@carbon/react 1.78.0-rc.0 → 1.78.1

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 (231) hide show
  1. package/.playwright/INTERNAL_AVT_REPORT_DO_NOT_USE.json +851 -816
  2. package/es/components/Accordion/AccordionItem.js +2 -2
  3. package/es/components/Button/Button.d.ts +2 -3
  4. package/es/components/Button/Button.js +1 -2
  5. package/es/components/Button/ButtonBase.js +1 -1
  6. package/es/components/ChatButton/ChatButton.d.ts +2 -3
  7. package/es/components/ChatButton/ChatButton.js +1 -2
  8. package/es/components/ComboBox/ComboBox.js +40 -30
  9. package/es/components/ComboButton/index.js +0 -1
  10. package/es/components/ComposedModal/ComposedModal.js +65 -51
  11. package/es/components/ContainedList/ContainedListItem/ContainedListItem.d.ts +2 -2
  12. package/es/components/ContainedList/ContainedListItem/ContainedListItem.js +1 -1
  13. package/es/components/ContentSwitcher/ContentSwitcher.js +3 -3
  14. package/es/components/ContextMenu/useContextMenu.d.ts +0 -1
  15. package/es/components/ContextMenu/useContextMenu.js +1 -2
  16. package/es/components/DataTable/TableBatchAction.d.ts +3 -3
  17. package/es/components/DataTable/TableBatchAction.js +1 -1
  18. package/es/components/DataTable/TableContainer.d.ts +1 -1
  19. package/es/components/DataTable/TableContainer.js +3 -3
  20. package/es/components/DataTable/TableExpandHeader.d.ts +6 -5
  21. package/es/components/DataTable/TableToolbarMenu.d.ts +2 -2
  22. package/es/components/DataTable/TableToolbarMenu.js +1 -1
  23. package/es/components/DatePicker/DatePicker.js +2 -2
  24. package/es/components/DatePicker/plugins/fixEventsPlugin.js +1 -1
  25. package/es/components/Dialog/index.d.ts +42 -4
  26. package/es/components/Dialog/index.js +177 -0
  27. package/es/components/ExpandableSearch/ExpandableSearch.js +2 -2
  28. package/es/components/FeatureFlags/index.d.ts +3 -1
  29. package/es/components/FeatureFlags/index.js +3 -0
  30. package/es/components/FileUploader/FileUploader.d.ts +1 -1
  31. package/es/components/FileUploader/FileUploader.js +2 -2
  32. package/es/components/FileUploader/FileUploaderButton.js +2 -2
  33. package/es/components/FileUploader/FileUploaderDropContainer.d.ts +1 -1
  34. package/es/components/FileUploader/FileUploaderDropContainer.js +6 -4
  35. package/es/components/FileUploader/FileUploaderItem.d.ts +1 -1
  36. package/es/components/FileUploader/FileUploaderItem.js +2 -2
  37. package/es/components/Grid/CSSGrid.js +18 -14
  38. package/es/components/Grid/FlexGrid.js +7 -6
  39. package/es/components/Grid/GridTypes.d.ts +5 -3
  40. package/es/components/IconButton/index.js +3 -3
  41. package/es/components/Layer/index.d.ts +4 -6
  42. package/es/components/Layer/index.js +5 -6
  43. package/es/components/Link/Link.d.ts +2 -3
  44. package/es/components/Link/Link.js +1 -2
  45. package/es/components/ListBox/ListBoxMenuItem.d.ts +3 -3
  46. package/es/components/ListBox/ListBoxMenuItem.js +37 -15
  47. package/es/components/Menu/Menu.d.ts +1 -0
  48. package/es/components/Menu/Menu.js +7 -9
  49. package/es/components/Menu/MenuContext.d.ts +4 -4
  50. package/es/components/Menu/MenuContext.js +6 -1
  51. package/es/components/Menu/MenuItem.d.ts +2 -2
  52. package/es/components/Menu/MenuItem.js +16 -24
  53. package/es/components/MenuButton/index.js +14 -2
  54. package/es/components/Modal/Modal.js +121 -49
  55. package/es/components/ModalWrapper/ModalWrapper.js +1 -1
  56. package/es/components/MultiSelect/FilterableMultiSelect.js +3 -3
  57. package/es/components/MultiSelect/MultiSelect.js +2 -2
  58. package/es/components/Notification/Notification.d.ts +5 -13
  59. package/es/components/Notification/Notification.js +7 -9
  60. package/es/components/OverflowMenu/OverflowMenu.d.ts +4 -8
  61. package/es/components/OverflowMenu/OverflowMenu.js +3 -3
  62. package/es/components/OverflowMenu/next/index.d.ts +2 -2
  63. package/es/components/OverflowMenu/next/index.js +1 -1
  64. package/es/components/OverflowMenuItem/OverflowMenuItem.js +2 -2
  65. package/es/components/ProgressIndicator/ProgressIndicator.js +2 -2
  66. package/es/components/RadioTile/RadioTile.js +2 -2
  67. package/es/components/Search/Search.d.ts +2 -3
  68. package/es/components/Search/Search.js +4 -6
  69. package/es/components/Slider/Slider.d.ts +16 -15
  70. package/es/components/Slider/Slider.js +22 -22
  71. package/es/components/Tabs/Tabs.d.ts +3 -6
  72. package/es/components/Tabs/Tabs.js +8 -9
  73. package/es/components/Tag/DismissibleTag.d.ts +3 -5
  74. package/es/components/Tag/DismissibleTag.js +1 -2
  75. package/es/components/Tag/OperationalTag.d.ts +2 -3
  76. package/es/components/Tag/OperationalTag.js +1 -2
  77. package/es/components/Tag/SelectableTag.d.ts +3 -5
  78. package/es/components/Tag/SelectableTag.js +1 -2
  79. package/es/components/Tag/Tag.d.ts +2 -3
  80. package/es/components/Tag/Tag.js +1 -2
  81. package/es/components/Tile/Tile.d.ts +3 -5
  82. package/es/components/Tile/Tile.js +8 -6
  83. package/es/components/Toggletip/index.js +2 -2
  84. package/es/components/Tooltip/DefinitionTooltip.js +2 -2
  85. package/es/components/Tooltip/Tooltip.d.ts +1 -1
  86. package/es/components/Tooltip/Tooltip.js +2 -2
  87. package/es/components/TreeView/TreeNode.d.ts +3 -5
  88. package/es/components/TreeView/TreeNode.js +3 -4
  89. package/es/components/TreeView/TreeView.js +2 -2
  90. package/es/components/UIShell/HeaderContainer.js +2 -2
  91. package/es/components/UIShell/HeaderMenu.js +2 -2
  92. package/es/components/UIShell/HeaderPanel.js +2 -2
  93. package/es/components/UIShell/SideNav.d.ts +1 -1
  94. package/es/components/UIShell/SideNav.js +2 -2
  95. package/es/components/UIShell/SideNavHeader.d.ts +2 -3
  96. package/es/components/UIShell/SideNavHeader.js +1 -2
  97. package/es/components/UIShell/SideNavLink.d.ts +2 -2
  98. package/es/components/UIShell/SideNavLink.js +1 -1
  99. package/es/components/UIShell/SideNavMenu.d.ts +2 -2
  100. package/es/components/UIShell/SideNavMenu.js +3 -3
  101. package/es/components/UIShell/SwitcherItem.js +2 -2
  102. package/es/internal/FloatingMenu.js +4 -4
  103. package/es/internal/OptimizedResize.d.ts +18 -0
  104. package/es/internal/OptimizedResize.js +21 -24
  105. package/es/internal/keyboard/index.d.ts +9 -0
  106. package/es/internal/keyboard/keys.d.ts +23 -0
  107. package/es/internal/keyboard/keys.js +2 -2
  108. package/es/internal/keyboard/match.d.ts +26 -0
  109. package/es/internal/keyboard/match.js +17 -41
  110. package/es/internal/keyboard/navigation.d.ts +37 -0
  111. package/es/internal/keyboard/navigation.js +15 -27
  112. package/es/internal/useMergedRefs.js +3 -0
  113. package/lib/components/Accordion/AccordionItem.js +2 -2
  114. package/lib/components/Button/Button.d.ts +2 -3
  115. package/lib/components/Button/Button.js +1 -2
  116. package/lib/components/Button/ButtonBase.js +1 -1
  117. package/lib/components/ChatButton/ChatButton.d.ts +2 -3
  118. package/lib/components/ChatButton/ChatButton.js +1 -2
  119. package/lib/components/ComboBox/ComboBox.js +40 -30
  120. package/lib/components/ComboButton/index.js +0 -1
  121. package/lib/components/ComposedModal/ComposedModal.js +64 -50
  122. package/lib/components/ContainedList/ContainedListItem/ContainedListItem.d.ts +2 -2
  123. package/lib/components/ContainedList/ContainedListItem/ContainedListItem.js +1 -1
  124. package/lib/components/ContentSwitcher/ContentSwitcher.js +3 -3
  125. package/lib/components/ContextMenu/useContextMenu.d.ts +0 -1
  126. package/lib/components/ContextMenu/useContextMenu.js +1 -2
  127. package/lib/components/DataTable/TableBatchAction.d.ts +3 -3
  128. package/lib/components/DataTable/TableBatchAction.js +1 -1
  129. package/lib/components/DataTable/TableContainer.d.ts +1 -1
  130. package/lib/components/DataTable/TableContainer.js +3 -3
  131. package/lib/components/DataTable/TableExpandHeader.d.ts +6 -5
  132. package/lib/components/DataTable/TableToolbarMenu.d.ts +2 -2
  133. package/lib/components/DataTable/TableToolbarMenu.js +1 -1
  134. package/lib/components/DatePicker/DatePicker.js +2 -2
  135. package/lib/components/DatePicker/plugins/fixEventsPlugin.js +1 -1
  136. package/lib/components/Dialog/index.d.ts +42 -4
  137. package/lib/components/Dialog/index.js +190 -0
  138. package/lib/components/ExpandableSearch/ExpandableSearch.js +2 -2
  139. package/lib/components/FeatureFlags/index.d.ts +3 -1
  140. package/lib/components/FeatureFlags/index.js +3 -0
  141. package/lib/components/FileUploader/FileUploader.d.ts +1 -1
  142. package/lib/components/FileUploader/FileUploader.js +2 -2
  143. package/lib/components/FileUploader/FileUploaderButton.js +2 -2
  144. package/lib/components/FileUploader/FileUploaderDropContainer.d.ts +1 -1
  145. package/lib/components/FileUploader/FileUploaderDropContainer.js +6 -4
  146. package/lib/components/FileUploader/FileUploaderItem.d.ts +1 -1
  147. package/lib/components/FileUploader/FileUploaderItem.js +2 -2
  148. package/lib/components/Grid/CSSGrid.js +18 -14
  149. package/lib/components/Grid/FlexGrid.js +7 -6
  150. package/lib/components/Grid/GridTypes.d.ts +5 -3
  151. package/lib/components/IconButton/index.js +3 -3
  152. package/lib/components/Layer/index.d.ts +4 -6
  153. package/lib/components/Layer/index.js +5 -6
  154. package/lib/components/Link/Link.d.ts +2 -3
  155. package/lib/components/Link/Link.js +1 -2
  156. package/lib/components/ListBox/ListBoxMenuItem.d.ts +3 -3
  157. package/lib/components/ListBox/ListBoxMenuItem.js +36 -14
  158. package/lib/components/Menu/Menu.d.ts +1 -0
  159. package/lib/components/Menu/Menu.js +7 -9
  160. package/lib/components/Menu/MenuContext.d.ts +4 -4
  161. package/lib/components/Menu/MenuContext.js +6 -1
  162. package/lib/components/Menu/MenuItem.d.ts +2 -2
  163. package/lib/components/Menu/MenuItem.js +15 -23
  164. package/lib/components/MenuButton/index.js +14 -2
  165. package/lib/components/Modal/Modal.js +123 -51
  166. package/lib/components/ModalWrapper/ModalWrapper.js +1 -1
  167. package/lib/components/MultiSelect/FilterableMultiSelect.js +3 -3
  168. package/lib/components/MultiSelect/MultiSelect.js +2 -2
  169. package/lib/components/Notification/Notification.d.ts +5 -13
  170. package/lib/components/Notification/Notification.js +7 -9
  171. package/lib/components/OverflowMenu/OverflowMenu.d.ts +4 -8
  172. package/lib/components/OverflowMenu/OverflowMenu.js +3 -3
  173. package/lib/components/OverflowMenu/next/index.d.ts +2 -2
  174. package/lib/components/OverflowMenu/next/index.js +1 -1
  175. package/lib/components/OverflowMenuItem/OverflowMenuItem.js +2 -2
  176. package/lib/components/ProgressIndicator/ProgressIndicator.js +2 -2
  177. package/lib/components/RadioTile/RadioTile.js +2 -2
  178. package/lib/components/Search/Search.d.ts +2 -3
  179. package/lib/components/Search/Search.js +4 -6
  180. package/lib/components/Slider/Slider.d.ts +16 -15
  181. package/lib/components/Slider/Slider.js +22 -22
  182. package/lib/components/Tabs/Tabs.d.ts +3 -6
  183. package/lib/components/Tabs/Tabs.js +8 -9
  184. package/lib/components/Tag/DismissibleTag.d.ts +3 -5
  185. package/lib/components/Tag/DismissibleTag.js +1 -2
  186. package/lib/components/Tag/OperationalTag.d.ts +2 -3
  187. package/lib/components/Tag/OperationalTag.js +1 -2
  188. package/lib/components/Tag/SelectableTag.d.ts +3 -5
  189. package/lib/components/Tag/SelectableTag.js +1 -2
  190. package/lib/components/Tag/Tag.d.ts +2 -3
  191. package/lib/components/Tag/Tag.js +1 -2
  192. package/lib/components/Tile/Tile.d.ts +3 -5
  193. package/lib/components/Tile/Tile.js +8 -6
  194. package/lib/components/Toggletip/index.js +2 -2
  195. package/lib/components/Tooltip/DefinitionTooltip.js +2 -2
  196. package/lib/components/Tooltip/Tooltip.d.ts +1 -1
  197. package/lib/components/Tooltip/Tooltip.js +2 -2
  198. package/lib/components/TreeView/TreeNode.d.ts +3 -5
  199. package/lib/components/TreeView/TreeNode.js +3 -4
  200. package/lib/components/TreeView/TreeView.js +2 -2
  201. package/lib/components/UIShell/HeaderContainer.js +2 -2
  202. package/lib/components/UIShell/HeaderMenu.js +2 -2
  203. package/lib/components/UIShell/HeaderPanel.js +2 -2
  204. package/lib/components/UIShell/SideNav.d.ts +1 -1
  205. package/lib/components/UIShell/SideNav.js +2 -2
  206. package/lib/components/UIShell/SideNavHeader.d.ts +2 -3
  207. package/lib/components/UIShell/SideNavHeader.js +1 -2
  208. package/lib/components/UIShell/SideNavLink.d.ts +2 -2
  209. package/lib/components/UIShell/SideNavLink.js +1 -1
  210. package/lib/components/UIShell/SideNavMenu.d.ts +2 -2
  211. package/lib/components/UIShell/SideNavMenu.js +3 -3
  212. package/lib/components/UIShell/SwitcherItem.js +2 -2
  213. package/lib/internal/FloatingMenu.js +5 -5
  214. package/lib/internal/OptimizedResize.d.ts +18 -0
  215. package/lib/internal/OptimizedResize.js +21 -24
  216. package/lib/internal/keyboard/index.d.ts +9 -0
  217. package/lib/internal/keyboard/keys.d.ts +23 -0
  218. package/lib/internal/keyboard/keys.js +2 -2
  219. package/lib/internal/keyboard/match.d.ts +26 -0
  220. package/lib/internal/keyboard/match.js +17 -41
  221. package/lib/internal/keyboard/navigation.d.ts +37 -0
  222. package/lib/internal/keyboard/navigation.js +15 -27
  223. package/lib/internal/useMergedRefs.js +3 -0
  224. package/package.json +7 -7
  225. package/scss/components/dialog/_dialog.scss +9 -0
  226. package/scss/components/dialog/_index.scss +9 -0
  227. package/telemetry.yml +1 -0
  228. package/es/components/Modal/next/index.d.ts +0 -171
  229. package/es/internal/focus/index.js +0 -15
  230. package/lib/components/Modal/next/index.d.ts +0 -171
  231. package/lib/internal/focus/index.js +0 -19
