@patternfly/quickstarts 6.3.0 → 6.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 +1 -1
- package/dist/ConsoleShared/src/components/markdown-extensions/admonition-extension.d.ts +1 -1
- package/dist/index.es.js +232 -147
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +232 -147
- package/dist/index.js.map +1 -1
- package/dist/quickstarts-full.es.js +280 -195
- package/dist/quickstarts-full.es.js.map +1 -1
- package/package.json +2 -2
- package/src/ConsoleInternal/components/markdown-view.tsx +92 -4
- package/src/ConsoleShared/src/components/markdown-extensions/__tests__/accordion-extension.spec.tsx +105 -0
- package/src/ConsoleShared/src/components/markdown-extensions/__tests__/admonition-extension.spec.tsx +121 -0
- package/src/ConsoleShared/src/components/markdown-extensions/accordion-extension.tsx +20 -13
- package/src/ConsoleShared/src/components/markdown-extensions/accordion-render-extension.tsx +19 -5
- package/src/ConsoleShared/src/components/markdown-extensions/admonition-extension.tsx +17 -6
- package/src/QuickStartDrawerContent.tsx +2 -5
- package/src/catalog/Toolbar/QuickStartCatalogFilterItems.tsx +1 -4
- package/src/controller/QuickStartIntroduction.tsx +1 -1
package/dist/index.js
CHANGED
|
@@ -62,18 +62,13 @@ var ArrowRightIcon__default = /*#__PURE__*/_interopDefaultLegacy(ArrowRightIcon)
|
|
|
62
62
|
var BarsIcon__default = /*#__PURE__*/_interopDefaultLegacy(BarsIcon);
|
|
63
63
|
|
|
64
64
|
function _extends() {
|
|
65
|
-
_extends = Object.assign ? Object.assign.bind() : function (
|
|
66
|
-
for (var
|
|
67
|
-
var
|
|
68
|
-
for (var
|
|
69
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
70
|
-
target[key] = source[key];
|
|
71
|
-
}
|
|
72
|
-
}
|
|
65
|
+
return _extends = Object.assign ? Object.assign.bind() : function (n) {
|
|
66
|
+
for (var e = 1; e < arguments.length; e++) {
|
|
67
|
+
var t = arguments[e];
|
|
68
|
+
for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
|
|
73
69
|
}
|
|
74
|
-
return
|
|
75
|
-
};
|
|
76
|
-
return _extends.apply(this, arguments);
|
|
70
|
+
return n;
|
|
71
|
+
}, _extends.apply(null, arguments);
|
|
77
72
|
}
|
|
78
73
|
|
|
79
74
|
var m,x=m||(m={});x.Pop="POP";x.Push="PUSH";x.Replace="REPLACE";var y="production"!==process.env.NODE_ENV?function(a){return Object.freeze(a)}:function(a){return a};function z(a,b){if(!a){"undefined"!==typeof console&&console.warn(b);try{throw Error(b);}catch(g){}}}function A(a){a.preventDefault();a.returnValue="";}
|
|
@@ -1191,6 +1186,155 @@ const useMultilineCopyClipboardShowdownExtension = () => {
|
|
|
1191
1186
|
}), [getResource]);
|
|
1192
1187
|
};
|
|
1193
1188
|
|
|
1189
|
+
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
1190
|
+
const DOMPurify$2 = require('dompurify');
|
|
1191
|
+
var AdmonitionType;
|
|
1192
|
+
(function (AdmonitionType) {
|
|
1193
|
+
AdmonitionType["TIP"] = "TIP";
|
|
1194
|
+
AdmonitionType["NOTE"] = "NOTE";
|
|
1195
|
+
AdmonitionType["IMPORTANT"] = "IMPORTANT";
|
|
1196
|
+
AdmonitionType["WARNING"] = "WARNING";
|
|
1197
|
+
AdmonitionType["CAUTION"] = "CAUTION";
|
|
1198
|
+
})(AdmonitionType || (AdmonitionType = {}));
|
|
1199
|
+
const admonitionToAlertVariantMap = {
|
|
1200
|
+
[AdmonitionType.NOTE]: { variant: 'info' },
|
|
1201
|
+
[AdmonitionType.TIP]: { variant: 'custom', customIcon: jsxRuntime.jsx(LightbulbIcon__default["default"], {}) },
|
|
1202
|
+
[AdmonitionType.IMPORTANT]: { variant: 'danger' },
|
|
1203
|
+
[AdmonitionType.CAUTION]: { variant: 'warning', customIcon: jsxRuntime.jsx(FireIcon__default["default"], {}) },
|
|
1204
|
+
[AdmonitionType.WARNING]: { variant: 'warning' },
|
|
1205
|
+
};
|
|
1206
|
+
const useAdmonitionShowdownExtension = () =>
|
|
1207
|
+
// const { getResource } = React.useContext<QuickStartContextValues>(QuickStartContext);
|
|
1208
|
+
react.useMemo(() => ({
|
|
1209
|
+
type: 'lang',
|
|
1210
|
+
regex: /\[(.+)]{{(admonition) ([\w-]+)}}/g,
|
|
1211
|
+
replace: (text, content, admonitionLabel, admonitionType) => {
|
|
1212
|
+
if (!content || !admonitionLabel || !admonitionType) {
|
|
1213
|
+
return text;
|
|
1214
|
+
}
|
|
1215
|
+
if (admonitionLabel !== 'admonition') {
|
|
1216
|
+
return text;
|
|
1217
|
+
}
|
|
1218
|
+
admonitionType = admonitionType.toUpperCase();
|
|
1219
|
+
// Process markdown content directly using marked
|
|
1220
|
+
const processedContent = marked.marked.parseInline(content);
|
|
1221
|
+
const sanitizedContent = DOMPurify$2.sanitize(processedContent);
|
|
1222
|
+
// Handle unknown admonition types by defaulting to NOTE
|
|
1223
|
+
const admonitionConfig = admonitionToAlertVariantMap[admonitionType] || admonitionToAlertVariantMap.NOTE;
|
|
1224
|
+
const { variant, customIcon } = admonitionConfig;
|
|
1225
|
+
const pfAlert = (jsxRuntime.jsx(reactCore.Alert, Object.assign({ variant: variant }, (customIcon && { customIcon }), { isInline: true, title: admonitionType, className: "pfext-markdown-admonition" }, { children: jsxRuntime.jsx("div", { dangerouslySetInnerHTML: { __html: sanitizedContent } }) })));
|
|
1226
|
+
return removeTemplateWhitespace(server.renderToStaticMarkup(pfAlert));
|
|
1227
|
+
},
|
|
1228
|
+
}), []);
|
|
1229
|
+
|
|
1230
|
+
const useCodeShowdownExtension = () => react.useMemo(() => ({
|
|
1231
|
+
type: 'output',
|
|
1232
|
+
regex: /<pre><code>(.*?)\n?<\/code><\/pre>/g,
|
|
1233
|
+
replace: (text, content) => {
|
|
1234
|
+
if (!content) {
|
|
1235
|
+
return text;
|
|
1236
|
+
}
|
|
1237
|
+
const pfCodeBlock = jsxRuntime.jsx(reactCore.CodeBlock, { children: content });
|
|
1238
|
+
return removeTemplateWhitespace(server.renderToStaticMarkup(pfCodeBlock));
|
|
1239
|
+
},
|
|
1240
|
+
}), []);
|
|
1241
|
+
|
|
1242
|
+
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
1243
|
+
const DOMPurify$1 = require('dompurify');
|
|
1244
|
+
const useAccordionShowdownExtension = () => react.useMemo(() => ({
|
|
1245
|
+
type: 'lang',
|
|
1246
|
+
regex: /\[(.+)]{{(accordion) ("(.*?)")}}/g,
|
|
1247
|
+
replace: (_text, accordionContent, _command, _quotedHeading, accordionHeading) => {
|
|
1248
|
+
const accordionId = String(accordionHeading).replace(/\s/g, '-');
|
|
1249
|
+
// Process accordion content with markdown
|
|
1250
|
+
const processedContent = marked.marked.parseInline(accordionContent);
|
|
1251
|
+
const sanitizedContent = DOMPurify$1.sanitize(processedContent);
|
|
1252
|
+
return removeTemplateWhitespace(server.renderToStaticMarkup(jsxRuntime.jsx(reactCore.Accordion, { children: jsxRuntime.jsxs(reactCore.AccordionItem, { children: [jsxRuntime.jsx(reactCore.AccordionToggle, Object.assign({ id: `${ACCORDION_MARKDOWN_BUTTON_ID}-${accordionId}` }, { children: accordionHeading })), jsxRuntime.jsx(reactCore.AccordionContent, Object.assign({ id: `${ACCORDION_MARKDOWN_CONTENT_ID}-${accordionId}`, hidden: true }, { children: jsxRuntime.jsx("div", { dangerouslySetInnerHTML: { __html: sanitizedContent } }) }))] }) })));
|
|
1253
|
+
},
|
|
1254
|
+
}), []);
|
|
1255
|
+
|
|
1256
|
+
const AccordionShowdownHandler = ({ buttonElement, contentElement, }) => {
|
|
1257
|
+
const [expanded, setExpanded] = react.useState(false);
|
|
1258
|
+
const handleClick = () => {
|
|
1259
|
+
const newExpanded = !expanded;
|
|
1260
|
+
const expandedModifier = 'pf-m-expanded';
|
|
1261
|
+
// Find the accordion item element (parent of the button)
|
|
1262
|
+
const accordionItem = buttonElement.closest('.pf-v6-c-accordion__item');
|
|
1263
|
+
// Update button - both visual state and aria-expanded
|
|
1264
|
+
buttonElement.className = `pf-v6-c-accordion__toggle ${newExpanded ? expandedModifier : ''}`;
|
|
1265
|
+
buttonElement.setAttribute('aria-expanded', newExpanded.toString());
|
|
1266
|
+
// Update content - both visual state and hidden attribute
|
|
1267
|
+
contentElement.hidden = !newExpanded;
|
|
1268
|
+
contentElement.className = `pf-v6-c-accordion__expandable-content ${newExpanded ? expandedModifier : ''}`;
|
|
1269
|
+
// Update accordion item
|
|
1270
|
+
if (accordionItem) {
|
|
1271
|
+
accordionItem.className = `pf-v6-c-accordion__item ${newExpanded ? expandedModifier : ''}`;
|
|
1272
|
+
}
|
|
1273
|
+
setExpanded(newExpanded);
|
|
1274
|
+
};
|
|
1275
|
+
useEventListener(buttonElement, 'click', handleClick);
|
|
1276
|
+
return jsxRuntime.jsx(jsxRuntime.Fragment, {});
|
|
1277
|
+
};
|
|
1278
|
+
const AccordionRenderExtension = ({ docContext }) => {
|
|
1279
|
+
const buttonElements = docContext.querySelectorAll(`[id ^= ${ACCORDION_MARKDOWN_BUTTON_ID}]`);
|
|
1280
|
+
const contentElements = docContext.querySelectorAll(`[id ^= ${ACCORDION_MARKDOWN_CONTENT_ID}]`);
|
|
1281
|
+
return buttonElements.length > 0 ? (jsxRuntime.jsx(jsxRuntime.Fragment, { children: Array.from(buttonElements).map((elm) => {
|
|
1282
|
+
const content = Array.from(contentElements).find((elm2) => {
|
|
1283
|
+
const elmId = elm.id.split(ACCORDION_MARKDOWN_BUTTON_ID)[1];
|
|
1284
|
+
const elm2Id = elm2.id.split(ACCORDION_MARKDOWN_CONTENT_ID)[1];
|
|
1285
|
+
return elmId === elm2Id;
|
|
1286
|
+
});
|
|
1287
|
+
return (jsxRuntime.jsx(AccordionShowdownHandler, { buttonElement: elm, contentElement: content }, elm.id.split(ACCORDION_MARKDOWN_BUTTON_ID)[1]));
|
|
1288
|
+
}) })) : null;
|
|
1289
|
+
};
|
|
1290
|
+
|
|
1291
|
+
const FallbackImg = ({ src, alt, className, fallback }) => {
|
|
1292
|
+
const [isSrcValid, setIsSrcValid] = react.useState(true);
|
|
1293
|
+
if (src && isSrcValid) {
|
|
1294
|
+
return jsxRuntime.jsx("img", { className: className, src: src, alt: alt, onError: () => setIsSrcValid(false) });
|
|
1295
|
+
}
|
|
1296
|
+
return jsxRuntime.jsx(jsxRuntime.Fragment, { children: fallback });
|
|
1297
|
+
};
|
|
1298
|
+
|
|
1299
|
+
const DASH = '-';
|
|
1300
|
+
|
|
1301
|
+
const PopoverStatus = ({ hideHeader, children, isVisible = null, statusBody, title, onHide, onShow, }) => (jsxRuntime.jsx(reactCore.Popover, Object.assign({ position: reactCore.PopoverPosition.right, headerContent: hideHeader ? null : title, bodyContent: children, "aria-label": title, onHide: onHide, onShow: onShow, isVisible: isVisible }, { children: jsxRuntime.jsx(reactCore.Button, Object.assign({ variant: "link", isInline: true }, { children: statusBody })) })));
|
|
1302
|
+
|
|
1303
|
+
const StatusIconAndText = ({ icon, title, spin, iconOnly, noTooltip, className, }) => {
|
|
1304
|
+
if (!title) {
|
|
1305
|
+
return jsxRuntime.jsx(jsxRuntime.Fragment, { children: DASH });
|
|
1306
|
+
}
|
|
1307
|
+
return (jsxRuntime.jsxs("span", Object.assign({ className: reactStyles.css('pfext-icon-and-text', className), title: iconOnly && !noTooltip ? title : undefined }, { children: [icon &&
|
|
1308
|
+
react.cloneElement(icon, {
|
|
1309
|
+
className: reactStyles.css(spin && 'fa-spin', icon.props.className, !iconOnly && 'pfext-icon-and-text__icon pfext-icon-flex-child'),
|
|
1310
|
+
}), !iconOnly && jsxRuntime.jsx(CamelCaseWrap, { value: title, dataTest: "status-text" })] })));
|
|
1311
|
+
};
|
|
1312
|
+
|
|
1313
|
+
const GenericStatus = (props) => {
|
|
1314
|
+
const { Icon, children, popoverTitle, title, noTooltip, iconOnly } = props, restProps = tslib.__rest(props, ["Icon", "children", "popoverTitle", "title", "noTooltip", "iconOnly"]);
|
|
1315
|
+
const renderIcon = iconOnly && !noTooltip ? jsxRuntime.jsx(Icon, { title: title }) : jsxRuntime.jsx(Icon, {});
|
|
1316
|
+
const statusBody = (jsxRuntime.jsx(StatusIconAndText, Object.assign({}, restProps, { noTooltip: noTooltip, title: title, iconOnly: iconOnly, icon: renderIcon })));
|
|
1317
|
+
return react.Children.toArray(children).length ? (jsxRuntime.jsx(PopoverStatus, Object.assign({ title: popoverTitle || title }, restProps, { statusBody: statusBody }, { children: children }))) : (statusBody);
|
|
1318
|
+
};
|
|
1319
|
+
|
|
1320
|
+
const GreenCheckCircleIcon = ({ className, title, size }) => (jsxRuntime.jsx(reactCore.Icon, Object.assign({ size: size, status: "success" }, { children: jsxRuntime.jsx(CheckCircleIcon__default["default"], { "data-test": "success-icon", className: className, title: title }) })));
|
|
1321
|
+
|
|
1322
|
+
const SuccessStatus = (props) => (jsxRuntime.jsx(GenericStatus, Object.assign({}, props, { Icon: GreenCheckCircleIcon, title: props.title || 'Healthy' })));
|
|
1323
|
+
SuccessStatus.displayName = 'SuccessStatus';
|
|
1324
|
+
|
|
1325
|
+
const Status = ({ status, title, iconOnly, noTooltip, className }) => {
|
|
1326
|
+
const statusProps = { title: title || status, iconOnly, noTooltip, className };
|
|
1327
|
+
switch (status) {
|
|
1328
|
+
case 'In Progress':
|
|
1329
|
+
return jsxRuntime.jsx(StatusIconAndText, Object.assign({}, statusProps, { icon: jsxRuntime.jsx(SyncAltIcon__default["default"], {}) }));
|
|
1330
|
+
case 'Complete':
|
|
1331
|
+
return jsxRuntime.jsx(SuccessStatus, Object.assign({}, statusProps));
|
|
1332
|
+
default:
|
|
1333
|
+
return jsxRuntime.jsx(jsxRuntime.Fragment, { children: status || DASH });
|
|
1334
|
+
}
|
|
1335
|
+
};
|
|
1336
|
+
const StatusIcon = ({ status }) => jsxRuntime.jsx(Status, { status: status, iconOnly: true });
|
|
1337
|
+
|
|
1194
1338
|
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
1195
1339
|
const DOMPurify = require('dompurify');
|
|
1196
1340
|
const markdownConvert = (markdown, extensions) => tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
@@ -1202,7 +1346,7 @@ const markdownConvert = (markdown, extensions) => tslib.__awaiter(void 0, void 0
|
|
|
1202
1346
|
node.setAttribute('rel', 'noopener noreferrer');
|
|
1203
1347
|
return node;
|
|
1204
1348
|
}
|
|
1205
|
-
// add PF content classes
|
|
1349
|
+
// add PF content classes to standard elements (details blocks get handled separately)
|
|
1206
1350
|
if (node.nodeType === 1) {
|
|
1207
1351
|
const contentElements = [
|
|
1208
1352
|
'ul',
|
|
@@ -1253,13 +1397,82 @@ const markdownConvert = (markdown, extensions) => tslib.__awaiter(void 0, void 0
|
|
|
1253
1397
|
const reversedMarkdown = reverseString(markdown);
|
|
1254
1398
|
const reverseMarkdownWithSubstitutedCodeFences = reversedMarkdown.replace(/{{```((.|\n)*?)```/g, '{{@@@$1@@@');
|
|
1255
1399
|
const markdownWithSubstitutedCodeFences = reverseString(reverseMarkdownWithSubstitutedCodeFences);
|
|
1256
|
-
|
|
1400
|
+
// Fix malformed HTML entities early in the process
|
|
1401
|
+
let preprocessedMarkdown = markdownWithSubstitutedCodeFences;
|
|
1402
|
+
preprocessedMarkdown = preprocessedMarkdown
|
|
1403
|
+
.replace(/ ([^;])/g, ' $1')
|
|
1404
|
+
.replace(/&nbsp;/g, ' ');
|
|
1405
|
+
preprocessedMarkdown = preprocessedMarkdown.replace(/ (?![;])/g, ' ');
|
|
1406
|
+
// Process content in segments to ensure markdown parsing continues after HTML blocks
|
|
1407
|
+
const htmlBlockRegex = /(<(?:details|div|section|article)[^>]*>[\s\S]*?<\/(?:details|div|section|article)>)/g;
|
|
1408
|
+
let parsedMarkdown = '';
|
|
1409
|
+
// Check if there are any HTML blocks
|
|
1410
|
+
if (htmlBlockRegex.test(preprocessedMarkdown)) {
|
|
1411
|
+
// Reset regex for actual processing
|
|
1412
|
+
htmlBlockRegex.lastIndex = 0;
|
|
1413
|
+
let lastIndex = 0;
|
|
1414
|
+
let match;
|
|
1415
|
+
while ((match = htmlBlockRegex.exec(preprocessedMarkdown)) !== null) {
|
|
1416
|
+
// Process markdown before the HTML block
|
|
1417
|
+
const markdownBefore = preprocessedMarkdown.slice(lastIndex, match.index).trim();
|
|
1418
|
+
if (markdownBefore) {
|
|
1419
|
+
const parsed = yield marked.marked.parse(markdownBefore);
|
|
1420
|
+
parsedMarkdown += parsed;
|
|
1421
|
+
}
|
|
1422
|
+
// Process the HTML block: parse markdown content inside while preserving HTML structure
|
|
1423
|
+
let htmlBlock = match[1];
|
|
1424
|
+
// Find and process markdown content inside HTML tags
|
|
1425
|
+
const contentRegex = />(\s*[\s\S]*?)\s*</g;
|
|
1426
|
+
const contentMatches = [];
|
|
1427
|
+
let contentMatch;
|
|
1428
|
+
while ((contentMatch = contentRegex.exec(htmlBlock)) !== null) {
|
|
1429
|
+
const content = contentMatch[1];
|
|
1430
|
+
// Only process content that has markdown formatting but no extension syntax
|
|
1431
|
+
if (content.trim() &&
|
|
1432
|
+
!content.includes('{{') &&
|
|
1433
|
+
(content.includes('**') || content.includes('- ') || content.includes('\n'))) {
|
|
1434
|
+
// This looks like markdown content without extensions - parse it as block content
|
|
1435
|
+
const parsedContent = yield marked.marked.parse(content.trim());
|
|
1436
|
+
// Remove wrapping <p> tags if they exist since we're inside HTML already
|
|
1437
|
+
const cleanedContent = parsedContent.replace(/^<p[^>]*>([\s\S]*)<\/p>[\s]*$/g, '$1');
|
|
1438
|
+
contentMatches.push({
|
|
1439
|
+
original: contentMatch[0],
|
|
1440
|
+
replacement: `>${cleanedContent}<`,
|
|
1441
|
+
});
|
|
1442
|
+
}
|
|
1443
|
+
}
|
|
1444
|
+
// Apply the content replacements
|
|
1445
|
+
contentMatches.forEach(({ original, replacement }) => {
|
|
1446
|
+
htmlBlock = htmlBlock.replace(original, replacement);
|
|
1447
|
+
});
|
|
1448
|
+
// Apply extensions (like admonitions) to the processed HTML block
|
|
1449
|
+
if (extensions) {
|
|
1450
|
+
extensions.forEach(({ regex, replace }) => {
|
|
1451
|
+
if (regex) {
|
|
1452
|
+
htmlBlock = htmlBlock.replace(regex, replace);
|
|
1453
|
+
}
|
|
1454
|
+
});
|
|
1455
|
+
}
|
|
1456
|
+
parsedMarkdown += htmlBlock;
|
|
1457
|
+
lastIndex = htmlBlockRegex.lastIndex;
|
|
1458
|
+
}
|
|
1459
|
+
// Process any remaining markdown after the last HTML block
|
|
1460
|
+
const markdownAfter = preprocessedMarkdown.slice(lastIndex).trim();
|
|
1461
|
+
if (markdownAfter) {
|
|
1462
|
+
const parsed = yield marked.marked.parse(markdownAfter);
|
|
1463
|
+
parsedMarkdown += parsed;
|
|
1464
|
+
}
|
|
1465
|
+
}
|
|
1466
|
+
else {
|
|
1467
|
+
// No HTML blocks found, process normally
|
|
1468
|
+
parsedMarkdown = yield marked.marked.parse(preprocessedMarkdown);
|
|
1469
|
+
}
|
|
1257
1470
|
// Swap the temporary tokens back to code fences before we run the extensions
|
|
1258
1471
|
let md = parsedMarkdown.replace(/@@@/g, '```');
|
|
1259
1472
|
if (extensions) {
|
|
1260
1473
|
// Convert code spans back to md format before we run the custom extension regexes
|
|
1261
1474
|
md = md.replace(/<code>(.*)<\/code>/g, '`$1`');
|
|
1262
|
-
extensions.forEach(({ regex, replace }) => {
|
|
1475
|
+
extensions.forEach(({ regex, replace }, _index) => {
|
|
1263
1476
|
if (regex) {
|
|
1264
1477
|
md = md.replace(regex, replace);
|
|
1265
1478
|
}
|
|
@@ -1324,7 +1537,7 @@ const RenderExtension = ({ renderExtension, selector, markup, docContext, }) =>
|
|
|
1324
1537
|
};
|
|
1325
1538
|
const InlineMarkdownView = ({ markup, isEmpty, renderExtension, className, }) => {
|
|
1326
1539
|
const id = react.useMemo(() => uniqueId('markdown'), []);
|
|
1327
|
-
return (jsxRuntime.jsxs("div", Object.assign({ className: reactStyles.css({ 'is-empty': isEmpty }, className), id: id }, { children: [jsxRuntime.jsx("div", { dangerouslySetInnerHTML: { __html: markup } }), renderExtension && (jsxRuntime.jsx(RenderExtension, { renderExtension: renderExtension, selector: `#${id}`, markup: markup }))] })));
|
|
1540
|
+
return (jsxRuntime.jsxs("div", Object.assign({ className: reactStyles.css({ 'is-empty': isEmpty }, className), id: id }, { children: [jsxRuntime.jsx("div", { style: { marginBlockEnd: 'var(--pf-t-global--spacer--md)' }, dangerouslySetInnerHTML: { __html: markup } }), renderExtension && (jsxRuntime.jsx(RenderExtension, { renderExtension: renderExtension, selector: `#${id}`, markup: markup }))] })));
|
|
1328
1541
|
};
|
|
1329
1542
|
const IFrameMarkdownView = ({ exactHeight, markup, isEmpty, renderExtension, className, }) => {
|
|
1330
1543
|
const [frame, setFrame] = react.useState();
|
|
@@ -1383,7 +1596,7 @@ const IFrameMarkdownView = ({ exactHeight, markup, isEmpty, renderExtension, cla
|
|
|
1383
1596
|
}
|
|
1384
1597
|
</style>
|
|
1385
1598
|
<body class="pf-m-redhat-font"><div style="overflow-y: auto;">${markup}</div></body>`;
|
|
1386
|
-
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("iframe", { sandbox: "allow-popups allow-popups-to-escape-sandbox allow-same-origin", srcDoc: contents, style: { border: '0px', display: 'block', width: '100%', height: '0' }, ref: (r) => {
|
|
1599
|
+
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("iframe", { title: "Markdown content preview", sandbox: "allow-popups allow-popups-to-escape-sandbox allow-same-origin", srcDoc: contents, style: { border: '0px', display: 'block', width: '100%', height: '0' }, ref: (r) => {
|
|
1387
1600
|
setFrame(r);
|
|
1388
1601
|
}, onLoad: () => onLoad(), className: className }), loaded && frame && renderExtension && (jsxRuntime.jsx(RenderExtension, { markup: markup, selector: '', renderExtension: renderExtension, docContext: frame.contentDocument }))] }));
|
|
1389
1602
|
};
|
|
@@ -1431,131 +1644,6 @@ const QuickStartMarkdownView = ({ content, exactHeight, className, }) => {
|
|
|
1431
1644
|
markdown.renderExtension(docContext, rootSelector)] })), className: className }));
|
|
1432
1645
|
};
|
|
1433
1646
|
|
|
1434
|
-
var AdmonitionType;
|
|
1435
|
-
(function (AdmonitionType) {
|
|
1436
|
-
AdmonitionType["TIP"] = "TIP";
|
|
1437
|
-
AdmonitionType["NOTE"] = "NOTE";
|
|
1438
|
-
AdmonitionType["IMPORTANT"] = "IMPORTANT";
|
|
1439
|
-
AdmonitionType["WARNING"] = "WARNING";
|
|
1440
|
-
AdmonitionType["CAUTION"] = "CAUTION";
|
|
1441
|
-
})(AdmonitionType || (AdmonitionType = {}));
|
|
1442
|
-
const admonitionToAlertVariantMap = {
|
|
1443
|
-
[AdmonitionType.NOTE]: { variant: 'info' },
|
|
1444
|
-
[AdmonitionType.TIP]: { variant: 'custom', customIcon: jsxRuntime.jsx(LightbulbIcon__default["default"], {}) },
|
|
1445
|
-
[AdmonitionType.IMPORTANT]: { variant: 'danger' },
|
|
1446
|
-
[AdmonitionType.CAUTION]: { variant: 'warning', customIcon: jsxRuntime.jsx(FireIcon__default["default"], {}) },
|
|
1447
|
-
[AdmonitionType.WARNING]: { variant: 'warning' },
|
|
1448
|
-
};
|
|
1449
|
-
const useAdmonitionShowdownExtension = () =>
|
|
1450
|
-
// const { getResource } = React.useContext<QuickStartContextValues>(QuickStartContext);
|
|
1451
|
-
react.useMemo(() => ({
|
|
1452
|
-
type: 'lang',
|
|
1453
|
-
regex: /\[(.+)]{{(admonition) ([\w-]+)}}/g,
|
|
1454
|
-
replace: (text, content, admonitionLabel, admonitionType, groupId) => {
|
|
1455
|
-
if (!content || !admonitionLabel || !admonitionType || !groupId) {
|
|
1456
|
-
return text;
|
|
1457
|
-
}
|
|
1458
|
-
admonitionType = admonitionType.toUpperCase();
|
|
1459
|
-
const { variant, customIcon } = admonitionToAlertVariantMap[admonitionType];
|
|
1460
|
-
const mdContent = jsxRuntime.jsx(QuickStartMarkdownView, { content: content });
|
|
1461
|
-
const pfAlert = (jsxRuntime.jsx(reactCore.Alert, Object.assign({ variant: variant }, (customIcon && { customIcon }), { isInline: true, title: admonitionType, className: "pfext-markdown-admonition" }, { children: mdContent })));
|
|
1462
|
-
return removeTemplateWhitespace(server.renderToStaticMarkup(pfAlert));
|
|
1463
|
-
},
|
|
1464
|
-
}), []);
|
|
1465
|
-
|
|
1466
|
-
const useCodeShowdownExtension = () => react.useMemo(() => ({
|
|
1467
|
-
type: 'output',
|
|
1468
|
-
regex: /<pre><code>(.*?)\n?<\/code><\/pre>/g,
|
|
1469
|
-
replace: (text, content) => {
|
|
1470
|
-
if (!content) {
|
|
1471
|
-
return text;
|
|
1472
|
-
}
|
|
1473
|
-
const pfCodeBlock = jsxRuntime.jsx(reactCore.CodeBlock, { children: content });
|
|
1474
|
-
return removeTemplateWhitespace(server.renderToStaticMarkup(pfCodeBlock));
|
|
1475
|
-
},
|
|
1476
|
-
}), []);
|
|
1477
|
-
|
|
1478
|
-
const useAccordionShowdownExtension = () => react.useMemo(() => ({
|
|
1479
|
-
type: 'lang',
|
|
1480
|
-
regex: /\[(.+)]{{(accordion) ("(.*?)")}}/g,
|
|
1481
|
-
replace: (_text, accordionContent, _command, accordionHeading) => {
|
|
1482
|
-
const accordionId = String(accordionHeading).replace(/\s/g, '-');
|
|
1483
|
-
return removeTemplateWhitespace(server.renderToStaticMarkup(jsxRuntime.jsx(jsxRuntime.Fragment, { children: jsxRuntime.jsx(reactCore.Accordion, Object.assign({ asDefinitionList: true }, { children: jsxRuntime.jsxs(reactCore.AccordionItem, Object.assign({ isExpanded: false }, { children: [jsxRuntime.jsx(reactCore.AccordionToggle, Object.assign({ id: `${ACCORDION_MARKDOWN_BUTTON_ID}-${accordionId}` }, { children: accordionHeading })), jsxRuntime.jsx(reactCore.AccordionContent, Object.assign({ id: `${ACCORDION_MARKDOWN_CONTENT_ID}-${accordionId}` }, { children: accordionContent }))] })) })) })));
|
|
1484
|
-
},
|
|
1485
|
-
}), []);
|
|
1486
|
-
|
|
1487
|
-
const AccordionShowdownHandler = ({ buttonElement, contentElement, }) => {
|
|
1488
|
-
const [expanded, setExpanded] = react.useState(false);
|
|
1489
|
-
const handleClick = () => {
|
|
1490
|
-
const expandedModifier = 'pf-m-expanded';
|
|
1491
|
-
buttonElement.className = `pf-v6-c-accordion__toggle ${!expanded ? expandedModifier : ''}`;
|
|
1492
|
-
contentElement.hidden = expanded;
|
|
1493
|
-
contentElement.className = `pf-v6-c-accordion__expanded-content ${!expanded ? expandedModifier : ''}`;
|
|
1494
|
-
setExpanded(!expanded);
|
|
1495
|
-
};
|
|
1496
|
-
useEventListener(buttonElement, 'click', handleClick);
|
|
1497
|
-
return jsxRuntime.jsx(jsxRuntime.Fragment, {});
|
|
1498
|
-
};
|
|
1499
|
-
const AccordionRenderExtension = ({ docContext }) => {
|
|
1500
|
-
const buttonElements = docContext.querySelectorAll(`[id ^= ${ACCORDION_MARKDOWN_BUTTON_ID}]`);
|
|
1501
|
-
const contentElements = docContext.querySelectorAll(`[id ^= ${ACCORDION_MARKDOWN_CONTENT_ID}]`);
|
|
1502
|
-
return buttonElements.length > 0 ? (jsxRuntime.jsx(jsxRuntime.Fragment, { children: Array.from(buttonElements).map((elm) => {
|
|
1503
|
-
const content = Array.from(contentElements).find((elm2) => {
|
|
1504
|
-
const elmId = elm.id.split(ACCORDION_MARKDOWN_BUTTON_ID)[1];
|
|
1505
|
-
const elm2Id = elm2.id.split(ACCORDION_MARKDOWN_CONTENT_ID)[1];
|
|
1506
|
-
return elmId === elm2Id;
|
|
1507
|
-
});
|
|
1508
|
-
return (jsxRuntime.jsx(AccordionShowdownHandler, { buttonElement: elm, contentElement: content }, elm.id.split(ACCORDION_MARKDOWN_BUTTON_ID)[1]));
|
|
1509
|
-
}) })) : null;
|
|
1510
|
-
};
|
|
1511
|
-
|
|
1512
|
-
const FallbackImg = ({ src, alt, className, fallback }) => {
|
|
1513
|
-
const [isSrcValid, setIsSrcValid] = react.useState(true);
|
|
1514
|
-
if (src && isSrcValid) {
|
|
1515
|
-
return jsxRuntime.jsx("img", { className: className, src: src, alt: alt, onError: () => setIsSrcValid(false) });
|
|
1516
|
-
}
|
|
1517
|
-
return jsxRuntime.jsx(jsxRuntime.Fragment, { children: fallback });
|
|
1518
|
-
};
|
|
1519
|
-
|
|
1520
|
-
const DASH = '-';
|
|
1521
|
-
|
|
1522
|
-
const PopoverStatus = ({ hideHeader, children, isVisible = null, statusBody, title, onHide, onShow, }) => (jsxRuntime.jsx(reactCore.Popover, Object.assign({ position: reactCore.PopoverPosition.right, headerContent: hideHeader ? null : title, bodyContent: children, "aria-label": title, onHide: onHide, onShow: onShow, isVisible: isVisible }, { children: jsxRuntime.jsx(reactCore.Button, Object.assign({ variant: "link", isInline: true }, { children: statusBody })) })));
|
|
1523
|
-
|
|
1524
|
-
const StatusIconAndText = ({ icon, title, spin, iconOnly, noTooltip, className, }) => {
|
|
1525
|
-
if (!title) {
|
|
1526
|
-
return jsxRuntime.jsx(jsxRuntime.Fragment, { children: DASH });
|
|
1527
|
-
}
|
|
1528
|
-
return (jsxRuntime.jsxs("span", Object.assign({ className: reactStyles.css('pfext-icon-and-text', className), title: iconOnly && !noTooltip ? title : undefined }, { children: [icon &&
|
|
1529
|
-
react.cloneElement(icon, {
|
|
1530
|
-
className: reactStyles.css(spin && 'fa-spin', icon.props.className, !iconOnly && 'pfext-icon-and-text__icon pfext-icon-flex-child'),
|
|
1531
|
-
}), !iconOnly && jsxRuntime.jsx(CamelCaseWrap, { value: title, dataTest: "status-text" })] })));
|
|
1532
|
-
};
|
|
1533
|
-
|
|
1534
|
-
const GenericStatus = (props) => {
|
|
1535
|
-
const { Icon, children, popoverTitle, title, noTooltip, iconOnly } = props, restProps = tslib.__rest(props, ["Icon", "children", "popoverTitle", "title", "noTooltip", "iconOnly"]);
|
|
1536
|
-
const renderIcon = iconOnly && !noTooltip ? jsxRuntime.jsx(Icon, { title: title }) : jsxRuntime.jsx(Icon, {});
|
|
1537
|
-
const statusBody = (jsxRuntime.jsx(StatusIconAndText, Object.assign({}, restProps, { noTooltip: noTooltip, title: title, iconOnly: iconOnly, icon: renderIcon })));
|
|
1538
|
-
return react.Children.toArray(children).length ? (jsxRuntime.jsx(PopoverStatus, Object.assign({ title: popoverTitle || title }, restProps, { statusBody: statusBody }, { children: children }))) : (statusBody);
|
|
1539
|
-
};
|
|
1540
|
-
|
|
1541
|
-
const GreenCheckCircleIcon = ({ className, title, size }) => (jsxRuntime.jsx(reactCore.Icon, Object.assign({ size: size, status: "success" }, { children: jsxRuntime.jsx(CheckCircleIcon__default["default"], { "data-test": "success-icon", className: className, title: title }) })));
|
|
1542
|
-
|
|
1543
|
-
const SuccessStatus = (props) => (jsxRuntime.jsx(GenericStatus, Object.assign({}, props, { Icon: GreenCheckCircleIcon, title: props.title || 'Healthy' })));
|
|
1544
|
-
SuccessStatus.displayName = 'SuccessStatus';
|
|
1545
|
-
|
|
1546
|
-
const Status = ({ status, title, iconOnly, noTooltip, className }) => {
|
|
1547
|
-
const statusProps = { title: title || status, iconOnly, noTooltip, className };
|
|
1548
|
-
switch (status) {
|
|
1549
|
-
case 'In Progress':
|
|
1550
|
-
return jsxRuntime.jsx(StatusIconAndText, Object.assign({}, statusProps, { icon: jsxRuntime.jsx(SyncAltIcon__default["default"], {}) }));
|
|
1551
|
-
case 'Complete':
|
|
1552
|
-
return jsxRuntime.jsx(SuccessStatus, Object.assign({}, statusProps));
|
|
1553
|
-
default:
|
|
1554
|
-
return jsxRuntime.jsx(jsxRuntime.Fragment, { children: status || DASH });
|
|
1555
|
-
}
|
|
1556
|
-
};
|
|
1557
|
-
const StatusIcon = ({ status }) => jsxRuntime.jsx(Status, { status: status, iconOnly: true });
|
|
1558
|
-
|
|
1559
1647
|
const QuickStartTileDescription = ({ description, prerequisites, }) => {
|
|
1560
1648
|
const { getResource } = react.useContext(QuickStartContext);
|
|
1561
1649
|
const prereqs = prerequisites === null || prerequisites === void 0 ? void 0 : prerequisites.filter((p) => p);
|
|
@@ -1658,7 +1746,7 @@ const QuickStartCatalogFilterSelect = (_a) => {
|
|
|
1658
1746
|
};
|
|
1659
1747
|
const QuickStartCatalogFilterCount = ({ quickStartsCount }) => {
|
|
1660
1748
|
const { getResource } = react.useContext(QuickStartContext);
|
|
1661
|
-
return (jsxRuntime.jsx(reactCore.ToolbarItem, Object.assign({ align: { default: 'alignEnd' } }, { children: getResource(
|
|
1749
|
+
return (jsxRuntime.jsx(reactCore.ToolbarItem, Object.assign({ align: { default: 'alignEnd' } }, { children: getResource("{{count, number}} item", quickStartsCount).replace('{{count, number}}', quickStartsCount) })));
|
|
1662
1750
|
};
|
|
1663
1751
|
const QuickStartCatalogFilterSearchWrapper = ({ onSearchInputChange = () => { } }) => {
|
|
1664
1752
|
const { useQueryParams, filter, setFilter } = react.useContext(QuickStartContext);
|
|
@@ -1872,7 +1960,7 @@ const QuickStartIntroduction = ({ tasks, introduction, allTaskStatuses, prerequi
|
|
|
1872
1960
|
const prereqs = prerequisites === null || prerequisites === void 0 ? void 0 : prerequisites.filter((p) => p);
|
|
1873
1961
|
const [isPrereqsExpanded, setIsPrereqsExpanded] = react.useState(false);
|
|
1874
1962
|
const prereqList = (prereqs === null || prereqs === void 0 ? void 0 : prereqs.length) > 0 && (jsxRuntime.jsx(reactCore.ExpandableSection, Object.assign({ toggleText: getResource('View Prerequisites ({{totalPrereqs}})').replace('{{totalPrereqs}}', prereqs.length), onToggle: () => setIsPrereqsExpanded(!isPrereqsExpanded) }, { children: jsxRuntime.jsx(reactCore.List, { children: prereqs.map((pr) => (jsxRuntime.jsx(reactCore.ListItem, { children: jsxRuntime.jsx(QuickStartMarkdownView, { content: pr }) }, pr))) }) })));
|
|
1875
|
-
return (jsxRuntime.jsxs(reactCore.Stack, Object.assign({ hasGutter: true }, { children: [jsxRuntime.jsx(QuickStartMarkdownView, { content: introduction }), prereqList, jsxRuntime.jsxs("p", { children: [getResource('In this quick start, you will complete {{count, number}} task', tasks === null || tasks === void 0 ? void 0 : tasks.length).replace('{{count, number}}', (tasks === null || tasks === void 0 ? void 0 : tasks.length) || 0), ":"] }), jsxRuntime.jsx(QuickStartTaskHeaderList, { tasks: tasks, allTaskStatuses: allTaskStatuses, onTaskSelect: onTaskSelect })] })));
|
|
1963
|
+
return (jsxRuntime.jsxs(reactCore.Stack, Object.assign({ hasGutter: true }, { children: [jsxRuntime.jsx(QuickStartMarkdownView, { content: introduction }), prereqList, jsxRuntime.jsxs("p", { children: [getResource('In this quick start, you will complete {{count, number}} task', (tasks === null || tasks === void 0 ? void 0 : tasks.length) || 0).replace('{{count, number}}', (tasks === null || tasks === void 0 ? void 0 : tasks.length) || 0), ":"] }), jsxRuntime.jsx(QuickStartTaskHeaderList, { tasks: tasks, allTaskStatuses: allTaskStatuses, onTaskSelect: onTaskSelect })] })));
|
|
1876
1964
|
};
|
|
1877
1965
|
|
|
1878
1966
|
const getAlertVariant = (status) => {
|
|
@@ -2045,10 +2133,7 @@ const QuickStartPanelContent = (_a) => {
|
|
|
2045
2133
|
const QuickStartDrawerContent = (_a) => {
|
|
2046
2134
|
var { quickStarts = [], appendTo, fullWidth, handleDrawerClose } = _a, props = tslib.__rest(_a, ["quickStarts", "appendTo", "fullWidth", "handleDrawerClose"]);
|
|
2047
2135
|
const { activeQuickStartID, allQuickStarts = [], activeQuickStartState, } = react.useContext(QuickStartContext);
|
|
2048
|
-
const combinedQuickStarts = [
|
|
2049
|
-
...allQuickStarts,
|
|
2050
|
-
...quickStarts,
|
|
2051
|
-
].filter((qs, idx, arr) => arr.findIndex(q => q.metadata.name === qs.metadata.name) === idx);
|
|
2136
|
+
const combinedQuickStarts = [...allQuickStarts, ...quickStarts].filter((qs, idx, arr) => arr.findIndex((q) => q.metadata.name === qs.metadata.name) === idx);
|
|
2052
2137
|
const handleClose = () => {
|
|
2053
2138
|
handleDrawerClose && handleDrawerClose(activeQuickStartState === null || activeQuickStartState === void 0 ? void 0 : activeQuickStartState.status);
|
|
2054
2139
|
};
|