@workday/canvas-kit-react 9.0.0-alpha.413-next.15 → 9.0.0-alpha.415-next.17
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/collection/index.ts +2 -1
- package/collection/lib/useCursorListModel.tsx +2 -2
- package/collection/lib/useListItemAllowChildStrings.ts +37 -0
- package/collection/lib/useListItemRegister.tsx +4 -2
- package/common/lib/utils/index.ts +1 -0
- package/common/lib/utils/slugify.ts +11 -0
- package/dist/commonjs/action-bar/lib/ActionBarItem.d.ts +1 -0
- package/dist/commonjs/action-bar/lib/ActionBarItem.d.ts.map +1 -1
- package/dist/commonjs/breadcrumbs/lib/BreadcrumbsCurrentItem.d.ts +1 -0
- package/dist/commonjs/breadcrumbs/lib/BreadcrumbsCurrentItem.d.ts.map +1 -1
- package/dist/commonjs/breadcrumbs/lib/BreadcrumbsItem.d.ts +1 -0
- package/dist/commonjs/breadcrumbs/lib/BreadcrumbsItem.d.ts.map +1 -1
- package/dist/commonjs/collection/index.d.ts +2 -1
- package/dist/commonjs/collection/index.d.ts.map +1 -1
- package/dist/commonjs/collection/index.js +1 -0
- package/dist/commonjs/collection/lib/useCursorListModel.d.ts +34 -0
- package/dist/commonjs/collection/lib/useCursorListModel.d.ts.map +1 -1
- package/dist/commonjs/collection/lib/useCursorListModel.js +1 -1
- package/dist/commonjs/collection/lib/useListItemAllowChildStrings.d.ts +84 -0
- package/dist/commonjs/collection/lib/useListItemAllowChildStrings.d.ts.map +1 -0
- package/dist/commonjs/collection/lib/useListItemAllowChildStrings.js +36 -0
- package/dist/commonjs/collection/lib/useListItemRegister.d.ts +1 -0
- package/dist/commonjs/collection/lib/useListItemRegister.d.ts.map +1 -1
- package/dist/commonjs/collection/lib/useListItemRegister.js +3 -2
- package/dist/commonjs/common/lib/utils/index.d.ts +1 -0
- package/dist/commonjs/common/lib/utils/index.d.ts.map +1 -1
- package/dist/commonjs/common/lib/utils/index.js +1 -0
- package/dist/commonjs/common/lib/utils/slugify.d.ts +5 -0
- package/dist/commonjs/common/lib/utils/slugify.d.ts.map +1 -0
- package/dist/commonjs/common/lib/utils/slugify.js +15 -0
- package/dist/commonjs/menu/lib/MenuItem.d.ts +1 -0
- package/dist/commonjs/menu/lib/MenuItem.d.ts.map +1 -1
- package/dist/commonjs/menu/lib/MenuItem.js +2 -2
- package/dist/commonjs/tabs/lib/TabsItem.d.ts +1 -0
- package/dist/commonjs/tabs/lib/TabsItem.d.ts.map +1 -1
- package/dist/commonjs/tabs/lib/TabsPanel.d.ts.map +1 -1
- package/dist/commonjs/tabs/lib/TabsPanel.js +2 -2
- package/dist/es6/action-bar/lib/ActionBarItem.d.ts +1 -0
- package/dist/es6/action-bar/lib/ActionBarItem.d.ts.map +1 -1
- package/dist/es6/breadcrumbs/lib/BreadcrumbsCurrentItem.d.ts +1 -0
- package/dist/es6/breadcrumbs/lib/BreadcrumbsCurrentItem.d.ts.map +1 -1
- package/dist/es6/breadcrumbs/lib/BreadcrumbsItem.d.ts +1 -0
- package/dist/es6/breadcrumbs/lib/BreadcrumbsItem.d.ts.map +1 -1
- package/dist/es6/collection/index.d.ts +2 -1
- package/dist/es6/collection/index.d.ts.map +1 -1
- package/dist/es6/collection/index.js +1 -0
- package/dist/es6/collection/lib/useCursorListModel.d.ts +34 -0
- package/dist/es6/collection/lib/useCursorListModel.d.ts.map +1 -1
- package/dist/es6/collection/lib/useCursorListModel.js +2 -2
- package/dist/es6/collection/lib/useListItemAllowChildStrings.d.ts +84 -0
- package/dist/es6/collection/lib/useListItemAllowChildStrings.d.ts.map +1 -0
- package/dist/es6/collection/lib/useListItemAllowChildStrings.js +33 -0
- package/dist/es6/collection/lib/useListItemRegister.d.ts +1 -0
- package/dist/es6/collection/lib/useListItemRegister.d.ts.map +1 -1
- package/dist/es6/collection/lib/useListItemRegister.js +4 -3
- package/dist/es6/common/lib/utils/index.d.ts +1 -0
- package/dist/es6/common/lib/utils/index.d.ts.map +1 -1
- package/dist/es6/common/lib/utils/index.js +1 -0
- package/dist/es6/common/lib/utils/slugify.d.ts +5 -0
- package/dist/es6/common/lib/utils/slugify.d.ts.map +1 -0
- package/dist/es6/common/lib/utils/slugify.js +11 -0
- package/dist/es6/menu/lib/MenuItem.d.ts +1 -0
- package/dist/es6/menu/lib/MenuItem.d.ts.map +1 -1
- package/dist/es6/menu/lib/MenuItem.js +2 -2
- package/dist/es6/tabs/lib/TabsItem.d.ts +1 -0
- package/dist/es6/tabs/lib/TabsItem.d.ts.map +1 -1
- package/dist/es6/tabs/lib/TabsPanel.d.ts.map +1 -1
- package/dist/es6/tabs/lib/TabsPanel.js +3 -3
- package/menu/lib/MenuItem.tsx +2 -2
- package/package.json +3 -3
- package/tabs/lib/TabsPanel.tsx +3 -2
package/collection/index.ts
CHANGED
|
@@ -10,7 +10,8 @@ export * from './lib/useListItemRovingFocus';
|
|
|
10
10
|
export * from './lib/useListItemSelect';
|
|
11
11
|
export * from './lib/useListModel';
|
|
12
12
|
export * from './lib/useGridModel';
|
|
13
|
-
export
|
|
13
|
+
export * from './lib/useListItemAllowChildStrings';
|
|
14
|
+
export {ListBox, ListBoxProps} from './lib/ListBox';
|
|
14
15
|
export {
|
|
15
16
|
singleSelectionManager,
|
|
16
17
|
multiSelectionManager,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import {assert, createModelHook, Generic} from '@workday/canvas-kit-react/common';
|
|
3
3
|
|
|
4
|
-
import {useBaseListModel, Item
|
|
4
|
+
import {useBaseListModel, Item} from './useBaseListModel';
|
|
5
5
|
|
|
6
6
|
type NavigationInput = Pick<ReturnType<typeof useCursorListModel>, 'state'>;
|
|
7
7
|
|
|
@@ -365,7 +365,7 @@ export const useCursorListModel = createModelHook({
|
|
|
365
365
|
registerItem(data: Parameters<typeof list.events.registerItem>[0]) {
|
|
366
366
|
// point the cursor at the first item
|
|
367
367
|
if (!initialCurrentRef.current) {
|
|
368
|
-
initialCurrentRef.current = getId(data.item);
|
|
368
|
+
initialCurrentRef.current = list.getId(data.item);
|
|
369
369
|
setCursorId(initialCurrentRef.current);
|
|
370
370
|
}
|
|
371
371
|
list.events.registerItem(data);
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import {createElemPropsHook} from '@workday/canvas-kit-react/common';
|
|
2
|
+
import {useListModel} from '@workday/canvas-kit-react/collection';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* This elemProps hook allows for children values to be considered identifiers if the children
|
|
6
|
+
* are strings. This can be useful for autocomplete or select components that allow string values.
|
|
7
|
+
* This hook must be defined _before_ {@link useListItemRegister} because it sets the `data-id`
|
|
8
|
+
* attribute if one hasn't been defined by the application.
|
|
9
|
+
*
|
|
10
|
+
* An example might look like:
|
|
11
|
+
* ```tsx
|
|
12
|
+
* const useMyListItem = composeHooks(
|
|
13
|
+
* // any other hooks here
|
|
14
|
+
* useListItemSelect,
|
|
15
|
+
* useListItemRegister,
|
|
16
|
+
* useListItemAllowChildStrings
|
|
17
|
+
* )
|
|
18
|
+
*
|
|
19
|
+
*
|
|
20
|
+
* <MyList onSelect={({id}) => {
|
|
21
|
+
* console.log(id) // will be "First" or "Second"
|
|
22
|
+
* }}>
|
|
23
|
+
* <MyList.Item>First</MyList.Item>
|
|
24
|
+
* <MyList.Item>Second</MyList.Item>
|
|
25
|
+
* </MyList>
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
export const useListItemAllowChildStrings = createElemPropsHook(useListModel)(
|
|
29
|
+
(_, __, elemProps: {'data-id'?: string; children?: React.ReactNode} = {}) => {
|
|
30
|
+
const props: {'data-id'?: string} = {};
|
|
31
|
+
if (!elemProps['data-id'] && typeof elemProps.children === 'string') {
|
|
32
|
+
props['data-id'] = elemProps.children;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return props;
|
|
36
|
+
}
|
|
37
|
+
);
|
|
@@ -5,6 +5,7 @@ import {
|
|
|
5
5
|
createElemPropsHook,
|
|
6
6
|
useLocalRef,
|
|
7
7
|
useForkRef,
|
|
8
|
+
slugify,
|
|
8
9
|
} from '@workday/canvas-kit-react/common';
|
|
9
10
|
|
|
10
11
|
import {Item} from './useBaseListModel';
|
|
@@ -26,7 +27,7 @@ import {useListModel} from './useListModel';
|
|
|
26
27
|
*/
|
|
27
28
|
export const useListItemRegister = createElemPropsHook(useListModel)(
|
|
28
29
|
(
|
|
29
|
-
{state, events
|
|
30
|
+
{state, events},
|
|
30
31
|
ref?: React.Ref<HTMLElement>,
|
|
31
32
|
elemProps: {
|
|
32
33
|
'data-id'?: string;
|
|
@@ -64,7 +65,7 @@ export const useListItemRegister = createElemPropsHook(useListModel)(
|
|
|
64
65
|
|
|
65
66
|
// TODO: Better lookup that using `items.find`. We need a more generic collection to handle seeing if an item already exists
|
|
66
67
|
// bail early if item already exists. This happens if items were already provided.
|
|
67
|
-
if (state.items.find(item =>
|
|
68
|
+
if (state.items.find(item => item.id === itemId)) {
|
|
68
69
|
return;
|
|
69
70
|
}
|
|
70
71
|
events.registerItem({
|
|
@@ -89,6 +90,7 @@ export const useListItemRegister = createElemPropsHook(useListModel)(
|
|
|
89
90
|
'aria-setsize': elemProps.virtual?.size,
|
|
90
91
|
'aria-posinset': elemProps.virtual ? elemProps.item!.index + 1 : undefined,
|
|
91
92
|
style,
|
|
93
|
+
id: slugify(`${state.id}-${localId}`),
|
|
92
94
|
};
|
|
93
95
|
}
|
|
94
96
|
);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Function that takes a string and returns a "slug" which can be used in HTML
|
|
3
|
+
*/
|
|
4
|
+
export function slugify(input: string): string {
|
|
5
|
+
return input
|
|
6
|
+
.trim()
|
|
7
|
+
.replace(/[^\w\s-]/g, '')
|
|
8
|
+
.replace(/[\s_-]+/g, '-')
|
|
9
|
+
.replace(/^-+|-+$/g, '')
|
|
10
|
+
.toLowerCase();
|
|
11
|
+
}
|
|
@@ -107,6 +107,7 @@ export declare const useActionBarItem: import("@workday/canvas-kit-react/common"
|
|
|
107
107
|
'aria-setsize': number | undefined;
|
|
108
108
|
'aria-posinset': number | undefined;
|
|
109
109
|
style: React.CSSProperties;
|
|
110
|
+
id: string;
|
|
110
111
|
}>;
|
|
111
112
|
export declare const ActionBarItem: import("@workday/canvas-kit-react/common").ElementComponentM<import("@workday/canvas-kit-react/common").ElementComponent<"button", import("@workday/canvas-kit-react/button").SecondaryButtonProps>, ActionBarItemProps, {
|
|
112
113
|
state: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ActionBarItem.d.ts","sourceRoot":"","sources":["../../../../action-bar/lib/ActionBarItem.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAU/B,MAAM,WAAW,kBAAkB;IACjC;;;;;;OAMG;IACH,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,eAAO,MAAM,gBAAgB
|
|
1
|
+
{"version":3,"file":"ActionBarItem.d.ts","sourceRoot":"","sources":["../../../../action-bar/lib/ActionBarItem.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAU/B,MAAM,WAAW,kBAAkB;IACjC;;;;;;OAMG;IACH,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAAgE,CAAC;AAE9F,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAMxB,CAAC"}
|
|
@@ -168,6 +168,7 @@ export declare const useBreadcrumbsItem: import("@workday/canvas-kit-react/commo
|
|
|
168
168
|
'aria-setsize': number | undefined;
|
|
169
169
|
'aria-posinset': number | undefined;
|
|
170
170
|
style: React.CSSProperties;
|
|
171
|
+
id: string;
|
|
171
172
|
}>;
|
|
172
173
|
export declare const BreadcrumbsCurrentItem: import("@workday/canvas-kit-react/common").ElementComponentM<"li", BreadcrumbsCurrentItemProps, {
|
|
173
174
|
state: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BreadcrumbsCurrentItem.d.ts","sourceRoot":"","sources":["../../../../breadcrumbs/lib/BreadcrumbsCurrentItem.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAQ1B,OAAO,EAAkB,oBAAoB,EAAC,MAAM,mCAAmC,CAAC;AAMxF,OAAO,EAAO,SAAS,EAAC,MAAM,gCAAgC,CAAC;AAE/D,MAAM,WAAW,2BAA4B,SAAQ,SAAS;IAC5D,YAAY,CAAC,EAAE,oBAAoB,CAAC;CACrC;AAED,eAAO,MAAM,kBAAkB
|
|
1
|
+
{"version":3,"file":"BreadcrumbsCurrentItem.d.ts","sourceRoot":"","sources":["../../../../breadcrumbs/lib/BreadcrumbsCurrentItem.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAQ1B,OAAO,EAAkB,oBAAoB,EAAC,MAAM,mCAAmC,CAAC;AAMxF,OAAO,EAAO,SAAS,EAAC,MAAM,gCAAgC,CAAC;AAE/D,MAAM,WAAW,2BAA4B,SAAQ,SAAS;IAC5D,YAAY,CAAC,EAAE,oBAAoB,CAAC;CACrC;AAED,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAkB9B,CAAC;AAEF,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAwBlC,CAAC"}
|
|
@@ -111,6 +111,7 @@ export declare const useBreadcrumbsItem: import("@workday/canvas-kit-react/commo
|
|
|
111
111
|
'aria-setsize': number | undefined;
|
|
112
112
|
'aria-posinset': number | undefined;
|
|
113
113
|
style: React.CSSProperties;
|
|
114
|
+
id: string;
|
|
114
115
|
}>;
|
|
115
116
|
export declare const BreadcrumbsItem: import("@workday/canvas-kit-react/common").ElementComponentM<"li", BreadcrumbsItemProps, {
|
|
116
117
|
state: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BreadcrumbsItem.d.ts","sourceRoot":"","sources":["../../../../breadcrumbs/lib/BreadcrumbsItem.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAW/B,OAAO,EAAO,SAAS,EAAC,MAAM,kCAAkC,CAAC;AAOjE,MAAM,WAAW,oBAAqB,SAAQ,SAAS;IACrD;;;;;;OAMG;IACH,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,eAAO,MAAM,kBAAkB
|
|
1
|
+
{"version":3,"file":"BreadcrumbsItem.d.ts","sourceRoot":"","sources":["../../../../breadcrumbs/lib/BreadcrumbsItem.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAW/B,OAAO,EAAO,SAAS,EAAC,MAAM,kCAAkC,CAAC;AAOjE,MAAM,WAAW,oBAAqB,SAAQ,SAAS;IACrD;;;;;;OAMG;IACH,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAoB9B,CAAC;AAEF,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwB1B,CAAC"}
|
|
@@ -10,7 +10,8 @@ export * from './lib/useListItemRovingFocus';
|
|
|
10
10
|
export * from './lib/useListItemSelect';
|
|
11
11
|
export * from './lib/useListModel';
|
|
12
12
|
export * from './lib/useGridModel';
|
|
13
|
-
export
|
|
13
|
+
export * from './lib/useListItemAllowChildStrings';
|
|
14
|
+
export { ListBox, ListBoxProps } from './lib/ListBox';
|
|
14
15
|
export { singleSelectionManager, multiSelectionManager, isSelected, } from './lib/useSelectionListModel';
|
|
15
16
|
export { wrappingNavigationManager, navigationManager } from './lib/useCursorListModel';
|
|
16
17
|
//# 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,cAAc,oBAAoB,CAAC;AACnC,OAAO,EAAC,OAAO,EAAC,MAAM,eAAe,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,cAAc,oCAAoC,CAAC;AACnD,OAAO,EAAC,OAAO,EAAE,YAAY,EAAC,MAAM,eAAe,CAAC;AACpD,OAAO,EACL,sBAAsB,EACtB,qBAAqB,EACrB,UAAU,GACX,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAC,yBAAyB,EAAE,iBAAiB,EAAC,MAAM,0BAA0B,CAAC"}
|
|
@@ -24,6 +24,7 @@ __exportStar(require("./lib/useListItemRovingFocus"), exports);
|
|
|
24
24
|
__exportStar(require("./lib/useListItemSelect"), exports);
|
|
25
25
|
__exportStar(require("./lib/useListModel"), exports);
|
|
26
26
|
__exportStar(require("./lib/useGridModel"), exports);
|
|
27
|
+
__exportStar(require("./lib/useListItemAllowChildStrings"), exports);
|
|
27
28
|
var ListBox_1 = require("./lib/ListBox");
|
|
28
29
|
Object.defineProperty(exports, "ListBox", { enumerable: true, get: function () { return ListBox_1.ListBox; } });
|
|
29
30
|
var useSelectionListModel_1 = require("./lib/useSelectionListModel");
|
|
@@ -139,6 +139,23 @@ export declare const useCursorListModel: (<TT_Special_Generic>(config?: (Partial
|
|
|
139
139
|
pageSize: number;
|
|
140
140
|
id: string;
|
|
141
141
|
getId: (item: any) => string;
|
|
142
|
+
/**
|
|
143
|
+
* Factory function that does type checking to create navigation managers. Navigation managers
|
|
144
|
+
* are expected to handle all methods of a grid. If your use-case isn't meant to handle a grid,
|
|
145
|
+
* pick one of the existing navigation managers and override the methods you wish to implement.
|
|
146
|
+
*
|
|
147
|
+
* For example,
|
|
148
|
+
* ```tsx
|
|
149
|
+
* import {createNavigationManager, wrappingNavigationManager} from '@workday/canvas-kit-react/collection'
|
|
150
|
+
*
|
|
151
|
+
* const navigationManager = createNavigationManager({
|
|
152
|
+
* ...wrappingNavigationManager,
|
|
153
|
+
* getNext(id, {state}) {
|
|
154
|
+
* //
|
|
155
|
+
* }
|
|
156
|
+
* })
|
|
157
|
+
* ```
|
|
158
|
+
*/
|
|
142
159
|
getTextValue: (item: any) => string;
|
|
143
160
|
nonInteractiveIds: string[];
|
|
144
161
|
orientation: import("./useBaseListModel").Orientation;
|
|
@@ -1122,6 +1139,23 @@ export declare const useCursorListModel: (<TT_Special_Generic>(config?: (Partial
|
|
|
1122
1139
|
pageSize: number;
|
|
1123
1140
|
id: string;
|
|
1124
1141
|
getId: (item: any) => string;
|
|
1142
|
+
/**
|
|
1143
|
+
* Factory function that does type checking to create navigation managers. Navigation managers
|
|
1144
|
+
* are expected to handle all methods of a grid. If your use-case isn't meant to handle a grid,
|
|
1145
|
+
* pick one of the existing navigation managers and override the methods you wish to implement.
|
|
1146
|
+
*
|
|
1147
|
+
* For example,
|
|
1148
|
+
* ```tsx
|
|
1149
|
+
* import {createNavigationManager, wrappingNavigationManager} from '@workday/canvas-kit-react/collection'
|
|
1150
|
+
*
|
|
1151
|
+
* const navigationManager = createNavigationManager({
|
|
1152
|
+
* ...wrappingNavigationManager,
|
|
1153
|
+
* getNext(id, {state}) {
|
|
1154
|
+
* //
|
|
1155
|
+
* }
|
|
1156
|
+
* })
|
|
1157
|
+
* ```
|
|
1158
|
+
*/
|
|
1125
1159
|
getTextValue: (item: any) => string;
|
|
1126
1160
|
nonInteractiveIds: string[];
|
|
1127
1161
|
orientation: import("./useBaseListModel").Orientation;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCursorListModel.d.ts","sourceRoot":"","sources":["../../../../collection/lib/useCursorListModel.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAA0B,OAAO,EAAC,MAAM,kCAAkC,CAAC;AAElF,OAAO,EAAmB,IAAI,
|
|
1
|
+
{"version":3,"file":"useCursorListModel.d.ts","sourceRoot":"","sources":["../../../../collection/lib/useCursorListModel.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAA0B,OAAO,EAAC,MAAM,kCAAkC,CAAC;AAElF,OAAO,EAAmB,IAAI,EAAC,MAAM,oBAAoB,CAAC;AAE1D,aAAK,eAAe,GAAG,IAAI,CAAC,UAAU,CAAC,OAAO,kBAAkB,CAAC,EAAE,OAAO,CAAC,CAAC;AAE5E;;;;GAIG;AACH,MAAM,WAAW,iBAAiB;IAChC;0CACsC;IACtC,QAAQ,EAAE,mBAAmB,CAAC;IAC9B;mCAC+B;IAC/B,OAAO,EAAE,mBAAmB,CAAC;IAC7B,0CAA0C;IAC1C,OAAO,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,eAAe,KAAK,IAAI,CAAC,OAAO,CAAC,CAAC;IAC/D;2FACuF;IACvF,OAAO,EAAE,mBAAmB,CAAC;IAC7B;uCACmC;IACnC,UAAU,EAAE,mBAAmB,CAAC;IAChC;+FAC2F;IAC3F,WAAW,EAAE,mBAAmB,CAAC;IACjC;0CACsC;IACtC,cAAc,EAAE,mBAAmB,CAAC;IACpC;kBACc;IACd,aAAa,EAAE,mBAAmB,CAAC;IACnC;kBACc;IACd,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AkD;;;;;;;;;;;;;;QA/ElD,wDAAwD;;QAExD;;;;WAIG;;QAEH;;;WAGG;;;;;;;;;;;;;;;;;;;QAMH;;;WAGG;;;;;QASH,mEAAmE;mBACxD;YAAC,EAAE,EAAE,MAAM,CAAA;SAAC;QAIvB;;;;;WAKG;;QAKH;;;WAGG;;QAKH;;;;;WAKG;;QAOH;;;;;WAKG;;QAKH,mDAAmD;;QAKnD,kDAAkD;;;;;;;;;;;;;;;EA0BpD,CAAC"}
|
|
@@ -301,7 +301,7 @@ exports.useCursorListModel = common_1.createModelHook({
|
|
|
301
301
|
registerItem(data) {
|
|
302
302
|
// point the cursor at the first item
|
|
303
303
|
if (!initialCurrentRef.current) {
|
|
304
|
-
initialCurrentRef.current =
|
|
304
|
+
initialCurrentRef.current = list.getId(data.item);
|
|
305
305
|
setCursorId(initialCurrentRef.current);
|
|
306
306
|
}
|
|
307
307
|
list.events.registerItem(data);
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This elemProps hook allows for children values to be considered identifiers if the children
|
|
3
|
+
* are strings. This can be useful for autocomplete or select components that allow string values.
|
|
4
|
+
* This hook must be defined _before_ {@link useListItemRegister} because it sets the `data-id`
|
|
5
|
+
* attribute if one hasn't been defined by the application.
|
|
6
|
+
*
|
|
7
|
+
* An example might look like:
|
|
8
|
+
* ```tsx
|
|
9
|
+
* const useMyListItem = composeHooks(
|
|
10
|
+
* // any other hooks here
|
|
11
|
+
* useListItemSelect,
|
|
12
|
+
* useListItemRegister,
|
|
13
|
+
* useListItemAllowChildStrings
|
|
14
|
+
* )
|
|
15
|
+
*
|
|
16
|
+
*
|
|
17
|
+
* <MyList onSelect={({id}) => {
|
|
18
|
+
* console.log(id) // will be "First" or "Second"
|
|
19
|
+
* }}>
|
|
20
|
+
* <MyList.Item>First</MyList.Item>
|
|
21
|
+
* <MyList.Item>Second</MyList.Item>
|
|
22
|
+
* </MyList>
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
export declare const useListItemAllowChildStrings: import("@workday/canvas-kit-react/common").BehaviorHook<{
|
|
26
|
+
state: {
|
|
27
|
+
selectedIds: string[] | "all";
|
|
28
|
+
unselectedIds: string[];
|
|
29
|
+
cursorId: string;
|
|
30
|
+
columnCount: number;
|
|
31
|
+
pageSizeRef: import("react").MutableRefObject<number>;
|
|
32
|
+
UNSTABLE_virtual: {
|
|
33
|
+
virtualItems: import("./react-virtual").VirtualItem[];
|
|
34
|
+
totalSize: number;
|
|
35
|
+
scrollToOffset: (index: number, options?: import("./react-virtual").ScrollToOffsetOptions | undefined) => void;
|
|
36
|
+
scrollToIndex: (index: number, options?: import("./react-virtual").ScrollToIndexOptions | undefined) => void;
|
|
37
|
+
measure: () => void;
|
|
38
|
+
};
|
|
39
|
+
UNSTABLE_defaultItemHeight: number;
|
|
40
|
+
containerRef: import("react").RefObject<HTMLDivElement>;
|
|
41
|
+
id: string;
|
|
42
|
+
orientation: "horizontal" | "vertical";
|
|
43
|
+
indexRef: import("react").MutableRefObject<number>;
|
|
44
|
+
nonInteractiveIds: string[];
|
|
45
|
+
isVirtualized: boolean;
|
|
46
|
+
items: import("@workday/canvas-kit-react/collection").Item<any>[];
|
|
47
|
+
};
|
|
48
|
+
events: {
|
|
49
|
+
select(data: {
|
|
50
|
+
id: string;
|
|
51
|
+
}): void;
|
|
52
|
+
selectAll(): void;
|
|
53
|
+
unselectAll(): void;
|
|
54
|
+
registerItem(data: {
|
|
55
|
+
item: any;
|
|
56
|
+
textValue: string;
|
|
57
|
+
}): void;
|
|
58
|
+
goTo(data: {
|
|
59
|
+
id: string;
|
|
60
|
+
}): void;
|
|
61
|
+
goToNext(): void;
|
|
62
|
+
goToPrevious(): void;
|
|
63
|
+
goToPreviousRow(): void;
|
|
64
|
+
goToNextRow(): void;
|
|
65
|
+
goToFirst(): void;
|
|
66
|
+
goToLast(): void;
|
|
67
|
+
goToFirstOfRow(): void;
|
|
68
|
+
goToLastOfRow(): void;
|
|
69
|
+
goToNextPage(): void;
|
|
70
|
+
goToPreviousPage(): void;
|
|
71
|
+
unregisterItem(data: {
|
|
72
|
+
id: string;
|
|
73
|
+
}): void;
|
|
74
|
+
updateItemHeight(data: {
|
|
75
|
+
value: number;
|
|
76
|
+
}): void;
|
|
77
|
+
};
|
|
78
|
+
selection: import("./useSelectionListModel").SelectionManager;
|
|
79
|
+
navigation: import("./useCursorListModel").NavigationManager;
|
|
80
|
+
getId: (item: any) => string;
|
|
81
|
+
}, {
|
|
82
|
+
'data-id'?: string | undefined;
|
|
83
|
+
}>;
|
|
84
|
+
//# sourceMappingURL=useListItemAllowChildStrings.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useListItemAllowChildStrings.d.ts","sourceRoot":"","sources":["../../../../collection/lib/useListItemAllowChildStrings.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,eAAO,MAAM,4BAA4B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EASxC,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useListItemAllowChildStrings = void 0;
|
|
4
|
+
const common_1 = require("@workday/canvas-kit-react/common");
|
|
5
|
+
const collection_1 = require("@workday/canvas-kit-react/collection");
|
|
6
|
+
/**
|
|
7
|
+
* This elemProps hook allows for children values to be considered identifiers if the children
|
|
8
|
+
* are strings. This can be useful for autocomplete or select components that allow string values.
|
|
9
|
+
* This hook must be defined _before_ {@link useListItemRegister} because it sets the `data-id`
|
|
10
|
+
* attribute if one hasn't been defined by the application.
|
|
11
|
+
*
|
|
12
|
+
* An example might look like:
|
|
13
|
+
* ```tsx
|
|
14
|
+
* const useMyListItem = composeHooks(
|
|
15
|
+
* // any other hooks here
|
|
16
|
+
* useListItemSelect,
|
|
17
|
+
* useListItemRegister,
|
|
18
|
+
* useListItemAllowChildStrings
|
|
19
|
+
* )
|
|
20
|
+
*
|
|
21
|
+
*
|
|
22
|
+
* <MyList onSelect={({id}) => {
|
|
23
|
+
* console.log(id) // will be "First" or "Second"
|
|
24
|
+
* }}>
|
|
25
|
+
* <MyList.Item>First</MyList.Item>
|
|
26
|
+
* <MyList.Item>Second</MyList.Item>
|
|
27
|
+
* </MyList>
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
exports.useListItemAllowChildStrings = common_1.createElemPropsHook(collection_1.useListModel)((_, __, elemProps = {}) => {
|
|
31
|
+
const props = {};
|
|
32
|
+
if (!elemProps['data-id'] && typeof elemProps.children === 'string') {
|
|
33
|
+
props['data-id'] = elemProps.children;
|
|
34
|
+
}
|
|
35
|
+
return props;
|
|
36
|
+
});
|
|
@@ -79,5 +79,6 @@ export declare const useListItemRegister: import("@workday/canvas-kit-react/comm
|
|
|
79
79
|
'aria-setsize': number | undefined;
|
|
80
80
|
'aria-posinset': number | undefined;
|
|
81
81
|
style: React.CSSProperties;
|
|
82
|
+
id: string;
|
|
82
83
|
}>;
|
|
83
84
|
//# sourceMappingURL=useListItemRegister.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useListItemRegister.d.ts","sourceRoot":"","sources":["../../../../collection/lib/useListItemRegister.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAsB,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"useListItemRegister.d.ts","sourceRoot":"","sources":["../../../../collection/lib/useListItemRegister.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAsB,MAAM,OAAO,CAAC;AAU3C,OAAO,EAAC,IAAI,EAAC,MAAM,oBAAoB,CAAC;AACxC,OAAO,EAAC,WAAW,EAAC,MAAM,iBAAiB,CAAC;AAG5C;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAoE/B,CAAC"}
|
|
@@ -20,7 +20,7 @@ const useListModel_1 = require("./useListModel");
|
|
|
20
20
|
* );
|
|
21
21
|
* ```
|
|
22
22
|
*/
|
|
23
|
-
exports.useListItemRegister = common_1.createElemPropsHook(useListModel_1.useListModel)(({ state, events
|
|
23
|
+
exports.useListItemRegister = common_1.createElemPropsHook(useListModel_1.useListModel)(({ state, events }, ref, elemProps = {}) => {
|
|
24
24
|
var _a, _b, _c;
|
|
25
25
|
const [localId, setLocalId] = react_1.default.useState(elemProps['data-id'] || ((_a = elemProps.item) === null || _a === void 0 ? void 0 : _a.id) || '');
|
|
26
26
|
const { localRef, elementRef } = common_1.useLocalRef(common_1.useForkRef(ref, (_b = elemProps.virtual) === null || _b === void 0 ? void 0 : _b.measureRef));
|
|
@@ -47,7 +47,7 @@ exports.useListItemRegister = common_1.createElemPropsHook(useListModel_1.useLis
|
|
|
47
47
|
const itemId = localId || String(defaultId);
|
|
48
48
|
// TODO: Better lookup that using `items.find`. We need a more generic collection to handle seeing if an item already exists
|
|
49
49
|
// bail early if item already exists. This happens if items were already provided.
|
|
50
|
-
if (state.items.find(item =>
|
|
50
|
+
if (state.items.find(item => item.id === itemId)) {
|
|
51
51
|
return;
|
|
52
52
|
}
|
|
53
53
|
events.registerItem({
|
|
@@ -70,5 +70,6 @@ exports.useListItemRegister = common_1.createElemPropsHook(useListModel_1.useLis
|
|
|
70
70
|
'aria-setsize': (_c = elemProps.virtual) === null || _c === void 0 ? void 0 : _c.size,
|
|
71
71
|
'aria-posinset': elemProps.virtual ? elemProps.item.index + 1 : undefined,
|
|
72
72
|
style,
|
|
73
|
+
id: common_1.slugify(`${state.id}-${localId}`),
|
|
73
74
|
};
|
|
74
75
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../common/lib/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,0BAA0B,CAAC;AACzC,cAAc,sBAAsB,CAAC;AACrC,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../common/lib/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,0BAA0B,CAAC;AACzC,cAAc,sBAAsB,CAAC;AACrC,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC"}
|
|
@@ -22,6 +22,7 @@ __exportStar(require("./assert"), exports);
|
|
|
22
22
|
__exportStar(require("./useMount"), exports);
|
|
23
23
|
__exportStar(require("./components"), exports);
|
|
24
24
|
__exportStar(require("./models"), exports);
|
|
25
|
+
__exportStar(require("./slugify"), exports);
|
|
25
26
|
__exportStar(require("./elements"), exports);
|
|
26
27
|
__exportStar(require("./useConstant"), exports);
|
|
27
28
|
__exportStar(require("./useIsFullscreen"), exports);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"slugify.d.ts","sourceRoot":"","sources":["../../../../../common/lib/utils/slugify.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,wBAAgB,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAO7C"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.slugify = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Function that takes a string and returns a "slug" which can be used in HTML
|
|
6
|
+
*/
|
|
7
|
+
function slugify(input) {
|
|
8
|
+
return input
|
|
9
|
+
.trim()
|
|
10
|
+
.replace(/[^\w\s-]/g, '')
|
|
11
|
+
.replace(/[\s_-]+/g, '-')
|
|
12
|
+
.replace(/^-+|-+$/g, '')
|
|
13
|
+
.toLowerCase();
|
|
14
|
+
}
|
|
15
|
+
exports.slugify = slugify;
|
|
@@ -107,6 +107,7 @@ export declare const useMenuItem: import("@workday/canvas-kit-react/common").Beh
|
|
|
107
107
|
'aria-setsize': number | undefined;
|
|
108
108
|
'aria-posinset': number | undefined;
|
|
109
109
|
style: React.CSSProperties;
|
|
110
|
+
id: string;
|
|
110
111
|
}>;
|
|
111
112
|
export declare const MenuItem: import("@workday/canvas-kit-react/common").ElementComponentM<"button", MenuItemProps, {
|
|
112
113
|
state: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MenuItem.d.ts","sourceRoot":"","sources":["../../../../menu/lib/MenuItem.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAsB/B,MAAM,WAAW,aAAa;IAC5B;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B;AA4FD,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;sBA0BF,MAAM,cAAc
|
|
1
|
+
{"version":3,"file":"MenuItem.d.ts","sourceRoot":"","sources":["../../../../menu/lib/MenuItem.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAsB/B,MAAM,WAAW,aAAa;IAC5B;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B;AA4FD,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;sBA0BF,MAAM,cAAc;;;;;;;;;;;;;;;;;;;EAazC,CAAC;AAEF,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgBnB,CAAC"}
|
|
@@ -128,10 +128,10 @@ exports.useMenuItem = common_1.composeHooks(common_1.createElemPropsHook(useMenu
|
|
|
128
128
|
});
|
|
129
129
|
}
|
|
130
130
|
}
|
|
131
|
-
// We only need to run when the ID has changed. If the static API is used, the first time
|
|
131
|
+
// We only need to run when the ID or cursorId has changed. If the static API is used, the first time
|
|
132
132
|
// this is run, the id will be blank
|
|
133
133
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
134
|
-
}, [id]);
|
|
134
|
+
}, [id, model.state.cursorId]);
|
|
135
135
|
return {
|
|
136
136
|
ref: elementRef,
|
|
137
137
|
role: 'menuitem',
|
|
@@ -243,6 +243,7 @@ export declare const useTabsItem: import("@workday/canvas-kit-react/common").Beh
|
|
|
243
243
|
'aria-setsize': number | undefined;
|
|
244
244
|
'aria-posinset': number | undefined;
|
|
245
245
|
style: React.CSSProperties;
|
|
246
|
+
id: string;
|
|
246
247
|
}>;
|
|
247
248
|
export declare const TabsItem: import("@workday/canvas-kit-react/common").ElementComponentM<"button", TabsItemProps, {
|
|
248
249
|
state: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TabsItem.d.ts","sourceRoot":"","sources":["../../../../tabs/lib/TabsItem.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,EAIL,UAAU,EAGV,YAAY,EAKb,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAC,GAAG,EAAE,SAAS,EAAC,MAAM,kCAAkC,CAAC;AAYhE,MAAM,WAAW,aACf,SAAQ,YAAY,CAAC,OAAO,GAAG,EAAE,KAAK,CAAC,EACrC,OAAO,CAAC,IAAI,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;IACjC;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;;;;;;;;;;;OAaG;IACH,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B;;;;;OAKG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ;;;;OAIG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB;;;;OAIG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,eAAO,MAAM,aAAa;;;;oDAsFzB,CAAC;AAEF,eAAO,MAAM,WAAW
|
|
1
|
+
{"version":3,"file":"TabsItem.d.ts","sourceRoot":"","sources":["../../../../tabs/lib/TabsItem.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AAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TabsPanel.d.ts","sourceRoot":"","sources":["../../../../tabs/lib/TabsPanel.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,EAIL,YAAY,
|
|
1
|
+
{"version":3,"file":"TabsPanel.d.ts","sourceRoot":"","sources":["../../../../tabs/lib/TabsPanel.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,EAIL,YAAY,EAIb,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAC,IAAI,EAAC,MAAM,sCAAsC,CAAC;AAC1D,OAAO,EAAC,GAAG,EAAC,MAAM,kCAAkC,CAAC;AAIrD,MAAM,WAAW,aAAc,SAAQ,YAAY,CAAC,OAAO,GAAG,EAAE,KAAK,CAAC;IACpE;;OAEG;IACH,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B;;;;;OAKG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAID,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA2BxB,CAAC;AAEF,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAUpB,CAAC"}
|
|
@@ -24,9 +24,9 @@ exports.useTabsPanel = common_1.createElemPropsHook(useTabsModel_1.useTabsModel)
|
|
|
24
24
|
});
|
|
25
25
|
return {
|
|
26
26
|
role: 'tabpanel',
|
|
27
|
-
'aria-labelledby': `${state.id}-${localId}
|
|
27
|
+
'aria-labelledby': common_1.slugify(`${state.id}-${localId}`),
|
|
28
28
|
hidden: !!localId && localId !== state.selectedIds[0],
|
|
29
|
-
id: `tabpanel-${state.id}-${localId}
|
|
29
|
+
id: common_1.slugify(`tabpanel-${state.id}-${localId}`),
|
|
30
30
|
tabIndex: 0,
|
|
31
31
|
};
|
|
32
32
|
});
|
|
@@ -107,6 +107,7 @@ export declare const useActionBarItem: import("@workday/canvas-kit-react/common"
|
|
|
107
107
|
'aria-setsize': number | undefined;
|
|
108
108
|
'aria-posinset': number | undefined;
|
|
109
109
|
style: React.CSSProperties;
|
|
110
|
+
id: string;
|
|
110
111
|
}>;
|
|
111
112
|
export declare const ActionBarItem: import("@workday/canvas-kit-react/common").ElementComponentM<import("@workday/canvas-kit-react/common").ElementComponent<"button", import("@workday/canvas-kit-react/button").SecondaryButtonProps>, ActionBarItemProps, {
|
|
112
113
|
state: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ActionBarItem.d.ts","sourceRoot":"","sources":["../../../../action-bar/lib/ActionBarItem.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAU/B,MAAM,WAAW,kBAAkB;IACjC;;;;;;OAMG;IACH,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,eAAO,MAAM,gBAAgB
|
|
1
|
+
{"version":3,"file":"ActionBarItem.d.ts","sourceRoot":"","sources":["../../../../action-bar/lib/ActionBarItem.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAU/B,MAAM,WAAW,kBAAkB;IACjC;;;;;;OAMG;IACH,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAAgE,CAAC;AAE9F,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAMxB,CAAC"}
|
|
@@ -168,6 +168,7 @@ export declare const useBreadcrumbsItem: import("@workday/canvas-kit-react/commo
|
|
|
168
168
|
'aria-setsize': number | undefined;
|
|
169
169
|
'aria-posinset': number | undefined;
|
|
170
170
|
style: React.CSSProperties;
|
|
171
|
+
id: string;
|
|
171
172
|
}>;
|
|
172
173
|
export declare const BreadcrumbsCurrentItem: import("@workday/canvas-kit-react/common").ElementComponentM<"li", BreadcrumbsCurrentItemProps, {
|
|
173
174
|
state: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BreadcrumbsCurrentItem.d.ts","sourceRoot":"","sources":["../../../../breadcrumbs/lib/BreadcrumbsCurrentItem.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAQ1B,OAAO,EAAkB,oBAAoB,EAAC,MAAM,mCAAmC,CAAC;AAMxF,OAAO,EAAO,SAAS,EAAC,MAAM,gCAAgC,CAAC;AAE/D,MAAM,WAAW,2BAA4B,SAAQ,SAAS;IAC5D,YAAY,CAAC,EAAE,oBAAoB,CAAC;CACrC;AAED,eAAO,MAAM,kBAAkB
|
|
1
|
+
{"version":3,"file":"BreadcrumbsCurrentItem.d.ts","sourceRoot":"","sources":["../../../../breadcrumbs/lib/BreadcrumbsCurrentItem.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAQ1B,OAAO,EAAkB,oBAAoB,EAAC,MAAM,mCAAmC,CAAC;AAMxF,OAAO,EAAO,SAAS,EAAC,MAAM,gCAAgC,CAAC;AAE/D,MAAM,WAAW,2BAA4B,SAAQ,SAAS;IAC5D,YAAY,CAAC,EAAE,oBAAoB,CAAC;CACrC;AAED,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAkB9B,CAAC;AAEF,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAwBlC,CAAC"}
|
|
@@ -111,6 +111,7 @@ export declare const useBreadcrumbsItem: import("@workday/canvas-kit-react/commo
|
|
|
111
111
|
'aria-setsize': number | undefined;
|
|
112
112
|
'aria-posinset': number | undefined;
|
|
113
113
|
style: React.CSSProperties;
|
|
114
|
+
id: string;
|
|
114
115
|
}>;
|
|
115
116
|
export declare const BreadcrumbsItem: import("@workday/canvas-kit-react/common").ElementComponentM<"li", BreadcrumbsItemProps, {
|
|
116
117
|
state: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BreadcrumbsItem.d.ts","sourceRoot":"","sources":["../../../../breadcrumbs/lib/BreadcrumbsItem.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAW/B,OAAO,EAAO,SAAS,EAAC,MAAM,kCAAkC,CAAC;AAOjE,MAAM,WAAW,oBAAqB,SAAQ,SAAS;IACrD;;;;;;OAMG;IACH,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,eAAO,MAAM,kBAAkB
|
|
1
|
+
{"version":3,"file":"BreadcrumbsItem.d.ts","sourceRoot":"","sources":["../../../../breadcrumbs/lib/BreadcrumbsItem.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAW/B,OAAO,EAAO,SAAS,EAAC,MAAM,kCAAkC,CAAC;AAOjE,MAAM,WAAW,oBAAqB,SAAQ,SAAS;IACrD;;;;;;OAMG;IACH,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAoB9B,CAAC;AAEF,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwB1B,CAAC"}
|
|
@@ -10,7 +10,8 @@ export * from './lib/useListItemRovingFocus';
|
|
|
10
10
|
export * from './lib/useListItemSelect';
|
|
11
11
|
export * from './lib/useListModel';
|
|
12
12
|
export * from './lib/useGridModel';
|
|
13
|
-
export
|
|
13
|
+
export * from './lib/useListItemAllowChildStrings';
|
|
14
|
+
export { ListBox, ListBoxProps } from './lib/ListBox';
|
|
14
15
|
export { singleSelectionManager, multiSelectionManager, isSelected, } from './lib/useSelectionListModel';
|
|
15
16
|
export { wrappingNavigationManager, navigationManager } from './lib/useCursorListModel';
|
|
16
17
|
//# 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,cAAc,oBAAoB,CAAC;AACnC,OAAO,EAAC,OAAO,EAAC,MAAM,eAAe,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,cAAc,oCAAoC,CAAC;AACnD,OAAO,EAAC,OAAO,EAAE,YAAY,EAAC,MAAM,eAAe,CAAC;AACpD,OAAO,EACL,sBAAsB,EACtB,qBAAqB,EACrB,UAAU,GACX,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAC,yBAAyB,EAAE,iBAAiB,EAAC,MAAM,0BAA0B,CAAC"}
|
|
@@ -10,6 +10,7 @@ export * from './lib/useListItemRovingFocus';
|
|
|
10
10
|
export * from './lib/useListItemSelect';
|
|
11
11
|
export * from './lib/useListModel';
|
|
12
12
|
export * from './lib/useGridModel';
|
|
13
|
+
export * from './lib/useListItemAllowChildStrings';
|
|
13
14
|
export { ListBox } from './lib/ListBox';
|
|
14
15
|
export { singleSelectionManager, multiSelectionManager, isSelected, } from './lib/useSelectionListModel';
|
|
15
16
|
export { wrappingNavigationManager, navigationManager } from './lib/useCursorListModel';
|
|
@@ -139,6 +139,23 @@ export declare const useCursorListModel: (<TT_Special_Generic>(config?: (Partial
|
|
|
139
139
|
pageSize: number;
|
|
140
140
|
id: string;
|
|
141
141
|
getId: (item: any) => string;
|
|
142
|
+
/**
|
|
143
|
+
* Factory function that does type checking to create navigation managers. Navigation managers
|
|
144
|
+
* are expected to handle all methods of a grid. If your use-case isn't meant to handle a grid,
|
|
145
|
+
* pick one of the existing navigation managers and override the methods you wish to implement.
|
|
146
|
+
*
|
|
147
|
+
* For example,
|
|
148
|
+
* ```tsx
|
|
149
|
+
* import {createNavigationManager, wrappingNavigationManager} from '@workday/canvas-kit-react/collection'
|
|
150
|
+
*
|
|
151
|
+
* const navigationManager = createNavigationManager({
|
|
152
|
+
* ...wrappingNavigationManager,
|
|
153
|
+
* getNext(id, {state}) {
|
|
154
|
+
* //
|
|
155
|
+
* }
|
|
156
|
+
* })
|
|
157
|
+
* ```
|
|
158
|
+
*/
|
|
142
159
|
getTextValue: (item: any) => string;
|
|
143
160
|
nonInteractiveIds: string[];
|
|
144
161
|
orientation: import("./useBaseListModel").Orientation;
|
|
@@ -1122,6 +1139,23 @@ export declare const useCursorListModel: (<TT_Special_Generic>(config?: (Partial
|
|
|
1122
1139
|
pageSize: number;
|
|
1123
1140
|
id: string;
|
|
1124
1141
|
getId: (item: any) => string;
|
|
1142
|
+
/**
|
|
1143
|
+
* Factory function that does type checking to create navigation managers. Navigation managers
|
|
1144
|
+
* are expected to handle all methods of a grid. If your use-case isn't meant to handle a grid,
|
|
1145
|
+
* pick one of the existing navigation managers and override the methods you wish to implement.
|
|
1146
|
+
*
|
|
1147
|
+
* For example,
|
|
1148
|
+
* ```tsx
|
|
1149
|
+
* import {createNavigationManager, wrappingNavigationManager} from '@workday/canvas-kit-react/collection'
|
|
1150
|
+
*
|
|
1151
|
+
* const navigationManager = createNavigationManager({
|
|
1152
|
+
* ...wrappingNavigationManager,
|
|
1153
|
+
* getNext(id, {state}) {
|
|
1154
|
+
* //
|
|
1155
|
+
* }
|
|
1156
|
+
* })
|
|
1157
|
+
* ```
|
|
1158
|
+
*/
|
|
1125
1159
|
getTextValue: (item: any) => string;
|
|
1126
1160
|
nonInteractiveIds: string[];
|
|
1127
1161
|
orientation: import("./useBaseListModel").Orientation;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCursorListModel.d.ts","sourceRoot":"","sources":["../../../../collection/lib/useCursorListModel.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAA0B,OAAO,EAAC,MAAM,kCAAkC,CAAC;AAElF,OAAO,EAAmB,IAAI,
|
|
1
|
+
{"version":3,"file":"useCursorListModel.d.ts","sourceRoot":"","sources":["../../../../collection/lib/useCursorListModel.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAA0B,OAAO,EAAC,MAAM,kCAAkC,CAAC;AAElF,OAAO,EAAmB,IAAI,EAAC,MAAM,oBAAoB,CAAC;AAE1D,aAAK,eAAe,GAAG,IAAI,CAAC,UAAU,CAAC,OAAO,kBAAkB,CAAC,EAAE,OAAO,CAAC,CAAC;AAE5E;;;;GAIG;AACH,MAAM,WAAW,iBAAiB;IAChC;0CACsC;IACtC,QAAQ,EAAE,mBAAmB,CAAC;IAC9B;mCAC+B;IAC/B,OAAO,EAAE,mBAAmB,CAAC;IAC7B,0CAA0C;IAC1C,OAAO,EAAE,CAAC,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;IAEH;;;;;;;;;;;OAWG;;IAEH;;;OAGG;;;;IAzQP;;;;;;;;;;;;;;;;OAgBG;;;;;;;;IAsRC,wDAAwD;;IAExD;;;;OAIG;;IAEH;;;OAGG;;;;;;;;;;;;;;;;;;IAMH;;;OAGG;;;;;IASH,mEAAmE;eACxD;QAAC,EAAE,EAAE,MAAM,CAAA;KAAC;IAIvB;;;;;OAKG;;IAKH;;;OAGG;;IAKH;;;;;OAKG;;IAOH;;;;;OAKG;;IAKH,mDAAmD;;IAKnD,kDAAkD;;;;;;;;;;;;;;QA/ElD,wDAAwD;;QAExD;;;;WAIG;;QAEH;;;WAGG;;;;;;;;;;;;;;;;;;;QAMH;;;WAGG;;;;;QASH,mEAAmE;mBACxD;YAAC,EAAE,EAAE,MAAM,CAAA;SAAC;QAIvB;;;;;WAKG;;QAKH;;;WAGG;;QAKH;;;;;WAKG;;QAOH;;;;;WAKG;;QAKH,mDAAmD;;QAKnD,kDAAkD;;;;;;;;;;;;;;;EA0BpD,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { assert, createModelHook } from '@workday/canvas-kit-react/common';
|
|
3
|
-
import { useBaseListModel
|
|
3
|
+
import { useBaseListModel } from './useBaseListModel';
|
|
4
4
|
/**
|
|
5
5
|
* Factory function that does type checking to create navigation managers. Navigation managers
|
|
6
6
|
* are expected to handle all methods of a grid. If your use-case isn't meant to handle a grid,
|
|
@@ -286,7 +286,7 @@ export const useCursorListModel = createModelHook({
|
|
|
286
286
|
registerItem(data) {
|
|
287
287
|
// point the cursor at the first item
|
|
288
288
|
if (!initialCurrentRef.current) {
|
|
289
|
-
initialCurrentRef.current = getId(data.item);
|
|
289
|
+
initialCurrentRef.current = list.getId(data.item);
|
|
290
290
|
setCursorId(initialCurrentRef.current);
|
|
291
291
|
}
|
|
292
292
|
list.events.registerItem(data);
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This elemProps hook allows for children values to be considered identifiers if the children
|
|
3
|
+
* are strings. This can be useful for autocomplete or select components that allow string values.
|
|
4
|
+
* This hook must be defined _before_ {@link useListItemRegister} because it sets the `data-id`
|
|
5
|
+
* attribute if one hasn't been defined by the application.
|
|
6
|
+
*
|
|
7
|
+
* An example might look like:
|
|
8
|
+
* ```tsx
|
|
9
|
+
* const useMyListItem = composeHooks(
|
|
10
|
+
* // any other hooks here
|
|
11
|
+
* useListItemSelect,
|
|
12
|
+
* useListItemRegister,
|
|
13
|
+
* useListItemAllowChildStrings
|
|
14
|
+
* )
|
|
15
|
+
*
|
|
16
|
+
*
|
|
17
|
+
* <MyList onSelect={({id}) => {
|
|
18
|
+
* console.log(id) // will be "First" or "Second"
|
|
19
|
+
* }}>
|
|
20
|
+
* <MyList.Item>First</MyList.Item>
|
|
21
|
+
* <MyList.Item>Second</MyList.Item>
|
|
22
|
+
* </MyList>
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
export declare const useListItemAllowChildStrings: import("@workday/canvas-kit-react/common").BehaviorHook<{
|
|
26
|
+
state: {
|
|
27
|
+
selectedIds: string[] | "all";
|
|
28
|
+
unselectedIds: string[];
|
|
29
|
+
cursorId: string;
|
|
30
|
+
columnCount: number;
|
|
31
|
+
pageSizeRef: import("react").MutableRefObject<number>;
|
|
32
|
+
UNSTABLE_virtual: {
|
|
33
|
+
virtualItems: import("./react-virtual").VirtualItem[];
|
|
34
|
+
totalSize: number;
|
|
35
|
+
scrollToOffset: (index: number, options?: import("./react-virtual").ScrollToOffsetOptions | undefined) => void;
|
|
36
|
+
scrollToIndex: (index: number, options?: import("./react-virtual").ScrollToIndexOptions | undefined) => void;
|
|
37
|
+
measure: () => void;
|
|
38
|
+
};
|
|
39
|
+
UNSTABLE_defaultItemHeight: number;
|
|
40
|
+
containerRef: import("react").RefObject<HTMLDivElement>;
|
|
41
|
+
id: string;
|
|
42
|
+
orientation: "horizontal" | "vertical";
|
|
43
|
+
indexRef: import("react").MutableRefObject<number>;
|
|
44
|
+
nonInteractiveIds: string[];
|
|
45
|
+
isVirtualized: boolean;
|
|
46
|
+
items: import("@workday/canvas-kit-react/collection").Item<any>[];
|
|
47
|
+
};
|
|
48
|
+
events: {
|
|
49
|
+
select(data: {
|
|
50
|
+
id: string;
|
|
51
|
+
}): void;
|
|
52
|
+
selectAll(): void;
|
|
53
|
+
unselectAll(): void;
|
|
54
|
+
registerItem(data: {
|
|
55
|
+
item: any;
|
|
56
|
+
textValue: string;
|
|
57
|
+
}): void;
|
|
58
|
+
goTo(data: {
|
|
59
|
+
id: string;
|
|
60
|
+
}): void;
|
|
61
|
+
goToNext(): void;
|
|
62
|
+
goToPrevious(): void;
|
|
63
|
+
goToPreviousRow(): void;
|
|
64
|
+
goToNextRow(): void;
|
|
65
|
+
goToFirst(): void;
|
|
66
|
+
goToLast(): void;
|
|
67
|
+
goToFirstOfRow(): void;
|
|
68
|
+
goToLastOfRow(): void;
|
|
69
|
+
goToNextPage(): void;
|
|
70
|
+
goToPreviousPage(): void;
|
|
71
|
+
unregisterItem(data: {
|
|
72
|
+
id: string;
|
|
73
|
+
}): void;
|
|
74
|
+
updateItemHeight(data: {
|
|
75
|
+
value: number;
|
|
76
|
+
}): void;
|
|
77
|
+
};
|
|
78
|
+
selection: import("./useSelectionListModel").SelectionManager;
|
|
79
|
+
navigation: import("./useCursorListModel").NavigationManager;
|
|
80
|
+
getId: (item: any) => string;
|
|
81
|
+
}, {
|
|
82
|
+
'data-id'?: string | undefined;
|
|
83
|
+
}>;
|
|
84
|
+
//# sourceMappingURL=useListItemAllowChildStrings.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useListItemAllowChildStrings.d.ts","sourceRoot":"","sources":["../../../../collection/lib/useListItemAllowChildStrings.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,eAAO,MAAM,4BAA4B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EASxC,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { createElemPropsHook } from '@workday/canvas-kit-react/common';
|
|
2
|
+
import { useListModel } from '@workday/canvas-kit-react/collection';
|
|
3
|
+
/**
|
|
4
|
+
* This elemProps hook allows for children values to be considered identifiers if the children
|
|
5
|
+
* are strings. This can be useful for autocomplete or select components that allow string values.
|
|
6
|
+
* This hook must be defined _before_ {@link useListItemRegister} because it sets the `data-id`
|
|
7
|
+
* attribute if one hasn't been defined by the application.
|
|
8
|
+
*
|
|
9
|
+
* An example might look like:
|
|
10
|
+
* ```tsx
|
|
11
|
+
* const useMyListItem = composeHooks(
|
|
12
|
+
* // any other hooks here
|
|
13
|
+
* useListItemSelect,
|
|
14
|
+
* useListItemRegister,
|
|
15
|
+
* useListItemAllowChildStrings
|
|
16
|
+
* )
|
|
17
|
+
*
|
|
18
|
+
*
|
|
19
|
+
* <MyList onSelect={({id}) => {
|
|
20
|
+
* console.log(id) // will be "First" or "Second"
|
|
21
|
+
* }}>
|
|
22
|
+
* <MyList.Item>First</MyList.Item>
|
|
23
|
+
* <MyList.Item>Second</MyList.Item>
|
|
24
|
+
* </MyList>
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
export const useListItemAllowChildStrings = createElemPropsHook(useListModel)((_, __, elemProps = {}) => {
|
|
28
|
+
const props = {};
|
|
29
|
+
if (!elemProps['data-id'] && typeof elemProps.children === 'string') {
|
|
30
|
+
props['data-id'] = elemProps.children;
|
|
31
|
+
}
|
|
32
|
+
return props;
|
|
33
|
+
});
|
|
@@ -79,5 +79,6 @@ export declare const useListItemRegister: import("@workday/canvas-kit-react/comm
|
|
|
79
79
|
'aria-setsize': number | undefined;
|
|
80
80
|
'aria-posinset': number | undefined;
|
|
81
81
|
style: React.CSSProperties;
|
|
82
|
+
id: string;
|
|
82
83
|
}>;
|
|
83
84
|
//# sourceMappingURL=useListItemRegister.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useListItemRegister.d.ts","sourceRoot":"","sources":["../../../../collection/lib/useListItemRegister.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAsB,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"useListItemRegister.d.ts","sourceRoot":"","sources":["../../../../collection/lib/useListItemRegister.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAsB,MAAM,OAAO,CAAC;AAU3C,OAAO,EAAC,IAAI,EAAC,MAAM,oBAAoB,CAAC;AACxC,OAAO,EAAC,WAAW,EAAC,MAAM,iBAAiB,CAAC;AAG5C;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAoE/B,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { useMountLayout, createElemPropsHook, useLocalRef, useForkRef, } from '@workday/canvas-kit-react/common';
|
|
2
|
+
import { useMountLayout, createElemPropsHook, useLocalRef, useForkRef, slugify, } from '@workday/canvas-kit-react/common';
|
|
3
3
|
import { useListModel } from './useListModel';
|
|
4
4
|
/**
|
|
5
5
|
* This elemProps hook is the base of all item component hooks. It registers an item with a
|
|
@@ -14,7 +14,7 @@ import { useListModel } from './useListModel';
|
|
|
14
14
|
* );
|
|
15
15
|
* ```
|
|
16
16
|
*/
|
|
17
|
-
export const useListItemRegister = createElemPropsHook(useListModel)(({ state, events
|
|
17
|
+
export const useListItemRegister = createElemPropsHook(useListModel)(({ state, events }, ref, elemProps = {}) => {
|
|
18
18
|
var _a, _b, _c;
|
|
19
19
|
const [localId, setLocalId] = React.useState(elemProps['data-id'] || ((_a = elemProps.item) === null || _a === void 0 ? void 0 : _a.id) || '');
|
|
20
20
|
const { localRef, elementRef } = useLocalRef(useForkRef(ref, (_b = elemProps.virtual) === null || _b === void 0 ? void 0 : _b.measureRef));
|
|
@@ -41,7 +41,7 @@ export const useListItemRegister = createElemPropsHook(useListModel)(({ state, e
|
|
|
41
41
|
const itemId = localId || String(defaultId);
|
|
42
42
|
// TODO: Better lookup that using `items.find`. We need a more generic collection to handle seeing if an item already exists
|
|
43
43
|
// bail early if item already exists. This happens if items were already provided.
|
|
44
|
-
if (state.items.find(item =>
|
|
44
|
+
if (state.items.find(item => item.id === itemId)) {
|
|
45
45
|
return;
|
|
46
46
|
}
|
|
47
47
|
events.registerItem({
|
|
@@ -64,5 +64,6 @@ export const useListItemRegister = createElemPropsHook(useListModel)(({ state, e
|
|
|
64
64
|
'aria-setsize': (_c = elemProps.virtual) === null || _c === void 0 ? void 0 : _c.size,
|
|
65
65
|
'aria-posinset': elemProps.virtual ? elemProps.item.index + 1 : undefined,
|
|
66
66
|
style,
|
|
67
|
+
id: slugify(`${state.id}-${localId}`),
|
|
67
68
|
};
|
|
68
69
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../common/lib/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,0BAA0B,CAAC;AACzC,cAAc,sBAAsB,CAAC;AACrC,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../common/lib/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,0BAA0B,CAAC;AACzC,cAAc,sBAAsB,CAAC;AACrC,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"slugify.d.ts","sourceRoot":"","sources":["../../../../../common/lib/utils/slugify.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,wBAAgB,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAO7C"}
|
|
@@ -107,6 +107,7 @@ export declare const useMenuItem: import("@workday/canvas-kit-react/common").Beh
|
|
|
107
107
|
'aria-setsize': number | undefined;
|
|
108
108
|
'aria-posinset': number | undefined;
|
|
109
109
|
style: React.CSSProperties;
|
|
110
|
+
id: string;
|
|
110
111
|
}>;
|
|
111
112
|
export declare const MenuItem: import("@workday/canvas-kit-react/common").ElementComponentM<"button", MenuItemProps, {
|
|
112
113
|
state: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MenuItem.d.ts","sourceRoot":"","sources":["../../../../menu/lib/MenuItem.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAsB/B,MAAM,WAAW,aAAa;IAC5B;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B;AA4FD,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;sBA0BF,MAAM,cAAc
|
|
1
|
+
{"version":3,"file":"MenuItem.d.ts","sourceRoot":"","sources":["../../../../menu/lib/MenuItem.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAsB/B,MAAM,WAAW,aAAa;IAC5B;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B;AA4FD,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;sBA0BF,MAAM,cAAc;;;;;;;;;;;;;;;;;;;EAazC,CAAC;AAEF,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgBnB,CAAC"}
|
|
@@ -106,10 +106,10 @@ export const useMenuItem = composeHooks(createElemPropsHook(useMenuModel)((model
|
|
|
106
106
|
});
|
|
107
107
|
}
|
|
108
108
|
}
|
|
109
|
-
// We only need to run when the ID has changed. If the static API is used, the first time
|
|
109
|
+
// We only need to run when the ID or cursorId has changed. If the static API is used, the first time
|
|
110
110
|
// this is run, the id will be blank
|
|
111
111
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
112
|
-
}, [id]);
|
|
112
|
+
}, [id, model.state.cursorId]);
|
|
113
113
|
return {
|
|
114
114
|
ref: elementRef,
|
|
115
115
|
role: 'menuitem',
|
|
@@ -243,6 +243,7 @@ export declare const useTabsItem: import("@workday/canvas-kit-react/common").Beh
|
|
|
243
243
|
'aria-setsize': number | undefined;
|
|
244
244
|
'aria-posinset': number | undefined;
|
|
245
245
|
style: React.CSSProperties;
|
|
246
|
+
id: string;
|
|
246
247
|
}>;
|
|
247
248
|
export declare const TabsItem: import("@workday/canvas-kit-react/common").ElementComponentM<"button", TabsItemProps, {
|
|
248
249
|
state: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TabsItem.d.ts","sourceRoot":"","sources":["../../../../tabs/lib/TabsItem.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,EAIL,UAAU,EAGV,YAAY,EAKb,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAC,GAAG,EAAE,SAAS,EAAC,MAAM,kCAAkC,CAAC;AAYhE,MAAM,WAAW,aACf,SAAQ,YAAY,CAAC,OAAO,GAAG,EAAE,KAAK,CAAC,EACrC,OAAO,CAAC,IAAI,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;IACjC;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;;;;;;;;;;;OAaG;IACH,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B;;;;;OAKG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ;;;;OAIG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB;;;;OAIG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,eAAO,MAAM,aAAa;;;;oDAsFzB,CAAC;AAEF,eAAO,MAAM,WAAW
|
|
1
|
+
{"version":3,"file":"TabsItem.d.ts","sourceRoot":"","sources":["../../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;;;;;;;CAiBnB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TabsPanel.d.ts","sourceRoot":"","sources":["../../../../tabs/lib/TabsPanel.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,EAIL,YAAY,
|
|
1
|
+
{"version":3,"file":"TabsPanel.d.ts","sourceRoot":"","sources":["../../../../tabs/lib/TabsPanel.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,EAIL,YAAY,EAIb,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAC,IAAI,EAAC,MAAM,sCAAsC,CAAC;AAC1D,OAAO,EAAC,GAAG,EAAC,MAAM,kCAAkC,CAAC;AAIrD,MAAM,WAAW,aAAc,SAAQ,YAAY,CAAC,OAAO,GAAG,EAAE,KAAK,CAAC;IACpE;;OAEG;IACH,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B;;;;;OAKG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAID,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA2BxB,CAAC;AAEF,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAUpB,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import styled from '@emotion/styled';
|
|
3
|
-
import { createSubcomponent, useMountLayout, createElemPropsHook, hideMouseFocus, } from '@workday/canvas-kit-react/common';
|
|
3
|
+
import { createSubcomponent, useMountLayout, createElemPropsHook, hideMouseFocus, slugify, } from '@workday/canvas-kit-react/common';
|
|
4
4
|
import { Box } from '@workday/canvas-kit-react/layout';
|
|
5
5
|
import { useTabsModel } from './useTabsModel';
|
|
6
6
|
const StyledTabsPanel = styled(Box)(hideMouseFocus);
|
|
@@ -18,9 +18,9 @@ export const useTabsPanel = createElemPropsHook(useTabsModel)(({ state, events }
|
|
|
18
18
|
});
|
|
19
19
|
return {
|
|
20
20
|
role: 'tabpanel',
|
|
21
|
-
'aria-labelledby': `${state.id}-${localId}
|
|
21
|
+
'aria-labelledby': slugify(`${state.id}-${localId}`),
|
|
22
22
|
hidden: !!localId && localId !== state.selectedIds[0],
|
|
23
|
-
id: `tabpanel-${state.id}-${localId}
|
|
23
|
+
id: slugify(`tabpanel-${state.id}-${localId}`),
|
|
24
24
|
tabIndex: 0,
|
|
25
25
|
};
|
|
26
26
|
});
|
package/menu/lib/MenuItem.tsx
CHANGED
|
@@ -146,10 +146,10 @@ export const useMenuItem = composeHooks(
|
|
|
146
146
|
});
|
|
147
147
|
}
|
|
148
148
|
}
|
|
149
|
-
// We only need to run when the ID has changed. If the static API is used, the first time
|
|
149
|
+
// We only need to run when the ID or cursorId has changed. If the static API is used, the first time
|
|
150
150
|
// this is run, the id will be blank
|
|
151
151
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
152
|
-
}, [id]);
|
|
152
|
+
}, [id, model.state.cursorId]);
|
|
153
153
|
|
|
154
154
|
return {
|
|
155
155
|
ref: elementRef,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@workday/canvas-kit-react",
|
|
3
|
-
"version": "9.0.0-alpha.
|
|
3
|
+
"version": "9.0.0-alpha.415-next.17+5fd436a0",
|
|
4
4
|
"description": "The parent module that contains all Workday Canvas Kit React components",
|
|
5
5
|
"author": "Workday, Inc. (https://www.workday.com)",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"@emotion/styled": "^11.6.0",
|
|
50
50
|
"@popperjs/core": "^2.5.4",
|
|
51
51
|
"@workday/canvas-colors-web": "^2.0.0",
|
|
52
|
-
"@workday/canvas-kit-popup-stack": "^9.0.0-alpha.
|
|
52
|
+
"@workday/canvas-kit-popup-stack": "^9.0.0-alpha.415-next.17+5fd436a0",
|
|
53
53
|
"@workday/canvas-system-icons-web": "^3.0.0",
|
|
54
54
|
"@workday/design-assets-types": "^0.2.8",
|
|
55
55
|
"chroma-js": "^2.1.0",
|
|
@@ -66,5 +66,5 @@
|
|
|
66
66
|
"@workday/canvas-accent-icons-web": "^3.0.0",
|
|
67
67
|
"@workday/canvas-applet-icons-web": "^2.0.0"
|
|
68
68
|
},
|
|
69
|
-
"gitHead": "
|
|
69
|
+
"gitHead": "5fd436a0c644d68c8a97fd0f52f4b32c1d5b2bec"
|
|
70
70
|
}
|
package/tabs/lib/TabsPanel.tsx
CHANGED
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
ExtractProps,
|
|
9
9
|
hideMouseFocus,
|
|
10
10
|
StyledType,
|
|
11
|
+
slugify,
|
|
11
12
|
} from '@workday/canvas-kit-react/common';
|
|
12
13
|
import {Item} from '@workday/canvas-kit-react/collection';
|
|
13
14
|
import {Box} from '@workday/canvas-kit-react/layout';
|
|
@@ -58,9 +59,9 @@ export const useTabsPanel = createElemPropsHook(useTabsModel)(
|
|
|
58
59
|
|
|
59
60
|
return {
|
|
60
61
|
role: 'tabpanel' as const,
|
|
61
|
-
'aria-labelledby': `${state.id}-${localId}
|
|
62
|
+
'aria-labelledby': slugify(`${state.id}-${localId}`),
|
|
62
63
|
hidden: !!localId && localId !== state.selectedIds[0],
|
|
63
|
-
id: `tabpanel-${state.id}-${localId}
|
|
64
|
+
id: slugify(`tabpanel-${state.id}-${localId}`),
|
|
64
65
|
tabIndex: 0 as const,
|
|
65
66
|
};
|
|
66
67
|
}
|