@glasshome/ui 1.18.0 → 1.19.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 (53) hide show
  1. package/SPEC.md +82 -1
  2. package/dist/index.js +2 -2
  3. package/dist/lib/button-variants.d.ts +3 -0
  4. package/dist/lib/card-classes.d.ts +4 -4
  5. package/dist/lib/motion-classes.d.ts +1 -0
  6. package/dist/lib/overlay-classes.d.ts +4 -2
  7. package/dist/lib/spotlight-geometry.d.ts +22 -0
  8. package/dist/solid/button.d.ts +8 -3
  9. package/dist/solid/dock.d.ts +9 -0
  10. package/dist/solid/docked-panel.d.ts +11 -0
  11. package/dist/solid/index.d.ts +6 -2
  12. package/dist/solid/index.js +4387 -4022
  13. package/dist/solid/option-card.d.ts +1 -1
  14. package/dist/solid/preview-tile.d.ts +33 -0
  15. package/dist/solid/spotlight.d.ts +14 -0
  16. package/dist/solid/swatch-picker.d.ts +12 -0
  17. package/dist/solid/tabs.d.ts +4 -1
  18. package/dist/solid/widget-identity.d.ts +2 -0
  19. package/dist/tokens/index.d.ts +1 -0
  20. package/dist/tokens/index.js +336 -118
  21. package/dist/tokens/material.d.ts +40 -0
  22. package/dist/tokens/presets.d.ts +3 -0
  23. package/dist/tokens/theme-colors.d.ts +13 -3
  24. package/dist/tokens/theme-recipe.d.ts +8 -0
  25. package/dist/{utils-COITV1s9.js → utils-CV6G6fr8.js} +618 -615
  26. package/package.json +2 -2
  27. package/src/lib/button-variants.ts +4 -3
  28. package/src/lib/card-classes.ts +4 -3
  29. package/src/lib/motion-classes.ts +5 -0
  30. package/src/lib/overlay-classes.ts +10 -2
  31. package/src/lib/spotlight-geometry.ts +90 -0
  32. package/src/solid/button.tsx +17 -2
  33. package/src/solid/dock.tsx +67 -9
  34. package/src/solid/docked-panel.tsx +56 -0
  35. package/src/solid/hero-action.tsx +2 -2
  36. package/src/solid/index.ts +11 -2
  37. package/src/solid/option-card.tsx +25 -31
  38. package/src/solid/preview-tile.tsx +79 -0
  39. package/src/solid/radio-group.tsx +7 -2
  40. package/src/solid/section-card.tsx +4 -2
  41. package/src/solid/sliding-indicator.tsx +13 -12
  42. package/src/solid/spotlight.tsx +179 -0
  43. package/src/solid/swatch-picker.tsx +47 -0
  44. package/src/solid/tabs.tsx +20 -4
  45. package/src/solid/toggle-group.tsx +1 -4
  46. package/src/solid/widget-identity.tsx +3 -1
  47. package/src/styles/globals.css +166 -14
  48. package/src/styles/theme.css +13 -0
  49. package/src/tokens/index.ts +1 -0
  50. package/src/tokens/material.ts +116 -0
  51. package/src/tokens/presets.ts +195 -56
  52. package/src/tokens/theme-colors.ts +15 -3
  53. package/src/tokens/theme-recipe.ts +18 -4
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@glasshome/ui",
3
- "version": "1.18.0",
3
+ "version": "1.19.0",
4
4
  "description": "SolidJS component library for GlassHome, built on Kobalte",
5
5
  "type": "module",
6
6
  "homepage": "https://github.com/glasshome/ui#readme",
@@ -109,7 +109,7 @@
109
109
  "@tailwindcss/vite": "^4.1.13",
110
110
  "@types/node": "^25.2.2",
111
111
  "fallow": "3.17.0",
112
- "happy-dom": "^20.11.0",
112
+ "happy-dom": "^20.14.0",
113
113
  "playwright": "^1.60.0",
114
114
  "publint": "^0.3.21",
115
115
  "tailwindcss": "^4.1.13",
