@patternfly/react-core 6.5.0-prerelease.11 → 6.5.0-prerelease.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -0
- package/components/package.json +1 -1
- package/deprecated/package.json +1 -1
- package/dist/dynamic/components/AboutModal/package.json +1 -1
- package/dist/dynamic/components/Accordion/package.json +1 -1
- package/dist/dynamic/components/ActionList/package.json +1 -1
- package/dist/dynamic/components/Alert/package.json +1 -1
- package/dist/dynamic/components/Avatar/package.json +1 -1
- package/dist/dynamic/components/BackToTop/package.json +1 -1
- package/dist/dynamic/components/Backdrop/package.json +1 -1
- package/dist/dynamic/components/BackgroundImage/package.json +1 -1
- package/dist/dynamic/components/Badge/package.json +1 -1
- package/dist/dynamic/components/Banner/package.json +1 -1
- package/dist/dynamic/components/Brand/package.json +1 -1
- package/dist/dynamic/components/Breadcrumb/package.json +1 -1
- package/dist/dynamic/components/Button/package.json +1 -1
- package/dist/dynamic/components/CalendarMonth/package.json +1 -1
- package/dist/dynamic/components/Card/package.json +1 -1
- package/dist/dynamic/components/Checkbox/package.json +1 -1
- package/dist/dynamic/components/ClipboardCopy/package.json +1 -1
- package/dist/dynamic/components/CodeBlock/package.json +1 -1
- package/dist/dynamic/components/Compass/package.json +1 -1
- package/dist/dynamic/components/Content/package.json +1 -1
- package/dist/dynamic/components/DataList/package.json +1 -1
- package/dist/dynamic/components/DatePicker/package.json +1 -1
- package/dist/dynamic/components/DescriptionList/package.json +1 -1
- package/dist/dynamic/components/Divider/package.json +1 -1
- package/dist/dynamic/components/Drawer/package.json +1 -1
- package/dist/dynamic/components/Dropdown/package.json +1 -1
- package/dist/dynamic/components/DualListSelector/package.json +1 -1
- package/dist/dynamic/components/EmptyState/package.json +1 -1
- package/dist/dynamic/components/ExpandableSection/package.json +1 -1
- package/dist/dynamic/components/FileUpload/package.json +1 -1
- package/dist/dynamic/components/Form/package.json +1 -1
- package/dist/dynamic/components/FormSelect/package.json +1 -1
- package/dist/dynamic/components/HelperText/package.json +1 -1
- package/dist/dynamic/components/Hero/package.json +1 -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 +14 -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 +11 -4
- package/dist/esm/components/Compass/CompassMainHeader.d.ts.map +1 -1
- package/dist/esm/components/Compass/CompassMainHeader.js +5 -3
- package/dist/esm/components/Compass/CompassMainHeader.js.map +1 -1
- package/dist/esm/components/Compass/CompassMainHeaderContent.d.ts +12 -0
- package/dist/esm/components/Compass/CompassMainHeaderContent.d.ts.map +1 -0
- package/dist/esm/components/Compass/CompassMainHeaderContent.js +10 -0
- package/dist/esm/components/Compass/CompassMainHeaderContent.js.map +1 -0
- package/dist/esm/components/Compass/CompassMainHeaderTitle.d.ts +12 -0
- package/dist/esm/components/Compass/CompassMainHeaderTitle.d.ts.map +1 -0
- package/dist/esm/components/Compass/CompassMainHeaderTitle.js +10 -0
- package/dist/esm/components/Compass/CompassMainHeaderTitle.js.map +1 -0
- package/dist/esm/components/Compass/CompassMainHeaderToolbar.d.ts +12 -0
- package/dist/esm/components/Compass/CompassMainHeaderToolbar.d.ts.map +1 -0
- package/dist/esm/components/Compass/CompassMainHeaderToolbar.js +10 -0
- package/dist/esm/components/Compass/CompassMainHeaderToolbar.js.map +1 -0
- 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/Compass/index.d.ts +3 -0
- package/dist/esm/components/Compass/index.d.ts.map +1 -1
- package/dist/esm/components/Compass/index.js +3 -0
- package/dist/esm/components/Compass/index.js.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 +11 -4
- package/dist/js/components/Compass/CompassMainHeader.d.ts.map +1 -1
- package/dist/js/components/Compass/CompassMainHeader.js +5 -3
- package/dist/js/components/Compass/CompassMainHeader.js.map +1 -1
- package/dist/js/components/Compass/CompassMainHeaderContent.d.ts +12 -0
- package/dist/js/components/Compass/CompassMainHeaderContent.d.ts.map +1 -0
- package/dist/js/components/Compass/CompassMainHeaderContent.js +14 -0
- package/dist/js/components/Compass/CompassMainHeaderContent.js.map +1 -0
- package/dist/js/components/Compass/CompassMainHeaderTitle.d.ts +12 -0
- package/dist/js/components/Compass/CompassMainHeaderTitle.d.ts.map +1 -0
- package/dist/js/components/Compass/CompassMainHeaderTitle.js +14 -0
- package/dist/js/components/Compass/CompassMainHeaderTitle.js.map +1 -0
- package/dist/js/components/Compass/CompassMainHeaderToolbar.d.ts +12 -0
- package/dist/js/components/Compass/CompassMainHeaderToolbar.d.ts.map +1 -0
- package/dist/js/components/Compass/CompassMainHeaderToolbar.js +14 -0
- package/dist/js/components/Compass/CompassMainHeaderToolbar.js.map +1 -0
- 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/Compass/index.d.ts +3 -0
- package/dist/js/components/Compass/index.d.ts.map +1 -1
- package/dist/js/components/Compass/index.js +3 -0
- package/dist/js/components/Compass/index.js.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-CSQR1P9A.css → output-DEO1snKq.css} +16932 -16769
- package/dist/umd/react-core.min.js +2 -2
- 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 +21 -10
- package/src/components/Compass/CompassMainHeaderContent.tsx +25 -0
- package/src/components/Compass/CompassMainHeaderTitle.tsx +25 -0
- package/src/components/Compass/CompassMainHeaderToolbar.tsx +25 -0
- 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__/CompassMainHeader.test.tsx +45 -2
- package/src/components/Compass/__tests__/CompassMainHeaderContent.test.tsx +28 -0
- package/src/components/Compass/__tests__/CompassMainHeaderTitle.test.tsx +28 -0
- package/src/components/Compass/__tests__/CompassMainHeaderToolbar.test.tsx +28 -0
- package/src/components/Compass/__tests__/__snapshots__/CompassHero.test.tsx.snap +2 -9
- package/src/components/Compass/__tests__/__snapshots__/CompassMainHeader.test.tsx.snap +3 -3
- package/src/components/Compass/__tests__/__snapshots__/CompassMainHeaderContent.test.tsx.snap +11 -0
- package/src/components/Compass/__tests__/__snapshots__/CompassMainHeaderTitle.test.tsx.snap +11 -0
- package/src/components/Compass/__tests__/__snapshots__/CompassMainHeaderToolbar.test.tsx.snap +11 -0
- package/src/components/Compass/examples/Compass.md +19 -1
- package/src/components/Compass/examples/CompassBasic.tsx +14 -2
- package/src/components/Compass/examples/CompassDemo.tsx +3 -2
- package/src/components/Compass/index.ts +3 -0
- 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/src/deprecated/components/Modal/examples/Modal.md +2 -2
- package/src/deprecated/components/Tile/examples/Tile.md +0 -2
- package/src/helpers/OUIA/OUIA.md +2 -2
- package/src/layouts/Bullseye/examples/Bullseye.md +2 -1
- package/src/layouts/Flex/examples/Flex.md +2 -1
- package/src/layouts/Gallery/examples/Gallery.md +2 -1
- package/src/layouts/Grid/examples/Grid.md +2 -1
- package/src/layouts/Level/examples/Level.md +2 -1
- package/src/layouts/Split/examples/Split.md +2 -1
- package/src/layouts/Stack/examples/Stack.md +2 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
id: Compass
|
|
3
3
|
cssPrefix: pf-v6-c-compass
|
|
4
|
-
section:
|
|
4
|
+
section: AI
|
|
5
5
|
subsection: Generative UIs
|
|
6
6
|
beta: true
|
|
7
7
|
propComponents:
|
|
@@ -46,3 +46,21 @@ The background image of the `Compass` and `CompassHero` may be customized by usi
|
|
|
46
46
|
```ts isFullscreen file="CompassDemo.tsx"
|
|
47
47
|
|
|
48
48
|
```
|
|
49
|
+
|
|
50
|
+
## Composable structure
|
|
51
|
+
|
|
52
|
+
When building a more custom implementation using Compass components, there are some intended or expected structures that must be present.
|
|
53
|
+
|
|
54
|
+
### CompassMainHeader structure
|
|
55
|
+
|
|
56
|
+
When using the `children` property in the `<CompassMainHeader>` component, you should ensure that the expected sub-components are used. The following code block shows a general structure to follow.
|
|
57
|
+
|
|
58
|
+
```noLive
|
|
59
|
+
<CompassMainHeader>
|
|
60
|
+
<CompassPanel>
|
|
61
|
+
<CompassMainHeaderContent>
|
|
62
|
+
{Your custom content goes here, which can include the CompassMainHeaderTitle and/or CompassMainHeaderToolbar sub-components}
|
|
63
|
+
</CompassMainHeaderContent>
|
|
64
|
+
</CompassPanel>
|
|
65
|
+
</CompassMainHeader>
|
|
66
|
+
```
|
|
@@ -1,4 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
Compass,
|
|
3
|
+
CompassHeader,
|
|
4
|
+
CompassHero,
|
|
5
|
+
CompassContent,
|
|
6
|
+
CompassMainHeader,
|
|
7
|
+
CompassPanel,
|
|
8
|
+
CompassMainHeaderContent
|
|
9
|
+
} from '@patternfly/react-core';
|
|
2
10
|
import './compass.css';
|
|
3
11
|
|
|
4
12
|
export const CompassBasic: React.FunctionComponent = () => {
|
|
@@ -12,7 +20,11 @@ export const CompassBasic: React.FunctionComponent = () => {
|
|
|
12
20
|
</CompassHero>
|
|
13
21
|
<CompassContent>
|
|
14
22
|
<CompassMainHeader>
|
|
15
|
-
<
|
|
23
|
+
<CompassPanel>
|
|
24
|
+
<CompassMainHeaderContent>
|
|
25
|
+
<div>Content title</div>
|
|
26
|
+
</CompassMainHeaderContent>
|
|
27
|
+
</CompassPanel>
|
|
16
28
|
</CompassMainHeader>
|
|
17
29
|
<div>Content</div>
|
|
18
30
|
</CompassContent>
|
|
@@ -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>
|
|
@@ -3,5 +3,8 @@ export * from './CompassContent';
|
|
|
3
3
|
export * from './CompassHeader';
|
|
4
4
|
export * from './CompassHero';
|
|
5
5
|
export * from './CompassMainHeader';
|
|
6
|
+
export * from './CompassMainHeaderContent';
|
|
7
|
+
export * from './CompassMainHeaderTitle';
|
|
8
|
+
export * from './CompassMainHeaderToolbar';
|
|
6
9
|
export * from './CompassMessageBar';
|
|
7
10
|
export * from './CompassPanel';
|
|
@@ -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
|
+
});
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`Matches the snapshot with backgroundSrc and gradient props 1`] = `
|
|
4
|
+
<DocumentFragment>
|
|
5
|
+
<div
|
|
6
|
+
class="pf-v6-c-hero"
|
|
7
|
+
style="--pf-v6-c-hero--BackgroundImage--light: url(light.jpg); --pf-v6-c-hero--BackgroundImage--dark: url(dark.jpg); --pf-v6-c-hero--gradient--stop-1--light: #ff0000; --pf-v6-c-hero--gradient--stop-2--light: #00ff00; --pf-v6-c-hero--gradient--stop-3--light: #0000ff; --pf-v6-c-hero--gradient--stop-1--dark: #000000; --pf-v6-c-hero--gradient--stop-2--dark: #ffffff; --pf-v6-c-hero--gradient--stop-3--dark: #808080;"
|
|
8
|
+
>
|
|
9
|
+
<div
|
|
10
|
+
class="pf-v6-c-hero__body"
|
|
11
|
+
>
|
|
12
|
+
Hero content
|
|
13
|
+
</div>
|
|
14
|
+
</div>
|
|
15
|
+
</DocumentFragment>
|
|
16
|
+
`;
|
|
17
|
+
|
|
18
|
+
exports[`Matches the snapshot without backgroundSrc and gradient props 1`] = `
|
|
19
|
+
<DocumentFragment>
|
|
20
|
+
<div
|
|
21
|
+
class="pf-v6-c-hero"
|
|
22
|
+
>
|
|
23
|
+
<div
|
|
24
|
+
class="pf-v6-c-hero__body"
|
|
25
|
+
>
|
|
26
|
+
Hero content
|
|
27
|
+
</div>
|
|
28
|
+
</div>
|
|
29
|
+
</DocumentFragment>
|
|
30
|
+
`;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: Hero
|
|
3
|
+
section: components
|
|
4
|
+
cssPrefix: pf-v6-c-hero
|
|
5
|
+
beta: true
|
|
6
|
+
propComponents: ['Hero']
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Examples
|
|
10
|
+
|
|
11
|
+
### Basic
|
|
12
|
+
|
|
13
|
+
If you need finer control over the placement of text content within the `<Hero>`, such as when you omit a background image, adjust the `bodyWidth` and `bodyMaxWidth` properties. Be mindful of using these properties when a background image is still present and ensure there is sufficient contrast between text and any part of the image that it overlaps.
|
|
14
|
+
|
|
15
|
+
When using `gradientLight` or `gradientDark` to apply gradient backgrounds, check the color contrast to ensure proper accessibility.
|
|
16
|
+
|
|
17
|
+
```ts file="HeroBasic.tsx"
|
|
18
|
+
|
|
19
|
+
```
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Hero';
|
package/src/components/index.ts
CHANGED
|
@@ -127,7 +127,7 @@ To guide users through a series of steps in a modal, you can add a [wizard](/com
|
|
|
127
127
|
|
|
128
128
|
### With dropdown
|
|
129
129
|
|
|
130
|
-
To present a menu of actions or links to a user, you can add a [dropdown](/components/dropdown) to a modal. To allow the dropdown to visually break out of the modal container, set the `menuAppendTo` property to “parent”. Handle the modal’s closing behavior by listening to the `onEscapePress` callback on the `<Modal>` component. This allows the "escape" key to collapse the dropdown without closing the entire modal.
|
|
130
|
+
To present a menu of actions or links to a user, you can add a [dropdown](/components/menus/dropdown) to a modal. To allow the dropdown to visually break out of the modal container, set the `menuAppendTo` property to “parent”. Handle the modal’s closing behavior by listening to the `onEscapePress` callback on the `<Modal>` component. This allows the "escape" key to collapse the dropdown without closing the entire modal.
|
|
131
131
|
|
|
132
132
|
```ts file="./ModalWithDropdown.tsx"
|
|
133
133
|
|
|
@@ -143,7 +143,7 @@ To help simplify and explain complex models, add a help [popover](/components/po
|
|
|
143
143
|
|
|
144
144
|
### With form
|
|
145
145
|
|
|
146
|
-
To collect user input within a modal, you can add a [form](/components/form).
|
|
146
|
+
To collect user input within a modal, you can add a [form](/components/forms/form).
|
|
147
147
|
|
|
148
148
|
To submit the form from a button in the modal's footer (outside of the `<Form>`), set the button's `form` property equal to the form's id.
|
|
149
149
|
|
|
@@ -15,8 +15,6 @@ import './Tile.css';
|
|
|
15
15
|
|
|
16
16
|
## Examples
|
|
17
17
|
|
|
18
|
-
Keyboard interaction patterns and a11y is implemented in the Tile demos, located in the [Demo section](/components/tile/react-demos).
|
|
19
|
-
|
|
20
18
|
### Basic tile
|
|
21
19
|
|
|
22
20
|
Basic tiles can appear in one of three states: a default state, selected state, and a disabled state. To change the state of a tile, use the properties `isSelected` and `isDisabled`.
|
package/src/helpers/OUIA/OUIA.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
id: Open UI Automation
|
|
3
|
-
section: developer-
|
|
3
|
+
section: developer-guides
|
|
4
4
|
---
|
|
5
5
|
import { Fragment } from 'react';
|
|
6
6
|
|
|
@@ -54,6 +54,7 @@ component.
|
|
|
54
54
|
* [Card](/components/card)
|
|
55
55
|
* [Checkbox](/components/forms/checkbox)
|
|
56
56
|
* [Chip](/components/chip)
|
|
57
|
+
* [Content](/components/content)
|
|
57
58
|
* [Dropdown](/components/menus/dropdown)
|
|
58
59
|
* [DropdownItem](/components/menus/dropdown)
|
|
59
60
|
* [FormSelect](/components/forms/form-select)
|
|
@@ -68,7 +69,6 @@ component.
|
|
|
68
69
|
* [Switch](/components/switch)
|
|
69
70
|
* [TabContent](/components/tabs)
|
|
70
71
|
* [Tabs](/components/tabs)
|
|
71
|
-
* [Text](/components/text)
|
|
72
72
|
* [TextInput](/components/forms/text-input)
|
|
73
73
|
* [Title](/components/title)
|
|
74
74
|
* [Toolbar](/components/toolbar)
|