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

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
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
2
  import React__default, { createContext, useCallback, useEffect, useState } from 'react';
3
- import { useIsomorphicLayoutEffect, Tooltip, Alert, CodeBlock, Accordion, AccordionItem, AccordionToggle, AccordionContent, Popover, PopoverPosition, Button, Icon, Flex, FlexItem, Title, Card, CardHeader, CardTitle, CardBody, Stack, Label, CardFooter, Gallery, ToolbarItem, SearchInput, Select, SelectList, SelectOption, MenuToggle, Badge, Toolbar, ToolbarContent, EmptyState, EmptyStateBody, EmptyStateFooter, EmptyStateActions, PageSection, Content, Divider, WizardNavItem, ExpandableSection, List, ListItem, Radio, ActionList, ActionListGroup, ActionListItem, DrawerPanelContent, DrawerHead, DrawerActions, DrawerCloseButton, DrawerPanelBody, Drawer, DrawerContent, DrawerContentBody, StackItem } from '@patternfly/react-core';
3
+ import { useIsomorphicLayoutEffect, Tooltip, Alert, CodeBlock, Accordion, AccordionItem, AccordionToggle, AccordionContent, Popover, PopoverPosition, Button, Icon, Flex, FlexItem, Card, CardHeader, CardTitle, CardBody, Stack, Label, CardFooter, Gallery, ToolbarItem, SearchInput, Select, SelectList, SelectOption, MenuToggle, Badge, Toolbar, ToolbarContent, EmptyState, EmptyStateBody, EmptyStateFooter, EmptyStateActions, PageSection, Content, Divider, Title, WizardNavItem, ExpandableSection, List, ListItem, Radio, ActionList, ActionListGroup, ActionListItem, DrawerPanelContent, DrawerHead, DrawerActions, DrawerCloseButton, DrawerPanelBody, Drawer, DrawerContent, DrawerContentBody, StackItem } 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';
@@ -1577,8 +1577,7 @@ const QuickStartTileFooterExternal = ({ link, quickStartId, }) => {
1577
1577
  };
1578
1578
 
1579
1579
  const QuickStartTileHeader = ({ name, quickStartId, onSelect, }) => (React.createElement(Flex, { flexWrap: { default: 'nowrap' } },
1580
- React.createElement(Title, { headingLevel: "h3", "data-test": "title", id: quickStartId },
1581
- React.createElement(Button, { variant: "link", isInline: true, onClick: onSelect }, name))));
1580
+ React.createElement(Button, { "data-test": "title", id: quickStartId, variant: "link", isInline: true, onClick: onSelect }, name)));
1582
1581
 
1583
1582
  const QuickStartTile = ({ quickStart, status, isActive, onClick = () => { }, action, }) => {
1584
1583
  const { metadata: { name: id }, spec: { icon, tasks, displayName, description, durationMinutes, prerequisites, link, type }, } = quickStart;
@@ -2121,39 +2120,26 @@ const QuickStartPanelContent = (_a) => {
2121
2120
  return content;
2122
2121
  };
2123
2122
 
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);
2123
+ const QuickStartDrawerContent = (_a) => {
2124
+ var { quickStarts = [], appendTo, fullWidth, handleDrawerClose } = _a, props = __rest(_a, ["quickStarts", "appendTo", "fullWidth", "handleDrawerClose"]);
2125
+ const { activeQuickStartID, allQuickStarts = [], activeQuickStartState, } = React.useContext(QuickStartContext);
2126
+ const combinedQuickStarts = allQuickStarts.concat(quickStarts);
2127
+ const handleClose = () => {
2128
+ handleDrawerClose && handleDrawerClose(activeQuickStartState === null || activeQuickStartState === void 0 ? void 0 : activeQuickStartState.status);
2129
+ };
2130
+ const fullWidthPanelStyle = fullWidth
2131
+ ? {
2132
+ style: {
2133
+ flex: 1,
2134
+ },
2145
2135
  }
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)));
2136
+ : {};
2137
+ return (React.createElement(QuickStartPanelContent, Object.assign({ quickStarts: combinedQuickStarts, handleClose: handleClose, activeQuickStartID: activeQuickStartID, appendTo: appendTo, isResizable: !fullWidth }, fullWidthPanelStyle, props)));
2153
2138
  };
2139
+
2154
2140
  const QuickStartDrawer = (_a) => {
2155
2141
  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);
2142
+ const { activeQuickStartID, setActiveQuickStart, allQuickStarts = [], allQuickStartStates, setAllQuickStartStates, } = React.useContext(QuickStartContext);
2157
2143
  const combinedQuickStarts = allQuickStarts.concat(quickStarts);
