@patternfly/react-core 4.223.3 → 4.224.2

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.
Files changed (50) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/dist/esm/components/Select/Select.d.ts.map +1 -1
  3. package/dist/esm/components/Select/Select.js +25 -23
  4. package/dist/esm/components/Select/Select.js.map +1 -1
  5. package/dist/esm/components/Wizard/Wizard.d.ts +9 -0
  6. package/dist/esm/components/Wizard/Wizard.d.ts.map +1 -1
  7. package/dist/esm/components/Wizard/Wizard.js +6 -3
  8. package/dist/esm/components/Wizard/Wizard.js.map +1 -1
  9. package/dist/esm/components/Wizard/WizardBody.d.ts +6 -0
  10. package/dist/esm/components/Wizard/WizardBody.d.ts.map +1 -1
  11. package/dist/esm/components/Wizard/WizardBody.js +6 -2
  12. package/dist/esm/components/Wizard/WizardBody.js.map +1 -1
  13. package/dist/esm/components/Wizard/WizardDrawerWrapper.d.ts +11 -0
  14. package/dist/esm/components/Wizard/WizardDrawerWrapper.d.ts.map +1 -0
  15. package/dist/esm/components/Wizard/WizardDrawerWrapper.js +3 -0
  16. package/dist/esm/components/Wizard/WizardDrawerWrapper.js.map +1 -0
  17. package/dist/esm/components/Wizard/WizardToggle.d.ts +5 -1
  18. package/dist/esm/components/Wizard/WizardToggle.d.ts.map +1 -1
  19. package/dist/esm/components/Wizard/WizardToggle.js +4 -2
  20. package/dist/esm/components/Wizard/WizardToggle.js.map +1 -1
  21. package/dist/js/components/Select/Select.d.ts.map +1 -1
  22. package/dist/js/components/Select/Select.js +25 -23
  23. package/dist/js/components/Select/Select.js.map +1 -1
  24. package/dist/js/components/Wizard/Wizard.d.ts +9 -0
  25. package/dist/js/components/Wizard/Wizard.d.ts.map +1 -1
  26. package/dist/js/components/Wizard/Wizard.js +6 -3
  27. package/dist/js/components/Wizard/Wizard.js.map +1 -1
  28. package/dist/js/components/Wizard/WizardBody.d.ts +6 -0
  29. package/dist/js/components/Wizard/WizardBody.d.ts.map +1 -1
  30. package/dist/js/components/Wizard/WizardBody.js +6 -2
  31. package/dist/js/components/Wizard/WizardBody.js.map +1 -1
  32. package/dist/js/components/Wizard/WizardDrawerWrapper.d.ts +11 -0
  33. package/dist/js/components/Wizard/WizardDrawerWrapper.d.ts.map +1 -0
  34. package/dist/js/components/Wizard/WizardDrawerWrapper.js +7 -0
  35. package/dist/js/components/Wizard/WizardDrawerWrapper.js.map +1 -0
  36. package/dist/js/components/Wizard/WizardToggle.d.ts +5 -1
  37. package/dist/js/components/Wizard/WizardToggle.d.ts.map +1 -1
  38. package/dist/js/components/Wizard/WizardToggle.js +4 -2
  39. package/dist/js/components/Wizard/WizardToggle.js.map +1 -1
  40. package/dist/umd/react-core.js +42 -30
  41. package/dist/umd/react-core.min.js +4 -4
  42. package/package.json +5 -5
  43. package/src/components/Select/Select.tsx +35 -33
  44. package/src/components/Wizard/Wizard.tsx +21 -1
  45. package/src/components/Wizard/WizardBody.tsx +23 -2
  46. package/src/components/Wizard/WizardDrawerWrapper.tsx +18 -0
  47. package/src/components/Wizard/WizardToggle.tsx +12 -2
  48. package/src/components/Wizard/__tests__/Wizard.test.tsx +24 -7
  49. package/src/components/Wizard/examples/Wizard.md +157 -2
  50. package/src/demos/Wizard/WizardDemo.md +1033 -2
@@ -7527,30 +7527,32 @@
7527
7527
  this.refCollection[this.state.viewMoreNextIndex][0].focus();
7528
7528
  this.setState({ viewMoreNextIndex: -1 });
7529
7529
  }
