@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
@@ -39,6 +39,7 @@ var TableToolbarAction = require('./TableToolbarAction.js');
39
39
  var TableToolbarContent = require('./TableToolbarContent.js');
40
40
  var TableToolbarSearch = require('./TableToolbarSearch.js');
41
41
  var TableToolbarMenu = require('./TableToolbarMenu.js');
42
+ var deprecate = require('../../prop-types/deprecate.js');
42
43
 
43
44
  const getInstanceId = setupGetInstanceId.setupGetInstanceId();
44
45
  const translationKeys = {
@@ -52,11 +53,8 @@ const translationKeys = {
52
53
  unselectRow: 'carbon.table.row.unselect'
53
54
  };
54
55
 
55
- // TODO: All code comments in this file should be revisited for accuracy and
56
- // clarity.
57
-
58
56
  /**
59
- * Message ids that will be passed to translateWithId().
57
+ * Message IDs that will be passed to translateWithId().
60
58
  */
61
59
 
62
60
  const defaultTranslations = {
@@ -70,16 +68,26 @@ const defaultTranslations = {
70
68
  [translationKeys.unselectRow]: 'Unselect row'
71
69
  };
72
70
  const translateWithId = id => defaultTranslations[id];
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
+
80
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20071
81
+
73
82
  /**
74
- * Data Tables are used to represent a collection of resources, displaying a
75
- * subset of their fields in columns, or headers. We prioritize direct updates
76
- * to the state of what we're rendering, so internally we end up normalizing the
77
- * given data and then denormalizing it when rendering.
78
- *
79
- * As a result, each part of the DataTable is accessible through look-up by id,
80
- * and updating the state of the single entity will cascade updates to the
81
- * consumer.
83
+ * DataTable components are used to represent a collection of resources,
84
+ * displaying a subset of their fields in columns, or headers. We prioritize
85
+ * direct updates to the state of what we're rendering, so internally we
86
+ * normalize the given data and then denormalize it at render time. Each part of
87
+ * the DataTable is accessible through look-up by ID, and updating the state of
88
+ * a single entity cascades updates to the consumer.
82
89
  */
90
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20071
83
91
  const DataTable = props => {
84
92
  const {
85
93
  children,
@@ -100,24 +108,18 @@ const DataTable = props => {
100
108
  const instanceId = React.useMemo(() => getInstanceId(), []);
101
109
  const [state, setState] = React.useState(() => ({
102
110
  ...getDerivedStateFromProps.default(props, {}),
103
- isExpandedAll: false // Start with collapsed state, treat `undefined` as neutral state
111
+ // Initialize to collapsed. A value of `undefined` is treated as neutral.
112
+ isExpandedAll: false
104
113
  }));
105
114
  React.useEffect(() => {
106
115
  const nextRowIds = rows.map(row => row.id);
107
116
  const nextHeaders = headers.map(header => header.key);
108
117
  const hasRowIdsChanged = !isEqual(nextRowIds, state.rowIds);
109
- const currentHeaders = Object.keys(state.cellsById).reduce((acc, cellId) => {
110
- const headerKey = cellId.split(':')[1];
111
- if (headerKey && !acc.includes(headerKey)) {
112
- acc.push(headerKey);
113
- }
114
- return acc;
115
- }, []);
118
+ const currentHeaders = Array.from(new Set(Object.keys(state.cellsById).map(id => id.split(':')[1])));
116
119
  const hasHeadersChanged = !isEqual(nextHeaders, currentHeaders);
117
120
  const currentRows = state.rowIds.map(id => {
118
121
  const row = state.rowsById[id];
119
122
  return {
120
- // TODO: Investigate whether it be okay to just return `row`.
121
123
  id: row.id,
122
124
  disabled: row.disabled,
123
125
  isExpanded: row.isExpanded,
@@ -128,12 +130,8 @@ const DataTable = props => {
128
130
  if (hasRowIdsChanged || hasHeadersChanged || hasRowsChanged) {
129
131
  setState(prev => getDerivedStateFromProps.default(props, prev));
130
132
  }
133
+ // eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/20071
131
134
  }, [headers, rows]);
132
-
133
- /**
134
- * Get the props associated with the given header. Mostly used for adding in
135
- * sorting behavior.
136
- */
137
135
  const getHeaderProps = ({
138
136
  header,
139
137
  onClick,
@@ -144,33 +142,36 @@ const DataTable = props => {
144
142
  sortDirection,
145
143
  sortHeaderKey
146
144
  } = state;
145
+ const {
146
+ key,
147
+ slug,
148
+ decorator
149
+ } = header;
147
150
  return {
148
151
  ...rest,
149
- key: header.key,
152
+ key,
150
153
  sortDirection,
151
154
  isSortable,
152
- isSortHeader: sortHeaderKey === header.key,
153
- slug: header.slug,
154
- decorator: header.decorator,
155
+ isSortHeader: sortHeaderKey === key,
156
+ slug,
157
+ decorator,
155
158
  onClick: event => {
156
159
  const nextSortState = sorting.getNextSortState(props, state, {
157
- key: header.key
160
+ key
158
161
  });
159
162
  setState(prev => ({
160
163
  ...prev,
161
164
  ...nextSortState
162
165
  }));
163
- onClick && handleOnHeaderClick(onClick, {
164
- sortHeaderKey: header.key,
165
- sortDirection: nextSortState.sortDirection
166
- })(event);
166
+ if (onClick) {
167
+ handleOnHeaderClick(onClick, {
168
+ sortHeaderKey: key,
169
+ sortDirection: nextSortState.sortDirection
170
+ })(event);
171
+ }
167
172
  }
168
173
  };
169
174
  };
170
-
171
- /**
172
- * Get the props associated with the given expand header.
173
- */
174
175
  const getExpandHeaderProps = ({
175
176
  onClick,
176
177
  onExpand,
@@ -183,39 +184,35 @@ const DataTable = props => {
183
184
  } = state;
184
185
  const isExpanded = isExpandedAll || rowIds.every(id => rowsById[id].isExpanded);
185
186
  const translationKey = isExpanded ? translationKeys.collapseAll : translationKeys.expandAll;
187
+ const handlers = [handleOnExpandAll, onExpand];
188
+ if (onClick) {
189
+ handlers.push(handleOnExpandHeaderClick(onClick, {
190
+ isExpanded
191
+ }));
192
+ }
186
193
  return {
187
194
  ...rest,
188
195
  'aria-label': t(translationKey),
189
- // Provide a string of all the expanded row id's, separated by a space.
196
+ // Provide a string of all expanded row IDs, separated by a space.
190
197
  'aria-controls': rowIds.map(id => `expanded-row-${id}`).join(' '),
191
198
  isExpanded,
192
- // Compose the event handlers so we don't overwrite a consumer's `onClick`
193
- // handler
194
- onExpand: events.composeEventHandlers([handleOnExpandAll, onExpand,
195
- // TODO: Avoid passing `false` to this function.
196
- onClick && handleOnExpandHeaderClick(onClick, {
197
- isExpanded
198
- })])
199
+ onExpand: events.composeEventHandlers(handlers)
199
200
  };
200
201
  };
201
202
 
202
203
  /**
203
- * Decorate consumer's `onClick` event handler with sort parameters
204
+ * Wraps the consumer's `onClick` with sorting metadata.
204
205
  */
205
206
  const handleOnHeaderClick = (onClick, sortParams) => {
206
207
  return event => onClick(event, sortParams);
207
208
  };
208
209
 
209
210
  /**
210
- * Decorate consumer's `onClick` event handler with expand parameters
211
+ * Wraps the consumer's `onClick` with sorting metadata.
211
212
  */
212
213
  const handleOnExpandHeaderClick = (onClick, expandParams) => {
213
214
  return event => onClick(event, expandParams);
214
215
  };
215
-
216
- /**
217
- * Get the props associated with the given row. Mostly used for expansion.
218
- */
219
216
  const getRowProps = ({
220
217
  row,
221
218
  onClick,
@@ -236,10 +233,6 @@ const DataTable = props => {
236
233
  disabled: row.disabled
237
234
  };
238
235
  };
239
-
240
- /**
241
- * Get the props associated with an expanded row
242
- */
243
236
  const getExpandedRowProps = ({
244
237
  row,
245
238
  ...rest
@@ -251,9 +244,7 @@ const DataTable = props => {
251
244
  };
252
245
 
253
246
  /**
254
- * Gets the props associated with selection for a header or a row, where
255
- * applicable. Most often used to indicate selection status of the table or
256
- * for a specific row.
247
+ * Gets the props associated with selection for a header or a row.
257
248
  */
258
249
  const getSelectionProps = ({
259
250
  onClick,
@@ -278,7 +269,7 @@ const DataTable = props => {
278
269
  // Otherwise, we're working on `TableSelectAll` which handles toggling the
279
270
  // selection state of all rows.
280
271
  const rowCount = state.rowIds.length;
281
- const selectedRowCount = getSelectedRows().length;
272
+ const selectedRowCount = selectedRows.length;
282
273
  const checked = rowCount > 0 && selectedRowCount === rowCount;
283
274
  const indeterminate = rowCount > 0 && selectedRowCount > 0 && selectedRowCount !== rowCount;
284
275
  const translationKey = checked || indeterminate ? translationKeys.unselectAll : translationKeys.selectAll;
@@ -303,13 +294,13 @@ const DataTable = props => {
303
294
  const {
304
295
  shouldShowBatchActions
305
296
  } = state;
306
- const totalSelected = getSelectedRows().length;
297
+ const selectedRowCount = selectedRows.length;
307
298
  return {
308
299
  onSelectAll: undefined,
309
- totalCount: state.rowIds.length || 0,
300
+ totalCount: state.rowIds.length,
310
301
  ...props,
311
- shouldShowBatchActions: shouldShowBatchActions && totalSelected > 0,
312
- totalSelected,
302
+ shouldShowBatchActions: shouldShowBatchActions && selectedRowCount > 0,
303
+ totalSelected: selectedRowCount,
313
304
  onCancel: handleOnCancel
314
305
  };
315
306
  };
@@ -330,77 +321,49 @@ const DataTable = props => {
330
321
  useStaticWidth
331
322
  };
332
323
  };
333
-
334
- // TODO: `getHeaderProps` and `getRowProps` return `key` props. Would it be
335
- // beneficial for this function to also return a `key` prop?
336
- /**
337
- * Get the props associated with the given table cell.
338
- */
339
324
  const getCellProps = ({
340
325
  cell: {
341
326
  hasAILabelHeader,
342
- hasDecoratorHeader
327
+ id
343
328
  },
344
329
  ...rest
345
330
  }) => {
346
331
  return {
347
332
  ...rest,
348
333
  hasAILabelHeader,
349
- hasDecoratorHeader
334
+ key: id
350
335
  };
351
336
  };
352
337
 
353
338
  /**
354
- * Helper utility to get all the currently selected rows
355
- *
356
- * @returns the array of rowIds that are currently selected
339
+ * Selected row IDs, excluding disabled rows.
357
340
  */
358
- const getSelectedRows = () => state.rowIds.filter(id => {
341
+ const selectedRows = state.rowIds.filter(id => {
359
342
  const row = state.rowsById[id];
360
343
  return row.isSelected && !row.disabled;
361
344
  });
345
+ const filteredRowIds = typeof state.filterInputValue === 'string' ? filterRows({
346
+ cellsById: state.cellsById,
347
+ getCellId: cells.getCellId,
348
+ headers,
349
+ inputValue: state.filterInputValue,
350
+ rowIds: state.rowIds
351
+ }) : state.rowIds;
362
352
 
363
353
  /**
364
- * Helper utility to get all of the available rows after applying the filter
365
- *
366
- * @returns the array of rowIds that are currently included through the filter
367
- */
368
- const getFilteredRowIds = () => {
369
- const filteredRowIds = typeof state.filterInputValue === 'string' ? filterRows({
370
- rowIds: state.rowIds,
371
- headers: headers,
372
- cellsById: state.cellsById,
373
- inputValue: state.filterInputValue,
374
- getCellId: cells.getCellId
375
- }) : state.rowIds;
376
- // TODO: Use strict equality check.
377
- if (filteredRowIds.length == 0) {
378
- return [];
379
- }
380
- return filteredRowIds;
381
- };
382
-
383
- /**
384
- * Helper for getting the table prefix for elements that require an
385
- * `id` attribute that is unique.
354
+ * Generates a prefix for table related IDs.
386
355
  */
387
356
  const getTablePrefix = () => `data-table-${instanceId}`;
388
357
 
389
358
  /**
390
- * Helper for toggling all selected items in a state. Does not call
391
- * setState, so use it when setting state.
392
- *
393
- * @returns object to put into this.setState (use spread operator)
359
+ * Generates a new `rowsById` object with updated selection state.
394
360
  */
395
- const setAllSelectedState = (initialState, isSelected, filteredRowIds) => {
361
+ const getUpdatedSelectionState = (initialState, isSelected) => {
396
362
  const {
397
363
  rowIds
398
364
  } = initialState;
399
- // TODO: Use strict inequality check.
400
- const isFiltered = rowIds.length != filteredRowIds.length;
365
+ const isFiltered = rowIds.length !== filteredRowIds.length;
401
366
  return {
402
- // TODO: Should the `reduce` be typed with `<Record<string,
403
- // DataTableRow<ColTypes>>>`?
404
367
  rowsById: rowIds.reduce((acc, id) => {
405
368
  const row = {
406
369
  ...initialState.rowsById[id]
@@ -408,62 +371,59 @@ const DataTable = props => {
408
371
  if (!row.disabled && (!isFiltered || filteredRowIds.includes(id))) {
409
372
  row.isSelected = isSelected;
410
373
  }
411
- acc[id] = row; // Local mutation for performance with large tables
374
+
375
+ // Local mutation for performance with large tables
376
+ acc[id] = row;
412
377
  return acc;
413
378
  }, {})
414
379
  };
415
380
  };
416
381
 
417
382
  /**
418
- * Handler for the `onCancel` event to hide the batch action bar and
419
- * deselect all selected rows
383
+ * Handler for `onCancel` to hide the batch action toolbar and deselect all
384
+ * rows.
420
385
  */
421
386
  const handleOnCancel = () => {
422
387
  setState(prev => {
423
388
  return {
424
389
  ...prev,
425
390
  shouldShowBatchActions: false,
426
- ...setAllSelectedState(prev, false, getFilteredRowIds())
391
+ ...getUpdatedSelectionState(prev, false)
427
392
  };
428
393
  });
429
394
  };
430
395
 
431
396
  /**
432
- * Handler for toggling the selection state of all rows in the database
397
+ * Handler for toggling the selection state of all rows.
433
398
  */
434
399
  const handleSelectAll = () => {
435
400
  setState(prev => {
436
- const filteredRowIds = getFilteredRowIds();
437
401
  const {
438
402
  rowsById
439
403
  } = prev;
440
- const isSelected = !(Object.values(rowsById).filter(row => row.isSelected && !row.disabled).length > 0);
404
+ const isSelected = !Object.values(rowsById).filter(row => row.isSelected && !row.disabled).length;
441
405
  return {
442
406
  ...prev,
443
407
  shouldShowBatchActions: isSelected,
444
- ...setAllSelectedState(prev, isSelected, filteredRowIds)
408
+ ...getUpdatedSelectionState(prev, isSelected)
445
409
  };
446
410
  });
447
411
  };
448
412
 
449
413
  /**
450
- * Handler for toggling the selection state of a given row.
414
+ * Handler for toggling selection state of a given row.
451
415
  */
452
416
  const handleOnSelectRow = rowId => () => {
453
417
  setState(prev => {
454
418
  const row = prev.rowsById[rowId];
455
419
  if (radio) {
456
- // TODO:
457
- // 1. Should the `reduce` be typed with `<Record<string,
458
- // DataTableRow<ColTypes>>>`?
459
- // 2. Add better parameter names. Use `acc` and `row`.
460
- //
461
- // deselect all radio buttons
462
- const rowsById = Object.entries(prev.rowsById).reduce((p, c) => {
463
- const [key, val] = c;
464
- val.isSelected = false;
465
- p[key] = val;
466
- return p;
420
+ // Deselect all radio buttons, then toggle the target row
421
+ const rowsById = Object.entries(prev.rowsById).reduce((acc, [id, row]) => {
422
+ acc[id] = {
423
+ ...row,
424
+ isSelected: false
425
+ };
426
+ return acc;
467
427
  }, {});
468
428
  return {
469
429
  ...prev,
@@ -471,8 +431,8 @@ const DataTable = props => {
471
431
  rowsById: {
472
432
  ...rowsById,
473
433
  [rowId]: {
474
- ...row,
475
- isSelected: !row.isSelected
434
+ ...rowsById[rowId],
435
+ isSelected: !rowsById[rowId].isSelected
476
436
  }
477
437
  }
478
438
  };
@@ -482,10 +442,8 @@ const DataTable = props => {
482
442
  const selectedRowsCount = !row.isSelected ? selectedRows + 1 : selectedRows - 1;
483
443
  return {
484
444
  ...prev,
485
- // Basic assumption here is that we want to show the batch action bar if
486
- // the row is being selected. If it's being unselected, then see if we
487
- // have a non-zero number of selected rows that batch actions could
488
- // still apply to
445
+ // Show batch action toolbar if selecting, or if there are other
446
+ // selected rows remaining.
489
447
  shouldShowBatchActions: !row.isSelected || selectedRowsCount > 0,
490
448
  rowsById: {
491
449
  ...prev.rowsById,
@@ -497,10 +455,6 @@ const DataTable = props => {
497
455
  };
498
456
  });
499
457
  };
500
-
501
- /**
502
- * Handler for toggling the expansion state of a given row.
503
- */
504
458
  const handleOnExpandRow = rowId => () => {
505
459
  setState(prev => {
506
460
  const row = prev.rowsById[rowId];
@@ -520,10 +474,6 @@ const DataTable = props => {
520
474
  };
521
475
  });
522
476
  };
523
-
524
- /**
525
- * Handler for changing the expansion state of all rows.
526
- */
527
477
  const handleOnExpandAll = () => {
528
478
  setState(prev => {
529
479
  const {
@@ -533,22 +483,19 @@ const DataTable = props => {
533
483
  return {
534
484
  ...prev,
535
485
  isExpandedAll: !isExpandedAll,
536
- // TODO: Add generic to `reduce`.
537
- rowsById: rowIds.reduce((acc, id) => ({
538
- ...acc,
539
- [id]: {
486
+ rowsById: rowIds.reduce((acc, id) => {
487
+ acc[id] = {
540
488
  ...prev.rowsById[id],
541
489
  isExpanded: !isExpandedAll
542
- }
543
- }), {})
490
+ };
491
+ return acc;
492
+ }, {})
544
493
  };
545
494
  });
546
495
  };
547
496
 
548
497
  /**
549
- * Handler for transitioning to the next sort state of the table
550
- *
551
- * @param headerKey - The field for the header that we are sorting by.
498
+ * Transitions to the next sort state of the table.
552
499
  */
553
500
  const handleSortBy = headerKey => () => {
554
501
  setState(prev => {
@@ -564,37 +511,20 @@ const DataTable = props => {
564
511
  };
565
512
 
566
513
  /**
567
- * Event handler for transitioning input value state changes for the table
568
- * filter component.
514
+ * Event handler for table filter input changes.
569
515
  */
570
516
  const handleOnInputValueChange = (event, defaultValue) => {
571
- if (event.target) {
572
- setState(prev => ({
573
- ...prev,
574
- filterInputValue: event.target.value
575
- }));
576
- }
577
- if (defaultValue) {
578
- setState(prev => ({
579
- ...prev,
580
- filterInputValue: defaultValue
581
- }));
582
- }
517
+ const value = defaultValue || event.target?.value;
518
+ setState(prev => ({
519
+ ...prev,
520
+ filterInputValue: value
521
+ }));
583
522
  };
584
-
585
- // TODO: Could getFilteredRowIds be used here?
586
- const filteredRowIds = typeof state.filterInputValue === 'string' ? filterRows({
587
- rowIds: state.rowIds,
588
- headers,
589
- cellsById: state.cellsById,
590
- inputValue: state.filterInputValue,
591
- getCellId: cells.getCellId
592
- }) : state.rowIds;
593
523
  const renderProps = {
594
524
  // Data derived from state
595
525
  rows: denormalize.default(filteredRowIds, state.rowsById, state.cellsById),
596
526
  headers: headers,
597
- selectedRows: denormalize.default(getSelectedRows(), state.rowsById, state.cellsById),
527
+ selectedRows: denormalize.default(selectedRows, state.rowsById, state.cellsById),
598
528
  // Prop accessors/getters
599
529
  getHeaderProps,
600
530
  getExpandHeaderProps,
@@ -648,6 +578,10 @@ DataTable.TableToolbarContent = TableToolbarContent.default;
648
578
  DataTable.TableToolbarSearch = TableToolbarSearch.default;
649
579
  DataTable.TableToolbarMenu = TableToolbarMenu.default;
650
580
  DataTable.propTypes = {
581
+ /**
582
+ * Pass in the children that will be rendered within the Table
583
+ */
584
+ children: PropTypes.node,
651
585
  /**
652
586
  * 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
653
587
  */
@@ -683,6 +617,13 @@ DataTable.propTypes = {
683
617
  * Specify whether the control should be a radio button or inline checkbox
684
618
  */
685
619
  radio: PropTypes.bool,
620
+ /**
621
+ * @deprecated Use `children` instead. This prop will be removed in
622
+ * the next major version.
623
+ *
624
+ * https://www.patterns.dev/react/render-props-pattern/#children-as-a-function
625
+ */
626
+ render: deprecate.deprecate(PropTypes.func),
686
627
  /**
687
628
  * The `rows` prop is where you provide us with a list of all the rows that
688
629
  * you want to render in the table. The only hard requirement is that this
@@ -709,13 +650,13 @@ DataTable.propTypes = {
709
650
  */
710
651
  stickyHeader: PropTypes.bool,
711
652
  /**
712
- * Optional method that takes in a message id and returns an
653
+ * Optional method that takes in a message ID and returns an
713
654
  * internationalized string. See `DataTable.translationKeys` for all
714
- * available message ids.
655
+ * available message IDs.
715
656
  */
716
657
  translateWithId: PropTypes.func,
717
658
  /**
718
- * `false` If true, will use a width of 'auto' instead of 100%
659
+ * If `true`, sets the table width to `auto` instead of `100%`.
719
660
  */
720
661
  useStaticWidth: PropTypes.bool,
721
662
  /**
@@ -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
  /**
@@ -76,9 +76,11 @@ const Table = ({
76
76
  [`${prefix}--data-table--visible-overflow-menu`]: !overflowMenuOnHover
77
77
  });
78
78
  const toggleTableBodyAlignmentClass = React.useCallback((alignTop = false) => {
79
+ // eslint-disable-next-line @typescript-eslint/no-unused-expressions -- https://github.com/carbon-design-system/carbon/issues/20071
79
80
  alignTop ? tableRef.current?.classList.add(`${prefix}--data-table--top-aligned-body`) : tableRef.current?.classList.remove(`${prefix}--data-table--top-aligned-body`);
80
81
  }, [prefix]);
81
82
  const toggleTableHeaderAlignmentClass = React.useCallback((alignTop = false) => {
83
+ // eslint-disable-next-line @typescript-eslint/no-unused-expressions -- https://github.com/carbon-design-system/carbon/issues/20071
82
84
  alignTop ? tableRef.current?.classList.add(`${prefix}--data-table--top-aligned-header`) : tableRef.current?.classList.remove(`${prefix}--data-table--top-aligned-header`);
83
85
  }, [prefix]);
84
86
  const setTableAlignment = React.useCallback(() => {
@@ -128,9 +130,7 @@ const Table = ({
128
130
  setTableAlignment();
129
131
  }, [setTableAlignment, size]);
130
132
  const table = /*#__PURE__*/React.createElement("div", {
131
- className: `${prefix}--data-table-content`
132
- // eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex
133
- ,
133
+ className: `${prefix}--data-table-content`,
134
134
  tabIndex: tabIndex ?? (isScrollable ? 0 : undefined)
135
135
  }, /*#__PURE__*/React.createElement("table", _rollupPluginBabelHelpers.extends({
136
136
  "aria-labelledby": titleId,
@@ -170,7 +170,7 @@ Table.propTypes = {
170
170
  */
171
171
  stickyHeader: PropTypes.bool,
172
172
  /**
173
- * `false` If true, will use a width of 'auto' instead of 100%
173
+ * If `true`, sets the table width to `auto` instead of `100%`.
174
174
  */
175
175
  useStaticWidth: PropTypes.bool,
176
176
  /**
@@ -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
  */
@@ -91,11 +91,15 @@ TableExpandHeader.propTypes = {
91
91
  * Specify whether this row is expanded or not. This helps coordinate data
92
92
  * attributes so that `TableExpandRow` and `TableExpandedRow` work together
93
93
  */
94
- isExpanded: requiredIfGivenPropIsTruthy.default('enableToggle', PropTypes.bool),
94
+ isExpanded: requiredIfGivenPropIsTruthy.requiredIfGivenPropIsTruthy('enableToggle', PropTypes.bool),
95
95
  /**
96
96
  * Hook for when a listener initiates a request to expand the given row
97
97
  */
98
- onExpand: PropTypes.oneOfType([requiredIfGivenPropIsTruthy.default('enableExpando', PropTypes.func), requiredIfGivenPropIsTruthy.default('enableToggle', PropTypes.func)])
98
+ onExpand: PropTypes.oneOfType([requiredIfGivenPropIsTruthy.requiredIfGivenPropIsTruthy('enableExpando', PropTypes.func
99
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20071
100
+ ), requiredIfGivenPropIsTruthy.requiredIfGivenPropIsTruthy('enableToggle', PropTypes.func
101
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20071
102
+ )])
99
103
  };
100
104
 
101
105
  exports.default = TableExpandHeader;
@@ -96,6 +96,7 @@ TableExpandRow.propTypes = {
96
96
  * Specify the string read by a voice reader when the expand trigger is
97
97
  * focused
98
98
  */
99
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment -- https://github.com/carbon-design-system/carbon/issues/20071
99
100
  /**@ts-ignore*/
100
101
  'aria-label': PropTypes.string,
101
102
  /**
@@ -192,6 +192,8 @@ TableHeader.propTypes = {
192
192
  */
193
193
  translateWithId: PropTypes.func
194
194
  };
195
+
196
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20071
195
197
  TableHeader.translationKeys = Object.values(translationKeys);
196
198
  TableHeader.displayName = 'TableHeader';
197
199