@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.
@@ -1,6 +1,6 @@
1
1
  declare const useAccordionShowdownExtension: () => {
2
2
  type: string;
3
3
  regex: RegExp;
4
- replace: (_text: string, accordionContent: string, _command: string, accordionHeading: string) => string;
4
+ replace: (_text: string, accordionContent: string, _command: string, _quotedHeading: string, accordionHeading: string) => string;
5
5
  };
6
6
  export default useAccordionShowdownExtension;
@@ -1,6 +1,6 @@
1
1
  declare const useAdmonitionShowdownExtension: () => {
2
2
  type: string;
3
3
  regex: RegExp;
4
- replace: (text: string, content: string, admonitionLabel: string, admonitionType: string, groupId: string) => string;
4
+ replace: (text: string, content: string, admonitionLabel: string, admonitionType: string) => string;
5
5
  };
6
6
  export default useAdmonitionShowdownExtension;
package/dist/index.es.js CHANGED
@@ -24,18 +24,13 @@ import ArrowRightIcon from '@patternfly/react-icons/dist/js/icons/arrow-right-ic
24
24
  import BarsIcon from '@patternfly/react-icons/dist/js/icons/bars-icon';
25
25
 
26
26
  function _extends() {
27
- _extends = Object.assign ? Object.assign.bind() : function (target) {
28
- for (var i = 1; i < arguments.length; i++) {
29
- var source = arguments[i];
30
- for (var key in source) {
31
- if (Object.prototype.hasOwnProperty.call(source, key)) {
32
- target[key] = source[key];
33
- }
34
- }
27
+ return _extends = Object.assign ? Object.assign.bind() : function (n) {
28
+ for (var e = 1; e < arguments.length; e++) {
29
+ var t = arguments[e];
30
+ for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
35
31
  }
36
- return target;
37
- };
38
- return _extends.apply(this, arguments);
32
+ return n;
33
+ }, _extends.apply(null, arguments);
39
34
  }
40
35
 
41
36
  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="";}
@@ -1153,6 +1148,155 @@ const useMultilineCopyClipboardShowdownExtension = () => {
1153
1148
  }), [getResource]);
1154
1149
  };
1155
1150
 
