@patternfly/react-core 6.0.0-alpha.91 → 6.0.0-alpha.93
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 +10 -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/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/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/Tile/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/Wizard/package.json +1 -1
- package/dist/dynamic/deprecated/components/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/dynamic-modules.json +2 -0
- package/dist/esm/components/Label/Label.d.ts.map +1 -1
- package/dist/esm/components/Label/Label.js +1 -1
- package/dist/esm/components/Label/Label.js.map +1 -1
- package/dist/esm/components/Masthead/MastheadBrand.d.ts +1 -3
- package/dist/esm/components/Masthead/MastheadBrand.d.ts.map +1 -1
- package/dist/esm/components/Masthead/MastheadBrand.js +2 -11
- package/dist/esm/components/Masthead/MastheadBrand.js.map +1 -1
- package/dist/esm/components/Masthead/MastheadLogo.d.ts +11 -0
- package/dist/esm/components/Masthead/MastheadLogo.d.ts.map +1 -0
- package/dist/esm/components/Masthead/MastheadLogo.js +19 -0
- package/dist/esm/components/Masthead/MastheadLogo.js.map +1 -0
- package/dist/esm/components/Masthead/index.d.ts +1 -0
- package/dist/esm/components/Masthead/index.d.ts.map +1 -1
- package/dist/esm/components/Masthead/index.js +1 -0
- package/dist/esm/components/Masthead/index.js.map +1 -1
- package/dist/esm/demos/DashboardHeader.d.ts.map +1 -1
- package/dist/esm/demos/DashboardHeader.js +6 -5
- package/dist/esm/demos/DashboardHeader.js.map +1 -1
- package/dist/js/components/Label/Label.d.ts.map +1 -1
- package/dist/js/components/Label/Label.js +1 -1
- package/dist/js/components/Label/Label.js.map +1 -1
- package/dist/js/components/Masthead/MastheadBrand.d.ts +1 -3
- package/dist/js/components/Masthead/MastheadBrand.d.ts.map +1 -1
- package/dist/js/components/Masthead/MastheadBrand.js +2 -11
- package/dist/js/components/Masthead/MastheadBrand.js.map +1 -1
- package/dist/js/components/Masthead/MastheadLogo.d.ts +11 -0
- package/dist/js/components/Masthead/MastheadLogo.d.ts.map +1 -0
- package/dist/js/components/Masthead/MastheadLogo.js +23 -0
- package/dist/js/components/Masthead/MastheadLogo.js.map +1 -0
- package/dist/js/components/Masthead/index.d.ts +1 -0
- package/dist/js/components/Masthead/index.d.ts.map +1 -1
- package/dist/js/components/Masthead/index.js +1 -0
- package/dist/js/components/Masthead/index.js.map +1 -1
- package/dist/js/demos/DashboardHeader.d.ts.map +1 -1
- package/dist/js/demos/DashboardHeader.js +5 -4
- package/dist/js/demos/DashboardHeader.js.map +1 -1
- package/dist/umd/assets/{output-B27G637D.css → output-DHPAPKR8.css} +19065 -18950
- 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/Label/Label.tsx +1 -0
- package/src/components/Label/__tests__/Label.test.tsx +7 -0
- package/src/components/Label/__tests__/__snapshots__/Label.test.tsx.snap +19 -0
- package/src/components/Label/__tests__/__snapshots__/LabelGroup.test.tsx.snap +1 -0
- package/src/components/Masthead/MastheadBrand.tsx +6 -20
- package/src/components/Masthead/MastheadLogo.tsx +35 -0
- package/src/components/Masthead/__tests__/Masthead.test.tsx +14 -12
- package/src/components/Masthead/__tests__/__snapshots__/Masthead.test.tsx.snap +44 -40
- package/src/components/Masthead/examples/Masthead.md +3 -3
- package/src/components/Masthead/examples/MastheadBasic.tsx +15 -5
- package/src/components/Masthead/examples/MastheadBasicMixedContent.tsx +8 -5
- package/src/components/Masthead/examples/MastheadDisplayInline.tsx +15 -5
- package/src/components/Masthead/examples/MastheadDisplayStack.tsx +15 -5
- package/src/components/Masthead/examples/MastheadDisplayStackInlineResponsive.tsx +15 -5
- package/src/components/Masthead/examples/MastheadIconRouterLink.tsx +9 -6
- package/src/components/Masthead/examples/MastheadInsets.tsx +15 -5
- package/src/components/Masthead/index.ts +1 -0
- package/src/components/Page/examples/Page.md +4 -1
- package/src/components/Page/examples/PageCenteredSection.tsx +17 -14
- package/src/components/Page/examples/PageGroupSection.tsx +17 -14
- package/src/components/Page/examples/PageHorizontalNav.tsx +5 -2
- package/src/components/Page/examples/PageMainSectionPadding.tsx +17 -14
- package/src/components/Page/examples/PageMainSectionVariations.tsx +17 -14
- package/src/components/Page/examples/PageMultipleSidebarBody.tsx +17 -14
- package/src/components/Page/examples/PageUncontrolledNav.tsx +11 -8
- package/src/components/Page/examples/PageVerticalNav.tsx +17 -14
- package/src/components/Page/examples/PageWithOrWithoutFill.tsx +17 -14
- package/src/demos/DashboardHeader.tsx +10 -7
- package/src/demos/Masthead.md +2 -0
- package/src/demos/NotificationDrawer/examples/NotificationDrawerBasic.tsx +10 -7
- package/src/demos/NotificationDrawer/examples/NotificationDrawerGrouped.tsx +10 -7
- package/src/demos/RTL/examples/PaginatedTable.jsx +13 -10
- package/src/demos/RTL/examples/PaginatedTable.tsx +13 -10
- package/src/demos/examples/Masthead/MastheadWithHorizontalNav.tsx +6 -3
- package/src/demos/examples/Masthead/MastheadWithUtilitiesAndUserDropdownMenu.tsx +11 -8
- package/src/demos/examples/Nav/NavFlyout.tsx +15 -12
- package/src/demos/examples/Nav/NavHorizontal.tsx +4 -1
- package/src/demos/examples/Nav/NavHorizontalWithSubnav.tsx +11 -8
- package/src/demos/examples/Nav/NavManual.tsx +15 -12
- package/src/demos/examples/Page/PageContextSelector.tsx +11 -8
- package/src/demos/examples/Page/PageStickySectionBreadcrumb.tsx +11 -8
- package/src/demos/examples/Page/PageStickySectionGroup.tsx +11 -8
- package/src/demos/examples/Page/PageStickySectionGroupAlternate.tsx +11 -8
- package/src/demos/examples/Wizard/InPageWithDrawer.tsx +11 -8
- package/src/demos/examples/Wizard/InPageWithDrawerInformationalStep.tsx +11 -8
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.0.0-alpha.
|
|
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.0.0-alpha.92","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.0.0-alpha.
|
|
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.0.0-alpha.92","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.0.0-alpha.
|
|
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.0.0-alpha.92","private":true}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@patternfly/react-core",
|
|
3
|
-
"version": "6.0.0-alpha.
|
|
3
|
+
"version": "6.0.0-alpha.93",
|
|
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",
|
|
@@ -47,15 +47,15 @@
|
|
|
47
47
|
"clean:exports": "node scripts/cleanDistExports.js"
|
|
48
48
|
},
|
|
49
49
|
"dependencies": {
|
|
50
|
-
"@patternfly/react-icons": "^6.0.0-alpha.
|
|
51
|
-
"@patternfly/react-styles": "^6.0.0-alpha.
|
|
52
|
-
"@patternfly/react-tokens": "^6.0.0-alpha.
|
|
50
|
+
"@patternfly/react-icons": "^6.0.0-alpha.33",
|
|
51
|
+
"@patternfly/react-styles": "^6.0.0-alpha.32",
|
|
52
|
+
"@patternfly/react-tokens": "^6.0.0-alpha.32",
|
|
53
53
|
"focus-trap": "7.5.4",
|
|
54
54
|
"react-dropzone": "^14.2.3",
|
|
55
55
|
"tslib": "^2.6.2"
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
58
|
-
"@patternfly/patternfly": "6.0.0-alpha.
|
|
58
|
+
"@patternfly/patternfly": "6.0.0-alpha.203",
|
|
59
59
|
"case-anything": "^2.1.13",
|
|
60
60
|
"css": "^3.0.0",
|
|
61
61
|
"fs-extra": "^11.2.0"
|
|
@@ -64,5 +64,5 @@
|
|
|
64
64
|
"react": "^17 || ^18",
|
|
65
65
|
"react-dom": "^17 || ^18"
|
|
66
66
|
},
|
|
67
|
-
"gitHead": "
|
|
67
|
+
"gitHead": "1b4893f237f016335930dd2bfc72e29a30412fce"
|
|
68
68
|
}
|
|
@@ -357,6 +357,7 @@ export const Label: React.FunctionComponent<LabelProps> = ({
|
|
|
357
357
|
className
|
|
358
358
|
)}
|
|
359
359
|
onClick={isOverflowLabel || isAddLabel ? onLabelClick : undefined}
|
|
360
|
+
{...(LabelComponent === 'button' && { type: 'button' })}
|
|
360
361
|
>
|
|
361
362
|
{!isEditableActive && labelComponentChild}
|
|
362
363
|
{!isEditableActive && onClose && closeButton}
|
|
@@ -2,6 +2,7 @@ import React from 'react';
|
|
|
2
2
|
|
|
3
3
|
import { render, screen } from '@testing-library/react';
|
|
4
4
|
import userEvent from '@testing-library/user-event';
|
|
5
|
+
import '@testing-library/jest-dom';
|
|
5
6
|
|
|
6
7
|
import { Label } from '../Label';
|
|
7
8
|
|
|
@@ -110,6 +111,12 @@ describe('Label', () => {
|
|
|
110
111
|
expect(asFragment()).toMatchSnapshot();
|
|
111
112
|
});
|
|
112
113
|
|
|
114
|
+
test('renders with variant overflow and type is set to button ', () => {
|
|
115
|
+
const { asFragment } = render(<Label variant="overflow">Something</Label>);
|
|
116
|
+
expect(screen.getByRole('button')).toHaveAttribute('type', 'button');
|
|
117
|
+
expect(asFragment()).toMatchSnapshot();
|
|
118
|
+
});
|
|
119
|
+
|
|
113
120
|
test('a button is not rendered when onClick is not passed', () => {
|
|
114
121
|
render(<Label>Click me</Label>);
|
|
115
122
|
|
|
@@ -599,3 +599,22 @@ exports[`Label renders with outline variant 1`] = `
|
|
|
599
599
|
</span>
|
|
600
600
|
</DocumentFragment>
|
|
601
601
|
`;
|
|
602
|
+
|
|
603
|
+
exports[`Label renders with variant overflow and type is set to button 1`] = `
|
|
604
|
+
<DocumentFragment>
|
|
605
|
+
<button
|
|
606
|
+
class="pf-v6-c-label pf-m-overflow"
|
|
607
|
+
type="button"
|
|
608
|
+
>
|
|
609
|
+
<span
|
|
610
|
+
class="pf-v6-c-label__content"
|
|
611
|
+
>
|
|
612
|
+
<span
|
|
613
|
+
class="pf-v6-c-label__text"
|
|
614
|
+
>
|
|
615
|
+
Something
|
|
616
|
+
</span>
|
|
617
|
+
</span>
|
|
618
|
+
</button>
|
|
619
|
+
</DocumentFragment>
|
|
620
|
+
`;
|
|
@@ -2,34 +2,20 @@ import * as React from 'react';
|
|
|
2
2
|
import styles from '@patternfly/react-styles/css/components/Masthead/masthead';
|
|
3
3
|
import { css } from '@patternfly/react-styles';
|
|
4
4
|
|
|
5
|
-
export interface MastheadBrandProps
|
|
6
|
-
extends React.DetailedHTMLProps<React.HTMLProps<HTMLAnchorElement>, HTMLAnchorElement> {
|
|
5
|
+
export interface MastheadBrandProps extends React.DetailedHTMLProps<React.HTMLProps<HTMLDivElement>, HTMLDivElement> {
|
|
7
6
|
/** Content rendered inside of the masthead brand. */
|
|
8
7
|
children?: React.ReactNode;
|
|
9
8
|
/** Additional classes added to the masthead brand. */
|
|
10
9
|
className?: string;
|
|
11
|
-
/** Component type of the masthead brand. */
|
|
12
|
-
component?: React.ElementType<any> | React.ComponentType<any>;
|
|
13
10
|
}
|
|
14
11
|
|
|
15
12
|
export const MastheadBrand: React.FunctionComponent<MastheadBrandProps> = ({
|
|
16
13
|
children,
|
|
17
14
|
className,
|
|
18
|
-
component,
|
|
19
15
|
...props
|
|
20
|
-
}: MastheadBrandProps) =>
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
} else {
|
|
26
|
-
Component = 'span';
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
return (
|
|
30
|
-
<Component className={css(styles.mastheadBrand, className)} {...(Component === 'a' && { tabIndex: 0 })} {...props}>
|
|
31
|
-
{children}
|
|
32
|
-
</Component>
|
|
33
|
-
);
|
|
34
|
-
};
|
|
16
|
+
}: MastheadBrandProps) => (
|
|
17
|
+
<div className={css(styles.mastheadBrand, className)} {...props}>
|
|
18
|
+
{children}
|
|
19
|
+
</div>
|
|
20
|
+
);
|
|
35
21
|
MastheadBrand.displayName = 'MastheadBrand';
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import styles from '@patternfly/react-styles/css/components/Masthead/masthead';
|
|
3
|
+
import { css } from '@patternfly/react-styles';
|
|
4
|
+
|
|
5
|
+
export interface MastheadLogoProps
|
|
6
|
+
extends React.DetailedHTMLProps<React.HTMLProps<HTMLAnchorElement>, HTMLAnchorElement> {
|
|
7
|
+
/** Content rendered inside of the masthead logo. */
|
|
8
|
+
children?: React.ReactNode;
|
|
9
|
+
/** Additional classes added to the masthead logo. */
|
|
10
|
+
className?: string;
|
|
11
|
+
/** Component type of the masthead logo. */
|
|
12
|
+
component?: React.ElementType<any> | React.ComponentType<any>;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export const MastheadLogo: React.FunctionComponent<MastheadLogoProps> = ({
|
|
16
|
+
children,
|
|
17
|
+
className,
|
|
18
|
+
component,
|
|
19
|
+
...props
|
|
20
|
+
}: MastheadLogoProps) => {
|
|
21
|
+
let Component = component as any;
|
|
22
|
+
if (!component) {
|
|
23
|
+
if (props?.href !== undefined) {
|
|
24
|
+
Component = 'a';
|
|
25
|
+
} else {
|
|
26
|
+
Component = 'span';
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
return (
|
|
30
|
+
<Component className={css(styles.mastheadLogo, className)} {...(Component === 'a' && { tabIndex: 0 })} {...props}>
|
|
31
|
+
{children}
|
|
32
|
+
</Component>
|
|
33
|
+
);
|
|
34
|
+
};
|
|
35
|
+
MastheadLogo.displayName = 'MastheadLogo';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { render } from '@testing-library/react';
|
|
3
|
-
import { Masthead,
|
|
3
|
+
import { Masthead, MastheadMain, MastheadLogo, MastheadContent, MastheadBrand, MastheadToggle } from '../index';
|
|
4
4
|
|
|
5
5
|
describe('Masthead', () => {
|
|
6
6
|
test('verify basic', () => {
|
|
@@ -12,9 +12,11 @@ describe('Masthead', () => {
|
|
|
12
12
|
test('verify full structure', () => {
|
|
13
13
|
const { asFragment } = render(
|
|
14
14
|
<Masthead>
|
|
15
|
-
<MastheadToggle>Toggle</MastheadToggle>
|
|
16
15
|
<MastheadMain>
|
|
17
|
-
<
|
|
16
|
+
<MastheadToggle>Toggle</MastheadToggle>
|
|
17
|
+
<MastheadBrand>
|
|
18
|
+
<MastheadLogo>Logo</MastheadLogo>
|
|
19
|
+
</MastheadBrand>
|
|
18
20
|
</MastheadMain>
|
|
19
21
|
<MastheadContent>
|
|
20
22
|
<span>Content</span>
|
|
@@ -72,33 +74,33 @@ describe('Masthead', () => {
|
|
|
72
74
|
});
|
|
73
75
|
});
|
|
74
76
|
|
|
75
|
-
describe('
|
|
77
|
+
describe('MastheadLogo', () => {
|
|
76
78
|
test('verify basic', () => {
|
|
77
|
-
const { asFragment } = render(<
|
|
79
|
+
const { asFragment } = render(<MastheadLogo>test</MastheadLogo>);
|
|
78
80
|
|
|
79
81
|
expect(asFragment()).toMatchSnapshot();
|
|
80
82
|
});
|
|
81
83
|
|
|
82
84
|
test('verify custom class', () => {
|
|
83
|
-
const { asFragment } = render(<
|
|
85
|
+
const { asFragment } = render(<MastheadLogo className="custom-css">test</MastheadLogo>);
|
|
84
86
|
|
|
85
87
|
expect(asFragment()).toMatchSnapshot();
|
|
86
88
|
});
|
|
87
89
|
|
|
88
90
|
test('verify default component', () => {
|
|
89
|
-
const { asFragment } = render(<
|
|
91
|
+
const { asFragment } = render(<MastheadLogo>test</MastheadLogo>);
|
|
90
92
|
|
|
91
93
|
expect(asFragment()).toMatchSnapshot();
|
|
92
94
|
});
|
|
93
95
|
|
|
94
96
|
test('verify custom component', () => {
|
|
95
|
-
const { asFragment } = render(<
|
|
97
|
+
const { asFragment } = render(<MastheadLogo component="div">test</MastheadLogo>);
|
|
96
98
|
|
|
97
99
|
expect(asFragment()).toMatchSnapshot();
|
|
98
100
|
});
|
|
99
101
|
|
|
100
102
|
test('verify anchor component with href', () => {
|
|
101
|
-
const { asFragment } = render(<
|
|
103
|
+
const { asFragment } = render(<MastheadLogo href="#">test</MastheadLogo>);
|
|
102
104
|
|
|
103
105
|
expect(asFragment()).toMatchSnapshot();
|
|
104
106
|
});
|
|
@@ -118,15 +120,15 @@ describe('MastheadContent', () => {
|
|
|
118
120
|
});
|
|
119
121
|
});
|
|
120
122
|
|
|
121
|
-
describe('
|
|
123
|
+
describe('MastheadBrand', () => {
|
|
122
124
|
test('verify basic', () => {
|
|
123
|
-
const { asFragment } = render(<
|
|
125
|
+
const { asFragment } = render(<MastheadBrand>test</MastheadBrand>);
|
|
124
126
|
|
|
125
127
|
expect(asFragment()).toMatchSnapshot();
|
|
126
128
|
});
|
|
127
129
|
|
|
128
130
|
test('verify custom class', () => {
|
|
129
|
-
const { asFragment } = render(<
|
|
131
|
+
const { asFragment } = render(<MastheadBrand className="custom-css">test</MastheadBrand>);
|
|
130
132
|
|
|
131
133
|
expect(asFragment()).toMatchSnapshot();
|
|
132
134
|
});
|
|
@@ -25,19 +25,23 @@ exports[`Masthead verify full structure 1`] = `
|
|
|
25
25
|
<header
|
|
26
26
|
class="pf-v6-c-masthead pf-m-display-inline-on-md"
|
|
27
27
|
>
|
|
28
|
-
<span
|
|
29
|
-
class="pf-v6-c-masthead__toggle"
|
|
30
|
-
>
|
|
31
|
-
Toggle
|
|
32
|
-
</span>
|
|
33
28
|
<div
|
|
34
29
|
class="pf-v6-c-masthead__main"
|
|
35
30
|
>
|
|
36
31
|
<span
|
|
37
|
-
class="pf-v6-c-
|
|
32
|
+
class="pf-v6-c-masthead__toggle"
|
|
38
33
|
>
|
|
39
|
-
|
|
34
|
+
Toggle
|
|
40
35
|
</span>
|
|
36
|
+
<div
|
|
37
|
+
class="pf-v6-c-masthead__brand"
|
|
38
|
+
>
|
|
39
|
+
<span
|
|
40
|
+
class="pf-v6-c-masthead__logo"
|
|
41
|
+
>
|
|
42
|
+
Logo
|
|
43
|
+
</span>
|
|
44
|
+
</div>
|
|
41
45
|
</div>
|
|
42
46
|
<div
|
|
43
47
|
class="pf-v6-c-masthead__content"
|
|
@@ -150,95 +154,95 @@ exports[`Masthead verify stack display breakpoints 1`] = `
|
|
|
150
154
|
</DocumentFragment>
|
|
151
155
|
`;
|
|
152
156
|
|
|
153
|
-
exports[`MastheadBrand verify
|
|
157
|
+
exports[`MastheadBrand verify basic 1`] = `
|
|
154
158
|
<DocumentFragment>
|
|
155
|
-
<
|
|
159
|
+
<div
|
|
156
160
|
class="pf-v6-c-masthead__brand"
|
|
157
|
-
href="#"
|
|
158
|
-
tabindex="0"
|
|
159
161
|
>
|
|
160
162
|
test
|
|
161
|
-
</
|
|
163
|
+
</div>
|
|
162
164
|
</DocumentFragment>
|
|
163
165
|
`;
|
|
164
166
|
|
|
165
|
-
exports[`MastheadBrand verify
|
|
167
|
+
exports[`MastheadBrand verify custom class 1`] = `
|
|
166
168
|
<DocumentFragment>
|
|
167
|
-
<
|
|
168
|
-
class="pf-v6-c-masthead__brand"
|
|
169
|
+
<div
|
|
170
|
+
class="pf-v6-c-masthead__brand custom-css"
|
|
169
171
|
>
|
|
170
172
|
test
|
|
171
|
-
</
|
|
173
|
+
</div>
|
|
172
174
|
</DocumentFragment>
|
|
173
175
|
`;
|
|
174
176
|
|
|
175
|
-
exports[`
|
|
177
|
+
exports[`MastheadContent verify basic 1`] = `
|
|
176
178
|
<DocumentFragment>
|
|
177
|
-
<
|
|
178
|
-
class="pf-v6-c-
|
|
179
|
+
<div
|
|
180
|
+
class="pf-v6-c-masthead__content"
|
|
179
181
|
>
|
|
180
182
|
test
|
|
181
|
-
</
|
|
183
|
+
</div>
|
|
182
184
|
</DocumentFragment>
|
|
183
185
|
`;
|
|
184
186
|
|
|
185
|
-
exports[`
|
|
187
|
+
exports[`MastheadContent verify custom class 1`] = `
|
|
186
188
|
<DocumentFragment>
|
|
187
189
|
<div
|
|
188
|
-
class="pf-v6-c-
|
|
190
|
+
class="pf-v6-c-masthead__content custom-css"
|
|
189
191
|
>
|
|
190
192
|
test
|
|
191
193
|
</div>
|
|
192
194
|
</DocumentFragment>
|
|
193
195
|
`;
|
|
194
196
|
|
|
195
|
-
exports[`
|
|
197
|
+
exports[`MastheadLogo verify anchor component with href 1`] = `
|
|
196
198
|
<DocumentFragment>
|
|
197
|
-
<
|
|
198
|
-
class="pf-v6-c-
|
|
199
|
+
<a
|
|
200
|
+
class="pf-v6-c-masthead__logo"
|
|
201
|
+
href="#"
|
|
202
|
+
tabindex="0"
|
|
199
203
|
>
|
|
200
204
|
test
|
|
201
|
-
</
|
|
205
|
+
</a>
|
|
202
206
|
</DocumentFragment>
|
|
203
207
|
`;
|
|
204
208
|
|
|
205
|
-
exports[`
|
|
209
|
+
exports[`MastheadLogo verify basic 1`] = `
|
|
206
210
|
<DocumentFragment>
|
|
207
|
-
<
|
|
208
|
-
class="pf-v6-c-
|
|
211
|
+
<span
|
|
212
|
+
class="pf-v6-c-masthead__logo"
|
|
209
213
|
>
|
|
210
214
|
test
|
|
211
|
-
</
|
|
215
|
+
</span>
|
|
212
216
|
</DocumentFragment>
|
|
213
217
|
`;
|
|
214
218
|
|
|
215
|
-
exports[`
|
|
219
|
+
exports[`MastheadLogo verify custom class 1`] = `
|
|
216
220
|
<DocumentFragment>
|
|
217
|
-
<
|
|
218
|
-
class="pf-v6-c-
|
|
221
|
+
<span
|
|
222
|
+
class="pf-v6-c-masthead__logo custom-css"
|
|
219
223
|
>
|
|
220
224
|
test
|
|
221
|
-
</
|
|
225
|
+
</span>
|
|
222
226
|
</DocumentFragment>
|
|
223
227
|
`;
|
|
224
228
|
|
|
225
|
-
exports[`
|
|
229
|
+
exports[`MastheadLogo verify custom component 1`] = `
|
|
226
230
|
<DocumentFragment>
|
|
227
231
|
<div
|
|
228
|
-
class="pf-v6-c-
|
|
232
|
+
class="pf-v6-c-masthead__logo"
|
|
229
233
|
>
|
|
230
234
|
test
|
|
231
235
|
</div>
|
|
232
236
|
</DocumentFragment>
|
|
233
237
|
`;
|
|
234
238
|
|
|
235
|
-
exports[`
|
|
239
|
+
exports[`MastheadLogo verify default component 1`] = `
|
|
236
240
|
<DocumentFragment>
|
|
237
|
-
<
|
|
238
|
-
class="pf-v6-c-
|
|
241
|
+
<span
|
|
242
|
+
class="pf-v6-c-masthead__logo"
|
|
239
243
|
>
|
|
240
244
|
test
|
|
241
|
-
</
|
|
245
|
+
</span>
|
|
242
246
|
</DocumentFragment>
|
|
243
247
|
`;
|
|
244
248
|
|
|
@@ -2,16 +2,16 @@
|
|
|
2
2
|
id: Masthead
|
|
3
3
|
section: components
|
|
4
4
|
cssPrefix: pf-v5-c-masthead
|
|
5
|
-
propComponents: ['Masthead', 'MastheadToggle', 'MastheadMain', 'MastheadBrand', 'MastheadContent']
|
|
5
|
+
propComponents: ['Masthead', 'MastheadToggle', 'MastheadMain', 'MastheadBrand', MastheadLogo, 'MastheadContent']
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
import BarsIcon from '@patternfly/react-icons/dist/js/icons/bars-icon';
|
|
9
9
|
import { Link } from '@reach/router';
|
|
10
10
|
import pfIcon from '../../assets/PF-HorizontalLogo-Color.svg';
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
To maintain proper layout and formatting, a `<Masthead>` should contain both a `<MastheadMain>` and `<MastheadContent>` component.
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
Mastheads contain the `<MastheadMain>` that wraps a `<PageToggleButton>` and `<MastheadBrand>`. The `<MastheadBrand>` wraps `<MastheadLogo>`. The masthead also contains the page's header toolbar within `<MastheadContent>`.
|
|
15
15
|
|
|
16
16
|
## Examples
|
|
17
17
|
|
|
@@ -1,14 +1,24 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
Masthead,
|
|
4
|
+
MastheadMain,
|
|
5
|
+
MastheadToggle,
|
|
6
|
+
MastheadBrand,
|
|
7
|
+
MastheadLogo,
|
|
8
|
+
MastheadContent,
|
|
9
|
+
Button
|
|
10
|
+
} from '@patternfly/react-core';
|
|
3
11
|
import BarsIcon from '@patternfly/react-icons/dist/js/icons/bars-icon';
|
|
4
12
|
|
|
5
13
|
export const MastheadBasic: React.FunctionComponent = () => (
|
|
6
14
|
<Masthead id="basic-example">
|
|
7
|
-
<MastheadToggle>
|
|
8
|
-
<Button variant="plain" onClick={() => {}} aria-label="Global navigation" icon={<BarsIcon />} />
|
|
9
|
-
</MastheadToggle>
|
|
10
15
|
<MastheadMain>
|
|
11
|
-
<
|
|
16
|
+
<MastheadToggle>
|
|
17
|
+
<Button variant="plain" onClick={() => {}} aria-label="Global navigation" icon={<BarsIcon />} />
|
|
18
|
+
</MastheadToggle>
|
|
19
|
+
<MastheadBrand>
|
|
20
|
+
<MastheadLogo component="a">Logo</MastheadLogo>
|
|
21
|
+
</MastheadBrand>
|
|
12
22
|
</MastheadMain>
|
|
13
23
|
<MastheadContent>
|
|
14
24
|
<span>Content</span>
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import {
|
|
3
3
|
Masthead,
|
|
4
|
-
MastheadToggle,
|
|
5
4
|
MastheadMain,
|
|
5
|
+
MastheadToggle,
|
|
6
6
|
MastheadBrand,
|
|
7
|
+
MastheadLogo,
|
|
7
8
|
MastheadContent,
|
|
8
9
|
Button,
|
|
9
10
|
Flex,
|
|
@@ -13,11 +14,13 @@ import BarsIcon from '@patternfly/react-icons/dist/js/icons/bars-icon';
|
|
|
13
14
|
|
|
14
15
|
export const MastheadBasicMixedContent: React.FunctionComponent = () => (
|
|
15
16
|
<Masthead id="basic-mixed">
|
|
16
|
-
<MastheadToggle>
|
|
17
|
-
<Button variant="plain" onClick={() => {}} aria-label="Global navigation" icon={<BarsIcon />} />
|
|
18
|
-
</MastheadToggle>
|
|
19
17
|
<MastheadMain>
|
|
20
|
-
<
|
|
18
|
+
<MastheadToggle>
|
|
19
|
+
<Button variant="plain" onClick={() => {}} aria-label="Global navigation" icon={<BarsIcon />} />
|
|
20
|
+
</MastheadToggle>
|
|
21
|
+
<MastheadBrand>
|
|
22
|
+
<MastheadLogo component="a">Logo</MastheadLogo>
|
|
23
|
+
</MastheadBrand>
|
|
21
24
|
</MastheadMain>
|
|
22
25
|
<MastheadContent>
|
|
23
26
|
<Flex>
|
|
@@ -1,14 +1,24 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
Masthead,
|
|
4
|
+
MastheadMain,
|
|
5
|
+
MastheadToggle,
|
|
6
|
+
MastheadBrand,
|
|
7
|
+
MastheadLogo,
|
|
8
|
+
MastheadContent,
|
|
9
|
+
Button
|
|
10
|
+
} from '@patternfly/react-core';
|
|
3
11
|
import BarsIcon from '@patternfly/react-icons/dist/js/icons/bars-icon';
|
|
4
12
|
|
|
5
13
|
export const MastheadDisplayInline: React.FunctionComponent = () => (
|
|
6
14
|
<Masthead id="inline-masthead" display={{ default: 'inline' }}>
|
|
7
|
-
<MastheadToggle>
|
|
8
|
-
<Button variant="plain" onClick={() => {}} aria-label="Global navigation" icon={<BarsIcon />} />
|
|
9
|
-
</MastheadToggle>
|
|
10
15
|
<MastheadMain>
|
|
11
|
-
<
|
|
16
|
+
<MastheadToggle>
|
|
17
|
+
<Button variant="plain" onClick={() => {}} aria-label="Global navigation" icon={<BarsIcon />} />
|
|
18
|
+
</MastheadToggle>
|
|
19
|
+
<MastheadBrand>
|
|
20
|
+
<MastheadLogo component="a">Logo</MastheadLogo>
|
|
21
|
+
</MastheadBrand>
|
|
12
22
|
</MastheadMain>
|
|
13
23
|
<MastheadContent>
|
|
14
24
|
<span>Content</span>
|
|
@@ -1,14 +1,24 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
Masthead,
|
|
4
|
+
MastheadMain,
|
|
5
|
+
MastheadToggle,
|
|
6
|
+
MastheadBrand,
|
|
7
|
+
MastheadLogo,
|
|
8
|
+
MastheadContent,
|
|
9
|
+
Button
|
|
10
|
+
} from '@patternfly/react-core';
|
|
3
11
|
import BarsIcon from '@patternfly/react-icons/dist/js/icons/bars-icon';
|
|
4
12
|
|
|
5
13
|
export const MastheadDisplayStack: React.FunctionComponent = () => (
|
|
6
14
|
<Masthead id="stack-masthead" display={{ default: 'stack' }}>
|
|
7
|
-
<MastheadToggle>
|
|
8
|
-
<Button variant="plain" onClick={() => {}} aria-label="Global navigation" icon={<BarsIcon />} />
|
|
9
|
-
</MastheadToggle>
|
|
10
15
|
<MastheadMain>
|
|
11
|
-
<
|
|
16
|
+
<MastheadToggle>
|
|
17
|
+
<Button variant="plain" onClick={() => {}} aria-label="Global navigation" icon={<BarsIcon />} />
|
|
18
|
+
</MastheadToggle>
|
|
19
|
+
<MastheadBrand>
|
|
20
|
+
<MastheadLogo component="a">Logo</MastheadLogo>
|
|
21
|
+
</MastheadBrand>
|
|
12
22
|
</MastheadMain>
|
|
13
23
|
<MastheadContent>
|
|
14
24
|
<span>Content</span>
|
|
@@ -1,14 +1,24 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
Masthead,
|
|
4
|
+
MastheadMain,
|
|
5
|
+
MastheadToggle,
|
|
6
|
+
MastheadBrand,
|
|
7
|
+
MastheadLogo,
|
|
8
|
+
MastheadContent,
|
|
9
|
+
Button
|
|
10
|
+
} from '@patternfly/react-core';
|
|
3
11
|
import BarsIcon from '@patternfly/react-icons/dist/js/icons/bars-icon';
|
|
4
12
|
|
|
5
13
|
export const MastheadDisplayStackInlineResponsive: React.FunctionComponent = () => (
|
|
6
14
|
<Masthead id="stack-inline-masthead" display={{ default: 'inline', lg: 'stack', '2xl': 'inline' }}>
|
|
7
|
-
<MastheadToggle>
|
|
8
|
-
<Button variant="plain" onClick={() => {}} aria-label="Global navigation" icon={<BarsIcon />} />
|
|
9
|
-
</MastheadToggle>
|
|
10
15
|
<MastheadMain>
|
|
11
|
-
<
|
|
16
|
+
<MastheadToggle>
|
|
17
|
+
<Button variant="plain" onClick={() => {}} aria-label="Global navigation" icon={<BarsIcon />} />
|
|
18
|
+
</MastheadToggle>
|
|
19
|
+
<MastheadBrand>
|
|
20
|
+
<MastheadLogo component="a">Logo</MastheadLogo>
|
|
21
|
+
</MastheadBrand>
|
|
12
22
|
</MastheadMain>
|
|
13
23
|
<MastheadContent>
|
|
14
24
|
<span>Content</span>
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import {
|
|
3
3
|
Masthead,
|
|
4
|
-
MastheadToggle,
|
|
5
4
|
MastheadMain,
|
|
5
|
+
MastheadToggle,
|
|
6
6
|
MastheadBrand,
|
|
7
|
+
MastheadLogo,
|
|
7
8
|
MastheadContent,
|
|
8
9
|
Button,
|
|
9
10
|
Brand
|
|
@@ -14,12 +15,14 @@ import pfIcon from '../../assets/PF-HorizontalLogo-Color.svg';
|
|
|
14
15
|
|
|
15
16
|
export const MastheadIconRouterLink: React.FunctionComponent = () => (
|
|
16
17
|
<Masthead id="icon-router-link">
|
|
17
|
-
<MastheadToggle>
|
|
18
|
-
<Button variant="plain" onClick={() => {}} aria-label="Global navigation" icon={<BarsIcon />} />
|
|
19
|
-
</MastheadToggle>
|
|
20
18
|
<MastheadMain>
|
|
21
|
-
<
|
|
22
|
-
<
|
|
19
|
+
<MastheadToggle>
|
|
20
|
+
<Button variant="plain" onClick={() => {}} aria-label="Global navigation" icon={<BarsIcon />} />
|
|
21
|
+
</MastheadToggle>
|
|
22
|
+
<MastheadBrand>
|
|
23
|
+
<MastheadLogo component={(props) => <Link {...props} to="#" />}>
|
|
24
|
+
<Brand src={pfIcon} alt="PatternFly" heights={{ default: '36px' }} />
|
|
25
|
+
</MastheadLogo>
|
|
23
26
|
</MastheadBrand>
|
|
24
27
|
</MastheadMain>
|
|
25
28
|
<MastheadContent>
|