@podoba/react 0.0.52 → 0.0.53

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/package.json +4 -4
  2. package/src/components/asset-selection-surface.tsx +264 -67
  3. package/src/components/citation.examples.tsx +14 -0
  4. package/src/components/citation.tsx +27 -0
  5. package/src/components/column-layout.examples.tsx +34 -0
  6. package/src/components/column-layout.tsx +36 -0
  7. package/src/components/combobox.tsx +9 -4
  8. package/src/components/compact-settings-dialog.tsx +80 -21
  9. package/src/components/date-picker.tsx +49 -8
  10. package/src/components/delivery/send-to-print-modal.tsx +191 -225
  11. package/src/components/field-appearance.ts +11 -1
  12. package/src/components/icon-button.examples.tsx +16 -0
  13. package/src/components/icon-button.tsx +20 -0
  14. package/src/components/input.tsx +25 -12
  15. package/src/components/island-toolbar.examples.tsx +27 -0
  16. package/src/components/island-toolbar.tsx +39 -0
  17. package/src/components/media-asset-panel.examples.tsx +44 -5
  18. package/src/components/media-asset-panel.tsx +339 -28
  19. package/src/components/media-collection.examples.tsx +18 -0
  20. package/src/components/media-collection.tsx +206 -0
  21. package/src/components/number-field.tsx +18 -9
  22. package/src/components/preview-error.examples.tsx +20 -0
  23. package/src/components/preview-error.tsx +29 -0
  24. package/src/components/preview-metadata-card.examples.tsx +32 -0
  25. package/src/components/preview-metadata-card.tsx +112 -0
  26. package/src/components/search-field.tsx +27 -7
  27. package/src/components/select.tsx +81 -50
  28. package/src/components/settings-dialog-surface.tsx +553 -114
  29. package/src/components/template-catalog-card.tsx +309 -78
  30. package/src/components/textarea.tsx +160 -12
  31. package/src/components/tile.tsx +30 -16
  32. package/src/components/zoomable-image.examples.tsx +33 -0
  33. package/src/components/zoomable-image.tsx +185 -0
  34. package/src/index.ts +96 -78
@@ -1,6 +1,20 @@
1
- import { createContext, useContext, useEffect, useId, useState, type ComponentProps, type CSSProperties, type ReactNode, type RefObject } from 'react'
1
+ import {
2
+ createContext,
3
+ useContext,
4
+ useEffect,
5
+ useId,
6
+ useState,
7
+ type ComponentProps,
8
+ type CSSProperties,
9
+ type ReactNode,
10
+ type RefObject,
11
+ } from 'react'
2
12
  import { Button } from './button'
3
- import { Button as AriaButton, Disclosure as AriaDisclosure, DisclosurePanel as AriaDisclosurePanel } from 'react-aria-components'
13
+ import {
14
+ Button as AriaButton,
15
+ Disclosure as AriaDisclosure,
16
+ DisclosurePanel as AriaDisclosurePanel,
17
+ } from 'react-aria-components'
4
18
  import { ModalDialog, ModalOverlay, ModalSurface } from './dialog'
5
19
  import { DisplayHeading, Heading } from './text'
6
20
  import { uic } from '../utils/uic'
