@patternfly/react-core 6.0.0-alpha.85 → 6.0.0-alpha.87
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/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/esm/components/Page/Page.d.ts +2 -0
- package/dist/esm/components/Page/Page.d.ts.map +1 -1
- package/dist/esm/components/Page/Page.js +2 -2
- package/dist/esm/components/Page/Page.js.map +1 -1
- package/dist/esm/components/Page/PageGroup.d.ts +3 -1
- package/dist/esm/components/Page/PageGroup.d.ts.map +1 -1
- package/dist/esm/components/Page/PageGroup.js +2 -2
- package/dist/esm/components/Page/PageGroup.js.map +1 -1
- package/dist/esm/components/Page/PageSection.d.ts +1 -1
- package/dist/esm/components/Page/PageSection.d.ts.map +1 -1
- package/dist/esm/components/Wizard/Wizard.d.ts.map +1 -1
- package/dist/esm/components/Wizard/Wizard.js +5 -3
- package/dist/esm/components/Wizard/Wizard.js.map +1 -1
- package/dist/esm/components/Wizard/WizardContext.d.ts.map +1 -1
- package/dist/esm/components/Wizard/WizardContext.js +13 -3
- package/dist/esm/components/Wizard/WizardContext.js.map +1 -1
- package/dist/esm/components/Wizard/WizardNavItem.d.ts +1 -1
- package/dist/esm/components/Wizard/WizardNavItem.d.ts.map +1 -1
- package/dist/esm/components/Wizard/WizardNavItem.js +5 -3
- package/dist/esm/components/Wizard/WizardNavItem.js.map +1 -1
- package/dist/esm/components/Wizard/WizardStep.d.ts +1 -1
- package/dist/esm/components/Wizard/WizardStep.d.ts.map +1 -1
- package/dist/esm/components/Wizard/WizardToggle.d.ts.map +1 -1
- package/dist/esm/components/Wizard/WizardToggle.js +7 -3
- package/dist/esm/components/Wizard/WizardToggle.js.map +1 -1
- package/dist/esm/components/Wizard/types.d.ts +3 -2
- package/dist/esm/components/Wizard/types.d.ts.map +1 -1
- package/dist/esm/components/Wizard/types.js +1 -0
- package/dist/esm/components/Wizard/types.js.map +1 -1
- package/dist/js/components/Page/Page.d.ts +2 -0
- package/dist/js/components/Page/Page.d.ts.map +1 -1
- package/dist/js/components/Page/Page.js +2 -2
- package/dist/js/components/Page/Page.js.map +1 -1
- package/dist/js/components/Page/PageGroup.d.ts +3 -1
- package/dist/js/components/Page/PageGroup.d.ts.map +1 -1
- package/dist/js/components/Page/PageGroup.js +2 -2
- package/dist/js/components/Page/PageGroup.js.map +1 -1
- package/dist/js/components/Page/PageSection.d.ts +1 -1
- package/dist/js/components/Page/PageSection.d.ts.map +1 -1
- package/dist/js/components/Wizard/Wizard.d.ts.map +1 -1
- package/dist/js/components/Wizard/Wizard.js +5 -3
- package/dist/js/components/Wizard/Wizard.js.map +1 -1
- package/dist/js/components/Wizard/WizardContext.d.ts.map +1 -1
- package/dist/js/components/Wizard/WizardContext.js +13 -3
- package/dist/js/components/Wizard/WizardContext.js.map +1 -1
- package/dist/js/components/Wizard/WizardNavItem.d.ts +1 -1
- package/dist/js/components/Wizard/WizardNavItem.d.ts.map +1 -1
- package/dist/js/components/Wizard/WizardNavItem.js +5 -3
- package/dist/js/components/Wizard/WizardNavItem.js.map +1 -1
- package/dist/js/components/Wizard/WizardStep.d.ts +1 -1
- package/dist/js/components/Wizard/WizardStep.d.ts.map +1 -1
- package/dist/js/components/Wizard/WizardToggle.d.ts.map +1 -1
- package/dist/js/components/Wizard/WizardToggle.js +7 -3
- package/dist/js/components/Wizard/WizardToggle.js.map +1 -1
- package/dist/js/components/Wizard/types.d.ts +3 -2
- package/dist/js/components/Wizard/types.d.ts.map +1 -1
- package/dist/js/components/Wizard/types.js +1 -0
- package/dist/js/components/Wizard/types.js.map +1 -1
- package/dist/styles/base-no-reset.css +6 -6
- package/dist/styles/base.css +8 -8
- package/dist/umd/assets/{output-CNxOEygf.css → output-InLLAkYl.css} +6890 -6891
- 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/Page/Page.tsx +4 -1
- package/src/components/Page/PageGroup.tsx +5 -0
- package/src/components/Page/PageSection.tsx +1 -1
- package/src/components/Page/__tests__/Page.test.tsx +21 -0
- package/src/components/Page/__tests__/PageGroup.test.tsx +20 -0
- package/src/components/Page/__tests__/PageSection.test.tsx +27 -0
- package/src/components/Page/examples/Page.md +2 -2
- package/src/components/Page/examples/PageWithOrWithoutFill.tsx +4 -5
- package/src/components/Wizard/Wizard.tsx +5 -3
- package/src/components/Wizard/WizardContext.tsx +13 -4
- package/src/components/Wizard/WizardNavItem.tsx +7 -4
- package/src/components/Wizard/WizardStep.tsx +1 -1
- package/src/components/Wizard/WizardToggle.tsx +16 -3
- package/src/components/Wizard/__tests__/WizardNavItem.test.tsx +6 -0
- package/src/components/Wizard/__tests__/WizardStep.test.tsx +2 -0
- package/src/components/Wizard/examples/Wizard.md +2 -2
- package/src/components/Wizard/examples/WizardStepStatus.tsx +82 -0
- package/src/components/Wizard/types.tsx +3 -2
- package/src/components/Wizard/examples/WizardStepErrorStatus.tsx +0 -54
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.86","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.86","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.86","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.87",
|
|
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.31",
|
|
51
|
+
"@patternfly/react-styles": "^6.0.0-alpha.30",
|
|
52
|
+
"@patternfly/react-tokens": "^6.0.0-alpha.30",
|
|
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.190",
|
|
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": "8e897861592c3ee8b186f6aef3958741073312e7"
|
|
68
68
|
}
|
|
@@ -94,6 +94,8 @@ export interface PageProps extends React.HTMLProps<HTMLDivElement> {
|
|
|
94
94
|
groupProps?: PageGroupProps;
|
|
95
95
|
/** Additional props of the breadcrumb */
|
|
96
96
|
breadcrumbProps?: PageBreadcrumbProps;
|
|
97
|
+
/** Enables children to fill the available vertical space. Child page sections or groups that should fill should be passed the isFilled property. */
|
|
98
|
+
isContentFilled?: boolean;
|
|
97
99
|
}
|
|
98
100
|
|
|
99
101
|
export interface PageState {
|
|
@@ -249,6 +251,7 @@ class Page extends React.Component<PageProps, PageState> {
|
|
|
249
251
|
additionalGroupedContent,
|
|
250
252
|
groupProps,
|
|
251
253
|
breadcrumbProps,
|
|
254
|
+
isContentFilled,
|
|
252
255
|
...rest
|
|
253
256
|
} = this.props;
|
|
254
257
|
const { mobileView, mobileIsSidebarOpen, desktopIsSidebarOpen, width, height } = this.state;
|
|
@@ -294,7 +297,7 @@ class Page extends React.Component<PageProps, PageState> {
|
|
|
294
297
|
const Component: keyof JSX.IntrinsicElements = mainComponent;
|
|
295
298
|
|
|
296
299
|
const main = (
|
|
297
|
-
<div className={css(styles.pageMainContainer)}>
|
|
300
|
+
<div className={css(styles.pageMainContainer, isContentFilled && styles.modifiers.fill)}>
|
|
298
301
|
<Component
|
|
299
302
|
ref={this.mainRef}
|
|
300
303
|
role={role}
|
|
@@ -17,6 +17,8 @@ export interface PageGroupProps extends React.HTMLProps<HTMLDivElement> {
|
|
|
17
17
|
xl?: 'top' | 'bottom';
|
|
18
18
|
'2xl'?: 'top' | 'bottom';
|
|
19
19
|
};
|
|
20
|
+
/** Enables the page group to fill the available vertical space if true, or disable filling if false. */
|
|
21
|
+
isFilled?: boolean;
|
|
20
22
|
/** Modifier indicating if PageGroup should have a shadow at the top */
|
|
21
23
|
hasShadowTop?: boolean;
|
|
22
24
|
/** Modifier indicating if PageGroup should have a shadow at the bottom */
|
|
@@ -31,6 +33,7 @@ export const PageGroup = ({
|
|
|
31
33
|
className = '',
|
|
32
34
|
children,
|
|
33
35
|
stickyOnBreakpoint,
|
|
36
|
+
isFilled,
|
|
34
37
|
hasShadowTop = false,
|
|
35
38
|
hasShadowBottom = false,
|
|
36
39
|
hasOverflowScroll = false,
|
|
@@ -52,6 +55,8 @@ export const PageGroup = ({
|
|
|
52
55
|
className={css(
|
|
53
56
|
styles.pageMainGroup,
|
|
54
57
|
formatBreakpointMods(stickyOnBreakpoint, styles, 'sticky-', getVerticalBreakpoint(height), true),
|
|
58
|
+
isFilled === false && styles.modifiers.noFill,
|
|
59
|
+
isFilled === true && styles.modifiers.fill,
|
|
55
60
|
hasShadowTop && styles.modifiers.shadowTop,
|
|
56
61
|
hasShadowBottom && styles.modifiers.shadowBottom,
|
|
57
62
|
hasOverflowScroll && styles.modifiers.overflowScroll,
|
|
@@ -27,7 +27,7 @@ export interface PageSectionProps extends React.HTMLProps<HTMLDivElement> {
|
|
|
27
27
|
variant?: 'default' | 'secondary';
|
|
28
28
|
/** Section type variant */
|
|
29
29
|
type?: 'default' | 'subnav' | 'breadcrumb' | 'tabs' | 'wizard';
|
|
30
|
-
/** Enables the page section to fill the available vertical space */
|
|
30
|
+
/** Enables the page section to fill the available vertical space if true, or disable filling if false. */
|
|
31
31
|
isFilled?: boolean;
|
|
32
32
|
/** Limits the width of the section */
|
|
33
33
|
isWidthLimited?: boolean;
|
|
@@ -13,6 +13,8 @@ import { PageBreadcrumb } from '../PageBreadcrumb';
|
|
|
13
13
|
import { PageGroup } from '../PageGroup';
|
|
14
14
|
import { Masthead } from '../../Masthead';
|
|
15
15
|
|
|
16
|
+
import styles from '@patternfly/react-styles/css/components/Page/page';
|
|
17
|
+
|
|
16
18
|
const props = {
|
|
17
19
|
'aria-label': 'Page layout',
|
|
18
20
|
id: 'PageId',
|
|
@@ -352,4 +354,23 @@ describe('Page', () => {
|
|
|
352
354
|
expect(screen.getByTestId('page-test-id')).toHaveAttribute('id', props.id);
|
|
353
355
|
expect(asFragment()).toMatchSnapshot();
|
|
354
356
|
});
|
|
357
|
+
|
|
358
|
+
test(`Does not render with ${styles.modifiers.fill} or ${styles.modifiers.noFill} if isContentFilled is not passed`, () => {
|
|
359
|
+
render(<Page {...props} role="main"></Page>);
|
|
360
|
+
|
|
361
|
+
expect(screen.getByRole('main').parentElement).not.toHaveClass(styles.modifiers.fill);
|
|
362
|
+
expect(screen.getByRole('main').parentElement).not.toHaveClass(styles.modifiers.noFill);
|
|
363
|
+
});
|
|
364
|
+
|
|
365
|
+
test(`Renders with ${styles.modifiers.fill} if isContentFilled={true} is passed`, () => {
|
|
366
|
+
render(<Page {...props} role="main" isContentFilled={true}></Page>);
|
|
367
|
+
|
|
368
|
+
expect(screen.getByRole('main').parentElement).toHaveClass(styles.modifiers.fill);
|
|
369
|
+
});
|
|
370
|
+
|
|
371
|
+
test(`Does not render with ${styles.modifiers.noFill} if isContentFilled={false} is passed`, () => {
|
|
372
|
+
render(<Page {...props} role="main" isContentFilled={false}></Page>);
|
|
373
|
+
|
|
374
|
+
expect(screen.getByRole('main').parentElement).not.toHaveClass(styles.modifiers.noFill);
|
|
375
|
+
});
|
|
355
376
|
});
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { render, screen } from '@testing-library/react';
|
|
3
3
|
import { PageGroup } from '../PageGroup';
|
|
4
|
+
import styles from '@patternfly/react-styles/css/components/Page/page';
|
|
4
5
|
|
|
5
6
|
describe('page group', () => {
|
|
6
7
|
test('Verify basic render', () => {
|
|
@@ -71,4 +72,23 @@ describe('page group', () => {
|
|
|
71
72
|
|
|
72
73
|
expect(consoleWarning).toHaveBeenCalled();
|
|
73
74
|
});
|
|
75
|
+
|
|
76
|
+
test(`Does not render with ${styles.modifiers.fill} or ${styles.modifiers.noFill} if isFilled is not passed`, () => {
|
|
77
|
+
render(<PageGroup>test</PageGroup>);
|
|
78
|
+
|
|
79
|
+
expect(screen.getByText('test')).not.toHaveClass(styles.modifiers.fill);
|
|
80
|
+
expect(screen.getByText('test')).not.toHaveClass(styles.modifiers.noFill);
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
test(`Renders with ${styles.modifiers.fill} if isFilled={true} is passed`, () => {
|
|
84
|
+
render(<PageGroup isFilled={true}>test</PageGroup>);
|
|
85
|
+
|
|
86
|
+
expect(screen.getByText('test')).toHaveClass(styles.modifiers.fill);
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
test(`Renders with ${styles.modifiers.noFill} if isFilled={false} is passed`, () => {
|
|
90
|
+
render(<PageGroup isFilled={false}>test</PageGroup>);
|
|
91
|
+
|
|
92
|
+
expect(screen.getByText('test')).toHaveClass(styles.modifiers.noFill);
|
|
93
|
+
});
|
|
74
94
|
});
|
|
@@ -153,3 +153,30 @@ test('Does not render with PageBody wrapper when hasBodyWrapper is false', () =>
|
|
|
153
153
|
|
|
154
154
|
expect(screen.getByText('test')).not.toHaveClass(styles.pageMainBody);
|
|
155
155
|
});
|
|
156
|
+
|
|
157
|
+
test(`Does not render with ${styles.modifiers.fill} or ${styles.modifiers.noFill} if isFilled is not passed`, () => {
|
|
158
|
+
render(<PageSection component="main">test</PageSection>);
|
|
159
|
+
|
|
160
|
+
expect(screen.getByRole('main')).not.toHaveClass(styles.modifiers.fill);
|
|
161
|
+
expect(screen.getByRole('main')).not.toHaveClass(styles.modifiers.noFill);
|
|
162
|
+
});
|
|
163
|
+
|
|
164
|
+
test(`Renders with ${styles.modifiers.fill} if isFilled={true} is passed`, () => {
|
|
165
|
+
render(
|
|
166
|
+
<PageSection component="main" isFilled={true}>
|
|
167
|
+
test
|
|
168
|
+
</PageSection>
|
|
169
|
+
);
|
|
170
|
+
|
|
171
|
+
expect(screen.getByRole('main')).toHaveClass(styles.modifiers.fill);
|
|
172
|
+
});
|
|
173
|
+
|
|
174
|
+
test(`Renders with ${styles.modifiers.noFill} if isFilled={false} is passed`, () => {
|
|
175
|
+
render(
|
|
176
|
+
<PageSection component="main" isFilled={false}>
|
|
177
|
+
test
|
|
178
|
+
</PageSection>
|
|
179
|
+
);
|
|
180
|
+
|
|
181
|
+
expect(screen.getByRole('main')).toHaveClass(styles.modifiers.noFill);
|
|
182
|
+
});
|
|
@@ -62,9 +62,9 @@ When the `isManagedSidebar` property is true, it manages the sidebar open/close
|
|
|
62
62
|
|
|
63
63
|
### Filled page sections
|
|
64
64
|
|
|
65
|
-
By default,
|
|
65
|
+
By default, page sections will not expand to fill in the available vertical space in a page.
|
|
66
66
|
|
|
67
|
-
To change
|
|
67
|
+
To change this default behavior, pass `isContentFilled` to the `<Page>` component and `isFilled={true}` to any child `<PageSection>` or `<PageGroup>` component that you want to fill the space. If multiple components are set to fill, then the available space will be split equally between them.
|
|
68
68
|
|
|
69
69
|
```ts file="./PageWithOrWithoutFill.tsx"
|
|
70
70
|
|
|
@@ -60,13 +60,12 @@ export const PageWithOrWithoutFill: React.FunctionComponent = () => {
|
|
|
60
60
|
);
|
|
61
61
|
|
|
62
62
|
return (
|
|
63
|
-
<Page masthead={masthead} sidebar={sidebar}>
|
|
63
|
+
<Page isContentFilled masthead={masthead} sidebar={sidebar}>
|
|
64
64
|
<PageSection>A default page section</PageSection>
|
|
65
|
-
<PageSection isFilled={true}
|
|
66
|
-
|
|
67
|
-
This section is set to not fill the available space, since the last page section is set to fill the available
|
|
68
|
-
space by default.
|
|
65
|
+
<PageSection isFilled={true} variant="secondary">
|
|
66
|
+
This section fills the available space.
|
|
69
67
|
</PageSection>
|
|
68
|
+
<PageSection>A default page section</PageSection>
|
|
70
69
|
</Page>
|
|
71
70
|
);
|
|
72
71
|
};
|
|
@@ -92,10 +92,12 @@ export const Wizard = ({
|
|
|
92
92
|
}
|
|
93
93
|
}, [startIndex]);
|
|
94
94
|
|
|
95
|
-
// When
|
|
95
|
+
// When the number of steps changes and pushes activeStepIndex out of bounds, reset back to startIndex
|
|
96
96
|
React.useEffect(() => {
|
|
97
|
-
|
|
98
|
-
|
|
97
|
+
if (activeStepIndex > initialSteps.length) {
|
|
98
|
+
setActiveStepIndex(startIndex);
|
|
99
|
+
}
|
|
100
|
+
}, [initialSteps, activeStepIndex, startIndex]);
|
|
99
101
|
|
|
100
102
|
const focusMainContentElement = () =>
|
|
101
103
|
setTimeout(() => {
|
|
@@ -74,10 +74,20 @@ export const WizardContextProvider: React.FunctionComponent<WizardContextProvide
|
|
|
74
74
|
const [currentSteps, setCurrentSteps] = React.useState<WizardStepType[]>(initialSteps);
|
|
75
75
|
const [currentFooter, setCurrentFooter] = React.useState<WizardFooterType>();
|
|
76
76
|
|
|
77
|
-
// Callback to update steps if
|
|
77
|
+
// Callback to update steps if the overall step number changes
|
|
78
78
|
React.useEffect(() => {
|
|
79
|
-
|
|
80
|
-
|
|
79
|
+
if (currentSteps.length !== initialSteps.length) {
|
|
80
|
+
const newSteps = initialSteps.map((newStep) => {
|
|
81
|
+
const currentStepMatch = currentSteps.find((step) => step.id === newStep.id);
|
|
82
|
+
// If an existing step has the same id as a new step, carry over props
|
|
83
|
+
if (currentStepMatch) {
|
|
84
|
+
return { ...currentStepMatch, ...newStep };
|
|
85
|
+
}
|
|
86
|
+
return newStep;
|
|
87
|
+
});
|
|
88
|
+
setCurrentSteps(newSteps);
|
|
89
|
+
}
|
|
90
|
+
}, [currentSteps, initialSteps]);
|
|
81
91
|
|
|
82
92
|
// Combined initial and current state steps
|
|
83
93
|
const steps = React.useMemo(
|
|
@@ -130,7 +140,6 @@ export const WizardContextProvider: React.FunctionComponent<WizardContextProvide
|
|
|
130
140
|
if (prevStep.id === step.id) {
|
|
131
141
|
return { ...prevStep, ...step };
|
|
132
142
|
}
|
|
133
|
-
|
|
134
143
|
return prevStep;
|
|
135
144
|
})
|
|
136
145
|
),
|
|
@@ -4,6 +4,7 @@ import { css } from '@patternfly/react-styles';
|
|
|
4
4
|
import styles from '@patternfly/react-styles/css/components/Wizard/wizard';
|
|
5
5
|
import AngleRightIcon from '@patternfly/react-icons/dist/esm/icons/angle-right-icon';
|
|
6
6
|
import ExclamationCircleIcon from '@patternfly/react-icons/dist/esm/icons/exclamation-circle-icon';
|
|
7
|
+
import CheckCircleIcon from '@patternfly/react-icons/dist/esm/icons/check-circle-icon';
|
|
7
8
|
|
|
8
9
|
import { OUIAProps, useOUIAProps } from '../../helpers';
|
|
9
10
|
import { WizardNavItemStatus } from './types';
|
|
@@ -38,7 +39,7 @@ export interface WizardNavItemProps
|
|
|
38
39
|
/** The id for the navigation item */
|
|
39
40
|
id?: string | number;
|
|
40
41
|
/** Used to determine the icon displayed next to content. Default has no icon. */
|
|
41
|
-
status?: 'default' | 'error';
|
|
42
|
+
status?: 'default' | 'error' | 'success';
|
|
42
43
|
}
|
|
43
44
|
|
|
44
45
|
export const WizardNavItem = ({
|
|
@@ -96,18 +97,20 @@ export const WizardNavItem = ({
|
|
|
96
97
|
styles.wizardNavLink,
|
|
97
98
|
isCurrent && styles.modifiers.current,
|
|
98
99
|
isDisabled && styles.modifiers.disabled,
|
|
99
|
-
status === WizardNavItemStatus.Error && styles.modifiers.danger
|
|
100
|
+
status === WizardNavItemStatus.Error && styles.modifiers.danger,
|
|
101
|
+
status === WizardNavItemStatus.Success && styles.modifiers.success
|
|
100
102
|
)}
|
|
101
103
|
aria-disabled={isDisabled ? true : null}
|
|
102
104
|
aria-current={isCurrent && !children ? 'step' : false}
|
|
103
105
|
{...(isExpandable && { 'aria-expanded': isExpanded })}
|
|
104
106
|
{...ouiaProps}
|
|
105
107
|
>
|
|
106
|
-
{status
|
|
108
|
+
{status !== WizardNavItemStatus.Default && (
|
|
107
109
|
<>
|
|
108
110
|
<span className="pf-v6-screen-reader">, {status}</span>
|
|
109
111
|
<span className={css(styles.wizardNavLinkStatusIcon)}>
|
|
110
|
-
<ExclamationCircleIcon />
|
|
112
|
+
{status === WizardNavItemStatus.Error && <ExclamationCircleIcon />}
|
|
113
|
+
{status === WizardNavItemStatus.Success && <CheckCircleIcon />}
|
|
111
114
|
</span>
|
|
112
115
|
</>
|
|
113
116
|
)}
|
|
@@ -29,7 +29,7 @@ export interface WizardStepProps {
|
|
|
29
29
|
/** Replaces the step's footer. The step's footer takes precedance over the wizard's footer. */
|
|
30
30
|
footer?: React.ReactElement | Partial<WizardFooterProps>;
|
|
31
31
|
/** Used to determine icon next to the step's navigation item */
|
|
32
|
-
status?: 'default' | 'error';
|
|
32
|
+
status?: 'default' | 'error' | 'success';
|
|
33
33
|
/** Flag to determine whether parent steps can expand or not. Defaults to false. */
|
|
34
34
|
isExpandable?: boolean;
|
|
35
35
|
}
|
|
@@ -5,6 +5,7 @@ import styles from '@patternfly/react-styles/css/components/Wizard/wizard';
|
|
|
5
5
|
import AngleRightIcon from '@patternfly/react-icons/dist/esm/icons/angle-right-icon';
|
|
6
6
|
import CaretDownIcon from '@patternfly/react-icons/dist/esm/icons/caret-down-icon';
|
|
7
7
|
import ExclamationCircleIcon from '@patternfly/react-icons/dist/esm/icons/exclamation-circle-icon';
|
|
8
|
+
import CheckCircleIcon from '@patternfly/react-icons/dist/esm/icons/check-circle-icon';
|
|
8
9
|
|
|
9
10
|
import { KeyTypes } from '../../helpers/constants';
|
|
10
11
|
import { WizardStepType, isWizardSubStep } from './types';
|
|
@@ -91,12 +92,24 @@ export const WizardToggle = ({
|
|
|
91
92
|
aria-expanded={isNavExpanded}
|
|
92
93
|
>
|
|
93
94
|
<span className={css(styles.wizardToggleList)}>
|
|
94
|
-
<span
|
|
95
|
-
{
|
|
95
|
+
<span
|
|
96
|
+
className={css(
|
|
97
|
+
styles.wizardToggleListItem,
|
|
98
|
+
isActiveStepStatus === 'error' && styles.modifiers.danger,
|
|
99
|
+
isActiveStepStatus === 'success' && styles.modifiers.success
|
|
100
|
+
)}
|
|
101
|
+
>
|
|
102
|
+
{isActiveStepStatus === 'error' && (
|
|
96
103
|
<span className={css(styles.wizardToggleStatusIcon)}>
|
|
97
104
|
<ExclamationCircleIcon />
|
|
98
105
|
</span>
|
|
99
|
-
)
|
|
106
|
+
)}
|
|
107
|
+
{isActiveStepStatus === 'success' && (
|
|
108
|
+
<span className={css(styles.wizardToggleStatusIcon)}>
|
|
109
|
+
<CheckCircleIcon />
|
|
110
|
+
</span>
|
|
111
|
+
)}
|
|
112
|
+
{isActiveStepStatus !== 'success' && isActiveStepStatus !== 'error' && (
|
|
100
113
|
<span className={css(styles.wizardToggleNum)}>{wizardToggleIndex}</span>
|
|
101
114
|
)}{' '}
|
|
102
115
|
{parentStep?.name || activeStep?.name}
|
|
@@ -59,3 +59,9 @@ test(`Renders screen reader text and danger icon when status is error`, () => {
|
|
|
59
59
|
expect(screen.getByRole('button')).toHaveClass(styles.modifiers.danger);
|
|
60
60
|
expect(screen.getByText(', error')).toBeInTheDocument();
|
|
61
61
|
});
|
|
62
|
+
|
|
63
|
+
test(`Renders screen reader text and success icon when status is success`, () => {
|
|
64
|
+
render(<WizardNavItem status="success" />);
|
|
65
|
+
expect(screen.getByRole('button')).toHaveClass(styles.modifiers.success);
|
|
66
|
+
expect(screen.getByText(', success')).toBeInTheDocument();
|
|
67
|
+
});
|
|
@@ -70,4 +70,6 @@ test('updates "navItem" in context when the value changes', () => {
|
|
|
70
70
|
test('updates "status" in context when the value changes', () => {
|
|
71
71
|
render(<WizardStep {...testStep} status="error" />);
|
|
72
72
|
expect(setStep).toHaveBeenCalledWith({ ...testStepProps, status: 'error', isVisited: true });
|
|
73
|
+
render(<WizardStep {...testStep} status="success" />);
|
|
74
|
+
expect(setStep).toHaveBeenCalledWith({ ...testStepProps, status: 'success', isVisited: true });
|
|
73
75
|
});
|
|
@@ -165,9 +165,9 @@ To focus the main content element of the `Wizard`, pass in the `shouldFocusConte
|
|
|
165
165
|
|
|
166
166
|
```
|
|
167
167
|
|
|
168
|
-
### Step
|
|
168
|
+
### Step status
|
|
169
169
|
|
|
170
|
-
```ts file="./
|
|
170
|
+
```ts file="./WizardStepStatus.tsx"
|
|
171
171
|
|
|
172
172
|
```
|
|
173
173
|
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import { Radio, Wizard, WizardStep } from '@patternfly/react-core';
|
|
4
|
+
|
|
5
|
+
interface SomeContextProps {
|
|
6
|
+
errorMessage: string | undefined;
|
|
7
|
+
setErrorMessage(error: string | undefined): void;
|
|
8
|
+
successMessage: string | undefined;
|
|
9
|
+
setSuccessMessage(error: string | undefined): void;
|
|
10
|
+
}
|
|
11
|
+
type SomeContextRenderProps = Pick<SomeContextProps, 'successMessage', 'errorMessage'>;
|
|
12
|
+
interface SomeContextProviderProps {
|
|
13
|
+
children: (context: SomeContextRenderProps) => React.ReactElement;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const SomeContext: React.Context<SomeContextProps> = React.createContext({} as SomeContextProps);
|
|
17
|
+
|
|
18
|
+
const SomeContextProvider = ({ children }: SomeContextProviderProps) => {
|
|
19
|
+
const [errorMessage, setErrorMessage] = React.useState<string>();
|
|
20
|
+
const [successMessage, setSuccessMessage] = React.useState<string>();
|
|
21
|
+
|
|
22
|
+
return (
|
|
23
|
+
<SomeContext.Provider value={{ errorMessage, setErrorMessage, successMessage, setSuccessMessage }}>
|
|
24
|
+
{children({ errorMessage, successMessage })}
|
|
25
|
+
</SomeContext.Provider>
|
|
26
|
+
);
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
const StepContentWithAction = () => {
|
|
30
|
+
const { errorMessage, setErrorMessage, successMessage, setSuccessMessage } = React.useContext(SomeContext);
|
|
31
|
+
|
|
32
|
+
return (
|
|
33
|
+
<>
|
|
34
|
+
<Radio
|
|
35
|
+
label="Give step 1 an error status"
|
|
36
|
+
isChecked={!!errorMessage}
|
|
37
|
+
onChange={(_event, checked) => {
|
|
38
|
+
setErrorMessage(checked ? 'Some error message' : undefined);
|
|
39
|
+
setSuccessMessage(!checked ? 'Some error message' : undefined);
|
|
40
|
+
}}
|
|
41
|
+
id="toggle-error-checkbox"
|
|
42
|
+
name="Toggle Status"
|
|
43
|
+
/>
|
|
44
|
+
<Radio
|
|
45
|
+
label="Give step 1 a success status"
|
|
46
|
+
isChecked={!!successMessage}
|
|
47
|
+
onChange={(_event, checked) => {
|
|
48
|
+
setSuccessMessage(checked ? 'Some success message' : undefined);
|
|
49
|
+
setErrorMessage(!checked ? 'Some success message' : undefined);
|
|
50
|
+
}}
|
|
51
|
+
id="toggle-success-checkbox"
|
|
52
|
+
name="Toggle Status"
|
|
53
|
+
/>
|
|
54
|
+
</>
|
|
55
|
+
);
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
export const WizardStepStatus: React.FunctionComponent = () => (
|
|
59
|
+
<SomeContextProvider>
|
|
60
|
+
{({ errorMessage, successMessage }) => {
|
|
61
|
+
let status = 'default';
|
|
62
|
+
if (errorMessage) {
|
|
63
|
+
status = 'error';
|
|
64
|
+
} else if (successMessage) {
|
|
65
|
+
status = 'success';
|
|
66
|
+
}
|
|
67
|
+
return (
|
|
68
|
+
<Wizard height={400} title="Step status wizard">
|
|
69
|
+
<WizardStep status={status} id="status-step-1" name="Step 1">
|
|
70
|
+
Step 1 content
|
|
71
|
+
</WizardStep>
|
|
72
|
+
<WizardStep name="Status step" id="error-status-step-2">
|
|
73
|
+
<StepContentWithAction />
|
|
74
|
+
</WizardStep>
|
|
75
|
+
<WizardStep name="Review" id="status-review-step" footer={{ nextButtonText: 'Finish' }}>
|
|
76
|
+
Review step content
|
|
77
|
+
</WizardStep>
|
|
78
|
+
</Wizard>
|
|
79
|
+
);
|
|
80
|
+
}}
|
|
81
|
+
</SomeContextProvider>
|
|
82
|
+
);
|
|
@@ -23,12 +23,13 @@ export interface WizardBasicStep {
|
|
|
23
23
|
/** Replaces the step's footer. The step's footer takes precedance over the wizard's footer. */
|
|
24
24
|
footer?: React.ReactElement | Partial<WizardFooterProps>;
|
|
25
25
|
/** Used to determine icon next to the step's navItem */
|
|
26
|
-
status?: 'default' | 'error';
|
|
26
|
+
status?: 'default' | 'error' | 'success';
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
export enum WizardNavItemStatus {
|
|
30
30
|
Default = 'default',
|
|
31
|
-
Error = 'error'
|
|
31
|
+
Error = 'error',
|
|
32
|
+
Success = 'success'
|
|
32
33
|
}
|
|
33
34
|
|
|
34
35
|
/** Type for customizing a button (next, back or cancel) in a Wizard footer. It omits some props which either have a default value or are passed directly via WizardFooterProps. */
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
|
|
3
|
-
import { Checkbox, Wizard, WizardStep } from '@patternfly/react-core';
|
|
4
|
-
|
|
5
|
-
interface SomeContextProps {
|
|
6
|
-
errorMessage: string | undefined;
|
|
7
|
-
setErrorMessage(error: string | undefined): void;
|
|
8
|
-
}
|
|
9
|
-
type SomeContextRenderProps = Pick<SomeContextProps, 'errorMessage'>;
|
|
10
|
-
interface SomeContextProviderProps {
|
|
11
|
-
children: (context: SomeContextRenderProps) => React.ReactElement;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
const SomeContext: React.Context<SomeContextProps> = React.createContext({} as SomeContextProps);
|
|
15
|
-
|
|
16
|
-
const SomeContextProvider = ({ children }: SomeContextProviderProps) => {
|
|
17
|
-
const [errorMessage, setErrorMessage] = React.useState<string>();
|
|
18
|
-
|
|
19
|
-
return (
|
|
20
|
-
<SomeContext.Provider value={{ errorMessage, setErrorMessage }}>{children({ errorMessage })}</SomeContext.Provider>
|
|
21
|
-
);
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
const StepContentWithAction = () => {
|
|
25
|
-
const { errorMessage, setErrorMessage } = React.useContext(SomeContext);
|
|
26
|
-
|
|
27
|
-
return (
|
|
28
|
-
<Checkbox
|
|
29
|
-
label="Give step 1 an error status"
|
|
30
|
-
isChecked={!!errorMessage}
|
|
31
|
-
onChange={(_event, checked) => setErrorMessage(checked ? 'Some error message' : undefined)}
|
|
32
|
-
id="toggle-error-checkbox"
|
|
33
|
-
name="Toggle Error Checkbox"
|
|
34
|
-
/>
|
|
35
|
-
);
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
export const WizardStepErrorStatus: React.FunctionComponent = () => (
|
|
39
|
-
<SomeContextProvider>
|
|
40
|
-
{({ errorMessage }) => (
|
|
41
|
-
<Wizard height={400} title="Step error status wizard">
|
|
42
|
-
<WizardStep status={errorMessage ? 'error' : 'default'} id="error-status-step-1" name="Step 1">
|
|
43
|
-
Step 1 content
|
|
44
|
-
</WizardStep>
|
|
45
|
-
<WizardStep name="Error action step" id="error-status-step-2">
|
|
46
|
-
<StepContentWithAction />
|
|
47
|
-
</WizardStep>
|
|
48
|
-
<WizardStep name="Review" id="error-status-review-step" footer={{ nextButtonText: 'Finish' }}>
|
|
49
|
-
Review step content
|
|
50
|
-
</WizardStep>
|
|
51
|
-
</Wizard>
|
|
52
|
-
)}
|
|
53
|
-
</SomeContextProvider>
|
|
54
|
-
);
|