Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into benelan/constraint-va…
Browse files Browse the repository at this point in the history
…lidation-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)
  • Loading branch information
benelan committed Apr 30, 2024
2 parents 0596ea8 + f110d63 commit 255febf
Show file tree
Hide file tree
Showing 65 changed files with 3,509 additions and 22 deletions.
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/calcite-components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
},
"devDependencies": {
"@esri/calcite-design-tokens": "^2.2.0-next.0",
"@esri/calcite-ui-icons": "3.27.8",
"@esri/calcite-ui-icons": "3.27.9",
"@esri/eslint-plugin-calcite-components": "^1.2.0-next.1",
"@stencil-community/eslint-plugin": "0.7.2",
"@stencil-community/postcss": "2.2.0",
Expand Down
179 changes: 179 additions & 0 deletions packages/calcite-components/src/components.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ import { BlockSectionMessages } from "./components/block-section/assets/block-se
import { ButtonAlignment, DropdownIconType } from "./components/button/interfaces";
import { ButtonMessages } from "./components/button/assets/button/t9n";
import { CardMessages } from "./components/card/assets/card/t9n";
import { ArrowType, AutoplayType } from "./components/carousel/interfaces";
import { CarouselMessages } from "./components/carousel/assets/carousel/t9n";
import { MutableValidityState } from "./utils/form";
import { ChipMessages } from "./components/chip/assets/chip/t9n";
import { ColorValue, InternalColor } from "./components/color-picker/interfaces";
Expand Down Expand Up @@ -111,6 +113,8 @@ export { BlockSectionMessages } from "./components/block-section/assets/block-se
export { ButtonAlignment, DropdownIconType } from "./components/button/interfaces";
export { ButtonMessages } from "./components/button/assets/button/t9n";
export { CardMessages } from "./components/card/assets/card/t9n";
export { ArrowType, AutoplayType } from "./components/carousel/interfaces";
export { CarouselMessages } from "./components/carousel/assets/carousel/t9n";
export { MutableValidityState } from "./utils/form";
export { ChipMessages } from "./components/chip/assets/chip/t9n";
export { ColorValue, InternalColor } from "./components/color-picker/interfaces";
Expand Down Expand Up @@ -828,6 +832,71 @@ export namespace Components {
*/
"setFocus": () => Promise<void>;
}
interface CalciteCarousel {
/**
* Specifies how and if the "previous" and "next" arrows are displayed.
*/
"arrowType": ArrowType;
/**
* 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.
*/
"autoplay": AutoplayType;
/**
* When `autoplay` is `true`, specifies in milliseconds the length of time to display each Carousel Item.
*/
"autoplayDuration": number;
/**
* Specifies if the component's controls are positioned absolutely on top of slotted Carousel Items.
*/
"controlOverlay": boolean;
/**
* When `true`, interaction is prevented and the component is displayed with lower opacity.
*/
"disabled": boolean;
/**
* Accessible name for the component.
*/
"label": string;
/**
* Use this property to override individual strings used by the component.
*/
"messageOverrides": Partial<CarouselMessages>;
/**
* Made into a prop for testing purposes only
*/
"messages": CarouselMessages;
/**
* Made into a prop for testing purposes only
*/
"paused": boolean;
/**
* Play the carousel. If `autoplay` is not enabled (initialized either to `true` or `"paused"`), these methods will have no effect.
*/
"play": () => Promise<void>;
/**
* The component's selected `calcite-carousel-item`.
* @readonly
*/
"selectedItem": HTMLCalciteCarouselItemElement;
/**
* Sets focus on the component.
*/
"setFocus": () => Promise<void>;
/**
* Stop the carousel. If `autoplay` is not enabled (initialized either to `true` or `"paused"`), these methods will have no effect.
*/
"stop": () => Promise<void>;
}
interface CalciteCarouselItem {
/**
* Accessible name for the component.
*/
"label": string;
/**
* When `true`, the component is selected.
*/
"selected": boolean;
}
interface CalciteCheckbox {
/**
* When `true`, the component is checked.
Expand Down Expand Up @@ -5552,6 +5621,10 @@ export interface CalciteCardGroupCustomEvent<T> extends CustomEvent<T> {
detail: T;
target: HTMLCalciteCardGroupElement;
}
export interface CalciteCarouselCustomEvent<T> extends CustomEvent<T> {
detail: T;
target: HTMLCalciteCarouselElement;
}
export interface CalciteCheckboxCustomEvent<T> extends CustomEvent<T> {
detail: T;
target: HTMLCalciteCheckboxElement;
Expand Down Expand Up @@ -6030,6 +6103,33 @@ declare global {
prototype: HTMLCalciteCardGroupElement;
new (): HTMLCalciteCardGroupElement;
};
interface HTMLCalciteCarouselElementEventMap {
"calciteCarouselChange": void;
"calciteCarouselPlay": void;
"calciteCarouselStop": void;
"calciteCarouselPause": void;
"calciteCarouselResume": void;
}
interface HTMLCalciteCarouselElement extends Components.CalciteCarousel, HTMLStencilElement {
addEventListener<K extends keyof HTMLCalciteCarouselElementEventMap>(type: K, listener: (this: HTMLCalciteCarouselElement, ev: CalciteCarouselCustomEvent<HTMLCalciteCarouselElementEventMap[K]>) => any, options?: boolean | AddEventListenerOptions): void;
addEventListener<K extends keyof DocumentEventMap>(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
removeEventListener<K extends keyof HTMLCalciteCarouselElementEventMap>(type: K, listener: (this: HTMLCalciteCarouselElement, ev: CalciteCarouselCustomEvent<HTMLCalciteCarouselElementEventMap[K]>) => any, options?: boolean | EventListenerOptions): void;
removeEventListener<K extends keyof DocumentEventMap>(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
removeEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
}
var HTMLCalciteCarouselElement: {
prototype: HTMLCalciteCarouselElement;
new (): HTMLCalciteCarouselElement;
};
interface HTMLCalciteCarouselItemElement extends Components.CalciteCarouselItem, HTMLStencilElement {
}
var HTMLCalciteCarouselItemElement: {
prototype: HTMLCalciteCarouselItemElement;
new (): HTMLCalciteCarouselItemElement;
};
interface HTMLCalciteCheckboxElementEventMap {
"calciteInternalCheckboxBlur": boolean;
"calciteCheckboxChange": void;
Expand Down Expand Up @@ -7513,6 +7613,8 @@ declare global {
"calcite-button": HTMLCalciteButtonElement;
"calcite-card": HTMLCalciteCardElement;
"calcite-card-group": HTMLCalciteCardGroupElement;
"calcite-carousel": HTMLCalciteCarouselElement;
"calcite-carousel-item": HTMLCalciteCarouselItemElement;
"calcite-checkbox": HTMLCalciteCheckboxElement;
"calcite-chip": HTMLCalciteChipElement;
"calcite-chip-group": HTMLCalciteChipGroupElement;
Expand Down Expand Up @@ -8281,6 +8383,79 @@ declare namespace LocalJSX {
SelectionMode
>;
}
interface CalciteCarousel {
/**
* Specifies how and if the "previous" and "next" arrows are displayed.
*/
"arrowType"?: ArrowType;
/**
* 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.
*/
"autoplay"?: AutoplayType;
/**
* When `autoplay` is `true`, specifies in milliseconds the length of time to display each Carousel Item.
*/
"autoplayDuration"?: number;
/**
* Specifies if the component's controls are positioned absolutely on top of slotted Carousel Items.
*/
"controlOverlay"?: boolean;
/**
* When `true`, interaction is prevented and the component is displayed with lower opacity.
*/
"disabled"?: boolean;
/**
* Accessible name for the component.
*/
"label": string;
/**
* Use this property to override individual strings used by the component.
*/
"messageOverrides"?: Partial<CarouselMessages>;
/**
* Made into a prop for testing purposes only
*/
"messages"?: CarouselMessages;
/**
* Fires when the selected `calcite-carousel-item` changes.
*/
"onCalciteCarouselChange"?: (event: CalciteCarouselCustomEvent<void>) => void;
/**
* Fires when the carousel autoplay state pauses due to a user hovering over the component or focusing on the component or slotted content
*/
"onCalciteCarouselPause"?: (event: CalciteCarouselCustomEvent<void>) => void;
/**
* Fires when the carousel autoplay is invoked by the user.
*/
"onCalciteCarouselPlay"?: (event: CalciteCarouselCustomEvent<void>) => void;
/**
* 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
*/
"onCalciteCarouselResume"?: (event: CalciteCarouselCustomEvent<void>) => void;
/**
* Fires when the carousel autoplay state is stopped by a user.
*/
"onCalciteCarouselStop"?: (event: CalciteCarouselCustomEvent<void>) => void;
/**
* Made into a prop for testing purposes only
*/
"paused"?: boolean;
/**
* The component's selected `calcite-carousel-item`.
* @readonly
*/
"selectedItem"?: HTMLCalciteCarouselItemElement;
}
interface CalciteCarouselItem {
/**
* Accessible name for the component.
*/
"label": string;
/**
* When `true`, the component is selected.
*/
"selected"?: boolean;
}
interface CalciteCheckbox {
/**
* When `true`, the component is checked.
Expand Down Expand Up @@ -13215,6 +13390,8 @@ declare namespace LocalJSX {
"calcite-button": CalciteButton;
"calcite-card": CalciteCard;
"calcite-card-group": CalciteCardGroup;
"calcite-carousel": CalciteCarousel;
"calcite-carousel-item": CalciteCarouselItem;
"calcite-checkbox": CalciteCheckbox;
"calcite-chip": CalciteChip;
"calcite-chip-group": CalciteChipGroup;
Expand Down Expand Up @@ -13329,6 +13506,8 @@ declare module "@stencil/core" {
"calcite-button": LocalJSX.CalciteButton & JSXBase.HTMLAttributes<HTMLCalciteButtonElement>;
"calcite-card": LocalJSX.CalciteCard & JSXBase.HTMLAttributes<HTMLCalciteCardElement>;
"calcite-card-group": LocalJSX.CalciteCardGroup & JSXBase.HTMLAttributes<HTMLCalciteCardGroupElement>;
"calcite-carousel": LocalJSX.CalciteCarousel & JSXBase.HTMLAttributes<HTMLCalciteCarouselElement>;
"calcite-carousel-item": LocalJSX.CalciteCarouselItem & JSXBase.HTMLAttributes<HTMLCalciteCarouselItemElement>;
"calcite-checkbox": LocalJSX.CalciteCheckbox & JSXBase.HTMLAttributes<HTMLCalciteCheckboxElement>;
"calcite-chip": LocalJSX.CalciteChip & JSXBase.HTMLAttributes<HTMLCalciteChipElement>;
"calcite-chip-group": LocalJSX.CalciteChipGroup & JSXBase.HTMLAttributes<HTMLCalciteChipGroupElement>;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { accessible, hidden, renders } from "../../tests/commonTests";

describe("calcite-carousel-item", () => {
describe("renders", () => {
renders("<calcite-carousel-item selected></calcite-carousel-item>", {
display: "flex",
});
});

describe("honors hidden attribute", () => {
hidden("calcite-carousel-item");
});

describe("accessible", () => {
accessible("calcite-carousel-item");
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
:host {
@apply flex;
}

.container {
@apply hidden;
inline-size: var(--calcite-container-size-content-fluid);
}

:host([selected]) .container {
@apply block;
}

@include base-component();
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
import { Component, Element, h, Host, Prop, VNode } from "@stencil/core";
import { guid } from "../../utils/guid";
import { CSS } from "./resources";

/**
* @slot - A slot for adding content.
*/
@Component({
tag: "calcite-carousel-item",
styleUrl: "carousel-item.scss",
shadow: true,
})
export class CarouselItem {
// --------------------------------------------------------------------------
//
// Properties
//
// --------------------------------------------------------------------------

/**
* Accessible name for the component.
*/
@Prop() label!: string;

/**
* When `true`, the component is selected.
*/
@Prop({ reflect: true }) selected = false;

// --------------------------------------------------------------------------
//
// Private Properties
//
// --------------------------------------------------------------------------

@Element() el: HTMLCalciteCarouselItemElement;

private guid = `calcite-carousel-item-${guid()}`;

// --------------------------------------------------------------------------
//
// Render Methods
//
// --------------------------------------------------------------------------

render(): VNode {
const id = this.el.id || this.guid;
return (
<Host id={id}>
<div
aria-label={this.label}
class={{ [CSS.container]: true, [CSS.selected]: this.selected }}
role="tabpanel"
>
<slot />
</div>
</Host>
);
}
}
32 changes: 32 additions & 0 deletions packages/calcite-components/src/components/carousel-item/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# calcite-carousel-item

<!-- Auto Generated Below -->

## Properties

| Property | Attribute | Description | Type | Default |
| -------------------- | ---------- | ---------------------------------------------------------------------------------------- | --------------------- | ----------- |
| `active` | `active` | When `true`, the component is active if it has a parent `calcite-carousel`. | `boolean` | `false` |
| `disabled` | `disabled` | When `true`, interaction is prevented and the component is displayed with lower opacity. | `boolean` | `false` |
| `label` *(required)* | `label` | The component label text. | `string` | `undefined` |
| `messageOverrides` | -- | Use this property to override individual strings used by the component. | `{ close?: string; }` | `undefined` |

## Methods

### `setFocus() => Promise<void>`

Sets focus on the component.

#### Returns

Type: `Promise<void>`

## Slots

| Slot | Description |
| ---- | -------------------------- |
| | A slot for adding content. |

---

*Built with [StencilJS](https://stenciljs.com/)*

0 comments on commit 255febf

Please sign in to comment.