@patternfly/react-core 4.223.3 → 4.224.0
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 +11 -0
- package/dist/esm/components/Wizard/Wizard.d.ts +9 -0
- package/dist/esm/components/Wizard/Wizard.d.ts.map +1 -1
- package/dist/esm/components/Wizard/Wizard.js +6 -3
- package/dist/esm/components/Wizard/Wizard.js.map +1 -1
- package/dist/esm/components/Wizard/WizardBody.d.ts +6 -0
- package/dist/esm/components/Wizard/WizardBody.d.ts.map +1 -1
- package/dist/esm/components/Wizard/WizardBody.js +6 -2
- package/dist/esm/components/Wizard/WizardBody.js.map +1 -1
- package/dist/esm/components/Wizard/WizardDrawerWrapper.d.ts +11 -0
- package/dist/esm/components/Wizard/WizardDrawerWrapper.d.ts.map +1 -0
- package/dist/esm/components/Wizard/WizardDrawerWrapper.js +3 -0
- package/dist/esm/components/Wizard/WizardDrawerWrapper.js.map +1 -0
- package/dist/esm/components/Wizard/WizardToggle.d.ts +5 -1
- package/dist/esm/components/Wizard/WizardToggle.d.ts.map +1 -1
- package/dist/esm/components/Wizard/WizardToggle.js +4 -2
- package/dist/esm/components/Wizard/WizardToggle.js.map +1 -1
- package/dist/js/components/Wizard/Wizard.d.ts +9 -0
- package/dist/js/components/Wizard/Wizard.d.ts.map +1 -1
- package/dist/js/components/Wizard/Wizard.js +6 -3
- package/dist/js/components/Wizard/Wizard.js.map +1 -1
- package/dist/js/components/Wizard/WizardBody.d.ts +6 -0
- package/dist/js/components/Wizard/WizardBody.d.ts.map +1 -1
- package/dist/js/components/Wizard/WizardBody.js +6 -2
- package/dist/js/components/Wizard/WizardBody.js.map +1 -1
- package/dist/js/components/Wizard/WizardDrawerWrapper.d.ts +11 -0
- package/dist/js/components/Wizard/WizardDrawerWrapper.d.ts.map +1 -0
- package/dist/js/components/Wizard/WizardDrawerWrapper.js +7 -0
- package/dist/js/components/Wizard/WizardDrawerWrapper.js.map +1 -0
- package/dist/js/components/Wizard/WizardToggle.d.ts +5 -1
- package/dist/js/components/Wizard/WizardToggle.d.ts.map +1 -1
- package/dist/js/components/Wizard/WizardToggle.js +4 -2
- package/dist/js/components/Wizard/WizardToggle.js.map +1 -1
- package/dist/umd/react-core.js +17 -7
- package/dist/umd/react-core.min.js +4 -4
- package/package.json +5 -5
- package/src/components/Wizard/Wizard.tsx +21 -1
- package/src/components/Wizard/WizardBody.tsx +23 -2
- package/src/components/Wizard/WizardDrawerWrapper.tsx +18 -0
- package/src/components/Wizard/WizardToggle.tsx +12 -2
- package/src/components/Wizard/__tests__/Wizard.test.tsx +24 -7
- package/src/components/Wizard/examples/Wizard.md +157 -2
- package/src/demos/Wizard/WizardDemo.md +1033 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@patternfly/react-core",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.224.0",
|
|
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",
|
|
@@ -34,9 +34,9 @@
|
|
|
34
34
|
"generate": "node scripts/copyStyles.js"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@patternfly/react-icons": "^4.
|
|
38
|
-
"@patternfly/react-styles": "^4.
|
|
39
|
-
"@patternfly/react-tokens": "^4.
|
|
37
|
+
"@patternfly/react-icons": "^4.75.0",
|
|
38
|
+
"@patternfly/react-styles": "^4.74.0",
|
|
39
|
+
"@patternfly/react-tokens": "^4.76.0",
|
|
40
40
|
"focus-trap": "6.9.2",
|
|
41
41
|
"react-dropzone": "9.0.0",
|
|
42
42
|
"tippy.js": "5.1.2",
|
|
@@ -60,5 +60,5 @@
|
|
|
60
60
|
"react": "^16.8.0 || ^17.0.0",
|
|
61
61
|
"react-dom": "^16.8.0 || ^17.0.0"
|
|
62
62
|
},
|
|
63
|
-
"gitHead": "
|
|
63
|
+
"gitHead": "778a51b5e590921dd5aa36cefa47b1c3acbcf162"
|
|
64
64
|
}
|
|
@@ -18,6 +18,10 @@ export interface WizardStep {
|
|
|
18
18
|
name: React.ReactNode;
|
|
19
19
|
/** The component to render in the main body */
|
|
20
20
|
component?: any;
|
|
21
|
+
/** @beta The content to render in the drawer panel (use when hasDrawer prop is set on the wizard). */
|
|
22
|
+
drawerPanelContent?: any;
|
|
23
|
+
/** @beta Custom drawer toggle button that opens the drawer. */
|
|
24
|
+
drawerToggleButton?: React.ReactNode;
|
|
21
25
|
/** Setting to true hides the side nav and footer */
|
|
22
26
|
isFinishedStep?: boolean;
|
|
23
27
|
/** Enables or disables the step in the navigation. Enabled by default. */
|
|
@@ -100,6 +104,10 @@ export interface WizardProps extends React.HTMLProps<HTMLDivElement> {
|
|
|
100
104
|
isOpen?: boolean;
|
|
101
105
|
/** Flag indicating nav items with sub steps are expandable */
|
|
102
106
|
isNavExpandable?: boolean;
|
|
107
|
+
/** @beta Flag indicating the wizard has a drawer for at least one of the wizard steps */
|
|
108
|
+
hasDrawer?: boolean;
|
|
109
|
+
/** @beta Flag indicating the wizard drawer is expanded */
|
|
110
|
+
isDrawerExpanded?: boolean;
|
|
103
111
|
}
|
|
104
112
|
|
|
105
113
|
interface WizardState {
|
|
@@ -135,10 +143,13 @@ export class Wizard extends React.Component<WizardProps, WizardState> {
|
|
|
135
143
|
onClose: () => undefined as any,
|
|
136
144
|
appendTo: null as HTMLElement,
|
|
137
145
|
isOpen: undefined,
|
|
138
|
-
isNavExpandable: false
|
|
146
|
+
isNavExpandable: false,
|
|
147
|
+
hasDrawer: false,
|
|
148
|
+
isDrawerExpanded: false
|
|
139
149
|
};
|
|
140
150
|
private titleId: string;
|
|
141
151
|
private descriptionId: string;
|
|
152
|
+
private drawerRef: React.RefObject<any>;
|
|
142
153
|
|
|
143
154
|
constructor(props: WizardProps) {
|
|
144
155
|
super(props);
|
|
@@ -150,6 +161,8 @@ export class Wizard extends React.Component<WizardProps, WizardState> {
|
|
|
150
161
|
currentStep: this.props.startAtStep && Number.isInteger(this.props.startAtStep) ? this.props.startAtStep : 1,
|
|
151
162
|
isNavOpen: false
|
|
152
163
|
};
|
|
164
|
+
|
|
165
|
+
this.drawerRef = React.createRef();
|
|
153
166
|
}
|
|
154
167
|
|
|
155
168
|
private handleKeyClicks = (event: KeyboardEvent): void => {
|
|
@@ -340,6 +353,8 @@ export class Wizard extends React.Component<WizardProps, WizardState> {
|
|
|
340
353
|
titleId,
|
|
341
354
|
descriptionId,
|
|
342
355
|
isNavExpandable,
|
|
356
|
+
hasDrawer,
|
|
357
|
+
isDrawerExpanded,
|
|
343
358
|
...rest
|
|
344
359
|
/* eslint-enable @typescript-eslint/no-unused-vars */
|
|
345
360
|
} = this.props;
|
|
@@ -350,12 +365,14 @@ export class Wizard extends React.Component<WizardProps, WizardState> {
|
|
|
350
365
|
const computedSteps: WizardStep[] = this.initSteps(steps);
|
|
351
366
|
const firstStep = activeStep === flattenedSteps[0];
|
|
352
367
|
const isValid = activeStep && activeStep.enableNext !== undefined ? activeStep.enableNext : true;
|
|
368
|
+
|
|
353
369
|
const nav = (isWizardNavOpen: boolean) => {
|
|
354
370
|
const wizNavAProps = {
|
|
355
371
|
isOpen: isWizardNavOpen,
|
|
356
372
|
'aria-label': navAriaLabel,
|
|
357
373
|
'aria-labelledby': (title || navAriaLabelledBy) && (navAriaLabelledBy || this.titleId)
|
|
358
374
|
};
|
|
375
|
+
|
|
359
376
|
return (
|
|
360
377
|
<WizardNav {...wizNavAProps}>
|
|
361
378
|
{computedSteps.map((step, index) => {
|
|
@@ -466,6 +483,8 @@ export class Wizard extends React.Component<WizardProps, WizardState> {
|
|
|
466
483
|
/>
|
|
467
484
|
)}
|
|
468
485
|
<WizardToggle
|
|
486
|
+
hasDrawer={hasDrawer}
|
|
487
|
+
isDrawerExpanded={isDrawerExpanded}
|
|
469
488
|
mainAriaLabel={mainAriaLabel}
|
|
470
489
|
isInPage={isOpen === undefined}
|
|
471
490
|
mainAriaLabelledBy={(title || mainAriaLabelledBy) && (mainAriaLabelledBy || this.titleId)}
|
|
@@ -509,6 +528,7 @@ export class Wizard extends React.Component<WizardProps, WizardState> {
|
|
|
509
528
|
</Modal>
|
|
510
529
|
);
|
|
511
530
|
}
|
|
531
|
+
|
|
512
532
|
return wizard;
|
|
513
533
|
}
|
|
514
534
|
}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import styles from '@patternfly/react-styles/css/components/Wizard/wizard';
|
|
3
3
|
import { css } from '@patternfly/react-styles';
|
|
4
|
+
import { WizardDrawerWrapper } from './WizardDrawerWrapper';
|
|
5
|
+
import { Drawer, DrawerContent } from '../Drawer';
|
|
6
|
+
import { WizardStep } from './Wizard';
|
|
4
7
|
|
|
5
8
|
export interface WizardBodyProps {
|
|
6
9
|
/** Anything that can be rendered in the Wizard body */
|
|
@@ -13,6 +16,12 @@ export interface WizardBodyProps {
|
|
|
13
16
|
'aria-labelledby': string;
|
|
14
17
|
/** Component used as the primary content container */
|
|
15
18
|
mainComponent?: React.ElementType;
|
|
19
|
+
/** The currently active WizardStep */
|
|
20
|
+
activeStep: WizardStep;
|
|
21
|
+
hasDrawer?: boolean;
|
|
22
|
+
/** Flag indicating the wizard drawer is expanded */
|
|
23
|
+
isDrawerExpanded?: boolean;
|
|
24
|
+
/** Callback function for when the drawer is toggled */
|
|
16
25
|
}
|
|
17
26
|
|
|
18
27
|
export const WizardBody: React.FunctionComponent<WizardBodyProps> = ({
|
|
@@ -20,12 +29,24 @@ export const WizardBody: React.FunctionComponent<WizardBodyProps> = ({
|
|
|
20
29
|
hasNoBodyPadding = false,
|
|
21
30
|
'aria-label': ariaLabel,
|
|
22
31
|
'aria-labelledby': ariaLabelledBy,
|
|
23
|
-
mainComponent = 'div'
|
|
32
|
+
mainComponent = 'div',
|
|
33
|
+
hasDrawer,
|
|
34
|
+
isDrawerExpanded,
|
|
35
|
+
activeStep
|
|
24
36
|
}: WizardBodyProps) => {
|
|
25
37
|
const MainComponent = mainComponent;
|
|
26
38
|
return (
|
|
27
39
|
<MainComponent aria-label={ariaLabel} aria-labelledby={ariaLabelledBy} className={css(styles.wizardMain)}>
|
|
28
|
-
<
|
|
40
|
+
<WizardDrawerWrapper
|
|
41
|
+
hasDrawer={hasDrawer && activeStep.drawerPanelContent}
|
|
42
|
+
wrapper={(children: React.ReactNode) => (
|
|
43
|
+
<Drawer isInline isExpanded={isDrawerExpanded}>
|
|
44
|
+
<DrawerContent panelContent={activeStep.drawerPanelContent}>{children}</DrawerContent>
|
|
45
|
+
</Drawer>
|
|
46
|
+
)}
|
|
47
|
+
>
|
|
48
|
+
<div className={css(styles.wizardMainBody, hasNoBodyPadding && styles.modifiers.noPadding)}>{children}</div>
|
|
49
|
+
</WizardDrawerWrapper>
|
|
29
50
|
</MainComponent>
|
|
30
51
|
);
|
|
31
52
|
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
export interface WizardDrawerWrapperProps {
|
|
4
|
+
/** The wizard content */
|
|
5
|
+
children: React.ReactElement;
|
|
6
|
+
/** Flag indicating the wizard has a drawer for at least one of the wizard steps */
|
|
7
|
+
hasDrawer: boolean;
|
|
8
|
+
/** The drawer component which wraps the wizard content */
|
|
9
|
+
wrapper: (children: React.ReactElement) => JSX.Element;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export const WizardDrawerWrapper: React.FunctionComponent<WizardDrawerWrapperProps> = ({
|
|
13
|
+
hasDrawer,
|
|
14
|
+
wrapper,
|
|
15
|
+
children
|
|
16
|
+
}) => (hasDrawer ? wrapper(children) : children);
|
|
17
|
+
|
|
18
|
+
WizardDrawerWrapper.displayName = 'WizardDrawerWrapper';
|
|
@@ -14,7 +14,7 @@ export interface WizardToggleProps {
|
|
|
14
14
|
/** The currently active WizardStep */
|
|
15
15
|
activeStep: WizardStep;
|
|
16
16
|
/** The WizardFooter */
|
|
17
|
-
children
|
|
17
|
+
children?: React.ReactNode;
|
|
18
18
|
/** Set to true to remove body padding */
|
|
19
19
|
hasNoBodyPadding: boolean;
|
|
20
20
|
/** If the nav is open */
|
|
@@ -29,6 +29,10 @@ export interface WizardToggleProps {
|
|
|
29
29
|
mainAriaLabel?: string;
|
|
30
30
|
/** If the wizard is in-page */
|
|
31
31
|
isInPage?: boolean;
|
|
32
|
+
/** @beta Flag indicating the wizard has a drawer for at least one of the wizard steps */
|
|
33
|
+
hasDrawer?: boolean;
|
|
34
|
+
/** @beta Flag indicating the wizard drawer is expanded */
|
|
35
|
+
isDrawerExpanded?: boolean;
|
|
32
36
|
}
|
|
33
37
|
|
|
34
38
|
export const WizardToggle: React.FunctionComponent<WizardToggleProps> = ({
|
|
@@ -42,7 +46,9 @@ export const WizardToggle: React.FunctionComponent<WizardToggleProps> = ({
|
|
|
42
46
|
'aria-label': ariaLabel = 'Wizard Toggle',
|
|
43
47
|
mainAriaLabelledBy = null,
|
|
44
48
|
mainAriaLabel = null,
|
|
45
|
-
isInPage = true
|
|
49
|
+
isInPage = true,
|
|
50
|
+
hasDrawer,
|
|
51
|
+
isDrawerExpanded
|
|
46
52
|
}: WizardToggleProps) => {
|
|
47
53
|
let activeStepIndex;
|
|
48
54
|
let activeStepName;
|
|
@@ -91,7 +97,11 @@ export const WizardToggle: React.FunctionComponent<WizardToggleProps> = ({
|
|
|
91
97
|
aria-label={mainAriaLabel}
|
|
92
98
|
aria-labelledby={mainAriaLabelledBy}
|
|
93
99
|
hasNoBodyPadding={hasNoBodyPadding}
|
|
100
|
+
activeStep={activeStep}
|
|
101
|
+
isDrawerExpanded={isDrawerExpanded}
|
|
102
|
+
hasDrawer={hasDrawer}
|
|
94
103
|
>
|
|
104
|
+
{hasDrawer && !isDrawerExpanded && activeStep.drawerToggleButton}
|
|
95
105
|
{activeStep.component}
|
|
96
106
|
</WizardBody>
|
|
97
107
|
</div>
|
|
@@ -1,31 +1,32 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { render, screen } from '@testing-library/react';
|
|
3
3
|
import { Wizard, WizardStepFunctionType, WizardStep } from '../Wizard';
|
|
4
|
+
import { DrawerPanelContent, DrawerColorVariant, DrawerHead } from '../../Drawer';
|
|
4
5
|
|
|
5
6
|
describe('Wizard', () => {
|
|
6
7
|
test('Wizard should match snapshot', () => {
|
|
7
8
|
const steps: WizardStep[] = [
|
|
8
|
-
{ name: 'A', id:
|
|
9
|
+
{ name: 'A', id: 'step-A', component: <p>Step 1</p> },
|
|
9
10
|
{
|
|
10
11
|
name: 'B',
|
|
11
|
-
id:
|
|
12
|
+
id: 'step-B',
|
|
12
13
|
steps: [
|
|
13
14
|
{
|
|
14
15
|
name: 'B-1',
|
|
15
|
-
id:
|
|
16
|
+
id: 'step-B-1',
|
|
16
17
|
component: <p>Step 2</p>,
|
|
17
18
|
enableNext: true
|
|
18
19
|
},
|
|
19
20
|
{
|
|
20
21
|
name: 'B-2',
|
|
21
|
-
id:
|
|
22
|
+
id: 'step-B-2',
|
|
22
23
|
component: <p>Step 3</p>,
|
|
23
24
|
enableNext: false
|
|
24
25
|
}
|
|
25
26
|
]
|
|
26
27
|
},
|
|
27
|
-
{ name: 'C', id:
|
|
28
|
-
{ name: 'D', id:
|
|
28
|
+
{ name: 'C', id: 'step-C', component: <p>Step 4</p> },
|
|
29
|
+
{ name: 'D', id: 'step-D', component: <p>Step 5</p> }
|
|
29
30
|
];
|
|
30
31
|
const onBack: WizardStepFunctionType = step => {
|
|
31
32
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
@@ -100,6 +101,22 @@ describe('Wizard', () => {
|
|
|
100
101
|
expect(screen.getByRole('heading', { name: 'Wizard' })).toBeInTheDocument();
|
|
101
102
|
});
|
|
102
103
|
|
|
104
|
+
test('wiz with drawer', () => {
|
|
105
|
+
const wizDrawerPanelContent = (
|
|
106
|
+
<DrawerPanelContent colorVariant={DrawerColorVariant.light200}>
|
|
107
|
+
<DrawerHead>
|
|
108
|
+
<span>This wizard has a drawer with drawer panel content</span>
|
|
109
|
+
</DrawerHead>
|
|
110
|
+
</DrawerPanelContent>
|
|
111
|
+
);
|
|
112
|
+
|
|
113
|
+
const steps: WizardStep[] = [{ name: 'A', component: <p>Step 1</p>, drawerPanelContent: wizDrawerPanelContent }];
|
|
114
|
+
|
|
115
|
+
render(<Wizard title="Wizard with drawer" hasDrawer isDrawerExpanded steps={steps} />);
|
|
116
|
+
expect(screen.getByRole('heading', { name: 'Wizard with drawer' })).toBeInTheDocument();
|
|
117
|
+
expect(screen.getByText('This wizard has a drawer with drawer panel content')).toBeInTheDocument();
|
|
118
|
+
});
|
|
119
|
+
|
|
103
120
|
test('wiz with title and navAriaLabel combination', () => {
|
|
104
121
|
const steps: WizardStep[] = [{ name: 'A', component: <p>Step 1</p> }];
|
|
105
122
|
|
|
@@ -109,7 +126,7 @@ describe('Wizard', () => {
|
|
|
109
126
|
|
|
110
127
|
expect(screen.getByRole('heading', { name: 'Wizard' })).toBeInTheDocument();
|
|
111
128
|
expect(nav).toBeInTheDocument();
|
|
112
|
-
expect(nav).toHaveAttribute('aria-labelledby', 'pf-wizard-title-
|
|
129
|
+
expect(nav).toHaveAttribute('aria-labelledby', 'pf-wizard-title-5');
|
|
113
130
|
});
|
|
114
131
|
|
|
115
132
|
test('wiz with title, navAriaLabel, and mainAriaLabel combination', () => {
|
|
@@ -2,10 +2,12 @@
|
|
|
2
2
|
id: Wizard
|
|
3
3
|
section: components
|
|
4
4
|
cssPrefix: pf-c-wizard
|
|
5
|
-
propComponents:
|
|
5
|
+
propComponents:
|
|
6
|
+
['Wizard', 'WizardNav', 'WizardNavItem', 'WizardHeader', 'WizardBody', 'WizardFooter', 'WizardToggle', 'WizardStep']
|
|
6
7
|
---
|
|
7
8
|
|
|
8
|
-
import { Button,
|
|
9
|
+
import { Button, Drawer, DrawerActions, DrawerCloseButton, DrawerColorVariant,
|
|
10
|
+
DrawerContent, DrawerContentBody, DrawerHead, DrawerPanelContent, DrawerSection, Wizard, WizardFooter, WizardContextConsumer, ModalVariant, Alert, EmptyState, EmptyStateIcon, EmptyStateBody, EmptyStateSecondaryActions, Title, Progress } from '@patternfly/react-core';
|
|
9
11
|
import ExternalLinkAltIcon from '@patternfly/react-icons/dist/esm/icons/external-link-alt-icon';
|
|
10
12
|
import SlackHashIcon from '@patternfly/react-icons/dist/esm/icons/slack-hash-icon';
|
|
11
13
|
import FinishedStep from './FinishedStep';
|
|
@@ -859,3 +861,156 @@ class WizardInModal extends React.Component {
|
|
|
859
861
|
}
|
|
860
862
|
}
|
|
861
863
|
```
|
|
864
|
+
|
|
865
|
+
### Wizard with drawer
|
|
866
|
+
|
|
867
|
+
```js isBeta
|
|
868
|
+
import React from 'react';
|
|
869
|
+
import {
|
|
870
|
+
Button,
|
|
871
|
+
DrawerActions,
|
|
872
|
+
DrawerCloseButton,
|
|
873
|
+
DrawerHead,
|
|
874
|
+
DrawerPanelContent,
|
|
875
|
+
Text,
|
|
876
|
+
TextContent,
|
|
877
|
+
Wizard
|
|
878
|
+
} from '@patternfly/react-core';
|
|
879
|
+
|
|
880
|
+
class WizardWithDrawer extends React.Component {
|
|
881
|
+
constructor(props) {
|
|
882
|
+
super(props);
|
|
883
|
+
this.state = {
|
|
884
|
+
isOpen: false,
|
|
885
|
+
isDrawerExpanded: false,
|
|
886
|
+
sectionGray: false,
|
|
887
|
+
panelGray: true,
|
|
888
|
+
contentGray: false
|
|
889
|
+
};
|
|
890
|
+
|
|
891
|
+
this.drawerRef = React.createRef();
|
|
892
|
+
|
|
893
|
+
this.onExpand = () => {
|
|
894
|
+
this.drawerRef.current && this.drawerRef.current.focus();
|
|
895
|
+
};
|
|
896
|
+
|
|
897
|
+
this.onOpenClick = () => {
|
|
898
|
+
this.setState({
|
|
899
|
+
isDrawerExpanded: true
|
|
900
|
+
});
|
|
901
|
+
};
|
|
902
|
+
|
|
903
|
+
this.onCloseClick = () => {
|
|
904
|
+
this.setState({
|
|
905
|
+
isDrawerExpanded: false
|
|
906
|
+
});
|
|
907
|
+
};
|
|
908
|
+
}
|
|
909
|
+
|
|
910
|
+
render() {
|
|
911
|
+
const { isDrawerExpanded } = this.state;
|
|
912
|
+
|
|
913
|
+
const panel1Content = (
|
|
914
|
+
<DrawerPanelContent widths={{ default: 'width_33' }} colorVariant={DrawerColorVariant.light200}>
|
|
915
|
+
<DrawerHead>
|
|
916
|
+
<span tabIndex={isDrawerExpanded ? 0 : -1} ref={this.drawerRef}>
|
|
917
|
+
drawer-panel-1 content
|
|
918
|
+
</span>
|
|
919
|
+
<DrawerActions>
|
|
920
|
+
<DrawerCloseButton onClick={this.onCloseClick} />
|
|
921
|
+
</DrawerActions>
|
|
922
|
+
</DrawerHead>
|
|
923
|
+
</DrawerPanelContent>
|
|
924
|
+
);
|
|
925
|
+
|
|
926
|
+
const panel2Content = (
|
|
927
|
+
<DrawerPanelContent widths={{ default: 'width_33' }} colorVariant={DrawerColorVariant.light200}>
|
|
928
|
+
<DrawerHead>
|
|
929
|
+
<span tabIndex={0} ref={this.drawerRef}>
|
|
930
|
+
drawer-panel-2 content
|
|
931
|
+
</span>
|
|
932
|
+
<DrawerActions>
|
|
933
|
+
<DrawerCloseButton onClick={this.onCloseClick} />
|
|
934
|
+
</DrawerActions>
|
|
935
|
+
</DrawerHead>
|
|
936
|
+
</DrawerPanelContent>
|
|
937
|
+
);
|
|
938
|
+
|
|
939
|
+
const panel3Content = (
|
|
940
|
+
<DrawerPanelContent widths={{ default: 'width_33' }} colorVariant={DrawerColorVariant.light200}>
|
|
941
|
+
<DrawerHead>
|
|
942
|
+
<span tabIndex={0} ref={this.drawerRef}>
|
|
943
|
+
drawer-panel-3 content
|
|
944
|
+
</span>
|
|
945
|
+
<DrawerActions>
|
|
946
|
+
<DrawerCloseButton onClick={this.onCloseClick} />
|
|
947
|
+
</DrawerActions>
|
|
948
|
+
</DrawerHead>
|
|
949
|
+
</DrawerPanelContent>
|
|
950
|
+
);
|
|
951
|
+
|
|
952
|
+
const drawerToggleButton = (
|
|
953
|
+
<Button isInline variant="link" onClick={this.onOpenClick}>
|
|
954
|
+
Open Drawer
|
|
955
|
+
</Button>
|
|
956
|
+
);
|
|
957
|
+
|
|
958
|
+
const steps = [
|
|
959
|
+
{
|
|
960
|
+
name: 'Information',
|
|
961
|
+
component: <p>Information step content</p>,
|
|
962
|
+
drawerPanelContent: panel1Content,
|
|
963
|
+
drawerToggleButton: drawerToggleButton
|
|
964
|
+
},
|
|
965
|
+
{
|
|
966
|
+
name: 'Configuration',
|
|
967
|
+
steps: [
|
|
968
|
+
{
|
|
969
|
+
name: 'Substep A',
|
|
970
|
+
component: <p>Substep A content</p>,
|
|
971
|
+
drawerPanelContent: panel2Content,
|
|
972
|
+
drawerToggleButton: drawerToggleButton
|
|
973
|
+
},
|
|
974
|
+
{
|
|
975
|
+
name: 'Substep B',
|
|
976
|
+
component: <p>Substep B content</p>,
|
|
977
|
+
drawerPanelContent: panel2Content,
|
|
978
|
+
drawerToggleButton: drawerToggleButton
|
|
979
|
+
},
|
|
980
|
+
{
|
|
981
|
+
name: 'Substep C',
|
|
982
|
+
component: <p>Substep C content</p>,
|
|
983
|
+
drawerPanelContent: panel2Content,
|
|
984
|
+
drawerToggleButton: drawerToggleButton
|
|
985
|
+
}
|
|
986
|
+
]
|
|
987
|
+
},
|
|
988
|
+
{
|
|
989
|
+
name: 'Additional',
|
|
990
|
+
component: <p>Additional step content</p>,
|
|
991
|
+
drawerPanelContent: panel3Content,
|
|
992
|
+
drawerToggleButton: drawerToggleButton
|
|
993
|
+
},
|
|
994
|
+
{
|
|
995
|
+
name: 'Review',
|
|
996
|
+
component: <p>Review step content</p>,
|
|
997
|
+
nextButtonText: 'Finish'
|
|
998
|
+
}
|
|
999
|
+
];
|
|
1000
|
+
|
|
1001
|
+
const title = 'Wizard with drawer';
|
|
1002
|
+
|
|
1003
|
+
return (
|
|
1004
|
+
<React.Fragment>
|
|
1005
|
+
<Wizard
|
|
1006
|
+
height={400}
|
|
1007
|
+
isDrawerExpanded={isDrawerExpanded}
|
|
1008
|
+
hasDrawer
|
|
1009
|
+
navAriaLabel={`${title} steps`}
|
|
1010
|
+
steps={steps}
|
|
1011
|
+
/>
|
|
1012
|
+
</React.Fragment>
|
|
1013
|
+
);
|
|
1014
|
+
}
|
|
1015
|
+
}
|
|
1016
|
+
```
|