@carbon/react 1.92.1 → 1.93.0-rc.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (302) hide show
  1. package/.playwright/INTERNAL_AVT_REPORT_DO_NOT_USE.json +1026 -985
  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/ComboBox/ComboBox.d.ts +3 -11
  9. package/es/components/ComboBox/ComboBox.js +15 -25
  10. package/es/components/ComboButton/index.d.ts +5 -8
  11. package/es/components/ComboButton/index.js +9 -12
  12. package/es/components/ComposedModal/ComposedModal.js +19 -25
  13. package/es/components/DataTable/DataTable.d.ts +25 -16
  14. package/es/components/DataTable/DataTable.js +33 -34
  15. package/es/components/DataTable/Table.js +2 -2
  16. package/es/components/DataTable/TableBatchActions.d.ts +49 -10
  17. package/es/components/DataTable/TableBatchActions.js +26 -21
  18. package/es/components/DataTable/TableExpandHeader.js +2 -2
  19. package/es/components/DataTable/TableExpandRow.js +1 -1
  20. package/es/components/DataTable/TableHeader.d.ts +8 -10
  21. package/es/components/DataTable/TableHeader.js +11 -13
  22. package/es/components/DataTable/TableRow.js +5 -5
  23. package/es/components/DataTable/TableSlugRow.js +1 -1
  24. package/es/components/DataTable/TableToolbarMenu.js +1 -1
  25. package/es/components/DataTable/TableToolbarSearch.d.ts +8 -7
  26. package/es/components/DataTable/TableToolbarSearch.js +11 -11
  27. package/es/components/DataTable/index.d.ts +2 -2
  28. package/es/components/DataTable/state/sorting.d.ts +2 -2
  29. package/es/components/DataTable/state/sorting.js +1 -1
  30. package/es/components/DataTable/tools/sorting.js +1 -1
  31. package/es/components/DatePicker/DatePicker.js +9 -9
  32. package/es/components/DatePickerInput/DatePickerInput.js +5 -5
  33. package/es/components/Dialog/Dialog.js +6 -6
  34. package/es/components/Dropdown/Dropdown.d.ts +1 -1
  35. package/es/components/Dropdown/Dropdown.js +8 -8
  36. package/es/components/ErrorBoundary/ErrorBoundaryContext.js +1 -1
  37. package/es/components/FileUploader/FileUploader.js +4 -4
  38. package/es/components/FileUploader/FileUploaderButton.js +1 -1
  39. package/es/components/FileUploader/FileUploaderDropContainer.js +1 -1
  40. package/es/components/FileUploader/FileUploaderItem.js +2 -2
  41. package/es/components/FluidComboBox/FluidComboBox.d.ts +4 -7
  42. package/es/components/FluidComboBox/FluidComboBox.js +1 -1
  43. package/es/components/FluidDropdown/FluidDropdown.d.ts +4 -8
  44. package/es/components/FluidDropdown/FluidDropdown.js +1 -1
  45. package/es/components/FluidMultiSelect/FluidFilterableMultiSelect.d.ts +3 -7
  46. package/es/components/FluidMultiSelect/FluidMultiSelect.d.ts +3 -7
  47. package/es/components/FluidMultiSelect/FluidMultiSelect.js +3 -3
  48. package/es/components/FluidNumberInput/FluidNumberInput.d.ts +4 -7
  49. package/es/components/FluidNumberInput/FluidNumberInput.js +2 -2
  50. package/es/components/FluidSearch/FluidSearch.js +1 -1
  51. package/es/components/FluidSelect/FluidSelect.js +1 -1
  52. package/es/components/FluidTextInput/FluidTextInput.js +1 -1
  53. package/es/components/FluidTimePicker/FluidTimePicker.js +3 -3
  54. package/es/components/FluidTimePickerSelect/FluidTimePickerSelect.js +1 -1
  55. package/es/components/Grid/CSSGrid.js +3 -3
  56. package/es/components/Grid/Column.js +2 -2
  57. package/es/components/Grid/ColumnHang.js +1 -1
  58. package/es/components/Grid/FlexGrid.js +1 -1
  59. package/es/components/Grid/Row.js +1 -1
  60. package/es/components/Heading/index.js +2 -2
  61. package/es/components/IconButton/index.js +2 -2
  62. package/es/components/IconIndicator/index.js +2 -2
  63. package/es/components/InlineCheckbox/InlineCheckbox.js +1 -1
  64. package/es/components/Layout/index.js +2 -2
  65. package/es/components/LayoutDirection/LayoutDirection.js +1 -1
  66. package/es/components/Link/Link.js +2 -2
  67. package/es/components/ListBox/ListBoxField.d.ts +0 -1
  68. package/es/components/ListBox/ListBoxMenuIcon.d.ts +8 -4
  69. package/es/components/ListBox/ListBoxMenuIcon.js +10 -6
  70. package/es/components/ListBox/ListBoxMenuItem.js +2 -2
  71. package/es/components/ListBox/ListBoxSelection.d.ts +3 -6
  72. package/es/components/ListBox/ListBoxSelection.js +5 -10
  73. package/es/components/ListBox/index.d.ts +5 -3
  74. package/es/components/ListBox/next/ListBoxSelection.d.ts +6 -13
  75. package/es/components/ListBox/next/ListBoxSelection.js +16 -8
  76. package/es/components/ListBox/next/ListBoxTrigger.d.ts +5 -10
  77. package/es/components/ListBox/next/ListBoxTrigger.js +6 -6
  78. package/es/components/Menu/MenuContext.js +1 -1
  79. package/es/components/Menu/MenuItem.js +1 -1
  80. package/es/components/MenuButton/index.js +5 -5
  81. package/es/components/Modal/Modal.js +17 -23
  82. package/es/components/ModalWrapper/ModalWrapper.js +2 -2
  83. package/es/components/MultiSelect/FilterableMultiSelect.d.ts +3 -12
  84. package/es/components/MultiSelect/FilterableMultiSelect.js +18 -27
  85. package/es/components/MultiSelect/MultiSelect.d.ts +2 -2
  86. package/es/components/MultiSelect/MultiSelect.js +12 -12
  87. package/es/components/Notification/Notification.js +1 -1
  88. package/es/components/NumberInput/NumberInput.d.ts +2 -5
  89. package/es/components/NumberInput/NumberInput.js +13 -18
  90. package/es/components/OverflowMenu/OverflowMenu.d.ts +2 -2
  91. package/es/components/OverflowMenu/OverflowMenu.js +4 -4
  92. package/es/components/OverflowMenu/next/index.d.ts +1 -1
  93. package/es/components/OverflowMenu/next/index.js +2 -2
  94. package/es/components/OverflowMenuItem/OverflowMenuItem.js +2 -2
  95. package/es/components/PageHeader/PageHeader.js +12 -12
  96. package/es/components/Pagination/Pagination.js +3 -3
  97. package/es/components/PaginationNav/PaginationNav.d.ts +6 -9
  98. package/es/components/PaginationNav/PaginationNav.js +21 -22
  99. package/es/components/Popover/index.js +8 -8
  100. package/es/components/ProgressBar/ProgressBar.js +2 -2
  101. package/es/components/ProgressIndicator/ProgressIndicator.d.ts +11 -15
  102. package/es/components/ProgressIndicator/ProgressIndicator.js +15 -15
  103. package/es/components/RadioButton/RadioButton.js +1 -1
  104. package/es/components/RadioButtonGroup/RadioButtonGroup.js +1 -1
  105. package/es/components/RadioTile/RadioTile.js +1 -1
  106. package/es/components/Select/Select.js +7 -5
  107. package/es/components/ShapeIndicator/index.js +2 -2
  108. package/es/components/Slider/Slider.d.ts +7 -9
  109. package/es/components/Slider/Slider.js +16 -20
  110. package/es/components/Stack/HStack.js +1 -1
  111. package/es/components/Stack/Stack.js +1 -1
  112. package/es/components/Stack/VStack.js +1 -1
  113. package/es/components/StructuredList/StructuredList.js +3 -3
  114. package/es/components/Tabs/Tabs.js +12 -12
  115. package/es/components/Tag/DismissibleTag.js +3 -3
  116. package/es/components/Tag/OperationalTag.js +2 -2
  117. package/es/components/Tag/SelectableTag.js +2 -2
  118. package/es/components/Tag/Tag.js +4 -4
  119. package/es/components/Tag/isEllipsisActive.js +1 -1
  120. package/es/components/Text/Text.js +1 -1
  121. package/es/components/TextArea/TextArea.js +1 -1
  122. package/es/components/TextInput/PasswordInput.js +4 -4
  123. package/es/components/TextInput/TextInput.js +3 -3
  124. package/es/components/Theme/index.js +3 -3
  125. package/es/components/Tile/Tile.js +3 -3
  126. package/es/components/TimePicker/TimePicker.js +1 -1
  127. package/es/components/Toggletip/index.js +4 -4
  128. package/es/components/Tooltip/DefinitionTooltip.js +1 -1
  129. package/es/components/Tooltip/Tooltip.js +3 -3
  130. package/es/components/TreeView/TreeNode.js +6 -6
  131. package/es/components/TreeView/TreeView.js +5 -5
  132. package/es/components/UIShell/HeaderContainer.js +1 -1
  133. package/es/components/UIShell/HeaderMenu.js +1 -1
  134. package/es/components/UIShell/Link.js +2 -2
  135. package/es/components/UIShell/SideNavItems.js +1 -1
  136. package/es/components/UIShell/Switcher.js +1 -1
  137. package/es/components/UIShell/SwitcherItem.js +1 -1
  138. package/es/index.d.ts +1 -1
  139. package/es/internal/FloatingMenu.js +4 -4
  140. package/es/internal/Selection.js +6 -6
  141. package/es/internal/useMergedRefs.js +1 -1
  142. package/es/internal/useNoInteractiveChildren.js +4 -4
  143. package/es/internal/useOutsideClick.js +1 -1
  144. package/es/internal/useOverflowItems.js +6 -6
  145. package/es/internal/useResizeObserver.js +3 -3
  146. package/es/internal/useSavedCallback.js +1 -1
  147. package/es/internal/warning.js +1 -1
  148. package/es/prop-types/isRequiredOneOf.js +2 -2
  149. package/es/tools/events.js +1 -1
  150. package/es/tools/wrapComponent.js +1 -1
  151. package/es/types/common.d.ts +6 -2
  152. package/lib/components/AILabel/index.js +4 -4
  153. package/lib/components/Breadcrumb/BreadcrumbItem.js +1 -1
  154. package/lib/components/Button/Button.js +2 -2
  155. package/lib/components/ChatButton/ChatButton.js +1 -1
  156. package/lib/components/Checkbox/Checkbox.js +1 -1
  157. package/lib/components/CheckboxGroup/CheckboxGroup.js +1 -1
  158. package/lib/components/ComboBox/ComboBox.d.ts +3 -11
  159. package/lib/components/ComboBox/ComboBox.js +15 -25
  160. package/lib/components/ComboButton/index.d.ts +5 -8
  161. package/lib/components/ComboButton/index.js +9 -12
  162. package/lib/components/ComposedModal/ComposedModal.js +18 -24
  163. package/lib/components/DataTable/DataTable.d.ts +25 -16
  164. package/lib/components/DataTable/DataTable.js +33 -34
  165. package/lib/components/DataTable/Table.js +2 -2
  166. package/lib/components/DataTable/TableBatchActions.d.ts +49 -10
  167. package/lib/components/DataTable/TableBatchActions.js +26 -21
  168. package/lib/components/DataTable/TableExpandHeader.js +2 -2
  169. package/lib/components/DataTable/TableExpandRow.js +1 -1
  170. package/lib/components/DataTable/TableHeader.d.ts +8 -10
  171. package/lib/components/DataTable/TableHeader.js +11 -13
  172. package/lib/components/DataTable/TableRow.js +5 -5
  173. package/lib/components/DataTable/TableSlugRow.js +1 -1
  174. package/lib/components/DataTable/TableToolbarMenu.js +1 -1
  175. package/lib/components/DataTable/TableToolbarSearch.d.ts +8 -7
  176. package/lib/components/DataTable/TableToolbarSearch.js +11 -11
  177. package/lib/components/DataTable/index.d.ts +2 -2
  178. package/lib/components/DataTable/state/sorting.d.ts +2 -2
  179. package/lib/components/DataTable/state/sorting.js +1 -1
  180. package/lib/components/DataTable/tools/sorting.js +1 -1
  181. package/lib/components/DatePicker/DatePicker.js +9 -9
  182. package/lib/components/DatePickerInput/DatePickerInput.js +5 -5
  183. package/lib/components/Dialog/Dialog.js +6 -6
  184. package/lib/components/Dropdown/Dropdown.d.ts +1 -1
  185. package/lib/components/Dropdown/Dropdown.js +8 -8
  186. package/lib/components/ErrorBoundary/ErrorBoundaryContext.js +1 -1
  187. package/lib/components/FileUploader/FileUploader.js +4 -4
  188. package/lib/components/FileUploader/FileUploaderButton.js +1 -1
  189. package/lib/components/FileUploader/FileUploaderDropContainer.js +1 -1
  190. package/lib/components/FileUploader/FileUploaderItem.js +2 -2
  191. package/lib/components/FluidComboBox/FluidComboBox.d.ts +4 -7
  192. package/lib/components/FluidComboBox/FluidComboBox.js +1 -1
  193. package/lib/components/FluidDropdown/FluidDropdown.d.ts +4 -8
  194. package/lib/components/FluidDropdown/FluidDropdown.js +1 -1
  195. package/lib/components/FluidMultiSelect/FluidFilterableMultiSelect.d.ts +3 -7
  196. package/lib/components/FluidMultiSelect/FluidMultiSelect.d.ts +3 -7
  197. package/lib/components/FluidMultiSelect/FluidMultiSelect.js +3 -3
  198. package/lib/components/FluidNumberInput/FluidNumberInput.d.ts +4 -7
  199. package/lib/components/FluidNumberInput/FluidNumberInput.js +2 -2
  200. package/lib/components/FluidSearch/FluidSearch.js +1 -1
  201. package/lib/components/FluidSelect/FluidSelect.js +1 -1
  202. package/lib/components/FluidTextInput/FluidTextInput.js +1 -1
  203. package/lib/components/FluidTimePicker/FluidTimePicker.js +3 -3
  204. package/lib/components/FluidTimePickerSelect/FluidTimePickerSelect.js +1 -1
  205. package/lib/components/Grid/CSSGrid.js +3 -3
  206. package/lib/components/Grid/Column.js +2 -2
  207. package/lib/components/Grid/ColumnHang.js +1 -1
  208. package/lib/components/Grid/FlexGrid.js +1 -1
  209. package/lib/components/Grid/Row.js +1 -1
  210. package/lib/components/Heading/index.js +2 -2
  211. package/lib/components/IconButton/index.js +2 -2
  212. package/lib/components/IconIndicator/index.js +2 -2
  213. package/lib/components/InlineCheckbox/InlineCheckbox.js +1 -1
  214. package/lib/components/Layout/index.js +2 -2
  215. package/lib/components/LayoutDirection/LayoutDirection.js +1 -1
  216. package/lib/components/Link/Link.js +2 -2
  217. package/lib/components/ListBox/ListBoxField.d.ts +0 -1
  218. package/lib/components/ListBox/ListBoxMenuIcon.d.ts +8 -4
  219. package/lib/components/ListBox/ListBoxMenuIcon.js +10 -6
  220. package/lib/components/ListBox/ListBoxMenuItem.js +2 -2
  221. package/lib/components/ListBox/ListBoxSelection.d.ts +3 -6
  222. package/lib/components/ListBox/ListBoxSelection.js +4 -10
  223. package/lib/components/ListBox/index.d.ts +5 -3
  224. package/lib/components/ListBox/next/ListBoxSelection.d.ts +6 -13
  225. package/lib/components/ListBox/next/ListBoxSelection.js +16 -8
  226. package/lib/components/ListBox/next/ListBoxTrigger.d.ts +5 -10
  227. package/lib/components/ListBox/next/ListBoxTrigger.js +5 -6
  228. package/lib/components/Menu/MenuContext.js +1 -1
  229. package/lib/components/Menu/MenuItem.js +1 -1
  230. package/lib/components/MenuButton/index.js +5 -5
  231. package/lib/components/Modal/Modal.js +16 -22
  232. package/lib/components/ModalWrapper/ModalWrapper.js +2 -2
  233. package/lib/components/MultiSelect/FilterableMultiSelect.d.ts +3 -12
  234. package/lib/components/MultiSelect/FilterableMultiSelect.js +18 -27
  235. package/lib/components/MultiSelect/MultiSelect.d.ts +2 -2
  236. package/lib/components/MultiSelect/MultiSelect.js +12 -12
  237. package/lib/components/Notification/Notification.js +1 -1
  238. package/lib/components/NumberInput/NumberInput.d.ts +2 -5
  239. package/lib/components/NumberInput/NumberInput.js +12 -18
  240. package/lib/components/OverflowMenu/OverflowMenu.d.ts +2 -2
  241. package/lib/components/OverflowMenu/OverflowMenu.js +4 -4
  242. package/lib/components/OverflowMenu/next/index.d.ts +1 -1
  243. package/lib/components/OverflowMenu/next/index.js +2 -2
  244. package/lib/components/OverflowMenuItem/OverflowMenuItem.js +2 -2
  245. package/lib/components/PageHeader/PageHeader.js +12 -12
  246. package/lib/components/Pagination/Pagination.js +3 -3
  247. package/lib/components/PaginationNav/PaginationNav.d.ts +6 -9
  248. package/lib/components/PaginationNav/PaginationNav.js +21 -22
  249. package/lib/components/Popover/index.js +8 -8
  250. package/lib/components/ProgressBar/ProgressBar.js +2 -2
  251. package/lib/components/ProgressIndicator/ProgressIndicator.d.ts +11 -15
  252. package/lib/components/ProgressIndicator/ProgressIndicator.js +15 -15
  253. package/lib/components/RadioButton/RadioButton.js +1 -1
  254. package/lib/components/RadioButtonGroup/RadioButtonGroup.js +1 -1
  255. package/lib/components/RadioTile/RadioTile.js +1 -1
  256. package/lib/components/Select/Select.js +7 -5
  257. package/lib/components/ShapeIndicator/index.js +2 -2
  258. package/lib/components/Slider/Slider.d.ts +7 -9
  259. package/lib/components/Slider/Slider.js +16 -20
  260. package/lib/components/Stack/HStack.js +1 -1
  261. package/lib/components/Stack/Stack.js +1 -1
  262. package/lib/components/Stack/VStack.js +1 -1
  263. package/lib/components/StructuredList/StructuredList.js +3 -3
  264. package/lib/components/Tabs/Tabs.js +12 -12
  265. package/lib/components/Tag/DismissibleTag.js +3 -3
  266. package/lib/components/Tag/OperationalTag.js +2 -2
  267. package/lib/components/Tag/SelectableTag.js +2 -2
  268. package/lib/components/Tag/Tag.js +4 -4
  269. package/lib/components/Tag/isEllipsisActive.js +1 -1
  270. package/lib/components/Text/Text.js +1 -1
  271. package/lib/components/TextArea/TextArea.js +1 -1
  272. package/lib/components/TextInput/PasswordInput.js +4 -4
  273. package/lib/components/TextInput/TextInput.js +3 -3
  274. package/lib/components/Theme/index.js +3 -3
  275. package/lib/components/Tile/Tile.js +3 -3
  276. package/lib/components/TimePicker/TimePicker.js +1 -1
  277. package/lib/components/Toggletip/index.js +4 -4
  278. package/lib/components/Tooltip/DefinitionTooltip.js +1 -1
  279. package/lib/components/Tooltip/Tooltip.js +3 -3
  280. package/lib/components/TreeView/TreeNode.js +6 -6
  281. package/lib/components/TreeView/TreeView.js +5 -5
  282. package/lib/components/UIShell/HeaderContainer.js +1 -1
  283. package/lib/components/UIShell/HeaderMenu.js +1 -1
  284. package/lib/components/UIShell/Link.js +2 -2
  285. package/lib/components/UIShell/SideNavItems.js +1 -1
  286. package/lib/components/UIShell/Switcher.js +1 -1
  287. package/lib/components/UIShell/SwitcherItem.js +1 -1
  288. package/lib/index.d.ts +1 -1
  289. package/lib/internal/FloatingMenu.js +4 -4
  290. package/lib/internal/Selection.js +6 -6
  291. package/lib/internal/useMergedRefs.js +1 -1
  292. package/lib/internal/useNoInteractiveChildren.js +4 -4
  293. package/lib/internal/useOutsideClick.js +1 -1
  294. package/lib/internal/useOverflowItems.js +6 -6
  295. package/lib/internal/useResizeObserver.js +3 -3
  296. package/lib/internal/useSavedCallback.js +1 -1
  297. package/lib/internal/warning.js +1 -1
  298. package/lib/prop-types/isRequiredOneOf.js +2 -2
  299. package/lib/tools/events.js +1 -1
  300. package/lib/tools/wrapComponent.js +1 -1
  301. package/lib/types/common.d.ts +6 -2
  302. package/package.json +9 -9
