@workday/canvas-kit-labs-react 16.1.4 → 16.2.0-0612-next.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. package/dist/commonjs/ai-ingress-button/lib/AIIngressButton.js +5 -5
  2. package/dist/commonjs/index.d.ts +1 -0
  3. package/dist/commonjs/index.d.ts.map +1 -1
  4. package/dist/commonjs/index.js +1 -0
  5. package/dist/commonjs/kbd/lib/KBD.js +6 -6
  6. package/dist/commonjs/kbd/lib/KBDItem.js +6 -6
  7. package/dist/commonjs/selection-group/index.d.ts +7 -0
  8. package/dist/commonjs/selection-group/index.d.ts.map +1 -0
  9. package/dist/commonjs/selection-group/index.js +22 -0
  10. package/dist/commonjs/selection-group/lib/SelectionGroup.d.ts +1499 -0
  11. package/dist/commonjs/selection-group/lib/SelectionGroup.d.ts.map +1 -0
  12. package/dist/commonjs/selection-group/lib/SelectionGroup.js +61 -0
  13. package/dist/commonjs/selection-group/lib/SelectionGroupIcon.d.ts +17 -0
  14. package/dist/commonjs/selection-group/lib/SelectionGroupIcon.d.ts.map +1 -0
  15. package/dist/commonjs/selection-group/lib/SelectionGroupIcon.js +24 -0
  16. package/dist/commonjs/selection-group/lib/SelectionGroupItem.d.ts +173 -0
  17. package/dist/commonjs/selection-group/lib/SelectionGroupItem.d.ts.map +1 -0
  18. package/dist/commonjs/selection-group/lib/SelectionGroupItem.js +37 -0
  19. package/dist/commonjs/selection-group/lib/SelectionGroupList.d.ts +172 -0
  20. package/dist/commonjs/selection-group/lib/SelectionGroupList.d.ts.map +1 -0
  21. package/dist/commonjs/selection-group/lib/SelectionGroupList.js +35 -0
  22. package/dist/commonjs/selection-group/lib/hooks/useSelectionGroupItem.d.ts +146 -0
  23. package/dist/commonjs/selection-group/lib/hooks/useSelectionGroupItem.d.ts.map +1 -0
  24. package/dist/commonjs/selection-group/lib/hooks/useSelectionGroupItem.js +29 -0
  25. package/dist/commonjs/selection-group/lib/hooks/useSelectionGroupModel.d.ts +1602 -0
  26. package/dist/commonjs/selection-group/lib/hooks/useSelectionGroupModel.d.ts.map +1 -0
  27. package/dist/commonjs/selection-group/lib/hooks/useSelectionGroupModel.js +166 -0
  28. package/dist/commonjs/version/lib/version.js +1 -1
  29. package/dist/es6/ai-ingress-button/lib/AIIngressButton.js +5 -5
  30. package/dist/es6/index.d.ts +1 -0
  31. package/dist/es6/index.d.ts.map +1 -1
  32. package/dist/es6/index.js +1 -0
  33. package/dist/es6/kbd/lib/KBD.js +6 -6
  34. package/dist/es6/kbd/lib/KBDItem.js +6 -6
  35. package/dist/es6/selection-group/index.d.ts +7 -0
  36. package/dist/es6/selection-group/index.d.ts.map +1 -0
  37. package/dist/es6/selection-group/index.js +6 -0
  38. package/dist/es6/selection-group/lib/SelectionGroup.d.ts +1499 -0
  39. package/dist/es6/selection-group/lib/SelectionGroup.d.ts.map +1 -0
  40. package/dist/es6/selection-group/lib/SelectionGroup.js +58 -0
  41. package/dist/es6/selection-group/lib/SelectionGroupIcon.d.ts +17 -0
  42. package/dist/es6/selection-group/lib/SelectionGroupIcon.d.ts.map +1 -0
  43. package/dist/es6/selection-group/lib/SelectionGroupIcon.js +21 -0
  44. package/dist/es6/selection-group/lib/SelectionGroupItem.d.ts +173 -0
  45. package/dist/es6/selection-group/lib/SelectionGroupItem.d.ts.map +1 -0
  46. package/dist/es6/selection-group/lib/SelectionGroupItem.js +34 -0
  47. package/dist/es6/selection-group/lib/SelectionGroupList.d.ts +172 -0
  48. package/dist/es6/selection-group/lib/SelectionGroupList.d.ts.map +1 -0
  49. package/dist/es6/selection-group/lib/SelectionGroupList.js +32 -0
  50. package/dist/es6/selection-group/lib/hooks/useSelectionGroupItem.d.ts +146 -0
  51. package/dist/es6/selection-group/lib/hooks/useSelectionGroupItem.d.ts.map +1 -0
  52. package/dist/es6/selection-group/lib/hooks/useSelectionGroupItem.js +26 -0
  53. package/dist/es6/selection-group/lib/hooks/useSelectionGroupModel.d.ts +1602 -0
  54. package/dist/es6/selection-group/lib/hooks/useSelectionGroupModel.d.ts.map +1 -0
  55. package/dist/es6/selection-group/lib/hooks/useSelectionGroupModel.js +160 -0
  56. package/dist/es6/version/lib/version.js +1 -1
  57. package/index.ts +1 -0
  58. package/package.json +4 -4
  59. package/selection-group/index.ts +6 -0
  60. package/selection-group/lib/SelectionGroup.tsx +65 -0
  61. package/selection-group/lib/SelectionGroupIcon.tsx +60 -0
  62. package/selection-group/lib/SelectionGroupItem.tsx +143 -0
  63. package/selection-group/lib/SelectionGroupList.tsx +89 -0
  64. package/selection-group/lib/hooks/useSelectionGroupItem.tsx +46 -0
  65. package/selection-group/lib/hooks/useSelectionGroupModel.tsx +195 -0
  66. package/selection-group/package.json +6 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SelectionGroup.d.ts","sourceRoot":"","sources":["../../../../selection-group/lib/SelectionGroup.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAQ1B,MAAM,WAAW,mBAAmB;IAClC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAIvB;;;;;;;;;;OAUG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAEH;;;;;;;OAOG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAKL,CAAC"}
