@patternfly/react-core 6.6.1-prerelease.4 → 6.6.1-prerelease.6
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/CHANGELOG.md +16 -0
- package/components/package.json +1 -1
- package/deprecated/package.json +1 -1
- package/dist/dynamic/components/AboutModal/package.json +1 -1
- package/dist/dynamic/components/Accordion/package.json +1 -1
- package/dist/dynamic/components/ActionList/package.json +1 -1
- package/dist/dynamic/components/Alert/package.json +1 -1
- package/dist/dynamic/components/Avatar/package.json +1 -1
- package/dist/dynamic/components/BackToTop/package.json +1 -1
- package/dist/dynamic/components/Backdrop/package.json +1 -1
- package/dist/dynamic/components/BackgroundImage/package.json +1 -1
- package/dist/dynamic/components/Badge/package.json +1 -1
- package/dist/dynamic/components/Banner/package.json +1 -1
- package/dist/dynamic/components/Brand/package.json +1 -1
- package/dist/dynamic/components/Breadcrumb/package.json +1 -1
- package/dist/dynamic/components/Button/package.json +1 -1
- package/dist/dynamic/components/CalendarMonth/package.json +1 -1
- package/dist/dynamic/components/Card/package.json +1 -1
- package/dist/dynamic/components/Checkbox/package.json +1 -1
- package/dist/dynamic/components/ClipboardCopy/package.json +1 -1
- package/dist/dynamic/components/CodeBlock/package.json +1 -1
- package/dist/dynamic/components/Compass/package.json +1 -1
- package/dist/dynamic/components/Content/package.json +1 -1
- package/dist/dynamic/components/DataList/package.json +1 -1
- package/dist/dynamic/components/DatePicker/package.json +1 -1
- package/dist/dynamic/components/DescriptionList/package.json +1 -1
- package/dist/dynamic/components/Divider/package.json +1 -1
- package/dist/dynamic/components/Drawer/package.json +1 -1
- package/dist/dynamic/components/Dropdown/package.json +1 -1
- package/dist/dynamic/components/DualListSelector/package.json +1 -1
- package/dist/dynamic/components/EmptyState/package.json +1 -1
- package/dist/dynamic/components/ExpandableSection/package.json +1 -1
- package/dist/dynamic/components/FileUpload/package.json +1 -1
- package/dist/dynamic/components/Form/package.json +1 -1
- package/dist/dynamic/components/FormSelect/package.json +1 -1
- package/dist/dynamic/components/HelperText/package.json +1 -1
- package/dist/dynamic/components/Hero/package.json +1 -1
- package/dist/dynamic/components/Hint/package.json +1 -1
- package/dist/dynamic/components/Icon/package.json +1 -1
- package/dist/dynamic/components/InputGroup/package.json +1 -1
- package/dist/dynamic/components/JumpLinks/package.json +1 -1
- package/dist/dynamic/components/Label/package.json +1 -1
- package/dist/dynamic/components/List/package.json +1 -1
- package/dist/dynamic/components/LoginPage/package.json +1 -1
- package/dist/dynamic/components/Masthead/package.json +1 -1
- package/dist/dynamic/components/Menu/package.json +1 -1
- package/dist/dynamic/components/MenuToggle/package.json +1 -1
- package/dist/dynamic/components/Modal/package.json +1 -1
- package/dist/dynamic/components/MultipleFileUpload/package.json +1 -1
- package/dist/dynamic/components/Nav/package.json +1 -1
- package/dist/dynamic/components/NotificationBadge/package.json +1 -1
- package/dist/dynamic/components/NotificationDrawer/package.json +1 -1
- package/dist/dynamic/components/NumberInput/package.json +1 -1
- package/dist/dynamic/components/OverflowMenu/package.json +1 -1
- package/dist/dynamic/components/Page/package.json +1 -1
- package/dist/dynamic/components/Pagination/package.json +1 -1
- package/dist/dynamic/components/Panel/package.json +1 -1
- package/dist/dynamic/components/Popover/package.json +1 -1
- package/dist/dynamic/components/Progress/package.json +1 -1
- package/dist/dynamic/components/ProgressStepper/package.json +1 -1
- package/dist/dynamic/components/Radio/package.json +1 -1
- package/dist/dynamic/components/SearchInput/package.json +1 -1
- package/dist/dynamic/components/Select/package.json +1 -1
- package/dist/dynamic/components/Sidebar/package.json +1 -1
- package/dist/dynamic/components/SimpleList/package.json +1 -1
- package/dist/dynamic/components/Skeleton/package.json +1 -1
- package/dist/dynamic/components/SkipToContent/package.json +1 -1
- package/dist/dynamic/components/Slider/package.json +1 -1
- package/dist/dynamic/components/Spinner/package.json +1 -1
- package/dist/dynamic/components/Switch/package.json +1 -1
- package/dist/dynamic/components/Tabs/package.json +1 -1
- package/dist/dynamic/components/TextArea/package.json +1 -1
- package/dist/dynamic/components/TextInput/package.json +1 -1
- package/dist/dynamic/components/TextInputGroup/package.json +1 -1
- package/dist/dynamic/components/TimePicker/package.json +1 -1
- package/dist/dynamic/components/Timestamp/package.json +1 -1
- package/dist/dynamic/components/Title/package.json +1 -1
- package/dist/dynamic/components/ToggleGroup/package.json +1 -1
- package/dist/dynamic/components/Toolbar/package.json +1 -1
- package/dist/dynamic/components/Tooltip/package.json +1 -1
- package/dist/dynamic/components/TreeView/package.json +1 -1
- package/dist/dynamic/components/Truncate/package.json +1 -1
- package/dist/dynamic/components/Wizard/hooks/package.json +1 -1
- package/dist/dynamic/components/Wizard/package.json +1 -1
- package/dist/dynamic/deprecated/components/Chip/package.json +1 -1
- package/dist/dynamic/deprecated/components/DragDrop/package.json +1 -1
- package/dist/dynamic/deprecated/components/DualListSelector/package.json +1 -1
- package/dist/dynamic/deprecated/components/Modal/package.json +1 -1
- package/dist/dynamic/deprecated/components/Tile/package.json +1 -1
- package/dist/dynamic/deprecated/components/Wizard/package.json +1 -1
- package/dist/dynamic/deprecated/components/package.json +1 -1
- package/dist/dynamic/helpers/AnimationsProvider/AnimationsProvider/package.json +1 -1
- package/dist/dynamic/helpers/AnimationsProvider/package.json +1 -1
- package/dist/dynamic/helpers/FocusTrap/FocusTrap/package.json +1 -1
- package/dist/dynamic/helpers/GenerateId/GenerateId/package.json +1 -1
- package/dist/dynamic/helpers/KeyboardHandler/package.json +1 -1
- package/dist/dynamic/helpers/OUIA/ouia/package.json +1 -1
- package/dist/dynamic/helpers/Popper/Popper/package.json +1 -1
- package/dist/dynamic/helpers/SSRSafeIds/SSRSafeIds/package.json +1 -1
- package/dist/dynamic/helpers/constants/package.json +1 -1
- package/dist/dynamic/helpers/datetimeUtils/package.json +1 -1
- package/dist/dynamic/helpers/fileUtils/package.json +1 -1
- package/dist/dynamic/helpers/htmlConstants/package.json +1 -1
- package/dist/dynamic/helpers/inert/package.json +1 -1
- package/dist/dynamic/helpers/package.json +1 -1
- package/dist/dynamic/helpers/resizeObserver/package.json +1 -1
- package/dist/dynamic/helpers/typeUtils/package.json +1 -1
- package/dist/dynamic/helpers/useInterval/package.json +1 -1
- package/dist/dynamic/helpers/useIsomorphicLayout/package.json +1 -1
- package/dist/dynamic/helpers/useSSRSafeId/package.json +1 -1
- package/dist/dynamic/helpers/useUnmountEffect/package.json +1 -1
- package/dist/dynamic/helpers/util/package.json +1 -1
- package/dist/dynamic/layouts/Bullseye/package.json +1 -1
- package/dist/dynamic/layouts/Flex/package.json +1 -1
- package/dist/dynamic/layouts/Gallery/package.json +1 -1
- package/dist/dynamic/layouts/Grid/package.json +1 -1
- package/dist/dynamic/layouts/Level/package.json +1 -1
- package/dist/dynamic/layouts/Split/package.json +1 -1
- package/dist/dynamic/layouts/Stack/package.json +1 -1
- package/dist/dynamic/styles/package.json +1 -1
- package/dist/dynamic-modules.json +3 -0
- package/dist/esm/components/Compass/Compass.d.ts +2 -0
- package/dist/esm/components/Compass/Compass.d.ts.map +1 -1
- package/dist/esm/components/Compass/Compass.js +2 -2
- package/dist/esm/components/Compass/Compass.js.map +1 -1
- package/dist/esm/components/Nav/NavExpandable.d.ts +2 -0
- package/dist/esm/components/Nav/NavExpandable.d.ts.map +1 -1
- package/dist/esm/components/Nav/NavExpandable.js +6 -4
- package/dist/esm/components/Nav/NavExpandable.js.map +1 -1
- package/dist/esm/components/Page/Page.d.ts +6 -1
- package/dist/esm/components/Page/Page.d.ts.map +1 -1
- package/dist/esm/components/Page/Page.js +4 -3
- package/dist/esm/components/Page/Page.js.map +1 -1
- package/dist/esm/components/Page/PageHeader.d.ts +11 -0
- package/dist/esm/components/Page/PageHeader.d.ts.map +1 -0
- package/dist/esm/components/Page/PageHeader.js +11 -0
- package/dist/esm/components/Page/PageHeader.js.map +1 -0
- package/dist/esm/components/Page/index.d.ts +1 -0
- package/dist/esm/components/Page/index.d.ts.map +1 -1
- package/dist/esm/components/Page/index.js +1 -0
- package/dist/esm/components/Page/index.js.map +1 -1
- package/dist/esm/helpers/index.d.ts +1 -0
- package/dist/esm/helpers/index.d.ts.map +1 -1
- package/dist/esm/helpers/index.js +1 -0
- package/dist/esm/helpers/index.js.map +1 -1
- package/dist/js/components/Compass/Compass.d.ts +2 -0
- package/dist/js/components/Compass/Compass.d.ts.map +1 -1
- package/dist/js/components/Compass/Compass.js +2 -2
- package/dist/js/components/Compass/Compass.js.map +1 -1
- package/dist/js/components/Nav/NavExpandable.d.ts +2 -0
- package/dist/js/components/Nav/NavExpandable.d.ts.map +1 -1
- package/dist/js/components/Nav/NavExpandable.js +6 -4
- package/dist/js/components/Nav/NavExpandable.js.map +1 -1
- package/dist/js/components/Page/Page.d.ts +6 -1
- package/dist/js/components/Page/Page.d.ts.map +1 -1
- package/dist/js/components/Page/Page.js +4 -3
- package/dist/js/components/Page/Page.js.map +1 -1
- package/dist/js/components/Page/PageHeader.d.ts +11 -0
- package/dist/js/components/Page/PageHeader.d.ts.map +1 -0
- package/dist/js/components/Page/PageHeader.js +15 -0
- package/dist/js/components/Page/PageHeader.js.map +1 -0
- package/dist/js/components/Page/index.d.ts +1 -0
- package/dist/js/components/Page/index.d.ts.map +1 -1
- package/dist/js/components/Page/index.js +1 -0
- package/dist/js/components/Page/index.js.map +1 -1
- package/dist/js/helpers/index.d.ts +1 -0
- package/dist/js/helpers/index.d.ts.map +1 -1
- package/dist/js/helpers/index.js +1 -0
- package/dist/js/helpers/index.js.map +1 -1
- package/dist/umd/assets/{output-CB485rDk.css → output-C3dFbrt3.css} +16242 -16164
- package/dist/umd/react-core.min.js +3 -3
- package/helpers/package.json +1 -1
- package/layouts/package.json +1 -1
- package/next/package.json +1 -1
- package/package.json +6 -6
- package/src/components/Compass/Compass.tsx +4 -0
- package/src/components/Compass/__tests__/Compass.test.tsx +15 -0
- package/src/components/List/__tests__/__snapshots__/ListItem.test.tsx.snap +1 -3
- package/src/components/Nav/NavExpandable.tsx +12 -2
- package/src/components/Nav/__tests__/Generated/__snapshots__/NavExpandable.test.tsx.snap +5 -1
- package/src/components/Nav/__tests__/NavExpandable.test.tsx +21 -0
- package/src/components/Nav/__tests__/__snapshots__/Nav.test.tsx.snap +15 -4
- package/src/components/Nav/examples/Nav.md +17 -4
- package/src/components/Nav/examples/NavDocked.tsx +98 -0
- package/src/components/Nav/examples/NavIcons.tsx +8 -8
- package/src/components/Page/Page.tsx +9 -1
- package/src/components/Page/PageHeader.tsx +28 -0
- package/src/components/Page/__tests__/Page.test.tsx +33 -0
- package/src/components/Page/__tests__/PageHeader.test.tsx +33 -0
- package/src/components/Page/examples/Page.md +19 -2
- package/src/components/Page/examples/PageHeaderContent.tsx +19 -0
- package/src/components/Page/index.ts +1 -0
- package/src/components/SearchInput/__tests__/__snapshots__/SearchInput.test.tsx.snap +2 -8
- package/src/components/ToggleGroup/__tests__/__snapshots__/ToggleGroupItemElement.test.tsx.snap +1 -3
- package/src/demos/Compass/Compass.md +3 -1
- package/src/demos/Compass/examples/CompassDockDemo.tsx +111 -5
- package/src/demos/Nav.md +4 -2
- package/src/demos/examples/Nav/NavDockedNav.tsx +113 -7
- package/src/helpers/index.ts +1 -0
- package/src/layouts/Flex/__tests__/__snapshots__/Flex.test.tsx.snap +3 -9
package/helpers/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"@patternfly/react-core-helpers","main":"../dist/js/helpers/index.js","module":"../dist/esm/helpers/index.js","typings":"../dist/esm/helpers/index.d.ts","version":"6.6.1-prerelease.
|
|
1
|
+
{"name":"@patternfly/react-core-helpers","main":"../dist/js/helpers/index.js","module":"../dist/esm/helpers/index.js","typings":"../dist/esm/helpers/index.d.ts","version":"6.6.1-prerelease.5","private":true}
|
package/layouts/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"@patternfly/react-core-layouts","main":"../dist/js/layouts/index.js","module":"../dist/esm/layouts/index.js","typings":"../dist/esm/layouts/index.d.ts","version":"6.6.1-prerelease.
|
|
1
|
+
{"name":"@patternfly/react-core-layouts","main":"../dist/js/layouts/index.js","module":"../dist/esm/layouts/index.js","typings":"../dist/esm/layouts/index.d.ts","version":"6.6.1-prerelease.5","private":true}
|
package/next/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"@patternfly/react-core-next","main":"../dist/js/next/index.js","module":"../dist/esm/next/index.js","typings":"../dist/esm/next/index.d.ts","version":"6.6.1-prerelease.
|
|
1
|
+
{"name":"@patternfly/react-core-next","main":"../dist/js/next/index.js","module":"../dist/esm/next/index.js","typings":"../dist/esm/next/index.d.ts","version":"6.6.1-prerelease.5","private":true}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@patternfly/react-core",
|
|
3
|
-
"version": "6.6.1-prerelease.
|
|
3
|
+
"version": "6.6.1-prerelease.6",
|
|
4
4
|
"description": "This library provides a set of common React components for use with the PatternFly reference implementation.",
|
|
5
5
|
"main": "dist/js/index.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -46,15 +46,15 @@
|
|
|
46
46
|
"subpaths": "node ../../scripts/exportSubpaths.mjs --config subpaths.config.json"
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@patternfly/react-icons": "^6.6.1-prerelease.
|
|
50
|
-
"@patternfly/react-styles": "^6.6.1-prerelease.
|
|
51
|
-
"@patternfly/react-tokens": "^6.6.1-prerelease.
|
|
49
|
+
"@patternfly/react-icons": "^6.6.1-prerelease.1",
|
|
50
|
+
"@patternfly/react-styles": "^6.6.1-prerelease.1",
|
|
51
|
+
"@patternfly/react-tokens": "^6.6.1-prerelease.1",
|
|
52
52
|
"focus-trap": "7.6.6",
|
|
53
53
|
"react-dropzone": "^14.3.5",
|
|
54
54
|
"tslib": "^2.8.1"
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
|
-
"@patternfly/patternfly": "6.6.0-prerelease.
|
|
57
|
+
"@patternfly/patternfly": "6.6.0-prerelease.39",
|
|
58
58
|
"case-anything": "^3.1.2",
|
|
59
59
|
"css": "^3.0.0",
|
|
60
60
|
"fs-extra": "^11.3.3"
|
|
@@ -63,5 +63,5 @@
|
|
|
63
63
|
"react": "^17 || ^18 || ^19",
|
|
64
64
|
"react-dom": "^17 || ^18 || ^19"
|
|
65
65
|
},
|
|
66
|
-
"gitHead": "
|
|
66
|
+
"gitHead": "652853d353e9440be40a7fbb8dfc04706137558a"
|
|
67
67
|
}
|
|
@@ -12,6 +12,8 @@ export interface CompassProps extends React.HTMLProps<HTMLDivElement> {
|
|
|
12
12
|
dock?: React.ReactNode;
|
|
13
13
|
/** @beta Flag indicating the docked nav is expanded on mobile. Only applies when dock content is passed. */
|
|
14
14
|
isDockExpanded?: boolean;
|
|
15
|
+
/** @beta Flag indicating a docked nav is expanded as an overlay, triggered by expandable nav children. Only applies when dock content is passed. */
|
|
16
|
+
isDockExpandableExpanded?: boolean;
|
|
15
17
|
/** @beta Flag indicating the docked nav should display text on desktop. Only applies when dock content is passed, and
|
|
16
18
|
* will handle toggling the visibility of the text in individual isDocked components.
|
|
17
19
|
*/
|
|
@@ -45,6 +47,7 @@ export const Compass: React.FunctionComponent<CompassProps> = ({
|
|
|
45
47
|
masthead,
|
|
46
48
|
dock,
|
|
47
49
|
isDockExpanded,
|
|
50
|
+
isDockExpandableExpanded,
|
|
48
51
|
isDockTextExpanded,
|
|
49
52
|
header,
|
|
50
53
|
isHeaderExpanded = true,
|
|
@@ -69,6 +72,7 @@ export const Compass: React.FunctionComponent<CompassProps> = ({
|
|
|
69
72
|
className={css(
|
|
70
73
|
`${styles.compass}__dock`,
|
|
71
74
|
isDockExpanded && styles.modifiers.expanded,
|
|
75
|
+
isDockExpandableExpanded && styles.modifiers.expandableExpanded,
|
|
72
76
|
isDockTextExpanded && styles.modifiers.textExpanded
|
|
73
77
|
)}
|
|
74
78
|
>
|
|
@@ -94,6 +94,21 @@ test('Renders footer without expanded class and with inert when isFooterExpanded
|
|
|
94
94
|
expect(footerElement).toHaveAttribute('inert');
|
|
95
95
|
});
|
|
96
96
|
|
|
97
|
+
test(`Renders with ${styles.modifiers.expandableExpanded} class when isDockExpandableExpanded is true`, () => {
|
|
98
|
+
render(<Compass dock={<div>Dock content</div>} isDockExpandableExpanded />);
|
|
99
|
+
expect(screen.getByText('Dock content').parentElement).toHaveClass(styles.modifiers.expandableExpanded);
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
test(`Does not render with ${styles.modifiers.expandableExpanded} class when isDockExpandableExpanded is false`, () => {
|
|
103
|
+
render(<Compass dock={<div>Dock content</div>} isDockExpandableExpanded={false} />);
|
|
104
|
+
expect(screen.getByText('Dock content').parentElement).not.toHaveClass(styles.modifiers.expandableExpanded);
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
test(`Does not render with ${styles.modifiers.expandableExpanded} class by default`, () => {
|
|
108
|
+
render(<Compass dock={<div>Dock content</div>} />);
|
|
109
|
+
expect(screen.getByText('Dock content').parentElement).not.toHaveClass(styles.modifiers.expandableExpanded);
|
|
110
|
+
});
|
|
111
|
+
|
|
97
112
|
test('Renders with drawer when drawerContent is provided', () => {
|
|
98
113
|
render(<Compass drawerContent={<div>Drawer content</div>} />);
|
|
99
114
|
expect(screen.getByText('Drawer content')).toBeVisible();
|
|
@@ -8,6 +8,7 @@ import { PickOptional } from '../../helpers/typeUtils';
|
|
|
8
8
|
import { getOUIAProps, OUIAProps } from '../../helpers';
|
|
9
9
|
import { SSRSafeIds } from '../../helpers/SSRSafeIds/SSRSafeIds';
|
|
10
10
|
import { IS_INERT } from '../../helpers/inert';
|
|
11
|
+
import RhUiEllipsisHorizontalFillIcon from '@patternfly/react-icons/dist/esm/icons/rh-ui-ellipsis-horizontal-fill-icon';
|
|
11
12
|
|
|
12
13
|
export interface NavExpandableProps
|
|
13
14
|
extends Omit<React.DetailedHTMLProps<React.LiHTMLAttributes<HTMLLIElement>, HTMLLIElement>, 'title'>, OUIAProps {
|
|
@@ -17,6 +18,8 @@ export interface NavExpandableProps
|
|
|
17
18
|
srText?: string;
|
|
18
19
|
/** Boolean to pragmatically expand or collapse section */
|
|
19
20
|
isExpanded?: boolean;
|
|
21
|
+
/** Adds an expandable icon to indicate the section is expandable */
|
|
22
|
+
hasExpandableIcon?: boolean;
|
|
20
23
|
/** Anything that can be rendered inside of the expandable list */
|
|
21
24
|
children?: React.ReactNode;
|
|
22
25
|
/** Additional classes added to the container */
|
|
@@ -50,7 +53,8 @@ class NavExpandable extends Component<NavExpandableProps, NavExpandableState> {
|
|
|
50
53
|
className: '',
|
|
51
54
|
groupId: null as string,
|
|
52
55
|
isActive: false,
|
|
53
|
-
id: ''
|
|
56
|
+
id: '',
|
|
57
|
+
hasExpandableIcon: false
|
|
54
58
|
};
|
|
55
59
|
|
|
56
60
|
state = {
|
|
@@ -100,6 +104,7 @@ class NavExpandable extends Component<NavExpandableProps, NavExpandableState> {
|
|
|
100
104
|
id,
|
|
101
105
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
102
106
|
isExpanded,
|
|
107
|
+
hasExpandableIcon,
|
|
103
108
|
buttonProps,
|
|
104
109
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
105
110
|
onExpand,
|
|
@@ -137,7 +142,12 @@ class NavExpandable extends Component<NavExpandableProps, NavExpandableState> {
|
|
|
137
142
|
{...buttonProps}
|
|
138
143
|
>
|
|
139
144
|
{icon && <span className={css(styles.navLinkIcon)}>{icon}</span>}
|
|
140
|
-
{
|
|
145
|
+
{hasExpandableIcon && (
|
|
146
|
+
<span className={css(styles.navLinkExpandableIcon)}>
|
|
147
|
+
<RhUiEllipsisHorizontalFillIcon />
|
|
148
|
+
</span>
|
|
149
|
+
)}
|
|
150
|
+
<span className={css(styles.navLinkText)}>{title}</span>
|
|
141
151
|
<span className={css(styles.navToggle)}>
|
|
142
152
|
<span className={css(styles.navToggleIcon)}>
|
|
143
153
|
<RhMicronsCaretDownIcon />
|
|
@@ -12,7 +12,11 @@ exports[`NavExpandable should match snapshot (auto-generated) 1`] = `
|
|
|
12
12
|
aria-expanded="false"
|
|
13
13
|
class="pf-v6-c-nav__link"
|
|
14
14
|
>
|
|
15
|
-
|
|
15
|
+
<span
|
|
16
|
+
class="pf-v6-c-nav__link-text"
|
|
17
|
+
>
|
|
18
|
+
string
|
|
19
|
+
</span>
|
|
16
20
|
<span
|
|
17
21
|
class="pf-v6-c-nav__toggle"
|
|
18
22
|
>
|
|
@@ -30,3 +30,24 @@ test('Does not render nav link icon wrapper when icon prop is not provided', ()
|
|
|
30
30
|
const button = screen.getByRole('button', { name: 'NavExpandable' });
|
|
31
31
|
expect(button.querySelector('.pf-v6-c-nav__link-icon')).not.toBeInTheDocument();
|
|
32
32
|
});
|
|
33
|
+
|
|
34
|
+
test(`Renders with expandable icon when hasExpandableIcon is true`, () => {
|
|
35
|
+
render(<NavExpandable id="grp-1" title="NavExpandable" hasExpandableIcon={true}></NavExpandable>);
|
|
36
|
+
|
|
37
|
+
const button = screen.getByRole('button', { name: 'NavExpandable' });
|
|
38
|
+
expect(button.querySelector('.pf-v6-c-nav__link-expandable-icon')).toBeInTheDocument();
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
test(`Does not render expandable icon when hasExpandableIcon is false`, () => {
|
|
42
|
+
render(<NavExpandable id="grp-1" title="NavExpandable" hasExpandableIcon={false}></NavExpandable>);
|
|
43
|
+
|
|
44
|
+
const button = screen.getByRole('button', { name: 'NavExpandable' });
|
|
45
|
+
expect(button.querySelector('.pf-v6-c-nav__link-expandable-icon')).not.toBeInTheDocument();
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
test(`Does not render expandable icon by default`, () => {
|
|
49
|
+
render(<NavExpandable id="grp-1" title="NavExpandable"></NavExpandable>);
|
|
50
|
+
|
|
51
|
+
const button = screen.getByRole('button', { name: 'NavExpandable' });
|
|
52
|
+
expect(button.querySelector('.pf-v6-c-nav__link-expandable-icon')).not.toBeInTheDocument();
|
|
53
|
+
});
|
|
@@ -196,7 +196,11 @@ exports[`Nav Expandable Nav List - Trigger toggle 1`] = `
|
|
|
196
196
|
class="pf-v6-c-nav__link"
|
|
197
197
|
id="grp-1"
|
|
198
198
|
>
|
|
199
|
-
|
|
199
|
+
<span
|
|
200
|
+
class="pf-v6-c-nav__link-text"
|
|
201
|
+
>
|
|
202
|
+
Section 1
|
|
203
|
+
</span>
|
|
200
204
|
<span
|
|
201
205
|
class="pf-v6-c-nav__toggle"
|
|
202
206
|
>
|
|
@@ -329,7 +333,11 @@ exports[`Nav Expandable Nav List 1`] = `
|
|
|
329
333
|
class="pf-v6-c-nav__link"
|
|
330
334
|
id="grp-1"
|
|
331
335
|
>
|
|
332
|
-
|
|
336
|
+
<span
|
|
337
|
+
class="pf-v6-c-nav__link-text"
|
|
338
|
+
>
|
|
339
|
+
Section 1
|
|
340
|
+
</span>
|
|
333
341
|
<span
|
|
334
342
|
class="pf-v6-c-nav__toggle"
|
|
335
343
|
>
|
|
@@ -461,7 +469,11 @@ exports[`Nav Expandable Nav List with aria label 1`] = `
|
|
|
461
469
|
aria-expanded="false"
|
|
462
470
|
class="pf-v6-c-nav__link"
|
|
463
471
|
>
|
|
464
|
-
|
|
472
|
+
<span
|
|
473
|
+
class="pf-v6-c-nav__link-text"
|
|
474
|
+
>
|
|
475
|
+
Section 1
|
|
476
|
+
</span>
|
|
465
477
|
<span
|
|
466
478
|
class="pf-v6-c-nav__toggle"
|
|
467
479
|
>
|
|
@@ -1017,7 +1029,6 @@ exports[`Nav Nav List with flyout 1`] = `
|
|
|
1017
1029
|
</li>
|
|
1018
1030
|
</ul>
|
|
1019
1031
|
<div
|
|
1020
|
-
class=""
|
|
1021
1032
|
data-popper-escaped="true"
|
|
1022
1033
|
data-popper-placement="right-start"
|
|
1023
1034
|
data-popper-reference-hidden="true"
|
|
@@ -9,11 +9,12 @@ ouia: true
|
|
|
9
9
|
import { useState } from 'react';
|
|
10
10
|
import './nav.css';
|
|
11
11
|
import RhMicronsCaretRightIcon from '@patternfly/react-icons/dist/esm/icons/rh-microns-caret-right-icon';
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import
|
|
12
|
+
import RhUiCubesIcon from '@patternfly/react-icons/dist/esm/icons/rh-ui-cubes-icon';
|
|
13
|
+
import RhUiFolderIcon from '@patternfly/react-icons/dist/esm/icons/rh-ui-folder-icon';
|
|
14
|
+
import RhUiFolderOpenIcon from '@patternfly/react-icons/dist/esm/icons/rh-ui-folder-open-icon';
|
|
15
|
+
import RhUiCloudIcon from '@patternfly/react-icons/dist/esm/icons/rh-ui-cloud-icon';
|
|
16
16
|
import RhUiLinkIcon from '@patternfly/react-icons/dist/esm/icons/rh-ui-link-icon';
|
|
17
|
+
import RhUiCodeIcon from '@patternfly/react-icons/dist/esm/icons/rh-ui-code-icon';
|
|
17
18
|
|
|
18
19
|
## Examples
|
|
19
20
|
|
|
@@ -81,6 +82,18 @@ A flyout should be a `Menu` component. Press `space` or `right arrow` to open a
|
|
|
81
82
|
|
|
82
83
|
```
|
|
83
84
|
|
|
85
|
+
### Docked
|
|
86
|
+
|
|
87
|
+
The docked variant of `Navigation` displays only icons passed to child `NavItems` or `NavExpandable`. Text becomes visible when `isDockTextExpanded` or `isDockExpandableExpanded` are applied to an outer page or compass dock.
|
|
88
|
+
|
|
89
|
+
`NavExpandable` items should include the `hasExpandableIcon` prop to indicate their expandable nature while in the collapsed state of the docked nav as the caret will not be rendered.
|
|
90
|
+
|
|
91
|
+
See the [docked nav demo](/components/navigation/react-demos#docked-nav) for a fully functional example.
|
|
92
|
+
|
|
93
|
+
```ts file="./NavDocked.tsx"
|
|
94
|
+
|
|
95
|
+
```
|
|
96
|
+
|
|
84
97
|
## Types
|
|
85
98
|
|
|
86
99
|
### NavSelectClickHandler
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { useState } from 'react';
|
|
2
|
+
import { Nav, NavItem, NavList, NavExpandable } from '@patternfly/react-core';
|
|
3
|
+
import RhUiCubesIcon from '@patternfly/react-icons/dist/esm/icons/rh-ui-cubes-icon';
|
|
4
|
+
import RhUiFolderIcon from '@patternfly/react-icons/dist/esm/icons/rh-ui-folder-icon';
|
|
5
|
+
import RhUiCodeIcon from '@patternfly/react-icons/dist/esm/icons/rh-ui-code-icon';
|
|
6
|
+
import RhUiCloudIcon from '@patternfly/react-icons/dist/esm/icons/rh-ui-cloud-icon';
|
|
7
|
+
|
|
8
|
+
export const NavDocked: React.FunctionComponent = () => {
|
|
9
|
+
const [activeItem, setActiveItem] = useState(0);
|
|
10
|
+
const [isGroupExpanded, setIsGroupExpanded] = useState(false);
|
|
11
|
+
|
|
12
|
+
const onSelect = (_event: React.FormEvent<HTMLInputElement>, result: { itemId: number | string }) => {
|
|
13
|
+
setActiveItem(result.itemId as number);
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
const onToggle = (
|
|
17
|
+
_event: React.MouseEvent<HTMLButtonElement>,
|
|
18
|
+
result: { groupId: number | string; isExpanded: boolean }
|
|
19
|
+
) => {
|
|
20
|
+
setIsGroupExpanded(result.isExpanded);
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
return (
|
|
24
|
+
<Nav variant="docked" onSelect={onSelect} onToggle={onToggle} aria-label="Default global" ouiaId="DefaultNav">
|
|
25
|
+
<NavList>
|
|
26
|
+
<NavItem
|
|
27
|
+
icon={<RhUiCubesIcon />}
|
|
28
|
+
preventDefault
|
|
29
|
+
id="nav-default-link1"
|
|
30
|
+
to="#nav-default-link1"
|
|
31
|
+
itemId={0}
|
|
32
|
+
isActive={activeItem === 0}
|
|
33
|
+
>
|
|
34
|
+
Default Link 1
|
|
35
|
+
</NavItem>
|
|
36
|
+
<NavItem
|
|
37
|
+
icon={<RhUiCloudIcon />}
|
|
38
|
+
preventDefault
|
|
39
|
+
id="nav-default-link2"
|
|
40
|
+
to="#nav-default-link2"
|
|
41
|
+
itemId={1}
|
|
42
|
+
isActive={activeItem === 1}
|
|
43
|
+
>
|
|
44
|
+
Default Link 2
|
|
45
|
+
</NavItem>
|
|
46
|
+
<NavItem
|
|
47
|
+
icon={<RhUiCodeIcon />}
|
|
48
|
+
preventDefault
|
|
49
|
+
id="nav-default-link3"
|
|
50
|
+
to="#nav-default-link3"
|
|
51
|
+
itemId={2}
|
|
52
|
+
isActive={activeItem === 2}
|
|
53
|
+
>
|
|
54
|
+
Default Link 3
|
|
55
|
+
</NavItem>
|
|
56
|
+
<NavExpandable
|
|
57
|
+
title="Expandable Group 1"
|
|
58
|
+
groupId="nav-expandable-group-1"
|
|
59
|
+
icon={<RhUiFolderIcon />}
|
|
60
|
+
isExpanded={isGroupExpanded}
|
|
61
|
+
hasExpandableIcon
|
|
62
|
+
buttonProps={{ 'aria-label': 'Expandable Group 1' }}
|
|
63
|
+
>
|
|
64
|
+
<NavItem
|
|
65
|
+
preventDefault
|
|
66
|
+
id="expandable-1"
|
|
67
|
+
to="#expandable-1"
|
|
68
|
+
groupId="nav-expandable-group-1"
|
|
69
|
+
itemId={3}
|
|
70
|
+
isActive={activeItem === 3}
|
|
71
|
+
>
|
|
72
|
+
Subnav 1 Link 1
|
|
73
|
+
</NavItem>
|
|
74
|
+
<NavItem
|
|
75
|
+
preventDefault
|
|
76
|
+
id="expandable-2"
|
|
77
|
+
to="#expandable-2"
|
|
78
|
+
groupId="nav-expandable-group-1"
|
|
79
|
+
itemId={4}
|
|
80
|
+
isActive={activeItem === 4}
|
|
81
|
+
>
|
|
82
|
+
Subnav 1 Link 2
|
|
83
|
+
</NavItem>
|
|
84
|
+
<NavItem
|
|
85
|
+
preventDefault
|
|
86
|
+
id="expandable-3"
|
|
87
|
+
to="#expandable-3"
|
|
88
|
+
groupId="nav-expandable-group-1"
|
|
89
|
+
itemId={5}
|
|
90
|
+
isActive={activeItem === 5}
|
|
91
|
+
>
|
|
92
|
+
Subnav 1 Link 3
|
|
93
|
+
</NavItem>
|
|
94
|
+
</NavExpandable>
|
|
95
|
+
</NavList>
|
|
96
|
+
</Nav>
|
|
97
|
+
);
|
|
98
|
+
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { useState } from 'react';
|
|
2
2
|
import { Nav, NavExpandable, NavItem, NavList } from '@patternfly/react-core';
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
3
|
+
import RhUiCubesIcon from '@patternfly/react-icons/dist/esm/icons/rh-ui-cubes-icon';
|
|
4
|
+
import RhUiFolderIcon from '@patternfly/react-icons/dist/esm/icons/rh-ui-folder-icon';
|
|
5
|
+
import RhUiFolderOpenIcon from '@patternfly/react-icons/dist/esm/icons/rh-ui-folder-open-icon';
|
|
6
|
+
import RhUiCloudIcon from '@patternfly/react-icons/dist/esm/icons/rh-ui-cloud-icon';
|
|
7
7
|
import RhUiLinkIcon from '@patternfly/react-icons/dist/esm/icons/rh-ui-link-icon';
|
|
8
8
|
|
|
9
9
|
export const NavIcons: React.FunctionComponent = () => {
|
|
@@ -22,7 +22,7 @@ export const NavIcons: React.FunctionComponent = () => {
|
|
|
22
22
|
to="#nav-icon-link1"
|
|
23
23
|
itemId={0}
|
|
24
24
|
isActive={activeItem === 0}
|
|
25
|
-
icon={<
|
|
25
|
+
icon={<RhUiCubesIcon />}
|
|
26
26
|
>
|
|
27
27
|
Link 1
|
|
28
28
|
</NavItem>
|
|
@@ -32,7 +32,7 @@ export const NavIcons: React.FunctionComponent = () => {
|
|
|
32
32
|
to="#nav-icon-link2"
|
|
33
33
|
itemId={1}
|
|
34
34
|
isActive={activeItem === 1}
|
|
35
|
-
icon={<
|
|
35
|
+
icon={<RhUiFolderIcon />}
|
|
36
36
|
>
|
|
37
37
|
Link 2
|
|
38
38
|
</NavItem>
|
|
@@ -42,7 +42,7 @@ export const NavIcons: React.FunctionComponent = () => {
|
|
|
42
42
|
to="#nav-icon-link3"
|
|
43
43
|
itemId={2}
|
|
44
44
|
isActive={activeItem === 2}
|
|
45
|
-
icon={<
|
|
45
|
+
icon={<RhUiCloudIcon />}
|
|
46
46
|
>
|
|
47
47
|
Link 3
|
|
48
48
|
</NavItem>
|
|
@@ -56,7 +56,7 @@ export const NavIcons: React.FunctionComponent = () => {
|
|
|
56
56
|
>
|
|
57
57
|
Link 4
|
|
58
58
|
</NavItem>
|
|
59
|
-
<NavExpandable title="Expandable" icon={<
|
|
59
|
+
<NavExpandable title="Expandable" icon={<RhUiFolderOpenIcon />} groupId="nav-icon-expandable">
|
|
60
60
|
<NavItem
|
|
61
61
|
preventDefault
|
|
62
62
|
id="nav-icon-expandable-link1"
|
|
@@ -24,11 +24,16 @@ export interface PageProps extends React.HTMLProps<HTMLDivElement> {
|
|
|
24
24
|
variant?: 'default' | 'docked';
|
|
25
25
|
/** @beta Flag indicating the docked nav is expanded on mobile. Only applies when variant is docked. */
|
|
26
26
|
isDockExpanded?: boolean;
|
|
27
|
+
/** @beta Flag indicating a docked nav is expanded as an overlay, triggered by expandable nav children. Only applies when dock content is passed. */
|
|
28
|
+
isDockExpandableExpanded?: boolean;
|
|
27
29
|
/** @beta Flag indicating the docked nav should display text on desktop. Only applies when variant is docked, and
|
|
28
30
|
* will handle toggling the visibility of the text in individual isDocked components.
|
|
29
31
|
*/
|
|
30
32
|
isDockTextExpanded?: boolean;
|
|
31
|
-
/** The horizontal masthead content (e.g. <Masthead />
|
|
33
|
+
/** The horizontal masthead content (e.g. <Masthead /> or <PageHeader />). PageHeader is an alternative to Masthead
|
|
34
|
+
* and should only be used to wrap custom header content. When using the docked variant, this content will only render at
|
|
35
|
+
* mobile viewports.
|
|
36
|
+
*/
|
|
32
37
|
masthead?: React.ReactNode;
|
|
33
38
|
/** @beta Content to render in the vertical dock when variant of docked is used. At mobile viewports, this content will be replaced with the content passed to masthead. */
|
|
34
39
|
dockContent?: React.ReactNode;
|
|
@@ -131,6 +136,7 @@ class Page extends Component<PageProps, PageState> {
|
|
|
131
136
|
defaultManagedSidebarIsOpen: true,
|
|
132
137
|
mainTabIndex: -1,
|
|
133
138
|
isNotificationDrawerExpanded: false,
|
|
139
|
+
isDockExpandableExpanded: false,
|
|
134
140
|
onNotificationDrawerExpand: () => null,
|
|
135
141
|
mainComponent: 'main',
|
|
136
142
|
getBreakpoint,
|
|
@@ -245,6 +251,7 @@ class Page extends Component<PageProps, PageState> {
|
|
|
245
251
|
variant,
|
|
246
252
|
isDockExpanded = false,
|
|
247
253
|
isDockTextExpanded = false,
|
|
254
|
+
isDockExpandableExpanded = false,
|
|
248
255
|
masthead,
|
|
249
256
|
dockContent,
|
|
250
257
|
sidebar,
|
|
@@ -371,6 +378,7 @@ class Page extends Component<PageProps, PageState> {
|
|
|
371
378
|
className={css(
|
|
372
379
|
styles.pageDock,
|
|
373
380
|
isDockExpanded && styles.modifiers.expanded,
|
|
381
|
+
isDockExpandableExpanded && styles.modifiers.expandableExpanded,
|
|
374
382
|
isDockTextExpanded && styles.modifiers.textExpanded
|
|
375
383
|
)}
|
|
376
384
|
>
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import styles from '@patternfly/react-styles/css/components/Page/page';
|
|
2
|
+
import { css } from '@patternfly/react-styles';
|
|
3
|
+
|
|
4
|
+
export interface PageHeaderProps extends React.HTMLProps<HTMLElement> {
|
|
5
|
+
/** Content rendered inside the page header. This should be custom header content, rather than the PatternFly Masthead. */
|
|
6
|
+
children?: React.ReactNode;
|
|
7
|
+
/** Additional classes added to the page header */
|
|
8
|
+
className?: string;
|
|
9
|
+
/** Sets the base component to render. Defaults to header */
|
|
10
|
+
component?: keyof React.JSX.IntrinsicElements;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export const PageHeader: React.FunctionComponent<PageHeaderProps> = ({
|
|
14
|
+
className,
|
|
15
|
+
children,
|
|
16
|
+
component = 'header',
|
|
17
|
+
...props
|
|
18
|
+
}: PageHeaderProps) => {
|
|
19
|
+
const Component = component as any;
|
|
20
|
+
|
|
21
|
+
return (
|
|
22
|
+
<Component {...props} className={css(styles.pageHeader, className)}>
|
|
23
|
+
{children}
|
|
24
|
+
</Component>
|
|
25
|
+
);
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
PageHeader.displayName = 'PageHeader';
|
|
@@ -9,6 +9,7 @@ import { Nav, NavList, NavItem } from '../../Nav';
|
|
|
9
9
|
import { SkipToContent } from '../../SkipToContent';
|
|
10
10
|
import { PageBreadcrumb } from '../PageBreadcrumb';
|
|
11
11
|
import { PageGroup } from '../PageGroup';
|
|
12
|
+
import { PageHeader } from '../PageHeader';
|
|
12
13
|
import { Masthead } from '../../Masthead';
|
|
13
14
|
|
|
14
15
|
import styles from '@patternfly/react-styles/css/components/Page/page';
|
|
@@ -481,10 +482,42 @@ describe('Page docked variant', () => {
|
|
|
481
482
|
expect(pageDock).toHaveClass(styles.modifiers.textExpanded);
|
|
482
483
|
});
|
|
483
484
|
|
|
485
|
+
test(`Does not render with ${styles.modifiers.expandableExpanded} when by default and variant is docked`, () => {
|
|
486
|
+
render(<Page variant="docked" dockContent={<>Dock content</>} masthead={<>Masthead</>} data-testid="page"></Page>);
|
|
487
|
+
const pageDock = screen.getByText('Dock content').closest(`.${styles.pageDock}`);
|
|
488
|
+
expect(pageDock).not.toHaveClass(styles.modifiers.expandableExpanded);
|
|
489
|
+
});
|
|
490
|
+
|
|
491
|
+
test(`Renders with ${styles.modifiers.expandableExpanded} when isDockExpandableExpanded is true and variant is docked`, () => {
|
|
492
|
+
render(
|
|
493
|
+
<Page
|
|
494
|
+
variant="docked"
|
|
495
|
+
isDockExpandableExpanded
|
|
496
|
+
dockContent={<>Dock content</>}
|
|
497
|
+
masthead={<>Masthead</>}
|
|
498
|
+
data-testid="page"
|
|
499
|
+
></Page>
|
|
500
|
+
);
|
|
501
|
+
const pageDock = screen.getByText('Dock content').closest(`.${styles.pageDock}`);
|
|
502
|
+
expect(pageDock).toHaveClass(styles.modifiers.expandableExpanded);
|
|
503
|
+
});
|
|
504
|
+
|
|
484
505
|
test(`Renders with ${styles.pageDockMain} wrapper when variant is docked`, () => {
|
|
485
506
|
render(<Page variant="docked" dockContent={<>Dock content</>} masthead={<>Masthead</>} data-testid="page"></Page>);
|
|
486
507
|
|
|
487
508
|
const pageDockMain = screen.getByText('Dock content').closest(`.${styles.pageDockMain}`);
|
|
488
509
|
expect(pageDockMain).toBeInTheDocument();
|
|
489
510
|
});
|
|
511
|
+
|
|
512
|
+
test('Renders PageHeader when passed to the masthead prop', () => {
|
|
513
|
+
render(
|
|
514
|
+
<Page {...props} masthead={<PageHeader>Custom header</PageHeader>}>
|
|
515
|
+
<PageSection>Custom content</PageSection>
|
|
516
|
+
</Page>
|
|
517
|
+
);
|
|
518
|
+
|
|
519
|
+
const header = screen.getByText('Custom header');
|
|
520
|
+
expect(header).toHaveClass(styles.pageHeader);
|
|
521
|
+
expect(header.parentElement).toHaveClass(styles.page);
|
|
522
|
+
});
|
|
490
523
|
});
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { render, screen } from '@testing-library/react';
|
|
2
|
+
import styles from '@patternfly/react-styles/css/components/Page/page';
|
|
3
|
+
import { PageHeader } from '../PageHeader';
|
|
4
|
+
|
|
5
|
+
test('Renders children', () => {
|
|
6
|
+
render(<PageHeader>Header content</PageHeader>);
|
|
7
|
+
expect(screen.getByText('Header content')).toBeVisible();
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
test(`Renders with class ${styles.pageHeader} by default`, () => {
|
|
11
|
+
render(<PageHeader>Header content</PageHeader>);
|
|
12
|
+
expect(screen.getByText('Header content')).toHaveClass(styles.pageHeader, { exact: true });
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
test('Renders as a div by default', () => {
|
|
16
|
+
render(<PageHeader>Header content</PageHeader>);
|
|
17
|
+
expect(screen.getByText('Header content').tagName).toBe('HEADER');
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
test('Renders as a custom component when component is passed', () => {
|
|
21
|
+
render(<PageHeader component="div">Header content</PageHeader>);
|
|
22
|
+
expect(screen.getByText('Header content').tagName).toBe('DIV');
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
test('Renders with custom classes when className is passed', () => {
|
|
26
|
+
render(<PageHeader className="custom-class">Header content</PageHeader>);
|
|
27
|
+
expect(screen.getByText('Header content')).toHaveClass('custom-class');
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
test('Renders with spread props', () => {
|
|
31
|
+
render(<PageHeader id="custom-id">Header content</PageHeader>);
|
|
32
|
+
expect(screen.getByText('Header content')).toHaveAttribute('id', 'custom-id');
|
|
33
|
+
});
|
|
@@ -3,7 +3,16 @@ id: Page
|
|
|
3
3
|
section: components
|
|
4
4
|
cssPrefix: pf-v6-c-page
|
|
5
5
|
propComponents:
|
|
6
|
-
[
|
|
6
|
+
[
|
|
7
|
+
'Page',
|
|
8
|
+
'PageHeader',
|
|
9
|
+
'PageSidebar',
|
|
10
|
+
'PageSidebarBody',
|
|
11
|
+
'PageSection',
|
|
12
|
+
'PageGroup',
|
|
13
|
+
'PageBreadcrumb',
|
|
14
|
+
'PageToggleButton'
|
|
15
|
+
]
|
|
7
16
|
---
|
|
8
17
|
|
|
9
18
|
import { useState, useLayoutEffect, useRef } from 'react';
|
|
@@ -16,7 +25,7 @@ import pageSectionWidthLimitMaxWidth from '@patternfly/react-tokens/dist/esm/c_p
|
|
|
16
25
|
|
|
17
26
|
A page will typically contain the following components:
|
|
18
27
|
|
|
19
|
-
- A `<Page>` with a `masthead` prop that often contains a [masthead](/components/masthead)
|
|
28
|
+
- A `<Page>` with a `masthead` prop that often contains a [masthead](/components/masthead) or a `<PageHeader>`
|
|
20
29
|
|
|
21
30
|
The `<MastheadMain>` component includes the smaller area that typically contains the `<MastheadToggle>` and a `<MastheadLogo>`. `<MastheadContent>` represents the main portion of the masthead, and will typically contain a `<Toolbar>` or other menu-like components, like a `<Dropdown>`.
|
|
22
31
|
|
|
@@ -24,6 +33,14 @@ The `<MastheadMain>` component includes the smaller area that typically contains
|
|
|
24
33
|
- 1 or more `<PageSidebarBody>` components inside `<PageSidebar>` for vertical navigation or other sidebar content
|
|
25
34
|
- 1 or more `<PageSection>` components
|
|
26
35
|
|
|
36
|
+
### Page header
|
|
37
|
+
|
|
38
|
+
To use a page header instead of passing a [masthead](/components/masthead) directly, pass a `<PageHeader>` to the `masthead` property. `<PageHeader>` should only be used to wrap custom header content.
|
|
39
|
+
|
|
40
|
+
```ts file="./PageHeaderContent.tsx"
|
|
41
|
+
|
|
42
|
+
```
|
|
43
|
+
|
|
27
44
|
### Vertical navigation
|
|
28
45
|
|
|
29
46
|
To add a vertical sidebar to a `<Page>`, pass a `<PageSidebar>` component into the `sidebar` property. To render navigation in the sidebar, pass a `<PageSidebarBody>` component to `<PageSidebar>`.
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Page, PageHeader, PageSection } from '@patternfly/react-core';
|
|
2
|
+
|
|
3
|
+
export const PageHeaderContent: React.FunctionComponent = () => {
|
|
4
|
+
const pageHeader = <PageHeader>Page header</PageHeader>;
|
|
5
|
+
|
|
6
|
+
return (
|
|
7
|
+
<Page masthead={pageHeader}>
|
|
8
|
+
<PageSection aria-labelledby="header-example-section-1">
|
|
9
|
+
<h2 id="header-example-section-1">Page header example section 1</h2>
|
|
10
|
+
</PageSection>
|
|
11
|
+
<PageSection variant="secondary" aria-labelledby="header-example-section-2">
|
|
12
|
+
<h2 id="header-example-section-2">Page header example section 2 with secondary variant styling</h2>
|
|
13
|
+
</PageSection>
|
|
14
|
+
<PageSection aria-labelledby="header-example-section-3">
|
|
15
|
+
<h2 id="header-example-section-3">Page header example section 3</h2>
|
|
16
|
+
</PageSection>
|
|
17
|
+
</Page>
|
|
18
|
+
);
|
|
19
|
+
};
|