7530
- const checkUpdatedChildren = (prevChildren, currChildren) => prevChildren.some((prevChild, index) => {
7531
- const prevChildProps = prevChild.props;
7532
- const currChild = currChildren[index];
7533
- const { props: currChildProps } = currChild;
7534
- if (prevChildProps && currChildProps) {
7535
- return (prevChildProps.value !== currChildProps.value ||
7536
- prevChildProps.label !== currChildProps.label ||
7537
- prevChildProps.isDisabled !== currChildProps.isDisabled ||
7538
- prevChildProps.isPlaceholder !== currChildProps.isPlaceholder);
7539
- }
7540
- else {
7541
- return prevChild !== currChild;
7530
+ if (this.props.variant === 'typeahead' || this.props.variant === 'typeaheadmulti') {
7531
+ const checkUpdatedChildren = (prevChildren, currChildren) => Array.from(prevChildren).some((prevChild, index) => {
7532
+ const prevChildProps = prevChild.props;
7533
+ const currChild = currChildren[index];
7534
+ const { props: currChildProps } = currChild;
7535
+ if (prevChildProps && currChildProps) {
7536
+ return (prevChildProps.value !== currChildProps.value ||
7537
+ prevChildProps.label !== currChildProps.label ||
7538
+ prevChildProps.isDisabled !== currChildProps.isDisabled ||
7539
+ prevChildProps.isPlaceholder !== currChildProps.isPlaceholder);
7540
+ }
7541
+ else {
7542
+ return prevChild !== currChild;
7543
+ }
7544
+ });
7545
+ const hasUpdatedChildren = prevProps.children.length !== this.props.children.length ||
7546
+ checkUpdatedChildren(prevProps.children, this.props.children) ||
7547
+ (this.props.isGrouped &&
7548
+ Array.from(prevProps.children).some((prevChild, index) => prevChild.type === SelectGroup &&
7549
+ prevChild.props.children &&
7550
+ this.props.children[index].props.children &&
7551
+ (prevChild.props.children.length !== this.props.children[index].props.children.length ||
7552
+ checkUpdatedChildren(prevChild.props.children, this.props.children[index].props.children))));
7553
+ if (hasUpdatedChildren) {
7554
+ this.updateTypeAheadFilteredChildren(prevState.typeaheadInputValue || '', null);
7542
7555
  }
7543
- });
7544
- const hasUpdatedChildren = prevProps.children.length !== this.props.children.length ||
7545
- checkUpdatedChildren(prevProps.children, this.props.children) ||
7546
- (this.props.isGrouped &&
7547
- prevProps.children.some((prevChild, index) => prevChild.type === SelectGroup &&
7548
- prevChild.props.children &&
7549
- this.props.children[index].props.children &&
7550
- (prevChild.props.children.length !== this.props.children[index].props.children.length ||
7551
- checkUpdatedChildren(prevChild.props.children, this.props.children[index].props.children))));
7552
- if (hasUpdatedChildren) {
7553
- this.updateTypeAheadFilteredChildren(prevState.typeaheadInputValue || '', null);
7554
7556
  }
7555
7557
  // for menus with favorites,
7556
7558
  // if the number of favorites or typeahead filtered children has changed, the generated
@@ -20883,14 +20885,19 @@
20883
20885
  React__namespace.createElement(Button, { variant: exports.ButtonVariant.link, onClick: onClose }, cancelButtonText)))));
20884
20886
  WizardFooterInternal.displayName = 'WizardFooterInternal';
20885
20887
 
20886
- const WizardBody = ({ children, hasNoBodyPadding = false, 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy, mainComponent = 'div' }) => {
20888
+ const WizardDrawerWrapper = ({ hasDrawer, wrapper, children }) => (hasDrawer ? wrapper(children) : children);
20889
+ WizardDrawerWrapper.displayName = 'WizardDrawerWrapper';
20890
+
20891
+ const WizardBody = ({ children, hasNoBodyPadding = false, 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy, mainComponent = 'div', hasDrawer, isDrawerExpanded, activeStep }) => {
20887
20892
  const MainComponent = mainComponent;
20888
20893
  return (React__namespace.createElement(MainComponent, { "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, className: css(styles$8.wizardMain) },
20889
- React__namespace.createElement("div", { className: css(styles$8.wizardMainBody, hasNoBodyPadding && styles$8.modifiers.noPadding) }, children)));
20894
+ React__namespace.createElement(WizardDrawerWrapper, { hasDrawer: hasDrawer && activeStep.drawerPanelContent, wrapper: (children) => (React__namespace.createElement(Drawer, { isInline: true, isExpanded: isDrawerExpanded },
20895
+ React__namespace.createElement(DrawerContent, { panelContent: activeStep.drawerPanelContent }, children))) },
20896
+ React__namespace.createElement("div", { className: css(styles$8.wizardMainBody, hasNoBodyPadding && styles$8.modifiers.noPadding) }, children))));
20890
20897
  };
