Skip to content

Commit c1d21be

Browse files
TheSonOfThompshaneezaCopilot
authored andcommitted
[LG-5562] integ(wizard): Creates Wizard package (#3152)
* scaffolds wizard package * Update pnpm-lock.yaml * scaffold WizardFooter * scaffold wizard step * [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 tests * chore(Wizard) Updates wizard utilities to use `hooks` and `compound-components` (#3200) * install cc * use CC in wiz * useControlled * rm isControlled check * lint * init wizard changeset * refactor(WizardFooter): simplify props by extending FormFooterProps * [LG-5562] feat(Wizard) Updates `Wizard` API (#3336) * rm step wrapper * rm descendants dep * export WizardProvider * delete-wizard-demo private endpoints useFetchRequiredActionTableData renam ReqAct cards composable basic table stream processing card federated db card applications card clusters card wizard step context Delete requiredActionsConfig.tsx re-enable wizard add useRequiredActionAcknowledgements mv required action. add skeleton Update ModelApiKeysCard.tsx * Update pnpm Update package.json * fix wizard changes * Adds `requiresAcknowledgement` prop to Wizard.Step * Implements `isAcknowledged` state inside provider * Update Wizard.stories.tsx * rm delete demo * Update wizard.md * rm temp changesets * Update README.md * Update WizardStep.spec.tsx * footer tests * Update Wizard.spec.tsx * update package json * update provider props * revert toast changes? * Update .npmrc * Update pnpm-lock.yaml * Update WizardStep.spec.tsx * exports form footer types * Update WizardFooter.types.ts * adds `totalSteps` to wizard context * fix bad merge * updates readme * updates tsdoc * fixes tests * fixes ack reset test * Update WizardStep.spec.tsx * fixes stories * [LG-5566] tests(Wizard) Implement TestUtils & LGIDs for `Wizard` (#3338) * rm step wrapper * rm descendants dep * export WizardProvider * delete-wizard-demo private endpoints useFetchRequiredActionTableData renam ReqAct cards composable basic table stream processing card federated db card applications card clusters card wizard step context Delete requiredActionsConfig.tsx re-enable wizard add useRequiredActionAcknowledgements mv required action. add skeleton Update ModelApiKeysCard.tsx * Update pnpm Update package.json * fix wizard changes * Adds `requiresAcknowledgement` prop to Wizard.Step * Implements `isAcknowledged` state inside provider * Update Wizard.stories.tsx * rm delete demo * Update wizard.md * rm temp changesets * Update README.md * Update WizardStep.spec.tsx * footer tests * Update Wizard.spec.tsx * update package json * update provider props * revert toast changes? * Update .npmrc * Update pnpm-lock.yaml * Update WizardStep.spec.tsx * exports form footer types * Update WizardFooter.types.ts * adds `totalSteps` to wizard context * fix bad merge * adds LGIDs * adds test utils * lint * fix bad merge * removes Step test utils * add layout comments * form-footer lgids * updates wizard testids * updates readme * updates tsdoc * fixes tests * fixes ack reset test * Squashed commit of the following: commit 4fd3668 Author: Adam Michael Thompson <adam.thompson@mongodb.com> Date: Tue Nov 25 13:18:59 2025 -0500 fixes ack reset test commit 4f024b1 Author: Adam Michael Thompson <adam.thompson@mongodb.com> Date: Tue Nov 25 13:11:35 2025 -0500 fixes tests commit f919ecc Author: Adam Michael Thompson <adam.thompson@mongodb.com> Date: Tue Nov 25 13:11:29 2025 -0500 updates tsdoc commit 6842bbb Author: Adam Michael Thompson <adam.thompson@mongodb.com> Date: Tue Nov 25 13:02:43 2025 -0500 updates readme * Update WizardStep.spec.tsx * Update WizardContext.tsx * Update WizardStep.spec.tsx * Squashed commit of the following: commit 982ef72 Author: Adam Michael Thompson <adam.thompson@mongodb.com> Date: Tue Nov 25 13:52:15 2025 -0500 Update WizardStep.spec.tsx * fixes stories * Squashed commit of the following: commit 4b32ed6 Author: Adam Michael Thompson <adam.thompson@mongodb.com> Date: Tue Nov 25 17:49:16 2025 -0500 fixes stories commit 982ef72 Author: Adam Michael Thompson <adam.thompson@mongodb.com> Date: Tue Nov 25 13:52:15 2025 -0500 Update WizardStep.spec.tsx * Update WizardStep.stories.tsx * Update packages/wizard/src/testing/getTestUtils.tsx Co-authored-by: Shaneeza <shaneeza.ali@mongodb.com> * Update README.md * use Button test utils * use test utils * Update pnpm-lock.yaml --------- Co-authored-by: Shaneeza <shaneeza.ali@mongodb.com> * Update packages/wizard/src/Wizard/Wizard.tsx Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update packages/lib/src/childQueries/findChild/findChild.spec.tsx Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update packages/lib/src/childQueries/findChildren/findChildren.spec.tsx Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update packages/wizard/src/WizardStep/WizardStep.tsx Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update getTestUtils.tsx --------- Co-authored-by: Shaneeza <shaneeza.ali@mongodb.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent 6055b8a commit c1d21be

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+2621
-122
lines changed

.changeset/descendants-exports.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@leafygreen-ui/descendants': minor
3+
---
4+
5+
Exports `Position` enum. Removes type annotation from `Direction` export
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@leafygreen-ui/form-footer': minor
3+
---
4+
5+
Exports button prop interfaces

.changeset/form-footer-lgids.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@leafygreen-ui/form-footer': patch
3+
---
4+
5+
Passes `data-lgid` to the root `footer` element

.changeset/lib-find-children.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@leafygreen-ui/lib': minor
3+
---
4+
5+
Adds `findChildren` utility to `lib`. Also adds `unwrapRootFragment` and `isChildWithProperty` helpers

.changeset/wizard.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
'@leafygreen-ui/wizard': minor
3+
---
4+
5+
Initial Wizard package release.
6+
7+
See [README.md](./README.md) for usage guidelines

packages/descendants/src/Highlight/index.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
export type {
1+
export {
22
Direction,
3-
HighlightChangeHandler,
4-
HighlightContextProps,
5-
HighlightHookReturnType,
6-
Index,
7-
UseHighlightOptions,
3+
type HighlightChangeHandler,
4+
type HighlightContextProps,
5+
type HighlightHookReturnType,
6+
type Index,
7+
Position,
8+
type UseHighlightOptions,
89
} from './highlight.types';
910
export {
1011
createHighlightContext,

packages/descendants/src/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,14 @@ export {
1515
// Highlight
1616
export {
1717
createHighlightContext,
18-
type Direction,
18+
Direction,
1919
type HighlightChangeHandler,
2020
type HighlightContextProps,
2121
type HighlightContextType,
2222
type HighlightHookReturnType,
2323
HighlightProvider,
2424
type Index,
25+
Position,
2526
useHighlight,
2627
useHighlightContext,
2728
type UseHighlightOptions,

packages/form-footer/src/FormFooter.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ export default function FormFooter({
4747
<LeafyGreenProvider darkMode={darkMode}>
4848
<footer
4949
data-testid={lgIds.root}
50+
data-lgid={lgIds.root}
5051
className={getFormFooterStyles({ theme, className })}
5152
{...rest}
5253
>

packages/form-footer/src/FormFooter.types.ts

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,26 +20,30 @@ type OmittedSplitButtonProps = Omit<
2020
'children' | 'variant'
2121
>;
2222

23-
type BackStandardButtonProps = ButtonPropsOmittingVariant & {
23+
export type BackStandardButtonProps = ButtonPropsOmittingVariant & {
2424
variant?: Extract<ButtonVariant, 'default' | 'dangerOutline'>;
2525
};
26-
type BackSplitButtonProps = OmittedSplitButtonProps & {
26+
export type BackSplitButtonProps = OmittedSplitButtonProps & {
2727
variant?: Extract<SplitButtonVariant, 'default' | 'danger'>;
2828
};
29-
type BackButtonProps = BackStandardButtonProps | BackSplitButtonProps;
29+
export type BackButtonProps = BackStandardButtonProps | BackSplitButtonProps;
3030

31-
type CancelStandardButtonProps = ButtonPropsOmittingVariant;
32-
type CancelSplitButtonProps = OmittedSplitButtonProps;
33-
type CancelButtonProps = CancelStandardButtonProps | CancelSplitButtonProps;
31+
export type CancelStandardButtonProps = ButtonPropsOmittingVariant;
32+
export type CancelSplitButtonProps = OmittedSplitButtonProps;
33+
export type CancelButtonProps =
34+
| CancelStandardButtonProps
35+
| CancelSplitButtonProps;
3436

35-
type PrimaryStandardButtonProps = ButtonPropsOmittingVariant &
37+
export type PrimaryStandardButtonProps = ButtonPropsOmittingVariant &
3638
ButtonPropsWithRequiredChildren & {
3739
variant?: Extract<ButtonVariant, 'primary' | 'danger'>;
3840
};
39-
type PrimarySplitButtonProps = OmittedSplitButtonProps & {
41+
export type PrimarySplitButtonProps = OmittedSplitButtonProps & {
4042
variant?: Extract<SplitButtonVariant, 'primary' | 'danger'>;
4143
};
42-
type PrimaryButtonProps = PrimaryStandardButtonProps | PrimarySplitButtonProps;
44+
export type PrimaryButtonProps =
45+
| PrimaryStandardButtonProps
46+
| PrimarySplitButtonProps;
4347

4448
export interface FormFooterProps
4549
extends React.ComponentProps<'footer'>,

packages/form-footer/src/index.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,16 @@ export {
55
default,
66
default as FormFooter,
77
} from './FormFooter';
8-
export { type FormFooterProps } from './FormFooter.types';
8+
export {
9+
type BackButtonProps,
10+
type BackSplitButtonProps,
11+
type BackStandardButtonProps,
12+
type CancelButtonProps,
13+
type CancelSplitButtonProps,
14+
type CancelStandardButtonProps,
15+
type FormFooterProps,
16+
type PrimaryButtonProps,
17+
type PrimarySplitButtonProps,
18+
type PrimaryStandardButtonProps,
19+
} from './FormFooter.types';
920
export { getLgIds } from './utils';

0 commit comments

Comments
 (0)