Skip to content
Merged
Show file tree
Hide file tree
Changes from 48 commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
dae23a2
rm step wrapper
TheSonOfThomp Oct 22, 2025
9c6c588
rm descendants dep
TheSonOfThomp Oct 22, 2025
79774a0
export WizardProvider
TheSonOfThomp Oct 22, 2025
c2f40f9
delete-wizard-demo
TheSonOfThomp Nov 4, 2025
7efcfc5
Update pnpm
TheSonOfThomp Nov 7, 2025
2b2ad96
fix wizard changes
TheSonOfThomp Nov 14, 2025
b3300d4
Adds `requiresAcknowledgement` prop to Wizard.Step
TheSonOfThomp Nov 21, 2025
c0baca5
Implements `isAcknowledged` state inside provider
TheSonOfThomp Nov 21, 2025
e5acf36
Update Wizard.stories.tsx
TheSonOfThomp Nov 21, 2025
daaa1c7
rm delete demo
TheSonOfThomp Nov 21, 2025
47bd132
Update wizard.md
TheSonOfThomp Nov 21, 2025
679a4a0
rm temp changesets
TheSonOfThomp Nov 21, 2025
4f49ad8
Update README.md
TheSonOfThomp Nov 21, 2025
0d85320
Update WizardStep.spec.tsx
TheSonOfThomp Nov 21, 2025
f848f24
footer tests
TheSonOfThomp Nov 21, 2025
fb638d3
Update Wizard.spec.tsx
TheSonOfThomp Nov 21, 2025
6d45f0e
update package json
TheSonOfThomp Nov 21, 2025
01f43ba
update provider props
TheSonOfThomp Nov 21, 2025
cbb87fe
revert toast changes?
TheSonOfThomp Nov 21, 2025
72c9c1f
Update .npmrc
TheSonOfThomp Nov 21, 2025
751644f
Update pnpm-lock.yaml
TheSonOfThomp Nov 21, 2025
947d899
Update WizardStep.spec.tsx
TheSonOfThomp Nov 21, 2025
6439be0
exports form footer types
TheSonOfThomp Nov 24, 2025
b2c8178
Update WizardFooter.types.ts
TheSonOfThomp Nov 24, 2025
5419883
adds `totalSteps` to wizard context
TheSonOfThomp Nov 24, 2025
bf9cbe8
fix bad merge
TheSonOfThomp Nov 24, 2025
1e92da7
adds LGIDs
TheSonOfThomp Nov 21, 2025
0d7650c
adds test utils
TheSonOfThomp Nov 21, 2025
35274d8
lint
TheSonOfThomp Nov 21, 2025
c77268a
fix bad merge
TheSonOfThomp Nov 24, 2025
649c699
removes Step test utils
TheSonOfThomp Nov 24, 2025
aa6aedb
add layout comments
TheSonOfThomp Nov 24, 2025
1fdc3e2
form-footer lgids
TheSonOfThomp Nov 24, 2025
265e1a1
updates wizard testids
TheSonOfThomp Nov 24, 2025
6842bbb
updates readme
TheSonOfThomp Nov 25, 2025
f919ecc
updates tsdoc
TheSonOfThomp Nov 25, 2025
4f024b1
fixes tests
TheSonOfThomp Nov 25, 2025
4fd3668
fixes ack reset test
TheSonOfThomp Nov 25, 2025
5701b76
Squashed commit of the following:
TheSonOfThomp Nov 25, 2025
e2de46c
Update WizardStep.spec.tsx
TheSonOfThomp Nov 25, 2025
7d00ad2
Update WizardContext.tsx
TheSonOfThomp Nov 25, 2025
95432ad
Merge branch 'LG-5562-wizard-updates' into LG-5566-wizard-test-utils-…
TheSonOfThomp Nov 25, 2025
982ef72
Update WizardStep.spec.tsx
TheSonOfThomp Nov 25, 2025
b469712
Squashed commit of the following:
TheSonOfThomp Nov 25, 2025
4b32ed6
fixes stories
TheSonOfThomp Nov 25, 2025
465f760
Squashed commit of the following:
TheSonOfThomp Nov 25, 2025
1106f38
Update WizardStep.stories.tsx
TheSonOfThomp Nov 25, 2025
02cfbf6
Merge branch 'LG-5562-wizard-updates' into LG-5566-wizard-test-utils-…
TheSonOfThomp Nov 25, 2025
fd56d83
Update packages/wizard/src/testing/getTestUtils.tsx
TheSonOfThomp Nov 26, 2025
47e4c4f
Merge branch 'at/wizard-integration' into LG-5566-wizard-test-utils-l…
TheSonOfThomp Nov 26, 2025
93f5e82
Update README.md
TheSonOfThomp Nov 26, 2025
e182b11
use Button test utils
TheSonOfThomp Nov 26, 2025
f402b88
use test utils
TheSonOfThomp Nov 26, 2025
1c32c53
Update pnpm-lock.yaml
TheSonOfThomp Nov 26, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/form-footer-interfaces.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@leafygreen-ui/form-footer': minor
---

