@carbon/react 1.78.1 → 1.78.2

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 (217) hide show
  1. package/.playwright/INTERNAL_AVT_REPORT_DO_NOT_USE.json +764 -764
  2. package/es/components/Accordion/AccordionItem.js +2 -2
  3. package/es/components/Button/Button.d.ts +3 -2
  4. package/es/components/Button/Button.js +2 -1
  5. package/es/components/Button/ButtonBase.js +1 -1
  6. package/es/components/ChatButton/ChatButton.d.ts +3 -2
  7. package/es/components/ChatButton/ChatButton.js +2 -1
  8. package/es/components/ComboBox/ComboBox.js +24 -34
  9. package/es/components/ComposedModal/ComposedModal.js +51 -65
  10. package/es/components/ContainedList/ContainedListItem/ContainedListItem.d.ts +2 -2
  11. package/es/components/ContainedList/ContainedListItem/ContainedListItem.js +1 -1
  12. package/es/components/ContentSwitcher/ContentSwitcher.js +3 -3
  13. package/es/components/DataTable/TableBatchAction.d.ts +3 -3
  14. package/es/components/DataTable/TableBatchAction.js +1 -1
  15. package/es/components/DataTable/TableContainer.d.ts +1 -1
  16. package/es/components/DataTable/TableContainer.js +3 -3
  17. package/es/components/DataTable/TableExpandHeader.d.ts +5 -6
  18. package/es/components/DataTable/TableToolbarMenu.d.ts +2 -2
  19. package/es/components/DataTable/TableToolbarMenu.js +1 -1
  20. package/es/components/DatePicker/DatePicker.js +2 -2
  21. package/es/components/DatePicker/plugins/fixEventsPlugin.js +1 -1
  22. package/es/components/Dialog/index.d.ts +4 -42
  23. package/es/components/ExpandableSearch/ExpandableSearch.js +2 -2
  24. package/es/components/FeatureFlags/index.d.ts +1 -3
  25. package/es/components/FeatureFlags/index.js +0 -3
  26. package/es/components/FileUploader/FileUploader.d.ts +1 -1
  27. package/es/components/FileUploader/FileUploader.js +2 -2
  28. package/es/components/FileUploader/FileUploaderButton.js +2 -2
  29. package/es/components/FileUploader/FileUploaderDropContainer.d.ts +1 -1
  30. package/es/components/FileUploader/FileUploaderDropContainer.js +4 -6
  31. package/es/components/FileUploader/FileUploaderItem.d.ts +1 -1
  32. package/es/components/FileUploader/FileUploaderItem.js +2 -2
  33. package/es/components/Grid/CSSGrid.js +14 -18
  34. package/es/components/Grid/FlexGrid.js +6 -7
  35. package/es/components/Grid/GridTypes.d.ts +3 -5
  36. package/es/components/IconButton/index.js +3 -3
  37. package/es/components/Layer/index.d.ts +6 -4
  38. package/es/components/Layer/index.js +6 -5
  39. package/es/components/Link/Link.d.ts +3 -2
  40. package/es/components/Link/Link.js +2 -1
  41. package/es/components/ListBox/ListBoxMenuItem.d.ts +3 -3
  42. package/es/components/ListBox/ListBoxMenuItem.js +15 -37
  43. package/es/components/Menu/Menu.js +2 -2
  44. package/es/components/Menu/MenuItem.d.ts +2 -2
  45. package/es/components/Menu/MenuItem.js +3 -3
  46. package/es/components/Modal/Modal.js +49 -121
  47. package/es/components/Modal/next/index.d.ts +171 -0
  48. package/es/components/ModalWrapper/ModalWrapper.js +1 -1
  49. package/es/components/MultiSelect/FilterableMultiSelect.js +3 -3
  50. package/es/components/MultiSelect/MultiSelect.js +2 -2
  51. package/es/components/Notification/Notification.d.ts +13 -5
  52. package/es/components/Notification/Notification.js +4 -3
  53. package/es/components/OverflowMenu/OverflowMenu.d.ts +8 -4
  54. package/es/components/OverflowMenu/OverflowMenu.js +3 -3
  55. package/es/components/OverflowMenu/next/index.d.ts +2 -2
  56. package/es/components/OverflowMenu/next/index.js +1 -1
  57. package/es/components/OverflowMenuItem/OverflowMenuItem.js +2 -2
  58. package/es/components/ProgressIndicator/ProgressIndicator.js +2 -2
  59. package/es/components/RadioTile/RadioTile.js +2 -2
  60. package/es/components/Search/Search.d.ts +3 -2
  61. package/es/components/Search/Search.js +6 -4
  62. package/es/components/Slider/Slider.d.ts +15 -16
  63. package/es/components/Slider/Slider.js +22 -22
  64. package/es/components/Tabs/Tabs.d.ts +6 -3
  65. package/es/components/Tabs/Tabs.js +9 -8
  66. package/es/components/Tag/DismissibleTag.d.ts +5 -3
  67. package/es/components/Tag/DismissibleTag.js +2 -1
  68. package/es/components/Tag/OperationalTag.d.ts +3 -2
  69. package/es/components/Tag/OperationalTag.js +2 -1
  70. package/es/components/Tag/SelectableTag.d.ts +5 -3
  71. package/es/components/Tag/SelectableTag.js +2 -1
  72. package/es/components/Tag/Tag.d.ts +3 -2
  73. package/es/components/Tag/Tag.js +2 -1
  74. package/es/components/Tile/Tile.d.ts +5 -3
  75. package/es/components/Tile/Tile.js +6 -8
  76. package/es/components/Toggletip/index.js +2 -2
  77. package/es/components/Tooltip/DefinitionTooltip.js +2 -2
  78. package/es/components/Tooltip/Tooltip.d.ts +1 -1
  79. package/es/components/Tooltip/Tooltip.js +2 -2
  80. package/es/components/TreeView/TreeNode.d.ts +5 -3
  81. package/es/components/TreeView/TreeNode.js +4 -3
  82. package/es/components/TreeView/TreeView.js +2 -2
  83. package/es/components/UIShell/HeaderContainer.js +2 -2
  84. package/es/components/UIShell/HeaderMenu.js +2 -2
  85. package/es/components/UIShell/HeaderPanel.js +2 -2
  86. package/es/components/UIShell/SideNav.d.ts +1 -1
  87. package/es/components/UIShell/SideNav.js +2 -2
  88. package/es/components/UIShell/SideNavHeader.d.ts +3 -2
  89. package/es/components/UIShell/SideNavHeader.js +2 -1
  90. package/es/components/UIShell/SideNavLink.d.ts +2 -2
  91. package/es/components/UIShell/SideNavLink.js +1 -1
  92. package/es/components/UIShell/SideNavMenu.d.ts +2 -2
  93. package/es/components/UIShell/SideNavMenu.js +3 -3
  94. package/es/components/UIShell/SwitcherItem.js +2 -2
  95. package/es/internal/FloatingMenu.js +4 -4
  96. package/es/internal/OptimizedResize.js +24 -21
  97. package/es/internal/focus/index.js +15 -0
  98. package/es/internal/keyboard/keys.js +2 -2
  99. package/es/internal/keyboard/match.js +41 -17
  100. package/es/internal/keyboard/navigation.js +27 -15
  101. package/es/internal/useMergedRefs.js +0 -3
  102. package/lib/components/Accordion/AccordionItem.js +2 -2
  103. package/lib/components/Button/Button.d.ts +3 -2
  104. package/lib/components/Button/Button.js +2 -1
  105. package/lib/components/Button/ButtonBase.js +1 -1
  106. package/lib/components/ChatButton/ChatButton.d.ts +3 -2
  107. package/lib/components/ChatButton/ChatButton.js +2 -1
  108. package/lib/components/ComboBox/ComboBox.js +24 -34
  109. package/lib/components/ComposedModal/ComposedModal.js +50 -64
  110. package/lib/components/ContainedList/ContainedListItem/ContainedListItem.d.ts +2 -2
  111. package/lib/components/ContainedList/ContainedListItem/ContainedListItem.js +1 -1
  112. package/lib/components/ContentSwitcher/ContentSwitcher.js +3 -3
  113. package/lib/components/DataTable/TableBatchAction.d.ts +3 -3
  114. package/lib/components/DataTable/TableBatchAction.js +1 -1
  115. package/lib/components/DataTable/TableContainer.d.ts +1 -1
  116. package/lib/components/DataTable/TableContainer.js +3 -3
  117. package/lib/components/DataTable/TableExpandHeader.d.ts +5 -6
  118. package/lib/components/DataTable/TableToolbarMenu.d.ts +2 -2
  119. package/lib/components/DataTable/TableToolbarMenu.js +1 -1
  120. package/lib/components/DatePicker/DatePicker.js +2 -2
  121. package/lib/components/DatePicker/plugins/fixEventsPlugin.js +1 -1
  122. package/lib/components/Dialog/index.d.ts +4 -42
  123. package/lib/components/ExpandableSearch/ExpandableSearch.js +2 -2
  124. package/lib/components/FeatureFlags/index.d.ts +1 -3
  125. package/lib/components/FeatureFlags/index.js +0 -3
  126. package/lib/components/FileUploader/FileUploader.d.ts +1 -1
  127. package/lib/components/FileUploader/FileUploader.js +2 -2
  128. package/lib/components/FileUploader/FileUploaderButton.js +2 -2
  129. package/lib/components/FileUploader/FileUploaderDropContainer.d.ts +1 -1
  130. package/lib/components/FileUploader/FileUploaderDropContainer.js +4 -6
  131. package/lib/components/FileUploader/FileUploaderItem.d.ts +1 -1
  132. package/lib/components/FileUploader/FileUploaderItem.js +2 -2
  133. package/lib/components/Grid/CSSGrid.js +14 -18
  134. package/lib/components/Grid/FlexGrid.js +6 -7
  135. package/lib/components/Grid/GridTypes.d.ts +3 -5
  136. package/lib/components/IconButton/index.js +3 -3
  137. package/lib/components/Layer/index.d.ts +6 -4
  138. package/lib/components/Layer/index.js +6 -5
  139. package/lib/components/Link/Link.d.ts +3 -2
  140. package/lib/components/Link/Link.js +2 -1
  141. package/lib/components/ListBox/ListBoxMenuItem.d.ts +3 -3
  142. package/lib/components/ListBox/ListBoxMenuItem.js +14 -36
  143. package/lib/components/Menu/Menu.js +2 -2
  144. package/lib/components/Menu/MenuItem.d.ts +2 -2
  145. package/lib/components/Menu/MenuItem.js +3 -3
  146. package/lib/components/Modal/Modal.js +51 -123
  147. package/lib/components/Modal/next/index.d.ts +171 -0
  148. package/lib/components/ModalWrapper/ModalWrapper.js +1 -1
  149. package/lib/components/MultiSelect/FilterableMultiSelect.js +3 -3
  150. package/lib/components/MultiSelect/MultiSelect.js +2 -2
  151. package/lib/components/Notification/Notification.d.ts +13 -5
  152. package/lib/components/Notification/Notification.js +4 -3
  153. package/lib/components/OverflowMenu/OverflowMenu.d.ts +8 -4
  154. package/lib/components/OverflowMenu/OverflowMenu.js +3 -3
  155. package/lib/components/OverflowMenu/next/index.d.ts +2 -2
  156. package/lib/components/OverflowMenu/next/index.js +1 -1
  157. package/lib/components/OverflowMenuItem/OverflowMenuItem.js +2 -2
  158. package/lib/components/ProgressIndicator/ProgressIndicator.js +2 -2
  159. package/lib/components/RadioTile/RadioTile.js +2 -2
  160. package/lib/components/Search/Search.d.ts +3 -2
  161. package/lib/components/Search/Search.js +6 -4
  162. package/lib/components/Slider/Slider.d.ts +15 -16
  163. package/lib/components/Slider/Slider.js +22 -22
  164. package/lib/components/Tabs/Tabs.d.ts +6 -3
  165. package/lib/components/Tabs/Tabs.js +9 -8
  166. package/lib/components/Tag/DismissibleTag.d.ts +5 -3
  167. package/lib/components/Tag/DismissibleTag.js +2 -1
  168. package/lib/components/Tag/OperationalTag.d.ts +3 -2
  169. package/lib/components/Tag/OperationalTag.js +2 -1
  170. package/lib/components/Tag/SelectableTag.d.ts +5 -3
  171. package/lib/components/Tag/SelectableTag.js +2 -1
  172. package/lib/components/Tag/Tag.d.ts +3 -2
  173. package/lib/components/Tag/Tag.js +2 -1
  174. package/lib/components/Tile/Tile.d.ts +5 -3
  175. package/lib/components/Tile/Tile.js +6 -8
  176. package/lib/components/Toggletip/index.js +2 -2
  177. package/lib/components/Tooltip/DefinitionTooltip.js +2 -2
  178. package/lib/components/Tooltip/Tooltip.d.ts +1 -1
  179. package/lib/components/Tooltip/Tooltip.js +2 -2
  180. package/lib/components/TreeView/TreeNode.d.ts +5 -3
  181. package/lib/components/TreeView/TreeNode.js +4 -3
  182. package/lib/components/TreeView/TreeView.js +2 -2
  183. package/lib/components/UIShell/HeaderContainer.js +2 -2
  184. package/lib/components/UIShell/HeaderMenu.js +2 -2
  185. package/lib/components/UIShell/HeaderPanel.js +2 -2
  186. package/lib/components/UIShell/SideNav.d.ts +1 -1
  187. package/lib/components/UIShell/SideNav.js +2 -2
  188. package/lib/components/UIShell/SideNavHeader.d.ts +3 -2
  189. package/lib/components/UIShell/SideNavHeader.js +2 -1
  190. package/lib/components/UIShell/SideNavLink.d.ts +2 -2
  191. package/lib/components/UIShell/SideNavLink.js +1 -1
  192. package/lib/components/UIShell/SideNavMenu.d.ts +2 -2
  193. package/lib/components/UIShell/SideNavMenu.js +3 -3
  194. package/lib/components/UIShell/SwitcherItem.js +2 -2
  195. package/lib/internal/FloatingMenu.js +5 -5
  196. package/lib/internal/OptimizedResize.js +24 -21
  197. package/lib/internal/focus/index.js +19 -0
  198. package/lib/internal/keyboard/keys.js +2 -2
  199. package/lib/internal/keyboard/match.js +41 -17
  200. package/lib/internal/keyboard/navigation.js +27 -15
  201. package/lib/internal/useMergedRefs.js +0 -3
  202. package/package.json +6 -6
  203. package/telemetry.yml +0 -1
  204. package/es/components/Dialog/index.js +0 -177
  205. package/es/internal/OptimizedResize.d.ts +0 -18
  206. package/es/internal/keyboard/index.d.ts +0 -9
  207. package/es/internal/keyboard/keys.d.ts +0 -23
  208. package/es/internal/keyboard/match.d.ts +0 -26
  209. package/es/internal/keyboard/navigation.d.ts +0 -37
  210. package/lib/components/Dialog/index.js +0 -190
  211. package/lib/internal/OptimizedResize.d.ts +0 -18
  212. package/lib/internal/keyboard/index.d.ts +0 -9
  213. package/lib/internal/keyboard/keys.d.ts +0 -23
  214. package/lib/internal/keyboard/match.d.ts +0 -26
  215. package/lib/internal/keyboard/navigation.d.ts +0 -37
  216. package/scss/components/dialog/_dialog.scss +0 -9
  217. package/scss/components/dialog/_index.scss +0 -9