@@ -18,11 +18,11 @@ export const buttonVariants = cva({
18
18
  variants: {
19
19
  variant: {
20
20
  default:
21
- "glass glass-tint [--glass-text:70%] [--glass-tone:var(--primary)] [--glass-wash:30%] hover:[--glass-edge:color-mix(in_srgb,var(--primary)_60%,transparent)] hover:[--glass-wash:40%]",
21
+ "glass glass-tint [--glass-text:0%] [--glass-tone:var(--primary)] [--glass-wash:55%] hover:[--glass-edge:color-mix(in_srgb,var(--primary)_60%,transparent)] hover:[--glass-wash:65%] dark:[--glass-tone:oklch(from_var(--primary)_calc(l_+_clamp(0,(l_-_0.74)*10,0.1))_c_h)] dark:[--glass-wash:62%] dark:[color:oklch(from_var(--glass-tone)_calc((0.74_-_l)*100)_0_0)] dark:hover:[--glass-wash:62%]",
22
22
  destructive:
23
- "glass glass-tint [--glass-text:61%] [--glass-tone:var(--destructive)] [--glass-wash:30%] focus-visible:ring-destructive/30 hover:[--glass-edge:color-mix(in_srgb,var(--destructive)_60%,transparent)] hover:[--glass-wash:40%]",
23
+ "glass glass-tint [--glass-text:0%] [--glass-tone:var(--destructive)] [--glass-wash:55%] focus-visible:ring-destructive/30 hover:[--glass-edge:color-mix(in_srgb,var(--destructive)_60%,transparent)] hover:[--glass-wash:65%] dark:[--glass-tone:oklch(from_var(--destructive)_calc(l_+_clamp(0,(l_-_0.74)*10,0.1))_c_h)] dark:[--glass-wash:62%] dark:[color:oklch(from_var(--glass-tone)_calc((0.74_-_l)*100)_0_0)] dark:hover:[--glass-wash:62%]",
24
24
  secondary:
25
- "glass glass-tint [--glass-tone:var(--accent)] [--glass-wash:30%] hover:[--glass-edge:color-mix(in_srgb,var(--accent)_60%,transparent)] hover:[--glass-wash:40%]",
25
+ "glass glass-tint [--glass-text:0%] [--glass-tone:var(--accent)] [--glass-wash:55%] hover:[--glass-edge:color-mix(in_srgb,var(--accent)_60%,transparent)] hover:[--glass-wash:65%] dark:[--glass-tone:oklch(from_var(--accent)_calc(l_+_clamp(0,(l_-_0.74)*10,0.1))_c_h)] dark:[--glass-wash:62%] dark:[color:oklch(from_var(--glass-tone)_calc((0.74_-_l)*100)_0_0)] dark:hover:[--glass-wash:62%]",
26
26
  outline: OUTLINE_SURFACE,
27
27
  ghost: "hover:bg-muted hover:text-foreground dark:hover:bg-muted/50",
28
28
  link: "text-primary underline-offset-4 hover:underline",
@@ -32,6 +32,7 @@ export const buttonVariants = cva({
32
32
  sm: "h-8 gap-1.5 px-3 has-[>svg]:px-2.5",
33
33
  lg: "h-10 px-6 has-[>svg]:px-4",
34
34
  icon: "size-9 p-2",
35
+ xl: "h-[72px] gap-3.5 rounded-full pr-7 pl-3 text-left font-semibold text-[17px] [&_svg:not([class*='size-'])]:size-5",
35
36
  none: "",
36
37
  },
37
38
  },
@@ -3,11 +3,12 @@ import { PRESS_DIP } from "./motion-classes.js";
3
3
  const CARD_KNOBS =
4
4
  "glass [--glass-wash:20%] [--glass-rim:0.3] [--glass-lift:0.45] [--glass-shade:0.05] dark:[--glass-shade:0]";
5
5
 
6
- export const CARD_SURFACE_BASE = `${CARD_KNOBS} [--glass-base:color-mix(in_srgb,var(--card)_60%,transparent)]`;
6
+ export const CARD_SURFACE_BASE = `${CARD_KNOBS} [--glass-base:color-mix(in_srgb,var(--card)_var(--material-clarity),transparent)]`;
7
7
 
8
8
  /* Split from the surface so dash's performant-blur engine can gate it off and
9
9
  * paint a precomputed frost instead. */
10
- export const CARD_BLUR = "backdrop-blur-[var(--glass-blur,24px)] backdrop-saturate-[1.8]";
10
+ export const CARD_BLUR =
11
+ "backdrop-blur-[var(--glass-blur,var(--material-blur,24px))] backdrop-saturate-[1.8]";
11
12
 
12
13
  export const CARD_SURFACE = `${CARD_SURFACE_BASE} ${CARD_BLUR}`;
13
14
 
@@ -18,7 +19,7 @@ export const CARD_SURFACE_OPAQUE = CARD_KNOBS;
18
19
  /* Rows inside a section: the card material again, one step in, so a row never
19
20
  * reads as a flat plate on a glass panel. */
20
21
  export const SECTION_ROW_SURFACE =
21
- "glass [--glass-rim:0.3] [--glass-base:color-mix(in_srgb,var(--card)_60%,transparent)]";
22
+ "glass [--glass-rim:0.3] [--glass-base:color-mix(in_srgb,var(--card)_var(--material-clarity),transparent)]";
22
23
 
23
24
  /* Recessed track frame (tabs, segmented controls). */
24
25
  export const TRACK_SURFACE = "border border-border/50 bg-card/40 backdrop-blur-sm";
@@ -49,3 +49,8 @@ export const HOLD_MOTION =
49
49
  * ends and leaves the element showing. */
50
50
  export const RISE_MOTION =
51
51
  "origin-bottom transition-[opacity,scale,translate] data-[expanded]:duration-(--duration-expand) data-[expanded]:ease-(--ease-expand) data-[closed]:duration-(--duration-micro) data-[closed]:ease-(--ease-contract) data-[closed]:pointer-events-none data-[closed]:translate-y-2 data-[closed]:scale-95 data-[closed]:opacity-0";
52
+
53
+ /* A mounted surface that follows its subject from place to place (the
54
+ * spotlight's hole and bubble). */
55
+ export const TRAVEL_MOTION =
56
+ "transition-[translate,clip-path] duration-(--duration-morph) ease-(--ease-expand)";
@@ -8,7 +8,8 @@ const OVERLAY_KNOBS =
8
8
 
9
9
  /* Split from the surface the way CARD_BLUR is, so a host can gate it off and
10
10
  * paint a precomputed frost instead. */
11
- export const OVERLAY_BLUR = "backdrop-blur-[var(--glass-blur,24px)] backdrop-saturate-[1.2]";
11
+ export const OVERLAY_BLUR =
12
+ "backdrop-blur-[var(--glass-blur,var(--material-blur,24px))] backdrop-saturate-[1.2]";
12
13
 
13
14
  export const OVERLAY_SURFACE_BASE = `${OVERLAY_KNOBS} [--glass-base:color-mix(in_srgb,var(--popover)_92%,transparent)]`;
14
15
 
@@ -26,9 +27,16 @@ export const OVERLAY_SURFACE_OPAQUE = `${OVERLAY_KNOBS} [--glass-base:var(--popo
26
27
  * unblurred scrim (backdrop-blur is too slow on mobile). */
27
28
  export const SCRIM_CLASS = "bg-scrim backdrop-blur-md";
28
29
 
30
+ export const PANEL_TAIL = `${Z_CLASS.overlay} rounded-md text-popover-foreground outline-hidden`;
31
+
32
+ /* The floating panel surface, minus positioning: a caller that is not
33
+ * anchor-relative (Spotlight's fixed bubble) composes this instead of
34
+ * FLOATING_PANEL. */
35
+ export const FLOATING_PANEL_SURFACE = `${OVERLAY_SURFACE} ${PANEL_TAIL}`;
36
+
29
37
  /* The floating panel every anchored surface wears. Padding is the caller's:
30
38
  * menus add p-1, popovers p-4, pickers none. */
31
- export const FLOATING_PANEL = `${OVERLAY_SURFACE} relative ${Z_CLASS.overlay} rounded-md text-popover-foreground outline-hidden`;
39
+ export const FLOATING_PANEL = `${OVERLAY_SURFACE} relative ${PANEL_TAIL}`;
32
40
 
33
41
  /* Zero-height rect on the trigger's top edge. With gutter 0 and the panel
34
42
  * width bound to --kb-popper-anchor-width, the panel covers the trigger and
@@ -0,0 +1,90 @@
1
+ export interface Box {
2
+ x: number;
3
+ y: number;
4
+ width: number;
5
+ height: number;
6
+ }
7
+
8
+ export interface Viewport {
9
+ width: number;
10
+ height: number;
11
+ }
12
+
13
+ /* Outer rect plus a rounded rect, filled even-odd. With no target the hole
14
+ * collapses to a point at the centre, same commands, so clip-path interpolates. */
15
+ export function holePath(
16
+ viewport: Viewport,
17
+ target: Box | null,
18
+ pad: number,
19
+ radius: number,
20
+ ): string {
21
+ const box = target
22
+ ? {
23
+ x: target.x - pad,
24
+ y: target.y - pad,
25
+ width: target.width + pad * 2,
26
+ height: target.height + pad * 2,
27
+ }
28
+ : { x: viewport.width / 2, y: viewport.height / 2, width: 0, height: 0 };
29
+ const r = Math.max(0, Math.min(radius, box.width / 2, box.height / 2));
30
+ const left = box.x;
31
+ const top = box.y;
32
+ const right = box.x + box.width;
33
+ const bottom = box.y + box.height;
34
+ const outer = `M0 0H${viewport.width}V${viewport.height}H0Z`;
35
+ const hole =
36
+ `M${left + r} ${top}H${right - r}A${r} ${r} 0 0 1 ${right} ${top + r}` +
37
+ `V${bottom - r}A${r} ${r} 0 0 1 ${right - r} ${bottom}` +
38
+ `H${left + r}A${r} ${r} 0 0 1 ${left} ${bottom - r}` +
39
+ `V${top + r}A${r} ${r} 0 0 1 ${left + r} ${top}Z`;
40
+ return outer + hole;
41
+ }
42
+
43
+ const clamp = (value: number, min: number, max: number) => Math.min(Math.max(value, min), max);
44
+
45
+ /* --radius-md (the panel's rounding) at the default 16px root: --radius 22.4px minus 2px. */
46
+ const PANEL_RADIUS = 20.4;
47
+ /* Keeps the tail off the rounded corners it would otherwise sit under. */
48
+ const TAIL_MARGIN = PANEL_RADIUS + 8;
49
+
50
+ export function placeBubble(
51
+ viewport: Viewport,
52
+ target: Box | null,
53
+ bubble: { width: number; height: number },
54
+ gap: number,
55
+ margin: number,
56
+ ): {
57
+ x: number;
58
+ y: number;
59
+ side: "above" | "below" | "center" | "inside";
60
+ tail: { x: number } | null;
61
+ } {
62
+ if (!target) {
63
+ return {
64
+ x: (viewport.width - bubble.width) / 2,
65
+ y: (viewport.height - bubble.height) / 2,
66
+ side: "center",
67
+ tail: null,
68
+ };
69
+ }
70
+ const rawX = target.x + target.width / 2 - bubble.width / 2;
71
+ if (target.height > viewport.height / 2) {
72
+ return {
73
+ x: clamp(rawX, margin, viewport.width - bubble.width - margin),
74
+ y: clamp(target.y + gap, margin, viewport.height - bubble.height - margin),
75
+ side: "inside",
76
+ tail: null,
77
+ };
78
+ }
79
+ const centreY = target.y + target.height / 2;
80
+ const side = centreY > viewport.height / 2 ? "above" : "below";
81
+ const rawY = side === "above" ? target.y - gap - bubble.height : target.y + target.height + gap;
82
+ const x = clamp(rawX, margin, viewport.width - bubble.width - margin);
83
+ const anchorCentre = target.x + target.width / 2;
84
+ return {
85
+ x,
86
+ y: clamp(rawY, margin, viewport.height - bubble.height - margin),
87
+ side,
88
+ tail: { x: clamp(anchorCentre - x, TAIL_MARGIN, bubble.width - TAIL_MARGIN) },
89
+ };
90
+ }
@@ -1,8 +1,9 @@
1
1
  import { Button as KobalteButton } from "@kobalte/core/button";
2
2
  import type { VariantProps } from "cva";
3
- import { type ComponentProps, splitProps } from "solid-js";
3
+ import { type ComponentProps, type JSX, splitProps } from "solid-js";
4
4
  import { buttonVariants } from "../lib/button-variants.js";
5
5
  import { cn } from "../lib/utils.js";
6
+ import { Icon } from "./icon.js";
6
7
 
7
8
  type ButtonProps = ComponentProps<typeof KobalteButton> & VariantProps<typeof buttonVariants>;
8
9
 
@@ -17,4 +18,18 @@ function Button(props: ButtonProps) {
17
18
  );
18
19
  }
19
20
 
20
- export { Button, buttonVariants };
21
+ function ButtonWell(props: { icon?: string; children?: JSX.Element; class?: string }) {
22
+ return (
23
+ <span
24
+ data-slot="button-well"
25
+ class={cn(
26
+ "grid size-12 shrink-0 place-items-center rounded-full bg-foreground/15",
27
+ props.class,
28
+ )}
29
+ >
30
+ {props.children ?? (props.icon ? <Icon icon={props.icon} /> : null)}
31
+ </span>
32
+ );
33
+ }
34
+
35
+ export { Button, ButtonWell, buttonVariants };
@@ -2,6 +2,7 @@ import {
2
2
  type Component,
3
3
  type ComponentProps,
4
4
  createEffect,
5
+ createMemo,
5
6
  createSignal,
6
7
  Index,
7
8
  type JSX,
@@ -27,6 +28,8 @@ interface DockItem {
27
28
  isActive?: boolean;
28
29
  /** Optional count badge on the item (e.g. pending updates). */
29
30
  badge?: number;
31
+ /** Something dragged is held over this item and will land here on release. */
32
+ isDropTarget?: boolean;
30
33
  }
31
34
 
32
35
  interface DockProps extends ComponentProps<"div"> {
@@ -36,19 +39,31 @@ interface DockProps extends ComponentProps<"div"> {
36
39
  hold?: { x: number; y: number; fired: boolean } | null;
37
40
  /** A rim light that orbits for as long as a mode is on. */
38
41
  glow?: boolean;
42
+ /** Where a drag from outside the dock is pointing, in client coordinates. */
43
+ dragPoint?: { x: number; y: number } | null;
39
44
  }
40
45
 
41
46
  interface DockIconButtonProps extends ComponentProps<"button"> {
42
47
  icon: Component<{ class?: string }> | JSX.Element;
43
48
  label: string;
44
49
  isActive?: boolean;
50
+ /** Sits on the sliding pill: the active item, or the one a drag would land on. */
51
+ lit?: boolean;
45
52
  badge?: number;
46
53
  }
47
54
 
48
55
  const DockIconButton: Component<DockIconButtonProps> = (props) => {
49
56
  // Kobalte's button root narrows `type`; Solid's ComponentProps<"button"> also
50
57
  // admits "menu", so it is split off rather than spread.
51
- const [local, rest] = splitProps(props, ["icon", "label", "class", "isActive", "badge", "type"]);
58
+ const [local, rest] = splitProps(props, [
59
+ "icon",
60
+ "label",
61
+ "class",
62
+ "isActive",
63
+ "badge",
64
+ "type",
65
+ "lit",
66
+ ]);
52
67
  const isElement = () => typeof local.icon !== "function";
53
68
 
54
69
  return (
@@ -68,8 +83,8 @@ const DockIconButton: Component<DockIconButtonProps> = (props) => {
68
83
  <div
69
84
  data-slot="dock-item-icon"
70
85
  class={cn(
71
- "flex items-center justify-center transition-colors duration-300",
72
- local.isActive ? "text-primary" : "text-foreground group-hover:text-primary/80",
86
+ "flex items-center justify-center transition-colors duration-(--duration-state)",
87
+ local.lit ? "text-primary" : "text-foreground group-hover:text-primary/80",
73
88
  )}
74
89
  >
75
90
  {isElement() ? (
@@ -100,7 +115,14 @@ const DockIconButton: Component<DockIconButtonProps> = (props) => {
100
115
  };
101
116
 
102
117
  const Dock: Component<DockProps> = (props) => {
103
- const [local, rest] = splitProps(props, ["items", "class", "dockMode", "hold", "glow"]);
118
+ const [local, rest] = splitProps(props, [
119
+ "items",
120
+ "class",
121
+ "dockMode",
122
+ "hold",
123
+ "glow",
124
+ "dragPoint",
125
+ ]);
104
126
  // The drain plays where the fill grew, so the point outlives the hold.
105
127
  const [holdPoint, setHoldPoint] = createSignal({ x: 0, y: 0, r: 0 });
106
128
  let surfaceRef: HTMLDivElement | undefined;
@@ -124,10 +146,16 @@ const Dock: Component<DockProps> = (props) => {
124
146
  const [viewportWidth, setViewportWidth] = createSignal(0);
125
147
 
126
148
  // The moving background: the shared SlidingIndicator tracks the active item.
127
- const activeIndex = () => {
149
+ // A memo: the items list is rebuilt on every hover change, and only a new active item may scroll the strip.
150
+ const activeIndex = createMemo(() => {
128
151
  const i = local.items.findIndex((it) => it.isActive);
129
152
  return i < 0 ? null : i;
130
- };
153
+ });
154
+ // A drag borrows the pill: it slides to where the drop would land and back when the drag leaves.
155
+ const pillIndex = createMemo(() => {
156
+ const i = local.items.findIndex((it) => it.isDropTarget);
157
+ return i < 0 ? activeIndex() : i;
158
+ });
131
159
 
132
160
  const gapWidth = () =>
133
161
  containerRef ? Number.parseFloat(getComputedStyle(containerRef).columnGap) || 0 : 0;
@@ -174,12 +202,39 @@ const Dock: Component<DockProps> = (props) => {
174
202
  });
175
203
  };
176
204
 
205
+ // A drag cannot click a page dot, so resting on the dot row turns to the page under it.
206
+ createEffect(() => {
207
+ const point = local.dragPoint;
208
+ if (!point || pages() < 2 || !surfaceRef || !containerRef) return;
209
+ const strip = containerRef.getBoundingClientRect();
210
+ const surface = surfaceRef.getBoundingClientRect();
211
+ const onDotRow =
212
+ point.y > strip.bottom &&
213
+ point.y <= surface.bottom &&
214
+ point.x >= surface.left &&
215
+ point.x <= surface.right;
216
+ if (!onDotRow) return;
217
+ const target = Math.min(
218
+ pages() - 1,
219
+ Math.floor(((point.x - surface.left) / surface.width) * pages()),
220
+ );
221
+ if (target === page()) return;
222
+ const timer = setTimeout(() => goToPage(target), 300);
223
+ onCleanup(() => clearTimeout(timer));
224
+ });
225
+
177
226
  // The active dashboard may sit on another page after a switch elsewhere.
178
227
  createEffect(() => {
179
228
  const i = activeIndex();
180
229
  if (i === null || !containerRef || !needsScroll()) return;
181
230
  const item = containerRef.querySelectorAll('[data-slot="dock-item"]')[i];
182
- item?.scrollIntoView({ inline: "nearest", block: "nearest", behavior: "smooth" });
231
+ if (!item || viewportWidth() <= 0) return;
232
+ // The strip only: scrollIntoView would also scroll the page and any frame embedding it.
233
+ const left =
234
+ item.getBoundingClientRect().left -
235
+ containerRef.getBoundingClientRect().left +
236
+ containerRef.scrollLeft;
237
+ goToPage(Math.floor(left / viewportWidth()));
183
238
  });
184
239
 
185
240
  onMount(() => {
@@ -275,16 +330,19 @@ const Dock: Component<DockProps> = (props) => {
275
330
  "min-width": needsScroll() ? "auto" : "fit-content",
276
331
  }}
277
332
  >
278
- <SlidingIndicator active={activeIndex()} class="flex items-center gap-0.5 sm:gap-1">
333
+ <SlidingIndicator active={pillIndex()} class="flex items-center gap-0.5 sm:gap-1">
279
334
  <Index each={local.items}>
280
- {(item) => (
335
+ {(item, i) => (
281
336
  <DockIconButton
282
337
  class={needsScroll() ? "snap-start" : undefined}
283
338
  icon={item().icon}
284
339
  label={item().label}
285
340
  onClick={item().onClick}
286
341
  isActive={item().isActive}
342
+ lit={i === pillIndex()}
287
343
  badge={item().badge}
344
+ data-drop-target={item().isDropTarget ? "" : undefined}
345
+ data-dock-id={item().id}
288
346
  />
289
347
  )}
290
348
  </Index>
@@ -0,0 +1,56 @@
1
+ import type { JSX } from "solid-js";
2
+ import { Show } from "solid-js";
3
+ import { Portal } from "solid-js/web";
4
+ import { Z_CLASS } from "../lib/layers.js";
5
+ import { OVERLAY_SURFACE_OPAQUE } from "../lib/overlay-classes.js";
6
+ import { cn } from "../lib/utils.js";
7
+ import { createModalParts } from "./dialog-parts.js";
8
+
9
+ /* Non-modal: no scrim, no scroll lock, no focus trap, so the page behind stays
10
+ * live. Opaque: an editor stays readable over any material, blur 0 included. Below md it docks to the bottom and a handle folds it to its header;
11
+ * z-sheet keeps menus opened from inside it (z-overlay) above it. */
12
+ const DOCKED_PANEL = `fixed ${Z_CLASS.sheet} flex flex-col overflow-hidden ${OVERLAY_SURFACE_OPAQUE} text-popover-foreground animate-in fade-in duration-300 max-md:inset-x-0 max-md:bottom-0 max-md:max-h-[min(60dvh,38rem)] max-md:rounded-t-2xl max-md:slide-in-from-bottom-8 md:inset-y-3 md:right-3 md:w-[25rem] md:rounded-2xl md:slide-in-from-right-8 max-md:data-[collapsed]:[&_[data-slot=docked-panel-body]]:hidden max-md:data-[collapsed]:[&_[data-slot=docked-panel-footer]]:hidden [&_[data-slot=docked-panel-footer]]:flex-row`;
13
+
14
+ export function DockedPanel(props: {
15
+ open: boolean;
16
+ ariaLabel: string;
17
+ collapsed?: boolean;
18
+ onCollapsedChange?: (collapsed: boolean) => void;
19
+ class?: string;
20
+ children: JSX.Element;
21
+ }) {
22
+ return (
23
+ <Show when={props.open}>
24
+ <Portal>
25
+ <aside
26
+ data-slot="docked-panel"
27
+ aria-label={props.ariaLabel}
28
+ data-collapsed={props.collapsed ? "" : undefined}
29
+ class={cn(DOCKED_PANEL, props.class)}
30
+ >
31
+ <Show when={props.onCollapsedChange}>
32
+ <button
33
+ type="button"
34
+ data-slot="docked-panel-handle"
35
+ aria-label={props.collapsed ? "Show panel" : "Hide panel"}
36
+ aria-expanded={!props.collapsed}
37
+ class="mx-auto flex h-6 w-full shrink-0 items-center justify-center md:hidden"
38
+ onClick={() => props.onCollapsedChange?.(!props.collapsed)}
39
+ >
40
+ <span class="h-1.5 w-10 rounded-full bg-foreground/25" />
41
+ </button>
42
+ </Show>
43
+ {props.children}
44
+ </aside>
45
+ </Portal>
46
+ </Show>
47
+ );
48
+ }
49
+
50
+ const {
51
+ Header: DockedPanelHeader,
52
+ Body: DockedPanelBody,
53
+ Footer: DockedPanelFooter,
54
+ } = createModalParts("docked-panel");
55
+
56
+ export { DockedPanelBody, DockedPanelFooter, DockedPanelHeader };
@@ -1,6 +1,5 @@
1
1
  import { type JSX, Show } from "solid-js";
2
2
  import { glassToneText, isNeutralTone, NEUTRAL_KNOBS } from "../lib/glass-tone.js";
3
- import { SECTION_OUTER_RADIUS } from "../lib/section-tokens.js";
4
3
  import { cn } from "../lib/utils.js";
5
4
  import { Badge } from "./badge.js";
6
5
  import { Icon } from "./icon.js";
@@ -11,7 +10,8 @@ import { Tooltip, TooltipContent, TooltipTrigger } from "./tooltip.js";
11
10
  * wizard's connect/sign-in steps and People's pick-one dialogs. Chrome lives
12
11
  * here once; the two call shapes below (nav button vs. grouped radio item)
13
12
  * share it so neither surface can drift from the other. */
14
- const HERO_ACTION_CHROME = `glass group relative flex min-h-[6.25rem] items-center gap-4 overflow-hidden ${SECTION_OUTER_RADIUS} p-4 text-left transition-glass duration-200 [--glass-lift:0.4] hover:-translate-y-0.5 active:translate-y-0 active:scale-[0.99] disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:translate-y-0 hover:[--glass-lift:0.85] data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50 data-[disabled]:hover:translate-y-0`;
13
+ const HERO_ACTION_CHROME =
14
+ "glass group relative flex min-h-[6.25rem] items-center gap-4 overflow-hidden rounded-[calc(var(--radius)+8px)] p-4 text-left transition-glass duration-200 [--glass-lift:0.4] [--glass-wash:20%] hover:[--glass-wash:30%] [--glass-edge:oklch(from_var(--glass-tone)_l_c_h/0.5)] [&_[data-slot=ornament-arrow]]:opacity-35 hover:-translate-y-0.5 active:translate-y-0 active:scale-[0.99] disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:translate-y-0 hover:[--glass-lift:0.85] data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50 data-[disabled]:hover:translate-y-0";
15
15
 
16
16
  /* glassToneText tints a label toward its own tone, which stops being legible
17
17
  * on a dark surface once the tone itself is dark (the GlassHome deep blue).
@@ -5,7 +5,7 @@
5
5
  export { type Color, parseColor } from "@kobalte/core/colors";
6
6
  // Floating glass panel + its shared surface token.
7
7
  export { SECTION_ROW_SURFACE } from "../lib/card-classes.js";
8
- export { RISE_MOTION } from "../lib/motion-classes.js";
8
+ export { RISE_MOTION, SETTLE_MOTION, TRAVEL_MOTION } from "../lib/motion-classes.js";
9
9
  export { OVERLAY_SURFACE } from "../lib/overlay-classes.js";
10
10
  // Section tokens re-exported from the Solid entry for convenience.
11
11
  export {
@@ -62,7 +62,7 @@ export {
62
62
  BreadcrumbPage,
63
63
  BreadcrumbSeparator,
64
64
  } from "./breadcrumb.js";
65
- export { Button, buttonVariants } from "./button.js";
65
+ export { Button, ButtonWell, buttonVariants } from "./button.js";
66
66
  export {
67
67
  ButtonGroup,
68
68
  ButtonGroupSeparator,
@@ -156,6 +156,12 @@ export {
156
156
  export type { ModalSize } from "./dialog-parts.js";
157
157
  export type { DockIconButtonProps, DockItem, DockProps } from "./dock.js";
158
158
  export { Dock } from "./dock.js";
159
+ export {
160
+ DockedPanel,
161
+ DockedPanelBody,
162
+ DockedPanelFooter,
163
+ DockedPanelHeader,
164
+ } from "./docked-panel.js";
159
165
  export {
160
166
  DropdownMenu,
161
167
  DropdownMenuCheckboxItem,
@@ -309,6 +315,7 @@ export {
309
315
  PopoverContent,
310
316
  PopoverTrigger,
311
317
  } from "./popover.js";
318
+ export { PreviewTile, PreviewTileGroup } from "./preview-tile.js";
312
319
  export { Progress } from "./progress.js";
313
320
  export { RadioGroup, RadioGroupItem } from "./radio-group.js";
314
321
  export {
@@ -389,7 +396,9 @@ export { SlidingIndicator } from "./sliding-indicator.js";
389
396
  // Wave 4: React-Library Alternatives - Simpler
390
397
  export { GlassToast, Toaster, toast } from "./sonner.js";
391
398
  export { Spinner } from "./spinner.js";
399
+ export { Spotlight } from "./spotlight.js";
392
400
  export { StepIndicator } from "./step-indicator.js";
401
+ export { SwatchPicker } from "./swatch-picker.js";
393
402
  export { Switch } from "./switch.js";
394
403
  export {
395
404
  TABLE_CELL_INSET,
@@ -10,7 +10,6 @@ import {
10
10
  useContext,
11
11
  } from "solid-js";
12
12
  import { CARD_SURFACE } from "../lib/card-classes.js";
13
- import { isNeutralTone, NEUTRAL_KNOBS } from "../lib/glass-tone.js";
14
13
  import { STAGGER } from "../lib/motion-classes.js";
15
14
  import { cn } from "../lib/utils.js";
16
15
  import { Icon } from "./icon.js";
@@ -18,13 +17,8 @@ import { Ornament } from "./ornament.js";
18
17
  import { PickerRow } from "./picker-row.js";
19
18
  import { RadioGroup, RadioGroupItem } from "./radio-group.js";
20
19
 
21
- /* The card is the affordance, so the radio's own control is suppressed and the
22
- * toned surface plus the check ornament carry the picked state; an accented card keeps its own tone at rest. Tone alone (no
23
- * .glass-tint) because a card is body copy: .glass-tint would mix the label
24
- * colour toward the tone, and toward `transparent` while nothing is picked.
25
- * Padding lives inside the label, not on the item, so the whole card is a
26
- * click target. */
27
- const OPTION_CARD_CHROME = `${CARD_SURFACE} group/option-card relative cursor-pointer overflow-hidden rounded-md transition-glass duration-200 hover:[--glass-base:color-mix(in_srgb,var(--card)_80%,transparent)] has-[:focus-visible]:[--glass-edge:var(--ring)] has-[:focus-visible]:ring-[3px] has-[:focus-visible]:ring-ring/50 [&:not([style*=--glass-tone])]:data-[checked]:[--glass-tone:var(--primary)] data-[checked]:[--glass-edge:color-mix(in_srgb,var(--primary)_45%,transparent)] data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50`;
20
+ /* Tone without .glass-tint: the card holds body copy, which must stay foreground-coloured. */
21
+ const OPTION_CARD_CHROME = `${CARD_SURFACE} group/option-card relative cursor-pointer overflow-hidden rounded-xl transition-glass duration-200 [&:not([style*=--glass-tone])]:[--glass-tone:var(--primary)] [--glass-wash:9%] hover:[--glass-wash:16%] has-[:focus-visible]:[--glass-edge:var(--ring)] has-[:focus-visible]:ring-[3px] has-[:focus-visible]:ring-ring/50 data-[checked]:[--glass-wash:30%] data-[checked]:[--glass-edge:oklch(from_var(--glass-tone)_l_c_h/0.75)] data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50`;
28
22
 
29
23
  /* Sub-options live inside the card: the card grows (a grid row morphing
30
24
  * 0fr -> 1fr on the morph token) while it is picked, and the content settles
@@ -37,7 +31,7 @@ const OPTION_CHOICE_ROW =
37
31
  "rounded-sm text-foreground/75 transition-colors hover:bg-foreground/5 aria-checked:text-foreground";
38
32
 
39
33
  const OPTION_CARD_DRAWER_CONTENT =
40
- "-translate-y-2 flex flex-col gap-0.5 pr-1 pb-2 pl-[calc(var(--spacing)*4+20px)] 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-[80ms]";
41
35
 
42
36
  /* Sub-options are rows of the card, chosen in place: the same row a picker
43
37
  * list shows, flat on the card (a glass pill on a glass card is a layer too
@@ -106,7 +100,7 @@ export function OptionCard(props: {
106
100
  description?: string;
107
101
  icon?: string;
108
102
  iconImage?: string;
109
- /** Per-option tone at rest (setup's brand colours); neutral by default. */
103
+ /** Per-option tone (setup's brand colours); the theme primary when absent. */
110
104
  accentVar?: string;
111
105
  /** Drop the check when picking the card is itself the next step. */
112
106
  ornament?: "check" | "none";
@@ -140,7 +134,8 @@ export function OptionCard(props: {
140
134
  <div
141
135
  data-slot="option-card"
142
136
  data-checked={checked() ? "" : undefined}
143
- class={cn(OPTION_CARD_CHROME, isNeutralTone(props.accentVar) && NEUTRAL_KNOBS, props.class)}
137
+ data-disabled={props.disabled ? "" : undefined}
138
+ class={cn(OPTION_CARD_CHROME, props.class)}
144
139
  style={
145
140
  props.accentVar ? ({ "--glass-tone": props.accentVar } as JSX.CSSProperties) : undefined
146
141
  }
@@ -154,14 +149,10 @@ export function OptionCard(props: {
154
149
  >
155
150
  {/* On the header row, not the card: a grown card keeps its rows clear. */}
156
151
  <Ornament kind={props.ornament ?? "check"} />
157
- <div data-slot="option-card-row" class="flex w-full items-start gap-3 p-3">
158
- <Show when={props.iconImage} fallback={<OptionIcon icon={props.icon} />}>
159
- {(src) => (
160
- <img src={src()} alt="" aria-hidden="true" class="size-5 shrink-0 object-contain" />
161
- )}
162
- </Show>
152
+ <div data-slot="option-card-row" class="flex w-full items-center gap-3.5 p-3.5">
153
+ <OptionIconWell icon={props.icon} image={props.iconImage} />
163
154
  <div class="flex min-w-0 flex-1 flex-col gap-0.5">
164
- <span data-slot="option-card-title" class="font-medium text-sm leading-snug">
155
+ <span data-slot="option-card-title" class="font-semibold text-[15px] leading-snug">
165
156
  {props.title}
166
157
  </span>
167
158
  <Show when={props.description}>
@@ -196,20 +187,23 @@ export function OptionCard(props: {
196
187
  );
197
188
  }
198
189
 
199
- /* The icon sits on the title line, the mini form of HeroAction's big glyph,
200
- * in text colour: the tone belongs to the surface and the ornament. */
201
- function OptionIcon(props: { icon?: string }) {
190
+ function OptionIconWell(props: { icon?: string; image?: string }) {
202
191
  return (
203
- <Show when={props.icon}>
204
- {(icon) => (
205
- <Icon
206
- icon={icon()}
207
- width={20}
208
- height={20}
209
- aria-hidden="true"
210
- class="mt-px shrink-0 text-muted-foreground"
211
- />
212
- )}
192
+ <Show when={props.icon || props.image}>
193
+ <span
194
+ data-slot="option-card-icon"
195
+ aria-hidden="true"
196
+ class="grid size-10 shrink-0 place-items-center rounded-[14px] bg-[color-mix(in_oklab,var(--surface-tone)_80%,black)] [color:oklch(from_var(--surface-tone)_calc((0.75_-_l)*100)_0_0)]"
197
+ >
198
+ <Show
199
+ when={props.image}
200
+ fallback={
201
+ <Show when={props.icon}>{(icon) => <Icon icon={icon()} width={20} height={20} />}</Show>
202
+ }
203
+ >
204
+ {(src) => <img src={src()} alt="" class="size-5 object-contain" />}
205
+ </Show>
206
+ </span>
213
207
  </Show>
214
208
  );
215
209
  }