@patternfly/quickstarts 2.1.0 → 2.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/README.md CHANGED
@@ -207,6 +207,30 @@ You can have inline or block copyable text.
207
207
  ```{{copy}}
208
208
  ```
209
209
 
210
+ ## Markdown extensions
211
+ If your source material content is defined in markdown (yaml + markdown / json + markdown), then you can add your own markdown extensions, example:
212
+ ```
213
+ const drawerProps: QuickStartContainerProps = {
214
+ markdown: {
215
+ extensions: [
216
+ // variable substitution example
217
+ // this replaces the strings [APPLICATION] and [PRODUCT]
218
+ {
219
+ type: 'output',
220
+ filter: function(html: string) {
221
+ html = html.replace(/\[APPLICATION\]/g, 'Mercury');
222
+ html = html.replace(/\[PRODUCT\]/g, 'Lightning');
223
+
224
+ return html;
225
+ },
226
+ },
227
+ ],
228
+ },
229
+ };
230
+
231
+ return <QuickStartContainer {...drawerProps}>My page content</QuickStartContainer>
232
+ ```
233
+
210
234
  ## Localization
211
235
  We use English as the default language. You can override the default by providing your own key/value pairs to the `QuickStartContainer` or `QuickStartContextProvider` resourceBundle prop.
212
236
 