@@ -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';
16
14
  import { useId } from '../../internal/useId.js';
17
15
  import deprecate from '../../prop-types/deprecate.js';
18
16
  import { usePrefix } from '../../internal/usePrefix.js';
19
17
  import { AccordionContext } from './AccordionProvider.js';
18
+ import { match } from '../../internal/keyboard/match.js';
20
19
  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, 2025
2
+ * Copyright IBM Corp. 2016, 2023
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,7 +50,8 @@ export interface ButtonBaseProps extends React.ButtonHTMLAttributes<HTMLButtonEl
50
50
  */
51
51
  rel?: React.AnchorHTMLAttributes<HTMLAnchorElement>['rel'];
52
52
  /**
53
- * A component used to render an icon.
53
+ * Optional prop to allow overriding the icon rendering.
54
+ * Can be a React component class
54
55
  */
55
56
  renderIcon?: React.ElementType;
56
57
  /**
@@ -194,7 +194,8 @@ Button.propTypes = {
194
194
  */
195
195
  rel: PropTypes.string,
196
196
  /**
197
- * A component used to render an icon.
197
+ * Optional prop to allow overriding the icon rendering.
198
+ * Can be a React component class
198
199
  */
199
200
  renderIcon: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
200
201
  /**
@@ -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,
52
+ [`${prefix}--btn--icon-only`]: hasIconOnly && !className?.includes(`${prefix}--btn--icon-only`),
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, 2025
2
+ * Copyright IBM Corp. 2024
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,7 +33,8 @@ export interface ChatButtonProps extends React.ButtonHTMLAttributes<HTMLButtonEl
33
33
  */
