parent
458996882e
commit
0b399cc6e8
@ -0,0 +1,68 @@
|
||||
# Dialog
|
||||
|
||||
Visual dialog wrapper over Soma's dialog primitive.
|
||||
|
||||
## Baseline
|
||||
|
||||
Air exposed `Root`, `Trigger`, `Portal`, `Overlay`, `Content`, `Header`,
|
||||
`Footer`, `Title`, `Description` and `Close`. The only visual prop on
|
||||
`Content` was responsive `size: 'sm' | 'md' | 'lg' | 'full'`; contextual
|
||||
motion lived in Air's motion helpers. Eidos keeps the same anatomy under the
|
||||
disciplined option C shape (`<Dialog>` + attached parts), adds `xl`, panel
|
||||
positioning and explicit dimension overrides, while Soma owns behavior.
|
||||
|
||||
## Comparison
|
||||
|
||||
| Feature | Air | Radix | Ark UI | Bits UI | shadcn-svelte | Eidos |
|
||||
| --- | :--: | :--: | :--: | :--: | :--: | :--: |
|
||||
| Compound API | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
|
||||
| Portal | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
|
||||
| Overlay / backdrop | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
|
||||
| Header / footer visual shells | ✅ | example | example | custom | ✅ | ✅ |
|
||||
| Responsive visual size | ✅ | ✅ | — | — | class | ✅ |
|
||||
| Explicit width / height overrides | ❌ | ✅ | — | — | class | ✅ |
|
||||
| Panel positioning | ❌ | custom CSS | ✅ `Positioner` | custom CSS | class | ✅ |
|
||||
| Modal / non-modal | ✅ | ✅ | ✅ | ✅ | primitive | ✅ Soma |
|
||||
| Alert dialog role | ✅ | separate primitive | ✅ | props | separate wrapper | ✅ Soma |
|
||||
| Focus trap / restore | ✅ | ✅ | ✅ | ✅ | primitive | ✅ Soma |
|
||||
| Escape / outside policies | ✅ | callbacks | ✅ | ✅ | primitive | ✅ Soma |
|
||||
| Nested dialogs | ✅ | basic | ✅ | ✅ | primitive | ✅ Soma |
|
||||
| Force mount for animation | ✅ | ✅ | ✅ | ✅ | primitive | ✅ Soma |
|
||||
| Scroll lock | ✅ | ✅ | ✅ | ✅ | primitive | ✅ Soma |
|
||||
|
||||
## Decisions
|
||||
|
||||
- **No `Dialog.Positioner` part**. Ark separates `Positioner`; Eidos exposes
|
||||
`Content.position` over the canonical 3x3 `Position` grid instead. A new part
|
||||
would duplicate a visual responsibility already represented by `Content`.
|
||||
- **Dimension overrides belong to Eidos**. `width`, `minWidth`, `maxWidth`,
|
||||
`height`, `minHeight` and `maxHeight` are visual-only props on
|
||||
`Dialog.Content`, serialized as private CSS variables. Soma remains unaware
|
||||
of them.
|
||||
- **Behavior stays in Soma**. Modal/non-modal mode, alertdialog role, focus,
|
||||
dismissal, nesting, scroll lock and force mount are inherited from Soma.
|
||||
|
||||
## Eidos API
|
||||
|
||||
```svelte
|
||||
<Dialog bind:open>
|
||||
<Dialog.Trigger>Open</Dialog.Trigger>
|
||||
<Dialog.Portal>
|
||||
<Dialog.Overlay overlayOpacity={0.52} />
|
||||
<Dialog.Content
|
||||
size="lg"
|
||||
position="top-center"
|
||||
maxWidth="min(90vw, 720px)"
|
||||
maxHeight="calc(100dvh - 4rem)"
|
||||
>
|
||||
<Dialog.Header>
|
||||
<Dialog.Title>Title</Dialog.Title>
|
||||
<Dialog.Description>Description</Dialog.Description>
|
||||
</Dialog.Header>
|
||||
<Dialog.Footer>
|
||||
<Dialog.Close>Close</Dialog.Close>
|
||||
</Dialog.Footer>
|
||||
</Dialog.Content>
|
||||
</Dialog.Portal>
|
||||
</Dialog>
|
||||
```
|
||||
Loading…
Reference in new issue