@glasshome/ui 1.24.0 → 1.25.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 +40 -12
- package/dist/index.d.ts +1 -1
- package/dist/index.js +3 -3
- package/dist/lib/card-classes.d.ts +4 -4
- package/dist/lib/input-classes.d.ts +1 -0
- package/dist/lib/overlay-classes.d.ts +2 -2
- package/dist/lib/position-bar-classes.d.ts +1 -1
- package/dist/lib/thumb-classes.d.ts +0 -1
- package/dist/solid/index.js +339 -339
- package/dist/solid/sliding-indicator.d.ts +1 -1
- package/dist/solid/toggle-group.d.ts +1 -1
- package/dist/tokens/index.js +201 -101
- package/dist/tokens/material.d.ts +53 -8
- package/dist/{utils-rZf2Zpkw.js → utils-Sl2ceVna.js} +23 -23
- package/package.json +1 -1
- package/src/index.ts +1 -0
- package/src/lib/button-variants.ts +1 -1
- package/src/lib/card-classes.ts +2 -2
- package/src/lib/input-classes.ts +5 -0
- package/src/lib/overlay-classes.ts +1 -1
- package/src/lib/position-bar-classes.ts +1 -1
- package/src/lib/thumb-classes.ts +0 -7
- package/src/solid/checkbox.tsx +1 -1
- package/src/solid/slider.tsx +5 -3
- package/src/solid/sliding-indicator.tsx +2 -2
- package/src/solid/switch.tsx +5 -7
- package/src/solid/tabs.tsx +1 -1
- package/src/solid/toggle-group.tsx +3 -3
- package/src/solid/toggle.tsx +1 -1
- package/src/styles/globals.css +237 -21
- package/src/styles/theme.css +27 -14
- package/src/tokens/material.ts +215 -41
|
@@ -126,7 +126,7 @@ var g = (e) => typeof e == "boolean" ? `${e}` : e === 0 ? "0" : e, _ = [], { com
|
|
|
126
126
|
base: "transition-glass focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 inline-flex shrink-0 cursor-pointer items-center justify-center gap-2 rounded-lg text-sm font-medium whitespace-nowrap outline-none focus-visible:ring-[3px] active:scale-[0.97] disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
127
127
|
variants: {
|
|
128
128
|
variant: {
|
|
129
|
-
default: `glass glass-tint ${b} [--glass-text:0%] [--glass-tone:var(--
|
|
129
|
+
default: `glass glass-tint ${b} [--glass-text:0%] [--glass-tone:var(--material-accent)] [--glass-wash:55%] hover:[--glass-edge:color-mix(in_srgb,var(--material-accent)_60%,transparent)] hover:[--glass-wash:65%] dark:[color:oklch(from_var(--glass-tone)_calc((0.74_-_l)*100)_0_0)] dark:[--glass-tone:oklch(from_var(--material-accent)_calc(l_+_clamp(0,(l_-_0.74)*10,0.1))_c_h)] dark:[--glass-wash:62%] dark:hover:[--glass-wash:70%]`,
|
|
130
130
|
destructive: `glass glass-tint ${b} focus-visible:ring-destructive/30 [--glass-text:0%] [--glass-tone:var(--destructive)] [--glass-wash:55%] hover:[--glass-edge:color-mix(in_srgb,var(--destructive)_60%,transparent)] hover:[--glass-wash:65%] dark:[color:oklch(from_var(--glass-tone)_calc((0.74_-_l)*100)_0_0)] dark:[--glass-tone:oklch(from_var(--destructive)_calc(l_+_clamp(0,(l_-_0.74)*10,0.1))_c_h)] dark:[--glass-wash:62%] dark:hover:[--glass-wash:70%]`,
|
|
131
131
|
secondary: `glass glass-tint ${b} [--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:[color:oklch(from_var(--glass-tone)_calc((0.74_-_l)*100)_0_0)] dark:[--glass-tone:oklch(from_var(--accent)_calc(l_+_clamp(0,(l_-_0.74)*10,0.1))_c_h)] dark:[--glass-wash:62%] dark:hover:[--glass-wash:70%]`,
|
|
132
132
|
outline: x,
|
|
@@ -152,33 +152,33 @@ var g = (e) => typeof e == "boolean" ? `${e}` : e === 0 ? "0" : e, _ = [], { com
|
|
|
152
152
|
}), ne = S({
|
|
153
153
|
variant: "outline",
|
|
154
154
|
size: "none"
|
|
155
|
-
}), re = "inline-flex shrink-0 cursor-pointer items-center justify-center rounded-lg transition-glass duration-150 hover:bg-primary/10 active:scale-[0.97]", w = "data-[expanded]:animate-in data-[expanded]:duration-(--duration-expand) data-[expanded]:ease-(--ease-expand)", T = "data-[closed]:animate-out data-[closed]:duration-(--duration-micro) data-[closed]:ease-(--ease-contract)", ie = `origin-(--kb-popper-content-transform-origin) ${w} data-[expanded]:fade-in-0 data-[expanded]:zoom-in-90 ${T} data-[closed]:fade-out-0 data-[closed]:zoom-out-95`, E = "data-[closed]:animate-select-out data-[expanded]:animate-select-in", D = "[--morph-w:var(--kb-popper-anchor-width)] min-w-[var(--kb-popper-anchor-width)] data-[expanded]:animate-morph-in data-[closed]:animate-morph-out", O = "data-[expanded]:animate-anchored-in data-[closed]:animate-morph-out", k = "gh-stagger", A = `${w} data-[expanded]:fade-in-0 data-[expanded]:zoom-in-[0.94] data-[expanded]:slide-in-from-bottom-2 ${T} data-[closed]:fade-out-0 data-[closed]:zoom-out-[0.96]`, j = `${w} data-[expanded]:fade-in-0 ${T} data-[closed]:fade-out-0`, ae = "animate-in fade-in-0 slide-in-from-bottom-1 duration-(--duration-state) ease-(--ease-expand)", oe = "active:scale-[0.97]", se = "scale-0 opacity-0 transition-[scale,opacity] duration-(--duration-state) ease-(--ease-contract) data-[hold]:scale-100 data-[hold]:opacity-100 data-[hold]:duration-(--duration-hold) data-[hold]:ease-linear data-[fired]:scale-100 data-[fired]:opacity-0", ce = "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", M = "transition-[translate,clip-path] duration-(--duration-morph) ease-(--ease-expand)", N = "glass [--glass-wash:20%] [--glass-rim:0.3] [--glass-lift:0.45] [--glass-shade:0.05] dark:[--glass-shade:0]", P = `${N} [--glass-base:color-mix(in_srgb,var(--card)_var(--material-clarity),transparent)]`, le = "backdrop-blur-[var(--glass-blur,var(--material-blur,24px))] backdrop-saturate-[1.8]", F = `${P} ${le}`, ue = N, I = "glass [--glass-rim:0.3] [--glass-base:color-mix(in_srgb,var(--card)_var(--material-clarity),transparent)]", L = "border border-border/50 bg-card/40 backdrop-blur-sm", R = {
|
|
155
|
+
}), re = "inline-flex shrink-0 cursor-pointer items-center justify-center rounded-lg transition-glass duration-150 hover:bg-primary/10 active:scale-[0.97]", w = "data-[expanded]:animate-in data-[expanded]:duration-(--duration-expand) data-[expanded]:ease-(--ease-expand)", T = "data-[closed]:animate-out data-[closed]:duration-(--duration-micro) data-[closed]:ease-(--ease-contract)", ie = `origin-(--kb-popper-content-transform-origin) ${w} data-[expanded]:fade-in-0 data-[expanded]:zoom-in-90 ${T} data-[closed]:fade-out-0 data-[closed]:zoom-out-95`, E = "data-[closed]:animate-select-out data-[expanded]:animate-select-in", D = "[--morph-w:var(--kb-popper-anchor-width)] min-w-[var(--kb-popper-anchor-width)] data-[expanded]:animate-morph-in data-[closed]:animate-morph-out", O = "data-[expanded]:animate-anchored-in data-[closed]:animate-morph-out", k = "gh-stagger", A = `${w} data-[expanded]:fade-in-0 data-[expanded]:zoom-in-[0.94] data-[expanded]:slide-in-from-bottom-2 ${T} data-[closed]:fade-out-0 data-[closed]:zoom-out-[0.96]`, j = `${w} data-[expanded]:fade-in-0 ${T} data-[closed]:fade-out-0`, ae = "animate-in fade-in-0 slide-in-from-bottom-1 duration-(--duration-state) ease-(--ease-expand)", oe = "active:scale-[0.97]", se = "scale-0 opacity-0 transition-[scale,opacity] duration-(--duration-state) ease-(--ease-contract) data-[hold]:scale-100 data-[hold]:opacity-100 data-[hold]:duration-(--duration-hold) data-[hold]:ease-linear data-[fired]:scale-100 data-[fired]:opacity-0", ce = "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", M = "transition-[translate,clip-path] duration-(--duration-morph) ease-(--ease-expand)", N = "glass [--glass-grain:var(--_material-grain)] [--glass-wash:20%] [--glass-rim:0.3] [--glass-lift:0.45] [--glass-shade:0.05] dark:[--glass-shade:0]", P = `${N} [--glass-base:color-mix(in_srgb,var(--card)_var(--material-clarity),transparent)]`, le = "backdrop-blur-[var(--glass-blur,var(--material-blur,24px))] backdrop-saturate-[calc(1.8*var(--_material-vibrancy,1))] backdrop-brightness-[calc(1+(var(--_material-vibrancy,1)-1)*0.2)]", F = `${P} ${le}`, ue = N, I = "glass [--glass-rim:0.3] [--glass-base:color-mix(in_srgb,var(--card)_var(--material-clarity),transparent)]", L = "border border-border/50 bg-card/40 backdrop-blur-sm", R = {
|
|
156
156
|
slots: "flex flex-col gap-3 p-3 md:gap-4 md:p-4",
|
|
157
157
|
md: "flex flex-col gap-3 p-4",
|
|
158
158
|
sm: "flex flex-col gap-2 p-3",
|
|
159
159
|
none: ""
|
|
160
|
-
}, z = "cursor-pointer transition-glass hover:[--glass-light:0.09] focus-within:[--glass-edge:var(--border)]", de = `${z} ${oe} outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50 has-[:focus-visible]:ring-[3px] has-[:focus-visible]:ring-ring/50`, fe = "@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-1.5 has-data-[slot=card-action]:grid-cols-[1fr_auto]", pe = "font-semibold leading-none", me = "text-muted-foreground text-sm", he = "col-start-2 row-span-2 row-start-1 self-start justify-self-end", ge = "min-w-0", _e = "flex items-center", ve = "glass glass-sink [--glass-base:var(--field)] [--glass-edge:var(--field-edge)] [--glass-light:0.04]", ye = "glass glass-sink [--glass-base:var(--input)] [--glass-light:0.04]", be = "outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:[--glass-edge:var(--ring)]",
|
|
160
|
+
}, z = "cursor-pointer transition-glass hover:[--glass-light:0.09] focus-within:[--glass-edge:var(--border)]", de = `${z} ${oe} outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50 has-[:focus-visible]:ring-[3px] has-[:focus-visible]:ring-ring/50`, fe = "@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-1.5 has-data-[slot=card-action]:grid-cols-[1fr_auto]", pe = "font-semibold leading-none", me = "text-muted-foreground text-sm", he = "col-start-2 row-span-2 row-start-1 self-start justify-self-end", ge = "min-w-0", _e = "flex items-center", ve = "glass glass-sink [--glass-base:var(--field)] [--glass-edge:var(--field-edge)] [--glass-light:0.04]", ye = "glass glass-sink [--glass-base:var(--input)] [--glass-light:0.04]", be = "glass glass-tint [--glass-tone:var(--material-accent)] [--glass-wash:100%] [--glass-text:0%]", xe = "outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:[--glass-edge:var(--ring)]", Se = "aria-invalid:[--glass-edge:var(--destructive)] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40", B = {
|
|
161
161
|
sm: "h-8",
|
|
162
162
|
default: "h-9",
|
|
163
163
|
lg: "h-10"
|
|
164
|
-
},
|
|
165
|
-
function
|
|
164
|
+
}, Ce = "text-base md:text-sm", we = `flex w-full min-w-0 rounded-md ${ve} px-3 ${Ce} transition-[color,box-shadow] placeholder:text-muted-foreground disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 ${xe} ${Se}`, Te = `${we} ${B.default} py-1 selection:bg-primary selection:text-primary-foreground file:inline-flex file:h-7 file:border-0 file:bg-transparent file:font-medium file:text-foreground file:text-sm`, Ee = `${ye} h-1.5 rounded-full transition-glass duration-(--duration-morph) ease-(--ease-morph)`, De = "glass glass-tint [--glass-tone:var(--material-accent)] [--glass-wash:70%] [--glass-drop:0%]", Oe = "h-full overflow-hidden";
|
|
165
|
+
function ke(e, t = "horizontal") {
|
|
166
166
|
if (e === "wipe") return "carousel-stack";
|
|
167
167
|
let n = t === "vertical";
|
|
168
168
|
return e === "fade" ? n ? "flex flex-col" : "flex" : `flex ${n ? "-mt-4 flex-col" : "-ml-4"}`;
|
|
169
169
|
}
|
|
170
|
-
function
|
|
170
|
+
function Ae(e, t = "horizontal") {
|
|
171
171
|
if (e === "wipe") return "min-w-0 carousel-wipe";
|
|
172
172
|
let n = "min-w-0 shrink-0 grow-0 basis-full";
|
|
173
173
|
return e === "fade" ? n : `${n} ${t === "horizontal" ? "pl-4" : "pt-4"}`;
|
|
174
174
|
}
|
|
175
|
-
var
|
|
176
|
-
function
|
|
177
|
-
return `${
|
|
175
|
+
var je = "flex items-center justify-center gap-2";
|
|
176
|
+
function Me(e) {
|
|
177
|
+
return `${Ee} ${e ? `w-6 ${De}` : "w-2.5 hover:[--glass-light:0.12]"}`;
|
|
178
178
|
}
|
|
179
179
|
//#endregion
|
|
180
180
|
//#region src/lib/glass-tone.ts
|
|
181
|
-
var
|
|
181
|
+
var Ne = {
|
|
182
182
|
"var(--primary)": .48,
|
|
183
183
|
"var(--accent)": .6,
|
|
184
184
|
"var(--success)": .68,
|
|
@@ -186,24 +186,24 @@ var Me = {
|
|
|
186
186
|
"var(--destructive)": .66,
|
|
187
187
|
"var(--muted-foreground)": .55
|
|
188
188
|
};
|
|
189
|
-
function
|
|
190
|
-
let t =
|
|
189
|
+
function Pe(e) {
|
|
190
|
+
let t = Ne[e], n = e.match(/oklch\(\s*([0-9.]+)/)?.[1];
|
|
191
191
|
return Math.min(70, Math.max(46, Math.round(71 - ((t ?? (n ? Number.parseFloat(n) : .6)) - .5) * 60)));
|
|
192
192
|
}
|
|
193
|
-
function
|
|
194
|
-
return `color-mix(in oklab, ${e} ${
|
|
193
|
+
function Fe(e) {
|
|
194
|
+
return `color-mix(in oklab, ${e} ${Pe(e)}%, var(--foreground))`;
|
|
195
195
|
}
|
|
196
|
-
var
|
|
196
|
+
var Ie = "var(--muted-foreground)", Le = "[--glass-wash:12%]", Re = (e) => e === Ie, ze = {
|
|
197
197
|
sheet: 40,
|
|
198
198
|
overlay: 50
|
|
199
|
-
},
|
|
199
|
+
}, Be = {
|
|
200
200
|
sheet: "z-40",
|
|
201
201
|
overlay: "z-50"
|
|
202
|
-
},
|
|
202
|
+
}, Ve = "/assets/glasshome_logo.png", He = "Dash", Ue = "md", We = {
|
|
203
203
|
sm: 32,
|
|
204
204
|
md: 48,
|
|
205
205
|
lg: 64
|
|
206
|
-
},
|
|
206
|
+
}, Ge = {
|
|
207
207
|
sm: {
|
|
208
208
|
mark: "h-8 w-8",
|
|
209
209
|
name: "text-xs",
|
|
@@ -222,9 +222,9 @@ var Fe = "var(--muted-foreground)", Ie = "[--glass-wash:12%]", Le = (e) => e ===
|
|
|
222
222
|
sub: "text-3xl",
|
|
223
223
|
gap: "gap-2"
|
|
224
224
|
}
|
|
225
|
-
},
|
|
226
|
-
`${
|
|
227
|
-
var
|
|
225
|
+
}, Ke = "inline-flex items-end", qe = "flex flex-col gap-0.5", Je = "shrink-0", Ye = "whitespace-nowrap font-bold leading-none tracking-tight", Xe = "font-bold text-primary uppercase leading-none tracking-[0.18em]", Ze = "relative flex cursor-default select-none items-center gap-2 rounded-sm py-1.5 text-sm outline-hidden transition-colors data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg:not([class*='size-'])]:size-4 [&:not([data-tone])_svg:not([class*='text-'])]:text-muted-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&>[data-slot=icon]]:shrink-0 [&>[data-slot=icon]]:text-[16px]", Qe = "px-2", $e = `${Ze} ${Qe}`, et = "px-2 py-1.5 font-medium text-muted-foreground text-xs", tt = "-mx-1 my-1 h-px bg-border", nt = 350, rt = 100, it = "glass glass-frost [--glass-rim:0.5] [--glass-lift:0.6] [--glass-light:0] [--glass-edge:color-mix(in_srgb,var(--border)_90%,transparent)]", at = "backdrop-blur-[var(--glass-blur,var(--material-blur,24px))] backdrop-saturate-[calc(1.2*var(--_material-vibrancy,1))] backdrop-brightness-[calc(1+(var(--_material-vibrancy,1)-1)*0.2)]", ot = `${it} [--glass-base:color-mix(in_srgb,var(--popover)_92%,transparent)]`, st = `${ot} ${at}`, ct = `${it} [--glass-base:var(--popover)]`, lt = "bg-scrim backdrop-blur-md", ut = `${Be.overlay} rounded-md text-popover-foreground outline-hidden`;
|
|
226
|
+
`${st}${ut}`;
|
|
227
|
+
var dt = `${st} relative ${ut}`, ft = (e) => {
|
|
228
228
|
let t = e?.getBoundingClientRect();
|
|
229
229
|
return t ? {
|
|
230
230
|
x: t.left,
|
|
@@ -237,7 +237,7 @@ var ut = `${ot} relative ${lt}`, dt = (e) => {
|
|
|
237
237
|
width: 0,
|
|
238
238
|
height: 0
|
|
239
239
|
};
|
|
240
|
-
},
|
|
240
|
+
}, pt = `${we} ${B.default} items-center justify-between gap-2 text-left hover:[--glass-light:0.09] disabled:hover:[--glass-light:0.04] data-[expanded]:ring-0 data-[expanded]:[--glass-edge:transparent] data-[expanded]:focus-visible:ring-0 data-[expanded]:focus-visible:[--glass-edge:transparent]`, mt = "max-h-[min(70vh,400px)] overflow-y-auto gh-scroll", ht = "h-11", gt = "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", _t = "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)]", vt = "glass glass-tint flex shrink-0 items-center justify-center [--glass-rim:0.4] [--glass-wash:18%]", yt = "rounded-[var(--radius)]", bt = "rounded-[max(0px,calc(var(--radius)-var(--spacing)*3))]", xt = "p-3", St = `${`${bt} border border-border/60 bg-card/60`} p-3`, Ct = `inline-flex items-center justify-center gap-1.5 whitespace-nowrap rounded-md ${B.sm} px-3 font-medium text-sm outline-none transition-glass active:scale-[0.97] disabled:pointer-events-none disabled:opacity-50 ${xe}`, wt = 31, Tt = "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)]", Et = "border-2 border-white/90", Dt = "px-3.5", Ot = "-mx-3.5", kt = 640, At = /* @__PURE__ */ new Map();
|
|
241
241
|
function jt(t = 640) {
|
|
242
242
|
if (typeof window > "u") return () => void 0;
|
|
243
243
|
let n = At.get(t);
|
|
@@ -1966,4 +1966,4 @@ function Jn(...e) {
|
|
|
1966
1966
|
return qn(h(e));
|
|
1967
1967
|
}
|
|
1968
1968
|
//#endregion
|
|
1969
|
-
export {
|
|
1969
|
+
export { Me as $, f as $t, $e as A, se as At, Ye as B, C as Bt, ot as C, ue as Ct, ft as D, L as Dt, lt as E, I as Et, Ue as F, ce as Ft, ze as G, y as Gt, Ge as H, re as Ht, Ve as I, j as It, Fe as J, p as Jt, Be as K, o as Kt, He as L, ae as Lt, Qe as M, D as Mt, et as N, ie as Nt, rt as O, O as Ot, tt as P, oe as Pt, Oe as Q, d as Qt, Je as R, k as Rt, st as S, P as St, ut as T, de as Tt, qe as U, x as Ut, Ke as V, ne as Vt, Xe as W, S as Wt, Pe as X, s as Xt, Re as Y, c as Yt, je as Z, n as Zt, ht as _, _e as _t, Et as a, l as an, be as at, dt as b, R as bt, wt as c, Ce as ct, yt as d, ve as dt, t as en, Ae as et, xt as f, Se as ft, vt as g, me as gt, _t as h, ge as ht, Tt as i, a as in, B as it, Ze as j, A as jt, nt as k, E as kt, Ct as l, xe as lt, gt as m, le as mt, kt as n, i as nn, Ee as nt, Ot as o, ye as ot, St as p, he as pt, Le as q, ee as qt, jt as r, u as rn, De as rt, Dt as s, we as st, Jn as t, r as tn, ke as tt, bt as u, Te as ut, mt as v, fe as vt, ct as w, pe as wt, at as x, F as xt, pt as y, z as yt, We as z, M as zt };
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -20,7 +20,7 @@ export const buttonVariants = cva({
|
|
|
20
20
|
base: "transition-glass focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 inline-flex shrink-0 cursor-pointer items-center justify-center gap-2 rounded-lg text-sm font-medium whitespace-nowrap outline-none focus-visible:ring-[3px] active:scale-[0.97] disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
21
21
|
variants: {
|
|
22
22
|
variant: {
|
|
23
|
-
default: `glass glass-tint ${CONTROL_GLASS} [--glass-text:0%] [--glass-tone:var(--
|
|
23
|
+
default: `glass glass-tint ${CONTROL_GLASS} [--glass-text:0%] [--glass-tone:var(--material-accent)] [--glass-wash:55%] hover:[--glass-edge:color-mix(in_srgb,var(--material-accent)_60%,transparent)] hover:[--glass-wash:65%] dark:[color:oklch(from_var(--glass-tone)_calc((0.74_-_l)*100)_0_0)] dark:[--glass-tone:oklch(from_var(--material-accent)_calc(l_+_clamp(0,(l_-_0.74)*10,0.1))_c_h)] dark:[--glass-wash:62%] dark:hover:[--glass-wash:70%]`,
|
|
24
24
|
destructive: `glass glass-tint ${CONTROL_GLASS} focus-visible:ring-destructive/30 [--glass-text:0%] [--glass-tone:var(--destructive)] [--glass-wash:55%] hover:[--glass-edge:color-mix(in_srgb,var(--destructive)_60%,transparent)] hover:[--glass-wash:65%] dark:[color:oklch(from_var(--glass-tone)_calc((0.74_-_l)*100)_0_0)] dark:[--glass-tone:oklch(from_var(--destructive)_calc(l_+_clamp(0,(l_-_0.74)*10,0.1))_c_h)] dark:[--glass-wash:62%] dark:hover:[--glass-wash:70%]`,
|
|
25
25
|
secondary: `glass glass-tint ${CONTROL_GLASS} [--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:[color:oklch(from_var(--glass-tone)_calc((0.74_-_l)*100)_0_0)] dark:[--glass-tone:oklch(from_var(--accent)_calc(l_+_clamp(0,(l_-_0.74)*10,0.1))_c_h)] dark:[--glass-wash:62%] dark:hover:[--glass-wash:70%]`,
|
|
26
26
|
outline: OUTLINE_SURFACE,
|
package/src/lib/card-classes.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { PRESS_DIP } from "./motion-classes.js";
|
|
2
2
|
|
|
3
3
|
const CARD_KNOBS =
|
|
4
|
-
"glass [--glass-wash:20%] [--glass-rim:0.3] [--glass-lift:0.45] [--glass-shade:0.05] dark:[--glass-shade:0]";
|
|
4
|
+
"glass [--glass-grain:var(--_material-grain)] [--glass-wash:20%] [--glass-rim:0.3] [--glass-lift:0.45] [--glass-shade:0.05] dark:[--glass-shade:0]";
|
|
5
5
|
|
|
6
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
10
|
export const CARD_BLUR =
|
|
11
|
-
"backdrop-blur-[var(--glass-blur,var(--material-blur,24px))] backdrop-saturate-[1.8]";
|
|
11
|
+
"backdrop-blur-[var(--glass-blur,var(--material-blur,24px))] backdrop-saturate-[calc(1.8*var(--_material-vibrancy,1))] backdrop-brightness-[calc(1+(var(--_material-vibrancy,1)-1)*0.2)]";
|
|
12
12
|
|
|
13
13
|
export const CARD_SURFACE = `${CARD_SURFACE_BASE} ${CARD_BLUR}`;
|
|
14
14
|
|
package/src/lib/input-classes.ts
CHANGED
|
@@ -17,6 +17,11 @@ export const INPUT_SURFACE =
|
|
|
17
17
|
* in the light theme. */
|
|
18
18
|
export const FIELD_CHROME = "glass glass-sink [--glass-base:var(--input)] [--glass-light:0.04]";
|
|
19
19
|
|
|
20
|
+
/* A control that is on: the material's accent, strong enough to carry the state
|
|
21
|
+
* on its own, so the knob riding it can stay plain. */
|
|
22
|
+
export const CONTROL_ON =
|
|
23
|
+
"glass glass-tint [--glass-tone:var(--material-accent)] [--glass-wash:100%] [--glass-text:0%]";
|
|
24
|
+
|
|
20
25
|
/* Focus on a glass element: border utilities are no-ops there, so the edge
|
|
21
26
|
* moves through the knob and the ring paints outside. */
|
|
22
27
|
export const FOCUS_RING =
|
|
@@ -9,7 +9,7 @@ const OVERLAY_KNOBS =
|
|
|
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
11
|
export const OVERLAY_BLUR =
|
|
12
|
-
"backdrop-blur-[var(--glass-blur,var(--material-blur,24px))] backdrop-saturate-[1.2]";
|
|
12
|
+
"backdrop-blur-[var(--glass-blur,var(--material-blur,24px))] backdrop-saturate-[calc(1.2*var(--_material-vibrancy,1))] backdrop-brightness-[calc(1+(var(--_material-vibrancy,1)-1)*0.2)]";
|
|
13
13
|
|
|
14
14
|
export const OVERLAY_SURFACE_BASE = `${OVERLAY_KNOBS} [--glass-base:color-mix(in_srgb,var(--popover)_92%,transparent)]`;
|
|
15
15
|
|
|
@@ -7,4 +7,4 @@ import { FIELD_CHROME } from "./input-classes.js";
|
|
|
7
7
|
export const POSITION_BAR = `${FIELD_CHROME} h-1.5 rounded-full transition-glass duration-(--duration-morph) ease-(--ease-morph)`;
|
|
8
8
|
|
|
9
9
|
export const POSITION_BAR_LIT =
|
|
10
|
-
"glass glass-tint [--glass-tone:var(--
|
|
10
|
+
"glass glass-tint [--glass-tone:var(--material-accent)] [--glass-wash:70%] [--glass-drop:0%]";
|
package/src/lib/thumb-classes.ts
CHANGED
|
@@ -11,13 +11,6 @@ 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
|
-
|
|
21
14
|
/* A rail pads by half a thumb so the knob stays inside the track at both ends;
|
|
22
15
|
* the fill cancels the same inset to reach the rounded edges. */
|
|
23
16
|
/* A thumb painted the live channel colour sits on a track of that same colour,
|
package/src/solid/checkbox.tsx
CHANGED
|
@@ -38,7 +38,7 @@ const Checkbox: Component<ComponentProps<typeof CheckboxPrimitive> & { size?: Ch
|
|
|
38
38
|
size().box,
|
|
39
39
|
"peer-focus-visible:ring-ring/50 peer-focus-visible:ring-[3px] peer-focus-visible:[--glass-edge:var(--ring)]",
|
|
40
40
|
state.checked()
|
|
41
|
-
? "glass glass-tint text-foreground [--glass-tone:var(--
|
|
41
|
+
? "glass glass-tint text-foreground [--glass-tone:var(--material-accent)]"
|
|
42
42
|
: FIELD_CHROME,
|
|
43
43
|
props.disabled && "cursor-not-allowed opacity-40",
|
|
44
44
|
local.class,
|
package/src/solid/slider.tsx
CHANGED
|
@@ -94,7 +94,7 @@ const Slider: Component<SliderProps> = (props) => {
|
|
|
94
94
|
class={cn(
|
|
95
95
|
// The fill sits sunk inside the recessed rail: the tinted-surface
|
|
96
96
|
// outer drop shadow would read as a halo leaking out of the groove.
|
|
97
|
-
"glass glass-tint absolute inset-y-0 rounded-xl [--glass-drop:0%]",
|
|
97
|
+
"glass glass-tint absolute inset-y-0 rounded-xl [--glass-drop:0%] [--glass-wash:90%]",
|
|
98
98
|
THUMB_RAIL_BLEED,
|
|
99
99
|
Array.isArray(local.fillTone) && "glass-edge-gradient",
|
|
100
100
|
)}
|
|
@@ -106,7 +106,7 @@ const Slider: Component<SliderProps> = (props) => {
|
|
|
106
106
|
"--glass-wash-2": "var(--glass-wash)",
|
|
107
107
|
"--glass-wash-angle": "90deg",
|
|
108
108
|
}
|
|
109
|
-
: { "--glass-tone": local.fillTone ?? "var(--
|
|
109
|
+
: { "--glass-tone": local.fillTone ?? "var(--material-accent)" }
|
|
110
110
|
}
|
|
111
111
|
/>
|
|
112
112
|
<Index each={local.markers ?? []}>
|
|
@@ -134,7 +134,9 @@ const Slider: Component<SliderProps> = (props) => {
|
|
|
134
134
|
)}
|
|
135
135
|
aria-label={local["aria-label"]}
|
|
136
136
|
aria-labelledby={local["aria-labelledby"]}
|
|
137
|
-
style={{
|
|
137
|
+
style={{
|
|
138
|
+
background: local.thumbColors?.[thumbIndex] ?? "var(--material-control-knob)",
|
|
139
|
+
}}
|
|
138
140
|
>
|
|
139
141
|
<KSlider.Input />
|
|
140
142
|
</KSlider.Thumb>
|
|
@@ -40,7 +40,7 @@ interface SlidingIndicatorProps extends ComponentProps<"div"> {
|
|
|
40
40
|
* this can't flatten the indicator; it only tunes it. Default radius: `rounded-lg`. */
|
|
41
41
|
indicatorClass?: string;
|
|
42
42
|
/** Glass tone that drives the `.glass` material (`--glass-tone`). Defaults to
|
|
43
|
-
* `var(--
|
|
43
|
+
* `var(--material-accent)`, the theme accent unless the material sets its own. Pass another CSS color to re-tint. */
|
|
44
44
|
indicatorTone?: string;
|
|
45
45
|
/** Selector for the measurable items. Default: direct children (minus the indicator). */
|
|
46
46
|
itemSelector?: string;
|
|
@@ -306,7 +306,7 @@ export function SlidingIndicator(props: SlidingIndicatorProps) {
|
|
|
306
306
|
transition: sliding()
|
|
307
307
|
? `transform ${SLIDE_MS}ms ease-in-out, width ${SLIDE_MS}ms ease-in-out, height ${SLIDE_MS}ms ease-in-out`
|
|
308
308
|
: "none",
|
|
309
|
-
"--glass-tone": local.indicatorTone ?? "var(--
|
|
309
|
+
"--glass-tone": local.indicatorTone ?? "var(--material-accent)",
|
|
310
310
|
...(local.wrapped && horizontal()
|
|
311
311
|
? {
|
|
312
312
|
transform: `translate(${p().offset}px, ${p().crossOffset}px)`,
|
package/src/solid/switch.tsx
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type Component, type ComponentProps, createSignal, splitProps } from "solid-js";
|
|
2
|
-
import { FIELD_CHROME, FOCUS_RING } from "../lib/input-classes.js";
|
|
3
|
-
import { THUMB_CLASS
|
|
2
|
+
import { CONTROL_ON, FIELD_CHROME, FOCUS_RING } from "../lib/input-classes.js";
|
|
3
|
+
import { THUMB_CLASS } from "../lib/thumb-classes.js";
|
|
4
4
|
import { cn } from "../lib/utils.js";
|
|
5
5
|
|
|
6
6
|
type SwitchProps = Omit<ComponentProps<"button">, "onChange" | "children"> & {
|
|
@@ -35,7 +35,7 @@ const Switch: Component<SwitchProps> = (props) => {
|
|
|
35
35
|
// the slider rail; checked matches the slider fill. A `border-input`
|
|
36
36
|
// utility here would beat `:where(.glass)` and flatten the rim.
|
|
37
37
|
`group/switch peer transition-glass relative inline-flex h-7 w-14 shrink-0 cursor-pointer items-center rounded-xl duration-200 ease-out disabled:cursor-not-allowed disabled:opacity-50 ${FOCUS_RING}`,
|
|
38
|
-
checked() ?
|
|
38
|
+
checked() ? CONTROL_ON : FIELD_CHROME,
|
|
39
39
|
local.class,
|
|
40
40
|
)}
|
|
41
41
|
onClick={() => {
|
|
@@ -50,11 +50,9 @@ const Switch: Component<SwitchProps> = (props) => {
|
|
|
50
50
|
THUMB_CLASS,
|
|
51
51
|
"pointer-events-none transition-transform duration-300 [transition-timing-function:cubic-bezier(0.34,1.56,0.64,1)] group-data-[checked]/switch:translate-x-full",
|
|
52
52
|
)}
|
|
53
|
-
// Off must read quieter than on: the knob dims with the track
|
|
54
|
-
// than staying one bright material in both states.
|
|
53
|
+
// Off must read quieter than on: the knob dims with the track.
|
|
55
54
|
style={{
|
|
56
|
-
"--thumb-face-
|
|
57
|
-
background: checked() ? "var(--thumb-face-on)" : "var(--thumb-face-off)",
|
|
55
|
+
background: checked() ? "var(--material-control-knob)" : "var(--thumb-face-off)",
|
|
58
56
|
}}
|
|
59
57
|
/>
|
|
60
58
|
{local.name && <input type="hidden" name={local.name} value={checked() ? "on" : "off"} />}
|
package/src/solid/tabs.tsx
CHANGED
|
@@ -97,7 +97,7 @@ const TabsTrigger: Component<ComponentProps<typeof TabsPrimitive.Trigger> & { ic
|
|
|
97
97
|
class={cn(
|
|
98
98
|
SEGMENT_ITEM,
|
|
99
99
|
PRESS_DIP,
|
|
100
|
-
"hover:text-
|
|
100
|
+
"hover:text-(--material-accent)/80 data-[selected]:text-(--material-accent)",
|
|
101
101
|
local.icon && "h-auto flex-1 flex-col gap-1 py-2 text-xs",
|
|
102
102
|
local.class,
|
|
103
103
|
)}
|
|
@@ -29,7 +29,7 @@ const ToggleGroupContext = createContext<ToggleGroupContextValue>({
|
|
|
29
29
|
const ToggleGroup: ParentComponent<
|
|
30
30
|
ComponentProps<typeof ToggleGroupPrimitive> &
|
|
31
31
|
VariantProps<typeof toggleVariants> & {
|
|
32
|
-
/** CSS colour for the selected segment's glass. Default `var(--
|
|
32
|
+
/** CSS colour for the selected segment's glass. Default `var(--material-accent)`. */
|
|
33
33
|
tone?: string;
|
|
34
34
|
/** One row that scrolls sideways when it outgrows its container, instead of wrapping. */
|
|
35
35
|
scroll?: boolean;
|
|
@@ -109,8 +109,8 @@ const ToggleGroupItem: Component<
|
|
|
109
109
|
// its own neutral fill; hover still tints text only, since a fill there
|
|
110
110
|
// would read as a second, squarer selection.
|
|
111
111
|
context.sliding
|
|
112
|
-
? "hover:text-
|
|
113
|
-
: "
|
|
112
|
+
? "hover:text-(--material-accent)"
|
|
113
|
+
: "data-[pressed]:bg-muted data-[pressed]:text-foreground not-data-[pressed]:hover:text-(--material-accent)",
|
|
114
114
|
local.class,
|
|
115
115
|
)}
|
|
116
116
|
{...rest}
|
package/src/solid/toggle.tsx
CHANGED
|
@@ -46,7 +46,7 @@ const Toggle: Component<
|
|
|
46
46
|
class={cn(
|
|
47
47
|
toggleVariants({ variant: local.variant, size: local.size }),
|
|
48
48
|
TOGGLE_HOVER[local.variant ?? "default"],
|
|
49
|
-
"data-[pressed]:glass data-[pressed]:[--glass-tone:var(--
|
|
49
|
+
"data-[pressed]:glass data-[pressed]:[--glass-tone:var(--material-accent)]",
|
|
50
50
|
local.class,
|
|
51
51
|
)}
|
|
52
52
|
{...rest}
|