@carbon/react 1.7.0 → 1.9.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.
Files changed (87) hide show
  1. package/es/components/ComposedModal/ComposedModal.js +1 -1
  2. package/es/components/ComposedModal/index.js +4 -4
  3. package/es/components/ComposedModal/next/ComposedModal.js +1 -1
  4. package/es/components/DataTable/DataTable.js +1 -1
  5. package/es/components/DataTable/Table.js +10 -2
  6. package/es/components/DataTable/TableContainer.js +20 -5
  7. package/es/components/DataTable/TableContext.js +15 -0
  8. package/es/components/DataTable/TableSelectRow.js +1 -1
  9. package/es/components/FileUploader/FileUploader.js +8 -1
  10. package/es/components/FileUploader/FileUploaderButton.js +3 -1
  11. package/es/components/FileUploader/FileUploaderDropContainer.js +3 -1
  12. package/es/components/FileUploader/FileUploaderItem.js +3 -1
  13. package/es/components/InlineLoading/InlineLoading.js +9 -5
  14. package/es/components/Loading/Loading.js +7 -18
  15. package/es/components/Menu/Menu.js +1 -1
  16. package/es/components/Modal/Modal.js +204 -273
  17. package/es/components/Modal/index.js +2 -8
  18. package/es/components/ModalWrapper/ModalWrapper.js +1 -1
  19. package/es/components/MultiSelect/FilterableMultiSelect.js +345 -386
  20. package/es/components/MultiSelect/index.js +4 -8
  21. package/es/components/Notification/Notification.js +322 -189
  22. package/es/components/NumberInput/NumberInput.Skeleton.js +3 -4
  23. package/es/components/NumberInput/NumberInput.js +308 -359
  24. package/es/components/RadioButton/RadioButton.js +58 -99
  25. package/es/components/RadioButton/index.js +2 -8
  26. package/es/components/RadioButtonGroup/RadioButtonGroup.js +72 -121
  27. package/es/components/RadioButtonGroup/index.js +2 -8
  28. package/es/components/Slider/Slider.js +2 -1
  29. package/es/components/Switch/Switch.js +0 -1
  30. package/es/components/TreeView/TreeView.js +19 -11
  31. package/es/components/UIShell/HeaderMenu.js +1 -1
  32. package/es/components/UIShell/HeaderMenuButton.js +4 -0
  33. package/es/components/UIShell/SideNavLink.js +6 -9
  34. package/es/index.js +10 -9
  35. package/es/internal/createClassWrapper.js +2 -5
  36. package/lib/components/ComposedModal/index.js +7 -7
  37. package/lib/components/ComposedModal/next/ComposedModal.js +1 -1
  38. package/lib/components/DataTable/DataTable.js +5 -5
  39. package/lib/components/DataTable/Table.js +9 -1
  40. package/lib/components/DataTable/TableContainer.js +19 -4
  41. package/lib/components/DataTable/TableContext.js +19 -0
  42. package/lib/components/DataTable/TableSelectRow.js +2 -2
  43. package/lib/components/FileUploader/FileUploader.js +8 -1
  44. package/lib/components/FileUploader/FileUploaderButton.js +3 -1
  45. package/lib/components/FileUploader/FileUploaderDropContainer.js +3 -1
  46. package/lib/components/FileUploader/FileUploaderItem.js +3 -1
  47. package/lib/components/InlineLoading/InlineLoading.js +9 -5
  48. package/lib/components/Loading/Loading.js +6 -17
  49. package/lib/components/Menu/Menu.js +1 -1
  50. package/lib/components/Modal/Modal.js +201 -270
  51. package/lib/components/Modal/index.js +2 -25
  52. package/lib/components/ModalWrapper/ModalWrapper.js +2 -2
  53. package/lib/components/MultiSelect/FilterableMultiSelect.js +341 -382
  54. package/lib/components/MultiSelect/index.js +5 -28
  55. package/lib/components/Notification/Notification.js +321 -188
  56. package/lib/components/NumberInput/NumberInput.Skeleton.js +3 -4
  57. package/lib/components/NumberInput/NumberInput.js +305 -376
  58. package/lib/components/RadioButton/RadioButton.js +57 -99
  59. package/lib/components/RadioButton/index.js +2 -25
  60. package/lib/components/RadioButtonGroup/RadioButtonGroup.js +68 -117
  61. package/lib/components/RadioButtonGroup/index.js +2 -25
  62. package/lib/components/Slider/Slider.js +2 -1
  63. package/lib/components/Switch/Switch.js +0 -1
  64. package/lib/components/TreeView/TreeView.js +18 -10
  65. package/lib/components/UIShell/HeaderMenu.js +1 -0
  66. package/lib/components/UIShell/HeaderMenuButton.js +4 -0
  67. package/lib/components/UIShell/SideNavLink.js +6 -9
  68. package/lib/index.js +95 -95
  69. package/lib/internal/createClassWrapper.js +2 -5
  70. package/package.json +7 -7
  71. package/scss/utilities/_hide-at-breakpoint.scss +9 -0
  72. package/es/components/Modal/next/Modal.js +0 -274
  73. package/es/components/MultiSelect/next/FilterableMultiSelect.js +0 -544
  74. package/es/components/Notification/index.js +0 -42
  75. package/es/components/Notification/next/Notification.js +0 -663
  76. package/es/components/RadioButton/next/RadioButton.js +0 -130
  77. package/es/components/RadioButtonGroup/next/RadioButtonGroup.js +0 -141
  78. package/es/internal/FeatureFlags.js +0 -52
  79. package/es/prop-types/requiredIfValueExists.js +0 -32
  80. package/lib/components/Modal/next/Modal.js +0 -284
  81. package/lib/components/MultiSelect/next/FilterableMultiSelect.js +0 -556
  82. package/lib/components/Notification/index.js +0 -51
  83. package/lib/components/Notification/next/Notification.js +0 -677
  84. package/lib/components/RadioButton/next/RadioButton.js +0 -140
  85. package/lib/components/RadioButtonGroup/next/RadioButtonGroup.js +0 -151
  86. package/lib/internal/FeatureFlags.js +0 -56
  87. package/lib/prop-types/requiredIfValueExists.js +0 -36
