@carbon/react 1.15.0 → 1.16.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 (67) hide show
  1. package/es/components/CodeSnippet/CodeSnippet.js +2 -1
  2. package/es/components/ComboBox/ComboBox.js +45 -24
  3. package/es/components/DataTable/TableHeader.js +1 -1
  4. package/es/components/DatePicker/DatePicker.js +10 -8
  5. package/es/components/Dropdown/Dropdown.js +2 -2
  6. package/es/components/FluidComboBox/FluidComboBox.Skeleton.js +41 -0
  7. package/es/components/FluidComboBox/FluidComboBox.js +140 -0
  8. package/es/components/FluidMultiSelect/FluidMultiSelect.Skeleton.js +41 -0
  9. package/es/components/FluidMultiSelect/FluidMultiSelect.js +151 -0
  10. package/es/components/FluidSelect/FluidSelect.Skeleton.js +41 -0
  11. package/es/components/FluidSelect/FluidSelect.js +93 -0
  12. package/es/components/FluidTextArea/FluidTextArea.js +2 -1
  13. package/es/components/InlineLoading/InlineLoading.js +2 -4
  14. package/es/components/ListBox/ListBox.js +2 -1
  15. package/es/components/MultiSelect/FilterableMultiSelect.js +41 -21
  16. package/es/components/MultiSelect/MultiSelect.js +28 -12
  17. package/es/components/OverflowMenu/OverflowMenu.js +2 -2
  18. package/es/components/Pagination/Pagination.js +271 -270
  19. package/es/components/Pagination/index.js +1 -6
  20. package/es/components/Select/Select.js +23 -5
  21. package/es/components/TextArea/TextArea.js +2 -2
  22. package/es/components/TextInput/ControlledPasswordInput.js +2 -3
  23. package/es/components/TextInput/PasswordInput.js +3 -3
  24. package/es/components/TextInput/TextInput.js +6 -7
  25. package/es/components/Tile/next/Tile.js +18 -22
  26. package/es/components/Tooltip/next/DefinitionTooltip.js +11 -2
  27. package/es/components/UIShell/HeaderMenu.js +15 -4
  28. package/es/components/UIShell/SideNavMenu.js +2 -1
  29. package/es/index.js +14 -8
  30. package/es/internal/useNormalizedInputProps.js +2 -1
  31. package/lib/components/CodeSnippet/CodeSnippet.js +2 -1
  32. package/lib/components/ComboBox/ComboBox.js +44 -23
  33. package/lib/components/DataTable/TableHeader.js +1 -1
  34. package/lib/components/DatePicker/DatePicker.js +10 -8
  35. package/lib/components/Dropdown/Dropdown.js +2 -2
  36. package/lib/components/FluidComboBox/FluidComboBox.Skeleton.js +51 -0
  37. package/lib/components/FluidComboBox/FluidComboBox.js +150 -0
  38. package/lib/components/FluidMultiSelect/FluidMultiSelect.Skeleton.js +51 -0
  39. package/lib/components/FluidMultiSelect/FluidMultiSelect.js +161 -0
  40. package/lib/components/FluidSelect/FluidSelect.Skeleton.js +51 -0
  41. package/lib/components/FluidSelect/FluidSelect.js +103 -0
  42. package/lib/components/FluidTextArea/FluidTextArea.js +2 -1
  43. package/lib/components/InlineLoading/InlineLoading.js +2 -4
  44. package/lib/components/ListBox/ListBox.js +2 -1
  45. package/lib/components/MultiSelect/FilterableMultiSelect.js +40 -20
  46. package/lib/components/MultiSelect/MultiSelect.js +27 -11
  47. package/lib/components/OverflowMenu/OverflowMenu.js +2 -2
  48. package/lib/components/Pagination/Pagination.js +269 -268
  49. package/lib/components/Pagination/index.js +2 -24
  50. package/lib/components/Select/Select.js +21 -3
  51. package/lib/components/TextArea/TextArea.js +2 -2
  52. package/lib/components/TextInput/ControlledPasswordInput.js +2 -3
  53. package/lib/components/TextInput/PasswordInput.js +3 -3
  54. package/lib/components/TextInput/TextInput.js +6 -7
  55. package/lib/components/Tile/next/Tile.js +18 -22
  56. package/lib/components/Tooltip/next/DefinitionTooltip.js +11 -2
  57. package/lib/components/UIShell/HeaderMenu.js +15 -4
  58. package/lib/components/UIShell/SideNavMenu.js +2 -1
  59. package/lib/index.js +98 -86
  60. package/lib/internal/useNormalizedInputProps.js +2 -1
  61. package/package.json +4 -4
  62. package/scss/components/fluid-select/_fluid-select.scss +9 -0
  63. package/scss/components/fluid-select/_index.scss +9 -0
  64. package/es/components/FileUploader/index.js +0 -15
  65. package/es/components/Pagination/next/Pagination.js +0 -421
  66. package/lib/components/FileUploader/index.js +0 -39
  67. package/lib/components/Pagination/next/Pagination.js +0 -431