@@ -9,8 +23,14 @@ export const SETTINGS_DIALOG_VARIANTS = ['create', 'edit', 'catalog', 'csv', 'ba
9
23
  export type SettingsDialogVariant = (typeof SETTINGS_DIALOG_VARIANTS)[number]
10
24
 
11
25
  const LayoutContext = createContext({ variant: 'edit' as SettingsDialogVariant, compact: false })
12
- const Panel = uic(ModalSurface, { displayName: 'SettingsDialogPanel', baseClass: 'box-border flex flex-col overflow-hidden p-0' })
13
- const Layout = uic(ModalDialog, { displayName: 'SettingsDialogLayout', baseClass: 'relative flex min-h-0 flex-1 flex-col outline-none' })
26
+ const Panel = uic(ModalSurface, {
27
+ displayName: 'SettingsDialogPanel',
28
+ baseClass: 'box-border flex flex-col overflow-hidden p-0',
29
+ })
30
+ const Layout = uic(ModalDialog, {
31
+ displayName: 'SettingsDialogLayout',
32
+ baseClass: 'relative flex min-h-0 flex-1 flex-col outline-none',
33
+ })
14
34
  const Container = uic('div', { displayName: 'SettingsDialogContainer', baseClass: 'box-border mx-auto w-full' })
15
35
  const ScrollBody = uic('div', { displayName: 'SettingsDialogScrollBody', baseClass: 'min-h-0 flex-1 overflow-y-auto' })
16
36
  const Body = uic('div', { displayName: 'SettingsDialogBody', baseClass: 'flex w-full flex-col' })
@@ -21,8 +41,23 @@ const Columns = uic('div', { displayName: 'SettingsDialogColumns', baseClass: 'g
21
41
  * Widths use the viewport-sized, unpadded overlay; rem caps use the shared spacing scale.
22
42
  * Create and edit deliberately have different geometry, including below the 900px breakpoint.
23
43
  */
24
- export function SettingsDialogSurface({ variant, isOpen, onOpenChange, isPending = false,
25
- label, title, closeLabel, children, footer, filters, bodyRef, bodyTestId, description, describedBy, isWide = false, headerBottomPadding = false,
44
+ export function SettingsDialogSurface({
45
+ variant,
46
+ isOpen,
47
+ onOpenChange,
48
+ isPending = false,
49
+ label,
50
+ title,
51
+ closeLabel,
52
+ children,
53
+ footer,
54
+ filters,
55
+ bodyRef,
56
+ bodyTestId,
57
+ description,
58
+ describedBy,
59
+ isWide = false,
60
+ headerBottomPadding = false,
26
61
  }: {
27
62
  variant: SettingsDialogVariant
28
63
  isOpen: boolean
@@ -46,7 +81,9 @@ export function SettingsDialogSurface({ variant, isOpen, onOpenChange, isPending
46
81
  }) {
47
82
  const titleId = useId()
48
83
  const descriptionId = useId()
49
- const [compact, setCompact] = useState(() => typeof window !== 'undefined' && window.matchMedia('(max-width: 900px)').matches)
84
+ const [compact, setCompact] = useState(
85
+ () => typeof window !== 'undefined' && window.matchMedia('(max-width: 900px)').matches,
86
+ )
50
87
  useEffect(() => {
51
88
  const media = window.matchMedia('(max-width: 900px)')
52
89
  const change = () => setCompact(media.matches)
@@ -58,9 +95,20 @@ export function SettingsDialogSurface({ variant, isOpen, onOpenChange, isPending
58
95
  const catalog = variant === 'catalog'
59
96
  const csv = variant === 'csv'
60
97
  const basic = variant === 'basic'
61
- const containerClass = csv && isWide ? compact ? 'px-5' : 'px-6' : catalog ? '' : compact
62
- ? create ? 'px-(--settings-dialog-gutter-inline)' : 'px-5'
63
- : create ? 'max-w-200 px-(--settings-dialog-gutter-inline)' : 'max-w-192 px-6'
98
+ const containerClass =
99
+ csv && isWide
100
+ ? compact
101
+ ? 'px-5'
102
+ : 'px-6'
103
+ : catalog
104
+ ? ''
105
+ : compact
106
+ ? create
107
+ ? 'px-(--settings-dialog-gutter-inline)'
108
+ : 'px-5'
109
+ : create
110
+ ? 'max-w-200 px-(--settings-dialog-gutter-inline)'
111
+ : 'max-w-192 px-6'
64
112
  // Source uses spacing8 × .6 (spacing6 × .6 on narrow screens). Tailwind's
65
113
  // numeric spacing utilities do not emit .8/.6 steps, so derive a named value
66
114
  // from the shared spacing token rather than silently emitting no padding.
@@ -69,72 +117,252 @@ export function SettingsDialogSurface({ variant, isOpen, onOpenChange, isPending
69
117
  '--settings-dialog-gutter-inline': compact ? 'calc(var(--spacing) * 3.6)' : 'calc(var(--spacing) * 4.8)',
70
118
  }
71
119
  const panelClass = compact
72
- ? catalog || (csv && isWide) ? 'h-23/25 w-24/25' : 'h-23/25 w-47/50'
73
- : catalog ? 'h-9/10 max-h-324 w-9/10 max-w-432'
74
- : csv && isWide ? 'h-9/10 max-h-264 w-9/10 max-w-432'
75
- : create ? 'h-9/10 max-h-288 w-1/2 max-w-288' : 'h-9/10 max-h-264 w-9/10 max-w-204'
76
- const layoutClass = catalog ? compact ? 'gap-3 p-4' : 'gap-4 p-6'
77
- : csv || basic ? compact ? 'gap-8 py-6' : 'gap-10 py-10'
78
- : create ? compact ? 'gap-4 py-7.5' : 'gap-5 py-10'
79
- : compact ? 'py-6' : 'py-10'
80
- const bodyClass = catalog ? '' : basic ? 'gap-8' : create ? compact ? 'gap-4' : 'gap-5' : compact ? 'gap-8' : 'gap-10'
81
- return <LayoutContext.Provider value={{ variant, compact }}>
82
- <ModalOverlay className="p-0" isOpen={isOpen} onOpenChange={open => { if (!isPending) onOpenChange(open) }} isDismissable={!isPending} isKeyboardDismissDisabled={isPending}>
83
- <Panel className={panelClass} data-settings-variant={variant} data-settings-compact={compact}>
84
- <Layout aria-label={label} aria-labelledby={label ? undefined : titleId} aria-describedby={[description ? descriptionId : undefined, describedBy].filter(Boolean).join(' ') || undefined} className={layoutClass} style={layoutStyle}>
85
- <Button variant="ghost" aria-label={closeLabel} isDisabled={isPending} onPress={() => onOpenChange(false)} className="absolute end-4 top-3.5 z-10 h-8 w-8 rounded-md p-0 text-fg-subtle">
86
- <svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" aria-hidden="true"><path d="m6 6 12 12M18 6 6 18" /></svg>
120
+ ? catalog || (csv && isWide)
121
+ ? 'h-23/25 w-24/25'
122
+ : 'h-23/25 w-47/50'
123
+ : catalog
124
+ ? 'h-9/10 max-h-324 w-9/10 max-w-432'
125
+ : csv && isWide
126
+ ? 'h-9/10 max-h-264 w-9/10 max-w-432'
127
+ : create
128
+ ? 'h-9/10 max-h-288 w-1/2 max-w-288'
129
+ : 'h-9/10 max-h-264 w-9/10 max-w-204'
130
+ const layoutClass = catalog
131
+ ? compact
132
+ ? 'gap-3 p-4'
133
+ : 'gap-4 p-6'
134
+ : csv || basic
135
+ ? compact
136
+ ? 'gap-8 py-6'
137
+ : 'gap-10 py-10'
138
+ : create
139
+ ? compact
140
+ ? 'gap-4 py-7.5'
141
+ : 'gap-5 py-10'
142
+ : compact
143
+ ? 'py-6'
144
+ : 'py-10'
145
+ const bodyClass = catalog
146
+ ? ''
147
+ : basic
148
+ ? 'gap-8'
149
+ : create
150
+ ? compact
151
+ ? 'gap-4'
152
+ : 'gap-5'
153
+ : compact
154
+ ? 'gap-8'
155
+ : 'gap-10'
156
+ return (
157
+ <LayoutContext.Provider value={{ variant, compact }}>
158
+ <ModalOverlay
159
+ className="p-0"
160
+ isOpen={isOpen}
161
+ onOpenChange={(open) => {
162
+ if (!isPending) onOpenChange(open)
163
+ }}
164
+ isDismissable={!isPending}
165
+ isKeyboardDismissDisabled={isPending}
166
+ >
167
+ <Panel className={panelClass} data-settings-variant={variant} data-settings-compact={compact}>
168
+ <Layout
169
+ aria-label={label}
170
+ aria-labelledby={label ? undefined : titleId}
171
+ aria-describedby={
172
+ [description ? descriptionId : undefined, describedBy].filter(Boolean).join(' ') || undefined
173
+ }
174
+ className={layoutClass}
175
+ style={layoutStyle}
176
+ >
177
+ <Button
178
+ variant="ghost"
179
+ aria-label={closeLabel}
180
+ isDisabled={isPending}
181
+ onPress={() => onOpenChange(false)}
182
+ className="absolute end-4 top-3.5 z-10 h-9 w-9 rounded-md p-0 text-fg-subtle"
183
+ >
184
+ <svg
185
+ width="18"
186
+ height="18"
187
+ viewBox="0 0 24 24"
188
+ fill="none"
189
+ stroke="currentColor"
190
+ strokeWidth="2"
191
+ aria-hidden="true"
192
+ >
193
+ <path d="m6 6 12 12M18 6 6 18" />
194
+ </svg>
195
+ </Button>
196
+ <header
197
+ className={
198
+ catalog
199
+ ? 'flex shrink-0 flex-col gap-2'
200
+ : basic
201
+ ? headerBottomPadding
202
+ ? 'shrink-0 pb-4'
203
+ : 'shrink-0'
204
+ : create || csv
205
+ ? 'shrink-0 pb-4'
206
+ : 'shrink-0 pb-10 max-md:pb-8'
207
+ }
208
+ >
209
+ <Container className={containerClass}>
210
+ {catalog ? (
211
+ <Heading
212
+ id={titleId}
213
+ level="1"
214
+ className="m-0 mb-4 max-w-5/6 whitespace-pre-line"
215
+ style={{ letterSpacing: 0 }}
216
+ >
217
+ {title}
218
+ </Heading>
219
+ ) : (
220
+ <DisplayHeading
221
+ id={titleId}
222
+ className={`m-0 whitespace-pre-line pb-0.5 text-fg-muted ${create ? 'mb-4 max-w-5/6' : ''}`}
223
+ style={{
224
+ letterSpacing: 0,
225
+ ...(basic ? { maxWidth: '83.333%' } : csv && isWide ? { maxWidth: '34ch' } : {}),
226
+ }}
227
+ >
228
+ {title}
229
+ </DisplayHeading>
230
+ )}
231
+ {description ? (
232
+ <p
233
+ id={descriptionId}
234
+ className="mb-0 mt-3 text-small font-normal text-fg-workflow-muted"
235
+ style={{ maxWidth: '48ch' }}
236
+ >
237
+ {description}
238
+ </p>
239
+ ) : null}
240
+ </Container>
241
+ {filters ? <div className="w-full max-w-80">{filters}</div> : null}
242
+ </header>
243
+ <ScrollBody style={{ scrollbarGutter: 'stable' }}>
244
+ <Container className={containerClass}>
245
+ <Body ref={bodyRef} className={bodyClass} data-testid={bodyTestId}>
246
+ {children}
247
+ </Body>
248
+ </Container>
249
+ </ScrollBody>
250
+ {/* gs dialog footers sit on the white surface with no rule above them. */}
251
+ <footer
252
+ className={
253
+ catalog ? 'shrink-0 bg-surface pt-3' : create ? 'shrink-0 bg-surface pt-4' : 'shrink-0 bg-surface pt-5'
254
+ }
255
+ >
256
+ <Container className={containerClass}>
257
+ <div
258
+ className={`flex justify-end ${csv || basic ? 'items-center gap-1' : variant === 'edit' ? 'gap-3' : 'gap-2'}`}
259
+ >
260
+ {footer}
261
+ </div>
262
+ </Container>
263
+ </footer>
264
+ </Layout>
265
+ </Panel>
266
+ </ModalOverlay>
267
+ </LayoutContext.Provider>
268
+ )
269
+ }
270
+
271
+ /** Multi-step form/catalog envelope. Switching width preserves mounted drafts. */
272
+ export const WizardForm = uic('form', { displayName: 'WizardForm', baseClass: 'flex flex-col gap-8' })
273
+ const BriefText = uic('p', {
274
+ displayName: 'WizardBriefText',
275
+ baseClass: 'm-0 min-h-32 rounded-lg bg-surface-card p-4 text-small text-fg-workflow-muted',
276
+ })
277
+ export function WizardBrief({ label, children }: { label: ReactNode; children: ReactNode }) {
278
+ const id = useId()
279
+ return (
280
+ <Group className="gap-2" role="group" aria-labelledby={id}>
281
+ <SettingsDialogLabel id={id}>{label}</SettingsDialogLabel>
282
+ <BriefText>{children}</BriefText>
283
+ </Group>
284
+ )
285
+ }
286
+
287
+ export function WizardFormDialog({
288
+ isOpen,
289
+ onOpenChange,
290
+ isPending = false,
291
+ isExpanded = false,
292
+ title,
293
+ closeLabel,
294
+ children,
295
+ footer,
296
+ }: {
297
+ isOpen: boolean
298
+ onOpenChange: (open: boolean) => void
299
+ isPending?: boolean
300
+ isExpanded?: boolean
301
+ title: ReactNode
302
+ closeLabel: string
303
+ children: ReactNode
304
+ footer: ReactNode
305
+ }) {
306
+ const titleId = useId()
307
+ return (
308
+ <ModalOverlay
309
+ className="p-0"
310
+ isOpen={isOpen}
311
+ onOpenChange={(open) => {
312
+ if (!isPending) onOpenChange(open)
313
+ }}
314
+ isDismissable={!isPending}
315
+ isKeyboardDismissDisabled={isPending}
316
+ >
317
+ <Panel
318
+ data-wizard-expanded={isExpanded}
319
+ className={`h-23/25 max-h-23/25 w-24/25 max-w-24/25 min-[901px]:h-9/10 min-[901px]:max-h-288 min-[901px]:w-9/10 ${isExpanded ? 'min-[901px]:max-w-432' : 'min-[901px]:max-w-204'}`}
320
+ >
321
+ <Layout aria-labelledby={titleId} className="gap-8 py-6 min-[901px]:gap-10 min-[901px]:py-10">
322
+ <Button
323
+ variant="ghost"
324
+ aria-label={closeLabel}
325
+ isDisabled={isPending}
326
+ onPress={() => onOpenChange(false)}
327
+ className="absolute end-4 top-3.5 z-10 h-9 w-9 rounded-md p-0 text-fg-subtle"
328
+ >
329
+ <svg
330
+ width="18"
331
+ height="18"
332
+ viewBox="0 0 24 24"
333
+ fill="none"
334
+ stroke="currentColor"
335
+ strokeWidth="2"
336
+ aria-hidden="true"
337
+ >
338
+ <path d="m6 6 12 12M18 6 6 18" />
339
+ </svg>
87
340
  </Button>
88
- <header className={catalog ? 'flex shrink-0 flex-col gap-2' : basic ? headerBottomPadding ? 'shrink-0 pb-4' : 'shrink-0' : create || csv ? 'shrink-0 pb-4' : 'shrink-0 pb-10 max-md:pb-8'}>
89
- <Container className={containerClass}>
90
- {catalog ? <Heading id={titleId} level="1" className="m-0 mb-4 max-w-5/6 whitespace-pre-line" style={{ letterSpacing: 0 }}>{title}</Heading>
91
- : <DisplayHeading id={titleId} className={`m-0 whitespace-pre-line pb-0.5 text-fg-muted ${create ? 'mb-4 max-w-5/6' : ''}`} style={{ letterSpacing: 0, ...(basic ? { maxWidth: '83.333%' } : csv && isWide ? { maxWidth: '34ch' } : {}) }}>{title}</DisplayHeading>}
92
- {description ? <p id={descriptionId} className="mb-0 mt-3 text-small font-normal text-fg-workflow-muted" style={{ maxWidth: '48ch' }}>{description}</p> : null}
341
+ <header className="shrink-0">
342
+ <Container className="max-w-384 px-5 min-[901px]:px-6">
343
+ <DisplayHeading
344
+ id={titleId}
345
+ className="m-0 whitespace-pre-line pb-0.5 text-fg-muted"
346
+ style={{ letterSpacing: 0 }}
347
+ >
348
+ {title}
349
+ </DisplayHeading>
93
350
  </Container>
94
- {filters ? <div className="w-full max-w-80">{filters}</div> : null}
95
351
  </header>
96
352
  <ScrollBody style={{ scrollbarGutter: 'stable' }}>
97
- <Container className={containerClass}>
98
- <Body ref={bodyRef} className={bodyClass} data-testid={bodyTestId}>{children}</Body>
353
+ <Container className="max-w-384 px-5 min-[901px]:px-6">
354
+ <Body className="gap-8">{children}</Body>
99
355
  </Container>
100
356
  </ScrollBody>
101
- {/* gs dialog footers sit on the white surface with no rule above them. */}
102
- <footer className={catalog ? 'shrink-0 bg-surface pt-3' : create ? 'shrink-0 bg-surface pt-4' : 'shrink-0 bg-surface pt-5'}>
103
- <Container className={containerClass}>
104
- <div className={`flex justify-end ${csv || basic ? 'items-center gap-1' : variant === 'edit' ? 'gap-3' : 'gap-2'}`}>{footer}</div>
357
+ <footer className="shrink-0 bg-surface pt-5">
358
+ <Container className="max-w-384 px-5 min-[901px]:px-6">
359
+ <div className="flex flex-wrap justify-end gap-2">{footer}</div>
105
360
  </Container>
106
361
  </footer>
107
362
  </Layout>
108
363
  </Panel>
109
364
  </ModalOverlay>
110
- </LayoutContext.Provider>
111
- }
112
-
113
- /** Multi-step form/catalog envelope. Switching width preserves mounted drafts. */
114
- export const WizardForm = uic('form', { displayName: 'WizardForm', baseClass: 'flex flex-col gap-8' })
115
- const BriefText = uic('p', { displayName: 'WizardBriefText', baseClass: 'm-0 min-h-32 rounded-lg bg-surface-card p-4 text-small text-fg-workflow-muted' })
116
- export function WizardBrief({ label, children }: { label: ReactNode; children: ReactNode }) {
117
- const id = useId()
118
- return <Group className="gap-2" role="group" aria-labelledby={id}><SettingsDialogLabel id={id}>{label}</SettingsDialogLabel><BriefText>{children}</BriefText></Group>
119
- }
120
-
121
- export function WizardFormDialog({ isOpen, onOpenChange, isPending = false, isExpanded = false, title, closeLabel, children, footer }: {
122
- isOpen: boolean; onOpenChange: (open: boolean) => void; isPending?: boolean; isExpanded?: boolean
123
- title: ReactNode; closeLabel: string; children: ReactNode; footer: ReactNode
124
- }) {
125
- const titleId = useId()
126
- return <ModalOverlay className="p-0" isOpen={isOpen} onOpenChange={open => { if (!isPending) onOpenChange(open) }} isDismissable={!isPending} isKeyboardDismissDisabled={isPending}>
127
- <Panel data-wizard-expanded={isExpanded} className={`h-23/25 max-h-23/25 w-24/25 max-w-24/25 min-[901px]:h-9/10 min-[901px]:max-h-288 min-[901px]:w-9/10 ${isExpanded ? 'min-[901px]:max-w-432' : 'min-[901px]:max-w-204'}`}>
128
- <Layout aria-labelledby={titleId} className="gap-8 py-6 min-[901px]:gap-10 min-[901px]:py-10">
129
- <Button variant="ghost" aria-label={closeLabel} isDisabled={isPending} onPress={() => onOpenChange(false)} className="absolute end-4 top-3.5 z-10 h-8 w-8 rounded-md p-0 text-fg-subtle">
130
- <svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" aria-hidden="true"><path d="m6 6 12 12M18 6 6 18" /></svg>
131
- </Button>
132
- <header className="shrink-0"><Container className="max-w-384 px-5 min-[901px]:px-6"><DisplayHeading id={titleId} className="m-0 whitespace-pre-line pb-0.5 text-fg-muted" style={{ letterSpacing: 0 }}>{title}</DisplayHeading></Container></header>
133
- <ScrollBody style={{ scrollbarGutter: 'stable' }}><Container className="max-w-384 px-5 min-[901px]:px-6"><Body className="gap-8">{children}</Body></Container></ScrollBody>
134
- <footer className="shrink-0 bg-surface pt-5"><Container className="max-w-384 px-5 min-[901px]:px-6"><div className="flex flex-wrap justify-end gap-2">{footer}</div></Container></footer>
135
- </Layout>
136
- </Panel>
137
- </ModalOverlay>
365
+ )
138
366
  }
139
367
 
140
368
  // The source New section dialog separates its groups by spacing only, no hairlines.
@@ -149,7 +377,13 @@ export function SettingsDialogDescription({ children }: { children: ReactNode })
149
377
  export function SettingsDialogColumns({ children, metadata = false }: { children: ReactNode; metadata?: boolean }) {
150
378
  const { variant, compact } = useContext(LayoutContext)
151
379
  if (metadata) return <Columns className={`${compact ? 'grid-cols-1' : 'grid-cols-3'} gap-3`}>{children}</Columns>
152
- return <Columns className={`${compact ? 'grid-cols-1' : 'grid-cols-2'} ${variant === 'create' ? compact ? 'gap-3' : 'gap-4' : 'gap-8'}`}>{children}</Columns>
380
+ return (
381
+ <Columns
382
+ className={`${compact ? 'grid-cols-1' : 'grid-cols-2'} ${variant === 'create' ? (compact ? 'gap-3' : 'gap-4') : 'gap-8'}`}
383
+ >
384
+ {children}
385
+ </Columns>
386
+ )
153
387
  }
154
388
  export function SettingsDialogGroup({ children }: { children: ReactNode }) {
155
389
  const { variant } = useContext(LayoutContext)
@@ -160,7 +394,9 @@ export function SettingsDialogGroup({ children }: { children: ReactNode }) {
160
394
  * Independent of SettingsDialogSurface's 900px breakpoint; this source uses1100px.
161
395
  */
162
396
  export function SettingsDialogProductionColumns({ children }: { children: ReactNode }) {
163
- const [compact, setCompact] = useState(() => typeof window !== 'undefined' && window.matchMedia('(max-width: 1100px)').matches)
397
+ const [compact, setCompact] = useState(
398
+ () => typeof window !== 'undefined' && window.matchMedia('(max-width: 1100px)').matches,
399
+ )
164
400
  useEffect(() => {
165
401
  const media = window.matchMedia('(max-width: 1100px)')
166
402
  const change = () => setCompact(media.matches)
@@ -168,7 +404,11 @@ export function SettingsDialogProductionColumns({ children }: { children: ReactN
168
404
  media.addEventListener('change', change)
169
405
  return () => media.removeEventListener('change', change)
170
406
  }, [])
171
- return <Columns data-settings-production-columns className={`${compact ? 'grid-cols-1' : 'grid-cols-2'} min-w-0 gap-4`}>{children}</Columns>
407
+ return (
408
+ <Columns data-settings-production-columns className={`${compact ? 'grid-cols-1' : 'grid-cols-2'} min-w-0 gap-4`}>
409
+ {children}
410
+ </Columns>
411
+ )
172
412
  }
173
413
  export function SettingsDialogControl({ children }: { children: ReactNode }) {
174
414
  const { variant } = useContext(LayoutContext)
@@ -178,71 +418,270 @@ const Label = uic('p', { displayName: 'SettingsDialogLabel', baseClass: 'm-0 tex
178
418
  /** Group label. The create variant uses the source New section group label: 16px/22px semibold. */
179
419
  export function SettingsDialogLabel({ className, ...props }: ComponentProps<typeof Label>) {
180
420
  const { variant } = useContext(LayoutContext)
181
- return <Label {...props} className={[variant === 'create' ? 'text-body leading-5.5 font-semibold' : '', className].filter(Boolean).join(' ') || undefined} />
421
+ return (
422
+ <Label
423
+ {...props}
424
+ className={
425
+ [variant === 'create' ? 'text-body leading-5.5 font-semibold' : '', className].filter(Boolean).join(' ') ||
426
+ undefined
427
+ }
428
+ />
429
+ )
182
430
  }
183
431
  export const SettingsDialogEmphasis = uic('span', { displayName: 'SettingsDialogEmphasis', baseClass: 'text-fg' })
184
- const Hint = uic('p', { displayName: 'SettingsDialogHint', baseClass: 'm-0 text-small font-normal text-fg-workflow-muted' })
432
+ const Hint = uic('p', {
433
+ displayName: 'SettingsDialogHint',
434
+ baseClass: 'm-0 text-small font-normal text-fg-workflow-muted',
435
+ })
185
436
  /** Helper line. The create variant uses the source 16px/22px `#242423` hint. */
186
437
  export function SettingsDialogHint({ style, className, ...props }: ComponentProps<typeof Hint>) {
187
438
  const { variant } = useContext(LayoutContext)
188
- return <Hint {...props} className={[variant === 'create' ? 'text-body leading-5.5 text-surface-inverted' : '', className].filter(Boolean).join(' ') || undefined} style={{ ...(variant === 'basic' ? { maxWidth: '48ch' } : {}), ...style }} />
439
+ return (
440
+ <Hint
441
+ {...props}
442
+ className={
443
+ [variant === 'create' ? 'text-body leading-5.5 text-surface-inverted' : '', className]
444
+ .filter(Boolean)
445
+ .join(' ') || undefined
446
+ }
447
+ style={{ ...(variant === 'basic' ? { maxWidth: '48ch' } : {}), ...style }}
448
+ />
449
+ )
189
450
  }
190
- export const SettingsDialogAction = uic(Button, { displayName: 'SettingsDialogAction', baseClass: 'h-11.5 rounded-full px-6 text-base font-medium leading-5', style: { letterSpacing: 0 } })
451
+ export const SettingsDialogAction = uic(Button, {
452
+ displayName: 'SettingsDialogAction',
453
+ baseClass: 'h-11.5 rounded-full px-6 text-base font-medium leading-5',
454
+ style: { letterSpacing: 0 },
455
+ })
191
456
 
192
- const ProductionLayout = uic(ModalDialog, { displayName: 'ProductionSettingsLayout', baseClass: 'relative grid h-full min-h-0 w-full overflow-hidden outline-none' })
193
- const ProductionHeader = uic('header', { displayName: 'ProductionSettingsHeader', baseClass: 'flex shrink-0 flex-col items-start gap-4 px-8 pb-6 pt-8' })
194
- const ProductionTitle = uic('h1', { displayName: 'ProductionSettingsTitle', baseClass: 'm-0 max-w-132 text-display-large font-medium text-fg-muted', style: { letterSpacing: '-0.02em' } })
195
- const ProductionDescription = uic('p', { displayName: 'ProductionSettingsDescription', baseClass: 'm-0 max-w-132 text-body font-normal text-fg' })
196
- const ProductionFields = uic('div', { displayName: 'ProductionSettingsFields', baseClass: 'flex min-h-0 flex-col gap-6 px-8 pb-8' })
197
- const ProductionFooter = uic('footer', { displayName: 'ProductionSettingsFooter', baseClass: 'relative z-10 flex shrink-0 flex-wrap items-center gap-2 bg-surface px-8 pb-8 pt-4' })
198
- const ProductionPreview = uic('aside', { displayName: 'ProductionSettingsPreview', baseClass: 'relative grid min-h-0 min-w-0 place-items-center overflow-hidden p-10', style: { background: 'radial-gradient(circle at 50% 42%, color-mix(in srgb, var(--color-surface) 8%, transparent) 0, transparent 42%), color-mix(in srgb, var(--color-fg) 84%, var(--color-surface))' } })
199
- const ProductionArtwork = uic('div', { displayName: 'ProductionSettingsArtwork', baseClass: 'min-h-0 min-w-0 overflow-hidden', style: { width: '80%', height: '80%' } })
200
- export const ProductionSettingsAction = uic(Button, { displayName: 'ProductionSettingsAction', baseClass: 'min-h-10 rounded-full px-6 text-body font-medium' })
457
+ const ProductionLayout = uic(ModalDialog, {
458
+ displayName: 'ProductionSettingsLayout',
459
+ baseClass: 'relative grid h-full min-h-0 w-full overflow-hidden outline-none',
460
+ })
461
+ const ProductionHeader = uic('header', {
462
+ displayName: 'ProductionSettingsHeader',
463
+ baseClass: 'flex shrink-0 flex-col items-start gap-4 px-8 pb-6 pt-8',
464
+ })
465
+ const ProductionTitle = uic('h1', {
466
+ displayName: 'ProductionSettingsTitle',
467
+ baseClass: 'm-0 max-w-132 text-display-large font-medium text-fg-muted',
468
+ style: { letterSpacing: '-0.02em' },
469
+ })
470
+ const ProductionDescription = uic('p', {
471
+ displayName: 'ProductionSettingsDescription',
472
+ baseClass: 'm-0 max-w-132 text-body font-normal text-fg',
473
+ })
474
+ const ProductionFields = uic('div', {
475
+ displayName: 'ProductionSettingsFields',
476
+ baseClass: 'flex min-h-0 flex-col gap-6 px-8 pb-8',
477
+ })
478
+ const ProductionFooter = uic('footer', {
479
+ displayName: 'ProductionSettingsFooter',
480
+ baseClass: 'relative z-10 flex shrink-0 flex-wrap items-center gap-2 bg-surface px-8 pb-8 pt-4',
481
+ })
482
+ const ProductionPreview = uic('aside', {
483
+ displayName: 'ProductionSettingsPreview',
484
+ baseClass: 'relative grid min-h-0 min-w-0 place-items-center overflow-hidden p-10',
485
+ style: {
486
+ background:
487
+ 'radial-gradient(circle at 50% 42%, color-mix(in srgb, var(--color-surface) 8%, transparent) 0, transparent 42%), color-mix(in srgb, var(--color-fg) 84%, var(--color-surface))',
488
+ },
489
+ })
490
+ const ProductionArtwork = uic('div', {
491
+ displayName: 'ProductionSettingsArtwork',
492
+ baseClass: 'min-h-0 min-w-0 overflow-hidden',
493
+ style: { width: '80%', height: '80%' },
494
+ })
495
+ export const ProductionSettingsAction = uic(Button, {
496
+ displayName: 'ProductionSettingsAction',
497
+ baseClass: 'min-h-10 rounded-full px-6 text-body font-medium',
498
+ })
201
499
 
202
500
  /** Wide production settings, not the content editor's independently tuned split. */
203
- export function ProductionSettingsDialog({ isOpen, onOpenChange, prefix, title, description, closeLabel, children, preview, footer, testId = 'production-settings' }: {
204
- isOpen: boolean; onOpenChange: (open: boolean) => void; prefix: ReactNode; title: ReactNode; description: ReactNode; closeLabel: string
205
- children: ReactNode; preview: ReactNode; footer: ReactNode; testId?: string
501
+ export function ProductionSettingsDialog({
502
+ isOpen,
503
+ onOpenChange,
504
+ prefix,
505
+ title,
506
+ description,
507
+ closeLabel,
508
+ children,
509
+ preview,
510
+ footer,
511
+ testId = 'production-settings',
512
+ isPending = false,
513
+ previewSize = 'contained',
514
+ previewLabel,
515
+ }: {
516
+ isPending?: boolean
517
+ previewLabel?: string
518
+ previewSize?: 'contained' | 'full'
519
+ isOpen: boolean
520
+ onOpenChange: (open: boolean) => void
521
+ prefix: ReactNode
522
+ title: ReactNode
523
+ description: ReactNode
524
+ closeLabel: string
525
+ children: ReactNode
526
+ preview: ReactNode
527
+ footer: ReactNode
528
+ testId?: string
206
529
  }) {
207
- const titleId = useId(), descriptionId = useId()
530
+ const titleId = useId(),
531
+ descriptionId = useId()
208
532
  const query = '(max-width: 1100px), (orientation: portrait)'
209
533
  const [compact, setCompact] = useState(() => typeof window !== 'undefined' && window.matchMedia(query).matches)
210
534
  useEffect(() => {
211
- const media = window.matchMedia(query), change = () => setCompact(media.matches)
212
- change(); media.addEventListener('change', change)
535
+ const media = window.matchMedia(query),
536
+ change = () => setCompact(media.matches)
537
+ change()
538
+ media.addEventListener('change', change)
213
539
  return () => media.removeEventListener('change', change)
214
540
  }, [])
215
- return <ModalOverlay isOpen={isOpen} onOpenChange={onOpenChange} isDismissable className="p-0">
216
- <Panel style={{ width: compact ? '96vw' : 'min(90vw, 110rem)', maxWidth: compact ? '96vw' : 'min(90vw, 110rem)', height: compact ? '92vh' : 'min(82vh, 63.125rem)', maxHeight: compact ? '92vh' : 'min(82vh, 63.125rem)' }}>
217
- <ProductionLayout aria-labelledby={titleId} aria-describedby={descriptionId} data-testid={testId} data-production-compact={compact} style={{ gridTemplateColumns: compact ? 'minmax(0,1fr)' : 'minmax(calc(var(--spacing) * 90),2fr) minmax(0,4fr)', gridTemplateRows: compact ? 'minmax(18rem,44%) minmax(0,1fr)' : 'minmax(0,1fr)' }}>
218
- <section className={`flex min-h-0 min-w-0 flex-col bg-surface ${compact ? 'row-start-2 overflow-y-auto' : 'overflow-hidden'}`} aria-labelledby={titleId}>
219
- <ProductionHeader><ProductionTitle id={titleId}>{prefix}{' '}<span className="text-fg">{title}</span></ProductionTitle><ProductionDescription id={descriptionId}>{description}</ProductionDescription></ProductionHeader>
220
- <ProductionFields data-testid={`${testId}-form`} className={compact ? 'shrink-0' : 'flex-1 overflow-y-auto'} style={{ scrollbarGutter: 'stable' }}>{children}</ProductionFields>
221
- <ProductionFooter>{footer}</ProductionFooter>
222
- </section>
223
- <ProductionPreview className={compact ? 'col-start-1 row-start-1' : undefined} data-testid={`${testId}-preview`}><ProductionArtwork data-testid={`${testId}-artwork`}>{preview}</ProductionArtwork></ProductionPreview>
224
- <Button variant="ghost" aria-label={closeLabel} onPress={() => onOpenChange(false)} className="absolute right-4 top-4 z-20 h-8 w-8 rounded-md p-0 text-white/60 hover:bg-transparent hover:text-white"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" aria-hidden="true"><path d="m6 6 12 12M18 6 6 18" /></svg></Button>
225
- </ProductionLayout>
226
- </Panel>
227
- </ModalOverlay>
541
+ return (
542
+ <ModalOverlay
543
+ isOpen={isOpen}
544
+ onOpenChange={(open) => {
545
+ if (!isPending) onOpenChange(open)
546
+ }}
547
+ isDismissable={!isPending}
548
+ isKeyboardDismissDisabled={isPending}
549
+ className="p-0"
550
+ >
551
+ <Panel
552
+ style={{
553
+ width: compact ? '96vw' : 'min(90vw, 110rem)',
554
+ maxWidth: compact ? '96vw' : 'min(90vw, 110rem)',
555
+ height: compact ? '92vh' : 'min(82vh, 63.125rem)',
556
+ maxHeight: compact ? '92vh' : 'min(82vh, 63.125rem)',
557
+ }}
558
+ >
559
+ <ProductionLayout
560
+ aria-labelledby={titleId}
561
+ aria-describedby={descriptionId}
562
+ data-testid={testId}
563
+ data-production-compact={compact}
564
+ style={{
565
+ gridTemplateColumns: compact ? 'minmax(0,1fr)' : 'minmax(calc(var(--spacing) * 90),2fr) minmax(0,4fr)',
566
+ gridTemplateRows: compact ? 'minmax(18rem,44%) minmax(0,1fr)' : 'minmax(0,1fr)',
567
+ }}
568
+ >
569
+ <section
570
+ className={`flex min-h-0 min-w-0 flex-col bg-surface ${compact ? 'row-start-2 overflow-y-auto' : 'overflow-hidden'}`}
571
+ aria-labelledby={titleId}
572
+ >
573
+ <ProductionHeader>
574
+ <ProductionTitle id={titleId}>
575
+ {prefix} <span className="text-fg">{title}</span>
576
+ </ProductionTitle>
577
+ <ProductionDescription id={descriptionId}>{description}</ProductionDescription>
578
+ </ProductionHeader>
579
+ <ProductionFields
580
+ data-testid={`${testId}-form`}
581
+ className={compact ? 'shrink-0' : 'flex-1 overflow-y-auto'}
582
+ style={{ scrollbarGutter: 'stable' }}
583
+ >
584
+ {children}
585
+ </ProductionFields>
586
+ <ProductionFooter>{footer}</ProductionFooter>
587
+ </section>
588
+ <ProductionPreview
589
+ aria-label={previewLabel}
590
+ className={compact ? 'col-start-1 row-start-1' : undefined}
591
+ data-testid={`${testId}-preview`}
592
+ >
593
+ <ProductionArtwork
594
+ style={previewSize === 'full' ? { width: '100%', height: '100%' } : undefined}
595
+ data-testid={`${testId}-artwork`}
596
+ >
597
+ {preview}
598
+ </ProductionArtwork>
599
+ </ProductionPreview>
600
+ <Button
601
+ variant="ghost"
602
+ aria-label={closeLabel}
603
+ isDisabled={isPending}
604
+ onPress={() => onOpenChange(false)}
605
+ className="absolute right-4 top-4 z-20 h-9 w-9 rounded-md p-0 text-white/60 hover:bg-transparent hover:text-white"
606
+ >
607
+ <svg
608
+ width="18"
609
+ height="18"
610
+ viewBox="0 0 24 24"
611
+ fill="none"
612
+ stroke="currentColor"
613
+ strokeWidth="2"
614
+ aria-hidden="true"
615
+ >
616
+ <path d="m6 6 12 12M18 6 6 18" />
617
+ </svg>
618
+ </Button>
619
+ </ProductionLayout>
620
+ </Panel>
621
+ </ModalOverlay>
622
+ )
228
623
  }
229
624
 
230
- const DisclosureRoot = uic(AriaDisclosure, { displayName: 'SettingsDisclosureRoot', baseClass: 'group/settings-disclosure flex min-w-0 flex-col gap-3' })
231
- const DisclosureTrigger = uic(AriaButton, { displayName: 'SettingsDisclosureTrigger', baseClass: 'flex w-full cursor-pointer items-start justify-between gap-3 bg-transparent p-0 text-left outline-none data-[focus-visible]:outline-solid data-[focus-visible]:outline-2 data-[focus-visible]:outline-ring data-[focus-visible]:outline-offset-2' })
625
+ const DisclosureRoot = uic(AriaDisclosure, {
626
+ displayName: 'SettingsDisclosureRoot',
627
+ baseClass: 'group/settings-disclosure flex min-w-0 flex-col gap-3',
628
+ })
629
+ const DisclosureTrigger = uic(AriaButton, {
630
+ displayName: 'SettingsDisclosureTrigger',
631
+ baseClass:
632
+ 'flex w-full cursor-pointer items-start justify-between gap-3 bg-transparent p-0 text-left outline-none data-[focus-visible]:outline-solid data-[focus-visible]:outline-2 data-[focus-visible]:outline-ring data-[focus-visible]:outline-offset-2',
633
+ })
232
634
  const DisclosureCopy = uic('span', { displayName: 'SettingsDisclosureCopy', baseClass: 'flex min-w-0 flex-col gap-1' })
233
- const DisclosureTitle = uic('strong', { displayName: 'SettingsDisclosureTitle', baseClass: 'text-body font-medium leading-normal text-fg' })
234
- const DisclosureHint = uic('span', { displayName: 'SettingsDisclosureHint', baseClass: 'text-body font-normal leading-normal text-fg-workflow-muted' })
235
- const DisclosureBody = uic(AriaDisclosurePanel, { displayName: 'SettingsDisclosureBody', baseClass: 'flex min-w-0 flex-col gap-5 pt-3' })
635
+ const DisclosureTitle = uic('strong', {
636
+ displayName: 'SettingsDisclosureTitle',
637
+ baseClass: 'text-body font-medium leading-normal text-fg',
638
+ })
639
+ const DisclosureHint = uic('span', {
640
+ displayName: 'SettingsDisclosureHint',
641
+ baseClass: 'text-body font-normal leading-normal text-fg-workflow-muted',
642
+ })
643
+ const DisclosureBody = uic(AriaDisclosurePanel, {
644
+ displayName: 'SettingsDisclosureBody',
645
+ baseClass: 'flex min-w-0 flex-col gap-5 pt-3',
646
+ })
236
647
 
237
648
  /** Source outputTaskDropdownPanel: labelled, initially expanded settings group. */
238
- export function SettingsDialogDisclosure({ title, description, children, defaultExpanded = true }: {
239
- title: ReactNode; description?: ReactNode; children: ReactNode; defaultExpanded?: boolean
649
+ export function SettingsDialogDisclosure({
650
+ title,
651
+ description,
652
+ children,
653
+ defaultExpanded = true,
654
+ }: {
655
+ title: ReactNode
656
+ description?: ReactNode
657
+ children: ReactNode
658
+ defaultExpanded?: boolean
240
659
  }) {
241
- return <DisclosureRoot defaultExpanded={defaultExpanded}>
242
- <DisclosureTrigger slot="trigger">
243
- <DisclosureCopy><DisclosureTitle>{title}</DisclosureTitle>{description ? <DisclosureHint>{description}</DisclosureHint> : null}</DisclosureCopy>
244
- <svg aria-hidden="true" width="15" height="15" viewBox="0 0 15 15" fill="none" className="mt-1 shrink-0 text-fg-workflow-muted transition-transform duration-150 group-data-[expanded]/settings-disclosure:rotate-180 motion-reduce:transition-none"><path d="m3.5 5.5 4 4 4-4" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round" /></svg>
245
- </DisclosureTrigger>
246
- <DisclosureBody>{children}</DisclosureBody>
247
- </DisclosureRoot>
660
+ return (
661
+ <DisclosureRoot defaultExpanded={defaultExpanded}>
662
+ <DisclosureTrigger slot="trigger">
663
+ <DisclosureCopy>
664
+ <DisclosureTitle>{title}</DisclosureTitle>
665
+ {description ? <DisclosureHint>{description}</DisclosureHint> : null}
666
+ </DisclosureCopy>
667
+ <svg
668
+ aria-hidden="true"
669
+ width="15"
670
+ height="15"
671
+ viewBox="0 0 15 15"
672
+ fill="none"
673
+ className="mt-1 shrink-0 text-fg-workflow-muted transition-transform duration-150 group-data-[expanded]/settings-disclosure:rotate-180 motion-reduce:transition-none"
674
+ >
675
+ <path
676
+ d="m3.5 5.5 4 4 4-4"
677
+ stroke="currentColor"
678
+ strokeWidth="1.5"
679
+ strokeLinecap="round"
680
+ strokeLinejoin="round"
681
+ />
682
+ </svg>
683
+ </DisclosureTrigger>
684
+ <DisclosureBody>{children}</DisclosureBody>
685
+ </DisclosureRoot>
686
+ )
248
687
  }