@carbon/react 1.63.1 → 1.64.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 +1558 -1265
- package/es/components/{Slug → AILabel}/index.js +47 -35
- package/es/components/{AiSkeleton/AiSkeletonIcon.d.ts → AISkeleton/AISkeletonIcon.d.ts} +4 -4
- package/es/components/{AiSkeleton/AiSkeletonIcon.js → AISkeleton/AISkeletonIcon.js} +5 -5
- package/es/components/{AiSkeleton/AiSkeletonPlaceholder.d.ts → AISkeleton/AISkeletonPlaceholder.d.ts} +4 -4
- package/es/components/{AiSkeleton/AiSkeletonPlaceholder.js → AISkeleton/AISkeletonPlaceholder.js} +5 -5
- package/es/components/{AiSkeleton/AiSkeletonText.d.ts → AISkeleton/AISkeletonText.d.ts} +4 -4
- package/es/components/{AiSkeleton/AiSkeletonText.js → AISkeleton/AISkeletonText.js} +3 -3
- package/es/components/AISkeleton/index.d.ts +10 -0
- package/es/components/CheckboxGroup/CheckboxGroup.js +1 -1
- package/es/components/ComboBox/ComboBox.d.ts +21 -6
- package/es/components/ComboBox/ComboBox.js +52 -14
- package/es/components/ComposedModal/ComposedModal.js +1 -1
- package/es/components/DataTable/DataTable.js +1 -1
- package/es/components/DataTable/TableSelectRow.js +2 -1
- package/es/components/DataTable/TableToolbarSearch.js +2 -2
- package/es/components/DatePicker/DatePicker.js +65 -14
- package/es/components/DatePicker/plugins/fixEventsPlugin.js +11 -0
- package/es/components/DatePickerInput/DatePickerInput.js +1 -1
- package/es/components/Dropdown/Dropdown.d.ts +6 -4
- package/es/components/Dropdown/Dropdown.js +18 -10
- package/es/components/FluidMultiSelect/FluidMultiSelect.js +10 -6
- package/es/components/Menu/MenuItem.js +45 -63
- package/es/components/Modal/Modal.js +1 -1
- package/es/components/MultiSelect/FilterableMultiSelect.d.ts +6 -4
- package/es/components/MultiSelect/FilterableMultiSelect.js +50 -27
- package/es/components/MultiSelect/MultiSelect.d.ts +6 -4
- package/es/components/MultiSelect/MultiSelect.js +12 -8
- package/es/components/NumberInput/NumberInput.js +2 -2
- package/es/components/OverflowMenu/OverflowMenu.js +2 -1
- package/es/components/OverflowMenu/next/index.js +2 -1
- package/es/components/RadioButtonGroup/RadioButtonGroup.js +1 -1
- package/es/components/RadioTile/RadioTile.js +1 -1
- package/es/components/Select/Select.js +1 -1
- package/es/components/Tabs/Tabs.js +3 -3
- package/es/components/Tag/DismissibleTag.js +1 -1
- package/es/components/Tag/OperationalTag.js +1 -1
- package/es/components/Tag/SelectableTag.js +3 -1
- package/es/components/Tag/Tag.js +1 -1
- package/es/components/TextArea/TextArea.js +1 -1
- package/es/components/TextInput/PasswordInput.js +5 -0
- package/es/components/TextInput/TextInput.js +1 -1
- package/es/components/Tile/Tile.js +2 -2
- package/es/components/TreeView/TreeNode.d.ts +150 -0
- package/es/components/TreeView/TreeNode.js +22 -15
- package/es/components/TreeView/TreeView.d.ts +59 -0
- package/es/components/TreeView/TreeView.js +37 -23
- package/es/components/TreeView/index.d.ts +11 -0
- package/es/components/UIShell/SwitcherItem.d.ts +4 -0
- package/es/components/UIShell/SwitcherItem.js +7 -1
- package/es/index.d.ts +4 -2
- package/es/index.js +6 -6
- package/es/node_modules/@floating-ui/core/dist/floating-ui.core.mjs.js +143 -0
- package/es/node_modules/@floating-ui/utils/dist/floating-ui.utils.mjs.js +39 -0
- package/lib/components/{Slug → AILabel}/index.js +49 -37
- package/lib/components/{AiSkeleton/AiSkeletonIcon.d.ts → AISkeleton/AISkeletonIcon.d.ts} +4 -4
- package/lib/components/{AiSkeleton/AiSkeletonIcon.js → AISkeleton/AISkeletonIcon.js} +5 -5
- package/lib/components/{AiSkeleton/AiSkeletonPlaceholder.d.ts → AISkeleton/AISkeletonPlaceholder.d.ts} +4 -4
- package/lib/components/{AiSkeleton/AiSkeletonPlaceholder.js → AISkeleton/AISkeletonPlaceholder.js} +5 -5
- package/lib/components/{AiSkeleton/AiSkeletonText.d.ts → AISkeleton/AISkeletonText.d.ts} +4 -4
- package/lib/components/{AiSkeleton/AiSkeletonText.js → AISkeleton/AISkeletonText.js} +3 -3
- package/lib/components/AISkeleton/index.d.ts +10 -0
- package/lib/components/CheckboxGroup/CheckboxGroup.js +1 -1
- package/lib/components/ComboBox/ComboBox.d.ts +21 -6
- package/lib/components/ComboBox/ComboBox.js +52 -14
- package/lib/components/ComposedModal/ComposedModal.js +1 -1
- package/lib/components/DataTable/DataTable.js +2 -2
- package/lib/components/DataTable/TableSelectRow.js +2 -1
- package/lib/components/DataTable/TableToolbarSearch.js +2 -2
- package/lib/components/DatePicker/DatePicker.js +65 -14
- package/lib/components/DatePicker/plugins/fixEventsPlugin.js +11 -0
- package/lib/components/DatePickerInput/DatePickerInput.js +1 -1
- package/lib/components/Dropdown/Dropdown.d.ts +6 -4
- package/lib/components/Dropdown/Dropdown.js +18 -10
- package/lib/components/FluidMultiSelect/FluidMultiSelect.js +10 -6
- package/lib/components/Menu/MenuItem.js +44 -62
- package/lib/components/Modal/Modal.js +1 -1
- package/lib/components/MultiSelect/FilterableMultiSelect.d.ts +6 -4
- package/lib/components/MultiSelect/FilterableMultiSelect.js +49 -26
- package/lib/components/MultiSelect/MultiSelect.d.ts +6 -4
- package/lib/components/MultiSelect/MultiSelect.js +12 -8
- package/lib/components/NumberInput/NumberInput.js +2 -2
- package/lib/components/OverflowMenu/OverflowMenu.js +2 -1
- package/lib/components/OverflowMenu/next/index.js +2 -1
- package/lib/components/RadioButtonGroup/RadioButtonGroup.js +1 -1
- package/lib/components/RadioTile/RadioTile.js +1 -1
- package/lib/components/Select/Select.js +1 -1
- package/lib/components/Tabs/Tabs.js +2 -2
- package/lib/components/Tag/DismissibleTag.js +1 -1
- package/lib/components/Tag/OperationalTag.js +1 -1
- package/lib/components/Tag/SelectableTag.js +3 -1
- package/lib/components/Tag/Tag.js +1 -1
- package/lib/components/TextArea/TextArea.js +1 -1
- package/lib/components/TextInput/PasswordInput.js +5 -0
- package/lib/components/TextInput/TextInput.js +1 -1
- package/lib/components/Tile/Tile.js +2 -2
- package/lib/components/TreeView/TreeNode.d.ts +150 -0
- package/lib/components/TreeView/TreeNode.js +24 -17
- package/lib/components/TreeView/TreeView.d.ts +59 -0
- package/lib/components/TreeView/TreeView.js +39 -25
- package/lib/components/TreeView/index.d.ts +11 -0
- package/lib/components/UIShell/SwitcherItem.d.ts +4 -0
- package/lib/components/UIShell/SwitcherItem.js +7 -1
- package/lib/index.d.ts +4 -2
- package/lib/index.js +20 -14
- package/lib/node_modules/@floating-ui/core/dist/floating-ui.core.mjs.js +148 -0
- package/lib/node_modules/@floating-ui/utils/dist/floating-ui.utils.mjs.js +47 -0
- package/package.json +4 -4
- package/scss/components/ai-label/_ai-label.scss +9 -0
- package/scss/components/ai-label/_index.scss +9 -0
- package/es/components/AiSkeleton/index.d.ts +0 -10
- package/es/components/DataTable/tools/instanceId.js +0 -20
- package/lib/components/AiSkeleton/index.d.ts +0 -10
- package/lib/components/DataTable/tools/instanceId.js +0 -24
|
@@ -14,26 +14,26 @@ import { ToggletipContent, ToggletipActions, Toggletip, ToggletipButton } from '
|
|
|
14
14
|
import { IconButton } from '../IconButton/index.js';
|
|
15
15
|
import { Undo } from '@carbon/icons-react';
|
|
16
16
|
import { useId } from '../../internal/useId.js';
|
|
17
|
+
import deprecate from '../../prop-types/deprecate.js';
|
|
17
18
|
|
|
18
19
|
var _Undo;
|
|
19
|
-
const
|
|
20
|
+
const AILabelContent = /*#__PURE__*/React__default.forwardRef(function AILabelContent(_ref, ref) {
|
|
20
21
|
let {
|
|
21
22
|
children,
|
|
22
23
|
className
|
|
23
24
|
} = _ref;
|
|
24
25
|
const prefix = usePrefix();
|
|
25
|
-
const
|
|
26
|
-
const
|
|
26
|
+
const hasAILabelActions = React__default.Children.toArray(children).some(child => child.type?.displayName === 'AILabelActions');
|
|
27
|
+
const aiLabelContentClasses = cx(className, {
|
|
27
28
|
[`${prefix}--slug-content`]: true,
|
|
28
|
-
[`${prefix}--slug-content--with-actions`]:
|
|
29
|
+
[`${prefix}--slug-content--with-actions`]: hasAILabelActions
|
|
29
30
|
});
|
|
30
31
|
return /*#__PURE__*/React__default.createElement(ToggletipContent, {
|
|
31
|
-
className:
|
|
32
|
-
ref: ref
|
|
32
|
+
className: aiLabelContentClasses
|
|
33
33
|
}, children);
|
|
34
34
|
});
|
|
35
|
-
|
|
36
|
-
|
|
35
|
+
AILabelContent.displayName = 'AILabelContent';
|
|
36
|
+
AILabelContent.propTypes = {
|
|
37
37
|
/**
|
|
38
38
|
* Specify the content you want rendered inside the slug ToggleTip
|
|
39
39
|
*/
|
|
@@ -43,22 +43,22 @@ SlugContent.propTypes = {
|
|
|
43
43
|
*/
|
|
44
44
|
className: PropTypes.string
|
|
45
45
|
};
|
|
46
|
-
const
|
|
46
|
+
const AILabelActions = /*#__PURE__*/React__default.forwardRef(function AILabelActions(_ref2, ref) {
|
|
47
47
|
let {
|
|
48
48
|
children,
|
|
49
49
|
className
|
|
50
50
|
} = _ref2;
|
|
51
51
|
const prefix = usePrefix();
|
|
52
|
-
const
|
|
52
|
+
const aiLabelActionsClasses = cx(className, {
|
|
53
53
|
[`${prefix}--slug-actions`]: true
|
|
54
54
|
});
|
|
55
55
|
return /*#__PURE__*/React__default.createElement(ToggletipActions, {
|
|
56
|
-
className:
|
|
56
|
+
className: aiLabelActionsClasses,
|
|
57
57
|
ref: ref
|
|
58
58
|
}, children);
|
|
59
59
|
});
|
|
60
|
-
|
|
61
|
-
|
|
60
|
+
AILabelActions.displayName = 'AILabelActions';
|
|
61
|
+
AILabelActions.propTypes = {
|
|
62
62
|
/**
|
|
63
63
|
* Specify the content you want rendered inside the slug callout toolbar
|
|
64
64
|
*/
|
|
@@ -68,10 +68,11 @@ SlugActions.propTypes = {
|
|
|
68
68
|
*/
|
|
69
69
|
className: PropTypes.string
|
|
70
70
|
};
|
|
71
|
-
const
|
|
71
|
+
const AILabel = /*#__PURE__*/React__default.forwardRef(function AILabel(_ref3, ref) {
|
|
72
72
|
let {
|
|
73
73
|
aiText = 'AI',
|
|
74
74
|
aiTextLabel,
|
|
75
|
+
textLabel,
|
|
75
76
|
align,
|
|
76
77
|
autoAlign = true,
|
|
77
78
|
children,
|
|
@@ -81,29 +82,30 @@ const Slug = /*#__PURE__*/React__default.forwardRef(function Slug(_ref3, ref) {
|
|
|
81
82
|
revertActive,
|
|
82
83
|
revertLabel = 'Revert to AI input',
|
|
83
84
|
slugLabel = 'Show information',
|
|
85
|
+
['aria-label']: ariaLabel = 'Show information',
|
|
84
86
|
size = 'xs',
|
|
85
87
|
...rest
|
|
86
88
|
} = _ref3;
|
|
87
89
|
const prefix = usePrefix();
|
|
88
|
-
const id = useId('
|
|
89
|
-
const
|
|
90
|
+
const id = useId('AILabel');
|
|
91
|
+
const aiLabelClasses = cx(className, {
|
|
90
92
|
[`${prefix}--slug`]: true,
|
|
91
93
|
[`${prefix}--slug--revert`]: revertActive
|
|
92
94
|
});
|
|
93
|
-
const
|
|
95
|
+
const aiLabelButtonClasses = cx({
|
|
94
96
|
[`${prefix}--slug__button`]: true,
|
|
95
97
|
[`${prefix}--slug__button--${size}`]: size,
|
|
96
98
|
[`${prefix}--slug__button--${kind}`]: kind,
|
|
97
|
-
[`${prefix}--slug__button--inline-with-content`]: kind === 'inline' && aiTextLabel
|
|
99
|
+
[`${prefix}--slug__button--inline-with-content`]: kind === 'inline' && (aiTextLabel || textLabel)
|
|
98
100
|
});
|
|
99
101
|
const handleOnRevertClick = evt => {
|
|
100
102
|
if (onRevertClick) {
|
|
101
103
|
onRevertClick(evt);
|
|
102
104
|
}
|
|
103
105
|
};
|
|
104
|
-
const
|
|
106
|
+
const ariaLabelText = !aiTextLabel && !textLabel ? `${aiText} - ${slugLabel || ariaLabel}` : `${aiText} - ${aiTextLabel || textLabel}`;
|
|
105
107
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
106
|
-
className:
|
|
108
|
+
className: aiLabelClasses,
|
|
107
109
|
ref: ref,
|
|
108
110
|
id: id
|
|
109
111
|
}, revertActive ? /*#__PURE__*/React__default.createElement(IconButton, _extends({
|
|
@@ -115,24 +117,29 @@ const Slug = /*#__PURE__*/React__default.forwardRef(function Slug(_ref3, ref) {
|
|
|
115
117
|
align: align,
|
|
116
118
|
autoAlign: autoAlign
|
|
117
119
|
}, rest), /*#__PURE__*/React__default.createElement(ToggletipButton, {
|
|
118
|
-
className:
|
|
119
|
-
label:
|
|
120
|
+
className: aiLabelButtonClasses,
|
|
121
|
+
label: ariaLabelText
|
|
120
122
|
}, /*#__PURE__*/React__default.createElement("span", {
|
|
121
123
|
className: `${prefix}--slug__text`
|
|
122
|
-
}, aiText), aiTextLabel && /*#__PURE__*/React__default.createElement("span", {
|
|
124
|
+
}, aiText), kind === 'inline' && (aiTextLabel || textLabel) && /*#__PURE__*/React__default.createElement("span", {
|
|
123
125
|
className: `${prefix}--slug__additional-text`
|
|
124
|
-
}, aiTextLabel)), children));
|
|
126
|
+
}, aiTextLabel || textLabel)), children));
|
|
125
127
|
});
|
|
126
|
-
|
|
127
|
-
|
|
128
|
+
AILabel.displayName = 'AILabel';
|
|
129
|
+
AILabel.propTypes = {
|
|
130
|
+
/**
|
|
131
|
+
* Specify the content you want rendered inside the `AILabel` ToggleTip
|
|
132
|
+
*/
|
|
133
|
+
AILabelContent: PropTypes.node,
|
|
128
134
|
/**
|
|
129
135
|
* Specify the correct translation of the AI text
|
|
130
136
|
*/
|
|
131
137
|
aiText: PropTypes.string,
|
|
132
138
|
/**
|
|
139
|
+
* @deprecated
|
|
133
140
|
* Specify additional text to be rendered next to the AI label in the inline variant
|
|
134
141
|
*/
|
|
135
|
-
aiTextLabel: PropTypes.string,
|
|
142
|
+
aiTextLabel: deprecate(PropTypes.string, '`aiTextLabel` on `AILabel` has been deprecated - Please use the `textLabel` prop instead'),
|
|
136
143
|
/**
|
|
137
144
|
* Specify how the popover should align with the button
|
|
138
145
|
*/
|
|
@@ -153,20 +160,24 @@ Slug.propTypes = {
|
|
|
153
160
|
'right-end', 'right-top',
|
|
154
161
|
// deprecated use right-start instead
|
|
155
162
|
'right-start']),
|
|
163
|
+
/**
|
|
164
|
+
* Specify the text that will be provided to the aria-label of the `AILabel` button
|
|
165
|
+
*/
|
|
166
|
+
'aria-label': PropTypes.string,
|
|
156
167
|
/**
|
|
157
168
|
* Will auto-align the popover. This prop is currently experimental and is subject to future changes.
|
|
158
169
|
*/
|
|
159
170
|
autoAlign: PropTypes.bool,
|
|
160
171
|
/**
|
|
161
|
-
* Specify the content you want rendered inside the
|
|
172
|
+
* Specify the content you want rendered inside the `AILabel` ToggleTip
|
|
162
173
|
*/
|
|
163
174
|
children: PropTypes.node,
|
|
164
175
|
/**
|
|
165
|
-
* Specify an optional className to be added to the
|
|
176
|
+
* Specify an optional className to be added to the `AILabel`
|
|
166
177
|
*/
|
|
167
178
|
className: PropTypes.string,
|
|
168
179
|
/**
|
|
169
|
-
* Specify the type of
|
|
180
|
+
* Specify the type of `AILabel`, from the following list of types:
|
|
170
181
|
*/
|
|
171
182
|
kind: PropTypes.oneOf(['default', 'inline']),
|
|
172
183
|
/**
|
|
@@ -186,13 +197,14 @@ Slug.propTypes = {
|
|
|
186
197
|
*/
|
|
187
198
|
size: PropTypes.oneOf(['mini', '2xs', 'xs', 'sm', 'md', 'lg', 'xl']),
|
|
188
199
|
/**
|
|
189
|
-
*
|
|
200
|
+
* @deprecated
|
|
201
|
+
* Specify the text that will be provided to the aria-label of the `AILabel` button
|
|
190
202
|
*/
|
|
191
|
-
|
|
203
|
+
slugLabel: deprecate(PropTypes.string, '`slugLabel` on `AILabel` has been deprecated - Please use the `ariaLabel` prop instead'),
|
|
192
204
|
/**
|
|
193
|
-
* Specify
|
|
205
|
+
* Specify additional text to be rendered next to the AI label in the inline variant
|
|
194
206
|
*/
|
|
195
|
-
|
|
207
|
+
textLabel: PropTypes.string
|
|
196
208
|
};
|
|
197
209
|
|
|
198
|
-
export {
|
|
210
|
+
export { AILabel, AILabelActions, AILabelContent };
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
8
|
import React from 'react';
|
|
9
|
-
interface
|
|
9
|
+
interface AISkeletonIconProps {
|
|
10
10
|
/**
|
|
11
11
|
* Specify an optional className to add.
|
|
12
12
|
*/
|
|
@@ -16,8 +16,8 @@ interface AiSkeletonIconProps {
|
|
|
16
16
|
*/
|
|
17
17
|
style?: React.CSSProperties;
|
|
18
18
|
}
|
|
19
|
-
declare const
|
|
20
|
-
({ className, ...rest }:
|
|
19
|
+
declare const AISkeletonIcon: {
|
|
20
|
+
({ className, ...rest }: AISkeletonIconProps): import("react/jsx-runtime").JSX.Element;
|
|
21
21
|
propTypes: {
|
|
22
22
|
/**
|
|
23
23
|
* Specify an optional className to add.
|
|
@@ -29,4 +29,4 @@ declare const AiSkeletonIcon: {
|
|
|
29
29
|
style: PropTypes.Requireable<object>;
|
|
30
30
|
};
|
|
31
31
|
};
|
|
32
|
-
export default
|
|
32
|
+
export default AISkeletonIcon;
|
|
@@ -12,20 +12,20 @@ import cx from 'classnames';
|
|
|
12
12
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
13
13
|
import SkeletonIcon from '../SkeletonIcon/SkeletonIcon.js';
|
|
14
14
|
|
|
15
|
-
const
|
|
15
|
+
const AISkeletonIcon = _ref => {
|
|
16
16
|
let {
|
|
17
17
|
className,
|
|
18
18
|
...rest
|
|
19
19
|
} = _ref;
|
|
20
20
|
const prefix = usePrefix();
|
|
21
|
-
const
|
|
21
|
+
const AISkeletonIconClasses = cx(className, {
|
|
22
22
|
[`${prefix}--skeleton__icon--ai`]: true
|
|
23
23
|
});
|
|
24
24
|
return /*#__PURE__*/React__default.createElement(SkeletonIcon, _extends({
|
|
25
|
-
className:
|
|
25
|
+
className: AISkeletonIconClasses
|
|
26
26
|
}, rest));
|
|
27
27
|
};
|
|
28
|
-
|
|
28
|
+
AISkeletonIcon.propTypes = {
|
|
29
29
|
/**
|
|
30
30
|
* Specify an optional className to add.
|
|
31
31
|
*/
|
|
@@ -36,4 +36,4 @@ AiSkeletonIcon.propTypes = {
|
|
|
36
36
|
style: PropTypes.object
|
|
37
37
|
};
|
|
38
38
|
|
|
39
|
-
export {
|
|
39
|
+
export { AISkeletonIcon as default };
|
|
@@ -5,14 +5,14 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
|
-
export interface
|
|
8
|
+
export interface AISkeletonPlaceholderProps {
|
|
9
9
|
/**
|
|
10
10
|
* Add a custom class to the component to set the height and width
|
|
11
11
|
*/
|
|
12
12
|
className?: string;
|
|
13
13
|
}
|
|
14
|
-
declare const
|
|
15
|
-
({ className, ...other }:
|
|
14
|
+
declare const AISkeletonPlaceholder: {
|
|
15
|
+
({ className, ...other }: AISkeletonPlaceholderProps): import("react/jsx-runtime").JSX.Element;
|
|
16
16
|
propTypes: {
|
|
17
17
|
/**
|
|
18
18
|
* Add a custom class to the component
|
|
@@ -21,4 +21,4 @@ declare const AiSkeletonPlaceholder: {
|
|
|
21
21
|
className: PropTypes.Requireable<string>;
|
|
22
22
|
};
|
|
23
23
|
};
|
|
24
|
-
export default
|
|
24
|
+
export default AISkeletonPlaceholder;
|
package/es/components/{AiSkeleton/AiSkeletonPlaceholder.js → AISkeleton/AISkeletonPlaceholder.js}
RENAMED
|
@@ -12,21 +12,21 @@ import cx from 'classnames';
|
|
|
12
12
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
13
13
|
import SkeletonPlaceholder from '../SkeletonPlaceholder/SkeletonPlaceholder.js';
|
|
14
14
|
|
|
15
|
-
const
|
|
15
|
+
const AISkeletonPlaceholder = _ref => {
|
|
16
16
|
let {
|
|
17
17
|
className,
|
|
18
18
|
...other
|
|
19
19
|
} = _ref;
|
|
20
20
|
const prefix = usePrefix();
|
|
21
|
-
const
|
|
21
|
+
const AISkeletonPlaceholderClasses = cx({
|
|
22
22
|
className,
|
|
23
23
|
[`${prefix}--skeleton__placeholder--ai`]: true
|
|
24
24
|
}, className);
|
|
25
25
|
return /*#__PURE__*/React__default.createElement(SkeletonPlaceholder, _extends({
|
|
26
|
-
className:
|
|
26
|
+
className: AISkeletonPlaceholderClasses
|
|
27
27
|
}, other));
|
|
28
28
|
};
|
|
29
|
-
|
|
29
|
+
AISkeletonPlaceholder.propTypes = {
|
|
30
30
|
/**
|
|
31
31
|
* Add a custom class to the component
|
|
32
32
|
* to set the height and width
|
|
@@ -34,4 +34,4 @@ AiSkeletonPlaceholder.propTypes = {
|
|
|
34
34
|
className: PropTypes.string
|
|
35
35
|
};
|
|
36
36
|
|
|
37
|
-
export {
|
|
37
|
+
export { AISkeletonPlaceholder as default };
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
|
-
interface
|
|
8
|
+
interface AISkeletonTextProps {
|
|
9
9
|
/**
|
|
10
10
|
* Specify an optional className to be applied to the container node.
|
|
11
11
|
*/
|
|
@@ -27,8 +27,8 @@ interface AiSkeletonTextProps {
|
|
|
27
27
|
*/
|
|
28
28
|
width?: string;
|
|
29
29
|
}
|
|
30
|
-
declare const
|
|
31
|
-
({ className, ...rest }:
|
|
30
|
+
declare const AISkeletonText: {
|
|
31
|
+
({ className, ...rest }: AISkeletonTextProps): import("react/jsx-runtime").JSX.Element;
|
|
32
32
|
propTypes: {
|
|
33
33
|
/**
|
|
34
34
|
* Specify an optional className to be applied to the container node
|
|
@@ -52,4 +52,4 @@ declare const AiSkeletonText: {
|
|
|
52
52
|
width: PropTypes.Requireable<string>;
|
|
53
53
|
};
|
|
54
54
|
};
|
|
55
|
-
export default
|
|
55
|
+
export default AISkeletonText;
|
|
@@ -12,7 +12,7 @@ import cx from 'classnames';
|
|
|
12
12
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
13
13
|
import SkeletonText from '../SkeletonText/SkeletonText.js';
|
|
14
14
|
|
|
15
|
-
const
|
|
15
|
+
const AISkeletonText = _ref => {
|
|
16
16
|
let {
|
|
17
17
|
className,
|
|
18
18
|
...rest
|
|
@@ -25,7 +25,7 @@ const AiSkeletonText = _ref => {
|
|
|
25
25
|
className: aiSkeletonTextClasses
|
|
26
26
|
}, rest));
|
|
27
27
|
};
|
|
28
|
-
|
|
28
|
+
AISkeletonText.propTypes = {
|
|
29
29
|
/**
|
|
30
30
|
* Specify an optional className to be applied to the container node
|
|
31
31
|
*/
|
|
@@ -48,4 +48,4 @@ AiSkeletonText.propTypes = {
|
|
|
48
48
|
width: PropTypes.string
|
|
49
49
|
};
|
|
50
50
|
|
|
51
|
-
export {
|
|
51
|
+
export { AISkeletonText as default };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2016, 2024
|
|
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 AISkeletonPlaceholder from './AISkeletonPlaceholder';
|
|
8
|
+
import AISkeletonIcon from './AISkeletonIcon';
|
|
9
|
+
import AISkeletonText from './AISkeletonText';
|
|
10
|
+
export { AISkeletonText, AISkeletonIcon, AISkeletonPlaceholder };
|
|
@@ -48,7 +48,7 @@ const CheckboxGroup = _ref => {
|
|
|
48
48
|
|
|
49
49
|
// Slug is always size `mini`
|
|
50
50
|
let normalizedSlug;
|
|
51
|
-
if ( /*#__PURE__*/React__default.isValidElement(slug) && slug['type']?.displayName === '
|
|
51
|
+
if ( /*#__PURE__*/React__default.isValidElement(slug) && slug['type']?.displayName === 'AILabel') {
|
|
52
52
|
normalizedSlug = /*#__PURE__*/React__default.cloneElement(slug, {
|
|
53
53
|
size: 'mini',
|
|
54
54
|
kind: 'default'
|
|
@@ -4,8 +4,8 @@
|
|
|
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 { UseComboboxProps } from 'downshift';
|
|
8
|
-
import { type ReactNode, type ComponentType, type ReactElement, type RefAttributes, type PropsWithChildren, type PropsWithRef, type InputHTMLAttributes, type MouseEvent } from 'react';
|
|
7
|
+
import { UseComboboxProps, UseComboboxActions } from 'downshift';
|
|
8
|
+
import React, { type ReactNode, type ComponentType, type ReactElement, type RefAttributes, type PropsWithChildren, type PropsWithRef, type InputHTMLAttributes, type MouseEvent } from 'react';
|
|
9
9
|
import { ListBoxSize } from '../ListBox';
|
|
10
10
|
import { TranslateWithId } from '../../types/common';
|
|
11
11
|
type ExcludedAttributes = 'id' | 'onChange' | 'onClick' | 'type' | 'size';
|
|
@@ -57,12 +57,27 @@ export interface ComboBoxProps<ItemType> extends Omit<InputHTMLAttributes<HTMLIn
|
|
|
57
57
|
*/
|
|
58
58
|
disabled?: boolean;
|
|
59
59
|
/**
|
|
60
|
-
* Additional props passed to Downshift.
|
|
61
|
-
*
|
|
62
|
-
*
|
|
63
|
-
*
|
|
60
|
+
* Additional props passed to Downshift.
|
|
61
|
+
*
|
|
62
|
+
* **Use with caution:** anything you define here overrides the components'
|
|
63
|
+
* internal handling of that prop. Downshift APIs and internals are subject to
|
|
64
|
+
* change, and in some cases they can not be shimmed by Carbon to shield you
|
|
65
|
+
* from potentially breaking changes.
|
|
66
|
+
*
|
|
64
67
|
*/
|
|
65
68
|
downshiftProps?: Partial<UseComboboxProps<ItemType>>;
|
|
69
|
+
/**
|
|
70
|
+
* Provide a ref that will be mutated to contain an object of downshift
|
|
71
|
+
* action functions. These can be called to change the internal state of the
|
|
72
|
+
* downshift useCombobox hook.
|
|
73
|
+
*
|
|
74
|
+
* **Use with caution:** calling these actions modifies the internal state of
|
|
75
|
+
* downshift. It may conflict with or override the state management used within
|
|
76
|
+
* Combobox. Downshift APIs and internals are subject to change, and in some
|
|
77
|
+
* cases they can not be shimmed by Carbon to shield you from potentially breaking
|
|
78
|
+
* changes.
|
|
79
|
+
*/
|
|
80
|
+
downshiftActions?: React.MutableRefObject<UseComboboxActions<ItemType> | undefined>;
|
|
66
81
|
/**
|
|
67
82
|
* Provide helper text that is used alongside the control label for
|
|
68
83
|
* additional help
|
|
@@ -99,6 +99,7 @@ const ComboBox = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
99
99
|
className: containerClassName,
|
|
100
100
|
direction = 'bottom',
|
|
101
101
|
disabled = false,
|
|
102
|
+
downshiftActions,
|
|
102
103
|
downshiftProps,
|
|
103
104
|
helperText,
|
|
104
105
|
id,
|
|
@@ -242,8 +243,7 @@ const ComboBox = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
242
243
|
case ToggleButtonClick:
|
|
243
244
|
if (changes.isOpen && !changes.selectedItem) {
|
|
244
245
|
return {
|
|
245
|
-
...changes
|
|
246
|
-
highlightedIndex: 0
|
|
246
|
+
...changes
|
|
247
247
|
};
|
|
248
248
|
}
|
|
249
249
|
return changes;
|
|
@@ -283,6 +283,7 @@ const ComboBox = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
283
283
|
};
|
|
284
284
|
const showWarning = !invalid && warn;
|
|
285
285
|
const className = cx(`${prefix}--combo-box`, {
|
|
286
|
+
[`${prefix}--combo-box--invalid--focused`]: invalid && isFocused,
|
|
286
287
|
[`${prefix}--list-box--up`]: direction === 'top',
|
|
287
288
|
[`${prefix}--combo-box--warning`]: showWarning,
|
|
288
289
|
[`${prefix}--combo-box--readonly`]: readOnly
|
|
@@ -303,7 +304,7 @@ const ComboBox = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
303
304
|
}]);
|
|
304
305
|
const inputClasses = cx(`${prefix}--text-input`, {
|
|
305
306
|
[`${prefix}--text-input--empty`]: !inputValue,
|
|
306
|
-
[`${prefix}--combo-box--input--focus`]: isFocused
|
|
307
|
+
[`${prefix}--combo-box--input--focus`]: isFocused
|
|
307
308
|
});
|
|
308
309
|
|
|
309
310
|
// needs to be Capitalized for react to render it correctly
|
|
@@ -311,23 +312,30 @@ const ComboBox = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
311
312
|
|
|
312
313
|
// Slug is always size `mini`
|
|
313
314
|
let normalizedSlug;
|
|
314
|
-
if (slug && slug['type']?.displayName === '
|
|
315
|
+
if (slug && slug['type']?.displayName === 'AILabel') {
|
|
315
316
|
normalizedSlug = /*#__PURE__*/React__default.cloneElement(slug, {
|
|
316
317
|
size: 'mini'
|
|
317
318
|
});
|
|
318
319
|
}
|
|
319
320
|
const {
|
|
321
|
+
// Prop getters
|
|
320
322
|
getInputProps,
|
|
321
323
|
getItemProps,
|
|
322
324
|
getLabelProps,
|
|
323
325
|
getMenuProps,
|
|
324
326
|
getToggleButtonProps,
|
|
327
|
+
// State
|
|
325
328
|
isOpen,
|
|
326
329
|
highlightedIndex,
|
|
327
|
-
selectItem,
|
|
328
330
|
selectedItem,
|
|
329
|
-
|
|
330
|
-
|
|
331
|
+
// Actions
|
|
332
|
+
closeMenu,
|
|
333
|
+
openMenu,
|
|
334
|
+
reset,
|
|
335
|
+
selectItem,
|
|
336
|
+
setHighlightedIndex,
|
|
337
|
+
setInputValue: downshiftSetInputValue,
|
|
338
|
+
toggleMenu
|
|
331
339
|
} = useCombobox({
|
|
332
340
|
items: filterItems(items, itemToString, inputValue),
|
|
333
341
|
inputValue: inputValue,
|
|
@@ -372,6 +380,22 @@ const ComboBox = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
372
380
|
},
|
|
373
381
|
...downshiftProps
|
|
374
382
|
});
|
|
383
|
+
useEffect(() => {
|
|
384
|
+
// Used to expose the downshift actions to consumers for use with downshiftProps
|
|
385
|
+
// An odd pattern, here we mutate the value stored in the ref provided from the consumer.
|
|
386
|
+
// A riff of https://gist.github.com/gaearon/1a018a023347fe1c2476073330cc5509
|
|
387
|
+
if (downshiftActions) {
|
|
388
|
+
downshiftActions.current = {
|
|
389
|
+
closeMenu,
|
|
390
|
+
openMenu,
|
|
391
|
+
reset,
|
|
392
|
+
selectItem,
|
|
393
|
+
setHighlightedIndex,
|
|
394
|
+
setInputValue: downshiftSetInputValue,
|
|
395
|
+
toggleMenu
|
|
396
|
+
};
|
|
397
|
+
}
|
|
398
|
+
}, [closeMenu, openMenu, reset, selectItem, setHighlightedIndex, downshiftSetInputValue, toggleMenu]);
|
|
375
399
|
const buttonProps = getToggleButtonProps({
|
|
376
400
|
disabled: disabled || readOnly,
|
|
377
401
|
onClick: handleToggleClick(isOpen),
|
|
@@ -444,9 +468,7 @@ const ComboBox = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
444
468
|
}, getInputProps({
|
|
445
469
|
'aria-controls': isOpen ? undefined : menuProps.id,
|
|
446
470
|
placeholder,
|
|
447
|
-
ref:
|
|
448
|
-
...mergeRefs(textInput, ref)
|
|
449
|
-
},
|
|
471
|
+
ref: mergeRefs(textInput, ref),
|
|
450
472
|
onKeyDown: event => {
|
|
451
473
|
if (match(event, Space)) {
|
|
452
474
|
event.stopPropagation();
|
|
@@ -586,12 +608,28 @@ ComboBox.propTypes = {
|
|
|
586
608
|
*/
|
|
587
609
|
disabled: PropTypes.bool,
|
|
588
610
|
/**
|
|
589
|
-
* Additional props passed to Downshift.
|
|
590
|
-
*
|
|
591
|
-
*
|
|
592
|
-
*
|
|
611
|
+
* Additional props passed to Downshift.
|
|
612
|
+
*
|
|
613
|
+
* **Use with caution:** anything you define here overrides the components'
|
|
614
|
+
* internal handling of that prop. Downshift APIs and internals are subject to
|
|
615
|
+
* change, and in some cases they can not be shimmed by Carbon to shield you
|
|
616
|
+
* from potentially breaking changes.
|
|
593
617
|
*/
|
|
594
618
|
downshiftProps: PropTypes.object,
|
|
619
|
+
/**
|
|
620
|
+
* Provide a ref that will be mutated to contain an object of downshift
|
|
621
|
+
* action functions. These can be called to change the internal state of the
|
|
622
|
+
* downshift useCombobox hook.
|
|
623
|
+
*
|
|
624
|
+
* **Use with caution:** calling these actions modifies the internal state of
|
|
625
|
+
* downshift. It may conflict with or override the state management used within
|
|
626
|
+
* Combobox. Downshift APIs and internals are subject to change, and in some
|
|
627
|
+
* cases they can not be shimmed by Carbon to shield you from potentially breaking
|
|
628
|
+
* changes.
|
|
629
|
+
*/
|
|
630
|
+
downshiftActions: PropTypes.exact({
|
|
631
|
+
current: PropTypes.any
|
|
632
|
+
}),
|
|
595
633
|
/**
|
|
596
634
|
* Provide helper text that is used alongside the control label for
|
|
597
635
|
* additional help
|
|
@@ -246,7 +246,7 @@ const ComposedModal = /*#__PURE__*/React__default.forwardRef(function ComposedMo
|
|
|
246
246
|
|
|
247
247
|
// Slug is always size `sm`
|
|
248
248
|
let normalizedSlug;
|
|
249
|
-
if (slug && slug['type']?.displayName === '
|
|
249
|
+
if (slug && slug['type']?.displayName === 'AILabel') {
|
|
250
250
|
normalizedSlug = /*#__PURE__*/React__default.cloneElement(slug, {
|
|
251
251
|
size: 'sm'
|
|
252
252
|
});
|
|
@@ -15,7 +15,7 @@ import { getCellId } from './tools/cells.js';
|
|
|
15
15
|
import denormalize from './tools/denormalize.js';
|
|
16
16
|
import { composeEventHandlers } from '../../tools/events.js';
|
|
17
17
|
import { defaultFilterRows } from './tools/filter.js';
|
|
18
|
-
import setupGetInstanceId from '
|
|
18
|
+
import setupGetInstanceId from '../../tools/setupGetInstanceId.js';
|
|
19
19
|
import { Table } from './Table.js';
|
|
20
20
|
import TableActionList from './TableActionList.js';
|
|
21
21
|
import TableBatchAction from './TableBatchAction.js';
|
|
@@ -7,10 +7,11 @@
|
|
|
7
7
|
|
|
8
8
|
import { extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
|
9
9
|
import PropTypes from 'prop-types';
|
|
10
|
-
import React__default
|
|
10
|
+
import React__default from 'react';
|
|
11
11
|
import cx from 'classnames';
|
|
12
12
|
import InlineCheckbox from '../InlineCheckbox/InlineCheckbox.js';
|
|
13
13
|
import RadioButton from '../RadioButton/RadioButton.js';
|
|
14
|
+
import { useId } from '../../internal/useId.js';
|
|
14
15
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
15
16
|
import deprecate from '../../prop-types/deprecate.js';
|
|
16
17
|
|
|
@@ -54,7 +54,7 @@ const TableToolbarSearch = _ref => {
|
|
|
54
54
|
const [expandedState, setExpandedState] = useState(Boolean(defaultExpanded || defaultValue));
|
|
55
55
|
const expanded = controlled ? expandedProp : expandedState;
|
|
56
56
|
const [value, setValue] = useState(defaultValue || '');
|
|
57
|
-
const uniqueId = useId();
|
|
57
|
+
const uniqueId = useId('table-toolbar-search');
|
|
58
58
|
const [focusTarget, setFocusTarget] = useState(null);
|
|
59
59
|
const prefix = usePrefix();
|
|
60
60
|
useEffect(() => {
|
|
@@ -101,7 +101,7 @@ const TableToolbarSearch = _ref => {
|
|
|
101
101
|
disabled: disabled,
|
|
102
102
|
className: searchClasses,
|
|
103
103
|
value: value,
|
|
104
|
-
id: typeof id !== 'undefined' ? id :
|
|
104
|
+
id: typeof id !== 'undefined' ? id : uniqueId,
|
|
105
105
|
labelText: labelText || t('carbon.table.toolbar.search.label'),
|
|
106
106
|
placeholder: placeholder || t('carbon.table.toolbar.search.placeholder'),
|
|
107
107
|
onChange: onChange,
|