package/es/index.d.ts CHANGED
@@ -245,7 +245,7 @@ export type { ListBoxFieldProps } from './components/ListBox/ListBoxField';
245
245
  export type { ListBoxMenuProps } from './components/ListBox/ListBoxMenu';
246
246
  export type { ListBoxMenuItemProps } from './components/ListBox/ListBoxMenuItem';
247
247
  export type { ListBoxMenuIconProps } from './components/ListBox/ListBoxMenuIcon';
248
- export type { ListBoxMenuIconTranslationKey } from './components/ListBox/ListBoxMenuIcon';
248
+ export type { ListBoxMenuIconTranslationKey, ListBoxSelectionTranslationKey, } from './components/ListBox';
249
249
  export type { ListBoxMenuIconComponent } from './components/ListBox/ListBoxMenuIcon';
250
250
  export type { ListBoxSelectionProps } from './components/ListBox/ListBoxSelection';
251
251
  export type { ListItemProps } from './components/ListItem/ListItem';
@@ -198,7 +198,7 @@ const FloatingMenu = ({
198
198
  }
199
199
  placeInProgressRef.current = false;
200
200
  }
201
- // eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/20071
201
+ // eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/20452
202
202
  }, [floatingPosition, onPlace]);
203
203
 
204
204
  // Attach a resize listener.
