@carbon/react 1.15.0 → 1.16.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 (71) hide show
  1. package/es/components/CodeSnippet/CodeSnippet.js +2 -2
  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/NumberInput/NumberInput.js +45 -1
  18. package/es/components/OverflowMenu/OverflowMenu.js +2 -2
  19. package/es/components/Pagination/Pagination.js +271 -270
  20. package/es/components/Pagination/index.js +1 -6
  21. package/es/components/ProgressIndicator/ProgressIndicator.Skeleton.js +10 -4
  22. package/es/components/Select/Select.js +23 -5
  23. package/es/components/TextArea/TextArea.js +2 -2
  24. package/es/components/TextInput/ControlledPasswordInput.js +2 -3
  25. package/es/components/TextInput/PasswordInput.js +3 -3
  26. package/es/components/TextInput/TextInput.js +7 -8
  27. package/es/components/Tile/next/Tile.js +18 -22
  28. package/es/components/Tooltip/next/DefinitionTooltip.js +11 -2
  29. package/es/components/UIShell/HeaderMenu.js +15 -4
  30. package/es/components/UIShell/SideNavMenu.js +2 -1
  31. package/es/index.js +14 -8
  32. package/es/internal/useNormalizedInputProps.js +15 -18
  33. package/lib/components/CodeSnippet/CodeSnippet.js +2 -2
  34. package/lib/components/ComboBox/ComboBox.js +44 -23
  35. package/lib/components/DataTable/TableHeader.js +1 -1
  36. package/lib/components/DatePicker/DatePicker.js +10 -8
  37. package/lib/components/Dropdown/Dropdown.js +2 -2
  38. package/lib/components/FluidComboBox/FluidComboBox.Skeleton.js +51 -0
  39. package/lib/components/FluidComboBox/FluidComboBox.js +150 -0
  40. package/lib/components/FluidMultiSelect/FluidMultiSelect.Skeleton.js +51 -0
  41. package/lib/components/FluidMultiSelect/FluidMultiSelect.js +161 -0
  42. package/lib/components/FluidSelect/FluidSelect.Skeleton.js +51 -0
  43. package/lib/components/FluidSelect/FluidSelect.js +103 -0
  44. package/lib/components/FluidTextArea/FluidTextArea.js +2 -1
  45. package/lib/components/InlineLoading/InlineLoading.js +2 -4
  46. package/lib/components/ListBox/ListBox.js +2 -1
  47. package/lib/components/MultiSelect/FilterableMultiSelect.js +40 -20
  48. package/lib/components/MultiSelect/MultiSelect.js +27 -11
  49. package/lib/components/NumberInput/NumberInput.js +45 -1
  50. package/lib/components/OverflowMenu/OverflowMenu.js +2 -2
  51. package/lib/components/Pagination/Pagination.js +269 -268
  52. package/lib/components/Pagination/index.js +2 -24
  53. package/lib/components/ProgressIndicator/ProgressIndicator.Skeleton.js +9 -3
  54. package/lib/components/Select/Select.js +21 -3
  55. package/lib/components/TextArea/TextArea.js +2 -2
  56. package/lib/components/TextInput/ControlledPasswordInput.js +2 -3
  57. package/lib/components/TextInput/PasswordInput.js +3 -3
  58. package/lib/components/TextInput/TextInput.js +7 -8
  59. package/lib/components/Tile/next/Tile.js +18 -22
  60. package/lib/components/Tooltip/next/DefinitionTooltip.js +11 -2
  61. package/lib/components/UIShell/HeaderMenu.js +15 -4
  62. package/lib/components/UIShell/SideNavMenu.js +2 -1
  63. package/lib/index.js +98 -86
  64. package/lib/internal/useNormalizedInputProps.js +14 -17
  65. package/package.json +4 -4
  66. package/scss/components/fluid-select/_fluid-select.scss +9 -0
  67. package/scss/components/fluid-select/_index.scss +9 -0
  68. package/es/components/FileUploader/index.js +0 -15
  69. package/es/components/Pagination/next/Pagination.js +0 -421
  70. package/lib/components/FileUploader/index.js +0 -39
  71. package/lib/components/Pagination/next/Pagination.js +0 -431
