@patternfly/quickstarts 2.3.2 → 2.4.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/ConsoleShared/src/components/markdown-extensions/accordion-extension.d.ts +7 -0
- package/dist/ConsoleShared/src/components/markdown-extensions/accordion-render-extension.d.ts +6 -0
- package/dist/ConsoleShared/src/components/markdown-extensions/const.d.ts +2 -0
- package/dist/ConsoleShared/src/components/markdown-extensions/index.d.ts +2 -0
- package/dist/ConsoleShared/src/components/status/NotStartedIcon.d.ts +0 -1
- package/dist/index.es.js +53 -6
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +52 -5
- package/dist/index.js.map +1 -1
- package/dist/patternfly-global.css +890 -419
- package/dist/patternfly-nested.css +12484 -7322
- package/dist/quickstarts-base.css +863 -664
- package/dist/quickstarts-full.es.js +3738 -1920
- package/dist/quickstarts-full.es.js.map +1 -1
- package/dist/quickstarts-standalone.css +848 -622
- package/dist/quickstarts-standalone.min.css +2 -2
- package/dist/quickstarts-vendor.css +84 -55
- package/dist/quickstarts.css +946 -719
- package/dist/quickstarts.min.css +1 -1
- package/dist/utils/quick-start-types.d.ts +0 -1
- package/package.json +14 -10
- package/src/ConsoleInternal/components/catalog/_catalog.scss +7 -5
- package/src/ConsoleShared/src/components/markdown-extensions/accordion-extension.tsx +52 -0
- package/src/ConsoleShared/src/components/markdown-extensions/accordion-render-extension.tsx +60 -0
- package/src/ConsoleShared/src/components/markdown-extensions/const.ts +2 -0
- package/src/ConsoleShared/src/components/markdown-extensions/index.ts +2 -0
- package/src/QuickStartMarkdownView.tsx +5 -0
- package/src/QuickStartPanelContent.tsx +7 -1
- package/src/catalog/QuickStartTileHeader.tsx +2 -1
- package/src/styles/legacy-bootstrap/_code.scss +4 -2
- package/src/styles/legacy-bootstrap/_type.scss +8 -6
- package/src/styles/patternfly-nested.scss +9 -9
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import './showdown-extension.scss';
|
|
2
|
+
declare const useAccordionShowdownExtension: () => {
|
|
3
|
+
type: string;
|
|
4
|
+
regex: RegExp;
|
|
5
|
+
replace: (_text: string, accordionContent: string, _command: string, accordionHeading: string) => string;
|
|
6
|
+
};
|
|
7
|
+
export default useAccordionShowdownExtension;
|
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
export declare const MARKDOWN_COPY_BUTTON_ID = "data-copy-for";
|
|
2
2
|
export declare const MARKDOWN_EXECUTE_BUTTON_ID = "data-execute-for";
|
|
3
3
|
export declare const MARKDOWN_SNIPPET_ID = "data-snippet-id";
|
|
4
|
+
export declare const ACCORDION_MARKDOWN_BUTTON_ID = "accordion-markdown-button-id";
|
|
5
|
+
export declare const ACCORDION_MARKDOWN_CONTENT_ID = "accordion-markdown-content-id";
|
|
@@ -3,3 +3,5 @@ export { default as useInlineCopyClipboardShowdownExtension } from './inline-cli
|
|
|
3
3
|
export { default as useMultilineCopyClipboardShowdownExtension } from './multiline-clipboard-extension';
|
|
4
4
|
export { default as useAdmonitionShowdownExtension } from './admonition-extension';
|
|
5
5
|
export { default as useCodeShowdownExtension } from './code-extension';
|
|
6
|
+
export { default as useAccordionShowdownExtension } from './accordion-extension';
|
|
7
|
+
export { default as AccordionRenderExtension } from './accordion-render-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, 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';
|
|
3
|
+
import { Card, CardHeader, CardActions, CardTitle, CardBody, CardFooter, Modal as Modal$1, Tooltip, Alert, CodeBlock, Accordion, AccordionItem, AccordionToggle, AccordionContent, 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';
|
|
@@ -872,7 +872,7 @@ class CatalogTile extends React.Component {
|
|
|
872
872
|
const _a = this.props, { id, className, featured, onClick, href, icon, iconImg, iconAlt, iconClass, badges, title, vendor, description, footer,
|
|
873
873
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
874
874
|
ref, children } = _a, props = __rest(_a, ["id", "className", "featured", "onClick", "href", "icon", "iconImg", "iconAlt", "iconClass", "badges", "title", "vendor", "description", "footer", "ref", "children"]);
|
|
875
|
-
return (React.createElement(Card, Object.assign({ component: href || onClick ? 'a' : 'div', id: id, href: href || '#', className: css('catalog-tile-pf', { featured }, className), onClick: e => this.handleClick(e),
|
|
875
|
+
return (React.createElement(Card, Object.assign({ component: href || onClick ? 'a' : 'div', id: id, href: href || '#', className: css('catalog-tile-pf', { featured }, className), onClick: e => this.handleClick(e), isSelectable: true }, props),
|
|
876
876
|
(badges.length > 0 || iconImg || iconClass || icon) && (React.createElement(CardHeader, null,
|
|
877
877
|
iconImg && React.createElement("img", { className: "catalog-tile-pf-icon", src: iconImg, alt: iconAlt }),
|
|
878
878
|
!iconImg && (iconClass || icon) && React.createElement("span", { className: `catalog-tile-pf-icon ${iconClass}` }, icon),
|
|
@@ -1195,7 +1195,9 @@ const MarkdownHighlightExtension = ({ docContext, rootSelector, }) => {
|
|
|
1195
1195
|
};
|
|
1196
1196
|
|
|
1197
1197
|
const MARKDOWN_COPY_BUTTON_ID = 'data-copy-for';
|
|
1198
|
-
const MARKDOWN_SNIPPET_ID = 'data-snippet-id';
|
|
1198
|
+
const MARKDOWN_SNIPPET_ID = 'data-snippet-id';
|
|
1199
|
+
const ACCORDION_MARKDOWN_BUTTON_ID = `accordion-markdown-button-id`;
|
|
1200
|
+
const ACCORDION_MARKDOWN_CONTENT_ID = `accordion-markdown-content-id`;
|
|
1199
1201
|
|
|
1200
1202
|
const CopyClipboard = ({ element, rootSelector, docContext, }) => {
|
|
1201
1203
|
const { getResource } = React.useContext(QuickStartContext);
|
|
@@ -1459,6 +1461,7 @@ const QuickStartMarkdownView = ({ content, exactHeight, className, }) => {
|
|
|
1459
1461
|
const multilineCopyClipboardShowdownExtension = useMultilineCopyClipboardShowdownExtension();
|
|
1460
1462
|
const admonitionShowdownExtension = useAdmonitionShowdownExtension();
|
|
1461
1463
|
const codeShowdownExtension = useCodeShowdownExtension();
|
|
1464
|
+
const accordionShowdownExtension = useAccordionShowdownExtension();
|
|
1462
1465
|
return (React.createElement(SyncMarkdownView, { inline: true, content: content, exactHeight: exactHeight, extensions: [
|
|
1463
1466
|
{
|
|
1464
1467
|
type: 'lang',
|
|
@@ -1482,8 +1485,10 @@ const QuickStartMarkdownView = ({ content, exactHeight, className, }) => {
|
|
|
1482
1485
|
multilineCopyClipboardShowdownExtension,
|
|
1483
1486
|
admonitionShowdownExtension,
|
|
1484
1487
|
codeShowdownExtension,
|
|
1488
|
+
accordionShowdownExtension,
|
|
1485
1489
|
...(markdown ? markdown.extensions : []),
|
|
1486
1490
|
], renderExtension: (docContext, rootSelector) => (React.createElement(React.Fragment, null,
|
|
1491
|
+
React.createElement(AccordionRenderExtension, { docContext: docContext }),
|
|
1487
1492
|
React.createElement(MarkdownHighlightExtension, { docContext: docContext, rootSelector: rootSelector }),
|
|
1488
1493
|
React.createElement(MarkdownCopyClipboard, { docContext: docContext, rootSelector: rootSelector }),
|
|
1489
1494
|
markdown &&
|
|
@@ -1539,6 +1544,45 @@ const useCodeShowdownExtension = () => {
|
|
|
1539
1544
|
}), []);
|
|
1540
1545
|
};
|
|
1541
1546
|
|
|
1547
|
+
const useAccordionShowdownExtension = () => {
|
|
1548
|
+
return React.useMemo(() => ({
|
|
1549
|
+
type: 'lang',
|
|
1550
|
+
regex: /\[(.+)]{{(accordion) ("(.*?)")}}/g,
|
|
1551
|
+
replace: (_text, accordionContent, _command, accordionHeading) => {
|
|
1552
|
+
const accordionId = new String(accordionHeading).replace(/\s/g, '-');
|
|
1553
|
+
return removeTemplateWhitespace(renderToStaticMarkup(React.createElement(Accordion, { asDefinitionList: true },
|
|
1554
|
+
React.createElement(AccordionItem, null,
|
|
1555
|
+
React.createElement(AccordionToggle, { isExpanded: false, id: `${ACCORDION_MARKDOWN_BUTTON_ID}-${accordionId}` }, accordionHeading),
|
|
1556
|
+
React.createElement(AccordionContent, { id: `${ACCORDION_MARKDOWN_CONTENT_ID}-${accordionId}`, isHidden: !false }, accordionContent)))));
|
|
1557
|
+
},
|
|
1558
|
+
}), []);
|
|
1559
|
+
};
|
|
1560
|
+
|
|
1561
|
+
const AccordionShowdownHandler = ({ buttonElement, contentElement, }) => {
|
|
1562
|
+
const [expanded, setExpanded] = React.useState(false);
|
|
1563
|
+
const handleClick = () => {
|
|
1564
|
+
const expandedModifier = 'pf-m-expanded';
|
|
1565
|
+
buttonElement.className = `pf-c-accordion__toggle ${!expanded ? expandedModifier : ''}`;
|
|
1566
|
+
contentElement.hidden = expanded;
|
|
1567
|
+
contentElement.className = `pf-c-accordion__expanded-content ${!expanded ? expandedModifier : ''}`;
|
|
1568
|
+
setExpanded(!expanded);
|
|
1569
|
+
};
|
|
1570
|
+
useEventListener(buttonElement, 'click', handleClick);
|
|
1571
|
+
return React.createElement(React.Fragment, null);
|
|
1572
|
+
};
|
|
1573
|
+
const AccordionRenderExtension = ({ docContext }) => {
|
|
1574
|
+
const buttonElements = docContext.querySelectorAll(`[id ^= ${ACCORDION_MARKDOWN_BUTTON_ID}]`);
|
|
1575
|
+
const contentElements = docContext.querySelectorAll(`[id ^= ${ACCORDION_MARKDOWN_CONTENT_ID}]`);
|
|
1576
|
+
return buttonElements.length > 0 ? (React.createElement(React.Fragment, null, Array.from(buttonElements).map((elm) => {
|
|
1577
|
+
const content = Array.from(contentElements).find((elm2) => {
|
|
1578
|
+
const elmId = elm.id.split(ACCORDION_MARKDOWN_BUTTON_ID)[1];
|
|
1579
|
+
const elm2Id = elm2.id.split(ACCORDION_MARKDOWN_CONTENT_ID)[1];
|
|
1580
|
+
return elmId === elm2Id;
|
|
1581
|
+
});
|
|
1582
|
+
return (React.createElement(AccordionShowdownHandler, { key: elm.id.split(ACCORDION_MARKDOWN_BUTTON_ID)[1], buttonElement: elm, contentElement: content }));
|
|
1583
|
+
}))) : null;
|
|
1584
|
+
};
|
|
1585
|
+
|
|
1542
1586
|
const FallbackImg = ({ src, alt, className, fallback }) => {
|
|
1543
1587
|
const [isSrcValid, setIsSrcValid] = React.useState(true);
|
|
1544
1588
|
if (src && isSrcValid) {
|
|
@@ -1669,7 +1713,8 @@ const QuickStartTileHeader = ({ status, duration, name, type, quickStartId, }) =
|
|
|
1669
1713
|
[QuickStartStatus.NOT_STARTED]: getResource('Not started'),
|
|
1670
1714
|
};
|
|
1671
1715
|
return (React.createElement("div", { className: "pfext-quick-start-tile-header" },
|
|
1672
|
-
React.createElement(Title, { headingLevel: "h3", "data-test": "title", id: quickStartId },
|
|
1716
|
+
React.createElement(Title, { headingLevel: "h3", "data-test": "title", id: quickStartId },
|
|
1717
|
+
React.createElement(QuickStartMarkdownView, { content: name })),
|
|
1673
1718
|
React.createElement("div", { className: "pfext-quick-start-tile-header__status" },
|
|
1674
1719
|
type && (React.createElement(Label, { className: "pfext-quick-start-tile-header--margin", color: type.color }, type.text)),
|
|
1675
1720
|
duration && (React.createElement(Label, { variant: "outline", "data-test": "duration", icon: React.createElement(OutlinedClockIcon, null), className: "pfext-quick-start-tile-header--margin" }, getResource('{{duration, number}} minutes', duration).replace('{{duration, number}}', duration))),
|
|
@@ -2217,8 +2262,10 @@ const QuickStartPanelContent = (_a) => {
|
|
|
2217
2262
|
React.createElement("div", { className: headerClasses },
|
|
2218
2263
|
React.createElement(DrawerHead, null,
|
|
2219
2264
|
React.createElement("div", { className: "pfext-quick-start-panel-content__title", tabIndex: -1, ref: titleRef },
|
|
2220
|
-
React.createElement(Title, { headingLevel: "h1", size: "xl", className: "pfext-quick-start-panel-content__name", style: { marginRight: 'var(--pf-global--spacer--md)' } },
|
|
2221
|
-
|
|
2265
|
+
React.createElement(Title, { headingLevel: "h1", size: "xl", className: "pfext-quick-start-panel-content__name", style: { marginRight: 'var(--pf-global--spacer--md)' } },
|
|
2266
|
+
React.createElement("span", { dangerouslySetInnerHTML: {
|
|
2267
|
+
__html: removeParagraphWrap(markdownConvert(quickStart === null || quickStart === void 0 ? void 0 : quickStart.spec.displayName)),
|
|
2268
|
+
} }),
|
|
2222
2269
|
' ',
|
|
2223
2270
|
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)
|
|
2224
2271
|
.replace('{{duration, number}}', quickStart === null || quickStart === void 0 ? void 0 : quickStart.spec.durationMinutes)
|