@patternfly/react-core 4.227.8 → 4.228.1
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/CHANGELOG.md +30 -0
- package/dist/esm/components/Menu/MenuItem.d.ts +3 -1
- package/dist/esm/components/Menu/MenuItem.d.ts.map +1 -1
- package/dist/esm/components/Menu/MenuItem.js +7 -5
- package/dist/esm/components/Menu/MenuItem.js.map +1 -1
- package/dist/esm/components/MenuToggle/MenuToggle.d.ts +6 -12
- package/dist/esm/components/MenuToggle/MenuToggle.d.ts.map +1 -1
- package/dist/esm/components/MenuToggle/MenuToggle.js +12 -8
- package/dist/esm/components/MenuToggle/MenuToggle.js.map +1 -1
- package/dist/esm/components/Nav/NavItem.d.ts.map +1 -1
- package/dist/esm/components/Nav/NavItem.js +5 -1
- package/dist/esm/components/Nav/NavItem.js.map +1 -1
- package/dist/esm/components/Tabs/OverflowTab.d.ts +16 -0
- package/dist/esm/components/Tabs/OverflowTab.d.ts.map +1 -0
- package/dist/esm/components/Tabs/OverflowTab.js +74 -0
- package/dist/esm/components/Tabs/OverflowTab.js.map +1 -0
- package/dist/esm/components/Tabs/Tabs.d.ts +12 -0
- package/dist/esm/components/Tabs/Tabs.d.ts.map +1 -1
- package/dist/esm/components/Tabs/Tabs.js +36 -13
- package/dist/esm/components/Tabs/Tabs.js.map +1 -1
- package/dist/esm/components/TextInputGroup/TextInputGroup.d.ts +2 -0
- package/dist/esm/components/TextInputGroup/TextInputGroup.d.ts.map +1 -1
- package/dist/esm/components/TextInputGroup/TextInputGroup.js +2 -2
- package/dist/esm/components/TextInputGroup/TextInputGroup.js.map +1 -1
- package/dist/esm/components/TextInputGroup/TextInputGroupMain.d.ts +1 -1
- package/dist/esm/components/TextInputGroup/TextInputGroupMain.d.ts.map +1 -1
- package/dist/esm/components/TreeView/TreeView.d.ts +2 -0
- package/dist/esm/components/TreeView/TreeView.d.ts.map +1 -1
- package/dist/esm/components/TreeView/TreeView.js +3 -3
- package/dist/esm/components/TreeView/TreeView.js.map +1 -1
- package/dist/esm/components/TreeView/TreeViewListItem.d.ts +2 -0
- package/dist/esm/components/TreeView/TreeViewListItem.d.ts.map +1 -1
- package/dist/esm/components/TreeView/TreeViewListItem.js +23 -14
- package/dist/esm/components/TreeView/TreeViewListItem.js.map +1 -1
- package/dist/js/components/Menu/MenuItem.d.ts +3 -1
- package/dist/js/components/Menu/MenuItem.d.ts.map +1 -1
- package/dist/js/components/Menu/MenuItem.js +7 -5
- package/dist/js/components/Menu/MenuItem.js.map +1 -1
- package/dist/js/components/MenuToggle/MenuToggle.d.ts +6 -12
- package/dist/js/components/MenuToggle/MenuToggle.d.ts.map +1 -1
- package/dist/js/components/MenuToggle/MenuToggle.js +12 -8
- package/dist/js/components/MenuToggle/MenuToggle.js.map +1 -1
- package/dist/js/components/Nav/NavItem.d.ts.map +1 -1
- package/dist/js/components/Nav/NavItem.js +5 -1
- package/dist/js/components/Nav/NavItem.js.map +1 -1
- package/dist/js/components/Tabs/OverflowTab.d.ts +16 -0
- package/dist/js/components/Tabs/OverflowTab.d.ts.map +1 -0
- package/dist/js/components/Tabs/OverflowTab.js +78 -0
- package/dist/js/components/Tabs/OverflowTab.js.map +1 -0
- package/dist/js/components/Tabs/Tabs.d.ts +12 -0
- package/dist/js/components/Tabs/Tabs.d.ts.map +1 -1
- package/dist/js/components/Tabs/Tabs.js +36 -13
- package/dist/js/components/Tabs/Tabs.js.map +1 -1
- package/dist/js/components/TextInputGroup/TextInputGroup.d.ts +2 -0
- package/dist/js/components/TextInputGroup/TextInputGroup.d.ts.map +1 -1
- package/dist/js/components/TextInputGroup/TextInputGroup.js +2 -2
- package/dist/js/components/TextInputGroup/TextInputGroup.js.map +1 -1
- package/dist/js/components/TextInputGroup/TextInputGroupMain.d.ts +1 -1
- package/dist/js/components/TextInputGroup/TextInputGroupMain.d.ts.map +1 -1
- package/dist/js/components/TreeView/TreeView.d.ts +2 -0
- package/dist/js/components/TreeView/TreeView.d.ts.map +1 -1
- package/dist/js/components/TreeView/TreeView.js +3 -3
- package/dist/js/components/TreeView/TreeView.js.map +1 -1
- package/dist/js/components/TreeView/TreeViewListItem.d.ts +2 -0
- package/dist/js/components/TreeView/TreeViewListItem.d.ts.map +1 -1
- package/dist/js/components/TreeView/TreeViewListItem.js +23 -14
- package/dist/js/components/TreeView/TreeViewListItem.js.map +1 -1
- package/dist/styles/base-no-reset.css +9 -0
- package/dist/styles/base.css +9 -0
- package/dist/umd/react-core.css +767 -777
- package/dist/umd/react-core.js +159 -52
- package/dist/umd/react-core.min.css +507 -517
- package/dist/umd/react-core.min.js +5 -5
- package/package.json +6 -6
- package/src/components/Menu/MenuItem.tsx +11 -5
- package/src/components/MenuToggle/MenuToggle.tsx +63 -25
- package/src/components/Nav/NavItem.tsx +6 -0
- package/src/components/Tabs/OverflowTab.tsx +141 -0
- package/src/components/Tabs/Tabs.tsx +72 -25
- package/src/components/Tabs/examples/Tabs.md +6 -1
- package/src/components/Tabs/examples/TabsHorizontalOverflow.tsx +67 -0
- package/src/components/TextInputGroup/TextInputGroup.tsx +9 -1
- package/src/components/TextInputGroup/TextInputGroupMain.tsx +1 -1
- package/src/components/TreeView/TreeView.tsx +5 -0
- package/src/components/TreeView/TreeViewListItem.tsx +31 -17
- package/src/components/TreeView/__tests__/__snapshots__/TreeView.test.tsx.snap +299 -299
- package/src/components/TreeView/examples/TreeView.md +125 -7
- package/src/demos/ComposableMenu/ComposableMenu.md +8 -0
- package/src/demos/ComposableMenu/examples/ComposableTypeaheadSelect.tsx +196 -0
package/dist/umd/react-core.js
CHANGED
|
@@ -15677,7 +15677,7 @@
|
|
|
15677
15677
|
direction: 'right'
|
|
15678
15678
|
});
|
|
15679
15679
|
const MenuItemBase = (_a) => {
|
|
15680
|
-
var { children, className, itemId = null, to, hasCheck = false, isActive = null, isFavorited = null, isLoadButton = false, isLoading = false, flyoutMenu, direction, description = null, onClick = () => { }, component = 'button', isDisabled = false, isExternalLink = false, isSelected = null, icon, actions, onShowFlyout, drilldownMenu, isOnPath, innerRef } = _a, props = __rest$1(_a, ["children", "className", "itemId", "to", "hasCheck", "isActive", "isFavorited", "isLoadButton", "isLoading", "flyoutMenu", "direction", "description", "onClick", "component", "isDisabled", "isExternalLink", "isSelected", "icon", "actions", "onShowFlyout", "drilldownMenu", "isOnPath", "innerRef"]);
|
|
15680
|
+
var { children, className, itemId = null, to, hasCheck = false, isActive = null, isFavorited = null, isLoadButton = false, isLoading = false, flyoutMenu, direction, description = null, onClick = () => { }, component = 'button', isDisabled = false, isExternalLink = false, isSelected = null, isFocused, icon, actions, onShowFlyout, drilldownMenu, isOnPath, innerRef } = _a, props = __rest$1(_a, ["children", "className", "itemId", "to", "hasCheck", "isActive", "isFavorited", "isLoadButton", "isLoading", "flyoutMenu", "direction", "description", "onClick", "component", "isDisabled", "isExternalLink", "isSelected", "isFocused", "icon", "actions", "onShowFlyout", "drilldownMenu", "isOnPath", "innerRef"]);
|
|
15681
15681
|
const { menuId, parentMenu, onSelect, onActionClick, activeItemId, selected, drilldownItemPath, onDrillIn, onDrillOut, flyoutRef, setFlyoutRef, disableHover } = React__namespace.useContext(MenuContext);
|
|
15682
15682
|
let Component = (to ? 'a' : component);
|
|
15683
15683
|
if (hasCheck && !to) {
|
|
@@ -15755,7 +15755,8 @@
|
|
|
15755
15755
|
const handleFlyout = (event) => {
|
|
15756
15756
|
const key = event.key;
|
|
15757
15757
|
const target = event.target;
|
|
15758
|
-
|
|
15758
|
+
const type = event.type;
|
|
15759
|
+
if (key === ' ' || key === 'Enter' || key === 'ArrowRight' || type === 'click') {
|
|
15759
15760
|
event.stopPropagation();
|
|
15760
15761
|
if (!flyoutVisible) {
|
|
15761
15762
|
showFlyout(true);
|
|
@@ -15806,7 +15807,7 @@
|
|
|
15806
15807
|
additionalProps['aria-expanded'] = true;
|
|
15807
15808
|
}
|
|
15808
15809
|
else if (hasFlyout) {
|
|
15809
|
-
additionalProps['aria-haspopup'] =
|
|
15810
|
+
additionalProps['aria-haspopup'] = 'menu';
|
|
15810
15811
|
additionalProps['aria-expanded'] = flyoutVisible;
|
|
15811
15812
|
}
|
|
15812
15813
|
const getAriaCurrent = () => {
|
|
@@ -15843,11 +15844,12 @@
|
|
|
15843
15844
|
setFlyoutRef(null);
|
|
15844
15845
|
}
|
|
15845
15846
|
};
|
|
15846
|
-
return (React__namespace.createElement("li", Object.assign({ className: css(menuStyles.menuListItem, isDisabled && menuStyles.modifiers.disabled, _isOnPath && menuStyles.modifiers.currentPath, isLoadButton && menuStyles.modifiers.load, isLoading && menuStyles.modifiers.loading, className), onMouseOver: onMouseOver }, (flyoutMenu && { onKeyDown: handleFlyout }), { ref: ref, role: !hasCheck ? 'none' : 'menuitem' }, props),
|
|
15847
|
-
React__namespace.createElement(GenerateId, null, randomId => (React__namespace.createElement(Component, Object.assign({ tabIndex: -1, className: css(menuStyles.menuItem, getIsSelected() && !hasCheck && menuStyles.modifiers.selected, className), "aria-current": getAriaCurrent() }, (!hasCheck && { disabled: isDisabled }), (!hasCheck && { role: 'menuitem' }), { ref: innerRef }, (!hasCheck && {
|
|
15847
|
+
return (React__namespace.createElement("li", Object.assign({ className: css(menuStyles.menuListItem, isDisabled && menuStyles.modifiers.disabled, _isOnPath && menuStyles.modifiers.currentPath, isLoadButton && menuStyles.modifiers.load, isLoading && menuStyles.modifiers.loading, isFocused && menuStyles.modifiers.focus, className), onMouseOver: onMouseOver }, (flyoutMenu && { onKeyDown: handleFlyout }), { ref: ref, role: !hasCheck ? 'none' : 'menuitem' }, props),
|
|
15848
|
+
React__namespace.createElement(GenerateId, null, randomId => (React__namespace.createElement(Component, Object.assign({ tabIndex: -1, className: css(menuStyles.menuItem, getIsSelected() && !hasCheck && menuStyles.modifiers.selected, className), "aria-current": getAriaCurrent() }, (!hasCheck && { disabled: isDisabled }), (!hasCheck && !flyoutMenu && { role: 'menuitem' }), { ref: innerRef }, (!hasCheck && {
|
|
15848
15849
|
onClick: (event) => {
|
|
15849
15850
|
onItemSelect(event, onSelect);
|
|
15850
15851
|
_drill && _drill();
|
|
15852
|
+
flyoutMenu && handleFlyout(event);
|
|
15851
15853
|
}
|
|
15852
15854
|
}), (hasCheck && { htmlFor: randomId }), additionalProps),
|
|
15853
15855
|
React__namespace.createElement("span", { className: css(menuStyles.menuItemMain) },
|
|
@@ -15936,19 +15938,23 @@
|
|
|
15936
15938
|
this.displayName = 'MenuToggleBase';
|
|
15937
15939
|
}
|
|
15938
15940
|
render() {
|
|
15939
|
-
const _a = this.props, { children, className, icon, badge, isExpanded, isDisabled, isFullHeight, isFullWidth, variant, innerRef } = _a,
|
|
15941
|
+
const _a = this.props, { children, className, icon, badge, isExpanded, isDisabled, isFullHeight, isFullWidth, variant, innerRef, onClick, 'aria-label': ariaLabel } = _a, otherProps = __rest$1(_a, ["children", "className", "icon", "badge", "isExpanded", "isDisabled", "isFullHeight", "isFullWidth", "variant", "innerRef", "onClick", 'aria-label']);
|
|
15940
15942
|
const isPlain = variant === 'plain';
|
|
15941
15943
|
const isPlainText = variant === 'plainText';
|
|
15944
|
+
const isTypeahead = variant === 'typeahead';
|
|
15945
|
+
const toggleControls = (React__namespace.createElement("span", { className: css(styles$x.menuToggleControls) },
|
|
15946
|
+
React__namespace.createElement("span", { className: css(styles$x.menuToggleToggleIcon) },
|
|
15947
|
+
React__namespace.createElement(CaretDownIcon$1, { "aria-hidden": true }))));
|
|
15942
15948
|
const content = (React__namespace.createElement(React__namespace.Fragment, null,
|
|
15943
15949
|
icon && React__namespace.createElement("span", { className: css(styles$x.menuToggleIcon) }, icon),
|
|
15944
|
-
React__namespace.createElement("span", { className: "pf-c-menu-toggle__text" }, children),
|
|
15950
|
+
isTypeahead ? children : React__namespace.createElement("span", { className: "pf-c-menu-toggle__text" }, children),
|
|
15945
15951
|
badge && React__namespace.createElement("span", { className: css(styles$x.menuToggleCount) }, badge),
|
|
15946
|
-
React__namespace.createElement("
|
|
15947
|
-
|
|
15948
|
-
|
|
15949
|
-
|
|
15950
|
-
|
|
15951
|
-
|
|
15952
|
+
isTypeahead ? (React__namespace.createElement("button", { type: "button", className: css(styles$x.menuToggleButton), "aria-expanded": isExpanded, onClick: onClick, "aria-label": "Menu toggle" }, toggleControls)) : (toggleControls)));
|
|
15953
|
+
const componentProps = Object.assign(Object.assign({ className: css(styles$x.menuToggle, isExpanded && styles$x.modifiers.expanded, variant === 'primary' && styles$x.modifiers.primary, (isPlain || isPlainText) && styles$x.modifiers.plain, isPlainText && styles$x.modifiers.text, isFullHeight && styles$x.modifiers.fullHeight, isTypeahead && styles$x.modifiers.typeahead, isFullWidth && styles$x.modifiers.fullWidth, className), children: isPlain ? children : content }, (isDisabled && { disabled: true })), otherProps);
|
|
15954
|
+
if (isTypeahead) {
|
|
15955
|
+
return React__namespace.createElement("div", Object.assign({ ref: innerRef }, componentProps));
|
|
15956
|
+
}
|
|
15957
|
+
return (React__namespace.createElement("button", Object.assign({ className: css(styles$x.menuToggle, isExpanded && styles$x.modifiers.expanded, variant === 'primary' && styles$x.modifiers.primary, variant === 'secondary' && styles$x.modifiers.secondary, (isPlain || isPlainText) && styles$x.modifiers.plain, isPlainText && styles$x.modifiers.text, isFullHeight && styles$x.modifiers.fullHeight, isFullWidth && styles$x.modifiers.fullWidth, className), ref: innerRef, type: "button", "aria-label": ariaLabel, "aria-expanded": isExpanded, onClick: onClick }, componentProps)));
|
|
15952
15958
|
}
|
|
15953
15959
|
}
|
|
15954
15960
|
MenuToggleBase.defaultProps = {
|
|
@@ -16880,9 +16886,13 @@
|
|
|
16880
16886
|
const flyoutButton = (React__namespace.createElement("span", { className: css(styles$u.navToggle) },
|
|
16881
16887
|
React__namespace.createElement("span", { className: css(styles$u.navToggleIcon) },
|
|
16882
16888
|
React__namespace.createElement(AngleRightIcon$1, { "aria-hidden": true }))));
|
|
16889
|
+
const ariaFlyoutProps = {
|
|
16890
|
+
'aria-haspopup': 'menu',
|
|
16891
|
+
'aria-expanded': flyoutVisible
|
|
16892
|
+
};
|
|
16883
16893
|
const renderDefaultLink = (context) => {
|
|
16884
16894
|
const preventLinkDefault = preventDefault || !to;
|
|
16885
|
-
return (React__namespace.createElement(Component, Object.assign({ href: to, onClick: (e) => context.onSelect(e, groupId, itemId, to, preventLinkDefault, onClick), className: css(styles$u.navLink, isActive && styles$u.modifiers.current, isHovered && styles$u.modifiers.hover, className), "aria-current": isActive ? 'page' : null, tabIndex: isNavOpen ? null : '-1' }, props),
|
|
16895
|
+
return (React__namespace.createElement(Component, Object.assign({ href: to, onClick: (e) => context.onSelect(e, groupId, itemId, to, preventLinkDefault, onClick), className: css(styles$u.navLink, isActive && styles$u.modifiers.current, isHovered && styles$u.modifiers.hover, className), "aria-current": isActive ? 'page' : null, tabIndex: isNavOpen ? null : '-1' }, (hasFlyout && Object.assign({}, ariaFlyoutProps)), props),
|
|
16886
16896
|
children,
|
|
16887
16897
|
flyout && flyoutButton));
|
|
16888
16898
|
};
|
|
@@ -18387,10 +18397,10 @@
|
|
|
18387
18397
|
isDisabled: false
|
|
18388
18398
|
});
|
|
18389
18399
|
const TextInputGroup = (_a) => {
|
|
18390
|
-
var { children, className, isDisabled, innerRef } = _a, props = __rest$1(_a, ["children", "className", "isDisabled", "innerRef"]);
|
|
18400
|
+
var { children, className, isDisabled, isPlain, innerRef } = _a, props = __rest$1(_a, ["children", "className", "isDisabled", "isPlain", "innerRef"]);
|
|
18391
18401
|
const textInputGroupRef = innerRef || React__namespace.useRef(null);
|
|
18392
18402
|
return (React__namespace.createElement(TextInputGroupContext.Provider, { value: { isDisabled } },
|
|
18393
|
-
React__namespace.createElement("div", Object.assign({ ref: textInputGroupRef, className: css(styles$l.textInputGroup, isDisabled && styles$l.modifiers.disabled, className) }, props), children)));
|
|
18403
|
+
React__namespace.createElement("div", Object.assign({ ref: textInputGroupRef, className: css(styles$l.textInputGroup, isDisabled && styles$l.modifiers.disabled, isPlain && styles$l.modifiers.plain, className) }, props), children)));
|
|
18394
18404
|
};
|
|
18395
18405
|
TextInputGroup.displayName = 'TextInputGroup';
|
|
18396
18406
|
|
|
@@ -19054,6 +19064,7 @@
|
|
|
19054
19064
|
"nonExpandableOn_2xl": "pf-m-non-expandable-on-2xl",
|
|
19055
19065
|
"expanded": "pf-m-expanded",
|
|
19056
19066
|
"pageInsets": "pf-m-page-insets",
|
|
19067
|
+
"overflow": "pf-m-overflow",
|
|
19057
19068
|
"action": "pf-m-action",
|
|
19058
19069
|
"active": "pf-m-active",
|
|
19059
19070
|
"disabled": "pf-m-disabled",
|
|
@@ -19211,6 +19222,77 @@
|
|
|
19211
19222
|
};
|
|
19212
19223
|
const TabContent = React__namespace.forwardRef((props, ref) => (React__namespace.createElement(TabContentBase, Object.assign({}, props, { innerRef: ref }))));
|
|
19213
19224
|
|
|
19225
|
+
const TabTitleText = (_a) => {
|
|
19226
|
+
var { children, className = '' } = _a, props = __rest$1(_a, ["children", "className"]);
|
|
19227
|
+
return (React__namespace.createElement("span", Object.assign({ className: css(styles$f.tabsItemText, className) }, props), children));
|
|
19228
|
+
};
|
|
19229
|
+
TabTitleText.displayName = 'TabTitleText';
|
|
19230
|
+
|
|
19231
|
+
const OverflowTab = (_a) => {
|
|
19232
|
+
var { className, overflowingTabs = [], showTabCount, defaultTitleText = 'More', toggleAriaLabel } = _a, props = __rest$1(_a, ["className", "overflowingTabs", "showTabCount", "defaultTitleText", "toggleAriaLabel"]);
|
|
19233
|
+
const menuRef = React__default["default"].useRef();
|
|
19234
|
+
const overflowTabRef = React__default["default"].useRef();
|
|
19235
|
+
const overflowLIRef = React__default["default"].useRef();
|
|
19236
|
+
const [isExpanded, setIsExpanded] = React__default["default"].useState(false);
|
|
19237
|
+
const { localActiveKey, handleTabClick } = React__default["default"].useContext(TabsContext);
|
|
19238
|
+
const closeMenu = () => {
|
|
19239
|
+
setIsExpanded(false);
|
|
19240
|
+
overflowTabRef.current.focus();
|
|
19241
|
+
};
|
|
19242
|
+
const handleMenuKeys = (ev) => {
|
|
19243
|
+
var _a;
|
|
19244
|
+
const menuContainsEventTarget = (_a = menuRef === null || menuRef === void 0 ? void 0 : menuRef.current) === null || _a === void 0 ? void 0 : _a.contains(ev.target);
|
|
19245
|
+
if (isExpanded && menuContainsEventTarget && ev.key === 'Escape') {
|
|
19246
|
+
closeMenu();
|
|
19247
|
+
}
|
|
19248
|
+
};
|
|
19249
|
+
const handleClick = (ev) => {
|
|
19250
|
+
var _a, _b;
|
|
19251
|
+
const clickIsOutsideMenu = !((_a = menuRef === null || menuRef === void 0 ? void 0 : menuRef.current) === null || _a === void 0 ? void 0 : _a.contains(ev.target));
|
|
19252
|
+
const clickIsOutsideOverflowTab = !((_b = overflowTabRef === null || overflowTabRef === void 0 ? void 0 : overflowTabRef.current) === null || _b === void 0 ? void 0 : _b.contains(ev.target));
|
|
19253
|
+
if (isExpanded && clickIsOutsideMenu && clickIsOutsideOverflowTab) {
|
|
19254
|
+
closeMenu();
|
|
19255
|
+
}
|
|
19256
|
+
};
|
|
19257
|
+
React__default["default"].useEffect(() => {
|
|
19258
|
+
window.addEventListener('click', handleClick);
|
|
19259
|
+
window.addEventListener('keydown', handleMenuKeys);
|
|
19260
|
+
return () => {
|
|
19261
|
+
window.removeEventListener('click', handleClick);
|
|
19262
|
+
window.removeEventListener('keydown', handleMenuKeys);
|
|
19263
|
+
};
|
|
19264
|
+
}, [isExpanded, menuRef, overflowTabRef]);
|
|
19265
|
+
const selectedTab = overflowingTabs.find(tab => tab.eventKey === localActiveKey);
|
|
19266
|
+
const tabTitle = (selectedTab === null || selectedTab === void 0 ? void 0 : selectedTab.title) ? selectedTab.title : defaultTitleText;
|
|
19267
|
+
const toggleMenu = () => {
|
|
19268
|
+
setIsExpanded(prevIsExpanded => !prevIsExpanded);
|
|
19269
|
+
setTimeout(() => {
|
|
19270
|
+
if (menuRef === null || menuRef === void 0 ? void 0 : menuRef.current) {
|
|
19271
|
+
const firstElement = menuRef.current.querySelector('li > button,input:not(:disabled)');
|
|
19272
|
+
firstElement && firstElement.focus();
|
|
19273
|
+
}
|
|
19274
|
+
}, 0);
|
|
19275
|
+
};
|
|
19276
|
+
const overflowTab = (React__default["default"].createElement("li", Object.assign({ className: css(styles$f.tabsItem, 'pf-m-overflow', selectedTab && styles$f.modifiers.current, className), role: "presentation", ref: overflowLIRef }, props),
|
|
19277
|
+
React__default["default"].createElement("button", { className: css(styles$f.tabsLink, isExpanded && styles$f.modifiers.expanded), onClick: () => toggleMenu(), "aria-label": toggleAriaLabel, "aria-haspopup": "menu", "aria-expanded": isExpanded, role: "tab", ref: overflowTabRef },
|
|
19278
|
+
React__default["default"].createElement(TabTitleText, null,
|
|
19279
|
+
tabTitle,
|
|
19280
|
+
showTabCount && tabTitle === defaultTitleText && ` (${overflowingTabs.length})`),
|
|
19281
|
+
React__default["default"].createElement("span", { className: styles$f.tabsLinkToggleIcon },
|
|
19282
|
+
React__default["default"].createElement(AngleRightIcon$1, null)))));
|
|
19283
|
+
const tabs = overflowingTabs.map(tab => (React__default["default"].createElement(MenuItem, { key: tab.eventKey, itemId: tab.eventKey, isSelected: localActiveKey === tab.eventKey }, tab.title)));
|
|
19284
|
+
const onTabSelect = (event, key) => {
|
|
19285
|
+
closeMenu();
|
|
19286
|
+
const selectedTabRef = overflowingTabs.find(tab => tab.eventKey === key).tabContentRef;
|
|
19287
|
+
handleTabClick(event, key, selectedTabRef);
|
|
19288
|
+
};
|
|
19289
|
+
const overflowMenu = (React__default["default"].createElement(Menu, { ref: menuRef, onSelect: (ev, itemId) => onTabSelect(ev, itemId) },
|
|
19290
|
+
React__default["default"].createElement(MenuContent, null,
|
|
19291
|
+
React__default["default"].createElement(MenuList, null, tabs))));
|
|
19292
|
+
return (React__default["default"].createElement(Popper, { trigger: overflowTab, popper: overflowMenu, isVisible: isExpanded, popperMatchesTriggerWidth: false, appendTo: overflowLIRef.current }));
|
|
19293
|
+
};
|
|
19294
|
+
OverflowTab.displayName = 'OverflowTab';
|
|
19295
|
+
|
|
19214
19296
|
exports.TabsComponent = void 0;
|
|
19215
19297
|
(function (TabsComponent) {
|
|
19216
19298
|
TabsComponent["div"] = "div";
|
|
@@ -19225,7 +19307,12 @@
|
|
|
19225
19307
|
super(props);
|
|
19226
19308
|
this.tabList = React__namespace.createRef();
|
|
19227
19309
|
this.scrollTimeout = null;
|
|
19310
|
+
this.countOverflowingElements = (container) => {
|
|
19311
|
+
const elements = Array.from(container.children);
|
|
19312
|
+
return elements.filter(element => !isElementInView(container, element, false)).length;
|
|
19313
|
+
};
|
|
19228
19314
|
this.handleScrollButtons = () => {
|
|
19315
|
+
const { isOverflowHorizontal: isOverflowHorizontal } = this.props;
|
|
19229
19316
|
// add debounce to the scroll event
|
|
19230
19317
|
clearTimeout(this.scrollTimeout);
|
|
19231
19318
|
this.scrollTimeout = setTimeout(() => {
|
|
@@ -19233,7 +19320,8 @@
|
|
|
19233
19320
|
let disableLeftScrollButton = true;
|
|
19234
19321
|
let disableRightScrollButton = true;
|
|
19235
19322
|
let showScrollButtons = false;
|
|
19236
|
-
|
|
19323
|
+
let overflowingTabCount = 0;
|
|
19324
|
+
if (container && !this.props.isVertical && !isOverflowHorizontal) {
|
|
19237
19325
|
// get first element and check if it is in view
|
|
19238
19326
|
const overflowOnLeft = !isElementInView(container, container.firstChild, false);
|
|
19239
19327
|
// get last element and check if it is in view
|
|
@@ -19242,10 +19330,14 @@
|
|
|
19242
19330
|
disableLeftScrollButton = !overflowOnLeft;
|
|
19243
19331
|
disableRightScrollButton = !overflowOnRight;
|
|
19244
19332
|
}
|
|
19333
|
+
if (isOverflowHorizontal) {
|
|
19334
|
+
overflowingTabCount = this.countOverflowingElements(container);
|
|
19335
|
+
}
|
|
19245
19336
|
this.setState({
|
|
19246
19337
|
showScrollButtons,
|
|
19247
19338
|
disableLeftScrollButton,
|
|
19248
|
-
disableRightScrollButton
|
|
19339
|
+
disableRightScrollButton,
|
|
19340
|
+
overflowingTabCount
|
|
19249
19341
|
});
|
|
19250
19342
|
}, 100);
|
|
19251
19343
|
};
|
|
@@ -19293,7 +19385,8 @@
|
|
|
19293
19385
|
shownKeys: this.props.defaultActiveKey !== undefined ? [this.props.defaultActiveKey] : [this.props.activeKey],
|
|
19294
19386
|
uncontrolledActiveKey: this.props.defaultActiveKey,
|
|
19295
19387
|
uncontrolledIsExpandedLocal: this.props.defaultIsExpanded,
|
|
19296
|
-
ouiaStateId: getDefaultOUIAId(Tabs.displayName)
|
|
19388
|
+
ouiaStateId: getDefaultOUIAId(Tabs.displayName),
|
|
19389
|
+
overflowingTabCount: 0
|
|
19297
19390
|
};
|
|
19298
19391
|
if (this.props.isVertical && this.props.expandable !== undefined) {
|
|
19299
19392
|
if (!this.props.toggleAriaLabel && !this.props.toggleText) {
|
|
@@ -19349,8 +19442,8 @@
|
|
|
19349
19442
|
clearTimeout(this.scrollTimeout);
|
|
19350
19443
|
}
|
|
19351
19444
|
componentDidUpdate(prevProps) {
|
|
19352
|
-
const { activeKey, mountOnEnter, children } = this.props;
|
|
19353
|
-
const { shownKeys } = this.state;
|
|
19445
|
+
const { activeKey, mountOnEnter, isOverflowHorizontal, children } = this.props;
|
|
19446
|
+
const { shownKeys, overflowingTabCount } = this.state;
|
|
19354
19447
|
if (prevProps.activeKey !== activeKey && mountOnEnter && shownKeys.indexOf(activeKey) < 0) {
|
|
19355
19448
|
this.setState({
|
|
19356
19449
|
shownKeys: shownKeys.concat(activeKey)
|
|
@@ -19361,13 +19454,20 @@
|
|
|
19361
19454
|
React__namespace.Children.toArray(prevProps.children).length !== React__namespace.Children.toArray(children).length) {
|
|
19362
19455
|
this.handleScrollButtons();
|
|
19363
19456
|
}
|
|
19457
|
+
const currentOverflowingTabCount = this.countOverflowingElements(this.tabList.current);
|
|
19458
|
+
if (isOverflowHorizontal && currentOverflowingTabCount) {
|
|
19459
|
+
this.setState({ overflowingTabCount: currentOverflowingTabCount + overflowingTabCount });
|
|
19460
|
+
}
|
|
19364
19461
|
}
|
|
19365
19462
|
render() {
|
|
19366
|
-
const _a = this.props, { className, children, activeKey, defaultActiveKey, id, isFilled, isSecondary, isVertical, isBox, hasBorderBottom, hasSecondaryBorderBottom, leftScrollAriaLabel, rightScrollAriaLabel, 'aria-label': ariaLabel, component, ouiaId, ouiaSafe, mountOnEnter, unmountOnExit, usePageInsets, inset, variant, expandable, isExpanded, defaultIsExpanded, toggleText, toggleAriaLabel, addButtonAriaLabel, onToggle, onClose, onAdd } = _a, props = __rest$1(_a, ["className", "children", "activeKey", "defaultActiveKey", "id", "isFilled", "isSecondary", "isVertical", "isBox", "hasBorderBottom", "hasSecondaryBorderBottom", "leftScrollAriaLabel", "rightScrollAriaLabel", 'aria-label', "component", "ouiaId", "ouiaSafe", "mountOnEnter", "unmountOnExit", "usePageInsets", "inset", "variant", "expandable", "isExpanded", "defaultIsExpanded", "toggleText", "toggleAriaLabel", "addButtonAriaLabel", "onToggle", "onClose", "onAdd"]);
|
|
19367
|
-
const { showScrollButtons, disableLeftScrollButton, disableRightScrollButton, shownKeys, uncontrolledActiveKey, uncontrolledIsExpandedLocal } = this.state;
|
|
19463
|
+
const _a = this.props, { className, children, activeKey, defaultActiveKey, id, isFilled, isSecondary, isVertical, isBox, hasBorderBottom, hasSecondaryBorderBottom, leftScrollAriaLabel, rightScrollAriaLabel, 'aria-label': ariaLabel, component, ouiaId, ouiaSafe, mountOnEnter, unmountOnExit, usePageInsets, inset, variant, expandable, isExpanded, defaultIsExpanded, toggleText, toggleAriaLabel, addButtonAriaLabel, onToggle, onClose, onAdd, isOverflowHorizontal: isOverflowHorizontal } = _a, props = __rest$1(_a, ["className", "children", "activeKey", "defaultActiveKey", "id", "isFilled", "isSecondary", "isVertical", "isBox", "hasBorderBottom", "hasSecondaryBorderBottom", "leftScrollAriaLabel", "rightScrollAriaLabel", 'aria-label', "component", "ouiaId", "ouiaSafe", "mountOnEnter", "unmountOnExit", "usePageInsets", "inset", "variant", "expandable", "isExpanded", "defaultIsExpanded", "toggleText", "toggleAriaLabel", "addButtonAriaLabel", "onToggle", "onClose", "onAdd", "isOverflowHorizontal"]);
|
|
19464
|
+
const { showScrollButtons, disableLeftScrollButton, disableRightScrollButton, shownKeys, uncontrolledActiveKey, uncontrolledIsExpandedLocal, overflowingTabCount } = this.state;
|
|
19368
19465
|
const filteredChildren = React__namespace.Children.toArray(children)
|
|
19369
19466
|
.filter(Boolean)
|
|
19370
19467
|
.filter(child => !child.props.isHidden);
|
|
19468
|
+
const filteredChildrenWithoutOverflow = filteredChildren.slice(0, filteredChildren.length - overflowingTabCount);
|
|
19469
|
+
const filteredChildrenOverflowing = filteredChildren.slice(filteredChildren.length - overflowingTabCount);
|
|
19470
|
+
const overflowingTabProps = filteredChildrenOverflowing.map((child) => child.props);
|
|
19371
19471
|
const uniqueId = id || getUniqueId();
|
|
19372
19472
|
const Component = component === exports.TabsComponent.nav ? 'nav' : 'div';
|
|
19373
19473
|
const localActiveKey = defaultActiveKey !== undefined ? uncontrolledActiveKey : activeKey;
|
|
@@ -19381,6 +19481,8 @@
|
|
|
19381
19481
|
onToggle(newValue);
|
|
19382
19482
|
}
|
|
19383
19483
|
};
|
|
19484
|
+
const hasOverflowTab = isOverflowHorizontal && overflowingTabCount > 0;
|
|
19485
|
+
const overflowObjectProps = typeof isOverflowHorizontal === 'object' ? Object.assign({}, isOverflowHorizontal) : {};
|
|
19384
19486
|
return (React__namespace.createElement(TabsContextProvider, { value: {
|
|
19385
19487
|
variant,
|
|
19386
19488
|
mountOnEnter,
|
|
@@ -19390,18 +19492,20 @@
|
|
|
19390
19492
|
handleTabClick: (...args) => this.handleTabClick(...args),
|
|
19391
19493
|
handleTabClose: onClose
|
|
19392
19494
|
} },
|
|
19393
|
-
React__namespace.createElement(Component, Object.assign({ "aria-label": ariaLabel, className: css(styles$f.tabs, isFilled && styles$f.modifiers.fill, isSecondary && styles$f.modifiers.secondary, isVertical && styles$f.modifiers.vertical, isVertical && expandable && formatBreakpointMods(expandable, styles$f), isVertical && expandable && isExpandedLocal && styles$f.modifiers.expanded, isBox && styles$f.modifiers.box, showScrollButtons && !isVertical && styles$f.modifiers.scrollable, usePageInsets && styles$f.modifiers.pageInsets, !hasBorderBottom && styles$f.modifiers.noBorderBottom, hasSecondaryBorderBottom && styles$f.modifiers.borderBottom, formatBreakpointMods(inset, styles$f), variantStyle[variant], className) }, getOUIAProps(Tabs.displayName, ouiaId !== undefined ? ouiaId : this.state.ouiaStateId, ouiaSafe), { id: id && id }, props),
|
|
19495
|
+
React__namespace.createElement(Component, Object.assign({ "aria-label": ariaLabel, className: css(styles$f.tabs, isFilled && styles$f.modifiers.fill, isSecondary && styles$f.modifiers.secondary, isVertical && styles$f.modifiers.vertical, isVertical && expandable && formatBreakpointMods(expandable, styles$f), isVertical && expandable && isExpandedLocal && styles$f.modifiers.expanded, isBox && styles$f.modifiers.box, showScrollButtons && !isVertical && styles$f.modifiers.scrollable, usePageInsets && styles$f.modifiers.pageInsets, !hasBorderBottom && styles$f.modifiers.noBorderBottom, hasSecondaryBorderBottom && styles$f.modifiers.borderBottom, formatBreakpointMods(inset, styles$f), variantStyle[variant], hasOverflowTab && styles$f.modifiers.overflow, className) }, getOUIAProps(Tabs.displayName, ouiaId !== undefined ? ouiaId : this.state.ouiaStateId, ouiaSafe), { id: id && id }, props),
|
|
19394
19496
|
expandable && isVertical && (React__namespace.createElement(GenerateId, null, randomId => (React__namespace.createElement("div", { className: css(styles$f.tabsToggle) },
|
|
19395
19497
|
React__namespace.createElement("div", { className: css(styles$f.tabsToggleButton) },
|
|
19396
19498
|
React__namespace.createElement(Button, { onClick: () => toggleTabs(!isExpandedLocal), variant: "plain", "aria-label": toggleAriaLabel, "aria-expanded": isExpandedLocal, id: `${randomId}-button`, "aria-labelledby": `${randomId}-text ${randomId}-button` },
|
|
19397
19499
|
React__namespace.createElement("span", { className: css(styles$f.tabsToggleIcon) },
|
|
19398
19500
|
React__namespace.createElement(AngleRightIcon$1, { "arian-hidden": "true" })),
|
|
19399
19501
|
toggleText && (React__namespace.createElement("span", { className: css('pf-c-tabs__toggle-text'), id: `${randomId}-text` }, toggleText)))))))),
|
|
19400
|
-
React__namespace.createElement("button", { className: css(styles$f.tabsScrollButton, isSecondary && buttonStyles.modifiers.secondary), "aria-label": leftScrollAriaLabel, onClick: this.scrollLeft, disabled: disableLeftScrollButton, "aria-hidden": disableLeftScrollButton },
|
|
19401
|
-
React__namespace.createElement(AngleLeftIcon$1, null)),
|
|
19402
|
-
React__namespace.createElement("ul", { className: css(styles$f.tabsList), ref: this.tabList, onScroll: this.handleScrollButtons, role: "tablist" },
|
|
19403
|
-
|
|
19404
|
-
React__namespace.createElement(
|
|
19502
|
+
!isOverflowHorizontal && (React__namespace.createElement("button", { className: css(styles$f.tabsScrollButton, isSecondary && buttonStyles.modifiers.secondary), "aria-label": leftScrollAriaLabel, onClick: this.scrollLeft, disabled: disableLeftScrollButton, "aria-hidden": disableLeftScrollButton },
|
|
19503
|
+
React__namespace.createElement(AngleLeftIcon$1, null))),
|
|
19504
|
+
React__namespace.createElement("ul", { className: css(styles$f.tabsList), ref: this.tabList, onScroll: this.handleScrollButtons, role: "tablist" },
|
|
19505
|
+
isOverflowHorizontal ? filteredChildrenWithoutOverflow : filteredChildren,
|
|
19506
|
+
hasOverflowTab && React__namespace.createElement(OverflowTab, Object.assign({ overflowingTabs: overflowingTabProps }, overflowObjectProps))),
|
|
19507
|
+
!isOverflowHorizontal && (React__namespace.createElement("button", { className: css(styles$f.tabsScrollButton, isSecondary && buttonStyles.modifiers.secondary), "aria-label": rightScrollAriaLabel, onClick: this.scrollRight, disabled: disableRightScrollButton, "aria-hidden": disableRightScrollButton },
|
|
19508
|
+
React__namespace.createElement(AngleRightIcon$1, null))),
|
|
19405
19509
|
onAdd !== undefined && (React__namespace.createElement("span", { className: css(styles$f.tabsAdd) },
|
|
19406
19510
|
React__namespace.createElement(Button, { variant: "plain", "aria-label": addButtonAriaLabel || 'Add tab', onClick: onAdd },
|
|
19407
19511
|
React__namespace.createElement(PlusIcon$1, null))))),
|
|
@@ -19438,12 +19542,6 @@
|
|
|
19438
19542
|
};
|
|
19439
19543
|
TabContentBody.displayName = 'TabContentBody';
|
|
19440
19544
|
|
|
19441
|
-
const TabTitleText = (_a) => {
|
|
19442
|
-
var { children, className = '' } = _a, props = __rest$1(_a, ["children", "className"]);
|
|
19443
|
-
return (React__namespace.createElement("span", Object.assign({ className: css(styles$f.tabsItemText, className) }, props), children));
|
|
19444
|
-
};
|
|
19445
|
-
TabTitleText.displayName = 'TabTitleText';
|
|
19446
|
-
|
|
19447
19545
|
const TabTitleIcon = (_a) => {
|
|
19448
19546
|
var { children, className = '' } = _a, props = __rest$1(_a, ["children", "className"]);
|
|
19449
19547
|
return (React__namespace.createElement("span", Object.assign({ className: css(styles$f.tabsItemIcon, className) }, props), children));
|
|
@@ -20594,7 +20692,7 @@
|
|
|
20594
20692
|
|
|
20595
20693
|
const TreeViewListItemBase = ({ name, title, id, isExpanded, defaultExpanded = false, children = null, onSelect, onCheck, hasCheck = false, checkProps = {
|
|
20596
20694
|
checked: false
|
|
20597
|
-
}, hasBadge = false, customBadgeContent, badgeProps = { isRead: true }, isCompact, activeItems = [], itemData, parentItem, icon, expandedIcon, action, compareItems,
|
|
20695
|
+
}, hasBadge = false, customBadgeContent, badgeProps = { isRead: true }, isSelectable = false, isCompact, activeItems = [], itemData, parentItem, icon, expandedIcon, action, compareItems,
|
|
20598
20696
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
20599
20697
|
useMemo }) => {
|
|
20600
20698
|
const [internalIsExpanded, setIsExpanded] = React.useState(defaultExpanded);
|
|
@@ -20606,13 +20704,22 @@
|
|
|
20606
20704
|
setIsExpanded(internalIsExpanded || defaultExpanded);
|
|
20607
20705
|
}
|
|
20608
20706
|
}, [isExpanded, defaultExpanded]);
|
|
20609
|
-
|
|
20610
|
-
|
|
20611
|
-
|
|
20612
|
-
|
|
20707
|
+
let Component = 'button';
|
|
20708
|
+
if (hasCheck) {
|
|
20709
|
+
Component = 'label';
|
|
20710
|
+
}
|
|
20711
|
+
else if (isSelectable) {
|
|
20712
|
+
Component = 'div';
|
|
20713
|
+
}
|
|
20714
|
+
const ToggleComponent = hasCheck || isSelectable ? 'button' : 'span';
|
|
20715
|
+
const renderToggle = (randomId) => (React__default["default"].createElement(ToggleComponent, Object.assign({ className: css(styles$9.treeViewNodeToggle), onClick: (evt) => {
|
|
20716
|
+
if (isSelectable || hasCheck) {
|
|
20613
20717
|
setIsExpanded(!internalIsExpanded);
|
|
20614
20718
|
}
|
|
20615
|
-
|
|
20719
|
+
if (isSelectable) {
|
|
20720
|
+
evt.stopPropagation();
|
|
20721
|
+
}
|
|
20722
|
+
} }, ((hasCheck || isSelectable) && { 'aria-labelledby': `label-${randomId}` }), { tabIndex: -1 }),
|
|
20616
20723
|
React__default["default"].createElement("span", { className: css(styles$9.treeViewNodeToggleIcon) },
|
|
20617
20724
|
React__default["default"].createElement(AngleRightIcon$1, { "aria-hidden": "true" }))));
|
|
20618
20725
|
const renderCheck = (randomId) => (React__default["default"].createElement("span", { className: css(styles$9.treeViewNodeCheck) },
|
|
@@ -20620,11 +20727,11 @@
|
|
|
20620
20727
|
const iconRendered = (React__default["default"].createElement("span", { className: css(styles$9.treeViewNodeIcon) },
|
|
20621
20728
|
!internalIsExpanded && icon,
|
|
20622
20729
|
internalIsExpanded && (expandedIcon || icon)));
|
|
20623
|
-
const renderNodeContent = (
|
|
20730
|
+
const renderNodeContent = () => {
|
|
20624
20731
|
const content = (React__default["default"].createElement(React__default["default"].Fragment, null,
|
|
20625
20732
|
isCompact && title && React__default["default"].createElement("span", { className: css(styles$9.treeViewNodeTitle) }, title),
|
|
20626
|
-
hasCheck ? (React__default["default"].createElement("
|
|
20627
|
-
return isCompact ? React__default["default"].createElement("
|
|
20733
|
+
hasCheck ? (React__default["default"].createElement("span", { className: css(styles$9.treeViewNodeText) }, name)) : (React__default["default"].createElement("span", { className: css(styles$9.treeViewNodeText) }, name))));
|
|
20734
|
+
return isCompact ? React__default["default"].createElement("span", { className: css(styles$9.treeViewNodeContent) }, content) : content;
|
|
20628
20735
|
};
|
|
20629
20736
|
const badgeRendered = (React__default["default"].createElement(React__default["default"].Fragment, null,
|
|
20630
20737
|
hasBadge && children && (React__default["default"].createElement("span", { className: css(styles$9.treeViewNodeCount) },
|
|
@@ -20633,7 +20740,7 @@
|
|
|
20633
20740
|
React__default["default"].createElement(Badge, Object.assign({}, badgeProps), customBadgeContent)))));
|
|
20634
20741
|
return (React__default["default"].createElement("li", Object.assign({ id: id, className: css(styles$9.treeViewListItem, internalIsExpanded && styles$9.modifiers.expanded) }, (internalIsExpanded && { 'aria-expanded': 'true' }), { role: "treeitem", tabIndex: -1 }),
|
|
20635
20742
|
React__default["default"].createElement("div", { className: css(styles$9.treeViewContent) },
|
|
20636
|
-
React__default["default"].createElement(GenerateId, { prefix:
|
|
20743
|
+
React__default["default"].createElement(GenerateId, { prefix: isSelectable ? 'selectable-id' : 'checkbox-id' }, randomId => (React__default["default"].createElement(Component, Object.assign({ className: css(styles$9.treeViewNode, children && (isSelectable || hasCheck) && styles$9.modifiers.selectable, (!children || isSelectable) &&
|
|
20637
20744
|
activeItems &&
|
|
20638
20745
|
activeItems.length > 0 &&
|
|
20639
20746
|
activeItems.some(item => compareItems && item && compareItems(item, itemData))
|
|
@@ -20641,16 +20748,16 @@
|
|
|
20641
20748
|
: ''), onClick: (evt) => {
|
|
20642
20749
|
if (!hasCheck) {
|
|
20643
20750
|
onSelect && onSelect(evt, itemData, parentItem);
|
|
20644
|
-
if (children && evt.isDefaultPrevented() !== true) {
|
|
20751
|
+
if (!isSelectable && children && evt.isDefaultPrevented() !== true) {
|
|
20645
20752
|
setIsExpanded(!internalIsExpanded);
|
|
20646
20753
|
}
|
|
20647
20754
|
}
|
|
20648
|
-
}, tabIndex: -1 },
|
|
20649
|
-
React__default["default"].createElement("
|
|
20755
|
+
}, tabIndex: isSelectable ? 0 : -1 }, (hasCheck && { htmlFor: randomId }), ((hasCheck || (isSelectable && children)) && { id: `label-${randomId}` })),
|
|
20756
|
+
React__default["default"].createElement("span", { className: css(styles$9.treeViewNodeContainer) },
|
|
20650
20757
|
children && renderToggle(randomId),
|
|
20651
20758
|
hasCheck && renderCheck(randomId),
|
|
20652
20759
|
icon && iconRendered,
|
|
20653
|
-
renderNodeContent(
|
|
20760
|
+
renderNodeContent(),
|
|
20654
20761
|
badgeRendered)))),
|
|
20655
20762
|
action && React__default["default"].createElement("div", { className: css(styles$9.treeViewAction) }, action)),
|
|
20656
20763
|
internalIsExpanded && children));
|
|
@@ -20821,11 +20928,11 @@
|
|
|
20821
20928
|
}
|
|
20822
20929
|
|
|
20823
20930
|
const TreeView = (_a) => {
|
|
20824
|
-
var { data, isNested = false, hasChecks = false, hasBadges = false, hasGuides = false, variant = 'default', defaultAllExpanded = false, allExpanded, icon, expandedIcon, parentItem, onSelect, onCheck, toolbar, activeItems, compareItems = (item, itemToCheck) => item.id === itemToCheck.id, className, useMemo } = _a, props = __rest$1(_a, ["data", "isNested", "hasChecks", "hasBadges", "hasGuides", "variant", "defaultAllExpanded", "allExpanded", "icon", "expandedIcon", "parentItem", "onSelect", "onCheck", "toolbar", "activeItems", "compareItems", "className", "useMemo"]);
|
|
20931
|
+
var { data, isNested = false, hasChecks = false, hasBadges = false, hasGuides = false, hasSelectableNodes = false, variant = 'default', defaultAllExpanded = false, allExpanded, icon, expandedIcon, parentItem, onSelect, onCheck, toolbar, activeItems, compareItems = (item, itemToCheck) => item.id === itemToCheck.id, className, useMemo } = _a, props = __rest$1(_a, ["data", "isNested", "hasChecks", "hasBadges", "hasGuides", "hasSelectableNodes", "variant", "defaultAllExpanded", "allExpanded", "icon", "expandedIcon", "parentItem", "onSelect", "onCheck", "toolbar", "activeItems", "compareItems", "className", "useMemo"]);
|
|
20825
20932
|
const treeViewList = (React__namespace.createElement(TreeViewList, { isNested: isNested, toolbar: toolbar }, data.map(item => {
|
|
20826
20933
|
var _a;
|
|
20827
|
-
return (React__namespace.createElement(TreeViewListItem, Object.assign({ key: ((_a = item.id) === null || _a === void 0 ? void 0 : _a.toString()) || item.name.toString(), name: item.name, title: item.title, id: item.id, isExpanded: allExpanded, defaultExpanded: item.defaultExpanded !== undefined ? item.defaultExpanded : defaultAllExpanded, onSelect: onSelect, onCheck: onCheck, hasCheck: item.hasCheck !== undefined ? item.hasCheck : hasChecks, checkProps: item.checkProps, hasBadge: item.hasBadge !== undefined ? item.hasBadge : hasBadges, customBadgeContent: item.customBadgeContent, badgeProps: item.badgeProps, activeItems: activeItems, parentItem: parentItem, itemData: item, icon: item.icon !== undefined ? item.icon : icon, expandedIcon: item.expandedIcon !== undefined ? item.expandedIcon : expandedIcon, action: item.action, compareItems: compareItems, isCompact: variant === 'compact' || variant === 'compactNoBackground', useMemo: useMemo }, (item.children && {
|
|
20828
|
-
children: (React__namespace.createElement(TreeView, { data: item.children, isNested: true, parentItem: item, hasChecks: hasChecks, hasBadges: hasBadges, hasGuides: hasGuides, variant: variant, allExpanded: allExpanded, defaultAllExpanded: defaultAllExpanded, onSelect: onSelect, onCheck: onCheck, activeItems: activeItems, icon: icon, expandedIcon: expandedIcon }))
|
|
20934
|
+
return (React__namespace.createElement(TreeViewListItem, Object.assign({ key: ((_a = item.id) === null || _a === void 0 ? void 0 : _a.toString()) || item.name.toString(), name: item.name, title: item.title, id: item.id, isExpanded: allExpanded, isSelectable: hasSelectableNodes, defaultExpanded: item.defaultExpanded !== undefined ? item.defaultExpanded : defaultAllExpanded, onSelect: onSelect, onCheck: onCheck, hasCheck: item.hasCheck !== undefined ? item.hasCheck : hasChecks, checkProps: item.checkProps, hasBadge: item.hasBadge !== undefined ? item.hasBadge : hasBadges, customBadgeContent: item.customBadgeContent, badgeProps: item.badgeProps, activeItems: activeItems, parentItem: parentItem, itemData: item, icon: item.icon !== undefined ? item.icon : icon, expandedIcon: item.expandedIcon !== undefined ? item.expandedIcon : expandedIcon, action: item.action, compareItems: compareItems, isCompact: variant === 'compact' || variant === 'compactNoBackground', useMemo: useMemo }, (item.children && {
|
|
20935
|
+
children: (React__namespace.createElement(TreeView, { data: item.children, isNested: true, parentItem: item, hasChecks: hasChecks, hasBadges: hasBadges, hasGuides: hasGuides, hasSelectableNodes: hasSelectableNodes, variant: variant, allExpanded: allExpanded, defaultAllExpanded: defaultAllExpanded, onSelect: onSelect, onCheck: onCheck, activeItems: activeItems, icon: icon, expandedIcon: expandedIcon }))
|
|
20829
20936
|
}))));
|
|
20830
20937
|
})));
|
|
20831
20938
|
return (React__namespace.createElement(React__namespace.Fragment, null, parentItem ? (treeViewList) : (React__namespace.createElement(TreeViewRoot, Object.assign({ hasChecks: hasChecks, hasGuides: hasGuides, variant: variant, className: className }, props), treeViewList))));
|