@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.
Files changed (145) hide show
  1. package/dist/index.d.ts +1 -1
  2. package/dist/index.js +1 -1
  3. package/dist/lib/use-is-mobile.d.ts +3 -1
  4. package/dist/solid/index.d.ts +9 -9
  5. package/dist/solid/index.js +5431 -5424
  6. package/dist/{utils-CMk7R3zM.js → utils-D5blHO4O.js} +624 -622
  7. package/package.json +128 -126
  8. package/scripts/check-gallery.ts +142 -142
  9. package/scripts/check-pack.ts +13 -13
  10. package/scripts/check-structural-classes.ts +20 -20
  11. package/scripts/check-tokens.ts +27 -27
  12. package/scripts/check-ui-drift.mjs +103 -103
  13. package/src/index.ts +75 -80
  14. package/src/lib/alert-tones.ts +41 -41
  15. package/src/lib/anchor-placement.ts +21 -21
  16. package/src/lib/button-variants.ts +28 -28
  17. package/src/lib/card-classes.ts +9 -9
  18. package/src/lib/carousel-classes.ts +14 -14
  19. package/src/lib/glass-tone.ts +11 -11
  20. package/src/lib/input-classes.ts +6 -6
  21. package/src/lib/layers.ts +4 -4
  22. package/src/lib/logo-lockup.ts +8 -8
  23. package/src/lib/menu-classes.ts +2 -2
  24. package/src/lib/motion-classes.ts +8 -8
  25. package/src/lib/motion-window.ts +24 -24
  26. package/src/lib/overlay-classes.ts +6 -6
  27. package/src/lib/pill-classes.ts +3 -3
  28. package/src/lib/position-bar-classes.ts +1 -1
  29. package/src/lib/spotlight-geometry.ts +67 -67
  30. package/src/lib/thumb-classes.ts +2 -2
  31. package/src/lib/tier-badge.ts +16 -16
  32. package/src/lib/use-is-mobile.ts +17 -14
  33. package/src/lib/utils.ts +1 -1
  34. package/src/solid/accordion.tsx +41 -41
  35. package/src/solid/alert-dialog.tsx +95 -95
  36. package/src/solid/alert.tsx +88 -88
  37. package/src/solid/area-picker.tsx +204 -204
  38. package/src/solid/aspect-ratio.tsx +13 -13
  39. package/src/solid/avatar.tsx +27 -27
  40. package/src/solid/badge.tsx +49 -49
  41. package/src/solid/bottom-sheet/arbitration.ts +22 -22
  42. package/src/solid/bottom-sheet/bottom-sheet.tsx +394 -394
  43. package/src/solid/bottom-sheet/drag-controller.ts +201 -201
  44. package/src/solid/bottom-sheet/focus-trap.ts +51 -47
  45. package/src/solid/bottom-sheet/index.ts +12 -12
  46. package/src/solid/bottom-sheet/keyboard.ts +25 -25
  47. package/src/solid/bottom-sheet/scroll-lock.ts +46 -46
  48. package/src/solid/bottom-sheet/state-machine.ts +28 -28
  49. package/src/solid/bottom-sheet/velocity.ts +29 -29
  50. package/src/solid/breadcrumb.tsx +76 -76
  51. package/src/solid/button-group.tsx +46 -46
  52. package/src/solid/button.tsx +19 -19
  53. package/src/solid/card.tsx +67 -67
  54. package/src/solid/carousel.tsx +246 -246
  55. package/src/solid/charts.tsx +253 -253
  56. package/src/solid/checkbox.tsx +51 -51
  57. package/src/solid/collapsible.tsx +22 -22
  58. package/src/solid/color-disc.tsx +213 -213
  59. package/src/solid/color-slider.tsx +81 -81
  60. package/src/solid/color-wheel.tsx +61 -61
  61. package/src/solid/context-menu.tsx +63 -63
  62. package/src/solid/copy-button.tsx +31 -31
  63. package/src/solid/count-pill.tsx +11 -11
  64. package/src/solid/dashboard-preview.tsx +104 -104
  65. package/src/solid/data-table.tsx +228 -228
  66. package/src/solid/dialog-parts.tsx +127 -127
  67. package/src/solid/dialog.tsx +113 -113
  68. package/src/solid/dock-paging.ts +9 -9
  69. package/src/solid/dock.tsx +339 -339
  70. package/src/solid/docked-panel.tsx +35 -35
  71. package/src/solid/dropdown-menu.tsx +77 -77
  72. package/src/solid/empty.tsx +70 -70
  73. package/src/solid/entity-data.ts +38 -38
  74. package/src/solid/entity-selector.tsx +634 -634
  75. package/src/solid/field.tsx +205 -205
  76. package/src/solid/form.tsx +159 -159
  77. package/src/solid/hero-action.tsx +85 -85
  78. package/src/solid/hover-card.tsx +11 -11
  79. package/src/solid/icon-picker.tsx +401 -401
  80. package/src/solid/icon.tsx +101 -78
  81. package/src/solid/image-picker.tsx +416 -414
  82. package/src/solid/index.ts +265 -304
  83. package/src/solid/input-group.tsx +123 -123
  84. package/src/solid/input-otp.tsx +143 -143
  85. package/src/solid/input.tsx +4 -4
  86. package/src/solid/item.tsx +130 -130
  87. package/src/solid/kbd.tsx +20 -20
  88. package/src/solid/label.tsx +12 -12
  89. package/src/solid/list-reorder.ts +122 -122
  90. package/src/solid/logo.tsx +60 -60
  91. package/src/solid/media-copy.ts +21 -21
  92. package/src/solid/media-store.ts +56 -56
  93. package/src/solid/media-tile.tsx +85 -85
  94. package/src/solid/menu-parts.tsx +164 -164
  95. package/src/solid/number-field.tsx +56 -56
  96. package/src/solid/option-card.tsx +164 -164
  97. package/src/solid/ornament.tsx +43 -43
  98. package/src/solid/overlay.tsx +4 -4
  99. package/src/solid/page-header.tsx +75 -75
  100. package/src/solid/pagination.tsx +80 -80
  101. package/src/solid/password-input.tsx +51 -51
  102. package/src/solid/picker-row.tsx +83 -83
  103. package/src/solid/picker-search.tsx +65 -63
  104. package/src/solid/picker-trigger.tsx +59 -57
  105. package/src/solid/popover.tsx +54 -54
  106. package/src/solid/preview-tile.tsx +67 -67
  107. package/src/solid/progress.tsx +21 -21
  108. package/src/solid/radio-group.tsx +51 -51
  109. package/src/solid/resizable.tsx +128 -128
  110. package/src/solid/responsive-dialog.tsx +134 -134
  111. package/src/solid/schema-form.tsx +743 -743
  112. package/src/solid/scope-indicator.tsx +5 -5
  113. package/src/solid/scroll-area.tsx +16 -16
  114. package/src/solid/section-card.tsx +281 -281
  115. package/src/solid/select.tsx +101 -101
  116. package/src/solid/separator.tsx +25 -25
  117. package/src/solid/settings-row.tsx +122 -122
  118. package/src/solid/sheet.tsx +96 -96
  119. package/src/solid/skeleton.tsx +8 -8
  120. package/src/solid/slider.tsx +132 -132
  121. package/src/solid/sliding-indicator.tsx +280 -265
  122. package/src/solid/sonner.tsx +164 -164
  123. package/src/solid/spinner.tsx +12 -12
  124. package/src/solid/spotlight.tsx +140 -140
  125. package/src/solid/step-indicator.tsx +18 -18
  126. package/src/solid/swatch-picker.tsx +38 -38
  127. package/src/solid/switch.tsx +52 -52
  128. package/src/solid/table.tsx +63 -63
  129. package/src/solid/tabs.tsx +93 -93
  130. package/src/solid/textarea.tsx +8 -8
  131. package/src/solid/toggle-group.tsx +83 -83
  132. package/src/solid/toggle.tsx +33 -33
  133. package/src/solid/tooltip.tsx +16 -16
  134. package/src/solid/widget-card.tsx +90 -90
  135. package/src/solid/widget-identity.tsx +99 -99
  136. package/src/solid/widget-trust-badge.tsx +20 -20
  137. package/src/styles/globals.css +316 -319
  138. package/src/styles/theme.css +448 -448
  139. package/src/tokens/hex.ts +29 -29
  140. package/src/tokens/material.ts +75 -75
  141. package/src/tokens/presets.ts +303 -303
  142. package/src/tokens/readability.ts +32 -32
  143. package/src/tokens/theme-colors.ts +95 -95
  144. package/src/tokens/theme-css.ts +22 -22
  145. 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
