@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
@@ -30,7 +30,6 @@ function FeatureFlags(_ref) {
30
30
  enableV12Overflowmenu = false,
31
31
  enableTreeviewControllable = false,
32
32
  enableExperimentalFocusWrapWithoutSentinels = false,
33
- enableDialogElement = false,
34
33
  enableV12DynamicFloatingStyles = false
35
34
  } = _ref;
36
35
  const parentScope = useContext(FeatureFlagContext);
@@ -41,7 +40,6 @@ function FeatureFlags(_ref) {
41
40
  'enable-v12-overflowmenu': enableV12Overflowmenu,
42
41
  'enable-treeview-controllable': enableTreeviewControllable,
43
42
  'enable-experimental-focus-wrap-without-sentinels': enableExperimentalFocusWrapWithoutSentinels,
44
- 'enable-dialog-element': enableDialogElement,
45
43
  'enable-v12-dynamic-floating-styles': enableV12DynamicFloatingStyles,
46
44
  ...flags
47
45
  };
@@ -80,7 +78,6 @@ FeatureFlags.propTypes = {
80
78
  enableV12Overflowmenu: PropTypes.bool,
81
79
  enableTreeviewControllable: PropTypes.bool,
82
80
  enableExperimentalFocusWrapWithoutSentinels: PropTypes.bool,
83
- enableDialogElement: PropTypes.bool,
84
81
  enableV12DynamicFloatingStyles: PropTypes.bool
85
82
  };
86
83
 
@@ -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.
@@ -12,12 +12,12 @@ import React__default, { useState, useImperativeHandle } from 'react';
12
12
  import Filename from './Filename.js';
13
13
  import FileUploaderButton from './FileUploaderButton.js';
14
14
  import { ButtonKinds } from '../Button/Button.js';
15
- import { Enter, Space } from '../../internal/keyboard/keys.js';
16
- import { matches } from '../../internal/keyboard/match.js';
17
15
  import { usePrefix } from '../../internal/usePrefix.js';
18
16
  import '../Text/index.js';
19
17
  import { useId } from '../../internal/useId.js';
18
+ import { matches } from '../../internal/keyboard/match.js';
20
19
  import { Text } from '../Text/Text.js';
20
+ import { Enter, Space } from '../../internal/keyboard/keys.js';
21
21
 
22
22
  const FileUploader = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
