@carbon/react 1.92.1 → 1.93.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (306) hide show
  1. package/.playwright/INTERNAL_AVT_REPORT_DO_NOT_USE.json +874 -838
  2. package/es/components/AILabel/index.js +4 -4
  3. package/es/components/Breadcrumb/BreadcrumbItem.js +1 -1
  4. package/es/components/Button/Button.js +2 -2
  5. package/es/components/ChatButton/ChatButton.js +1 -1
  6. package/es/components/Checkbox/Checkbox.js +1 -1
  7. package/es/components/CheckboxGroup/CheckboxGroup.js +1 -1
  8. package/es/components/CodeSnippet/CodeSnippet.js +9 -50
  9. package/es/components/ComboBox/ComboBox.d.ts +3 -11
  10. package/es/components/ComboBox/ComboBox.js +15 -25
  11. package/es/components/ComboButton/index.d.ts +5 -8
  12. package/es/components/ComboButton/index.js +9 -12
  13. package/es/components/ComposedModal/ComposedModal.js +19 -25
  14. package/es/components/DataTable/DataTable.d.ts +27 -16
  15. package/es/components/DataTable/DataTable.js +40 -39
  16. package/es/components/DataTable/Table.js +2 -2
  17. package/es/components/DataTable/TableBatchActions.d.ts +49 -10
  18. package/es/components/DataTable/TableBatchActions.js +26 -21
  19. package/es/components/DataTable/TableExpandHeader.js +2 -2
  20. package/es/components/DataTable/TableExpandRow.d.ts +4 -0
  21. package/es/components/DataTable/TableExpandRow.js +1 -1
  22. package/es/components/DataTable/TableHeader.d.ts +8 -10
  23. package/es/components/DataTable/TableHeader.js +11 -13
  24. package/es/components/DataTable/TableRow.js +7 -5
  25. package/es/components/DataTable/TableSlugRow.js +1 -1
  26. package/es/components/DataTable/TableToolbarMenu.js +1 -1
  27. package/es/components/DataTable/TableToolbarSearch.d.ts +8 -7
  28. package/es/components/DataTable/TableToolbarSearch.js +11 -11
  29. package/es/components/DataTable/index.d.ts +2 -2
  30. package/es/components/DataTable/state/sorting.d.ts +2 -2
  31. package/es/components/DataTable/state/sorting.js +1 -1
  32. package/es/components/DataTable/tools/sorting.js +1 -1
  33. package/es/components/DatePicker/DatePicker.js +9 -9
  34. package/es/components/DatePickerInput/DatePickerInput.js +5 -5
  35. package/es/components/Dialog/Dialog.js +6 -6
  36. package/es/components/Dropdown/Dropdown.d.ts +1 -1
  37. package/es/components/Dropdown/Dropdown.js +8 -8
  38. package/es/components/ErrorBoundary/ErrorBoundaryContext.js +1 -1
  39. package/es/components/FileUploader/FileUploader.js +4 -4
  40. package/es/components/FileUploader/FileUploaderButton.js +1 -1
  41. package/es/components/FileUploader/FileUploaderDropContainer.js +1 -1
  42. package/es/components/FileUploader/FileUploaderItem.js +2 -2
  43. package/es/components/FluidComboBox/FluidComboBox.d.ts +4 -7
  44. package/es/components/FluidComboBox/FluidComboBox.js +1 -1
  45. package/es/components/FluidDropdown/FluidDropdown.d.ts +4 -8
  46. package/es/components/FluidDropdown/FluidDropdown.js +1 -1
  47. package/es/components/FluidMultiSelect/FluidFilterableMultiSelect.d.ts +3 -7
  48. package/es/components/FluidMultiSelect/FluidMultiSelect.d.ts +3 -7
  49. package/es/components/FluidMultiSelect/FluidMultiSelect.js +3 -3
  50. package/es/components/FluidNumberInput/FluidNumberInput.d.ts +4 -7
  51. package/es/components/FluidNumberInput/FluidNumberInput.js +2 -2
  52. package/es/components/FluidSearch/FluidSearch.js +1 -1
  53. package/es/components/FluidSelect/FluidSelect.js +1 -1
  54. package/es/components/FluidTextInput/FluidTextInput.js +1 -1
  55. package/es/components/FluidTimePicker/FluidTimePicker.js +3 -3
  56. package/es/components/FluidTimePickerSelect/FluidTimePickerSelect.js +1 -1
  57. package/es/components/Grid/CSSGrid.js +3 -3
  58. package/es/components/Grid/Column.js +2 -2
  59. package/es/components/Grid/ColumnHang.js +1 -1
  60. package/es/components/Grid/FlexGrid.js +1 -1
  61. package/es/components/Grid/Row.js +1 -1
  62. package/es/components/Heading/index.js +2 -2
  63. package/es/components/IconButton/index.js +2 -2
  64. package/es/components/IconIndicator/index.js +2 -2
  65. package/es/components/InlineCheckbox/InlineCheckbox.js +1 -1
  66. package/es/components/Layout/index.js +2 -2
  67. package/es/components/LayoutDirection/LayoutDirection.js +1 -1
  68. package/es/components/Link/Link.js +2 -2
  69. package/es/components/ListBox/ListBoxField.d.ts +0 -1
  70. package/es/components/ListBox/ListBoxMenuIcon.d.ts +8 -4
  71. package/es/components/ListBox/ListBoxMenuIcon.js +10 -6
  72. package/es/components/ListBox/ListBoxMenuItem.js +2 -2
  73. package/es/components/ListBox/ListBoxSelection.d.ts +3 -6
  74. package/es/components/ListBox/ListBoxSelection.js +5 -10
  75. package/es/components/ListBox/index.d.ts +5 -3
  76. package/es/components/ListBox/next/ListBoxSelection.d.ts +6 -13
  77. package/es/components/ListBox/next/ListBoxSelection.js +16 -8
  78. package/es/components/ListBox/next/ListBoxTrigger.d.ts +5 -10
  79. package/es/components/ListBox/next/ListBoxTrigger.js +6 -6
  80. package/es/components/Menu/MenuContext.js +1 -1
  81. package/es/components/Menu/MenuItem.js +1 -1
  82. package/es/components/MenuButton/index.js +5 -5
  83. package/es/components/Modal/Modal.js +17 -23
  84. package/es/components/ModalWrapper/ModalWrapper.js +2 -2
  85. package/es/components/MultiSelect/FilterableMultiSelect.d.ts +3 -12
  86. package/es/components/MultiSelect/FilterableMultiSelect.js +18 -27
  87. package/es/components/MultiSelect/MultiSelect.d.ts +2 -2
  88. package/es/components/MultiSelect/MultiSelect.js +12 -12
  89. package/es/components/Notification/Notification.js +1 -1
  90. package/es/components/NumberInput/NumberInput.d.ts +2 -5
  91. package/es/components/NumberInput/NumberInput.js +13 -18
  92. package/es/components/OverflowMenu/OverflowMenu.d.ts +2 -2
  93. package/es/components/OverflowMenu/OverflowMenu.js +4 -4
  94. package/es/components/OverflowMenu/next/index.d.ts +1 -1
  95. package/es/components/OverflowMenu/next/index.js +2 -2
  96. package/es/components/OverflowMenuItem/OverflowMenuItem.js +2 -2
  97. package/es/components/PageHeader/PageHeader.js +12 -12
  98. package/es/components/Pagination/Pagination.js +3 -3
  99. package/es/components/PaginationNav/PaginationNav.d.ts +6 -9
  100. package/es/components/PaginationNav/PaginationNav.js +21 -22
  101. package/es/components/Popover/index.js +10 -9
  102. package/es/components/ProgressBar/ProgressBar.js +2 -2
  103. package/es/components/ProgressIndicator/ProgressIndicator.d.ts +11 -15
  104. package/es/components/ProgressIndicator/ProgressIndicator.js +15 -15
  105. package/es/components/RadioButton/RadioButton.js +1 -1
  106. package/es/components/RadioButtonGroup/RadioButtonGroup.js +1 -1
  107. package/es/components/RadioTile/RadioTile.js +1 -1
  108. package/es/components/Select/Select.js +7 -5
  109. package/es/components/ShapeIndicator/index.js +2 -2
  110. package/es/components/Slider/Slider.d.ts +7 -9
  111. package/es/components/Slider/Slider.js +16 -20
  112. package/es/components/Stack/HStack.js +1 -1
  113. package/es/components/Stack/Stack.js +1 -1
  114. package/es/components/Stack/VStack.js +1 -1
  115. package/es/components/StructuredList/StructuredList.js +3 -3
  116. package/es/components/Tabs/Tabs.js +12 -12
  117. package/es/components/Tag/DismissibleTag.js +3 -3
  118. package/es/components/Tag/OperationalTag.js +2 -2
  119. package/es/components/Tag/SelectableTag.js +2 -2
  120. package/es/components/Tag/Tag.js +4 -4
  121. package/es/components/Tag/isEllipsisActive.js +1 -1
  122. package/es/components/Text/Text.js +1 -1
  123. package/es/components/TextArea/TextArea.js +1 -1
  124. package/es/components/TextInput/PasswordInput.js +4 -4
  125. package/es/components/TextInput/TextInput.js +3 -3
  126. package/es/components/Theme/index.js +3 -3
  127. package/es/components/Tile/Tile.js +3 -3
  128. package/es/components/TimePicker/TimePicker.js +1 -1
  129. package/es/components/Toggletip/index.js +4 -4
  130. package/es/components/Tooltip/DefinitionTooltip.js +1 -1
  131. package/es/components/Tooltip/Tooltip.js +3 -3
  132. package/es/components/TreeView/TreeNode.js +6 -6
  133. package/es/components/TreeView/TreeView.js +5 -5
  134. package/es/components/UIShell/HeaderContainer.js +1 -1
  135. package/es/components/UIShell/HeaderMenu.js +1 -1
  136. package/es/components/UIShell/Link.js +2 -2
  137. package/es/components/UIShell/SideNavItems.js +1 -1
  138. package/es/components/UIShell/Switcher.js +1 -1
  139. package/es/components/UIShell/SwitcherItem.js +1 -1
  140. package/es/index.d.ts +1 -1
  141. package/es/internal/FloatingMenu.js +4 -4
  142. package/es/internal/Selection.js +6 -6
  143. package/es/internal/useMergedRefs.js +1 -1
  144. package/es/internal/useNoInteractiveChildren.js +4 -4
  145. package/es/internal/useOutsideClick.js +1 -1
  146. package/es/internal/useOverflowItems.js +6 -6
  147. package/es/internal/useResizeObserver.js +3 -3
  148. package/es/internal/useSavedCallback.js +1 -1
  149. package/es/internal/warning.js +1 -1
  150. package/es/prop-types/isRequiredOneOf.js +2 -2
  151. package/es/tools/events.js +1 -1
  152. package/es/tools/wrapComponent.js +1 -1
  153. package/es/types/common.d.ts +6 -2
  154. package/lib/components/AILabel/index.js +4 -4
  155. package/lib/components/Breadcrumb/BreadcrumbItem.js +1 -1
  156. package/lib/components/Button/Button.js +2 -2
  157. package/lib/components/ChatButton/ChatButton.js +1 -1
  158. package/lib/components/Checkbox/Checkbox.js +1 -1
  159. package/lib/components/CheckboxGroup/CheckboxGroup.js +1 -1
  160. package/lib/components/CodeSnippet/CodeSnippet.js +8 -49
  161. package/lib/components/ComboBox/ComboBox.d.ts +3 -11
  162. package/lib/components/ComboBox/ComboBox.js +15 -25
  163. package/lib/components/ComboButton/index.d.ts +5 -8
  164. package/lib/components/ComboButton/index.js +9 -12
  165. package/lib/components/ComposedModal/ComposedModal.js +18 -24
  166. package/lib/components/DataTable/DataTable.d.ts +27 -16
  167. package/lib/components/DataTable/DataTable.js +40 -39
  168. package/lib/components/DataTable/Table.js +2 -2
  169. package/lib/components/DataTable/TableBatchActions.d.ts +49 -10
  170. package/lib/components/DataTable/TableBatchActions.js +26 -21
  171. package/lib/components/DataTable/TableExpandHeader.js +2 -2
  172. package/lib/components/DataTable/TableExpandRow.d.ts +4 -0
  173. package/lib/components/DataTable/TableExpandRow.js +1 -1
  174. package/lib/components/DataTable/TableHeader.d.ts +8 -10
  175. package/lib/components/DataTable/TableHeader.js +11 -13
  176. package/lib/components/DataTable/TableRow.js +7 -5
  177. package/lib/components/DataTable/TableSlugRow.js +1 -1
  178. package/lib/components/DataTable/TableToolbarMenu.js +1 -1
  179. package/lib/components/DataTable/TableToolbarSearch.d.ts +8 -7
  180. package/lib/components/DataTable/TableToolbarSearch.js +11 -11
  181. package/lib/components/DataTable/index.d.ts +2 -2
  182. package/lib/components/DataTable/state/sorting.d.ts +2 -2
  183. package/lib/components/DataTable/state/sorting.js +1 -1
  184. package/lib/components/DataTable/tools/sorting.js +1 -1
  185. package/lib/components/DatePicker/DatePicker.js +9 -9
  186. package/lib/components/DatePickerInput/DatePickerInput.js +5 -5
  187. package/lib/components/Dialog/Dialog.js +6 -6
  188. package/lib/components/Dropdown/Dropdown.d.ts +1 -1
  189. package/lib/components/Dropdown/Dropdown.js +8 -8
  190. package/lib/components/ErrorBoundary/ErrorBoundaryContext.js +1 -1
  191. package/lib/components/FileUploader/FileUploader.js +4 -4
  192. package/lib/components/FileUploader/FileUploaderButton.js +1 -1
  193. package/lib/components/FileUploader/FileUploaderDropContainer.js +1 -1
  194. package/lib/components/FileUploader/FileUploaderItem.js +2 -2
  195. package/lib/components/FluidComboBox/FluidComboBox.d.ts +4 -7
  196. package/lib/components/FluidComboBox/FluidComboBox.js +1 -1
  197. package/lib/components/FluidDropdown/FluidDropdown.d.ts +4 -8
  198. package/lib/components/FluidDropdown/FluidDropdown.js +1 -1
  199. package/lib/components/FluidMultiSelect/FluidFilterableMultiSelect.d.ts +3 -7
  200. package/lib/components/FluidMultiSelect/FluidMultiSelect.d.ts +3 -7
  201. package/lib/components/FluidMultiSelect/FluidMultiSelect.js +3 -3
  202. package/lib/components/FluidNumberInput/FluidNumberInput.d.ts +4 -7
  203. package/lib/components/FluidNumberInput/FluidNumberInput.js +2 -2
  204. package/lib/components/FluidSearch/FluidSearch.js +1 -1
  205. package/lib/components/FluidSelect/FluidSelect.js +1 -1
  206. package/lib/components/FluidTextInput/FluidTextInput.js +1 -1
  207. package/lib/components/FluidTimePicker/FluidTimePicker.js +3 -3
  208. package/lib/components/FluidTimePickerSelect/FluidTimePickerSelect.js +1 -1
  209. package/lib/components/Grid/CSSGrid.js +3 -3
  210. package/lib/components/Grid/Column.js +2 -2
  211. package/lib/components/Grid/ColumnHang.js +1 -1
  212. package/lib/components/Grid/FlexGrid.js +1 -1
  213. package/lib/components/Grid/Row.js +1 -1
  214. package/lib/components/Heading/index.js +2 -2
  215. package/lib/components/IconButton/index.js +2 -2
  216. package/lib/components/IconIndicator/index.js +2 -2
  217. package/lib/components/InlineCheckbox/InlineCheckbox.js +1 -1
  218. package/lib/components/Layout/index.js +2 -2
  219. package/lib/components/LayoutDirection/LayoutDirection.js +1 -1
  220. package/lib/components/Link/Link.js +2 -2
  221. package/lib/components/ListBox/ListBoxField.d.ts +0 -1
  222. package/lib/components/ListBox/ListBoxMenuIcon.d.ts +8 -4
  223. package/lib/components/ListBox/ListBoxMenuIcon.js +10 -6
  224. package/lib/components/ListBox/ListBoxMenuItem.js +2 -2
  225. package/lib/components/ListBox/ListBoxSelection.d.ts +3 -6
  226. package/lib/components/ListBox/ListBoxSelection.js +4 -10
  227. package/lib/components/ListBox/index.d.ts +5 -3
  228. package/lib/components/ListBox/next/ListBoxSelection.d.ts +6 -13
  229. package/lib/components/ListBox/next/ListBoxSelection.js +16 -8
  230. package/lib/components/ListBox/next/ListBoxTrigger.d.ts +5 -10
  231. package/lib/components/ListBox/next/ListBoxTrigger.js +5 -6
  232. package/lib/components/Menu/MenuContext.js +1 -1
  233. package/lib/components/Menu/MenuItem.js +1 -1
  234. package/lib/components/MenuButton/index.js +5 -5
  235. package/lib/components/Modal/Modal.js +16 -22
  236. package/lib/components/ModalWrapper/ModalWrapper.js +2 -2
  237. package/lib/components/MultiSelect/FilterableMultiSelect.d.ts +3 -12
  238. package/lib/components/MultiSelect/FilterableMultiSelect.js +18 -27
  239. package/lib/components/MultiSelect/MultiSelect.d.ts +2 -2
  240. package/lib/components/MultiSelect/MultiSelect.js +12 -12
  241. package/lib/components/Notification/Notification.js +1 -1
  242. package/lib/components/NumberInput/NumberInput.d.ts +2 -5
  243. package/lib/components/NumberInput/NumberInput.js +12 -18
  244. package/lib/components/OverflowMenu/OverflowMenu.d.ts +2 -2
  245. package/lib/components/OverflowMenu/OverflowMenu.js +4 -4
  246. package/lib/components/OverflowMenu/next/index.d.ts +1 -1
  247. package/lib/components/OverflowMenu/next/index.js +2 -2
  248. package/lib/components/OverflowMenuItem/OverflowMenuItem.js +2 -2
  249. package/lib/components/PageHeader/PageHeader.js +12 -12
  250. package/lib/components/Pagination/Pagination.js +3 -3
  251. package/lib/components/PaginationNav/PaginationNav.d.ts +6 -9
  252. package/lib/components/PaginationNav/PaginationNav.js +21 -22
  253. package/lib/components/Popover/index.js +10 -9
  254. package/lib/components/ProgressBar/ProgressBar.js +2 -2
  255. package/lib/components/ProgressIndicator/ProgressIndicator.d.ts +11 -15
  256. package/lib/components/ProgressIndicator/ProgressIndicator.js +15 -15
  257. package/lib/components/RadioButton/RadioButton.js +1 -1
  258. package/lib/components/RadioButtonGroup/RadioButtonGroup.js +1 -1
  259. package/lib/components/RadioTile/RadioTile.js +1 -1
  260. package/lib/components/Select/Select.js +7 -5
  261. package/lib/components/ShapeIndicator/index.js +2 -2
  262. package/lib/components/Slider/Slider.d.ts +7 -9
  263. package/lib/components/Slider/Slider.js +16 -20
  264. package/lib/components/Stack/HStack.js +1 -1
  265. package/lib/components/Stack/Stack.js +1 -1
  266. package/lib/components/Stack/VStack.js +1 -1
  267. package/lib/components/StructuredList/StructuredList.js +3 -3
  268. package/lib/components/Tabs/Tabs.js +12 -12
  269. package/lib/components/Tag/DismissibleTag.js +3 -3
  270. package/lib/components/Tag/OperationalTag.js +2 -2
  271. package/lib/components/Tag/SelectableTag.js +2 -2
  272. package/lib/components/Tag/Tag.js +4 -4
  273. package/lib/components/Tag/isEllipsisActive.js +1 -1
  274. package/lib/components/Text/Text.js +1 -1
  275. package/lib/components/TextArea/TextArea.js +1 -1
  276. package/lib/components/TextInput/PasswordInput.js +4 -4
  277. package/lib/components/TextInput/TextInput.js +3 -3
  278. package/lib/components/Theme/index.js +3 -3
  279. package/lib/components/Tile/Tile.js +3 -3
  280. package/lib/components/TimePicker/TimePicker.js +1 -1
  281. package/lib/components/Toggletip/index.js +4 -4
  282. package/lib/components/Tooltip/DefinitionTooltip.js +1 -1
  283. package/lib/components/Tooltip/Tooltip.js +3 -3
  284. package/lib/components/TreeView/TreeNode.js +6 -6
  285. package/lib/components/TreeView/TreeView.js +5 -5
  286. package/lib/components/UIShell/HeaderContainer.js +1 -1
  287. package/lib/components/UIShell/HeaderMenu.js +1 -1
  288. package/lib/components/UIShell/Link.js +2 -2
  289. package/lib/components/UIShell/SideNavItems.js +1 -1
  290. package/lib/components/UIShell/Switcher.js +1 -1
  291. package/lib/components/UIShell/SwitcherItem.js +1 -1
  292. package/lib/index.d.ts +1 -1
  293. package/lib/internal/FloatingMenu.js +4 -4
  294. package/lib/internal/Selection.js +6 -6
  295. package/lib/internal/useMergedRefs.js +1 -1
  296. package/lib/internal/useNoInteractiveChildren.js +4 -4
  297. package/lib/internal/useOutsideClick.js +1 -1
  298. package/lib/internal/useOverflowItems.js +6 -6
  299. package/lib/internal/useResizeObserver.js +3 -3
  300. package/lib/internal/useSavedCallback.js +1 -1
  301. package/lib/internal/warning.js +1 -1
  302. package/lib/prop-types/isRequiredOneOf.js +2 -2
  303. package/lib/tools/events.js +1 -1
  304. package/lib/tools/wrapComponent.js +1 -1
  305. package/lib/types/common.d.ts +6 -2
  306. package/package.json +9 -9