@@ -20,7 +20,9 @@ require('../ListBox/index.js');
20
20
  var setupGetInstanceId = require('../../tools/setupGetInstanceId.js');
21
21
  var mergeRefs = require('../../tools/mergeRefs.js');
22
22
  var index = require('../FeatureFlags/index.js');
23
+ var deprecate = require('../../prop-types/deprecate.js');
23
24
  var usePrefix = require('../../internal/usePrefix.js');
25
+ var FormContext = require('../FluidForm/FormContext.js');
24
26
  var match = require('../../internal/keyboard/match.js');
25
27
  var Text = require('../Text/Text.js');
26
28
  var ListBox = require('../ListBox/ListBox.js');
@@ -90,7 +92,7 @@ var findHighlightedIndex = function findHighlightedIndex(_ref2, inputValue) {
90
92
 
91
93
  var getInstanceId = setupGetInstanceId["default"]();
92
94
  var ComboBox = /*#__PURE__*/React__default["default"].forwardRef(function (props, ref) {
93
- var _cx, _Text;
95
+ var _cx, _ref4, _Text;
94
96
 
95
97
  var ariaLabel = props.ariaLabel,
96
98
  containerClassName = props.className,
@@ -122,6 +124,10 @@ var ComboBox = /*#__PURE__*/React__default["default"].forwardRef(function (props
122
124
  var rest = _rollupPluginBabelHelpers.objectWithoutProperties(props, _excluded);
123
125
 
124
126
  var prefix = usePrefix.usePrefix();
127
+
128
+ var _useContext = React.useContext(FormContext.FormContext),
129
+ isFluid = _useContext.isFluid;
130
+
125
131
  var textInput = React.useRef();
126
132
  var comboBoxInstanceId = getInstanceId();
127
133
 
@@ -135,15 +141,20 @@ var ComboBox = /*#__PURE__*/React__default["default"].forwardRef(function (props
135
141
  inputValue = _useState2[0],
136
142
  setInputValue = _useState2[1];
137
143
 
138
- var _useState3 = React.useState(null),
144
+ var _useState3 = React.useState(false),
139
145
  _useState4 = _rollupPluginBabelHelpers.slicedToArray(_useState3, 2),
140
- prevSelectedItem = _useState4[0],
141
- setPrevSelectedItem = _useState4[1];
146
+ isFocused = _useState4[0],
147
+ setIsFocused = _useState4[1];
142
148
 
143
149
  var _useState5 = React.useState(null),
144
150
  _useState6 = _rollupPluginBabelHelpers.slicedToArray(_useState5, 2),
145
- doneInitialSelectedItem = _useState6[0],
146
- setDoneInitialSelectedItem = _useState6[1];
151
+ prevSelectedItem = _useState6[0],
152
+ setPrevSelectedItem = _useState6[1];
153
+
154
+ var _useState7 = React.useState(null),
155
+ _useState8 = _rollupPluginBabelHelpers.slicedToArray(_useState7, 2),
156
+ doneInitialSelectedItem = _useState8[0],
157
+ setDoneInitialSelectedItem = _useState8[1];
147
158
 
148
159
  var savedOnInputChange = React.useRef(onInputChange);
149
160
 
@@ -226,7 +237,7 @@ var ComboBox = /*#__PURE__*/React__default["default"].forwardRef(function (props
226
237
  var titleClasses = cx__default["default"]("".concat(prefix, "--label"), _rollupPluginBabelHelpers.defineProperty({}, "".concat(prefix, "--label--disabled"), disabled));
227
238
  var comboBoxHelperId = !helperText ? undefined : "combobox-helper-text-".concat(comboBoxInstanceId);
228
239
  var helperClasses = cx__default["default"]("".concat(prefix, "--form__helper-text"), _rollupPluginBabelHelpers.defineProperty({}, "".concat(prefix, "--form__helper-text--disabled"), disabled));
229
- var wrapperClasses = cx__default["default"]("".concat(prefix, "--list-box__wrapper"), [enabled ? containerClassName : null]);
240
+ var wrapperClasses = cx__default["default"]("".concat(prefix, "--list-box__wrapper"), [enabled ? containerClassName : null, (_ref4 = {}, _rollupPluginBabelHelpers.defineProperty(_ref4, "".concat(prefix, "--list-box__wrapper--fluid--invalid"), isFluid && invalid), _rollupPluginBabelHelpers.defineProperty(_ref4, "".concat(prefix, "--list-box__wrapper--fluid--focus"), isFluid && isFocused), _ref4)]);
230
241
  var inputClasses = cx__default["default"]("".concat(prefix, "--text-input"), _rollupPluginBabelHelpers.defineProperty({}, "".concat(prefix, "--text-input--empty"), !inputValue)); // needs to be Capitalized for react to render it correctly
231
242
 
232
243
  var ItemToElement = itemToElement;
@@ -248,21 +259,21 @@ var ComboBox = /*#__PURE__*/React__default["default"].forwardRef(function (props
248
259
  initialSelectedItem: initialSelectedItem,
249
260
  inputId: id,
250
261
  selectedItem: selectedItem
251
- }), function (_ref4) {
262
+ }), function (_ref5) {
252
263
  var _textInput$current;
253
264
 
254
- var getInputProps = _ref4.getInputProps,
255
- getItemProps = _ref4.getItemProps,
256
- getLabelProps = _ref4.getLabelProps,
257
- getMenuProps = _ref4.getMenuProps,
258
- getRootProps = _ref4.getRootProps,
259
- getToggleButtonProps = _ref4.getToggleButtonProps,
260
- isOpen = _ref4.isOpen,
261
- inputValue = _ref4.inputValue,
262
- selectedItem = _ref4.selectedItem,
263
- highlightedIndex = _ref4.highlightedIndex,
264
- clearSelection = _ref4.clearSelection,
265
- toggleMenu = _ref4.toggleMenu;
265
+ var getInputProps = _ref5.getInputProps,
266
+ getItemProps = _ref5.getItemProps,
267
+ getLabelProps = _ref5.getLabelProps,
268
+ getMenuProps = _ref5.getMenuProps,
269
+ getRootProps = _ref5.getRootProps,
270
+ getToggleButtonProps = _ref5.getToggleButtonProps,
271
+ isOpen = _ref5.isOpen,
272
+ inputValue = _ref5.inputValue,
273
+ selectedItem = _ref5.selectedItem,
274
+ highlightedIndex = _ref5.highlightedIndex,
275
+ clearSelection = _ref5.clearSelection,
276
+ toggleMenu = _ref5.toggleMenu;
266
277
  var rootProps = getRootProps({}, {
267
278
  suppressRefError: true
268
279
  });
@@ -303,12 +314,23 @@ var ComboBox = /*#__PURE__*/React__default["default"].forwardRef(function (props
303
314
  }
304
315
  }
305
316
  });
317
+
318
+ var handleFocus = function handleFocus(evt) {
319
+ if (evt.target.type === 'button') {
320
+ setIsFocused(false);
321
+ } else {
322
+ setIsFocused(evt.type === 'focus' ? true : false);
323
+ }
324
+ };
325
+
306
326
  return /*#__PURE__*/React__default["default"].createElement("div", {
307
327
  className: wrapperClasses
308
328
  }, titleText && /*#__PURE__*/React__default["default"].createElement(Text.Text, _rollupPluginBabelHelpers["extends"]({
309
329
  as: "label",
310
330
  className: titleClasses
311
331
  }, labelProps), titleText), /*#__PURE__*/React__default["default"].createElement(ListBox["default"], {
332
+ onFocus: handleFocus,
333
+ onBlur: handleFocus,
312
334
  className: className,
313
335
  disabled: disabled,
314
336
  invalid: invalid,
@@ -364,7 +386,7 @@ var ComboBox = /*#__PURE__*/React__default["default"].forwardRef(function (props
364
386
  }, item)) : itemToString(item), selectedItem === item && /*#__PURE__*/React__default["default"].createElement(iconsReact.Checkmark, {
365
387
  className: "".concat(prefix, "--list-box__menu-item__selected-icon")
366
388
  }));
367
- }) : null)), helperText && !invalid && !warn && (_Text || (_Text = /*#__PURE__*/React__default["default"].createElement(Text.Text, {
389
+ }) : null)), helperText && !invalid && !warn && !isFluid && (_Text || (_Text = /*#__PURE__*/React__default["default"].createElement(Text.Text, {
368
390
  as: "div",
369
391
  id: comboBoxHelperId,
370
392
  className: helperClasses
@@ -447,7 +469,7 @@ ComboBox.propTypes = {
447
469
  /**
448
470
  * should use "light theme" (white background)?
449
471
  */
450
- light: PropTypes__default["default"].bool,
472
+ light: deprecate["default"](PropTypes__default["default"].bool, 'The `light` prop for `Combobox` has ' + 'been deprecated in favor of the new `Layer` component. It will be removed in the next major release.'),
451
473
 
452
474
  /**
453
475
  * `onChange` is a utility for this controlled component to communicate to a
@@ -532,7 +554,6 @@ ComboBox.defaultProps = {
532
554
  shouldFilterItem: defaultShouldFilterItem,
533
555
  type: 'default',
534
556
  ariaLabel: 'Choose an item',
535
- light: false,
536
557
  direction: 'bottom'
537
558
  };
538
559
  var ComboBox$1 = ComboBox;
@@ -90,7 +90,7 @@ var TableHeader = /*#__PURE__*/React__default["default"].forwardRef(function Tab
90
90
  }, children) : null);
91
91
  }
92
92
 
93
- var className = cx__default["default"](headerClassName, (_cx = {}, _rollupPluginBabelHelpers.defineProperty(_cx, "".concat(prefix, "--table-sort"), true), _rollupPluginBabelHelpers.defineProperty(_cx, "".concat(prefix, "--table-sort--active"), isSortHeader && sortDirection !== sortStates.sortStates.NONE), _rollupPluginBabelHelpers.defineProperty(_cx, "".concat(prefix, "--table-sort--ascending"), isSortHeader && sortDirection === sortStates.sortStates.DESC), _cx));
93
+ var className = cx__default["default"](headerClassName, (_cx = {}, _rollupPluginBabelHelpers.defineProperty(_cx, "".concat(prefix, "--table-sort"), true), _rollupPluginBabelHelpers.defineProperty(_cx, "".concat(prefix, "--table-sort--active"), isSortHeader && sortDirection !== sortStates.sortStates.NONE), _rollupPluginBabelHelpers.defineProperty(_cx, "".concat(prefix, "--table-sort--descending"), isSortHeader && sortDirection === sortStates.sortStates.DESC), _cx));
94
94
  var ariaSort = !isSortHeader ? 'none' : sortDirections[sortDirection];
95
95
  var sortDescription = t('carbon.table.header.icon.description', {
96
96
  header: children,
@@ -19,6 +19,7 @@ var DatePickerInput = require('../DatePickerInput/DatePickerInput.js');
19
19
  var appendToPlugin = require('./plugins/appendToPlugin.js');
20
20
  var fixEventsPlugin = require('./plugins/fixEventsPlugin.js');
21
21
  var rangePlugin = require('./plugins/rangePlugin.js');
22
+ var deprecate = require('../../prop-types/deprecate.js');
22
23
  var usePrefix = require('../../internal/usePrefix.js');
23
24
  var useSavedCallback = require('../../internal/useSavedCallback.js');
24
25
  var match = require('../../internal/keyboard/match.js');
@@ -156,7 +157,7 @@ function updateClassNames(calendar, prefix) {
156
157
  }
157
158
  }
158
159
 
159
- function DatePicker(_ref) {
160
+ var DatePicker = /*#__PURE__*/React__default["default"].forwardRef(function DatePicker(_ref, ref) {
160
161
  var _cx;
161
162
 
162
163
  var allowInput = _ref.allowInput,
@@ -363,12 +364,12 @@ function DatePicker(_ref) {
363
364
  }
364
365
  }, [dateFormat]);
365
366
  React.useEffect(function () {
366
- if (calendarRef.current && minDate) {
367
+ if (calendarRef.current) {
367
368
  calendarRef.current.set('minDate', minDate);
368
369
  }
369
370
  }, [minDate]);
370
371
  React.useEffect(function () {
371
- if (calendarRef.current && maxDate) {
372
+ if (calendarRef.current) {
372
373
  calendarRef.current.set('maxDate', maxDate);
373
374
  }
374
375
  }, [maxDate]);
@@ -399,12 +400,12 @@ function DatePicker(_ref) {
399
400
  }
400
401
  }, [value, prefix]);
401
402
  return /*#__PURE__*/React__default["default"].createElement("div", _rollupPluginBabelHelpers["extends"]({
402
- className: wrapperClasses
403
+ className: wrapperClasses,
404
+ ref: ref
403
405
  }, rest), /*#__PURE__*/React__default["default"].createElement("div", {
404
406
  className: datePickerClasses
405
407
  }, childrenWithProps));
406
- }
407
-
408
+ });
408
409
  DatePicker.propTypes = {
409
410
  /**
410
411
  * flatpickr prop passthrough. Allows the user to enter a date directly
@@ -464,7 +465,7 @@ DatePicker.propTypes = {
464
465
  /**
465
466
  * `true` to use the light version.
466
467
  */
467
- light: PropTypes__default["default"].bool,
468
+ light: deprecate["default"](PropTypes__default["default"].bool, 'The `light` prop for `DatePicker` has ' + 'been deprecated in favor of the new `Layer` component. It will be removed in the next major release.'),
468
469
 
469
470
  /**
470
471
  * The language locale used to format the days of the week, months, and numbers. The full list of supported locales can be found here https://github.com/flatpickr/flatpickr/tree/master/src/l10n
@@ -568,5 +569,6 @@ DatePicker.propTypes = {
568
569
  */
569
570
  value: PropTypes__default["default"].oneOfType([PropTypes__default["default"].string, PropTypes__default["default"].arrayOf(PropTypes__default["default"].oneOfType([PropTypes__default["default"].string, PropTypes__default["default"].number, PropTypes__default["default"].object])), PropTypes__default["default"].object, PropTypes__default["default"].number])
570
571
  };
572
+ var DatePicker$1 = DatePicker;
571
573
 
572
- exports["default"] = DatePicker;
574
+ exports["default"] = DatePicker$1;
@@ -17,6 +17,7 @@ var PropTypes = require('prop-types');
17
17
  var iconsReact = require('@carbon/icons-react');
18
18
  require('../ListBox/index.js');
19
19
  var mergeRefs = require('../../tools/mergeRefs.js');
20
+ var deprecate = require('../../prop-types/deprecate.js');
20
21
  var index = require('../FeatureFlags/index.js');
21
22
  var usePrefix = require('../../internal/usePrefix.js');
22
23
  var FormContext = require('../FluidForm/FormContext.js');
@@ -278,7 +279,7 @@ Dropdown.propTypes = {
278
279
  /**
279
280
  * `true` to use the light version.
280
281
  */
281
- light: PropTypes__default["default"].bool,
282
+ light: deprecate["default"](PropTypes__default["default"].bool, 'The `light` prop for `Dropdown` has ' + 'been deprecated in favor of the new `Layer` component. It will be removed in the next major release.'),
282
283
 
283
284
  /**
284
285
  * `onChange` is a utility for this controlled component to communicate to a
@@ -333,7 +334,6 @@ Dropdown.defaultProps = {
333
334
  type: 'default',
334
335
  itemToString: defaultItemToString,
335
336
  itemToElement: null,
336
- light: false,
337
337
  titleText: '',
338
338
  helperText: '',
339
339
  direction: 'bottom'
@@ -0,0 +1,51 @@
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
+ 'use strict';
9
+
10
+ Object.defineProperty(exports, '__esModule', { value: true });
11
+
12
+ var _rollupPluginBabelHelpers = require('../../_virtual/_rollupPluginBabelHelpers.js');
13
+ var PropTypes = require('prop-types');
14
+ var React = require('react');
15
+ var cx = require('classnames');
16
+ var usePrefix = require('../../internal/usePrefix.js');
17
+
18
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
19
+
20
+ var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
21
+ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
22
+ var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
23
+
24
+ var _excluded = ["className"];
25
+
26
+ var FluidComboBoxSkeleton = function FluidComboBoxSkeleton(_ref) {
27
+ var className = _ref.className,
28
+ rest = _rollupPluginBabelHelpers.objectWithoutProperties(_ref, _excluded);
29
+
30
+ var prefix = usePrefix.usePrefix();
31
+ var wrapperClasses = cx__default["default"](className, "".concat(prefix, "--skeleton"), "".concat(prefix, "--list-box"));
32
+ return /*#__PURE__*/React__default["default"].createElement("div", {
33
+ className: "".concat(prefix, "--list-box__wrapper--fluid")
34
+ }, /*#__PURE__*/React__default["default"].createElement("div", _rollupPluginBabelHelpers["extends"]({
35
+ className: wrapperClasses
36
+ }, rest), /*#__PURE__*/React__default["default"].createElement("span", {
37
+ className: "".concat(prefix, "--list-box__label")
38
+ }), /*#__PURE__*/React__default["default"].createElement("div", {
39
+ className: "".concat(prefix, "--list-box__field")
40
+ })));
41
+ };
42
+
43
+ FluidComboBoxSkeleton.propTypes = {
44
+ /**
45
+ * Specify an optional className to add.
46
+ */
47
+ className: PropTypes__default["default"].string
48
+ };
49
+ var FluidComboBoxSkeleton$1 = FluidComboBoxSkeleton;
50
+
51
+ exports["default"] = FluidComboBoxSkeleton$1;
@@ -0,0 +1,150 @@
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
+ 'use strict';
9
+
10
+ Object.defineProperty(exports, '__esModule', { value: true });
11
+
12
+ var _rollupPluginBabelHelpers = require('../../_virtual/_rollupPluginBabelHelpers.js');
13
+ var PropTypes = require('prop-types');
14
+ var React = require('react');
15
+ var cx = require('classnames');
16
+ var ComboBox = require('../ComboBox/ComboBox.js');
17
+ var usePrefix = require('../../internal/usePrefix.js');
18
+ var FormContext = require('../FluidForm/FormContext.js');
19
+
20
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
21
+
22
+ var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
23
+ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
24
+ var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
25
+
26
+ var _excluded = ["className", "isCondensed"];
27
+ var FluidComboBox = /*#__PURE__*/React__default["default"].forwardRef(function FluidComboBox(_ref, ref) {
28
+ var className = _ref.className,
29
+ isCondensed = _ref.isCondensed,
30
+ other = _rollupPluginBabelHelpers.objectWithoutProperties(_ref, _excluded);
31
+
32
+ var prefix = usePrefix.usePrefix();
33
+ var classNames = cx__default["default"]("".concat(prefix, "--list-box__wrapper--fluid"), className, _rollupPluginBabelHelpers.defineProperty({}, "".concat(prefix, "--list-box__wrapper--fluid--condensed"), isCondensed));
34
+ return /*#__PURE__*/React__default["default"].createElement(FormContext.FormContext.Provider, {
35
+ value: {
36
+ isFluid: true
37
+ }
38
+ }, /*#__PURE__*/React__default["default"].createElement(ComboBox["default"], _rollupPluginBabelHelpers["extends"]({
39
+ ref: ref,
40
+ className: classNames
41
+ }, other)));
42
+ });
43
+ FluidComboBox.propTypes = {
44
+ /**
45
+ * Specify an optional className to be applied to the outer FluidForm wrapper
46
+ */
47
+ className: PropTypes__default["default"].string,
48
+
49
+ /**
50
+ * Specify the direction of the dropdown. Can be either top or bottom.
51
+ */
52
+ direction: PropTypes__default["default"].oneOf(['top', 'bottom']),
53
+
54
+ /**
55
+ * Specify whether the `<input>` should be disabled
56
+ */
57
+ disabled: PropTypes__default["default"].bool,
58
+
59
+ /**
60
+ * Specify a custom `id` for the `<input>`
61
+ */
62
+ id: PropTypes__default["default"].string.isRequired,
63
+
64
+ /**
65
+ * Allow users to pass in an arbitrary item or a string (in case their items are an array of strings)
66
+ * from their collection that are pre-selected
67
+ */
68
+ initialSelectedItem: PropTypes__default["default"].oneOfType([PropTypes__default["default"].object, PropTypes__default["default"].string, PropTypes__default["default"].number]),
69
+
70
+ /**
71
+ * Specify if the currently selected value is invalid.
72
+ */
73
+ invalid: PropTypes__default["default"].bool,
74
+
75
+ /**
76
+ * Provide the text that is displayed when the control is in an invalid state
77
+ */
78
+ invalidText: PropTypes__default["default"].node,
79
+
80
+ /**
81
+ * Specify if the `FluidComboBox` should render its menu items in condensed mode
82
+ */
83
+ isCondensed: PropTypes__default["default"].bool,
84
+
85
+ /**
86
+ * Function to render items as custom components instead of strings.
87
+ * Defaults to null and is overridden by a getter
88
+ */
89
+ itemToElement: PropTypes__default["default"].func,
90
+
91
+ /**
92
+ * Helper function passed to downshift that allows the library to render a
93
+ * given item to a string label. By default, it extracts the `label` field
94
+ * from a given item to serve as the item label in the list.
95
+ */
96
+ itemToString: PropTypes__default["default"].func,
97
+
98
+ /**
99
+ * We try to stay as generic as possible here to allow individuals to pass
100
+ * in a collection of whatever kind of data structure they prefer
101
+ */
102
+ items: PropTypes__default["default"].array.isRequired,
103
+
104
+ /**
105
+ * Generic `label` that will be used as the textual representation of what
106
+ * this field is for
107
+ */
108
+ label: PropTypes__default["default"].node.isRequired,
109
+
110
+ /**
111
+ * `onChange` is a utility for this controlled component to communicate to a
112
+ * consuming component what kind of internal state changes are occurring.
113
+ */
114
+ onChange: PropTypes__default["default"].func,
115
+
116
+ /**
117
+ * An optional callback to render the currently selected item as a react element instead of only
118
+ * as a string.
119
+ */
120
+ renderSelectedItem: PropTypes__default["default"].func,
121
+
122
+ /**
123
+ * In the case you want to control the dropdown selection entirely.
124
+ */
125
+ selectedItem: PropTypes__default["default"].oneOfType([PropTypes__default["default"].object, PropTypes__default["default"].string, PropTypes__default["default"].number]),
126
+
127
+ /**
128
+ * Provide the title text that will be read by a screen reader when
129
+ * visiting this control
130
+ */
131
+ titleText: PropTypes__default["default"].node,
132
+
133
+ /**
134
+ * Callback function for translating ListBoxMenuIcon SVG title
135
+ */
136
+ translateWithId: PropTypes__default["default"].func,
137
+
138
+ /**
139
+ * Specify whether the control is currently in warning state
140
+ */
141
+ warn: PropTypes__default["default"].bool,
142
+
143
+ /**
144
+ * Provide the text that is displayed when the control is in warning state
145
+ */
146
+ warnText: PropTypes__default["default"].node
147
+ };
148
+ var FluidComboBox$1 = FluidComboBox;
149
+
150
+ exports["default"] = FluidComboBox$1;
@@ -0,0 +1,51 @@
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
+ 'use strict';
9
+
10
+ Object.defineProperty(exports, '__esModule', { value: true });
11
+
12
+ var _rollupPluginBabelHelpers = require('../../_virtual/_rollupPluginBabelHelpers.js');
13
+ var PropTypes = require('prop-types');
14
+ var React = require('react');
15
+ var cx = require('classnames');
16
+ var usePrefix = require('../../internal/usePrefix.js');
17
+
18
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
19
+
20
+ var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
21
+ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
22
+ var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
23
+
24
+ var _excluded = ["className"];
25
+
26
+ var FluidMultiSelectSkeleton = function FluidMultiSelectSkeleton(_ref) {
27
+ var className = _ref.className,
28
+ rest = _rollupPluginBabelHelpers.objectWithoutProperties(_ref, _excluded);
29
+
30
+ var prefix = usePrefix.usePrefix();
31
+ var wrapperClasses = cx__default["default"](className, "".concat(prefix, "--skeleton"), "".concat(prefix, "--list-box"));
32
+ return /*#__PURE__*/React__default["default"].createElement("div", {
33
+ className: "".concat(prefix, "--list-box__wrapper--fluid")
34
+ }, /*#__PURE__*/React__default["default"].createElement("div", _rollupPluginBabelHelpers["extends"]({
35
+ className: wrapperClasses
36
+ }, rest), /*#__PURE__*/React__default["default"].createElement("span", {
37
+ className: "".concat(prefix, "--list-box__label")
38
+ }), /*#__PURE__*/React__default["default"].createElement("div", {
39
+ className: "".concat(prefix, "--list-box__field")
40
+ })));
41
+ };
42
+
43
+ FluidMultiSelectSkeleton.propTypes = {
44
+ /**
45
+ * Specify an optional className to add.
46
+ */
47
+ className: PropTypes__default["default"].string
48
+ };
49
+ var FluidMultiSelectSkeleton$1 = FluidMultiSelectSkeleton;
50
+
51
+ exports["default"] = FluidMultiSelectSkeleton$1;
@@ -0,0 +1,161 @@
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
+ 'use strict';
9
+
10
+ Object.defineProperty(exports, '__esModule', { value: true });
11
+
12
+ var _rollupPluginBabelHelpers = require('../../_virtual/_rollupPluginBabelHelpers.js');
13
+ var PropTypes = require('prop-types');
14
+ var React = require('react');
15
+ var cx = require('classnames');
16
+ require('../MultiSelect/index.js');
17
+ var usePrefix = require('../../internal/usePrefix.js');
18
+ var FormContext = require('../FluidForm/FormContext.js');
19
+ var FilterableMultiSelect = require('../MultiSelect/FilterableMultiSelect.js');
20
+ var MultiSelect = require('../MultiSelect/MultiSelect.js');
21
+
22
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
23
+
24
+ var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
25
+ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
26
+ var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
27
+
28
+ var _excluded = ["className", "isCondensed", "isFilterable"];
29
+ var FluidMultiSelect = /*#__PURE__*/React__default["default"].forwardRef(function FluidMultiSelect(_ref, ref) {
30
+ var className = _ref.className,
31
+ isCondensed = _ref.isCondensed,
32
+ isFilterable = _ref.isFilterable,
33
+ other = _rollupPluginBabelHelpers.objectWithoutProperties(_ref, _excluded);
34
+
35
+ var prefix = usePrefix.usePrefix();
36
+ var classNames = cx__default["default"]("".concat(prefix, "--list-box__wrapper--fluid"), className, _rollupPluginBabelHelpers.defineProperty({}, "".concat(prefix, "--list-box__wrapper--fluid--condensed"), isCondensed));
37
+ return /*#__PURE__*/React__default["default"].createElement(FormContext.FormContext.Provider, {
38
+ value: {
39
+ isFluid: true
40
+ }
41
+ }, isFilterable ? /*#__PURE__*/React__default["default"].createElement(FilterableMultiSelect["default"], _rollupPluginBabelHelpers["extends"]({
42
+ ref: ref,
43
+ className: classNames
44
+ }, other)) : /*#__PURE__*/React__default["default"].createElement(MultiSelect["default"], _rollupPluginBabelHelpers["extends"]({
45
+ ref: ref,
46
+ className: classNames
47
+ }, other)));
48
+ });
49
+ FluidMultiSelect.propTypes = {
50
+ /**
51
+ * Specify an optional className to be applied to the outer FluidForm wrapper
52
+ */
53
+ className: PropTypes__default["default"].string,
54
+
55
+ /**
56
+ * Specify the direction of the dropdown. Can be either top or bottom.
57
+ */
58
+ direction: PropTypes__default["default"].oneOf(['top', 'bottom']),
59
+
60
+ /**
61
+ * Specify whether the `<input>` should be disabled
62
+ */
63
+ disabled: PropTypes__default["default"].bool,
64
+
65
+ /**
66
+ * Specify a custom `id` for the `<input>`
67
+ */
68
+ id: PropTypes__default["default"].string.isRequired,
69
+
70
+ /**
71
+ * Allow users to pass in an arbitrary item or a string (in case their items are an array of strings)
72
+ * from their collection that are pre-selected
73
+ */
74
+ initialSelectedItem: PropTypes__default["default"].oneOfType([PropTypes__default["default"].object, PropTypes__default["default"].string, PropTypes__default["default"].number]),
75
+
76
+ /**
77
+ * Specify if the currently selected value is invalid.
78
+ */
79
+ invalid: PropTypes__default["default"].bool,
80
+
81
+ /**
82
+ * Provide the text that is displayed when the control is in an invalid state
83
+ */
84
+ invalidText: PropTypes__default["default"].node,
85
+
86
+ /**
87
+ * Specify if the `FluidMultiSelect` should render its menu items in condensed mode
88
+ */
89
+ isCondensed: PropTypes__default["default"].bool,
90
+
91
+ /**
92
+ * Specify if the `FluidMultiSelect` should render the `filterable` variant of `FluidMultiSelect`
93
+ */
94
+ isFilterable: PropTypes__default["default"].bool,
95
+
96
+ /**
97
+ * Function to render items as custom components instead of strings.
98
+ * Defaults to null and is overridden by a getter
99
+ */
100
+ itemToElement: PropTypes__default["default"].func,
101
+
102
+ /**
103
+ * Helper function passed to downshift that allows the library to render a
104
+ * given item to a string label. By default, it extracts the `label` field
105
+ * from a given item to serve as the item label in the list.
106
+ */
107
+ itemToString: PropTypes__default["default"].func,
108
+
109
+ /**
110
+ * We try to stay as generic as possible here to allow individuals to pass
111
+ * in a collection of whatever kind of data structure they prefer
112
+ */
113
+ items: PropTypes__default["default"].array.isRequired,
114
+
115
+ /**
116
+ * Generic `label` that will be used as the textual representation of what
117
+ * this field is for
118
+ */
119
+ label: PropTypes__default["default"].node.isRequired,
120
+
121
+ /**
122
+ * `onChange` is a utility for this controlled component to communicate to a
123
+ * consuming component what kind of internal state changes are occurring.
124
+ */
125
+ onChange: PropTypes__default["default"].func,
126
+
127
+ /**
128
+ * An optional callback to render the currently selected item as a react element instead of only
129
+ * as a string.
130
+ */
131
+ renderSelectedItem: PropTypes__default["default"].func,
132
+
133
+ /**
134
+ * In the case you want to control the dropdown selection entirely.
135
+ */
136
+ selectedItem: PropTypes__default["default"].oneOfType([PropTypes__default["default"].object, PropTypes__default["default"].string, PropTypes__default["default"].number]),
137
+
138
+ /**
139
+ * Provide the title text that will be read by a screen reader when
140
+ * visiting this control
141
+ */
142
+ titleText: PropTypes__default["default"].node,
143
+
144
+ /**
145
+ * Callback function for translating ListBoxMenuIcon SVG title
146
+ */
147
+ translateWithId: PropTypes__default["default"].func,
148
+
149
+ /**
150
+ * Specify whether the control is currently in warning state
151
+ */
152
+ warn: PropTypes__default["default"].bool,
153
+
154
+ /**
155
+ * Provide the text that is displayed when the control is in warning state
156
+ */
157
+ warnText: PropTypes__default["default"].node
158
+ };
159
+ var FluidMultiSelect$1 = FluidMultiSelect;
160
+
161
+ exports["default"] = FluidMultiSelect$1;