20891
20898
  WizardBody.displayName = 'WizardBody';
20892
20899
 
20893
- const WizardToggle = ({ isNavOpen, onNavToggle, nav, steps, activeStep, children, hasNoBodyPadding = false, 'aria-label': ariaLabel = 'Wizard Toggle', mainAriaLabelledBy = null, mainAriaLabel = null, isInPage = true }) => {
20900
+ const WizardToggle = ({ isNavOpen, onNavToggle, nav, steps, activeStep, children, hasNoBodyPadding = false, 'aria-label': ariaLabel = 'Wizard Toggle', mainAriaLabelledBy = null, mainAriaLabel = null, isInPage = true, hasDrawer, isDrawerExpanded }) => {
20894
20901
  let activeStepIndex;
20895
20902
  let activeStepName;
20896
20903
  let activeStepSubName;
@@ -20925,7 +20932,9 @@
20925
20932
  React__namespace.createElement("div", { className: css(styles$8.wizardOuterWrap) },
20926
20933
  React__namespace.createElement("div", { className: css(styles$8.wizardInnerWrap) },
20927
20934
  nav(isNavOpen),
20928
- React__namespace.createElement(WizardBody, { mainComponent: isInPage ? 'div' : 'main', "aria-label": mainAriaLabel, "aria-labelledby": mainAriaLabelledBy, hasNoBodyPadding: hasNoBodyPadding }, activeStep.component)),
20935
+ React__namespace.createElement(WizardBody, { mainComponent: isInPage ? 'div' : 'main', "aria-label": mainAriaLabel, "aria-labelledby": mainAriaLabelledBy, hasNoBodyPadding: hasNoBodyPadding, activeStep: activeStep, isDrawerExpanded: isDrawerExpanded, hasDrawer: hasDrawer },
20936
+ hasDrawer && !isDrawerExpanded && activeStep.drawerToggleButton,
20937
+ activeStep.component)),
20929
20938
  children)));
20930
20939
  };
20931
20940
  WizardToggle.displayName = 'WizardToggle';
@@ -21132,6 +21141,7 @@
21132
21141
  currentStep: this.props.startAtStep && Number.isInteger(this.props.startAtStep) ? this.props.startAtStep : 1,
21133
21142
  isNavOpen: false
21134
21143
  };
21144
+ this.drawerRef = React__namespace.createRef();
21135
21145
  }
