@glasshome/ui 1.21.0 → 1.21.2
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/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/lib/use-is-mobile.d.ts +3 -1
- package/dist/solid/alert-dialog.d.ts +7 -1
- package/dist/solid/bottom-sheet/bottom-sheet.d.ts +7 -1
- package/dist/solid/dialog-parts.d.ts +3 -2
- package/dist/solid/dialog.d.ts +7 -1
- package/dist/solid/docked-panel.d.ts +7 -1
- package/dist/solid/index.d.ts +9 -9
- package/dist/solid/index.js +5456 -5447
- package/dist/solid/media-store.d.ts +4 -1
- package/dist/solid/option-card.d.ts +4 -1
- package/dist/solid/responsive-dialog.d.ts +7 -1
- package/dist/solid/sheet.d.ts +7 -1
- package/dist/{utils-CMk7R3zM.js → utils-D5blHO4O.js} +624 -622
- package/package.json +128 -126
- package/scripts/check-gallery.ts +142 -142
- package/scripts/check-pack.ts +13 -13
- package/scripts/check-structural-classes.ts +20 -20
- package/scripts/check-tokens.ts +27 -27
- package/scripts/check-ui-drift.mjs +103 -103
- package/src/index.ts +75 -80
- package/src/lib/alert-tones.ts +41 -41
- package/src/lib/anchor-placement.ts +21 -21
- package/src/lib/button-variants.ts +28 -28
- package/src/lib/card-classes.ts +9 -9
- package/src/lib/carousel-classes.ts +14 -14
- package/src/lib/glass-tone.ts +11 -11
- package/src/lib/input-classes.ts +6 -6
- package/src/lib/layers.ts +4 -4
- package/src/lib/logo-lockup.ts +8 -8
- package/src/lib/menu-classes.ts +2 -2
- package/src/lib/motion-classes.ts +8 -8
- package/src/lib/motion-window.ts +24 -24
- package/src/lib/overlay-classes.ts +6 -6
- package/src/lib/pill-classes.ts +3 -3
- package/src/lib/position-bar-classes.ts +1 -1
- package/src/lib/spotlight-geometry.ts +67 -67
- package/src/lib/thumb-classes.ts +2 -2
- package/src/lib/tier-badge.ts +16 -16
- package/src/lib/use-is-mobile.ts +17 -14
- package/src/lib/utils.ts +1 -1
- package/src/solid/accordion.tsx +41 -41
- package/src/solid/alert-dialog.tsx +95 -95
- package/src/solid/alert.tsx +88 -88
- package/src/solid/area-picker.tsx +204 -204
- package/src/solid/aspect-ratio.tsx +13 -13
- package/src/solid/avatar.tsx +27 -27
- package/src/solid/badge.tsx +49 -49
- package/src/solid/bottom-sheet/arbitration.ts +22 -22
- package/src/solid/bottom-sheet/bottom-sheet.tsx +394 -394
- package/src/solid/bottom-sheet/drag-controller.ts +201 -201
- package/src/solid/bottom-sheet/focus-trap.ts +51 -47
- package/src/solid/bottom-sheet/index.ts +12 -12
- package/src/solid/bottom-sheet/keyboard.ts +25 -25
- package/src/solid/bottom-sheet/scroll-lock.ts +46 -46
- package/src/solid/bottom-sheet/state-machine.ts +28 -28
- package/src/solid/bottom-sheet/velocity.ts +29 -29
- package/src/solid/breadcrumb.tsx +76 -76
- package/src/solid/button-group.tsx +46 -46
- package/src/solid/button.tsx +19 -19
- package/src/solid/card.tsx +67 -67
- package/src/solid/carousel.tsx +246 -246
- package/src/solid/charts.tsx +253 -253
- package/src/solid/checkbox.tsx +51 -51
- package/src/solid/collapsible.tsx +22 -22
- package/src/solid/color-disc.tsx +213 -213
- package/src/solid/color-slider.tsx +81 -81
- package/src/solid/color-wheel.tsx +61 -61
- package/src/solid/context-menu.tsx +63 -63
- package/src/solid/copy-button.tsx +31 -31
- package/src/solid/count-pill.tsx +11 -11
- package/src/solid/dashboard-preview.tsx +104 -104
- package/src/solid/data-table.tsx +228 -228
- package/src/solid/dialog-parts.tsx +129 -129
- package/src/solid/dialog.tsx +113 -113
- package/src/solid/dock-paging.ts +9 -9
- package/src/solid/dock.tsx +339 -338
- package/src/solid/docked-panel.tsx +35 -35
- package/src/solid/dropdown-menu.tsx +77 -77
- package/src/solid/empty.tsx +70 -70
- package/src/solid/entity-data.ts +38 -38
- package/src/solid/entity-selector.tsx +634 -634
- package/src/solid/field.tsx +205 -205
- package/src/solid/form.tsx +159 -159
- package/src/solid/hero-action.tsx +85 -85
- package/src/solid/hover-card.tsx +11 -11
- package/src/solid/icon-picker.tsx +401 -401
- package/src/solid/icon.tsx +101 -78
- package/src/solid/image-picker.tsx +416 -414
- package/src/solid/index.ts +265 -304
- package/src/solid/input-group.tsx +123 -123
- package/src/solid/input-otp.tsx +143 -143
- package/src/solid/input.tsx +4 -4
- package/src/solid/item.tsx +130 -130
- package/src/solid/kbd.tsx +20 -20
- package/src/solid/label.tsx +12 -12
- package/src/solid/list-reorder.ts +122 -122
- package/src/solid/logo.tsx +60 -60
- package/src/solid/media-copy.ts +21 -21
- package/src/solid/media-store.ts +60 -57
- package/src/solid/media-tile.tsx +85 -85
- package/src/solid/menu-parts.tsx +164 -164
- package/src/solid/number-field.tsx +56 -56
- package/src/solid/option-card.tsx +168 -165
- package/src/solid/ornament.tsx +43 -43
- package/src/solid/overlay.tsx +4 -4
- package/src/solid/page-header.tsx +75 -75
- package/src/solid/pagination.tsx +80 -80
- package/src/solid/password-input.tsx +51 -51
- package/src/solid/picker-row.tsx +83 -83
- package/src/solid/picker-search.tsx +65 -63
- package/src/solid/picker-trigger.tsx +59 -57
- package/src/solid/popover.tsx +54 -54
- package/src/solid/preview-tile.tsx +67 -67
- package/src/solid/progress.tsx +21 -21
- package/src/solid/radio-group.tsx +51 -51
- package/src/solid/resizable.tsx +128 -128
- package/src/solid/responsive-dialog.tsx +134 -134
- package/src/solid/schema-form.tsx +746 -739
- package/src/solid/scope-indicator.tsx +5 -5
- package/src/solid/scroll-area.tsx +16 -16
- package/src/solid/section-card.tsx +281 -281
- package/src/solid/select.tsx +101 -101
- package/src/solid/separator.tsx +25 -25
- package/src/solid/settings-row.tsx +122 -122
- package/src/solid/sheet.tsx +96 -96
- package/src/solid/skeleton.tsx +8 -8
- package/src/solid/slider.tsx +132 -132
- package/src/solid/sliding-indicator.tsx +280 -265
- package/src/solid/sonner.tsx +164 -164
- package/src/solid/spinner.tsx +12 -12
- package/src/solid/spotlight.tsx +140 -140
- package/src/solid/step-indicator.tsx +18 -18
- package/src/solid/swatch-picker.tsx +38 -38
- package/src/solid/switch.tsx +52 -52
- package/src/solid/table.tsx +63 -63
- package/src/solid/tabs.tsx +93 -93
- package/src/solid/textarea.tsx +8 -8
- package/src/solid/toggle-group.tsx +83 -83
- package/src/solid/toggle.tsx +33 -33
- package/src/solid/tooltip.tsx +16 -16
- package/src/solid/widget-card.tsx +90 -90
- package/src/solid/widget-identity.tsx +99 -99
- package/src/solid/widget-trust-badge.tsx +20 -20
- package/src/styles/globals.css +316 -319
- package/src/styles/theme.css +448 -448
- package/src/tokens/hex.ts +29 -29
- package/src/tokens/material.ts +75 -75
- package/src/tokens/presets.ts +303 -303
- package/src/tokens/readability.ts +32 -32
- package/src/tokens/theme-colors.ts +95 -95
- package/src/tokens/theme-css.ts +22 -22
- package/src/tokens/theme-recipe.ts +106 -106
|
@@ -2,20 +2,20 @@ import { type ParentComponent, splitProps } from "solid-js";
|
|
|
2
2
|
import { cn } from "../lib/utils.js";
|
|
3
3
|
|
|
4
4
|
const AspectRatio: ParentComponent<{
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
class?: string;
|
|
6
|
+
ratio?: number;
|
|
7
7
|
}> = (props) => {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
8
|
+
const [local, rest] = splitProps(props, ["class", "ratio", "children"]);
|
|
9
|
+
return (
|
|
10
|
+
<div
|
|
11
|
+
data-slot="aspect-ratio"
|
|
12
|
+
class={cn("relative w-full", local.class)}
|
|
13
|
+
style={{ "aspect-ratio": String(local.ratio ?? 1) }}
|
|
14
|
+
{...rest}
|
|
15
|
+
>
|
|
16
|
+
{local.children}
|
|
17
|
+
</div>
|
|
18
|
+
);
|
|
19
19
|
};
|
|
20
20
|
|
|
21
21
|
export { AspectRatio };
|
package/src/solid/avatar.tsx
CHANGED
|
@@ -3,39 +3,39 @@ import { type Component, type ComponentProps, splitProps } from "solid-js";
|
|
|
3
3
|
import { cn } from "../lib/utils.js";
|
|
4
4
|
|
|
5
5
|
const Avatar: Component<ComponentProps<typeof ImagePrimitive>> = (props) => {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
6
|
+
const [local, rest] = splitProps(props, ["class"]);
|
|
7
|
+
return (
|
|
8
|
+
<ImagePrimitive
|
|
9
|
+
data-slot="avatar"
|
|
10
|
+
class={cn("relative flex size-10 shrink-0 overflow-hidden rounded-full", local.class)}
|
|
11
|
+
{...rest}
|
|
12
|
+
/>
|
|
13
|
+
);
|
|
14
14
|
};
|
|
15
15
|
|
|
16
16
|
const AvatarImage: Component<ComponentProps<typeof ImagePrimitive.Img>> = (props) => {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
17
|
+
const [local, rest] = splitProps(props, ["class"]);
|
|
18
|
+
return (
|
|
19
|
+
<ImagePrimitive.Img
|
|
20
|
+
data-slot="avatar-image"
|
|
21
|
+
class={cn("aspect-square size-full", local.class)}
|
|
22
|
+
{...rest}
|
|
23
|
+
/>
|
|
24
|
+
);
|
|
25
25
|
};
|
|
26
26
|
|
|
27
27
|
const AvatarFallback: Component<ComponentProps<typeof ImagePrimitive.Fallback>> = (props) => {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
28
|
+
const [local, rest] = splitProps(props, ["class"]);
|
|
29
|
+
return (
|
|
30
|
+
<ImagePrimitive.Fallback
|
|
31
|
+
data-slot="avatar-fallback"
|
|
32
|
+
class={cn(
|
|
33
|
+
"glass flex size-full items-center justify-center rounded-full font-semibold [--glass-tone:var(--primary)]",
|
|
34
|
+
local.class,
|
|
35
|
+
)}
|
|
36
|
+
{...rest}
|
|
37
|
+
/>
|
|
38
|
+
);
|
|
39
39
|
};
|
|
40
40
|
|
|
41
41
|
export { Avatar, AvatarFallback, AvatarImage };
|
package/src/solid/badge.tsx
CHANGED
|
@@ -7,41 +7,41 @@ import { TIER_BADGE_CLASS, tierBadgeStyle } from "../lib/tier-badge.js";
|
|
|
7
7
|
import { cn } from "../lib/utils.js";
|
|
8
8
|
|
|
9
9
|
type BadgeProps = ComponentProps<"span"> &
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
10
|
+
Partial<Pick<ComponentProps<"a">, "href" | "target" | "rel">> & {
|
|
11
|
+
as?: ValidComponent;
|
|
12
|
+
/** Any CSS color (semantic token or arbitrary hue). Defaults to var(--primary). */
|
|
13
|
+
tone?: string;
|
|
14
|
+
};
|
|
15
15
|
|
|
16
16
|
const Badge: Component<BadgeProps> = (props) => {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
17
|
+
const [local, others] = splitProps(props, ["class", "as", "tone", "children", "style"]);
|
|
18
|
+
const Comp = () => local.as || "span";
|
|
19
|
+
const c = () => local.tone ?? BADGE_DEFAULT_TONE;
|
|
20
|
+
return (
|
|
21
|
+
<Dynamic
|
|
22
|
+
component={Comp()}
|
|
23
|
+
data-slot="badge"
|
|
24
|
+
class={cn(CHIP, isNeutralTone(c()) && BADGE_NEUTRAL_KNOBS, local.class)}
|
|
25
|
+
style={{ "--glass-tone": c(), ...(local.style as Record<string, string>) }}
|
|
26
|
+
{...others}
|
|
27
|
+
>
|
|
28
|
+
{local.children}
|
|
29
|
+
</Dynamic>
|
|
30
|
+
);
|
|
31
31
|
};
|
|
32
32
|
|
|
33
33
|
type TierBadgeProps = ComponentProps<"span"> & {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
34
|
+
/** Gradient high stop (the near end of the diagonal sweep, and by default
|
|
35
|
+
* the far end too). */
|
|
36
|
+
hi: string;
|
|
37
|
+
/** Gradient low stop (the dip). */
|
|
38
|
+
lo: string;
|
|
39
|
+
/** Dark label color. */
|
|
40
|
+
text: string;
|
|
41
|
+
/** Far end of the sweep. Default: `hi` (symmetric brushed look). */
|
|
42
|
+
end?: string;
|
|
43
|
+
/** Where `lo` sits, in percent. Default: 50. */
|
|
44
|
+
stop?: number;
|
|
45
45
|
};
|
|
46
46
|
|
|
47
47
|
/**
|
|
@@ -50,25 +50,25 @@ type TierBadgeProps = ComponentProps<"span"> & {
|
|
|
50
50
|
* One family; only the hi/lo/text triplet changes per tier.
|
|
51
51
|
*/
|
|
52
52
|
const TierBadge: Component<TierBadgeProps> = (props) => {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
53
|
+
const [local, others] = splitProps(props, [
|
|
54
|
+
"class",
|
|
55
|
+
"hi",
|
|
56
|
+
"lo",
|
|
57
|
+
"text",
|
|
58
|
+
"end",
|
|
59
|
+
"stop",
|
|
60
|
+
"children",
|
|
61
|
+
]);
|
|
62
|
+
return (
|
|
63
|
+
<span
|
|
64
|
+
data-slot="tier-badge"
|
|
65
|
+
class={cn(TIER_BADGE_CLASS, local.class)}
|
|
66
|
+
style={tierBadgeStyle(local.hi, local.lo, local.text, { end: local.end, stop: local.stop })}
|
|
67
|
+
{...others}
|
|
68
|
+
>
|
|
69
|
+
{local.children}
|
|
70
|
+
</span>
|
|
71
|
+
);
|
|
72
72
|
};
|
|
73
73
|
|
|
74
74
|
export { Badge, TierBadge };
|
|
@@ -5,36 +5,36 @@
|
|
|
5
5
|
type Direction = "down" | "up";
|
|
6
6
|
|
|
7
7
|
function isScrollableAxis(el: Element): boolean {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
if (el.hasAttribute("data-sheet-scroll")) return true;
|
|
9
|
+
const overflowY = getComputedStyle(el).overflowY;
|
|
10
|
+
if (overflowY !== "auto" && overflowY !== "scroll" && overflowY !== "overlay") return false;
|
|
11
|
+
return el.scrollHeight > el.clientHeight;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
function canScrollFurther(el: Element, dir: Direction): boolean {
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
if (dir === "down") return el.scrollTop > 0;
|
|
16
|
+
return el.scrollTop + el.clientHeight < el.scrollHeight - 1;
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
export function hasNoDragAncestor(target: Element | null, root: Element): boolean {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
20
|
+
let cur: Element | null = target;
|
|
21
|
+
while (cur && cur !== root.parentElement) {
|
|
22
|
+
if (cur.hasAttribute("data-sheet-no-drag")) return true;
|
|
23
|
+
cur = cur.parentElement;
|
|
24
|
+
}
|
|
25
|
+
return false;
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
export function shouldDrag(target: Element | null, root: Element, dy: number, dx: number): boolean {
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
if (Math.abs(dx) > Math.abs(dy)) return false;
|
|
30
|
+
if (hasNoDragAncestor(target, root)) return false;
|
|
31
31
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
32
|
+
const dir: Direction = dy > 0 ? "down" : "up";
|
|
33
|
+
let cur: Element | null = target;
|
|
34
|
+
while (cur && cur !== root.parentElement) {
|
|
35
|
+
if (isScrollableAxis(cur) && canScrollFurther(cur, dir)) return false;
|
|
36
|
+
if (cur === root) break;
|
|
37
|
+
cur = cur.parentElement;
|
|
38
|
+
}
|
|
39
|
+
return true;
|
|
40
40
|
}
|