@patternfly/quickstarts 6.0.0-alpha.1 → 6.0.0-alpha.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/catalog/QuickStartTile.d.ts +3 -0
- package/dist/catalog/QuickStartTileHeader.d.ts +12 -0
- package/dist/catalog/index.d.ts +1 -1
- package/dist/index.es.js +31 -20
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +32 -20
- package/dist/index.js.map +1 -1
- package/dist/quickstarts-base.css +63 -60
- package/dist/quickstarts-full.es.js +737 -78
- package/dist/quickstarts-full.es.js.map +1 -1
- package/dist/quickstarts-standalone.css +6 -0
- package/dist/quickstarts-standalone.min.css +1 -1
- package/dist/quickstarts.css +63 -60
- package/dist/quickstarts.min.css +1 -1
- package/dist/utils/quick-start-context.d.ts +2 -0
- package/package.json +4 -5
- package/src/QuickStartController.tsx +1 -1
- package/src/QuickStartPanelContent.tsx +3 -3
- package/src/catalog/QuickStartTile.tsx +19 -7
- package/src/catalog/QuickStartTileHeader.scss +4 -0
- package/src/catalog/QuickStartTileHeader.tsx +31 -4
- package/src/catalog/index.ts +1 -1
- package/src/controller/QuickStartTaskHeader.tsx +4 -2
- package/src/utils/quick-start-context.tsx +2 -0
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { QuickStart, QuickStartStatus } from '../utils/quick-start-types';
|
|
3
|
+
import { QuickstartAction } from './QuickStartTileHeader';
|
|
3
4
|
import './QuickStartTile.scss';
|
|
4
5
|
interface QuickStartTileProps {
|
|
5
6
|
quickStart: QuickStart;
|
|
6
7
|
status: QuickStartStatus;
|
|
7
8
|
isActive: boolean;
|
|
8
9
|
onClick?: () => void;
|
|
10
|
+
/** Action config for button rendered next to title */
|
|
11
|
+
action?: QuickstartAction;
|
|
9
12
|
}
|
|
10
13
|
declare const QuickStartTile: React.FC<QuickStartTileProps>;
|
|
11
14
|
export default QuickStartTile;
|
|
@@ -1,12 +1,24 @@
|
|
|
1
1
|
import './QuickStartTileHeader.scss';
|
|
2
2
|
import * as React from 'react';
|
|
3
|
+
import { ButtonProps } from '@patternfly/react-core';
|
|
3
4
|
import { QuickStartType } from '../utils/quick-start-types';
|
|
5
|
+
export interface QuickstartAction {
|
|
6
|
+
/** Screen reader aria label. */
|
|
7
|
+
'aria-label': string;
|
|
8
|
+
/** Icon to be rendered as a plain button, by default Bookmark outlined will be used. */
|
|
9
|
+
icon?: React.ComponentType<unknown>;
|
|
10
|
+
/** Callback with synthetic event parameter. */
|
|
11
|
+
onClick?: (e: React.SyntheticEvent) => void;
|
|
12
|
+
/** Additional button props to be rendered as extra props. */
|
|
13
|
+
buttonProps?: ButtonProps;
|
|
14
|
+
}
|
|
4
15
|
interface QuickStartTileHeaderProps {
|
|
5
16
|
status: string;
|
|
6
17
|
duration: number;
|
|
7
18
|
name: string;
|
|
8
19
|
type?: QuickStartType;
|
|
9
20
|
quickStartId?: string;
|
|
21
|
+
action?: QuickstartAction;
|
|
10
22
|
}
|
|
11
23
|
declare const QuickStartTileHeader: React.FC<QuickStartTileHeaderProps>;
|
|
12
24
|
export default QuickStartTileHeader;
|
package/dist/catalog/index.d.ts
CHANGED
|
@@ -4,6 +4,6 @@ export { default as QuickStartTile } from './QuickStartTile';
|
|
|
4
4
|
export { default as QuickStartTileDescription } from './QuickStartTileDescription';
|
|
5
5
|
export { default as QuickStartTileFooter } from './QuickStartTileFooter';
|
|
6
6
|
export { default as QuickStartTileFooterExternal } from './QuickStartTileFooterExternal';
|
|
7
|
-
export { default as QuickStartTileHeader } from './QuickStartTileHeader';
|
|
7
|
+
export { default as QuickStartTileHeader, QuickstartAction } from './QuickStartTileHeader';
|
|
8
8
|
export * from './Toolbar/QuickStartCatalogFilterItems';
|
|
9
9
|
export * from './Catalog';
|
package/dist/index.es.js
CHANGED
|
@@ -18,6 +18,7 @@ import '@patternfly/react-icons/dist/js/icons/exclamation-circle-icon';
|
|
|
18
18
|
import InfoCircleIcon from '@patternfly/react-icons/dist/js/icons/info-circle-icon';
|
|
19
19
|
import ExternalLinkAltIcon from '@patternfly/react-icons/dist/js/icons/external-link-alt-icon';
|
|
20
20
|
import OutlinedClockIcon from '@patternfly/react-icons/dist/js/icons/outlined-clock-icon';
|
|
21
|
+
import OutlinedBookmarkIcon from '@patternfly/react-icons/dist/js/icons/outlined-bookmark-icon';
|
|
21
22
|
import ArrowRightIcon from '@patternfly/react-icons/dist/js/icons/arrow-right-icon';
|
|
22
23
|
import BarsIcon from '@patternfly/react-icons/dist/js/icons/bars-icon';
|
|
23
24
|
|
|
@@ -576,6 +577,7 @@ const QuickStartContextDefaults = {
|
|
|
576
577
|
markdown: null,
|
|
577
578
|
loading: false,
|
|
578
579
|
alwaysShowTaskReview: true,
|
|
580
|
+
focusOnQuickStart: true,
|
|
579
581
|
};
|
|
580
582
|
const QuickStartContext = createContext(QuickStartContextDefaults);
|
|
581
583
|
const getResource = (resource, options, resourceBundle, lng) => {
|
|
@@ -1662,23 +1664,26 @@ const statusColorMap = {
|
|
|
1662
1664
|
[QuickStartStatus.IN_PROGRESS]: 'purple',
|
|
1663
1665
|
[QuickStartStatus.NOT_STARTED]: 'grey',
|
|
1664
1666
|
};
|
|
1665
|
-
const QuickStartTileHeader = ({ status, duration, name, type, quickStartId, }) => {
|
|
1667
|
+
const QuickStartTileHeader = ({ status, duration, name, type, quickStartId, action, }) => {
|
|
1666
1668
|
const { getResource } = React.useContext(QuickStartContext);
|
|
1667
1669
|
const statusLocaleMap = {
|
|
1668
1670
|
[QuickStartStatus.COMPLETE]: getResource('Complete'),
|
|
1669
1671
|
[QuickStartStatus.IN_PROGRESS]: getResource('In progress'),
|
|
1670
1672
|
[QuickStartStatus.NOT_STARTED]: getResource('Not started'),
|
|
1671
1673
|
};
|
|
1674
|
+
const ActionIcon = (action === null || action === void 0 ? void 0 : action.icon) || OutlinedBookmarkIcon;
|
|
1672
1675
|
return (React.createElement("div", { className: "pfext-quick-start-tile-header" },
|
|
1673
|
-
React.createElement(
|
|
1674
|
-
React.createElement(
|
|
1676
|
+
React.createElement(Flex, { flexWrap: { default: 'nowrap' } },
|
|
1677
|
+
React.createElement(Title, { headingLevel: "h3", "data-test": "title", id: quickStartId },
|
|
1678
|
+
React.createElement(QuickStartMarkdownView, { content: name })),
|
|
1679
|
+
action && (React.createElement(Button, Object.assign({ "aria-label": action['aria-label'], icon: React.createElement(ActionIcon, null), variant: "plain", onClick: action.onClick }, action.buttonProps)))),
|
|
1675
1680
|
React.createElement("div", { className: "pfext-quick-start-tile-header__status" },
|
|
1676
1681
|
type && (React.createElement(Label, { className: "pfext-quick-start-tile-header--margin", color: type.color }, type.text)),
|
|
1677
1682
|
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))),
|
|
1678
1683
|
status !== QuickStartStatus.NOT_STARTED && (React.createElement(Label, { variant: "outline", color: statusColorMap[status], icon: React.createElement(StatusIcon, { status: status }), "data-test": "status" }, statusLocaleMap[status])))));
|
|
1679
1684
|
};
|
|
1680
1685
|
|
|
1681
|
-
const QuickStartTile = ({ quickStart, status, isActive, onClick = () => { }, }) => {
|
|
1686
|
+
const QuickStartTile = ({ quickStart, status, isActive, onClick = () => { }, action, }) => {
|
|
1682
1687
|
const { metadata: { name: id }, spec: { icon, tasks, displayName, description, durationMinutes, prerequisites, link, type }, } = quickStart;
|
|
1683
1688
|
const { setActiveQuickStart, footer } = React.useContext(QuickStartContext);
|
|
1684
1689
|
const ref = React.useRef(null);
|
|
@@ -1702,26 +1707,31 @@ const QuickStartTile = ({ quickStart, status, isActive, onClick = () => { }, })
|
|
|
1702
1707
|
const handleClick = (e) => {
|
|
1703
1708
|
var _a;
|
|
1704
1709
|
if ((_a = ref.current) === null || _a === void 0 ? void 0 : _a.contains(e.target)) {
|
|
1705
|
-
if (link) {
|
|
1706
|
-
window.open(link.href);
|
|
1707
|
-
}
|
|
1708
|
-
else {
|
|
1710
|
+
if (!link) {
|
|
1709
1711
|
setActiveQuickStart(id, tasks === null || tasks === void 0 ? void 0 : tasks.length);
|
|
1710
1712
|
}
|
|
1711
1713
|
onClick();
|
|
1712
1714
|
}
|
|
1713
1715
|
};
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
+
const linkProps = link
|
|
1717
|
+
? {
|
|
1718
|
+
href: link.href,
|
|
1719
|
+
target: '_blank',
|
|
1720
|
+
rel: 'noreferrer',
|
|
1721
|
+
}
|
|
1722
|
+
: {};
|
|
1723
|
+
return (React.createElement("div", { ref: ref, onClick: handleClick },
|
|
1724
|
+
React.createElement(CatalogTile, Object.assign({ id: id + '-catalog-tile', style: {
|
|
1716
1725
|
cursor: 'pointer',
|
|
1717
|
-
}, 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
|
|
1726
|
+
}, 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, action: action }), onKeyDown: (event) => {
|
|
1718
1727
|
if (event.key === 'Enter' || event.key === ' ') {
|
|
1719
1728
|
setActiveQuickStart(id, tasks === null || tasks === void 0 ? void 0 : tasks.length);
|
|
1720
1729
|
onClick();
|
|
1721
1730
|
}
|
|
1722
|
-
},
|
|
1723
|
-
//
|
|
1724
|
-
|
|
1731
|
+
} }, linkProps, { "data-test": `tile ${id}`, description: React.createElement(QuickStartTileDescription, { description: description, prerequisites: prerequisites }), footer: footerComponent, tabIndex: 0,
|
|
1732
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
1733
|
+
// @ts-ignore-next-line
|
|
1734
|
+
isSelectableRaised: true }))));
|
|
1725
1735
|
};
|
|
1726
1736
|
|
|
1727
1737
|
const QuickStartCatalog = ({ quickStarts }) => {
|
|
@@ -1948,12 +1958,13 @@ const QuickStartCloseModal = ({ isOpen, onConfirm, onCancel, }) => {
|
|
|
1948
1958
|
|
|
1949
1959
|
const QuickStartTaskHeader = ({ title, taskIndex, subtitle, taskStatus, size, isActiveTask, onTaskSelect, children, }) => {
|
|
1950
1960
|
const titleRef = React.useRef(null);
|
|
1961
|
+
const { focusOnQuickStart } = React.useContext(QuickStartContext);
|
|
1951
1962
|
React.useEffect(() => {
|
|
1952
|
-
if (isActiveTask) {
|
|
1963
|
+
if (focusOnQuickStart && isActiveTask) {
|
|
1953
1964
|
// Focus the WizardNavItem button element that contains the title
|
|
1954
1965
|
titleRef.current.parentNode.focus();
|
|
1955
1966
|
}
|
|
1956
|
-
}, [isActiveTask]);
|
|
1967
|
+
}, [focusOnQuickStart, isActiveTask]);
|
|
1957
1968
|
css('pfext-quick-start-task-header__title', {
|
|
1958
1969
|
'pfext-quick-start-task-header__title-success': taskStatus === QuickStartTaskStatus.SUCCESS,
|
|
1959
1970
|
'pfext-quick-start-task-header__title-failed': taskStatus === (QuickStartTaskStatus.FAILED || QuickStartTaskStatus.VISITED),
|
|
@@ -2120,7 +2131,7 @@ const QuickStartController = ({ quickStart, nextQuickStarts, contentRef, footerC
|
|
|
2120
2131
|
const getQuickStartActiveTask = React.useCallback(() => {
|
|
2121
2132
|
let activeTaskNumber = 0;
|
|
2122
2133
|
while (activeTaskNumber !== totalTasks &&
|
|
2123
|
-
activeQuickStartState[`taskStatus${activeTaskNumber}`]
|
|
2134
|
+
activeQuickStartState[`taskStatus${activeTaskNumber}`] === QuickStartTaskStatus.SUCCESS) {
|
|
2124
2135
|
activeTaskNumber++;
|
|
2125
2136
|
}
|
|
2126
2137
|
return activeTaskNumber;
|
|
@@ -2163,7 +2174,7 @@ const useScrollTopOnTaskNumberChange = (node, taskNumber) => {
|
|
|
2163
2174
|
const QuickStartPanelContent = (_a) => {
|
|
2164
2175
|
var { quickStarts = [], handleClose, activeQuickStartID, appendTo, isResizable = true, showClose = true, headerVariant = '' } = _a, props = __rest(_a, ["quickStarts", "handleClose", "activeQuickStartID", "appendTo", "isResizable", "showClose", "headerVariant"]);
|
|
2165
2176
|
const titleRef = React.useRef(null);
|
|
2166
|
-
const { getResource, activeQuickStartState } = React.useContext(QuickStartContext);
|
|
2177
|
+
const { getResource, activeQuickStartState, focusOnQuickStart } = React.useContext(QuickStartContext);
|
|
2167
2178
|
const [contentRef, setContentRef] = React.useState();
|
|
2168
2179
|
const shadows = useScrollShadows(contentRef);
|
|
2169
2180
|
const quickStart = quickStarts.find((qs) => qs.metadata.name === activeQuickStartID);
|
|
@@ -2188,10 +2199,10 @@ const QuickStartPanelContent = (_a) => {
|
|
|
2188
2199
|
return Number.parseInt(taskNumber) + 1;
|
|
2189
2200
|
};
|
|
2190
2201
|
React.useEffect(() => {
|
|
2191
|
-
if (quickStart) {
|
|
2202
|
+
if (focusOnQuickStart && quickStart) {
|
|
2192
2203
|
titleRef.current.focus();
|
|
2193
2204
|
}
|
|
2194
|
-
}, [quickStart]);
|
|
2205
|
+
}, [focusOnQuickStart, quickStart]);
|
|
2195
2206
|
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),
|
|
2196
2207
|
React.createElement("div", { className: headerClasses },
|
|
2197
2208
|
React.createElement(DrawerHead, null,
|