@patternfly/quickstarts 5.2.0-prerelease.2 → 5.2.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/dist/index.js CHANGED
@@ -24,6 +24,7 @@ require('@patternfly/react-tokens/dist/esm/global_palette_blue_300');
24
24
  var okColor = require('@patternfly/react-tokens/dist/esm/global_palette_green_500');
25
25
  var ExternalLinkAltIcon = require('@patternfly/react-icons/dist/js/icons/external-link-alt-icon');
26
26
  var OutlinedClockIcon = require('@patternfly/react-icons/dist/js/icons/outlined-clock-icon');
27
+ var OutlinedBookmarkIcon = require('@patternfly/react-icons/dist/js/icons/outlined-bookmark-icon');
27
28
  var ArrowRightIcon = require('@patternfly/react-icons/dist/js/icons/arrow-right-icon');
28
29
  var BarsIcon = require('@patternfly/react-icons/dist/js/icons/bars-icon');
29
30
 
@@ -64,6 +65,7 @@ var InfoCircleIcon__default = /*#__PURE__*/_interopDefaultLegacy(InfoCircleIcon)
64
65
  var okColor__default = /*#__PURE__*/_interopDefaultLegacy(okColor);
65
66
  var ExternalLinkAltIcon__default = /*#__PURE__*/_interopDefaultLegacy(ExternalLinkAltIcon);
66
67
  var OutlinedClockIcon__default = /*#__PURE__*/_interopDefaultLegacy(OutlinedClockIcon);
68
+ var OutlinedBookmarkIcon__default = /*#__PURE__*/_interopDefaultLegacy(OutlinedBookmarkIcon);
67
69
  var ArrowRightIcon__default = /*#__PURE__*/_interopDefaultLegacy(ArrowRightIcon);
68
70
  var BarsIcon__default = /*#__PURE__*/_interopDefaultLegacy(BarsIcon);
69
71
 
@@ -1710,23 +1712,26 @@ const statusColorMap = {
1710
1712
  [exports.QuickStartStatus.IN_PROGRESS]: 'purple',
1711
1713
  [exports.QuickStartStatus.NOT_STARTED]: 'grey',
1712
1714
  };
