@glasshome/ui 1.9.0 → 1.10.1
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/README.md +2 -13
- package/SPEC.md +4 -4
- package/dist/lib/badge-tone.d.ts +0 -2
- package/dist/solid/badge.d.ts +1 -1
- package/dist/solid/card.d.ts +4 -2
- package/dist/solid/icon.d.ts +14 -0
- package/dist/solid/index.js +1645 -1632
- package/dist/solid/spinner.d.ts +1 -1
- package/package.json +9 -12
- package/scripts/check-pack.ts +32 -0
- package/src/index.ts +111 -0
- package/src/lib/badge-tone.ts +0 -4
- package/src/lib/carousel-classes.ts +2 -3
- package/src/solid/accordion.tsx +60 -0
- package/src/solid/alert-dialog.tsx +148 -0
- package/src/solid/alert.tsx +118 -0
- package/src/solid/area-picker.tsx +225 -0
- package/src/solid/aspect-ratio.tsx +21 -0
- package/src/solid/avatar.tsx +41 -0
- package/src/solid/badge.tsx +74 -0
- package/src/solid/bottom-sheet/arbitration.ts +40 -0
- package/src/solid/bottom-sheet/bottom-sheet.tsx +457 -0
- package/src/solid/bottom-sheet/constants.ts +8 -0
- package/src/solid/bottom-sheet/drag-controller.ts +221 -0
- package/src/solid/bottom-sheet/focus-trap.ts +56 -0
- package/src/solid/bottom-sheet/index.ts +14 -0
- package/src/solid/bottom-sheet/keyboard.ts +35 -0
- package/src/solid/bottom-sheet/scroll-lock.ts +64 -0
- package/src/solid/bottom-sheet/state-machine.ts +40 -0
- package/src/solid/bottom-sheet/velocity.ts +42 -0
- package/src/solid/breadcrumb.tsx +105 -0
- package/src/solid/button-group.tsx +66 -0
- package/src/solid/button.tsx +20 -0
- package/src/solid/card.tsx +101 -0
- package/src/solid/carousel.tsx +302 -0
- package/src/solid/charts.tsx +338 -0
- package/src/solid/checkbox.tsx +70 -0
- package/src/solid/collapsible.tsx +38 -0
- package/src/solid/color-slider.tsx +98 -0
- package/src/solid/color-wheel.tsx +77 -0
- package/src/solid/context-menu.tsx +109 -0
- package/src/solid/copy-button.tsx +46 -0
- package/src/solid/count-pill.tsx +24 -0
- package/src/solid/data-table.tsx +248 -0
- package/src/solid/dialog-parts.tsx +242 -0
- package/src/solid/dialog.tsx +121 -0
- package/src/solid/dock.tsx +186 -0
- package/src/solid/dropdown-menu.tsx +130 -0
- package/src/solid/empty.tsx +99 -0
- package/src/solid/entity-data.ts +78 -0
- package/src/solid/entity-selector.tsx +697 -0
- package/src/solid/field.tsx +253 -0
- package/src/solid/form.tsx +231 -0
- package/src/solid/hero-action.tsx +117 -0
- package/src/solid/hover-card.tsx +26 -0
- package/src/solid/icon-picker.tsx +432 -0
- package/src/solid/icon.tsx +20 -0
- package/src/solid/image-picker.tsx +380 -0
- package/src/solid/index.ts +417 -0
- package/src/solid/input-group.tsx +170 -0
- package/src/solid/input-otp.tsx +175 -0
- package/src/solid/input.tsx +12 -0
- package/src/solid/item.tsx +179 -0
- package/src/solid/kbd.tsx +30 -0
- package/src/solid/label.tsx +19 -0
- package/src/solid/list-reorder.ts +148 -0
- package/src/solid/logo.tsx +79 -0
- package/src/solid/media-copy.ts +37 -0
- package/src/solid/media-store.ts +110 -0
- package/src/solid/media-tile.tsx +100 -0
- package/src/solid/menu-parts.tsx +248 -0
- package/src/solid/number-field.tsx +72 -0
- package/src/solid/option-card.tsx +218 -0
- package/src/solid/ornament.tsx +53 -0
- package/src/solid/overlay.tsx +16 -0
- package/src/solid/page-header.tsx +102 -0
- package/src/solid/pagination.tsx +111 -0
- package/src/solid/password-input.tsx +69 -0
- package/src/solid/picker-row.tsx +102 -0
- package/src/solid/picker-search.tsx +78 -0
- package/src/solid/popover.tsx +103 -0
- package/src/solid/progress.tsx +31 -0
- package/src/solid/radio-group.tsx +60 -0
- package/src/solid/resizable.tsx +149 -0
- package/src/solid/responsive-dialog.tsx +180 -0
- package/src/solid/schema-form.tsx +830 -0
- package/src/solid/scope-indicator.tsx +13 -0
- package/src/solid/scroll-area.tsx +27 -0
- package/src/solid/section-card.tsx +358 -0
- package/src/solid/select.tsx +139 -0
- package/src/solid/separator.tsx +35 -0
- package/src/solid/settings-row.tsx +159 -0
- package/src/solid/sheet.tsx +157 -0
- package/src/solid/skeleton.tsx +15 -0
- package/src/solid/slider.tsx +148 -0
- package/src/solid/sliding-indicator.tsx +294 -0
- package/src/solid/sonner.tsx +219 -0
- package/src/solid/spinner.tsx +20 -0
- package/src/solid/step-indicator.tsx +30 -0
- package/src/solid/switch.tsx +62 -0
- package/src/solid/table.tsx +98 -0
- package/src/solid/tabs.tsx +86 -0
- package/src/solid/textarea.tsx +16 -0
- package/src/solid/toggle-group.tsx +102 -0
- package/src/solid/toggle.tsx +57 -0
- package/src/solid/tooltip.tsx +38 -0
- package/src/solid/widget-card.tsx +117 -0
- package/src/solid/widget-identity.tsx +135 -0
- package/src/solid/widget-trust-badge.tsx +37 -0
- package/src/tokens/hex.ts +50 -0
- package/src/tokens/index.ts +8 -0
- package/src/tokens/presets.ts +192 -0
- package/src/tokens/theme-colors.ts +147 -0
- package/dist/lib/carousel-init.d.ts +0 -9
- package/src/astro/Alert.astro +0 -63
- package/src/astro/Badge.astro +0 -18
- package/src/astro/Button.astro +0 -47
- package/src/astro/Card.astro +0 -48
- package/src/astro/Carousel.astro +0 -82
- package/src/astro/Logo.astro +0 -73
- package/src/astro/TierBadge.astro +0 -33
- package/src/lib/carousel-init.ts +0 -87
package/src/astro/Carousel.astro
DELETED
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
/**
|
|
3
|
-
* Server-rendered carousel. Slides live in the HTML, so they are indexable and
|
|
4
|
-
* the first one is the LCP image; the client script only adds behaviour.
|
|
5
|
-
* Use this on content pages; use the Solid <Carousel> inside an app.
|
|
6
|
-
*
|
|
7
|
-
* Slides go in the default slot as <CarouselItem>-shaped elements, or pass
|
|
8
|
-
* `count` to have dots rendered for you.
|
|
9
|
-
*/
|
|
10
|
-
import type { HTMLAttributes } from "astro/types";
|
|
11
|
-
import {
|
|
12
|
-
CAROUSEL_DOTS,
|
|
13
|
-
CAROUSEL_VIEWPORT,
|
|
14
|
-
type CarouselTransition,
|
|
15
|
-
carouselDot,
|
|
16
|
-
carouselTrack,
|
|
17
|
-
} from "../lib/carousel-classes";
|
|
18
|
-
import { cn } from "../lib/utils";
|
|
19
|
-
|
|
20
|
-
// Extends div attributes because everything not destructured below is spread
|
|
21
|
-
// onto the root; without it a caller's style/role/aria-* is a type error while
|
|
22
|
-
// still working at runtime.
|
|
23
|
-
interface Props extends HTMLAttributes<"div"> {
|
|
24
|
-
transition?: CarouselTransition;
|
|
25
|
-
/** Advance every N ms. Skipped under prefers-reduced-motion. */
|
|
26
|
-
autoplay?: number;
|
|
27
|
-
loop?: boolean;
|
|
28
|
-
/** Slide count; when set, dots are rendered. */
|
|
29
|
-
count?: number;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
const {
|
|
33
|
-
transition = "slide",
|
|
34
|
-
autoplay,
|
|
35
|
-
loop = false,
|
|
36
|
-
count,
|
|
37
|
-
class: className,
|
|
38
|
-
...rest
|
|
39
|
-
} = Astro.props;
|
|
40
|
-
---
|
|
41
|
-
|
|
42
|
-
<div
|
|
43
|
-
data-carousel
|
|
44
|
-
data-carousel-transition={transition}
|
|
45
|
-
data-carousel-autoplay={autoplay}
|
|
46
|
-
data-carousel-loop={loop ? "" : undefined}
|
|
47
|
-
class={cn("relative", className)}
|
|
48
|
-
role="region"
|
|
49
|
-
aria-roledescription="carousel"
|
|
50
|
-
{...rest}
|
|
51
|
-
>
|
|
52
|
-
<div data-carousel-viewport class={CAROUSEL_VIEWPORT}>
|
|
53
|
-
<div class={carouselTrack(transition)}>
|
|
54
|
-
<slot />
|
|
55
|
-
</div>
|
|
56
|
-
</div>
|
|
57
|
-
|
|
58
|
-
<slot name="controls" />
|
|
59
|
-
|
|
60
|
-
{
|
|
61
|
-
count && (
|
|
62
|
-
<div class={CAROUSEL_DOTS} data-carousel-dots>
|
|
63
|
-
{Array.from({ length: count }, (_, i) => (
|
|
64
|
-
<button
|
|
65
|
-
type="button"
|
|
66
|
-
data-carousel-dot
|
|
67
|
-
aria-label={`Go to slide ${i + 1}`}
|
|
68
|
-
aria-current={i === 0}
|
|
69
|
-
class={carouselDot(i === 0)}
|
|
70
|
-
/>
|
|
71
|
-
))}
|
|
72
|
-
</div>
|
|
73
|
-
)
|
|
74
|
-
}
|
|
75
|
-
</div>
|
|
76
|
-
|
|
77
|
-
<script>
|
|
78
|
-
import { initCarousels } from "../lib/carousel-init";
|
|
79
|
-
|
|
80
|
-
initCarousels();
|
|
81
|
-
document.addEventListener("astro:page-load", () => initCarousels());
|
|
82
|
-
</script>
|
package/src/astro/Logo.astro
DELETED
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
import {
|
|
3
|
-
cn,
|
|
4
|
-
LOGO_DEFAULT_SIZE,
|
|
5
|
-
LOGO_DEFAULT_SRC,
|
|
6
|
-
LOGO_DEFAULT_SUB,
|
|
7
|
-
LOGO_MARK_CLASS,
|
|
8
|
-
LOGO_MARK_PX,
|
|
9
|
-
LOGO_NAME_CLASS,
|
|
10
|
-
LOGO_ROOT_CLASS,
|
|
11
|
-
LOGO_SIZES,
|
|
12
|
-
LOGO_STACK_CLASS,
|
|
13
|
-
LOGO_SUB_CLASS,
|
|
14
|
-
type LogoSize,
|
|
15
|
-
} from "@glasshome/ui";
|
|
16
|
-
/**
|
|
17
|
-
* The GlassHome lockup for Astro / SSR pages — the same spec the Solid <Logo>
|
|
18
|
-
* renders, as plain HTML with zero JS. Use this instead of hand-building a
|
|
19
|
-
* mark + "GlassHome" + sub-line stack; that is how the lockup ended up in six
|
|
20
|
-
* shapes across the repos.
|
|
21
|
-
*
|
|
22
|
-
* `href` renders the whole lockup as a link. The `sub` slot replaces the
|
|
23
|
-
* sub-brand line for surfaces that animate over it (e.g. hub's launch
|
|
24
|
-
* countdown cross-fade); it inherits nothing, so pass LOGO_SUB_CLASS yourself.
|
|
25
|
-
*/
|
|
26
|
-
import type { HTMLAttributes } from "astro/types";
|
|
27
|
-
|
|
28
|
-
// Renders <a> when href is set, <div> otherwise, so the div attributes are the
|
|
29
|
-
// common base and the anchor-only ones a lockup link actually wants are added.
|
|
30
|
-
interface Props
|
|
31
|
-
extends HTMLAttributes<"div">,
|
|
32
|
-
Partial<Pick<HTMLAttributes<"a">, "target" | "rel">> {
|
|
33
|
-
/** Sub-brand line. Defaults to "Dash". */
|
|
34
|
-
sub?: string;
|
|
35
|
-
size?: LogoSize;
|
|
36
|
-
/** Renders the lockup as a link when set. */
|
|
37
|
-
href?: string;
|
|
38
|
-
/** Override the mark asset. Both apps serve the default path. */
|
|
39
|
-
src?: string;
|
|
40
|
-
/** Extra classes for the mark, e.g. a hover transform. */
|
|
41
|
-
markClass?: string;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
const {
|
|
45
|
-
sub = LOGO_DEFAULT_SUB,
|
|
46
|
-
size = LOGO_DEFAULT_SIZE,
|
|
47
|
-
href,
|
|
48
|
-
src = LOGO_DEFAULT_SRC,
|
|
49
|
-
class: className,
|
|
50
|
-
markClass,
|
|
51
|
-
...rest
|
|
52
|
-
} = Astro.props;
|
|
53
|
-
|
|
54
|
-
const s = LOGO_SIZES[size];
|
|
55
|
-
const px = LOGO_MARK_PX[size];
|
|
56
|
-
const Tag = href ? "a" : "div";
|
|
57
|
-
---
|
|
58
|
-
|
|
59
|
-
<Tag data-slot="logo" class={cn(LOGO_ROOT_CLASS, s.gap, className)} href={href} {...rest}>
|
|
60
|
-
<img
|
|
61
|
-
src={src}
|
|
62
|
-
alt=""
|
|
63
|
-
width={px}
|
|
64
|
-
height={px}
|
|
65
|
-
class={cn(LOGO_MARK_CLASS, s.mark, markClass)}
|
|
66
|
-
/>
|
|
67
|
-
<span class={LOGO_STACK_CLASS}>
|
|
68
|
-
<span data-slot="logo-name" class={cn(s.name, LOGO_NAME_CLASS)}>GlassHome</span>
|
|
69
|
-
<slot name="sub">
|
|
70
|
-
<span data-slot="logo-sub" class={cn(s.sub, LOGO_SUB_CLASS)}>{sub}</span>
|
|
71
|
-
</slot>
|
|
72
|
-
</span>
|
|
73
|
-
</Tag>
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
/**
|
|
3
|
-
* Static metallic tier chip for Astro / SSR pages (PRO / EARLY BIRD / CREATOR /
|
|
4
|
-
* FOUNDER) — the same tier tokens the Solid <TierBadge> uses, rendered as plain
|
|
5
|
-
* HTML with zero JS. One family; only the hi/lo/text triplet changes per tier.
|
|
6
|
-
*/
|
|
7
|
-
import type { HTMLAttributes } from "astro/types";
|
|
8
|
-
import { TIER_BADGE_CLASS, tierBadgeStyle } from "../lib/tier-badge";
|
|
9
|
-
import { cn } from "../lib/utils";
|
|
10
|
-
|
|
11
|
-
interface Props extends HTMLAttributes<"span"> {
|
|
12
|
-
/** Gradient high stop (the near end of the diagonal sweep, and by default
|
|
13
|
-
* the far end too). */
|
|
14
|
-
hi: string;
|
|
15
|
-
/** Gradient low stop (the dip). */
|
|
16
|
-
lo: string;
|
|
17
|
-
/** Dark label color. */
|
|
18
|
-
text: string;
|
|
19
|
-
/** Far end of the sweep. Default: `hi` (symmetric brushed look). */
|
|
20
|
-
end?: string;
|
|
21
|
-
/** Where `lo` sits, in percent. Default: 50. */
|
|
22
|
-
stop?: number;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
const { hi, lo, text, end, stop, class: className, ...rest } = Astro.props;
|
|
26
|
-
const style = Object.entries(tierBadgeStyle(hi, lo, text, { end, stop }))
|
|
27
|
-
.map(([k, v]) => `${k}:${v}`)
|
|
28
|
-
.join(";");
|
|
29
|
-
---
|
|
30
|
-
|
|
31
|
-
<span data-slot="tier-badge" class={cn(TIER_BADGE_CLASS, className)} style={style} {...rest}>
|
|
32
|
-
<slot />
|
|
33
|
-
</span>
|
package/src/lib/carousel-init.ts
DELETED
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
import EmblaCarousel from "embla-carousel";
|
|
2
|
-
import Autoplay from "embla-carousel-autoplay";
|
|
3
|
-
import Fade from "embla-carousel-fade";
|
|
4
|
-
import { type CarouselTransition, carouselDot } from "./carousel-classes.js";
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Client enhancement for astro/Carousel.astro. The markup is already in the
|
|
8
|
-
* server HTML; this only adds behaviour, so the slides stay visible (and
|
|
9
|
-
* indexable) if the script never runs.
|
|
10
|
-
*
|
|
11
|
-
* Emits `carousel:select` with `{ index }` so a host page can sync its own
|
|
12
|
-
* chrome (labels, lightboxes) without owning the carousel.
|
|
13
|
-
*/
|
|
14
|
-
export function initCarousels(root: ParentNode = document) {
|
|
15
|
-
const roots = Array.from(root.querySelectorAll("[data-carousel]")) as HTMLElement[];
|
|
16
|
-
for (const el of roots) {
|
|
17
|
-
if (el.dataset.carouselReady) continue;
|
|
18
|
-
el.dataset.carouselReady = "1";
|
|
19
|
-
|
|
20
|
-
const viewport = el.querySelector("[data-carousel-viewport]") as HTMLElement | null;
|
|
21
|
-
if (!viewport) continue;
|
|
22
|
-
|
|
23
|
-
const transition = (el.dataset.carouselTransition ?? "slide") as CarouselTransition;
|
|
24
|
-
const autoplayMs = Number(el.dataset.carouselAutoplay ?? 0);
|
|
25
|
-
const loop = el.dataset.carouselLoop === "";
|
|
26
|
-
const reduced = window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
27
|
-
|
|
28
|
-
const plugins = [];
|
|
29
|
-
if (transition !== "slide") plugins.push(Fade());
|
|
30
|
-
if (autoplayMs > 0 && !reduced) {
|
|
31
|
-
// Manual nav should not kill autoplay for good; hovering pauses it and
|
|
32
|
-
// leaving resumes, which is what a hero carousel wants.
|
|
33
|
-
plugins.push(
|
|
34
|
-
Autoplay({
|
|
35
|
-
delay: autoplayMs,
|
|
36
|
-
stopOnInteraction: false,
|
|
37
|
-
stopOnMouseEnter: true,
|
|
38
|
-
stopOnFocusIn: true,
|
|
39
|
-
}),
|
|
40
|
-
);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
const embla = EmblaCarousel(viewport, { loop }, plugins);
|
|
44
|
-
const dots = Array.from(el.querySelectorAll("[data-carousel-dot]")) as HTMLButtonElement[];
|
|
45
|
-
|
|
46
|
-
let previous = -1;
|
|
47
|
-
const onSelect = () => {
|
|
48
|
-
const index = embla.selectedScrollSnap();
|
|
49
|
-
embla.slideNodes().forEach((node, i) => {
|
|
50
|
-
node.toggleAttribute("data-selected", i === index);
|
|
51
|
-
// The outgoing slide stays visible one layer down until the sweep lands.
|
|
52
|
-
node.toggleAttribute("data-prev", i === previous && i !== index);
|
|
53
|
-
});
|
|
54
|
-
previous = index;
|
|
55
|
-
dots.forEach((dot, i) => {
|
|
56
|
-
dot.className = carouselDot(i === index);
|
|
57
|
-
dot.setAttribute("aria-current", String(i === index));
|
|
58
|
-
});
|
|
59
|
-
el.dispatchEvent(new CustomEvent("carousel:select", { detail: { index }, bubbles: true }));
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
el.addEventListener("keydown", (e) => {
|
|
63
|
-
const key = (e as KeyboardEvent).key;
|
|
64
|
-
if (key !== "ArrowLeft" && key !== "ArrowRight") return;
|
|
65
|
-
e.preventDefault();
|
|
66
|
-
if (key === "ArrowLeft") embla.scrollPrev();
|
|
67
|
-
else embla.scrollNext();
|
|
68
|
-
});
|
|
69
|
-
|
|
70
|
-
// A host that covers the carousel (a lightbox) pauses it, so the slide
|
|
71
|
-
// does not change behind the overlay.
|
|
72
|
-
const autoplay = (embla.plugins() as { autoplay?: { play: () => void; stop: () => void } })
|
|
73
|
-
.autoplay;
|
|
74
|
-
el.addEventListener("carousel:pause", () => autoplay?.stop());
|
|
75
|
-
el.addEventListener("carousel:resume", () => autoplay?.play());
|
|
76
|
-
|
|
77
|
-
dots.forEach((dot, i) => {
|
|
78
|
-
dot.addEventListener("click", () => embla.scrollTo(i));
|
|
79
|
-
});
|
|
80
|
-
el.querySelector("[data-carousel-prev]")?.addEventListener("click", () => embla.scrollPrev());
|
|
81
|
-
el.querySelector("[data-carousel-next]")?.addEventListener("click", () => embla.scrollNext());
|
|
82
|
-
|
|
83
|
-
onSelect();
|
|
84
|
-
embla.on("select", onSelect);
|
|
85
|
-
embla.on("reInit", onSelect);
|
|
86
|
-
}
|
|
87
|
-
}
|