@carbon/react 1.81.0-rc.0 → 1.82.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 (222) hide show
  1. package/.playwright/INTERNAL_AVT_REPORT_DO_NOT_USE.json +784 -784
  2. package/es/components/AILabel/index.d.ts +1 -1
  3. package/es/components/AILabel/index.js +2 -9
  4. package/es/components/Breadcrumb/Breadcrumb.d.ts +2 -3
  5. package/es/components/Breadcrumb/Breadcrumb.js +4 -4
  6. package/es/components/Breadcrumb/BreadcrumbItem.d.ts +3 -4
  7. package/es/components/Breadcrumb/BreadcrumbItem.js +5 -4
  8. package/es/components/Button/Button.js +2 -10
  9. package/es/components/ButtonSet/ButtonSet.d.ts +2 -3
  10. package/es/components/ButtonSet/ButtonSet.js +4 -4
  11. package/es/components/CodeSnippet/CodeSnippet.d.ts +1 -1
  12. package/es/components/CodeSnippet/CodeSnippet.js +3 -19
  13. package/es/components/ComboBox/ComboBox.d.ts +1 -1
  14. package/es/components/ComboBox/ComboBox.js +54 -32
  15. package/es/components/ComboButton/index.d.ts +1 -1
  16. package/es/components/ComboButton/index.js +2 -18
  17. package/es/components/ComposedModal/ComposedModal.js +5 -3
  18. package/es/components/Copy/Copy.d.ts +1 -1
  19. package/es/components/Copy/Copy.js +2 -18
  20. package/es/components/CopyButton/CopyButton.d.ts +1 -1
  21. package/es/components/CopyButton/CopyButton.js +2 -18
  22. package/es/components/DataTable/DataTable.d.ts +7 -12
  23. package/es/components/DataTable/DataTable.js +0 -5
  24. package/es/components/DataTable/TableCell.js +28 -4
  25. package/es/components/DataTable/TableToolbarAction.d.ts +2 -4
  26. package/es/components/DataTable/TableToolbarAction.js +5 -4
  27. package/es/components/DataTable/tools/cells.d.ts +13 -0
  28. package/es/components/DataTable/tools/cells.js +3 -6
  29. package/es/components/DataTable/tools/filter.d.ts +26 -0
  30. package/es/components/DataTable/tools/filter.js +8 -17
  31. package/es/components/DataTable/tools/sorting.d.ts +42 -0
  32. package/es/components/DataTable/tools/sorting.js +24 -53
  33. package/es/components/DatePicker/DatePicker.d.ts +1 -1
  34. package/es/components/DatePicker/DatePicker.js +19 -19
  35. package/es/components/Dialog/index.d.ts +1 -1
  36. package/es/components/Dropdown/Dropdown.Skeleton.d.ts +2 -2
  37. package/es/components/Dropdown/Dropdown.Skeleton.js +2 -2
  38. package/es/components/Dropdown/Dropdown.d.ts +7 -6
  39. package/es/components/Dropdown/Dropdown.js +13 -9
  40. package/es/components/FileUploader/FileUploaderButton.d.ts +1 -1
  41. package/es/components/FileUploader/FileUploaderButton.js +1 -1
  42. package/es/components/FileUploader/FileUploaderDropContainer.js +1 -1
  43. package/es/components/FileUploader/FileUploaderItem.js +1 -1
  44. package/es/components/FluidDatePickerInput/FluidDatePickerInput.d.ts +1 -1
  45. package/es/components/FluidDatePickerInput/FluidDatePickerInput.js +5 -6
  46. package/es/components/FluidDropdown/FluidDropdown.d.ts +1 -1
  47. package/es/components/FluidSearch/FluidSearch.d.ts +3 -6
  48. package/es/components/IconButton/index.d.ts +1 -1
  49. package/es/components/IconButton/index.js +2 -18
  50. package/es/components/ListBox/ListBox.d.ts +4 -5
  51. package/es/components/ListBox/ListBox.js +8 -7
  52. package/es/components/ListBox/ListBoxMenu.d.ts +4 -4
  53. package/es/components/ListBox/ListBoxMenu.js +4 -2
  54. package/es/components/ListBox/ListBoxMenuItem.d.ts +9 -8
  55. package/es/components/ListBox/ListBoxPropTypes.d.ts +3 -3
  56. package/es/components/ListBox/ListBoxPropTypes.js +3 -3
  57. package/es/components/ListBox/index.d.ts +7 -5
  58. package/es/components/ListBox/index.js +1 -1
  59. package/es/components/Menu/Menu.js +9 -14
  60. package/es/components/Menu/MenuItem.js +15 -4
  61. package/es/components/Modal/Modal.js +9 -9
  62. package/es/components/MultiSelect/FilterableMultiSelect.d.ts +3 -2
  63. package/es/components/MultiSelect/FilterableMultiSelect.js +3 -2
  64. package/es/components/MultiSelect/MultiSelect.d.ts +8 -2
  65. package/es/components/MultiSelect/MultiSelect.js +7 -4
  66. package/es/components/Notification/Notification.js +1 -1
  67. package/es/components/OverflowMenu/OverflowMenu.js +2 -21
  68. package/es/components/OverflowMenu/index.d.ts +1 -1
  69. package/es/components/OverflowMenu/index.js +2 -3
  70. package/es/components/OverflowMenu/next/index.js +2 -18
  71. package/es/components/OverflowMenuItem/OverflowMenuItem.d.ts +2 -4
  72. package/es/components/OverflowMenuItem/OverflowMenuItem.js +5 -4
  73. package/es/components/PageHeader/PageHeader.d.ts +160 -8
  74. package/es/components/PageHeader/PageHeader.js +155 -21
  75. package/es/components/PageHeader/index.d.ts +2 -2
  76. package/es/components/PageHeader/index.js +1 -1
  77. package/es/components/Popover/index.js +4 -21
  78. package/es/components/Search/Search.d.ts +2 -5
  79. package/es/components/Search/Search.js +24 -8
  80. package/es/components/Stack/HStack.d.ts +2 -3
  81. package/es/components/Stack/HStack.js +4 -7
  82. package/es/components/Stack/Stack.d.ts +3 -4
  83. package/es/components/Stack/Stack.js +3 -6
  84. package/es/components/Stack/VStack.d.ts +2 -3
  85. package/es/components/Stack/VStack.js +3 -2
  86. package/es/components/Stack/index.d.ts +4 -4
  87. package/es/components/TextArea/TextArea.js +3 -5
  88. package/es/components/TimePicker/TimePicker.d.ts +3 -4
  89. package/es/components/TimePicker/TimePicker.js +5 -4
  90. package/es/components/TimePickerSelect/TimePickerSelect.d.ts +23 -4
  91. package/es/components/TimePickerSelect/TimePickerSelect.js +5 -4
  92. package/es/components/TreeView/TreeNode.js +13 -1
  93. package/es/components/TreeView/TreeView.js +1 -1
  94. package/es/index.js +1 -1
  95. package/es/internal/FloatingMenu.js +9 -5
  96. package/es/internal/environment.js +7 -0
  97. package/es/internal/keyboard/navigation.d.ts +0 -10
  98. package/es/internal/keyboard/navigation.js +1 -13
  99. package/es/internal/useId.js +1 -1
  100. package/es/internal/useNoInteractiveChildren.js +7 -0
  101. package/es/internal/useOutsideClick.js +3 -0
  102. package/es/internal/wrapFocus.d.ts +49 -0
  103. package/es/internal/wrapFocus.js +64 -51
  104. package/es/tools/events.d.ts +17 -0
  105. package/es/tools/events.js +10 -13
  106. package/es/tools/mapPopoverAlign.d.ts +15 -0
  107. package/es/tools/mapPopoverAlign.js +28 -0
  108. package/es/tools/uniqueId.d.ts +7 -0
  109. package/es/tools/uniqueId.js +3 -3
  110. package/es/types/common.d.ts +0 -2
  111. package/lib/components/AILabel/index.d.ts +1 -1
  112. package/lib/components/AILabel/index.js +2 -9
  113. package/lib/components/Breadcrumb/Breadcrumb.d.ts +2 -3
  114. package/lib/components/Breadcrumb/Breadcrumb.js +3 -3
  115. package/lib/components/Breadcrumb/BreadcrumbItem.d.ts +3 -4
  116. package/lib/components/Breadcrumb/BreadcrumbItem.js +4 -3
  117. package/lib/components/Button/Button.js +1 -9
  118. package/lib/components/ButtonSet/ButtonSet.d.ts +2 -3
  119. package/lib/components/ButtonSet/ButtonSet.js +3 -3
  120. package/lib/components/CodeSnippet/CodeSnippet.d.ts +1 -1
  121. package/lib/components/CodeSnippet/CodeSnippet.js +3 -19
  122. package/lib/components/ComboBox/ComboBox.d.ts +1 -1
  123. package/lib/components/ComboBox/ComboBox.js +53 -31
  124. package/lib/components/ComboButton/index.d.ts +1 -1
  125. package/lib/components/ComboButton/index.js +2 -18
  126. package/lib/components/ComposedModal/ComposedModal.js +5 -3
  127. package/lib/components/Copy/Copy.d.ts +1 -1
  128. package/lib/components/Copy/Copy.js +2 -18
  129. package/lib/components/CopyButton/CopyButton.d.ts +1 -1
  130. package/lib/components/CopyButton/CopyButton.js +2 -18
  131. package/lib/components/DataTable/DataTable.d.ts +7 -12
  132. package/lib/components/DataTable/DataTable.js +0 -5
  133. package/lib/components/DataTable/TableCell.js +28 -3
  134. package/lib/components/DataTable/TableToolbarAction.d.ts +2 -4
  135. package/lib/components/DataTable/TableToolbarAction.js +4 -3
  136. package/lib/components/DataTable/tools/cells.d.ts +13 -0
  137. package/lib/components/DataTable/tools/cells.js +3 -6
  138. package/lib/components/DataTable/tools/filter.d.ts +26 -0
  139. package/lib/components/DataTable/tools/filter.js +8 -17
  140. package/lib/components/DataTable/tools/sorting.d.ts +42 -0
  141. package/lib/components/DataTable/tools/sorting.js +23 -53
  142. package/lib/components/DatePicker/DatePicker.d.ts +1 -1
  143. package/lib/components/DatePicker/DatePicker.js +19 -19
  144. package/lib/components/Dialog/index.d.ts +1 -1
  145. package/lib/components/Dropdown/Dropdown.Skeleton.d.ts +2 -2
  146. package/lib/components/Dropdown/Dropdown.Skeleton.js +1 -1
  147. package/lib/components/Dropdown/Dropdown.d.ts +7 -6
  148. package/lib/components/Dropdown/Dropdown.js +12 -8
  149. package/lib/components/FileUploader/FileUploaderButton.d.ts +1 -1
  150. package/lib/components/FileUploader/FileUploaderButton.js +1 -1
  151. package/lib/components/FileUploader/FileUploaderDropContainer.js +1 -1
  152. package/lib/components/FileUploader/FileUploaderItem.js +1 -1
  153. package/lib/components/FluidDatePickerInput/FluidDatePickerInput.d.ts +1 -1
  154. package/lib/components/FluidDatePickerInput/FluidDatePickerInput.js +4 -5
  155. package/lib/components/FluidDropdown/FluidDropdown.d.ts +1 -1
  156. package/lib/components/FluidSearch/FluidSearch.d.ts +3 -6
  157. package/lib/components/IconButton/index.d.ts +1 -1
  158. package/lib/components/IconButton/index.js +2 -18
  159. package/lib/components/ListBox/ListBox.d.ts +4 -5
  160. package/lib/components/ListBox/ListBox.js +7 -6
  161. package/lib/components/ListBox/ListBoxMenu.d.ts +4 -4
  162. package/lib/components/ListBox/ListBoxMenu.js +3 -1
  163. package/lib/components/ListBox/ListBoxMenuItem.d.ts +9 -8
  164. package/lib/components/ListBox/ListBoxPropTypes.d.ts +3 -3
  165. package/lib/components/ListBox/ListBoxPropTypes.js +4 -4
  166. package/lib/components/ListBox/index.d.ts +7 -5
  167. package/lib/components/ListBox/index.js +2 -2
  168. package/lib/components/Menu/Menu.js +9 -14
  169. package/lib/components/Menu/MenuItem.js +15 -4
  170. package/lib/components/Modal/Modal.js +9 -9
  171. package/lib/components/MultiSelect/FilterableMultiSelect.d.ts +3 -2
  172. package/lib/components/MultiSelect/FilterableMultiSelect.js +2 -1
  173. package/lib/components/MultiSelect/MultiSelect.d.ts +8 -2
  174. package/lib/components/MultiSelect/MultiSelect.js +6 -3
  175. package/lib/components/Notification/Notification.js +1 -1
  176. package/lib/components/OverflowMenu/OverflowMenu.js +2 -21
  177. package/lib/components/OverflowMenu/index.d.ts +1 -1
  178. package/lib/components/OverflowMenu/index.js +2 -3
  179. package/lib/components/OverflowMenu/next/index.js +2 -18
  180. package/lib/components/OverflowMenuItem/OverflowMenuItem.d.ts +2 -4
  181. package/lib/components/OverflowMenuItem/OverflowMenuItem.js +4 -3
  182. package/lib/components/PageHeader/PageHeader.d.ts +160 -8
  183. package/lib/components/PageHeader/PageHeader.js +159 -19
  184. package/lib/components/PageHeader/index.d.ts +2 -2
  185. package/lib/components/PageHeader/index.js +6 -0
  186. package/lib/components/Popover/index.js +4 -21
  187. package/lib/components/Search/Search.d.ts +2 -5
  188. package/lib/components/Search/Search.js +24 -8
  189. package/lib/components/Stack/HStack.d.ts +2 -3
  190. package/lib/components/Stack/HStack.js +3 -6
  191. package/lib/components/Stack/Stack.d.ts +3 -4
  192. package/lib/components/Stack/Stack.js +2 -5
  193. package/lib/components/Stack/VStack.d.ts +2 -3
  194. package/lib/components/Stack/VStack.js +2 -1
  195. package/lib/components/Stack/index.d.ts +4 -4
  196. package/lib/components/TextArea/TextArea.js +2 -4
  197. package/lib/components/TimePicker/TimePicker.d.ts +3 -4
  198. package/lib/components/TimePicker/TimePicker.js +4 -3
  199. package/lib/components/TimePickerSelect/TimePickerSelect.d.ts +23 -4
  200. package/lib/components/TimePickerSelect/TimePickerSelect.js +4 -3
  201. package/lib/components/TreeView/TreeNode.js +13 -1
  202. package/lib/components/TreeView/TreeView.js +1 -1
  203. package/lib/index.js +2 -2
  204. package/lib/internal/FloatingMenu.js +9 -5
  205. package/lib/internal/environment.js +7 -0
  206. package/lib/internal/keyboard/navigation.d.ts +0 -10
  207. package/lib/internal/keyboard/navigation.js +0 -14
  208. package/lib/internal/useNoInteractiveChildren.js +7 -0
  209. package/lib/internal/useOutsideClick.js +3 -0
  210. package/lib/internal/wrapFocus.d.ts +49 -0
  211. package/lib/internal/wrapFocus.js +66 -53
  212. package/lib/tools/events.d.ts +17 -0
  213. package/lib/tools/events.js +10 -13
  214. package/lib/tools/mapPopoverAlign.d.ts +15 -0
  215. package/lib/tools/mapPopoverAlign.js +32 -0
  216. package/lib/tools/uniqueId.d.ts +7 -0
  217. package/lib/tools/uniqueId.js +3 -3
  218. package/lib/types/common.d.ts +0 -2
  219. package/package.json +9 -9
  220. package/telemetry.yml +3 -1
  221. package/es/tools/createPropAdapter.js +0 -40
  222. package/lib/tools/createPropAdapter.js +0 -44