1151
+ // eslint-disable-next-line @typescript-eslint/no-require-imports
1152
+ const DOMPurify$2 = require('dompurify');
1153
+ var AdmonitionType;
1154
+ (function (AdmonitionType) {
1155
+ AdmonitionType["TIP"] = "TIP";
1156
+ AdmonitionType["NOTE"] = "NOTE";
1157
+ AdmonitionType["IMPORTANT"] = "IMPORTANT";
1158
+ AdmonitionType["WARNING"] = "WARNING";
1159
+ AdmonitionType["CAUTION"] = "CAUTION";
1160
+ })(AdmonitionType || (AdmonitionType = {}));
1161
+ const admonitionToAlertVariantMap = {
1162
+ [AdmonitionType.NOTE]: { variant: 'info' },
1163
+ [AdmonitionType.TIP]: { variant: 'custom', customIcon: jsx(LightbulbIcon, {}) },
1164
+ [AdmonitionType.IMPORTANT]: { variant: 'danger' },
1165
+ [AdmonitionType.CAUTION]: { variant: 'warning', customIcon: jsx(FireIcon, {}) },
1166
+ [AdmonitionType.WARNING]: { variant: 'warning' },
1167
+ };
1168
+ const useAdmonitionShowdownExtension = () =>
1169
+ // const { getResource } = React.useContext<QuickStartContextValues>(QuickStartContext);
1170
+ useMemo(() => ({
1171
+ type: 'lang',
1172
+ regex: /\[(.+)]{{(admonition) ([\w-]+)}}/g,
1173
+ replace: (text, content, admonitionLabel, admonitionType) => {
1174
+ if (!content || !admonitionLabel || !admonitionType) {
1175
+ return text;
1176
+ }
1177
+ if (admonitionLabel !== 'admonition') {
1178
+ return text;
1179
+ }
1180
+ admonitionType = admonitionType.toUpperCase();
1181
+ // Process markdown content directly using marked
1182
+ const processedContent = marked.parseInline(content);
1183
+ const sanitizedContent = DOMPurify$2.sanitize(processedContent);
1184
+ // Handle unknown admonition types by defaulting to NOTE
1185
+ const admonitionConfig = admonitionToAlertVariantMap[admonitionType] || admonitionToAlertVariantMap.NOTE;
1186
+ const { variant, customIcon } = admonitionConfig;
1187
+ const pfAlert = (jsx(Alert, Object.assign({ variant: variant }, (customIcon && { customIcon }), { isInline: true, title: admonitionType, className: "pfext-markdown-admonition" }, { children: jsx("div", { dangerouslySetInnerHTML: { __html: sanitizedContent } }) })));
1188
+ return removeTemplateWhitespace(renderToStaticMarkup(pfAlert));
1189
+ },
1190
+ }), []);
1191
+
1192
+ const useCodeShowdownExtension = () => useMemo(() => ({
1193
+ type: 'output',
1194
+ regex: /<pre><code>(.*?)\n?<\/code><\/pre>/g,
1195
+ replace: (text, content) => {
1196
+ if (!content) {
1197
+ return text;
1198
+ }
1199
+ const pfCodeBlock = jsx(CodeBlock, { children: content });
1200
+ return removeTemplateWhitespace(renderToStaticMarkup(pfCodeBlock));
1201
+ },
1202
+ }), []);
1203
+
1204
+ // eslint-disable-next-line @typescript-eslint/no-require-imports
1205
+ const DOMPurify$1 = require('dompurify');
1206
+ const useAccordionShowdownExtension = () => useMemo(() => ({
1207
+ type: 'lang',
1208
+ regex: /\[(.+)]{{(accordion) (&quot;(.*?)&quot;)}}/g,
1209
+ replace: (_text, accordionContent, _command, _quotedHeading, accordionHeading) => {
1210
+ const accordionId = String(accordionHeading).replace(/\s/g, '-');
1211
+ // Process accordion content with markdown
1212
+ const processedContent = marked.parseInline(accordionContent);
1213
+ const sanitizedContent = DOMPurify$1.sanitize(processedContent);
1214
+ return removeTemplateWhitespace(renderToStaticMarkup(jsx(Accordion, { children: jsxs(AccordionItem, { children: [jsx(AccordionToggle, Object.assign({ id: `${ACCORDION_MARKDOWN_BUTTON_ID}-${accordionId}` }, { children: accordionHeading })), jsx(AccordionContent, Object.assign({ id: `${ACCORDION_MARKDOWN_CONTENT_ID}-${accordionId}`, hidden: true }, { children: jsx("div", { dangerouslySetInnerHTML: { __html: sanitizedContent } }) }))] }) })));
1215
+ },
1216
+ }), []);
1217
+
1218
+ const AccordionShowdownHandler = ({ buttonElement, contentElement, }) => {
1219
+ const [expanded, setExpanded] = useState(false);
1220
+ const handleClick = () => {
1221
+ const newExpanded = !expanded;
1222
+ const expandedModifier = 'pf-m-expanded';
1223
+ // Find the accordion item element (parent of the button)
1224
+ const accordionItem = buttonElement.closest('.pf-v6-c-accordion__item');
1225
+ // Update button - both visual state and aria-expanded
1226
+ buttonElement.className = `pf-v6-c-accordion__toggle ${newExpanded ? expandedModifier : ''}`;
1227
+ buttonElement.setAttribute('aria-expanded', newExpanded.toString());
1228
+ // Update content - both visual state and hidden attribute
1229
+ contentElement.hidden = !newExpanded;
1230
+ contentElement.className = `pf-v6-c-accordion__expandable-content ${newExpanded ? expandedModifier : ''}`;
1231
+ // Update accordion item
1232
+ if (accordionItem) {
1233
+ accordionItem.className = `pf-v6-c-accordion__item ${newExpanded ? expandedModifier : ''}`;
1234
+ }
1235
+ setExpanded(newExpanded);
1236
+ };
1237
+ useEventListener(buttonElement, 'click', handleClick);
1238
+ return jsx(Fragment$1, {});
1239
+ };
1240
+ const AccordionRenderExtension = ({ docContext }) => {
1241
+ const buttonElements = docContext.querySelectorAll(`[id ^= ${ACCORDION_MARKDOWN_BUTTON_ID}]`);
1242
+ const contentElements = docContext.querySelectorAll(`[id ^= ${ACCORDION_MARKDOWN_CONTENT_ID}]`);
1243
+ return buttonElements.length > 0 ? (jsx(Fragment$1, { children: Array.from(buttonElements).map((elm) => {
1244
+ const content = Array.from(contentElements).find((elm2) => {
1245
+ const elmId = elm.id.split(ACCORDION_MARKDOWN_BUTTON_ID)[1];
1246
+ const elm2Id = elm2.id.split(ACCORDION_MARKDOWN_CONTENT_ID)[1];
1247
+ return elmId === elm2Id;
1248
+ });
1249
+ return (jsx(AccordionShowdownHandler, { buttonElement: elm, contentElement: content }, elm.id.split(ACCORDION_MARKDOWN_BUTTON_ID)[1]));
1250
+ }) })) : null;
1251
+ };
1252
+
1253
+ const FallbackImg = ({ src, alt, className, fallback }) => {
1254
+ const [isSrcValid, setIsSrcValid] = useState(true);
1255
+ if (src && isSrcValid) {
1256
+ return jsx("img", { className: className, src: src, alt: alt, onError: () => setIsSrcValid(false) });
1257
+ }
1258
+ return jsx(Fragment$1, { children: fallback });
1259
+ };
1260
+
1261
+ const DASH = '-';
1262
+
1263
+ const PopoverStatus = ({ hideHeader, children, isVisible = null, statusBody, title, onHide, onShow, }) => (jsx(Popover, Object.assign({ position: PopoverPosition.right, headerContent: hideHeader ? null : title, bodyContent: children, "aria-label": title, onHide: onHide, onShow: onShow, isVisible: isVisible }, { children: jsx(Button, Object.assign({ variant: "link", isInline: true }, { children: statusBody })) })));
1264
+
1265
+ const StatusIconAndText = ({ icon, title, spin, iconOnly, noTooltip, className, }) => {
1266
+ if (!title) {
1267
+ return jsx(Fragment$1, { children: DASH });
1268
+ }
1269
+ return (jsxs("span", Object.assign({ className: css('pfext-icon-and-text', className), title: iconOnly && !noTooltip ? title : undefined }, { children: [icon &&
1270
+ cloneElement(icon, {
1271
+ className: css(spin && 'fa-spin', icon.props.className, !iconOnly && 'pfext-icon-and-text__icon pfext-icon-flex-child'),
1272
+ }), !iconOnly && jsx(CamelCaseWrap, { value: title, dataTest: "status-text" })] })));
1273
+ };
1274
+
1275
+ const GenericStatus = (props) => {
1276
+ const { Icon, children, popoverTitle, title, noTooltip, iconOnly } = props, restProps = __rest(props, ["Icon", "children", "popoverTitle", "title", "noTooltip", "iconOnly"]);
1277
+ const renderIcon = iconOnly && !noTooltip ? jsx(Icon, { title: title }) : jsx(Icon, {});
1278
+ const statusBody = (jsx(StatusIconAndText, Object.assign({}, restProps, { noTooltip: noTooltip, title: title, iconOnly: iconOnly, icon: renderIcon })));
1279
+ return Children.toArray(children).length ? (jsx(PopoverStatus, Object.assign({ title: popoverTitle || title }, restProps, { statusBody: statusBody }, { children: children }))) : (statusBody);
1280
+ };
1281
+
1282
+ const GreenCheckCircleIcon = ({ className, title, size }) => (jsx(Icon, Object.assign({ size: size, status: "success" }, { children: jsx(CheckCircleIcon, { "data-test": "success-icon", className: className, title: title }) })));
1283
+
1284
+ const SuccessStatus = (props) => (jsx(GenericStatus, Object.assign({}, props, { Icon: GreenCheckCircleIcon, title: props.title || 'Healthy' })));
1285
+ SuccessStatus.displayName = 'SuccessStatus';
1286
+
1287
+ const Status = ({ status, title, iconOnly, noTooltip, className }) => {
1288
+ const statusProps = { title: title || status, iconOnly, noTooltip, className };
1289
+ switch (status) {
1290
+ case 'In Progress':
1291
+ return jsx(StatusIconAndText, Object.assign({}, statusProps, { icon: jsx(SyncAltIcon, {}) }));
1292
+ case 'Complete':
1293
+ return jsx(SuccessStatus, Object.assign({}, statusProps));
1294
+ default:
1295
+ return jsx(Fragment$1, { children: status || DASH });
1296
+ }
1297
+ };
1298
+ const StatusIcon = ({ status }) => jsx(Status, { status: status, iconOnly: true });
1299
+
1156
1300
  // eslint-disable-next-line @typescript-eslint/no-require-imports
