@carbon/react 1.101.0-rc.0 → 1.102.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 (162) hide show
  1. package/.playwright/INTERNAL_AVT_REPORT_DO_NOT_USE.json +1009 -974
  2. package/es/components/Accordion/AccordionItem.js +8 -6
  3. package/es/components/ComboBox/ComboBox.js +10 -5
  4. package/es/components/ComposedModal/ComposedModal.js +0 -1
  5. package/es/components/ContainedList/ContainedList.d.ts +1 -1
  6. package/es/components/ContainedList/ContainedList.js +9 -34
  7. package/es/components/ContentSwitcher/ContentSwitcher.d.ts +3 -3
  8. package/es/components/ContentSwitcher/ContentSwitcher.js +1 -2
  9. package/es/components/DataTable/DataTable.d.ts +6 -2
  10. package/es/components/DataTable/DataTable.js +3 -1
  11. package/es/components/DataTable/Table.js +1 -1
  12. package/es/components/DataTable/TableToolbarSearch.d.ts +11 -2
  13. package/es/components/DataTable/TableToolbarSearch.js +10 -3
  14. package/es/components/DataTable/stories/examples/TableToolbarFilter.d.ts +3 -0
  15. package/es/components/DataTableSkeleton/DataTableSkeleton.d.ts +2 -12
  16. package/es/components/DataTableSkeleton/DataTableSkeleton.js +1 -8
  17. package/es/components/DatePicker/DatePicker.js +4 -1
  18. package/es/components/DatePickerInput/DatePickerInput.d.ts +2 -5
  19. package/es/components/DatePickerInput/DatePickerInput.js +2 -13
  20. package/es/components/Dropdown/Dropdown.js +5 -4
  21. package/es/components/ExpandableSearch/ExpandableSearch.js +2 -1
  22. package/es/components/ExpandableSearch/index.js +12 -0
  23. package/es/components/FluidSelect/FluidSelect.d.ts +3 -3
  24. package/es/components/FluidTextArea/FluidTextArea.d.ts +2 -4
  25. package/es/components/FluidTextArea/FluidTextArea.js +1 -2
  26. package/es/components/FluidTimePickerSelect/FluidTimePickerSelect.d.ts +3 -3
  27. package/es/components/Grid/Column.d.ts +1 -1
  28. package/es/components/Grid/Column.js +2 -2
  29. package/es/components/ListBox/test-helpers.d.ts +71 -0
  30. package/es/components/Loading/Loading.d.ts +1 -1
  31. package/es/components/Loading/Loading.js +3 -1
  32. package/es/components/Menu/Menu.d.ts +1 -1
  33. package/es/components/Menu/Menu.js +6 -2
  34. package/es/components/Menu/MenuItem.js +2 -2
  35. package/es/components/Modal/Modal.js +0 -1
  36. package/es/components/MultiSelect/FilterableMultiSelect.js +5 -4
  37. package/es/components/MultiSelect/MultiSelect.js +6 -9
  38. package/es/components/MultiSelect/MultiSelectPropTypes.d.ts +6 -8
  39. package/es/components/MultiSelect/tools/sorting.d.ts +16 -9
  40. package/es/components/MultiSelect/tools/sorting.js +10 -14
  41. package/es/components/NumberInput/NumberInput.js +1 -1
  42. package/es/components/OverflowMenu/OverflowMenu.js +1 -0
  43. package/es/components/OverflowMenuItem/OverflowMenuItem.d.ts +5 -1
  44. package/es/components/OverflowMenuItem/OverflowMenuItem.js +12 -2
  45. package/es/components/Popover/index.js +4 -4
  46. package/es/components/ProgressIndicator/ProgressIndicator.d.ts +1 -1
  47. package/es/components/ProgressIndicator/ProgressIndicator.js +1 -1
  48. package/es/components/RadioButtonGroup/RadioButtonGroup.d.ts +1 -1
  49. package/es/components/RadioButtonGroup/RadioButtonGroup.js +8 -11
  50. package/es/components/Search/Search.d.ts +1 -1
  51. package/es/components/Search/Search.js +3 -2
  52. package/es/components/Search/utils.d.ts +7 -0
  53. package/es/components/Search/utils.js +10 -0
  54. package/es/components/Select/Select.d.ts +2 -2
  55. package/es/components/Select/Select.js +2 -2
  56. package/es/components/SelectItem/SelectItem.d.ts +3 -3
  57. package/es/components/StructuredList/StructuredList.js +2 -2
  58. package/es/components/Tabs/Tabs.js +9 -4
  59. package/es/components/Tag/DismissibleTag.d.ts +1 -1
  60. package/es/components/Tag/DismissibleTag.js +2 -2
  61. package/es/components/Tag/OperationalTag.d.ts +1 -1
  62. package/es/components/Tag/OperationalTag.js +2 -2
  63. package/es/components/Tag/SelectableTag.d.ts +1 -1
  64. package/es/components/Tag/SelectableTag.js +2 -2
  65. package/es/components/Tag/Tag.d.ts +1 -1
  66. package/es/components/Tag/Tag.js +2 -2
  67. package/es/components/TextArea/TextArea.d.ts +2 -3
  68. package/es/components/TextArea/TextArea.js +4 -5
  69. package/es/components/TextInput/ControlledPasswordInput.js +1 -1
  70. package/es/components/TimePickerSelect/TimePickerSelect.d.ts +4 -4
  71. package/es/components/Toggletip/index.js +1 -2
  72. package/es/components/TreeView/TreeNode.js +2 -2
  73. package/es/components/TreeView/TreeView.d.ts +1 -1
  74. package/es/components/UIShell/HeaderPanel.d.ts +1 -1
  75. package/es/components/UIShell/HeaderPanel.js +4 -2
  76. package/es/components/UIShell/SideNav.js +3 -3
  77. package/es/components/UIShell/Switcher.d.ts +1 -1
  78. package/es/components/UIShell/Switcher.js +1 -1
  79. package/es/feature-flags.js +2 -2
  80. package/es/internal/FloatingMenu.js +3 -3
  81. package/lib/components/Accordion/AccordionItem.js +7 -5
  82. package/lib/components/ComboBox/ComboBox.js +10 -5
  83. package/lib/components/ComposedModal/ComposedModal.js +0 -1
  84. package/lib/components/ContainedList/ContainedList.d.ts +1 -1
  85. package/lib/components/ContainedList/ContainedList.js +9 -34
  86. package/lib/components/ContentSwitcher/ContentSwitcher.d.ts +3 -3
  87. package/lib/components/ContentSwitcher/ContentSwitcher.js +1 -2
  88. package/lib/components/DataTable/DataTable.d.ts +6 -2
  89. package/lib/components/DataTable/DataTable.js +3 -1
  90. package/lib/components/DataTable/Table.js +1 -1
  91. package/lib/components/DataTable/TableToolbarSearch.d.ts +11 -2
  92. package/lib/components/DataTable/TableToolbarSearch.js +10 -3
  93. package/lib/components/DataTable/stories/examples/TableToolbarFilter.d.ts +3 -0
  94. package/lib/components/DataTableSkeleton/DataTableSkeleton.d.ts +2 -12
  95. package/lib/components/DataTableSkeleton/DataTableSkeleton.js +1 -8
  96. package/lib/components/DatePicker/DatePicker.js +4 -1
  97. package/lib/components/DatePickerInput/DatePickerInput.d.ts +2 -5
  98. package/lib/components/DatePickerInput/DatePickerInput.js +2 -13
  99. package/lib/components/Dropdown/Dropdown.js +5 -4
  100. package/lib/components/ExpandableSearch/ExpandableSearch.js +2 -1
  101. package/lib/components/ExpandableSearch/index.js +17 -0
  102. package/lib/components/FeatureFlags/index.js +5 -5
  103. package/lib/components/FluidSelect/FluidSelect.d.ts +3 -3
  104. package/lib/components/FluidTextArea/FluidTextArea.d.ts +2 -4
  105. package/lib/components/FluidTextArea/FluidTextArea.js +1 -2
  106. package/lib/components/FluidTimePickerSelect/FluidTimePickerSelect.d.ts +3 -3
  107. package/lib/components/Grid/Column.d.ts +1 -1
  108. package/lib/components/Grid/Column.js +2 -21
  109. package/lib/components/ListBox/test-helpers.d.ts +71 -0
  110. package/lib/components/Loading/Loading.d.ts +1 -1
  111. package/lib/components/Loading/Loading.js +3 -1
  112. package/lib/components/Menu/Menu.d.ts +1 -1
  113. package/lib/components/Menu/Menu.js +6 -2
  114. package/lib/components/Menu/MenuItem.js +2 -2
  115. package/lib/components/Modal/Modal.js +0 -1
  116. package/lib/components/MultiSelect/FilterableMultiSelect.js +5 -4
  117. package/lib/components/MultiSelect/MultiSelect.js +6 -9
  118. package/lib/components/MultiSelect/MultiSelectPropTypes.d.ts +6 -8
  119. package/lib/components/MultiSelect/tools/sorting.d.ts +16 -9
  120. package/lib/components/MultiSelect/tools/sorting.js +10 -14
  121. package/lib/components/NumberInput/NumberInput.js +1 -1
  122. package/lib/components/OverflowMenu/OverflowMenu.js +1 -0
  123. package/lib/components/OverflowMenuItem/OverflowMenuItem.d.ts +5 -1
  124. package/lib/components/OverflowMenuItem/OverflowMenuItem.js +12 -2
  125. package/lib/components/Popover/index.js +4 -4
  126. package/lib/components/ProgressIndicator/ProgressIndicator.d.ts +1 -1
  127. package/lib/components/ProgressIndicator/ProgressIndicator.js +1 -1
  128. package/lib/components/RadioButtonGroup/RadioButtonGroup.d.ts +1 -1
  129. package/lib/components/RadioButtonGroup/RadioButtonGroup.js +7 -10
  130. package/lib/components/Search/Search.d.ts +1 -1
  131. package/lib/components/Search/Search.js +3 -2
  132. package/lib/components/Search/utils.d.ts +7 -0
  133. package/lib/components/Search/utils.js +12 -0
  134. package/lib/components/Select/Select.d.ts +2 -2
  135. package/lib/components/Select/Select.js +2 -2
  136. package/lib/components/SelectItem/SelectItem.d.ts +3 -3
  137. package/lib/components/StructuredList/StructuredList.js +2 -2
  138. package/lib/components/Tabs/Tabs.js +9 -4
  139. package/lib/components/Tag/DismissibleTag.d.ts +1 -1
  140. package/lib/components/Tag/DismissibleTag.js +2 -2
  141. package/lib/components/Tag/OperationalTag.d.ts +1 -1
  142. package/lib/components/Tag/OperationalTag.js +2 -2
  143. package/lib/components/Tag/SelectableTag.d.ts +1 -1
  144. package/lib/components/Tag/SelectableTag.js +2 -2
  145. package/lib/components/Tag/Tag.d.ts +1 -1
  146. package/lib/components/Tag/Tag.js +2 -2
  147. package/lib/components/TextArea/TextArea.d.ts +2 -3
  148. package/lib/components/TextArea/TextArea.js +4 -5
  149. package/lib/components/TextInput/ControlledPasswordInput.js +1 -1
  150. package/lib/components/TimePickerSelect/TimePickerSelect.d.ts +4 -4
  151. package/lib/components/Toggletip/index.js +1 -2
  152. package/lib/components/TreeView/TreeNode.js +2 -2
  153. package/lib/components/TreeView/TreeView.d.ts +1 -1
  154. package/lib/components/UIShell/HeaderPanel.d.ts +1 -1
  155. package/lib/components/UIShell/HeaderPanel.js +4 -2
  156. package/lib/components/UIShell/SideNav.js +3 -3
  157. package/lib/components/UIShell/Switcher.d.ts +1 -1
  158. package/lib/components/UIShell/Switcher.js +1 -1
  159. package/lib/feature-flags.js +2 -21
  160. package/lib/internal/FloatingMenu.js +3 -22
  161. package/package.json +10 -10
  162. package/telemetry.yml +0 -1
