@carbon/react 1.81.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 (202) hide show
  1. package/.playwright/INTERNAL_AVT_REPORT_DO_NOT_USE.json +892 -892
  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 +2 -2
  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/TableToolbarAction.d.ts +2 -4
  25. package/es/components/DataTable/TableToolbarAction.js +5 -4
  26. package/es/components/DataTable/tools/sorting.d.ts +42 -0
  27. package/es/components/DataTable/tools/sorting.js +24 -53
  28. package/es/components/DatePicker/DatePicker.d.ts +1 -1
  29. package/es/components/DatePicker/DatePicker.js +18 -18
  30. package/es/components/Dialog/index.d.ts +1 -1
  31. package/es/components/Dropdown/Dropdown.Skeleton.d.ts +2 -2
  32. package/es/components/Dropdown/Dropdown.Skeleton.js +2 -2
  33. package/es/components/Dropdown/Dropdown.d.ts +7 -6
  34. package/es/components/Dropdown/Dropdown.js +7 -3
  35. package/es/components/FileUploader/FileUploaderButton.d.ts +1 -1
  36. package/es/components/FileUploader/FileUploaderButton.js +1 -1
  37. package/es/components/FileUploader/FileUploaderDropContainer.js +1 -1
  38. package/es/components/FileUploader/FileUploaderItem.js +1 -1
  39. package/es/components/FluidDropdown/FluidDropdown.d.ts +1 -1
  40. package/es/components/FluidSearch/FluidSearch.d.ts +3 -6
  41. package/es/components/IconButton/index.d.ts +1 -1
  42. package/es/components/IconButton/index.js +2 -18
  43. package/es/components/ListBox/ListBox.d.ts +4 -5
  44. package/es/components/ListBox/ListBox.js +8 -7
  45. package/es/components/ListBox/ListBoxMenu.d.ts +4 -4
  46. package/es/components/ListBox/ListBoxMenu.js +4 -2
  47. package/es/components/ListBox/ListBoxMenuItem.d.ts +9 -8
  48. package/es/components/ListBox/ListBoxPropTypes.d.ts +3 -3
  49. package/es/components/ListBox/ListBoxPropTypes.js +3 -3
  50. package/es/components/ListBox/index.d.ts +7 -5
  51. package/es/components/ListBox/index.js +1 -1
  52. package/es/components/Menu/Menu.js +5 -0
  53. package/es/components/Modal/Modal.js +9 -9
  54. package/es/components/MultiSelect/FilterableMultiSelect.d.ts +3 -2
  55. package/es/components/MultiSelect/FilterableMultiSelect.js +3 -2
  56. package/es/components/MultiSelect/MultiSelect.d.ts +8 -2
  57. package/es/components/MultiSelect/MultiSelect.js +3 -3
  58. package/es/components/Notification/Notification.js +1 -1
  59. package/es/components/OverflowMenu/OverflowMenu.js +2 -21
  60. package/es/components/OverflowMenu/next/index.js +2 -18
  61. package/es/components/OverflowMenuItem/OverflowMenuItem.d.ts +2 -4
  62. package/es/components/OverflowMenuItem/OverflowMenuItem.js +5 -4
  63. package/es/components/PageHeader/PageHeader.d.ts +153 -8
  64. package/es/components/PageHeader/PageHeader.js +143 -21
  65. package/es/components/PageHeader/index.d.ts +2 -2
  66. package/es/components/PageHeader/index.js +1 -1
  67. package/es/components/Popover/index.js +4 -21
  68. package/es/components/Search/Search.d.ts +2 -5
  69. package/es/components/Search/Search.js +24 -8
  70. package/es/components/Stack/HStack.d.ts +2 -3
  71. package/es/components/Stack/HStack.js +4 -7
  72. package/es/components/Stack/Stack.d.ts +3 -4
  73. package/es/components/Stack/Stack.js +3 -6
  74. package/es/components/Stack/VStack.d.ts +2 -3
  75. package/es/components/Stack/VStack.js +3 -2
  76. package/es/components/Stack/index.d.ts +4 -4
  77. package/es/components/TextArea/TextArea.js +3 -5
  78. package/es/components/TimePicker/TimePicker.d.ts +3 -4
  79. package/es/components/TimePicker/TimePicker.js +5 -4
  80. package/es/components/TimePickerSelect/TimePickerSelect.d.ts +23 -4
  81. package/es/components/TimePickerSelect/TimePickerSelect.js +5 -4
  82. package/es/components/TreeView/TreeNode.js +13 -1
  83. package/es/components/TreeView/TreeView.js +1 -1
  84. package/es/index.js +1 -1
  85. package/es/internal/FloatingMenu.js +9 -5
  86. package/es/internal/environment.js +7 -0
  87. package/es/internal/keyboard/navigation.d.ts +0 -10
  88. package/es/internal/keyboard/navigation.js +1 -13
  89. package/es/internal/useId.js +1 -1
  90. package/es/internal/useNoInteractiveChildren.js +7 -0
  91. package/es/internal/useOutsideClick.js +3 -0
  92. package/es/internal/wrapFocus.d.ts +49 -0
  93. package/es/internal/wrapFocus.js +64 -51
  94. package/es/tools/events.d.ts +17 -0
  95. package/es/tools/events.js +10 -13
  96. package/es/tools/mapPopoverAlign.d.ts +15 -0
  97. package/es/tools/mapPopoverAlign.js +28 -0
  98. package/es/tools/uniqueId.d.ts +7 -0
  99. package/es/tools/uniqueId.js +3 -3
  100. package/es/types/common.d.ts +0 -2
  101. package/lib/components/AILabel/index.d.ts +1 -1
  102. package/lib/components/AILabel/index.js +2 -9
  103. package/lib/components/Breadcrumb/Breadcrumb.d.ts +2 -3
  104. package/lib/components/Breadcrumb/Breadcrumb.js +3 -3
  105. package/lib/components/Breadcrumb/BreadcrumbItem.d.ts +3 -4
  106. package/lib/components/Breadcrumb/BreadcrumbItem.js +4 -3
  107. package/lib/components/Button/Button.js +1 -9
  108. package/lib/components/ButtonSet/ButtonSet.d.ts +2 -3
  109. package/lib/components/ButtonSet/ButtonSet.js +3 -3
  110. package/lib/components/CodeSnippet/CodeSnippet.d.ts +1 -1
  111. package/lib/components/CodeSnippet/CodeSnippet.js +3 -19
  112. package/lib/components/ComboBox/ComboBox.d.ts +1 -1
  113. package/lib/components/ComboBox/ComboBox.js +1 -1
  114. package/lib/components/ComboButton/index.d.ts +1 -1
  115. package/lib/components/ComboButton/index.js +2 -18
  116. package/lib/components/ComposedModal/ComposedModal.js +5 -3
  117. package/lib/components/Copy/Copy.d.ts +1 -1
  118. package/lib/components/Copy/Copy.js +2 -18
  119. package/lib/components/CopyButton/CopyButton.d.ts +1 -1
  120. package/lib/components/CopyButton/CopyButton.js +2 -18
  121. package/lib/components/DataTable/DataTable.d.ts +7 -12
  122. package/lib/components/DataTable/DataTable.js +0 -5
  123. package/lib/components/DataTable/TableToolbarAction.d.ts +2 -4
  124. package/lib/components/DataTable/TableToolbarAction.js +4 -3
  125. package/lib/components/DataTable/tools/sorting.d.ts +42 -0
  126. package/lib/components/DataTable/tools/sorting.js +23 -53
  127. package/lib/components/DatePicker/DatePicker.d.ts +1 -1
  128. package/lib/components/DatePicker/DatePicker.js +18 -18
  129. package/lib/components/Dialog/index.d.ts +1 -1
  130. package/lib/components/Dropdown/Dropdown.Skeleton.d.ts +2 -2
  131. package/lib/components/Dropdown/Dropdown.Skeleton.js +1 -1
  132. package/lib/components/Dropdown/Dropdown.d.ts +7 -6
  133. package/lib/components/Dropdown/Dropdown.js +6 -2
  134. package/lib/components/FileUploader/FileUploaderButton.d.ts +1 -1
  135. package/lib/components/FileUploader/FileUploaderButton.js +1 -1
  136. package/lib/components/FileUploader/FileUploaderDropContainer.js +1 -1
  137. package/lib/components/FileUploader/FileUploaderItem.js +1 -1
  138. package/lib/components/FluidDropdown/FluidDropdown.d.ts +1 -1
  139. package/lib/components/FluidSearch/FluidSearch.d.ts +3 -6
  140. package/lib/components/IconButton/index.d.ts +1 -1
  141. package/lib/components/IconButton/index.js +2 -18
  142. package/lib/components/ListBox/ListBox.d.ts +4 -5
  143. package/lib/components/ListBox/ListBox.js +7 -6
  144. package/lib/components/ListBox/ListBoxMenu.d.ts +4 -4
  145. package/lib/components/ListBox/ListBoxMenu.js +3 -1
  146. package/lib/components/ListBox/ListBoxMenuItem.d.ts +9 -8
  147. package/lib/components/ListBox/ListBoxPropTypes.d.ts +3 -3
  148. package/lib/components/ListBox/ListBoxPropTypes.js +4 -4
  149. package/lib/components/ListBox/index.d.ts +7 -5
  150. package/lib/components/ListBox/index.js +2 -2
  151. package/lib/components/Menu/Menu.js +5 -0
  152. package/lib/components/Modal/Modal.js +9 -9
  153. package/lib/components/MultiSelect/FilterableMultiSelect.d.ts +3 -2
  154. package/lib/components/MultiSelect/FilterableMultiSelect.js +2 -1
  155. package/lib/components/MultiSelect/MultiSelect.d.ts +8 -2
  156. package/lib/components/MultiSelect/MultiSelect.js +2 -2
  157. package/lib/components/Notification/Notification.js +1 -1
  158. package/lib/components/OverflowMenu/OverflowMenu.js +2 -21
  159. package/lib/components/OverflowMenu/next/index.js +2 -18
  160. package/lib/components/OverflowMenuItem/OverflowMenuItem.d.ts +2 -4
  161. package/lib/components/OverflowMenuItem/OverflowMenuItem.js +4 -3
  162. package/lib/components/PageHeader/PageHeader.d.ts +153 -8
  163. package/lib/components/PageHeader/PageHeader.js +145 -19
  164. package/lib/components/PageHeader/index.d.ts +2 -2
  165. package/lib/components/PageHeader/index.js +4 -0
  166. package/lib/components/Popover/index.js +4 -21
  167. package/lib/components/Search/Search.d.ts +2 -5
  168. package/lib/components/Search/Search.js +24 -8
  169. package/lib/components/Stack/HStack.d.ts +2 -3
  170. package/lib/components/Stack/HStack.js +3 -6
  171. package/lib/components/Stack/Stack.d.ts +3 -4
  172. package/lib/components/Stack/Stack.js +2 -5
  173. package/lib/components/Stack/VStack.d.ts +2 -3
  174. package/lib/components/Stack/VStack.js +2 -1
  175. package/lib/components/Stack/index.d.ts +4 -4
  176. package/lib/components/TextArea/TextArea.js +2 -4
  177. package/lib/components/TimePicker/TimePicker.d.ts +3 -4
  178. package/lib/components/TimePicker/TimePicker.js +4 -3
  179. package/lib/components/TimePickerSelect/TimePickerSelect.d.ts +23 -4
  180. package/lib/components/TimePickerSelect/TimePickerSelect.js +4 -3
  181. package/lib/components/TreeView/TreeNode.js +13 -1
  182. package/lib/components/TreeView/TreeView.js +1 -1
  183. package/lib/index.js +2 -2
  184. package/lib/internal/FloatingMenu.js +9 -5
  185. package/lib/internal/environment.js +7 -0
  186. package/lib/internal/keyboard/navigation.d.ts +0 -10
  187. package/lib/internal/keyboard/navigation.js +0 -14
  188. package/lib/internal/useNoInteractiveChildren.js +7 -0
  189. package/lib/internal/useOutsideClick.js +3 -0
  190. package/lib/internal/wrapFocus.d.ts +49 -0
  191. package/lib/internal/wrapFocus.js +66 -53
  192. package/lib/tools/events.d.ts +17 -0
  193. package/lib/tools/events.js +10 -13
  194. package/lib/tools/mapPopoverAlign.d.ts +15 -0
  195. package/lib/tools/mapPopoverAlign.js +32 -0
  196. package/lib/tools/uniqueId.d.ts +7 -0
  197. package/lib/tools/uniqueId.js +3 -3
  198. package/lib/types/common.d.ts +0 -2
  199. package/package.json +7 -7
  200. package/telemetry.yml +3 -1
  201. package/es/tools/createPropAdapter.js +0 -40
  202. 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 {
@@ -906,7 +906,7 @@ ComboBox.propTypes = {
906
906
  /**
907
907
  * Specify the size of the ListBox. Currently supports either `sm`, `md` or `lg` as an option.
908
908
  */
909
- size: ListBoxSize,
909
+ size: ListBoxSizePropType,
910
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.'),
911
911
  /**
912
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
  */
@@ -5,7 +5,7 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
  import PropTypes from 'prop-types';
8
- import React from 'react';
8
+ import React, { type MouseEvent } from 'react';
9
9
  import type { DataTableSortState } from './state/sortStates';
10
10
  import Table from './Table';
11
11
  import TableActionList from './TableActionList';
@@ -125,7 +125,7 @@ export interface DataTableRenderProps<RowType, ColTypes extends any[]> {
125
125
  [key: string]: unknown;
126
126
  };
127
127
  getSelectionProps: (getSelectionPropsArgs?: {
128
- onClick?: (e: React.MouseEvent<HTMLButtonElement>) => void;
128
+ onClick?: (e: MouseEvent<HTMLInputElement, globalThis.MouseEvent>) => void;
129
129
  row: DataTableRow<ColTypes>;
130
130
  [key: string]: unknown;
131
131
  }) => {
@@ -381,7 +381,7 @@ declare class DataTable<RowType, ColTypes extends any[]> extends React.Component
381
381
  'aria-label': any;
382
382
  'aria-controls': string;
383
383
  isExpanded: boolean;
384
- onExpand: any;
384
+ onExpand: (event: React.MouseEvent<HTMLButtonElement, globalThis.MouseEvent>, ...args: any[]) => void;
385
385
  };
386
386
  /**
387
387
  * Decorate consumer's `onClick` event handler with sort parameters
@@ -413,7 +413,7 @@ declare class DataTable<RowType, ColTypes extends any[]> extends React.Component
413
413
  [key: string]: unknown;
414
414
  }) => {
415
415
  key: string;
416
- onExpand: any;
416
+ onExpand: (event: React.MouseEvent<HTMLButtonElement, globalThis.MouseEvent>, ...args: any[]) => void;
417
417
  isExpanded: boolean | undefined;
418
418
  'aria-label': any;
419
419
  'aria-controls': string;
@@ -437,19 +437,14 @@ declare class DataTable<RowType, ColTypes extends any[]> extends React.Component
437
437
  * Gets the props associated with selection for a header or a row, where
438
438
  * applicable. Most often used to indicate selection status of the table or
439
439
  * for a specific row.
440
- *
441
- * @param {object} [row] an optional row that we want to access the props for
442
- * @param {Function} row.onClick
443
- * @param {object} row.row
444
- * @returns {object}
445
440
  */
446
441
  getSelectionProps: ({ onClick, row, ...rest }?: {
447
442
  [key: string]: unknown;
448
- onClick?: (e: React.MouseEvent<HTMLButtonElement>) => void;
443
+ onClick?: (e: MouseEvent<HTMLInputElement, globalThis.MouseEvent>) => void;
449
444
  row: DataTableRow<ColTypes>;
450
445
  }) => {
451
446
  checked: boolean | undefined;
452
- onSelect: any;
447
+ onSelect: (event: React.MouseEvent<HTMLInputElement, globalThis.MouseEvent>, ...args: any[]) => void;
453
448
  id: string;
454
449
  name: string;
455
450
  'aria-label': any;
@@ -461,7 +456,7 @@ declare class DataTable<RowType, ColTypes extends any[]> extends React.Component
461
456
  id: string;
462
457
  indeterminate: boolean;
463
458
  name: string;
464
- onSelect: any;
459
+ onSelect: (event: React.MouseEvent<HTMLInputElement, globalThis.MouseEvent>, ...args: any[]) => void;
465
460
  };
466
461
  getToolbarProps: (props?: {}) => {
467
462
  size: "sm" | undefined;
@@ -233,11 +233,6 @@ class DataTable extends React__default.Component {
233
233
  * Gets the props associated with selection for a header or a row, where
234
234
  * applicable. Most often used to indicate selection status of the table or
235
235
  * for a specific row.
236
- *
237
- * @param {object} [row] an optional row that we want to access the props for
238
- * @param {Function} row.onClick
239
- * @param {object} row.row
240
- * @returns {object}
241
236
  */
242
237
  _defineProperty(this, "getSelectionProps", function () {
243
238
  let {
@@ -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 TableToolbarActionProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'onClick'> {
10
9
  /**
11
10
  * Pass in the children that will be rendered inside the TableToolbarAction
@@ -16,6 +15,5 @@ export interface TableToolbarActionProps extends Omit<React.HTMLAttributes<HTMLD
16
15
  */
17
16
  onClick: (event: React.MouseEvent<HTMLDivElement>) => void;
18
17
  }
19
- export type TableToolbarActionComponent = ForwardRefReturn<HTMLDivElement, TableToolbarActionProps>;
20
- declare const TableToolbarAction: TableToolbarActionComponent;
18
+ declare const TableToolbarAction: React.ForwardRefExoticComponent<TableToolbarActionProps & React.RefAttributes<HTMLDivElement>>;
21
19
  export default TableToolbarAction;
@@ -7,14 +7,15 @@
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 OverflowMenuItem from '../OverflowMenuItem/OverflowMenuItem.js';
12
12
 
13
- const TableToolbarAction = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
14
- let {
13
+ const frFn = forwardRef;
14
+ const TableToolbarAction = frFn((props, ref) => {
15
+ const {
15
16
  children,
16
17
  ...rest
17
- } = _ref;
18
+ } = props;
18
19
  return /*#__PURE__*/React__default.createElement(OverflowMenuItem, _extends({
19
20
  ref: ref,
20
21
  itemText: children
@@ -0,0 +1,42 @@
1
+ /**
2
+ * Copyright IBM Corp. 2016, 2025
3
+ *
4
+ * This source code is licensed under the Apache-2.0 license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+ import { type DataTableSortState } from '../state/sortStates';
8
+ /**
9
+ * Compare two values to determine their order. If both values have the same
10
+ * type, the default sort algorithm will be used for those types. Otherwise, the
11
+ * values will be converted to strings for comparison.
12
+ */
13
+ export declare const compare: (a: any, b: any, locale?: string) => number;
14
+ interface Cell {
15
+ id: string;
16
+ value: any;
17
+ }
18
+ interface SortRowParams {
19
+ key: string;
20
+ sortDirection: DataTableSortState;
21
+ sortStates: Record<DataTableSortState, DataTableSortState>;
22
+ locale: string;
23
+ compare: typeof compare;
24
+ rowIds: string[];
25
+ }
26
+ interface SortRowsConfig {
27
+ rowIds: string[];
28
+ cellsById: Record<string, Cell>;
29
+ key: string;
30
+ sortDirection: DataTableSortState;
31
+ locale?: string;
32
+ sortRow?: (cellA: any, cellB: any, params: SortRowParams) => number;
33
+ }
34
+ /**
35
+ * Sorts table rows based on the provided column key and direction.
36
+ */
37
+ export declare const sortRows: ({ rowIds, cellsById, sortDirection, key, locale, sortRow, }: SortRowsConfig) => string[];
38
+ /**
39
+ * Sorts table rows based on the sort direction.
40
+ */
41
+ export declare const defaultSortRow: (cellA: any, cellB: any, { sortDirection, sortStates, locale, }: Pick<SortRowParams, "locale" | "sortDirection" | "sortStates">) => number;
42
+ export {};