-
Notifications
You must be signed in to change notification settings - Fork 470
feat(ui): Reverification flow block #9605
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
ca09bda
0b0fe77
7adc0c7
0a1ebb9
4c61e5c
440243a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| --- | ||
| --- | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| import * as FlowStories from './flow.component.stories'; | ||
|
|
||
| # Flow | ||
|
|
||
| `Flow` is a controlled Mosaic screen compositor. It treats `state` as opaque, renders the `Flow.Step` whose `ids` contain its `value`, and keeps the outgoing and incoming steps mounted for transitions. | ||
|
|
||
| ## Example | ||
|
|
||
| <Story | ||
| name='Default' | ||
| storyModule={FlowStories} | ||
| /> | ||
|
|
||
| ## Usage | ||
|
Comment on lines
+7
to
+14
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win Restore the required story sections and order. This page uses 🤖 Prompt for AI AgentsSource: Path instructions |
||
|
|
||
| ```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> | ||
| ``` | ||
|
|
||
| ## Parts | ||
|
|
||
| | Part | Class | Description | | ||
| | ----------- | --------------- | ------------------------------------------------------------- | | ||
| | `Flow.Root` | `.cl-flow-root` | Receives the controlled value and opaque state. | | ||
| | `Flow.Step` | `.cl-flow-step` | Renders when its `ids` include the root's controlled `value`. | | ||
|
|
||
| ## Styling | ||
|
|
||
| `Flow.Root` reflects its controlled value through `data-value`. The active `Flow.Step` carries `data-open` and reflects the first grouped id through `data-step`; an outgoing step carries `data-closed` until its transition finishes. Both parts accept `className`, `style`, and the Mosaic `render` prop. | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,69 @@ | ||
| import { Button } from '@clerk/ui/mosaic/components/button'; | ||
| import { Card } from '@clerk/ui/mosaic/components/card'; | ||
| import { Flow, type FlowDirection } from '@clerk/ui/mosaic/components/flow'; | ||
| import { useState } from 'react'; | ||
|
|
||
| import type { StoryMeta } from '@/lib/types'; | ||
|
|
||
| export { default as __source } from './flow.component.stories?raw'; | ||
|
|
||
| export const meta: StoryMeta = { | ||
| group: 'Components', | ||
| title: 'Flow', | ||
| source: 'packages/ui/src/mosaic/components/flow/flow.tsx', | ||
| }; | ||
|
|
||
| export function Default(): JSX.Element { | ||
| const [step, setStep] = useState('details'); | ||
| const [direction, setDirection] = useState<FlowDirection>(1); | ||
|
|
||
| const navigate = (nextStep: string, nextDirection: FlowDirection) => { | ||
| setDirection(nextDirection); | ||
| setStep(nextStep); | ||
| }; | ||
|
|
||
| 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> | ||
| ); | ||
| } |
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win
Add a package release entry.
Lines 1-2 define an empty Changeset. It produces no version bump or changelog entry. The new public Flow and Reverification APIs will not ship to package consumers. Add the affected package, its intended semver bump, and a concise release summary.
As per coding guidelines, “Use Changesets for version management and changelogs.”
🤖 Prompt for AI Agents
Source: Coding guidelines