@carbon/react 1.101.0 → 1.102.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 (174) hide show
  1. package/.playwright/INTERNAL_AVT_REPORT_DO_NOT_USE.json +987 -952
  2. package/es/components/Accordion/AccordionItem.js +8 -6
  3. package/es/components/CheckboxGroup/CheckboxGroup.d.ts +1 -1
  4. package/es/components/CheckboxGroup/CheckboxGroup.js +2 -2
  5. package/es/components/ComboBox/ComboBox.js +3 -4
  6. package/es/components/ComposedModal/ComposedModal.js +0 -1
  7. package/es/components/ContainedList/ContainedList.d.ts +1 -1
  8. package/es/components/ContainedList/ContainedList.js +9 -34
  9. package/es/components/ContentSwitcher/ContentSwitcher.d.ts +3 -3
  10. package/es/components/ContentSwitcher/ContentSwitcher.js +4 -4
  11. package/es/components/DataTable/DataTable.d.ts +6 -2
  12. package/es/components/DataTable/DataTable.js +3 -1
  13. package/es/components/DataTable/Table.js +1 -1
  14. package/es/components/DataTable/TableExpandRow.js +2 -2
  15. package/es/components/DataTable/TableToolbarSearch.d.ts +11 -2
  16. package/es/components/DataTable/TableToolbarSearch.js +10 -3
  17. package/es/components/DataTable/stories/examples/TableToolbarFilter.d.ts +3 -0
  18. package/es/components/DataTable/tools/normalize.js +2 -1
  19. package/es/components/DataTableSkeleton/DataTableSkeleton.d.ts +2 -12
  20. package/es/components/DataTableSkeleton/DataTableSkeleton.js +1 -8
  21. package/es/components/DatePicker/DatePicker.js +7 -3
  22. package/es/components/DatePickerInput/DatePickerInput.d.ts +2 -5
  23. package/es/components/DatePickerInput/DatePickerInput.js +2 -13
  24. package/es/components/Dropdown/Dropdown.js +2 -3
  25. package/es/components/ExpandableSearch/ExpandableSearch.js +2 -1
  26. package/es/components/ExpandableSearch/index.js +12 -0
  27. package/es/components/FluidSelect/FluidSelect.d.ts +3 -3
  28. package/es/components/FluidTextArea/FluidTextArea.d.ts +2 -4
  29. package/es/components/FluidTextArea/FluidTextArea.js +1 -2
  30. package/es/components/FluidTimePickerSelect/FluidTimePickerSelect.d.ts +3 -3
  31. package/es/components/Grid/Column.d.ts +1 -1
  32. package/es/components/Grid/Column.js +2 -2
  33. package/es/components/Loading/Loading.d.ts +1 -1
  34. package/es/components/Loading/Loading.js +3 -1
  35. package/es/components/Menu/Menu.d.ts +1 -1
  36. package/es/components/Menu/Menu.js +6 -2
  37. package/es/components/Menu/MenuItem.js +2 -2
  38. package/es/components/Modal/Modal.js +0 -1
  39. package/es/components/MultiSelect/FilterableMultiSelect.js +4 -3
  40. package/es/components/MultiSelect/MultiSelect.js +5 -8
  41. package/es/components/MultiSelect/MultiSelectPropTypes.d.ts +6 -8
  42. package/es/components/MultiSelect/tools/sorting.d.ts +16 -9
  43. package/es/components/MultiSelect/tools/sorting.js +10 -14
  44. package/es/components/OverflowMenu/OverflowMenu.js +1 -0
  45. package/es/components/OverflowMenuItem/OverflowMenuItem.d.ts +5 -1
  46. package/es/components/OverflowMenuItem/OverflowMenuItem.js +12 -2
  47. package/es/components/Popover/index.js +3 -3
  48. package/es/components/ProgressIndicator/ProgressIndicator.js +3 -3
  49. package/es/components/RadioButtonGroup/RadioButtonGroup.d.ts +1 -1
  50. package/es/components/RadioButtonGroup/RadioButtonGroup.js +8 -11
  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 +1 -1
  56. package/es/components/SelectItem/SelectItem.d.ts +3 -3
  57. package/es/components/Slider/Slider.d.ts +1 -1
  58. package/es/components/Slider/Slider.js +2 -8
  59. package/es/components/StructuredList/StructuredList.js +2 -2
  60. package/es/components/Tabs/Tabs.js +9 -4
  61. package/es/components/Tag/DismissibleTag.d.ts +1 -1
  62. package/es/components/Tag/DismissibleTag.js +2 -2
  63. package/es/components/Tag/OperationalTag.d.ts +1 -1
  64. package/es/components/Tag/OperationalTag.js +2 -2
  65. package/es/components/Tag/SelectableTag.d.ts +1 -1
  66. package/es/components/Tag/SelectableTag.js +2 -2
  67. package/es/components/Tag/Tag.d.ts +1 -1
  68. package/es/components/Tag/Tag.js +2 -2
  69. package/es/components/TextArea/TextArea.d.ts +1 -2
  70. package/es/components/TextArea/TextArea.js +4 -5
  71. package/es/components/TextInput/ControlledPasswordInput.js +1 -1
  72. package/es/components/TileGroup/TileGroup.d.ts +1 -1
  73. package/es/components/TileGroup/TileGroup.js +2 -1
  74. package/es/components/TimePickerSelect/TimePickerSelect.d.ts +4 -4
  75. package/es/components/Toggletip/index.js +1 -2
  76. package/es/components/TreeView/TreeNode.js +2 -2
  77. package/es/components/TreeView/TreeView.d.ts +1 -1
  78. package/es/components/UIShell/HeaderPanel.d.ts +1 -1
  79. package/es/components/UIShell/HeaderPanel.js +7 -4
  80. package/es/components/UIShell/SideNav.js +3 -3
  81. package/es/components/UIShell/Switcher.d.ts +1 -1
  82. package/es/components/UIShell/Switcher.js +6 -5
  83. package/es/feature-flags.js +2 -2
  84. package/es/internal/FloatingMenu.js +3 -3
  85. package/es/internal/useOverflowItems.d.ts +1 -5
  86. package/es/internal/useOverflowItems.js +6 -27
  87. package/lib/components/Accordion/AccordionItem.js +7 -5
  88. package/lib/components/CheckboxGroup/CheckboxGroup.d.ts +1 -1
  89. package/lib/components/CheckboxGroup/CheckboxGroup.js +1 -1
  90. package/lib/components/ComboBox/ComboBox.js +3 -4
  91. package/lib/components/ComposedModal/ComposedModal.js +0 -1
  92. package/lib/components/ContainedList/ContainedList.d.ts +1 -1
  93. package/lib/components/ContainedList/ContainedList.js +9 -34
  94. package/lib/components/ContentSwitcher/ContentSwitcher.d.ts +3 -3
  95. package/lib/components/ContentSwitcher/ContentSwitcher.js +3 -3
  96. package/lib/components/DataTable/DataTable.d.ts +6 -2
  97. package/lib/components/DataTable/DataTable.js +3 -1
  98. package/lib/components/DataTable/Table.js +1 -1
  99. package/lib/components/DataTable/TableExpandRow.js +1 -1
  100. package/lib/components/DataTable/TableToolbarSearch.d.ts +11 -2
  101. package/lib/components/DataTable/TableToolbarSearch.js +10 -3
  102. package/lib/components/DataTable/stories/examples/TableToolbarFilter.d.ts +3 -0
  103. package/lib/components/DataTable/tools/normalize.js +2 -1
  104. package/lib/components/DataTableSkeleton/DataTableSkeleton.d.ts +2 -12
  105. package/lib/components/DataTableSkeleton/DataTableSkeleton.js +1 -8
  106. package/lib/components/DatePicker/DatePicker.js +7 -3
  107. package/lib/components/DatePickerInput/DatePickerInput.d.ts +2 -5
  108. package/lib/components/DatePickerInput/DatePickerInput.js +2 -13
  109. package/lib/components/Dropdown/Dropdown.js +2 -3
  110. package/lib/components/ExpandableSearch/ExpandableSearch.js +2 -1
  111. package/lib/components/ExpandableSearch/index.js +17 -0
  112. package/lib/components/FeatureFlags/index.js +5 -5
  113. package/lib/components/FluidSelect/FluidSelect.d.ts +3 -3
  114. package/lib/components/FluidTextArea/FluidTextArea.d.ts +2 -4
  115. package/lib/components/FluidTextArea/FluidTextArea.js +1 -2
  116. package/lib/components/FluidTimePickerSelect/FluidTimePickerSelect.d.ts +3 -3
  117. package/lib/components/Grid/Column.d.ts +1 -1
  118. package/lib/components/Grid/Column.js +2 -21
  119. package/lib/components/Loading/Loading.d.ts +1 -1
  120. package/lib/components/Loading/Loading.js +3 -1
  121. package/lib/components/Menu/Menu.d.ts +1 -1
  122. package/lib/components/Menu/Menu.js +6 -2
  123. package/lib/components/Menu/MenuItem.js +2 -2
  124. package/lib/components/Modal/Modal.js +0 -1
  125. package/lib/components/MultiSelect/FilterableMultiSelect.js +4 -3
  126. package/lib/components/MultiSelect/MultiSelect.js +5 -8
  127. package/lib/components/MultiSelect/MultiSelectPropTypes.d.ts +6 -8
  128. package/lib/components/MultiSelect/tools/sorting.d.ts +16 -9
  129. package/lib/components/MultiSelect/tools/sorting.js +10 -14
  130. package/lib/components/OverflowMenu/OverflowMenu.js +1 -0
  131. package/lib/components/OverflowMenuItem/OverflowMenuItem.d.ts +5 -1
  132. package/lib/components/OverflowMenuItem/OverflowMenuItem.js +12 -2
  133. package/lib/components/Popover/index.js +3 -3
  134. package/lib/components/ProgressIndicator/ProgressIndicator.js +3 -3
  135. package/lib/components/RadioButtonGroup/RadioButtonGroup.d.ts +1 -1
  136. package/lib/components/RadioButtonGroup/RadioButtonGroup.js +7 -10
  137. package/lib/components/Search/Search.js +3 -2
  138. package/lib/components/Search/utils.d.ts +7 -0
  139. package/lib/components/Search/utils.js +12 -0
  140. package/lib/components/Select/Select.d.ts +2 -2
  141. package/lib/components/Select/Select.js +1 -1
  142. package/lib/components/SelectItem/SelectItem.d.ts +3 -3
  143. package/lib/components/Slider/Slider.d.ts +1 -1
  144. package/lib/components/Slider/Slider.js +2 -8
  145. package/lib/components/StructuredList/StructuredList.js +2 -2
  146. package/lib/components/Tabs/Tabs.js +9 -4
  147. package/lib/components/Tag/DismissibleTag.d.ts +1 -1
  148. package/lib/components/Tag/DismissibleTag.js +2 -2
  149. package/lib/components/Tag/OperationalTag.d.ts +1 -1
  150. package/lib/components/Tag/OperationalTag.js +2 -2
  151. package/lib/components/Tag/SelectableTag.d.ts +1 -1
  152. package/lib/components/Tag/SelectableTag.js +2 -2
  153. package/lib/components/Tag/Tag.d.ts +1 -1
  154. package/lib/components/Tag/Tag.js +2 -2
  155. package/lib/components/TextArea/TextArea.d.ts +1 -2
  156. package/lib/components/TextArea/TextArea.js +4 -5
  157. package/lib/components/TextInput/ControlledPasswordInput.js +1 -1
  158. package/lib/components/TileGroup/TileGroup.d.ts +1 -1
  159. package/lib/components/TileGroup/TileGroup.js +2 -1
  160. package/lib/components/TimePickerSelect/TimePickerSelect.d.ts +4 -4
  161. package/lib/components/Toggletip/index.js +1 -2
  162. package/lib/components/TreeView/TreeNode.js +2 -2
  163. package/lib/components/TreeView/TreeView.d.ts +1 -1
  164. package/lib/components/UIShell/HeaderPanel.d.ts +1 -1
  165. package/lib/components/UIShell/HeaderPanel.js +6 -3
  166. package/lib/components/UIShell/SideNav.js +3 -3
  167. package/lib/components/UIShell/Switcher.d.ts +1 -1
  168. package/lib/components/UIShell/Switcher.js +5 -4
  169. package/lib/feature-flags.js +2 -21
  170. package/lib/internal/FloatingMenu.js +3 -22
  171. package/lib/internal/useOverflowItems.d.ts +1 -5
  172. package/lib/internal/useOverflowItems.js +6 -27
  173. package/package.json +8 -8
  174. package/telemetry.yml +0 -1
