@carbon/react 1.76.0-rc.0 → 1.77.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 (190) hide show
  1. package/.playwright/INTERNAL_AVT_REPORT_DO_NOT_USE.json +908 -873
  2. package/es/components/Button/Button.d.ts +9 -1
  3. package/es/components/Button/Button.js +8 -0
  4. package/es/components/CodeSnippet/CodeSnippet.d.ts +2 -2
  5. package/es/components/ComboBox/ComboBox.d.ts +2 -2
  6. package/es/components/ComboBox/ComboBox.js +36 -13
  7. package/es/components/ComboButton/index.js +1 -2
  8. package/es/components/ComposedModal/ComposedModal.js +1 -1
  9. package/es/components/ContentSwitcher/index.d.ts +0 -1
  10. package/es/components/ContextMenu/useContextMenu.d.ts +0 -1
  11. package/es/components/Copy/Copy.js +1 -1
  12. package/es/components/DataTable/DataTable.d.ts +12 -20
  13. package/es/components/DataTable/DataTable.js +1 -9
  14. package/es/components/DataTable/Table.js +1 -1
  15. package/es/components/DataTable/TableActionList.d.ts +1 -1
  16. package/es/components/DataTable/TableBody.js +1 -1
  17. package/es/components/DataTable/TableContext.d.ts +0 -1
  18. package/es/components/DataTable/TableHead.d.ts +1 -1
  19. package/es/components/DataTable/TableToolbarContent.d.ts +1 -1
  20. package/es/components/DatePicker/plugins/fixEventsPlugin.js +2 -2
  21. package/es/components/DatePickerInput/DatePickerInput.js +1 -1
  22. package/es/components/Dropdown/Dropdown.js +1 -2
  23. package/es/components/FluidForm/FormContext.d.ts +0 -1
  24. package/es/components/FluidTextInput/FluidTextInput.d.ts +8 -0
  25. package/es/components/FluidTextInput/FluidTextInput.js +8 -0
  26. package/es/components/Grid/CSSGrid.js +1 -1
  27. package/es/components/Grid/Grid.js +1 -1
  28. package/es/components/Grid/GridTypes.d.ts +0 -1
  29. package/es/components/Heading/index.d.ts +1 -1
  30. package/es/components/IconButton/index.d.ts +17 -1
  31. package/es/components/IconButton/index.js +20 -1
  32. package/es/components/InlineCheckbox/InlineCheckbox.js +1 -1
  33. package/es/components/InlineLoading/InlineLoading.d.ts +1 -1
  34. package/es/components/InlineLoading/InlineLoading.js +21 -7
  35. package/es/components/Menu/Menu.js +2 -2
  36. package/es/components/Menu/MenuContext.d.ts +1 -1
  37. package/es/components/MenuButton/index.d.ts +1 -1
  38. package/es/components/MenuButton/index.js +1 -2
  39. package/es/components/Modal/Modal.js +1 -1
  40. package/es/components/Modal/next/index.d.ts +175 -0
  41. package/es/components/MultiSelect/FilterableMultiSelect.d.ts +1 -1
  42. package/es/components/MultiSelect/FilterableMultiSelect.js +1 -2
  43. package/es/components/MultiSelect/MultiSelect.d.ts +1 -1
  44. package/es/components/MultiSelect/MultiSelect.js +1 -2
  45. package/es/components/Popover/index.js +2 -3
  46. package/es/components/PrimaryButton/PrimaryButton.d.ts +1 -1
  47. package/es/components/RadioTile/RadioTile.d.ts +1 -1
  48. package/es/components/SecondaryButton/SecondaryButton.d.ts +1 -1
  49. package/es/components/Slider/Slider.d.ts +1 -1
  50. package/es/components/Slider/Slider.js +1 -1
  51. package/es/components/Slider/index.d.ts +0 -1
  52. package/es/components/Tabs/Tabs.d.ts +3 -3
  53. package/es/components/Tabs/Tabs.js +4 -4
  54. package/es/components/Tag/DismissibleTag.d.ts +2 -2
  55. package/es/components/Tag/OperationalTag.d.ts +1 -1
  56. package/es/components/Tag/SelectableTag.d.ts +2 -2
  57. package/es/components/Text/index.d.ts +2 -2
  58. package/es/components/TextArea/TextArea.js +2 -1
  59. package/es/components/TextInput/PasswordInput.d.ts +1 -1
  60. package/es/components/Theme/index.d.ts +1 -1
  61. package/es/components/Tile/Tile.d.ts +1 -1
  62. package/es/components/Tile/Tile.js +1 -1
  63. package/es/components/Toggletip/index.d.ts +3 -3
  64. package/es/components/Toggletip/index.js +5 -4
  65. package/es/components/Tooltip/Tooltip.d.ts +17 -1
  66. package/es/components/Tooltip/Tooltip.js +12 -2
  67. package/es/components/TreeView/TreeNode.d.ts +27 -19
  68. package/es/components/TreeView/TreeNode.js +100 -31
  69. package/es/components/TreeView/TreeView.js +1 -1
  70. package/es/components/UIShell/Content.d.ts +9 -9
  71. package/es/components/UIShell/HeaderGlobalBar.d.ts +1 -1
  72. package/es/components/UIShell/HeaderMenu.d.ts +69 -25
  73. package/es/components/UIShell/HeaderMenuButton.d.ts +69 -27
  74. package/es/components/UIShell/HeaderMenuItem.d.ts +4 -3
  75. package/es/components/UIShell/HeaderMenuItem.js +1 -1
  76. package/es/components/UIShell/HeaderName.js +1 -1
  77. package/es/components/UIShell/HeaderNavigation.d.ts +69 -25
  78. package/es/components/UIShell/Link.d.ts +14 -11
  79. package/es/components/UIShell/Link.js +5 -6
  80. package/es/components/UIShell/SideNav.js +3 -3
  81. package/es/components/UIShell/SideNavLink.js +1 -1
  82. package/es/components/UIShell/SideNavMenuItem.d.ts +51 -3
  83. package/es/components/UIShell/SideNavMenuItem.js +6 -6
  84. package/es/components/UIShell/SwitcherItem.d.ts +2 -2
  85. package/es/components/UIShell/SwitcherItem.js +1 -1
  86. package/es/internal/PolymorphicProps.d.ts +0 -1
  87. package/es/internal/Selection.d.ts +38 -0
  88. package/es/internal/Selection.js +26 -113
  89. package/es/node_modules/es-toolkit/dist/compat/function/debounce.mjs.js +55 -0
  90. package/es/node_modules/es-toolkit/dist/compat/function/throttle.mjs.js +23 -0
  91. package/es/node_modules/es-toolkit/dist/function/debounce.mjs.js +70 -0
  92. package/es/tools/wrapComponent.d.ts +1 -1
  93. package/lib/components/Button/Button.d.ts +9 -1
  94. package/lib/components/Button/Button.js +8 -0
  95. package/lib/components/CodeSnippet/CodeSnippet.d.ts +2 -2
  96. package/lib/components/ComboBox/ComboBox.d.ts +2 -2
  97. package/lib/components/ComboBox/ComboBox.js +36 -13
  98. package/lib/components/ComboButton/index.js +1 -2
  99. package/lib/components/ComposedModal/ComposedModal.js +2 -2
  100. package/lib/components/ContentSwitcher/index.d.ts +0 -1
  101. package/lib/components/ContextMenu/useContextMenu.d.ts +0 -1
  102. package/lib/components/Copy/Copy.js +2 -2
  103. package/lib/components/DataTable/DataTable.d.ts +12 -20
  104. package/lib/components/DataTable/DataTable.js +1 -9
  105. package/lib/components/DataTable/Table.js +3 -3
  106. package/lib/components/DataTable/TableActionList.d.ts +1 -1
  107. package/lib/components/DataTable/TableBody.js +1 -1
  108. package/lib/components/DataTable/TableContext.d.ts +0 -1
  109. package/lib/components/DataTable/TableHead.d.ts +1 -1
  110. package/lib/components/DataTable/TableToolbarContent.d.ts +1 -1
  111. package/lib/components/DatePicker/plugins/fixEventsPlugin.js +2 -2
  112. package/lib/components/DatePickerInput/DatePickerInput.js +1 -1
  113. package/lib/components/Dropdown/Dropdown.js +1 -2
  114. package/lib/components/FluidForm/FormContext.d.ts +0 -1
  115. package/lib/components/FluidTextInput/FluidTextInput.d.ts +8 -0
  116. package/lib/components/FluidTextInput/FluidTextInput.js +8 -0
  117. package/lib/components/Grid/CSSGrid.js +1 -1
  118. package/lib/components/Grid/Grid.js +1 -1
  119. package/lib/components/Grid/GridTypes.d.ts +0 -1
  120. package/lib/components/Heading/index.d.ts +1 -1
  121. package/lib/components/IconButton/index.d.ts +17 -1
  122. package/lib/components/IconButton/index.js +20 -1
  123. package/lib/components/InlineCheckbox/InlineCheckbox.js +1 -1
  124. package/lib/components/InlineLoading/InlineLoading.d.ts +1 -1
  125. package/lib/components/InlineLoading/InlineLoading.js +20 -6
  126. package/lib/components/Menu/Menu.js +2 -2
  127. package/lib/components/Menu/MenuContext.d.ts +1 -1
  128. package/lib/components/MenuButton/index.d.ts +1 -1
  129. package/lib/components/MenuButton/index.js +1 -2
  130. package/lib/components/Modal/Modal.js +2 -2
  131. package/lib/components/Modal/next/index.d.ts +175 -0
  132. package/lib/components/MultiSelect/FilterableMultiSelect.d.ts +1 -1
  133. package/lib/components/MultiSelect/FilterableMultiSelect.js +1 -2
  134. package/lib/components/MultiSelect/MultiSelect.d.ts +1 -1
  135. package/lib/components/MultiSelect/MultiSelect.js +1 -2
  136. package/lib/components/Popover/index.js +2 -3
  137. package/lib/components/PrimaryButton/PrimaryButton.d.ts +1 -1
  138. package/lib/components/RadioTile/RadioTile.d.ts +1 -1
  139. package/lib/components/SecondaryButton/SecondaryButton.d.ts +1 -1
  140. package/lib/components/Slider/Slider.d.ts +1 -1
  141. package/lib/components/Slider/Slider.js +2 -2
  142. package/lib/components/Slider/index.d.ts +0 -1
  143. package/lib/components/Tabs/Tabs.d.ts +3 -3
  144. package/lib/components/Tabs/Tabs.js +6 -6
  145. package/lib/components/Tag/DismissibleTag.d.ts +2 -2
  146. package/lib/components/Tag/OperationalTag.d.ts +1 -1
  147. package/lib/components/Tag/SelectableTag.d.ts +2 -2
  148. package/lib/components/Text/index.d.ts +2 -2
  149. package/lib/components/TextArea/TextArea.js +2 -1
  150. package/lib/components/TextInput/PasswordInput.d.ts +1 -1
  151. package/lib/components/Theme/index.d.ts +1 -1
  152. package/lib/components/Tile/Tile.d.ts +1 -1
  153. package/lib/components/Tile/Tile.js +1 -1
  154. package/lib/components/Toggletip/index.d.ts +3 -3
  155. package/lib/components/Toggletip/index.js +5 -4
  156. package/lib/components/Tooltip/Tooltip.d.ts +17 -1
  157. package/lib/components/Tooltip/Tooltip.js +12 -2
  158. package/lib/components/TreeView/TreeNode.d.ts +27 -19
  159. package/lib/components/TreeView/TreeNode.js +100 -31
  160. package/lib/components/TreeView/TreeView.js +1 -1
  161. package/lib/components/UIShell/Content.d.ts +9 -9
  162. package/lib/components/UIShell/HeaderGlobalBar.d.ts +1 -1
  163. package/lib/components/UIShell/HeaderMenu.d.ts +69 -25
  164. package/lib/components/UIShell/HeaderMenuButton.d.ts +69 -27
  165. package/lib/components/UIShell/HeaderMenuItem.d.ts +4 -3
  166. package/lib/components/UIShell/HeaderMenuItem.js +1 -1
  167. package/lib/components/UIShell/HeaderName.js +1 -1
  168. package/lib/components/UIShell/HeaderNavigation.d.ts +69 -25
  169. package/lib/components/UIShell/Link.d.ts +14 -11
  170. package/lib/components/UIShell/Link.js +4 -4
  171. package/lib/components/UIShell/SideNav.js +3 -3
  172. package/lib/components/UIShell/SideNavLink.js +1 -1
  173. package/lib/components/UIShell/SideNavMenuItem.d.ts +51 -3
  174. package/lib/components/UIShell/SideNavMenuItem.js +6 -6
  175. package/lib/components/UIShell/SwitcherItem.d.ts +2 -2
  176. package/lib/components/UIShell/SwitcherItem.js +1 -1
  177. package/lib/internal/PolymorphicProps.d.ts +0 -1
  178. package/lib/internal/Selection.d.ts +38 -0
  179. package/lib/internal/Selection.js +24 -114
  180. package/lib/node_modules/es-toolkit/dist/compat/function/debounce.mjs.js +59 -0
  181. package/lib/node_modules/es-toolkit/dist/compat/function/throttle.mjs.js +27 -0
  182. package/lib/node_modules/es-toolkit/dist/function/debounce.mjs.js +74 -0
  183. package/lib/tools/wrapComponent.d.ts +1 -1
  184. package/package.json +10 -9
  185. package/es/node_modules/@floating-ui/core/dist/floating-ui.core.mjs.js +0 -896
  186. package/es/node_modules/@floating-ui/dom/dist/floating-ui.dom.mjs.js +0 -76
  187. package/es/node_modules/@floating-ui/utils/dist/floating-ui.utils.mjs.js +0 -139
  188. package/lib/node_modules/@floating-ui/core/dist/floating-ui.core.mjs.js +0 -909
  189. package/lib/node_modules/@floating-ui/dom/dist/floating-ui.dom.mjs.js +0 -80
  190. package/lib/node_modules/@floating-ui/utils/dist/floating-ui.utils.mjs.js +0 -163