21136
21146
  componentDidMount() {
21137
21147
  const target = typeof document !== 'undefined' ? document.body : null;
@@ -21148,7 +21158,7 @@
21148
21158
  render() {
21149
21159
  const _a = this.props, {
21150
21160
  /* eslint-disable @typescript-eslint/no-unused-vars */
21151
- width, height, title, description, descriptionComponent, onClose, onSave, onBack, onNext, onGoToStep, className, steps, startAtStep, nextButtonText = 'Next', backButtonText = 'Back', cancelButtonText = 'Cancel', hideClose, closeButtonAriaLabel = 'Close', navAriaLabel, navAriaLabelledBy, mainAriaLabel, mainAriaLabelledBy, hasNoBodyPadding, footer, appendTo, isOpen, titleId, descriptionId, isNavExpandable } = _a, rest = __rest$1(_a, ["width", "height", "title", "description", "descriptionComponent", "onClose", "onSave", "onBack", "onNext", "onGoToStep", "className", "steps", "startAtStep", "nextButtonText", "backButtonText", "cancelButtonText", "hideClose", "closeButtonAriaLabel", "navAriaLabel", "navAriaLabelledBy", "mainAriaLabel", "mainAriaLabelledBy", "hasNoBodyPadding", "footer", "appendTo", "isOpen", "titleId", "descriptionId", "isNavExpandable"])
21161
+ width, height, title, description, descriptionComponent, onClose, onSave, onBack, onNext, onGoToStep, className, steps, startAtStep, nextButtonText = 'Next', backButtonText = 'Back', cancelButtonText = 'Cancel', hideClose, closeButtonAriaLabel = 'Close', navAriaLabel, navAriaLabelledBy, mainAriaLabel, mainAriaLabelledBy, hasNoBodyPadding, footer, appendTo, isOpen, titleId, descriptionId, isNavExpandable, hasDrawer, isDrawerExpanded } = _a, rest = __rest$1(_a, ["width", "height", "title", "description", "descriptionComponent", "onClose", "onSave", "onBack", "onNext", "onGoToStep", "className", "steps", "startAtStep", "nextButtonText", "backButtonText", "cancelButtonText", "hideClose", "closeButtonAriaLabel", "navAriaLabel", "navAriaLabelledBy", "mainAriaLabel", "mainAriaLabelledBy", "hasNoBodyPadding", "footer", "appendTo", "isOpen", "titleId", "descriptionId", "isNavExpandable", "hasDrawer", "isDrawerExpanded"])
21152
21162
  /* eslint-enable @typescript-eslint/no-unused-vars */
21153
21163
  ;
21154
21164
  const { currentStep } = this.state;
@@ -21212,7 +21222,7 @@
21212
21222
  const wizard = (React__namespace.createElement(WizardContextProvider, { value: context },
21213
21223
  React__namespace.createElement("div", Object.assign({}, rest, { className: css(styles$8.wizard, activeStep && activeStep.isFinishedStep && 'pf-m-finished', className), style: Object.keys(divStyles).length ? divStyles : undefined }),
21214
21224
  title && (React__namespace.createElement(WizardHeader, { titleId: this.titleId, descriptionId: this.descriptionId, onClose: onClose, title: title, description: description, descriptionComponent: descriptionComponent, closeButtonAriaLabel: closeButtonAriaLabel, hideClose: hideClose })),
21215
- React__namespace.createElement(WizardToggle, { mainAriaLabel: mainAriaLabel, isInPage: isOpen === undefined, mainAriaLabelledBy: (title || mainAriaLabelledBy) && (mainAriaLabelledBy || this.titleId), isNavOpen: this.state.isNavOpen, onNavToggle: isNavOpen => this.setState({ isNavOpen }), nav: nav, steps: steps, activeStep: activeStep, hasNoBodyPadding: hasNoBodyPadding }, footer || (React__namespace.createElement(WizardFooterInternal, { onNext: this.onNext, onBack: this.onBack, onClose: onClose, isValid: isValid, firstStep: firstStep, activeStep: activeStep, nextButtonText: (activeStep && activeStep.nextButtonText) || nextButtonText, backButtonText: backButtonText, cancelButtonText: cancelButtonText }))))));
21225
+ React__namespace.createElement(WizardToggle, { hasDrawer: hasDrawer, isDrawerExpanded: isDrawerExpanded, mainAriaLabel: mainAriaLabel, isInPage: isOpen === undefined, mainAriaLabelledBy: (title || mainAriaLabelledBy) && (mainAriaLabelledBy || this.titleId), isNavOpen: this.state.isNavOpen, onNavToggle: isNavOpen => this.setState({ isNavOpen }), nav: nav, steps: steps, activeStep: activeStep, hasNoBodyPadding: hasNoBodyPadding }, footer || (React__namespace.createElement(WizardFooterInternal, { onNext: this.onNext, onBack: this.onBack, onClose: onClose, isValid: isValid, firstStep: firstStep, activeStep: activeStep, nextButtonText: (activeStep && activeStep.nextButtonText) || nextButtonText, backButtonText: backButtonText, cancelButtonText: cancelButtonText }))))));
21216
21226
  if (isOpen !== undefined) {
21217
21227
  return (React__namespace.createElement(Modal, { width: width !== null ? width : undefined, isOpen: isOpen, variant: exports.ModalVariant.large, "aria-labelledby": this.titleId, "aria-describedby": this.descriptionId, showClose: false, hasNoBodyWrapper: true }, wizard));
21218
21228
  }
@@ -21246,7 +21256,9 @@
21246
21256
  onClose: () => undefined,
21247
21257
  appendTo: null,
21248
21258
  isOpen: undefined,
21249
- isNavExpandable: false
21259
+ isNavExpandable: false,
21260
+ hasDrawer: false,
21261
+ isDrawerExpanded: false
21250
21262
  };
21251
21263
 
21252
21264
  const WizardFooter = ({ children }) => (React__namespace.createElement("footer", { className: css(styles$8.wizardFooter) }, children));