1157
1301
  const DOMPurify = require('dompurify');
1158
1302
  const markdownConvert = (markdown, extensions) => __awaiter(void 0, void 0, void 0, function* () {
@@ -1164,7 +1308,7 @@ const markdownConvert = (markdown, extensions) => __awaiter(void 0, void 0, void
1164
1308
  node.setAttribute('rel', 'noopener noreferrer');
1165
1309
  return node;
1166
1310
  }
1167
- // add PF content classes
1311
+ // add PF content classes to standard elements (details blocks get handled separately)
1168
1312
  if (node.nodeType === 1) {
1169
1313
  const contentElements = [
1170
1314
  'ul',
@@ -1215,13 +1359,82 @@ const markdownConvert = (markdown, extensions) => __awaiter(void 0, void 0, void
1215
1359
  const reversedMarkdown = reverseString(markdown);
1216
1360
  const reverseMarkdownWithSubstitutedCodeFences = reversedMarkdown.replace(/{{```((.|\n)*?)```/g, '{{@@@$1@@@');
1217
1361
  const markdownWithSubstitutedCodeFences = reverseString(reverseMarkdownWithSubstitutedCodeFences);
1218
- const parsedMarkdown = yield marked.parse(markdownWithSubstitutedCodeFences);
1362
+ // Fix malformed HTML entities early in the process
1363
+ let preprocessedMarkdown = markdownWithSubstitutedCodeFences;
1364
+ preprocessedMarkdown = preprocessedMarkdown
1365
+ .replace(/&nbsp([^;])/g, '&nbsp;$1')
1366
+ .replace(/&amp;nbsp;/g, '&nbsp;');
1367
+ preprocessedMarkdown = preprocessedMarkdown.replace(/&nbsp(?![;])/g, '&nbsp;');
1368
+ // Process content in segments to ensure markdown parsing continues after HTML blocks
1369
+ const htmlBlockRegex = /(<(?:details|div|section|article)[^>]*>[\s\S]*?<\/(?:details|div|section|article)>)/g;
1370
+ let parsedMarkdown = '';
1371
+ // Check if there are any HTML blocks
1372
+ if (htmlBlockRegex.test(preprocessedMarkdown)) {
1373
+ // Reset regex for actual processing
1374
+ htmlBlockRegex.lastIndex = 0;
1375
+ let lastIndex = 0;
1376
+ let match;
1377
+ while ((match = htmlBlockRegex.exec(preprocessedMarkdown)) !== null) {
1378
+ // Process markdown before the HTML block
1379
+ const markdownBefore = preprocessedMarkdown.slice(lastIndex, match.index).trim();
1380
+ if (markdownBefore) {
1381
+ const parsed = yield marked.parse(markdownBefore);
1382
+ parsedMarkdown += parsed;
1383
+ }
1384
+ // Process the HTML block: parse markdown content inside while preserving HTML structure
1385
+ let htmlBlock = match[1];
1386
+ // Find and process markdown content inside HTML tags
1387
+ const contentRegex = />(\s*[\s\S]*?)\s*</g;
1388
+ const contentMatches = [];
1389
+ let contentMatch;
1390
+ while ((contentMatch = contentRegex.exec(htmlBlock)) !== null) {
1391
+ const content = contentMatch[1];
1392
+ // Only process content that has markdown formatting but no extension syntax
1393
+ if (content.trim() &&
1394
+ !content.includes('{{') &&
1395
+ (content.includes('**') || content.includes('- ') || content.includes('\n'))) {
1396
+ // This looks like markdown content without extensions - parse it as block content
1397
+ const parsedContent = yield marked.parse(content.trim());
1398
+ // Remove wrapping <p> tags if they exist since we're inside HTML already
1399
+ const cleanedContent = parsedContent.replace(/^<p[^>]*>([\s\S]*)<\/p>[\s]*$/g, '$1');
1400
+ contentMatches.push({
1401
+ original: contentMatch[0],
1402
+ replacement: `>${cleanedContent}<`,
1403
+ });
1404
+ }
1405
+ }
1406
+ // Apply the content replacements
1407
+ contentMatches.forEach(({ original, replacement }) => {
1408
+ htmlBlock = htmlBlock.replace(original, replacement);
1409
+ });
1410
+ // Apply extensions (like admonitions) to the processed HTML block
1411
+ if (extensions) {
1412
+ extensions.forEach(({ regex, replace }) => {
1413
+ if (regex) {
1414
+ htmlBlock = htmlBlock.replace(regex, replace);
1415
+ }
1416
+ });
1417
+ }
1418
+ parsedMarkdown += htmlBlock;
1419
+ lastIndex = htmlBlockRegex.lastIndex;
1420
+ }
1421
+ // Process any remaining markdown after the last HTML block
1422
+ const markdownAfter = preprocessedMarkdown.slice(lastIndex).trim();
1423
+ if (markdownAfter) {
1424
+ const parsed = yield marked.parse(markdownAfter);
1425
+ parsedMarkdown += parsed;
1426
+ }
1427
+ }
1428
+ else {
1429
+ // No HTML blocks found, process normally
1430
+ parsedMarkdown = yield marked.parse(preprocessedMarkdown);
1431
+ }
1219
1432
  // Swap the temporary tokens back to code fences before we run the extensions
1220
1433
  let md = parsedMarkdown.replace(/@@@/g, '```');
1221
1434
  if (extensions) {
1222
1435
  // Convert code spans back to md format before we run the custom extension regexes
1223
1436
  md = md.replace(/<code>(.*)<\/code>/g, '`$1`');
1224
- extensions.forEach(({ regex, replace }) => {
1437
+ extensions.forEach(({ regex, replace }, _index) => {
1225
1438
  if (regex) {
1226
1439
  md = md.replace(regex, replace);
1227
1440
  }
@@ -1286,7 +1499,7 @@ const RenderExtension = ({ renderExtension, selector, markup, docContext, }) =>
1286
1499
  };
1287
1500
  const InlineMarkdownView = ({ markup, isEmpty, renderExtension, className, }) => {
1288
1501
  const id = useMemo(() => uniqueId('markdown'), []);
1289
- return (jsxs("div", Object.assign({ className: css({ 'is-empty': isEmpty }, className), id: id }, { children: [jsx("div", { dangerouslySetInnerHTML: { __html: markup } }), renderExtension && (jsx(RenderExtension, { renderExtension: renderExtension, selector: `#${id}`, markup: markup }))] })));
1502
+ return (jsxs("div", Object.assign({ className: css({ 'is-empty': isEmpty }, className), id: id }, { children: [jsx("div", { style: { marginBlockEnd: 'var(--pf-t-global--spacer--md)' }, dangerouslySetInnerHTML: { __html: markup } }), renderExtension && (jsx(RenderExtension, { renderExtension: renderExtension, selector: `#${id}`, markup: markup }))] })));
1290
1503
  };
1291
1504
  const IFrameMarkdownView = ({ exactHeight, markup, isEmpty, renderExtension, className, }) => {
1292
1505
  const [frame, setFrame] = useState();
@@ -1345,7 +1558,7 @@ const IFrameMarkdownView = ({ exactHeight, markup, isEmpty, renderExtension, cla
1345
1558
  }
1346
1559
  </style>
1347
1560
  <body class="pf-m-redhat-font"><div style="overflow-y: auto;">${markup}</div></body>`;
1348
- return (jsxs(Fragment$1, { children: [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) => {
1561
+ return (jsxs(Fragment$1, { children: [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) => {
1349
1562
  setFrame(r);
1350
1563
  }, onLoad: () => onLoad(), className: className }), loaded && frame && renderExtension && (jsx(RenderExtension, { markup: markup, selector: '', renderExtension: renderExtension, docContext: frame.contentDocument }))] }));
1351
1564
  };
@@ -1393,131 +1606,6 @@ const QuickStartMarkdownView = ({ content, exactHeight, className, }) => {
1393
1606
  markdown.renderExtension(docContext, rootSelector)] })), className: className }));
1394
1607
  };
1395
1608
 
1396
- var AdmonitionType;
1397
- (function (AdmonitionType) {
1398
- AdmonitionType["TIP"] = "TIP";
1399
- AdmonitionType["NOTE"] = "NOTE";
1400
- AdmonitionType["IMPORTANT"] = "IMPORTANT";
1401
- AdmonitionType["WARNING"] = "WARNING";
1402
- AdmonitionType["CAUTION"] = "CAUTION";
1403
- })(AdmonitionType || (AdmonitionType = {}));
1404
- const admonitionToAlertVariantMap = {
1405
- [AdmonitionType.NOTE]: { variant: 'info' },
1406
- [AdmonitionType.TIP]: { variant: 'custom', customIcon: jsx(LightbulbIcon, {}) },
1407
- [AdmonitionType.IMPORTANT]: { variant: 'danger' },
1408
- [AdmonitionType.CAUTION]: { variant: 'warning', customIcon: jsx(FireIcon, {}) },
1409
- [AdmonitionType.WARNING]: { variant: 'warning' },
1410
- };
1411
- const useAdmonitionShowdownExtension = () =>
1412
- // const { getResource } = React.useContext<QuickStartContextValues>(QuickStartContext);
1413
- useMemo(() => ({
1414
- type: 'lang',
1415
- regex: /\[(.+)]{{(admonition) ([\w-]+)}}/g,
1416
- replace: (text, content, admonitionLabel, admonitionType, groupId) => {
1417
- if (!content || !admonitionLabel || !admonitionType || !groupId) {
1418
- return text;
1419
- }
1420
- admonitionType = admonitionType.toUpperCase();
1421
- const { variant, customIcon } = admonitionToAlertVariantMap[admonitionType];
1422
- const mdContent = jsx(QuickStartMarkdownView, { content: content });
1423
- const pfAlert = (jsx(Alert, Object.assign({ variant: variant }, (customIcon && { customIcon }), { isInline: true, title: admonitionType, className: "pfext-markdown-admonition" }, { children: mdContent })));
1424
- return removeTemplateWhitespace(renderToStaticMarkup(pfAlert));
1425
- },
1426
- }), []);
1427
-
1428
- const useCodeShowdownExtension = () => useMemo(() => ({
1429
- type: 'output',
1430
- regex: /<pre><code>(.*?)\n?<\/code><\/pre>/g,
1431
- replace: (text, content) => {
1432
- if (!content) {
1433
- return text;
1434
- }
1435
- const pfCodeBlock = jsx(CodeBlock, { children: content });
1436
- return removeTemplateWhitespace(renderToStaticMarkup(pfCodeBlock));
1437
- },
1438
- }), []);
1439
-
1440
- const useAccordionShowdownExtension = () => useMemo(() => ({
1441
- type: 'lang',
1442
- regex: /\[(.+)]{{(accordion) ("(.*?)")}}/g,
1443
- replace: (_text, accordionContent, _command, accordionHeading) => {
1444
- const accordionId = String(accordionHeading).replace(/\s/g, '-');
1445
- return removeTemplateWhitespace(renderToStaticMarkup(jsx(Fragment$1, { children: jsx(Accordion, Object.assign({ asDefinitionList: true }, { children: jsxs(AccordionItem, Object.assign({ isExpanded: false }, { children: [jsx(AccordionToggle, Object.assign({ id: `${ACCORDION_MARKDOWN_BUTTON_ID}-${accordionId}` }, { children: accordionHeading })), jsx(AccordionContent, Object.assign({ id: `${ACCORDION_MARKDOWN_CONTENT_ID}-${accordionId}` }, { children: accordionContent }))] })) })) })));
1446
- },
1447
- }), []);
1448
-
1449
- const AccordionShowdownHandler = ({ buttonElement, contentElement, }) => {
1450
- const [expanded, setExpanded] = useState(false);
1451
- const handleClick = () => {
1452
- const expandedModifier = 'pf-m-expanded';
1453
- buttonElement.className = `pf-v6-c-accordion__toggle ${!expanded ? expandedModifier : ''}`;
1454
- contentElement.hidden = expanded;
1455
- contentElement.className = `pf-v6-c-accordion__expanded-content ${!expanded ? expandedModifier : ''}`;
1456
- setExpanded(!expanded);
1457
- };
1458
- useEventListener(buttonElement, 'click', handleClick);
1459
- return jsx(Fragment$1, {});
1460
- };
1461
- const AccordionRenderExtension = ({ docContext }) => {
1462
- const buttonElements = docContext.querySelectorAll(`[id ^= ${ACCORDION_MARKDOWN_BUTTON_ID}]`);
1463
- const contentElements = docContext.querySelectorAll(`[id ^= ${ACCORDION_MARKDOWN_CONTENT_ID}]`);
1464
- return buttonElements.length > 0 ? (jsx(Fragment$1, { children: Array.from(buttonElements).map((elm) => {
1465
- const content = Array.from(contentElements).find((elm2) => {
1466
- const elmId = elm.id.split(ACCORDION_MARKDOWN_BUTTON_ID)[1];
1467
- const elm2Id = elm2.id.split(ACCORDION_MARKDOWN_CONTENT_ID)[1];
1468
- return elmId === elm2Id;
1469
- });
1470
- return (jsx(AccordionShowdownHandler, { buttonElement: elm, contentElement: content }, elm.id.split(ACCORDION_MARKDOWN_BUTTON_ID)[1]));
1471
- }) })) : null;
1472
- };
1473
-
1474
- const FallbackImg = ({ src, alt, className, fallback }) => {
1475
- const [isSrcValid, setIsSrcValid] = useState(true);
1476
- if (src && isSrcValid) {
1477
- return jsx("img", { className: className, src: src, alt: alt, onError: () => setIsSrcValid(false) });
1478
- }
1479
- return jsx(Fragment$1, { children: fallback });
1480
- };
1481
-
1482
- const DASH = '-';
1483
-
1484
- const PopoverStatus = ({ hideHeader, children, isVisible = null, statusBody, title, onHide, onShow, }) => (jsx(Popover, Object.assign({ position: PopoverPosition.right, headerContent: hideHeader ? null : title, bodyContent: children, "aria-label": title, onHide: onHide, onShow: onShow, isVisible: isVisible }, { children: jsx(Button, Object.assign({ variant: "link", isInline: true }, { children: statusBody })) })));
1485
-
1486
- const StatusIconAndText = ({ icon, title, spin, iconOnly, noTooltip, className, }) => {
1487
- if (!title) {
1488
- return jsx(Fragment$1, { children: DASH });
1489
- }
1490
- return (jsxs("span", Object.assign({ className: css('pfext-icon-and-text', className), title: iconOnly && !noTooltip ? title : undefined }, { children: [icon &&
1491
- cloneElement(icon, {
1492
- className: css(spin && 'fa-spin', icon.props.className, !iconOnly && 'pfext-icon-and-text__icon pfext-icon-flex-child'),
1493
- }), !iconOnly && jsx(CamelCaseWrap, { value: title, dataTest: "status-text" })] })));
1494
- };
1495
-
1496
- const GenericStatus = (props) => {
1497
- const { Icon, children, popoverTitle, title, noTooltip, iconOnly } = props, restProps = __rest(props, ["Icon", "children", "popoverTitle", "title", "noTooltip", "iconOnly"]);
1498
- const renderIcon = iconOnly && !noTooltip ? jsx(Icon, { title: title }) : jsx(Icon, {});
1499
- const statusBody = (jsx(StatusIconAndText, Object.assign({}, restProps, { noTooltip: noTooltip, title: title, iconOnly: iconOnly, icon: renderIcon })));
1500
- return Children.toArray(children).length ? (jsx(PopoverStatus, Object.assign({ title: popoverTitle || title }, restProps, { statusBody: statusBody }, { children: children }))) : (statusBody);
1501
- };
1502
-
1503
- const GreenCheckCircleIcon = ({ className, title, size }) => (jsx(Icon, Object.assign({ size: size, status: "success" }, { children: jsx(CheckCircleIcon, { "data-test": "success-icon", className: className, title: title }) })));
1504
-
1505
- const SuccessStatus = (props) => (jsx(GenericStatus, Object.assign({}, props, { Icon: GreenCheckCircleIcon, title: props.title || 'Healthy' })));
1506
- SuccessStatus.displayName = 'SuccessStatus';
1507
-
1508
- const Status = ({ status, title, iconOnly, noTooltip, className }) => {
1509
- const statusProps = { title: title || status, iconOnly, noTooltip, className };
1510
- switch (status) {
1511
- case 'In Progress':
1512
- return jsx(StatusIconAndText, Object.assign({}, statusProps, { icon: jsx(SyncAltIcon, {}) }));
1513
- case 'Complete':
1514
- return jsx(SuccessStatus, Object.assign({}, statusProps));
1515
- default:
1516
- return jsx(Fragment$1, { children: status || DASH });
1517
- }
1518
- };
1519
- const StatusIcon = ({ status }) => jsx(Status, { status: status, iconOnly: true });
1520
-
1521
1609
  const QuickStartTileDescription = ({ description, prerequisites, }) => {
1522
1610
  const { getResource } = useContext(QuickStartContext);
1523
1611
  const prereqs = prerequisites === null || prerequisites === void 0 ? void 0 : prerequisites.filter((p) => p);
@@ -1620,7 +1708,7 @@ const QuickStartCatalogFilterSelect = (_a) => {
1620
1708
  };
1621
1709
  const QuickStartCatalogFilterCount = ({ quickStartsCount }) => {
1622
1710
  const { getResource } = useContext(QuickStartContext);
1623
- return (jsx(ToolbarItem, Object.assign({ align: { default: 'alignEnd' } }, { children: getResource('{{count, number}} item', quickStartsCount).replace('{{count, number}}', quickStartsCount) })));
1711
+ return (jsx(ToolbarItem, Object.assign({ align: { default: 'alignEnd' } }, { children: getResource("{{count, number}} item", quickStartsCount).replace('{{count, number}}', quickStartsCount) })));
1624
1712
  };
1625
1713
  const QuickStartCatalogFilterSearchWrapper = ({ onSearchInputChange = () => { } }) => {
1626
1714
  const { useQueryParams, filter, setFilter } = useContext(QuickStartContext);
@@ -1834,7 +1922,7 @@ const QuickStartIntroduction = ({ tasks, introduction, allTaskStatuses, prerequi
1834
1922
  const prereqs = prerequisites === null || prerequisites === void 0 ? void 0 : prerequisites.filter((p) => p);
1835
1923
  const [isPrereqsExpanded, setIsPrereqsExpanded] = useState(false);
1836
1924
  const prereqList = (prereqs === null || prereqs === void 0 ? void 0 : prereqs.length) > 0 && (jsx(ExpandableSection, Object.assign({ toggleText: getResource('View Prerequisites ({{totalPrereqs}})').replace('{{totalPrereqs}}', prereqs.length), onToggle: () => setIsPrereqsExpanded(!isPrereqsExpanded) }, { children: jsx(List, { children: prereqs.map((pr) => (jsx(ListItem, { children: jsx(QuickStartMarkdownView, { content: pr }) }, pr))) }) })));
1837
- return (jsxs(Stack, Object.assign({ hasGutter: true }, { children: [jsx(QuickStartMarkdownView, { content: introduction }), prereqList, 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), ":"] }), jsx(QuickStartTaskHeaderList, { tasks: tasks, allTaskStatuses: allTaskStatuses, onTaskSelect: onTaskSelect })] })));
1925
+ return (jsxs(Stack, Object.assign({ hasGutter: true }, { children: [jsx(QuickStartMarkdownView, { content: introduction }), prereqList, 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), ":"] }), jsx(QuickStartTaskHeaderList, { tasks: tasks, allTaskStatuses: allTaskStatuses, onTaskSelect: onTaskSelect })] })));
1838
1926
  };
1839
1927
 
1840
1928
  const getAlertVariant = (status) => {
@@ -2007,10 +2095,7 @@ const QuickStartPanelContent = (_a) => {
2007
2095
  const QuickStartDrawerContent = (_a) => {
2008
2096
  var { quickStarts = [], appendTo, fullWidth, handleDrawerClose } = _a, props = __rest(_a, ["quickStarts", "appendTo", "fullWidth", "handleDrawerClose"]);
2009
2097
  const { activeQuickStartID, allQuickStarts = [], activeQuickStartState, } = useContext(QuickStartContext);
2010
- const combinedQuickStarts = [
2011
- ...allQuickStarts,
2012
- ...quickStarts,
2013
- ].filter((qs, idx, arr) => arr.findIndex(q => q.metadata.name === qs.metadata.name) === idx);
2098
+ const combinedQuickStarts = [...allQuickStarts, ...quickStarts].filter((qs, idx, arr) => arr.findIndex((q) => q.metadata.name === qs.metadata.name) === idx);
2014
2099
  const handleClose = () => {
2015
2100
  handleDrawerClose && handleDrawerClose(activeQuickStartState === null || activeQuickStartState === void 0 ? void 0 : activeQuickStartState.status);
2016
2101
  };