@glasshome/ui 1.39.0 → 1.40.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.
@@ -0,0 +1,14 @@
1
+ import { type JSX } from "solid-js";
2
+ export interface TermDefinition {
3
+ icon: string;
4
+ title: string;
5
+ /** One sentence a homeowner reads in a glance. */
6
+ line: string;
7
+ href?: string;
8
+ }
9
+ /** A word a homeowner may not know; tapping it explains it in place. */
10
+ export declare function Term(props: {
11
+ term: TermDefinition;
12
+ children?: JSX.Element;
13
+ class?: string;
14
+ }): JSX.Element;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@glasshome/ui",
3
- "version": "1.39.0",
3
+ "version": "1.40.0",
4
4
  "description": "SolidJS component library for GlassHome, built on Kobalte",
5
5
  "keywords": [
6
6
  "components",
@@ -85,10 +85,15 @@
85
85
  "check:publish": "publint && attw --pack . --profile esm-only --exclude-entrypoints ./styles ./styles/theme && bun scripts/check-pack.ts",
86
86
  "dev": "tsc -b tsconfig.build.json --force && vite build --watch",
87
87
  "lint": "oxlint --type-aware . && oxfmt --check .",
88
- "test": "vitest run",
88
+ "test": "vitest run --project '!visual'",
89
+ "test:visual": "vitest run --project visual",
90
+ "test:visual:image": "sh dev/visual-in-image.sh",
91
+ "test:visual:update": "sh dev/visual-in-image.sh --update",
89
92
  "test:watch": "vitest",
90
93
  "dev:gallery": "vite --config vite.dev.config.ts",
91
- "gallery:shots": "node dev/shoot.mjs"
94
+ "gallery:shots": "bun dev/shoot.mjs",
95
+ "drive": "bun dev/drive/main.ts",
96
+ "preview": "bun dev/drive/main.ts preview"
92
97
  },
93
98
  "dependencies": {
94
99
  "@iconify/types": "^2.0.0",
@@ -105,6 +110,9 @@
105
110
  },
106
111
  "devDependencies": {
107
112
  "@arethetypeswrong/cli": "^0.18.5",
113
+ "@fontsource-variable/geist": "^5.3.0",
114
+ "@fontsource-variable/geist-mono": "^5.3.0",
115
+ "@guidepup/virtual-screen-reader": "^0.33.0",
108
116
  "@iconify-json/lucide": "^1.2.130",
109
117
  "@iconify-json/mdi": "^1.2.3",
110
118
  "@iconify-json/simple-icons": "^1.2.95",
@@ -113,6 +121,8 @@
113
121
  "@types/bun": "^1.4.0",
114
122
  "@types/node": "^25.2.2",
115
123
  "@vitest/browser-playwright": "4.1.11",
124
+ "axe-core": "^4.14.0",
125
+ "dom-accessibility-api": "^0.7.1",
116
126
  "fallow": "3.17.0",
117
127
  "happy-dom": "^20.14.0",
118
128
  "oxfmt": "0.65.0",
@@ -142,6 +152,7 @@
142
152
  "node": ">=20"
143
153
  },
144
154
  "patchedDependencies": {
155
+ "@guidepup/virtual-screen-reader@0.33.0": "patches/@guidepup%2Fvirtual-screen-reader@0.33.0.patch",
145
156
  "@kobalte/core@0.13.13": "patches/@kobalte%2Fcore@0.13.13.patch"
146
157
  }
147
158
  }
@@ -1,4 +1,4 @@
1
- import { readdirSync } from "node:fs";
1
+ import { existsSync, readdirSync, readFileSync } from "node:fs";
2
2
  import { dirname, join, resolve } from "node:path";
3
3
  import { fileURLToPath } from "node:url";
