@glasshome/ui 1.19.0 → 1.21.0

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 (45) hide show
  1. package/SPEC.md +2 -1
  2. package/dist/index.js +2 -2
  3. package/dist/lib/anchor-placement.d.ts +5 -0
  4. package/dist/lib/button-variants.d.ts +1 -1
  5. package/dist/lib/motion-classes.d.ts +1 -0
  6. package/dist/solid/color-disc.d.ts +33 -0
  7. package/dist/solid/dashboard-preview.d.ts +24 -0
  8. package/dist/solid/dialog-parts.d.ts +1 -0
  9. package/dist/solid/dialog.d.ts +3 -0
  10. package/dist/solid/image-picker.d.ts +3 -0
  11. package/dist/solid/index.d.ts +3 -1
  12. package/dist/solid/index.js +5931 -5537
  13. package/dist/solid/media-store.d.ts +10 -0
  14. package/dist/solid/option-card.d.ts +1 -0
  15. package/dist/solid/page-header.d.ts +2 -2
  16. package/dist/solid/preview-tile.d.ts +2 -0
  17. package/dist/solid/responsive-dialog.d.ts +2 -0
  18. package/dist/solid/schema-form.d.ts +6 -1
  19. package/dist/solid/sliding-indicator.d.ts +2 -0
  20. package/dist/solid/toggle-group.d.ts +4 -1
  21. package/dist/tokens/index.js +2 -1
  22. package/dist/{utils-CV6G6fr8.js → utils-CMk7R3zM.js} +413 -413
  23. package/package.json +1 -1
  24. package/scripts/check-ui-drift.mjs +5 -0
  25. package/src/lib/anchor-placement.ts +30 -0
  26. package/src/lib/button-variants.ts +12 -12
  27. package/src/lib/motion-classes.ts +5 -0
  28. package/src/solid/bottom-sheet/bottom-sheet.tsx +8 -1
  29. package/src/solid/color-disc.tsx +253 -0
  30. package/src/solid/dashboard-preview.tsx +128 -0
  31. package/src/solid/dialog-parts.tsx +5 -1
  32. package/src/solid/dialog.tsx +47 -5
  33. package/src/solid/entity-selector.tsx +2 -2
  34. package/src/solid/image-picker.tsx +232 -147
  35. package/src/solid/index.ts +9 -0
  36. package/src/solid/media-store.ts +20 -1
  37. package/src/solid/option-card.tsx +2 -0
  38. package/src/solid/page-header.tsx +9 -16
  39. package/src/solid/preview-tile.tsx +10 -0
  40. package/src/solid/responsive-dialog.tsx +10 -2
  41. package/src/solid/schema-form.tsx +30 -4
  42. package/src/solid/sliding-indicator.tsx +21 -5
  43. package/src/solid/toggle-group.tsx +18 -5
  44. package/src/styles/theme.css +12 -3
  45. package/src/tokens/presets.ts +1 -0
@@ -8,7 +8,9 @@ import {
8
8
  Show,
9
9
  Switch,
10
10
  } from "solid-js";
11
+ import { FIELD_CHROME } from "../lib/input-classes.js";
11
12
  import { PICKER_LIST } from "../lib/picker-classes.js";
13
+ import { SECTION_INNER_RADIUS } from "../lib/section-tokens.js";
12
14
  import { cn } from "../lib/utils.js";
13
15
  import { Alert } from "./alert.js";