@@ -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.
@@ -45,8 +45,8 @@ const DismissibleTag = /*#__PURE__*/forwardRef(({
45
45
  }, forwardRef) => {
46
46
  const prefix = usePrefix();
47
47
  const tagLabelRef = useRef(null);
48
- // eslint-disable-next-line react-hooks/rules-of-hooks -- https://github.com/carbon-design-system/carbon/issues/20452
49
- const tagId = id || `tag-${useId()}`;
48
+ const generatedTagId = useId();
49
+ const tagId = id ?? `tag-${generatedTagId}`;
50
50
  const tagClasses = cx(`${prefix}--tag--filter`, className);
51
51
  const [isEllipsisApplied, setIsEllipsisApplied] = useState(false);
52
52
  useIsomorphicEffect(() => {
@@ -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.
@@ -45,8 +45,8 @@ const OperationalTag = /*#__PURE__*/forwardRef(({
45
45
  }, forwardRef) => {
46
46
  const prefix = usePrefix();
47
47
  const tagRef = useRef(null);
48
- // eslint-disable-next-line react-hooks/rules-of-hooks -- https://github.com/carbon-design-system/carbon/issues/20452
49
- const tagId = id || `tag-${useId()}`;
48
+ const generatedTagId = useId();
49
+ const tagId = id ?? `tag-${generatedTagId}`;
50
50
  const tagClasses = cx(`${prefix}--tag--operational`, className);
51
51
  const [isEllipsisApplied, setIsEllipsisApplied] = useState(false);
52
52
  useIsomorphicEffect(() => {
@@ -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.
@@ -37,8 +37,8 @@ const SelectableTag = /*#__PURE__*/forwardRef(({
37
37
  }, forwardRef) => {
38
38
  const prefix = usePrefix();
39
39
  const tagRef = useRef(null);
40
- // eslint-disable-next-line react-hooks/rules-of-hooks -- https://github.com/carbon-design-system/carbon/issues/20452
41
- const tagId = id || `tag-${useId()}`;
40
+ const generatedTagId = useId();
41
+ const tagId = id ?? `tag-${generatedTagId}`;
42
42
  const [selectedTag, setSelectedTag] = useControllableState({
43
43
  value: selected,
44
44
  onChange: onChange,
@@ -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.
@@ -74,8 +74,8 @@ const TagBase = /*#__PURE__*/React.forwardRef(({
74
74
  console.warn('The `onClose` prop for Tag has been deprecated and will be removed in the next major version. Use DismissibleTag instead.');
75
75
  }
76
76
  const ref = useMergedRefs([forwardRef, tagRef]);
77
- // eslint-disable-next-line react-hooks/rules-of-hooks -- https://github.com/carbon-design-system/carbon/issues/20452
78
- const tagId = id || `tag-${useId()}`;
77
+ const generatedTagId = useId();
78
+ const tagId = id ?? `tag-${generatedTagId}`;
79
79
  const [isEllipsisApplied, setIsEllipsisApplied] = useState(false);
80
80
  useIsomorphicEffect(() => {
81
81
  const newElement = tagRef.current?.getElementsByClassName(`${prefix}--tag__label`)[0];
@@ -7,8 +7,7 @@
7
7
  import React, { type ReactNode } from 'react';
8
8
  export interface TextAreaProps extends React.TextareaHTMLAttributes<HTMLTextAreaElement> {
9
9
  /**
10
- * Provide a custom className that is applied directly to the underlying
11
- * `<textarea>` node
10
+ * Provide a custom className that is applied to the wrapper node
12
11
  */
13
12
  className?: string;
14
13
  /**
@@ -38,7 +38,7 @@ const TextArea = frFn((props, forwardRef) => {
38
38
  onKeyDown = noopFn,
39
39
  invalid = false,
40
40
  invalidText = '',
41
- helperText = '',
41
+ helperText,
42
42
  light,
43
43
  placeholder = '',
44
44
  enableCounter = false,
@@ -239,7 +239,7 @@ const TextArea = frFn((props, forwardRef) => {
239
239
  ariaDescribedBy = warnId;
240
240
  } else {
241
241
  const ids = [];
242
- if (!isFluid && helperText && helperId) ids.push(helperId);
242
+ if (!isFluid && hasHelper && helperId) ids.push(helperId);
243
243
  if (counterDescriptionId) ids.push(counterDescriptionId);
244
244
  ariaDescribedBy = ids.length > 0 ? ids.join(' ') : undefined;
245
245
  }
@@ -278,7 +278,7 @@ const TextArea = frFn((props, forwardRef) => {
278
278
  }, [ariaAnnouncement, prevAnnouncement, counterMode]);
279
279
  const input = /*#__PURE__*/React.createElement("textarea", _extends({}, other, textareaProps, {
280
280
  placeholder: placeholder,
281
- "aria-readonly": Boolean(other.readOnly),
281
+ "aria-readonly": other.readOnly,
282
282
  className: textareaClasses,
283
283
  "aria-invalid": invalid,
284
284
  "aria-describedby": ariaDescribedBy,
@@ -324,8 +324,7 @@ const TextArea = frFn((props, forwardRef) => {
324
324
  TextArea.displayName = 'TextArea';
325
325
  TextArea.propTypes = {
326
326
  /**
327
- * Provide a custom className that is applied directly to the underlying
328
- * `<textarea>` node
327
+ * Provide a custom className that is applied to the wrapper node
329
328
  */
330
329
  className: PropTypes.string,
331
330
  /**
@@ -27,7 +27,7 @@ const ControlledPasswordInput = /*#__PURE__*/forwardRef(({
27
27
  hideLabel,
28
28
  invalid = false,
29
29
  invalidText = '',
30
- helperText = '',
30
+ helperText,
31
31
  light,
32
32
  type = 'password',
33
33
  togglePasswordVisibility,
@@ -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.
@@ -9,6 +9,7 @@ import { extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js
9
9
  import PropTypes from 'prop-types';
10
10
  import React, { useState, useEffect, Children, isValidElement, cloneElement } from 'react';
11
11
  import RadioTile from '../RadioTile/RadioTile.js';
12
+ import { isComponentElement } from '../../internal/utils.js';
12
13
  import { usePrefix } from '../../internal/usePrefix.js';
13
14
  import { noopFn } from '../../internal/noopFn.js';
14
15
 
@@ -42,7 +43,7 @@ const TileGroup = ({
42
43
  if (! /*#__PURE__*/isValidElement(child)) return child;
43
44
 
44
45
  // If a `RadioTile` is found, return it with necessary props,
45
- if (/*#__PURE__*/isValidElement(child) && child.type === RadioTile) {
46
+ if (isComponentElement(child, RadioTile)) {
46
47
  const {
47
48
  value,
48
49
  ...otherProps
@@ -1,10 +1,10 @@
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.
6
6
  */
7
- import React from 'react';
7
+ import React, { type SelectHTMLAttributes } from 'react';
8
8
  export type TimePickerSelectProps = {
9
9
  /**
10
10
  * Provide the contents of your TimePickerSelect
@@ -17,7 +17,7 @@ export type TimePickerSelectProps = {
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
  */
@@ -39,7 +39,7 @@ declare const TimePickerSelect: React.ForwardRefExoticComponent<{
39
39
  /**
40
40
  * Optionally provide the default value of the `<select>`
41
41
  */
42
- defaultValue?: any;
42
+ defaultValue?: SelectHTMLAttributes<HTMLSelectElement>["defaultValue"];
43
43
  /**
44
44
  * Specify whether the control is disabled
45
45
  */
@@ -134,8 +134,7 @@ function Toggletip({
134
134
  const eventType = 'PointerEvent' in window ? 'pointerdown' : 'mousedown';
135
135
  const handleOutsideClick = event => {
136
136
  const node = event.target;
137
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- https://github.com/carbon-design-system/carbon/issues/20452
138
- if (open && node && !ref.current.contains(node)) {
137
+ if (open && node && !ref.current?.contains(node)) {
139
138
  setOpen(false);
140
139
  }
141
140
  };
@@ -241,7 +241,7 @@ const TreeNode = /*#__PURE__*/React.forwardRef(({
241
241
  return node;
242
242
  }
243
243
  if (node.classList.contains(`${prefix}--tree-node-link-parent`)) {
244
- return node.firstChild;
244
+ return node.firstElementChild;
245
245
  }
246
246
  if (node.classList.contains(`${prefix}--tree`)) {
247
247
  return null;
@@ -263,7 +263,7 @@ const TreeNode = /*#__PURE__*/React.forwardRef(({
263
263
  * When focus is on a leaf node or a closed parent node, move focus to
264
264
  * its parent node (unless its depth is level 1)
265
265
  */
266
- const parentNode = findParentTreeNode(href ? currentNode.current?.parentElement?.parentElement : currentNode.current?.parentElement);
266
+ const parentNode = findParentTreeNode((href ? currentNode.current?.parentElement?.parentElement : currentNode.current?.parentElement) ?? null);
267
267
  if (parentNode instanceof HTMLElement) {
268
268
  parentNode.focus();
269
269
  }
@@ -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.
@@ -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.
@@ -8,7 +8,8 @@
8
8
  import { extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
9
9
  import cx from 'classnames';
10
10
  import PropTypes from 'prop-types';
11
- import React, { useRef, useState, isValidElement } from 'react';
11
+ import React, { useRef, useState } from 'react';
12
+ import { isComponentElement } from '../../internal/utils.js';
12
13
  import { usePrefix } from '../../internal/usePrefix.js';
13
14
  import { Escape } from '../../internal/keyboard/keys.js';
14
15
  import { match } from '../../internal/keyboard/match.js';
@@ -59,10 +60,12 @@ const HeaderPanel = /*#__PURE__*/React.forwardRef(({
59
60
  };
60
61
  }
61
62
  useWindowEvent('click', event => {
62
- const target = event.target;
63
- if (!(target instanceof HTMLElement)) return;
63
+ const {
64
+ target
65
+ } = event;
66
+ if (!(target instanceof Element)) return;
64
67
  setLastClickedElement(target);
65
- const isChildASwitcher = /*#__PURE__*/isValidElement(children) && typeof children.type !== 'string' && children.type === Switcher;
68
+ const isChildASwitcher = isComponentElement(children, Switcher);
66
69
  if (isChildASwitcher && !target.closest(`.${prefix}--header-panel--expanded`) && !target.closest(`.${prefix}--header__action`) && !headerPanelReference?.current?.classList.contains(`${prefix}--switcher`) && expanded) {
67
70
  setExpandedState(false);
68
71
  onHeaderPanelFocus();
@@ -20,7 +20,7 @@ import { useDelayedState } from '../../internal/useDelayedState.js';
20
20
  import { breakpoints } from '@carbon/layout';
21
21
  import { useMatchMedia } from '../../internal/useMatchMedia.js';
22
22
 
23
- // TO-DO: comment back in when footer is added for rails
23
+ // TODO: comment back in when footer is added for rails
24
24
  // import SideNavFooter from './SideNavFooter';
25
25
 
26
26
  const SideNavContext = /*#__PURE__*/createContext({});
@@ -35,7 +35,7 @@ const SideNav = frFn((props, ref) => {
35
35
  children,
36
36
  onToggle,
37
37
  className: customClassName,
38
- // TO-DO: comment back in when footer is added for rails
38
+ // TODO: comment back in when footer is added for rails
39
39
  // translateById: t = (id) => translations[id],
40
40
  href,
41
41
  isFixedNav = false,
@@ -73,7 +73,7 @@ const SideNav = frFn((props, ref) => {
73
73
  'aria-labelledby': ariaLabelledBy
74
74
  };
75
75
 
76
- // TO-DO: comment back in when footer is added for rails
76
+ // TODO: comment back in when footer is added for rails
77
77
  // const assistiveText = expanded
78
78
  // ? t('carbon.sidenav.state.open')
79
79
  // : t('carbon.sidenav.state.closed');
@@ -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.
@@ -6,10 +6,11 @@
6
6
  */
7
7
 
8
8
  import { extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
9
- import React, { forwardRef, useRef, Children, isValidElement, cloneElement } from 'react';
9
+ import React, { forwardRef, useRef, Children, cloneElement } from 'react';
10
10
  import cx from 'classnames';
11
11
  import { usePrefix } from '../../internal/usePrefix.js';
12
12
  import { useMergedRefs } from '../../internal/useMergedRefs.js';
13
+ import { isComponentElement } from '../../internal/utils.js';
13
14
  import PropTypes from 'prop-types';
14
15
  import { AriaLabelPropType } from '../../prop-types/AriaPropTypes.js';
15
16
  import SwitcherItem from './SwitcherItem.js';
@@ -38,7 +39,7 @@ const Switcher = /*#__PURE__*/forwardRef((props, forwardRef) => {
38
39
  direction
39
40
  }) => {
40
41
  const enabledIndices = Children.toArray(children).reduce((acc, child, i) => {
41
- if (/*#__PURE__*/isValidElement(child) && child.type === SwitcherItem && Object.keys(child.props).length) {
42
+ if (isComponentElement(child, SwitcherItem) && Object.keys(child.props).length) {
42
43
  acc.push(i);
43
44
  }
44
45
  return acc;
@@ -61,12 +62,12 @@ const Switcher = /*#__PURE__*/forwardRef((props, forwardRef) => {
61
62
  }
62
63
  })();
63
64
  const switcherItem = switcherRef.current?.children[nextValidIndex]?.children[0];
64
- if (switcherItem) {
65
+ if (switcherItem instanceof HTMLElement) {
65
66
  switcherItem.focus();
66
67
  }
67
68
  };
68
69
  const childrenWithProps = Children.toArray(children).map((child, index) => {
69
- if (/*#__PURE__*/isValidElement(child) && child.type === SwitcherItem) {
70
+ if (isComponentElement(child, SwitcherItem)) {
70
71
  return /*#__PURE__*/cloneElement(child, {
71
72
  handleSwitcherItemFocus,
72
73
  index,
@@ -74,7 +75,7 @@ const Switcher = /*#__PURE__*/forwardRef((props, forwardRef) => {
74
75
  expanded
75
76
  });
76
77
  }
77
- if (/*#__PURE__*/isValidElement(child) && child.type === SwitcherDivider) {
78
+ if (isComponentElement(child, SwitcherDivider)) {
78
79
  return /*#__PURE__*/cloneElement(child, {
79
80
  key: index
80
81
  });
@@ -5,9 +5,9 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
 
8
- import * as FeatureFlags from '@carbon/feature-flags';
8
+ import { merge } from '@carbon/feature-flags';
9
9
 
10
- FeatureFlags.merge({
10
+ merge({
11
11
  'enable-css-custom-properties': true,
12
12
  'enable-css-grid': true,
13
13
  'enable-v11-release': true,
@@ -6,7 +6,7 @@
6
6
  */
7
7
 
8
8
  import React, { useContext, useState, useRef, useCallback, useEffect, cloneElement } from 'react';
9
- import * as FeatureFlags from '@carbon/feature-flags';
9
+ import { enabled } from '@carbon/feature-flags';
10
10
  import ReactDOM from 'react-dom';
11
11
  import { Tab } from './keyboard/keys.js';
12
12
  import { match } from './keyboard/match.js';
@@ -274,8 +274,8 @@ const FloatingMenu = ({
274
274
  });
275
275
  }
276
276
  };
277
- const deprecatedFlag = FeatureFlags.enabled('enable-experimental-focus-wrap-without-sentinels');
278
- const focusTrapWithoutSentinelsFlag = FeatureFlags.enabled('enable-focus-wrap-without-sentinels');
277
+ const deprecatedFlag = enabled('enable-experimental-focus-wrap-without-sentinels');
278
+ const focusTrapWithoutSentinelsFlag = enabled('enable-focus-wrap-without-sentinels');
279
279
  const focusTrapWithoutSentinels = deprecatedFlag || focusTrapWithoutSentinelsFlag;
280
280
  if (typeof document !== 'undefined') {
281
281
  const portalTarget = target ? target() : document.body;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright IBM Corp. 2025, 2025
2
+ * Copyright IBM Corp. 2025, 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.
@@ -18,10 +18,6 @@ type Item = {
18
18
  * @returns Object with `visibleItems` (items to display), `hiddenItems` (items that don't fit), and `itemRefHandler` (function to attach refs to items for width measurement).
19
19
  */
20
20
  declare const useOverflowItems: <T extends Item>(items: T[] | ReactNode, containerRef: RefObject<HTMLDivElement>, offsetRef?: RefObject<HTMLDivElement>, maxItems?: number, onChange?: (hiddenItems: T[]) => void) => {
21
- visibleItems: T[];
22
- hiddenItems: T[];
23
- itemRefHandler: () => void;
24
- } | {
25
21
  visibleItems: T[];
26
22
  itemRefHandler: (id: string, node: HTMLDivElement | null) => () => void;
27
23
  hiddenItems: T[];
@@ -18,17 +18,10 @@ import { usePreviousValue } from './usePreviousValue.js';
18
18
  * @param onChange - Optional callback called when hidden items change. Receives array of currently hidden items.
19
19
  * @returns Object with `visibleItems` (items to display), `hiddenItems` (items that don't fit), and `itemRefHandler` (function to attach refs to items for width measurement).
20
20
  */
21
-
22
21
  const useOverflowItems = (items, containerRef, offsetRef, maxItems, onChange) => {
23
22
  const itemsRef = useRef(null);
24
23
  const [maxWidth, setMaxWidth] = useState(0);
25
- if (!items || !Array.isArray(items)) {
26
- return {
27
- visibleItems: [],
28
- hiddenItems: [],
29
- itemRefHandler: () => {}
30
- };
31
- }
24
+ const overflowItems = useMemo(() => Array.isArray(items) ? items : [], [items]);
32
25
  const handleResize = () => {
33
26
  if (containerRef.current) {
34
27
  const offset = offsetRef?.current?.offsetWidth || 0;
@@ -36,7 +29,6 @@ const useOverflowItems = (items, containerRef, offsetRef, maxItems, onChange) =>
36
29
  setMaxWidth(newMax);
37
30
  }
38
31
  };
39
- // eslint-disable-next-line react-hooks/rules-of-hooks -- https://github.com/carbon-design-system/carbon/issues/20452
40
32
  useResizeObserver({
41
33
  ref: containerRef,
42
34
  onResize: handleResize
@@ -59,16 +51,13 @@ const useOverflowItems = (items, containerRef, offsetRef, maxItems, onChange) =>
59
51
  };
60
52
  };
61
53
  const getVisibleItems = () => {
62
- if (!items || Array.isArray(items) === false) {
63
- return [];
64
- }
65
54
  if (!containerRef) {
66
- return items;
55
+ return overflowItems;
67
56
  }
68
57
  const map = getMap();
69
58
  let maxReached = false;
70
59
  let accumulatedWidth = 0;
71
- const visibleItems = items.slice(0, maxItems).reduce((prev, cur) => {
60
+ const visibleItems = overflowItems.slice(0, maxItems).reduce((prev, cur) => {
72
61
  if (maxReached) {
73
62
  return prev;
74
63
  }
@@ -86,30 +75,20 @@ const useOverflowItems = (items, containerRef, offsetRef, maxItems, onChange) =>
86
75
  };
87
76
 
88
77
  // Memoize visible items calculation to avoid recalculating on every render
89
- // eslint-disable-next-line react-hooks/rules-of-hooks -- https://github.com/carbon-design-system/carbon/issues/20452
90
78
  const visibleItems = useMemo(() => {
91
- if (!Array.isArray(items)) {
92
- return [];
93
- }
94
79
  return getVisibleItems();
95
80
  // eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/20452
96
- }, [items, maxWidth, maxItems]);
81
+ }, [overflowItems, maxWidth, maxItems]);
97
82
 
98
83
  // Memoize hidden items calculation
99
- // eslint-disable-next-line react-hooks/rules-of-hooks -- https://github.com/carbon-design-system/carbon/issues/20452
100
84
  const hiddenItems = useMemo(() => {
101
- if (!Array.isArray(items)) {
102
- return [];
103
- }
104
- return items.slice(visibleItems.length);
105
- }, [items, visibleItems]);
85
+ return overflowItems.slice(visibleItems.length);
86
+ }, [overflowItems, visibleItems]);
106
87
 
107
88
  // Use previous value to compare and only call onChange when needed
108
- // eslint-disable-next-line react-hooks/rules-of-hooks -- https://github.com/carbon-design-system/carbon/issues/20452
109
89
  const previousHiddenItems = usePreviousValue(hiddenItems);
110
90
 
111
91
  // Only call onChange if hidden items actually changed
112
- // eslint-disable-next-line react-hooks/rules-of-hooks -- https://github.com/carbon-design-system/carbon/issues/20452
113
92
  useEffect(() => {
114
93
  }, [hiddenItems, previousHiddenItems, onChange]);
115
94
  return {
@@ -41,7 +41,7 @@ function AccordionItem({
41
41
  ...rest
42
42
  }) {
43
43
  const [isOpen, setIsOpen] = React.useState(open);
44
- const [prevIsOpen, setPrevIsOpen] = React.useState(open);
44
+ const prevOpenRef = React.useRef(open);
45
45
  const accordionState = React.useContext(AccordionProvider.AccordionContext);
46
46
  const disabledIsControlled = typeof controlledDisabled === 'boolean';
47
47
  const disabled = disabledIsControlled ? controlledDisabled : accordionState.disabled;
@@ -64,10 +64,12 @@ function AccordionItem({
64
64
  node.style.maxBlockSize = '';
65
65
  }
66
66
  }, [isOpen]);
67
- if (open !== prevIsOpen) {
68
- setIsOpen(open);
69
- setPrevIsOpen(open);
70
- }
67
+ React.useEffect(() => {
68
+ if (open !== prevOpenRef.current) {
69
+ setIsOpen(open);
70
+ prevOpenRef.current = open;
71
+ }
72
+ }, [open]);
71
73
 
72
74
  // When the AccordionItem heading is clicked, toggle the open state of the
73
75
  // panel
@@ -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.
@@ -65,7 +65,7 @@ const CheckboxGroup = ({
65
65
  kind: 'default'
66
66
  }) : candidate;
67
67
  const clonedChildren = React.Children.map(children, child => {
68
- if (/*#__PURE__*/React.isValidElement(child) && child.type === Checkbox.default) {
68
+ if (utils.isComponentElement(child, Checkbox.default)) {
69
69
  const childProps = {
70
70
  ...(typeof invalid !== 'undefined' && typeof child.props.invalid === 'undefined' ? {
71
71
  invalid
@@ -149,7 +149,8 @@ const ComboBox = /*#__PURE__*/React.forwardRef((props, ref) => {
149
149
  middleware: autoAlign ? [react.flip(), react.hide()] : undefined,
150
150
  whileElementsMounted: react.autoUpdate
151
151
  } : {});
152
- const parentWidth = refs?.reference?.current?.clientWidth;
152
+ const referenceElement = refs?.reference?.current;
153
+ const parentWidth = referenceElement instanceof HTMLElement ? referenceElement.clientWidth : undefined;
153
154
  React.useEffect(() => {
154
155
  if (enableFloatingStyles) {
155
156
  const updatedFloatingStyles = {
@@ -503,10 +504,8 @@ const ComboBox = /*#__PURE__*/React.forwardRef((props, ref) => {
503
504
  onHighlightedIndexChange: ({
504
505
  highlightedIndex
505
506
  }) => {
506
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion , valid-typeof , no-constant-binary-expression -- https://github.com/carbon-design-system/carbon/issues/20452
507
- if (highlightedIndex > -1 && typeof window !== undefined) {
507
+ if (highlightedIndex > -1) {
508
508
  const itemArray = document.querySelectorAll(`li.${prefix}--list-box__menu-item[role="option"]`);
509
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- https://github.com/carbon-design-system/carbon/issues/20452
510
509
  const highlightedItem = itemArray[highlightedIndex];
511
510
  if (highlightedItem) {
512
511
  highlightedItem.scrollIntoView({
@@ -200,7 +200,6 @@ const ComposedModalDialog = /*#__PURE__*/React.forwardRef(function ComposedModal
200
200
  target
201
201
  } = evt;
202
202
  const mouseDownTarget = onMouseDownTarget.current;
203
- evt.stopPropagation();
204
203
  const shouldCloseOnOutsideClick =
205
204
  // Passive modals can close on clicks outside the modal when
206
205
  // preventCloseOnClickOutside is undefined or explicitly set to false.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright IBM Corp. 2022, 2025
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.
@@ -14,36 +14,25 @@ var React = require('react');
14
14
  var PropTypes = require('prop-types');
15
15
  var cx = require('classnames');
16
16
  var index = require('../Layout/index.js');
17
+ var utils = require('../../internal/utils.js');
17
18
  var useId = require('../../internal/useId.js');
18
19
  var usePrefix = require('../../internal/usePrefix.js');
19
20
  var ContainedListItem = require('./ContainedListItem/ContainedListItem.js');
21
+ var ExpandableSearch = require('../ExpandableSearch/ExpandableSearch.js');
20
22
  var Search = require('../Search/Search.js');
21
23
  require('../Search/Search.Skeleton.js');
22
24
 
23
25
  const variants = ['on-page', 'disclosed'];
24
- function filterChildren(children) {
26
+ const isSearchComponent = node => utils.isComponentElement(node, Search.default) || utils.isComponentElement(node, ExpandableSearch.default);
27
+ const filterChildren = children => {
25
28
  if (Array.isArray(children)) {
26
- return children?.filter(child => !['Search', 'ExpandableSearch'].includes(child?.type?.displayName));
29
+ return children.filter(child => !isSearchComponent(child));
27
30
  }
28
- if (children && !['Search', 'ExpandableSearch'].includes(children?.type?.displayName)) {
31
+ if (children && !isSearchComponent(children)) {
29
32
  return children;
30
33
  }
31
34
  return null;
32
- }
33
- function renderChildren(children) {
34
- if (Array.isArray(children)) {
35
- children.map((child, index) => {
36
- if (index === 0 && child.type === Search.default) {
37
- return child;
38
- }
39
- return child;
40
- });
41
- }
42
- if (children && children.type === Search.default) {
43
- return children;
44
- }
45
- return children;
46
- }
35
+ };
47
36
  const ContainedList = ({
48
37
  action,
49
38
  children,
@@ -63,21 +52,7 @@ const ContainedList = ({
63
52
  [`${prefix}--layout--size-${size}`]: size
64
53
  }, `${prefix}--contained-list--${kind}`, className);
65
54
  const filteredChildren = filterChildren(children);
66
- function isSearchAction(action) {
67
- if (! /*#__PURE__*/React.isValidElement(action)) {
68
- return false;
69
- }
70
- const actionTypes = ['Search', 'ExpandableSearch'];
71
- let actionType = '';
72
- if (typeof action.type === 'string') {
73
- actionType = action.type;
74
- } else {
75
- actionType = action.type.displayName || '';
76
- }
77
- return actionTypes.includes(actionType);
78
- }
79
- const isActionSearch = isSearchAction(action);
80
- const renderedChildren = renderChildren(children);
55
+ const isActionSearch = isSearchComponent(action);
81
56
  return /*#__PURE__*/React.createElement("div", _rollupPluginBabelHelpers.extends({
82
57
  className: classes
83
58
  }, rest), label && /*#__PURE__*/React.createElement("div", {
@@ -104,7 +79,7 @@ const ContainedList = ({
104
79
  React.createElement("ul", {
105
80
  role: "list",
106
81
  "aria-labelledby": label ? labelId : undefined
107
- }, isActionSearch ? filteredChildren : renderedChildren));
82
+ }, isActionSearch ? filteredChildren : children));
108
83
  };
109
84
  ContainedList.propTypes = {
110
85
  /**