Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
37 changes: 20 additions & 17 deletions packages/swingset/src/stories/flow.component.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -13,27 +13,30 @@ import * as FlowStories from './flow.component.stories';

## Usage

Keep `Card.Root` outside `Flow.Root` so the card remains stable while Flow clips and animates its step viewport.

```tsx
import { Card } from '@clerk/ui/mosaic/components/card';
import { Flow } from '@clerk/ui/mosaic/components/flow';

<Flow.Root
render={<Card.Root />}
value={model.status}
direction={model.direction}
state={model}
>
{current => (
<>
<Flow.Step ids={['details', 'details-pending']}>
<DetailsView {...current.details} />
</Flow.Step>
<Flow.Step ids={['confirm']}>
<ConfirmationView {...current.confirmation} />
</Flow.Step>
</>
)}
</Flow.Root>
<Card.Root>
<Flow.Root
value={model.status}
direction={model.direction}
state={model}
>
{current => (
<>
<Flow.Step ids={['details', 'details-pending']}>
<DetailsView {...current.details} />
</Flow.Step>
<Flow.Step ids={['confirm']}>
<ConfirmationView {...current.confirmation} />
</Flow.Step>
</>
)}
</Flow.Root>
</Card.Root>
```

## Parts
Expand Down
85 changes: 43 additions & 42 deletions packages/swingset/src/stories/flow.component.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,47 +23,48 @@ export function Default(): JSX.Element {
};

return (
<Flow.Root
render={<Card.Root />}
value={step}
direction={direction}
state={{ step }}
>
{state => (
<>
<Flow.Step ids={['details', 'details-pending']}>
<Card.Header>
<Card.Title>Account details</Card.Title>
<Card.Description>Current controller state: {state.step}</Card.Description>
</Card.Header>
<Card.Footer>
<Button
fullWidth
onClick={() => navigate('confirm', 1)}
>
Continue
</Button>
</Card.Footer>
</Flow.Step>
<Flow.Step ids={['confirm']}>
<Card.Header>
<Card.Title>Confirm changes</Card.Title>
<Card.Description>Review the final step before submitting.</Card.Description>
</Card.Header>
<Card.Footer>
<Button
fullWidth
variant='outline'
color='neutral'
onClick={() => navigate('details', -1)}
>
Back
</Button>
<Button fullWidth>Submit</Button>
</Card.Footer>
</Flow.Step>
</>
)}
</Flow.Root>
<Card.Root>
<Flow.Root
value={step}
direction={direction}
state={{ step }}
>
{state => (
<>
<Flow.Step ids={['details', 'details-pending']}>
<Card.Header>
<Card.Title>Account details</Card.Title>
<Card.Description>Current controller state: {state.step}</Card.Description>
</Card.Header>
<Card.Footer>
<Button
fullWidth
onClick={() => navigate('confirm', 1)}
>
Continue
</Button>
</Card.Footer>
</Flow.Step>
<Flow.Step ids={['confirm']}>
<Card.Header>
<Card.Title>Confirm changes</Card.Title>
<Card.Description>Review the final step before submitting.</Card.Description>
</Card.Header>
<Card.Footer>
<Button
fullWidth
variant='outline'
color='neutral'
onClick={() => navigate('details', -1)}
>
Back
</Button>
<Button fullWidth>Submit</Button>
</Card.Footer>
</Flow.Step>
</>
)}
</Flow.Root>
</Card.Root>
);
}
14 changes: 13 additions & 1 deletion packages/swingset/src/stories/reverification.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ The working example shows the complete reverification card. The individual panel

The example pauses briefly in each pending state. Enter `error` in password or backup code fields, or `000000` for OTP, to render an attempt error.

## Working example
## Example

<Story
name='Default'
Expand All @@ -17,8 +17,20 @@ The example pauses briefly in each pending state. Enter `error` in password or b
]}
/>

## Usage

The controller supplies one model containing the active view, transition direction, resolved messages, form state, and event handlers. Spread that model directly into the prop-driven `Reverification` view.

```tsx
import { Reverification } from '@clerk/ui/mosaic/blocks/reverification';

<Reverification {...reverificationModel} />;
```

## Panels

These examples isolate the presentational views and their visual states. Product code should normally render the `Reverification` block shown above.

### Password

<Story name='Password' storyModule={Stories} composition={[{ name: 'Card', href: '/components/card', layer: 'Components' }]} />
Expand Down
Loading
Loading