@workday/canvas-kit-react 9.0.0-alpha.414-next.16 → 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/useListItemAllowChildStrings.ts +37 -0
- 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/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/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/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/package.json +3 -3
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,
|
|
@@ -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
|
+
);
|
|
@@ -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");
|
|
@@ -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
|
+
});
|
|
@@ -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';
|
|
@@ -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
|
+
});
|
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
|
}
|