Skip to content

Commit aed2403

Browse files
committed
Merge remote-tracking branch 'origin/main' into devin/mosaic-component-exports
2 parents 272e1e8 + 4026619 commit aed2403

50 files changed

Lines changed: 2702 additions & 942 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
---
2+
---
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
---
2+
---
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
---
2+
---
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
---
2+
---

‎.changeset/mosaic-sign-in-steps.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
---
2+
---

‎packages/mosaic/docs/documenting-components.md‎

Lines changed: 45 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ Worked examples: `button.stories.tsx` and `button.mdx` (archetype A, simple), `p
2323
| `User Profile` | Composed flow UI (e.g. `UserProfileProfilePanel`) | C |
2424
| `Organization Profile` | Composed flow UI (e.g. `OrganizationProfileGeneralPanel`) | C |
2525
| `Misc` | Standalone composed components (e.g. `OrganizationSwitcher`, `Waitlist`) | C |
26+
| `Authentication` | Flow views built from steps (e.g. `SignIn`) | C · flow |
2627
| `Blocks` | Flows assembled from components, wired by the caller's machine (e.g. `Confirmation`, `Destructive`) | C |
2728
| `Components` | Styled Mosaic components — simple, with a flat variant surface (`Button`, `Input`), or compound (`Card`, `Field`, `Menu`, `Popover`) | A |
2829
| `Primitives` | Headless primitives from `@clerk/mosaic`'s `src/primitives/` (`Accordion`) | B |
@@ -204,7 +205,7 @@ The story is `meta` (no `styles`) plus a single `Default` export that renders th
204205

205206
Every props table has a **Default** column, and the `Type` stays a plain union, never with the default inlined. The auto `<PropTable>` fills it from `meta.styles._defaultVariants`; hand-written tables (`Prop | Type | Default | Description`) fill it by hand. Name the default member (`'bottom-start'`), use `—` when there is none and append `(required)` for a required prop, and state a behavioral default in words (`inherits Root`).
206207

207-
## Archetype C — composed layer (`User Button`, `User Profile`, `Organization Profile`, `Misc`, `Blocks`)
208+
## Archetype C — composed layer (`User Button`, `User Profile`, `Organization Profile`, `Misc`, `Blocks`, `Authentication`)
208209

209210
These compose lower layers, so the docs lead with the composition rather than knobs. Required MDX:
210211

@@ -230,6 +231,49 @@ import * as SwitcherStories from './user-button.stories';
230231
- The `composition` array names each lower-layer component this one builds on, with a link to that component's page and its `layer`. List every direct dependency so the layering is navigable.
231232
- The story is `meta` plus a single `Default` export that renders the composed UI with no knobs.
232233

234+
### C · flow — a view built from steps (`Authentication`)
235+
236+
A flow view shows one step at a time, so a single `Default` cannot show every screen. The page adds `Usage` and one section per step component after the composition. Required MDX section order:
237+
238+
```mdx
239+
import * as Stories from './sign-in.stories';
240+
241+
# SignIn
242+
243+
<!-- One paragraph: what the working example does and which inputs reach which branches. -->
244+
245+
## Example
246+
247+
<Story
248+
name='Default'
249+
storyModule={Stories}
250+
composition={[{ name: 'Card', href: '/components/card', layer: 'Components' }]}
251+
/>
252+
253+
## Usage
254+
255+
<!-- What the view owns, how `step` picks the screen, and a code fence rendering the view. -->
256+
257+
## Steps
258+
259+
<!-- One sentence on how the sections map to step components, and that a red box marks a planned view. -->
260+
261+
### Identifier step
262+
263+
<!-- One line naming the step file and the step values it draws. -->
264+
265+
#### Default
266+
267+
<Story
268+
name='IdentifierDefault'
269+
storyModule={Stories}
270+
/>
271+
```
272+
273+
- `Default` is a working example: plain props driven by a stand-in for the controller, so the whole flow can be clicked through.
274+
- Under `## Steps`, each `###` is one component in the feature's `steps/` folder, and each `####` is one step value it draws. Each example is one story export, named for the step and the example (`IdentifierDefault`, `CredentialPasswordError`).
275+
- A view the legacy component has and Mosaic does not yet gets its `####` and a `<Story>` naming the export it will have. Swingset renders a red "not found" box for a story the file does not export, which marks the gap on the page. Exporting the story turns the box into the example, with no MDX change.
276+
233277
## Writing the prose
234278

235279
- Keep the intro to one short, present-tense paragraph: what the thing is and what it's for. For primitives, say it is headless and ships no styles.

‎packages/mosaic/src/blocks/verification/index.ts‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,7 @@ export { VerificationHelp } from './verification-help';
44
export { VerificationMethodPicker } from './verification-method-picker';
55
export { VerificationPasskey } from './verification-passkey';
66
export { VerificationPassword } from './verification-password';
7+
export type { VerificationBackupCodeMessages } from './verification-backup-code';
8+
export type { VerificationCodeMessages, VerificationCodeResend } from './verification-code';
9+
export type { VerificationHelpMessages } from './verification-help';
10+
export type { VerificationMethodPickerMessages } from './verification-method-picker';

‎packages/mosaic/src/blocks/verification/verification-backup-code.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { useFlowAutoFocus } from '../../components/flow';
99
import { Input } from '../../components/input';
1010
import { Form } from '../../primitives/form';
1111

12-
interface VerificationBackupCodeMessages {
12+
export interface VerificationBackupCodeMessages {
1313
title: string;
1414
description: string;
1515
fieldLabel: string;

‎packages/mosaic/src/blocks/verification/verification-code.tsx‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { Otp } from '../../components/otp';
1010
import { Form } from '../../primitives/form';
1111
import { CODE_LENGTH } from '../../utils/verification';
1212

13-
interface VerificationCodeMessages {
13+
export interface VerificationCodeMessages {
1414
title: string;
1515
description: string;
1616
fieldLabel: string;
@@ -19,7 +19,7 @@ interface VerificationCodeMessages {
1919
pendingLabel: string;
2020
}
2121

22-
interface VerificationCodeResend {
22+
export interface VerificationCodeResend {
2323
text: string;
2424
label: ReactNode;
2525
disabled?: boolean;

‎packages/mosaic/src/blocks/verification/verification-help.tsx‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { Button } from '../../components/button';
22
import { Card } from '../../components/card';
33
import { useFlowAutoFocus } from '../../components/flow';
44

5-
interface VerificationHelpMessages {
5+
export interface VerificationHelpMessages {
66
title: string;
77
description: string;
88
backButton: string;
@@ -24,7 +24,6 @@ export function VerificationHelp({ messages, onEmailSupport, onBack }: Verificat
2424
</Card.Header>
2525
<Card.Footer>
2626
<Button
27-
ref={useFlowAutoFocus<HTMLButtonElement>()}
2827
type='button'
2928
variant='outline'
3029
color='neutral'
@@ -33,6 +32,7 @@ export function VerificationHelp({ messages, onEmailSupport, onBack }: Verificat
3332
{messages.backButton}
3433
</Button>
3534
<Button
35+
ref={useFlowAutoFocus<HTMLButtonElement>()}
3636
type='button'
3737
onClick={onEmailSupport}
3838
>

0 commit comments

Comments
 (0)