@patternfly/quickstarts 2.0.1 → 2.2.1

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.es.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
2
  import React__default, { createContext, useCallback, useEffect, useState } from 'react';
3
- import { Card, CardHeader, CardActions, CardTitle, CardBody, CardFooter, Modal as Modal$1, Tooltip, Popover, PopoverPosition, Button, Text, TextVariants, TextList, TextListItem, Flex, FlexItem, Title, Label, Gallery, GalleryItem, ToolbarItem, SearchInput, Select, SelectVariant, SelectOption, Toolbar, ToolbarContent, EmptyState, EmptyStateIcon, EmptyStateBody, EmptyStatePrimary, Divider, ModalVariant, WizardNavItem, List, ExpandableSection, ListItem, Alert, Radio, DrawerPanelContent, DrawerHead, DrawerActions, DrawerCloseButton, DrawerPanelBody, Drawer, DrawerContent, DrawerContentBody } from '@patternfly/react-core';
3
+ import { Card, CardHeader, CardActions, CardTitle, CardBody, CardFooter, Modal as Modal$1, Tooltip, Alert, Popover, PopoverPosition, Button, Text, TextVariants, TextList, TextListItem, Flex, FlexItem, Title, Label, Gallery, GalleryItem, ToolbarItem, SearchInput, Select, SelectVariant, SelectOption, Toolbar, ToolbarContent, EmptyState, EmptyStateIcon, EmptyStateBody, EmptyStatePrimary, Divider, ModalVariant, WizardNavItem, List, ExpandableSection, ListItem, Radio, DrawerPanelContent, DrawerHead, DrawerActions, DrawerCloseButton, DrawerPanelBody, Drawer, DrawerContent, DrawerContentBody, OptionsMenuItem, OptionsMenu, OptionsMenuToggle } from '@patternfly/react-core';
4
4
  import SearchIcon from '@patternfly/react-icons/dist/js/icons/search-icon';
5
5
  import { css } from '@patternfly/react-styles';
6
6
  import RocketIcon from '@patternfly/react-icons/dist/js/icons/rocket-icon';
@@ -8,6 +8,8 @@ import { __rest } from 'tslib';
8
8
  import * as ReactDOM from 'react-dom';
9
9
  import { renderToStaticMarkup } from 'react-dom/server';
10
10
  import CopyIcon from '@patternfly/react-icons/dist/js/icons/copy-icon';
11
+ import LightbulbIcon from '@patternfly/react-icons/dist/js/icons/lightbulb-icon';
12
+ import FireIcon from '@patternfly/react-icons/dist/js/icons/fire-icon';
11
13
  import SyncAltIcon from '@patternfly/react-icons/dist/js/icons/sync-alt-icon';
12
14
  import CheckCircleIcon from '@patternfly/react-icons/dist/js/icons/check-circle-icon';
13
15
  import ExclamationCircleIcon from '@patternfly/react-icons/dist/js/icons/exclamation-circle-icon';
@@ -19,6 +21,7 @@ import { Converter } from 'showdown';
19
21
  import ExternalLinkAltIcon from '@patternfly/react-icons/dist/js/icons/external-link-alt-icon';
20
22
  import OutlinedClockIcon from '@patternfly/react-icons/dist/js/icons/outlined-clock-icon';
21
23
  import ArrowRightIcon from '@patternfly/react-icons/dist/js/icons/arrow-right-icon';
24
+ import BarsIcon from '@patternfly/react-icons/dist/js/icons/bars-icon';
22
25
 
23
26
  function _extends() {
24
27
  _extends = Object.assign || function (target) {
@@ -70,7 +73,8 @@ const QUICKSTART_ID_FILTER_KEY = 'quickstart';
70
73
  const QUICKSTART_TASKS_INITIAL_STATES = [
71
74
  QuickStartTaskStatus.INIT,
72
75
  QuickStartTaskStatus.VISITED,
73
- ];
76
+ ];
77
+ const HELP_TOPIC_NAME_KEY = 'topic';
74
78
 
75
79
  let createHistory;
76
80
  try {
@@ -125,6 +129,7 @@ var Yes = "Yes";
125
129
  var No = "No";
126
130
  var Cancel = "Cancel";
127
131
  var Leave = "Leave";
132
+ var Type = "Quick start";
128
133
  var en = {
129
134
  "No results found": "No results found",
130
135
  "No results match the filter criteria. Remove filters or clear all filters to show results.": "No results match the filter criteria. Remove filters or clear all filters to show results.",
@@ -168,7 +173,8 @@ var en = {
168
173
  "Not available": "Not available",
169
174
  "Copy to clipboard": "Copy to clipboard",
170
175
  "Successfully copied to clipboard!": "Successfully copied to clipboard!",
171
- "Quick start • {{duration, number}} minutes": "Quick start • {{duration, number}} minutes"
176
+ Type: Type,
177
+ "{{type}} • {{duration, number}} minutes": "{{type}} • {{duration, number}} minutes"
172
178
  };
173
179
 
174
180
  /* eslint-disable */
@@ -581,7 +587,7 @@ const QuickStartContextDefaults = {
581
587
  useLegacyHeaderColors: false,
582
588
  markdown: null,
583
589
  loading: false,
584
- alwaysShowTaskReview: false,
590
+ alwaysShowTaskReview: true,
585
591
  };
586
592
  const QuickStartContext = createContext(QuickStartContextDefaults);
587
593
  const getResource = (resource, options, resourceBundle, lng) => {
@@ -678,7 +684,7 @@ const useValuesForQuickStartContext = (value = {}) => {
678
684
  useQueryParams && setQueryArgument(QUICKSTART_ID_FILTER_KEY, id);
679
685
  return id;
680
686
  });
681
- setAllQuickStartStates((qs) => (Object.assign(Object.assign({}, qs), { [quickStartId]: getDefaultQuickStartState(totalTasks, QuickStartStatus.IN_PROGRESS) })));
687
+ setAllQuickStartStates((qs) => (Object.assign(Object.assign({}, qs), { [quickStartId]: getDefaultQuickStartState(totalTasks, QuickStartStatus.NOT_STARTED) })));
682
688
  }, [setActiveQuickStartID, setAllQuickStartStates, useQueryParams]);
683
689
  // When alwaysShowTaskReview preference is enabled, skip visited step and go directly to review
684
690
  const stepAfterInitial = alwaysShowTaskReview
@@ -1276,6 +1282,39 @@ const useMultilineCopyClipboardShowdownExtension = () => {
1276
1282
  }), [getResource]);
