@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.
Files changed (227) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/components/Menu/MenuGroup.d.ts +1 -1
  3. package/components/Menu/MenuGroup.d.ts.map +1 -1
  4. package/components/Menu/MenuGroup.js.map +1 -1
  5. package/components/Select/Select.d.ts +2 -0
  6. package/components/Select/Select.d.ts.map +1 -1
  7. package/components/Select/Select.js +3 -3
  8. package/components/Select/Select.js.map +1 -1
  9. package/components/Select/SelectToggle.d.ts +4 -14
  10. package/components/Select/SelectToggle.d.ts.map +1 -1
  11. package/components/Select/SelectToggle.js +11 -5
  12. package/components/Select/SelectToggle.js.map +1 -1
  13. package/dist/esm/components/Menu/MenuGroup.d.ts +1 -1
  14. package/dist/esm/components/Menu/MenuGroup.d.ts.map +1 -1
  15. package/dist/esm/components/Menu/MenuGroup.js.map +1 -1
  16. package/dist/esm/components/Select/Select.d.ts +2 -0
  17. package/dist/esm/components/Select/Select.d.ts.map +1 -1
  18. package/dist/esm/components/Select/Select.js +3 -3
  19. package/dist/esm/components/Select/Select.js.map +1 -1
  20. package/dist/esm/components/Select/SelectToggle.d.ts +4 -14
  21. package/dist/esm/components/Select/SelectToggle.d.ts.map +1 -1
  22. package/dist/esm/components/Select/SelectToggle.js +11 -5
  23. package/dist/esm/components/Select/SelectToggle.js.map +1 -1
  24. package/dist/esm/next/components/Wizard/Wizard.d.ts +11 -14
  25. package/dist/esm/next/components/Wizard/Wizard.d.ts.map +1 -1
  26. package/dist/esm/next/components/Wizard/Wizard.js +30 -23
  27. package/dist/esm/next/components/Wizard/Wizard.js.map +1 -1
  28. package/dist/esm/next/components/Wizard/WizardContext.d.ts +16 -16
  29. package/dist/esm/next/components/Wizard/WizardContext.d.ts.map +1 -1
  30. package/dist/esm/next/components/Wizard/WizardContext.js +17 -19
  31. package/dist/esm/next/components/Wizard/WizardContext.js.map +1 -1
  32. package/dist/esm/next/components/Wizard/WizardFooter.d.ts +8 -5
  33. package/dist/esm/next/components/Wizard/WizardFooter.d.ts.map +1 -1
  34. package/dist/esm/next/components/Wizard/WizardFooter.js +1 -1
  35. package/dist/esm/next/components/Wizard/WizardFooter.js.map +1 -1
  36. package/dist/esm/next/components/Wizard/WizardHeader.d.ts +1 -1
  37. package/dist/esm/next/components/Wizard/WizardHeader.d.ts.map +1 -1
  38. package/dist/esm/next/components/Wizard/WizardNavInternal.d.ts +2 -2
  39. package/dist/esm/next/components/Wizard/WizardNavInternal.d.ts.map +1 -1
  40. package/dist/esm/next/components/Wizard/WizardNavInternal.js +15 -9
  41. package/dist/esm/next/components/Wizard/WizardNavInternal.js.map +1 -1
  42. package/dist/esm/next/components/Wizard/WizardNavItem.d.ts +10 -4
  43. package/dist/esm/next/components/Wizard/WizardNavItem.d.ts.map +1 -1
  44. package/dist/esm/next/components/Wizard/WizardNavItem.js +10 -9
  45. package/dist/esm/next/components/Wizard/WizardNavItem.js.map +1 -1
  46. package/dist/esm/next/components/Wizard/WizardStep.d.ts +3 -3
  47. package/dist/esm/next/components/Wizard/WizardStep.d.ts.map +1 -1
  48. package/dist/esm/next/components/Wizard/WizardStep.js +4 -2
  49. package/dist/esm/next/components/Wizard/WizardStep.js.map +1 -1
  50. package/dist/esm/next/components/Wizard/WizardToggle.d.ts +4 -4
  51. package/dist/esm/next/components/Wizard/WizardToggle.d.ts.map +1 -1
  52. package/dist/esm/next/components/Wizard/WizardToggle.js +1 -1
  53. package/dist/esm/next/components/Wizard/WizardToggle.js.map +1 -1
  54. package/dist/esm/next/components/Wizard/hooks/index.d.ts +1 -0
  55. package/dist/esm/next/components/Wizard/hooks/index.d.ts.map +1 -1
  56. package/dist/esm/next/components/Wizard/hooks/index.js +1 -0
  57. package/dist/esm/next/components/Wizard/hooks/index.js.map +1 -1
  58. package/dist/esm/next/components/Wizard/hooks/useGetMergedSteps.d.ts +9 -0
  59. package/dist/esm/next/components/Wizard/hooks/useGetMergedSteps.d.ts.map +1 -0
  60. package/dist/esm/next/components/Wizard/hooks/useGetMergedSteps.js +33 -0
  61. package/dist/esm/next/components/Wizard/hooks/useGetMergedSteps.js.map +1 -0
  62. package/dist/esm/next/components/Wizard/index.d.ts +2 -2
  63. package/dist/esm/next/components/Wizard/index.d.ts.map +1 -1
  64. package/dist/esm/next/components/Wizard/index.js +2 -2
  65. package/dist/esm/next/components/Wizard/index.js.map +1 -1
  66. package/dist/esm/next/components/Wizard/types.d.ts +13 -19
  67. package/dist/esm/next/components/Wizard/types.d.ts.map +1 -1
  68. package/dist/esm/next/components/Wizard/types.js +6 -0
  69. package/dist/esm/next/components/Wizard/types.js.map +1 -1
  70. package/dist/esm/next/components/Wizard/utils.d.ts +5 -6
  71. package/dist/esm/next/components/Wizard/utils.d.ts.map +1 -1
  72. package/dist/esm/next/components/Wizard/utils.js +15 -22
  73. package/dist/esm/next/components/Wizard/utils.js.map +1 -1
  74. package/dist/js/components/Menu/MenuGroup.d.ts +1 -1
  75. package/dist/js/components/Menu/MenuGroup.d.ts.map +1 -1
  76. package/dist/js/components/Menu/MenuGroup.js.map +1 -1
  77. package/dist/js/components/Select/Select.d.ts +2 -0
  78. package/dist/js/components/Select/Select.d.ts.map +1 -1
  79. package/dist/js/components/Select/Select.js +3 -3
  80. package/dist/js/components/Select/Select.js.map +1 -1
  81. package/dist/js/components/Select/SelectToggle.d.ts +4 -14
  82. package/dist/js/components/Select/SelectToggle.d.ts.map +1 -1
  83. package/dist/js/components/Select/SelectToggle.js +11 -6
  84. package/dist/js/components/Select/SelectToggle.js.map +1 -1
  85. package/dist/js/next/components/Wizard/Wizard.d.ts +11 -14
  86. package/dist/js/next/components/Wizard/Wizard.d.ts.map +1 -1
  87. package/dist/js/next/components/Wizard/Wizard.js +28 -21
  88. package/dist/js/next/components/Wizard/Wizard.js.map +1 -1
  89. package/dist/js/next/components/Wizard/WizardContext.d.ts +16 -16
  90. package/dist/js/next/components/Wizard/WizardContext.d.ts.map +1 -1
  91. package/dist/js/next/components/Wizard/WizardContext.js +16 -17
  92. package/dist/js/next/components/Wizard/WizardContext.js.map +1 -1
  93. package/dist/js/next/components/Wizard/WizardFooter.d.ts +8 -5
  94. package/dist/js/next/components/Wizard/WizardFooter.d.ts.map +1 -1
  95. package/dist/js/next/components/Wizard/WizardFooter.js +1 -1
  96. package/dist/js/next/components/Wizard/WizardFooter.js.map +1 -1
  97. package/dist/js/next/components/Wizard/WizardHeader.d.ts +1 -1
  98. package/dist/js/next/components/Wizard/WizardHeader.d.ts.map +1 -1
  99. package/dist/js/next/components/Wizard/WizardNavInternal.d.ts +2 -2
  100. package/dist/js/next/components/Wizard/WizardNavInternal.d.ts.map +1 -1
  101. package/dist/js/next/components/Wizard/WizardNavInternal.js +15 -9
  102. package/dist/js/next/components/Wizard/WizardNavInternal.js.map +1 -1
  103. package/dist/js/next/components/Wizard/WizardNavItem.d.ts +10 -4
  104. package/dist/js/next/components/Wizard/WizardNavItem.d.ts.map +1 -1
  105. package/dist/js/next/components/Wizard/WizardNavItem.js +10 -8
  106. package/dist/js/next/components/Wizard/WizardNavItem.js.map +1 -1
  107. package/dist/js/next/components/Wizard/WizardStep.d.ts +3 -3
  108. package/dist/js/next/components/Wizard/WizardStep.d.ts.map +1 -1
  109. package/dist/js/next/components/Wizard/WizardStep.js +4 -2
  110. package/dist/js/next/components/Wizard/WizardStep.js.map +1 -1
  111. package/dist/js/next/components/Wizard/WizardToggle.d.ts +4 -4
  112. package/dist/js/next/components/Wizard/WizardToggle.d.ts.map +1 -1
  113. package/dist/js/next/components/Wizard/WizardToggle.js +1 -1
  114. package/dist/js/next/components/Wizard/WizardToggle.js.map +1 -1
  115. package/dist/js/next/components/Wizard/hooks/index.d.ts +1 -0
  116. package/dist/js/next/components/Wizard/hooks/index.d.ts.map +1 -1
  117. package/dist/js/next/components/Wizard/hooks/index.js +3 -1
  118. package/dist/js/next/components/Wizard/hooks/index.js.map +1 -1
  119. package/dist/js/next/components/Wizard/hooks/useGetMergedSteps.d.ts +9 -0
  120. package/dist/js/next/components/Wizard/hooks/useGetMergedSteps.d.ts.map +1 -0
  121. package/dist/js/next/components/Wizard/hooks/useGetMergedSteps.js +38 -0
  122. package/dist/js/next/components/Wizard/hooks/useGetMergedSteps.js.map +1 -0
  123. package/dist/js/next/components/Wizard/index.d.ts +2 -2
  124. package/dist/js/next/components/Wizard/index.d.ts.map +1 -1
  125. package/dist/js/next/components/Wizard/index.js +4 -2
  126. package/dist/js/next/components/Wizard/index.js.map +1 -1
  127. package/dist/js/next/components/Wizard/types.d.ts +13 -19
  128. package/dist/js/next/components/Wizard/types.d.ts.map +1 -1
  129. package/dist/js/next/components/Wizard/types.js +7 -1
  130. package/dist/js/next/components/Wizard/types.js.map +1 -1
  131. package/dist/js/next/components/Wizard/utils.d.ts +5 -6
  132. package/dist/js/next/components/Wizard/utils.d.ts.map +1 -1
  133. package/dist/js/next/components/Wizard/utils.js +17 -25
  134. package/dist/js/next/components/Wizard/utils.js.map +1 -1
  135. package/dist/umd/react-core.min.js +2 -2
  136. package/next/components/Wizard/Wizard.d.ts +11 -14
  137. package/next/components/Wizard/Wizard.d.ts.map +1 -1
  138. package/next/components/Wizard/Wizard.js +30 -23
  139. package/next/components/Wizard/Wizard.js.map +1 -1
  140. package/next/components/Wizard/WizardContext.d.ts +16 -16
  141. package/next/components/Wizard/WizardContext.d.ts.map +1 -1
  142. package/next/components/Wizard/WizardContext.js +17 -19
  143. package/next/components/Wizard/WizardContext.js.map +1 -1
  144. package/next/components/Wizard/WizardFooter.d.ts +8 -5
  145. package/next/components/Wizard/WizardFooter.d.ts.map +1 -1
  146. package/next/components/Wizard/WizardFooter.js +1 -1
  147. package/next/components/Wizard/WizardFooter.js.map +1 -1
  148. package/next/components/Wizard/WizardHeader.d.ts +1 -1
  149. package/next/components/Wizard/WizardHeader.d.ts.map +1 -1
  150. package/next/components/Wizard/WizardNavInternal.d.ts +2 -2
  151. package/next/components/Wizard/WizardNavInternal.d.ts.map +1 -1
  152. package/next/components/Wizard/WizardNavInternal.js +15 -9
  153. package/next/components/Wizard/WizardNavInternal.js.map +1 -1
  154. package/next/components/Wizard/WizardNavItem.d.ts +10 -4
  155. package/next/components/Wizard/WizardNavItem.d.ts.map +1 -1
  156. package/next/components/Wizard/WizardNavItem.js +10 -9
  157. package/next/components/Wizard/WizardNavItem.js.map +1 -1
  158. package/next/components/Wizard/WizardStep.d.ts +3 -3
  159. package/next/components/Wizard/WizardStep.d.ts.map +1 -1
  160. package/next/components/Wizard/WizardStep.js +4 -2
  161. package/next/components/Wizard/WizardStep.js.map +1 -1
  162. package/next/components/Wizard/WizardToggle.d.ts +4 -4
  163. package/next/components/Wizard/WizardToggle.d.ts.map +1 -1
  164. package/next/components/Wizard/WizardToggle.js +1 -1
  165. package/next/components/Wizard/WizardToggle.js.map +1 -1
  166. package/next/components/Wizard/hooks/index.d.ts +1 -0
  167. package/next/components/Wizard/hooks/index.d.ts.map +1 -1
  168. package/next/components/Wizard/hooks/index.js +1 -0
  169. package/next/components/Wizard/hooks/index.js.map +1 -1
  170. package/next/components/Wizard/hooks/useGetMergedSteps.d.ts +9 -0
  171. package/next/components/Wizard/hooks/useGetMergedSteps.d.ts.map +1 -0
  172. package/next/components/Wizard/hooks/useGetMergedSteps.js +33 -0
  173. package/next/components/Wizard/hooks/useGetMergedSteps.js.map +1 -0
  174. package/next/components/Wizard/index.d.ts +2 -2
  175. package/next/components/Wizard/index.d.ts.map +1 -1
  176. package/next/components/Wizard/index.js +2 -2
  177. package/next/components/Wizard/index.js.map +1 -1
  178. package/next/components/Wizard/types.d.ts +13 -19
  179. package/next/components/Wizard/types.d.ts.map +1 -1
  180. package/next/components/Wizard/types.js +6 -0
  181. package/next/components/Wizard/types.js.map +1 -1
  182. package/next/components/Wizard/utils.d.ts +5 -6
  183. package/next/components/Wizard/utils.d.ts.map +1 -1
  184. package/next/components/Wizard/utils.js +15 -22
  185. package/next/components/Wizard/utils.js.map +1 -1
  186. package/package.json +2 -2
  187. package/src/components/Menu/MenuGroup.tsx +2 -2
  188. package/src/components/Select/Select.tsx +4 -0
  189. package/src/components/Select/SelectToggle.tsx +14 -3
  190. package/src/components/Select/examples/Select.md +28 -0
  191. package/src/next/components/Wizard/Wizard.tsx +71 -46
  192. package/src/next/components/Wizard/WizardContext.tsx +38 -43
  193. package/src/next/components/Wizard/WizardFooter.tsx +10 -6
  194. package/src/next/components/Wizard/WizardHeader.tsx +1 -1
  195. package/src/next/components/Wizard/WizardNavInternal.tsx +51 -43
  196. package/src/next/components/Wizard/WizardNavItem.tsx +21 -14
  197. package/src/next/components/Wizard/WizardStep.tsx +8 -6
  198. package/src/next/components/Wizard/WizardToggle.tsx +5 -5
  199. package/src/next/components/Wizard/__tests__/Wizard.test.tsx +129 -26
  200. package/src/next/components/Wizard/__tests__/WizardStep.test.tsx +5 -5
  201. package/src/next/components/Wizard/__tests__/WizardToggle.test.tsx +2 -2
  202. package/src/next/components/Wizard/__tests__/utils.test.tsx +3 -17
  203. package/src/next/components/Wizard/examples/Wizard.md +69 -41
  204. package/src/next/components/Wizard/examples/WizardBasic.tsx +6 -12
  205. package/src/next/components/Wizard/examples/WizardBasicDisabledSteps.tsx +22 -0
  206. package/src/next/components/Wizard/examples/WizardEnabledOnFormValidation.tsx +84 -0
  207. package/src/next/components/Wizard/examples/WizardExpandableSteps.tsx +42 -0
  208. package/src/next/components/Wizard/examples/WizardGetCurrentStep.tsx +53 -0
  209. package/src/next/components/Wizard/examples/WizardProgressiveSteps.tsx +31 -0
  210. package/src/next/components/Wizard/examples/WizardStepDrawerContent.tsx +80 -0
  211. package/src/next/components/Wizard/examples/WizardStepErrorStatus.tsx +55 -0
  212. package/src/next/components/Wizard/examples/WizardStepVisitRequired.tsx +22 -0
  213. package/src/next/components/Wizard/examples/WizardToggleStepVisibility.tsx +57 -0
  214. package/src/next/components/Wizard/examples/WizardValidateOnButtonPress.tsx +183 -0
  215. package/src/next/components/Wizard/examples/WizardWithCustomFooter.tsx +107 -0
  216. package/src/next/components/Wizard/examples/{WizardCustomNav.tsx → WizardWithCustomNav.tsx} +11 -11
  217. package/src/next/components/Wizard/examples/WizardWithCustomNavItem.tsx +22 -0
  218. package/src/next/components/Wizard/examples/WizardWithHeader.tsx +26 -0
  219. package/src/next/components/Wizard/examples/WizardWithNavAnchors.tsx +46 -0
  220. package/src/next/components/Wizard/examples/WizardWithSubmitProgress.tsx +86 -0
  221. package/src/next/components/Wizard/examples/WizardWithinModal.tsx +41 -0
  222. package/src/next/components/Wizard/hooks/index.ts +1 -0
  223. package/src/next/components/Wizard/hooks/useGetMergedSteps.tsx +45 -0
  224. package/src/next/components/Wizard/index.ts +2 -2
  225. package/src/next/components/Wizard/types.tsx +19 -29
  226. package/src/next/components/Wizard/utils.ts +27 -33
  227. 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