34
34
  kind?: ChatButtonKind;
35
35
  /**
36
- * A component used to render an icon.
36
+ * Optional prop to specify an icon to be rendered.
37
+ * Can be a React component class
37
38
  */
38
39
  renderIcon?: ComponentType | FunctionComponent;
39
40
  /**
@@ -75,7 +75,8 @@ ChatButton.propTypes = {
75
75
  */
76
76
  kind: PropTypes.oneOf(['primary', 'secondary', 'danger', 'ghost', 'tertiary']),
77
77
  /**
78
- * A component used to render an icon.
78
+ * Optional prop to specify an icon to be rendered.
79
+ * Can be a React component class
79
80
  */
80
81
  // @ts-expect-error: PropTypes are not expressive enough to cover this case
81
82
  renderIcon: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
@@ -16,8 +16,6 @@ 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';
21
19
  import { useId } from '../../internal/useId.js';
22
20
  import mergeRefs from '../../tools/mergeRefs.js';
23
21
  import deprecate from '../../prop-types/deprecate.js';
@@ -26,8 +24,10 @@ import '../FluidForm/FluidForm.js';
26
24
  import { FormContext } from '../FluidForm/FormContext.js';
27
25
  import { useFloating, flip, hide, autoUpdate } from '@floating-ui/react';
