@glasshome/ui 1.17.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.
- package/SPEC.md +83 -2
- package/dist/index.js +2 -2
- package/dist/lib/button-variants.d.ts +4 -1
- package/dist/lib/card-classes.d.ts +4 -4
- package/dist/lib/motion-classes.d.ts +1 -0
- package/dist/lib/overlay-classes.d.ts +4 -2
- package/dist/lib/pill-classes.d.ts +1 -1
- package/dist/lib/spotlight-geometry.d.ts +22 -0
- package/dist/lib/thumb-classes.d.ts +1 -0
- package/dist/lib/tier-badge.d.ts +1 -1
- package/dist/solid/button.d.ts +8 -3
- package/dist/solid/dock.d.ts +9 -0
- package/dist/solid/docked-panel.d.ts +11 -0
- package/dist/solid/index.d.ts +6 -2
- package/dist/solid/index.js +4399 -4034
- package/dist/solid/option-card.d.ts +1 -1
- package/dist/solid/preview-tile.d.ts +33 -0
- package/dist/solid/spotlight.d.ts +14 -0
- package/dist/solid/swatch-picker.d.ts +12 -0
- package/dist/solid/tabs.d.ts +4 -1
- package/dist/solid/widget-identity.d.ts +2 -0
- package/dist/tokens/index.d.ts +3 -0
- package/dist/tokens/index.js +481 -67
- package/dist/tokens/material.d.ts +40 -0
- package/dist/tokens/presets.d.ts +3 -0
- package/dist/tokens/readability.d.ts +21 -0
- package/dist/tokens/theme-colors.d.ts +13 -3
- package/dist/tokens/theme-recipe.d.ts +33 -0
- package/dist/{utils-DMaksjvy.js → utils-CV6G6fr8.js} +343 -340
- package/package.json +2 -2
- package/src/lib/button-variants.ts +10 -7
- package/src/lib/card-classes.ts +4 -3
- package/src/lib/motion-classes.ts +5 -0
- package/src/lib/overlay-classes.ts +10 -2
- package/src/lib/pill-classes.ts +4 -3
- package/src/lib/spotlight-geometry.ts +90 -0
- package/src/lib/thumb-classes.ts +7 -0
- package/src/lib/tier-badge.ts +1 -1
- package/src/solid/button.tsx +17 -2
- package/src/solid/carousel.tsx +2 -2
- package/src/solid/data-table.tsx +2 -2
- package/src/solid/dock.tsx +67 -9
- package/src/solid/docked-panel.tsx +56 -0
- package/src/solid/hero-action.tsx +2 -2
- package/src/solid/icon-picker.tsx +1 -1
- package/src/solid/index.ts +11 -2
- package/src/solid/media-tile.tsx +1 -1
- package/src/solid/option-card.tsx +25 -31
- package/src/solid/preview-tile.tsx +79 -0
- package/src/solid/radio-group.tsx +7 -2
- package/src/solid/section-card.tsx +4 -2
- package/src/solid/sliding-indicator.tsx +13 -12
- package/src/solid/spotlight.tsx +179 -0
- package/src/solid/swatch-picker.tsx +47 -0
- package/src/solid/switch.tsx +5 -2
- package/src/solid/tabs.tsx +20 -4
- package/src/solid/toggle-group.tsx +1 -4
- package/src/solid/widget-identity.tsx +3 -1
- package/src/styles/globals.css +166 -14
- package/src/styles/theme.css +22 -3
- package/src/tokens/index.ts +3 -0
- package/src/tokens/material.ts +116 -0
- package/src/tokens/presets.ts +201 -62
- package/src/tokens/readability.ts +67 -0
- package/src/tokens/theme-colors.ts +15 -3
- package/src/tokens/theme-recipe.ts +161 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@glasshome/ui",
|
|
3
|
-
"version": "1.
|
|
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.
|
|
112
|
+
"happy-dom": "^20.14.0",
|
|
113
113
|
"playwright": "^1.60.0",
|
|
114
114
|
"publint": "^0.3.21",
|
|
115
115
|
"tailwindcss": "^4.1.13",
|
|
@@ -8,19 +8,21 @@ export const OUTLINE_SURFACE =
|
|
|
8
8
|
/* Buttons are glass pills on an OPAQUE --card base: a translucent fill goes
|
|
9
9
|
* muddy over dark heroes/sections. Every class is literal for Tailwind's
|
|
10
10
|
* scanner. `size: none` is sizeless for callers that own height/padding. */
|
|
11
|
+
/* Controls take the theme's corner (rounded-lg is --radius): a capsule at the
|
|
12
|
+
* roundness every preset but the sharp one ships, square at zero. */
|
|
11
13
|
export const buttonVariants = cva({
|
|
12
14
|
// structural-ok: the [&_svg]: utilities stay in Tailwind's utility layer so a
|
|
13
15
|
// caller's own [&_svg]:size-* override can still win; unlayered real CSS in
|
|
14
16
|
// globals.css would beat every consumer utility regardless of specificity.
|
|
15
|
-
base: "inline-flex shrink-0 cursor-pointer items-center justify-center gap-2 whitespace-nowrap rounded-
|
|
17
|
+
base: "inline-flex shrink-0 cursor-pointer items-center justify-center gap-2 whitespace-nowrap rounded-lg font-medium text-sm outline-none transition-glass focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 active:scale-[0.97] disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0",
|
|
16
18
|
variants: {
|
|
17
19
|
variant: {
|
|
18
20
|
default:
|
|
19
|
-
"glass glass-tint [--glass-text:
|
|
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%]",
|
|
20
22
|
destructive:
|
|
21
|
-
"glass glass-tint [--glass-text:
|
|
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%]",
|
|
22
24
|
secondary:
|
|
23
|
-
"glass glass-tint [--glass-tone:var(--accent)] [--glass-wash:
|
|
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%]",
|
|
24
26
|
outline: OUTLINE_SURFACE,
|
|
25
27
|
ghost: "hover:bg-muted hover:text-foreground dark:hover:bg-muted/50",
|
|
26
28
|
link: "text-primary underline-offset-4 hover:underline",
|
|
@@ -30,6 +32,7 @@ export const buttonVariants = cva({
|
|
|
30
32
|
sm: "h-8 gap-1.5 px-3 has-[>svg]:px-2.5",
|
|
31
33
|
lg: "h-10 px-6 has-[>svg]:px-4",
|
|
32
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",
|
|
33
36
|
none: "",
|
|
34
37
|
},
|
|
35
38
|
},
|
|
@@ -45,7 +48,7 @@ export const buttonVariants = cva({
|
|
|
45
48
|
export const BUTTON_DEFAULT_CLASS = buttonVariants({ variant: "default", size: "none" });
|
|
46
49
|
export const BUTTON_OUTLINE_CLASS = buttonVariants({ variant: "outline", size: "none" });
|
|
47
50
|
|
|
48
|
-
/*
|
|
49
|
-
*
|
|
51
|
+
/* Ghost icon button (copy buttons, small icon actions). Size and text color
|
|
52
|
+
* stay at the call site. */
|
|
50
53
|
export const ICON_BUTTON_CLASS =
|
|
51
|
-
"inline-flex shrink-0 cursor-pointer items-center justify-center rounded-
|
|
54
|
+
"inline-flex shrink-0 cursor-pointer items-center justify-center rounded-lg transition-glass duration-150 hover:bg-primary/10 active:scale-[0.97]";
|
package/src/lib/card-classes.ts
CHANGED
|
@@ -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)
|
|
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 =
|
|
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)
|
|
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 =
|
|
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 ${
|
|
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
|
package/src/lib/pill-classes.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
/* Small tinted things share the Badge material. A chip is a
|
|
2
|
-
*
|
|
1
|
+
/* Small tinted things share the Badge material. A chip is a glass pill at the
|
|
2
|
+
* theme's corner, so it squares off with a sharp theme (Badge, CountPill, scope
|
|
3
|
+
* chips); an icon pill is the square-ish glass
|
|
3
4
|
* well behind a glyph (SectionIcon, ItemMedia, EmptyMedia). Tone comes from the
|
|
4
5
|
* caller's --glass-tone (via Badge's style or a [--glass-tone:…] utility);
|
|
5
6
|
* neutral wells set none and read as foreground glass. */
|
|
6
7
|
export const CHIP =
|
|
7
|
-
"glass glass-tint inline-flex w-fit shrink-0 select-none items-center gap-1.5 whitespace-nowrap rounded-
|
|
8
|
+
"glass glass-tint inline-flex w-fit shrink-0 select-none items-center gap-1.5 whitespace-nowrap rounded-lg px-2.5 py-0.5 font-medium text-xs";
|
|
8
9
|
|
|
9
10
|
export const ICON_PILL =
|
|
10
11
|
"glass flex shrink-0 items-center justify-center [--glass-rim:0.4] [--glass-light:0.08] [--glass-base:color-mix(in_srgb,var(--foreground)_10%,transparent)]";
|
|
@@ -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
|
+
}
|
package/src/lib/thumb-classes.ts
CHANGED
|
@@ -11,6 +11,13 @@ export const THUMB_SIZE = 31;
|
|
|
11
11
|
export const THUMB_CLASS =
|
|
12
12
|
"block size-7 shrink-0 rounded-xl shadow-[0_2px_5px_oklch(0_0_0/0.35),inset_0_1px_0_oklch(1_0_0/0.35),inset_0_-2px_3px_oklch(0_0_0/0.2)]";
|
|
13
13
|
|
|
14
|
+
/* The lit knob wears the theme's hue at the depth theme.css sets per mode. The
|
|
15
|
+
* knob re-declares --thumb-face-on on itself with this value: a var() resolves
|
|
16
|
+
* where it is declared, so the :root one answers for the page only and a
|
|
17
|
+
* container that re-scopes --primary (a theme preview) would keep the page's. */
|
|
18
|
+
export const THUMB_FACE_ON =
|
|
19
|
+
"oklch(from var(--primary) var(--thumb-on-l) min(c, var(--thumb-on-c)) h)";
|
|
20
|
+
|
|
14
21
|
/* A rail pads by half a thumb so the knob stays inside the track at both ends;
|
|
15
22
|
* the fill cancels the same inset to reach the rounded edges. */
|
|
16
23
|
/* A thumb painted the live channel colour sits on a track of that same colour,
|
package/src/lib/tier-badge.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/* Metallic tier chip: 135deg brushed sweep, bright ends, dip in the middle. */
|
|
2
2
|
|
|
3
3
|
export const TIER_BADGE_CLASS =
|
|
4
|
-
"inline-flex cursor-default select-none items-center rounded-
|
|
4
|
+
"inline-flex cursor-default select-none items-center rounded-lg px-2 py-0.5 font-black text-[10px] tracking-wide";
|
|
5
5
|
|
|
6
6
|
/** Optional sweep shaping. Default is the symmetric brushed look (both ends
|
|
7
7
|
* `hi`, dipping to `lo` at the midpoint). The collectible/license golds are a
|
package/src/solid/button.tsx
CHANGED
|
@@ -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
|
-
|
|
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 };
|
package/src/solid/carousel.tsx
CHANGED
|
@@ -248,7 +248,7 @@ const CarouselPrevious: Component<ComponentProps<typeof Button>> = (props) => {
|
|
|
248
248
|
variant={local.variant ?? "outline"}
|
|
249
249
|
size={local.size ?? "icon"}
|
|
250
250
|
class={cn(
|
|
251
|
-
"absolute size-8
|
|
251
|
+
"absolute size-8",
|
|
252
252
|
orientation() === "horizontal"
|
|
253
253
|
? "top-1/2 -left-12 -translate-y-1/2"
|
|
254
254
|
: "-top-12 left-1/2 -translate-x-1/2 rotate-90",
|
|
@@ -274,7 +274,7 @@ const CarouselNext: Component<ComponentProps<typeof Button>> = (props) => {
|
|
|
274
274
|
variant={local.variant ?? "outline"}
|
|
275
275
|
size={local.size ?? "icon"}
|
|
276
276
|
class={cn(
|
|
277
|
-
"absolute size-8
|
|
277
|
+
"absolute size-8",
|
|
278
278
|
orientation() === "horizontal"
|
|
279
279
|
? "top-1/2 -right-12 -translate-y-1/2"
|
|
280
280
|
: "-bottom-12 left-1/2 -translate-x-1/2 rotate-90",
|
package/src/solid/data-table.tsx
CHANGED
|
@@ -293,8 +293,8 @@ export function TableSkeleton(props: { count?: number; class?: string }) {
|
|
|
293
293
|
class={cn("h-2.5", SKELETON_META_WIDTHS[i() % SKELETON_META_WIDTHS.length])}
|
|
294
294
|
/>
|
|
295
295
|
<div class="flex gap-1 pt-0.5 sm:hidden">
|
|
296
|
-
<Skeleton class="h-4 w-12 rounded-
|
|
297
|
-
<Skeleton class="h-4 w-16 rounded-
|
|
296
|
+
<Skeleton class="h-4 w-12 rounded-lg" />
|
|
297
|
+
<Skeleton class="h-4 w-16 rounded-lg" />
|
|
298
298
|
</div>
|
|
299
299
|
</div>
|
|
300
300
|
<Skeleton class="h-3 w-12 shrink-0" />
|
package/src/solid/dock.tsx
CHANGED
|
@@ -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, [
|
|
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-
|
|
72
|
-
local.
|
|
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, [
|
|
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
|
-
|
|
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
|
|
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={
|
|
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 =
|
|
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).
|
|
@@ -410,7 +410,7 @@ export function IconPicker(props: IconPickerProps) {
|
|
|
410
410
|
type="button"
|
|
411
411
|
aria-pressed={props.value === icon}
|
|
412
412
|
class={cn(
|
|
413
|
-
"mx-auto flex size-11 cursor-pointer items-center justify-center rounded-
|
|
413
|
+
"mx-auto flex size-11 cursor-pointer items-center justify-center rounded-lg transition-glass hover:bg-accent",
|
|
414
414
|
props.value === icon &&
|
|
415
415
|
`${ICON_PILL_TINT} text-foreground [--glass-tone:var(--primary)] hover:bg-transparent`,
|
|
416
416
|
)}
|
package/src/solid/index.ts
CHANGED
|
@@ -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,
|
package/src/solid/media-tile.tsx
CHANGED
|
@@ -85,7 +85,7 @@ export function MediaTile(props: MediaTileProps) {
|
|
|
85
85
|
data-slot="media-tile-delete"
|
|
86
86
|
// after:-inset-1.5 lifts the touch target to ~44px without growing the glyph or its scrim.
|
|
87
87
|
class={cn(
|
|
88
|
-
"absolute top-1 right-1 size-8
|
|
88
|
+
"absolute top-1 right-1 size-8 text-destructive hover:text-destructive",
|
|
89
89
|
"after:absolute after:-inset-1.5 after:content-['']",
|
|
90
90
|
SCRIM_CLASS,
|
|
91
91
|
)}
|