@@ -11,13 +11,13 @@ import cx from 'classnames';
11
11
  import PropTypes from 'prop-types';
12
12
  import React__default, { useState, useContext } from 'react';
13
13
  import '../Text/index.js';
14
+ import { Escape } from '../../internal/keyboard/keys.js';
15
+ import { match } from '../../internal/keyboard/match.js';
14
16
  import { useId } from '../../internal/useId.js';
15
17
  import deprecate from '../../prop-types/deprecate.js';
16
18
  import { usePrefix } from '../../internal/usePrefix.js';
17
19
  import { AccordionContext } from './AccordionProvider.js';
18
- import { match } from '../../internal/keyboard/match.js';
19
20
  import { Text } from '../Text/Text.js';
20
- import { Escape } from '../../internal/keyboard/keys.js';
21
21
 
22
22
  const defaultRenderToggle = props => /*#__PURE__*/React__default.createElement("button", _extends({
23
23
  type: "button"
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright IBM Corp. 2016, 2023
2
+ * Copyright IBM Corp. 2016, 2025
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.
@@ -50,8 +50,7 @@ export interface ButtonBaseProps extends React.ButtonHTMLAttributes<HTMLButtonEl
50
50
  */
51
51
  rel?: React.AnchorHTMLAttributes<HTMLAnchorElement>['rel'];
52
52
  /**
53
- * Optional prop to allow overriding the icon rendering.
54
- * Can be a React component class
53
+ * A component used to render an icon.
55
54
  */
56
55
  renderIcon?: React.ElementType;
57
56
  /**
@@ -194,8 +194,7 @@ Button.propTypes = {
194
194
  */
195
195
  rel: PropTypes.string,
196
196
  /**
197
- * Optional prop to allow overriding the icon rendering.
198
- * Can be a React component class
197
+ * A component used to render an icon.
199
198
  */
200
199
  renderIcon: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
201
200
  /**
@@ -49,7 +49,7 @@ const ButtonBase = /*#__PURE__*/React__default.forwardRef(function ButtonBase(_r
49
49
  [`${prefix}--btn--${kind}`]: kind,
50
50
  [`${prefix}--btn--disabled`]: disabled,
51
51
  [`${prefix}--btn--expressive`]: isExpressive,
52
- [`${prefix}--btn--icon-only`]: hasIconOnly && !className?.includes(`${prefix}--btn--icon-only`),
52
+ [`${prefix}--btn--icon-only`]: hasIconOnly,
53
53
  [`${prefix}--btn--selected`]: hasIconOnly && isSelected && kind === 'ghost'
54
54
  });
55
55
  const commonProps = {
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright IBM Corp. 2024
2
+ * Copyright IBM Corp. 2024, 2025
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.
@@ -33,8 +33,7 @@ export interface ChatButtonProps extends React.ButtonHTMLAttributes<HTMLButtonEl
33
33
  */
34
34
  kind?: ChatButtonKind;
35
35
  /**
36
- * Optional prop to specify an icon to be rendered.
37
- * Can be a React component class
36
+ * A component used to render an icon.
38
37
  */
39
38
  renderIcon?: ComponentType | FunctionComponent;
40
39
  /**
@@ -75,8 +75,7 @@ ChatButton.propTypes = {
75
75
  */
76
76
  kind: PropTypes.oneOf(['primary', 'secondary', 'danger', 'ghost', 'tertiary']),
77
77
  /**
78
- * Optional prop to specify an icon to be rendered.
79
- * Can be a React component class
78
+ * A component used to render an icon.
80
79
  */
81
80
  // @ts-expect-error: PropTypes are not expressive enough to cover this case
82
81
  renderIcon: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
@@ -16,6 +16,8 @@ import isEqual from 'react-fast-compare';
16
16
  import ListBox from '../ListBox/index.js';
17
17
  import ListBoxSelection from '../ListBox/next/ListBoxSelection.js';
18
18
  import ListBoxTrigger from '../ListBox/next/ListBoxTrigger.js';
19
+ import { Space, Enter, Escape, Home, End } from '../../internal/keyboard/keys.js';
20
+ import { match } from '../../internal/keyboard/match.js';
19
21
  import { useId } from '../../internal/useId.js';
20
22
  import mergeRefs from '../../tools/mergeRefs.js';
21
23
  import deprecate from '../../prop-types/deprecate.js';
@@ -24,10 +26,8 @@ import '../FluidForm/FluidForm.js';
24
26
  import { FormContext } from '../FluidForm/FormContext.js';
25
27
  import { useFloating, flip, hide, autoUpdate } from '@floating-ui/react';
26
28
  import { useFeatureFlag } from '../FeatureFlags/index.js';
27
- import { match } from '../../internal/keyboard/match.js';
28
29
  import { ListBoxSize } from '../ListBox/ListBoxPropTypes.js';
29
30
  import { Text } from '../Text/Text.js';
30
- import { Space, Enter, Escape, Home, End } from '../../internal/keyboard/keys.js';
31
31
 
32
32
  const {
33
33
  InputBlur,
@@ -215,7 +215,7 @@ const ComboBox = /*#__PURE__*/forwardRef((props, ref) => {
215
215
  const textInput = useRef(null);
216
216
  const comboBoxInstanceId = useId();
217
217
  const [isFocused, setIsFocused] = useState(false);
218
- const savedOnInputChange = useRef(onInputChange);
218
+ const prevInputValue = useRef(inputValue);
219
219
  const prevSelectedItemProp = useRef(selectedItemProp);
220
220
 
221
221
  // fully controlled combobox: handle changes to selectedItemProp
@@ -246,12 +246,12 @@ const ComboBox = /*#__PURE__*/forwardRef((props, ref) => {
246
246
  itemToString,
247
247
  inputValue
248
248
  }) : defaultShouldFilterItem());
249
+
250
+ // call onInputChange whenever inputValue is updated
249
251
  useEffect(() => {
250
- savedOnInputChange.current = onInputChange;
251
- }, [onInputChange]);
252
- useEffect(() => {
253
- if (savedOnInputChange.current) {
254
- savedOnInputChange.current(inputValue);
252
+ if (prevInputValue.current !== inputValue) {
253
+ prevInputValue.current = inputValue;
254
+ onInputChange && onInputChange(inputValue);
255
255
  }
256
256
  }, [inputValue]);
257
257
  const handleSelectionClear = () => {
@@ -301,31 +301,41 @@ const ComboBox = /*#__PURE__*/forwardRef((props, ref) => {
301
301
  return changes;
302
302
  }
303
303
  case InputKeyDownEnter:
304
- if (highlightedIndex === -1 && !allowCustomValue && state.selectedItem) {
305
- return {
306
- ...changes,
307
- selectedItem: null,
308
- inputValue: state.inputValue
309
- };
310
- }
311
- if (allowCustomValue) {
312
- setInputValue(inputValue);
313
- setHighlightedIndex(changes.selectedItem);
314
- if (onChange) {
315
- onChange({
316
- selectedItem: changes.selectedItem,
304
+ if (!allowCustomValue) {
305
+ const highlightedIndex = indexToHighlight(inputValue);
306
+ const matchingItem = items[highlightedIndex];
307
+ if (matchingItem) {
308
+ // Prevent matching items that are marked as `disabled` from
309
+ // being selected.
310
+ if (matchingItem.disabled) {
311
+ return state;
312
+ }
313
+
314
+ // Select the matching item.
315
+ return {
316
+ ...changes,
317
+ selectedItem: matchingItem,
318
+ inputValue: itemToString(matchingItem)
319
+ };
320
+ }
321
+
322
+ // If no matching item is found and there is an existing
323
+ // selection, clear the selection.
324
+ if (state.selectedItem !== null) {
325
+ return {
326
+ ...changes,
327
+ selectedItem: null,
317
328
  inputValue
318
- });
329
+ };
319
330
  }
320
- return changes;
321
- } else if (changes.selectedItem && !allowCustomValue) {
322
- return changes;
323
- } else {
324
- return {
325
- ...changes,
326
- isOpen: true
327
- };
328
331
  }
332
+
333
+ // For `allowCustomValue` or if no matching item is found, keep the
334
+ // menu open.
335
+ return {
336
+ ...changes,
337
+ isOpen: true
338
+ };
329
339
  case FunctionToggleMenu:
330
340
  case ToggleButtonClick:
331
341
  if (!changes.isOpen && state.inputValue && highlightedIndex === -1 && !allowCustomValue) {
@@ -166,7 +166,6 @@ const ComboButton = /*#__PURE__*/React__default.forwardRef(function ComboButton(
166
166
  ref: refs.setFloating,
167
167
  id: id,
168
168
  label: t('carbon.combo-button.additional-actions'),
169
- mode: "basic",
170
169
  size: size$1,
171
170
  open: open,
172
171
  onClose: handleClose
@@ -17,14 +17,15 @@ import mergeRefs from '../../tools/mergeRefs.js';
17
17
  import cx from 'classnames';
18
18
  import toggleClass from '../../tools/toggleClass.js';
19
19
  import requiredIfGivenPropIsTruthy from '../../prop-types/requiredIfGivenPropIsTruthy.js';
20
- import wrapFocus, { wrapFocusWithoutSentinels, elementOrParentIsFloatingMenu } from '../../internal/wrapFocus.js';
20
+ import wrapFocus, { elementOrParentIsFloatingMenu } from '../../internal/wrapFocus.js';
21
21
  import { usePrefix } from '../../internal/usePrefix.js';
22
+ import { Escape } from '../../internal/keyboard/keys.js';
23
+ import { match } from '../../internal/keyboard/match.js';
22
24
  import { useFeatureFlag } from '../FeatureFlags/index.js';
23
25
  import { composeEventHandlers } from '../../tools/events.js';
24
26
  import deprecate from '../../prop-types/deprecate.js';
27
+ import { unstable__Dialog } from '../Dialog/index.js';
25
28
  import { debounce } from '../../node_modules/es-toolkit/dist/compat/function/debounce.mjs.js';
26
- import { match } from '../../internal/keyboard/match.js';
27
- import { Escape, Tab } from '../../internal/keyboard/keys.js';
28
29
 
29
30
  const ModalBody = /*#__PURE__*/React__default.forwardRef(function ModalBody(_ref, ref) {
30
31
  let {
@@ -120,12 +121,14 @@ const ComposedModal = /*#__PURE__*/React__default.forwardRef(function ComposedMo
120
121
  const startSentinel = useRef(null);
121
122
  const endSentinel = useRef(null);
122
123
  const onMouseDownTarget = useRef(null);
123
- const focusTrapWithoutSentinels = useFeatureFlag('enable-experimental-focus-wrap-without-sentinels');
124
+ const enableDialogElement =
125
+ // useFeatureFlag('enable-experimental-focus-wrap-without-sentinels') ||
126
+ useFeatureFlag('enable-dialog-element');
124
127
 
125
128
  // Keep track of modal open/close state
126
129
  // and propagate it to the document.body
127
130
  useEffect(() => {
128
- if (open !== wasOpen) {
131
+ if (!enableDialogElement && open !== wasOpen) {
129
132
  setIsOpen(!!open);
130
133
  setWasOpen(!!open);
131
134
  toggleClass(document.body, `${prefix}--body--with-modal-open`, !!open);
@@ -133,22 +136,19 @@ const ComposedModal = /*#__PURE__*/React__default.forwardRef(function ComposedMo
133
136
  }, [open, wasOpen, prefix]);
134
137
  // Remove the document.body className on unmount
135
138
  useEffect(() => {
136
- return () => {
137
- toggleClass(document.body, `${prefix}--body--with-modal-open`, false);
138
- };
139
+ if (!enableDialogElement) {
140
+ return () => {
141
+ toggleClass(document.body, `${prefix}--body--with-modal-open`, false);
142
+ };
143
+ }
139
144
  }, []); // eslint-disable-line react-hooks/exhaustive-deps
140
145
 
141
146
  function handleKeyDown(event) {
142
- event.stopPropagation();
143
- if (match(event, Escape)) {
144
- closeModal(event);
145
- }
146
- if (focusTrapWithoutSentinels && open && match(event, Tab) && innerModal.current) {
147
- wrapFocusWithoutSentinels({
148
- containerNode: innerModal.current,
149
- currentActiveNode: event.target,
150
- event: event
151
- });
147
+ if (!enableDialogElement) {
148
+ event.stopPropagation();
149
+ if (match(event, Escape)) {
150
+ closeModal(event);
151
+ }
152
152
  }
153
153
  onKeyDown?.(event);
154
154
  }
@@ -228,32 +228,34 @@ const ComposedModal = /*#__PURE__*/React__default.forwardRef(function ComposedMo
228
228
  }
229
229
  });
230
230
  useEffect(() => {
231
- if (!open && launcherButtonRef) {
231
+ if (!enableDialogElement && !open && launcherButtonRef) {
232
232
  setTimeout(() => {
233
233
  launcherButtonRef?.current?.focus();
234
234
  });
235
235
  }
236
236
  }, [open, launcherButtonRef]);
237
237
  useEffect(() => {
238
- const initialFocus = focusContainerElement => {
239
- const containerElement = focusContainerElement || innerModal.current;
240
- const primaryFocusElement = containerElement ? containerElement.querySelector(danger ? `.${prefix}--btn--secondary` : selectorPrimaryFocus) : null;
241
- if (primaryFocusElement) {
242
- return primaryFocusElement;
243
- }
244
- return button && button.current;
245
- };
246
- const focusButton = focusContainerElement => {
247
- const target = initialFocus(focusContainerElement);
248
- const closeButton = focusContainerElement.querySelector(`.${prefix}--modal-close`);
249
- if (target) {
250
- target.focus();
251
- } else if (!target && closeButton) {
252
- closeButton?.focus();
238
+ if (!enableDialogElement) {
239
+ const initialFocus = focusContainerElement => {
240
+ const containerElement = focusContainerElement || innerModal.current;
241
+ const primaryFocusElement = containerElement ? containerElement.querySelector(danger ? `.${prefix}--btn--secondary` : selectorPrimaryFocus) : null;
242
+ if (primaryFocusElement) {
243
+ return primaryFocusElement;
244
+ }
245
+ return button && button.current;
246
+ };
247
+ const focusButton = focusContainerElement => {
248
+ const target = initialFocus(focusContainerElement);
249
+ const closeButton = focusContainerElement.querySelector(`.${prefix}--modal-close`);
250
+ if (target) {
251
+ target.focus();
252
+ } else if (!target && closeButton) {
253
+ closeButton?.focus();
254
+ }
255
+ };
256
+ if (open && isOpen) {
257
+ focusButton(innerModal.current);
253
258
  }
254
- };
255
- if (open && isOpen) {
256
- focusButton(innerModal.current);
257
259
  }
258
260
  }, [open, selectorPrimaryFocus, isOpen]);
259
261
 
@@ -264,23 +266,24 @@ const ComposedModal = /*#__PURE__*/React__default.forwardRef(function ComposedMo
264
266
  size: 'sm'
265
267
  });
266
268
  }
267
- return /*#__PURE__*/React__default.createElement(Layer, _extends({}, rest, {
268
- level: 0,
269
- role: "presentation",
270
- ref: ref,
271
- "aria-hidden": !open,
272
- onBlur: !focusTrapWithoutSentinels ? handleBlur : () => {},
273
- onClick: composeEventHandlers([rest?.onClick, handleOnClick]),
274
- onMouseDown: composeEventHandlers([rest?.onMouseDown, handleOnMouseDown]),
275
- onKeyDown: handleKeyDown,
276
- className: modalClass
277
- }), /*#__PURE__*/React__default.createElement("div", {
269
+ const modalBody = enableDialogElement ? /*#__PURE__*/React__default.createElement(unstable__Dialog, {
270
+ open: open,
271
+ modal: true,
272
+ className: containerClass,
273
+ "aria-label": ariaLabel ? ariaLabel : generatedAriaLabel,
274
+ "aria-labelledby": ariaLabelledBy
275
+ }, /*#__PURE__*/React__default.createElement("div", {
276
+ ref: innerModal,
277
+ className: `${prefix}--modal-container-body`
278
+ }, slug ? normalizedDecorator : decorator ? /*#__PURE__*/React__default.createElement("div", {
279
+ className: `${prefix}--modal--inner__decorator`
280
+ }, normalizedDecorator) : '', childrenWithProps)) : /*#__PURE__*/React__default.createElement("div", {
278
281
  className: containerClass,
279
282
  role: "dialog",
280
283
  "aria-modal": "true",
281
284
  "aria-label": ariaLabel ? ariaLabel : generatedAriaLabel,
282
285
  "aria-labelledby": ariaLabelledBy
283
- }, !focusTrapWithoutSentinels && /*#__PURE__*/React__default.createElement("button", {
286
+ }, /*#__PURE__*/React__default.createElement("button", {
284
287
  type: "button",
285
288
  ref: startSentinel,
286
289
  className: `${prefix}--visually-hidden`
@@ -289,11 +292,22 @@ const ComposedModal = /*#__PURE__*/React__default.forwardRef(function ComposedMo
289
292
  className: `${prefix}--modal-container-body`
290
293
  }, slug ? normalizedDecorator : decorator ? /*#__PURE__*/React__default.createElement("div", {
291
294
  className: `${prefix}--modal--inner__decorator`
292
- }, normalizedDecorator) : '', childrenWithProps), !focusTrapWithoutSentinels && /*#__PURE__*/React__default.createElement("button", {
295
+ }, normalizedDecorator) : '', childrenWithProps), /*#__PURE__*/React__default.createElement("button", {
293
296
  type: "button",
294
297
  ref: endSentinel,
295
298
  className: `${prefix}--visually-hidden`
296
- }, "Focus sentinel")));
299
+ }, "Focus sentinel"));
300
+ return /*#__PURE__*/React__default.createElement(Layer, _extends({}, rest, {
301
+ level: 0,
302
+ role: "presentation",
303
+ ref: ref,
304
+ "aria-hidden": !open,
305
+ onBlur: !enableDialogElement ? handleBlur : () => {},
306
+ onClick: composeEventHandlers([rest?.onClick, handleOnClick]),
307
+ onMouseDown: composeEventHandlers([rest?.onMouseDown, handleOnMouseDown]),
308
+ onKeyDown: handleKeyDown,
309
+ className: modalClass
310
+ }), modalBody);
297
311
  });
298
312
  ComposedModal.propTypes = {
299
313
  /**
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright IBM Corp. 2022
2
+ * Copyright IBM Corp. 2022, 2025
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.
@@ -27,7 +27,7 @@ interface ContainedListItemProps {
27
27
  */
28
28
  onClick?: () => void;
29
29
  /**
30
- * Provide an optional icon to render in front of the item's content.
30
+ * A component used to render an icon.
31
31
  */
32
32
  renderIcon?: ComponentType | FunctionComponent;
33
33
  }
@@ -71,7 +71,7 @@ ContainedListItem.propTypes = {
71
71
  */
72
72
  onClick: PropTypes.func,
73
73
  /**
74
- * Provide an optional icon to render in front of the item's content.
74
+ * A component used to render an icon.
75
75
  */
76
76
  // @ts-expect-error: PropTypes are not expressive enough to cover this case
77
77
  renderIcon: PropTypes.oneOfType([PropTypes.func, PropTypes.object])
@@ -12,11 +12,11 @@ import cx from 'classnames';
12
12
  import deprecate from '../../prop-types/deprecate.js';
13
13
  import { LayoutConstraint } from '../Layout/index.js';
14
14
  import { composeEventHandlers } from '../../tools/events.js';
15
- import { PrefixContext } from '../../internal/usePrefix.js';
16
- import { noopFn } from '../../internal/noopFn.js';
15
+ import { ArrowRight, ArrowLeft } from '../../internal/keyboard/keys.js';
17
16
  import { matches } from '../../internal/keyboard/match.js';
18
17
  import { getNextIndex } from '../../internal/keyboard/navigation.js';
19
- import { ArrowRight, ArrowLeft } from '../../internal/keyboard/keys.js';
18
+ import { PrefixContext } from '../../internal/usePrefix.js';
19
+ import { noopFn } from '../../internal/noopFn.js';
20
20
 
21
21
  class ContentSwitcher extends React__default.Component {
22
22
  constructor() {
@@ -10,7 +10,6 @@ export interface ContextMenuProps {
10
10
  x: number;
11
11
  y: number;
12
12
  onClose: () => void;
13
- mode: string;
14
13
  }
15
14
  /**
16
15
  * @param {TriggerType} [trigger=document] The element or ref which should trigger the Menu on right-click
@@ -41,8 +41,7 @@ function useContextMenu() {
41
41
  open,
42
42
  x: position[0],
43
43
  y: position[1],
44
- onClose,
45
- mode: 'full'
44
+ onClose
46
45
  };
47
46
  }
48
47
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright IBM Corp. 2016, 2023
2
+ * Copyright IBM Corp. 2016, 2025
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.
@@ -17,7 +17,7 @@ export interface TableBatchActionProps extends React.ButtonHTMLAttributes<HTMLBu
17
17
  */
18
18
  iconDescription?: string;
19
19
  /**
20
- * Optional function to render your own icon in the underlying button
20
+ * A component used to render an icon.
21
21
  */
22
22
  renderIcon?: React.ElementType;
23
23
  }
@@ -34,7 +34,7 @@ declare const TableBatchAction: {
34
34
  */
35
35
  iconDescription: (props: any) => Error | undefined;
36
36
  /**
37
- * Optional function to render your own icon in the underlying button
37
+ * A component used to render an icon.
38
38
  */
39
39
  renderIcon: PropTypes.Requireable<object>;
40
40
  };
@@ -39,7 +39,7 @@ TableBatchAction.propTypes = {
39
39
  return undefined;
40
40
  },
41
41
  /**
42
- * Optional function to render your own icon in the underlying button
42
+ * A component used to render an icon.
43
43
  */
44
44
  renderIcon: PropTypes.oneOfType([PropTypes.func, PropTypes.object])
45
45
  };
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright IBM Corp. 2016, 2023
2
+ * Copyright IBM Corp. 2016, 2025
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.
@@ -41,12 +41,12 @@ const TableContainer = _ref => {
41
41
  value: value
42
42
  }, /*#__PURE__*/React__default.createElement("div", _extends({}, rest, {
43
43
  className: tableContainerClasses
44
- }), title && /*#__PURE__*/React__default.createElement("div", {
44
+ }), (title || description) && /*#__PURE__*/React__default.createElement("div", {
45
45
  className: `${prefix}--data-table-header`
46
- }, /*#__PURE__*/React__default.createElement("h4", {
46
+ }, title && /*#__PURE__*/React__default.createElement("h4", {
47
47
  className: `${prefix}--data-table-header__title`,
48
48
  id: titleId
49
- }, title), /*#__PURE__*/React__default.createElement("p", {
49
+ }, title), description && /*#__PURE__*/React__default.createElement("p", {
50
50
  className: `${prefix}--data-table-header__description`,
51
51
  id: descriptionId
52
52
  }, description)), children));
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright IBM Corp. 2016, 2023
2
+ * Copyright IBM Corp. 2016, 2025
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,15 +45,16 @@ export type TableExpandHeaderPropsBase = {
45
45
  */
46
46
  onExpand?(event: React.MouseEvent<HTMLButtonElement>): void;
47
47
  } & ReactAttr<HTMLTableCellElement>;
48
- export type TableExpandHeaderPropsWithToggle = Omit<TableExpandHeaderPropsBase, 'ariaLabel' | 'aria-label' | 'enableToggle' | 'onExpand'> & {
48
+ export type TableExpandHeaderPropsWithToggle = Omit<TableExpandHeaderPropsBase, 'aria-label' | 'enableToggle' | 'onExpand'> & {
49
49
  enableToggle: true;
50
- ariaLabel: string;
51
50
  ['aria-label']: string;
52
51
  onExpand(event: React.MouseEvent<HTMLButtonElement>): void;
53
52
  };
54
- export type TableExpandHeaderPropsWithExpando = Omit<TableExpandHeaderPropsBase, 'ariaLabel' | 'aria-label' | 'enableExpando' | 'onExpand'> & {
53
+ export type TableExpandHeaderPropsWithExpando = Omit<TableExpandHeaderPropsBase, 'aria-label' | 'enableExpando' | 'onExpand'> & {
54
+ /**
55
+ * @deprecated The enableExpando prop is being replaced by `enableToggle`
56
+ */
55
57
  enableExpando: true;
56
- ariaLabel: string;
57
58
  ['aria-label']: string;
58
59
  onExpand(event: React.MouseEvent<HTMLButtonElement>): void;
59
60
  };
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright IBM Corp. 2016, 2023
2
+ * Copyright IBM Corp. 2016, 2025
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.
@@ -20,7 +20,7 @@ export interface TableToolbarMenuProps extends React.HTMLAttributes<HTMLDivEleme
20
20
  */
21
21
  menuOptionsClass?: string;
22
22
  /**
23
- * Optional prop to allow overriding the default menu icon
23
+ * A component used to render an icon.
24
24
  */
25
25
  renderIcon?: any;
26
26
  }
@@ -51,7 +51,7 @@ TableToolbarMenu.propTypes = {
51
51
  */
52
52
  menuOptionsClass: PropTypes.string,
53
53
  /**
54
- * Optional prop to allow overriding the default menu icon
54
+ * A component used to render an icon.
55
55
  */
56
56
  renderIcon: PropTypes.oneOfType([PropTypes.func, PropTypes.object])
57
57
  };
@@ -16,13 +16,13 @@ import carbonFlatpickrAppendToPlugin from './plugins/appendToPlugin.js';
16
16
  import carbonFlatpickrFixEventsPlugin from './plugins/fixEventsPlugin.js';
17
17
  import carbonFlatpickrRangePlugin from './plugins/rangePlugin.js';
18
18
  import deprecate from '../../prop-types/deprecate.js';
19
+ import { Escape, ArrowDown, Enter, Tab } from '../../internal/keyboard/keys.js';
20
+ import { match } from '../../internal/keyboard/match.js';
19
21
  import { usePrefix } from '../../internal/usePrefix.js';
20
22
  import { useSavedCallback } from '../../internal/useSavedCallback.js';
21
23
  import '../FluidForm/FluidForm.js';
22
24
  import { FormContext } from '../FluidForm/FormContext.js';
23
25
  import { WarningFilled, WarningAltFilled } from '@carbon/icons-react';
24
- import { match } from '../../internal/keyboard/match.js';
25
- import { Escape, ArrowDown, Enter, Tab } from '../../internal/keyboard/keys.js';
26
26
 
27
27
  // Weekdays shorthand for english locale
28
28
  l10n.en.weekdays.shorthand.forEach((_day, index) => {
@@ -5,8 +5,8 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
 
8
- import { match } from '../../../internal/keyboard/match.js';
9
8
  import { Enter, ArrowLeft, ArrowRight, ArrowDown } from '../../../internal/keyboard/keys.js';
9
+ import { match } from '../../../internal/keyboard/match.js';
10
10
 
11
11
  /**
12
12
  * @param {object} config Plugin configuration.