@@ -230,3 +254,284 @@ Use this [file](https://github.com/patternfly/patternfly-quickstarts/blob/main/p
230
254
  Each language is different, especially when it comes to plurals. Try [this utility](https://jsfiddle.net/6bpxsgd4) sourced from [i18next](https://www.i18next.com/translation-function/plurals#how-to-find-the-correct-plural-suffix) to determine the suffixes for the right plural format.
231
255
 
232
256
  For localizing the content of quick starts files, we provide the option to include `language` and `countryCode` key to your translated file. Based on these keys you can filter out quick starts. We have a demo of this behaviour in our [demo app](https://quickstarts.netlify.app/quickstarts-localized). You can have a look at the code [here](https://github.com/patternfly/patternfly-quickstarts/blob/main/packages/dev/src/AppLocalized.tsx).
257
+
258
+ ## In-App / In Context Help Panel
259
+
260
+ The quickstarts package is being extended to support a side panel that displays smaller chunks (defined as the `HelpTopic` type) of documentation.
261
+
262
+ ### Help Topic type definition
263
+
264
+ ```ts
265
+ type HelpTopic = {
266
+ name: string; // unique identifier
267
+ title: string; // displayed in header of side panel
268
+ tags: string[]; // metadata to filter/add relationships between HelpTopics and some piece of data in your application
269
+ content: string; // main content of topic, supports markdown
270
+ links: string[]; // list of related information, use markdown link syntax
271
+ };
272
+ ```
273
+
274
+ ### Example Help Topic in yaml with markdown support for content and links
275
+
276
+ ```yml
277
+ - name: auto-deploy
278
+ tags:
279
+ - page-1
280
+ title: Automatic Deployment
281
+ content: |-
282
+ **An Automatic Deployment** is...
283
+
284
+ Etiam viverra et tortor et maximus. Aliquam quis scelerisque metus. Proin luctus pretium sodales. Mauris nibh nibh, auctor eu scelerisque et, hendrerit a metus. Vivamus pharetra bibendum finibus. Sed a pulvinar ipsum. Fusce pharetra venenatis porttitor. Praesent justo metus, consectetur quis erat id, congue varius metus. Suspendisse dui est, tempor nec diam quis, facilisis sodales erat. Curabitur viverra convallis ex. Ut egestas condimentum augue, id euismod leo volutpat vitae. Quisque aliquet ac dolor quis pretium. Nunc at nibh quis arcu maximus elementum vel a mi.
285
+ links:
286
+ - '[Creating quick starts](https://docs.openshift.com/container-platform/4.9/web_console/creating-quick-start-tutorials.html)'
287
+ - '[Redhat Console](https://console.redhat.com/)'
288
+ - name: workspace
289
+ tags:
290
+ - page-1
291
+ - page-2
292
+ - page-3
293
+ title: Workspace
294
+ content: |-
295
+ **A Workspace** is...
296
+
297
+ Fusce nunc risus, vehicula feugiat pellentesque sit amet, pretium non urna. Phasellus nibh mi, ornare quis euismod a, iaculis et eros. Vivamus auctor nunc odio, quis porttitor diam pellentesque nec. In et varius tellus, eget porta urna. Etiam bibendum, est eget mollis lobortis, velit risus efficitur lacus, sed pulvinar sem est vel libero. In sodales placerat tincidunt. Proin vitae risus elit. Ut lobortis ligula est, cursus rhoncus enim scelerisque ac. Donec lacus nisl, tempor porta hendrerit nec, volutpat vitae arcu. Curabitur ornare ullamcorper mi in tincidunt. Aenean efficitur posuere auctor. Pellentesque accumsan mauris vel arcu congue, nec sagittis nisl condimentum. Suspendisse mauris nulla, dignissim at viverra sed, fringilla eu purus.
298
+ links:
299
+ - '[Creating quick starts](https://docs.openshift.com/container-platform/4.9/web_console/creating-quick-start-tutorials.html)'
300
+ - '[Redhat Console](https://console.redhat.com/)'
301
+ ```
302
+
303
+ ### Usage Example
304
+
305
+ See the [HelpTopicDemo](https://github.com/patternfly/patternfly-quickstarts/blob/6b35d3c346b3e92ed0003de955421c8dff58a22b/packages/dev/src/AppHelpTopicDemo.tsx)
306
+
307
+ - Similar to standard Quickstarts usage
308
+ - Load yaml defined `HelpTopic` array
309
+ - Pass `HelpTopicContainerProps`, including loaded `HelpTopics` to the `<HelpTopicContainer/>`
310
+
311
+ ```ts
312
+ import './App.css';
313
+ import { Page } from '@patternfly/react-core';
314
+ import { LoadingBox, HelpTopicContainerProps, HelpTopicContainer } from '@patternfly/quickstarts';
315
+ import { helpTopics } from './quickstarts-data/quick-start-test-data';
316
+ import React from 'react';
317
+ import i18n from './i18n/i18n';
318
+ import { AppHeader, AppSidebar } from './common/Page';
319
+
320
+ type AppProps = {
321
+ children?: React.ReactNode;
322
+ showCardFooters?: boolean;
323
+ };
324
+
325
+ const AppHelpTopicDemo: React.FC<AppProps> = ({ children }) => {
326
+ const language = localStorage.getItem('bridge/language') || 'en';
327
+ const resourceBundle = i18n.getResourceBundle(language, 'quickstart');
328
+
329
+ const [loading, setLoading] = React.useState(true);
330
+ React.useEffect(() => {
331
+ const load = async () => {
332
+ setLoading(false);
333
+ };
334
+ setTimeout(() => {
335
+ load();
336
+ }, 500);
337
+ }, []);
338
+
339
+ const inContextHelpProps: HelpTopicContainerProps = {
340
+ helpTopics,
341
+ resourceBundle,
342
+ language,
343
+ loading,
344
+ };
345
+
346
+ return (
347
+ <React.Suspense fallback={<LoadingBox />}>
348
+ <HelpTopicContainer {...inContextHelpProps}>
349
+ <Page header={AppHeader} sidebar={AppSidebar} isManagedSidebar>
350
+ {children}
351
+ </Page>
352
+ </HelpTopicContainer>
353
+ </React.Suspense>
354
+ );
355
+ };
356
+ ```
357
+
358
+ In the example above `<HelpTopicContainer />` wraps the `<Page/>` element as well as a mock "console" showing how to trigger the side panel and allow navigation to all `HelpTopics` available on each console page:
359
+
360
+ Live [preview](https://deploy-preview-140--quickstarts.netlify.app/in-context-help) of code below:
361
+
362
+ ```ts
363
+ import * as React from 'react';
364
+ import {
365
+ Banner,
366
+ Button,
367
+ Divider,
368
+ Form,
369
+ FormGroup,
370
+ PageSection,
371
+ Popover,
372
+ Split,
373
+ SplitItem,
374
+ TextInput,
375
+ Title,
376
+ } from '@patternfly/react-core';
377
+ import { HelpTopicContext, HelpTopicContextValues } from '@patternfly/quickstarts';
378
+ import HelpIcon from '@patternfly/react-icons/dist/js/icons/help-icon';
379
+ import { HelpTopic } from '@patternfly/quickstarts/dist/utils/help-topic-types';
380
+
381
+ // Example usage of topics, render certain topics depending on the page
382
+ // used this case when "consolePageState" below is between 4 - 6
383
+ // these HelpTopics with the following names will be rendered
384
+ const helpTopicNamesByPage = [
385
+ ['auto-deploy', 'code-sample', 'manual-deployment'],
386
+ ['manual-deployment', 'target-port', 'build-configuration'],
387
+ ['deploy-configuration', 'environment-variables', 'health-checks'],
388
+ ];
389
+
390
+ interface FormGroupWithHelpTopicPopoverProps extends React.HTMLProps<HTMLDivElement> {
391
+ topic: HelpTopic;
392
+ }
393
+
394
+ // Example usage of setActiveHelpTopicByName()
395
+ // render a popover with a learn more link to open the drawer
396
+ const FormGroupWithHelpTopicPopover: React.FC<FormGroupWithHelpTopicPopoverProps> = ({ topic }) => {
397
+ const { setActiveHelpTopicByName } = React.useContext<HelpTopicContextValues>(HelpTopicContext);
398
+
399
+ return (
400
+ <FormGroup
401
+ label={topic.title}
402
+ isRequired
403
+ fieldId={topic.name}
404
+ key={topic.name}
405
+ labelIcon={
406
+ <Popover
407
+ bodyContent={(hide) => (
408
+ <div>
409
+ {topic.title} is quite amaizing{' '}
410
+ <Button
411
+ variant="link"
412
+ onClick={() => {
413
+ setActiveHelpTopicByName(topic.name);
414
+ hide();
415
+ }}
416
+ >
417
+ Learn more
418
+ </Button>
419
+ </div>
420
+ )}
421
+ >
422
+ <Button variant="plain">
423
+ <HelpIcon noVerticalAlign />
424
+ </Button>
425
+ </Popover>
426
+ }
427
+ >
428
+ <TextInput isRequired type="text" id={topic.name} />
429
+ </FormGroup>
430
+ );
431
+ };
432
+
433
+ export const MockConsole: React.FC = () => {
434
+ const { helpTopics, setFilteredHelpTopics, filteredHelpTopics, setActiveHelpTopicByName } =
435
+ React.useContext<HelpTopicContextValues>(HelpTopicContext);
436
+
437
+ // mock console page identifiers: 1 - 6
438
+ // click handlers to change page
439
+ const [consolePageState, setConsolePageState] = React.useState(1);
440
+
441
+ const handleClickNext = () => {
442
+ setActiveHelpTopicByName('');
443
+ if (consolePageState === 6) {
444
+ setConsolePageState(1);
445
+ return;
446
+ }
447
+ setConsolePageState(consolePageState + 1);
448
+ };
449
+
450
+ const handleClickBack = () => {
451
+ setActiveHelpTopicByName('');
452
+ if (consolePageState === 6) {
453
+ setConsolePageState(4);
454
+ return;
455
+ }
456
+ setConsolePageState(consolePageState - 1);
457
+ };
458
+
459
+ // Example usage setFilteredHelpTopics()
460
+ // After rendering the console, set the filtered help topics
461
+ React.useEffect(() => {
462
+ // set filtered topics using tags, matching to the consolePageState
463
+ if (consolePageState < 4) {
464
+ const topics = helpTopics.filter((topic: HelpTopic) => {
465
+ const pageTagNumbers = topic.tags.map((tag: string) => {
466
+ return Number(tag.slice(-1));
467
+ });
468
+ return pageTagNumbers.includes(consolePageState);
469
+ });
470
+ setFilteredHelpTopics(topics);
471
+ } else {
472
+ // set filtered topics using the appropriate helpTopicNamesByPage array above
473
+ setFilteredHelpTopics(
474
+ helpTopics.filter((topic) => {
475
+ return helpTopicNamesByPage[consolePageState - 4].includes(topic.name);
476
+ }),
477
+ );
478
+ }
479
+ }, [consolePageState, helpTopics, setFilteredHelpTopics]);
480
+
481
+ // Render filteredHelpTopics in a <FormGroupWithHelpTopicPopover />
482
+ const formGroupsFromTags = filteredHelpTopics.map((topic: HelpTopic, index) => {
483
+ return <FormGroupWithHelpTopicPopover topic={topic} key={index} />;
484
+ });
485
+
486
+ // From an array of topic names, render all topics in a <FormGroupWithHelpTopicPopover />
487
+ const formGroupsFromTopicNames = (helpTopicNames: string[]) => {
488
+ return helpTopicNames.map((topicName: string, index) => {
489
+ const topicToRender = helpTopics.find((topic) => {
490
+ return topicName === topic.name;
491
+ });
492
+
493
+ if (topicToRender) {
494
+ return <FormGroupWithHelpTopicPopover topic={topicToRender} key={index} />;
495
+ }
496
+ });
497
+ };
498
+
499
+ return (
500
+ <>
501
+ <PageSection>
502
+ <Banner variant="info">
503
+ <Title headingLevel="h1">Console Page {consolePageState}</Title>
504
+ </Banner>
505
+ </PageSection>
506
+ <PageSection>
507
+ <Title headingLevel="h3">
508
+ Example usage of help topics opened via popover{' '}
509
+ <b>
510
+ {consolePageState < 4
511
+ ? 'using tags that match the Console Page number'
512
+ : 'by defining which help topics should be present on each page'}
513
+ </b>
514
+ </Title>
515
+ <Divider />
516
+ <Form>
517
+ {consolePageState < 4
518
+ ? formGroupsFromTags
519
+ : formGroupsFromTopicNames(helpTopicNamesByPage[consolePageState - 4])}
520
+ </Form>
521
+ </PageSection>
522
+ <PageSection>
523
+ <Split hasGutter>
524
+ <SplitItem>
525
+ <Button onClick={handleClickBack} variant="tertiary">
526
+ Previous
527
+ </Button>
528
+ </SplitItem>
529
+ <SplitItem>
530
+ <Button onClick={handleClickNext}>Next</Button>
531
+ </SplitItem>
532
+ </Split>
533
+ </PageSection>
534
+ </>
535
+ );
536
+ };
537
+ ```
@@ -0,0 +1,26 @@
1
+ import './QuickStartDrawer.scss';
2
+ import * as React from 'react';
3
+ import { QuickStartContextValues } from './utils/quick-start-context';
4
+ import { HelpTopic } from './utils/help-topic-types';
5
+ export interface HelpTopicContainerProps extends React.HTMLProps<HTMLDivElement> {
6
+ helpTopics: HelpTopic[];
7
+ resourceBundle?: any;
8
+ language?: string;
9
+ loading?: boolean;
10
+ /**
11
+ * Additional markdown extensions and renderers to use
12
+ * TODO: example usage - In the meantime you can take a look at:
13
+ * https://github.com/openshift/console/blob/master/frontend/packages/console-app/src/components/quick-starts/utils/quick-start-context.tsx#L235
14
+ */
15
+ markdown?: {
16
+ extensions?: any[];
17
+ renderExtension?: (docContext: HTMLDocument, rootSelector: string) => React.ReactNode;
18
+ };
19
+ contextProps?: QuickStartContextValues;
20
+ }
21
+ export declare const HelpTopicContainer: React.FC<HelpTopicContainerProps>;
22
+ export interface HelpTopicDrawerProps extends React.HTMLProps<HTMLDivElement> {
23
+ helpTopics?: HelpTopic[];
24
+ children?: React.ReactNode;
25
+ }
26
+ export declare const HelpTopicDrawer: React.FC<HelpTopicDrawerProps>;
@@ -0,0 +1,10 @@
1
+ import * as React from 'react';
2
+ import { HelpTopic } from './utils/help-topic-types';
3
+ import './QuickStartPanelContent.scss';
4
+ declare type HelpTopicPanelContentProps = {
5
+ activeHelpTopic: HelpTopic;
6
+ filteredHelpTopics?: HelpTopic[];
7
+ isResizable?: boolean;
8
+ };
9
+ declare const HelpTopicPanelContent: React.FC<HelpTopicPanelContentProps>;
10
+ export default HelpTopicPanelContent;
package/dist/index.d.ts CHANGED
@@ -3,9 +3,12 @@ export * from './QuickStartCatalogPage';
3
3
  export * from './catalog';
4
4
  export * from './ConsoleInternal/components/utils';
5
5
  export * from './QuickStartDrawer';
6
+ export * from './HelpTopicDrawer';
6
7
  export * from './utils/const';
7
8
  export * from './utils/quick-start-context';
8
9
  export * from './utils/quick-start-types';
10
+ export * from './utils/help-topic-context';
11
+ export * from './utils/help-topic-types';
9
12
  export * from './utils/quick-start-utils';
10
13
  export * from './utils/useLocalStorage';
11
14
  export { default as QuickStartPanelContent } from './QuickStartPanelContent';
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, 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 } 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, Stack, StackItem } 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';
@@ -21,6 +21,7 @@ import { Converter } from 'showdown';
21
21
  import ExternalLinkAltIcon from '@patternfly/react-icons/dist/js/icons/external-link-alt-icon';
22
22
  import OutlinedClockIcon from '@patternfly/react-icons/dist/js/icons/outlined-clock-icon';
23
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';
24
25
 
25
26
  function _extends() {
26
27
  _extends = Object.assign || function (target) {
@@ -72,7 +73,8 @@ const QUICKSTART_ID_FILTER_KEY = 'quickstart';
72
73
  const QUICKSTART_TASKS_INITIAL_STATES = [
73
74
  QuickStartTaskStatus.INIT,
74
75
  QuickStartTaskStatus.VISITED,
75
- ];
76
+ ];
77
+ const HELP_TOPIC_NAME_KEY = 'topic';
76
78
 
77
79
  let createHistory;
78
80
  try {
@@ -1579,7 +1581,9 @@ const QuickStartMarkdownView = ({ content, exactHeight, className, }) => {
1579
1581
  ], renderExtension: (docContext, rootSelector) => (React.createElement(React.Fragment, null,
1580
1582
  React.createElement(MarkdownHighlightExtension, { docContext: docContext, rootSelector: rootSelector }),
1581
1583
  React.createElement(MarkdownCopyClipboard, { docContext: docContext, rootSelector: rootSelector }),
1582
- markdown && markdown.renderExtension(docContext, rootSelector))), className: className }));
1584
+ markdown &&
1585
+ markdown.renderExtension &&
1586
+ markdown.renderExtension(docContext, rootSelector))), className: className }));
1583
1587
  };