@@ -27,7 +27,7 @@ export interface ButtonBaseProps extends React.ButtonHTMLAttributes<HTMLButtonEl
27
27
  /**
28
28
  * Optionally specify an href for your Button to become an `<a>` element
29
29
  */
30
- href?: string;
30
+ href?: React.AnchorHTMLAttributes<HTMLAnchorElement>['href'];
31
31
  /**
32
32
  * If specifying the `renderIcon` prop, provide a description for that icon that can
33
33
  * be read by screen readers
@@ -45,6 +45,10 @@ export interface ButtonBaseProps extends React.ButtonHTMLAttributes<HTMLButtonEl
45
45
  * Specify the kind of Button you want to create
46
46
  */
47
47
  kind?: ButtonBaseProps['hasIconOnly'] extends true ? IconButtonKind : ButtonKind;
48
+ /**
49
+ * Optionally specify a `rel` when using an `<a>` element.
50
+ */
51
+ rel?: React.AnchorHTMLAttributes<HTMLAnchorElement>['rel'];
48
52
  /**
49
53
  * Optional prop to allow overriding the icon rendering.
50
54
  * Can be a React component class
@@ -54,6 +58,10 @@ export interface ButtonBaseProps extends React.ButtonHTMLAttributes<HTMLButtonEl
54
58
  * Specify the size of the button, from the following list of sizes:
55
59
  */
