Skip to content

Commit 304c0b6

Browse files
authored
feat(ui): rebuild Mosaic Dialog on bring-your-own surfaces (#9772)
1 parent 7e51255 commit 304c0b6

44 files changed

Lines changed: 1370 additions & 1992 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+
---

‎.claude/skills/mosaic/SKILL.md‎

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,3 +78,38 @@ layer. Copy from it.
7878
The migration workflow (`migration.md`) ties the flow references together: it
7979
treats the legacy component as the spec and drives you through the model,
8080
controller, and view layers, then verifies parity with `parity-audit.md`.
81+
82+
## Documenting a component in swingset
83+
84+
`packages/swingset/CLAUDE.md` is the house style — archetypes, required section
85+
order, `meta` conventions. One rule on top of it, because it is the one agents
86+
get wrong:
87+
88+
**The docs describe the API as it is. They do not carry the reasoning that
89+
produced it.** No "not a `size`, because…", no rejected alternatives, no history
90+
of what the prop used to be. A reader is there to learn what the thing does, and
91+
every sentence of rationale is a sentence they have to skim past to find it.
92+
State the behaviour plainly and briefly, then stop.
93+
94+
```mdx
95+
<!-- no -->
96+
97+
### Variant
98+
99+
Which surface the dialog holds, and so the geometry it is given. Not a `size`,
100+
because these are different surfaces rather than one surface at two widths — a
101+
second card width would be a size of the `card` variant, with nowhere to sit on
102+
this axis.
103+
104+
<!-- yes -->
105+
106+
### Variant
107+
108+
Which surface the dialog holds, and the geometry that comes with it.
109+
```
110+
111+
This is the opposite of the rule for **code**, where a comment earns its place by
112+
explaining what the code cannot say for itself — the cascade fight behind a
113+
`null`, the measured reason a duration is what it is. Keep that reasoning where a
114+
future maintainer will hit it, which is the source file. The trade you rejected
115+
belongs in a code comment or the PR description; the docs get the conclusion.

‎packages/swingset/CLAUDE.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,7 @@ import * as UserButtonStories from './user-button.stories';
273273

274274
- Keep the intro to one short, present-tense paragraph: what the thing is and what it's for. For primitives, say explicitly that it's headless and ships no styles.
275275
- Prose should add what a demo can't — behavior, accessibility, when to reach for it — not restate prop names already in the table.
276+
- Describe the API as it is; leave the reasoning that produced it out. No "not a `size`, because…", no rejected alternatives, no history of what a prop used to be — that belongs in a code comment or the PR. The docs get the conclusion, stated plainly and briefly.
276277
- Lead every page with the heading hierarchy its archetype prescribes; don't invent new top-level sections or reorder them. Consistency across pages is the goal.
277278

278279
### Before you finish

‎packages/swingset/src/stories/confirmation.mdx‎

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ import * as Stories from './confirmation.stories';
1919

2020
A confirmation for a destructive action that is worth a second look but not worth making the user type for. Removing a connected account, revoking a session, signing out everywhere. For the actions that do warrant typing, use [Destructive](/components/destructive).
2121

22+
It is an `alertdialog`: it announces as an interruption, an outside press cannot dismiss it, and the card carries no corner dismiss. Escape and the footer's Cancel action dismiss it. Under the phone band it arrives as a bottom sheet.
23+
2224
The block holds nothing of its own. Everything that decides what the dialog does next belongs to the caller. `open` closes it, `isConfirming` marks it busy, `errorMessage` explains a failure.
2325

2426
```tsx
@@ -94,18 +96,18 @@ Opened from a menu item, focus returns to that menu's trigger when the dialog cl
9496

9597
Controlled:
9698

97-
| Prop | Type | Default | Description |
98-
| -------------- | ------------------------- | ------------ | ------------------------------------------------------------------------------ |
99-
| `open` | `boolean` | — (required) | Whether the confirmation is showing. Controlled, the way any dialog is. |
100-
| `onOpenChange` | `(open: boolean) => void` | — (required) | Asks to open or close. Fired by the trigger, Cancel, Escape, and the backdrop. |
101-
| `trigger` | `ReactNode` | — | The button that asks to open the dialog. |
102-
| `title` | `string` | — (required) | Names what is about to happen. |
103-
| `description` | `ReactNode` | — (required) | Spells out what it means. Takes markup, for a name to emphasise. |
104-
| `actionLabel` | `string` | — (required) | The destructive button's label. |
105-
| `cancelLabel` | `string` | `'Cancel'` | The cancel button's label. |
106-
| `onConfirm` | `() => void` | — (required) | Asks the caller to run the action. |
107-
| `isConfirming` | `boolean` | `false` | Renders the action pending and ignores further presses. |
108-
| `errorMessage` | `string` | — | Renders as a negative banner above the actions. |
99+
| Prop | Type | Default | Description |
100+
| -------------- | ------------------------- | ------------ | ------------------------------------------------------------------------------------------ |
101+
| `open` | `boolean` | — (required) | Whether the confirmation is showing. Controlled, the way any dialog is. |
102+
| `onOpenChange` | `(open: boolean) => void` | — (required) | Asks to open or close. Fired by the trigger, Escape, and the `Dialog.Close` Cancel action. |
103+
| `trigger` | `ReactNode` | — | The button that asks to open the dialog. |
104+
| `title` | `string` | — (required) | Names what is about to happen. |
105+
| `description` | `ReactNode` | — (required) | Spells out what it means. Takes markup, for a name to emphasise. |
106+
| `actionLabel` | `string` | — (required) | The destructive button's label. |
107+
| `cancelLabel` | `string` | `'Cancel'` | The cancel button's label. |
108+
| `onConfirm` | `() => void` | — (required) | Asks the caller to run the action. |
109+
| `isConfirming` | `boolean` | `false` | Renders the action pending and ignores further presses. |
110+
| `errorMessage` | `string` | — | Renders as a negative banner above the actions. |
109111

110112
With a handle:
111113

0 commit comments

Comments
 (0)