@patternfly/react-core 6.5.0-prerelease.10 → 6.5.0-prerelease.12
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 +12 -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 -0
- 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/dynamic-modules.json +8 -0
- package/dist/esm/components/Compass/CompassContent.d.ts +1 -2
- package/dist/esm/components/Compass/CompassContent.d.ts.map +1 -1
- package/dist/esm/components/Compass/CompassHeader.d.ts +1 -2
- package/dist/esm/components/Compass/CompassHeader.d.ts.map +1 -1
- package/dist/esm/components/Compass/CompassHero.d.ts +2 -18
- package/dist/esm/components/Compass/CompassHero.d.ts.map +1 -1
- package/dist/esm/components/Compass/CompassHero.js +2 -39
- package/dist/esm/components/Compass/CompassHero.js.map +1 -1
- package/dist/esm/components/Compass/CompassMainHeader.d.ts +1 -2
- package/dist/esm/components/Compass/CompassMainHeader.d.ts.map +1 -1
- package/dist/esm/components/Compass/CompassMessageBar.d.ts +1 -2
- package/dist/esm/components/Compass/CompassMessageBar.d.ts.map +1 -1
- package/dist/esm/components/Compass/CompassPanel.d.ts +1 -2
- package/dist/esm/components/Compass/CompassPanel.d.ts.map +1 -1
- package/dist/esm/components/Hero/Hero.d.ts +32 -0
- package/dist/esm/components/Hero/Hero.d.ts.map +1 -0
- package/dist/esm/components/Hero/Hero.js +51 -0
- package/dist/esm/components/Hero/Hero.js.map +1 -0
- package/dist/esm/components/Hero/index.d.ts +2 -0
- package/dist/esm/components/Hero/index.d.ts.map +1 -0
- package/dist/esm/components/Hero/index.js +2 -0
- package/dist/esm/components/Hero/index.js.map +1 -0
- package/dist/esm/components/index.d.ts +1 -0
- package/dist/esm/components/index.d.ts.map +1 -1
- package/dist/esm/components/index.js +1 -0
- package/dist/esm/components/index.js.map +1 -1
- package/dist/js/components/Compass/CompassContent.d.ts +1 -2
- package/dist/js/components/Compass/CompassContent.d.ts.map +1 -1
- package/dist/js/components/Compass/CompassHeader.d.ts +1 -2
- package/dist/js/components/Compass/CompassHeader.d.ts.map +1 -1
- package/dist/js/components/Compass/CompassHero.d.ts +2 -18
- package/dist/js/components/Compass/CompassHero.d.ts.map +1 -1
- package/dist/js/components/Compass/CompassHero.js +2 -39
- package/dist/js/components/Compass/CompassHero.js.map +1 -1
- package/dist/js/components/Compass/CompassMainHeader.d.ts +1 -2
- package/dist/js/components/Compass/CompassMainHeader.d.ts.map +1 -1
- package/dist/js/components/Compass/CompassMessageBar.d.ts +1 -2
- package/dist/js/components/Compass/CompassMessageBar.d.ts.map +1 -1
- package/dist/js/components/Compass/CompassPanel.d.ts +1 -2
- package/dist/js/components/Compass/CompassPanel.d.ts.map +1 -1
- package/dist/js/components/Hero/Hero.d.ts +32 -0
- package/dist/js/components/Hero/Hero.d.ts.map +1 -0
- package/dist/js/components/Hero/Hero.js +55 -0
- package/dist/js/components/Hero/Hero.js.map +1 -0
- package/dist/js/components/Hero/index.d.ts +2 -0
- package/dist/js/components/Hero/index.d.ts.map +1 -0
- package/dist/js/components/Hero/index.js +5 -0
- package/dist/js/components/Hero/index.js.map +1 -0
- package/dist/js/components/index.d.ts +1 -0
- package/dist/js/components/index.d.ts.map +1 -1
- package/dist/js/components/index.js +1 -0
- package/dist/js/components/index.js.map +1 -1
- package/dist/umd/assets/{output-4DDCBaXc.css → output-I61K8nI9.css} +13047 -13005
- 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/CompassContent.tsx +1 -1
- package/src/components/Compass/CompassHeader.tsx +1 -1
- package/src/components/Compass/CompassHero.tsx +7 -76
- package/src/components/Compass/CompassMainHeader.tsx +1 -1
- package/src/components/Compass/CompassMessageBar.tsx +1 -1
- package/src/components/Compass/CompassPanel.tsx +1 -1
- package/src/components/Compass/__tests__/CompassHero.test.tsx +7 -119
- package/src/components/Compass/__tests__/__snapshots__/CompassHero.test.tsx.snap +2 -9
- package/src/components/Compass/examples/Compass.md +2 -1
- package/src/components/Compass/examples/CompassDemo.tsx +3 -2
- package/src/components/Hero/Hero.tsx +102 -0
- package/src/components/Hero/__tests__/Hero.test.tsx +175 -0
- package/src/components/Hero/__tests__/__snapshots__/Hero.test.tsx.snap +30 -0
- package/src/components/Hero/examples/Hero.md +19 -0
- package/src/components/Hero/examples/HeroBasic.tsx +3 -0
- package/src/components/Hero/index.ts +1 -0
- package/src/components/index.ts +1 -0
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.11","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.11","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.11","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.12",
|
|
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.5",
|
|
50
|
+
"@patternfly/react-styles": "^6.5.0-prerelease.5",
|
|
51
|
+
"@patternfly/react-tokens": "^6.5.0-prerelease.5",
|
|
52
52
|
"focus-trap": "7.6.4",
|
|
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.21",
|
|
58
58
|
"case-anything": "^3.1.2",
|
|
59
59
|
"css": "^3.0.0",
|
|
60
60
|
"fs-extra": "^11.3.0"
|
|
@@ -63,5 +63,5 @@
|
|
|
63
63
|
"react": "^17 || ^18 || ^19",
|
|
64
64
|
"react-dom": "^17 || ^18 || ^19"
|
|
65
65
|
},
|
|
66
|
-
"gitHead": "
|
|
66
|
+
"gitHead": "b1ae7eb5e94f906f4373f38e14d9125e5cccd1c5"
|
|
67
67
|
}
|
|
@@ -2,7 +2,7 @@ import { Drawer, DrawerContent, DrawerProps } from '../Drawer';
|
|
|
2
2
|
import styles from '@patternfly/react-styles/css/components/Compass/compass';
|
|
3
3
|
import { css } from '@patternfly/react-styles';
|
|
4
4
|
|
|
5
|
-
interface CompassContentProps extends React.HTMLProps<HTMLDivElement> {
|
|
5
|
+
export interface CompassContentProps extends React.HTMLProps<HTMLDivElement> {
|
|
6
6
|
/** Content of the main compass area. Typically one or more CompassPanel components. */
|
|
7
7
|
children: React.ReactNode;
|
|
8
8
|
/** Additional classes added to the CompassContent */
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import styles from '@patternfly/react-styles/css/components/Compass/compass';
|
|
2
2
|
import { css } from '@patternfly/react-styles';
|
|
3
3
|
|
|
4
|
-
interface CompassHeaderProps {
|
|
4
|
+
export interface CompassHeaderProps {
|
|
5
5
|
/** Content of the logo area */
|
|
6
6
|
logo?: React.ReactNode;
|
|
7
7
|
/** Content of the navigation area */
|
|
@@ -1,87 +1,18 @@
|
|
|
1
1
|
import styles from '@patternfly/react-styles/css/components/Compass/compass';
|
|
2
2
|
import { css } from '@patternfly/react-styles';
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
import compassHeroGradientStop1Light from '@patternfly/react-tokens/dist/esm/c_compass__hero_gradient_stop_1_light';
|
|
7
|
-
import compassHeroGradientStop2Light from '@patternfly/react-tokens/dist/esm/c_compass__hero_gradient_stop_2_light';
|
|
8
|
-
import compassHeroGradientStop3Light from '@patternfly/react-tokens/dist/esm/c_compass__hero_gradient_stop_3_light';
|
|
9
|
-
import compassHeroGradientStop1Dark from '@patternfly/react-tokens/dist/esm/c_compass__hero_gradient_stop_1_dark';
|
|
10
|
-
import compassHeroGradientStop2Dark from '@patternfly/react-tokens/dist/esm/c_compass__hero_gradient_stop_2_dark';
|
|
11
|
-
import compassHeroGradientStop3Dark from '@patternfly/react-tokens/dist/esm/c_compass__hero_gradient_stop_3_dark';
|
|
12
|
-
|
|
13
|
-
interface CompassHeroProps extends Omit<React.HTMLProps<HTMLDivElement>, 'content'> {
|
|
4
|
+
/** A wrapper component to pass a PatternFly Hero component into. */
|
|
5
|
+
export interface CompassHeroProps extends Omit<React.HTMLProps<HTMLDivElement>, 'content'> {
|
|
14
6
|
/** Content of the hero */
|
|
15
7
|
children?: React.ReactNode;
|
|
16
8
|
/** Additional classes added to the hero */
|
|
17
9
|
className?: string;
|
|
18
|
-
/** Light theme background image path of the hero */
|
|
19
|
-
backgroundSrcLight?: string;
|
|
20
|
-
/** Dark theme background image path of the hero */
|
|
21
|
-
backgroundSrcDark?: string;
|
|
22
|
-
/** Light theme gradient of the hero */
|
|
23
|
-
gradientLight?: {
|
|
24
|
-
stop1?: string;
|
|
25
|
-
stop2?: string;
|
|
26
|
-
stop3?: string;
|
|
27
|
-
};
|
|
28
|
-
/** Dark theme gradient of the hero */
|
|
29
|
-
gradientDark?: {
|
|
30
|
-
stop1?: string;
|
|
31
|
-
stop2?: string;
|
|
32
|
-
stop3?: string;
|
|
33
|
-
};
|
|
34
10
|
}
|
|
35
11
|
|
|
36
|
-
export const CompassHero: React.FunctionComponent<CompassHeroProps> = ({
|
|
37
|
-
className
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
gradientLight,
|
|
42
|
-
gradientDark,
|
|
43
|
-
...props
|
|
44
|
-
}) => {
|
|
45
|
-
const backgroundImageStyles: { [key: string]: string } = {};
|
|
46
|
-
if (backgroundSrcLight) {
|
|
47
|
-
backgroundImageStyles[compassHeroBackgroundImageLight.name] = `url(${backgroundSrcLight})`;
|
|
48
|
-
}
|
|
49
|
-
if (backgroundSrcDark) {
|
|
50
|
-
backgroundImageStyles[compassHeroBackgroundImageDark.name] = `url(${backgroundSrcDark})`;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
if (gradientLight) {
|
|
54
|
-
if (gradientLight.stop1) {
|
|
55
|
-
backgroundImageStyles[compassHeroGradientStop1Light.name] = gradientLight.stop1;
|
|
56
|
-
}
|
|
57
|
-
if (gradientLight.stop2) {
|
|
58
|
-
backgroundImageStyles[compassHeroGradientStop2Light.name] = gradientLight.stop2;
|
|
59
|
-
}
|
|
60
|
-
if (gradientLight.stop3) {
|
|
61
|
-
backgroundImageStyles[compassHeroGradientStop3Light.name] = gradientLight.stop3;
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
if (gradientDark) {
|
|
65
|
-
if (gradientDark.stop1) {
|
|
66
|
-
backgroundImageStyles[compassHeroGradientStop1Dark.name] = gradientDark.stop1;
|
|
67
|
-
}
|
|
68
|
-
if (gradientDark.stop2) {
|
|
69
|
-
backgroundImageStyles[compassHeroGradientStop2Dark.name] = gradientDark.stop2;
|
|
70
|
-
}
|
|
71
|
-
if (gradientDark.stop3) {
|
|
72
|
-
backgroundImageStyles[compassHeroGradientStop3Dark.name] = gradientDark.stop3;
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
return (
|
|
77
|
-
<div
|
|
78
|
-
className={css(styles.compassPanel, styles.compassHero, className)}
|
|
79
|
-
style={{ ...props.style, ...backgroundImageStyles }}
|
|
80
|
-
{...props}
|
|
81
|
-
>
|
|
82
|
-
<div className={css(styles.compassHeroBody)}>{children}</div>
|
|
83
|
-
</div>
|
|
84
|
-
);
|
|
85
|
-
};
|
|
12
|
+
export const CompassHero: React.FunctionComponent<CompassHeroProps> = ({ className, children, ...props }) => (
|
|
13
|
+
<div className={css(`${styles.compass}__hero`, className)} {...props}>
|
|
14
|
+
{children}
|
|
15
|
+
</div>
|
|
16
|
+
);
|
|
86
17
|
|
|
87
18
|
CompassHero.displayName = 'CompassHero';
|
|
@@ -3,7 +3,7 @@ import { CompassPanel } from './CompassPanel';
|
|
|
3
3
|
import styles from '@patternfly/react-styles/css/components/Compass/compass';
|
|
4
4
|
import { css } from '@patternfly/react-styles';
|
|
5
5
|
|
|
6
|
-
interface CompassMainHeaderProps extends Omit<React.HTMLProps<HTMLDivElement>, 'title'> {
|
|
6
|
+
export interface CompassMainHeaderProps extends Omit<React.HTMLProps<HTMLDivElement>, 'title'> {
|
|
7
7
|
/** Additional classes added to the main header */
|
|
8
8
|
className?: string;
|
|
9
9
|
/** Styled title. If title or toolbar is provided, the children will be ignored. */
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import styles from '@patternfly/react-styles/css/components/Compass/compass';
|
|
2
2
|
import { css } from '@patternfly/react-styles';
|
|
3
3
|
|
|
4
|
-
interface CompassMessageBarProps extends React.HTMLProps<HTMLDivElement> {
|
|
4
|
+
export interface CompassMessageBarProps extends React.HTMLProps<HTMLDivElement> {
|
|
5
5
|
/** Content of the message bar. Typically a @patternfly/chatbot MessageBar component. */
|
|
6
6
|
children?: React.ReactNode;
|
|
7
7
|
/** Additional classes added to the message bar */
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import styles from '@patternfly/react-styles/css/components/Compass/compass';
|
|
2
2
|
import { css } from '@patternfly/react-styles';
|
|
3
3
|
|
|
4
|
-
interface CompassPanelProps extends React.HTMLProps<HTMLDivElement> {
|
|
4
|
+
export interface CompassPanelProps extends React.HTMLProps<HTMLDivElement> {
|
|
5
5
|
/** Content of the panel. */
|
|
6
6
|
children: React.ReactNode;
|
|
7
7
|
/** Additional classes added to the panel. */
|
|
@@ -16,135 +16,23 @@ test('Renders with children', () => {
|
|
|
16
16
|
expect(screen.getByText('Test content')).toBeVisible();
|
|
17
17
|
});
|
|
18
18
|
|
|
19
|
-
test(
|
|
20
|
-
render(<CompassHero className="custom-class">Test</CompassHero>);
|
|
21
|
-
expect(screen.getByText('Test').parentElement).toHaveClass('custom-class');
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
test(`Renders with default ${styles.compassPanel} and ${styles.compassHero} classes on the hero and ${styles.compassHeroBody} class on the hero body`, () => {
|
|
19
|
+
test(`Renders with ${styles.compass}__hero class by defaulty`, () => {
|
|
25
20
|
render(<CompassHero>Test</CompassHero>);
|
|
26
|
-
const heroBodyElement = screen.getByText('Test');
|
|
27
|
-
expect(heroBodyElement).toHaveClass(styles.compassHeroBody);
|
|
28
|
-
|
|
29
|
-
const heroElement = heroBodyElement.parentElement;
|
|
30
|
-
expect(heroElement).toHaveClass(styles.compassPanel);
|
|
31
|
-
expect(heroElement).toHaveClass(styles.compassHero);
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
test('Renders with light background image style when backgroundSrcLight is provided', () => {
|
|
35
|
-
const backgroundSrc = 'light-bg.jpg';
|
|
36
|
-
render(<CompassHero backgroundSrcLight={backgroundSrc}>Test</CompassHero>);
|
|
37
|
-
expect(screen.getByText('Test').parentElement).toHaveStyle(
|
|
38
|
-
`--pf-v6-c-compass__hero--BackgroundImage--light: url(${backgroundSrc})`
|
|
39
|
-
);
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
test('Renders with dark background image style when backgroundSrcDark is provided', () => {
|
|
43
|
-
const backgroundSrc = 'dark-bg.jpg';
|
|
44
|
-
render(<CompassHero backgroundSrcDark={backgroundSrc}>Test</CompassHero>);
|
|
45
|
-
expect(screen.getByText('Test').parentElement).toHaveStyle(
|
|
46
|
-
`--pf-v6-c-compass__hero--BackgroundImage--dark: url(${backgroundSrc})`
|
|
47
|
-
);
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
test('Renders with both light and dark background image styles when both are provided', () => {
|
|
51
|
-
const lightSrc = 'light-bg.jpg';
|
|
52
|
-
const darkSrc = 'dark-bg.jpg';
|
|
53
|
-
render(
|
|
54
|
-
<CompassHero backgroundSrcLight={lightSrc} backgroundSrcDark={darkSrc}>
|
|
55
|
-
Test
|
|
56
|
-
</CompassHero>
|
|
57
|
-
);
|
|
58
|
-
const heroElement = screen.getByText('Test').parentElement;
|
|
59
|
-
expect(heroElement).toHaveStyle(`--pf-v6-c-compass__hero--BackgroundImage--light: url(${lightSrc})`);
|
|
60
|
-
expect(heroElement).toHaveStyle(`--pf-v6-c-compass__hero--BackgroundImage--dark: url(${darkSrc})`);
|
|
61
|
-
});
|
|
62
|
-
|
|
63
|
-
test('Renders with light gradient styles when gradientLight is provided', () => {
|
|
64
|
-
const gradient = {
|
|
65
|
-
stop1: '#ff0000',
|
|
66
|
-
stop2: '#00ff00',
|
|
67
|
-
stop3: '#0000ff'
|
|
68
|
-
};
|
|
69
|
-
render(<CompassHero gradientLight={gradient}>Test</CompassHero>);
|
|
70
|
-
const heroElement = screen.getByText('Test').parentElement;
|
|
71
|
-
expect(heroElement).toHaveStyle(`--pf-v6-c-compass__hero--gradient--stop-1--light: ${gradient.stop1}`);
|
|
72
|
-
expect(heroElement).toHaveStyle(`--pf-v6-c-compass__hero--gradient--stop-2--light: ${gradient.stop2}`);
|
|
73
|
-
expect(heroElement).toHaveStyle(`--pf-v6-c-compass__hero--gradient--stop-3--light: ${gradient.stop3}`);
|
|
74
|
-
});
|
|
75
21
|
|
|
76
|
-
|
|
77
|
-
const gradient = {
|
|
78
|
-
stop1: '#ff0000',
|
|
79
|
-
stop2: '#00ff00',
|
|
80
|
-
stop3: '#0000ff'
|
|
81
|
-
};
|
|
82
|
-
render(<CompassHero gradientDark={gradient}>Test</CompassHero>);
|
|
83
|
-
const heroElement = screen.getByText('Test').parentElement;
|
|
84
|
-
expect(heroElement).toHaveStyle(`--pf-v6-c-compass__hero--gradient--stop-1--dark: ${gradient.stop1}`);
|
|
85
|
-
expect(heroElement).toHaveStyle(`--pf-v6-c-compass__hero--gradient--stop-2--dark: ${gradient.stop2}`);
|
|
86
|
-
expect(heroElement).toHaveStyle(`--pf-v6-c-compass__hero--gradient--stop-3--dark: ${gradient.stop3}`);
|
|
87
|
-
});
|
|
88
|
-
|
|
89
|
-
test('Renders with both light and dark gradient styles when both are provided', () => {
|
|
90
|
-
const lightGradient = {
|
|
91
|
-
stop1: '#ff0000',
|
|
92
|
-
stop2: '#00ff00',
|
|
93
|
-
stop3: '#0000ff'
|
|
94
|
-
};
|
|
95
|
-
const darkGradient = {
|
|
96
|
-
stop1: '#000000',
|
|
97
|
-
stop2: '#ffffff',
|
|
98
|
-
stop3: '#808080'
|
|
99
|
-
};
|
|
100
|
-
render(
|
|
101
|
-
<CompassHero gradientLight={lightGradient} gradientDark={darkGradient}>
|
|
102
|
-
Test
|
|
103
|
-
</CompassHero>
|
|
104
|
-
);
|
|
105
|
-
const heroElement = screen.getByText('Test').parentElement;
|
|
106
|
-
expect(heroElement).toHaveStyle(`--pf-v6-c-compass__hero--gradient--stop-1--light: ${lightGradient.stop1}`);
|
|
107
|
-
expect(heroElement).toHaveStyle(`--pf-v6-c-compass__hero--gradient--stop-1--dark: ${darkGradient.stop1}`);
|
|
22
|
+
expect(screen.getByText('Test')).toHaveClass(`${styles.compass}__hero`, { exact: true });
|
|
108
23
|
});
|
|
109
24
|
|
|
110
|
-
test('Renders with
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
const lightGradient = { stop1: '#ff0000' };
|
|
114
|
-
const darkGradient = { stop1: '#000000' };
|
|
115
|
-
|
|
116
|
-
render(
|
|
117
|
-
<CompassHero
|
|
118
|
-
backgroundSrcLight={lightSrc}
|
|
119
|
-
backgroundSrcDark={darkSrc}
|
|
120
|
-
gradientLight={lightGradient}
|
|
121
|
-
gradientDark={darkGradient}
|
|
122
|
-
>
|
|
123
|
-
Test
|
|
124
|
-
</CompassHero>
|
|
125
|
-
);
|
|
126
|
-
const heroElement = screen.getByText('Test').parentElement;
|
|
127
|
-
expect(heroElement).toHaveStyle(`--pf-v6-c-compass__hero--BackgroundImage--light: url(${lightSrc})`);
|
|
128
|
-
expect(heroElement).toHaveStyle(`--pf-v6-c-compass__hero--BackgroundImage--dark: url(${darkSrc})`);
|
|
129
|
-
expect(heroElement).toHaveStyle(`--pf-v6-c-compass__hero--gradient--stop-1--light: ${lightGradient.stop1}`);
|
|
130
|
-
expect(heroElement).toHaveStyle(`--pf-v6-c-compass__hero--gradient--stop-1--dark: ${darkGradient.stop1}`);
|
|
25
|
+
test('Renders with custom class name when className prop is provided', () => {
|
|
26
|
+
render(<CompassHero className="custom-class">Test</CompassHero>);
|
|
27
|
+
expect(screen.getByText('Test')).toHaveClass('custom-class');
|
|
131
28
|
});
|
|
132
29
|
|
|
133
30
|
test('Renders with additional props spread to the component', () => {
|
|
134
31
|
render(<CompassHero aria-label="Test label">Test</CompassHero>);
|
|
135
|
-
expect(screen.getByText('Test')
|
|
32
|
+
expect(screen.getByText('Test')).toHaveAccessibleName('Test label');
|
|
136
33
|
});
|
|
137
34
|
|
|
138
35
|
test('Matches the snapshot', () => {
|
|
139
|
-
const { asFragment } = render(
|
|
140
|
-
<CompassHero
|
|
141
|
-
backgroundSrcLight="light.jpg"
|
|
142
|
-
backgroundSrcDark="dark.jpg"
|
|
143
|
-
gradientLight={{ stop1: '#ff0000', stop2: '#00ff00', stop3: '#0000ff' }}
|
|
144
|
-
gradientDark={{ stop1: '#000000', stop2: '#ffffff', stop3: '#808080' }}
|
|
145
|
-
>
|
|
146
|
-
<div>Hero content</div>
|
|
147
|
-
</CompassHero>
|
|
148
|
-
);
|
|
36
|
+
const { asFragment } = render(<CompassHero>Hero content</CompassHero>);
|
|
149
37
|
expect(asFragment()).toMatchSnapshot();
|
|
150
38
|
});
|
|
@@ -3,16 +3,9 @@
|
|
|
3
3
|
exports[`Matches the snapshot 1`] = `
|
|
4
4
|
<DocumentFragment>
|
|
5
5
|
<div
|
|
6
|
-
class="pf-v6-c-
|
|
7
|
-
style="--pf-v6-c-compass__hero--BackgroundImage--light: url(light.jpg); --pf-v6-c-compass__hero--BackgroundImage--dark: url(dark.jpg); --pf-v6-c-compass__hero--gradient--stop-1--light: #ff0000; --pf-v6-c-compass__hero--gradient--stop-2--light: #00ff00; --pf-v6-c-compass__hero--gradient--stop-3--light: #0000ff; --pf-v6-c-compass__hero--gradient--stop-1--dark: #000000; --pf-v6-c-compass__hero--gradient--stop-2--dark: #ffffff; --pf-v6-c-compass__hero--gradient--stop-3--dark: #808080;"
|
|
6
|
+
class="pf-v6-c-compass__hero"
|
|
8
7
|
>
|
|
9
|
-
|
|
10
|
-
class="pf-v6-c-compass__hero-body"
|
|
11
|
-
>
|
|
12
|
-
<div>
|
|
13
|
-
Hero content
|
|
14
|
-
</div>
|
|
15
|
-
</div>
|
|
8
|
+
Hero content
|
|
16
9
|
</div>
|
|
17
10
|
</DocumentFragment>
|
|
18
11
|
`;
|
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
CompassMainHeader,
|
|
8
8
|
CompassPanel,
|
|
9
9
|
CompassMessageBar,
|
|
10
|
+
Hero,
|
|
10
11
|
Tabs,
|
|
11
12
|
TabsComponent,
|
|
12
13
|
Tab,
|
|
@@ -119,8 +120,8 @@ export const CompassBasic: React.FunctionComponent = () => {
|
|
|
119
120
|
const sidebarStartContent = sidebarContent;
|
|
120
121
|
const mainContent = (
|
|
121
122
|
<>
|
|
122
|
-
<CompassHero
|
|
123
|
-
<
|
|
123
|
+
<CompassHero>
|
|
124
|
+
<Hero gradientDark={{ stop1: '#000', stop2: '#1b0d33', stop3: '#3d2785' }}>Hero</Hero>
|
|
124
125
|
</CompassHero>
|
|
125
126
|
<CompassMainHeader title={<Title headingLevel="h1">Content title</Title>} />
|
|
126
127
|
<CompassContent>
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import styles from '@patternfly/react-styles/css/components/Hero/hero';
|
|
2
|
+
import { css } from '@patternfly/react-styles';
|
|
3
|
+
import heroBackgroundImageLight from '@patternfly/react-tokens/dist/esm/c_hero_BackgroundImage_light';
|
|
4
|
+
import heroBackgroundImageDark from '@patternfly/react-tokens/dist/esm/c_hero_BackgroundImage_dark';
|
|
5
|
+
import heroGradientStop1Light from '@patternfly/react-tokens/dist/esm/c_hero_gradient_stop_1_light';
|
|
6
|
+
import heroGradientStop2Light from '@patternfly/react-tokens/dist/esm/c_hero_gradient_stop_2_light';
|
|
7
|
+
import heroGradientStop3Light from '@patternfly/react-tokens/dist/esm/c_hero_gradient_stop_3_light';
|
|
8
|
+
import heroGradientStop1Dark from '@patternfly/react-tokens/dist/esm/c_hero_gradient_stop_1_dark';
|
|
9
|
+
import heroGradientStop2Dark from '@patternfly/react-tokens/dist/esm/c_hero_gradient_stop_2_dark';
|
|
10
|
+
import heroGradientStop3Dark from '@patternfly/react-tokens/dist/esm/c_hero_gradient_stop_3_dark';
|
|
11
|
+
import heroBodyWidth from '@patternfly/react-tokens/dist/esm/c_hero__body_Width';
|
|
12
|
+
import heroBodyMaxWidth from '@patternfly/react-tokens/dist/esm/c_hero__body_MaxWidth';
|
|
13
|
+
|
|
14
|
+
/** The main Hero component that allows adjusting of its background images and gradients in different color modes (such as light and dark). */
|
|
15
|
+
|
|
16
|
+
export interface HeroProps extends Omit<React.HTMLProps<HTMLDivElement>, 'content'> {
|
|
17
|
+
/** Content of the hero */
|
|
18
|
+
children?: React.ReactNode;
|
|
19
|
+
/** Additional classes added to the hero */
|
|
20
|
+
className?: string;
|
|
21
|
+
/** Light theme background image path of the hero */
|
|
22
|
+
backgroundSrcLight?: string;
|
|
23
|
+
/** Dark theme background image path of the hero */
|
|
24
|
+
backgroundSrcDark?: string;
|
|
25
|
+
/** Light theme gradient of the hero, taking any valid CSS color values for each stop property. */
|
|
26
|
+
gradientLight?: {
|
|
27
|
+
stop1?: string;
|
|
28
|
+
stop2?: string;
|
|
29
|
+
stop3?: string;
|
|
30
|
+
};
|
|
31
|
+
/** Dark theme gradient of the hero, taking any valid CSS color values for each stop property. */
|
|
32
|
+
gradientDark?: {
|
|
33
|
+
stop1?: string;
|
|
34
|
+
stop2?: string;
|
|
35
|
+
stop3?: string;
|
|
36
|
+
};
|
|
37
|
+
/** Flag indicating whether glass styles are removed from the hero when a glass theme is applied. */
|
|
38
|
+
hasNoGlass?: boolean;
|
|
39
|
+
/** Modifies the width of the hero body. */
|
|
40
|
+
bodyWidth?: string;
|
|
41
|
+
/** Modifies the max-width of the hero body. */
|
|
42
|
+
bodyMaxWidth?: string;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export const Hero: React.FunctionComponent<HeroProps> = ({
|
|
46
|
+
className,
|
|
47
|
+
children,
|
|
48
|
+
backgroundSrcLight,
|
|
49
|
+
backgroundSrcDark,
|
|
50
|
+
gradientLight,
|
|
51
|
+
gradientDark,
|
|
52
|
+
hasNoGlass = false,
|
|
53
|
+
bodyWidth,
|
|
54
|
+
bodyMaxWidth,
|
|
55
|
+
...props
|
|
56
|
+
}) => {
|
|
57
|
+
const customStyles: { [key: string]: string } = {};
|
|
58
|
+
if (backgroundSrcLight) {
|
|
59
|
+
customStyles[heroBackgroundImageLight.name] = `url(${backgroundSrcLight})`;
|
|
60
|
+
}
|
|
61
|
+
if (backgroundSrcDark) {
|
|
62
|
+
customStyles[heroBackgroundImageDark.name] = `url(${backgroundSrcDark})`;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
if (gradientLight?.stop1) {
|
|
66
|
+
customStyles[heroGradientStop1Light.name] = gradientLight.stop1;
|
|
67
|
+
}
|
|
68
|
+
if (gradientLight?.stop2) {
|
|
69
|
+
customStyles[heroGradientStop2Light.name] = gradientLight.stop2;
|
|
70
|
+
}
|
|
71
|
+
if (gradientLight?.stop3) {
|
|
72
|
+
customStyles[heroGradientStop3Light.name] = gradientLight.stop3;
|
|
73
|
+
}
|
|
74
|
+
if (gradientDark?.stop1) {
|
|
75
|
+
customStyles[heroGradientStop1Dark.name] = gradientDark.stop1;
|
|
76
|
+
}
|
|
77
|
+
if (gradientDark?.stop2) {
|
|
78
|
+
customStyles[heroGradientStop2Dark.name] = gradientDark.stop2;
|
|
79
|
+
}
|
|
80
|
+
if (gradientDark?.stop3) {
|
|
81
|
+
customStyles[heroGradientStop3Dark.name] = gradientDark.stop3;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
if (bodyWidth) {
|
|
85
|
+
customStyles[heroBodyWidth.name] = bodyWidth;
|
|
86
|
+
}
|
|
87
|
+
if (bodyMaxWidth) {
|
|
88
|
+
customStyles[heroBodyMaxWidth.name] = bodyMaxWidth;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
return (
|
|
92
|
+
<div
|
|
93
|
+
className={css(styles.hero, hasNoGlass && styles.modifiers.noGlass, className)}
|
|
94
|
+
style={{ ...props.style, ...customStyles }}
|
|
95
|
+
{...props}
|
|
96
|
+
>
|
|
97
|
+
<div className={css(styles.heroBody)}>{children}</div>
|
|
98
|
+
</div>
|
|
99
|
+
);
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
Hero.displayName = 'Hero';
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
import { render, screen } from '@testing-library/react';
|
|
2
|
+
import { Hero } from '../Hero';
|
|
3
|
+
import styles from '@patternfly/react-styles/css/components/Hero/hero';
|
|
4
|
+
|
|
5
|
+
test('Renders without children', () => {
|
|
6
|
+
render(
|
|
7
|
+
<div data-testid="test-hero">
|
|
8
|
+
<Hero />
|
|
9
|
+
</div>
|
|
10
|
+
);
|
|
11
|
+
expect(screen.getByTestId('test-hero').firstChild).toBeVisible();
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
test('Renders with children', () => {
|
|
15
|
+
render(<Hero>Test content</Hero>);
|
|
16
|
+
expect(screen.getByText('Test content')).toBeVisible();
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
test(`Renders with ${styles.hero} class on wrapper by defaulty`, () => {
|
|
20
|
+
render(<Hero>Test</Hero>);
|
|
21
|
+
|
|
22
|
+
expect(screen.getByText('Test').parentElement).toHaveClass(`${styles.hero}`, { exact: true });
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
test('Renders with custom class name on wrapper when className prop is provided', () => {
|
|
26
|
+
render(<Hero className="custom-class">Test</Hero>);
|
|
27
|
+
expect(screen.getByText('Test').parentElement).toHaveClass('custom-class');
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
test(`Renders with class ${styles.heroBody} on content element`, () => {
|
|
31
|
+
render(<Hero>Test</Hero>);
|
|
32
|
+
|
|
33
|
+
expect(screen.getByText('Test')).toHaveClass(`${styles.heroBody}`, { exact: true });
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
test('Renders with additional props spread to the wrapper component', () => {
|
|
37
|
+
render(<Hero id="custom-id">Test</Hero>);
|
|
38
|
+
expect(screen.getByText('Test').parentElement).toHaveAttribute('id', 'custom-id');
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
test('Renders with light background image style when backgroundSrcLight is provided', () => {
|
|
42
|
+
const backgroundSrc = 'light-bg.jpg';
|
|
43
|
+
render(<Hero backgroundSrcLight={backgroundSrc}>Test</Hero>);
|
|
44
|
+
expect(screen.getByText('Test').parentElement).toHaveStyle(
|
|
45
|
+
`--pf-v6-c-hero--BackgroundImage--light: url(${backgroundSrc})`
|
|
46
|
+
);
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
test('Renders with dark background image style when backgroundSrcDark is provided', () => {
|
|
50
|
+
const backgroundSrc = 'dark-bg.jpg';
|
|
51
|
+
render(<Hero backgroundSrcDark={backgroundSrc}>Test</Hero>);
|
|
52
|
+
expect(screen.getByText('Test').parentElement).toHaveStyle(
|
|
53
|
+
`--pf-v6-c-hero--BackgroundImage--dark: url(${backgroundSrc})`
|
|
54
|
+
);
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
test('Renders with both light and dark background image styles when both are provided', () => {
|
|
58
|
+
const lightSrc = 'light-bg.jpg';
|
|
59
|
+
const darkSrc = 'dark-bg.jpg';
|
|
60
|
+
render(
|
|
61
|
+
<Hero backgroundSrcLight={lightSrc} backgroundSrcDark={darkSrc}>
|
|
62
|
+
Test
|
|
63
|
+
</Hero>
|
|
64
|
+
);
|
|
65
|
+
const heroElement = screen.getByText('Test').parentElement;
|
|
66
|
+
expect(heroElement).toHaveStyle(`--pf-v6-c-hero--BackgroundImage--light: url(${lightSrc})`);
|
|
67
|
+
expect(heroElement).toHaveStyle(`--pf-v6-c-hero--BackgroundImage--dark: url(${darkSrc})`);
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
test('Renders with light gradient styles when gradientLight is provided', () => {
|
|
71
|
+
const gradient = {
|
|
72
|
+
stop1: '#ff0000',
|
|
73
|
+
stop2: '#00ff00',
|
|
74
|
+
stop3: '#0000ff'
|
|
75
|
+
};
|
|
76
|
+
render(<Hero gradientLight={gradient}>Test</Hero>);
|
|
77
|
+
const heroElement = screen.getByText('Test').parentElement;
|
|
78
|
+
expect(heroElement).toHaveStyle(`--pf-v6-c-hero--gradient--stop-1--light: ${gradient.stop1}`);
|
|
79
|
+
expect(heroElement).toHaveStyle(`--pf-v6-c-hero--gradient--stop-2--light: ${gradient.stop2}`);
|
|
80
|
+
expect(heroElement).toHaveStyle(`--pf-v6-c-hero--gradient--stop-3--light: ${gradient.stop3}`);
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
test('Renders with dark gradient styles when gradientDark is provided', () => {
|
|
84
|
+
const gradient = {
|
|
85
|
+
stop1: '#ff0000',
|
|
86
|
+
stop2: '#00ff00',
|
|
87
|
+
stop3: '#0000ff'
|
|
88
|
+
};
|
|
89
|
+
render(<Hero gradientDark={gradient}>Test</Hero>);
|
|
90
|
+
const heroElement = screen.getByText('Test').parentElement;
|
|
91
|
+
expect(heroElement).toHaveStyle(`--pf-v6-c-hero--gradient--stop-1--dark: ${gradient.stop1}`);
|
|
92
|
+
expect(heroElement).toHaveStyle(`--pf-v6-c-hero--gradient--stop-2--dark: ${gradient.stop2}`);
|
|
93
|
+
expect(heroElement).toHaveStyle(`--pf-v6-c-hero--gradient--stop-3--dark: ${gradient.stop3}`);
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
test('Renders with both light and dark gradient styles when both are provided', () => {
|
|
97
|
+
const lightGradient = {
|
|
98
|
+
stop1: '#ff0000',
|
|
99
|
+
stop2: '#00ff00',
|
|
100
|
+
stop3: '#0000ff'
|
|
101
|
+
};
|
|
102
|
+
const darkGradient = {
|
|
103
|
+
stop1: '#000000',
|
|
104
|
+
stop2: '#ffffff',
|
|
105
|
+
stop3: '#808080'
|
|
106
|
+
};
|
|
107
|
+
render(
|
|
108
|
+
<Hero gradientLight={lightGradient} gradientDark={darkGradient}>
|
|
109
|
+
Test
|
|
110
|
+
</Hero>
|
|
111
|
+
);
|
|
112
|
+
const heroElement = screen.getByText('Test').parentElement;
|
|
113
|
+
expect(heroElement).toHaveStyle(`--pf-v6-c-hero--gradient--stop-1--light: ${lightGradient.stop1}`);
|
|
114
|
+
expect(heroElement).toHaveStyle(`--pf-v6-c-hero--gradient--stop-1--dark: ${darkGradient.stop1}`);
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
test('Renders with both background images and gradient styles when both are provided', () => {
|
|
118
|
+
const lightSrc = 'light-bg.jpg';
|
|
119
|
+
const darkSrc = 'dark-bg.jpg';
|
|
120
|
+
const lightGradient = { stop1: '#ff0000' };
|
|
121
|
+
const darkGradient = { stop1: '#000000' };
|
|
122
|
+
|
|
123
|
+
render(
|
|
124
|
+
<Hero
|
|
125
|
+
backgroundSrcLight={lightSrc}
|
|
126
|
+
backgroundSrcDark={darkSrc}
|
|
127
|
+
gradientLight={lightGradient}
|
|
128
|
+
gradientDark={darkGradient}
|
|
129
|
+
>
|
|
130
|
+
Test
|
|
131
|
+
</Hero>
|
|
132
|
+
);
|
|
133
|
+
const heroElement = screen.getByText('Test').parentElement;
|
|
134
|
+
expect(heroElement).toHaveStyle(`--pf-v6-c-hero--BackgroundImage--light: url(${lightSrc})`);
|
|
135
|
+
expect(heroElement).toHaveStyle(`--pf-v6-c-hero--BackgroundImage--dark: url(${darkSrc})`);
|
|
136
|
+
expect(heroElement).toHaveStyle(`--pf-v6-c-hero--gradient--stop-1--light: ${lightGradient.stop1}`);
|
|
137
|
+
expect(heroElement).toHaveStyle(`--pf-v6-c-hero--gradient--stop-1--dark: ${darkGradient.stop1}`);
|
|
138
|
+
});
|
|
139
|
+
|
|
140
|
+
test('Renders with inline width style when bodyWidth is passed', () => {
|
|
141
|
+
const bodyWidth = '100px';
|
|
142
|
+
|
|
143
|
+
render(<Hero bodyWidth={bodyWidth}>Test</Hero>);
|
|
144
|
+
const heroElement = screen.getByText('Test').parentElement;
|
|
145
|
+
expect(heroElement).toHaveStyle(`--pf-v6-c-hero__body--Width: ${bodyWidth}`);
|
|
146
|
+
});
|
|
147
|
+
|
|
148
|
+
test('Renders with inline max-width style when bodyMaxWidth is passed', () => {
|
|
149
|
+
const bodyMaxWidth = '100px';
|
|
150
|
+
|
|
151
|
+
render(<Hero bodyMaxWidth={bodyMaxWidth}>Test</Hero>);
|
|
152
|
+
const heroElement = screen.getByText('Test').parentElement;
|
|
153
|
+
expect(heroElement).toHaveStyle(`--pf-v6-c-hero__body--MaxWidth: ${bodyMaxWidth}`);
|
|
154
|
+
});
|
|
155
|
+
|
|
156
|
+
test('Matches the snapshot without backgroundSrc and gradient props', () => {
|
|
157
|
+
const { asFragment } = render(<Hero>Hero content</Hero>);
|
|
158
|
+
|
|
159
|
+
expect(asFragment()).toMatchSnapshot();
|
|
160
|
+
});
|
|
161
|
+
|
|
162
|
+
test('Matches the snapshot with backgroundSrc and gradient props', () => {
|
|
163
|
+
const { asFragment } = render(
|
|
164
|
+
<Hero
|
|
165
|
+
backgroundSrcLight="light.jpg"
|
|
166
|
+
backgroundSrcDark="dark.jpg"
|
|
167
|
+
gradientLight={{ stop1: '#ff0000', stop2: '#00ff00', stop3: '#0000ff' }}
|
|
168
|
+
gradientDark={{ stop1: '#000000', stop2: '#ffffff', stop3: '#808080' }}
|
|
169
|
+
>
|
|
170
|
+
Hero content
|
|
171
|
+
</Hero>
|
|
172
|
+
);
|
|
173
|
+
|
|
174
|
+
expect(asFragment()).toMatchSnapshot();
|
|
175
|
+
});
|