@carbon/react 1.76.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 (184) hide show
  1. package/.playwright/INTERNAL_AVT_REPORT_DO_NOT_USE.json +794 -759
  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 +34 -12
  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/Grid/CSSGrid.js +1 -1
  25. package/es/components/Grid/Grid.js +1 -1
  26. package/es/components/Grid/GridTypes.d.ts +0 -1
  27. package/es/components/Heading/index.d.ts +1 -1
  28. package/es/components/IconButton/index.d.ts +17 -1
  29. package/es/components/IconButton/index.js +20 -1
  30. package/es/components/InlineCheckbox/InlineCheckbox.js +1 -1
  31. package/es/components/InlineLoading/InlineLoading.d.ts +1 -1
  32. package/es/components/InlineLoading/InlineLoading.js +21 -7
  33. package/es/components/Menu/Menu.js +2 -2
  34. package/es/components/Menu/MenuContext.d.ts +1 -1
  35. package/es/components/MenuButton/index.d.ts +1 -1
  36. package/es/components/MenuButton/index.js +1 -2
  37. package/es/components/Modal/Modal.js +1 -1
  38. package/es/components/Modal/next/index.d.ts +175 -0
  39. package/es/components/MultiSelect/FilterableMultiSelect.d.ts +1 -1
  40. package/es/components/MultiSelect/FilterableMultiSelect.js +1 -2
  41. package/es/components/MultiSelect/MultiSelect.d.ts +1 -1
  42. package/es/components/MultiSelect/MultiSelect.js +1 -2
  43. package/es/components/Popover/index.js +2 -3
  44. package/es/components/PrimaryButton/PrimaryButton.d.ts +1 -1
  45. package/es/components/RadioTile/RadioTile.d.ts +1 -1
  46. package/es/components/SecondaryButton/SecondaryButton.d.ts +1 -1
  47. package/es/components/Slider/Slider.d.ts +1 -1
  48. package/es/components/Slider/Slider.js +1 -1
  49. package/es/components/Slider/index.d.ts +0 -1
  50. package/es/components/Tabs/Tabs.d.ts +3 -3
  51. package/es/components/Tabs/Tabs.js +4 -4
  52. package/es/components/Tag/DismissibleTag.d.ts +2 -2
  53. package/es/components/Tag/OperationalTag.d.ts +1 -1
  54. package/es/components/Tag/SelectableTag.d.ts +2 -2
  55. package/es/components/Text/index.d.ts +2 -2
  56. package/es/components/TextInput/PasswordInput.d.ts +1 -1
  57. package/es/components/Theme/index.d.ts +1 -1
  58. package/es/components/Tile/Tile.d.ts +1 -1
  59. package/es/components/Tile/Tile.js +1 -1
  60. package/es/components/Toggletip/index.d.ts +3 -3
  61. package/es/components/Toggletip/index.js +5 -4
  62. package/es/components/Tooltip/Tooltip.d.ts +17 -1
  63. package/es/components/Tooltip/Tooltip.js +12 -2
  64. package/es/components/TreeView/TreeNode.d.ts +27 -19
  65. package/es/components/TreeView/TreeNode.js +100 -31
  66. package/es/components/TreeView/TreeView.js +1 -1
  67. package/es/components/UIShell/Content.d.ts +9 -9
  68. package/es/components/UIShell/HeaderGlobalBar.d.ts +1 -1
  69. package/es/components/UIShell/HeaderMenu.d.ts +69 -25
  70. package/es/components/UIShell/HeaderMenuButton.d.ts +69 -27
  71. package/es/components/UIShell/HeaderMenuItem.d.ts +4 -3
  72. package/es/components/UIShell/HeaderMenuItem.js +1 -1
  73. package/es/components/UIShell/HeaderName.js +1 -1
  74. package/es/components/UIShell/HeaderNavigation.d.ts +69 -25
  75. package/es/components/UIShell/Link.d.ts +14 -11
  76. package/es/components/UIShell/Link.js +5 -6
  77. package/es/components/UIShell/SideNav.js +3 -3
  78. package/es/components/UIShell/SideNavLink.js +1 -1
  79. package/es/components/UIShell/SideNavMenuItem.d.ts +51 -3
  80. package/es/components/UIShell/SideNavMenuItem.js +6 -6
  81. package/es/components/UIShell/SwitcherItem.d.ts +2 -2
  82. package/es/components/UIShell/SwitcherItem.js +1 -1
  83. package/es/internal/PolymorphicProps.d.ts +0 -1
  84. package/es/internal/Selection.d.ts +38 -0
  85. package/es/internal/Selection.js +26 -113
  86. package/es/node_modules/es-toolkit/dist/compat/function/debounce.mjs.js +55 -0
  87. package/es/node_modules/es-toolkit/dist/compat/function/throttle.mjs.js +23 -0
  88. package/es/node_modules/es-toolkit/dist/function/debounce.mjs.js +70 -0
  89. package/es/tools/wrapComponent.d.ts +1 -1
  90. package/lib/components/Button/Button.d.ts +9 -1
  91. package/lib/components/Button/Button.js +8 -0
  92. package/lib/components/CodeSnippet/CodeSnippet.d.ts +2 -2
  93. package/lib/components/ComboBox/ComboBox.d.ts +2 -2
  94. package/lib/components/ComboBox/ComboBox.js +34 -12
  95. package/lib/components/ComboButton/index.js +1 -2
  96. package/lib/components/ComposedModal/ComposedModal.js +2 -2
  97. package/lib/components/ContentSwitcher/index.d.ts +0 -1
  98. package/lib/components/ContextMenu/useContextMenu.d.ts +0 -1
  99. package/lib/components/Copy/Copy.js +2 -2
  100. package/lib/components/DataTable/DataTable.d.ts +12 -20
  101. package/lib/components/DataTable/DataTable.js +1 -9
  102. package/lib/components/DataTable/Table.js +3 -3
  103. package/lib/components/DataTable/TableActionList.d.ts +1 -1
  104. package/lib/components/DataTable/TableBody.js +1 -1
  105. package/lib/components/DataTable/TableContext.d.ts +0 -1
  106. package/lib/components/DataTable/TableHead.d.ts +1 -1
  107. package/lib/components/DataTable/TableToolbarContent.d.ts +1 -1
  108. package/lib/components/DatePicker/plugins/fixEventsPlugin.js +2 -2
  109. package/lib/components/DatePickerInput/DatePickerInput.js +1 -1
  110. package/lib/components/Dropdown/Dropdown.js +1 -2
  111. package/lib/components/FluidForm/FormContext.d.ts +0 -1
  112. package/lib/components/Grid/CSSGrid.js +1 -1
  113. package/lib/components/Grid/Grid.js +1 -1
  114. package/lib/components/Grid/GridTypes.d.ts +0 -1
  115. package/lib/components/Heading/index.d.ts +1 -1
  116. package/lib/components/IconButton/index.d.ts +17 -1
  117. package/lib/components/IconButton/index.js +20 -1
  118. package/lib/components/InlineCheckbox/InlineCheckbox.js +1 -1
  119. package/lib/components/InlineLoading/InlineLoading.d.ts +1 -1
  120. package/lib/components/InlineLoading/InlineLoading.js +20 -6
  121. package/lib/components/Menu/Menu.js +2 -2
  122. package/lib/components/Menu/MenuContext.d.ts +1 -1
  123. package/lib/components/MenuButton/index.d.ts +1 -1
  124. package/lib/components/MenuButton/index.js +1 -2
  125. package/lib/components/Modal/Modal.js +2 -2
  126. package/lib/components/Modal/next/index.d.ts +175 -0
  127. package/lib/components/MultiSelect/FilterableMultiSelect.d.ts +1 -1
  128. package/lib/components/MultiSelect/FilterableMultiSelect.js +1 -2
  129. package/lib/components/MultiSelect/MultiSelect.d.ts +1 -1
  130. package/lib/components/MultiSelect/MultiSelect.js +1 -2
  131. package/lib/components/Popover/index.js +2 -3
  132. package/lib/components/PrimaryButton/PrimaryButton.d.ts +1 -1
  133. package/lib/components/RadioTile/RadioTile.d.ts +1 -1
  134. package/lib/components/SecondaryButton/SecondaryButton.d.ts +1 -1
  135. package/lib/components/Slider/Slider.d.ts +1 -1
  136. package/lib/components/Slider/Slider.js +2 -2
  137. package/lib/components/Slider/index.d.ts +0 -1
  138. package/lib/components/Tabs/Tabs.d.ts +3 -3
  139. package/lib/components/Tabs/Tabs.js +6 -6
  140. package/lib/components/Tag/DismissibleTag.d.ts +2 -2
  141. package/lib/components/Tag/OperationalTag.d.ts +1 -1
  142. package/lib/components/Tag/SelectableTag.d.ts +2 -2
  143. package/lib/components/Text/index.d.ts +2 -2
  144. package/lib/components/TextInput/PasswordInput.d.ts +1 -1
  145. package/lib/components/Theme/index.d.ts +1 -1
  146. package/lib/components/Tile/Tile.d.ts +1 -1
  147. package/lib/components/Tile/Tile.js +1 -1
  148. package/lib/components/Toggletip/index.d.ts +3 -3
  149. package/lib/components/Toggletip/index.js +5 -4
  150. package/lib/components/Tooltip/Tooltip.d.ts +17 -1
  151. package/lib/components/Tooltip/Tooltip.js +12 -2
  152. package/lib/components/TreeView/TreeNode.d.ts +27 -19
  153. package/lib/components/TreeView/TreeNode.js +100 -31
  154. package/lib/components/TreeView/TreeView.js +1 -1
  155. package/lib/components/UIShell/Content.d.ts +9 -9
  156. package/lib/components/UIShell/HeaderGlobalBar.d.ts +1 -1
  157. package/lib/components/UIShell/HeaderMenu.d.ts +69 -25
  158. package/lib/components/UIShell/HeaderMenuButton.d.ts +69 -27
  159. package/lib/components/UIShell/HeaderMenuItem.d.ts +4 -3
  160. package/lib/components/UIShell/HeaderMenuItem.js +1 -1
  161. package/lib/components/UIShell/HeaderName.js +1 -1
  162. package/lib/components/UIShell/HeaderNavigation.d.ts +69 -25
  163. package/lib/components/UIShell/Link.d.ts +14 -11
  164. package/lib/components/UIShell/Link.js +4 -4
  165. package/lib/components/UIShell/SideNav.js +3 -3
  166. package/lib/components/UIShell/SideNavLink.js +1 -1
  167. package/lib/components/UIShell/SideNavMenuItem.d.ts +51 -3
  168. package/lib/components/UIShell/SideNavMenuItem.js +6 -6
  169. package/lib/components/UIShell/SwitcherItem.d.ts +2 -2
  170. package/lib/components/UIShell/SwitcherItem.js +1 -1
  171. package/lib/internal/PolymorphicProps.d.ts +0 -1
  172. package/lib/internal/Selection.d.ts +38 -0
  173. package/lib/internal/Selection.js +24 -114
  174. package/lib/node_modules/es-toolkit/dist/compat/function/debounce.mjs.js +59 -0
  175. package/lib/node_modules/es-toolkit/dist/compat/function/throttle.mjs.js +27 -0
  176. package/lib/node_modules/es-toolkit/dist/function/debounce.mjs.js +74 -0
  177. package/lib/tools/wrapComponent.d.ts +1 -1
  178. package/package.json +10 -9
  179. package/es/node_modules/@floating-ui/core/dist/floating-ui.core.mjs.js +0 -896
  180. package/es/node_modules/@floating-ui/dom/dist/floating-ui.dom.mjs.js +0 -76
  181. package/es/node_modules/@floating-ui/utils/dist/floating-ui.utils.mjs.js +0 -139
  182. package/lib/node_modules/@floating-ui/core/dist/floating-ui.core.mjs.js +0 -909
  183. package/lib/node_modules/@floating-ui/dom/dist/floating-ui.dom.mjs.js +0 -80
  184. package/lib/node_modules/@floating-ui/utils/dist/floating-ui.utils.mjs.js +0 -163
