@carbon/react 1.63.2 → 1.64.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 +1562 -1193
- 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/Accordion/AccordionItem.js +1 -0
- package/es/components/CheckboxGroup/CheckboxGroup.js +1 -1
- package/es/components/ComboBox/ComboBox.js +4 -4
- package/es/components/ComposedModal/ComposedModal.js +1 -1
- package/es/components/DataTable/DataTable.js +1 -1
- package/es/components/DatePicker/DatePicker.js +16 -1
- package/es/components/DatePickerInput/DatePickerInput.js +1 -1
- package/es/components/Dropdown/Dropdown.js +12 -6
- package/es/components/FluidMultiSelect/FluidMultiSelect.js +4 -2
- package/es/components/Menu/MenuItem.js +45 -63
- package/es/components/Modal/Modal.js +1 -1
- package/es/components/MultiSelect/FilterableMultiSelect.js +44 -23
- package/es/components/MultiSelect/MultiSelect.js +6 -4
- package/es/components/NumberInput/NumberInput.js +12 -4
- 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/Accordion/AccordionItem.js +1 -0
- package/lib/components/CheckboxGroup/CheckboxGroup.js +1 -1
- package/lib/components/ComboBox/ComboBox.js +4 -4
- package/lib/components/ComposedModal/ComposedModal.js +1 -1
- package/lib/components/DataTable/DataTable.js +2 -2
- package/lib/components/DatePicker/DatePicker.js +15 -0
- package/lib/components/DatePickerInput/DatePickerInput.js +1 -1
- package/lib/components/Dropdown/Dropdown.js +12 -6
- package/lib/components/FluidMultiSelect/FluidMultiSelect.js +4 -2
- package/lib/components/Menu/MenuItem.js +44 -62
- package/lib/components/Modal/Modal.js +1 -1
- package/lib/components/MultiSelect/FilterableMultiSelect.js +43 -22
- package/lib/components/MultiSelect/MultiSelect.js +6 -4
- package/lib/components/NumberInput/NumberInput.js +12 -4
- 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 +5 -5
- 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
|
@@ -0,0 +1,143 @@
|
|
|
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
|
+
import { evaluate, getPaddingObject, rectToClientRect, sides } from '../../utils/dist/floating-ui.utils.mjs.js';
|
|
9
|
+
export { rectToClientRect } from '../../utils/dist/floating-ui.utils.mjs.js';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Resolves with an object of overflow side offsets that determine how much the
|
|
13
|
+
* element is overflowing a given clipping boundary on each side.
|
|
14
|
+
* - positive = overflowing the boundary by that number of pixels
|
|
15
|
+
* - negative = how many pixels left before it will overflow
|
|
16
|
+
* - 0 = lies flush with the boundary
|
|
17
|
+
* @see https://floating-ui.com/docs/detectOverflow
|
|
18
|
+
*/
|
|
19
|
+
async function detectOverflow(state, options) {
|
|
20
|
+
var _await$platform$isEle;
|
|
21
|
+
if (options === void 0) {
|
|
22
|
+
options = {};
|
|
23
|
+
}
|
|
24
|
+
const {
|
|
25
|
+
x,
|
|
26
|
+
y,
|
|
27
|
+
platform,
|
|
28
|
+
rects,
|
|
29
|
+
elements,
|
|
30
|
+
strategy
|
|
31
|
+
} = state;
|
|
32
|
+
const {
|
|
33
|
+
boundary = 'clippingAncestors',
|
|
34
|
+
rootBoundary = 'viewport',
|
|
35
|
+
elementContext = 'floating',
|
|
36
|
+
altBoundary = false,
|
|
37
|
+
padding = 0
|
|
38
|
+
} = evaluate(options, state);
|
|
39
|
+
const paddingObject = getPaddingObject(padding);
|
|
40
|
+
const altContext = elementContext === 'floating' ? 'reference' : 'floating';
|
|
41
|
+
const element = elements[altBoundary ? altContext : elementContext];
|
|
42
|
+
const clippingClientRect = rectToClientRect(await platform.getClippingRect({
|
|
43
|
+
element: ((_await$platform$isEle = await (platform.isElement == null ? void 0 : platform.isElement(element))) != null ? _await$platform$isEle : true) ? element : element.contextElement || (await (platform.getDocumentElement == null ? void 0 : platform.getDocumentElement(elements.floating))),
|
|
44
|
+
boundary,
|
|
45
|
+
rootBoundary,
|
|
46
|
+
strategy
|
|
47
|
+
}));
|
|
48
|
+
const rect = elementContext === 'floating' ? {
|
|
49
|
+
...rects.floating,
|
|
50
|
+
x,
|
|
51
|
+
y
|
|
52
|
+
} : rects.reference;
|
|
53
|
+
const offsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(elements.floating));
|
|
54
|
+
const offsetScale = (await (platform.isElement == null ? void 0 : platform.isElement(offsetParent))) ? (await (platform.getScale == null ? void 0 : platform.getScale(offsetParent))) || {
|
|
55
|
+
x: 1,
|
|
56
|
+
y: 1
|
|
57
|
+
} : {
|
|
58
|
+
x: 1,
|
|
59
|
+
y: 1
|
|
60
|
+
};
|
|
61
|
+
const elementClientRect = rectToClientRect(platform.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform.convertOffsetParentRelativeRectToViewportRelativeRect({
|
|
62
|
+
rect,
|
|
63
|
+
offsetParent,
|
|
64
|
+
strategy
|
|
65
|
+
}) : rect);
|
|
66
|
+
return {
|
|
67
|
+
top: (clippingClientRect.top - elementClientRect.top + paddingObject.top) / offsetScale.y,
|
|
68
|
+
bottom: (elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom) / offsetScale.y,
|
|
69
|
+
left: (clippingClientRect.left - elementClientRect.left + paddingObject.left) / offsetScale.x,
|
|
70
|
+
right: (elementClientRect.right - clippingClientRect.right + paddingObject.right) / offsetScale.x
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
function getSideOffsets(overflow, rect) {
|
|
75
|
+
return {
|
|
76
|
+
top: overflow.top - rect.height,
|
|
77
|
+
right: overflow.right - rect.width,
|
|
78
|
+
bottom: overflow.bottom - rect.height,
|
|
79
|
+
left: overflow.left - rect.width
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
function isAnySideFullyClipped(overflow) {
|
|
83
|
+
return sides.some(side => overflow[side] >= 0);
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Provides data to hide the floating element in applicable situations, such as
|
|
87
|
+
* when it is not in the same clipping context as the reference element.
|
|
88
|
+
* @see https://floating-ui.com/docs/hide
|
|
89
|
+
*/
|
|
90
|
+
const hide = function (options) {
|
|
91
|
+
if (options === void 0) {
|
|
92
|
+
options = {};
|
|
93
|
+
}
|
|
94
|
+
return {
|
|
95
|
+
name: 'hide',
|
|
96
|
+
options,
|
|
97
|
+
async fn(state) {
|
|
98
|
+
const {
|
|
99
|
+
rects
|
|
100
|
+
} = state;
|
|
101
|
+
const {
|
|
102
|
+
strategy = 'referenceHidden',
|
|
103
|
+
...detectOverflowOptions
|
|
104
|
+
} = evaluate(options, state);
|
|
105
|
+
switch (strategy) {
|
|
106
|
+
case 'referenceHidden':
|
|
107
|
+
{
|
|
108
|
+
const overflow = await detectOverflow(state, {
|
|
109
|
+
...detectOverflowOptions,
|
|
110
|
+
elementContext: 'reference'
|
|
111
|
+
});
|
|
112
|
+
const offsets = getSideOffsets(overflow, rects.reference);
|
|
113
|
+
return {
|
|
114
|
+
data: {
|
|
115
|
+
referenceHiddenOffsets: offsets,
|
|
116
|
+
referenceHidden: isAnySideFullyClipped(offsets)
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
case 'escaped':
|
|
121
|
+
{
|
|
122
|
+
const overflow = await detectOverflow(state, {
|
|
123
|
+
...detectOverflowOptions,
|
|
124
|
+
altBoundary: true
|
|
125
|
+
});
|
|
126
|
+
const offsets = getSideOffsets(overflow, rects.floating);
|
|
127
|
+
return {
|
|
128
|
+
data: {
|
|
129
|
+
escapedOffsets: offsets,
|
|
130
|
+
escaped: isAnySideFullyClipped(offsets)
|
|
131
|
+
}
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
default:
|
|
135
|
+
{
|
|
136
|
+
return {};
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
};
|
|
141
|
+
};
|
|
142
|
+
|
|
143
|
+
export { detectOverflow, hide };
|
|
@@ -0,0 +1,39 @@
|
|
|
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
|
+
const sides = ['top', 'right', 'bottom', 'left'];
|
|
9
|
+
function evaluate(value, param) {
|
|
10
|
+
return typeof value === 'function' ? value(param) : value;
|
|
11
|
+
}
|
|
12
|
+
function expandPaddingObject(padding) {
|
|
13
|
+
return {
|
|
14
|
+
top: 0,
|
|
15
|
+
right: 0,
|
|
16
|
+
bottom: 0,
|
|
17
|
+
left: 0,
|
|
18
|
+
...padding
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
function getPaddingObject(padding) {
|
|
22
|
+
return typeof padding !== 'number' ? expandPaddingObject(padding) : {
|
|
23
|
+
top: padding,
|
|
24
|
+
right: padding,
|
|
25
|
+
bottom: padding,
|
|
26
|
+
left: padding
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
function rectToClientRect(rect) {
|
|
30
|
+
return {
|
|
31
|
+
...rect,
|
|
32
|
+
top: rect.y,
|
|
33
|
+
left: rect.x,
|
|
34
|
+
right: rect.x + rect.width,
|
|
35
|
+
bottom: rect.y + rect.height
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export { evaluate, expandPaddingObject, getPaddingObject, rectToClientRect, sides };
|
|
@@ -18,6 +18,7 @@ var index = require('../Toggletip/index.js');
|
|
|
18
18
|
var index$1 = require('../IconButton/index.js');
|
|
19
19
|
var iconsReact = require('@carbon/icons-react');
|
|
20
20
|
var useId = require('../../internal/useId.js');
|
|
21
|
+
var deprecate = require('../../prop-types/deprecate.js');
|
|
21
22
|
|
|
22
23
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
23
24
|
|
|
@@ -26,24 +27,23 @@ var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
|
|
|
26
27
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
27
28
|
|
|
28
29
|
var _Undo;
|
|
29
|
-
const
|
|
30
|
+
const AILabelContent = /*#__PURE__*/React__default["default"].forwardRef(function AILabelContent(_ref, ref) {
|
|
30
31
|
let {
|
|
31
32
|
children,
|
|
32
33
|
className
|
|
33
34
|
} = _ref;
|
|
34
35
|
const prefix = usePrefix.usePrefix();
|
|
35
|
-
const
|
|
36
|
-
const
|
|
36
|
+
const hasAILabelActions = React__default["default"].Children.toArray(children).some(child => child.type?.displayName === 'AILabelActions');
|
|
37
|
+
const aiLabelContentClasses = cx__default["default"](className, {
|
|
37
38
|
[`${prefix}--slug-content`]: true,
|
|
38
|
-
[`${prefix}--slug-content--with-actions`]:
|
|
39
|
+
[`${prefix}--slug-content--with-actions`]: hasAILabelActions
|
|
39
40
|
});
|
|
40
41
|
return /*#__PURE__*/React__default["default"].createElement(index.ToggletipContent, {
|
|
41
|
-
className:
|
|
42
|
-
ref: ref
|
|
42
|
+
className: aiLabelContentClasses
|
|
43
43
|
}, children);
|
|
44
44
|
});
|
|
45
|
-
|
|
46
|
-
|
|
45
|
+
AILabelContent.displayName = 'AILabelContent';
|
|
46
|
+
AILabelContent.propTypes = {
|
|
47
47
|
/**
|
|
48
48
|
* Specify the content you want rendered inside the slug ToggleTip
|
|
49
49
|
*/
|
|
@@ -53,22 +53,22 @@ SlugContent.propTypes = {
|
|
|
53
53
|
*/
|
|
54
54
|
className: PropTypes__default["default"].string
|
|
55
55
|
};
|
|
56
|
-
const
|
|
56
|
+
const AILabelActions = /*#__PURE__*/React__default["default"].forwardRef(function AILabelActions(_ref2, ref) {
|
|
57
57
|
let {
|
|
58
58
|
children,
|
|
59
59
|
className
|
|
60
60
|
} = _ref2;
|
|
61
61
|
const prefix = usePrefix.usePrefix();
|
|
62
|
-
const
|
|
62
|
+
const aiLabelActionsClasses = cx__default["default"](className, {
|
|
63
63
|
[`${prefix}--slug-actions`]: true
|
|
64
64
|
});
|
|
65
65
|
return /*#__PURE__*/React__default["default"].createElement(index.ToggletipActions, {
|
|
66
|
-
className:
|
|
66
|
+
className: aiLabelActionsClasses,
|
|
67
67
|
ref: ref
|
|
68
68
|
}, children);
|
|
69
69
|
});
|
|
70
|
-
|
|
71
|
-
|
|
70
|
+
AILabelActions.displayName = 'AILabelActions';
|
|
71
|
+
AILabelActions.propTypes = {
|
|
72
72
|
/**
|
|
73
73
|
* Specify the content you want rendered inside the slug callout toolbar
|
|
74
74
|
*/
|
|
@@ -78,10 +78,11 @@ SlugActions.propTypes = {
|
|
|
78
78
|
*/
|
|
79
79
|
className: PropTypes__default["default"].string
|
|
80
80
|
};
|
|
81
|
-
const
|
|
81
|
+
const AILabel = /*#__PURE__*/React__default["default"].forwardRef(function AILabel(_ref3, ref) {
|
|
82
82
|
let {
|
|
83
83
|
aiText = 'AI',
|
|
84
84
|
aiTextLabel,
|
|
85
|
+
textLabel,
|
|
85
86
|
align,
|
|
86
87
|
autoAlign = true,
|
|
87
88
|
children,
|
|
@@ -91,29 +92,30 @@ const Slug = /*#__PURE__*/React__default["default"].forwardRef(function Slug(_re
|
|
|
91
92
|
revertActive,
|
|
92
93
|
revertLabel = 'Revert to AI input',
|
|
93
94
|
slugLabel = 'Show information',
|
|
95
|
+
['aria-label']: ariaLabel = 'Show information',
|
|
94
96
|
size = 'xs',
|
|
95
97
|
...rest
|
|
96
98
|
} = _ref3;
|
|
97
99
|
const prefix = usePrefix.usePrefix();
|
|
98
|
-
const id = useId.useId('
|
|
99
|
-
const
|
|
100
|
+
const id = useId.useId('AILabel');
|
|
101
|
+
const aiLabelClasses = cx__default["default"](className, {
|
|
100
102
|
[`${prefix}--slug`]: true,
|
|
101
103
|
[`${prefix}--slug--revert`]: revertActive
|
|
102
104
|
});
|
|
103
|
-
const
|
|
105
|
+
const aiLabelButtonClasses = cx__default["default"]({
|
|
104
106
|
[`${prefix}--slug__button`]: true,
|
|
105
107
|
[`${prefix}--slug__button--${size}`]: size,
|
|
106
108
|
[`${prefix}--slug__button--${kind}`]: kind,
|
|
107
|
-
[`${prefix}--slug__button--inline-with-content`]: kind === 'inline' && aiTextLabel
|
|
109
|
+
[`${prefix}--slug__button--inline-with-content`]: kind === 'inline' && (aiTextLabel || textLabel)
|
|
108
110
|
});
|
|
109
111
|
const handleOnRevertClick = evt => {
|
|
110
112
|
if (onRevertClick) {
|
|
111
113
|
onRevertClick(evt);
|
|
112
114
|
}
|
|
113
115
|
};
|
|
114
|
-
const
|
|
116
|
+
const ariaLabelText = !aiTextLabel && !textLabel ? `${aiText} - ${slugLabel || ariaLabel}` : `${aiText} - ${aiTextLabel || textLabel}`;
|
|
115
117
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
116
|
-
className:
|
|
118
|
+
className: aiLabelClasses,
|
|
117
119
|
ref: ref,
|
|
118
120
|
id: id
|
|
119
121
|
}, revertActive ? /*#__PURE__*/React__default["default"].createElement(index$1.IconButton, _rollupPluginBabelHelpers["extends"]({
|
|
@@ -125,24 +127,29 @@ const Slug = /*#__PURE__*/React__default["default"].forwardRef(function Slug(_re
|
|
|
125
127
|
align: align,
|
|
126
128
|
autoAlign: autoAlign
|
|
127
129
|
}, rest), /*#__PURE__*/React__default["default"].createElement(index.ToggletipButton, {
|
|
128
|
-
className:
|
|
129
|
-
label:
|
|
130
|
+
className: aiLabelButtonClasses,
|
|
131
|
+
label: ariaLabelText
|
|
130
132
|
}, /*#__PURE__*/React__default["default"].createElement("span", {
|
|
131
133
|
className: `${prefix}--slug__text`
|
|
132
|
-
}, aiText), aiTextLabel && /*#__PURE__*/React__default["default"].createElement("span", {
|
|
134
|
+
}, aiText), kind === 'inline' && (aiTextLabel || textLabel) && /*#__PURE__*/React__default["default"].createElement("span", {
|
|
133
135
|
className: `${prefix}--slug__additional-text`
|
|
134
|
-
}, aiTextLabel)), children));
|
|
136
|
+
}, aiTextLabel || textLabel)), children));
|
|
135
137
|
});
|
|
136
|
-
|
|
137
|
-
|
|
138
|
+
AILabel.displayName = 'AILabel';
|
|
139
|
+
AILabel.propTypes = {
|
|
140
|
+
/**
|
|
141
|
+
* Specify the content you want rendered inside the `AILabel` ToggleTip
|
|
142
|
+
*/
|
|
143
|
+
AILabelContent: PropTypes__default["default"].node,
|
|
138
144
|
/**
|
|
139
145
|
* Specify the correct translation of the AI text
|
|
140
146
|
*/
|
|
141
147
|
aiText: PropTypes__default["default"].string,
|
|
142
148
|
/**
|
|
149
|
+
* @deprecated
|
|
143
150
|
* Specify additional text to be rendered next to the AI label in the inline variant
|
|
144
151
|
*/
|
|
145
|
-
aiTextLabel: PropTypes__default["default"].string,
|
|
152
|
+
aiTextLabel: deprecate["default"](PropTypes__default["default"].string, '`aiTextLabel` on `AILabel` has been deprecated - Please use the `textLabel` prop instead'),
|
|
146
153
|
/**
|
|
147
154
|
* Specify how the popover should align with the button
|
|
148
155
|
*/
|
|
@@ -163,20 +170,24 @@ Slug.propTypes = {
|
|
|
163
170
|
'right-end', 'right-top',
|
|
164
171
|
// deprecated use right-start instead
|
|
165
172
|
'right-start']),
|
|
173
|
+
/**
|
|
174
|
+
* Specify the text that will be provided to the aria-label of the `AILabel` button
|
|
175
|
+
*/
|
|
176
|
+
'aria-label': PropTypes__default["default"].string,
|
|
166
177
|
/**
|
|
167
178
|
* Will auto-align the popover. This prop is currently experimental and is subject to future changes.
|
|
168
179
|
*/
|
|
169
180
|
autoAlign: PropTypes__default["default"].bool,
|
|
170
181
|
/**
|
|
171
|
-
* Specify the content you want rendered inside the
|
|
182
|
+
* Specify the content you want rendered inside the `AILabel` ToggleTip
|
|
172
183
|
*/
|
|
173
184
|
children: PropTypes__default["default"].node,
|
|
174
185
|
/**
|
|
175
|
-
* Specify an optional className to be added to the
|
|
186
|
+
* Specify an optional className to be added to the `AILabel`
|
|
176
187
|
*/
|
|
177
188
|
className: PropTypes__default["default"].string,
|
|
178
189
|
/**
|
|
179
|
-
* Specify the type of
|
|
190
|
+
* Specify the type of `AILabel`, from the following list of types:
|
|
180
191
|
*/
|
|
181
192
|
kind: PropTypes__default["default"].oneOf(['default', 'inline']),
|
|
182
193
|
/**
|
|
@@ -196,15 +207,16 @@ Slug.propTypes = {
|
|
|
196
207
|
*/
|
|
197
208
|
size: PropTypes__default["default"].oneOf(['mini', '2xs', 'xs', 'sm', 'md', 'lg', 'xl']),
|
|
198
209
|
/**
|
|
199
|
-
*
|
|
210
|
+
* @deprecated
|
|
211
|
+
* Specify the text that will be provided to the aria-label of the `AILabel` button
|
|
200
212
|
*/
|
|
201
|
-
|
|
213
|
+
slugLabel: deprecate["default"](PropTypes__default["default"].string, '`slugLabel` on `AILabel` has been deprecated - Please use the `ariaLabel` prop instead'),
|
|
202
214
|
/**
|
|
203
|
-
* Specify
|
|
215
|
+
* Specify additional text to be rendered next to the AI label in the inline variant
|
|
204
216
|
*/
|
|
205
|
-
|
|
217
|
+
textLabel: PropTypes__default["default"].string
|
|
206
218
|
};
|
|
207
219
|
|
|
208
|
-
exports.
|
|
209
|
-
exports.
|
|
210
|
-
exports.
|
|
220
|
+
exports.AILabel = AILabel;
|
|
221
|
+
exports.AILabelActions = AILabelActions;
|
|
222
|
+
exports.AILabelContent = 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;
|
|
@@ -22,20 +22,20 @@ var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
|
|
|
22
22
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
23
23
|
var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
|
|
24
24
|
|
|
25
|
-
const
|
|
25
|
+
const AISkeletonIcon = _ref => {
|
|
26
26
|
let {
|
|
27
27
|
className,
|
|
28
28
|
...rest
|
|
29
29
|
} = _ref;
|
|
30
30
|
const prefix = usePrefix.usePrefix();
|
|
31
|
-
const
|
|
31
|
+
const AISkeletonIconClasses = cx__default["default"](className, {
|
|
32
32
|
[`${prefix}--skeleton__icon--ai`]: true
|
|
33
33
|
});
|
|
34
34
|
return /*#__PURE__*/React__default["default"].createElement(SkeletonIcon["default"], _rollupPluginBabelHelpers["extends"]({
|
|
35
|
-
className:
|
|
35
|
+
className: AISkeletonIconClasses
|
|
36
36
|
}, rest));
|
|
37
37
|
};
|
|
38
|
-
|
|
38
|
+
AISkeletonIcon.propTypes = {
|
|
39
39
|
/**
|
|
40
40
|
* Specify an optional className to add.
|
|
41
41
|
*/
|
|
@@ -46,4 +46,4 @@ AiSkeletonIcon.propTypes = {
|
|
|
46
46
|
style: PropTypes__default["default"].object
|
|
47
47
|
};
|
|
48
48
|
|
|
49
|
-
exports["default"] =
|
|
49
|
+
exports["default"] = AISkeletonIcon;
|
|
@@ -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/lib/components/{AiSkeleton/AiSkeletonPlaceholder.js → AISkeleton/AISkeletonPlaceholder.js}
RENAMED
|
@@ -22,21 +22,21 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
|
22
22
|
var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
|
|
23
23
|
var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
|
|
24
24
|
|
|
25
|
-
const
|
|
25
|
+
const AISkeletonPlaceholder = _ref => {
|
|
26
26
|
let {
|
|
27
27
|
className,
|
|
28
28
|
...other
|
|
29
29
|
} = _ref;
|
|
30
30
|
const prefix = usePrefix.usePrefix();
|
|
31
|
-
const
|
|
31
|
+
const AISkeletonPlaceholderClasses = cx__default["default"]({
|
|
32
32
|
className,
|
|
33
33
|
[`${prefix}--skeleton__placeholder--ai`]: true
|
|
34
34
|
}, className);
|
|
35
35
|
return /*#__PURE__*/React__default["default"].createElement(SkeletonPlaceholder["default"], _rollupPluginBabelHelpers["extends"]({
|
|
36
|
-
className:
|
|
36
|
+
className: AISkeletonPlaceholderClasses
|
|
37
37
|
}, other));
|
|
38
38
|
};
|
|
39
|
-
|
|
39
|
+
AISkeletonPlaceholder.propTypes = {
|
|
40
40
|
/**
|
|
41
41
|
* Add a custom class to the component
|
|
42
42
|
* to set the height and width
|
|
@@ -44,4 +44,4 @@ AiSkeletonPlaceholder.propTypes = {
|
|
|
44
44
|
className: PropTypes__default["default"].string
|
|
45
45
|
};
|
|
46
46
|
|
|
47
|
-
exports["default"] =
|
|
47
|
+
exports["default"] = AISkeletonPlaceholder;
|
|
@@ -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;
|
|
@@ -22,7 +22,7 @@ var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
|
|
|
22
22
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
23
23
|
var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
|
|
24
24
|
|
|
25
|
-
const
|
|
25
|
+
const AISkeletonText = _ref => {
|
|
26
26
|
let {
|
|
27
27
|
className,
|
|
28
28
|
...rest
|
|
@@ -35,7 +35,7 @@ const AiSkeletonText = _ref => {
|
|
|
35
35
|
className: aiSkeletonTextClasses
|
|
36
36
|
}, rest));
|
|
37
37
|
};
|
|
38
|
-
|
|
38
|
+
AISkeletonText.propTypes = {
|
|
39
39
|
/**
|
|
40
40
|
* Specify an optional className to be applied to the container node
|
|
41
41
|
*/
|
|
@@ -58,4 +58,4 @@ AiSkeletonText.propTypes = {
|
|
|
58
58
|
width: PropTypes__default["default"].string
|
|
59
59
|
};
|
|
60
60
|
|
|
61
|
-
exports["default"] =
|
|
61
|
+
exports["default"] = AISkeletonText;
|
|
@@ -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 };
|
|
@@ -118,6 +118,7 @@ function AccordionItem(_ref) {
|
|
|
118
118
|
className: `${prefix}--accordion__title`
|
|
119
119
|
}, title)), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
120
120
|
ref: content,
|
|
121
|
+
hidden: !isOpen,
|
|
121
122
|
className: `${prefix}--accordion__wrapper`,
|
|
122
123
|
onTransitionEnd: onAnimationEnd
|
|
123
124
|
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
@@ -58,7 +58,7 @@ const CheckboxGroup = _ref => {
|
|
|
58
58
|
|
|
59
59
|
// Slug is always size `mini`
|
|
60
60
|
let normalizedSlug;
|
|
61
|
-
if ( /*#__PURE__*/React__default["default"].isValidElement(slug) && slug['type']?.displayName === '
|
|
61
|
+
if ( /*#__PURE__*/React__default["default"].isValidElement(slug) && slug['type']?.displayName === 'AILabel') {
|
|
62
62
|
normalizedSlug = /*#__PURE__*/React__default["default"].cloneElement(slug, {
|
|
63
63
|
size: 'mini',
|
|
64
64
|
kind: 'default'
|
|
@@ -253,8 +253,7 @@ const ComboBox = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
253
253
|
case ToggleButtonClick:
|
|
254
254
|
if (changes.isOpen && !changes.selectedItem) {
|
|
255
255
|
return {
|
|
256
|
-
...changes
|
|
257
|
-
highlightedIndex: 0
|
|
256
|
+
...changes
|
|
258
257
|
};
|
|
259
258
|
}
|
|
260
259
|
return changes;
|
|
@@ -294,6 +293,7 @@ const ComboBox = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
294
293
|
};
|
|
295
294
|
const showWarning = !invalid && warn;
|
|
296
295
|
const className = cx__default["default"](`${prefix}--combo-box`, {
|
|
296
|
+
[`${prefix}--combo-box--invalid--focused`]: invalid && isFocused,
|
|
297
297
|
[`${prefix}--list-box--up`]: direction === 'top',
|
|
298
298
|
[`${prefix}--combo-box--warning`]: showWarning,
|
|
299
299
|
[`${prefix}--combo-box--readonly`]: readOnly
|
|
@@ -314,7 +314,7 @@ const ComboBox = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
314
314
|
}]);
|
|
315
315
|
const inputClasses = cx__default["default"](`${prefix}--text-input`, {
|
|
316
316
|
[`${prefix}--text-input--empty`]: !inputValue,
|
|
317
|
-
[`${prefix}--combo-box--input--focus`]: isFocused
|
|
317
|
+
[`${prefix}--combo-box--input--focus`]: isFocused
|
|
318
318
|
});
|
|
319
319
|
|
|
320
320
|
// needs to be Capitalized for react to render it correctly
|
|
@@ -322,7 +322,7 @@ const ComboBox = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
322
322
|
|
|
323
323
|
// Slug is always size `mini`
|
|
324
324
|
let normalizedSlug;
|
|
325
|
-
if (slug && slug['type']?.displayName === '
|
|
325
|
+
if (slug && slug['type']?.displayName === 'AILabel') {
|
|
326
326
|
normalizedSlug = /*#__PURE__*/React__default["default"].cloneElement(slug, {
|
|
327
327
|
size: 'mini'
|
|
328
328
|
});
|
|
@@ -257,7 +257,7 @@ const ComposedModal = /*#__PURE__*/React__default["default"].forwardRef(function
|
|
|
257
257
|
|
|
258
258
|
// Slug is always size `sm`
|
|
259
259
|
let normalizedSlug;
|
|
260
|
-
if (slug && slug['type']?.displayName === '
|
|
260
|
+
if (slug && slug['type']?.displayName === 'AILabel') {
|
|
261
261
|
normalizedSlug = /*#__PURE__*/React__default["default"].cloneElement(slug, {
|
|
262
262
|
size: 'sm'
|
|
263
263
|
});
|
|
@@ -19,7 +19,7 @@ var cells = require('./tools/cells.js');
|
|
|
19
19
|
var denormalize = require('./tools/denormalize.js');
|
|
20
20
|
var events = require('../../tools/events.js');
|
|
21
21
|
var filter = require('./tools/filter.js');
|
|
22
|
-
var
|
|
22
|
+
var setupGetInstanceId = require('../../tools/setupGetInstanceId.js');
|
|
23
23
|
var Table = require('./Table.js');
|
|
24
24
|
var TableActionList = require('./TableActionList.js');
|
|
25
25
|
var TableBatchAction = require('./TableBatchAction.js');
|
|
@@ -48,7 +48,7 @@ var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
|
|
|
48
48
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
49
49
|
var isEqual__default = /*#__PURE__*/_interopDefaultLegacy(isEqual);
|
|
50
50
|
|
|
51
|
-
const getInstanceId =
|
|
51
|
+
const getInstanceId = setupGetInstanceId["default"]();
|
|
52
52
|
const translationKeys = {
|
|
53
53
|
expandRow: 'carbon.table.row.expand',
|
|
54
54
|
collapseRow: 'carbon.table.row.collapse',
|