carbon-react 114.13.1 → 114.14.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/esm/__internal__/input-icon-toggle/input-icon-toggle.component.js +2 -1
- package/esm/components/link/link.component.d.ts +2 -0
- package/esm/components/link/link.component.js +7 -1
- package/esm/components/menu/__internal__/keyboard-navigation/index.d.ts +4 -2
- package/esm/components/menu/__internal__/keyboard-navigation/index.js +16 -15
- package/esm/components/menu/__internal__/locators.d.ts +6 -0
- package/esm/components/menu/__internal__/locators.js +6 -0
- package/esm/components/menu/__internal__/submenu/submenu.component.js +109 -108
- package/esm/components/menu/menu-full-screen/menu-full-screen.component.js +1 -2
- package/esm/components/menu/menu-item/index.js +0 -1
- package/esm/components/menu/menu-item/menu-item.component.js +77 -51
- package/esm/components/menu/menu-item/menu-item.d.ts +7 -3
- package/esm/components/menu/menu.component.js +33 -37
- package/esm/components/menu/menu.context.d.ts +2 -2
- package/esm/components/menu/menu.context.js +2 -2
- package/esm/components/menu/scrollable-block/scrollable-block.component.js +6 -24
- package/esm/components/select/filterable-select/filterable-select.component.js +15 -2
- package/esm/components/select/filterable-select/filterable-select.d.ts +7 -0
- package/esm/components/select/list-action-button/list-action-button.style.js +4 -1
- package/esm/components/select/multi-select/multi-select.component.js +15 -2
- package/esm/components/select/multi-select/multi-select.d.ts +7 -0
- package/esm/components/select/option/option.component.js +16 -5
- package/esm/components/select/option/option.style.js +4 -0
- package/esm/components/select/option-group-header/option-group-header.component.js +20 -8
- package/esm/components/select/option-group-header/option-group-header.style.js +3 -2
- package/esm/components/select/option-row/option-row.component.js +16 -5
- package/esm/components/select/option-row/option-row.style.js +4 -0
- package/esm/components/select/select-list/select-list-container.style.js +11 -1
- package/esm/components/select/select-list/select-list.component.js +136 -62
- package/esm/components/select/select-list/select-list.style.js +15 -18
- package/esm/components/select/simple-select/simple-select.component.js +15 -2
- package/esm/components/select/simple-select/simple-select.d.ts +7 -0
- package/lib/__internal__/input-icon-toggle/input-icon-toggle.component.js +2 -1
- package/lib/components/link/link.component.d.ts +2 -0
- package/lib/components/link/link.component.js +7 -1
- package/lib/components/menu/__internal__/keyboard-navigation/index.d.ts +4 -2
- package/lib/components/menu/__internal__/keyboard-navigation/index.js +16 -15
- package/lib/components/menu/__internal__/locators.d.ts +6 -0
- package/lib/components/menu/__internal__/locators.js +18 -0
- package/lib/components/menu/__internal__/submenu/submenu.component.js +111 -113
- package/lib/components/menu/menu-full-screen/menu-full-screen.component.js +1 -2
- package/lib/components/menu/menu-item/menu-item.component.js +76 -52
- package/lib/components/menu/menu-item/menu-item.d.ts +7 -3
- package/lib/components/menu/menu.component.js +33 -37
- package/lib/components/menu/menu.context.d.ts +2 -2
- package/lib/components/menu/menu.context.js +2 -2
- package/lib/components/menu/scrollable-block/scrollable-block.component.js +6 -25
- package/lib/components/select/filterable-select/filterable-select.component.js +15 -2
- package/lib/components/select/filterable-select/filterable-select.d.ts +7 -0
- package/lib/components/select/list-action-button/list-action-button.style.js +4 -1
- package/lib/components/select/multi-select/multi-select.component.js +15 -2
- package/lib/components/select/multi-select/multi-select.d.ts +7 -0
- package/lib/components/select/option/option.component.js +16 -5
- package/lib/components/select/option/option.style.js +4 -0
- package/lib/components/select/option-group-header/option-group-header.component.js +20 -6
- package/lib/components/select/option-group-header/option-group-header.style.js +3 -2
- package/lib/components/select/option-row/option-row.component.js +16 -5
- package/lib/components/select/option-row/option-row.style.js +4 -0
- package/lib/components/select/select-list/select-list-container.style.js +11 -1
- package/lib/components/select/select-list/select-list.component.js +139 -63
- package/lib/components/select/select-list/select-list.style.js +15 -18
- package/lib/components/select/simple-select/simple-select.component.js +15 -2
- package/lib/components/select/simple-select/simple-select.d.ts +7 -0
- package/package.json +2 -1
- package/esm/components/select/select-list/update-list-scroll.js +0 -21
- package/lib/components/select/select-list/update-list-scroll.js +0 -28
|
@@ -19,11 +19,11 @@ var _propTypes2 = _interopRequireDefault(require("@styled-system/prop-types"));
|
|
|
19
19
|
|
|
20
20
|
var _menu = require("./menu.style");
|
|
21
21
|
|
|
22
|
-
var
|
|
22
|
+
var _menu2 = _interopRequireDefault(require("./menu.context"));
|
|
23
23
|
|
|
24
|
-
var
|
|
24
|
+
var _keyboardNavigation = require("./__internal__/keyboard-navigation");
|
|
25
25
|
|
|
26
|
-
var
|
|
26
|
+
var _locators = require("./__internal__/locators");
|
|
27
27
|
|
|
28
28
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
29
29
|
|
|
@@ -38,52 +38,48 @@ const Menu = ({
|
|
|
38
38
|
children,
|
|
39
39
|
...rest
|
|
40
40
|
}) => {
|
|
41
|
-
const [
|
|
42
|
-
const [openSubmenuIndex, setOpenSubmenuIndex] = (0, _react.useState)(null);
|
|
41
|
+
const [openSubmenuId, setOpenSubmenuId] = (0, _react.useState)(null);
|
|
43
42
|
const ref = (0, _react.useRef)();
|
|
44
|
-
const
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
43
|
+
const [focusId, setFocusId] = (0, _react.useState)(undefined);
|
|
44
|
+
const [itemIds, setItemIds] = (0, _react.useState)([]);
|
|
45
|
+
const registerItem = (0, _react.useCallback)(id => {
|
|
46
|
+
setItemIds(prevState => {
|
|
47
|
+
return [...prevState, id];
|
|
48
|
+
});
|
|
49
|
+
}, []);
|
|
50
|
+
const unregisterItem = (0, _react.useCallback)(id => {
|
|
51
|
+
setItemIds(prevState => {
|
|
52
|
+
return prevState.filter(itemId => itemId !== id);
|
|
53
|
+
});
|
|
54
54
|
}, []);
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
55
|
+
|
|
56
|
+
const handleKeyDown = event => {
|
|
57
|
+
/* istanbul ignore else */
|
|
58
|
+
if (ref.current) {
|
|
59
|
+
const focusableItems = Array.from(ref.current.querySelectorAll(_locators.MENU_ITEM_CHILDREN_LOCATOR));
|
|
60
|
+
const newIndex = (0, _keyboardNavigation.menuKeyboardNavigation)(event, focusableItems);
|
|
61
|
+
setFocusId(itemIds[newIndex]);
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
|
|
61
65
|
return /*#__PURE__*/_react.default.createElement(_menu.StyledMenuWrapper, _extends({
|
|
62
66
|
"data-component": "menu",
|
|
63
67
|
menuType: menuType
|
|
64
68
|
}, rest, {
|
|
65
69
|
ref: ref,
|
|
66
|
-
role: "list"
|
|
70
|
+
role: "list",
|
|
71
|
+
onKeyDown: handleKeyDown
|
|
67
72
|
}), /*#__PURE__*/_react.default.createElement(_menu2.default.Provider, {
|
|
68
73
|
value: {
|
|
69
74
|
menuType,
|
|
70
|
-
handleKeyDown,
|
|
71
75
|
inMenu: true,
|
|
72
|
-
|
|
73
|
-
|
|
76
|
+
openSubmenuId,
|
|
77
|
+
setOpenSubmenuId,
|
|
78
|
+
focusId,
|
|
79
|
+
registerItem,
|
|
80
|
+
unregisterItem
|
|
74
81
|
}
|
|
75
|
-
},
|
|
76
|
-
const isFocused = focusedItemIndex === index;
|
|
77
|
-
|
|
78
|
-
if ( /*#__PURE__*/_react.default.isValidElement(child) && child.type.displayName === "MenuItem" && child.props.submenu) {
|
|
79
|
-
return /*#__PURE__*/_react.default.cloneElement(child, {
|
|
80
|
-
isFocused,
|
|
81
|
-
indexInMenu: index
|
|
82
|
-
});
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
return child;
|
|
86
|
-
})));
|
|
82
|
+
}, children));
|
|
87
83
|
};
|
|
88
84
|
|
|
89
85
|
Menu.propTypes = {
|
|
@@ -12,8 +12,8 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
12
12
|
var _default = /*#__PURE__*/_react.default.createContext({
|
|
13
13
|
menuType: "light",
|
|
14
14
|
inMenu: false,
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
openSubmenuId: null,
|
|
16
|
+
setOpenSubmenuId:
|
|
17
17
|
/* istanbul ignore next */
|
|
18
18
|
() => {}
|
|
19
19
|
});
|
|
@@ -13,8 +13,6 @@ var _menu = _interopRequireDefault(require("../menu.context"));
|
|
|
13
13
|
|
|
14
14
|
var _menuItem = _interopRequireDefault(require("../menu-item"));
|
|
15
15
|
|
|
16
|
-
var _submenu = _interopRequireDefault(require("../__internal__/submenu/submenu.context"));
|
|
17
|
-
|
|
18
16
|
var _scrollableBlock = _interopRequireDefault(require("./scrollable-block.style"));
|
|
19
17
|
|
|
20
18
|
var _box = _interopRequireDefault(require("../../box"));
|
|
@@ -35,13 +33,9 @@ const ScrollableBlock = ({
|
|
|
35
33
|
parentVariant,
|
|
36
34
|
...rest
|
|
37
35
|
}) => {
|
|
38
|
-
const menuContext = (0, _react.useContext)(_menu.default);
|
|
39
|
-
const submenuContext = (0, _react.useContext)(_submenu.default);
|
|
40
36
|
const {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
handleKeyDown
|
|
44
|
-
} = submenuContext;
|
|
37
|
+
menuType
|
|
38
|
+
} = (0, _react.useContext)(_menu.default);
|
|
45
39
|
const scrollVariants = {
|
|
46
40
|
light: "light",
|
|
47
41
|
dark: "dark",
|
|
@@ -50,35 +44,22 @@ const ScrollableBlock = ({
|
|
|
50
44
|
};
|
|
51
45
|
return /*#__PURE__*/_react.default.createElement(_scrollableBlock.default, _extends({
|
|
52
46
|
"data-component": "submenu-scrollable-block",
|
|
53
|
-
menuType:
|
|
47
|
+
menuType: menuType,
|
|
54
48
|
variant: variant
|
|
55
49
|
}, rest), parent && /*#__PURE__*/_react.default.createElement(_menuItem.default, {
|
|
50
|
+
"data-component": "scrollable-block-parent",
|
|
56
51
|
overrideColor: true,
|
|
57
52
|
variant: parentVariant,
|
|
58
53
|
as: "div",
|
|
59
54
|
href: "#"
|
|
60
55
|
}, parent), /*#__PURE__*/_react.default.createElement(_box.default, {
|
|
61
56
|
overflowY: "scroll",
|
|
62
|
-
scrollVariant: scrollVariants[
|
|
57
|
+
scrollVariant: scrollVariants[menuType],
|
|
63
58
|
height: height,
|
|
64
59
|
p: 0,
|
|
65
60
|
as: "ul",
|
|
66
61
|
role: "list"
|
|
67
|
-
},
|
|
68
|
-
let isFocused = false;
|
|
69
|
-
const blockItemFocused = focusIndex >= blockIndex;
|
|
70
|
-
|
|
71
|
-
if (blockItemFocused) {
|
|
72
|
-
isFocused = focusIndex - blockIndex === index;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
return /*#__PURE__*/_react.default.createElement(_submenu.default.Provider, {
|
|
76
|
-
value: {
|
|
77
|
-
isFocused,
|
|
78
|
-
handleKeyDown
|
|
79
|
-
}
|
|
80
|
-
}, child);
|
|
81
|
-
})));
|
|
62
|
+
}, children));
|
|
82
63
|
};
|
|
83
64
|
|
|
84
65
|
ScrollableBlock.propTypes = {
|
|
@@ -73,6 +73,8 @@ const FilterableSelect = /*#__PURE__*/_react.default.forwardRef(({
|
|
|
73
73
|
listPlacement = "bottom",
|
|
74
74
|
flipEnabled = true,
|
|
75
75
|
inputRef,
|
|
76
|
+
enableVirtualScroll,
|
|
77
|
+
virtualScrollOverscan,
|
|
76
78
|
...textboxProps
|
|
77
79
|
}, ref) => {
|
|
78
80
|
const [activeDescendantId, setActiveDescendantId] = (0, _react.useState)();
|
|
@@ -455,7 +457,9 @@ const FilterableSelect = /*#__PURE__*/_react.default.forwardRef(({
|
|
|
455
457
|
loaderDataRole: "filterable-select-list-loader",
|
|
456
458
|
listPlacement: listPlacement,
|
|
457
459
|
flipEnabled: flipEnabled,
|
|
458
|
-
isOpen: isOpen
|
|
460
|
+
isOpen: isOpen,
|
|
461
|
+
enableVirtualScroll: enableVirtualScroll,
|
|
462
|
+
virtualScrollOverscan: virtualScrollOverscan
|
|
459
463
|
}, children);
|
|
460
464
|
|
|
461
465
|
return /*#__PURE__*/_react.default.createElement(_select.default, _extends({
|
|
@@ -543,7 +547,16 @@ FilterableSelect.propTypes = { ..._selectTextbox.formInputPropTypes,
|
|
|
543
547
|
listPlacement: _propTypes.default.oneOf(["top", "bottom", "right", "left"]),
|
|
544
548
|
|
|
545
549
|
/** Use the opposite list placement if the set placement does not fit */
|
|
546
|
-
flipEnabled: _propTypes.default.bool
|
|
550
|
+
flipEnabled: _propTypes.default.bool,
|
|
551
|
+
|
|
552
|
+
/** Set this prop to enable a virtualised list of options. If it is not used then all options will be in the
|
|
553
|
+
* DOM at all times, which may cause performance problems on very large lists */
|
|
554
|
+
enableVirtualScroll: _propTypes.default.bool,
|
|
555
|
+
|
|
556
|
+
/** The number of options to render into the DOM at once, either side of the currently-visible ones.
|
|
557
|
+
* Higher values make for smoother scrolling but may impact performance.
|
|
558
|
+
* Only used if the `enableVirtualScroll` prop is set. */
|
|
559
|
+
virtualScrollOverscan: _propTypes.default.number
|
|
547
560
|
};
|
|
548
561
|
FilterableSelect.defaultProps = {
|
|
549
562
|
"data-component": "filterable-select"
|
|
@@ -51,6 +51,13 @@ export interface FilterableSelectProps
|
|
|
51
51
|
listPlacement?: Side;
|
|
52
52
|
/** Use the opposite list placement if the set placement does not fit */
|
|
53
53
|
flipEnabled?: boolean;
|
|
54
|
+
/** Set this prop to enable a virtualised list of options. If it is not used then all options will be in the
|
|
55
|
+
* DOM at all times, which may cause performance problems on very large lists */
|
|
56
|
+
enableVirtualScroll?: boolean;
|
|
57
|
+
/** The number of options to render into the DOM at once, either side of the currently-visible ones.
|
|
58
|
+
* Higher values make for smoother scrolling but may impact performance.
|
|
59
|
+
* Only used if the `enableVirtualScroll` prop is set. */
|
|
60
|
+
virtualScrollOverscan?: number;
|
|
54
61
|
}
|
|
55
62
|
|
|
56
63
|
declare function FilterableSelect(
|
|
@@ -16,13 +16,16 @@ const StyledListActionButtonWrapper = _styledComponents.default.div`
|
|
|
16
16
|
padding-bottom: var(--spacing100);
|
|
17
17
|
border-top: 1px solid var(--colorsUtilityDisabled600);
|
|
18
18
|
box-shadow: 0 0px 0 0 rgba(0, 0, 0, 0), 0 -8px 8px 0 rgba(0, 0, 0, 0.03);
|
|
19
|
+
width: 100%;
|
|
20
|
+
position: sticky;
|
|
21
|
+
bottom: 0;
|
|
22
|
+
background-color: inherit;
|
|
19
23
|
|
|
20
24
|
${_button.default} {
|
|
21
25
|
border: none;
|
|
22
26
|
justify-content: left;
|
|
23
27
|
padding-left: var(--spacing200);
|
|
24
28
|
padding-right: var(--spacing200);
|
|
25
|
-
width: 100%;
|
|
26
29
|
}
|
|
27
30
|
`;
|
|
28
31
|
var _default = StyledListActionButtonWrapper;
|
|
@@ -76,6 +76,8 @@ const MultiSelect = /*#__PURE__*/_react.default.forwardRef(({
|
|
|
76
76
|
flipEnabled = true,
|
|
77
77
|
wrapPillText = true,
|
|
78
78
|
inputRef,
|
|
79
|
+
enableVirtualScroll,
|
|
80
|
+
virtualScrollOverscan,
|
|
79
81
|
...textboxProps
|
|
80
82
|
}, ref) => {
|
|
81
83
|
const [activeDescendantId, setActiveDescendantId] = (0, _react.useState)();
|
|
@@ -468,7 +470,9 @@ const MultiSelect = /*#__PURE__*/_react.default.forwardRef(({
|
|
|
468
470
|
flipEnabled: flipEnabled,
|
|
469
471
|
loaderDataRole: "multi-select-list-loader",
|
|
470
472
|
multiselectValues: actualValue,
|
|
471
|
-
isOpen: isOpen
|
|
473
|
+
isOpen: isOpen,
|
|
474
|
+
enableVirtualScroll: enableVirtualScroll,
|
|
475
|
+
virtualScrollOverscan: virtualScrollOverscan
|
|
472
476
|
}, children);
|
|
473
477
|
|
|
474
478
|
return /*#__PURE__*/_react.default.createElement(_multiSelect.StyledSelectMultiSelect, _extends({
|
|
@@ -555,7 +559,16 @@ MultiSelect.propTypes = { ..._selectTextbox.formInputPropTypes,
|
|
|
555
559
|
flipEnabled: _propTypes.default.bool,
|
|
556
560
|
|
|
557
561
|
/** Wraps the pill text when it would overflow the input width */
|
|
558
|
-
wrapPillText: _propTypes.default.bool
|
|
562
|
+
wrapPillText: _propTypes.default.bool,
|
|
563
|
+
|
|
564
|
+
/** Set this prop to enable a virtualised list of options. If it is not used then all options will be in the
|
|
565
|
+
* DOM at all times, which may cause performance problems on very large lists */
|
|
566
|
+
enableVirtualScroll: _propTypes.default.bool,
|
|
567
|
+
|
|
568
|
+
/** The number of options to render into the DOM at once, either side of the currently-visible ones.
|
|
569
|
+
* Higher values make for smoother scrolling but may impact performance.
|
|
570
|
+
* Only used if the `enableVirtualScroll` prop is set. */
|
|
571
|
+
virtualScrollOverscan: _propTypes.default.number
|
|
559
572
|
};
|
|
560
573
|
MultiSelect.defaultProps = {
|
|
561
574
|
"data-component": "multiselect"
|
|
@@ -48,6 +48,13 @@ export interface MultiSelectProps
|
|
|
48
48
|
flipEnabled?: boolean;
|
|
49
49
|
/** Wraps the pill text when it would overflow the input width */
|
|
50
50
|
wrapPillText?: boolean;
|
|
51
|
+
/** Set this prop to enable a virtualised list of options. If it is not used then all options will be in the
|
|
52
|
+
* DOM at all times, which may cause performance problems on very large lists */
|
|
53
|
+
enableVirtualScroll?: boolean;
|
|
54
|
+
/** The number of options to render into the DOM at once, either side of the currently-visible ones.
|
|
55
|
+
* Higher values make for smoother scrolling but may impact performance.
|
|
56
|
+
* Only used if the `enableVirtualScroll` prop is set. */
|
|
57
|
+
virtualScrollOverscan?: number;
|
|
51
58
|
}
|
|
52
59
|
|
|
53
60
|
declare function MultiSelect(
|
|
@@ -19,6 +19,8 @@ function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return
|
|
|
19
19
|
|
|
20
20
|
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
21
21
|
|
|
22
|
+
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
23
|
+
|
|
22
24
|
const Option = /*#__PURE__*/_react.default.forwardRef(({
|
|
23
25
|
text,
|
|
24
26
|
children,
|
|
@@ -27,7 +29,9 @@ const Option = /*#__PURE__*/_react.default.forwardRef(({
|
|
|
27
29
|
id,
|
|
28
30
|
index,
|
|
29
31
|
hidden,
|
|
30
|
-
onClick
|
|
32
|
+
onClick,
|
|
33
|
+
style,
|
|
34
|
+
...rest
|
|
31
35
|
}, ref) => {
|
|
32
36
|
const selectListContext = (0, _react.useContext)(_selectListContext.default);
|
|
33
37
|
let isSelected = selectListContext.currentOptionsListIndex === index;
|
|
@@ -55,7 +59,7 @@ const Option = /*#__PURE__*/_react.default.forwardRef(({
|
|
|
55
59
|
}
|
|
56
60
|
}
|
|
57
61
|
|
|
58
|
-
return /*#__PURE__*/_react.default.createElement(_option.default, {
|
|
62
|
+
return /*#__PURE__*/_react.default.createElement(_option.default, _extends({
|
|
59
63
|
id: id,
|
|
60
64
|
ref: ref,
|
|
61
65
|
"aria-selected": isSelected,
|
|
@@ -63,8 +67,9 @@ const Option = /*#__PURE__*/_react.default.forwardRef(({
|
|
|
63
67
|
onClick: handleClick,
|
|
64
68
|
isHighlighted: selectListContext.currentOptionsListIndex === index,
|
|
65
69
|
role: "option",
|
|
66
|
-
hidden: hidden
|
|
67
|
-
|
|
70
|
+
hidden: hidden,
|
|
71
|
+
style: style
|
|
72
|
+
}, rest), children || text);
|
|
68
73
|
});
|
|
69
74
|
|
|
70
75
|
Option.propTypes = {
|
|
@@ -114,7 +119,13 @@ Option.propTypes = {
|
|
|
114
119
|
|
|
115
120
|
/** MultiSelect only - fill Pill background with color */
|
|
116
121
|
// eslint-disable-next-line react/no-unused-prop-types
|
|
117
|
-
fill: _propTypes.default.bool
|
|
122
|
+
fill: _propTypes.default.bool,
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* @private
|
|
126
|
+
* @ignore
|
|
127
|
+
* object containing CSS styles to be passed to the underlying list-item */
|
|
128
|
+
style: _propTypes.default.object
|
|
118
129
|
};
|
|
119
130
|
var _default = Option;
|
|
120
131
|
exports.default = _default;
|
|
@@ -15,14 +15,22 @@ var _icon = _interopRequireDefault(require("../../icon"));
|
|
|
15
15
|
|
|
16
16
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
19
|
+
|
|
20
|
+
const OptionGroupHeader = /*#__PURE__*/_react.default.forwardRef(({
|
|
19
21
|
label,
|
|
20
|
-
icon
|
|
21
|
-
|
|
22
|
-
|
|
22
|
+
icon,
|
|
23
|
+
style,
|
|
24
|
+
...rest
|
|
25
|
+
}, ref) => {
|
|
26
|
+
return /*#__PURE__*/_react.default.createElement(_optionGroupHeader.default, _extends({
|
|
27
|
+
style: style
|
|
28
|
+
}, rest, {
|
|
29
|
+
ref: ref
|
|
30
|
+
}), icon && /*#__PURE__*/_react.default.createElement(_icon.default, {
|
|
23
31
|
type: icon
|
|
24
32
|
}), /*#__PURE__*/_react.default.createElement("h4", null, label));
|
|
25
|
-
};
|
|
33
|
+
});
|
|
26
34
|
|
|
27
35
|
OptionGroupHeader.propTypes = {
|
|
28
36
|
/** Heading text */
|
|
@@ -33,7 +41,13 @@ OptionGroupHeader.propTypes = {
|
|
|
33
41
|
*
|
|
34
42
|
* Any valid Carbon icon name
|
|
35
43
|
*/
|
|
36
|
-
icon: _propTypes.default.string
|
|
44
|
+
icon: _propTypes.default.string,
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* @private
|
|
48
|
+
* @ignore
|
|
49
|
+
* object containing CSS styles to be passed to the underlying DOM element */
|
|
50
|
+
style: _propTypes.default.object
|
|
37
51
|
};
|
|
38
52
|
var _default = OptionGroupHeader;
|
|
39
53
|
exports.default = _default;
|
|
@@ -13,9 +13,10 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
13
13
|
|
|
14
14
|
const StyledOptionGroupHeader = _styledComponents.default.div`
|
|
15
15
|
box-sizing: border-box;
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
position: absolute;
|
|
17
|
+
height: 40px;
|
|
18
18
|
padding-left: 16px;
|
|
19
|
+
padding-top: 16px;
|
|
19
20
|
display: flex;
|
|
20
21
|
align-items: center;
|
|
21
22
|
width: 100%;
|
|
@@ -19,6 +19,8 @@ function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return
|
|
|
19
19
|
|
|
20
20
|
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
21
21
|
|
|
22
|
+
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
23
|
+
|
|
22
24
|
const OptionRow = /*#__PURE__*/_react.default.forwardRef(({
|
|
23
25
|
id,
|
|
24
26
|
text,
|
|
@@ -26,7 +28,9 @@ const OptionRow = /*#__PURE__*/_react.default.forwardRef(({
|
|
|
26
28
|
onSelect,
|
|
27
29
|
value,
|
|
28
30
|
index,
|
|
29
|
-
hidden
|
|
31
|
+
hidden,
|
|
32
|
+
style,
|
|
33
|
+
...rest
|
|
30
34
|
}, ref) => {
|
|
31
35
|
const handleClick = () => {
|
|
32
36
|
onSelect({
|
|
@@ -43,7 +47,7 @@ const OptionRow = /*#__PURE__*/_react.default.forwardRef(({
|
|
|
43
47
|
isSelected = selectListContext.multiselectValues.includes(value);
|
|
44
48
|
}
|
|
45
49
|
|
|
46
|
-
return /*#__PURE__*/_react.default.createElement(_optionRow.default, {
|
|
50
|
+
return /*#__PURE__*/_react.default.createElement(_optionRow.default, _extends({
|
|
47
51
|
id: id,
|
|
48
52
|
ref: ref,
|
|
49
53
|
"aria-selected": isSelected,
|
|
@@ -51,8 +55,9 @@ const OptionRow = /*#__PURE__*/_react.default.forwardRef(({
|
|
|
51
55
|
onClick: handleClick,
|
|
52
56
|
isHighlighted: selectListContext.currentOptionsListIndex === index,
|
|
53
57
|
role: "option",
|
|
54
|
-
hidden: hidden
|
|
55
|
-
|
|
58
|
+
hidden: hidden,
|
|
59
|
+
style: style
|
|
60
|
+
}, rest), children);
|
|
56
61
|
});
|
|
57
62
|
|
|
58
63
|
OptionRow.propTypes = {
|
|
@@ -88,7 +93,13 @@ OptionRow.propTypes = {
|
|
|
88
93
|
* @private
|
|
89
94
|
* @ignore
|
|
90
95
|
* True when option should be hidden from the view (prop added by the SelectList component) */
|
|
91
|
-
hidden: _propTypes.default.bool
|
|
96
|
+
hidden: _propTypes.default.bool,
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* @private
|
|
100
|
+
* @ignore
|
|
101
|
+
* object containing CSS styles to be passed to the underlying DOM element */
|
|
102
|
+
style: _propTypes.default.object
|
|
92
103
|
};
|
|
93
104
|
var _default = OptionRow;
|
|
94
105
|
exports.default = _default;
|
|
@@ -14,12 +14,22 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
14
14
|
const StyledSelectListContainer = _styledComponents.default.div`
|
|
15
15
|
background-color: white;
|
|
16
16
|
box-shadow: var(--boxShadow100);
|
|
17
|
-
overflow: hidden;
|
|
18
17
|
animation: fadeIn 250ms ease-out;
|
|
19
18
|
position: absolute;
|
|
20
19
|
z-index: ${({
|
|
21
20
|
theme
|
|
22
21
|
}) => theme.zIndex.popover};
|
|
22
|
+
max-height: ${({
|
|
23
|
+
maxHeight
|
|
24
|
+
}) => `${maxHeight}px`};
|
|
25
|
+
overflow-y: auto;
|
|
26
|
+
display: flex;
|
|
27
|
+
flex-wrap: wrap;
|
|
28
|
+
align-items: flex-start;
|
|
29
|
+
|
|
30
|
+
${({
|
|
31
|
+
isLoading
|
|
32
|
+
}) => isLoading && "min-height: 150px"};
|
|
23
33
|
|
|
24
34
|
@keyframes fadeIn {
|
|
25
35
|
0% {
|