@patternfly/quickstarts 2.2.0 → 2.2.1
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 +2 -2
- package/dist/HelpTopicPanelContent.d.ts +1 -0
- package/dist/index.es.js +31 -17
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +30 -16
- package/dist/index.js.map +1 -1
- package/dist/patternfly-nested.css +1 -11
- package/dist/quickstarts-base.css +24 -24
- package/dist/quickstarts-full.es.js +315 -323
- package/dist/quickstarts-full.es.js.map +1 -1
- package/dist/quickstarts-standalone.min.css +1 -1
- package/dist/quickstarts.css +24 -24
- package/dist/quickstarts.min.css +1 -1
- package/dist/utils/help-topic-context.d.ts +2 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -308,7 +308,7 @@ See the [HelpTopicDemo](https://github.com/patternfly/patternfly-quickstarts/blo
|
|
|
308
308
|
- Load yaml defined `HelpTopic` array
|
|
309
309
|
- Pass `HelpTopicContainerProps`, including loaded `HelpTopics` to the `<HelpTopicContainer/>`
|
|
310
310
|
|
|
311
|
-
```
|
|
311
|
+
```tsx
|
|
312
312
|
import './App.css';
|
|
313
313
|
import { Page } from '@patternfly/react-core';
|
|
314
314
|
import { LoadingBox, HelpTopicContainerProps, HelpTopicContainer } from '@patternfly/quickstarts';
|
|
@@ -359,7 +359,7 @@ In the example above `<HelpTopicContainer />` wraps the `<Page/>` element as wel
|
|
|
359
359
|
|
|
360
360
|
Live [preview](https://deploy-preview-140--quickstarts.netlify.app/in-context-help) of code below:
|
|
361
361
|
|
|
362
|
-
```
|
|
362
|
+
```tsx
|
|
363
363
|
import * as React from 'react';
|
|
364
364
|
import {
|
|
365
365
|
Banner,
|
|
@@ -5,6 +5,7 @@ declare type HelpTopicPanelContentProps = {
|
|
|
5
5
|
activeHelpTopic: HelpTopic;
|
|
6
6
|
filteredHelpTopics?: HelpTopic[];
|
|
7
7
|
isResizable?: boolean;
|
|
8
|
+
onClose: () => void;
|
|
8
9
|
};
|
|
9
10
|
declare const HelpTopicPanelContent: React.FC<HelpTopicPanelContentProps>;
|
|
10
11
|
export default HelpTopicPanelContent;
|
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 { Card, CardHeader, CardActions, CardTitle, CardBody, CardFooter, Modal as Modal$1, Tooltip, Alert, Popover, PopoverPosition, Button, Text, TextVariants, TextList, TextListItem, Flex, FlexItem, Title, Label, Gallery, GalleryItem, ToolbarItem, SearchInput, Select, SelectVariant, SelectOption, Toolbar, ToolbarContent, EmptyState, EmptyStateIcon, EmptyStateBody, EmptyStatePrimary, Divider, ModalVariant, WizardNavItem, List, ExpandableSection, ListItem, Radio, DrawerPanelContent, DrawerHead, DrawerActions, DrawerCloseButton, DrawerPanelBody, Drawer, DrawerContent, DrawerContentBody, OptionsMenuItem, OptionsMenu, OptionsMenuToggle
|
|
3
|
+
import { Card, CardHeader, CardActions, CardTitle, CardBody, CardFooter, Modal as Modal$1, Tooltip, Alert, Popover, PopoverPosition, Button, Text, TextVariants, TextList, TextListItem, Flex, FlexItem, Title, Label, Gallery, GalleryItem, ToolbarItem, SearchInput, Select, SelectVariant, SelectOption, Toolbar, ToolbarContent, EmptyState, EmptyStateIcon, EmptyStateBody, EmptyStatePrimary, Divider, ModalVariant, WizardNavItem, List, ExpandableSection, ListItem, Radio, DrawerPanelContent, DrawerHead, DrawerActions, DrawerCloseButton, DrawerPanelBody, Drawer, DrawerContent, DrawerContentBody, OptionsMenuItem, OptionsMenu, OptionsMenuToggle } 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';
|
|
@@ -2298,6 +2298,7 @@ const QuickStartDrawer = (_a) => {
|
|
|
2298
2298
|
|
|
2299
2299
|
const HelpTopicContextDefaults = {
|
|
2300
2300
|
helpTopics: [],
|
|
2301
|
+
setHelpTopics: () => { },
|
|
2301
2302
|
activeHelpTopic: null,
|
|
2302
2303
|
setActiveHelpTopicByName: () => { },
|
|
2303
2304
|
filteredHelpTopics: [],
|
|
@@ -2324,6 +2325,7 @@ const useValuesForHelpTopicContext = (value = {}) => {
|
|
|
2324
2325
|
const [filteredHelpTopics, setFilteredHelpTopics] = React__default.useState(combinedValue.filteredHelpTopics || []);
|
|
2325
2326
|
return {
|
|
2326
2327
|
helpTopics,
|
|
2328
|
+
setHelpTopics,
|
|
2327
2329
|
activeHelpTopic,
|
|
2328
2330
|
setActiveHelpTopicByName,
|
|
2329
2331
|
filteredHelpTopics,
|
|
@@ -2334,7 +2336,7 @@ const useValuesForHelpTopicContext = (value = {}) => {
|
|
|
2334
2336
|
};
|
|
2335
2337
|
|
|
2336
2338
|
const HelpTopicPanelContent = (_a) => {
|
|
2337
|
-
var { activeHelpTopic = null, filteredHelpTopics = [], isResizable = true } = _a, props = __rest(_a, ["activeHelpTopic", "filteredHelpTopics", "isResizable"]);
|
|
2339
|
+
var { activeHelpTopic = null, filteredHelpTopics = [], isResizable = true, onClose } = _a, props = __rest(_a, ["activeHelpTopic", "filteredHelpTopics", "isResizable", "onClose"]);
|
|
2338
2340
|
const { setActiveHelpTopicByName } = React.useContext(HelpTopicContext);
|
|
2339
2341
|
const [isHelpTopicMenuOpen, setIsHelpTopicMenuOpen] = React.useState(false);
|
|
2340
2342
|
const toggleHelpTopicMenu = () => {
|
|
@@ -2345,24 +2347,27 @@ const HelpTopicPanelContent = (_a) => {
|
|
|
2345
2347
|
setActiveHelpTopicByName(topicName);
|
|
2346
2348
|
toggleHelpTopicMenu();
|
|
2347
2349
|
};
|
|
2348
|
-
const menuItems = filteredHelpTopics.
|
|
2349
|
-
|
|
2350
|
-
|
|
2350
|
+
const menuItems = filteredHelpTopics.length > 0 &&
|
|
2351
|
+
filteredHelpTopics.map((topic) => {
|
|
2352
|
+
return (React.createElement(OptionsMenuItem, { key: topic.name, onSelect: onSelectHelpTopic, id: topic.name }, topic.title));
|
|
2353
|
+
});
|
|
2354
|
+
const paddingContainer = (children) => React.createElement("div", { style: { padding: '24px' } }, children);
|
|
2355
|
+
const panelBodyItems = (React.createElement(React.Fragment, null,
|
|
2356
|
+
paddingContainer(React.createElement(QuickStartMarkdownView, { content: activeHelpTopic === null || activeHelpTopic === void 0 ? void 0 : activeHelpTopic.content })),
|
|
2357
|
+
React.createElement(Divider, null),
|
|
2358
|
+
paddingContainer(activeHelpTopic === null || activeHelpTopic === void 0 ? void 0 : activeHelpTopic.links.map((link) => {
|
|
2359
|
+
return React.createElement(QuickStartMarkdownView, { key: link, content: link });
|
|
2360
|
+
}))));
|
|
2351
2361
|
const content = (React.createElement(DrawerPanelContent, Object.assign({ isResizable: isResizable, className: "pfext-quick-start__base" }, props),
|
|
2352
2362
|
React.createElement("div", null,
|
|
2353
2363
|
React.createElement(DrawerHead, null,
|
|
2354
2364
|
React.createElement("div", { className: "pfext-quick-start-panel-content__title" },
|
|
2355
|
-
React.createElement(OptionsMenu, { id: 'helptopics', isPlain: true, isOpen: isHelpTopicMenuOpen, toggle: React.createElement(OptionsMenuToggle, { onToggle: toggleHelpTopicMenu, toggleTemplate: React.createElement(BarsIcon, null) }), menuItems: menuItems }),
|
|
2356
|
-
React.createElement(Title, { headingLevel: "h1", size: "xl", className: "pfext-quick-start-panel-content__name", style: { marginRight: 'var(--pf-global--spacer--md)' } }, activeHelpTopic === null || activeHelpTopic === void 0 ? void 0 : activeHelpTopic.title))
|
|
2365
|
+
menuItems && (React.createElement(OptionsMenu, { id: 'helptopics', isPlain: true, isOpen: isHelpTopicMenuOpen, toggle: React.createElement(OptionsMenuToggle, { style: { paddingLeft: '0px' }, onToggle: toggleHelpTopicMenu, toggleTemplate: React.createElement(BarsIcon, null) }), menuItems: menuItems })),
|
|
2366
|
+
React.createElement(Title, { headingLevel: "h1", size: "xl", className: "pfext-quick-start-panel-content__name", style: { marginRight: 'var(--pf-global--spacer--md)' } }, activeHelpTopic === null || activeHelpTopic === void 0 ? void 0 : activeHelpTopic.title)),
|
|
2367
|
+
React.createElement(DrawerActions, null,
|
|
2368
|
+
React.createElement(DrawerCloseButton, { onClick: onClose, className: "pfext-quick-start-panel-content__close-button", "data-testid": "qs-drawer-close" }))),
|
|
2357
2369
|
React.createElement(Divider, null),
|
|
2358
|
-
React.createElement(DrawerPanelBody, { hasNoPadding: true, className: "pfext-quick-start-panel-content__body", "data-test": "content" },
|
|
2359
|
-
React.createElement(Stack, { hasGutter: true },
|
|
2360
|
-
React.createElement(StackItem, { style: { padding: '20px' } },
|
|
2361
|
-
React.createElement(QuickStartMarkdownView, { content: activeHelpTopic === null || activeHelpTopic === void 0 ? void 0 : activeHelpTopic.content })),
|
|
2362
|
-
React.createElement(Divider, null),
|
|
2363
|
-
React.createElement(StackItem, { style: { padding: '20px' } }, activeHelpTopic === null || activeHelpTopic === void 0 ? void 0 : activeHelpTopic.links.map((link) => {
|
|
2364
|
-
return React.createElement(QuickStartMarkdownView, { key: link, content: link });
|
|
2365
|
-
})))))));
|
|
2370
|
+
React.createElement(DrawerPanelBody, { hasNoPadding: true, className: "pfext-quick-start-panel-content__body", "data-test": "content" }, panelBodyItems))));
|
|
2366
2371
|
return content;
|
|
2367
2372
|
};
|
|
2368
2373
|
|
|
@@ -2376,6 +2381,12 @@ const HelpTopicContainer = (_a) => {
|
|
|
2376
2381
|
valuesForHelpTopicContext.setLoading(loading);
|
|
2377
2382
|
}
|
|
2378
2383
|
}, [loading, valuesForHelpTopicContext]);
|
|
2384
|
+
React.useEffect(() => {
|
|
2385
|
+
if (helpTopics &&
|
|
2386
|
+
JSON.stringify(helpTopics) !== JSON.stringify(valuesForHelpTopicContext.helpTopics)) {
|
|
2387
|
+
valuesForHelpTopicContext.setHelpTopics(helpTopics);
|
|
2388
|
+
}
|
|
2389
|
+
}, [helpTopics, valuesForHelpTopicContext]);
|
|
2379
2390
|
const drawerProps = Object.assign({}, props);
|
|
2380
2391
|
return (React.createElement(HelpTopicContext.Provider, { value: valuesForHelpTopicContext },
|
|
2381
2392
|
React.createElement(HelpTopicDrawer, Object.assign({}, drawerProps), children)));
|
|
@@ -2384,7 +2395,7 @@ const HelpTopicDrawer = (_a) => {
|
|
|
2384
2395
|
var {
|
|
2385
2396
|
// helpTopics,
|
|
2386
2397
|
children } = _a, props = __rest(_a, ["children"]);
|
|
2387
|
-
const { activeHelpTopic, filteredHelpTopics } = React.useContext(HelpTopicContext);
|
|
2398
|
+
const { activeHelpTopic, filteredHelpTopics, setActiveHelpTopicByName } = React.useContext(HelpTopicContext);
|
|
2388
2399
|
// Leave here if query param is desired for help topics later
|
|
2389
2400
|
// React.useEffect(() => {
|
|
2390
2401
|
// const params = new URLSearchParams(window.location.search);
|
|
@@ -2395,7 +2406,10 @@ const HelpTopicDrawer = (_a) => {
|
|
|
2395
2406
|
// setActiveHelpTopicByName(helpTopicNameFromParam);
|
|
2396
2407
|
// }
|
|
2397
2408
|
// }, [inContextHelpTopics, setActiveHelpTopicByName]);
|
|
2398
|
-
const
|
|
2409
|
+
const onClose = () => {
|
|
2410
|
+
setActiveHelpTopicByName('');
|
|
2411
|
+
};
|
|
2412
|
+
const panelContent = (React.createElement(HelpTopicPanelContent, { activeHelpTopic: activeHelpTopic, filteredHelpTopics: filteredHelpTopics, onClose: onClose }));
|
|
2399
2413
|
return (React.createElement(React.Fragment, null,
|
|
2400
2414
|
React.createElement(Drawer, Object.assign({ isExpanded: !!activeHelpTopic, isInline: true }, props), children ? (React.createElement(DrawerContent, { panelContent: panelContent },
|
|
2401
2415
|
React.createElement(DrawerContentBody, { className: "pfext-quick-start-drawer__body" }, children))) : (React.createElement("div", { className: "pf-c-drawer__main" }, panelContent)))));
|