- position: string;
5
- top: string;
6
- left: string;
7
- right: string;
8
- width: string;
9
- overflow: string;
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
- 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);
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
- refcount++;
20
- if (refcount > 1) return;
21
- if (typeof document === "undefined") return;
19
+ refcount++;
20
+ if (refcount > 1) return;
21
+ if (typeof document === "undefined") return;
22
22
 
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
- };
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
- 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
- }
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
- refcount = Math.max(0, refcount - 1);
47
- if (refcount > 0) return;
48
- if (typeof document === "undefined" || !savedBodyStyles) return;
46
+ refcount = Math.max(0, refcount - 1);
47
+ if (refcount > 0) return;
48
+ if (typeof document === "undefined" || !savedBodyStyles) return;
49
49
 
50
- const body = document.body;
51
- const wasIOS = body.style.position === "fixed";
50
+ const body = document.body;
51
+ const wasIOS = body.style.position === "fixed";
52
52
 
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;
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
- if (wasIOS) {
62
- window.scrollTo(0, savedScrollY);
63
- }
61
+ if (wasIOS) {
62
+ window.scrollTo(0, savedScrollY);
63
+ }
64
64
  }
@@ -1,40 +1,40 @@
1
1
  export type SheetState =
2
- | "closed"
3
- | "opening"
4
- | "open"
5
- | "pressing"
6
- | "dragging"
7
- | "snapping"
8
- | "closing";
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
- { 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" },
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
- return VALID.some((t) => t.from === from && t.to === to);
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
- 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
- }
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
- y: number;
5
- t: number;
4
+ y: number;
5
+ t: number;
6
6
  }
