@carbon/react 1.90.0-rc.0 → 1.91.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 (320) hide show
  1. package/.playwright/INTERNAL_AVT_REPORT_DO_NOT_USE.json +923 -964
  2. package/es/components/AILabel/index.js +8 -6
  3. package/es/components/Breadcrumb/BreadcrumbItem.js +2 -0
  4. package/es/components/Button/Button.js +3 -0
  5. package/es/components/ChatButton/ChatButton.js +1 -0
  6. package/es/components/CheckboxGroup/CheckboxGroup.js +21 -2
  7. package/es/components/CodeSnippet/CodeSnippet.d.ts +1 -1
  8. package/es/components/CodeSnippet/CodeSnippet.js +1 -1
  9. package/es/components/ComboBox/ComboBox.js +18 -13
  10. package/es/components/ComboButton/index.js +2 -1
  11. package/es/components/ComposedModal/ComposedModal.js +5 -2
  12. package/es/components/Copy/Copy.d.ts +1 -1
  13. package/es/components/Copy/Copy.js +1 -1
  14. package/es/components/CopyButton/CopyButton.d.ts +1 -1
  15. package/es/components/CopyButton/CopyButton.js +1 -1
  16. package/es/components/DataTable/DataTable.d.ts +60 -15
  17. package/es/components/DataTable/DataTable.js +119 -178
  18. package/es/components/DataTable/Table.d.ts +2 -2
  19. package/es/components/DataTable/Table.js +4 -4
  20. package/es/components/DataTable/TableExpandHeader.d.ts +1 -1
  21. package/es/components/DataTable/TableExpandHeader.js +6 -2
  22. package/es/components/DataTable/TableExpandRow.js +1 -0
  23. package/es/components/DataTable/TableHeader.js +2 -0
  24. package/es/components/DataTable/TableRow.js +5 -0
  25. package/es/components/DataTable/TableSlugRow.js +1 -0
  26. package/es/components/DataTable/TableToolbarMenu.js +3 -0
  27. package/es/components/DataTable/state/sorting.d.ts +3 -1
  28. package/es/components/DataTable/state/sorting.js +2 -0
  29. package/es/components/DataTable/tools/sorting.js +1 -0
  30. package/es/components/DatePicker/DatePicker.d.ts +0 -12
  31. package/es/components/DatePicker/DatePicker.js +17 -6
  32. package/es/components/DatePicker/plugins/rangePlugin.d.ts +19 -2
  33. package/es/components/DatePicker/plugins/rangePlugin.js +18 -14
  34. package/es/components/DatePickerInput/DatePickerInput.js +6 -0
  35. package/es/components/Dialog/Dialog.js +10 -2
  36. package/es/components/Dropdown/Dropdown.js +17 -16
  37. package/es/components/ErrorBoundary/ErrorBoundaryContext.js +1 -0
  38. package/es/components/FeatureFlags/index.js +1 -0
  39. package/es/components/FileUploader/FileUploader.js +9 -2
  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 +3 -0
  43. package/es/components/FluidMultiSelect/FluidMultiSelect.js +2 -0
  44. package/es/components/FluidNumberInput/FluidNumberInput.js +3 -2
  45. package/es/components/FluidSearch/FluidSearch.js +3 -2
  46. package/es/components/FluidSelect/FluidSelect.js +3 -2
  47. package/es/components/FluidTextInput/FluidTextInput.js +3 -2
  48. package/es/components/FluidTimePicker/FluidTimePicker.js +11 -4
  49. package/es/components/FluidTimePickerSelect/FluidTimePickerSelect.js +3 -2
  50. package/es/components/Grid/CSSGrid.js +5 -0
  51. package/es/components/Grid/Column.js +3 -0
  52. package/es/components/Grid/ColumnHang.js +1 -0
  53. package/es/components/Grid/FlexGrid.js +1 -0
  54. package/es/components/Grid/Row.js +1 -0
  55. package/es/components/Heading/index.js +3 -1
  56. package/es/components/IconButton/index.js +5 -3
  57. package/es/components/IconIndicator/index.js +4 -2
  58. package/es/components/InlineCheckbox/InlineCheckbox.js +3 -2
  59. package/es/components/Layout/index.js +6 -4
  60. package/es/components/LayoutDirection/LayoutDirection.js +2 -0
  61. package/es/components/Link/Link.js +3 -0
  62. package/es/components/ListBox/ListBoxMenuItem.js +4 -1
  63. package/es/components/ListBox/next/ListBoxTrigger.js +3 -2
  64. package/es/components/Menu/Menu.js +6 -9
  65. package/es/components/Menu/MenuContext.js +1 -0
  66. package/es/components/Menu/MenuItem.d.ts +1 -1
  67. package/es/components/Menu/MenuItem.js +10 -18
  68. package/es/components/MenuButton/index.js +7 -2
  69. package/es/components/Modal/Modal.js +4 -1
  70. package/es/components/ModalWrapper/ModalWrapper.js +2 -0
  71. package/es/components/MultiSelect/FilterableMultiSelect.js +25 -6
  72. package/es/components/MultiSelect/MultiSelect.js +22 -17
  73. package/es/components/Notification/Notification.d.ts +6 -6
  74. package/es/components/Notification/Notification.js +7 -7
  75. package/es/components/NumberInput/NumberInput.js +7 -1
  76. package/es/components/OverflowMenu/OverflowMenu.js +3 -1
  77. package/es/components/OverflowMenu/next/index.js +4 -3
  78. package/es/components/OverflowMenuItem/OverflowMenuItem.js +2 -0
  79. package/es/components/PageHeader/PageHeader.d.ts +3 -3
  80. package/es/components/PageHeader/PageHeader.js +22 -8
  81. package/es/components/Pagination/Pagination.js +6 -2
  82. package/es/components/PaginationNav/PaginationNav.js +2 -5
  83. package/es/components/Popover/index.js +15 -5
  84. package/es/components/ProgressBar/ProgressBar.js +4 -2
  85. package/es/components/RadioTile/RadioTile.js +2 -2
  86. package/es/components/Search/Search.d.ts +4 -2
  87. package/es/components/Search/Search.js +7 -6
  88. package/es/components/Select/Select.js +2 -3
  89. package/es/components/ShapeIndicator/index.js +4 -2
  90. package/es/components/SkeletonPlaceholder/SkeletonPlaceholder.d.ts +4 -4
  91. package/es/components/SkeletonPlaceholder/SkeletonPlaceholder.js +1 -2
  92. package/es/components/SkeletonText/SkeletonText.js +0 -2
  93. package/es/components/Slider/Slider.d.ts +144 -188
  94. package/es/components/Slider/Slider.js +798 -726
  95. package/es/components/Slider/index.d.ts +2 -2
  96. package/es/components/Stack/HStack.js +1 -0
  97. package/es/components/Stack/Stack.js +6 -9
  98. package/es/components/Stack/VStack.js +1 -0
  99. package/es/components/StructuredList/StructuredList.js +3 -0
  100. package/es/components/Switch/Switch.js +1 -1
  101. package/es/components/Tabs/Tabs.d.ts +4 -0
  102. package/es/components/Tabs/Tabs.js +28 -17
  103. package/es/components/Tag/DismissibleTag.js +2 -0
  104. package/es/components/Tag/OperationalTag.js +2 -0
  105. package/es/components/Tag/SelectableTag.js +2 -0
  106. package/es/components/Tag/Tag.js +4 -0
  107. package/es/components/Tag/isEllipsisActive.js +1 -0
  108. package/es/components/Text/Text.js +1 -0
  109. package/es/components/TextArea/TextArea.js +13 -6
  110. package/es/components/TextInput/ControlledPasswordInput.js +4 -6
  111. package/es/components/TextInput/PasswordInput.js +9 -4
  112. package/es/components/TextInput/TextInput.js +6 -4
  113. package/es/components/TextInput/util.d.ts +17 -5
  114. package/es/components/TextInput/util.js +2 -7
  115. package/es/components/Theme/index.js +8 -3
  116. package/es/components/Tile/Tile.js +14 -17
  117. package/es/components/TimePicker/TimePicker.js +1 -0
  118. package/es/components/Toggle/Toggle.js +1 -1
  119. package/es/components/Toggletip/index.js +4 -0
  120. package/es/components/Tooltip/DefinitionTooltip.js +1 -0
  121. package/es/components/Tooltip/Tooltip.js +30 -23
  122. package/es/components/TreeView/TreeNode.js +13 -5
  123. package/es/components/TreeView/TreeView.js +7 -0
  124. package/es/components/UIShell/HeaderContainer.js +3 -1
  125. package/es/components/UIShell/HeaderGlobalAction.js +2 -2
  126. package/es/components/UIShell/HeaderMenu.js +3 -3
  127. package/es/components/UIShell/HeaderPanel.d.ts +1 -1
  128. package/es/components/UIShell/HeaderPanel.js +2 -2
  129. package/es/components/UIShell/Link.js +2 -0
  130. package/es/components/UIShell/SideNavItems.js +1 -0
  131. package/es/components/UIShell/SideNavMenu.js +2 -2
  132. package/es/components/UIShell/SideNavMenuItem.js +1 -1
  133. package/es/components/UIShell/SideNavSwitcher.js +1 -1
  134. package/es/components/UIShell/Switcher.js +2 -1
  135. package/es/components/UIShell/SwitcherItem.js +4 -2
  136. package/es/index.d.ts +12 -13
  137. package/es/index.js +25 -24
  138. package/es/internal/FloatingMenu.js +7 -1
  139. package/es/internal/Selection.js +12 -3
  140. package/es/internal/defaultItemToString.d.ts +7 -0
  141. package/es/internal/defaultItemToString.js +17 -0
  142. package/es/internal/index.d.ts +1 -0
  143. package/es/internal/useMergedRefs.js +1 -0
  144. package/es/internal/useNoInteractiveChildren.js +4 -0
  145. package/es/internal/useOutsideClick.js +1 -0
  146. package/es/internal/useOverflowItems.js +6 -0
  147. package/es/internal/useResizeObserver.js +4 -0
  148. package/es/internal/useSavedCallback.js +1 -0
  149. package/es/internal/warning.js +1 -0
  150. package/es/prop-types/deprecateValuesWithin.d.ts +8 -1
  151. package/es/prop-types/deprecateValuesWithin.js +6 -6
  152. package/es/prop-types/isRequiredOneOf.js +4 -1
  153. package/es/prop-types/requiredIfGivenPropIsTruthy.d.ts +8 -7
  154. package/es/prop-types/requiredIfGivenPropIsTruthy.js +10 -10
  155. package/es/tools/events.js +3 -1
  156. package/es/tools/wrapComponent.js +1 -0
  157. package/lib/components/AILabel/index.js +8 -6
  158. package/lib/components/Breadcrumb/BreadcrumbItem.js +2 -0
  159. package/lib/components/Button/Button.js +3 -0
  160. package/lib/components/ChatButton/ChatButton.js +1 -0
  161. package/lib/components/CheckboxGroup/CheckboxGroup.js +20 -1
  162. package/lib/components/CodeSnippet/CodeSnippet.d.ts +1 -1
  163. package/lib/components/CodeSnippet/CodeSnippet.js +1 -1
  164. package/lib/components/ComboBox/ComboBox.js +20 -15
  165. package/lib/components/ComboButton/index.js +2 -1
  166. package/lib/components/ComposedModal/ComposedModal.js +5 -2
  167. package/lib/components/Copy/Copy.d.ts +1 -1
  168. package/lib/components/Copy/Copy.js +1 -1
  169. package/lib/components/CopyButton/CopyButton.d.ts +1 -1
  170. package/lib/components/CopyButton/CopyButton.js +1 -1
  171. package/lib/components/DataTable/DataTable.d.ts +60 -15
  172. package/lib/components/DataTable/DataTable.js +119 -178
  173. package/lib/components/DataTable/Table.d.ts +2 -2
  174. package/lib/components/DataTable/Table.js +4 -4
  175. package/lib/components/DataTable/TableExpandHeader.d.ts +1 -1
  176. package/lib/components/DataTable/TableExpandHeader.js +6 -2
  177. package/lib/components/DataTable/TableExpandRow.js +1 -0
  178. package/lib/components/DataTable/TableHeader.js +2 -0
  179. package/lib/components/DataTable/TableRow.js +5 -0
  180. package/lib/components/DataTable/TableSlugRow.js +1 -0
  181. package/lib/components/DataTable/TableToolbarMenu.js +3 -0
  182. package/lib/components/DataTable/state/sorting.d.ts +3 -1
  183. package/lib/components/DataTable/state/sorting.js +2 -0
  184. package/lib/components/DataTable/tools/sorting.js +1 -0
  185. package/lib/components/DatePicker/DatePicker.d.ts +0 -12
  186. package/lib/components/DatePicker/DatePicker.js +16 -5
  187. package/lib/components/DatePicker/plugins/rangePlugin.d.ts +19 -2
  188. package/lib/components/DatePicker/plugins/rangePlugin.js +18 -16
  189. package/lib/components/DatePickerInput/DatePickerInput.js +6 -0
  190. package/lib/components/Dialog/Dialog.js +10 -2
  191. package/lib/components/Dropdown/Dropdown.js +19 -18
  192. package/lib/components/ErrorBoundary/ErrorBoundaryContext.js +1 -0
  193. package/lib/components/FeatureFlags/index.js +1 -0
  194. package/lib/components/FileUploader/FileUploader.js +9 -2
  195. package/lib/components/FileUploader/FileUploaderButton.js +1 -1
  196. package/lib/components/FileUploader/FileUploaderDropContainer.js +1 -1
  197. package/lib/components/FileUploader/FileUploaderItem.js +3 -0
  198. package/lib/components/FluidMultiSelect/FluidMultiSelect.js +2 -0
  199. package/lib/components/FluidNumberInput/FluidNumberInput.js +3 -2
  200. package/lib/components/FluidSearch/FluidSearch.js +3 -2
  201. package/lib/components/FluidSelect/FluidSelect.js +3 -2
  202. package/lib/components/FluidTextInput/FluidTextInput.js +3 -2
  203. package/lib/components/FluidTimePicker/FluidTimePicker.js +11 -4
  204. package/lib/components/FluidTimePickerSelect/FluidTimePickerSelect.js +3 -2
  205. package/lib/components/Grid/CSSGrid.js +5 -0
  206. package/lib/components/Grid/Column.js +3 -0
  207. package/lib/components/Grid/ColumnHang.js +1 -0
  208. package/lib/components/Grid/FlexGrid.js +1 -0
  209. package/lib/components/Grid/Row.js +1 -0
  210. package/lib/components/Heading/index.js +3 -1
  211. package/lib/components/IconButton/index.js +5 -3
  212. package/lib/components/IconIndicator/index.js +4 -2
  213. package/lib/components/InlineCheckbox/InlineCheckbox.js +3 -2
  214. package/lib/components/Layout/index.js +6 -4
  215. package/lib/components/LayoutDirection/LayoutDirection.js +2 -0
  216. package/lib/components/Link/Link.js +3 -0
  217. package/lib/components/ListBox/ListBoxMenuItem.js +4 -1
  218. package/lib/components/ListBox/next/ListBoxTrigger.js +3 -2
  219. package/lib/components/Menu/Menu.js +6 -9
  220. package/lib/components/Menu/MenuContext.js +1 -0
  221. package/lib/components/Menu/MenuItem.d.ts +1 -1
  222. package/lib/components/Menu/MenuItem.js +11 -19
  223. package/lib/components/MenuButton/index.js +7 -2
  224. package/lib/components/Modal/Modal.js +4 -1
  225. package/lib/components/ModalWrapper/ModalWrapper.js +2 -0
  226. package/lib/components/MultiSelect/FilterableMultiSelect.js +32 -13
  227. package/lib/components/MultiSelect/MultiSelect.js +23 -18
  228. package/lib/components/Notification/Notification.d.ts +6 -6
  229. package/lib/components/Notification/Notification.js +7 -7
  230. package/lib/components/NumberInput/NumberInput.js +7 -1
  231. package/lib/components/OverflowMenu/OverflowMenu.js +3 -1
  232. package/lib/components/OverflowMenu/next/index.js +4 -3
  233. package/lib/components/OverflowMenuItem/OverflowMenuItem.js +2 -0
  234. package/lib/components/PageHeader/PageHeader.d.ts +3 -3
  235. package/lib/components/PageHeader/PageHeader.js +22 -8
  236. package/lib/components/Pagination/Pagination.js +6 -2
  237. package/lib/components/PaginationNav/PaginationNav.js +2 -5
  238. package/lib/components/Popover/index.js +15 -5
  239. package/lib/components/ProgressBar/ProgressBar.js +4 -2
  240. package/lib/components/RadioTile/RadioTile.js +2 -2
  241. package/lib/components/Search/Search.d.ts +4 -2
  242. package/lib/components/Search/Search.js +7 -6
  243. package/lib/components/Select/Select.js +2 -3
  244. package/lib/components/ShapeIndicator/index.js +4 -2
  245. package/lib/components/SkeletonPlaceholder/SkeletonPlaceholder.d.ts +4 -4
  246. package/lib/components/SkeletonPlaceholder/SkeletonPlaceholder.js +1 -2
  247. package/lib/components/SkeletonText/SkeletonText.js +0 -2
  248. package/lib/components/Slider/Slider.d.ts +144 -188
  249. package/lib/components/Slider/Slider.js +795 -725
  250. package/lib/components/Slider/index.d.ts +2 -2
  251. package/lib/components/Stack/HStack.js +1 -0
  252. package/lib/components/Stack/Stack.js +6 -9
  253. package/lib/components/Stack/VStack.js +1 -0
  254. package/lib/components/StructuredList/StructuredList.js +3 -0
  255. package/lib/components/Switch/Switch.js +1 -1
  256. package/lib/components/Tabs/Tabs.d.ts +4 -0
  257. package/lib/components/Tabs/Tabs.js +28 -17
  258. package/lib/components/Tag/DismissibleTag.js +2 -0
  259. package/lib/components/Tag/OperationalTag.js +2 -0
  260. package/lib/components/Tag/SelectableTag.js +2 -0
  261. package/lib/components/Tag/Tag.js +4 -0
  262. package/lib/components/Tag/isEllipsisActive.js +1 -0
  263. package/lib/components/Text/Text.js +1 -0
  264. package/lib/components/TextArea/TextArea.js +13 -6
  265. package/lib/components/TextInput/ControlledPasswordInput.js +3 -5
  266. package/lib/components/TextInput/PasswordInput.js +8 -3
  267. package/lib/components/TextInput/TextInput.js +5 -3
  268. package/lib/components/TextInput/util.d.ts +17 -5
  269. package/lib/components/TextInput/util.js +2 -7
  270. package/lib/components/Theme/index.js +8 -3
  271. package/lib/components/Tile/Tile.js +14 -17
  272. package/lib/components/TimePicker/TimePicker.js +1 -0
  273. package/lib/components/Toggle/Toggle.js +1 -1
  274. package/lib/components/Toggletip/index.js +4 -0
  275. package/lib/components/Tooltip/DefinitionTooltip.js +1 -0
  276. package/lib/components/Tooltip/Tooltip.js +30 -23
  277. package/lib/components/TreeView/TreeNode.js +13 -5
  278. package/lib/components/TreeView/TreeView.js +7 -0
  279. package/lib/components/UIShell/HeaderContainer.js +3 -1
  280. package/lib/components/UIShell/HeaderGlobalAction.js +2 -2
  281. package/lib/components/UIShell/HeaderMenu.js +3 -3
  282. package/lib/components/UIShell/HeaderPanel.d.ts +1 -1
  283. package/lib/components/UIShell/HeaderPanel.js +2 -2
  284. package/lib/components/UIShell/Link.js +2 -0
  285. package/lib/components/UIShell/SideNavItems.js +1 -0
  286. package/lib/components/UIShell/SideNavMenu.js +2 -2
  287. package/lib/components/UIShell/SideNavMenuItem.js +1 -1
  288. package/lib/components/UIShell/SideNavSwitcher.js +1 -1
  289. package/lib/components/UIShell/Switcher.js +2 -1
  290. package/lib/components/UIShell/SwitcherItem.js +4 -2
  291. package/lib/index.d.ts +12 -13
  292. package/lib/index.js +51 -28
  293. package/lib/internal/FloatingMenu.js +7 -1
  294. package/lib/internal/Selection.js +12 -3
  295. package/lib/internal/defaultItemToString.d.ts +7 -0
  296. package/lib/internal/defaultItemToString.js +19 -0
  297. package/lib/internal/index.d.ts +1 -0
  298. package/lib/internal/useMergedRefs.js +1 -0
  299. package/lib/internal/useNoInteractiveChildren.js +4 -0
  300. package/lib/internal/useOutsideClick.js +1 -0
  301. package/lib/internal/useOverflowItems.js +6 -0
  302. package/lib/internal/useResizeObserver.js +4 -0
  303. package/lib/internal/useSavedCallback.js +1 -0
  304. package/lib/internal/warning.js +1 -0
  305. package/lib/prop-types/deprecateValuesWithin.d.ts +8 -1
  306. package/lib/prop-types/deprecateValuesWithin.js +6 -8
  307. package/lib/prop-types/isRequiredOneOf.js +4 -1
  308. package/lib/prop-types/requiredIfGivenPropIsTruthy.d.ts +8 -7
  309. package/lib/prop-types/requiredIfGivenPropIsTruthy.js +10 -12
  310. package/lib/tools/events.js +3 -1
  311. package/lib/tools/wrapComponent.js +1 -0
  312. package/package.json +10 -9
  313. package/es/components/MultiSelect/tools/itemToString.d.ts +0 -1
  314. package/es/components/MultiSelect/tools/itemToString.js +0 -21
  315. package/es/components/Slider/index.js +0 -14
  316. package/es/internal/createClassWrapper.js +0 -23
  317. package/lib/components/MultiSelect/tools/itemToString.d.ts +0 -1
  318. package/lib/components/MultiSelect/tools/itemToString.js +0 -23
  319. package/lib/components/Slider/index.js +0 -20
  320. package/lib/internal/createClassWrapper.js +0 -25
