@patternfly/quickstarts 2.2.0 → 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.js CHANGED
@@ -2340,6 +2340,7 @@ const QuickStartDrawer = (_a) => {
2340
2340
 
2341
2341
  const HelpTopicContextDefaults = {
2342
2342
  helpTopics: [],
2343
+ setHelpTopics: () => { },
2343
2344
  activeHelpTopic: null,
2344
2345
  setActiveHelpTopicByName: () => { },
2345
2346
  filteredHelpTopics: [],
@@ -2366,6 +2367,7 @@ const useValuesForHelpTopicContext = (value = {}) => {
2366
2367
  const [filteredHelpTopics, setFilteredHelpTopics] = React__default['default'].useState(combinedValue.filteredHelpTopics || []);
2367
2368
  return {
2368
2369
  helpTopics,
2370
+ setHelpTopics,
2369
2371
  activeHelpTopic,
2370
2372
  setActiveHelpTopicByName,
2371
2373
  filteredHelpTopics,
@@ -2376,7 +2378,7 @@ const useValuesForHelpTopicContext = (value = {}) => {
2376
2378
  };
2377
2379
 
2378
2380
  const HelpTopicPanelContent = (_a) => {
2379
- var { activeHelpTopic = null, filteredHelpTopics = [], isResizable = true } = _a, props = tslib.__rest(_a, ["activeHelpTopic", "filteredHelpTopics", "isResizable"]);
2381
+ var { activeHelpTopic = null, filteredHelpTopics = [], isResizable = true, onClose } = _a, props = tslib.__rest(_a, ["activeHelpTopic", "filteredHelpTopics", "isResizable", "onClose"]);
2380
2382
  const { setActiveHelpTopicByName } = React__namespace.useContext(HelpTopicContext);
2381
2383
  const [isHelpTopicMenuOpen, setIsHelpTopicMenuOpen] = React__namespace.useState(false);
2382
2384
  const toggleHelpTopicMenu = () => {
@@ -2387,24 +2389,27 @@ const HelpTopicPanelContent = (_a) => {
2387
2389
  setActiveHelpTopicByName(topicName);
2388
2390
  toggleHelpTopicMenu();
2389
2391
  };
2390
- const menuItems = filteredHelpTopics.map((topic) => {
2391
- return (React__namespace.createElement(reactCore.OptionsMenuItem, { key: topic.name, onSelect: onSelectHelpTopic, id: topic.name }, topic.title));
2392
- });
2392
+ const menuItems = filteredHelpTopics.length > 0 &&
2393
+ filteredHelpTopics.map((topic) => {
2394
+ return (React__namespace.createElement(reactCore.OptionsMenuItem, { key: topic.name, onSelect: onSelectHelpTopic, id: topic.name }, topic.title));
2395
+ });
2396
+ const paddingContainer = (children) => React__namespace.createElement("div", { style: { padding: '24px' } }, children);
2397
+ const panelBodyItems = (React__namespace.createElement(React__namespace.Fragment, null,
2398
+ paddingContainer(React__namespace.createElement(QuickStartMarkdownView, { content: activeHelpTopic === null || activeHelpTopic === void 0 ? void 0 : activeHelpTopic.content })),
2399
+ React__namespace.createElement(reactCore.Divider, null),
2400
+ paddingContainer(activeHelpTopic === null || activeHelpTopic === void 0 ? void 0 : activeHelpTopic.links.map((link) => {
2401
+ return React__namespace.createElement(QuickStartMarkdownView, { key: link, content: link });
2402
+ }))));
2393
2403
  const content = (React__namespace.createElement(reactCore.DrawerPanelContent, Object.assign({ isResizable: isResizable, className: "pfext-quick-start__base" }, props),
2394
2404
  React__namespace.createElement("div", null,
2395
2405
  React__namespace.createElement(reactCore.DrawerHead, null,
2396
2406
  React__namespace.createElement("div", { className: "pfext-quick-start-panel-content__title" },
2397
- React__namespace.createElement(reactCore.OptionsMenu, { id: 'helptopics', isPlain: true, isOpen: isHelpTopicMenuOpen, toggle: React__namespace.createElement(reactCore.OptionsMenuToggle, { onToggle: toggleHelpTopicMenu, toggleTemplate: React__namespace.createElement(BarsIcon__default['default'], null) }), menuItems: menuItems }),
2398
- React__namespace.createElement(reactCore.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))),
2407
+ menuItems && (React__namespace.createElement(reactCore.OptionsMenu, { id: 'helptopics', isPlain: true, isOpen: isHelpTopicMenuOpen, toggle: React__namespace.createElement(reactCore.OptionsMenuToggle, { style: { paddingLeft: '0px' }, onToggle: toggleHelpTopicMenu, toggleTemplate: React__namespace.createElement(BarsIcon__default['default'], null) }), menuItems: menuItems })),
2408
+ React__namespace.createElement(reactCore.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)),
2409
+ React__namespace.createElement(reactCore.DrawerActions, null,
2410
+ React__namespace.createElement(reactCore.DrawerCloseButton, { onClick: onClose, className: "pfext-quick-start-panel-content__close-button", "data-testid": "qs-drawer-close" }))),
2399
2411
  React__namespace.createElement(reactCore.Divider, null),
2400
- React__namespace.createElement(reactCore.DrawerPanelBody, { hasNoPadding: true, className: "pfext-quick-start-panel-content__body", "data-test": "content" },
2401
- React__namespace.createElement(reactCore.Stack, { hasGutter: true },
2402
- React__namespace.createElement(reactCore.StackItem, { style: { padding: '20px' } },
2403
- React__namespace.createElement(QuickStartMarkdownView, { content: activeHelpTopic === null || activeHelpTopic === void 0 ? void 0 : activeHelpTopic.content })),
2404
- React__namespace.createElement(reactCore.Divider, null),
2405
- React__namespace.createElement(reactCore.StackItem, { style: { padding: '20px' } }, activeHelpTopic === null || activeHelpTopic === void 0 ? void 0 : activeHelpTopic.links.map((link) => {
2406
- return React__namespace.createElement(QuickStartMarkdownView, { key: link, content: link });
2407
- })))))));
2412
+ React__namespace.createElement(reactCore.DrawerPanelBody, { hasNoPadding: true, className: "pfext-quick-start-panel-content__body", "data-test": "content" }, panelBodyItems))));
2408
2413
  return content;
2409
2414
  };
