@carbon/react 1.89.0 → 1.90.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 (262) hide show
  1. package/.playwright/INTERNAL_AVT_REPORT_DO_NOT_USE.json +877 -877
  2. package/README.md +2 -2
  3. package/es/components/AILabel/index.js +8 -6
  4. package/es/components/Breadcrumb/BreadcrumbItem.js +2 -0
  5. package/es/components/Button/Button.js +3 -0
  6. package/es/components/ChatButton/ChatButton.js +1 -0
  7. package/es/components/CheckboxGroup/CheckboxGroup.js +21 -2
  8. package/es/components/ComboBox/ComboBox.js +17 -1
  9. package/es/components/ComboButton/index.js +1 -0
  10. package/es/components/ComposedModal/ComposedModal.js +18 -4
  11. package/es/components/DataTable/DataTable.d.ts +3 -8
  12. package/es/components/DataTable/DataTable.js +14 -0
  13. package/es/components/DataTable/Table.js +3 -3
  14. package/es/components/DataTable/TableExpandHeader.js +5 -1
  15. package/es/components/DataTable/TableExpandRow.d.ts +33 -5
  16. package/es/components/DataTable/TableExpandRow.js +5 -2
  17. package/es/components/DataTable/TableHeader.d.ts +1 -2
  18. package/es/components/DataTable/TableHeader.js +3 -2
  19. package/es/components/DataTable/TableRow.d.ts +3 -6
  20. package/es/components/DataTable/TableRow.js +40 -22
  21. package/es/components/DataTable/TableSlugRow.js +1 -0
  22. package/es/components/DataTable/TableToolbarMenu.js +3 -0
  23. package/es/components/DataTable/state/sorting.d.ts +57 -14
  24. package/es/components/DataTable/state/sorting.js +42 -50
  25. package/es/components/DataTable/tools/sorting.js +5 -0
  26. package/es/components/DatePicker/DatePicker.js +14 -3
  27. package/es/components/DatePickerInput/DatePickerInput.js +6 -0
  28. package/es/components/Dialog/Dialog.js +10 -2
  29. package/es/components/Dropdown/Dropdown.js +16 -4
  30. package/es/components/ErrorBoundary/ErrorBoundaryContext.js +1 -0
  31. package/es/components/FileUploader/FileUploader.js +9 -2
  32. package/es/components/FileUploader/FileUploaderButton.js +1 -1
  33. package/es/components/FileUploader/FileUploaderDropContainer.js +1 -1
  34. package/es/components/FileUploader/FileUploaderItem.js +3 -0
  35. package/es/components/FluidMultiSelect/FluidMultiSelect.js +2 -0
  36. package/es/components/FluidNumberInput/FluidNumberInput.js +3 -2
  37. package/es/components/FluidSearch/FluidSearch.js +3 -2
  38. package/es/components/FluidSelect/FluidSelect.js +3 -2
  39. package/es/components/FluidTextInput/FluidTextInput.js +3 -2
  40. package/es/components/FluidTimePicker/FluidTimePicker.js +11 -4
  41. package/es/components/FluidTimePickerSelect/FluidTimePickerSelect.js +3 -2
  42. package/es/components/Grid/CSSGrid.js +5 -0
  43. package/es/components/Grid/Column.js +3 -0
  44. package/es/components/Grid/ColumnHang.js +1 -0
  45. package/es/components/Grid/FlexGrid.js +1 -0
  46. package/es/components/Grid/Row.js +1 -0
  47. package/es/components/Heading/index.js +3 -1
  48. package/es/components/IconButton/index.js +4 -2
  49. package/es/components/IconIndicator/index.js +4 -2
  50. package/es/components/InlineCheckbox/InlineCheckbox.js +3 -2
  51. package/es/components/Layout/index.js +6 -4
  52. package/es/components/LayoutDirection/LayoutDirection.js +2 -0
  53. package/es/components/Link/Link.js +3 -0
  54. package/es/components/ListBox/ListBoxMenuItem.js +4 -1
  55. package/es/components/ListBox/next/ListBoxTrigger.js +3 -2
  56. package/es/components/Menu/Menu.js +6 -9
  57. package/es/components/Menu/MenuContext.js +1 -0
  58. package/es/components/Menu/MenuItem.js +5 -13
  59. package/es/components/MenuButton/index.js +7 -2
  60. package/es/components/Modal/Modal.js +15 -6
  61. package/es/components/ModalWrapper/ModalWrapper.js +2 -0
  62. package/es/components/MultiSelect/FilterableMultiSelect.js +24 -5
  63. package/es/components/MultiSelect/MultiSelect.js +21 -5
  64. package/es/components/Notification/Notification.js +1 -1
  65. package/es/components/NumberInput/NumberInput.js +18 -7
  66. package/es/components/OverflowMenu/OverflowMenu.js +2 -0
  67. package/es/components/OverflowMenu/next/index.js +3 -2
  68. package/es/components/OverflowMenuItem/OverflowMenuItem.js +2 -0
  69. package/es/components/PageHeader/PageHeader.d.ts +3 -3
  70. package/es/components/PageHeader/PageHeader.js +22 -8
  71. package/es/components/Pagination/Pagination.js +6 -2
  72. package/es/components/PaginationNav/PaginationNav.js +2 -5
  73. package/es/components/Popover/index.js +20 -6
  74. package/es/components/ProgressBar/ProgressBar.js +4 -2
  75. package/es/components/RadioTile/RadioTile.js +2 -2
  76. package/es/components/Search/Search.js +2 -2
  77. package/es/components/Select/Select.js +2 -3
  78. package/es/components/ShapeIndicator/index.js +4 -2
  79. package/es/components/SkeletonPlaceholder/SkeletonPlaceholder.d.ts +4 -4
  80. package/es/components/SkeletonPlaceholder/SkeletonPlaceholder.js +1 -2
  81. package/es/components/SkeletonText/SkeletonText.js +0 -2
  82. package/es/components/Slider/Slider.js +11 -16
  83. package/es/components/Stack/HStack.js +1 -0
  84. package/es/components/Stack/Stack.js +6 -9
  85. package/es/components/Stack/VStack.js +1 -0
  86. package/es/components/StructuredList/StructuredList.js +3 -0
  87. package/es/components/Switch/Switch.js +1 -1
  88. package/es/components/Tabs/Tabs.js +28 -17
  89. package/es/components/Tag/DismissibleTag.d.ts +5 -0
  90. package/es/components/Tag/DismissibleTag.js +8 -1
  91. package/es/components/Tag/OperationalTag.js +2 -0
  92. package/es/components/Tag/SelectableTag.js +2 -0
  93. package/es/components/Tag/Tag.js +4 -0
  94. package/es/components/Tag/isEllipsisActive.js +1 -0
  95. package/es/components/Text/Text.js +1 -0
  96. package/es/components/TextInput/ControlledPasswordInput.js +2 -4
  97. package/es/components/TextInput/PasswordInput.js +7 -2
  98. package/es/components/TextInput/TextInput.js +4 -2
  99. package/es/components/Theme/index.js +8 -3
  100. package/es/components/Tile/Tile.js +14 -17
  101. package/es/components/TimePicker/TimePicker.js +1 -0
  102. package/es/components/Toggle/Toggle.js +1 -1
  103. package/es/components/Toggletip/index.js +23 -8
  104. package/es/components/Tooltip/DefinitionTooltip.js +1 -0
  105. package/es/components/Tooltip/Tooltip.js +30 -23
  106. package/es/components/TreeView/TreeNode.d.ts +28 -0
  107. package/es/components/TreeView/TreeNode.js +19 -10
  108. package/es/components/TreeView/TreeView.js +7 -0
  109. package/es/components/UIShell/HeaderContainer.js +3 -1
  110. package/es/components/UIShell/HeaderGlobalAction.js +2 -2
  111. package/es/components/UIShell/HeaderMenu.js +3 -3
  112. package/es/components/UIShell/HeaderPanel.js +2 -2
  113. package/es/components/UIShell/Link.js +2 -0
  114. package/es/components/UIShell/SideNavItems.js +1 -0
  115. package/es/components/UIShell/SideNavMenu.js +2 -2
  116. package/es/components/UIShell/SideNavMenuItem.js +1 -1
  117. package/es/components/UIShell/SideNavSwitcher.js +1 -1
  118. package/es/components/UIShell/Switcher.js +2 -1
  119. package/es/components/UIShell/SwitcherItem.js +4 -2
  120. package/es/internal/FloatingMenu.js +7 -1
  121. package/es/internal/Selection.js +12 -3
  122. package/es/internal/useMergedRefs.js +1 -0
  123. package/es/internal/useNoInteractiveChildren.js +4 -0
  124. package/es/internal/useOutsideClick.js +1 -0
  125. package/es/internal/useOverflowItems.js +6 -0
  126. package/es/internal/useResizeObserver.js +4 -0
  127. package/es/internal/useSavedCallback.js +1 -0
  128. package/es/internal/warning.js +1 -0
  129. package/es/prop-types/isRequiredOneOf.js +4 -1
  130. package/es/tools/events.js +3 -1
  131. package/es/tools/wrapComponent.js +1 -0
  132. package/lib/components/AILabel/index.js +8 -6
  133. package/lib/components/Breadcrumb/BreadcrumbItem.js +2 -0
  134. package/lib/components/Button/Button.js +3 -0
  135. package/lib/components/ChatButton/ChatButton.js +1 -0
  136. package/lib/components/CheckboxGroup/CheckboxGroup.js +20 -1
  137. package/lib/components/ComboBox/ComboBox.js +17 -1
  138. package/lib/components/ComboButton/index.js +1 -0
  139. package/lib/components/ComposedModal/ComposedModal.js +18 -4
  140. package/lib/components/DataTable/DataTable.d.ts +3 -8
  141. package/lib/components/DataTable/DataTable.js +14 -0
  142. package/lib/components/DataTable/Table.js +3 -3
  143. package/lib/components/DataTable/TableExpandHeader.js +5 -1
  144. package/lib/components/DataTable/TableExpandRow.d.ts +33 -5
  145. package/lib/components/DataTable/TableExpandRow.js +5 -2
  146. package/lib/components/DataTable/TableHeader.d.ts +1 -2
  147. package/lib/components/DataTable/TableHeader.js +3 -2
  148. package/lib/components/DataTable/TableRow.d.ts +3 -6
  149. package/lib/components/DataTable/TableRow.js +39 -21
  150. package/lib/components/DataTable/TableSlugRow.js +1 -0
  151. package/lib/components/DataTable/TableToolbarMenu.js +3 -0
  152. package/lib/components/DataTable/state/sorting.d.ts +57 -14
  153. package/lib/components/DataTable/state/sorting.js +41 -50
  154. package/lib/components/DataTable/tools/sorting.js +5 -0
  155. package/lib/components/DatePicker/DatePicker.js +14 -3
  156. package/lib/components/DatePickerInput/DatePickerInput.js +6 -0
  157. package/lib/components/Dialog/Dialog.js +10 -2
  158. package/lib/components/Dropdown/Dropdown.js +16 -4
  159. package/lib/components/ErrorBoundary/ErrorBoundaryContext.js +1 -0
  160. package/lib/components/FileUploader/FileUploader.js +9 -2
  161. package/lib/components/FileUploader/FileUploaderButton.js +1 -1
  162. package/lib/components/FileUploader/FileUploaderDropContainer.js +1 -1
  163. package/lib/components/FileUploader/FileUploaderItem.js +3 -0
  164. package/lib/components/FluidMultiSelect/FluidMultiSelect.js +2 -0
  165. package/lib/components/FluidNumberInput/FluidNumberInput.js +3 -2
  166. package/lib/components/FluidSearch/FluidSearch.js +3 -2
  167. package/lib/components/FluidSelect/FluidSelect.js +3 -2
  168. package/lib/components/FluidTextInput/FluidTextInput.js +3 -2
  169. package/lib/components/FluidTimePicker/FluidTimePicker.js +11 -4
  170. package/lib/components/FluidTimePickerSelect/FluidTimePickerSelect.js +3 -2
  171. package/lib/components/Grid/CSSGrid.js +5 -0
  172. package/lib/components/Grid/Column.js +3 -0
  173. package/lib/components/Grid/ColumnHang.js +1 -0
  174. package/lib/components/Grid/FlexGrid.js +1 -0
  175. package/lib/components/Grid/Row.js +1 -0
  176. package/lib/components/Heading/index.js +3 -1
  177. package/lib/components/IconButton/index.js +4 -2
  178. package/lib/components/IconIndicator/index.js +4 -2
  179. package/lib/components/InlineCheckbox/InlineCheckbox.js +3 -2
  180. package/lib/components/Layout/index.js +6 -4
  181. package/lib/components/LayoutDirection/LayoutDirection.js +2 -0
  182. package/lib/components/Link/Link.js +3 -0
  183. package/lib/components/ListBox/ListBoxMenuItem.js +4 -1
  184. package/lib/components/ListBox/next/ListBoxTrigger.js +3 -2
  185. package/lib/components/Menu/Menu.js +6 -9
  186. package/lib/components/Menu/MenuContext.js +1 -0
  187. package/lib/components/Menu/MenuItem.js +5 -13
  188. package/lib/components/MenuButton/index.js +7 -2
  189. package/lib/components/Modal/Modal.js +15 -6
  190. package/lib/components/ModalWrapper/ModalWrapper.js +2 -0
  191. package/lib/components/MultiSelect/FilterableMultiSelect.js +24 -5
  192. package/lib/components/MultiSelect/MultiSelect.js +21 -5
  193. package/lib/components/Notification/Notification.js +1 -1
  194. package/lib/components/NumberInput/NumberInput.js +17 -6
  195. package/lib/components/OverflowMenu/OverflowMenu.js +2 -0
  196. package/lib/components/OverflowMenu/next/index.js +3 -2
  197. package/lib/components/OverflowMenuItem/OverflowMenuItem.js +2 -0
  198. package/lib/components/PageHeader/PageHeader.d.ts +3 -3
  199. package/lib/components/PageHeader/PageHeader.js +22 -8
  200. package/lib/components/Pagination/Pagination.js +6 -2
  201. package/lib/components/PaginationNav/PaginationNav.js +2 -5
  202. package/lib/components/Popover/index.js +20 -6
  203. package/lib/components/ProgressBar/ProgressBar.js +4 -2
  204. package/lib/components/RadioTile/RadioTile.js +2 -2
  205. package/lib/components/Search/Search.js +2 -2
  206. package/lib/components/Select/Select.js +2 -3
  207. package/lib/components/ShapeIndicator/index.js +4 -2
  208. package/lib/components/SkeletonPlaceholder/SkeletonPlaceholder.d.ts +4 -4
  209. package/lib/components/SkeletonPlaceholder/SkeletonPlaceholder.js +1 -2
  210. package/lib/components/SkeletonText/SkeletonText.js +0 -2
  211. package/lib/components/Slider/Slider.js +11 -16
  212. package/lib/components/Stack/HStack.js +1 -0
  213. package/lib/components/Stack/Stack.js +6 -9
  214. package/lib/components/Stack/VStack.js +1 -0
  215. package/lib/components/StructuredList/StructuredList.js +3 -0
  216. package/lib/components/Switch/Switch.js +1 -1
  217. package/lib/components/Tabs/Tabs.js +28 -17
  218. package/lib/components/Tag/DismissibleTag.d.ts +5 -0
  219. package/lib/components/Tag/DismissibleTag.js +8 -1
  220. package/lib/components/Tag/OperationalTag.js +2 -0
  221. package/lib/components/Tag/SelectableTag.js +2 -0
  222. package/lib/components/Tag/Tag.js +4 -0
  223. package/lib/components/Tag/isEllipsisActive.js +1 -0
  224. package/lib/components/Text/Text.js +1 -0
  225. package/lib/components/TextInput/ControlledPasswordInput.js +2 -4
  226. package/lib/components/TextInput/PasswordInput.js +7 -2
  227. package/lib/components/TextInput/TextInput.js +4 -2
  228. package/lib/components/Theme/index.js +8 -3
  229. package/lib/components/Tile/Tile.js +14 -17
  230. package/lib/components/TimePicker/TimePicker.js +1 -0
  231. package/lib/components/Toggle/Toggle.js +1 -1
  232. package/lib/components/Toggletip/index.js +22 -7
  233. package/lib/components/Tooltip/DefinitionTooltip.js +1 -0
  234. package/lib/components/Tooltip/Tooltip.js +30 -23
  235. package/lib/components/TreeView/TreeNode.d.ts +28 -0
  236. package/lib/components/TreeView/TreeNode.js +19 -10
  237. package/lib/components/TreeView/TreeView.js +7 -0
  238. package/lib/components/UIShell/HeaderContainer.js +3 -1
  239. package/lib/components/UIShell/HeaderGlobalAction.js +2 -2
  240. package/lib/components/UIShell/HeaderMenu.js +3 -3
  241. package/lib/components/UIShell/HeaderPanel.js +2 -2
  242. package/lib/components/UIShell/Link.js +2 -0
  243. package/lib/components/UIShell/SideNavItems.js +1 -0
  244. package/lib/components/UIShell/SideNavMenu.js +2 -2
  245. package/lib/components/UIShell/SideNavMenuItem.js +1 -1
  246. package/lib/components/UIShell/SideNavSwitcher.js +1 -1
  247. package/lib/components/UIShell/Switcher.js +2 -1
  248. package/lib/components/UIShell/SwitcherItem.js +4 -2
  249. package/lib/internal/FloatingMenu.js +7 -1
  250. package/lib/internal/Selection.js +12 -3
  251. package/lib/internal/useMergedRefs.js +1 -0
  252. package/lib/internal/useNoInteractiveChildren.js +4 -0
  253. package/lib/internal/useOutsideClick.js +1 -0
  254. package/lib/internal/useOverflowItems.js +6 -0
  255. package/lib/internal/useResizeObserver.js +4 -0
  256. package/lib/internal/useSavedCallback.js +1 -0
  257. package/lib/internal/warning.js +1 -0
  258. package/lib/prop-types/isRequiredOneOf.js +4 -1
  259. package/lib/tools/events.js +3 -1
  260. package/lib/tools/wrapComponent.js +1 -0
  261. package/package.json +11 -11
  262. package/telemetry.yml +14 -0