@@ -41,56 +41,98 @@ declare namespace HeaderMenuButton {
41
41
  length: 1;
42
42
  toString(): string;
43
43
  toLocaleString(): string;
44
+ toLocaleString(locales: string | string[], options?: Intl.NumberFormatOptions & Intl.DateTimeFormatOptions): string;
44
45
  pop(): string | undefined;
45
46
  push(...items: string[]): number;
46
47
  concat(...items: ConcatArray<string>[]): string[];
47
48
  concat(...items: (string | ConcatArray<string>)[]): string[];
48
- join(separator?: string | undefined): string;
49
+ join(separator?: string): string;
49
50
  reverse(): string[];
50
51
  shift(): string | undefined;
51
- slice(start?: number | undefined, end?: number | undefined): string[];
52
+ slice(start?: number, end?: number): string[];
52
53
  sort(compareFn?: ((a: string, b: string) => number) | undefined): [key: string];
53
- splice(start: number, deleteCount?: number | undefined): string[];
54
+ splice(start: number, deleteCount?: number): string[];
54
55
  splice(start: number, deleteCount: number, ...items: string[]): string[];
55
56
  unshift(...items: string[]): number;
56
- indexOf(searchElement: string, fromIndex?: number | undefined): number;
57
- lastIndexOf(searchElement: string, fromIndex?: number | undefined): number;
57
+ indexOf(searchElement: string, fromIndex?: number): number;
58
+ lastIndexOf(searchElement: string, fromIndex?: number): number;
58
59
  every<S extends string>(predicate: (value: string, index: number, array: string[]) => value is S, thisArg?: any): this is S[];
59
60
  every(predicate: (value: string, index: number, array: string[]) => unknown, thisArg?: any): boolean;
60
61
  some(predicate: (value: string, index: number, array: string[]) => unknown, thisArg?: any): boolean;
61
62
  forEach(callbackfn: (value: string, index: number, array: string[]) => void, thisArg?: any): void;
62
63
  map<U>(callbackfn: (value: string, index: number, array: string[]) => U, thisArg?: any): U[];
63
- filter<S_1 extends string>(predicate: (value: string, index: number, array: string[]) => value is S_1, thisArg?: any): S_1[];
64
+ filter<S extends string>(predicate: (value: string, index: number, array: string[]) => value is S, thisArg?: any): S[];
64
65
  filter(predicate: (value: string, index: number, array: string[]) => unknown, thisArg?: any): string[];
65
66
  reduce(callbackfn: (previousValue: string, currentValue: string, currentIndex: number, array: string[]) => string): string;
66
67
  reduce(callbackfn: (previousValue: string, currentValue: string, currentIndex: number, array: string[]) => string, initialValue: string): string;
67
- reduce<U_1>(callbackfn: (previousValue: U_1, currentValue: string, currentIndex: number, array: string[]) => U_1, initialValue: U_1): U_1;
68
+ reduce<U>(callbackfn: (previousValue: U, currentValue: string, currentIndex: number, array: string[]) => U, initialValue: U): U;
68
69
  reduceRight(callbackfn: (previousValue: string, currentValue: string, currentIndex: number, array: string[]) => string): string;
69
70
  reduceRight(callbackfn: (previousValue: string, currentValue: string, currentIndex: number, array: string[]) => string, initialValue: string): string;
70
- reduceRight<U_2>(callbackfn: (previousValue: U_2, currentValue: string, currentIndex: number, array: string[]) => U_2, initialValue: U_2): U_2;
71
- find<S_2 extends string>(predicate: (this: void, value: string, index: number, obj: string[]) => value is S_2, thisArg?: any): S_2 | undefined;
71
+ reduceRight<U>(callbackfn: (previousValue: U, currentValue: string, currentIndex: number, array: string[]) => U, initialValue: U): U;
72
+ find<S extends string>(predicate: (value: string, index: number, obj: string[]) => value is S, thisArg?: any): S | undefined;
72
73
  find(predicate: (value: string, index: number, obj: string[]) => unknown, thisArg?: any): string | undefined;
73
74
  findIndex(predicate: (value: string, index: number, obj: string[]) => unknown, thisArg?: any): number;
74
- fill(value: string, start?: number | undefined, end?: number | undefined): [key: string];
75
- copyWithin(target: number, start: number, end?: number | undefined): [key: string];
76
- entries(): IterableIterator<[number, string]>;
77
- keys(): IterableIterator<number>; /**
78
- * Specify whether the menu button is collapsible.
79
- */
80
- values(): IterableIterator<string>;
81
- includes(searchElement: string, fromIndex?: number | undefined): boolean;
82
- flatMap<U_3, This = undefined>(callback: (this: This, value: string, index: number, array: string[]) => U_3 | readonly U_3[], thisArg?: This | undefined): U_3[];
75
+ fill(value: string, start?: number, end?: number): [key: string];
76
+ copyWithin(target: number, start: number, end?: number): [key: string];
77
+ entries(): ArrayIterator<[number, string]>;
78
+ keys(): ArrayIterator<number>;
79
+ values(): ArrayIterator<string>;
80
+ includes(searchElement: string, fromIndex?: number): boolean;
81
+ flatMap<U, This = undefined>(callback: (this: This, value: string, index: number, array: string[]) => U | readonly U[], thisArg?: This | undefined): U[];
83
82
  flat<A, D extends number = 1>(this: A, depth?: D | undefined): FlatArray<A, D>[];
84
83
  at(index: number): string | undefined;
85
- [Symbol.iterator](): IterableIterator<string>;
86
- [Symbol.unscopables](): {
87
- copyWithin: boolean;
88
- entries: boolean;
89
- fill: boolean;
90
- find: boolean;
91
- findIndex: boolean;
92
- keys: boolean;
93
- values: boolean;
84
+ findLast<S extends string>(predicate: (value: string, index: number, array: string[]) => value is S, thisArg?: any): S | undefined;
85
+ findLast(predicate: (value: string, index: number, array: string[]) => unknown, thisArg?: any): string | undefined;
86
+ findLastIndex(predicate: (value: string, index: number, array: string[]) => unknown, thisArg?: any): number;
87
+ toReversed(): string[];
88
+ toSorted(compareFn?: ((a: string, b: string) => number) | undefined): string[];
89
+ toSpliced(start: number, deleteCount: number, ...items: string[]): string[];
90
+ toSpliced(start: number, deleteCount?: number): string[];
91
+ with(index: number, value: string): string[];
92
+ [Symbol.iterator](): ArrayIterator<string>;
93
+ [Symbol.unscopables]: {
94
+ [x: number]: boolean | undefined;
95
+ length?: boolean | undefined;
96
+ toString?: boolean | undefined;
97
+ toLocaleString?: boolean | undefined;
98
+ pop?: boolean | undefined;
99
+ push?: boolean | undefined;
100
+ concat?: boolean | undefined;
101
+ join?: boolean | undefined;
102
+ reverse?: boolean | undefined;
103
+ shift?: boolean | undefined;
104
+ slice?: boolean | undefined;
105
+ sort?: boolean | undefined;
106
+ splice?: boolean | undefined;
107
+ unshift?: boolean | undefined;
108
+ indexOf?: boolean | undefined;
109
+ lastIndexOf?: boolean | undefined;
110
+ every?: boolean | undefined;
111
+ some?: boolean | undefined;
112
+ forEach?: boolean | undefined;
113
+ map?: boolean | undefined;
114
+ filter?: boolean | undefined;
115
+ reduce?: boolean | undefined;
116
+ reduceRight?: boolean | undefined;
117
+ find?: boolean | undefined;
118
+ findIndex?: boolean | undefined;
119
+ fill?: boolean | undefined;
120
+ copyWithin?: boolean | undefined;
121
+ entries?: boolean | undefined;
122
+ keys?: boolean | undefined;
123
+ values?: boolean | undefined;
124
+ includes?: boolean | undefined;
125
+ flatMap?: boolean | undefined;
126
+ flat?: boolean | undefined;
127
+ at?: boolean | undefined;
128
+ findLast?: boolean | undefined;
129
+ findLastIndex?: boolean | undefined;
130
+ toReversed?: boolean | undefined;
131
+ toSorted?: boolean | undefined;
132
+ toSpliced?: boolean | undefined;
133
+ with?: boolean | undefined;
134
+ [Symbol.iterator]?: boolean | undefined;
135
+ readonly [Symbol.unscopables]?: boolean | undefined;
94
136
  };
95
137
  };
96
138
  }