28
26
  import { useFeatureFlag } from '../FeatureFlags/index.js';
27
+ import { match } from '../../internal/keyboard/match.js';
29
28
  import { ListBoxSize } from '../ListBox/ListBoxPropTypes.js';
30
29
  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,
@@ -301,41 +301,31 @@ const ComboBox = /*#__PURE__*/forwardRef((props, ref) => {
301
301
  return changes;
302
302
  }
303
303
  case InputKeyDownEnter:
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,
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,
328
317
  inputValue
329
- };
318
+ });
330
319
  }
320
+ return changes;
321
+ } else if (changes.selectedItem && !allowCustomValue) {
322
+ return changes;
323
+ } else {
324
+ return {
325
+ ...changes,
326
+ isOpen: true
327
+ };
331
328
  }
332
-
333
- // For `allowCustomValue` or if no matching item is found, keep the
334
- // menu open.
335
- return {
336
- ...changes,
337
- isOpen: true
338
- };
339
329
  case FunctionToggleMenu:
340
330
  case ToggleButtonClick:
341
331
  if (!changes.isOpen && state.inputValue && highlightedIndex === -1 && !allowCustomValue) {
@@ -17,15 +17,14 @@ 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, { elementOrParentIsFloatingMenu } from '../../internal/wrapFocus.js';
20
+ import wrapFocus, { wrapFocusWithoutSentinels, 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';
24
22
  import { useFeatureFlag } from '../FeatureFlags/index.js';
25
23
  import { composeEventHandlers } from '../../tools/events.js';
26
24
  import deprecate from '../../prop-types/deprecate.js';
27
- import { unstable__Dialog } from '../Dialog/index.js';
28
25
  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';
29
28
 
30
29
  const ModalBody = /*#__PURE__*/React__default.forwardRef(function ModalBody(_ref, ref) {
31
30
  let {
@@ -121,14 +120,12 @@ const ComposedModal = /*#__PURE__*/React__default.forwardRef(function ComposedMo
121
120
  const startSentinel = useRef(null);
122
121
  const endSentinel = useRef(null);
123
122
  const onMouseDownTarget = useRef(null);
124
- const enableDialogElement =
125
- // useFeatureFlag('enable-experimental-focus-wrap-without-sentinels') ||
126
- useFeatureFlag('enable-dialog-element');
123
+ const focusTrapWithoutSentinels = useFeatureFlag('enable-experimental-focus-wrap-without-sentinels');
127
124
 
128
125
  // Keep track of modal open/close state
129
126
  // and propagate it to the document.body
130
127
  useEffect(() => {
131
- if (!enableDialogElement && open !== wasOpen) {
128
+ if (open !== wasOpen) {
132
129
  setIsOpen(!!open);
133
130
  setWasOpen(!!open);
134
131
  toggleClass(document.body, `${prefix}--body--with-modal-open`, !!open);
@@ -136,19 +133,22 @@ const ComposedModal = /*#__PURE__*/React__default.forwardRef(function ComposedMo
136
133
  }, [open, wasOpen, prefix]);
137
134
  // Remove the document.body className on unmount
138
135
  useEffect(() => {
139
- if (!enableDialogElement) {
140
- return () => {
141
- toggleClass(document.body, `${prefix}--body--with-modal-open`, false);
142
- };
143
- }
136
+ return () => {
137
+ toggleClass(document.body, `${prefix}--body--with-modal-open`, false);
138
+ };
144
139
  }, []); // eslint-disable-line react-hooks/exhaustive-deps
145
140
 
146
141
  function handleKeyDown(event) {
147
- if (!enableDialogElement) {
148
- event.stopPropagation();
149
- if (match(event, Escape)) {
150
- closeModal(event);
151
- }
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
+ });
152
152
  }
153
153
  onKeyDown?.(event);
154
154
  }
@@ -228,34 +228,32 @@ const ComposedModal = /*#__PURE__*/React__default.forwardRef(function ComposedMo
228
228
  }
229
229
  });
230
230
  useEffect(() => {
231
- if (!enableDialogElement && !open && launcherButtonRef) {
231
+ if (!open && launcherButtonRef) {
232
232
  setTimeout(() => {
233
233
  launcherButtonRef?.current?.focus();
234
234
  });
235
235
  }
236
236
  }, [open, launcherButtonRef]);
237
237
  useEffect(() => {
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);
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;
258
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();
253
+ }
254
+ };
255
+ if (open && isOpen) {
256
+ focusButton(innerModal.current);
259
257
  }
260
258
  }, [open, selectorPrimaryFocus, isOpen]);
261
259
 
@@ -266,24 +264,23 @@ const ComposedModal = /*#__PURE__*/React__default.forwardRef(function ComposedMo
266
264
  size: 'sm'
267
265
  });
268
266
  }
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", {
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", {
281
278
  className: containerClass,
282
279
  role: "dialog",
283
280
  "aria-modal": "true",
284
281
  "aria-label": ariaLabel ? ariaLabel : generatedAriaLabel,
285
282
  "aria-labelledby": ariaLabelledBy
286
- }, /*#__PURE__*/React__default.createElement("button", {
283
+ }, !focusTrapWithoutSentinels && /*#__PURE__*/React__default.createElement("button", {
287
284
  type: "button",
288
285
  ref: startSentinel,
289
286
  className: `${prefix}--visually-hidden`
@@ -292,22 +289,11 @@ const ComposedModal = /*#__PURE__*/React__default.forwardRef(function ComposedMo
292
289
  className: `${prefix}--modal-container-body`
293
290
  }, slug ? normalizedDecorator : decorator ? /*#__PURE__*/React__default.createElement("div", {
294
291
  className: `${prefix}--modal--inner__decorator`
295
- }, normalizedDecorator) : '', childrenWithProps), /*#__PURE__*/React__default.createElement("button", {
292
+ }, normalizedDecorator) : '', childrenWithProps), !focusTrapWithoutSentinels && /*#__PURE__*/React__default.createElement("button", {
296
293
  type: "button",
297
294
  ref: endSentinel,
298
295
  className: `${prefix}--visually-hidden`
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);
296
+ }, "Focus sentinel")));
311
297
  });
