@carbon/react 1.100.0-rc.0 → 1.101.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 (148) hide show
  1. package/.playwright/INTERNAL_AVT_REPORT_DO_NOT_USE.json +933 -933
  2. package/es/components/AILabel/index.d.ts +1 -1
  3. package/es/components/AILabel/index.js +1 -12
  4. package/es/components/Checkbox/Checkbox.js +5 -3
  5. package/es/components/CheckboxGroup/CheckboxGroup.js +4 -3
  6. package/es/components/CodeSnippet/CodeSnippet.d.ts +1 -1
  7. package/es/components/ComboBox/ComboBox.d.ts +3 -4
  8. package/es/components/ComboBox/ComboBox.js +20 -18
  9. package/es/components/ComboButton/index.d.ts +1 -1
  10. package/es/components/ComboButton/index.js +3 -2
  11. package/es/components/ComposedModal/ComposedModal.js +17 -22
  12. package/es/components/ComposedModal/ModalHeader.d.ts +2 -2
  13. package/es/components/ComposedModal/ModalHeader.js +1 -1
  14. package/es/components/Copy/Copy.d.ts +1 -1
  15. package/es/components/CopyButton/CopyButton.d.ts +1 -1
  16. package/es/components/DataTable/DataTable.d.ts +2 -0
  17. package/es/components/DataTable/DataTable.js +6 -5
  18. package/es/components/DataTable/Table.d.ts +1 -1
  19. package/es/components/DataTable/Table.js +10 -4
  20. package/es/components/DataTable/state/sorting.d.ts +4 -2
  21. package/es/components/Dropdown/Dropdown.d.ts +3 -4
  22. package/es/components/Dropdown/Dropdown.js +16 -13
  23. package/es/components/FileUploader/FileUploaderItem.d.ts +1 -1
  24. package/es/components/FileUploader/FileUploaderItem.js +3 -2
  25. package/es/components/FluidComboBox/FluidComboBox.d.ts +2 -7
  26. package/es/components/FluidComboBox/FluidComboBox.js +1 -2
  27. package/es/components/FluidDropdown/FluidDropdown.d.ts +1 -6
  28. package/es/components/FluidDropdown/FluidDropdown.js +1 -2
  29. package/es/components/FluidMultiSelect/FluidMultiSelect.d.ts +1 -6
  30. package/es/components/FluidMultiSelect/FluidMultiSelect.js +1 -2
  31. package/es/components/InlineLoading/InlineLoading.js +5 -11
  32. package/es/components/Menu/Menu.js +8 -4
  33. package/es/components/Menu/MenuItem.d.ts +5 -1
  34. package/es/components/Menu/MenuItem.js +11 -1
  35. package/es/components/MenuButton/index.d.ts +1 -1
  36. package/es/components/MenuButton/index.js +3 -2
  37. package/es/components/MultiSelect/FilterableMultiSelect.d.ts +1 -1
  38. package/es/components/MultiSelect/FilterableMultiSelect.js +7 -5
  39. package/es/components/MultiSelect/MultiSelect.d.ts +3 -4
  40. package/es/components/MultiSelect/MultiSelect.js +10 -13
  41. package/es/components/Notification/Notification.js +5 -3
  42. package/es/components/NumberInput/NumberInput.d.ts +1 -1
  43. package/es/components/NumberInput/NumberInput.js +5 -4
  44. package/es/components/OverflowMenu/OverflowMenu.d.ts +1 -0
  45. package/es/components/OverflowMenu/OverflowMenu.js +8 -4
  46. package/es/components/PageHeader/PageHeader.d.ts +1 -1
  47. package/es/components/PageHeader/PageHeader.js +5 -5
  48. package/es/components/RadioButtonGroup/RadioButtonGroup.js +4 -3
  49. package/es/components/Select/Select.js +2 -1
  50. package/es/components/StructuredList/StructuredList.d.ts +1 -1
  51. package/es/components/StructuredList/StructuredList.js +2 -4
  52. package/es/components/Tabs/Tabs.d.ts +2 -2
  53. package/es/components/Tabs/Tabs.js +20 -26
  54. package/es/components/Tag/DismissibleTag.js +3 -2
  55. package/es/components/Tag/OperationalTag.js +3 -2
  56. package/es/components/Tag/SelectableTag.js +3 -2
  57. package/es/components/Tag/Tag.js +3 -2
  58. package/es/components/TextArea/TextArea.d.ts +1 -1
  59. package/es/components/TextArea/TextArea.js +7 -8
  60. package/es/components/TextInput/ControlledPasswordInput.js +7 -6
  61. package/es/components/TextInput/PasswordInput.js +5 -6
  62. package/es/components/TextInput/TextInput.js +4 -4
  63. package/es/components/Tile/Tile.d.ts +1 -1
  64. package/es/components/Tile/Tile.js +37 -69
  65. package/es/components/TimePicker/TimePicker.js +2 -2
  66. package/es/components/Tooltip/DefinitionTooltip.d.ts +1 -1
  67. package/es/components/Tooltip/DefinitionTooltip.js +3 -2
  68. package/es/components/UIShell/SideNav.d.ts +0 -1
  69. package/es/components/UIShell/SideNav.js +12 -3
  70. package/es/internal/useId.js +3 -4
  71. package/es/internal/usePresence.js +3 -2
  72. package/es/internal/useResizeObserver.d.ts +1 -1
  73. package/es/internal/useResizeObserver.js +5 -7
  74. package/es/tools/events.d.ts +1 -1
  75. package/lib/components/AILabel/index.d.ts +1 -1
  76. package/lib/components/AILabel/index.js +1 -12
  77. package/lib/components/Checkbox/Checkbox.js +5 -3
  78. package/lib/components/CheckboxGroup/CheckboxGroup.js +4 -3
  79. package/lib/components/CodeSnippet/CodeSnippet.d.ts +1 -1
  80. package/lib/components/ComboBox/ComboBox.d.ts +3 -4
  81. package/lib/components/ComboBox/ComboBox.js +20 -18
  82. package/lib/components/ComboButton/index.d.ts +1 -1
  83. package/lib/components/ComboButton/index.js +2 -1
  84. package/lib/components/ComposedModal/ComposedModal.js +16 -21
  85. package/lib/components/ComposedModal/ModalHeader.d.ts +2 -2
  86. package/lib/components/ComposedModal/ModalHeader.js +1 -1
  87. package/lib/components/Copy/Copy.d.ts +1 -1
  88. package/lib/components/CopyButton/CopyButton.d.ts +1 -1
  89. package/lib/components/DataTable/DataTable.d.ts +2 -0
  90. package/lib/components/DataTable/DataTable.js +6 -5
  91. package/lib/components/DataTable/Table.d.ts +1 -1
  92. package/lib/components/DataTable/Table.js +10 -4
  93. package/lib/components/DataTable/state/sorting.d.ts +4 -2
  94. package/lib/components/Dropdown/Dropdown.d.ts +3 -4
  95. package/lib/components/Dropdown/Dropdown.js +16 -13
  96. package/lib/components/FileUploader/FileUploaderItem.d.ts +1 -1
  97. package/lib/components/FileUploader/FileUploaderItem.js +2 -1
  98. package/lib/components/FluidComboBox/FluidComboBox.d.ts +2 -7
  99. package/lib/components/FluidComboBox/FluidComboBox.js +1 -2
  100. package/lib/components/FluidDropdown/FluidDropdown.d.ts +1 -6
  101. package/lib/components/FluidDropdown/FluidDropdown.js +1 -2
  102. package/lib/components/FluidMultiSelect/FluidMultiSelect.d.ts +1 -6
  103. package/lib/components/FluidMultiSelect/FluidMultiSelect.js +1 -2
  104. package/lib/components/InlineLoading/InlineLoading.js +5 -11
  105. package/lib/components/Menu/Menu.js +7 -3
  106. package/lib/components/Menu/MenuItem.d.ts +5 -1
  107. package/lib/components/Menu/MenuItem.js +11 -1
  108. package/lib/components/MenuButton/index.d.ts +1 -1
  109. package/lib/components/MenuButton/index.js +2 -1
  110. package/lib/components/MultiSelect/FilterableMultiSelect.d.ts +1 -1
  111. package/lib/components/MultiSelect/FilterableMultiSelect.js +6 -4
  112. package/lib/components/MultiSelect/MultiSelect.d.ts +3 -4
  113. package/lib/components/MultiSelect/MultiSelect.js +9 -12
  114. package/lib/components/Notification/Notification.js +5 -3
  115. package/lib/components/NumberInput/NumberInput.d.ts +1 -1
  116. package/lib/components/NumberInput/NumberInput.js +5 -4
  117. package/lib/components/OverflowMenu/OverflowMenu.d.ts +1 -0
  118. package/lib/components/OverflowMenu/OverflowMenu.js +7 -3
  119. package/lib/components/PageHeader/PageHeader.d.ts +1 -1
  120. package/lib/components/PageHeader/PageHeader.js +4 -4
  121. package/lib/components/RadioButtonGroup/RadioButtonGroup.js +4 -3
  122. package/lib/components/Select/Select.js +2 -1
  123. package/lib/components/StructuredList/StructuredList.d.ts +1 -1
  124. package/lib/components/StructuredList/StructuredList.js +2 -4
  125. package/lib/components/Tabs/Tabs.d.ts +2 -2
  126. package/lib/components/Tabs/Tabs.js +15 -21
  127. package/lib/components/Tag/DismissibleTag.js +2 -1
  128. package/lib/components/Tag/OperationalTag.js +2 -1
  129. package/lib/components/Tag/SelectableTag.js +2 -1
  130. package/lib/components/Tag/Tag.js +2 -1
  131. package/lib/components/TextArea/TextArea.d.ts +1 -1
  132. package/lib/components/TextArea/TextArea.js +7 -8
  133. package/lib/components/TextInput/ControlledPasswordInput.js +7 -6
  134. package/lib/components/TextInput/PasswordInput.js +5 -6
  135. package/lib/components/TextInput/TextInput.js +4 -4
  136. package/lib/components/Tile/Tile.d.ts +1 -1
  137. package/lib/components/Tile/Tile.js +35 -67
  138. package/lib/components/TimePicker/TimePicker.js +2 -2
  139. package/lib/components/Tooltip/DefinitionTooltip.d.ts +1 -1
  140. package/lib/components/Tooltip/DefinitionTooltip.js +3 -2
  141. package/lib/components/UIShell/SideNav.d.ts +0 -1
  142. package/lib/components/UIShell/SideNav.js +11 -2
  143. package/lib/internal/useId.js +2 -3
  144. package/lib/internal/usePresence.js +2 -1
  145. package/lib/internal/useResizeObserver.d.ts +1 -1
  146. package/lib/internal/useResizeObserver.js +4 -6
  147. package/lib/tools/events.d.ts +1 -1
  148. package/package.json +8 -8
