@carbon/react 1.25.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/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/TableToolbarContent.d.ts +4 -6
- package/es/components/DataTable/TableToolbarSearch.js +1 -0
- package/es/components/ExpandableSearch/ExpandableSearch.js +1 -0
- package/es/components/FileUploader/FileUploaderButton.js +2 -0
- package/es/components/InlineCheckbox/InlineCheckbox.js +7 -53
- package/es/components/MultiSelect/FilterableMultiSelect.js +15 -7
- package/es/components/MultiSelect/MultiSelect.js +0 -2
- package/es/components/NumberInput/NumberInput.js +9 -1
- 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 +84 -25
- 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/StructuredList/StructuredList.js +1 -1
- package/es/components/Tabs/Tabs.js +26 -5
- 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/UIShell/HeaderMenu.js +13 -4
- package/es/components/UIShell/HeaderMenuItem.js +17 -4
- package/es/tools/wrapComponent.js +9 -0
- package/lib/components/Button/Button.js +2 -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/TableToolbarContent.d.ts +4 -6
- package/lib/components/DataTable/TableToolbarSearch.js +1 -0
- package/lib/components/ExpandableSearch/ExpandableSearch.js +1 -0
- package/lib/components/FileUploader/FileUploaderButton.js +2 -0
- package/lib/components/InlineCheckbox/InlineCheckbox.js +7 -53
- package/lib/components/MultiSelect/FilterableMultiSelect.js +14 -6
- package/lib/components/MultiSelect/MultiSelect.js +0 -2
- package/lib/components/NumberInput/NumberInput.js +9 -1
- 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 +83 -24
- 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/StructuredList/StructuredList.js +1 -1
- package/lib/components/Tabs/Tabs.js +26 -5
- 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/UIShell/HeaderMenu.js +13 -4
- package/lib/components/UIShell/HeaderMenuItem.js +17 -4
- package/lib/tools/wrapComponent.js +9 -0
- package/package.json +3 -3
|
@@ -17,7 +17,7 @@ import { useId } from '../../internal/useId.js';
|
|
|
17
17
|
|
|
18
18
|
var _excluded = ["as", "children", "className", "dangerDescription", "disabled", "hasIconOnly", "href", "iconDescription", "isExpressive", "isSelected", "kind", "onBlur", "onClick", "onFocus", "onMouseEnter", "onMouseLeave", "renderIcon", "size", "tabIndex", "tooltipAlignment", "tooltipPosition", "type"];
|
|
19
19
|
var Button = /*#__PURE__*/React__default.forwardRef(function Button(_ref, ref) {
|
|
20
|
-
var _classNames;
|
|
20
|
+
var _classNames, _rest$ariaPressed;
|
|
21
21
|
|
|
22
22
|
var as = _ref.as,
|
|
23
23
|
children = _ref.children,
|
|
@@ -82,7 +82,7 @@ var Button = /*#__PURE__*/React__default.forwardRef(function Button(_ref, ref) {
|
|
|
82
82
|
disabled: disabled,
|
|
83
83
|
type: type,
|
|
84
84
|
'aria-describedby': dangerButtonVariants.includes(kind) ? assistiveId : null,
|
|
85
|
-
'aria-pressed': hasIconOnly && kind === 'ghost' ? isSelected : null
|
|
85
|
+
'aria-pressed': (_rest$ariaPressed = rest['aria-pressed']) !== null && _rest$ariaPressed !== void 0 ? _rest$ariaPressed : hasIconOnly && kind === 'ghost' ? isSelected : null
|
|
86
86
|
};
|
|
87
87
|
var anchorProps = {
|
|
88
88
|
href: href
|
|
@@ -0,0 +1,74 @@
|
|
|
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 { PropsWithChildren } from 'react';
|
|
8
|
+
import PropTypes from 'prop-types';
|
|
9
|
+
interface TableProps {
|
|
10
|
+
className?: string;
|
|
11
|
+
/**
|
|
12
|
+
* `false` If true, will apply sorting styles
|
|
13
|
+
*/
|
|
14
|
+
isSortable?: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Specify whether the overflow menu (if it exists) should be shown always, or only on hover
|
|
17
|
+
*/
|
|
18
|
+
overflowMenuOnHover?: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Change the row height of table. Currently supports `xs`, `sm`, `md`, `lg`, and `xl`.
|
|
21
|
+
*/
|
|
22
|
+
size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
23
|
+
/**
|
|
24
|
+
* `false` If true, will keep the header sticky (only data rows will scroll)
|
|
25
|
+
*/
|
|
26
|
+
stickyHeader?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* `false` If true, will use a width of 'auto' instead of 100%
|
|
29
|
+
*/
|
|
30
|
+
useStaticWidth?: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* `true` to add useZebraStyles striping.
|
|
33
|
+
*/
|
|
34
|
+
useZebraStyles?: boolean;
|
|
35
|
+
}
|
|
36
|
+
export declare const Table: {
|
|
37
|
+
({ className, children, useZebraStyles, size, isSortable, useStaticWidth, stickyHeader, overflowMenuOnHover, ...other }: PropsWithChildren<TableProps>): JSX.Element;
|
|
38
|
+
propTypes: {
|
|
39
|
+
/**
|
|
40
|
+
* Pass in the children that will be rendered within the Table
|
|
41
|
+
*/
|
|
42
|
+
children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
43
|
+
className: PropTypes.Requireable<string>;
|
|
44
|
+
/**
|
|
45
|
+
* `false` If true, will apply sorting styles
|
|
46
|
+
*/
|
|
47
|
+
isSortable: PropTypes.Requireable<boolean>;
|
|
48
|
+
/**
|
|
49
|
+
* Specify whether the overflow menu (if it exists) should be shown always, or only on hover
|
|
50
|
+
*/
|
|
51
|
+
overflowMenuOnHover: PropTypes.Requireable<boolean>;
|
|
52
|
+
/**
|
|
53
|
+
* Change the row height of table. Currently supports `xs`, `sm`, `md`, `lg`, and `xl`.
|
|
54
|
+
*/
|
|
55
|
+
size: PropTypes.Requireable<string>;
|
|
56
|
+
/**
|
|
57
|
+
* `false` If true, will keep the header sticky (only data rows will scroll)
|
|
58
|
+
*/
|
|
59
|
+
stickyHeader: PropTypes.Requireable<boolean>;
|
|
60
|
+
/**
|
|
61
|
+
* `false` If true, will use a width of 'auto' instead of 100%
|
|
62
|
+
*/
|
|
63
|
+
useStaticWidth: PropTypes.Requireable<boolean>;
|
|
64
|
+
/**
|
|
65
|
+
* `true` to add useZebraStyles striping.
|
|
66
|
+
*/
|
|
67
|
+
useZebraStyles: PropTypes.Requireable<boolean>;
|
|
68
|
+
};
|
|
69
|
+
defaultProps: {
|
|
70
|
+
isSortable: boolean;
|
|
71
|
+
overflowMenuOnHover: boolean;
|
|
72
|
+
};
|
|
73
|
+
};
|
|
74
|
+
export default Table;
|
|
@@ -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 = {
|
|
@@ -7,13 +7,11 @@
|
|
|
7
7
|
declare const TableToolbarContent: {
|
|
8
8
|
({ className: baseClassName, ...other }: {
|
|
9
9
|
[x: string]: any;
|
|
10
|
-
className
|
|
11
|
-
}): import("react").
|
|
10
|
+
className?: string | undefined;
|
|
11
|
+
}): import("react").ReactElement<{
|
|
12
12
|
className: string | undefined;
|
|
13
|
-
}, import("react").
|
|
14
|
-
|
|
15
|
-
}, any, any>>;
|
|
16
|
-
displayName: any;
|
|
13
|
+
}, string | import("react").JSXElementConstructor<any>>;
|
|
14
|
+
displayName: string;
|
|
17
15
|
propTypes: {
|
|
18
16
|
className: import("prop-types").Requireable<string>;
|
|
19
17
|
};
|
|
@@ -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
|
|
|
@@ -9,6 +9,7 @@ import { objectWithoutProperties as _objectWithoutProperties, slicedToArray as _
|
|
|
9
9
|
import React__default, { useState, useRef } from 'react';
|
|
10
10
|
import cx from 'classnames';
|
|
11
11
|
import Search from '../Search/Search.js';
|
|
12
|
+
import '../Search/Search.Skeleton.js';
|
|
12
13
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
13
14
|
import { composeEventHandlers } from '../../tools/events.js';
|
|
14
15
|
|
|
@@ -70,11 +70,13 @@ function FileUploaderButton(_ref) {
|
|
|
70
70
|
|
|
71
71
|
function onClick(event) {
|
|
72
72
|
event.target.value = null;
|
|
73
|
+
inputNode.current.value = '';
|
|
73
74
|
inputNode.current.click();
|
|
74
75
|
}
|
|
75
76
|
|
|
76
77
|
function onKeyDown(event) {
|
|
77
78
|
if (matches(event, [Enter, Space])) {
|
|
79
|
+
inputNode.current.value = '';
|
|
78
80
|
inputNode.current.click();
|
|
79
81
|
}
|
|
80
82
|
}
|
|
@@ -5,15 +5,19 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
+
import { defineProperty as _defineProperty } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
|
8
9
|
import PropTypes from 'prop-types';
|
|
9
10
|
import React__default, { useRef, useEffect } from 'react';
|
|
11
|
+
import deprecate from '../../prop-types/deprecate.js';
|
|
10
12
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
11
13
|
import { useMergedRefs } from '../../internal/useMergedRefs.js';
|
|
12
14
|
|
|
15
|
+
var _InlineCheckbox$propT;
|
|
13
16
|
/** @type any */
|
|
14
17
|
|
|
15
18
|
var InlineCheckbox = /*#__PURE__*/React__default.forwardRef(function InlineCheckbox(props, forwardRef) {
|
|
16
|
-
var ariaLabel = props
|
|
19
|
+
var ariaLabel = props['aria-label'],
|
|
20
|
+
deprecatedAriaLabel = props.ariaLabel,
|
|
17
21
|
_props$checked = props.checked,
|
|
18
22
|
checked = _props$checked === void 0 ? false : _props$checked,
|
|
19
23
|
disabled = props.disabled,
|
|
@@ -60,64 +64,14 @@ var InlineCheckbox = /*#__PURE__*/React__default.forwardRef(function InlineCheck
|
|
|
60
64
|
React__default.createElement("label", {
|
|
61
65
|
htmlFor: id,
|
|
62
66
|
className: "".concat(prefix, "--checkbox-label"),
|
|
63
|
-
"aria-label": ariaLabel,
|
|
67
|
+
"aria-label": deprecatedAriaLabel || ariaLabel,
|
|
64
68
|
title: title,
|
|
65
69
|
onClick: function onClick(evt) {
|
|
66
70
|
evt.stopPropagation();
|
|
67
71
|
}
|
|
68
72
|
}));
|
|
69
73
|
});
|
|
70
|
-
InlineCheckbox.propTypes = {
|
|
71
|
-
/**
|
|
72
|
-
* Specify the label for the control
|
|
73
|
-
*/
|
|
74
|
-
ariaLabel: PropTypes.string.isRequired,
|
|
75
|
-
|
|
76
|
-
/**
|
|
77
|
-
* Specify whether the underlying control is checked, or not
|
|
78
|
-
*/
|
|
79
|
-
checked: PropTypes.bool,
|
|
80
|
-
|
|
81
|
-
/**
|
|
82
|
-
* Specify whether the underlying input control should be disabled
|
|
83
|
-
*/
|
|
84
|
-
disabled: PropTypes.bool,
|
|
85
|
-
|
|
86
|
-
/**
|
|
87
|
-
* Provide an `id` for the underlying input control
|
|
88
|
-
*/
|
|
89
|
-
id: PropTypes.string.isRequired,
|
|
90
|
-
|
|
91
|
-
/**
|
|
92
|
-
* Specify whether the control is in an indterminate state
|
|
93
|
-
*/
|
|
94
|
-
indeterminate: PropTypes.bool,
|
|
95
|
-
|
|
96
|
-
/**
|
|
97
|
-
* Provide a `name` for the underlying input control
|
|
98
|
-
*/
|
|
99
|
-
name: PropTypes.string.isRequired,
|
|
100
|
-
|
|
101
|
-
/**
|
|
102
|
-
* Provide an optional hook that is called each time the input is updated
|
|
103
|
-
*/
|
|
104
|
-
onChange: PropTypes.func,
|
|
105
|
-
|
|
106
|
-
/**
|
|
107
|
-
* Provide a handler that is invoked when a user clicks on the control
|
|
108
|
-
*/
|
|
109
|
-
onClick: PropTypes.func,
|
|
110
|
-
|
|
111
|
-
/**
|
|
112
|
-
* Provide a handler that is invoked on the key down event for the control
|
|
113
|
-
*/
|
|
114
|
-
onKeyDown: PropTypes.func,
|
|
115
|
-
|
|
116
|
-
/**
|
|
117
|
-
* Provide an optional tooltip for the InlineCheckbox
|
|
118
|
-
*/
|
|
119
|
-
title: PropTypes.string
|
|
120
|
-
};
|
|
74
|
+
InlineCheckbox.propTypes = (_InlineCheckbox$propT = {}, _defineProperty(_InlineCheckbox$propT, 'aria-label', PropTypes.string.isRequired), _defineProperty(_InlineCheckbox$propT, "ariaLabel", deprecate(PropTypes.string.isRequired, 'The `ariaLabel` prop has been deprecated in favor of `aria-label`. This prop will be removed in the next major release.')), _defineProperty(_InlineCheckbox$propT, "checked", PropTypes.bool), _defineProperty(_InlineCheckbox$propT, "disabled", PropTypes.bool), _defineProperty(_InlineCheckbox$propT, "id", PropTypes.string.isRequired), _defineProperty(_InlineCheckbox$propT, "indeterminate", PropTypes.bool), _defineProperty(_InlineCheckbox$propT, "name", PropTypes.string.isRequired), _defineProperty(_InlineCheckbox$propT, "onChange", PropTypes.func), _defineProperty(_InlineCheckbox$propT, "onClick", PropTypes.func), _defineProperty(_InlineCheckbox$propT, "onKeyDown", PropTypes.func), _defineProperty(_InlineCheckbox$propT, "title", PropTypes.string), _InlineCheckbox$propT);
|
|
121
75
|
var InlineCheckbox$1 = InlineCheckbox;
|
|
122
76
|
|
|
123
77
|
export { InlineCheckbox$1 as default };
|
|
@@ -11,7 +11,7 @@ import cx from 'classnames';
|
|
|
11
11
|
import Downshift from 'downshift';
|
|
12
12
|
import isEqual from 'lodash.isequal';
|
|
13
13
|
import PropTypes from 'prop-types';
|
|
14
|
-
import React__default, { useContext, useState, useRef } from 'react';
|
|
14
|
+
import React__default, { useContext, useState, useRef, useEffect } from 'react';
|
|
15
15
|
import { defaultFilterItems } from '../ComboBox/tools/filter.js';
|
|
16
16
|
import { sortingPropTypes } from './MultiSelectPropTypes.js';
|
|
17
17
|
import ListBox from '../ListBox/index.js';
|
|
@@ -92,7 +92,7 @@ var FilterableMultiSelect = /*#__PURE__*/React__default.forwardRef(function Filt
|
|
|
92
92
|
inputValue = _useState8[0],
|
|
93
93
|
setInputValue = _useState8[1];
|
|
94
94
|
|
|
95
|
-
var _useState9 = useState([]),
|
|
95
|
+
var _useState9 = useState(initialSelectedItems !== null && initialSelectedItems !== void 0 ? initialSelectedItems : []),
|
|
96
96
|
_useState10 = _slicedToArray(_useState9, 2),
|
|
97
97
|
topItems = _useState10[0],
|
|
98
98
|
setTopItems = _useState10[1];
|
|
@@ -107,6 +107,11 @@ var FilterableMultiSelect = /*#__PURE__*/React__default.forwardRef(function Filt
|
|
|
107
107
|
highlightedIndex = _useState14[0],
|
|
108
108
|
setHighlightedIndex = _useState14[1];
|
|
109
109
|
|
|
110
|
+
var _useState15 = useState(initialSelectedItems !== null && initialSelectedItems !== void 0 ? initialSelectedItems : []),
|
|
111
|
+
_useState16 = _slicedToArray(_useState15, 2),
|
|
112
|
+
currentSelectedItems = _useState16[0],
|
|
113
|
+
setCurrentSelectedItems = _useState16[1];
|
|
114
|
+
|
|
110
115
|
var textInput = useRef();
|
|
111
116
|
var filterableMultiSelectInstanceId = useId();
|
|
112
117
|
var enabled = useFeatureFlag('enable-v11-release');
|
|
@@ -131,8 +136,15 @@ var FilterableMultiSelect = /*#__PURE__*/React__default.forwardRef(function Filt
|
|
|
131
136
|
}, helperText) : null;
|
|
132
137
|
var menuId = "".concat(id, "__menu");
|
|
133
138
|
var inputId = "".concat(id, "-input");
|
|
139
|
+
useEffect(function () {
|
|
140
|
+
if (!isOpen) {
|
|
141
|
+
setTopItems(currentSelectedItems);
|
|
142
|
+
}
|
|
143
|
+
}, [currentSelectedItems, isOpen, setTopItems]);
|
|
134
144
|
|
|
135
145
|
function handleOnChange(changes) {
|
|
146
|
+
setCurrentSelectedItems(changes.selectedItems);
|
|
147
|
+
|
|
136
148
|
if (onChange) {
|
|
137
149
|
onChange(changes);
|
|
138
150
|
}
|
|
@@ -151,11 +163,7 @@ var FilterableMultiSelect = /*#__PURE__*/React__default.forwardRef(function Filt
|
|
|
151
163
|
handleOnMenuChange(false);
|
|
152
164
|
}
|
|
153
165
|
|
|
154
|
-
function handleOnStateChange(changes
|
|
155
|
-
if (changes.isOpen && !isOpen) {
|
|
156
|
-
setTopItems(downshift.selectedItem);
|
|
157
|
-
}
|
|
158
|
-
|
|
166
|
+
function handleOnStateChange(changes) {
|
|
159
167
|
var type = changes.type;
|
|
160
168
|
var stateChangeTypes = Downshift.stateChangeTypes;
|
|
161
169
|
|