1584
1588
 
1585
1589
  const QuickStartTileDescription = ({ description, prerequisites, }) => {
@@ -2149,11 +2153,10 @@ const useScrollTopOnTaskNumberChange = (node, taskNumber) => {
2149
2153
  };
2150
2154
  const QuickStartPanelContent = (_a) => {
2151
2155
  var { quickStarts = [], handleClose, activeQuickStartID, appendTo, isResizable = true, showClose = true, headerVariant = '' } = _a, props = __rest(_a, ["quickStarts", "handleClose", "activeQuickStartID", "appendTo", "isResizable", "showClose", "headerVariant"]);
2152
- const { getResource } = React.useContext(QuickStartContext);
2156
+ const { getResource, activeQuickStartState } = React.useContext(QuickStartContext);
2153
2157
  const [contentRef, setContentRef] = React.useState();
2154
2158
  const shadows = useScrollShadows(contentRef);
2155
2159
  const quickStart = quickStarts.find((qs) => qs.metadata.name === activeQuickStartID);
2156
- const { activeQuickStartState } = React.useContext(QuickStartContext);
2157
2160
  const taskNumber = activeQuickStartState === null || activeQuickStartState === void 0 ? void 0 : activeQuickStartState.taskNumber;
2158
2161
  useScrollTopOnTaskNumberChange(contentRef, taskNumber);
2159
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); });
@@ -2293,6 +2296,111 @@ const QuickStartDrawer = (_a) => {
2293
2296
  React.createElement(QuickStartCloseModal, { isOpen: modalOpen, onConfirm: onModalConfirm, onCancel: onModalCancel })));