@@ -256,9 +256,6 @@ const Dropdown = /*#__PURE__*/React.forwardRef(({
256
256
  [`${prefix}--list-box__wrapper--slug`]: slug,
257
257
  [`${prefix}--list-box__wrapper--decorator`]: decorator
258
258
  });
259
-
260
- // needs to be Capitalized for react to render it correctly
261
- const ItemToElement = itemToElement;
262
259
  const toggleButtonProps = getToggleButtonProps({
263
260
  'aria-label': ariaLabel || deprecatedAriaLabel
264
261
  });
@@ -274,10 +271,20 @@ const Dropdown = /*#__PURE__*/React.forwardRef(({
274
271
  const [currTimer, setCurrTimer] = React.useState();
275
272
  const [isTyping, setIsTyping] = React.useState(false);
276
273
  const onKeyDownHandler = React.useCallback(evt => {
277
- if (evt.code !== 'Space' || !['ArrowDown', 'ArrowUp', ' ', 'Enter'].includes(evt.key)) {
274
+ const navigationKeys = ['ArrowDown', 'ArrowUp', ' ', 'Enter'];
275
+
276
+ // If the key is not a navigation key, the user is typing
277
+ if (!navigationKeys.includes(evt.key)) {
278
278
  setIsTyping(true);
279
- }
280
- if (isTyping && evt.code === 'Space' || !['ArrowDown', 'ArrowUp', ' ', 'Enter'].includes(evt.key)) {
279
+ // Reset the timer for typing timeout
280
+ if (currTimer) {
281
+ clearTimeout(currTimer);
282
+ }
283
+ setCurrTimer(setTimeout(() => {
284
+ setIsTyping(false);
285
+ }, 3000));
286
+ } else if (isTyping && evt.key === ' ') {
287
+ // If user is typing and presses space, reset the timer
281
288
  if (currTimer) {
282
289
  clearTimeout(currTimer);
283
290
  }
@@ -381,21 +388,18 @@ const Dropdown = /*#__PURE__*/React.forwardRef(({
381
388
  })), slug ? normalizedDecorator : decorator ? /*#__PURE__*/React.createElement("div", {
382
389
  className: `${prefix}--list-box__inner-wrapper--decorator`
383
390
  }, normalizedDecorator) : '', /*#__PURE__*/React.createElement(index$2.default.Menu, menuProps, isOpen && items.map((item, index) => {
384
- const isObject = item !== null && typeof item === 'object';
385
391
  const itemProps = getItemProps({
386
392
  item,
387
393
  index
388
394
  });
389
- const title = isObject && 'text' in item && itemToElement ? item.text : itemToString(item);
395
+ const title = itemToString(item);
390
396
  return /*#__PURE__*/React.createElement(index$2.default.MenuItem, _rollupPluginBabelHelpers.extends({
391
397
  key: itemProps.id,
392
398
  isActive: selectedItem === item,
393
399
  isHighlighted: highlightedIndex === index,
394
400
  title: title,
395
401
  disabled: itemProps['aria-disabled']
396
- }, itemProps), typeof item === 'object' && ItemToElement !== undefined && ItemToElement !== null ? /*#__PURE__*/React.createElement(ItemToElement, _rollupPluginBabelHelpers.extends({
397
- key: itemProps.id
398
- }, item)) : itemToString(item), selectedItem === item && /*#__PURE__*/React.createElement(iconsReact.Checkmark, {
402
+ }, itemProps), itemToElement ? itemToElement(item) : itemToString(item), selectedItem === item && /*#__PURE__*/React.createElement(iconsReact.Checkmark, {
399
403
  className: `${prefix}--list-box__menu-item__selected-icon`
400
404
  }));
401
405
  }))), !inline && !isFluid && !normalizedProps.validation && helper, !inline && !isFluid && normalizedProps.validation);
@@ -475,8 +479,7 @@ Dropdown.propTypes = {
475
479
  */
476
480
  invalidText: PropTypes.node,
477
481
  /**
478
- * Function to render items as custom components instead of strings.
479
- * Defaults to null and is overridden by a getter
482
+ * Renders an item as a custom React node instead of a string.
480
483
  */
481
484
  itemToElement: PropTypes.func,
482
485
  /**
@@ -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.
@@ -19,6 +19,7 @@ var match = require('../../internal/keyboard/match.js');
19
19
  var useId = require('../../internal/useId.js');
20
20
  var usePrefix = require('../../internal/usePrefix.js');
21
21
  var noopFn = require('../../internal/noopFn.js');
22
+ var useIsomorphicEffect = require('../../internal/useIsomorphicEffect.js');
22
23
  var Text = require('../Text/Text.js');
23
24
  require('../Text/TextDirection.js');
24
25
  require('../Tooltip/DefinitionTooltip.js');
@@ -62,7 +63,7 @@ function FileUploaderItem({
62
63
  setIsEllipsisApplied(isActive);
63
64
  return isActive;
64
65
  };
65
- React.useLayoutEffect(() => {
66
+ useIsomorphicEffect.default(() => {
66
67
  isEllipsisActive(textRef.current);
67
68
  }, [prefix, name]);
68
69
  return /*#__PURE__*/React.createElement("span", _rollupPluginBabelHelpers.extends({
@@ -1,10 +1,10 @@
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.
6
6
  */
7
- import React, { ComponentType, type ComponentProps } from 'react';
7
+ import React, { type ComponentProps } from 'react';
8
8
  import ComboBox from '../ComboBox';
9
9
  import { ComboBoxProps } from '../ComboBox/ComboBox';
10
10
  type ItemToStringHandler<ItemType> = (item: ItemType | null) => string;
@@ -46,11 +46,6 @@ export interface FluidComboBoxProps<ItemType> extends ComboBoxProps<ItemType>, P
46
46
  * Specify if the `FluidComboBox` should render its menu items in condensed mode
47
47
  */
48
48
  isCondensed?: boolean;
49
- /**
50
- * Function to render items as custom components instead of strings.
51
- * Defaults to null and is overridden by a getter
52
- */
53
- itemToElement?: ComponentType<ItemType> | null;
54
49
  /**
55
50
  * Helper function passed to downshift that allows the library to render a
56
51
  * given item to a string label. By default, it extracts the `label` field
@@ -70,8 +70,7 @@ FluidComboBox.propTypes = {
70
70
  */
71
71
  isCondensed: PropTypes.bool,
72
72
  /**
73
- * Function to render items as custom components instead of strings.
74
- * Defaults to null and is overridden by a getter
73
+ * Renders an item as a custom React node instead of a string.
75
74
  */
76
75
  itemToElement: PropTypes.func,
77
76
  /**
@@ -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.
@@ -43,11 +43,6 @@ export interface FluidDropdownProps<ItemType> extends DropdownProps<ItemType>, P
43
43
  * Specify if the `FluidDropdown` should render its menu items in condensed mode
44
44
  */
45
45
  isCondensed?: boolean;
46
- /**
47
- * Function to render items as custom components instead of strings.
48
- * Defaults to null and is overridden by a getter
49
- */
50
- itemToElement?: React.JSXElementConstructor<ItemType> | null;
51
46
  /**
52
47
  * Helper function passed to downshift that allows the library to render a
53
48
  * given item to a string label. By default, it extracts the `label` field
@@ -71,8 +71,7 @@ FluidDropdown.propTypes = {
71
71
  */
72
72
  isCondensed: PropTypes.bool,
73
73
  /**
74
- * Function to render items as custom components instead of strings.
75
- * Defaults to null and is overridden by a getter
74
+ * Renders an item as a custom React node instead of a string.
76
75
  */
77
76
  itemToElement: PropTypes.func,
78
77
  /**
@@ -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.
@@ -66,11 +66,6 @@ export interface FluidMultiSelectProps<ItemType> extends MultiSelectProps<ItemTy
66
66
  * @deprecated This prop is deprecated in favor of new component called FluidFilterableMultiSelect and will be removed in the next major release
67
67
  */
68
68
  isFilterable?: boolean;
69
- /**
70
- * Function to render items as custom components instead of strings.
71
- * Defaults to null and is overridden by a getter
72
- */
73
- itemToElement?: React.JSXElementConstructor<ItemType>;
74
69
  /**
75
70
  * Helper function passed to downshift that allows the library to render a
76
71
  * given item to a string label. By default, it extracts the `label` field
@@ -110,8 +110,7 @@ FluidMultiSelect.propTypes = {
110
110
  */
111
111
  isFilterable: PropTypes.bool,
112
112
  /**
113
- * Function to render items as custom components instead of strings.
114
- * Defaults to null and is overridden by a getter
113
+ * Renders an item as a custom React node instead of a string.
115
114
  */
116
115
  itemToElement: PropTypes.func,
117
116
  /**
@@ -56,7 +56,10 @@ const InlineLoading = ({
56
56
  className: `${prefix}--inline-loading__checkmark-container`
57
57
  }, /*#__PURE__*/React.createElement("title", null, iconLabel));
58
58
  }
59
- if (status === 'active') {
59
+ if (status === 'inactive' || status === 'active') {
60
+ if (status === 'inactive') {
61
+ return undefined;
62
+ }
60
63
  if (!iconDescription) {
61
64
  iconLabel = 'loading';
62
65
  }
@@ -67,15 +70,6 @@ const InlineLoading = ({
67
70
  active: status === 'active'
68
71
  });
69
72
  }
70
- if (status === 'inactive') {
71
- if (!iconDescription) {
72
- iconLabel = 'not loading';
73
- }
74
- return /*#__PURE__*/React.createElement("title", {
75
- className: `${prefix}--inline-loading__inactive-status`
76
- }, iconLabel);
77
- }
78
- return undefined;
79
73
  };
80
74
  const loadingText = description && /*#__PURE__*/React.createElement("div", {
81
75
  className: `${prefix}--inline-loading__text`
@@ -87,7 +81,7 @@ const InlineLoading = ({
87
81
  return /*#__PURE__*/React.createElement("div", _rollupPluginBabelHelpers.extends({
88
82
  className: loadingClasses
89
83
  }, rest, {
90
- "aria-live": rest['aria-live'] ?? 'assertive'
84
+ "aria-live": rest['aria-live'] ?? (status === 'inactive' ? 'off' : 'assertive')
91
85
  }), loadingAnimation, loadingText);
92
86
  };
93
87
  InlineLoading.propTypes = {
@@ -50,6 +50,8 @@ const Menu = /*#__PURE__*/React.forwardRef(function Menu({
50
50
  const [childState, childDispatch] = React.useReducer(MenuContext.menuReducer, {
51
51
  ...context.state,
52
52
  isRoot: false,
53
+ hasIcons: false,
54
+ hasSelectableItems: false,
53
55
  size,
54
56
  requestCloseRoot: isRoot ? handleClose : context.state.requestCloseRoot
55
57
  });
@@ -112,9 +114,9 @@ const Menu = /*#__PURE__*/React.forwardRef(function Menu({
112
114
  function handleKeyDown(e) {
113
115
  e.stopPropagation();
114
116
 
115
- // if the user presses escape or this is a submenu
116
- // and the user presses ArrowLeft, close it
117
- if ((match.match(e, keys.Escape) || !isRoot && match.match(e, keys.ArrowLeft)) && onClose) {
117
+ // If the user presses escape or tab, or this is a submenu and the user presses ArrowLeft, close it.
118
+ if ((match.match(e, keys.Escape) || match.match(e, keys.Tab) || !isRoot && match.match(e, keys.ArrowLeft)) && onClose) {
119
+ e.preventDefault();
118
120
  handleClose();
119
121
  } else {
120
122
  focusItem(e);
@@ -248,6 +250,8 @@ const Menu = /*#__PURE__*/React.forwardRef(function Menu({
248
250
  }
249
251
  return [fitValue(ranges.x, 'x') ?? -1, fitValue(ranges.y, 'y') ?? -1];
250
252
  }
253
+
254
+ // When a menu is opened, focus the first item.
251
255
  React.useEffect(() => {
252
256
  if (open) {
253
257
  const raf = requestAnimationFrame(() => {
@@ -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.
@@ -14,6 +14,10 @@ export interface MenuItemProps extends LiHTMLAttributes<HTMLLIElement> {
14
14
  * Additional CSS class names.
15
15
  */
16
16
  className?: string;
17
+ /**
18
+ * Specify the message read by screen readers for the danger menu item variant
19
+ */
20
+ dangerDescription?: string;
17
21
  /**
18
22
  * Specify whether the MenuItem is disabled or not.
19
23
  */
@@ -18,6 +18,7 @@ var match = require('../../internal/keyboard/match.js');
18
18
  var useControllableState = require('../../internal/useControllableState.js');
19
19
  var useMergedRefs = require('../../internal/useMergedRefs.js');
20
20
  var usePrefix = require('../../internal/usePrefix.js');
21
+ var useId = require('../../internal/useId.js');
21
22
  var Menu = require('./Menu.js');
22
23
  var MenuContext = require('./MenuContext.js');
23
24
  require('../LayoutDirection/LayoutDirection.js');
@@ -30,6 +31,7 @@ var _Checkmark, _CaretLeft, _CaretRight;
30
31
  const MenuItem = /*#__PURE__*/React.forwardRef(function MenuItem({
31
32
  children,
32
33
  className,
34
+ dangerDescription = 'danger',
33
35
  disabled,
34
36
  kind = 'default',
35
37
  label,
@@ -166,6 +168,7 @@ const MenuItem = /*#__PURE__*/React.forwardRef(function MenuItem({
166
168
  }
167
169
  });
168
170
  }, [floatingStyles, refs.floating]);
171
+ const assistiveId = useId.useId('danger-description');
169
172
  return /*#__PURE__*/React.createElement(react.FloatingFocusManager, {
170
173
  context: floatingContext,
171
174
  order: ['reference', 'floating'],
@@ -190,7 +193,10 @@ const MenuItem = /*#__PURE__*/React.forwardRef(function MenuItem({
190
193
  }, IconElement && /*#__PURE__*/React.createElement(IconElement, null)), /*#__PURE__*/React.createElement(Text.Text, {
191
194
  as: "div",
192
195
  className: `${prefix}--menu-item__label`
193
- }, label), shortcut && !hasChildren && /*#__PURE__*/React.createElement("div", {
196
+ }, label), isDanger && /*#__PURE__*/React.createElement("span", {
197
+ id: assistiveId,
198
+ className: `${prefix}--visually-hidden`
199
+ }, dangerDescription), shortcut && !hasChildren && /*#__PURE__*/React.createElement("div", {
194
200
  className: `${prefix}--menu-item__shortcut`
195
201
  }, shortcut), hasChildren && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
196
202
  className: `${prefix}--menu-item__shortcut`
@@ -213,6 +219,10 @@ MenuItem.propTypes = {
213
219
  * Additional CSS class names.
214
220
  */
215
221
  className: PropTypes.string,
222
+ /**
223
+ * Specify the message read by screen readers for the danger menu item variant
224
+ */
225
+ dangerDescription: PropTypes.string,
216
226
  /**
217
227
  * Specify whether the MenuItem is disabled or not.
218
228
  */
@@ -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.
@@ -19,6 +19,7 @@ require('../Menu/MenuItem.js');
19
19
  var useAttachedMenu = require('../../internal/useAttachedMenu.js');
20
20
  var useId = require('../../internal/useId.js');
21
21
  var usePrefix = require('../../internal/usePrefix.js');
22
+ var useIsomorphicEffect = require('../../internal/useIsomorphicEffect.js');
22
23
  var react = require('@floating-ui/react');
23
24
  var index = require('../FeatureFlags/index.js');
24
25
  var mergeRefs = require('../../tools/mergeRefs.js');
@@ -97,7 +98,7 @@ const MenuButton = /*#__PURE__*/React.forwardRef(({
97
98
  handleMousedown,
98
99
  handleClose
99
100
  } = useAttachedMenu.useAttachedMenu(triggerRef);
100
- React.useLayoutEffect(() => {
101
+ useIsomorphicEffect.default(() => {
101
102
  Object.keys(floatingStyles).forEach(style => {
102
103
  if (refs.floating.current) {
103
104
  let value = floatingStyles[style];
@@ -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.
@@ -36,6 +36,7 @@ var index = require('../AILabel/index.js');
36
36
  var defaultItemToString = require('../../internal/defaultItemToString.js');
37
37
  var utils = require('../../internal/utils.js');
38
38
  var useNormalizedInputProps = require('../../internal/useNormalizedInputProps.js');
39
+ var useIsomorphicEffect = require('../../internal/useIsomorphicEffect.js');
39
40
  var ListBoxPropTypes = require('../ListBox/ListBoxPropTypes.js');
40
41
 
41
42
  const {
@@ -191,7 +192,7 @@ const FilterableMultiSelect = /*#__PURE__*/React.forwardRef(function FilterableM
191
192
  }), react.hide()],
192
193
  whileElementsMounted: react.autoUpdate
193
194
  } : {});
194
- React.useLayoutEffect(() => {
195
+ useIsomorphicEffect.default(() => {
195
196
  if (autoAlign) {
196
197
  const updatedFloatingStyles = {
197
198
  ...floatingStyles,
@@ -261,7 +262,8 @@ const FilterableMultiSelect = /*#__PURE__*/React.forwardRef(function FilterableM
261
262
  [`${prefix}--list-box__wrapper--decorator`]: decorator,
262
263
  [`${prefix}--autoalign`]: autoAlign
263
264
  });
264
- const helperId = !helperText ? undefined : `filterablemultiselect-helper-text-${filterableMultiSelectInstanceId}`;
265
+ const hasHelper = typeof helperText !== 'undefined' && helperText !== null;
266
+ const helperId = !hasHelper ? undefined : `filterablemultiselect-helper-text-${filterableMultiSelectInstanceId}`;
265
267
  const labelId = `${id}-label`;
266
268
  const titleClasses = cx({
267
269
  [`${prefix}--label`]: true,
@@ -277,10 +279,10 @@ const FilterableMultiSelect = /*#__PURE__*/React.forwardRef(function FilterableM
277
279
  [`${prefix}--text-input--empty`]: !inputValue,
278
280
  [`${prefix}--text-input--light`]: light
279
281
  });
280
- const helper = helperText ? /*#__PURE__*/React.createElement("div", {
282
+ const helper = hasHelper && /*#__PURE__*/React.createElement("div", {
281
283
  id: helperId,
282
284
  className: helperClasses
283
- }, helperText) : null;
285
+ }, helperText);
284
286
  const menuId = `${id}__menu`;
285
287
  const inputId = `${id}-input`;
286
288
  React.useEffect(() => {
@@ -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.
@@ -82,10 +82,9 @@ export interface MultiSelectProps<ItemType> extends MultiSelectSortingProps<Item
82
82
  */
83
83
  invalidText?: ReactNode;
84
84
  /**
85
- * Function to render items as custom components instead of strings.
86
- * Defaults to null and is overridden by a getter
85
+ * Renders an item as a custom React node instead of a string.
87
86
  */
88
- itemToElement?: React.JSXElementConstructor<ItemType>;
87
+ itemToElement?: ((item: ItemType) => NonNullable<ReactNode>) | null;
89
88
  /**
90
89
  * Helper function passed to downshift that allows the library to render a
91
90
  * given item to a string label. By default, it extracts the `label` field
@@ -35,6 +35,7 @@ var index$1 = require('../AILabel/index.js');
35
35
  var defaultItemToString = require('../../internal/defaultItemToString.js');
36
36
  var utils = require('../../internal/utils.js');
37
37
  var useNormalizedInputProps = require('../../internal/useNormalizedInputProps.js');
38
+ var useIsomorphicEffect = require('../../internal/useIsomorphicEffect.js');
38
39
  var ListBoxPropTypes = require('../ListBox/ListBoxPropTypes.js');
39
40
 
40
41
  const {
@@ -145,7 +146,7 @@ const MultiSelect = /*#__PURE__*/React.forwardRef(({
145
146
  }), autoAlign && react.hide()],
146
147
  whileElementsMounted: react.autoUpdate
147
148
  } : {});
148
- React.useLayoutEffect(() => {
149
+ useIsomorphicEffect.default(() => {
149
150
  if (enableFloatingStyles) {
150
151
  const updatedFloatingStyles = {
151
152
  ...floatingStyles,
@@ -296,10 +297,6 @@ const MultiSelect = /*#__PURE__*/React.forwardRef(({
296
297
  [`${prefix}--autoalign`]: enableFloatingStyles,
297
298
  [`${prefix}--multi-select--selectall`]: selectAll
298
299
  });
299
-
300
- // needs to be capitalized for react to render it correctly
301
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
302
- const ItemToElement = itemToElement;
303
300
  if (selectionFeedback === 'fixed') {
304
301
  sortOptions.selectedItems = [];
305
302
  } else if (selectionFeedback === 'top-after-reopen') {
@@ -392,8 +389,11 @@ const MultiSelect = /*#__PURE__*/React.forwardRef(({
392
389
  [`${prefix}--list-box__field--wrapper--input-focused`]: inputFocused
393
390
  });
394
391
  const handleFocus = evt => {
395
- // eslint-disable-next-line @typescript-eslint/no-unused-expressions -- https://github.com/carbon-design-system/carbon/issues/20452
396
- evt.target.classList.contains(`${prefix}--tag__close-icon`) ? setIsFocused(false) : setIsFocused(evt.type === 'focus' ? true : false);
392
+ if (evt.target.classList.contains(`${prefix}--tag__close-icon`)) {
393
+ setIsFocused(false);
394
+ } else {
395
+ setIsFocused(evt.type === 'focus' ? true : false);
396
+ }
397
397
  };
398
398
  const readOnlyEventHandlers = readOnly ? {
399
399
  onClick: evt => {
@@ -528,9 +528,7 @@ const MultiSelect = /*#__PURE__*/React.forwardRef(({
528
528
  className: `${prefix}--checkbox-wrapper`
529
529
  }, /*#__PURE__*/React.createElement(Checkbox.default, {
530
530
  id: `${itemProps.id}__checkbox`,
531
- labelText: itemToElement ? /*#__PURE__*/React.createElement(ItemToElement, _rollupPluginBabelHelpers.extends({
532
- key: itemProps.id
533
- }, item)) : itemText,
531
+ labelText: itemToElement ? itemToElement(item) : itemText,
534
532
  checked: isChecked,
535
533
  title: useTitleInItem ? itemText : undefined,
536
534
  indeterminate: isIndeterminate,
@@ -621,8 +619,7 @@ MultiSelect.propTypes = {
621
619
  */
622
620
  invalidText: PropTypes.node,
623
621
  /**
624
- * Function to render items as custom components instead of strings.
625
- * Defaults to null and is overridden by a getter
622
+ * Renders an item as a custom React node instead of a string.
626
623
  */
627
624
  itemToElement: PropTypes.func,
628
625
  /**
@@ -574,6 +574,9 @@ function ActionableNotification({
574
574
  role: "link",
575
575
  className: `${prefix}--visually-hidden`
576
576
  }, "Focus sentinel"), /*#__PURE__*/React.createElement("div", {
577
+ ref: innerModal,
578
+ className: `${prefix}--actionable-notification__focus-wrapper`
579
+ }, /*#__PURE__*/React.createElement("div", {
577
580
  className: `${prefix}--actionable-notification__details`
578
581
  }, /*#__PURE__*/React.createElement(NotificationIcon, {
579
582
  notificationType: inline ? 'inline' : 'toast',
@@ -595,8 +598,7 @@ function ActionableNotification({
595
598
  as: "div",
596
599
  className: `${prefix}--actionable-notification__caption`
597
600
  }, caption), children))), /*#__PURE__*/React.createElement("div", {
598
- className: `${prefix}--actionable-notification__button-wrapper`,
599
- ref: innerModal
601
+ className: `${prefix}--actionable-notification__button-wrapper`
600
602
  }, actionButtonLabel && /*#__PURE__*/React.createElement(NotificationActionButton, {
601
603
  onClick: onActionButtonClick,
602
604
  inline: inline
@@ -604,7 +606,7 @@ function ActionableNotification({
604
606
  "aria-label": deprecatedAriaLabel || ariaLabel,
605
607
  notificationType: "actionable",
606
608
  onClick: handleCloseButtonClick
607
- })), !focusTrapWithoutSentinels && /*#__PURE__*/React.createElement("span", {
609
+ }))), !focusTrapWithoutSentinels && /*#__PURE__*/React.createElement("span", {
608
610
  ref: endTrap,
609
611
  tabIndex: 0,
610
612
  role: "link",
@@ -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.
@@ -566,10 +566,11 @@ const NumberInput = /*#__PURE__*/React.forwardRef((props, forwardRef) => {
566
566
  onKeyUp: onKeyUp,
567
567
  onKeyDown: e => {
568
568
  if (type === 'text') {
569
- // eslint-disable-next-line @typescript-eslint/no-unused-expressions -- https://github.com/carbon-design-system/carbon/issues/20452
570
- match.match(e, keys.ArrowUp) && handleStep(e, 'up');
571
- // eslint-disable-next-line @typescript-eslint/no-unused-expressions -- https://github.com/carbon-design-system/carbon/issues/20452
572
- match.match(e, keys.ArrowDown) && handleStep(e, 'down');
569
+ if (match.match(e, keys.ArrowUp)) {
570
+ handleStep(e, 'up');
571
+ } else if (match.match(e, keys.ArrowDown)) {
572
+ handleStep(e, 'down');
573
+ }
573
574
  }
574
575
  if (rest?.onKeyDown) {
575
576
  rest?.onKeyDown(e);
@@ -44,6 +44,7 @@ export interface OverflowMenuProps extends Omit<IconButtonProps, 'type' | 'aria-
44
44
  */
45
45
  flipped?: boolean;
46
46
  /**
47
+ * @deprecated Tab key is handled with event handler so no need for focus trap.
47
48
  * Enable or disable focus trap behavior
48
49
  */
49
50
  focusTrap?: boolean;
@@ -101,7 +101,7 @@ const OverflowMenu = /*#__PURE__*/React.forwardRef(({
101
101
  className,
102
102
  direction = FloatingMenu.DIRECTION_BOTTOM,
103
103
  flipped = false,
104
- focusTrap = true,
104
+ focusTrap = false,
105
105
  iconClass,
106
106
  iconDescription = 'Options',
107
107
  id,
@@ -204,12 +204,15 @@ const OverflowMenu = /*#__PURE__*/React.forwardRef(({
204
204
  evt.preventDefault();
205
205
  }
206
206
 
207
- // Close the overflow menu on escape
208
- if (match.matches(evt, [keys.Escape])) {
207
+ // Close the overflow menu on escape or tab.
208
+ if (match.matches(evt, [keys.Escape, keys.Tab])) {
209
209
  closeMenuOnEscape();
210
210
 
211
211
  // Stop the esc keypress from bubbling out and closing something it shouldn't
212
212
  evt.stopPropagation();
213
+
214
+ // Stop the tab key from making the browser focus somewhere else.
215
+ evt.preventDefault();
213
216
  }
214
217
  };
215
218
 
@@ -394,6 +397,7 @@ OverflowMenu.propTypes = {
394
397
  */
395
398
  flipped: PropTypes.bool,
396
399
  /**
400
+ * @deprecated Tab key is handled with event handler so no need for focus trap.
397
401
  * Enable or disable focus trap behavior
398
402
  */
399
403
  focusTrap: PropTypes.bool,
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright IBM Corp. 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.
@@ -37,6 +37,7 @@ require('../Grid/Row.js');
37
37
  var Column = require('../Grid/Column.js');
38
38
  require('../Grid/ColumnHang.js');
39
39
  require('../Grid/GridContext.js');
40
+ var useIsomorphicEffect = require('../../internal/useIsomorphicEffect.js');
40
41
 
41
42
  /**
42
43
  * ----------
@@ -132,9 +133,8 @@ const PageHeaderContent = /*#__PURE__*/React.forwardRef(({
132
133
  setIsEllipsisApplied(element.offsetHeight < element.scrollHeight);
133
134
  return element.offsetHeight < element.scrollHeight;
134
135
  };
135
- React.useLayoutEffect(() => {
136
- // eslint-disable-next-line @typescript-eslint/no-unused-expressions -- https://github.com/carbon-design-system/carbon/issues/20452
137
- titleRef.current && isEllipsisActive(titleRef.current);
136
+ useIsomorphicEffect.default(() => {
137
+ if (titleRef.current) isEllipsisActive(titleRef.current);
138
138
  }, [title]);
139
139
  return /*#__PURE__*/React.createElement("div", _rollupPluginBabelHelpers.extends({
140
140
  className: classNames,
@@ -222,7 +222,7 @@ const PageHeaderContentPageActions = ({
222
222
 
223
223
  // need to set the grid columns width based on the menu button's width
224
224
  // to avoid overlapping when resizing
225
- React.useLayoutEffect(() => {
225
+ useIsomorphicEffect.default(() => {
226
226
  if (menuButtonVisibility && offsetRef.current) {
227
227
  const width = offsetRef.current.offsetWidth;
228
228
  document.documentElement.style.setProperty('--pageheader-title-grid-width', `${width}px`);
@@ -101,11 +101,12 @@ const RadioButtonGroup = /*#__PURE__*/React.forwardRef((props, ref) => {
101
101
  const helperClasses = cx(`${prefix}--form__helper-text`, {
102
102
  [`${prefix}--form__helper-text--disabled`]: disabled
103
103
  });
104
- const helperId = !helperText ? undefined : `radio-button-group-helper-text-${radioButtonGroupInstanceId}`;
105
- const helper = helperText ? /*#__PURE__*/React.createElement("div", {
104
+ const hasHelper = typeof helperText !== 'undefined' && helperText !== null;
105
+ const helperId = !hasHelper ? undefined : `radio-button-group-helper-text-${radioButtonGroupInstanceId}`;
106
+ const helper = hasHelper && /*#__PURE__*/React.createElement("div", {
106
107
  id: helperId,
107
108
  className: helperClasses
108
- }, helperText) : null;
109
+ }, helperText);
109
110
  const divRef = React.useRef(null);
110
111
 
111
112
  // AILabel is always size `mini`