@workday/canvas-kit-labs-react 7.1.4 → 7.2.0-427-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/combobox/README.md +4 -4
- package/combobox/index.ts +0 -4
- package/combobox/lib/AutocompleteList.tsx +5 -8
- package/combobox/lib/Combobox.tsx +14 -20
- package/combobox/lib/Status.tsx +1 -3
- package/combobox/package.json +2 -1
- package/common/index.ts +0 -2
- package/common/lib/theming/index.ts +0 -1
- package/common/lib/theming/useThemeRTL.ts +14 -13
- package/common/package.json +2 -1
- package/dist/commonjs/combobox/index.d.ts +0 -3
- package/dist/commonjs/combobox/index.d.ts.map +1 -1
- package/dist/commonjs/combobox/index.js +0 -7
- package/dist/commonjs/combobox/lib/AutocompleteList.d.ts +4 -5
- package/dist/commonjs/combobox/lib/AutocompleteList.d.ts.map +1 -1
- package/dist/commonjs/combobox/lib/AutocompleteList.js +33 -53
- package/dist/commonjs/combobox/lib/Combobox.d.ts +4 -6
- package/dist/commonjs/combobox/lib/Combobox.d.ts.map +1 -1
- package/dist/commonjs/combobox/lib/Combobox.js +110 -142
- package/dist/commonjs/combobox/lib/Status.d.ts +1 -2
- package/dist/commonjs/combobox/lib/Status.d.ts.map +1 -1
- package/dist/commonjs/combobox/lib/Status.js +11 -11
- package/dist/commonjs/common/index.d.ts +0 -2
- package/dist/commonjs/common/index.d.ts.map +1 -1
- package/dist/commonjs/common/index.js +0 -5
- package/dist/commonjs/common/lib/theming/index.d.ts +0 -1
- package/dist/commonjs/common/lib/theming/index.d.ts.map +1 -1
- package/dist/commonjs/common/lib/theming/index.js +0 -1
- package/dist/commonjs/common/lib/theming/useThemeRTL.d.ts +3 -0
- package/dist/commonjs/common/lib/theming/useThemeRTL.d.ts.map +1 -1
- package/dist/commonjs/common/lib/theming/useThemeRTL.js +21 -46
- package/dist/commonjs/expandable/index.d.ts +3 -0
- package/dist/commonjs/expandable/index.d.ts.map +1 -0
- package/dist/commonjs/{drawer → expandable}/index.js +2 -10
- package/dist/commonjs/expandable/lib/Expandable.d.ts +108 -0
- package/dist/commonjs/expandable/lib/Expandable.d.ts.map +1 -0
- package/dist/commonjs/expandable/lib/Expandable.js +59 -0
- package/dist/commonjs/expandable/lib/ExpandableAvatar.d.ts +7 -0
- package/dist/commonjs/expandable/lib/ExpandableAvatar.d.ts.map +1 -0
- package/dist/commonjs/expandable/lib/ExpandableAvatar.js +23 -0
- package/dist/commonjs/expandable/lib/ExpandableContent.d.ts +21 -0
- package/dist/commonjs/expandable/lib/ExpandableContent.d.ts.map +1 -0
- package/dist/commonjs/expandable/lib/ExpandableContent.js +18 -0
- package/dist/commonjs/expandable/lib/ExpandableIcon.d.ts +29 -0
- package/dist/commonjs/expandable/lib/ExpandableIcon.d.ts.map +1 -0
- package/dist/commonjs/expandable/lib/ExpandableIcon.js +31 -0
- package/dist/commonjs/expandable/lib/ExpandableTarget.d.ts +33 -0
- package/dist/commonjs/expandable/lib/ExpandableTarget.d.ts.map +1 -0
- package/dist/commonjs/expandable/lib/ExpandableTarget.js +32 -0
- package/dist/commonjs/expandable/lib/ExpandableTitle.d.ts +11 -0
- package/dist/commonjs/expandable/lib/ExpandableTitle.d.ts.map +1 -0
- package/dist/commonjs/expandable/lib/ExpandableTitle.js +16 -0
- package/dist/commonjs/expandable/lib/hooks/index.d.ts +5 -0
- package/dist/commonjs/expandable/lib/hooks/index.d.ts.map +1 -0
- package/dist/commonjs/expandable/lib/hooks/index.js +16 -0
- package/dist/commonjs/expandable/lib/hooks/useExpandableContent.d.ts +18 -0
- package/dist/commonjs/expandable/lib/hooks/useExpandableContent.d.ts.map +1 -0
- package/dist/commonjs/expandable/lib/hooks/useExpandableContent.js +11 -0
- package/dist/commonjs/expandable/lib/hooks/useExpandableIcon.d.ts +13 -0
- package/dist/commonjs/expandable/lib/hooks/useExpandableIcon.d.ts.map +1 -0
- package/dist/commonjs/expandable/lib/hooks/useExpandableIcon.js +10 -0
- package/dist/commonjs/expandable/lib/hooks/useExpandableModel.d.ts +53 -0
- package/dist/commonjs/expandable/lib/hooks/useExpandableModel.d.ts.map +1 -0
- package/dist/commonjs/expandable/lib/hooks/useExpandableModel.js +22 -0
- package/dist/commonjs/expandable/lib/hooks/useExpandableTarget.d.ts +15 -0
- package/dist/commonjs/expandable/lib/hooks/useExpandableTarget.d.ts.map +1 -0
- package/dist/commonjs/expandable/lib/hooks/useExpandableTarget.js +19 -0
- package/dist/commonjs/index.d.ts +1 -2
- package/dist/commonjs/index.d.ts.map +1 -1
- package/dist/commonjs/index.js +1 -2
- package/dist/commonjs/search-form/lib/SearchForm.d.ts +7 -3
- package/dist/commonjs/search-form/lib/SearchForm.d.ts.map +1 -1
- package/dist/commonjs/search-form/lib/SearchForm.js +118 -145
- package/dist/commonjs/search-form/lib/themes.js +7 -8
- package/dist/es6/combobox/index.d.ts +0 -3
- package/dist/es6/combobox/index.d.ts.map +1 -1
- package/dist/es6/combobox/index.js +0 -3
- package/dist/es6/combobox/lib/AutocompleteList.d.ts +4 -5
- package/dist/es6/combobox/lib/AutocompleteList.d.ts.map +1 -1
- package/dist/es6/combobox/lib/AutocompleteList.js +26 -48
- package/dist/es6/combobox/lib/Combobox.d.ts +4 -6
- package/dist/es6/combobox/lib/Combobox.d.ts.map +1 -1
- package/dist/es6/combobox/lib/Combobox.js +98 -131
- package/dist/es6/combobox/lib/Status.d.ts +1 -2
- package/dist/es6/combobox/lib/Status.d.ts.map +1 -1
- package/dist/es6/combobox/lib/Status.js +6 -8
- package/dist/es6/common/index.d.ts +0 -2
- package/dist/es6/common/index.d.ts.map +1 -1
- package/dist/es6/common/index.js +0 -2
- package/dist/es6/common/lib/theming/index.d.ts +0 -1
- package/dist/es6/common/lib/theming/index.d.ts.map +1 -1
- package/dist/es6/common/lib/theming/index.js +0 -1
- package/dist/es6/common/lib/theming/useThemeRTL.d.ts +3 -0
- package/dist/es6/common/lib/theming/useThemeRTL.d.ts.map +1 -1
- package/dist/es6/common/lib/theming/useThemeRTL.js +19 -44
- package/dist/es6/expandable/index.d.ts +3 -0
- package/dist/es6/expandable/index.d.ts.map +1 -0
- package/dist/es6/expandable/index.js +2 -0
- package/dist/es6/expandable/lib/Expandable.d.ts +108 -0
- package/dist/es6/expandable/lib/Expandable.d.ts.map +1 -0
- package/dist/es6/expandable/lib/Expandable.js +53 -0
- package/dist/es6/expandable/lib/ExpandableAvatar.d.ts +7 -0
- package/dist/es6/expandable/lib/ExpandableAvatar.d.ts.map +1 -0
- package/dist/es6/expandable/lib/ExpandableAvatar.js +17 -0
- package/dist/es6/expandable/lib/ExpandableContent.d.ts +21 -0
- package/dist/es6/expandable/lib/ExpandableContent.d.ts.map +1 -0
- package/dist/es6/expandable/lib/ExpandableContent.js +12 -0
- package/dist/es6/expandable/lib/ExpandableIcon.d.ts +29 -0
- package/dist/es6/expandable/lib/ExpandableIcon.d.ts.map +1 -0
- package/dist/es6/expandable/lib/ExpandableIcon.js +25 -0
- package/dist/es6/expandable/lib/ExpandableTarget.d.ts +33 -0
- package/dist/es6/expandable/lib/ExpandableTarget.d.ts.map +1 -0
- package/dist/es6/expandable/lib/ExpandableTarget.js +26 -0
- package/dist/es6/expandable/lib/ExpandableTitle.d.ts +11 -0
- package/dist/es6/expandable/lib/ExpandableTitle.d.ts.map +1 -0
- package/dist/es6/expandable/lib/ExpandableTitle.js +10 -0
- package/dist/es6/expandable/lib/hooks/index.d.ts +5 -0
- package/dist/es6/expandable/lib/hooks/index.d.ts.map +1 -0
- package/dist/es6/expandable/lib/hooks/index.js +4 -0
- package/dist/es6/expandable/lib/hooks/useExpandableContent.d.ts +18 -0
- package/dist/es6/expandable/lib/hooks/useExpandableContent.d.ts.map +1 -0
- package/dist/es6/expandable/lib/hooks/useExpandableContent.js +8 -0
- package/dist/es6/expandable/lib/hooks/useExpandableIcon.d.ts +13 -0
- package/dist/es6/expandable/lib/hooks/useExpandableIcon.d.ts.map +1 -0
- package/dist/es6/expandable/lib/hooks/useExpandableIcon.js +7 -0
- package/dist/es6/expandable/lib/hooks/useExpandableModel.d.ts +53 -0
- package/dist/es6/expandable/lib/hooks/useExpandableModel.d.ts.map +1 -0
- package/dist/es6/expandable/lib/hooks/useExpandableModel.js +19 -0
- package/dist/es6/expandable/lib/hooks/useExpandableTarget.d.ts +15 -0
- package/dist/es6/expandable/lib/hooks/useExpandableTarget.d.ts.map +1 -0
- package/dist/es6/expandable/lib/hooks/useExpandableTarget.js +16 -0
- package/dist/es6/index.d.ts +1 -2
- package/dist/es6/index.d.ts.map +1 -1
- package/dist/es6/index.js +1 -2
- package/dist/es6/search-form/lib/SearchForm.d.ts +7 -3
- package/dist/es6/search-form/lib/SearchForm.d.ts.map +1 -1
- package/dist/es6/search-form/lib/SearchForm.js +108 -136
- package/dist/es6/search-form/lib/themes.js +5 -6
- package/{drawer → expandable}/LICENSE +2 -1
- package/expandable/README.md +11 -0
- package/expandable/index.ts +2 -0
- package/expandable/lib/Expandable.tsx +68 -0
- package/expandable/lib/ExpandableAvatar.tsx +26 -0
- package/expandable/lib/ExpandableContent.tsx +32 -0
- package/expandable/lib/ExpandableIcon.tsx +75 -0
- package/expandable/lib/ExpandableTarget.tsx +67 -0
- package/expandable/lib/ExpandableTitle.tsx +32 -0
- package/expandable/lib/hooks/index.ts +4 -0
- package/expandable/lib/hooks/useExpandableContent.ts +9 -0
- package/expandable/lib/hooks/useExpandableIcon.ts +8 -0
- package/expandable/lib/hooks/useExpandableModel.tsx +20 -0
- package/expandable/lib/hooks/useExpandableTarget.ts +16 -0
- package/expandable/package.json +6 -0
- package/index.ts +1 -2
- package/package.json +5 -5
- package/search-form/lib/SearchForm.tsx +13 -11
- package/search-form/package.json +2 -1
- package/common/lib/storybook-utils/ComponentStatesTable.tsx +0 -80
- package/common/lib/storybook-utils/permutateProps.ts +0 -47
- package/common/lib/storybook-utils/propTypes.ts +0 -15
- package/common/lib/theming/useThemedRing.ts +0 -82
- package/dist/commonjs/common/lib/storybook-utils/ComponentStatesTable.d.ts +0 -26
- package/dist/commonjs/common/lib/storybook-utils/ComponentStatesTable.d.ts.map +0 -1
- package/dist/commonjs/common/lib/storybook-utils/ComponentStatesTable.js +0 -48
- package/dist/commonjs/common/lib/storybook-utils/permutateProps.d.ts +0 -5
- package/dist/commonjs/common/lib/storybook-utils/permutateProps.d.ts.map +0 -1
- package/dist/commonjs/common/lib/storybook-utils/permutateProps.js +0 -47
- package/dist/commonjs/common/lib/storybook-utils/propTypes.d.ts +0 -15
- package/dist/commonjs/common/lib/storybook-utils/propTypes.d.ts.map +0 -1
- package/dist/commonjs/common/lib/storybook-utils/propTypes.js +0 -2
- package/dist/commonjs/common/lib/theming/useThemedRing.d.ts +0 -11
- package/dist/commonjs/common/lib/theming/useThemedRing.d.ts.map +0 -1
- package/dist/commonjs/common/lib/theming/useThemedRing.js +0 -67
- package/dist/commonjs/drawer/index.d.ts +0 -6
- package/dist/commonjs/drawer/index.d.ts.map +0 -1
- package/dist/commonjs/drawer/lib/Drawer.d.ts +0 -49
- package/dist/commonjs/drawer/lib/Drawer.d.ts.map +0 -1
- package/dist/commonjs/drawer/lib/Drawer.js +0 -124
- package/dist/commonjs/drawer/lib/DrawerHeader.d.ts +0 -38
- package/dist/commonjs/drawer/lib/DrawerHeader.d.ts.map +0 -1
- package/dist/commonjs/drawer/lib/DrawerHeader.js +0 -105
- package/dist/es6/common/lib/storybook-utils/ComponentStatesTable.d.ts +0 -26
- package/dist/es6/common/lib/storybook-utils/ComponentStatesTable.d.ts.map +0 -1
- package/dist/es6/common/lib/storybook-utils/ComponentStatesTable.js +0 -41
- package/dist/es6/common/lib/storybook-utils/permutateProps.d.ts +0 -5
- package/dist/es6/common/lib/storybook-utils/permutateProps.d.ts.map +0 -1
- package/dist/es6/common/lib/storybook-utils/permutateProps.js +0 -43
- package/dist/es6/common/lib/storybook-utils/propTypes.d.ts +0 -15
- package/dist/es6/common/lib/storybook-utils/propTypes.d.ts.map +0 -1
- package/dist/es6/common/lib/storybook-utils/propTypes.js +0 -1
- package/dist/es6/common/lib/theming/useThemedRing.d.ts +0 -11
- package/dist/es6/common/lib/theming/useThemedRing.d.ts.map +0 -1
- package/dist/es6/common/lib/theming/useThemedRing.js +0 -59
- package/dist/es6/drawer/index.d.ts +0 -6
- package/dist/es6/drawer/index.d.ts.map +0 -1
- package/dist/es6/drawer/index.js +0 -5
- package/dist/es6/drawer/lib/Drawer.d.ts +0 -49
- package/dist/es6/drawer/lib/Drawer.d.ts.map +0 -1
- package/dist/es6/drawer/lib/Drawer.js +0 -99
- package/dist/es6/drawer/lib/DrawerHeader.d.ts +0 -38
- package/dist/es6/drawer/lib/DrawerHeader.d.ts.map +0 -1
- package/dist/es6/drawer/lib/DrawerHeader.js +0 -81
- package/drawer/README.md +0 -35
- package/drawer/index.ts +0 -5
- package/drawer/lib/Drawer.tsx +0 -119
- package/drawer/lib/DrawerHeader.tsx +0 -105
- package/drawer/package.json +0 -5
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var _a;
|
|
3
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
3
|
exports.searchThemes = exports.SearchTheme = void 0;
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
const common_1 = require("@workday/canvas-kit-react/common");
|
|
5
|
+
const tokens_1 = require("@workday/canvas-kit-react/tokens");
|
|
7
6
|
var SearchTheme;
|
|
8
7
|
(function (SearchTheme) {
|
|
9
8
|
SearchTheme[SearchTheme["Light"] = 0] = "Light";
|
|
10
9
|
SearchTheme[SearchTheme["Dark"] = 1] = "Dark";
|
|
11
10
|
SearchTheme[SearchTheme["Transparent"] = 2] = "Transparent";
|
|
12
11
|
})(SearchTheme = exports.SearchTheme || (exports.SearchTheme = {}));
|
|
13
|
-
exports.searchThemes =
|
|
14
|
-
|
|
12
|
+
exports.searchThemes = {
|
|
13
|
+
[SearchTheme.Transparent]: {
|
|
15
14
|
background: 'rgba(0, 0, 0, 0)',
|
|
16
15
|
backgroundFocus: 'rgba(0, 0, 0, 0)',
|
|
17
16
|
color: tokens_1.colors.blackPepper300,
|
|
@@ -21,7 +20,7 @@ exports.searchThemes = (_a = {},
|
|
|
21
20
|
boxShadow: 'none',
|
|
22
21
|
boxShadowFocus: 'none',
|
|
23
22
|
},
|
|
24
|
-
|
|
23
|
+
[SearchTheme.Light]: {
|
|
25
24
|
background: tokens_1.colors.soap200,
|
|
26
25
|
backgroundFocus: tokens_1.colors.soap200,
|
|
27
26
|
backgroundHover: tokens_1.colors.soap300,
|
|
@@ -30,7 +29,7 @@ exports.searchThemes = (_a = {},
|
|
|
30
29
|
boxShadow: 'none',
|
|
31
30
|
boxShadowFocus: common_1.focusRing().boxShadow,
|
|
32
31
|
},
|
|
33
|
-
|
|
32
|
+
[SearchTheme.Dark]: {
|
|
34
33
|
background: 'rgba(0, 0, 0, 0.2)',
|
|
35
34
|
backgroundFocus: tokens_1.colors.frenchVanilla100,
|
|
36
35
|
color: tokens_1.colors.frenchVanilla100,
|
|
@@ -39,4 +38,4 @@ exports.searchThemes = (_a = {},
|
|
|
39
38
|
placeholderColorFocus: tokens_1.colors.licorice300,
|
|
40
39
|
boxShadow: 'none',
|
|
41
40
|
},
|
|
42
|
-
|
|
41
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../combobox/index.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../combobox/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC"}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { MenuItemProps } from '@workday/canvas-kit-preview-react/menu';
|
|
3
2
|
import { ComboBoxMenuItemGroup } from './Combobox';
|
|
4
3
|
interface AutocompleteListProps {
|
|
5
4
|
/**
|
|
6
5
|
* The autocomplete items of the Combobox. This array of menu items is shown under the text input.
|
|
7
6
|
*/
|
|
8
|
-
autocompleteItems: React.ReactElement<
|
|
7
|
+
autocompleteItems: React.ReactElement<any>[] | ComboBoxMenuItemGroup[];
|
|
9
8
|
/**
|
|
10
9
|
* Index of the active autocomplete item
|
|
11
10
|
*/
|
|
@@ -13,7 +12,7 @@ interface AutocompleteListProps {
|
|
|
13
12
|
/**
|
|
14
13
|
* The function called when an autocomplete item is selected
|
|
15
14
|
*/
|
|
16
|
-
handleAutocompleteClick: (event: React.SyntheticEvent<Element, Event>, menuItemProps:
|
|
15
|
+
handleAutocompleteClick: (event: React.SyntheticEvent<Element, Event>, menuItemProps: any) => void;
|
|
17
16
|
/**
|
|
18
17
|
* The id of the form field.
|
|
19
18
|
*/
|
|
@@ -27,6 +26,6 @@ interface AutocompleteListProps {
|
|
|
27
26
|
*/
|
|
28
27
|
showGroupText: boolean;
|
|
29
28
|
}
|
|
30
|
-
declare const AutocompleteList: ({ autocompleteItems, comboboxId, selectedIndex, handleAutocompleteClick, labelId, showGroupText, }: AutocompleteListProps) => JSX.Element | null;
|
|
31
|
-
export
|
|
29
|
+
export declare const AutocompleteList: ({ autocompleteItems, comboboxId, selectedIndex, handleAutocompleteClick, labelId, showGroupText, }: AutocompleteListProps) => JSX.Element | null;
|
|
30
|
+
export {};
|
|
32
31
|
//# sourceMappingURL=AutocompleteList.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AutocompleteList.d.ts","sourceRoot":"","sources":["../../../../combobox/lib/AutocompleteList.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA2B,MAAM,OAAO,CAAC;AAIhD,OAAO,EAAC,
|
|
1
|
+
{"version":3,"file":"AutocompleteList.d.ts","sourceRoot":"","sources":["../../../../combobox/lib/AutocompleteList.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA2B,MAAM,OAAO,CAAC;AAIhD,OAAO,EAAC,qBAAqB,EAAiD,MAAM,YAAY,CAAC;AAYjG,UAAU,qBAAqB;IAC7B;;OAEG;IACH,iBAAiB,EAAE,KAAK,CAAC,YAAY,CAAC,GAAG,CAAC,EAAE,GAAG,qBAAqB,EAAE,CAAC;IACvE;;OAEG;IACH,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B;;OAEG;IACH,uBAAuB,EAAE,CACvB,KAAK,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,EAAE,KAAK,CAAC,EAC3C,aAAa,EAAE,GAAG,KACf,IAAI,CAAC;IACV;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;IAChB;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,aAAa,EAAE,OAAO,CAAC;CACxB;AAED,eAAO,MAAM,gBAAgB,uGAO1B,qBAAqB,uBAiFvB,CAAC"}
|
|
@@ -1,58 +1,40 @@
|
|
|
1
|
-
var __assign = (this && this.__assign) || function () {
|
|
2
|
-
__assign = Object.assign || function(t) {
|
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
-
s = arguments[i];
|
|
5
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
-
t[p] = s[p];
|
|
7
|
-
}
|
|
8
|
-
return t;
|
|
9
|
-
};
|
|
10
|
-
return __assign.apply(this, arguments);
|
|
11
|
-
};
|
|
12
|
-
var __spreadArrays = (this && this.__spreadArrays) || function () {
|
|
13
|
-
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
|
|
14
|
-
for (var r = Array(s), k = 0, i = 0; i < il; i++)
|
|
15
|
-
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
|
|
16
|
-
r[k] = a[j];
|
|
17
|
-
return r;
|
|
18
|
-
};
|
|
19
1
|
import React, { Fragment, useState } from 'react';
|
|
20
2
|
import styled from '@emotion/styled';
|
|
21
3
|
import { space } from '@workday/canvas-kit-react/tokens';
|
|
22
4
|
import { accessibleHide, generateUniqueId } from '@workday/canvas-kit-react/common';
|
|
23
5
|
import { getOptionId, listBoxIdPart, getTextFromElement } from './Combobox';
|
|
24
|
-
|
|
6
|
+
const Autocomplete = styled('ul')({
|
|
25
7
|
margin: 0,
|
|
26
8
|
maxHeight: 200,
|
|
27
9
|
boxSizing: 'border-box',
|
|
28
10
|
overflowY: 'auto',
|
|
29
|
-
padding: space.xxs
|
|
11
|
+
padding: `${space.xxs} 0`,
|
|
30
12
|
});
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
var listBoxProps = {
|
|
13
|
+
const AccessibleHide = styled('span')(accessibleHide);
|
|
14
|
+
export const AutocompleteList = ({ autocompleteItems, comboboxId, selectedIndex, handleAutocompleteClick, labelId, showGroupText, }) => {
|
|
15
|
+
const [randomComponentId] = useState(generateUniqueId); // https://codesandbox.io/s/p2ndq
|
|
16
|
+
const componentId = comboboxId || randomComponentId;
|
|
17
|
+
const listBoxProps = {
|
|
37
18
|
role: 'listbox',
|
|
38
|
-
id: componentId
|
|
19
|
+
id: `${componentId}-${listBoxIdPart}`,
|
|
39
20
|
'aria-labelledby': labelId,
|
|
40
21
|
};
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
React.createElement(AccessibleHide, { key:
|
|
44
|
-
|
|
22
|
+
const createListItem = (listboxItem, itemIndex, groupMessage) => {
|
|
23
|
+
const children = [
|
|
24
|
+
React.createElement(AccessibleHide, { key: `group-message-${itemIndex}` }, groupMessage),
|
|
25
|
+
...React.Children.toArray(listboxItem.props.children),
|
|
26
|
+
];
|
|
45
27
|
return (React.createElement(Fragment, { key: itemIndex }, React.cloneElement(listboxItem, {
|
|
46
28
|
children: children,
|
|
47
29
|
id: getOptionId(componentId, itemIndex),
|
|
48
30
|
role: 'option',
|
|
49
31
|
isFocused: selectedIndex === itemIndex,
|
|
50
32
|
'aria-selected': selectedIndex === itemIndex ? true : undefined,
|
|
51
|
-
onMouseDown:
|
|
33
|
+
onMouseDown: (event) => {
|
|
52
34
|
// prevent focus from shifting away from the the combobox
|
|
53
35
|
event.preventDefault();
|
|
54
36
|
},
|
|
55
|
-
onClick:
|
|
37
|
+
onClick: (event) => {
|
|
56
38
|
event.preventDefault();
|
|
57
39
|
handleAutocompleteClick(event, listboxItem.props);
|
|
58
40
|
},
|
|
@@ -62,30 +44,26 @@ var AutocompleteList = function (_a) {
|
|
|
62
44
|
return null;
|
|
63
45
|
}
|
|
64
46
|
else if (autocompleteItems[0].hasOwnProperty('header')) {
|
|
65
|
-
|
|
66
|
-
return (React.createElement(Autocomplete,
|
|
67
|
-
|
|
68
|
-
var groupLabel = "itemGroup-" + componentId + "-" + groupIndex;
|
|
47
|
+
let itemIndex = 0;
|
|
48
|
+
return (React.createElement(Autocomplete, Object.assign({}, listBoxProps), autocompleteItems.map(({ header, items }, groupIndex) => {
|
|
49
|
+
const groupLabel = `itemGroup-${componentId}-${groupIndex}`;
|
|
69
50
|
return (React.createElement(Fragment, { key: groupLabel },
|
|
70
51
|
React.cloneElement(header, {
|
|
71
52
|
role: 'presentation',
|
|
72
|
-
style: { pointerEvents:
|
|
53
|
+
style: { pointerEvents: `none` },
|
|
73
54
|
}),
|
|
74
|
-
items.map(
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
?
|
|
55
|
+
items.map((listboxItem) => {
|
|
56
|
+
const headerName = getTextFromElement(header);
|
|
57
|
+
const groupMessage = showGroupText
|
|
58
|
+
? `Entering group ${headerName}, with ${items.length} options.`
|
|
78
59
|
: undefined;
|
|
79
|
-
|
|
80
|
-
|
|
60
|
+
const item = createListItem(listboxItem, itemIndex, groupMessage);
|
|
61
|
+
itemIndex++;
|
|
81
62
|
return item;
|
|
82
63
|
})));
|
|
83
64
|
})));
|
|
84
65
|
}
|
|
85
66
|
else {
|
|
86
|
-
return (React.createElement(Autocomplete,
|
|
87
|
-
return createListItem(listboxItem, index);
|
|
88
|
-
})));
|
|
67
|
+
return (React.createElement(Autocomplete, Object.assign({}, listBoxProps), autocompleteItems.map((listboxItem, index) => createListItem(listboxItem, index))));
|
|
89
68
|
}
|
|
90
69
|
};
|
|
91
|
-
export default AutocompleteList;
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { GrowthBehavior } from '@workday/canvas-kit-react/common';
|
|
3
|
-
import { MenuItemProps } from '@workday/canvas-kit-preview-react/menu';
|
|
4
3
|
import { TertiaryButtonProps } from '@workday/canvas-kit-react/button';
|
|
5
4
|
import { TextInputProps } from '@workday/canvas-kit-react/text-input';
|
|
6
5
|
export interface ComboBoxMenuItemGroup {
|
|
7
|
-
header: React.ReactElement<
|
|
8
|
-
items: React.ReactElement<
|
|
6
|
+
header: React.ReactElement<any>;
|
|
7
|
+
items: React.ReactElement<any>[];
|
|
9
8
|
}
|
|
10
9
|
export interface ComboboxProps extends GrowthBehavior, React.HTMLAttributes<HTMLElement> {
|
|
11
10
|
/**
|
|
@@ -33,7 +32,7 @@ export interface ComboboxProps extends GrowthBehavior, React.HTMLAttributes<HTML
|
|
|
33
32
|
/**
|
|
34
33
|
* The autocomplete items of the Combobox. This array of menu items is shown under the text input.
|
|
35
34
|
*/
|
|
36
|
-
autocompleteItems?: React.ReactElement<
|
|
35
|
+
autocompleteItems?: React.ReactElement<any>[] | ComboBoxMenuItemGroup[];
|
|
37
36
|
/**
|
|
38
37
|
* The function called when the Combobox text input changes.
|
|
39
38
|
*/
|
|
@@ -58,6 +57,5 @@ export interface ComboboxProps extends GrowthBehavior, React.HTMLAttributes<HTML
|
|
|
58
57
|
export declare const listBoxIdPart = "listbox";
|
|
59
58
|
export declare const getOptionId: (baseId?: string | undefined, index?: number | undefined) => string;
|
|
60
59
|
export declare const getTextFromElement: (children?: React.ReactNode) => string;
|
|
61
|
-
declare const Combobox: ({ autocompleteItems, children, grow, initialValue, onChange, onFocus, onBlur, showClearButton, clearButtonVariant, clearButtonAriaLabel, labelId, getStatusText, id, ...elemProps }: ComboboxProps) => JSX.Element;
|
|
62
|
-
export default Combobox;
|
|
60
|
+
export declare const Combobox: ({ autocompleteItems, children, grow, initialValue, onChange, onFocus, onBlur, showClearButton, clearButtonVariant, clearButtonAriaLabel, labelId, getStatusText, id, ...elemProps }: ComboboxProps) => JSX.Element;
|
|
63
61
|
//# sourceMappingURL=Combobox.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Combobox.d.ts","sourceRoot":"","sources":["../../../../combobox/lib/Combobox.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAkE,MAAM,OAAO,CAAC;AAEvF,OAAO,EACL,cAAc,EAKf,MAAM,kCAAkC,CAAC;
|
|
1
|
+
{"version":3,"file":"Combobox.d.ts","sourceRoot":"","sources":["../../../../combobox/lib/Combobox.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAkE,MAAM,OAAO,CAAC;AAEvF,OAAO,EACL,cAAc,EAKf,MAAM,kCAAkC,CAAC;AAG1C,OAAO,EAAiB,mBAAmB,EAAC,MAAM,kCAAkC,CAAC;AAErF,OAAO,EAAC,cAAc,EAAC,MAAM,sCAAsC,CAAC;AAKpE,MAAM,WAAW,qBAAqB;IAEpC,MAAM,EAAE,KAAK,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC;IAEhC,KAAK,EAAE,KAAK,CAAC,YAAY,CAAC,GAAG,CAAC,EAAE,CAAC;CAClC;AAED,MAAM,WAAW,aAAc,SAAQ,cAAc,EAAE,KAAK,CAAC,cAAc,CAAC,WAAW,CAAC;IACtF;;OAEG;IACH,QAAQ,EAAE,KAAK,CAAC,YAAY,CAAC,cAAc,CAAC,CAAC;IAC7C;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;OAEG;IACH,kBAAkB,CAAC,EAAE,mBAAmB,CAAC,SAAS,CAAC,CAAC;IACpD;;;OAGG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B;;;OAGG;IACH,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B;;OAEG;IACH,iBAAiB,CAAC,EAAE,KAAK,CAAC,YAAY,CAAC,GAAG,CAAC,EAAE,GAAG,qBAAqB,EAAE,CAAC;IACxE;;OAEG;IACH,QAAQ,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,WAAW,CAAC,gBAAgB,CAAC,KAAK,IAAI,CAAC;IAC5D;;OAEG;IACH,OAAO,CAAC,EAAE,KAAK,CAAC,iBAAiB,CAAC;IAClC;;OAEG;IACH,MAAM,CAAC,EAAE,KAAK,CAAC,iBAAiB,CAAC;IACjC;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,aAAa,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,MAAM,CAAC;CAC/C;AA2DD,eAAO,MAAM,aAAa,YAAY,CAAC;AAEvC,eAAO,MAAM,WAAW,qEACc,CAAC;AAEvC,eAAO,MAAM,kBAAkB,cAAe,MAAM,SAAS,WAc5D,CAAC;AAYF,eAAO,MAAM,QAAQ,wLAelB,aAAa,gBAuTf,CAAC"}
|