@patternfly/react-core 4.223.3 → 4.224.2

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.
Files changed (50) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/dist/esm/components/Select/Select.d.ts.map +1 -1
  3. package/dist/esm/components/Select/Select.js +25 -23
  4. package/dist/esm/components/Select/Select.js.map +1 -1
  5. package/dist/esm/components/Wizard/Wizard.d.ts +9 -0
  6. package/dist/esm/components/Wizard/Wizard.d.ts.map +1 -1
  7. package/dist/esm/components/Wizard/Wizard.js +6 -3
  8. package/dist/esm/components/Wizard/Wizard.js.map +1 -1
  9. package/dist/esm/components/Wizard/WizardBody.d.ts +6 -0
  10. package/dist/esm/components/Wizard/WizardBody.d.ts.map +1 -1
  11. package/dist/esm/components/Wizard/WizardBody.js +6 -2
  12. package/dist/esm/components/Wizard/WizardBody.js.map +1 -1
  13. package/dist/esm/components/Wizard/WizardDrawerWrapper.d.ts +11 -0
  14. package/dist/esm/components/Wizard/WizardDrawerWrapper.d.ts.map +1 -0
  15. package/dist/esm/components/Wizard/WizardDrawerWrapper.js +3 -0
  16. package/dist/esm/components/Wizard/WizardDrawerWrapper.js.map +1 -0
  17. package/dist/esm/components/Wizard/WizardToggle.d.ts +5 -1
  18. package/dist/esm/components/Wizard/WizardToggle.d.ts.map +1 -1
  19. package/dist/esm/components/Wizard/WizardToggle.js +4 -2
  20. package/dist/esm/components/Wizard/WizardToggle.js.map +1 -1
  21. package/dist/js/components/Select/Select.d.ts.map +1 -1
  22. package/dist/js/components/Select/Select.js +25 -23
  23. package/dist/js/components/Select/Select.js.map +1 -1
  24. package/dist/js/components/Wizard/Wizard.d.ts +9 -0
  25. package/dist/js/components/Wizard/Wizard.d.ts.map +1 -1
  26. package/dist/js/components/Wizard/Wizard.js +6 -3
  27. package/dist/js/components/Wizard/Wizard.js.map +1 -1
  28. package/dist/js/components/Wizard/WizardBody.d.ts +6 -0
  29. package/dist/js/components/Wizard/WizardBody.d.ts.map +1 -1
  30. package/dist/js/components/Wizard/WizardBody.js +6 -2
  31. package/dist/js/components/Wizard/WizardBody.js.map +1 -1
  32. package/dist/js/components/Wizard/WizardDrawerWrapper.d.ts +11 -0
  33. package/dist/js/components/Wizard/WizardDrawerWrapper.d.ts.map +1 -0
  34. package/dist/js/components/Wizard/WizardDrawerWrapper.js +7 -0
  35. package/dist/js/components/Wizard/WizardDrawerWrapper.js.map +1 -0
  36. package/dist/js/components/Wizard/WizardToggle.d.ts +5 -1
  37. package/dist/js/components/Wizard/WizardToggle.d.ts.map +1 -1
  38. package/dist/js/components/Wizard/WizardToggle.js +4 -2
  39. package/dist/js/components/Wizard/WizardToggle.js.map +1 -1
  40. package/dist/umd/react-core.js +42 -30
  41. package/dist/umd/react-core.min.js +4 -4
  42. package/package.json +5 -5
  43. package/src/components/Select/Select.tsx +35 -33
  44. package/src/components/Wizard/Wizard.tsx +21 -1
  45. package/src/components/Wizard/WizardBody.tsx +23 -2
  46. package/src/components/Wizard/WizardDrawerWrapper.tsx +18 -0
  47. package/src/components/Wizard/WizardToggle.tsx +12 -2
  48. package/src/components/Wizard/__tests__/Wizard.test.tsx +24 -7
  49. package/src/components/Wizard/examples/Wizard.md +157 -2
  50. package/src/demos/Wizard/WizardDemo.md +1033 -2
@@ -9,7 +9,7 @@ import DashboardWrapper from '../examples/DashboardWrapper';
9
9
 
10
10
  ## Demos
11
11
 
12
- ### In Modal
12
+ ### In modal
13
13
 
14
14
  ```js isFullscreen
15
15
  import React from 'react';
@@ -106,7 +106,454 @@ class BasicWizardDemo extends React.Component {
106
106
  }
107
107
  ```
108
108
 