@@ -49,7 +49,7 @@ function FileUploaderButton(_ref) {
49
49
  const [prevOwnerLabelText, setPrevOwnerLabelText] = React.useState(ownerLabelText);
50
50
  const {
51
51
  current: inputId
52
- } = React.useRef(id || uniqueId["default"]());
52
+ } = React.useRef(id || uniqueId.uniqueId());
53
53
  const inputNode = React.useRef(null);
54
54
  const classes = cx__default["default"](`${prefix}--btn`, className, {
55
55
  [`${prefix}--btn--${buttonKind}`]: buttonKind,
@@ -47,7 +47,7 @@ function FileUploaderDropContainer(_ref) {
47
47
  const inputRef = React.useRef(null);
48
48
  const {
49
49
  current: uid
50
- } = React.useRef(id || uniqueId["default"]());
50
+ } = React.useRef(id || uniqueId.uniqueId());
51
51
  const [isActive, setActive] = React.useState(false);
52
52
  const dropareaClasses = cx__default["default"](`${prefix}--file__drop-container`, `${prefix}--file-browse-btn`, {
53
53
  [`${prefix}--file__drop-container--drag-over`]: isActive,
@@ -49,7 +49,7 @@ function FileUploaderItem(_ref) {
49
49
  const prefix = usePrefix.usePrefix();
50
50
  const {
51
51
  current: id
52
- } = React.useRef(uuid || uniqueId["default"]());
52
+ } = React.useRef(uuid || uniqueId.uniqueId());
53
53
  const classes = cx__default["default"](`${prefix}--file__selected-file`, className, {
54
54
  [`${prefix}--file__selected-file--invalid`]: invalid,
55
55
  [`${prefix}--file__selected-file--md`]: size === 'md',
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright IBM Corp. 2022
2
+ * Copyright IBM Corp. 2022, 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.
@@ -18,17 +18,16 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
18
18
 
19
19
  var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
20
20
 
21
- const FluidDatePickerInput = /*#__PURE__*/React__default["default"].forwardRef(function FluidDatePickerInput(_ref, ref) {
22
- let {
23
- ...other
24
- } = _ref;
21
+ const frFn = React.forwardRef;
22
+ const FluidDatePickerInput = frFn((props, ref) => {
25
23
  return /*#__PURE__*/React__default["default"].createElement(FormContext.FormContext.Provider, {
26
24
  value: {
27
25
  isFluid: true
28
26
  }
29
27
  }, /*#__PURE__*/React__default["default"].createElement(DatePickerInput["default"], _rollupPluginBabelHelpers["extends"]({
30
28
  ref: ref
31
- }, other)));
29
+ }, props)));
32
30
  });
31
+ FluidDatePickerInput.propTypes = DatePickerInput["default"].propTypes;
33
32
 
34
33
  exports["default"] = FluidDatePickerInput;
@@ -97,5 +97,5 @@ export interface FluidDropdownProps<ItemType> extends DropdownProps<ItemType> {
97
97
  */
98
98
  warnText?: React.ReactNode;
99
99
  }
100
- declare const FluidDropdown: React.ForwardRefExoticComponent<Omit<FluidDropdownProps<unknown>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
100
+ declare const FluidDropdown: React.ForwardRefExoticComponent<FluidDropdownProps<unknown> & React.RefAttributes<HTMLButtonElement>>;
101
101
  export default FluidDropdown;
@@ -1,10 +1,10 @@
1
1
  /**
2
- * Copyright IBM Corp. 2022
2
+ * Copyright IBM Corp. 2022, 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.
6
6
  */
7
- import React from 'react';
7
+ import React, { type ChangeEvent } from 'react';
8
8
  export interface FluidSearchProps {
9
9
  /**
10
10
  * Specify an optional value for the `autocomplete` property on the underlying
@@ -38,10 +38,7 @@ export interface FluidSearchProps {
38
38
  /**
39
39
  * Optional callback called when the search value changes.
40
40
  */
41
- onChange?(e: {
42
- target: HTMLInputElement;
43
- type: 'change';
44
- }): void;
41
+ onChange?(event: ChangeEvent<HTMLInputElement>): void;
45
42
  /**
46
43
  * Optional callback called when the search value is cleared.
47
44
  */
@@ -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.
@@ -20,6 +20,7 @@ var usePrefix = require('../../internal/usePrefix.js');
20
20
  var ButtonBase = require('../Button/ButtonBase.js');
21
21
  var deprecateValuesWithin = require('../../prop-types/deprecateValuesWithin.js');
22
22
  var index = require('../BadgeIndicator/index.js');
23
+ var mapPopoverAlign = require('../../tools/mapPopoverAlign.js');
23
24
 
24
25
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
25
26
 
@@ -28,19 +29,6 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
28
29
  var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
29
30
 
30
31
  const IconButtonKinds = ['primary', 'secondary', 'ghost', 'tertiary'];
31
- const propMappingFunction = deprecatedValue => {
32
- const mapping = {
33
- 'top-left': 'top-start',
34
- 'top-right': 'top-end',
35
- 'bottom-left': 'bottom-start',
36
- 'bottom-right': 'bottom-end',
37
- 'left-bottom': 'left-end',
38
- 'left-top': 'left-start',
39
- 'right-bottom': 'right-end',
40
- 'right-top': 'right-start'
41
- };
42
- return mapping[deprecatedValue];
43
- };
44
32
  const IconButton = /*#__PURE__*/React__default["default"].forwardRef(function IconButton(_ref, ref) {
45
33
  let {
46
34
  align,
@@ -120,11 +108,7 @@ IconButton.propTypes = {
120
108
  // deprecated use right-start instead
121
109
 
122
110
  // new values to match floating-ui
123
- 'top-start', 'top-end', 'bottom-start', 'bottom-end', 'left-end', 'left-start', 'right-end', 'right-start']),
124
- //allowed prop values
125
- ['top', 'top-start', 'top-end', 'bottom', 'bottom-start', 'bottom-end', 'left', 'left-start', 'left-end', 'right', 'right-start', 'right-end'],
126
- //optional mapper function
127
- propMappingFunction),
111
+ 'top-start', 'top-end', 'bottom-start', 'bottom-end', 'left-end', 'left-start', 'right-end', 'right-start']), ['top', 'top-start', 'top-end', 'bottom', 'bottom-start', 'bottom-end', 'left', 'left-start', 'left-end', 'right', 'right-start', 'right-end'], mapPopoverAlign.mapPopoverAlign),
128
112
  /**
129
113
  * **Experimental**: Will attempt to automatically align the tooltip
130
114
  */
@@ -1,12 +1,12 @@
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.
6
6
  */
7
7
  import React from 'react';
8
- import { ListBoxType, ListBoxSize } from './ListBoxPropTypes';
9
- import { ForwardRefReturn, ReactAttr } from '../../types/common';
8
+ import { type ListBoxSize, type ListBoxType } from '.';
9
+ import { ReactAttr } from '../../types/common';
10
10
  type ExcludedAttributes = 'onKeyDown' | 'onKeyPress' | 'ref';
11
11
  export interface ListBoxProps extends Omit<ReactAttr<HTMLDivElement>, ExcludedAttributes> {
12
12
  /**
@@ -59,10 +59,9 @@ export interface ListBoxProps extends Omit<ReactAttr<HTMLDivElement>, ExcludedAt
59
59
  */
60
60
  warnTextId?: string;
61
61
  }
62
- export type ListBoxComponent = ForwardRefReturn<HTMLDivElement, ListBoxProps>;
63
62
  /**
64
63
  * `ListBox` is a generic container component that handles creating the
65
64
  * container class name in response to certain props.
66
65
  */
67
- declare const ListBox: ListBoxComponent;
66
+ declare const ListBox: React.ForwardRefExoticComponent<ListBoxProps & React.RefAttributes<HTMLDivElement>>;
68
67
  export default ListBox;
@@ -14,10 +14,11 @@ var cx = require('classnames');
14
14
  var React = require('react');
15
15
  var PropTypes = require('prop-types');
16
16
  var deprecate = require('../../prop-types/deprecate.js');
17
- var ListBoxPropTypes = require('./ListBoxPropTypes.js');
17
+ require('./index.js');
18
18
  var usePrefix = require('../../internal/usePrefix.js');
19
19
  require('../FluidForm/FluidForm.js');
20
20
  var FormContext = require('../FluidForm/FormContext.js');
21
+ var ListBoxPropTypes = require('./ListBoxPropTypes.js');
21
22
 
22
23
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
23
24
 
@@ -38,8 +39,8 @@ const handleClick = event => {
38
39
  * `ListBox` is a generic container component that handles creating the
39
40
  * container class name in response to certain props.
40
41
  */
41
- const ListBox = /*#__PURE__*/React__default["default"].forwardRef(function ListBox(_ref, ref) {
42
- let {
42
+ const ListBox = /*#__PURE__*/React.forwardRef((props, ref) => {
43
+ const {
43
44
  children,
44
45
  className: containerClassName,
45
46
  disabled = false,
@@ -54,7 +55,7 @@ const ListBox = /*#__PURE__*/React__default["default"].forwardRef(function ListB
54
55
  light,
55
56
  isOpen,
56
57
  ...rest
57
- } = _ref;
58
+ } = props;
58
59
  const prefix = usePrefix.usePrefix();
59
60
  const {
60
61
  isFluid
@@ -127,12 +128,12 @@ ListBox.propTypes = {
127
128
  /**
128
129
  * Specify the size of the ListBox. Currently supports either `sm`, `md` or `lg` as an option.
129
130
  */
130
- size: ListBoxPropTypes.ListBoxSize,
131
+ size: ListBoxPropTypes.ListBoxSizePropType,
131
132
  /**
132
133
  * Specify the "type" of the ListBox. Currently supports either `default` or
133
134
  * `inline` as an option.
134
135
  */
135
- type: ListBoxPropTypes.ListBoxType,
136
+ type: ListBoxPropTypes.ListBoxTypePropType,
136
137
  /**
137
138
  * Specify whether the control is currently in warning state
138
139
  */
@@ -1,10 +1,11 @@
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.
6
6
  */
7
- import { ForwardRefReturn, ReactAttr } from '../../types/common';
7
+ import React from 'react';
8
+ import { ReactAttr } from '../../types/common';
8
9
  type ExcludedAttributes = 'id';
9
10
  export interface ListBoxMenuProps extends Omit<ReactAttr<HTMLUListElement>, ExcludedAttributes> {
10
11
  children?: any;
@@ -13,11 +14,10 @@ export interface ListBoxMenuProps extends Omit<ReactAttr<HTMLUListElement>, Excl
13
14
  */
14
15
  id: string;
15
16
  }
16
- export type ListBoxMenuComponent = ForwardRefReturn<HTMLUListElement, ListBoxMenuProps>;
17
17
  /**
18
18
  * `ListBoxMenu` is a simple container node that isolates the `list-box__menu`
19
19
  * class into a single component. It is also being used to validate given
20
20
  * `children` components.
21
21
  */
22
- declare const ListBoxMenu: ListBoxMenuComponent;
22
+ declare const ListBoxMenu: React.ForwardRefExoticComponent<ListBoxMenuProps & React.RefAttributes<HTMLUListElement>>;
23
23
  export default ListBoxMenu;
@@ -20,12 +20,14 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
20
20
  var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
21
21
  var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
22
22
 
23
+ const frFn = React.forwardRef;
24
+
23
25
  /**
24
26
  * `ListBoxMenu` is a simple container node that isolates the `list-box__menu`
25
27
  * class into a single component. It is also being used to validate given
26
28
  * `children` components.
27
29
  */
28
- const ListBoxMenu = /*#__PURE__*/React__default["default"].forwardRef(function ListBoxMenu(_ref, ref) {
30
+ const ListBoxMenu = frFn((_ref, ref) => {
29
31
  let {
30
32
  children,
31
33
  id,
@@ -4,8 +4,8 @@
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 { ForwardedRef, ReactNode, type Ref } from 'react';
8
- import { ForwardRefReturn, ReactAttr } from '../../types/common';
7
+ import React, { ReactNode } from 'react';
8
+ import { ReactAttr } from '../../types/common';
9
9
  export interface ListBoxMenuItemProps extends ReactAttr<HTMLLIElement> {
10
10
  /**
11
11
  * Specify any children nodes that should be rendered inside of the ListBox
@@ -29,9 +29,10 @@ export interface ListBoxMenuItemProps extends ReactAttr<HTMLLIElement> {
29
29
  */
30
30
  title?: string;
31
31
  }
32
- export type ListBoxMenuItemForwardedRef = (ForwardedRef<HTMLLIElement> & {
33
- menuItemOptionRef?: Ref<HTMLDivElement>;
34
- }) | null;
35
- export type ListBoxMenuItemComponent = ForwardRefReturn<ListBoxMenuItemForwardedRef, ListBoxMenuItemProps>;
36
- declare const _default: ListBoxMenuItemComponent;
37
- export default _default;
32
+ /**
33
+ * `ListBoxMenuItem` is a helper component for managing the container class
34
+ * name, alongside any classes for any corresponding states, for a generic list
35
+ * box menu item.
36
+ */
37
+ declare const ListBoxMenuItem: React.ForwardRefExoticComponent<ListBoxMenuItemProps & React.RefAttributes<HTMLLIElement>>;
38
+ export default ListBoxMenuItem;
@@ -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.
@@ -9,6 +9,6 @@ declare const listBoxTypes: readonly ["default", "inline"];
9
9
  declare const listBoxSizes: readonly ["sm", "md", "lg"];
10
10
  export type ListBoxType = (typeof listBoxTypes)[number];
11
11
  export type ListBoxSize = (typeof listBoxSizes)[number];
12
- export declare const ListBoxType: PropTypes.Requireable<"default" | "inline">;
13
- export declare const ListBoxSize: PropTypes.Requireable<"sm" | "md" | "lg">;
12
+ export declare const ListBoxTypePropType: PropTypes.Requireable<"default" | "inline">;
13
+ export declare const ListBoxSizePropType: PropTypes.Requireable<"sm" | "md" | "lg">;
14
14
  export {};
@@ -17,8 +17,8 @@ var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
17
17
 
18
18
  const listBoxTypes = ['default', 'inline'];
19
19
  const listBoxSizes = ['sm', 'md', 'lg'];
20
- const ListBoxType = PropTypes__default["default"].oneOf(listBoxTypes);
21
- const ListBoxSize = PropTypes__default["default"].oneOf(listBoxSizes);
20
+ const ListBoxTypePropType = PropTypes__default["default"].oneOf(listBoxTypes);
21
+ const ListBoxSizePropType = PropTypes__default["default"].oneOf(listBoxSizes);
22
22
 
23
- exports.ListBoxSize = ListBoxSize;
24
- exports.ListBoxType = ListBoxType;
23
+ exports.ListBoxSizePropType = ListBoxSizePropType;
24
+ exports.ListBoxTypePropType = ListBoxTypePropType;
@@ -1,17 +1,19 @@
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.
6
6
  */
7
- export * as PropTypes from './ListBoxPropTypes';
8
7
  export * from './ListBoxPropTypes';
9
- import { ListBoxComponent as ListBoxPartialComponent } from './ListBox';
8
+ import ListBoxInternal from './ListBox';
10
9
  import { ListBoxFieldComponent } from './ListBoxField';
11
- import { ListBoxMenuComponent } from './ListBoxMenu';
10
+ import ListBoxMenu from './ListBoxMenu';
12
11
  import { ListBoxMenuIconComponent } from './ListBoxMenuIcon';
13
- import { ListBoxMenuItemComponent } from './ListBoxMenuItem';
12
+ import ListBoxMenuItem from './ListBoxMenuItem';
14
13
  import { ListBoxSelectionComponent } from './ListBoxSelection';
14
+ type ListBoxMenuComponent = typeof ListBoxMenu;
15
+ type ListBoxMenuItemComponent = typeof ListBoxMenuItem;
16
+ type ListBoxPartialComponent = typeof ListBoxInternal;
15
17
  export interface ListBoxComponent extends ListBoxPartialComponent {
16
18
  readonly Field: ListBoxFieldComponent;
17
19
  readonly Menu: ListBoxMenuComponent;
@@ -25,6 +25,6 @@ const ListBox = Object.assign(ListBox$1["default"], {
25
25
  Selection: ListBoxSelection["default"]
26
26
  });
27
27
 
28
- exports.ListBoxSize = ListBoxPropTypes.ListBoxSize;
29
- exports.ListBoxType = ListBoxPropTypes.ListBoxType;
28
+ exports.ListBoxSizePropType = ListBoxPropTypes.ListBoxSizePropType;
29
+ exports.ListBoxTypePropType = ListBoxPropTypes.ListBoxTypePropType;
30
30
  exports["default"] = ListBox;
@@ -44,7 +44,12 @@ const Menu = /*#__PURE__*/React.forwardRef(function Menu(_ref, forwardRef) {
44
44
  open,
45
45
  size = 'sm',
46
46
  legacyAutoalign = 'true',
47
+ // TODO: `ssr-friendly` doesn't support ESLint v9.
48
+ // https://github.com/kopiro/eslint-plugin-ssr-friendly/issues/30
49
+ // https://github.com/carbon-design-system/carbon/issues/18991
50
+ /*
47
51
  // eslint-disable-next-line ssr-friendly/no-dom-globals-in-react-fc
52
+ */
48
53
  target = environment.canUseDOM && document.body,
49
54
  x = 0,
50
55
  y = 0,
@@ -111,18 +116,8 @@ const Menu = /*#__PURE__*/React.forwardRef(function Menu(_ref, forwardRef) {
111
116
  }
112
117
  }
113
118
  }
114
- function handleClose(e) {
115
- if (/^key/.test(e.type)) {
116
- window.addEventListener('keyup', returnFocus, {
117
- once: true
118
- });
119
- } else if (e.type === 'click' && menu.current) {
120
- menu.current.addEventListener('focusout', returnFocus, {
121
- once: true
122
- });
123
- } else {
124
- returnFocus();
125
- }
119
+ function handleClose() {
120
+ returnFocus();
126
121
  if (onClose) {
127
122
  onClose();
128
123
  }
@@ -133,7 +128,7 @@ const Menu = /*#__PURE__*/React.forwardRef(function Menu(_ref, forwardRef) {
133
128
  // if the user presses escape or this is a submenu
134
129
  // and the user presses ArrowLeft, close it
135
130
  if ((match.match(e, keys.Escape) || !isRoot && match.match(e, keys.ArrowLeft)) && onClose) {
136
- handleClose(e);
131
+ handleClose();
137
132
  } else {
138
133
  focusItem(e);
139
134
  }
@@ -168,7 +163,7 @@ const Menu = /*#__PURE__*/React.forwardRef(function Menu(_ref, forwardRef) {
168
163
  }
169
164
  function handleBlur(e) {
170
165
  if (open && onClose && isRoot && !menu.current?.contains(e.relatedTarget)) {
171
- handleClose(e);
166
+ handleClose();
172
167
  }
173
168
  }
174
169
  function fitValue(range, axis) {
@@ -108,18 +108,28 @@ const MenuItem = /*#__PURE__*/React.forwardRef(function MenuItem(_ref, forwardRe
108
108
  }
109
109
  }
110
110
  }
111
+
112
+ // Avoid stray keyup event from MenuButton affecting MenuItem, and vice versa.
113
+ // Keyboard click is handled differently for <button> vs. <li> and for Enter vs. Space. See
114
+ // https://www.stefanjudis.com/today-i-learned/keyboard-button-clicks-with-space-and-enter-behave-differently/.
115
+ const pendingKeyboardClick = React.useRef(false);
116
+ const keyboardClickEvent = e => match.match(e, keys.Enter) || match.match(e, keys.Space);
111
117
  function handleKeyDown(e) {
112
118
  if (hasChildren && match.match(e, keys.ArrowRight)) {
113
119
  openSubmenu();
114
120
  e.stopPropagation();
115
121
  }
116
- if (match.match(e, keys.Enter) || match.match(e, keys.Space)) {
117
- handleClick(e);
118
- }
122
+ pendingKeyboardClick.current = keyboardClickEvent(e);
119
123
  if (rest.onKeyDown) {
120
124
  rest.onKeyDown(e);
121
125
  }
122
126
  }
127
+ function handleKeyUp(e) {
128
+ if (pendingKeyboardClick.current && keyboardClickEvent(e)) {
129
+ handleClick(e);
130
+ }
131
+ pendingKeyboardClick.current = false;
132
+ }
123
133
  const classNames = cx__default["default"](className, `${prefix}--menu-item`, {
124
134
  [`${prefix}--menu-item--disabled`]: isDisabled,
125
135
  [`${prefix}--menu-item--danger`]: isDanger
@@ -172,7 +182,8 @@ const MenuItem = /*#__PURE__*/React.forwardRef(function MenuItem(_ref, forwardRe
172
182
  "aria-haspopup": hasChildren ?? undefined,
173
183
  "aria-expanded": hasChildren ? submenuOpen : undefined,
174
184
  onClick: handleClick,
175
- onKeyDown: handleKeyDown
185
+ onKeyDown: handleKeyDown,
186
+ onKeyUp: handleKeyUp
176
187
  }, getReferenceProps()), /*#__PURE__*/React__default["default"].createElement("div", {
177
188
  className: `${prefix}--menu-item__selection-icon`
178
189
  }, rest['aria-checked'] && (_Checkmark || (_Checkmark = /*#__PURE__*/React__default["default"].createElement(iconsReact.Checkmark, null)))), /*#__PURE__*/React__default["default"].createElement("div", {
@@ -109,28 +109,28 @@ const Modal = /*#__PURE__*/React__default["default"].forwardRef(function Modal(_
109
109
  target
110
110
  } = evt;
111
111
  evt.stopPropagation();
112
- if (open) {
112
+ if (open && target instanceof HTMLElement) {
113
113
  if (match.match(evt, keys.Escape)) {
114
114
  onRequestClose(evt);
115
115
  }
116
- if (match.match(evt, keys.Enter) && shouldSubmitOnEnter && target instanceof Element && !isCloseButton(target) && document.activeElement !== button.current) {
116
+ if (match.match(evt, keys.Enter) && shouldSubmitOnEnter && !isCloseButton(target) && document.activeElement !== button.current) {
117
117
  onRequestSubmit(evt);
118
118
  }
119
119
  if (focusTrapWithoutSentinels && !enableDialogElement && match.match(evt, keys.Tab) && innerModal.current) {
120
120
  wrapFocus.wrapFocusWithoutSentinels({
121
121
  containerNode: innerModal.current,
122
- currentActiveNode: evt.target,
123
- // TODO: Delete type assertion following util rewrite.
124
- // https://github.com/carbon-design-system/carbon/pull/18913
122
+ currentActiveNode: target,
125
123
  event: evt
126
124
  });
127
125
  }
128
126
  }
129
127
  }
130
128
  function handleOnClick(evt) {
131
- const target = evt.target;
129
+ const {
130
+ target
131
+ } = evt;
132
132
  evt.stopPropagation();
133
- if (!preventCloseOnClickOutside && !wrapFocus.elementOrParentIsFloatingMenu(target, selectorsFloatingMenus) && innerModal.current && !innerModal.current.contains(target)) {
133
+ if (!preventCloseOnClickOutside && target instanceof Node && !wrapFocus.elementOrParentIsFloatingMenu(target, selectorsFloatingMenus) && innerModal.current && !innerModal.current.contains(target)) {
134
134
  onRequestClose(evt);
135
135
  }
136
136
  }
@@ -139,7 +139,7 @@ const Modal = /*#__PURE__*/React__default["default"].forwardRef(function Modal(_
139
139
  target: oldActiveNode,
140
140
  relatedTarget: currentActiveNode
141
141
  } = _ref2;
142
- if (open && currentActiveNode && oldActiveNode) {
142
+ if (open && oldActiveNode instanceof HTMLElement && currentActiveNode instanceof HTMLElement) {
143
143
  const {
144
144
  current: bodyNode
145
145
  } = innerModal;
@@ -149,7 +149,7 @@ const Modal = /*#__PURE__*/React__default["default"].forwardRef(function Modal(_
149
149
  const {
150
150
  current: endTrapNode
151
151
  } = endTrap;
152
- wrapFocus["default"]({
152
+ wrapFocus.wrapFocus({
153
153
  bodyNode,
154
154
  startTrapNode,
155
155
  endTrapNode,
@@ -7,6 +7,7 @@
7
7
  import { type UseComboboxProps, type UseMultipleSelectionProps } from 'downshift';
8
8
  import React, { ReactNode, FunctionComponent, ReactElement } from 'react';
9
9
  import { type MultiSelectSortingProps } from './MultiSelectPropTypes';
10
+ import { type ListBoxSize, type ListBoxType } from '../ListBox';
10
11
  import { TranslateWithId } from '../../types/common';
11
12
  /**
12
13
  * Message ids that will be passed to translateWithId().
@@ -166,7 +167,7 @@ export interface FilterableMultiSelectProps<ItemType> extends MultiSelectSorting
166
167
  * Specify the size of the ListBox.
167
168
  * Currently, supports either `sm`, `md` or `lg` as an option.
168
169
  */
169
- size?: 'sm' | 'md' | 'lg';
170
+ size?: ListBoxSize;
170
171
  /**
171
172
  * @deprecated please use decorator instead.
172
173
  * **Experimental**: Provide a `Slug` component to be rendered inside the `Checkbox` component
@@ -177,7 +178,7 @@ export interface FilterableMultiSelectProps<ItemType> extends MultiSelectSorting
177
178
  * combobox via ARIA attributes.
178
179
  */
179
180
  titleText?: ReactNode;
180
- type?: 'default' | 'inline';
181
+ type?: ListBoxType;
181
182
  /**
182
183
  * Specify title to show title on hover
183
184
  */
@@ -787,7 +787,7 @@ FilterableMultiSelect.propTypes = {
787
787
  /**
788
788
  * Specify the size of the ListBox. Currently supports either `sm`, `md` or `lg` as an option.
789
789
  */
790
- size: ListBoxPropTypes.ListBoxSize,
790
+ size: ListBoxPropTypes.ListBoxSizePropType,
791
791
  slug: deprecate["default"](PropTypes__default["default"].node, 'The `slug` prop has been deprecated and will be removed in the next major version. Use the decorator prop instead.'),
792
792
  ...MultiSelectPropTypes.sortingPropTypes,
793
793
  /**
@@ -799,6 +799,7 @@ FilterableMultiSelect.propTypes = {
799
799
  * Callback function for translating ListBoxMenuIcon SVG title
800
800
  */
801
801
  translateWithId: PropTypes__default["default"].func,
802
+ type: ListBoxPropTypes.ListBoxTypePropType,
802
803
  /**
803
804
  * Specify title to show title on hover
804
805
  */
@@ -6,7 +6,7 @@
6
6
  */
7
7
  import { UseSelectProps } from 'downshift';
8
8
  import React, { ReactNode } from 'react';
9
- import { ListBoxSize, ListBoxType } from '../ListBox';
9
+ import { type ListBoxSize, type ListBoxType } from '../ListBox';
10
10
  import { MultiSelectSortingProps } from './MultiSelectPropTypes';
11
11
  import { ListBoxProps } from '../ListBox/ListBox';
12
12
  import type { TranslateWithId } from '../../types/common';
@@ -173,5 +173,11 @@ export interface MultiSelectProps<ItemType> extends MultiSelectSortingProps<Item
173
173
  */
174
174
  warnText?: ReactNode;
175
175
  }
176
- export declare const MultiSelect: React.ForwardRefExoticComponent<MultiSelectProps<unknown> & React.RefAttributes<HTMLButtonElement>>;
176
+ export declare const MultiSelect: MultiSelectComponent;
177
+ type MultiSelectComponentProps<ItemType> = React.PropsWithChildren<MultiSelectProps<ItemType>> & React.RefAttributes<HTMLButtonElement>;
178
+ interface MultiSelectComponent {
179
+ propTypes: Record<string, any>;
180
+ displayName: string;
181
+ <ItemType>(props: MultiSelectComponentProps<ItemType>): React.ReactElement<any> | null;
182
+ }
177
183
  export {};
@@ -435,7 +435,10 @@ const MultiSelect = /*#__PURE__*/React__default["default"].forwardRef((_ref, ref
435
435
  const menuProps = React.useMemo(() => getMenuProps({
436
436
  ref: enableFloatingStyles ? refs.setFloating : null
437
437
  }), [enableFloatingStyles, getMenuProps, refs.setFloating]);
438
- const labelProps = ! /*#__PURE__*/React.isValidElement(titleText) ? getLabelProps() : null;
438
+ const allLabelProps = getLabelProps();
439
+ const labelProps = /*#__PURE__*/React.isValidElement(titleText) ? {
440
+ id: allLabelProps.id
441
+ } : allLabelProps;
439
442
  const getSelectionStats = React.useCallback((selectedItems, filteredItems) => {
440
443
  const hasIndividualSelections = selectedItems.some(selected => !selected.isSelectAll);
441
444
  const nonSelectAllSelectedCount = selectedItems.filter(selected => !selected.isSelectAll).length;
@@ -677,7 +680,7 @@ MultiSelect.propTypes = {
677
680
  /**
678
681
  * Specify the size of the ListBox. Currently supports either `sm`, `md` or `lg` as an option.
679
682
  */
680
- size: ListBoxPropTypes.ListBoxSize,
683
+ size: ListBoxPropTypes.ListBoxSizePropType,
681
684
  slug: deprecate["default"](PropTypes__default["default"].node, 'The `slug` prop has been deprecated and will be removed in the next major version. Use the decorator prop instead.'),
682
685
  /**
683
686
  * Provide a method that sorts all options in the control. Overriding this
@@ -712,7 +715,7 @@ MultiSelect.propTypes = {
712
715
  /**
713
716
  * Specify 'inline' to create an inline multi-select.
714
717
  */
715
- type: PropTypes__default["default"].oneOf(['default', 'inline']),
718
+ type: ListBoxPropTypes.ListBoxTypePropType,
716
719
  /**
717
720
  * Specify title to show title on hover
718
721
  */
@@ -543,7 +543,7 @@ function ActionableNotification(_ref6) {
543
543
  const {
544
544
  current: endTrapNode
545
545
  } = endTrap;
546
- wrapFocus["default"]({
546
+ wrapFocus.wrapFocus({
547
547
  bodyNode,
548
548
  startTrapNode,
549
549
  endTrapNode,