312
298
  ComposedModal.propTypes = {
313
299
  /**
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright IBM Corp. 2022, 2025
2
+ * Copyright IBM Corp. 2022
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
- * A component used to render an icon.
30
+ * Provide an optional icon to render in front of the item's content.
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
- * A component used to render an icon.
74
+ * Provide an optional icon to render in front of the item's content.
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 { ArrowRight, ArrowLeft } from '../../internal/keyboard/keys.js';
16
- import { matches } from '../../internal/keyboard/match.js';
17
- import { getNextIndex } from '../../internal/keyboard/navigation.js';
18
15
  import { PrefixContext } from '../../internal/usePrefix.js';
19
16
  import { noopFn } from '../../internal/noopFn.js';
17
+ import { matches } from '../../internal/keyboard/match.js';
18
+ import { getNextIndex } from '../../internal/keyboard/navigation.js';
19
+ import { ArrowRight, ArrowLeft } from '../../internal/keyboard/keys.js';
20
20
 
21
21
  class ContentSwitcher extends React__default.Component {
22
22
  constructor() {
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright IBM Corp. 2016, 2025
2
+ * Copyright IBM Corp. 2016, 2023
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
- * A component used to render an icon.
20
+ * Optional function to render your own icon in the underlying button
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
- * A component used to render an icon.
37
+ * Optional function to render your own icon in the underlying button
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
- * A component used to render an icon.
42
+ * Optional function to render your own icon in the underlying button
43
43
  */
44
44
  renderIcon: PropTypes.oneOfType([PropTypes.func, PropTypes.object])
45
45
  };
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright IBM Corp. 2016, 2025
2
+ * Copyright IBM Corp. 2016, 2023
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 || description) && /*#__PURE__*/React__default.createElement("div", {
44
+ }), title && /*#__PURE__*/React__default.createElement("div", {
45
45
  className: `${prefix}--data-table-header`
46
- }, title && /*#__PURE__*/React__default.createElement("h4", {
46
+ }, /*#__PURE__*/React__default.createElement("h4", {
47
47
  className: `${prefix}--data-table-header__title`,
48
48
  id: titleId
49
- }, title), description && /*#__PURE__*/React__default.createElement("p", {
49
+ }, title), /*#__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, 2025
2
+ * Copyright IBM Corp. 2016, 2023
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,16 +45,15 @@ export type TableExpandHeaderPropsBase = {
45
45
  */
46
46
  onExpand?(event: React.MouseEvent<HTMLButtonElement>): void;
47
47
  } & ReactAttr<HTMLTableCellElement>;
48
- export type TableExpandHeaderPropsWithToggle = Omit<TableExpandHeaderPropsBase, 'aria-label' | 'enableToggle' | 'onExpand'> & {
48
+ export type TableExpandHeaderPropsWithToggle = Omit<TableExpandHeaderPropsBase, 'ariaLabel' | 'aria-label' | 'enableToggle' | 'onExpand'> & {
49
49
  enableToggle: true;
50
+ ariaLabel: string;
50
51
  ['aria-label']: string;
51
52
  onExpand(event: React.MouseEvent<HTMLButtonElement>): void;
52
53
  };
53
- export type TableExpandHeaderPropsWithExpando = Omit<TableExpandHeaderPropsBase, 'aria-label' | 'enableExpando' | 'onExpand'> & {
54
- /**
55
- * @deprecated The enableExpando prop is being replaced by `enableToggle`
56
- */
54
+ export type TableExpandHeaderPropsWithExpando = Omit<TableExpandHeaderPropsBase, 'ariaLabel' | 'aria-label' | 'enableExpando' | 'onExpand'> & {
57
55
  enableExpando: true;
56
+ ariaLabel: string;
58
57
  ['aria-label']: string;
59
58
  onExpand(event: React.MouseEvent<HTMLButtonElement>): void;
60
59
  };
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright IBM Corp. 2016, 2025
2
+ * Copyright IBM Corp. 2016, 2023
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
- * A component used to render an icon.
23
+ * Optional prop to allow overriding the default menu 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
- * A component used to render an icon.
54
+ * Optional prop to allow overriding the default menu 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';
21
19
  import { usePrefix } from '../../internal/usePrefix.js';
22
20
  import { useSavedCallback } from '../../internal/useSavedCallback.js';
23
21
  import '../FluidForm/FluidForm.js';
24
22
  import { FormContext } from '../FluidForm/FormContext.js';
25
23
  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 { Enter, ArrowLeft, ArrowRight, ArrowDown } from '../../../internal/keyboard/keys.js';
9
8
  import { match } from '../../../internal/keyboard/match.js';
9
+ import { Enter, ArrowLeft, ArrowRight, ArrowDown } from '../../../internal/keyboard/keys.js';
10
10
 
11
11
  /**
12
12
  * @param {object} config Plugin configuration.
@@ -12,28 +12,9 @@ export interface DialogProps extends ReactAttr<HTMLDialogElement> {
12
12
  */
13
13
  children?: React.ReactNode;
14
14
  /**
15
- * Specify an optional className to be applied to the modal root node
16
- */
17
- className?: string;
18
- /**
19
- * Specifies whether the dialog is modal or non-modal. This cannot be changed
20
- * while open=true
15
+ * Specifies whether the dialog is modal or non-modal
21
16
  */
22
17
  modal?: boolean;
23
- /**
24
- * Specify a handler for the dialog's cancel event.
25
- * The browser fires this event when the user presses the Esc key and is cancelable.
26
- */
27
- onCancel?: React.ReactEventHandler<HTMLDialogElement>;
28
- /**
29
- * Specify a click handler applied to the dialog.
30
- */
31
- onClick?: React.ReactEventHandler<HTMLDialogElement>;
32
- /**
33
- * Specify a handler the dialog's close event.
34
- * The browser fires this event after the dialog has closed.
35
- */
36
- onClose?: React.ReactEventHandler<HTMLDialogElement>;
37
18
  /**
38
19
  * Specify a handler for closing Dialog.
39
20
  * The handler should care of closing Dialog, e.g. changing `open` prop.
@@ -44,25 +25,6 @@ export interface DialogProps extends ReactAttr<HTMLDialogElement> {
44
25
  */
45
26
  open?: boolean;
46
27
  }
47
- export declare const unstable__Dialog: React.ForwardRefExoticComponent<DialogProps & React.RefAttributes<unknown>>;
48
- export interface DialogHeaderProps extends ReactAttr<HTMLDivElement> {
49
- /**
50
- * Provide the contents to be rendered inside of this component
51
- */
52
- children?: React.ReactNode;
53
- }
54
- export declare const DialogHeader: React.ForwardRefExoticComponent<DialogHeaderProps & React.RefAttributes<HTMLDivElement>>;
55
- export interface DialogControlsProps extends ReactAttr<HTMLDivElement> {
56
- /**
57
- * Provide the contents to be rendered inside of this component
58
- */
59
- children?: React.ReactNode;
60
- }
61
- export declare const DialogControls: React.ForwardRefExoticComponent<DialogControlsProps & React.RefAttributes<HTMLDivElement>>;
62
- export interface DialogCloseButtonProps extends ReactAttr<HTMLDivElement> {
63
- /**
64
- * Specify a click handler applied to the IconButton
65
- */
66
- onClick?: React.MouseEventHandler;
67
- }
68
- export declare const DialogCloseButton: React.ForwardRefExoticComponent<DialogCloseButtonProps & React.RefAttributes<HTMLDivElement>>;
28
+ declare const unstable__Dialog: React.ForwardRefExoticComponent<DialogProps & React.RefAttributes<unknown>>;
29
+ export { unstable__Dialog };
30
+ export default unstable__Dialog;
@@ -12,9 +12,9 @@ import Search from '../Search/Search.js';
12
12
  import '../Search/Search.Skeleton.js';
13
13
  import { usePrefix } from '../../internal/usePrefix.js';
14
14
  import { composeEventHandlers } from '../../tools/events.js';
15
- import { Escape } from '../../internal/keyboard/keys.js';
16
- import { match } from '../../internal/keyboard/match.js';
17
15
  import mergeRefs from '../../tools/mergeRefs.js';
16
+ import { match } from '../../internal/keyboard/match.js';
17
+ import { Escape } from '../../internal/keyboard/keys.js';
18
18
 
19
19
  const ExpandableSearch = /*#__PURE__*/React__default.forwardRef(function ExpandableSearch(_ref, forwardedRef) {
20
20
  let {
@@ -14,7 +14,6 @@ export interface FeatureFlagsProps {
14
14
  enableV12Overflowmenu?: boolean;
15
15
  enableTreeviewControllable?: boolean;
16
16
  enableExperimentalFocusWrapWithoutSentinels?: boolean;
17
- enableDialogElement?: boolean;
18
17
  enableV12DynamicFloatingStyles?: boolean;
19
18
  }
20
19
  /**
@@ -27,7 +26,7 @@ declare const FeatureFlagContext: React.Context<any>;
27
26
  * along with the current `FeatureFlagContext` to provide consumers to check if
28
27
  * a feature flag is enabled or disabled in a given React tree
29
28
  */
30
- declare function FeatureFlags({ children, flags, enableV12TileDefaultIcons, enableV12TileRadioIcons, enableV12Overflowmenu, enableTreeviewControllable, enableExperimentalFocusWrapWithoutSentinels, enableDialogElement, enableV12DynamicFloatingStyles, }: FeatureFlagsProps): JSX.Element;
29
+ declare function FeatureFlags({ children, flags, enableV12TileDefaultIcons, enableV12TileRadioIcons, enableV12Overflowmenu, enableTreeviewControllable, enableExperimentalFocusWrapWithoutSentinels, enableV12DynamicFloatingStyles, }: FeatureFlagsProps): JSX.Element;
31
30
  declare namespace FeatureFlags {
32
31
  var propTypes: {
33
32
  children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
@@ -40,7 +39,6 @@ declare namespace FeatureFlags {
40
39
  enableV12Overflowmenu: PropTypes.Requireable<boolean>;
41
40
  enableTreeviewControllable: PropTypes.Requireable<boolean>;
42
41
  enableExperimentalFocusWrapWithoutSentinels: PropTypes.Requireable<boolean>;
43
- enableDialogElement: PropTypes.Requireable<boolean>;
44
42
  enableV12DynamicFloatingStyles: PropTypes.Requireable<boolean>;
45
43
  };
46
44
  }