@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
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright IBM Corp. 2016, 2024
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.
@@ -13,7 +13,7 @@ import React__default from 'react';
13
13
  import { usePrefix } from '../../internal/usePrefix.js';
14
14
  import { ToggletipContent, ToggletipActions, Toggletip, ToggletipButton } from '../Toggletip/index.js';
15
15
  import { IconButton } from '../IconButton/index.js';
16
- import { mapPopoverAlignProp } from '../../tools/createPropAdapter.js';
16
+ import { mapPopoverAlign } from '../../tools/mapPopoverAlign.js';
17
17
  import { Undo } from '@carbon/icons-react';
18
18
  import { useId } from '../../internal/useId.js';
19
19
  import deprecate from '../../prop-types/deprecate.js';
@@ -80,9 +80,6 @@ AILabelActions.propTypes = {
80
80
  * @deprecated Use NewPopoverAlignment instead.
81
81
  */
82
82
 
83
- const propMappingFunction = deprecatedValue => {
84
- return mapPopoverAlignProp(deprecatedValue);
85
- };
86
83
  const AILabel = /*#__PURE__*/React__default.forwardRef(function AILabel(_ref3, ref) {
87
84
  let {
88
85
  aiText = 'AI',
@@ -181,11 +178,7 @@ AILabel.propTypes = {
181
178
  // deprecated use right-start instead
182
179
 
183
180
  // new values to match floating-ui
184
- 'top-start', 'top-end', 'bottom-start', 'bottom-end', 'left-end', 'left-start', 'right-end', 'right-start']),
185
- //allowed prop values
186
- ['top', 'top-start', 'top-end', 'bottom', 'bottom-start', 'bottom-end', 'left', 'left-start', 'left-end', 'right', 'right-start', 'right-end'],
187
- //optional mapper function
188
- propMappingFunction),
181
+ '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),
189
182
  /**
190
183
  * Specify the text that will be provided to the aria-label of the `AILabel` button
191
184
  */
@@ -1,11 +1,10 @@
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 { ForwardRefReturn } from '../../types/common';
9
8
  export interface BreadcrumbProps extends React.HTMLAttributes<HTMLElement> {
10
9
  /**
11
10
  * Specify the label for the breadcrumb container
@@ -25,5 +24,5 @@ export interface BreadcrumbProps extends React.HTMLAttributes<HTMLElement> {
25
24
  */
26
25
  size?: 'sm' | 'md';
27
26
  }
28
- declare const Breadcrumb: ForwardRefReturn<HTMLElement, BreadcrumbProps>;
27
+ declare const Breadcrumb: React.ForwardRefExoticComponent<BreadcrumbProps & React.RefAttributes<HTMLElement>>;
29
28
  export default Breadcrumb;
@@ -7,19 +7,19 @@
7
7
 
8
8
  import { extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
9
9
  import PropTypes from 'prop-types';
10
- import React__default from 'react';
10
+ import React__default, { forwardRef } from 'react';
11
11
  import cx from 'classnames';
12
12
  import { usePrefix } from '../../internal/usePrefix.js';
13
13
 
14
- const Breadcrumb = /*#__PURE__*/React__default.forwardRef(function Breadcrumb(_ref, ref) {
15
- let {
14
+ const Breadcrumb = /*#__PURE__*/forwardRef((props, ref) => {
15
+ const {
16
16
  'aria-label': ariaLabel,
17
17
  children,
18
18
  className: customClassNameNav,
19
19
  noTrailingSlash,
20
20
  size,
21
21
  ...rest
22
- } = _ref;
22
+ } = props;
23
23
  const prefix = usePrefix();
24
24
  const className = cx({
25
25
  [`${prefix}--breadcrumb`]: true,
@@ -1,11 +1,10 @@
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 React, { AriaAttributes } from 'react';
8
- import { ForwardRefReturn } from '../../types/common';
7
+ import React, { type AriaAttributes } from 'react';
9
8
  export interface BreadcrumbItemProps extends React.HTMLAttributes<HTMLLIElement> {
10
9
  'aria-current'?: AriaAttributes['aria-current'];
11
10
  /**
@@ -21,5 +20,5 @@ export interface BreadcrumbItemProps extends React.HTMLAttributes<HTMLLIElement>
21
20
  */
22
21
  isCurrentPage?: boolean;
23
22
  }
24
- declare const BreadcrumbItem: ForwardRefReturn<HTMLLIElement, BreadcrumbItemProps>;
23
+ declare const BreadcrumbItem: React.ForwardRefExoticComponent<BreadcrumbItemProps & React.RefAttributes<HTMLLIElement>>;
25
24
  export default BreadcrumbItem;
@@ -7,7 +7,7 @@
7
7
 
8
8
  import { extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
9
9
  import PropTypes from 'prop-types';
10
- import React__default from 'react';
10
+ import React__default, { forwardRef } from 'react';
11
11
  import cx from 'classnames';
12
12
  import Link from '../Link/Link.js';
13
13
  import { OverflowMenuHorizontal } from '@carbon/icons-react';
@@ -15,15 +15,16 @@ import { usePrefix } from '../../internal/usePrefix.js';
15
15
  import '../Text/index.js';
16
16
  import { Text } from '../Text/Text.js';
17
17
 
18
- const BreadcrumbItem = /*#__PURE__*/React__default.forwardRef(function BreadcrumbItem(_ref, ref) {
19
- let {
18
+ const frFn = forwardRef;
19
+ const BreadcrumbItem = frFn((props, ref) => {
20
+ const {
20
21
  'aria-current': ariaCurrent,
21
22
  children,
22
23
  className: customClassName = '',
23
24
  href,
24
25
  isCurrentPage,
25
26
  ...rest
26
- } = _ref;
27
+ } = props;
27
28
  const prefix = usePrefix();
28
29
  const className = cx({
29
30
  [`${prefix}--breadcrumb-item`]: true,
@@ -7,9 +7,8 @@
7
7
 
8
8
  import { extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
9
9
  import PropTypes from 'prop-types';
10
- import React__default, { useRef } from 'react';
10
+ import React__default from 'react';
11
11
  import { IconButton, IconButtonKinds } from '../IconButton/index.js';
12
- import { composeEventHandlers } from '../../tools/events.js';
13
12
  import ButtonBase from './ButtonBase.js';
14
13
 
15
14
  const ButtonKinds = ['primary', 'secondary', 'danger', 'ghost', 'danger--primary', 'danger--ghost', 'danger--tertiary', 'tertiary'];
@@ -23,7 +22,6 @@ function isIconOnlyButton(hasIconOnly, _kind) {
23
22
  return false;
24
23
  }
25
24
  const Button = /*#__PURE__*/React__default.forwardRef((props, ref) => {
26
- const tooltipRef = useRef(null);
27
25
  const {
28
26
  as,
29
27
  autoAlign = false,
@@ -47,12 +45,6 @@ const Button = /*#__PURE__*/React__default.forwardRef((props, ref) => {
47
45
  if (ButtonImageElement && !children && !iconDescription) {
48
46
  console.error('Button: renderIcon property specified without also providing an iconDescription property. ' + 'This may impact accessibility for screen reader users.');
49
47
  }
50
- const handleClick = evt => {
51
- // Prevent clicks on the tooltip from triggering the button click event
52
- if (evt.target === tooltipRef.current) {
53
- evt.preventDefault();
54
- }
55
- };
56
48
  const iconOnlyImage = !ButtonImageElement ? null : /*#__PURE__*/React__default.createElement(ButtonImageElement, null);
57
49
  if (!isIconOnlyButton(hasIconOnly)) {
58
50
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
@@ -103,7 +95,7 @@ const Button = /*#__PURE__*/React__default.forwardRef((props, ref) => {
103
95
  onFocus: onFocus,
104
96
  onBlur: onBlur,
105
97
  autoAlign: autoAlign,
106
- onClick: composeEventHandlers([onClick, handleClick]),
98
+ onClick: onClick,
107
99
  renderIcon: iconOnlyImage ? null : ButtonImageElement // avoid doubling the icon.
108
100
  }), iconOnlyImage ?? children)
109
101
  );
@@ -1,11 +1,10 @@
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 { ForwardRefReturn } from '../../types/common';
9
8
  export interface ButtonSetProps extends React.HTMLAttributes<HTMLDivElement> {
10
9
  /**
11
10
  * Specify the button arrangement of the set (vertically stacked or
@@ -13,5 +12,5 @@ export interface ButtonSetProps extends React.HTMLAttributes<HTMLDivElement> {
13
12
  */
14
13
  stacked?: boolean;
15
14
  }
16
- declare const ButtonSet: ForwardRefReturn<HTMLDivElement, ButtonSetProps>;
15
+ declare const ButtonSet: React.ForwardRefExoticComponent<ButtonSetProps & React.RefAttributes<HTMLDivElement>>;
17
16
  export default ButtonSet;
@@ -6,18 +6,18 @@
6
6
  */
7
7
 
8
8
  import { extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
9
- import React__default from 'react';
9
+ import React__default, { forwardRef } from 'react';
10
10
  import PropTypes from 'prop-types';
11
11
  import cx from 'classnames';
12
12
  import { usePrefix } from '../../internal/usePrefix.js';
13
13
 
14
- const ButtonSet = /*#__PURE__*/React__default.forwardRef(function ButtonSet(_ref, ref) {
15
- let {
14
+ const ButtonSet = /*#__PURE__*/forwardRef((props, ref) => {
15
+ const {
16
16
  children,
17
17
  className,
18
18
  stacked,
19
19
  ...rest
20
- } = _ref;
20
+ } = props;
21
21
  const prefix = usePrefix();
22
22
  const buttonSetClasses = cx(className, `${prefix}--btn-set`, {
23
23
  [`${prefix}--btn-set--stacked`]: stacked
@@ -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.
@@ -15,30 +15,18 @@ import Copy from '../Copy/Copy.js';
15
15
  import Button from '../Button/Button.js';
16
16
  import '../Button/Button.Skeleton.js';
17
17
  import CopyButton from '../CopyButton/CopyButton.js';
18
- import uniqueId from '../../tools/uniqueId.js';
18
+ import { uniqueId } from '../../tools/uniqueId.js';
19
19
  import copy from 'copy-to-clipboard';
20
20
  import deprecate from '../../prop-types/deprecate.js';
21
21
  import { usePrefix } from '../../internal/usePrefix.js';
22
22
  import deprecateValuesWithin from '../../prop-types/deprecateValuesWithin.js';
23
+ import { mapPopoverAlign } from '../../tools/mapPopoverAlign.js';
23
24
 
24
25
  const rowHeightInPixels = 16;
25
26
  const defaultMaxCollapsedNumberOfRows = 15;
26
27
  const defaultMaxExpandedNumberOfRows = 0;
27
28
  const defaultMinCollapsedNumberOfRows = 3;
28
29
  const defaultMinExpandedNumberOfRows = 16;
29
- const propMappingFunction = deprecatedValue => {
30
- const mapping = {
31
- 'top-left': 'top-start',
32
- 'top-right': 'top-end',
33
- 'bottom-left': 'bottom-start',
34
- 'bottom-right': 'bottom-end',
35
- 'left-bottom': 'left-end',
36
- 'left-top': 'left-start',
37
- 'right-bottom': 'right-end',
38
- 'right-top': 'right-start'
39
- };
40
- return mapping[deprecatedValue];
41
- };
42
30
  function CodeSnippet(_ref) {
43
31
  let {
44
32
  align = 'bottom',
@@ -269,11 +257,7 @@ CodeSnippet.propTypes = {
269
257
  // deprecated use right-start instead
270
258
 
271
259
  // new values to match floating-ui
272
- 'top-start', 'top-end', 'bottom-start', 'bottom-end', 'left-end', 'left-start', 'right-end', 'right-start']),
273
- //allowed prop values
274
- ['top', 'top-start', 'top-end', 'bottom', 'bottom-start', 'bottom-end', 'left', 'left-start', 'left-end', 'right', 'right-start', 'right-end'],
275
- //optional mapper function
276
- propMappingFunction),
260
+ '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),
277
261
  /**
278
262
  * Specify a label to be read by screen readers on the containing textbox
279
263
  * node
@@ -6,7 +6,7 @@
6
6
  */
7
7
  import { UseComboboxProps, UseComboboxActions } from 'downshift';
8
8
  import React, { type ReactNode, type ComponentType, type ReactElement, type RefAttributes, type PropsWithChildren, type PropsWithRef, type InputHTMLAttributes, type MouseEvent } from 'react';
9
- import { ListBoxSize } from '../ListBox';
9
+ import { type ListBoxSize } from '../ListBox';
10
10
  import { TranslateWithId } from '../../types/common';
11
11
  type ExcludedAttributes = 'id' | 'onChange' | 'onClick' | 'type' | 'size';
12
12
  export interface OnChangeData<ItemType> {
@@ -26,7 +26,7 @@ import '../FluidForm/FluidForm.js';
26
26
  import { FormContext } from '../FluidForm/FormContext.js';
27
27
  import { useFloating, flip, hide, autoUpdate } from '@floating-ui/react';
28
28
  import { useFeatureFlag } from '../FeatureFlags/index.js';
29
- import { ListBoxSize } from '../ListBox/ListBoxPropTypes.js';
29
+ import { ListBoxSizePropType } from '../ListBox/ListBoxPropTypes.js';
30
30
  import { Text } from '../Text/Text.js';
31
31
 
32
32
  const {
@@ -37,7 +37,9 @@ const {
37
37
  ItemMouseMove,
38
38
  InputKeyDownArrowUp,
39
39
  InputKeyDownArrowDown,
40
- MenuMouseLeave
40
+ MenuMouseLeave,
41
+ ItemClick,
42
+ FunctionSelectItem
41
43
  } = useCombobox.stateChangeTypes;
42
44
  const defaultItemToString = item => {
43
45
  if (typeof item === 'string') {
@@ -208,6 +210,8 @@ const ComboBox = /*#__PURE__*/forwardRef((props, ref) => {
208
210
  prevInputLengthRef.current = inputValue.length;
209
211
  }
210
212
  }, [typeahead, inputValue, items, itemToString, autocompleteCustomFilter]);
213
+ const isManualClearingRef = useRef(false);
214
+ const [isClearing, setIsClearing] = useState(false);
211
215
  const prefix = usePrefix();
212
216
  const {
213
217
  isFluid
@@ -217,6 +221,14 @@ const ComboBox = /*#__PURE__*/forwardRef((props, ref) => {
217
221
  const [isFocused, setIsFocused] = useState(false);
218
222
  const prevInputValue = useRef(inputValue);
219
223
  const prevSelectedItemProp = useRef(selectedItemProp);
224
+ useEffect(() => {
225
+ isManualClearingRef.current = isClearing;
226
+
227
+ // Reset flag after render cycle
228
+ if (isClearing) {
229
+ setIsClearing(false);
230
+ }
231
+ }, [isClearing]);
220
232
 
221
233
  // fully controlled combobox: handle changes to selectedItemProp
222
234
  useEffect(() => {
@@ -302,31 +314,38 @@ const ComboBox = /*#__PURE__*/forwardRef((props, ref) => {
302
314
  }
303
315
  case InputKeyDownEnter:
304
316
  if (!allowCustomValue) {
305
- const highlightedIndex = indexToHighlight(inputValue);
306
- const matchingItem = items[highlightedIndex];
307
- if (matchingItem) {
308
- // Prevent matching items that are marked as `disabled` from
309
- // being selected.
310
- if (matchingItem.disabled) {
311
- return state;
317
+ if (state.highlightedIndex !== -1) {
318
+ const filteredList = filterItems(items, itemToString, inputValue);
319
+ const highlightedItem = filteredList[state.highlightedIndex];
320
+ if (highlightedItem && !highlightedItem.disabled) {
321
+ return {
322
+ ...changes,
323
+ selectedItem: highlightedItem,
324
+ inputValue: itemToString(highlightedItem)
325
+ };
326
+ }
327
+ } else {
328
+ const autoIndex = indexToHighlight(inputValue);
329
+ if (autoIndex !== -1) {
330
+ const matchingItem = items[autoIndex];
331
+ if (matchingItem && !matchingItem.disabled) {
332
+ return {
333
+ ...changes,
334
+ selectedItem: matchingItem,
335
+ inputValue: itemToString(matchingItem)
336
+ };
337
+ }
312
338
  }
313
339
 
314
- // Select the matching item.
315
- return {
316
- ...changes,
317
- selectedItem: matchingItem,
318
- inputValue: itemToString(matchingItem)
319
- };
320
- }
321
-
322
- // If no matching item is found and there is an existing
323
- // selection, clear the selection.
324
- if (state.selectedItem !== null) {
325
- return {
326
- ...changes,
327
- selectedItem: null,
328
- inputValue
329
- };
340
+ // If no matching item is found and there is an existing
341
+ // selection, clear the selection.
342
+ if (state.selectedItem !== null) {
343
+ return {
344
+ ...changes,
345
+ selectedItem: null,
346
+ inputValue
347
+ };
348
+ }
330
349
  }
331
350
  }
332
351
 
@@ -491,13 +510,10 @@ const ComboBox = /*#__PURE__*/forwardRef((props, ref) => {
491
510
  type,
492
511
  selectedItem: newSelectedItem
493
512
  });
494
- if (type === useCombobox.stateChangeTypes.ItemClick && !isEqual(selectedItemProp, newSelectedItem)) {
495
- onChange({
496
- selectedItem: newSelectedItem
497
- });
513
+ if (isManualClearingRef.current) {
514
+ return;
498
515
  }
499
- if ((type === useCombobox.stateChangeTypes.FunctionSelectItem || type === useCombobox.stateChangeTypes.InputKeyDownEnter) && !isEqual(selectedItemProp, newSelectedItem) // Only fire if there's an actual change
500
- ) {
516
+ if ((type === ItemClick || type === FunctionSelectItem || type === InputKeyDownEnter) && typeof newSelectedItem !== 'undefined' && !isEqual(selectedItemProp, newSelectedItem)) {
501
517
  onChange({
502
518
  selectedItem: newSelectedItem
503
519
  });
@@ -690,7 +706,13 @@ const ComboBox = /*#__PURE__*/forwardRef((props, ref) => {
690
706
  className: `${prefix}--list-box__invalid-icon ${prefix}--list-box__invalid-icon--warning`
691
707
  }), inputValue && /*#__PURE__*/React__default.createElement(ListBoxSelection, {
692
708
  clearSelection: () => {
709
+ setIsClearing(true); // This updates the state which syncs to the ref
710
+ setInputValue('');
711
+ onChange({
712
+ selectedItem: null
713
+ });
693
714
  selectItem(null);
715
+ handleSelectionClear();
694
716
  },
695
717
  translateWithId: translateWithId,
696
718
  disabled: disabled || readOnly,
@@ -884,7 +906,7 @@ ComboBox.propTypes = {
884
906
  /**
885
907
  * Specify the size of the ListBox. Currently supports either `sm`, `md` or `lg` as an option.
886
908
  */
887
- size: ListBoxSize,
909
+ size: ListBoxSizePropType,
888
910
  slug: deprecate(PropTypes.node, 'The `slug` prop has been deprecated and will be removed in the next major version. Use the decorator prop instead.'),
889
911
  /**
890
912
  * Provide text to be used in a `<label>` element that is tied to the
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright IBM Corp. 2023
2
+ * Copyright IBM Corp. 2023, 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.
@@ -22,6 +22,7 @@ import { flip, hide, size, useFloating, autoUpdate } from '@floating-ui/react';
22
22
  import { useFeatureFlag } from '../FeatureFlags/index.js';
23
23
  import mergeRefs from '../../tools/mergeRefs.js';
24
24
  import deprecateValuesWithin from '../../prop-types/deprecateValuesWithin.js';
25
+ import { mapPopoverAlign } from '../../tools/mapPopoverAlign.js';
25
26
 
26
27
  var _ChevronDown;
27
28
  const defaultTranslations = {
@@ -32,19 +33,6 @@ const defaultTranslations = {
32
33
  * Message ids that will be passed to translateWithId().
33
34
  */
34
35
 
35
- const propMappingFunction = deprecatedValue => {
36
- const mapping = {
37
- 'top-left': 'top-start',
38
- 'top-right': 'top-end',
39
- 'bottom-left': 'bottom-start',
40
- 'bottom-right': 'bottom-end',
41
- 'left-bottom': 'left-end',
42
- 'left-top': 'left-start',
43
- 'right-bottom': 'right-end',
44
- 'right-top': 'right-start'
45
- };
46
- return mapping[deprecatedValue];
47
- };
48
36
  function defaultTranslateWithId(messageId) {
49
37
  return defaultTranslations[messageId];
50
38
  }
@@ -224,11 +212,7 @@ ComboButton.propTypes = {
224
212
  // deprecated use right-start instead
225
213
 
226
214
  // new values to match floating-ui
227
- 'top-start', 'top-end', 'bottom-start', 'bottom-end', 'left-end', 'left-start', 'right-end', 'right-start']),
228
- //allowed prop values
229
- ['top', 'top-start', 'top-end', 'bottom', 'bottom-start', 'bottom-end', 'left', 'left-start', 'left-end', 'right', 'right-start', 'right-end'],
230
- //optional mapper function
231
- propMappingFunction),
215
+ '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),
232
216
  /**
233
217
  * Optional method that takes in a message id and returns an
234
218
  * internationalized string.
@@ -17,7 +17,7 @@ import mergeRefs from '../../tools/mergeRefs.js';
17
17
  import cx from 'classnames';
18
18
  import { toggleClass } from '../../tools/toggleClass.js';
19
19
  import requiredIfGivenPropIsTruthy from '../../prop-types/requiredIfGivenPropIsTruthy.js';
20
- import wrapFocus, { wrapFocusWithoutSentinels, elementOrParentIsFloatingMenu } from '../../internal/wrapFocus.js';
20
+ import { wrapFocusWithoutSentinels, elementOrParentIsFloatingMenu, wrapFocus } from '../../internal/wrapFocus.js';
21
21
  import { usePrefix } from '../../internal/usePrefix.js';
22
22
  import { Escape, Tab } from '../../internal/keyboard/keys.js';
23
23
  import { match } from '../../internal/keyboard/match.js';
@@ -165,10 +165,12 @@ const ComposedModal = /*#__PURE__*/React__default.forwardRef(function ComposedMo
165
165
  onMouseDownTarget.current = target;
166
166
  }
167
167
  function handleOnClick(evt) {
168
- const target = evt.target;
168
+ const {
169
+ target
170
+ } = evt;
169
171
  const mouseDownTarget = onMouseDownTarget.current;
170
172
  evt.stopPropagation();
171
- if (!preventCloseOnClickOutside && !elementOrParentIsFloatingMenu(target, selectorsFloatingMenus) && innerModal.current && !innerModal.current.contains(target) && !innerModal.current.contains(mouseDownTarget)) {
173
+ if (!preventCloseOnClickOutside && target instanceof Node && !elementOrParentIsFloatingMenu(target, selectorsFloatingMenus) && innerModal.current && !innerModal.current.contains(target) && !innerModal.current.contains(mouseDownTarget)) {
172
174
  closeModal(evt);
173
175
  }
174
176
  }
@@ -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.
@@ -14,21 +14,9 @@ import { usePrefix } from '../../internal/usePrefix.js';
14
14
  import { IconButton } from '../IconButton/index.js';
15
15
  import { noopFn } from '../../internal/noopFn.js';
16
16
  import deprecateValuesWithin from '../../prop-types/deprecateValuesWithin.js';
17
+ import { mapPopoverAlign } from '../../tools/mapPopoverAlign.js';
17
18
  import { debounce } from '../../node_modules/es-toolkit/dist/compat/function/debounce.mjs.js';
18
19
 
19
- const propMappingFunction = deprecatedValue => {
20
- const mapping = {
21
- 'top-left': 'top-start',
22
- 'top-right': 'top-end',
23
- 'bottom-left': 'bottom-start',
24
- 'bottom-right': 'bottom-end',
25
- 'left-bottom': 'left-end',
26
- 'left-top': 'left-start',
27
- 'right-bottom': 'right-end',
28
- 'right-top': 'right-start'
29
- };
30
- return mapping[deprecatedValue];
31
- };
32
20
  function Copy(_ref) {
33
21
  let {
34
22
  align = 'bottom',
@@ -101,11 +89,7 @@ Copy.propTypes = {
101
89
  // deprecated use right-start instead
102
90
 
103
91
  // new values to match floating-ui
104
- 'top-start', 'top-end', 'bottom-start', 'bottom-end', 'left-end', 'left-start', 'right-end', 'right-start']),
105
- //allowed prop values
106
- ['top', 'top-start', 'top-end', 'bottom', 'bottom-start', 'bottom-end', 'left', 'left-start', 'left-end', 'right', 'right-start', 'right-end'],
107
- //optional mapper function
108
- propMappingFunction),
92
+ '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),
109
93
  /**
110
94
  * **Experimental**: Will attempt to automatically align the tooltip
111
95
  */
@@ -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.
@@ -15,20 +15,8 @@ import { LayoutConstraint } from '../Layout/index.js';
15
15
  import { usePrefix } from '../../internal/usePrefix.js';
16
16
  import { noopFn } from '../../internal/noopFn.js';
17
17
  import deprecateValuesWithin from '../../prop-types/deprecateValuesWithin.js';
18
+ import { mapPopoverAlign } from '../../tools/mapPopoverAlign.js';
18
19
 
19
- const propMappingFunction = deprecatedValue => {
20
- const mapping = {
21
- 'top-left': 'top-start',
22
- 'top-right': 'top-end',
23
- 'bottom-left': 'bottom-start',
24
- 'bottom-right': 'bottom-end',
25
- 'left-bottom': 'left-end',
26
- 'left-top': 'left-start',
27
- 'right-bottom': 'right-end',
28
- 'right-top': 'right-start'
29
- };
30
- return mapping[deprecatedValue];
31
- };
32
20
  function CopyButton(_ref) {
33
21
  let {
34
22
  align = 'bottom',
@@ -83,11 +71,7 @@ CopyButton.propTypes = {
83
71
  // deprecated use right-start instead
84
72
 
85
73
  // new values to match floating-ui
86
- 'top-start', 'top-end', 'bottom-start', 'bottom-end', 'left-end', 'left-start', 'right-end', 'right-start']),
87
- //allowed prop values
88
- ['top', 'top-start', 'top-end', 'bottom', 'bottom-start', 'bottom-end', 'left', 'left-start', 'left-end', 'right', 'right-start', 'right-end'],
89
- //optional mapper function
90
- propMappingFunction),
74
+ '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),
91
75
  /**
92
76
  * **Experimental**: Will attempt to automatically align the tooltip
93
77
  */