@@ -0,0 +1,61 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SelectionGroup = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const common_1 = require("@workday/canvas-kit-react/common");
6
+ const SelectionGroupItem_1 = require("./SelectionGroupItem");
7
+ const SelectionGroupList_1 = require("./SelectionGroupList");
8
+ const useSelectionGroupModel_1 = require("./hooks/useSelectionGroupModel");
9
+ /**
10
+ * `SelectionGroup` is a container component that allows users to select one or more options from a
11
+ * predefined list using chip-style controls with a lightweight glyph indicator. It is responsible
12
+ * for creating a {@link useSelectionGroupModel SelectionGroupModel} and sharing it with its
13
+ * subcomponents using React context. It does not represent a real element.
14
+ *
15
+ * ```tsx
16
+ * <SelectionGroup mode="single">
17
+ * <SelectionGroup.List aria-label="Select one option">
18
+ * <SelectionGroup.Item data-id="first">First</SelectionGroup.Item>
19
+ * <SelectionGroup.Item data-id="second">Second</SelectionGroup.Item>
20
+ * </SelectionGroup.List>
21
+ * </SelectionGroup>
22
+ * ```
23
+ *
24
+ * Alternatively, you may pass in a model using the [hoisted model
25
+ * pattern](/getting-started/for-developers/resources/compound-components/#configuring-a-model).
26
+ *
27
+ * ```tsx
28
+ * const model = useSelectionGroupModel({mode: 'multiple'});
29
+ *
30
+ * <SelectionGroup model={model}>{Child components}</SelectionGroup>
31
+ * ```
32
+ */
33
+ exports.SelectionGroup = (0, common_1.createContainer)()({
34
+ displayName: 'SelectionGroup',
35
+ modelHook: useSelectionGroupModel_1.useSelectionGroupModel,
36
+ subComponents: {
37
+ /**
38
+ * `SelectionGroup.List` is a container for {@link SelectionGroupItem SelectionGroup.Item}
39
+ * subcomponents. It renders a `radiogroup` in `single` mode and a `group` in `multiple` mode,
40
+ * and carries the group's accessible label and notification state.
41
+ *
42
+ * ```tsx
43
+ * <SelectionGroup.List aria-label="Select all that apply">
44
+ * {SelectionGroup.Items}
45
+ * </SelectionGroup.List>
46
+ * ```
47
+ */
48
+ List: SelectionGroupList_1.SelectionGroupList,
49
+ /**
50
+ * `SelectionGroup.Item` is a `button` element with a glyph and a label. Each item requires a
51
+ * `data-id` prop to handle selection events properly.
52
+ *
53
+ * ```tsx
54
+ * <SelectionGroup.Item data-id="option-a">Option A</SelectionGroup.Item>
55
+ * ```
56
+ */
57
+ Item: SelectionGroupItem_1.SelectionGroupItem,
58
+ },
59
+ })(({ children }) => {
60
+ return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: children });
61
+ });
@@ -0,0 +1,17 @@
1
+ import { ExtractProps } from '@workday/canvas-kit-react/common';
2
+ import { SystemIcon } from '@workday/canvas-kit-react/icon';
3
+ import { SelectionGroupMode } from './hooks/useSelectionGroupModel';
4
+ export interface SelectionGroupIconProps extends Omit<ExtractProps<typeof SystemIcon, never>, 'icon'> {
5
+ /**
6
+ * The selection mode of the group the item belongs to. A circle is used for `single` and a
7
+ * square for `multiple`, matching the radio and checkbox controls each mode behaves like.
8
+ */
9
+ mode: SelectionGroupMode;
10
+ /**
11
+ * If true, the checked form of the icon is rendered.
12
+ */
13
+ selected: boolean;
14
+ }
15
+ export declare const selectionGroupIconStencil: import("@workday/canvas-kit-styling").Stencil<import("@workday/canvas-kit-styling").StencilModifierConfig<{}, {}, never>, {}, {}, never, never>;
16
+ export declare const SelectionGroupIcon: import("@workday/canvas-kit-react/common").ElementComponent<"span", SelectionGroupIconProps>;
17
+ //# sourceMappingURL=SelectionGroupIcon.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SelectionGroupIcon.d.ts","sourceRoot":"","sources":["../../../../selection-group/lib/SelectionGroupIcon.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAkB,MAAM,kCAAkC,CAAC;AAC/E,OAAO,EAAC,UAAU,EAAC,MAAM,gCAAgC,CAAC;AAS1D,OAAO,EAAC,kBAAkB,EAAC,MAAM,gCAAgC,CAAC;AAElE,MAAM,WAAW,uBACf,SAAQ,IAAI,CAAC,YAAY,CAAC,OAAO,UAAU,EAAE,KAAK,CAAC,EAAE,MAAM,CAAC;IAC5D;;;OAGG;IACH,IAAI,EAAE,kBAAkB,CAAC;IACzB;;OAEG;IACH,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED,eAAO,MAAM,yBAAyB,iJAIpC,CAAC;AAYH,eAAO,MAAM,kBAAkB,8FAkB7B,CAAC"}
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SelectionGroupIcon = exports.selectionGroupIconStencil = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const common_1 = require("@workday/canvas-kit-react/common");
6
+ const icon_1 = require("@workday/canvas-kit-react/icon");
7
+ const canvas_kit_styling_1 = require("@workday/canvas-kit-styling");
8
+ const canvas_system_icons_web_1 = require("@workday/canvas-system-icons-web");
9
+ exports.selectionGroupIconStencil = (0, canvas_kit_styling_1.createStencil)({
10
+ base: { name: "84ykk", styles: "box-sizing:border-box;flex-shrink:0;" }
11
+ }, "selection-group-icon-6bc986");
12
+ /**
13
+ * The icon is always rendered, in both modes and in both selected states, so items never shift
14
+ * width on selection. The shape communicates the mode and the checkmark communicates selection, so
15
+ * selected state is never conveyed by color alone.
16
+ */
17
+ const icons = {
18
+ single: { selected: canvas_system_icons_web_1.checkCircleFillIcon, unselected: canvas_system_icons_web_1.circleIcon },
19
+ multiple: { selected: canvas_system_icons_web_1.checkboxFillIcon, unselected: canvas_system_icons_web_1.squareIcon },
20
+ };
21
+ exports.SelectionGroupIcon = (0, common_1.createComponent)('span')({
22
+ displayName: 'SelectionGroupIcon',
23
+ Component: ({ mode, selected, size = 'xs', ...elemProps }, ref, Element) => ((0, jsx_runtime_1.jsx)(icon_1.SystemIcon, { as: Element, ref: ref, size: size, "aria-hidden": true, icon: icons[mode][selected ? 'selected' : 'unselected'], ...(0, canvas_kit_styling_1.handleCsProp)(elemProps, (0, exports.selectionGroupIconStencil)()) })),
24
+ });
@@ -0,0 +1,173 @@
1
+ import * as React from 'react';
2
+ export interface SelectionGroupItemProps {
3
+ /**
4
+ * Optionally pass index to the item. This should be done if `SelectionGroup.Item` components were
5
+ * created via a `map` function. This index will ensure keyboard navigation works even if items
6
+ * are inserted out of order.
7
+ */
8
+ index?: number;
9
+ /**
10
+ * The contents of the item. This is text used as the accessible name of the button for screen
11
+ * readers. Labels should be short and concise.
12
+ */
13
+ children?: React.ReactNode;
14
+ /**
15
+ * The identifier of the item. This identifier will be used in change events.
16
+ * If this property is not provided, it will default to a string representation
17
+ * of the zero-based index of the item when it was initialized.
18
+ */
19
+ 'data-id'?: string;
20
+ /**
21
+ * Optional id. If not set, it will inherit the ID passed to the `SelectionGroup` component and
22
+ * append the index at the end. Only set this for advanced cases.
23
+ */
24
+ id?: string;
25
+ }
26
+ export declare const selectionGroupItemStencil: import("@workday/canvas-kit-styling").Stencil<{
27
+ width: {
28
+ content: {
29
+ width: string;
30
+ };
31
+ equal: {
32
+ width: string;
33
+ };
34
+ column: {
35
+ width: string;
36
+ };
37
+ };
38
+ }, {
39
+ readonly label: "selection-group-item-label";
40
+ }, {}, import("@workday/canvas-kit-styling").Stencil<import("@workday/canvas-kit-styling").StencilModifierConfig<{}, {
41
+ shape: string;
42
+ }, never>, {}, {
43
+ shape: string;
44
+ }, never, never>, never>;
45
+ export declare const SelectionGroupItem: import("@workday/canvas-kit-react/common").ElementComponentM<"button", SelectionGroupItemProps, {
46
+ state: {
47
+ mode: import("./hooks/useSelectionGroupModel").SelectionGroupMode;
48
+ width: import("./hooks/useSelectionGroupModel").SelectionGroupWidth;
49
+ disabled: boolean;
50
+ error: import("./hooks/useSelectionGroupModel").SelectionGroupError | undefined;
51
+ 'aria-invalid': boolean | undefined;
52
+ 'aria-describedby': string | undefined;
53
+ selectedIds: string[] | "all";
54
+ unselectedIds: string[];
55
+ cursorId: string | string[];
56
+ columnCount: number;
57
+ pageSizeRef: React.MutableRefObject<number>;
58
+ cursorIndexRef: {
59
+ readonly current: number;
60
+ };
61
+ UNSTABLE_virtual: import("@tanstack/virtual-core").Virtualizer<HTMLDivElement, Element>;
62
+ UNSTABLE_defaultItemHeight: number;
63
+ containerRef: React.RefObject<HTMLDivElement>;
64
+ id: string;
65
+ orientation: "horizontal" | "vertical";
66
+ indexRef: React.MutableRefObject<number>;
67
+ nonInteractiveIds: string[];
68
+ isVirtualized: boolean;
69
+ items: import("@workday/canvas-kit-react/collection").Item<any>[];
70
+ };
71
+ events: {
72
+ goToNext: () => void;
73
+ goToPrevious: () => void;
74
+ goToPreviousRow: () => void;
75
+ goToNextRow: () => void;
76
+ goToFirst: () => void;
77
+ goToLast: () => void;
78
+ goToFirstOfRow: () => void;
79
+ goToLastOfRow: () => void;
80
+ goToNextPage: () => void;
81
+ goToPreviousPage: () => void;
82
+ select(data: {
83
+ id: string;
84
+ }): void;
85
+ selectAll(): void;
86
+ unselectAll(): void;
87
+ setSelectedIds(ids: string[] | "all"): void;
88
+ remove(data: {
89
+ id: string;
90
+ nextId?: string | undefined;
91
+ event?: Event | React.SyntheticEvent<Element, Event> | undefined;
92
+ }): void;
93
+ goTo(data: {
94
+ id: string;
95
+ }): void;
96
+ registerItem(data: {
97
+ id: string;
98
+ textValue: string;
99
+ }): void;
100
+ unregisterItem(data: {
101
+ id: string;
102
+ }): void;
103
+ updateItemHeight(data: {
104
+ value: number;
105
+ }): void;
106
+ };
107
+ selection: import("@workday/canvas-kit-react/collection").SelectionManager;
108
+ navigation: import("@workday/canvas-kit-react/collection").NavigationManager;
109
+ getId: (item: any) => string;
110
+ getTextValue: (item: any) => string;
111
+ UNSTABLE_parentModel: {
112
+ state: {
113
+ selectedIds: string[] | "all";
114
+ unselectedIds: string[];
115
+ cursorId: string | string[];
116
+ columnCount: number;
117
+ pageSizeRef: React.MutableRefObject<number>;
118
+ cursorIndexRef: {
119
+ readonly current: number;
120
+ };
121
+ UNSTABLE_virtual: import("@tanstack/virtual-core").Virtualizer<HTMLDivElement, Element>;
122
+ UNSTABLE_defaultItemHeight: number;
123
+ containerRef: React.RefObject<HTMLDivElement>;
124
+ id: string;
125
+ orientation: "horizontal" | "vertical";
126
+ indexRef: React.MutableRefObject<number>;
127
+ nonInteractiveIds: string[];
128
+ isVirtualized: boolean;
129
+ items: import("@workday/canvas-kit-react/collection").Item<any>[];
130
+ };
131
+ events: {
132
+ select(data: {
133
+ id: string;
134
+ }): void;
135
+ selectAll(): void;
136
+ unselectAll(): void;
137
+ setSelectedIds(ids: string[] | "all"): void;
138
+ remove(data: {
139
+ id: string;
140
+ nextId?: string | undefined;
141
+ event?: Event | React.SyntheticEvent<Element, Event> | undefined;
142
+ }): void;
143
+ goTo(data: {
144
+ id: string;
145
+ }): void;
146
+ goToNext(): void;
147
+ goToPrevious(): void;
148
+ goToPreviousRow(): void;
149
+ goToNextRow(): void;
150
+ goToFirst(): void;
151
+ goToLast(): void;
152
+ goToFirstOfRow(): void;
153
+ goToLastOfRow(): void;
154
+ goToNextPage(): void;
155
+ goToPreviousPage(): void;
156
+ registerItem(data: {
157
+ id: string;
158
+ textValue: string;
159
+ }): void;
160
+ unregisterItem(data: {
161
+ id: string;
162
+ }): void;
163
+ updateItemHeight(data: {
164
+ value: number;
165
+ }): void;
166
+ };
167
+ selection: import("@workday/canvas-kit-react/collection").SelectionManager;
168
+ navigation: import("@workday/canvas-kit-react/collection").NavigationManager;
169
+ getId: (item: any) => string;
170
+ getTextValue: (item: any) => string;
171
+ } | undefined;
172
+ }>;
173
+ //# sourceMappingURL=SelectionGroupItem.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SelectionGroupItem.d.ts","sourceRoot":"","sources":["../../../../selection-group/lib/SelectionGroupItem.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAY/B,MAAM,WAAW,uBAAuB;IACtC;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,EAAE,CAAC,EAAE,MAAM,CAAC;CACb;AAED,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;wBAkFpC,CAAC;AAEH,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAqB7B,CAAC"}
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SelectionGroupItem = exports.selectionGroupItemStencil = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const collection_1 = require("@workday/canvas-kit-react/collection");
6
+ const common_1 = require("@workday/canvas-kit-react/common");
7
+ const icon_1 = require("@workday/canvas-kit-react/icon");
8
+ const canvas_kit_styling_1 = require("@workday/canvas-kit-styling");
9
+ const canvas_tokens_web_1 = require("@workday/canvas-tokens-web");
10
+ const SelectionGroupIcon_1 = require("./SelectionGroupIcon");
11
+ const useSelectionGroupItem_1 = require("./hooks/useSelectionGroupItem");
12
+ const useSelectionGroupModel_1 = require("./hooks/useSelectionGroupModel");
13
+ exports.selectionGroupItemStencil = (0, canvas_kit_styling_1.createStencil)({
14
+ extends: common_1.cornerShapeStencil,
15
+ parts: {
16
+ label: 'selection-group-item-label',
17
+ },
18
+ base: { name: "2ja79u", styles: "box-sizing:border-box;--shape-corner-shape-ccab68:var(--cnvs-sys-shape-lg, 0.75rem);font-family:var(--cnvs-sys-font-family-default, \"Roboto\");font-weight:var(--cnvs-sys-font-weight-normal, 400);line-height:var(--cnvs-sys-line-height-subtext-lg, 1.25rem);font-size:var(--cnvs-sys-font-size-subtext-lg, 0.875rem);letter-spacing:var(--cnvs-sys-letter-spacing-subtext-lg, 0.015rem);display:inline-flex;align-items:center;gap:var(--cnvs-base-size-75, 0.375rem);border:0.0625rem solid var(--cnvs-sys-color-border-default);padding:var(--cnvs-sys-padding-xs, var(--cnvs-sys-space-x2, 0.5rem)) var(--cnvs-sys-padding-sm, var(--cnvs-sys-space-x3, 0.75rem));background-color:var(--cnvs-sys-color-surface-default, var(--cnvs-sys-color-bg-default, oklch(1 0 0 / 1)));color:var(--cnvs-sys-color-fg-strong);cursor:pointer;text-align:start;transition:background-color 80ms ease, color 80ms ease, border-color 80ms ease;--color-system-icon-c9acc3:currentColor;--accentColor-system-icon-c9acc3:currentColor;[data-part=\"selection-group-item-label\"]{white-space:nowrap;}&:not([aria-checked=\"true\"]):is(:hover, .hover){background-color:var(--cnvs-sys-color-surface-overlay-hover-default, oklch(0.3343 0.0951 253.3 / 0.05));}&:not([aria-checked=\"true\"]):is(:active, .active){background-color:var(--cnvs-sys-color-surface-overlay-pressed-default, oklch(0.3337 0.0688 250.79 / 0.09));}&:is(:focus-visible, .focus){box-shadow:0 0 0 1px var(--cnvs-sys-color-border-inverse-default, var(--cnvs-base-palette-neutral-0)), 0 0 0 3px var(--cnvs-brand-common-focus-outline, rgba(8,117,225,1));}&:is(:disabled, .disabled){cursor:default;opacity:var(--cnvs-sys-opacity-disabled);&:is(:hover, .hover){background-color:var(--cnvs-sys-color-surface-default, var(--cnvs-sys-color-bg-default, oklch(1 0 0 / 1)));}}&[aria-checked=\"true\"]{background-color:var(--cnvs-sys-color-brand-surface-selected, oklch(0.6152 0.2108 256.1 / 0.11));border:0.0625rem solid transparent;color:var(--cnvs-sys-color-brand-fg-selected, var(--cnvs-brand-primary-dark, oklch(0.4658 0.1562 255.5 / 1)));&:is(:hover, .hover){background-color:var(--cnvs-sys-color-brand-surface-selected, oklch(0.6152 0.2108 256.1 / 0.11));}&:is(:active, .active){background-color:var(--cnvs-sys-color-brand-surface-selected, oklch(0.6152 0.2108 256.1 / 0.11));}&:is(:disabled, .disabled){background-color:var(--cnvs-sys-color-brand-surface-selected, oklch(0.6152 0.2108 256.1 / 0.11));color:var(--cnvs-sys-color-brand-fg-selected, var(--cnvs-brand-primary-dark, oklch(0.4658 0.1562 255.5 / 1)));}}" },
19
+ modifiers: {
20
+ width: {
21
+ content: { name: "hluj6", styles: "width:fit-content;" },
22
+ equal: { name: "1v6fnw", styles: "width:100%;" },
23
+ column: { name: "3i2d48", styles: "width:100%;" }
24
+ }
25
+ }
26
+ }, "selection-group-item-15e2bc");
27
+ exports.SelectionGroupItem = (0, common_1.createSubcomponent)('button')({
28
+ displayName: 'SelectionGroup.Item',
29
+ modelHook: useSelectionGroupModel_1.useSelectionGroupModel,
30
+ elemPropsHook: useSelectionGroupItem_1.useSelectionGroupItem,
31
+ })(({ children, ...elemProps }, Element, model) => {
32
+ const name = elemProps['data-id'] || '';
33
+ const selected = !!name && (0, collection_1.isSelected)(name, model.state);
34
+ return ((0, jsx_runtime_1.jsxs)(Element, { ...(0, canvas_kit_styling_1.handleCsProp)(elemProps, (0, exports.selectionGroupItemStencil)({
35
+ width: model.state.width,
36
+ })), children: [(0, jsx_runtime_1.jsx)(SelectionGroupIcon_1.SelectionGroupIcon, { mode: model.state.mode, selected: selected }), children && (0, jsx_runtime_1.jsx)("span", { ...exports.selectionGroupItemStencil.parts.label, children: children })] }));
37
+ });
@@ -0,0 +1,172 @@
1
+ import * as React from 'react';
2
+ import { CSProps } from '@workday/canvas-kit-styling';
3
+ export interface SelectionGroupListProps<T = any> extends CSProps {
4
+ /**
5
+ * Accessible label for the group. The label should state the selection mode, for example
6
+ * `"Select one"` or `"Select all that apply"`, so the mode is clear before interacting. Required
7
+ * unless `aria-labelledby` is provided or the group is wrapped in a `FormField` with a visible
8
+ * label.
9
+ */
10
+ 'aria-label'?: string;
11
+ /**
12
+ * ID of an element that labels the group. Use when the group label is rendered outside the list.
13
+ */
14
+ 'aria-labelledby'?: string;
15
+ children: ((item: T) => React.ReactNode) | React.ReactNode;
16
+ }
17
+ export declare const selectionGroupListStencil: import("@workday/canvas-kit-styling").Stencil<{
18
+ width: {
19
+ content: {};
20
+ equal: {
21
+ display: string;
22
+ gridAutoFlow: string;
23
+ gridAutoColumns: string;
24
+ };
25
+ column: {
26
+ flexDirection: string;
27
+ flexWrap: string;
28
+ width: string;
29
+ };
30
+ };
31
+ error: {
32
+ error: {
33
+ borderColor: "var(--cnvs-sys-color-brand-border-critical, oklch(0.6495 0.2369 30.04 / 1))";
34
+ };
35
+ caution: {
36
+ borderColor: "var(--cnvs-sys-color-brand-border-caution, var(--cnvs-brand-alert-dark, oklch(0.6601 0.1537 60.7 / 1)))";
37
+ };
38
+ };
39
+ }, {}, {}, import("@workday/canvas-kit-styling").Stencil<import("@workday/canvas-kit-styling").StencilModifierConfig<{}, {
40
+ shape: string;
41
+ }, never>, {}, {
42
+ shape: string;
43
+ }, never, never>, never>;
44
+ export declare const SelectionGroupList: import("@workday/canvas-kit-react/common").ElementComponentM<"div", SelectionGroupListProps<any>, {
45
+ state: {
46
+ mode: import("./hooks/useSelectionGroupModel").SelectionGroupMode;
47
+ width: import("./hooks/useSelectionGroupModel").SelectionGroupWidth;
48
+ disabled: boolean;
49
+ error: import("./hooks/useSelectionGroupModel").SelectionGroupError | undefined;
50
+ 'aria-invalid': boolean | undefined;
51
+ 'aria-describedby': string | undefined;
52
+ selectedIds: string[] | "all";
53
+ unselectedIds: string[];
54
+ cursorId: string | string[];
55
+ columnCount: number;
56
+ pageSizeRef: React.MutableRefObject<number>;
57
+ cursorIndexRef: {
58
+ readonly current: number;
59
+ };
60
+ UNSTABLE_virtual: import("@tanstack/virtual-core").Virtualizer<HTMLDivElement, Element>;
61
+ UNSTABLE_defaultItemHeight: number;
62
+ containerRef: React.RefObject<HTMLDivElement>;
63
+ id: string;
64
+ orientation: "horizontal" | "vertical";
65
+ indexRef: React.MutableRefObject<number>;
66
+ nonInteractiveIds: string[];
67
+ isVirtualized: boolean;
68
+ items: import("@workday/canvas-kit-react/collection").Item<any>[];
69
+ };
70
+ events: {
71
+ goToNext: () => void;
72
+ goToPrevious: () => void;
73
+ goToPreviousRow: () => void;
74
+ goToNextRow: () => void;
75
+ goToFirst: () => void;
76
+ goToLast: () => void;
77
+ goToFirstOfRow: () => void;
78
+ goToLastOfRow: () => void;
79
+ goToNextPage: () => void;
80
+ goToPreviousPage: () => void;
81
+ select(data: {
82
+ id: string;
83
+ }): void;
84
+ selectAll(): void;
85
+ unselectAll(): void;
86
+ setSelectedIds(ids: string[] | "all"): void;
87
+ remove(data: {
88
+ id: string;
89
+ nextId?: string | undefined;
90
+ event?: Event | React.SyntheticEvent<Element, Event> | undefined;
91
+ }): void;
92
+ goTo(data: {
93
+ id: string;
94
+ }): void;
95
+ registerItem(data: {
96
+ id: string;
97
+ textValue: string;
98
+ }): void;
99
+ unregisterItem(data: {
100
+ id: string;
101
+ }): void;
102
+ updateItemHeight(data: {
103
+ value: number;
104
+ }): void;
105
+ };
106
+ selection: import("@workday/canvas-kit-react/collection").SelectionManager;
107
+ navigation: import("@workday/canvas-kit-react/collection").NavigationManager;
108
+ getId: (item: any) => string;
109
+ getTextValue: (item: any) => string;
110
+ UNSTABLE_parentModel: {
111
+ state: {
112
+ selectedIds: string[] | "all";
113
+ unselectedIds: string[];
114
+ cursorId: string | string[];
115
+ columnCount: number;
116
+ pageSizeRef: React.MutableRefObject<number>;
117
+ cursorIndexRef: {
118
+ readonly current: number;
119
+ };
120
+ UNSTABLE_virtual: import("@tanstack/virtual-core").Virtualizer<HTMLDivElement, Element>;
121
+ UNSTABLE_defaultItemHeight: number;
122
+ containerRef: React.RefObject<HTMLDivElement>;
123
+ id: string;
124
+ orientation: "horizontal" | "vertical";
125
+ indexRef: React.MutableRefObject<number>;
126
+ nonInteractiveIds: string[];
127
+ isVirtualized: boolean;
128
+ items: import("@workday/canvas-kit-react/collection").Item<any>[];
129
+ };
130
+ events: {
131
+ select(data: {
132
+ id: string;
133
+ }): void;
134
+ selectAll(): void;
135
+ unselectAll(): void;
136
+ setSelectedIds(ids: string[] | "all"): void;
137
+ remove(data: {
138
+ id: string;
139
+ nextId?: string | undefined;
140
+ event?: Event | React.SyntheticEvent<Element, Event> | undefined;
141
+ }): void;
142
+ goTo(data: {
143
+ id: string;
144
+ }): void;
145
+ goToNext(): void;
146
+ goToPrevious(): void;
147
+ goToPreviousRow(): void;
148
+ goToNextRow(): void;
149
+ goToFirst(): void;
150
+ goToLast(): void;
151
+ goToFirstOfRow(): void;
152
+ goToLastOfRow(): void;
153
+ goToNextPage(): void;
154
+ goToPreviousPage(): void;
155
+ registerItem(data: {
156
+ id: string;
157
+ textValue: string;
158
+ }): void;
159
+ unregisterItem(data: {
160
+ id: string;
161
+ }): void;
162
+ updateItemHeight(data: {
163
+ value: number;
164
+ }): void;
165
+ };
166
+ selection: import("@workday/canvas-kit-react/collection").SelectionManager;
167
+ navigation: import("@workday/canvas-kit-react/collection").NavigationManager;
168
+ getId: (item: any) => string;
169
+ getTextValue: (item: any) => string;
170
+ } | undefined;
171
+ }>;
172
+ //# sourceMappingURL=SelectionGroupList.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SelectionGroupList.d.ts","sourceRoot":"","sources":["../../../../selection-group/lib/SelectionGroupList.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,OAAO,EAAC,OAAO,EAAsC,MAAM,6BAA6B,CAAC;AAKzF,MAAM,WAAW,uBAAuB,CAAC,CAAC,GAAG,GAAG,CAAE,SAAQ,OAAO;IAC/D;;;;;OAKG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;OAEG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,QAAQ,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,KAAK,KAAK,CAAC,SAAS,CAAC,GAAG,KAAK,CAAC,SAAS,CAAC;CAC5D;AAED,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;wBAwCpC,CAAC;AAEH,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAsB7B,CAAC"}
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SelectionGroupList = exports.selectionGroupListStencil = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const collection_1 = require("@workday/canvas-kit-react/collection");
6
+ const common_1 = require("@workday/canvas-kit-react/common");
7
+ const canvas_kit_styling_1 = require("@workday/canvas-kit-styling");
8
+ const canvas_tokens_web_1 = require("@workday/canvas-tokens-web");
9
+ const useSelectionGroupModel_1 = require("./hooks/useSelectionGroupModel");
10
+ exports.selectionGroupListStencil = (0, canvas_kit_styling_1.createStencil)({
11
+ extends: common_1.cornerShapeStencil,
12
+ base: { name: "4354zn", styles: "box-sizing:border-box;--shape-corner-shape-ccab68:var(--cnvs-sys-shape-lg, 0.75rem);display:flex;flex-wrap:wrap;gap:var(--cnvs-sys-gap-xs, var(--cnvs-sys-space-x1, 0.25rem));width:fit-content;border:0.125rem solid transparent;padding:var(--cnvs-sys-padding-xxs, var(--cnvs-sys-space-x1, 0.25rem));transition:100ms border-color;" },
13
+ modifiers: {
14
+ width: {
15
+ content: { name: "3v8oj4", styles: "" },
16
+ // `1fr` auto columns inside a `fit-content` grid all resolve to the widest item's
17
+ // max-content width, which sizes every item to the longest label without measuring the DOM.
18
+ equal: { name: "41o1qx", styles: "display:grid;grid-auto-flow:column;grid-auto-columns:1fr;" },
19
+ column: { name: "1yq4s2", styles: "flex-direction:column;flex-wrap:nowrap;width:100%;" }
20
+ },
21
+ error: {
22
+ error: { name: "2g6m3w", styles: "border-color:var(--cnvs-sys-color-brand-border-critical, oklch(0.6495 0.2369 30.04 / 1));" },
23
+ caution: { name: "2us6z8", styles: "border-color:var(--cnvs-sys-color-brand-border-caution, var(--cnvs-brand-alert-dark, oklch(0.6601 0.1537 60.7 / 1)));" }
24
+ }
25
+ }
26
+ }, "selection-group-list-25bb89");
27
+ exports.SelectionGroupList = (0, common_1.createSubcomponent)('div')({
28
+ displayName: 'SelectionGroup.List',
29
+ modelHook: useSelectionGroupModel_1.useSelectionGroupModel,
30
+ })(({ children, ...elemProps }, Element, model) => {
31
+ return ((0, jsx_runtime_1.jsx)(Element, { role: model.state.mode === 'single' ? 'radiogroup' : 'group', "aria-invalid": model.state.mode === 'single' ? model.state['aria-invalid'] : undefined, "aria-describedby": model.state['aria-describedby'], ...(0, canvas_kit_styling_1.handleCsProp)(elemProps, (0, exports.selectionGroupListStencil)({
32
+ width: model.state.width,
33
+ error: model.state.error,
34
+ })), children: (0, collection_1.useListRenderItems)(model, children) }));
35
+ });