1713
- const QuickStartTileHeader = ({ status, duration, name, type, quickStartId, }) => {
1715
+ const QuickStartTileHeader = ({ status, duration, name, type, quickStartId, action, }) => {
1714
1716
  const { getResource } = React__namespace.useContext(QuickStartContext);
1715
1717
  const statusLocaleMap = {
1716
1718
  [exports.QuickStartStatus.COMPLETE]: getResource('Complete'),
1717
1719
  [exports.QuickStartStatus.IN_PROGRESS]: getResource('In progress'),
1718
1720
  [exports.QuickStartStatus.NOT_STARTED]: getResource('Not started'),
1719
1721
  };
1722
+ const ActionIcon = (action === null || action === void 0 ? void 0 : action.icon) || OutlinedBookmarkIcon__default['default'];
1720
1723
  return (React__namespace.createElement("div", { className: "pfext-quick-start-tile-header" },
1721
- React__namespace.createElement(reactCore.Title, { headingLevel: "h3", "data-test": "title", id: quickStartId },
1722
- React__namespace.createElement(QuickStartMarkdownView, { content: name })),
1724
+ React__namespace.createElement(reactCore.Flex, { flexWrap: { default: 'nowrap' } },
1725
+ React__namespace.createElement(reactCore.Title, { headingLevel: "h3", "data-test": "title", id: quickStartId },
1726
+ React__namespace.createElement(QuickStartMarkdownView, { content: name })),
1727
+ action && (React__namespace.createElement(reactCore.Button, Object.assign({ "aria-label": action['aria-label'], icon: React__namespace.createElement(ActionIcon, null), variant: "plain", onClick: action.onClick }, action.buttonProps)))),
1723
1728
  React__namespace.createElement("div", { className: "pfext-quick-start-tile-header__status" },
1724
1729
  type && (React__namespace.createElement(reactCore.Label, { className: "pfext-quick-start-tile-header--margin", color: type.color }, type.text)),
1725
1730
  duration && (React__namespace.createElement(reactCore.Label, { variant: "outline", "data-test": "duration", icon: React__namespace.createElement(OutlinedClockIcon__default['default'], null), className: "pfext-quick-start-tile-header--margin" }, getResource('{{duration, number}} minutes', duration).replace('{{duration, number}}', duration))),
1726
1731
  status !== exports.QuickStartStatus.NOT_STARTED && (React__namespace.createElement(reactCore.Label, { variant: "outline", color: statusColorMap[status], icon: React__namespace.createElement(StatusIcon, { status: status }), "data-test": "status" }, statusLocaleMap[status])))));
1727
1732
  };
1728
1733
 
1729
- const QuickStartTile = ({ quickStart, status, isActive, onClick = () => { }, }) => {
1734
+ const QuickStartTile = ({ quickStart, status, isActive, onClick = () => { }, action, }) => {
1730
1735
  const { metadata: { name: id }, spec: { icon, tasks, displayName, description, durationMinutes, prerequisites, link, type }, } = quickStart;
1731
1736
  const { setActiveQuickStart, footer } = React__namespace.useContext(QuickStartContext);
1732
1737
  const ref = React__namespace.useRef(null);
@@ -1749,26 +1754,31 @@ const QuickStartTile = ({ quickStart, status, isActive, onClick = () => { }, })
1749
1754
  const handleClick = (e) => {
1750
1755
  var _a;
1751
1756
  if ((_a = ref.current) === null || _a === void 0 ? void 0 : _a.contains(e.target)) {
1752
- if (link) {
1753
- window.open(link.href);
1754
- }
1755
- else {
1757
+ if (!link) {
1756
1758
  setActiveQuickStart(id, tasks === null || tasks === void 0 ? void 0 : tasks.length);
1757
1759
  }
1758
1760
  onClick();
1759
1761
  }
1760
1762
  };
1761
- return (React__namespace.createElement("div", { ref: ref },
1762
- React__namespace.createElement(CatalogTile, { id: id + '-catalog-tile', style: {
1763
+ const linkProps = link
1764
+ ? {
1765
+ href: link.href,
1766
+ target: '_blank',
1767
+ rel: 'noreferrer',
1768
+ }
1769
+ : {};
1770
+ return (React__namespace.createElement("div", { ref: ref, onClick: handleClick },
1771
+ React__namespace.createElement(CatalogTile, Object.assign({ id: id + '-catalog-tile', style: {
1763
1772
  cursor: 'pointer',
1764
- }, icon: quickStartIcon, className: "pfext-quick-start-tile", "data-testid": `qs-card-${camelize(displayName)}`, featured: isActive, title: React__namespace.createElement(QuickStartTileHeader, { name: displayName, status: status, duration: durationMinutes, type: type, quickStartId: id }), onClick: handleClick, onKeyDown: (event) => {
1773
+ }, icon: quickStartIcon, className: "pfext-quick-start-tile", "data-testid": `qs-card-${camelize(displayName)}`, featured: isActive, title: React__namespace.createElement(QuickStartTileHeader, { name: displayName, status: status, duration: durationMinutes, type: type, quickStartId: id, action: action }), onKeyDown: (event) => {
1765
1774
  if (event.key === 'Enter' || event.key === ' ') {
1766
1775
  setActiveQuickStart(id, tasks === null || tasks === void 0 ? void 0 : tasks.length);
1767
1776
  onClick();
1768
1777
  }
1769
- },
1770
- // https://github.com/patternfly/patternfly-react/issues/7039
1771
- href: link === null || link === void 0 ? void 0 : link.href, "data-test": `tile ${id}`, description: React__namespace.createElement(QuickStartTileDescription, { description: description, prerequisites: prerequisites }), footer: footerComponent, tabIndex: 0 })));
1778
+ } }, linkProps, { "data-test": `tile ${id}`, description: React__namespace.createElement(QuickStartTileDescription, { description: description, prerequisites: prerequisites }), footer: footerComponent, tabIndex: 0,
1779
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
1780
+ // @ts-ignore-next-line
1781
+ isSelectableRaised: true }))));
1772
1782
  };
1773
1783
 
1774
1784
  const QuickStartCatalog = ({ quickStarts }) => {