@carbon/react 1.65.0 → 1.66.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 +927 -927
- package/es/components/AILabel/index.d.ts +37 -0
- package/es/components/AILabel/index.js +38 -14
- package/es/components/Accordion/Accordion.d.ts +5 -1
- package/es/components/Breadcrumb/BreadcrumbItem.js +1 -1
- package/es/components/Button/Button.d.ts +2 -1
- package/es/components/Button/Button.js +14 -3
- package/es/components/ChatButton/ChatButton.Skeleton.d.ts +31 -0
- package/es/components/ChatButton/ChatButton.Skeleton.js +1 -2
- package/es/components/ChatButton/ChatButton.d.ts +46 -0
- package/es/components/ChatButton/ChatButton.js +3 -3
- package/es/components/ChatButton/index.d.ts +12 -0
- package/es/components/Checkbox/index.js +10 -0
- package/es/components/CodeSnippet/CodeSnippet.d.ts +9 -1
- package/es/components/CodeSnippet/CodeSnippet.js +7 -0
- package/es/components/ComboBox/ComboBox.js +38 -19
- package/es/components/ComboButton/index.js +8 -3
- package/es/components/ComposedModal/index.d.ts +2 -0
- package/es/components/Copy/Copy.d.ts +9 -1
- package/es/components/Copy/Copy.js +6 -0
- package/es/components/CopyButton/CopyButton.d.ts +9 -1
- package/es/components/CopyButton/CopyButton.js +6 -0
- package/es/components/DataTable/TableSlugRow.d.ts +1 -0
- package/es/components/DataTable/TableSlugRow.js +1 -0
- package/es/components/Dropdown/Dropdown.js +1 -1
- package/es/components/FluidTextArea/FluidTextArea.Skeleton.d.ts +20 -0
- package/es/components/FluidTextArea/FluidTextArea.Skeleton.js +3 -20
- package/es/components/FluidTextArea/FluidTextArea.d.ts +96 -0
- package/es/components/FluidTextArea/FluidTextArea.js +2 -2
- package/es/components/FluidTextArea/index.d.ts +12 -0
- package/es/components/Grid/Column.js +3 -3
- package/es/components/IconButton/index.d.ts +4 -0
- package/es/components/IconButton/index.js +6 -0
- package/es/components/ListBox/ListBoxMenuItem.d.ts +10 -1
- package/es/components/ListBox/next/ListBoxSelection.d.ts +106 -0
- package/es/components/ListBox/next/ListBoxSelection.js +12 -16
- package/es/components/ListBox/next/ListBoxTrigger.d.ts +31 -0
- package/es/components/ListBox/next/ListBoxTrigger.js +2 -4
- package/es/components/ListBox/next/index.d.ts +8 -0
- package/es/components/Menu/Menu.js +2 -1
- package/es/components/MultiSelect/FilterableMultiSelect.js +14 -15
- package/es/components/MultiSelect/MultiSelect.js +65 -49
- package/es/components/MultiSelect/tools/sorting.js +5 -8
- package/es/components/OverflowMenu/OverflowMenu.js +1 -1
- package/es/components/OverflowMenu/next/index.js +3 -1
- package/es/components/Popover/index.js +22 -5
- package/es/components/Tag/DismissibleTag.d.ts +9 -1
- package/es/components/Tag/DismissibleTag.js +7 -3
- package/es/components/Tag/Tag.js +2 -2
- package/es/components/Toggletip/index.js +2 -1
- package/es/components/TreeView/TreeNode.js +41 -33
- package/es/components/TreeView/TreeView.d.ts +5 -3
- package/es/index.js +4 -4
- package/es/internal/Selection.js +30 -18
- package/es/internal/useMergedRefs.d.ts +1 -1
- package/lib/components/AILabel/index.d.ts +37 -0
- package/lib/components/AILabel/index.js +38 -14
- package/lib/components/Accordion/Accordion.d.ts +5 -1
- package/lib/components/Breadcrumb/BreadcrumbItem.js +1 -1
- package/lib/components/Button/Button.d.ts +2 -1
- package/lib/components/Button/Button.js +13 -2
- package/lib/components/ChatButton/ChatButton.Skeleton.d.ts +31 -0
- package/lib/components/ChatButton/ChatButton.Skeleton.js +1 -2
- package/lib/components/ChatButton/ChatButton.d.ts +46 -0
- package/lib/components/ChatButton/ChatButton.js +4 -4
- package/lib/components/ChatButton/index.d.ts +12 -0
- package/lib/components/Checkbox/index.js +19 -0
- package/lib/components/CodeSnippet/CodeSnippet.d.ts +9 -1
- package/lib/components/CodeSnippet/CodeSnippet.js +7 -0
- package/lib/components/ComboBox/ComboBox.js +38 -19
- package/lib/components/ComboButton/index.js +8 -3
- package/lib/components/ComposedModal/index.d.ts +2 -0
- package/lib/components/Copy/Copy.d.ts +9 -1
- package/lib/components/Copy/Copy.js +6 -0
- package/lib/components/CopyButton/CopyButton.d.ts +9 -1
- package/lib/components/CopyButton/CopyButton.js +6 -0
- package/lib/components/DataTable/TableSlugRow.d.ts +1 -0
- package/lib/components/DataTable/TableSlugRow.js +1 -0
- package/lib/components/Dropdown/Dropdown.js +1 -1
- package/lib/components/FluidTextArea/FluidTextArea.Skeleton.d.ts +20 -0
- package/lib/components/FluidTextArea/FluidTextArea.Skeleton.js +3 -22
- package/lib/components/FluidTextArea/FluidTextArea.d.ts +96 -0
- package/lib/components/FluidTextArea/FluidTextArea.js +2 -2
- package/lib/components/FluidTextArea/index.d.ts +12 -0
- package/lib/components/Grid/Column.js +3 -3
- package/lib/components/IconButton/index.d.ts +4 -0
- package/lib/components/IconButton/index.js +6 -0
- package/lib/components/ListBox/ListBoxMenuItem.d.ts +10 -1
- package/lib/components/ListBox/next/ListBoxSelection.d.ts +106 -0
- package/lib/components/ListBox/next/ListBoxSelection.js +11 -16
- package/lib/components/ListBox/next/ListBoxTrigger.d.ts +31 -0
- package/lib/components/ListBox/next/ListBoxTrigger.js +2 -4
- package/lib/components/ListBox/next/index.d.ts +8 -0
- package/lib/components/Menu/Menu.js +2 -1
- package/lib/components/MultiSelect/FilterableMultiSelect.js +14 -15
- package/lib/components/MultiSelect/MultiSelect.js +64 -48
- package/lib/components/MultiSelect/tools/sorting.js +5 -8
- package/lib/components/OverflowMenu/OverflowMenu.js +1 -1
- package/lib/components/OverflowMenu/next/index.js +3 -1
- package/lib/components/Popover/index.js +22 -5
- package/lib/components/Tag/DismissibleTag.d.ts +9 -1
- package/lib/components/Tag/DismissibleTag.js +7 -3
- package/lib/components/Tag/Tag.js +2 -2
- package/lib/components/Toggletip/index.js +2 -1
- package/lib/components/TreeView/TreeNode.js +41 -33
- package/lib/components/TreeView/TreeView.d.ts +5 -3
- package/lib/index.js +8 -8
- package/lib/internal/Selection.js +30 -18
- package/lib/internal/useMergedRefs.d.ts +1 -1
- package/package.json +25 -22
|
@@ -43,6 +43,10 @@ export interface DismissibleTagBaseProps {
|
|
|
43
43
|
* Provide text to be rendered inside of a the tag.
|
|
44
44
|
*/
|
|
45
45
|
text?: string;
|
|
46
|
+
/**
|
|
47
|
+
* Provide a custom `title` to be inserted in the tag.
|
|
48
|
+
*/
|
|
49
|
+
tagTitle?: string;
|
|
46
50
|
/**
|
|
47
51
|
* Text to show on clear filters
|
|
48
52
|
*/
|
|
@@ -54,7 +58,7 @@ export interface DismissibleTagBaseProps {
|
|
|
54
58
|
}
|
|
55
59
|
export type DismissibleTagProps<T extends React.ElementType> = PolymorphicProps<T, DismissibleTagBaseProps>;
|
|
56
60
|
declare const DismissibleTag: {
|
|
57
|
-
<T extends React.ElementType<any, keyof React.JSX.IntrinsicElements>>({ className, disabled, id, renderIcon, title, onClose, slug, size, text, type, ...other }: DismissibleTagProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
61
|
+
<T extends React.ElementType<any, keyof React.JSX.IntrinsicElements>>({ className, disabled, id, renderIcon, title, onClose, slug, size, text, tagTitle, type, ...other }: DismissibleTagProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
58
62
|
propTypes: {
|
|
59
63
|
/**
|
|
60
64
|
* Provide a custom className that is applied to the containing <span>
|
|
@@ -90,6 +94,10 @@ declare const DismissibleTag: {
|
|
|
90
94
|
* Provide text to be rendered inside of a the tag.
|
|
91
95
|
*/
|
|
92
96
|
text: PropTypes.Requireable<string>;
|
|
97
|
+
/**
|
|
98
|
+
* Provide a custom `title` to be inserted in the tag.
|
|
99
|
+
*/
|
|
100
|
+
tagTitle: PropTypes.Requireable<string>;
|
|
93
101
|
/**
|
|
94
102
|
* Text to show on clear filters
|
|
95
103
|
*/
|
|
@@ -41,6 +41,7 @@ const DismissibleTag = _ref => {
|
|
|
41
41
|
slug,
|
|
42
42
|
size,
|
|
43
43
|
text,
|
|
44
|
+
tagTitle,
|
|
44
45
|
type,
|
|
45
46
|
...other
|
|
46
47
|
} = _ref;
|
|
@@ -86,7 +87,7 @@ const DismissibleTag = _ref => {
|
|
|
86
87
|
}, otherProps), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
87
88
|
className: `${prefix}--interactive--tag-children`
|
|
88
89
|
}, /*#__PURE__*/React__default["default"].createElement(Text.Text, {
|
|
89
|
-
title: text,
|
|
90
|
+
title: tagTitle ? tagTitle : text,
|
|
90
91
|
className: `${prefix}--tag__label`
|
|
91
92
|
}, text), /*#__PURE__*/React__default["default"].createElement(Tooltip.Tooltip, {
|
|
92
93
|
label: isEllipsisApplied ? dismissLabel : title,
|
|
@@ -99,8 +100,7 @@ const DismissibleTag = _ref => {
|
|
|
99
100
|
className: `${prefix}--tag__close-icon`,
|
|
100
101
|
onClick: handleClose,
|
|
101
102
|
disabled: disabled,
|
|
102
|
-
"aria-label": title
|
|
103
|
-
title: title
|
|
103
|
+
"aria-label": title
|
|
104
104
|
}, _Close || (_Close = /*#__PURE__*/React__default["default"].createElement(iconsReact.Close, null)))), normalizedSlug));
|
|
105
105
|
};
|
|
106
106
|
DismissibleTag.propTypes = {
|
|
@@ -138,6 +138,10 @@ DismissibleTag.propTypes = {
|
|
|
138
138
|
* Provide text to be rendered inside of a the tag.
|
|
139
139
|
*/
|
|
140
140
|
text: PropTypes__default["default"].string,
|
|
141
|
+
/**
|
|
142
|
+
* Provide a custom `title` to be inserted in the tag.
|
|
143
|
+
*/
|
|
144
|
+
tagTitle: PropTypes__default["default"].string,
|
|
141
145
|
/**
|
|
142
146
|
* Text to show on clear filters
|
|
143
147
|
*/
|
|
@@ -141,10 +141,10 @@ const Tag = /*#__PURE__*/React__default["default"].forwardRef(function Tag(_ref,
|
|
|
141
141
|
definition: children !== null && children !== undefined ? children : typeText,
|
|
142
142
|
className: `${prefix}--definition--tooltip--tag`
|
|
143
143
|
}, /*#__PURE__*/React__default["default"].createElement(Text.Text, {
|
|
144
|
-
title: children !== null && children !== undefined ? children : typeText,
|
|
144
|
+
title: children !== null && children !== undefined && typeof children === 'string' ? children : typeText,
|
|
145
145
|
className: labelClasses
|
|
146
146
|
}, children !== null && children !== undefined ? children : typeText)) : /*#__PURE__*/React__default["default"].createElement(Text.Text, {
|
|
147
|
-
title: children !== null && children !== undefined ? children : typeText,
|
|
147
|
+
title: children !== null && children !== undefined && typeof children === 'string' ? children : typeText,
|
|
148
148
|
className: labelClasses
|
|
149
149
|
}, children !== null && children !== undefined ? children : typeText), normalizedSlug);
|
|
150
150
|
});
|
|
@@ -84,7 +84,8 @@ function Toggletip(_ref2) {
|
|
|
84
84
|
const prefix = usePrefix.usePrefix();
|
|
85
85
|
const id = useId.useId();
|
|
86
86
|
const className = cx__default["default"](`${prefix}--toggletip`, customClassName, {
|
|
87
|
-
[`${prefix}--toggletip--open`]: open
|
|
87
|
+
[`${prefix}--toggletip--open`]: open,
|
|
88
|
+
[`${prefix}--autoalign`]: autoAlign
|
|
88
89
|
});
|
|
89
90
|
const actions = {
|
|
90
91
|
toggle: () => {
|
|
@@ -27,7 +27,7 @@ var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
|
|
|
27
27
|
var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
|
|
28
28
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
29
29
|
|
|
30
|
-
const TreeNode = /*#__PURE__*/React__default["default"].forwardRef((_ref,
|
|
30
|
+
const TreeNode = /*#__PURE__*/React__default["default"].forwardRef((_ref, forwardedRef) => {
|
|
31
31
|
let {
|
|
32
32
|
active,
|
|
33
33
|
children,
|
|
@@ -64,6 +64,14 @@ const TreeNode = /*#__PURE__*/React__default["default"].forwardRef((_ref, ref) =
|
|
|
64
64
|
const currentNode = React.useRef(null);
|
|
65
65
|
const currentNodeLabel = React.useRef(null);
|
|
66
66
|
const prefix = usePrefix.usePrefix();
|
|
67
|
+
const setRefs = element => {
|
|
68
|
+
currentNode.current = element;
|
|
69
|
+
if (typeof forwardedRef === 'function') {
|
|
70
|
+
forwardedRef(element);
|
|
71
|
+
} else if (forwardedRef) {
|
|
72
|
+
forwardedRef.current = element;
|
|
73
|
+
}
|
|
74
|
+
};
|
|
67
75
|
const nodesWithProps = React__default["default"].Children.map(children, node => {
|
|
68
76
|
if ( /*#__PURE__*/React__default["default"].isValidElement(node)) {
|
|
69
77
|
return /*#__PURE__*/React__default["default"].cloneElement(node, {
|
|
@@ -131,13 +139,14 @@ const TreeNode = /*#__PURE__*/React__default["default"].forwardRef((_ref, ref) =
|
|
|
131
139
|
}
|
|
132
140
|
if (match.match(event, keys.ArrowLeft)) {
|
|
133
141
|
const findParentTreeNode = node => {
|
|
142
|
+
if (!node) return null;
|
|
134
143
|
if (node.classList.contains(`${prefix}--tree-parent-node`)) {
|
|
135
144
|
return node;
|
|
136
145
|
}
|
|
137
146
|
if (node.classList.contains(`${prefix}--tree`)) {
|
|
138
147
|
return null;
|
|
139
148
|
}
|
|
140
|
-
return findParentTreeNode(node.
|
|
149
|
+
return findParentTreeNode(node.parentElement);
|
|
141
150
|
};
|
|
142
151
|
if (children && expanded) {
|
|
143
152
|
if (!enableTreeviewControllable) {
|
|
@@ -154,7 +163,10 @@ const TreeNode = /*#__PURE__*/React__default["default"].forwardRef((_ref, ref) =
|
|
|
154
163
|
* When focus is on a leaf node or a closed parent node, move focus to
|
|
155
164
|
* its parent node (unless its depth is level 1)
|
|
156
165
|
*/
|
|
157
|
-
findParentTreeNode(currentNode.current?.
|
|
166
|
+
const parentNode = findParentTreeNode(currentNode.current?.parentElement || null);
|
|
167
|
+
if (parentNode instanceof HTMLElement) {
|
|
168
|
+
parentNode.focus();
|
|
169
|
+
}
|
|
158
170
|
}
|
|
159
171
|
}
|
|
160
172
|
if (children && match.match(event, keys.ArrowRight)) {
|
|
@@ -239,44 +251,40 @@ const TreeNode = /*#__PURE__*/React__default["default"].forwardRef((_ref, ref) =
|
|
|
239
251
|
onClick: handleClick,
|
|
240
252
|
onFocus: handleFocusEvent,
|
|
241
253
|
onKeyDown: handleKeyDown,
|
|
242
|
-
role: 'treeitem'
|
|
243
|
-
// @ts-ignore
|
|
244
|
-
ref: currentNode
|
|
254
|
+
role: 'treeitem'
|
|
245
255
|
};
|
|
246
256
|
if (!children) {
|
|
247
|
-
return /*#__PURE__*/React__default["default"].createElement("li",
|
|
257
|
+
return /*#__PURE__*/React__default["default"].createElement("li", _rollupPluginBabelHelpers["extends"]({}, treeNodeProps, {
|
|
258
|
+
ref: setRefs
|
|
259
|
+
}), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
248
260
|
className: `${prefix}--tree-node__label`,
|
|
249
261
|
ref: currentNodeLabel
|
|
250
262
|
}, Icon && /*#__PURE__*/React__default["default"].createElement(Icon, {
|
|
251
263
|
className: `${prefix}--tree-node__icon`
|
|
252
264
|
}), label));
|
|
253
265
|
}
|
|
254
|
-
return (
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
role: "group",
|
|
277
|
-
className: `${prefix}--tree-node__children`
|
|
278
|
-
}, nodesWithProps))
|
|
279
|
-
);
|
|
266
|
+
return /*#__PURE__*/React__default["default"].createElement("li", _rollupPluginBabelHelpers["extends"]({}, treeNodeProps, {
|
|
267
|
+
"aria-expanded": !!expanded,
|
|
268
|
+
ref: setRefs
|
|
269
|
+
}), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
270
|
+
className: `${prefix}--tree-node__label`,
|
|
271
|
+
ref: currentNodeLabel
|
|
272
|
+
}, /*#__PURE__*/React__default["default"].createElement("span", {
|
|
273
|
+
className: `${prefix}--tree-parent-node__toggle`
|
|
274
|
+
// @ts-ignore
|
|
275
|
+
,
|
|
276
|
+
disabled: disabled,
|
|
277
|
+
onClick: handleToggleClick
|
|
278
|
+
}, /*#__PURE__*/React__default["default"].createElement(iconsReact.CaretDown, {
|
|
279
|
+
className: toggleClasses
|
|
280
|
+
})), /*#__PURE__*/React__default["default"].createElement("span", {
|
|
281
|
+
className: `${prefix}--tree-node__label__details`
|
|
282
|
+
}, Icon && /*#__PURE__*/React__default["default"].createElement(Icon, {
|
|
283
|
+
className: `${prefix}--tree-node__icon`
|
|
284
|
+
}), label)), expanded && /*#__PURE__*/React__default["default"].createElement("ul", {
|
|
285
|
+
role: "group",
|
|
286
|
+
className: `${prefix}--tree-node__children`
|
|
287
|
+
}, nodesWithProps));
|
|
280
288
|
});
|
|
281
289
|
TreeNode.propTypes = {
|
|
282
290
|
/**
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
import React from 'react';
|
|
8
|
-
import TreeNode from './TreeNode';
|
|
8
|
+
import TreeNode, { TreeNodeProps } from './TreeNode';
|
|
9
9
|
export type TreeViewProps = {
|
|
10
10
|
/**
|
|
11
11
|
* Mark the active node in the tree, represented by its ID
|
|
@@ -40,7 +40,9 @@ export type TreeViewProps = {
|
|
|
40
40
|
/**
|
|
41
41
|
* Callback function that is called when any node is selected
|
|
42
42
|
*/
|
|
43
|
-
onSelect?: (
|
|
43
|
+
onSelect?: (event: React.SyntheticEvent<HTMLUListElement>, payload?: Partial<TreeNodeProps> & {
|
|
44
|
+
activeNodeId?: string | number;
|
|
45
|
+
}) => void;
|
|
44
46
|
/**
|
|
45
47
|
* Array representing all selected node IDs in the tree
|
|
46
48
|
*/
|
|
@@ -49,7 +51,7 @@ export type TreeViewProps = {
|
|
|
49
51
|
* Specify the size of the tree from a list of available sizes.
|
|
50
52
|
*/
|
|
51
53
|
size?: 'xs' | 'sm';
|
|
52
|
-
} & React.HTMLAttributes<HTMLUListElement>;
|
|
54
|
+
} & Omit<React.HTMLAttributes<HTMLUListElement>, 'onSelect'>;
|
|
53
55
|
type TreeViewComponent = {
|
|
54
56
|
(props: TreeViewProps): JSX.Element;
|
|
55
57
|
propTypes?: any;
|
package/lib/index.js
CHANGED
|
@@ -163,6 +163,8 @@ var SideNavMenuItem = require('./components/UIShell/SideNavMenuItem.js');
|
|
|
163
163
|
var SideNavSwitcher = require('./components/UIShell/SideNavSwitcher.js');
|
|
164
164
|
var UnorderedList = require('./components/UnorderedList/UnorderedList.js');
|
|
165
165
|
var index = require('./components/FeatureFlags/index.js');
|
|
166
|
+
var FluidTextArea = require('./components/FluidTextArea/FluidTextArea.js');
|
|
167
|
+
var FluidTextArea_Skeleton = require('./components/FluidTextArea/FluidTextArea.Skeleton.js');
|
|
166
168
|
var index$c = require('./components/Heading/index.js');
|
|
167
169
|
var index$d = require('./components/IconButton/index.js');
|
|
168
170
|
var index$e = require('./components/Layer/index.js');
|
|
@@ -171,6 +173,8 @@ var index$2 = require('./components/OverflowMenuV2/index.js');
|
|
|
171
173
|
var index$f = require('./components/Popover/index.js');
|
|
172
174
|
var ProgressBar = require('./components/ProgressBar/ProgressBar.js');
|
|
173
175
|
var index$3 = require('./components/AILabel/index.js');
|
|
176
|
+
var ChatButton = require('./components/ChatButton/ChatButton.js');
|
|
177
|
+
var ChatButton_Skeleton = require('./components/ChatButton/ChatButton.Skeleton.js');
|
|
174
178
|
var AISkeletonPlaceholder = require('./components/AISkeleton/AISkeletonPlaceholder.js');
|
|
175
179
|
var AISkeletonIcon = require('./components/AISkeleton/AISkeletonIcon.js');
|
|
176
180
|
var AISkeletonText = require('./components/AISkeleton/AISkeletonText.js');
|
|
@@ -182,8 +186,6 @@ var usePrefix = require('./internal/usePrefix.js');
|
|
|
182
186
|
var useIdPrefix = require('./internal/useIdPrefix.js');
|
|
183
187
|
var FluidDatePicker_Skeleton = require('./components/FluidDatePicker/FluidDatePicker.Skeleton.js');
|
|
184
188
|
var FluidSearch_Skeleton = require('./components/FluidSearch/FluidSearch.Skeleton.js');
|
|
185
|
-
var FluidTextArea = require('./components/FluidTextArea/FluidTextArea.js');
|
|
186
|
-
var FluidTextArea_Skeleton = require('./components/FluidTextArea/FluidTextArea.Skeleton.js');
|
|
187
189
|
var FluidTextInput = require('./components/FluidTextInput/FluidTextInput.js');
|
|
188
190
|
var FluidTextInput_Skeleton = require('./components/FluidTextInput/FluidTextInput.Skeleton.js');
|
|
189
191
|
var PageSelector = require('./components/Pagination/experimental/PageSelector.js');
|
|
@@ -210,8 +212,6 @@ var FluidTimePicker_Skeleton = require('./components/FluidTimePicker/FluidTimePi
|
|
|
210
212
|
var FluidTimePickerSelect = require('./components/FluidTimePickerSelect/FluidTimePickerSelect.js');
|
|
211
213
|
var LayoutDirection = require('./components/LayoutDirection/LayoutDirection.js');
|
|
212
214
|
var useLayoutDirection = require('./components/LayoutDirection/useLayoutDirection.js');
|
|
213
|
-
var ChatButton = require('./components/ChatButton/ChatButton.js');
|
|
214
|
-
var ChatButton_Skeleton = require('./components/ChatButton/ChatButton.Skeleton.js');
|
|
215
215
|
var Text = require('./components/Text/Text.js');
|
|
216
216
|
var TextDirection = require('./components/Text/TextDirection.js');
|
|
217
217
|
var CheckboxGroup = require('./components/CheckboxGroup/CheckboxGroup.js');
|
|
@@ -429,6 +429,8 @@ exports.UnorderedList = UnorderedList["default"];
|
|
|
429
429
|
exports.unstable_FeatureFlags = index.FeatureFlags;
|
|
430
430
|
exports.unstable_useFeatureFlag = index.useFeatureFlag;
|
|
431
431
|
exports.unstable_useFeatureFlags = index.useFeatureFlags;
|
|
432
|
+
exports.unstable__FluidTextArea = FluidTextArea["default"];
|
|
433
|
+
exports.unstable__FluidTextAreaSkeleton = FluidTextArea_Skeleton["default"];
|
|
432
434
|
exports.Heading = index$c.Heading;
|
|
433
435
|
exports.Section = index$c.Section;
|
|
434
436
|
exports.IconButton = index$d.IconButton;
|
|
@@ -446,6 +448,8 @@ exports.AILabelContent = index$3.AILabelContent;
|
|
|
446
448
|
exports.unstable__Slug = index$3.AILabel;
|
|
447
449
|
exports.unstable__SlugActions = index$3.AILabelActions;
|
|
448
450
|
exports.unstable__SlugContent = index$3.AILabelContent;
|
|
451
|
+
exports.unstable__ChatButton = ChatButton["default"];
|
|
452
|
+
exports.unstable__ChatButtonSkeleton = ChatButton_Skeleton["default"];
|
|
449
453
|
exports.AISkeletonPlaceholder = AISkeletonPlaceholder["default"];
|
|
450
454
|
exports.unstable__AiSkeletonPlaceholder = AISkeletonPlaceholder["default"];
|
|
451
455
|
exports.AISkeletonIcon = AISkeletonIcon["default"];
|
|
@@ -464,8 +468,6 @@ exports.usePrefix = usePrefix.usePrefix;
|
|
|
464
468
|
exports.useIdPrefix = useIdPrefix.useIdPrefix;
|
|
465
469
|
exports.unstable__FluidDatePickerSkeleton = FluidDatePicker_Skeleton["default"];
|
|
466
470
|
exports.unstable__FluidSearchSkeleton = FluidSearch_Skeleton["default"];
|
|
467
|
-
exports.unstable__FluidTextArea = FluidTextArea["default"];
|
|
468
|
-
exports.unstable__FluidTextAreaSkeleton = FluidTextArea_Skeleton["default"];
|
|
469
471
|
exports.unstable__FluidTextInput = FluidTextInput["default"];
|
|
470
472
|
exports.unstable__FluidTextInputSkeleton = FluidTextInput_Skeleton["default"];
|
|
471
473
|
exports.unstable_PageSelector = PageSelector["default"];
|
|
@@ -492,8 +494,6 @@ exports.unstable__FluidTimePickerSkeleton = FluidTimePicker_Skeleton["default"];
|
|
|
492
494
|
exports.unstable__FluidTimePickerSelect = FluidTimePickerSelect["default"];
|
|
493
495
|
exports.unstable_LayoutDirection = LayoutDirection.LayoutDirection;
|
|
494
496
|
exports.unstable_useLayoutDirection = useLayoutDirection.useLayoutDirection;
|
|
495
|
-
exports.unstable__ChatButton = ChatButton["default"];
|
|
496
|
-
exports.unstable__ChatButtonSkeleton = ChatButton_Skeleton["default"];
|
|
497
497
|
exports.unstable_Text = Text.Text;
|
|
498
498
|
exports.unstable_TextDirection = TextDirection.TextDirection;
|
|
499
499
|
exports.CheckboxGroup = CheckboxGroup["default"];
|
|
@@ -43,7 +43,9 @@ function useSelection(_ref2) {
|
|
|
43
43
|
disabled,
|
|
44
44
|
onChange,
|
|
45
45
|
initialSelectedItems = [],
|
|
46
|
-
selectedItems: controlledItems
|
|
46
|
+
selectedItems: controlledItems,
|
|
47
|
+
selectAll = false,
|
|
48
|
+
filteredItems = []
|
|
47
49
|
} = _ref2;
|
|
48
50
|
const isMounted = React.useRef(false);
|
|
49
51
|
const savedOnChange = React.useRef(onChange);
|
|
@@ -54,25 +56,35 @@ function useSelection(_ref2) {
|
|
|
54
56
|
if (disabled) {
|
|
55
57
|
return;
|
|
56
58
|
}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
if (isEqual__default["default"](selectedItem, item)) {
|
|
60
|
-
selectedIndex = index;
|
|
61
|
-
}
|
|
62
|
-
});
|
|
59
|
+
const allSelectableItems = filteredItems.filter(item => !item.disabled);
|
|
60
|
+
const disabledItemCount = filteredItems.filter(item => item.disabled).length;
|
|
63
61
|
let newSelectedItems;
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
62
|
+
|
|
63
|
+
//deselect all on click to All/indeterminate option
|
|
64
|
+
if (item && item.isSelectAll && selectedItems.length > 0) {
|
|
65
|
+
newSelectedItems = [];
|
|
66
|
+
}
|
|
67
|
+
//select all option
|
|
68
|
+
else if (item && item.isSelectAll && selectedItems.length == 0) {
|
|
69
|
+
newSelectedItems = allSelectableItems;
|
|
70
|
+
} else {
|
|
71
|
+
let selectedIndex;
|
|
72
|
+
selectedItems.forEach((selectedItem, index) => {
|
|
73
|
+
if (isEqual__default["default"](selectedItem, item)) {
|
|
74
|
+
selectedIndex = index;
|
|
75
|
+
}
|
|
72
76
|
});
|
|
73
|
-
|
|
77
|
+
if (selectedIndex === undefined) {
|
|
78
|
+
newSelectedItems = selectedItems.concat(item);
|
|
79
|
+
// checking if all items are selected then We should select mark the 'select All' option as well
|
|
80
|
+
if (selectAll && filteredItems.length - 1 === newSelectedItems.length + disabledItemCount) {
|
|
81
|
+
newSelectedItems = allSelectableItems;
|
|
82
|
+
}
|
|
83
|
+
} else {
|
|
84
|
+
newSelectedItems = removeAtIndex(selectedItems, selectedIndex);
|
|
85
|
+
newSelectedItems = newSelectedItems.filter(item => !item.isSelectAll);
|
|
86
|
+
}
|
|
74
87
|
}
|
|
75
|
-
newSelectedItems = removeAtIndex(selectedItems, selectedIndex);
|
|
76
88
|
callOnChangeHandler({
|
|
77
89
|
isControlled,
|
|
78
90
|
isMounted: isMounted.current,
|
|
@@ -80,7 +92,7 @@ function useSelection(_ref2) {
|
|
|
80
92
|
onChangeHandlerUncontrolled: setUncontrolledItems,
|
|
81
93
|
selectedItems: newSelectedItems
|
|
82
94
|
});
|
|
83
|
-
}, [disabled,
|
|
95
|
+
}, [disabled, selectedItems, filteredItems, selectAll, isControlled]);
|
|
84
96
|
const clearSelection = React.useCallback(() => {
|
|
85
97
|
if (disabled) {
|
|
86
98
|
return;
|
|
@@ -10,4 +10,4 @@ import { Ref, ForwardedRef } from 'react';
|
|
|
10
10
|
* refs from both `React.forwardRef` and `useRef` that you would like to add to
|
|
11
11
|
* the same node.
|
|
12
12
|
*/
|
|
13
|
-
export declare const useMergedRefs: <T>(refs: ForwardedRef<T>[]) => Ref<T>;
|
|
13
|
+
export declare const useMergedRefs: <T extends unknown>(refs: ForwardedRef<T>[]) => Ref<T>;
|
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.66.0",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "lib/index.js",
|
|
7
7
|
"module": "es/index.js",
|
|
@@ -49,9 +49,9 @@
|
|
|
49
49
|
"dependencies": {
|
|
50
50
|
"@babel/runtime": "^7.24.7",
|
|
51
51
|
"@carbon/feature-flags": "^0.22.0",
|
|
52
|
-
"@carbon/icons-react": "^11.
|
|
53
|
-
"@carbon/layout": "^11.
|
|
54
|
-
"@carbon/styles": "^1.
|
|
52
|
+
"@carbon/icons-react": "^11.49.0",
|
|
53
|
+
"@carbon/layout": "^11.26.0",
|
|
54
|
+
"@carbon/styles": "^1.65.0",
|
|
55
55
|
"@floating-ui/react": "^0.26.0",
|
|
56
56
|
"@ibm/telemetry-js": "^1.5.0",
|
|
57
57
|
"classnames": "2.5.1",
|
|
@@ -79,22 +79,25 @@
|
|
|
79
79
|
"@babel/preset-env": "^7.24.7",
|
|
80
80
|
"@babel/preset-react": "^7.24.7",
|
|
81
81
|
"@babel/preset-typescript": "^7.24.7",
|
|
82
|
-
"@carbon/test-utils": "^10.
|
|
83
|
-
"@carbon/themes": "^11.
|
|
84
|
-
"@figma/code-connect": "^1.0.
|
|
82
|
+
"@carbon/test-utils": "^10.32.0",
|
|
83
|
+
"@carbon/themes": "^11.40.0",
|
|
84
|
+
"@figma/code-connect": "^1.0.6",
|
|
85
85
|
"@rollup/plugin-babel": "^6.0.0",
|
|
86
86
|
"@rollup/plugin-commonjs": "^26.0.0",
|
|
87
87
|
"@rollup/plugin-node-resolve": "^15.0.0",
|
|
88
88
|
"@rollup/plugin-typescript": "^11.0.0",
|
|
89
|
-
"@storybook/addon-a11y": "^
|
|
90
|
-
"@storybook/addon-actions": "^
|
|
91
|
-
"@storybook/addon-docs": "^
|
|
92
|
-
"@storybook/addon-essentials": "^
|
|
93
|
-
"@storybook/addon-links": "^
|
|
94
|
-
"@storybook/addon-storysource": "^
|
|
95
|
-
"@storybook/
|
|
96
|
-
"@storybook/
|
|
97
|
-
"@storybook/
|
|
89
|
+
"@storybook/addon-a11y": "^8.2.8",
|
|
90
|
+
"@storybook/addon-actions": "^8.2.8",
|
|
91
|
+
"@storybook/addon-docs": "^8.2.8",
|
|
92
|
+
"@storybook/addon-essentials": "^8.2.8",
|
|
93
|
+
"@storybook/addon-links": "^8.1.10",
|
|
94
|
+
"@storybook/addon-storysource": "^8.2.8",
|
|
95
|
+
"@storybook/addon-webpack5-compiler-babel": "^3.0.3",
|
|
96
|
+
"@storybook/blocks": "^8.2.8",
|
|
97
|
+
"@storybook/manager-api": "^8.2.8",
|
|
98
|
+
"@storybook/react": "^8.2.8",
|
|
99
|
+
"@storybook/react-webpack5": "^8.2.8",
|
|
100
|
+
"@storybook/theming": "^8.2.8",
|
|
98
101
|
"@types/react-is": "~18.3.0",
|
|
99
102
|
"autoprefixer": "^10.4.0",
|
|
100
103
|
"babel-loader": "^9.0.0",
|
|
@@ -115,20 +118,20 @@
|
|
|
115
118
|
"prop-types": "^15.7.2",
|
|
116
119
|
"react": "^18.2.0",
|
|
117
120
|
"react-dom": "^18.2.0",
|
|
118
|
-
"remark-gfm": "^
|
|
121
|
+
"remark-gfm": "^4.0.0",
|
|
119
122
|
"requestanimationframe": "^0.0.23",
|
|
120
123
|
"rimraf": "^6.0.0",
|
|
121
124
|
"rollup": "^2.79.1",
|
|
122
125
|
"rollup-plugin-strip-banner": "^3.0.0",
|
|
123
|
-
"sass": "^1.
|
|
124
|
-
"sass-loader": "^
|
|
125
|
-
"storybook": "^
|
|
126
|
+
"sass": "^1.77.7",
|
|
127
|
+
"sass-loader": "^16.0.0",
|
|
128
|
+
"storybook": "^8.2.8",
|
|
126
129
|
"storybook-addon-accessibility-checker": "^3.1.61-rc.3",
|
|
127
130
|
"stream-browserify": "^3.0.0",
|
|
128
131
|
"style-loader": "^4.0.0",
|
|
129
132
|
"typescript-config-carbon": "^0.3.0",
|
|
130
133
|
"webpack": "^5.65.0",
|
|
131
|
-
"webpack-dev-server": "^
|
|
134
|
+
"webpack-dev-server": "^5.0.0"
|
|
132
135
|
},
|
|
133
136
|
"sideEffects": [
|
|
134
137
|
"es/index.js",
|
|
@@ -141,5 +144,5 @@
|
|
|
141
144
|
"**/*.scss",
|
|
142
145
|
"**/*.css"
|
|
143
146
|
],
|
|
144
|
-
"gitHead": "
|
|
147
|
+
"gitHead": "d706ffca254bad174fdfc88c05f620ba547cc369"
|
|
145
148
|
}
|