@patternfly/quickstarts 6.1.0-prerelease.2 → 6.1.0-prerelease.3

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.
@@ -0,0 +1,55 @@
1
+ import * as React from 'react';
2
+ import { QuickStartContextValues } from './utils/quick-start-context';
3
+ import { QuickStart, AllQuickStartStates } from './utils/quick-start-types';
4
+ export interface QuickStartContainerProps extends React.HTMLProps<HTMLDivElement> {
5
+ /** array of quick starts */
6
+ quickStarts: QuickStart[];
7
+ /** id of the currently active quick start */
8
+ activeQuickStartID: string;
9
+ /** setter for the active quick starts */
10
+ setActiveQuickStartID: React.Dispatch<React.SetStateAction<string>>;
11
+ /** quick starts state object */
12
+ allQuickStartStates: AllQuickStartStates;
13
+ /** setter for the quick starts state object */
14
+ setAllQuickStartStates: React.Dispatch<React.SetStateAction<AllQuickStartStates>>;
15
+ /** content to render within the container */
16
+ children?: React.ReactNode;
17
+ /** element to render the drawer panel into */
18
+ appendTo?: HTMLElement | (() => HTMLElement);
19
+ /** if true, the panel will take up the full browser width */
20
+ fullWidth?: boolean;
21
+ /** callback when an in-progress quick start is closed */
22
+ onCloseInProgress?: any;
23
+ /** callback when a not-in-progress quick start is closed */
24
+ onCloseNotInProgress?: any;
25
+ /** true to show footer buttons in the catalog tiles (default true) */
26
+ showCardFooters?: boolean;
27
+ /** true to use legacy drawer header variant colors */
28
+ useLegacyHeaderColors?: boolean;
29
+ /** text resources object */
30
+ resourceBundle?: any;
31
+ /** language of the current resource bundle
32
+ * Add custom strings: https://github.com/patternfly/patternfly-quickstarts/tree/main/packages/module#localization
33
+ */
34
+ language?: string;
35
+ /** if true, will show a loading spinner on the catalog page (default false) */
36
+ loading?: boolean;
37
+ /** if true, will update the browser URL with ?quickstart={ID} (default true) */
38
+ useQueryParams?: boolean;
39
+ /** if true, the TaskReview component, aka "Check your work", will be shown regardless of task status */
40
+ alwaysShowTaskReview?: boolean;
41
+ /**
42
+ * Additional markdown extensions and renderers to use
43
+ * Example usage: https://github.com/patternfly/patternfly-quickstarts/tree/main/packages/module#markdown-extensions
44
+ */
45
+ markdown?: {
46
+ extensions?: any[];
47
+ renderExtension?: (docContext: Document, rootSelector: string) => React.ReactNode;
48
+ };
49
+ /** additional quick start context props */
50
+ contextProps?: QuickStartContextValues;
51
+ /** Indicates that QuickStart should create and maintain its own drawer. If false, a QuickStartDrawerContent component should be present within the children, replacing the custom Drawer's DrawerContent. */
52
+ isManagedDrawer?: boolean;
53
+ }
54
+ export declare const QuickStartContainer: React.FC<QuickStartContainerProps>;
55
+ export default QuickStartContainer;
@@ -1,55 +1,5 @@
1
1
  import * as React from 'react';
