@patternfly/quickstarts 2.2.1 → 2.2.2
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 +20 -20
- package/dist/ConsoleShared/src/components/markdown-extensions/code-extension.d.ts +7 -0
- package/dist/ConsoleShared/src/components/markdown-extensions/index.d.ts +1 -0
- package/dist/index.es.js +26 -20
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +25 -19
- package/dist/index.js.map +1 -1
- package/dist/patternfly-nested.css +11 -1
- package/dist/quickstarts-base.css +49 -11
- package/dist/quickstarts-full.es.js +350 -304
- package/dist/quickstarts-full.es.js.map +1 -1
- package/dist/quickstarts-standalone.css +5 -15
- package/dist/quickstarts-standalone.min.css +1 -1
- package/dist/quickstarts.css +49 -11
- package/dist/quickstarts.min.css +1 -1
- package/dist/utils/help-topic-types.d.ts +7 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -262,12 +262,21 @@ The quickstarts package is being extended to support a side panel that displays
|
|
|
262
262
|
### Help Topic type definition
|
|
263
263
|
|
|
264
264
|
```ts
|
|
265
|
+
type HelpTopicLink = {
|
|
266
|
+
href: string;
|
|
267
|
+
text?: string;
|
|
268
|
+
// open link in new tab
|
|
269
|
+
newTab?: boolean;
|
|
270
|
+
// add PF icon indicating link is external
|
|
271
|
+
isExternal?: boolean;
|
|
272
|
+
};
|
|
273
|
+
|
|
265
274
|
type HelpTopic = {
|
|
266
|
-
name: string;
|
|
267
|
-
title: string;
|
|
268
|
-
tags: string[];
|
|
269
|
-
content: string;
|
|
270
|
-
links:
|
|
275
|
+
name: string;
|
|
276
|
+
title: string;
|
|
277
|
+
tags: string[];
|
|
278
|
+
content: string;
|
|
279
|
+
links: HelpTopicLink[];
|
|
271
280
|
};
|
|
272
281
|
```
|
|
273
282
|
|
|
@@ -283,21 +292,12 @@ type HelpTopic = {
|
|
|
283
292
|
|
|
284
293
|
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
294
|
links:
|
|
286
|
-
- '
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
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/)'
|
|
295
|
+
- text: 'Creating quick starts (external)'
|
|
296
|
+
href: 'https://docs.openshift.com/container-platform/4.9/web_console/creating-quick-start-tutorials.html'
|
|
297
|
+
isExternal: true
|
|
298
|
+
- text: 'Redhat Console (opens in new tab)'
|
|
299
|
+
href: 'https://console.redhat.com'
|
|
300
|
+
newTab: true
|
|
301
301
|
```
|
|
302
302
|
|
|
303
303
|
### Usage Example
|
|
@@ -2,3 +2,4 @@ export { default as MarkdownCopyClipboard } from './MarkdownCopyClipboard';
|
|
|
2
2
|
export { default as useInlineCopyClipboardShowdownExtension } from './inline-clipboard-extension';
|
|
3
3
|
export { default as useMultilineCopyClipboardShowdownExtension } from './multiline-clipboard-extension';
|
|
4
4
|
export { default as useAdmonitionShowdownExtension } from './admonition-extension';
|
|
5
|
+
export { default as useCodeShowdownExtension } from './code-extension';
|
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, OptionsMenuItem, OptionsMenu, OptionsMenuToggle } from '@patternfly/react-core';
|
|
3
|
+
import { Card, CardHeader, CardActions, CardTitle, CardBody, CardFooter, Modal as Modal$1, Tooltip, Alert, CodeBlock, 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, Stack, StackItem, 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';
|
|
@@ -1315,6 +1315,20 @@ const useAdmonitionShowdownExtension = () => {
|
|
|
1315
1315
|
}), []);
|
|
1316
1316
|
};
|
|
1317
1317
|
|
|
1318
|
+
const useCodeShowdownExtension = () => {
|
|
1319
|
+
return React.useMemo(() => ({
|
|
1320
|
+
type: 'output',
|
|
1321
|
+
regex: /<pre><code>(.*?)\n?<\/code><\/pre>/g,
|
|
1322
|
+
replace: (text, content) => {
|
|
1323
|
+
if (!content) {
|
|
1324
|
+
return text;
|
|
1325
|
+
}
|
|
1326
|
+
const pfCodeBlock = React.createElement(CodeBlock, null, content);
|
|
1327
|
+
return removeTemplateWhitespace(renderToStaticMarkup(pfCodeBlock));
|
|
1328
|
+
},
|
|
1329
|
+
}), []);
|
|
1330
|
+
};
|
|
1331
|
+
|
|
1318
1332
|
const FallbackImg = ({ src, alt, className, fallback }) => {
|
|
1319
1333
|
const [isSrcValid, setIsSrcValid] = React.useState(true);
|
|
1320
1334
|
if (src && isSrcValid) {
|
|
@@ -1555,6 +1569,7 @@ const QuickStartMarkdownView = ({ content, exactHeight, className, }) => {
|
|
|
1555
1569
|
const inlineCopyClipboardShowdownExtension = useInlineCopyClipboardShowdownExtension();
|
|
1556
1570
|
const multilineCopyClipboardShowdownExtension = useMultilineCopyClipboardShowdownExtension();
|
|
1557
1571
|
const admonitionShowdownExtension = useAdmonitionShowdownExtension();
|
|
1572
|
+
const codeShowdownExtension = useCodeShowdownExtension();
|
|
1558
1573
|
return (React.createElement(SyncMarkdownView, { inline: true, content: content, exactHeight: exactHeight, extensions: [
|
|
1559
1574
|
{
|
|
1560
1575
|
type: 'lang',
|
|
@@ -1577,6 +1592,7 @@ const QuickStartMarkdownView = ({ content, exactHeight, className, }) => {
|
|
|
1577
1592
|
inlineCopyClipboardShowdownExtension,
|
|
1578
1593
|
multilineCopyClipboardShowdownExtension,
|
|
1579
1594
|
admonitionShowdownExtension,
|
|
1595
|
+
codeShowdownExtension,
|
|
1580
1596
|
...(markdown ? markdown.extensions : []),
|
|
1581
1597
|
], renderExtension: (docContext, rootSelector) => (React.createElement(React.Fragment, null,
|
|
1582
1598
|
React.createElement(MarkdownHighlightExtension, { docContext: docContext, rootSelector: rootSelector }),
|
|
@@ -1696,7 +1712,7 @@ const QuickStartTile = ({ quickStart, status, isActive, onClick = () => { }, })
|
|
|
1696
1712
|
|
|
1697
1713
|
const QuickStartCatalog = ({ quickStarts }) => {
|
|
1698
1714
|
const { activeQuickStartID, allQuickStartStates } = React.useContext(QuickStartContext);
|
|
1699
|
-
return (React.createElement("div", { className: "pfext-page-layout__content
|
|
1715
|
+
return (React.createElement("div", { className: "pfext-page-layout__content" },
|
|
1700
1716
|
React.createElement(Gallery, { className: "pfext-quick-start-catalog__gallery", hasGutter: true }, quickStarts.map((quickStart) => {
|
|
1701
1717
|
const { metadata: { name: id }, } = quickStart;
|
|
1702
1718
|
return (React.createElement(GalleryItem, { key: id, className: "pfext-quick-start-catalog__gallery-item" },
|
|
@@ -1901,7 +1917,7 @@ const QuickStartCatalogHeader = ({ title, hint, }) => (React.createElement("div"
|
|
|
1901
1917
|
React.createElement("h1", { "data-pf-content": "true", className: "pfext-page-layout__title" }, title),
|
|
1902
1918
|
hint && React.createElement("div", { className: "pfext-page-layout__hint" }, hint)));
|
|
1903
1919
|
|
|
1904
|
-
const QuickStartCatalogSection = ({ children }) => (React.createElement("div", { className: "pfext-page-layout__content
|
|
1920
|
+
const QuickStartCatalogSection = ({ children }) => (React.createElement("div", { className: "pfext-page-layout__content" }, children));
|
|
1905
1921
|
|
|
1906
1922
|
const QuickStartCatalogToolbar = ({ children }) => (React.createElement(Toolbar, { usePageInsets: true, className: "pfext-quick-start-catalog-filter__flex" }, children));
|
|
1907
1923
|
|
|
@@ -2336,6 +2352,7 @@ const useValuesForHelpTopicContext = (value = {}) => {
|
|
|
2336
2352
|
};
|
|
2337
2353
|
|
|
2338
2354
|
const HelpTopicPanelContent = (_a) => {
|
|
2355
|
+
var _b, _c;
|
|
2339
2356
|
var { activeHelpTopic = null, filteredHelpTopics = [], isResizable = true, onClose } = _a, props = __rest(_a, ["activeHelpTopic", "filteredHelpTopics", "isResizable", "onClose"]);
|
|
2340
2357
|
const { setActiveHelpTopicByName } = React.useContext(HelpTopicContext);
|
|
2341
2358
|
const [isHelpTopicMenuOpen, setIsHelpTopicMenuOpen] = React.useState(false);
|
|
@@ -2354,10 +2371,11 @@ const HelpTopicPanelContent = (_a) => {
|
|
|
2354
2371
|
const paddingContainer = (children) => React.createElement("div", { style: { padding: '24px' } }, children);
|
|
2355
2372
|
const panelBodyItems = (React.createElement(React.Fragment, null,
|
|
2356
2373
|
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((
|
|
2359
|
-
return React.createElement(
|
|
2360
|
-
|
|
2374
|
+
((_b = activeHelpTopic === null || activeHelpTopic === void 0 ? void 0 : activeHelpTopic.links) === null || _b === void 0 ? void 0 : _b.length) && React.createElement(Divider, null),
|
|
2375
|
+
paddingContainer(React.createElement(Stack, { hasGutter: true }, (_c = activeHelpTopic === null || activeHelpTopic === void 0 ? void 0 : activeHelpTopic.links) === null || _c === void 0 ? void 0 : _c.map(({ href, text, newTab, isExternal }, index) => {
|
|
2376
|
+
return (React.createElement(StackItem, { key: index },
|
|
2377
|
+
React.createElement(Button, { component: "a", href: href, target: newTab ? '_blank' : '', rel: "noopener noreferrer", variant: "link", "aria-label": `Open documentation in new window`, isInline: true, icon: isExternal ? React.createElement(ExternalLinkAltIcon, null) : null, iconPosition: "right", style: { fontSize: 'inherit' } }, text || href)));
|
|
2378
|
+
})))));
|
|
2361
2379
|
const content = (React.createElement(DrawerPanelContent, Object.assign({ isResizable: isResizable, className: "pfext-quick-start__base" }, props),
|
|
2362
2380
|
React.createElement("div", null,
|
|
2363
2381
|
React.createElement(DrawerHead, null,
|
|
@@ -2392,20 +2410,8 @@ const HelpTopicContainer = (_a) => {
|
|
|
2392
2410
|
React.createElement(HelpTopicDrawer, Object.assign({}, drawerProps), children)));
|
|
2393
2411
|
};
|
|
2394
2412
|
const HelpTopicDrawer = (_a) => {
|
|
2395
|
-
var {
|
|
2396
|
-
// helpTopics,
|
|
2397
|
-
children } = _a, props = __rest(_a, ["children"]);
|
|
2413
|
+
var { children } = _a, props = __rest(_a, ["children"]);
|
|
2398
2414
|
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
2415
|
const onClose = () => {
|
|
2410
2416
|
setActiveHelpTopicByName('');
|
|
2411
2417
|
};
|