@patternfly/quickstarts 2.3.0 → 2.3.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/dist/ConsoleShared/src/components/markdown-extensions/inline-clipboard-extension.d.ts +1 -1
- package/dist/ConsoleShared/src/components/markdown-extensions/multiline-clipboard-extension.d.ts +1 -1
- package/dist/index.es.js +151 -131
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +151 -131
- package/dist/index.js.map +1 -1
- package/dist/quickstarts-full.es.js +224 -204
- package/dist/quickstarts-full.es.js.map +1 -1
- package/dist/utils/quick-start-context.d.ts +1 -1
- package/package.json +1 -1
- package/src/ConsoleShared/src/components/markdown-extensions/MarkdownCopyClipboard.tsx +2 -2
- package/src/ConsoleShared/src/components/markdown-extensions/admonition-extension.tsx +3 -2
- package/src/ConsoleShared/src/components/markdown-extensions/inline-clipboard-extension.tsx +5 -11
- package/src/ConsoleShared/src/components/markdown-extensions/multiline-clipboard-extension.tsx +5 -11
- package/src/QuickStartPanelContent.tsx +8 -1
- package/src/catalog/QuickStartTile.tsx +7 -0
- package/src/controller/QuickStartTaskHeader.tsx +8 -1
- package/src/utils/quick-start-context.tsx +2 -2
package/dist/ConsoleShared/src/components/markdown-extensions/inline-clipboard-extension.d.ts
CHANGED
|
@@ -2,6 +2,6 @@ import './showdown-extension.scss';
|
|
|
2
2
|
declare const useInlineCopyClipboardShowdownExtension: () => {
|
|
3
3
|
type: string;
|
|
4
4
|
regex: RegExp;
|
|
5
|
-
replace: (text: string, group: string,
|
|
5
|
+
replace: (text: string, group: string, _: string, groupId: number) => string;
|
|
6
6
|
};
|
|
7
7
|
export default useInlineCopyClipboardShowdownExtension;
|
package/dist/ConsoleShared/src/components/markdown-extensions/multiline-clipboard-extension.d.ts
CHANGED
|
@@ -2,6 +2,6 @@ import './showdown-extension.scss';
|
|
|
2
2
|
declare const useMultilineCopyClipboardShowdownExtension: () => {
|
|
3
3
|
type: string;
|
|
4
4
|
regex: RegExp;
|
|
5
|
-
replace: (text: string, group: string,
|
|
5
|
+
replace: (text: string, group: string, _1: string, _2: string, groupId: number) => string;
|
|
6
6
|
};
|
|
7
7
|
export default useMultilineCopyClipboardShowdownExtension;
|
package/dist/index.es.js
CHANGED
|
@@ -10,6 +10,7 @@ import { renderToStaticMarkup } from 'react-dom/server';
|
|
|
10
10
|
import CopyIcon from '@patternfly/react-icons/dist/js/icons/copy-icon';
|
|
11
11
|
import LightbulbIcon from '@patternfly/react-icons/dist/js/icons/lightbulb-icon';
|
|
12
12
|
import FireIcon from '@patternfly/react-icons/dist/js/icons/fire-icon';
|
|
13
|
+
import { Converter } from 'showdown';
|
|
13
14
|
import SyncAltIcon from '@patternfly/react-icons/dist/js/icons/sync-alt-icon';
|
|
14
15
|
import CheckCircleIcon from '@patternfly/react-icons/dist/js/icons/check-circle-icon';
|
|
15
16
|
import ExclamationCircleIcon from '@patternfly/react-icons/dist/js/icons/exclamation-circle-icon';
|
|
@@ -17,7 +18,6 @@ import InfoCircleIcon from '@patternfly/react-icons/dist/js/icons/info-circle-ic
|
|
|
17
18
|
import '@patternfly/react-tokens/dist/js/global_danger_color_100';
|
|
18
19
|
import '@patternfly/react-tokens/dist/js/global_palette_blue_300';
|
|
19
20
|
import { global_palette_green_500 } from '@patternfly/react-tokens/dist/js/global_palette_green_500';
|
|
20
|
-
import { Converter } from 'showdown';
|
|
21
21
|
import ExternalLinkAltIcon from '@patternfly/react-icons/dist/js/icons/external-link-alt-icon';
|
|
22
22
|
import OutlinedClockIcon from '@patternfly/react-icons/dist/js/icons/outlined-clock-icon';
|
|
23
23
|
import ArrowRightIcon from '@patternfly/react-icons/dist/js/icons/arrow-right-icon';
|
|
@@ -572,7 +572,7 @@ const QuickStartContextDefaults = {
|
|
|
572
572
|
activeQuickStartState: {},
|
|
573
573
|
setAllQuickStarts: () => { },
|
|
574
574
|
resourceBundle: en,
|
|
575
|
-
getResource: () =>
|
|
575
|
+
getResource: (resource) => resource,
|
|
576
576
|
language: 'en',
|
|
577
577
|
useQueryParams: true,
|
|
578
578
|
filter: {
|
|
@@ -598,7 +598,7 @@ const getResource = (resource, options, resourceBundle, lng) => {
|
|
|
598
598
|
return resourceBundle[`${resource}_${suffix}`];
|
|
599
599
|
}
|
|
600
600
|
}
|
|
601
|
-
return (resourceBundle && resourceBundle[resource]) ||
|
|
601
|
+
return (resourceBundle && resourceBundle[resource]) || resource;
|
|
602
602
|
};
|
|
603
603
|
const useValuesForQuickStartContext = (value = {}) => {
|
|
604
604
|
var _a, _b;
|
|
@@ -1201,12 +1201,13 @@ const CopyClipboard = ({ element, rootSelector, docContext, }) => {
|
|
|
1201
1201
|
const { getResource } = React.useContext(QuickStartContext);
|
|
1202
1202
|
const [showSuccessContent, setShowSuccessContent] = React.useState(false);
|
|
1203
1203
|
const textToCopy = React.useMemo(() => {
|
|
1204
|
+
var _a;
|
|
1204
1205
|
const copyTextId = element.getAttribute(MARKDOWN_COPY_BUTTON_ID);
|
|
1205
|
-
return docContext.querySelector(`${rootSelector} [${MARKDOWN_SNIPPET_ID}="${copyTextId}"]`).innerText;
|
|
1206
|
+
return (_a = docContext.querySelector(`${rootSelector} [${MARKDOWN_SNIPPET_ID}="${copyTextId}"]`)) === null || _a === void 0 ? void 0 : _a.innerText;
|
|
1206
1207
|
}, [element, docContext, rootSelector]);
|
|
1207
1208
|
useEventListener(element, 'click', React.useCallback(() => {
|
|
1208
1209
|
navigator.clipboard
|
|
1209
|
-
.writeText(textToCopy)
|
|
1210
|
+
.writeText(textToCopy.trim())
|
|
1210
1211
|
.then(() => {
|
|
1211
1212
|
setShowSuccessContent(true);
|
|
1212
1213
|
})
|
|
@@ -1233,16 +1234,16 @@ const useInlineCopyClipboardShowdownExtension = () => {
|
|
|
1233
1234
|
const { getResource } = React.useContext(QuickStartContext);
|
|
1234
1235
|
return React.useMemo(() => ({
|
|
1235
1236
|
type: 'lang',
|
|
1236
|
-
regex:
|
|
1237
|
-
replace: (text, group,
|
|
1238
|
-
if (!group ||
|
|
1237
|
+
regex: /`([^`](.*?)[^`])`{{copy}}/g,
|
|
1238
|
+
replace: (text, group, _, groupId) => {
|
|
1239
|
+
if (!group || isNaN(groupId)) {
|
|
1239
1240
|
return text;
|
|
1240
1241
|
}
|
|
1241
1242
|
return removeTemplateWhitespace(`<span class="pf-c-clipboard-copy pf-m-inline">
|
|
1242
|
-
<span class="pf-c-clipboard-copy__text" ${MARKDOWN_SNIPPET_ID}="${
|
|
1243
|
+
<span class="pf-c-clipboard-copy__text" ${MARKDOWN_SNIPPET_ID}="${groupId}">${group}</span>
|
|
1243
1244
|
<span class="pf-c-clipboard-copy__actions">
|
|
1244
1245
|
<span class="pf-c-clipboard-copy__actions-item">
|
|
1245
|
-
<button class="pf-c-button pf-m-plain" aria-label="${getResource('Copy to clipboard')}" ${MARKDOWN_COPY_BUTTON_ID}="${
|
|
1246
|
+
<button class="pf-c-button pf-m-plain" aria-label="${getResource('Copy to clipboard')}" ${MARKDOWN_COPY_BUTTON_ID}="${groupId}">
|
|
1246
1247
|
${renderToStaticMarkup(React.createElement(CopyIcon, null))}
|
|
1247
1248
|
</button>
|
|
1248
1249
|
</span>
|
|
@@ -1256,16 +1257,16 @@ const useMultilineCopyClipboardShowdownExtension = () => {
|
|
|
1256
1257
|
const { getResource } = React.useContext(QuickStartContext);
|
|
1257
1258
|
return React.useMemo(() => ({
|
|
1258
1259
|
type: 'lang',
|
|
1259
|
-
regex: /```[\n]((
|
|
1260
|
-
replace: (text, group,
|
|
1261
|
-
if (!group ||
|
|
1260
|
+
regex: /```[\n]\s*((((?!```).)*?\n)+)\s*```{{copy}}/g,
|
|
1261
|
+
replace: (text, group, _1, _2, groupId) => {
|
|
1262
|
+
if (!group || isNaN(groupId)) {
|
|
1262
1263
|
return text;
|
|
1263
1264
|
}
|
|
1264
1265
|
return `<div class="pf-c-code-block">
|
|
1265
1266
|
<div class="pf-c-code-block__header">
|
|
1266
1267
|
<div class="pf-c-code-block__actions">
|
|
1267
1268
|
<div class="pf-c-code-block__actions-item">
|
|
1268
|
-
<button class="pf-c-button pf-m-plain" type="button" aria-label="${getResource('Copy to clipboard')}" ${MARKDOWN_COPY_BUTTON_ID}="${
|
|
1269
|
+
<button class="pf-c-button pf-m-plain" type="button" aria-label="${getResource('Copy to clipboard')}" ${MARKDOWN_COPY_BUTTON_ID}="${groupId}">
|
|
1269
1270
|
${renderToStaticMarkup(React.createElement(CopyIcon, null))}
|
|
1270
1271
|
</button>
|
|
1271
1272
|
</div>
|
|
@@ -1274,7 +1275,7 @@ const useMultilineCopyClipboardShowdownExtension = () => {
|
|
|
1274
1275
|
<div class="pf-c-code-block__content">
|
|
1275
1276
|
<pre class="pf-c-code-block__pre pfext-code-block__pre">
|
|
1276
1277
|
<code class="pf-c-code-block__code"
|
|
1277
|
-
${MARKDOWN_SNIPPET_ID}="${
|
|
1278
|
+
${MARKDOWN_SNIPPET_ID}="${groupId}">${group.trim()}</code>
|
|
1278
1279
|
</pre>
|
|
1279
1280
|
</div>
|
|
1280
1281
|
</div>`;
|
|
@@ -1282,118 +1283,6 @@ const useMultilineCopyClipboardShowdownExtension = () => {
|
|
|
1282
1283
|
}), [getResource]);
|
|
1283
1284
|
};
|
|
1284
1285
|
|
|
1285
|
-
var AdmonitionType;
|
|
1286
|
-
(function (AdmonitionType) {
|
|
1287
|
-
AdmonitionType["TIP"] = "TIP";
|
|
1288
|
-
AdmonitionType["NOTE"] = "NOTE";
|
|
1289
|
-
AdmonitionType["IMPORTANT"] = "IMPORTANT";
|
|
1290
|
-
AdmonitionType["WARNING"] = "WARNING";
|
|
1291
|
-
AdmonitionType["CAUTION"] = "CAUTION";
|
|
1292
|
-
})(AdmonitionType || (AdmonitionType = {}));
|
|
1293
|
-
const admonitionToAlertVariantMap = {
|
|
1294
|
-
[AdmonitionType.NOTE]: { variant: 'info' },
|
|
1295
|
-
[AdmonitionType.TIP]: { variant: 'default', customIcon: React.createElement(LightbulbIcon, null) },
|
|
1296
|
-
[AdmonitionType.IMPORTANT]: { variant: 'danger' },
|
|
1297
|
-
[AdmonitionType.CAUTION]: { variant: 'warning', customIcon: React.createElement(FireIcon, null) },
|
|
1298
|
-
[AdmonitionType.WARNING]: { variant: 'warning' },
|
|
1299
|
-
};
|
|
1300
|
-
const useAdmonitionShowdownExtension = () => {
|
|
1301
|
-
// const { getResource } = React.useContext<QuickStartContextValues>(QuickStartContext);
|
|
1302
|
-
return React.useMemo(() => ({
|
|
1303
|
-
type: 'lang',
|
|
1304
|
-
regex: /\[(.+)]{{(admonition) ([\w-]+)}}/g,
|
|
1305
|
-
replace: (text, content, admonitionLabel, admonitionType, groupId) => {
|
|
1306
|
-
if (!content || !admonitionLabel || !admonitionType || !groupId) {
|
|
1307
|
-
return text;
|
|
1308
|
-
}
|
|
1309
|
-
admonitionType = admonitionType.toUpperCase();
|
|
1310
|
-
const { variant, customIcon } = admonitionToAlertVariantMap[admonitionType];
|
|
1311
|
-
const style = admonitionType === AdmonitionType.CAUTION ? { backgroundColor: '#ec7a0915' } : {};
|
|
1312
|
-
const pfAlert = (React.createElement(Alert, { variant: variant, customIcon: customIcon && customIcon, isInline: true, title: admonitionType, className: "pfext-markdown-admonition", style: style }, content));
|
|
1313
|
-
return removeTemplateWhitespace(renderToStaticMarkup(pfAlert));
|
|
1314
|
-
},
|
|
1315
|
-
}), []);
|
|
1316
|
-
};
|
|
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
|
-
|
|
1332
|
-
const FallbackImg = ({ src, alt, className, fallback }) => {
|
|
1333
|
-
const [isSrcValid, setIsSrcValid] = React.useState(true);
|
|
1334
|
-
if (src && isSrcValid) {
|
|
1335
|
-
return React.createElement("img", { className: className, src: src, alt: alt, onError: () => setIsSrcValid(false) });
|
|
1336
|
-
}
|
|
1337
|
-
return React.createElement(React.Fragment, null, fallback);
|
|
1338
|
-
};
|
|
1339
|
-
|
|
1340
|
-
const DASH = '-';
|
|
1341
|
-
|
|
1342
|
-
const PopoverStatus = ({ hideHeader, children, isVisible = null, shouldClose = null, statusBody, title, onHide, onShow, }) => {
|
|
1343
|
-
return (React.createElement(Popover, { position: PopoverPosition.right, headerContent: hideHeader ? null : title, bodyContent: children, "aria-label": title, onHide: onHide, onShow: onShow, isVisible: isVisible, shouldClose: shouldClose },
|
|
1344
|
-
React.createElement(Button, { variant: "link", isInline: true }, statusBody)));
|
|
1345
|
-
};
|
|
1346
|
-
|
|
1347
|
-
const StatusIconAndText = ({ icon, title, spin, iconOnly, noTooltip, className, }) => {
|
|
1348
|
-
if (!title) {
|
|
1349
|
-
return React.createElement(React.Fragment, null, DASH);
|
|
1350
|
-
}
|
|
1351
|
-
return (React.createElement("span", { className: css('pfext-icon-and-text', className), title: iconOnly && !noTooltip ? title : undefined },
|
|
1352
|
-
icon &&
|
|
1353
|
-
React.cloneElement(icon, {
|
|
1354
|
-
className: css(spin && 'fa-spin', icon.props.className, !iconOnly && 'pfext-icon-and-text__icon pfext-icon-flex-child'),
|
|
1355
|
-
}),
|
|
1356
|
-
!iconOnly && React.createElement(CamelCaseWrap, { value: title, dataTest: "status-text" })));
|
|
1357
|
-
};
|
|
1358
|
-
|
|
1359
|
-
const GenericStatus = (props) => {
|
|
1360
|
-
const { Icon, children, popoverTitle, title, noTooltip, iconOnly } = props, restProps = __rest(props, ["Icon", "children", "popoverTitle", "title", "noTooltip", "iconOnly"]);
|
|
1361
|
-
const renderIcon = iconOnly && !noTooltip ? React.createElement(Icon, { title: title }) : React.createElement(Icon, null);
|
|
1362
|
-
const statusBody = (React.createElement(StatusIconAndText, Object.assign({}, restProps, { noTooltip: noTooltip, title: title, iconOnly: iconOnly, icon: renderIcon })));
|
|
1363
|
-
return React.Children.toArray(children).length ? (React.createElement(PopoverStatus, Object.assign({ title: popoverTitle || title }, restProps, { statusBody: statusBody }), children)) : (statusBody);
|
|
1364
|
-
};
|
|
1365
|
-
|
|
1366
|
-
// import { global_warning_color_100 as warningColor } from '@patternfly/react-tokens/dist/js/global_warning_color_100';
|
|
1367
|
-
const GreenCheckCircleIcon = ({ className, title, size }) => (React.createElement(CheckCircleIcon, { "data-test": "success-icon", size: size, color: global_palette_green_500.value, className: className, title: title }));
|
|
1368
|
-
|
|
1369
|
-
// export const PendingStatus: React.FC<StatusComponentProps> = (props) => (
|
|
1370
|
-
// <GenericStatus {...props} Icon={HourglassHalfIcon} title={props.title || 'Pending'} />
|
|
1371
|
-
// );
|
|
1372
|
-
// PendingStatus.displayName = 'PendingStatus';
|
|
1373
|
-
// export const ProgressStatus: React.FC<StatusComponentProps> = (props) => (
|
|
1374
|
-
// <GenericStatus {...props} Icon={InProgressIcon} title={props.title || 'In progress'} />
|
|
1375
|
-
// );
|
|
1376
|
-
// ProgressStatus.displayName = 'ProgressStatus';
|
|
1377
|
-
const SuccessStatus = (props) => (React.createElement(GenericStatus, Object.assign({}, props, { Icon: GreenCheckCircleIcon, title: props.title || 'Healthy' })));
|
|
1378
|
-
SuccessStatus.displayName = 'SuccessStatus';
|
|
1379
|
-
// export const WarningStatus: React.FC<StatusComponentProps> = (props) => (
|
|
1380
|
-
// <GenericStatus {...props} Icon={YellowExclamationTriangleIcon} title={props.title || 'Warning'} />
|
|
1381
|
-
// );
|
|
1382
|
-
// WarningStatus.displayName = 'WarningStatus';
|
|
1383
|
-
|
|
1384
|
-
const Status = ({ status, title, iconOnly, noTooltip, className, }) => {
|
|
1385
|
-
const statusProps = { title: title || status, iconOnly, noTooltip, className };
|
|
1386
|
-
switch (status) {
|
|
1387
|
-
case 'In Progress':
|
|
1388
|
-
return React.createElement(StatusIconAndText, Object.assign({}, statusProps, { icon: React.createElement(SyncAltIcon, null) }));
|
|
1389
|
-
case 'Complete':
|
|
1390
|
-
return React.createElement(SuccessStatus, Object.assign({}, statusProps));
|
|
1391
|
-
default:
|
|
1392
|
-
return React.createElement(React.Fragment, null, status || DASH);
|
|
1393
|
-
}
|
|
1394
|
-
};
|
|
1395
|
-
const StatusIcon = ({ status }) => (React.createElement(Status, { status: status, iconOnly: true }));
|
|
1396
|
-
|
|
1397
1286
|
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
1398
1287
|
const DOMPurify = require('dompurify');
|
|
1399
1288
|
const markdownConvert = (markdown, extensions) => {
|
|
@@ -1602,6 +1491,119 @@ const QuickStartMarkdownView = ({ content, exactHeight, className, }) => {
|
|
|
1602
1491
|
markdown.renderExtension(docContext, rootSelector))), className: className }));
|
|
1603
1492
|
};
|
|
1604
1493
|
|
|
1494
|
+
var AdmonitionType;
|
|
1495
|
+
(function (AdmonitionType) {
|
|
1496
|
+
AdmonitionType["TIP"] = "TIP";
|
|
1497
|
+
AdmonitionType["NOTE"] = "NOTE";
|
|
1498
|
+
AdmonitionType["IMPORTANT"] = "IMPORTANT";
|
|
1499
|
+
AdmonitionType["WARNING"] = "WARNING";
|
|
1500
|
+
AdmonitionType["CAUTION"] = "CAUTION";
|
|
1501
|
+
})(AdmonitionType || (AdmonitionType = {}));
|
|
1502
|
+
const admonitionToAlertVariantMap = {
|
|
1503
|
+
[AdmonitionType.NOTE]: { variant: 'info' },
|
|
1504
|
+
[AdmonitionType.TIP]: { variant: 'default', customIcon: React.createElement(LightbulbIcon, null) },
|
|
1505
|
+
[AdmonitionType.IMPORTANT]: { variant: 'danger' },
|
|
1506
|
+
[AdmonitionType.CAUTION]: { variant: 'warning', customIcon: React.createElement(FireIcon, null) },
|
|
1507
|
+
[AdmonitionType.WARNING]: { variant: 'warning' },
|
|
1508
|
+
};
|
|
1509
|
+
const useAdmonitionShowdownExtension = () => {
|
|
1510
|
+
// const { getResource } = React.useContext<QuickStartContextValues>(QuickStartContext);
|
|
1511
|
+
return React.useMemo(() => ({
|
|
1512
|
+
type: 'lang',
|
|
1513
|
+
regex: /\[(.+)]{{(admonition) ([\w-]+)}}/g,
|
|
1514
|
+
replace: (text, content, admonitionLabel, admonitionType, groupId) => {
|
|
1515
|
+
if (!content || !admonitionLabel || !admonitionType || !groupId) {
|
|
1516
|
+
return text;
|
|
1517
|
+
}
|
|
1518
|
+
admonitionType = admonitionType.toUpperCase();
|
|
1519
|
+
const { variant, customIcon } = admonitionToAlertVariantMap[admonitionType];
|
|
1520
|
+
const style = admonitionType === AdmonitionType.CAUTION ? { backgroundColor: '#ec7a0915' } : {};
|
|
1521
|
+
const mdContent = React.createElement(QuickStartMarkdownView, { content: content });
|
|
1522
|
+
const pfAlert = (React.createElement(Alert, { variant: variant, customIcon: customIcon && customIcon, isInline: true, title: admonitionType, className: "pfext-markdown-admonition", style: style }, mdContent));
|
|
1523
|
+
return removeTemplateWhitespace(renderToStaticMarkup(pfAlert));
|
|
1524
|
+
},
|
|
1525
|
+
}), []);
|
|
1526
|
+
};
|
|
1527
|
+
|
|
1528
|
+
const useCodeShowdownExtension = () => {
|
|
1529
|
+
return React.useMemo(() => ({
|
|
1530
|
+
type: 'output',
|
|
1531
|
+
regex: /<pre><code>(.*?)\n?<\/code><\/pre>/g,
|
|
1532
|
+
replace: (text, content) => {
|
|
1533
|
+
if (!content) {
|
|
1534
|
+
return text;
|
|
1535
|
+
}
|
|
1536
|
+
const pfCodeBlock = React.createElement(CodeBlock, null, content);
|
|
1537
|
+
return removeTemplateWhitespace(renderToStaticMarkup(pfCodeBlock));
|
|
1538
|
+
},
|
|
1539
|
+
}), []);
|
|
1540
|
+
};
|
|
1541
|
+
|
|
1542
|
+
const FallbackImg = ({ src, alt, className, fallback }) => {
|
|
1543
|
+
const [isSrcValid, setIsSrcValid] = React.useState(true);
|
|
1544
|
+
if (src && isSrcValid) {
|
|
1545
|
+
return React.createElement("img", { className: className, src: src, alt: alt, onError: () => setIsSrcValid(false) });
|
|
1546
|
+
}
|
|
1547
|
+
return React.createElement(React.Fragment, null, fallback);
|
|
1548
|
+
};
|
|
1549
|
+
|
|
1550
|
+
const DASH = '-';
|
|
1551
|
+
|
|
1552
|
+
const PopoverStatus = ({ hideHeader, children, isVisible = null, shouldClose = null, statusBody, title, onHide, onShow, }) => {
|
|
1553
|
+
return (React.createElement(Popover, { position: PopoverPosition.right, headerContent: hideHeader ? null : title, bodyContent: children, "aria-label": title, onHide: onHide, onShow: onShow, isVisible: isVisible, shouldClose: shouldClose },
|
|
1554
|
+
React.createElement(Button, { variant: "link", isInline: true }, statusBody)));
|
|
1555
|
+
};
|
|
1556
|
+
|
|
1557
|
+
const StatusIconAndText = ({ icon, title, spin, iconOnly, noTooltip, className, }) => {
|
|
1558
|
+
if (!title) {
|
|
1559
|
+
return React.createElement(React.Fragment, null, DASH);
|
|
1560
|
+
}
|
|
1561
|
+
return (React.createElement("span", { className: css('pfext-icon-and-text', className), title: iconOnly && !noTooltip ? title : undefined },
|
|
1562
|
+
icon &&
|
|
1563
|
+
React.cloneElement(icon, {
|
|
1564
|
+
className: css(spin && 'fa-spin', icon.props.className, !iconOnly && 'pfext-icon-and-text__icon pfext-icon-flex-child'),
|
|
1565
|
+
}),
|
|
1566
|
+
!iconOnly && React.createElement(CamelCaseWrap, { value: title, dataTest: "status-text" })));
|
|
1567
|
+
};
|
|
1568
|
+
|
|
1569
|
+
const GenericStatus = (props) => {
|
|
1570
|
+
const { Icon, children, popoverTitle, title, noTooltip, iconOnly } = props, restProps = __rest(props, ["Icon", "children", "popoverTitle", "title", "noTooltip", "iconOnly"]);
|
|
1571
|
+
const renderIcon = iconOnly && !noTooltip ? React.createElement(Icon, { title: title }) : React.createElement(Icon, null);
|
|
1572
|
+
const statusBody = (React.createElement(StatusIconAndText, Object.assign({}, restProps, { noTooltip: noTooltip, title: title, iconOnly: iconOnly, icon: renderIcon })));
|
|
1573
|
+
return React.Children.toArray(children).length ? (React.createElement(PopoverStatus, Object.assign({ title: popoverTitle || title }, restProps, { statusBody: statusBody }), children)) : (statusBody);
|
|
1574
|
+
};
|
|
1575
|
+
|
|
1576
|
+
// import { global_warning_color_100 as warningColor } from '@patternfly/react-tokens/dist/js/global_warning_color_100';
|
|
1577
|
+
const GreenCheckCircleIcon = ({ className, title, size }) => (React.createElement(CheckCircleIcon, { "data-test": "success-icon", size: size, color: global_palette_green_500.value, className: className, title: title }));
|
|
1578
|
+
|
|
1579
|
+
// export const PendingStatus: React.FC<StatusComponentProps> = (props) => (
|
|
1580
|
+
// <GenericStatus {...props} Icon={HourglassHalfIcon} title={props.title || 'Pending'} />
|
|
1581
|
+
// );
|
|
1582
|
+
// PendingStatus.displayName = 'PendingStatus';
|
|
1583
|
+
// export const ProgressStatus: React.FC<StatusComponentProps> = (props) => (
|
|
1584
|
+
// <GenericStatus {...props} Icon={InProgressIcon} title={props.title || 'In progress'} />
|
|
1585
|
+
// );
|
|
1586
|
+
// ProgressStatus.displayName = 'ProgressStatus';
|
|
1587
|
+
const SuccessStatus = (props) => (React.createElement(GenericStatus, Object.assign({}, props, { Icon: GreenCheckCircleIcon, title: props.title || 'Healthy' })));
|
|
1588
|
+
SuccessStatus.displayName = 'SuccessStatus';
|
|
1589
|
+
// export const WarningStatus: React.FC<StatusComponentProps> = (props) => (
|
|
1590
|
+
// <GenericStatus {...props} Icon={YellowExclamationTriangleIcon} title={props.title || 'Warning'} />
|
|
1591
|
+
// );
|
|
1592
|
+
// WarningStatus.displayName = 'WarningStatus';
|
|
1593
|
+
|
|
1594
|
+
const Status = ({ status, title, iconOnly, noTooltip, className, }) => {
|
|
1595
|
+
const statusProps = { title: title || status, iconOnly, noTooltip, className };
|
|
1596
|
+
switch (status) {
|
|
1597
|
+
case 'In Progress':
|
|
1598
|
+
return React.createElement(StatusIconAndText, Object.assign({}, statusProps, { icon: React.createElement(SyncAltIcon, null) }));
|
|
1599
|
+
case 'Complete':
|
|
1600
|
+
return React.createElement(SuccessStatus, Object.assign({}, statusProps));
|
|
1601
|
+
default:
|
|
1602
|
+
return React.createElement(React.Fragment, null, status || DASH);
|
|
1603
|
+
}
|
|
1604
|
+
};
|
|
1605
|
+
const StatusIcon = ({ status }) => (React.createElement(Status, { status: status, iconOnly: true }));
|
|
1606
|
+
|
|
1605
1607
|
const QuickStartTileDescription = ({ description, prerequisites, }) => {
|
|
1606
1608
|
const { getResource } = React.useContext(QuickStartContext);
|
|
1607
1609
|
const prereqs = prerequisites === null || prerequisites === void 0 ? void 0 : prerequisites.filter((p) => p);
|
|
@@ -1705,9 +1707,14 @@ const QuickStartTile = ({ quickStart, status, isActive, onClick = () => { }, })
|
|
|
1705
1707
|
// @ts-ignore
|
|
1706
1708
|
component: "div", style: {
|
|
1707
1709
|
cursor: 'pointer',
|
|
1708
|
-
}, icon: quickStartIcon, className: "pfext-quick-start-tile", "data-testid": `qs-card-${camelize(displayName)}`, featured: isActive, title: React.createElement(QuickStartTileHeader, { name: displayName, status: status, duration: durationMinutes, type: type, quickStartId: id }), onClick: handleClick,
|
|
1710
|
+
}, icon: quickStartIcon, className: "pfext-quick-start-tile", "data-testid": `qs-card-${camelize(displayName)}`, featured: isActive, title: React.createElement(QuickStartTileHeader, { name: displayName, status: status, duration: durationMinutes, type: type, quickStartId: id }), onClick: handleClick, onKeyDown: (event) => {
|
|
1711
|
+
if (event.key === 'Enter' || event.key === ' ') {
|
|
1712
|
+
setActiveQuickStart(id, tasks === null || tasks === void 0 ? void 0 : tasks.length);
|
|
1713
|
+
onClick();
|
|
1714
|
+
}
|
|
1715
|
+
},
|
|
1709
1716
|
// https://github.com/patternfly/patternfly-react/issues/7039
|
|
1710
|
-
href: "#", "data-test": `tile ${id}`, description: React.createElement(QuickStartTileDescription, { description: description, prerequisites: prerequisites }), footer: footerComponent })));
|
|
1717
|
+
href: "#", "data-test": `tile ${id}`, description: React.createElement(QuickStartTileDescription, { description: description, prerequisites: prerequisites }), footer: footerComponent, tabIndex: 0 })));
|
|
1711
1718
|
};
|
|
1712
1719
|
|
|
1713
1720
|
const QuickStartCatalog = ({ quickStarts }) => {
|
|
@@ -1950,6 +1957,13 @@ const TaskIcon = ({ taskIndex, taskStatus }) => {
|
|
|
1950
1957
|
return React.createElement("span", { className: classNames }, content);
|
|
1951
1958
|
};
|
|
1952
1959
|
const QuickStartTaskHeader = ({ title, taskIndex, subtitle, taskStatus, size, isActiveTask, onTaskSelect, children, }) => {
|
|
1960
|
+
const titleRef = React.useRef(null);
|
|
1961
|
+
React.useEffect(() => {
|
|
1962
|
+
if (isActiveTask) {
|
|
1963
|
+
// Focus the WizardNavItem button element that contains the title
|
|
1964
|
+
titleRef.current.parentNode.focus();
|
|
1965
|
+
}
|
|
1966
|
+
}, [isActiveTask]);
|
|
1953
1967
|
const classNames = css('pfext-quick-start-task-header__title', {
|
|
1954
1968
|
'pfext-quick-start-task-header__title-success': taskStatus === QuickStartTaskStatus.SUCCESS,
|
|
1955
1969
|
'pfext-quick-start-task-header__title-failed': taskStatus === (QuickStartTaskStatus.FAILED || QuickStartTaskStatus.VISITED),
|
|
@@ -1962,7 +1976,7 @@ const QuickStartTaskHeader = ({ title, taskIndex, subtitle, taskStatus, size, is
|
|
|
1962
1976
|
const tryAgain = failedReview && (React.createElement(React.Fragment, null,
|
|
1963
1977
|
React.createElement("div", null),
|
|
1964
1978
|
React.createElement("div", { className: "pfext-quick-start-task-header__tryagain" }, "Try the steps again.")));
|
|
1965
|
-
const content = (React.createElement("div", { className: "pfext-quick-start-task-header" },
|
|
1979
|
+
const content = (React.createElement("div", { className: "pfext-quick-start-task-header", ref: titleRef },
|
|
1966
1980
|
React.createElement(TaskIcon, { taskIndex: taskIndex, taskStatus: taskStatus }),
|
|
1967
1981
|
React.createElement(Title, { headingLevel: "h3", size: size, className: classNames },
|
|
1968
1982
|
React.createElement("span", { dangerouslySetInnerHTML: { __html: removeParagraphWrap(markdownConvert(title)) } }),
|
|
@@ -2169,6 +2183,7 @@ const useScrollTopOnTaskNumberChange = (node, taskNumber) => {
|
|
|
2169
2183
|
};
|
|
2170
2184
|
const QuickStartPanelContent = (_a) => {
|
|
2171
2185
|
var { quickStarts = [], handleClose, activeQuickStartID, appendTo, isResizable = true, showClose = true, headerVariant = '' } = _a, props = __rest(_a, ["quickStarts", "handleClose", "activeQuickStartID", "appendTo", "isResizable", "showClose", "headerVariant"]);
|
|
2186
|
+
const titleRef = React.useRef(null);
|
|
2172
2187
|
const { getResource, activeQuickStartState } = React.useContext(QuickStartContext);
|
|
2173
2188
|
const [contentRef, setContentRef] = React.useState();
|
|
2174
2189
|
const shadows = useScrollShadows(contentRef);
|
|
@@ -2193,10 +2208,15 @@ const QuickStartPanelContent = (_a) => {
|
|
|
2193
2208
|
}
|
|
2194
2209
|
return Number.parseInt(taskNumber, 10) + 1;
|
|
2195
2210
|
};
|
|
2211
|
+
React.useEffect(() => {
|
|
2212
|
+
if (quickStart) {
|
|
2213
|
+
titleRef.current.focus();
|
|
2214
|
+
}
|
|
2215
|
+
}, [quickStart]);
|
|
2196
2216
|
const content = quickStart ? (React.createElement(DrawerPanelContent, Object.assign({ isResizable: isResizable, className: "pfext-quick-start__base", "data-testid": `qs-drawer-${camelize(quickStart.spec.displayName)}`, "data-qs": `qs-step-${getStep()}`, "data-test": "quickstart drawer" }, props),
|
|
2197
2217
|
React.createElement("div", { className: headerClasses },
|
|
2198
2218
|
React.createElement(DrawerHead, null,
|
|
2199
|
-
React.createElement("div", { className: "pfext-quick-start-panel-content__title" },
|
|
2219
|
+
React.createElement("div", { className: "pfext-quick-start-panel-content__title", tabIndex: -1, ref: titleRef },
|
|
2200
2220
|
React.createElement(Title, { headingLevel: "h1", size: "xl", className: "pfext-quick-start-panel-content__name", style: { marginRight: 'var(--pf-global--spacer--md)' } }, quickStart === null || quickStart === void 0 ? void 0 :
|
|
2201
2221
|
quickStart.spec.displayName,
|
|
2202
2222
|
' ',
|