2158
2144
  React.useEffect(() => {
2159
2145
  const params = new URLSearchParams(window.location.search);
@@ -2175,9 +2161,8 @@ const QuickStartDrawer = (_a) => {
2175
2161
  }
2176
2162
  }, [activeQuickStartID, allQuickStartStates, setAllQuickStartStates]);
2177
2163
  const [modalOpen, setModalOpen] = React.useState(false);
2178
- const activeQuickStartStatus = activeQuickStartState === null || activeQuickStartState === void 0 ? void 0 : activeQuickStartState.status;
2179
2164
  const onClose = () => setActiveQuickStart('');
2180
- const handleClose = () => {
2165
+ const handleClose = (activeQuickStartStatus) => {
2181
2166
  if (activeQuickStartStatus === QuickStartStatus.IN_PROGRESS) {
2182
2167
  if (onCloseInProgress) {
2183
2168
  onCloseInProgress();
@@ -2198,13 +2183,6 @@ const QuickStartDrawer = (_a) => {
2198
2183
  onClose();
2199
2184
  };
2200
2185
  const onModalCancel = () => setModalOpen(false);
2201
- const fullWidthPanelStyle = fullWidth
2202
- ? {
2203
- style: {
2204
- flex: 1,
2205
- },
2206
- }
2207
- : {};
2208
2186
  const fullWidthBodyStyle = fullWidth
2209
2187
  ? {
2210
2188
  style: {
@@ -2212,13 +2190,43 @@ const QuickStartDrawer = (_a) => {
2212
2190
  },
2213
2191
  }
2214
2192
  : {};
2215
- const panelContent = (React.createElement(QuickStartPanelContent, Object.assign({ quickStarts: combinedQuickStarts, handleClose: handleClose, activeQuickStartID: activeQuickStartID, appendTo: appendTo, isResizable: !fullWidth }, fullWidthPanelStyle)));
2216
2193
  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))),
2194
+ React.createElement(Drawer, Object.assign({ isExpanded: !!activeQuickStartID, isInline: true }, props),
2195
+ React.createElement(DrawerContent, Object.assign({ panelContent: React.createElement(QuickStartDrawerContent, { quickStarts: combinedQuickStarts, handleDrawerClose: handleClose, appendTo: appendTo, fullWidth: fullWidth }) }, fullWidthBodyStyle),
2196
+ React.createElement(DrawerContentBody, null, children))),
2219
2197
  React.createElement(QuickStartCloseModal, { isOpen: modalOpen, onConfirm: onModalConfirm, onCancel: onModalCancel })));
2220
2198
  };
2221
2199
 
2200
+ const QuickStartContainer = (_a) => {
2201
+ 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"]);
2202
+ const valuesForQuickstartContext = useValuesForQuickStartContext(Object.assign({ allQuickStarts: quickStarts, activeQuickStartID,
2203
+ setActiveQuickStartID,
2204
+ allQuickStartStates,
2205
+ setAllQuickStartStates, footer: {
2206
+ show: showCardFooters,
2207
+ }, useLegacyHeaderColors,
2208
+ language, resourceBundle: Object.assign({}, resourceBundle), loading,
2209
+ useQueryParams,
2210
+ markdown,
2211
+ alwaysShowTaskReview }, contextProps));
2212
+ React.useEffect(() => {
2213
+ if (quickStarts &&
2214
+ JSON.stringify(quickStarts) !== JSON.stringify(valuesForQuickstartContext.allQuickStarts)) {
2215
+ valuesForQuickstartContext.setAllQuickStarts(quickStarts);
2216
+ }
2217
+ }, [quickStarts, valuesForQuickstartContext]);
2218
+ React.useEffect(() => {
2219
+ if (loading !== valuesForQuickstartContext.loading) {
2220
+ valuesForQuickstartContext.setLoading(loading);
2221
+ }
2222
+ }, [loading, valuesForQuickstartContext]);
2223
+ const drawerProps = Object.assign({ appendTo,
2224
+ fullWidth,
2225
+ onCloseInProgress,
2226
+ onCloseNotInProgress }, props);
2227
+ return (React.createElement(QuickStartContext.Provider, { value: valuesForQuickstartContext }, isManagedDrawer ? (React.createElement(QuickStartDrawer, Object.assign({}, drawerProps), children)) : (children)));
2228
+ };
2229
+
2222
2230
  const HelpTopicContextDefaults = {
2223
2231
  helpTopics: [],
2224
2232
  setHelpTopics: () => { },
@@ -2457,5 +2465,5 @@ const ProcQuickStartParser = (quickStart, environmentVariables) => {
2457
2465
  return quickStart;
2458
2466
  };
2459
2467
 
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 };
2468
+ 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
2469
  //# sourceMappingURL=index.es.js.map