@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.
- package/.playwright/INTERNAL_AVT_REPORT_DO_NOT_USE.json +892 -892
- package/es/components/AILabel/index.d.ts +1 -1
- package/es/components/AILabel/index.js +2 -9
- package/es/components/Breadcrumb/Breadcrumb.d.ts +2 -3
- package/es/components/Breadcrumb/Breadcrumb.js +4 -4
- package/es/components/Breadcrumb/BreadcrumbItem.d.ts +3 -4
- package/es/components/Breadcrumb/BreadcrumbItem.js +5 -4
- package/es/components/Button/Button.js +2 -10
- package/es/components/ButtonSet/ButtonSet.d.ts +2 -3
- package/es/components/ButtonSet/ButtonSet.js +4 -4
- package/es/components/CodeSnippet/CodeSnippet.d.ts +1 -1
- package/es/components/CodeSnippet/CodeSnippet.js +3 -19
- package/es/components/ComboBox/ComboBox.d.ts +1 -1
- package/es/components/ComboBox/ComboBox.js +2 -2
- package/es/components/ComboButton/index.d.ts +1 -1
- package/es/components/ComboButton/index.js +2 -18
- package/es/components/ComposedModal/ComposedModal.js +5 -3
- package/es/components/Copy/Copy.d.ts +1 -1
- package/es/components/Copy/Copy.js +2 -18
- package/es/components/CopyButton/CopyButton.d.ts +1 -1
- package/es/components/CopyButton/CopyButton.js +2 -18
- package/es/components/DataTable/DataTable.d.ts +7 -12
- package/es/components/DataTable/DataTable.js +0 -5
- package/es/components/DataTable/TableToolbarAction.d.ts +2 -4
- package/es/components/DataTable/TableToolbarAction.js +5 -4
- package/es/components/DataTable/tools/sorting.d.ts +42 -0
- package/es/components/DataTable/tools/sorting.js +24 -53
- package/es/components/DatePicker/DatePicker.d.ts +1 -1
- package/es/components/DatePicker/DatePicker.js +18 -18
- package/es/components/Dialog/index.d.ts +1 -1
- package/es/components/Dropdown/Dropdown.Skeleton.d.ts +2 -2
- package/es/components/Dropdown/Dropdown.Skeleton.js +2 -2
- package/es/components/Dropdown/Dropdown.d.ts +7 -6
- package/es/components/Dropdown/Dropdown.js +7 -3
- package/es/components/FileUploader/FileUploaderButton.d.ts +1 -1
- package/es/components/FileUploader/FileUploaderButton.js +1 -1
- package/es/components/FileUploader/FileUploaderDropContainer.js +1 -1
- package/es/components/FileUploader/FileUploaderItem.js +1 -1
- package/es/components/FluidDropdown/FluidDropdown.d.ts +1 -1
- package/es/components/FluidSearch/FluidSearch.d.ts +3 -6
- package/es/components/IconButton/index.d.ts +1 -1
- package/es/components/IconButton/index.js +2 -18
- package/es/components/ListBox/ListBox.d.ts +4 -5
- package/es/components/ListBox/ListBox.js +8 -7
- package/es/components/ListBox/ListBoxMenu.d.ts +4 -4
- package/es/components/ListBox/ListBoxMenu.js +4 -2
- package/es/components/ListBox/ListBoxMenuItem.d.ts +9 -8
- package/es/components/ListBox/ListBoxPropTypes.d.ts +3 -3
- package/es/components/ListBox/ListBoxPropTypes.js +3 -3
- package/es/components/ListBox/index.d.ts +7 -5
- package/es/components/ListBox/index.js +1 -1
- package/es/components/Menu/Menu.js +5 -0
- package/es/components/Modal/Modal.js +9 -9
- package/es/components/MultiSelect/FilterableMultiSelect.d.ts +3 -2
- package/es/components/MultiSelect/FilterableMultiSelect.js +3 -2
- package/es/components/MultiSelect/MultiSelect.d.ts +8 -2
- package/es/components/MultiSelect/MultiSelect.js +3 -3
- package/es/components/Notification/Notification.js +1 -1
- package/es/components/OverflowMenu/OverflowMenu.js +2 -21
- package/es/components/OverflowMenu/next/index.js +2 -18
- package/es/components/OverflowMenuItem/OverflowMenuItem.d.ts +2 -4
- package/es/components/OverflowMenuItem/OverflowMenuItem.js +5 -4
- package/es/components/PageHeader/PageHeader.d.ts +153 -8
- package/es/components/PageHeader/PageHeader.js +143 -21
- package/es/components/PageHeader/index.d.ts +2 -2
- package/es/components/PageHeader/index.js +1 -1
- package/es/components/Popover/index.js +4 -21
- package/es/components/Search/Search.d.ts +2 -5
- package/es/components/Search/Search.js +24 -8
- package/es/components/Stack/HStack.d.ts +2 -3
- package/es/components/Stack/HStack.js +4 -7
- package/es/components/Stack/Stack.d.ts +3 -4
- package/es/components/Stack/Stack.js +3 -6
- package/es/components/Stack/VStack.d.ts +2 -3
- package/es/components/Stack/VStack.js +3 -2
- package/es/components/Stack/index.d.ts +4 -4
- package/es/components/TextArea/TextArea.js +3 -5
- package/es/components/TimePicker/TimePicker.d.ts +3 -4
- package/es/components/TimePicker/TimePicker.js +5 -4
- package/es/components/TimePickerSelect/TimePickerSelect.d.ts +23 -4
- package/es/components/TimePickerSelect/TimePickerSelect.js +5 -4
- package/es/components/TreeView/TreeNode.js +13 -1
- package/es/components/TreeView/TreeView.js +1 -1
- package/es/index.js +1 -1
- package/es/internal/FloatingMenu.js +9 -5
- package/es/internal/environment.js +7 -0
- package/es/internal/keyboard/navigation.d.ts +0 -10
- package/es/internal/keyboard/navigation.js +1 -13
- package/es/internal/useId.js +1 -1
- package/es/internal/useNoInteractiveChildren.js +7 -0
- package/es/internal/useOutsideClick.js +3 -0
- package/es/internal/wrapFocus.d.ts +49 -0
- package/es/internal/wrapFocus.js +64 -51
- package/es/tools/events.d.ts +17 -0
- package/es/tools/events.js +10 -13
- package/es/tools/mapPopoverAlign.d.ts +15 -0
- package/es/tools/mapPopoverAlign.js +28 -0
- package/es/tools/uniqueId.d.ts +7 -0
- package/es/tools/uniqueId.js +3 -3
- package/es/types/common.d.ts +0 -2
- package/lib/components/AILabel/index.d.ts +1 -1
- package/lib/components/AILabel/index.js +2 -9
- package/lib/components/Breadcrumb/Breadcrumb.d.ts +2 -3
- package/lib/components/Breadcrumb/Breadcrumb.js +3 -3
- package/lib/components/Breadcrumb/BreadcrumbItem.d.ts +3 -4
- package/lib/components/Breadcrumb/BreadcrumbItem.js +4 -3
- package/lib/components/Button/Button.js +1 -9
- package/lib/components/ButtonSet/ButtonSet.d.ts +2 -3
- package/lib/components/ButtonSet/ButtonSet.js +3 -3
- package/lib/components/CodeSnippet/CodeSnippet.d.ts +1 -1
- package/lib/components/CodeSnippet/CodeSnippet.js +3 -19
- package/lib/components/ComboBox/ComboBox.d.ts +1 -1
- package/lib/components/ComboBox/ComboBox.js +1 -1
- package/lib/components/ComboButton/index.d.ts +1 -1
- package/lib/components/ComboButton/index.js +2 -18
- package/lib/components/ComposedModal/ComposedModal.js +5 -3
- package/lib/components/Copy/Copy.d.ts +1 -1
- package/lib/components/Copy/Copy.js +2 -18
- package/lib/components/CopyButton/CopyButton.d.ts +1 -1
- package/lib/components/CopyButton/CopyButton.js +2 -18
- package/lib/components/DataTable/DataTable.d.ts +7 -12
- package/lib/components/DataTable/DataTable.js +0 -5
- package/lib/components/DataTable/TableToolbarAction.d.ts +2 -4
- package/lib/components/DataTable/TableToolbarAction.js +4 -3
- package/lib/components/DataTable/tools/sorting.d.ts +42 -0
- package/lib/components/DataTable/tools/sorting.js +23 -53
- package/lib/components/DatePicker/DatePicker.d.ts +1 -1
- package/lib/components/DatePicker/DatePicker.js +18 -18
- package/lib/components/Dialog/index.d.ts +1 -1
- package/lib/components/Dropdown/Dropdown.Skeleton.d.ts +2 -2
- package/lib/components/Dropdown/Dropdown.Skeleton.js +1 -1
- package/lib/components/Dropdown/Dropdown.d.ts +7 -6
- package/lib/components/Dropdown/Dropdown.js +6 -2
- package/lib/components/FileUploader/FileUploaderButton.d.ts +1 -1
- package/lib/components/FileUploader/FileUploaderButton.js +1 -1
- package/lib/components/FileUploader/FileUploaderDropContainer.js +1 -1
- package/lib/components/FileUploader/FileUploaderItem.js +1 -1
- package/lib/components/FluidDropdown/FluidDropdown.d.ts +1 -1
- package/lib/components/FluidSearch/FluidSearch.d.ts +3 -6
- package/lib/components/IconButton/index.d.ts +1 -1
- package/lib/components/IconButton/index.js +2 -18
- package/lib/components/ListBox/ListBox.d.ts +4 -5
- package/lib/components/ListBox/ListBox.js +7 -6
- package/lib/components/ListBox/ListBoxMenu.d.ts +4 -4
- package/lib/components/ListBox/ListBoxMenu.js +3 -1
- package/lib/components/ListBox/ListBoxMenuItem.d.ts +9 -8
- package/lib/components/ListBox/ListBoxPropTypes.d.ts +3 -3
- package/lib/components/ListBox/ListBoxPropTypes.js +4 -4
- package/lib/components/ListBox/index.d.ts +7 -5
- package/lib/components/ListBox/index.js +2 -2
- package/lib/components/Menu/Menu.js +5 -0
- package/lib/components/Modal/Modal.js +9 -9
- package/lib/components/MultiSelect/FilterableMultiSelect.d.ts +3 -2
- package/lib/components/MultiSelect/FilterableMultiSelect.js +2 -1
- package/lib/components/MultiSelect/MultiSelect.d.ts +8 -2
- package/lib/components/MultiSelect/MultiSelect.js +2 -2
- package/lib/components/Notification/Notification.js +1 -1
- package/lib/components/OverflowMenu/OverflowMenu.js +2 -21
- package/lib/components/OverflowMenu/next/index.js +2 -18
- package/lib/components/OverflowMenuItem/OverflowMenuItem.d.ts +2 -4
- package/lib/components/OverflowMenuItem/OverflowMenuItem.js +4 -3
- package/lib/components/PageHeader/PageHeader.d.ts +153 -8
- package/lib/components/PageHeader/PageHeader.js +145 -19
- package/lib/components/PageHeader/index.d.ts +2 -2
- package/lib/components/PageHeader/index.js +4 -0
- package/lib/components/Popover/index.js +4 -21
- package/lib/components/Search/Search.d.ts +2 -5
- package/lib/components/Search/Search.js +24 -8
- package/lib/components/Stack/HStack.d.ts +2 -3
- package/lib/components/Stack/HStack.js +3 -6
- package/lib/components/Stack/Stack.d.ts +3 -4
- package/lib/components/Stack/Stack.js +2 -5
- package/lib/components/Stack/VStack.d.ts +2 -3
- package/lib/components/Stack/VStack.js +2 -1
- package/lib/components/Stack/index.d.ts +4 -4
- package/lib/components/TextArea/TextArea.js +2 -4
- package/lib/components/TimePicker/TimePicker.d.ts +3 -4
- package/lib/components/TimePicker/TimePicker.js +4 -3
- package/lib/components/TimePickerSelect/TimePickerSelect.d.ts +23 -4
- package/lib/components/TimePickerSelect/TimePickerSelect.js +4 -3
- package/lib/components/TreeView/TreeNode.js +13 -1
- package/lib/components/TreeView/TreeView.js +1 -1
- package/lib/index.js +2 -2
- package/lib/internal/FloatingMenu.js +9 -5
- package/lib/internal/environment.js +7 -0
- package/lib/internal/keyboard/navigation.d.ts +0 -10
- package/lib/internal/keyboard/navigation.js +0 -14
- package/lib/internal/useNoInteractiveChildren.js +7 -0
- package/lib/internal/useOutsideClick.js +3 -0
- package/lib/internal/wrapFocus.d.ts +49 -0
- package/lib/internal/wrapFocus.js +66 -53
- package/lib/tools/events.d.ts +17 -0
- package/lib/tools/events.js +10 -13
- package/lib/tools/mapPopoverAlign.d.ts +15 -0
- package/lib/tools/mapPopoverAlign.js +32 -0
- package/lib/tools/uniqueId.d.ts +7 -0
- package/lib/tools/uniqueId.js +3 -3
- package/lib/types/common.d.ts +0 -2
- package/package.json +7 -7
- package/telemetry.yml +3 -1
- package/es/tools/createPropAdapter.js +0 -40
- package/lib/tools/createPropAdapter.js +0 -44
|
@@ -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 {
|
|
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,
|
|
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:
|
|
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__*/
|
|
15
|
-
|
|
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
|
-
} =
|
|
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,
|
|
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:
|
|
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
|
|
19
|
-
|
|
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
|
-
} =
|
|
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
|
|
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:
|
|
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,
|
|
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:
|
|
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__*/
|
|
15
|
-
|
|
14
|
+
const ButtonSet = /*#__PURE__*/forwardRef((props, ref) => {
|
|
15
|
+
const {
|
|
16
16
|
children,
|
|
17
17
|
className,
|
|
18
18
|
stacked,
|
|
19
19
|
...rest
|
|
20
|
-
} =
|
|
20
|
+
} = props;
|
|
21
21
|
const prefix = usePrefix();
|
|
22
22
|
const buttonSetClasses = cx(className, `${prefix}--btn-set`, {
|
|
23
23
|
[`${prefix}--btn-set--stacked`]: stacked
|
|
@@ -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 {
|
|
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:
|
|
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
|
|
@@ -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
|
|
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
|
|
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
|
}
|
|
@@ -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
|
*/
|
|
@@ -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:
|
|
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:
|
|
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,
|
|
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
|
-
|
|
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
|
|
14
|
-
|
|
13
|
+
const frFn = forwardRef;
|
|
14
|
+
const TableToolbarAction = frFn((props, ref) => {
|
|
15
|
+
const {
|
|
15
16
|
children,
|
|
16
17
|
...rest
|
|
17
|
-
} =
|
|
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 {};
|