@carbon/react 1.71.1 → 1.72.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 +937 -937
- package/es/components/ComboBox/ComboBox.d.ts +5 -0
- package/es/components/ComboBox/ComboBox.js +17 -12
- package/es/components/MultiSelect/FilterableMultiSelect.d.ts +5 -0
- package/es/components/MultiSelect/FilterableMultiSelect.js +14 -9
- package/es/components/MultiSelect/MultiSelect.d.ts +5 -0
- package/es/components/MultiSelect/MultiSelect.js +15 -10
- package/es/components/OverflowMenu/OverflowMenu.d.ts +1 -1
- package/es/components/OverflowMenu/OverflowMenu.js +7 -17
- package/es/components/Pagination/Pagination.js +1 -1
- package/es/components/Popover/index.d.ts +5 -0
- package/es/components/Popover/index.js +12 -1
- package/es/components/Select/Select.d.ts +6 -1
- package/es/components/Select/Select.js +15 -10
- package/es/components/Tile/Tile.d.ts +1 -1
- package/es/components/UIShell/Switcher.js +7 -3
- package/lib/components/ComboBox/ComboBox.d.ts +5 -0
- package/lib/components/ComboBox/ComboBox.js +17 -12
- package/lib/components/MultiSelect/FilterableMultiSelect.d.ts +5 -0
- package/lib/components/MultiSelect/FilterableMultiSelect.js +14 -9
- package/lib/components/MultiSelect/MultiSelect.d.ts +5 -0
- package/lib/components/MultiSelect/MultiSelect.js +15 -10
- package/lib/components/OverflowMenu/OverflowMenu.d.ts +1 -1
- package/lib/components/OverflowMenu/OverflowMenu.js +9 -19
- package/lib/components/Pagination/Pagination.js +1 -1
- package/lib/components/Popover/index.d.ts +5 -0
- package/lib/components/Popover/index.js +12 -1
- package/lib/components/Select/Select.d.ts +6 -1
- package/lib/components/Select/Select.js +15 -10
- package/lib/components/Tile/Tile.d.ts +1 -1
- package/lib/components/UIShell/Switcher.js +7 -3
- package/package.json +15 -15
|
@@ -81,6 +81,7 @@ const FilterableMultiSelect = /*#__PURE__*/React__default["default"].forwardRef(
|
|
|
81
81
|
clearSelectionDescription = 'Total items selected: ',
|
|
82
82
|
clearSelectionText = 'To clear selection, press Delete or Backspace',
|
|
83
83
|
compareItems = sorting.defaultCompareItems,
|
|
84
|
+
decorator,
|
|
84
85
|
direction = 'bottom',
|
|
85
86
|
disabled = false,
|
|
86
87
|
downshiftProps,
|
|
@@ -210,6 +211,7 @@ const FilterableMultiSelect = /*#__PURE__*/React__default["default"].forwardRef(
|
|
|
210
211
|
[`${prefix}--list-box__wrapper--fluid--invalid`]: isFluid && invalid,
|
|
211
212
|
[`${prefix}--list-box__wrapper--fluid--focus`]: isFluid && isFocused,
|
|
212
213
|
[`${prefix}--list-box__wrapper--slug`]: slug,
|
|
214
|
+
[`${prefix}--list-box__wrapper--decorator`]: decorator,
|
|
213
215
|
[`${prefix}--autoalign`]: autoAlign
|
|
214
216
|
});
|
|
215
217
|
const helperId = !helperText ? undefined : `filterablemultiselect-helper-text-${filterableMultiSelectInstanceId}`;
|
|
@@ -424,10 +426,10 @@ const FilterableMultiSelect = /*#__PURE__*/React__default["default"].forwardRef(
|
|
|
424
426
|
}
|
|
425
427
|
}
|
|
426
428
|
|
|
427
|
-
//
|
|
428
|
-
let
|
|
429
|
-
if (
|
|
430
|
-
|
|
429
|
+
// AILabel always size `mini`
|
|
430
|
+
let normalizedDecorator = /*#__PURE__*/React__default["default"].isValidElement(slug ?? decorator) ? slug ?? decorator : null;
|
|
431
|
+
if (normalizedDecorator && normalizedDecorator['type']?.displayName === 'AILabel') {
|
|
432
|
+
normalizedDecorator = /*#__PURE__*/React__default["default"].cloneElement(normalizedDecorator, {
|
|
431
433
|
size: 'mini'
|
|
432
434
|
});
|
|
433
435
|
}
|
|
@@ -608,7 +610,9 @@ const FilterableMultiSelect = /*#__PURE__*/React__default["default"].forwardRef(
|
|
|
608
610
|
}), /*#__PURE__*/React__default["default"].createElement(ListBoxTrigger["default"], _rollupPluginBabelHelpers["extends"]({}, buttonProps, {
|
|
609
611
|
isOpen: isOpen,
|
|
610
612
|
translateWithId: translateWithId
|
|
611
|
-
}))),
|
|
613
|
+
}))), slug ? normalizedDecorator : decorator ? /*#__PURE__*/React__default["default"].createElement("div", {
|
|
614
|
+
className: `${prefix}--list-box__inner-wrapper--decorator`
|
|
615
|
+
}, normalizedDecorator) : '', /*#__PURE__*/React__default["default"].createElement(index["default"].Menu, menuProps, isOpen ? sortedItems.map((item, index$1) => {
|
|
612
616
|
const isChecked = controlledSelectedItems.filter(selected => isEqual__default["default"](selected, item)).length > 0;
|
|
613
617
|
const itemProps = getItemProps({
|
|
614
618
|
item,
|
|
@@ -670,6 +674,10 @@ FilterableMultiSelect.propTypes = {
|
|
|
670
674
|
* Specify the text that should be read for screen readers to clear selection.
|
|
671
675
|
*/
|
|
672
676
|
clearSelectionText: PropTypes__default["default"].string,
|
|
677
|
+
/**
|
|
678
|
+
* **Experimental**: Provide a decorator component to be rendered inside the `FilterableMultiSelect` component
|
|
679
|
+
*/
|
|
680
|
+
decorator: PropTypes__default["default"].node,
|
|
673
681
|
/**
|
|
674
682
|
* Specify the direction of the multiselect dropdown. Can be either top or bottom.
|
|
675
683
|
*/
|
|
@@ -769,10 +777,7 @@ FilterableMultiSelect.propTypes = {
|
|
|
769
777
|
* Specify the size of the ListBox. Currently supports either `sm`, `md` or `lg` as an option.
|
|
770
778
|
*/
|
|
771
779
|
size: ListBoxPropTypes.ListBoxSize,
|
|
772
|
-
|
|
773
|
-
* **Experimental**: Provide a `Slug` component to be rendered inside the `FilterableMultiSelect` component
|
|
774
|
-
*/
|
|
775
|
-
slug: PropTypes__default["default"].node,
|
|
780
|
+
slug: deprecate["default"](PropTypes__default["default"].node, 'The `slug` prop has been deprecated and will be removed in the next major version. Use the decorator prop instead.'),
|
|
776
781
|
...MultiSelectPropTypes.sortingPropTypes,
|
|
777
782
|
/**
|
|
778
783
|
* Provide text to be used in a `<label>` element that is tied to the
|
|
@@ -33,6 +33,10 @@ export interface MultiSelectProps<ItemType> extends MultiSelectSortingProps<Item
|
|
|
33
33
|
* Specify the text that should be read for screen readers to clear selection.
|
|
34
34
|
*/
|
|
35
35
|
clearSelectionText?: string;
|
|
36
|
+
/**
|
|
37
|
+
* **Experimental**: Provide a `decorator` component to be rendered inside the `MultiSelect` component
|
|
38
|
+
*/
|
|
39
|
+
decorator?: ReactNode;
|
|
36
40
|
/**
|
|
37
41
|
* Specify the direction of the multiselect dropdown. Can be either top or bottom.
|
|
38
42
|
*/
|
|
@@ -143,6 +147,7 @@ export interface MultiSelectProps<ItemType> extends MultiSelectSortingProps<Item
|
|
|
143
147
|
*/
|
|
144
148
|
size?: ListBoxSize;
|
|
145
149
|
/**
|
|
150
|
+
* @deprecated please use decorator instead.
|
|
146
151
|
* **Experimental**: Provide a `Slug` component to be rendered inside the `MultiSelect` component
|
|
147
152
|
*/
|
|
148
153
|
slug?: ReactNode;
|
|
@@ -74,6 +74,7 @@ const MultiSelect = /*#__PURE__*/React__default["default"].forwardRef((_ref, ref
|
|
|
74
74
|
let {
|
|
75
75
|
autoAlign = false,
|
|
76
76
|
className: containerClassName,
|
|
77
|
+
decorator,
|
|
77
78
|
id,
|
|
78
79
|
items,
|
|
79
80
|
itemToElement,
|
|
@@ -273,7 +274,8 @@ const MultiSelect = /*#__PURE__*/React__default["default"].forwardRef((_ref, ref
|
|
|
273
274
|
[`${prefix}--list-box__wrapper--inline--invalid`]: inline && invalid,
|
|
274
275
|
[`${prefix}--list-box__wrapper--fluid--invalid`]: isFluid && invalid,
|
|
275
276
|
[`${prefix}--list-box__wrapper--fluid--focus`]: !isOpen && isFluid && isFocused,
|
|
276
|
-
[`${prefix}--list-box__wrapper--slug`]: slug
|
|
277
|
+
[`${prefix}--list-box__wrapper--slug`]: slug,
|
|
278
|
+
[`${prefix}--list-box__wrapper--decorator`]: decorator
|
|
277
279
|
});
|
|
278
280
|
const titleClasses = cx__default["default"](`${prefix}--label`, {
|
|
279
281
|
[`${prefix}--label--disabled`]: disabled,
|
|
@@ -411,10 +413,10 @@ const MultiSelect = /*#__PURE__*/React__default["default"].forwardRef((_ref, ref
|
|
|
411
413
|
}
|
|
412
414
|
} : {};
|
|
413
415
|
|
|
414
|
-
//
|
|
415
|
-
let
|
|
416
|
-
if (
|
|
417
|
-
|
|
416
|
+
// AILabel always size `mini`
|
|
417
|
+
let normalizedDecorator = /*#__PURE__*/React__default["default"].isValidElement(slug ?? decorator) ? slug ?? decorator : null;
|
|
418
|
+
if (normalizedDecorator && normalizedDecorator['type']?.displayName === 'AILabel') {
|
|
419
|
+
normalizedDecorator = /*#__PURE__*/React__default["default"].cloneElement(normalizedDecorator, {
|
|
418
420
|
size: 'mini'
|
|
419
421
|
});
|
|
420
422
|
}
|
|
@@ -474,7 +476,9 @@ const MultiSelect = /*#__PURE__*/React__default["default"].forwardRef((_ref, ref
|
|
|
474
476
|
}, label), /*#__PURE__*/React__default["default"].createElement(index$1["default"].MenuIcon, {
|
|
475
477
|
isOpen: isOpen,
|
|
476
478
|
translateWithId: translateWithId
|
|
477
|
-
})),
|
|
479
|
+
})), slug ? normalizedDecorator : decorator ? /*#__PURE__*/React__default["default"].createElement("div", {
|
|
480
|
+
className: `${prefix}--list-box__inner-wrapper--decorator`
|
|
481
|
+
}, normalizedDecorator) : ''), /*#__PURE__*/React__default["default"].createElement(index$1["default"].Menu, menuProps, isOpen && sortItems(filteredItems, sortOptions).map((item, index) => {
|
|
478
482
|
const isChecked = selectedItems.filter(selected => isEqual__default["default"](selected, item)).length > 0;
|
|
479
483
|
const isIndeterminate = selectedItems.length !== 0 && item['isSelectAll'] && !isChecked;
|
|
480
484
|
const itemProps = getItemProps({
|
|
@@ -539,6 +543,10 @@ MultiSelect.propTypes = {
|
|
|
539
543
|
* declaring function with `useCallback` to prevent unnecessary re-renders.
|
|
540
544
|
*/
|
|
541
545
|
compareItems: PropTypes__default["default"].func,
|
|
546
|
+
/**
|
|
547
|
+
* **Experimental**: Provide a decorator component to be rendered inside the `MultiSelect` component
|
|
548
|
+
*/
|
|
549
|
+
decorator: PropTypes__default["default"].node,
|
|
542
550
|
/**
|
|
543
551
|
* Specify the direction of the multiselect dropdown. Can be either top or bottom.
|
|
544
552
|
*/
|
|
@@ -646,10 +654,7 @@ MultiSelect.propTypes = {
|
|
|
646
654
|
* Specify the size of the ListBox. Currently supports either `sm`, `md` or `lg` as an option.
|
|
647
655
|
*/
|
|
648
656
|
size: ListBoxPropTypes.ListBoxSize,
|
|
649
|
-
|
|
650
|
-
* **Experimental**: Provide a `Slug` component to be rendered inside the `MultiSelect` component
|
|
651
|
-
*/
|
|
652
|
-
slug: PropTypes__default["default"].node,
|
|
657
|
+
slug: deprecate["default"](PropTypes__default["default"].node, 'The `slug` prop has been deprecated and will be removed in the next major version. Use the decorator prop instead.'),
|
|
653
658
|
/**
|
|
654
659
|
* Provide a method that sorts all options in the control. Overriding this
|
|
655
660
|
* prop means that you also have to handle the sort logic for selected versus
|
|
@@ -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 PropTypes from 'prop-types';
|
|
8
7
|
import React, { ComponentType } from 'react';
|
|
8
|
+
import PropTypes from 'prop-types';
|
|
9
9
|
/**
|
|
10
10
|
* @param {Element} menuBody The menu body with the menu arrow.
|
|
11
11
|
* @param {string} direction The floating menu direction.
|
|
@@ -10,28 +10,28 @@
|
|
|
10
10
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
11
11
|
|
|
12
12
|
var _rollupPluginBabelHelpers = require('../../_virtual/_rollupPluginBabelHelpers.js');
|
|
13
|
-
var
|
|
14
|
-
var PropTypes = require('prop-types');
|
|
13
|
+
var FloatingMenu = require('../../internal/FloatingMenu.js');
|
|
15
14
|
var React = require('react');
|
|
16
|
-
var cx = require('classnames');
|
|
17
15
|
var ClickListener = require('../../internal/ClickListener.js');
|
|
18
|
-
var
|
|
16
|
+
var index = require('../IconButton/index.js');
|
|
19
17
|
var iconsReact = require('@carbon/icons-react');
|
|
20
|
-
var mergeRefs = require('../../tools/mergeRefs.js');
|
|
21
18
|
var usePrefix = require('../../internal/usePrefix.js');
|
|
19
|
+
var PropTypes = require('prop-types');
|
|
20
|
+
var cx = require('classnames');
|
|
22
21
|
var deprecate = require('../../prop-types/deprecate.js');
|
|
23
|
-
var
|
|
24
|
-
var
|
|
22
|
+
var invariant = require('invariant');
|
|
23
|
+
var mergeRefs = require('../../tools/mergeRefs.js');
|
|
25
24
|
var noopFn = require('../../internal/noopFn.js');
|
|
25
|
+
var setupGetInstanceId = require('../../tools/setupGetInstanceId.js');
|
|
26
26
|
var match = require('../../internal/keyboard/match.js');
|
|
27
27
|
var keys = require('../../internal/keyboard/keys.js');
|
|
28
28
|
|
|
29
29
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
30
30
|
|
|
31
|
-
var invariant__default = /*#__PURE__*/_interopDefaultLegacy(invariant);
|
|
32
|
-
var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
|
|
33
31
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
32
|
+
var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
|
|
34
33
|
var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
|
|
34
|
+
var invariant__default = /*#__PURE__*/_interopDefaultLegacy(invariant);
|
|
35
35
|
|
|
36
36
|
const getInstanceId = setupGetInstanceId["default"]();
|
|
37
37
|
const on = function (element) {
|
|
@@ -92,16 +92,6 @@ const getMenuOffset = (menuBody, direction, trigger, flip) => {
|
|
|
92
92
|
top: 0
|
|
93
93
|
};
|
|
94
94
|
}
|
|
95
|
-
case 'left':
|
|
96
|
-
case 'right':
|
|
97
|
-
{
|
|
98
|
-
// TODO: Ensure `trigger` is there for `<OverflowMenu open>`
|
|
99
|
-
const triggerHeight = !trigger ? 0 : trigger.offsetHeight;
|
|
100
|
-
return {
|
|
101
|
-
left: 0,
|
|
102
|
-
top: (!flip ? 1 : -1) * (menuHeight / 2 - triggerHeight / 2)
|
|
103
|
-
};
|
|
104
|
-
}
|
|
105
95
|
}
|
|
106
96
|
};
|
|
107
97
|
class OverflowMenu extends React__default["default"].Component {
|
|
@@ -235,7 +235,7 @@ const Pagination = /*#__PURE__*/React__default["default"].forwardRef(function Pa
|
|
|
235
235
|
}, pageText(page)) : /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement(Select["default"], {
|
|
236
236
|
id: `${prefix}-pagination-select-${inputId}-right`,
|
|
237
237
|
className: `${prefix}--select__page-number`,
|
|
238
|
-
labelText: `Page
|
|
238
|
+
labelText: `Page of ${totalPages} pages`,
|
|
239
239
|
inline: true,
|
|
240
240
|
hideLabel: true,
|
|
241
241
|
onChange: handlePageInputChange,
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import React, { type ForwardedRef, type WeakValidationMap, type ElementType } from 'react';
|
|
8
8
|
import { type PolymorphicProps } from '../../types/common';
|
|
9
|
+
import { type Boundary } from '@floating-ui/react';
|
|
9
10
|
/**
|
|
10
11
|
* Deprecated popover alignment values.
|
|
11
12
|
* @deprecated Use NewPopoverAlignment instead.
|
|
@@ -22,6 +23,10 @@ interface PopoverBaseProps {
|
|
|
22
23
|
* Will auto-align the popover on first render if it is not visible. This prop is currently experimental and is subject to future changes.
|
|
23
24
|
*/
|
|
24
25
|
autoAlign?: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Specify a bounding element to be used for autoAlign calculations. The viewport is used by default. This prop is currently experimental and is subject to future changes.
|
|
28
|
+
*/
|
|
29
|
+
autoAlignBoundary?: Boundary;
|
|
25
30
|
/**
|
|
26
31
|
* Specify whether a caret should be rendered
|
|
27
32
|
*/
|
|
@@ -63,6 +63,7 @@ const Popover = /*#__PURE__*/React__default["default"].forwardRef(function Popov
|
|
|
63
63
|
align: initialAlign = isTabTip ? 'bottom-start' : 'bottom',
|
|
64
64
|
as: BaseComponent = 'span',
|
|
65
65
|
autoAlign = false,
|
|
66
|
+
autoAlignBoundary,
|
|
66
67
|
caret = isTabTip ? false : true,
|
|
67
68
|
className: customClassName,
|
|
68
69
|
children,
|
|
@@ -140,7 +141,8 @@ const Popover = /*#__PURE__*/React__default["default"].forwardRef(function Popov
|
|
|
140
141
|
middleware: [react.offset(!isTabTip ? popoverDimensions?.current?.offset : 0), autoAlign && react.flip({
|
|
141
142
|
fallbackPlacements: align.includes('bottom') ? ['bottom', 'bottom-start', 'bottom-end', 'right', 'right-start', 'right-end', 'left', 'left-start', 'left-end', 'top', 'top-start', 'top-end'] : ['top', 'top-start', 'top-end', 'left', 'left-start', 'left-end', 'right', 'right-start', 'right-end', 'bottom', 'bottom-start', 'bottom-end'],
|
|
142
143
|
fallbackStrategy: 'initialPlacement',
|
|
143
|
-
fallbackAxisSideDirection: 'start'
|
|
144
|
+
fallbackAxisSideDirection: 'start',
|
|
145
|
+
boundary: autoAlignBoundary
|
|
144
146
|
}), react.arrow({
|
|
145
147
|
element: caretRef
|
|
146
148
|
}), autoAlign && floatingUi_dom.hide()],
|
|
@@ -311,6 +313,15 @@ Popover.propTypes = {
|
|
|
311
313
|
* Will auto-align the popover on first render if it is not visible. This prop is currently experimental and is subject to future changes.
|
|
312
314
|
*/
|
|
313
315
|
autoAlign: PropTypes__default["default"].bool,
|
|
316
|
+
/**
|
|
317
|
+
* Specify a bounding element to be used for autoAlign calculations. The viewport is used by default. This prop is currently experimental and is subject to future changes.
|
|
318
|
+
*/
|
|
319
|
+
autoAlignBoundary: PropTypes__default["default"].oneOfType([PropTypes__default["default"].oneOf(['clippingAncestors']), PropTypes__default["default"].elementType, PropTypes__default["default"].arrayOf(PropTypes__default["default"].elementType), PropTypes__default["default"].exact({
|
|
320
|
+
x: PropTypes__default["default"].number.isRequired,
|
|
321
|
+
y: PropTypes__default["default"].number.isRequired,
|
|
322
|
+
width: PropTypes__default["default"].number.isRequired,
|
|
323
|
+
height: PropTypes__default["default"].number.isRequired
|
|
324
|
+
})]),
|
|
314
325
|
/**
|
|
315
326
|
* Specify whether a caret should be rendered
|
|
316
327
|
*/
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import React, { ChangeEventHandler, ComponentPropsWithRef, ReactNode } from 'react';
|
|
8
8
|
type ExcludedAttributes = 'size';
|
|
9
|
-
interface SelectProps extends Omit<ComponentPropsWithRef<'select'>, ExcludedAttributes> {
|
|
9
|
+
export interface SelectProps extends Omit<ComponentPropsWithRef<'select'>, ExcludedAttributes> {
|
|
10
10
|
/**
|
|
11
11
|
* Provide the contents of your Select
|
|
12
12
|
*/
|
|
@@ -15,6 +15,10 @@ interface SelectProps extends Omit<ComponentPropsWithRef<'select'>, ExcludedAttr
|
|
|
15
15
|
* Specify an optional className to be applied to the node containing the label and the select box
|
|
16
16
|
*/
|
|
17
17
|
className?: string;
|
|
18
|
+
/**
|
|
19
|
+
* **Experimental**: Provide a `decorator` component to be rendered inside the `Select` component
|
|
20
|
+
*/
|
|
21
|
+
decorator?: ReactNode;
|
|
18
22
|
/**
|
|
19
23
|
* Optionally provide the default value of the `<select>`
|
|
20
24
|
*/
|
|
@@ -77,6 +81,7 @@ interface SelectProps extends Omit<ComponentPropsWithRef<'select'>, ExcludedAttr
|
|
|
77
81
|
*/
|
|
78
82
|
size?: 'sm' | 'md' | 'lg';
|
|
79
83
|
/**
|
|
84
|
+
* @deprecated please use decorator instead.
|
|
80
85
|
* **Experimental**: Provide a `Slug` component to be rendered inside the `Dropdown` component
|
|
81
86
|
*/
|
|
82
87
|
slug?: ReactNode;
|
|
@@ -32,6 +32,7 @@ var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
|
|
|
32
32
|
const Select = /*#__PURE__*/React__default["default"].forwardRef(function Select(_ref, ref) {
|
|
33
33
|
let {
|
|
34
34
|
className,
|
|
35
|
+
decorator,
|
|
35
36
|
id,
|
|
36
37
|
inline = false,
|
|
37
38
|
labelText = 'Select',
|
|
@@ -70,7 +71,8 @@ const Select = /*#__PURE__*/React__default["default"].forwardRef(function Select
|
|
|
70
71
|
[`${prefix}--select--warning`]: warn,
|
|
71
72
|
[`${prefix}--select--fluid--invalid`]: isFluid && invalid,
|
|
72
73
|
[`${prefix}--select--fluid--focus`]: isFluid && isFocused,
|
|
73
|
-
[`${prefix}--select--slug`]: slug
|
|
74
|
+
[`${prefix}--select--slug`]: slug,
|
|
75
|
+
[`${prefix}--select--decorator`]: decorator
|
|
74
76
|
});
|
|
75
77
|
const labelClasses = cx__default["default"](`${prefix}--label`, {
|
|
76
78
|
[`${prefix}--visually-hidden`]: hideLabel,
|
|
@@ -133,10 +135,10 @@ const Select = /*#__PURE__*/React__default["default"].forwardRef(function Select
|
|
|
133
135
|
}
|
|
134
136
|
};
|
|
135
137
|
|
|
136
|
-
//
|
|
137
|
-
let
|
|
138
|
-
if (
|
|
139
|
-
|
|
138
|
+
// AILabel always size `mini`
|
|
139
|
+
let normalizedDecorator = /*#__PURE__*/React__default["default"].isValidElement(slug ?? decorator) ? slug ?? decorator : null;
|
|
140
|
+
if (normalizedDecorator && normalizedDecorator['type']?.displayName === 'AILabel') {
|
|
141
|
+
normalizedDecorator = /*#__PURE__*/React__default["default"].cloneElement(normalizedDecorator, {
|
|
140
142
|
size: 'mini'
|
|
141
143
|
});
|
|
142
144
|
}
|
|
@@ -177,7 +179,9 @@ const Select = /*#__PURE__*/React__default["default"].forwardRef(function Select
|
|
|
177
179
|
"data-invalid": invalid || null,
|
|
178
180
|
onFocus: handleFocus,
|
|
179
181
|
onBlur: handleFocus
|
|
180
|
-
}, input,
|
|
182
|
+
}, input, slug ? normalizedDecorator : decorator ? /*#__PURE__*/React__default["default"].createElement("div", {
|
|
183
|
+
className: `${prefix}--select__inner-wrapper--decorator`
|
|
184
|
+
}, normalizedDecorator) : '', isFluid && /*#__PURE__*/React__default["default"].createElement("hr", {
|
|
181
185
|
className: `${prefix}--select__divider`
|
|
182
186
|
}), isFluid && error ? error : null), !inline && !isFluid && error ? error : helper));
|
|
183
187
|
});
|
|
@@ -191,6 +195,10 @@ Select.propTypes = {
|
|
|
191
195
|
* Specify an optional className to be applied to the node containing the label and the select box
|
|
192
196
|
*/
|
|
193
197
|
className: PropTypes__default["default"].string,
|
|
198
|
+
/**
|
|
199
|
+
* **Experimental**: Provide a decorator component to be rendered inside the `Select` component
|
|
200
|
+
*/
|
|
201
|
+
decorator: PropTypes__default["default"].node,
|
|
194
202
|
/**
|
|
195
203
|
* Optionally provide the default value of the `<select>`
|
|
196
204
|
*/
|
|
@@ -251,10 +259,7 @@ Select.propTypes = {
|
|
|
251
259
|
* Specify the size of the Select Input.
|
|
252
260
|
*/
|
|
253
261
|
size: PropTypes__default["default"].oneOf(['sm', 'md', 'lg']),
|
|
254
|
-
|
|
255
|
-
* **Experimental**: Provide a `Slug` component to be rendered inside the `Select` component
|
|
256
|
-
*/
|
|
257
|
-
slug: PropTypes__default["default"].node,
|
|
262
|
+
slug: deprecate["default"](PropTypes__default["default"].node, 'The `slug` prop has been deprecated and will be removed in the next major version. Use the decorator prop instead.'),
|
|
258
263
|
/**
|
|
259
264
|
* Specify whether the control is currently in warning state
|
|
260
265
|
*/
|
|
@@ -131,7 +131,7 @@ export interface SelectableTileProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
131
131
|
* The value of the `<input>`.
|
|
132
132
|
* @deprecated
|
|
133
133
|
*/
|
|
134
|
-
value
|
|
134
|
+
value?: string | number;
|
|
135
135
|
}
|
|
136
136
|
export declare const SelectableTile: React.ForwardRefExoticComponent<SelectableTileProps & React.RefAttributes<HTMLDivElement>>;
|
|
137
137
|
export interface ExpandableTileProps extends HTMLAttributes<HTMLDivElement> {
|
|
@@ -48,7 +48,7 @@ const Switcher = /*#__PURE__*/React.forwardRef(function Switcher(props, forwardR
|
|
|
48
48
|
direction
|
|
49
49
|
} = _ref;
|
|
50
50
|
const enabledIndices = React__default["default"].Children.toArray(children).reduce((acc, curr, i) => {
|
|
51
|
-
if (Object.keys(curr.props).length !== 0) {
|
|
51
|
+
if (/*#__PURE__*/React__default["default"].isValidElement(curr) && Object.keys(curr.props).length !== 0 && getDisplayName["default"](curr.type) === 'SwitcherItem') {
|
|
52
52
|
acc.push(i);
|
|
53
53
|
}
|
|
54
54
|
return acc;
|
|
@@ -60,7 +60,11 @@ const Switcher = /*#__PURE__*/React.forwardRef(function Switcher(props, forwardR
|
|
|
60
60
|
if (direction === -1) {
|
|
61
61
|
return enabledIndices[enabledIndices.length - 1];
|
|
62
62
|
}
|
|
63
|
-
return 0;
|
|
63
|
+
return enabledIndices[0];
|
|
64
|
+
case 0:
|
|
65
|
+
if (direction === 1) {
|
|
66
|
+
return enabledIndices[1];
|
|
67
|
+
}
|
|
64
68
|
default:
|
|
65
69
|
return enabledIndices[nextIndex];
|
|
66
70
|
}
|
|
@@ -72,7 +76,7 @@ const Switcher = /*#__PURE__*/React.forwardRef(function Switcher(props, forwardR
|
|
|
72
76
|
};
|
|
73
77
|
const childrenWithProps = React__default["default"].Children.toArray(children).map((child, index) => {
|
|
74
78
|
// only setup click handlers if onChange event is passed
|
|
75
|
-
if (/*#__PURE__*/React__default["default"].isValidElement(child) && child.type && getDisplayName["default"](child.type) === '
|
|
79
|
+
if (/*#__PURE__*/React__default["default"].isValidElement(child) && child.type && getDisplayName["default"](child.type) === 'SwitcherItem') {
|
|
76
80
|
return /*#__PURE__*/React__default["default"].cloneElement(child, {
|
|
77
81
|
handleSwitcherItemFocus,
|
|
78
82
|
index,
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@carbon/react",
|
|
3
3
|
"description": "React components for the Carbon Design System",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.72.0",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "lib/index.js",
|
|
7
7
|
"module": "es/index.js",
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"@carbon/feature-flags": "^0.24.0",
|
|
53
53
|
"@carbon/icons-react": "^11.53.0",
|
|
54
54
|
"@carbon/layout": "^11.28.0",
|
|
55
|
-
"@carbon/styles": "^1.
|
|
55
|
+
"@carbon/styles": "^1.71.0",
|
|
56
56
|
"@floating-ui/react": "^0.26.0",
|
|
57
57
|
"@ibm/telemetry-js": "^1.5.0",
|
|
58
58
|
"classnames": "2.5.1",
|
|
@@ -81,23 +81,23 @@
|
|
|
81
81
|
"@babel/preset-typescript": "^7.24.7",
|
|
82
82
|
"@carbon/test-utils": "^10.34.0",
|
|
83
83
|
"@carbon/themes": "^11.43.0",
|
|
84
|
-
"@figma/code-connect": "^1.2.
|
|
84
|
+
"@figma/code-connect": "^1.2.2",
|
|
85
85
|
"@rollup/plugin-babel": "^6.0.0",
|
|
86
86
|
"@rollup/plugin-commonjs": "^28.0.0",
|
|
87
87
|
"@rollup/plugin-node-resolve": "^15.0.0",
|
|
88
88
|
"@rollup/plugin-typescript": "^11.0.0",
|
|
89
|
-
"@storybook/addon-a11y": "^8.
|
|
90
|
-
"@storybook/addon-actions": "^8.
|
|
91
|
-
"@storybook/addon-docs": "^8.
|
|
92
|
-
"@storybook/addon-essentials": "^8.
|
|
89
|
+
"@storybook/addon-a11y": "^8.4.5",
|
|
90
|
+
"@storybook/addon-actions": "^8.4.5",
|
|
91
|
+
"@storybook/addon-docs": "^8.4.5",
|
|
92
|
+
"@storybook/addon-essentials": "^8.4.5",
|
|
93
93
|
"@storybook/addon-links": "^8.1.10",
|
|
94
|
-
"@storybook/addon-storysource": "^8.
|
|
94
|
+
"@storybook/addon-storysource": "^8.4.5",
|
|
95
95
|
"@storybook/addon-webpack5-compiler-babel": "^3.0.3",
|
|
96
|
-
"@storybook/blocks": "^8.
|
|
97
|
-
"@storybook/manager-api": "^8.
|
|
98
|
-
"@storybook/react": "^8.
|
|
99
|
-
"@storybook/react-webpack5": "^8.
|
|
100
|
-
"@storybook/theming": "^8.
|
|
96
|
+
"@storybook/blocks": "^8.4.5",
|
|
97
|
+
"@storybook/manager-api": "^8.4.5",
|
|
98
|
+
"@storybook/react": "^8.4.5",
|
|
99
|
+
"@storybook/react-webpack5": "^8.4.5",
|
|
100
|
+
"@storybook/theming": "^8.4.5",
|
|
101
101
|
"@types/react-is": "~18.3.0",
|
|
102
102
|
"autoprefixer": "^10.4.0",
|
|
103
103
|
"babel-loader": "^9.0.0",
|
|
@@ -126,7 +126,7 @@
|
|
|
126
126
|
"rollup-plugin-strip-banner": "^3.0.0",
|
|
127
127
|
"sass": "^1.77.7",
|
|
128
128
|
"sass-loader": "^16.0.0",
|
|
129
|
-
"storybook": "^8.
|
|
129
|
+
"storybook": "^8.4.5",
|
|
130
130
|
"storybook-addon-accessibility-checker": "^3.1.61-rc.3",
|
|
131
131
|
"stream-browserify": "^3.0.0",
|
|
132
132
|
"style-loader": "^4.0.0",
|
|
@@ -145,5 +145,5 @@
|
|
|
145
145
|
"**/*.scss",
|
|
146
146
|
"**/*.css"
|
|
147
147
|
],
|
|
148
|
-
"gitHead": "
|
|
148
|
+
"gitHead": "4e89908b4bbb6b1c34543cb56f551f242a27d609"
|
|
149
149
|
}
|