@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
package/dist/index.js
CHANGED
|
@@ -21,6 +21,7 @@ require('@patternfly/react-icons/dist/js/icons/exclamation-circle-icon');
|
|
|
21
21
|
var InfoCircleIcon = require('@patternfly/react-icons/dist/js/icons/info-circle-icon');
|
|
22
22
|
var ExternalLinkAltIcon = require('@patternfly/react-icons/dist/js/icons/external-link-alt-icon');
|
|
23
23
|
var OutlinedClockIcon = require('@patternfly/react-icons/dist/js/icons/outlined-clock-icon');
|
|
24
|
+
var OutlinedBookmarkIcon = require('@patternfly/react-icons/dist/js/icons/outlined-bookmark-icon');
|
|
24
25
|
var ArrowRightIcon = require('@patternfly/react-icons/dist/js/icons/arrow-right-icon');
|
|
25
26
|
var BarsIcon = require('@patternfly/react-icons/dist/js/icons/bars-icon');
|
|
26
27
|
|
|
@@ -59,6 +60,7 @@ var CheckCircleIcon__default = /*#__PURE__*/_interopDefaultLegacy(CheckCircleIco
|
|
|
59
60
|
var InfoCircleIcon__default = /*#__PURE__*/_interopDefaultLegacy(InfoCircleIcon);
|
|
60
61
|
var ExternalLinkAltIcon__default = /*#__PURE__*/_interopDefaultLegacy(ExternalLinkAltIcon);
|
|
61
62
|
var OutlinedClockIcon__default = /*#__PURE__*/_interopDefaultLegacy(OutlinedClockIcon);
|
|
63
|
+
var OutlinedBookmarkIcon__default = /*#__PURE__*/_interopDefaultLegacy(OutlinedBookmarkIcon);
|
|
62
64
|
var ArrowRightIcon__default = /*#__PURE__*/_interopDefaultLegacy(ArrowRightIcon);
|
|
63
65
|
var BarsIcon__default = /*#__PURE__*/_interopDefaultLegacy(BarsIcon);
|
|
64
66
|
|
|
@@ -617,6 +619,7 @@ const QuickStartContextDefaults = {
|
|
|
617
619
|
markdown: null,
|
|
618
620
|
loading: false,
|
|
619
621
|
alwaysShowTaskReview: true,
|
|
622
|
+
focusOnQuickStart: true,
|
|
620
623
|
};
|
|
621
624
|
const QuickStartContext = React.createContext(QuickStartContextDefaults);
|
|
622
625
|
const getResource = (resource, options, resourceBundle, lng) => {
|
|
@@ -1703,23 +1706,26 @@ const statusColorMap = {
|
|
|
1703
1706
|
[exports.QuickStartStatus.IN_PROGRESS]: 'purple',
|
|
1704
1707
|
[exports.QuickStartStatus.NOT_STARTED]: 'grey',
|
|
1705
1708
|
};
|
|
1706
|
-
const QuickStartTileHeader = ({ status, duration, name, type, quickStartId, }) => {
|
|
1709
|
+
const QuickStartTileHeader = ({ status, duration, name, type, quickStartId, action, }) => {
|
|
1707
1710
|
const { getResource } = React__namespace.useContext(QuickStartContext);
|
|
1708
1711
|
const statusLocaleMap = {
|
|
1709
1712
|
[exports.QuickStartStatus.COMPLETE]: getResource('Complete'),
|
|
1710
1713
|
[exports.QuickStartStatus.IN_PROGRESS]: getResource('In progress'),
|
|
1711
1714
|
[exports.QuickStartStatus.NOT_STARTED]: getResource('Not started'),
|
|
1712
1715
|
};
|
|
1716
|
+
const ActionIcon = (action === null || action === void 0 ? void 0 : action.icon) || OutlinedBookmarkIcon__default['default'];
|
|
1713
1717
|
return (React__namespace.createElement("div", { className: "pfext-quick-start-tile-header" },
|
|
1714
|
-
React__namespace.createElement(reactCore.
|
|
1715
|
-
React__namespace.createElement(
|
|
1718
|
+
React__namespace.createElement(reactCore.Flex, { flexWrap: { default: 'nowrap' } },
|
|
1719
|
+
React__namespace.createElement(reactCore.Title, { headingLevel: "h3", "data-test": "title", id: quickStartId },
|
|
1720
|
+
React__namespace.createElement(QuickStartMarkdownView, { content: name })),
|
|
1721
|
+
action && (React__namespace.createElement(reactCore.Button, Object.assign({ "aria-label": action['aria-label'], icon: React__namespace.createElement(ActionIcon, null), variant: "plain", onClick: action.onClick }, action.buttonProps)))),
|
|
1716
1722
|
React__namespace.createElement("div", { className: "pfext-quick-start-tile-header__status" },
|
|
1717
1723
|
type && (React__namespace.createElement(reactCore.Label, { className: "pfext-quick-start-tile-header--margin", color: type.color }, type.text)),
|
|
1718
1724
|
duration && (React__namespace.createElement(reactCore.Label, { variant: "outline", "data-test": "duration", icon: React__namespace.createElement(OutlinedClockIcon__default['default'], null), className: "pfext-quick-start-tile-header--margin" }, getResource('{{duration, number}} minutes', duration).replace('{{duration, number}}', duration))),
|
|
1719
1725
|
status !== exports.QuickStartStatus.NOT_STARTED && (React__namespace.createElement(reactCore.Label, { variant: "outline", color: statusColorMap[status], icon: React__namespace.createElement(StatusIcon, { status: status }), "data-test": "status" }, statusLocaleMap[status])))));
|
|
1720
1726
|
};
|
|
1721
1727
|
|
|
1722
|
-
const QuickStartTile = ({ quickStart, status, isActive, onClick = () => { }, }) => {
|
|
1728
|
+
const QuickStartTile = ({ quickStart, status, isActive, onClick = () => { }, action, }) => {
|
|
1723
1729
|
const { metadata: { name: id }, spec: { icon, tasks, displayName, description, durationMinutes, prerequisites, link, type }, } = quickStart;
|
|
1724
1730
|
const { setActiveQuickStart, footer } = React__namespace.useContext(QuickStartContext);
|
|
1725
1731
|
const ref = React__namespace.useRef(null);
|
|
@@ -1743,26 +1749,31 @@ const QuickStartTile = ({ quickStart, status, isActive, onClick = () => { }, })
|
|
|
1743
1749
|
const handleClick = (e) => {
|
|
1744
1750
|
var _a;
|
|
1745
1751
|
if ((_a = ref.current) === null || _a === void 0 ? void 0 : _a.contains(e.target)) {
|
|
1746
|
-
if (link) {
|
|
1747
|
-
window.open(link.href);
|
|
1748
|
-
}
|
|
1749
|
-
else {
|
|
1752
|
+
if (!link) {
|
|
1750
1753
|
setActiveQuickStart(id, tasks === null || tasks === void 0 ? void 0 : tasks.length);
|
|
1751
1754
|
}
|
|
1752
1755
|
onClick();
|
|
1753
1756
|
}
|
|
1754
1757
|
};
|
|
1755
|
-
|
|
1756
|
-
|
|
1758
|
+
const linkProps = link
|
|
1759
|
+
? {
|
|
1760
|
+
href: link.href,
|
|
1761
|
+
target: '_blank',
|
|
1762
|
+
rel: 'noreferrer',
|
|
1763
|
+
}
|
|
1764
|
+
: {};
|
|
1765
|
+
return (React__namespace.createElement("div", { ref: ref, onClick: handleClick },
|
|
1766
|
+
React__namespace.createElement(CatalogTile, Object.assign({ id: id + '-catalog-tile', style: {
|
|
1757
1767
|
cursor: 'pointer',
|
|
1758
|
-
}, icon: quickStartIcon, className: "pfext-quick-start-tile", "data-testid": `qs-card-${camelize(displayName)}`, featured: isActive, title: React__namespace.createElement(QuickStartTileHeader, { name: displayName, status: status, duration: durationMinutes, type: type, quickStartId: id
|
|
1768
|
+
}, icon: quickStartIcon, className: "pfext-quick-start-tile", "data-testid": `qs-card-${camelize(displayName)}`, featured: isActive, title: React__namespace.createElement(QuickStartTileHeader, { name: displayName, status: status, duration: durationMinutes, type: type, quickStartId: id, action: action }), onKeyDown: (event) => {
|
|
1759
1769
|
if (event.key === 'Enter' || event.key === ' ') {
|
|
1760
1770
|
setActiveQuickStart(id, tasks === null || tasks === void 0 ? void 0 : tasks.length);
|
|
1761
1771
|
onClick();
|
|
1762
1772
|
}
|
|
1763
|
-
},
|
|
1764
|
-
//
|
|
1765
|
-
|
|
1773
|
+
} }, linkProps, { "data-test": `tile ${id}`, description: React__namespace.createElement(QuickStartTileDescription, { description: description, prerequisites: prerequisites }), footer: footerComponent, tabIndex: 0,
|
|
1774
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
1775
|
+
// @ts-ignore-next-line
|
|
1776
|
+
isSelectableRaised: true }))));
|
|
1766
1777
|
};
|
|
1767
1778
|
|
|
1768
1779
|
const QuickStartCatalog = ({ quickStarts }) => {
|
|
@@ -1989,12 +2000,13 @@ const QuickStartCloseModal = ({ isOpen, onConfirm, onCancel, }) => {
|
|
|
1989
2000
|
|
|
1990
2001
|
const QuickStartTaskHeader = ({ title, taskIndex, subtitle, taskStatus, size, isActiveTask, onTaskSelect, children, }) => {
|
|
1991
2002
|
const titleRef = React__namespace.useRef(null);
|
|
2003
|
+
const { focusOnQuickStart } = React__namespace.useContext(QuickStartContext);
|
|
1992
2004
|
React__namespace.useEffect(() => {
|
|
1993
|
-
if (isActiveTask) {
|
|
2005
|
+
if (focusOnQuickStart && isActiveTask) {
|
|
1994
2006
|
// Focus the WizardNavItem button element that contains the title
|
|
1995
2007
|
titleRef.current.parentNode.focus();
|
|
1996
2008
|
}
|
|
1997
|
-
}, [isActiveTask]);
|
|
2009
|
+
}, [focusOnQuickStart, isActiveTask]);
|
|
1998
2010
|
reactStyles.css('pfext-quick-start-task-header__title', {
|
|
1999
2011
|
'pfext-quick-start-task-header__title-success': taskStatus === exports.QuickStartTaskStatus.SUCCESS,
|
|
2000
2012
|
'pfext-quick-start-task-header__title-failed': taskStatus === (exports.QuickStartTaskStatus.FAILED || exports.QuickStartTaskStatus.VISITED),
|
|
@@ -2161,7 +2173,7 @@ const QuickStartController = ({ quickStart, nextQuickStarts, contentRef, footerC
|
|
|
2161
2173
|
const getQuickStartActiveTask = React__namespace.useCallback(() => {
|
|
2162
2174
|
let activeTaskNumber = 0;
|
|
2163
2175
|
while (activeTaskNumber !== totalTasks &&
|
|
2164
|
-
activeQuickStartState[`taskStatus${activeTaskNumber}`]
|
|
2176
|
+
activeQuickStartState[`taskStatus${activeTaskNumber}`] === exports.QuickStartTaskStatus.SUCCESS) {
|
|
2165
2177
|
activeTaskNumber++;
|
|
2166
2178
|
}
|
|
2167
2179
|
return activeTaskNumber;
|
|
@@ -2204,7 +2216,7 @@ const useScrollTopOnTaskNumberChange = (node, taskNumber) => {
|
|
|
2204
2216
|
const QuickStartPanelContent = (_a) => {
|
|
2205
2217
|
var { quickStarts = [], handleClose, activeQuickStartID, appendTo, isResizable = true, showClose = true, headerVariant = '' } = _a, props = tslib.__rest(_a, ["quickStarts", "handleClose", "activeQuickStartID", "appendTo", "isResizable", "showClose", "headerVariant"]);
|
|
2206
2218
|
const titleRef = React__namespace.useRef(null);
|
|
2207
|
-
const { getResource, activeQuickStartState } = React__namespace.useContext(QuickStartContext);
|
|
2219
|
+
const { getResource, activeQuickStartState, focusOnQuickStart } = React__namespace.useContext(QuickStartContext);
|
|
2208
2220
|
const [contentRef, setContentRef] = React__namespace.useState();
|
|
2209
2221
|
const shadows = useScrollShadows(contentRef);
|
|
2210
2222
|
const quickStart = quickStarts.find((qs) => qs.metadata.name === activeQuickStartID);
|
|
@@ -2229,10 +2241,10 @@ const QuickStartPanelContent = (_a) => {
|
|
|
2229
2241
|
return Number.parseInt(taskNumber) + 1;
|
|
2230
2242
|
};
|
|
2231
2243
|
React__namespace.useEffect(() => {
|
|
2232
|
-
if (quickStart) {
|
|
2244
|
+
if (focusOnQuickStart && quickStart) {
|
|
2233
2245
|
titleRef.current.focus();
|
|
2234
2246
|
}
|
|
2235
|
-
}, [quickStart]);
|
|
2247
|
+
}, [focusOnQuickStart, quickStart]);
|
|
2236
2248
|
const content = quickStart ? (React__namespace.createElement(reactCore.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),
|
|
2237
2249
|
React__namespace.createElement("div", { className: headerClasses },
|
|
2238
2250
|
React__namespace.createElement(reactCore.DrawerHead, null,
|