Commit 3b0cf7c
committed
[LG-5563] feat(Wizard) Adds Wizard (#3161)
* initial Wizard component
* Creates basic Wizard.tsx component
Prompt:
In the newly created package, create the Wizard component.
Note: these docs mention `Wizard.Step` and `Wizard.Footer`. DO NOT create these yet. They will be created later
The `@leafygreen-ui/wizard` is a general-purpose, multi-step page template, designed to create guided in-app flows and wizards:
Based on the MultiStepWizard component in MMS, and intended to be used in the Product Deletion template.
Feature Overview:
- Takes in all Steps in the flow as children.
- Renders the appropriate content for the current step
- Internally handles step changing (with optional external control)
Non-goals:
- We will not be implementing this across MMS (MultiStepWizard is currently used in 26 files)
- This will not support different url routes per step
Wizard component
The root flow component. Controls the rendering of the appropriate step based on a controlled prop, or uncontrolled internal state.
Example
```tsx
const [activeStep, setActiveStep] = useState(0)
<Wizard activeStep={activeStep}>
<Wizard.Step
title="Step 1"
description={<>Some description with a <Link>link</Link></>}
>
Some Content. Lorem ipsum dolor.
</Wizard.Step>
<Wizard.Step />
<Wizard.Step />
<Wizard.Footer
backButtonProps={{ onClick: setActiveStep(x--) }}
cancelButtonProps={{}}
primaryButtonProps={{ onClick: setActiveStep(x++), variant: 'danger', disabled }}
/>
</Wizard>
```
Props:
```ts
activeStep?: number;
onStepChange?: (step: number) => void
showStepper?: boolean; // omit for v1
```
State:
`[activeStep, setActiveStep] = useState<number> // if none provided as a prop`
Events:
- `onStepChange` : fired when the activeStep changes
- this should still fire when controlled?
Rendering:
- Renders the appropriate Step based on the activeStep prop/state
- Renders the Footer element, with enabled/hidden buttons based on the activeStep
- If activeStep === 0, hides back button
- Injects setActiveStep into Back and Primary buttons (if uncontrolled)
* Creates WizardStep and WizardFooter
Prompt:
The Footer and Step components have been scaffolded.
Create both components with the following spec:
Step:
A single Step in the multi-step flow. Must be rendered within a Wizard.
```ts
title: ReactNode;
description: ReactNode;
children: ReactNode;
```
Footer:
The footer element for the Wizard. A wrapper around LeafyGreen `FormFooter`, but allows us to optionally inject event handlers into the buttons.
```
backButtonProps: ButtonProps;
cancelButtonProps: ButtonProps;
primaryButtonProps: ButtonProps;
```
* footer& step stories
* temp useWizardControlledValue
* fix useWizardControlledValue
* update Footer
* Update package.json
* use typography in Step
* update descendants
* update packages
* the rest of the owl
* update width
* fix nits
* Squashed commit of the following:
commit c826033
Author: Adam Thompson <adam.thompson@mongodb.com>
Date: Tue Sep 30 15:54:03 2025 -0400
Update isChildWithProperty.spec.tsx
commit 01585d3
Merge: f3570c4 94745fb
Author: Adam Thompson <adam.thompson@mongodb.com>
Date: Tue Sep 30 13:28:59 2025 -0400
Merge branch 'main' into ac/cc-utils
commit f3570c4
Author: Adam Thompson <adam.thompson@mongodb.com>
Date: Tue Sep 30 13:28:37 2025 -0400
rm todo
commit becf667
Author: Adam Thompson <adam.thompson@mongodb.com>
Date: Fri Sep 26 16:50:05 2025 -0400
rm wizard
commit f8463ac
Author: Adam Thompson <adam.thompson@mongodb.com>
Date: Fri Sep 26 16:50:00 2025 -0400
update index files
commit 5e0d157
Author: Adam Thompson <adam.thompson@mongodb.com>
Date: Fri Sep 26 16:49:50 2025 -0400
adds 2 level fragment test
commit caf8a93
Author: Adam Thompson <2414030+TheSonOfThomp@users.noreply.github.com>
Date: Fri Sep 26 16:39:09 2025 -0400
Update packages/lib/src/childQueries/findChildren/findChildren.ts
Co-authored-by: Stephen Lee <stephen.lee@mongodb.com>
commit ee977a1
Author: Adam Thompson <2414030+TheSonOfThomp@users.noreply.github.com>
Date: Fri Sep 26 16:38:18 2025 -0400
Update packages/lib/src/childQueries/findChild/findChild.tsx
Co-authored-by: Stephen Lee <stephen.lee@mongodb.com>
commit ee32a26
Merge: ac2c485 366e851
Author: Adam Thompson <2414030+TheSonOfThomp@users.noreply.github.com>
Date: Thu Sep 25 15:20:23 2025 -0400
Merge branch 'main' into ac/cc-utils
commit ac2c485
Author: Adam Thompson <adam.thompson@mongodb.com>
Date: Thu Sep 25 14:03:09 2025 -0400
Create lib-find-children.md
commit 9cd7489
Author: Adam Thompson <adam.thompson@mongodb.com>
Date: Thu Sep 25 14:00:05 2025 -0400
Update findChildren.ts
commit 90e8208
Author: Adam Thompson <adam.thompson@mongodb.com>
Date: Thu Sep 25 13:59:35 2025 -0400
Update findChildren.ts
commit d7ae970
Author: Adam Thompson <adam.thompson@mongodb.com>
Date: Thu Sep 25 13:52:04 2025 -0400
update findChild/children with unwrapRootFragment
commit a64ff9e
Author: Adam Thompson <adam.thompson@mongodb.com>
Date: Thu Sep 25 13:49:27 2025 -0400
Creates unwrapRootFragment
commit 000f713
Author: Adam Thompson <2414030+TheSonOfThomp@users.noreply.github.com>
Date: Thu Sep 25 13:05:35 2025 -0400
Apply suggestions from code review
`allChildren.length === 1`
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
commit c6d9c9d
Author: Adam Thompson <adam.thompson@mongodb.com>
Date: Thu Sep 25 13:00:30 2025 -0400
Update index.ts
commit c369957
Author: Adam Thompson <adam.thompson@mongodb.com>
Date: Thu Sep 25 13:00:12 2025 -0400
mv child queries
commit 5fe4f9d
Author: Adam Thompson <adam.thompson@mongodb.com>
Date: Thu Sep 25 12:59:35 2025 -0400
update index files
commit c9261c8
Author: Adam Thompson <adam.thompson@mongodb.com>
Date: Thu Sep 25 12:58:48 2025 -0400
mv componentQueries
commit be05c4d
Author: Adam Thompson <adam.thompson@mongodb.com>
Date: Thu Sep 25 12:55:19 2025 -0400
Update findChildren.spec.tsx
commit f493f6d
Author: Adam Thompson <adam.thompson@mongodb.com>
Date: Thu Sep 25 12:46:47 2025 -0400
update findChild tests
commit 74f5f7e
Author: Adam Thompson <adam.thompson@mongodb.com>
Date: Thu Sep 25 12:46:28 2025 -0400
Fix isChildWithProperty tests
commit 5439034
Author: Adam Thompson <adam.thompson@mongodb.com>
Date: Wed Sep 24 19:05:18 2025 -0400
findChildren
commit aa89584
Author: Adam Thompson <adam.thompson@mongodb.com>
Date: Wed Sep 24 19:05:10 2025 -0400
Update findChild.tsx
commit dda7ad5
Author: Adam Thompson <adam.thompson@mongodb.com>
Date: Wed Sep 24 19:05:01 2025 -0400
isChildWithProperty
commit ae3a41b
Author: Adam Thompson <adam.thompson@mongodb.com>
Date: Wed Sep 24 17:02:37 2025 -0400
mv existing utils
* adds findChildren
* adds TextNode
* Update Wizard.spec.tsx
* minor fixes
* spread rest
* adds wizard context assertions
* fix exports
* fix exports
* Update TextNode.tsx
* creates compound component
* lint
* update CompoundSubComponent api
* update packages
* add WizardProvider
* update stories
* Wizard
* update findChild/ren
* spread className
* add "exceeded steps" warning
* adds warning tests1 parent f6b4998 commit 3b0cf7c
File tree
41 files changed
+1359
-172
lines changed- .changeset
- packages
- descendants/src
- Highlight
- lib/src/childQueries
- findChildren
- findChild
- wizard
- src
- WizardContext
- WizardStep
- Wizard
- testing
- utils
- useWizardControlledValue
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
41 files changed
+1359
-172
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | | - | |
4 | | - | |
5 | | - | |
6 | | - | |
7 | | - | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | | - | |
| 18 | + | |
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| 25 | + | |
25 | 26 | | |
26 | 27 | | |
27 | 28 | | |
| |||
Lines changed: 25 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
33 | | - | |
| 33 | + | |
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
| |||
77 | 77 | | |
78 | 78 | | |
79 | 79 | | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
80 | 104 | | |
81 | 105 | | |
82 | 106 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
| 45 | + | |
45 | 46 | | |
46 | | - | |
47 | | - | |
48 | | - | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
49 | 50 | | |
Lines changed: 121 additions & 99 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
33 | | - | |
| 33 | + | |
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
| |||
67 | 67 | | |
68 | 68 | | |
69 | 69 | | |
70 | | - | |
71 | | - | |
72 | | - | |
73 | | - | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
74 | 74 | | |
75 | 75 | | |
76 | | - | |
77 | | - | |
78 | | - | |
79 | | - | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
80 | 79 | | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | | - | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
86 | 94 | | |
87 | | - | |
88 | | - | |
89 | | - | |
90 | | - | |
91 | | - | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
92 | 99 | | |
93 | 100 | | |
94 | | - | |
95 | | - | |
96 | | - | |
97 | | - | |
98 | | - | |
99 | | - | |
100 | | - | |
101 | | - | |
102 | | - | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
103 | 105 | | |
104 | | - | |
105 | | - | |
106 | | - | |
107 | | - | |
108 | | - | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
109 | 118 | | |
110 | | - | |
111 | | - | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
112 | 139 | | |
113 | | - | |
114 | 140 | | |
115 | | - | |
116 | | - | |
117 | | - | |
| 141 | + | |
118 | 142 | | |
119 | | - | |
120 | 143 | | |
121 | | - | |
122 | | - | |
123 | | - | |
124 | | - | |
125 | | - | |
126 | | - | |
127 | | - | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
128 | 152 | | |
| 153 | + | |
129 | 154 | | |
130 | | - | |
131 | | - | |
132 | | - | |
133 | | - | |
134 | | - | |
135 | | - | |
136 | | - | |
137 | | - | |
138 | | - | |
139 | | - | |
140 | | - | |
141 | | - | |
142 | | - | |
143 | | - | |
144 | | - | |
145 | | - | |
146 | | - | |
147 | | - | |
148 | | - | |
149 | | - | |
150 | | - | |
151 | | - | |
152 | | - | |
153 | | - | |
154 | | - | |
155 | | - | |
156 | | - | |
157 | | - | |
158 | | - | |
159 | | - | |
160 | | - | |
161 | | - | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
162 | 184 | | |
| 185 | + | |
163 | 186 | | |
164 | | - | |
165 | | - | |
166 | | - | |
167 | | - | |
168 | | - | |
169 | | - | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
170 | 194 | | |
171 | | - | |
172 | | - | |
173 | | - | |
174 | | - | |
175 | | - | |
176 | | - | |
177 | | - | |
178 | | - | |
179 | | - | |
180 | | - | |
181 | | - | |
182 | | - | |
183 | | - | |
184 | | - | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
185 | 207 | | |
186 | 208 | | |
Lines changed: 6 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | | - | |
| 18 | + | |
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| |||
56 | 56 | | |
57 | 57 | | |
58 | 58 | | |
59 | | - | |
60 | | - | |
61 | | - | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
62 | 64 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
2 | 1 | | |
3 | 2 | | |
4 | 3 | | |
| 4 | + | |
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
26 | | - | |
0 commit comments