@patternfly/react-core 4.158.4 → 4.159.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/Select/Select.d.ts +3 -0
- package/dist/esm/components/Select/Select.d.ts.map +1 -1
- package/dist/esm/components/Select/Select.js +2 -1
- package/dist/esm/components/Select/Select.js.map +1 -1
- package/dist/esm/components/Select/SelectMenu.d.ts +3 -0
- package/dist/esm/components/Select/SelectMenu.d.ts.map +1 -1
- package/dist/esm/components/Select/SelectMenu.js +4 -3
- package/dist/esm/components/Select/SelectMenu.js.map +1 -1
- package/dist/esm/components/Select/selectConstants.d.ts +4 -0
- package/dist/esm/components/Select/selectConstants.d.ts.map +1 -1
- package/dist/esm/components/Select/selectConstants.js +5 -0
- package/dist/esm/components/Select/selectConstants.js.map +1 -1
- package/dist/esm/components/Tabs/Tabs.d.ts +20 -0
- package/dist/esm/components/Tabs/Tabs.d.ts.map +1 -1
- package/dist/esm/components/Tabs/Tabs.js +44 -14
- package/dist/esm/components/Tabs/Tabs.js.map +1 -1
- package/dist/esm/components/Wizard/WizardNavItem.js +1 -1
- package/dist/js/components/Select/Select.d.ts +3 -0
- package/dist/js/components/Select/Select.d.ts.map +1 -1
- package/dist/js/components/Select/Select.js +1 -0
- package/dist/js/components/Select/Select.js.map +1 -1
- package/dist/js/components/Select/SelectMenu.d.ts +3 -0
- package/dist/js/components/Select/SelectMenu.d.ts.map +1 -1
- package/dist/js/components/Select/SelectMenu.js +3 -2
- package/dist/js/components/Select/SelectMenu.js.map +1 -1
- package/dist/js/components/Select/selectConstants.d.ts +4 -0
- package/dist/js/components/Select/selectConstants.d.ts.map +1 -1
- package/dist/js/components/Select/selectConstants.js +6 -1
- package/dist/js/components/Select/selectConstants.js.map +1 -1
- package/dist/js/components/Tabs/Tabs.d.ts +20 -0
- package/dist/js/components/Tabs/Tabs.d.ts.map +1 -1
- package/dist/js/components/Tabs/Tabs.js +44 -14
- package/dist/js/components/Tabs/Tabs.js.map +1 -1
- package/dist/js/components/Wizard/WizardNavItem.js +1 -1
- package/dist/umd/react-core.css +11237 -11237
- package/dist/umd/react-core.js +51 -17
- package/dist/umd/react-core.min.css +12076 -12076
- package/dist/umd/react-core.min.js +2 -2
- package/package.json +2 -2
- package/src/components/Drawer/examples/Drawer.md +0 -78
- package/src/components/Page/examples/Page.md +289 -103
- package/src/components/Select/Select.tsx +4 -1
- package/src/components/Select/SelectMenu.tsx +10 -2
- package/src/components/Select/__tests__/Generated/__snapshots__/SelectMenu.test.tsx.snap +1 -0
- package/src/components/Select/__tests__/__snapshots__/Select.test.tsx.snap +57 -0
- package/src/components/Select/selectConstants.tsx +5 -0
- package/src/components/Tabs/Tabs.tsx +97 -13
- package/src/components/Tabs/__tests__/Generated/__snapshots__/Tabs.test.tsx.snap +4 -4
- package/src/components/Tabs/__tests__/Tabs.test.tsx +50 -0
- package/src/components/Tabs/__tests__/__snapshots__/Tabs.test.tsx.snap +276 -30
- package/src/components/Tabs/examples/Tabs.md +96 -0
- package/src/components/Wizard/WizardNavItem.tsx +1 -1
- package/src/demos/ComposableMenu.md +125 -17
- package/src/demos/Page/Page.md +322 -12
package/dist/umd/react-core.js
CHANGED
|
@@ -5947,6 +5947,10 @@
|
|
|
5947
5947
|
SelectVariant["typeahead"] = "typeahead";
|
|
5948
5948
|
SelectVariant["typeaheadMulti"] = "typeaheadmulti";
|
|
5949
5949
|
})(exports.SelectVariant || (exports.SelectVariant = {}));
|
|
5950
|
+
(function (SelectPosition) {
|
|
5951
|
+
SelectPosition["right"] = "right";
|
|
5952
|
+
SelectPosition["left"] = "left";
|
|
5953
|
+
})(exports.SelectPosition || (exports.SelectPosition = {}));
|
|
5950
5954
|
(function (SelectDirection) {
|
|
5951
5955
|
SelectDirection["up"] = "up";
|
|
5952
5956
|
SelectDirection["down"] = "down";
|
|
@@ -6218,10 +6222,10 @@
|
|
|
6218
6222
|
}
|
|
6219
6223
|
renderSelectMenu({ variant, inputIdPrefix }) {
|
|
6220
6224
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
6221
|
-
const _a = this.props, { children, isCustomContent, className, isExpanded, openedOnEnter, selected, checked, isGrouped, sendRef, keyHandler, maxHeight, noResultsFoundText, createText, 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy, hasInlineFilter, innerRef, footer, footerRef, isLastOptionBeforeFooter } = _a, props = __rest(_a, ["children", "isCustomContent", "className", "isExpanded", "openedOnEnter", "selected", "checked", "isGrouped", "sendRef", "keyHandler", "maxHeight", "noResultsFoundText", "createText", 'aria-label', 'aria-labelledby', "hasInlineFilter", "innerRef", "footer", "footerRef", "isLastOptionBeforeFooter"]);
|
|
6225
|
+
const _a = this.props, { children, isCustomContent, className, isExpanded, openedOnEnter, selected, checked, isGrouped, position, sendRef, keyHandler, maxHeight, noResultsFoundText, createText, 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy, hasInlineFilter, innerRef, footer, footerRef, isLastOptionBeforeFooter } = _a, props = __rest(_a, ["children", "isCustomContent", "className", "isExpanded", "openedOnEnter", "selected", "checked", "isGrouped", "position", "sendRef", "keyHandler", "maxHeight", "noResultsFoundText", "createText", 'aria-label', 'aria-labelledby', "hasInlineFilter", "innerRef", "footer", "footerRef", "isLastOptionBeforeFooter"]);
|
|
6222
6226
|
/* eslint-enable @typescript-eslint/no-unused-vars */
|
|
6223
6227
|
let Component = 'div';
|
|
6224
|
-
const variantProps = Object.assign({ ref: innerRef, className: css(!footer ? styles$j.selectMenu : 'pf-c-select__menu-list', className) }, (maxHeight && { style: { maxHeight, overflow: 'auto' } }));
|
|
6228
|
+
const variantProps = Object.assign({ ref: innerRef, className: css(!footer ? styles$j.selectMenu : 'pf-c-select__menu-list', position === exports.SelectPosition.right && styles$j.modifiers.alignRight, className) }, (maxHeight && { style: { maxHeight, overflow: 'auto' } }));
|
|
6225
6229
|
const extendedChildren = () => variant === exports.SelectVariant.checkbox
|
|
6226
6230
|
? this.extendCheckboxChildren(children)
|
|
6227
6231
|
: this.extendChildren(inputIdPrefix);
|
|
@@ -6263,6 +6267,7 @@
|
|
|
6263
6267
|
openedOnEnter: false,
|
|
6264
6268
|
selected: '',
|
|
6265
6269
|
maxHeight: '',
|
|
6270
|
+
position: exports.SelectPosition.left,
|
|
6266
6271
|
sendRef: () => { },
|
|
6267
6272
|
keyHandler: () => { },
|
|
6268
6273
|
isCustomContent: false,
|
|
@@ -7263,6 +7268,7 @@
|
|
|
7263
7268
|
Select.defaultProps = {
|
|
7264
7269
|
children: [],
|
|
7265
7270
|
className: '',
|
|
7271
|
+
position: exports.SelectPosition.left,
|
|
7266
7272
|
direction: exports.SelectDirection.down,
|
|
7267
7273
|
toggleId: null,
|
|
7268
7274
|
isOpen: false,
|
|
@@ -17366,20 +17372,23 @@
|
|
|
17366
17372
|
this.tabList = React.createRef();
|
|
17367
17373
|
this.handleScrollButtons = () => {
|
|
17368
17374
|
const container = this.tabList.current;
|
|
17375
|
+
let disableLeftScrollButton = true;
|
|
17376
|
+
let disableRightScrollButton = true;
|
|
17377
|
+
let showScrollButtons = false;
|
|
17369
17378
|
if (container && !this.props.isVertical) {
|
|
17370
17379
|
// get first element and check if it is in view
|
|
17371
17380
|
const overflowOnLeft = !isElementInView(container, container.firstChild, false);
|
|
17372
17381
|
// get last element and check if it is in view
|
|
17373
17382
|
const overflowOnRight = !isElementInView(container, container.lastChild, false);
|
|
17374
|
-
|
|
17375
|
-
|
|
17376
|
-
|
|
17377
|
-
this.setState({
|
|
17378
|
-
showScrollButtons,
|
|
17379
|
-
disableLeftScrollButton,
|
|
17380
|
-
disableRightScrollButton
|
|
17381
|
-
});
|
|
17383
|
+
showScrollButtons = overflowOnLeft || overflowOnRight;
|
|
17384
|
+
disableLeftScrollButton = !overflowOnLeft;
|
|
17385
|
+
disableRightScrollButton = !overflowOnRight;
|
|
17382
17386
|
}
|
|
17387
|
+
this.setState({
|
|
17388
|
+
showScrollButtons,
|
|
17389
|
+
disableLeftScrollButton,
|
|
17390
|
+
disableRightScrollButton
|
|
17391
|
+
});
|
|
17383
17392
|
};
|
|
17384
17393
|
this.scrollLeft = () => {
|
|
17385
17394
|
// find first Element that is fully in view on the left, then scroll to the element before it
|
|
@@ -17420,12 +17429,19 @@
|
|
|
17420
17429
|
};
|
|
17421
17430
|
this.state = {
|
|
17422
17431
|
showScrollButtons: false,
|
|
17423
|
-
disableLeftScrollButton:
|
|
17424
|
-
disableRightScrollButton:
|
|
17432
|
+
disableLeftScrollButton: true,
|
|
17433
|
+
disableRightScrollButton: true,
|
|
17425
17434
|
shownKeys: this.props.defaultActiveKey !== undefined ? [this.props.defaultActiveKey] : [this.props.activeKey],
|
|
17426
17435
|
uncontrolledActiveKey: this.props.defaultActiveKey,
|
|
17436
|
+
uncontrolledIsExpandedLocal: this.props.defaultIsExpanded,
|
|
17427
17437
|
ouiaStateId: getDefaultOUIAId(Tabs.displayName)
|
|
17428
17438
|
};
|
|
17439
|
+
if (this.props.isVertical && this.props.expandable !== undefined) {
|
|
17440
|
+
if (!this.props.toggleAriaLabel && !this.props.toggleText) {
|
|
17441
|
+
// eslint-disable-next-line no-console
|
|
17442
|
+
console.error('Tabs:', 'toggleAriaLabel or the toggleText prop is required to make the toggle button accessible');
|
|
17443
|
+
}
|
|
17444
|
+
}
|
|
17429
17445
|
}
|
|
17430
17446
|
handleTabClick(event, eventKey, tabContentRef) {
|
|
17431
17447
|
// When tab is an achor tag with href, cancel navigation event
|
|
@@ -17484,14 +17500,24 @@
|
|
|
17484
17500
|
}
|
|
17485
17501
|
}
|
|
17486
17502
|
render() {
|
|
17487
|
-
const _a = this.props, { className, children, activeKey, defaultActiveKey, id, isFilled, isSecondary, isVertical, isBox, leftScrollAriaLabel, rightScrollAriaLabel, 'aria-label': ariaLabel, component, ouiaId, ouiaSafe, mountOnEnter, unmountOnExit, usePageInsets, inset, variant } = _a, props = __rest(_a, ["className", "children", "activeKey", "defaultActiveKey", "id", "isFilled", "isSecondary", "isVertical", "isBox", "leftScrollAriaLabel", "rightScrollAriaLabel", 'aria-label', "component", "ouiaId", "ouiaSafe", "mountOnEnter", "unmountOnExit", "usePageInsets", "inset", "variant"]);
|
|
17488
|
-
const { showScrollButtons, disableLeftScrollButton, disableRightScrollButton, shownKeys, uncontrolledActiveKey } = this.state;
|
|
17503
|
+
const _a = this.props, { className, children, activeKey, defaultActiveKey, id, isFilled, isSecondary, isVertical, isBox, leftScrollAriaLabel, rightScrollAriaLabel, 'aria-label': ariaLabel, component, ouiaId, ouiaSafe, mountOnEnter, unmountOnExit, usePageInsets, inset, variant, expandable, isExpanded, defaultIsExpanded, toggleText, toggleAriaLabel, onToggle } = _a, props = __rest(_a, ["className", "children", "activeKey", "defaultActiveKey", "id", "isFilled", "isSecondary", "isVertical", "isBox", "leftScrollAriaLabel", "rightScrollAriaLabel", 'aria-label', "component", "ouiaId", "ouiaSafe", "mountOnEnter", "unmountOnExit", "usePageInsets", "inset", "variant", "expandable", "isExpanded", "defaultIsExpanded", "toggleText", "toggleAriaLabel", "onToggle"]);
|
|
17504
|
+
const { showScrollButtons, disableLeftScrollButton, disableRightScrollButton, shownKeys, uncontrolledActiveKey, uncontrolledIsExpandedLocal } = this.state;
|
|
17489
17505
|
const filteredChildren = React.Children.toArray(children)
|
|
17490
17506
|
.filter(Boolean)
|
|
17491
17507
|
.filter(child => !child.props.isHidden);
|
|
17492
17508
|
const uniqueId = id || getUniqueId();
|
|
17493
17509
|
const Component = component === exports.TabsComponent.nav ? 'nav' : 'div';
|
|
17494
17510
|
const localActiveKey = defaultActiveKey !== undefined ? uncontrolledActiveKey : activeKey;
|
|
17511
|
+
const isExpandedLocal = defaultIsExpanded !== undefined ? uncontrolledIsExpandedLocal : isExpanded;
|
|
17512
|
+
/* Uncontrolled expandable tabs */
|
|
17513
|
+
const toggleTabs = (newValue) => {
|
|
17514
|
+
if (isExpanded === undefined) {
|
|
17515
|
+
this.setState({ uncontrolledIsExpandedLocal: newValue });
|
|
17516
|
+
}
|
|
17517
|
+
else {
|
|
17518
|
+
onToggle(newValue);
|
|
17519
|
+
}
|
|
17520
|
+
};
|
|
17495
17521
|
return (React.createElement(TabsContextProvider, { value: {
|
|
17496
17522
|
variant,
|
|
17497
17523
|
mountOnEnter,
|
|
@@ -17500,7 +17526,13 @@
|
|
|
17500
17526
|
uniqueId,
|
|
17501
17527
|
handleTabClick: (...args) => this.handleTabClick(...args)
|
|
17502
17528
|
} },
|
|
17503
|
-
React.createElement(Component, Object.assign({ "aria-label": ariaLabel, className: css(styles$10.tabs, isFilled && styles$10.modifiers.fill, isSecondary && styles$10.modifiers.secondary, isVertical && styles$10.modifiers.vertical, isBox && styles$10.modifiers.box, showScrollButtons && !isVertical && styles$10.modifiers.scrollable, usePageInsets && styles$10.modifiers.pageInsets, formatBreakpointMods(inset, styles$10), variantStyle$3[variant], className) }, getOUIAProps(Tabs.displayName, ouiaId !== undefined ? ouiaId : this.state.ouiaStateId, ouiaSafe), { id: id && id }, props),
|
|
17529
|
+
React.createElement(Component, Object.assign({ "aria-label": ariaLabel, className: css(styles$10.tabs, isFilled && styles$10.modifiers.fill, isSecondary && styles$10.modifiers.secondary, isVertical && styles$10.modifiers.vertical, isVertical && expandable && formatBreakpointMods(expandable, styles$10), isVertical && expandable && isExpandedLocal && styles$10.modifiers.expanded, isBox && styles$10.modifiers.box, showScrollButtons && !isVertical && styles$10.modifiers.scrollable, usePageInsets && styles$10.modifiers.pageInsets, formatBreakpointMods(inset, styles$10), variantStyle$3[variant], className) }, getOUIAProps(Tabs.displayName, ouiaId !== undefined ? ouiaId : this.state.ouiaStateId, ouiaSafe), { id: id && id }, props),
|
|
17530
|
+
expandable && isVertical && (React.createElement(GenerateId, null, randomId => (React.createElement("div", { className: css(styles$10.tabsToggle) },
|
|
17531
|
+
React.createElement("div", { className: css(styles$10.tabsToggleButton) },
|
|
17532
|
+
React.createElement(Button, { onClick: () => toggleTabs(!isExpandedLocal), variant: "plain", "aria-label": toggleAriaLabel, "aria-expanded": isExpandedLocal, id: `${randomId}-button`, "aria-labelledby": `${randomId}-text ${randomId}-button` },
|
|
17533
|
+
React.createElement("span", { className: css(styles$10.tabsToggleIcon) },
|
|
17534
|
+
React.createElement(AngleRightIcon, { "arian-hidden": "true" })),
|
|
17535
|
+
toggleText && (React.createElement("span", { className: css('pf-c-tabs__toggle-text'), id: `${randomId}-text` }, toggleText)))))))),
|
|
17504
17536
|
React.createElement("button", { className: css(styles$10.tabsScrollButton, isSecondary && buttonStyles.modifiers.secondary), "aria-label": leftScrollAriaLabel, onClick: this.scrollLeft, disabled: disableLeftScrollButton, "aria-hidden": disableLeftScrollButton },
|
|
17505
17537
|
React.createElement(AngleLeftIcon, null)),
|
|
17506
17538
|
React.createElement("ul", { className: css(styles$10.tabsList), ref: this.tabList, onScroll: this.handleScrollButtons }, filteredChildren),
|
|
@@ -17527,7 +17559,9 @@
|
|
|
17527
17559
|
mountOnEnter: false,
|
|
17528
17560
|
unmountOnExit: false,
|
|
17529
17561
|
ouiaSafe: true,
|
|
17530
|
-
variant: 'default'
|
|
17562
|
+
variant: 'default',
|
|
17563
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
17564
|
+
onToggle: (isExpanded) => undefined
|
|
17531
17565
|
};
|
|
17532
17566
|
|
|
17533
17567
|
const TabTitleText = (_a) => {
|
|
@@ -18952,7 +18986,7 @@
|
|
|
18952
18986
|
href
|
|
18953
18987
|
};
|
|
18954
18988
|
return (React.createElement("li", { className: css(styles$17.wizardNavItem, isExpandable && styles$17.modifiers.expandable, isExpandable && isExpanded && styles$17.modifiers.expanded) },
|
|
18955
|
-
React.createElement(NavItemComponent, Object.assign({}, rest, (navItemComponent === 'a' ? Object.assign({}, linkProps) : Object.assign({}, btnProps)), { onClick: () => (isExpandable ? setIsExpanded(!isExpanded || isCurrent) : onNavItemClick(step)), className: css(styles$17.wizardNavLink, isCurrent && styles$17.modifiers.current, isDisabled && styles$17.modifiers.disabled), "aria-disabled": isDisabled ? true : null, "aria-current": isCurrent && !children ? '
|
|
18989
|
+
React.createElement(NavItemComponent, Object.assign({}, rest, (navItemComponent === 'a' ? Object.assign({}, linkProps) : Object.assign({}, btnProps)), { onClick: () => (isExpandable ? setIsExpanded(!isExpanded || isCurrent) : onNavItemClick(step)), className: css(styles$17.wizardNavLink, isCurrent && styles$17.modifiers.current, isDisabled && styles$17.modifiers.disabled), "aria-disabled": isDisabled ? true : null, "aria-current": isCurrent && !children ? 'step' : false }, (isExpandable && { 'aria-expanded': isExpanded })), isExpandable ? (React.createElement(React.Fragment, null,
|
|
18956
18990
|
React.createElement("span", { className: css(styles$17.wizardNavLinkText) }, content),
|
|
18957
18991
|
React.createElement("span", { className: css(styles$17.wizardNavLinkToggle) },
|
|
18958
18992
|
React.createElement("span", { className: css(styles$17.wizardNavLinkToggleIcon) },
|