@patternfly/quickstarts 1.2.3 → 2.0.1-rc.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/README.md +48 -2
- package/dist/QuickStartDrawer.d.ts +2 -0
- package/dist/QuickStartPanelContent.d.ts +1 -0
- package/dist/catalog/QuickStartTileFooterExternal.d.ts +1 -0
- package/dist/catalog/QuickStartTileHeader.d.ts +1 -0
- package/dist/controller/QuickStartIntroduction.d.ts +2 -0
- package/dist/index.es.js +107 -62
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +106 -61
- package/dist/index.js.map +1 -1
- package/dist/patternfly-global.css +1189 -0
- package/dist/patternfly-nested.css +7233 -0
- package/dist/quickstarts-base.css +220 -36
- package/dist/quickstarts-full.es.js +375 -254
- package/dist/quickstarts-full.es.js.map +1 -1
- package/dist/quickstarts-standalone.css +639 -0
- package/dist/quickstarts-standalone.min.css +4 -0
- package/dist/quickstarts.css +220 -36
- package/dist/quickstarts.min.css +1 -1
- package/dist/styles/patternfly-global-entry.d.ts +1 -0
- package/dist/styles/patternfly-nested-entry.d.ts +1 -0
- package/dist/styles/quickstarts-standalone-entry.d.ts +1 -0
- package/dist/utils/quick-start-context.d.ts +5 -0
- package/package.json +6 -4
package/README.md
CHANGED
|
@@ -27,9 +27,26 @@ import '@patternfly/react-core/dist/styles/base.css';
|
|
|
27
27
|
import '@patternfly/quickstarts/dist/quickstarts.min.css';
|
|
28
28
|
```
|
|
29
29
|
|
|
30
|
+
### Stylesheets if you use an older version of PatternFly
|
|
31
|
+
If you use an older version of @patternfly/react-core (older than "4.115.2"), and you can't upgrade yet, you can pull in the necessary PatternFly styles that @patternfly/quickstarts depends upon.
|
|
32
|
+
|
|
33
|
+
Ideally @patternfly/quickstarts will use the consumer provided PatternFly styles, only use these stylesheets if really needed.
|
|
34
|
+
|
|
35
|
+
`quickstarts-standalone.min.css` nests the css classes within a **.pfext-quick-start__base** parent, so that they have higher specificity. `patternfly-global.css` includes component styles that we cannot nest with more specificiy (for example Drawer since it can include consumer components that depend on an older PF version).
|
|
36
|
+
|
|
37
|
+
> Note: Only use these stylesheets if necessary!
|
|
38
|
+
```js
|
|
39
|
+
// import base from PatternFly to get the font
|
|
40
|
+
import '@patternfly/react-core/dist/styles/base.css';
|
|
41
|
+
// some global styles and variables that quickstarts uses (Drawer, Popover, Modal, Backdrop, Bullseye)
|
|
42
|
+
import '@patternfly/quickstarts/dist/patternfly-global.css';
|
|
43
|
+
// PF and quickstarts styles nested within .pfext-quick-start__base
|
|
44
|
+
import '@patternfly/quickstarts/dist/quickstarts-standalone.min.css';
|
|
45
|
+
```
|
|
46
|
+
|
|
30
47
|
## Usage example
|
|
31
48
|
|
|
32
|
-
Note: You can also view this example on [codesandbox](https://codesandbox.io/s/
|
|
49
|
+
Note: You can also view this example on [codesandbox](https://codesandbox.io/s/patternfly-quickstarts-finished-cnv53)!
|
|
33
50
|
|
|
34
51
|
```js
|
|
35
52
|
import "./styles.css";
|
|
@@ -93,7 +110,10 @@ const App = () => {
|
|
|
93
110
|
allQuickStartStates,
|
|
94
111
|
setActiveQuickStartID,
|
|
95
112
|
setAllQuickStartStates,
|
|
113
|
+
// Set to true to opt-out of default hidden card footers
|
|
96
114
|
showCardFooters: false,
|
|
115
|
+
// Set to true to opt-out of default drawer header colors of blue with white text
|
|
116
|
+
useLegacyHeaderColors: false,
|
|
97
117
|
loading,
|
|
98
118
|
useQueryParams: withQueryParams,
|
|
99
119
|
};
|
|
@@ -140,6 +160,10 @@ const SomeNestedComponent = () => {
|
|
|
140
160
|
export default App;
|
|
141
161
|
```
|
|
142
162
|
|
|
163
|
+
## Design update, option to opt-out of new drawer header coloring
|
|
164
|
+
|
|
165
|
+
See above usage of `useLegacyHeaderColors` boolean to opt-out of update. Should only be used if new color scheme clashes with the usage context.
|
|
166
|
+
|
|
143
167
|
## Quick starts format
|
|
144
168
|
|
|
145
169
|
Quick starts are parsed as markdown. To write your own quick start, if you use Typescript you can [check out the type definition here](https://github.com/patternfly/patternfly-quickstarts/blob/d52b194119f1ff16e69bf589d49a14931a19ac4b/packages/module/src/utils/quick-start-types.ts#L6).
|
|
@@ -204,4 +228,26 @@ You can have inline or block copyable text.
|
|
|
204
228
|
```{{copy}}
|
|
205
229
|
```
|
|
206
230
|
|
|
207
|
-
|
|
231
|
+
## Localization
|
|
232
|
+
We use English as the default language. You can override the default by providing your own key/value pairs to the `QuickStartContainer` or `QuickStartContextProvider` resourceBundle prop.
|
|
233
|
+
|
|
234
|
+
Example:
|
|
235
|
+
```js
|
|
236
|
+
// load my own resource Czech translations resource bundle using i18next
|
|
237
|
+
const resourceBundle = i18n.getResourceBundle('cs', 'quickstart');
|
|
238
|
+
const resources = {
|
|
239
|
+
...resourceBundle,
|
|
240
|
+
Start: "Let's go!",
|
|
241
|
+
Continue: 'Resume',
|
|
242
|
+
Restart: 'Start over',
|
|
243
|
+
};
|
|
244
|
+
return (
|
|
245
|
+
<QuickStartContainer resourceBundle={resources}>
|
|
246
|
+
</QuickStartContainer>
|
|
247
|
+
)
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
Use this [file](https://github.com/patternfly/patternfly-quickstarts/blob/main/packages/module/src/locales/en/quickstart.json) as a base for your translations.
|
|
251
|
+
Each language is different, especially when it comes to plurals. Try [this utility](https://jsfiddle.net/6bpxsgd4) sourced from [i18next](https://www.i18next.com/translation-function/plurals#how-to-find-the-correct-plural-suffix) to determine the suffixes for the right plural format.
|
|
252
|
+
|
|
253
|
+
####
|
|
@@ -14,10 +14,12 @@ export interface QuickStartContainerProps extends React.HTMLProps<HTMLDivElement
|
|
|
14
14
|
onCloseInProgress?: any;
|
|
15
15
|
onCloseNotInProgress?: any;
|
|
16
16
|
showCardFooters?: boolean;
|
|
17
|
+
useLegacyHeaderColors?: boolean;
|
|
17
18
|
resourceBundle?: any;
|
|
18
19
|
language?: string;
|
|
19
20
|
loading?: boolean;
|
|
20
21
|
useQueryParams?: boolean;
|
|
22
|
+
alwaysShowTaskReview?: boolean;
|
|
21
23
|
/**
|
|
22
24
|
* Additional markdown extensions and renderers to use
|
|
23
25
|
* TODO: example usage - In the meantime you can take a look at:
|
|
@@ -9,6 +9,7 @@ declare type QuickStartPanelContentProps = {
|
|
|
9
9
|
appendTo?: HTMLElement | (() => HTMLElement);
|
|
10
10
|
isResizable?: boolean;
|
|
11
11
|
showClose?: boolean;
|
|
12
|
+
headerVariant?: '' | 'blue-white';
|
|
12
13
|
};
|
|
13
14
|
declare const QuickStartPanelContent: React.FC<QuickStartPanelContentProps>;
|
|
14
15
|
export default QuickStartPanelContent;
|
|
@@ -2,6 +2,7 @@ import * as React from 'react';
|
|
|
2
2
|
import { QuickStartExternal } from '../utils/quick-start-types';
|
|
3
3
|
declare type QuickStartTileFooterProps = {
|
|
4
4
|
link: QuickStartExternal;
|
|
5
|
+
quickStartId?: string;
|
|
5
6
|
};
|
|
6
7
|
declare const QuickStartTileFooterExternal: React.FC<QuickStartTileFooterProps>;
|
|
7
8
|
export default QuickStartTileFooterExternal;
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { QuickStartTask, QuickStartTaskStatus } from '../utils/quick-start-types';
|
|
3
|
+
import './QuickStartIntroduction.scss';
|
|
3
4
|
declare type QuickStartIntroductionProps = {
|
|
4
5
|
introduction: string;
|
|
5
6
|
tasks: QuickStartTask[];
|
|
6
7
|
allTaskStatuses: QuickStartTaskStatus[];
|
|
8
|
+
prerequisites?: string[];
|
|
7
9
|
onTaskSelect: (selectedTaskNumber: number) => void;
|
|
8
10
|
};
|
|
9
11
|
declare const QuickStartIntroduction: React.FC<QuickStartIntroductionProps>;
|
package/dist/index.es.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import React__default, { createContext, useCallback, useEffect, useState } from 'react';
|
|
3
|
-
import { Card, CardHeader, CardActions, CardTitle, CardBody, CardFooter, Modal as Modal$1, Tooltip, Popover, PopoverPosition, Button, Text, TextVariants, TextList, TextListItem, Flex, FlexItem, Title, Label, Gallery, GalleryItem, ToolbarItem, SearchInput, Select, SelectVariant, SelectOption, Toolbar, ToolbarContent, EmptyState, EmptyStateIcon, EmptyStateBody, EmptyStatePrimary, Divider, ModalVariant, WizardNavItem, List, Alert, Radio, DrawerPanelContent, DrawerHead, DrawerActions, DrawerCloseButton, DrawerPanelBody, Drawer, DrawerContent, DrawerContentBody } from '@patternfly/react-core';
|
|
3
|
+
import { Card, CardHeader, CardActions, CardTitle, CardBody, CardFooter, Modal as Modal$1, Tooltip, Popover, PopoverPosition, Button, Text, TextVariants, TextList, TextListItem, Flex, FlexItem, Title, Label, Gallery, GalleryItem, ToolbarItem, SearchInput, Select, SelectVariant, SelectOption, Toolbar, ToolbarContent, EmptyState, EmptyStateIcon, EmptyStateBody, EmptyStatePrimary, Divider, ModalVariant, WizardNavItem, List, ExpandableSection, ListItem, Alert, Radio, DrawerPanelContent, DrawerHead, DrawerActions, DrawerCloseButton, DrawerPanelBody, Drawer, DrawerContent, DrawerContentBody } from '@patternfly/react-core';
|
|
4
4
|
import SearchIcon from '@patternfly/react-icons/dist/js/icons/search-icon';
|
|
5
5
|
import { css } from '@patternfly/react-styles';
|
|
6
6
|
import RocketIcon from '@patternfly/react-icons/dist/js/icons/rocket-icon';
|
|
@@ -139,6 +139,7 @@ var en = {
|
|
|
139
139
|
"{{count, number}} item": "{{count, number}} item",
|
|
140
140
|
"{{count, number}} item_plural": "{{count, number}} items",
|
|
141
141
|
"Prerequisites ({{totalPrereqs}})": "Prerequisites ({{totalPrereqs}})",
|
|
142
|
+
"View Prerequisites ({{totalPrereqs}})": "View Prerequisites ({{totalPrereqs}})",
|
|
142
143
|
Prerequisites: Prerequisites,
|
|
143
144
|
"Show prerequisites": "Show prerequisites",
|
|
144
145
|
Complete: Complete,
|
|
@@ -166,7 +167,8 @@ var en = {
|
|
|
166
167
|
"Your progress will be saved.": "Your progress will be saved.",
|
|
167
168
|
"Not available": "Not available",
|
|
168
169
|
"Copy to clipboard": "Copy to clipboard",
|
|
169
|
-
"Successfully copied to clipboard!": "Successfully copied to clipboard!"
|
|
170
|
+
"Successfully copied to clipboard!": "Successfully copied to clipboard!",
|
|
171
|
+
"Quick start • {{duration, number}} minutes": "Quick start • {{duration, number}} minutes"
|
|
170
172
|
};
|
|
171
173
|
|
|
172
174
|
/* eslint-disable */
|
|
@@ -576,8 +578,10 @@ const QuickStartContextDefaults = {
|
|
|
576
578
|
},
|
|
577
579
|
setFilter: () => { },
|
|
578
580
|
footer: null,
|
|
581
|
+
useLegacyHeaderColors: false,
|
|
579
582
|
markdown: null,
|
|
580
583
|
loading: false,
|
|
584
|
+
alwaysShowTaskReview: false,
|
|
581
585
|
};
|
|
582
586
|
const QuickStartContext = createContext(QuickStartContextDefaults);
|
|
583
587
|
const getResource = (resource, options, resourceBundle, lng) => {
|
|
@@ -593,7 +597,7 @@ const getResource = (resource, options, resourceBundle, lng) => {
|
|
|
593
597
|
const useValuesForQuickStartContext = (value = {}) => {
|
|
594
598
|
var _a, _b;
|
|
595
599
|
const combinedValue = Object.assign(Object.assign({}, QuickStartContextDefaults), value);
|
|
596
|
-
const { activeQuickStartID, setActiveQuickStartID, setAllQuickStartStates, useQueryParams, allQuickStartStates, allQuickStarts = [], footer, markdown, } = combinedValue;
|
|
600
|
+
const { activeQuickStartID, setActiveQuickStartID, setAllQuickStartStates, useQueryParams, allQuickStartStates, allQuickStarts = [], footer, useLegacyHeaderColors, markdown, } = combinedValue;
|
|
597
601
|
const [quickStarts, setQuickStarts] = React__default.useState(combinedValue.allQuickStarts || []);
|
|
598
602
|
const [resourceBundle, setResourceBundle] = React__default.useState(Object.assign(Object.assign({}, en), combinedValue.resourceBundle));
|
|
599
603
|
const [language, setLanguage] = React__default.useState(combinedValue.language);
|
|
@@ -605,6 +609,7 @@ const useValuesForQuickStartContext = (value = {}) => {
|
|
|
605
609
|
return getResource(resource, count !== undefined ? { count } : null, resourceBundle, language);
|
|
606
610
|
}, [resourceBundle, language]);
|
|
607
611
|
const [loading, setLoading] = React__default.useState(combinedValue.loading);
|
|
612
|
+
const [alwaysShowTaskReview, setAlwaysShowTaskReview] = React__default.useState(combinedValue.alwaysShowTaskReview);
|
|
608
613
|
const initialSearchParams = new URLSearchParams(window.location.search);
|
|
609
614
|
const initialSearchQuery = initialSearchParams.get(QUICKSTART_SEARCH_FILTER_KEY) || '';
|
|
610
615
|
const initialStatusFilters = ((_a = initialSearchParams.get(QUICKSTART_STATUS_FILTER_KEY)) === null || _a === void 0 ? void 0 : _a.split(',')) || [];
|
|
@@ -675,6 +680,10 @@ const useValuesForQuickStartContext = (value = {}) => {
|
|
|
675
680
|
});
|
|
676
681
|
setAllQuickStartStates((qs) => (Object.assign(Object.assign({}, qs), { [quickStartId]: getDefaultQuickStartState(totalTasks, QuickStartStatus.IN_PROGRESS) })));
|
|
677
682
|
}, [setActiveQuickStartID, setAllQuickStartStates, useQueryParams]);
|
|
683
|
+
// When alwaysShowTaskReview preference is enabled, skip visited step and go directly to review
|
|
684
|
+
const stepAfterInitial = alwaysShowTaskReview
|
|
685
|
+
? QuickStartTaskStatus.REVIEW
|
|
686
|
+
: QuickStartTaskStatus.VISITED;
|
|
678
687
|
const nextStep = useCallback((totalTasks) => {
|
|
679
688
|
if (!activeQuickStartID) {
|
|
680
689
|
return;
|
|
@@ -701,19 +710,19 @@ const useValuesForQuickStartContext = (value = {}) => {
|
|
|
701
710
|
if (taskNumber < totalTasks && !updatedTaskStatus) {
|
|
702
711
|
updatedTaskNumber = taskNumber + 1;
|
|
703
712
|
}
|
|
704
|
-
const
|
|
713
|
+
const markInitialStepVisitedOrReview = updatedTaskNumber > -1 &&
|
|
705
714
|
quickStart[getTaskStatusKey(updatedTaskNumber)] === QuickStartTaskStatus.INIT
|
|
706
|
-
?
|
|
715
|
+
? stepAfterInitial
|
|
707
716
|
: quickStart[getTaskStatusKey(updatedTaskNumber)];
|
|
708
717
|
const newState = Object.assign(Object.assign({}, qs), { [activeQuickStartID]: Object.assign(Object.assign(Object.assign(Object.assign({}, quickStart), (updatedStatus ? { status: updatedStatus } : {})), (updatedTaskNumber > -1
|
|
709
718
|
? {
|
|
710
719
|
taskNumber: updatedTaskNumber,
|
|
711
|
-
[getTaskStatusKey(updatedTaskNumber)]:
|
|
720
|
+
[getTaskStatusKey(updatedTaskNumber)]: markInitialStepVisitedOrReview,
|
|
712
721
|
}
|
|
713
722
|
: {})), (updatedTaskStatus ? { [getTaskStatusKey(taskNumber)]: updatedTaskStatus } : {})) });
|
|
714
723
|
return newState;
|
|
715
724
|
});
|
|
716
|
-
}, [activeQuickStartID, setAllQuickStartStates]);
|
|
725
|
+
}, [activeQuickStartID, setAllQuickStartStates, stepAfterInitial]);
|
|
717
726
|
const previousStep = useCallback(() => {
|
|
718
727
|
setAllQuickStartStates((qs) => {
|
|
719
728
|
const quickStart = qs[activeQuickStartID];
|
|
@@ -735,7 +744,7 @@ const useValuesForQuickStartContext = (value = {}) => {
|
|
|
735
744
|
let updatedTaskStatus = {};
|
|
736
745
|
for (let taskIndex = 0; taskIndex <= taskNumber; taskIndex++) {
|
|
737
746
|
const taskStatus = quickStart[getTaskStatusKey(taskIndex)];
|
|
738
|
-
const newTaskStatus = taskStatus === QuickStartTaskStatus.INIT ?
|
|
747
|
+
const newTaskStatus = taskStatus === QuickStartTaskStatus.INIT ? stepAfterInitial : undefined;
|
|
739
748
|
if (newTaskStatus) {
|
|
740
749
|
updatedTaskStatus = Object.assign(Object.assign({}, updatedTaskStatus), { [getTaskStatusKey(taskIndex)]: newTaskStatus });
|
|
741
750
|
}
|
|
@@ -743,7 +752,7 @@ const useValuesForQuickStartContext = (value = {}) => {
|
|
|
743
752
|
const updatedQuickStart = Object.assign(Object.assign(Object.assign(Object.assign({}, quickStart), (updatedStatus ? { status: updatedStatus } : {})), { taskNumber }), updatedTaskStatus);
|
|
744
753
|
return Object.assign(Object.assign({}, qs), { [quickStartId]: updatedQuickStart });
|
|
745
754
|
});
|
|
746
|
-
}, [setAllQuickStartStates]);
|
|
755
|
+
}, [setAllQuickStartStates, stepAfterInitial]);
|
|
747
756
|
const setQuickStartTaskStatus = useCallback((taskStatus) => {
|
|
748
757
|
const quickStart = allQuickStartStates[activeQuickStartID];
|
|
749
758
|
const { taskNumber } = quickStart;
|
|
@@ -771,6 +780,7 @@ const useValuesForQuickStartContext = (value = {}) => {
|
|
|
771
780
|
setQuickStartTaskStatus,
|
|
772
781
|
getQuickStartForId,
|
|
773
782
|
footer,
|
|
783
|
+
useLegacyHeaderColors,
|
|
774
784
|
useQueryParams,
|
|
775
785
|
markdown,
|
|
776
786
|
resourceBundle,
|
|
@@ -789,6 +799,8 @@ const useValuesForQuickStartContext = (value = {}) => {
|
|
|
789
799
|
setFilter,
|
|
790
800
|
loading,
|
|
791
801
|
setLoading,
|
|
802
|
+
alwaysShowTaskReview,
|
|
803
|
+
setAlwaysShowTaskReview,
|
|
792
804
|
};
|
|
793
805
|
};
|
|
794
806
|
const QuickStartContextProvider = ({ children, value }) => {
|
|
@@ -954,7 +966,7 @@ const SimplePopper = ({ children }) => {
|
|
|
954
966
|
}
|
|
955
967
|
}, [destroy, isOpen]);
|
|
956
968
|
return isOpen ? (React.createElement(Portal, null,
|
|
957
|
-
React.createElement("div", { ref: nodeRefCallback, style: { zIndex: 9999, position: 'absolute', top: 0, left: 0 } }, children))) : null;
|
|
969
|
+
React.createElement("div", { ref: nodeRefCallback, style: { zIndex: 9999, position: 'absolute', top: 0, left: 0 }, className: "pfext-quick-start__base" }, children))) : null;
|
|
958
970
|
};
|
|
959
971
|
|
|
960
972
|
const isInViewport = (elementToCheck) => {
|
|
@@ -1197,7 +1209,7 @@ const CopyClipboard = ({ element, rootSelector, docContext, }) => {
|
|
|
1197
1209
|
useEventListener(element, 'mouseleave', React.useCallback(() => {
|
|
1198
1210
|
setShowSuccessContent(false);
|
|
1199
1211
|
}, []));
|
|
1200
|
-
return showSuccessContent ? (React.createElement(Tooltip, { key: "after-copy", isVisible: true, reference: () => element, content: getResource('Successfully copied to clipboard!') })) : (React.createElement(Tooltip, { key: "before-copy", reference: () => element, content: getResource('Copy to clipboard') }));
|
|
1212
|
+
return showSuccessContent ? (React.createElement(Tooltip, { key: "after-copy", isVisible: true, reference: () => element, content: getResource('Successfully copied to clipboard!'), className: "pfext-quick-start__base" })) : (React.createElement(Tooltip, { key: "before-copy", reference: () => element, content: getResource('Copy to clipboard'), className: "pfext-quick-start__base" }));
|
|
1201
1213
|
};
|
|
1202
1214
|
const MarkdownCopyClipboard = ({ docContext, rootSelector, }) => {
|
|
1203
1215
|
const elements = docContext.querySelectorAll(`${rootSelector} [${MARKDOWN_COPY_BUTTON_ID}]`);
|
|
@@ -1522,10 +1534,11 @@ const QuickStartTileDescription = ({ description, prerequisites, }) => {
|
|
|
1522
1534
|
React.createElement(Text, { component: TextVariants.h5, className: "pfext-quick-start-tile-prerequisites__text" },
|
|
1523
1535
|
getResource('Prerequisites ({{totalPrereqs}})').replace('{{totalPrereqs}}', prereqs.length),
|
|
1524
1536
|
' '),
|
|
1525
|
-
React.createElement(Popover, { "aria-label": getResource('Prerequisites'), headerContent: getResource('Prerequisites'), className: "pfext-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
React.createElement(
|
|
1537
|
+
React.createElement(Popover, { "aria-label": getResource('Prerequisites'), headerContent: getResource('Prerequisites'), className: "pfext-quick-start__base", bodyContent: React.createElement("div", { className: "pfext-popover__base" },
|
|
1538
|
+
React.createElement(TextList, { "aria-label": getResource('Prerequisites'), className: "pfext-quick-start-tile-prerequisites-list" }, prereqs.map((prerequisite, index) => (
|
|
1539
|
+
// eslint-disable-next-line react/no-array-index-key
|
|
1540
|
+
React.createElement(TextListItem, { key: index },
|
|
1541
|
+
React.createElement(QuickStartMarkdownView, { content: prerequisite })))))) },
|
|
1529
1542
|
React.createElement(Button, { variant: "link", isInline: true, className: "pfext-quick-start-tile-prerequisites__icon", "data-testid": "qs-card-prereqs", onClick: (e) => {
|
|
1530
1543
|
e.preventDefault();
|
|
1531
1544
|
e.stopPropagation();
|
|
@@ -1548,20 +1561,20 @@ const QuickStartTileFooter = ({ quickStartId, status, totalTasks, }) => {
|
|
|
1548
1561
|
}, [quickStartId, restartQuickStart, totalTasks]);
|
|
1549
1562
|
return (React.createElement(Flex, { justifyContent: { default: 'justifyContentSpaceBetween' } },
|
|
1550
1563
|
status === QuickStartStatus.NOT_STARTED && (React.createElement(FlexItem, null,
|
|
1551
|
-
React.createElement(Button, { onClick: start, variant: "link", isInline: true, "data-testid": "qs-card-notStarted-start" }, getResource('Start')))),
|
|
1564
|
+
React.createElement(Button, { onClick: start, variant: "link", isInline: true, "data-testid": "qs-card-notStarted-start", id: `${quickStartId}-start`, "aria-labelledby": `${quickStartId}-start ${quickStartId}` }, getResource('Start')))),
|
|
1552
1565
|
status === QuickStartStatus.IN_PROGRESS && activeQuickStartID !== quickStartId && (React.createElement(FlexItem, null,
|
|
1553
|
-
React.createElement(Button, { variant: "link", isInline: true, "data-testid": "qs-card-inProgress-resume" }, getResource('Continue')))),
|
|
1566
|
+
React.createElement(Button, { variant: "link", isInline: true, "data-testid": "qs-card-inProgress-resume", id: `${quickStartId}-continue`, "aria-labelledby": `${quickStartId}-continue ${quickStartId}` }, getResource('Continue')))),
|
|
1554
1567
|
status === QuickStartStatus.COMPLETE && (React.createElement(FlexItem, null,
|
|
1555
|
-
React.createElement(Button, { onClick: restart, variant: "link", isInline: true, "data-testid": "qs-card-complete-restart" }, getResource('
|
|
1568
|
+
React.createElement(Button, { onClick: restart, variant: "link", isInline: true, "data-testid": "qs-card-complete-restart", id: `${quickStartId}-restart`, "aria-labelledby": `${quickStartId}-restart ${quickStartId}` }, getResource('Restart')))),
|
|
1556
1569
|
status === QuickStartStatus.IN_PROGRESS && (React.createElement(FlexItem, null,
|
|
1557
|
-
React.createElement(Button, { onClick: restart, variant: "link", isInline: true, "data-testid": "qs-card-inProgress-restart" }, getResource('Restart'))))));
|
|
1570
|
+
React.createElement(Button, { onClick: restart, variant: "link", isInline: true, "data-testid": "qs-card-inProgress-restart", id: `${quickStartId}-restart`, "aria-labelledby": `${quickStartId}-restart ${quickStartId}` }, getResource('Restart'))))));
|
|
1558
1571
|
};
|
|
1559
1572
|
|
|
1560
|
-
const QuickStartTileFooterExternal = ({ link }) => {
|
|
1573
|
+
const QuickStartTileFooterExternal = ({ link, quickStartId, }) => {
|
|
1561
1574
|
const { href, text } = link;
|
|
1562
1575
|
return (React.createElement(Flex, { justifyContent: { default: 'justifyContentSpaceBetween' } },
|
|
1563
1576
|
React.createElement(FlexItem, null,
|
|
1564
|
-
React.createElement(Button, { component: "a", href: href, target: "_blank", rel: "noopener noreferrer", variant: "link", "aria-label": `Open documentation in new window`, isInline: true, icon: React.createElement(ExternalLinkAltIcon, null), iconPosition: "right" }, text || href))));
|
|
1577
|
+
React.createElement(Button, { component: "a", href: href, target: "_blank", rel: "noopener noreferrer", variant: "link", "aria-label": `Open documentation in new window`, isInline: true, icon: React.createElement(ExternalLinkAltIcon, null), iconPosition: "right", id: quickStartId, "aria-labelledby": `${quickStartId}-external ${quickStartId}` }, text || href))));
|
|
1565
1578
|
};
|
|
1566
1579
|
|
|
1567
1580
|
const statusColorMap = {
|
|
@@ -1569,7 +1582,7 @@ const statusColorMap = {
|
|
|
1569
1582
|
[QuickStartStatus.IN_PROGRESS]: 'purple',
|
|
1570
1583
|
[QuickStartStatus.NOT_STARTED]: 'grey',
|
|
1571
1584
|
};
|
|
1572
|
-
const QuickStartTileHeader = ({ status, duration, name, type, }) => {
|
|
1585
|
+
const QuickStartTileHeader = ({ status, duration, name, type, quickStartId, }) => {
|
|
1573
1586
|
const { getResource } = React.useContext(QuickStartContext);
|
|
1574
1587
|
const statusLocaleMap = {
|
|
1575
1588
|
[QuickStartStatus.COMPLETE]: getResource('Complete'),
|
|
@@ -1577,7 +1590,7 @@ const QuickStartTileHeader = ({ status, duration, name, type, }) => {
|
|
|
1577
1590
|
[QuickStartStatus.NOT_STARTED]: getResource('Not started'),
|
|
1578
1591
|
};
|
|
1579
1592
|
return (React.createElement("div", { className: "pfext-quick-start-tile-header" },
|
|
1580
|
-
React.createElement(Title, { headingLevel: "h3", "data-test": "title" }, name),
|
|
1593
|
+
React.createElement(Title, { headingLevel: "h3", "data-test": "title", id: quickStartId }, name),
|
|
1581
1594
|
React.createElement("div", { className: "pfext-quick-start-tile-header__status" },
|
|
1582
1595
|
type && (React.createElement(Label, { className: "pfext-quick-start-tile-header--margin", color: type.color }, type.text)),
|
|
1583
1596
|
duration && (React.createElement(Label, { variant: "outline", "data-test": "duration", icon: React.createElement(OutlinedClockIcon, null), className: "pfext-quick-start-tile-header--margin" }, getResource('{{duration, number}} minutes', duration).replace('{{duration, number}}', duration))),
|
|
@@ -1595,7 +1608,7 @@ const QuickStartTile = ({ quickStart, status, isActive, onClick = () => { }, })
|
|
|
1595
1608
|
else {
|
|
1596
1609
|
quickStartIcon = (React.createElement(FallbackImg, { className: "pfext-catalog-item-icon__img--large", src: icon, alt: "", fallback: React.createElement(RocketIcon, null) }));
|
|
1597
1610
|
}
|
|
1598
|
-
const footerComponent = footer && footer.show === false ? null : link ? (React.createElement(QuickStartTileFooterExternal, { link: link })) : (React.createElement(QuickStartTileFooter, { quickStartId: id, status: status, totalTasks: tasks === null || tasks === void 0 ? void 0 : tasks.length }));
|
|
1611
|
+
const footerComponent = footer && footer.show === false ? null : link ? (React.createElement(QuickStartTileFooterExternal, { link: link, quickStartId: id })) : (React.createElement(QuickStartTileFooter, { quickStartId: id, status: status, totalTasks: tasks === null || tasks === void 0 ? void 0 : tasks.length }));
|
|
1599
1612
|
const handleClick = (e) => {
|
|
1600
1613
|
var _a;
|
|
1601
1614
|
if ((_a = ref.current) === null || _a === void 0 ? void 0 : _a.contains(e.target)) {
|
|
@@ -1615,7 +1628,7 @@ const QuickStartTile = ({ quickStart, status, isActive, onClick = () => { }, })
|
|
|
1615
1628
|
// @ts-ignore
|
|
1616
1629
|
component: "div", style: {
|
|
1617
1630
|
cursor: 'pointer',
|
|
1618
|
-
}, 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 }), onClick: handleClick, "data-test": `tile ${id}`, description: React.createElement(QuickStartTileDescription, { description: description, prerequisites: prerequisites }), footer: footerComponent })));
|
|
1631
|
+
}, 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, "data-test": `tile ${id}`, description: React.createElement(QuickStartTileDescription, { description: description, prerequisites: prerequisites }), footer: footerComponent })));
|
|
1619
1632
|
};
|
|
1620
1633
|
|
|
1621
1634
|
const QuickStartCatalog = ({ quickStarts }) => {
|
|
@@ -1808,7 +1821,7 @@ const QuickStartCatalogPage = ({ quickStarts, showFilter, sortFnc = (q1, q2) =>
|
|
|
1808
1821
|
if (!allQuickStarts || allQuickStarts.length === 0) {
|
|
1809
1822
|
return React.createElement(EmptyBox, { label: getResource('Quick Starts') });
|
|
1810
1823
|
}
|
|
1811
|
-
return (React.createElement(
|
|
1824
|
+
return (React.createElement("div", { className: "pfext-quick-start__base" },
|
|
1812
1825
|
showTitle && (React.createElement("div", { className: "pfext-page-layout__header" },
|
|
1813
1826
|
React.createElement(Text, { component: "h1", className: "pfext-page-layout__title", "data-test": "page-title" }, title || getResource('Quick Starts')),
|
|
1814
1827
|
hint && React.createElement("div", { className: "pfext-page-layout__hint" }, hint))),
|
|
@@ -1829,39 +1842,51 @@ const QuickStartCatalogToolbar = ({ children }) => (React.createElement(Toolbar,
|
|
|
1829
1842
|
|
|
1830
1843
|
const QuickStartCloseModal = ({ isOpen, onConfirm, onCancel, }) => {
|
|
1831
1844
|
const { getResource } = React.useContext(QuickStartContext);
|
|
1832
|
-
return (React.createElement(Modal, { className: "pfext-quick-start-drawer__modal", isOpen: isOpen, variant: ModalVariant.small, showClose: false, "data-test": "leave-quickstart", title: getResource('Leave quick start?'), footer: React.createElement(Flex, null,
|
|
1845
|
+
return (React.createElement(Modal, { className: "pfext-quick-start-drawer__modal pfext-quick-start__base", isOpen: isOpen, variant: ModalVariant.small, showClose: false, "data-test": "leave-quickstart", title: getResource('Leave quick start?'), footer: React.createElement(Flex, null,
|
|
1833
1846
|
React.createElement(FlexItem, { align: { default: 'alignRight' } },
|
|
1834
1847
|
React.createElement(Button, { variant: "secondary", "data-test": "cancel button", onClick: onCancel }, getResource('Cancel'))),
|
|
1835
1848
|
React.createElement(FlexItem, null,
|
|
1836
1849
|
React.createElement(Button, { variant: "primary", "data-test": "leave button", onClick: onConfirm }, getResource('Leave')))), isFullScreen: true }, getResource('Your progress will be saved.')));
|
|
1837
1850
|
};
|
|
1838
1851
|
|
|
1839
|
-
const TaskIcon = ({ taskIndex, taskStatus
|
|
1852
|
+
const TaskIcon = ({ taskIndex, taskStatus }) => {
|
|
1840
1853
|
const { getResource } = React.useContext(QuickStartContext);
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1854
|
+
const success = taskStatus === QuickStartTaskStatus.SUCCESS;
|
|
1855
|
+
const failed = taskStatus === QuickStartTaskStatus.FAILED;
|
|
1856
|
+
const classNames = css('pfext-icon-and-text__icon', {
|
|
1857
|
+
'pfext-quick-start-task-header__task-icon-init': !failed && !success,
|
|
1858
|
+
});
|
|
1859
|
+
let content;
|
|
1860
|
+
if (success) {
|
|
1861
|
+
content = (React.createElement(CheckCircleIcon, { size: "md", className: "pfext-quick-start-task-header__task-icon-success" }));
|
|
1862
|
+
}
|
|
1863
|
+
else if (failed) {
|
|
1864
|
+
content = (React.createElement(ExclamationCircleIcon, { size: "md", className: "pfext-quick-start-task-header__task-icon-failed" }));
|
|
1865
|
+
}
|
|
1866
|
+
else {
|
|
1867
|
+
content = getResource('{{taskIndex, number}}', taskIndex).replace('{{taskIndex, number}}', taskIndex);
|
|
1850
1868
|
}
|
|
1869
|
+
return React.createElement("span", { className: classNames }, content);
|
|
1851
1870
|
};
|
|
1852
1871
|
const QuickStartTaskHeader = ({ title, taskIndex, subtitle, taskStatus, size, isActiveTask, onTaskSelect, }) => {
|
|
1853
1872
|
const classNames = css('pfext-quick-start-task-header__title', {
|
|
1854
1873
|
'pfext-quick-start-task-header__title-success': taskStatus === QuickStartTaskStatus.SUCCESS,
|
|
1855
|
-
'pfext-quick-start-task-header__title-failed': taskStatus === QuickStartTaskStatus.FAILED,
|
|
1874
|
+
'pfext-quick-start-task-header__title-failed': taskStatus === (QuickStartTaskStatus.FAILED || QuickStartTaskStatus.VISITED),
|
|
1856
1875
|
});
|
|
1857
|
-
const
|
|
1876
|
+
const notCompleted = taskStatus === QuickStartTaskStatus.VISITED;
|
|
1877
|
+
const skippedReviewOrFailed = taskStatus === QuickStartTaskStatus.REVIEW || taskStatus === QuickStartTaskStatus.FAILED;
|
|
1878
|
+
const tryAgain = !isActiveTask && (skippedReviewOrFailed || notCompleted) && (React.createElement(React.Fragment, null,
|
|
1879
|
+
React.createElement("div", null),
|
|
1880
|
+
React.createElement("div", { className: "pfext-quick-start-task-header__tryagain" }, "Try the steps again.")));
|
|
1881
|
+
const content = (React.createElement("div", { className: "pfext-quick-start-task-header" },
|
|
1882
|
+
React.createElement(TaskIcon, { taskIndex: taskIndex, taskStatus: taskStatus }),
|
|
1858
1883
|
React.createElement(Title, { headingLevel: "h3", size: size, className: classNames },
|
|
1859
|
-
React.createElement(TaskIcon, { taskIndex: taskIndex, taskStatus: taskStatus }),
|
|
1860
1884
|
React.createElement("span", { dangerouslySetInnerHTML: { __html: removeParagraphWrap(markdownConvert(title)) } }),
|
|
1861
|
-
isActiveTask && subtitle && (React.createElement(
|
|
1885
|
+
isActiveTask && subtitle && (React.createElement("span", { className: "pfext-quick-start-task-header__subtitle", "data-test-id": "quick-start-task-subtitle" },
|
|
1862
1886
|
' ',
|
|
1863
|
-
|
|
1864
|
-
|
|
1887
|
+
subtitle))),
|
|
1888
|
+
tryAgain));
|
|
1889
|
+
return (React.createElement(WizardNavItem, { content: content, step: taskIndex, onNavItemClick: () => onTaskSelect(taskIndex - 1), navItemComponent: "button", isCurrent: isActiveTask }));
|
|
1865
1890
|
};
|
|
1866
1891
|
|
|
1867
1892
|
const QuickStartTaskHeaderList = ({ tasks, allTaskStatuses, onTaskSelect, }) => {
|
|
@@ -1888,10 +1913,18 @@ const QuickStartConclusion = ({ tasks, conclusion, allTaskStatuses, nextQuickSta
|
|
|
1888
1913
|
})));
|
|
1889
1914
|
};
|
|
1890
1915
|
|
|
1891
|
-
const QuickStartIntroduction = ({ tasks, introduction, allTaskStatuses, onTaskSelect, }) => {
|
|
1916
|
+
const QuickStartIntroduction = ({ tasks, introduction, allTaskStatuses, prerequisites, onTaskSelect, }) => {
|
|
1892
1917
|
const { getResource } = React.useContext(QuickStartContext);
|
|
1918
|
+
const prereqs = prerequisites === null || prerequisites === void 0 ? void 0 : prerequisites.filter((p) => p);
|
|
1919
|
+
const [isPrereqsExpanded, setIsPrereqsExpanded] = React.useState(false);
|
|
1920
|
+
const prereqList = (prereqs === null || prereqs === void 0 ? void 0 : prereqs.length) > 0 && (React.createElement(ExpandableSection, { toggleText: getResource('View Prerequisites ({{totalPrereqs}})').replace('{{totalPrereqs}}', prereqs.length), onToggle: () => setIsPrereqsExpanded(!isPrereqsExpanded), className: "pfext-quick-start-intro__prereq" },
|
|
1921
|
+
React.createElement(List, { className: "pfext-quick-start-intro__prereq-list" }, prereqs.map((pr) => {
|
|
1922
|
+
return (React.createElement(ListItem, { key: pr, className: "pfext-quick-start-intro__prereq-list__item" },
|
|
1923
|
+
React.createElement("span", { className: "pfext-quick-start-intro__prereq-list__item-content" }, pr)));
|
|
1924
|
+
}))));
|
|
1893
1925
|
return (React.createElement(React.Fragment, null,
|
|
1894
1926
|
React.createElement(QuickStartMarkdownView, { content: introduction }),
|
|
1927
|
+
prereqList,
|
|
1895
1928
|
React.createElement("p", { style: { marginBottom: 'var(--pf-global--spacer--md)' } },
|
|
1896
1929
|
getResource('In this quick start, you will complete {{count, number}} task', tasks.length).replace('{{count, number}}', tasks.length),
|
|
1897
1930
|
":"),
|
|
@@ -1916,7 +1949,7 @@ const QuickStartTaskReview = ({ review, taskStatus, onTaskReview, }) => {
|
|
|
1916
1949
|
'pfext-quick-start-task-review--failed': taskStatus === QuickStartTaskStatus.FAILED,
|
|
1917
1950
|
});
|
|
1918
1951
|
const title = React.createElement("span", { className: alertClassNames }, getResource('Check your work'));
|
|
1919
|
-
return (React.createElement(Alert, { variant: getAlertVariant(taskStatus), title: title, isInline: true },
|
|
1952
|
+
return (React.createElement(Alert, { className: "pfext-quick-start-task-review-alert", variant: getAlertVariant(taskStatus), title: title, isInline: true },
|
|
1920
1953
|
React.createElement(QuickStartMarkdownView, { content: instructions }),
|
|
1921
1954
|
React.createElement("span", { className: "pfext-quick-start-task-review__actions" },
|
|
1922
1955
|
React.createElement(Radio, { id: "review-success", name: "review-success", "data-testid": "qs-drawer-check-yes", label: getResource('Yes'), className: "pfext-quick-start-task-review__radio", isChecked: taskStatus === QuickStartTaskStatus.SUCCESS, onChange: () => onTaskReview(QuickStartTaskStatus.SUCCESS) }),
|
|
@@ -1925,28 +1958,30 @@ const QuickStartTaskReview = ({ review, taskStatus, onTaskReview, }) => {
|
|
|
1925
1958
|
};
|
|
1926
1959
|
|
|
1927
1960
|
const QuickStartTasks = ({ tasks, taskNumber, allTaskStatuses, onTaskReview, onTaskSelect, }) => {
|
|
1928
|
-
const { getResource } = React.useContext(QuickStartContext);
|
|
1961
|
+
const { getResource, alwaysShowTaskReview } = React.useContext(QuickStartContext);
|
|
1929
1962
|
return (React.createElement("div", { className: "pfext-quick-start-tasks__list" }, tasks
|
|
1930
1963
|
.filter((_, index) => allTaskStatuses[index] !== QuickStartTaskStatus.INIT)
|
|
1931
1964
|
.map((task, index) => {
|
|
1932
1965
|
const { title, description, review } = task;
|
|
1933
1966
|
const isActiveTask = index === taskNumber;
|
|
1934
1967
|
const taskStatus = allTaskStatuses[index];
|
|
1968
|
+
const shouldShowTaskReview = (!QUICKSTART_TASKS_INITIAL_STATES.includes(taskStatus) || alwaysShowTaskReview) &&
|
|
1969
|
+
review;
|
|
1935
1970
|
return (React.createElement(React.Fragment, { key: title },
|
|
1936
1971
|
React.createElement(QuickStartTaskHeader, { taskIndex: index + 1, title: title, size: "md", subtitle: getResource('{{index, number}} of {{tasks, number}}')
|
|
1937
1972
|
.replace('{{index, number}}', index + 1)
|
|
1938
1973
|
.replace('{{tasks, number}}', tasks.length), taskStatus: taskStatus, isActiveTask: isActiveTask, onTaskSelect: onTaskSelect }),
|
|
1939
|
-
isActiveTask && (React.createElement("div", {
|
|
1974
|
+
isActiveTask && (React.createElement("div", { className: "pfext-quick-start-task__content" },
|
|
1940
1975
|
React.createElement(QuickStartMarkdownView, { content: description }),
|
|
1941
|
-
|
|
1976
|
+
shouldShowTaskReview && (React.createElement(QuickStartTaskReview, { review: review, taskStatus: taskStatus, onTaskReview: onTaskReview }))))));
|
|
1942
1977
|
})));
|
|
1943
1978
|
};
|
|
1944
1979
|
|
|
1945
1980
|
const QuickStartContent = React.forwardRef(({ quickStart, nextQuickStarts = [], taskNumber, allTaskStatuses, onTaskSelect, onTaskReview, onQuickStartChange, }, ref) => {
|
|
1946
|
-
const { spec: { introduction, tasks, conclusion }, } = quickStart;
|
|
1981
|
+
const { spec: { introduction, tasks, conclusion, prerequisites }, } = quickStart;
|
|
1947
1982
|
const totalTasks = tasks.length;
|
|
1948
1983
|
return (React.createElement("div", { className: "pfext-quick-start-content", ref: ref },
|
|
1949
|
-
taskNumber === -1 && (React.createElement(QuickStartIntroduction, { tasks: tasks, allTaskStatuses: allTaskStatuses, introduction: introduction, onTaskSelect: onTaskSelect })),
|
|
1984
|
+
taskNumber === -1 && (React.createElement(QuickStartIntroduction, { tasks: tasks, allTaskStatuses: allTaskStatuses, introduction: introduction, prerequisites: prerequisites, onTaskSelect: onTaskSelect })),
|
|
1950
1985
|
taskNumber > -1 && taskNumber < totalTasks && (React.createElement(QuickStartTasks, { tasks: tasks, taskNumber: taskNumber, allTaskStatuses: allTaskStatuses, onTaskReview: onTaskReview, onTaskSelect: onTaskSelect })),
|
|
1951
1986
|
taskNumber === totalTasks && (React.createElement(QuickStartConclusion, { tasks: tasks, conclusion: conclusion, allTaskStatuses: allTaskStatuses, nextQuickStarts: nextQuickStarts, onQuickStartChange: onQuickStartChange, onTaskSelect: onTaskSelect }))));
|
|
1952
1987
|
});
|
|
@@ -1986,8 +2021,7 @@ const QuickStartFooter = ({ status, taskNumber, totalTasks, onNext, onBack, foot
|
|
|
1986
2021
|
}, [taskNumber, totalTasks, PrimaryButtonText, status]);
|
|
1987
2022
|
const getPrimaryButton = React.useMemo(() => (React.createElement(Button, { variant: "primary", className: "pfext-quick-start-footer__actionbtn", onClick: onNext, "data-testid": `qs-drawer-${camelize(getPrimaryButtonText)}`, "data-test": `${getPrimaryButtonText} button` }, getPrimaryButtonText)), [getPrimaryButtonText, onNext]);
|
|
1988
2023
|
const getSecondaryButton = React.useMemo(() => taskNumber === -1 && status !== QuickStartStatus.NOT_STARTED ? (React.createElement(Button, { variant: "secondary", onClick: onRestart, "data-testid": "qs-drawer-restart" }, SecondaryButtonText.RESTART)) : (taskNumber > -1 && (React.createElement(Button, { variant: "secondary", onClick: onBack, "data-testid": "qs-drawer-back" }, SecondaryButtonText.BACK))), [onRestart, onBack, SecondaryButtonText, status, taskNumber]);
|
|
1989
|
-
const getSideNoteAction = React.useMemo(() =>
|
|
1990
|
-
taskNumber === totalTasks && (React.createElement(Button, { variant: "link", className: "pfext-quick-start-footer__restartbtn", onClick: onRestart, "data-testid": "qs-drawer-side-note-action" }, SecondaryButtonText.RESTART)), [status, SecondaryButtonText, onRestart, taskNumber, totalTasks]);
|
|
2024
|
+
const getSideNoteAction = React.useMemo(() => taskNumber !== -1 && (React.createElement(Button, { variant: "link", className: "pfext-quick-start-footer__restartbtn", onClick: onRestart, "data-testid": "qs-drawer-side-note-action" }, SecondaryButtonText.RESTART)), [taskNumber, onRestart, SecondaryButtonText.RESTART]);
|
|
1991
2025
|
return (React.createElement("div", { className: `pfext-quick-start-footer ${footerClass}` },
|
|
1992
2026
|
getPrimaryButton,
|
|
1993
2027
|
getSecondaryButton,
|
|
@@ -2041,17 +2075,26 @@ const getElement = (appendTo) => {
|
|
|
2041
2075
|
}
|
|
2042
2076
|
return appendTo;
|
|
2043
2077
|
};
|
|
2078
|
+
const useScrollTopOnTaskNumberChange = (node, taskNumber) => {
|
|
2079
|
+
React.useEffect(() => {
|
|
2080
|
+
if (node) {
|
|
2081
|
+
node.scrollTo({ top: 0, behavior: 'smooth' });
|
|
2082
|
+
}
|
|
2083
|
+
}, [taskNumber, node]);
|
|
2084
|
+
};
|
|
2044
2085
|
const QuickStartPanelContent = (_a) => {
|
|
2045
|
-
var { quickStarts = [], handleClose, activeQuickStartID, appendTo, isResizable = true, showClose = true } = _a, props = __rest(_a, ["quickStarts", "handleClose", "activeQuickStartID", "appendTo", "isResizable", "showClose"]);
|
|
2086
|
+
var { quickStarts = [], handleClose, activeQuickStartID, appendTo, isResizable = true, showClose = true, headerVariant = '' } = _a, props = __rest(_a, ["quickStarts", "handleClose", "activeQuickStartID", "appendTo", "isResizable", "showClose", "headerVariant"]);
|
|
2046
2087
|
const { getResource } = React.useContext(QuickStartContext);
|
|
2047
2088
|
const [contentRef, setContentRef] = React.useState();
|
|
2048
2089
|
const shadows = useScrollShadows(contentRef);
|
|
2049
2090
|
const quickStart = quickStarts.find((qs) => qs.metadata.name === activeQuickStartID);
|
|
2050
2091
|
const { activeQuickStartState } = React.useContext(QuickStartContext);
|
|
2051
2092
|
const taskNumber = activeQuickStartState === null || activeQuickStartState === void 0 ? void 0 : activeQuickStartState.taskNumber;
|
|
2093
|
+
useScrollTopOnTaskNumberChange(contentRef, taskNumber);
|
|
2052
2094
|
const nextQuickStarts = quickStarts.filter((qs) => { var _a; return (_a = quickStart === null || quickStart === void 0 ? void 0 : quickStart.spec.nextQuickStart) === null || _a === void 0 ? void 0 : _a.includes(qs.metadata.name); });
|
|
2053
2095
|
const headerClasses = css('pfext-quick-start-panel-content__header', {
|
|
2054
2096
|
'pfext-quick-start-panel-content__header__shadow': shadows === Shadows.top || shadows === Shadows.both,
|
|
2097
|
+
'pfext-quick-start-panel-content__header--blue-white': headerVariant === 'blue-white',
|
|
2055
2098
|
});
|
|
2056
2099
|
const footerClass = css({
|
|
2057
2100
|
'pfext-quick-start-panel-content__footer__shadow': shadows === Shadows.bottom || shadows === Shadows.both,
|
|
@@ -2066,16 +2109,16 @@ const QuickStartPanelContent = (_a) => {
|
|
|
2066
2109
|
}
|
|
2067
2110
|
return Number.parseInt(taskNumber, 10) + 1;
|
|
2068
2111
|
};
|
|
2069
|
-
const content = quickStart ? (React.createElement(DrawerPanelContent, Object.assign({ isResizable: isResizable, className: "pfext-quick-
|
|
2112
|
+
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),
|
|
2070
2113
|
React.createElement("div", { className: headerClasses },
|
|
2071
2114
|
React.createElement(DrawerHead, null,
|
|
2072
2115
|
React.createElement("div", { className: "pfext-quick-start-panel-content__title" },
|
|
2073
|
-
React.createElement(Title, { headingLevel: "h1", size: "xl", style: { marginRight: 'var(--pf-global--spacer--md)' } }, quickStart === null || quickStart === void 0 ? void 0 :
|
|
2116
|
+
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 :
|
|
2074
2117
|
quickStart.spec.displayName,
|
|
2075
2118
|
' ',
|
|
2076
|
-
React.createElement("small", { className: "pfext-quick-start-panel-content__duration
|
|
2119
|
+
React.createElement("small", { className: "pfext-quick-start-panel-content__duration" }, getResource('Quick start • {{duration, number}} minutes', quickStart === null || quickStart === void 0 ? void 0 : quickStart.spec.durationMinutes).replace('{{duration, number}}', quickStart === null || quickStart === void 0 ? void 0 : quickStart.spec.durationMinutes)))),
|
|
2077
2120
|
showClose && (React.createElement(DrawerActions, null,
|
|
2078
|
-
React.createElement(DrawerCloseButton, { onClick: handleClose, "data-testid": "qs-drawer-close" }))))),
|
|
2121
|
+
React.createElement(DrawerCloseButton, { onClick: handleClose, className: "pfext-quick-start-panel-content__close-button", "data-testid": "qs-drawer-close" }))))),
|
|
2079
2122
|
React.createElement(DrawerPanelBody, { hasNoPadding: true, className: "pfext-quick-start-panel-content__body", "data-test": "content" },
|
|
2080
2123
|
React.createElement(QuickStartController, { quickStart: quickStart, nextQuickStarts: nextQuickStarts, footerClass: footerClass, contentRef: setContentRef })))) : null;
|
|
2081
2124
|
if (appendTo) {
|
|
@@ -2085,15 +2128,17 @@ const QuickStartPanelContent = (_a) => {
|
|
|
2085
2128
|
};
|
|
2086
2129
|
|
|
2087
2130
|
const QuickStartContainer = (_a) => {
|
|
2088
|
-
var { quickStarts, children, activeQuickStartID, allQuickStartStates, setActiveQuickStartID, setAllQuickStartStates, appendTo, fullWidth, onCloseInProgress, onCloseNotInProgress, resourceBundle, showCardFooters, language, loading = false, useQueryParams = true, markdown, contextProps } = _a, props = __rest(_a, ["quickStarts", "children", "activeQuickStartID", "allQuickStartStates", "setActiveQuickStartID", "setAllQuickStartStates", "appendTo", "fullWidth", "onCloseInProgress", "onCloseNotInProgress", "resourceBundle", "showCardFooters", "language", "loading", "useQueryParams", "markdown", "contextProps"]);
|
|
2131
|
+
var { quickStarts, children, activeQuickStartID, allQuickStartStates, setActiveQuickStartID, setAllQuickStartStates, appendTo, fullWidth, onCloseInProgress, onCloseNotInProgress, resourceBundle, showCardFooters, useLegacyHeaderColors, language, loading = false, useQueryParams = true, markdown, contextProps, alwaysShowTaskReview = false } = _a, props = __rest(_a, ["quickStarts", "children", "activeQuickStartID", "allQuickStartStates", "setActiveQuickStartID", "setAllQuickStartStates", "appendTo", "fullWidth", "onCloseInProgress", "onCloseNotInProgress", "resourceBundle", "showCardFooters", "useLegacyHeaderColors", "language", "loading", "useQueryParams", "markdown", "contextProps", "alwaysShowTaskReview"]);
|
|
2089
2132
|
const valuesForQuickstartContext = useValuesForQuickStartContext(Object.assign({ allQuickStarts: quickStarts, activeQuickStartID,
|
|
2090
2133
|
setActiveQuickStartID,
|
|
2091
2134
|
allQuickStartStates,
|
|
2092
2135
|
setAllQuickStartStates, footer: {
|
|
2093
2136
|
show: showCardFooters,
|
|
2094
|
-
},
|
|
2137
|
+
}, useLegacyHeaderColors,
|
|
2138
|
+
language, resourceBundle: Object.assign({}, resourceBundle), loading,
|
|
2095
2139
|
useQueryParams,
|
|
2096
|
-
markdown
|
|
2140
|
+
markdown,
|
|
2141
|
+
alwaysShowTaskReview }, contextProps));
|
|
2097
2142
|
React.useEffect(() => {
|
|
2098
2143
|
if (quickStarts &&
|
|
2099
2144
|
JSON.stringify(quickStarts) !== JSON.stringify(valuesForQuickstartContext.allQuickStarts)) {
|
|
@@ -2114,7 +2159,7 @@ const QuickStartContainer = (_a) => {
|
|
|
2114
2159
|
};
|
|
2115
2160
|
const QuickStartDrawer = (_a) => {
|
|
2116
2161
|
var { quickStarts = [], children, appendTo, fullWidth, onCloseInProgress, onCloseNotInProgress } = _a, props = __rest(_a, ["quickStarts", "children", "appendTo", "fullWidth", "onCloseInProgress", "onCloseNotInProgress"]);
|
|
2117
|
-
const { activeQuickStartID, setActiveQuickStart, allQuickStarts = [], activeQuickStartState, allQuickStartStates, setAllQuickStartStates, } = React.useContext(QuickStartContext);
|
|
2162
|
+
const { activeQuickStartID, setActiveQuickStart, allQuickStarts = [], activeQuickStartState, allQuickStartStates, setAllQuickStartStates, useLegacyHeaderColors, } = React.useContext(QuickStartContext);
|
|
2118
2163
|
const combinedQuickStarts = allQuickStarts.concat(quickStarts);
|
|
2119
2164
|
React.useEffect(() => {
|
|
2120
2165
|
const params = new URLSearchParams(window.location.search);
|
|
@@ -2173,7 +2218,7 @@ const QuickStartDrawer = (_a) => {
|
|
|
2173
2218
|
},
|
|
2174
2219
|
}
|
|
2175
2220
|
: {};
|
|
2176
|
-
const panelContent = (React.createElement(QuickStartPanelContent, Object.assign({ quickStarts: combinedQuickStarts, handleClose: handleClose, activeQuickStartID: activeQuickStartID, appendTo: appendTo, isResizable: !fullWidth }, fullWidthPanelStyle)));
|
|
2221
|
+
const panelContent = (React.createElement(QuickStartPanelContent, Object.assign({ quickStarts: combinedQuickStarts, handleClose: handleClose, activeQuickStartID: activeQuickStartID, appendTo: appendTo, isResizable: !fullWidth, headerVariant: useLegacyHeaderColors ? '' : 'blue-white' }, fullWidthPanelStyle)));
|
|
2177
2222
|
return (React.createElement(React.Fragment, null,
|
|
2178
2223
|
React.createElement(Drawer, Object.assign({ isExpanded: !!activeQuickStartID, isInline: true }, props), children ? (React.createElement(DrawerContent, Object.assign({ panelContent: panelContent }, fullWidthBodyStyle),
|
|
2179
2224
|
React.createElement(DrawerContentBody, { className: "pfext-quick-start-drawer__body" }, children))) : (React.createElement("div", { className: "pf-c-drawer__main" }, panelContent))),
|