@@ -0,0 +1,41 @@
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 { objectWithoutProperties as _objectWithoutProperties, extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
9
+ import PropTypes from 'prop-types';
10
+ import React__default from 'react';
11
+ import cx from 'classnames';
12
+ import { usePrefix } from '../../internal/usePrefix.js';
13
+
14
+ var _excluded = ["className"];
15
+
16
+ var FluidSelectSkeleton = function FluidSelectSkeleton(_ref) {
17
+ var className = _ref.className,
18
+ rest = _objectWithoutProperties(_ref, _excluded);
19
+
20
+ var prefix = usePrefix();
21
+ var wrapperClasses = cx(className, "".concat(prefix, "--skeleton"), "".concat(prefix, "--list-box"));
22
+ return /*#__PURE__*/React__default.createElement("div", {
23
+ className: "".concat(prefix, "--list-box__wrapper--fluid")
24
+ }, /*#__PURE__*/React__default.createElement("div", _extends({
25
+ className: wrapperClasses
26
+ }, rest), /*#__PURE__*/React__default.createElement("span", {
27
+ className: "".concat(prefix, "--list-box__label")
28
+ }), /*#__PURE__*/React__default.createElement("div", {
29
+ className: "".concat(prefix, "--list-box__field")
30
+ })));
31
+ };
32
+
33
+ FluidSelectSkeleton.propTypes = {
34
+ /**
35
+ * Specify an optional className to add.
36
+ */
37
+ className: PropTypes.string
38
+ };
39
+ var FluidSelectSkeleton$1 = FluidSelectSkeleton;
40
+
41
+ export { FluidSelectSkeleton$1 as default };
@@ -0,0 +1,93 @@
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 { objectWithoutProperties as _objectWithoutProperties, extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
9
+ import PropTypes from 'prop-types';
10
+ import React__default from 'react';
11
+ import cx from 'classnames';
12
+ import Select from '../Select/Select.js';
13
+ import { usePrefix } from '../../internal/usePrefix.js';
14
+ import { FormContext } from '../FluidForm/FormContext.js';
15
+
16
+ var _excluded = ["className", "children"];
17
+ var FluidSelect = /*#__PURE__*/React__default.forwardRef(function FluidSelect(_ref, ref) {
18
+ var className = _ref.className,
19
+ children = _ref.children,
20
+ other = _objectWithoutProperties(_ref, _excluded);
21
+
22
+ var prefix = usePrefix();
23
+ var classNames = cx("".concat(prefix, "--select--fluid"), className);
24
+ return /*#__PURE__*/React__default.createElement(FormContext.Provider, {
25
+ value: {
26
+ isFluid: true
27
+ }
28
+ }, /*#__PURE__*/React__default.createElement(Select, _extends({
29
+ ref: ref,
30
+ className: classNames
31
+ }, other), children));
32
+ });
33
+ FluidSelect.propTypes = {
34
+ /**
35
+ * Provide the contents of your Select
36
+ */
37
+ children: PropTypes.node,
38
+
39
+ /**
40
+ * Specify an optional className to be applied to the node containing the label and the select box
41
+ */
42
+ className: PropTypes.string,
43
+
44
+ /**
45
+ * Optionally provide the default value of the `<select>`
46
+ */
47
+ defaultValue: PropTypes.any,
48
+
49
+ /**
50
+ * Specify whether the control is disabled
51
+ */
52
+ disabled: PropTypes.bool,
53
+
54
+ /**
55
+ * Specify a custom `id` for the `<select>`
56
+ */
57
+ id: PropTypes.string.isRequired,
58
+
59
+ /**
60
+ * Specify if the currently value is invalid.
61
+ */
62
+ invalid: PropTypes.bool,
63
+
64
+ /**
65
+ * Message which is displayed if the value is invalid.
66
+ */
67
+ invalidText: PropTypes.node,
68
+
69
+ /**
70
+ * Provide label text to be read by screen readers when interacting with the
71
+ * control
72
+ */
73
+ labelText: PropTypes.node,
74
+
75
+ /**
76
+ * Provide an optional `onChange` hook that is called each time the value of
77
+ * the underlying `<input>` changes
78
+ */
79
+ onChange: PropTypes.func,
80
+
81
+ /**
82
+ * Specify whether the control is currently in warning state
83
+ */
84
+ warn: PropTypes.bool,
85
+
86
+ /**
87
+ * Provide the text that is displayed when the control is in warning state
88
+ */
89
+ warnText: PropTypes.node
90
+ };
91
+ var FluidSelect$1 = FluidSelect;
92
+
93
+ export { FluidSelect$1 as default };
@@ -10,6 +10,7 @@ import PropTypes from 'prop-types';
10
10
  import React__default from 'react';
11
11
  import cx from 'classnames';
12
12
  import TextArea from '../TextArea/TextArea.js';
13
+ import deprecate from '../../prop-types/deprecate.js';
13
14
  import { usePrefix } from '../../internal/usePrefix.js';
14
15
  import { FormContext } from '../FluidForm/FormContext.js';
15
16
 
@@ -92,7 +93,7 @@ FluidTextArea.propTypes = {
92
93
  * `true` to use the light version. For use on $ui-01 backgrounds only.
93
94
  * Don't use this to make tile background color same as container background color.
94
95
  */
95
- light: PropTypes.bool,
96
+ light: deprecate(PropTypes.bool, 'The `light` prop for `FluidTextArea` has ' + 'been deprecated in favor of the new `Layer` component. It will be removed in the next major release.'),
96
97
 
97
98
  /**
98
99
  * Max character count allowed for the textarea. This is needed in order for enableCounter to display
@@ -21,7 +21,8 @@ function InlineLoading(_ref) {
21
21
  iconDescription = _ref.iconDescription,
22
22
  description = _ref.description,
23
23
  onSuccess = _ref.onSuccess,
24
- successDelay = _ref.successDelay,
24
+ _ref$successDelay = _ref.successDelay,
25
+ successDelay = _ref$successDelay === void 0 ? 1500 : _ref$successDelay,
25
26
  other = _objectWithoutProperties(_ref, _excluded);
26
27
 
27
28
  var prefix = usePrefix();
@@ -108,8 +109,5 @@ InlineLoading.propTypes = {
108
109
  */
109
110
  successDelay: PropTypes.number
110
111
  };
111
- InlineLoading.defaultProps = {
112
- successDelay: 1500
113
- };
114
112
 
115
113
  export { InlineLoading as default };
@@ -9,6 +9,7 @@ import { objectWithoutProperties as _objectWithoutProperties, defineProperty as
9
9
  import cx from 'classnames';
10
10
  import React__default, { useContext } from 'react';
11
11
  import PropTypes from 'prop-types';
12
+ import deprecate from '../../prop-types/deprecate.js';
12
13
  import { ListBoxSize, ListBoxType } from './ListBoxPropTypes.js';
13
14
  import { usePrefix } from '../../internal/usePrefix.js';
14
15
  import ListBoxField from './ListBoxField.js';
@@ -109,7 +110,7 @@ ListBox.propTypes = {
109
110
  * `true` to use the light version. For use on $ui-01 backgrounds only.
110
111
  * Don't use this to make tile background color same as container background color.
111
112
  */
112
- light: PropTypes.bool,
113
+ light: deprecate(PropTypes.bool, 'The `light` prop for `ListBox` has ' + 'been deprecated in favor of the new `Layer` component. It will be removed in the next major release.'),
113
114
 
114
115
  /**
115
116
  * Specify the size of the ListBox. Currently supports either `sm`, `md` or `lg` as an option.
@@ -11,17 +11,19 @@ import cx from 'classnames';
11
11
  import Downshift from 'downshift';
12
12
  import isEqual from 'lodash.isequal';
13
13
  import PropTypes from 'prop-types';
14
- import React__default, { useState, useRef } from 'react';
14
+ import React__default, { useContext, useState, useRef } from 'react';
15
15
  import { defaultFilterItems } from '../ComboBox/tools/filter.js';
16
16
  import { sortingPropTypes } from './MultiSelectPropTypes.js';
17
17
  import '../ListBox/index.js';
18
18
  import Selection from '../../internal/Selection.js';
19
19
  import { defaultItemToString } from './tools/itemToString.js';
20
20
  import mergeRefs from '../../tools/mergeRefs.js';
21
+ import deprecate from '../../prop-types/deprecate.js';
21
22
  import { useId } from '../../internal/useId.js';
22
23
  import { defaultCompareItems, defaultSortItems } from './tools/sorting.js';
23
24
  import { useFeatureFlag } from '../FeatureFlags/index.js';
24
25
  import { usePrefix } from '../../internal/usePrefix.js';
26
+ import { FormContext } from '../FluidForm/FormContext.js';
25
27
  import { match } from '../../internal/keyboard/match.js';
26
28
  import ListBoxSelection from '../ListBox/next/ListBoxSelection.js';
27
29
  import ListBoxTrigger from '../ListBox/next/ListBoxTrigger.js';
@@ -65,35 +67,43 @@ var FilterableMultiSelect = /*#__PURE__*/React__default.forwardRef(function Filt
65
67
  warn = _ref.warn,
66
68
  warnText = _ref.warnText;
67
69
 
68
- var _useState = useState(open),
70
+ var _useContext = useContext(FormContext),
71
+ isFluid = _useContext.isFluid;
72
+
73
+ var _useState = useState(false),
69
74
  _useState2 = _slicedToArray(_useState, 2),
70
- isOpen = _useState2[0],
71
- setIsOpen = _useState2[1];
75
+ isFocused = _useState2[0],
76
+ setIsFocused = _useState2[1];
72
77
 
73
78
  var _useState3 = useState(open),
74
79
  _useState4 = _slicedToArray(_useState3, 2),
75
- prevOpen = _useState4[0],
76
- setPrevOpen = _useState4[1];
80
+ isOpen = _useState4[0],
81
+ setIsOpen = _useState4[1];
77
82
 
78
- var _useState5 = useState(''),
83
+ var _useState5 = useState(open),
79
84
  _useState6 = _slicedToArray(_useState5, 2),
80
- inputValue = _useState6[0],
81
- setInputValue = _useState6[1];
85
+ prevOpen = _useState6[0],
86
+ setPrevOpen = _useState6[1];
82
87
 
83
- var _useState7 = useState([]),
88
+ var _useState7 = useState(''),
84
89
  _useState8 = _slicedToArray(_useState7, 2),
85
- topItems = _useState8[0],
86
- setTopItems = _useState8[1];
90
+ inputValue = _useState8[0],
91
+ setInputValue = _useState8[1];
87
92
 
88
- var _useState9 = useState(false),
93
+ var _useState9 = useState([]),
89
94
  _useState10 = _slicedToArray(_useState9, 2),
90
- inputFocused = _useState10[0],
91
- setInputFocused = _useState10[1];
95
+ topItems = _useState10[0],
96
+ setTopItems = _useState10[1];
92
97
 
93
- var _useState11 = useState(null),
98
+ var _useState11 = useState(false),
94
99
  _useState12 = _slicedToArray(_useState11, 2),
95
- highlightedIndex = _useState12[0],
96
- setHighlightedIndex = _useState12[1];
100
+ inputFocused = _useState12[0],
101
+ setInputFocused = _useState12[1];
102
+
103
+ var _useState13 = useState(null),
104
+ _useState14 = _slicedToArray(_useState13, 2),
105
+ highlightedIndex = _useState14[0],
106
+ setHighlightedIndex = _useState14[1];
97
107
 
98
108
  var textInput = useRef();
99
109
  var filterableMultiSelectInstanceId = useId();
@@ -107,7 +117,7 @@ var FilterableMultiSelect = /*#__PURE__*/React__default.forwardRef(function Filt
107
117
 
108
118
  var inline = type === 'inline';
109
119
  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));
120
+ 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'), _defineProperty(_cx, "".concat(prefix, "--list-box__wrapper--fluid--invalid"), isFluid && invalid), _defineProperty(_cx, "".concat(prefix, "--list-box__wrapper--fluid--focus"), isFluid && isFocused), _cx));
111
121
  var helperId = !helperText ? undefined : "filterablemultiselect-helper-text-".concat(filterableMultiSelectInstanceId);
112
122
  var labelId = "".concat(id, "-label");
113
123
  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));
@@ -297,11 +307,22 @@ var FilterableMultiSelect = /*#__PURE__*/React__default.forwardRef(function Filt
297
307
  }, {
298
308
  suppressRefError: true
299
309
  });
310
+
311
+ var handleFocus = function handleFocus(evt) {
312
+ if (evt.target.classList.contains("".concat(prefix, "--tag__close-icon")) || evt.target.classList.contains("".concat(prefix, "--list-box__selection"))) {
313
+ setIsFocused(false);
314
+ } else {
315
+ setIsFocused(evt.type === 'focus' ? true : false);
316
+ }
317
+ };
318
+
300
319
  return /*#__PURE__*/React__default.createElement("div", {
301
320
  className: wrapperClasses
302
321
  }, titleText ? /*#__PURE__*/React__default.createElement("label", _extends({
303
322
  className: titleClasses
304
323
  }, labelProps), titleText) : null, /*#__PURE__*/React__default.createElement(ListBox, {
324
+ onFocus: isFluid ? handleFocus : null,
325
+ onBlur: isFluid ? handleFocus : null,
305
326
  className: className,
306
327
  disabled: disabled,
307
328
  light: light,
@@ -459,7 +480,7 @@ FilterableMultiSelect.propTypes = _objectSpread2(_objectSpread2({
459
480
  /**
460
481
  * `true` to use the light version.
461
482
  */
462
- light: PropTypes.bool,
483
+ light: deprecate(PropTypes.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.'),
463
484
 
464
485
  /**
465
486
  * Specify the locale of the control. Used for the default `compareItems`
@@ -539,7 +560,6 @@ FilterableMultiSelect.defaultProps = {
539
560
  itemToString: defaultItemToString,
540
561
  locale: 'en',
541
562
  sortItems: defaultSortItems,
542
- light: false,
543
563
  open: false,
544
564
  selectionFeedback: 'top-after-reopen'
545
565
  };
@@ -11,7 +11,7 @@ import cx from 'classnames';
11
11
  import Downshift, { useSelect } from 'downshift';
12
12
  import isEqual from 'lodash.isequal';
13
13
  import PropTypes from 'prop-types';
14
- import React__default, { useRef, useState } from 'react';
14
+ import React__default, { useContext, useRef, useState } from 'react';
15
15
  import '../ListBox/index.js';
16
16
  import { sortingPropTypes } from './MultiSelectPropTypes.js';
17
17
  import { defaultItemToString } from './tools/itemToString.js';
@@ -19,8 +19,10 @@ import { defaultCompareItems, defaultSortItems } from './tools/sorting.js';
19
19
  import { useSelection } from '../../internal/Selection.js';
20
20
  import setupGetInstanceId from '../../tools/setupGetInstanceId.js';
21
21
  import mergeRefs from '../../tools/mergeRefs.js';
22
+ import deprecate from '../../prop-types/deprecate.js';
22
23
  import { useFeatureFlag } from '../FeatureFlags/index.js';
23
24
  import { usePrefix } from '../../internal/usePrefix.js';
25
+ import { FormContext } from '../FluidForm/FormContext.js';
24
26
  import { match } from '../../internal/keyboard/match.js';
25
27
  import ListBox from '../ListBox/ListBox.js';
26
28
  import { ListBoxSize } from '../ListBox/ListBoxPropTypes.js';
@@ -74,6 +76,9 @@ var MultiSelect = /*#__PURE__*/React__default.forwardRef(function MultiSelect(_r
74
76
  selected = _ref.selectedItems;
75
77
  var prefix = usePrefix();
76
78
 
79
+ var _useContext = useContext(FormContext),
80
+ isFluid = _useContext.isFluid;
81
+
77
82
  var _useRef = useRef(getInstanceId()),
78
83
  multiSelectInstanceId = _useRef.current;
79
84
 
@@ -82,20 +87,25 @@ var MultiSelect = /*#__PURE__*/React__default.forwardRef(function MultiSelect(_r
82
87
  highlightedIndex = _useState2[0],
83
88
  setHighlightedIndex = _useState2[1];
84
89
 
85
- var _useState3 = useState(open),
90
+ var _useState3 = useState(false),
86
91
  _useState4 = _slicedToArray(_useState3, 2),
87
- isOpen = _useState4[0],
88
- setIsOpen = _useState4[1];
92
+ isFocused = _useState4[0],
93
+ setIsFocused = _useState4[1];
89
94
 
90
95
  var _useState5 = useState(open),
91
96
  _useState6 = _slicedToArray(_useState5, 2),
92
- prevOpenProp = _useState6[0],
93
- setPrevOpenProp = _useState6[1];
97
+ isOpen = _useState6[0],
98
+ setIsOpen = _useState6[1];
94
99
 
95
- var _useState7 = useState([]),
100
+ var _useState7 = useState(open),
96
101
  _useState8 = _slicedToArray(_useState7, 2),
97
- topItems = _useState8[0],
98
- setTopItems = _useState8[1];
102
+ prevOpenProp = _useState8[0],
103
+ setPrevOpenProp = _useState8[1];
104
+
105
+ var _useState9 = useState([]),
106
+ _useState10 = _slicedToArray(_useState9, 2),
107
+ topItems = _useState10[0],
108
+ setTopItems = _useState10[1];
99
109
 
100
110
  var _useSelection = useSelection({
101
111
  disabled: disabled,
@@ -149,7 +159,7 @@ var MultiSelect = /*#__PURE__*/React__default.forwardRef(function MultiSelect(_r
149
159
  var inline = type === 'inline';
150
160
  var showWarning = !invalid && warn;
151
161
  var enabled = useFeatureFlag('enable-v11-release');
152
- 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), _cx));
162
+ 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__wrapper--fluid--invalid"), isFluid && invalid), _defineProperty(_cx, "".concat(prefix, "--list-box__wrapper--fluid--focus"), !isOpen && isFluid && isFocused), _cx));
153
163
  var titleClasses = cx("".concat(prefix, "--label"), (_cx2 = {}, _defineProperty(_cx2, "".concat(prefix, "--label--disabled"), disabled), _defineProperty(_cx2, "".concat(prefix, "--visually-hidden"), hideLabel), _cx2));
154
164
  var helperId = !helperText ? undefined : "multiselect-helper-text-".concat(multiSelectInstanceId);
155
165
  var fieldLabelId = "multiselect-field-label-".concat(multiSelectInstanceId);
@@ -214,6 +224,11 @@ var MultiSelect = /*#__PURE__*/React__default.forwardRef(function MultiSelect(_r
214
224
  };
215
225
 
216
226
  var toggleButtonProps = getToggleButtonProps();
227
+
228
+ var handleFocus = function handleFocus(evt) {
229
+ evt.target.classList.contains("".concat(prefix, "--tag__close-icon")) ? setIsFocused(false) : setIsFocused(evt.type === 'focus' ? true : false);
230
+ };
231
+
217
232
  return /*#__PURE__*/React__default.createElement("div", {
218
233
  className: wrapperClasses
219
234
  }, /*#__PURE__*/React__default.createElement("label", _extends({
@@ -221,6 +236,8 @@ var MultiSelect = /*#__PURE__*/React__default.forwardRef(function MultiSelect(_r
221
236
  }, getLabelProps()), titleText && titleText, selectedItems.length > 0 && /*#__PURE__*/React__default.createElement("span", {
222
237
  className: "".concat(prefix, "--visually-hidden")
223
238
  }, clearSelectionDescription, " ", selectedItems.length, ",", clearSelectionText)), /*#__PURE__*/React__default.createElement(ListBox, {
239
+ onFocus: isFluid ? handleFocus : null,
240
+ onBlur: isFluid ? handleFocus : null,
224
241
  type: type,
225
242
  size: size,
226
243
  className: className,
@@ -371,7 +388,7 @@ MultiSelect.propTypes = _objectSpread2(_objectSpread2({}, sortingPropTypes), {},
371
388
  /**
372
389
  * `true` to use the light version.
373
390
  */
374
- light: PropTypes.bool,
391
+ light: deprecate(PropTypes.bool, 'The `light` prop for `MultiSelect` has ' + 'been deprecated in favor of the new `Layer` component. It will be removed in the next major release.'),
375
392
 
376
393
  /**
377
394
  * Specify the locale of the control. Used for the default `compareItems`
@@ -453,7 +470,6 @@ MultiSelect.defaultProps = {
453
470
  initialSelectedItems: [],
454
471
  sortItems: defaultSortItems,
455
472
  type: 'default',
456
- light: false,
457
473
  title: false,
458
474
  open: false,
459
475
  selectionFeedback: 'top-after-reopen',
@@ -16,7 +16,7 @@ import { useNormalizedInputProps } from '../../internal/useNormalizedInputProps.
16
16
  import { usePrefix } from '../../internal/usePrefix.js';
17
17
  import deprecate from '../../prop-types/deprecate.js';
18
18
 
19
- var _excluded = ["allowEmpty", "className", "disabled", "defaultValue", "helperText", "hideLabel", "hideSteppers", "iconDescription", "id", "label", "invalid", "invalidText", "light", "max", "min", "onChange", "onClick", "onKeyUp", "readOnly", "size", "step", "translateWithId", "warn", "warnText", "value"];
19
+ var _excluded = ["allowEmpty", "className", "disabled", "disableWheel", "defaultValue", "helperText", "hideLabel", "hideSteppers", "iconDescription", "id", "label", "invalid", "invalidText", "light", "max", "min", "onChange", "onClick", "onKeyUp", "readOnly", "size", "step", "translateWithId", "warn", "warnText", "value"];
20
20
 
21
21
  var _defaultTranslations, _Subtract, _Add;
22
22
  var translationIds = {
@@ -34,6 +34,8 @@ var NumberInput = /*#__PURE__*/React__default.forwardRef(function NumberInput(pr
34
34
  customClassName = props.className,
35
35
  _props$disabled = props.disabled,
36
36
  disabled = _props$disabled === void 0 ? false : _props$disabled,
37
+ _props$disableWheel = props.disableWheel,
38
+ disableWheelProp = _props$disableWheel === void 0 ? false : _props$disableWheel,
37
39
  defaultValue = props.defaultValue,
38
40
  _props$helperText = props.helperText,
39
41
  helperText = _props$helperText === void 0 ? '' : _props$helperText,
@@ -172,6 +174,24 @@ var NumberInput = /*#__PURE__*/React__default.forwardRef(function NumberInput(pr
172
174
  onClick: _onClick,
173
175
  onChange: handleOnChange,
174
176
  onKeyUp: onKeyUp,
177
+ onFocus: function onFocus(e) {
178
+ if (disableWheelProp) {
179
+ e.target.addEventListener('wheel', disableWheel);
180
+ }
181
+
182
+ if (rest.onFocus) {
183
+ rest.onFocus(e);
184
+ }
185
+ },
186
+ onBlur: function onBlur(e) {
187
+ if (disableWheelProp) {
188
+ e.target.removeEventListener('wheel', disableWheel);
189
+ }
190
+
191
+ if (rest.onBlur) {
192
+ rest.onBlur(e);
193
+ }
194
+ },
175
195
  pattern: "[0-9]*",
176
196
  readOnly: readOnly,
177
197
  step: step,
@@ -254,6 +274,11 @@ NumberInput.propTypes = {
254
274
  */
255
275
  defaultValue: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
256
276
 
277
+ /**
278
+ * Specify if the wheel functionality for the input should be disabled, or not
279
+ */
280
+ disableWheel: PropTypes.bool,
281
+
257
282
  /**
258
283
  * Specify if the control should be disabled, or not
259
284
  */
@@ -449,6 +474,25 @@ function getInputValidity(_ref4) {
449
474
 
450
475
  return true;
451
476
  }
477
+ /**
478
+ * It prevents any wheel event from emitting.
479
+ *
480
+ * We want to prevent this input field from changing by the user accidentally
481
+ * when the user scrolling up or down in a long form. So we prevent the default
482
+ * behavior of wheel events when it is focused.
483
+ *
484
+ * Because React uses passive event handler by default, we can't just call
485
+ * `preventDefault` in the `onWheel` event handler. So we have to get the input
486
+ * ref and add our event handler manually.
487
+ *
488
+ * @see https://github.com/facebook/react/pull/19654
489
+ * @param {WheelEvent} e A wheel event.
490
+ */
491
+
492
+
493
+ function disableWheel(e) {
494
+ e.preventDefault();
495
+ }
452
496
  /**
453
497
  * Clamp the given value between the upper bound `max` and the lower bound `min`
454
498
  * @param {number} max
@@ -496,8 +496,8 @@ _defineProperty(OverflowMenu, "propTypes", {
496
496
  _defineProperty(OverflowMenu, "contextType", PrefixContext);
497
497
 
498
498
  _defineProperty(OverflowMenu, "defaultProps", {
499
- ariaLabel: FeatureFlags.enabled('enable-v11-release') ? null : 'open and close list of options',
500
- iconDescription: 'open and close list of options',
499
+ ariaLabel: FeatureFlags.enabled('enable-v11-release') ? null : 'Open and close list of options',
500
+ iconDescription: 'Open and close list of options',
501
501
  open: false,
502
502
  direction: DIRECTION_BOTTOM,
503
503
  flipped: false,