@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
|
@@ -55,7 +55,7 @@ export declare const QuickStartContextDefaults: {
|
|
|
55
55
|
activeQuickStartState: {};
|
|
56
56
|
setAllQuickStarts: () => void;
|
|
57
57
|
resourceBundle: any;
|
|
58
|
-
getResource: () => string;
|
|
58
|
+
getResource: (resource: string) => string;
|
|
59
59
|
language: string;
|
|
60
60
|
useQueryParams: boolean;
|
|
61
61
|
filter: {
|
package/package.json
CHANGED
|
@@ -21,7 +21,7 @@ export const CopyClipboard: React.FC<CopyClipboardProps> = ({
|
|
|
21
21
|
const copyTextId = element.getAttribute(MARKDOWN_COPY_BUTTON_ID);
|
|
22
22
|
return (docContext.querySelector(
|
|
23
23
|
`${rootSelector} [${MARKDOWN_SNIPPET_ID}="${copyTextId}"]`,
|
|
24
|
-
) as HTMLElement)
|
|
24
|
+
) as HTMLElement)?.innerText;
|
|
25
25
|
}, [element, docContext, rootSelector]);
|
|
26
26
|
|
|
27
27
|
useEventListener(
|
|
@@ -29,7 +29,7 @@ export const CopyClipboard: React.FC<CopyClipboardProps> = ({
|
|
|
29
29
|
'click',
|
|
30
30
|
React.useCallback(() => {
|
|
31
31
|
navigator.clipboard
|
|
32
|
-
.writeText(textToCopy)
|
|
32
|
+
.writeText(textToCopy.trim())
|
|
33
33
|
.then(() => {
|
|
34
34
|
setShowSuccessContent(true);
|
|
35
35
|
})
|
|
@@ -5,6 +5,7 @@ import { Alert } from '@patternfly/react-core';
|
|
|
5
5
|
import LightbulbIcon from '@patternfly/react-icons/dist/js/icons/lightbulb-icon';
|
|
6
6
|
import FireIcon from '@patternfly/react-icons/dist/js/icons/fire-icon';
|
|
7
7
|
import './showdown-extension.scss';
|
|
8
|
+
import QuickStartMarkdownView from '../../../../QuickStartMarkdownView';
|
|
8
9
|
|
|
9
10
|
enum AdmonitionType {
|
|
10
11
|
TIP = 'TIP',
|
|
@@ -43,7 +44,7 @@ const useAdmonitionShowdownExtension = () => {
|
|
|
43
44
|
const { variant, customIcon } = admonitionToAlertVariantMap[admonitionType];
|
|
44
45
|
const style =
|
|
45
46
|
admonitionType === AdmonitionType.CAUTION ? { backgroundColor: '#ec7a0915' } : {};
|
|
46
|
-
|
|
47
|
+
const mdContent = <QuickStartMarkdownView content={content} />;
|
|
47
48
|
const pfAlert = (
|
|
48
49
|
<Alert
|
|
49
50
|
variant={variant}
|
|
@@ -53,7 +54,7 @@ const useAdmonitionShowdownExtension = () => {
|
|
|
53
54
|
className="pfext-markdown-admonition"
|
|
54
55
|
style={style}
|
|
55
56
|
>
|
|
56
|
-
{
|
|
57
|
+
{mdContent}
|
|
57
58
|
</Alert>
|
|
58
59
|
);
|
|
59
60
|
return removeTemplateWhitespace(renderToStaticMarkup(pfAlert));
|
|
@@ -11,25 +11,19 @@ const useInlineCopyClipboardShowdownExtension = () => {
|
|
|
11
11
|
return React.useMemo(
|
|
12
12
|
() => ({
|
|
13
13
|
type: 'lang',
|
|
14
|
-
regex:
|
|
15
|
-
replace: (
|
|
16
|
-
|
|
17
|
-
group: string,
|
|
18
|
-
subGroup: string,
|
|
19
|
-
groupType: string,
|
|
20
|
-
groupId: string,
|
|
21
|
-
): string => {
|
|
22
|
-
if (!group || !subGroup || !groupType || !groupId) {
|
|
14
|
+
regex: /`([^`](.*?)[^`])`{{copy}}/g,
|
|
15
|
+
replace: (text: string, group: string, _: string, groupId: number): string => {
|
|
16
|
+
if (!group || isNaN(groupId)) {
|
|
23
17
|
return text;
|
|
24
18
|
}
|
|
25
19
|
return removeTemplateWhitespace(
|
|
26
20
|
`<span class="pf-c-clipboard-copy pf-m-inline">
|
|
27
|
-
<span class="pf-c-clipboard-copy__text" ${MARKDOWN_SNIPPET_ID}="${
|
|
21
|
+
<span class="pf-c-clipboard-copy__text" ${MARKDOWN_SNIPPET_ID}="${groupId}">${group}</span>
|
|
28
22
|
<span class="pf-c-clipboard-copy__actions">
|
|
29
23
|
<span class="pf-c-clipboard-copy__actions-item">
|
|
30
24
|
<button class="pf-c-button pf-m-plain" aria-label="${getResource(
|
|
31
25
|
'Copy to clipboard',
|
|
32
|
-
)}" ${MARKDOWN_COPY_BUTTON_ID}="${
|
|
26
|
+
)}" ${MARKDOWN_COPY_BUTTON_ID}="${groupId}">
|
|
33
27
|
${renderToStaticMarkup(<CopyIcon />)}
|
|
34
28
|
</button>
|
|
35
29
|
</span>
|
package/src/ConsoleShared/src/components/markdown-extensions/multiline-clipboard-extension.tsx
CHANGED
|
@@ -11,15 +11,9 @@ const useMultilineCopyClipboardShowdownExtension = () => {
|
|
|
11
11
|
return React.useMemo(
|
|
12
12
|
() => ({
|
|
13
13
|
type: 'lang',
|
|
14
|
-
regex: /```[\n]((
|
|
15
|
-
replace: (
|
|
16
|
-
|
|
17
|
-
group: string,
|
|
18
|
-
subgroup: string,
|
|
19
|
-
groupType: string,
|
|
20
|
-
groupId: string,
|
|
21
|
-
): string => {
|
|
22
|
-
if (!group || !subgroup || !groupType || !groupId) {
|
|
14
|
+
regex: /```[\n]\s*((((?!```).)*?\n)+)\s*```{{copy}}/g,
|
|
15
|
+
replace: (text: string, group: string, _1: string, _2: string, groupId: number): string => {
|
|
16
|
+
if (!group || isNaN(groupId)) {
|
|
23
17
|
return text;
|
|
24
18
|
}
|
|
25
19
|
return `<div class="pf-c-code-block">
|
|
@@ -28,7 +22,7 @@ const useMultilineCopyClipboardShowdownExtension = () => {
|
|
|
28
22
|
<div class="pf-c-code-block__actions-item">
|
|
29
23
|
<button class="pf-c-button pf-m-plain" type="button" aria-label="${getResource(
|
|
30
24
|
'Copy to clipboard',
|
|
31
|
-
)}" ${MARKDOWN_COPY_BUTTON_ID}="${
|
|
25
|
+
)}" ${MARKDOWN_COPY_BUTTON_ID}="${groupId}">
|
|
32
26
|
${renderToStaticMarkup(<CopyIcon />)}
|
|
33
27
|
</button>
|
|
34
28
|
</div>
|
|
@@ -37,7 +31,7 @@ const useMultilineCopyClipboardShowdownExtension = () => {
|
|
|
37
31
|
<div class="pf-c-code-block__content">
|
|
38
32
|
<pre class="pf-c-code-block__pre pfext-code-block__pre">
|
|
39
33
|
<code class="pf-c-code-block__code"
|
|
40
|
-
${MARKDOWN_SNIPPET_ID}="${
|
|
34
|
+
${MARKDOWN_SNIPPET_ID}="${groupId}">${group.trim()}</code>
|
|
41
35
|
</pre>
|
|
42
36
|
</div>
|
|
43
37
|
</div>`;
|
|
@@ -53,6 +53,7 @@ const QuickStartPanelContent: React.FC<QuickStartPanelContentProps> = ({
|
|
|
53
53
|
headerVariant = '',
|
|
54
54
|
...props
|
|
55
55
|
}) => {
|
|
56
|
+
const titleRef = React.useRef(null);
|
|
56
57
|
const { getResource, activeQuickStartState } = React.useContext<QuickStartContextValues>(
|
|
57
58
|
QuickStartContext,
|
|
58
59
|
);
|
|
@@ -87,6 +88,12 @@ const QuickStartPanelContent: React.FC<QuickStartPanelContentProps> = ({
|
|
|
87
88
|
return Number.parseInt(taskNumber as string, 10) + 1;
|
|
88
89
|
};
|
|
89
90
|
|
|
91
|
+
React.useEffect(() => {
|
|
92
|
+
if (quickStart) {
|
|
93
|
+
titleRef.current.focus();
|
|
94
|
+
}
|
|
95
|
+
}, [quickStart]);
|
|
96
|
+
|
|
90
97
|
const content = quickStart ? (
|
|
91
98
|
<DrawerPanelContent
|
|
92
99
|
isResizable={isResizable}
|
|
@@ -98,7 +105,7 @@ const QuickStartPanelContent: React.FC<QuickStartPanelContentProps> = ({
|
|
|
98
105
|
>
|
|
99
106
|
<div className={headerClasses}>
|
|
100
107
|
<DrawerHead>
|
|
101
|
-
<div className="pfext-quick-start-panel-content__title">
|
|
108
|
+
<div className="pfext-quick-start-panel-content__title" tabIndex={-1} ref={titleRef}>
|
|
102
109
|
<Title
|
|
103
110
|
headingLevel="h1"
|
|
104
111
|
size="xl"
|
|
@@ -90,6 +90,12 @@ const QuickStartTile: React.FC<QuickStartTileProps> = ({
|
|
|
90
90
|
/>
|
|
91
91
|
}
|
|
92
92
|
onClick={handleClick}
|
|
93
|
+
onKeyDown={(event) => {
|
|
94
|
+
if (event.key === 'Enter' || event.key === ' ') {
|
|
95
|
+
setActiveQuickStart(id, tasks?.length);
|
|
96
|
+
onClick();
|
|
97
|
+
}
|
|
98
|
+
}}
|
|
93
99
|
// https://github.com/patternfly/patternfly-react/issues/7039
|
|
94
100
|
href="#"
|
|
95
101
|
data-test={`tile ${id}`}
|
|
@@ -97,6 +103,7 @@ const QuickStartTile: React.FC<QuickStartTileProps> = ({
|
|
|
97
103
|
<QuickStartTileDescription description={description} prerequisites={prerequisites} />
|
|
98
104
|
}
|
|
99
105
|
footer={footerComponent}
|
|
106
|
+
tabIndex={0}
|
|
100
107
|
/>
|
|
101
108
|
</div>
|
|
102
109
|
);
|
|
@@ -63,6 +63,13 @@ const QuickStartTaskHeader: React.FC<QuickStartTaskHeaderProps> = ({
|
|
|
63
63
|
onTaskSelect,
|
|
64
64
|
children,
|
|
65
65
|
}) => {
|
|
66
|
+
const titleRef = React.useRef(null);
|
|
67
|
+
React.useEffect(() => {
|
|
68
|
+
if (isActiveTask) {
|
|
69
|
+
// Focus the WizardNavItem button element that contains the title
|
|
70
|
+
titleRef.current.parentNode.focus();
|
|
71
|
+
}
|
|
72
|
+
}, [isActiveTask]);
|
|
66
73
|
const classNames = css('pfext-quick-start-task-header__title', {
|
|
67
74
|
'pfext-quick-start-task-header__title-success': taskStatus === QuickStartTaskStatus.SUCCESS,
|
|
68
75
|
'pfext-quick-start-task-header__title-failed':
|
|
@@ -82,7 +89,7 @@ const QuickStartTaskHeader: React.FC<QuickStartTaskHeaderProps> = ({
|
|
|
82
89
|
);
|
|
83
90
|
|
|
84
91
|
const content = (
|
|
85
|
-
<div className="pfext-quick-start-task-header">
|
|
92
|
+
<div className="pfext-quick-start-task-header" ref={titleRef}>
|
|
86
93
|
<TaskIcon taskIndex={taskIndex} taskStatus={taskStatus} />
|
|
87
94
|
<Title headingLevel="h3" size={size} className={classNames}>
|
|
88
95
|
<span dangerouslySetInnerHTML={{ __html: removeParagraphWrap(markdownConvert(title)) }} />
|
|
@@ -88,7 +88,7 @@ export const QuickStartContextDefaults = {
|
|
|
88
88
|
activeQuickStartState: {},
|
|
89
89
|
setAllQuickStarts: () => {},
|
|
90
90
|
resourceBundle: en,
|
|
91
|
-
getResource: () =>
|
|
91
|
+
getResource: (resource: string) => resource,
|
|
92
92
|
language: 'en',
|
|
93
93
|
useQueryParams: true,
|
|
94
94
|
filter: {
|
|
@@ -115,7 +115,7 @@ export const getResource = (resource: string, options: any, resourceBundle: any,
|
|
|
115
115
|
return resourceBundle[`${resource}_${suffix}`];
|
|
116
116
|
}
|
|
117
117
|
}
|
|
118
|
-
return (resourceBundle && resourceBundle[resource]) ||
|
|
118
|
+
return (resourceBundle && resourceBundle[resource]) || resource;
|
|
119
119
|
};
|
|
120
120
|
|
|
121
121
|
export const useValuesForQuickStartContext = (
|