@@ -1,544 +0,0 @@
1
- /**
2
- * Copyright IBM Corp. 2016, 2022
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
- import { slicedToArray as _slicedToArray, defineProperty as _defineProperty, extends as _extends, objectSpread2 as _objectSpread2 } from '../../../_virtual/_rollupPluginBabelHelpers.js';
9
- import { WarningFilled, WarningAltFilled } from '@carbon/icons-react';
10
- import cx from 'classnames';
11
- import Downshift from 'downshift';
12
- import isEqual from 'lodash.isequal';
13
- import PropTypes from 'prop-types';
14
- import React__default, { useState, useRef } from 'react';
15
- import { defaultFilterItems } from '../../ComboBox/tools/filter.js';
16
- import { sortingPropTypes } from '../MultiSelectPropTypes.js';
17
- import '../../ListBox/index.js';
18
- import Selection from '../../../internal/Selection.js';
19
- import { defaultItemToString } from '../tools/itemToString.js';
20
- import mergeRefs from '../../../tools/mergeRefs.js';
21
- import { useId } from '../../../internal/useId.js';
22
- import { defaultCompareItems, defaultSortItems } from '../tools/sorting.js';
23
- import { useFeatureFlag } from '../../FeatureFlags/index.js';
24
- import { usePrefix } from '../../../internal/usePrefix.js';
25
- import { match } from '../../../internal/keyboard/match.js';
26
- import ListBoxSelection from '../../ListBox/next/ListBoxSelection.js';
27
- import ListBoxTrigger from '../../ListBox/next/ListBoxTrigger.js';
28
- import ListBox from '../../ListBox/ListBox.js';
29
- import { ListBoxSize } from '../../ListBox/ListBoxPropTypes.js';
30
- import { Space } from '../../../internal/keyboard/keys.js';
31
-
32
- var FilterableMultiSelect = /*#__PURE__*/React__default.forwardRef(function FilterableMultiSelect(_ref, ref) {
33
- var _cx, _cx2, _cx3, _cx4;
34
-
35
- var ariaLabel = _ref.ariaLabel,
36
- containerClassName = _ref.className,
37
- compareItems = _ref.compareItems,
38
- direction = _ref.direction,
39
- disabled = _ref.disabled,
40
- downshiftProps = _ref.downshiftProps,
41
- filterItems = _ref.filterItems,
42
- helperText = _ref.helperText,
43
- hideLabel = _ref.hideLabel,
44
- id = _ref.id,
45
- initialSelectedItems = _ref.initialSelectedItems,
46
- invalid = _ref.invalid,
47
- invalidText = _ref.invalidText,
48
- items = _ref.items,
49
- ItemToElement = _ref.itemToElement,
50
- itemToString = _ref.itemToString,
51
- light = _ref.light,
52
- locale = _ref.locale,
53
- onInputValueChange = _ref.onInputValueChange,
54
- open = _ref.open,
55
- onChange = _ref.onChange,
56
- onMenuChange = _ref.onMenuChange,
57
- placeholder = _ref.placeholder,
58
- titleText = _ref.titleText,
59
- type = _ref.type,
60
- selectionFeedback = _ref.selectionFeedback,
61
- size = _ref.size,
62
- sortItems = _ref.sortItems,
63
- translateWithId = _ref.translateWithId,
64
- useTitleInItem = _ref.useTitleInItem,
65
- warn = _ref.warn,
66
- warnText = _ref.warnText;
67
-
68
- var _useState = useState(open),
69
- _useState2 = _slicedToArray(_useState, 2),
70
- isOpen = _useState2[0],
71
- setIsOpen = _useState2[1];
72
-
73
- var _useState3 = useState(open),
74
- _useState4 = _slicedToArray(_useState3, 2),
75
- prevOpen = _useState4[0],
76
- setPrevOpen = _useState4[1];
77
-
78
- var _useState5 = useState(''),
79
- _useState6 = _slicedToArray(_useState5, 2),
80
- inputValue = _useState6[0],
81
- setInputValue = _useState6[1];
82
-
83
- var _useState7 = useState([]),
84
- _useState8 = _slicedToArray(_useState7, 2),
85
- topItems = _useState8[0],
86
- setTopItems = _useState8[1];
87
-
88
- var _useState9 = useState(false),
89
- _useState10 = _slicedToArray(_useState9, 2),
90
- inputFocused = _useState10[0],
91
- setInputFocused = _useState10[1];
92
-
93
- var _useState11 = useState(null),
94
- _useState12 = _slicedToArray(_useState11, 2),
95
- highlightedIndex = _useState12[0],
96
- setHighlightedIndex = _useState12[1];
97
-
98
- var textInput = useRef();
99
- var filterableMultiSelectInstanceId = useId();
100
- var enabled = useFeatureFlag('enable-v11-release');
101
- var prefix = usePrefix();
102
-
103
- if (prevOpen !== open) {
104
- setIsOpen(open);
105
- setPrevOpen(open);
106
- }
107
-
108
- var inline = type === 'inline';
109
- var showWarning = !invalid && warn;
110
- var wrapperClasses = cx("".concat(prefix, "--multi-select__wrapper"), "".concat(prefix, "--list-box__wrapper"), [enabled ? containerClassName : null], (_cx = {}, _defineProperty(_cx, "".concat(prefix, "--multi-select__wrapper--inline"), inline), _defineProperty(_cx, "".concat(prefix, "--list-box__wrapper--inline"), inline), _defineProperty(_cx, "".concat(prefix, "--multi-select__wrapper--inline--invalid"), inline && invalid), _defineProperty(_cx, "".concat(prefix, "--list-box__wrapper--inline--invalid"), inline && invalid), _defineProperty(_cx, "".concat(prefix, "--list-box--up"), direction === 'top'), _cx));
111
- var helperId = !helperText ? undefined : "filterablemultiselect-helper-text-".concat(filterableMultiSelectInstanceId);
112
- var labelId = "".concat(id, "-label");
113
- var titleClasses = cx((_cx2 = {}, _defineProperty(_cx2, "".concat(prefix, "--label"), true), _defineProperty(_cx2, "".concat(prefix, "--label--disabled"), disabled), _defineProperty(_cx2, "".concat(prefix, "--visually-hidden"), hideLabel), _cx2));
114
- var helperClasses = cx((_cx3 = {}, _defineProperty(_cx3, "".concat(prefix, "--form__helper-text"), true), _defineProperty(_cx3, "".concat(prefix, "--form__helper-text--disabled"), disabled), _cx3));
115
- var inputClasses = cx((_cx4 = {}, _defineProperty(_cx4, "".concat(prefix, "--text-input"), true), _defineProperty(_cx4, "".concat(prefix, "--text-input--empty"), !inputValue), _defineProperty(_cx4, "".concat(prefix, "--text-input--light"), light), _cx4));
116
- var helper = helperText ? /*#__PURE__*/React__default.createElement("div", {
117
- id: helperId,
118
- className: helperClasses
119
- }, helperText) : null;
120
- var menuId = "".concat(id, "__menu");
121
- var inputId = "".concat(id, "-input");
122
-
123
- function handleOnChange(changes) {
124
- if (onChange) {
125
- onChange(changes);
126
- }
127
- }
128
-
129
- function handleOnMenuChange(forceIsOpen) {
130
- var nextIsOpen = forceIsOpen !== null && forceIsOpen !== void 0 ? forceIsOpen : !isOpen;
131
- setIsOpen(nextIsOpen);
132
-
133
- if (onMenuChange) {
134
- onMenuChange(nextIsOpen);
135
- }
136
- }
137
-
138
- function handleOnOuterClick() {
139
- handleOnMenuChange(false);
140
- }
141
-
142
- function handleOnStateChange(changes, downshift) {
143
- if (changes.isOpen && !isOpen) {
144
- setTopItems(downshift.selectedItem);
145
- }
146
-
147
- var type = changes.type;
148
- var stateChangeTypes = Downshift.stateChangeTypes;
149
-
150
- switch (type) {
151
- case stateChangeTypes.keyDownArrowDown:
152
- case stateChangeTypes.keyDownArrowUp:
153
- case stateChangeTypes.keyDownHome:
154
- case stateChangeTypes.keyDownEnd:
155
- setHighlightedIndex(changes.highlightedIndex !== undefined ? changes.highlightedIndex : null);
156
-
157
- if (stateChangeTypes.keyDownArrowDown === type && !isOpen) {
158
- handleOnMenuChange(true);
159
- }
160
-
161
- break;
162
-
163
- case stateChangeTypes.keyDownEscape:
164
- handleOnMenuChange(false);
165
- break;
166
- }
167
- }
168
-
169
- function handleOnInputValueChange(inputValue, _ref2) {
170
- var type = _ref2.type;
171
-
172
- if (onInputValueChange) {
173
- onInputValueChange(inputValue);
174
- }
175
-
176
- if (type !== Downshift.stateChangeTypes.changeInput) {
177
- return;
178
- }
179
-
180
- if (Array.isArray(inputValue)) {
181
- clearInputValue();
182
- } else {
183
- setInputValue(inputValue);
184
- }
185
-
186
- if (inputValue && !isOpen) {
187
- handleOnMenuChange(true);
188
- } else if (!inputValue && isOpen) {
189
- handleOnMenuChange(false);
190
- }
191
- }
192
-
193
- function clearInputValue() {
194
- setInputValue('');
195
-
196
- if (textInput.current) {
197
- textInput.current.focus();
198
- }
199
- }
200
-
201
- return /*#__PURE__*/React__default.createElement(Selection, {
202
- disabled: disabled,
203
- onChange: handleOnChange,
204
- initialSelectedItems: initialSelectedItems,
205
- render: function render(_ref3) {
206
- var selectedItems = _ref3.selectedItems,
207
- onItemChange = _ref3.onItemChange,
208
- _clearSelection = _ref3.clearSelection;
209
- return /*#__PURE__*/React__default.createElement(Downshift, _extends({}, downshiftProps, {
210
- highlightedIndex: highlightedIndex,
211
- id: id,
212
- isOpen: isOpen,
213
- inputValue: inputValue,
214
- onInputValueChange: handleOnInputValueChange,
215
- onChange: function onChange(selectedItem) {
216
- if (selectedItem !== null) {
217
- onItemChange(selectedItem);
218
- }
219
- },
220
- itemToString: itemToString,
221
- onStateChange: handleOnStateChange,
222
- onOuterClick: handleOnOuterClick,
223
- selectedItem: selectedItems,
224
- labelId: labelId,
225
- menuId: menuId,
226
- inputId: inputId
227
- }), function (_ref4) {
228
- var _cx5;
229
-
230
- var getInputProps = _ref4.getInputProps,
231
- getItemProps = _ref4.getItemProps,
232
- getLabelProps = _ref4.getLabelProps,
233
- getMenuProps = _ref4.getMenuProps,
234
- getRootProps = _ref4.getRootProps,
235
- getToggleButtonProps = _ref4.getToggleButtonProps,
236
- isOpen = _ref4.isOpen,
237
- inputValue = _ref4.inputValue,
238
- selectedItem = _ref4.selectedItem;
239
- var className = cx("".concat(prefix, "--multi-select"), "".concat(prefix, "--combo-box"), "".concat(prefix, "--multi-select--filterable"), [enabled ? null : containerClassName], (_cx5 = {}, _defineProperty(_cx5, "".concat(prefix, "--multi-select--invalid"), invalid), _defineProperty(_cx5, "".concat(prefix, "--multi-select--open"), isOpen), _defineProperty(_cx5, "".concat(prefix, "--multi-select--inline"), inline), _defineProperty(_cx5, "".concat(prefix, "--multi-select--selected"), selectedItem.length > 0), _defineProperty(_cx5, "".concat(prefix, "--multi-select--filterable--input-focused"), inputFocused), _cx5));
240
- var rootProps = getRootProps({}, {
241
- suppressRefError: true
242
- });
243
- var labelProps = getLabelProps();
244
- var buttonProps = getToggleButtonProps({
245
- disabled: disabled,
246
- onClick: function onClick() {
247
- handleOnMenuChange(!isOpen);
248
-
249
- if (textInput.current) {
250
- textInput.current.focus();
251
- }
252
- },
253
- // When we moved the "root node" of Downshift to the <input> for
254
- // ARIA 1.2 compliance, we unfortunately hit this branch for the
255
- // "mouseup" event that downshift listens to:
256
- // https://github.com/downshift-js/downshift/blob/v5.2.1/src/downshift.js#L1051-L1065
257
- //
258
- // As a result, it will reset the state of the component and so we
259
- // stop the event from propagating to prevent this. This allows the
260
- // toggleMenu behavior for the toggleButton to correctly open and
261
- // close the menu.
262
- onMouseUp: function onMouseUp(event) {
263
- if (isOpen) {
264
- event.stopPropagation();
265
- }
266
- }
267
- });
268
- var inputProps = getInputProps({
269
- 'aria-controls': isOpen ? menuId : null,
270
- 'aria-describedby': helperText ? helperId : null,
271
- // Remove excess aria `aria-labelledby`. HTML <label for>
272
- // provides this aria information.
273
- 'aria-labelledby': null,
274
- disabled: disabled,
275
- placeholder: placeholder,
276
- onClick: function onClick() {
277
- handleOnMenuChange(true);
278
- },
279
- onKeyDown: function onKeyDown(event) {
280
- if (match(event, Space)) {
281
- event.stopPropagation();
282
- }
283
- },
284
- onFocus: function onFocus() {
285
- setInputFocused(true);
286
- },
287
- onBlur: function onBlur() {
288
- setInputFocused(false);
289
- }
290
- });
291
- var menuProps = getMenuProps({
292
- 'aria-label': ariaLabel
293
- }, {
294
- suppressRefError: true
295
- });
296
- return /*#__PURE__*/React__default.createElement("div", {
297
- className: wrapperClasses
298
- }, titleText ? /*#__PURE__*/React__default.createElement("label", _extends({
299
- className: titleClasses
300
- }, labelProps), titleText) : null, /*#__PURE__*/React__default.createElement(ListBox, {
301
- className: className,
302
- disabled: disabled,
303
- light: light,
304
- ref: ref,
305
- invalid: invalid,
306
- invalidText: invalidText,
307
- warn: warn,
308
- warnText: warnText,
309
- isOpen: isOpen,
310
- size: size
311
- }, /*#__PURE__*/React__default.createElement("div", {
312
- className: "".concat(prefix, "--list-box__field")
313
- }, selectedItem.length > 0 && /*#__PURE__*/React__default.createElement(ListBoxSelection, {
314
- clearSelection: function clearSelection() {
315
- _clearSelection();
316
-
317
- if (textInput.current) {
318
- textInput.current.focus();
319
- }
320
- },
321
- selectionCount: selectedItem.length,
322
- translateWithId: translateWithId,
323
- disabled: disabled
324
- }), /*#__PURE__*/React__default.createElement("input", _extends({
325
- className: inputClasses
326
- }, rootProps, inputProps, {
327
- ref: mergeRefs(textInput, rootProps.ref)
328
- })), invalid && /*#__PURE__*/React__default.createElement(WarningFilled, {
329
- className: "".concat(prefix, "--list-box__invalid-icon")
330
- }), showWarning && /*#__PURE__*/React__default.createElement(WarningAltFilled, {
331
- className: "".concat(prefix, "--list-box__invalid-icon ").concat(prefix, "--list-box__invalid-icon--warning")
332
- }), inputValue && /*#__PURE__*/React__default.createElement(ListBoxSelection, {
333
- clearSelection: clearInputValue,
334
- disabled: disabled,
335
- translateWithId: translateWithId,
336
- onMouseUp: function onMouseUp(event) {
337
- // If we do not stop this event from propagating,
338
- // it seems like Downshift takes our event and
339
- // prevents us from getting `onClick` /
340
- // `clearSelection` from the underlying <button> in
341
- // ListBoxSelection
342
- event.stopPropagation();
343
- }
344
- }), /*#__PURE__*/React__default.createElement(ListBoxTrigger, _extends({}, buttonProps, {
345
- isOpen: isOpen,
346
- translateWithId: translateWithId
347
- }))), isOpen ? /*#__PURE__*/React__default.createElement(ListBox.Menu, menuProps, sortItems(filterItems(items, {
348
- itemToString: itemToString,
349
- inputValue: inputValue
350
- }), {
351
- selectedItems: {
352
- top: selectedItems,
353
- fixed: [],
354
- 'top-after-reopen': topItems
355
- }[selectionFeedback],
356
- itemToString: itemToString,
357
- compareItems: compareItems,
358
- locale: locale
359
- }).map(function (item, index) {
360
- var itemProps = getItemProps({
361
- item: item,
362
- disabled: item.disabled
363
- });
364
- var itemText = itemToString(item);
365
- var isChecked = selectedItem.filter(function (selected) {
366
- return isEqual(selected, item);
367
- }).length > 0;
368
- return /*#__PURE__*/React__default.createElement(ListBox.MenuItem, _extends({
369
- key: itemProps.id,
370
- "aria-label": itemText,
371
- isActive: isChecked,
372
- isHighlighted: highlightedIndex === index,
373
- title: itemText
374
- }, itemProps), /*#__PURE__*/React__default.createElement("div", {
375
- className: "".concat(prefix, "--checkbox-wrapper")
376
- }, /*#__PURE__*/React__default.createElement("span", {
377
- title: useTitleInItem ? itemText : null,
378
- className: "".concat(prefix, "--checkbox-label"),
379
- "data-contained-checkbox-state": isChecked,
380
- id: "".concat(itemProps.id, "-item")
381
- }, ItemToElement ? /*#__PURE__*/React__default.createElement(ItemToElement, _extends({
382
- key: itemProps.id
383
- }, item)) : itemText)));
384
- })) : null), !inline && !invalid && !warn ? helper : null);
385
- });
386
- }
387
- });
388
- });
389
- FilterableMultiSelect.propTypes = _objectSpread2(_objectSpread2({
390
- /**
391
- * 'aria-label' of the ListBox component.
392
- */
393
- ariaLabel: PropTypes.string,
394
-
395
- /**
396
- * Specify the direction of the multiselect dropdown. Can be either top or bottom.
397
- */
398
- direction: PropTypes.oneOf(['top', 'bottom']),
399
-
400
- /**
401
- * Disable the control
402
- */
403
- disabled: PropTypes.bool,
404
-
405
- /**
406
- * Additional props passed to Downshift
407
- */
408
- downshiftProps: PropTypes.shape(Downshift.propTypes),
409
-
410
- /**
411
- * Specify whether the title text should be hidden or not
412
- */
413
- hideLabel: PropTypes.bool,
414
-
415
- /**
416
- * Specify a custom `id`
417
- */
418
- id: PropTypes.string.isRequired,
419
-
420
- /**
421
- * Allow users to pass in arbitrary items from their collection that are
422
- * pre-selected
423
- */
424
- initialSelectedItems: PropTypes.array,
425
-
426
- /**
427
- * Is the current selection invalid?
428
- */
429
- invalid: PropTypes.bool,
430
-
431
- /**
432
- * If invalid, what is the error?
433
- */
434
- invalidText: PropTypes.node,
435
-
436
- /**
437
- * Function to render items as custom components instead of strings.
438
- * Defaults to null and is overridden by a getter
439
- */
440
- itemToElement: PropTypes.func,
441
-
442
- /**
443
- * Helper function passed to downshift that allows the library to render a
444
- * given item to a string label. By default, it extracts the `label` field
445
- * from a given item to serve as the item label in the list.
446
- */
447
- itemToString: PropTypes.func,
448
-
449
- /**
450
- * We try to stay as generic as possible here to allow individuals to pass
451
- * in a collection of whatever kind of data structure they prefer
452
- */
453
- items: PropTypes.array.isRequired,
454
-
455
- /**
456
- * `true` to use the light version.
457
- */
458
- light: PropTypes.bool,
459
-
460
- /**
461
- * Specify the locale of the control. Used for the default `compareItems`
462
- * used for sorting the list of items in the control.
463
- */
464
- locale: PropTypes.string,
465
-
466
- /**
467
- * `onChange` is a utility for this controlled component to communicate to a
468
- * consuming component what kind of internal state changes are occurring.
469
- */
470
- onChange: PropTypes.func,
471
-
472
- /**
473
- * `onInputValueChange` is a utility for this controlled component to communicate to
474
- * the currently typed input.
475
- */
476
- onInputValueChange: PropTypes.func,
477
-
478
- /**
479
- * `onMenuChange` is a utility for this controlled component to communicate to a
480
- * consuming component that the menu was opened(`true`)/closed(`false`).
481
- */
482
- onMenuChange: PropTypes.func,
483
-
484
- /**
485
- * Initialize the component with an open(`true`)/closed(`false`) menu.
486
- */
487
- open: PropTypes.bool,
488
-
489
- /**
490
- * Generic `placeholder` that will be used as the textual representation of
491
- * what this field is for
492
- */
493
- placeholder: PropTypes.string,
494
-
495
- /**
496
- * Specify feedback (mode) of the selection.
497
- * `top`: selected item jumps to top
498
- * `fixed`: selected item stays at it's position
499
- * `top-after-reopen`: selected item jump to top after reopen dropdown
500
- */
501
- selectionFeedback: PropTypes.oneOf(['top', 'fixed', 'top-after-reopen']),
502
-
503
- /**
504
- * Specify the size of the ListBox. Currently supports either `sm`, `md` or `lg` as an option.
505
- */
506
- size: ListBoxSize
507
- }, sortingPropTypes), {}, {
508
- /**
509
- * Callback function for translating ListBoxMenuIcon SVG title
510
- */
511
- translateWithId: PropTypes.func,
512
-
513
- /**
514
- * Specify title to show title on hover
515
- */
516
- useTitleInItem: PropTypes.bool,
517
-
518
- /**
519
- * Specify whether the control is currently in warning state
520
- */
521
- warn: PropTypes.bool,
522
-
523
- /**
524
- * Provide the text that is displayed when the control is in warning state
525
- */
526
- warnText: PropTypes.node
527
- });
528
- FilterableMultiSelect.defaultProps = {
529
- ariaLabel: 'Choose an item',
530
- compareItems: defaultCompareItems,
531
- direction: 'bottom',
532
- disabled: false,
533
- filterItems: defaultFilterItems,
534
- initialSelectedItems: [],
535
- itemToString: defaultItemToString,
536
- locale: 'en',
537
- sortItems: defaultSortItems,
538
- light: false,
539
- open: false,
540
- selectionFeedback: 'top-after-reopen'
541
- };
542
- var FilterableMultiSelectNext = FilterableMultiSelect;
543
-
544
- export { FilterableMultiSelectNext as default };
@@ -1,42 +0,0 @@
1
- /**
2
- * Copyright IBM Corp. 2016, 2022
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
- import { NotificationActionButton as NotificationActionButton$1, NotificationButton as NotificationButton$1, ToastNotification as ToastNotification$1, InlineNotification as InlineNotification$1, ActionableNotification as ActionableNotification$1 } from './next/Notification.js';
9
- import { NotificationActionButton as NotificationActionButton$2, NotificationTextDetails as NotificationTextDetails$1, NotificationButton as NotificationButton$2, ToastNotification as ToastNotification$2, InlineNotification as InlineNotification$2 } from './Notification.js';
10
- import { createComponentToggle } from '../../internal/ComponentToggle.js';
11
-
12
- var NotificationActionButton = createComponentToggle({
13
- name: 'NotificationActionButton',
14
- next: NotificationActionButton$1,
15
- classic: NotificationActionButton$2
16
- });
17
- var NotificationTextDetails = createComponentToggle({
18
- name: 'NotificationTextDetails',
19
- classic: NotificationTextDetails$1
20
- });
21
- var NotificationButton = createComponentToggle({
22
- name: 'NotificationButton',
23
- next: NotificationButton$1,
24
- classic: NotificationButton$2
25
- });
26
- var ToastNotification = createComponentToggle({
27
- name: 'ToastNotification',
28
- next: ToastNotification$1,
29
- classic: ToastNotification$2
30
- });
31
- var InlineNotification = createComponentToggle({
32
- name: 'InlineNotification',
33
- next: InlineNotification$1,
34
- classic: InlineNotification$2
35
- });
36
- var ActionableNotification = createComponentToggle({
37
- name: 'ActionableNotification',
38
- next: ActionableNotification$1,
39
- classic: null
40
- });
41
-
42
- export { ActionableNotification, InlineNotification, NotificationActionButton, NotificationButton, NotificationTextDetails, ToastNotification };