@@ -209,13 +209,13 @@ const FloatingMenu = ({
209
209
  return () => {
210
210
  resizeHandler.remove();
211
211
  };
212
- // eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/20071
212
+ // eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/20452
213
213
  }, [triggerRef, menuOffset, menuDirection, flipped, target, updateOrientation]);
214
214
 
215
215
  // Update menu position when key props change.
216
216
  useEffect(() => {
217
217
  updateMenuPosition();
218
- // eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/20071
218
+ // eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/20452
219
219
  }, [menuOffset, menuDirection, flipped, triggerRef, target, updateOrientation]);
220
220
 
221
221
  /**
@@ -279,7 +279,7 @@ const FloatingMenu = ({
279
279
  const portalTarget = target ? target() : document.body;
280
280
  return /*#__PURE__*/ReactDOM.createPortal(
281
281
  /*#__PURE__*/
282
- // eslint-disable-next-line jsx-a11y/no-static-element-interactions -- https://github.com/carbon-design-system/carbon/issues/20071
282
+ // eslint-disable-next-line jsx-a11y/no-static-element-interactions -- https://github.com/carbon-design-system/carbon/issues/20452
283
283
  React.createElement("div", {
284
284
  onBlur: focusTrap && !focusTrapWithoutSentinels ? handleBlur : undefined,
285
285
  onKeyDown: focusTrapWithoutSentinels ? handleKeyDown : undefined
@@ -42,7 +42,7 @@ const useSelection = ({
42
42
  const savedOnChange = useRef(onChange);
43
43
  const [uncontrolledItems, setUncontrolledItems] = useState(initialSelectedItems);
44
44
  const isControlled = !!controlledItems;
45
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- https://github.com/carbon-design-system/carbon/issues/20071
45
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- https://github.com/carbon-design-system/carbon/issues/20452
46
46
  const selectedItems = isControlled ? controlledItems : uncontrolledItems;
47
47
  const onItemChange = useCallback(item => {
48
48
  if (disabled) return;
@@ -50,20 +50,20 @@ const useSelection = ({
50
50
  // Assert special properties (e.g., `disabled`, `isSelectAll`, etc.) are
51
51
  // `any` since those properties aren’t part of the generic type.
52
52
  const allSelectableItems = filteredItems.filter(
53
- // eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20071
53
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20452
54
54
  item => !item?.disabled && !item?.isSelectAll);
55
55
  const disabledItemCount = filteredItems.filter(
56
- // eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20071
56
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20452
57
57
  item => item?.disabled).length;
58
58
  let newSelectedItems;
59
59
 
60
60
  // deselect all on click to All/indeterminate option
61
- // eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20071
61
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20452
62
62
  if (item?.isSelectAll && selectedItems.length > 0) {
63
63
  newSelectedItems = [];
64
64
  }
65
65
  // select all options
66
- // eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20071
66
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20452
67
67
  else if (item?.isSelectAll && selectedItems.length === 0) {
68
68
  newSelectedItems = allSelectableItems;
69
69
  } else {
@@ -77,7 +77,7 @@ const useSelection = ({
77
77
  } else {
78
78
  newSelectedItems = removeAtIndex(selectedItems, selectedIndex);
79
79
  newSelectedItems = newSelectedItems.filter(
80
- // eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20071
80
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20452
81
81
  item => !item?.isSelectAll);
82
82
  }
83
83
  }
@@ -16,7 +16,7 @@ import { useMemo, useCallback } from 'react';
16
16
  * node, assigns that node to every ref in the array.
17
17
  */
18
18
  const useMergedRefs = refs => {
19
- // eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/20071
19
+ // eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/20452
20
20
  const memoizedRefs = useMemo(() => refs, refs);
21
21
  return useCallback(node => {
22
22
  memoizedRefs.forEach(ref => {
@@ -14,16 +14,16 @@ const useNoInteractiveChildren = (ref, message = 'component should have no inter
14
14
  /*
15
15
  // eslint-disable-next-line react-hooks/rules-of-hooks
16
16
  */
17
- // eslint-disable-next-line react-hooks/rules-of-hooks -- https://github.com/carbon-design-system/carbon/issues/20071
17
+ // eslint-disable-next-line react-hooks/rules-of-hooks -- https://github.com/carbon-design-system/carbon/issues/20452
18
18
  useEffect(() => {
19
19
  const node = ref.current ? getInteractiveContent(ref.current) : false;
20
20
  if (node) {
21
21
  const errorMessage = `Error: ${message}.\n\nInstead found: ${node.outerHTML}`;
22
- // eslint-disable-next-line no-console -- https://github.com/carbon-design-system/carbon/issues/20071
22
+ // eslint-disable-next-line no-console -- https://github.com/carbon-design-system/carbon/issues/20452
23
23
  console.error(errorMessage);
24
24
  throw new Error(errorMessage);
25
25
  }
26
- // eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/20071
26
+ // eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/20452
27
27
  }, []);
28
28
  }
29
29
  };
@@ -34,7 +34,7 @@ const useInteractiveChildrenNeedDescription = (ref, message = `interactive child
34
34
  /*
35
35
  // eslint-disable-next-line react-hooks/rules-of-hooks
36
36
  */
37
- // eslint-disable-next-line react-hooks/rules-of-hooks -- https://github.com/carbon-design-system/carbon/issues/20071
37
+ // eslint-disable-next-line react-hooks/rules-of-hooks -- https://github.com/carbon-design-system/carbon/issues/20452
38
38
  useEffect(() => {
39
39
  const node = ref.current ? getInteractiveContent(ref.current) : false;
40
40
  if (node && !node.hasAttribute('aria-describedby')) {
@@ -23,7 +23,7 @@ const useOutsideClick = (ref, callback) => {
23
23
  /*
24
24
  // eslint-disable-next-line react-hooks/rules-of-hooks
25
25
  */
26
- // eslint-disable-next-line react-hooks/rules-of-hooks -- https://github.com/carbon-design-system/carbon/issues/20071
26
+ // eslint-disable-next-line react-hooks/rules-of-hooks -- https://github.com/carbon-design-system/carbon/issues/20452
27
27
  useWindowEvent('click', event => {
28
28
  const {
29
29
  target
@@ -36,7 +36,7 @@ const useOverflowItems = (items, containerRef, offsetRef, maxItems, onChange) =>
36
36
  setMaxWidth(newMax);
37
37
  }
38
38
  };
39
- // eslint-disable-next-line react-hooks/rules-of-hooks -- https://github.com/carbon-design-system/carbon/issues/20071
39
+ // eslint-disable-next-line react-hooks/rules-of-hooks -- https://github.com/carbon-design-system/carbon/issues/20452
40
40
  useResizeObserver({
41
41
  ref: containerRef,
42
42
  onResize: handleResize
@@ -86,17 +86,17 @@ const useOverflowItems = (items, containerRef, offsetRef, maxItems, onChange) =>
86
86
  };
87
87
 
88
88
  // Memoize visible items calculation to avoid recalculating on every render
89
- // eslint-disable-next-line react-hooks/rules-of-hooks -- https://github.com/carbon-design-system/carbon/issues/20071
89
+ // eslint-disable-next-line react-hooks/rules-of-hooks -- https://github.com/carbon-design-system/carbon/issues/20452
90
90
  const visibleItems = useMemo(() => {
91
91
  if (!Array.isArray(items)) {
92
92
  return [];
93
93
  }
94
94
  return getVisibleItems();
95
- // eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/20071
95
+ // eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/20452
96
96
  }, [items, maxWidth, maxItems]);
97
97
 
98
98
  // Memoize hidden items calculation
99
- // eslint-disable-next-line react-hooks/rules-of-hooks -- https://github.com/carbon-design-system/carbon/issues/20071
99
+ // eslint-disable-next-line react-hooks/rules-of-hooks -- https://github.com/carbon-design-system/carbon/issues/20452
100
100
  const hiddenItems = useMemo(() => {
101
101
  if (!Array.isArray(items)) {
102
102
  return [];
@@ -105,11 +105,11 @@ const useOverflowItems = (items, containerRef, offsetRef, maxItems, onChange) =>
105
105
  }, [items, visibleItems]);
106
106
 
107
107
  // Use previous value to compare and only call onChange when needed
108
- // eslint-disable-next-line react-hooks/rules-of-hooks -- https://github.com/carbon-design-system/carbon/issues/20071
108
+ // eslint-disable-next-line react-hooks/rules-of-hooks -- https://github.com/carbon-design-system/carbon/issues/20452
109
109
  const previousHiddenItems = usePreviousValue(hiddenItems);
110
110
 
111
111
  // Only call onChange if hidden items actually changed
112
- // eslint-disable-next-line react-hooks/rules-of-hooks -- https://github.com/carbon-design-system/carbon/issues/20071
112
+ // eslint-disable-next-line react-hooks/rules-of-hooks -- https://github.com/carbon-design-system/carbon/issues/20452
113
113
  useEffect(() => {
114
114
  }, [hiddenItems, previousHiddenItems, onChange]);
115
115
  return {
@@ -35,7 +35,7 @@ const useResizeObserver = ({
35
35
  return;
36
36
  }
37
37
  getInitialSize();
38
- // eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/20071
38
+ // eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/20452
39
39
  }, [width, height]);
40
40
  useLayoutEffect(() => {
41
41
  if (!ref?.current) {
@@ -49,7 +49,7 @@ const useResizeObserver = ({
49
49
  setWidth(entry.contentRect.width);
50
50
  setHeight(entry.contentRect.height);
51
51
 
52
- // eslint-disable-next-line @typescript-eslint/no-unused-expressions -- https://github.com/carbon-design-system/carbon/issues/20071
52
+ // eslint-disable-next-line @typescript-eslint/no-unused-expressions -- https://github.com/carbon-design-system/carbon/issues/20452
53
53
  cb.current && cb.current(entry.contentRect);
54
54
  };
55
55
  const observer = new ResizeObserver(entries => {
@@ -66,7 +66,7 @@ const useResizeObserver = ({
66
66
  return () => {
67
67
  observer.disconnect();
68
68
  };
69
- // eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/20071
69
+ // eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/20452
70
70
  }, []);
71
71
  return {
72
72
  width,
@@ -15,7 +15,7 @@ import { useRef, useEffect, useCallback } from 'react';
15
15
  *
16
16
  * @param callback - The callback to track.
17
17
  */
18
- // eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20071
18
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20452
19
19
  const useSavedCallback = callback => {
20
20
  const savedCallback = useRef(callback);
21
21
  useEffect(() => {
@@ -22,7 +22,7 @@ const warning = process.env.NODE_ENV !== 'production' ? (condition, message) =>
22
22
  throw new Error('`warning(condition, message)` requires a warning ' + 'format argument');
23
23
  }
24
24
  if (!condition) {
25
- // eslint-disable-next-line no-console -- https://github.com/carbon-design-system/carbon/issues/20071
25
+ // eslint-disable-next-line no-console -- https://github.com/carbon-design-system/carbon/issues/20452
26
26
  console.warn('Warning: ' + message);
27
27
  }
28
28
  } : noopFn;
@@ -13,11 +13,11 @@
13
13
  * are the names of the props, and the values are the prop-type validators.
14
14
  * @returns A new object of wrapped prop-type validators.
15
15
  */
16
- // eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20071
16
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20452
17
17
  const isRequiredOneOf = propTypes => {
18
18
  const names = Object.keys(propTypes);
19
19
  const checker = propType =>
20
- // eslint-disable-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20071
20
+ // eslint-disable-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20452
21
21
  (props, propName, componentName, ...rest) => {
22
22
  if (process.env.NODE_ENV !== 'production' && names.every(name => typeof props[name] === 'undefined')) {
23
23
  return new Error(`${componentName} requires one of the following props: ${names.join(', ')}`);
@@ -15,7 +15,7 @@
15
15
  * @returns A composite event handler.
16
16
  */
17
17
  const composeEventHandlers = handlers =>
18
- // eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20071
18
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20452
19
19
  (event, ...args) => {
20
20
  for (const handler of handlers) {
21
21
  if (event.defaultPrevented) {
@@ -42,7 +42,7 @@ const wrapComponent = ({
42
42
  Component.propTypes = {
43
43
  className: PropTypes.string
44
44
  };
45
- // eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20071
45
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20452
46
46
  return Component;
47
47
  };
48
48
 
@@ -13,8 +13,12 @@ export type PolymorphicProps<Element extends React.ElementType, Props> = Props &
13
13
  };
14
14
  export interface TranslateWithId<MID = string, ARGS = Record<string, unknown>> {
15
15
  /**
16
- * Supply a method to translate internal strings with your i18n tool of
17
- * choice.
16
+ * Translates component strings using your i18n tool.
17
+ *
18
+ * @param messageId - The translation ID for the string to translate.
19
+ * @param [args] - Arguments for string interpolation.
20
+ * @returns The translated string.
18
21
  */
19
22
  translateWithId?(messageId: MID, args?: ARGS): string;
20
23
  }
24
+ export type TFunc<K, A = Record<string, unknown>> = NonNullable<TranslateWithId<K, A>['translateWithId']>;
@@ -22,18 +22,18 @@ var _Undo;
22
22
  const AILabelContent = /*#__PURE__*/React.forwardRef(function AILabelContent({
23
23
  className,
24
24
  children
25
- }, ref // eslint-disable-line @typescript-eslint/no-unused-vars -- https://github.com/carbon-design-system/carbon/issues/20071
25
+ }, ref // eslint-disable-line @typescript-eslint/no-unused-vars -- https://github.com/carbon-design-system/carbon/issues/20452
26
26
  ) {
27
27
  const prefix = usePrefix.usePrefix();
28
28
  const hasAILabelActions = React.Children.toArray(children).some(child => {
29
- // eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20071
29
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20452
30
30
  const item = child;
31
31
  // TODO: Is there supposed to be a `return` here? If so, this issue would
32
32
  // have been caught by ESLint. It's concerning that this code is 7 months
33
33
  // old and no one has noticed any issues with it. It also makes me question
34
34
  // whether the code is necessary.
35
35
  // https://github.com/carbon-design-system/carbon/issues/18991
36
- // eslint-disable-next-line @typescript-eslint/no-unused-expressions -- https://github.com/carbon-design-system/carbon/issues/20071
36
+ // eslint-disable-next-line @typescript-eslint/no-unused-expressions -- https://github.com/carbon-design-system/carbon/issues/20452
37
37
  item.type === AILabelActions;
38
38
  });
39
39
  const aiLabelContentClasses = cx(className, {
@@ -58,7 +58,7 @@ AILabelContent.propTypes = {
58
58
  const AILabelActions = /*#__PURE__*/React.forwardRef(function AILabelActions({
59
59
  className,
60
60
  children
61
- }, ref // eslint-disable-line @typescript-eslint/no-unused-vars -- https://github.com/carbon-design-system/carbon/issues/20071
61
+ }, ref // eslint-disable-line @typescript-eslint/no-unused-vars -- https://github.com/carbon-design-system/carbon/issues/20452
62
62
  ) {
63
63
  const prefix = usePrefix.usePrefix();
64
64
  const aiLabelActionsClasses = cx(className, {
@@ -38,7 +38,7 @@ const BreadcrumbItem = frFn((props, ref) => {
38
38
  [customClassName]: !!customClassName
39
39
  });
40
40
 
41
- // eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20071
41
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20452
42
42
  const child = children;
43
43
  if (child.type && child.type.displayName !== undefined && child.type.displayName.includes('OverflowMenu')) {
44
44
  const horizontalOverflowIcon = /*#__PURE__*/React.createElement(iconsReact.OverflowMenuHorizontal, {
@@ -26,7 +26,7 @@ function isIconOnlyButton(hasIconOnly, _kind) {
26
26
  return false;
27
27
  }
28
28
 
29
- // eslint-disable-next-line react/display-name -- https://github.com/carbon-design-system/carbon/issues/20071
29
+ // eslint-disable-next-line react/display-name -- https://github.com/carbon-design-system/carbon/issues/20452
30
30
  const Button = /*#__PURE__*/React.forwardRef((props, ref) => {
31
31
  const {
32
32
  as,
@@ -49,7 +49,7 @@ const Button = /*#__PURE__*/React.forwardRef((props, ref) => {
49
49
  ...rest
50
50
  } = props;
51
51
  if (ButtonImageElement && !children && !iconDescription) {
52
- // eslint-disable-next-line no-console -- https://github.com/carbon-design-system/carbon/issues/20071
52
+ // eslint-disable-next-line no-console -- https://github.com/carbon-design-system/carbon/issues/20452
53
53
  console.error('Button: renderIcon property specified without also providing an iconDescription property. ' + 'This may impact accessibility for screen reader users.');
54
54
  }
55
55
  const iconOnlyImage = !ButtonImageElement ? null : /*#__PURE__*/React.createElement(ButtonImageElement, null);
@@ -42,7 +42,7 @@ const ChatButton = /*#__PURE__*/React.forwardRef(function ChatButton({
42
42
  } else {
43
43
  // Check if size is valid and warn if not
44
44
  if (size && !allowedSizes.includes(size)) {
45
- // eslint-disable-next-line no-console -- https://github.com/carbon-design-system/carbon/issues/20071
45
+ // eslint-disable-next-line no-console -- https://github.com/carbon-design-system/carbon/issues/20452
46
46
  console.error(`Invalid size "${size}" provided to ChatButton. Size must be one of: ${allowedSizes.join(', ')}. Defaulting to "lg".`);
47
47
  size = 'lg';
48
48
  }
@@ -65,7 +65,7 @@ const Checkbox = /*#__PURE__*/React.forwardRef(({
65
65
  const candidateIsAILabel = utils.isComponentElement(candidate, index.AILabel);
66
66
  const normalizedDecorator = candidateIsAILabel ? /*#__PURE__*/React.cloneElement(candidate, {
67
67
  size: candidate.props.kind === 'inline' ? 'md' : 'mini'
68
- }) : null;
68
+ }) : candidate;
69
69
  return /*#__PURE__*/React.createElement("div", {
70
70
  className: wrapperClasses
71
71
  }, /*#__PURE__*/React.createElement("input", _rollupPluginBabelHelpers.extends({}, other, {
@@ -62,7 +62,7 @@ const CheckboxGroup = ({
62
62
  const normalizedDecorator = candidateIsAILabel ? /*#__PURE__*/React.cloneElement(candidate, {
63
63
  size: 'mini',
64
64
  kind: 'default'
65
- }) : null;
65
+ }) : candidate;
66
66
  const clonedChildren = React.Children.map(children, child => {
67
67
  if (/*#__PURE__*/React.isValidElement(child) && child.type === Checkbox.default) {
68
68
  const childProps = {
@@ -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
@@ -97,15 +97,6 @@ const findHighlightedIndex = ({
97
97
  }
98
98
  return -1;
99
99
  };
100
-
101
- /**
102
- * Message ids that will be passed to translateWithId().
103
- * Combination of message ids from ListBox/next/ListBoxSelection.js and
104
- * ListBox/next/ListBoxTrigger.js, but we can't access those values directly
105
- * because those components aren't Typescript. (If you try, TranslationKey
106
- * ends up just being defined as "string".)
107
- */
108
-
109
100
  const ComboBox = /*#__PURE__*/React.forwardRef((props, ref) => {
110
101
  const prevInputLengthRef = React.useRef(0);
111
102
  const inputRef = React.useRef(null);
@@ -173,7 +164,7 @@ const ComboBox = /*#__PURE__*/React.forwardRef((props, ref) => {
173
164
  refs.floating.current.style.width = parentWidth + 'px';
174
165
  }
175
166
  }
176
- // eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/20071
167
+ // eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/20452
177
168
  }, [enableFloatingStyles, floatingStyles, refs.floating, parentWidth]);
178
169
  const [inputValue, setInputValue] = React.useState(getInputValue({
179
170
  initialSelectedItem,
@@ -203,7 +194,7 @@ const ComboBox = /*#__PURE__*/React.forwardRef((props, ref) => {
203
194
  }
204
195
  prevInputLengthRef.current = inputValue.length;
205
196
  }
206
- // eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/20071
197
+ // eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/20452
207
198
  }, [typeahead, inputValue, items, itemToString, autocompleteCustomFilter]);
208
199
  const isManualClearingRef = React.useRef(false);
209
200
  const [isClearing, setIsClearing] = React.useState(false);
@@ -244,7 +235,7 @@ const ComboBox = /*#__PURE__*/React.forwardRef((props, ref) => {
244
235
  }
245
236
  prevSelectedItemProp.current = selectedItemProp;
246
237
  }
247
- // eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/20071
238
+ // eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/20452
248
239
  }, [selectedItemProp]);
249
240
  const filterItems = (items, itemToString, inputValue) => items.filter(item => typeahead ? autocompleteCustomFilter({
250
241
  item: itemToString(item),
@@ -259,10 +250,10 @@ const ComboBox = /*#__PURE__*/React.forwardRef((props, ref) => {
259
250
  React.useEffect(() => {
260
251
  if (prevInputValue.current !== inputValue) {
261
252
  prevInputValue.current = inputValue;
262
- // eslint-disable-next-line @typescript-eslint/no-unused-expressions -- https://github.com/carbon-design-system/carbon/issues/20071
253
+ // eslint-disable-next-line @typescript-eslint/no-unused-expressions -- https://github.com/carbon-design-system/carbon/issues/20452
263
254
  onInputChange && onInputChange(inputValue);
264
255
  }
265
- // eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/20071
256
+ // eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/20452
266
257
  }, [inputValue]);
267
258
  const handleSelectionClear = () => {
268
259
  if (textInput?.current) {
@@ -331,7 +322,7 @@ const ComboBox = /*#__PURE__*/React.forwardRef((props, ref) => {
331
322
  const filteredList = filterItems(items, itemToString, inputValue);
332
323
  const highlightedItem = filteredList[state.highlightedIndex];
333
324
 
334
- // eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20071
325
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20452
335
326
  if (highlightedItem && !highlightedItem.disabled) {
336
327
  return {
337
328
  ...changes,
@@ -344,7 +335,7 @@ const ComboBox = /*#__PURE__*/React.forwardRef((props, ref) => {
344
335
  if (autoIndex !== -1) {
345
336
  const matchingItem = items[autoIndex];
346
337
 
347
- // eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20071
338
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20452
348
339
  if (matchingItem && !matchingItem.disabled) {
349
340
  return {
350
341
  ...changes,
@@ -462,7 +453,7 @@ const ComboBox = /*#__PURE__*/React.forwardRef((props, ref) => {
462
453
  const candidateIsAILabel = utils.isComponentElement(candidate, index$1.AILabel);
463
454
  const normalizedDecorator = candidateIsAILabel ? /*#__PURE__*/React.cloneElement(candidate, {
464
455
  size: 'mini'
465
- }) : null;
456
+ }) : candidate;
466
457
  const {
467
458
  // Prop getters
468
459
  getInputProps,
@@ -498,10 +489,10 @@ const ComboBox = /*#__PURE__*/React.forwardRef((props, ref) => {
498
489
  onHighlightedIndexChange: ({
499
490
  highlightedIndex
500
491
  }) => {
501
- // 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
492
+ // 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
502
493
  if (highlightedIndex > -1 && typeof window !== undefined) {
503
494
  const itemArray = document.querySelectorAll(`li.${prefix}--list-box__menu-item[role="option"]`);
504
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- https://github.com/carbon-design-system/carbon/issues/20071
495
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- https://github.com/carbon-design-system/carbon/issues/20452
505
496
  const highlightedItem = itemArray[highlightedIndex];
506
497
  if (highlightedItem) {
507
498
  highlightedItem.scrollIntoView({
@@ -514,9 +505,9 @@ const ComboBox = /*#__PURE__*/React.forwardRef((props, ref) => {
514
505
  initialSelectedItem: initialSelectedItem,
515
506
  inputId: id,
516
507
  stateReducer,
517
- // eslint-disable-next-line @typescript-eslint/no-unused-vars -- https://github.com/carbon-design-system/carbon/issues/20071
508
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars -- https://github.com/carbon-design-system/carbon/issues/20452
518
509
  isItemDisabled(item, _index) {
519
- // eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20071
510
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20452
520
511
  return item?.disabled;
521
512
  },
522
513
  ...downshiftProps,
@@ -553,7 +544,7 @@ const ComboBox = /*#__PURE__*/React.forwardRef((props, ref) => {
553
544
  toggleMenu
554
545
  };
555
546
  }
556
- // eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/20071
547
+ // eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/20452
557
548
  }, [closeMenu, openMenu, reset, selectItem, setHighlightedIndex, downshiftSetInputValue, toggleMenu]);
558
549
  const buttonProps = getToggleButtonProps({
559
550
  disabled: disabled || readOnly,
@@ -603,7 +594,7 @@ const ComboBox = /*#__PURE__*/React.forwardRef((props, ref) => {
603
594
  const menuProps = React.useMemo(() => getMenuProps({
604
595
  ref: enableFloatingStyles ? refs.setFloating : null
605
596
  }),
606
- // eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/20071
597
+ // eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/20452
607
598
  [enableFloatingStyles, deprecatedAriaLabel, ariaLabel, getMenuProps, refs.setFloating]);
608
599
  React.useEffect(() => {
609
600
  if (textInput.current) {
@@ -937,8 +928,7 @@ ComboBox.propTypes = {
937
928
  */
938
929
  titleText: PropTypes.node,
939
930
  /**
940
- * Specify a custom translation function that takes in a message identifier
941
- * and returns the localized string for the message
931
+ * Translates component strings using your i18n tool.
942
932
  */
943
933
  translateWithId: PropTypes.func,
944
934
  /**
@@ -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
  */
@@ -27,17 +27,15 @@ var deprecateValuesWithin = require('../../prop-types/deprecateValuesWithin.js')
27
27
  var mapPopoverAlign = require('../../tools/mapPopoverAlign.js');
28
28
 
29
29
  var _ChevronDown;
30
+ const translationIds = {
31
+ 'carbon.combo-button.additional-actions': 'carbon.combo-button.additional-actions'
32
+ };
30
33
  const defaultTranslations = {
31
- 'carbon.combo-button.additional-actions': 'Additional actions'
34
+ [translationIds['carbon.combo-button.additional-actions']]: 'Additional actions'
32
35
  };
33
-
34
- /**
35
- * Message ids that will be passed to translateWithId().
36
- */
37
-
38
- function defaultTranslateWithId(messageId) {
36
+ const defaultTranslateWithId = messageId => {
39
37
  return defaultTranslations[messageId];
40
- }
38
+ };
41
39
  const ComboButton = /*#__PURE__*/React.forwardRef(function ComboButton({
42
40
  children,
43
41
  className,
@@ -56,7 +54,7 @@ const ComboButton = /*#__PURE__*/React.forwardRef(function ComboButton({
56
54
  const id = useId.useId('combobutton');
57
55
  const prefix = usePrefix.usePrefix();
58
56
  const containerRef = React.useRef(null);
59
- // eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20071
57
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20452
60
58
  let middlewares = [];
61
59
  if (!enableOnlyFloatingStyles) {
62
60
  middlewares = [react.flip({
@@ -188,7 +186,7 @@ ComboButton.propTypes = {
188
186
  /**
189
187
  * Specify the size of the buttons and menu.
190
188
  */
191
- size: PropTypes.oneOf(['sm', 'md', 'lg']),
189
+ size: PropTypes.oneOf(['xs', 'sm', 'md', 'lg']),
192
190
  /**
193
191
  * Specify how the trigger tooltip should be aligned.
194
192
  */
@@ -215,8 +213,7 @@ ComboButton.propTypes = {
215
213
  // new values to match floating-ui
216
214
  '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.mapPopoverAlign),
217
215
  /**
218
- * Optional method that takes in a message id and returns an
219
- * internationalized string.
216
+ * Translates component strings using your i18n tool.
220
217
  */
221
218
  translateWithId: PropTypes.func
222
219
  };