@workday/canvas-kit-react 7.2.0-next.1 → 7.2.0-next.2
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/action-bar/lib/ActionBarList.tsx +2 -9
- package/collection/index.ts +2 -0
- package/collection/lib/useBaseListModel.tsx +1 -1
- package/collection/lib/useCursorListModel.tsx +88 -20
- package/collection/lib/useGridModel.ts +34 -0
- package/collection/lib/useListItemRovingFocus.tsx +6 -4
- package/dist/commonjs/action-bar/lib/ActionBarList.d.ts +0 -58
- package/dist/commonjs/action-bar/lib/ActionBarList.d.ts.map +1 -1
- package/dist/commonjs/action-bar/lib/ActionBarList.js +2 -3
- package/dist/commonjs/collection/index.d.ts +2 -0
- package/dist/commonjs/collection/index.d.ts.map +1 -1
- package/dist/commonjs/collection/index.js +5 -1
- package/dist/commonjs/collection/lib/useBaseListModel.js +1 -1
- package/dist/commonjs/collection/lib/useCursorListModel.d.ts +64 -101
- package/dist/commonjs/collection/lib/useCursorListModel.d.ts.map +1 -1
- package/dist/commonjs/collection/lib/useCursorListModel.js +64 -23
- package/dist/commonjs/collection/lib/useGridModel.d.ts +955 -0
- package/dist/commonjs/collection/lib/useGridModel.d.ts.map +1 -0
- package/dist/commonjs/collection/lib/useGridModel.js +52 -0
- package/dist/commonjs/collection/lib/useListItemRovingFocus.d.ts.map +1 -1
- package/dist/commonjs/collection/lib/useListItemRovingFocus.js +6 -4
- package/dist/commonjs/radio/lib/RadioGroup.d.ts.map +1 -1
- package/dist/commonjs/radio/lib/RadioGroup.js +5 -1
- package/dist/es6/action-bar/lib/ActionBarList.d.ts +0 -58
- package/dist/es6/action-bar/lib/ActionBarList.d.ts.map +1 -1
- package/dist/es6/action-bar/lib/ActionBarList.js +3 -4
- package/dist/es6/collection/index.d.ts +2 -0
- package/dist/es6/collection/index.d.ts.map +1 -1
- package/dist/es6/collection/index.js +2 -0
- package/dist/es6/collection/lib/useBaseListModel.js +1 -1
- package/dist/es6/collection/lib/useCursorListModel.d.ts +64 -101
- package/dist/es6/collection/lib/useCursorListModel.d.ts.map +1 -1
- package/dist/es6/collection/lib/useCursorListModel.js +64 -23
- package/dist/es6/collection/lib/useGridModel.d.ts +955 -0
- package/dist/es6/collection/lib/useGridModel.d.ts.map +1 -0
- package/dist/es6/collection/lib/useGridModel.js +49 -0
- package/dist/es6/collection/lib/useListItemRovingFocus.d.ts.map +1 -1
- package/dist/es6/collection/lib/useListItemRovingFocus.js +6 -4
- package/dist/es6/radio/lib/RadioGroup.d.ts.map +1 -1
- package/dist/es6/radio/lib/RadioGroup.js +5 -1
- package/package.json +5 -5
- package/radio/lib/RadioGroup.tsx +5 -1
|
@@ -2,18 +2,13 @@ import * as React from 'react';
|
|
|
2
2
|
|
|
3
3
|
import {commonColors, colors, space} from '@workday/canvas-kit-react/tokens';
|
|
4
4
|
import {
|
|
5
|
-
composeHooks,
|
|
6
5
|
createSubcomponent,
|
|
7
6
|
ExtractProps,
|
|
8
7
|
styled,
|
|
9
8
|
StyledType,
|
|
10
9
|
} from '@workday/canvas-kit-react/common';
|
|
11
10
|
import {HStack} from '@workday/canvas-kit-react/layout';
|
|
12
|
-
import {
|
|
13
|
-
useOverflowListMeasure,
|
|
14
|
-
useListRenderItems,
|
|
15
|
-
useListResetCursorOnBlur,
|
|
16
|
-
} from '@workday/canvas-kit-react/collection';
|
|
11
|
+
import {useOverflowListMeasure, useListRenderItems} from '@workday/canvas-kit-react/collection';
|
|
17
12
|
|
|
18
13
|
import {useActionBarModel} from './useActionBarModel';
|
|
19
14
|
import {ActionBar} from './ActionBar';
|
|
@@ -42,12 +37,10 @@ const ResponsiveHStack = styled(HStack)<ActionBarListProps & StyledType>(({theme
|
|
|
42
37
|
},
|
|
43
38
|
}));
|
|
44
39
|
|
|
45
|
-
export const useActionBarList = composeHooks(useOverflowListMeasure, useListResetCursorOnBlur);
|
|
46
|
-
|
|
47
40
|
export const ActionBarList = createSubcomponent('div')({
|
|
48
41
|
displayName: 'ActionBar.List',
|
|
49
42
|
modelHook: useActionBarModel,
|
|
50
|
-
elemPropsHook:
|
|
43
|
+
elemPropsHook: useOverflowListMeasure,
|
|
51
44
|
})<ActionBarListProps>(({children, ...elemProps}, Element, model) => {
|
|
52
45
|
return (
|
|
53
46
|
<ResponsiveHStack
|
package/collection/index.ts
CHANGED
|
@@ -9,9 +9,11 @@ export * from './lib/useListResetCursorOnBlur';
|
|
|
9
9
|
export * from './lib/useListItemRovingFocus';
|
|
10
10
|
export * from './lib/useListItemSelect';
|
|
11
11
|
export * from './lib/useListModel';
|
|
12
|
+
export * from './lib/useGridModel';
|
|
12
13
|
export {ListBox} from './lib/ListBox';
|
|
13
14
|
export {
|
|
14
15
|
singleSelectionManager,
|
|
15
16
|
multiSelectionManager,
|
|
16
17
|
isSelected,
|
|
17
18
|
} from './lib/useSelectionListModel';
|
|
19
|
+
export {wrappingNavigationManager, navigationManager} from './lib/useCursorListModel';
|
|
@@ -6,17 +6,40 @@ import {useBaseListModel, Item, defaultGetId as getId} from './useBaseListModel'
|
|
|
6
6
|
type NavigationInput = Pick<ReturnType<typeof useCursorListModel>, 'state'>;
|
|
7
7
|
|
|
8
8
|
export interface NavigationManager {
|
|
9
|
+
/** Get the first item in a collection. This will be called when the `Home` key is pressed for
|
|
10
|
+
* Lists and `Ctrl+Home` for Grids. */
|
|
9
11
|
getFirst: NavigationRequestor;
|
|
12
|
+
/** Get the last item in a collection. This will be called when the `End` key is pressed for Lists
|
|
13
|
+
* and `Ctrl+End` for Grids. */
|
|
10
14
|
getLast: NavigationRequestor;
|
|
15
|
+
/** Get an item with the provided `id`. */
|
|
11
16
|
getItem: NavigationRequestor;
|
|
17
|
+
/** Get the next item after the provided `id`. This will be called when the `Right` arrow key is
|
|
18
|
+
* pressed for RTL languages and when the `Left` arrow is pressed for LTR languages. */
|
|
12
19
|
getNext: NavigationRequestor;
|
|
20
|
+
/** **For Grids:** Get the cell in the next row from the provided `id`. This will be called when
|
|
21
|
+
* the `Down` arrow is pressed. */
|
|
13
22
|
getNextRow: NavigationRequestor;
|
|
23
|
+
/** Get the previous item before the provided `id`. This will be called when the `Left` arrow key
|
|
24
|
+
* is pressed for RTL languages and when the `Right` arrow is pressed for LTR languages. */
|
|
14
25
|
getPrevious: NavigationRequestor;
|
|
26
|
+
/** **For Grids:** Get the cell in the previous row from the provided `id`. This will be called
|
|
27
|
+
* when the `Up` arrow is pressed. */
|
|
15
28
|
getPreviousRow: NavigationRequestor;
|
|
29
|
+
/** **For Grids:** Get the first item in a row. This will be called when the `Home` key is
|
|
30
|
+
* pressed. */
|
|
16
31
|
getFirstOfRow: NavigationRequestor;
|
|
32
|
+
/** **For Grids:** Get the last item in a row. This will be called when the `End` key is
|
|
33
|
+
* pressed. */
|
|
17
34
|
getLastOfRow: NavigationRequestor;
|
|
18
|
-
|
|
35
|
+
/** Get the next "page". A "page" is application specific and usually means next visible screen.
|
|
36
|
+
* If the viewport is scrollable, it would scroll so that the last item visible is now the first
|
|
37
|
+
* item visible. This is called when the `PageDown` key is pressed */
|
|
19
38
|
getNextPage: NavigationRequestor;
|
|
39
|
+
/** Get the next "page". A "page" is application specific and usually means previous visible
|
|
40
|
+
* screen. If the viewport is scrollable, it would scroll so that the first item visible is now
|
|
41
|
+
* the last item visible. This is called when the `PageUp` key is pressed */
|
|
42
|
+
getPreviousPage: NavigationRequestor;
|
|
20
43
|
}
|
|
21
44
|
|
|
22
45
|
/**
|
|
@@ -56,7 +79,7 @@ export const getLast: NavigationRequestor = (_, {state}) => state.items[state.it
|
|
|
56
79
|
export const getFirstOfRow: NavigationRequestor = (id, {state}) => {
|
|
57
80
|
if (state.columnCount) {
|
|
58
81
|
const item = getItem(id, {state});
|
|
59
|
-
const currentIndex =
|
|
82
|
+
const currentIndex = item.index;
|
|
60
83
|
const offset = currentIndex % state.columnCount;
|
|
61
84
|
return state.items[currentIndex - offset];
|
|
62
85
|
}
|
|
@@ -69,9 +92,13 @@ export const getFirstOfRow: NavigationRequestor = (id, {state}) => {
|
|
|
69
92
|
export const getLastOfRow: NavigationRequestor = (id, {state}) => {
|
|
70
93
|
if (state.columnCount) {
|
|
71
94
|
const item = getItem(id, {state});
|
|
72
|
-
const currentIndex =
|
|
95
|
+
const currentIndex = item.index;
|
|
73
96
|
const offset = (currentIndex % state.columnCount) - state.columnCount + 1;
|
|
74
|
-
|
|
97
|
+
let nextIndex = currentIndex - offset;
|
|
98
|
+
if (nextIndex >= state.items.length) {
|
|
99
|
+
nextIndex = state.items.length - 1;
|
|
100
|
+
}
|
|
101
|
+
return state.items[nextIndex];
|
|
75
102
|
}
|
|
76
103
|
return getLast(id, {state});
|
|
77
104
|
};
|
|
@@ -83,7 +110,7 @@ export const getLastOfRow: NavigationRequestor = (id, {state}) => {
|
|
|
83
110
|
export const getPreviousPage: NavigationRequestor = (id, {state}) => {
|
|
84
111
|
if (state.columnCount) {
|
|
85
112
|
const item = getItem(id, {state});
|
|
86
|
-
const currentIndex =
|
|
113
|
+
const currentIndex = item.index;
|
|
87
114
|
return state.items[currentIndex % state.columnCount];
|
|
88
115
|
}
|
|
89
116
|
return getFirst(id, {state});
|
|
@@ -96,7 +123,7 @@ export const getPreviousPage: NavigationRequestor = (id, {state}) => {
|
|
|
96
123
|
export const getNextPage: NavigationRequestor = (id, {state}) => {
|
|
97
124
|
if (state.columnCount) {
|
|
98
125
|
const item = getItem(id, {state});
|
|
99
|
-
const currentIndex =
|
|
126
|
+
const currentIndex = item.index;
|
|
100
127
|
const lastRowIndex = state.items.length - state.columnCount;
|
|
101
128
|
return state.items[lastRowIndex + (currentIndex % state.columnCount)];
|
|
102
129
|
}
|
|
@@ -117,12 +144,38 @@ export const getWrappingOffsetItem = (offset: number) => (
|
|
|
117
144
|
const items = state.items;
|
|
118
145
|
const item = getItem(id, {state});
|
|
119
146
|
|
|
120
|
-
const currentIndex =
|
|
147
|
+
const currentIndex = item.index;
|
|
121
148
|
let nextIndex = currentIndex + offset;
|
|
149
|
+
|
|
150
|
+
// calculate idealLength as in if the grid was a perfect rectangle
|
|
151
|
+
const rows = Math.ceil(items.length / state.columnCount);
|
|
152
|
+
const idealLength = rows * state.columnCount;
|
|
122
153
|
if (nextIndex < 0) {
|
|
123
|
-
|
|
154
|
+
if (offset === -1) {
|
|
155
|
+
// if the offset is -1, we want to wrap to the end
|
|
156
|
+
nextIndex = items.length - 1;
|
|
157
|
+
} else {
|
|
158
|
+
// if the offset is smaller than -1, we want to wrap by column
|
|
159
|
+
if (idealLength + nextIndex >= items.length) {
|
|
160
|
+
// we'll overflow the grid because there isn't enough items. Move `nextIndex` up so we wrap in
|
|
161
|
+
// the right spot
|
|
162
|
+
nextIndex -= state.columnCount;
|
|
163
|
+
}
|
|
164
|
+
nextIndex = idealLength + nextIndex;
|
|
165
|
+
}
|
|
124
166
|
} else if (nextIndex >= items.length) {
|
|
125
|
-
|
|
167
|
+
if (offset === 1) {
|
|
168
|
+
// if the offset is 1, we want to wrap to the beginning
|
|
169
|
+
nextIndex = 0;
|
|
170
|
+
} else {
|
|
171
|
+
// if the offset is larger than 1, we want to wrap by column
|
|
172
|
+
if (nextIndex - idealLength < 0) {
|
|
173
|
+
// we're going to overflow the grid because there isn't enough items. Move `nextIndex` down to
|
|
174
|
+
// the missing item in the next row. This way we'll end up wrapping in the right spot
|
|
175
|
+
nextIndex += state.columnCount;
|
|
176
|
+
}
|
|
177
|
+
nextIndex = nextIndex - idealLength;
|
|
178
|
+
}
|
|
126
179
|
}
|
|
127
180
|
|
|
128
181
|
if (state.nonInteractiveIds.includes(getId(items[nextIndex])) && tries > 0) {
|
|
@@ -142,8 +195,9 @@ export const getOffsetItem = (offset: number) => (
|
|
|
142
195
|
const {items, columnCount} = state;
|
|
143
196
|
const item = getItem(id, {state});
|
|
144
197
|
|
|
145
|
-
const currentIndex =
|
|
198
|
+
const currentIndex = item.index;
|
|
146
199
|
let nextIndex = currentIndex + offset;
|
|
200
|
+
|
|
147
201
|
if (Math.abs(offset) < columnCount) {
|
|
148
202
|
// if we're here, the columnCount is non-zero and the absolute value of offset is less than the
|
|
149
203
|
// column count. We don't want to wrap, so we'll bound within the row
|
|
@@ -157,10 +211,19 @@ export const getOffsetItem = (offset: number) => (
|
|
|
157
211
|
// if we're here, there's a column count, but the offset will move into another row. We need to
|
|
158
212
|
// bound to row values
|
|
159
213
|
const nextRow = Math.floor(nextIndex / columnCount);
|
|
214
|
+
|
|
160
215
|
if (nextRow < 0 || nextRow >= columnCount) {
|
|
161
216
|
nextIndex = currentIndex;
|
|
162
217
|
}
|
|
163
|
-
|
|
218
|
+
|
|
219
|
+
// make sure we don't go out of bounds if the grid isn't a perfect rectangle
|
|
220
|
+
if (nextIndex > items.length - 1) {
|
|
221
|
+
nextIndex = currentIndex;
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
// make sure we're always in bounds
|
|
226
|
+
if (nextIndex < 0) {
|
|
164
227
|
nextIndex = 0;
|
|
165
228
|
} else if (nextIndex >= items.length) {
|
|
166
229
|
nextIndex = items.length - 1;
|
|
@@ -176,30 +239,36 @@ export const getOffsetItem = (offset: number) => (
|
|
|
176
239
|
};
|
|
177
240
|
|
|
178
241
|
/**
|
|
179
|
-
* The default navigation manager of lists
|
|
242
|
+
* The default navigation manager of lists. This navigation manager will wrap around when the edge
|
|
243
|
+
* is hit. For example, if the user is the the right-most item in a list or right-most item in a
|
|
244
|
+
* row, the cursor will wrap around to the beginning or the next row.
|
|
180
245
|
*/
|
|
181
246
|
export const wrappingNavigationManager = createNavigationManager({
|
|
182
247
|
getFirst,
|
|
183
248
|
getLast,
|
|
184
249
|
getItem,
|
|
185
250
|
getNext: getWrappingOffsetItem(1),
|
|
186
|
-
getNextRow: (id, {state}) => getWrappingOffsetItem(
|
|
251
|
+
getNextRow: (id, {state}) => getWrappingOffsetItem(state.columnCount)(id, {state}),
|
|
187
252
|
getPrevious: getWrappingOffsetItem(-1),
|
|
188
|
-
getPreviousRow: (id, {state}) => getWrappingOffsetItem(state.columnCount)(id, {state}),
|
|
253
|
+
getPreviousRow: (id, {state}) => getWrappingOffsetItem(-state.columnCount)(id, {state}),
|
|
189
254
|
getPreviousPage,
|
|
190
255
|
getNextPage,
|
|
191
256
|
getFirstOfRow,
|
|
192
257
|
getLastOfRow,
|
|
193
258
|
});
|
|
194
259
|
|
|
260
|
+
/**
|
|
261
|
+
* The default navigation of grids. This navigation manager will not wrap, but will stop when an
|
|
262
|
+
* edge is detected. This could be the last item in a list or the last item of a row in a grid.
|
|
263
|
+
*/
|
|
195
264
|
export const navigationManager = createNavigationManager({
|
|
196
265
|
getFirst,
|
|
197
266
|
getLast,
|
|
198
267
|
getItem,
|
|
199
268
|
getNext: getOffsetItem(1),
|
|
200
|
-
getNextRow: (id, {state}) => getOffsetItem(
|
|
269
|
+
getNextRow: (id, {state}) => getOffsetItem(state.columnCount)(id, {state}),
|
|
201
270
|
getPrevious: getOffsetItem(-1),
|
|
202
|
-
getPreviousRow: (id, {state}) => getOffsetItem(state.columnCount)(id, {state}),
|
|
271
|
+
getPreviousRow: (id, {state}) => getOffsetItem(-state.columnCount)(id, {state}),
|
|
203
272
|
getPreviousPage,
|
|
204
273
|
getNextPage,
|
|
205
274
|
getFirstOfRow,
|
|
@@ -229,9 +298,7 @@ export const useCursorListModel = createModelHook({
|
|
|
229
298
|
* (left-to-right or right-to-left) and call the correct navigation method. In our example, a
|
|
230
299
|
* left-to-right language would send a `getNext`. The navigation manager may return the next item
|
|
231
300
|
* in the list. Different managers can be created for slightly different use cases. The default
|
|
232
|
-
* navigation manager will accept `orientation` and directionality to determine mapping.
|
|
233
|
-
* `columnCount` is non-zero, it will use a grid mode where `orientation` is ignored and only
|
|
234
|
-
* directionality matters.
|
|
301
|
+
* navigation manager will accept `orientation` and directionality to determine mapping.
|
|
235
302
|
*
|
|
236
303
|
* An example override might be a tab list with an overflow menu that is meant to be transparent
|
|
237
304
|
* to screen reader users. This would require the overflow menu to accept both up/down keys as
|
|
@@ -247,6 +314,7 @@ export const useCursorListModel = createModelHook({
|
|
|
247
314
|
const initialCurrentRef = React.useRef(
|
|
248
315
|
config.initialCursorId || (config.items?.length ? getId(config.items![0]) : '')
|
|
249
316
|
);
|
|
317
|
+
const navigation = config.navigation;
|
|
250
318
|
|
|
251
319
|
const state = {
|
|
252
320
|
...list.state,
|
|
@@ -255,10 +323,10 @@ export const useCursorListModel = createModelHook({
|
|
|
255
323
|
/**
|
|
256
324
|
* Any positive non-zero value treats the list like a grid with rows and columns
|
|
257
325
|
* @default 0
|
|
326
|
+
* @private Use useGridModel instead to make a grid instead of a list
|
|
258
327
|
*/
|
|
259
328
|
columnCount,
|
|
260
329
|
};
|
|
261
|
-
const navigation = config.navigation || wrappingNavigationManager;
|
|
262
330
|
|
|
263
331
|
const events = {
|
|
264
332
|
...list.events,
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import {createModelHook} from '@workday/canvas-kit-react/common';
|
|
2
|
+
import {navigationManager} from './useCursorListModel';
|
|
3
|
+
import {useListModel} from './useListModel';
|
|
4
|
+
|
|
5
|
+
const {columnCount, orientation, ...defaultConfig} = useListModel.defaultConfig;
|
|
6
|
+
|
|
7
|
+
export const useGridModel = createModelHook({
|
|
8
|
+
defaultConfig: {
|
|
9
|
+
...defaultConfig,
|
|
10
|
+
/**
|
|
11
|
+
* Controls the state changes when the user sends navigation events to the model. For example,
|
|
12
|
+
* when the user hits the "right" arrow, a behavior hook will determine directionality
|
|
13
|
+
* (left-to-right or right-to-left) and call the correct navigation method. In our example, a
|
|
14
|
+
* left-to-right language would send a `getNext`. The navigation manager may return the next
|
|
15
|
+
* item in the list. Different managers can be created for slightly different use cases. The
|
|
16
|
+
* default navigation manager will stop when the end of a row/column is detected. For example,
|
|
17
|
+
* `getNext` will return the same item the cursor was previously on if the cursor is on the last
|
|
18
|
+
* item of a row.
|
|
19
|
+
*/
|
|
20
|
+
navigation: navigationManager,
|
|
21
|
+
},
|
|
22
|
+
requiredConfig: {
|
|
23
|
+
/**
|
|
24
|
+
* The number of columns represented in a grid
|
|
25
|
+
*/
|
|
26
|
+
columnCount: 1,
|
|
27
|
+
...useListModel.requiredConfig,
|
|
28
|
+
},
|
|
29
|
+
contextOverride: useListModel.Context,
|
|
30
|
+
})(config => {
|
|
31
|
+
const list = useListModel(config);
|
|
32
|
+
|
|
33
|
+
return list;
|
|
34
|
+
});
|
|
@@ -103,10 +103,12 @@ export const useListItemRovingFocus = createElemPropsHook(useCursorListModel)(
|
|
|
103
103
|
if (event.ctrlKey) {
|
|
104
104
|
for (const key in ctrlKeyMap) {
|
|
105
105
|
if (hasOwnKey(ctrlKeyMap, key)) {
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
106
|
+
if (event.key === key) {
|
|
107
|
+
keyDownRef.current = true;
|
|
108
|
+
events[ctrlKeyMap[key]]?.();
|
|
109
|
+
event.preventDefault();
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
110
112
|
}
|
|
111
113
|
}
|
|
112
114
|
}
|
|
@@ -13,64 +13,6 @@ export interface ActionBarListProps<T = unknown> extends Partial<ExtractProps<ty
|
|
|
13
13
|
*/
|
|
14
14
|
children: ((item: T) => React.ReactNode) | React.ReactNode;
|
|
15
15
|
}
|
|
16
|
-
export declare const useActionBarList: <P extends {}, R>(model: {
|
|
17
|
-
state: {
|
|
18
|
-
selectedIds: import("../../collection/lib/useSelectionListModel").SelectedIds;
|
|
19
|
-
unselectedIds: string[];
|
|
20
|
-
cursorId: string;
|
|
21
|
-
columnCount: number;
|
|
22
|
-
UNSTABLE_virtual: {
|
|
23
|
-
virtualItems: import("../../collection/lib/react-virtual").VirtualItem[];
|
|
24
|
-
totalSize: number;
|
|
25
|
-
scrollToOffset: (index: number, options?: import("../../collection/lib/react-virtual").ScrollToOffsetOptions | undefined) => void;
|
|
26
|
-
scrollToIndex: (index: number, options?: import("../../collection/lib/react-virtual").ScrollToIndexOptions | undefined) => void;
|
|
27
|
-
measure: () => void;
|
|
28
|
-
};
|
|
29
|
-
UNSTABLE_defaultItemHeight: number;
|
|
30
|
-
containerRef: React.RefObject<HTMLDivElement>;
|
|
31
|
-
id: string;
|
|
32
|
-
orientation: import("../../collection/lib/useBaseListModel").Orientation;
|
|
33
|
-
indexRef: React.MutableRefObject<number>;
|
|
34
|
-
nonInteractiveIds: string[];
|
|
35
|
-
isVirtualized: boolean;
|
|
36
|
-
items: import("../../collection").Item<any>[];
|
|
37
|
-
};
|
|
38
|
-
events: {
|
|
39
|
-
select(data: {
|
|
40
|
-
id: string;
|
|
41
|
-
}): void;
|
|
42
|
-
selectAll(): void;
|
|
43
|
-
unselectAll(): void;
|
|
44
|
-
registerItem(data: {
|
|
45
|
-
item: any;
|
|
46
|
-
textValue: string;
|
|
47
|
-
}): void;
|
|
48
|
-
goTo(data: {
|
|
49
|
-
id: string;
|
|
50
|
-
}): void;
|
|
51
|
-
goToNext(): void;
|
|
52
|
-
goToPrevious(): void;
|
|
53
|
-
goToPreviousRow(): void;
|
|
54
|
-
goToNextRow(): void;
|
|
55
|
-
goToFirst(): void;
|
|
56
|
-
goToLast(): void;
|
|
57
|
-
goToFirstOfRow(): void;
|
|
58
|
-
goToLastOfRow(): void;
|
|
59
|
-
goToNextPage(): void;
|
|
60
|
-
goToPreviousPage(): void;
|
|
61
|
-
unregisterItem(data: {
|
|
62
|
-
id: string;
|
|
63
|
-
}): void;
|
|
64
|
-
updateItemHeight(data: {
|
|
65
|
-
value: number;
|
|
66
|
-
}): void;
|
|
67
|
-
};
|
|
68
|
-
selection: import("../../collection/lib/useSelectionListModel").SelectionManager;
|
|
69
|
-
navigation: import("../../collection/lib/useCursorListModel").NavigationManager;
|
|
70
|
-
getId: (item: any) => string;
|
|
71
|
-
}, elemProps?: P | undefined, ref?: ((instance: R | null) => void) | React.RefObject<R> | null | undefined) => {} & P & (R extends HTMLOrSVGElement ? {
|
|
72
|
-
ref: React.Ref<R>;
|
|
73
|
-
} : {});
|
|
74
16
|
export declare const ActionBarList: import("../../common").ElementComponentM<"div", ActionBarListProps<unknown>, {
|
|
75
17
|
state: {
|
|
76
18
|
hiddenIds: string[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ActionBarList.d.ts","sourceRoot":"","sources":["../../../../action-bar/lib/ActionBarList.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,
|
|
1
|
+
{"version":3,"file":"ActionBarList.d.ts","sourceRoot":"","sources":["../../../../action-bar/lib/ActionBarList.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,EAEL,YAAY,EAGb,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAC,MAAM,EAAC,MAAM,kCAAkC,CAAC;AAOxD,MAAM,WAAW,kBAAkB,CAAC,CAAC,GAAG,OAAO,CAC7C,SAAQ,OAAO,CAAC,YAAY,CAAC,OAAO,MAAM,EAAE,KAAK,CAAC,CAAC;IACnD;;;;;;;;OAQG;IACH,QAAQ,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,KAAK,KAAK,CAAC,SAAS,CAAC,GAAG,KAAK,CAAC,SAAS,CAAC;CAC5D;AAWD,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAuBxB,CAAC"}
|
|
@@ -41,7 +41,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
41
41
|
return t;
|
|
42
42
|
};
|
|
43
43
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
44
|
-
exports.ActionBarList =
|
|
44
|
+
exports.ActionBarList = void 0;
|
|
45
45
|
var React = __importStar(require("react"));
|
|
46
46
|
var tokens_1 = require("@workday/canvas-kit-react/tokens");
|
|
47
47
|
var common_1 = require("@workday/canvas-kit-react/common");
|
|
@@ -61,11 +61,10 @@ var ResponsiveHStack = common_1.styled(layout_1.HStack)(function (_a) {
|
|
|
61
61
|
},
|
|
62
62
|
_b);
|
|
63
63
|
});
|
|
64
|
-
exports.useActionBarList = common_1.composeHooks(collection_1.useOverflowListMeasure, collection_1.useListResetCursorOnBlur);
|
|
65
64
|
exports.ActionBarList = common_1.createSubcomponent('div')({
|
|
66
65
|
displayName: 'ActionBar.List',
|
|
67
66
|
modelHook: useActionBarModel_1.useActionBarModel,
|
|
68
|
-
elemPropsHook:
|
|
67
|
+
elemPropsHook: collection_1.useOverflowListMeasure,
|
|
69
68
|
})(function (_a, Element, model) {
|
|
70
69
|
var children = _a.children, elemProps = __rest(_a, ["children"]);
|
|
71
70
|
return (React.createElement(ResponsiveHStack, __assign({ as: Element, spacing: "s", depth: 1, background: tokens_1.commonColors.background, borderTop: "solid 1px " + tokens_1.colors.soap400, padding: tokens_1.space.s + " " + tokens_1.space.xl + " ", position: "fixed", bottom: 0, left: 0, right: 0 }, elemProps),
|
|
@@ -9,6 +9,8 @@ export * from './lib/useListResetCursorOnBlur';
|
|
|
9
9
|
export * from './lib/useListItemRovingFocus';
|
|
10
10
|
export * from './lib/useListItemSelect';
|
|
11
11
|
export * from './lib/useListModel';
|
|
12
|
+
export * from './lib/useGridModel';
|
|
12
13
|
export { ListBox } from './lib/ListBox';
|
|
13
14
|
export { singleSelectionManager, multiSelectionManager, isSelected, } from './lib/useSelectionListModel';
|
|
15
|
+
export { wrappingNavigationManager, navigationManager } from './lib/useCursorListModel';
|
|
14
16
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../collection/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAE,IAAI,EAAC,MAAM,wBAAwB,CAAC;AAC1D,cAAc,2BAA2B,CAAC;AAC1C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,kCAAkC,CAAC;AACjD,cAAc,4BAA4B,CAAC;AAC3C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,yBAAyB,CAAC;AACxC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,yBAAyB,CAAC;AACxC,cAAc,oBAAoB,CAAC;AACnC,OAAO,EAAC,OAAO,EAAC,MAAM,eAAe,CAAC;AACtC,OAAO,EACL,sBAAsB,EACtB,qBAAqB,EACrB,UAAU,GACX,MAAM,6BAA6B,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../collection/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAE,IAAI,EAAC,MAAM,wBAAwB,CAAC;AAC1D,cAAc,2BAA2B,CAAC;AAC1C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,kCAAkC,CAAC;AACjD,cAAc,4BAA4B,CAAC;AAC3C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,yBAAyB,CAAC;AACxC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,yBAAyB,CAAC;AACxC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,OAAO,EAAC,OAAO,EAAC,MAAM,eAAe,CAAC;AACtC,OAAO,EACL,sBAAsB,EACtB,qBAAqB,EACrB,UAAU,GACX,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAC,yBAAyB,EAAE,iBAAiB,EAAC,MAAM,0BAA0B,CAAC"}
|
|
@@ -10,7 +10,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
10
10
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
11
|
};
|
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
-
exports.isSelected = exports.multiSelectionManager = exports.singleSelectionManager = exports.ListBox = exports.defaultGetId = void 0;
|
|
13
|
+
exports.navigationManager = exports.wrappingNavigationManager = exports.isSelected = exports.multiSelectionManager = exports.singleSelectionManager = exports.ListBox = exports.defaultGetId = void 0;
|
|
14
14
|
var useBaseListModel_1 = require("./lib/useBaseListModel");
|
|
15
15
|
Object.defineProperty(exports, "defaultGetId", { enumerable: true, get: function () { return useBaseListModel_1.defaultGetId; } });
|
|
16
16
|
__exportStar(require("./lib/useListItemRegister"), exports);
|
|
@@ -23,9 +23,13 @@ __exportStar(require("./lib/useListResetCursorOnBlur"), exports);
|
|
|
23
23
|
__exportStar(require("./lib/useListItemRovingFocus"), exports);
|
|
24
24
|
__exportStar(require("./lib/useListItemSelect"), exports);
|
|
25
25
|
__exportStar(require("./lib/useListModel"), exports);
|
|
26
|
+
__exportStar(require("./lib/useGridModel"), exports);
|
|
26
27
|
var ListBox_1 = require("./lib/ListBox");
|
|
27
28
|
Object.defineProperty(exports, "ListBox", { enumerable: true, get: function () { return ListBox_1.ListBox; } });
|
|
28
29
|
var useSelectionListModel_1 = require("./lib/useSelectionListModel");
|
|
29
30
|
Object.defineProperty(exports, "singleSelectionManager", { enumerable: true, get: function () { return useSelectionListModel_1.singleSelectionManager; } });
|
|
30
31
|
Object.defineProperty(exports, "multiSelectionManager", { enumerable: true, get: function () { return useSelectionListModel_1.multiSelectionManager; } });
|
|
31
32
|
Object.defineProperty(exports, "isSelected", { enumerable: true, get: function () { return useSelectionListModel_1.isSelected; } });
|
|
33
|
+
var useCursorListModel_1 = require("./lib/useCursorListModel");
|
|
34
|
+
Object.defineProperty(exports, "wrappingNavigationManager", { enumerable: true, get: function () { return useCursorListModel_1.wrappingNavigationManager; } });
|
|
35
|
+
Object.defineProperty(exports, "navigationManager", { enumerable: true, get: function () { return useCursorListModel_1.navigationManager; } });
|