@workday/canvas-kit-labs-react 8.0.0-alpha.253-next.22 → 8.0.0-alpha.428-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/common/lib/theming/index.ts +0 -1
- package/common/lib/theming/useThemeRTL.ts +3 -0
- package/dist/commonjs/combobox/lib/AutocompleteList.js +31 -52
- package/dist/commonjs/combobox/lib/Combobox.js +105 -133
- package/dist/commonjs/combobox/lib/Status.js +9 -10
- 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 +19 -42
- package/dist/commonjs/expandable/lib/Expandable.d.ts +45 -12
- package/dist/commonjs/expandable/lib/Expandable.d.ts.map +1 -1
- package/dist/commonjs/expandable/lib/Expandable.js +46 -37
- package/dist/commonjs/expandable/lib/ExpandableAvatar.js +7 -30
- package/dist/commonjs/expandable/lib/ExpandableContent.d.ts +4 -2
- package/dist/commonjs/expandable/lib/ExpandableContent.d.ts.map +1 -1
- package/dist/commonjs/expandable/lib/ExpandableContent.js +8 -31
- package/dist/commonjs/expandable/lib/ExpandableIcon.d.ts +1 -1
- package/dist/commonjs/expandable/lib/ExpandableIcon.d.ts.map +1 -1
- package/dist/commonjs/expandable/lib/ExpandableIcon.js +20 -51
- package/dist/commonjs/expandable/lib/ExpandableTarget.d.ts +7 -2
- package/dist/commonjs/expandable/lib/ExpandableTarget.d.ts.map +1 -1
- package/dist/commonjs/expandable/lib/ExpandableTarget.js +18 -34
- package/dist/commonjs/expandable/lib/ExpandableTitle.d.ts +3 -1
- package/dist/commonjs/expandable/lib/ExpandableTitle.d.ts.map +1 -1
- package/dist/commonjs/expandable/lib/ExpandableTitle.js +6 -29
- package/dist/commonjs/expandable/lib/hooks/index.d.ts +1 -0
- package/dist/commonjs/expandable/lib/hooks/index.d.ts.map +1 -1
- package/dist/commonjs/expandable/lib/hooks/index.js +1 -0
- package/dist/commonjs/expandable/lib/hooks/useExpandableContent.d.ts +4 -6
- package/dist/commonjs/expandable/lib/hooks/useExpandableContent.d.ts.map +1 -1
- package/dist/commonjs/expandable/lib/hooks/useExpandableContent.js +3 -4
- package/dist/commonjs/expandable/lib/hooks/useExpandableIcon.d.ts +4 -6
- package/dist/commonjs/expandable/lib/hooks/useExpandableIcon.d.ts.map +1 -1
- package/dist/commonjs/expandable/lib/hooks/useExpandableIcon.js +3 -4
- package/dist/{es6/expandable/lib → commonjs/expandable/lib/hooks}/useExpandableModel.d.ts +10 -7
- 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 +4 -6
- package/dist/commonjs/expandable/lib/hooks/useExpandableTarget.d.ts.map +1 -1
- package/dist/commonjs/expandable/lib/hooks/useExpandableTarget.js +4 -5
- package/dist/commonjs/index.d.ts +0 -3
- package/dist/commonjs/index.d.ts.map +1 -1
- package/dist/commonjs/index.js +0 -3
- package/dist/commonjs/search-form/lib/SearchForm.d.ts +6 -1
- package/dist/commonjs/search-form/lib/SearchForm.d.ts.map +1 -1
- package/dist/commonjs/search-form/lib/SearchForm.js +117 -142
- package/dist/commonjs/search-form/lib/themes.js +7 -8
- package/dist/es6/combobox/lib/AutocompleteList.js +26 -47
- package/dist/es6/combobox/lib/Combobox.js +95 -123
- package/dist/es6/combobox/lib/Status.js +6 -7
- 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 +16 -39
- package/dist/es6/expandable/lib/Expandable.d.ts +45 -12
- package/dist/es6/expandable/lib/Expandable.d.ts.map +1 -1
- package/dist/es6/expandable/lib/Expandable.js +40 -31
- package/dist/es6/expandable/lib/ExpandableAvatar.js +4 -27
- package/dist/es6/expandable/lib/ExpandableContent.d.ts +4 -2
- package/dist/es6/expandable/lib/ExpandableContent.d.ts.map +1 -1
- package/dist/es6/expandable/lib/ExpandableContent.js +5 -28
- package/dist/es6/expandable/lib/ExpandableIcon.d.ts +1 -1
- package/dist/es6/expandable/lib/ExpandableIcon.d.ts.map +1 -1
- package/dist/es6/expandable/lib/ExpandableIcon.js +15 -46
- package/dist/es6/expandable/lib/ExpandableTarget.d.ts +7 -2
- package/dist/es6/expandable/lib/ExpandableTarget.d.ts.map +1 -1
- package/dist/es6/expandable/lib/ExpandableTarget.js +15 -31
- package/dist/es6/expandable/lib/ExpandableTitle.d.ts +3 -1
- package/dist/es6/expandable/lib/ExpandableTitle.d.ts.map +1 -1
- package/dist/es6/expandable/lib/ExpandableTitle.js +3 -26
- package/dist/es6/expandable/lib/hooks/index.d.ts +1 -0
- package/dist/es6/expandable/lib/hooks/index.d.ts.map +1 -1
- package/dist/es6/expandable/lib/hooks/index.js +1 -0
- package/dist/es6/expandable/lib/hooks/useExpandableContent.d.ts +4 -6
- package/dist/es6/expandable/lib/hooks/useExpandableContent.d.ts.map +1 -1
- package/dist/es6/expandable/lib/hooks/useExpandableContent.js +2 -3
- package/dist/es6/expandable/lib/hooks/useExpandableIcon.d.ts +4 -6
- package/dist/es6/expandable/lib/hooks/useExpandableIcon.d.ts.map +1 -1
- package/dist/es6/expandable/lib/hooks/useExpandableIcon.js +2 -3
- package/dist/{commonjs/expandable/lib → es6/expandable/lib/hooks}/useExpandableModel.d.ts +10 -7
- 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 +4 -6
- package/dist/es6/expandable/lib/hooks/useExpandableTarget.d.ts.map +1 -1
- package/dist/es6/expandable/lib/hooks/useExpandableTarget.js +3 -4
- package/dist/es6/index.d.ts +0 -3
- package/dist/es6/index.d.ts.map +1 -1
- package/dist/es6/index.js +0 -3
- package/dist/es6/search-form/lib/SearchForm.d.ts +6 -1
- package/dist/es6/search-form/lib/SearchForm.d.ts.map +1 -1
- package/dist/es6/search-form/lib/SearchForm.js +107 -133
- package/dist/es6/search-form/lib/themes.js +5 -6
- package/expandable/lib/Expandable.tsx +38 -4
- package/expandable/lib/ExpandableContent.tsx +4 -4
- package/expandable/lib/ExpandableIcon.tsx +2 -1
- package/expandable/lib/ExpandableTarget.tsx +3 -3
- package/expandable/lib/ExpandableTitle.tsx +6 -8
- package/expandable/lib/hooks/index.ts +1 -0
- package/expandable/lib/hooks/useExpandableContent.ts +1 -1
- package/expandable/lib/hooks/useExpandableIcon.ts +1 -1
- package/expandable/lib/{useExpandableModel.tsx → hooks/useExpandableModel.tsx} +3 -0
- package/expandable/lib/hooks/useExpandableTarget.ts +1 -1
- package/index.ts +0 -3
- package/package.json +4 -4
- package/search-form/lib/SearchForm.tsx +11 -5
- package/common/lib/theming/useThemedRing.ts +0 -82
- 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 -3
- package/dist/commonjs/drawer/index.d.ts.map +0 -1
- package/dist/commonjs/drawer/index.js +0 -16
- package/dist/commonjs/drawer/lib/Drawer.d.ts +0 -74
- package/dist/commonjs/drawer/lib/Drawer.d.ts.map +0 -1
- package/dist/commonjs/drawer/lib/Drawer.js +0 -142
- package/dist/commonjs/drawer/lib/DrawerHeader.d.ts +0 -55
- package/dist/commonjs/drawer/lib/DrawerHeader.d.ts.map +0 -1
- package/dist/commonjs/drawer/lib/DrawerHeader.js +0 -113
- package/dist/commonjs/expandable/lib/useExpandableModel.d.ts.map +0 -1
- package/dist/commonjs/expandable/lib/useExpandableModel.js +0 -24
- package/dist/commonjs/toast/index.d.ts +0 -3
- package/dist/commonjs/toast/index.d.ts.map +0 -1
- package/dist/commonjs/toast/index.js +0 -14
- package/dist/commonjs/toast/lib/Toast.d.ts +0 -27
- package/dist/commonjs/toast/lib/Toast.d.ts.map +0 -1
- package/dist/commonjs/toast/lib/Toast.js +0 -78
- package/dist/commonjs/toast/lib/ToastBody.d.ts +0 -6
- package/dist/commonjs/toast/lib/ToastBody.d.ts.map +0 -1
- package/dist/commonjs/toast/lib/ToastBody.js +0 -40
- package/dist/commonjs/toast/lib/ToastCloseIcon.d.ts +0 -6
- package/dist/commonjs/toast/lib/ToastCloseIcon.d.ts.map +0 -1
- package/dist/commonjs/toast/lib/ToastCloseIcon.js +0 -43
- package/dist/commonjs/toast/lib/ToastIcon.d.ts +0 -5
- package/dist/commonjs/toast/lib/ToastIcon.d.ts.map +0 -1
- package/dist/commonjs/toast/lib/ToastIcon.js +0 -26
- package/dist/commonjs/toast/lib/ToastLink.d.ts +0 -9
- package/dist/commonjs/toast/lib/ToastLink.d.ts.map +0 -1
- package/dist/commonjs/toast/lib/ToastLink.js +0 -42
- package/dist/commonjs/toast/lib/ToastMessage.d.ts +0 -11
- package/dist/commonjs/toast/lib/ToastMessage.d.ts.map +0 -1
- package/dist/commonjs/toast/lib/ToastMessage.js +0 -41
- package/dist/commonjs/toast/lib/hooks/useToastModel.d.ts +0 -65
- package/dist/commonjs/toast/lib/hooks/useToastModel.d.ts.map +0 -1
- package/dist/commonjs/toast/lib/hooks/useToastModel.js +0 -35
- 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 -3
- package/dist/es6/drawer/index.d.ts.map +0 -1
- package/dist/es6/drawer/index.js +0 -2
- package/dist/es6/drawer/lib/Drawer.d.ts +0 -74
- package/dist/es6/drawer/lib/Drawer.d.ts.map +0 -1
- package/dist/es6/drawer/lib/Drawer.js +0 -117
- package/dist/es6/drawer/lib/DrawerHeader.d.ts +0 -55
- package/dist/es6/drawer/lib/DrawerHeader.d.ts.map +0 -1
- package/dist/es6/drawer/lib/DrawerHeader.js +0 -88
- package/dist/es6/expandable/lib/useExpandableModel.d.ts.map +0 -1
- package/dist/es6/expandable/lib/useExpandableModel.js +0 -21
- package/dist/es6/toast/index.d.ts +0 -3
- package/dist/es6/toast/index.d.ts.map +0 -1
- package/dist/es6/toast/index.js +0 -2
- package/dist/es6/toast/lib/Toast.d.ts +0 -27
- package/dist/es6/toast/lib/Toast.d.ts.map +0 -1
- package/dist/es6/toast/lib/Toast.js +0 -72
- package/dist/es6/toast/lib/ToastBody.d.ts +0 -6
- package/dist/es6/toast/lib/ToastBody.d.ts.map +0 -1
- package/dist/es6/toast/lib/ToastBody.js +0 -34
- package/dist/es6/toast/lib/ToastCloseIcon.d.ts +0 -6
- package/dist/es6/toast/lib/ToastCloseIcon.d.ts.map +0 -1
- package/dist/es6/toast/lib/ToastCloseIcon.js +0 -37
- package/dist/es6/toast/lib/ToastIcon.d.ts +0 -5
- package/dist/es6/toast/lib/ToastIcon.d.ts.map +0 -1
- package/dist/es6/toast/lib/ToastIcon.js +0 -20
- package/dist/es6/toast/lib/ToastLink.d.ts +0 -9
- package/dist/es6/toast/lib/ToastLink.d.ts.map +0 -1
- package/dist/es6/toast/lib/ToastLink.js +0 -36
- package/dist/es6/toast/lib/ToastMessage.d.ts +0 -11
- package/dist/es6/toast/lib/ToastMessage.d.ts.map +0 -1
- package/dist/es6/toast/lib/ToastMessage.js +0 -35
- package/dist/es6/toast/lib/hooks/useToastModel.d.ts +0 -65
- package/dist/es6/toast/lib/hooks/useToastModel.d.ts.map +0 -1
- package/dist/es6/toast/lib/hooks/useToastModel.js +0 -32
- package/drawer/LICENSE +0 -51
- package/drawer/README.md +0 -35
- package/drawer/index.ts +0 -2
- package/drawer/lib/Drawer.tsx +0 -156
- package/drawer/lib/DrawerHeader.tsx +0 -133
- package/drawer/package.json +0 -6
- package/toast/LICENSE +0 -52
- package/toast/README.md +0 -5
- package/toast/index.ts +0 -2
- package/toast/lib/Toast.tsx +0 -63
- package/toast/lib/ToastBody.tsx +0 -34
- package/toast/lib/ToastCloseIcon.tsx +0 -18
- package/toast/lib/ToastIcon.tsx +0 -24
- package/toast/lib/ToastLink.tsx +0 -27
- package/toast/lib/ToastMessage.tsx +0 -21
- package/toast/lib/hooks/useToastModel.tsx +0 -27
- package/toast/package.json +0 -6
|
@@ -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';
|
|
@@ -30,20 +8,17 @@ import { xSmallIcon } from '@workday/canvas-system-icons-web';
|
|
|
30
8
|
import flatten from 'lodash.flatten';
|
|
31
9
|
import { AutocompleteList } from './AutocompleteList';
|
|
32
10
|
import { Status } from './Status';
|
|
33
|
-
|
|
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,45 +26,40 @@ 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
|
-
return baseId + "-" + optionIdPart + "-" + index;
|
|
89
|
-
};
|
|
90
|
-
export var getTextFromElement = function (children) {
|
|
91
|
-
var text = '';
|
|
92
|
-
React.Children.map(children, function (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 => {
|
|
93
63
|
if (child == null || typeof child === 'boolean') {
|
|
94
64
|
text += '';
|
|
95
65
|
}
|
|
@@ -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
|
-
export
|
|
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,25 +167,25 @@ export 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
|
-
|
|
188
|
+
const target = event.relatedTarget;
|
|
220
189
|
if (target && comboboxRef.current.contains(target)) {
|
|
221
190
|
return;
|
|
222
191
|
}
|
|
@@ -226,45 +195,45 @@ export var Combobox = function (_a) {
|
|
|
226
195
|
onBlur(event);
|
|
227
196
|
}
|
|
228
197
|
};
|
|
229
|
-
|
|
198
|
+
const resetSearchInput = () => {
|
|
230
199
|
setInputValue('');
|
|
231
200
|
focusInput();
|
|
232
201
|
};
|
|
233
|
-
|
|
202
|
+
const getGroupIndex = (itemIndex) => {
|
|
234
203
|
if (itemIndex != null &&
|
|
235
204
|
autocompleteItems &&
|
|
236
205
|
autocompleteItems.length &&
|
|
237
206
|
autocompleteItems[0].hasOwnProperty('header')) {
|
|
238
|
-
|
|
239
|
-
return autocompleteItems.findIndex(
|
|
240
|
-
|
|
241
|
-
return
|
|
207
|
+
let count = 0;
|
|
208
|
+
return autocompleteItems.findIndex(groups => {
|
|
209
|
+
count += groups.items.length;
|
|
210
|
+
return count > itemIndex;
|
|
242
211
|
});
|
|
243
212
|
}
|
|
244
213
|
else {
|
|
245
214
|
return -1;
|
|
246
215
|
}
|
|
247
216
|
};
|
|
248
|
-
|
|
217
|
+
const handleKeyboardShortcuts = (event) => {
|
|
249
218
|
if (event.ctrlKey || event.altKey || event.metaKey || !interactiveAutocompleteItems.length) {
|
|
250
219
|
return;
|
|
251
220
|
}
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
221
|
+
const autoCompleteItemCount = interactiveAutocompleteItems.length;
|
|
222
|
+
const firstItem = 0;
|
|
223
|
+
const lastItem = autoCompleteItemCount - 1;
|
|
224
|
+
let nextIndex = null;
|
|
256
225
|
setIsOpened(true);
|
|
257
226
|
switch (event.key) {
|
|
258
227
|
case 'ArrowUp':
|
|
259
228
|
case 'Up': // IE/Edge specific value
|
|
260
|
-
|
|
229
|
+
const upIndex = selectedAutocompleteIndex !== null ? selectedAutocompleteIndex - 1 : lastItem;
|
|
261
230
|
nextIndex = upIndex < 0 ? lastItem : upIndex;
|
|
262
231
|
event.stopPropagation();
|
|
263
232
|
event.preventDefault();
|
|
264
233
|
break;
|
|
265
234
|
case 'ArrowDown':
|
|
266
235
|
case 'Down': // IE/Edge specific value
|
|
267
|
-
|
|
236
|
+
const downIndex = selectedAutocompleteIndex !== null ? selectedAutocompleteIndex + 1 : firstItem;
|
|
268
237
|
nextIndex = downIndex >= autoCompleteItemCount ? firstItem : downIndex;
|
|
269
238
|
event.stopPropagation();
|
|
270
239
|
event.preventDefault();
|
|
@@ -275,7 +244,7 @@ export var Combobox = function (_a) {
|
|
|
275
244
|
break;
|
|
276
245
|
case 'Enter':
|
|
277
246
|
if (selectedAutocompleteIndex != null) {
|
|
278
|
-
|
|
247
|
+
const item = interactiveAutocompleteItems[selectedAutocompleteIndex];
|
|
279
248
|
handleAutocompleteClick(event, item.props);
|
|
280
249
|
if (item.props.isDisabled) {
|
|
281
250
|
nextIndex = selectedAutocompleteIndex;
|
|
@@ -286,25 +255,27 @@ export var Combobox = function (_a) {
|
|
|
286
255
|
break;
|
|
287
256
|
default:
|
|
288
257
|
}
|
|
289
|
-
|
|
290
|
-
|
|
258
|
+
const lastGroupIndex = getGroupIndex(selectedAutocompleteIndex);
|
|
259
|
+
const nextGroupIndex = getGroupIndex(nextIndex);
|
|
291
260
|
setShowGroupText(lastGroupIndex !== nextGroupIndex);
|
|
292
261
|
setSelectedAutocompleteIndex(nextIndex);
|
|
293
262
|
};
|
|
294
|
-
|
|
263
|
+
const handleSearchInputChange = (event) => {
|
|
295
264
|
if (onChange) {
|
|
296
265
|
onChange(event);
|
|
297
266
|
}
|
|
298
267
|
_setValue(event.target.value); // Calling set value directly only for on change event
|
|
299
268
|
};
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
var cssOverride = { ':focus': { zIndex: 2 } };
|
|
269
|
+
const renderChildren = (inputElement) => {
|
|
270
|
+
let cssOverride = { ':focus': { zIndex: 2 } };
|
|
303
271
|
if (showClearButton) {
|
|
304
|
-
|
|
305
|
-
cssOverride =
|
|
272
|
+
const paddingDirection = isRTL ? 'paddingLeft' : 'paddingRight';
|
|
273
|
+
cssOverride = {
|
|
274
|
+
...cssOverride,
|
|
275
|
+
[paddingDirection]: space.xl,
|
|
276
|
+
};
|
|
306
277
|
}
|
|
307
|
-
|
|
278
|
+
const newTextInputProps = {
|
|
308
279
|
type: 'text',
|
|
309
280
|
id: componentId,
|
|
310
281
|
grow: grow,
|
|
@@ -321,16 +292,17 @@ export var Combobox = function (_a) {
|
|
|
321
292
|
onBlur: handleBlur,
|
|
322
293
|
css: cssOverride,
|
|
323
294
|
role: 'combobox',
|
|
324
|
-
'aria-owns': showingAutocomplete ? componentId
|
|
295
|
+
'aria-owns': showingAutocomplete ? `${componentId}-${listBoxIdPart}` : undefined,
|
|
325
296
|
'aria-haspopup': true,
|
|
326
297
|
'aria-expanded': showingAutocomplete,
|
|
327
298
|
};
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
299
|
+
const cloneElement = (element, props) => jsx(element.type, {
|
|
300
|
+
...element.props,
|
|
301
|
+
...props,
|
|
302
|
+
});
|
|
303
|
+
return cloneElement(inputElement, { ...inputElement.props, ...newTextInputProps });
|
|
332
304
|
};
|
|
333
|
-
return (React.createElement(Container,
|
|
305
|
+
return (React.createElement(Container, Object.assign({ grow: grow }, elemProps),
|
|
334
306
|
React.createElement(InputContainer, { ref: comboboxRef },
|
|
335
307
|
isValidSingleChild(children) && React.Children.map(children, renderChildren),
|
|
336
308
|
showClearButton && (React.createElement(ResetButton, { shouldShow: !!value, "aria-label": clearButtonAriaLabel, icon: xSmallIcon, variant: clearButtonVariant, onClick: resetSearchInput, onBlur: handleBlur, size: "small", type: "button" })),
|
|
@@ -1,17 +1,16 @@
|
|
|
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
|
-
export
|
|
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]);
|
|
@@ -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":"AACA,OAAO,EAAC,aAAa,EAAC,MAAM,kCAAkC,CAAC;AAI/D,oBAAY,eAAe,GAAG,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;AAc5D
|
|
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,35 +1,16 @@
|
|
|
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 { 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
|
-
|
|
7
|
+
const getConvertedStyles = (styles, convertFunc) => {
|
|
30
8
|
return convertFunc ? convertFunc(styles) : styles;
|
|
31
9
|
};
|
|
32
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
|
+
*
|
|
33
14
|
* A helpful hook for supporting bidirectional styles.
|
|
34
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).
|
|
35
16
|
*
|
|
@@ -59,22 +40,18 @@ var getConvertedStyles = function (styles, convertFunc) {
|
|
|
59
40
|
* }
|
|
60
41
|
*/
|
|
61
42
|
export function useThemeRTL() {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
return
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
return styles.reduce(function (first, second) {
|
|
73
|
-
var convertedFirst = getConvertedStyles(first, convertFunc);
|
|
74
|
-
var convertedSecond = getConvertedStyles(second, convertFunc);
|
|
75
|
-
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 };
|
|
76
53
|
}, {});
|
|
77
54
|
};
|
|
78
55
|
}, [direction, convertFunc]);
|
|
79
|
-
return { themeRTL
|
|
56
|
+
return { themeRTL, theme };
|
|
80
57
|
}
|
|
@@ -8,68 +8,101 @@ export interface ExpandableProps extends ExtractProps<typeof Flex, never> {
|
|
|
8
8
|
*/
|
|
9
9
|
children?: React.ReactNode;
|
|
10
10
|
}
|
|
11
|
+
/**
|
|
12
|
+
* `Expandable` wraps an `Expandable.Target` and an `Expandable.Content`. By default, it provides a
|
|
13
|
+
* `DisclosureModel` for its subcomponents. Alternatively, a model may be passed in using the
|
|
14
|
+
* hoisted model pattern.
|
|
15
|
+
*/
|
|
11
16
|
export declare const Expandable: import("@workday/canvas-kit-react/common").ElementComponentM<"div", ExpandableProps & Partial<{
|
|
12
17
|
id: string;
|
|
13
18
|
initialVisibility: import("@workday/canvas-kit-react/disclosure").Visibility;
|
|
14
19
|
}> & {
|
|
15
20
|
onShow?: ((data: Event | React.SyntheticEvent<Element, Event> | undefined, prevState: {
|
|
16
21
|
id: string;
|
|
17
|
-
visibility:
|
|
22
|
+
visibility: "hidden" | "visible";
|
|
18
23
|
}) => void) | undefined;
|
|
19
24
|
onHide?: ((data: Event | React.SyntheticEvent<Element, Event> | undefined, prevState: {
|
|
20
25
|
id: string;
|
|
21
|
-
visibility:
|
|
26
|
+
visibility: "hidden" | "visible";
|
|
22
27
|
}) => void) | undefined;
|
|
23
28
|
} & {
|
|
24
29
|
shouldShow?: ((data: Event | React.SyntheticEvent<Element, Event> | undefined, state: {
|
|
25
30
|
id: string;
|
|
26
|
-
visibility:
|
|
31
|
+
visibility: "hidden" | "visible";
|
|
27
32
|
}) => boolean) | undefined;
|
|
28
33
|
shouldHide?: ((data: Event | React.SyntheticEvent<Element, Event> | undefined, state: {
|
|
29
34
|
id: string;
|
|
30
|
-
visibility:
|
|
35
|
+
visibility: "hidden" | "visible";
|
|
31
36
|
}) => boolean) | undefined;
|
|
32
37
|
}, {
|
|
33
38
|
state: {
|
|
34
39
|
id: string;
|
|
35
|
-
visibility:
|
|
40
|
+
visibility: "hidden" | "visible";
|
|
36
41
|
};
|
|
37
42
|
events: {
|
|
38
43
|
show(event?: Event | React.SyntheticEvent<Element, Event> | undefined): void;
|
|
39
44
|
hide(event?: Event | React.SyntheticEvent<Element, Event> | undefined): void;
|
|
40
45
|
};
|
|
41
46
|
}> & {
|
|
47
|
+
/**
|
|
48
|
+
* `Expandable.Target` creates a heading and a button. The heading is a semantic heading to
|
|
49
|
+
* describe the associated content. The button provides users the ability to toggle the
|
|
50
|
+
* associated content.
|
|
51
|
+
*
|
|
52
|
+
* As according to the [W3 disclosure
|
|
53
|
+
* specification](https://www.w3.org/TR/wai-aria-practices-1.1/#disclosure), the button has
|
|
54
|
+
* `aria-expanded` and `aria-controls` attributes set by default
|
|
55
|
+
*
|
|
56
|
+
* This component should hold an `Expandable.Icon`, an optional `Expandable.Avatar`, and an
|
|
57
|
+
* `Expandable.Title`.
|
|
58
|
+
*/
|
|
42
59
|
Target: import("@workday/canvas-kit-react/common").ElementComponentM<"button", import("./ExpandableTarget").ExpandableTargetProps, {
|
|
43
60
|
state: {
|
|
44
61
|
id: string;
|
|
45
|
-
visibility:
|
|
62
|
+
visibility: "hidden" | "visible";
|
|
46
63
|
};
|
|
47
64
|
events: {
|
|
48
65
|
show(event?: Event | React.SyntheticEvent<Element, Event> | undefined): void;
|
|
49
66
|
hide(event?: Event | React.SyntheticEvent<Element, Event> | undefined): void;
|
|
50
67
|
};
|
|
51
68
|
}>;
|
|
52
|
-
|
|
69
|
+
/**
|
|
70
|
+
* `Expandable.Title` styles the target text that describes the content.
|
|
71
|
+
*/
|
|
72
|
+
Title: import("@workday/canvas-kit-react/common").ElementComponent<"div", import("./ExpandableTitle").ExpandableTitleProps>;
|
|
73
|
+
/**
|
|
74
|
+
* `Expandable.Icon` creates an icon to visually indicate the state of the content. It takes an
|
|
75
|
+
* `iconPosition` prop to determine which chevron icon to use.
|
|
76
|
+
*/
|
|
77
|
+
Icon: import("@workday/canvas-kit-react/common").ElementComponentM<"span", import("./ExpandableIcon").ExpandableIconProps, {
|
|
53
78
|
state: {
|
|
54
79
|
id: string;
|
|
55
|
-
visibility:
|
|
80
|
+
visibility: "hidden" | "visible";
|
|
56
81
|
};
|
|
57
82
|
events: {
|
|
58
83
|
show(event?: Event | React.SyntheticEvent<Element, Event> | undefined): void;
|
|
59
84
|
hide(event?: Event | React.SyntheticEvent<Element, Event> | undefined): void;
|
|
60
85
|
};
|
|
61
86
|
}>;
|
|
62
|
-
|
|
87
|
+
/**
|
|
88
|
+
* `Expandable.Avatar` is an optional component that creates an `Avatar` to display a decorative
|
|
89
|
+
* image.
|
|
90
|
+
*/
|
|
91
|
+
Avatar: import("@workday/canvas-kit-react/common").ElementComponent<"button", import("./ExpandableAvatar").ExpandableAvatarProps>;
|
|
92
|
+
/**
|
|
93
|
+
* `Expandable.Content` holds the content that will be conditionally expanded and collapsed. It
|
|
94
|
+
* has an `id` to ensure the `Expandable.Target` properly set it to the `aria-controls`
|
|
95
|
+
* attribute.
|
|
96
|
+
*/
|
|
97
|
+
Content: import("@workday/canvas-kit-react/common").ElementComponentM<"div", import("./ExpandableContent").ExpandableContentProps, {
|
|
63
98
|
state: {
|
|
64
99
|
id: string;
|
|
65
|
-
visibility:
|
|
100
|
+
visibility: "hidden" | "visible";
|
|
66
101
|
};
|
|
67
102
|
events: {
|
|
68
103
|
show(event?: Event | React.SyntheticEvent<Element, Event> | undefined): void;
|
|
69
104
|
hide(event?: Event | React.SyntheticEvent<Element, Event> | undefined): void;
|
|
70
105
|
};
|
|
71
106
|
}>;
|
|
72
|
-
Avatar: import("@workday/canvas-kit-react/common").ElementComponent<"button", import("./ExpandableAvatar").ExpandableAvatarProps>;
|
|
73
|
-
Title: import("@workday/canvas-kit-react/common").ElementComponent<"div", import("./ExpandableTitle").ExpandableTitleProps>;
|
|
74
107
|
};
|
|
75
108
|
//# sourceMappingURL=Expandable.d.ts.map
|