14
16
  import {
@@ -21,6 +23,7 @@ import {
21
23
  AlertDialogHeader,
22
24
  AlertDialogTitle,
23
25
  } from "./alert-dialog.js";
26
+ import { Badge } from "./badge.js";
24
27
  import { Button } from "./button.js";
25
28
  import { formatBytes } from "./charts.js";
26
29
  import {
@@ -35,8 +38,12 @@ import { Icon } from "./icon.js";
35
38
  import { mediaIndexErrorCopy, mediaStoreErrorCopy, toMediaStoreError } from "./media-copy.js";
36
39
  import {
37
40
  createBrokenMedia,
41
+ type ImagePreset,
42
+ imagePreset,
38
43
  MEDIA_PAGE_SIZE,
44
+ type MediaStore,
39
45
  type MediaStoreError,
46
+ presetValue,
40
47
  type StoredMedia,
41
48
  sortMediaForClearing,
42
49
  useMediaStore,
@@ -59,19 +66,66 @@ export interface ImagePickerProps {
59
66
  id?: string;
60
67
  value: string;
61
68
  onChange: (id: string) => void;
69
+ /** Built-in pictures offered before the uploads; picking one stores `presetValue(key)`. */
70
+ presets?: Record<string, ImagePreset>;
62
71
  class?: string;
63
72
  }
64
73
 
65
74
  export function ImagePicker(props: ImagePickerProps) {
66
75
  const store = useMediaStore();
76
+ return (
77
+ <Show
78
+ when={store || props.presets}
79
+ fallback={
80
+ <div data-slot="image-picker" class={cn(props.class)}>
81
+ <Alert tone="info">This dashboard cannot store images.</Alert>
82
+ </div>
83
+ }
84
+ >
85
+ <ImageGallery {...props} store={store} />
86
+ </Show>
87
+ );
88
+ }
67
89
 
68
- if (!store) {
69
- return (
70
- <div data-slot="image-picker" class={cn(props.class)}>
71
- <Alert tone="info">This dashboard cannot store images.</Alert>
72
- </div>
73
- );
74
- }
90
+ type GalleryTile =
91
+ | { kind: "preset"; key: string; preset: ImagePreset }
92
+ | { kind: "media"; image: StoredMedia };
93
+
94
+ function PresetTile(props: { preset: ImagePreset; selected: boolean; onSelect: () => void }) {
95
+ return (
96
+ <div data-slot="image-picker-preset" class="relative min-w-0">
97
+ <button
98
+ type="button"
99
+ aria-label={`Use ${props.preset.label}`}
100
+ aria-pressed={props.selected}
101
+ onClick={() => props.onSelect()}
102
+ class={cn(
103
+ FIELD_CHROME,
104
+ SECTION_INNER_RADIUS,
105
+ "relative block aspect-square w-full overflow-hidden",
106
+ props.selected && "ring-2 ring-primary",
107
+ )}
108
+ >
109
+ <img
110
+ src={props.preset.thumb}
111
+ alt={props.preset.label}
112
+ loading="lazy"
113
+ decoding="async"
114
+ class="absolute inset-0 h-full w-full object-cover"
115
+ />
116
+ </button>
117
+ <Badge
118
+ tone="var(--muted-foreground)"
119
+ class="pointer-events-none absolute bottom-1 left-1 backdrop-blur-md"
120
+ >
121
+ Built in
122
+ </Badge>
123
+ </div>
124
+ );
125
+ }
126
+
127
+ function ImageGallery(props: ImagePickerProps & { store: MediaStore | undefined }) {
128
+ const store = props.store;
75
129
 
76
130
  const [open, setOpen] = createSignal(false);
77
131
  const [everOpened, setEverOpened] = createSignal(false);
@@ -80,11 +134,14 @@ export function ImagePicker(props: ImagePickerProps) {
80
134
  const [thumbBroken, setThumbBroken] = createSignal(false);
81
135
  const [uploading, setUploading] = createSignal(false);
82
136
  const [page, setPage] = createSignal(0);
83
- const thumbUrl = (id: string) => store.url(id, "thumb");
137
+ const thumbUrl = (id: string) => store?.url(id, "thumb") ?? "";
84
138
  const brokenTiles = createBrokenMedia(thumbUrl);
85
139
  let fileInput: HTMLInputElement | undefined;
86
140
 
87
- const [index, { refetch }] = createResource(everOpened, () => store.index());
141
+ const [index, { refetch }] = createResource(
142
+ () => everOpened() && store !== undefined,
143
+ () => (store ? store.index() : Promise.reject(new Error("no media store"))),
144
+ );
88
145
  // Reading index() on a rejected resource rethrows, which crashes the popover's
89
146
  // portal and leaves its overlay swallowing clicks. Every read goes through this.
90
147
  const indexError = createMemo(() =>
@@ -92,10 +149,17 @@ export function ImagePicker(props: ImagePickerProps) {
92
149
  );
93
150
  const loaded = () => (index.error === undefined ? index() : undefined);
94
151
  const sorted = createMemo(() => sortMediaForClearing(loaded()?.media ?? []));
95
- const pageCount = createMemo(() => Math.max(1, Math.ceil(sorted().length / MEDIA_PAGE_SIZE)));
152
+ // Built-in pictures lead the grid; the household's uploads follow them.
153
+ const tiles = createMemo<GalleryTile[]>(() => [
154
+ ...Object.entries(props.presets ?? {}).map(
155
+ ([key, preset]): GalleryTile => ({ kind: "preset", key, preset }),
156
+ ),
157
+ ...sorted().map((image): GalleryTile => ({ kind: "media", image })),
158
+ ]);
159
+ const pageCount = createMemo(() => Math.max(1, Math.ceil(tiles().length / MEDIA_PAGE_SIZE)));
96
160
  const current = createMemo(() => Math.min(page(), pageCount() - 1));
97
- const pageImages = createMemo(() =>
98
- sorted().slice(current() * MEDIA_PAGE_SIZE, current() * MEDIA_PAGE_SIZE + MEDIA_PAGE_SIZE),
161
+ const pageTiles = createMemo(() =>
162
+ tiles().slice(current() * MEDIA_PAGE_SIZE, current() * MEDIA_PAGE_SIZE + MEDIA_PAGE_SIZE),
99
163
  );
100
164
  const deleteDescription = createMemo(() => {
101
165
  const used = pendingDelete()?.usedBy ?? 0;
@@ -104,6 +168,17 @@ export function ImagePicker(props: ImagePickerProps) {
104
168
  : `This image is used in ${used} widget${used === 1 ? "" : "s"}. Deleting it will leave those widgets without an image.`;
105
169
  });
106
170
 
171
+ const chosenPreset = () => {
172
+ const key = imagePreset(props.value);
173
+ return key === undefined ? undefined : props.presets?.[key];
174
+ };
175
+
176
+ const pick = (value: string) => {
177
+ props.onChange(props.value === value ? "" : value);
178
+ setThumbBroken(false);
179
+ setOpen(false);
180
+ };
181
+
107
182
  const clearImage = () => {
108
183
  props.onChange("");
109
184
  setThumbBroken(false);
@@ -132,6 +207,7 @@ export function ImagePicker(props: ImagePickerProps) {
132
207
  setError(undefined);
133
208
  setUploading(true);
134
209
  try {
210
+ if (!store) return;
135
211
  const uploaded = await store.upload(file);
136
212
  await refetch();
137
213
  props.onChange(uploaded.id);
@@ -147,7 +223,7 @@ export function ImagePicker(props: ImagePickerProps) {
147
223
  if (!target) return;
148
224
  setError(undefined);
149
225
  try {
150
- await store.remove(target.id);
226
+ await store?.remove(target.id);
151
227
  await refetch();
152
228
  } catch (cause) {
153
229
  fail(cause);
@@ -169,7 +245,7 @@ export function ImagePicker(props: ImagePickerProps) {
169
245
  clearLabel="Clear image"
170
246
  >
171
247
  <Show
172
- when={!thumbBroken() && props.value}
248
+ when={!thumbBroken() && props.value && (chosenPreset() ?? store)}
173
249
  fallback={
174
250
  <>
175
251
  <Icon
@@ -185,7 +261,7 @@ export function ImagePicker(props: ImagePickerProps) {
185
261
  }
186
262
  >
187
263
  <img
188
- src={store.url(props.value)}
264
+ src={chosenPreset()?.thumb ?? store?.url(props.value)}
189
265
  alt=""
190
266
  width={24}
191
267
  height={24}
@@ -193,7 +269,9 @@ export function ImagePicker(props: ImagePickerProps) {
193
269
  class="size-6 shrink-0 rounded-sm object-cover"
194
270
  onError={() => setThumbBroken(true)}
195
271
  />
196
- <span class="flex-1 truncate text-left">Image selected</span>
272
+ <span class="flex-1 truncate text-left">
273
+ {chosenPreset()?.label ?? "Image selected"}
274
+ </span>
197
275
  </Show>
198
276
  </PickerTrigger>
199
277
  </PopoverAnchor>
@@ -207,42 +285,43 @@ export function ImagePicker(props: ImagePickerProps) {
207
285
  </Alert>
208
286
  )}
209
287
  </Show>
210
- <Switch
288
+ <Show when={indexError()}>
289
+ {(failure) => (
290
+ // role="status": the gallery is explaining itself, not raising an alarm.
291
+ <Empty role="status">
292
+ <EmptyHeader>
293
+ <EmptyMedia variant="icon">
294
+ <Icon icon="lucide:image-off" width={24} height={24} />
295
+ </EmptyMedia>
296
+ <EmptyTitle>Images unavailable</EmptyTitle>
297
+ <EmptyDescription>{mediaIndexErrorCopy(failure())}</EmptyDescription>
298
+ </EmptyHeader>
299
+ <EmptyContent>
300
+ <Button
301
+ type="button"
302
+ variant="outline"
303
+ size="sm"
304
+ data-slot="image-picker-retry"
305
+ onClick={() => void refetch()}
306
+ >
307
+ Try again
308
+ </Button>
309
+ </EmptyContent>
310
+ </Empty>
311
+ )}
312
+ </Show>
313
+ <Show
314
+ when={tiles().length > 0}
211
315
  fallback={
212
- <div data-slot="image-picker-loading" class="grid grid-cols-3 gap-2">
213
- <For each={[0, 1, 2, 3, 4, 5]}>{() => <Skeleton class="aspect-square" />}</For>
214
- </div>
215
- }
216
- >
217
- <Match when={indexError()}>
218
- {(failure) => (
219
- // role="status": the gallery is explaining itself, not raising an alarm.
220
- <Empty role="status">
221
- <EmptyHeader>
222
- <EmptyMedia variant="icon">
223
- <Icon icon="lucide:image-off" width={24} height={24} />
224
- </EmptyMedia>
225
- <EmptyTitle>Images unavailable</EmptyTitle>
226
- <EmptyDescription>{mediaIndexErrorCopy(failure())}</EmptyDescription>
227
- </EmptyHeader>
228
- <EmptyContent>
229
- <Button
230
- type="button"
231
- variant="outline"
232
- size="sm"
233
- data-slot="image-picker-retry"
234
- onClick={() => void refetch()}
235
- >
236
- Try again
237
- </Button>
238
- </EmptyContent>
239
- </Empty>
240
- )}
241
- </Match>
242
- <Match when={loaded()}>
243
- <Show
244
- when={sorted().length > 0}
245
- fallback={
316
+ <Switch>
317
+ <Match when={store && !loaded() && !indexError()}>
318
+ <div data-slot="image-picker-loading" class="grid grid-cols-3 gap-2">
319
+ <For each={[0, 1, 2, 3, 4, 5]}>
320
+ {() => <Skeleton class="aspect-square" />}
321
+ </For>
322
+ </div>
323
+ </Match>
324
+ <Match when={loaded()}>
246
325
  <Empty>
247
326
  <EmptyHeader>
248
327
  <EmptyMedia variant="icon">
@@ -252,103 +331,109 @@ export function ImagePicker(props: ImagePickerProps) {
252
331
  <EmptyDescription>Upload one to use it here.</EmptyDescription>
253
332
  </EmptyHeader>
254
333
  </Empty>
255
- }
256
- >
257
- <div
258
- data-slot="image-picker-gallery"
259
- class={cn("grid grid-cols-3 gap-2", PICKER_LIST)}
260
- >
261
- <For each={pageImages()}>
262
- {(image) => (
263
- <MediaTile
264
- item={image}
265
- thumbUrl={thumbUrl(image.id)}
266
- label={`Use ${image.id}`}
267
- broken={brokenTiles.isBroken(image)}
268
- markUnused
269
- selected={props.value === image.id}
270
- onSelect={() => {
271
- props.onChange(props.value === image.id ? "" : image.id);
272
- setThumbBroken(false);
273
- setOpen(false);
274
- }}
275
- onBroken={() => brokenTiles.markBroken(image)}
276
- onDelete={() => setPendingDelete(image)}
277
- />
278
- )}
279
- </For>
280
- </div>
281
- <Show when={pageCount() > 1}>
282
- <Pagination>
283
- <PaginationContent class="w-full justify-between">
284
- <PaginationItem>
285
- <PaginationPrevious
286
- href="#"
287
- aria-disabled={current() === 0}
288
- class={current() === 0 ? "pointer-events-none opacity-50" : undefined}
289
- onClick={(event) => {
290
- event.preventDefault();
291
- step(-1);
292
- }}
293
- />
294
- </PaginationItem>
295
- <PaginationItem data-testid="image-picker-page-label">
296
- <SectionMeta>
297
- Page {current() + 1} of {pageCount()}
298
- </SectionMeta>
299
- </PaginationItem>
300
- <PaginationItem>
301
- <PaginationNext
302
- href="#"
303
- aria-disabled={current() === pageCount() - 1}
304
- class={
305
- current() === pageCount() - 1
306
- ? "pointer-events-none opacity-50"
307
- : undefined
308
- }
309
- onClick={(event) => {
310
- event.preventDefault();
311
- step(1);
312
- }}
313
- />
314
- </PaginationItem>
315
- </PaginationContent>
316
- </Pagination>
317
- </Show>
318
- </Show>
319
- <Show when={loaded()?.usage}>
320
- {(u) => (
321
- <SectionMeta>
322
- {formatBytes(u().bytes)} of {formatBytes(u().limitBytes)} · {u().files} of{" "}
323
- {u().limitFiles} images
324
- </SectionMeta>
325
- )}
326
- </Show>
327
- </Match>
328
- </Switch>
329
- <input
330
- ref={fileInput}
331
- type="file"
332
- accept="image/*"
333
- data-testid="image-upload-input"
334
- class="hidden"
335
- onChange={(e) => {
336
- const file = e.currentTarget.files?.[0];
337
- e.currentTarget.value = "";
338
- if (file) void handleUpload(file);
339
- }}
340
- />
341
- <Button
342
- type="button"
343
- variant="outline"
344
- size="sm"
345
- data-slot="image-picker-upload"
346
- disabled={uploading()}
347
- onClick={() => fileInput?.click()}
334
+ </Match>
335
+ </Switch>
336
+ }
348
337
  >
349
- <Icon icon="lucide:upload" width={14} height={14} />
350
- {uploading() ? "Uploading..." : "Upload"}
351
- </Button>
338
+ <div
339
+ data-slot="image-picker-gallery"
340
+ class={cn("grid grid-cols-3 gap-2", PICKER_LIST, "overflow-x-hidden")}
341
+ >
342
+ <For each={pageTiles()}>
343
+ {(tile) =>
344
+ tile.kind === "preset" ? (
345
+ <PresetTile
346
+ preset={tile.preset}
347
+ selected={props.value === presetValue(tile.key)}
348
+ onSelect={() => pick(presetValue(tile.key))}
349
+ />
350
+ ) : (
351
+ <MediaTile
352
+ item={tile.image}
353
+ thumbUrl={thumbUrl(tile.image.id)}
354
+ label={`Use ${tile.image.id}`}
355
+ broken={brokenTiles.isBroken(tile.image)}
356
+ markUnused
357
+ selected={props.value === tile.image.id}
358
+ onSelect={() => pick(tile.image.id)}
359
+ onBroken={() => brokenTiles.markBroken(tile.image)}
360
+ onDelete={() => setPendingDelete(tile.image)}
361
+ />
362
+ )
363
+ }
364
+ </For>
365
+ </div>
366
+ <Show when={pageCount() > 1}>
367
+ <Pagination>
368
+ <PaginationContent class="w-full justify-between">
369
+ <PaginationItem>
370
+ <PaginationPrevious
371
+ href="#"
372
+ aria-disabled={current() === 0}
373
+ class={current() === 0 ? "pointer-events-none opacity-50" : undefined}
374
+ onClick={(event) => {
375
+ event.preventDefault();
376
+ step(-1);
377
+ }}
378
+ />
379
+ </PaginationItem>
380
+ <PaginationItem data-testid="image-picker-page-label">
381
+ <SectionMeta>
382
+ Page {current() + 1} of {pageCount()}
383
+ </SectionMeta>
384
+ </PaginationItem>
385
+ <PaginationItem>
386
+ <PaginationNext
387
+ href="#"
388
+ aria-disabled={current() === pageCount() - 1}
389
+ class={
390
+ current() === pageCount() - 1
391
+ ? "pointer-events-none opacity-50"
392
+ : undefined
393
+ }
394
+ onClick={(event) => {
395
+ event.preventDefault();
396
+ step(1);
397
+ }}
398
+ />
399
+ </PaginationItem>
400
+ </PaginationContent>
401
+ </Pagination>
402
+ </Show>
403
+ </Show>
404
+ <Show when={loaded()?.usage}>
405
+ {(u) => (
406
+ <SectionMeta>
407
+ {formatBytes(u().bytes)} of {formatBytes(u().limitBytes)} · {u().files} of{" "}
408
+ {u().limitFiles} images
409
+ </SectionMeta>
410
+ )}
411
+ </Show>
412
+ <Show when={store}>
413
+ <input
414
+ ref={fileInput}
415
+ type="file"
416
+ accept="image/*"
417
+ data-testid="image-upload-input"
418
+ class="hidden"
419
+ onChange={(e) => {
420
+ const file = e.currentTarget.files?.[0];
421
+ e.currentTarget.value = "";
422
+ if (file) void handleUpload(file);
423
+ }}
424
+ />
425
+ <Button
426
+ type="button"
427
+ variant="outline"
428
+ size="sm"
429
+ data-slot="image-picker-upload"
430
+ disabled={uploading()}
431
+ onClick={() => fileInput?.click()}
432
+ >
433
+ <Icon icon="lucide:upload" width={14} height={14} />
434
+ {uploading() ? "Uploading..." : "Upload"}
435
+ </Button>
436
+ </Show>
352
437
  </div>
353
438
  </PopoverContent>
354
439
  </Popover>
@@ -102,6 +102,11 @@ export {
102
102
  CollapsibleContent,
103
103
  CollapsibleTrigger,
104
104
  } from "./collapsible.js";
105
+ export {
106
+ ColorDisc,
107
+ kelvinToCss,
108
+ TemperatureBar,
109
+ } from "./color-disc.js";
105
110
  export { ColorSlider } from "./color-slider.js";
106
111
  export { ColorWheel } from "./color-wheel.js";
107
112
  export {
@@ -122,6 +127,7 @@ export {
122
127
  } from "./context-menu.js";
123
128
  export { CopyButton } from "./copy-button.js";
124
129
  export { CountPill } from "./count-pill.js";
130
+ export { DashboardPreview, type DashboardPreviewTile } from "./dashboard-preview.js";
125
131
  export {
126
132
  DataTableHead,
127
133
  DataTableRow,
@@ -275,6 +281,8 @@ export {
275
281
  export {
276
282
  type BrokenMedia,
277
283
  createBrokenMedia,
284
+ type ImagePreset,
285
+ imagePreset,
278
286
  imageUrl,
279
287
  isMediaImage,
280
288
  MEDIA_PAGE_SIZE,
@@ -286,6 +294,7 @@ export {
286
294
  type MediaStoreErrorKind,
287
295
  type MediaVariant,
288
296
  mediaUrl,
297
+ presetValue,
289
298
  provideMediaStore,
290
299
  type StoredMedia,
291
300
  sortMediaForClearing,
@@ -101,8 +101,27 @@ export function createBrokenMedia(thumbUrl: (id: string) => string): BrokenMedia
101
101
  };
102
102
  }
103
103
 
104
+ const PRESET_PREFIX = "preset:";
105
+
106
+ /** A built-in picture a widget offers beside the household's own uploads. */
107
+ export interface ImagePreset {
108
+ label: string;
109
+ /** Small image for the picker; the widget keeps the full picture. */
110
+ thumb: string;
111
+ }
112
+
113
+ /** The stored value that picks a built-in picture. */
114
+ export function presetValue(key: string): string {
115
+ return `${PRESET_PREFIX}${key}`;
116
+ }
117
+
118
+ /** The built-in picture a stored image value names, or undefined for an upload. */
119
+ export function imagePreset(value: string | null | undefined): string | undefined {
120
+ return value?.startsWith(PRESET_PREFIX) ? value.slice(PRESET_PREFIX.length) : undefined;
121
+ }
122
+
104
123
  export function mediaUrl(id: string | null | undefined): string | undefined {
105
- if (!id) return undefined;
124
+ if (!id || imagePreset(id) !== undefined) return undefined;
106
125
  return useMediaStore()?.url(id);
107
126
  }
108
127
 
@@ -79,6 +79,7 @@ export function OptionCardGroup(props: {
79
79
  value: string | null;
80
80
  onChange: (value: string) => void;
81
81
  "aria-label"?: string;
82
+ "aria-labelledby"?: string;
82
83
  class?: string;
83
84
  children: JSX.Element;
84
85
  }) {
@@ -88,6 +89,7 @@ export function OptionCardGroup(props: {
88
89
  value={props.value ?? undefined}
89
90
  onChange={props.onChange}
90
91
  aria-label={props["aria-label"]}
92
+ aria-labelledby={props["aria-labelledby"]}
91
93
  >
92
94
  {props.children}
93
95
  </RadioGroup>
@@ -1,13 +1,13 @@
1
1
  import { type JSX, Show } from "solid-js";
2
2
  import { CARD_BLUR, CARD_SURFACE_BASE } from "../lib/card-classes.js";
3
+ import { SECTION_OUTER_RADIUS } from "../lib/section-tokens.js";
3
4
  import { cn } from "../lib/utils.js";
4
5
  import { CountPill } from "./count-pill.js";
5
- import { Icon } from "./icon.js";
6
- import { type GlassSurface, NOOP_GLASS } from "./section-card.js";
6
+ import { type GlassSurface, NOOP_GLASS, SectionIcon } from "./section-card.js";
7
7
 
8
8
  /**
9
- * Page banner header, shared by dash and hub: the card surface with a primary
10
- * glow and an optional logo watermark. Content is a superset API: icon/iconNode
9
+ * Page banner header, shared by dash and hub: the card surface with a display
10
+ * title and an optional logo watermark. Content is a superset API: icon/iconNode
11
11
  * + title + count pill + subtitle on the left, actions on the right. The caller
12
12
  * owns the space around it.
13
13
  *
@@ -36,14 +36,10 @@ export function PageHeader(props: {
36
36
  <div
37
37
  data-slot="page-header"
38
38
  ref={glass().ref}
39
- class={cn(CARD_SURFACE_BASE, "relative overflow-hidden rounded-xl")}
39
+ class={cn(CARD_SURFACE_BASE, SECTION_OUTER_RADIUS, "relative overflow-hidden")}
40
40
  classList={{ [CARD_BLUR]: !(glass().active?.() ?? false) }}
41
41
  style={glass().style?.() ?? {}}
42
42
  >
43
- <div
44
- data-slot="page-header-glow"
45
- class="pointer-events-none absolute top-0 left-0 h-48 w-72 -translate-x-1/3 -translate-y-1/2 rounded-full bg-primary/15 blur-3xl"
46
- />
47
43
  <Show when={props.logo}>
48
44
  {(logo) => (
49
45
  <img
@@ -54,27 +50,24 @@ export function PageHeader(props: {
54
50
  />
55
51
  )}
56
52
  </Show>
57
- <div
58
- data-slot="page-header-row"
59
- class="relative flex min-h-[64px] items-center gap-2.5 px-4 py-3 sm:min-h-[80px] sm:gap-4 sm:px-6 sm:py-5"
60
- >
53
+ <div data-slot="page-header-row" class="relative flex items-center gap-3 p-4 sm:gap-5 sm:p-6">
61
54
  <Show
62
55
  when={props.iconNode}
63
56
  fallback={
64
57
  <Show when={props.icon}>
65
58
  {(icon) => (
66
- <Icon icon={icon()} class="shrink-0 text-[28px] text-primary sm:text-[32px]" />
59
+ <SectionIcon icon={icon()} size="lg" tone="var(--primary)" class="shrink-0" />
67
60
  )}
68
61
  </Show>
69
62
  }
70
63
  >
71
64
  {props.iconNode}
72
65
  </Show>
73
- <div data-slot="page-header-headings" class="flex min-w-0 flex-1 flex-col gap-0.5">
66
+ <div data-slot="page-header-headings" class="flex min-w-0 flex-1 flex-col gap-1.5 sm:gap-2">
74
67
  <div data-slot="page-header-headline" class="flex min-w-0 items-center gap-2 sm:gap-3">
75
68
  <h1
76
69
  data-slot="page-header-title"
77
- class="min-w-0 truncate font-bold text-foreground text-xl tracking-[-0.02em] sm:text-2xl"
70
+ class="min-w-0 truncate pb-0.5 font-bold text-[1.75rem] text-foreground leading-none tracking-[-0.035em] sm:text-[2.5rem]"
78
71
  >
79
72
  {props.title}
80
73
  </h1>
@@ -38,6 +38,8 @@ export function PreviewTileGroup(props: {
38
38
  export function PreviewTile(props: {
39
39
  value: string;
40
40
  label: string;
41
+ /** A quieter second line under the caption. */
42
+ meta?: string;
41
43
  /** Off for pictures that name themselves; the label still reaches assistive tech. */
42
44
  caption?: boolean;
43
45
  icon?: string;
@@ -73,6 +75,14 @@ export function PreviewTile(props: {
73
75
  </Show>
74
76
  {props.label}
75
77
  </span>
78
+ <Show when={props.meta}>
79
+ <span
80
+ data-slot="preview-tile-meta"
81
+ class="-mt-1 text-center text-[11px] text-muted-foreground/80 leading-tight"
82
+ >
83
+ {props.meta}
84
+ </span>
85
+ </Show>
76
86
  </Show>
77
87
  </RadioGroupItem>
78
88
  );
@@ -95,17 +95,25 @@ type ResponsiveDialogContentProps = ComponentProps<"div"> & {
95
95
  size?: ModalSize;
96
96
  /** Names a panel that has no `ResponsiveDialogTitle`. */
97
97
  ariaLabel?: string;
98
+ /** Desktop only: opens the panel beside this element instead of centred. The mobile sheet ignores it. */
99
+ anchor?: HTMLElement;
98
100
  };
99
101
 
100
102
  const ResponsiveDialogContent: ParentComponent<ResponsiveDialogContentProps> = (props) => {
101
103
  const ctx = useResponsiveDialogContext();
102
- const [local, rest] = splitProps(props, ["class", "children", "size", "ariaLabel"]);
104
+ const [local, rest] = splitProps(props, ["class", "children", "size", "ariaLabel", "anchor"]);
103
105
 
104
106
  return (
105
107
  <Show
106
108
  when={ctx.isMobile()}
107
109
  fallback={
108
- <DialogContent class={local.class} size={local.size} ariaLabel={local.ariaLabel} {...rest}>
110
+ <DialogContent
111
+ class={local.class}
112
+ size={local.size}
113
+ ariaLabel={local.ariaLabel}
114
+ anchor={local.anchor}
115
+ {...rest}
116
+ >
109
117
  {local.children}
110
118
  </DialogContent>
111
119
  }