Exports button prop interfaces
5 changes: 5 additions & 0 deletions .changeset/form-footer-lgids.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@leafygreen-ui/form-footer': patch
---

Passes `data-lgid` to the root `footer` element
4 changes: 3 additions & 1 deletion .changeset/wizard.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@
'@leafygreen-ui/wizard': minor
---

Initial Wizard package release
Initial Wizard package release.

See [README.md](./README.md) for usage guidelines
1 change: 1 addition & 0 deletions packages/form-footer/src/FormFooter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ export default function FormFooter({
<LeafyGreenProvider darkMode={darkMode}>
<footer
data-testid={lgIds.root}
data-lgid={lgIds.root}
className={getFormFooterStyles({ theme, className })}
{...rest}
>
Expand Down
22 changes: 13 additions & 9 deletions packages/form-footer/src/FormFooter.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,26 +20,30 @@ type OmittedSplitButtonProps = Omit<
'children' | 'variant'
>;

type BackStandardButtonProps = ButtonPropsOmittingVariant & {
export type BackStandardButtonProps = ButtonPropsOmittingVariant & {
variant?: Extract<ButtonVariant, 'default' | 'dangerOutline'>;
};
type BackSplitButtonProps = OmittedSplitButtonProps & {
export type BackSplitButtonProps = OmittedSplitButtonProps & {
variant?: Extract<SplitButtonVariant, 'default' | 'danger'>;
};
type BackButtonProps = BackStandardButtonProps | BackSplitButtonProps;
export type BackButtonProps = BackStandardButtonProps | BackSplitButtonProps;

type CancelStandardButtonProps = ButtonPropsOmittingVariant;
type CancelSplitButtonProps = OmittedSplitButtonProps;
type CancelButtonProps = CancelStandardButtonProps | CancelSplitButtonProps;
export type CancelStandardButtonProps = ButtonPropsOmittingVariant;
export type CancelSplitButtonProps = OmittedSplitButtonProps;
export type CancelButtonProps =
| CancelStandardButtonProps
| CancelSplitButtonProps;

type PrimaryStandardButtonProps = ButtonPropsOmittingVariant &
export type PrimaryStandardButtonProps = ButtonPropsOmittingVariant &
ButtonPropsWithRequiredChildren & {
variant?: Extract<ButtonVariant, 'primary' | 'danger'>;
};
type PrimarySplitButtonProps = OmittedSplitButtonProps & {
export type PrimarySplitButtonProps = OmittedSplitButtonProps & {
variant?: Extract<SplitButtonVariant, 'primary' | 'danger'>;
};
type PrimaryButtonProps = PrimaryStandardButtonProps | PrimarySplitButtonProps;
export type PrimaryButtonProps =
| PrimaryStandardButtonProps
| PrimarySplitButtonProps;

export interface FormFooterProps
extends React.ComponentProps<'footer'>,
Expand Down
13 changes: 12 additions & 1 deletion packages/form-footer/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,16 @@ export {
default,
default as FormFooter,
} from './FormFooter';
export { type FormFooterProps } from './FormFooter.types';
export {
type BackButtonProps,
type BackSplitButtonProps,
type BackStandardButtonProps,
type CancelButtonProps,
type CancelSplitButtonProps,
type CancelStandardButtonProps,
type FormFooterProps,
type PrimaryButtonProps,
type PrimarySplitButtonProps,
type PrimaryStandardButtonProps,
} from './FormFooter.types';
export { getLgIds } from './utils';
85 changes: 85 additions & 0 deletions packages/wizard/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,88 @@ yarn add @leafygreen-ui/wizard
```shell
npm install @leafygreen-ui/wizard
```

```tsx
<Wizard>
<Wizard.Step>
<div>Step 1 contents<div>
<Wizard.Footer
primaryButtonProps={{
children: 'Continue',
variant: 'primary'
}}
/>
</Wizard.Step>

<Wizard.Step requiresAcknowledgement>
<div>Step 2 contents<div>
<Wizard.Footer
primaryButtonProps={{
children: 'Delete',
variant: 'danger'
}}
/>
</Wizard.Step>
</Wizard>
```

### Wizard

The `Wizard` component establishes a context with an internal state, and will render only the `activeStep`.

You can also control the Wizard externally using the `activeStep` and `onStepChange` callback.

```tsx
<Wizard
activeStep={0}
onStepChange={() => {
/* do something */
}}
/>
```

Note: When the `activeStep` is externally controlled, ensure that the provided `activeStep` index is valid relative to the count of steps available. If the zero-indexed `activeStep` value exceeds the count of steps provided (or is negative), nothing will render inside the Wizard. (i.e. passing `activeStep={2}` to a Wizard with only 2 steps, nothing will render)

### Wizard.Step

Defines a discrete step in the wizard. Only the step matching the internal (or provided) `activeStep` index will be displayed.

Both `Wizard` and `Wizard.Step` are only wrapped in a `Fragment` to allow for more versatile styling.

#### `requiresAcknowledgement`

If `requiresAcknowledgement` is true, the step must be acknowledged for the Footer's primary button to be enabled. By default (or when explicitly set to `false`) the primary button will always be enabled.

To set a step to be acknowledged, call `setIsAcknowledged` provided from the `useWizardStepContext` hook.
e.g.

```tsx
// App.tsx
<Wizard.Step requiresAcknowledgement>
<MyWizardStepContents />
<Wizard.Footer
primaryButtonProps={{
children: 'Delete', // This button will be disabled until the step has been acknowledged
}}
/>
</Wizard.Step>;

// MyWizardStepContents.tsx
const MyWizardStepContents = () => {
const { isAcknowledged, setAcknowledged } = useWizardStepContext();

return (
<>
<Checkbox
label="Acknowledge"
checked={isAcknowledged}
onChange={e => setAcknowledged(e.target.checked)}
/>
</>
);
};
```

### Wizard.Footer

The `Wizard.Footer` is a convenience wrapper around the `FormFooter` component. Each step should render its own Footer component
20 changes: 13 additions & 7 deletions packages/wizard/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@

{
"name": "@leafygreen-ui/wizard",
"version": "0.0.1",
"version": "0.1.0-local.1",
"description": "LeafyGreen UI Kit Wizard",
"main": "./dist/umd/index.js",
"module": "./dist/esm/index.js",
Expand All @@ -28,21 +27,28 @@
"access": "public"
},
"dependencies": {
"@leafygreen-ui/button": "workspace:^",
"@leafygreen-ui/compound-component": "workspace:^",
"@leafygreen-ui/descendants": "workspace:^",
"@leafygreen-ui/emotion": "workspace:^",
"@leafygreen-ui/form-footer": "workspace:^",
"@leafygreen-ui/hooks": "workspace:^",
"@leafygreen-ui/lib": "workspace:^",
"@leafygreen-ui/polymorphic": "workspace:^",
"@leafygreen-ui/tokens": "workspace:^",
"@leafygreen-ui/typography": "workspace:^",
"@lg-tools/test-harnesses": "workspace:^"
},
"devDependencies" : {
"devDependencies": {
"@faker-js/faker": "^8.0.0",
"@leafygreen-ui/button": "workspace:^",
"@leafygreen-ui/badge": "workspace:^",
"@leafygreen-ui/banner": "workspace:^",
"@leafygreen-ui/card": "workspace:^",
"@leafygreen-ui/checkbox": "workspace:^",
"@leafygreen-ui/expandable-card": "workspace:^",
"@leafygreen-ui/icon": "workspace:^",
"@faker-js/faker": "^8.0.0"
"@leafygreen-ui/loading-indicator": "workspace:^",
"@leafygreen-ui/segmented-control": "workspace:^",
"@leafygreen-ui/skeleton-loader": "workspace:^",
"@leafygreen-ui/typography": "workspace:^"
},
"homepage": "https://github.com/mongodb/leafygreen-ui/tree/main/packages/wizard",
"repository": {
Expand Down
Loading
Loading