7
7
 
8
8
  const MAX_SAMPLES = 16;
9
9
 
10
10
  export class VelocityTracker {
11
- private samples: Sample[] = [];
11
+ private samples: Sample[] = [];
12
12
 
13
- reset(): void {
14
- this.samples.length = 0;
15
- }
13
+ reset(): void {
14
+ this.samples.length = 0;
15
+ }
16
16
 
17
- add(y: number, t: number): void {
18
- this.samples.push({ y, t });
19
- if (this.samples.length > MAX_SAMPLES) this.samples.shift();
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
- /** 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;
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
- 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
- }
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
  }
@@ -1,105 +1,105 @@
1
1
  import {
2
- type Component,
3
- type ComponentProps,
4
- type ParentComponent,
5
- splitProps,
6
- type ValidComponent,
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
- return <nav aria-label="breadcrumb" data-slot="breadcrumb" {...props} />;
13
+ return <nav aria-label="breadcrumb" data-slot="breadcrumb" {...props} />;
14
14
  };
15
15
 
16
16
  const BreadcrumbList: Component<ComponentProps<"ol">> = (props) => {
17
- const [local, rest] = splitProps(props, ["class"]);
18
- return (
19
- <ol
20
- data-slot="breadcrumb-list"
21
- class={cn(
22
- "flex flex-wrap items-center gap-1.5 break-words text-muted-foreground text-sm sm:gap-2.5",
23
- local.class,
24
- )}
25
- {...rest}
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
- 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
- );
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
- 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("transition-colors hover:text-foreground", local.class)}
49
- {...rest}
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
- const [local, rest] = splitProps(props, ["class"]);
56
- return (
57
- <span
58
- data-slot="breadcrumb-page"
59
- aria-current="page"
60
- class={cn("font-normal text-foreground", local.class)}
61
- {...rest}
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
- 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
- );
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
- 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
- );
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
- Breadcrumb,
99
- BreadcrumbEllipsis,
100
- BreadcrumbItem,
101
- BreadcrumbLink,
102
- BreadcrumbList,
103
- BreadcrumbPage,
104
- BreadcrumbSeparator,
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
- 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
- },
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
- props,
23
+ props,
24
24
  ) => {
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
- );
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
- 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 flex items-center gap-2 rounded-md px-4 font-medium text-muted-foreground text-sm [--glass-edge:var(--border)] [&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none",
44
- local.class,
45
- )}
46
- {...rest}
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
- 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
- "!m-0 relative self-stretch bg-input data-[orientation=vertical]:h-auto",
59
- local.class,
60
- )}
61
- {...rest}
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 };
@@ -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
- 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
- );
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
- return (
23
- <span
24
- data-slot="button-well"
25
- class={cn(
26
- "grid size-12 shrink-0 place-items-center rounded-full bg-foreground/15",
27
- props.class,
28
- )}
29
- >
30
- {props.children ?? (props.icon ? <Icon icon={props.icon} /> : null)}
31
- </span>
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 };