@patternfly/quickstarts 1.4.0 → 1.4.1-rc.0

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 CHANGED
@@ -110,7 +110,10 @@ const App = () => {
110
110
  allQuickStartStates,
111
111
  setActiveQuickStartID,
112
112
  setAllQuickStartStates,
113
+ // Set to true to opt-out of default hidden card footers
113
114
  showCardFooters: false,
115
+ // Set to true to opt-out of default drawer header colors of blue with white text
116
+ useLegacyHeaderColors: false,
114
117
  loading,
115
118
  useQueryParams: withQueryParams,
116
119
  };
@@ -157,6 +160,10 @@ const SomeNestedComponent = () => {
157
160
  export default App;
158
161
  ```
159
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
+
160
167
  ## Quick starts format
161
168
 
162
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).
@@ -243,4 +250,4 @@ return (
243
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.
244
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.
245
252
 
246
- ####
253
+ ####
@@ -14,6 +14,7 @@ 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;
@@ -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;
package/dist/index.es.js CHANGED
@@ -167,7 +167,8 @@ var en = {
167
167
  "Your progress will be saved.": "Your progress will be saved.",
168
168
  "Not available": "Not available",
169
169
  "Copy to clipboard": "Copy to clipboard",
170
- "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"
171
172
  };
172
173
 
173
174
  /* eslint-disable */
@@ -577,6 +578,7 @@ const QuickStartContextDefaults = {
577
578
  },
578
579
  setFilter: () => { },
579
580
  footer: null,
581
+ useLegacyHeaderColors: false,
580
582
  markdown: null,
581
583
  loading: false,
582
584
  alwaysShowTaskReview: false,
@@ -595,7 +597,7 @@ const getResource = (resource, options, resourceBundle, lng) => {
595
597
  const useValuesForQuickStartContext = (value = {}) => {
596
598
  var _a, _b;
597
599
  const combinedValue = Object.assign(Object.assign({}, QuickStartContextDefaults), value);
598
- const { activeQuickStartID, setActiveQuickStartID, setAllQuickStartStates, useQueryParams, allQuickStartStates, allQuickStarts = [], footer, markdown, } = combinedValue;
600
+ const { activeQuickStartID, setActiveQuickStartID, setAllQuickStartStates, useQueryParams, allQuickStartStates, allQuickStarts = [], footer, useLegacyHeaderColors, markdown, } = combinedValue;
599
601
  const [quickStarts, setQuickStarts] = React__default.useState(combinedValue.allQuickStarts || []);
600
602
  const [resourceBundle, setResourceBundle] = React__default.useState(Object.assign(Object.assign({}, en), combinedValue.resourceBundle));
601
603
  const [language, setLanguage] = React__default.useState(combinedValue.language);
@@ -778,6 +780,7 @@ const useValuesForQuickStartContext = (value = {}) => {
778
780
  setQuickStartTaskStatus,
779
781
  getQuickStartForId,
780
782
  footer,
783
+ useLegacyHeaderColors,
781
784
  useQueryParams,
782
785
  markdown,
783
786
  resourceBundle,
@@ -1872,16 +1875,16 @@ const QuickStartTaskHeader = ({ title, taskIndex, subtitle, taskStatus, size, is
1872
1875
  });
1873
1876
  const notCompleted = taskStatus === QuickStartTaskStatus.VISITED;
1874
1877
  const skippedReviewOrFailed = taskStatus === QuickStartTaskStatus.REVIEW || taskStatus === QuickStartTaskStatus.FAILED;
1875
- const tryAgain = !isActiveTask && (skippedReviewOrFailed || notCompleted) && (React.createElement(FlexItem, null,
1876
- React.createElement(Title, { headingLevel: "h4", className: "pfext-quick-start-task-header__tryagain" }, "Try the steps again.")));
1877
- const content = (React.createElement(Flex, { className: "pfext-quick-start-task-header", direction: { default: 'column' }, spaceItems: { default: 'spaceItemsXs' } },
1878
- React.createElement(FlexItem, null,
1879
- React.createElement(Title, { headingLevel: "h3", size: size, className: classNames },
1880
- React.createElement(TaskIcon, { taskIndex: taskIndex, taskStatus: taskStatus }),
1881
- React.createElement("span", { dangerouslySetInnerHTML: { __html: removeParagraphWrap(markdownConvert(title)) } }),
1882
- isActiveTask && subtitle && (React.createElement(React.Fragment, null,
1883
- ' ',
1884
- React.createElement("span", { className: "pfext-quick-start-task-header__subtitle", "data-test-id": "quick-start-task-subtitle" }, subtitle))))),
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 }),
1883
+ React.createElement(Title, { headingLevel: "h3", size: size, className: classNames },
1884
+ React.createElement("span", { dangerouslySetInnerHTML: { __html: removeParagraphWrap(markdownConvert(title)) } }),
1885
+ isActiveTask && subtitle && (React.createElement("span", { className: "pfext-quick-start-task-header__subtitle", "data-test-id": "quick-start-task-subtitle" },
1886
+ ' ',
1887
+ subtitle))),
1885
1888
  tryAgain));
1886
1889
  return (React.createElement(WizardNavItem, { content: content, step: taskIndex, onNavItemClick: () => onTaskSelect(taskIndex - 1), navItemComponent: "button", isCurrent: isActiveTask }));
1887
1890
  };
@@ -1968,7 +1971,7 @@ const QuickStartTasks = ({ tasks, taskNumber, allTaskStatuses, onTaskReview, onT
1968
1971
  React.createElement(QuickStartTaskHeader, { taskIndex: index + 1, title: title, size: "md", subtitle: getResource('{{index, number}} of {{tasks, number}}')
1969
1972
  .replace('{{index, number}}', index + 1)
1970
1973
  .replace('{{tasks, number}}', tasks.length), taskStatus: taskStatus, isActiveTask: isActiveTask, onTaskSelect: onTaskSelect }),
1971
- isActiveTask && (React.createElement("div", { style: { marginBottom: 'var(--pf-global--spacer--md)' } },
1974
+ isActiveTask && (React.createElement("div", { className: "pfext-quick-start-task__content" },
1972
1975
  React.createElement(QuickStartMarkdownView, { content: description }),
1973
1976
  shouldShowTaskReview && (React.createElement(QuickStartTaskReview, { review: review, taskStatus: taskStatus, onTaskReview: onTaskReview }))))));
1974
1977
  })));
@@ -2080,7 +2083,7 @@ const useScrollTopOnTaskNumberChange = (node, taskNumber) => {
2080
2083
  }, [taskNumber, node]);
2081
2084
  };
2082
2085
  const QuickStartPanelContent = (_a) => {
2083
- 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"]);
2084
2087
  const { getResource } = React.useContext(QuickStartContext);
2085
2088
  const [contentRef, setContentRef] = React.useState();
2086
2089
  const shadows = useScrollShadows(contentRef);
@@ -2091,6 +2094,7 @@ const QuickStartPanelContent = (_a) => {
2091
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); });
2092
2095
  const headerClasses = css('pfext-quick-start-panel-content__header', {
2093
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',
2094
2098
  });
2095
2099
  const footerClass = css({
2096
2100
  'pfext-quick-start-panel-content__footer__shadow': shadows === Shadows.bottom || shadows === Shadows.both,
@@ -2109,12 +2113,12 @@ const QuickStartPanelContent = (_a) => {
2109
2113
  React.createElement("div", { className: headerClasses },
2110
2114
  React.createElement(DrawerHead, null,
2111
2115
  React.createElement("div", { className: "pfext-quick-start-panel-content__title" },
2112
- 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 :
2113
2117
  quickStart.spec.displayName,
2114
2118
  ' ',
2115
- React.createElement("small", { className: "pfext-quick-start-panel-content__duration text-secondary" }, getResource('{{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)))),
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)))),
2116
2120
  showClose && (React.createElement(DrawerActions, null,
2117
- 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" }))))),
2118
2122
  React.createElement(DrawerPanelBody, { hasNoPadding: true, className: "pfext-quick-start-panel-content__body", "data-test": "content" },
2119
2123
  React.createElement(QuickStartController, { quickStart: quickStart, nextQuickStarts: nextQuickStarts, footerClass: footerClass, contentRef: setContentRef })))) : null;
2120
2124
  if (appendTo) {
@@ -2124,13 +2128,14 @@ const QuickStartPanelContent = (_a) => {
2124
2128
  };
2125
2129
 
2126
2130
  const QuickStartContainer = (_a) => {
2127
- var { quickStarts, children, activeQuickStartID, allQuickStartStates, setActiveQuickStartID, setAllQuickStartStates, appendTo, fullWidth, onCloseInProgress, onCloseNotInProgress, resourceBundle, showCardFooters, 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", "language", "loading", "useQueryParams", "markdown", "contextProps", "alwaysShowTaskReview"]);
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"]);
2128
2132
  const valuesForQuickstartContext = useValuesForQuickStartContext(Object.assign({ allQuickStarts: quickStarts, activeQuickStartID,
2129
2133
  setActiveQuickStartID,
2130
2134
  allQuickStartStates,
2131
2135
  setAllQuickStartStates, footer: {
2132
2136
  show: showCardFooters,
2133
- }, language, resourceBundle: Object.assign({}, resourceBundle), loading,
2137
+ }, useLegacyHeaderColors,
2138
+ language, resourceBundle: Object.assign({}, resourceBundle), loading,
2134
2139
  useQueryParams,
2135
2140
  markdown,
2136
2141
  alwaysShowTaskReview }, contextProps));
@@ -2154,7 +2159,7 @@ const QuickStartContainer = (_a) => {
2154
2159
  };
2155
2160
  const QuickStartDrawer = (_a) => {
2156
2161
  var { quickStarts = [], children, appendTo, fullWidth, onCloseInProgress, onCloseNotInProgress } = _a, props = __rest(_a, ["quickStarts", "children", "appendTo", "fullWidth", "onCloseInProgress", "onCloseNotInProgress"]);
2157
- const { activeQuickStartID, setActiveQuickStart, allQuickStarts = [], activeQuickStartState, allQuickStartStates, setAllQuickStartStates, } = React.useContext(QuickStartContext);
2162
+ const { activeQuickStartID, setActiveQuickStart, allQuickStarts = [], activeQuickStartState, allQuickStartStates, setAllQuickStartStates, useLegacyHeaderColors, } = React.useContext(QuickStartContext);
2158
2163
  const combinedQuickStarts = allQuickStarts.concat(quickStarts);
2159
2164
  React.useEffect(() => {
2160
2165
  const params = new URLSearchParams(window.location.search);
@@ -2213,7 +2218,7 @@ const QuickStartDrawer = (_a) => {
2213
2218
  },
2214
2219
  }
2215
2220
  : {};
2216
- 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)));
2217
2222
  return (React.createElement(React.Fragment, null,
2218
2223
  React.createElement(Drawer, Object.assign({ isExpanded: !!activeQuickStartID, isInline: true }, props), children ? (React.createElement(DrawerContent, Object.assign({ panelContent: panelContent }, fullWidthBodyStyle),
2219
2224
  React.createElement(DrawerContentBody, { className: "pfext-quick-start-drawer__body" }, children))) : (React.createElement("div", { className: "pf-c-drawer__main" }, panelContent))),