Skip to content

Commit 255febf

Browse files
committed
Merge remote-tracking branch 'origin/main' into benelan/constraint-validation-apis
* origin/main: build(deps): update dependency @esri/calcite-ui-icons to v3.27.9 (#9216) fix(combobox, input-time-zone): improve readOnly behavior and styling (#9222) feat(carousel): Add Carousel and Carousel Item components (#8995)
2 parents 0596ea8 + f110d63 commit 255febf

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+3509
-22
lines changed

package-lock.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/calcite-components/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@
7575
},
7676
"devDependencies": {
7777
"@esri/calcite-design-tokens": "^2.2.0-next.0",
78-
"@esri/calcite-ui-icons": "3.27.8",
78+
"@esri/calcite-ui-icons": "3.27.9",
7979
"@esri/eslint-plugin-calcite-components": "^1.2.0-next.1",
8080
"@stencil-community/eslint-plugin": "0.7.2",
8181
"@stencil-community/postcss": "2.2.0",

packages/calcite-components/src/components.d.ts

Lines changed: 179 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ import { BlockSectionMessages } from "./components/block-section/assets/block-se
2323
import { ButtonAlignment, DropdownIconType } from "./components/button/interfaces";
2424
import { ButtonMessages } from "./components/button/assets/button/t9n";
2525
import { CardMessages } from "./components/card/assets/card/t9n";
26+
import { ArrowType, AutoplayType } from "./components/carousel/interfaces";
27+
import { CarouselMessages } from "./components/carousel/assets/carousel/t9n";
2628
import { MutableValidityState } from "./utils/form";
2729
import { ChipMessages } from "./components/chip/assets/chip/t9n";
2830
import { ColorValue, InternalColor } from "./components/color-picker/interfaces";
@@ -111,6 +113,8 @@ export { BlockSectionMessages } from "./components/block-section/assets/block-se
111113
export { ButtonAlignment, DropdownIconType } from "./components/button/interfaces";
112114
export { ButtonMessages } from "./components/button/assets/button/t9n";
113115
export { CardMessages } from "./components/card/assets/card/t9n";
116+
export { ArrowType, AutoplayType } from "./components/carousel/interfaces";
117+
export { CarouselMessages } from "./components/carousel/assets/carousel/t9n";
114118
export { MutableValidityState } from "./utils/form";
115119
export { ChipMessages } from "./components/chip/assets/chip/t9n";
116120
export { ColorValue, InternalColor } from "./components/color-picker/interfaces";
@@ -828,6 +832,71 @@ export namespace Components {
828832
*/
829833
"setFocus": () => Promise<void>;
830834
}
835+
interface CalciteCarousel {
836+
/**
837+
* Specifies how and if the "previous" and "next" arrows are displayed.
838+
*/
839+
"arrowType": ArrowType;
840+
/**
841+
* When `true`, the carousel will autoplay and controls will be displayed. When "paused" at time of initialization, the carousel will not autoplay, but controls will be displayed.
842+
*/
843+
"autoplay": AutoplayType;
844+
/**
845+
* When `autoplay` is `true`, specifies in milliseconds the length of time to display each Carousel Item.
846+
*/
847+
"autoplayDuration": number;
848+
/**
849+
* Specifies if the component's controls are positioned absolutely on top of slotted Carousel Items.
850+
*/
851+
"controlOverlay": boolean;
852+
/**
853+
* When `true`, interaction is prevented and the component is displayed with lower opacity.
854+
*/
855+
"disabled": boolean;
856+
/**
857+
* Accessible name for the component.
858+
*/
859+
"label": string;
860+
/**
861+
* Use this property to override individual strings used by the component.
862+
*/
863+
"messageOverrides": Partial<CarouselMessages>;
864+
/**
865+
* Made into a prop for testing purposes only
866+
*/
867+
"messages": CarouselMessages;
868+
/**
869+
* Made into a prop for testing purposes only
870+
*/
871+
"paused": boolean;
872+
/**
873+
* Play the carousel. If `autoplay` is not enabled (initialized either to `true` or `"paused"`), these methods will have no effect.
874+
*/
875+
"play": () => Promise<void>;
876+
/**
877+
* The component's selected `calcite-carousel-item`.
878+
* @readonly
879+
*/
880+
"selectedItem": HTMLCalciteCarouselItemElement;
881+
/**
882+
* Sets focus on the component.
883+
*/
884+
"setFocus": () => Promise<void>;
885+
/**
886+
* Stop the carousel. If `autoplay` is not enabled (initialized either to `true` or `"paused"`), these methods will have no effect.
887+
*/
888+
"stop": () => Promise<void>;
889+
}
890+
interface CalciteCarouselItem {
891+
/**
892+
* Accessible name for the component.
893+
*/
894+
"label": string;
895+
/**
896+
* When `true`, the component is selected.
897+
*/
898+
"selected": boolean;
899+
}
831900
interface CalciteCheckbox {
832901
/**
833902
* When `true`, the component is checked.
@@ -5552,6 +5621,10 @@ export interface CalciteCardGroupCustomEvent<T> extends CustomEvent<T> {
55525621
detail: T;
55535622
target: HTMLCalciteCardGroupElement;
55545623
}
5624+
export interface CalciteCarouselCustomEvent<T> extends CustomEvent<T> {
5625+
detail: T;
5626+
target: HTMLCalciteCarouselElement;
5627+
}
55555628
export interface CalciteCheckboxCustomEvent<T> extends CustomEvent<T> {
55565629
detail: T;
55575630
target: HTMLCalciteCheckboxElement;
@@ -6030,6 +6103,33 @@ declare global {
60306103
prototype: HTMLCalciteCardGroupElement;
60316104
new (): HTMLCalciteCardGroupElement;
60326105
};
6106+
interface HTMLCalciteCarouselElementEventMap {
6107+
"calciteCarouselChange": void;
6108+
"calciteCarouselPlay": void;
6109+
"calciteCarouselStop": void;
6110+
"calciteCarouselPause": void;
6111+
"calciteCarouselResume": void;
6112+
}
6113+
interface HTMLCalciteCarouselElement extends Components.CalciteCarousel, HTMLStencilElement {
6114+
addEventListener<K extends keyof HTMLCalciteCarouselElementEventMap>(type: K, listener: (this: HTMLCalciteCarouselElement, ev: CalciteCarouselCustomEvent<HTMLCalciteCarouselElementEventMap[K]>) => any, options?: boolean | AddEventListenerOptions): void;
6115+
addEventListener<K extends keyof DocumentEventMap>(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
6116+
addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
6117+
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
6118+
removeEventListener<K extends keyof HTMLCalciteCarouselElementEventMap>(type: K, listener: (this: HTMLCalciteCarouselElement, ev: CalciteCarouselCustomEvent<HTMLCalciteCarouselElementEventMap[K]>) => any, options?: boolean | EventListenerOptions): void;
6119+
removeEventListener<K extends keyof DocumentEventMap>(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
6120+
removeEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
6121+
removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
6122+
}
6123+
var HTMLCalciteCarouselElement: {
6124+
prototype: HTMLCalciteCarouselElement;
6125+
new (): HTMLCalciteCarouselElement;
6126+
};
6127+
interface HTMLCalciteCarouselItemElement extends Components.CalciteCarouselItem, HTMLStencilElement {
6128+
}
6129+
var HTMLCalciteCarouselItemElement: {
6130+
prototype: HTMLCalciteCarouselItemElement;
6131+
new (): HTMLCalciteCarouselItemElement;
6132+
};
60336133
interface HTMLCalciteCheckboxElementEventMap {
60346134
"calciteInternalCheckboxBlur": boolean;
60356135
"calciteCheckboxChange": void;
@@ -7513,6 +7613,8 @@ declare global {
75137613
"calcite-button": HTMLCalciteButtonElement;
75147614
"calcite-card": HTMLCalciteCardElement;
75157615
"calcite-card-group": HTMLCalciteCardGroupElement;
7616+
"calcite-carousel": HTMLCalciteCarouselElement;
7617+
"calcite-carousel-item": HTMLCalciteCarouselItemElement;
75167618
"calcite-checkbox": HTMLCalciteCheckboxElement;
75177619
"calcite-chip": HTMLCalciteChipElement;
75187620
"calcite-chip-group": HTMLCalciteChipGroupElement;
@@ -8281,6 +8383,79 @@ declare namespace LocalJSX {
82818383
SelectionMode
82828384
>;
82838385
}
8386+
interface CalciteCarousel {
8387+
/**
8388+
* Specifies how and if the "previous" and "next" arrows are displayed.
8389+
*/
8390+
"arrowType"?: ArrowType;
8391+
/**
8392+
* When `true`, the carousel will autoplay and controls will be displayed. When "paused" at time of initialization, the carousel will not autoplay, but controls will be displayed.
8393+
*/
8394+
"autoplay"?: AutoplayType;
8395+
/**
8396+
* When `autoplay` is `true`, specifies in milliseconds the length of time to display each Carousel Item.
8397+
*/
8398+
"autoplayDuration"?: number;
8399+
/**
8400+
* Specifies if the component's controls are positioned absolutely on top of slotted Carousel Items.
8401+
*/
8402+
"controlOverlay"?: boolean;
8403+
/**
8404+
* When `true`, interaction is prevented and the component is displayed with lower opacity.
8405+
*/
8406+
"disabled"?: boolean;
8407+
/**
8408+
* Accessible name for the component.
8409+
*/
8410+
"label": string;
8411+
/**
8412+
* Use this property to override individual strings used by the component.
8413+
*/
8414+
"messageOverrides"?: Partial<CarouselMessages>;
8415+
/**
8416+
* Made into a prop for testing purposes only
8417+
*/
8418+
"messages"?: CarouselMessages;
8419+
/**
8420+
* Fires when the selected `calcite-carousel-item` changes.
8421+
*/
8422+
"onCalciteCarouselChange"?: (event: CalciteCarouselCustomEvent<void>) => void;
8423+
/**
8424+
* Fires when the carousel autoplay state pauses due to a user hovering over the component or focusing on the component or slotted content
8425+
*/
8426+
"onCalciteCarouselPause"?: (event: CalciteCarouselCustomEvent<void>) => void;
8427+
/**
8428+
* Fires when the carousel autoplay is invoked by the user.
8429+
*/
8430+
"onCalciteCarouselPlay"?: (event: CalciteCarouselCustomEvent<void>) => void;
8431+
/**
8432+
* Fires when the carousel autoplay state resumes due to a user no longer hovering over the component or focusing on the component or slotted content
8433+
*/
8434+
"onCalciteCarouselResume"?: (event: CalciteCarouselCustomEvent<void>) => void;
8435+
/**
8436+
* Fires when the carousel autoplay state is stopped by a user.
8437+
*/
8438+
"onCalciteCarouselStop"?: (event: CalciteCarouselCustomEvent<void>) => void;
8439+
/**
8440+
* Made into a prop for testing purposes only
8441+
*/
8442+
"paused"?: boolean;
8443+
/**
8444+
* The component's selected `calcite-carousel-item`.
8445+
* @readonly
8446+
*/
8447+
"selectedItem"?: HTMLCalciteCarouselItemElement;
8448+
}
8449+
interface CalciteCarouselItem {
8450+
/**
8451+
* Accessible name for the component.
8452+
*/
8453+
"label": string;
8454+
/**
8455+
* When `true`, the component is selected.
8456+
*/
8457+
"selected"?: boolean;
8458+
}
82848459
interface CalciteCheckbox {
82858460
/**
82868461
* When `true`, the component is checked.
@@ -13215,6 +13390,8 @@ declare namespace LocalJSX {
1321513390
"calcite-button": CalciteButton;
1321613391
"calcite-card": CalciteCard;
1321713392
"calcite-card-group": CalciteCardGroup;
13393+
"calcite-carousel": CalciteCarousel;
13394+
"calcite-carousel-item": CalciteCarouselItem;
1321813395
"calcite-checkbox": CalciteCheckbox;
1321913396
"calcite-chip": CalciteChip;
1322013397
"calcite-chip-group": CalciteChipGroup;
@@ -13329,6 +13506,8 @@ declare module "@stencil/core" {
1332913506
"calcite-button": LocalJSX.CalciteButton & JSXBase.HTMLAttributes<HTMLCalciteButtonElement>;
1333013507
"calcite-card": LocalJSX.CalciteCard & JSXBase.HTMLAttributes<HTMLCalciteCardElement>;
1333113508
"calcite-card-group": LocalJSX.CalciteCardGroup & JSXBase.HTMLAttributes<HTMLCalciteCardGroupElement>;
13509+
"calcite-carousel": LocalJSX.CalciteCarousel & JSXBase.HTMLAttributes<HTMLCalciteCarouselElement>;
13510+
"calcite-carousel-item": LocalJSX.CalciteCarouselItem & JSXBase.HTMLAttributes<HTMLCalciteCarouselItemElement>;
1333213511
"calcite-checkbox": LocalJSX.CalciteCheckbox & JSXBase.HTMLAttributes<HTMLCalciteCheckboxElement>;
1333313512
"calcite-chip": LocalJSX.CalciteChip & JSXBase.HTMLAttributes<HTMLCalciteChipElement>;
1333413513
"calcite-chip-group": LocalJSX.CalciteChipGroup & JSXBase.HTMLAttributes<HTMLCalciteChipGroupElement>;
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import { accessible, hidden, renders } from "../../tests/commonTests";
2+
3+
describe("calcite-carousel-item", () => {
4+
describe("renders", () => {
5+
renders("<calcite-carousel-item selected></calcite-carousel-item>", {
6+
display: "flex",
7+
});
8+
});
9+
10+
describe("honors hidden attribute", () => {
11+
hidden("calcite-carousel-item");
12+
});
13+
14+
describe("accessible", () => {
15+
accessible("calcite-carousel-item");
16+
});
17+
});
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
:host {
2+
@apply flex;
3+
}
4+
5+
.container {
6+
@apply hidden;
7+
inline-size: var(--calcite-container-size-content-fluid);
8+
}
9+
10+
:host([selected]) .container {
11+
@apply block;
12+
}
13+
14+
@include base-component();
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
import { Component, Element, h, Host, Prop, VNode } from "@stencil/core";
2+
import { guid } from "../../utils/guid";
3+
import { CSS } from "./resources";
4+
5+
/**
6+
* @slot - A slot for adding content.
7+
*/
8+
@Component({
9+
tag: "calcite-carousel-item",
10+
styleUrl: "carousel-item.scss",
11+
shadow: true,
12+
})
13+
export class CarouselItem {
14+
// --------------------------------------------------------------------------
15+
//
16+
// Properties
17+
//
18+
// --------------------------------------------------------------------------
19+
20+
/**
21+
* Accessible name for the component.
22+
*/
23+
@Prop() label!: string;
24+
25+
/**
26+
* When `true`, the component is selected.
27+
*/
28+
@Prop({ reflect: true }) selected = false;
29+
30+
// --------------------------------------------------------------------------
31+
//
32+
// Private Properties
33+
//
34+
// --------------------------------------------------------------------------
35+
36+
@Element() el: HTMLCalciteCarouselItemElement;
37+
38+
private guid = `calcite-carousel-item-${guid()}`;
39+
40+
// --------------------------------------------------------------------------
41+
//
42+
// Render Methods
43+
//
44+
// --------------------------------------------------------------------------
45+
46+
render(): VNode {
47+
const id = this.el.id || this.guid;
48+
return (
49+
<Host id={id}>
50+
<div
51+
aria-label={this.label}
52+
class={{ [CSS.container]: true, [CSS.selected]: this.selected }}
53+
role="tabpanel"
54+
>
55+
<slot />
56+
</div>
57+
</Host>
58+
);
59+
}
60+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# calcite-carousel-item
2+
3+
<!-- Auto Generated Below -->
4+
5+
## Properties
6+
7+
| Property | Attribute | Description | Type | Default |
8+
| -------------------- | ---------- | ---------------------------------------------------------------------------------------- | --------------------- | ----------- |
9+
| `active` | `active` | When `true`, the component is active if it has a parent `calcite-carousel`. | `boolean` | `false` |
10+
| `disabled` | `disabled` | When `true`, interaction is prevented and the component is displayed with lower opacity. | `boolean` | `false` |
11+
| `label` *(required)* | `label` | The component label text. | `string` | `undefined` |
12+
| `messageOverrides` | -- | Use this property to override individual strings used by the component. | `{ close?: string; }` | `undefined` |
13+
14+
## Methods
15+
16+
### `setFocus() => Promise<void>`
17+
18+
Sets focus on the component.
19+
20+
#### Returns
21+
22+
Type: `Promise<void>`
23+
24+
## Slots
25+
26+
| Slot | Description |
27+
| ---- | -------------------------- |
28+
| | A slot for adding content. |
29+
30+
---
31+
32+
*Built with [StencilJS](https://stenciljs.com/)*

0 commit comments

Comments
 (0)