1277
1283
  };
1278
1284
 
1285
+ var AdmonitionType;
1286
+ (function (AdmonitionType) {
1287
+ AdmonitionType["TIP"] = "TIP";
1288
+ AdmonitionType["NOTE"] = "NOTE";
1289
+ AdmonitionType["IMPORTANT"] = "IMPORTANT";
1290
+ AdmonitionType["WARNING"] = "WARNING";
1291
+ AdmonitionType["CAUTION"] = "CAUTION";
1292
+ })(AdmonitionType || (AdmonitionType = {}));
1293
+ const admonitionToAlertVariantMap = {
1294
+ [AdmonitionType.NOTE]: { variant: 'info' },
1295
+ [AdmonitionType.TIP]: { variant: 'default', customIcon: React.createElement(LightbulbIcon, null) },
1296
+ [AdmonitionType.IMPORTANT]: { variant: 'danger' },
1297
+ [AdmonitionType.CAUTION]: { variant: 'warning', customIcon: React.createElement(FireIcon, null) },
1298
+ [AdmonitionType.WARNING]: { variant: 'warning' },
1299
+ };
1300
+ const useAdmonitionShowdownExtension = () => {
1301
+ // const { getResource } = React.useContext<QuickStartContextValues>(QuickStartContext);
1302
+ return React.useMemo(() => ({
1303
+ type: 'lang',
1304
+ regex: /\[([\d\w\s-()$!]+)]{{(admonition) ([\w-]+)}}/g,
1305
+ replace: (text, content, admonitionLabel, admonitionType, groupId) => {
1306
+ if (!content || !admonitionLabel || !admonitionType || !groupId) {
1307
+ return text;
1308
+ }
1309
+ admonitionType = admonitionType.toUpperCase();
1310
+ const { variant, customIcon } = admonitionToAlertVariantMap[admonitionType];
1311
+ const style = admonitionType === AdmonitionType.CAUTION ? { backgroundColor: '#ec7a0915' } : {};
1312
+ const pfAlert = (React.createElement(Alert, { variant: variant, customIcon: customIcon && customIcon, isInline: true, title: admonitionType, className: "pfext-markdown-admonition", style: style }, content));
1313
+ return removeTemplateWhitespace(renderToStaticMarkup(pfAlert));
1314
+ },
1315
+ }), []);
1316
+ };
1317
+
1279
1318
  const FallbackImg = ({ src, alt, className, fallback }) => {
1280
1319
  const [isSrcValid, setIsSrcValid] = React.useState(true);
1281
1320
  if (src && isSrcValid) {
@@ -1353,13 +1392,31 @@ const markdownConvert = (markdown, extensions) => {
1353
1392
  if (extensions) {
1354
1393
  converter.addExtension(extensions);
1355
1394
  }
1356
- // add hook to transform anchor tags
1357
1395
  DOMPurify.addHook('beforeSanitizeElements', function (node) {
1358
1396
  // nodeType 1 = element type
1397
+ // transform anchor tags
1359
1398
  if (node.nodeType === 1 && node.nodeName.toLowerCase() === 'a') {
1360
1399
  node.setAttribute('rel', 'noopener noreferrer');
1361
1400
  return node;
1362
1401
  }
1402
+ // add PF class to ul and ol lists
1403
+ if (node.nodeType === 1 &&
1404
+ (node.nodeName.toLowerCase() === 'ul' || node.nodeName.toLowerCase() === 'ol')) {
1405
+ node.setAttribute('class', 'pf-c-list');
1406
+ return node;
1407
+ }
1408
+ });
1409
+ // Add a hook to make all links open a new window
1410
+ DOMPurify.addHook('afterSanitizeAttributes', function (node) {
1411
+ // set all elements owning target to target=_blank
1412
+ if ('target' in node) {
1413
+ node.setAttribute('target', '_blank');
1414
+ }
1415
+ // set non-HTML/MathML links to xlink:show=new
1416
+ if (!node.hasAttribute('target') &&
1417
+ (node.hasAttribute('xlink:href') || node.hasAttribute('href'))) {
1418
+ node.setAttribute('xlink:show', 'new');
1419
+ }
1363
1420
  });
1364
1421
  return DOMPurify.sanitize(converter.makeHtml(markdown), {
1365
1422
  USE_PROFILES: {
@@ -1497,6 +1554,7 @@ const QuickStartMarkdownView = ({ content, exactHeight, className, }) => {
1497
1554
  const { markdown } = React.useContext(QuickStartContext);
1498
1555
  const inlineCopyClipboardShowdownExtension = useInlineCopyClipboardShowdownExtension();
1499
1556
  const multilineCopyClipboardShowdownExtension = useMultilineCopyClipboardShowdownExtension();
1557
+ const admonitionShowdownExtension = useAdmonitionShowdownExtension();
1500
1558
  return (React.createElement(SyncMarkdownView, { inline: true, content: content, exactHeight: exactHeight, extensions: [
1501
1559
  {
1502
1560
  type: 'lang',
@@ -1518,11 +1576,14 @@ const QuickStartMarkdownView = ({ content, exactHeight, className, }) => {
1518
1576
  },
1519
1577
  inlineCopyClipboardShowdownExtension,
1520
1578
  multilineCopyClipboardShowdownExtension,
1579
+ admonitionShowdownExtension,
1521
1580
  ...(markdown ? markdown.extensions : []),
1522
1581
  ], renderExtension: (docContext, rootSelector) => (React.createElement(React.Fragment, null,
1523
1582
  React.createElement(MarkdownHighlightExtension, { docContext: docContext, rootSelector: rootSelector }),
1524
1583
  React.createElement(MarkdownCopyClipboard, { docContext: docContext, rootSelector: rootSelector }),
1525
- markdown && markdown.renderExtension(docContext, rootSelector))), className: className }));
1584
+ markdown &&
1585
+ markdown.renderExtension &&
1586
+ markdown.renderExtension(docContext, rootSelector))), className: className }));
1526
1587
  };
1527
1588
 
1528
1589
  const QuickStartTileDescription = ({ description, prerequisites, }) => {
@@ -1628,7 +1689,9 @@ const QuickStartTile = ({ quickStart, status, isActive, onClick = () => { }, })
1628
1689
  // @ts-ignore
1629
1690
  component: "div", style: {
1630
1691
  cursor: 'pointer',
1631
- }, icon: quickStartIcon, className: "pfext-quick-start-tile", "data-testid": `qs-card-${camelize(displayName)}`, featured: isActive, title: React.createElement(QuickStartTileHeader, { name: displayName, status: status, duration: durationMinutes, type: type, quickStartId: id }), onClick: handleClick, "data-test": `tile ${id}`, description: React.createElement(QuickStartTileDescription, { description: description, prerequisites: prerequisites }), footer: footerComponent })));
1692
+ }, icon: quickStartIcon, className: "pfext-quick-start-tile", "data-testid": `qs-card-${camelize(displayName)}`, featured: isActive, title: React.createElement(QuickStartTileHeader, { name: displayName, status: status, duration: durationMinutes, type: type, quickStartId: id }), onClick: handleClick,
1693
+ // https://github.com/patternfly/patternfly-react/issues/7039
1694
+ href: "#", "data-test": `tile ${id}`, description: React.createElement(QuickStartTileDescription, { description: description, prerequisites: prerequisites }), footer: footerComponent })));
1632
1695
  };
