@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,25 +1,3 @@
|
|
|
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 __rest = (this && this.__rest) || function (s, e) {
|
|
13
|
-
var t = {};
|
|
14
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
15
|
-
t[p] = s[p];
|
|
16
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
17
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
18
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
19
|
-
t[p[i]] = s[p[i]];
|
|
20
|
-
}
|
|
21
|
-
return t;
|
|
22
|
-
};
|
|
23
1
|
import React, { useEffect, useLayoutEffect, useRef, useState, useCallback } from 'react';
|
|
24
2
|
import { jsx, keyframes } from '@emotion/react';
|
|
25
3
|
import { useForkRef, styled, useIsRTL, useUniqueId, } from '@workday/canvas-kit-react/common';
|
|
@@ -28,22 +6,19 @@ import { Card } from '@workday/canvas-kit-react/card';
|
|
|
28
6
|
import { TertiaryButton } from '@workday/canvas-kit-react/button';
|
|
29
7
|
import { xSmallIcon } from '@workday/canvas-system-icons-web';
|
|
30
8
|
import flatten from 'lodash.flatten';
|
|
31
|
-
import AutocompleteList from './AutocompleteList';
|
|
32
|
-
import Status from './Status';
|
|
33
|
-
|
|
9
|
+
import { AutocompleteList } from './AutocompleteList';
|
|
10
|
+
import { Status } from './Status';
|
|
11
|
+
const Container = styled('div')({
|
|
34
12
|
display: 'inline-block',
|
|
35
|
-
},
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
var InputContainer = styled('div')({
|
|
42
|
-
display: "flex",
|
|
43
|
-
alignItems: "center",
|
|
13
|
+
}, ({ grow }) => ({
|
|
14
|
+
width: grow ? '100%' : 'auto',
|
|
15
|
+
}));
|
|
16
|
+
const InputContainer = styled('div')({
|
|
17
|
+
display: `flex`,
|
|
18
|
+
alignItems: `center`,
|
|
44
19
|
position: 'relative',
|
|
45
20
|
});
|
|
46
|
-
|
|
21
|
+
const fadeInKeyframes = keyframes({
|
|
47
22
|
'0%': {
|
|
48
23
|
opacity: 0,
|
|
49
24
|
},
|
|
@@ -51,46 +26,41 @@ var fadeInKeyframes = keyframes({
|
|
|
51
26
|
opacity: 1,
|
|
52
27
|
},
|
|
53
28
|
});
|
|
54
|
-
|
|
29
|
+
const MenuContainer = styled(Card)({
|
|
55
30
|
position: 'absolute',
|
|
56
31
|
zIndex: 1,
|
|
57
32
|
left: 0,
|
|
58
33
|
top: '100%',
|
|
59
34
|
borderRadius: borderRadius.m,
|
|
60
35
|
background: commonColors.background,
|
|
61
|
-
border:
|
|
62
|
-
marginTop:
|
|
36
|
+
border: `none`,
|
|
37
|
+
marginTop: `-${borderRadius.m}`,
|
|
63
38
|
width: '100%',
|
|
64
39
|
minWidth: 0,
|
|
65
|
-
animation: fadeInKeyframes
|
|
40
|
+
animation: `${fadeInKeyframes} 200ms ease-out`,
|
|
66
41
|
maxHeight: 200,
|
|
67
42
|
overflow: 'hidden',
|
|
68
43
|
});
|
|
69
|
-
|
|
44
|
+
const ResetButton = styled(TertiaryButton)({
|
|
70
45
|
position: 'absolute',
|
|
71
|
-
margin:
|
|
46
|
+
margin: `auto ${space.xxxs}`,
|
|
72
47
|
top: 0,
|
|
73
48
|
bottom: 0,
|
|
74
49
|
right: 0,
|
|
75
50
|
padding: 0,
|
|
76
51
|
zIndex: 2,
|
|
77
52
|
transition: 'opacity 120ms',
|
|
78
|
-
},
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
}
|
|
85
|
-
export
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
};
|
|
90
|
-
export var getTextFromElement = function (children) {
|
|
91
|
-
var text = '';
|
|
92
|
-
React.Children.map(children, function (child) {
|
|
93
|
-
if (child == null || typeof child === 'boolean' || child === {}) {
|
|
53
|
+
}, ({ shouldShow }) => ({
|
|
54
|
+
visibility: shouldShow ? 'visible' : 'hidden',
|
|
55
|
+
opacity: shouldShow ? 1 : 0,
|
|
56
|
+
}));
|
|
57
|
+
export const listBoxIdPart = `listbox`;
|
|
58
|
+
const optionIdPart = `option`;
|
|
59
|
+
export const getOptionId = (baseId, index) => `${baseId}-${optionIdPart}-${index}`;
|
|
60
|
+
export const getTextFromElement = (children) => {
|
|
61
|
+
let text = '';
|
|
62
|
+
React.Children.map(children, child => {
|
|
63
|
+
if (child == null || typeof child === 'boolean') {
|
|
94
64
|
text += '';
|
|
95
65
|
}
|
|
96
66
|
else if (typeof child === 'string' || typeof child === 'number') {
|
|
@@ -105,89 +75,88 @@ export var getTextFromElement = function (children) {
|
|
|
105
75
|
});
|
|
106
76
|
return text;
|
|
107
77
|
};
|
|
108
|
-
|
|
109
|
-
return
|
|
78
|
+
const buildStatusString = (listCount) => {
|
|
79
|
+
return `There ${listCount === 1 ? 'is' : 'are'} ${listCount} suggestion${listCount === 1 ? '' : 's'}.`;
|
|
110
80
|
};
|
|
111
|
-
|
|
81
|
+
const isValidSingleChild = (child) => {
|
|
112
82
|
return React.isValidElement(child) && React.Children.only(child);
|
|
113
83
|
};
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
var _k = useState(''), announcementText = _k[0], setAnnouncementText = _k[1];
|
|
84
|
+
export const Combobox = ({ autocompleteItems, children, grow, initialValue, onChange, onFocus, onBlur, showClearButton, clearButtonVariant = undefined, clearButtonAriaLabel = `Reset Search Input`, labelId, getStatusText = buildStatusString, id, ...elemProps }) => {
|
|
85
|
+
const [isOpened, setIsOpened] = useState(false);
|
|
86
|
+
const [value, _setValue] = useState(''); // Don't call _setValue directly instead call setInputValue to make sure onChange fires correctly
|
|
87
|
+
const [showingAutocomplete, setShowingAutocomplete] = useState(false);
|
|
88
|
+
const [selectedAutocompleteIndex, setSelectedAutocompleteIndex] = useState(null);
|
|
89
|
+
const [interactiveAutocompleteItems, setInteractiveAutocompleteItems] = useState([]);
|
|
90
|
+
const [announcementText, setAnnouncementText] = useState('');
|
|
122
91
|
// Create a ref to the soon-to-be-created TextInput clone for internal use.
|
|
123
92
|
// Use useForkRef to combine it with the ref already assigned to the original
|
|
124
93
|
// TextInput (if it exists) to create a single callback ref which can be
|
|
125
94
|
// forwarded to the TextInput clone.
|
|
126
|
-
|
|
95
|
+
const inputRef = useRef(null);
|
|
127
96
|
// We need access to the original TextInput's ref _property_ (not prop) so we
|
|
128
97
|
// can combine it with the internal inputRef using useForkRef. ref isn't
|
|
129
98
|
// listed in the ReactElement interface, but it's there, so we cast children
|
|
130
99
|
// to satisfy TS.
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
100
|
+
const elementRef = useForkRef(children.ref, inputRef);
|
|
101
|
+
const comboboxRef = useRef(null);
|
|
102
|
+
const randomComponentId = useUniqueId();
|
|
103
|
+
const randomLabelId = useUniqueId();
|
|
104
|
+
const componentId = id || randomComponentId;
|
|
105
|
+
const formLabelId = labelId || randomLabelId;
|
|
106
|
+
const [showGroupText, setShowGroupText] = useState(false);
|
|
138
107
|
// We're using LayoutEffect here because of an issue with the Synthetic event system and typing a key
|
|
139
108
|
// after the listbox has been closed. Somehow the key is ignored unless we use `useLayoutEffect`
|
|
140
|
-
useLayoutEffect(
|
|
141
|
-
|
|
109
|
+
useLayoutEffect(() => {
|
|
110
|
+
const shouldShow = interactiveAutocompleteItems.length > 0 && isOpened;
|
|
142
111
|
setShowingAutocomplete(shouldShow);
|
|
143
112
|
if (shouldShow) {
|
|
144
113
|
setAnnouncementText(getStatusText(interactiveAutocompleteItems.length));
|
|
145
114
|
}
|
|
146
115
|
}, [getStatusText, interactiveAutocompleteItems, isOpened]);
|
|
147
116
|
// Used to set the position of the reset button and the padding direction inside the input container
|
|
148
|
-
|
|
149
|
-
|
|
117
|
+
const isRTL = useIsRTL();
|
|
118
|
+
const setInputValue = useCallback((newValue) => {
|
|
150
119
|
_setValue(newValue);
|
|
151
|
-
|
|
120
|
+
const inputDomElement = inputRef.current;
|
|
152
121
|
// Changing value prop programmatically doesn't fire an Synthetic event or trigger native onChange.
|
|
153
122
|
// We can not just update .value= in setState because React library overrides input value setter
|
|
154
123
|
// but we can call the function directly on the input as context.
|
|
155
124
|
// This will cause onChange events to fire no matter how value is updated.
|
|
156
125
|
if (inputDomElement) {
|
|
157
|
-
|
|
126
|
+
const nativeInputValue = Object.getOwnPropertyDescriptor(Object.getPrototypeOf(inputDomElement), 'value');
|
|
158
127
|
if (nativeInputValue && nativeInputValue.set) {
|
|
159
128
|
nativeInputValue.set.call(inputDomElement, newValue);
|
|
160
129
|
}
|
|
161
|
-
|
|
130
|
+
let event;
|
|
162
131
|
if (typeof Event === 'function') {
|
|
163
132
|
// modern browsers
|
|
164
|
-
|
|
133
|
+
event = new Event('input', { bubbles: true });
|
|
165
134
|
}
|
|
166
135
|
else {
|
|
167
136
|
// IE 11
|
|
168
|
-
|
|
169
|
-
|
|
137
|
+
event = document.createEvent('Event');
|
|
138
|
+
event.initEvent('input', true, true);
|
|
170
139
|
}
|
|
171
|
-
inputDomElement.dispatchEvent(
|
|
140
|
+
inputDomElement.dispatchEvent(event);
|
|
172
141
|
}
|
|
173
142
|
}, [inputRef]);
|
|
174
|
-
useEffect(
|
|
143
|
+
useEffect(() => {
|
|
175
144
|
if (initialValue !== null && initialValue !== undefined) {
|
|
176
145
|
setInputValue(initialValue);
|
|
177
146
|
}
|
|
178
147
|
}, [initialValue, setInputValue]);
|
|
179
|
-
useEffect(
|
|
180
|
-
|
|
148
|
+
useEffect(() => {
|
|
149
|
+
const getInteractiveAutocompleteItems = () => {
|
|
181
150
|
if (autocompleteItems &&
|
|
182
151
|
autocompleteItems.length &&
|
|
183
152
|
autocompleteItems[0].hasOwnProperty('header')) {
|
|
184
|
-
return flatten(autocompleteItems.map(
|
|
153
|
+
return flatten(autocompleteItems.map(group => group.items));
|
|
185
154
|
}
|
|
186
155
|
return autocompleteItems || [];
|
|
187
156
|
};
|
|
188
157
|
setInteractiveAutocompleteItems(getInteractiveAutocompleteItems());
|
|
189
158
|
}, [autocompleteItems]);
|
|
190
|
-
|
|
159
|
+
const handleAutocompleteClick = (event, menuItemProps) => {
|
|
191
160
|
if (menuItemProps.isDisabled) {
|
|
192
161
|
return;
|
|
193
162
|
}
|
|
@@ -198,29 +167,25 @@ var Combobox = function (_a) {
|
|
|
198
167
|
menuItemProps.onClick(event);
|
|
199
168
|
}
|
|
200
169
|
};
|
|
201
|
-
|
|
170
|
+
const focusInput = () => {
|
|
202
171
|
if (inputRef.current) {
|
|
203
172
|
inputRef.current.focus();
|
|
204
173
|
}
|
|
205
174
|
};
|
|
206
|
-
|
|
175
|
+
const handleClick = (event) => {
|
|
207
176
|
if (!showingAutocomplete) {
|
|
208
177
|
setShowingAutocomplete(true);
|
|
209
178
|
}
|
|
210
179
|
};
|
|
211
|
-
|
|
180
|
+
const handleFocus = (event) => {
|
|
212
181
|
setIsOpened(true);
|
|
213
182
|
if (onFocus) {
|
|
214
183
|
onFocus(event);
|
|
215
184
|
}
|
|
216
185
|
};
|
|
217
|
-
|
|
186
|
+
const handleBlur = (event) => {
|
|
218
187
|
if (comboboxRef.current) {
|
|
219
|
-
|
|
220
|
-
if (target === null) {
|
|
221
|
-
// IE11 swaps related and active target before it fires the blur event
|
|
222
|
-
target = document.activeElement;
|
|
223
|
-
}
|
|
188
|
+
const target = event.relatedTarget;
|
|
224
189
|
if (target && comboboxRef.current.contains(target)) {
|
|
225
190
|
return;
|
|
226
191
|
}
|
|
@@ -230,45 +195,45 @@ var Combobox = function (_a) {
|
|
|
230
195
|
onBlur(event);
|
|
231
196
|
}
|
|
232
197
|
};
|
|
233
|
-
|
|
198
|
+
const resetSearchInput = () => {
|
|
234
199
|
setInputValue('');
|
|
235
200
|
focusInput();
|
|
236
201
|
};
|
|
237
|
-
|
|
202
|
+
const getGroupIndex = (itemIndex) => {
|
|
238
203
|
if (itemIndex != null &&
|
|
239
204
|
autocompleteItems &&
|
|
240
205
|
autocompleteItems.length &&
|
|
241
206
|
autocompleteItems[0].hasOwnProperty('header')) {
|
|
242
|
-
|
|
243
|
-
return autocompleteItems.findIndex(
|
|
244
|
-
|
|
245
|
-
return
|
|
207
|
+
let count = 0;
|
|
208
|
+
return autocompleteItems.findIndex(groups => {
|
|
209
|
+
count += groups.items.length;
|
|
210
|
+
return count > itemIndex;
|
|
246
211
|
});
|
|
247
212
|
}
|
|
248
213
|
else {
|
|
249
214
|
return -1;
|
|
250
215
|
}
|
|
251
216
|
};
|
|
252
|
-
|
|
217
|
+
const handleKeyboardShortcuts = (event) => {
|
|
253
218
|
if (event.ctrlKey || event.altKey || event.metaKey || !interactiveAutocompleteItems.length) {
|
|
254
219
|
return;
|
|
255
220
|
}
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
221
|
+
const autoCompleteItemCount = interactiveAutocompleteItems.length;
|
|
222
|
+
const firstItem = 0;
|
|
223
|
+
const lastItem = autoCompleteItemCount - 1;
|
|
224
|
+
let nextIndex = null;
|
|
260
225
|
setIsOpened(true);
|
|
261
226
|
switch (event.key) {
|
|
262
227
|
case 'ArrowUp':
|
|
263
228
|
case 'Up': // IE/Edge specific value
|
|
264
|
-
|
|
229
|
+
const upIndex = selectedAutocompleteIndex !== null ? selectedAutocompleteIndex - 1 : lastItem;
|
|
265
230
|
nextIndex = upIndex < 0 ? lastItem : upIndex;
|
|
266
231
|
event.stopPropagation();
|
|
267
232
|
event.preventDefault();
|
|
268
233
|
break;
|
|
269
234
|
case 'ArrowDown':
|
|
270
235
|
case 'Down': // IE/Edge specific value
|
|
271
|
-
|
|
236
|
+
const downIndex = selectedAutocompleteIndex !== null ? selectedAutocompleteIndex + 1 : firstItem;
|
|
272
237
|
nextIndex = downIndex >= autoCompleteItemCount ? firstItem : downIndex;
|
|
273
238
|
event.stopPropagation();
|
|
274
239
|
event.preventDefault();
|
|
@@ -279,7 +244,7 @@ var Combobox = function (_a) {
|
|
|
279
244
|
break;
|
|
280
245
|
case 'Enter':
|
|
281
246
|
if (selectedAutocompleteIndex != null) {
|
|
282
|
-
|
|
247
|
+
const item = interactiveAutocompleteItems[selectedAutocompleteIndex];
|
|
283
248
|
handleAutocompleteClick(event, item.props);
|
|
284
249
|
if (item.props.isDisabled) {
|
|
285
250
|
nextIndex = selectedAutocompleteIndex;
|
|
@@ -290,25 +255,27 @@ var Combobox = function (_a) {
|
|
|
290
255
|
break;
|
|
291
256
|
default:
|
|
292
257
|
}
|
|
293
|
-
|
|
294
|
-
|
|
258
|
+
const lastGroupIndex = getGroupIndex(selectedAutocompleteIndex);
|
|
259
|
+
const nextGroupIndex = getGroupIndex(nextIndex);
|
|
295
260
|
setShowGroupText(lastGroupIndex !== nextGroupIndex);
|
|
296
261
|
setSelectedAutocompleteIndex(nextIndex);
|
|
297
262
|
};
|
|
298
|
-
|
|
263
|
+
const handleSearchInputChange = (event) => {
|
|
299
264
|
if (onChange) {
|
|
300
265
|
onChange(event);
|
|
301
266
|
}
|
|
302
267
|
_setValue(event.target.value); // Calling set value directly only for on change event
|
|
303
268
|
};
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
var cssOverride = { zIndex: 2 };
|
|
269
|
+
const renderChildren = (inputElement) => {
|
|
270
|
+
let cssOverride = { ':focus': { zIndex: 2 } };
|
|
307
271
|
if (showClearButton) {
|
|
308
|
-
|
|
309
|
-
cssOverride =
|
|
272
|
+
const paddingDirection = isRTL ? 'paddingLeft' : 'paddingRight';
|
|
273
|
+
cssOverride = {
|
|
274
|
+
...cssOverride,
|
|
275
|
+
[paddingDirection]: space.xl,
|
|
276
|
+
};
|
|
310
277
|
}
|
|
311
|
-
|
|
278
|
+
const newTextInputProps = {
|
|
312
279
|
type: 'text',
|
|
313
280
|
id: componentId,
|
|
314
281
|
grow: grow,
|
|
@@ -325,16 +292,17 @@ var Combobox = function (_a) {
|
|
|
325
292
|
onBlur: handleBlur,
|
|
326
293
|
css: cssOverride,
|
|
327
294
|
role: 'combobox',
|
|
328
|
-
'aria-owns': showingAutocomplete ? componentId
|
|
295
|
+
'aria-owns': showingAutocomplete ? `${componentId}-${listBoxIdPart}` : undefined,
|
|
329
296
|
'aria-haspopup': true,
|
|
330
297
|
'aria-expanded': showingAutocomplete,
|
|
331
298
|
};
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
299
|
+
const cloneElement = (element, props) => jsx(element.type, {
|
|
300
|
+
...element.props,
|
|
301
|
+
...props,
|
|
302
|
+
});
|
|
303
|
+
return cloneElement(inputElement, { ...inputElement.props, ...newTextInputProps });
|
|
336
304
|
};
|
|
337
|
-
return (React.createElement(Container,
|
|
305
|
+
return (React.createElement(Container, Object.assign({ grow: grow }, elemProps),
|
|
338
306
|
React.createElement(InputContainer, { ref: comboboxRef },
|
|
339
307
|
isValidSingleChild(children) && React.Children.map(children, renderChildren),
|
|
340
308
|
showClearButton && (React.createElement(ResetButton, { shouldShow: !!value, "aria-label": clearButtonAriaLabel, icon: xSmallIcon, variant: clearButtonVariant, onClick: resetSearchInput, onBlur: handleBlur, size: "small", type: "button" })),
|
|
@@ -343,4 +311,3 @@ var Combobox = function (_a) {
|
|
|
343
311
|
React.createElement(AutocompleteList, { comboboxId: componentId, autocompleteItems: autocompleteItems, selectedIndex: selectedAutocompleteIndex, handleAutocompleteClick: handleAutocompleteClick, labelId: formLabelId, showGroupText: showGroupText }))))),
|
|
344
312
|
React.createElement(Status, { announcementText: announcementText })));
|
|
345
313
|
};
|
|
346
|
-
export default Combobox;
|
|
@@ -6,6 +6,5 @@ export interface StatusProps {
|
|
|
6
6
|
expireMilliseconds?: number;
|
|
7
7
|
announcementText?: string;
|
|
8
8
|
}
|
|
9
|
-
declare const Status: ({ ariaLive, role, ariaRelevant, expireMilliseconds, announcementText, ariaAtomic, }: StatusProps) => JSX.Element;
|
|
10
|
-
export default Status;
|
|
9
|
+
export declare const Status: ({ ariaLive, role, ariaRelevant, expireMilliseconds, announcementText, ariaAtomic, }: StatusProps) => JSX.Element;
|
|
11
10
|
//# sourceMappingURL=Status.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Status.d.ts","sourceRoot":"","sources":["../../../../combobox/lib/Status.tsx"],"names":[],"mappings":"AAIA,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,EAAE,QAAQ,GAAG,WAAW,GAAG,KAAK,CAAC;IAC1C,IAAI,CAAC,EAAE,KAAK,GAAG,QAAQ,GAAG,OAAO,GAAG,aAAa,GAAG,SAAS,GAAG,OAAO,CAAC;IACxE,YAAY,CAAC,EAAE,WAAW,GAAG,gBAAgB,GAAG,KAAK,GAAG,UAAU,GAAG,MAAM,CAAC;IAC5E,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B;AAID,
|
|
1
|
+
{"version":3,"file":"Status.d.ts","sourceRoot":"","sources":["../../../../combobox/lib/Status.tsx"],"names":[],"mappings":"AAIA,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,EAAE,QAAQ,GAAG,WAAW,GAAG,KAAK,CAAC;IAC1C,IAAI,CAAC,EAAE,KAAK,GAAG,QAAQ,GAAG,OAAO,GAAG,aAAa,GAAG,SAAS,GAAG,OAAO,CAAC;IACxE,YAAY,CAAC,EAAE,WAAW,GAAG,gBAAgB,GAAG,KAAK,GAAG,UAAU,GAAG,MAAM,CAAC;IAC5E,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B;AAID,eAAO,MAAM,MAAM,wFAOhB,WAAW,gBAuBb,CAAC"}
|
|
@@ -1,20 +1,18 @@
|
|
|
1
1
|
import React, { useState, useEffect } from 'react';
|
|
2
2
|
import styled from '@emotion/styled';
|
|
3
3
|
import { accessibleHide } from '@workday/canvas-kit-react/common';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
useEffect(function () {
|
|
4
|
+
const Container = styled('div')(accessibleHide);
|
|
5
|
+
export const Status = ({ ariaLive = 'polite', role = 'status', ariaRelevant = 'additions', expireMilliseconds = 500, announcementText = '', ariaAtomic, }) => {
|
|
6
|
+
const [displayText, setDisplayText] = useState(announcementText);
|
|
7
|
+
useEffect(() => {
|
|
9
8
|
if (!announcementText) {
|
|
10
9
|
return;
|
|
11
10
|
}
|
|
12
11
|
setDisplayText(announcementText);
|
|
13
|
-
|
|
14
|
-
return
|
|
12
|
+
const clearText = setTimeout(() => setDisplayText(''), expireMilliseconds);
|
|
13
|
+
return () => {
|
|
15
14
|
clearTimeout(clearText);
|
|
16
15
|
};
|
|
17
16
|
}, [announcementText, expireMilliseconds]);
|
|
18
17
|
return (React.createElement(Container, { "aria-live": ariaLive, role: role, "aria-relevant": ariaRelevant, "aria-atomic": ariaAtomic }, displayText));
|
|
19
18
|
};
|
|
20
|
-
export default Status;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../common/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../common/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC"}
|
package/dist/es6/common/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../common/lib/theming/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../common/lib/theming/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC"}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { CSSProperties } from '@workday/canvas-kit-react/tokens';
|
|
2
2
|
export declare type ComponentStyles = Record<string, CSSProperties>;
|
|
3
3
|
/**
|
|
4
|
+
* @deprecated Now that IE11 is no longer supported, we encourage consumers to use [CSS logical properties](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Logical_Properties)
|
|
5
|
+
*
|
|
6
|
+
*
|
|
4
7
|
* A helpful hook for supporting bidirectional styles.
|
|
5
8
|
* * Read below for more detail or [view the docs](https://github.com/Workday/canvas-kit/blob/master/modules/labs-react/common/README.md#useThemeRTL).
|
|
6
9
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useThemeRTL.d.ts","sourceRoot":"","sources":["../../../../../common/lib/theming/useThemeRTL.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useThemeRTL.d.ts","sourceRoot":"","sources":["../../../../../common/lib/theming/useThemeRTL.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,aAAa,EAAC,MAAM,kCAAkC,CAAC;AAI/D,oBAAY,eAAe,GAAG,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;AAc5D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,wBAAgB,WAAW;6BAMD,aAAa,EAAE;;EAYxC"}
|
|
@@ -1,36 +1,16 @@
|
|
|
1
|
-
|
|
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
|
-
import { convertToStaticStates, useIsRTL, useTheme, } from '@workday/canvas-kit-react/common';
|
|
1
|
+
import { useIsRTL, useTheme } from '@workday/canvas-kit-react/common';
|
|
20
2
|
import { useMemo } from 'react';
|
|
21
3
|
import rtlCSSJS from 'rtl-css-js';
|
|
22
|
-
|
|
23
|
-
var styles = [];
|
|
24
|
-
for (var _i = 1; _i < arguments.length; _i++) {
|
|
25
|
-
styles[_i - 1] = arguments[_i];
|
|
26
|
-
}
|
|
4
|
+
const getDirectionalStyles = (isRTL, ...styles) => {
|
|
27
5
|
return isRTL ? rtlCSSJS(styles) : styles;
|
|
28
6
|
};
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
return shouldConvert ? (_a = convertToStaticStates(styles)) !== null && _a !== void 0 ? _a : styles : styles;
|
|
7
|
+
const getConvertedStyles = (styles, convertFunc) => {
|
|
8
|
+
return convertFunc ? convertFunc(styles) : styles;
|
|
32
9
|
};
|
|
33
10
|
/**
|
|
11
|
+
* @deprecated Now that IE11 is no longer supported, we encourage consumers to use [CSS logical properties](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Logical_Properties)
|
|
12
|
+
*
|
|
13
|
+
*
|
|
34
14
|
* A helpful hook for supporting bidirectional styles.
|
|
35
15
|
* * Read below for more detail or [view the docs](https://github.com/Workday/canvas-kit/blob/master/modules/labs-react/common/README.md#useThemeRTL).
|
|
36
16
|
*
|
|
@@ -60,23 +40,18 @@ var getConvertedStyles = function (shouldConvert, styles) {
|
|
|
60
40
|
* }
|
|
61
41
|
*/
|
|
62
42
|
export function useThemeRTL() {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
var styles = getDirectionalStyles.apply(void 0, __spreadArrays([direction], cssObject));
|
|
74
|
-
return styles.reduce(function (first, second) {
|
|
75
|
-
var convertedFirst = shouldConvert ? getConvertedStyles(shouldConvert, first) : first;
|
|
76
|
-
var convertedSecond = shouldConvert ? getConvertedStyles(shouldConvert, second) : second;
|
|
77
|
-
return __assign(__assign({}, convertedFirst), convertedSecond);
|
|
43
|
+
const theme = useTheme();
|
|
44
|
+
const direction = useIsRTL(theme);
|
|
45
|
+
const convertFunc = theme.canvas._styleRewriteFn;
|
|
46
|
+
const themeRTL = useMemo(() => {
|
|
47
|
+
return (...cssObject) => {
|
|
48
|
+
const styles = getDirectionalStyles(direction, ...cssObject);
|
|
49
|
+
return styles.reduce((first, second) => {
|
|
50
|
+
const convertedFirst = getConvertedStyles(first, convertFunc);
|
|
51
|
+
const convertedSecond = getConvertedStyles(second, convertFunc);
|
|
52
|
+
return { ...convertedFirst, ...convertedSecond };
|
|
78
53
|
}, {});
|
|
79
54
|
};
|
|
80
|
-
}, [direction,
|
|
81
|
-
return { themeRTL
|
|
55
|
+
}, [direction, convertFunc]);
|
|
56
|
+
return { themeRTL, theme };
|
|
82
57
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../expandable/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,aAAa,CAAC"}
|