@@ -20,18 +20,18 @@ var _Undo;
20
20
  const AILabelContent = /*#__PURE__*/React.forwardRef(function AILabelContent({
21
21
  className,
22
22
  children
23
- }, ref // eslint-disable-line @typescript-eslint/no-unused-vars -- https://github.com/carbon-design-system/carbon/issues/20071
23
+ }, ref // eslint-disable-line @typescript-eslint/no-unused-vars -- https://github.com/carbon-design-system/carbon/issues/20452
24
24
  ) {
25
25
  const prefix = usePrefix();
26
26
  const hasAILabelActions = React.Children.toArray(children).some(child => {
27
- // eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20071
27
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20452
28
28
  const item = child;
29
29
  // TODO: Is there supposed to be a `return` here? If so, this issue would
30
30
  // have been caught by ESLint. It's concerning that this code is 7 months
31
31
  // old and no one has noticed any issues with it. It also makes me question
32
32
  // whether the code is necessary.
33
33
  // https://github.com/carbon-design-system/carbon/issues/18991
34
- // eslint-disable-next-line @typescript-eslint/no-unused-expressions -- https://github.com/carbon-design-system/carbon/issues/20071
34
+ // eslint-disable-next-line @typescript-eslint/no-unused-expressions -- https://github.com/carbon-design-system/carbon/issues/20452
35
35
  item.type === AILabelActions;
36
36
  });
37
37
  const aiLabelContentClasses = cx(className, {
@@ -56,7 +56,7 @@ AILabelContent.propTypes = {
56
56
  const AILabelActions = /*#__PURE__*/React.forwardRef(function AILabelActions({
57
57
  className,
58
58
  children
59
- }, ref // eslint-disable-line @typescript-eslint/no-unused-vars -- https://github.com/carbon-design-system/carbon/issues/20071
59
+ }, ref // eslint-disable-line @typescript-eslint/no-unused-vars -- https://github.com/carbon-design-system/carbon/issues/20452
60
60
  ) {
61
61
  const prefix = usePrefix();
62
62
  const aiLabelActionsClasses = cx(className, {
@@ -34,7 +34,7 @@ const BreadcrumbItem = frFn((props, ref) => {
34
34
  [customClassName]: !!customClassName
35
35
  });
36
36
 
37
- // eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20071
37
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20452
38
38
  const child = children;
39
39
  if (child.type && child.type.displayName !== undefined && child.type.displayName.includes('OverflowMenu')) {
40
40
  const horizontalOverflowIcon = /*#__PURE__*/React.createElement(OverflowMenuHorizontal, {
@@ -22,7 +22,7 @@ function isIconOnlyButton(hasIconOnly, _kind) {
22
22
  return false;
23
23
  }
24
24
 
25
- // eslint-disable-next-line react/display-name -- https://github.com/carbon-design-system/carbon/issues/20071
25
+ // eslint-disable-next-line react/display-name -- https://github.com/carbon-design-system/carbon/issues/20452
26
26
  const Button = /*#__PURE__*/React.forwardRef((props, ref) => {
27
27
  const {
28
28
  as,
@@ -45,7 +45,7 @@ const Button = /*#__PURE__*/React.forwardRef((props, ref) => {
45
45
  ...rest
46
46
  } = props;
47
47
  if (ButtonImageElement && !children && !iconDescription) {
48
- // eslint-disable-next-line no-console -- https://github.com/carbon-design-system/carbon/issues/20071
48
+ // eslint-disable-next-line no-console -- https://github.com/carbon-design-system/carbon/issues/20452
49
49
  console.error('Button: renderIcon property specified without also providing an iconDescription property. ' + 'This may impact accessibility for screen reader users.');
50
50
  }
51
51
  const iconOnlyImage = !ButtonImageElement ? null : /*#__PURE__*/React.createElement(ButtonImageElement, null);
@@ -38,7 +38,7 @@ const ChatButton = /*#__PURE__*/React.forwardRef(function ChatButton({
38
38
  } else {
39
39
  // Check if size is valid and warn if not
40
40
  if (size && !allowedSizes.includes(size)) {
41
- // eslint-disable-next-line no-console -- https://github.com/carbon-design-system/carbon/issues/20071
41
+ // eslint-disable-next-line no-console -- https://github.com/carbon-design-system/carbon/issues/20452
42
42
  console.error(`Invalid size "${size}" provided to ChatButton. Size must be one of: ${allowedSizes.join(', ')}. Defaulting to "lg".`);
43
43
  size = 'lg';
44
44
  }
@@ -61,7 +61,7 @@ const Checkbox = /*#__PURE__*/React.forwardRef(({
61
61
  const candidateIsAILabel = isComponentElement(candidate, AILabel);
62
62
  const normalizedDecorator = candidateIsAILabel ? /*#__PURE__*/cloneElement(candidate, {
63
63
  size: candidate.props.kind === 'inline' ? 'md' : 'mini'
64
- }) : null;
64
+ }) : candidate;
65
65
  return /*#__PURE__*/React.createElement("div", {
66
66
  className: wrapperClasses
67
67
  }, /*#__PURE__*/React.createElement("input", _extends({}, other, {
@@ -58,7 +58,7 @@ const CheckboxGroup = ({
58
58
  const normalizedDecorator = candidateIsAILabel ? /*#__PURE__*/cloneElement(candidate, {
59
59
  size: 'mini',
60
60
  kind: 'default'
61
- }) : null;
61
+ }) : candidate;
62
62
  const clonedChildren = Children.map(children, child => {
63
63
  if (/*#__PURE__*/isValidElement(child) && child.type === Checkbox) {
64
64
  const childProps = {
@@ -7,7 +7,7 @@
7
7
 
8
8
  import { extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
9
9
  import PropTypes from 'prop-types';
10
- import React, { useState, useRef, useCallback, useEffect } from 'react';
10
+ import React, { useState, useRef, useCallback } from 'react';
11
11
  import cx from 'classnames';
12
12
  import { useResizeObserver } from '../../internal/useResizeObserver.js';
13
13
  import { ChevronDown } from '@carbon/icons-react';
@@ -60,8 +60,6 @@ function CodeSnippet({
60
60
  const codeContentRef = useRef(null);
61
61
  const codeContainerRef = useRef(null);
62
62
  const innerCodeRef = useRef(null);
63
- const [hasLeftOverflow, setHasLeftOverflow] = useState(false);
64
- const [hasRightOverflow, setHasRightOverflow] = useState(false);
65
63
  const getCodeRef = useCallback(() => {
66
64
  if (type === 'single') {
67
65
  return codeContainerRef;
@@ -73,39 +71,13 @@ function CodeSnippet({
73
71
  }
74
72
  }, [type]);
75
73
  const prefix = usePrefix();
76
- const getCodeRefDimensions = useCallback(() => {
77
- const {
78
- clientWidth: codeClientWidth = 0,
79
- scrollLeft: codeScrollLeft = 0,
80
- scrollWidth: codeScrollWidth = 0
81
- } = getCodeRef().current || {};
82
- return {
83
- horizontalOverflow: codeScrollWidth > codeClientWidth,
84
- codeClientWidth,
85
- codeScrollWidth,
86
- codeScrollLeft
87
- };
88
- }, [getCodeRef]);
89
- const handleScroll = useCallback(() => {
90
- if (type === 'inline' || type === 'single' && !codeContainerRef?.current || type === 'multi' && !codeContentRef?.current) {
91
- return;
92
- }
93
- const {
94
- horizontalOverflow,
95
- codeClientWidth,
96
- codeScrollWidth,
97
- codeScrollLeft
98
- } = getCodeRefDimensions();
99
- setHasLeftOverflow(horizontalOverflow && !!codeScrollLeft);
100
- setHasRightOverflow(horizontalOverflow && codeScrollLeft + codeClientWidth !== codeScrollWidth);
101
- }, [type, getCodeRefDimensions]);
102
74
  useResizeObserver({
103
75
  ref: getCodeRef(),
104
76
  onResize: () => {
105
- if (codeContentRef?.current && type === 'multi') {
77
+ if (innerCodeRef?.current && type === 'multi') {
106
78
  const {
107
79
  height
108
- } = codeContentRef.current.getBoundingClientRect();
80
+ } = innerCodeRef.current.getBoundingClientRect();
109
81
  if (maxCollapsedNumberOfRows > 0 && (maxExpandedNumberOfRows <= 0 || maxExpandedNumberOfRows > maxCollapsedNumberOfRows) && height > maxCollapsedNumberOfRows * rowHeightInPixels) {
110
82
  setShouldShowMoreLessBtn(true);
111
83
  } else {
@@ -115,14 +87,8 @@ function CodeSnippet({
115
87
  setExpandedCode(false);
116
88
  }
117
89
  }
118
- if (codeContentRef?.current && type === 'multi' || codeContainerRef?.current && type === 'single') {
119
- handleScroll();
120
- }
121
90
  }
122
91
  });
123
- useEffect(() => {
124
- handleScroll();
125
- }, [handleScroll]);
126
92
  const handleCopyClick = evt => {
127
93
  if (copyText || innerCodeRef?.current) {
128
94
  copy(copyText ?? innerCodeRef?.current?.innerText ?? '');
@@ -137,8 +103,7 @@ function CodeSnippet({
137
103
  [`${prefix}--snippet--expand`]: expandedCode,
138
104
  [`${prefix}--snippet--light`]: light,
139
105
  [`${prefix}--snippet--no-copy`]: hideCopyButton,
140
- [`${prefix}--snippet--wraptext`]: wrapText,
141
- [`${prefix}--snippet--has-right-overflow`]: type == 'multi' && hasRightOverflow
106
+ [`${prefix}--snippet--wraptext`]: wrapText
142
107
  });
143
108
  const expandCodeBtnText = expandedCode ? showLessText : showMoreText;
144
109
  if (type === 'inline') {
@@ -196,18 +161,12 @@ function CodeSnippet({
196
161
  className: `${prefix}--snippet-container`,
197
162
  "aria-label": deprecatedAriaLabel || ariaLabel || 'code-snippet',
198
163
  "aria-readonly": type === 'single' || type === 'multi' ? true : undefined,
199
- "aria-multiline": type === 'multi' ? true : undefined,
200
- onScroll: type === 'single' && handleScroll || undefined
201
- }, containerStyle), /*#__PURE__*/React.createElement("pre", {
202
- ref: codeContentRef,
203
- onScroll: type === 'multi' && handleScroll || undefined
204
- }, /*#__PURE__*/React.createElement("code", {
164
+ "aria-multiline": type === 'multi' ? true : undefined
165
+ }, containerStyle), /*#__PURE__*/React.createElement("pre", _extends({
166
+ ref: codeContentRef
167
+ }, containerStyle), /*#__PURE__*/React.createElement("code", {
205
168
  ref: innerCodeRef
206
- }, children))), hasLeftOverflow && /*#__PURE__*/React.createElement("div", {
207
- className: `${prefix}--snippet__overflow-indicator--left`
208
- }), hasRightOverflow && type !== 'multi' && /*#__PURE__*/React.createElement("div", {
209
- className: `${prefix}--snippet__overflow-indicator--right`
210
- }), !hideCopyButton && /*#__PURE__*/React.createElement(CopyButton, {
169
+ }, children))), !hideCopyButton && /*#__PURE__*/React.createElement(CopyButton, {
211
170
  align: align,
212
171
  autoAlign: autoAlign,
213
172
  size: type === 'multi' ? 'sm' : 'md',
@@ -6,23 +6,15 @@
6
6
  */
7
7
  import { UseComboboxProps, UseComboboxActions } from 'downshift';
8
8
  import React, { type ComponentType, type InputHTMLAttributes, type MouseEvent, type PropsWithChildren, type PropsWithRef, type ReactElement, type ReactNode, type RefAttributes } from 'react';
9
- import { type ListBoxSize } from '../ListBox';
10
- import { TranslateWithId } from '../../types/common';
9
+ import { type ListBoxMenuIconTranslationKey, type ListBoxSelectionTranslationKey, type ListBoxSize } from '../ListBox';
10
+ import type { TranslateWithId } from '../../types/common';
11
11
  type ExcludedAttributes = 'id' | 'onChange' | 'onClick' | 'type' | 'size';
12
12
  export interface OnChangeData<ItemType> {
13
13
  selectedItem: ItemType | null | undefined;
14
14
  inputValue?: string | null;
15
15
  }
16
- /**
17
- * Message ids that will be passed to translateWithId().
18
- * Combination of message ids from ListBox/next/ListBoxSelection.js and
19
- * ListBox/next/ListBoxTrigger.js, but we can't access those values directly
20
- * because those components aren't Typescript. (If you try, TranslationKey
21
- * ends up just being defined as "string".)
22
- */
23
- export type TranslationKey = 'close.menu' | 'open.menu' | 'clear.all' | 'clear.selection';
24
16
  export type ItemToStringHandler<ItemType> = (item: ItemType | null) => string;
25
- export interface ComboBoxProps<ItemType> extends Omit<InputHTMLAttributes<HTMLInputElement>, ExcludedAttributes>, TranslateWithId<TranslationKey> {
17
+ export interface ComboBoxProps<ItemType> extends Omit<InputHTMLAttributes<HTMLInputElement>, ExcludedAttributes>, TranslateWithId<ListBoxMenuIconTranslationKey | ListBoxSelectionTranslationKey> {
26
18
  /**
27
19
  * Specify whether or not the ComboBox should allow a value that is
28
20
  * not in the list to be entered in the input
@@ -93,15 +93,6 @@ const findHighlightedIndex = ({
93
93
  }
94
94
  return -1;
95
95
  };
96
-
97
- /**
98
- * Message ids that will be passed to translateWithId().
99
- * Combination of message ids from ListBox/next/ListBoxSelection.js and
100
- * ListBox/next/ListBoxTrigger.js, but we can't access those values directly
101
- * because those components aren't Typescript. (If you try, TranslationKey
102
- * ends up just being defined as "string".)
103
- */
104
-
105
96
  const ComboBox = /*#__PURE__*/forwardRef((props, ref) => {
106
97
  const prevInputLengthRef = useRef(0);
107
98
  const inputRef = useRef(null);
@@ -169,7 +160,7 @@ const ComboBox = /*#__PURE__*/forwardRef((props, ref) => {
169
160
  refs.floating.current.style.width = parentWidth + 'px';
170
161
  }
171
162
  }
172
- // eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/20071
163
+ // eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/20452
173
164
  }, [enableFloatingStyles, floatingStyles, refs.floating, parentWidth]);
174
165
  const [inputValue, setInputValue] = useState(getInputValue({
175
166
  initialSelectedItem,
@@ -199,7 +190,7 @@ const ComboBox = /*#__PURE__*/forwardRef((props, ref) => {
199
190
  }
200
191
  prevInputLengthRef.current = inputValue.length;
201
192
  }
202
- // eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/20071
193
+ // eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/20452
203
194
  }, [typeahead, inputValue, items, itemToString, autocompleteCustomFilter]);
204
195
  const isManualClearingRef = useRef(false);
205
196
  const [isClearing, setIsClearing] = useState(false);
@@ -240,7 +231,7 @@ const ComboBox = /*#__PURE__*/forwardRef((props, ref) => {
240
231
  }
241
232
  prevSelectedItemProp.current = selectedItemProp;
242
233
  }
243
- // eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/20071
234
+ // eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/20452
244
235
  }, [selectedItemProp]);
245
236
  const filterItems = (items, itemToString, inputValue) => items.filter(item => typeahead ? autocompleteCustomFilter({
246
237
  item: itemToString(item),
@@ -255,10 +246,10 @@ const ComboBox = /*#__PURE__*/forwardRef((props, ref) => {
255
246
  useEffect(() => {
256
247
  if (prevInputValue.current !== inputValue) {
257
248
  prevInputValue.current = inputValue;
258
- // eslint-disable-next-line @typescript-eslint/no-unused-expressions -- https://github.com/carbon-design-system/carbon/issues/20071
249
+ // eslint-disable-next-line @typescript-eslint/no-unused-expressions -- https://github.com/carbon-design-system/carbon/issues/20452
259
250
  onInputChange && onInputChange(inputValue);
260
251
  }
261
- // eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/20071
252
+ // eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/20452
262
253
  }, [inputValue]);
263
254
  const handleSelectionClear = () => {
264
255
  if (textInput?.current) {
@@ -327,7 +318,7 @@ const ComboBox = /*#__PURE__*/forwardRef((props, ref) => {
327
318
  const filteredList = filterItems(items, itemToString, inputValue);
328
319
  const highlightedItem = filteredList[state.highlightedIndex];
329
320
 
330
- // eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20071
321
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20452
331
322
  if (highlightedItem && !highlightedItem.disabled) {
332
323
  return {
333
324
  ...changes,
@@ -340,7 +331,7 @@ const ComboBox = /*#__PURE__*/forwardRef((props, ref) => {
340
331
  if (autoIndex !== -1) {
341
332
  const matchingItem = items[autoIndex];
342
333
 
343
- // eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20071
334
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20452
344
335
  if (matchingItem && !matchingItem.disabled) {
345
336
  return {
346
337
  ...changes,
@@ -458,7 +449,7 @@ const ComboBox = /*#__PURE__*/forwardRef((props, ref) => {
458
449
  const candidateIsAILabel = isComponentElement(candidate, AILabel);
459
450
  const normalizedDecorator = candidateIsAILabel ? /*#__PURE__*/cloneElement(candidate, {
460
451
  size: 'mini'
461
- }) : null;
452
+ }) : candidate;
462
453
  const {
463
454
  // Prop getters
464
455
  getInputProps,
@@ -494,10 +485,10 @@ const ComboBox = /*#__PURE__*/forwardRef((props, ref) => {
494
485
  onHighlightedIndexChange: ({
495
486
  highlightedIndex
496
487
  }) => {
497
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion , valid-typeof , no-constant-binary-expression -- https://github.com/carbon-design-system/carbon/issues/20071
488
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion , valid-typeof , no-constant-binary-expression -- https://github.com/carbon-design-system/carbon/issues/20452
498
489
  if (highlightedIndex > -1 && typeof window !== undefined) {
499
490
  const itemArray = document.querySelectorAll(`li.${prefix}--list-box__menu-item[role="option"]`);
500
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- https://github.com/carbon-design-system/carbon/issues/20071
491
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- https://github.com/carbon-design-system/carbon/issues/20452
501
492
  const highlightedItem = itemArray[highlightedIndex];
502
493
  if (highlightedItem) {
503
494
  highlightedItem.scrollIntoView({
@@ -510,9 +501,9 @@ const ComboBox = /*#__PURE__*/forwardRef((props, ref) => {
510
501
  initialSelectedItem: initialSelectedItem,
511
502
  inputId: id,
512
503
  stateReducer,
513
- // eslint-disable-next-line @typescript-eslint/no-unused-vars -- https://github.com/carbon-design-system/carbon/issues/20071
504
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars -- https://github.com/carbon-design-system/carbon/issues/20452
514
505
  isItemDisabled(item, _index) {
515
- // eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20071
506
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20452
516
507
  return item?.disabled;
517
508
  },
518
509
  ...downshiftProps,
@@ -549,7 +540,7 @@ const ComboBox = /*#__PURE__*/forwardRef((props, ref) => {
549
540
  toggleMenu
550
541
  };
551
542
  }
552
- // eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/20071
543
+ // eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/20452
553
544
  }, [closeMenu, openMenu, reset, selectItem, setHighlightedIndex, downshiftSetInputValue, toggleMenu]);
554
545
  const buttonProps = getToggleButtonProps({
555
546
  disabled: disabled || readOnly,
@@ -599,7 +590,7 @@ const ComboBox = /*#__PURE__*/forwardRef((props, ref) => {
599
590
  const menuProps = useMemo(() => getMenuProps({
600
591
  ref: enableFloatingStyles ? refs.setFloating : null
601
592
  }),
602
- // eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/20071
593
+ // eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/20452
603
594
  [enableFloatingStyles, deprecatedAriaLabel, ariaLabel, getMenuProps, refs.setFloating]);
604
595
  useEffect(() => {
605
596
  if (textInput.current) {
@@ -933,8 +924,7 @@ ComboBox.propTypes = {
933
924
  */
934
925
  titleText: PropTypes.node,
935
926
  /**
936
- * Specify a custom translation function that takes in a message identifier
937
- * and returns the localized string for the message
927
+ * Translates component strings using your i18n tool.
938
928
  */
939
929
  translateWithId: PropTypes.func,
940
930
  /**
@@ -9,14 +9,11 @@ import { IconButton } from '../IconButton';
9
9
  import Button from '../Button';
10
10
  import { Menu } from '../Menu';
11
11
  import { MenuAlignment } from '../MenuButton';
12
- import { TranslateWithId } from '../../types/common';
13
- declare const defaultTranslations: {
14
- 'carbon.combo-button.additional-actions': string;
12
+ import type { TranslateWithId } from '../../types/common';
13
+ declare const translationIds: {
14
+ readonly 'carbon.combo-button.additional-actions': "carbon.combo-button.additional-actions";
15
15
  };
16
- /**
17
- * Message ids that will be passed to translateWithId().
18
- */
19
- export type TranslationKey = keyof typeof defaultTranslations;
16
+ type TranslationKey = keyof typeof translationIds;
20
17
  interface ComboButtonProps extends TranslateWithId<TranslationKey> {
21
18
  /**
22
19
  * A collection of `MenuItems` to be rendered as additional actions for this `ComboButton`.
@@ -45,7 +42,7 @@ interface ComboButtonProps extends TranslateWithId<TranslationKey> {
45
42
  /**
46
43
  * Specify the size of the buttons and menu.
47
44
  */
48
- size?: 'sm' | 'md' | 'lg';
45
+ size?: 'xs' | 'sm' | 'md' | 'lg';
49
46
  /**
50
47
  * Specify how the trigger tooltip should be aligned.
51
48
  */
@@ -25,17 +25,15 @@ import { deprecateValuesWithin } from '../../prop-types/deprecateValuesWithin.js
25
25
  import { mapPopoverAlign } from '../../tools/mapPopoverAlign.js';
26
26
 
27
27
  var _ChevronDown;
28
+ const translationIds = {
29
+ 'carbon.combo-button.additional-actions': 'carbon.combo-button.additional-actions'
30
+ };
28
31
  const defaultTranslations = {
29
- 'carbon.combo-button.additional-actions': 'Additional actions'
32
+ [translationIds['carbon.combo-button.additional-actions']]: 'Additional actions'
30
33
  };
31
-
32
- /**
33
- * Message ids that will be passed to translateWithId().
34
- */
35
-
36
- function defaultTranslateWithId(messageId) {
34
+ const defaultTranslateWithId = messageId => {
37
35
  return defaultTranslations[messageId];
38
- }
36
+ };
39
37
  const ComboButton = /*#__PURE__*/React.forwardRef(function ComboButton({
40
38
  children,
41
39
  className,
@@ -54,7 +52,7 @@ const ComboButton = /*#__PURE__*/React.forwardRef(function ComboButton({
54
52
  const id = useId('combobutton');
55
53
  const prefix = usePrefix();
56
54
  const containerRef = useRef(null);
57
- // eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20071
55
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20452
58
56
  let middlewares = [];
59
57
  if (!enableOnlyFloatingStyles) {
60
58
  middlewares = [flip({
@@ -186,7 +184,7 @@ ComboButton.propTypes = {
186
184
  /**
187
185
  * Specify the size of the buttons and menu.
188
186
  */
189
- size: PropTypes.oneOf(['sm', 'md', 'lg']),
187
+ size: PropTypes.oneOf(['xs', 'sm', 'md', 'lg']),
190
188
  /**
191
189
  * Specify how the trigger tooltip should be aligned.
192
190
  */
@@ -213,8 +211,7 @@ ComboButton.propTypes = {
213
211
  // new values to match floating-ui
214
212
  'top-start', 'top-end', 'bottom-start', 'bottom-end', 'left-end', 'left-start', 'right-end', 'right-start']), ['top', 'top-start', 'top-end', 'bottom', 'bottom-start', 'bottom-end', 'left', 'left-start', 'left-end', 'right', 'right-start', 'right-end'], mapPopoverAlign),
215
213
  /**
216
- * Optional method that takes in a message id and returns an
217
- * internationalized string.
214
+ * Translates component strings using your i18n tool.
218
215
  */
219
216
  translateWithId: PropTypes.func
220
217
  };
@@ -6,13 +6,13 @@
6
6
  */
7
7
 
8
8
  import { extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
9
- import React, { useRef, useState, useContext, useEffect, Children, cloneElement } from 'react';
9
+ import React, { useRef, useContext, useEffect, Children, cloneElement } from 'react';
10
+ import { useResizeObserver } from '../../internal/useResizeObserver.js';
10
11
  import { isElement } from 'react-is';
11
12
  import PropTypes from 'prop-types';
12
13
  import { Layer } from '../Layer/index.js';
13
14
  import { ModalHeader } from './ModalHeader.js';
14
15
  import { ModalFooter } from './ModalFooter.js';
15
- import useIsomorphicEffect from '../../internal/useIsomorphicEffect.js';
16
16
  import { mergeRefs } from '../../tools/mergeRefs.js';
17
17
  import cx from 'classnames';
18
18
  import { toggleClass } from '../../tools/toggleClass.js';
@@ -32,7 +32,6 @@ import { useMergeRefs } from '@floating-ui/react';
32
32
  import { ComposedModalPresenceContext, useExclusiveComposedModalPresenceContext, ComposedModalPresence } from './ComposedModalPresence.js';
33
33
  import { useId } from '../../internal/useId.js';
34
34
  import { useComposedModalState } from './useComposedModalState.js';
35
- import { debounce } from '../../node_modules/es-toolkit/dist/compat/function/debounce.js';
36
35
 
37
36
  const ModalBody = /*#__PURE__*/React.forwardRef(function ModalBody({
38
37
  className: customClassName,
@@ -43,28 +42,23 @@ const ModalBody = /*#__PURE__*/React.forwardRef(function ModalBody({
43
42
  }, ref) {
44
43
  const prefix = usePrefix();
45
44
  const contentRef = useRef(null);
46
- const [isScrollable, setIsScrollable] = useState(false);
45
+ const {
46
+ height
47
+ } = useResizeObserver({
48
+ ref: contentRef
49
+ });
50
+
51
+ /**
52
+ * isScrollable is implicitly dependent on height, when height gets updated
53
+ * via `useResizeObserver`, clientHeight and scrollHeight get updated too
54
+ */
55
+ const isScrollable = !!contentRef.current && contentRef?.current?.scrollHeight > contentRef?.current?.clientHeight;
47
56
  const contentClass = cx({
48
57
  [`${prefix}--modal-content`]: true,
49
58
  [`${prefix}--modal-content--with-form`]: hasForm,
50
- [`${prefix}--modal-scroll-content`]: hasScrollingContent || isScrollable
59
+ [`${prefix}--modal-scroll-content`]: hasScrollingContent || isScrollable,
60
+ [`${prefix}--modal-scroll-content--no-fade`]: height <= 300
51
61
  }, customClassName);
52
- useIsomorphicEffect(() => {
53
- if (contentRef.current) {
54
- setIsScrollable(contentRef.current.scrollHeight > contentRef.current.clientHeight);
55
- }
56
- function handler() {
57
- if (contentRef.current) {
58
- setIsScrollable(contentRef.current.scrollHeight > contentRef.current.clientHeight);
59
- }
60
- }
61
- const debouncedHandler = debounce(handler, 200);
62
- window.addEventListener('resize', debouncedHandler);
63
- return () => {
64
- debouncedHandler.cancel();
65
- window.removeEventListener('resize', debouncedHandler);
66
- };
67
- }, []);
68
62
  const hasScrollingContentProps = hasScrollingContent || isScrollable ? {
69
63
  tabIndex: 0,
70
64
  role: 'region'
@@ -169,7 +163,7 @@ const ComposedModalDialog = /*#__PURE__*/React.forwardRef(function ComposedModal
169
163
  if (!enableDialogElement) {
170
164
  toggleClass(document.body, `${prefix}--body--with-modal-open`, !!open);
171
165
  }
172
- // eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/20071
166
+ // eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/20452
173
167
  }, [open, prefix]);
174
168
  // Remove the document.body className on unmount
175
169
  useEffect(() => {
@@ -305,7 +299,7 @@ const ComposedModalDialog = /*#__PURE__*/React.forwardRef(function ComposedModal
305
299
  return () => {
306
300
  document.removeEventListener('keydown', handleEscapeKey, true);
307
301
  };
308
- // eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/20071
302
+ // eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/20452
309
303
  }, [open]);
310
304
  useEffect(() => {
311
305
  if (!enableDialogElement && !enablePresence && !open && launcherButtonRef) {
@@ -348,7 +342,7 @@ const ComposedModalDialog = /*#__PURE__*/React.forwardRef(function ComposedModal
348
342
  focusButton(innerModal.current);
349
343
  }
350
344
  }
351
- // eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/20071
345
+ // eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/20452
352
346
  }, [open, selectorPrimaryFocus, isOpen]);
353
347
 
354
348
  // AILabel is always size `sm`
@@ -356,7 +350,7 @@ const ComposedModalDialog = /*#__PURE__*/React.forwardRef(function ComposedModal
356
350
  const candidateIsAILabel = isComponentElement(candidate, AILabel);
357
351
  const normalizedDecorator = candidateIsAILabel ? /*#__PURE__*/cloneElement(candidate, {
358
352
  size: 'sm'
359
- }) : null;
353
+ }) : candidate;
360
354
  const modalBody = enableDialogElement ? /*#__PURE__*/React.createElement(Dialog, {
361
355
  open: open,
362
356
  focusAfterCloseRef: launcherButtonRef,
@@ -8,21 +8,21 @@ import PropTypes from 'prop-types';
8
8
  import React, { type ChangeEvent, type MouseEvent, type ReactElement, type ReactNode } from 'react';
9
9
  import { type SortRowFn } from './state/sorting';
10
10
  import type { DataTableSortState } from './state/sortStates';
11
- import { TranslateWithId } from '../../types/common';
12
- declare const translationKeys: {
13
- readonly expandRow: "carbon.table.row.expand";
14
- readonly collapseRow: "carbon.table.row.collapse";
15
- readonly expandAll: "carbon.table.all.expand";
16
- readonly collapseAll: "carbon.table.all.collapse";
17
- readonly selectAll: "carbon.table.all.select";
18
- readonly unselectAll: "carbon.table.all.unselect";
19
- readonly selectRow: "carbon.table.row.select";
20
- readonly unselectRow: "carbon.table.row.unselect";
11
+ import type { TranslateWithId } from '../../types/common';
12
+ declare const translationIds: {
13
+ readonly 'carbon.table.row.expand': "carbon.table.row.expand";
14
+ readonly 'carbon.table.row.collapse': "carbon.table.row.collapse";
15
+ readonly 'carbon.table.all.expand': "carbon.table.all.expand";
16
+ readonly 'carbon.table.all.collapse': "carbon.table.all.collapse";
17
+ readonly 'carbon.table.all.select': "carbon.table.all.select";
18
+ readonly 'carbon.table.all.unselect': "carbon.table.all.unselect";
19
+ readonly 'carbon.table.row.select': "carbon.table.row.select";
20
+ readonly 'carbon.table.row.unselect': "carbon.table.row.unselect";
21
21
  };
22
22
  /**
23
23
  * Message IDs that will be passed to translateWithId().
24
24
  */
25
- type TranslationKey = (typeof translationKeys)[keyof typeof translationKeys];
25
+ type TranslationKey = keyof typeof translationIds;
26
26
  export type DataTableSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
27
27
  export interface DataTableCell<T> {
28
28
  id: string;
@@ -92,6 +92,7 @@ export interface DataTableRenderProps<RowType, ColTypes extends any[]> {
92
92
  isExpanded: boolean;
93
93
  onExpand: (event: MouseEvent<HTMLButtonElement>) => void;
94
94
  [key: string]: unknown;
95
+ id: string;
95
96
  };
96
97
  getRowProps: (options: {
97
98
  onClick?: (event: MouseEvent<HTMLButtonElement>) => void;
@@ -105,6 +106,7 @@ export interface DataTableRenderProps<RowType, ColTypes extends any[]> {
105
106
  key: string;
106
107
  onExpand: (event: MouseEvent<HTMLButtonElement>) => void;
107
108
  [key: string]: unknown;
109
+ expandHeader: string;
108
110
  };
109
111
  getExpandedRowProps: (options: {
110
112
  row: DataTableRow<ColTypes>;
@@ -233,7 +235,6 @@ export interface DataTableProps<RowType, ColTypes extends any[]> extends Transla
233
235
  */
234
236
  export declare const DataTable: {
235
237
  <RowType, ColTypes extends any[]>(props: DataTableProps<RowType, ColTypes>): React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | null;
236
- translationKeys: ("carbon.table.row.expand" | "carbon.table.row.collapse" | "carbon.table.all.expand" | "carbon.table.all.collapse" | "carbon.table.all.select" | "carbon.table.all.unselect" | "carbon.table.row.select" | "carbon.table.row.unselect")[];
237
238
  Table: {
238
239
  ({ className, children, useZebraStyles, size, isSortable, useStaticWidth, stickyHeader, overflowMenuOnHover, experimentalAutoAlign, tabIndex, ...other }: React.PropsWithChildren<import("./Table").TableProps>): import("react/jsx-runtime").JSX.Element;
239
240
  propTypes: {
@@ -258,7 +259,19 @@ export declare const DataTable: {
258
259
  renderIcon: PropTypes.Requireable<object>;
259
260
  };
260
261
  };
261
- TableBatchActions: import("./TableBatchActions").TableBatchActionsComponent;
262
+ TableBatchActions: {
263
+ ({ className, children, shouldShowBatchActions, totalSelected, totalCount, onCancel, onSelectAll, translateWithId: t, ...rest }: import("./TableBatchActions").TableBatchActionsProps): import("react/jsx-runtime").JSX.Element;
264
+ propTypes: {
265
+ children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
266
+ className: PropTypes.Requireable<string>;
267
+ onCancel: PropTypes.Validator<(...args: any[]) => any>;
268
+ onSelectAll: PropTypes.Requireable<(...args: any[]) => any>;
269
+ shouldShowBatchActions: PropTypes.Requireable<boolean>;
270
+ totalCount: PropTypes.Requireable<number>;
271
+ totalSelected: PropTypes.Validator<number>;
272
+ translateWithId: PropTypes.Requireable<(...args: any[]) => any>;
273
+ };
274
+ };
262
275
  TableBody: {
263
276
  ({ children, className, ...rest }: import("./TableBody").TableBodyProps): import("react/jsx-runtime").JSX.Element;
264
277
  propTypes: {
@@ -454,9 +467,7 @@ export declare const DataTable: {
454
467
  */
455
468
  stickyHeader: PropTypes.Requireable<boolean>;
456
469
  /**
457
- * Optional method that takes in a message ID and returns an
458
- * internationalized string. See `DataTable.translationKeys` for all
459
- * available message IDs.
470
+ * Translates component strings using your i18n tool.
460
471
  */
461
472
  translateWithId: PropTypes.Requireable<(...args: any[]) => any>;
462
473
  /**