@@ -5,8 +5,8 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
  import { type ComponentProps, type ForwardedRef, type ReactNode, ElementType, WeakValidationMap } from 'react';
8
- import { LinkProps } from './Link';
9
- export type HeaderMenuItemProps<E extends ElementType> = LinkProps<E> & {
8
+ import { PolymorphicComponentPropWithRef } from '../../internal/PolymorphicProps';
9
+ export interface HeaderMenuItemBaseProps {
10
10
  className?: string | undefined;
11
11
  isActive?: boolean | undefined;
12
12
  isCurrentPage?: boolean | undefined;
@@ -14,7 +14,8 @@ export type HeaderMenuItemProps<E extends ElementType> = LinkProps<E> & {
14
14
  children: ReactNode;
15
15
  role?: ComponentProps<'li'>['role'];
16
16
  tabIndex?: number | undefined;
17
- };
17
+ }
18
+ export type HeaderMenuItemProps<E extends ElementType = 'a'> = PolymorphicComponentPropWithRef<E, HeaderMenuItemBaseProps>;
18
19
  export interface HeaderMenuItemComponent {
19
20
  <E extends ElementType = 'a'>(props: HeaderMenuItemProps<E> & {
20
21
  ref?: ForwardedRef<ElementType>;
@@ -47,7 +47,7 @@ const HeaderMenuItem = /*#__PURE__*/React.forwardRef(function HeaderMenuItemRend
47
47
  return /*#__PURE__*/React__default["default"].createElement("li", {
48
48
  className: className,
49
49
  role: role
50
- }, /*#__PURE__*/React__default["default"].createElement(Link["default"], _rollupPluginBabelHelpers["extends"]({}, rest, {
50
+ }, /*#__PURE__*/React__default["default"].createElement(Link.Link, _rollupPluginBabelHelpers["extends"]({}, rest, {
51
51
  "aria-current": ariaCurrent,
52
52
  className: linkClassName,
53
53
  ref: ref,
@@ -31,7 +31,7 @@ function HeaderName(_ref) {
31
31
  } = _ref;
32
32
  const selectorPrefix = usePrefix.usePrefix();
33
33
  const className = cx__default["default"](`${selectorPrefix}--header__name`, customClassName);
34
- return /*#__PURE__*/React__default["default"].createElement(Link["default"], _rollupPluginBabelHelpers["extends"]({}, rest, {
34
+ return /*#__PURE__*/React__default["default"].createElement(Link.Link, _rollupPluginBabelHelpers["extends"]({}, rest, {
35
35
  className: className
36
36
  }), prefix && /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement("span", {
37
37
  className: `${selectorPrefix}--header__name--prefix`
@@ -23,54 +23,98 @@ declare namespace HeaderNavigation {
23
23
  length: 1;
24
24
  toString(): string;
25
25
  toLocaleString(): string;
26
+ toLocaleString(locales: string | string[], options?: Intl.NumberFormatOptions & Intl.DateTimeFormatOptions): string;
26
27
  pop(): string | undefined;
27
28
  push(...items: string[]): number;
28
29
  concat(...items: ConcatArray<string>[]): string[];
29
30
  concat(...items: (string | ConcatArray<string>)[]): string[];
30
- join(separator?: string | undefined): string;
31
+ join(separator?: string): string;
31
32
  reverse(): string[];
32
33
  shift(): string | undefined;
33
- slice(start?: number | undefined, end?: number | undefined): string[];
34
+ slice(start?: number, end?: number): string[];
34
35
  sort(compareFn?: ((a: string, b: string) => number) | undefined): [key: string];
35
- splice(start: number, deleteCount?: number | undefined): string[];
36
+ splice(start: number, deleteCount?: number): string[];
36
37
  splice(start: number, deleteCount: number, ...items: string[]): string[];
37
38
  unshift(...items: string[]): number;
38
- indexOf(searchElement: string, fromIndex?: number | undefined): number;
39
- lastIndexOf(searchElement: string, fromIndex?: number | undefined): number;
39
+ indexOf(searchElement: string, fromIndex?: number): number;
40
+ lastIndexOf(searchElement: string, fromIndex?: number): number;
40
41
  every<S extends string>(predicate: (value: string, index: number, array: string[]) => value is S, thisArg?: any): this is S[];
41
42
  every(predicate: (value: string, index: number, array: string[]) => unknown, thisArg?: any): boolean;
42
43
  some(predicate: (value: string, index: number, array: string[]) => unknown, thisArg?: any): boolean;
43
44
  forEach(callbackfn: (value: string, index: number, array: string[]) => void, thisArg?: any): void;
44
45
  map<U>(callbackfn: (value: string, index: number, array: string[]) => U, thisArg?: any): U[];
45
- filter<S_1 extends string>(predicate: (value: string, index: number, array: string[]) => value is S_1, thisArg?: any): S_1[];
46
+ filter<S extends string>(predicate: (value: string, index: number, array: string[]) => value is S, thisArg?: any): S[];
46
47
  filter(predicate: (value: string, index: number, array: string[]) => unknown, thisArg?: any): string[];
47
48
  reduce(callbackfn: (previousValue: string, currentValue: string, currentIndex: number, array: string[]) => string): string;
48
49
  reduce(callbackfn: (previousValue: string, currentValue: string, currentIndex: number, array: string[]) => string, initialValue: string): string;
49
- reduce<U_1>(callbackfn: (previousValue: U_1, currentValue: string, currentIndex: number, array: string[]) => U_1, initialValue: U_1): U_1;
50
+ reduce<U>(callbackfn: (previousValue: U, currentValue: string, currentIndex: number, array: string[]) => U, initialValue: U): U;
50
51
  reduceRight(callbackfn: (previousValue: string, currentValue: string, currentIndex: number, array: string[]) => string): string;
51
52
  reduceRight(callbackfn: (previousValue: string, currentValue: string, currentIndex: number, array: string[]) => string, initialValue: string): string;
52
- reduceRight<U_2>(callbackfn: (previousValue: U_2, currentValue: string, currentIndex: number, array: string[]) => U_2, initialValue: U_2): U_2;
53
- find<S_2 extends string>(predicate: (this: void, value: string, index: number, obj: string[]) => value is S_2, thisArg?: any): S_2 | undefined;
53
+ reduceRight<U>(callbackfn: (previousValue: U, currentValue: string, currentIndex: number, array: string[]) => U, initialValue: U): U;
54
+ find<S extends string>(predicate: (value: string, index: number, obj: string[]) => value is S, thisArg?: any): S | undefined;
54
55
  find(predicate: (value: string, index: number, obj: string[]) => unknown, thisArg?: any): string | undefined;
55
56
  findIndex(predicate: (value: string, index: number, obj: string[]) => unknown, thisArg?: any): number;
56
- fill(value: string, start?: number | undefined, end?: number | undefined): [key: string];
57
- copyWithin(target: number, start: number, end?: number | undefined): [key: string];
58
- entries(): IterableIterator<[number, string]>;
59
- keys(): IterableIterator<number>;
60
- values(): IterableIterator<string>;
61
- includes(searchElement: string, fromIndex?: number | undefined): boolean;
62
- flatMap<U_3, This = undefined>(callback: (this: This, value: string, index: number, array: string[]) => U_3 | readonly U_3[], thisArg?: This | undefined): U_3[];
57
+ fill(value: string, start?: number, end?: number): [key: string];
58
+ copyWithin(target: number, start: number, end?: number): [key: string];
59
+ entries(): ArrayIterator<[number, string]>;
60
+ keys(): ArrayIterator<number>;
61
+ values(): ArrayIterator<string>;
62
+ includes(searchElement: string, fromIndex?: number): boolean;
63
+ flatMap<U, This = undefined>(callback: (this: This, value: string, index: number, array: string[]) => U | readonly U[], thisArg?: This | undefined): U[];
63
64
  flat<A, D extends number = 1>(this: A, depth?: D | undefined): FlatArray<A, D>[];
64
65
  at(index: number): string | undefined;
65
- [Symbol.iterator](): IterableIterator<string>;
66
- [Symbol.unscopables](): {
67
- copyWithin: boolean;
68
- entries: boolean;
69
- fill: boolean;
70
- find: boolean;
71
- findIndex: boolean;
72
- keys: boolean;
73
- values: boolean;
66
+ findLast<S extends string>(predicate: (value: string, index: number, array: string[]) => value is S, thisArg?: any): S | undefined;
67
+ findLast(predicate: (value: string, index: number, array: string[]) => unknown, thisArg?: any): string | undefined;
68
+ findLastIndex(predicate: (value: string, index: number, array: string[]) => unknown, thisArg?: any): number;
69
+ toReversed(): string[];
70
+ toSorted(compareFn?: ((a: string, b: string) => number) | undefined): string[];
71
+ toSpliced(start: number, deleteCount: number, ...items: string[]): string[];
72
+ toSpliced(start: number, deleteCount?: number): string[];
73
+ with(index: number, value: string): string[];
74
+ [Symbol.iterator](): ArrayIterator<string>;
75
+ [Symbol.unscopables]: {
76
+ [x: number]: boolean | undefined;
77
+ length?: boolean | undefined;
78
+ toString?: boolean | undefined;
79
+ toLocaleString?: boolean | undefined;
80
+ pop?: boolean | undefined;
81
+ push?: boolean | undefined;
82
+ concat?: boolean | undefined;
83
+ join?: boolean | undefined;
84
+ reverse?: boolean | undefined;
85
+ shift?: boolean | undefined;
86
+ slice?: boolean | undefined;
87
+ sort?: boolean | undefined;
88
+ splice?: boolean | undefined;
89
+ unshift?: boolean | undefined;
90
+ indexOf?: boolean | undefined;
91
+ lastIndexOf?: boolean | undefined;
92
+ every?: boolean | undefined;
93
+ some?: boolean | undefined;
94
+ forEach?: boolean | undefined;
95
+ map?: boolean | undefined;
96
+ filter?: boolean | undefined;
97
+ reduce?: boolean | undefined;
98
+ reduceRight?: boolean | undefined;
99
+ find?: boolean | undefined;
100
+ findIndex?: boolean | undefined;
101
+ fill?: boolean | undefined;
102
+ copyWithin?: boolean | undefined;
103
+ entries?: boolean | undefined;
104
+ keys?: boolean | undefined;
105
+ values?: boolean | undefined;
106
+ includes?: boolean | undefined;
107
+ flatMap?: boolean | undefined;
108
+ flat?: boolean | undefined;
109
+ at?: boolean | undefined;
110
+ findLast?: boolean | undefined;
111
+ findLastIndex?: boolean | undefined;
112
+ toReversed?: boolean | undefined;
113
+ toSorted?: boolean | undefined;
114
+ toSpliced?: boolean | undefined;
115
+ with?: boolean | undefined;
116
+ [Symbol.iterator]?: boolean | undefined;
117
+ readonly [Symbol.unscopables]?: boolean | undefined;
74
118
  };
75
119
  };
76
120
  }
@@ -5,26 +5,29 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
  import PropTypes from 'prop-types';
8
- import React, { type ElementType, type Ref } from 'react';
9
- import { type PolymorphicProps } from '../../types/common';
10
- type LinkBaseProps<E extends ElementType> = {
8
+ import React, { ForwardedRef, type ElementType, type WeakValidationMap } from 'react';
9
+ import { PolymorphicProps } from '../../types/common';
10
+ import { HeaderMenuItemBaseProps } from './HeaderMenuItem';
11
+ export interface LinkBaseProps {
11
12
  /**
12
13
  * @deprecated Use `as` instead
13
14
  */
14
- element?: E | undefined;
15
- ref?: Ref<E>;
16
- };
17
- export type LinkProps<E extends ElementType> = PolymorphicProps<E, LinkBaseProps<E>>;
15
+ element?: undefined;
16
+ ref?: ForwardedRef<ElementType>;
17
+ }
18
+ export type LinkProps<E extends React.ElementType> = PolymorphicProps<E, LinkBaseProps>;
19
+ export interface LinkComponent {
20
+ <E extends ElementType = 'a'>(props: LinkProps<E> | HeaderMenuItemBaseProps): JSX.Element | null;
21
+ displayName?: string;
22
+ propTypes?: WeakValidationMap<LinkProps<any>>;
23
+ }
24
+ export declare const Link: LinkComponent;
18
25
  /**
19
26
  * Link is a custom component that allows us to supporting rendering elements
20
27
  * other than `a` in our markup. The goal is to allow users to support passing
21
28
  * in their own components to support use-cases like `react-router` or
22
29
  * `@reach/router`
23
30
  */
24
- declare const Link: (<E extends React.ElementType<any, keyof React.JSX.IntrinsicElements> = "a">(props: LinkProps<E>) => JSX.Element) & {
25
- displayName?: string | undefined;
26
- propTypes?: React.WeakValidationMap<LinkProps<any>> | undefined;
27
- };
28
31
  declare const LinkPropTypes: {
29
32
  /**
30
33
  * Provide a custom element or component to render the top-level node for the
@@ -22,7 +22,7 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
22
22
  // Note: Maybe we should use `as` instead of `element`? `as` appears to be
23
23
  // standard and is used in other places in this project.
24
24
 
25
- function LinkRenderFunction(_ref, ref) {
25
+ const Link = /*#__PURE__*/React__default["default"].forwardRef(function LinkRenderFunction(_ref, ref) {
26
26
  let {
27
27
  element,
28
28
  as: BaseComponent,
@@ -35,15 +35,14 @@ function LinkRenderFunction(_ref, ref) {
35
35
  return /*#__PURE__*/React__default["default"].createElement(BaseComponentAsAny, _rollupPluginBabelHelpers["extends"]({
36
36
  ref: ref
37
37
  }, rest));
38
- }
39
-
38
+ });
40
39
  /**
41
40
  * Link is a custom component that allows us to supporting rendering elements
42
41
  * other than `a` in our markup. The goal is to allow users to support passing
43
42
  * in their own components to support use-cases like `react-router` or
44
43
  * `@reach/router`
45
44
  */
46
- const Link = /*#__PURE__*/React.forwardRef(LinkRenderFunction);
45
+
47
46
  const LinkPropTypes = {
48
47
  /**
49
48
  * Provide a custom element or component to render the top-level node for the
@@ -66,5 +65,6 @@ const LinkPropTypes = {
66
65
  Link.displayName = 'Link';
67
66
  Link.propTypes = LinkPropTypes;
68
67
 
68
+ exports.Link = Link;
69
69
  exports.LinkPropTypes = LinkPropTypes;
70
70
  exports["default"] = Link;
@@ -208,12 +208,12 @@ SideNav.propTypes = {
208
208
  */
209
209
  defaultExpanded: PropTypes__default["default"].bool,
210
210
  /**
211
- * Specify the duration in milliseconds to delay before displaying the sidenavigation
211
+ * Specify the duration in milliseconds to delay before displaying the side navigation
212
212
  */
213
213
  enterDelayMs: PropTypes__default["default"].number,
214
214
  /**
215
215
  * If `true`, the SideNav will be expanded, otherwise it will be collapsed.
216
- * Using this prop causes SideNav to become a controled component.
216
+ * Using this prop causes SideNav to become a controlled component.
217
217
  */
218
218
  expanded: PropTypes__default["default"].bool,
219
219
  /**
@@ -259,7 +259,7 @@ SideNav.propTypes = {
259
259
 
260
260
  /**
261
261
  * Provide a custom function for translating all message ids within this
262
- * component. This function will take in two arguments: the mesasge Id and the
262
+ * component. This function will take in two arguments: the message Id and the
263
263
  * state of the component. From this, you should return a string representing
264
264
  * the label you want displayed or read by screen readers.
265
265
  */
@@ -46,7 +46,7 @@ const SideNavLink = /*#__PURE__*/React.forwardRef(function SideNavLink(_ref, ref
46
46
  });
47
47
  return /*#__PURE__*/React__default["default"].createElement(SideNavItem["default"], {
48
48
  large: large
49
- }, /*#__PURE__*/React__default["default"].createElement(Link["default"], _rollupPluginBabelHelpers["extends"]({}, rest, {
49
+ }, /*#__PURE__*/React__default["default"].createElement(Link.Link, _rollupPluginBabelHelpers["extends"]({}, rest, {
50
50
  className: className,
51
51
  ref: ref,
52
52
  tabIndex: tabIndex === undefined ? !isSideNavExpanded && !isRail ? -1 : 0 : tabIndex
@@ -6,7 +6,7 @@
6
6
  */
7
7
  import React, { ElementType, ComponentProps } from 'react';
8
8
  import Link from './Link';
9
- export interface SideNavMenuItemProps extends ComponentProps<typeof Link> {
9
+ export type SideNavMenuItemProps = ComponentProps<typeof Link> & {
10
10
  /**
11
11
  * Specify the children to be rendered inside of the `SideNavMenuItem`
12
12
  */
@@ -29,6 +29,54 @@ export interface SideNavMenuItemProps extends ComponentProps<typeof Link> {
29
29
  * Optional component to render instead of default Link
30
30
  */
31
31
  as?: ElementType;
32
- }
33
- declare const SideNavMenuItem: React.ForwardRefExoticComponent<Omit<SideNavMenuItemProps, "ref"> & React.RefAttributes<HTMLElement>>;
32
+ };
33
+ declare const SideNavMenuItem: React.ForwardRefExoticComponent<((import("./HeaderMenuItem").HeaderMenuItemBaseProps & {
34
+ /**
35
+ * Specify the children to be rendered inside of the `SideNavMenuItem`
36
+ */
37
+ children?: React.ReactNode;
38
+ /**
39
+ * Provide an optional class to be applied to the containing node
40
+ */
41
+ className?: string;
42
+ /**
43
+ * Optionally specify whether the link is "active". An active link is one that
44
+ * has an href that is the same as the current page. Can also pass in
45
+ * `aria-current="page"`, as well.
46
+ */
47
+ isActive?: boolean;
48
+ /**
49
+ * Optionally provide an href for the underlying li`
50
+ */
51
+ href?: string;
52
+ /**
53
+ * Optional component to render instead of default Link
54
+ */
55
+ as?: ElementType;
56
+ }) | Omit<import("./Link").LinkBaseProps & Omit<any, "as"> & {
57
+ as?: React.ElementType | undefined;
58
+ } & {
59
+ /**
60
+ * Specify the children to be rendered inside of the `SideNavMenuItem`
61
+ */
62
+ children?: React.ReactNode;
63
+ /**
64
+ * Provide an optional class to be applied to the containing node
65
+ */
66
+ className?: string;
67
+ /**
68
+ * Optionally specify whether the link is "active". An active link is one that
69
+ * has an href that is the same as the current page. Can also pass in
70
+ * `aria-current="page"`, as well.
71
+ */
72
+ isActive?: boolean;
73
+ /**
74
+ * Optionally provide an href for the underlying li`
75
+ */
76
+ href?: string;
77
+ /**
78
+ * Optional component to render instead of default Link
79
+ */
80
+ as?: ElementType;
81
+ }, "ref">) & React.RefAttributes<HTMLElement>>;
34
82
  export default SideNavMenuItem;
@@ -28,7 +28,7 @@ const SideNavMenuItem = /*#__PURE__*/React__default["default"].forwardRef(functi
28
28
  const {
29
29
  children,
30
30
  className: customClassName,
31
- as: Component = Link["default"],
31
+ as: Component = Link.Link,
32
32
  isActive,
33
33
  ...rest
34
34
  } = props;
@@ -46,6 +46,10 @@ const SideNavMenuItem = /*#__PURE__*/React__default["default"].forwardRef(functi
46
46
  });
47
47
  SideNavMenuItem.displayName = 'SideNavMenuItem';
48
48
  SideNavMenuItem.propTypes = {
49
+ /**
50
+ * Optional component to render instead of default Link
51
+ */
52
+ as: PropTypes__default["default"].elementType,
49
53
  /**
50
54
  * Specify the children to be rendered inside of the `SideNavMenuItem`
51
55
  */
@@ -63,11 +67,7 @@ SideNavMenuItem.propTypes = {
63
67
  * has an href that is the same as the current page. Can also pass in
64
68
  * `aria-current="page"`, as well.
65
69
  */
66
- isActive: PropTypes__default["default"].bool,
67
- /**
68
- * Optional component to render instead of default Link
69
- */
70
- as: PropTypes__default["default"].elementType
70
+ isActive: PropTypes__default["default"].bool
71
71
  };
72
72
 
73
73
  exports["default"] = SideNavMenuItem;
@@ -1,4 +1,4 @@
1
- import React, { HTMLAttributeAnchorTarget } from 'react';
1
+ import React, { HTMLAttributeAnchorTarget, KeyboardEvent } from 'react';
2
2
  export interface BaseSwitcherItemProps {
3
3
  /**
4
4
  * Specify the text content for the link
@@ -61,5 +61,5 @@ export interface SwitcherItemWithAriaLabelledBy extends BaseSwitcherItemProps {
61
61
  'aria-labelledby': string;
62
62
  }
63
63
  export type SwitcherItemProps = SwitcherItemWithAriaLabel | SwitcherItemWithAriaLabelledBy;
64
- declare const SwitcherItem: React.ForwardRefExoticComponent<SwitcherItemProps & React.RefAttributes<React.ElementType<any, keyof React.JSX.IntrinsicElements>>>;
64
+ declare const SwitcherItem: React.ForwardRefExoticComponent<SwitcherItemProps & React.RefAttributes<React.ElementType>>;
65
65
  export default SwitcherItem;
@@ -71,7 +71,7 @@ const SwitcherItem = /*#__PURE__*/React.forwardRef(function SwitcherItem(props,
71
71
  }
72
72
  return /*#__PURE__*/React__default["default"].createElement("li", {
73
73
  className: classNames
74
- }, /*#__PURE__*/React__default["default"].createElement(Link["default"], _rollupPluginBabelHelpers["extends"]({
74
+ }, /*#__PURE__*/React__default["default"].createElement(Link.Link, _rollupPluginBabelHelpers["extends"]({
75
75
  onKeyDown: evt => {
76
76
  setTabFocus(evt);
77
77
  onKeyDown(evt);
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  type AsProp<C extends React.ElementType> = {
3
2
  as?: C;
4
3
  };
@@ -0,0 +1,38 @@
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 React from 'react';
8
+ interface UseSelectionProps<ItemType> {
9
+ disabled?: boolean;
10
+ filteredItems?: ItemType[];
11
+ initialSelectedItems?: ItemType[];
12
+ onChange?: (data: {
13
+ selectedItems: ItemType[];
14
+ }) => void;
15
+ selectAll?: boolean;
16
+ selectedItems?: ItemType[];
17
+ }
18
+ export declare const useSelection: <ItemType>({ disabled, onChange, initialSelectedItems, selectedItems: controlledItems, selectAll, filteredItems, }: UseSelectionProps<ItemType>) => {
19
+ clearSelection: () => void;
20
+ onItemChange: (item: ItemType) => void;
21
+ selectedItems: ItemType[];
22
+ };
23
+ interface SelectionRenderProps<ItemType> {
24
+ clearSelection: () => void;
25
+ onItemChange: (item: ItemType) => void;
26
+ selectedItems: ItemType[];
27
+ }
28
+ interface SelectionProps<ItemType> {
29
+ children?: (renderProps: SelectionRenderProps<ItemType>) => React.ReactNode;
30
+ disabled?: boolean;
31
+ initialSelectedItems: ItemType[];
32
+ onChange?: (state: {
33
+ selectedItems: ItemType[];
34
+ }) => void;
35
+ render?: (renderProps: SelectionRenderProps<ItemType>) => React.ReactNode;
36
+ }
37
+ export declare const Selection: <ItemType>({ children, disabled, initialSelectedItems, onChange, render, }: SelectionProps<ItemType>) => import("react/jsx-runtime").JSX.Element | null;
38
+ export {};