@carbon/react 1.24.0 → 1.26.0-rc.0
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/es/components/Button/Button.js +2 -2
- package/es/components/CodeSnippet/CodeSnippet.js +13 -115
- package/es/components/ComboBox/ComboBox.d.ts +6 -0
- package/es/components/ComboBox/ComboBox.js +19 -172
- package/es/components/ComboButton/index.js +164 -0
- package/es/components/ComposedModal/ComposedModal.js +1 -2
- package/es/components/DataTable/Table.d.ts +74 -0
- package/es/components/DataTable/Table.js +4 -2
- package/es/components/DataTable/TableCell.d.ts +10 -0
- package/es/components/DataTable/TableContext.d.ts +13 -0
- package/es/components/DataTable/TableContext.js +2 -2
- package/es/components/DataTable/TableExpandRow.d.ts +67 -0
- package/es/components/DataTable/TableExpandedRow.d.ts +32 -0
- package/es/components/DataTable/TableHead.d.ts +10 -0
- package/es/components/DataTable/TableHeader.d.ts +64 -0
- package/es/components/DataTable/TableHeader.js +23 -28
- package/es/components/DataTable/TableRow.d.ts +32 -0
- package/es/components/DataTable/TableSelectAll.js +1 -1
- package/es/components/DataTable/TableSelectRow.js +1 -3
- package/es/components/DataTable/TableToolbar.d.ts +19 -0
- package/es/components/DataTable/TableToolbar.js +1 -1
- package/es/components/DataTable/TableToolbarAction.d.ts +21 -0
- package/es/components/DataTable/TableToolbarContent.d.ts +19 -0
- package/es/components/DataTable/TableToolbarMenu.d.ts +24 -0
- package/es/components/DataTable/TableToolbarMenu.js +3 -3
- package/es/components/DataTable/TableToolbarSearch.js +1 -0
- package/es/components/DataTable/tools/sorting.js +2 -1
- package/es/components/DataTableSkeleton/DataTableSkeleton.d.ts +107 -0
- package/es/components/Dropdown/Dropdown.d.ts +6 -0
- package/es/components/Dropdown/Dropdown.js +8 -145
- package/es/components/ExpandableSearch/ExpandableSearch.js +1 -0
- package/es/components/FileUploader/FileUploader.js +1 -1
- package/es/components/FileUploader/FileUploaderButton.js +2 -0
- package/es/components/FileUploader/FileUploaderDropContainer.js +30 -18
- package/es/components/FileUploader/FileUploaderItem.js +2 -1
- package/es/components/FileUploader/Filename.js +8 -2
- package/es/components/FluidTextArea/FluidTextArea.js +12 -1
- package/es/components/IconButton/index.js +1 -0
- package/es/components/InlineCheckbox/InlineCheckbox.js +7 -53
- package/es/components/ListBox/ListBoxSelection.js +4 -23
- package/es/components/ListBox/next/ListBoxSelection.js +2 -23
- package/es/components/Menu/Menu.js +50 -29
- package/es/components/Menu/MenuItem.js +1 -0
- package/es/components/MenuButton/index.js +127 -0
- package/es/components/Modal/Modal.js +4 -3
- package/es/components/MultiSelect/FilterableMultiSelect.js +46 -144
- package/es/components/MultiSelect/MultiSelect.d.ts +1 -1
- package/es/components/MultiSelect/MultiSelect.js +48 -28
- package/es/components/Notification/Notification.js +27 -264
- package/es/components/NumberInput/NumberInput.js +9 -1
- package/es/components/OverflowMenu/OverflowMenu.js +13 -139
- package/es/components/OverflowMenuItem/OverflowMenuItem.d.ts +58 -0
- package/es/components/OverflowMenuItem/OverflowMenuItem.js +12 -7
- package/es/components/OverflowMenuV2/index.js +15 -51
- package/es/components/Popover/index.d.ts +5 -1
- package/es/components/Popover/index.js +37 -9
- package/es/components/RadioButton/RadioButton.Skeleton.d.ts +25 -0
- package/es/components/RadioButton/RadioButton.Skeleton.js +3 -3
- package/es/components/RadioButton/RadioButton.d.ts +64 -0
- package/es/components/RadioButton/RadioButton.js +19 -17
- package/es/components/RadioButtonGroup/RadioButtonGroup.d.ts +80 -0
- package/es/components/RadioButtonGroup/RadioButtonGroup.js +88 -26
- package/es/components/RadioTile/RadioTile.js +6 -6
- package/es/components/Search/Search.Skeleton.d.ts +36 -0
- package/es/components/Search/Search.js +3 -2
- package/es/components/Search/index.js +1 -0
- package/es/components/Select/Select.d.ts +89 -0
- package/es/components/SelectItem/SelectItem.d.ts +62 -0
- package/es/components/SelectItem/SelectItem.js +2 -4
- package/es/components/SelectItemGroup/SelectItemGroup.d.ts +52 -0
- package/es/components/SkeletonText/SkeletonText.js +1 -1
- package/es/components/StructuredList/StructuredList.js +11 -39
- package/es/components/Tabs/Tabs.js +29 -6
- package/es/components/TextArea/TextArea.Skeleton.d.ts +33 -0
- package/es/components/TextArea/TextArea.Skeleton.js +5 -5
- package/es/components/TextArea/TextArea.d.ts +9 -2
- package/es/components/TextArea/TextArea.js +31 -8
- package/es/components/TextArea/index.js +1 -0
- package/es/components/TextInput/TextInput.Skeleton.d.ts +33 -0
- package/es/components/TextInput/index.js +1 -0
- package/es/components/Tile/Tile.js +15 -8
- package/es/components/Toggle/Toggle.js +8 -19
- package/es/components/Tooltip/DefinitionTooltip.d.ts +52 -0
- package/es/components/Tooltip/DefinitionTooltip.js +2 -2
- package/es/components/Tooltip/Tooltip.d.ts +117 -0
- package/es/components/Tooltip/Tooltip.js +6 -4
- package/es/components/Tooltip/index.d.ts +9 -0
- package/es/components/UIShell/HeaderMenu.js +13 -4
- package/es/components/UIShell/HeaderMenuItem.js +17 -4
- package/es/index.d.ts +2 -0
- package/es/index.js +5 -3
- package/es/internal/ClickListener.js +1 -2
- package/es/internal/keyboard/match.js +1 -1
- package/es/internal/useAttachedMenu.js +85 -0
- package/es/internal/useDelayedState.d.ts +19 -0
- package/es/internal/useDelayedState.js +7 -3
- package/es/internal/useId.js +1 -1
- package/es/tools/wrapComponent.js +9 -0
- package/lib/components/Button/Button.js +2 -2
- package/lib/components/CodeSnippet/CodeSnippet.js +13 -115
- package/lib/components/ComboBox/ComboBox.d.ts +6 -0
- package/lib/components/ComboBox/ComboBox.js +18 -171
- package/lib/components/ComboButton/index.js +174 -0
- package/lib/components/ComposedModal/ComposedModal.js +1 -2
- package/lib/components/DataTable/Table.d.ts +74 -0
- package/lib/components/DataTable/Table.js +4 -2
- package/lib/components/DataTable/TableCell.d.ts +10 -0
- package/lib/components/DataTable/TableContext.d.ts +13 -0
- package/lib/components/DataTable/TableContext.js +2 -2
- package/lib/components/DataTable/TableExpandRow.d.ts +67 -0
- package/lib/components/DataTable/TableExpandedRow.d.ts +32 -0
- package/lib/components/DataTable/TableHead.d.ts +10 -0
- package/lib/components/DataTable/TableHeader.d.ts +64 -0
- package/lib/components/DataTable/TableHeader.js +23 -28
- package/lib/components/DataTable/TableRow.d.ts +32 -0
- package/lib/components/DataTable/TableSelectAll.js +1 -1
- package/lib/components/DataTable/TableSelectRow.js +1 -3
- package/lib/components/DataTable/TableToolbar.d.ts +19 -0
- package/lib/components/DataTable/TableToolbar.js +1 -1
- package/lib/components/DataTable/TableToolbarAction.d.ts +21 -0
- package/lib/components/DataTable/TableToolbarContent.d.ts +19 -0
- package/lib/components/DataTable/TableToolbarMenu.d.ts +24 -0
- package/lib/components/DataTable/TableToolbarMenu.js +3 -3
- package/lib/components/DataTable/TableToolbarSearch.js +1 -0
- package/lib/components/DataTable/tools/sorting.js +2 -1
- package/lib/components/DataTableSkeleton/DataTableSkeleton.d.ts +107 -0
- package/lib/components/Dropdown/Dropdown.d.ts +6 -0
- package/lib/components/Dropdown/Dropdown.js +7 -144
- package/lib/components/ExpandableSearch/ExpandableSearch.js +1 -0
- package/lib/components/FileUploader/FileUploader.js +1 -1
- package/lib/components/FileUploader/FileUploaderButton.js +2 -0
- package/lib/components/FileUploader/FileUploaderDropContainer.js +30 -18
- package/lib/components/FileUploader/FileUploaderItem.js +2 -1
- package/lib/components/FileUploader/Filename.js +8 -2
- package/lib/components/FluidTextArea/FluidTextArea.js +12 -1
- package/lib/components/IconButton/index.js +1 -0
- package/lib/components/InlineCheckbox/InlineCheckbox.js +7 -53
- package/lib/components/ListBox/ListBoxSelection.js +4 -23
- package/lib/components/ListBox/next/ListBoxSelection.js +2 -23
- package/lib/components/Menu/Menu.js +50 -29
- package/lib/components/Menu/MenuItem.js +1 -0
- package/lib/components/MenuButton/index.js +137 -0
- package/lib/components/Modal/Modal.js +4 -3
- package/lib/components/MultiSelect/FilterableMultiSelect.js +43 -141
- package/lib/components/MultiSelect/MultiSelect.d.ts +1 -1
- package/lib/components/MultiSelect/MultiSelect.js +47 -27
- package/lib/components/Notification/Notification.js +27 -264
- package/lib/components/NumberInput/NumberInput.js +9 -1
- package/lib/components/OverflowMenu/OverflowMenu.js +13 -139
- package/lib/components/OverflowMenuItem/OverflowMenuItem.d.ts +58 -0
- package/lib/components/OverflowMenuItem/OverflowMenuItem.js +12 -7
- package/lib/components/OverflowMenuV2/index.js +13 -49
- package/lib/components/Popover/index.d.ts +5 -1
- package/lib/components/Popover/index.js +37 -9
- package/lib/components/RadioButton/RadioButton.Skeleton.d.ts +25 -0
- package/lib/components/RadioButton/RadioButton.Skeleton.js +3 -3
- package/lib/components/RadioButton/RadioButton.d.ts +64 -0
- package/lib/components/RadioButton/RadioButton.js +18 -16
- package/lib/components/RadioButtonGroup/RadioButtonGroup.d.ts +80 -0
- package/lib/components/RadioButtonGroup/RadioButtonGroup.js +86 -24
- package/lib/components/RadioTile/RadioTile.js +6 -6
- package/lib/components/Search/Search.Skeleton.d.ts +36 -0
- package/lib/components/Search/Search.js +3 -2
- package/lib/components/Search/index.js +2 -0
- package/lib/components/Select/Select.d.ts +89 -0
- package/lib/components/SelectItem/SelectItem.d.ts +62 -0
- package/lib/components/SelectItem/SelectItem.js +1 -3
- package/lib/components/SelectItemGroup/SelectItemGroup.d.ts +52 -0
- package/lib/components/SkeletonText/SkeletonText.js +1 -1
- package/lib/components/StructuredList/StructuredList.js +11 -39
- package/lib/components/Tabs/Tabs.js +29 -6
- package/lib/components/TextArea/TextArea.Skeleton.d.ts +33 -0
- package/lib/components/TextArea/TextArea.Skeleton.js +5 -5
- package/lib/components/TextArea/TextArea.d.ts +9 -2
- package/lib/components/TextArea/TextArea.js +30 -7
- package/lib/components/TextArea/index.js +2 -0
- package/lib/components/TextInput/TextInput.Skeleton.d.ts +33 -0
- package/lib/components/TextInput/index.js +2 -0
- package/lib/components/Tile/Tile.js +15 -8
- package/lib/components/Toggle/Toggle.js +8 -19
- package/lib/components/Tooltip/DefinitionTooltip.d.ts +52 -0
- package/lib/components/Tooltip/DefinitionTooltip.js +2 -2
- package/lib/components/Tooltip/Tooltip.d.ts +117 -0
- package/lib/components/Tooltip/Tooltip.js +6 -4
- package/lib/components/Tooltip/index.d.ts +9 -0
- package/lib/components/UIShell/HeaderMenu.js +13 -4
- package/lib/components/UIShell/HeaderMenuItem.js +17 -4
- package/lib/index.d.ts +2 -0
- package/lib/index.js +50 -46
- package/lib/internal/ClickListener.js +1 -2
- package/lib/internal/keyboard/match.js +1 -1
- package/lib/internal/useAttachedMenu.js +89 -0
- package/lib/internal/useDelayedState.d.ts +19 -0
- package/lib/internal/useDelayedState.js +7 -3
- package/lib/internal/useId.js +1 -1
- package/lib/tools/wrapComponent.js +9 -0
- package/package.json +3 -3
|
@@ -26,7 +26,7 @@ var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
|
|
|
26
26
|
var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
|
|
27
27
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
28
28
|
|
|
29
|
-
var _excluded = ["children", "className", "label", "onClose", "open", "size", "target", "x", "y"];
|
|
29
|
+
var _excluded = ["children", "className", "label", "onClose", "onOpen", "open", "size", "target", "x", "y"];
|
|
30
30
|
var spacing = 8; // distance to keep to window edges, in px
|
|
31
31
|
|
|
32
32
|
var Menu = /*#__PURE__*/React__default["default"].forwardRef(function Menu(_ref, forwardRef) {
|
|
@@ -36,6 +36,7 @@ var Menu = /*#__PURE__*/React__default["default"].forwardRef(function Menu(_ref,
|
|
|
36
36
|
className = _ref.className,
|
|
37
37
|
label = _ref.label,
|
|
38
38
|
onClose = _ref.onClose,
|
|
39
|
+
onOpen = _ref.onOpen,
|
|
39
40
|
open = _ref.open,
|
|
40
41
|
_ref$size = _ref.size,
|
|
41
42
|
size = _ref$size === void 0 ? 'sm' : _ref$size,
|
|
@@ -77,7 +78,7 @@ var Menu = /*#__PURE__*/React__default["default"].forwardRef(function Menu(_ref,
|
|
|
77
78
|
setPosition = _useState2[1];
|
|
78
79
|
|
|
79
80
|
var focusableItems = childContext.state.items.filter(function (item) {
|
|
80
|
-
return !item.disabled;
|
|
81
|
+
return !item.disabled && item.ref.current;
|
|
81
82
|
});
|
|
82
83
|
|
|
83
84
|
function returnFocus() {
|
|
@@ -89,8 +90,15 @@ var Menu = /*#__PURE__*/React__default["default"].forwardRef(function Menu(_ref,
|
|
|
89
90
|
function handleOpen() {
|
|
90
91
|
if (menu.current) {
|
|
91
92
|
focusReturn.current = document.activeElement;
|
|
92
|
-
|
|
93
|
+
var pos = calculatePosition();
|
|
94
|
+
menu.current.style.left = "".concat(pos[0], "px");
|
|
95
|
+
menu.current.style.top = "".concat(pos[1], "px");
|
|
96
|
+
setPosition(pos);
|
|
93
97
|
menu.current.focus();
|
|
98
|
+
|
|
99
|
+
if (onOpen) {
|
|
100
|
+
onOpen();
|
|
101
|
+
}
|
|
94
102
|
}
|
|
95
103
|
}
|
|
96
104
|
|
|
@@ -113,39 +121,46 @@ var Menu = /*#__PURE__*/React__default["default"].forwardRef(function Menu(_ref,
|
|
|
113
121
|
}
|
|
114
122
|
|
|
115
123
|
function handleKeyDown(e) {
|
|
116
|
-
e.stopPropagation();
|
|
117
|
-
var currentItem = focusableItems.findIndex(function (item) {
|
|
118
|
-
return item.ref.current.contains(document.activeElement);
|
|
119
|
-
});
|
|
120
|
-
var indexToFocus = currentItem; // if the user presses escape or this is a submenu
|
|
124
|
+
e.stopPropagation(); // if the user presses escape or this is a submenu
|
|
121
125
|
// and the user presses ArrowLeft, close it
|
|
122
126
|
|
|
123
127
|
if ((match.match(e, keys.Escape) || !isRoot && match.match(e, keys.ArrowLeft)) && onClose) {
|
|
124
128
|
handleClose(e);
|
|
125
129
|
} else {
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
130
|
+
focusItem(e);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
function focusItem(e) {
|
|
135
|
+
var currentItem = focusableItems.findIndex(function (item) {
|
|
136
|
+
return item.ref.current.contains(document.activeElement);
|
|
137
|
+
});
|
|
138
|
+
var indexToFocus = currentItem; // if currentItem is -1, no menu item is focused yet.
|
|
139
|
+
// in this case, the first item should receive focus.
|
|
140
|
+
|
|
141
|
+
if (currentItem === -1) {
|
|
142
|
+
indexToFocus = 0;
|
|
143
|
+
} else if (e) {
|
|
129
144
|
if (match.match(e, keys.ArrowUp)) {
|
|
130
|
-
indexToFocus =
|
|
145
|
+
indexToFocus = indexToFocus - 1;
|
|
131
146
|
}
|
|
132
147
|
|
|
133
148
|
if (match.match(e, keys.ArrowDown)) {
|
|
134
|
-
indexToFocus =
|
|
149
|
+
indexToFocus = indexToFocus + 1;
|
|
135
150
|
}
|
|
151
|
+
}
|
|
136
152
|
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
153
|
+
if (indexToFocus < 0) {
|
|
154
|
+
indexToFocus = focusableItems.length - 1;
|
|
155
|
+
}
|
|
140
156
|
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
157
|
+
if (indexToFocus >= focusableItems.length) {
|
|
158
|
+
indexToFocus = 0;
|
|
159
|
+
}
|
|
144
160
|
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
}
|
|
161
|
+
if (indexToFocus !== currentItem) {
|
|
162
|
+
var nodeToFocus = focusableItems[indexToFocus];
|
|
163
|
+
nodeToFocus.ref.current.focus();
|
|
149
164
|
}
|
|
150
165
|
}
|
|
151
166
|
|
|
@@ -207,6 +222,12 @@ var Menu = /*#__PURE__*/React__default["default"].forwardRef(function Menu(_ref,
|
|
|
207
222
|
return [-1, -1];
|
|
208
223
|
}
|
|
209
224
|
|
|
225
|
+
React.useEffect(function () {
|
|
226
|
+
if (open && focusableItems.length > 0) {
|
|
227
|
+
focusItem();
|
|
228
|
+
} // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
229
|
+
|
|
230
|
+
}, [open, focusableItems]);
|
|
210
231
|
React.useEffect(function () {
|
|
211
232
|
if (open) {
|
|
212
233
|
handleOpen();
|
|
@@ -227,12 +248,7 @@ var Menu = /*#__PURE__*/React__default["default"].forwardRef(function Menu(_ref,
|
|
|
227
248
|
"aria-label": label,
|
|
228
249
|
tabIndex: -1,
|
|
229
250
|
onKeyDown: handleKeyDown,
|
|
230
|
-
onBlur: handleBlur
|
|
231
|
-
,
|
|
232
|
-
style: {
|
|
233
|
-
left: "".concat(position[0], "px"),
|
|
234
|
-
top: "".concat(position[1], "px")
|
|
235
|
-
}
|
|
251
|
+
onBlur: handleBlur
|
|
236
252
|
}), children));
|
|
237
253
|
return isRoot ? open && /*#__PURE__*/ReactDOM.createPortal(rendered, target) || null : rendered;
|
|
238
254
|
});
|
|
@@ -257,6 +273,11 @@ Menu.propTypes = {
|
|
|
257
273
|
*/
|
|
258
274
|
onClose: PropTypes__default["default"].func,
|
|
259
275
|
|
|
276
|
+
/**
|
|
277
|
+
* Provide an optional function to be called when the Menu is opened.
|
|
278
|
+
*/
|
|
279
|
+
onOpen: PropTypes__default["default"].func,
|
|
280
|
+
|
|
260
281
|
/**
|
|
261
282
|
* Whether the Menu is open or not.
|
|
262
283
|
*/
|
|
@@ -136,6 +136,7 @@ var MenuItem = /*#__PURE__*/React__default["default"].forwardRef(function MenuIt
|
|
|
136
136
|
function handleKeyDown(e) {
|
|
137
137
|
if (hasChildren && match.match(e, keys.ArrowRight)) {
|
|
138
138
|
openSubmenu();
|
|
139
|
+
e.stopPropagation();
|
|
139
140
|
}
|
|
140
141
|
|
|
141
142
|
if (match.match(e, keys.Enter) || match.match(e, keys.Space)) {
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2016, 2023
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
'use strict';
|
|
9
|
+
|
|
10
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
11
|
+
|
|
12
|
+
var _rollupPluginBabelHelpers = require('../../_virtual/_rollupPluginBabelHelpers.js');
|
|
13
|
+
var React = require('react');
|
|
14
|
+
var PropTypes = require('prop-types');
|
|
15
|
+
var cx = require('classnames');
|
|
16
|
+
var iconsReact = require('@carbon/icons-react');
|
|
17
|
+
var Button = require('../Button/Button.js');
|
|
18
|
+
var Menu = require('../Menu/Menu.js');
|
|
19
|
+
var useAttachedMenu = require('../../internal/useAttachedMenu.js');
|
|
20
|
+
var useId = require('../../internal/useId.js');
|
|
21
|
+
var useMergedRefs = require('../../internal/useMergedRefs.js');
|
|
22
|
+
var usePrefix = require('../../internal/usePrefix.js');
|
|
23
|
+
|
|
24
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
25
|
+
|
|
26
|
+
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
27
|
+
var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
|
|
28
|
+
var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
|
|
29
|
+
|
|
30
|
+
var _excluded = ["children", "className", "disabled", "kind", "label", "size"];
|
|
31
|
+
var spacing = 4; // top and bottom spacing between the button and the menu. in px
|
|
32
|
+
|
|
33
|
+
var validButtonKinds = ['primary', 'tertiary', 'ghost'];
|
|
34
|
+
var defaultButtonKind = 'primary';
|
|
35
|
+
var MenuButton = /*#__PURE__*/React__default["default"].forwardRef(function MenuButton(_ref, forwardRef) {
|
|
36
|
+
var children = _ref.children,
|
|
37
|
+
className = _ref.className,
|
|
38
|
+
disabled = _ref.disabled,
|
|
39
|
+
_ref$kind = _ref.kind,
|
|
40
|
+
kind = _ref$kind === void 0 ? defaultButtonKind : _ref$kind,
|
|
41
|
+
label = _ref.label,
|
|
42
|
+
_ref$size = _ref.size,
|
|
43
|
+
size = _ref$size === void 0 ? 'lg' : _ref$size,
|
|
44
|
+
rest = _rollupPluginBabelHelpers.objectWithoutProperties(_ref, _excluded);
|
|
45
|
+
|
|
46
|
+
var id = useId.useId('MenuButton');
|
|
47
|
+
var prefix = usePrefix.usePrefix();
|
|
48
|
+
var triggerRef = React.useRef(null);
|
|
49
|
+
var menuRef = React.useRef(null);
|
|
50
|
+
var ref = useMergedRefs.useMergedRefs([forwardRef, triggerRef]);
|
|
51
|
+
|
|
52
|
+
var _useState = React.useState(0),
|
|
53
|
+
_useState2 = _rollupPluginBabelHelpers.slicedToArray(_useState, 2),
|
|
54
|
+
width = _useState2[0],
|
|
55
|
+
setWidth = _useState2[1];
|
|
56
|
+
|
|
57
|
+
var _useAttachedMenu = useAttachedMenu.useAttachedMenu(triggerRef),
|
|
58
|
+
open = _useAttachedMenu.open,
|
|
59
|
+
x = _useAttachedMenu.x,
|
|
60
|
+
y = _useAttachedMenu.y,
|
|
61
|
+
hookOnClick = _useAttachedMenu.handleClick,
|
|
62
|
+
handleMousedown = _useAttachedMenu.handleMousedown,
|
|
63
|
+
handleClose = _useAttachedMenu.handleClose;
|
|
64
|
+
|
|
65
|
+
function handleClick() {
|
|
66
|
+
if (triggerRef.current) {
|
|
67
|
+
var _triggerRef$current$g = triggerRef.current.getBoundingClientRect(),
|
|
68
|
+
w = _triggerRef$current$g.width;
|
|
69
|
+
|
|
70
|
+
setWidth(w);
|
|
71
|
+
hookOnClick();
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
function handleOpen() {
|
|
76
|
+
menuRef.current.style.width = "".concat(width, "px");
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
var triggerClasses = cx__default["default"]("".concat(prefix, "--menu-button__trigger"), _rollupPluginBabelHelpers.defineProperty({}, "".concat(prefix, "--menu-button__trigger--open"), open), className);
|
|
80
|
+
var buttonKind = validButtonKinds.includes(kind) ? kind : defaultButtonKind;
|
|
81
|
+
return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement(Button["default"], _rollupPluginBabelHelpers["extends"]({}, rest, {
|
|
82
|
+
ref: ref,
|
|
83
|
+
className: triggerClasses,
|
|
84
|
+
size: size,
|
|
85
|
+
kind: buttonKind,
|
|
86
|
+
renderIcon: iconsReact.ChevronDown,
|
|
87
|
+
disabled: disabled,
|
|
88
|
+
"aria-haspopup": true,
|
|
89
|
+
"aria-expanded": open,
|
|
90
|
+
onClick: handleClick,
|
|
91
|
+
onMouseDown: handleMousedown,
|
|
92
|
+
"aria-owns": open ? id : null
|
|
93
|
+
}), label), /*#__PURE__*/React__default["default"].createElement(Menu.Menu, {
|
|
94
|
+
ref: menuRef,
|
|
95
|
+
id: id,
|
|
96
|
+
label: label,
|
|
97
|
+
size: size,
|
|
98
|
+
open: open,
|
|
99
|
+
onClose: handleClose,
|
|
100
|
+
onOpen: handleOpen,
|
|
101
|
+
x: x,
|
|
102
|
+
y: [y[0] - spacing, y[1] + spacing]
|
|
103
|
+
}, children));
|
|
104
|
+
});
|
|
105
|
+
MenuButton.propTypes = {
|
|
106
|
+
/**
|
|
107
|
+
* A collection of MenuItems to be rendered as actions for this MenuButton.
|
|
108
|
+
*/
|
|
109
|
+
children: PropTypes__default["default"].node.isRequired,
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Additional CSS class names.
|
|
113
|
+
*/
|
|
114
|
+
className: PropTypes__default["default"].string,
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* Specify whether the MenuButton should be disabled, or not.
|
|
118
|
+
*/
|
|
119
|
+
disabled: PropTypes__default["default"].bool,
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* Specify the type of button to be used as the base for the trigger button.
|
|
123
|
+
*/
|
|
124
|
+
kind: PropTypes__default["default"].oneOf(validButtonKinds),
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* Provide the label to be renderd on the trigger button.
|
|
128
|
+
*/
|
|
129
|
+
label: PropTypes__default["default"].string.isRequired,
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Specify the size of the button and menu.
|
|
133
|
+
*/
|
|
134
|
+
size: PropTypes__default["default"].oneOf(['sm', 'md', 'lg'])
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
exports.MenuButton = MenuButton;
|
|
@@ -30,12 +30,13 @@ var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
|
|
|
30
30
|
|
|
31
31
|
var _Modal$propTypes;
|
|
32
32
|
|
|
33
|
-
var _excluded = ["children", "className", "modalHeading", "modalLabel", "modalAriaLabel", "passiveModal", "secondaryButtonText", "primaryButtonText", "open", "onRequestClose", "onRequestSubmit", "onSecondarySubmit", "primaryButtonDisabled", "danger", "alert", "secondaryButtons", "selectorPrimaryFocus", "selectorsFloatingMenus", "shouldSubmitOnEnter", "size", "hasScrollingContent", "closeButtonLabel", "preventCloseOnClickOutside", "isFullWidth"];
|
|
33
|
+
var _excluded = ["aria-label", "children", "className", "modalHeading", "modalLabel", "modalAriaLabel", "passiveModal", "secondaryButtonText", "primaryButtonText", "open", "onRequestClose", "onRequestSubmit", "onSecondarySubmit", "primaryButtonDisabled", "danger", "alert", "secondaryButtons", "selectorPrimaryFocus", "selectorsFloatingMenus", "shouldSubmitOnEnter", "size", "hasScrollingContent", "closeButtonLabel", "preventCloseOnClickOutside", "isFullWidth"];
|
|
34
34
|
var getInstanceId = setupGetInstanceId["default"]();
|
|
35
35
|
var Modal = /*#__PURE__*/React__default["default"].forwardRef(function Modal(_ref, ref) {
|
|
36
36
|
var _classNames, _classNames2;
|
|
37
37
|
|
|
38
|
-
var
|
|
38
|
+
var ariaLabelProp = _ref['aria-label'],
|
|
39
|
+
children = _ref.children,
|
|
39
40
|
className = _ref.className,
|
|
40
41
|
modalHeading = _ref.modalHeading,
|
|
41
42
|
modalLabel = _ref.modalLabel,
|
|
@@ -132,7 +133,7 @@ var Modal = /*#__PURE__*/React__default["default"].forwardRef(function Modal(_re
|
|
|
132
133
|
tabIndex: "-1",
|
|
133
134
|
className: "".concat(modalCloseButtonClass, "__icon")
|
|
134
135
|
}));
|
|
135
|
-
var ariaLabel = modalLabel ||
|
|
136
|
+
var ariaLabel = modalLabel || ariaLabelProp || modalAriaLabel || modalHeading;
|
|
136
137
|
var getAriaLabelledBy = modalLabel ? modalLabelId : modalHeadingId;
|
|
137
138
|
var hasScrollingContentProps = hasScrollingContent ? {
|
|
138
139
|
tabIndex: 0,
|
|
@@ -43,10 +43,12 @@ var isEqual__default = /*#__PURE__*/_interopDefaultLegacy(isEqual);
|
|
|
43
43
|
var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
|
|
44
44
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
45
45
|
|
|
46
|
+
var _objectSpread2, _FilterableMultiSelec;
|
|
46
47
|
var FilterableMultiSelect = /*#__PURE__*/React__default["default"].forwardRef(function FilterableMultiSelect(_ref, ref) {
|
|
47
48
|
var _cx, _cx2, _cx3, _cx4;
|
|
48
49
|
|
|
49
|
-
var ariaLabel = _ref
|
|
50
|
+
var ariaLabel = _ref['aria-label'],
|
|
51
|
+
deprecatedAriaLabel = _ref.ariaLabel,
|
|
50
52
|
containerClassName = _ref.className,
|
|
51
53
|
compareItems = _ref.compareItems,
|
|
52
54
|
direction = _ref.direction,
|
|
@@ -102,7 +104,7 @@ var FilterableMultiSelect = /*#__PURE__*/React__default["default"].forwardRef(fu
|
|
|
102
104
|
inputValue = _useState8[0],
|
|
103
105
|
setInputValue = _useState8[1];
|
|
104
106
|
|
|
105
|
-
var _useState9 = React.useState([]),
|
|
107
|
+
var _useState9 = React.useState(initialSelectedItems !== null && initialSelectedItems !== void 0 ? initialSelectedItems : []),
|
|
106
108
|
_useState10 = _rollupPluginBabelHelpers.slicedToArray(_useState9, 2),
|
|
107
109
|
topItems = _useState10[0],
|
|
108
110
|
setTopItems = _useState10[1];
|
|
@@ -117,6 +119,11 @@ var FilterableMultiSelect = /*#__PURE__*/React__default["default"].forwardRef(fu
|
|
|
117
119
|
highlightedIndex = _useState14[0],
|
|
118
120
|
setHighlightedIndex = _useState14[1];
|
|
119
121
|
|
|
122
|
+
var _useState15 = React.useState(initialSelectedItems !== null && initialSelectedItems !== void 0 ? initialSelectedItems : []),
|
|
123
|
+
_useState16 = _rollupPluginBabelHelpers.slicedToArray(_useState15, 2),
|
|
124
|
+
currentSelectedItems = _useState16[0],
|
|
125
|
+
setCurrentSelectedItems = _useState16[1];
|
|
126
|
+
|
|
120
127
|
var textInput = React.useRef();
|
|
121
128
|
var filterableMultiSelectInstanceId = useId.useId();
|
|
122
129
|
var enabled = index.useFeatureFlag('enable-v11-release');
|
|
@@ -129,7 +136,7 @@ var FilterableMultiSelect = /*#__PURE__*/React__default["default"].forwardRef(fu
|
|
|
129
136
|
|
|
130
137
|
var inline = type === 'inline';
|
|
131
138
|
var showWarning = !invalid && warn;
|
|
132
|
-
var wrapperClasses = cx__default["default"]("".concat(prefix, "--multi-select__wrapper"), "".concat(prefix, "--list-box__wrapper"), [enabled ? containerClassName : null], (_cx = {}, _rollupPluginBabelHelpers.defineProperty(_cx, "".concat(prefix, "--multi-select__wrapper--inline"), inline), _rollupPluginBabelHelpers.defineProperty(_cx, "".concat(prefix, "--list-box__wrapper--inline"), inline), _rollupPluginBabelHelpers.defineProperty(_cx, "".concat(prefix, "--multi-select__wrapper--inline--invalid"), inline && invalid), _rollupPluginBabelHelpers.defineProperty(_cx, "".concat(prefix, "--list-box__wrapper--inline--invalid"), inline && invalid), _rollupPluginBabelHelpers.defineProperty(_cx, "".concat(prefix, "--list-box--up"), direction === 'top'), _rollupPluginBabelHelpers.defineProperty(_cx, "".concat(prefix, "--list-box__wrapper--fluid--invalid"), isFluid && invalid), _rollupPluginBabelHelpers.defineProperty(_cx, "".concat(prefix, "--list-box__wrapper--fluid--focus"), isFluid && isFocused), _cx));
|
|
139
|
+
var wrapperClasses = cx__default["default"]("".concat(prefix, "--multi-select__wrapper"), "".concat(prefix, "--multi-select--filterable__wrapper"), "".concat(prefix, "--list-box__wrapper"), [enabled ? containerClassName : null], (_cx = {}, _rollupPluginBabelHelpers.defineProperty(_cx, "".concat(prefix, "--multi-select__wrapper--inline"), inline), _rollupPluginBabelHelpers.defineProperty(_cx, "".concat(prefix, "--list-box__wrapper--inline"), inline), _rollupPluginBabelHelpers.defineProperty(_cx, "".concat(prefix, "--multi-select__wrapper--inline--invalid"), inline && invalid), _rollupPluginBabelHelpers.defineProperty(_cx, "".concat(prefix, "--list-box__wrapper--inline--invalid"), inline && invalid), _rollupPluginBabelHelpers.defineProperty(_cx, "".concat(prefix, "--list-box--up"), direction === 'top'), _rollupPluginBabelHelpers.defineProperty(_cx, "".concat(prefix, "--list-box__wrapper--fluid--invalid"), isFluid && invalid), _rollupPluginBabelHelpers.defineProperty(_cx, "".concat(prefix, "--list-box__wrapper--fluid--focus"), isFluid && isFocused), _cx));
|
|
133
140
|
var helperId = !helperText ? undefined : "filterablemultiselect-helper-text-".concat(filterableMultiSelectInstanceId);
|
|
134
141
|
var labelId = "".concat(id, "-label");
|
|
135
142
|
var titleClasses = cx__default["default"]((_cx2 = {}, _rollupPluginBabelHelpers.defineProperty(_cx2, "".concat(prefix, "--label"), true), _rollupPluginBabelHelpers.defineProperty(_cx2, "".concat(prefix, "--label--disabled"), disabled), _rollupPluginBabelHelpers.defineProperty(_cx2, "".concat(prefix, "--visually-hidden"), hideLabel), _cx2));
|
|
@@ -141,8 +148,15 @@ var FilterableMultiSelect = /*#__PURE__*/React__default["default"].forwardRef(fu
|
|
|
141
148
|
}, helperText) : null;
|
|
142
149
|
var menuId = "".concat(id, "__menu");
|
|
143
150
|
var inputId = "".concat(id, "-input");
|
|
151
|
+
React.useEffect(function () {
|
|
152
|
+
if (!isOpen) {
|
|
153
|
+
setTopItems(currentSelectedItems);
|
|
154
|
+
}
|
|
155
|
+
}, [currentSelectedItems, isOpen, setTopItems]);
|
|
144
156
|
|
|
145
157
|
function handleOnChange(changes) {
|
|
158
|
+
setCurrentSelectedItems(changes.selectedItems);
|
|
159
|
+
|
|
146
160
|
if (onChange) {
|
|
147
161
|
onChange(changes);
|
|
148
162
|
}
|
|
@@ -161,11 +175,7 @@ var FilterableMultiSelect = /*#__PURE__*/React__default["default"].forwardRef(fu
|
|
|
161
175
|
handleOnMenuChange(false);
|
|
162
176
|
}
|
|
163
177
|
|
|
164
|
-
function handleOnStateChange(changes
|
|
165
|
-
if (changes.isOpen && !isOpen) {
|
|
166
|
-
setTopItems(downshift.selectedItem);
|
|
167
|
-
}
|
|
168
|
-
|
|
178
|
+
function handleOnStateChange(changes) {
|
|
169
179
|
var type = changes.type;
|
|
170
180
|
var stateChangeTypes = Downshift__default["default"].stateChangeTypes;
|
|
171
181
|
|
|
@@ -258,7 +268,7 @@ var FilterableMultiSelect = /*#__PURE__*/React__default["default"].forwardRef(fu
|
|
|
258
268
|
isOpen = _ref4.isOpen,
|
|
259
269
|
inputValue = _ref4.inputValue,
|
|
260
270
|
selectedItem = _ref4.selectedItem;
|
|
261
|
-
var className = cx__default["default"]("".concat(prefix, "--multi-select"), "".concat(prefix, "--combo-box"), "".concat(prefix, "--multi-select--filterable"), [enabled ? null : containerClassName], (_cx5 = {}, _rollupPluginBabelHelpers.defineProperty(_cx5, "".concat(prefix, "--multi-select--invalid"), invalid), _rollupPluginBabelHelpers.defineProperty(_cx5, "".concat(prefix, "--multi-select--open"), isOpen), _rollupPluginBabelHelpers.defineProperty(_cx5, "".concat(prefix, "--multi-select--inline"), inline), _rollupPluginBabelHelpers.defineProperty(_cx5, "".concat(prefix, "--multi-select--selected"), selectedItem.length > 0), _rollupPluginBabelHelpers.defineProperty(_cx5, "".concat(prefix, "--multi-select--filterable--input-focused"), inputFocused), _cx5));
|
|
271
|
+
var className = cx__default["default"]("".concat(prefix, "--multi-select"), "".concat(prefix, "--combo-box"), "".concat(prefix, "--multi-select--filterable"), [enabled ? null : containerClassName], (_cx5 = {}, _rollupPluginBabelHelpers.defineProperty(_cx5, "".concat(prefix, "--multi-select--invalid"), invalid), _rollupPluginBabelHelpers.defineProperty(_cx5, "".concat(prefix, "--multi-select--invalid--focused"), invalid && inputFocused), _rollupPluginBabelHelpers.defineProperty(_cx5, "".concat(prefix, "--multi-select--open"), isOpen), _rollupPluginBabelHelpers.defineProperty(_cx5, "".concat(prefix, "--multi-select--inline"), inline), _rollupPluginBabelHelpers.defineProperty(_cx5, "".concat(prefix, "--multi-select--selected"), selectedItem.length > 0), _rollupPluginBabelHelpers.defineProperty(_cx5, "".concat(prefix, "--multi-select--filterable--input-focused"), inputFocused), _cx5));
|
|
262
272
|
var rootProps = getRootProps({}, {
|
|
263
273
|
suppressRefError: true
|
|
264
274
|
});
|
|
@@ -303,6 +313,26 @@ var FilterableMultiSelect = /*#__PURE__*/React__default["default"].forwardRef(fu
|
|
|
303
313
|
event.stopPropagation();
|
|
304
314
|
}
|
|
305
315
|
|
|
316
|
+
if (match.match(event, keys.Enter)) {
|
|
317
|
+
handleOnMenuChange(true);
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
if (!disabled) {
|
|
321
|
+
if (match.match(event, keys.Delete) || match.match(event, keys.Escape)) {
|
|
322
|
+
if (isOpen) {
|
|
323
|
+
handleOnMenuChange(true);
|
|
324
|
+
clearInputValue();
|
|
325
|
+
event.stopPropagation();
|
|
326
|
+
} else if (!isOpen) {
|
|
327
|
+
clearInputValue();
|
|
328
|
+
|
|
329
|
+
_clearSelection();
|
|
330
|
+
|
|
331
|
+
event.stopPropagation();
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
|
|
306
336
|
if (match.match(event, keys.Tab)) {
|
|
307
337
|
handleOnMenuChange(false);
|
|
308
338
|
}
|
|
@@ -312,6 +342,7 @@ var FilterableMultiSelect = /*#__PURE__*/React__default["default"].forwardRef(fu
|
|
|
312
342
|
},
|
|
313
343
|
onBlur: function onBlur() {
|
|
314
344
|
setInputFocused(false);
|
|
345
|
+
setInputValue('');
|
|
315
346
|
}
|
|
316
347
|
});
|
|
317
348
|
var menuProps = getMenuProps({
|
|
@@ -333,6 +364,7 @@ var FilterableMultiSelect = /*#__PURE__*/React__default["default"].forwardRef(fu
|
|
|
333
364
|
}, titleText ? /*#__PURE__*/React__default["default"].createElement("label", _rollupPluginBabelHelpers["extends"]({
|
|
334
365
|
className: titleClasses
|
|
335
366
|
}, labelProps), titleText) : null, /*#__PURE__*/React__default["default"].createElement(index$1["default"], {
|
|
367
|
+
"aria-label": deprecatedAriaLabel || ariaLabel,
|
|
336
368
|
onFocus: isFluid ? handleFocus : null,
|
|
337
369
|
onBlur: isFluid ? handleFocus : null,
|
|
338
370
|
className: className,
|
|
@@ -423,125 +455,7 @@ var FilterableMultiSelect = /*#__PURE__*/React__default["default"].forwardRef(fu
|
|
|
423
455
|
}
|
|
424
456
|
});
|
|
425
457
|
});
|
|
426
|
-
FilterableMultiSelect.propTypes = _rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({
|
|
427
|
-
/**
|
|
428
|
-
* 'aria-label' of the ListBox component.
|
|
429
|
-
*/
|
|
430
|
-
ariaLabel: PropTypes__default["default"].string,
|
|
431
|
-
|
|
432
|
-
/**
|
|
433
|
-
* Specify the direction of the multiselect dropdown. Can be either top or bottom.
|
|
434
|
-
*/
|
|
435
|
-
direction: PropTypes__default["default"].oneOf(['top', 'bottom']),
|
|
436
|
-
|
|
437
|
-
/**
|
|
438
|
-
* Disable the control
|
|
439
|
-
*/
|
|
440
|
-
disabled: PropTypes__default["default"].bool,
|
|
441
|
-
|
|
442
|
-
/**
|
|
443
|
-
* Additional props passed to Downshift
|
|
444
|
-
*/
|
|
445
|
-
downshiftProps: PropTypes__default["default"].shape(Downshift__default["default"].propTypes),
|
|
446
|
-
|
|
447
|
-
/**
|
|
448
|
-
* Specify whether the title text should be hidden or not
|
|
449
|
-
*/
|
|
450
|
-
hideLabel: PropTypes__default["default"].bool,
|
|
451
|
-
|
|
452
|
-
/**
|
|
453
|
-
* Specify a custom `id`
|
|
454
|
-
*/
|
|
455
|
-
id: PropTypes__default["default"].string.isRequired,
|
|
456
|
-
|
|
457
|
-
/**
|
|
458
|
-
* Allow users to pass in arbitrary items from their collection that are
|
|
459
|
-
* pre-selected
|
|
460
|
-
*/
|
|
461
|
-
initialSelectedItems: PropTypes__default["default"].array,
|
|
462
|
-
|
|
463
|
-
/**
|
|
464
|
-
* Is the current selection invalid?
|
|
465
|
-
*/
|
|
466
|
-
invalid: PropTypes__default["default"].bool,
|
|
467
|
-
|
|
468
|
-
/**
|
|
469
|
-
* If invalid, what is the error?
|
|
470
|
-
*/
|
|
471
|
-
invalidText: PropTypes__default["default"].node,
|
|
472
|
-
|
|
473
|
-
/**
|
|
474
|
-
* Function to render items as custom components instead of strings.
|
|
475
|
-
* Defaults to null and is overridden by a getter
|
|
476
|
-
*/
|
|
477
|
-
itemToElement: PropTypes__default["default"].func,
|
|
478
|
-
|
|
479
|
-
/**
|
|
480
|
-
* Helper function passed to downshift that allows the library to render a
|
|
481
|
-
* given item to a string label. By default, it extracts the `label` field
|
|
482
|
-
* from a given item to serve as the item label in the list.
|
|
483
|
-
*/
|
|
484
|
-
itemToString: PropTypes__default["default"].func,
|
|
485
|
-
|
|
486
|
-
/**
|
|
487
|
-
* We try to stay as generic as possible here to allow individuals to pass
|
|
488
|
-
* in a collection of whatever kind of data structure they prefer
|
|
489
|
-
*/
|
|
490
|
-
items: PropTypes__default["default"].array.isRequired,
|
|
491
|
-
|
|
492
|
-
/**
|
|
493
|
-
* `true` to use the light version.
|
|
494
|
-
*/
|
|
495
|
-
light: deprecate["default"](PropTypes__default["default"].bool, 'The `light` prop for `FilterableMultiSelect` has ' + 'been deprecated in favor of the new `Layer` component. It will be removed in the next major release.'),
|
|
496
|
-
|
|
497
|
-
/**
|
|
498
|
-
* Specify the locale of the control. Used for the default `compareItems`
|
|
499
|
-
* used for sorting the list of items in the control.
|
|
500
|
-
*/
|
|
501
|
-
locale: PropTypes__default["default"].string,
|
|
502
|
-
|
|
503
|
-
/**
|
|
504
|
-
* `onChange` is a utility for this controlled component to communicate to a
|
|
505
|
-
* consuming component what kind of internal state changes are occurring.
|
|
506
|
-
*/
|
|
507
|
-
onChange: PropTypes__default["default"].func,
|
|
508
|
-
|
|
509
|
-
/**
|
|
510
|
-
* `onInputValueChange` is a utility for this controlled component to communicate to
|
|
511
|
-
* the currently typed input.
|
|
512
|
-
*/
|
|
513
|
-
onInputValueChange: PropTypes__default["default"].func,
|
|
514
|
-
|
|
515
|
-
/**
|
|
516
|
-
* `onMenuChange` is a utility for this controlled component to communicate to a
|
|
517
|
-
* consuming component that the menu was opened(`true`)/closed(`false`).
|
|
518
|
-
*/
|
|
519
|
-
onMenuChange: PropTypes__default["default"].func,
|
|
520
|
-
|
|
521
|
-
/**
|
|
522
|
-
* Initialize the component with an open(`true`)/closed(`false`) menu.
|
|
523
|
-
*/
|
|
524
|
-
open: PropTypes__default["default"].bool,
|
|
525
|
-
|
|
526
|
-
/**
|
|
527
|
-
* Generic `placeholder` that will be used as the textual representation of
|
|
528
|
-
* what this field is for
|
|
529
|
-
*/
|
|
530
|
-
placeholder: PropTypes__default["default"].string,
|
|
531
|
-
|
|
532
|
-
/**
|
|
533
|
-
* Specify feedback (mode) of the selection.
|
|
534
|
-
* `top`: selected item jumps to top
|
|
535
|
-
* `fixed`: selected item stays at it's position
|
|
536
|
-
* `top-after-reopen`: selected item jump to top after reopen dropdown
|
|
537
|
-
*/
|
|
538
|
-
selectionFeedback: PropTypes__default["default"].oneOf(['top', 'fixed', 'top-after-reopen']),
|
|
539
|
-
|
|
540
|
-
/**
|
|
541
|
-
* Specify the size of the ListBox. Currently supports either `sm`, `md` or `lg` as an option.
|
|
542
|
-
*/
|
|
543
|
-
size: ListBoxPropTypes.ListBoxSize
|
|
544
|
-
}, MultiSelectPropTypes.sortingPropTypes), {}, {
|
|
458
|
+
FilterableMultiSelect.propTypes = _rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2((_objectSpread2 = {}, _rollupPluginBabelHelpers.defineProperty(_objectSpread2, 'aria-label', PropTypes__default["default"].string), _rollupPluginBabelHelpers.defineProperty(_objectSpread2, "ariaLabel", deprecate["default"](PropTypes__default["default"].string, 'This prop syntax has been deprecated. Please use the new `aria-label`.')), _rollupPluginBabelHelpers.defineProperty(_objectSpread2, "direction", PropTypes__default["default"].oneOf(['top', 'bottom'])), _rollupPluginBabelHelpers.defineProperty(_objectSpread2, "disabled", PropTypes__default["default"].bool), _rollupPluginBabelHelpers.defineProperty(_objectSpread2, "downshiftProps", PropTypes__default["default"].shape(Downshift__default["default"].propTypes)), _rollupPluginBabelHelpers.defineProperty(_objectSpread2, "hideLabel", PropTypes__default["default"].bool), _rollupPluginBabelHelpers.defineProperty(_objectSpread2, "id", PropTypes__default["default"].string.isRequired), _rollupPluginBabelHelpers.defineProperty(_objectSpread2, "initialSelectedItems", PropTypes__default["default"].array), _rollupPluginBabelHelpers.defineProperty(_objectSpread2, "invalid", PropTypes__default["default"].bool), _rollupPluginBabelHelpers.defineProperty(_objectSpread2, "invalidText", PropTypes__default["default"].node), _rollupPluginBabelHelpers.defineProperty(_objectSpread2, "itemToElement", PropTypes__default["default"].func), _rollupPluginBabelHelpers.defineProperty(_objectSpread2, "itemToString", PropTypes__default["default"].func), _rollupPluginBabelHelpers.defineProperty(_objectSpread2, "items", PropTypes__default["default"].array.isRequired), _rollupPluginBabelHelpers.defineProperty(_objectSpread2, "light", deprecate["default"](PropTypes__default["default"].bool, 'The `light` prop for `FilterableMultiSelect` has ' + 'been deprecated in favor of the new `Layer` component. It will be removed in the next major release.')), _rollupPluginBabelHelpers.defineProperty(_objectSpread2, "locale", PropTypes__default["default"].string), _rollupPluginBabelHelpers.defineProperty(_objectSpread2, "onChange", PropTypes__default["default"].func), _rollupPluginBabelHelpers.defineProperty(_objectSpread2, "onInputValueChange", PropTypes__default["default"].func), _rollupPluginBabelHelpers.defineProperty(_objectSpread2, "onMenuChange", PropTypes__default["default"].func), _rollupPluginBabelHelpers.defineProperty(_objectSpread2, "open", PropTypes__default["default"].bool), _rollupPluginBabelHelpers.defineProperty(_objectSpread2, "placeholder", PropTypes__default["default"].string), _rollupPluginBabelHelpers.defineProperty(_objectSpread2, "selectionFeedback", PropTypes__default["default"].oneOf(['top', 'fixed', 'top-after-reopen'])), _rollupPluginBabelHelpers.defineProperty(_objectSpread2, "size", ListBoxPropTypes.ListBoxSize), _objectSpread2), MultiSelectPropTypes.sortingPropTypes), {}, {
|
|
545
459
|
/**
|
|
546
460
|
* Callback function for translating ListBoxMenuIcon SVG title
|
|
547
461
|
*/
|
|
@@ -562,19 +476,7 @@ FilterableMultiSelect.propTypes = _rollupPluginBabelHelpers.objectSpread2(_rollu
|
|
|
562
476
|
*/
|
|
563
477
|
warnText: PropTypes__default["default"].node
|
|
564
478
|
});
|
|
565
|
-
FilterableMultiSelect.defaultProps = {
|
|
566
|
-
ariaLabel: 'Choose an item',
|
|
567
|
-
compareItems: sorting.defaultCompareItems,
|
|
568
|
-
direction: 'bottom',
|
|
569
|
-
disabled: false,
|
|
570
|
-
filterItems: filter.defaultFilterItems,
|
|
571
|
-
initialSelectedItems: [],
|
|
572
|
-
itemToString: itemToString.defaultItemToString,
|
|
573
|
-
locale: 'en',
|
|
574
|
-
sortItems: sorting.defaultSortItems,
|
|
575
|
-
open: false,
|
|
576
|
-
selectionFeedback: 'top-after-reopen'
|
|
577
|
-
};
|
|
479
|
+
FilterableMultiSelect.defaultProps = (_FilterableMultiSelec = {}, _rollupPluginBabelHelpers.defineProperty(_FilterableMultiSelec, 'aria-label', 'Choose an item'), _rollupPluginBabelHelpers.defineProperty(_FilterableMultiSelec, "compareItems", sorting.defaultCompareItems), _rollupPluginBabelHelpers.defineProperty(_FilterableMultiSelec, "direction", 'bottom'), _rollupPluginBabelHelpers.defineProperty(_FilterableMultiSelec, "disabled", false), _rollupPluginBabelHelpers.defineProperty(_FilterableMultiSelec, "filterItems", filter.defaultFilterItems), _rollupPluginBabelHelpers.defineProperty(_FilterableMultiSelec, "initialSelectedItems", []), _rollupPluginBabelHelpers.defineProperty(_FilterableMultiSelec, "itemToString", itemToString.defaultItemToString), _rollupPluginBabelHelpers.defineProperty(_FilterableMultiSelec, "locale", 'en'), _rollupPluginBabelHelpers.defineProperty(_FilterableMultiSelec, "sortItems", sorting.defaultSortItems), _rollupPluginBabelHelpers.defineProperty(_FilterableMultiSelec, "open", false), _rollupPluginBabelHelpers.defineProperty(_FilterableMultiSelec, "selectionFeedback", 'top-after-reopen'), _FilterableMultiSelec);
|
|
578
480
|
var FilterableMultiSelect$1 = FilterableMultiSelect;
|
|
579
481
|
|
|
580
482
|
exports["default"] = FilterableMultiSelect$1;
|
|
@@ -114,7 +114,7 @@ export interface MultiSelectProps<ItemType> extends MultiSelectSortingProps<Item
|
|
|
114
114
|
onChange?(data: OnChangeData<ItemType>): void;
|
|
115
115
|
/**
|
|
116
116
|
* `onMenuChange` is a utility for this controlled component to communicate to a
|
|
117
|
-
* consuming component that the menu was
|
|
117
|
+
* consuming component that the menu was open(`true`)/closed(`false`).
|
|
118
118
|
*/
|
|
119
119
|
onMenuChange?(open: boolean): void;
|
|
120
120
|
/**
|