2
- import { QuickStartContextValues } from './utils/quick-start-context';
3
- import { QuickStart, AllQuickStartStates } from './utils/quick-start-types';
4
- export interface QuickStartContainerProps extends React.HTMLProps<HTMLDivElement> {
5
- /** array of quick starts */
6
- quickStarts: QuickStart[];
7
- /** id of the currently active quick start */
8
- activeQuickStartID: string;
9
- /** setter for the active quick starts */
10
- setActiveQuickStartID: React.Dispatch<React.SetStateAction<string>>;
11
- /** quick starts state object */
12
- allQuickStartStates: AllQuickStartStates;
13
- /** setter for the quick starts state object */
14
- setAllQuickStartStates: React.Dispatch<React.SetStateAction<AllQuickStartStates>>;
15
- /** content to render within the container */
16
- children?: React.ReactNode;
17
- /** element to render the drawer panel into */
18
- appendTo?: HTMLElement | (() => HTMLElement);
19
- /** if true, the panel will take up the full browser width */
20
- fullWidth?: boolean;
21
- /** callback when an in-progress quick start is closed */
22
- onCloseInProgress?: any;
23
- /** callback when a not-in-progress quick start is closed */
24
- onCloseNotInProgress?: any;
25
- /** true to show footer buttons in the catalog tiles (default true) */
26
- showCardFooters?: boolean;
27
- /** true to use legacy drawer header variant colors */
28
- useLegacyHeaderColors?: boolean;
29
- /** text resources object */
30
- resourceBundle?: any;
31
- /** language of the current resource bundle
32
- * Add custom strings: https://github.com/patternfly/patternfly-quickstarts/tree/main/packages/module#localization
33
- */
34
- language?: string;
35
- /** if true, will show a loading spinner on the catalog page (default false) */
36
- loading?: boolean;
37
- /** if true, will update the browser URL with ?quickstart={ID} (default true) */
38
- useQueryParams?: boolean;
39
- /** if true, the TaskReview component, aka "Check your work", will be shown regardless of task status */
40
- alwaysShowTaskReview?: boolean;
41
- /**
42
- * Additional markdown extensions and renderers to use
43
- * Example usage: https://github.com/patternfly/patternfly-quickstarts/tree/main/packages/module#markdown-extensions
44
- */
45
- markdown?: {
46
- extensions?: any[];
47
- renderExtension?: (docContext: Document, rootSelector: string) => React.ReactNode;
48
- };
49
- /** additional quick start context props */
50
- contextProps?: QuickStartContextValues;
51
- }
52
- export declare const QuickStartContainer: React.FC<QuickStartContainerProps>;
2
+ import { QuickStart } from './utils/quick-start-types';
53
3
  export interface QuickStartDrawerProps extends React.HTMLProps<HTMLDivElement> {
54
4
  quickStarts?: QuickStart[];
55
5
  children?: React.ReactNode;
@@ -59,3 +9,4 @@ export interface QuickStartDrawerProps extends React.HTMLProps<HTMLDivElement> {
59
9
  onCloseNotInProgress?: any;
60
10
  }
61
11
  export declare const QuickStartDrawer: React.FC<QuickStartDrawerProps>;
12
+ export default QuickStartDrawer;
@@ -0,0 +1,12 @@
1
+ import * as React from 'react';
2
+ import { QuickStart } from './utils/quick-start-types';
3
+ export interface QuickStartDrawerContentProps extends React.HTMLProps<HTMLDivElement> {
4
+ quickStarts?: QuickStart[];
5
+ appendTo?: HTMLElement | (() => HTMLElement);
6
+ fullWidth?: boolean;
7
+ onCloseInProgress?: any;
8
+ onCloseNotInProgress?: any;
9
+ handleDrawerClose?: (quickStartStatus: string | number) => void;
10
+ }
11
+ export declare const QuickStartDrawerContent: React.FC<QuickStartDrawerContentProps>;
12
+ export default QuickStartDrawerContent;
package/dist/index.d.ts CHANGED
@@ -2,7 +2,10 @@ import './styles/style.scss';
2
2
  export * from './QuickStartCatalogPage';
3
3
  export * from './catalog';
4
4
  export * from './ConsoleInternal/components/utils';
5
+ export * from './QuickStartContainer';
5
6
  export * from './QuickStartDrawer';
7
+ export * from './QuickStartDrawerContent';
8
+ export * from './QuickStartCloseModal';
6
9
  export * from './HelpTopicDrawer';
7
10
  export * from './utils/const';
8
11
  export * from './utils/quick-start-context';
package/dist/index.es.js CHANGED
@@ -2121,39 +2121,26 @@ const QuickStartPanelContent = (_a) => {
2121
2121
  return content;
2122
2122
  };
2123
2123
 
2124
- const QuickStartContainer = (_a) => {
2125
- var { quickStarts, children, activeQuickStartID, allQuickStartStates, setActiveQuickStartID, setAllQuickStartStates, appendTo, fullWidth, onCloseInProgress, onCloseNotInProgress, resourceBundle, showCardFooters, useLegacyHeaderColors, language, loading = false, useQueryParams = true, markdown, contextProps, alwaysShowTaskReview = true } = _a, props = __rest(_a, ["quickStarts", "children", "activeQuickStartID", "allQuickStartStates", "setActiveQuickStartID", "setAllQuickStartStates", "appendTo", "fullWidth", "onCloseInProgress", "onCloseNotInProgress", "resourceBundle", "showCardFooters", "useLegacyHeaderColors", "language", "loading", "useQueryParams", "markdown", "contextProps", "alwaysShowTaskReview"]);
2126
- const valuesForQuickstartContext = useValuesForQuickStartContext(Object.assign({ allQuickStarts: quickStarts, activeQuickStartID,
2127
- setActiveQuickStartID,
2128
- allQuickStartStates,
2129
- setAllQuickStartStates, footer: {
2130
- show: showCardFooters,
2131
- }, useLegacyHeaderColors,
2132
- language, resourceBundle: Object.assign({}, resourceBundle), loading,
2133
- useQueryParams,
2134
- markdown,
2135
- alwaysShowTaskReview }, contextProps));
2136
- React.useEffect(() => {
2137
- if (quickStarts &&
2138
- JSON.stringify(quickStarts) !== JSON.stringify(valuesForQuickstartContext.allQuickStarts)) {
2139
- valuesForQuickstartContext.setAllQuickStarts(quickStarts);
2140
- }
2141
- }, [quickStarts, valuesForQuickstartContext]);
2142
- React.useEffect(() => {
2143
- if (loading !== valuesForQuickstartContext.loading) {
2144
- valuesForQuickstartContext.setLoading(loading);
2124
+ const QuickStartDrawerContent = (_a) => {
2125
+ var { quickStarts = [], appendTo, fullWidth, handleDrawerClose } = _a, props = __rest(_a, ["quickStarts", "appendTo", "fullWidth", "handleDrawerClose"]);
2126
+ const { activeQuickStartID, allQuickStarts = [], activeQuickStartState, } = React.useContext(QuickStartContext);
2127
+ const combinedQuickStarts = allQuickStarts.concat(quickStarts);
2128
+ const handleClose = () => {
2129
+ handleDrawerClose && handleDrawerClose(activeQuickStartState === null || activeQuickStartState === void 0 ? void 0 : activeQuickStartState.status);
2130
+ };
2131
+ const fullWidthPanelStyle = fullWidth
2132
+ ? {
2133
+ style: {
2134
+ flex: 1,
2135
+ },
2145
2136
  }
2146
- }, [loading, valuesForQuickstartContext]);
2147
- const drawerProps = Object.assign({ appendTo,
2148
- fullWidth,
2149
- onCloseInProgress,
2150
- onCloseNotInProgress }, props);
2151
- return (React.createElement(QuickStartContext.Provider, { value: valuesForQuickstartContext },
2152
- React.createElement(QuickStartDrawer, Object.assign({}, drawerProps), children)));
2137
+ : {};
2138
+ return (React.createElement(QuickStartPanelContent, Object.assign({ quickStarts: combinedQuickStarts, handleClose: handleClose, activeQuickStartID: activeQuickStartID, appendTo: appendTo, isResizable: !fullWidth }, fullWidthPanelStyle, props)));
2153
2139
  };
2140
+
2154
2141
  const QuickStartDrawer = (_a) => {
2155
2142
  var { quickStarts = [], children, appendTo, fullWidth, onCloseInProgress, onCloseNotInProgress } = _a, props = __rest(_a, ["quickStarts", "children", "appendTo", "fullWidth", "onCloseInProgress", "onCloseNotInProgress"]);
2156
- const { activeQuickStartID, setActiveQuickStart, allQuickStarts = [], activeQuickStartState, allQuickStartStates, setAllQuickStartStates, } = React.useContext(QuickStartContext);
2143
+ const { activeQuickStartID, setActiveQuickStart, allQuickStarts = [], allQuickStartStates, setAllQuickStartStates, } = React.useContext(QuickStartContext);
2157
2144
  const combinedQuickStarts = allQuickStarts.concat(quickStarts);
2158
2145
  React.useEffect(() => {
2159
2146
  const params = new URLSearchParams(window.location.search);
@@ -2175,9 +2162,8 @@ const QuickStartDrawer = (_a) => {
2175
2162
  }
2176
2163
  }, [activeQuickStartID, allQuickStartStates, setAllQuickStartStates]);
2177
2164
  const [modalOpen, setModalOpen] = React.useState(false);
2178
- const activeQuickStartStatus = activeQuickStartState === null || activeQuickStartState === void 0 ? void 0 : activeQuickStartState.status;
2179
2165
  const onClose = () => setActiveQuickStart('');
2180
- const handleClose = () => {
2166
+ const handleClose = (activeQuickStartStatus) => {
2181
2167
  if (activeQuickStartStatus === QuickStartStatus.IN_PROGRESS) {
2182
2168
  if (onCloseInProgress) {
2183
2169
  onCloseInProgress();
@@ -2198,13 +2184,6 @@ const QuickStartDrawer = (_a) => {
2198
2184
  onClose();
2199
2185
  };
2200
2186
  const onModalCancel = () => setModalOpen(false);
2201
- const fullWidthPanelStyle = fullWidth
2202
- ? {
2203
- style: {
2204
- flex: 1,
2205
- },
2206
- }
2207
- : {};
2208
2187
  const fullWidthBodyStyle = fullWidth
2209
2188
  ? {
2210
2189
  style: {
@@ -2212,13 +2191,43 @@ const QuickStartDrawer = (_a) => {
2212
2191
  },
2213
2192
  }
2214
2193
  : {};
2215
- const panelContent = (React.createElement(QuickStartPanelContent, Object.assign({ quickStarts: combinedQuickStarts, handleClose: handleClose, activeQuickStartID: activeQuickStartID, appendTo: appendTo, isResizable: !fullWidth }, fullWidthPanelStyle)));
2216
2194
  return (React.createElement(React.Fragment, null,
2217
- React.createElement(Drawer, Object.assign({ isExpanded: !!activeQuickStartID, isInline: true }, props), children ? (React.createElement(DrawerContent, Object.assign({ panelContent: panelContent }, fullWidthBodyStyle),
2218
- React.createElement(DrawerContentBody, null, children))) : (React.createElement("div", null, panelContent))),
2195
+ React.createElement(Drawer, Object.assign({ isExpanded: !!activeQuickStartID, isInline: true }, props),
2196
+ React.createElement(DrawerContent, Object.assign({ panelContent: React.createElement(QuickStartDrawerContent, { quickStarts: combinedQuickStarts, handleDrawerClose: handleClose, appendTo: appendTo, fullWidth: fullWidth }) }, fullWidthBodyStyle),
2197
+ React.createElement(DrawerContentBody, null, children))),
2219
2198
  React.createElement(QuickStartCloseModal, { isOpen: modalOpen, onConfirm: onModalConfirm, onCancel: onModalCancel })));
2220
2199
  };
2221
2200
 
2201
+ const QuickStartContainer = (_a) => {
2202
+ var { quickStarts, children, activeQuickStartID, allQuickStartStates, setActiveQuickStartID, setAllQuickStartStates, appendTo, fullWidth, onCloseInProgress, onCloseNotInProgress, resourceBundle, showCardFooters, useLegacyHeaderColors, language, loading = false, useQueryParams = true, markdown, contextProps, alwaysShowTaskReview = true, isManagedDrawer = true } = _a, props = __rest(_a, ["quickStarts", "children", "activeQuickStartID", "allQuickStartStates", "setActiveQuickStartID", "setAllQuickStartStates", "appendTo", "fullWidth", "onCloseInProgress", "onCloseNotInProgress", "resourceBundle", "showCardFooters", "useLegacyHeaderColors", "language", "loading", "useQueryParams", "markdown", "contextProps", "alwaysShowTaskReview", "isManagedDrawer"]);
2203
+ const valuesForQuickstartContext = useValuesForQuickStartContext(Object.assign({ allQuickStarts: quickStarts, activeQuickStartID,
2204
+ setActiveQuickStartID,
2205
+ allQuickStartStates,
2206
+ setAllQuickStartStates, footer: {
2207
+ show: showCardFooters,
2208
+ }, useLegacyHeaderColors,
2209
+ language, resourceBundle: Object.assign({}, resourceBundle), loading,
2210
+ useQueryParams,
2211
+ markdown,
2212
+ alwaysShowTaskReview }, contextProps));
2213
+ React.useEffect(() => {
2214
+ if (quickStarts &&
2215
+ JSON.stringify(quickStarts) !== JSON.stringify(valuesForQuickstartContext.allQuickStarts)) {
2216
+ valuesForQuickstartContext.setAllQuickStarts(quickStarts);
2217
+ }
2218
+ }, [quickStarts, valuesForQuickstartContext]);
2219
+ React.useEffect(() => {
2220
+ if (loading !== valuesForQuickstartContext.loading) {
2221
+ valuesForQuickstartContext.setLoading(loading);
2222
+ }
2223
+ }, [loading, valuesForQuickstartContext]);
2224
+ const drawerProps = Object.assign({ appendTo,
2225
+ fullWidth,
2226
+ onCloseInProgress,
2227
+ onCloseNotInProgress }, props);
2228
+ return (React.createElement(QuickStartContext.Provider, { value: valuesForQuickstartContext }, isManagedDrawer ? (React.createElement(QuickStartDrawer, Object.assign({}, drawerProps), children)) : (children)));
2229
+ };
2230
+
2222
2231
  const HelpTopicContextDefaults = {
2223
2232
  helpTopics: [],
2224
2233
  setHelpTopics: () => { },
@@ -2457,5 +2466,5 @@ const ProcQuickStartParser = (quickStart, environmentVariables) => {
2457
2466
  return quickStart;
2458
2467
  };
2459
2468
 
2460
- export { Box, CamelCaseWrap, EmptyBox, HELP_TOPIC_NAME_KEY, HelpTopicContainer, HelpTopicContext, HelpTopicContextDefaults, HelpTopicDrawer, Loading, LoadingBox, ProcQuickStartParser, QUICKSTART_ID_FILTER_KEY, QUICKSTART_SEARCH_FILTER_KEY, QUICKSTART_STATUS_FILTER_KEY, QUICKSTART_TASKS_INITIAL_STATES, QUICK_START_NAME, QuickStartCatalog, QuickStartCatalogEmptyState, QuickStartCatalogFilter, QuickStartCatalogFilterCount, QuickStartCatalogFilterCountWrapper, QuickStartCatalogFilterSearch, QuickStartCatalogFilterSearchWrapper, QuickStartCatalogFilterSelect, QuickStartCatalogFilterStatusWrapper, QuickStartCatalogHeader, QuickStartCatalogPage, QuickStartCatalogSection, QuickStartCatalogToolbar, QuickStartCloseModal, QuickStartContainer, QuickStartContext, QuickStartContextDefaults, QuickStartContextProvider, QuickStartDrawer, QuickStartPanelContent, QuickStartStatus, QuickStartTaskStatus, QuickStartTile, QuickStartTileDescription, QuickStartTileFooter, QuickStartTileFooterExternal, QuickStartTileHeader, camelize, clearFilterParams, equalsIgnoreOrder, filterQuickStarts, getDefaultQuickStartState, getDisabledQuickStarts, getQuickStartByName, getQuickStartStatus, getQuickStartStatusCount, getResource, getTaskStatusKey, history, isDisabledQuickStart, removeQueryArgument, setQueryArgument, useLocalStorage, useValuesForHelpTopicContext, useValuesForQuickStartContext };
2469
+ export { Box, CamelCaseWrap, EmptyBox, HELP_TOPIC_NAME_KEY, HelpTopicContainer, HelpTopicContext, HelpTopicContextDefaults, HelpTopicDrawer, Loading, LoadingBox, ProcQuickStartParser, QUICKSTART_ID_FILTER_KEY, QUICKSTART_SEARCH_FILTER_KEY, QUICKSTART_STATUS_FILTER_KEY, QUICKSTART_TASKS_INITIAL_STATES, QUICK_START_NAME, QuickStartCatalog, QuickStartCatalogEmptyState, QuickStartCatalogFilter, QuickStartCatalogFilterCount, QuickStartCatalogFilterCountWrapper, QuickStartCatalogFilterSearch, QuickStartCatalogFilterSearchWrapper, QuickStartCatalogFilterSelect, QuickStartCatalogFilterStatusWrapper, QuickStartCatalogHeader, QuickStartCatalogPage, QuickStartCatalogSection, QuickStartCatalogToolbar, QuickStartCloseModal, QuickStartContainer, QuickStartContext, QuickStartContextDefaults, QuickStartContextProvider, QuickStartDrawer, QuickStartDrawerContent, QuickStartPanelContent, QuickStartStatus, QuickStartTaskStatus, QuickStartTile, QuickStartTileDescription, QuickStartTileFooter, QuickStartTileFooterExternal, QuickStartTileHeader, camelize, clearFilterParams, equalsIgnoreOrder, filterQuickStarts, getDefaultQuickStartState, getDisabledQuickStarts, getQuickStartByName, getQuickStartStatus, getQuickStartStatusCount, getResource, getTaskStatusKey, history, isDisabledQuickStart, removeQueryArgument, setQueryArgument, useLocalStorage, useValuesForHelpTopicContext, useValuesForQuickStartContext };
2461
2470
  //# sourceMappingURL=index.es.js.map