@patternfly/react-core 4.162.1 → 4.162.5

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 (37) hide show
  1. package/CHANGELOG.md +38 -0
  2. package/dist/esm/components/FormSelect/FormSelectOption.d.ts +1 -0
  3. package/dist/esm/components/FormSelect/FormSelectOption.d.ts.map +1 -1
  4. package/dist/esm/components/TreeView/TreeView.d.ts +2 -0
  5. package/dist/esm/components/TreeView/TreeView.d.ts.map +1 -1
  6. package/dist/esm/components/TreeView/TreeView.js +2 -2
  7. package/dist/esm/components/TreeView/TreeView.js.map +1 -1
  8. package/dist/esm/components/TreeView/TreeViewListItem.d.ts +3 -1
  9. package/dist/esm/components/TreeView/TreeViewListItem.d.ts.map +1 -1
  10. package/dist/esm/components/TreeView/TreeViewListItem.js +39 -2
  11. package/dist/esm/components/TreeView/TreeViewListItem.js.map +1 -1
  12. package/dist/esm/components/Wizard/WizardToggle.js +3 -3
  13. package/dist/esm/components/Wizard/WizardToggle.js.map +1 -1
  14. package/dist/js/components/FormSelect/FormSelectOption.d.ts +1 -0
  15. package/dist/js/components/FormSelect/FormSelectOption.d.ts.map +1 -1
  16. package/dist/js/components/TreeView/TreeView.d.ts +2 -0
  17. package/dist/js/components/TreeView/TreeView.d.ts.map +1 -1
  18. package/dist/js/components/TreeView/TreeView.js +2 -2
  19. package/dist/js/components/TreeView/TreeView.js.map +1 -1
  20. package/dist/js/components/TreeView/TreeViewListItem.d.ts +3 -1
  21. package/dist/js/components/TreeView/TreeViewListItem.d.ts.map +1 -1
  22. package/dist/js/components/TreeView/TreeViewListItem.js +39 -3
  23. package/dist/js/components/TreeView/TreeViewListItem.js.map +1 -1
  24. package/dist/js/components/Wizard/WizardToggle.js +3 -3
  25. package/dist/js/components/Wizard/WizardToggle.js.map +1 -1
  26. package/dist/umd/react-core.css +8658 -8658
  27. package/dist/umd/react-core.js +44 -7
  28. package/dist/umd/react-core.min.css +14346 -14345
  29. package/dist/umd/react-core.min.js +1 -1
  30. package/package.json +6 -6
  31. package/src/components/FormSelect/FormSelectOption.tsx +1 -1
  32. package/src/components/Nav/examples/Nav.md +1 -1
  33. package/src/components/TreeView/TreeView.tsx +4 -0
  34. package/src/components/TreeView/TreeViewListItem.tsx +55 -3
  35. package/src/components/TreeView/examples/TreeView.md +286 -176
  36. package/src/components/Wizard/WizardToggle.tsx +5 -5
  37. package/src/components/Wizard/__tests__/Generated/__snapshots__/WizardToggle.test.tsx.snap +4 -4
@@ -18425,9 +18425,11 @@
18425
18425
  "treeViewSearch": "pf-c-tree-view__search"
18426
18426
  };
18427
18427
 
