@patternfly/react-core 4.274.0 → 4.275.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 +19 -0
- package/components/Menu/MenuGroup.d.ts +1 -1
- package/components/Menu/MenuGroup.d.ts.map +1 -1
- package/components/Menu/MenuGroup.js.map +1 -1
- package/components/Select/Select.d.ts +2 -0
- package/components/Select/Select.d.ts.map +1 -1
- package/components/Select/Select.js +3 -3
- package/components/Select/Select.js.map +1 -1
- package/components/Select/SelectToggle.d.ts +4 -14
- package/components/Select/SelectToggle.d.ts.map +1 -1
- package/components/Select/SelectToggle.js +11 -5
- package/components/Select/SelectToggle.js.map +1 -1
- package/dist/esm/components/Menu/MenuGroup.d.ts +1 -1
- package/dist/esm/components/Menu/MenuGroup.d.ts.map +1 -1
- package/dist/esm/components/Menu/MenuGroup.js.map +1 -1
- package/dist/esm/components/Select/Select.d.ts +2 -0
- package/dist/esm/components/Select/Select.d.ts.map +1 -1
- package/dist/esm/components/Select/Select.js +3 -3
- package/dist/esm/components/Select/Select.js.map +1 -1
- package/dist/esm/components/Select/SelectToggle.d.ts +4 -14
- package/dist/esm/components/Select/SelectToggle.d.ts.map +1 -1
- package/dist/esm/components/Select/SelectToggle.js +11 -5
- package/dist/esm/components/Select/SelectToggle.js.map +1 -1
- package/dist/esm/next/components/Wizard/Wizard.d.ts +11 -14
- package/dist/esm/next/components/Wizard/Wizard.d.ts.map +1 -1
- package/dist/esm/next/components/Wizard/Wizard.js +30 -23
- package/dist/esm/next/components/Wizard/Wizard.js.map +1 -1
- package/dist/esm/next/components/Wizard/WizardContext.d.ts +16 -16
- package/dist/esm/next/components/Wizard/WizardContext.d.ts.map +1 -1
- package/dist/esm/next/components/Wizard/WizardContext.js +17 -19
- package/dist/esm/next/components/Wizard/WizardContext.js.map +1 -1
- package/dist/esm/next/components/Wizard/WizardFooter.d.ts +8 -5
- package/dist/esm/next/components/Wizard/WizardFooter.d.ts.map +1 -1
- package/dist/esm/next/components/Wizard/WizardFooter.js +1 -1
- package/dist/esm/next/components/Wizard/WizardFooter.js.map +1 -1
- package/dist/esm/next/components/Wizard/WizardHeader.d.ts +1 -1
- package/dist/esm/next/components/Wizard/WizardHeader.d.ts.map +1 -1
- package/dist/esm/next/components/Wizard/WizardNavInternal.d.ts +2 -2
- package/dist/esm/next/components/Wizard/WizardNavInternal.d.ts.map +1 -1
- package/dist/esm/next/components/Wizard/WizardNavInternal.js +15 -9
- package/dist/esm/next/components/Wizard/WizardNavInternal.js.map +1 -1
- package/dist/esm/next/components/Wizard/WizardNavItem.d.ts +10 -4
- package/dist/esm/next/components/Wizard/WizardNavItem.d.ts.map +1 -1
- package/dist/esm/next/components/Wizard/WizardNavItem.js +10 -9
- package/dist/esm/next/components/Wizard/WizardNavItem.js.map +1 -1
- package/dist/esm/next/components/Wizard/WizardStep.d.ts +3 -3
- package/dist/esm/next/components/Wizard/WizardStep.d.ts.map +1 -1
- package/dist/esm/next/components/Wizard/WizardStep.js +4 -2
- package/dist/esm/next/components/Wizard/WizardStep.js.map +1 -1
- package/dist/esm/next/components/Wizard/WizardToggle.d.ts +4 -4
- package/dist/esm/next/components/Wizard/WizardToggle.d.ts.map +1 -1
- package/dist/esm/next/components/Wizard/WizardToggle.js +1 -1
- package/dist/esm/next/components/Wizard/WizardToggle.js.map +1 -1
- package/dist/esm/next/components/Wizard/hooks/index.d.ts +1 -0
- package/dist/esm/next/components/Wizard/hooks/index.d.ts.map +1 -1
- package/dist/esm/next/components/Wizard/hooks/index.js +1 -0
- package/dist/esm/next/components/Wizard/hooks/index.js.map +1 -1
- package/dist/esm/next/components/Wizard/hooks/useGetMergedSteps.d.ts +9 -0
- package/dist/esm/next/components/Wizard/hooks/useGetMergedSteps.d.ts.map +1 -0
- package/dist/esm/next/components/Wizard/hooks/useGetMergedSteps.js +33 -0
- package/dist/esm/next/components/Wizard/hooks/useGetMergedSteps.js.map +1 -0
- package/dist/esm/next/components/Wizard/index.d.ts +2 -2
- package/dist/esm/next/components/Wizard/index.d.ts.map +1 -1
- package/dist/esm/next/components/Wizard/index.js +2 -2
- package/dist/esm/next/components/Wizard/index.js.map +1 -1
- package/dist/esm/next/components/Wizard/types.d.ts +13 -19
- package/dist/esm/next/components/Wizard/types.d.ts.map +1 -1
- package/dist/esm/next/components/Wizard/types.js +6 -0
- package/dist/esm/next/components/Wizard/types.js.map +1 -1
- package/dist/esm/next/components/Wizard/utils.d.ts +5 -6
- package/dist/esm/next/components/Wizard/utils.d.ts.map +1 -1
- package/dist/esm/next/components/Wizard/utils.js +15 -22
- package/dist/esm/next/components/Wizard/utils.js.map +1 -1
- package/dist/js/components/Menu/MenuGroup.d.ts +1 -1
- package/dist/js/components/Menu/MenuGroup.d.ts.map +1 -1
- package/dist/js/components/Menu/MenuGroup.js.map +1 -1
- package/dist/js/components/Select/Select.d.ts +2 -0
- package/dist/js/components/Select/Select.d.ts.map +1 -1
- package/dist/js/components/Select/Select.js +3 -3
- package/dist/js/components/Select/Select.js.map +1 -1
- package/dist/js/components/Select/SelectToggle.d.ts +4 -14
- package/dist/js/components/Select/SelectToggle.d.ts.map +1 -1
- package/dist/js/components/Select/SelectToggle.js +11 -6
- package/dist/js/components/Select/SelectToggle.js.map +1 -1
- package/dist/js/next/components/Wizard/Wizard.d.ts +11 -14
- package/dist/js/next/components/Wizard/Wizard.d.ts.map +1 -1
- package/dist/js/next/components/Wizard/Wizard.js +28 -21
- package/dist/js/next/components/Wizard/Wizard.js.map +1 -1
- package/dist/js/next/components/Wizard/WizardContext.d.ts +16 -16
- package/dist/js/next/components/Wizard/WizardContext.d.ts.map +1 -1
- package/dist/js/next/components/Wizard/WizardContext.js +16 -17
- package/dist/js/next/components/Wizard/WizardContext.js.map +1 -1
- package/dist/js/next/components/Wizard/WizardFooter.d.ts +8 -5
- package/dist/js/next/components/Wizard/WizardFooter.d.ts.map +1 -1
- package/dist/js/next/components/Wizard/WizardFooter.js +1 -1
- package/dist/js/next/components/Wizard/WizardFooter.js.map +1 -1
- package/dist/js/next/components/Wizard/WizardHeader.d.ts +1 -1
- package/dist/js/next/components/Wizard/WizardHeader.d.ts.map +1 -1
- package/dist/js/next/components/Wizard/WizardNavInternal.d.ts +2 -2
- package/dist/js/next/components/Wizard/WizardNavInternal.d.ts.map +1 -1
- package/dist/js/next/components/Wizard/WizardNavInternal.js +15 -9
- package/dist/js/next/components/Wizard/WizardNavInternal.js.map +1 -1
- package/dist/js/next/components/Wizard/WizardNavItem.d.ts +10 -4
- package/dist/js/next/components/Wizard/WizardNavItem.d.ts.map +1 -1
- package/dist/js/next/components/Wizard/WizardNavItem.js +10 -8
- package/dist/js/next/components/Wizard/WizardNavItem.js.map +1 -1
- package/dist/js/next/components/Wizard/WizardStep.d.ts +3 -3
- package/dist/js/next/components/Wizard/WizardStep.d.ts.map +1 -1
- package/dist/js/next/components/Wizard/WizardStep.js +4 -2
- package/dist/js/next/components/Wizard/WizardStep.js.map +1 -1
- package/dist/js/next/components/Wizard/WizardToggle.d.ts +4 -4
- package/dist/js/next/components/Wizard/WizardToggle.d.ts.map +1 -1
- package/dist/js/next/components/Wizard/WizardToggle.js +1 -1
- package/dist/js/next/components/Wizard/WizardToggle.js.map +1 -1
- package/dist/js/next/components/Wizard/hooks/index.d.ts +1 -0
- package/dist/js/next/components/Wizard/hooks/index.d.ts.map +1 -1
- package/dist/js/next/components/Wizard/hooks/index.js +3 -1
- package/dist/js/next/components/Wizard/hooks/index.js.map +1 -1
- package/dist/js/next/components/Wizard/hooks/useGetMergedSteps.d.ts +9 -0
- package/dist/js/next/components/Wizard/hooks/useGetMergedSteps.d.ts.map +1 -0
- package/dist/js/next/components/Wizard/hooks/useGetMergedSteps.js +38 -0
- package/dist/js/next/components/Wizard/hooks/useGetMergedSteps.js.map +1 -0
- package/dist/js/next/components/Wizard/index.d.ts +2 -2
- package/dist/js/next/components/Wizard/index.d.ts.map +1 -1
- package/dist/js/next/components/Wizard/index.js +4 -2
- package/dist/js/next/components/Wizard/index.js.map +1 -1
- package/dist/js/next/components/Wizard/types.d.ts +13 -19
- package/dist/js/next/components/Wizard/types.d.ts.map +1 -1
- package/dist/js/next/components/Wizard/types.js +7 -1
- package/dist/js/next/components/Wizard/types.js.map +1 -1
- package/dist/js/next/components/Wizard/utils.d.ts +5 -6
- package/dist/js/next/components/Wizard/utils.d.ts.map +1 -1
- package/dist/js/next/components/Wizard/utils.js +17 -25
- package/dist/js/next/components/Wizard/utils.js.map +1 -1
- package/dist/umd/react-core.min.js +2 -2
- package/next/components/Wizard/Wizard.d.ts +11 -14
- package/next/components/Wizard/Wizard.d.ts.map +1 -1
- package/next/components/Wizard/Wizard.js +30 -23
- package/next/components/Wizard/Wizard.js.map +1 -1
- package/next/components/Wizard/WizardContext.d.ts +16 -16
- package/next/components/Wizard/WizardContext.d.ts.map +1 -1
- package/next/components/Wizard/WizardContext.js +17 -19
- package/next/components/Wizard/WizardContext.js.map +1 -1
- package/next/components/Wizard/WizardFooter.d.ts +8 -5
- package/next/components/Wizard/WizardFooter.d.ts.map +1 -1
- package/next/components/Wizard/WizardFooter.js +1 -1
- package/next/components/Wizard/WizardFooter.js.map +1 -1
- package/next/components/Wizard/WizardHeader.d.ts +1 -1
- package/next/components/Wizard/WizardHeader.d.ts.map +1 -1
- package/next/components/Wizard/WizardNavInternal.d.ts +2 -2
- package/next/components/Wizard/WizardNavInternal.d.ts.map +1 -1
- package/next/components/Wizard/WizardNavInternal.js +15 -9
- package/next/components/Wizard/WizardNavInternal.js.map +1 -1
- package/next/components/Wizard/WizardNavItem.d.ts +10 -4
- package/next/components/Wizard/WizardNavItem.d.ts.map +1 -1
- package/next/components/Wizard/WizardNavItem.js +10 -9
- package/next/components/Wizard/WizardNavItem.js.map +1 -1
- package/next/components/Wizard/WizardStep.d.ts +3 -3
- package/next/components/Wizard/WizardStep.d.ts.map +1 -1
- package/next/components/Wizard/WizardStep.js +4 -2
- package/next/components/Wizard/WizardStep.js.map +1 -1
- package/next/components/Wizard/WizardToggle.d.ts +4 -4
- package/next/components/Wizard/WizardToggle.d.ts.map +1 -1
- package/next/components/Wizard/WizardToggle.js +1 -1
- package/next/components/Wizard/WizardToggle.js.map +1 -1
- package/next/components/Wizard/hooks/index.d.ts +1 -0
- package/next/components/Wizard/hooks/index.d.ts.map +1 -1
- package/next/components/Wizard/hooks/index.js +1 -0
- package/next/components/Wizard/hooks/index.js.map +1 -1
- package/next/components/Wizard/hooks/useGetMergedSteps.d.ts +9 -0
- package/next/components/Wizard/hooks/useGetMergedSteps.d.ts.map +1 -0
- package/next/components/Wizard/hooks/useGetMergedSteps.js +33 -0
- package/next/components/Wizard/hooks/useGetMergedSteps.js.map +1 -0
- package/next/components/Wizard/index.d.ts +2 -2
- package/next/components/Wizard/index.d.ts.map +1 -1
- package/next/components/Wizard/index.js +2 -2
- package/next/components/Wizard/index.js.map +1 -1
- package/next/components/Wizard/types.d.ts +13 -19
- package/next/components/Wizard/types.d.ts.map +1 -1
- package/next/components/Wizard/types.js +6 -0
- package/next/components/Wizard/types.js.map +1 -1
- package/next/components/Wizard/utils.d.ts +5 -6
- package/next/components/Wizard/utils.d.ts.map +1 -1
- package/next/components/Wizard/utils.js +15 -22
- package/next/components/Wizard/utils.js.map +1 -1
- package/package.json +2 -2
- package/src/components/Menu/MenuGroup.tsx +2 -2
- package/src/components/Select/Select.tsx +4 -0
- package/src/components/Select/SelectToggle.tsx +14 -3
- package/src/components/Select/examples/Select.md +28 -0
- package/src/next/components/Wizard/Wizard.tsx +71 -46
- package/src/next/components/Wizard/WizardContext.tsx +38 -43
- package/src/next/components/Wizard/WizardFooter.tsx +10 -6
- package/src/next/components/Wizard/WizardHeader.tsx +1 -1
- package/src/next/components/Wizard/WizardNavInternal.tsx +51 -43
- package/src/next/components/Wizard/WizardNavItem.tsx +21 -14
- package/src/next/components/Wizard/WizardStep.tsx +8 -6
- package/src/next/components/Wizard/WizardToggle.tsx +5 -5
- package/src/next/components/Wizard/__tests__/Wizard.test.tsx +129 -26
- package/src/next/components/Wizard/__tests__/WizardStep.test.tsx +5 -5
- package/src/next/components/Wizard/__tests__/WizardToggle.test.tsx +2 -2
- package/src/next/components/Wizard/__tests__/utils.test.tsx +3 -17
- package/src/next/components/Wizard/examples/Wizard.md +69 -41
- package/src/next/components/Wizard/examples/WizardBasic.tsx +6 -12
- package/src/next/components/Wizard/examples/WizardBasicDisabledSteps.tsx +22 -0
- package/src/next/components/Wizard/examples/WizardEnabledOnFormValidation.tsx +84 -0
- package/src/next/components/Wizard/examples/WizardExpandableSteps.tsx +42 -0
- package/src/next/components/Wizard/examples/WizardGetCurrentStep.tsx +53 -0
- package/src/next/components/Wizard/examples/WizardProgressiveSteps.tsx +31 -0
- package/src/next/components/Wizard/examples/WizardStepDrawerContent.tsx +80 -0
- package/src/next/components/Wizard/examples/WizardStepErrorStatus.tsx +55 -0
- package/src/next/components/Wizard/examples/WizardStepVisitRequired.tsx +22 -0
- package/src/next/components/Wizard/examples/WizardToggleStepVisibility.tsx +57 -0
- package/src/next/components/Wizard/examples/WizardValidateOnButtonPress.tsx +183 -0
- package/src/next/components/Wizard/examples/WizardWithCustomFooter.tsx +107 -0
- package/src/next/components/Wizard/examples/{WizardCustomNav.tsx → WizardWithCustomNav.tsx} +11 -11
- package/src/next/components/Wizard/examples/WizardWithCustomNavItem.tsx +22 -0
- package/src/next/components/Wizard/examples/WizardWithHeader.tsx +26 -0
- package/src/next/components/Wizard/examples/WizardWithNavAnchors.tsx +46 -0
- package/src/next/components/Wizard/examples/WizardWithSubmitProgress.tsx +86 -0
- package/src/next/components/Wizard/examples/WizardWithinModal.tsx +41 -0
- package/src/next/components/Wizard/hooks/index.ts +1 -0
- package/src/next/components/Wizard/hooks/useGetMergedSteps.tsx +45 -0
- package/src/next/components/Wizard/index.ts +2 -2
- package/src/next/components/Wizard/types.tsx +19 -29
- package/src/next/components/Wizard/utils.ts +27 -33
- package/src/next/components/Wizard/examples/WizardKitchenSink.tsx +0 -243
|
@@ -6,6 +6,7 @@ propComponents:
|
|
|
6
6
|
[
|
|
7
7
|
'Wizard',
|
|
8
8
|
'WizardFooter',
|
|
9
|
+
'WizardFooterWrapper',
|
|
9
10
|
'WizardToggle',
|
|
10
11
|
'WizardStep',
|
|
11
12
|
'WizardBody',
|
|
@@ -16,7 +17,6 @@ propComponents:
|
|
|
16
17
|
'WizardBasicStep',
|
|
17
18
|
'WizardParentStep',
|
|
18
19
|
'WizardSubStep',
|
|
19
|
-
'WizardNavStepData',
|
|
20
20
|
]
|
|
21
21
|
beta: true
|
|
22
22
|
---
|
|
@@ -49,6 +49,9 @@ WizardNavItem,
|
|
|
49
49
|
WizardNav,
|
|
50
50
|
WizardHeader
|
|
51
51
|
} from '@patternfly/react-core/next';
|
|
52
|
+
import ExternalLinkAltIcon from '@patternfly/react-icons/dist/esm/icons/external-link-alt-icon';
|
|
53
|
+
import SlackHashIcon from '@patternfly/react-icons/dist/esm/icons/slack-hash-icon';
|
|
54
|
+
import CogsIcon from '@patternfly/react-icons/dist/esm/icons/cogs-icon';
|
|
52
55
|
|
|
53
56
|
PatternFly has two implementations of a `Wizard`. This newer `Wizard` takes a more explicit and declarative approach compared to the older implementation, which can be found under the [React](/components/wizard/react) tab.
|
|
54
57
|
|
|
@@ -59,64 +62,89 @@ PatternFly has two implementations of a `Wizard`. This newer `Wizard` takes a mo
|
|
|
59
62
|
```ts file="./WizardBasic.tsx"
|
|
60
63
|
```
|
|
61
64
|
|
|
62
|
-
###
|
|
65
|
+
### Basic with disabled steps
|
|
63
66
|
|
|
64
|
-
|
|
67
|
+
```ts file="./WizardBasicDisabledSteps.tsx"
|
|
68
|
+
```
|
|
65
69
|
|
|
66
|
-
|
|
67
|
-
/** Callback for the Wizard's 'nav' property. Returns element which replaces the Wizard's default navigation. */
|
|
68
|
-
export type CustomWizardNavFunction = (
|
|
69
|
-
isExpanded: boolean,
|
|
70
|
-
steps: WizardControlStep[],
|
|
71
|
-
activeStep: WizardControlStep,
|
|
72
|
-
goToStepByIndex: (index: number) => void
|
|
73
|
-
) => React.ReactElement<WizardNavProps>;
|
|
70
|
+
### Anchors for nav items
|
|
74
71
|
|
|
75
|
-
|
|
76
|
-
type WizardControlStep = WizardBasicStep | WizardParentStep | WizardSubStep;
|
|
72
|
+
```ts file="./WizardWithNavAnchors.tsx"
|
|
77
73
|
```
|
|
78
74
|
|
|
79
|
-
|
|
75
|
+
### Incrementally enabled steps
|
|
76
|
+
|
|
77
|
+
```ts file="./WizardStepVisitRequired.tsx"
|
|
80
78
|
```
|
|
81
79
|
|
|
82
|
-
###
|
|
80
|
+
### Expandable steps
|
|
83
81
|
|
|
84
|
-
|
|
82
|
+
```ts file="./WizardExpandableSteps.tsx"
|
|
83
|
+
```
|
|
85
84
|
|
|
86
|
-
|
|
87
|
-
- Custom footer
|
|
88
|
-
- Sub-steps
|
|
89
|
-
- Step content with a drawer
|
|
90
|
-
- Custom navigation item
|
|
91
|
-
- Disabled navigation items until visited
|
|
92
|
-
- Action to toggle visibility of a step
|
|
93
|
-
- Action to toggle navigation item error status
|
|
85
|
+
### Progress after submission
|
|
94
86
|
|
|
95
|
-
|
|
87
|
+
```ts file="./WizardWithSubmitProgress.tsx"
|
|
88
|
+
```
|
|
96
89
|
|
|
97
|
-
|
|
98
|
-
/** Callback for the Wizard's 'onNext', 'onBack', and 'onNavByIndex' properties */
|
|
99
|
-
type WizardNavStepFunction = (currentStep: WizardNavStepData, previousStep: WizardNavStepData) => void | Promise<void>;
|
|
90
|
+
### Enabled on form validation
|
|
100
91
|
|
|
101
|
-
|
|
102
|
-
type WizardNavStepData = Pick<WizardControlStep, 'id' | 'name'>;
|
|
92
|
+
```ts file="./WizardEnabledOnFormValidation.tsx"
|
|
103
93
|
```
|
|
104
94
|
|
|
105
|
-
|
|
95
|
+
### Validate on button press
|
|
106
96
|
|
|
107
|
-
|
|
97
|
+
```ts file="./WizardValidateOnButtonPress.tsx"
|
|
98
|
+
```
|
|
108
99
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
100
|
+
### Progressive steps
|
|
101
|
+
|
|
102
|
+
```ts file="./WizardProgressiveSteps.tsx"
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
### Get current step
|
|
106
|
+
|
|
107
|
+
```ts file="./WizardGetCurrentStep.tsx"
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
### Within modal
|
|
111
|
+
|
|
112
|
+
```ts file="./WizardWithinModal.tsx"
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### Step drawer content
|
|
116
|
+
|
|
117
|
+
```ts file="./WizardStepDrawerContent.tsx"
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
### Custom navigation
|
|
121
|
+
|
|
122
|
+
```ts file="./WizardWithCustomNav.tsx"
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
### Header
|
|
126
|
+
|
|
127
|
+
```ts file="./WizardWithHeader.tsx"
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
### Custom footer
|
|
131
|
+
|
|
132
|
+
```ts file="./WizardWithCustomFooter.tsx"
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
### Custom navigation item
|
|
136
|
+
|
|
137
|
+
```ts file="./WizardWithCustomNavItem.tsx"
|
|
117
138
|
```
|
|
118
139
|
|
|
119
|
-
|
|
140
|
+
### Toggle step visibility
|
|
141
|
+
|
|
142
|
+
```ts file="./WizardToggleStepVisibility.tsx"
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
### Step error status
|
|
146
|
+
|
|
147
|
+
```ts file="./WizardStepErrorStatus.tsx"
|
|
120
148
|
```
|
|
121
149
|
|
|
122
150
|
## Hooks
|
|
@@ -2,21 +2,15 @@ import React from 'react';
|
|
|
2
2
|
import { Wizard, WizardStep } from '@patternfly/react-core/next';
|
|
3
3
|
|
|
4
4
|
export const WizardBasic: React.FunctionComponent = () => (
|
|
5
|
-
<Wizard height={400}>
|
|
6
|
-
<WizardStep name="
|
|
7
|
-
|
|
5
|
+
<Wizard height={400} title="Basic wizard">
|
|
6
|
+
<WizardStep name="Step 1" id="basic-first-step">
|
|
7
|
+
Step 1 content
|
|
8
8
|
</WizardStep>
|
|
9
|
-
<WizardStep name="
|
|
10
|
-
|
|
11
|
-
</WizardStep>
|
|
12
|
-
<WizardStep name="Third step" id="basic-third-step">
|
|
13
|
-
<p>Step 3 content</p>
|
|
14
|
-
</WizardStep>
|
|
15
|
-
<WizardStep name="Fourth step" id="basic-fourth-step">
|
|
16
|
-
<p>Step 4 content</p>
|
|
9
|
+
<WizardStep name="Step 2" id="basic-second-step">
|
|
10
|
+
Step 2 content
|
|
17
11
|
</WizardStep>
|
|
18
12
|
<WizardStep name="Review" id="basic-review-step" footer={{ nextButtonText: 'Finish' }}>
|
|
19
|
-
|
|
13
|
+
Review step content
|
|
20
14
|
</WizardStep>
|
|
21
15
|
</Wizard>
|
|
22
16
|
);
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Wizard, WizardStep } from '@patternfly/react-core/next';
|
|
3
|
+
|
|
4
|
+
export const WizardBasicDisabledSteps: React.FunctionComponent = () => (
|
|
5
|
+
<Wizard height={400} title="Basic disabled wizard">
|
|
6
|
+
<WizardStep name="Step 1" id="bdisabled-first-step">
|
|
7
|
+
Step 1 content
|
|
8
|
+
</WizardStep>
|
|
9
|
+
<WizardStep name="Step 2" id="bdisabled-second-step" isDisabled>
|
|
10
|
+
Step 2 content
|
|
11
|
+
</WizardStep>
|
|
12
|
+
<WizardStep name="Step 3" id="bdisabled-third-step">
|
|
13
|
+
Step 3 content
|
|
14
|
+
</WizardStep>
|
|
15
|
+
<WizardStep name="Step 4" id="bdisabled-fourth-step" isDisabled>
|
|
16
|
+
Step 4 content
|
|
17
|
+
</WizardStep>
|
|
18
|
+
<WizardStep name="Review" id="bdisabled-review-step" footer={{ nextButtonText: 'Finish' }}>
|
|
19
|
+
Review step content
|
|
20
|
+
</WizardStep>
|
|
21
|
+
</Wizard>
|
|
22
|
+
);
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import { Form, FormGroup, TextInput } from '@patternfly/react-core';
|
|
4
|
+
import { Wizard, WizardStep } from '@patternfly/react-core/next';
|
|
5
|
+
|
|
6
|
+
interface SampleFormProps {
|
|
7
|
+
value: string;
|
|
8
|
+
isValid: boolean;
|
|
9
|
+
setValue: (value: string) => void;
|
|
10
|
+
setIsValid: (isValid: boolean) => void;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const SampleForm: React.FunctionComponent<SampleFormProps> = ({ value, isValid, setValue, setIsValid }) => {
|
|
14
|
+
const validated = isValid ? 'default' : 'error';
|
|
15
|
+
|
|
16
|
+
const handleTextInputChange = (value: string) => {
|
|
17
|
+
const isValid = /^\d+$/.test(value);
|
|
18
|
+
|
|
19
|
+
setValue(value);
|
|
20
|
+
setIsValid(isValid);
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
return (
|
|
24
|
+
<Form>
|
|
25
|
+
<FormGroup
|
|
26
|
+
label="Age:"
|
|
27
|
+
type="number"
|
|
28
|
+
helperText="Write your age in numbers."
|
|
29
|
+
helperTextInvalid="Age has to be a number"
|
|
30
|
+
fieldId="age"
|
|
31
|
+
validated={validated}
|
|
32
|
+
>
|
|
33
|
+
<TextInput
|
|
34
|
+
validated={validated}
|
|
35
|
+
value={value}
|
|
36
|
+
id="age"
|
|
37
|
+
aria-describedby="age-helper"
|
|
38
|
+
onChange={handleTextInputChange}
|
|
39
|
+
/>
|
|
40
|
+
</FormGroup>
|
|
41
|
+
</Form>
|
|
42
|
+
);
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
export const WizardEnabledOnFormValidation: React.FunctionComponent = () => {
|
|
46
|
+
const [ageValue, setAgeValue] = React.useState('Thirty');
|
|
47
|
+
const [isSubAFormValid, setIsSubAFormValid] = React.useState(false);
|
|
48
|
+
|
|
49
|
+
const onSave = () => alert(`Wow, you look a lot younger than ${ageValue}.`);
|
|
50
|
+
|
|
51
|
+
return (
|
|
52
|
+
<Wizard isVisitRequired height={400} title="Enabled on form validation wizard" onSave={onSave}>
|
|
53
|
+
<WizardStep name="Information" id="form-valid-info">
|
|
54
|
+
Information content
|
|
55
|
+
</WizardStep>
|
|
56
|
+
<WizardStep
|
|
57
|
+
name="Configuration"
|
|
58
|
+
id="form-valid-config"
|
|
59
|
+
steps={[
|
|
60
|
+
<WizardStep
|
|
61
|
+
name="Substep A with validation"
|
|
62
|
+
id="form-valid-sub-a"
|
|
63
|
+
key="form-valid-sub-a"
|
|
64
|
+
footer={{ isNextDisabled: !isSubAFormValid }}
|
|
65
|
+
>
|
|
66
|
+
<SampleForm
|
|
67
|
+
value={ageValue}
|
|
68
|
+
setValue={setAgeValue}
|
|
69
|
+
isValid={isSubAFormValid}
|
|
70
|
+
setIsValid={setIsSubAFormValid}
|
|
71
|
+
/>
|
|
72
|
+
</WizardStep>,
|
|
73
|
+
<WizardStep name="Substep B" id="form-valid-sub-b" key="form-valid-sub-b">
|
|
74
|
+
Substep B content
|
|
75
|
+
</WizardStep>
|
|
76
|
+
]}
|
|
77
|
+
/>
|
|
78
|
+
<WizardStep name="Additional" id="form-valid-additional">
|
|
79
|
+
Additional step content
|
|
80
|
+
</WizardStep>
|
|
81
|
+
<WizardStep name="Review" id="form-valid-review" footer={{ nextButtonText: 'Submit form' }}></WizardStep>
|
|
82
|
+
</Wizard>
|
|
83
|
+
);
|
|
84
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Wizard, WizardStep } from '@patternfly/react-core/next';
|
|
3
|
+
|
|
4
|
+
export const WizardExpandableSteps: React.FunctionComponent = () => (
|
|
5
|
+
<Wizard height={400} title="Expandable steps wizard" nav={{ isExpanded: true }}>
|
|
6
|
+
<WizardStep
|
|
7
|
+
name="Step 1"
|
|
8
|
+
id="expand-steps-1"
|
|
9
|
+
isExpandable
|
|
10
|
+
steps={[
|
|
11
|
+
<WizardStep name="Substep A" id="expand-steps-sub-a" key="expand-steps-sub-a">
|
|
12
|
+
Substep A content
|
|
13
|
+
</WizardStep>,
|
|
14
|
+
<WizardStep name="Substep B" id="expand-steps-sub-b" key="expand-steps-sub-b">
|
|
15
|
+
Substep B content
|
|
16
|
+
</WizardStep>
|
|
17
|
+
]}
|
|
18
|
+
/>
|
|
19
|
+
<WizardStep name="Step 2" id="expand-steps-2">
|
|
20
|
+
Step 2 content
|
|
21
|
+
</WizardStep>
|
|
22
|
+
<WizardStep
|
|
23
|
+
name="Step 3"
|
|
24
|
+
id="expand-steps-3"
|
|
25
|
+
isExpandable
|
|
26
|
+
steps={[
|
|
27
|
+
<WizardStep name="Substep C" id="expand-steps-sub-c" key="expand-steps-sub-c">
|
|
28
|
+
Substep C content
|
|
29
|
+
</WizardStep>,
|
|
30
|
+
<WizardStep name="Substep D" id="expand-steps-sub-d" key="expand-steps-sub-d">
|
|
31
|
+
Substep D content
|
|
32
|
+
</WizardStep>
|
|
33
|
+
]}
|
|
34
|
+
/>
|
|
35
|
+
<WizardStep name="Step 4" id="expand-steps-4">
|
|
36
|
+
Step 4 content
|
|
37
|
+
</WizardStep>
|
|
38
|
+
<WizardStep name="Review" id="expand-steps-review" footer={{ nextButtonText: 'Finish' }}>
|
|
39
|
+
Review step content
|
|
40
|
+
</WizardStep>
|
|
41
|
+
</Wizard>
|
|
42
|
+
);
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {
|
|
3
|
+
DescriptionList,
|
|
4
|
+
DescriptionListGroup,
|
|
5
|
+
DescriptionListTerm,
|
|
6
|
+
DescriptionListDescription
|
|
7
|
+
} from '@patternfly/react-core';
|
|
8
|
+
import { Wizard, WizardStep, WizardStepType } from '@patternfly/react-core/next';
|
|
9
|
+
|
|
10
|
+
const CurrentStepDescriptionList = ({ currentStep }: { currentStep: WizardStepType | undefined }) => (
|
|
11
|
+
<DescriptionList isHorizontal isCompact>
|
|
12
|
+
<DescriptionListGroup>
|
|
13
|
+
<DescriptionListTerm>Index</DescriptionListTerm>
|
|
14
|
+
<DescriptionListDescription>{currentStep?.index}</DescriptionListDescription>
|
|
15
|
+
</DescriptionListGroup>
|
|
16
|
+
|
|
17
|
+
<DescriptionListGroup>
|
|
18
|
+
<DescriptionListTerm>ID</DescriptionListTerm>
|
|
19
|
+
<DescriptionListDescription>{currentStep?.id}</DescriptionListDescription>
|
|
20
|
+
</DescriptionListGroup>
|
|
21
|
+
|
|
22
|
+
<DescriptionListGroup>
|
|
23
|
+
<DescriptionListTerm>Name</DescriptionListTerm>
|
|
24
|
+
<DescriptionListDescription>{currentStep?.name}</DescriptionListDescription>
|
|
25
|
+
</DescriptionListGroup>
|
|
26
|
+
|
|
27
|
+
<DescriptionListGroup>
|
|
28
|
+
<DescriptionListTerm>Visited</DescriptionListTerm>
|
|
29
|
+
<DescriptionListDescription>{currentStep?.isVisited ? 'true' : 'false'}</DescriptionListDescription>
|
|
30
|
+
</DescriptionListGroup>
|
|
31
|
+
</DescriptionList>
|
|
32
|
+
);
|
|
33
|
+
|
|
34
|
+
export const GetCurrentStepWizard: React.FunctionComponent = () => {
|
|
35
|
+
const [currentStep, setCurrentStep] = React.useState<WizardStepType>();
|
|
36
|
+
|
|
37
|
+
const onStepChange = (event: React.MouseEvent<HTMLButtonElement>, currentStep: WizardStepType) =>
|
|
38
|
+
setCurrentStep(currentStep);
|
|
39
|
+
|
|
40
|
+
return (
|
|
41
|
+
<Wizard height={400} title="Get current step wizard" onStepChange={onStepChange}>
|
|
42
|
+
<WizardStep name="Step 1" id="get-current-step-1">
|
|
43
|
+
{currentStep ? <CurrentStepDescriptionList currentStep={currentStep} /> : 'Step 1 content'}
|
|
44
|
+
</WizardStep>
|
|
45
|
+
<WizardStep name="Step 2" id="get-current-step-2">
|
|
46
|
+
<CurrentStepDescriptionList currentStep={currentStep} />
|
|
47
|
+
</WizardStep>
|
|
48
|
+
<WizardStep name="Review" id="get-current-review-step" footer={{ nextButtonText: 'Finish' }}>
|
|
49
|
+
<CurrentStepDescriptionList currentStep={currentStep} />
|
|
50
|
+
</WizardStep>
|
|
51
|
+
</Wizard>
|
|
52
|
+
);
|
|
53
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Wizard, WizardStep } from '@patternfly/react-core/next';
|
|
3
|
+
|
|
4
|
+
export const WizardProgressiveSteps: React.FunctionComponent = () => (
|
|
5
|
+
<Wizard height={400} title="Progressive steps wizard" isProgressive>
|
|
6
|
+
<WizardStep id="progressive-step-1" name="Get started">
|
|
7
|
+
Get started content
|
|
8
|
+
</WizardStep>
|
|
9
|
+
<WizardStep id="progressive-step-2" name="Update options">
|
|
10
|
+
Update options content
|
|
11
|
+
</WizardStep>
|
|
12
|
+
<WizardStep
|
|
13
|
+
id="progressive-step-3"
|
|
14
|
+
name="Quick options"
|
|
15
|
+
steps={[
|
|
16
|
+
<WizardStep key="progressive-substep-1" id="progressive-substep-1" name="Substep 1">
|
|
17
|
+
Substep 1 content
|
|
18
|
+
</WizardStep>,
|
|
19
|
+
<WizardStep key="progressive-substep-2" id="progressive-substep-2" name="Substep 2">
|
|
20
|
+
Substep 2 content
|
|
21
|
+
</WizardStep>,
|
|
22
|
+
<WizardStep key="progressive-substep-3" id="progressive-substep-3" name="Substep 3">
|
|
23
|
+
Substep 3 content
|
|
24
|
+
</WizardStep>
|
|
25
|
+
]}
|
|
26
|
+
/>
|
|
27
|
+
<WizardStep id="progressive-step-4" name="Review" footer={{ nextButtonText: 'Finish' }}>
|
|
28
|
+
Review content
|
|
29
|
+
</WizardStep>
|
|
30
|
+
</Wizard>
|
|
31
|
+
);
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
Drawer,
|
|
5
|
+
DrawerContent,
|
|
6
|
+
DrawerPanelContent,
|
|
7
|
+
DrawerColorVariant,
|
|
8
|
+
DrawerHead,
|
|
9
|
+
DrawerActions,
|
|
10
|
+
DrawerCloseButton,
|
|
11
|
+
Flex,
|
|
12
|
+
Button
|
|
13
|
+
} from '@patternfly/react-core';
|
|
14
|
+
import { useWizardContext, Wizard, WizardStep } from '@patternfly/react-core/next';
|
|
15
|
+
|
|
16
|
+
const StepContentWithDrawer: React.FunctionComponent = () => {
|
|
17
|
+
const [isDrawerExpanded, setIsDrawerExpanded] = React.useState(false);
|
|
18
|
+
const { activeStep } = useWizardContext();
|
|
19
|
+
const drawerRef = React.useRef<HTMLSpanElement>(null);
|
|
20
|
+
|
|
21
|
+
const onWizardExpand = () => drawerRef.current && drawerRef.current.focus();
|
|
22
|
+
|
|
23
|
+
return (
|
|
24
|
+
<Drawer isInline isExpanded={isDrawerExpanded} onExpand={onWizardExpand}>
|
|
25
|
+
<DrawerContent
|
|
26
|
+
panelContent={
|
|
27
|
+
<DrawerPanelContent widths={{ default: 'width_50' }} colorVariant={DrawerColorVariant.light200}>
|
|
28
|
+
<DrawerHead>
|
|
29
|
+
<span tabIndex={isDrawerExpanded ? 0 : -1} ref={drawerRef}>
|
|
30
|
+
Drawer content: <strong>{activeStep?.name}</strong>
|
|
31
|
+
</span>
|
|
32
|
+
<DrawerActions>
|
|
33
|
+
<DrawerCloseButton onClick={() => setIsDrawerExpanded(false)} />
|
|
34
|
+
</DrawerActions>
|
|
35
|
+
</DrawerHead>
|
|
36
|
+
</DrawerPanelContent>
|
|
37
|
+
}
|
|
38
|
+
>
|
|
39
|
+
<Flex
|
|
40
|
+
className="pf-c-wizard__main-body"
|
|
41
|
+
direction={{ default: 'column' }}
|
|
42
|
+
spaceItems={{ default: 'spaceItemsLg' }}
|
|
43
|
+
height="100%"
|
|
44
|
+
>
|
|
45
|
+
{!isDrawerExpanded && (
|
|
46
|
+
<Button isInline variant="link" onClick={() => setIsDrawerExpanded(prevExpanded => !prevExpanded)}>
|
|
47
|
+
Open drawer
|
|
48
|
+
</Button>
|
|
49
|
+
)}
|
|
50
|
+
<div>{activeStep?.name} content</div>
|
|
51
|
+
</Flex>
|
|
52
|
+
</DrawerContent>
|
|
53
|
+
</Drawer>
|
|
54
|
+
);
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
export const WizardStepDrawerContent: React.FunctionComponent = () => (
|
|
58
|
+
<Wizard height={400} title="With drawer wizard">
|
|
59
|
+
<WizardStep body={null} name="Step 1" id="with-drawer-step-1">
|
|
60
|
+
<StepContentWithDrawer />
|
|
61
|
+
</WizardStep>
|
|
62
|
+
<WizardStep
|
|
63
|
+
name="Step 2"
|
|
64
|
+
id="with-drawer-step-2"
|
|
65
|
+
steps={[
|
|
66
|
+
<WizardStep body={null} key="with-drawer-substep-1" name="Substep 1" id="with-drawer-substep-1">
|
|
67
|
+
<StepContentWithDrawer />
|
|
68
|
+
</WizardStep>,
|
|
69
|
+
<WizardStep body={null} key="with-drawer-substep-2" name="Substep 2" id="with-drawer-substep-2">
|
|
70
|
+
<StepContentWithDrawer />
|
|
71
|
+
</WizardStep>
|
|
72
|
+
]}
|
|
73
|
+
>
|
|
74
|
+
<StepContentWithDrawer />
|
|
75
|
+
</WizardStep>
|
|
76
|
+
<WizardStep name="Review" id="with-drawer-review-step" footer={{ nextButtonText: 'Finish' }}>
|
|
77
|
+
Review step content
|
|
78
|
+
</WizardStep>
|
|
79
|
+
</Wizard>
|
|
80
|
+
);
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import { Checkbox } from '@patternfly/react-core';
|
|
4
|
+
import { Wizard, WizardStep } from '@patternfly/react-core/next';
|
|
5
|
+
|
|
6
|
+
interface SomeContextProps {
|
|
7
|
+
errorMessage: string | undefined;
|
|
8
|
+
setErrorMessage(error: string | undefined): void;
|
|
9
|
+
}
|
|
10
|
+
type SomeContextRenderProps = Pick<SomeContextProps, 'errorMessage'>;
|
|
11
|
+
interface SomeContextProviderProps {
|
|
12
|
+
children: (context: SomeContextRenderProps) => React.ReactElement;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const SomeContext: React.Context<SomeContextProps> = React.createContext({} as SomeContextProps);
|
|
16
|
+
|
|
17
|
+
const SomeContextProvider = ({ children }: SomeContextProviderProps) => {
|
|
18
|
+
const [errorMessage, setErrorMessage] = React.useState<string>();
|
|
19
|
+
|
|
20
|
+
return (
|
|
21
|
+
<SomeContext.Provider value={{ errorMessage, setErrorMessage }}>{children({ errorMessage })}</SomeContext.Provider>
|
|
22
|
+
);
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
const StepContentWithAction = () => {
|
|
26
|
+
const { errorMessage, setErrorMessage } = React.useContext(SomeContext);
|
|
27
|
+
|
|
28
|
+
return (
|
|
29
|
+
<Checkbox
|
|
30
|
+
label="Give step 1 an error status"
|
|
31
|
+
isChecked={!!errorMessage}
|
|
32
|
+
onChange={checked => setErrorMessage(checked ? 'Some error message' : undefined)}
|
|
33
|
+
id="toggle-error-checkbox"
|
|
34
|
+
name="Toggle Error Checkbox"
|
|
35
|
+
/>
|
|
36
|
+
);
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export const WizardStepErrorStatus: React.FunctionComponent = () => (
|
|
40
|
+
<SomeContextProvider>
|
|
41
|
+
{({ errorMessage }) => (
|
|
42
|
+
<Wizard height={400} title="Step error status wizard">
|
|
43
|
+
<WizardStep status={errorMessage ? 'error' : 'default'} id="error-status-step-1" name="Step 1">
|
|
44
|
+
Step 1 content
|
|
45
|
+
</WizardStep>
|
|
46
|
+
<WizardStep name="Error action step" id="error-status-step-2">
|
|
47
|
+
<StepContentWithAction />
|
|
48
|
+
</WizardStep>
|
|
49
|
+
<WizardStep name="Review" id="error-status-review-step" footer={{ nextButtonText: 'Finish' }}>
|
|
50
|
+
Review step content
|
|
51
|
+
</WizardStep>
|
|
52
|
+
</Wizard>
|
|
53
|
+
)}
|
|
54
|
+
</SomeContextProvider>
|
|
55
|
+
);
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Wizard, WizardStep } from '@patternfly/react-core/next';
|
|
3
|
+
|
|
4
|
+
export const WizardStepVisitRequired: React.FunctionComponent = () => (
|
|
5
|
+
<Wizard height={400} title="Incrementally enabled steps wizard" isVisitRequired>
|
|
6
|
+
<WizardStep name="Step 1" id="req-visit-first-step">
|
|
7
|
+
Step 1 content
|
|
8
|
+
</WizardStep>
|
|
9
|
+
<WizardStep name="Step 2" id="req-visit-second-step">
|
|
10
|
+
Step 2 content
|
|
11
|
+
</WizardStep>
|
|
12
|
+
<WizardStep name="Step 3" id="req-visit-third-step">
|
|
13
|
+
Step 3 content
|
|
14
|
+
</WizardStep>
|
|
15
|
+
<WizardStep name="Step 4" id="req-visit-fourth-step">
|
|
16
|
+
Step 4 content
|
|
17
|
+
</WizardStep>
|
|
18
|
+
<WizardStep name="Review" id="req-visit-review-step" footer={{ nextButtonText: 'Finish' }}>
|
|
19
|
+
Review step content
|
|
20
|
+
</WizardStep>
|
|
21
|
+
</Wizard>
|
|
22
|
+
);
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import { Checkbox } from '@patternfly/react-core';
|
|
4
|
+
import { Wizard, WizardStep } from '@patternfly/react-core/next';
|
|
5
|
+
|
|
6
|
+
interface SomeContextProps {
|
|
7
|
+
isToggleStepChecked: boolean;
|
|
8
|
+
setIsToggleStepChecked(isHidden: boolean): void;
|
|
9
|
+
}
|
|
10
|
+
type SomeContextRenderProps = Pick<SomeContextProps, 'isToggleStepChecked'>;
|
|
11
|
+
interface SomeContextProviderProps {
|
|
12
|
+
children: (context: SomeContextRenderProps) => React.ReactElement;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const SomeContext: React.Context<SomeContextProps> = React.createContext({} as SomeContextProps);
|
|
16
|
+
|
|
17
|
+
const SomeContextProvider: React.FunctionComponent<SomeContextProviderProps> = ({ children }) => {
|
|
18
|
+
const [isToggleStepChecked, setIsToggleStepChecked] = React.useState(false);
|
|
19
|
+
|
|
20
|
+
return (
|
|
21
|
+
<SomeContext.Provider value={{ isToggleStepChecked, setIsToggleStepChecked }}>
|
|
22
|
+
{children({ isToggleStepChecked })}
|
|
23
|
+
</SomeContext.Provider>
|
|
24
|
+
);
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
const StepContentWithAction: React.FunctionComponent = () => {
|
|
28
|
+
const { isToggleStepChecked, setIsToggleStepChecked } = React.useContext(SomeContext);
|
|
29
|
+
|
|
30
|
+
return (
|
|
31
|
+
<Checkbox
|
|
32
|
+
label="Toggle visibility of the next step"
|
|
33
|
+
isChecked={isToggleStepChecked}
|
|
34
|
+
onChange={checked => setIsToggleStepChecked(checked)}
|
|
35
|
+
id="toggle-hide-step-checkbox"
|
|
36
|
+
name="Toggle Hide Step Checkbox"
|
|
37
|
+
/>
|
|
38
|
+
);
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export const WizardToggleStepVisibility: React.FunctionComponent = () => (
|
|
42
|
+
<SomeContextProvider>
|
|
43
|
+
{({ isToggleStepChecked }) => (
|
|
44
|
+
<Wizard height={400} title="Toggle step visibility wizard">
|
|
45
|
+
<WizardStep name="Hidden action step" id="toggle-visible-step-1">
|
|
46
|
+
<StepContentWithAction />
|
|
47
|
+
</WizardStep>
|
|
48
|
+
<WizardStep name="Step 2" id="toggle-visible-step-2" isHidden={isToggleStepChecked}>
|
|
49
|
+
Step 2 content
|
|
50
|
+
</WizardStep>
|
|
51
|
+
<WizardStep name="Review" id="toggle-visible-review-step" footer={{ nextButtonText: 'Finish' }}>
|
|
52
|
+
Review step content
|
|
53
|
+
</WizardStep>
|
|
54
|
+
</Wizard>
|
|
55
|
+
)}
|
|
56
|
+
</SomeContextProvider>
|
|
57
|
+
);
|