@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.
- package/dist/commonjs/ai-ingress-button/lib/AIIngressButton.js +5 -5
- package/dist/commonjs/index.d.ts +1 -0
- package/dist/commonjs/index.d.ts.map +1 -1
- package/dist/commonjs/index.js +1 -0
- package/dist/commonjs/kbd/lib/KBD.js +6 -6
- package/dist/commonjs/kbd/lib/KBDItem.js +6 -6
- package/dist/commonjs/selection-group/index.d.ts +7 -0
- package/dist/commonjs/selection-group/index.d.ts.map +1 -0
- package/dist/commonjs/selection-group/index.js +22 -0
- package/dist/commonjs/selection-group/lib/SelectionGroup.d.ts +1499 -0
- package/dist/commonjs/selection-group/lib/SelectionGroup.d.ts.map +1 -0
- package/dist/commonjs/selection-group/lib/SelectionGroup.js +61 -0
- package/dist/commonjs/selection-group/lib/SelectionGroupIcon.d.ts +17 -0
- package/dist/commonjs/selection-group/lib/SelectionGroupIcon.d.ts.map +1 -0
- package/dist/commonjs/selection-group/lib/SelectionGroupIcon.js +24 -0
- package/dist/commonjs/selection-group/lib/SelectionGroupItem.d.ts +173 -0
- package/dist/commonjs/selection-group/lib/SelectionGroupItem.d.ts.map +1 -0
- package/dist/commonjs/selection-group/lib/SelectionGroupItem.js +37 -0
- package/dist/commonjs/selection-group/lib/SelectionGroupList.d.ts +172 -0
- package/dist/commonjs/selection-group/lib/SelectionGroupList.d.ts.map +1 -0
- package/dist/commonjs/selection-group/lib/SelectionGroupList.js +35 -0
- package/dist/commonjs/selection-group/lib/hooks/useSelectionGroupItem.d.ts +146 -0
- package/dist/commonjs/selection-group/lib/hooks/useSelectionGroupItem.d.ts.map +1 -0
- package/dist/commonjs/selection-group/lib/hooks/useSelectionGroupItem.js +29 -0
- package/dist/commonjs/selection-group/lib/hooks/useSelectionGroupModel.d.ts +1602 -0
- package/dist/commonjs/selection-group/lib/hooks/useSelectionGroupModel.d.ts.map +1 -0
- package/dist/commonjs/selection-group/lib/hooks/useSelectionGroupModel.js +166 -0
- package/dist/commonjs/version/lib/version.js +1 -1
- package/dist/es6/ai-ingress-button/lib/AIIngressButton.js +5 -5
- package/dist/es6/index.d.ts +1 -0
- package/dist/es6/index.d.ts.map +1 -1
- package/dist/es6/index.js +1 -0
- package/dist/es6/kbd/lib/KBD.js +6 -6
- package/dist/es6/kbd/lib/KBDItem.js +6 -6
- package/dist/es6/selection-group/index.d.ts +7 -0
- package/dist/es6/selection-group/index.d.ts.map +1 -0
- package/dist/es6/selection-group/index.js +6 -0
- package/dist/es6/selection-group/lib/SelectionGroup.d.ts +1499 -0
- package/dist/es6/selection-group/lib/SelectionGroup.d.ts.map +1 -0
- package/dist/es6/selection-group/lib/SelectionGroup.js +58 -0
- package/dist/es6/selection-group/lib/SelectionGroupIcon.d.ts +17 -0
- package/dist/es6/selection-group/lib/SelectionGroupIcon.d.ts.map +1 -0
- package/dist/es6/selection-group/lib/SelectionGroupIcon.js +21 -0
- package/dist/es6/selection-group/lib/SelectionGroupItem.d.ts +173 -0
- package/dist/es6/selection-group/lib/SelectionGroupItem.d.ts.map +1 -0
- package/dist/es6/selection-group/lib/SelectionGroupItem.js +34 -0
- package/dist/es6/selection-group/lib/SelectionGroupList.d.ts +172 -0
- package/dist/es6/selection-group/lib/SelectionGroupList.d.ts.map +1 -0
- package/dist/es6/selection-group/lib/SelectionGroupList.js +32 -0
- package/dist/es6/selection-group/lib/hooks/useSelectionGroupItem.d.ts +146 -0
- package/dist/es6/selection-group/lib/hooks/useSelectionGroupItem.d.ts.map +1 -0
- package/dist/es6/selection-group/lib/hooks/useSelectionGroupItem.js +26 -0
- package/dist/es6/selection-group/lib/hooks/useSelectionGroupModel.d.ts +1602 -0
- package/dist/es6/selection-group/lib/hooks/useSelectionGroupModel.d.ts.map +1 -0
- package/dist/es6/selection-group/lib/hooks/useSelectionGroupModel.js +160 -0
- package/dist/es6/version/lib/version.js +1 -1
- package/index.ts +1 -0
- package/package.json +4 -4
- package/selection-group/index.ts +6 -0
- package/selection-group/lib/SelectionGroup.tsx +65 -0
- package/selection-group/lib/SelectionGroupIcon.tsx +60 -0
- package/selection-group/lib/SelectionGroupItem.tsx +143 -0
- package/selection-group/lib/SelectionGroupList.tsx +89 -0
- package/selection-group/lib/hooks/useSelectionGroupItem.tsx +46 -0
- package/selection-group/lib/hooks/useSelectionGroupModel.tsx +195 -0
- 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,58 @@
|
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { createContainer } from '@workday/canvas-kit-react/common';
|
|
3
|
+
import { SelectionGroupItem } from './SelectionGroupItem';
|
|
4
|
+
import { SelectionGroupList } from './SelectionGroupList';
|
|
5
|
+
import { useSelectionGroupModel } from './hooks/useSelectionGroupModel';
|
|
6
|
+
/**
|
|
7
|
+
* `SelectionGroup` is a container component that allows users to select one or more options from a
|
|
8
|
+
* predefined list using chip-style controls with a lightweight glyph indicator. It is responsible
|
|
9
|
+
* for creating a {@link useSelectionGroupModel SelectionGroupModel} and sharing it with its
|
|
10
|
+
* subcomponents using React context. It does not represent a real element.
|
|
11
|
+
*
|
|
12
|
+
* ```tsx
|
|
13
|
+
* <SelectionGroup mode="single">
|
|
14
|
+
* <SelectionGroup.List aria-label="Select one option">
|
|
15
|
+
* <SelectionGroup.Item data-id="first">First</SelectionGroup.Item>
|
|
16
|
+
* <SelectionGroup.Item data-id="second">Second</SelectionGroup.Item>
|
|
17
|
+
* </SelectionGroup.List>
|
|
18
|
+
* </SelectionGroup>
|
|
19
|
+
* ```
|
|
20
|
+
*
|
|
21
|
+
* Alternatively, you may pass in a model using the [hoisted model
|
|
22
|
+
* pattern](/getting-started/for-developers/resources/compound-components/#configuring-a-model).
|
|
23
|
+
*
|
|
24
|
+
* ```tsx
|
|
25
|
+
* const model = useSelectionGroupModel({mode: 'multiple'});
|
|
26
|
+
*
|
|
27
|
+
* <SelectionGroup model={model}>{Child components}</SelectionGroup>
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
export const SelectionGroup = createContainer()({
|
|
31
|
+
displayName: 'SelectionGroup',
|
|
32
|
+
modelHook: useSelectionGroupModel,
|
|
33
|
+
subComponents: {
|
|
34
|
+
/**
|
|
35
|
+
* `SelectionGroup.List` is a container for {@link SelectionGroupItem SelectionGroup.Item}
|
|
36
|
+
* subcomponents. It renders a `radiogroup` in `single` mode and a `group` in `multiple` mode,
|
|
37
|
+
* and carries the group's accessible label and notification state.
|
|
38
|
+
*
|
|
39
|
+
* ```tsx
|
|
40
|
+
* <SelectionGroup.List aria-label="Select all that apply">
|
|
41
|
+
* {SelectionGroup.Items}
|
|
42
|
+
* </SelectionGroup.List>
|
|
43
|
+
* ```
|
|
44
|
+
*/
|
|
45
|
+
List: SelectionGroupList,
|
|
46
|
+
/**
|
|
47
|
+
* `SelectionGroup.Item` is a `button` element with a glyph and a label. Each item requires a
|
|
48
|
+
* `data-id` prop to handle selection events properly.
|
|
49
|
+
*
|
|
50
|
+
* ```tsx
|
|
51
|
+
* <SelectionGroup.Item data-id="option-a">Option A</SelectionGroup.Item>
|
|
52
|
+
* ```
|
|
53
|
+
*/
|
|
54
|
+
Item: SelectionGroupItem,
|
|
55
|
+
},
|
|
56
|
+
})(({ children }) => {
|
|
57
|
+
return _jsx(_Fragment, { children: children });
|
|
58
|
+
});
|
|
@@ -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,21 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { createComponent } from '@workday/canvas-kit-react/common';
|
|
3
|
+
import { SystemIcon } from '@workday/canvas-kit-react/icon';
|
|
4
|
+
import { createStencil, handleCsProp } from '@workday/canvas-kit-styling';
|
|
5
|
+
import { checkCircleFillIcon, checkboxFillIcon, circleIcon, squareIcon, } from '@workday/canvas-system-icons-web';
|
|
6
|
+
export const selectionGroupIconStencil = createStencil({
|
|
7
|
+
base: { name: "84ykk", styles: "box-sizing:border-box;flex-shrink:0;" }
|
|
8
|
+
}, "selection-group-icon-6bc986");
|
|
9
|
+
/**
|
|
10
|
+
* The icon is always rendered, in both modes and in both selected states, so items never shift
|
|
11
|
+
* width on selection. The shape communicates the mode and the checkmark communicates selection, so
|
|
12
|
+
* selected state is never conveyed by color alone.
|
|
13
|
+
*/
|
|
14
|
+
const icons = {
|
|
15
|
+
single: { selected: checkCircleFillIcon, unselected: circleIcon },
|
|
16
|
+
multiple: { selected: checkboxFillIcon, unselected: squareIcon },
|
|
17
|
+
};
|
|
18
|
+
export const SelectionGroupIcon = createComponent('span')({
|
|
19
|
+
displayName: 'SelectionGroupIcon',
|
|
20
|
+
Component: ({ mode, selected, size = 'xs', ...elemProps }, ref, Element) => (_jsx(SystemIcon, { as: Element, ref: ref, size: size, "aria-hidden": true, icon: icons[mode][selected ? 'selected' : 'unselected'], ...handleCsProp(elemProps, selectionGroupIconStencil()) })),
|
|
21
|
+
});
|
|
@@ -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,34 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { isSelected } from '@workday/canvas-kit-react/collection';
|
|
3
|
+
import { cornerShapeStencil, createSubcomponent, focusRing } from '@workday/canvas-kit-react/common';
|
|
4
|
+
import { systemIconStencil } from '@workday/canvas-kit-react/icon';
|
|
5
|
+
import { createStencil, handleCsProp, px2rem } from '@workday/canvas-kit-styling';
|
|
6
|
+
import { base, system } from '@workday/canvas-tokens-web';
|
|
7
|
+
import { SelectionGroupIcon } from './SelectionGroupIcon';
|
|
8
|
+
import { useSelectionGroupItem } from './hooks/useSelectionGroupItem';
|
|
9
|
+
import { useSelectionGroupModel } from './hooks/useSelectionGroupModel';
|
|
10
|
+
export const selectionGroupItemStencil = createStencil({
|
|
11
|
+
extends: cornerShapeStencil,
|
|
12
|
+
parts: {
|
|
13
|
+
label: 'selection-group-item-label',
|
|
14
|
+
},
|
|
15
|
+
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)));}}" },
|
|
16
|
+
modifiers: {
|
|
17
|
+
width: {
|
|
18
|
+
content: { name: "hluj6", styles: "width:fit-content;" },
|
|
19
|
+
equal: { name: "1v6fnw", styles: "width:100%;" },
|
|
20
|
+
column: { name: "3i2d48", styles: "width:100%;" }
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}, "selection-group-item-15e2bc");
|
|
24
|
+
export const SelectionGroupItem = createSubcomponent('button')({
|
|
25
|
+
displayName: 'SelectionGroup.Item',
|
|
26
|
+
modelHook: useSelectionGroupModel,
|
|
27
|
+
elemPropsHook: useSelectionGroupItem,
|
|
28
|
+
})(({ children, ...elemProps }, Element, model) => {
|
|
29
|
+
const name = elemProps['data-id'] || '';
|
|
30
|
+
const selected = !!name && isSelected(name, model.state);
|
|
31
|
+
return (_jsxs(Element, { ...handleCsProp(elemProps, selectionGroupItemStencil({
|
|
32
|
+
width: model.state.width,
|
|
33
|
+
})), children: [_jsx(SelectionGroupIcon, { mode: model.state.mode, selected: selected }), children && _jsx("span", { ...selectionGroupItemStencil.parts.label, children: children })] }));
|
|
34
|
+
});
|
|
@@ -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,32 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useListRenderItems } from '@workday/canvas-kit-react/collection';
|
|
3
|
+
import { cornerShapeStencil, createSubcomponent } from '@workday/canvas-kit-react/common';
|
|
4
|
+
import { createStencil, handleCsProp, px2rem } from '@workday/canvas-kit-styling';
|
|
5
|
+
import { system } from '@workday/canvas-tokens-web';
|
|
6
|
+
import { useSelectionGroupModel } from './hooks/useSelectionGroupModel';
|
|
7
|
+
export const selectionGroupListStencil = createStencil({
|
|
8
|
+
extends: cornerShapeStencil,
|
|
9
|
+
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;" },
|
|
10
|
+
modifiers: {
|
|
11
|
+
width: {
|
|
12
|
+
content: { name: "3v8oj4", styles: "" },
|
|
13
|
+
// `1fr` auto columns inside a `fit-content` grid all resolve to the widest item's
|
|
14
|
+
// max-content width, which sizes every item to the longest label without measuring the DOM.
|
|
15
|
+
equal: { name: "41o1qx", styles: "display:grid;grid-auto-flow:column;grid-auto-columns:1fr;" },
|
|
16
|
+
column: { name: "1yq4s2", styles: "flex-direction:column;flex-wrap:nowrap;width:100%;" }
|
|
17
|
+
},
|
|
18
|
+
error: {
|
|
19
|
+
error: { name: "2g6m3w", styles: "border-color:var(--cnvs-sys-color-brand-border-critical, oklch(0.6495 0.2369 30.04 / 1));" },
|
|
20
|
+
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)));" }
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}, "selection-group-list-25bb89");
|
|
24
|
+
export const SelectionGroupList = createSubcomponent('div')({
|
|
25
|
+
displayName: 'SelectionGroup.List',
|
|
26
|
+
modelHook: useSelectionGroupModel,
|
|
27
|
+
})(({ children, ...elemProps }, Element, model) => {
|
|
28
|
+
return (_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'], ...handleCsProp(elemProps, selectionGroupListStencil({
|
|
29
|
+
width: model.state.width,
|
|
30
|
+
error: model.state.error,
|
|
31
|
+
})), children: useListRenderItems(model, children) }));
|
|
32
|
+
});
|