56
60
  size?: ButtonSize;
61
+ /**
62
+ * Optionally specify a `target` when using an `<a>` element.
63
+ */
64
+ target?: React.AnchorHTMLAttributes<HTMLAnchorElement>['target'];
57
65
  /**
58
66
  * Specify the alignment of the tooltip to the icon-only button.
59
67
  * Can be one of: start, center, or end.
@@ -185,6 +185,10 @@ Button.propTypes = {
185
185
  * leaves the button element
186
186
  */
187
187
  onMouseLeave: PropTypes.func,
188
+ /**
189
+ * Optionally specify a `rel` when using an `<a>` element.
190
+ */
191
+ rel: PropTypes.string,
188
192
  /**
189
193
  * Optional prop to allow overriding the icon rendering.
190
194
  * Can be a React component class
@@ -202,6 +206,10 @@ Button.propTypes = {
202
206
  * Optional prop to specify the tabIndex of the Button
203
207
  */
204
208
  tabIndex: PropTypes.number,
209
+ /**
210
+ * Optionally specify a `target` when using an `<a>` element.
211
+ */
212
+ target: PropTypes.string,
205
213
  /**
206
214
  * Specify the alignment of the tooltip to the icon-only button.
207
215
  * Can be one of: start, center, or end.
@@ -7,8 +7,8 @@
7
7
  import PropTypes from 'prop-types';
8
8
  import { PropsWithChildren } from 'react';
9
9
  export type DeprecatedCodeSnippetAlignment = 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right' | 'left-bottom' | 'left-top' | 'right-bottom' | 'right-top';
10
- export type NewCodeSnippetAlignmnet = 'top' | 'bottom' | 'left' | 'right' | 'top-start' | 'top-end' | 'bottom-start' | 'bottom-end' | 'left-end' | 'left-start' | 'right-end' | 'right-start';
11
- export type CodeSnippetAlignment = DeprecatedCodeSnippetAlignment | NewCodeSnippetAlignmnet;
10
+ export type NewCodeSnippetAlignment = 'top' | 'bottom' | 'left' | 'right' | 'top-start' | 'top-end' | 'bottom-start' | 'bottom-end' | 'left-end' | 'left-start' | 'right-end' | 'right-start';
11
+ export type CodeSnippetAlignment = DeprecatedCodeSnippetAlignment | NewCodeSnippetAlignment;
12
12
  export interface CodeSnippetProps {
13
13
  /**
14
14
  * Specify how the trigger should align with the tooltip
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright IBM Corp. 2016, 2023
2
+ * Copyright IBM Corp. 2016, 2025
3
3
  *
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.
@@ -184,7 +184,7 @@ export interface ComboBoxProps<ItemType> extends Omit<InputHTMLAttributes<HTMLIn
184
184
  */