2410
2415
 
@@ -2418,6 +2423,12 @@ const HelpTopicContainer = (_a) => {
2418
2423
  valuesForHelpTopicContext.setLoading(loading);
2419
2424
  }
2420
2425
  }, [loading, valuesForHelpTopicContext]);
2426
+ React__namespace.useEffect(() => {
2427
+ if (helpTopics &&
2428
+ JSON.stringify(helpTopics) !== JSON.stringify(valuesForHelpTopicContext.helpTopics)) {
2429
+ valuesForHelpTopicContext.setHelpTopics(helpTopics);
2430
+ }
2431
+ }, [helpTopics, valuesForHelpTopicContext]);
2421
2432
  const drawerProps = Object.assign({}, props);
2422
2433
  return (React__namespace.createElement(HelpTopicContext.Provider, { value: valuesForHelpTopicContext },
2423
2434
  React__namespace.createElement(HelpTopicDrawer, Object.assign({}, drawerProps), children)));
@@ -2426,7 +2437,7 @@ const HelpTopicDrawer = (_a) => {
2426
2437
  var {
2427
2438
  // helpTopics,
2428
2439
  children } = _a, props = tslib.__rest(_a, ["children"]);
2429
- const { activeHelpTopic, filteredHelpTopics } = React__namespace.useContext(HelpTopicContext);
2440
+ const { activeHelpTopic, filteredHelpTopics, setActiveHelpTopicByName } = React__namespace.useContext(HelpTopicContext);
2430
2441
  // Leave here if query param is desired for help topics later
2431
2442
  // React.useEffect(() => {
2432
2443
  // const params = new URLSearchParams(window.location.search);
@@ -2437,7 +2448,10 @@ const HelpTopicDrawer = (_a) => {
2437
2448
  // setActiveHelpTopicByName(helpTopicNameFromParam);
2438
2449
  // }
2439
2450
  // }, [inContextHelpTopics, setActiveHelpTopicByName]);
2440
- const panelContent = (React__namespace.createElement(HelpTopicPanelContent, { activeHelpTopic: activeHelpTopic, filteredHelpTopics: filteredHelpTopics }));
2451
+ const onClose = () => {
2452
+ setActiveHelpTopicByName('');
2453
+ };
2454
+ const panelContent = (React__namespace.createElement(HelpTopicPanelContent, { activeHelpTopic: activeHelpTopic, filteredHelpTopics: filteredHelpTopics, onClose: onClose }));
2441
2455
  return (React__namespace.createElement(React__namespace.Fragment, null,
2442
2456
  React__namespace.createElement(reactCore.Drawer, Object.assign({ isExpanded: !!activeHelpTopic, isInline: true }, props), children ? (React__namespace.createElement(reactCore.DrawerContent, { panelContent: panelContent },
2443
2457
  React__namespace.createElement(reactCore.DrawerContentBody, { className: "pfext-quick-start-drawer__body" }, children))) : (React__namespace.createElement("div", { className: "pf-c-drawer__main" }, panelContent)))));