@patternfly/react-core 4.227.9 → 4.228.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/CHANGELOG.md +11 -0
- 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/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/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/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 +37 -44
- package/dist/umd/react-core.js +132 -36
- package/dist/umd/react-core.min.css +6 -13
- package/dist/umd/react-core.min.js +4 -4
- package/package.json +6 -6
- 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/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/dist/umd/react-core.css
CHANGED
|
@@ -266,6 +266,37 @@
|
|
|
266
266
|
--pf-c-accordion__toggle--active--BackgroundColor: var(--pf-global--BackgroundColor--300);
|
|
267
267
|
}
|
|
268
268
|
|
|
269
|
+
.pf-c-action-list {
|
|
270
|
+
--pf-c-action-list--m-icon--spacer: 0;
|
|
271
|
+
--pf-c-action-list--child--spacer-base: var(--pf-global--spacer--md);
|
|
272
|
+
--pf-c-action-list--group--spacer-base: var(--pf-global--spacer--2xl);
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
.pf-c-action-list,
|
|
276
|
+
.pf-c-action-list__group {
|
|
277
|
+
--pf-c-action-list--child--spacer: var(--pf-c-action-list--child--spacer-base);
|
|
278
|
+
--pf-c-action-list--group--spacer: var(--pf-c-action-list--group--spacer-base);
|
|
279
|
+
display: flex;
|
|
280
|
+
align-items: center;
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
.pf-c-action-list > * + *,
|
|
284
|
+
.pf-c-action-list__group > * + * {
|
|
285
|
+
margin-left: var(--pf-c-action-list--child--spacer);
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
.pf-c-action-list > * + .pf-c-action-list__group,
|
|
289
|
+
.pf-c-action-list .pf-c-action-list__group + *,
|
|
290
|
+
.pf-c-action-list__group > * + .pf-c-action-list__group,
|
|
291
|
+
.pf-c-action-list__group .pf-c-action-list__group + * {
|
|
292
|
+
margin-left: var(--pf-c-action-list--group--spacer);
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
.pf-c-action-list.pf-m-icons,
|
|
296
|
+
.pf-c-action-list__group.pf-m-icons {
|
|
297
|
+
--pf-c-action-list--child--spacer: var(--pf-c-action-list--m-icon--spacer);
|
|
298
|
+
}
|
|
299
|
+
|
|
269
300
|
.pf-c-alert {
|
|
270
301
|
--pf-global--Color--100: var(--pf-global--Color--dark-100);
|
|
271
302
|
--pf-global--Color--200: var(--pf-global--Color--dark-200);
|
|
@@ -498,37 +529,6 @@
|
|
|
498
529
|
--pf-c-alert--m-inline--m-info--BackgroundColor: var(--pf-global--palette--black-600);
|
|
499
530
|
}
|
|
500
531
|
|
|
501
|
-
.pf-c-action-list {
|
|
502
|
-
--pf-c-action-list--m-icon--spacer: 0;
|
|
503
|
-
--pf-c-action-list--child--spacer-base: var(--pf-global--spacer--md);
|
|
504
|
-
--pf-c-action-list--group--spacer-base: var(--pf-global--spacer--2xl);
|
|
505
|
-
}
|
|
506
|
-
|
|
507
|
-
.pf-c-action-list,
|
|
508
|
-
.pf-c-action-list__group {
|
|
509
|
-
--pf-c-action-list--child--spacer: var(--pf-c-action-list--child--spacer-base);
|
|
510
|
-
--pf-c-action-list--group--spacer: var(--pf-c-action-list--group--spacer-base);
|
|
511
|
-
display: flex;
|
|
512
|
-
align-items: center;
|
|
513
|
-
}
|
|
514
|
-
|
|
515
|
-
.pf-c-action-list > * + *,
|
|
516
|
-
.pf-c-action-list__group > * + * {
|
|
517
|
-
margin-left: var(--pf-c-action-list--child--spacer);
|
|
518
|
-
}
|
|
519
|
-
|
|
520
|
-
.pf-c-action-list > * + .pf-c-action-list__group,
|
|
521
|
-
.pf-c-action-list .pf-c-action-list__group + *,
|
|
522
|
-
.pf-c-action-list__group > * + .pf-c-action-list__group,
|
|
523
|
-
.pf-c-action-list__group .pf-c-action-list__group + * {
|
|
524
|
-
margin-left: var(--pf-c-action-list--group--spacer);
|
|
525
|
-
}
|
|
526
|
-
|
|
527
|
-
.pf-c-action-list.pf-m-icons,
|
|
528
|
-
.pf-c-action-list__group.pf-m-icons {
|
|
529
|
-
--pf-c-action-list--child--spacer: var(--pf-c-action-list--m-icon--spacer);
|
|
530
|
-
}
|
|
531
|
-
|
|
532
532
|
.pf-c-app-launcher {
|
|
533
533
|
--pf-c-app-launcher__menu--BackgroundColor: var(--pf-global--BackgroundColor--light-100);
|
|
534
534
|
--pf-c-app-launcher__menu--BoxShadow: var(--pf-global--BoxShadow--md);
|
|
@@ -22772,23 +22772,16 @@ svg.pf-c-spinner.pf-m-xl {
|
|
|
22772
22772
|
--pf-c-badge--m-read--BackgroundColor: var(--pf-c-tree-view__node-count--c-badge--m-read--BackgroundColor);
|
|
22773
22773
|
}
|
|
22774
22774
|
|
|
22775
|
-
.pf-c-tree-view__node.pf-m-selectable .pf-c-tree-view__node-toggle {
|
|
22776
|
-
--pf-c-tree-view__node-toggle--Color: var(--pf-c-tree-view__node-toggle--Color
|
|
22777
|
-
}
|
|
22778
|
-
|
|
22779
|
-
.pf-c-tree-view__node:hover,
|
|
22780
|
-
.pf-c-tree-view__node .pf-c-tree-view__node-toggle:hover {
|
|
22781
|
-
--pf-c-tree-view__node-toggle--Color: var(--pf-c-tree-view__node-toggle--hover__icon--Color);
|
|
22775
|
+
.pf-c-tree-view__node:not(.pf-m-selectable):hover, .pf-c-tree-view__node.pf-m-selectable .pf-c-tree-view__node-toggle:hover {
|
|
22776
|
+
--pf-c-tree-view__node-toggle--Color: var(--pf-c-tree-view__node-toggle--hover--Color);
|
|
22782
22777
|
}
|
|
22783
22778
|
|
|
22784
|
-
.pf-c-tree-view__node:focus,
|
|
22785
|
-
|
|
22786
|
-
--pf-c-tree-view__node-toggle--Color: var(--pf-c-tree-view__node-toggle--focus__icon--Color);
|
|
22779
|
+
.pf-c-tree-view__node:not(.pf-m-selectable):focus, .pf-c-tree-view__node.pf-m-selectable .pf-c-tree-view__node-toggle:focus {
|
|
22780
|
+
--pf-c-tree-view__node-toggle--Color: var(--pf-c-tree-view__node-toggle--focus--Color);
|
|
22787
22781
|
}
|
|
22788
22782
|
|
|
22789
|
-
.pf-c-tree-view__node:active,
|
|
22790
|
-
|
|
22791
|
-
--pf-c-tree-view__node-toggle--Color: var(--pf-c-tree-view__node-toggle--active__icon--Color);
|
|
22783
|
+
.pf-c-tree-view__node:not(.pf-m-selectable):active, .pf-c-tree-view__node.pf-m-selectable .pf-c-tree-view__node-toggle:active {
|
|
22784
|
+
--pf-c-tree-view__node-toggle--Color: var(--pf-c-tree-view__node-toggle--active--Color);
|
|
22792
22785
|
}
|
|
22793
22786
|
|
|
22794
22787
|
.pf-c-tree-view__node-container {
|
package/dist/umd/react-core.js
CHANGED
|
@@ -19216,6 +19216,77 @@
|
|
|
19216
19216
|
};
|
|
19217
19217
|
const TabContent = React__namespace.forwardRef((props, ref) => (React__namespace.createElement(TabContentBase, Object.assign({}, props, { innerRef: ref }))));
|
|
19218
19218
|
|
|
19219
|
+
const TabTitleText = (_a) => {
|
|
19220
|
+
var { children, className = '' } = _a, props = __rest$1(_a, ["children", "className"]);
|
|
19221
|
+
return (React__namespace.createElement("span", Object.assign({ className: css(styles$f.tabsItemText, className) }, props), children));
|
|
19222
|
+
};
|
|
19223
|
+
TabTitleText.displayName = 'TabTitleText';
|
|
19224
|
+
|
|
19225
|
+
const OverflowTab = (_a) => {
|
|
19226
|
+
var { className, overflowingTabs = [], showTabCount, defaultTitleText = 'More', toggleAriaLabel } = _a, props = __rest$1(_a, ["className", "overflowingTabs", "showTabCount", "defaultTitleText", "toggleAriaLabel"]);
|
|
19227
|
+
const menuRef = React__default["default"].useRef();
|
|
19228
|
+
const overflowTabRef = React__default["default"].useRef();
|
|
19229
|
+
const overflowLIRef = React__default["default"].useRef();
|
|
19230
|
+
const [isExpanded, setIsExpanded] = React__default["default"].useState(false);
|
|
19231
|
+
const { localActiveKey, handleTabClick } = React__default["default"].useContext(TabsContext);
|
|
19232
|
+
const closeMenu = () => {
|
|
19233
|
+
setIsExpanded(false);
|
|
19234
|
+
overflowTabRef.current.focus();
|
|
19235
|
+
};
|
|
19236
|
+
const handleMenuKeys = (ev) => {
|
|
19237
|
+
var _a;
|
|
19238
|
+
const menuContainsEventTarget = (_a = menuRef === null || menuRef === void 0 ? void 0 : menuRef.current) === null || _a === void 0 ? void 0 : _a.contains(ev.target);
|
|
19239
|
+
if (isExpanded && menuContainsEventTarget && ev.key === 'Escape') {
|
|
19240
|
+
closeMenu();
|
|
19241
|
+
}
|
|
19242
|
+
};
|
|
19243
|
+
const handleClick = (ev) => {
|
|
19244
|
+
var _a, _b;
|
|
19245
|
+
const clickIsOutsideMenu = !((_a = menuRef === null || menuRef === void 0 ? void 0 : menuRef.current) === null || _a === void 0 ? void 0 : _a.contains(ev.target));
|
|
19246
|
+
const clickIsOutsideOverflowTab = !((_b = overflowTabRef === null || overflowTabRef === void 0 ? void 0 : overflowTabRef.current) === null || _b === void 0 ? void 0 : _b.contains(ev.target));
|
|
19247
|
+
if (isExpanded && clickIsOutsideMenu && clickIsOutsideOverflowTab) {
|
|
19248
|
+
closeMenu();
|
|
19249
|
+
}
|
|
19250
|
+
};
|
|
19251
|
+
React__default["default"].useEffect(() => {
|
|
19252
|
+
window.addEventListener('click', handleClick);
|
|
19253
|
+
window.addEventListener('keydown', handleMenuKeys);
|
|
19254
|
+
return () => {
|
|
19255
|
+
window.removeEventListener('click', handleClick);
|
|
19256
|
+
window.removeEventListener('keydown', handleMenuKeys);
|
|
19257
|
+
};
|
|
19258
|
+
}, [isExpanded, menuRef, overflowTabRef]);
|
|
19259
|
+
const selectedTab = overflowingTabs.find(tab => tab.eventKey === localActiveKey);
|
|
19260
|
+
const tabTitle = (selectedTab === null || selectedTab === void 0 ? void 0 : selectedTab.title) ? selectedTab.title : defaultTitleText;
|
|
19261
|
+
const toggleMenu = () => {
|
|
19262
|
+
setIsExpanded(prevIsExpanded => !prevIsExpanded);
|
|
19263
|
+
setTimeout(() => {
|
|
19264
|
+
if (menuRef === null || menuRef === void 0 ? void 0 : menuRef.current) {
|
|
19265
|
+
const firstElement = menuRef.current.querySelector('li > button,input:not(:disabled)');
|
|
19266
|
+
firstElement && firstElement.focus();
|
|
19267
|
+
}
|
|
19268
|
+
}, 0);
|
|
19269
|
+
};
|
|
19270
|
+
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),
|
|
19271
|
+
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 },
|
|
19272
|
+
React__default["default"].createElement(TabTitleText, null,
|
|
19273
|
+
tabTitle,
|
|
19274
|
+
showTabCount && tabTitle === defaultTitleText && ` (${overflowingTabs.length})`),
|
|
19275
|
+
React__default["default"].createElement("span", { className: styles$f.tabsLinkToggleIcon },
|
|
19276
|
+
React__default["default"].createElement(AngleRightIcon$1, null)))));
|
|
19277
|
+
const tabs = overflowingTabs.map(tab => (React__default["default"].createElement(MenuItem, { key: tab.eventKey, itemId: tab.eventKey, isSelected: localActiveKey === tab.eventKey }, tab.title)));
|
|
19278
|
+
const onTabSelect = (event, key) => {
|
|
19279
|
+
closeMenu();
|
|
19280
|
+
const selectedTabRef = overflowingTabs.find(tab => tab.eventKey === key).tabContentRef;
|
|
19281
|
+
handleTabClick(event, key, selectedTabRef);
|
|
19282
|
+
};
|
|
19283
|
+
const overflowMenu = (React__default["default"].createElement(Menu, { ref: menuRef, onSelect: (ev, itemId) => onTabSelect(ev, itemId) },
|
|
19284
|
+
React__default["default"].createElement(MenuContent, null,
|
|
19285
|
+
React__default["default"].createElement(MenuList, null, tabs))));
|
|
19286
|
+
return (React__default["default"].createElement(Popper, { trigger: overflowTab, popper: overflowMenu, isVisible: isExpanded, popperMatchesTriggerWidth: false, appendTo: overflowLIRef.current }));
|
|
19287
|
+
};
|
|
19288
|
+
OverflowTab.displayName = 'OverflowTab';
|
|
19289
|
+
|
|
19219
19290
|
exports.TabsComponent = void 0;
|
|
19220
19291
|
(function (TabsComponent) {
|
|
19221
19292
|
TabsComponent["div"] = "div";
|
|
@@ -19230,7 +19301,12 @@
|
|
|
19230
19301
|
super(props);
|
|
19231
19302
|
this.tabList = React__namespace.createRef();
|
|
19232
19303
|
this.scrollTimeout = null;
|
|
19304
|
+
this.countOverflowingElements = (container) => {
|
|
19305
|
+
const elements = Array.from(container.children);
|
|
19306
|
+
return elements.filter(element => !isElementInView(container, element, false)).length;
|
|
19307
|
+
};
|
|
19233
19308
|
this.handleScrollButtons = () => {
|
|
19309
|
+
const { isOverflowHorizontal: isOverflowHorizontal } = this.props;
|
|
19234
19310
|
// add debounce to the scroll event
|
|
19235
19311
|
clearTimeout(this.scrollTimeout);
|
|
19236
19312
|
this.scrollTimeout = setTimeout(() => {
|
|
@@ -19238,7 +19314,8 @@
|
|
|
19238
19314
|
let disableLeftScrollButton = true;
|
|
19239
19315
|
let disableRightScrollButton = true;
|
|
19240
19316
|
let showScrollButtons = false;
|
|
19241
|
-
|
|
19317
|
+
let overflowingTabCount = 0;
|
|
19318
|
+
if (container && !this.props.isVertical && !isOverflowHorizontal) {
|
|
19242
19319
|
// get first element and check if it is in view
|
|
19243
19320
|
const overflowOnLeft = !isElementInView(container, container.firstChild, false);
|
|
19244
19321
|
// get last element and check if it is in view
|
|
@@ -19247,10 +19324,14 @@
|
|
|
19247
19324
|
disableLeftScrollButton = !overflowOnLeft;
|
|
19248
19325
|
disableRightScrollButton = !overflowOnRight;
|
|
19249
19326
|
}
|
|
19327
|
+
if (isOverflowHorizontal) {
|
|
19328
|
+
overflowingTabCount = this.countOverflowingElements(container);
|
|
19329
|
+
}
|
|
19250
19330
|
this.setState({
|
|
19251
19331
|
showScrollButtons,
|
|
19252
19332
|
disableLeftScrollButton,
|
|
19253
|
-
disableRightScrollButton
|
|
19333
|
+
disableRightScrollButton,
|
|
19334
|
+
overflowingTabCount
|
|
19254
19335
|
});
|
|
19255
19336
|
}, 100);
|
|
19256
19337
|
};
|
|
@@ -19298,7 +19379,8 @@
|
|
|
19298
19379
|
shownKeys: this.props.defaultActiveKey !== undefined ? [this.props.defaultActiveKey] : [this.props.activeKey],
|
|
19299
19380
|
uncontrolledActiveKey: this.props.defaultActiveKey,
|
|
19300
19381
|
uncontrolledIsExpandedLocal: this.props.defaultIsExpanded,
|
|
19301
|
-
ouiaStateId: getDefaultOUIAId(Tabs.displayName)
|
|
19382
|
+
ouiaStateId: getDefaultOUIAId(Tabs.displayName),
|
|
19383
|
+
overflowingTabCount: 0
|
|
19302
19384
|
};
|
|
19303
19385
|
if (this.props.isVertical && this.props.expandable !== undefined) {
|
|
19304
19386
|
if (!this.props.toggleAriaLabel && !this.props.toggleText) {
|
|
@@ -19354,8 +19436,8 @@
|
|
|
19354
19436
|
clearTimeout(this.scrollTimeout);
|
|
19355
19437
|
}
|
|
19356
19438
|
componentDidUpdate(prevProps) {
|
|
19357
|
-
const { activeKey, mountOnEnter, children } = this.props;
|
|
19358
|
-
const { shownKeys } = this.state;
|
|
19439
|
+
const { activeKey, mountOnEnter, isOverflowHorizontal, children } = this.props;
|
|
19440
|
+
const { shownKeys, overflowingTabCount } = this.state;
|
|
19359
19441
|
if (prevProps.activeKey !== activeKey && mountOnEnter && shownKeys.indexOf(activeKey) < 0) {
|
|
19360
19442
|
this.setState({
|
|
19361
19443
|
shownKeys: shownKeys.concat(activeKey)
|
|
@@ -19366,13 +19448,20 @@
|
|
|
19366
19448
|
React__namespace.Children.toArray(prevProps.children).length !== React__namespace.Children.toArray(children).length) {
|
|
19367
19449
|
this.handleScrollButtons();
|
|
19368
19450
|
}
|
|
19451
|
+
const currentOverflowingTabCount = this.countOverflowingElements(this.tabList.current);
|
|
19452
|
+
if (isOverflowHorizontal && currentOverflowingTabCount) {
|
|
19453
|
+
this.setState({ overflowingTabCount: currentOverflowingTabCount + overflowingTabCount });
|
|
19454
|
+
}
|
|
19369
19455
|
}
|
|
19370
19456
|
render() {
|
|
19371
|
-
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"]);
|
|
19372
|
-
const { showScrollButtons, disableLeftScrollButton, disableRightScrollButton, shownKeys, uncontrolledActiveKey, uncontrolledIsExpandedLocal } = this.state;
|
|
19457
|
+
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"]);
|
|
19458
|
+
const { showScrollButtons, disableLeftScrollButton, disableRightScrollButton, shownKeys, uncontrolledActiveKey, uncontrolledIsExpandedLocal, overflowingTabCount } = this.state;
|
|
19373
19459
|
const filteredChildren = React__namespace.Children.toArray(children)
|
|
19374
19460
|
.filter(Boolean)
|
|
19375
19461
|
.filter(child => !child.props.isHidden);
|
|
19462
|
+
const filteredChildrenWithoutOverflow = filteredChildren.slice(0, filteredChildren.length - overflowingTabCount);
|
|
19463
|
+
const filteredChildrenOverflowing = filteredChildren.slice(filteredChildren.length - overflowingTabCount);
|
|
19464
|
+
const overflowingTabProps = filteredChildrenOverflowing.map((child) => child.props);
|
|
19376
19465
|
const uniqueId = id || getUniqueId();
|
|
19377
19466
|
const Component = component === exports.TabsComponent.nav ? 'nav' : 'div';
|
|
19378
19467
|
const localActiveKey = defaultActiveKey !== undefined ? uncontrolledActiveKey : activeKey;
|
|
@@ -19386,6 +19475,8 @@
|
|
|
19386
19475
|
onToggle(newValue);
|
|
19387
19476
|
}
|
|
19388
19477
|
};
|
|
19478
|
+
const hasOverflowTab = isOverflowHorizontal && overflowingTabCount > 0;
|
|
19479
|
+
const overflowObjectProps = typeof isOverflowHorizontal === 'object' ? Object.assign({}, isOverflowHorizontal) : {};
|
|
19389
19480
|
return (React__namespace.createElement(TabsContextProvider, { value: {
|
|
19390
19481
|
variant,
|
|
19391
19482
|
mountOnEnter,
|
|
@@ -19395,18 +19486,20 @@
|
|
|
19395
19486
|
handleTabClick: (...args) => this.handleTabClick(...args),
|
|
19396
19487
|
handleTabClose: onClose
|
|
19397
19488
|
} },
|
|
19398
|
-
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),
|
|
19489
|
+
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),
|
|
19399
19490
|
expandable && isVertical && (React__namespace.createElement(GenerateId, null, randomId => (React__namespace.createElement("div", { className: css(styles$f.tabsToggle) },
|
|
19400
19491
|
React__namespace.createElement("div", { className: css(styles$f.tabsToggleButton) },
|
|
19401
19492
|
React__namespace.createElement(Button, { onClick: () => toggleTabs(!isExpandedLocal), variant: "plain", "aria-label": toggleAriaLabel, "aria-expanded": isExpandedLocal, id: `${randomId}-button`, "aria-labelledby": `${randomId}-text ${randomId}-button` },
|
|
19402
19493
|
React__namespace.createElement("span", { className: css(styles$f.tabsToggleIcon) },
|
|
19403
19494
|
React__namespace.createElement(AngleRightIcon$1, { "arian-hidden": "true" })),
|
|
19404
19495
|
toggleText && (React__namespace.createElement("span", { className: css('pf-c-tabs__toggle-text'), id: `${randomId}-text` }, toggleText)))))))),
|
|
19405
|
-
React__namespace.createElement("button", { className: css(styles$f.tabsScrollButton, isSecondary && buttonStyles.modifiers.secondary), "aria-label": leftScrollAriaLabel, onClick: this.scrollLeft, disabled: disableLeftScrollButton, "aria-hidden": disableLeftScrollButton },
|
|
19406
|
-
React__namespace.createElement(AngleLeftIcon$1, null)),
|
|
19407
|
-
React__namespace.createElement("ul", { className: css(styles$f.tabsList), ref: this.tabList, onScroll: this.handleScrollButtons, role: "tablist" },
|
|
19408
|
-
|
|
19409
|
-
React__namespace.createElement(
|
|
19496
|
+
!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 },
|
|
19497
|
+
React__namespace.createElement(AngleLeftIcon$1, null))),
|
|
19498
|
+
React__namespace.createElement("ul", { className: css(styles$f.tabsList), ref: this.tabList, onScroll: this.handleScrollButtons, role: "tablist" },
|
|
19499
|
+
isOverflowHorizontal ? filteredChildrenWithoutOverflow : filteredChildren,
|
|
19500
|
+
hasOverflowTab && React__namespace.createElement(OverflowTab, Object.assign({ overflowingTabs: overflowingTabProps }, overflowObjectProps))),
|
|
19501
|
+
!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 },
|
|
19502
|
+
React__namespace.createElement(AngleRightIcon$1, null))),
|
|
19410
19503
|
onAdd !== undefined && (React__namespace.createElement("span", { className: css(styles$f.tabsAdd) },
|
|
19411
19504
|
React__namespace.createElement(Button, { variant: "plain", "aria-label": addButtonAriaLabel || 'Add tab', onClick: onAdd },
|
|
19412
19505
|
React__namespace.createElement(PlusIcon$1, null))))),
|
|
@@ -19443,12 +19536,6 @@
|
|
|
19443
19536
|
};
|
|
19444
19537
|
TabContentBody.displayName = 'TabContentBody';
|
|
19445
19538
|
|
|
19446
|
-
const TabTitleText = (_a) => {
|
|
19447
|
-
var { children, className = '' } = _a, props = __rest$1(_a, ["children", "className"]);
|
|
19448
|
-
return (React__namespace.createElement("span", Object.assign({ className: css(styles$f.tabsItemText, className) }, props), children));
|
|
19449
|
-
};
|
|
19450
|
-
TabTitleText.displayName = 'TabTitleText';
|
|
19451
|
-
|
|
19452
19539
|
const TabTitleIcon = (_a) => {
|
|
19453
19540
|
var { children, className = '' } = _a, props = __rest$1(_a, ["children", "className"]);
|
|
19454
19541
|
return (React__namespace.createElement("span", Object.assign({ className: css(styles$f.tabsItemIcon, className) }, props), children));
|
|
@@ -20599,7 +20686,7 @@
|
|
|
20599
20686
|
|
|
20600
20687
|
const TreeViewListItemBase = ({ name, title, id, isExpanded, defaultExpanded = false, children = null, onSelect, onCheck, hasCheck = false, checkProps = {
|
|
20601
20688
|
checked: false
|
|
20602
|
-
}, hasBadge = false, customBadgeContent, badgeProps = { isRead: true }, isCompact, activeItems = [], itemData, parentItem, icon, expandedIcon, action, compareItems,
|
|
20689
|
+
}, hasBadge = false, customBadgeContent, badgeProps = { isRead: true }, isSelectable = false, isCompact, activeItems = [], itemData, parentItem, icon, expandedIcon, action, compareItems,
|
|
20603
20690
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
20604
20691
|
useMemo }) => {
|
|
20605
20692
|
const [internalIsExpanded, setIsExpanded] = React.useState(defaultExpanded);
|
|
@@ -20611,13 +20698,22 @@
|
|
|
20611
20698
|
setIsExpanded(internalIsExpanded || defaultExpanded);
|
|
20612
20699
|
}
|
|
20613
20700
|
}, [isExpanded, defaultExpanded]);
|
|
20614
|
-
|
|
20615
|
-
|
|
20616
|
-
|
|
20617
|
-
|
|
20701
|
+
let Component = 'button';
|
|
20702
|
+
if (hasCheck) {
|
|
20703
|
+
Component = 'label';
|
|
20704
|
+
}
|
|
20705
|
+
else if (isSelectable) {
|
|
20706
|
+
Component = 'div';
|
|
20707
|
+
}
|
|
20708
|
+
const ToggleComponent = hasCheck || isSelectable ? 'button' : 'span';
|
|
20709
|
+
const renderToggle = (randomId) => (React__default["default"].createElement(ToggleComponent, Object.assign({ className: css(styles$9.treeViewNodeToggle), onClick: (evt) => {
|
|
20710
|
+
if (isSelectable || hasCheck) {
|
|
20618
20711
|
setIsExpanded(!internalIsExpanded);
|
|
20619
20712
|
}
|
|
20620
|
-
|
|
20713
|
+
if (isSelectable) {
|
|
20714
|
+
evt.stopPropagation();
|
|
20715
|
+
}
|
|
20716
|
+
} }, ((hasCheck || isSelectable) && { 'aria-labelledby': `label-${randomId}` }), { tabIndex: -1 }),
|
|
20621
20717
|
React__default["default"].createElement("span", { className: css(styles$9.treeViewNodeToggleIcon) },
|
|
20622
20718
|
React__default["default"].createElement(AngleRightIcon$1, { "aria-hidden": "true" }))));
|
|
20623
20719
|
const renderCheck = (randomId) => (React__default["default"].createElement("span", { className: css(styles$9.treeViewNodeCheck) },
|
|
@@ -20625,11 +20721,11 @@
|
|
|
20625
20721
|
const iconRendered = (React__default["default"].createElement("span", { className: css(styles$9.treeViewNodeIcon) },
|
|
20626
20722
|
!internalIsExpanded && icon,
|
|
20627
20723
|
internalIsExpanded && (expandedIcon || icon)));
|
|
20628
|
-
const renderNodeContent = (
|
|
20724
|
+
const renderNodeContent = () => {
|
|
20629
20725
|
const content = (React__default["default"].createElement(React__default["default"].Fragment, null,
|
|
20630
20726
|
isCompact && title && React__default["default"].createElement("span", { className: css(styles$9.treeViewNodeTitle) }, title),
|
|
20631
|
-
hasCheck ? (React__default["default"].createElement("
|
|
20632
|
-
return isCompact ? React__default["default"].createElement("
|
|
20727
|
+
hasCheck ? (React__default["default"].createElement("span", { className: css(styles$9.treeViewNodeText) }, name)) : (React__default["default"].createElement("span", { className: css(styles$9.treeViewNodeText) }, name))));
|
|
20728
|
+
return isCompact ? React__default["default"].createElement("span", { className: css(styles$9.treeViewNodeContent) }, content) : content;
|
|
20633
20729
|
};
|
|
20634
20730
|
const badgeRendered = (React__default["default"].createElement(React__default["default"].Fragment, null,
|
|
20635
20731
|
hasBadge && children && (React__default["default"].createElement("span", { className: css(styles$9.treeViewNodeCount) },
|
|
@@ -20638,7 +20734,7 @@
|
|
|
20638
20734
|
React__default["default"].createElement(Badge, Object.assign({}, badgeProps), customBadgeContent)))));
|
|
20639
20735
|
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 }),
|
|
20640
20736
|
React__default["default"].createElement("div", { className: css(styles$9.treeViewContent) },
|
|
20641
|
-
React__default["default"].createElement(GenerateId, { prefix:
|
|
20737
|
+
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) &&
|
|
20642
20738
|
activeItems &&
|
|
20643
20739
|
activeItems.length > 0 &&
|
|
20644
20740
|
activeItems.some(item => compareItems && item && compareItems(item, itemData))
|
|
@@ -20646,16 +20742,16 @@
|
|
|
20646
20742
|
: ''), onClick: (evt) => {
|
|
20647
20743
|
if (!hasCheck) {
|
|
20648
20744
|
onSelect && onSelect(evt, itemData, parentItem);
|
|
20649
|
-
if (children && evt.isDefaultPrevented() !== true) {
|
|
20745
|
+
if (!isSelectable && children && evt.isDefaultPrevented() !== true) {
|
|
20650
20746
|
setIsExpanded(!internalIsExpanded);
|
|
20651
20747
|
}
|
|
20652
20748
|
}
|
|
20653
|
-
}, tabIndex: -1 },
|
|
20654
|
-
React__default["default"].createElement("
|
|
20749
|
+
}, tabIndex: isSelectable ? 0 : -1 }, (hasCheck && { htmlFor: randomId }), ((hasCheck || (isSelectable && children)) && { id: `label-${randomId}` })),
|
|
20750
|
+
React__default["default"].createElement("span", { className: css(styles$9.treeViewNodeContainer) },
|
|
20655
20751
|
children && renderToggle(randomId),
|
|
20656
20752
|
hasCheck && renderCheck(randomId),
|
|
20657
20753
|
icon && iconRendered,
|
|
20658
|
-
renderNodeContent(
|
|
20754
|
+
renderNodeContent(),
|
|
20659
20755
|
badgeRendered)))),
|
|
20660
20756
|
action && React__default["default"].createElement("div", { className: css(styles$9.treeViewAction) }, action)),
|
|
20661
20757
|
internalIsExpanded && children));
|
|
@@ -20826,11 +20922,11 @@
|
|
|
20826
20922
|
}
|
|
20827
20923
|
|
|
20828
20924
|
const TreeView = (_a) => {
|
|
20829
|
-
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"]);
|
|
20925
|
+
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"]);
|
|
20830
20926
|
const treeViewList = (React__namespace.createElement(TreeViewList, { isNested: isNested, toolbar: toolbar }, data.map(item => {
|
|
20831
20927
|
var _a;
|
|
20832
|
-
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 && {
|
|
20833
|
-
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 }))
|
|
20928
|
+
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 && {
|
|
20929
|
+
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 }))
|
|
20834
20930
|
}))));
|
|
20835
20931
|
})));
|
|
20836
20932
|
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))));
|
|
@@ -22772,23 +22772,16 @@ svg.pf-c-spinner.pf-m-xl {
|
|
|
22772
22772
|
--pf-c-badge--m-read--BackgroundColor: var(--pf-c-tree-view__node-count--c-badge--m-read--BackgroundColor);
|
|
22773
22773
|
}
|
|
22774
22774
|
|
|
22775
|
-
.pf-c-tree-view__node.pf-m-selectable .pf-c-tree-view__node-toggle {
|
|
22776
|
-
--pf-c-tree-view__node-toggle--Color: var(--pf-c-tree-view__node-toggle--Color
|
|
22777
|
-
}
|
|
22778
|
-
|
|
22779
|
-
.pf-c-tree-view__node:hover,
|
|
22780
|
-
.pf-c-tree-view__node .pf-c-tree-view__node-toggle:hover {
|
|
22781
|
-
--pf-c-tree-view__node-toggle--Color: var(--pf-c-tree-view__node-toggle--hover__icon--Color);
|
|
22775
|
+
.pf-c-tree-view__node:not(.pf-m-selectable):hover, .pf-c-tree-view__node.pf-m-selectable .pf-c-tree-view__node-toggle:hover {
|
|
22776
|
+
--pf-c-tree-view__node-toggle--Color: var(--pf-c-tree-view__node-toggle--hover--Color);
|
|
22782
22777
|
}
|
|
22783
22778
|
|
|
22784
|
-
.pf-c-tree-view__node:focus,
|
|
22785
|
-
|
|
22786
|
-
--pf-c-tree-view__node-toggle--Color: var(--pf-c-tree-view__node-toggle--focus__icon--Color);
|
|
22779
|
+
.pf-c-tree-view__node:not(.pf-m-selectable):focus, .pf-c-tree-view__node.pf-m-selectable .pf-c-tree-view__node-toggle:focus {
|
|
22780
|
+
--pf-c-tree-view__node-toggle--Color: var(--pf-c-tree-view__node-toggle--focus--Color);
|
|
22787
22781
|
}
|
|
22788
22782
|
|
|
22789
|
-
.pf-c-tree-view__node:active,
|
|
22790
|
-
|
|
22791
|
-
--pf-c-tree-view__node-toggle--Color: var(--pf-c-tree-view__node-toggle--active__icon--Color);
|
|
22783
|
+
.pf-c-tree-view__node:not(.pf-m-selectable):active, .pf-c-tree-view__node.pf-m-selectable .pf-c-tree-view__node-toggle:active {
|
|
22784
|
+
--pf-c-tree-view__node-toggle--Color: var(--pf-c-tree-view__node-toggle--active--Color);
|
|
22792
22785
|
}
|
|
22793
22786
|
|
|
22794
22787
|
.pf-c-tree-view__node-container {
|