@podoba/react 0.0.52 → 0.0.54
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.
- package/package.json +4 -4
- package/src/components/asset-selection-surface.tsx +264 -67
- package/src/components/citation.examples.tsx +14 -0
- package/src/components/citation.tsx +27 -0
- package/src/components/column-layout.examples.tsx +34 -0
- package/src/components/column-layout.tsx +36 -0
- package/src/components/combobox.tsx +9 -4
- package/src/components/compact-settings-dialog.tsx +80 -21
- package/src/components/date-picker.tsx +49 -8
- package/src/components/delivery/send-to-print-modal.tsx +191 -225
- package/src/components/field-appearance.ts +11 -1
- package/src/components/field-autofocus.ts +23 -0
- package/src/components/icon-button.examples.tsx +16 -0
- package/src/components/icon-button.tsx +20 -0
- package/src/components/input.tsx +37 -21
- package/src/components/island-toolbar.examples.tsx +27 -0
- package/src/components/island-toolbar.tsx +39 -0
- package/src/components/media-asset-panel.examples.tsx +44 -5
- package/src/components/media-asset-panel.tsx +339 -28
- package/src/components/media-collection.examples.tsx +18 -0
- package/src/components/media-collection.tsx +206 -0
- package/src/components/number-field.tsx +18 -9
- package/src/components/preview-error.examples.tsx +20 -0
- package/src/components/preview-error.tsx +29 -0
- package/src/components/preview-metadata-card.examples.tsx +32 -0
- package/src/components/preview-metadata-card.tsx +112 -0
- package/src/components/search-field.tsx +27 -7
- package/src/components/select.tsx +81 -50
- package/src/components/settings-dialog-surface.tsx +560 -114
- package/src/components/template-catalog-card.tsx +309 -78
- package/src/components/textarea.tsx +174 -23
- package/src/components/tile.tsx +30 -16
- package/src/components/zoomable-image.examples.tsx +33 -0
- package/src/components/zoomable-image.tsx +185 -0
- package/src/index.ts +96 -78
|
@@ -1,6 +1,20 @@
|
|
|
1
|
-
import {
|
|
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 {
|
|
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, {
|
|
13
|
-
|
|
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({
|
|
25
|
-
|
|
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(
|
|
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 =
|
|
62
|
-
|
|
63
|
-
|
|
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,259 @@ 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)
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
:
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
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
|
+
ariaLabel,
|
|
294
|
+
closeLabel,
|
|
295
|
+
children,
|
|
296
|
+
footer,
|
|
297
|
+
}: {
|
|
298
|
+
isOpen: boolean
|
|
299
|
+
onOpenChange: (open: boolean) => void
|
|
300
|
+
isPending?: boolean
|
|
301
|
+
isExpanded?: boolean
|
|
302
|
+
title: ReactNode
|
|
303
|
+
/** Stable accessible name when the visual heading changes between steps. */
|
|
304
|
+
ariaLabel?: string
|
|
305
|
+
closeLabel: string
|
|
306
|
+
children: ReactNode
|
|
307
|
+
footer: ReactNode
|
|
308
|
+
}) {
|
|
309
|
+
const titleId = useId()
|
|
310
|
+
return (
|
|
311
|
+
<ModalOverlay
|
|
312
|
+
className="p-0"
|
|
313
|
+
isOpen={isOpen}
|
|
314
|
+
onOpenChange={(open) => {
|
|
315
|
+
if (!isPending) onOpenChange(open)
|
|
316
|
+
}}
|
|
317
|
+
isDismissable={!isPending}
|
|
318
|
+
isKeyboardDismissDisabled={isPending}
|
|
319
|
+
>
|
|
320
|
+
<Panel
|
|
321
|
+
data-wizard-expanded={isExpanded}
|
|
322
|
+
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'}`}
|
|
323
|
+
>
|
|
324
|
+
<Layout
|
|
325
|
+
aria-label={ariaLabel}
|
|
326
|
+
aria-labelledby={ariaLabel ? undefined : titleId}
|
|
327
|
+
className="gap-8 py-6 min-[901px]:gap-10 min-[901px]:py-10"
|
|
328
|
+
>
|
|
329
|
+
<Button
|
|
330
|
+
variant="ghost"
|
|
331
|
+
aria-label={closeLabel}
|
|
332
|
+
isDisabled={isPending}
|
|
333
|
+
onPress={() => onOpenChange(false)}
|
|
334
|
+
className="absolute end-4 top-3.5 z-10 h-9 w-9 rounded-md p-0 text-fg-subtle"
|
|
335
|
+
>
|
|
336
|
+
<svg
|
|
337
|
+
width="18"
|
|
338
|
+
height="18"
|
|
339
|
+
viewBox="0 0 24 24"
|
|
340
|
+
fill="none"
|
|
341
|
+
stroke="currentColor"
|
|
342
|
+
strokeWidth="2"
|
|
343
|
+
aria-hidden="true"
|
|
344
|
+
>
|
|
345
|
+
<path d="m6 6 12 12M18 6 6 18" />
|
|
346
|
+
</svg>
|
|
87
347
|
</Button>
|
|
88
|
-
<header className=
|
|
89
|
-
<Container className=
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
348
|
+
<header className="shrink-0">
|
|
349
|
+
<Container className="max-w-384 px-5 min-[901px]:px-6">
|
|
350
|
+
<DisplayHeading
|
|
351
|
+
id={titleId}
|
|
352
|
+
className="m-0 whitespace-pre-line pb-0.5 text-fg-muted"
|
|
353
|
+
style={{ letterSpacing: 0 }}
|
|
354
|
+
>
|
|
355
|
+
{title}
|
|
356
|
+
</DisplayHeading>
|
|
93
357
|
</Container>
|
|
94
|
-
{filters ? <div className="w-full max-w-80">{filters}</div> : null}
|
|
95
358
|
</header>
|
|
96
359
|
<ScrollBody style={{ scrollbarGutter: 'stable' }}>
|
|
97
|
-
<Container className=
|
|
98
|
-
<Body
|
|
360
|
+
<Container className="max-w-384 px-5 min-[901px]:px-6">
|
|
361
|
+
<Body className="gap-8">{children}</Body>
|
|
99
362
|
</Container>
|
|
100
363
|
</ScrollBody>
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
<div className={`flex justify-end ${csv || basic ? 'items-center gap-1' : variant === 'edit' ? 'gap-3' : 'gap-2'}`}>{footer}</div>
|
|
364
|
+
<footer className="shrink-0 bg-surface pt-5">
|
|
365
|
+
<Container className="max-w-384 px-5 min-[901px]:px-6">
|
|
366
|
+
<div className="flex flex-wrap justify-end gap-2">{footer}</div>
|
|
105
367
|
</Container>
|
|
106
368
|
</footer>
|
|
107
369
|
</Layout>
|
|
108
370
|
</Panel>
|
|
109
371
|
</ModalOverlay>
|
|
110
|
-
|
|
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>
|
|
372
|
+
)
|
|
138
373
|
}
|
|
139
374
|
|
|
140
375
|
// The source New section dialog separates its groups by spacing only, no hairlines.
|
|
@@ -149,7 +384,13 @@ export function SettingsDialogDescription({ children }: { children: ReactNode })
|
|
|
149
384
|
export function SettingsDialogColumns({ children, metadata = false }: { children: ReactNode; metadata?: boolean }) {
|
|
150
385
|
const { variant, compact } = useContext(LayoutContext)
|
|
151
386
|
if (metadata) return <Columns className={`${compact ? 'grid-cols-1' : 'grid-cols-3'} gap-3`}>{children}</Columns>
|
|
152
|
-
return
|
|
387
|
+
return (
|
|
388
|
+
<Columns
|
|
389
|
+
className={`${compact ? 'grid-cols-1' : 'grid-cols-2'} ${variant === 'create' ? (compact ? 'gap-3' : 'gap-4') : 'gap-8'}`}
|
|
390
|
+
>
|
|
391
|
+
{children}
|
|
392
|
+
</Columns>
|
|
393
|
+
)
|
|
153
394
|
}
|
|
154
395
|
export function SettingsDialogGroup({ children }: { children: ReactNode }) {
|
|
155
396
|
const { variant } = useContext(LayoutContext)
|
|
@@ -160,7 +401,9 @@ export function SettingsDialogGroup({ children }: { children: ReactNode }) {
|
|
|
160
401
|
* Independent of SettingsDialogSurface's 900px breakpoint; this source uses1100px.
|
|
161
402
|
*/
|
|
162
403
|
export function SettingsDialogProductionColumns({ children }: { children: ReactNode }) {
|
|
163
|
-
const [compact, setCompact] = useState(
|
|
404
|
+
const [compact, setCompact] = useState(
|
|
405
|
+
() => typeof window !== 'undefined' && window.matchMedia('(max-width: 1100px)').matches,
|
|
406
|
+
)
|
|
164
407
|
useEffect(() => {
|
|
165
408
|
const media = window.matchMedia('(max-width: 1100px)')
|
|
166
409
|
const change = () => setCompact(media.matches)
|
|
@@ -168,7 +411,11 @@ export function SettingsDialogProductionColumns({ children }: { children: ReactN
|
|
|
168
411
|
media.addEventListener('change', change)
|
|
169
412
|
return () => media.removeEventListener('change', change)
|
|
170
413
|
}, [])
|
|
171
|
-
return
|
|
414
|
+
return (
|
|
415
|
+
<Columns data-settings-production-columns className={`${compact ? 'grid-cols-1' : 'grid-cols-2'} min-w-0 gap-4`}>
|
|
416
|
+
{children}
|
|
417
|
+
</Columns>
|
|
418
|
+
)
|
|
172
419
|
}
|
|
173
420
|
export function SettingsDialogControl({ children }: { children: ReactNode }) {
|
|
174
421
|
const { variant } = useContext(LayoutContext)
|
|
@@ -178,71 +425,270 @@ const Label = uic('p', { displayName: 'SettingsDialogLabel', baseClass: 'm-0 tex
|
|
|
178
425
|
/** Group label. The create variant uses the source New section group label: 16px/22px semibold. */
|
|
179
426
|
export function SettingsDialogLabel({ className, ...props }: ComponentProps<typeof Label>) {
|
|
180
427
|
const { variant } = useContext(LayoutContext)
|
|
181
|
-
return
|
|
428
|
+
return (
|
|
429
|
+
<Label
|
|
430
|
+
{...props}
|
|
431
|
+
className={
|
|
432
|
+
[variant === 'create' ? 'text-body leading-5.5 font-semibold' : '', className].filter(Boolean).join(' ') ||
|
|
433
|
+
undefined
|
|
434
|
+
}
|
|
435
|
+
/>
|
|
436
|
+
)
|
|
182
437
|
}
|
|
183
438
|
export const SettingsDialogEmphasis = uic('span', { displayName: 'SettingsDialogEmphasis', baseClass: 'text-fg' })
|
|
184
|
-
const Hint = uic('p', {
|
|
439
|
+
const Hint = uic('p', {
|
|
440
|
+
displayName: 'SettingsDialogHint',
|
|
441
|
+
baseClass: 'm-0 text-small font-normal text-fg-workflow-muted',
|
|
442
|
+
})
|
|
185
443
|
/** Helper line. The create variant uses the source 16px/22px `#242423` hint. */
|
|
186
444
|
export function SettingsDialogHint({ style, className, ...props }: ComponentProps<typeof Hint>) {
|
|
187
445
|
const { variant } = useContext(LayoutContext)
|
|
188
|
-
return
|
|
446
|
+
return (
|
|
447
|
+
<Hint
|
|
448
|
+
{...props}
|
|
449
|
+
className={
|
|
450
|
+
[variant === 'create' ? 'text-body leading-5.5 text-surface-inverted' : '', className]
|
|
451
|
+
.filter(Boolean)
|
|
452
|
+
.join(' ') || undefined
|
|
453
|
+
}
|
|
454
|
+
style={{ ...(variant === 'basic' ? { maxWidth: '48ch' } : {}), ...style }}
|
|
455
|
+
/>
|
|
456
|
+
)
|
|
189
457
|
}
|
|
190
|
-
export const SettingsDialogAction = uic(Button, {
|
|
458
|
+
export const SettingsDialogAction = uic(Button, {
|
|
459
|
+
displayName: 'SettingsDialogAction',
|
|
460
|
+
baseClass: 'h-11.5 rounded-full px-6 text-base font-medium leading-5',
|
|
461
|
+
style: { letterSpacing: 0 },
|
|
462
|
+
})
|
|
191
463
|
|
|
192
|
-
const ProductionLayout = uic(ModalDialog, {
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
const
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
464
|
+
const ProductionLayout = uic(ModalDialog, {
|
|
465
|
+
displayName: 'ProductionSettingsLayout',
|
|
466
|
+
baseClass: 'relative grid h-full min-h-0 w-full overflow-hidden outline-none',
|
|
467
|
+
})
|
|
468
|
+
const ProductionHeader = uic('header', {
|
|
469
|
+
displayName: 'ProductionSettingsHeader',
|
|
470
|
+
baseClass: 'flex shrink-0 flex-col items-start gap-4 px-8 pb-6 pt-8',
|
|
471
|
+
})
|
|
472
|
+
const ProductionTitle = uic('h1', {
|
|
473
|
+
displayName: 'ProductionSettingsTitle',
|
|
474
|
+
baseClass: 'm-0 max-w-132 text-display-large font-medium text-fg-muted',
|
|
475
|
+
style: { letterSpacing: '-0.02em' },
|
|
476
|
+
})
|
|
477
|
+
const ProductionDescription = uic('p', {
|
|
478
|
+
displayName: 'ProductionSettingsDescription',
|
|
479
|
+
baseClass: 'm-0 max-w-132 text-body font-normal text-fg',
|
|
480
|
+
})
|
|
481
|
+
const ProductionFields = uic('div', {
|
|
482
|
+
displayName: 'ProductionSettingsFields',
|
|
483
|
+
baseClass: 'flex min-h-0 flex-col gap-6 px-8 pb-8',
|
|
484
|
+
})
|
|
485
|
+
const ProductionFooter = uic('footer', {
|
|
486
|
+
displayName: 'ProductionSettingsFooter',
|
|
487
|
+
baseClass: 'relative z-10 flex shrink-0 flex-wrap items-center gap-2 bg-surface px-8 pb-8 pt-4',
|
|
488
|
+
})
|
|
489
|
+
const ProductionPreview = uic('aside', {
|
|
490
|
+
displayName: 'ProductionSettingsPreview',
|
|
491
|
+
baseClass: 'relative grid min-h-0 min-w-0 place-items-center overflow-hidden p-10',
|
|
492
|
+
style: {
|
|
493
|
+
background:
|
|
494
|
+
'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))',
|
|
495
|
+
},
|
|
496
|
+
})
|
|
497
|
+
const ProductionArtwork = uic('div', {
|
|
498
|
+
displayName: 'ProductionSettingsArtwork',
|
|
499
|
+
baseClass: 'min-h-0 min-w-0 overflow-hidden',
|
|
500
|
+
style: { width: '80%', height: '80%' },
|
|
501
|
+
})
|
|
502
|
+
export const ProductionSettingsAction = uic(Button, {
|
|
503
|
+
displayName: 'ProductionSettingsAction',
|
|
504
|
+
baseClass: 'min-h-10 rounded-full px-6 text-body font-medium',
|
|
505
|
+
})
|
|
201
506
|
|
|
202
507
|
/** Wide production settings, not the content editor's independently tuned split. */
|
|
203
|
-
export function ProductionSettingsDialog({
|
|
204
|
-
isOpen
|
|
205
|
-
|
|
508
|
+
export function ProductionSettingsDialog({
|
|
509
|
+
isOpen,
|
|
510
|
+
onOpenChange,
|
|
511
|
+
prefix,
|
|
512
|
+
title,
|
|
513
|
+
description,
|
|
514
|
+
closeLabel,
|
|
515
|
+
children,
|
|
516
|
+
preview,
|
|
517
|
+
footer,
|
|
518
|
+
testId = 'production-settings',
|
|
519
|
+
isPending = false,
|
|
520
|
+
previewSize = 'contained',
|
|
521
|
+
previewLabel,
|
|
522
|
+
}: {
|
|
523
|
+
isPending?: boolean
|
|
524
|
+
previewLabel?: string
|
|
525
|
+
previewSize?: 'contained' | 'full'
|
|
526
|
+
isOpen: boolean
|
|
527
|
+
onOpenChange: (open: boolean) => void
|
|
528
|
+
prefix: ReactNode
|
|
529
|
+
title: ReactNode
|
|
530
|
+
description: ReactNode
|
|
531
|
+
closeLabel: string
|
|
532
|
+
children: ReactNode
|
|
533
|
+
preview: ReactNode
|
|
534
|
+
footer: ReactNode
|
|
535
|
+
testId?: string
|
|
206
536
|
}) {
|
|
207
|
-
const titleId = useId(),
|
|
537
|
+
const titleId = useId(),
|
|
538
|
+
descriptionId = useId()
|
|
208
539
|
const query = '(max-width: 1100px), (orientation: portrait)'
|
|
209
540
|
const [compact, setCompact] = useState(() => typeof window !== 'undefined' && window.matchMedia(query).matches)
|
|
210
541
|
useEffect(() => {
|
|
211
|
-
const media = window.matchMedia(query),
|
|
212
|
-
|
|
542
|
+
const media = window.matchMedia(query),
|
|
543
|
+
change = () => setCompact(media.matches)
|
|
544
|
+
change()
|
|
545
|
+
media.addEventListener('change', change)
|
|
213
546
|
return () => media.removeEventListener('change', change)
|
|
214
547
|
}, [])
|
|
215
|
-
return
|
|
216
|
-
<
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
548
|
+
return (
|
|
549
|
+
<ModalOverlay
|
|
550
|
+
isOpen={isOpen}
|
|
551
|
+
onOpenChange={(open) => {
|
|
552
|
+
if (!isPending) onOpenChange(open)
|
|
553
|
+
}}
|
|
554
|
+
isDismissable={!isPending}
|
|
555
|
+
isKeyboardDismissDisabled={isPending}
|
|
556
|
+
className="p-0"
|
|
557
|
+
>
|
|
558
|
+
<Panel
|
|
559
|
+
style={{
|
|
560
|
+
width: compact ? '96vw' : 'min(90vw, 110rem)',
|
|
561
|
+
maxWidth: compact ? '96vw' : 'min(90vw, 110rem)',
|
|
562
|
+
height: compact ? '92vh' : 'min(82vh, 63.125rem)',
|
|
563
|
+
maxHeight: compact ? '92vh' : 'min(82vh, 63.125rem)',
|
|
564
|
+
}}
|
|
565
|
+
>
|
|
566
|
+
<ProductionLayout
|
|
567
|
+
aria-labelledby={titleId}
|
|
568
|
+
aria-describedby={descriptionId}
|
|
569
|
+
data-testid={testId}
|
|
570
|
+
data-production-compact={compact}
|
|
571
|
+
style={{
|
|
572
|
+
gridTemplateColumns: compact ? 'minmax(0,1fr)' : 'minmax(calc(var(--spacing) * 90),2fr) minmax(0,4fr)',
|
|
573
|
+
gridTemplateRows: compact ? 'minmax(18rem,44%) minmax(0,1fr)' : 'minmax(0,1fr)',
|
|
574
|
+
}}
|
|
575
|
+
>
|
|
576
|
+
<section
|
|
577
|
+
className={`flex min-h-0 min-w-0 flex-col bg-surface ${compact ? 'row-start-2 overflow-y-auto' : 'overflow-hidden'}`}
|
|
578
|
+
aria-labelledby={titleId}
|
|
579
|
+
>
|
|
580
|
+
<ProductionHeader>
|
|
581
|
+
<ProductionTitle id={titleId}>
|
|
582
|
+
{prefix} <span className="text-fg">{title}</span>
|
|
583
|
+
</ProductionTitle>
|
|
584
|
+
<ProductionDescription id={descriptionId}>{description}</ProductionDescription>
|
|
585
|
+
</ProductionHeader>
|
|
586
|
+
<ProductionFields
|
|
587
|
+
data-testid={`${testId}-form`}
|
|
588
|
+
className={compact ? 'shrink-0' : 'flex-1 overflow-y-auto'}
|
|
589
|
+
style={{ scrollbarGutter: 'stable' }}
|
|
590
|
+
>
|
|
591
|
+
{children}
|
|
592
|
+
</ProductionFields>
|
|
593
|
+
<ProductionFooter>{footer}</ProductionFooter>
|
|
594
|
+
</section>
|
|
595
|
+
<ProductionPreview
|
|
596
|
+
aria-label={previewLabel}
|
|
597
|
+
className={compact ? 'col-start-1 row-start-1' : undefined}
|
|
598
|
+
data-testid={`${testId}-preview`}
|
|
599
|
+
>
|
|
600
|
+
<ProductionArtwork
|
|
601
|
+
style={previewSize === 'full' ? { width: '100%', height: '100%' } : undefined}
|
|
602
|
+
data-testid={`${testId}-artwork`}
|
|
603
|
+
>
|
|
604
|
+
{preview}
|
|
605
|
+
</ProductionArtwork>
|
|
606
|
+
</ProductionPreview>
|
|
607
|
+
<Button
|
|
608
|
+
variant="ghost"
|
|
609
|
+
aria-label={closeLabel}
|
|
610
|
+
isDisabled={isPending}
|
|
611
|
+
onPress={() => onOpenChange(false)}
|
|
612
|
+
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"
|
|
613
|
+
>
|
|
614
|
+
<svg
|
|
615
|
+
width="18"
|
|
616
|
+
height="18"
|
|
617
|
+
viewBox="0 0 24 24"
|
|
618
|
+
fill="none"
|
|
619
|
+
stroke="currentColor"
|
|
620
|
+
strokeWidth="2"
|
|
621
|
+
aria-hidden="true"
|
|
622
|
+
>
|
|
623
|
+
<path d="m6 6 12 12M18 6 6 18" />
|
|
624
|
+
</svg>
|
|
625
|
+
</Button>
|
|
626
|
+
</ProductionLayout>
|
|
627
|
+
</Panel>
|
|
628
|
+
</ModalOverlay>
|
|
629
|
+
)
|
|
228
630
|
}
|
|
229
631
|
|
|
230
|
-
const DisclosureRoot = uic(AriaDisclosure, {
|
|
231
|
-
|
|
632
|
+
const DisclosureRoot = uic(AriaDisclosure, {
|
|
633
|
+
displayName: 'SettingsDisclosureRoot',
|
|
634
|
+
baseClass: 'group/settings-disclosure flex min-w-0 flex-col gap-3',
|
|
635
|
+
})
|
|
636
|
+
const DisclosureTrigger = uic(AriaButton, {
|
|
637
|
+
displayName: 'SettingsDisclosureTrigger',
|
|
638
|
+
baseClass:
|
|
639
|
+
'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',
|
|
640
|
+
})
|
|
232
641
|
const DisclosureCopy = uic('span', { displayName: 'SettingsDisclosureCopy', baseClass: 'flex min-w-0 flex-col gap-1' })
|
|
233
|
-
const DisclosureTitle = uic('strong', {
|
|
234
|
-
|
|
235
|
-
|
|
642
|
+
const DisclosureTitle = uic('strong', {
|
|
643
|
+
displayName: 'SettingsDisclosureTitle',
|
|
644
|
+
baseClass: 'text-body font-medium leading-normal text-fg',
|
|
645
|
+
})
|
|
646
|
+
const DisclosureHint = uic('span', {
|
|
647
|
+
displayName: 'SettingsDisclosureHint',
|
|
648
|
+
baseClass: 'text-body font-normal leading-normal text-fg-workflow-muted',
|
|
649
|
+
})
|
|
650
|
+
const DisclosureBody = uic(AriaDisclosurePanel, {
|
|
651
|
+
displayName: 'SettingsDisclosureBody',
|
|
652
|
+
baseClass: 'flex min-w-0 flex-col gap-5 pt-3',
|
|
653
|
+
})
|
|
236
654
|
|
|
237
655
|
/** Source outputTaskDropdownPanel: labelled, initially expanded settings group. */
|
|
238
|
-
export function SettingsDialogDisclosure({
|
|
239
|
-
title
|
|
656
|
+
export function SettingsDialogDisclosure({
|
|
657
|
+
title,
|
|
658
|
+
description,
|
|
659
|
+
children,
|
|
660
|
+
defaultExpanded = true,
|
|
661
|
+
}: {
|
|
662
|
+
title: ReactNode
|
|
663
|
+
description?: ReactNode
|
|
664
|
+
children: ReactNode
|
|
665
|
+
defaultExpanded?: boolean
|
|
240
666
|
}) {
|
|
241
|
-
return
|
|
242
|
-
<
|
|
243
|
-
<
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
667
|
+
return (
|
|
668
|
+
<DisclosureRoot defaultExpanded={defaultExpanded}>
|
|
669
|
+
<DisclosureTrigger slot="trigger">
|
|
670
|
+
<DisclosureCopy>
|
|
671
|
+
<DisclosureTitle>{title}</DisclosureTitle>
|
|
672
|
+
{description ? <DisclosureHint>{description}</DisclosureHint> : null}
|
|
673
|
+
</DisclosureCopy>
|
|
674
|
+
<svg
|
|
675
|
+
aria-hidden="true"
|
|
676
|
+
width="15"
|
|
677
|
+
height="15"
|
|
678
|
+
viewBox="0 0 15 15"
|
|
679
|
+
fill="none"
|
|
680
|
+
className="mt-1 shrink-0 text-fg-workflow-muted transition-transform duration-150 group-data-[expanded]/settings-disclosure:rotate-180 motion-reduce:transition-none"
|
|
681
|
+
>
|
|
682
|
+
<path
|
|
683
|
+
d="m3.5 5.5 4 4 4-4"
|
|
684
|
+
stroke="currentColor"
|
|
685
|
+
strokeWidth="1.5"
|
|
686
|
+
strokeLinecap="round"
|
|
687
|
+
strokeLinejoin="round"
|
|
688
|
+
/>
|
|
689
|
+
</svg>
|
|
690
|
+
</DisclosureTrigger>
|
|
691
|
+
<DisclosureBody>{children}</DisclosureBody>
|
|
692
|
+
</DisclosureRoot>
|
|
693
|
+
)
|
|
248
694
|
}
|