1633
1696
 
1634
1697
  const QuickStartCatalog = ({ quickStarts }) => {
@@ -1779,7 +1842,9 @@ const QuickStartCatalogPage = ({ quickStarts, showFilter, sortFnc = (q1, q2) =>
1779
1842
  const filteredQs = showFilter
1780
1843
  ? filterQuickStarts(allQuickStarts, filter.keyword, filter.status.statusFilters, allQuickStartStates).sort(sortFncCallback)
1781
1844
  : allQuickStarts;
1782
- if (filteredQs.length !== filteredQuickStarts.length) {
1845
+ // also needs a check whether the content of the QS changed
1846
+ if (filteredQs.length !== filteredQuickStarts.length ||
1847
+ JSON.stringify(filteredQs) !== JSON.stringify(filteredQuickStarts)) {
1783
1848
  setFilteredQuickStarts(filteredQs);
1784
1849
  }
1785
1850
  }, [
@@ -1868,14 +1933,17 @@ const TaskIcon = ({ taskIndex, taskStatus }) => {
1868
1933
  }
1869
1934
  return React.createElement("span", { className: classNames }, content);
1870
1935
  };
1871
- const QuickStartTaskHeader = ({ title, taskIndex, subtitle, taskStatus, size, isActiveTask, onTaskSelect, }) => {
1936
+ const QuickStartTaskHeader = ({ title, taskIndex, subtitle, taskStatus, size, isActiveTask, onTaskSelect, children, }) => {
1872
1937
  const classNames = css('pfext-quick-start-task-header__title', {
1873
1938
  'pfext-quick-start-task-header__title-success': taskStatus === QuickStartTaskStatus.SUCCESS,
1874
1939
  'pfext-quick-start-task-header__title-failed': taskStatus === (QuickStartTaskStatus.FAILED || QuickStartTaskStatus.VISITED),
1875
1940
  });
1876
- const notCompleted = taskStatus === QuickStartTaskStatus.VISITED;
1877
- const skippedReviewOrFailed = taskStatus === QuickStartTaskStatus.REVIEW || taskStatus === QuickStartTaskStatus.FAILED;
1878
- const tryAgain = !isActiveTask && (skippedReviewOrFailed || notCompleted) && (React.createElement(React.Fragment, null,
1941
+ // const notCompleted = taskStatus === QuickStartTaskStatus.VISITED;
1942
+ // const skippedReview = taskStatus === QuickStartTaskStatus.REVIEW;
1943
+ const failedReview = taskStatus === QuickStartTaskStatus.FAILED;
1944
+ // TODO: toned down when this is shown, investigate further when we should display it
1945
+ // related: https://github.com/patternfly/patternfly-quickstarts/issues/104
1946
+ const tryAgain = failedReview && (React.createElement(React.Fragment, null,
1879
1947
  React.createElement("div", null),
1880
1948
  React.createElement("div", { className: "pfext-quick-start-task-header__tryagain" }, "Try the steps again.")));
1881
1949
  const content = (React.createElement("div", { className: "pfext-quick-start-task-header" },
@@ -1886,7 +1954,7 @@ const QuickStartTaskHeader = ({ title, taskIndex, subtitle, taskStatus, size, is
1886
1954
  ' ',
1887
1955
  subtitle))),
1888
1956
  tryAgain));
1889
- return (React.createElement(WizardNavItem, { content: content, step: taskIndex, onNavItemClick: () => onTaskSelect(taskIndex - 1), navItemComponent: "button", isCurrent: isActiveTask }));
1957
+ return (React.createElement(WizardNavItem, { content: content, step: taskIndex, onNavItemClick: () => onTaskSelect(taskIndex - 1), navItemComponent: "button", isCurrent: isActiveTask }, children));
1890
1958
  };
1891
1959
 
1892
1960
  const QuickStartTaskHeaderList = ({ tasks, allTaskStatuses, onTaskSelect, }) => {
@@ -1920,7 +1988,8 @@ const QuickStartIntroduction = ({ tasks, introduction, allTaskStatuses, prerequi
1920
1988
  const prereqList = (prereqs === null || prereqs === void 0 ? void 0 : prereqs.length) > 0 && (React.createElement(ExpandableSection, { toggleText: getResource('View Prerequisites ({{totalPrereqs}})').replace('{{totalPrereqs}}', prereqs.length), onToggle: () => setIsPrereqsExpanded(!isPrereqsExpanded), className: "pfext-quick-start-intro__prereq" },
1921
1989
  React.createElement(List, { className: "pfext-quick-start-intro__prereq-list" }, prereqs.map((pr) => {
1922
1990
  return (React.createElement(ListItem, { key: pr, className: "pfext-quick-start-intro__prereq-list__item" },
1923
- React.createElement("span", { className: "pfext-quick-start-intro__prereq-list__item-content" }, pr)));
1991
+ React.createElement("span", { className: "pfext-quick-start-intro__prereq-list__item-content" },
1992
+ React.createElement(QuickStartMarkdownView, { content: pr }))));
1924
1993
  }))));
1925
1994
  return (React.createElement(React.Fragment, null,
1926
1995
  React.createElement(QuickStartMarkdownView, { content: introduction }),
@@ -1949,7 +2018,7 @@ const QuickStartTaskReview = ({ review, taskStatus, onTaskReview, }) => {
1949
2018
  'pfext-quick-start-task-review--failed': taskStatus === QuickStartTaskStatus.FAILED,
1950
2019
  });
1951
2020
  const title = React.createElement("span", { className: alertClassNames }, getResource('Check your work'));
1952
- return (React.createElement(Alert, { className: "pfext-quick-start-task-review-alert", variant: getAlertVariant(taskStatus), title: title, isInline: true },
2021
+ return (React.createElement(Alert, { className: "pfext-quick-start-task-review-alert", variant: getAlertVariant(taskStatus), title: title, isInline: true, role: "alert" },
1953
2022
  React.createElement(QuickStartMarkdownView, { content: instructions }),
1954
2023
  React.createElement("span", { className: "pfext-quick-start-task-review__actions" },
1955
2024
  React.createElement(Radio, { id: "review-success", name: "review-success", "data-testid": "qs-drawer-check-yes", label: getResource('Yes'), className: "pfext-quick-start-task-review__radio", isChecked: taskStatus === QuickStartTaskStatus.SUCCESS, onChange: () => onTaskReview(QuickStartTaskStatus.SUCCESS) }),
@@ -1959,22 +2028,22 @@ const QuickStartTaskReview = ({ review, taskStatus, onTaskReview, }) => {
1959
2028
 
1960
2029
  const QuickStartTasks = ({ tasks, taskNumber, allTaskStatuses, onTaskReview, onTaskSelect, }) => {
1961
2030
  const { getResource, alwaysShowTaskReview } = React.useContext(QuickStartContext);
1962
- return (React.createElement("div", { className: "pfext-quick-start-tasks__list" }, tasks
1963
- .filter((_, index) => allTaskStatuses[index] !== QuickStartTaskStatus.INIT)
1964
- .map((task, index) => {
1965
- const { title, description, review } = task;
1966
- const isActiveTask = index === taskNumber;
1967
- const taskStatus = allTaskStatuses[index];
1968
- const shouldShowTaskReview = (!QUICKSTART_TASKS_INITIAL_STATES.includes(taskStatus) || alwaysShowTaskReview) &&
1969
- review;
1970
- return (React.createElement(React.Fragment, { key: title },
1971
- React.createElement(QuickStartTaskHeader, { taskIndex: index + 1, title: title, size: "md", subtitle: getResource('{{index, number}} of {{tasks, number}}')
1972
- .replace('{{index, number}}', index + 1)
1973
- .replace('{{tasks, number}}', tasks.length), taskStatus: taskStatus, isActiveTask: isActiveTask, onTaskSelect: onTaskSelect }),
1974
- isActiveTask && (React.createElement("div", { className: "pfext-quick-start-task__content" },
1975
- React.createElement(QuickStartMarkdownView, { content: description }),
1976
- shouldShowTaskReview && (React.createElement(QuickStartTaskReview, { review: review, taskStatus: taskStatus, onTaskReview: onTaskReview }))))));
1977
- })));
2031
+ return (React.createElement("div", { className: "pfext-quick-start-tasks__list" },
2032
+ React.createElement("ul", null, tasks
2033
+ .filter((_, index) => allTaskStatuses[index] !== QuickStartTaskStatus.INIT)
2034
+ .map((task, index) => {
2035
+ const { title, description, review } = task;
2036
+ const isActiveTask = index === taskNumber;
2037
+ const taskStatus = allTaskStatuses[index];
2038
+ const shouldShowTaskReview = (!QUICKSTART_TASKS_INITIAL_STATES.includes(taskStatus) || alwaysShowTaskReview) &&
2039
+ review;
2040
+ return (React.createElement(React.Fragment, { key: title },
2041
+ React.createElement(QuickStartTaskHeader, { taskIndex: index + 1, title: title, size: "md", subtitle: getResource('{{index, number}} of {{tasks, number}}')
2042
+ .replace('{{index, number}}', index + 1)
2043
+ .replace('{{tasks, number}}', tasks.length), taskStatus: taskStatus, isActiveTask: isActiveTask, onTaskSelect: onTaskSelect }, isActiveTask && (React.createElement("div", { className: "pfext-quick-start-task__content" },
2044
+ React.createElement(QuickStartMarkdownView, { content: description }),
2045
+ shouldShowTaskReview && (React.createElement(QuickStartTaskReview, { review: review, taskStatus: taskStatus, onTaskReview: onTaskReview })))))));
2046
+ }))));
1978
2047
  };
1979
2048
 
1980
2049
  const QuickStartContent = React.forwardRef(({ quickStart, nextQuickStarts = [], taskNumber, allTaskStatuses, onTaskSelect, onTaskReview, onQuickStartChange, }, ref) => {
@@ -2084,11 +2153,10 @@ const useScrollTopOnTaskNumberChange = (node, taskNumber) => {
2084
2153
  };
2085
2154
  const QuickStartPanelContent = (_a) => {
2086
2155
  var { quickStarts = [], handleClose, activeQuickStartID, appendTo, isResizable = true, showClose = true, headerVariant = '' } = _a, props = __rest(_a, ["quickStarts", "handleClose", "activeQuickStartID", "appendTo", "isResizable", "showClose", "headerVariant"]);
2087
- const { getResource } = React.useContext(QuickStartContext);
2156
+ const { getResource, activeQuickStartState } = React.useContext(QuickStartContext);
2088
2157
  const [contentRef, setContentRef] = React.useState();
2089
2158
  const shadows = useScrollShadows(contentRef);
2090
2159
  const quickStart = quickStarts.find((qs) => qs.metadata.name === activeQuickStartID);
2091
- const { activeQuickStartState } = React.useContext(QuickStartContext);
2092
2160
  const taskNumber = activeQuickStartState === null || activeQuickStartState === void 0 ? void 0 : activeQuickStartState.taskNumber;
2093
2161
  useScrollTopOnTaskNumberChange(contentRef, taskNumber);
2094
2162
  const nextQuickStarts = quickStarts.filter((qs) => { var _a; return (_a = quickStart === null || quickStart === void 0 ? void 0 : quickStart.spec.nextQuickStart) === null || _a === void 0 ? void 0 : _a.includes(qs.metadata.name); });
@@ -2116,7 +2184,10 @@ const QuickStartPanelContent = (_a) => {
2116
2184
  React.createElement(Title, { headingLevel: "h1", size: "xl", className: "pfext-quick-start-panel-content__name", style: { marginRight: 'var(--pf-global--spacer--md)' } }, quickStart === null || quickStart === void 0 ? void 0 :
2117
2185
  quickStart.spec.displayName,
2118
2186
  ' ',
2119
- React.createElement("small", { className: "pfext-quick-start-panel-content__duration" }, getResource('Quick start • {{duration, number}} minutes', quickStart === null || quickStart === void 0 ? void 0 : quickStart.spec.durationMinutes).replace('{{duration, number}}', quickStart === null || quickStart === void 0 ? void 0 : quickStart.spec.durationMinutes)))),
2187
+ React.createElement("small", { className: "pfext-quick-start-panel-content__duration" }, (quickStart === null || quickStart === void 0 ? void 0 : quickStart.spec.durationMinutes) ? getResource('{{type}} • {{duration, number}} minutes', quickStart === null || quickStart === void 0 ? void 0 : quickStart.spec.durationMinutes)
2188
+ .replace('{{duration, number}}', quickStart === null || quickStart === void 0 ? void 0 : quickStart.spec.durationMinutes)
2189
+ .replace('{{type}}', getResource('Type'))
2190
+ : getResource('Type')))),
2120
2191
  showClose && (React.createElement(DrawerActions, null,
2121
2192
  React.createElement(DrawerCloseButton, { onClick: handleClose, className: "pfext-quick-start-panel-content__close-button", "data-testid": "qs-drawer-close" }))))),
2122
2193
  React.createElement(DrawerPanelBody, { hasNoPadding: true, className: "pfext-quick-start-panel-content__body", "data-test": "content" },
@@ -2128,7 +2199,7 @@ const QuickStartPanelContent = (_a) => {
2128
2199
  };
2129
2200
 
2130
2201
  const QuickStartContainer = (_a) => {
2131
- var { quickStarts, children, activeQuickStartID, allQuickStartStates, setActiveQuickStartID, setAllQuickStartStates, appendTo, fullWidth, onCloseInProgress, onCloseNotInProgress, resourceBundle, showCardFooters, useLegacyHeaderColors, language, loading = false, useQueryParams = true, markdown, contextProps, alwaysShowTaskReview = false } = _a, props = __rest(_a, ["quickStarts", "children", "activeQuickStartID", "allQuickStartStates", "setActiveQuickStartID", "setAllQuickStartStates", "appendTo", "fullWidth", "onCloseInProgress", "onCloseNotInProgress", "resourceBundle", "showCardFooters", "useLegacyHeaderColors", "language", "loading", "useQueryParams", "markdown", "contextProps", "alwaysShowTaskReview"]);
2202
+ var { quickStarts, children, activeQuickStartID, allQuickStartStates, setActiveQuickStartID, setAllQuickStartStates, appendTo, fullWidth, onCloseInProgress, onCloseNotInProgress, resourceBundle, showCardFooters, useLegacyHeaderColors, language, loading = false, useQueryParams = true, markdown, contextProps, alwaysShowTaskReview = true } = _a, props = __rest(_a, ["quickStarts", "children", "activeQuickStartID", "allQuickStartStates", "setActiveQuickStartID", "setAllQuickStartStates", "appendTo", "fullWidth", "onCloseInProgress", "onCloseNotInProgress", "resourceBundle", "showCardFooters", "useLegacyHeaderColors", "language", "loading", "useQueryParams", "markdown", "contextProps", "alwaysShowTaskReview"]);
2132
2203
  const valuesForQuickstartContext = useValuesForQuickStartContext(Object.assign({ allQuickStarts: quickStarts, activeQuickStartID,
2133
2204
  setActiveQuickStartID,
2134
2205
  allQuickStartStates,
@@ -2166,7 +2237,7 @@ const QuickStartDrawer = (_a) => {
2166
2237
  // if there is a quick start param, but the quick start is not active, set it
2167
2238
  // this can happen if a new browser session is opened or an incognito window for example
2168
2239
  const quickStartIdFromParam = params.get(QUICKSTART_ID_FILTER_KEY) || '';
2169
- if (quickStartIdFromParam && !activeQuickStartID) {
2240
+ if (quickStartIdFromParam && activeQuickStartID !== quickStartIdFromParam) {
2170
2241
  const activeQuickStart = getQuickStartByName(quickStartIdFromParam, combinedQuickStarts);
2171
2242
  // don't try to load a quick start that is actually just an external resource (spec.link)
2172
2243
  if (combinedQuickStarts.length > 0 && activeQuickStart && !activeQuickStart.spec.link) {
@@ -2225,6 +2296,125 @@ const QuickStartDrawer = (_a) => {
2225
2296
  React.createElement(QuickStartCloseModal, { isOpen: modalOpen, onConfirm: onModalConfirm, onCancel: onModalCancel })));
2226
2297
  };
2227
2298
 
2299
+ const HelpTopicContextDefaults = {
2300
+ helpTopics: [],
2301
+ setHelpTopics: () => { },
2302
+ activeHelpTopic: null,
2303
+ setActiveHelpTopicByName: () => { },
2304
+ filteredHelpTopics: [],
2305
+ setFilteredHelpTopics: () => { },
2306
+ loading: false,
2307
+ };
2308
+ const HelpTopicContext = React__default.createContext(HelpTopicContextDefaults);
2309
+ const useValuesForHelpTopicContext = (value = {}) => {
2310
+ const combinedValue = Object.assign(Object.assign({}, HelpTopicContextDefaults), value);
2311
+ const [loading, setLoading] = React__default.useState(combinedValue.loading);
2312
+ // eslint-disable-next-line no-unused-vars, @typescript-eslint/no-unused-vars
2313
+ const [helpTopics, setHelpTopics] = React__default.useState(combinedValue.helpTopics || []);
2314
+ const [activeHelpTopic, setActiveHelpTopic] = React__default.useState(combinedValue.activeHelpTopic || null);
2315
+ const setActiveHelpTopicByName = React__default.useCallback((helpTopicName) => {
2316
+ const topic = helpTopics.find((t) => {
2317
+ return t.name === helpTopicName;
2318
+ });
2319
+ if (!helpTopicName) {
2320
+ setActiveHelpTopic(null);
2321
+ return;
2322
+ }
2323
+ setActiveHelpTopic(topic);
2324
+ }, [helpTopics]);
2325
+ const [filteredHelpTopics, setFilteredHelpTopics] = React__default.useState(combinedValue.filteredHelpTopics || []);
2326
+ return {
2327
+ helpTopics,
2328
+ setHelpTopics,
2329
+ activeHelpTopic,
2330
+ setActiveHelpTopicByName,
2331
+ filteredHelpTopics,
2332
+ setFilteredHelpTopics,
2333
+ loading,
2334
+ setLoading,
2335
+ };
2336
+ };
2337
+
2338
+ const HelpTopicPanelContent = (_a) => {
2339
+ var { activeHelpTopic = null, filteredHelpTopics = [], isResizable = true, onClose } = _a, props = __rest(_a, ["activeHelpTopic", "filteredHelpTopics", "isResizable", "onClose"]);
2340
+ const { setActiveHelpTopicByName } = React.useContext(HelpTopicContext);
2341
+ const [isHelpTopicMenuOpen, setIsHelpTopicMenuOpen] = React.useState(false);
2342
+ const toggleHelpTopicMenu = () => {
2343
+ setIsHelpTopicMenuOpen(!isHelpTopicMenuOpen);
2344
+ };
2345
+ const onSelectHelpTopic = (event) => {
2346
+ const topicName = event.currentTarget.id;
2347
+ setActiveHelpTopicByName(topicName);
2348
+ toggleHelpTopicMenu();
2349
+ };
2350
+ const menuItems = filteredHelpTopics.length > 0 &&
2351
+ filteredHelpTopics.map((topic) => {
2352
+ return (React.createElement(OptionsMenuItem, { key: topic.name, onSelect: onSelectHelpTopic, id: topic.name }, topic.title));
2353
+ });
2354
+ const paddingContainer = (children) => React.createElement("div", { style: { padding: '24px' } }, children);
2355
+ const panelBodyItems = (React.createElement(React.Fragment, null,
2356
+ paddingContainer(React.createElement(QuickStartMarkdownView, { content: activeHelpTopic === null || activeHelpTopic === void 0 ? void 0 : activeHelpTopic.content })),
2357
+ React.createElement(Divider, null),
2358
+ paddingContainer(activeHelpTopic === null || activeHelpTopic === void 0 ? void 0 : activeHelpTopic.links.map((link) => {
2359
+ return React.createElement(QuickStartMarkdownView, { key: link, content: link });
2360
+ }))));
2361
+ const content = (React.createElement(DrawerPanelContent, Object.assign({ isResizable: isResizable, className: "pfext-quick-start__base" }, props),
2362
+ React.createElement("div", null,
2363
+ React.createElement(DrawerHead, null,
2364
+ React.createElement("div", { className: "pfext-quick-start-panel-content__title" },
2365
+ menuItems && (React.createElement(OptionsMenu, { id: 'helptopics', isPlain: true, isOpen: isHelpTopicMenuOpen, toggle: React.createElement(OptionsMenuToggle, { style: { paddingLeft: '0px' }, onToggle: toggleHelpTopicMenu, toggleTemplate: React.createElement(BarsIcon, null) }), menuItems: menuItems })),
2366
+ React.createElement(Title, { headingLevel: "h1", size: "xl", className: "pfext-quick-start-panel-content__name", style: { marginRight: 'var(--pf-global--spacer--md)' } }, activeHelpTopic === null || activeHelpTopic === void 0 ? void 0 : activeHelpTopic.title)),
2367
+ React.createElement(DrawerActions, null,
2368
+ React.createElement(DrawerCloseButton, { onClick: onClose, className: "pfext-quick-start-panel-content__close-button", "data-testid": "qs-drawer-close" }))),
2369
+ React.createElement(Divider, null),
2370
+ React.createElement(DrawerPanelBody, { hasNoPadding: true, className: "pfext-quick-start-panel-content__body", "data-test": "content" }, panelBodyItems))));
2371
+ return content;
2372
+ };
2373
+
2374
+ const HelpTopicContainer = (_a) => {
2375
+ var { helpTopics, children, resourceBundle, language, loading = false, markdown, contextProps } = _a, props = __rest(_a, ["helpTopics", "children", "resourceBundle", "language", "loading", "markdown", "contextProps"]);
2376
+ const valuesForHelpTopicContext = useValuesForHelpTopicContext(Object.assign({ helpTopics,
2377
+ language, resourceBundle: Object.assign({}, resourceBundle), loading,
2378
+ markdown }, contextProps));
2379
+ React.useEffect(() => {
2380
+ if (loading !== valuesForHelpTopicContext.loading) {
2381
+ valuesForHelpTopicContext.setLoading(loading);
2382
+ }
2383
+ }, [loading, valuesForHelpTopicContext]);
2384
+ React.useEffect(() => {
2385
+ if (helpTopics &&
2386
+ JSON.stringify(helpTopics) !== JSON.stringify(valuesForHelpTopicContext.helpTopics)) {
2387
+ valuesForHelpTopicContext.setHelpTopics(helpTopics);
2388
+ }
2389
+ }, [helpTopics, valuesForHelpTopicContext]);
2390
+ const drawerProps = Object.assign({}, props);
2391
+ return (React.createElement(HelpTopicContext.Provider, { value: valuesForHelpTopicContext },
2392
+ React.createElement(HelpTopicDrawer, Object.assign({}, drawerProps), children)));
2393
+ };
2394
+ const HelpTopicDrawer = (_a) => {
2395
+ var {
2396
+ // helpTopics,
2397
+ children } = _a, props = __rest(_a, ["children"]);
2398
+ const { activeHelpTopic, filteredHelpTopics, setActiveHelpTopicByName } = React.useContext(HelpTopicContext);
2399
+ // Leave here if query param is desired for help topics later
2400
+ // React.useEffect(() => {
2401
+ // const params = new URLSearchParams(window.location.search);
2402
+ // // if there is a quick start param, but the quick start is not active, set it
2403
+ // // this can happen if a new browser session is opened or an incognito window for example
2404
+ // const helpTopicNameFromParam = params.get(HELP_TOPIC_NAME_KEY) || '';
2405
+ // if (helpTopicNameFromParam) {
2406
+ // setActiveHelpTopicByName(helpTopicNameFromParam);
2407
+ // }
2408
+ // }, [inContextHelpTopics, setActiveHelpTopicByName]);
2409
+ const onClose = () => {
2410
+ setActiveHelpTopicByName('');
2411
+ };
2412
+ const panelContent = (React.createElement(HelpTopicPanelContent, { activeHelpTopic: activeHelpTopic, filteredHelpTopics: filteredHelpTopics, onClose: onClose }));
2413
+ return (React.createElement(React.Fragment, null,
2414
+ React.createElement(Drawer, Object.assign({ isExpanded: !!activeHelpTopic, isInline: true }, props), children ? (React.createElement(DrawerContent, { panelContent: panelContent },
2415
+ React.createElement(DrawerContentBody, { className: "pfext-quick-start-drawer__body" }, children))) : (React.createElement("div", { className: "pf-c-drawer__main" }, panelContent)))));
2416
+ };
2417
+
2228
2418
  const useLocalStorage = (key, initialValue) => {
2229
2419
  // State to store our value
2230
2420
  // Pass initial state function to useState so logic is only executed once
@@ -2262,5 +2452,5 @@ const useLocalStorage = (key, initialValue) => {
2262
2452
  return [storedValue, setValue];
2263
2453
  };
2264
2454
 
2265
- export { Box, CamelCaseWrap, EmptyBox, Loading, LoadingBox, QUICKSTART_ID_FILTER_KEY, QUICKSTART_SEARCH_FILTER_KEY, QUICKSTART_STATUS_FILTER_KEY, QUICKSTART_TASKS_INITIAL_STATES, QUICK_START_NAME, QuickStartCatalog, QuickStartCatalogEmptyState, QuickStartCatalogFilter, QuickStartCatalogFilterCount, QuickStartCatalogFilterCountWrapper, QuickStartCatalogFilterSearch, QuickStartCatalogFilterSearchWrapper, QuickStartCatalogFilterSelect, QuickStartCatalogFilterStatusWrapper, QuickStartCatalogHeader, QuickStartCatalogPage, QuickStartCatalogSection, QuickStartCatalogToolbar, QuickStartCloseModal, QuickStartContainer, QuickStartContext, QuickStartContextDefaults, QuickStartContextProvider, QuickStartDrawer, QuickStartPanelContent, QuickStartStatus, QuickStartTaskStatus, QuickStartTile, QuickStartTileDescription, QuickStartTileFooter, QuickStartTileFooterExternal, QuickStartTileHeader, camelize, clearFilterParams, equalsIgnoreOrder, filterQuickStarts, getDefaultQuickStartState, getDisabledQuickStarts, getQuickStartByName, getQuickStartStatus, getQuickStartStatusCount, getResource, getTaskStatusKey, history, isDisabledQuickStart, removeQueryArgument, setQueryArgument, useLocalStorage, useValuesForQuickStartContext };
2455
+ export { Box, CamelCaseWrap, EmptyBox, HELP_TOPIC_NAME_KEY, HelpTopicContainer, HelpTopicContext, HelpTopicContextDefaults, HelpTopicDrawer, Loading, LoadingBox, QUICKSTART_ID_FILTER_KEY, QUICKSTART_SEARCH_FILTER_KEY, QUICKSTART_STATUS_FILTER_KEY, QUICKSTART_TASKS_INITIAL_STATES, QUICK_START_NAME, QuickStartCatalog, QuickStartCatalogEmptyState, QuickStartCatalogFilter, QuickStartCatalogFilterCount, QuickStartCatalogFilterCountWrapper, QuickStartCatalogFilterSearch, QuickStartCatalogFilterSearchWrapper, QuickStartCatalogFilterSelect, QuickStartCatalogFilterStatusWrapper, QuickStartCatalogHeader, QuickStartCatalogPage, QuickStartCatalogSection, QuickStartCatalogToolbar, QuickStartCloseModal, QuickStartContainer, QuickStartContext, QuickStartContextDefaults, QuickStartContextProvider, QuickStartDrawer, QuickStartPanelContent, QuickStartStatus, QuickStartTaskStatus, QuickStartTile, QuickStartTileDescription, QuickStartTileFooter, QuickStartTileFooterExternal, QuickStartTileHeader, camelize, clearFilterParams, equalsIgnoreOrder, filterQuickStarts, getDefaultQuickStartState, getDisabledQuickStarts, getQuickStartByName, getQuickStartStatus, getQuickStartStatusCount, getResource, getTaskStatusKey, history, isDisabledQuickStart, removeQueryArgument, setQueryArgument, useLocalStorage, useValuesForHelpTopicContext, useValuesForQuickStartContext };
2266
2456
  //# sourceMappingURL=index.es.js.map