@carbon/react 1.70.0-rc.0 → 1.71.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 +756 -756
- package/es/components/AILabel/index.js +15 -15
- package/es/components/CheckboxGroup/CheckboxGroup.js +1 -1
- package/es/components/CodeSnippet/CodeSnippet.d.ts +5 -2
- package/es/components/CodeSnippet/CodeSnippet.js +40 -1
- package/es/components/ComboBox/ComboBox.js +28 -23
- package/es/components/ComboButton/index.js +40 -1
- package/es/components/ComposedModal/ComposedModal.js +6 -2
- package/es/components/ContentSwitcher/ContentSwitcher.d.ts +2 -2
- package/es/components/ContentSwitcher/ContentSwitcher.js +1 -1
- package/es/components/Copy/Copy.d.ts +5 -2
- package/es/components/Copy/Copy.js +40 -1
- package/es/components/CopyButton/CopyButton.d.ts +5 -2
- package/es/components/CopyButton/CopyButton.js +40 -1
- package/es/components/DataTable/Table.d.ts +9 -1
- package/es/components/DataTable/Table.js +7 -2
- package/es/components/DataTable/TableSelectRow.js +14 -6
- package/es/components/DataTable/TableToolbarSearch.js +1 -1
- package/es/components/DataTable/stories/examples/TableToolbarFilter.d.ts +1 -1
- package/es/components/DatePicker/DatePicker.js +0 -8
- package/es/components/DatePicker/plugins/appendToPlugin.js +2 -2
- package/es/components/DatePicker/plugins/fixEventsPlugin.js +4 -4
- package/es/components/DatePicker/plugins/rangePlugin.js +2 -2
- package/es/components/DatePickerInput/DatePickerInput.d.ts +6 -1
- package/es/components/DatePickerInput/DatePickerInput.js +16 -10
- package/es/components/Dropdown/Dropdown.d.ts +5 -0
- package/es/components/Dropdown/Dropdown.js +132 -92
- package/es/components/FeatureFlags/index.js +1 -2
- package/es/components/IconButton/index.d.ts +4 -1
- package/es/components/IconButton/index.js +40 -1
- package/es/components/InlineCheckbox/InlineCheckbox.d.ts +50 -0
- package/es/components/InlineCheckbox/InlineCheckbox.js +3 -6
- package/es/components/InlineCheckbox/index.d.ts +9 -0
- package/es/components/LayoutDirection/LayoutDirection.d.ts +44 -0
- package/es/components/LayoutDirection/LayoutDirectionContext.d.ts +10 -0
- package/es/components/LayoutDirection/useLayoutDirection.d.ts +12 -0
- package/es/components/Menu/MenuItem.js +0 -3
- package/es/components/MultiSelect/FilterableMultiSelect.d.ts +1 -1
- package/es/components/MultiSelect/FilterableMultiSelect.js +1 -2
- package/es/components/MultiSelect/MultiSelect.js +1 -1
- package/es/components/Notification/Notification.d.ts +9 -2
- package/es/components/Notification/Notification.js +16 -2
- package/es/components/NumberInput/NumberInput.d.ts +5 -0
- package/es/components/NumberInput/NumberInput.js +17 -9
- package/es/components/OverflowMenu/OverflowMenu.js +1 -1
- package/es/components/OverflowMenu/next/index.js +40 -1
- package/es/components/Pagination/Pagination.js +2 -2
- package/es/components/Pagination/experimental/PageSelector.js +1 -1
- package/es/components/PaginationNav/PaginationNav.d.ts +1 -1
- package/es/components/PaginationNav/PaginationNav.js +10 -5
- package/es/components/Popover/index.js +2 -2
- package/es/components/SkeletonText/SkeletonText.js +1 -1
- package/es/components/Tabs/Tabs.js +46 -29
- package/es/components/TextArea/TextArea.d.ts +5 -0
- package/es/components/TextArea/TextArea.js +15 -7
- package/es/components/TextInput/TextInput.d.ts +5 -0
- package/es/components/TextInput/TextInput.js +15 -7
- package/es/components/TreeView/TreeNode.js +1 -1
- package/es/components/TreeView/TreeView.js +1 -1
- package/es/components/UIShell/HeaderMenu.js +1 -1
- package/es/components/UIShell/SideNav.js +1 -1
- package/es/components/UIShell/SideNavItems.js +1 -1
- package/es/components/UIShell/SideNavMenu.js +1 -1
- package/es/components/UIShell/SideNavMenuItem.d.ts +5 -1
- package/es/components/UIShell/SideNavMenuItem.js +7 -2
- package/es/components/UIShell/Switcher.js +1 -1
- package/lib/components/AILabel/index.js +15 -15
- package/lib/components/CheckboxGroup/CheckboxGroup.js +1 -1
- package/lib/components/CodeSnippet/CodeSnippet.d.ts +5 -2
- package/lib/components/CodeSnippet/CodeSnippet.js +40 -1
- package/lib/components/ComboBox/ComboBox.js +29 -23
- package/lib/components/ComboButton/index.js +40 -1
- package/lib/components/ComposedModal/ComposedModal.js +6 -2
- package/lib/components/ContentSwitcher/ContentSwitcher.d.ts +2 -2
- package/lib/components/ContentSwitcher/ContentSwitcher.js +1 -1
- package/lib/components/Copy/Copy.d.ts +5 -2
- package/lib/components/Copy/Copy.js +40 -1
- package/lib/components/CopyButton/CopyButton.d.ts +5 -2
- package/lib/components/CopyButton/CopyButton.js +40 -1
- package/lib/components/DataTable/Table.d.ts +9 -1
- package/lib/components/DataTable/Table.js +7 -2
- package/lib/components/DataTable/TableSelectRow.js +14 -6
- package/lib/components/DataTable/TableToolbarSearch.js +1 -1
- package/lib/components/DataTable/stories/examples/TableToolbarFilter.d.ts +1 -1
- package/lib/components/DatePicker/DatePicker.js +0 -8
- package/lib/components/DatePicker/plugins/appendToPlugin.js +2 -2
- package/lib/components/DatePicker/plugins/fixEventsPlugin.js +4 -4
- package/lib/components/DatePicker/plugins/rangePlugin.js +2 -2
- package/lib/components/DatePickerInput/DatePickerInput.d.ts +6 -1
- package/lib/components/DatePickerInput/DatePickerInput.js +16 -10
- package/lib/components/Dropdown/Dropdown.d.ts +5 -0
- package/lib/components/Dropdown/Dropdown.js +131 -91
- package/lib/components/FeatureFlags/index.js +1 -2
- package/lib/components/IconButton/index.d.ts +4 -1
- package/lib/components/IconButton/index.js +40 -1
- package/lib/components/InlineCheckbox/InlineCheckbox.d.ts +50 -0
- package/lib/components/InlineCheckbox/InlineCheckbox.js +3 -6
- package/lib/components/InlineCheckbox/index.d.ts +9 -0
- package/lib/components/LayoutDirection/LayoutDirection.d.ts +44 -0
- package/lib/components/LayoutDirection/LayoutDirectionContext.d.ts +10 -0
- package/lib/components/LayoutDirection/useLayoutDirection.d.ts +12 -0
- package/lib/components/Menu/MenuItem.js +0 -3
- package/lib/components/MultiSelect/FilterableMultiSelect.d.ts +1 -1
- package/lib/components/MultiSelect/FilterableMultiSelect.js +1 -2
- package/lib/components/MultiSelect/MultiSelect.js +1 -1
- package/lib/components/Notification/Notification.d.ts +9 -2
- package/lib/components/Notification/Notification.js +16 -2
- package/lib/components/NumberInput/NumberInput.d.ts +5 -0
- package/lib/components/NumberInput/NumberInput.js +17 -9
- package/lib/components/OverflowMenu/OverflowMenu.js +1 -1
- package/lib/components/OverflowMenu/next/index.js +40 -1
- package/lib/components/Pagination/Pagination.js +2 -2
- package/lib/components/Pagination/experimental/PageSelector.js +1 -1
- package/lib/components/PaginationNav/PaginationNav.d.ts +1 -1
- package/lib/components/PaginationNav/PaginationNav.js +10 -5
- package/lib/components/Popover/index.js +2 -2
- package/lib/components/SkeletonText/SkeletonText.js +1 -1
- package/lib/components/Tabs/Tabs.js +46 -29
- package/lib/components/TextArea/TextArea.d.ts +5 -0
- package/lib/components/TextArea/TextArea.js +15 -7
- package/lib/components/TextInput/TextInput.d.ts +5 -0
- package/lib/components/TextInput/TextInput.js +15 -7
- package/lib/components/TreeView/TreeNode.js +1 -1
- package/lib/components/TreeView/TreeView.js +1 -1
- package/lib/components/UIShell/HeaderMenu.js +1 -1
- package/lib/components/UIShell/SideNav.js +1 -1
- package/lib/components/UIShell/SideNavItems.js +1 -1
- package/lib/components/UIShell/SideNavMenu.js +1 -1
- package/lib/components/UIShell/SideNavMenuItem.d.ts +5 -1
- package/lib/components/UIShell/SideNavMenuItem.js +7 -2
- package/lib/components/UIShell/Switcher.js +1 -1
- package/package.json +5 -5
|
@@ -26,6 +26,7 @@ var noopFn = require('../../internal/noopFn.js');
|
|
|
26
26
|
var wrapFocus = require('../../internal/wrapFocus.js');
|
|
27
27
|
var index = require('../FeatureFlags/index.js');
|
|
28
28
|
var warning = require('../../internal/warning.js');
|
|
29
|
+
var deprecateValuesWithin = require('../../prop-types/deprecateValuesWithin.js');
|
|
29
30
|
var Text = require('../Text/Text.js');
|
|
30
31
|
var match = require('../../internal/keyboard/match.js');
|
|
31
32
|
var keys = require('../../internal/keyboard/keys.js');
|
|
@@ -703,6 +704,19 @@ ActionableNotification.propTypes = {
|
|
|
703
704
|
* ==================
|
|
704
705
|
*/
|
|
705
706
|
|
|
707
|
+
/**
|
|
708
|
+
* Deprecated callout kind values.
|
|
709
|
+
* @deprecated Use NewKindProps instead.
|
|
710
|
+
*/
|
|
711
|
+
|
|
712
|
+
const propMappingFunction = deprecatedValue => {
|
|
713
|
+
const mapping = {
|
|
714
|
+
error: 'warning',
|
|
715
|
+
// only redirect error -> warning
|
|
716
|
+
success: 'info' // only redirect success -> info
|
|
717
|
+
};
|
|
718
|
+
return mapping[deprecatedValue];
|
|
719
|
+
};
|
|
706
720
|
function Callout(_ref8) {
|
|
707
721
|
let {
|
|
708
722
|
actionButtonLabel,
|
|
@@ -713,7 +727,7 @@ function Callout(_ref8) {
|
|
|
713
727
|
subtitle,
|
|
714
728
|
statusIconDescription,
|
|
715
729
|
className,
|
|
716
|
-
kind = '
|
|
730
|
+
kind = 'info',
|
|
717
731
|
lowContrast,
|
|
718
732
|
...rest
|
|
719
733
|
} = _ref8;
|
|
@@ -769,7 +783,7 @@ Callout.propTypes = {
|
|
|
769
783
|
/**
|
|
770
784
|
* Specify what state the notification represents
|
|
771
785
|
*/
|
|
772
|
-
kind: PropTypes__default["default"].oneOf(['error', 'info', 'info-square', 'success', 'warning', 'warning-alt']),
|
|
786
|
+
kind: deprecateValuesWithin["default"](PropTypes__default["default"].oneOf(['error', 'info', 'info-square', 'success', 'warning', 'warning-alt']), ['warning', 'info'], propMappingFunction),
|
|
773
787
|
/**
|
|
774
788
|
* Specify whether you are using the low contrast variant of the Callout.
|
|
775
789
|
*/
|
|
@@ -24,6 +24,10 @@ export interface NumberInputProps extends Omit<React.InputHTMLAttributes<HTMLInp
|
|
|
24
24
|
* Specify an optional className to be applied to the wrapper node
|
|
25
25
|
*/
|
|
26
26
|
className?: string;
|
|
27
|
+
/**
|
|
28
|
+
* **Experimental**: Provide a `decorator` component to be rendered inside the `TextInput` component
|
|
29
|
+
*/
|
|
30
|
+
decorator?: ReactNode;
|
|
27
31
|
/**
|
|
28
32
|
* Optional starting value for uncontrolled state
|
|
29
33
|
*/
|
|
@@ -113,6 +117,7 @@ export interface NumberInputProps extends Omit<React.InputHTMLAttributes<HTMLInp
|
|
|
113
117
|
*/
|
|
114
118
|
size?: 'sm' | 'md' | 'lg';
|
|
115
119
|
/**
|
|
120
|
+
* @deprecated please use `decorator` instead.
|
|
116
121
|
* **Experimental**: Provide a `Slug` component to be rendered inside the `TextInput` component
|
|
117
122
|
*/
|
|
118
123
|
slug?: ReactNode;
|
|
@@ -47,6 +47,7 @@ const NumberInput = /*#__PURE__*/React__default["default"].forwardRef(function N
|
|
|
47
47
|
const {
|
|
48
48
|
allowEmpty = false,
|
|
49
49
|
className: customClassName,
|
|
50
|
+
decorator,
|
|
50
51
|
disabled = false,
|
|
51
52
|
disableWheel: disableWheelProp = false,
|
|
52
53
|
defaultValue = 0,
|
|
@@ -122,7 +123,8 @@ const NumberInput = /*#__PURE__*/React__default["default"].forwardRef(function N
|
|
|
122
123
|
const [incrementNumLabel, decrementNumLabel] = [t('increment.number'), t('decrement.number')];
|
|
123
124
|
const wrapperClasses = cx__default["default"](`${prefix}--number__input-wrapper`, {
|
|
124
125
|
[`${prefix}--number__input-wrapper--warning`]: normalizedProps.warn,
|
|
125
|
-
[`${prefix}--number__input-wrapper--slug`]: slug
|
|
126
|
+
[`${prefix}--number__input-wrapper--slug`]: slug,
|
|
127
|
+
[`${prefix}--number__input-wrapper--decorator`]: decorator
|
|
126
128
|
});
|
|
127
129
|
const iconClasses = cx__default["default"]({
|
|
128
130
|
[`${prefix}--number__invalid`]: normalizedProps.invalid || normalizedProps.warn,
|
|
@@ -196,18 +198,18 @@ const NumberInput = /*#__PURE__*/React__default["default"].forwardRef(function N
|
|
|
196
198
|
}
|
|
197
199
|
}
|
|
198
200
|
|
|
199
|
-
//
|
|
200
|
-
let
|
|
201
|
-
if (
|
|
202
|
-
|
|
201
|
+
// AILabel always size `mini`
|
|
202
|
+
let normalizedDecorator = /*#__PURE__*/React__default["default"].isValidElement(slug ?? decorator) ? slug ?? decorator : null;
|
|
203
|
+
if (normalizedDecorator && normalizedDecorator['type']?.displayName === 'AILabel') {
|
|
204
|
+
normalizedDecorator = /*#__PURE__*/React__default["default"].cloneElement(normalizedDecorator, {
|
|
203
205
|
size: 'mini'
|
|
204
206
|
});
|
|
205
207
|
}
|
|
206
208
|
|
|
207
209
|
// Need to update the internal value when the revert button is clicked
|
|
208
210
|
let isRevertActive;
|
|
209
|
-
if (
|
|
210
|
-
isRevertActive =
|
|
211
|
+
if (normalizedDecorator && normalizedDecorator['type']?.displayName === 'AILabel') {
|
|
212
|
+
isRevertActive = normalizedDecorator.props.revertActive;
|
|
211
213
|
}
|
|
212
214
|
React.useEffect(() => {
|
|
213
215
|
if (!isRevertActive && slug && defaultValue) {
|
|
@@ -262,7 +264,9 @@ const NumberInput = /*#__PURE__*/React__default["default"].forwardRef(function N
|
|
|
262
264
|
step: step,
|
|
263
265
|
type: "number",
|
|
264
266
|
value: value
|
|
265
|
-
})),
|
|
267
|
+
})), slug ? normalizedDecorator : decorator ? /*#__PURE__*/React__default["default"].createElement("div", {
|
|
268
|
+
className: `${prefix}--number__input-inner-wrapper--decorator`
|
|
269
|
+
}, normalizedDecorator) : '', Icon ? /*#__PURE__*/React__default["default"].createElement(Icon, {
|
|
266
270
|
className: iconClasses
|
|
267
271
|
}) : null, !hideSteppers && /*#__PURE__*/React__default["default"].createElement("div", {
|
|
268
272
|
className: `${prefix}--number__controls`
|
|
@@ -307,6 +311,10 @@ NumberInput.propTypes = {
|
|
|
307
311
|
* Specify an optional className to be applied to the wrapper node
|
|
308
312
|
*/
|
|
309
313
|
className: PropTypes__default["default"].string,
|
|
314
|
+
/**
|
|
315
|
+
* **Experimental**: Provide a `decorator` component to be rendered inside the `NumberInput` component
|
|
316
|
+
*/
|
|
317
|
+
decorator: PropTypes__default["default"].node,
|
|
310
318
|
/**
|
|
311
319
|
* Optional starting value for uncontrolled state
|
|
312
320
|
*/
|
|
@@ -389,7 +397,7 @@ NumberInput.propTypes = {
|
|
|
389
397
|
/**
|
|
390
398
|
* **Experimental**: Provide a `Slug` component to be rendered inside the `NumberInput` component
|
|
391
399
|
*/
|
|
392
|
-
slug: PropTypes__default["default"].node,
|
|
400
|
+
slug: deprecate["default"](PropTypes__default["default"].node, 'The `slug` prop for `NumberInput` is no longer needed and has ' + 'been deprecated in v11 in favor of the new `decorator` prop. It will be moved in the next major release.'),
|
|
393
401
|
/**
|
|
394
402
|
* Specify how much the values should increase/decrease upon clicking on up/down button
|
|
395
403
|
*/
|
|
@@ -217,7 +217,7 @@ class OverflowMenu extends React__default["default"].Component {
|
|
|
217
217
|
direction
|
|
218
218
|
} = _ref;
|
|
219
219
|
const enabledIndices = React__default["default"].Children.toArray(this.props.children).reduce((acc, curr, i) => {
|
|
220
|
-
if (
|
|
220
|
+
if (/*#__PURE__*/React__default["default"].isValidElement(curr) && !curr.props.disabled) {
|
|
221
221
|
acc.push(i);
|
|
222
222
|
}
|
|
223
223
|
return acc;
|
|
@@ -23,6 +23,7 @@ var mergeRefs = require('../../../tools/mergeRefs.js');
|
|
|
23
23
|
var useId = require('../../../internal/useId.js');
|
|
24
24
|
var usePrefix = require('../../../internal/usePrefix.js');
|
|
25
25
|
var useAttachedMenu = require('../../../internal/useAttachedMenu.js');
|
|
26
|
+
var deprecateValuesWithin = require('../../../prop-types/deprecateValuesWithin.js');
|
|
26
27
|
|
|
27
28
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
28
29
|
|
|
@@ -31,6 +32,19 @@ var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
|
|
|
31
32
|
var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
|
|
32
33
|
|
|
33
34
|
const defaultSize = 'md';
|
|
35
|
+
const propMappingFunction = deprecatedValue => {
|
|
36
|
+
const mapping = {
|
|
37
|
+
'top-left': 'top-start',
|
|
38
|
+
'top-right': 'top-end',
|
|
39
|
+
'bottom-left': 'bottom-start',
|
|
40
|
+
'bottom-right': 'bottom-end',
|
|
41
|
+
'left-bottom': 'left-end',
|
|
42
|
+
'left-top': 'left-start',
|
|
43
|
+
'right-bottom': 'right-end',
|
|
44
|
+
'right-top': 'right-start'
|
|
45
|
+
};
|
|
46
|
+
return mapping[deprecatedValue];
|
|
47
|
+
};
|
|
34
48
|
const OverflowMenu = /*#__PURE__*/React__default["default"].forwardRef(function OverflowMenu(_ref, forwardRef) {
|
|
35
49
|
let {
|
|
36
50
|
autoAlign = false,
|
|
@@ -172,7 +186,32 @@ OverflowMenu.propTypes = {
|
|
|
172
186
|
/**
|
|
173
187
|
* Specify how the trigger tooltip should be aligned.
|
|
174
188
|
*/
|
|
175
|
-
tooltipAlignment: PropTypes__default["default"].oneOf(['top', 'top-left',
|
|
189
|
+
tooltipAlignment: deprecateValuesWithin["default"](PropTypes__default["default"].oneOf(['top', 'top-left',
|
|
190
|
+
// deprecated use top-start instead
|
|
191
|
+
'top-right',
|
|
192
|
+
// deprecated use top-end instead
|
|
193
|
+
|
|
194
|
+
'bottom', 'bottom-left',
|
|
195
|
+
// deprecated use bottom-start instead
|
|
196
|
+
'bottom-right',
|
|
197
|
+
// deprecated use bottom-end instead
|
|
198
|
+
|
|
199
|
+
'left', 'left-bottom',
|
|
200
|
+
// deprecated use left-end instead
|
|
201
|
+
'left-top',
|
|
202
|
+
// deprecated use left-start instead
|
|
203
|
+
|
|
204
|
+
'right', 'right-bottom',
|
|
205
|
+
// deprecated use right-end instead
|
|
206
|
+
'right-top',
|
|
207
|
+
// deprecated use right-start instead
|
|
208
|
+
|
|
209
|
+
// new values to match floating-ui
|
|
210
|
+
'top-start', 'top-end', 'bottom-start', 'bottom-end', 'left-end', 'left-start', 'right-end', 'right-start']),
|
|
211
|
+
//allowed prop values
|
|
212
|
+
['top', 'top-start', 'top-end', 'bottom', 'bottom-start', 'bottom-end', 'left', 'left-start', 'left-end', 'right', 'right-start', 'right-end'],
|
|
213
|
+
//optional mapper function
|
|
214
|
+
propMappingFunction),
|
|
176
215
|
/**
|
|
177
216
|
* Specify a DOM node where the Menu should be rendered in. Defaults to document.body.
|
|
178
217
|
*/
|
|
@@ -39,7 +39,7 @@ function renderSelectItems(total) {
|
|
|
39
39
|
let counter = 1;
|
|
40
40
|
const itemArr = [];
|
|
41
41
|
while (counter <= total) {
|
|
42
|
-
itemArr.push(
|
|
42
|
+
itemArr.push(/*#__PURE__*/React__default["default"].createElement(SelectItem["default"], {
|
|
43
43
|
key: counter,
|
|
44
44
|
value: counter,
|
|
45
45
|
text: String(counter)
|
|
@@ -255,7 +255,7 @@ const Pagination = /*#__PURE__*/React__default["default"].forwardRef(function Pa
|
|
|
255
255
|
onClick: decrementPage,
|
|
256
256
|
ref: backBtnRef
|
|
257
257
|
}, _CaretLeft || (_CaretLeft = /*#__PURE__*/React__default["default"].createElement(iconsReact.CaretLeft, null))), /*#__PURE__*/React__default["default"].createElement(index.IconButton, {
|
|
258
|
-
align: "top-
|
|
258
|
+
align: "top-end",
|
|
259
259
|
disabled: forwardButtonDisabled || isLastPage,
|
|
260
260
|
kind: "ghost",
|
|
261
261
|
className: forwardButtonClasses,
|
|
@@ -40,7 +40,7 @@ function PageSelector(_ref) {
|
|
|
40
40
|
const renderPages = total => {
|
|
41
41
|
const pages = [];
|
|
42
42
|
for (let counter = 1; counter <= total; counter += 1) {
|
|
43
|
-
pages.push(
|
|
43
|
+
pages.push(/*#__PURE__*/React__default["default"].createElement(SelectItem["default"], {
|
|
44
44
|
key: counter,
|
|
45
45
|
value: counter,
|
|
46
46
|
text: String(counter)
|
|
@@ -28,7 +28,7 @@ interface PaginationNavProps extends Omit<React.HTMLAttributes<HTMLElement>, 'on
|
|
|
28
28
|
*/
|
|
29
29
|
disableOverflow?: boolean;
|
|
30
30
|
/**
|
|
31
|
-
* The number of items to be shown.
|
|
31
|
+
* The number of items to be shown (minimum of 4 unless props.items < 4).
|
|
32
32
|
*/
|
|
33
33
|
itemsShown?: number;
|
|
34
34
|
/**
|
|
@@ -16,6 +16,8 @@ var cx = require('classnames');
|
|
|
16
16
|
var iconsReact = require('@carbon/icons-react');
|
|
17
17
|
var index = require('../IconButton/index.js');
|
|
18
18
|
var usePrefix = require('../../internal/usePrefix.js');
|
|
19
|
+
var layout = require('@carbon/layout');
|
|
20
|
+
var useMatchMedia = require('../../internal/useMatchMedia.js');
|
|
19
21
|
|
|
20
22
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
21
23
|
|
|
@@ -189,8 +191,10 @@ const PaginationNav = /*#__PURE__*/React__default["default"].forwardRef(function
|
|
|
189
191
|
translateWithId: t = translateWithId,
|
|
190
192
|
...rest
|
|
191
193
|
} = _ref4;
|
|
194
|
+
const smMediaQuery = `(max-width: ${layout.breakpoints.sm.width})`;
|
|
195
|
+
const isSm = useMatchMedia.useMatchMedia(smMediaQuery);
|
|
192
196
|
const [currentPage, setCurrentPage] = React.useState(page);
|
|
193
|
-
const [itemsDisplayedOnPage, setItemsDisplayedOnPage] = React.useState(itemsShown >= 4 ? itemsShown : 4);
|
|
197
|
+
const [itemsDisplayedOnPage, setItemsDisplayedOnPage] = React.useState(itemsShown >= 4 && !isSm ? itemsShown : 4);
|
|
194
198
|
const [cuts, setCuts] = React.useState(calculateCuts(currentPage, totalItems, itemsDisplayedOnPage));
|
|
195
199
|
const prevPage = usePrevious(currentPage);
|
|
196
200
|
const prefix = usePrefix.usePrefix();
|
|
@@ -235,9 +239,10 @@ const PaginationNav = /*#__PURE__*/React__default["default"].forwardRef(function
|
|
|
235
239
|
|
|
236
240
|
// re-calculate cuts if props.totalItems or props.itemsShown change
|
|
237
241
|
React.useEffect(() => {
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
242
|
+
const itemsToBeShown = itemsShown >= 4 && !isSm ? itemsShown : 4;
|
|
243
|
+
setItemsDisplayedOnPage(Math.max(itemsToBeShown, 4));
|
|
244
|
+
setCuts(calculateCuts(currentPage, totalItems, Math.max(itemsToBeShown, 4)));
|
|
245
|
+
}, [totalItems, itemsShown, isSm]); // eslint-disable-line react-hooks/exhaustive-deps
|
|
241
246
|
|
|
242
247
|
// update cuts if necessary whenever currentPage changes
|
|
243
248
|
React.useEffect(() => {
|
|
@@ -396,7 +401,7 @@ PaginationNav.propTypes = {
|
|
|
396
401
|
// eslint-disable-line react/prop-types
|
|
397
402
|
|
|
398
403
|
/**
|
|
399
|
-
* The number of items to be shown.
|
|
404
|
+
* The number of items to be shown (minimum of 4 unless props.items < 4).
|
|
400
405
|
*/
|
|
401
406
|
itemsShown: PropTypes__default["default"].number,
|
|
402
407
|
/**
|
|
@@ -223,7 +223,7 @@ const Popover = /*#__PURE__*/React__default["default"].forwardRef(function Popov
|
|
|
223
223
|
const isTriggerElement = item?.type === 'button';
|
|
224
224
|
const isTriggerComponent = enableFloatingStyles && displayName && ['ToggletipButton'].includes(displayName);
|
|
225
225
|
const isAllowedTriggerComponent = enableFloatingStyles && !['ToggletipContent', 'PopoverContent'].includes(displayName);
|
|
226
|
-
if (
|
|
226
|
+
if (/*#__PURE__*/React__default["default"].isValidElement(item) && (isTriggerElement || isTriggerComponent || isAllowedTriggerComponent)) {
|
|
227
227
|
const className = item?.props?.className;
|
|
228
228
|
const ref = (item?.props).ref;
|
|
229
229
|
const tabTipClasses = cx__default["default"](`${prefix}--popover--tab-tip__button`, className);
|
|
@@ -346,7 +346,7 @@ Popover.propTypes = {
|
|
|
346
346
|
*/
|
|
347
347
|
open: PropTypes__default["default"].bool.isRequired
|
|
348
348
|
};
|
|
349
|
-
function PopoverContentRenderFunction(
|
|
349
|
+
function PopoverContentRenderFunction(// eslint-disable-next-line react/prop-types
|
|
350
350
|
_ref2, forwardRef) {
|
|
351
351
|
let {
|
|
352
352
|
className,
|
|
@@ -66,7 +66,7 @@ const SkeletonText = _ref => {
|
|
|
66
66
|
}, [lineCountNumber, paragraph, refs, width, widthNum, widthPercent, widthPx]);
|
|
67
67
|
const lines = [];
|
|
68
68
|
for (let i = 0; i < lineCountNumber; i++) {
|
|
69
|
-
lines.push(
|
|
69
|
+
lines.push(/*#__PURE__*/React__default["default"].createElement("p", _rollupPluginBabelHelpers["extends"]({
|
|
70
70
|
className: skeletonTextClasses,
|
|
71
71
|
key: i,
|
|
72
72
|
ref: el => refs.current = [...refs.current, el]
|
|
@@ -357,6 +357,41 @@ function TabList(_ref4) {
|
|
|
357
357
|
setActiveIndex(selectedIndex);
|
|
358
358
|
}
|
|
359
359
|
}
|
|
360
|
+
|
|
361
|
+
/**
|
|
362
|
+
* Scroll the tab into view if it is not already visible
|
|
363
|
+
* @param tab - The tab to scroll into view
|
|
364
|
+
* @returns {void}
|
|
365
|
+
*/
|
|
366
|
+
function scrollTabIntoView(tab) {
|
|
367
|
+
if (!isScrollable || !ref.current) {
|
|
368
|
+
return;
|
|
369
|
+
}
|
|
370
|
+
if (tab) {
|
|
371
|
+
// The width of the "scroll buttons"
|
|
372
|
+
const {
|
|
373
|
+
width: tabWidth
|
|
374
|
+
} = tab.getBoundingClientRect();
|
|
375
|
+
|
|
376
|
+
// The start and end position of the selected tab
|
|
377
|
+
const start = tab.offsetLeft;
|
|
378
|
+
const end = tab.offsetLeft + tabWidth;
|
|
379
|
+
|
|
380
|
+
// The start and end of the visible area for the tabs
|
|
381
|
+
const visibleStart = ref.current.scrollLeft + buttonWidth;
|
|
382
|
+
const visibleEnd = ref.current.scrollLeft + ref.current.clientWidth - buttonWidth;
|
|
383
|
+
|
|
384
|
+
// The beginning of the tab is clipped and not visible
|
|
385
|
+
if (start < visibleStart) {
|
|
386
|
+
setScrollLeft(start - buttonWidth);
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
// The end of the tab is clipped and not visible
|
|
390
|
+
if (end > visibleEnd) {
|
|
391
|
+
setScrollLeft(end + buttonWidth - ref.current.clientWidth);
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
}
|
|
360
395
|
useEffectOnce.useEffectOnce(() => {
|
|
361
396
|
const tab = tabs.current[selectedIndex];
|
|
362
397
|
if (scrollIntoView && tab) {
|
|
@@ -388,12 +423,12 @@ function TabList(_ref4) {
|
|
|
388
423
|
});
|
|
389
424
|
useIsomorphicEffect["default"](() => {
|
|
390
425
|
if (ref.current) {
|
|
391
|
-
//adding 1 in calculation for firefox support
|
|
426
|
+
// adding 1 in calculation for firefox support
|
|
392
427
|
setIsScrollable(ref.current.scrollWidth > ref.current.clientWidth + 1);
|
|
393
428
|
}
|
|
394
429
|
function handler() {
|
|
395
430
|
if (ref.current) {
|
|
396
|
-
//adding 1 in calculation for firefox support
|
|
431
|
+
// adding 1 in calculation for firefox support
|
|
397
432
|
setIsScrollable(ref.current.scrollWidth > ref.current.clientWidth + 1);
|
|
398
433
|
}
|
|
399
434
|
}
|
|
@@ -411,36 +446,18 @@ function TabList(_ref4) {
|
|
|
411
446
|
ref.current.scrollLeft = scrollLeft;
|
|
412
447
|
}
|
|
413
448
|
}, [scrollLeft]);
|
|
449
|
+
|
|
450
|
+
// scroll manual tabs when active index changes (focus outline movement)
|
|
414
451
|
useIsomorphicEffect["default"](() => {
|
|
415
|
-
if (!isScrollable || !ref.current) {
|
|
416
|
-
return;
|
|
417
|
-
}
|
|
418
452
|
const tab = activation === 'manual' ? tabs.current[activeIndex] : tabs.current[selectedIndex];
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
// The start and end position of the selected tab
|
|
423
|
-
const {
|
|
424
|
-
width: tabWidth
|
|
425
|
-
} = tab.getBoundingClientRect();
|
|
426
|
-
const start = tab.offsetLeft;
|
|
427
|
-
const end = tab.offsetLeft + tabWidth;
|
|
428
|
-
|
|
429
|
-
// The start and end of the visible area for the tabs
|
|
430
|
-
const visibleStart = ref.current.scrollLeft + buttonWidth;
|
|
431
|
-
const visibleEnd = ref.current.scrollLeft + ref.current.clientWidth - buttonWidth;
|
|
432
|
-
|
|
433
|
-
// The beginning of the tab is clipped and not visible
|
|
434
|
-
if (start < visibleStart) {
|
|
435
|
-
setScrollLeft(start - buttonWidth);
|
|
436
|
-
}
|
|
453
|
+
scrollTabIntoView(tab);
|
|
454
|
+
}, [activation, activeIndex]);
|
|
437
455
|
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
}, [activation, activeIndex, selectedIndex, isScrollable, children]);
|
|
456
|
+
// scroll tabs when selected index changes
|
|
457
|
+
useIsomorphicEffect["default"](() => {
|
|
458
|
+
const tab = tabs.current[selectedIndex];
|
|
459
|
+
scrollTabIntoView(tab);
|
|
460
|
+
}, [selectedIndex, isScrollable, children]);
|
|
444
461
|
usePressable.usePressable(previousButton, {
|
|
445
462
|
onPress(_ref6) {
|
|
446
463
|
let {
|
|
@@ -15,6 +15,10 @@ export interface TextAreaProps extends React.InputHTMLAttributes<HTMLTextAreaEle
|
|
|
15
15
|
* Specify the `cols` attribute for the underlying `<textarea>` node
|
|
16
16
|
*/
|
|
17
17
|
cols?: number;
|
|
18
|
+
/**
|
|
19
|
+
* **Experimental**: Provide a `decorator` component to be rendered inside the `TextArea` component
|
|
20
|
+
*/
|
|
21
|
+
decorator?: ReactNode;
|
|
18
22
|
/**
|
|
19
23
|
* Optionally provide the default value of the `<textarea>`
|
|
20
24
|
*/
|
|
@@ -90,6 +94,7 @@ export interface TextAreaProps extends React.InputHTMLAttributes<HTMLTextAreaEle
|
|
|
90
94
|
*/
|
|
91
95
|
rows?: number;
|
|
92
96
|
/**
|
|
97
|
+
* @deprecated please use `decorator` instead.
|
|
93
98
|
* **Experimental**: Provide a `Slug` component to be rendered inside the `TextArea` component
|
|
94
99
|
*/
|
|
95
100
|
slug?: ReactNode;
|
|
@@ -35,6 +35,7 @@ var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
|
|
|
35
35
|
const TextArea = /*#__PURE__*/React__default["default"].forwardRef((props, forwardRef) => {
|
|
36
36
|
const {
|
|
37
37
|
className,
|
|
38
|
+
decorator,
|
|
38
39
|
disabled = false,
|
|
39
40
|
id,
|
|
40
41
|
labelText,
|
|
@@ -164,7 +165,8 @@ const TextArea = /*#__PURE__*/React__default["default"].forwardRef((props, forwa
|
|
|
164
165
|
[`${prefix}--text-area__wrapper--cols`]: other.cols,
|
|
165
166
|
[`${prefix}--text-area__wrapper--readonly`]: other.readOnly,
|
|
166
167
|
[`${prefix}--text-area__wrapper--warn`]: warn,
|
|
167
|
-
[`${prefix}--text-area__wrapper--slug`]: slug
|
|
168
|
+
[`${prefix}--text-area__wrapper--slug`]: slug,
|
|
169
|
+
[`${prefix}--text-area__wrapper--decorator`]: decorator
|
|
168
170
|
});
|
|
169
171
|
const labelClasses = cx__default["default"](`${prefix}--label`, {
|
|
170
172
|
[`${prefix}--visually-hidden`]: hideLabel && !isFluid,
|
|
@@ -263,10 +265,10 @@ const TextArea = /*#__PURE__*/React__default["default"].forwardRef((props, forwa
|
|
|
263
265
|
ref: ref
|
|
264
266
|
}));
|
|
265
267
|
|
|
266
|
-
//
|
|
267
|
-
let
|
|
268
|
-
if (
|
|
269
|
-
|
|
268
|
+
// AILabel is always size `mini`
|
|
269
|
+
let normalizedDecorator = /*#__PURE__*/React__default["default"].isValidElement(slug ?? decorator) ? slug ?? decorator : null;
|
|
270
|
+
if (normalizedDecorator && normalizedDecorator['type']?.displayName === 'AILabel') {
|
|
271
|
+
normalizedDecorator = /*#__PURE__*/React__default["default"].cloneElement(normalizedDecorator, {
|
|
270
272
|
size: 'mini'
|
|
271
273
|
});
|
|
272
274
|
}
|
|
@@ -281,7 +283,9 @@ const TextArea = /*#__PURE__*/React__default["default"].forwardRef((props, forwa
|
|
|
281
283
|
className: `${prefix}--text-area__invalid-icon`
|
|
282
284
|
}), warn && !invalid && !isFluid && /*#__PURE__*/React__default["default"].createElement(iconsReact.WarningAltFilled, {
|
|
283
285
|
className: `${prefix}--text-area__invalid-icon ${prefix}--text-area__invalid-icon--warning`
|
|
284
|
-
}), input,
|
|
286
|
+
}), input, slug ? normalizedDecorator : decorator ? /*#__PURE__*/React__default["default"].createElement("div", {
|
|
287
|
+
className: `${prefix}--text-area__inner-wrapper--decorator`
|
|
288
|
+
}, normalizedDecorator) : '', /*#__PURE__*/React__default["default"].createElement("span", {
|
|
285
289
|
className: `${prefix}--text-area__counter-alert`,
|
|
286
290
|
role: "alert",
|
|
287
291
|
"aria-live": "assertive",
|
|
@@ -306,6 +310,10 @@ TextArea.propTypes = {
|
|
|
306
310
|
* Specify the method used for calculating the counter number
|
|
307
311
|
*/
|
|
308
312
|
counterMode: PropTypes__default["default"].oneOf(['character', 'word']),
|
|
313
|
+
/**
|
|
314
|
+
* **Experimental**: Provide a `decorator` component to be rendered inside the `TextArea` component
|
|
315
|
+
*/
|
|
316
|
+
decorator: PropTypes__default["default"].node,
|
|
309
317
|
/**
|
|
310
318
|
* Optionally provide the default value of the `<textarea>`
|
|
311
319
|
*/
|
|
@@ -382,7 +390,7 @@ TextArea.propTypes = {
|
|
|
382
390
|
/**
|
|
383
391
|
* **Experimental**: Provide a `Slug` component to be rendered inside the `TextArea` component
|
|
384
392
|
*/
|
|
385
|
-
slug: PropTypes__default["default"].node,
|
|
393
|
+
slug: deprecate["default"](PropTypes__default["default"].node, 'The `slug` prop for `TextArea` has ' + 'been deprecated in favor of the new `decorator` prop. It will be removed in the next major release.'),
|
|
386
394
|
/**
|
|
387
395
|
* Provide the current value of the `<textarea>`
|
|
388
396
|
*/
|
|
@@ -11,6 +11,10 @@ export interface TextInputProps extends Omit<React.InputHTMLAttributes<HTMLInput
|
|
|
11
11
|
* Specify an optional className to be applied to the `<input>` node
|
|
12
12
|
*/
|
|
13
13
|
className?: string;
|
|
14
|
+
/**
|
|
15
|
+
* **Experimental**: Provide a `decorator` component to be rendered inside the `TextInput` component
|
|
16
|
+
*/
|
|
17
|
+
decorator?: ReactNode;
|
|
14
18
|
/**
|
|
15
19
|
* Optionally provide the default value of the `<input>`
|
|
16
20
|
*/
|
|
@@ -86,6 +90,7 @@ export interface TextInputProps extends Omit<React.InputHTMLAttributes<HTMLInput
|
|
|
86
90
|
*/
|
|
87
91
|
size?: 'sm' | 'md' | 'lg' | 'xl';
|
|
88
92
|
/**
|
|
93
|
+
* @deprecated please use `decorator` instead.
|
|
89
94
|
* **Experimental**: Provide a `Slug` component to be rendered inside the `TextInput` component
|
|
90
95
|
*/
|
|
91
96
|
slug?: ReactNode;
|
|
@@ -33,6 +33,7 @@ var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
|
|
|
33
33
|
const TextInput = /*#__PURE__*/React__default["default"].forwardRef(function TextInput(_ref, ref) {
|
|
34
34
|
let {
|
|
35
35
|
className,
|
|
36
|
+
decorator,
|
|
36
37
|
disabled = false,
|
|
37
38
|
helperText,
|
|
38
39
|
hideLabel,
|
|
@@ -125,7 +126,8 @@ const TextInput = /*#__PURE__*/React__default["default"].forwardRef(function Tex
|
|
|
125
126
|
});
|
|
126
127
|
const fieldWrapperClasses = cx__default["default"](`${prefix}--text-input__field-wrapper`, {
|
|
127
128
|
[`${prefix}--text-input__field-wrapper--warning`]: normalizedProps.warn,
|
|
128
|
-
[`${prefix}--text-input__field-wrapper--slug`]: slug
|
|
129
|
+
[`${prefix}--text-input__field-wrapper--slug`]: slug,
|
|
130
|
+
[`${prefix}--text-input__field-wrapper--decorator`]: decorator
|
|
129
131
|
});
|
|
130
132
|
const iconClasses = cx__default["default"]({
|
|
131
133
|
[`${prefix}--text-input__invalid-icon`]: normalizedProps.invalid || normalizedProps.warn,
|
|
@@ -189,10 +191,10 @@ const TextInput = /*#__PURE__*/React__default["default"].forwardRef(function Tex
|
|
|
189
191
|
}, [ariaAnnouncement, prevAnnouncement]);
|
|
190
192
|
const Icon = normalizedProps.icon;
|
|
191
193
|
|
|
192
|
-
//
|
|
193
|
-
let
|
|
194
|
-
if (
|
|
195
|
-
|
|
194
|
+
// AILabel is always size `mini`
|
|
195
|
+
let normalizedDecorator = /*#__PURE__*/React__default["default"].isValidElement(slug ?? decorator) ? slug ?? decorator : null;
|
|
196
|
+
if (normalizedDecorator && normalizedDecorator['type']?.displayName === 'AILabel') {
|
|
197
|
+
normalizedDecorator = /*#__PURE__*/React__default["default"].cloneElement(normalizedDecorator, {
|
|
196
198
|
size: 'mini'
|
|
197
199
|
});
|
|
198
200
|
}
|
|
@@ -207,7 +209,9 @@ const TextInput = /*#__PURE__*/React__default["default"].forwardRef(function Tex
|
|
|
207
209
|
"data-invalid": normalizedProps.invalid || null
|
|
208
210
|
}, Icon && /*#__PURE__*/React__default["default"].createElement(Icon, {
|
|
209
211
|
className: iconClasses
|
|
210
|
-
}), input,
|
|
212
|
+
}), input, slug ? normalizedDecorator : decorator ? /*#__PURE__*/React__default["default"].createElement("div", {
|
|
213
|
+
className: `${prefix}--text-input__field-inner-wrapper--decorator`
|
|
214
|
+
}, normalizedDecorator) : '', /*#__PURE__*/React__default["default"].createElement("span", {
|
|
211
215
|
className: `${prefix}--text-input__counter-alert`,
|
|
212
216
|
role: "alert",
|
|
213
217
|
"aria-live": "assertive",
|
|
@@ -225,6 +229,10 @@ TextInput.propTypes = {
|
|
|
225
229
|
* Specify an optional className to be applied to the `<input>` node
|
|
226
230
|
*/
|
|
227
231
|
className: PropTypes__default["default"].string,
|
|
232
|
+
/**
|
|
233
|
+
* **Experimental**: Provide a `decorator` component to be rendered inside the `TextInput` component
|
|
234
|
+
*/
|
|
235
|
+
decorator: PropTypes__default["default"].node,
|
|
228
236
|
/**
|
|
229
237
|
* Optionally provide the default value of the `<input>`
|
|
230
238
|
*/
|
|
@@ -300,7 +308,7 @@ TextInput.propTypes = {
|
|
|
300
308
|
/**
|
|
301
309
|
* **Experimental**: Provide a `Slug` component to be rendered inside the `TextInput` component
|
|
302
310
|
*/
|
|
303
|
-
slug: PropTypes__default["default"].node,
|
|
311
|
+
slug: deprecate["default"](PropTypes__default["default"].node, 'The `slug` prop for `TextInput` has ' + 'been deprecated in favor of the new `decorator` prop. It will be removed in the next major release.'),
|
|
304
312
|
/**
|
|
305
313
|
* Specify the type of the `<input>`
|
|
306
314
|
*/
|
|
@@ -73,7 +73,7 @@ const TreeNode = /*#__PURE__*/React__default["default"].forwardRef((_ref, forwar
|
|
|
73
73
|
}
|
|
74
74
|
};
|
|
75
75
|
const nodesWithProps = React__default["default"].Children.map(children, node => {
|
|
76
|
-
if (
|
|
76
|
+
if (/*#__PURE__*/React__default["default"].isValidElement(node)) {
|
|
77
77
|
return /*#__PURE__*/React__default["default"].cloneElement(node, {
|
|
78
78
|
active,
|
|
79
79
|
depth: depth + 1,
|
|
@@ -131,7 +131,7 @@ const TreeView = _ref => {
|
|
|
131
131
|
sharedNodeProps.tabIndex = 0;
|
|
132
132
|
focusTarget = true;
|
|
133
133
|
}
|
|
134
|
-
if (
|
|
134
|
+
if (/*#__PURE__*/React__default["default"].isValidElement(node)) {
|
|
135
135
|
return /*#__PURE__*/React__default["default"].cloneElement(node, sharedNodeProps);
|
|
136
136
|
}
|
|
137
137
|
});
|
|
@@ -134,7 +134,7 @@ class HeaderMenu extends React__default["default"].Component {
|
|
|
134
134
|
* sequence when they might not want to go through all the items.
|
|
135
135
|
*/
|
|
136
136
|
_rollupPluginBabelHelpers.defineProperty(this, "_renderMenuItem", (item, index) => {
|
|
137
|
-
if (
|
|
137
|
+
if (/*#__PURE__*/React__default["default"].isValidElement(item)) {
|
|
138
138
|
return /*#__PURE__*/React__default["default"].cloneElement(item, {
|
|
139
139
|
ref: this.handleItemRef(index)
|
|
140
140
|
});
|
|
@@ -106,7 +106,7 @@ function SideNavRenderFunction(_ref, ref) {
|
|
|
106
106
|
childrenToRender = React__default["default"].Children.map(children, child => {
|
|
107
107
|
// if we are controlled, check for if we have hovered over or the expanded state, else just use the expanded state (uncontrolled)
|
|
108
108
|
const currentExpansionState = controlled ? expandedViaHoverState || expanded : expanded;
|
|
109
|
-
if (
|
|
109
|
+
if (/*#__PURE__*/React.isValidElement(child)) {
|
|
110
110
|
const childJsxElement = child;
|
|
111
111
|
// avoid spreading `isSideNavExpanded` to non-Carbon UI Shell children
|
|
112
112
|
return /*#__PURE__*/React__default["default"].cloneElement(childJsxElement, {
|
|
@@ -30,7 +30,7 @@ const SideNavItems = _ref => {
|
|
|
30
30
|
const prefix = usePrefix.usePrefix();
|
|
31
31
|
const className = cx__default["default"]([`${prefix}--side-nav__items`], customClassName);
|
|
32
32
|
const childrenWithExpandedState = React__default["default"].Children.map(children, child => {
|
|
33
|
-
if (
|
|
33
|
+
if (/*#__PURE__*/React__default["default"].isValidElement(child)) {
|
|
34
34
|
// avoid spreading `isSideNavExpanded` to non-Carbon UI Shell children
|
|
35
35
|
const childDisplayName = child.type?.displayName;
|
|
36
36
|
return /*#__PURE__*/React__default["default"].cloneElement(child, {
|