109
- ### In Page
109
+ ### In modal, with drawer
110
+
111
+ ```js isFullscreen
112
+ import React from 'react';
113
+ import {
114
+ Button,
115
+ DrawerActions,
116
+ DrawerCloseButton,
117
+ DrawerPanelContent,
118
+ DrawerHead,
119
+ Modal,
120
+ ModalVariant,
121
+ Wizard
122
+ } from '@patternfly/react-core';
123
+
124
+ class WizardModalWithDrawerDemo extends React.Component {
125
+ constructor(props) {
126
+ super(props);
127
+ this.state = {
128
+ isDrawerExpanded: false
129
+ };
130
+
131
+ this.drawerRef = React.createRef();
132
+
133
+ this.onExpand = () => {
134
+ this.drawerRef.current && this.drawerRef.current.focus();
135
+ };
136
+
137
+ this.onOpenClick = () => {
138
+ this.setState({
139
+ isDrawerExpanded: true
140
+ });
141
+ };
142
+
143
+ this.onCloseClick = () => {
144
+ this.setState({
145
+ isDrawerExpanded: false
146
+ });
147
+ };
148
+ }
149
+ render() {
150
+ const { isDrawerExpanded } = this.state;
151
+
152
+ const informationPanelContent = (
153
+ <DrawerPanelContent widths={{ default: 'width_33' }} colorVariant={DrawerColorVariant.light200}>
154
+ <DrawerHead>
155
+ <span tabIndex={0} ref={this.drawerRef}>
156
+ Information panel content
157
+ </span>
158
+ <DrawerActions>
159
+ <DrawerCloseButton onClick={this.onCloseClick} />
160
+ </DrawerActions>
161
+ </DrawerHead>
162
+ </DrawerPanelContent>
163
+ );
164
+
165
+ const configSubstepAPanelContent = (
166
+ <DrawerPanelContent widths={{ default: 'width_33' }} colorVariant={DrawerColorVariant.light200}>
167
+ <DrawerHead>
168
+ <span tabIndex={0} ref={this.drawerRef}>
169
+ Configuration substep A content
170
+ </span>
171
+ <DrawerActions>
172
+ <DrawerCloseButton onClick={this.onCloseClick} />
173
+ </DrawerActions>
174
+ </DrawerHead>
175
+ </DrawerPanelContent>
176
+ );
177
+
178
+ const configSubstepBPanelContent = (
179
+ <DrawerPanelContent widths={{ default: 'width_33' }} colorVariant={DrawerColorVariant.light200}>
180
+ <DrawerHead>
181
+ <span tabIndex={0} ref={this.drawerRef}>
182
+ Configuration substep B content
183
+ </span>
184
+ <DrawerActions>
185
+ <DrawerCloseButton onClick={this.onCloseClick} />
186
+ </DrawerActions>
187
+ </DrawerHead>
188
+ </DrawerPanelContent>
189
+ );
190
+
191
+ const additionalPanelContent = (
192
+ <DrawerPanelContent widths={{ default: 'width_33' }} colorVariant={DrawerColorVariant.light200}>
193
+ <DrawerHead>
194
+ <span tabIndex={0} ref={this.drawerRef}>
195
+ Additional panel content
196
+ </span>
197
+ <DrawerActions>
198
+ <DrawerCloseButton onClick={this.onCloseClick} />
199
+ </DrawerActions>
200
+ </DrawerHead>
201
+ </DrawerPanelContent>
202
+ );
203
+
204
+ const reviewPanelContent = (
205
+ <DrawerPanelContent widths={{ default: 'width_33' }} colorVariant={DrawerColorVariant.light200}>
206
+ <DrawerHead>
207
+ <span tabIndex={0} ref={this.drawerRef}>
208
+ Review panel content
209
+ </span>
210
+ <DrawerActions>
211
+ <DrawerCloseButton onClick={this.onCloseClick} />
212
+ </DrawerActions>
213
+ </DrawerHead>
214
+ </DrawerPanelContent>
215
+ );
216
+
217
+ const drawerToggleButton = (
218
+ <Button className="pf-u-float-right pf-u-ml-md" isInline variant="link" onClick={this.onOpenClick}>
219
+ Open drawer
220
+ </Button>
221
+ );
222
+
223
+ const steps = [
224
+ {
225
+ id: 0,
226
+ name: 'Information',
227
+ component: <p>Step 1 content</p>,
228
+ drawerPanelContent: informationPanelContent,
229
+ drawerToggleButton: drawerToggleButton
230
+ },
231
+ {
232
+ id: 1,
233
+ name: 'Configuration',
234
+ steps: [
235
+ {
236
+ id: 2,
237
+ name: 'Substep A',
238
+ component: <p>Configuration substep A</p>,
239
+ drawerPanelContent: configSubstepAPanelContent,
240
+ drawerToggleButton: drawerToggleButton
241
+ },
242
+ {
243
+ id: 3,
244
+ name: 'Substep B',
245
+ component: <p>Configuration substep B</p>,
246
+ drawerPanelContent: configSubstepBPanelContent,
247
+ drawerToggleButton: drawerToggleButton
248
+ }
249
+ ]
250
+ },
251
+ {
252
+ id: 4,
253
+ name: 'Additional',
254
+ component: <p>Step 3 content</p>,
255
+ drawerPanelContent: additionalPanelContent,
256
+ drawerToggleButton: drawerToggleButton
257
+ },
258
+ {
259
+ id: 5,
260
+ name: 'Review',
261
+ component: <p>Review step content</p>,
262
+ drawerPanelContent: reviewPanelContent,
263
+ drawerToggleButton: drawerToggleButton,
264
+ nextButtonText: 'Finish'
265
+ }
266
+ ];
267
+ const title = 'Wizard modal with Drawer';
268
+
269
+ const panelContent = (
270
+ <DrawerPanelContent widths={{ default: 'width_33' }} colorVariant={DrawerColorVariant.light200}>
271
+ <DrawerHead>
272
+ <span tabIndex={0} ref={this.drawerRef}>
273
+ drawer-panel
274
+ </span>
275
+ </DrawerHead>
276
+ </DrawerPanelContent>
277
+ );
278
+
279
+ return (
280
+ <Modal
281
+ isOpen
282
+ variant={ModalVariant.large}
283
+ showClose={false}
284
+ hasNoBodyWrapper
285
+ aria-describedby="wiz-modal-demo-description"
286
+ aria-labelledby="wiz-modal-demo-title"
287
+ >
288
+ <Wizard
289
+ navAriaLabel={`${title} steps`}
290
+ hasDrawer
291
+ isDrawerExpanded={isDrawerExpanded}
292
+ mainAriaLabel={`${title} content`}
293
+ titleId="wiz-modal-demo-title"
294
+ descriptionId="wiz-modal-demo-description"
295
+ title="Simple wizard in modal"
296
+ description="Simple wizard description"
297
+ steps={steps}
298
+ height={400}
299
+ />
300
+ </Modal>
301
+ );
302
+ }
303
+ }
304
+ ```
305
+
306
+ ### In modal, with drawer and informational step
307
+
308
+ ```js isFullscreen
309
+ import React from 'react';
310
+ import {
311
+ Button,
312
+ DrawerActions,
313
+ DrawerCloseButton,
314
+ DrawerPanelContent,
315
+ DrawerHead,
316
+ Modal,
317
+ ModalVariant,
318
+ Text,
319
+ TextContent,
320
+ Wizard
321
+ } from '@patternfly/react-core';
322
+
323
+ class WizardModalWithDrawerDemo extends React.Component {
324
+ constructor(props) {
325
+ super(props);
326
+ this.state = {
327
+ isDrawerExpanded: false
328
+ };
329
+
330
+ this.drawerRef = React.createRef();
331
+
332
+ this.onExpand = () => {
333
+ this.drawerRef.current && this.drawerRef.current.focus();
334
+ };
335
+
336
+ this.onOpenClick = () => {
337
+ this.setState({
338
+ isDrawerExpanded: true
339
+ });
340
+ };
341
+
342
+ this.onCloseClick = () => {
343
+ this.setState({
344
+ isDrawerExpanded: false
345
+ });
346
+ };
347
+ }
348
+ render() {
349
+ const { isDrawerExpanded } = this.state;
350
+
351
+ const informationPanelContent = (
352
+ <DrawerPanelContent widths={{ default: 'width_33' }} colorVariant={DrawerColorVariant.light200}>
353
+ <DrawerHead>
354
+ <span tabIndex={0} ref={this.drawerRef}>
355
+ Information panel content
356
+ </span>
357
+ <DrawerActions>
358
+ <DrawerCloseButton onClick={this.onCloseClick} />
359
+ </DrawerActions>
360
+ </DrawerHead>
361
+ </DrawerPanelContent>
362
+ );
363
+
364
+ const configSubstepAPanelContent = (
365
+ <DrawerPanelContent widths={{ default: 'width_33' }} colorVariant={DrawerColorVariant.light200}>
366
+ <DrawerHead>
367
+ <span tabIndex={0} ref={this.drawerRef}>
368
+ Configuration substep A content
369
+ </span>
370
+ <DrawerActions>
371
+ <DrawerCloseButton onClick={this.onCloseClick} />
372
+ </DrawerActions>
373
+ </DrawerHead>
374
+ </DrawerPanelContent>
375
+ );
376
+
377
+ const configSubstepBPanelContent = (
378
+ <DrawerPanelContent widths={{ default: 'width_33' }} colorVariant={DrawerColorVariant.light200}>
379
+ <DrawerHead>
380
+ <span tabIndex={0} ref={this.drawerRef}>
381
+ Configuration substep B content
382
+ </span>
383
+ <DrawerActions>
384
+ <DrawerCloseButton onClick={this.onCloseClick} />
385
+ </DrawerActions>
386
+ </DrawerHead>
387
+ </DrawerPanelContent>
388
+ );
389
+
390
+ const additionalPanelContent = (
391
+ <DrawerPanelContent widths={{ default: 'width_33' }} colorVariant={DrawerColorVariant.light200}>
392
+ <DrawerHead>
393
+ <span tabIndex={0} ref={this.drawerRef}>
394
+ Additional panel content
395
+ </span>
396
+ <DrawerActions>
397
+ <DrawerCloseButton onClick={this.onCloseClick} />
398
+ </DrawerActions>
399
+ </DrawerHead>
400
+ </DrawerPanelContent>
401
+ );
402
+
403
+ const reviewPanelContent = (
404
+ <DrawerPanelContent widths={{ default: 'width_33' }} colorVariant={DrawerColorVariant.light200}>
405
+ <DrawerHead>
406
+ <span tabIndex={0} ref={this.drawerRef}>
407
+ Review panel content
408
+ </span>
409
+ <DrawerActions>
410
+ <DrawerCloseButton onClick={this.onCloseClick} />
411
+ </DrawerActions>
412
+ </DrawerHead>
413
+ </DrawerPanelContent>
414
+ );
415
+
416
+ const drawerToggleButton = (
417
+ <Button className="pf-u-float-right pf-u-ml-md" isInline variant="link" onClick={this.onOpenClick}>
418
+ Open drawer
419
+ </Button>
420
+ );
421
+
422
+ const steps = [
423
+ {
424
+ id: 0,
425
+ name: 'Information',
426
+ component: (
427
+ <TextContent>
428
+ <Text component={TextVariants.h1}>Information step content</Text>
429
+ <p>
430
+ Wizard description goes here. If you need more assistance,{' '}
431
+ <Button isInline variant="link" onClick={this.onOpenClick}>
432
+ see more information
433
+ </Button>{' '}
434
+ in the side drawer.{' '}
435
+ </p>
436
+ </TextContent>
437
+ ),
438
+ drawerPanelContent: informationPanelContent
439
+ },
440
+ {
441
+ id: 1,
442
+ name: 'Configuration',
443
+ steps: [
444
+ {
445
+ id: 2,
446
+ name: 'Substep A',
447
+ component: (
448
+ <TextContent>
449
+ <Text component={TextVariants.h1}>Configuration substep A content</Text>
450
+ <p>
451
+ Wizard description goes here. If you need more assistance,
452
+ <Button isInline variant="link" onClick={this.onOpenClick}>
453
+ see more information
454
+ </Button>
455
+ in the side drawer.
456
+ </p>
457
+ </TextContent>
458
+ ),
459
+ drawerPanelContent: configSubstepAPanelContent
460
+ },
461
+ {
462
+ id: 3,
463
+ name: 'Substep B',
464
+ component: (
465
+ <TextContent>
466
+ <Text component={TextVariants.h1}>Configuration substep B content</Text>
467
+ <p>
468
+ Wizard description goes here. If you need more assistance,
469
+ <Button isInline variant="link" onClick={this.onOpenClick}>
470
+ see more information
471
+ </Button>
472
+ in the side drawer.
473
+ </p>
474
+ </TextContent>
475
+ ),
476
+ drawerPanelContent: configSubstepBPanelContent
477
+ }
478
+ ]
479
+ },
480
+ {
481
+ id: 4,
482
+ name: 'Additional',
483
+ component: (
484
+ <TextContent>
485
+ <Text component={TextVariants.h1}>Additional step content</Text>
486
+ <p>
487
+ Wizard description goes here. If you need more assistance,
488
+ <Button isInline variant="link" onClick={this.onOpenClick}>
489
+ see more information
490
+ </Button>
491
+ in the side drawer.
492
+ </p>
493
+ </TextContent>
494
+ ),
495
+ drawerPanelContent: additionalPanelContent
496
+ },
497
+ {
498
+ id: 5,
499
+ name: 'Review',
500
+ component: (
501
+ <TextContent>
502
+ <Text component={TextVariants.h1}>Review step content</Text>
503
+ <p>
504
+ Wizard description goes here. If you need more assistance,
505
+ <Button isInline variant="link" onClick={this.onOpenClick}>
506
+ see more information
507
+ </Button>
508
+ in the side drawer.
509
+ </p>
510
+ </TextContent>
511
+ ),
512
+ nextButtonText: 'Finish',
513
+ drawerPanelContent: reviewPanelContent
514
+ }
515
+ ];
516
+
517
+ const title = 'Wizard modal with Drawer';
518
+
519
+ const panelContent = (
520
+ <DrawerPanelContent widths={{ default: 'width_33' }} colorVariant={DrawerColorVariant.light200}>
521
+ <DrawerHead>
522
+ <span tabIndex={0} ref={this.drawerRef}>
523
+ drawer-panel
524
+ </span>
525
+ </DrawerHead>
526
+ </DrawerPanelContent>
527
+ );
528
+
529
+ return (
530
+ <Modal
531
+ isOpen
532
+ variant={ModalVariant.large}
533
+ showClose={false}
534
+ hasNoBodyWrapper
535
+ aria-describedby="wiz-modal-demo-description"
536
+ aria-labelledby="wiz-modal-demo-title"
537
+ >
538
+ <Wizard
539
+ navAriaLabel={`${title} steps`}
540
+ hasDrawer
541
+ isDrawerExpanded={isDrawerExpanded}
542
+ mainAriaLabel={`${title} content`}
543
+ titleId="wiz-modal-demo-title"
544
+ descriptionId="wiz-modal-demo-description"
545
+ title="Simple wizard in modal"
546
+ description="Simple wizard description"
547
+ steps={steps}
548
+ height={400}
549
+ />
550
+ </Modal>
551
+ );
552
+ }
553
+ }
554
+ ```
555
+
556
+ ### In page
110
557
 