@@ -30,6 +30,13 @@ const defaultTranslations = {
30
30
  const defaultTranslateWithId = messageId => {
31
31
  return defaultTranslations[messageId];
32
32
  };
33
+
34
+ /**
35
+ * @deprecated Passing `''` as the event sentinel is legacy compatibility
36
+ * behavior for `DataTable` filtering. In the next major release, this type
37
+ * should become an optional `ChangeEvent<HTMLInputElement>` instead.
38
+ */
39
+
33
40
  const TableToolbarSearch = ({
34
41
  className,
35
42
  searchContainerClass,
@@ -68,14 +75,14 @@ const TableToolbarSearch = ({
68
75
  }, [focusTarget]);
69
76
  React.useEffect(() => {
70
77
  if (defaultValue) {
78
+ // TODO: Remove the `''` event sentinel and pass `undefined` for
79
+ // value initialization in the next major release.
71
80
  onChangeProp?.('', defaultValue);
72
81
  }
73
82
  },
74
83
  //eslint-disable-next-line react-hooks/exhaustive-deps
75
84
  []);
76
- const searchClasses = cx(className, {
77
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
78
- [searchContainerClass]: searchContainerClass,
85
+ const searchClasses = cx(className, searchContainerClass, {
79
86
  [`${prefix}--toolbar-search-container-active`]: expanded,
80
87
  [`${prefix}--toolbar-search-container-disabled`]: disabled,
81
88
  [`${prefix}--toolbar-search-container-expandable`]: !persistent,
@@ -12,6 +12,9 @@ interface TableToolbarFilterProps {
12
12
  className?: string;
13
13
  /**
14
14
  * Provide an optional hook that is called each time the input is updated
15
+ *
16
+ * Note: the `''` event sentinel exists for `DataTable` compatibility and
17
+ * should be removed in the next major release.
15
18
  */
16
19
  onChange?: (event: '' | ChangeEvent<HTMLInputElement>) => void;
17
20
  /**
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright IBM Corp. 2016, 2025
2
+ * Copyright IBM Corp. 2016, 2026
3
3
  *
4
4
  * This source code is licensed under the Apache-2.0 license found in the
5
5
  * LICENSE file in the root directory of this source tree.
@@ -22,11 +22,6 @@ export interface DataTableSkeletonProps extends TableHTMLAttributes<HTMLTableEle
22
22
  * Specify the number of columns that you want to render in the skeleton state
23
23
  */
24
24
  columnCount?: number;
25
- /**
26
- * Optionally specify whether you want the Skeleton to be rendered as a
27
- * compact DataTable
28
- */
29
- compact?: boolean;
30
25
  /**
31
26
  * Optionally specify the displayed headers
32
27
  */
@@ -57,7 +52,7 @@ export interface DataTableSkeletonProps extends TableHTMLAttributes<HTMLTableEle
57
52
  className?: string;
58
53
  }
59
54
  declare const DataTableSkeleton: {
60
- ({ headers, rowCount, columnCount, zebra, compact, className, showHeader, showToolbar, size, ...rest }: DataTableSkeletonProps): import("react/jsx-runtime").JSX.Element;
55
+ ({ headers, rowCount, columnCount, zebra, className, showHeader, showToolbar, size, ...rest }: DataTableSkeletonProps): import("react/jsx-runtime").JSX.Element;
61
56
  propTypes: {
62
57
  /**
63
58
  * Specify an optional className to add.
@@ -67,11 +62,6 @@ declare const DataTableSkeleton: {
67
62
  * Specify the number of columns that you want to render in the skeleton state
68
63
  */
69
64
  columnCount: PropTypes.Requireable<number>;
70
- /**
71
- * Optionally specify whether you want the Skeleton to be rendered as a
72
- * compact DataTable
73
- */
74
- compact: PropTypes.Requireable<boolean>;
75
65
  /**
76
66
  * Optionally specify the displayed headers
77
67
  */
@@ -21,7 +21,6 @@ const DataTableSkeleton = ({
21
21
  rowCount = 5,
22
22
  columnCount = 5,
23
23
  zebra = false,
24
- compact = false,
25
24
  className,
26
25
  showHeader = true,
27
26
  showToolbar = true,
@@ -33,8 +32,7 @@ const DataTableSkeleton = ({
33
32
  [`${prefix}--skeleton`]: true,
34
33
  [`${prefix}--data-table`]: true,
35
34
  [`${prefix}--data-table--${size}`]: size,
36
- [`${prefix}--data-table--zebra`]: zebra,
37
- [`${prefix}--data-table--compact`]: compact
35
+ [`${prefix}--data-table--zebra`]: zebra
38
36
  });
39
37
  const rowRepeat = rowCount;
40
38
  const rows = Array(rowRepeat);
@@ -80,11 +78,6 @@ DataTableSkeleton.propTypes = {
80
78
  * Specify the number of columns that you want to render in the skeleton state
81
79
  */
82
80
  columnCount: PropTypes.number,
83
- /**
84
- * Optionally specify whether you want the Skeleton to be rendered as a
85
- * compact DataTable
86
- */
87
- compact: PropTypes.bool,
88
81
  /**
89
82
  * Optionally specify the displayed headers
90
83
  */
@@ -433,7 +433,10 @@ const DatePicker = /*#__PURE__*/React.forwardRef((props, ref) => {
433
433
  calendarContainer.classList.add('open');
434
434
  const selectedDateElem = calendarContainer.querySelector('.selected') && fpSelectedDateElem;
435
435
  const todayDateElem = calendarContainer.querySelector('.today') && fpTodayDateElem;
436
- (selectedDateElem || todayDateElem || calendarContainer.querySelector('.flatpickr-day[tabindex]') || calendarContainer).focus();
436
+ const focusTarget = selectedDateElem || todayDateElem || calendarContainer.querySelector('.flatpickr-day[tabindex]') || calendarContainer;
437
+ if (focusTarget instanceof HTMLElement) {
438
+ focusTarget.focus();
439
+ }
437
440
  if (event.target === startInputField.current) {
438
441
  lastFocusedField.current = startInputField.current;
439
442
  } else if (event.target === endInputField.current) {
@@ -61,12 +61,9 @@ export interface DatePickerInputProps extends Omit<HTMLAttributes<HTMLInputEleme
61
61
  */
62
62
  onClick?: func;
63
63
  /**
64
- * Provide a regular expression that the input value must match
65
- * TODO:need to be rewritten
64
+ * Provide a regular expression pattern string that the input value must match
66
65
  */
67
- pattern?: (props: {
68
- [key: string]: any;
69
- }, propName: string, componentName: string) => null | any | Error;
66
+ pattern?: string;
70
67
  /**
71
68
  * Specify the placeholder text
72
69
  */
@@ -208,20 +208,9 @@ DatePickerInput.propTypes = {
208
208
  */
209
209
  onClick: PropTypes.func,
210
210
  /**
211
- * Provide a regular expression that the input value must match
211
+ * Provide a regular expression pattern string that the input value must match
212
212
  */
213
- // eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20452
214
- pattern: (props, propName, componentName) => {
215
- if (props[propName] === undefined) {
216
- return;
217
- }
218
- try {
219
- new RegExp(props[propName]);
220
- // eslint-disable-next-line @typescript-eslint/no-unused-vars -- https://github.com/carbon-design-system/carbon/issues/20452
221
- } catch (e) {
222
- return new Error(`Invalid value of prop '${propName}' supplied to '${componentName}', it should be a valid regular expression`);
223
- }
224
- },
213
+ pattern: PropTypes.string,
225
214
  /**
226
215
  * Specify the placeholder text
227
216
  */
@@ -61,6 +61,7 @@ function stateReducer(state, actionAndChanges) {
61
61
  } = actionAndChanges;
62
62
  switch (type) {
63
63
  case ItemMouseMove:
64
+ return state;
64
65
  case MenuMouseLeave:
65
66
  if (changes.highlightedIndex === state.highlightedIndex) {
66
67
  // Prevent state update if highlightedIndex hasn't changed
@@ -264,7 +265,7 @@ const Dropdown = /*#__PURE__*/React.forwardRef(({
264
265
  className: helperClasses
265
266
  }, helperText) : null;
266
267
  const handleFocus = evt => {
267
- setIsFocused(evt.type === 'focus' && !selectedItem ? true : false);
268
+ setIsFocused(evt.type === 'focus' && !selectedItem);
268
269
  };
269
270
  const buttonRef = React.useRef(null);
270
271
  const mergedRef = mergeRefs.mergeRefs(toggleButtonProps.ref, ref, buttonRef);
@@ -353,10 +354,10 @@ const Dropdown = /*#__PURE__*/React.forwardRef(({
353
354
  size: size,
354
355
  className: className,
355
356
  invalid: normalizedProps.invalid,
356
- invalidText: isFluid ? invalidText : undefined,
357
+ invalidText: invalidText,
357
358
  invalidTextId: normalizedProps.invalidId,
358
359
  warn: normalizedProps.warn,
359
- warnText: isFluid ? warnText : undefined,
360
+ warnText: warnText,
360
361
  warnTextId: normalizedProps.warnId,
361
362
  light: light,
362
363
  isOpen: isOpen,
@@ -402,7 +403,7 @@ const Dropdown = /*#__PURE__*/React.forwardRef(({
402
403
  }, itemProps), itemToElement ? itemToElement(item) : itemToString(item), selectedItem === item && /*#__PURE__*/React.createElement(iconsReact.Checkmark, {
403
404
  className: `${prefix}--list-box__menu-item__selected-icon`
404
405
  }));
405
- }))), !inline && !isFluid && !normalizedProps.validation && helper, !inline && !isFluid && normalizedProps.validation);
406
+ }))), !inline && !isFluid && !normalizedProps.validation && helper);
406
407
  });
407
408
 
408
409
  // Workaround problems with forwardRef() and generics. In the long term, should stop using forwardRef().
@@ -19,6 +19,7 @@ var events = require('../../tools/events.js');
19
19
  var keys = require('../../internal/keyboard/keys.js');
20
20
  var match = require('../../internal/keyboard/match.js');
21
21
  var mergeRefs = require('../../tools/mergeRefs.js');
22
+ var utils = require('../Search/utils.js');
22
23
 
23
24
  const frFn = React.forwardRef;
24
25
  const ExpandableSearch = frFn((props, forwardedRef) => {
@@ -32,7 +33,7 @@ const ExpandableSearch = frFn((props, forwardedRef) => {
32
33
  ...rest
33
34
  } = props;
34
35
  const [expanded, setExpanded] = React.useState(isExpanded || false);
35
- const [hasContent, setHasContent] = React.useState(defaultValue ? true : false);
36
+ const [hasContent, setHasContent] = React.useState(utils.isSearchValuePresent(defaultValue));
36
37
  const searchRef = React.useRef(null);
37
38
  const prefix = usePrefix.usePrefix();
38
39
  function handleBlur(evt) {
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Copyright IBM Corp. 2016, 2023
3
+ *
4
+ * This source code is licensed under the Apache-2.0 license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+
8
+ 'use strict';
9
+
10
+ Object.defineProperty(exports, '__esModule', { value: true });
11
+
12
+ var ExpandableSearch = require('./ExpandableSearch.js');
13
+
14
+
15
+
16
+ exports.ExpandableSearch = ExpandableSearch.default;
17
+ exports.default = ExpandableSearch.default;
@@ -7,7 +7,7 @@
7
7
 
8
8
  'use strict';
9
9
 
10
- var FeatureFlags$1 = require('@carbon/feature-flags');
10
+ var featureFlags = require('@carbon/feature-flags');
11
11
  var PropTypes = require('prop-types');
12
12
  var React = require('react');
13
13
  var deprecate = require('../../prop-types/deprecate.js');
@@ -17,7 +17,7 @@ var deprecate = require('../../prop-types/deprecate.js');
17
17
  * Our FeatureFlagContext is used alongside the FeatureFlags component to enable
18
18
  * or disable feature flags in a given React tree
19
19
  */
20
- const FeatureFlagContext = /*#__PURE__*/React.createContext(FeatureFlags$1.FeatureFlags);
20
+ const FeatureFlagContext = /*#__PURE__*/React.createContext(featureFlags.FeatureFlags);
21
21
 
22
22
  /**
23
23
  * Supports an object of feature flag values with the `flags` prop, merging them
@@ -54,12 +54,12 @@ function FeatureFlags({
54
54
  ...flags
55
55
  };
56
56
  const [scope, updateScope] = React.useState(() => {
57
- const scope = FeatureFlags$1.createScope(combinedFlags);
57
+ const scope = featureFlags.createScope(combinedFlags);
58
58
  scope.mergeWithScope(parentScope);
59
59
  return scope;
60
60
  });
61
61
  if (parentScope !== prevParentScope) {
62
- const scope = FeatureFlags$1.createScope(combinedFlags);
62
+ const scope = featureFlags.createScope(combinedFlags);
63
63
  scope.mergeWithScope(parentScope);
64
64
  updateScope(scope);
65
65
  setPrevParentScope(parentScope);
@@ -69,7 +69,7 @@ function FeatureFlags({
69
69
  // for flags that are passed in. If they have changed, then we re-create the
70
70
  // FeatureFlagScope using the new flags
71
71
  useChangedValue(combinedFlags, isEqual, changedFlags => {
72
- const scope = FeatureFlags$1.createScope(changedFlags);
72
+ const scope = featureFlags.createScope(changedFlags);
73
73
  scope.mergeWithScope(parentScope);
74
74
  updateScope(scope);
75
75
  });
@@ -1,10 +1,10 @@
1
1
  /**
2
- * Copyright IBM Corp. 2022
2
+ * Copyright IBM Corp. 2022, 2026
3
3
  *
4
4
  * This source code is licensed under the Apache-2.0 license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
- import React from 'react';
7
+ import React, { type SelectHTMLAttributes } from 'react';
8
8
  export interface FluidSelectProps {
9
9
  /**
10
10
  * Provide the contents of your Select
@@ -17,7 +17,7 @@ export interface FluidSelectProps {
17
17
  /**
18
18
  * Optionally provide the default value of the `<select>`
19
19
  */
20
- defaultValue?: any;
20
+ defaultValue?: SelectHTMLAttributes<HTMLSelectElement>['defaultValue'];
21
21
  /**
22
22
  * Specify whether the control is disabled
23
23
  */
@@ -8,8 +8,7 @@ import PropTypes from 'prop-types';
8
8
  import React from 'react';
9
9
  export interface FluidTextAreaProps {
10
10
  /**
11
- * Provide a custom className that is applied directly to the underlying
12
- * `<textarea>` node
11
+ * Provide a custom className that is applied to the wrapper node
13
12
  */
14
13
  className?: string;
15
14
  /**
@@ -101,8 +100,7 @@ declare const FluidTextArea: {
101
100
  ({ className, ...other }: FluidTextAreaProps): import("react/jsx-runtime").JSX.Element;
102
101
  propTypes: {
103
102
  /**
104
- * Provide a custom className that is applied directly to the underlying
105
- * `<textarea>` node
103
+ * Provide a custom className that is applied to the wrapper node
106
104
  */
107
105
  className: PropTypes.Requireable<string>;
108
106
  /**
@@ -35,8 +35,7 @@ const FluidTextArea = ({
35
35
  };
36
36
  FluidTextArea.propTypes = {
37
37
  /**
38
- * Provide a custom className that is applied directly to the underlying
39
- * `<textarea>` node
38
+ * Provide a custom className that is applied to the wrapper node
40
39
  */
41
40
  className: PropTypes.string,
42
41
  /**
@@ -1,10 +1,10 @@
1
1
  /**
2
- * Copyright IBM Corp. 2022
2
+ * Copyright IBM Corp. 2022, 2026
3
3
  *
4
4
  * This source code is licensed under the Apache-2.0 license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
- import React from 'react';
7
+ import React, { type SelectHTMLAttributes } from 'react';
8
8
  export interface FluidTimePickerSelectProps {
9
9
  /**
10
10
  * Provide the contents of your Select
@@ -17,7 +17,7 @@ export interface FluidTimePickerSelectProps {
17
17
  /**
18
18
  * Optionally provide the default value of the `<select>`
19
19
  */
20
- defaultValue?: any;
20
+ defaultValue?: SelectHTMLAttributes<HTMLSelectElement>['defaultValue'];
21
21
  /**
22
22
  * Specify whether the control is disabled
23
23
  */
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright IBM Corp. 2016, 2023
2
+ * Copyright IBM Corp. 2016, 2026
3
3
  *
4
4
  * This source code is licensed under the Apache-2.0 license found in the
5
5
  * LICENSE file in the root directory of this source tree.
@@ -10,32 +10,13 @@
10
10
  Object.defineProperty(exports, '__esModule', { value: true });
11
11
 
12
12
  var _rollupPluginBabelHelpers = require('../../_virtual/_rollupPluginBabelHelpers.js');
13
- var FeatureFlags = require('@carbon/feature-flags');
13
+ var featureFlags = require('@carbon/feature-flags');
14
14
  var cx = require('classnames');
15
15
  var PropTypes = require('prop-types');
16
16
  var React = require('react');
17
17
  var usePrefix = require('../../internal/usePrefix.js');
18
18
  var GridContext = require('./GridContext.js');
19
19
 
20
- function _interopNamespaceDefault(e) {
21
- var n = Object.create(null);
22
- if (e) {
23
- Object.keys(e).forEach(function (k) {
24
- if (k !== 'default') {
25
- var d = Object.getOwnPropertyDescriptor(e, k);
26
- Object.defineProperty(n, k, d.get ? d : {
27
- enumerable: true,
28
- get: function () { return e[k]; }
29
- });
30
- }
31
- });
32
- }
33
- n.default = e;
34
- return Object.freeze(n);
35
- }
36
-
37
- var FeatureFlags__namespace = /*#__PURE__*/_interopNamespaceDefault(FeatureFlags);
38
-
39
20
  // eslint-disable-next-line react/display-name -- https://github.com/carbon-design-system/carbon/issues/20452
40
21
  const Column = /*#__PURE__*/React.forwardRef(({
41
22
  as,
@@ -75,7 +56,7 @@ const Column = /*#__PURE__*/React.forwardRef(({
75
56
  }, rest), children);
76
57
  });
77
58
  const percentSpanType = PropTypes.oneOf(['25%', '50%', '75%', '100%']);
78
- const spanPropType = FeatureFlags__namespace.enabled('enable-css-grid') ? PropTypes.oneOfType([PropTypes.bool, PropTypes.number, PropTypes.shape({
59
+ const spanPropType = featureFlags.enabled('enable-css-grid') ? PropTypes.oneOfType([PropTypes.bool, PropTypes.number, PropTypes.shape({
79
60
  span: PropTypes.oneOfType([PropTypes.number, percentSpanType]),
80
61
  offset: PropTypes.number,
81
62
  start: PropTypes.number,
@@ -0,0 +1,71 @@
1
+ /**
2
+ * Copyright IBM Corp. 2016, 2026
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
+ import '@testing-library/jest-dom/jest-globals';
8
+ export declare const findListBoxNode: () => Element | null;
9
+ export declare const findMenuNode: () => Element | null;
10
+ export declare const findMenuItemNode: (index: number) => Element;
11
+ export declare const findMenuIconNode: () => Element | null;
12
+ export declare const findFieldNode: () => Element | null;
13
+ export declare const findComboboxNode: () => Element | null;
14
+ export declare const findPopupNode: () => Element | null;
15
+ export declare const openMenu: () => Promise<void>;
16
+ export declare const assertMenuOpen: (mockProps: {
17
+ items: unknown[];
18
+ }) => void;
19
+ export declare const assertMenuClosed: () => void;
20
+ /**
21
+ * 'GenericItem' corresponds to an item in a collection that is passed to
22
+ * `MultiSelect` that is in a predictable shape and works with the default
23
+ * `itemToString` function.
24
+ */
25
+ export declare const generateGenericItem: (index: number) => {
26
+ id: string;
27
+ label: string;
28
+ value: number;
29
+ };
30
+ /**
31
+ * 'CustomItem' corresponds to a potentially different item structure that might
32
+ * be passed into `MultiSelect` that we would need to supply a custom
33
+ * `itemToString` method for.
34
+ */
35
+ export declare const generateCustomItem: (index: number) => {
36
+ field: string;
37
+ value: string;
38
+ };
39
+ /**
40
+ * Generates an array of values generated by the `generator` function.
41
+ */
42
+ export declare const generateItems: <T>(amount: number, generator: (index: number) => T) => T[];
43
+ export declare const customItemToString: ({ field, }: {
44
+ field: string;
45
+ value: string;
46
+ }) => string;
47
+ /**
48
+ * This object contains two sets of three items that share the same root
49
+ * word in different portions of the string (beginning, middle, end):
50
+ *
51
+ * - 'struct'
52
+ * - 'port'
53
+ *
54
+ * Separated by a disabled item, these derivative words are helpful when
55
+ * testing fuzzy search functions and components that do substring filtering.
56
+ */
57
+ export declare const cognateItems: ({
58
+ id: string;
59
+ text: string;
60
+ disabled?: undefined;
61
+ } | {
62
+ id: string;
63
+ text: string;
64
+ disabled: boolean;
65
+ })[];
66
+ /**
67
+ * Flushes microtasks to ensure element position state is settled
68
+ * From https://floating-ui.com/docs/react#testing
69
+ * More context here: https://github.com/floating-ui/react-popper/issues/368#issuecomment-1340413010
70
+ */
71
+ export declare const waitForPosition: () => Promise<void>;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright IBM Corp. 2016, 2025
2
+ * Copyright IBM Corp. 2016, 2026
3
3
  *
4
4
  * This source code is licensed under the Apache-2.0 license found in the
5
5
  * LICENSE file in the root directory of this source tree.
@@ -40,7 +40,9 @@ function Loading({
40
40
  className: loadingClassName
41
41
  }), /*#__PURE__*/React.createElement("svg", {
42
42
  className: `${prefix}--loading__svg`,
43
- viewBox: "0 0 100 100"
43
+ viewBox: "0 0 100 100",
44
+ role: "img",
45
+ "aria-label": description
44
46
  }, /*#__PURE__*/React.createElement("title", null, description), small ? /*#__PURE__*/React.createElement("circle", {
45
47
  className: `${prefix}--loading__background`,
46
48
  cx: "50%",
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright IBM Corp. 2023, 2025
2
+ * Copyright IBM Corp. 2023, 2026
3
3
  *
4
4
  * This source code is licensed under the Apache-2.0 license found in the
5
5
  * LICENSE file in the root directory of this source tree.
@@ -86,10 +86,14 @@ const Menu = /*#__PURE__*/React.forwardRef(function Menu({
86
86
  }
87
87
  function handleOpen() {
88
88
  if (menu.current) {
89
- focusReturn.current = document.activeElement;
89
+ const {
90
+ activeElement,
91
+ dir
92
+ } = document;
93
+ focusReturn.current = activeElement instanceof HTMLElement ? activeElement : null;
90
94
  if (legacyAutoalign) {
91
95
  const pos = calculatePosition();
92
- if ((document?.dir === 'rtl' || direction === 'rtl') && !rest?.id?.includes('MenuButton')) {
96
+ if ((dir === 'rtl' || direction === 'rtl') && !rest?.id?.includes('MenuButton')) {
93
97
  menu.current.style.insetInlineStart = `initial`;
94
98
  menu.current.style.insetInlineEnd = `${pos[0]}px`;
95
99
  } else {
@@ -71,7 +71,7 @@ const MenuItem = /*#__PURE__*/React.forwardRef(function MenuItem({
71
71
  const context = React.useContext(MenuContext.MenuContext);
72
72
  const menuItem = React.useRef(null);
73
73
  const ref = useMergedRefs.useMergedRefs([forwardRef, menuItem, refs.setReference]);
74
- const hasChildren = Boolean(children);
74
+ const hasChildren = React.Children.toArray(children).length > 0;
75
75
  const isDisabled = disabled && !hasChildren;
76
76
  const isDanger = kind === 'danger' && !hasChildren;
77
77
  function registerItem() {
@@ -79,7 +79,7 @@ const MenuItem = /*#__PURE__*/React.forwardRef(function MenuItem({
79
79
  type: 'registerItem',
80
80
  payload: {
81
81
  ref: menuItem,
82
- disabled: Boolean(disabled)
82
+ disabled: disabled ?? false
83
83
  }
84
84
  });
85
85
  }
@@ -162,7 +162,6 @@ const ModalDialog = /*#__PURE__*/React.forwardRef(function ModalDialog({
162
162
  const {
163
163
  target
164
164
  } = evt;
165
- evt.stopPropagation();
166
165
  const shouldCloseOnOutsideClick =
167
166
  // Passive modals can close on clicks outside the modal when
168
167
  // preventCloseOnClickOutside is undefined or explicitly set to false.
@@ -222,7 +222,6 @@ const FilterableMultiSelect = /*#__PURE__*/React.forwardRef(function FilterableM
222
222
  item => !item.disabled);
223
223
 
224
224
  // Sort only non-select-all items, select-all item must stay at the top
225
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- https://github.com/carbon-design-system/carbon/issues/20452
226
225
  const sortedReal = sortItems(nonSelectAllItems, {
227
226
  selectedItems: {
228
227
  top: controlledSelectedItems,
@@ -315,6 +314,7 @@ const FilterableMultiSelect = /*#__PURE__*/React.forwardRef(function FilterableM
315
314
  React.useEffect(() => {
316
315
  const handleClickOutside = event => {
317
316
  const target = event.target;
317
+ if (!(target instanceof Node)) return;
318
318
  const wrapper = document.getElementById(id)?.closest(`.${prefix}--multi-select__wrapper`);
319
319
 
320
320
  // If click is outside our component and menu is open or input is focused
@@ -616,15 +616,16 @@ const FilterableMultiSelect = /*#__PURE__*/React.forwardRef(function FilterableM
616
616
 
617
617
  // Memoize the value of getMenuProps to avoid an infinite loop
618
618
  const menuProps = React.useMemo(() => getMenuProps({
619
- ref: autoAlign ? refs.setFloating : null
619
+ ref: autoAlign ? refs.setFloating : null,
620
+ hidden: !isOpen
620
621
  }, {
621
622
  suppressRefError: true
622
- }), [autoAlign, getMenuProps, refs.setFloating]);
623
+ }), [autoAlign, getMenuProps, isOpen, refs.setFloating]);
623
624
  const handleFocus = evt => {
624
625
  if (evt?.target.classList.contains(`${prefix}--tag__close-icon`) || evt?.target.classList.contains(`${prefix}--list-box__selection`)) {
625
626
  setIsFocused(false);
626
627
  } else {
627
- setIsFocused(evt?.type === 'focus' ? true : false);
628
+ setIsFocused(evt?.type === 'focus');
628
629
  }
629
630
  };
630
631
  const mergedRef = mergeRefs.mergeRefs(textInput, inputProp.ref);
@@ -392,7 +392,7 @@ const MultiSelect = /*#__PURE__*/React.forwardRef(({
392
392
  if (evt.target.classList.contains(`${prefix}--tag__close-icon`)) {
393
393
  setIsFocused(false);
394
394
  } else {
395
- setIsFocused(evt.type === 'focus' ? true : false);
395
+ setIsFocused(evt.type === 'focus');
396
396
  }
397
397
  };
398
398
  const readOnlyEventHandlers = readOnly ? {
@@ -426,8 +426,9 @@ const MultiSelect = /*#__PURE__*/React.forwardRef(({
426
426
 
427
427
  // Memoize the value of getMenuProps to avoid an infinite loop
428
428
  const menuProps = React.useMemo(() => getMenuProps({
429
- ref: enableFloatingStyles ? refs.setFloating : null
430
- }), [enableFloatingStyles, getMenuProps, refs.setFloating]);
429
+ ref: enableFloatingStyles ? refs.setFloating : null,
430
+ hidden: !isOpen
431
+ }), [enableFloatingStyles, getMenuProps, isOpen, refs.setFloating]);
431
432
  const allLabelProps = getLabelProps();
432
433
  const labelProps = /*#__PURE__*/React.isValidElement(titleText) ? {
433
434
  id: allLabelProps.id
@@ -474,9 +475,7 @@ const MultiSelect = /*#__PURE__*/React.forwardRef(({
474
475
  }, selectedItems.length > 0 && /*#__PURE__*/React.createElement(index$2.default.Selection, {
475
476
  readOnly: readOnly,
476
477
  clearSelection: !disabled && !readOnly ? clearSelection : noopFn.noopFn,
477
- selectionCount: selectedItemsLength
478
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
479
- ,
478
+ selectionCount: selectedItemsLength,
480
479
  translateWithId: translateWithId,
481
480
  disabled: disabled
482
481
  }), /*#__PURE__*/React.createElement("button", _rollupPluginBabelHelpers.extends({
@@ -495,9 +494,7 @@ const MultiSelect = /*#__PURE__*/React.forwardRef(({
495
494
  translateWithId: translateWithId
496
495
  })), slug ? normalizedDecorator : decorator ? /*#__PURE__*/React.createElement("div", {
497
496
  className: `${prefix}--list-box__inner-wrapper--decorator`
498
- }, normalizedDecorator) : ''), /*#__PURE__*/React.createElement(index$2.default.Menu, menuProps, isOpen &&
499
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- https://github.com/carbon-design-system/carbon/issues/20452
500
- sortItems(filteredItems, sortOptions).map((item, index) => {
497
+ }, normalizedDecorator) : ''), /*#__PURE__*/React.createElement(index$2.default.Menu, menuProps, isOpen && sortItems(filteredItems, sortOptions).map((item, index) => {
501
498
  const {
502
499
  hasIndividualSelections,
503
500
  nonSelectAllSelectedCount,