@@ -37,6 +37,7 @@ import TableToolbarAction from './TableToolbarAction.js';
37
37
  import TableToolbarContent from './TableToolbarContent.js';
38
38
  import TableToolbarSearch from './TableToolbarSearch.js';
39
39
  import TableToolbarMenu from './TableToolbarMenu.js';
40
+ import { deprecate } from '../../prop-types/deprecate.js';
40
41
 
41
42
  const getInstanceId = setupGetInstanceId();
42
43
  const translationKeys = {
@@ -50,11 +51,8 @@ const translationKeys = {
50
51
  unselectRow: 'carbon.table.row.unselect'
51
52
  };
52
53
 
53
- // TODO: All code comments in this file should be revisited for accuracy and
54
- // clarity.
55
-
56
54
  /**
57
- * Message ids that will be passed to translateWithId().
55
+ * Message IDs that will be passed to translateWithId().
58
56
  */
59
57
 
60
58
  const defaultTranslations = {
@@ -68,16 +66,26 @@ const defaultTranslations = {
68
66
  [translationKeys.unselectRow]: 'Unselect row'
69
67
  };
70
68
  const translateWithId = id => defaultTranslations[id];
69
+
70
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20071
71
+
72
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20071
73
+
74
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20071
75
+
76
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20071
77
+
78
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20071
79
+
71
80
  /**
72
- * Data Tables are used to represent a collection of resources, displaying a
73
- * subset of their fields in columns, or headers. We prioritize direct updates
74
- * to the state of what we're rendering, so internally we end up normalizing the
75
- * given data and then denormalizing it when rendering.
76
- *
77
- * As a result, each part of the DataTable is accessible through look-up by id,
78
- * and updating the state of the single entity will cascade updates to the
79
- * consumer.
81
+ * DataTable components are used to represent a collection of resources,
82
+ * displaying a subset of their fields in columns, or headers. We prioritize
83
+ * direct updates to the state of what we're rendering, so internally we
84
+ * normalize the given data and then denormalize it at render time. Each part of
85
+ * the DataTable is accessible through look-up by ID, and updating the state of
86
+ * a single entity cascades updates to the consumer.
80
87
  */
88
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20071
81
89
  const DataTable = props => {
82
90
  const {
83
91
  children,
@@ -98,24 +106,18 @@ const DataTable = props => {
98
106
  const instanceId = useMemo(() => getInstanceId(), []);
99
107
  const [state, setState] = useState(() => ({
100
108
  ...getDerivedStateFromProps(props, {}),
101
- isExpandedAll: false // Start with collapsed state, treat `undefined` as neutral state
109
+ // Initialize to collapsed. A value of `undefined` is treated as neutral.
110
+ isExpandedAll: false
102
111
  }));
103
112
  useEffect(() => {
104
113
  const nextRowIds = rows.map(row => row.id);
105
114
  const nextHeaders = headers.map(header => header.key);
106
115
  const hasRowIdsChanged = !isEqual(nextRowIds, state.rowIds);
107
- const currentHeaders = Object.keys(state.cellsById).reduce((acc, cellId) => {
108
- const headerKey = cellId.split(':')[1];
109
- if (headerKey && !acc.includes(headerKey)) {
110
- acc.push(headerKey);
111
- }
112
- return acc;
113
- }, []);
116
+ const currentHeaders = Array.from(new Set(Object.keys(state.cellsById).map(id => id.split(':')[1])));
114
117
  const hasHeadersChanged = !isEqual(nextHeaders, currentHeaders);
115
118
  const currentRows = state.rowIds.map(id => {
116
119
  const row = state.rowsById[id];
117
120
  return {
118
- // TODO: Investigate whether it be okay to just return `row`.
119
121
  id: row.id,
120
122
  disabled: row.disabled,
121
123
  isExpanded: row.isExpanded,
@@ -126,12 +128,8 @@ const DataTable = props => {
126
128
  if (hasRowIdsChanged || hasHeadersChanged || hasRowsChanged) {
127
129
  setState(prev => getDerivedStateFromProps(props, prev));
128
130
  }
131
+ // eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/20071
129
132
  }, [headers, rows]);
130
-
131
- /**
132
- * Get the props associated with the given header. Mostly used for adding in
133
- * sorting behavior.
134
- */
135
133
  const getHeaderProps = ({
136
134
  header,
137
135
  onClick,
@@ -142,33 +140,36 @@ const DataTable = props => {
142
140
  sortDirection,
143
141
  sortHeaderKey
144
142
  } = state;
143
+ const {
144
+ key,
145
+ slug,
146
+ decorator
147
+ } = header;
145
148
  return {
146
149
  ...rest,
147
- key: header.key,
150
+ key,
148
151
  sortDirection,
149
152
  isSortable,
150
- isSortHeader: sortHeaderKey === header.key,
151
- slug: header.slug,
152
- decorator: header.decorator,
153
+ isSortHeader: sortHeaderKey === key,
154
+ slug,
155
+ decorator,
153
156
  onClick: event => {
154
157
  const nextSortState = getNextSortState(props, state, {
155
- key: header.key
158
+ key
156
159
  });
157
160
  setState(prev => ({
158
161
  ...prev,
159
162
  ...nextSortState
160
163
  }));
161
- onClick && handleOnHeaderClick(onClick, {
162
- sortHeaderKey: header.key,
163
- sortDirection: nextSortState.sortDirection
164
- })(event);
164
+ if (onClick) {
165
+ handleOnHeaderClick(onClick, {
166
+ sortHeaderKey: key,
167
+ sortDirection: nextSortState.sortDirection
168
+ })(event);
169
+ }
165
170
  }
166
171
  };
167
172
  };
168
-
169
- /**
170
- * Get the props associated with the given expand header.
171
- */
172
173
  const getExpandHeaderProps = ({
173
174
  onClick,
174
175
  onExpand,
@@ -181,39 +182,35 @@ const DataTable = props => {
181
182
  } = state;
182
183
  const isExpanded = isExpandedAll || rowIds.every(id => rowsById[id].isExpanded);
183
184
  const translationKey = isExpanded ? translationKeys.collapseAll : translationKeys.expandAll;
185
+ const handlers = [handleOnExpandAll, onExpand];
186
+ if (onClick) {
187
+ handlers.push(handleOnExpandHeaderClick(onClick, {
188
+ isExpanded
189
+ }));
190
+ }
184
191
  return {
185
192
  ...rest,
186
193
  'aria-label': t(translationKey),
187
- // Provide a string of all the expanded row id's, separated by a space.
194
+ // Provide a string of all expanded row IDs, separated by a space.
188
195
  'aria-controls': rowIds.map(id => `expanded-row-${id}`).join(' '),
189
196
  isExpanded,
190
- // Compose the event handlers so we don't overwrite a consumer's `onClick`
191
- // handler
192
- onExpand: composeEventHandlers([handleOnExpandAll, onExpand,
193
- // TODO: Avoid passing `false` to this function.
194
- onClick && handleOnExpandHeaderClick(onClick, {
195
- isExpanded
196
- })])
197
+ onExpand: composeEventHandlers(handlers)
197
198
  };
198
199
  };
199
200
 
200
201
  /**
201
- * Decorate consumer's `onClick` event handler with sort parameters
202
+ * Wraps the consumer's `onClick` with sorting metadata.
202
203
  */
203
204
  const handleOnHeaderClick = (onClick, sortParams) => {
204
205
  return event => onClick(event, sortParams);
205
206
  };
206
207
 
207
208
  /**
208
- * Decorate consumer's `onClick` event handler with expand parameters
209
+ * Wraps the consumer's `onClick` with sorting metadata.
209
210
  */
210
211
  const handleOnExpandHeaderClick = (onClick, expandParams) => {
211
212
  return event => onClick(event, expandParams);
212
213
  };
213
-
214
- /**
215
- * Get the props associated with the given row. Mostly used for expansion.
216
- */
217
214
  const getRowProps = ({
218
215
  row,
219
216
  onClick,
@@ -234,10 +231,6 @@ const DataTable = props => {
234
231
  disabled: row.disabled
235
232
  };
236
233
  };
237
-
238
- /**
239
- * Get the props associated with an expanded row
240
- */
241
234
  const getExpandedRowProps = ({
242
235
  row,
243
236
  ...rest
@@ -249,9 +242,7 @@ const DataTable = props => {
249
242
  };
250
243
 
251
244
  /**
252
- * Gets the props associated with selection for a header or a row, where
253
- * applicable. Most often used to indicate selection status of the table or
254
- * for a specific row.
245
+ * Gets the props associated with selection for a header or a row.
255
246
  */
256
247
  const getSelectionProps = ({
257
248
  onClick,
@@ -276,7 +267,7 @@ const DataTable = props => {
276
267
  // Otherwise, we're working on `TableSelectAll` which handles toggling the
277
268
  // selection state of all rows.
278
269
  const rowCount = state.rowIds.length;
279
- const selectedRowCount = getSelectedRows().length;
270
+ const selectedRowCount = selectedRows.length;
280
271
  const checked = rowCount > 0 && selectedRowCount === rowCount;
281
272
  const indeterminate = rowCount > 0 && selectedRowCount > 0 && selectedRowCount !== rowCount;
282
273
  const translationKey = checked || indeterminate ? translationKeys.unselectAll : translationKeys.selectAll;
@@ -301,13 +292,13 @@ const DataTable = props => {
301
292
  const {
302
293
  shouldShowBatchActions
303
294
  } = state;
304
- const totalSelected = getSelectedRows().length;
295
+ const selectedRowCount = selectedRows.length;
305
296
  return {
306
297
  onSelectAll: undefined,
307
- totalCount: state.rowIds.length || 0,
298
+ totalCount: state.rowIds.length,
308
299
  ...props,
309
- shouldShowBatchActions: shouldShowBatchActions && totalSelected > 0,
310
- totalSelected,
300
+ shouldShowBatchActions: shouldShowBatchActions && selectedRowCount > 0,
301
+ totalSelected: selectedRowCount,
311
302
  onCancel: handleOnCancel
312
303
  };
313
304
  };
@@ -328,77 +319,49 @@ const DataTable = props => {
328
319
  useStaticWidth
329
320
  };
330
321
  };
331
-
332
- // TODO: `getHeaderProps` and `getRowProps` return `key` props. Would it be
333
- // beneficial for this function to also return a `key` prop?
334
- /**
335
- * Get the props associated with the given table cell.
336
- */
337
322
  const getCellProps = ({
338
323
  cell: {
339
324
  hasAILabelHeader,
340
- hasDecoratorHeader
325
+ id
341
326
  },
342
327
  ...rest
343
328
  }) => {
344
329
  return {
345
330
  ...rest,
346
331
  hasAILabelHeader,
347
- hasDecoratorHeader
332
+ key: id
348
333
  };
349
334
  };
350
335
 
351
336
  /**
352
- * Helper utility to get all the currently selected rows
353
- *
354
- * @returns the array of rowIds that are currently selected
337
+ * Selected row IDs, excluding disabled rows.
355
338
  */
356
- const getSelectedRows = () => state.rowIds.filter(id => {
339
+ const selectedRows = state.rowIds.filter(id => {
357
340
  const row = state.rowsById[id];
358
341
  return row.isSelected && !row.disabled;
359
342
  });
343
+ const filteredRowIds = typeof state.filterInputValue === 'string' ? filterRows({
344
+ cellsById: state.cellsById,
345
+ getCellId,
346
+ headers,
347
+ inputValue: state.filterInputValue,
348
+ rowIds: state.rowIds
349
+ }) : state.rowIds;
360
350
 
361
351
  /**
362
- * Helper utility to get all of the available rows after applying the filter
363
- *
364
- * @returns the array of rowIds that are currently included through the filter
365
- */
366
- const getFilteredRowIds = () => {
367
- const filteredRowIds = typeof state.filterInputValue === 'string' ? filterRows({
368
- rowIds: state.rowIds,
369
- headers: headers,
370
- cellsById: state.cellsById,
371
- inputValue: state.filterInputValue,
372
- getCellId
373
- }) : state.rowIds;
374
- // TODO: Use strict equality check.
375
- if (filteredRowIds.length == 0) {
376
- return [];
377
- }
378
- return filteredRowIds;
379
- };
380
-
381
- /**
382
- * Helper for getting the table prefix for elements that require an
383
- * `id` attribute that is unique.
352
+ * Generates a prefix for table related IDs.
384
353
  */
385
354
  const getTablePrefix = () => `data-table-${instanceId}`;
386
355
 
387
356
  /**
388
- * Helper for toggling all selected items in a state. Does not call
389
- * setState, so use it when setting state.
390
- *
391
- * @returns object to put into this.setState (use spread operator)
357
+ * Generates a new `rowsById` object with updated selection state.
392
358
  */
393
- const setAllSelectedState = (initialState, isSelected, filteredRowIds) => {
359
+ const getUpdatedSelectionState = (initialState, isSelected) => {
394
360
  const {
395
361
  rowIds
396
362
  } = initialState;
397
- // TODO: Use strict inequality check.
398
- const isFiltered = rowIds.length != filteredRowIds.length;
363
+ const isFiltered = rowIds.length !== filteredRowIds.length;
399
364
  return {
400
- // TODO: Should the `reduce` be typed with `<Record<string,
401
- // DataTableRow<ColTypes>>>`?
402
365
  rowsById: rowIds.reduce((acc, id) => {
403
366
  const row = {
404
367
  ...initialState.rowsById[id]
@@ -406,62 +369,59 @@ const DataTable = props => {
406
369
  if (!row.disabled && (!isFiltered || filteredRowIds.includes(id))) {
407
370
  row.isSelected = isSelected;
408
371
  }
409
- acc[id] = row; // Local mutation for performance with large tables
372
+
373
+ // Local mutation for performance with large tables
374
+ acc[id] = row;
410
375
  return acc;
411
376
  }, {})
412
377
  };
413
378
  };
414
379
 
415
380
  /**
416
- * Handler for the `onCancel` event to hide the batch action bar and
417
- * deselect all selected rows
381
+ * Handler for `onCancel` to hide the batch action toolbar and deselect all
382
+ * rows.
418
383
  */
419
384
  const handleOnCancel = () => {
420
385
  setState(prev => {
421
386
  return {
422
387
  ...prev,
423
388
  shouldShowBatchActions: false,
424
- ...setAllSelectedState(prev, false, getFilteredRowIds())
389
+ ...getUpdatedSelectionState(prev, false)
425
390
  };
426
391
  });
427
392
  };
428
393
 
429
394
  /**
430
- * Handler for toggling the selection state of all rows in the database
395
+ * Handler for toggling the selection state of all rows.
431
396
  */
432
397
  const handleSelectAll = () => {
433
398
  setState(prev => {
434
- const filteredRowIds = getFilteredRowIds();
435
399
  const {
436
400
  rowsById
437
401
  } = prev;
438
- const isSelected = !(Object.values(rowsById).filter(row => row.isSelected && !row.disabled).length > 0);
402
+ const isSelected = !Object.values(rowsById).filter(row => row.isSelected && !row.disabled).length;
439
403
  return {
440
404
  ...prev,
441
405
  shouldShowBatchActions: isSelected,
442
- ...setAllSelectedState(prev, isSelected, filteredRowIds)
406
+ ...getUpdatedSelectionState(prev, isSelected)
443
407
  };
444
408
  });
445
409
  };
446
410
 
447
411
  /**
448
- * Handler for toggling the selection state of a given row.
412
+ * Handler for toggling selection state of a given row.
449
413
  */
450
414
  const handleOnSelectRow = rowId => () => {
451
415
  setState(prev => {
452
416
  const row = prev.rowsById[rowId];
453
417
  if (radio) {
454
- // TODO:
455
- // 1. Should the `reduce` be typed with `<Record<string,
456
- // DataTableRow<ColTypes>>>`?
457
- // 2. Add better parameter names. Use `acc` and `row`.
458
- //
459
- // deselect all radio buttons
460
- const rowsById = Object.entries(prev.rowsById).reduce((p, c) => {
461
- const [key, val] = c;
462
- val.isSelected = false;
463
- p[key] = val;
464
- return p;
418
+ // Deselect all radio buttons, then toggle the target row
419
+ const rowsById = Object.entries(prev.rowsById).reduce((acc, [id, row]) => {
420
+ acc[id] = {
421
+ ...row,
422
+ isSelected: false
423
+ };
424
+ return acc;
465
425
  }, {});
466
426
  return {
467
427
  ...prev,
@@ -469,8 +429,8 @@ const DataTable = props => {
469
429
  rowsById: {
470
430
  ...rowsById,
471
431
  [rowId]: {
472
- ...row,
473
- isSelected: !row.isSelected
432
+ ...rowsById[rowId],
433
+ isSelected: !rowsById[rowId].isSelected
474
434
  }
475
435
  }
476
436
  };
@@ -480,10 +440,8 @@ const DataTable = props => {
480
440
  const selectedRowsCount = !row.isSelected ? selectedRows + 1 : selectedRows - 1;
481
441
  return {
482
442
  ...prev,
483
- // Basic assumption here is that we want to show the batch action bar if
484
- // the row is being selected. If it's being unselected, then see if we
485
- // have a non-zero number of selected rows that batch actions could
486
- // still apply to
443
+ // Show batch action toolbar if selecting, or if there are other
444
+ // selected rows remaining.
487
445
  shouldShowBatchActions: !row.isSelected || selectedRowsCount > 0,
488
446
  rowsById: {
489
447
  ...prev.rowsById,
@@ -495,10 +453,6 @@ const DataTable = props => {
495
453
  };
496
454
  });
497
455
  };
498
-
499
- /**
500
- * Handler for toggling the expansion state of a given row.
501
- */
502
456
  const handleOnExpandRow = rowId => () => {
503
457
  setState(prev => {
504
458
  const row = prev.rowsById[rowId];
@@ -518,10 +472,6 @@ const DataTable = props => {
518
472
  };
519
473
  });
520
474
  };
521
-
522
- /**
523
- * Handler for changing the expansion state of all rows.
524
- */
525
475
  const handleOnExpandAll = () => {
526
476
  setState(prev => {
527
477
  const {
@@ -531,22 +481,19 @@ const DataTable = props => {
531
481
  return {
532
482
  ...prev,
533
483
  isExpandedAll: !isExpandedAll,
534
- // TODO: Add generic to `reduce`.
535
- rowsById: rowIds.reduce((acc, id) => ({
536
- ...acc,
537
- [id]: {
484
+ rowsById: rowIds.reduce((acc, id) => {
485
+ acc[id] = {
538
486
  ...prev.rowsById[id],
539
487
  isExpanded: !isExpandedAll
540
- }
541
- }), {})
488
+ };
489
+ return acc;
490
+ }, {})
542
491
  };
543
492
  });
544
493
  };
545
494
 
546
495
  /**
547
- * Handler for transitioning to the next sort state of the table
548
- *
549
- * @param headerKey - The field for the header that we are sorting by.
496
+ * Transitions to the next sort state of the table.
550
497
  */
551
498
  const handleSortBy = headerKey => () => {
552
499
  setState(prev => {
@@ -562,37 +509,20 @@ const DataTable = props => {
562
509
  };
563
510
 
564
511
  /**
565
- * Event handler for transitioning input value state changes for the table
566
- * filter component.
512
+ * Event handler for table filter input changes.
567
513
  */
568
514
  const handleOnInputValueChange = (event, defaultValue) => {
569
- if (event.target) {
570
- setState(prev => ({
571
- ...prev,
572
- filterInputValue: event.target.value
573
- }));
574
- }
575
- if (defaultValue) {
576
- setState(prev => ({
577
- ...prev,
578
- filterInputValue: defaultValue
579
- }));
580
- }
515
+ const value = defaultValue || event.target?.value;
516
+ setState(prev => ({
517
+ ...prev,
518
+ filterInputValue: value
519
+ }));
581
520
  };
582
-
583
- // TODO: Could getFilteredRowIds be used here?
584
- const filteredRowIds = typeof state.filterInputValue === 'string' ? filterRows({
585
- rowIds: state.rowIds,
586
- headers,
587
- cellsById: state.cellsById,
588
- inputValue: state.filterInputValue,
589
- getCellId
590
- }) : state.rowIds;
591
521
  const renderProps = {
592
522
  // Data derived from state
593
523
  rows: denormalize(filteredRowIds, state.rowsById, state.cellsById),
594
524
  headers: headers,
595
- selectedRows: denormalize(getSelectedRows(), state.rowsById, state.cellsById),
525
+ selectedRows: denormalize(selectedRows, state.rowsById, state.cellsById),
596
526
  // Prop accessors/getters
597
527
  getHeaderProps,
598
528
  getExpandHeaderProps,
@@ -646,6 +576,10 @@ DataTable.TableToolbarContent = TableToolbarContent;
646
576
  DataTable.TableToolbarSearch = TableToolbarSearch;
647
577
  DataTable.TableToolbarMenu = TableToolbarMenu;
648
578
  DataTable.propTypes = {
579
+ /**
580
+ * Pass in the children that will be rendered within the Table
581
+ */
582
+ children: PropTypes.node,
649
583
  /**
650
584
  * Experimental property. Allows table to align cell contents to the top if there is text wrapping in the content. Might have performance issues, intended for smaller tables
651
585
  */
@@ -681,6 +615,13 @@ DataTable.propTypes = {
681
615
  * Specify whether the control should be a radio button or inline checkbox
682
616
  */
683
617
  radio: PropTypes.bool,
618
+ /**
619
+ * @deprecated Use `children` instead. This prop will be removed in
620
+ * the next major version.
621
+ *
622
+ * https://www.patterns.dev/react/render-props-pattern/#children-as-a-function
623
+ */
624
+ render: deprecate(PropTypes.func),
684
625
  /**
685
626
  * The `rows` prop is where you provide us with a list of all the rows that
686
627
  * you want to render in the table. The only hard requirement is that this
@@ -707,13 +648,13 @@ DataTable.propTypes = {
707
648
  */
708
649
  stickyHeader: PropTypes.bool,
709
650
  /**
710
- * Optional method that takes in a message id and returns an
651
+ * Optional method that takes in a message ID and returns an
711
652
  * internationalized string. See `DataTable.translationKeys` for all
712
- * available message ids.
653
+ * available message IDs.
713
654
  */
714
655
  translateWithId: PropTypes.func,
715
656
  /**
716
- * `false` If true, will use a width of 'auto' instead of 100%
657
+ * If `true`, sets the table width to `auto` instead of `100%`.
717
658
  */
718
659
  useStaticWidth: PropTypes.bool,
719
660
  /**
@@ -26,7 +26,7 @@ export interface TableProps {
26
26
  */
27
27
  stickyHeader?: boolean;
28
28
  /**
29
- * `false` If true, will use a width of 'auto' instead of 100%
29
+ * If `true`, sets the table width to `auto` instead of `100%`.
30
30
  */
31
31
  useStaticWidth?: boolean;
32
32
  /**
@@ -67,7 +67,7 @@ export declare const Table: {
67
67
  */
68
68
  stickyHeader: PropTypes.Requireable<boolean>;
69
69
  /**
70
- * `false` If true, will use a width of 'auto' instead of 100%
70
+ * If `true`, sets the table width to `auto` instead of `100%`.
71
71
  */
72
72
  useStaticWidth: PropTypes.Requireable<boolean>;
73
73
  /**
@@ -72,9 +72,11 @@ const Table = ({
72
72
  [`${prefix}--data-table--visible-overflow-menu`]: !overflowMenuOnHover
73
73
  });
74
74
  const toggleTableBodyAlignmentClass = useCallback((alignTop = false) => {
75
+ // eslint-disable-next-line @typescript-eslint/no-unused-expressions -- https://github.com/carbon-design-system/carbon/issues/20071
75
76
  alignTop ? tableRef.current?.classList.add(`${prefix}--data-table--top-aligned-body`) : tableRef.current?.classList.remove(`${prefix}--data-table--top-aligned-body`);
76
77
  }, [prefix]);
77
78
  const toggleTableHeaderAlignmentClass = useCallback((alignTop = false) => {
79
+ // eslint-disable-next-line @typescript-eslint/no-unused-expressions -- https://github.com/carbon-design-system/carbon/issues/20071
78
80
  alignTop ? tableRef.current?.classList.add(`${prefix}--data-table--top-aligned-header`) : tableRef.current?.classList.remove(`${prefix}--data-table--top-aligned-header`);
79
81
  }, [prefix]);
80
82
  const setTableAlignment = useCallback(() => {
@@ -124,9 +126,7 @@ const Table = ({
124
126
  setTableAlignment();
125
127
  }, [setTableAlignment, size]);
126
128
  const table = /*#__PURE__*/React.createElement("div", {
127
- className: `${prefix}--data-table-content`
128
- // eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex
129
- ,
129
+ className: `${prefix}--data-table-content`,
130
130
  tabIndex: tabIndex ?? (isScrollable ? 0 : undefined)
131
131
  }, /*#__PURE__*/React.createElement("table", _extends({
132
132
  "aria-labelledby": titleId,
@@ -166,7 +166,7 @@ Table.propTypes = {
166
166
  */
167
167
  stickyHeader: PropTypes.bool,
168
168
  /**
169
- * `false` If true, will use a width of 'auto' instead of 100%
169
+ * If `true`, sets the table width to `auto` instead of `100%`.
170
170
  */
171
171
  useStaticWidth: PropTypes.bool,
172
172
  /**
@@ -98,7 +98,7 @@ declare const TableExpandHeader: {
98
98
  * Specify whether this row is expanded or not. This helps coordinate data
99
99
  * attributes so that `TableExpandRow` and `TableExpandedRow` work together
100
100
  */
101
- isExpanded: React.Validator;
101
+ isExpanded: PropTypes.Validator<boolean | null | undefined>;
102
102
  /**
103
103
  * Hook for when a listener initiates a request to expand the given row
104
104
  */
@@ -12,7 +12,7 @@ import PropTypes from 'prop-types';
12
12
  import React from 'react';
13
13
  import { usePrefix } from '../../internal/usePrefix.js';
14
14
  import { deprecate } from '../../prop-types/deprecate.js';
15
- import requiredIfGivenPropIsTruthy from '../../prop-types/requiredIfGivenPropIsTruthy.js';
15
+ import { requiredIfGivenPropIsTruthy } from '../../prop-types/requiredIfGivenPropIsTruthy.js';
16
16
 
17
17
  const TableExpandHeader = ({
18
18
  ['aria-controls']: ariaControls,
@@ -91,7 +91,11 @@ TableExpandHeader.propTypes = {
91
91
  /**
92
92
  * Hook for when a listener initiates a request to expand the given row
93
93
  */
94
- onExpand: PropTypes.oneOfType([requiredIfGivenPropIsTruthy('enableExpando', PropTypes.func), requiredIfGivenPropIsTruthy('enableToggle', PropTypes.func)])
94
+ onExpand: PropTypes.oneOfType([requiredIfGivenPropIsTruthy('enableExpando', PropTypes.func
95
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20071
96
+ ), requiredIfGivenPropIsTruthy('enableToggle', PropTypes.func
97
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20071
98
+ )])
95
99
  };
96
100
 
97
101
  export { TableExpandHeader as default };
@@ -92,6 +92,7 @@ TableExpandRow.propTypes = {
92
92
  * Specify the string read by a voice reader when the expand trigger is
93
93
  * focused
94
94
  */
95
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment -- https://github.com/carbon-design-system/carbon/issues/20071
95
96
  /**@ts-ignore*/
96
97
  'aria-label': PropTypes.string,
97
98
  /**
@@ -188,6 +188,8 @@ TableHeader.propTypes = {
188
188
  */
189
189
  translateWithId: PropTypes.func
190
190
  };
191
+
192
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20071
191
193
  TableHeader.translationKeys = Object.values(translationKeys);
192
194
  TableHeader.displayName = 'TableHeader';
193
195