@carbon/react 1.54.0 → 1.55.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 +981 -1010
- package/es/components/CodeSnippet/CodeSnippet.Skeleton.d.ts +37 -0
- package/es/components/CodeSnippet/CodeSnippet.d.ts +196 -0
- package/es/components/CodeSnippet/CodeSnippet.js +20 -19
- package/es/components/CodeSnippet/index.d.ts +10 -0
- package/es/components/ComboBox/ComboBox.d.ts +2 -2
- package/es/components/ComboBox/ComboBox.js +13 -5
- package/es/components/ComboButton/index.d.ts +51 -0
- package/es/components/ComboButton/index.js +9 -7
- package/es/components/ComposedModal/ComposedModal.js +2 -2
- package/es/components/DataTable/TableBatchAction.d.ts +1 -5
- package/es/components/Dropdown/Dropdown.js +3 -1
- package/es/components/Modal/Modal.js +2 -2
- package/es/components/MultiSelect/FilterableMultiSelect.js +31 -0
- package/es/components/MultiSelect/MultiSelect.js +37 -7
- package/es/components/Slug/index.js +8 -13
- package/es/components/Tag/DismissibleTag.js +119 -0
- package/es/components/Tag/OperationalTag.js +99 -0
- package/es/components/Tag/SelectableTag.js +98 -0
- package/es/components/Tag/index.d.ts +4 -1
- package/es/components/TreeView/TreeNode.js +1 -1
- package/es/components/UIShell/SideNavMenu.js +11 -1
- package/es/components/UIShell/SideNavMenuItem.d.ts +4 -0
- package/es/components/UIShell/SideNavMenuItem.js +8 -1
- package/es/components/UIShell/SwitcherItem.d.ts +4 -0
- package/es/components/UIShell/SwitcherItem.js +6 -0
- package/es/index.js +5 -2
- package/lib/components/CodeSnippet/CodeSnippet.Skeleton.d.ts +37 -0
- package/lib/components/CodeSnippet/CodeSnippet.d.ts +196 -0
- package/lib/components/CodeSnippet/CodeSnippet.js +20 -19
- package/lib/components/CodeSnippet/index.d.ts +10 -0
- package/lib/components/ComboBox/ComboBox.d.ts +2 -2
- package/lib/components/ComboBox/ComboBox.js +13 -5
- package/lib/components/ComboButton/index.d.ts +51 -0
- package/lib/components/ComboButton/index.js +9 -7
- package/lib/components/ComposedModal/ComposedModal.js +2 -2
- package/lib/components/DataTable/TableBatchAction.d.ts +1 -5
- package/lib/components/Dropdown/Dropdown.js +3 -1
- package/lib/components/Modal/Modal.js +2 -2
- package/lib/components/MultiSelect/FilterableMultiSelect.js +31 -0
- package/lib/components/MultiSelect/MultiSelect.js +37 -7
- package/lib/components/Slug/index.js +8 -13
- package/lib/components/Tag/DismissibleTag.js +129 -0
- package/lib/components/Tag/OperationalTag.js +109 -0
- package/lib/components/Tag/SelectableTag.js +108 -0
- package/lib/components/Tag/index.d.ts +4 -1
- package/lib/components/TreeView/TreeNode.js +1 -1
- package/lib/components/UIShell/SideNavMenu.js +11 -1
- package/lib/components/UIShell/SideNavMenuItem.d.ts +4 -0
- package/lib/components/UIShell/SideNavMenuItem.js +8 -1
- package/lib/components/UIShell/SwitcherItem.d.ts +4 -0
- package/lib/components/UIShell/SwitcherItem.js +6 -0
- package/lib/index.js +10 -4
- package/package.json +3 -3
|
@@ -148,26 +148,21 @@ Slug.propTypes = {
|
|
|
148
148
|
*/
|
|
149
149
|
align: PropTypes__default["default"].oneOf(['top', 'top-left',
|
|
150
150
|
// deprecated use top-start instead
|
|
151
|
-
'top-right',
|
|
151
|
+
'top-start', 'top-right',
|
|
152
152
|
// deprecated use top-end instead
|
|
153
|
-
|
|
154
|
-
'bottom', 'bottom-left',
|
|
153
|
+
'top-end', 'bottom', 'bottom-left',
|
|
155
154
|
// deprecated use bottom-start instead
|
|
156
|
-
'bottom-right',
|
|
155
|
+
'bottom-start', 'bottom-right',
|
|
157
156
|
// deprecated use bottom-end instead
|
|
158
|
-
|
|
159
|
-
'left', 'left-bottom',
|
|
157
|
+
'bottom-end', 'left', 'left-bottom',
|
|
160
158
|
// deprecated use left-end instead
|
|
161
|
-
'left-top',
|
|
159
|
+
'left-end', 'left-top',
|
|
162
160
|
// deprecated use left-start instead
|
|
163
|
-
|
|
164
|
-
'right', 'right-bottom',
|
|
161
|
+
'left-start', 'right', 'right-bottom',
|
|
165
162
|
// deprecated use right-end instead
|
|
166
|
-
'right-top',
|
|
163
|
+
'right-end', 'right-top',
|
|
167
164
|
// deprecated use right-start instead
|
|
168
|
-
|
|
169
|
-
// new values to match floating-ui
|
|
170
|
-
'top-start', 'top-end', 'bottom-start', 'bottom-end', 'left-end', 'left-start', 'right-end', 'right-start']),
|
|
165
|
+
'right-start']),
|
|
171
166
|
/**
|
|
172
167
|
* Will auto-align the popover. This prop is currently experimental and is subject to future changes.
|
|
173
168
|
*/
|
|
@@ -0,0 +1,129 @@
|
|
|
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
|
+
|
|
8
|
+
'use strict';
|
|
9
|
+
|
|
10
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
11
|
+
|
|
12
|
+
var _rollupPluginBabelHelpers = require('../../_virtual/_rollupPluginBabelHelpers.js');
|
|
13
|
+
var PropTypes = require('prop-types');
|
|
14
|
+
var React = require('react');
|
|
15
|
+
var cx = require('classnames');
|
|
16
|
+
var setupGetInstanceId = require('../../tools/setupGetInstanceId.js');
|
|
17
|
+
var usePrefix = require('../../internal/usePrefix.js');
|
|
18
|
+
var Tag = require('./Tag.js');
|
|
19
|
+
var iconsReact = require('@carbon/icons-react');
|
|
20
|
+
|
|
21
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
22
|
+
|
|
23
|
+
var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
|
|
24
|
+
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
25
|
+
var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
|
|
26
|
+
|
|
27
|
+
var _Close;
|
|
28
|
+
const getInstanceId = setupGetInstanceId["default"]();
|
|
29
|
+
const DismissibleTag = _ref => {
|
|
30
|
+
let {
|
|
31
|
+
children,
|
|
32
|
+
className,
|
|
33
|
+
disabled,
|
|
34
|
+
id,
|
|
35
|
+
renderIcon,
|
|
36
|
+
title = 'Clear filter',
|
|
37
|
+
onClose,
|
|
38
|
+
slug,
|
|
39
|
+
size,
|
|
40
|
+
type,
|
|
41
|
+
...other
|
|
42
|
+
} = _ref;
|
|
43
|
+
const prefix = usePrefix.usePrefix();
|
|
44
|
+
const tagId = id || `tag-${getInstanceId()}`;
|
|
45
|
+
const tagClasses = cx__default["default"](`${prefix}--tag--filter`, className);
|
|
46
|
+
const handleClose = event => {
|
|
47
|
+
if (onClose) {
|
|
48
|
+
event.stopPropagation();
|
|
49
|
+
onClose(event);
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
let normalizedSlug;
|
|
53
|
+
if (slug && slug['type']?.displayName === 'Slug') {
|
|
54
|
+
normalizedSlug = /*#__PURE__*/React__default["default"].cloneElement(slug, {
|
|
55
|
+
size: 'sm',
|
|
56
|
+
kind: 'inline'
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
// Removing onClick from the spread operator
|
|
61
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
62
|
+
const {
|
|
63
|
+
onClick,
|
|
64
|
+
...otherProps
|
|
65
|
+
} = other;
|
|
66
|
+
return /*#__PURE__*/React__default["default"].createElement(Tag["default"], _rollupPluginBabelHelpers["extends"]({
|
|
67
|
+
type: type,
|
|
68
|
+
size: size,
|
|
69
|
+
renderIcon: renderIcon,
|
|
70
|
+
disabled: disabled,
|
|
71
|
+
className: tagClasses,
|
|
72
|
+
id: tagId
|
|
73
|
+
}, otherProps), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
74
|
+
className: `${prefix}--interactive--tag-children`
|
|
75
|
+
}, children, normalizedSlug, /*#__PURE__*/React__default["default"].createElement("button", {
|
|
76
|
+
type: "button",
|
|
77
|
+
className: `${prefix}--tag__close-icon`,
|
|
78
|
+
onClick: handleClose,
|
|
79
|
+
disabled: disabled,
|
|
80
|
+
"aria-label": title,
|
|
81
|
+
title: title
|
|
82
|
+
}, _Close || (_Close = /*#__PURE__*/React__default["default"].createElement(iconsReact.Close, null)))));
|
|
83
|
+
};
|
|
84
|
+
DismissibleTag.propTypes = {
|
|
85
|
+
/**
|
|
86
|
+
* Provide content to be rendered inside of a `DismissibleTag`
|
|
87
|
+
*/
|
|
88
|
+
children: PropTypes__default["default"].node,
|
|
89
|
+
/**
|
|
90
|
+
* Provide a custom className that is applied to the containing <span>
|
|
91
|
+
*/
|
|
92
|
+
className: PropTypes__default["default"].string,
|
|
93
|
+
/**
|
|
94
|
+
* Specify if the `DismissibleTag` is disabled
|
|
95
|
+
*/
|
|
96
|
+
disabled: PropTypes__default["default"].bool,
|
|
97
|
+
/**
|
|
98
|
+
* Specify the id for the tag.
|
|
99
|
+
*/
|
|
100
|
+
id: PropTypes__default["default"].string,
|
|
101
|
+
/**
|
|
102
|
+
* Click handler for filter tag close button.
|
|
103
|
+
*/
|
|
104
|
+
onClose: PropTypes__default["default"].func,
|
|
105
|
+
/**
|
|
106
|
+
* Optional prop to render a custom icon.
|
|
107
|
+
* Can be a React component class
|
|
108
|
+
*/
|
|
109
|
+
renderIcon: PropTypes__default["default"].oneOfType([PropTypes__default["default"].func, PropTypes__default["default"].object]),
|
|
110
|
+
/**
|
|
111
|
+
* Specify the size of the Tag. Currently supports either `sm`,
|
|
112
|
+
* `md` (default) or `lg` sizes.
|
|
113
|
+
*/
|
|
114
|
+
size: PropTypes__default["default"].oneOf(Object.keys(Tag.SIZES)),
|
|
115
|
+
/**
|
|
116
|
+
* **Experimental:** Provide a `Slug` component to be rendered inside the `DismissibleTag` component
|
|
117
|
+
*/
|
|
118
|
+
slug: PropTypes__default["default"].node,
|
|
119
|
+
/**
|
|
120
|
+
* Text to show on clear filters
|
|
121
|
+
*/
|
|
122
|
+
title: PropTypes__default["default"].string,
|
|
123
|
+
/**
|
|
124
|
+
* Specify the type of the `Tag`
|
|
125
|
+
*/
|
|
126
|
+
type: PropTypes__default["default"].oneOf(Object.keys(Tag.TYPES))
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
exports["default"] = DismissibleTag;
|
|
@@ -0,0 +1,109 @@
|
|
|
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
|
+
|
|
8
|
+
'use strict';
|
|
9
|
+
|
|
10
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
11
|
+
|
|
12
|
+
var _rollupPluginBabelHelpers = require('../../_virtual/_rollupPluginBabelHelpers.js');
|
|
13
|
+
var PropTypes = require('prop-types');
|
|
14
|
+
var React = require('react');
|
|
15
|
+
var cx = require('classnames');
|
|
16
|
+
var setupGetInstanceId = require('../../tools/setupGetInstanceId.js');
|
|
17
|
+
var usePrefix = require('../../internal/usePrefix.js');
|
|
18
|
+
var Tag = require('./Tag.js');
|
|
19
|
+
|
|
20
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
21
|
+
|
|
22
|
+
var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
|
|
23
|
+
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
24
|
+
var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
|
|
25
|
+
|
|
26
|
+
const getInstanceId = setupGetInstanceId["default"]();
|
|
27
|
+
const TYPES = {
|
|
28
|
+
red: 'Red',
|
|
29
|
+
magenta: 'Magenta',
|
|
30
|
+
purple: 'Purple',
|
|
31
|
+
blue: 'Blue',
|
|
32
|
+
cyan: 'Cyan',
|
|
33
|
+
teal: 'Teal',
|
|
34
|
+
green: 'Green',
|
|
35
|
+
gray: 'Gray',
|
|
36
|
+
'cool-gray': 'Cool-Gray',
|
|
37
|
+
'warm-gray': 'Warm-Gray'
|
|
38
|
+
};
|
|
39
|
+
const OperationalTag = _ref => {
|
|
40
|
+
let {
|
|
41
|
+
children,
|
|
42
|
+
className,
|
|
43
|
+
disabled,
|
|
44
|
+
id,
|
|
45
|
+
renderIcon,
|
|
46
|
+
slug,
|
|
47
|
+
size,
|
|
48
|
+
type = 'gray',
|
|
49
|
+
...other
|
|
50
|
+
} = _ref;
|
|
51
|
+
const prefix = usePrefix.usePrefix();
|
|
52
|
+
const tagId = id || `tag-${getInstanceId()}`;
|
|
53
|
+
const tagClasses = cx__default["default"](`${prefix}--tag--operational`, className);
|
|
54
|
+
let normalizedSlug;
|
|
55
|
+
if (slug && slug['type']?.displayName === 'Slug') {
|
|
56
|
+
normalizedSlug = /*#__PURE__*/React__default["default"].cloneElement(slug, {
|
|
57
|
+
size: 'sm',
|
|
58
|
+
kind: 'inline'
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
return /*#__PURE__*/React__default["default"].createElement(Tag["default"], _rollupPluginBabelHelpers["extends"]({
|
|
62
|
+
type: type,
|
|
63
|
+
size: size,
|
|
64
|
+
renderIcon: renderIcon,
|
|
65
|
+
disabled: disabled,
|
|
66
|
+
className: tagClasses,
|
|
67
|
+
id: tagId
|
|
68
|
+
}, other), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
69
|
+
className: `${prefix}--interactive--tag-children`
|
|
70
|
+
}, children, normalizedSlug));
|
|
71
|
+
};
|
|
72
|
+
OperationalTag.propTypes = {
|
|
73
|
+
/**
|
|
74
|
+
* Provide content to be rendered inside of a `OperationalTag`
|
|
75
|
+
*/
|
|
76
|
+
children: PropTypes__default["default"].node,
|
|
77
|
+
/**
|
|
78
|
+
* Provide a custom className that is applied to the containing <span>
|
|
79
|
+
*/
|
|
80
|
+
className: PropTypes__default["default"].string,
|
|
81
|
+
/**
|
|
82
|
+
* Specify if the `OperationalTag` is disabled
|
|
83
|
+
*/
|
|
84
|
+
disabled: PropTypes__default["default"].bool,
|
|
85
|
+
/**
|
|
86
|
+
* Specify the id for the tag.
|
|
87
|
+
*/
|
|
88
|
+
id: PropTypes__default["default"].string,
|
|
89
|
+
/**
|
|
90
|
+
* Optional prop to render a custom icon.
|
|
91
|
+
* Can be a React component class
|
|
92
|
+
*/
|
|
93
|
+
renderIcon: PropTypes__default["default"].oneOfType([PropTypes__default["default"].func, PropTypes__default["default"].object]),
|
|
94
|
+
/**
|
|
95
|
+
* Specify the size of the Tag. Currently supports either `sm`,
|
|
96
|
+
* `md` (default) or `lg` sizes.
|
|
97
|
+
*/
|
|
98
|
+
size: PropTypes__default["default"].oneOf(Object.keys(Tag.SIZES)),
|
|
99
|
+
/**
|
|
100
|
+
* **Experimental:** Provide a `Slug` component to be rendered inside the `OperationalTag` component
|
|
101
|
+
*/
|
|
102
|
+
slug: PropTypes__default["default"].node,
|
|
103
|
+
/**
|
|
104
|
+
* Specify the type of the `Tag`
|
|
105
|
+
*/
|
|
106
|
+
type: PropTypes__default["default"].oneOf(Object.keys(TYPES))
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
exports["default"] = OperationalTag;
|
|
@@ -0,0 +1,108 @@
|
|
|
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
|
+
|
|
8
|
+
'use strict';
|
|
9
|
+
|
|
10
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
11
|
+
|
|
12
|
+
var _rollupPluginBabelHelpers = require('../../_virtual/_rollupPluginBabelHelpers.js');
|
|
13
|
+
var PropTypes = require('prop-types');
|
|
14
|
+
var React = require('react');
|
|
15
|
+
var cx = require('classnames');
|
|
16
|
+
var setupGetInstanceId = require('../../tools/setupGetInstanceId.js');
|
|
17
|
+
var usePrefix = require('../../internal/usePrefix.js');
|
|
18
|
+
var Tag = require('./Tag.js');
|
|
19
|
+
|
|
20
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
21
|
+
|
|
22
|
+
var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
|
|
23
|
+
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
24
|
+
var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
|
|
25
|
+
|
|
26
|
+
const getInstanceId = setupGetInstanceId["default"]();
|
|
27
|
+
const SelectableTag = _ref => {
|
|
28
|
+
let {
|
|
29
|
+
children,
|
|
30
|
+
className,
|
|
31
|
+
disabled,
|
|
32
|
+
id,
|
|
33
|
+
renderIcon,
|
|
34
|
+
selected = false,
|
|
35
|
+
slug,
|
|
36
|
+
size,
|
|
37
|
+
...other
|
|
38
|
+
} = _ref;
|
|
39
|
+
const prefix = usePrefix.usePrefix();
|
|
40
|
+
const tagId = id || `tag-${getInstanceId()}`;
|
|
41
|
+
const [selectedTag, setSelectedTag] = React.useState(selected);
|
|
42
|
+
const tagClasses = cx__default["default"](`${prefix}--tag--selectable`, className, {
|
|
43
|
+
[`${prefix}--tag--selectable-selected`]: selectedTag
|
|
44
|
+
});
|
|
45
|
+
let normalizedSlug;
|
|
46
|
+
if (slug && slug['type']?.displayName === 'Slug') {
|
|
47
|
+
normalizedSlug = /*#__PURE__*/React__default["default"].cloneElement(slug, {
|
|
48
|
+
size: 'sm',
|
|
49
|
+
kind: 'inline'
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// Removing onClick from the spread operator
|
|
54
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
55
|
+
const {
|
|
56
|
+
onClick,
|
|
57
|
+
...otherProps
|
|
58
|
+
} = other;
|
|
59
|
+
return /*#__PURE__*/React__default["default"].createElement(Tag["default"], _rollupPluginBabelHelpers["extends"]({
|
|
60
|
+
slug: slug,
|
|
61
|
+
size: size,
|
|
62
|
+
renderIcon: renderIcon,
|
|
63
|
+
disabled: disabled,
|
|
64
|
+
className: tagClasses,
|
|
65
|
+
id: tagId,
|
|
66
|
+
onClick: () => setSelectedTag(!selectedTag)
|
|
67
|
+
}, otherProps), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
68
|
+
className: `${prefix}--interactive--tag-children`
|
|
69
|
+
}, children, normalizedSlug));
|
|
70
|
+
};
|
|
71
|
+
SelectableTag.propTypes = {
|
|
72
|
+
/**
|
|
73
|
+
* Provide content to be rendered inside of a `SelectableTag`
|
|
74
|
+
*/
|
|
75
|
+
children: PropTypes__default["default"].node,
|
|
76
|
+
/**
|
|
77
|
+
* Provide a custom className that is applied to the containing <span>
|
|
78
|
+
*/
|
|
79
|
+
className: PropTypes__default["default"].string,
|
|
80
|
+
/**
|
|
81
|
+
* Specify if the `SelectableTag` is disabled
|
|
82
|
+
*/
|
|
83
|
+
disabled: PropTypes__default["default"].bool,
|
|
84
|
+
/**
|
|
85
|
+
* Specify the id for the tag.
|
|
86
|
+
*/
|
|
87
|
+
id: PropTypes__default["default"].string,
|
|
88
|
+
/**
|
|
89
|
+
* Optional prop to render a custom icon.
|
|
90
|
+
* Can be a React component class
|
|
91
|
+
*/
|
|
92
|
+
renderIcon: PropTypes__default["default"].oneOfType([PropTypes__default["default"].func, PropTypes__default["default"].object]),
|
|
93
|
+
/**
|
|
94
|
+
* Specify the state of the selectable tag.
|
|
95
|
+
*/
|
|
96
|
+
selected: PropTypes__default["default"].bool,
|
|
97
|
+
/**
|
|
98
|
+
* Specify the size of the Tag. Currently supports either `sm`,
|
|
99
|
+
* `md` (default) or `lg` sizes.
|
|
100
|
+
*/
|
|
101
|
+
size: PropTypes__default["default"].oneOf(Object.keys(Tag.SIZES)),
|
|
102
|
+
/**
|
|
103
|
+
* **Experimental:** Provide a `Slug` component to be rendered inside the `SelectableTag` component
|
|
104
|
+
*/
|
|
105
|
+
slug: PropTypes__default["default"].node
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
exports["default"] = SelectableTag;
|
|
@@ -5,6 +5,9 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
import Tag from './Tag';
|
|
8
|
+
import DismissibleTag from './DismissibleTag';
|
|
9
|
+
import OperationalTag from './OperationalTag';
|
|
10
|
+
import SelectableTag from './SelectableTag';
|
|
8
11
|
export * from './Tag.Skeleton';
|
|
9
12
|
export default Tag;
|
|
10
|
-
export { Tag };
|
|
13
|
+
export { Tag, DismissibleTag, OperationalTag, SelectableTag };
|
|
@@ -66,7 +66,7 @@ const TreeNode = /*#__PURE__*/React__default["default"].forwardRef((_ref, ref) =
|
|
|
66
66
|
return /*#__PURE__*/React__default["default"].cloneElement(node, {
|
|
67
67
|
active,
|
|
68
68
|
depth: depth + 1,
|
|
69
|
-
disabled,
|
|
69
|
+
disabled: disabled || node.props.disabled,
|
|
70
70
|
onTreeSelect,
|
|
71
71
|
selected,
|
|
72
72
|
tabIndex: !node.props.disabled && -1 || null
|
|
@@ -38,9 +38,12 @@ const SideNavMenu = /*#__PURE__*/React__default["default"].forwardRef(function S
|
|
|
38
38
|
tabIndex,
|
|
39
39
|
title
|
|
40
40
|
} = _ref;
|
|
41
|
-
const
|
|
41
|
+
const {
|
|
42
|
+
isRail
|
|
43
|
+
} = React.useContext(SideNav.SideNavContext);
|
|
42
44
|
const prefix = usePrefix.usePrefix();
|
|
43
45
|
const [isExpanded, setIsExpanded] = React.useState(defaultExpanded);
|
|
46
|
+
const [prevExpanded, setPrevExpanded] = React.useState(defaultExpanded);
|
|
44
47
|
const className = cx__default["default"]({
|
|
45
48
|
[`${prefix}--side-nav__item`]: true,
|
|
46
49
|
[`${prefix}--side-nav__item--active`]: isActive || hasActiveDescendant(children) && !isExpanded,
|
|
@@ -48,6 +51,13 @@ const SideNavMenu = /*#__PURE__*/React__default["default"].forwardRef(function S
|
|
|
48
51
|
[`${prefix}--side-nav__item--large`]: large,
|
|
49
52
|
[customClassName]: !!customClassName
|
|
50
53
|
});
|
|
54
|
+
if (!isSideNavExpanded && isExpanded && isRail) {
|
|
55
|
+
setIsExpanded(false);
|
|
56
|
+
setPrevExpanded(true);
|
|
57
|
+
} else if (isSideNavExpanded && prevExpanded && isRail) {
|
|
58
|
+
setIsExpanded(true);
|
|
59
|
+
setPrevExpanded(false);
|
|
60
|
+
}
|
|
51
61
|
return (
|
|
52
62
|
/*#__PURE__*/
|
|
53
63
|
// eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions
|
|
@@ -20,6 +20,10 @@ interface SideNavMenuItemProps extends HTMLAttributes<HTMLElement> {
|
|
|
20
20
|
* `aria-current="page"`, as well.
|
|
21
21
|
*/
|
|
22
22
|
isActive?: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Optionally provide an href for the underlying li`
|
|
25
|
+
*/
|
|
26
|
+
href?: string;
|
|
23
27
|
}
|
|
24
28
|
declare const SideNavMenuItem: React.ForwardRefExoticComponent<SideNavMenuItemProps & React.RefAttributes<HTMLElement>>;
|
|
25
29
|
export default SideNavMenuItem;
|
|
@@ -29,6 +29,7 @@ const SideNavMenuItem = /*#__PURE__*/React__default["default"].forwardRef(functi
|
|
|
29
29
|
children,
|
|
30
30
|
className: customClassName,
|
|
31
31
|
isActive,
|
|
32
|
+
href,
|
|
32
33
|
...rest
|
|
33
34
|
} = props;
|
|
34
35
|
const className = cx__default["default"](`${prefix}--side-nav__menu-item`, customClassName);
|
|
@@ -38,7 +39,9 @@ const SideNavMenuItem = /*#__PURE__*/React__default["default"].forwardRef(functi
|
|
|
38
39
|
});
|
|
39
40
|
return /*#__PURE__*/React__default["default"].createElement("li", {
|
|
40
41
|
className: className
|
|
41
|
-
}, /*#__PURE__*/React__default["default"].createElement(Link["default"], _rollupPluginBabelHelpers["extends"]({
|
|
42
|
+
}, /*#__PURE__*/React__default["default"].createElement(Link["default"], _rollupPluginBabelHelpers["extends"]({
|
|
43
|
+
href: href
|
|
44
|
+
}, rest, {
|
|
42
45
|
className: linkClassName,
|
|
43
46
|
ref: ref
|
|
44
47
|
}), /*#__PURE__*/React__default["default"].createElement(SideNavLinkText["default"], null, children)));
|
|
@@ -53,6 +56,10 @@ SideNavMenuItem.propTypes = {
|
|
|
53
56
|
* Provide an optional class to be applied to the containing node
|
|
54
57
|
*/
|
|
55
58
|
className: PropTypes__default["default"].string,
|
|
59
|
+
/**
|
|
60
|
+
* Optionally provide an href for the underlying li`
|
|
61
|
+
*/
|
|
62
|
+
href: PropTypes__default["default"].string,
|
|
56
63
|
/**
|
|
57
64
|
* Optionally specify whether the link is "active". An active link is one that
|
|
58
65
|
* has an href that is the same as the current page. Can also pass in
|
|
@@ -39,6 +39,10 @@ interface BaseSwitcherItemProps {
|
|
|
39
39
|
* Specify whether the panel is selected
|
|
40
40
|
*/
|
|
41
41
|
isSelected?: boolean;
|
|
42
|
+
/**
|
|
43
|
+
* Optionally provide an href for the underlying li`
|
|
44
|
+
*/
|
|
45
|
+
href?: string;
|
|
42
46
|
}
|
|
43
47
|
interface SwitcherItemWithAriaLabel extends BaseSwitcherItemProps {
|
|
44
48
|
'aria-label': string;
|
|
@@ -37,6 +37,7 @@ const SwitcherItem = /*#__PURE__*/React.forwardRef(function SwitcherItem(props,
|
|
|
37
37
|
index,
|
|
38
38
|
handleSwitcherItemFocus,
|
|
39
39
|
onKeyDown = () => {},
|
|
40
|
+
href,
|
|
40
41
|
...rest
|
|
41
42
|
} = props;
|
|
42
43
|
const prefix = usePrefix.usePrefix();
|
|
@@ -73,6 +74,7 @@ const SwitcherItem = /*#__PURE__*/React.forwardRef(function SwitcherItem(props,
|
|
|
73
74
|
setTabFocus(evt);
|
|
74
75
|
onKeyDown(evt);
|
|
75
76
|
},
|
|
77
|
+
href: href,
|
|
76
78
|
ref: forwardRef
|
|
77
79
|
}, rest, {
|
|
78
80
|
className: linkClassName,
|
|
@@ -94,6 +96,10 @@ SwitcherItem.propTypes = {
|
|
|
94
96
|
* event handlers
|
|
95
97
|
*/
|
|
96
98
|
handleSwitcherItemFocus: PropTypes__default["default"].func,
|
|
99
|
+
/**
|
|
100
|
+
* Optionally provide an href for the underlying li`
|
|
101
|
+
*/
|
|
102
|
+
href: PropTypes__default["default"].string,
|
|
97
103
|
/**
|
|
98
104
|
* Specify the index of the SwitcherItem
|
|
99
105
|
*/
|
package/lib/index.js
CHANGED
|
@@ -23,6 +23,8 @@ var ButtonSet = require('./components/ButtonSet/ButtonSet.js');
|
|
|
23
23
|
var Checkbox = require('./components/Checkbox/Checkbox.js');
|
|
24
24
|
var Checkbox_Skeleton = require('./components/Checkbox/Checkbox.Skeleton.js');
|
|
25
25
|
var index$4 = require('./components/ClassPrefix/index.js');
|
|
26
|
+
var CodeSnippet = require('./components/CodeSnippet/CodeSnippet.js');
|
|
27
|
+
var CodeSnippet_Skeleton = require('./components/CodeSnippet/CodeSnippet.Skeleton.js');
|
|
26
28
|
var ComboBox = require('./components/ComboBox/ComboBox.js');
|
|
27
29
|
var index$5 = require('./components/ComboButton/index.js');
|
|
28
30
|
var ComposedModal = require('./components/ComposedModal/ComposedModal.js');
|
|
@@ -109,6 +111,9 @@ var Tabs = require('./components/Tabs/Tabs.js');
|
|
|
109
111
|
var TabContent = require('./components/TabContent/TabContent.js');
|
|
110
112
|
var Tabs_Skeleton = require('./components/Tabs/Tabs.Skeleton.js');
|
|
111
113
|
var Tag = require('./components/Tag/Tag.js');
|
|
114
|
+
var DismissibleTag = require('./components/Tag/DismissibleTag.js');
|
|
115
|
+
var OperationalTag = require('./components/Tag/OperationalTag.js');
|
|
116
|
+
var SelectableTag = require('./components/Tag/SelectableTag.js');
|
|
112
117
|
var Tag_Skeleton = require('./components/Tag/Tag.Skeleton.js');
|
|
113
118
|
var TextArea = require('./components/TextArea/TextArea.js');
|
|
114
119
|
var TextArea_Skeleton = require('./components/TextArea/TextArea.Skeleton.js');
|
|
@@ -177,8 +182,6 @@ var FluidTextInput_Skeleton = require('./components/FluidTextInput/FluidTextInpu
|
|
|
177
182
|
var PageSelector = require('./components/Pagination/experimental/PageSelector.js');
|
|
178
183
|
var Pagination = require('./components/Pagination/experimental/Pagination.js');
|
|
179
184
|
var CheckboxGroup = require('./components/CheckboxGroup/CheckboxGroup.js');
|
|
180
|
-
var CodeSnippet_Skeleton = require('./components/CodeSnippet/CodeSnippet.Skeleton.js');
|
|
181
|
-
var CodeSnippet = require('./components/CodeSnippet/CodeSnippet.js');
|
|
182
185
|
var ContainedListItem = require('./components/ContainedList/ContainedListItem/ContainedListItem.js');
|
|
183
186
|
var ContainedList = require('./components/ContainedList/ContainedList.js');
|
|
184
187
|
var useContextMenu = require('./components/ContextMenu/useContextMenu.js');
|
|
@@ -252,6 +255,8 @@ exports.ButtonSet = ButtonSet["default"];
|
|
|
252
255
|
exports.Checkbox = Checkbox["default"];
|
|
253
256
|
exports.CheckboxSkeleton = Checkbox_Skeleton["default"];
|
|
254
257
|
exports.ClassPrefix = index$4.ClassPrefix;
|
|
258
|
+
exports.CodeSnippet = CodeSnippet["default"];
|
|
259
|
+
exports.CodeSnippetSkeleton = CodeSnippet_Skeleton["default"];
|
|
255
260
|
exports.ComboBox = ComboBox["default"];
|
|
256
261
|
exports.ComboButton = index$5.ComboButton;
|
|
257
262
|
exports.ComposedModal = ComposedModal["default"];
|
|
@@ -358,6 +363,9 @@ exports.Tabs = Tabs.Tabs;
|
|
|
358
363
|
exports.TabContent = TabContent["default"];
|
|
359
364
|
exports.TabsSkeleton = Tabs_Skeleton["default"];
|
|
360
365
|
exports.Tag = Tag["default"];
|
|
366
|
+
exports.DismissibleTag = DismissibleTag["default"];
|
|
367
|
+
exports.OperationalTag = OperationalTag["default"];
|
|
368
|
+
exports.SelectableTag = SelectableTag["default"];
|
|
361
369
|
exports.TagSkeleton = Tag_Skeleton["default"];
|
|
362
370
|
exports.TextArea = TextArea["default"];
|
|
363
371
|
exports.TextAreaSkeleton = TextArea_Skeleton["default"];
|
|
@@ -445,8 +453,6 @@ exports.unstable__FluidTextInputSkeleton = FluidTextInput_Skeleton["default"];
|
|
|
445
453
|
exports.unstable_PageSelector = PageSelector["default"];
|
|
446
454
|
exports.unstable_Pagination = Pagination["default"];
|
|
447
455
|
exports.CheckboxGroup = CheckboxGroup["default"];
|
|
448
|
-
exports.CodeSnippetSkeleton = CodeSnippet_Skeleton["default"];
|
|
449
|
-
exports.CodeSnippet = CodeSnippet["default"];
|
|
450
456
|
exports.ContainedListItem = ContainedListItem["default"];
|
|
451
457
|
exports.ContainedList = ContainedList["default"];
|
|
452
458
|
exports.useContextMenu = useContextMenu["default"];
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@carbon/react",
|
|
3
3
|
"description": "React components for the Carbon Design System",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.55.0-rc.0",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "lib/index.js",
|
|
7
7
|
"module": "es/index.js",
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"@carbon/feature-flags": "^0.19.0",
|
|
52
52
|
"@carbon/icons-react": "^11.39.0",
|
|
53
53
|
"@carbon/layout": "^11.21.0",
|
|
54
|
-
"@carbon/styles": "^1.
|
|
54
|
+
"@carbon/styles": "^1.55.0-rc.0",
|
|
55
55
|
"@floating-ui/react": "^0.25.4",
|
|
56
56
|
"@ibm/telemetry-js": "^1.2.1",
|
|
57
57
|
"classnames": "2.5.1",
|
|
@@ -141,5 +141,5 @@
|
|
|
141
141
|
"**/*.scss",
|
|
142
142
|
"**/*.css"
|
|
143
143
|
],
|
|
144
|
-
"gitHead": "
|
|
144
|
+
"gitHead": "600138750484cf814dc1b927ed4c277301b5290a"
|
|
145
145
|
}
|