@patternfly/react-core 6.5.0-prerelease.21 → 6.5.0-prerelease.25
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 +23 -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/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/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/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/esm/components/ClipboardCopy/ClipboardCopy.d.ts +8 -0
- package/dist/esm/components/ClipboardCopy/ClipboardCopy.d.ts.map +1 -1
- package/dist/esm/components/ClipboardCopy/ClipboardCopy.js +4 -2
- package/dist/esm/components/ClipboardCopy/ClipboardCopy.js.map +1 -1
- package/dist/esm/components/Compass/Compass.d.ts +5 -3
- package/dist/esm/components/Compass/Compass.d.ts.map +1 -1
- package/dist/esm/components/Compass/Compass.js +3 -3
- package/dist/esm/components/Compass/Compass.js.map +1 -1
- package/dist/esm/components/Compass/CompassContent.d.ts +1 -1
- package/dist/esm/components/Compass/CompassContent.js +1 -1
- package/dist/esm/components/Compass/CompassContent.js.map +1 -1
- package/dist/esm/components/Compass/CompassMainHeader.d.ts +4 -4
- package/dist/esm/components/Compass/CompassMainHeaderContent.d.ts +2 -2
- package/dist/esm/components/Compass/CompassMainHeaderTitle.d.ts +2 -2
- package/dist/esm/components/Compass/CompassMainHeaderToolbar.d.ts +2 -2
- package/dist/esm/components/Drawer/DrawerPanelContent.d.ts.map +1 -1
- package/dist/esm/components/Drawer/DrawerPanelContent.js +7 -1
- package/dist/esm/components/Drawer/DrawerPanelContent.js.map +1 -1
- package/dist/esm/components/Form/FormGroup.d.ts.map +1 -1
- package/dist/esm/components/Form/FormGroup.js +1 -1
- package/dist/esm/components/Form/FormGroup.js.map +1 -1
- package/dist/esm/components/Masthead/Masthead.d.ts +2 -0
- package/dist/esm/components/Masthead/Masthead.d.ts.map +1 -1
- package/dist/esm/components/Masthead/Masthead.js +2 -2
- package/dist/esm/components/Masthead/Masthead.js.map +1 -1
- package/dist/esm/components/Nav/Nav.d.ts +2 -2
- package/dist/esm/components/Nav/Nav.d.ts.map +1 -1
- package/dist/esm/components/Nav/Nav.js +1 -1
- package/dist/esm/components/Nav/Nav.js.map +1 -1
- package/dist/esm/components/Nav/NavItem.d.ts +5 -1
- package/dist/esm/components/Nav/NavItem.d.ts.map +1 -1
- package/dist/esm/components/Nav/NavItem.js +8 -6
- package/dist/esm/components/Nav/NavItem.js.map +1 -1
- package/dist/esm/components/Page/Page.d.ts +2 -0
- package/dist/esm/components/Page/Page.d.ts.map +1 -1
- package/dist/esm/components/Page/Page.js +3 -3
- package/dist/esm/components/Page/Page.js.map +1 -1
- package/dist/esm/components/Toolbar/Toolbar.d.ts +2 -0
- package/dist/esm/components/Toolbar/Toolbar.d.ts.map +1 -1
- package/dist/esm/components/Toolbar/Toolbar.js +2 -2
- package/dist/esm/components/Toolbar/Toolbar.js.map +1 -1
- package/dist/esm/components/Wizard/WizardNavInternal.js +3 -3
- package/dist/esm/components/Wizard/WizardNavInternal.js.map +1 -1
- package/dist/js/components/ClipboardCopy/ClipboardCopy.d.ts +8 -0
- package/dist/js/components/ClipboardCopy/ClipboardCopy.d.ts.map +1 -1
- package/dist/js/components/ClipboardCopy/ClipboardCopy.js +4 -2
- package/dist/js/components/ClipboardCopy/ClipboardCopy.js.map +1 -1
- package/dist/js/components/Compass/Compass.d.ts +5 -3
- package/dist/js/components/Compass/Compass.d.ts.map +1 -1
- package/dist/js/components/Compass/Compass.js +3 -3
- package/dist/js/components/Compass/Compass.js.map +1 -1
- package/dist/js/components/Compass/CompassContent.d.ts +1 -1
- package/dist/js/components/Compass/CompassContent.js +1 -1
- package/dist/js/components/Compass/CompassContent.js.map +1 -1
- package/dist/js/components/Compass/CompassMainHeader.d.ts +4 -4
- package/dist/js/components/Compass/CompassMainHeaderContent.d.ts +2 -2
- package/dist/js/components/Compass/CompassMainHeaderTitle.d.ts +2 -2
- package/dist/js/components/Compass/CompassMainHeaderToolbar.d.ts +2 -2
- package/dist/js/components/Drawer/DrawerPanelContent.d.ts.map +1 -1
- package/dist/js/components/Drawer/DrawerPanelContent.js +7 -1
- package/dist/js/components/Drawer/DrawerPanelContent.js.map +1 -1
- package/dist/js/components/Form/FormGroup.d.ts.map +1 -1
- package/dist/js/components/Form/FormGroup.js +1 -1
- package/dist/js/components/Form/FormGroup.js.map +1 -1
- package/dist/js/components/Masthead/Masthead.d.ts +2 -0
- package/dist/js/components/Masthead/Masthead.d.ts.map +1 -1
- package/dist/js/components/Masthead/Masthead.js +2 -2
- package/dist/js/components/Masthead/Masthead.js.map +1 -1
- package/dist/js/components/Nav/Nav.d.ts +2 -2
- package/dist/js/components/Nav/Nav.d.ts.map +1 -1
- package/dist/js/components/Nav/Nav.js +1 -1
- package/dist/js/components/Nav/Nav.js.map +1 -1
- package/dist/js/components/Nav/NavItem.d.ts +5 -1
- package/dist/js/components/Nav/NavItem.d.ts.map +1 -1
- package/dist/js/components/Nav/NavItem.js +7 -6
- package/dist/js/components/Nav/NavItem.js.map +1 -1
- package/dist/js/components/Page/Page.d.ts +2 -0
- package/dist/js/components/Page/Page.d.ts.map +1 -1
- package/dist/js/components/Page/Page.js +3 -3
- package/dist/js/components/Page/Page.js.map +1 -1
- package/dist/js/components/Toolbar/Toolbar.d.ts +2 -0
- package/dist/js/components/Toolbar/Toolbar.d.ts.map +1 -1
- package/dist/js/components/Toolbar/Toolbar.js +2 -2
- package/dist/js/components/Toolbar/Toolbar.js.map +1 -1
- package/dist/js/components/Wizard/WizardNavInternal.js +3 -3
- package/dist/js/components/Wizard/WizardNavInternal.js.map +1 -1
- package/dist/umd/assets/{output-Bhl00hr4.css → output-ClqppqYH.css} +16187 -15964
- package/dist/umd/react-core.min.js +5 -5
- package/helpers/package.json +1 -1
- package/layouts/package.json +1 -1
- package/next/package.json +1 -1
- package/package.json +7 -7
- package/src/components/ClipboardCopy/ClipboardCopy.tsx +16 -1
- package/src/components/ClipboardCopy/__tests__/ClipboardCopy.test.tsx +72 -0
- package/src/components/ClipboardCopy/__tests__/__snapshots__/ClipboardCopy.test.tsx.snap +1 -1
- package/src/components/Compass/Compass.tsx +46 -30
- package/src/components/Compass/CompassContent.tsx +2 -2
- package/src/components/Compass/CompassMainHeader.tsx +4 -4
- package/src/components/Compass/CompassMainHeaderContent.tsx +2 -2
- package/src/components/Compass/CompassMainHeaderTitle.tsx +2 -2
- package/src/components/Compass/CompassMainHeaderToolbar.tsx +2 -2
- package/src/components/Compass/__tests__/Compass.test.tsx +10 -0
- package/src/components/Compass/__tests__/__snapshots__/Compass.test.tsx.snap +1 -1
- package/src/components/Compass/__tests__/__snapshots__/CompassContent.test.tsx.snap +1 -1
- package/src/components/Compass/examples/Compass.md +16 -15
- package/src/components/Compass/examples/CompassDockLayout.tsx +25 -0
- package/src/components/Compass/examples/compass.css +16 -4
- package/src/components/Drawer/DrawerPanelContent.tsx +7 -0
- package/src/components/Drawer/__tests__/DrawerPanelContent.test.tsx +20 -0
- package/src/components/Drawer/__tests__/Generated/__snapshots__/DrawerPanelContent.test.tsx.snap +1 -0
- package/src/components/Drawer/__tests__/__snapshots__/Drawer.test.tsx.snap +2 -0
- package/src/components/Drawer/examples/Drawer.md +1 -1
- package/src/components/Drawer/examples/DrawerAdditionalSectionAboveContent.tsx +1 -1
- package/src/components/Drawer/examples/DrawerBasic.tsx +1 -1
- package/src/components/Drawer/examples/DrawerBasicInline.tsx +1 -1
- package/src/components/Drawer/examples/DrawerBasicPill.tsx +1 -1
- package/src/components/Drawer/examples/DrawerBreakpoint.tsx +1 -1
- package/src/components/Drawer/examples/DrawerInlinePanelEnd.tsx +1 -1
- package/src/components/Drawer/examples/DrawerInlinePanelStart.tsx +1 -1
- package/src/components/Drawer/examples/DrawerModifiedContentPadding.tsx +1 -1
- package/src/components/Drawer/examples/DrawerModifiedPanelPadding.tsx +1 -1
- package/src/components/Drawer/examples/DrawerPanelBottom.tsx +1 -1
- package/src/components/Drawer/examples/DrawerPanelEnd.tsx +1 -1
- package/src/components/Drawer/examples/DrawerPanelStart.tsx +1 -1
- package/src/components/Drawer/examples/DrawerPillInline.tsx +1 -1
- package/src/components/Drawer/examples/DrawerResizableAtEnd.tsx +1 -1
- package/src/components/Drawer/examples/DrawerResizableAtStart.tsx +1 -1
- package/src/components/Drawer/examples/DrawerResizableOnBottom.tsx +1 -1
- package/src/components/Drawer/examples/DrawerResizableOnInline.tsx +1 -1
- package/src/components/Drawer/examples/DrawerStatic.tsx +1 -1
- package/src/components/Dropdown/examples/Dropdown.md +13 -1
- package/src/components/Dropdown/examples/DropdownWithSplit.tsx +97 -0
- package/src/components/Form/FormGroup.tsx +1 -2
- package/src/components/Form/__tests__/__snapshots__/FormGroup.test.tsx.snap +1 -1
- package/src/components/LoginPage/__tests__/__snapshots__/LoginForm.test.tsx.snap +6 -6
- package/src/components/Masthead/Masthead.tsx +4 -0
- package/src/components/Masthead/__tests__/Masthead.test.tsx +25 -1
- package/src/components/Nav/Nav.tsx +3 -2
- package/src/components/Nav/NavItem.tsx +27 -3
- package/src/components/Nav/__tests__/Nav.test.tsx +15 -0
- package/src/components/Page/Page.tsx +5 -1
- package/src/components/Page/__tests__/Page.test.tsx +17 -0
- package/src/components/Toolbar/Toolbar.tsx +4 -0
- package/src/components/Toolbar/__tests__/Toolbar.test.tsx +34 -1
- package/src/components/Wizard/WizardNavInternal.tsx +3 -3
- package/src/components/Wizard/__tests__/Wizard.test.tsx +39 -0
- package/src/demos/Compass/Compass.md +40 -0
- package/src/demos/Compass/examples/CompassDockDemo.tsx +215 -0
- package/src/demos/Page.md +12 -1
- package/src/demos/assets/PF-IconLogo-color.svg +17 -0
- package/src/demos/examples/Page/PageDockedNav.tsx +259 -0
- package/src/layouts/Bullseye/examples/bullseye.css +2 -2
- package/src/layouts/Flex/examples/flex.css +3 -3
- package/src/layouts/Gallery/examples/gallery.css +2 -2
- package/src/layouts/Grid/examples/grid.css +2 -2
- package/src/layouts/Level/examples/level.css +4 -4
- package/src/layouts/Split/examples/split.css +2 -2
- package/src/layouts/Stack/examples/stack.css +4 -4
- /package/src/{components → demos}/Compass/examples/CompassDemo.tsx +0 -0
|
@@ -281,6 +281,7 @@ exports[`Drawer isExpanded = false and isInline = false and isStatic = false 1`]
|
|
|
281
281
|
class="pf-v6-c-drawer__panel"
|
|
282
282
|
hidden=""
|
|
283
283
|
id="generated-id"
|
|
284
|
+
inert=""
|
|
284
285
|
/>
|
|
285
286
|
</div>
|
|
286
287
|
</div>
|
|
@@ -308,6 +309,7 @@ exports[`Drawer isExpanded = false and isInline = true and isStatic = false 1`]
|
|
|
308
309
|
class="pf-v6-c-drawer__panel"
|
|
309
310
|
hidden=""
|
|
310
311
|
id="generated-id"
|
|
312
|
+
inert=""
|
|
311
313
|
/>
|
|
312
314
|
</div>
|
|
313
315
|
</div>
|
|
@@ -135,7 +135,7 @@ import accessibility from '@patternfly/react-styles/css/utilities/Accessibility/
|
|
|
135
135
|
|
|
136
136
|
### With focus trap
|
|
137
137
|
|
|
138
|
-
When a [focus trap](/accessibility/
|
|
138
|
+
When a [focus trap](/accessibility/develop#trapping-focus) is enabled on an element, a user will only be able to interact with the contents of that element until the focus trap is closed or deactivated.
|
|
139
139
|
|
|
140
140
|
To enable and customize a focus trap on a drawer panel, apply the `focusTrap` property to the `<DrawerPanelContent>` component. Enabling a focus trap with `focusTrap.enabled` will also automatically place focus on the first focusable element when the drawer panel expands, and return focus to the previously focused element when it collapses.
|
|
141
141
|
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
|
|
14
14
|
export const DrawerAdditionalSectionAboveContent: React.FunctionComponent = () => {
|
|
15
15
|
const [isExpanded, setIsExpanded] = useState(false);
|
|
16
|
-
const drawerRef = useRef<
|
|
16
|
+
const drawerRef = useRef<HTMLSpanElement>(null);
|
|
17
17
|
|
|
18
18
|
const onExpand = () => {
|
|
19
19
|
drawerRef.current && drawerRef.current.focus();
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
|
|
15
15
|
export const DrawerBasic: React.FunctionComponent = () => {
|
|
16
16
|
const [isExpanded, setIsExpanded] = useState(false);
|
|
17
|
-
const drawerRef = useRef<
|
|
17
|
+
const drawerRef = useRef<HTMLSpanElement>(null);
|
|
18
18
|
|
|
19
19
|
const onExpand = () => {
|
|
20
20
|
drawerRef.current && drawerRef.current.focus();
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
|
|
13
13
|
export const DrawerBasicInline: React.FunctionComponent = () => {
|
|
14
14
|
const [isExpanded, setIsExpanded] = useState(false);
|
|
15
|
-
const drawerRef = useRef<
|
|
15
|
+
const drawerRef = useRef<HTMLSpanElement>(null);
|
|
16
16
|
|
|
17
17
|
const onExpand = () => {
|
|
18
18
|
drawerRef.current && drawerRef.current.focus();
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
|
|
13
13
|
export const DrawerBasicPill: React.FunctionComponent = () => {
|
|
14
14
|
const [isExpanded, setIsExpanded] = useState(false);
|
|
15
|
-
const drawerRef = useRef<
|
|
15
|
+
const drawerRef = useRef<HTMLSpanElement>(null);
|
|
16
16
|
|
|
17
17
|
const onExpand = () => {
|
|
18
18
|
drawerRef.current && drawerRef.current.focus();
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
|
|
13
13
|
export const DrawerBreakpoint: React.FunctionComponent = () => {
|
|
14
14
|
const [isExpanded, setIsExpanded] = useState(false);
|
|
15
|
-
const drawerRef = useRef<
|
|
15
|
+
const drawerRef = useRef<HTMLSpanElement>(null);
|
|
16
16
|
|
|
17
17
|
const onExpand = () => {
|
|
18
18
|
drawerRef.current && drawerRef.current.focus();
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
|
|
13
13
|
export const DrawerInlinePanelEnd: React.FunctionComponent = () => {
|
|
14
14
|
const [isExpanded, setIsExpanded] = useState(false);
|
|
15
|
-
const drawerRef = useRef<
|
|
15
|
+
const drawerRef = useRef<HTMLSpanElement>(null);
|
|
16
16
|
|
|
17
17
|
const onExpand = () => {
|
|
18
18
|
drawerRef.current && drawerRef.current.focus();
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
|
|
13
13
|
export const DrawerInlinePanelStart: React.FunctionComponent = () => {
|
|
14
14
|
const [isExpanded, setIsExpanded] = useState(false);
|
|
15
|
-
const drawerRef = useRef<
|
|
15
|
+
const drawerRef = useRef<HTMLSpanElement>(null);
|
|
16
16
|
|
|
17
17
|
const onExpand = () => {
|
|
18
18
|
drawerRef.current && drawerRef.current.focus();
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
|
|
13
13
|
export const DrawerModifiedContentPadding: React.FunctionComponent = () => {
|
|
14
14
|
const [isExpanded, setIsExpanded] = useState(false);
|
|
15
|
-
const drawerRef = useRef<
|
|
15
|
+
const drawerRef = useRef<HTMLSpanElement>(null);
|
|
16
16
|
|
|
17
17
|
const onExpand = () => {
|
|
18
18
|
drawerRef.current && drawerRef.current.focus();
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
|
|
13
13
|
export const DrawerModifiedPanelPadding: React.FunctionComponent = () => {
|
|
14
14
|
const [isExpanded, setIsExpanded] = useState(false);
|
|
15
|
-
const drawerRef = useRef<
|
|
15
|
+
const drawerRef = useRef<HTMLSpanElement>(null);
|
|
16
16
|
|
|
17
17
|
const onExpand = () => {
|
|
18
18
|
drawerRef.current && drawerRef.current.focus();
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
|
|
13
13
|
export const DrawerPanelBottom: React.FunctionComponent = () => {
|
|
14
14
|
const [isExpanded, setIsExpanded] = useState(false);
|
|
15
|
-
const drawerRef = useRef<
|
|
15
|
+
const drawerRef = useRef<HTMLSpanElement>(null);
|
|
16
16
|
|
|
17
17
|
const onExpand = () => {
|
|
18
18
|
drawerRef.current && drawerRef.current.focus();
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
|
|
13
13
|
export const DrawerPanelEnd: React.FunctionComponent = () => {
|
|
14
14
|
const [isExpanded, setIsExpanded] = useState(false);
|
|
15
|
-
const drawerRef = useRef<
|
|
15
|
+
const drawerRef = useRef<HTMLSpanElement>(null);
|
|
16
16
|
|
|
17
17
|
const onExpand = () => {
|
|
18
18
|
drawerRef.current && drawerRef.current.focus();
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
|
|
13
13
|
export const DrawerPanelStart: React.FunctionComponent = () => {
|
|
14
14
|
const [isExpanded, setIsExpanded] = useState(false);
|
|
15
|
-
const drawerRef = useRef<
|
|
15
|
+
const drawerRef = useRef<HTMLSpanElement>(null);
|
|
16
16
|
|
|
17
17
|
const onExpand = () => {
|
|
18
18
|
drawerRef.current && drawerRef.current.focus();
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
|
|
13
13
|
export const DrawerBasicPill: React.FunctionComponent = () => {
|
|
14
14
|
const [isExpanded, setIsExpanded] = useState(false);
|
|
15
|
-
const drawerRef = useRef<
|
|
15
|
+
const drawerRef = useRef<HTMLSpanElement>(null);
|
|
16
16
|
|
|
17
17
|
const onExpand = () => {
|
|
18
18
|
drawerRef.current && drawerRef.current.focus();
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
|
|
13
13
|
export const DrawerResizableAtEnd: React.FunctionComponent = () => {
|
|
14
14
|
const [isExpanded, setIsExpanded] = useState(false);
|
|
15
|
-
const drawerRef = useRef<
|
|
15
|
+
const drawerRef = useRef<HTMLSpanElement>(null);
|
|
16
16
|
|
|
17
17
|
const onExpand = () => {
|
|
18
18
|
drawerRef.current && drawerRef.current.focus();
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
|
|
13
13
|
export const DrawerResizableAtStart: React.FunctionComponent = () => {
|
|
14
14
|
const [isExpanded, setIsExpanded] = useState(false);
|
|
15
|
-
const drawerRef = useRef<
|
|
15
|
+
const drawerRef = useRef<HTMLSpanElement>(null);
|
|
16
16
|
|
|
17
17
|
const onExpand = () => {
|
|
18
18
|
drawerRef.current && drawerRef.current.focus();
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
|
|
13
13
|
export const DrawerResizableOnBottom: React.FunctionComponent = () => {
|
|
14
14
|
const [isExpanded, setIsExpanded] = useState(false);
|
|
15
|
-
const drawerRef = useRef<
|
|
15
|
+
const drawerRef = useRef<HTMLSpanElement>(null);
|
|
16
16
|
|
|
17
17
|
const onExpand = () => {
|
|
18
18
|
drawerRef.current && drawerRef.current.focus();
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
|
|
13
13
|
export const DrawerResizableOnInline: React.FunctionComponent = () => {
|
|
14
14
|
const [isExpanded, setIsExpanded] = useState(false);
|
|
15
|
-
const drawerRef = useRef<
|
|
15
|
+
const drawerRef = useRef<HTMLSpanElement>(null);
|
|
16
16
|
|
|
17
17
|
const onExpand = () => {
|
|
18
18
|
drawerRef.current && drawerRef.current.focus();
|
|
@@ -13,7 +13,7 @@ import accessibility from '@patternfly/react-styles/css/utilities/Accessibility/
|
|
|
13
13
|
|
|
14
14
|
export const DrawerStatic: React.FunctionComponent = () => {
|
|
15
15
|
const [isExpanded, setIsExpanded] = useState(false);
|
|
16
|
-
const drawerRef = useRef<
|
|
16
|
+
const drawerRef = useRef<HTMLSpanElement>(null);
|
|
17
17
|
|
|
18
18
|
const onExpand = () => {
|
|
19
19
|
drawerRef.current && drawerRef.current.focus();
|
|
@@ -16,7 +16,7 @@ propComponents:
|
|
|
16
16
|
]
|
|
17
17
|
---
|
|
18
18
|
|
|
19
|
-
import { useState } from 'react';
|
|
19
|
+
import { useState, useRef } from 'react';
|
|
20
20
|
import EllipsisVIcon from '@patternfly/react-icons/dist/esm/icons/ellipsis-v-icon';
|
|
21
21
|
|
|
22
22
|
## Examples
|
|
@@ -63,3 +63,15 @@ To provide users with more context about a `<DropdownItem>`, pass a short messag
|
|
|
63
63
|
```ts file="./DropdownWithDescriptions.tsx"
|
|
64
64
|
|
|
65
65
|
```
|
|
66
|
+
|
|
67
|
+
### Split toggle with checkbox
|
|
68
|
+
|
|
69
|
+
To combine a checkbox or other control with a dropdown menu, use a split button.
|
|
70
|
+
|
|
71
|
+
A `<MenuToggle>` can be rendered as a split button via `splitButtonItems`. Elements to be displayed before the dropdown toggle button (like the `<MenuToggleCheckbox>`) must be included in the `splitButtonItems`.
|
|
72
|
+
|
|
73
|
+
If the dropdown menu closes upon selection, you will need to manually shift focus back to the toggle element after a user selects an item from the menu.
|
|
74
|
+
|
|
75
|
+
```ts file="./DropdownWithSplit.tsx"
|
|
76
|
+
|
|
77
|
+
```
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Dropdown,
|
|
3
|
+
MenuToggle,
|
|
4
|
+
MenuToggleCheckbox,
|
|
5
|
+
DropdownItem,
|
|
6
|
+
DropdownList,
|
|
7
|
+
Divider,
|
|
8
|
+
MenuToggleElement
|
|
9
|
+
} from '@patternfly/react-core';
|
|
10
|
+
import { useRef, useState } from 'react';
|
|
11
|
+
|
|
12
|
+
export const DropdownSplitButtonText: React.FunctionComponent = () => {
|
|
13
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
14
|
+
const toggleRef = useRef<MenuToggleElement>(null);
|
|
15
|
+
|
|
16
|
+
const onFocus = () => {
|
|
17
|
+
if (!toggleRef.current) {
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const toggleButton = toggleRef.current.querySelector('button[aria-expanded]');
|
|
22
|
+
toggleButton?.focus();
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
const onSelect = () => {
|
|
26
|
+
setIsOpen(false);
|
|
27
|
+
onFocus();
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
const onToggleClick = () => {
|
|
31
|
+
setIsOpen(!isOpen);
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
return (
|
|
35
|
+
<Dropdown
|
|
36
|
+
onSelect={onSelect}
|
|
37
|
+
onOpenChange={(isOpen: boolean) => setIsOpen(isOpen)}
|
|
38
|
+
toggle={(toggleRefCallback: React.Ref<MenuToggleElement>) => (
|
|
39
|
+
<MenuToggle
|
|
40
|
+
ref={(node) => {
|
|
41
|
+
// Handle both callback ref and useRef
|
|
42
|
+
if (typeof toggleRefCallback === 'function') {
|
|
43
|
+
toggleRefCallback(node);
|
|
44
|
+
} else if (toggleRefCallback) {
|
|
45
|
+
(toggleRefCallback as React.MutableRefObject<MenuToggleElement | null>).current = node;
|
|
46
|
+
}
|
|
47
|
+
(toggleRef as React.MutableRefObject<MenuToggleElement | null>).current = node;
|
|
48
|
+
}}
|
|
49
|
+
splitButtonItems={[
|
|
50
|
+
<MenuToggleCheckbox id="split-button-checkbox-example" key="split-checkbox" aria-label="Select all" />
|
|
51
|
+
]}
|
|
52
|
+
aria-label="Dropdown with checkbox split button"
|
|
53
|
+
onClick={onToggleClick}
|
|
54
|
+
isExpanded={isOpen}
|
|
55
|
+
/>
|
|
56
|
+
)}
|
|
57
|
+
isOpen={isOpen}
|
|
58
|
+
>
|
|
59
|
+
<DropdownList>
|
|
60
|
+
<DropdownItem value={0} key="action">
|
|
61
|
+
Action
|
|
62
|
+
</DropdownItem>
|
|
63
|
+
<DropdownItem
|
|
64
|
+
value={1}
|
|
65
|
+
key="link"
|
|
66
|
+
to="#default-link2"
|
|
67
|
+
// Prevent the default onClick functionality for example purposes
|
|
68
|
+
onClick={(ev: any) => ev.preventDefault()}
|
|
69
|
+
>
|
|
70
|
+
Link
|
|
71
|
+
</DropdownItem>
|
|
72
|
+
<DropdownItem value={2} isDisabled key="disabled action">
|
|
73
|
+
Disabled Action
|
|
74
|
+
</DropdownItem>
|
|
75
|
+
<DropdownItem value={3} isDisabled key="disabled link" to="#default-link4">
|
|
76
|
+
Disabled Link
|
|
77
|
+
</DropdownItem>
|
|
78
|
+
<DropdownItem
|
|
79
|
+
value={4}
|
|
80
|
+
isAriaDisabled
|
|
81
|
+
key="aria-disabled link"
|
|
82
|
+
to="#default-link5"
|
|
83
|
+
tooltipProps={{ content: 'aria-disabled link', position: 'top' }}
|
|
84
|
+
>
|
|
85
|
+
Aria-disabled Link
|
|
86
|
+
</DropdownItem>
|
|
87
|
+
<Divider component="li" key="separator" />
|
|
88
|
+
<DropdownItem value={5} key="separated action">
|
|
89
|
+
Separated Action
|
|
90
|
+
</DropdownItem>
|
|
91
|
+
<DropdownItem value={6} key="separated link" to="#default-link6" onClick={(ev) => ev.preventDefault()}>
|
|
92
|
+
Separated Link
|
|
93
|
+
</DropdownItem>
|
|
94
|
+
</DropdownList>
|
|
95
|
+
</Dropdown>
|
|
96
|
+
);
|
|
97
|
+
};
|
|
@@ -56,8 +56,7 @@ export const FormGroup: React.FunctionComponent<FormGroupProps> = ({
|
|
|
56
56
|
<span className={css(styles.formLabelText)}>{label}</span>
|
|
57
57
|
{isRequired && (
|
|
58
58
|
<span className={css(styles.formLabelRequired)} aria-hidden="true">
|
|
59
|
-
{
|
|
60
|
-
{ASTERISK}
|
|
59
|
+
{ASTERISK}
|
|
61
60
|
</span>
|
|
62
61
|
)}
|
|
63
62
|
</LabelComponent>
|
|
@@ -25,7 +25,7 @@ exports[`LoginForm LoginForm with rememberMeLabel 1`] = `
|
|
|
25
25
|
aria-hidden="true"
|
|
26
26
|
class="pf-v6-c-form__label-required"
|
|
27
27
|
>
|
|
28
|
-
|
|
28
|
+
*
|
|
29
29
|
</span>
|
|
30
30
|
</label>
|
|
31
31
|
|
|
@@ -69,7 +69,7 @@ exports[`LoginForm LoginForm with rememberMeLabel 1`] = `
|
|
|
69
69
|
aria-hidden="true"
|
|
70
70
|
class="pf-v6-c-form__label-required"
|
|
71
71
|
>
|
|
72
|
-
|
|
72
|
+
*
|
|
73
73
|
</span>
|
|
74
74
|
</label>
|
|
75
75
|
|
|
@@ -175,7 +175,7 @@ exports[`LoginForm LoginForm with show password 1`] = `
|
|
|
175
175
|
aria-hidden="true"
|
|
176
176
|
class="pf-v6-c-form__label-required"
|
|
177
177
|
>
|
|
178
|
-
|
|
178
|
+
*
|
|
179
179
|
</span>
|
|
180
180
|
</label>
|
|
181
181
|
|
|
@@ -219,7 +219,7 @@ exports[`LoginForm LoginForm with show password 1`] = `
|
|
|
219
219
|
aria-hidden="true"
|
|
220
220
|
class="pf-v6-c-form__label-required"
|
|
221
221
|
>
|
|
222
|
-
|
|
222
|
+
*
|
|
223
223
|
</span>
|
|
224
224
|
</label>
|
|
225
225
|
|
|
@@ -336,7 +336,7 @@ exports[`LoginForm should render Login form 1`] = `
|
|
|
336
336
|
aria-hidden="true"
|
|
337
337
|
class="pf-v6-c-form__label-required"
|
|
338
338
|
>
|
|
339
|
-
|
|
339
|
+
*
|
|
340
340
|
</span>
|
|
341
341
|
</label>
|
|
342
342
|
|
|
@@ -380,7 +380,7 @@ exports[`LoginForm should render Login form 1`] = `
|
|
|
380
380
|
aria-hidden="true"
|
|
381
381
|
class="pf-v6-c-form__label-required"
|
|
382
382
|
>
|
|
383
|
-
|
|
383
|
+
*
|
|
384
384
|
</span>
|
|
385
385
|
</label>
|
|
386
386
|
|
|
@@ -27,6 +27,8 @@ export interface MastheadProps extends React.DetailedHTMLProps<React.HTMLProps<H
|
|
|
27
27
|
xl?: 'insetNone' | 'insetXs' | 'insetSm' | 'insetMd' | 'insetLg' | 'insetXl' | 'inset2xl' | 'inset3xl';
|
|
28
28
|
'2xl'?: 'insetNone' | 'insetXs' | 'insetSm' | 'insetMd' | 'insetLg' | 'insetXl' | 'inset2xl' | 'inset3xl';
|
|
29
29
|
};
|
|
30
|
+
/** @beta Indicates the variant of the masthead */
|
|
31
|
+
variant?: 'default' | 'docked';
|
|
30
32
|
}
|
|
31
33
|
|
|
32
34
|
export const Masthead: React.FunctionComponent<MastheadProps> = ({
|
|
@@ -36,6 +38,7 @@ export const Masthead: React.FunctionComponent<MastheadProps> = ({
|
|
|
36
38
|
md: 'inline'
|
|
37
39
|
},
|
|
38
40
|
inset,
|
|
41
|
+
variant = 'default',
|
|
39
42
|
...props
|
|
40
43
|
}: MastheadProps) => {
|
|
41
44
|
const { width, getBreakpoint } = useContext(PageContext);
|
|
@@ -43,6 +46,7 @@ export const Masthead: React.FunctionComponent<MastheadProps> = ({
|
|
|
43
46
|
<header
|
|
44
47
|
className={css(
|
|
45
48
|
styles.masthead,
|
|
49
|
+
variant === 'docked' && styles.modifiers.docked,
|
|
46
50
|
formatBreakpointMods(display, styles, 'display-', getBreakpoint(width)),
|
|
47
51
|
formatBreakpointMods(inset, styles, '', getBreakpoint(width)),
|
|
48
52
|
className
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { render } from '@testing-library/react';
|
|
1
|
+
import { render, screen } from '@testing-library/react';
|
|
2
2
|
import { Masthead, MastheadMain, MastheadLogo, MastheadContent, MastheadBrand, MastheadToggle } from '../index';
|
|
3
|
+
import styles from '@patternfly/react-styles/css/components/Masthead/masthead';
|
|
3
4
|
|
|
4
5
|
describe('Masthead', () => {
|
|
5
6
|
test('verify basic', () => {
|
|
@@ -71,6 +72,29 @@ describe('Masthead', () => {
|
|
|
71
72
|
expect(asFragment()).toMatchSnapshot();
|
|
72
73
|
});
|
|
73
74
|
});
|
|
75
|
+
|
|
76
|
+
test(`Renders with ${styles.modifiers.docked} class when variant is docked`, () => {
|
|
77
|
+
render(
|
|
78
|
+
<Masthead variant="docked" data-testid="masthead">
|
|
79
|
+
test
|
|
80
|
+
</Masthead>
|
|
81
|
+
);
|
|
82
|
+
expect(screen.getByTestId('masthead')).toHaveClass(styles.modifiers.docked);
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
test(`Does not render with ${styles.modifiers.docked} class when variant is default`, () => {
|
|
86
|
+
render(
|
|
87
|
+
<Masthead variant="default" data-testid="masthead">
|
|
88
|
+
test
|
|
89
|
+
</Masthead>
|
|
90
|
+
);
|
|
91
|
+
expect(screen.getByTestId('masthead')).not.toHaveClass(styles.modifiers.docked);
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
test(`Does not render with ${styles.modifiers.docked} class when variant is not passed`, () => {
|
|
95
|
+
render(<Masthead data-testid="masthead">test</Masthead>);
|
|
96
|
+
expect(screen.getByTestId('masthead')).not.toHaveClass(styles.modifiers.docked);
|
|
97
|
+
});
|
|
74
98
|
});
|
|
75
99
|
|
|
76
100
|
describe('MastheadLogo', () => {
|
|
@@ -35,8 +35,8 @@ export interface NavProps
|
|
|
35
35
|
) => void;
|
|
36
36
|
/** Accessible label for the nav when there are multiple navs on the page */
|
|
37
37
|
'aria-label'?: string;
|
|
38
|
-
/**
|
|
39
|
-
variant?: 'default' | 'horizontal' | 'horizontal-subnav';
|
|
38
|
+
/** The nav variant to use. Docked is in beta. */
|
|
39
|
+
variant?: 'default' | 'horizontal' | 'horizontal-subnav' | 'docked';
|
|
40
40
|
/** Value to overwrite the randomly generated data-ouia-component-id.*/
|
|
41
41
|
ouiaId?: number | string;
|
|
42
42
|
/** Set the value of data-ouia-safe. Only set to true when the component is in a static state, i.e. no animations are occurring. At all other times, this value must be false. */
|
|
@@ -154,6 +154,7 @@ class Nav extends Component<
|
|
|
154
154
|
className={css(
|
|
155
155
|
styles.nav,
|
|
156
156
|
isHorizontal && styles.modifiers.horizontal,
|
|
157
|
+
variant === 'docked' && styles.modifiers.docked,
|
|
157
158
|
variant === 'horizontal-subnav' && styles.modifiers.subnav,
|
|
158
159
|
this.state.isScrollable && styles.modifiers.scrollable,
|
|
159
160
|
className
|
|
@@ -1,4 +1,14 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
cloneElement,
|
|
3
|
+
Fragment,
|
|
4
|
+
isValidElement,
|
|
5
|
+
useContext,
|
|
6
|
+
useEffect,
|
|
7
|
+
useRef,
|
|
8
|
+
useState,
|
|
9
|
+
forwardRef,
|
|
10
|
+
MutableRefObject
|
|
11
|
+
} from 'react';
|
|
2
12
|
import styles from '@patternfly/react-styles/css/components/Nav/nav';
|
|
3
13
|
import menuStyles from '@patternfly/react-styles/css/components/Menu/menu';
|
|
4
14
|
import dividerStyles from '@patternfly/react-styles/css/components/Divider/divider';
|
|
@@ -42,9 +52,13 @@ export interface NavItemProps extends Omit<React.HTMLProps<HTMLAnchorElement>, '
|
|
|
42
52
|
ouiaId?: number | string;
|
|
43
53
|
/** Set the value of data-ouia-safe. Only set to true when the component is in a static state, i.e. no animations are occurring. At all other times, this value must be false. */
|
|
44
54
|
ouiaSafe?: boolean;
|
|
55
|
+
/** React ref for the anchor element within the nav item. */
|
|
56
|
+
anchorRef?: React.Ref<HTMLAnchorElement>;
|
|
57
|
+
/** @hide Forwarded ref */
|
|
58
|
+
innerRef?: React.Ref<HTMLLIElement>;
|
|
45
59
|
}
|
|
46
60
|
|
|
47
|
-
|
|
61
|
+
const NavItemBase: React.FunctionComponent<NavItemProps> = ({
|
|
48
62
|
children,
|
|
49
63
|
styleChildren = true,
|
|
50
64
|
className,
|
|
@@ -61,13 +75,16 @@ export const NavItem: React.FunctionComponent<NavItemProps> = ({
|
|
|
61
75
|
ouiaSafe,
|
|
62
76
|
zIndex = 9999,
|
|
63
77
|
icon,
|
|
78
|
+
innerRef,
|
|
79
|
+
anchorRef,
|
|
64
80
|
...props
|
|
65
81
|
}: NavItemProps) => {
|
|
66
82
|
const { flyoutRef, setFlyoutRef, navRef } = useContext(NavContext);
|
|
67
83
|
const { isSidebarOpen } = useContext(PageSidebarContext);
|
|
68
84
|
const [flyoutTarget, setFlyoutTarget] = useState(null);
|
|
69
85
|
const [isHovered, setIsHovered] = useState(false);
|
|
70
|
-
const
|
|
86
|
+
const _ref = useRef<HTMLLIElement>(undefined);
|
|
87
|
+
const ref = (innerRef as MutableRefObject<HTMLLIElement>) || _ref;
|
|
71
88
|
const flyoutVisible = ref === flyoutRef;
|
|
72
89
|
const popperRef = useRef<HTMLDivElement>(undefined);
|
|
73
90
|
const hasFlyout = flyout !== undefined;
|
|
@@ -180,6 +197,7 @@ export const NavItem: React.FunctionComponent<NavItemProps> = ({
|
|
|
180
197
|
const preventLinkDefault = preventDefault || !to;
|
|
181
198
|
return (
|
|
182
199
|
<Component
|
|
200
|
+
ref={anchorRef}
|
|
183
201
|
href={to}
|
|
184
202
|
onClick={(e: any) => context.onSelect(e, groupId, itemId, to, preventLinkDefault, onClick)}
|
|
185
203
|
className={css(
|
|
@@ -208,6 +226,7 @@ export const NavItem: React.FunctionComponent<NavItemProps> = ({
|
|
|
208
226
|
className: css(styles.navLink, isActive && styles.modifiers.current, child.props && child.props.className)
|
|
209
227
|
}),
|
|
210
228
|
tabIndex: child.props.tabIndex || tabIndex,
|
|
229
|
+
ref: anchorRef,
|
|
211
230
|
children: hasFlyout ? (
|
|
212
231
|
<Fragment>
|
|
213
232
|
{child.props.children}
|
|
@@ -267,4 +286,9 @@ export const NavItem: React.FunctionComponent<NavItemProps> = ({
|
|
|
267
286
|
|
|
268
287
|
return navItem;
|
|
269
288
|
};
|
|
289
|
+
|
|
290
|
+
export const NavItem = forwardRef<HTMLLIElement, NavItemProps>((props, ref) => (
|
|
291
|
+
<NavItemBase {...props} innerRef={ref} />
|
|
292
|
+
));
|
|
293
|
+
|
|
270
294
|
NavItem.displayName = 'NavItem';
|
|
@@ -259,4 +259,19 @@ describe('Nav', () => {
|
|
|
259
259
|
);
|
|
260
260
|
expect(screen.getAllByText('this is an icon')[0].parentElement).toHaveClass(styles.navLinkIcon);
|
|
261
261
|
});
|
|
262
|
+
|
|
263
|
+
test(`Renders with ${styles.modifiers.docked} class when variant is docked`, () => {
|
|
264
|
+
renderNav(
|
|
265
|
+
<Nav variant="docked" data-testid="docked-nav">
|
|
266
|
+
<NavList>
|
|
267
|
+
{props.items.map((item) => (
|
|
268
|
+
<NavItem to={item.to} key={item.to}>
|
|
269
|
+
{item.label}
|
|
270
|
+
</NavItem>
|
|
271
|
+
))}
|
|
272
|
+
</NavList>
|
|
273
|
+
</Nav>
|
|
274
|
+
);
|
|
275
|
+
expect(screen.getByTestId('docked-nav')).toHaveClass(styles.modifiers.docked);
|
|
276
|
+
});
|
|
262
277
|
});
|
|
@@ -20,6 +20,8 @@ export interface PageProps extends React.HTMLProps<HTMLDivElement> {
|
|
|
20
20
|
children?: React.ReactNode;
|
|
21
21
|
/** Additional classes added to the page layout */
|
|
22
22
|
className?: string;
|
|
23
|
+
/** @beta Indicates the layout variant */
|
|
24
|
+
variant?: 'default' | 'docked';
|
|
23
25
|
/** Masthead component (e.g. <Masthead />) */
|
|
24
26
|
masthead?: React.ReactNode;
|
|
25
27
|
/** Sidebar component for a side nav, recommended to be a PageSidebar. If set to null, the page grid layout
|
|
@@ -229,6 +231,7 @@ class Page extends Component<PageProps, PageState> {
|
|
|
229
231
|
isBreadcrumbWidthLimited,
|
|
230
232
|
className,
|
|
231
233
|
children,
|
|
234
|
+
variant,
|
|
232
235
|
masthead,
|
|
233
236
|
sidebar,
|
|
234
237
|
notificationDrawer,
|
|
@@ -336,6 +339,7 @@ class Page extends Component<PageProps, PageState> {
|
|
|
336
339
|
{...rest}
|
|
337
340
|
className={css(
|
|
338
341
|
styles.page,
|
|
342
|
+
variant === 'docked' && styles.modifiers.dock,
|
|
339
343
|
width !== null && height !== null && 'pf-m-resize-observer',
|
|
340
344
|
width !== null && `pf-m-breakpoint-${getBreakpoint(width)}`,
|
|
341
345
|
height !== null && `pf-m-height-breakpoint-${getVerticalBreakpoint(height)}`,
|
|
@@ -344,7 +348,7 @@ class Page extends Component<PageProps, PageState> {
|
|
|
344
348
|
)}
|
|
345
349
|
>
|
|
346
350
|
{skipToContent}
|
|
347
|
-
{masthead}
|
|
351
|
+
{variant === 'docked' ? <div className={css(styles.pageDock)}>{masthead}</div> : masthead}
|
|
348
352
|
{sidebar}
|
|
349
353
|
{notificationDrawer && (
|
|
350
354
|
<div className={css(styles.pageDrawer)}>
|
|
@@ -389,4 +389,21 @@ describe('Page', () => {
|
|
|
389
389
|
|
|
390
390
|
expect(screen.getByRole('main').parentElement).not.toHaveClass(styles.modifiers.noFill);
|
|
391
391
|
});
|
|
392
|
+
|
|
393
|
+
test(`Renders with ${styles.modifiers.dock} class when variant is docked`, () => {
|
|
394
|
+
render(<Page {...props} variant="docked" data-testid="page"></Page>);
|
|
395
|
+
|
|
396
|
+
expect(screen.getByTestId('page')).toHaveClass(styles.modifiers.dock);
|
|
397
|
+
});
|
|
398
|
+
|
|
399
|
+
test(`Does not render with ${styles.modifiers.dock} class when variant is default`, () => {
|
|
400
|
+
render(<Page {...props} variant="default" data-testid="page"></Page>);
|
|
401
|
+
|
|
402
|
+
expect(screen.getByTestId('page')).not.toHaveClass(styles.modifiers.dock);
|
|
403
|
+
});
|
|
404
|
+
|
|
405
|
+
test(`Does not render with ${styles.modifiers.dock} class when variant is not passed`, () => {
|
|
406
|
+
render(<Page data-testid="page"></Page>);
|
|
407
|
+
expect(screen.getByTestId('page')).not.toHaveClass(styles.modifiers.dock);
|
|
408
|
+
});
|
|
392
409
|
});
|