2294
2297
  };
2295
2298
 
2299
+ const HelpTopicContextDefaults = {
2300
+ helpTopics: [],
2301
+ activeHelpTopic: null,
2302
+ setActiveHelpTopicByName: () => { },
2303
+ filteredHelpTopics: [],
2304
+ setFilteredHelpTopics: () => { },
2305
+ loading: false,
2306
+ };
2307
+ const HelpTopicContext = React__default.createContext(HelpTopicContextDefaults);
2308
+ const useValuesForHelpTopicContext = (value = {}) => {
2309
+ const combinedValue = Object.assign(Object.assign({}, HelpTopicContextDefaults), value);
2310
+ const [loading, setLoading] = React__default.useState(combinedValue.loading);
2311
+ // eslint-disable-next-line no-unused-vars, @typescript-eslint/no-unused-vars
2312
+ const [helpTopics, setHelpTopics] = React__default.useState(combinedValue.helpTopics || []);
2313
+ const [activeHelpTopic, setActiveHelpTopic] = React__default.useState(combinedValue.activeHelpTopic || null);
2314
+ const setActiveHelpTopicByName = React__default.useCallback((helpTopicName) => {
2315
+ const topic = helpTopics.find((t) => {
2316
+ return t.name === helpTopicName;
2317
+ });
2318
+ if (!helpTopicName) {
2319
+ setActiveHelpTopic(null);
2320
+ return;
2321
+ }
2322
+ setActiveHelpTopic(topic);
2323
+ }, [helpTopics]);
2324
+ const [filteredHelpTopics, setFilteredHelpTopics] = React__default.useState(combinedValue.filteredHelpTopics || []);
2325
+ return {
2326
+ helpTopics,
2327
+ activeHelpTopic,
2328
+ setActiveHelpTopicByName,
2329
+ filteredHelpTopics,
2330
+ setFilteredHelpTopics,
2331
+ loading,
2332
+ setLoading,
2333
+ };
2334
+ };
2335
+
2336
+ const HelpTopicPanelContent = (_a) => {
2337
+ var { activeHelpTopic = null, filteredHelpTopics = [], isResizable = true } = _a, props = __rest(_a, ["activeHelpTopic", "filteredHelpTopics", "isResizable"]);
2338
+ const { setActiveHelpTopicByName } = React.useContext(HelpTopicContext);
2339
+ const [isHelpTopicMenuOpen, setIsHelpTopicMenuOpen] = React.useState(false);
2340
+ const toggleHelpTopicMenu = () => {
2341
+ setIsHelpTopicMenuOpen(!isHelpTopicMenuOpen);
2342
+ };
2343
+ const onSelectHelpTopic = (event) => {
2344
+ const topicName = event.currentTarget.id;
2345
+ setActiveHelpTopicByName(topicName);
2346
+ toggleHelpTopicMenu();
2347
+ };
2348
+ const menuItems = filteredHelpTopics.map((topic) => {
2349
+ return (React.createElement(OptionsMenuItem, { key: topic.name, onSelect: onSelectHelpTopic, id: topic.name }, topic.title));
2350
+ });
2351
+ const content = (React.createElement(DrawerPanelContent, Object.assign({ isResizable: isResizable, className: "pfext-quick-start__base" }, props),
2352
+ React.createElement("div", null,
2353
+ React.createElement(DrawerHead, null,
2354
+ React.createElement("div", { className: "pfext-quick-start-panel-content__title" },
2355
+ React.createElement(OptionsMenu, { id: 'helptopics', isPlain: true, isOpen: isHelpTopicMenuOpen, toggle: React.createElement(OptionsMenuToggle, { onToggle: toggleHelpTopicMenu, toggleTemplate: React.createElement(BarsIcon, null) }), menuItems: menuItems }),
2356
+ 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))),
2357
+ React.createElement(Divider, null),
2358
+ React.createElement(DrawerPanelBody, { hasNoPadding: true, className: "pfext-quick-start-panel-content__body", "data-test": "content" },
2359
+ React.createElement(Stack, { hasGutter: true },
2360
+ React.createElement(StackItem, { style: { padding: '20px' } },
2361
+ React.createElement(QuickStartMarkdownView, { content: activeHelpTopic === null || activeHelpTopic === void 0 ? void 0 : activeHelpTopic.content })),
2362
+ React.createElement(Divider, null),
2363
+ React.createElement(StackItem, { style: { padding: '20px' } }, activeHelpTopic === null || activeHelpTopic === void 0 ? void 0 : activeHelpTopic.links.map((link) => {
2364
+ return React.createElement(QuickStartMarkdownView, { key: link, content: link });
2365
+ })))))));
2366
+ return content;
2367
+ };
2368
+
2369
+ const HelpTopicContainer = (_a) => {
2370
+ var { helpTopics, children, resourceBundle, language, loading = false, markdown, contextProps } = _a, props = __rest(_a, ["helpTopics", "children", "resourceBundle", "language", "loading", "markdown", "contextProps"]);
2371
+ const valuesForHelpTopicContext = useValuesForHelpTopicContext(Object.assign({ helpTopics,
2372
+ language, resourceBundle: Object.assign({}, resourceBundle), loading,
2373
+ markdown }, contextProps));
2374
+ React.useEffect(() => {
2375
+ if (loading !== valuesForHelpTopicContext.loading) {
2376
+ valuesForHelpTopicContext.setLoading(loading);
2377
+ }
2378
+ }, [loading, valuesForHelpTopicContext]);
2379
+ const drawerProps = Object.assign({}, props);
2380
+ return (React.createElement(HelpTopicContext.Provider, { value: valuesForHelpTopicContext },
2381
+ React.createElement(HelpTopicDrawer, Object.assign({}, drawerProps), children)));
2382
+ };
2383
+ const HelpTopicDrawer = (_a) => {
2384
+ var {
2385
+ // helpTopics,
2386
+ children } = _a, props = __rest(_a, ["children"]);
2387
+ const { activeHelpTopic, filteredHelpTopics } = React.useContext(HelpTopicContext);
2388
+ // Leave here if query param is desired for help topics later
2389
+ // React.useEffect(() => {
2390
+ // const params = new URLSearchParams(window.location.search);
2391
+ // // if there is a quick start param, but the quick start is not active, set it
2392
+ // // this can happen if a new browser session is opened or an incognito window for example
2393
+ // const helpTopicNameFromParam = params.get(HELP_TOPIC_NAME_KEY) || '';
2394
+ // if (helpTopicNameFromParam) {
2395
+ // setActiveHelpTopicByName(helpTopicNameFromParam);
2396
+ // }
2397
+ // }, [inContextHelpTopics, setActiveHelpTopicByName]);
2398
+ const panelContent = (React.createElement(HelpTopicPanelContent, { activeHelpTopic: activeHelpTopic, filteredHelpTopics: filteredHelpTopics }));
2399
+ return (React.createElement(React.Fragment, null,
2400
+ React.createElement(Drawer, Object.assign({ isExpanded: !!activeHelpTopic, isInline: true }, props), children ? (React.createElement(DrawerContent, { panelContent: panelContent },
2401
+ React.createElement(DrawerContentBody, { className: "pfext-quick-start-drawer__body" }, children))) : (React.createElement("div", { className: "pf-c-drawer__main" }, panelContent)))));
2402
+ };
2403
+
2296
2404
  const useLocalStorage = (key, initialValue) => {
2297
2405
  // State to store our value
2298
2406
  // Pass initial state function to useState so logic is only executed once
@@ -2330,5 +2438,5 @@ const useLocalStorage = (key, initialValue) => {
2330
2438
  return [storedValue, setValue];
2331
2439
  };
2332
2440
 
2333
- 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 };
2441
+ 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 };
2334
2442
  //# sourceMappingURL=index.es.js.map