@carbon/react 1.24.0-rc.0 → 1.25.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/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/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 +21 -0
- package/es/components/DataTable/TableToolbarMenu.d.ts +24 -0
- package/es/components/DataTable/TableToolbarMenu.js +3 -3
- 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/FileUploader/FileUploader.js +1 -1
- 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/ListBox/ListBoxMenuItem.d.ts +2 -2
- package/es/components/ListBox/ListBoxSelection.js +4 -23
- package/es/components/ListBox/next/ListBoxSelection.js +2 -23
- package/es/components/Menu/Menu.js +50 -33
- package/es/components/Menu/MenuContext.js +3 -6
- 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 +31 -137
- package/es/components/MultiSelect/MultiSelect.d.ts +1 -1
- package/es/components/MultiSelect/MultiSelect.js +48 -26
- package/es/components/Notification/Notification.js +27 -264
- 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 +55 -0
- package/es/components/Popover/index.js +61 -29
- package/es/components/RadioButtonGroup/RadioButtonGroup.js +7 -4
- package/es/components/RadioTile/RadioTile.js +6 -6
- 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/Slider/Slider.Skeleton.d.ts +2 -2
- package/es/components/Slider/Slider.d.ts +355 -0
- package/es/components/Slider/Slider.js +63 -35
- package/es/components/StructuredList/StructuredList.js +10 -38
- package/es/components/Tabs/Tabs.js +3 -1
- 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.d.ts +106 -0
- package/es/components/TextInput/TextInput.js +3 -2
- 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/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/internal/useMergedRefs.d.ts +13 -0
- package/es/internal/useMergedRefs.js +2 -5
- package/es/internal/useNormalizedInputProps.js +1 -0
- 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/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 +21 -0
- package/lib/components/DataTable/TableToolbarMenu.d.ts +24 -0
- package/lib/components/DataTable/TableToolbarMenu.js +3 -3
- 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/FileUploader/FileUploader.js +1 -1
- 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/ListBox/ListBoxMenuItem.d.ts +2 -2
- package/lib/components/ListBox/ListBoxSelection.js +4 -23
- package/lib/components/ListBox/next/ListBoxSelection.js +2 -23
- package/lib/components/Menu/Menu.js +50 -33
- package/lib/components/Menu/MenuContext.js +3 -6
- 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 +29 -135
- package/lib/components/MultiSelect/MultiSelect.d.ts +1 -1
- package/lib/components/MultiSelect/MultiSelect.js +47 -25
- package/lib/components/Notification/Notification.js +27 -264
- 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 +55 -0
- package/lib/components/Popover/index.js +61 -29
- package/lib/components/RadioButtonGroup/RadioButtonGroup.js +6 -3
- package/lib/components/RadioTile/RadioTile.js +6 -6
- 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/Slider/Slider.Skeleton.d.ts +2 -2
- package/lib/components/Slider/Slider.d.ts +355 -0
- package/lib/components/Slider/Slider.js +62 -34
- package/lib/components/StructuredList/StructuredList.js +10 -38
- package/lib/components/Tabs/Tabs.js +3 -1
- 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.d.ts +106 -0
- package/lib/components/TextInput/TextInput.js +3 -2
- 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/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/internal/useMergedRefs.d.ts +13 -0
- package/lib/internal/useMergedRefs.js +2 -5
- package/lib/internal/useNormalizedInputProps.js +1 -0
- package/package.json +10 -10
|
@@ -15,8 +15,6 @@ var React = require('react');
|
|
|
15
15
|
var PropTypes = require('prop-types');
|
|
16
16
|
var iconsReact = require('@carbon/icons-react');
|
|
17
17
|
var usePrefix = require('../../../internal/usePrefix.js');
|
|
18
|
-
var match = require('../../../internal/keyboard/match.js');
|
|
19
|
-
var keys = require('../../../internal/keyboard/keys.js');
|
|
20
18
|
|
|
21
19
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
22
20
|
|
|
@@ -62,23 +60,6 @@ function ListBoxSelection(_ref) {
|
|
|
62
60
|
}
|
|
63
61
|
}
|
|
64
62
|
|
|
65
|
-
function onKeyDown(event) {
|
|
66
|
-
event.stopPropagation();
|
|
67
|
-
|
|
68
|
-
if (disabled) {
|
|
69
|
-
return;
|
|
70
|
-
} // When a user hits ENTER, we'll clear the selection
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
if (match.match(event, keys.Enter)) {
|
|
74
|
-
clearSelection(event);
|
|
75
|
-
|
|
76
|
-
if (onClearSelection) {
|
|
77
|
-
onClearSelection(event);
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
|
|
82
63
|
if (selectionCount) {
|
|
83
64
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
84
65
|
className: tagClasses
|
|
@@ -90,8 +71,7 @@ function ListBoxSelection(_ref) {
|
|
|
90
71
|
className: "".concat(prefix, "--tag__close-icon"),
|
|
91
72
|
disabled: disabled,
|
|
92
73
|
onClick: onClick,
|
|
93
|
-
|
|
94
|
-
tabIndex: disabled ? -1 : 0,
|
|
74
|
+
tabIndex: -1,
|
|
95
75
|
title: description,
|
|
96
76
|
type: "button"
|
|
97
77
|
}, _Close || (_Close = /*#__PURE__*/React__default["default"].createElement(iconsReact.Close, null))));
|
|
@@ -102,8 +82,7 @@ function ListBoxSelection(_ref) {
|
|
|
102
82
|
className: className,
|
|
103
83
|
disabled: disabled,
|
|
104
84
|
onClick: onClick,
|
|
105
|
-
|
|
106
|
-
tabIndex: disabled ? -1 : 0,
|
|
85
|
+
tabIndex: -1,
|
|
107
86
|
title: description,
|
|
108
87
|
type: "button"
|
|
109
88
|
}), _Close2 || (_Close2 = /*#__PURE__*/React__default["default"].createElement(iconsReact.Close, null)));
|
|
@@ -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
|
|
|
@@ -107,49 +115,52 @@ var Menu = /*#__PURE__*/React__default["default"].forwardRef(function Menu(_ref,
|
|
|
107
115
|
returnFocus();
|
|
108
116
|
}
|
|
109
117
|
|
|
110
|
-
childDispatch({
|
|
111
|
-
type: 'clearRegisteredItems'
|
|
112
|
-
});
|
|
113
|
-
|
|
114
118
|
if (onClose) {
|
|
115
119
|
onClose();
|
|
116
120
|
}
|
|
117
121
|
}
|
|
118
122
|
|
|
119
123
|
function handleKeyDown(e) {
|
|
120
|
-
e.stopPropagation();
|
|
121
|
-
var currentItem = focusableItems.findIndex(function (item) {
|
|
122
|
-
return item.ref.current.contains(document.activeElement);
|
|
123
|
-
});
|
|
124
|
-
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
|
|
125
125
|
// and the user presses ArrowLeft, close it
|
|
126
126
|
|
|
127
127
|
if ((match.match(e, keys.Escape) || !isRoot && match.match(e, keys.ArrowLeft)) && onClose) {
|
|
128
128
|
handleClose(e);
|
|
129
129
|
} else {
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
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) {
|
|
133
144
|
if (match.match(e, keys.ArrowUp)) {
|
|
134
|
-
indexToFocus =
|
|
145
|
+
indexToFocus = indexToFocus - 1;
|
|
135
146
|
}
|
|
136
147
|
|
|
137
148
|
if (match.match(e, keys.ArrowDown)) {
|
|
138
|
-
indexToFocus =
|
|
149
|
+
indexToFocus = indexToFocus + 1;
|
|
139
150
|
}
|
|
151
|
+
}
|
|
140
152
|
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
153
|
+
if (indexToFocus < 0) {
|
|
154
|
+
indexToFocus = focusableItems.length - 1;
|
|
155
|
+
}
|
|
144
156
|
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
157
|
+
if (indexToFocus >= focusableItems.length) {
|
|
158
|
+
indexToFocus = 0;
|
|
159
|
+
}
|
|
148
160
|
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
}
|
|
161
|
+
if (indexToFocus !== currentItem) {
|
|
162
|
+
var nodeToFocus = focusableItems[indexToFocus];
|
|
163
|
+
nodeToFocus.ref.current.focus();
|
|
153
164
|
}
|
|
154
165
|
}
|
|
155
166
|
|
|
@@ -211,6 +222,12 @@ var Menu = /*#__PURE__*/React__default["default"].forwardRef(function Menu(_ref,
|
|
|
211
222
|
return [-1, -1];
|
|
212
223
|
}
|
|
213
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]);
|
|
214
231
|
React.useEffect(function () {
|
|
215
232
|
if (open) {
|
|
216
233
|
handleOpen();
|
|
@@ -231,12 +248,7 @@ var Menu = /*#__PURE__*/React__default["default"].forwardRef(function Menu(_ref,
|
|
|
231
248
|
"aria-label": label,
|
|
232
249
|
tabIndex: -1,
|
|
233
250
|
onKeyDown: handleKeyDown,
|
|
234
|
-
onBlur: handleBlur
|
|
235
|
-
,
|
|
236
|
-
style: {
|
|
237
|
-
left: "".concat(position[0], "px"),
|
|
238
|
-
top: "".concat(position[1], "px")
|
|
239
|
-
}
|
|
251
|
+
onBlur: handleBlur
|
|
240
252
|
}), children));
|
|
241
253
|
return isRoot ? open && /*#__PURE__*/ReactDOM.createPortal(rendered, target) || null : rendered;
|
|
242
254
|
});
|
|
@@ -261,6 +273,11 @@ Menu.propTypes = {
|
|
|
261
273
|
*/
|
|
262
274
|
onClose: PropTypes__default["default"].func,
|
|
263
275
|
|
|
276
|
+
/**
|
|
277
|
+
* Provide an optional function to be called when the Menu is opened.
|
|
278
|
+
*/
|
|
279
|
+
onOpen: PropTypes__default["default"].func,
|
|
280
|
+
|
|
264
281
|
/**
|
|
265
282
|
* Whether the Menu is open or not.
|
|
266
283
|
*/
|
|
@@ -33,12 +33,9 @@ function menuReducer(state, action) {
|
|
|
33
33
|
|
|
34
34
|
case 'registerItem':
|
|
35
35
|
return _rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, state), {}, {
|
|
36
|
-
items: [].concat(_rollupPluginBabelHelpers.toConsumableArray(state.items), [action.payload])
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
case 'clearRegisteredItems':
|
|
40
|
-
return _rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, state), {}, {
|
|
41
|
-
items: []
|
|
36
|
+
items: [].concat(_rollupPluginBabelHelpers.toConsumableArray(state.items), [action.payload]).filter(function (item) {
|
|
37
|
+
return item.ref.current !== null;
|
|
38
|
+
})
|
|
42
39
|
});
|
|
43
40
|
}
|
|
44
41
|
}
|
|
@@ -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,
|
|
@@ -129,7 +131,7 @@ var FilterableMultiSelect = /*#__PURE__*/React__default["default"].forwardRef(fu
|
|
|
129
131
|
|
|
130
132
|
var inline = type === 'inline';
|
|
131
133
|
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));
|
|
134
|
+
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
135
|
var helperId = !helperText ? undefined : "filterablemultiselect-helper-text-".concat(filterableMultiSelectInstanceId);
|
|
134
136
|
var labelId = "".concat(id, "-label");
|
|
135
137
|
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));
|
|
@@ -258,7 +260,7 @@ var FilterableMultiSelect = /*#__PURE__*/React__default["default"].forwardRef(fu
|
|
|
258
260
|
isOpen = _ref4.isOpen,
|
|
259
261
|
inputValue = _ref4.inputValue,
|
|
260
262
|
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));
|
|
263
|
+
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
264
|
var rootProps = getRootProps({}, {
|
|
263
265
|
suppressRefError: true
|
|
264
266
|
});
|
|
@@ -303,6 +305,26 @@ var FilterableMultiSelect = /*#__PURE__*/React__default["default"].forwardRef(fu
|
|
|
303
305
|
event.stopPropagation();
|
|
304
306
|
}
|
|
305
307
|
|
|
308
|
+
if (match.match(event, keys.Enter)) {
|
|
309
|
+
handleOnMenuChange(true);
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
if (!disabled) {
|
|
313
|
+
if (match.match(event, keys.Delete) || match.match(event, keys.Escape)) {
|
|
314
|
+
if (isOpen) {
|
|
315
|
+
handleOnMenuChange(true);
|
|
316
|
+
clearInputValue();
|
|
317
|
+
event.stopPropagation();
|
|
318
|
+
} else if (!isOpen) {
|
|
319
|
+
clearInputValue();
|
|
320
|
+
|
|
321
|
+
_clearSelection();
|
|
322
|
+
|
|
323
|
+
event.stopPropagation();
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
|
|
306
328
|
if (match.match(event, keys.Tab)) {
|
|
307
329
|
handleOnMenuChange(false);
|
|
308
330
|
}
|
|
@@ -312,6 +334,7 @@ var FilterableMultiSelect = /*#__PURE__*/React__default["default"].forwardRef(fu
|
|
|
312
334
|
},
|
|
313
335
|
onBlur: function onBlur() {
|
|
314
336
|
setInputFocused(false);
|
|
337
|
+
setInputValue('');
|
|
315
338
|
}
|
|
316
339
|
});
|
|
317
340
|
var menuProps = getMenuProps({
|
|
@@ -333,6 +356,7 @@ var FilterableMultiSelect = /*#__PURE__*/React__default["default"].forwardRef(fu
|
|
|
333
356
|
}, titleText ? /*#__PURE__*/React__default["default"].createElement("label", _rollupPluginBabelHelpers["extends"]({
|
|
334
357
|
className: titleClasses
|
|
335
358
|
}, labelProps), titleText) : null, /*#__PURE__*/React__default["default"].createElement(index$1["default"], {
|
|
359
|
+
"aria-label": deprecatedAriaLabel || ariaLabel,
|
|
336
360
|
onFocus: isFluid ? handleFocus : null,
|
|
337
361
|
onBlur: isFluid ? handleFocus : null,
|
|
338
362
|
className: className,
|
|
@@ -423,125 +447,7 @@ var FilterableMultiSelect = /*#__PURE__*/React__default["default"].forwardRef(fu
|
|
|
423
447
|
}
|
|
424
448
|
});
|
|
425
449
|
});
|
|
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), {}, {
|
|
450
|
+
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
451
|
/**
|
|
546
452
|
* Callback function for translating ListBoxMenuIcon SVG title
|
|
547
453
|
*/
|
|
@@ -562,19 +468,7 @@ FilterableMultiSelect.propTypes = _rollupPluginBabelHelpers.objectSpread2(_rollu
|
|
|
562
468
|
*/
|
|
563
469
|
warnText: PropTypes__default["default"].node
|
|
564
470
|
});
|
|
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
|
-
};
|
|
471
|
+
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
472
|
var FilterableMultiSelect$1 = FilterableMultiSelect;
|
|
579
473
|
|
|
580
474
|
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
|
/**
|