@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.
Files changed (36) 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/inline-alert.examples.tsx +8 -0
  15. package/src/components/inline-alert.tsx +23 -0
  16. package/src/components/input.tsx +25 -12
  17. package/src/components/island-toolbar.examples.tsx +27 -0
  18. package/src/components/island-toolbar.tsx +39 -0
  19. package/src/components/media-asset-panel.examples.tsx +44 -5
  20. package/src/components/media-asset-panel.tsx +339 -28
  21. package/src/components/media-collection.examples.tsx +18 -0
  22. package/src/components/media-collection.tsx +206 -0
  23. package/src/components/number-field.tsx +18 -9
  24. package/src/components/preview-error.examples.tsx +20 -0
  25. package/src/components/preview-error.tsx +29 -0
  26. package/src/components/preview-metadata-card.examples.tsx +32 -0
  27. package/src/components/preview-metadata-card.tsx +112 -0
  28. package/src/components/search-field.tsx +27 -7
  29. package/src/components/select.tsx +81 -50
  30. package/src/components/settings-dialog-surface.tsx +553 -114
  31. package/src/components/template-catalog-card.tsx +309 -78
  32. package/src/components/textarea.tsx +160 -12
  33. package/src/components/tile.tsx +30 -16
  34. package/src/components/zoomable-image.examples.tsx +33 -0
  35. package/src/components/zoomable-image.tsx +185 -0
  36. package/src/index.ts +98 -78
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@podoba/react",
3
- "version": "0.0.51",
3
+ "version": "0.0.53",
4
4
  "type": "module",
5
5
  "description": "podoba React components — React Aria Components + Tailwind primitives + layout, built with uic.",
6
6
  "repository": {
@@ -28,9 +28,9 @@
28
28
  "typecheck": "tsc --build"
29
29
  },