@@ -70,6 +70,17 @@ const defaultTranslations = {
70
70
  [translationKeys.unselectRow]: 'Unselect row'
71
71
  };
72
72
  const translateWithId = id => defaultTranslations[id];
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
+
82
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20071
83
+
73
84
  /**
74
85
  * Data Tables are used to represent a collection of resources, displaying a
75
86
  * subset of their fields in columns, or headers. We prioritize direct updates
@@ -80,6 +91,7 @@ const translateWithId = id => defaultTranslations[id];
80
91
  * and updating the state of the single entity will cascade updates to the
81
92
  * consumer.
82
93
  */
94
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20071
83
95
  const DataTable = props => {
84
96
  const {
85
97
  children,
@@ -128,6 +140,7 @@ const DataTable = props => {
128
140
  if (hasRowIdsChanged || hasHeadersChanged || hasRowsChanged) {
129
141
  setState(prev => getDerivedStateFromProps.default(props, prev));
130
142
  }
143
+ // eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/20071
131
144
  }, [headers, rows]);
132
145
 
133
146
  /**
@@ -160,6 +173,7 @@ const DataTable = props => {
160
173
  ...prev,
161
174
  ...nextSortState
162
175
  }));
176
+ // eslint-disable-next-line @typescript-eslint/no-unused-expressions -- https://github.com/carbon-design-system/carbon/issues/20071
163
177
  onClick && handleOnHeaderClick(onClick, {
164
178
  sortHeaderKey: header.key,
165
179
  sortDirection: nextSortState.sortDirection
@@ -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,
@@ -95,7 +95,11 @@ TableExpandHeader.propTypes = {
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.default('enableExpando', PropTypes.func
99
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20071
100
+ ), requiredIfGivenPropIsTruthy.default('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;
@@ -4,13 +4,41 @@
4
4
  * This source code is licensed under the Apache-2.0 license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
- import React, { type MouseEventHandler, type PropsWithChildren } from 'react';
8
- import { TableRowProps } from './TableRow';
9
- export interface TableExpandRowProps extends PropsWithChildren<TableRowProps> {
7
+ import React, { type HTMLAttributes, type MouseEventHandler, type PropsWithChildren } from 'react';
8
+ /** Props shared between `TableRow` and `TableExpandRow`. */
9
+ export interface TableRowExpandInteropProps {
10
+ /**
11
+ * @deprecated Use `aria-label` instead.
12
+ */
13
+ ariaLabel?: string;
14
+ /**
15
+ * Specify the string read by a voice reader when the expand trigger is
16
+ * focused
17
+ */
18
+ 'aria-label'?: string;
19
+ /**
20
+ * Space separated list of one or more ID values referencing the TableExpandedRow(s) being controlled by the TableExpandRow
21
+ */
22
+ 'aria-controls'?: string;
23
+ /**
24
+ * Specify whether this row is expanded or not. This helps coordinate data
25
+ * attributes so that `TableExpandRow` and `TableExpandedRow` work together
26
+ */
27
+ isExpanded?: boolean;
28
+ /**
29
+ * Hook for when a listener initiates a request to expand the given row
30
+ */
31
+ onExpand?: MouseEventHandler<HTMLButtonElement>;
32
+ /**
33
+ * Specify if the row is selected.
34
+ */
35
+ isSelected?: boolean;
36
+ }
37
+ export interface TableExpandRowProps extends PropsWithChildren<Omit<HTMLAttributes<HTMLTableRowElement>, 'onClick'>>, Omit<TableRowExpandInteropProps, 'aria-label' | 'onExpand'> {
10
38
  /**
11
39
  * Space separated list of one or more ID values referencing the TableExpandedRow(s) being controlled by the TableExpandRow
12
40
  */
13
- ['aria-controls']?: string;
41
+ 'aria-controls'?: string;
14
42
  /**
15
43
  * @deprecated This prop has been deprecated and will be
16
44
  * removed in the next major release of Carbon. Use the
@@ -21,7 +49,7 @@ export interface TableExpandRowProps extends PropsWithChildren<TableRowProps> {
21
49
  * Specify the string read by a voice reader when the expand trigger is
22
50
  * focused
23
51
  */
24
- ['aria-label']: string;
52
+ 'aria-label': string;
25
53
  /**
26
54
  * The id of the matching th node in the table head. Addresses a11y concerns outlined here: https://www.ibm.com/able/guidelines/ci162/info_and_relationships.html and https://www.w3.org/TR/WCAG20-TECHS/H43
27
55
  */
@@ -21,6 +21,8 @@ var TableDecoratorRow = require('./TableDecoratorRow.js');
21
21
  var index = require('../AILabel/index.js');
22
22
  var utils = require('../../internal/utils.js');
23
23
 
24
+ /** Props shared between `TableRow` and `TableExpandRow`. */
25
+
24
26
  const TableExpandRow = /*#__PURE__*/React.forwardRef(({
25
27
  ['aria-controls']: ariaControls,
26
28
  ['aria-label']: ariaLabel,
@@ -89,13 +91,14 @@ TableExpandRow.propTypes = {
89
91
  * Space separated list of one or more ID values referencing the TableExpandedRow(s) being controlled by the TableExpandRow
90
92
  * TODO: make this required in v12
91
93
  */
92
- ['aria-controls']: PropTypes.string,
94
+ 'aria-controls': PropTypes.string,
93
95
  /**
94
96
  * Specify the string read by a voice reader when the expand trigger is
95
97
  * focused
96
98
  */
99
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment -- https://github.com/carbon-design-system/carbon/issues/20071
97
100
  /**@ts-ignore*/
98
- ['aria-label']: PropTypes.string,
101
+ 'aria-label': PropTypes.string,
99
102
  /**
100
103
  * Deprecated, please use `aria-label` instead.
101
104
  * Specify the string read by a voice reader when the expand trigger is
@@ -5,9 +5,8 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
  import React, { type HTMLAttributes, type MouseEventHandler, type ReactNode } from 'react';
8
- import { sortStates } from './state/sorting';
9
8
  import { TranslateWithId } from '../../types/common';
10
- import { DataTableSortState } from './state/sortStates';
9
+ import { sortStates, type DataTableSortState } from './state/sortStates';
11
10
  export type TableHeaderTranslationKey = 'carbon.table.header.icon.description';
12
11
  export interface TableHeaderTranslationArgs {
13
12
  header: ReactNode;
@@ -14,12 +14,11 @@ var cx = require('classnames');
14
14
  var PropTypes = require('prop-types');
15
15
  var React = require('react');
16
16
  var iconsReact = require('@carbon/icons-react');
17
- require('./state/sorting.js');
18
17
  var useId = require('../../internal/useId.js');
19
18
  var usePrefix = require('../../internal/usePrefix.js');
19
+ var sortStates = require('./state/sortStates.js');
20
20
  var index = require('../AILabel/index.js');
21
21
  var utils = require('../../internal/utils.js');
22
- var sortStates = require('./state/sortStates.js');
23
22
 
24
23
  const defaultScope = 'col';
25
24
  const translationKeys = {
@@ -193,6 +192,8 @@ TableHeader.propTypes = {
193
192
  */
194
193
  translateWithId: PropTypes.func
195
194
  };
195
+
196
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20071
196
197
  TableHeader.translationKeys = Object.values(translationKeys);
197
198
  TableHeader.displayName = 'TableHeader';
198
199
 
@@ -5,15 +5,12 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
  import React, { type HTMLAttributes } from 'react';
8
- export interface TableRowProps extends HTMLAttributes<HTMLTableRowElement> {
8
+ import type { TableRowExpandInteropProps } from './TableExpandRow';
9
+ export interface TableRowProps extends HTMLAttributes<HTMLTableRowElement>, TableRowExpandInteropProps {
9
10
  /**
10
11
  * Specify an optional className to be applied to the container node
11
12
  */
12
13
  className?: string;
13
- /**
14
- * Specify if the row is selected
15
- */
16
- isSelected?: boolean;
17
14
  }
18
- declare const TableRow: React.ForwardRefExoticComponent<TableRowProps & React.RefAttributes<HTMLTableCellElement>>;
15
+ declare const TableRow: React.ForwardRefExoticComponent<TableRowProps & React.RefAttributes<HTMLTableRowElement>>;
19
16
  export default TableRow;
@@ -19,37 +19,35 @@ var TableDecoratorRow = require('./TableDecoratorRow.js');
19
19
  var index = require('../AILabel/index.js');
20
20
  var utils = require('../../internal/utils.js');
21
21
 
22
- const TableRow = /*#__PURE__*/React.forwardRef((props, ref) => {
23
- const prefix = usePrefix.usePrefix();
24
- let rowHasAILabel;
25
- if (props?.children) {
26
- // TODO: Why is this loop a `map`? It's not returning anything. Ideally,
27
- // it seems that it should be a `some`. Maybe I'm missing something?
28
- React.Children.toArray(props.children).map(child => {
29
- if (utils.isComponentElement(child, TableSlugRow.default)) {
30
- if (child.props.slug) {
31
- rowHasAILabel = true;
32
- }
33
- } else if (utils.isComponentElement(child, TableDecoratorRow.default) && utils.isComponentElement(child.props.decorator, index.AILabel)) {
34
- rowHasAILabel = true;
35
- }
36
- });
37
- }
22
+ const frFn = React.forwardRef;
23
+ const TableRow = frFn((props, ref) => {
38
24
  // Remove unnecessary props if provided to this component, these are
39
25
  // only useful in `TableExpandRow`
40
- const className = cx(props.className, {
41
- [`${prefix}--data-table--selected`]: props.isSelected,
42
- [`${prefix}--data-table--slug-row ${prefix}--data-table--ai-label-row`]: rowHasAILabel
43
- });
44
26
  const {
45
27
  ariaLabel,
28
+ // eslint-disable-line @typescript-eslint/no-unused-vars -- https://github.com/carbon-design-system/carbon/issues/20071
46
29
  'aria-label': ariaLabelAlt,
30
+ // eslint-disable-line @typescript-eslint/no-unused-vars -- https://github.com/carbon-design-system/carbon/issues/20071
47
31
  'aria-controls': ariaControls,
32
+ // eslint-disable-line @typescript-eslint/no-unused-vars -- https://github.com/carbon-design-system/carbon/issues/20071
48
33
  onExpand,
34
+ // eslint-disable-line @typescript-eslint/no-unused-vars -- https://github.com/carbon-design-system/carbon/issues/20071
49
35
  isExpanded,
36
+ // eslint-disable-line @typescript-eslint/no-unused-vars -- https://github.com/carbon-design-system/carbon/issues/20071
50
37
  isSelected,
51
38
  ...cleanProps
52
39
  } = props;
40
+ const prefix = usePrefix.usePrefix();
41
+ const rowHasAILabel = React.Children.toArray(props.children).some(child => {
42
+ if (utils.isComponentElement(child, TableSlugRow.default)) {
43
+ return !!child.props.slug;
44
+ }
45
+ return utils.isComponentElement(child, TableDecoratorRow.default) && utils.isComponentElement(child.props.decorator, index.AILabel);
46
+ });
47
+ const className = cx(props.className, {
48
+ [`${prefix}--data-table--selected`]: isSelected,
49
+ [`${prefix}--data-table--slug-row ${prefix}--data-table--ai-label-row`]: rowHasAILabel
50
+ });
53
51
  if (className) {
54
52
  cleanProps.className = className;
55
53
  }
@@ -65,7 +63,27 @@ TableRow.propTypes = {
65
63
  /**
66
64
  * Specify if the row is selected
67
65
  */
68
- isSelected: PropTypes.bool
66
+ isSelected: PropTypes.bool,
67
+ /**
68
+ * Non-standard alias for `aria-label`.
69
+ */
70
+ ariaLabel: PropTypes.string,
71
+ /**
72
+ * Accessible label for the row element.
73
+ */
74
+ 'aria-label': PropTypes.string,
75
+ /**
76
+ * Associates this row with the id of the corresponding expanded row content.
77
+ */
78
+ 'aria-controls': PropTypes.string,
79
+ /**
80
+ * Handler called when the row’s expand toggle is clicked.
81
+ */
82
+ onExpand: PropTypes.func,
83
+ /**
84
+ * Flag indicating whether the row is currently expanded.
85
+ */
86
+ isExpanded: PropTypes.bool
69
87
  };
70
88
 
71
89
  exports.default = TableRow;
@@ -34,6 +34,7 @@ const TableSlugRow = ({
34
34
  // Slug is always size `mini`
35
35
  let normalizedSlug;
36
36
  if (slug) {
37
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20071
37
38
  normalizedSlug = /*#__PURE__*/React.cloneElement(slug, {
38
39
  size: 'mini'
39
40
  });
@@ -18,6 +18,9 @@ var usePrefix = require('../../internal/usePrefix.js');
18
18
  var index = require('../OverflowMenu/index.js');
19
19
 
20
20
  const defaultIconDescription = 'Settings';
21
+
22
+ // eslint-disable-next-line @typescript-eslint/no-empty-object-type -- https://github.com/carbon-design-system/carbon/issues/20071
23
+
21
24
  const TableToolbarMenu = ({
22
25
  className,
23
26
  renderIcon = iconsReact.Settings,
@@ -1,15 +1,58 @@
1
- export { sortStates };
2
- export const initialSortState: import("./sortStates").DataTableSortState;
3
- export function getNextSortDirection(prevHeader: string, header: string, prevState: string): string;
4
- export function getNextSortState(props: any, state: any, { key }: {
5
- key: any;
6
- }): any;
7
- export function getSortedState(props: {
1
+ /**
2
+ * Copyright IBM Corp. 2016, 2025
3
+ *
4
+ * This source code is licensed under the Apache-2.0 license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+ import { type DataTableSortState } from './sortStates';
8
+ import type { DataTableCell } from '../DataTable';
9
+ export interface SortRowParams {
10
+ key: string;
11
+ sortDirection: DataTableSortState;
12
+ sortStates: Record<DataTableSortState, DataTableSortState>;
8
13
  locale: string;
9
- sortRows: Function;
10
- }, state: {
11
- rowIds: Array<string>;
12
- cellsById: object;
13
- initialRowOrder: Array<string>;
14
- }, key: string, sortDirection: string): object;
15
- import { sortStates } from './sortStates';
14
+ compare: (a: string | number, b: string | number, locale?: string) => number;
15
+ }
16
+ export type SortRowFn = (cellA: any, // eslint-disable-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20071
17
+ cellB: any, // eslint-disable-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20071
18
+ options: SortRowParams) => number;
19
+ interface Props {
20
+ locale?: string;
21
+ sortRow?: SortRowFn;
22
+ }
23
+ interface State<ColTypes extends any[]> {
24
+ rowIds: string[];
25
+ cellsById: Record<string, DataTableCell<ColTypes[number]>>;
26
+ initialRowOrder: string[];
27
+ sortHeaderKey: string | null;
28
+ sortDirection: DataTableSortState;
29
+ }
30
+ export declare const initialSortState: DataTableSortState;
31
+ /**
32
+ * Gets the next sort direction for a header.
33
+ *
34
+ * @param prevHeader - Key of the previously sorted header.
35
+ * @param currentHeader - Key of the currently selected header.
36
+ * @param prevState - Previous sort direction.
37
+ */
38
+ export declare const getNextSortDirection: (prevHeader: string, currentHeader: string, prevState: DataTableSortState) => DataTableSortState;
39
+ /**
40
+ * Gets the next sort state.
41
+ *
42
+ * @param props - Component props.
43
+ * @param state - Current table state.
44
+ * @param key - Header key to sort by.
45
+ */
46
+ export declare const getNextSortState: <ColTypes extends any[]>(props: Props, state: State<ColTypes>, { key }: {
47
+ key: string;
48
+ }) => Pick<State<ColTypes>, "sortHeaderKey" | "sortDirection" | "rowIds">;
49
+ /**
50
+ * Gets a sort state update.
51
+ *
52
+ * @param props - Component props.
53
+ * @param state - Current state of the table.
54
+ * @param key - Header key to sort by.
55
+ * @param sortDirection - Sort direction to apply.
56
+ */
57
+ export declare const getSortedState: <ColTypes extends any[]>({ locale, sortRow }: Props, { rowIds, cellsById, initialRowOrder }: State<ColTypes>, key: string, sortDirection: DataTableSortState) => Pick<State<ColTypes>, "rowIds" | "sortDirection" | "sortHeaderKey">;
58
+ export {};
@@ -10,37 +10,41 @@
10
10
  var sortStates = require('./sortStates.js');
11
11
  var sorting = require('../tools/sorting.js');
12
12
 
13
- // Our initialSortState should be `NONE`, unless a consumer has specified a
14
- // different initialSortState
13
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20071
14
+
15
15
  const initialSortState = sortStates.sortStates.NONE;
16
16
 
17
17
  /**
18
- * Utility used to get the next sort state given the following pieces of
19
- * information:
18
+ * Gets the next sort direction for a header.
20
19
  *
21
- * @param {string} prevHeader the value of the previous header
22
- * @param {string} header the value of the currently selected header
23
- * @param {string} prevState the previous sort state of the table
24
- * @returns {string}
20
+ * @param prevHeader - Key of the previously sorted header.
21
+ * @param currentHeader - Key of the currently selected header.
22
+ * @param prevState - Previous sort direction.
25
23
  */
26
- const getNextSortDirection = (prevHeader, header, prevState) => {
27
- // If the previous header is equivalent to the current header, we know that we
28
- // have to derive the next sort state from the previous sort state
29
- if (prevHeader === header) {
30
- // When transitioning, we know that the sequence of states is as follows:
31
- // NONE -> ASC -> DESC -> NONE
32
- if (prevState === 'NONE') {
33
- return sortStates.sortStates.ASC;
34
- }
35
- if (prevState === 'ASC') {
36
- return sortStates.sortStates.DESC;
24
+ const getNextSortDirection = (prevHeader, currentHeader, prevState) => {
25
+ // Cycle for sorting the same header: NONE -> ASC -> DESC -> NONE.
26
+ if (prevHeader === currentHeader) {
27
+ switch (prevState) {
28
+ case sortStates.sortStates.NONE:
29
+ return sortStates.sortStates.ASC;
30
+ case sortStates.sortStates.ASC:
31
+ return sortStates.sortStates.DESC;
32
+ case sortStates.sortStates.DESC:
33
+ return sortStates.sortStates.NONE;
37
34
  }
38
- return sortStates.sortStates.NONE;
39
35
  }
40
- // Otherwise, we have selected a new header and need to start off by sorting
41
- // in descending order by default
36
+
37
+ // Sorting a new header starts at ascending order.
42
38
  return sortStates.sortStates.ASC;
43
39
  };
40
+
41
+ /**
42
+ * Gets the next sort state.
43
+ *
44
+ * @param props - Component props.
45
+ * @param state - Current table state.
46
+ * @param key - Header key to sort by.
47
+ */
44
48
  const getNextSortState = (props, state, {
45
49
  key
46
50
  }) => {
@@ -48,38 +52,26 @@ const getNextSortState = (props, state, {
48
52
  sortDirection,
49
53
  sortHeaderKey
50
54
  } = state;
51
- const nextSortDirection = getNextSortDirection(key, sortHeaderKey, sortDirection);
55
+ const nextSortDirection = getNextSortDirection(key, sortHeaderKey ?? '', sortDirection);
52
56
  return getSortedState(props, state, key, nextSortDirection);
53
57
  };
54
58
 
55
59
  /**
56
- * Derive the set of sorted state fields from props and state for the given
57
- * header key and sortDirection
60
+ * Gets a sort state update.
58
61
  *
59
- * @param {object} props
60
- * @param {string} props.locale The current locale
61
- * @param {Function} props.sortRows Method to handle sorting a collection of
62
- * rows
63
- * @param {object} state
64
- * @param {Array<string>} state.rowIds Array of row ids
65
- * @param {object} state.cellsById Lookup object for cells by id
66
- * @param {Array<string>} state.initialRowOrder Initial row order for the
67
- * current set of rows
68
- * @param {string} key The key for the given header we are serving the
69
- * sorted state for
70
- * @param {string} sortDirection The sortState that we want to order by
71
- * @returns {object}
62
+ * @param props - Component props.
63
+ * @param state - Current state of the table.
64
+ * @param key - Header key to sort by.
65
+ * @param sortDirection - Sort direction to apply.
72
66
  */
73
- const getSortedState = (props, state, key, sortDirection) => {
74
- const {
75
- rowIds,
76
- cellsById,
77
- initialRowOrder
78
- } = state;
79
- const {
80
- locale,
81
- sortRow
82
- } = props;
67
+ const getSortedState = ({
68
+ locale,
69
+ sortRow
70
+ }, {
71
+ rowIds,
72
+ cellsById,
73
+ initialRowOrder
74
+ }, key, sortDirection) => {
83
75
  const nextRowIds = sortDirection !== sortStates.sortStates.NONE ? sorting.sortRows({
84
76
  rowIds,
85
77
  cellsById,
@@ -90,12 +82,11 @@ const getSortedState = (props, state, key, sortDirection) => {
90
82
  }) : initialRowOrder;
91
83
  return {
92
84
  sortHeaderKey: key,
93
- sortDirection: sortDirection,
85
+ sortDirection,
94
86
  rowIds: nextRowIds
95
87
  };
96
88
  };
97
89
 
98
- exports.sortStates = sortStates.sortStates;
99
90
  exports.getNextSortDirection = getNextSortDirection;
100
91
  exports.getNextSortState = getNextSortState;
101
92
  exports.getSortedState = getSortedState;
@@ -15,6 +15,7 @@ var sortStates = require('../state/sortStates.js');
15
15
  * type, the default sort algorithm will be used for those types. Otherwise, the
16
16
  * values will be converted to strings for comparison.
17
17
  */
18
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20071
18
19
  const compare = (a, b, locale = 'en') => {
19
20
  // prevent multiple null values in one column (sorting breaks)
20
21
  if (a === null) a = '';
@@ -44,6 +45,10 @@ const compareStrings = (a, b, locale = 'en') => {
44
45
  numeric: isNumeric
45
46
  });
46
47
  };
48
+
49
+ // TODO: Should `SortRowParams` in
50
+ // packages/react/src/components/DataTable/state/sorting.ts be used here?
51
+
47
52
  /**
48
53
  * Sorts table rows based on the provided column key and direction.
49
54
  */
@@ -73,7 +73,6 @@ const carbonFlatpickrMonthSelectPlugin = config => fp => {
73
73
  elem.parentNode.removeChild(elem);
74
74
  });
75
75
  fp.monthElements.splice(0, fp.monthElements.length, ...fp.monthElements.map(() => {
76
- // eslint-disable-next-line no-underscore-dangle
77
76
  const monthElement = fp._createElement('span', config.classFlatpickrCurrentMonth);
78
77
  monthElement.textContent = monthToStr(fp.currentMonth, config.shorthand === true, fp.l10n);
79
78
  fp.yearElements[0].closest(config.selectorFlatpickrMonthYearContainer).insertBefore(monthElement, fp.yearElements[0].closest(config.selectorFlatpickrYearContainer));
@@ -174,6 +173,7 @@ const DatePicker = /*#__PURE__*/React.forwardRef(function DatePicker({
174
173
  isFluid
175
174
  } = React.useContext(FormContext.FormContext);
176
175
  const [hasInput, setHasInput] = React.useState(false);
176
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20071
177
177
  const startInputField = React.useCallback(node => {
178
178
  if (node !== null) {
179
179
  startInputField.current = node;
@@ -193,7 +193,10 @@ const DatePicker = /*#__PURE__*/React.forwardRef(function DatePicker({
193
193
  if (onClose) {
194
194
  onClose(selectedDates, dateStr, instance);
195
195
  }
196
- }, [onClose]);
196
+ },
197
+ // eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/20071
198
+ [onClose]);
199
+ // eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/20071
197
200
  const onCalendarClose = (selectedDates, dateStr, instance, e) => {
198
201
  if (e && e.type === 'clickOutside') {
199
202
  return;
@@ -230,7 +233,11 @@ const DatePicker = /*#__PURE__*/React.forwardRef(function DatePicker({
230
233
  const wrapperClasses = cx(`${prefix}--form-item`, {
231
234
  [String(className)]: className
232
235
  });
233
- const childrenWithProps = React.Children.toArray(children).map((child, index) => {
236
+
237
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20071
238
+ const childrenWithProps = React.Children.toArray(children).map(
239
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20071
240
+ (child, index) => {
234
241
  if (index === 0 && child.type === /*#__PURE__*/React.createElement(DatePickerInput.default, child.props).type) {
235
242
  return /*#__PURE__*/React.cloneElement(child, {
236
243
  datePickerType,
@@ -336,6 +343,7 @@ const DatePicker = /*#__PURE__*/React.forwardRef(function DatePicker({
336
343
  const {
337
344
  current: end
338
345
  } = endInputField;
346
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20071
339
347
  const flatpickerConfig = {
340
348
  inline: inline ?? false,
341
349
  onClose: onCalendarClose,
@@ -511,6 +519,7 @@ const DatePicker = /*#__PURE__*/React.forwardRef(function DatePicker({
511
519
  // this hook allows consumers to access the flatpickr calendar
512
520
  // instance for cases where functions like open() or close()
513
521
  // need to be imperatively called on the calendar
522
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20071
514
523
  React.useImperativeHandle(ref, () => ({
515
524
  get calendar() {
516
525
  return calendarRef.current;
@@ -567,6 +576,7 @@ const DatePicker = /*#__PURE__*/React.forwardRef(function DatePicker({
567
576
  endInputField.current.value = '';
568
577
  }
569
578
  }
579
+ // eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/20071
570
580
  }, [value]);
571
581
  React.useEffect(() => {
572
582
  const handleMouseDown = event => {
@@ -575,6 +585,7 @@ const DatePicker = /*#__PURE__*/React.forwardRef(function DatePicker({
575
585
  closeCalendar();
576
586
  }
577
587
  };
588
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars -- https://github.com/carbon-design-system/carbon/issues/20071
578
589
  const closeCalendar = event => {
579
590
  calendarRef.current?.close();
580
591
  // Remove focus from endDate calendar input
@@ -24,6 +24,8 @@ var index = require('../AILabel/index.js');
24
24
  var utils = require('../../internal/utils.js');
25
25
  var Text = require('../Text/Text.js');
26
26
 
27
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20071
28
+
27
29
  let didWarnAboutDatePickerInputValue = false;
28
30
  const DatePickerInput = /*#__PURE__*/React.forwardRef(function DatePickerInput(props, ref) {
29
31
  const {
@@ -97,6 +99,8 @@ const DatePickerInput = /*#__PURE__*/React.forwardRef(function DatePickerInput(p
97
99
  [`${prefix}--date-picker--fluid--warn`]: isFluid && warn
98
100
  });
99
101
  const datePickerInputHelperId = !helperText ? undefined : `datepicker-input-helper-text-${datePickerInputInstanceId}`;
102
+
103
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20071
100
104
  const inputProps = {
101
105
  ...rest,
102
106
  ...datePickerInputProps,
@@ -202,12 +206,14 @@ DatePickerInput.propTypes = {
202
206
  /**
203
207
  * Provide a regular expression that the input value must match
204
208
  */
209
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20071
205
210
  pattern: (props, propName, componentName) => {
206
211
  if (props[propName] === undefined) {
207
212
  return;
208
213
  }
209
214
  try {
210
215
  new RegExp(props[propName]);
216
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars -- https://github.com/carbon-design-system/carbon/issues/20071
211
217
  } catch (e) {
212
218
  return new Error(`Invalid value of prop '${propName}' supplied to '${componentName}', it should be a valid regular expression`);
213
219
  }