23
23
  let {
@@ -9,13 +9,13 @@ import { extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js
9
9
  import cx from 'classnames';
10
10
  import PropTypes from 'prop-types';
11
11
  import React__default, { useState, useRef } from 'react';
12
- import { Enter, Space } from '../../internal/keyboard/keys.js';
13
- import { matches } from '../../internal/keyboard/match.js';
14
12
  import { ButtonKinds } from '../../prop-types/types.js';
15
13
  import uniqueId from '../../tools/uniqueId.js';
16
14
  import { usePrefix } from '../../internal/usePrefix.js';
17
15
  import deprecate from '../../prop-types/deprecate.js';
18
16
  import { noopFn } from '../../internal/noopFn.js';
17
+ import { matches } from '../../internal/keyboard/match.js';
18
+ import { Enter, Space } from '../../internal/keyboard/keys.js';
19
19
 
20
20
  function FileUploaderButton(_ref) {
21
21
  let {
@@ -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.
@@ -9,13 +9,13 @@ import { extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js
9
9
  import React__default, { useRef, useState } from 'react';
10
10
  import PropTypes from 'prop-types';
11
11
  import cx from 'classnames';
12
- import { Enter, Space } from '../../internal/keyboard/keys.js';
13
- import { matches } from '../../internal/keyboard/match.js';
14
12
  import uniqueId from '../../tools/uniqueId.js';
15
13
  import { usePrefix } from '../../internal/usePrefix.js';
16
14
  import { composeEventHandlers } from '../../tools/events.js';
17
15
  import deprecate from '../../prop-types/deprecate.js';
18
16
  import { noopFn } from '../../internal/noopFn.js';
17
+ import { matches } from '../../internal/keyboard/match.js';
18
+ import { Enter, Space } from '../../internal/keyboard/keys.js';
19
19
 
20
20
  function FileUploaderDropContainer(_ref) {
21
21
  let {
@@ -71,16 +71,14 @@ function FileUploaderDropContainer(_ref) {
71
71
  }
72
72
  function handleChange(event) {
73
73
  const files = [...(event.target.files ?? [])];
74
- const filesToValidate = multiple ? files : [files[0]];
75
- const addedFiles = validateFiles(filesToValidate);
74
+ const addedFiles = validateFiles(files);
76
75
  return onAddFiles(event, {
77
76
  addedFiles
78
77
  });
79
78
  }
80
79
  function handleDrop(event) {
81
80
  const files = [...event.dataTransfer.files];
82
- const filesToValidate = multiple ? files : [files[0]];
83
- const addedFiles = validateFiles(filesToValidate);
81
+ const addedFiles = validateFiles(files);
84
82
  return onAddFiles(event, {
85
83
  addedFiles
86
84
  });
@@ -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.
@@ -10,15 +10,15 @@ import cx from 'classnames';
10
10
  import PropTypes from 'prop-types';
11
11
  import React__default, { useRef, useState, useLayoutEffect } from 'react';
12
12
  import Filename from './Filename.js';
13
- import { Enter, Space } from '../../internal/keyboard/keys.js';
14
- import { matches } from '../../internal/keyboard/match.js';
15
13
  import uniqueId from '../../tools/uniqueId.js';
16
14
  import { usePrefix } from '../../internal/usePrefix.js';
17
15
  import { noopFn } from '../../internal/noopFn.js';
18
16
  import '../Text/index.js';
19
17
  import '../Tooltip/DefinitionTooltip.js';
20
18
  import { Tooltip } from '../Tooltip/Tooltip.js';
19
+ import { matches } from '../../internal/keyboard/match.js';
21
20
  import { Text } from '../Text/Text.js';
21
+ import { Enter, Space } from '../../internal/keyboard/keys.js';
22
22
 
23
23
  function FileUploaderItem(_ref) {
24
24
  let {
@@ -12,10 +12,10 @@ import React__default from 'react';
12
12
  import { usePrefix } from '../../internal/usePrefix.js';
13
13
  import { useGridSettings, GridSettings } from './GridContext.js';
14
14
 
15
- const CSSGrid = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
15
+ function CSSGrid(_ref) {
16
16
  let {
17
17
  align,
18
- as,
18
+ as: BaseComponent = 'div',
19
19
  children,
20
20
  className: customClassName,
21
21
  condensed = false,
@@ -38,8 +38,7 @@ const CSSGrid = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
38
38
  mode: "css-grid",
39
39
  subgrid: true
40
40
  }, /*#__PURE__*/React__default.createElement(Subgrid, _extends({
41
- ref: ref,
42
- as: as,
41
+ as: BaseComponent,
43
42
  className: customClassName,
44
43
  mode: mode
45
44
  }, rest), children));
@@ -54,24 +53,23 @@ const CSSGrid = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
54
53
  });
55
54
 
56
55
  // cast as any to let TypeScript allow passing in attributes to base component
57
- const BaseComponent = as || 'div';
56
+ const BaseComponentAsAny = BaseComponent;
58
57
  return /*#__PURE__*/React__default.createElement(GridSettings, {
59
58
  mode: "css-grid",
60
59
  subgrid: true
61
- }, /*#__PURE__*/React__default.createElement(BaseComponent, _extends({
62
- className: className,
63
- ref: ref
60
+ }, /*#__PURE__*/React__default.createElement(BaseComponentAsAny, _extends({
61
+ className: className
64
62
  }, rest), children));
65
- });
63
+ }
66
64
  CSSGrid.propTypes = {
67
- /**
68
- * Provide a custom element to render instead of the default <div>
69
- */
70
- as: PropTypes.oneOfType([PropTypes.string, PropTypes.elementType]),
71
65
  /**
72
66
  * Specify grid alignment. Default is center
73
67
  */
74
68
  align: PropTypes.oneOf(['start', 'center', 'end']),
69
+ /**
70
+ * Provide a custom element to render instead of the default <div>
71
+ */
72
+ as: PropTypes.oneOfType([PropTypes.string, PropTypes.elementType]),
75
73
  /**
76
74
  * Pass in content that will be rendered within the `Grid`
77
75
  */
@@ -95,9 +93,9 @@ CSSGrid.propTypes = {
95
93
  */
96
94
  narrow: PropTypes.bool
97
95
  };
98
- const Subgrid = /*#__PURE__*/React__default.forwardRef((_ref2, ref) => {
96
+ const Subgrid = _ref2 => {
99
97
  let {
100
- as,
98
+ as: BaseComponent = 'div',
101
99
  className: customClassName,
102
100
  children,
103
101
  mode,
@@ -110,12 +108,10 @@ const Subgrid = /*#__PURE__*/React__default.forwardRef((_ref2, ref) => {
110
108
  [`${prefix}--subgrid--narrow`]: mode === 'narrow',
111
109
  [`${prefix}--subgrid--wide`]: mode === 'wide'
112
110
  });
113
- const BaseComponent = as || 'div';
114
111
  return /*#__PURE__*/React__default.createElement(BaseComponent, _extends({}, rest, {
115
- ref: ref,
116
112
  className: className
117
113
  }), children);
118
- });
114
+ };
119
115
  Subgrid.propTypes = {
120
116
  /**
121
117
  * Provide a custom element to render instead of the default <div>
@@ -12,9 +12,9 @@ import React__default from 'react';
12
12
  import { usePrefix } from '../../internal/usePrefix.js';
13
13
  import { GridSettings } from './GridContext.js';
14
14
 
15
- const FlexGrid = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
15
+ function FlexGrid(_ref) {
16
16
  let {
17
- as,
17
+ as: BaseComponent = 'div',
18
18
  condensed = false,
19
19
  narrow = false,
20
20
  fullWidth = false,
@@ -30,15 +30,14 @@ const FlexGrid = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
30
30
  [`${prefix}--grid--full-width`]: fullWidth
31
31
  });
32
32
  // cast as any to let TypeScript allow passing in attributes to base component
33
- const BaseComponent = as || 'div';
33
+ const BaseComponentAsAny = BaseComponent;
34
34
  return /*#__PURE__*/React__default.createElement(GridSettings, {
35
35
  mode: "flexbox",
36
36
  subgrid: false
37
- }, /*#__PURE__*/React__default.createElement(BaseComponent, _extends({
38
- className: className,
39
- ref: ref
37
+ }, /*#__PURE__*/React__default.createElement(BaseComponentAsAny, _extends({
38
+ className: className
40
39
  }, rest), children));
41
- });
40
+ }
42
41
  FlexGrid.propTypes = {
43
42
  /**
44
43
  * Provide a custom element to render instead of the default <div>
@@ -4,7 +4,7 @@
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 { PolymorphicComponentPropWithRef } from '../../internal/PolymorphicProps';
7
+ import { PolymorphicProps } from '../../types/common';
8
8
  export interface GridBaseProps {
9
9
  /**
10
10
  * Pass in content that will be rendered within the `Grid`
@@ -29,9 +29,7 @@ export interface GridBaseProps {
29
29
  */
30
30
  narrow?: boolean;
31
31
  }
32
- export type GridProps<T extends React.ElementType> = PolymorphicComponentPropWithRef<T, GridBaseProps>;
32
+ export type GridProps<T extends React.ElementType> = PolymorphicProps<T, GridBaseProps>;
33
33
  export interface GridComponent {
34
- <T extends React.ElementType = 'div'>(props: GridProps<T>): React.ReactElement | null;
35
- displayName?: string;
36
- propTypes?: React.WeakValidationMap<GridProps<any>>;
34
+ <T extends React.ElementType>(props: GridProps<T>, context?: any): React.ReactElement<any, any> | null;
37
35
  }
@@ -76,9 +76,9 @@ const IconButton = /*#__PURE__*/React__default.forwardRef(function IconButton(_r
76
76
  kind: kind,
77
77
  ref: ref,
78
78
  size: size,
79
- isSelected: isSelected,
80
- hasIconOnly: true,
81
- className: className,
79
+ className: cx(`${prefix}--btn--icon-only`, {
80
+ [`${prefix}--btn--selected`]: isSelected
81
+ }, className),
82
82
  "aria-describedby": badgeCount && badgeId
83
83
  }), children, !disabled && badgeCount !== undefined && /*#__PURE__*/React__default.createElement(BadgeIndicator, {
84
84
  id: badgeId,
@@ -6,7 +6,7 @@
6
6
  */
7
7
  import React from 'react';
8
8
  import { LayerLevel } from './LayerLevel';
9
- import { PolymorphicComponentPropWithRef } from '../../internal/PolymorphicProps';
9
+ import { PolymorphicProps } from '../../types/common';
10
10
  /**
11
11
  * A custom hook that will return information about the current layer. A common
12
12
  * field to pull from this is the `level` for the layer that the component that
@@ -30,6 +30,8 @@ export interface LayerBaseProps {
30
30
  */
31
31
  level?: LayerLevel;
32
32
  }
33
- export type LayerProps<T extends React.ElementType> = PolymorphicComponentPropWithRef<T, LayerBaseProps>;
34
- declare const Layer: React.ForwardRefExoticComponent<Omit<LayerProps<React.ElementType<any, keyof React.JSX.IntrinsicElements>>, "ref"> & React.RefAttributes<unknown>>;
35
- export { Layer };
33
+ export type LayerProps<T extends React.ElementType> = PolymorphicProps<T, LayerBaseProps>;
34
+ export interface LayerComponent {
35
+ <T extends React.ElementType>(props: LayerProps<T>, context?: any): React.ReactElement<any, any> | null;
36
+ }
37
+ export declare const Layer: LayerComponent;
@@ -24,9 +24,9 @@ function useLayer() {
24
24
  level
25
25
  };
26
26
  }
27
- const Layer = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
27
+ const LayerRenderFunction = /*#__PURE__*/React__default.forwardRef(function Layer(_ref, ref) {
28
28
  let {
29
- as,
29
+ as = 'div',
30
30
  className: customClassName,
31
31
  children,
32
32
  level: overrideLevel,
@@ -38,7 +38,7 @@ const Layer = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
38
38
  const className = cx(`${prefix}--layer-${levels[level]}`, customClassName);
39
39
  // The level should be between MIN_LEVEL and MAX_LEVEL
40
40
  const value = Math.max(MIN_LEVEL, Math.min(level + 1, MAX_LEVEL));
41
- const BaseComponent = as || 'div';
41
+ const BaseComponent = as;
42
42
  return /*#__PURE__*/React__default.createElement(LayerContext.Provider, {
43
43
  value: value
44
44
  }, /*#__PURE__*/React__default.createElement(BaseComponent, _extends({
@@ -47,8 +47,8 @@ const Layer = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
47
47
  className: className
48
48
  }), children));
49
49
  });
50
- Layer.displayName = 'Layer';
51
- Layer.propTypes = {
50
+ LayerRenderFunction.displayName = 'Layer';
51
+ LayerRenderFunction.propTypes = {
52
52
  /**
53
53
  * Specify a custom component or element to be rendered as the top-level
54
54
  * element in the component
@@ -68,5 +68,6 @@ Layer.propTypes = {
68
68
  */
69
69
  level: PropTypes.oneOf([0, 1, 2])
70
70
  };
71
+ const Layer = LayerRenderFunction;
71
72
 
72
73
  export { Layer, useLayer };
@@ -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.
@@ -31,7 +31,8 @@ export interface LinkBaseProps extends AnchorHTMLAttributes<HTMLAnchorElement> {
31
31
  */
32
32
  inline?: boolean;
33
33
  /**
34
- * A component used to render an icon.
34
+ * @description Optional prop to render an icon next to the link.
35
+ * Can be a React component class
35
36
  */
36
37
  renderIcon?: ComponentType;
37
38
  /**
@@ -82,7 +82,8 @@ Link.propTypes = {
82
82
  */
83
83
  inline: PropTypes.bool,
84
84
  /**
85
- * A component used to render an icon.
85
+ * Optional prop to render an icon next to the link.
86
+ * Can be a React component class
86
87
  */
87
88
  renderIcon: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
88
89
  /**
@@ -1,10 +1,10 @@
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.
6
6
  */
7
- import { ForwardedRef, ReactNode, type Ref } from 'react';
7
+ import React, { ForwardedRef, ReactNode } from 'react';
8
8
  import { ForwardRefReturn, ReactAttr } from '../../types/common';
9
9
  export interface ListBoxMenuItemProps extends ReactAttr<HTMLLIElement> {
10
10
  /**
@@ -30,7 +30,7 @@ export interface ListBoxMenuItemProps extends ReactAttr<HTMLLIElement> {
30
30
  title?: string;
31
31
  }
32
32
  export type ListBoxMenuItemForwardedRef = (ForwardedRef<HTMLLIElement> & {
33
- menuItemOptionRef?: Ref<HTMLDivElement>;
33
+ menuItemOptionRef?: React.Ref<HTMLDivElement>;
34
34
  }) | null;
35
35
  export type ListBoxMenuItemComponent = ForwardRefReturn<ListBoxMenuItemForwardedRef, ListBoxMenuItemProps>;
36
36
  declare const _default: ListBoxMenuItemComponent;
@@ -7,47 +7,28 @@
7
7
 
8
8
  import { extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
9
9
  import cx from 'classnames';
10
- import React__default, { forwardRef, useRef, useState, useEffect } from 'react';
10
+ import React__default, { useRef, useState, useEffect } from 'react';
11
11
  import PropTypes from 'prop-types';
12
12
  import { usePrefix } from '../../internal/usePrefix.js';
13
- import { useMergedRefs } from '../../internal/useMergedRefs.js';
14
13
 
15
- /**
16
- * Determines if the content of an element is truncated.
17
- *
18
- * Merges a forwarded ref with a local ref to check the element's dimensions.
19
- *
20
- * @template T
21
- * @param forwardedRef - A ref passed from the parent component.
22
- * @param deps - Dependencies to re-run the truncation check.
23
- * @returns An object containing the truncation state and the merged ref.
24
- */
25
- const useIsTruncated = function (forwardedRef) {
26
- let deps = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
27
- const localRef = useRef(null);
28
- const mergedRef = useMergedRefs([...(forwardedRef ? [forwardedRef] : []), localRef]);
14
+ function useIsTruncated(ref) {
29
15
  const [isTruncated, setIsTruncated] = useState(false);
30
16
  useEffect(() => {
31
- const element = localRef.current;
32
- if (element) {
33
- const {
34
- offsetWidth,
35
- scrollWidth
36
- } = element;
37
- setIsTruncated(offsetWidth < scrollWidth);
38
- }
39
- }, [localRef, ...deps]);
40
- return {
41
- isTruncated,
42
- ref: mergedRef
43
- };
44
- };
17
+ const element = ref.current;
18
+ const {
19
+ offsetWidth,
20
+ scrollWidth
21
+ } = element;
22
+ setIsTruncated(offsetWidth < scrollWidth);
23
+ }, [ref, setIsTruncated]);
24
+ return isTruncated;
25
+ }
45
26
  /**
46
27
  * `ListBoxMenuItem` is a helper component for managing the container class
47
28
  * name, alongside any classes for any corresponding states, for a generic list
48
29
  * box menu item.
49
30
  */
50
- const ListBoxMenuItem = /*#__PURE__*/forwardRef((_ref, forwardedRef) => {
31
+ const ListBoxMenuItem = /*#__PURE__*/React__default.forwardRef(function ListBoxMenuItem(_ref, forwardedRef) {
51
32
  let {
52
33
  children,
53
34
  isActive = false,
@@ -56,11 +37,8 @@ const ListBoxMenuItem = /*#__PURE__*/forwardRef((_ref, forwardedRef) => {
56
37
  ...rest
57
38
  } = _ref;
58
39
  const prefix = usePrefix();
59
- const menuItemOptionRefProp = forwardedRef && typeof forwardedRef !== 'function' ? forwardedRef.menuItemOptionRef : undefined;
60
- const {
61
- isTruncated,
62
- ref: menuItemOptionRef
63
- } = useIsTruncated(menuItemOptionRefProp, [children]);
40
+ const ref = useRef(null);
41
+ const isTruncated = useIsTruncated(forwardedRef?.menuItemOptionRef || ref);
64
42
  const className = cx(`${prefix}--list-box__menu-item`, {
65
43
  [`${prefix}--list-box__menu-item--active`]: isActive,
66
44
  [`${prefix}--list-box__menu-item--highlighted`]: isHighlighted
@@ -70,7 +48,7 @@ const ListBoxMenuItem = /*#__PURE__*/forwardRef((_ref, forwardedRef) => {
70
48
  title: isTruncated ? title : undefined
71
49
  }), /*#__PURE__*/React__default.createElement("div", {
72
50
  className: `${prefix}--list-box__menu-item__option`,
73
- ref: menuItemOptionRef
51
+ ref: forwardedRef?.menuItemOptionRef || ref
74
52
  }, children));
75
53
  });
76
54
  ListBoxMenuItem.displayName = 'ListBoxMenuItem';
@@ -10,14 +10,14 @@ import cx from 'classnames';
10
10
  import PropTypes from 'prop-types';
11
11
  import React__default, { forwardRef, useRef, useContext, useReducer, useMemo, useState, useEffect } from 'react';
12
12
  import { createPortal } from 'react-dom';
13
- import { Escape, ArrowLeft, ArrowUp, ArrowDown } from '../../internal/keyboard/keys.js';
14
- import { match } from '../../internal/keyboard/match.js';
15
13
  import { useMergedRefs } from '../../internal/useMergedRefs.js';
16
14
  import { usePrefix } from '../../internal/usePrefix.js';
17
15
  import deprecate from '../../prop-types/deprecate.js';
18
16
  import { MenuContext, menuReducer } from './MenuContext.js';
19
17
  import { canUseDOM } from '../../internal/environment.js';
20
18
  import { useLayoutDirection } from '../LayoutDirection/useLayoutDirection.js';
19
+ import { match } from '../../internal/keyboard/match.js';
20
+ import { Escape, ArrowLeft, ArrowUp, ArrowDown } from '../../internal/keyboard/keys.js';
21
21
 
22
22
  const spacing = 8; // distance to keep to window edges, in px
23
23
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright IBM Corp. 2025
2
+ * Copyright IBM Corp. 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.
@@ -31,7 +31,7 @@ export interface MenuItemProps extends LiHTMLAttributes<HTMLLIElement> {
31
31
  */
32
32
  onClick?: (event: KeyboardEvent<HTMLLIElement> | MouseEvent<HTMLLIElement>) => void;
33
33
  /**
34
- * A component used to render an icon.
34
+ * Sets the menu item's icon.
35
35
  */
36
36
  renderIcon?: FC;
37
37
  /**
@@ -11,8 +11,6 @@ import PropTypes from 'prop-types';
11
11
  import React__default, { forwardRef, useState, useContext, useRef, useEffect } from 'react';
12
12
  import { useFloating, autoUpdate, offset, useInteractions, useHover, safePolygon, FloatingFocusManager } from '@floating-ui/react';
13
13
  import { Checkmark, CaretLeft, CaretRight } from '@carbon/icons-react';
14
- import { ArrowRight, Enter, Space } from '../../internal/keyboard/keys.js';
15
- import { match } from '../../internal/keyboard/match.js';
16
14
  import { useControllableState } from '../../internal/useControllableState.js';
17
15
  import { useMergedRefs } from '../../internal/useMergedRefs.js';
18
16
  import { usePrefix } from '../../internal/usePrefix.js';
@@ -20,7 +18,9 @@ import { Menu } from './Menu.js';
20
18
  import { MenuContext } from './MenuContext.js';
21
19
  import '../Text/index.js';
22
20
  import { useLayoutDirection } from '../LayoutDirection/useLayoutDirection.js';
21
+ import { match } from '../../internal/keyboard/match.js';
23
22
  import { Text } from '../Text/Text.js';
23
+ import { ArrowRight, Enter, Space } from '../../internal/keyboard/keys.js';
24
24
 
25
25
  var _Checkmark, _CaretLeft, _CaretRight;
26
26
  const MenuItem = /*#__PURE__*/forwardRef(function MenuItem(_ref, forwardRef) {
@@ -212,7 +212,7 @@ MenuItem.propTypes = {
212
212
  // @ts-ignore-next-line -- avoid spurious (?) TS2322 error
213
213
  onClick: PropTypes.func,
214
214
  /**
215
- * A component used to render an icon.
215
+ * Sets the menu item's icon.
216
216
  */
217
217
  // @ts-ignore-next-line -- avoid spurious (?) TS2322 error
218
218
  renderIcon: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),