@carbon/react 1.24.0 → 1.26.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/es/components/Button/Button.js +2 -2
- package/es/components/CodeSnippet/CodeSnippet.js +13 -115
- package/es/components/ComboBox/ComboBox.d.ts +6 -0
- package/es/components/ComboBox/ComboBox.js +19 -172
- package/es/components/ComboButton/index.js +164 -0
- package/es/components/ComposedModal/ComposedModal.js +1 -2
- package/es/components/DataTable/Table.d.ts +74 -0
- package/es/components/DataTable/Table.js +4 -2
- package/es/components/DataTable/TableCell.d.ts +10 -0
- package/es/components/DataTable/TableContext.d.ts +13 -0
- package/es/components/DataTable/TableContext.js +2 -2
- package/es/components/DataTable/TableExpandRow.d.ts +67 -0
- package/es/components/DataTable/TableExpandedRow.d.ts +32 -0
- package/es/components/DataTable/TableHead.d.ts +10 -0
- package/es/components/DataTable/TableHeader.d.ts +64 -0
- package/es/components/DataTable/TableHeader.js +23 -28
- package/es/components/DataTable/TableRow.d.ts +32 -0
- package/es/components/DataTable/TableSelectAll.js +1 -1
- package/es/components/DataTable/TableSelectRow.js +1 -3
- package/es/components/DataTable/TableToolbar.d.ts +19 -0
- package/es/components/DataTable/TableToolbar.js +1 -1
- package/es/components/DataTable/TableToolbarAction.d.ts +21 -0
- package/es/components/DataTable/TableToolbarContent.d.ts +19 -0
- package/es/components/DataTable/TableToolbarMenu.d.ts +24 -0
- package/es/components/DataTable/TableToolbarMenu.js +3 -3
- package/es/components/DataTable/TableToolbarSearch.js +1 -0
- package/es/components/DataTable/tools/sorting.js +2 -1
- package/es/components/DataTableSkeleton/DataTableSkeleton.d.ts +107 -0
- package/es/components/Dropdown/Dropdown.d.ts +6 -0
- package/es/components/Dropdown/Dropdown.js +8 -145
- package/es/components/ExpandableSearch/ExpandableSearch.js +1 -0
- package/es/components/FileUploader/FileUploader.js +1 -1
- package/es/components/FileUploader/FileUploaderButton.js +2 -0
- package/es/components/FileUploader/FileUploaderDropContainer.js +30 -18
- package/es/components/FileUploader/FileUploaderItem.js +2 -1
- package/es/components/FileUploader/Filename.js +8 -2
- package/es/components/FluidTextArea/FluidTextArea.js +12 -1
- package/es/components/IconButton/index.js +1 -0
- package/es/components/InlineCheckbox/InlineCheckbox.js +7 -53
- package/es/components/ListBox/ListBoxSelection.js +4 -23
- package/es/components/ListBox/next/ListBoxSelection.js +2 -23
- package/es/components/Menu/Menu.js +50 -29
- package/es/components/Menu/MenuItem.js +1 -0
- package/es/components/MenuButton/index.js +127 -0
- package/es/components/Modal/Modal.js +4 -3
- package/es/components/MultiSelect/FilterableMultiSelect.js +46 -144
- package/es/components/MultiSelect/MultiSelect.d.ts +1 -1
- package/es/components/MultiSelect/MultiSelect.js +48 -28
- package/es/components/Notification/Notification.js +27 -264
- package/es/components/NumberInput/NumberInput.js +9 -1
- package/es/components/OverflowMenu/OverflowMenu.js +13 -139
- package/es/components/OverflowMenuItem/OverflowMenuItem.d.ts +58 -0
- package/es/components/OverflowMenuItem/OverflowMenuItem.js +12 -7
- package/es/components/OverflowMenuV2/index.js +15 -51
- package/es/components/Popover/index.d.ts +5 -1
- package/es/components/Popover/index.js +37 -9
- package/es/components/RadioButton/RadioButton.Skeleton.d.ts +25 -0
- package/es/components/RadioButton/RadioButton.Skeleton.js +3 -3
- package/es/components/RadioButton/RadioButton.d.ts +64 -0
- package/es/components/RadioButton/RadioButton.js +19 -17
- package/es/components/RadioButtonGroup/RadioButtonGroup.d.ts +80 -0
- package/es/components/RadioButtonGroup/RadioButtonGroup.js +88 -26
- package/es/components/RadioTile/RadioTile.js +6 -6
- package/es/components/Search/Search.Skeleton.d.ts +36 -0
- package/es/components/Search/Search.js +3 -2
- package/es/components/Search/index.js +1 -0
- package/es/components/Select/Select.d.ts +89 -0
- package/es/components/SelectItem/SelectItem.d.ts +62 -0
- package/es/components/SelectItem/SelectItem.js +2 -4
- package/es/components/SelectItemGroup/SelectItemGroup.d.ts +52 -0
- package/es/components/SkeletonText/SkeletonText.js +1 -1
- package/es/components/StructuredList/StructuredList.js +11 -39
- package/es/components/Tabs/Tabs.js +29 -6
- package/es/components/TextArea/TextArea.Skeleton.d.ts +33 -0
- package/es/components/TextArea/TextArea.Skeleton.js +5 -5
- package/es/components/TextArea/TextArea.d.ts +9 -2
- package/es/components/TextArea/TextArea.js +31 -8
- package/es/components/TextArea/index.js +1 -0
- package/es/components/TextInput/TextInput.Skeleton.d.ts +33 -0
- package/es/components/TextInput/index.js +1 -0
- package/es/components/Tile/Tile.js +15 -8
- package/es/components/Toggle/Toggle.js +8 -19
- package/es/components/Tooltip/DefinitionTooltip.d.ts +52 -0
- package/es/components/Tooltip/DefinitionTooltip.js +2 -2
- package/es/components/Tooltip/Tooltip.d.ts +117 -0
- package/es/components/Tooltip/Tooltip.js +6 -4
- package/es/components/Tooltip/index.d.ts +9 -0
- package/es/components/UIShell/HeaderMenu.js +13 -4
- package/es/components/UIShell/HeaderMenuItem.js +17 -4
- package/es/index.d.ts +2 -0
- package/es/index.js +5 -3
- package/es/internal/ClickListener.js +1 -2
- package/es/internal/keyboard/match.js +1 -1
- package/es/internal/useAttachedMenu.js +85 -0
- package/es/internal/useDelayedState.d.ts +19 -0
- package/es/internal/useDelayedState.js +7 -3
- package/es/internal/useId.js +1 -1
- package/es/tools/wrapComponent.js +9 -0
- package/lib/components/Button/Button.js +2 -2
- package/lib/components/CodeSnippet/CodeSnippet.js +13 -115
- package/lib/components/ComboBox/ComboBox.d.ts +6 -0
- package/lib/components/ComboBox/ComboBox.js +18 -171
- package/lib/components/ComboButton/index.js +174 -0
- package/lib/components/ComposedModal/ComposedModal.js +1 -2
- package/lib/components/DataTable/Table.d.ts +74 -0
- package/lib/components/DataTable/Table.js +4 -2
- package/lib/components/DataTable/TableCell.d.ts +10 -0
- package/lib/components/DataTable/TableContext.d.ts +13 -0
- package/lib/components/DataTable/TableContext.js +2 -2
- package/lib/components/DataTable/TableExpandRow.d.ts +67 -0
- package/lib/components/DataTable/TableExpandedRow.d.ts +32 -0
- package/lib/components/DataTable/TableHead.d.ts +10 -0
- package/lib/components/DataTable/TableHeader.d.ts +64 -0
- package/lib/components/DataTable/TableHeader.js +23 -28
- package/lib/components/DataTable/TableRow.d.ts +32 -0
- package/lib/components/DataTable/TableSelectAll.js +1 -1
- package/lib/components/DataTable/TableSelectRow.js +1 -3
- package/lib/components/DataTable/TableToolbar.d.ts +19 -0
- package/lib/components/DataTable/TableToolbar.js +1 -1
- package/lib/components/DataTable/TableToolbarAction.d.ts +21 -0
- package/lib/components/DataTable/TableToolbarContent.d.ts +19 -0
- package/lib/components/DataTable/TableToolbarMenu.d.ts +24 -0
- package/lib/components/DataTable/TableToolbarMenu.js +3 -3
- package/lib/components/DataTable/TableToolbarSearch.js +1 -0
- package/lib/components/DataTable/tools/sorting.js +2 -1
- package/lib/components/DataTableSkeleton/DataTableSkeleton.d.ts +107 -0
- package/lib/components/Dropdown/Dropdown.d.ts +6 -0
- package/lib/components/Dropdown/Dropdown.js +7 -144
- package/lib/components/ExpandableSearch/ExpandableSearch.js +1 -0
- package/lib/components/FileUploader/FileUploader.js +1 -1
- package/lib/components/FileUploader/FileUploaderButton.js +2 -0
- package/lib/components/FileUploader/FileUploaderDropContainer.js +30 -18
- package/lib/components/FileUploader/FileUploaderItem.js +2 -1
- package/lib/components/FileUploader/Filename.js +8 -2
- package/lib/components/FluidTextArea/FluidTextArea.js +12 -1
- package/lib/components/IconButton/index.js +1 -0
- package/lib/components/InlineCheckbox/InlineCheckbox.js +7 -53
- package/lib/components/ListBox/ListBoxSelection.js +4 -23
- package/lib/components/ListBox/next/ListBoxSelection.js +2 -23
- package/lib/components/Menu/Menu.js +50 -29
- package/lib/components/Menu/MenuItem.js +1 -0
- package/lib/components/MenuButton/index.js +137 -0
- package/lib/components/Modal/Modal.js +4 -3
- package/lib/components/MultiSelect/FilterableMultiSelect.js +43 -141
- package/lib/components/MultiSelect/MultiSelect.d.ts +1 -1
- package/lib/components/MultiSelect/MultiSelect.js +47 -27
- package/lib/components/Notification/Notification.js +27 -264
- package/lib/components/NumberInput/NumberInput.js +9 -1
- package/lib/components/OverflowMenu/OverflowMenu.js +13 -139
- package/lib/components/OverflowMenuItem/OverflowMenuItem.d.ts +58 -0
- package/lib/components/OverflowMenuItem/OverflowMenuItem.js +12 -7
- package/lib/components/OverflowMenuV2/index.js +13 -49
- package/lib/components/Popover/index.d.ts +5 -1
- package/lib/components/Popover/index.js +37 -9
- package/lib/components/RadioButton/RadioButton.Skeleton.d.ts +25 -0
- package/lib/components/RadioButton/RadioButton.Skeleton.js +3 -3
- package/lib/components/RadioButton/RadioButton.d.ts +64 -0
- package/lib/components/RadioButton/RadioButton.js +18 -16
- package/lib/components/RadioButtonGroup/RadioButtonGroup.d.ts +80 -0
- package/lib/components/RadioButtonGroup/RadioButtonGroup.js +86 -24
- package/lib/components/RadioTile/RadioTile.js +6 -6
- package/lib/components/Search/Search.Skeleton.d.ts +36 -0
- package/lib/components/Search/Search.js +3 -2
- package/lib/components/Search/index.js +2 -0
- package/lib/components/Select/Select.d.ts +89 -0
- package/lib/components/SelectItem/SelectItem.d.ts +62 -0
- package/lib/components/SelectItem/SelectItem.js +1 -3
- package/lib/components/SelectItemGroup/SelectItemGroup.d.ts +52 -0
- package/lib/components/SkeletonText/SkeletonText.js +1 -1
- package/lib/components/StructuredList/StructuredList.js +11 -39
- package/lib/components/Tabs/Tabs.js +29 -6
- package/lib/components/TextArea/TextArea.Skeleton.d.ts +33 -0
- package/lib/components/TextArea/TextArea.Skeleton.js +5 -5
- package/lib/components/TextArea/TextArea.d.ts +9 -2
- package/lib/components/TextArea/TextArea.js +30 -7
- package/lib/components/TextArea/index.js +2 -0
- package/lib/components/TextInput/TextInput.Skeleton.d.ts +33 -0
- package/lib/components/TextInput/index.js +2 -0
- package/lib/components/Tile/Tile.js +15 -8
- package/lib/components/Toggle/Toggle.js +8 -19
- package/lib/components/Tooltip/DefinitionTooltip.d.ts +52 -0
- package/lib/components/Tooltip/DefinitionTooltip.js +2 -2
- package/lib/components/Tooltip/Tooltip.d.ts +117 -0
- package/lib/components/Tooltip/Tooltip.js +6 -4
- package/lib/components/Tooltip/index.d.ts +9 -0
- package/lib/components/UIShell/HeaderMenu.js +13 -4
- package/lib/components/UIShell/HeaderMenuItem.js +17 -4
- package/lib/index.d.ts +2 -0
- package/lib/index.js +50 -46
- package/lib/internal/ClickListener.js +1 -2
- package/lib/internal/keyboard/match.js +1 -1
- package/lib/internal/useAttachedMenu.js +89 -0
- package/lib/internal/useDelayedState.d.ts +19 -0
- package/lib/internal/useDelayedState.js +7 -3
- package/lib/internal/useId.js +1 -1
- package/lib/tools/wrapComponent.js +9 -0
- package/package.json +3 -3
|
@@ -20,10 +20,12 @@ var Table = function Table(_ref) {
|
|
|
20
20
|
children = _ref.children,
|
|
21
21
|
useZebraStyles = _ref.useZebraStyles,
|
|
22
22
|
size = _ref.size,
|
|
23
|
-
isSortable = _ref.isSortable,
|
|
23
|
+
_ref$isSortable = _ref.isSortable,
|
|
24
|
+
isSortable = _ref$isSortable === void 0 ? false : _ref$isSortable,
|
|
24
25
|
useStaticWidth = _ref.useStaticWidth,
|
|
25
26
|
stickyHeader = _ref.stickyHeader,
|
|
26
|
-
|
|
27
|
+
_ref$overflowMenuOnHo = _ref.overflowMenuOnHover,
|
|
28
|
+
overflowMenuOnHover = _ref$overflowMenuOnHo === void 0 ? true : _ref$overflowMenuOnHo,
|
|
27
29
|
other = _objectWithoutProperties(_ref, _excluded);
|
|
28
30
|
|
|
29
31
|
var _useContext = useContext(TableContext),
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2016, 2023
|
|
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 { TdHTMLAttributes } from 'react';
|
|
8
|
+
export type TableCellProps = TdHTMLAttributes<HTMLTableCellElement>;
|
|
9
|
+
declare const TableCell: React.FC<TableCellProps>;
|
|
10
|
+
export default TableCell;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2016, 2023
|
|
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
|
+
/// <reference types="react" />
|
|
8
|
+
interface TableContextType {
|
|
9
|
+
titleId?: string;
|
|
10
|
+
descriptionId?: string;
|
|
11
|
+
}
|
|
12
|
+
export declare const TableContext: import("react").Context<TableContextType>;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2016, 2023
|
|
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 PropTypes from 'prop-types';
|
|
8
|
+
import { MouseEventHandler, PropsWithChildren } from 'react';
|
|
9
|
+
import { TableRowProps } from './TableRow';
|
|
10
|
+
interface TableExpandRowProps extends PropsWithChildren<TableRowProps> {
|
|
11
|
+
/**
|
|
12
|
+
* Specify the string read by a voice reader when the expand trigger is
|
|
13
|
+
* focused
|
|
14
|
+
*/
|
|
15
|
+
ariaLabel: string;
|
|
16
|
+
/**
|
|
17
|
+
* The id of the matching th node in the table head. Addresses a11y concerns outlined here: https://www.ibm.com/able/guidelines/ci162/info_and_relationships.html and https://www.w3.org/TR/WCAG20-TECHS/H43
|
|
18
|
+
*/
|
|
19
|
+
expandHeader?: string;
|
|
20
|
+
/**
|
|
21
|
+
* The description of the chevron right icon, to be put in its SVG `<title>` element.
|
|
22
|
+
*/
|
|
23
|
+
expandIconDescription?: string;
|
|
24
|
+
/**
|
|
25
|
+
* Specify whether this row is expanded or not. This helps coordinate data
|
|
26
|
+
* attributes so that `TableExpandRow` and `TableExpandedRow` work together
|
|
27
|
+
*/
|
|
28
|
+
isExpanded: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Hook for when a listener initiates a request to expand the given row
|
|
31
|
+
*/
|
|
32
|
+
onExpand: MouseEventHandler<HTMLButtonElement>;
|
|
33
|
+
}
|
|
34
|
+
declare const TableExpandRow: {
|
|
35
|
+
({ ariaLabel, className: rowClassName, children, isExpanded, onExpand, expandIconDescription, isSelected, expandHeader, ...rest }: TableExpandRowProps): JSX.Element;
|
|
36
|
+
propTypes: {
|
|
37
|
+
/**
|
|
38
|
+
* Specify the string read by a voice reader when the expand trigger is
|
|
39
|
+
* focused
|
|
40
|
+
*/
|
|
41
|
+
ariaLabel: PropTypes.Validator<string>;
|
|
42
|
+
children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
43
|
+
className: PropTypes.Requireable<string>;
|
|
44
|
+
/**
|
|
45
|
+
* The id of the matching th node in the table head. Addresses a11y concerns outlined here: https://www.ibm.com/able/guidelines/ci162/info_and_relationships.html and https://www.w3.org/TR/WCAG20-TECHS/H43
|
|
46
|
+
*/
|
|
47
|
+
expandHeader: PropTypes.Requireable<string>;
|
|
48
|
+
/**
|
|
49
|
+
* The description of the chevron right icon, to be put in its SVG `<title>` element.
|
|
50
|
+
*/
|
|
51
|
+
expandIconDescription: PropTypes.Requireable<string>;
|
|
52
|
+
/**
|
|
53
|
+
* Specify whether this row is expanded or not. This helps coordinate data
|
|
54
|
+
* attributes so that `TableExpandRow` and `TableExpandedRow` work together
|
|
55
|
+
*/
|
|
56
|
+
isExpanded: PropTypes.Validator<boolean>;
|
|
57
|
+
/**
|
|
58
|
+
* Specify if the row is selected
|
|
59
|
+
*/
|
|
60
|
+
isSelected: PropTypes.Requireable<boolean>;
|
|
61
|
+
/**
|
|
62
|
+
* Hook for when a listener initiates a request to expand the given row
|
|
63
|
+
*/
|
|
64
|
+
onExpand: PropTypes.Validator<(...args: any[]) => any>;
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
export default TableExpandRow;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2016, 2023
|
|
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 PropTypes from 'prop-types';
|
|
8
|
+
import { ReactAttr } from '../../types/common';
|
|
9
|
+
interface TableExpandedRowProps extends ReactAttr<HTMLTableRowElement> {
|
|
10
|
+
/**
|
|
11
|
+
* The width of the expanded row's internal cell
|
|
12
|
+
*/
|
|
13
|
+
colSpan: number;
|
|
14
|
+
}
|
|
15
|
+
declare const TableExpandedRow: {
|
|
16
|
+
({ className: customClassName, children, colSpan, ...rest }: TableExpandedRowProps): JSX.Element;
|
|
17
|
+
propTypes: {
|
|
18
|
+
/**
|
|
19
|
+
* Pass in the contents for your TableExpandedRow
|
|
20
|
+
*/
|
|
21
|
+
children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
22
|
+
/**
|
|
23
|
+
* Specify an optional className to be applied to the container node
|
|
24
|
+
*/
|
|
25
|
+
className: PropTypes.Requireable<string>;
|
|
26
|
+
/**
|
|
27
|
+
* The width of the expanded row's internal cell
|
|
28
|
+
*/
|
|
29
|
+
colSpan: PropTypes.Validator<number>;
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
export default TableExpandedRow;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2016, 2023
|
|
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 React, { ThHTMLAttributes } from 'react';
|
|
8
|
+
export type TableHeadProps = ThHTMLAttributes<HTMLTableSectionElement>;
|
|
9
|
+
declare const TableHead: React.FC<TableHeadProps>;
|
|
10
|
+
export default TableHead;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2016, 2023
|
|
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 React, { MouseEventHandler } from 'react';
|
|
8
|
+
import { ReactAttr } from '../../types/common';
|
|
9
|
+
interface TableHeaderProps extends ReactAttr<HTMLTableCellElement & HTMLButtonElement> {
|
|
10
|
+
/**
|
|
11
|
+
* Pass in children that will be embedded in the table header label
|
|
12
|
+
*/
|
|
13
|
+
children?: React.ReactNode;
|
|
14
|
+
/**
|
|
15
|
+
* Specify an optional className to be applied to the container node
|
|
16
|
+
*/
|
|
17
|
+
className?: string;
|
|
18
|
+
/**
|
|
19
|
+
* Specify `colSpan` as a non-negative integer value to indicate how
|
|
20
|
+
* many columns the TableHeader cell extends in a table
|
|
21
|
+
*/
|
|
22
|
+
colSpan?: number;
|
|
23
|
+
/**
|
|
24
|
+
* Supply an id to the th element.
|
|
25
|
+
*/
|
|
26
|
+
id?: string;
|
|
27
|
+
/**
|
|
28
|
+
* Specify whether this header is the header by which a table is being sorted
|
|
29
|
+
* by
|
|
30
|
+
*/
|
|
31
|
+
isSortHeader?: boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Specify whether this header is one through which a user can sort the table
|
|
34
|
+
*/
|
|
35
|
+
isSortable?: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Hook that is invoked when the header is clicked
|
|
38
|
+
*/
|
|
39
|
+
onClick?: MouseEventHandler<HTMLButtonElement>;
|
|
40
|
+
/**
|
|
41
|
+
* Specify the scope of this table header. You can find more info about this
|
|
42
|
+
* attribute at the following URL:
|
|
43
|
+
* https://developer.mozilla.org/en-US/docs/Web/HTML/Element/th#attr-scope
|
|
44
|
+
*/
|
|
45
|
+
scope: string;
|
|
46
|
+
/**
|
|
47
|
+
* Specify which direction we are currently sorting by, should be one of DESC,
|
|
48
|
+
* NONE, or ASC.
|
|
49
|
+
*/
|
|
50
|
+
sortDirection?: string;
|
|
51
|
+
/**
|
|
52
|
+
* Supply a method to translate internal strings with your i18n tool of
|
|
53
|
+
* choice. Translation keys are available on the `translationKeys` field for
|
|
54
|
+
* this component.
|
|
55
|
+
*/
|
|
56
|
+
translateWithId?: (key: string, { header, sortDirection, isSortHeader, sortStates }: {
|
|
57
|
+
header: any;
|
|
58
|
+
sortDirection: any;
|
|
59
|
+
isSortHeader: any;
|
|
60
|
+
sortStates: any;
|
|
61
|
+
}) => string;
|
|
62
|
+
}
|
|
63
|
+
declare const TableHeader: React.ForwardRefExoticComponent<TableHeaderProps & React.RefAttributes<HTMLTableCellElement>>;
|
|
64
|
+
export default TableHeader;
|
|
@@ -22,48 +22,43 @@ var translationKeys = {
|
|
|
22
22
|
buttonDescription: 'carbon.table.header.icon.description'
|
|
23
23
|
};
|
|
24
24
|
|
|
25
|
-
var translateWithId = function translateWithId(key,
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
isSortHeader = _ref.isSortHeader,
|
|
29
|
-
sortStates = _ref.sortStates;
|
|
30
|
-
|
|
31
|
-
if (key === translationKeys.buttonDescription) {
|
|
32
|
-
if (isSortHeader) {
|
|
25
|
+
var translateWithId = function translateWithId(key, args) {
|
|
26
|
+
if (args && key === translationKeys.buttonDescription) {
|
|
27
|
+
if (args.isSortHeader && sortStates) {
|
|
33
28
|
// When transitioning, we know that the sequence of states is as follows:
|
|
34
29
|
// NONE -> ASC -> DESC -> NONE
|
|
35
|
-
if (sortDirection === sortStates.NONE) {
|
|
36
|
-
return "Click to sort rows by ".concat(header, " header in ascending order");
|
|
30
|
+
if (args.sortDirection === sortStates.NONE) {
|
|
31
|
+
return "Click to sort rows by ".concat(args.header, " header in ascending order");
|
|
37
32
|
}
|
|
38
33
|
|
|
39
|
-
if (sortDirection === sortStates.ASC) {
|
|
40
|
-
return "Click to sort rows by ".concat(header, " header in descending order");
|
|
34
|
+
if (args.sortDirection === sortStates.ASC) {
|
|
35
|
+
return "Click to sort rows by ".concat(args.header, " header in descending order");
|
|
41
36
|
}
|
|
42
37
|
|
|
43
|
-
return "Click to unsort rows by ".concat(header, " header");
|
|
38
|
+
return "Click to unsort rows by ".concat(args.header, " header");
|
|
44
39
|
}
|
|
45
40
|
|
|
46
|
-
return "Click to sort rows by ".concat(header, " header in ascending order");
|
|
41
|
+
return "Click to sort rows by ".concat(args.header, " header in ascending order");
|
|
47
42
|
}
|
|
48
43
|
|
|
49
44
|
return '';
|
|
50
45
|
};
|
|
51
46
|
|
|
52
47
|
var sortDirections = (_sortDirections = {}, _defineProperty(_sortDirections, sortStates.NONE, 'none'), _defineProperty(_sortDirections, sortStates.ASC, 'ascending'), _defineProperty(_sortDirections, sortStates.DESC, 'descending'), _sortDirections);
|
|
53
|
-
var TableHeader = /*#__PURE__*/React__default.forwardRef(function TableHeader(
|
|
48
|
+
var TableHeader = /*#__PURE__*/React__default.forwardRef(function TableHeader(_ref, ref) {
|
|
54
49
|
var _cx;
|
|
55
50
|
|
|
56
|
-
var headerClassName =
|
|
57
|
-
children =
|
|
58
|
-
colSpan =
|
|
59
|
-
isSortable =
|
|
60
|
-
isSortHeader =
|
|
61
|
-
onClick =
|
|
62
|
-
scope =
|
|
63
|
-
sortDirection =
|
|
64
|
-
t =
|
|
65
|
-
id =
|
|
66
|
-
rest = _objectWithoutProperties(
|
|
51
|
+
var headerClassName = _ref.className,
|
|
52
|
+
children = _ref.children,
|
|
53
|
+
colSpan = _ref.colSpan,
|
|
54
|
+
isSortable = _ref.isSortable,
|
|
55
|
+
isSortHeader = _ref.isSortHeader,
|
|
56
|
+
onClick = _ref.onClick,
|
|
57
|
+
scope = _ref.scope,
|
|
58
|
+
sortDirection = _ref.sortDirection,
|
|
59
|
+
t = _ref.translateWithId,
|
|
60
|
+
id = _ref.id,
|
|
61
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
67
62
|
|
|
68
63
|
var prefix = usePrefix();
|
|
69
64
|
var uniqueId = useId('table-sort');
|
|
@@ -81,8 +76,8 @@ var TableHeader = /*#__PURE__*/React__default.forwardRef(function TableHeader(_r
|
|
|
81
76
|
}
|
|
82
77
|
|
|
83
78
|
var className = cx(headerClassName, (_cx = {}, _defineProperty(_cx, "".concat(prefix, "--table-sort"), true), _defineProperty(_cx, "".concat(prefix, "--table-sort--active"), isSortHeader && sortDirection !== sortStates.NONE), _defineProperty(_cx, "".concat(prefix, "--table-sort--descending"), isSortHeader && sortDirection === sortStates.DESC), _cx));
|
|
84
|
-
var ariaSort = !isSortHeader ? 'none' : sortDirections[sortDirection];
|
|
85
|
-
var sortDescription = t('carbon.table.header.icon.description', {
|
|
79
|
+
var ariaSort = !isSortHeader || !sortDirection ? 'none' : sortDirections[sortDirection];
|
|
80
|
+
var sortDescription = t && t('carbon.table.header.icon.description', {
|
|
86
81
|
header: children,
|
|
87
82
|
sortDirection: sortDirection,
|
|
88
83
|
isSortHeader: isSortHeader,
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2016, 2023
|
|
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 PropTypes from 'prop-types';
|
|
8
|
+
import { ReactAttr } from '../../types/common';
|
|
9
|
+
export interface TableRowProps extends ReactAttr<HTMLTableRowElement> {
|
|
10
|
+
/**
|
|
11
|
+
* Specify an optional className to be applied to the container node
|
|
12
|
+
*/
|
|
13
|
+
className?: string;
|
|
14
|
+
/**
|
|
15
|
+
* Specify if the row is selected
|
|
16
|
+
*/
|
|
17
|
+
isSelected?: boolean;
|
|
18
|
+
}
|
|
19
|
+
declare const TableRow: {
|
|
20
|
+
(props: TableRowProps): JSX.Element;
|
|
21
|
+
propTypes: {
|
|
22
|
+
/**
|
|
23
|
+
* Specify an optional className to be applied to the container node
|
|
24
|
+
*/
|
|
25
|
+
className: PropTypes.Requireable<string>;
|
|
26
|
+
/**
|
|
27
|
+
* Specify if the row is selected
|
|
28
|
+
*/
|
|
29
|
+
isSelected: PropTypes.Requireable<boolean>;
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
export default TableRow;
|
|
@@ -25,7 +25,7 @@ var TableSelectAll = function TableSelectAll(_ref) {
|
|
|
25
25
|
scope: "col",
|
|
26
26
|
className: cx("".concat(prefix, "--table-column-checkbox"), className)
|
|
27
27
|
}, /*#__PURE__*/React__default.createElement(InlineCheckbox, {
|
|
28
|
-
|
|
28
|
+
"aria-label": ariaLabel,
|
|
29
29
|
checked: checked,
|
|
30
30
|
id: id,
|
|
31
31
|
indeterminate: indeterminate,
|
|
@@ -39,9 +39,7 @@ var TableSelectRow = function TableSelectRow(_ref) {
|
|
|
39
39
|
}, /*#__PURE__*/React__default.createElement(InlineInputComponent, _extends({}, selectionInputProps, radio && {
|
|
40
40
|
labelText: ariaLabel,
|
|
41
41
|
hideLabel: true
|
|
42
|
-
}, !radio && {
|
|
43
|
-
ariaLabel: ariaLabel
|
|
44
|
-
})));
|
|
42
|
+
}, !radio && _defineProperty({}, 'aria-label', ariaLabel))));
|
|
45
43
|
};
|
|
46
44
|
|
|
47
45
|
TableSelectRow.propTypes = {
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2016, 2023
|
|
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 React from 'react';
|
|
8
|
+
export interface TableToolbarProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
9
|
+
/**
|
|
10
|
+
* Pass in the children that will be rendered inside the TableToolbar
|
|
11
|
+
*/
|
|
12
|
+
children: React.ReactNode;
|
|
13
|
+
/**
|
|
14
|
+
* `lg` Change the row height of table
|
|
15
|
+
*/
|
|
16
|
+
size?: 'sm' | 'lg';
|
|
17
|
+
}
|
|
18
|
+
declare const TableToolbar: React.FC<TableToolbarProps>;
|
|
19
|
+
export default TableToolbar;
|
|
@@ -9,8 +9,8 @@ import { objectWithoutProperties as _objectWithoutProperties, defineProperty as
|
|
|
9
9
|
import cx from 'classnames';
|
|
10
10
|
import PropTypes from 'prop-types';
|
|
11
11
|
import React__default from 'react';
|
|
12
|
-
import { AriaLabelPropType } from '../../prop-types/AriaPropTypes.js';
|
|
13
12
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
13
|
+
import { AriaLabelPropType } from '../../prop-types/AriaPropTypes.js';
|
|
14
14
|
|
|
15
15
|
var _excluded = ["children", "size"];
|
|
16
16
|
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2016, 2023
|
|
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 React from 'react';
|
|
8
|
+
import { ForwardRefReturn } from '../../types/common';
|
|
9
|
+
export interface TableToolbarActionProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'onClick'> {
|
|
10
|
+
/**
|
|
11
|
+
* Pass in the children that will be rendered inside the TableToolbarAction
|
|
12
|
+
*/
|
|
13
|
+
children?: React.ReactNode;
|
|
14
|
+
/**
|
|
15
|
+
* onClick handler for the TableToolbarAction
|
|
16
|
+
*/
|
|
17
|
+
onClick: (event: React.MouseEvent<HTMLDivElement>) => void;
|
|
18
|
+
}
|
|
19
|
+
export type TableToolbarActionComponent = ForwardRefReturn<HTMLDivElement, TableToolbarActionProps>;
|
|
20
|
+
declare const TableToolbarAction: TableToolbarActionComponent;
|
|
21
|
+
export default TableToolbarAction;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2016, 2023
|
|
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
|
+
declare const TableToolbarContent: {
|
|
8
|
+
({ className: baseClassName, ...other }: {
|
|
9
|
+
[x: string]: any;
|
|
10
|
+
className?: string | undefined;
|
|
11
|
+
}): import("react").ReactElement<{
|
|
12
|
+
className: string | undefined;
|
|
13
|
+
}, string | import("react").JSXElementConstructor<any>>;
|
|
14
|
+
displayName: string;
|
|
15
|
+
propTypes: {
|
|
16
|
+
className: import("prop-types").Requireable<string>;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
export default TableToolbarContent;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2016, 2023
|
|
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 React from 'react';
|
|
8
|
+
export interface TableToolbarMenuProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
9
|
+
children: React.ReactNode;
|
|
10
|
+
/**
|
|
11
|
+
* Provide an optional class name for the toolbar menu
|
|
12
|
+
*/
|
|
13
|
+
className?: string;
|
|
14
|
+
/**
|
|
15
|
+
* The description of the menu icon.
|
|
16
|
+
*/
|
|
17
|
+
iconDescription: string;
|
|
18
|
+
/**
|
|
19
|
+
* Optional prop to allow overriding the default menu icon
|
|
20
|
+
*/
|
|
21
|
+
renderIcon?: React.ReactNode;
|
|
22
|
+
}
|
|
23
|
+
declare const TableToolbarMenu: React.FC<TableToolbarMenuProps>;
|
|
24
|
+
export default TableToolbarMenu;
|
|
@@ -6,12 +6,12 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
import { objectWithoutProperties as _objectWithoutProperties, extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
|
9
|
+
import { Settings } from '@carbon/icons-react';
|
|
9
10
|
import cx from 'classnames';
|
|
10
11
|
import PropTypes from 'prop-types';
|
|
11
12
|
import React__default from 'react';
|
|
12
|
-
import OverflowMenu from '../OverflowMenu/index.js';
|
|
13
|
-
import { Settings } from '@carbon/icons-react';
|
|
14
13
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
14
|
+
import OverflowMenu from '../OverflowMenu/index.js';
|
|
15
15
|
|
|
16
16
|
var _excluded = ["className", "renderIcon", "iconDescription", "children"];
|
|
17
17
|
|
|
@@ -25,7 +25,7 @@ var TableToolbarMenu = function TableToolbarMenu(_ref) {
|
|
|
25
25
|
var prefix = usePrefix();
|
|
26
26
|
var toolbarActionClasses = cx(className, "".concat(prefix, "--toolbar-action ").concat(prefix, "--overflow-menu"));
|
|
27
27
|
return /*#__PURE__*/React__default.createElement(OverflowMenu, _extends({
|
|
28
|
-
|
|
28
|
+
"aria-label": iconDescription,
|
|
29
29
|
renderIcon: renderIcon,
|
|
30
30
|
className: toolbarActionClasses,
|
|
31
31
|
title: iconDescription,
|
|
@@ -10,6 +10,7 @@ import cx from 'classnames';
|
|
|
10
10
|
import PropTypes from 'prop-types';
|
|
11
11
|
import React__default, { useRef, useState, useMemo, useEffect } from 'react';
|
|
12
12
|
import Search from '../Search/Search.js';
|
|
13
|
+
import '../Search/Search.Skeleton.js';
|
|
13
14
|
import setupGetInstanceId from './tools/instanceId.js';
|
|
14
15
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
15
16
|
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2016, 2023
|
|
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 PropTypes from 'prop-types';
|
|
8
|
+
export interface DataTableSkeletonProps {
|
|
9
|
+
/**
|
|
10
|
+
* Specify an optional className to add.
|
|
11
|
+
*/
|
|
12
|
+
className?: string;
|
|
13
|
+
/**
|
|
14
|
+
* Specify the number of columns that you want to render in the skeleton state
|
|
15
|
+
*/
|
|
16
|
+
columnCount: number;
|
|
17
|
+
/**
|
|
18
|
+
* Optionally specify whether you want the Skeleton to be rendered as a
|
|
19
|
+
* compact DataTable
|
|
20
|
+
*/
|
|
21
|
+
compact: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Optionally specify the displayed headers
|
|
24
|
+
*/
|
|
25
|
+
headers?: [{
|
|
26
|
+
header: string;
|
|
27
|
+
key: string;
|
|
28
|
+
}] | {
|
|
29
|
+
header: string;
|
|
30
|
+
key: string;
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* Specify the number of rows that you want to render in the skeleton state
|
|
34
|
+
*/
|
|
35
|
+
rowCount: number;
|
|
36
|
+
/**
|
|
37
|
+
* Specify if the table header should be rendered as part of the skeleton.
|
|
38
|
+
*/
|
|
39
|
+
showHeader: boolean;
|
|
40
|
+
/**
|
|
41
|
+
* Specify if the table toolbar should be rendered as part of the skeleton.
|
|
42
|
+
*/
|
|
43
|
+
showToolbar: boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Optionally specify whether you want the DataTable to be zebra striped
|
|
46
|
+
*/
|
|
47
|
+
zebra: boolean;
|
|
48
|
+
}
|
|
49
|
+
declare const DataTableSkeleton: {
|
|
50
|
+
({ headers, rowCount, columnCount, zebra, compact, className, showHeader, showToolbar, ...rest }: {
|
|
51
|
+
[x: string]: any;
|
|
52
|
+
headers: any;
|
|
53
|
+
rowCount: any;
|
|
54
|
+
columnCount: any;
|
|
55
|
+
zebra: any;
|
|
56
|
+
compact: any;
|
|
57
|
+
className: any;
|
|
58
|
+
showHeader: any;
|
|
59
|
+
showToolbar: any;
|
|
60
|
+
}): JSX.Element;
|
|
61
|
+
propTypes: {
|
|
62
|
+
/**
|
|
63
|
+
* Specify an optional className to add.
|
|
64
|
+
*/
|
|
65
|
+
className: PropTypes.Requireable<string>;
|
|
66
|
+
/**
|
|
67
|
+
* Specify the number of columns that you want to render in the skeleton state
|
|
68
|
+
*/
|
|
69
|
+
columnCount: PropTypes.Requireable<number>;
|
|
70
|
+
/**
|
|
71
|
+
* Optionally specify whether you want the Skeleton to be rendered as a
|
|
72
|
+
* compact DataTable
|
|
73
|
+
*/
|
|
74
|
+
compact: PropTypes.Requireable<boolean>;
|
|
75
|
+
/**
|
|
76
|
+
* Optionally specify the displayed headers
|
|
77
|
+
*/
|
|
78
|
+
headers: PropTypes.Requireable<NonNullable<any[] | PropTypes.InferProps<{
|
|
79
|
+
key: PropTypes.Requireable<string>;
|
|
80
|
+
}> | null | undefined>>;
|
|
81
|
+
/**
|
|
82
|
+
* Specify the number of rows that you want to render in the skeleton state
|
|
83
|
+
*/
|
|
84
|
+
rowCount: PropTypes.Requireable<number>;
|
|
85
|
+
/**
|
|
86
|
+
* Specify if the table header should be rendered as part of the skeleton.
|
|
87
|
+
*/
|
|
88
|
+
showHeader: PropTypes.Requireable<boolean>;
|
|
89
|
+
/**
|
|
90
|
+
* Specify if the table toolbar should be rendered as part of the skeleton.
|
|
91
|
+
*/
|
|
92
|
+
showToolbar: PropTypes.Requireable<boolean>;
|
|
93
|
+
/**
|
|
94
|
+
* Optionally specify whether you want the DataTable to be zebra striped
|
|
95
|
+
*/
|
|
96
|
+
zebra: PropTypes.Requireable<boolean>;
|
|
97
|
+
};
|
|
98
|
+
defaultProps: {
|
|
99
|
+
rowCount: number;
|
|
100
|
+
columnCount: number;
|
|
101
|
+
zebra: boolean;
|
|
102
|
+
compact: boolean;
|
|
103
|
+
showHeader: boolean;
|
|
104
|
+
showToolbar: boolean;
|
|
105
|
+
};
|
|
106
|
+
};
|
|
107
|
+
export default DataTableSkeleton;
|
|
@@ -14,8 +14,14 @@ export interface OnChangeData<ItemType> {
|
|
|
14
14
|
}
|
|
15
15
|
export interface DropdownProps<ItemType> extends Omit<ReactAttr<HTMLDivElement>, ExcludedAttributes> {
|
|
16
16
|
/**
|
|
17
|
+
* Specify a label to be read by screen readers on the container node
|
|
17
18
|
* 'aria-label' of the ListBox component.
|
|
18
19
|
*/
|
|
20
|
+
['aria-label']?: string;
|
|
21
|
+
/**
|
|
22
|
+
* @deprecated please use `aria-label` instead.
|
|
23
|
+
* Specify a label to be read by screen readers on the container note.
|
|
24
|
+
*/
|
|
19
25
|
ariaLabel?: string;
|
|
20
26
|
/**
|
|
21
27
|
* Specify the direction of the dropdown. Can be either top or bottom.
|