18428
- const TreeViewListItem = ({ name, title, id, isExpanded, defaultExpanded = false, children = null, onSelect, onCheck, hasCheck = false, checkProps = {
18428
+ const TreeViewListItemBase = ({ name, title, id, isExpanded, defaultExpanded = false, children = null, onSelect, onCheck, hasCheck = false, checkProps = {
18429
18429
  checked: false
18430
- }, hasBadge = false, customBadgeContent, badgeProps = { isRead: true }, isCompact, activeItems = [], itemData, parentItem, icon, expandedIcon, action, compareItems }) => {
18430
+ }, hasBadge = false, customBadgeContent, badgeProps = { isRead: true }, isCompact, activeItems = [], itemData, parentItem, icon, expandedIcon, action, compareItems,
18431
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
18432
+ useMemo }) => {
18431
18433
  const [internalIsExpanded, setIsExpanded] = React.useState(defaultExpanded);
18432
18434
  React.useEffect(() => {
18433
18435
  if (isExpanded !== undefined && isExpanded !== null) {
@@ -18486,6 +18488,41 @@
18486
18488
  action && React__default["default"].createElement("div", { className: css(_default$8.treeViewAction) }, action)),
18487
18489
  internalIsExpanded && children));
18488
18490
  };
18491
+ const TreeViewListItem = React__default["default"].memo(TreeViewListItemBase, (prevProps, nextProps) => {
18492
+ if (!nextProps.useMemo) {
18493
+ return false;
18494
+ }
18495
+ const prevIncludes = prevProps.activeItems &&
18496
+ prevProps.activeItems.length > 0 &&
18497
+ prevProps.activeItems.some(item => prevProps.compareItems && item && prevProps.compareItems(item, prevProps.itemData));
18498
+ const nextIncludes = nextProps.activeItems &&
18499
+ nextProps.activeItems.length > 0 &&
18500
+ nextProps.activeItems.some(item => nextProps.compareItems && item && nextProps.compareItems(item, nextProps.itemData));
18501
+ if (prevIncludes || nextIncludes) {
18502
+ return false;
18503
+ }
18504
+ if (prevProps.name !== nextProps.name ||
18505
+ prevProps.title !== nextProps.title ||
18506
+ prevProps.id !== nextProps.id ||
18507
+ prevProps.isExpanded !== nextProps.isExpanded ||
18508
+ prevProps.defaultExpanded !== nextProps.defaultExpanded ||
18509
+ prevProps.onSelect !== nextProps.onSelect ||
18510
+ prevProps.onCheck !== nextProps.onCheck ||
18511
+ prevProps.hasCheck !== nextProps.hasCheck ||
18512
+ prevProps.checkProps !== nextProps.checkProps ||
18513
+ prevProps.hasBadge !== nextProps.hasBadge ||
18514
+ prevProps.customBadgeContent !== nextProps.customBadgeContent ||
18515
+ prevProps.badgeProps !== nextProps.badgeProps ||
18516
+ prevProps.isCompact !== nextProps.isCompact ||
18517
+ prevProps.icon !== nextProps.icon ||
18518
+ prevProps.expandedIcon !== nextProps.expandedIcon ||
18519
+ prevProps.action !== nextProps.action ||
18520
+ prevProps.parentItem !== nextProps.parentItem ||
18521
+ prevProps.itemData !== nextProps.itemData) {
18522
+ return false;
18523
+ }
18524
+ return true;
18525
+ });
18489
18526
  TreeViewListItem.displayName = 'TreeViewListItem';
18490
18527
 
18491
18528
  class TreeViewRoot extends React__namespace.Component {
@@ -18617,10 +18654,10 @@
18617
18654
  }
18618
18655
 
18619
18656
  const TreeView = (_a) => {
18620
- 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 } = _a, props = __rest$1(_a, ["data", "isNested", "hasChecks", "hasBadges", "hasGuides", "variant", "defaultAllExpanded", "allExpanded", "icon", "expandedIcon", "parentItem", "onSelect", "onCheck", "toolbar", "activeItems", "compareItems", "className"]);
18657
+ 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"]);
18621
18658
  const treeViewList = (React__namespace.createElement(TreeViewList, { isNested: isNested, toolbar: toolbar }, data.map(item => {
18622
18659
  var _a;
18623
- 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' }, (item.children && {
18660
+ 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 && {
18624
18661
  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 }))
18625
18662
  }))));
18626
18663
  })));
@@ -18711,13 +18748,13 @@
18711
18748
  }
18712
18749
  return (React__namespace.createElement(React__namespace.Fragment, null,
18713
18750
  React__namespace.createElement("button", { onClick: () => onNavToggle(!isNavOpen), className: css(_default$7.wizardToggle, isNavOpen && 'pf-m-expanded'), "aria-label": ariaLabel, "aria-expanded": isNavOpen },
18714
- React__namespace.createElement("ol", { className: css(_default$7.wizardToggleList) },
18715
- React__namespace.createElement("li", { className: css(_default$7.wizardToggleListItem) },
18751
+ React__namespace.createElement("span", { className: css(_default$7.wizardToggleList) },
18752
+ React__namespace.createElement("span", { className: css(_default$7.wizardToggleListItem) },
18716
18753
  React__namespace.createElement("span", { className: css(_default$7.wizardToggleNum) }, activeStepIndex),
18717
18754
  " ",
18718
18755
  activeStepName,
18719
18756
  activeStepSubName && React__namespace.createElement(AngleRightIcon$1, { className: css(_default$7.wizardToggleSeparator), "aria-hidden": "true" })),
18720
- activeStepSubName && React__namespace.createElement("li", { className: css(_default$7.wizardToggleListItem) }, activeStepSubName)),
18757
+ activeStepSubName && React__namespace.createElement("span", { className: css(_default$7.wizardToggleListItem) }, activeStepSubName)),
18721
18758
  React__namespace.createElement("span", { className: css(_default$7.wizardToggleIcon) },
18722
18759
  React__namespace.createElement(CaretDownIcon$1, { "aria-hidden": "true" }))),
18723
18760
  React__namespace.createElement("div", { className: css(_default$7.wizardOuterWrap) },