30
30
  "dependencies": {
31
- "@podoba/tokens": "^0.0.51",
32
- "@podoba/tailwind": "^0.0.51",
33
- "react-aria-components": "1.18.0",
31
+ "@podoba/tokens": "^0.0.53",
32
+ "@podoba/tailwind": "^0.0.53",
33
+ "react-aria-components": "1.20.0",
34
34
  "class-variance-authority": "0.7.1",
35
35
  "clsx": "2.1.1",
36
36
  "tailwind-merge": "3.6.0",
@@ -26,6 +26,8 @@ export interface AssetSelectionSurfaceProps {
26
26
  isPending?: boolean
27
27
  closeLabel: string
28
28
  title: ReactNode
29
+ description?: ReactNode
30
+ width?: 'wide' | 'compact'
29
31
  filters?: ReactNode
30
32
  children: ReactNode
31
33
  footer: ReactNode
@@ -37,11 +39,25 @@ export interface AssetSelectionSurfaceProps {
37
39
 
38
40
  /** Linked-assets/storage envelope. Domain state and attachment stay in the app. */
39
41
  export function AssetSelectionSurface({
40
- isOpen, onOpenChange, isPending = false, closeLabel, title, filters,
41
- children, footer, error, overlays, bodyRef, onContextMenuCapture,
42
+ isOpen,
43
+ onOpenChange,
44
+ isPending = false,
45
+ closeLabel,
46
+ title,
47
+ filters,
48
+ description,
49
+ width = 'wide',
50
+ children,
51
+ footer,
52
+ error,
53
+ overlays,
54
+ bodyRef,
55
+ onContextMenuCapture,
42
56
  }: AssetSelectionSurfaceProps) {
43
57
  const titleId = useId()
44
- const [compact, setCompact] = useState(() => typeof window !== 'undefined' && window.matchMedia('(max-width: 900px)').matches)
58
+ const [compact, setCompact] = useState(
59
+ () => typeof window !== 'undefined' && window.matchMedia('(max-width: 900px)').matches,
60
+ )
45
61
  useEffect(() => {
46
62
  const media = window.matchMedia('(max-width: 900px)')
47
63
  const change = () => setCompact(media.matches)
@@ -49,21 +65,71 @@ export function AssetSelectionSurface({
49
65
  media.addEventListener('change', change)
50
66
  return () => media.removeEventListener('change', change)
51
67
  }, [])
52
- const close = () => { if (!isPending) onOpenChange(false) }
68
+ const close = () => {
69
+ if (!isPending) onOpenChange(false)
70
+ }
53
71
  return (
54
- <ModalOverlay className="p-0" isOpen={isOpen} onOpenChange={open => { if (!isPending) onOpenChange(open) }} isDismissable={!isPending} isKeyboardDismissDisabled={isPending}>
55
- <ModalSurface className={`flex max-h-324 max-w-432 flex-col overflow-hidden p-0 ${compact ? 'h-23/25 w-24/25' : 'h-9/10 w-9/10'}`}>
56
- <ModalDialog aria-labelledby={titleId} style={{ letterSpacing: 0 }} className={`relative flex min-h-0 flex-1 flex-col gap-8 outline-none ${compact ? 'px-5 py-6' : 'px-6 py-10'}`} onContextMenuCapture={onContextMenuCapture} onContextMenu={event => event.stopPropagation()}>
72
+ <ModalOverlay
73
+ className="p-0"
74
+ isOpen={isOpen}
75
+ onOpenChange={(open) => {
76
+ if (!isPending) onOpenChange(open)
77
+ }}
78
+ isDismissable={!isPending}
79
+ isKeyboardDismissDisabled={isPending}
80
+ >
81
+ <ModalSurface
82
+ className={`flex max-h-324 ${width === 'compact' ? 'max-w-204' : 'max-w-432'} flex-col overflow-hidden p-0 ${compact ? 'h-23/25 w-24/25' : 'h-9/10 w-9/10'}`}
83
+ >
84
+ <ModalDialog
85
+ aria-labelledby={titleId}
86
+ aria-describedby={description ? `${titleId}-description` : undefined}
87
+ style={{ letterSpacing: 0 }}
88
+ className={`relative flex min-h-0 flex-1 flex-col gap-8 outline-none ${compact ? 'px-5 py-6' : 'px-6 py-10'}`}
89
+ onContextMenuCapture={onContextMenuCapture}
90
+ onContextMenu={(event) => event.stopPropagation()}
91
+ >
57
92
  <header className="flex shrink-0 flex-col gap-3">
58
- <DisplayHeading id={titleId} className="mb-4 pb-0.5" style={{ maxWidth: '28ch', letterSpacing: 0 }}>{title}</DisplayHeading>
59
- <Button variant="ghost" aria-label={closeLabel} isDisabled={isPending} onPress={close} className="absolute end-4 top-3.5 h-8 w-8 rounded-md p-0 text-fg-subtle">
60
- <svg width="15" height="15" viewBox="0 0 15 15" fill="none" aria-hidden="true"><path d="M11.7816 4.03157C12.0062 3.80702 12.0062 3.44295 11.7816 3.2184C11.5571 2.99385 11.193 2.99385 10.9685 3.2184L7.50005 6.68682L4.03164 3.2184C3.80708 2.99385 3.44301 2.99385 3.21846 3.2184C2.99391 3.44295 2.99391 3.80702 3.21846 4.03157L6.68688 7.49999L3.21846 10.9684C2.99391 11.193 2.99391 11.557 3.21846 11.7816C3.44301 12.0061 3.80708 12.0061 4.03164 11.7816L7.50005 8.31316L10.9685 11.7816C11.193 12.0061 11.5571 12.0061 11.7816 11.7816C12.0062 11.557 12.0062 11.193 11.7816 10.9684L8.31322 7.49999L11.7816 4.03157Z" fill="currentColor" fillRule="evenodd" clipRule="evenodd" /></svg>
93
+ <DisplayHeading id={titleId} className="mb-4 pb-0.5" style={{ maxWidth: '28ch', letterSpacing: 0 }}>
94
+ {title}
95
+ </DisplayHeading>
96
+ <Button
97
+ variant="ghost"
98
+ aria-label={closeLabel}
99
+ isDisabled={isPending}
100
+ onPress={close}
101
+ className="absolute end-4 top-3.5 h-9 w-9 rounded-md p-0 text-fg-subtle"
102
+ >
103
+ <svg width="15" height="15" viewBox="0 0 15 15" fill="none" aria-hidden="true">
104
+ <path
105
+ d="M11.7816 4.03157C12.0062 3.80702 12.0062 3.44295 11.7816 3.2184C11.5571 2.99385 11.193 2.99385 10.9685 3.2184L7.50005 6.68682L4.03164 3.2184C3.80708 2.99385 3.44301 2.99385 3.21846 3.2184C2.99391 3.44295 2.99391 3.80702 3.21846 4.03157L6.68688 7.49999L3.21846 10.9684C2.99391 11.193 2.99391 11.557 3.21846 11.7816C3.44301 12.0061 3.80708 12.0061 4.03164 11.7816L7.50005 8.31316L10.9685 11.7816C11.193 12.0061 11.5571 12.0061 11.7816 11.7816C12.0062 11.557 12.0062 11.193 11.7816 10.9684L8.31322 7.49999L11.7816 4.03157Z"
106
+ fill="currentColor"
107
+ fillRule="evenodd"
108
+ clipRule="evenodd"
109
+ />
110
+ </svg>
61
111
  </Button>
112
+ {description ? (
113
+ <p id={`${titleId}-description`} className="m-0 text-small text-fg-muted">
114
+ {description}
115
+ </p>
116
+ ) : null}
62
117
  {filters ? <div className="max-w-full pt-1">{filters}</div> : null}
63
118
  </header>
64
- <Body ref={bodyRef} style={{ scrollbarGutter: 'stable' }}>{children}</Body>
65
- {error ? <div role="alert" className="shrink-0 rounded-md border border-danger bg-danger/10 px-4 py-3 text-small text-danger">{error}</div> : null}
66
- <footer className="flex shrink-0 justify-end gap-2 pt-3 [&>button]:text-body [&>button]:leading-5 [&>button]:font-medium">{footer}</footer>
119
+ <Body ref={bodyRef} style={{ scrollbarGutter: 'stable' }}>
120
+ {children}
121
+ </Body>
122
+ {error ? (
123
+ <div
124
+ role="alert"
125
+ className="shrink-0 rounded-md border border-danger bg-danger/10 px-4 py-3 text-small text-danger"
126
+ >
127
+ {error}
128
+ </div>
129
+ ) : null}
130
+ <footer className="flex shrink-0 justify-end gap-2 pt-3 [&>button]:text-body [&>button]:leading-5 [&>button]:font-medium">
131
+ {footer}
132
+ </footer>
67
133
  {overlays}
68
134
  </ModalDialog>
69
135
  </ModalSurface>
@@ -71,42 +137,107 @@ export function AssetSelectionSurface({
71
137
  )
72
138
  }
73
139
 
74
- export function AssetSelectionEmpty({ title, description, variant = 'selection' }: { title: string; description?: string; variant?: 'selection' | 'library' }) {
75
- if (variant === 'library') return <div role="status" className="px-8 py-16 text-center text-fg-muted">
76
- <p className="my-2">{title}</p>
77
- {description ? <p className="my-2 text-small">{description}</p> : null}
78
- </div>
79
- return <div role="status" className="flex min-h-96 flex-col items-center justify-center text-center text-fg-muted">
80
- <p className="m-0 text-panel-heading font-medium text-fg">{title}</p>
81
- {description ? <p className="mt-1 text-small" style={{ maxWidth: '32ch' }}>{description}</p> : null}
82
- </div>
140
+ export function AssetSelectionEmpty({
141
+ title,
142
+ description,
143
+ variant = 'selection',
144
+ }: {
145
+ title: string
146
+ description?: string
147
+ variant?: 'selection' | 'library'
148
+ }) {
149
+ if (variant === 'library')
150
+ return (
151
+ <div role="status" className="px-8 py-16 text-center text-fg-muted">
152
+ <p className="my-2">{title}</p>
153
+ {description ? <p className="my-2 text-small">{description}</p> : null}
154
+ </div>
155
+ )
156
+ return (
157
+ <div role="status" className="flex min-h-96 flex-col items-center justify-center text-center text-fg-muted">
158
+ <p className="m-0 text-panel-heading font-medium text-fg">{title}</p>
159
+ {description ? (
160
+ <p className="mt-1 text-small" style={{ maxWidth: '32ch' }}>
161
+ {description}
162
+ </p>
163
+ ) : null}
164
+ </div>
165
+ )
83
166
  }
84
167
 
85
168
  /** Library preview: source accent selection and hover-only curated tags. */
86
- export function AssetLibraryPreview({ label, selected, aspectRatio, tags, onPress, children }: {
87
- label: string; selected: boolean; aspectRatio: number; tags: string[]
88
- onPress: () => void; children: ReactNode
169
+ export function AssetLibraryPreview({
170
+ label,
171
+ selected,
172
+ aspectRatio,
173
+ tags,
174
+ onPress,
175
+ children,
176
+ }: {
177
+ label: string
178
+ selected: boolean
179
+ aspectRatio: number
180
+ tags: string[]
181
+ onPress: () => void
182
+ children: ReactNode
89
183
  }) {
90
- return <AriaButton aria-label={label} aria-pressed={selected} onPress={onPress}
91
- style={{ aspectRatio }}
92
- className={`group relative block min-h-[150px] max-h-[800px] w-full cursor-pointer overflow-hidden rounded-none border p-0 transition-transform duration-200 ease-[ease] hover:-translate-y-0.5 hover:shadow-xs hover:border-[#aba89c] active:translate-y-0 focus-visible:ring-2 focus-visible:ring-accent-blue focus-visible:ring-offset-2 motion-reduce:transition-none ${selected ? 'border-accent-blue bg-accent-blue/10' : 'border-border bg-surface-card'}`}>
93
- {children}
94
- {tags.length ? <span data-testid="asset-card-overlay" className="pointer-events-none absolute inset-x-0 bottom-0 flex flex-wrap items-center gap-1 bg-gradient-to-t from-black/70 to-transparent p-3 opacity-0 transition-opacity duration-250 ease-[ease] group-hover:opacity-100 group-focus-visible:opacity-100 motion-reduce:transition-none">
95
- {tags.slice(0, 3).map(tag => <span key={tag} className="ms-3 inline-flex h-6 items-center rounded-full bg-surface-muted px-2.5 text-label font-medium leading-5 text-(--color-neutral-600)">{tag}</span>)}
96
- {tags.length > 3 ? <span className="text-label font-medium text-white/90">+{tags.length - 3}</span> : null}
97
- </span> : null}
98
- </AriaButton>
184
+ return (
185
+ <AriaButton
186
+ aria-label={label}
187
+ aria-pressed={selected}
188
+ onPress={onPress}
189
+ style={{ aspectRatio }}
190
+ className={`group relative block min-h-[150px] max-h-[800px] w-full cursor-pointer overflow-hidden rounded-none border p-0 transition-transform duration-200 ease-[ease] hover:-translate-y-0.5 hover:shadow-xs hover:border-[#aba89c] active:translate-y-0 focus-visible:ring-2 focus-visible:ring-accent-blue focus-visible:ring-offset-2 motion-reduce:transition-none ${selected ? 'border-accent-blue bg-accent-blue/10' : 'border-border bg-surface-card'}`}
191
+ >
192
+ {children}
193
+ {tags.length ? (
194
+ <span
195
+ data-testid="asset-card-overlay"
196
+ className="pointer-events-none absolute inset-x-0 bottom-0 flex flex-wrap items-center gap-1 bg-gradient-to-t from-black/70 to-transparent p-3 opacity-0 transition-opacity duration-250 ease-[ease] group-hover:opacity-100 group-focus-visible:opacity-100 motion-reduce:transition-none"
197
+ >
198
+ {tags.slice(0, 3).map((tag) => (
199
+ <span
200
+ key={tag}
201
+ className="ms-3 inline-flex h-6 items-center rounded-full bg-surface-muted px-2.5 text-label font-medium leading-5 text-(--color-neutral-600)"
202
+ >
203
+ {tag}
204
+ </span>
205
+ ))}
206
+ {tags.length > 3 ? <span className="text-label font-medium text-white/90">+{tags.length - 3}</span> : null}
207
+ </span>
208
+ ) : null}
209
+ </AriaButton>
210
+ )
99
211
  }
100
212
 
101
- export function AssetSelectionFilters({ items, onChange, disabled = false, autoFocus = false }: {
213
+ export function AssetSelectionFilters({
214
+ items,
215
+ onChange,
216
+ disabled = false,
217
+ autoFocus = false,
218
+ }: {
102
219
  items: { id: string; label: string; selected: boolean }[]
103
220
  onChange: (id: string) => void
104
- disabled?: boolean; autoFocus?: boolean
221
+ disabled?: boolean
222
+ autoFocus?: boolean
105
223
  }) {
106
- return <div role="group" className="mb-4 flex min-h-9 w-full flex-wrap content-start items-center gap-2 lg:w-2/3">
107
- {items.map((item, index) => <Button key={item.id} autoFocus={autoFocus && index === 0} variant="ghost" isDisabled={disabled} aria-pressed={item.selected}
108
- onPress={() => onChange(item.id)} className={`h-7 rounded-sm px-nav-x py-1.5 text-compact font-normal ${item.selected ? 'bg-surface-muted text-fg' : 'text-fg-muted'}`}>{item.label}</Button>)}
109
- </div>
224
+ return (
225
+ <div role="group" className="mb-4 flex min-h-9 w-full flex-wrap content-start items-center gap-2 lg:w-2/3">
226
+ {items.map((item, index) => (
227
+ <Button
228
+ key={item.id}
229
+ autoFocus={autoFocus && index === 0}
230
+ variant="ghost"
231
+ isDisabled={disabled}
232
+ aria-pressed={item.selected}
233
+ onPress={() => onChange(item.id)}
234
+ className={`h-7 rounded-sm px-nav-x py-1.5 text-compact font-normal ${item.selected ? 'bg-surface-muted text-fg' : 'text-fg-muted'}`}
235
+ >
236
+ {item.label}
237
+ </Button>
238
+ ))}
239
+ </div>
240
+ )
110
241
  }
111
242
 
112
243
  export interface AssetSelectionGridItem {
@@ -119,7 +250,12 @@ export interface AssetSelectionGridItem {
119
250
  }
120
251
 
121
252
  /** Source masonry geometry: responsive columns, shortest-column placement, 12px gaps. */
122
- export function AssetSelectionGrid({ items, selectedId, onSelect, onContextMenu }: {
253
+ export function AssetSelectionGrid({
254
+ items,
255
+ selectedId,
256
+ onSelect,
257
+ onContextMenu,
258
+ }: {
123
259
  items: AssetSelectionGridItem[]
124
260
  selectedId: string | null
125
261
  onSelect?: (id: string) => void
@@ -141,10 +277,8 @@ export function AssetSelectionGrid({ items, selectedId, onSelect, onContextMenu
141
277
  // (square fallback when either is missing), the other derives from aspectRatio.
142
278
  const columns = assetMasonryColumns(width)
143
279
  const columnWidth = columns.width
144
- const heights = items.map(item =>
145
- item.width && item.height
146
- ? Math.min(800, Math.max(150, columnWidth * item.height / item.width))
147
- : columnWidth,
280
+ const heights = items.map((item) =>
281
+ item.width && item.height ? Math.min(800, Math.max(150, (columnWidth * item.height) / item.width)) : columnWidth,
148
282
  )
149
283
  const layout = assetMasonryPositions(heights, columns.count, columns.gap)
150
284
  const positioned = items.map((item, index) => ({
@@ -153,32 +287,95 @@ export function AssetSelectionGrid({ items, selectedId, onSelect, onContextMenu
153
287
  left: (layout.positions[index]?.column ?? 0) * (columnWidth + columns.gap),
154
288
  height: heights[index] ?? columnWidth,
155
289
  }))
156
- return <div ref={container} className="relative w-full" style={{ height: layout.height }}>
157
- {positioned.map(({ item, top, left, height }) => {
158
- const className = `group relative block h-full w-full overflow-hidden rounded-lg border bg-surface-card p-0 transition-transform duration-200 hover:-translate-y-0.5 active:translate-y-0 motion-reduce:transition-none ${onSelect ? 'hover:shadow-xs hover:border-border-muted' : ''} ${selectedId === item.id ? 'border-accent-blue' : 'border-border'}`
159
- const contents = <>{item.preview}
160
- {item.tags.length ? <span className="pointer-events-none absolute inset-x-0 bottom-0 flex flex-wrap items-center gap-1 bg-gradient-to-t from-black/70 to-transparent p-3 opacity-0 transition-opacity duration-250 ease-[ease] group-hover:opacity-100 group-focus-visible:opacity-100 motion-reduce:transition-none">
161
- {item.tags.slice(0, 3).map(tag => <span key={tag} className="ms-3 inline-flex h-6 items-center rounded-full bg-surface-muted px-2.5 text-label font-medium leading-5 text-(--color-neutral-600)">{tag}</span>)}
162
- {item.tags.length > 3 ? <span className="text-label font-medium text-white/90">+{item.tags.length - 3}</span> : null}
163
- </span> : null}
164
- </>
165
- return <div key={item.id} data-cloud-asset-id={item.id}
166
- onContextMenu={event => onContextMenu(item.id, event)} className="absolute" style={{ top, insetInlineStart: left, width: columnWidth, height }}>
167
- <AssetCardKeyboard onContextMenu={event => onContextMenu(item.id, event)}>
168
- {onSelect ? <Button variant="ghost" aria-label={item.label} aria-pressed={selectedId === item.id}
169
- onPress={() => onSelect(item.id)} className={className}>{contents}</Button>
170
- : <BrowsableAsset role="img" aria-label={item.label} tabIndex={0} aria-haspopup="menu" className={className}>{contents}</BrowsableAsset>}
171
- </AssetCardKeyboard>
172
- </div>})}
173
- </div>
290
+ return (
291
+ <div ref={container} className="relative w-full" style={{ height: layout.height }}>
292
+ {positioned.map(({ item, top, left, height }) => {
293
+ const className = `group relative block h-full w-full overflow-hidden rounded-lg border bg-surface-card p-0 transition-transform duration-200 hover:-translate-y-0.5 active:translate-y-0 motion-reduce:transition-none ${onSelect ? 'hover:shadow-xs hover:border-border-muted' : ''} ${selectedId === item.id ? 'border-accent-blue' : 'border-border'}`
294
+ const contents = (
295
+ <>
296
+ {item.preview}
297
+ {item.tags.length ? (
298
+ <span className="pointer-events-none absolute inset-x-0 bottom-0 flex flex-wrap items-center gap-1 bg-gradient-to-t from-black/70 to-transparent p-3 opacity-0 transition-opacity duration-250 ease-[ease] group-hover:opacity-100 group-focus-visible:opacity-100 motion-reduce:transition-none">
299
+ {item.tags.slice(0, 3).map((tag) => (
300
+ <span
301
+ key={tag}
302
+ className="ms-3 inline-flex h-6 items-center rounded-full bg-surface-muted px-2.5 text-label font-medium leading-5 text-(--color-neutral-600)"
303
+ >
304
+ {tag}
305
+ </span>
306
+ ))}
307
+ {item.tags.length > 3 ? (
308
+ <span className="text-label font-medium text-white/90">+{item.tags.length - 3}</span>
309
+ ) : null}
310
+ </span>
311
+ ) : null}
312
+ </>
313
+ )
314
+ return (
315
+ <div
316
+ key={item.id}
317
+ data-cloud-asset-id={item.id}
318
+ onContextMenu={(event) => onContextMenu(item.id, event)}
319
+ className="absolute"
320
+ style={{ top, insetInlineStart: left, width: columnWidth, height }}
321
+ >
322
+ <AssetCardKeyboard onContextMenu={(event) => onContextMenu(item.id, event)}>
323
+ {onSelect ? (
324
+ <Button
325
+ variant="ghost"
326
+ aria-label={item.label}
327
+ aria-pressed={selectedId === item.id}
328
+ onPress={() => onSelect(item.id)}
329
+ className={className}
330
+ >
331
+ {contents}
332
+ </Button>
333
+ ) : (
334
+ <BrowsableAsset
335
+ role="img"
336
+ aria-label={item.label}
337
+ tabIndex={0}
338
+ aria-haspopup="menu"
339
+ className={className}
340
+ >
341
+ {contents}
342
+ </BrowsableAsset>
343
+ )}
344
+ </AssetCardKeyboard>
345
+ </div>
346
+ )
347
+ })}
348
+ </div>
349
+ )
174
350
  }
175
351
 
176
352
  /** Browsing is not selection. Keep keyboard access to the same context actions. */
177
- function AssetCardKeyboard({ children, onContextMenu }: { children: ReactNode; onContextMenu: (event: AssetMenuEvent) => void }) {
178
- return <div className="h-full w-full" onKeyDown={event => { if (event.key === 'ContextMenu' || (event.shiftKey && event.key === 'F10')) {
353
+ function AssetCardKeyboard({
354
+ children,
355
+ onContextMenu,
356
+ }: {
357
+ children: ReactNode
358
+ onContextMenu: (event: AssetMenuEvent) => void
359
+ }) {
360
+ return (
361
+ <div
362
+ className="h-full w-full"
363
+ onKeyDown={(event) => {
364
+ if (event.key === 'ContextMenu' || (event.shiftKey && event.key === 'F10')) {
179
365
  const rect = event.currentTarget.getBoundingClientRect()
180
366
  event.preventDefault()
181
367
  event.stopPropagation()
182
- onContextMenu({ preventDefault: () => event.preventDefault(), stopPropagation: () => event.stopPropagation(), clientX: rect.left + 16, clientY: rect.top + 16, currentTarget: event.currentTarget })
183
- } }}>{children}</div>
368
+ onContextMenu({
369
+ preventDefault: () => event.preventDefault(),
370
+ stopPropagation: () => event.stopPropagation(),
371
+ clientX: rect.left + 16,
372
+ clientY: rect.top + 16,
373
+ currentTarget: event.currentTarget,
374
+ })
375
+ }
376
+ }}
377
+ >
378
+ {children}
379
+ </div>
380
+ )
184
381
  }
@@ -0,0 +1,14 @@
1
+ import { Citation } from './citation'
2
+ export const examples = {
3
+ default: () => <Citation source="Brand manual · page 12">Keep the original proportions.</Citation>,
4
+ variants: () => (
5
+ <Citation variant="box" source="Brand manual · page 12">
6
+ Keep the original proportions.
7
+ </Citation>
8
+ ),
9
+ states: () => <Citation>Keep the original proportions even when a source is unavailable.</Citation>,
10
+ }
11
+ export const meta = {
12
+ category: 'Composite',
13
+ description: 'Narrative citation with a left rule or optional inset tile.',
14
+ }
@@ -0,0 +1,27 @@
1
+ import type { ReactNode } from 'react'
2
+ import { Tile } from './tile'
3
+
4
+ /** Narrative rule citation; source actions remain separate from review/approval. */
5
+ export function Citation({
6
+ children,
7
+ source,
8
+ variant = 'line',
9
+ }: {
10
+ children: ReactNode
11
+ source?: ReactNode
12
+ variant?: 'line' | 'box'
13
+ }) {
14
+ const content = (
15
+ <figure className="m-0">
16
+ <blockquote className="m-0 whitespace-pre-wrap text-body font-normal leading-relaxed text-fg">
17
+ {children}
18
+ </blockquote>
19
+ {source ? <figcaption className="mt-4 text-label font-normal text-fg-muted">{source}</figcaption> : null}
20
+ </figure>
21
+ )
22
+ return variant === 'box' ? (
23
+ <Tile className="h-auto min-h-0">{content}</Tile>
24
+ ) : (
25
+ <div className="border-s border-border ps-4">{content}</div>
26
+ )
27
+ }
@@ -0,0 +1,34 @@
1
+ import { ColumnLayout, ColumnLayoutRow, ColumnLayoutColumn, ColumnLayoutEmpty } from './column-layout'
2
+ export const examples = {
3
+ default: () => (
4
+ <ColumnLayout>
5
+ <ColumnLayoutRow weights={[1, 1]}>
6
+ <ColumnLayoutColumn>Main content</ColumnLayoutColumn>
7
+ <ColumnLayoutColumn>Supporting content</ColumnLayoutColumn>
8
+ </ColumnLayoutRow>
9
+ </ColumnLayout>
10
+ ),
11
+ variants: () => (
12
+ <ColumnLayout>
13
+ <ColumnLayoutRow weights={[2, 1]}>
14
+ <ColumnLayoutColumn>Wide content</ColumnLayoutColumn>
15
+ <ColumnLayoutColumn>Supporting content</ColumnLayoutColumn>
16
+ </ColumnLayoutRow>
17
+ </ColumnLayout>
18
+ ),
19
+ states: () => (
20
+ <ColumnLayout>
21
+ <ColumnLayoutRow weights={[1, 1, 1]}>
22
+ <ColumnLayoutColumn>Content</ColumnLayoutColumn>
23
+ <ColumnLayoutColumn>
24
+ <ColumnLayoutEmpty>Empty column</ColumnLayoutEmpty>
25
+ </ColumnLayoutColumn>
26
+ <ColumnLayoutColumn>Content</ColumnLayoutColumn>
27
+ </ColumnLayoutRow>
28
+ </ColumnLayout>
29
+ ),
30
+ }
31
+ export const meta = {
32
+ category: 'Layout',
33
+ description: 'Responsive weighted columns with a consistent block handle gutter.',
34
+ }
@@ -0,0 +1,36 @@
1
+ import type { CSSProperties, ReactNode } from 'react'
2
+ import { uic } from '../utils/uic'
3
+
4
+ export const ColumnLayout = uic('div', { displayName: 'ColumnLayout', baseClass: 'grid min-w-0 gap-y-4' })
5
+ const Row = uic('div', {
6
+ displayName: 'ColumnLayoutRow',
7
+ baseClass: 'relative grid min-w-0 grid-cols-1 items-start gap-y-4 md:grid-cols-(--layout-columns)',
8
+ })
9
+ /** The 38 px handle gutter is included once, not added to a second column gap.
10
+ * Weights apply to CONTENT widths after all gutters have been removed.
11
+ */
12
+ export function ColumnLayoutRow({
13
+ weights,
14
+ children,
15
+ ...props
16
+ }: React.ComponentProps<typeof Row> & { weights: readonly number[]; children: ReactNode }) {
17
+ const total = weights.reduce((sum, value) => sum + value, 0)
18
+ const gutter = 'calc(var(--spacing) * 9.5)'
19
+ const columns = weights
20
+ .map((weight) => `minmax(0,calc(${gutter} + (100% - ${weights.length} * ${gutter}) * ${weight} / ${total}))`)
21
+ .join(' ')
22
+ return (
23
+ <Row {...props} style={{ ...props.style, '--layout-columns': columns } as CSSProperties}>
24
+ {children}
25
+ </Row>
26
+ )
27
+ }
28
+ export const ColumnLayoutColumn = uic('div', {
29
+ displayName: 'ColumnLayoutColumn',
30
+ baseClass: 'grid min-w-0 content-start gap-y-4 ps-9.5',
31
+ })
32
+ export const ColumnLayoutEmpty = uic('div', {
33
+ displayName: 'ColumnLayoutEmpty',
34
+ baseClass:
35
+ 'grid min-h-30 place-content-center gap-2 rounded-lg border border-dashed border-border p-2 text-center text-label text-fg-muted',
36
+ })
@@ -67,6 +67,8 @@ export type ComboBoxProps<T extends object> = RACComboBoxProps<T> & {
67
67
  placeholder?: string
68
68
  /** Input height, matching `Input`'s `size`. */
69
69
  size?: FieldSize
70
+ /** Hide the toggle for fields driven only by text input. */
71
+ showToggle?: boolean
70
72
  children: ReactNode
71
73
  }
72
74
 
@@ -76,6 +78,7 @@ export const ComboBox = <T extends object>({
76
78
  errorMessage,
77
79
  placeholder,
78
80
  size = 'md',
81
+ showToggle = true,
79
82
  children,
80
83
  selectedKey,
81
84
  onSelectionChange,
@@ -133,11 +136,13 @@ export const ComboBox = <T extends object>({
133
136
  >
134
137
  <Label className={fieldLabelClass}>{label}</Label>
135
138
  <div className="relative">
136
- <ComboBoxInput placeholder={placeholder} fieldSize={size} />
139
+ <ComboBoxInput placeholder={placeholder} fieldSize={size} className={showToggle ? undefined : 'pr-4'} />
137
140
  {/* RAC uses this Button to toggle the listbox open/closed. */}
138
- <RACButton className="absolute inset-y-0 right-0 flex w-11 cursor-pointer data-[disabled]:cursor-not-allowed items-center justify-center rounded-r-lg outline-none data-[focus-visible]:ring-2 data-[focus-visible]:ring-ring">
139
- <Chevron />
140
- </RACButton>
141
+ {showToggle ? (
142
+ <RACButton className="absolute inset-y-0 right-0 flex w-11 cursor-pointer data-[disabled]:cursor-not-allowed items-center justify-center rounded-r-lg outline-none data-[focus-visible]:ring-2 data-[focus-visible]:ring-ring">
143
+ <Chevron />
144
+ </RACButton>
145
+ ) : null}
141
146
  </div>
142
147
  {desc}
143
148
  <FieldError className={fieldErrorClass}>{errorMessage}</FieldError>