Skip to content

feat(tile, tile-group): support single, multi, single-persist, none selection modes and icon and border selection appearances #9159

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 76 commits into from
Apr 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
76 commits
Select commit Hold shift + click to select a range
053360f
feat(tile): add selection, selection-mode, selection-appearance prope…
eriklharper Feb 24, 2024
442f607
making none the default selection mode
eriklharper Feb 26, 2024
a0f7257
adding selection props to tile-group, unnesting class css rules from …
eriklharper Feb 27, 2024
7b016ed
getting simple click to toggle selection working
eriklharper Mar 7, 2024
ac2ec1b
updating tile group demo page. Matching vertical samples with horizo…
eriklharper Mar 8, 2024
96ce94e
adding single-persist to demo
eriklharper Mar 8, 2024
30ceba9
emitting basic tile change event only when the selected state actuall…
eriklharper Mar 8, 2024
68eed40
Merge branch 'main' of github.com:Esri/calcite-design-system into eri…
eriklharper Mar 25, 2024
24c0762
adding aria-label and role to tile-group to match pattern in chip-group
eriklharper Mar 25, 2024
8717a5b
adding interactive prop to Tile to match patterns elsewhere, renaming…
eriklharper Mar 25, 2024
f5f9275
Merge branch 'main' of github.com:Esri/calcite-design-system into eri…
eriklharper Mar 29, 2024
45959c1
Merge branch 'main' of github.com:Esri/calcite-design-system into eri…
eriklharper Apr 2, 2024
427eb09
Reorganizing the Tile layout markup and styles to float the radio/che…
eriklharper Apr 3, 2024
d952b73
Merge branch 'main' of github.com:Esri/calcite-design-system into eri…
eriklharper Apr 3, 2024
34896cb
single, multiple and single-persist selection is working!
eriklharper Apr 3, 2024
2d1de4d
adding keyboard select emitting, adding aria attributes to match chip
eriklharper Apr 8, 2024
4e6f473
basic focusing behavior, need to add styles
eriklharper Apr 10, 2024
c5e5586
inverting some embed styles to simplify them for later removal
eriklharper Apr 10, 2024
31b64f6
adding focus borders, removing unused css class
eriklharper Apr 10, 2024
231ebc6
selection and focus styles
eriklharper Apr 10, 2024
9d1188c
updating href styling and adding support for disabled links
eriklharper Apr 11, 2024
84b1486
focus links with keyboard
eriklharper Apr 11, 2024
3cb0779
removing host click listener in favor of inline on the container div,…
eriklharper Apr 11, 2024
6184efd
removing unused selectable css resource
eriklharper Apr 11, 2024
c232f64
removing old cursor pointer that's not needed
eriklharper Apr 11, 2024
81d4dac
first start to selection appearance border
eriklharper Apr 15, 2024
feb3b47
using an inset box-shadow instead of a border handles better
eriklharper Apr 16, 2024
52238d2
selection appearance border in vertical layout
eriklharper Apr 16, 2024
b5036cd
inset focus borders ftw!
eriklharper Apr 17, 2024
a8d385f
using a box-shadow for focus ring around radio/checkbox icon
eriklharper Apr 18, 2024
dc3eb54
adjusting hover focus shadow for small scale
eriklharper Apr 18, 2024
a03821b
perfectly centering the selection icon hover shadow
eriklharper Apr 18, 2024
ffd773a
removing ref from name that gets a ref to the slot element
eriklharper Apr 19, 2024
5102c4e
alpha ordering
eriklharper Apr 19, 2024
a3ceb03
Merge branch 'main' of github.com:Esri/calcite-design-system into eri…
eriklharper Apr 22, 2024
2c4308b
fixing broken disabled test
eriklharper Apr 22, 2024
d6aea01
adding more defaults tests
eriklharper Apr 22, 2024
8346f96
more tests and some updates to default prop settings
eriklharper Apr 22, 2024
0fb0982
Adding single, single-persist, multiple tests that use an assertSelec…
eriklharper Apr 23, 2024
a002e08
adding none selection mode test
eriklharper Apr 23, 2024
8e9b33d
moar tests ported over from chip-group
eriklharper Apr 23, 2024
1e91274
removing unused focused prop from Tile, deprecating active prop
eriklharper Apr 24, 2024
3986ba8
adding deprecation messages for large visual Tile variant
eriklharper Apr 24, 2024
574d4e6
tile e2e tests using chip tests as a guide
eriklharper Apr 24, 2024
6f2281e
Merge branch 'main' of github.com:Esri/calcite-design-system into eri…
eriklharper Apr 24, 2024
e5bb959
adding onclick test
eriklharper Apr 25, 2024
e55d56c
copying tile-group demo html over to all variants story
eriklharper Apr 25, 2024
1473008
Merge branch 'main' into eriklharper/tile-selection
eriklharper Apr 25, 2024
a01e7a1
moving selectable tests into utils and restoring the default name. W…
eriklharper Apr 26, 2024
3223400
Merge branch 'eriklharper/tile-selection' of github.com:Esri/calcite-…
eriklharper Apr 26, 2024
0152b8d
removing import from previous commit
eriklharper Apr 26, 2024
4a07dac
updating demo html and story to visually capture icons above the fold…
eriklharper Apr 26, 2024
5e19acf
removing unnecessary use of knobs in test only stories for Tile
eriklharper Apr 26, 2024
335f1bd
review comments
eriklharper Apr 29, 2024
c6bbb90
removing duplicate checks for selected item length
eriklharper Apr 29, 2024
58e1267
refactoring focus checks to use isElementFocused util
eriklharper Apr 29, 2024
1486a23
better name for test
eriklharper Apr 29, 2024
f346af5
addressing https://github.com/Esri/calcite-design-system/pull/9159#di…
eriklharper Apr 29, 2024
7583587
addressing https://github.com/Esri/calcite-design-system/pull/9159#di…
eriklharper Apr 29, 2024
4bc4500
addressing https://github.com/Esri/calcite-design-system/pull/9159#di…
eriklharper Apr 29, 2024
102791d
addressing https://github.com/Esri/calcite-design-system/pull/9159#di…
eriklharper Apr 29, 2024
567a9ca
more meaningful test name
eriklharper Apr 29, 2024
efa6e22
addresses https://github.com/Esri/calcite-design-system/pull/9159#dis…
eriklharper Apr 29, 2024
f6d470d
test refactors based on comments
eriklharper Apr 29, 2024
03b0c76
moar test refactor
eriklharper Apr 29, 2024
daa03e6
removing native browser click test
eriklharper Apr 29, 2024
8ddaf11
reverting accessible util helper changes
eriklharper Apr 29, 2024
5be1db5
addressing https://github.com/Esri/calcite-design-system/pull/9159#di…
eriklharper Apr 30, 2024
f81ee74
https://github.com/Esri/calcite-design-system/pull/9159#discussion_r1…
eriklharper Apr 30, 2024
00b3c6a
https://github.com/Esri/calcite-design-system/pull/9159#discussion_r1…
eriklharper Apr 30, 2024
0049260
addressing https://github.com/Esri/calcite-design-system/pull/9159#di…
eriklharper Apr 30, 2024
1e8c1df
addressing https://github.com/Esri/calcite-design-system/pull/9159#di…
eriklharper Apr 30, 2024
38fcbb0
updating hover, focus and select styles to only apply when interactive
eriklharper Apr 30, 2024
7d9e8a1
simplifying conditional https://github.com/Esri/calcite-design-system…
eriklharper Apr 30, 2024
bef4e2b
reverting gray hover box around selection icon in favor of blue icon …
eriklharper Apr 30, 2024
5757381
Merge branch 'main' into eriklharper/tile-selection
eriklharper Apr 30, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
152 changes: 142 additions & 10 deletions packages/calcite-components/src/components.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* It contains typing information for all components that exist in this project.
*/
import { HTMLStencilElement, JSXBase } from "@stencil/core/internal";
import { Alignment, Appearance, Columns, FlipContext, Kind, Layout, LogicalFlowPosition, Position, Scale, SelectionMode, Status, Width } from "./components/interfaces";
import { Alignment, Appearance, Columns, FlipContext, Kind, Layout, LogicalFlowPosition, Position, Scale, SelectionAppearance as SelectionAppearance1, SelectionMode, Status, Width } from "./components/interfaces";
import { RequestedItem } from "./components/accordion/interfaces";
import { RequestedItem as RequestedItem1 } from "./components/accordion-item/interfaces";
import { ActionMessages } from "./components/action/assets/action/t9n";
Expand Down Expand Up @@ -94,7 +94,7 @@ import { TipManagerMessages } from "./components/tip-manager/assets/tip-manager/
import { TreeItemSelectDetail } from "./components/tree-item/interfaces";
import { ValueListMessages } from "./components/value-list/assets/value-list/t9n";
import { ListItemAndHandle } from "./components/value-list-item/interfaces";
export { Alignment, Appearance, Columns, FlipContext, Kind, Layout, LogicalFlowPosition, Position, Scale, SelectionMode, Status, Width } from "./components/interfaces";
export { Alignment, Appearance, Columns, FlipContext, Kind, Layout, LogicalFlowPosition, Position, Scale, SelectionAppearance as SelectionAppearance1, SelectionMode, Status, Width } from "./components/interfaces";
export { RequestedItem } from "./components/accordion/interfaces";
export { RequestedItem as RequestedItem1 } from "./components/accordion-item/interfaces";
export { ActionMessages } from "./components/action/assets/action/t9n";
Expand Down Expand Up @@ -5071,6 +5071,7 @@ export namespace Components {
interface CalciteTile {
/**
* When `true`, the component is active.
* @deprecated
*/
"active": boolean;
/**
Expand All @@ -5090,10 +5091,6 @@ export namespace Components {
* @deprecated No longer necessary.
*/
"embed": boolean;
/**
* The focused state of the component.
*/
"focused": boolean;
/**
* The component header text, which displays between the icon and description.
*/
Expand All @@ -5110,16 +5107,51 @@ export namespace Components {
* When `true`, the icon will be flipped when the element direction is right-to-left (`"rtl"`).
*/
"iconFlipRtl": boolean;
/**
* When true, enables the tile to be focused, and allows the `calciteTileSelect` to emit. This is set to `true` by a parent Tile Group component.
*/
"interactive": boolean;
/**
* Accessible name for the component.
*/
"label": string;
/**
* Defines the layout of the component. Use `"horizontal"` for rows, and `"vertical"` for a single column.
*/
"layout": Exclude<Layout, "grid">;
/**
* Specifies the size of the component.
*/
"scale": Scale;
/**
* When `true` and the parent's `selectionMode` is `"single"`, `"single-persist"', or `"multiple"`, the component is selected.
*/
"selected": boolean;
/**
* Specifies the selection appearance, where: - `"icon"` (displays a checkmark or dot), or - `"border"` (displays a border). This property is set by the parent tile-group.
*/
"selectionAppearance": SelectionAppearance1;
/**
* Specifies the selection mode, where: - `"multiple"` (allows any number of selected items), - `"single"` (allows only one selected item), - `"single-persist"` (allows only one selected item and prevents de-selection), - `"none"` (allows no selected items). This property is set by the parent tile-group.
*/
"selectionMode": Extract<
"multiple" | "none" | "single" | "single-persist",
SelectionMode
>;
/**
* Sets focus on the component.
*/
"setFocus": () => Promise<void>;
}
interface CalciteTileGroup {
/**
* When `true`, interaction is prevented and the component is displayed with lower opacity.
*/
"disabled": boolean;
/**
* Accessible name for the component.
*/
"label": string;
/**
* Defines the layout of the component. Use `"horizontal"` for rows, and `"vertical"` for a single column.
*/
Expand All @@ -5128,6 +5160,22 @@ export namespace Components {
* Specifies the size of the component.
*/
"scale": Scale;
/**
* Specifies the component's selected items.
* @readonly
*/
"selectedItems": HTMLCalciteTileElement[];
/**
* Specifies the selection appearance, where: - `"icon"` (displays a checkmark or dot), or - `"border"` (displays a border).
*/
"selectionAppearance": SelectionAppearance1;
/**
* Specifies the selection mode, where: - `"multiple"` (allows any number of selected items), - `"single"` (allows only one selected item), - `"single-persist"` (allows only one selected item and prevents de-selection), - `"none"` (allows no selected items).
*/
"selectionMode": Extract<
"multiple" | "none" | "single" | "single-persist",
SelectionMode
>;
}
interface CalciteTileSelect {
/**
Expand Down Expand Up @@ -5793,6 +5841,14 @@ export interface CalciteTextAreaCustomEvent<T> extends CustomEvent<T> {
detail: T;
target: HTMLCalciteTextAreaElement;
}
export interface CalciteTileCustomEvent<T> extends CustomEvent<T> {
detail: T;
target: HTMLCalciteTileElement;
}
export interface CalciteTileGroupCustomEvent<T> extends CustomEvent<T> {
detail: T;
target: HTMLCalciteTileGroupElement;
}
export interface CalciteTileSelectCustomEvent<T> extends CustomEvent<T> {
detail: T;
target: HTMLCalciteTileSelectElement;
Expand Down Expand Up @@ -7333,13 +7389,36 @@ declare global {
prototype: HTMLCalciteTextAreaElement;
new (): HTMLCalciteTextAreaElement;
};
interface HTMLCalciteTileElementEventMap {
"calciteInternalTileKeyEvent": KeyboardEvent;
"calciteTileSelect": void;
}
interface HTMLCalciteTileElement extends Components.CalciteTile, HTMLStencilElement {
addEventListener<K extends keyof HTMLCalciteTileElementEventMap>(type: K, listener: (this: HTMLCalciteTileElement, ev: CalciteTileCustomEvent<HTMLCalciteTileElementEventMap[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 HTMLCalciteTileElementEventMap>(type: K, listener: (this: HTMLCalciteTileElement, ev: CalciteTileCustomEvent<HTMLCalciteTileElementEventMap[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 HTMLCalciteTileElement: {
prototype: HTMLCalciteTileElement;
new (): HTMLCalciteTileElement;
};
interface HTMLCalciteTileGroupElementEventMap {
"calciteTileGroupSelect": void;
}
interface HTMLCalciteTileGroupElement extends Components.CalciteTileGroup, HTMLStencilElement {
addEventListener<K extends keyof HTMLCalciteTileGroupElementEventMap>(type: K, listener: (this: HTMLCalciteTileGroupElement, ev: CalciteTileGroupCustomEvent<HTMLCalciteTileGroupElementEventMap[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 HTMLCalciteTileGroupElementEventMap>(type: K, listener: (this: HTMLCalciteTileGroupElement, ev: CalciteTileGroupCustomEvent<HTMLCalciteTileGroupElementEventMap[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 HTMLCalciteTileGroupElement: {
prototype: HTMLCalciteTileGroupElement;
Expand Down Expand Up @@ -12777,6 +12856,7 @@ declare namespace LocalJSX {
interface CalciteTile {
/**
* When `true`, the component is active.
* @deprecated
*/
"active"?: boolean;
/**
Expand All @@ -12796,10 +12876,6 @@ declare namespace LocalJSX {
* @deprecated No longer necessary.
*/
"embed"?: boolean;
/**
* The focused state of the component.
*/
"focused"?: boolean;
/**
* The component header text, which displays between the icon and description.
*/
Expand All @@ -12816,24 +12892,80 @@ declare namespace LocalJSX {
* When `true`, the icon will be flipped when the element direction is right-to-left (`"rtl"`).
*/
"iconFlipRtl"?: boolean;
/**
* When true, enables the tile to be focused, and allows the `calciteTileSelect` to emit. This is set to `true` by a parent Tile Group component.
*/
"interactive"?: boolean;
/**
* Accessible name for the component.
*/
"label"?: string;
/**
* Defines the layout of the component. Use `"horizontal"` for rows, and `"vertical"` for a single column.
*/
"layout"?: Exclude<Layout, "grid">;
"onCalciteInternalTileKeyEvent"?: (event: CalciteTileCustomEvent<KeyboardEvent>) => void;
/**
* Fires when the selected state of the component changes.
*/
"onCalciteTileSelect"?: (event: CalciteTileCustomEvent<void>) => void;
/**
* Specifies the size of the component.
*/
"scale"?: Scale;
/**
* When `true` and the parent's `selectionMode` is `"single"`, `"single-persist"', or `"multiple"`, the component is selected.
*/
"selected"?: boolean;
/**
* Specifies the selection appearance, where: - `"icon"` (displays a checkmark or dot), or - `"border"` (displays a border). This property is set by the parent tile-group.
*/
"selectionAppearance"?: SelectionAppearance1;
/**
* Specifies the selection mode, where: - `"multiple"` (allows any number of selected items), - `"single"` (allows only one selected item), - `"single-persist"` (allows only one selected item and prevents de-selection), - `"none"` (allows no selected items). This property is set by the parent tile-group.
*/
"selectionMode"?: Extract<
"multiple" | "none" | "single" | "single-persist",
SelectionMode
>;
}
interface CalciteTileGroup {
/**
* When `true`, interaction is prevented and the component is displayed with lower opacity.
*/
"disabled"?: boolean;
/**
* Accessible name for the component.
*/
"label": string;
/**
* Defines the layout of the component. Use `"horizontal"` for rows, and `"vertical"` for a single column.
*/
"layout"?: Exclude<Layout, "grid">;
/**
* Fires when the component's selection changes.
*/
"onCalciteTileGroupSelect"?: (event: CalciteTileGroupCustomEvent<void>) => void;
/**
* Specifies the size of the component.
*/
"scale"?: Scale;
/**
* Specifies the component's selected items.
* @readonly
*/
"selectedItems"?: HTMLCalciteTileElement[];
/**
* Specifies the selection appearance, where: - `"icon"` (displays a checkmark or dot), or - `"border"` (displays a border).
*/
"selectionAppearance"?: SelectionAppearance1;
/**
* Specifies the selection mode, where: - `"multiple"` (allows any number of selected items), - `"single"` (allows only one selected item), - `"single-persist"` (allows only one selected item and prevents de-selection), - `"none"` (allows no selected items).
*/
"selectionMode"?: Extract<
"multiple" | "none" | "single" | "single-persist",
SelectionMode
>;
}
interface CalciteTileSelect {
/**
Expand Down
1 change: 1 addition & 0 deletions packages/calcite-components/src/components/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export type LogicalFlowPosition = "inline-start" | "inline-end" | "block-start"
export type ModeClass = "calcite-mode-light" | "calcite-mode-dark" | "calcite-mode-auto";
export type ModeName = "light" | "dark" | "auto";
export type Position = "start" | "end";
export type SelectionAppearance = "border" | "icon";
export type SelectionMode =
| "single"
| "none"
Expand Down
Loading