@carbon/react 1.90.0 → 1.91.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 +986 -926
- package/es/components/Breadcrumb/Breadcrumb.Skeleton.d.ts +27 -2
- package/es/components/Breadcrumb/Breadcrumb.Skeleton.js +27 -4
- package/es/components/Breadcrumb/Breadcrumb.js +2 -1
- package/es/components/CodeSnippet/CodeSnippet.d.ts +1 -1
- package/es/components/CodeSnippet/CodeSnippet.js +1 -1
- package/es/components/ComboBox/ComboBox.js +1 -12
- package/es/components/ComboButton/index.js +1 -1
- package/es/components/ComposedModal/ComposedModal.js +1 -1
- package/es/components/ContentSwitcher/ContentSwitcher.js +2 -2
- package/es/components/Copy/Copy.d.ts +1 -1
- package/es/components/Copy/Copy.js +1 -1
- package/es/components/CopyButton/CopyButton.d.ts +1 -1
- package/es/components/CopyButton/CopyButton.js +1 -1
- package/es/components/DataTable/DataTable.d.ts +60 -15
- package/es/components/DataTable/DataTable.js +106 -179
- package/es/components/DataTable/Table.d.ts +2 -2
- package/es/components/DataTable/Table.js +1 -1
- package/es/components/DataTable/TableExpandHeader.d.ts +1 -1
- package/es/components/DataTable/TableExpandHeader.js +1 -1
- package/es/components/DatePicker/DatePicker.d.ts +0 -12
- package/es/components/DatePicker/DatePicker.js +3 -3
- package/es/components/DatePicker/plugins/rangePlugin.d.ts +19 -2
- package/es/components/DatePicker/plugins/rangePlugin.js +18 -14
- package/es/components/Dropdown/Dropdown.js +1 -12
- package/es/components/FeatureFlags/index.js +1 -0
- package/es/components/IconButton/index.js +1 -1
- package/es/components/Menu/MenuItem.d.ts +1 -1
- package/es/components/Menu/MenuItem.js +5 -5
- package/es/components/Modal/Modal.js +1 -1
- package/es/components/MultiSelect/FilterableMultiSelect.js +1 -1
- package/es/components/MultiSelect/MultiSelect.js +1 -12
- package/es/components/Notification/Notification.d.ts +6 -6
- package/es/components/Notification/Notification.js +6 -6
- package/es/components/OverflowMenu/OverflowMenu.js +1 -1
- package/es/components/OverflowMenu/next/index.js +1 -1
- package/es/components/PaginationNav/PaginationNav.d.ts +20 -0
- package/es/components/PaginationNav/PaginationNav.js +34 -5
- package/es/components/Popover/index.js +1 -1
- package/es/components/Search/Search.d.ts +4 -2
- package/es/components/Search/Search.js +5 -4
- package/es/components/Slider/Slider.d.ts +144 -188
- package/es/components/Slider/Slider.js +787 -710
- package/es/components/Slider/index.d.ts +2 -2
- package/es/components/Tabs/Tabs.d.ts +4 -0
- package/es/components/TextArea/TextArea.js +13 -6
- package/es/components/TextInput/ControlledPasswordInput.js +2 -2
- package/es/components/TextInput/PasswordInput.js +2 -2
- package/es/components/TextInput/TextInput.js +2 -2
- package/es/components/TextInput/util.d.ts +17 -5
- package/es/components/TextInput/util.js +2 -7
- package/es/components/UIShell/HeaderPanel.d.ts +1 -1
- package/es/index.d.ts +27 -24
- package/es/index.js +43 -41
- package/es/internal/defaultItemToString.d.ts +7 -0
- package/es/internal/defaultItemToString.js +17 -0
- package/es/internal/index.d.ts +1 -0
- package/es/prop-types/deprecateValuesWithin.d.ts +8 -1
- package/es/prop-types/deprecateValuesWithin.js +6 -6
- package/es/prop-types/requiredIfGivenPropIsTruthy.d.ts +8 -7
- package/es/prop-types/requiredIfGivenPropIsTruthy.js +10 -10
- package/lib/components/Breadcrumb/Breadcrumb.Skeleton.d.ts +27 -2
- package/lib/components/Breadcrumb/Breadcrumb.Skeleton.js +27 -4
- package/lib/components/Breadcrumb/Breadcrumb.js +2 -1
- package/lib/components/CodeSnippet/CodeSnippet.d.ts +1 -1
- package/lib/components/CodeSnippet/CodeSnippet.js +1 -1
- package/lib/components/ComboBox/ComboBox.js +3 -14
- package/lib/components/ComboButton/index.js +1 -1
- package/lib/components/ComposedModal/ComposedModal.js +1 -1
- package/lib/components/ContentSwitcher/ContentSwitcher.js +1 -1
- package/lib/components/Copy/Copy.d.ts +1 -1
- package/lib/components/Copy/Copy.js +1 -1
- package/lib/components/CopyButton/CopyButton.d.ts +1 -1
- package/lib/components/CopyButton/CopyButton.js +1 -1
- package/lib/components/DataTable/DataTable.d.ts +60 -15
- package/lib/components/DataTable/DataTable.js +106 -179
- package/lib/components/DataTable/Table.d.ts +2 -2
- package/lib/components/DataTable/Table.js +1 -1
- package/lib/components/DataTable/TableExpandHeader.d.ts +1 -1
- package/lib/components/DataTable/TableExpandHeader.js +3 -3
- package/lib/components/DatePicker/DatePicker.d.ts +0 -12
- package/lib/components/DatePicker/DatePicker.js +2 -2
- package/lib/components/DatePicker/plugins/rangePlugin.d.ts +19 -2
- package/lib/components/DatePicker/plugins/rangePlugin.js +18 -16
- package/lib/components/Dropdown/Dropdown.js +3 -14
- package/lib/components/FeatureFlags/index.js +1 -0
- package/lib/components/IconButton/index.js +1 -1
- package/lib/components/Menu/MenuItem.d.ts +1 -1
- package/lib/components/Menu/MenuItem.js +6 -6
- package/lib/components/Modal/Modal.js +1 -1
- package/lib/components/MultiSelect/FilterableMultiSelect.js +8 -8
- package/lib/components/MultiSelect/MultiSelect.js +2 -13
- package/lib/components/Notification/Notification.d.ts +6 -6
- package/lib/components/Notification/Notification.js +6 -6
- package/lib/components/OverflowMenu/OverflowMenu.js +1 -1
- package/lib/components/OverflowMenu/next/index.js +1 -1
- package/lib/components/PaginationNav/PaginationNav.d.ts +20 -0
- package/lib/components/PaginationNav/PaginationNav.js +34 -5
- package/lib/components/Popover/index.js +1 -1
- package/lib/components/Search/Search.d.ts +4 -2
- package/lib/components/Search/Search.js +5 -4
- package/lib/components/Slider/Slider.d.ts +144 -188
- package/lib/components/Slider/Slider.js +784 -709
- package/lib/components/Slider/index.d.ts +2 -2
- package/lib/components/Tabs/Tabs.d.ts +4 -0
- package/lib/components/TextArea/TextArea.js +13 -6
- package/lib/components/TextInput/ControlledPasswordInput.js +1 -1
- package/lib/components/TextInput/PasswordInput.js +1 -1
- package/lib/components/TextInput/TextInput.js +1 -1
- package/lib/components/TextInput/util.d.ts +17 -5
- package/lib/components/TextInput/util.js +2 -7
- package/lib/components/UIShell/HeaderPanel.d.ts +1 -1
- package/lib/index.d.ts +27 -24
- package/lib/index.js +95 -28
- package/lib/internal/defaultItemToString.d.ts +7 -0
- package/lib/internal/defaultItemToString.js +19 -0
- package/lib/internal/index.d.ts +1 -0
- package/lib/prop-types/deprecateValuesWithin.d.ts +8 -1
- package/lib/prop-types/deprecateValuesWithin.js +6 -8
- package/lib/prop-types/requiredIfGivenPropIsTruthy.d.ts +8 -7
- package/lib/prop-types/requiredIfGivenPropIsTruthy.js +10 -12
- package/package.json +8 -7
- package/telemetry.yml +1 -2
- package/es/components/MultiSelect/tools/itemToString.d.ts +0 -1
- package/es/components/MultiSelect/tools/itemToString.js +0 -21
- package/es/components/Slider/index.js +0 -14
- package/es/internal/createClassWrapper.js +0 -23
- package/lib/components/MultiSelect/tools/itemToString.d.ts +0 -1
- package/lib/components/MultiSelect/tools/itemToString.js +0 -23
- package/lib/components/Slider/index.js +0 -20
- package/lib/internal/createClassWrapper.js +0 -25
|
@@ -1,5 +1,5 @@
|
|
|
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.
|
|
@@ -11,14 +11,39 @@ export interface BreadcrumbSkeletonProps extends React.HTMLAttributes<HTMLDivEle
|
|
|
11
11
|
* Specify an optional className to add.
|
|
12
12
|
*/
|
|
13
13
|
className?: string;
|
|
14
|
+
/**
|
|
15
|
+
* Specify the number of items
|
|
16
|
+
*/
|
|
17
|
+
items?: number;
|
|
18
|
+
/**
|
|
19
|
+
* Optional prop to omit the trailing slash for the breadcrumbs
|
|
20
|
+
*/
|
|
21
|
+
noTrailingSlash?: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Specify the size of the Breadcrumb. Currently
|
|
24
|
+
* supports the following: `sm` & `md` (default: 'md')
|
|
25
|
+
*/
|
|
26
|
+
size?: 'sm' | 'md';
|
|
14
27
|
}
|
|
15
|
-
declare function BreadcrumbSkeleton({ className, ...rest }: BreadcrumbSkeletonProps): import("react/jsx-runtime").JSX.Element;
|
|
28
|
+
declare function BreadcrumbSkeleton({ className, items, noTrailingSlash, size, ...rest }: BreadcrumbSkeletonProps): import("react/jsx-runtime").JSX.Element;
|
|
16
29
|
declare namespace BreadcrumbSkeleton {
|
|
17
30
|
var propTypes: {
|
|
18
31
|
/**
|
|
19
32
|
* Specify an optional className to add.
|
|
20
33
|
*/
|
|
21
34
|
className: PropTypes.Requireable<string>;
|
|
35
|
+
/**
|
|
36
|
+
* Specify the number of items
|
|
37
|
+
*/
|
|
38
|
+
items: PropTypes.Requireable<number>;
|
|
39
|
+
/**
|
|
40
|
+
* Optional prop to omit the trailing slash for the breadcrumbs
|
|
41
|
+
*/
|
|
42
|
+
noTrailingSlash: PropTypes.Requireable<boolean>;
|
|
43
|
+
/**
|
|
44
|
+
* Specify the size of the Breadcrumb. Currently supports the following: `sm` & `md` (default: 'md')
|
|
45
|
+
*/
|
|
46
|
+
size: PropTypes.Requireable<string>;
|
|
22
47
|
};
|
|
23
48
|
}
|
|
24
49
|
export default BreadcrumbSkeleton;
|
|
@@ -11,7 +11,6 @@ import React from 'react';
|
|
|
11
11
|
import cx from 'classnames';
|
|
12
12
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
13
13
|
|
|
14
|
-
var _Item, _Item2, _Item3;
|
|
15
14
|
function Item() {
|
|
16
15
|
const prefix = usePrefix();
|
|
17
16
|
return /*#__PURE__*/React.createElement("div", {
|
|
@@ -22,19 +21,43 @@ function Item() {
|
|
|
22
21
|
}
|
|
23
22
|
function BreadcrumbSkeleton({
|
|
24
23
|
className,
|
|
24
|
+
items = 3,
|
|
25
|
+
noTrailingSlash,
|
|
26
|
+
size,
|
|
25
27
|
...rest
|
|
26
28
|
}) {
|
|
27
29
|
const prefix = usePrefix();
|
|
28
|
-
const classes = cx(
|
|
30
|
+
const classes = cx({
|
|
31
|
+
[`${prefix}--breadcrumb`]: true,
|
|
32
|
+
[`${prefix}--skeleton`]: true,
|
|
33
|
+
[`${prefix}--breadcrumb--no-trailing-slash`]: noTrailingSlash,
|
|
34
|
+
[`${prefix}--breadcrumb--sm`]: size === 'sm'
|
|
35
|
+
}, className);
|
|
29
36
|
return /*#__PURE__*/React.createElement("div", _extends({
|
|
30
37
|
className: classes
|
|
31
|
-
}, rest),
|
|
38
|
+
}, rest), Array.from({
|
|
39
|
+
length: items
|
|
40
|
+
}, (_, i) => /*#__PURE__*/React.createElement(Item, {
|
|
41
|
+
key: i
|
|
42
|
+
})));
|
|
32
43
|
}
|
|
33
44
|
BreadcrumbSkeleton.propTypes = {
|
|
34
45
|
/**
|
|
35
46
|
* Specify an optional className to add.
|
|
36
47
|
*/
|
|
37
|
-
className: PropTypes.string
|
|
48
|
+
className: PropTypes.string,
|
|
49
|
+
/**
|
|
50
|
+
* Specify the number of items
|
|
51
|
+
*/
|
|
52
|
+
items: PropTypes.number,
|
|
53
|
+
/**
|
|
54
|
+
* Optional prop to omit the trailing slash for the breadcrumbs
|
|
55
|
+
*/
|
|
56
|
+
noTrailingSlash: PropTypes.bool,
|
|
57
|
+
/**
|
|
58
|
+
* Specify the size of the Breadcrumb. Currently supports the following: `sm` & `md` (default: 'md')
|
|
59
|
+
*/
|
|
60
|
+
size: PropTypes.oneOf(['sm', 'md'])
|
|
38
61
|
};
|
|
39
62
|
|
|
40
63
|
export { BreadcrumbSkeleton, BreadcrumbSkeleton as default };
|
|
@@ -53,7 +53,8 @@ Breadcrumb.propTypes = {
|
|
|
53
53
|
*/
|
|
54
54
|
noTrailingSlash: PropTypes.bool,
|
|
55
55
|
/**
|
|
56
|
-
* Specify the size of the Breadcrumb. Currently
|
|
56
|
+
* Specify the size of the Breadcrumb. Currently
|
|
57
|
+
* supports the following: `sm` & `md` (default: 'md')
|
|
57
58
|
*/
|
|
58
59
|
size: PropTypes.oneOf(['sm', 'md'])
|
|
59
60
|
};
|
|
@@ -111,7 +111,7 @@ declare namespace CodeSnippet {
|
|
|
111
111
|
/**
|
|
112
112
|
* Specify how the trigger should align with the tooltip
|
|
113
113
|
*/
|
|
114
|
-
align:
|
|
114
|
+
align: PropTypes.Requireable<string> | PropTypes.Validator<string>;
|
|
115
115
|
/**
|
|
116
116
|
* Specify a label to be read by screen readers on the containing textbox
|
|
117
117
|
* node
|
|
@@ -19,7 +19,7 @@ import { useId } from '../../internal/useId.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
|
-
import deprecateValuesWithin from '../../prop-types/deprecateValuesWithin.js';
|
|
22
|
+
import { deprecateValuesWithin } from '../../prop-types/deprecateValuesWithin.js';
|
|
23
23
|
import { mapPopoverAlign } from '../../tools/mapPopoverAlign.js';
|
|
24
24
|
|
|
25
25
|
const rowHeightInPixels = 16;
|
|
@@ -27,6 +27,7 @@ import { FormContext } from '../FluidForm/FormContext.js';
|
|
|
27
27
|
import { useFloating, autoUpdate, flip, hide } from '@floating-ui/react';
|
|
28
28
|
import { useFeatureFlag } from '../FeatureFlags/index.js';
|
|
29
29
|
import { AILabel } from '../AILabel/index.js';
|
|
30
|
+
import { defaultItemToString } from '../../internal/defaultItemToString.js';
|
|
30
31
|
import { isComponentElement } from '../../internal/utils.js';
|
|
31
32
|
import { ListBoxSizePropType } from '../ListBox/ListBoxPropTypes.js';
|
|
32
33
|
import { Text } from '../Text/Text.js';
|
|
@@ -43,18 +44,6 @@ const {
|
|
|
43
44
|
ItemClick,
|
|
44
45
|
FunctionSelectItem
|
|
45
46
|
} = useCombobox.stateChangeTypes;
|
|
46
|
-
const defaultItemToString = item => {
|
|
47
|
-
if (typeof item === 'string') {
|
|
48
|
-
return item;
|
|
49
|
-
}
|
|
50
|
-
if (typeof item === 'number') {
|
|
51
|
-
return `${item}`;
|
|
52
|
-
}
|
|
53
|
-
if (item !== null && typeof item === 'object' && 'label' in item && typeof item['label'] === 'string') {
|
|
54
|
-
return item['label'];
|
|
55
|
-
}
|
|
56
|
-
return '';
|
|
57
|
-
};
|
|
58
47
|
const defaultShouldFilterItem = () => true;
|
|
59
48
|
const autocompleteCustomFilter = ({
|
|
60
49
|
item,
|
|
@@ -21,7 +21,7 @@ import { usePrefix } from '../../internal/usePrefix.js';
|
|
|
21
21
|
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
|
-
import deprecateValuesWithin from '../../prop-types/deprecateValuesWithin.js';
|
|
24
|
+
import { deprecateValuesWithin } from '../../prop-types/deprecateValuesWithin.js';
|
|
25
25
|
import { mapPopoverAlign } from '../../tools/mapPopoverAlign.js';
|
|
26
26
|
|
|
27
27
|
var _ChevronDown;
|
|
@@ -16,7 +16,7 @@ import useIsomorphicEffect from '../../internal/useIsomorphicEffect.js';
|
|
|
16
16
|
import mergeRefs from '../../tools/mergeRefs.js';
|
|
17
17
|
import cx from 'classnames';
|
|
18
18
|
import { toggleClass } from '../../tools/toggleClass.js';
|
|
19
|
-
import requiredIfGivenPropIsTruthy from '../../prop-types/requiredIfGivenPropIsTruthy.js';
|
|
19
|
+
import { requiredIfGivenPropIsTruthy } from '../../prop-types/requiredIfGivenPropIsTruthy.js';
|
|
20
20
|
import { wrapFocusWithoutSentinels, wrapFocus, elementOrParentIsFloatingMenu } from '../../internal/wrapFocus.js';
|
|
21
21
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
22
22
|
import { Escape, Tab } from '../../internal/keyboard/keys.js';
|
|
@@ -12,7 +12,7 @@ import cx from 'classnames';
|
|
|
12
12
|
import { deprecate } from '../../prop-types/deprecate.js';
|
|
13
13
|
import { LayoutConstraint } from '../Layout/index.js';
|
|
14
14
|
import { composeEventHandlers } from '../../tools/events.js';
|
|
15
|
-
import { ArrowRight, ArrowLeft } from '../../internal/keyboard/keys.js';
|
|
15
|
+
import { ArrowRight, ArrowLeft, Enter, Space } from '../../internal/keyboard/keys.js';
|
|
16
16
|
import { matches } from '../../internal/keyboard/match.js';
|
|
17
17
|
import { getNextIndex } from '../../internal/keyboard/navigation.js';
|
|
18
18
|
import { PrefixContext } from '../../internal/usePrefix.js';
|
|
@@ -75,7 +75,7 @@ const ContentSwitcher = ({
|
|
|
75
75
|
});
|
|
76
76
|
}
|
|
77
77
|
}
|
|
78
|
-
} else if (selectedIndex !== index) {
|
|
78
|
+
} else if (selectedIndex !== index && (isKeyboardEvent(event) ? matches(event, [Enter, Space]) : true)) {
|
|
79
79
|
setSelectedIndex(index);
|
|
80
80
|
focusSwitch(index);
|
|
81
81
|
onChange(event);
|
|
@@ -50,7 +50,7 @@ declare namespace Copy {
|
|
|
50
50
|
/**
|
|
51
51
|
* Specify how the trigger should align with the tooltip
|
|
52
52
|
*/
|
|
53
|
-
align:
|
|
53
|
+
align: PropTypes.Requireable<string> | PropTypes.Validator<string>;
|
|
54
54
|
/**
|
|
55
55
|
* **Experimental**: Will attempt to automatically align the tooltip. Requires
|
|
56
56
|
* React v17+
|
|
@@ -13,7 +13,7 @@ import { composeEventHandlers } from '../../tools/events.js';
|
|
|
13
13
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
14
14
|
import { IconButton } from '../IconButton/index.js';
|
|
15
15
|
import { noopFn } from '../../internal/noopFn.js';
|
|
16
|
-
import deprecateValuesWithin from '../../prop-types/deprecateValuesWithin.js';
|
|
16
|
+
import { deprecateValuesWithin } from '../../prop-types/deprecateValuesWithin.js';
|
|
17
17
|
import { mapPopoverAlign } from '../../tools/mapPopoverAlign.js';
|
|
18
18
|
import { debounce } from '../../node_modules/es-toolkit/dist/compat/function/debounce.js';
|
|
19
19
|
|
|
@@ -51,7 +51,7 @@ declare namespace CopyButton {
|
|
|
51
51
|
/**
|
|
52
52
|
* Specify how the trigger should align with the tooltip
|
|
53
53
|
*/
|
|
54
|
-
align:
|
|
54
|
+
align: PropTypes.Requireable<string> | PropTypes.Validator<string>;
|
|
55
55
|
/**
|
|
56
56
|
* **Experimental**: Will attempt to automatically align the tooltip. Requires
|
|
57
57
|
* React v17+
|
|
@@ -14,7 +14,7 @@ import Copy from '../Copy/Copy.js';
|
|
|
14
14
|
import { LayoutConstraint } from '../Layout/index.js';
|
|
15
15
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
16
16
|
import { noopFn } from '../../internal/noopFn.js';
|
|
17
|
-
import deprecateValuesWithin from '../../prop-types/deprecateValuesWithin.js';
|
|
17
|
+
import { deprecateValuesWithin } from '../../prop-types/deprecateValuesWithin.js';
|
|
18
18
|
import { mapPopoverAlign } from '../../tools/mapPopoverAlign.js';
|
|
19
19
|
|
|
20
20
|
function CopyButton({
|
|
@@ -20,7 +20,7 @@ declare const translationKeys: {
|
|
|
20
20
|
readonly unselectRow: "carbon.table.row.unselect";
|
|
21
21
|
};
|
|
22
22
|
/**
|
|
23
|
-
* Message
|
|
23
|
+
* Message IDs that will be passed to translateWithId().
|
|
24
24
|
*/
|
|
25
25
|
type TranslationKey = (typeof translationKeys)[keyof typeof translationKeys];
|
|
26
26
|
export type DataTableSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
@@ -35,7 +35,6 @@ export interface DataTableCell<T> {
|
|
|
35
35
|
header: string;
|
|
36
36
|
};
|
|
37
37
|
hasAILabelHeader?: boolean;
|
|
38
|
-
hasDecoratorHeader?: boolean;
|
|
39
38
|
}
|
|
40
39
|
type DataTableCells<T extends any[]> = {
|
|
41
40
|
[K in keyof T]: DataTableCell<T[K]>;
|
|
@@ -54,8 +53,17 @@ export interface DataTableHeader {
|
|
|
54
53
|
decorator?: ReactElement;
|
|
55
54
|
}
|
|
56
55
|
export interface DataTableRenderProps<RowType, ColTypes extends any[]> {
|
|
56
|
+
/**
|
|
57
|
+
* The headers for the table.
|
|
58
|
+
*/
|
|
57
59
|
headers: DataTableHeader[];
|
|
60
|
+
/**
|
|
61
|
+
* The rows for the table.
|
|
62
|
+
*/
|
|
58
63
|
rows: (DataTableRow<ColTypes> & RowType)[];
|
|
64
|
+
/**
|
|
65
|
+
* The rows that are currently selected.
|
|
66
|
+
*/
|
|
59
67
|
selectedRows: (DataTableRow<ColTypes> & RowType)[];
|
|
60
68
|
getHeaderProps: (options: {
|
|
61
69
|
header: DataTableHeader;
|
|
@@ -154,14 +162,36 @@ export interface DataTableRenderProps<RowType, ColTypes extends any[]> {
|
|
|
154
162
|
}) => {
|
|
155
163
|
[key: string]: unknown;
|
|
156
164
|
hasAILabelHeader?: boolean;
|
|
157
|
-
|
|
165
|
+
key: string;
|
|
158
166
|
};
|
|
167
|
+
/**
|
|
168
|
+
* Handles input value changes.
|
|
169
|
+
*/
|
|
159
170
|
onInputChange: (event: ChangeEvent<HTMLInputElement>, defaultValue?: string) => void;
|
|
171
|
+
/**
|
|
172
|
+
* Sorts the table by a specific header.
|
|
173
|
+
*/
|
|
160
174
|
sortBy: (headerKey: string) => void;
|
|
175
|
+
/**
|
|
176
|
+
* Selects all rows.
|
|
177
|
+
*/
|
|
161
178
|
selectAll: () => void;
|
|
179
|
+
/**
|
|
180
|
+
* Selects or deselects a specific row.
|
|
181
|
+
*/
|
|
162
182
|
selectRow: (rowId: string) => void;
|
|
183
|
+
/**
|
|
184
|
+
* Expands or collapses a specific row.
|
|
185
|
+
*/
|
|
163
186
|
expandRow: (rowId: string) => void;
|
|
187
|
+
/**
|
|
188
|
+
* Expands or collapses all rows.
|
|
189
|
+
*/
|
|
164
190
|
expandAll: () => void;
|
|
191
|
+
/**
|
|
192
|
+
* Whether the table is using radio buttons for selection instead of
|
|
193
|
+
* checkboxes.
|
|
194
|
+
*/
|
|
165
195
|
radio: boolean | undefined;
|
|
166
196
|
}
|
|
167
197
|
export interface DataTableProps<RowType, ColTypes extends any[]> extends TranslateWithId<TranslationKey> {
|
|
@@ -179,6 +209,12 @@ export interface DataTableProps<RowType, ColTypes extends any[]> extends Transla
|
|
|
179
209
|
locale?: string;
|
|
180
210
|
overflowMenuOnHover?: boolean;
|
|
181
211
|
radio?: boolean;
|
|
212
|
+
/**
|
|
213
|
+
* @deprecated Use `children` instead. This prop will be removed in
|
|
214
|
+
* the next major version.
|
|
215
|
+
*
|
|
216
|
+
* https://www.patterns.dev/react/render-props-pattern/#children-as-a-function
|
|
217
|
+
*/
|
|
182
218
|
render?: (renderProps: DataTableRenderProps<RowType, ColTypes>) => ReactElement;
|
|
183
219
|
rows: Omit<DataTableRow<ColTypes>, 'cells'>[];
|
|
184
220
|
size?: DataTableSize;
|
|
@@ -188,14 +224,12 @@ export interface DataTableProps<RowType, ColTypes extends any[]> extends Transla
|
|
|
188
224
|
useZebraStyles?: boolean;
|
|
189
225
|
}
|
|
190
226
|
/**
|
|
191
|
-
*
|
|
192
|
-
* subset of their fields in columns, or headers. We prioritize
|
|
193
|
-
* to the state of what we're rendering, so internally we
|
|
194
|
-
* given data and then
|
|
195
|
-
*
|
|
196
|
-
*
|
|
197
|
-
* and updating the state of the single entity will cascade updates to the
|
|
198
|
-
* consumer.
|
|
227
|
+
* DataTable components are used to represent a collection of resources,
|
|
228
|
+
* displaying a subset of their fields in columns, or headers. We prioritize
|
|
229
|
+
* direct updates to the state of what we're rendering, so internally we
|
|
230
|
+
* normalize the given data and then denormalize it at render time. Each part of
|
|
231
|
+
* the DataTable is accessible through look-up by ID, and updating the state of
|
|
232
|
+
* a single entity cascades updates to the consumer.
|
|
199
233
|
*/
|
|
200
234
|
export declare const DataTable: {
|
|
201
235
|
<RowType, ColTypes extends any[]>(props: DataTableProps<RowType, ColTypes>): React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | null;
|
|
@@ -266,7 +300,7 @@ export declare const DataTable: {
|
|
|
266
300
|
enableToggle: PropTypes.Requireable<boolean>;
|
|
267
301
|
expandIconDescription: PropTypes.Requireable<string>;
|
|
268
302
|
id: PropTypes.Requireable<string>;
|
|
269
|
-
isExpanded:
|
|
303
|
+
isExpanded: PropTypes.Validator<boolean | null | undefined>;
|
|
270
304
|
onExpand: PropTypes.Requireable<any>;
|
|
271
305
|
};
|
|
272
306
|
};
|
|
@@ -348,6 +382,10 @@ export declare const DataTable: {
|
|
|
348
382
|
};
|
|
349
383
|
TableToolbarMenu: React.FC<import("./TableToolbarMenu").TableToolbarMenuProps>;
|
|
350
384
|
propTypes: {
|
|
385
|
+
/**
|
|
386
|
+
* Pass in the children that will be rendered within the Table
|
|
387
|
+
*/
|
|
388
|
+
children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
351
389
|
/**
|
|
352
390
|
* Experimental property. Allows table to align cell contents to the top if there is text wrapping in the content. Might have performance issues, intended for smaller tables
|
|
353
391
|
*/
|
|
@@ -383,6 +421,13 @@ export declare const DataTable: {
|
|
|
383
421
|
* Specify whether the control should be a radio button or inline checkbox
|
|
384
422
|
*/
|
|
385
423
|
radio: PropTypes.Requireable<boolean>;
|
|
424
|
+
/**
|
|
425
|
+
* @deprecated Use `children` instead. This prop will be removed in
|
|
426
|
+
* the next major version.
|
|
427
|
+
*
|
|
428
|
+
* https://www.patterns.dev/react/render-props-pattern/#children-as-a-function
|
|
429
|
+
*/
|
|
430
|
+
render: (props: Record<string, any>, propName: string, componentName: string, ...rest: any[]) => any;
|
|
386
431
|
/**
|
|
387
432
|
* The `rows` prop is where you provide us with a list of all the rows that
|
|
388
433
|
* you want to render in the table. The only hard requirement is that this
|
|
@@ -409,13 +454,13 @@ export declare const DataTable: {
|
|
|
409
454
|
*/
|
|
410
455
|
stickyHeader: PropTypes.Requireable<boolean>;
|
|
411
456
|
/**
|
|
412
|
-
* Optional method that takes in a message
|
|
457
|
+
* Optional method that takes in a message ID and returns an
|
|
413
458
|
* internationalized string. See `DataTable.translationKeys` for all
|
|
414
|
-
* available message
|
|
459
|
+
* available message IDs.
|
|
415
460
|
*/
|
|
416
461
|
translateWithId: PropTypes.Requireable<(...args: any[]) => any>;
|
|
417
462
|
/**
|
|
418
|
-
*
|
|
463
|
+
* If `true`, sets the table width to `auto` instead of `100%`.
|
|
419
464
|
*/
|
|
420
465
|
useStaticWidth: PropTypes.Requireable<boolean>;
|
|
421
466
|
/**
|