185
185
  titleText?: ReactNode;
186
186
  /**
187
- * **Experimental**: will enable autcomplete and typeahead for the input field
187
+ * **Experimental**: will enable autocomplete and typeahead for the input field
188
188
  */
189
189
  typeahead?: boolean;
190
190
  /**
@@ -22,8 +22,7 @@ import deprecate from '../../prop-types/deprecate.js';
22
22
  import { usePrefix } from '../../internal/usePrefix.js';
23
23
  import '../FluidForm/FluidForm.js';
24
24
  import { FormContext } from '../FluidForm/FormContext.js';
25
- import { useFloating, flip, autoUpdate } from '@floating-ui/react';
26
- import { hide } from '../../node_modules/@floating-ui/dom/dist/floating-ui.dom.mjs.js';
25
+ import { useFloating, flip, hide, autoUpdate } from '@floating-ui/react';
27
26
  import { useFeatureFlag } from '../FeatureFlags/index.js';
28
27
  import { Text } from '../Text/Text.js';
29
28
  import { match } from '../../internal/keyboard/match.js';
@@ -68,21 +67,24 @@ const autocompleteCustomFilter = _ref => {
68
67
  const getInputValue = _ref2 => {
69
68
  let {
70
69
  initialSelectedItem,
71
- inputValue,
72
70
  itemToString,
73
71
  selectedItem,
74
72
  prevSelectedItem
75
73
  } = _ref2;
76
- if (selectedItem) {
74
+ // If there's a current selection (even if it's an object or string), use it.
75
+ if (selectedItem !== null && typeof selectedItem !== 'undefined') {
77
76
  return itemToString(selectedItem);
78
77
  }
79
- if (initialSelectedItem) {
78
+
79
+ // On the very first render (when no previous value exists), use
80
+ // `initialSelectedItem`.
81
+ if (typeof prevSelectedItem === 'undefined' && initialSelectedItem !== null && typeof initialSelectedItem !== 'undefined') {
80
82
  return itemToString(initialSelectedItem);
81
83
  }
82
- if (!selectedItem && prevSelectedItem) {
83
- return '';
84
- }
85
- return inputValue || '';
84
+
85
+ // Otherwise (i.e., after the user has cleared the selection), return an empty
86
+ // string.
87
+ return '';
86
88
  };
87
89
  const findHighlightedIndex = (_ref3, inputValue) => {
88
90
  let {
@@ -179,7 +181,6 @@ const ComboBox = /*#__PURE__*/forwardRef((props, ref) => {
179
181
  }, [enableFloatingStyles, floatingStyles, refs.floating, parentWidth]);
180
182
  const [inputValue, setInputValue] = useState(getInputValue({
181
183
  initialSelectedItem,
182
- inputValue: '',
183
184
  itemToString,
184
185
  selectedItem: selectedItemProp
185
186
  }));