- ### Custom navigation
65
+ ### Basic with disabled steps
63
66
 
64
- The `Wizard`'s `nav` property can be used to build your own navigation.
67
+ ```ts file="./WizardBasicDisabledSteps.tsx"
68
+ ```
65
69
 
66
- ```noLive
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
- /** Encompasses all step type variants that are internally controlled by the Wizard */
76
- type WizardControlStep = WizardBasicStep | WizardParentStep | WizardSubStep;
72
+ ```ts file="./WizardWithNavAnchors.tsx"
77
73
  ```
78
74
 
79
- ```ts file="./WizardCustomNav.tsx"
75
+ ### Incrementally enabled steps
76
+
77
+ ```ts file="./WizardStepVisitRequired.tsx"
80
78
  ```
81
79
 
82
- ### Kitchen sink
80
+ ### Expandable steps
83
81
 
84
- Includes the following:
82
+ ```ts file="./WizardExpandableSteps.tsx"
83
+ ```
85
84
 
86
- - Header
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
- Custom operations when navigating between steps can be achieved by utilizing `onNext`, `onBack`, or `onNavByIndex` properties whose callback functions return the 'id' and 'name' of the currently focused step (currentStep), and the previously focused step (previousStep).
87
+ ```ts file="./WizardWithSubmitProgress.tsx"
88
+ ```
96
89
 
97
- ```noLive
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
- /** Data returned for either parameter of WizardNavStepFunction */
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
- The `WizardStep`'s `navItem` property can be used to build your own nav item for that step.
97
+ ```ts file="./WizardValidateOnButtonPress.tsx"
98
+ ```
108
99
 
109
- ```noLive
110
- /** Callback for the Wizard's 'navItem' property. Returns element which replaces the WizardStep's default navItem. */
111
- export type CustomWizardNavItemFunction = (
112
- step: WizardControlStep,
113
- activeStep: WizardControlStep,
114
- steps: WizardControlStep[],
115
- goToStepByIndex: (index: number) => void
116
- ) => React.ReactElement<WizardNavItemProps>;
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
- ```ts file="./WizardKitchenSink.tsx"
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="First step" id="basic-first-step">
7
- <p>Step 1 content</p>
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="Second step" id="basic-second-step">
10
- <p>Step 2 content</p>
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
- <p>Review step content</p>
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
+ );