@carbon/react 1.41.1 → 1.42.0-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.playwright/INTERNAL_AVT_REPORT_DO_NOT_USE.json +720 -652
- package/es/components/Breadcrumb/Breadcrumb.Skeleton.d.ts +25 -0
- package/es/components/Breadcrumb/Breadcrumb.d.ts +24 -0
- package/es/components/Breadcrumb/Breadcrumb.js +1 -2
- package/es/components/Breadcrumb/BreadcrumbItem.d.ts +25 -0
- package/es/components/Breadcrumb/BreadcrumbItem.js +8 -7
- package/es/components/ComboBox/ComboBox.d.ts +7 -1
- package/es/components/ComboBox/ComboBox.js +30 -2
- package/es/components/ContentSwitcher/ContentSwitcher.d.ts +1 -1
- package/es/components/DataTable/TableBatchAction.d.ts +46 -0
- package/es/components/DataTable/TableBatchAction.js +1 -2
- package/es/components/DataTable/TableExpandRow.d.ts +2 -46
- package/es/components/DataTable/TableExpandRow.js +6 -2
- package/es/components/Dropdown/Dropdown.d.ts +1 -1
- package/es/components/FileUploader/FileUploaderDropContainer.d.ts +1 -1
- package/es/components/Notification/Notification.d.ts +8 -8
- package/es/components/Tabs/Tabs.js +1 -2
- package/es/components/TreeView/TreeNode.js +7 -4
- package/es/components/UIShell/HeaderMenu.js +2 -2
- package/es/components/UIShell/SideNav.d.ts +1 -1
- package/es/components/UIShell/SideNavFooter.d.ts +52 -0
- package/es/components/UIShell/SideNavFooter.js +0 -1
- package/es/components/UIShell/SideNavItem.d.ts +24 -0
- package/es/components/UIShell/SideNavItem.js +2 -2
- package/es/components/UIShell/SideNavMenu.js +4 -5
- package/es/components/UIShell/SideNavMenuItem.d.ts +25 -0
- package/es/components/UIShell/SideNavMenuItem.js +1 -2
- package/es/index.js +1 -1
- package/icons/index.d.ts +7 -0
- package/lib/components/Breadcrumb/Breadcrumb.Skeleton.d.ts +25 -0
- package/lib/components/Breadcrumb/Breadcrumb.d.ts +24 -0
- package/lib/components/Breadcrumb/Breadcrumb.js +1 -2
- package/lib/components/Breadcrumb/BreadcrumbItem.d.ts +25 -0
- package/lib/components/Breadcrumb/BreadcrumbItem.js +8 -7
- package/lib/components/ComboBox/ComboBox.d.ts +7 -1
- package/lib/components/ComboBox/ComboBox.js +30 -2
- package/lib/components/ContentSwitcher/ContentSwitcher.d.ts +1 -1
- package/lib/components/DataTable/TableBatchAction.d.ts +46 -0
- package/lib/components/DataTable/TableBatchAction.js +1 -2
- package/lib/components/DataTable/TableExpandRow.d.ts +2 -46
- package/lib/components/DataTable/TableExpandRow.js +6 -2
- package/lib/components/Dropdown/Dropdown.d.ts +1 -1
- package/lib/components/FileUploader/FileUploaderDropContainer.d.ts +1 -1
- package/lib/components/Notification/Notification.d.ts +8 -8
- package/lib/components/Tabs/Tabs.js +1 -2
- package/lib/components/TreeView/TreeNode.js +7 -4
- package/lib/components/UIShell/HeaderMenu.js +2 -2
- package/lib/components/UIShell/SideNav.d.ts +1 -1
- package/lib/components/UIShell/SideNavFooter.d.ts +52 -0
- package/lib/components/UIShell/SideNavFooter.js +0 -1
- package/lib/components/UIShell/SideNavItem.d.ts +24 -0
- package/lib/components/UIShell/SideNavItem.js +2 -2
- package/lib/components/UIShell/SideNavMenu.js +4 -5
- package/lib/components/UIShell/SideNavMenuItem.d.ts +25 -0
- package/lib/components/UIShell/SideNavMenuItem.js +1 -2
- package/lib/index.js +2 -2
- package/package.json +8 -7
|
@@ -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
|
+
interface SideNavItemProps {
|
|
9
|
+
/**
|
|
10
|
+
* Provide a single icon as the child to `SideNavItem` to render in the
|
|
11
|
+
* container
|
|
12
|
+
*/
|
|
13
|
+
children: React.ReactNode;
|
|
14
|
+
/**
|
|
15
|
+
* Provide an optional class to be applied to the containing node
|
|
16
|
+
*/
|
|
17
|
+
className?: string;
|
|
18
|
+
/**
|
|
19
|
+
* Specify if this is a large variation of the SideNavItem
|
|
20
|
+
*/
|
|
21
|
+
large?: boolean;
|
|
22
|
+
}
|
|
23
|
+
declare const SideNavItem: React.FC<SideNavItemProps>;
|
|
24
|
+
export default SideNavItem;
|
|
@@ -10,7 +10,7 @@ import PropTypes from 'prop-types';
|
|
|
10
10
|
import React__default from 'react';
|
|
11
11
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
const SideNavItem = _ref => {
|
|
14
14
|
let {
|
|
15
15
|
className: customClassName,
|
|
16
16
|
children,
|
|
@@ -25,7 +25,7 @@ function SideNavItem(_ref) {
|
|
|
25
25
|
return /*#__PURE__*/React__default.createElement("li", {
|
|
26
26
|
className: className
|
|
27
27
|
}, children);
|
|
28
|
-
}
|
|
28
|
+
};
|
|
29
29
|
SideNavItem.propTypes = {
|
|
30
30
|
/**
|
|
31
31
|
* Provide a single icon as the child to `SideNavItem` to render in the
|
|
@@ -34,7 +34,7 @@ const SideNavMenu = /*#__PURE__*/React__default.forwardRef(function SideNavMenu(
|
|
|
34
34
|
const [prevExpanded, setPrevExpanded] = useState(defaultExpanded);
|
|
35
35
|
const className = cx({
|
|
36
36
|
[`${prefix}--side-nav__item`]: true,
|
|
37
|
-
[`${prefix}--side-nav__item--active`]: isActive ||
|
|
37
|
+
[`${prefix}--side-nav__item--active`]: isActive || hasActiveDescendant(children) && !isExpanded,
|
|
38
38
|
[`${prefix}--side-nav__item--icon`]: IconElement,
|
|
39
39
|
[`${prefix}--side-nav__item--large`]: large,
|
|
40
40
|
[customClassName]: !!customClassName
|
|
@@ -66,8 +66,7 @@ const SideNavMenu = /*#__PURE__*/React__default.forwardRef(function SideNavMenu(
|
|
|
66
66
|
type: "button",
|
|
67
67
|
tabIndex: tabIndex === undefined ? !isSideNavExpanded && !isRail ? -1 : 0 : tabIndex
|
|
68
68
|
}, IconElement && /*#__PURE__*/React__default.createElement(SideNavIcon, null, /*#__PURE__*/React__default.createElement(IconElement, null)), /*#__PURE__*/React__default.createElement("span", {
|
|
69
|
-
className: `${prefix}--side-nav__submenu-title
|
|
70
|
-
title: title
|
|
69
|
+
className: `${prefix}--side-nav__submenu-title`
|
|
71
70
|
}, title), /*#__PURE__*/React__default.createElement(SideNavIcon, {
|
|
72
71
|
className: `${prefix}--side-nav__submenu-chevron`,
|
|
73
72
|
small: true
|
|
@@ -127,7 +126,7 @@ SideNavMenu.propTypes = {
|
|
|
127
126
|
Defining the children parameter with the type ReactNode | ReactNode[]. This allows for various possibilities:
|
|
128
127
|
a single element, an array of elements, or null or undefined.
|
|
129
128
|
**/
|
|
130
|
-
function
|
|
129
|
+
function hasActiveDescendant(children) {
|
|
131
130
|
if (Array.isArray(children)) {
|
|
132
131
|
return children.some(child => {
|
|
133
132
|
if (! /*#__PURE__*/React__default.isValidElement(child)) {
|
|
@@ -138,7 +137,7 @@ function hasActiveChild(children) {
|
|
|
138
137
|
safety when accessing their props.
|
|
139
138
|
**/
|
|
140
139
|
const props = child.props;
|
|
141
|
-
if (props.isActive === true || props['aria-current']) {
|
|
140
|
+
if (props.isActive === true || props['aria-current'] || props.children instanceof Array && hasActiveDescendant(props.children)) {
|
|
142
141
|
return true;
|
|
143
142
|
}
|
|
144
143
|
return false;
|
|
@@ -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 React, { HTMLAttributes } from 'react';
|
|
8
|
+
interface SideNavMenuItemProps extends HTMLAttributes<HTMLElement> {
|
|
9
|
+
/**
|
|
10
|
+
* Specify the children to be rendered inside of the `SideNavMenuItem`
|
|
11
|
+
*/
|
|
12
|
+
children?: React.ReactNode;
|
|
13
|
+
/**
|
|
14
|
+
* Provide an optional class to be applied to the containing node
|
|
15
|
+
*/
|
|
16
|
+
className?: string;
|
|
17
|
+
/**
|
|
18
|
+
* Optionally specify whether the link is "active". An active link is one that
|
|
19
|
+
* has an href that is the same as the current page. Can also pass in
|
|
20
|
+
* `aria-current="page"`, as well.
|
|
21
|
+
*/
|
|
22
|
+
isActive?: boolean;
|
|
23
|
+
}
|
|
24
|
+
declare const SideNavMenuItem: React.ForwardRefExoticComponent<SideNavMenuItemProps & React.RefAttributes<HTMLElement>>;
|
|
25
|
+
export default SideNavMenuItem;
|
package/es/index.js
CHANGED
|
@@ -161,7 +161,6 @@ export { default as ModalWrapper } from './components/ModalWrapper/ModalWrapper.
|
|
|
161
161
|
export { default as ProgressIndicatorSkeleton } from './components/ProgressIndicator/ProgressIndicator.Skeleton.js';
|
|
162
162
|
export { default as TextInputSkeleton } from './components/TextInput/TextInput.Skeleton.js';
|
|
163
163
|
export { default as TextInput } from './components/TextInput/TextInput.js';
|
|
164
|
-
export { default as TreeNode } from './components/TreeView/TreeNode.js';
|
|
165
164
|
export { default as TreeView } from './components/TreeView/TreeView.js';
|
|
166
165
|
export { default as ProgressBar } from './components/ProgressBar/ProgressBar.js';
|
|
167
166
|
export { default as unstable__FluidComboBox } from './components/FluidComboBox/FluidComboBox.js';
|
|
@@ -219,4 +218,5 @@ export { default as SkeletonIcon } from './components/SkeletonIcon/SkeletonIcon.
|
|
|
219
218
|
export { default as SliderSkeleton } from './components/Slider/Slider.Skeleton.js';
|
|
220
219
|
export { default as Switch } from './components/Switch/Switch.js';
|
|
221
220
|
export { default as IconSwitch } from './components/Switch/IconSwitch.js';
|
|
221
|
+
export { default as TreeNode } from './components/TreeView/TreeNode.js';
|
|
222
222
|
export { Stack } from './components/Stack/Stack.js';
|
package/icons/index.d.ts
ADDED
|
@@ -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 BreadcrumbSkeletonProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
10
|
+
/**
|
|
11
|
+
* Specify an optional className to add.
|
|
12
|
+
*/
|
|
13
|
+
className?: string;
|
|
14
|
+
}
|
|
15
|
+
declare function BreadcrumbSkeleton({ className, ...rest }: BreadcrumbSkeletonProps): JSX.Element;
|
|
16
|
+
declare namespace BreadcrumbSkeleton {
|
|
17
|
+
var propTypes: {
|
|
18
|
+
/**
|
|
19
|
+
* Specify an optional className to add.
|
|
20
|
+
*/
|
|
21
|
+
className: PropTypes.Requireable<string>;
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
export default BreadcrumbSkeleton;
|
|
25
|
+
export { BreadcrumbSkeleton };
|
|
@@ -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
|
+
import { ForwardRefReturn } from '../../types/common';
|
|
9
|
+
export interface BreadcrumbProps extends React.HTMLAttributes<HTMLElement> {
|
|
10
|
+
/**
|
|
11
|
+
* Specify the label for the breadcrumb container
|
|
12
|
+
*/
|
|
13
|
+
'aria-label'?: string;
|
|
14
|
+
/**
|
|
15
|
+
* Specify an optional className to be applied to the container node
|
|
16
|
+
*/
|
|
17
|
+
className?: string;
|
|
18
|
+
/**
|
|
19
|
+
* Optional prop to omit the trailing slash for the breadcrumbs
|
|
20
|
+
*/
|
|
21
|
+
noTrailingSlash?: boolean;
|
|
22
|
+
}
|
|
23
|
+
declare const Breadcrumb: ForwardRefReturn<HTMLElement, BreadcrumbProps>;
|
|
24
|
+
export default Breadcrumb;
|
|
@@ -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 React, { AriaAttributes } from 'react';
|
|
8
|
+
import { ForwardRefReturn } from '../../types/common';
|
|
9
|
+
export interface BreadcrumbItemProps extends React.HTMLAttributes<HTMLLIElement> {
|
|
10
|
+
'aria-current'?: AriaAttributes['aria-current'];
|
|
11
|
+
/**
|
|
12
|
+
* Specify an optional className to be applied to the container node
|
|
13
|
+
*/
|
|
14
|
+
className?: string;
|
|
15
|
+
/**
|
|
16
|
+
* Optional string representing the link location for the BreadcrumbItem
|
|
17
|
+
*/
|
|
18
|
+
href?: string;
|
|
19
|
+
/**
|
|
20
|
+
* Provide if this breadcrumb item represents the current page
|
|
21
|
+
*/
|
|
22
|
+
isCurrentPage?: boolean;
|
|
23
|
+
}
|
|
24
|
+
declare const BreadcrumbItem: ForwardRefReturn<HTMLLIElement, BreadcrumbItemProps>;
|
|
25
|
+
export default BreadcrumbItem;
|
|
@@ -29,7 +29,7 @@ const BreadcrumbItem = /*#__PURE__*/React__default["default"].forwardRef(functio
|
|
|
29
29
|
let {
|
|
30
30
|
'aria-current': ariaCurrent,
|
|
31
31
|
children,
|
|
32
|
-
className: customClassName,
|
|
32
|
+
className: customClassName = '',
|
|
33
33
|
href,
|
|
34
34
|
isCurrentPage,
|
|
35
35
|
...rest
|
|
@@ -42,13 +42,14 @@ const BreadcrumbItem = /*#__PURE__*/React__default["default"].forwardRef(functio
|
|
|
42
42
|
[`${prefix}--breadcrumb-item--current`]: isCurrentPage && ariaCurrent !== 'page',
|
|
43
43
|
[customClassName]: !!customClassName
|
|
44
44
|
});
|
|
45
|
-
|
|
45
|
+
const child = children;
|
|
46
|
+
if (child.type && child.type.displayName !== undefined && child.type.displayName.includes('OverflowMenu')) {
|
|
46
47
|
const horizontalOverflowIcon = /*#__PURE__*/React__default["default"].createElement(iconsReact.OverflowMenuHorizontal, {
|
|
47
48
|
className: `${prefix}--overflow-menu__icon`
|
|
48
49
|
});
|
|
49
50
|
return /*#__PURE__*/React__default["default"].createElement("li", _rollupPluginBabelHelpers["extends"]({
|
|
50
51
|
className: className
|
|
51
|
-
}, rest), /*#__PURE__*/React__default["default"].cloneElement(
|
|
52
|
+
}, rest), /*#__PURE__*/React__default["default"].cloneElement(child, {
|
|
52
53
|
menuOptionsClass: `${prefix}--breadcrumb-menu-options`,
|
|
53
54
|
menuOffset: {
|
|
54
55
|
top: 10,
|
|
@@ -71,13 +72,14 @@ const BreadcrumbItem = /*#__PURE__*/React__default["default"].forwardRef(functio
|
|
|
71
72
|
return /*#__PURE__*/React__default["default"].createElement("li", _rollupPluginBabelHelpers["extends"]({
|
|
72
73
|
className: className,
|
|
73
74
|
ref: ref
|
|
74
|
-
}, rest), /*#__PURE__*/React__default["default"].cloneElement(
|
|
75
|
+
}, rest), /*#__PURE__*/React__default["default"].cloneElement(child, {
|
|
75
76
|
'aria-current': ariaCurrent,
|
|
76
|
-
className: cx__default["default"](`${prefix}--link`,
|
|
77
|
+
className: cx__default["default"](`${prefix}--link`, child.props.className)
|
|
77
78
|
}));
|
|
78
79
|
});
|
|
79
80
|
BreadcrumbItem.displayName = 'BreadcrumbItem';
|
|
80
81
|
BreadcrumbItem.propTypes = {
|
|
82
|
+
// @ts-expect-error - v12 TODO: BREAKING: This should match AriaAttributes['aria-current']
|
|
81
83
|
'aria-current': PropTypes__default["default"].oneOfType([PropTypes__default["default"].string, PropTypes__default["default"].bool]),
|
|
82
84
|
/**
|
|
83
85
|
* Pass in content that will be inside of the BreadcrumbItem
|
|
@@ -96,6 +98,5 @@ BreadcrumbItem.propTypes = {
|
|
|
96
98
|
*/
|
|
97
99
|
isCurrentPage: PropTypes__default["default"].bool
|
|
98
100
|
};
|
|
99
|
-
var BreadcrumbItem$1 = BreadcrumbItem;
|
|
100
101
|
|
|
101
|
-
exports["default"] = BreadcrumbItem
|
|
102
|
+
exports["default"] = BreadcrumbItem;
|
|
@@ -9,10 +9,16 @@ import { type ComponentProps, type ReactNode, type ComponentType, type ReactElem
|
|
|
9
9
|
import { ListBoxSize } from '../ListBox';
|
|
10
10
|
type ExcludedAttributes = 'id' | 'onChange' | 'onClick' | 'type' | 'size';
|
|
11
11
|
interface OnChangeData<ItemType> {
|
|
12
|
-
selectedItem: ItemType | null;
|
|
12
|
+
selectedItem: ItemType | null | undefined;
|
|
13
|
+
inputValue?: string | null;
|
|
13
14
|
}
|
|
14
15
|
type ItemToStringHandler<ItemType> = (item: ItemType | null) => string;
|
|
15
16
|
export interface ComboBoxProps<ItemType> extends Omit<InputHTMLAttributes<HTMLInputElement>, ExcludedAttributes> {
|
|
17
|
+
/**
|
|
18
|
+
* Specify whether or not the ComboBox should allow a value that is
|
|
19
|
+
* not in the list to be entered in the input
|
|
20
|
+
*/
|
|
21
|
+
allowCustomValue?: boolean;
|
|
16
22
|
/**
|
|
17
23
|
* Specify a label to be read by screen readers on the container node
|
|
18
24
|
* 'aria-label' of the ListBox component.
|
|
@@ -43,7 +43,8 @@ const {
|
|
|
43
43
|
keyDownEscape,
|
|
44
44
|
clickButton,
|
|
45
45
|
blurButton,
|
|
46
|
-
changeInput
|
|
46
|
+
changeInput,
|
|
47
|
+
blurInput
|
|
47
48
|
} = Downshift__default["default"].stateChangeTypes;
|
|
48
49
|
const defaultItemToString = item => {
|
|
49
50
|
if (typeof item === 'string') {
|
|
@@ -121,6 +122,7 @@ const ComboBox = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
121
122
|
translateWithId,
|
|
122
123
|
warn,
|
|
123
124
|
warnText,
|
|
125
|
+
allowCustomValue = false,
|
|
124
126
|
...rest
|
|
125
127
|
} = props;
|
|
126
128
|
const prefix = usePrefix.usePrefix();
|
|
@@ -215,6 +217,17 @@ const ComboBox = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
215
217
|
case changeInput:
|
|
216
218
|
updateHighlightedIndex(getHighlightedIndex(changes));
|
|
217
219
|
break;
|
|
220
|
+
case blurInput:
|
|
221
|
+
if (allowCustomValue) {
|
|
222
|
+
setInputValue(inputValue);
|
|
223
|
+
if (onChange) {
|
|
224
|
+
onChange({
|
|
225
|
+
selectedItem,
|
|
226
|
+
inputValue
|
|
227
|
+
});
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
break;
|
|
218
231
|
}
|
|
219
232
|
};
|
|
220
233
|
const handleToggleClick = isOpen => event => {
|
|
@@ -313,8 +326,18 @@ const ComboBox = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
313
326
|
if (match.match(event, keys.Space)) {
|
|
314
327
|
event.stopPropagation();
|
|
315
328
|
}
|
|
316
|
-
if (match.match(event, keys.Enter) && !inputValue) {
|
|
329
|
+
if (match.match(event, keys.Enter) && (!inputValue || allowCustomValue)) {
|
|
317
330
|
toggleMenu();
|
|
331
|
+
|
|
332
|
+
// Since `onChange` does not normally fire when the menu is closed, we should
|
|
333
|
+
// manually fire it when `allowCustomValue` is provided, the menu is closing,
|
|
334
|
+
// and there is a value.
|
|
335
|
+
if (allowCustomValue && isOpen && inputValue) {
|
|
336
|
+
onChange({
|
|
337
|
+
selectedItem,
|
|
338
|
+
inputValue
|
|
339
|
+
});
|
|
340
|
+
}
|
|
318
341
|
}
|
|
319
342
|
if (match.match(event, keys.Escape) && inputValue) {
|
|
320
343
|
if (event.target === textInput.current && isOpen) {
|
|
@@ -422,6 +445,11 @@ const ComboBox = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
422
445
|
});
|
|
423
446
|
ComboBox.displayName = 'ComboBox';
|
|
424
447
|
ComboBox.propTypes = {
|
|
448
|
+
/**
|
|
449
|
+
* Specify whether or not the ComboBox should allow a value that is
|
|
450
|
+
* not in the list to be entered in the input
|
|
451
|
+
*/
|
|
452
|
+
allowCustomValue: PropTypes__default["default"].bool,
|
|
425
453
|
/**
|
|
426
454
|
* 'aria-label' of the ListBox component.
|
|
427
455
|
* Specify a label to be read by screen readers on the container node
|
|
@@ -40,7 +40,7 @@ export interface ContentSwitcherProps extends Omit<HTMLAttributes<HTMLElement>,
|
|
|
40
40
|
/**
|
|
41
41
|
* Choose whether or not to automatically change selection on focus
|
|
42
42
|
*/
|
|
43
|
-
selectionMode
|
|
43
|
+
selectionMode?: 'automatic' | 'manual';
|
|
44
44
|
/**
|
|
45
45
|
* Specify the size of the Content Switcher. Currently supports either `sm`, 'md' (default) or 'lg` as an option.
|
|
46
46
|
*/
|
|
@@ -0,0 +1,46 @@
|
|
|
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 TableBatchActionProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
10
|
+
/**
|
|
11
|
+
* Specify if the button is an icon-only button
|
|
12
|
+
*/
|
|
13
|
+
hasIconOnly?: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* If specifying the `renderIcon` prop, provide a description for that icon that can
|
|
16
|
+
* be read by screen readers
|
|
17
|
+
*/
|
|
18
|
+
iconDescription?: string;
|
|
19
|
+
/**
|
|
20
|
+
* Optional function to render your own icon in the underlying button
|
|
21
|
+
*/
|
|
22
|
+
renderIcon?: React.ElementType;
|
|
23
|
+
}
|
|
24
|
+
declare const TableBatchAction: {
|
|
25
|
+
({ renderIcon, iconDescription, ...props }: {
|
|
26
|
+
[x: string]: any;
|
|
27
|
+
renderIcon?: import("@carbon/icons-react/lib/CarbonIcon").CarbonIconType | undefined;
|
|
28
|
+
iconDescription?: string | undefined;
|
|
29
|
+
}): JSX.Element;
|
|
30
|
+
propTypes: {
|
|
31
|
+
/**
|
|
32
|
+
* Specify if the button is an icon-only button
|
|
33
|
+
*/
|
|
34
|
+
hasIconOnly: PropTypes.Requireable<boolean>;
|
|
35
|
+
/**
|
|
36
|
+
* If specifying the `renderIcon` prop, provide a description for that icon that can
|
|
37
|
+
* be read by screen readers
|
|
38
|
+
*/
|
|
39
|
+
iconDescription: (props: any) => Error | undefined;
|
|
40
|
+
/**
|
|
41
|
+
* Optional function to render your own icon in the underlying button
|
|
42
|
+
*/
|
|
43
|
+
renderIcon: PropTypes.Requireable<object>;
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
export default TableBatchAction;
|
|
@@ -52,6 +52,5 @@ TableBatchAction.propTypes = {
|
|
|
52
52
|
*/
|
|
53
53
|
renderIcon: PropTypes__default["default"].oneOfType([PropTypes__default["default"].func, PropTypes__default["default"].object])
|
|
54
54
|
};
|
|
55
|
-
var TableBatchAction$1 = TableBatchAction;
|
|
56
55
|
|
|
57
|
-
exports["default"] = TableBatchAction
|
|
56
|
+
exports["default"] = TableBatchAction;
|
|
@@ -4,8 +4,7 @@
|
|
|
4
4
|
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
|
-
import
|
|
8
|
-
import { MouseEventHandler, PropsWithChildren } from 'react';
|
|
7
|
+
import React, { MouseEventHandler, PropsWithChildren } from 'react';
|
|
9
8
|
import { TableRowProps } from './TableRow';
|
|
10
9
|
interface TableExpandRowProps extends PropsWithChildren<TableRowProps> {
|
|
11
10
|
/**
|
|
@@ -41,48 +40,5 @@ interface TableExpandRowProps extends PropsWithChildren<TableRowProps> {
|
|
|
41
40
|
*/
|
|
42
41
|
onExpand: MouseEventHandler<HTMLButtonElement>;
|
|
43
42
|
}
|
|
44
|
-
declare const TableExpandRow:
|
|
45
|
-
({ ["aria-controls"]: ariaControls, ["aria-label"]: ariaLabel, ariaLabel: deprecatedAriaLabel, className: rowClassName, children, isExpanded, onExpand, expandIconDescription, isSelected, expandHeader, ...rest }: TableExpandRowProps): JSX.Element;
|
|
46
|
-
propTypes: {
|
|
47
|
-
/**
|
|
48
|
-
* Space separated list of one or more ID values referencing the TableExpandedRow(s) being controlled by the TableExpandRow
|
|
49
|
-
* TODO: make this required in v12
|
|
50
|
-
*/
|
|
51
|
-
"aria-controls": PropTypes.Requireable<string>;
|
|
52
|
-
/**
|
|
53
|
-
* Specify the string read by a voice reader when the expand trigger is
|
|
54
|
-
* focused
|
|
55
|
-
*/
|
|
56
|
-
"aria-label": PropTypes.Requireable<string>;
|
|
57
|
-
/**
|
|
58
|
-
* Deprecated, please use `aria-label` instead.
|
|
59
|
-
* Specify the string read by a voice reader when the expand trigger is
|
|
60
|
-
* focused
|
|
61
|
-
*/
|
|
62
|
-
ariaLabel: PropTypes.Requireable<string>;
|
|
63
|
-
children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
64
|
-
className: PropTypes.Requireable<string>;
|
|
65
|
-
/**
|
|
66
|
-
* 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
|
|
67
|
-
*/
|
|
68
|
-
expandHeader: PropTypes.Requireable<string>;
|
|
69
|
-
/**
|
|
70
|
-
* The description of the chevron right icon, to be put in its SVG `<title>` element.
|
|
71
|
-
*/
|
|
72
|
-
expandIconDescription: PropTypes.Requireable<string>;
|
|
73
|
-
/**
|
|
74
|
-
* Specify whether this row is expanded or not. This helps coordinate data
|
|
75
|
-
* attributes so that `TableExpandRow` and `TableExpandedRow` work together
|
|
76
|
-
*/
|
|
77
|
-
isExpanded: PropTypes.Validator<boolean>;
|
|
78
|
-
/**
|
|
79
|
-
* Specify if the row is selected
|
|
80
|
-
*/
|
|
81
|
-
isSelected: PropTypes.Requireable<boolean>;
|
|
82
|
-
/**
|
|
83
|
-
* Hook for when a listener initiates a request to expand the given row
|
|
84
|
-
*/
|
|
85
|
-
onExpand: PropTypes.Validator<(...args: any[]) => any>;
|
|
86
|
-
};
|
|
87
|
-
};
|
|
43
|
+
declare const TableExpandRow: React.ForwardRefExoticComponent<TableExpandRowProps & React.RefAttributes<HTMLTableCellElement>>;
|
|
88
44
|
export default TableExpandRow;
|
|
@@ -23,7 +23,7 @@ var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
|
|
|
23
23
|
var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
|
|
24
24
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
25
25
|
|
|
26
|
-
const TableExpandRow = _ref => {
|
|
26
|
+
const TableExpandRow = /*#__PURE__*/React__default["default"].forwardRef((_ref, ref) => {
|
|
27
27
|
let {
|
|
28
28
|
['aria-controls']: ariaControls,
|
|
29
29
|
['aria-label']: ariaLabel,
|
|
@@ -45,6 +45,7 @@ const TableExpandRow = _ref => {
|
|
|
45
45
|
}, rowClassName);
|
|
46
46
|
const previousValue = isExpanded ? 'collapsed' : undefined;
|
|
47
47
|
return /*#__PURE__*/React__default["default"].createElement("tr", _rollupPluginBabelHelpers["extends"]({}, rest, {
|
|
48
|
+
ref: ref,
|
|
48
49
|
className: className,
|
|
49
50
|
"data-parent-row": true
|
|
50
51
|
}), /*#__PURE__*/React__default["default"].createElement(TableCell["default"], {
|
|
@@ -63,17 +64,19 @@ const TableExpandRow = _ref => {
|
|
|
63
64
|
className: `${prefix}--table-expand__svg`,
|
|
64
65
|
"aria-label": expandIconDescription
|
|
65
66
|
}))), children);
|
|
66
|
-
};
|
|
67
|
+
});
|
|
67
68
|
TableExpandRow.propTypes = {
|
|
68
69
|
/**
|
|
69
70
|
* Space separated list of one or more ID values referencing the TableExpandedRow(s) being controlled by the TableExpandRow
|
|
70
71
|
* TODO: make this required in v12
|
|
71
72
|
*/
|
|
73
|
+
/**@ts-ignore*/
|
|
72
74
|
['aria-controls']: PropTypes__default["default"].string,
|
|
73
75
|
/**
|
|
74
76
|
* Specify the string read by a voice reader when the expand trigger is
|
|
75
77
|
* focused
|
|
76
78
|
*/
|
|
79
|
+
/**@ts-ignore*/
|
|
77
80
|
['aria-label']: PropTypes__default["default"].string,
|
|
78
81
|
/**
|
|
79
82
|
* Deprecated, please use `aria-label` instead.
|
|
@@ -105,5 +108,6 @@ TableExpandRow.propTypes = {
|
|
|
105
108
|
*/
|
|
106
109
|
onExpand: PropTypes__default["default"].func.isRequired
|
|
107
110
|
};
|
|
111
|
+
TableExpandRow.displayName = 'TableExpandRow';
|
|
108
112
|
|
|
109
113
|
exports["default"] = TableExpandRow;
|
|
@@ -101,7 +101,7 @@ export interface DropdownProps<ItemType> extends Omit<ReactAttr<HTMLDivElement>,
|
|
|
101
101
|
* An optional callback to render the currently selected item as a react element instead of only
|
|
102
102
|
* as a string.
|
|
103
103
|
*/
|
|
104
|
-
renderSelectedItem?(item: ItemType):
|
|
104
|
+
renderSelectedItem?(item: ItemType): React.JSXElementConstructor<ItemType> | null;
|
|
105
105
|
/**
|
|
106
106
|
* In the case you want to control the dropdown selection entirely.
|
|
107
107
|
*/
|
|
@@ -28,7 +28,7 @@ export interface FileUploaderDropContainerProps extends Omit<ReactAttr<HTMLButto
|
|
|
28
28
|
* Provide the label text to be read by screen readers when interacting with
|
|
29
29
|
* this control
|
|
30
30
|
*/
|
|
31
|
-
labelText
|
|
31
|
+
labelText?: string;
|
|
32
32
|
/**
|
|
33
33
|
* Specify if the component should accept multiple files to upload
|
|
34
34
|
*/
|
|
@@ -151,7 +151,7 @@ export interface ToastNotificationProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
151
151
|
/**
|
|
152
152
|
* Specify what state the notification represents
|
|
153
153
|
*/
|
|
154
|
-
kind
|
|
154
|
+
kind?: 'error' | 'info' | 'info-square' | 'success' | 'warning' | 'warning-alt';
|
|
155
155
|
/**
|
|
156
156
|
* Specify whether you are using the low contrast variant of the ToastNotification.
|
|
157
157
|
*/
|
|
@@ -163,12 +163,12 @@ export interface ToastNotificationProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
163
163
|
/**
|
|
164
164
|
* Provide a function that is called when the close button is clicked
|
|
165
165
|
*/
|
|
166
|
-
onCloseButtonClick(event: MouseEvent): void;
|
|
166
|
+
onCloseButtonClick?(event: MouseEvent): void;
|
|
167
167
|
/**
|
|
168
168
|
* By default, this value is "status". You can also provide an alternate
|
|
169
169
|
* role if it makes sense from the accessibility-side
|
|
170
170
|
*/
|
|
171
|
-
role
|
|
171
|
+
role?: 'alert' | 'log' | 'status';
|
|
172
172
|
/**
|
|
173
173
|
* Provide a description for "status" icon that can be read by screen readers
|
|
174
174
|
*/
|
|
@@ -277,7 +277,7 @@ export interface InlineNotificationProps extends HTMLAttributes<HTMLDivElement>
|
|
|
277
277
|
/**
|
|
278
278
|
* Specify what state the notification represents
|
|
279
279
|
*/
|
|
280
|
-
kind
|
|
280
|
+
kind?: 'error' | 'info' | 'info-square' | 'success' | 'warning' | 'warning-alt';
|
|
281
281
|
/**
|
|
282
282
|
* Specify whether you are using the low contrast variant of the InlineNotification.
|
|
283
283
|
*/
|
|
@@ -289,12 +289,12 @@ export interface InlineNotificationProps extends HTMLAttributes<HTMLDivElement>
|
|
|
289
289
|
/**
|
|
290
290
|
* Provide a function that is called when the close button is clicked
|
|
291
291
|
*/
|
|
292
|
-
onCloseButtonClick(event: MouseEvent): void;
|
|
292
|
+
onCloseButtonClick?(event: MouseEvent): void;
|
|
293
293
|
/**
|
|
294
294
|
* By default, this value is "status". You can also provide an alternate
|
|
295
295
|
* role if it makes sense from the accessibility-side.
|
|
296
296
|
*/
|
|
297
|
-
role
|
|
297
|
+
role?: 'alert' | 'log' | 'status';
|
|
298
298
|
/**
|
|
299
299
|
* Provide a description for "status" icon that can be read by screen readers
|
|
300
300
|
*/
|
|
@@ -399,7 +399,7 @@ export interface ActionableNotificationProps extends HTMLAttributes<HTMLDivEleme
|
|
|
399
399
|
/**
|
|
400
400
|
* Specify what state the notification represents
|
|
401
401
|
*/
|
|
402
|
-
kind
|
|
402
|
+
kind?: 'error' | 'info' | 'info-square' | 'success' | 'warning' | 'warning-alt';
|
|
403
403
|
/**
|
|
404
404
|
* Specify whether you are using the low contrast variant of the ActionableNotification.
|
|
405
405
|
*/
|
|
@@ -416,7 +416,7 @@ export interface ActionableNotificationProps extends HTMLAttributes<HTMLDivEleme
|
|
|
416
416
|
/**
|
|
417
417
|
* Provide a function that is called when the close button is clicked
|
|
418
418
|
*/
|
|
419
|
-
onCloseButtonClick(event: MouseEvent): void;
|
|
419
|
+
onCloseButtonClick?(event: MouseEvent): void;
|
|
420
420
|
/**
|
|
421
421
|
* By default, this value is "alertdialog". You can also provide an alternate
|
|
422
422
|
* role if it makes sense from from an accessibility perspective.
|
|
@@ -598,8 +598,7 @@ const Tab = /*#__PURE__*/React.forwardRef(function Tab(_ref5, forwardRef) {
|
|
|
598
598
|
}, /*#__PURE__*/React__default["default"].createElement(Icon, {
|
|
599
599
|
size: 16
|
|
600
600
|
})), /*#__PURE__*/React__default["default"].createElement(Text.Text, {
|
|
601
|
-
className: `${prefix}--tabs__nav-item-label
|
|
602
|
-
title: children
|
|
601
|
+
className: `${prefix}--tabs__nav-item-label`
|
|
603
602
|
}, children), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
604
603
|
className: cx__default["default"](`${prefix}--tabs__nav-item--icon`, {
|
|
605
604
|
[`${prefix}--visually-hidden`]: !hasIcon
|