@glasshome/ui 1.21.1 → 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/index.d.ts +9 -9
- package/dist/solid/index.js +5431 -5424
- 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 +127 -127
- package/src/solid/dialog.tsx +113 -113
- package/src/solid/dock-paging.ts +9 -9
- package/src/solid/dock.tsx +339 -339
- 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 +56 -56
- 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 +164 -164
- 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 +743 -743
- 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
|
@@ -3,66 +3,68 @@ import { PICKER_TRIGGER } from "../lib/picker-classes.js";
|
|
|
3
3
|
import { cn } from "../lib/utils.js";
|
|
4
4
|
import { Icon } from "./icon.js";
|
|
5
5
|
|
|
6
|
-
export interface PickerTriggerProps
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
6
|
+
export interface PickerTriggerProps extends Omit<
|
|
7
|
+
JSX.ButtonHTMLAttributes<HTMLButtonElement>,
|
|
8
|
+
"onClick"
|
|
9
|
+
> {
|
|
10
|
+
/** data-slot for the button, so each picker keeps its own test and style hook. */
|
|
11
|
+
slot: string;
|
|
12
|
+
open: boolean;
|
|
13
|
+
onToggle: () => void;
|
|
14
|
+
/** Passed only when there is a value to drop: its presence paints the clear button. */
|
|
15
|
+
onClear?: () => void;
|
|
16
|
+
clearLabel?: string;
|
|
15
17
|
}
|
|
16
18
|
|
|
17
19
|
export function PickerTrigger(props: PickerTriggerProps) {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
20
|
+
const [own, rest] = splitProps(props, [
|
|
21
|
+
"slot",
|
|
22
|
+
"open",
|
|
23
|
+
"onToggle",
|
|
24
|
+
"onClear",
|
|
25
|
+
"clearLabel",
|
|
26
|
+
"class",
|
|
27
|
+
"children",
|
|
28
|
+
]);
|
|
27
29
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
30
|
+
return (
|
|
31
|
+
<div class="relative">
|
|
32
|
+
<button
|
|
33
|
+
type="button"
|
|
34
|
+
data-slot={own.slot}
|
|
35
|
+
data-expanded={own.open || undefined}
|
|
36
|
+
class={cn(PICKER_TRIGGER, own.class)}
|
|
37
|
+
onClick={() => own.onToggle()}
|
|
38
|
+
{...rest}
|
|
39
|
+
>
|
|
40
|
+
{own.children}
|
|
41
|
+
{/* The clear button cannot nest inside the trigger button, so it is
|
|
40
42
|
positioned over this gap, left of the chevron. */}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
43
|
+
<Show when={own.onClear}>
|
|
44
|
+
<span class="w-6 shrink-0" />
|
|
45
|
+
</Show>
|
|
46
|
+
<Icon
|
|
47
|
+
icon="lucide:chevron-down"
|
|
48
|
+
width={16}
|
|
49
|
+
height={16}
|
|
50
|
+
class={cn(
|
|
51
|
+
"text-muted-foreground shrink-0 transition-transform",
|
|
52
|
+
own.open && "rotate-180",
|
|
53
|
+
)}
|
|
54
|
+
/>
|
|
55
|
+
</button>
|
|
56
|
+
<Show when={own.onClear}>
|
|
57
|
+
<button
|
|
58
|
+
type="button"
|
|
59
|
+
data-slot="picker-trigger-clear"
|
|
60
|
+
aria-label={own.clearLabel ?? "Clear selection"}
|
|
61
|
+
disabled={rest.disabled}
|
|
62
|
+
class="text-muted-foreground hover:text-foreground absolute top-1/2 right-9 flex -translate-y-1/2 items-center rounded-sm p-1 transition-colors disabled:pointer-events-none disabled:opacity-50"
|
|
63
|
+
onClick={() => own.onClear?.()}
|
|
64
|
+
>
|
|
65
|
+
<Icon icon="lucide:circle-x" width={16} height={16} />
|
|
66
|
+
</button>
|
|
67
|
+
</Show>
|
|
68
|
+
</div>
|
|
69
|
+
);
|
|
68
70
|
}
|
package/src/solid/popover.tsx
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { Popover as PopoverPrimitive, usePopoverContext } from "@kobalte/core/popover";
|
|
2
2
|
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
type Component,
|
|
4
|
+
type ComponentProps,
|
|
5
|
+
createContext,
|
|
6
|
+
splitProps,
|
|
7
|
+
useContext,
|
|
8
8
|
} from "solid-js";
|
|
9
9
|
import { INPUT_SURFACE } from "../lib/input-classes.js";
|
|
10
10
|
import { Z_CLASS } from "../lib/layers.js";
|
|
@@ -15,7 +15,7 @@ import { cn } from "../lib/utils.js";
|
|
|
15
15
|
type PopoverSurface = "overlay" | "field";
|
|
16
16
|
|
|
17
17
|
const PopoverSurfaceContext = createContext<() => PopoverSurface>(
|
|
18
|
-
|
|
18
|
+
() => "overlay" as PopoverSurface,
|
|
19
19
|
);
|
|
20
20
|
|
|
21
21
|
/* The expanding field panel: opaque (the trigger sits underneath it), bound to
|
|
@@ -26,25 +26,25 @@ const FIELD_PANEL = `${INPUT_SURFACE} ${FIELD_MOTION} relative ${Z_CLASS.overlay
|
|
|
26
26
|
const OVERLAY_PANEL = `${FLOATING_PANEL} ${MORPH_MOTION} ${STAGGER} w-72 p-4`;
|
|
27
27
|
|
|
28
28
|
type PopoverProps = ComponentProps<typeof PopoverPrimitive> & {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
29
|
+
/** "field" anchors the panel over the trigger's top edge, so the field reads
|
|
30
|
+
* as expanding into its panel instead of a box dropping in below it. */
|
|
31
|
+
surface?: PopoverSurface;
|
|
32
32
|
};
|
|
33
33
|
|
|
34
34
|
const PopoverRoot: Component<PopoverProps> = (props) => {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
35
|
+
const [local, rest] = splitProps(props, ["surface", "gutter", "getAnchorRect"]);
|
|
36
|
+
const surface = () => local.surface ?? "overlay";
|
|
37
|
+
return (
|
|
38
|
+
<PopoverSurfaceContext.Provider value={surface}>
|
|
39
|
+
<PopoverPrimitive
|
|
40
|
+
gutter={local.gutter ?? 0}
|
|
41
|
+
getAnchorRect={local.getAnchorRect ?? anchorToTriggerTop}
|
|
42
|
+
flip={false}
|
|
43
|
+
overlap
|
|
44
|
+
{...rest}
|
|
45
|
+
/>
|
|
46
|
+
</PopoverSurfaceContext.Provider>
|
|
47
|
+
);
|
|
48
48
|
};
|
|
49
49
|
|
|
50
50
|
/* Omit<T, never> keeps the statics and drops the call signature, so the
|
|
@@ -55,49 +55,49 @@ type PopoverStatics = Omit<typeof PopoverPrimitive, never>;
|
|
|
55
55
|
* root; carry them across so `Popover.Portal` keeps resolving for hosts that
|
|
56
56
|
* reach past the wrapped parts. */
|
|
57
57
|
const Popover = Object.assign(PopoverRoot, PopoverPrimitive) as Component<PopoverProps> &
|
|
58
|
-
|
|
58
|
+
PopoverStatics;
|
|
59
59
|
|
|
60
60
|
const PopoverTrigger: Component<ComponentProps<typeof PopoverPrimitive.Trigger>> = (props) => {
|
|
61
|
-
|
|
61
|
+
return <PopoverPrimitive.Trigger data-slot="popover-trigger" {...props} />;
|
|
62
62
|
};
|
|
63
63
|
|
|
64
64
|
type PopoverContentProps = ComponentProps<typeof PopoverPrimitive.Content> & {
|
|
65
|
-
|
|
65
|
+
surface?: PopoverSurface;
|
|
66
66
|
};
|
|
67
67
|
|
|
68
68
|
const PopoverContent: Component<PopoverContentProps> = (props) => {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
69
|
+
const [local, rest] = splitProps(props, ["class", "surface"]);
|
|
70
|
+
const fromRoot = useContext(PopoverSurfaceContext);
|
|
71
|
+
const surface = () => local.surface ?? fromRoot();
|
|
72
|
+
const popover = usePopoverContext();
|
|
73
|
+
// The morph starts as the trigger's box (pill radius clamped to h/2). A
|
|
74
|
+
// field picker has an Anchor, not a Trigger, and keeps its clip reveal.
|
|
75
|
+
const writeMorphStart = (el: HTMLElement) => {
|
|
76
|
+
const trigger = popover.triggerRef();
|
|
77
|
+
if (!trigger || surface() === "field") return;
|
|
78
|
+
const height = trigger.getBoundingClientRect().height;
|
|
79
|
+
const radius = Math.min(
|
|
80
|
+
Number.parseFloat(getComputedStyle(trigger).borderTopLeftRadius) || 0,
|
|
81
|
+
height / 2,
|
|
82
|
+
);
|
|
83
|
+
el.style.setProperty("--morph-h", `${height}px`);
|
|
84
|
+
el.style.setProperty("--morph-radius", `${radius}px`);
|
|
85
|
+
};
|
|
86
|
+
return (
|
|
87
|
+
<PopoverPrimitive.Portal>
|
|
88
|
+
<PopoverPrimitive.Content
|
|
89
|
+
ref={writeMorphStart}
|
|
90
|
+
data-slot="popover-content"
|
|
91
|
+
data-surface={surface()}
|
|
92
|
+
class={cn(surface() === "field" ? FIELD_PANEL : OVERLAY_PANEL, local.class)}
|
|
93
|
+
{...rest}
|
|
94
|
+
/>
|
|
95
|
+
</PopoverPrimitive.Portal>
|
|
96
|
+
);
|
|
97
97
|
};
|
|
98
98
|
|
|
99
99
|
const PopoverAnchor: Component<ComponentProps<typeof PopoverPrimitive.Anchor>> = (props) => {
|
|
100
|
-
|
|
100
|
+
return <PopoverPrimitive.Anchor data-slot="popover-anchor" {...props} />;
|
|
101
101
|
};
|
|
102
102
|
|
|
103
103
|
export { Popover, PopoverAnchor, PopoverContent, PopoverTrigger };
|
|
@@ -11,79 +11,79 @@ const SHAPE = { wide: "aspect-[16/10]", tile: "aspect-[5/4]" } as const;
|
|
|
11
11
|
/* The face is the affordance: the radio control is suppressed and a ring on
|
|
12
12
|
* the face carries the picked state, the focus ring rides the same edge. */
|
|
13
13
|
const TILE_FACE =
|
|
14
|
-
|
|
14
|
+
"relative w-full overflow-hidden rounded-lg border border-border/60 transition-glass duration-200 group-active/preview-tile:scale-[0.97] group-data-[checked]/preview-tile:border-transparent group-data-[checked]/preview-tile:ring-2 group-data-[checked]/preview-tile:ring-primary group-data-[checked]/preview-tile:ring-offset-2 group-data-[checked]/preview-tile:ring-offset-transparent group-has-[:focus-visible]/preview-tile:ring-[3px] group-has-[:focus-visible]/preview-tile:ring-ring/50";
|
|
15
15
|
|
|
16
16
|
export function PreviewTileGroup(props: {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
17
|
+
value: string | null;
|
|
18
|
+
onChange: (value: string) => void;
|
|
19
|
+
"aria-label": string;
|
|
20
|
+
columns?: keyof typeof COLUMNS;
|
|
21
|
+
class?: string;
|
|
22
|
+
children: JSX.Element;
|
|
23
23
|
}) {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
24
|
+
return (
|
|
25
|
+
<RadioGroup
|
|
26
|
+
data-slot="preview-tile-group"
|
|
27
|
+
class={cn("grid gap-2.5", COLUMNS[props.columns ?? 2], props.class)}
|
|
28
|
+
value={props.value ?? ""}
|
|
29
|
+
onChange={props.onChange}
|
|
30
|
+
aria-label={props["aria-label"]}
|
|
31
|
+
>
|
|
32
|
+
{props.children}
|
|
33
|
+
</RadioGroup>
|
|
34
|
+
);
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
/** A choice shown as what it produces: a picture, a preview card, a shape. */
|
|
38
38
|
export function PreviewTile(props: {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
39
|
+
value: string;
|
|
40
|
+
label: string;
|
|
41
|
+
/** A quieter second line under the caption. */
|
|
42
|
+
meta?: string;
|
|
43
|
+
/** Off for pictures that name themselves; the label still reaches assistive tech. */
|
|
44
|
+
caption?: boolean;
|
|
45
|
+
icon?: string;
|
|
46
|
+
shape?: keyof typeof SHAPE;
|
|
47
|
+
disabled?: boolean;
|
|
48
|
+
class?: string;
|
|
49
|
+
/** Fires on every click, including a re-pick of the checked tile. */
|
|
50
|
+
onPick?: () => void;
|
|
51
|
+
children: JSX.Element;
|
|
52
52
|
}) {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
53
|
+
return (
|
|
54
|
+
<RadioGroupItem
|
|
55
|
+
data-slot="preview-tile"
|
|
56
|
+
value={props.value}
|
|
57
|
+
disabled={props.disabled}
|
|
58
|
+
showControl={false}
|
|
59
|
+
onClick={() => !props.disabled && props.onPick?.()}
|
|
60
|
+
class={cn(
|
|
61
|
+
"group/preview-tile min-w-0 [&_[data-slot=radio-group-item-content]]:flex [&_[data-slot=radio-group-item-content]]:flex-col [&_[data-slot=radio-group-item-content]]:gap-1.5",
|
|
62
|
+
props.class,
|
|
63
|
+
)}
|
|
64
|
+
>
|
|
65
|
+
<div data-slot="preview-tile-face" class={cn(TILE_FACE, SHAPE[props.shape ?? "wide"])}>
|
|
66
|
+
{props.children}
|
|
67
|
+
</div>
|
|
68
|
+
<Show when={props.caption ?? true} fallback={<span class="sr-only">{props.label}</span>}>
|
|
69
|
+
<span
|
|
70
|
+
data-slot="preview-tile-caption"
|
|
71
|
+
class="text-muted-foreground group-data-[checked]/preview-tile:text-foreground flex items-center justify-center gap-1 text-xs"
|
|
72
|
+
>
|
|
73
|
+
<Show when={props.icon}>
|
|
74
|
+
{(icon) => <Icon icon={icon()} width={12} height={12} aria-hidden="true" />}
|
|
75
|
+
</Show>
|
|
76
|
+
{props.label}
|
|
77
|
+
</span>
|
|
78
|
+
<Show when={props.meta}>
|
|
79
|
+
<span
|
|
80
|
+
data-slot="preview-tile-meta"
|
|
81
|
+
class="text-muted-foreground/80 -mt-1 text-center text-[11px] leading-tight"
|
|
82
|
+
>
|
|
83
|
+
{props.meta}
|
|
84
|
+
</span>
|
|
85
|
+
</Show>
|
|
86
|
+
</Show>
|
|
87
|
+
</RadioGroupItem>
|
|
88
|
+
);
|
|
89
89
|
}
|
package/src/solid/progress.tsx
CHANGED
|
@@ -4,28 +4,28 @@ import { FIELD_CHROME } from "../lib/input-classes.js";
|
|
|
4
4
|
import { cn } from "../lib/utils.js";
|
|
5
5
|
|
|
6
6
|
const Progress: Component<
|
|
7
|
-
|
|
7
|
+
ComponentProps<typeof ProgressPrimitive> & { value?: number; tone?: string }
|
|
8
8
|
> = (props) => {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
9
|
+
const [local, rest] = splitProps(props, ["class", "value", "tone"]);
|
|
10
|
+
return (
|
|
11
|
+
<ProgressPrimitive
|
|
12
|
+
data-slot="progress"
|
|
13
|
+
value={local.value}
|
|
14
|
+
class={cn(FIELD_CHROME, "relative h-2 w-full overflow-hidden rounded-full", local.class)}
|
|
15
|
+
{...rest}
|
|
16
|
+
>
|
|
17
|
+
<ProgressPrimitive.Track class="h-full w-full">
|
|
18
|
+
<ProgressPrimitive.Fill
|
|
19
|
+
data-slot="progress-indicator"
|
|
20
|
+
class="glass glass-tint transition-glass h-full w-full flex-1"
|
|
21
|
+
style={{
|
|
22
|
+
"--glass-tone": local.tone ?? "var(--primary)",
|
|
23
|
+
transform: `translateX(-${100 - (local.value || 0)}%)`,
|
|
24
|
+
}}
|
|
25
|
+
/>
|
|
26
|
+
</ProgressPrimitive.Track>
|
|
27
|
+
</ProgressPrimitive>
|
|
28
|
+
);
|
|
29
29
|
};
|
|
30
30
|
|
|
31
31
|
export { Progress };
|
|
@@ -4,62 +4,62 @@ import { FIELD_CHROME } from "../lib/input-classes.js";
|
|
|
4
4
|
import { cn } from "../lib/utils.js";
|
|
5
5
|
|
|
6
6
|
const RadioGroup: Component<ComponentProps<typeof RadioGroupPrimitive>> = (props) => {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
7
|
+
const [local, rest] = splitProps(props, ["class"]);
|
|
8
|
+
return (
|
|
9
|
+
<RadioGroupPrimitive
|
|
10
|
+
data-slot="radio-group"
|
|
11
|
+
class={cn("flex flex-col gap-3", local.class)}
|
|
12
|
+
{...rest}
|
|
13
|
+
/>
|
|
14
|
+
);
|
|
15
15
|
};
|
|
16
16
|
|
|
17
17
|
const RadioGroupItem: Component<
|
|
18
|
-
|
|
18
|
+
ComponentProps<typeof RadioGroupPrimitive.Item> & { showControl?: boolean }
|
|
19
19
|
> = (props) => {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
20
|
+
const [local, rest] = splitProps(props, ["class", "children", "showControl"]);
|
|
21
|
+
return (
|
|
22
|
+
<RadioGroupPrimitive.Item
|
|
23
|
+
data-slot="radio-group-item"
|
|
24
|
+
class={cn("flex", local.class)}
|
|
25
|
+
{...rest}
|
|
26
|
+
>
|
|
27
|
+
<RadioGroupPrimitive.ItemInput class="peer" />
|
|
28
|
+
<RadioGroupPrimitive.ItemLabel
|
|
29
|
+
data-slot="radio-group-item-label"
|
|
30
|
+
class="flex flex-1 cursor-pointer items-center gap-2.5 select-none data-[disabled]:cursor-not-allowed"
|
|
31
|
+
>
|
|
32
|
+
<Show when={local.showControl ?? true}>
|
|
33
|
+
<RadioGroupPrimitive.ItemControl
|
|
34
|
+
data-slot="radio-group-item-control"
|
|
35
|
+
class={cn(
|
|
36
|
+
"transition-glass relative flex aspect-square size-7 shrink-0 items-center justify-center overflow-hidden rounded-full duration-200 ease-out active:scale-90",
|
|
37
|
+
FIELD_CHROME,
|
|
38
|
+
"peer-focus-visible:ring-ring/50 peer-focus-visible:ring-[3px] peer-focus-visible:[--glass-edge:var(--ring)]",
|
|
39
|
+
"data-[invalid]:ring-destructive/20 data-[disabled]:opacity-40 data-[invalid]:[--glass-edge:var(--destructive)]",
|
|
40
|
+
)}
|
|
41
|
+
>
|
|
42
|
+
{/* Gradient backgrounds can't transition; the glass rides an inner element
|
|
43
43
|
that animates in. */}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
44
|
+
<RadioGroupPrimitive.ItemIndicator
|
|
45
|
+
data-slot="radio-group-item-indicator"
|
|
46
|
+
class="glass glass-tint zoom-in-50 fade-in animate-in absolute inset-0 grid place-items-center rounded-full duration-200 [--glass-tone:var(--primary)] [--glass-wash:90%]"
|
|
47
|
+
>
|
|
48
|
+
<span
|
|
49
|
+
data-slot="radio-group-item-dot"
|
|
50
|
+
class="size-[36%] rounded-full [background:oklch(from_var(--primary)_calc((0.42_-_l)*100)_0_0)] dark:[background:oklch(from_var(--primary)_calc((0.6_-_l)*100)_0_0)]"
|
|
51
|
+
/>
|
|
52
|
+
</RadioGroupPrimitive.ItemIndicator>
|
|
53
|
+
</RadioGroupPrimitive.ItemControl>
|
|
54
|
+
</Show>
|
|
55
|
+
{local.children && (
|
|
56
|
+
<div data-slot="radio-group-item-content" class="min-w-0 flex-1 text-sm">
|
|
57
|
+
{local.children}
|
|
58
|
+
</div>
|
|
59
|
+
)}
|
|
60
|
+
</RadioGroupPrimitive.ItemLabel>
|
|
61
|
+
</RadioGroupPrimitive.Item>
|
|
62
|
+
);
|
|
63
63
|
};
|
|
64
64
|
|
|
65
65
|
export { RadioGroup, RadioGroupItem };
|