111
558
  ```js isFullscreen
112
559
  import React from 'react';
@@ -174,3 +621,587 @@ class FullPageWizard extends React.Component {
174
621
  }
175
622
  }
176
623
  ```
624
+
625
+ ### In page, with drawer
626
+
627
+ ```js isFullscreen
628
+ import React from 'react';
629
+ import {
630
+ Brand,
631
+ Breadcrumb,
632
+ BreadcrumbItem,
633
+ Button,
634
+ DrawerActions,
635
+ DrawerCloseButton,
636
+ DrawerHead,
637
+ DrawerPanelContent,
638
+ Nav,
639
+ NavItem,
640
+ NavList,
641
+ Page,
642
+ PageSection,
643
+ PageSectionTypes,
644
+ PageSectionVariants,
645
+ PageSidebar,
646
+ Progress,
647
+ SkipToContent,
648
+ Text,
649
+ TextContent,
650
+ Title,
651
+ Wizard,
652
+ Masthead,
653
+ PageToggleButton,
654
+ MastheadToggle,
655
+ MastheadMain,
656
+ MastheadBrand
657
+ } from '@patternfly/react-core';
658
+ import imgBrand from './imgBrand.svg';
659
+ import BarsIcon from '@patternfly/react-icons/dist/js/icons/bars-icon';
660
+
661
+ class FullPageWizard extends React.Component {
662
+ constructor(props) {
663
+ super(props);
664
+ this.state = {
665
+ isDrawerExpanded: false,
666
+ activeItem: 0
667
+ };
668
+
669
+ this.drawerRef = React.createRef();
670
+
671
+ this.onExpand = () => {
672
+ this.drawerRef.current && this.drawerRef.current.focus();
673
+ };
674
+
675
+ this.onOpenClick = () => {
676
+ this.setState({
677
+ isDrawerExpanded: true
678
+ });
679
+ };
680
+
681
+ this.onCloseClick = () => {
682
+ this.setState({
683
+ isDrawerExpanded: false
684
+ });
685
+ };
686
+ this.onNavSelect = result => {
687
+ this.setState({
688
+ activeItem: result.itemId
689
+ });
690
+ };
691
+ }
692
+ render() {
693
+ const { activeItem, isDrawerExpanded } = this.state;
694
+ const PageNav = (
695
+ <Nav onSelect={this.onNavSelect} aria-label="Nav">
696
+ <NavList>
697
+ <NavItem itemId={0} isActive={activeItem === 0}>
698
+ System Panel
699
+ </NavItem>
700
+ <NavItem itemId={1} isActive={activeItem === 1}>
701
+ Policy
702
+ </NavItem>
703
+ <NavItem itemId={2} isActive={activeItem === 2}>
704
+ Authentication
705
+ </NavItem>
706
+ <NavItem itemId={3} isActive={activeItem === 3}>
707
+ Network Services
708
+ </NavItem>
709
+ <NavItem itemId={4} isActive={activeItem === 4}>
710
+ Server
711
+ </NavItem>
712
+ </NavList>
713
+ </Nav>
714
+ );
715
+ const Header = (
716
+ <Masthead id="basic">
717
+ <MastheadToggle>
718
+ <PageToggleButton variant="plain" aria-label="Global navigation">
719
+ <BarsIcon />
720
+ </PageToggleButton>
721
+ </MastheadToggle>
722
+ <MastheadMain>
723
+ <MastheadBrand>
724
+ <Brand src={imgBrand} alt="Patternfly logo" />
725
+ </MastheadBrand>
726
+ </MastheadMain>
727
+ </Masthead>
728
+ );
729
+ const Sidebar = <PageSidebar nav={PageNav} />;
730
+ const pageId = 'main-content-page-layout-default-nav';
731
+ const PageSkipToContent = <SkipToContent href={`#${pageId}`}>Skip to content</SkipToContent>;
732
+ const PageBreadcrumb = (
733
+ <Breadcrumb>
734
+ <BreadcrumbItem>Section home</BreadcrumbItem>
735
+ <BreadcrumbItem to="#">Section title</BreadcrumbItem>
736
+ <BreadcrumbItem to="#">Section title</BreadcrumbItem>
737
+ <BreadcrumbItem to="#" isActive>
738
+ Section landing
739
+ </BreadcrumbItem>
740
+ </Breadcrumb>
741
+ );
742
+
743
+ const informationPanelContent = (
744
+ <DrawerPanelContent widths={{ default: 'width_33' }} colorVariant={DrawerColorVariant.light200}>
745
+ <DrawerHead>
746
+ <span tabIndex={0} ref={this.drawerRef}>
747
+ Information panel content
748
+ </span>
749
+ <DrawerActions>
750
+ <DrawerCloseButton onClick={this.onCloseClick} />
751
+ </DrawerActions>
752
+ </DrawerHead>
753
+ </DrawerPanelContent>
754
+ );
755
+
756
+ const configSubstepAPanelContent = (
757
+ <DrawerPanelContent widths={{ default: 'width_33' }} colorVariant={DrawerColorVariant.light200}>
758
+ <DrawerHead>
759
+ <span tabIndex={0} ref={this.drawerRef}>
760
+ Configuration substep A content
761
+ </span>
762
+ <DrawerActions>
763
+ <DrawerCloseButton onClick={this.onCloseClick} />
764
+ </DrawerActions>
765
+ </DrawerHead>
766
+ </DrawerPanelContent>
767
+ );
768
+
769
+ const configSubstepBPanelContent = (
770
+ <DrawerPanelContent widths={{ default: 'width_33' }} colorVariant={DrawerColorVariant.light200}>
771
+ <DrawerHead>
772
+ <span tabIndex={0} ref={this.drawerRef}>
773
+ Configuration substep B content
774
+ </span>
775
+ <DrawerActions>
776
+ <DrawerCloseButton onClick={this.onCloseClick} />
777
+ </DrawerActions>
778
+ </DrawerHead>
779
+ </DrawerPanelContent>
780
+ );
781
+
782
+ const additionalPanelContent = (
783
+ <DrawerPanelContent widths={{ default: 'width_33' }} colorVariant={DrawerColorVariant.light200}>
784
+ <DrawerHead>
785
+ <span tabIndex={0} ref={this.drawerRef}>
786
+ Additional panel content
787
+ </span>
788
+ <DrawerActions>
789
+ <DrawerCloseButton onClick={this.onCloseClick} />
790
+ </DrawerActions>
791
+ </DrawerHead>
792
+ </DrawerPanelContent>
793
+ );
794
+
795
+ const reviewPanelContent = (
796
+ <DrawerPanelContent widths={{ default: 'width_33' }} colorVariant={DrawerColorVariant.light200}>
797
+ <DrawerHead>
798
+ <span tabIndex={0} ref={this.drawerRef}>
799
+ Review panel content
800
+ </span>
801
+ <DrawerActions>
802
+ <DrawerCloseButton onClick={this.onCloseClick} />
803
+ </DrawerActions>
804
+ </DrawerHead>
805
+ </DrawerPanelContent>
806
+ );
807
+
808
+ const drawerToggleButton = (
809
+ <Button className="pf-u-float-right pf-u-ml-md" isInline variant="link" onClick={this.onOpenClick}>
810
+ Open drawer
811
+ </Button>
812
+ );
813
+
814
+ const steps = [
815
+ {
816
+ id: 0,
817
+ name: 'Information',
818
+ component: <p>Step 1 content</p>,
819
+ drawerPanelContent: informationPanelContent,
820
+ drawerToggleButton: drawerToggleButton
821
+ },
822
+ {
823
+ id: 1,
824
+ name: 'Configuration',
825
+ steps: [
826
+ {
827
+ id: 2,
828
+ name: 'Substep A',
829
+ component: <p>Configuration substep A</p>,
830
+ drawerPanelContent: configSubstepAPanelContent,
831
+ drawerToggleButton: drawerToggleButton
832
+ },
833
+ {
834
+ id: 3,
835
+ name: 'Substep B',
836
+ component: <p>Configuration substep B</p>,
837
+ drawerPanelContent: configSubstepBPanelContent,
838
+ drawerToggleButton: drawerToggleButton
839
+ }
840
+ ]
841
+ },
842
+ {
843
+ id: 4,
844
+ name: 'Additional',
845
+ component: <p>Step 3 content</p>,
846
+ drawerPanelContent: additionalPanelContent,
847
+ drawerToggleButton: drawerToggleButton
848
+ },
849
+ {
850
+ id: 5,
851
+ name: 'Review',
852
+ component: <p>Review step content</p>,
853
+ nextButtonText: 'Finish',
854
+ drawerPanelContent: reviewPanelContent,
855
+ drawerToggleButton: drawerToggleButton
856
+ }
857
+ ];
858
+ const title = 'Basic wizard';
859
+
860
+ return (
861
+ <React.Fragment>
862
+ <Page
863
+ header={Header}
864
+ sidebar={Sidebar}
865
+ isManagedSidebar
866
+ skipToContent={PageSkipToContent}
867
+ breadcrumb={PageBreadcrumb}
868
+ mainContainerId={pageId}
869
+ >
870
+ <PageSection variant={PageSectionVariants.light}>
871
+ <TextContent>
872
+ <Text component="h1">Main title</Text>
873
+ <Text component="p">A demo of a wizard in a page.</Text>
874
+ </TextContent>
875
+ </PageSection>
876
+ <PageSection type={PageSectionTypes.wizard} variant={PageSectionVariants.light}>
877
+ <Wizard
878
+ hasDrawer
879
+ isDrawerExpanded={isDrawerExpanded}
880
+ navAriaLabel={`${title} steps`}
881
+ mainAriaLabel={`${title} content`}
882
+ steps={steps}
883
+ />
884
+ </PageSection>
885
+ </Page>
886
+ </React.Fragment>
887
+ );
888
+ }
889
+ }
890
+ ```
891
+
892
+ ### In page, with drawer and informational step
893
+
894
+ ```js isFullscreen
895
+ import React from 'react';
896
+ import {
897
+ Brand,
898
+ Breadcrumb,
899
+ BreadcrumbItem,
900
+ Button,
901
+ DrawerActions,
902
+ DrawerCloseButton,
903
+ DrawerHead,
904
+ DrawerPanelContent,
905
+ Nav,
906
+ NavItem,
907
+ NavList,
908
+ Page,
909
+ PageSection,
910
+ PageSectionTypes,
911
+ PageSectionVariants,
912
+ PageSidebar,
913
+ Progress,
914
+ SkipToContent,
915
+ Text,
916
+ TextContent,
917
+ Title,
918
+ Wizard,
919
+ Masthead,
920
+ PageToggleButton,
921
+ MastheadToggle,
922
+ MastheadMain,
923
+ MastheadBrand
924
+ } from '@patternfly/react-core';
925
+ import imgBrand from './imgBrand.svg';
926
+ import BarsIcon from '@patternfly/react-icons/dist/js/icons/bars-icon';
927
+
928
+ class FullPageWizard extends React.Component {
929
+ constructor(props) {
930
+ super(props);
931
+ this.state = {
932
+ isDrawerExpanded: false,
933
+ activeItem: 0
934
+ };
935
+
936
+ this.drawerRef = React.createRef();
937
+
938
+ this.onExpand = () => {
939
+ this.drawerRef.current && this.drawerRef.current.focus();
940
+ };
941
+
942
+ this.onOpenClick = () => {
943
+ this.setState({
944
+ isDrawerExpanded: true
945
+ });
946
+ };
947
+
948
+ this.onCloseClick = () => {
949
+ this.setState({
950
+ isDrawerExpanded: false
951
+ });
952
+ };
953
+ this.onNavSelect = result => {
954
+ this.setState({
955
+ activeItem: result.itemId
956
+ });
957
+ };
958
+ }
959
+ render() {
960
+ const { activeItem, isDrawerExpanded } = this.state;
961
+ const PageNav = (
962
+ <Nav onSelect={this.onNavSelect} aria-label="Nav">
963
+ <NavList>
964
+ <NavItem itemId={0} isActive={activeItem === 0}>
965
+ System Panel
966
+ </NavItem>
967
+ <NavItem itemId={1} isActive={activeItem === 1}>
968
+ Policy
969
+ </NavItem>
970
+ <NavItem itemId={2} isActive={activeItem === 2}>
971
+ Authentication
972
+ </NavItem>
973
+ <NavItem itemId={3} isActive={activeItem === 3}>
974
+ Network Services
975
+ </NavItem>
976
+ <NavItem itemId={4} isActive={activeItem === 4}>
977
+ Server
978
+ </NavItem>
979
+ </NavList>
980
+ </Nav>
981
+ );
982
+ const Header = (
983
+ <Masthead id="basic">
984
+ <MastheadToggle>
985
+ <PageToggleButton variant="plain" aria-label="Global navigation">
986
+ <BarsIcon />
987
+ </PageToggleButton>
988
+ </MastheadToggle>
989
+ <MastheadMain>
990
+ <MastheadBrand>
991
+ <Brand src={imgBrand} alt="Patternfly logo" />
992
+ </MastheadBrand>
993
+ </MastheadMain>
994
+ </Masthead>
995
+ );
996
+ const Sidebar = <PageSidebar nav={PageNav} />;
997
+ const pageId = 'main-content-page-layout-default-nav';
998
+ const PageSkipToContent = <SkipToContent href={`#${pageId}`}>Skip to content</SkipToContent>;
999
+ const PageBreadcrumb = (
1000
+ <Breadcrumb>
1001
+ <BreadcrumbItem>Section home</BreadcrumbItem>
1002
+ <BreadcrumbItem to="#">Section title</BreadcrumbItem>
1003
+ <BreadcrumbItem to="#">Section title</BreadcrumbItem>
1004
+ <BreadcrumbItem to="#" isActive>
1005
+ Section landing
1006
+ </BreadcrumbItem>
1007
+ </Breadcrumb>
1008
+ );
1009
+
1010
+ const informationPanelContent = (
1011
+ <DrawerPanelContent widths={{ default: 'width_33' }} colorVariant={DrawerColorVariant.light200}>
1012
+ <DrawerHead>
1013
+ <span tabIndex={0} ref={this.drawerRef}>
1014
+ Information panel content
1015
+ </span>
1016
+ <DrawerActions>
1017
+ <DrawerCloseButton onClick={this.onCloseClick} />
1018
+ </DrawerActions>
1019
+ </DrawerHead>
1020
+ </DrawerPanelContent>
1021
+ );
1022
+
1023
+ const configSubstepAPanelContent = (
1024
+ <DrawerPanelContent widths={{ default: 'width_33' }} colorVariant={DrawerColorVariant.light200}>
1025
+ <DrawerHead>
1026
+ <span tabIndex={0} ref={this.drawerRef}>
1027
+ Configuration substep A content
1028
+ </span>
1029
+ <DrawerActions>
1030
+ <DrawerCloseButton onClick={this.onCloseClick} />
1031
+ </DrawerActions>
1032
+ </DrawerHead>
1033
+ </DrawerPanelContent>
1034
+ );
1035
+
1036
+ const configSubstepBPanelContent = (
1037
+ <DrawerPanelContent widths={{ default: 'width_33' }} colorVariant={DrawerColorVariant.light200}>
1038
+ <DrawerHead>
1039
+ <span tabIndex={0} ref={this.drawerRef}>
1040
+ Configuration substep B content
1041
+ </span>
1042
+ <DrawerActions>
1043
+ <DrawerCloseButton onClick={this.onCloseClick} />
1044
+ </DrawerActions>
1045
+ </DrawerHead>
1046
+ </DrawerPanelContent>
1047
+ );
1048
+
1049
+ const additionalPanelContent = (
1050
+ <DrawerPanelContent widths={{ default: 'width_33' }} colorVariant={DrawerColorVariant.light200}>
1051
+ <DrawerHead>
1052
+ <span tabIndex={0} ref={this.drawerRef}>
1053
+ Additional panel content
1054
+ </span>
1055
+ <DrawerActions>
1056
+ <DrawerCloseButton onClick={this.onCloseClick} />
1057
+ </DrawerActions>
1058
+ </DrawerHead>
1059
+ </DrawerPanelContent>
1060
+ );
1061
+
1062
+ const reviewPanelContent = (
1063
+ <DrawerPanelContent widths={{ default: 'width_33' }} colorVariant={DrawerColorVariant.light200}>
1064
+ <DrawerHead>
1065
+ <span tabIndex={0} ref={this.drawerRef}>
1066
+ Review panel content
1067
+ </span>
1068
+ <DrawerActions>
1069
+ <DrawerCloseButton onClick={this.onCloseClick} />
1070
+ </DrawerActions>
1071
+ </DrawerHead>
1072
+ </DrawerPanelContent>
1073
+ );
1074
+
1075
+ const drawerToggleButton = (
1076
+ <Button className="pf-u-float-right pf-u-ml-md" isInline variant="link" onClick={this.onOpenClick}>
1077
+ Open drawer
1078
+ </Button>
1079
+ );
1080
+
1081
+ const steps = [
1082
+ {
1083
+ id: 0,
1084
+ name: 'Information',
1085
+ component: (
1086
+ <TextContent>
1087
+ <Text component={TextVariants.h1}>Information step content</Text>
1088
+ <p>
1089
+ Wizard description goes here. If you need more assistance,{' '}
1090
+ <Button isInline variant="link" onClick={this.onOpenClick}>
1091
+ see more information
1092
+ </Button>{' '}
1093
+ in the side drawer.{' '}
1094
+ </p>
1095
+ </TextContent>
1096
+ ),
1097
+ drawerPanelContent: informationPanelContent
1098
+ },
1099
+ {
1100
+ id: 1,
1101
+ name: 'Configuration',
1102
+ steps: [
1103
+ {
1104
+ id: 2,
1105
+ name: 'Substep A',
1106
+ component: (
1107
+ <TextContent>
1108
+ <Text component={TextVariants.h1}>Configuration substep A content</Text>
1109
+ <p>
1110
+ Wizard description goes here. If you need more assistance,
1111
+ <Button isInline variant="link" onClick={this.onOpenClick}>
1112
+ see more information
1113
+ </Button>
1114
+ in the side drawer.
1115
+ </p>
1116
+ </TextContent>
1117
+ ),
1118
+ drawerPanelContent: configSubstepAPanelContent
1119
+ },
1120
+ {
1121
+ id: 3,
1122
+ name: 'Substep B',
1123
+ component: (
1124
+ <TextContent>
1125
+ <Text component={TextVariants.h1}>Configuration substep B content</Text>
1126
+ <p>
1127
+ Wizard description goes here. If you need more assistance,
1128
+ <Button isInline variant="link" onClick={this.onOpenClick}>
1129
+ see more information
1130
+ </Button>
1131
+ in the side drawer.
1132
+ </p>
1133
+ </TextContent>
1134
+ ),
1135
+ drawerPanelContent: configSubstepBPanelContent
1136
+ }
1137
+ ]
1138
+ },
1139
+ {
1140
+ id: 4,
1141
+ name: 'Additional',
1142
+ component: (
1143
+ <TextContent>
1144
+ <Text component={TextVariants.h1}>Additional step content</Text>
1145
+ <p>
1146
+ Wizard description goes here. If you need more assistance,
1147
+ <Button isInline variant="link" onClick={this.onOpenClick}>
1148
+ see more information
1149
+ </Button>
1150
+ in the side drawer.
1151
+ </p>
1152
+ </TextContent>
1153
+ ),
1154
+ drawerPanelContent: additionalPanelContent
1155
+ },
1156
+ {
1157
+ id: 5,
1158
+ name: 'Review',
1159
+ component: (
1160
+ <TextContent>
1161
+ <Text component={TextVariants.h1}>Review step content</Text>
1162
+ <p>
1163
+ Wizard description goes here. If you need more assistance,
1164
+ <Button isInline variant="link" onClick={this.onOpenClick}>
1165
+ see more information
1166
+ </Button>
1167
+ in the side drawer.
1168
+ </p>
1169
+ </TextContent>
1170
+ ),
1171
+ nextButtonText: 'Finish',
1172
+ drawerPanelContent: reviewPanelContent
1173
+ }
1174
+ ];
1175
+ const title = 'Basic wizard';
1176
+
1177
+ return (
1178
+ <React.Fragment>
1179
+ <Page
1180
+ header={Header}
1181
+ sidebar={Sidebar}
1182
+ isManagedSidebar
1183
+ skipToContent={PageSkipToContent}
1184
+ breadcrumb={PageBreadcrumb}
1185
+ mainContainerId={pageId}
1186
+ >
1187
+ <PageSection variant={PageSectionVariants.light}>
1188
+ <TextContent>
1189
+ <Text component="h1">Main title</Text>
1190
+ <Text component="p">A demo of a wizard in a page.</Text>
1191
+ </TextContent>
1192
+ </PageSection>
1193
+ <PageSection type={PageSectionTypes.wizard} variant={PageSectionVariants.light}>
1194
+ <Wizard
1195
+ hasDrawer
1196
+ isDrawerExpanded={isDrawerExpanded}
1197
+ navAriaLabel={`${title} steps`}
1198
+ mainAriaLabel={`${title} content`}
1199
+ steps={steps}
1200
+ />
1201
+ </PageSection>
1202
+ </Page>
1203
+ </React.Fragment>
1204
+ );
1205
+ }
1206
+ }
1207
+ ```