@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
|
@@ -1,64 +1,64 @@
|
|
|
1
1
|
let refcount = 0;
|
|
2
2
|
let savedScrollY = 0;
|
|
3
3
|
let savedBodyStyles: {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
4
|
+
position: string;
|
|
5
|
+
top: string;
|
|
6
|
+
left: string;
|
|
7
|
+
right: string;
|
|
8
|
+
width: string;
|
|
9
|
+
overflow: string;
|
|
10
10
|
} | null = null;
|
|
11
11
|
|
|
12
12
|
function isIOS(): boolean {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
if (typeof navigator === "undefined") return false;
|
|
14
|
+
const ua = navigator.userAgent;
|
|
15
|
+
return /iP(ad|hone|od)/.test(ua) || (ua.includes("Mac") && "ontouchend" in document);
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
export function acquireScrollLock(): void {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
refcount++;
|
|
20
|
+
if (refcount > 1) return;
|
|
21
|
+
if (typeof document === "undefined") return;
|
|
22
22
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
23
|
+
const body = document.body;
|
|
24
|
+
savedBodyStyles = {
|
|
25
|
+
position: body.style.position,
|
|
26
|
+
top: body.style.top,
|
|
27
|
+
left: body.style.left,
|
|
28
|
+
right: body.style.right,
|
|
29
|
+
width: body.style.width,
|
|
30
|
+
overflow: body.style.overflow,
|
|
31
|
+
};
|
|
32
32
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
33
|
+
if (isIOS()) {
|
|
34
|
+
savedScrollY = window.scrollY;
|
|
35
|
+
body.style.position = "fixed";
|
|
36
|
+
body.style.top = `-${savedScrollY}px`;
|
|
37
|
+
body.style.left = "0";
|
|
38
|
+
body.style.right = "0";
|
|
39
|
+
body.style.width = "100%";
|
|
40
|
+
} else {
|
|
41
|
+
body.style.overflow = "hidden";
|
|
42
|
+
}
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
export function releaseScrollLock(): void {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
46
|
+
refcount = Math.max(0, refcount - 1);
|
|
47
|
+
if (refcount > 0) return;
|
|
48
|
+
if (typeof document === "undefined" || !savedBodyStyles) return;
|
|
49
49
|
|
|
50
|
-
|
|
51
|
-
|
|
50
|
+
const body = document.body;
|
|
51
|
+
const wasIOS = body.style.position === "fixed";
|
|
52
52
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
53
|
+
body.style.position = savedBodyStyles.position;
|
|
54
|
+
body.style.top = savedBodyStyles.top;
|
|
55
|
+
body.style.left = savedBodyStyles.left;
|
|
56
|
+
body.style.right = savedBodyStyles.right;
|
|
57
|
+
body.style.width = savedBodyStyles.width;
|
|
58
|
+
body.style.overflow = savedBodyStyles.overflow;
|
|
59
|
+
savedBodyStyles = null;
|
|
60
60
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
61
|
+
if (wasIOS) {
|
|
62
|
+
window.scrollTo(0, savedScrollY);
|
|
63
|
+
}
|
|
64
64
|
}
|
|
@@ -1,40 +1,40 @@
|
|
|
1
1
|
export type SheetState =
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
2
|
+
| "closed"
|
|
3
|
+
| "opening"
|
|
4
|
+
| "open"
|
|
5
|
+
| "pressing"
|
|
6
|
+
| "dragging"
|
|
7
|
+
| "snapping"
|
|
8
|
+
| "closing";
|
|
9
9
|
|
|
10
10
|
type Transition = { from: SheetState; to: SheetState };
|
|
11
11
|
|
|
12
12
|
const VALID: Transition[] = [
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
13
|
+
{ from: "closed", to: "opening" },
|
|
14
|
+
{ from: "opening", to: "open" },
|
|
15
|
+
{ from: "opening", to: "closing" },
|
|
16
|
+
{ from: "open", to: "pressing" },
|
|
17
|
+
{ from: "open", to: "closing" },
|
|
18
|
+
{ from: "pressing", to: "dragging" },
|
|
19
|
+
{ from: "pressing", to: "open" },
|
|
20
|
+
{ from: "pressing", to: "closing" },
|
|
21
|
+
{ from: "dragging", to: "snapping" },
|
|
22
|
+
{ from: "dragging", to: "closing" },
|
|
23
|
+
{ from: "snapping", to: "open" },
|
|
24
|
+
{ from: "snapping", to: "closing" },
|
|
25
|
+
{ from: "closing", to: "closed" },
|
|
26
|
+
{ from: "closing", to: "opening" },
|
|
27
27
|
];
|
|
28
28
|
|
|
29
29
|
export function canTransition(from: SheetState, to: SheetState): boolean {
|
|
30
|
-
|
|
30
|
+
return VALID.some((t) => t.from === from && t.to === to);
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
export function assertTransition(from: SheetState, to: SheetState): void {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
34
|
+
if (from === to) return;
|
|
35
|
+
if (!canTransition(from, to)) {
|
|
36
|
+
if (typeof process !== "undefined" && process.env?.NODE_ENV !== "production") {
|
|
37
|
+
throw new Error(`[Sheet] invalid transition: ${from} → ${to}`);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
40
|
}
|
|
@@ -1,42 +1,42 @@
|
|
|
1
1
|
import { VELOCITY_WINDOW_MS } from "./constants.js";
|
|
2
2
|
|
|
3
3
|
interface Sample {
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
y: number;
|
|
5
|
+
t: number;
|
|
6
6
|
}
|
|
7
7
|
|
|
8
8
|
const MAX_SAMPLES = 16;
|
|
9
9
|
|
|
10
10
|
export class VelocityTracker {
|
|
11
|
-
|
|
11
|
+
private samples: Sample[] = [];
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
reset(): void {
|
|
14
|
+
this.samples.length = 0;
|
|
15
|
+
}
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
17
|
+
add(y: number, t: number): void {
|
|
18
|
+
this.samples.push({ y, t });
|
|
19
|
+
if (this.samples.length > MAX_SAMPLES) this.samples.shift();
|
|
20
|
+
}
|
|
21
21
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
22
|
+
/** Weighted velocity over the last VELOCITY_WINDOW_MS, in px/ms. */
|
|
23
|
+
compute(now: number): number {
|
|
24
|
+
const recent = this.samples.filter((s) => now - s.t <= VELOCITY_WINDOW_MS);
|
|
25
|
+
if (recent.length < 2) return 0;
|
|
26
26
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
27
|
+
let weightedDy = 0;
|
|
28
|
+
let weightedDt = 0;
|
|
29
|
+
for (let i = 1; i < recent.length; i++) {
|
|
30
|
+
const prev = recent[i - 1];
|
|
31
|
+
const cur = recent[i];
|
|
32
|
+
if (!prev || !cur) continue;
|
|
33
|
+
const dy = cur.y - prev.y;
|
|
34
|
+
const dt = cur.t - prev.t || 1;
|
|
35
|
+
const w = i / recent.length;
|
|
36
|
+
weightedDy += dy * w;
|
|
37
|
+
weightedDt += dt * w;
|
|
38
|
+
}
|
|
39
|
+
if (weightedDt === 0) return 0;
|
|
40
|
+
return weightedDy / weightedDt;
|
|
41
|
+
}
|
|
42
42
|
}
|
package/src/solid/breadcrumb.tsx
CHANGED
|
@@ -1,105 +1,105 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
type Component,
|
|
3
|
+
type ComponentProps,
|
|
4
|
+
type ParentComponent,
|
|
5
|
+
splitProps,
|
|
6
|
+
type ValidComponent,
|
|
7
7
|
} from "solid-js";
|
|
8
8
|
import { Dynamic } from "solid-js/web";
|
|
9
9
|
import { cn } from "../lib/utils.js";
|
|
10
10
|
import { Icon } from "./icon.js";
|
|
11
11
|
|
|
12
12
|
const Breadcrumb: Component<ComponentProps<"nav">> = (props) => {
|
|
13
|
-
|
|
13
|
+
return <nav aria-label="breadcrumb" data-slot="breadcrumb" {...props} />;
|
|
14
14
|
};
|
|
15
15
|
|
|
16
16
|
const BreadcrumbList: Component<ComponentProps<"ol">> = (props) => {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
17
|
+
const [local, rest] = splitProps(props, ["class"]);
|
|
18
|
+
return (
|
|
19
|
+
<ol
|
|
20
|
+
data-slot="breadcrumb-list"
|
|
21
|
+
class={cn(
|
|
22
|
+
"text-muted-foreground flex flex-wrap items-center gap-1.5 text-sm break-words sm:gap-2.5",
|
|
23
|
+
local.class,
|
|
24
|
+
)}
|
|
25
|
+
{...rest}
|
|
26
|
+
/>
|
|
27
|
+
);
|
|
28
28
|
};
|
|
29
29
|
|
|
30
30
|
const BreadcrumbItem: Component<ComponentProps<"li">> = (props) => {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
31
|
+
const [local, rest] = splitProps(props, ["class"]);
|
|
32
|
+
return (
|
|
33
|
+
<li
|
|
34
|
+
data-slot="breadcrumb-item"
|
|
35
|
+
class={cn("inline-flex items-center gap-1.5", local.class)}
|
|
36
|
+
{...rest}
|
|
37
|
+
/>
|
|
38
|
+
);
|
|
39
39
|
};
|
|
40
40
|
|
|
41
41
|
const BreadcrumbLink: Component<ComponentProps<"a"> & { as?: ValidComponent }> = (props) => {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
42
|
+
const [local, rest] = splitProps(props, ["class", "as"]);
|
|
43
|
+
const Comp = () => local.as || "a";
|
|
44
|
+
return (
|
|
45
|
+
<Dynamic
|
|
46
|
+
component={Comp()}
|
|
47
|
+
data-slot="breadcrumb-link"
|
|
48
|
+
class={cn("hover:text-foreground transition-colors", local.class)}
|
|
49
|
+
{...rest}
|
|
50
|
+
/>
|
|
51
|
+
);
|
|
52
52
|
};
|
|
53
53
|
|
|
54
54
|
const BreadcrumbPage: Component<ComponentProps<"span">> = (props) => {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
55
|
+
const [local, rest] = splitProps(props, ["class"]);
|
|
56
|
+
return (
|
|
57
|
+
<span
|
|
58
|
+
data-slot="breadcrumb-page"
|
|
59
|
+
aria-current="page"
|
|
60
|
+
class={cn("text-foreground font-normal", local.class)}
|
|
61
|
+
{...rest}
|
|
62
|
+
/>
|
|
63
|
+
);
|
|
64
64
|
};
|
|
65
65
|
|
|
66
66
|
const BreadcrumbSeparator: ParentComponent<ComponentProps<"li">> = (props) => {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
67
|
+
const [local, rest] = splitProps(props, ["children", "class"]);
|
|
68
|
+
return (
|
|
69
|
+
<li
|
|
70
|
+
data-slot="breadcrumb-separator"
|
|
71
|
+
role="presentation"
|
|
72
|
+
aria-hidden="true"
|
|
73
|
+
class={cn("[&>svg]:size-3.5", local.class)}
|
|
74
|
+
{...rest}
|
|
75
|
+
>
|
|
76
|
+
{local.children ?? <Icon icon="lucide:chevron-right" width={14} height={14} />}
|
|
77
|
+
</li>
|
|
78
|
+
);
|
|
79
79
|
};
|
|
80
80
|
|
|
81
81
|
const BreadcrumbEllipsis: Component<ComponentProps<"span">> = (props) => {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
82
|
+
const [local, rest] = splitProps(props, ["class"]);
|
|
83
|
+
return (
|
|
84
|
+
<span
|
|
85
|
+
data-slot="breadcrumb-ellipsis"
|
|
86
|
+
role="presentation"
|
|
87
|
+
aria-hidden="true"
|
|
88
|
+
class={cn("flex size-9 items-center justify-center", local.class)}
|
|
89
|
+
{...rest}
|
|
90
|
+
>
|
|
91
|
+
<Icon icon="lucide:ellipsis" width={16} height={16} class="size-4" />
|
|
92
|
+
<span class="sr-only">More</span>
|
|
93
|
+
</span>
|
|
94
|
+
);
|
|
95
95
|
};
|
|
96
96
|
|
|
97
97
|
export {
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
98
|
+
Breadcrumb,
|
|
99
|
+
BreadcrumbEllipsis,
|
|
100
|
+
BreadcrumbItem,
|
|
101
|
+
BreadcrumbLink,
|
|
102
|
+
BreadcrumbList,
|
|
103
|
+
BreadcrumbPage,
|
|
104
|
+
BreadcrumbSeparator,
|
|
105
105
|
};
|
|
@@ -5,62 +5,62 @@ import { cn } from "../lib/utils.js";
|
|
|
5
5
|
import { Separator } from "./separator.js";
|
|
6
6
|
|
|
7
7
|
const buttonGroupVariants = cva({
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
8
|
+
base: "flex w-fit items-stretch has-[>[data-slot=button-group]]:gap-2 [&>*]:focus-visible:relative [&>*]:focus-visible:z-10 has-[select[aria-hidden=true]:last-child]:[&>[data-slot=select-trigger]:last-of-type]:rounded-r-md [&>[data-slot=select-trigger]:not([class*='w-'])]:w-fit [&>input]:flex-1",
|
|
9
|
+
variants: {
|
|
10
|
+
orientation: {
|
|
11
|
+
horizontal:
|
|
12
|
+
"[&>*:not(:first-child)]:rounded-l-none [&>*:not(:first-child)]:border-l-0 [&>*:not(:last-child)]:rounded-r-none",
|
|
13
|
+
vertical:
|
|
14
|
+
"flex-col [&>*:not(:first-child)]:rounded-t-none [&>*:not(:first-child)]:border-t-0 [&>*:not(:last-child)]:rounded-b-none",
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
defaultVariants: {
|
|
18
|
+
orientation: "horizontal",
|
|
19
|
+
},
|
|
20
20
|
});
|
|
21
21
|
|
|
22
22
|
const ButtonGroup: Component<ComponentProps<"div"> & VariantProps<typeof buttonGroupVariants>> = (
|
|
23
|
-
|
|
23
|
+
props,
|
|
24
24
|
) => {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
25
|
+
const [local, rest] = splitProps(props, ["class", "orientation"] as const);
|
|
26
|
+
return (
|
|
27
|
+
<div
|
|
28
|
+
data-slot="button-group"
|
|
29
|
+
data-orientation={local.orientation}
|
|
30
|
+
class={cn(buttonGroupVariants({ orientation: local.orientation }), local.class)}
|
|
31
|
+
{...rest}
|
|
32
|
+
/>
|
|
33
|
+
);
|
|
34
34
|
};
|
|
35
35
|
|
|
36
36
|
const ButtonGroupText: Component<ComponentProps<"div"> & { as?: ValidComponent }> = (props) => {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
37
|
+
const [local, rest] = splitProps(props, ["class", "as"] as const);
|
|
38
|
+
const Comp = () => local.as || "div";
|
|
39
|
+
return (
|
|
40
|
+
<Dynamic
|
|
41
|
+
component={Comp()}
|
|
42
|
+
class={cn(
|
|
43
|
+
"glass text-muted-foreground flex items-center gap-2 rounded-md px-4 text-sm font-medium [--glass-edge:var(--border)] [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4",
|
|
44
|
+
local.class,
|
|
45
|
+
)}
|
|
46
|
+
{...rest}
|
|
47
|
+
/>
|
|
48
|
+
);
|
|
49
49
|
};
|
|
50
50
|
|
|
51
51
|
const ButtonGroupSeparator: Component<ComponentProps<typeof Separator>> = (props) => {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
52
|
+
const [local, rest] = splitProps(props, ["class", "orientation"] as const);
|
|
53
|
+
return (
|
|
54
|
+
<Separator
|
|
55
|
+
data-slot="button-group-separator"
|
|
56
|
+
orientation={local.orientation ?? "vertical"}
|
|
57
|
+
class={cn(
|
|
58
|
+
"bg-input relative !m-0 self-stretch data-[orientation=vertical]:h-auto",
|
|
59
|
+
local.class,
|
|
60
|
+
)}
|
|
61
|
+
{...rest}
|
|
62
|
+
/>
|
|
63
|
+
);
|
|
64
64
|
};
|
|
65
65
|
|
|
66
66
|
export { ButtonGroup, ButtonGroupSeparator, ButtonGroupText, buttonGroupVariants };
|
package/src/solid/button.tsx
CHANGED
|
@@ -8,28 +8,28 @@ import { Icon } from "./icon.js";
|
|
|
8
8
|
type ButtonProps = ComponentProps<typeof KobalteButton> & VariantProps<typeof buttonVariants>;
|
|
9
9
|
|
|
10
10
|
function Button(props: ButtonProps) {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
11
|
+
const [local, others] = splitProps(props, ["class", "variant", "size"] as const);
|
|
12
|
+
return (
|
|
13
|
+
<KobalteButton
|
|
14
|
+
data-slot="button"
|
|
15
|
+
class={cn(buttonVariants({ variant: local.variant, size: local.size }), local.class)}
|
|
16
|
+
{...others}
|
|
17
|
+
/>
|
|
18
|
+
);
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
function ButtonWell(props: { icon?: string; children?: JSX.Element; class?: string }) {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
22
|
+
return (
|
|
23
|
+
<span
|
|
24
|
+
data-slot="button-well"
|
|
25
|
+
class={cn(
|
|
26
|
+
"bg-foreground/15 grid size-12 shrink-0 place-items-center rounded-full",
|
|
27
|
+
props.class,
|
|
28
|
+
)}
|
|
29
|
+
>
|
|
30
|
+
{props.children ?? (props.icon ? <Icon icon={props.icon} /> : null)}
|
|
31
|
+
</span>
|
|
32
|
+
);
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
export { Button, ButtonWell, buttonVariants };
|