-
Notifications
You must be signed in to change notification settings - Fork 467
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
base: main
Are you sure you want to change the base?
Changes from all commits
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,38 @@ | ||
| import * as FlowStories from './flow.component.stories'; | ||
|
|
||
| # Flow | ||
|
|
||
| `Flow` is a controlled Mosaic screen compositor. It treats `state` as opaque and renders the `Flow.Step` whose `ids` contain its `value`, establishing the seam where screen transitions can later retain outgoing and incoming state. | ||
|
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 State that The introduction describes Flow's compositor behavior but not its styling contract. Add the required statement so users know that Flow provides no styles. 🤖 Prompt for AI AgentsSource: Path instructions |
||
|
|
||
| ## 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 { Flow } from '@clerk/ui/mosaic/components/flow'; | ||
|
|
||
| <Flow.Root render={<Card.Root />} value={model.status} state={model}> | ||
|
Comment on lines
+17
to
+19
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. 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win Import every component used by the Usage snippet. The snippet imports 🤖 Prompt for AI Agents |
||
| {state => ( | ||
| <> | ||
| <Flow.Step ids={['details', 'details-pending']}>{state.details}</Flow.Step> | ||
| <Flow.Step ids={['confirm']}>{state.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-active` and reflects the first grouped id through `data-step`. 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