@@ -222,7 +223,6 @@ const ComboBox = /*#__PURE__*/forwardRef((props, ref) => {
222
223
  if (prevSelectedItemProp.current !== selectedItemProp) {
223
224
  const currentInputValue = getInputValue({
224
225
  initialSelectedItem,
225
- inputValue,
226
226
  itemToString,
227
227
  selectedItem: selectedItemProp,
228
228
  prevSelectedItem: prevSelectedItemProp.current
@@ -301,6 +301,13 @@ const ComboBox = /*#__PURE__*/forwardRef((props, ref) => {
301
301
  return changes;
302
302
  }
303
303
  case InputKeyDownEnter:
304
+ if (highlightedIndex === -1 && !allowCustomValue && state.selectedItem) {
305
+ return {
306
+ ...changes,
307
+ selectedItem: null,
308
+ inputValue: state.inputValue
309
+ };
310
+ }
304
311
  if (allowCustomValue) {
305
312
  setInputValue(inputValue);
306
313
  setHighlightedIndex(changes.selectedItem);
@@ -321,6 +328,12 @@ const ComboBox = /*#__PURE__*/forwardRef((props, ref) => {
321
328
  }
322
329
  case FunctionToggleMenu:
323
330
  case ToggleButtonClick:
331
+ if (!changes.isOpen && state.inputValue && highlightedIndex === -1 && !allowCustomValue) {
332
+ return {
333
+ ...changes,
334
+ inputValue: '' // Clear the input
335
+ };
336
+ }
324
337
  if (changes.isOpen && !changes.selectedItem) {
325
338
  return {
326
339
  ...changes
@@ -462,7 +475,8 @@ const ComboBox = /*#__PURE__*/forwardRef((props, ref) => {
462
475
  selectedItem: newSelectedItem
463
476
  });
464
477
  }
465
- if (type === useCombobox.stateChangeTypes.FunctionSelectItem || type === useCombobox.stateChangeTypes.InputKeyDownEnter) {
478
+ if ((type === useCombobox.stateChangeTypes.FunctionSelectItem || type === useCombobox.stateChangeTypes.InputKeyDownEnter) && !isEqual(selectedItemProp, newSelectedItem) // Only fire if there's an actual change
479
+ ) {
466
480
  onChange({
467
481
  selectedItem: newSelectedItem
468
482
  });
@@ -512,6 +526,9 @@ const ComboBox = /*#__PURE__*/forwardRef((props, ref) => {
512
526
  });
513
527
  const handleFocus = evt => {
514
528
  setIsFocused(evt.type === 'focus');
529
+ if (!inputRef.current?.value && evt.type === 'blur') {
530
+ selectItem(null);
531
+ }
515
532
  };
516
533
  const readOnlyEventHandlers = readOnly ? {
517
534
  onKeyDown: evt => {
@@ -634,6 +651,12 @@ const ComboBox = /*#__PURE__*/forwardRef((props, ref) => {
634
651
  toggleMenu();
635
652
  }
636
653
  }
654
+ if (!inputValue && highlightedIndex == -1 && event.key == 'Enter') {
655
+ if (!isOpen) toggleMenu();
656
+ selectItem(null);
657
+ event.preventDownshiftDefault = true;
658
+ if (event.currentTarget.ariaExpanded === 'false') openMenu();
659
+ }
637
660
  if (typeahead && event.key === 'Tab') {
638
661
  // event.preventDefault();
639
662
  const matchingItem = items.find(item => itemToString(item).toLowerCase().startsWith(inputValue.toLowerCase()));
@@ -860,7 +883,7 @@ ComboBox.propTypes = {
860
883
  */
861
884
  translateWithId: PropTypes.func,
862
885
  /**
863
- * **Experimental**: will enable autcomplete and typeahead for the input field
886
+ * **Experimental**: will enable autocomplete and typeahead for the input field
864
887
  */
865
888
  typeahead: PropTypes.bool,
866
889
  /**
@@ -18,8 +18,7 @@ import '../Menu/MenuItem.js';
18
18
  import { useAttachedMenu } from '../../internal/useAttachedMenu.js';
19
19
  import { useId } from '../../internal/useId.js';
20
20
  import { usePrefix } from '../../internal/usePrefix.js';
21
- import { flip, size, useFloating, autoUpdate } from '@floating-ui/react';
22
- import { hide } from '../../node_modules/@floating-ui/dom/dist/floating-ui.dom.mjs.js';
21
+ import { flip, hide, size, useFloating, autoUpdate } from '@floating-ui/react';
23
22
  import { useFeatureFlag } from '../FeatureFlags/index.js';
24
23
  import mergeRefs from '../../tools/mergeRefs.js';
25
24
  import deprecateValuesWithin from '../../prop-types/deprecateValuesWithin.js';
@@ -12,7 +12,6 @@ import PropTypes from 'prop-types';
12
12
  import { Layer } from '../Layer/index.js';
13
13
  import { ModalHeader } from './ModalHeader.js';
14
14
  import { ModalFooter } from './ModalFooter.js';
15
- import { debounce } from 'es-toolkit/compat';
16
15
  import useIsomorphicEffect from '../../internal/useIsomorphicEffect.js';
17
16
  import mergeRefs from '../../tools/mergeRefs.js';
18
17
  import cx from 'classnames';
@@ -23,6 +22,7 @@ import { usePrefix } from '../../internal/usePrefix.js';
23
22
  import { useFeatureFlag } from '../FeatureFlags/index.js';
24
23
  import { composeEventHandlers } from '../../tools/events.js';
25
24
  import deprecate from '../../prop-types/deprecate.js';
25
+ import { debounce } from '../../node_modules/es-toolkit/dist/compat/function/debounce.mjs.js';
26
26
  import { match } from '../../internal/keyboard/match.js';
27
27
  import { Escape, Tab } from '../../internal/keyboard/keys.js';
28
28
 
@@ -4,7 +4,6 @@
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
- /// <reference types="react" />
8
7
  import { ContentSwitcherProps } from './ContentSwitcher';
9
8
  declare const ContentSwitcher: import("react").FunctionComponent<ContentSwitcherProps>;
10
9
  export default ContentSwitcher;
@@ -4,7 +4,6 @@
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
- /// <reference types="react" />
8
7
  type TriggerType = Element | Document | Window | React.RefObject<Element>;
9
8
  export interface ContextMenuProps {
10
9
  open: boolean;
@@ -8,13 +8,13 @@
8
8
  import { extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
9
9
  import PropTypes from 'prop-types';
10
10
  import React__default, { useState, useCallback, useEffect } from 'react';
11
- import { debounce } from 'es-toolkit/compat';
12
11
  import cx from 'classnames';
13
12
  import { composeEventHandlers } from '../../tools/events.js';
14
13
  import { usePrefix } from '../../internal/usePrefix.js';
15
14
  import { IconButton } from '../IconButton/index.js';
16
15
  import { noopFn } from '../../internal/noopFn.js';
17
16
  import deprecateValuesWithin from '../../prop-types/deprecateValuesWithin.js';
17
+ import { debounce } from '../../node_modules/es-toolkit/dist/compat/function/debounce.mjs.js';
18
18
 
19
19
  const propMappingFunction = deprecatedValue => {
20
20
  const mapping = {
@@ -6,7 +6,6 @@
6
6
  */
7
7
  import PropTypes from 'prop-types';
8
8
  import React from 'react';
9
- import type { MouseEvent } from 'react';
10
9
  import type { DataTableSortState } from './state/sortStates';
11
10
  import Table from './Table';
12
11
  import TableActionList from './TableActionList';
@@ -100,7 +99,6 @@ export interface DataTableRenderProps<RowType, ColTypes extends any[]> {
100
99
  onExpand?: (e: React.MouseEvent<HTMLButtonElement>) => void;
101
100
  [key: string]: unknown;
102
101
  }) => {
103
- ariaLabel: string;
104
102
  ['aria-label']: string;
105
103
  isExpanded: boolean;
106
104
  onExpand: (e: React.MouseEvent<HTMLButtonElement>) => void;
@@ -111,7 +109,6 @@ export interface DataTableRenderProps<RowType, ColTypes extends any[]> {
111
109
  row: DataTableRow<ColTypes>;
112
110
  [key: string]: unknown;
113
111
  }) => {
114
- ariaLabel: string;
115
112
  ['aria-label']: string;
116
113
  disabled: boolean | undefined;
117
114
  isExpanded?: boolean;
@@ -132,7 +129,6 @@ export interface DataTableRenderProps<RowType, ColTypes extends any[]> {
132
129
  row: DataTableRow<ColTypes>;
133
130
  [key: string]: unknown;
134
131
  }) => {
135
- ariaLabel: string;
136
132
  'aria-label': string;
137
133
  checked?: boolean | undefined;
138
134
  disabled?: boolean | undefined;
@@ -349,13 +345,13 @@ declare class DataTable<RowType, ColTypes extends any[]> extends React.Component
349
345
  * @returns {object}
350
346
  */
351
347
  getHeaderProps: ({ header, onClick, isSortable, ...rest }: {
352
- [key: string]: unknown;
353
348
  header: DataTableHeader;
354
- onClick?: ((e: React.MouseEvent<HTMLButtonElement>, sortState: {
349
+ onClick?: (e: React.MouseEvent<HTMLButtonElement>, sortState: {
355
350
  sortHeaderKey: string;
356
351
  sortDirection: DataTableSortState;
357
- }) => void) | undefined;
358
- isSortable?: boolean | undefined;
352
+ }) => void;
353
+ isSortable?: boolean;
354
+ [key: string]: unknown;
359
355
  }) => {
360
356
  key: string;
361
357
  sortDirection: DataTableSortState;
@@ -375,12 +371,11 @@ declare class DataTable<RowType, ColTypes extends any[]> extends React.Component
375
371
  */
376
372
  getExpandHeaderProps: ({ onClick, onExpand, ...rest }?: {
377
373
  [key: string]: unknown;
378
- onClick?: ((e: React.MouseEvent<HTMLButtonElement>, expandState: {
374
+ onClick?: (e: React.MouseEvent<HTMLButtonElement>, expandState: {
379
375
  isExpanded: boolean;
380
- }) => void) | undefined;
381
- onExpand?: ((e: React.MouseEvent<HTMLButtonElement>) => void) | undefined;
376
+ }) => void;
377
+ onExpand?: (e: React.MouseEvent<HTMLButtonElement>) => void;
382
378
  }) => {
383
- ariaLabel: any;
384
379
  'aria-label': any;
385
380
  'aria-controls': string;
386
381
  isExpanded: boolean;
@@ -411,14 +406,13 @@ declare class DataTable<RowType, ColTypes extends any[]> extends React.Component
411
406
  * @returns {object}
412
407
  */
413
408
  getRowProps: ({ row, onClick, ...rest }: {
414
- [key: string]: unknown;
415
- onClick?: ((e: React.MouseEvent<HTMLButtonElement>) => void) | undefined;
409
+ onClick?: (e: React.MouseEvent<HTMLButtonElement>) => void;
416
410
  row: DataTableRow<ColTypes>;
411
+ [key: string]: unknown;
417
412
  }) => {
418
413
  key: string;
419
414
  onExpand: any;
420
415
  isExpanded: boolean | undefined;
421
- ariaLabel: any;
422
416
  'aria-label': any;
423
417
  'aria-controls': string;
424
418
  isSelected: boolean | undefined;
@@ -432,8 +426,8 @@ declare class DataTable<RowType, ColTypes extends any[]> extends React.Component
432
426
  * @returns {object}
433
427
  */
434
428
  getExpandedRowProps: ({ row, ...rest }: {
435
- [key: string]: unknown;
436
429
  row: DataTableRow<ColTypes>;
430
+ [key: string]: unknown;
437
431
  }) => {
438
432
  id: string;
439
433
  };
@@ -449,19 +443,17 @@ declare class DataTable<RowType, ColTypes extends any[]> extends React.Component
449
443
  */
450
444
  getSelectionProps: ({ onClick, row, ...rest }?: {
451
445
  [key: string]: unknown;
452
- onClick?: ((e: React.MouseEvent<HTMLButtonElement>) => void) | undefined;
446
+ onClick?: (e: React.MouseEvent<HTMLButtonElement>) => void;
453
447
  row: DataTableRow<ColTypes>;
454
448
  }) => {
455
449
  checked: boolean | undefined;
456
450
  onSelect: any;
457
451
  id: string;
458
452
  name: string;
459
- ariaLabel: any;
460
453
  'aria-label': any;
461
454
  disabled: boolean | undefined;
462
455
  radio: boolean | undefined;
463
456
  } | {
464
- ariaLabel: any;
465
457
  'aria-label': any;
466
458
  checked: boolean;
467
459
  id: string;
@@ -470,8 +462,8 @@ declare class DataTable<RowType, ColTypes extends any[]> extends React.Component
470
462
  onSelect: any;
471
463
  };
472
464
  getToolbarProps: (props?: {}) => {
465
+ size: "sm" | undefined;
473
466
  [key: string]: unknown;
474
- size: 'sm' | undefined;
475
467
  };
476
468
  getBatchActionProps: (props?: {}) => {
477
469
  shouldShowBatchActions: boolean;
@@ -150,8 +150,6 @@ class DataTable extends React__default.Component {
150
150
  const translationKey = isExpanded ? translationKeys.collapseAll : translationKeys.expandAll;
151
151
  return {
152
152
  ...rest,
153
- ariaLabel: t(translationKey),
154
- // TODO: remove in v12
155
153
  'aria-label': t(translationKey),
156
154
  // Provide a string of all the expanded row id's, separated by a space.
157
155
  'aria-controls': rowIds.map(id => `expanded-row-${id}`).join(' '),
@@ -208,8 +206,6 @@ class DataTable extends React__default.Component {
208
206
  // handler
209
207
  onExpand: composeEventHandlers([this.handleOnExpandRow(row.id), onClick]),
210
208
  isExpanded: row.isExpanded,
211
- ariaLabel: t(translationKey),
212
- // TODO remove in v12
213
209
  'aria-label': t(translationKey),
214
210
  'aria-controls': `expanded-row-${row.id}`,
215
211
  isSelected: row.isSelected,
@@ -262,8 +258,6 @@ class DataTable extends React__default.Component {
262
258
  onSelect: composeEventHandlers([_this.handleOnSelectRow(row.id), onClick]),
263
259
  id: `${_this.getTablePrefix()}__select-row-${row.id}`,
264
260
  name: `select-row-${_this.instanceId}`,
265
- ariaLabel: t(translationKey),
266
- // TODO remove in v12
267
261
  'aria-label': t(translationKey),
268
262
  disabled: row.disabled,
269
263
  radio: _this.props.radio
@@ -279,13 +273,11 @@ class DataTable extends React__default.Component {
279
273
  const translationKey = checked || indeterminate ? translationKeys.unselectAll : translationKeys.selectAll;
280
274
  return {
281
275
  ...rest,
282
- ariaLabel: t(translationKey),
283
- // TODO remove in v12
284
276
  'aria-label': t(translationKey),
285
277
  checked,
286
278
  id: `${_this.getTablePrefix()}__select-all`,
287
279
  indeterminate,
288
- name: 'select-all',
280
+ name: `select-all-${_this.instanceId}`,
289
281
  onSelect: composeEventHandlers([_this.handleSelectAll, onClick])
290
282
  };
291
283
  });
@@ -9,11 +9,11 @@ import { extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js
9
9
  import React__default, { useContext, useState, useRef, useCallback } from 'react';
10
10
  import PropTypes from 'prop-types';
11
11
  import cx from 'classnames';
12
- import { debounce } from 'es-toolkit/compat';
13
12
  import { usePrefix } from '../../internal/usePrefix.js';
14
13
  import { TableContext } from './TableContext.js';
15
14
  import { useWindowEvent } from '../../internal/useEvent.js';
16
15
  import useIsomorphicEffect from '../../internal/useIsomorphicEffect.js';
16
+ import { debounce } from '../../node_modules/es-toolkit/dist/compat/function/debounce.mjs.js';
17
17
 
18
18
  const isElementWrappingContent = (element, context) => {
19
19
  if (element.children.length > 0) {
@@ -4,5 +4,5 @@
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
- declare const TableActionList: (props: import("../../types/common").ReactAttr<"div">) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
7
+ declare const TableActionList: (props: import("../../types/common").ReactAttr<"div">) => React.ReactElement;
8
8
  export default TableActionList;
@@ -16,7 +16,7 @@ const TableBody = _ref => {
16
16
  ...rest
17
17
  } = _ref;
18
18
  return /*#__PURE__*/React__default.createElement("tbody", _extends({
19
- "aria-live": 'polite' ,
19
+ "aria-live": rest['aria-live'] ?? 'polite',
20
20
  className: className
21
21
  }, rest), children);
22
22
  };
@@ -4,7 +4,6 @@
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
- /// <reference types="react" />
8
7
  interface TableContextType {
9
8
  titleId?: string;
10
9
  descriptionId?: string;
@@ -6,5 +6,5 @@
6
6
  */
7
7
  import { ThHTMLAttributes } from 'react';
8
8
  export type TableHeadProps = ThHTMLAttributes<HTMLTableSectionElement>;
9
- declare const TableHead: (props: import("../../types/common").ReactAttr<"thead">) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
9
+ declare const TableHead: (props: import("../../types/common").ReactAttr<"thead">) => React.ReactElement;
10
10
  export default TableHead;
@@ -4,5 +4,5 @@
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
- declare const TableToolbarContent: (props: import("../../types/common").ReactAttr<"div">) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
7
+ declare const TableToolbarContent: (props: import("../../types/common").ReactAttr<"div">) => React.ReactElement;
8
8
  export default TableToolbarContent;
@@ -81,7 +81,7 @@ var carbonFlatpickrFixEventsPlugin = config => fp => {
81
81
  const currentValueToDate = withoutTime(parseDateWithFormat(inputTo.value));
82
82
 
83
83
  // The date should only be set if both dates are valid dates, and they don't match.
84
- // When they don't match, this indiciates that the date selected in the calendar is stale,
84
+ // When they don't match, this indicates that the date selected in the calendar is stale,
85
85
  // and the current value in the input should be set for the calendar to update.
86
86
  if (selectedToDate && currentValueToDate && selectedToDate !== currentValueToDate) {
87
87
  // Update the calendar with the value of the `to` date input
@@ -89,7 +89,7 @@ var carbonFlatpickrFixEventsPlugin = config => fp => {
89
89
  }
90
90
  }
91
91
  const isValidDate = date => date?.toString() !== 'Invalid Date';
92
- // save end date in calendar inmediately after it's been written down
92
+ // save end date in calendar immediately after it's been written down
93
93
  if (inputTo === target && fp.selectedDates.length === 1 && inputTo.value) {
94
94
  if (isValidDate(parseDateWithFormat(inputTo.value))) {
95
95
  fp.setDate([inputFrom.value, inputTo.value], true, fp.config.dateFormat);
@@ -84,7 +84,7 @@ const DatePickerInput = /*#__PURE__*/React__default.forwardRef(function DatePick
84
84
  [`${prefix}--date-picker--fluid--invalid`]: isFluid && invalid,
85
85
  [`${prefix}--date-picker--fluid--warn`]: isFluid && warn
86
86
  });
87
- const datePickerInputHelperId = !helperText ? undefined : `detepicker-input-helper-text-${datePickerInputInstanceId}`;
87
+ const datePickerInputHelperId = !helperText ? undefined : `datepicker-input-helper-text-${datePickerInputInstanceId}`;
88
88
  const inputProps = {
89
89
  ...rest,
90
90
  ...datePickerInputProps,
@@ -18,8 +18,7 @@ import { usePrefix } from '../../internal/usePrefix.js';
18
18
  import '../FluidForm/FluidForm.js';
19
19
  import { FormContext } from '../FluidForm/FormContext.js';
20
20
  import { useId } from '../../internal/useId.js';
21
- import { useFloating, size, flip, autoUpdate } from '@floating-ui/react';
22
- import { hide } from '../../node_modules/@floating-ui/dom/dist/floating-ui.dom.mjs.js';
21
+ import { useFloating, size, flip, hide, autoUpdate } from '@floating-ui/react';
23
22
  import { useFeatureFlag } from '../FeatureFlags/index.js';
24
23
  import { ListBoxSize, ListBoxType } from '../ListBox/ListBoxPropTypes.js';
25
24
 
@@ -4,7 +4,6 @@
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
- /// <reference types="react" />
8
7
  export interface FormContextProps {
9
8
  isFluid?: boolean;
10
9
  }
@@ -34,6 +34,14 @@ export interface FluidTextInputProps {
34
34
  * Specify whether the control is a password input
35
35
  */
36
36
  isPassword?: boolean;
37
+ /**
38
+ * Max character count allowed for the textInput. This is needed in order for enableCounter to display
39
+ */
40
+ maxCount?: number;
41
+ /**
42
+ * Specify whether to display the character counter
43
+ */
44
+ enableCounter?: boolean;
37
45
  /**
38
46
  * Provide the text that will be read by a screen reader when visiting this
39
47
  * control
@@ -67,6 +67,14 @@ FluidTextInput.propTypes = {
67
67
  * Specify whether the control is a password input
68
68
  */
69
69
  isPassword: PropTypes.bool,
70
+ /**
71
+ * Max character count allowed for the textInput. This is needed in order for enableCounter to display
72
+ */
73
+ maxCount: PropTypes.number,
74
+ /**
75
+ * Specify whether to display the character counter
76
+ */
77
+ enableCounter: PropTypes.bool,
70
78
  /**
71
79
  * Provide the text that will be read by a screen reader when visiting this
72
80
  * control
@@ -63,7 +63,7 @@ function CSSGrid(_ref) {
63
63
  }
64
64
  CSSGrid.propTypes = {
65
65
  /**
66
- * Specify grid aligment. Default is center
66
+ * Specify grid alignment. Default is center
67
67
  */
68
68
  align: PropTypes.oneOf(['start', 'center', 'end']),
69
69
  /**
@@ -20,7 +20,7 @@ function Grid(props) {
20
20
  }
21
21
  Grid.propTypes = {
22
22
  /**
23
- * Specify grid aligment. Default is center
23
+ * Specify grid alignment. Default is center
24
24
  */
25
25
  align: PropTypes.oneOf(['start', 'center', 'end']),
26
26
  /**
@@ -4,7 +4,6 @@
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
- /// <reference types="react" />
8
7
  import { PolymorphicProps } from '../../types/common';
9
8
  export interface GridBaseProps {
10
9
  /**
@@ -11,6 +11,6 @@ type SectionBaseProps = {
11
11
  level?: HeadingLevel;
12
12
  };
13
13
  export type SectionProps<E extends ElementType> = PolymorphicProps<E, SectionBaseProps>;
14
- export declare const Section: React.ForwardRefExoticComponent<Omit<SectionProps<React.ElementType<any, keyof React.JSX.IntrinsicElements>>, "ref"> & React.RefAttributes<unknown>>;
14
+ export declare const Section: React.ForwardRefExoticComponent<Omit<SectionProps<React.ElementType>, "ref"> & React.RefAttributes<unknown>>;
15
15
  export declare const Heading: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>, "ref"> & React.RefAttributes<HTMLHeadingElement>>;
16
16
  export {};