@podoba/react 0.0.51 → 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.
- 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/icon-button.examples.tsx +16 -0
- package/src/components/icon-button.tsx +20 -0
- package/src/components/inline-alert.examples.tsx +8 -0
- package/src/components/inline-alert.tsx +23 -0
- package/src/components/input.tsx +25 -12
- 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 +553 -114
- package/src/components/template-catalog-card.tsx +309 -78
- package/src/components/textarea.tsx +160 -12
- 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 +98 -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,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)
|
|
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
|
+
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=
|
|
89
|
-
<Container className=
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
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=
|
|
98
|
-
<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
|
-
|
|
102
|
-
|
|
103
|
-
|
|
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
|
-
|
|
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
|
|
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(
|
|
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
|
|
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
|
|
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', {
|
|
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
|
|
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, {
|
|
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, {
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
const
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
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({
|
|
204
|
-
isOpen
|
|
205
|
-
|
|
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(),
|
|
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),
|
|
212
|
-
|
|
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
|
|
216
|
-
<
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
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, {
|
|
231
|
-
|
|
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', {
|
|
234
|
-
|
|
235
|
-
|
|
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({
|
|
239
|
-
title
|
|
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
|
|
242
|
-
<
|
|
243
|
-
<
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
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
|
}
|