@patternfly/react-core 6.5.0-prerelease.62 → 6.5.0-prerelease.64
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 +14 -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/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 +2 -0
- package/dist/esm/components/Compass/Compass.d.ts +9 -1
- 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/Compass/CompassDockMain.d.ts +9 -0
- package/dist/esm/components/Compass/CompassDockMain.d.ts.map +1 -0
- package/dist/esm/components/Compass/CompassDockMain.js +10 -0
- package/dist/esm/components/Compass/CompassDockMain.js.map +1 -0
- package/dist/esm/components/Compass/index.d.ts +1 -0
- package/dist/esm/components/Compass/index.d.ts.map +1 -1
- package/dist/esm/components/Compass/index.js +1 -0
- package/dist/esm/components/Compass/index.js.map +1 -1
- package/dist/esm/components/OverflowMenu/OverflowMenu.d.ts +7 -1
- package/dist/esm/components/OverflowMenu/OverflowMenu.d.ts.map +1 -1
- package/dist/esm/components/OverflowMenu/OverflowMenu.js +33 -3
- package/dist/esm/components/OverflowMenu/OverflowMenu.js.map +1 -1
- package/dist/esm/components/Page/Page.d.ts +3 -3
- package/dist/esm/components/Page/Page.d.ts.map +1 -1
- package/dist/esm/components/Toolbar/Toolbar.d.ts +5 -1
- 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/Toolbar/ToolbarContent.d.ts +9 -1
- package/dist/esm/components/Toolbar/ToolbarContent.d.ts.map +1 -1
- package/dist/esm/components/Toolbar/ToolbarContent.js +2 -2
- package/dist/esm/components/Toolbar/ToolbarContent.js.map +1 -1
- package/dist/esm/components/Toolbar/ToolbarGroup.d.ts +9 -1
- package/dist/esm/components/Toolbar/ToolbarGroup.d.ts.map +1 -1
- package/dist/esm/components/Toolbar/ToolbarGroup.js +3 -3
- package/dist/esm/components/Toolbar/ToolbarGroup.js.map +1 -1
- package/dist/esm/components/Toolbar/ToolbarItem.d.ts +9 -1
- package/dist/esm/components/Toolbar/ToolbarItem.d.ts.map +1 -1
- package/dist/esm/components/Toolbar/ToolbarItem.js +2 -2
- package/dist/esm/components/Toolbar/ToolbarItem.js.map +1 -1
- package/dist/js/components/Compass/Compass.d.ts +9 -1
- 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/Compass/CompassDockMain.d.ts +9 -0
- package/dist/js/components/Compass/CompassDockMain.d.ts.map +1 -0
- package/dist/js/components/Compass/CompassDockMain.js +14 -0
- package/dist/js/components/Compass/CompassDockMain.js.map +1 -0
- package/dist/js/components/Compass/index.d.ts +1 -0
- package/dist/js/components/Compass/index.d.ts.map +1 -1
- package/dist/js/components/Compass/index.js +1 -0
- package/dist/js/components/Compass/index.js.map +1 -1
- package/dist/js/components/OverflowMenu/OverflowMenu.d.ts +7 -1
- package/dist/js/components/OverflowMenu/OverflowMenu.d.ts.map +1 -1
- package/dist/js/components/OverflowMenu/OverflowMenu.js +32 -2
- package/dist/js/components/OverflowMenu/OverflowMenu.js.map +1 -1
- package/dist/js/components/Page/Page.d.ts +3 -3
- package/dist/js/components/Page/Page.d.ts.map +1 -1
- package/dist/js/components/Toolbar/Toolbar.d.ts +5 -1
- 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/Toolbar/ToolbarContent.d.ts +9 -1
- package/dist/js/components/Toolbar/ToolbarContent.d.ts.map +1 -1
- package/dist/js/components/Toolbar/ToolbarContent.js +2 -2
- package/dist/js/components/Toolbar/ToolbarContent.js.map +1 -1
- package/dist/js/components/Toolbar/ToolbarGroup.d.ts +9 -1
- package/dist/js/components/Toolbar/ToolbarGroup.d.ts.map +1 -1
- package/dist/js/components/Toolbar/ToolbarGroup.js +3 -3
- package/dist/js/components/Toolbar/ToolbarGroup.js.map +1 -1
- package/dist/js/components/Toolbar/ToolbarItem.d.ts +9 -1
- package/dist/js/components/Toolbar/ToolbarItem.d.ts.map +1 -1
- package/dist/js/components/Toolbar/ToolbarItem.js +2 -2
- package/dist/js/components/Toolbar/ToolbarItem.js.map +1 -1
- package/dist/umd/assets/{output-C2ilqqsl.css → output-BwoQb44a.css} +22943 -22734
- package/dist/umd/react-core.min.js +1 -1
- 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 +24 -2
- package/src/components/Compass/CompassDockMain.tsx +21 -0
- package/src/components/Compass/__tests__/Compass.test.tsx +30 -0
- package/src/components/Compass/__tests__/CompassDockMain.test.tsx +41 -0
- package/src/components/Compass/__tests__/__snapshots__/CompassDockMain.test.tsx.snap +13 -0
- package/src/components/Compass/index.ts +1 -0
- package/src/components/EmptyState/__tests__/EmptyState.test.tsx +2 -2
- package/src/components/EmptyState/__tests__/__snapshots__/EmptyState.test.tsx.snap +2 -2
- package/src/components/MenuToggle/__tests__/__snapshots__/MenuToggle.test.tsx.snap +1 -1
- package/src/components/OverflowMenu/OverflowMenu.tsx +42 -4
- package/src/components/OverflowMenu/__tests__/OverflowMenu.test.tsx +18 -0
- package/src/components/OverflowMenu/examples/OverflowMenu.md +17 -1
- package/src/components/OverflowMenu/examples/OverflowMenuBreakpointOnContainerHeight.tsx +109 -0
- package/src/components/OverflowMenu/examples/OverflowMenuSimpleVertical.tsx +76 -0
- package/src/components/Page/Page.tsx +3 -3
- package/src/components/Toolbar/Toolbar.tsx +9 -1
- package/src/components/Toolbar/ToolbarContent.tsx +12 -2
- package/src/components/Toolbar/ToolbarGroup.tsx +12 -2
- package/src/components/Toolbar/ToolbarItem.tsx +12 -2
- package/src/components/Toolbar/__tests__/Toolbar.test.tsx +63 -2
- package/src/components/Toolbar/__tests__/ToolbarGroup.test.tsx +26 -0
- package/src/components/Toolbar/__tests__/ToolbarItem.test.tsx +26 -0
- package/src/components/Toolbar/examples/Toolbar.md +19 -1
- package/src/components/Toolbar/examples/ToolbarDynamicSticky.tsx +75 -0
- package/src/components/Toolbar/examples/ToolbarVertical.tsx +22 -0
- package/src/demos/Compass/Compass.md +4 -1
- package/src/demos/Compass/examples/CompassDockDemo.tsx +311 -130
- package/src/demos/Nav.md +2 -1
- package/src/demos/examples/Nav/NavDockedNav.tsx +32 -10
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.5.0-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.5.0-prerelease.63","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.5.0-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.5.0-prerelease.63","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.5.0-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.5.0-prerelease.63","private":true}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@patternfly/react-core",
|
|
3
|
-
"version": "6.5.0-prerelease.
|
|
3
|
+
"version": "6.5.0-prerelease.64",
|
|
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.5.0-prerelease.
|
|
50
|
-
"@patternfly/react-styles": "^6.5.0-prerelease.
|
|
51
|
-
"@patternfly/react-tokens": "^6.5.0-prerelease.
|
|
49
|
+
"@patternfly/react-icons": "^6.5.0-prerelease.29",
|
|
50
|
+
"@patternfly/react-styles": "^6.5.0-prerelease.21",
|
|
51
|
+
"@patternfly/react-tokens": "^6.5.0-prerelease.20",
|
|
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.5.0-prerelease.
|
|
57
|
+
"@patternfly/patternfly": "6.5.0-prerelease.78",
|
|
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": "e47cb62c1acf1d92a2b40dcaffd5fa015278a1e2"
|
|
67
67
|
}
|
|
@@ -8,9 +8,17 @@ import compassBackgroundImageDark from '@patternfly/react-tokens/dist/esm/c_comp
|
|
|
8
8
|
export interface CompassProps extends React.HTMLProps<HTMLDivElement> {
|
|
9
9
|
/** Additional classes added to the Compass. */
|
|
10
10
|
className?: string;
|
|
11
|
+
/** The horizontal masthead content (e.g. <Masthead />). This masthead will only render when dock content is passed and only at mobile viewports. */
|
|
12
|
+
masthead?: React.ReactNode;
|
|
11
13
|
/** Content of the docked navigation area of the layout */
|
|
12
14
|
dock?: React.ReactNode;
|
|
13
|
-
/**
|
|
15
|
+
/** @beta Flag indicating the docked nav is expanded on mobile. Only applies when dock content is passed. */
|
|
16
|
+
isDockExpanded?: boolean;
|
|
17
|
+
/** @beta Flag indicating the docked nav should display text on desktop. Only applies when dock content is passed, and
|
|
18
|
+
* will handle toggling the visibility of the text in individual isDocked components.
|
|
19
|
+
*/
|
|
20
|
+
isDockTextExpanded?: boolean;
|
|
21
|
+
/** Content placed at the top of the compass layout */
|
|
14
22
|
header?: React.ReactNode;
|
|
15
23
|
/** Flag indicating if the header is expanded */
|
|
16
24
|
isHeaderExpanded?: boolean;
|
|
@@ -40,7 +48,10 @@ export interface CompassProps extends React.HTMLProps<HTMLDivElement> {
|
|
|
40
48
|
|
|
41
49
|
export const Compass: React.FunctionComponent<CompassProps> = ({
|
|
42
50
|
className,
|
|
51
|
+
masthead,
|
|
43
52
|
dock,
|
|
53
|
+
isDockExpanded,
|
|
54
|
+
isDockTextExpanded,
|
|
44
55
|
header,
|
|
45
56
|
isHeaderExpanded = true,
|
|
46
57
|
sidebarStart,
|
|
@@ -72,7 +83,18 @@ export const Compass: React.FunctionComponent<CompassProps> = ({
|
|
|
72
83
|
{...props}
|
|
73
84
|
style={{ ...props.style, ...backgroundImageStyles }}
|
|
74
85
|
>
|
|
75
|
-
{dock &&
|
|
86
|
+
{dock && masthead}
|
|
87
|
+
{dock && (
|
|
88
|
+
<div
|
|
89
|
+
className={css(
|
|
90
|
+
`${styles.compass}__dock`,
|
|
91
|
+
isDockExpanded && styles.modifiers.expanded,
|
|
92
|
+
isDockTextExpanded && styles.modifiers.textExpanded
|
|
93
|
+
)}
|
|
94
|
+
>
|
|
95
|
+
{dock}
|
|
96
|
+
</div>
|
|
97
|
+
)}
|
|
76
98
|
{header && (
|
|
77
99
|
<div
|
|
78
100
|
className={css(styles.compassHeader, isHeaderExpanded && 'pf-m-expanded')}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import styles from '@patternfly/react-styles/css/components/Compass/compass';
|
|
2
|
+
import { css } from '@patternfly/react-styles';
|
|
3
|
+
|
|
4
|
+
export interface CompassDockMainProps extends React.HTMLProps<HTMLDivElement> {
|
|
5
|
+
/** Additional classes added to the compass dock main container. */
|
|
6
|
+
className?: string;
|
|
7
|
+
/** Content of the compass dock main container. */
|
|
8
|
+
children?: React.ReactNode;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export const CompassDockMain: React.FunctionComponent<CompassDockMainProps> = ({
|
|
12
|
+
className,
|
|
13
|
+
children,
|
|
14
|
+
...props
|
|
15
|
+
}: CompassDockMainProps) => (
|
|
16
|
+
<div className={css(styles.compassDockMain, className)} {...props}>
|
|
17
|
+
{children}
|
|
18
|
+
</div>
|
|
19
|
+
);
|
|
20
|
+
|
|
21
|
+
CompassDockMain.displayName = 'CompassDockMain';
|
|
@@ -180,3 +180,33 @@ test(`Does not render with ${styles.modifiers.docked} class when dock is not pas
|
|
|
180
180
|
render(<Compass data-testid="compass" />);
|
|
181
181
|
expect(screen.getByTestId('compass')).not.toHaveClass(styles.modifiers.docked);
|
|
182
182
|
});
|
|
183
|
+
|
|
184
|
+
test('Does not render masthead content when dock is not passed', () => {
|
|
185
|
+
render(<Compass masthead="Masthead content" />);
|
|
186
|
+
expect(screen.queryByText('Masthead content')).not.toBeInTheDocument();
|
|
187
|
+
});
|
|
188
|
+
|
|
189
|
+
test('Renders masthead content when dock is passed', () => {
|
|
190
|
+
render(<Compass masthead={<div>Masthead content</div>} dock={<div>Dock content</div>} />);
|
|
191
|
+
expect(screen.getByText('Masthead content')).toBeVisible();
|
|
192
|
+
});
|
|
193
|
+
|
|
194
|
+
test(`Renders dock with ${styles.modifiers.expanded} class when isDockExpanded is true`, () => {
|
|
195
|
+
render(<Compass dock="Dock content" isDockExpanded />);
|
|
196
|
+
expect(screen.getByText('Dock content')).toHaveClass(styles.modifiers.expanded);
|
|
197
|
+
});
|
|
198
|
+
|
|
199
|
+
test(`Renders dock without ${styles.modifiers.expanded} class when isDockExpanded is false`, () => {
|
|
200
|
+
render(<Compass dock="Dock content" isDockExpanded={false} />);
|
|
201
|
+
expect(screen.getByText('Dock content')).not.toHaveClass(styles.modifiers.expanded);
|
|
202
|
+
});
|
|
203
|
+
|
|
204
|
+
test(`Renders dock with ${styles.modifiers.textExpanded} class when isDockTextExpanded is true`, () => {
|
|
205
|
+
render(<Compass dock="Dock content" isDockTextExpanded />);
|
|
206
|
+
expect(screen.getByText('Dock content')).toHaveClass(styles.modifiers.textExpanded);
|
|
207
|
+
});
|
|
208
|
+
|
|
209
|
+
test(`Renders dock without ${styles.modifiers.textExpanded} class when isDockTextExpanded is false`, () => {
|
|
210
|
+
render(<Compass dock="Dock content" isDockTextExpanded={false} />);
|
|
211
|
+
expect(screen.getByText('Dock content')).not.toHaveClass(styles.modifiers.textExpanded);
|
|
212
|
+
});
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { render, screen } from '@testing-library/react';
|
|
2
|
+
import { CompassDockMain } from '../CompassDockMain';
|
|
3
|
+
import styles from '@patternfly/react-styles/css/components/Compass/compass';
|
|
4
|
+
|
|
5
|
+
test('Renders without children', () => {
|
|
6
|
+
render(
|
|
7
|
+
<div data-testid="test-compass-dock-main">
|
|
8
|
+
<CompassDockMain />
|
|
9
|
+
</div>
|
|
10
|
+
);
|
|
11
|
+
expect(screen.getByTestId('test-compass-dock-main').firstChild).toBeVisible();
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
test('Renders with children', () => {
|
|
15
|
+
render(<CompassDockMain>Test content</CompassDockMain>);
|
|
16
|
+
expect(screen.getByText('Test content')).toBeVisible();
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
test('Renders with custom class name when className prop is provided', () => {
|
|
20
|
+
render(<CompassDockMain className="custom-class">Test</CompassDockMain>);
|
|
21
|
+
expect(screen.getByText('Test')).toHaveClass('custom-class');
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
test(`Renders with default ${styles.compassDockMain} class`, () => {
|
|
25
|
+
render(<CompassDockMain>Test</CompassDockMain>);
|
|
26
|
+
expect(screen.getByText('Test')).toHaveClass(styles.compassDockMain, { exact: true });
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
test('Renders with additional props spread to the component', () => {
|
|
30
|
+
render(<CompassDockMain id="custom-id">Test</CompassDockMain>);
|
|
31
|
+
expect(screen.getByText('Test')).toHaveAttribute('id', 'custom-id');
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
test('Matches the snapshot', () => {
|
|
35
|
+
const { asFragment } = render(
|
|
36
|
+
<CompassDockMain>
|
|
37
|
+
<div>Test content</div>
|
|
38
|
+
</CompassDockMain>
|
|
39
|
+
);
|
|
40
|
+
expect(asFragment()).toMatchSnapshot();
|
|
41
|
+
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { render, screen } from '@testing-library/react';
|
|
2
2
|
|
|
3
|
-
import
|
|
3
|
+
import RhUiDocumentIcon from '@patternfly/react-icons/dist/esm/icons/rh-ui-document-icon';
|
|
4
4
|
|
|
5
5
|
import { EmptyState, EmptyStateVariant } from '../EmptyState';
|
|
6
6
|
import { EmptyStateBody } from '../EmptyStateBody';
|
|
@@ -71,7 +71,7 @@ describe('EmptyState', () => {
|
|
|
71
71
|
});
|
|
72
72
|
|
|
73
73
|
test('Header with icon', () => {
|
|
74
|
-
const { asFragment } = render(<EmptyStateHeader titleText="Empty state" icon={
|
|
74
|
+
const { asFragment } = render(<EmptyStateHeader titleText="Empty state" icon={RhUiDocumentIcon} />);
|
|
75
75
|
expect(asFragment()).toMatchSnapshot();
|
|
76
76
|
});
|
|
77
77
|
|
|
@@ -40,11 +40,11 @@ exports[`EmptyState Header with icon 1`] = `
|
|
|
40
40
|
fill="currentColor"
|
|
41
41
|
height="1em"
|
|
42
42
|
role="img"
|
|
43
|
-
viewBox="0 0
|
|
43
|
+
viewBox="0 0 32 32"
|
|
44
44
|
width="1em"
|
|
45
45
|
>
|
|
46
46
|
<path
|
|
47
|
-
d="
|
|
47
|
+
d="M26.5 1H12a1.001 1.001 0 0 0-.708.294L4.294 8.292A1.001 1.001 0 0 0 4 9v20.5c0 .827.673 1.5 1.5 1.5h21c.827 0 1.5-.673 1.5-1.5v-27c0-.827-.673-1.5-1.5-1.5ZM11 4.414V8H7.414L11 4.414ZM26 29H6V10h5.5c.827 0 1.5-.673 1.5-1.5V3h13v26Z"
|
|
48
48
|
/>
|
|
49
49
|
</svg>
|
|
50
50
|
</div>
|
|
@@ -188,7 +188,7 @@ exports[`Old Snapshot tests - remove when refactoring shows icon 1`] = `
|
|
|
188
188
|
width="1em"
|
|
189
189
|
>
|
|
190
190
|
<path
|
|
191
|
-
d="
|
|
191
|
+
d="M26.463 16.845a9.635 9.635 0 0 0-.002-1.688l3.41-1.974a.5.5 0 0 0 .235-.548 14.47 14.47 0 0 0-4.142-7.167.5.5 0 0 0-.594-.07l-3.404 1.97c-.469-.326-.96-.61-1.466-.85V2.58a.5.5 0 0 0-.356-.48 14.662 14.662 0 0 0-8.288 0 .5.5 0 0 0-.356.48v3.944c-.513.245-1.003.528-1.462.846L6.63 5.397a.5.5 0 0 0-.594.07 14.47 14.47 0 0 0-4.142 7.168.5.5 0 0 0 .236.548l3.407 1.972a9.635 9.635 0 0 0 .002 1.688l-3.41 1.974a.5.5 0 0 0-.235.548 14.47 14.47 0 0 0 4.142 7.167c.16.154.405.18.594.07l3.404-1.97c.469.326.96.61 1.466.85v3.938a.5.5 0 0 0 .356.48c1.333.398 2.728.6 4.144.6s2.81-.202 4.144-.6a.5.5 0 0 0 .356-.48v-3.944a10.449 10.449 0 0 0 1.462-.846l3.408 1.973a.5.5 0 0 0 .594-.07 14.47 14.47 0 0 0 4.142-7.168.5.5 0 0 0-.236-.548l-3.407-1.972ZM16 21c-2.757 0-5-2.243-5-5s2.243-5 5-5 5 2.243 5 5-2.243 5-5 5Z"
|
|
192
192
|
/>
|
|
193
193
|
</svg>
|
|
194
194
|
</span>
|
|
@@ -3,18 +3,21 @@ import styles from '@patternfly/react-styles/css/components/OverflowMenu/overflo
|
|
|
3
3
|
import { css } from '@patternfly/react-styles';
|
|
4
4
|
import { OverflowMenuContext } from './OverflowMenuContext';
|
|
5
5
|
import { debounce } from '../../helpers/util';
|
|
6
|
-
import { globalWidthBreakpoints } from '../../helpers/constants';
|
|
6
|
+
import { globalWidthBreakpoints, globalHeightBreakpoints } from '../../helpers/constants';
|
|
7
7
|
import { getResizeObserver } from '../../helpers/resizeObserver';
|
|
8
|
+
import { PickOptional } from '../../helpers/typeUtils';
|
|
8
9
|
|
|
9
10
|
export interface OverflowMenuProps extends React.HTMLProps<HTMLDivElement> {
|
|
10
11
|
/** Any elements that can be rendered in the menu */
|
|
11
12
|
children?: any;
|
|
12
13
|
/** Additional classes added to the OverflowMenu. */
|
|
13
14
|
className?: string;
|
|
14
|
-
/** Indicates breakpoint at which to switch between
|
|
15
|
+
/** Indicates breakpoint at which to switch between expanded and collapsed states. The "sm" breakpoint does not apply to vertical overflow menus. */
|
|
15
16
|
breakpoint: 'sm' | 'md' | 'lg' | 'xl' | '2xl';
|
|
16
17
|
/** A container reference to base the specified breakpoint on instead of the viewport width. */
|
|
17
18
|
breakpointReference?: HTMLElement | (() => HTMLElement) | React.RefObject<any>;
|
|
19
|
+
/** Indicates the overflow menu orientation is vertical and should respond to height changes instead of width. */
|
|
20
|
+
isVertical?: boolean;
|
|
18
21
|
}
|
|
19
22
|
|
|
20
23
|
export interface OverflowMenuState extends React.HTMLProps<HTMLDivElement> {
|
|
@@ -24,6 +27,11 @@ export interface OverflowMenuState extends React.HTMLProps<HTMLDivElement> {
|
|
|
24
27
|
|
|
25
28
|
class OverflowMenu extends Component<OverflowMenuProps, OverflowMenuState> {
|
|
26
29
|
static displayName = 'OverflowMenu';
|
|
30
|
+
|
|
31
|
+
static defaultProps: PickOptional<OverflowMenuProps> = {
|
|
32
|
+
isVertical: false
|
|
33
|
+
};
|
|
34
|
+
|
|
27
35
|
constructor(props: OverflowMenuProps) {
|
|
28
36
|
super(props);
|
|
29
37
|
this.state = {
|
|
@@ -69,6 +77,15 @@ class OverflowMenu extends Component<OverflowMenuProps, OverflowMenuState> {
|
|
|
69
77
|
}
|
|
70
78
|
|
|
71
79
|
handleResize = () => {
|
|
80
|
+
const { isVertical } = this.props;
|
|
81
|
+
if (isVertical) {
|
|
82
|
+
this.handleResizeHeight();
|
|
83
|
+
} else {
|
|
84
|
+
this.handleResizeWidth();
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
handleResizeWidth = () => {
|
|
72
89
|
const breakpointWidth = globalWidthBreakpoints[this.props.breakpoint];
|
|
73
90
|
if (!breakpointWidth) {
|
|
74
91
|
// eslint-disable-next-line no-console
|
|
@@ -83,14 +100,35 @@ class OverflowMenu extends Component<OverflowMenuProps, OverflowMenuState> {
|
|
|
83
100
|
}
|
|
84
101
|
};
|
|
85
102
|
|
|
103
|
+
handleResizeHeight = () => {
|
|
104
|
+
const breakpointHeight = globalHeightBreakpoints[this.props.breakpoint];
|
|
105
|
+
if (breakpointHeight === 0) {
|
|
106
|
+
// eslint-disable-next-line no-console
|
|
107
|
+
console.warn('The "sm" breakpoint does not apply to vertical overflow menus.');
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
if (!breakpointHeight) {
|
|
112
|
+
// eslint-disable-next-line no-console
|
|
113
|
+
console.error('OverflowMenu will not be visible without a valid breakpoint.');
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
const relativeHeight = this.state.breakpointRef ? this.state.breakpointRef.clientHeight : window.innerHeight;
|
|
118
|
+
const isBelowBreakpoint = relativeHeight < breakpointHeight;
|
|
119
|
+
if (this.state.isBelowBreakpoint !== isBelowBreakpoint) {
|
|
120
|
+
this.setState({ isBelowBreakpoint });
|
|
121
|
+
}
|
|
122
|
+
};
|
|
123
|
+
|
|
86
124
|
handleResizeWithDelay = debounce(this.handleResize, 250);
|
|
87
125
|
|
|
88
126
|
render() {
|
|
89
127
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
90
|
-
const { className, breakpoint, children, breakpointReference, ...props } = this.props;
|
|
128
|
+
const { className, breakpoint, children, breakpointReference, isVertical, ...props } = this.props;
|
|
91
129
|
|
|
92
130
|
return (
|
|
93
|
-
<div {...props} className={css(styles.overflowMenu, className)}>
|
|
131
|
+
<div {...props} className={css(styles.overflowMenu, isVertical && styles.modifiers.vertical, className)}>
|
|
94
132
|
<OverflowMenuContext.Provider value={{ isBelowBreakpoint: this.state.isBelowBreakpoint }}>
|
|
95
133
|
{children}
|
|
96
134
|
</OverflowMenuContext.Provider>
|
|
@@ -79,4 +79,22 @@ describe('OverflowMenu', () => {
|
|
|
79
79
|
|
|
80
80
|
expect(resizeObserver).toHaveBeenCalledWith(containerRef.current, expect.any(Function));
|
|
81
81
|
});
|
|
82
|
+
|
|
83
|
+
test(`applies ${styles.modifiers.vertical} when isVertical is passed`, () => {
|
|
84
|
+
render(<OverflowMenu breakpoint="md" isVertical data-testid="test-id" />);
|
|
85
|
+
expect(screen.getByTestId('test-id')).toHaveClass(styles.modifiers.vertical);
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
test('warns when using "sm" breakpoint and isVertical is passed', () => {
|
|
89
|
+
const warnMock = jest.fn() as any;
|
|
90
|
+
const originalConsole = global.console;
|
|
91
|
+
global.console = { ...originalConsole, warn: warnMock } as any;
|
|
92
|
+
|
|
93
|
+
try {
|
|
94
|
+
render(<OverflowMenu breakpoint="sm" isVertical />);
|
|
95
|
+
expect(warnMock).toHaveBeenCalledWith('The "sm" breakpoint does not apply to vertical overflow menus.');
|
|
96
|
+
} finally {
|
|
97
|
+
global.console = originalConsole;
|
|
98
|
+
}
|
|
99
|
+
});
|
|
82
100
|
});
|
|
@@ -27,6 +27,14 @@ import EllipsisVIcon from '@patternfly/react-icons/dist/esm/icons/ellipsis-v-ico
|
|
|
27
27
|
|
|
28
28
|
```
|
|
29
29
|
|
|
30
|
+
### Vertical
|
|
31
|
+
|
|
32
|
+
Passing `isVertical` to `OverflowMenu` will change its behavior to respond to breakpoints based on window height instead of width.
|
|
33
|
+
|
|
34
|
+
```ts file="./OverflowMenuSimpleVertical.tsx"
|
|
35
|
+
|
|
36
|
+
```
|
|
37
|
+
|
|
30
38
|
### Group types
|
|
31
39
|
|
|
32
40
|
```ts file="./OverflowMenuGroupTypes.tsx"
|
|
@@ -45,7 +53,7 @@ import EllipsisVIcon from '@patternfly/react-icons/dist/esm/icons/ellipsis-v-ico
|
|
|
45
53
|
|
|
46
54
|
```
|
|
47
55
|
|
|
48
|
-
### Breakpoint on container
|
|
56
|
+
### Breakpoint on container width
|
|
49
57
|
|
|
50
58
|
By passing in the `breakpointReference` property, the overflow menu's breakpoint will be relative to the width of the reference container rather than the viewport width.
|
|
51
59
|
|
|
@@ -54,3 +62,11 @@ You can change the container width in this example by adjusting the slider. As t
|
|
|
54
62
|
```ts file="./OverflowMenuBreakpointOnContainer.tsx"
|
|
55
63
|
|
|
56
64
|
```
|
|
65
|
+
|
|
66
|
+
### Breakpoint on container height
|
|
67
|
+
|
|
68
|
+
By passing in the `breakpointReference` and `isVertical` properties, the overflow menu's breakpoint will be determined relative to the height of the reference container rather than the window height.
|
|
69
|
+
|
|
70
|
+
```ts isFullscreen file="./OverflowMenuBreakpointOnContainerHeight.tsx"
|
|
71
|
+
|
|
72
|
+
```
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { useRef, useState } from 'react';
|
|
2
|
+
import {
|
|
3
|
+
OverflowMenu,
|
|
4
|
+
OverflowMenuControl,
|
|
5
|
+
OverflowMenuContent,
|
|
6
|
+
OverflowMenuGroup,
|
|
7
|
+
OverflowMenuItem,
|
|
8
|
+
OverflowMenuDropdownItem,
|
|
9
|
+
MenuToggle,
|
|
10
|
+
Slider,
|
|
11
|
+
SliderOnChangeEvent,
|
|
12
|
+
Dropdown,
|
|
13
|
+
DropdownList
|
|
14
|
+
} from '@patternfly/react-core';
|
|
15
|
+
import EllipsisVIcon from '@patternfly/react-icons/dist/esm/icons/ellipsis-v-icon';
|
|
16
|
+
|
|
17
|
+
export const OverflowMenuBreakpointOnContainerHeight: React.FunctionComponent = () => {
|
|
18
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
19
|
+
const [containerHeight, setContainerHeight] = useState(100);
|
|
20
|
+
const containerRef = useRef<HTMLDivElement>(null);
|
|
21
|
+
|
|
22
|
+
const onToggle = () => {
|
|
23
|
+
setIsOpen(!isOpen);
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
const onSelect = () => {
|
|
27
|
+
setIsOpen(!isOpen);
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
const onChange = (_event: SliderOnChangeEvent, value: number) => {
|
|
31
|
+
setContainerHeight(value);
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
const containerStyles = {
|
|
35
|
+
height: `${containerHeight}%`,
|
|
36
|
+
padding: '1rem',
|
|
37
|
+
borderWidth: '2px',
|
|
38
|
+
borderStyle: 'dashed'
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
const dropdownItems = [
|
|
42
|
+
<OverflowMenuDropdownItem itemId={0} key="item1" isShared>
|
|
43
|
+
Item 1
|
|
44
|
+
</OverflowMenuDropdownItem>,
|
|
45
|
+
<OverflowMenuDropdownItem itemId={1} key="item2" isShared>
|
|
46
|
+
Item 2
|
|
47
|
+
</OverflowMenuDropdownItem>,
|
|
48
|
+
<OverflowMenuDropdownItem itemId={2} key="item3" isShared>
|
|
49
|
+
Item 3
|
|
50
|
+
</OverflowMenuDropdownItem>,
|
|
51
|
+
<OverflowMenuDropdownItem itemId={3} key="item4" isShared>
|
|
52
|
+
Item 4
|
|
53
|
+
</OverflowMenuDropdownItem>,
|
|
54
|
+
<OverflowMenuDropdownItem itemId={4} key="item5" isShared>
|
|
55
|
+
Item 5
|
|
56
|
+
</OverflowMenuDropdownItem>
|
|
57
|
+
];
|
|
58
|
+
|
|
59
|
+
return (
|
|
60
|
+
<>
|
|
61
|
+
<span id="overflowMenu-hasBreakpointOnContainer-height-slider-label">Current container height</span>:{' '}
|
|
62
|
+
{containerHeight}%
|
|
63
|
+
<Slider
|
|
64
|
+
value={containerHeight}
|
|
65
|
+
onChange={onChange}
|
|
66
|
+
max={100}
|
|
67
|
+
min={20}
|
|
68
|
+
step={20}
|
|
69
|
+
showTicks
|
|
70
|
+
showBoundaries={false}
|
|
71
|
+
aria-labelledby="overflowMenu-hasBreakpointOnContainer-height-slider-label"
|
|
72
|
+
/>
|
|
73
|
+
<div style={{ height: '100%' }}>
|
|
74
|
+
<div ref={containerRef} id="height-breakpoint-reference-container" style={containerStyles}>
|
|
75
|
+
<OverflowMenu breakpointReference={containerRef} breakpoint="md" isVertical>
|
|
76
|
+
<OverflowMenuContent>
|
|
77
|
+
<OverflowMenuItem>Item 1</OverflowMenuItem>
|
|
78
|
+
<OverflowMenuItem>Item 2</OverflowMenuItem>
|
|
79
|
+
<OverflowMenuGroup>
|
|
80
|
+
<OverflowMenuItem>Item 3</OverflowMenuItem>
|
|
81
|
+
<OverflowMenuItem>Item 4</OverflowMenuItem>
|
|
82
|
+
<OverflowMenuItem>Item 5</OverflowMenuItem>
|
|
83
|
+
</OverflowMenuGroup>
|
|
84
|
+
</OverflowMenuContent>
|
|
85
|
+
<OverflowMenuControl>
|
|
86
|
+
<Dropdown
|
|
87
|
+
onSelect={onSelect}
|
|
88
|
+
toggle={(toggleRef) => (
|
|
89
|
+
<MenuToggle
|
|
90
|
+
ref={toggleRef}
|
|
91
|
+
aria-label="Height breakpoint on container example overflow menu"
|
|
92
|
+
variant="plain"
|
|
93
|
+
onClick={onToggle}
|
|
94
|
+
isExpanded={isOpen}
|
|
95
|
+
icon={<EllipsisVIcon />}
|
|
96
|
+
/>
|
|
97
|
+
)}
|
|
98
|
+
isOpen={isOpen}
|
|
99
|
+
onOpenChange={(isOpen) => setIsOpen(isOpen)}
|
|
100
|
+
>
|
|
101
|
+
<DropdownList>{dropdownItems}</DropdownList>
|
|
102
|
+
</Dropdown>
|
|
103
|
+
</OverflowMenuControl>
|
|
104
|
+
</OverflowMenu>
|
|
105
|
+
</div>
|
|
106
|
+
</div>
|
|
107
|
+
</>
|
|
108
|
+
);
|
|
109
|
+
};
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { useState } from 'react';
|
|
2
|
+
import {
|
|
3
|
+
OverflowMenu,
|
|
4
|
+
OverflowMenuControl,
|
|
5
|
+
OverflowMenuContent,
|
|
6
|
+
OverflowMenuGroup,
|
|
7
|
+
OverflowMenuItem,
|
|
8
|
+
OverflowMenuDropdownItem,
|
|
9
|
+
MenuToggle,
|
|
10
|
+
Dropdown,
|
|
11
|
+
DropdownList
|
|
12
|
+
} from '@patternfly/react-core';
|
|
13
|
+
import EllipsisVIcon from '@patternfly/react-icons/dist/esm/icons/ellipsis-v-icon';
|
|
14
|
+
|
|
15
|
+
export const OverflowMenuSimpleVertical: React.FunctionComponent = () => {
|
|
16
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
17
|
+
|
|
18
|
+
const onToggle = () => {
|
|
19
|
+
setIsOpen(!isOpen);
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
const onSelect = () => {
|
|
23
|
+
setIsOpen(!isOpen);
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
const dropdownItems = [
|
|
27
|
+
<OverflowMenuDropdownItem itemId={0} key="item1" isShared>
|
|
28
|
+
Item 1
|
|
29
|
+
</OverflowMenuDropdownItem>,
|
|
30
|
+
<OverflowMenuDropdownItem itemId={1} key="item2" isShared>
|
|
31
|
+
Item 2
|
|
32
|
+
</OverflowMenuDropdownItem>,
|
|
33
|
+
<OverflowMenuDropdownItem itemId={2} key="item3" isShared>
|
|
34
|
+
Item 3
|
|
35
|
+
</OverflowMenuDropdownItem>,
|
|
36
|
+
<OverflowMenuDropdownItem itemId={3} key="item4" isShared>
|
|
37
|
+
Item 4
|
|
38
|
+
</OverflowMenuDropdownItem>,
|
|
39
|
+
<OverflowMenuDropdownItem itemId={4} key="item5" isShared>
|
|
40
|
+
Item 5
|
|
41
|
+
</OverflowMenuDropdownItem>
|
|
42
|
+
];
|
|
43
|
+
|
|
44
|
+
return (
|
|
45
|
+
<OverflowMenu breakpoint="md" isVertical>
|
|
46
|
+
<OverflowMenuContent>
|
|
47
|
+
<OverflowMenuItem>Item</OverflowMenuItem>
|
|
48
|
+
<OverflowMenuItem>Item</OverflowMenuItem>
|
|
49
|
+
<OverflowMenuGroup>
|
|
50
|
+
<OverflowMenuItem>Item</OverflowMenuItem>
|
|
51
|
+
<OverflowMenuItem>Item</OverflowMenuItem>
|
|
52
|
+
<OverflowMenuItem>Item</OverflowMenuItem>
|
|
53
|
+
</OverflowMenuGroup>
|
|
54
|
+
</OverflowMenuContent>
|
|
55
|
+
<OverflowMenuControl>
|
|
56
|
+
<Dropdown
|
|
57
|
+
onSelect={onSelect}
|
|
58
|
+
toggle={(toggleRef) => (
|
|
59
|
+
<MenuToggle
|
|
60
|
+
ref={toggleRef}
|
|
61
|
+
aria-label="Simple example overflow menu"
|
|
62
|
+
variant="plain"
|
|
63
|
+
onClick={onToggle}
|
|
64
|
+
isExpanded={isOpen}
|
|
65
|
+
icon={<EllipsisVIcon />}
|
|
66
|
+
/>
|
|
67
|
+
)}
|
|
68
|
+
isOpen={isOpen}
|
|
69
|
+
onOpenChange={(isOpen) => setIsOpen(isOpen)}
|
|
70
|
+
>
|
|
71
|
+
<DropdownList>{dropdownItems}</DropdownList>
|
|
72
|
+
</Dropdown>
|
|
73
|
+
</OverflowMenuControl>
|
|
74
|
+
</OverflowMenu>
|
|
75
|
+
);
|
|
76
|
+
};
|
|
@@ -24,9 +24,9 @@ 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 the docked nav should display text on desktop. Only applies when variant is docked, and
|
|
28
|
-
*
|
|
29
|
-
|
|
27
|
+
/** @beta Flag indicating the docked nav should display text on desktop. Only applies when variant is docked, and
|
|
28
|
+
* will handle toggling the visibility of the text in individual isDocked components.
|
|
29
|
+
*/
|
|
30
30
|
isDockTextExpanded?: boolean;
|
|
31
31
|
/** The horizontal masthead content (e.g. <Masthead />). When using the docked variant, this content will only render at mobile viewports. */
|
|
32
32
|
masthead?: React.ReactNode;
|
|
@@ -38,8 +38,12 @@ export interface ToolbarProps extends React.HTMLProps<HTMLDivElement>, OUIAProps
|
|
|
38
38
|
isFullHeight?: boolean;
|
|
39
39
|
/** Flag indicating the toolbar is static */
|
|
40
40
|
isStatic?: boolean;
|
|
41
|
-
/** Flag indicating the toolbar should stick to the top of its container */
|
|
41
|
+
/** Flag indicating the toolbar should stick to the top of its container. This property applies both the sticky position and styling. */
|
|
42
42
|
isSticky?: boolean;
|
|
43
|
+
/** @beta Flag indicating the toolbar should have sticky positioning to the top of its container */
|
|
44
|
+
isStickyBase?: boolean;
|
|
45
|
+
/** @beta Flag indicating the toolbar should have stuck styling, when the toolbar is not at the top of the scroll container */
|
|
46
|
+
isStickyStuck?: boolean;
|
|
43
47
|
/** @beta Flag indicating the toolbar has a vertical orientation */
|
|
44
48
|
isVertical?: boolean;
|
|
45
49
|
/** Insets at various breakpoints. */
|
|
@@ -144,6 +148,8 @@ class Toolbar extends Component<ToolbarProps, ToolbarState> {
|
|
|
144
148
|
children,
|
|
145
149
|
isFullHeight,
|
|
146
150
|
isStatic,
|
|
151
|
+
isStickyBase,
|
|
152
|
+
isStickyStuck,
|
|
147
153
|
inset,
|
|
148
154
|
isSticky,
|
|
149
155
|
isVertical,
|
|
@@ -171,6 +177,8 @@ class Toolbar extends Component<ToolbarProps, ToolbarState> {
|
|
|
171
177
|
isFullHeight && styles.modifiers.fullHeight,
|
|
172
178
|
isStatic && styles.modifiers.static,
|
|
173
179
|
isSticky && styles.modifiers.sticky,
|
|
180
|
+
isStickyBase && styles.modifiers.stickyBase,
|
|
181
|
+
isStickyStuck && styles.modifiers.stickyStuck,
|
|
174
182
|
isVertical && styles.modifiers.vertical,
|
|
175
183
|
formatBreakpointMods(inset, styles, '', getBreakpoint(width)),
|
|
176
184
|
colorVariant === 'primary' && styles.modifiers.primary,
|