@carbon/react 1.25.0 → 1.26.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 +91 -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/PasswordInput.d.ts +125 -0
- package/es/components/TextInput/PasswordInput.js +10 -6
- 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 +90 -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/PasswordInput.d.ts +125 -0
- package/lib/components/TextInput/PasswordInput.js +10 -25
- 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
|
@@ -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;
|
|
@@ -32,48 +32,43 @@ var translationKeys = {
|
|
|
32
32
|
buttonDescription: 'carbon.table.header.icon.description'
|
|
33
33
|
};
|
|
34
34
|
|
|
35
|
-
var translateWithId = function translateWithId(key,
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
isSortHeader = _ref.isSortHeader,
|
|
39
|
-
sortStates = _ref.sortStates;
|
|
40
|
-
|
|
41
|
-
if (key === translationKeys.buttonDescription) {
|
|
42
|
-
if (isSortHeader) {
|
|
35
|
+
var translateWithId = function translateWithId(key, args) {
|
|
36
|
+
if (args && key === translationKeys.buttonDescription) {
|
|
37
|
+
if (args.isSortHeader && sortStates.sortStates) {
|
|
43
38
|
// When transitioning, we know that the sequence of states is as follows:
|
|
44
39
|
// NONE -> ASC -> DESC -> NONE
|
|
45
|
-
if (sortDirection === sortStates.NONE) {
|
|
46
|
-
return "Click to sort rows by ".concat(header, " header in ascending order");
|
|
40
|
+
if (args.sortDirection === sortStates.sortStates.NONE) {
|
|
41
|
+
return "Click to sort rows by ".concat(args.header, " header in ascending order");
|
|
47
42
|
}
|
|
48
43
|
|
|
49
|
-
if (sortDirection === sortStates.ASC) {
|
|
50
|
-
return "Click to sort rows by ".concat(header, " header in descending order");
|
|
44
|
+
if (args.sortDirection === sortStates.sortStates.ASC) {
|
|
45
|
+
return "Click to sort rows by ".concat(args.header, " header in descending order");
|
|
51
46
|
}
|
|
52
47
|
|
|
53
|
-
return "Click to unsort rows by ".concat(header, " header");
|
|
48
|
+
return "Click to unsort rows by ".concat(args.header, " header");
|
|
54
49
|
}
|
|
55
50
|
|
|
56
|
-
return "Click to sort rows by ".concat(header, " header in ascending order");
|
|
51
|
+
return "Click to sort rows by ".concat(args.header, " header in ascending order");
|
|
57
52
|
}
|
|
58
53
|
|
|
59
54
|
return '';
|
|
60
55
|
};
|
|
61
56
|
|
|
62
57
|
var sortDirections = (_sortDirections = {}, _rollupPluginBabelHelpers.defineProperty(_sortDirections, sortStates.sortStates.NONE, 'none'), _rollupPluginBabelHelpers.defineProperty(_sortDirections, sortStates.sortStates.ASC, 'ascending'), _rollupPluginBabelHelpers.defineProperty(_sortDirections, sortStates.sortStates.DESC, 'descending'), _sortDirections);
|
|
63
|
-
var TableHeader = /*#__PURE__*/React__default["default"].forwardRef(function TableHeader(
|
|
58
|
+
var TableHeader = /*#__PURE__*/React__default["default"].forwardRef(function TableHeader(_ref, ref) {
|
|
64
59
|
var _cx;
|
|
65
60
|
|
|
66
|
-
var headerClassName =
|
|
67
|
-
children =
|
|
68
|
-
colSpan =
|
|
69
|
-
isSortable =
|
|
70
|
-
isSortHeader =
|
|
71
|
-
onClick =
|
|
72
|
-
scope =
|
|
73
|
-
sortDirection =
|
|
74
|
-
t =
|
|
75
|
-
id =
|
|
76
|
-
rest = _rollupPluginBabelHelpers.objectWithoutProperties(
|
|
61
|
+
var headerClassName = _ref.className,
|
|
62
|
+
children = _ref.children,
|
|
63
|
+
colSpan = _ref.colSpan,
|
|
64
|
+
isSortable = _ref.isSortable,
|
|
65
|
+
isSortHeader = _ref.isSortHeader,
|
|
66
|
+
onClick = _ref.onClick,
|
|
67
|
+
scope = _ref.scope,
|
|
68
|
+
sortDirection = _ref.sortDirection,
|
|
69
|
+
t = _ref.translateWithId,
|
|
70
|
+
id = _ref.id,
|
|
71
|
+
rest = _rollupPluginBabelHelpers.objectWithoutProperties(_ref, _excluded);
|
|
77
72
|
|
|
78
73
|
var prefix = usePrefix.usePrefix();
|
|
79
74
|
var uniqueId = useId.useId('table-sort');
|
|
@@ -91,8 +86,8 @@ var TableHeader = /*#__PURE__*/React__default["default"].forwardRef(function Tab
|
|
|
91
86
|
}
|
|
92
87
|
|
|
93
88
|
var className = cx__default["default"](headerClassName, (_cx = {}, _rollupPluginBabelHelpers.defineProperty(_cx, "".concat(prefix, "--table-sort"), true), _rollupPluginBabelHelpers.defineProperty(_cx, "".concat(prefix, "--table-sort--active"), isSortHeader && sortDirection !== sortStates.sortStates.NONE), _rollupPluginBabelHelpers.defineProperty(_cx, "".concat(prefix, "--table-sort--descending"), isSortHeader && sortDirection === sortStates.sortStates.DESC), _cx));
|
|
94
|
-
var ariaSort = !isSortHeader ? 'none' : sortDirections[sortDirection];
|
|
95
|
-
var sortDescription = t('carbon.table.header.icon.description', {
|
|
89
|
+
var ariaSort = !isSortHeader || !sortDirection ? 'none' : sortDirections[sortDirection];
|
|
90
|
+
var sortDescription = t && t('carbon.table.header.icon.description', {
|
|
96
91
|
header: children,
|
|
97
92
|
sortDirection: sortDirection,
|
|
98
93
|
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;
|
|
@@ -35,7 +35,7 @@ var TableSelectAll = function TableSelectAll(_ref) {
|
|
|
35
35
|
scope: "col",
|
|
36
36
|
className: cx__default["default"]("".concat(prefix, "--table-column-checkbox"), className)
|
|
37
37
|
}, /*#__PURE__*/React__default["default"].createElement(InlineCheckbox["default"], {
|
|
38
|
-
|
|
38
|
+
"aria-label": ariaLabel,
|
|
39
39
|
checked: checked,
|
|
40
40
|
id: id,
|
|
41
41
|
indeterminate: indeterminate,
|
|
@@ -49,9 +49,7 @@ var TableSelectRow = function TableSelectRow(_ref) {
|
|
|
49
49
|
}, /*#__PURE__*/React__default["default"].createElement(InlineInputComponent, _rollupPluginBabelHelpers["extends"]({}, selectionInputProps, radio && {
|
|
50
50
|
labelText: ariaLabel,
|
|
51
51
|
hideLabel: true
|
|
52
|
-
}, !radio && {
|
|
53
|
-
ariaLabel: ariaLabel
|
|
54
|
-
})));
|
|
52
|
+
}, !radio && _rollupPluginBabelHelpers.defineProperty({}, 'aria-label', ariaLabel))));
|
|
55
53
|
};
|
|
56
54
|
|
|
57
55
|
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
|
};
|
|
@@ -14,6 +14,7 @@ var cx = require('classnames');
|
|
|
14
14
|
var PropTypes = require('prop-types');
|
|
15
15
|
var React = require('react');
|
|
16
16
|
var Search = require('../Search/Search.js');
|
|
17
|
+
require('../Search/Search.Skeleton.js');
|
|
17
18
|
var instanceId = require('./tools/instanceId.js');
|
|
18
19
|
var usePrefix = require('../../internal/usePrefix.js');
|
|
19
20
|
|
|
@@ -13,6 +13,7 @@ var _rollupPluginBabelHelpers = require('../../_virtual/_rollupPluginBabelHelper
|
|
|
13
13
|
var React = require('react');
|
|
14
14
|
var cx = require('classnames');
|
|
15
15
|
var Search = require('../Search/Search.js');
|
|
16
|
+
require('../Search/Search.Skeleton.js');
|
|
16
17
|
var usePrefix = require('../../internal/usePrefix.js');
|
|
17
18
|
var events = require('../../tools/events.js');
|
|
18
19
|
|
|
@@ -99,11 +99,13 @@ function FileUploaderButton(_ref) {
|
|
|
99
99
|
|
|
100
100
|
function onClick(event) {
|
|
101
101
|
event.target.value = null;
|
|
102
|
+
inputNode.current.value = '';
|
|
102
103
|
inputNode.current.click();
|
|
103
104
|
}
|
|
104
105
|
|
|
105
106
|
function onKeyDown(event) {
|
|
106
107
|
if (match.matches(event, [keys.Enter, keys.Space])) {
|
|
108
|
+
inputNode.current.value = '';
|
|
107
109
|
inputNode.current.click();
|
|
108
110
|
}
|
|
109
111
|
}
|
|
@@ -9,8 +9,10 @@
|
|
|
9
9
|
|
|
10
10
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
11
11
|
|
|
12
|
+
var _rollupPluginBabelHelpers = require('../../_virtual/_rollupPluginBabelHelpers.js');
|
|
12
13
|
var PropTypes = require('prop-types');
|
|
13
14
|
var React = require('react');
|
|
15
|
+
var deprecate = require('../../prop-types/deprecate.js');
|
|
14
16
|
var usePrefix = require('../../internal/usePrefix.js');
|
|
15
17
|
var useMergedRefs = require('../../internal/useMergedRefs.js');
|
|
16
18
|
|
|
@@ -19,10 +21,12 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
|
19
21
|
var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
|
|
20
22
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
21
23
|
|
|
24
|
+
var _InlineCheckbox$propT;
|
|
22
25
|
/** @type any */
|
|
23
26
|
|
|
24
27
|
var InlineCheckbox = /*#__PURE__*/React__default["default"].forwardRef(function InlineCheckbox(props, forwardRef) {
|
|
25
|
-
var ariaLabel = props
|
|
28
|
+
var ariaLabel = props['aria-label'],
|
|
29
|
+
deprecatedAriaLabel = props.ariaLabel,
|
|
26
30
|
_props$checked = props.checked,
|
|
27
31
|
checked = _props$checked === void 0 ? false : _props$checked,
|
|
28
32
|
disabled = props.disabled,
|
|
@@ -69,64 +73,14 @@ var InlineCheckbox = /*#__PURE__*/React__default["default"].forwardRef(function
|
|
|
69
73
|
React__default["default"].createElement("label", {
|
|
70
74
|
htmlFor: id,
|
|
71
75
|
className: "".concat(prefix, "--checkbox-label"),
|
|
72
|
-
"aria-label": ariaLabel,
|
|
76
|
+
"aria-label": deprecatedAriaLabel || ariaLabel,
|
|
73
77
|
title: title,
|
|
74
78
|
onClick: function onClick(evt) {
|
|
75
79
|
evt.stopPropagation();
|
|
76
80
|
}
|
|
77
81
|
}));
|
|
78
82
|
});
|
|
79
|
-
InlineCheckbox.propTypes = {
|
|
80
|
-
/**
|
|
81
|
-
* Specify the label for the control
|
|
82
|
-
*/
|
|
83
|
-
ariaLabel: PropTypes__default["default"].string.isRequired,
|
|
84
|
-
|
|
85
|
-
/**
|
|
86
|
-
* Specify whether the underlying control is checked, or not
|
|
87
|
-
*/
|
|
88
|
-
checked: PropTypes__default["default"].bool,
|
|
89
|
-
|
|
90
|
-
/**
|
|
91
|
-
* Specify whether the underlying input control should be disabled
|
|
92
|
-
*/
|
|
93
|
-
disabled: PropTypes__default["default"].bool,
|
|
94
|
-
|
|
95
|
-
/**
|
|
96
|
-
* Provide an `id` for the underlying input control
|
|
97
|
-
*/
|
|
98
|
-
id: PropTypes__default["default"].string.isRequired,
|
|
99
|
-
|
|
100
|
-
/**
|
|
101
|
-
* Specify whether the control is in an indterminate state
|
|
102
|
-
*/
|
|
103
|
-
indeterminate: PropTypes__default["default"].bool,
|
|
104
|
-
|
|
105
|
-
/**
|
|
106
|
-
* Provide a `name` for the underlying input control
|
|
107
|
-
*/
|
|
108
|
-
name: PropTypes__default["default"].string.isRequired,
|
|
109
|
-
|
|
110
|
-
/**
|
|
111
|
-
* Provide an optional hook that is called each time the input is updated
|
|
112
|
-
*/
|
|
113
|
-
onChange: PropTypes__default["default"].func,
|
|
114
|
-
|
|
115
|
-
/**
|
|
116
|
-
* Provide a handler that is invoked when a user clicks on the control
|
|
117
|
-
*/
|
|
118
|
-
onClick: PropTypes__default["default"].func,
|
|
119
|
-
|
|
120
|
-
/**
|
|
121
|
-
* Provide a handler that is invoked on the key down event for the control
|
|
122
|
-
*/
|
|
123
|
-
onKeyDown: PropTypes__default["default"].func,
|
|
124
|
-
|
|
125
|
-
/**
|
|
126
|
-
* Provide an optional tooltip for the InlineCheckbox
|
|
127
|
-
*/
|
|
128
|
-
title: PropTypes__default["default"].string
|
|
129
|
-
};
|
|
83
|
+
InlineCheckbox.propTypes = (_InlineCheckbox$propT = {}, _rollupPluginBabelHelpers.defineProperty(_InlineCheckbox$propT, 'aria-label', PropTypes__default["default"].string.isRequired), _rollupPluginBabelHelpers.defineProperty(_InlineCheckbox$propT, "ariaLabel", deprecate["default"](PropTypes__default["default"].string.isRequired, 'The `ariaLabel` prop has been deprecated in favor of `aria-label`. This prop will be removed in the next major release.')), _rollupPluginBabelHelpers.defineProperty(_InlineCheckbox$propT, "checked", PropTypes__default["default"].bool), _rollupPluginBabelHelpers.defineProperty(_InlineCheckbox$propT, "disabled", PropTypes__default["default"].bool), _rollupPluginBabelHelpers.defineProperty(_InlineCheckbox$propT, "id", PropTypes__default["default"].string.isRequired), _rollupPluginBabelHelpers.defineProperty(_InlineCheckbox$propT, "indeterminate", PropTypes__default["default"].bool), _rollupPluginBabelHelpers.defineProperty(_InlineCheckbox$propT, "name", PropTypes__default["default"].string.isRequired), _rollupPluginBabelHelpers.defineProperty(_InlineCheckbox$propT, "onChange", PropTypes__default["default"].func), _rollupPluginBabelHelpers.defineProperty(_InlineCheckbox$propT, "onClick", PropTypes__default["default"].func), _rollupPluginBabelHelpers.defineProperty(_InlineCheckbox$propT, "onKeyDown", PropTypes__default["default"].func), _rollupPluginBabelHelpers.defineProperty(_InlineCheckbox$propT, "title", PropTypes__default["default"].string), _InlineCheckbox$propT);
|
|
130
84
|
var InlineCheckbox$1 = InlineCheckbox;
|
|
131
85
|
|
|
132
86
|
exports["default"] = InlineCheckbox$1;
|
|
@@ -104,7 +104,7 @@ var FilterableMultiSelect = /*#__PURE__*/React__default["default"].forwardRef(fu
|
|
|
104
104
|
inputValue = _useState8[0],
|
|
105
105
|
setInputValue = _useState8[1];
|
|
106
106
|
|
|
107
|
-
var _useState9 = React.useState([]),
|
|
107
|
+
var _useState9 = React.useState(initialSelectedItems !== null && initialSelectedItems !== void 0 ? initialSelectedItems : []),
|
|
108
108
|
_useState10 = _rollupPluginBabelHelpers.slicedToArray(_useState9, 2),
|
|
109
109
|
topItems = _useState10[0],
|
|
110
110
|
setTopItems = _useState10[1];
|
|
@@ -119,6 +119,11 @@ var FilterableMultiSelect = /*#__PURE__*/React__default["default"].forwardRef(fu
|
|
|
119
119
|
highlightedIndex = _useState14[0],
|
|
120
120
|
setHighlightedIndex = _useState14[1];
|
|
121
121
|
|
|
122
|
+
var _useState15 = React.useState(initialSelectedItems !== null && initialSelectedItems !== void 0 ? initialSelectedItems : []),
|
|
123
|
+
_useState16 = _rollupPluginBabelHelpers.slicedToArray(_useState15, 2),
|
|
124
|
+
currentSelectedItems = _useState16[0],
|
|
125
|
+
setCurrentSelectedItems = _useState16[1];
|
|
126
|
+
|
|
122
127
|
var textInput = React.useRef();
|
|
123
128
|
var filterableMultiSelectInstanceId = useId.useId();
|
|
124
129
|
var enabled = index.useFeatureFlag('enable-v11-release');
|
|
@@ -143,8 +148,15 @@ var FilterableMultiSelect = /*#__PURE__*/React__default["default"].forwardRef(fu
|
|
|
143
148
|
}, helperText) : null;
|
|
144
149
|
var menuId = "".concat(id, "__menu");
|
|
145
150
|
var inputId = "".concat(id, "-input");
|
|
151
|
+
React.useEffect(function () {
|
|
152
|
+
if (!isOpen) {
|
|
153
|
+
setTopItems(currentSelectedItems);
|
|
154
|
+
}
|
|
155
|
+
}, [currentSelectedItems, isOpen, setTopItems]);
|
|
146
156
|
|
|
147
157
|
function handleOnChange(changes) {
|
|
158
|
+
setCurrentSelectedItems(changes.selectedItems);
|
|
159
|
+
|
|
148
160
|
if (onChange) {
|
|
149
161
|
onChange(changes);
|
|
150
162
|
}
|
|
@@ -163,11 +175,7 @@ var FilterableMultiSelect = /*#__PURE__*/React__default["default"].forwardRef(fu
|
|
|
163
175
|
handleOnMenuChange(false);
|
|
164
176
|
}
|
|
165
177
|
|
|
166
|
-
function handleOnStateChange(changes
|
|
167
|
-
if (changes.isOpen && !isOpen) {
|
|
168
|
-
setTopItems(downshift.selectedItem);
|
|
169
|
-
}
|
|
170
|
-
|
|
178
|
+
function handleOnStateChange(changes) {
|
|
171
179
|
var type = changes.type;
|
|
172
180
|
var stateChangeTypes = Downshift__default["default"].stateChangeTypes;
|
|
173
181
|
|
|
@@ -47,7 +47,6 @@ var _ref = Downshift.useSelect.stateChangeTypes,
|
|
|
47
47
|
MenuBlur = _ref.MenuBlur,
|
|
48
48
|
MenuKeyDownArrowDown = _ref.MenuKeyDownArrowDown,
|
|
49
49
|
MenuKeyDownArrowUp = _ref.MenuKeyDownArrowUp,
|
|
50
|
-
MenuKeyDownEnter = _ref.MenuKeyDownEnter,
|
|
51
50
|
MenuKeyDownEscape = _ref.MenuKeyDownEscape,
|
|
52
51
|
MenuKeyDownSpaceButton = _ref.MenuKeyDownSpaceButton,
|
|
53
52
|
ToggleButtonClick = _ref.ToggleButtonClick;
|
|
@@ -247,7 +246,6 @@ var MultiSelect = /*#__PURE__*/React__default["default"].forwardRef(function Mul
|
|
|
247
246
|
switch (type) {
|
|
248
247
|
case ItemClick:
|
|
249
248
|
case MenuKeyDownSpaceButton:
|
|
250
|
-
case MenuKeyDownEnter:
|
|
251
249
|
if (changes.selectedItem === undefined) {
|
|
252
250
|
break;
|
|
253
251
|
}
|
|
@@ -525,13 +525,21 @@ function disableWheel(e) {
|
|
|
525
525
|
}
|
|
526
526
|
/**
|
|
527
527
|
* Clamp the given value between the upper bound `max` and the lower bound `min`
|
|
528
|
+
*
|
|
529
|
+
* 16 digit min/max more precise than Infinity. Somewhere in 9 quadrillion,
|
|
530
|
+
* there will be integer display issues at runtime. 9quad is a safe cutoff.
|
|
528
531
|
* @param {number} max
|
|
529
532
|
* @param {number} min
|
|
530
533
|
* @param {number} value
|
|
531
534
|
*/
|
|
532
535
|
|
|
533
536
|
|
|
534
|
-
|
|
537
|
+
var boundLimit = 9000000000000000; // 16 digit, 9 quadrillion
|
|
538
|
+
|
|
539
|
+
function clamp() {
|
|
540
|
+
var max = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : boundLimit;
|
|
541
|
+
var min = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : -boundLimit;
|
|
542
|
+
var value = arguments.length > 2 ? arguments[2] : undefined;
|
|
535
543
|
return Math.min(max, Math.max(min, value));
|
|
536
544
|
}
|
|
537
545
|
|
|
@@ -0,0 +1,25 @@
|
|
|
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 React from 'react';
|
|
9
|
+
export interface RadioButtonSkeletonProps extends React.InputHTMLAttributes<HTMLInputElement> {
|
|
10
|
+
/**
|
|
11
|
+
* Specify an optional className to add.
|
|
12
|
+
*/
|
|
13
|
+
className?: string;
|
|
14
|
+
}
|
|
15
|
+
declare function RadioButtonSkeleton(props: RadioButtonSkeletonProps): JSX.Element;
|
|
16
|
+
declare namespace RadioButtonSkeleton {
|
|
17
|
+
var propTypes: {
|
|
18
|
+
/**
|
|
19
|
+
* Specify an optional className to add.
|
|
20
|
+
*/
|
|
21
|
+
className: PropTypes.Requireable<string>;
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
export default RadioButtonSkeleton;
|
|
25
|
+
export { RadioButtonSkeleton };
|
|
@@ -23,9 +23,9 @@ var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
|
|
|
23
23
|
|
|
24
24
|
var _excluded = ["className"];
|
|
25
25
|
|
|
26
|
-
function RadioButtonSkeleton(
|
|
27
|
-
var className =
|
|
28
|
-
rest = _rollupPluginBabelHelpers.objectWithoutProperties(
|
|
26
|
+
function RadioButtonSkeleton(props) {
|
|
27
|
+
var className = props.className,
|
|
28
|
+
rest = _rollupPluginBabelHelpers.objectWithoutProperties(props, _excluded);
|
|
29
29
|
|
|
30
30
|
var prefix = usePrefix.usePrefix();
|
|
31
31
|
return /*#__PURE__*/React__default["default"].createElement("div", _rollupPluginBabelHelpers["extends"]({
|
|
@@ -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 { ReactNodeLike } from 'prop-types';
|
|
8
|
+
import React from 'react';
|
|
9
|
+
type ExcludedAttributes = 'onChange';
|
|
10
|
+
export interface RadioButtonProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, ExcludedAttributes> {
|
|
11
|
+
/**
|
|
12
|
+
* Specify whether the `<RadioButton>` is currently checked
|
|
13
|
+
*/
|
|
14
|
+
checked?: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Provide an optional className to be applied to the containing node
|
|
17
|
+
*/
|
|
18
|
+
className?: string;
|
|
19
|
+
/**
|
|
20
|
+
* Specify whether the `<RadioButton>` should be checked by default
|
|
21
|
+
*/
|
|
22
|
+
defaultChecked?: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Specify whether the control is disabled
|
|
25
|
+
*/
|
|
26
|
+
disabled?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Specify whether the label should be hidden, or not
|
|
29
|
+
*/
|
|
30
|
+
hideLabel?: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Provide a unique id for the underlying `<input>` node
|
|
33
|
+
*/
|
|
34
|
+
id?: string;
|
|
35
|
+
/**
|
|
36
|
+
* Provide where label text should be placed
|
|
37
|
+
* NOTE: `top`/`bottom` are deprecated
|
|
38
|
+
*/
|
|
39
|
+
labelPosition?: 'left' | 'right';
|
|
40
|
+
/**
|
|
41
|
+
* Provide label text to be read by screen readers when interacting with the
|
|
42
|
+
* control
|
|
43
|
+
*/
|
|
44
|
+
labelText: ReactNodeLike;
|
|
45
|
+
/**
|
|
46
|
+
* Provide a name for the underlying `<input>` node
|
|
47
|
+
*/
|
|
48
|
+
name?: string;
|
|
49
|
+
/**
|
|
50
|
+
* Provide an optional `onChange` hook that is called each time the value of
|
|
51
|
+
* the underlying `<input>` changes
|
|
52
|
+
*/
|
|
53
|
+
onChange?: (value: string | number, name: string | undefined, event: any) => void;
|
|
54
|
+
/**
|
|
55
|
+
* Provide a handler that is invoked when a user clicks on the control
|
|
56
|
+
*/
|
|
57
|
+
onClick?: (evt: React.MouseEvent<HTMLInputElement>) => void;
|
|
58
|
+
/**
|
|
59
|
+
* Specify the value of the `<RadioButton>`
|
|
60
|
+
*/
|
|
61
|
+
value?: string | number;
|
|
62
|
+
}
|
|
63
|
+
declare const RadioButton: React.ForwardRefExoticComponent<RadioButtonProps & React.RefAttributes<unknown>>;
|
|
64
|
+
export default RadioButton;
|
|
@@ -16,6 +16,7 @@ var cx = require('classnames');
|
|
|
16
16
|
require('../Text/index.js');
|
|
17
17
|
var usePrefix = require('../../internal/usePrefix.js');
|
|
18
18
|
var useId = require('../../internal/useId.js');
|
|
19
|
+
var mergeRefs = require('../../tools/mergeRefs.js');
|
|
19
20
|
var Text = require('../Text/Text.js');
|
|
20
21
|
|
|
21
22
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
@@ -25,21 +26,21 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
|
25
26
|
var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
|
|
26
27
|
|
|
27
28
|
var _excluded = ["className", "disabled", "hideLabel", "id", "labelPosition", "labelText", "name", "onChange", "value"];
|
|
28
|
-
var RadioButton = /*#__PURE__*/React__default["default"].forwardRef(function
|
|
29
|
-
var className =
|
|
30
|
-
disabled =
|
|
31
|
-
hideLabel =
|
|
32
|
-
id =
|
|
33
|
-
|
|
34
|
-
labelPosition =
|
|
35
|
-
|
|
36
|
-
labelText =
|
|
37
|
-
name =
|
|
38
|
-
|
|
39
|
-
onChange =
|
|
40
|
-
|
|
41
|
-
value =
|
|
42
|
-
rest = _rollupPluginBabelHelpers.objectWithoutProperties(
|
|
29
|
+
var RadioButton = /*#__PURE__*/React__default["default"].forwardRef(function (props, ref) {
|
|
30
|
+
var className = props.className,
|
|
31
|
+
disabled = props.disabled,
|
|
32
|
+
hideLabel = props.hideLabel,
|
|
33
|
+
id = props.id,
|
|
34
|
+
_props$labelPosition = props.labelPosition,
|
|
35
|
+
labelPosition = _props$labelPosition === void 0 ? 'right' : _props$labelPosition,
|
|
36
|
+
_props$labelText = props.labelText,
|
|
37
|
+
labelText = _props$labelText === void 0 ? '' : _props$labelText,
|
|
38
|
+
name = props.name,
|
|
39
|
+
_props$onChange = props.onChange,
|
|
40
|
+
onChange = _props$onChange === void 0 ? function () {} : _props$onChange,
|
|
41
|
+
_props$value = props.value,
|
|
42
|
+
value = _props$value === void 0 ? '' : _props$value,
|
|
43
|
+
rest = _rollupPluginBabelHelpers.objectWithoutProperties(props, _excluded);
|
|
43
44
|
|
|
44
45
|
var prefix = usePrefix.usePrefix();
|
|
45
46
|
var uid = useId.useId('radio-button');
|
|
@@ -51,6 +52,7 @@ var RadioButton = /*#__PURE__*/React__default["default"].forwardRef(function Rad
|
|
|
51
52
|
|
|
52
53
|
var innerLabelClasses = cx__default["default"]("".concat(prefix, "--radio-button__label-text"), _rollupPluginBabelHelpers.defineProperty({}, "".concat(prefix, "--visually-hidden"), hideLabel));
|
|
53
54
|
var wrapperClasses = cx__default["default"](className, "".concat(prefix, "--radio-button-wrapper"), _rollupPluginBabelHelpers.defineProperty({}, "".concat(prefix, "--radio-button-wrapper--label-").concat(labelPosition), labelPosition !== 'right'));
|
|
55
|
+
var inputRef = React.useRef(null);
|
|
54
56
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
55
57
|
className: wrapperClasses
|
|
56
58
|
}, /*#__PURE__*/React__default["default"].createElement("input", _rollupPluginBabelHelpers["extends"]({}, rest, {
|
|
@@ -58,7 +60,7 @@ var RadioButton = /*#__PURE__*/React__default["default"].forwardRef(function Rad
|
|
|
58
60
|
className: "".concat(prefix, "--radio-button"),
|
|
59
61
|
onChange: handleOnChange,
|
|
60
62
|
id: uniqueId,
|
|
61
|
-
ref: ref,
|
|
63
|
+
ref: mergeRefs["default"](inputRef, ref),
|
|
62
64
|
disabled: disabled,
|
|
63
65
|
value: value,
|
|
64
66
|
name: name
|