4
4
  import {
@@ -25,11 +25,18 @@ const pkg = resolve(dirname(fileURLToPath(import.meta.url)), "..");
25
25
  const CONFIG = join(pkg, "tsconfig.json");
26
26
  const ENTRY = join(pkg, "src/solid/index.ts");
27
27
  const GROUPS = join(pkg, "dev/groups");
28
+ const SCENARIOS = join(pkg, "dev/components");
28
29
  const SCREAMING_CASE = /^[A-Z][A-Z0-9_]*$/;
29
30
 
30
31
  export type Component = { name: string; module: string };
31
32
  export type SpecimenUse = { name: string; renders: string[] };
32
- export type Inventory = { exports: string[]; components: Component[]; specimens: SpecimenUse[] };
33
+ /** `scenarios` names each export a `dev/components/<kebab(name)>/scenarios.tsx` declares. */
34
+ export type Inventory = {
35
+ exports: string[];
36
+ components: Component[];
37
+ specimens: SpecimenUse[];
38
+ scenarios: string[];
39
+ };
33
40
  export type Report = {
34
41
  uncovered: string[];
35
42
  unknownSpecimens: string[];
@@ -40,7 +47,7 @@ type Allow = ReadonlyArray<readonly [name: string, reason: string]>;
40
47
 
41
48
  export function judge(inventory: Inventory, allow: Allow): Report {
42
49
  const moduleOf = new Map(inventory.components.map((c) => [c.name, c.module]));
43
- const named = new Set(inventory.specimens.map((s) => s.name));
50
+ const named = new Set([...inventory.specimens.map((s) => s.name), ...inventory.scenarios]);
44
51
  const exportNames = new Set(inventory.exports);
45
52
  const renderedByOwnModule = (c: Component) =>
46
53
  inventory.specimens.some(
@@ -49,7 +56,7 @@ export function judge(inventory: Inventory, allow: Allow): Report {
49
56
  const uncovered = inventory.components
50
57
  .filter((c) => !named.has(c.name) && !renderedByOwnModule(c))
51
58
  .map((c) => c.name);
52
- const unknown = [...named].filter((name) => !exportNames.has(name));
59
+ const unknown = inventory.specimens.map((s) => s.name).filter((name) => !exportNames.has(name));
53
60
  const allowed = new Set(allow.map(([name]) => name));
54
61
  const failing = new Set([...uncovered, ...unknown]);
55
62
  return {
@@ -101,6 +108,16 @@ function specimenName(node: Node): string | undefined {
101
108
  return "{no name}";
102
109
  }
103
110
 
111
+ function scenarioComponents(): string[] {
112
+ return readdirSync(SCENARIOS).flatMap((folder) => {
113
+ const file = join(SCENARIOS, folder, "scenarios.tsx");
114
+ if (!existsSync(file)) return [];
115
+ const name = /\bcomponent:\s*"([A-Za-z]+)"/.exec(readFileSync(file, "utf8"))?.[1];
116
+ const kebab = name?.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
117
+ return name !== undefined && kebab === folder ? [name] : [];
118
+ });
119
+ }
120
+
104
121
  export async function collectInventory(): Promise<Inventory> {
105
122
  const api = new API({ cwd: pkg });
106
123
  try {
@@ -158,6 +175,7 @@ export async function collectInventory(): Promise<Inventory> {
158
175
  exports,
159
176
  components,
160
177
  specimens: [...specimens].map(([name, renders]) => ({ name, renders: [...renders] })),
178
+ scenarios: scenarioComponents(),
161
179
  };
162
180
  } finally {
163
181
  await api.close();
@@ -3,6 +3,7 @@ import { Portal } from "solid-js/web";
3
3
  import { Z_CLASS } from "../lib/layers.js";
4
4
  import { cn } from "../lib/utils.js";
5
5
  import { type EdgeZone, edgeZone, moveId, slotAt } from "./dock-paging.js";
6
+ import { Icon } from "./icon.js";
6
7
  import { usePortalMount } from "./portal-mount.js";
7
8
 
8
9
  const DRAG_SLOP = 6;
@@ -168,19 +169,7 @@ const ZONE_BOX: Record<EdgeZone, string> = {
168
169
  bottom: "inset-x-1/4 bottom-0 h-2/5 border-t-2",
169
170
  };
170
171
 
171
- const GRIP_BOX: Record<EdgeZone, string> = {
172
- bottom: "top-0 left-1/2 h-3 w-12 -translate-x-1/2",
173
- left: "top-1/2 left-0 h-12 w-3 -translate-y-1/2",
174
- right: "top-1/2 right-0 h-12 w-3 -translate-y-1/2",
175
- };
176
-
177
- const GRIP_PILL: Record<EdgeZone, string> = {
178
- bottom: "h-1 w-8",
179
- left: "h-8 w-1",
180
- right: "h-8 w-1",
181
- };
182
-
183
- /** The grip on a dock's outer edge: carry it toward a screen edge and the three landing zones light up. */
172
+ /** The grip at the start of a dock (its top on a side, its left end at the bottom): carry it toward a screen edge and the three landing zones light up. */
184
173
  export function DockMoveGrip(props: {
185
174
  placement: EdgeZone;
186
175
  onMove: (placement: EdgeZone) => void;
@@ -233,11 +222,17 @@ export function DockMoveGrip(props: {
233
222
  aria-hidden="true"
234
223
  onPointerDown={onPointerDown}
235
224
  class={cn(
236
- "absolute z-10 flex cursor-grab touch-none items-center justify-center",
237
- GRIP_BOX[props.placement],
225
+ "text-foreground/50 absolute z-10 flex cursor-grab touch-none items-center justify-center",
226
+ props.placement === "bottom"
227
+ ? "top-1/2 left-0 h-12 w-5 -translate-y-1/2 sm:w-6"
228
+ : "top-0 left-1/2 h-5 w-12 -translate-x-1/2 sm:h-6",
238
229
  )}
239
230
  >
240
- <span class={cn("bg-foreground/35 rounded-full", GRIP_PILL[props.placement])} />
231
+ <Icon
232
+ icon={props.placement === "bottom" ? "lucide:grip-vertical" : "lucide:grip-horizontal"}
233
+ width={16}
234
+ height={16}
235
+ />
241
236
  </div>
242
237
  <Show when={carrying()}>
243
238
  <Portal mount={usePortalMount()}>
@@ -1,4 +1,5 @@
1
1
  import {
2
+ children,
2
3
  type Component,
3
4
  type ComponentProps,
4
5
  createEffect,
@@ -64,8 +65,13 @@ interface DockProps extends ComponentProps<"div"> {
64
65
  onAdd?: () => void;
65
66
  /** The full id order after a drag or an Alt+arrow move. */
66
67
  onReorder?: (ids: string[]) => void;
67
- /** While editing, a grip on the outer edge carries the whole dock to a screen edge; fires once on release over one. */
68
+ /** While editing, a grip at the dock's start carries the whole dock to a screen edge; fires once on release over one. */
68
69
  onMovePlacement?: (placement: DockPlacement) => void;
70
+ /** Sits inside the glass before the strip, never pages away; the strip's room shrinks by it. */
71
+ lead?: JSX.Element;
72
+ /** A second glass unit that grows out of the dock while `companionOpen`: above a bottom dock, under a side dock, which pages to make room. */
73
+ companion?: JSX.Element;
74
+ companionOpen?: boolean;
69
75
  }
70
76
 
71
77
  interface DockIconButtonProps extends ComponentProps<"button"> {
@@ -166,12 +172,21 @@ const Dock: Component<DockProps> = (props) => {
166
172
  "onAdd",
167
173
  "onReorder",
168
174
  "onMovePlacement",
175
+ "lead",
176
+ "companion",
177
+ "companionOpen",
169
178
  ]);
170
179
  const placement = () => local.placement ?? "bottom";
171
180
  const vertical = () => placement() !== "bottom";
181
+ const gripShown = () => Boolean(local.editing && local.onMovePlacement);
172
182
  // The drain plays where the fill grew, so the point outlives the hold.
173
183
  const [holdPoint, setHoldPoint] = createSignal({ x: 0, y: 0, r: 0 });
174
184
  let surfaceRef: HTMLDivElement | undefined;
185
+ let dotsRef: HTMLDivElement | undefined;
186
+ let leadRef: HTMLDivElement | undefined;
187
+ let companionRef: HTMLDivElement | undefined;
188
+ const lead = children(() => local.lead);
189
+ const companion = children(() => local.companion);
175
190
  createEffect(() => {
176
191
  const h = local.hold;
177
192
  if (!h) return;
@@ -254,7 +269,10 @@ const Dock: Component<DockProps> = (props) => {
254
269
  const availableSpan = () => {
255
270
  const box = containerRef?.closest<HTMLElement>('[data-slot="dock"]');
256
271
  if (!box || !surfaceRef) return 0;
257
- return viewSize(box) - padAlong(box) - padAlong(surfaceRef);
272
+ const lead = leadRef ? (vertical() ? leadRef.offsetHeight : leadRef.offsetWidth) : 0;
273
+ // A side dock's companion stacks along the edge, so the strip gives up its height.
274
+ const companion = vertical() && local.companionOpen ? (companionRef?.offsetHeight ?? 0) : 0;
275
+ return viewSize(box) - padAlong(box) - padAlong(surfaceRef) - lead - companion;
258
276
  };
259
277
 
260
278
  const checkOverflow = () => {
@@ -307,11 +325,12 @@ const Dock: Component<DockProps> = (props) => {
307
325
  const inSurfaceAlong = vertical()
308
326
  ? point.y >= surface.top && point.y <= surface.bottom
309
327
  : point.x >= surface.left && point.x <= surface.right;
328
+ const dots = dotsRef?.getBoundingClientRect();
310
329
  const pastStrip =
311
330
  place === "left"
312
- ? point.x > strip.right && point.x <= surface.right
331
+ ? point.x >= surface.left && point.x <= (dots?.right ?? strip.left)
313
332
  : place === "right"
314
- ? point.x < strip.left && point.x >= surface.left
333
+ ? point.x <= surface.right && point.x >= (dots?.left ?? strip.right)
315
334
  : point.y > strip.bottom && point.y <= surface.bottom;
316
335
  if (!pastStrip || !inSurfaceAlong) return;
317
336
  const ratio = vertical()
@@ -356,12 +375,38 @@ const Dock: Component<DockProps> = (props) => {
356
375
  });
357
376
  });
358
377
 
378
+ // The companion's own content can change height while open, under a side dock that is the strip's room.
379
+ onMount(() => {
380
+ if (!companionRef) return;
381
+ let frame = 0;
382
+ const observer = new ResizeObserver(() => {
383
+ if (!vertical() || !local.companionOpen) return;
384
+ cancelAnimationFrame(frame);
385
+ frame = requestAnimationFrame(checkOverflow);
386
+ });
387
+ observer.observe(companionRef);
388
+ onCleanup(() => {
389
+ cancelAnimationFrame(frame);
390
+ observer.disconnect();
391
+ });
392
+ });
393
+
359
394
  // The box pads by mode and the strip runs along the edge, so either switching changes the room it has.
360
395
  createEffect(
361
- on([() => local.items.length, dockMode, vertical], () => {
362
- const frame = requestAnimationFrame(checkOverflow);
363
- onCleanup(() => cancelAnimationFrame(frame));
364
- }),
396
+ on(
397
+ [
398
+ () => local.items.length,
399
+ dockMode,
400
+ vertical,
401
+ () => Boolean(lead()),
402
+ () => local.companionOpen,
403
+ gripShown,
404
+ ],
405
+ () => {
406
+ const frame = requestAnimationFrame(checkOverflow);
407
+ onCleanup(() => cancelAnimationFrame(frame));
408
+ },
409
+ ),
365
410
  );
366
411
 
367
412
  return (
@@ -370,7 +415,7 @@ const Dock: Component<DockProps> = (props) => {
370
415
  data-placement={placement()}
371
416
  class={cn(
372
417
  "flex max-w-full items-center justify-center",
373
- vertical() && "h-full max-h-full",
418
+ vertical() ? "h-full max-h-full flex-col" : "flex-col-reverse",
374
419
  dockMode() === "floating" ? "p-1 sm:p-2" : "",
375
420
  local.class,
376
421
  )}
@@ -382,17 +427,14 @@ const Dock: Component<DockProps> = (props) => {
382
427
  class={cn(
383
428
  // isolate: the layers behind the icons stay inside the dock even with blur off.
384
429
  "pointer-events-auto relative isolate flex max-w-full items-center justify-center p-1.5 sm:p-2",
385
- vertical() && "max-h-full flex-col",
386
- // A flush side dock runs the whole edge.
387
- vertical() && dockMode() === "docked" && "h-full",
388
- // Room for the page dots inside the glass; outside it they sit on
389
- // the screen edge and get clipped.
390
- pages() > 1 &&
391
- {
392
- bottom: "pb-4 sm:pb-5",
393
- left: "pr-4 sm:pr-5",
394
- right: "pl-4 sm:pl-5",
395
- }[placement()],
430
+ vertical() && "max-h-full min-h-0 flex-col",
431
+ // A flush side dock runs the whole edge, less what the companion takes.
432
+ vertical() && dockMode() === "docked" && "flex-1",
433
+ // Room for the page dots inside the glass; outside it they sit on the screen edge and get
434
+ // clipped. A side dock's dots sit behind its icons, so paging never widens or shifts it.
435
+ pages() > 1 && placement() === "bottom" && "pb-4 sm:pb-5",
436
+ // The grip takes the start of the dock's length, so the items stay centred across it.
437
+ gripShown() && (vertical() ? "pt-5 sm:pt-6" : "pl-5 sm:pl-6"),
396
438
  CARD_SURFACE,
397
439
  "[--glass-lift:0.55]",
398
440
  dockMode() === "floating"
@@ -429,6 +471,22 @@ const Dock: Component<DockProps> = (props) => {
429
471
  <div />
430
472
  </div>
431
473
  </Show>
474
+ <Show when={lead()}>
475
+ <div
476
+ ref={leadRef}
477
+ data-slot="dock-lead"
478
+ class={cn(
479
+ "flex shrink-0 items-center gap-0.5 sm:gap-1",
480
+ vertical() ? "flex-col pb-1 sm:pb-2" : "pr-1 sm:pr-2",
481
+ )}
482
+ >
483
+ {lead()}
484
+ <span
485
+ aria-hidden="true"
486
+ class={cn("bg-foreground/15 rounded-full", vertical() ? "h-px w-6" : "h-6 w-px")}
487
+ />
488
+ </div>
489
+ </Show>
432
490
  <div
433
491
  ref={containerRef}
434
492
  data-slot="dock-bar"
@@ -520,18 +578,20 @@ const Dock: Component<DockProps> = (props) => {
520
578
  </Show>
521
579
  </SelectionScope>
522
580
  </div>
523
- <Show when={local.editing && local.onMovePlacement}>
581
+ <Show when={gripShown()}>
524
582
  <DockMoveGrip placement={placement()} onMove={(next) => local.onMovePlacement?.(next)} />
525
583
  </Show>
526
584
  <Show when={pages() > 1}>
527
585
  <div
586
+ ref={dotsRef}
528
587
  data-slot="dock-pages"
529
588
  class={cn(
530
589
  "pointer-events-auto absolute flex justify-center gap-1.5",
531
590
  {
532
591
  bottom: "inset-x-0 bottom-1.5",
533
- left: "inset-y-0 right-1.5 flex-col items-center",
534
- right: "inset-y-0 left-1.5 flex-col items-center",
592
+ // 10px from the glass rim, which draws a 1px border.
593
+ left: "inset-y-0 left-[9px] -z-1 flex-col items-center",
594
+ right: "inset-y-0 right-[9px] -z-1 flex-col items-center",
535
595
  }[placement()],
536
596
  )}
537
597
  >
@@ -544,10 +604,10 @@ const Dock: Component<DockProps> = (props) => {
544
604
  onClick={() => goToPage(i)}
545
605
  class={cn(
546
606
  "transition-glass rounded-full",
547
- vertical() ? "w-1.5" : "h-1.5",
607
+ vertical() ? "w-1" : "h-1.5",
548
608
  page() === i
549
609
  ? cn("bg-foreground/70", vertical() ? "h-4" : "w-4")
550
- : cn("bg-foreground/25", vertical() ? "h-1.5" : "w-1.5"),
610
+ : cn("bg-foreground/25", vertical() ? "h-1" : "w-1.5"),
551
611
  )}
552
612
  />
553
613
  )}
@@ -555,6 +615,36 @@ const Dock: Component<DockProps> = (props) => {
555
615
  </div>
556
616
  </Show>
557
617
  </div>
618
+ <Show when={companion()}>
619
+ <div
620
+ data-slot="dock-companion-reveal"
621
+ data-open={local.companionOpen ? "" : undefined}
622
+ aria-hidden={local.companionOpen ? undefined : "true"}
623
+ inert={!local.companionOpen}
624
+ class={cn(
625
+ "grid shrink-0 grid-rows-[0fr] opacity-0 transition-[grid-template-rows,opacity] duration-(--duration-micro) ease-(--ease-contract) data-[open]:grid-rows-[1fr] data-[open]:opacity-100 data-[open]:duration-(--duration-expand) data-[open]:ease-(--ease-expand)",
626
+ // Takes the dock's width instead of widening it.
627
+ vertical() && "self-stretch [contain:inline-size]",
628
+ )}
629
+ >
630
+ <div class="min-h-0 min-w-0 overflow-hidden">
631
+ <div ref={companionRef} class={vertical() ? "pt-2" : "px-2 pt-2 pb-1"}>
632
+ <div
633
+ data-slot="dock-companion"
634
+ data-placement={placement()}
635
+ class={cn(
636
+ "pointer-events-auto flex items-center gap-1 rounded-xl p-1.5",
637
+ vertical() ? "w-full flex-col" : "w-max",
638
+ CARD_SURFACE,
639
+ "[--glass-lift:0.55]",
640
+ )}
641
+ >
642
+ {companion()}
643
+ </div>
644
+ </div>
645
+ </div>
646
+ </div>
647
+ </Show>
558
648
  </div>
559
649
  );
560
650
  };
@@ -136,12 +136,14 @@ export function Icon(props: IconProps) {
136
136
  const body = createMemo(() => built().body);
137
137
  // A TrustedHTML is a fresh object per call, which the spread would write as a new innerHTML.
138
138
  const html = createMemo(() => trusted(body()));
139
+ const named = () =>
140
+ rest["aria-label"] != null || rest["aria-labelledby"] != null || rest.role != null;
139
141
  return (
140
142
  <svg
141
143
  xmlns="http://www.w3.org/2000/svg"
142
144
  data-slot="icon"
143
145
  data-icon={local.icon}
144
- aria-hidden="true"
146
+ aria-hidden={named() ? undefined : "true"}
145
147
  fill="currentColor"
146
148
  {...rest}
147
149
  viewBox={built().attributes.viewBox}
@@ -396,6 +396,7 @@ export {
396
396
  TableRow,
397
397
  } from "./table.js";
398
398
  export { Tabs, TabsContent, TabsList, TabsTrigger } from "./tabs.js";
399
+ export { Term, type TermDefinition } from "./term.js";
399
400
  export { Textarea } from "./textarea.js";
400
401
  export { Toggle, toggleVariants } from "./toggle.js";
401
402
  export { ToggleGroup, ToggleGroupItem } from "./toggle-group.js";
@@ -31,7 +31,7 @@ const OPTION_CHOICE_ROW =
31
31
  "rounded-sm text-foreground/75 transition-colors hover:bg-foreground/5 aria-checked:text-foreground";
32
32
 
33
33
  const OPTION_CARD_DRAWER_CONTENT =
34
- "-translate-y-2 flex flex-col gap-0.5 pr-1 pb-2 pl-[calc(var(--spacing)*3.5+54px)] opacity-0 transition-[opacity,translate] duration-(--duration-expand) ease-(--ease-morph) group-data-[checked]/option-card:translate-y-0 group-data-[checked]/option-card:opacity-100 group-data-[checked]/option-card:delay-[80ms]";
34
+ "-translate-y-2 flex flex-col gap-0.5 pr-1 pb-2 pl-[calc(var(--spacing)*3.5+54px)] opacity-0 transition-[opacity,translate] duration-(--duration-expand) ease-(--ease-morph) group-data-[checked]/option-card:translate-y-0 group-data-[checked]/option-card:opacity-100 group-data-[checked]/option-card:delay-[var(--stagger-base,80ms)]";
35
35
 
36
36
  /* Sub-options are rows of the card, chosen in place: the same row a picker
37
37
  * list shows, flat on the card (a glass pill on a glass card is a layer too
@@ -69,6 +69,7 @@ const SelectContent: ParentComponent<
69
69
  ]);
70
70
  const select = useSelectContext();
71
71
  const [panel, setPanel] = createSignal<HTMLElement>();
72
+ const [list, setList] = createSignal<HTMLElement>();
72
73
  const layer = shadowLayer({
73
74
  content: panel,
74
75
  open: () => select.isOpen(),
@@ -98,11 +99,15 @@ const SelectContent: ParentComponent<
98
99
  {...rest}
99
100
  >
100
101
  <SelectionScope
101
- ref={ignoreOpeningRelease}
102
+ ref={(el: HTMLElement) => {
103
+ ignoreOpeningRelease(el);
104
+ setList(el);
105
+ }}
102
106
  marker="highlighted"
103
107
  class={cn("w-full", PICKER_LIST)}
104
108
  >
105
- <SelectPrimitive.Listbox class={cn(STAGGER, local.listboxClass)} />
109
+ {/* Kobalte scrolls its scrollRef to the highlighted option; the scope is what scrolls. */}
110
+ <SelectPrimitive.Listbox scrollRef={list} class={cn(STAGGER, local.listboxClass)} />
106
111
  </SelectionScope>
107
112
  </SelectPrimitive.Content>
108
113
  </SelectPrimitive.Portal>
@@ -68,7 +68,7 @@ const TabsTrigger: Component<ComponentProps<typeof TabsPrimitive.Trigger> & { ic
68
68
  class={cn(
69
69
  SEGMENT_ITEM,
70
70
  PRESS_DIP,
71
- "relative isolate hover:text-(--material-accent)/80 data-[selected]:text-(--material-accent)",
71
+ "not-data-[selected]:hover:text-foreground relative isolate data-[selected]:text-(--material-accent)",
72
72
  local.icon && "h-auto flex-1 flex-col gap-1 py-2 text-xs",
73
73
  local.class,
74
74
  )}
@@ -0,0 +1,51 @@
1
+ import { Popover as PopoverPrimitive } from "@kobalte/core/popover";
2
+ import { type JSX, Show } from "solid-js";
3
+ import { cn } from "../lib/utils.js";
4
+ import { Icon } from "./icon.js";
5
+ import { Popover, PopoverContent } from "./popover.js";
6
+ import { SectionIcon } from "./section-card.js";
7
+
8
+ export interface TermDefinition {
9
+ icon: string;
10
+ title: string;
11
+ /** One sentence a homeowner reads in a glance. */
12
+ line: string;
13
+ href?: string;
14
+ }
15
+
16
+ /** A word a homeowner may not know; tapping it explains it in place. */
17
+ export function Term(props: { term: TermDefinition; children?: JSX.Element; class?: string }) {
18
+ return (
19
+ <Popover>
20
+ <PopoverPrimitive.Trigger
21
+ data-slot="term"
22
+ class={cn(
23
+ "decoration-muted-foreground/60 hover:decoration-foreground cursor-help underline decoration-dotted underline-offset-4 outline-none focus-visible:rounded-sm focus-visible:ring-2 focus-visible:ring-[var(--material-accent)]",
24
+ props.class,
25
+ )}
26
+ >
27
+ {props.children ?? props.term.title}
28
+ </PopoverPrimitive.Trigger>
29
+ <PopoverContent class="flex w-72 items-start gap-3 text-left">
30
+ <SectionIcon icon={props.term.icon} tone="var(--material-accent)" size="sm" />
31
+ <div class="flex min-w-0 flex-col gap-1">
32
+ <span class="text-foreground text-sm font-semibold">{props.term.title}</span>
33
+ <span class="text-muted-foreground text-xs leading-snug">{props.term.line}</span>
34
+ <Show when={props.term.href}>
35
+ {(href) => (
36
+ <a
37
+ href={href()}
38
+ target="_blank"
39
+ rel="noopener noreferrer"
40
+ class="text-primary-tint-foreground mt-1 inline-flex items-center gap-1 self-start text-xs font-medium underline-offset-4 hover:underline"
41
+ >
42
+ Learn more
43
+ <Icon icon="lucide:arrow-up-right" width={12} height={12} />
44
+ </a>
45
+ )}
46
+ </Show>
47
+ </div>
48
+ </PopoverContent>
49
+ </Popover>
50
+ );
51
+ }
@@ -48,12 +48,15 @@ const ToggleGroup: ParentComponent<
48
48
  // discriminated union, so pulling `multiple` into a separate prop collapses the
49
49
  // union and mistypes `value`. Leave it in `rest` and just peek at it here.
50
50
  const sliding = () => !(props as { multiple?: boolean }).multiple;
51
+ // Same peek for `orientation`: a column stacks its segments instead of balancing rows.
52
+ const vertical = () => (props as { orientation?: string }).orientation === "vertical";
51
53
  let root: HTMLDivElement | undefined;
52
54
  let scope: HTMLDivElement | undefined;
53
55
  onMount(() => {
54
56
  if (!root) return;
55
57
  if (local.scroll) onCleanup(trackScroll(root, "[data-pressed]", "data-pressed"));
56
- else onCleanup(balanceRows(root, scope ?? root, '[data-slot="toggle-group-item"]'));
58
+ else if (!vertical())
59
+ onCleanup(balanceRows(root, scope ?? root, '[data-slot="toggle-group-item"]'));
57
60
  });
58
61
  return (
59
62
  <ToggleGroupPrimitive
@@ -66,9 +69,11 @@ const ToggleGroup: ParentComponent<
66
69
  `group/toggle-group w-fit max-w-full items-center gap-y-1 rounded-lg data-[wrapped]:w-full ${TRACK_SURFACE} p-1 data-[variant=outline]:shadow-xs`,
67
70
  local.scroll
68
71
  ? `flex [scrollbar-width:none] flex-nowrap overflow-x-auto ${SCROLL_TRACK_FADE}`
69
- : sliding()
70
- ? "flex"
71
- : BALANCED_ROWS,
72
+ : vertical()
73
+ ? "flex flex-col items-stretch"
74
+ : sliding()
75
+ ? "flex"
76
+ : BALANCED_ROWS,
72
77
  local.class,
73
78
  )}
74
79
  {...rest}
@@ -86,7 +91,9 @@ const ToggleGroup: ParentComponent<
86
91
  class={
87
92
  local.scroll
88
93
  ? "flex w-max flex-nowrap items-center"
89
- : `w-full items-center gap-y-1 ${BALANCED_ROWS}`
94
+ : vertical()
95
+ ? "flex w-full flex-col items-stretch gap-y-0.5"
96
+ : `w-full items-center gap-y-1 ${BALANCED_ROWS}`
90
97
  }
91
98
  >
92
99
  {local.children}
@@ -613,6 +613,8 @@ html[data-motion="live"] {
613
613
  --duration-arrive: 0ms;
614
614
  --duration-jiggle: 0ms;
615
615
  --duration-slide: 0ms;
616
+ --stagger-base: 0ms;
617
+ --stagger-step: 0ms;
616
618
  }
617
619
  /* tw-animate enter/exit classes carry their own fallback duration. */
618
620
  .animate-in,