@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.
Files changed (154) 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/alert-dialog.d.ts +7 -1
  5. package/dist/solid/bottom-sheet/bottom-sheet.d.ts +7 -1
  6. package/dist/solid/dialog-parts.d.ts +3 -2
  7. package/dist/solid/dialog.d.ts +7 -1
  8. package/dist/solid/docked-panel.d.ts +7 -1
  9. package/dist/solid/index.d.ts +9 -9
  10. package/dist/solid/index.js +5456 -5447
  11. package/dist/solid/media-store.d.ts +4 -1
  12. package/dist/solid/option-card.d.ts +4 -1
  13. package/dist/solid/responsive-dialog.d.ts +7 -1
  14. package/dist/solid/sheet.d.ts +7 -1
  15. package/dist/{utils-CMk7R3zM.js → utils-D5blHO4O.js} +624 -622
  16. package/package.json +128 -126
  17. package/scripts/check-gallery.ts +142 -142
  18. package/scripts/check-pack.ts +13 -13
  19. package/scripts/check-structural-classes.ts +20 -20
  20. package/scripts/check-tokens.ts +27 -27
  21. package/scripts/check-ui-drift.mjs +103 -103
  22. package/src/index.ts +75 -80
  23. package/src/lib/alert-tones.ts +41 -41
  24. package/src/lib/anchor-placement.ts +21 -21
  25. package/src/lib/button-variants.ts +28 -28
  26. package/src/lib/card-classes.ts +9 -9
  27. package/src/lib/carousel-classes.ts +14 -14
  28. package/src/lib/glass-tone.ts +11 -11
  29. package/src/lib/input-classes.ts +6 -6
  30. package/src/lib/layers.ts +4 -4
  31. package/src/lib/logo-lockup.ts +8 -8
  32. package/src/lib/menu-classes.ts +2 -2
  33. package/src/lib/motion-classes.ts +8 -8
  34. package/src/lib/motion-window.ts +24 -24
  35. package/src/lib/overlay-classes.ts +6 -6
  36. package/src/lib/pill-classes.ts +3 -3
  37. package/src/lib/position-bar-classes.ts +1 -1
  38. package/src/lib/spotlight-geometry.ts +67 -67
  39. package/src/lib/thumb-classes.ts +2 -2
  40. package/src/lib/tier-badge.ts +16 -16
  41. package/src/lib/use-is-mobile.ts +17 -14
  42. package/src/lib/utils.ts +1 -1
  43. package/src/solid/accordion.tsx +41 -41
  44. package/src/solid/alert-dialog.tsx +95 -95
  45. package/src/solid/alert.tsx +88 -88
  46. package/src/solid/area-picker.tsx +204 -204
  47. package/src/solid/aspect-ratio.tsx +13 -13
  48. package/src/solid/avatar.tsx +27 -27
  49. package/src/solid/badge.tsx +49 -49
  50. package/src/solid/bottom-sheet/arbitration.ts +22 -22
  51. package/src/solid/bottom-sheet/bottom-sheet.tsx +394 -394
  52. package/src/solid/bottom-sheet/drag-controller.ts +201 -201
  53. package/src/solid/bottom-sheet/focus-trap.ts +51 -47
  54. package/src/solid/bottom-sheet/index.ts +12 -12
  55. package/src/solid/bottom-sheet/keyboard.ts +25 -25
  56. package/src/solid/bottom-sheet/scroll-lock.ts +46 -46
  57. package/src/solid/bottom-sheet/state-machine.ts +28 -28
  58. package/src/solid/bottom-sheet/velocity.ts +29 -29
  59. package/src/solid/breadcrumb.tsx +76 -76
  60. package/src/solid/button-group.tsx +46 -46
  61. package/src/solid/button.tsx +19 -19
  62. package/src/solid/card.tsx +67 -67
  63. package/src/solid/carousel.tsx +246 -246
  64. package/src/solid/charts.tsx +253 -253
  65. package/src/solid/checkbox.tsx +51 -51
  66. package/src/solid/collapsible.tsx +22 -22
  67. package/src/solid/color-disc.tsx +213 -213
  68. package/src/solid/color-slider.tsx +81 -81
  69. package/src/solid/color-wheel.tsx +61 -61
  70. package/src/solid/context-menu.tsx +63 -63
  71. package/src/solid/copy-button.tsx +31 -31
  72. package/src/solid/count-pill.tsx +11 -11
  73. package/src/solid/dashboard-preview.tsx +104 -104
  74. package/src/solid/data-table.tsx +228 -228
  75. package/src/solid/dialog-parts.tsx +129 -129
  76. package/src/solid/dialog.tsx +113 -113
  77. package/src/solid/dock-paging.ts +9 -9
  78. package/src/solid/dock.tsx +339 -338
  79. package/src/solid/docked-panel.tsx +35 -35
  80. package/src/solid/dropdown-menu.tsx +77 -77
  81. package/src/solid/empty.tsx +70 -70
  82. package/src/solid/entity-data.ts +38 -38
  83. package/src/solid/entity-selector.tsx +634 -634
  84. package/src/solid/field.tsx +205 -205
  85. package/src/solid/form.tsx +159 -159
  86. package/src/solid/hero-action.tsx +85 -85
  87. package/src/solid/hover-card.tsx +11 -11
  88. package/src/solid/icon-picker.tsx +401 -401
  89. package/src/solid/icon.tsx +101 -78
  90. package/src/solid/image-picker.tsx +416 -414
  91. package/src/solid/index.ts +265 -304
  92. package/src/solid/input-group.tsx +123 -123
  93. package/src/solid/input-otp.tsx +143 -143
  94. package/src/solid/input.tsx +4 -4
  95. package/src/solid/item.tsx +130 -130
  96. package/src/solid/kbd.tsx +20 -20
  97. package/src/solid/label.tsx +12 -12
  98. package/src/solid/list-reorder.ts +122 -122
  99. package/src/solid/logo.tsx +60 -60
  100. package/src/solid/media-copy.ts +21 -21
  101. package/src/solid/media-store.ts +60 -57
  102. package/src/solid/media-tile.tsx +85 -85
  103. package/src/solid/menu-parts.tsx +164 -164
  104. package/src/solid/number-field.tsx +56 -56
  105. package/src/solid/option-card.tsx +168 -165
  106. package/src/solid/ornament.tsx +43 -43
  107. package/src/solid/overlay.tsx +4 -4
  108. package/src/solid/page-header.tsx +75 -75
  109. package/src/solid/pagination.tsx +80 -80
  110. package/src/solid/password-input.tsx +51 -51
  111. package/src/solid/picker-row.tsx +83 -83
  112. package/src/solid/picker-search.tsx +65 -63
  113. package/src/solid/picker-trigger.tsx +59 -57
  114. package/src/solid/popover.tsx +54 -54
  115. package/src/solid/preview-tile.tsx +67 -67
  116. package/src/solid/progress.tsx +21 -21
  117. package/src/solid/radio-group.tsx +51 -51
  118. package/src/solid/resizable.tsx +128 -128
  119. package/src/solid/responsive-dialog.tsx +134 -134
  120. package/src/solid/schema-form.tsx +746 -739
  121. package/src/solid/scope-indicator.tsx +5 -5
  122. package/src/solid/scroll-area.tsx +16 -16
  123. package/src/solid/section-card.tsx +281 -281
  124. package/src/solid/select.tsx +101 -101
  125. package/src/solid/separator.tsx +25 -25
  126. package/src/solid/settings-row.tsx +122 -122
  127. package/src/solid/sheet.tsx +96 -96
  128. package/src/solid/skeleton.tsx +8 -8
  129. package/src/solid/slider.tsx +132 -132
  130. package/src/solid/sliding-indicator.tsx +280 -265
  131. package/src/solid/sonner.tsx +164 -164
  132. package/src/solid/spinner.tsx +12 -12
  133. package/src/solid/spotlight.tsx +140 -140
  134. package/src/solid/step-indicator.tsx +18 -18
  135. package/src/solid/swatch-picker.tsx +38 -38
  136. package/src/solid/switch.tsx +52 -52
  137. package/src/solid/table.tsx +63 -63
  138. package/src/solid/tabs.tsx +93 -93
  139. package/src/solid/textarea.tsx +8 -8
  140. package/src/solid/toggle-group.tsx +83 -83
  141. package/src/solid/toggle.tsx +33 -33
  142. package/src/solid/tooltip.tsx +16 -16
  143. package/src/solid/widget-card.tsx +90 -90
  144. package/src/solid/widget-identity.tsx +99 -99
  145. package/src/solid/widget-trust-badge.tsx +20 -20
  146. package/src/styles/globals.css +316 -319
  147. package/src/styles/theme.css +448 -448
  148. package/src/tokens/hex.ts +29 -29
  149. package/src/tokens/material.ts +75 -75
  150. package/src/tokens/presets.ts +303 -303
  151. package/src/tokens/readability.ts +32 -32
  152. package/src/tokens/theme-colors.ts +95 -95
  153. package/src/tokens/theme-css.ts +22 -22
  154. package/src/tokens/theme-recipe.ts +106 -106
@@ -9,90 +9,90 @@ export const TABLE_HEAD_LABEL_CLASS = "font-medium text-muted-foreground text-xs
9
9
  export const TABLE_HEAD_CELL_CLASS = `${TABLE_CELL_INSET} text-left ${TABLE_HEAD_LABEL_CLASS}`;
10
10
 
11
11
  const Table: Component<ComponentProps<"table">> = (props) => {
12
- const [local, rest] = splitProps(props, ["class"]);
13
- return (
14
- <div data-slot="table-container" class="relative w-full overflow-x-auto">
15
- <table data-slot="table" class={cn("w-full caption-bottom text-sm", local.class)} {...rest} />
16
- </div>
17
- );
12
+ const [local, rest] = splitProps(props, ["class"]);
13
+ return (
14
+ <div data-slot="table-container" class="relative w-full overflow-x-auto">
15
+ <table data-slot="table" class={cn("w-full caption-bottom text-sm", local.class)} {...rest} />
16
+ </div>
17
+ );
18
18
  };
19
19
 
20
20
  const TableHeader: Component<ComponentProps<"thead">> = (props) => {
21
- const [local, rest] = splitProps(props, ["class"]);
22
- return <thead data-slot="table-header" class={cn("[&_tr]:border-b", local.class)} {...rest} />;
21
+ const [local, rest] = splitProps(props, ["class"]);
22
+ return <thead data-slot="table-header" class={cn("[&_tr]:border-b", local.class)} {...rest} />;
23
23
  };
24
24
 
25
25
  const TableBody: Component<ComponentProps<"tbody">> = (props) => {
26
- const [local, rest] = splitProps(props, ["class"]);
27
- return (
28
- <tbody data-slot="table-body" class={cn("[&_tr:last-child]:border-0", local.class)} {...rest} />
29
- );
26
+ const [local, rest] = splitProps(props, ["class"]);
27
+ return (
28
+ <tbody data-slot="table-body" class={cn("[&_tr:last-child]:border-0", local.class)} {...rest} />
29
+ );
30
30
  };
31
31
 
32
32
  const TableFooter: Component<ComponentProps<"tfoot">> = (props) => {
33
- const [local, rest] = splitProps(props, ["class"]);
34
- return (
35
- <tfoot
36
- data-slot="table-footer"
37
- class={cn("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0", local.class)}
38
- {...rest}
39
- />
40
- );
33
+ const [local, rest] = splitProps(props, ["class"]);
34
+ return (
35
+ <tfoot
36
+ data-slot="table-footer"
37
+ class={cn("bg-muted/50 border-t font-medium [&>tr]:last:border-b-0", local.class)}
38
+ {...rest}
39
+ />
40
+ );
41
41
  };
42
42
 
43
43
  const TableRow: Component<ComponentProps<"tr">> = (props) => {
44
- const [local, rest] = splitProps(props, ["class"]);
45
- return (
46
- <tr
47
- data-slot="table-row"
48
- class={cn(
49
- "border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",
50
- local.class,
51
- )}
52
- {...rest}
53
- />
54
- );
44
+ const [local, rest] = splitProps(props, ["class"]);
45
+ return (
46
+ <tr
47
+ data-slot="table-row"
48
+ class={cn(
49
+ "hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors",
50
+ local.class,
51
+ )}
52
+ {...rest}
53
+ />
54
+ );
55
55
  };
56
56
 
57
57
  const TableHead: Component<ComponentProps<"th">> = (props) => {
58
- const [local, rest] = splitProps(props, ["class"]);
59
- return (
60
- <th
61
- data-slot="table-head"
62
- class={cn(
63
- TABLE_HEAD_CELL_CLASS,
64
- "h-10 whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",
65
- local.class,
66
- )}
67
- {...rest}
68
- />
69
- );
58
+ const [local, rest] = splitProps(props, ["class"]);
59
+ return (
60
+ <th
61
+ data-slot="table-head"
62
+ class={cn(
63
+ TABLE_HEAD_CELL_CLASS,
64
+ "h-10 whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",
65
+ local.class,
66
+ )}
67
+ {...rest}
68
+ />
69
+ );
70
70
  };
71
71
 
72
72
  const TableCell: Component<ComponentProps<"td">> = (props) => {
73
- const [local, rest] = splitProps(props, ["class"]);
74
- return (
75
- <td
76
- data-slot="table-cell"
77
- class={cn(
78
- TABLE_CELL_INSET,
79
- "whitespace-nowrap align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",
80
- local.class,
81
- )}
82
- {...rest}
83
- />
84
- );
73
+ const [local, rest] = splitProps(props, ["class"]);
74
+ return (
75
+ <td
76
+ data-slot="table-cell"
77
+ class={cn(
78
+ TABLE_CELL_INSET,
79
+ "align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",
80
+ local.class,
81
+ )}
82
+ {...rest}
83
+ />
84
+ );
85
85
  };
86
86
 
87
87
  const TableCaption: Component<ComponentProps<"caption">> = (props) => {
88
- const [local, rest] = splitProps(props, ["class"]);
89
- return (
90
- <caption
91
- data-slot="table-caption"
92
- class={cn("mt-4 text-muted-foreground text-sm", local.class)}
93
- {...rest}
94
- />
95
- );
88
+ const [local, rest] = splitProps(props, ["class"]);
89
+ return (
90
+ <caption
91
+ data-slot="table-caption"
92
+ class={cn("text-muted-foreground mt-4 text-sm", local.class)}
93
+ {...rest}
94
+ />
95
+ );
96
96
  };
97
97
 
98
98
  export { Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow };
@@ -13,22 +13,22 @@ import { SlidingIndicator } from "./sliding-indicator.js";
13
13
  type TabsLayout = "stack" | "split";
14
14
 
15
15
  const TABS_LAYOUT: Record<TabsLayout, string> = {
16
- stack: "flex flex-col gap-2",
17
- split: "contents",
16
+ stack: "flex flex-col gap-2",
17
+ split: "contents",
18
18
  };
19
19
 
20
20
  type TabsProps = ComponentProps<typeof TabsPrimitive> & { layout?: TabsLayout };
21
21
 
22
22
  const Tabs: Component<TabsProps> = (props) => {
23
- const [local, others] = splitProps(props, ["class", "layout"]);
24
- return (
25
- <TabsPrimitive
26
- data-slot="tabs"
27
- data-layout={local.layout ?? "stack"}
28
- class={cn(TABS_LAYOUT[local.layout ?? "stack"], local.class)}
29
- {...others}
30
- />
31
- );
23
+ const [local, others] = splitProps(props, ["class", "layout"]);
24
+ return (
25
+ <TabsPrimitive
26
+ data-slot="tabs"
27
+ data-layout={local.layout ?? "stack"}
28
+ class={cn(TABS_LAYOUT[local.layout ?? "stack"], local.class)}
29
+ {...others}
30
+ />
31
+ );
32
32
  };
33
33
 
34
34
  /** Keeps the selected trigger centred in the scrolled track, so a deep link to
@@ -36,100 +36,100 @@ const Tabs: Component<TabsProps> = (props) => {
36
36
  * Drives scrollLeft rather than scrollIntoView, which would scroll the page
37
37
  * with it. */
38
38
  function followSelection(list: HTMLElement): () => void {
39
- const reveal = () => {
40
- if (list.scrollWidth <= list.clientWidth) return;
41
- const selected = list.querySelector("[data-selected]");
42
- if (!selected) return;
43
- const track = list.getBoundingClientRect();
44
- const item = selected.getBoundingClientRect();
45
- const left = list.scrollLeft + (item.left - track.left) - (track.width - item.width) / 2;
46
- const smooth = !matchMedia("(prefers-reduced-motion: reduce)").matches;
47
- list.scrollTo({ left, behavior: smooth ? "smooth" : "auto" });
48
- };
49
- // The track has no width during mount, so the first pass has to wait for
50
- // layout or it measures a track that cannot scroll yet.
51
- const first = requestAnimationFrame(reveal);
52
- const observer = new MutationObserver(reveal);
53
- observer.observe(list, { attributes: true, attributeFilter: ["data-selected"], subtree: true });
54
- return () => {
55
- cancelAnimationFrame(first);
56
- observer.disconnect();
57
- };
39
+ const reveal = () => {
40
+ if (list.scrollWidth <= list.clientWidth) return;
41
+ const selected = list.querySelector("[data-selected]");
42
+ if (!selected) return;
43
+ const track = list.getBoundingClientRect();
44
+ const item = selected.getBoundingClientRect();
45
+ const left = list.scrollLeft + (item.left - track.left) - (track.width - item.width) / 2;
46
+ const smooth = !matchMedia("(prefers-reduced-motion: reduce)").matches;
47
+ list.scrollTo({ left, behavior: smooth ? "smooth" : "auto" });
48
+ };
49
+ // The track has no width during mount, so the first pass has to wait for
50
+ // layout or it measures a track that cannot scroll yet.
51
+ const first = requestAnimationFrame(reveal);
52
+ const observer = new MutationObserver(reveal);
53
+ observer.observe(list, { attributes: true, attributeFilter: ["data-selected"], subtree: true });
54
+ return () => {
55
+ cancelAnimationFrame(first);
56
+ observer.disconnect();
57
+ };
58
58
  }
59
59
 
60
60
  const TabsList: Component<ComponentProps<typeof TabsPrimitive.List>> = (props) => {
61
- const [local, others] = splitProps(props, ["class", "children"]);
62
- let listRef: HTMLDivElement | undefined;
63
- onMount(() => {
64
- if (listRef) onCleanup(followSelection(listRef));
65
- });
66
- return (
67
- <TabsPrimitive.List
68
- ref={listRef}
69
- data-slot="tabs-list"
70
- class={cn(
71
- `scrollbar-hide inline-flex h-9 w-full items-center overflow-x-auto rounded-lg has-[[data-slot=tabs-trigger-icon]]:h-auto ${TRACK_SURFACE} p-1 text-muted-foreground`,
72
- local.class,
73
- )}
74
- {...others}
75
- >
76
- {/* w-max so triggers keep their natural width and the track scrolls;
61
+ const [local, others] = splitProps(props, ["class", "children"]);
62
+ let listRef: HTMLDivElement | undefined;
63
+ onMount(() => {
64
+ if (listRef) onCleanup(followSelection(listRef));
65
+ });
66
+ return (
67
+ <TabsPrimitive.List
68
+ ref={listRef}
69
+ data-slot="tabs-list"
70
+ class={cn(
71
+ `scrollbar-hide inline-flex h-9 w-full items-center overflow-x-auto rounded-lg has-[[data-slot=tabs-trigger-icon]]:h-auto ${TRACK_SURFACE} text-muted-foreground p-1`,
72
+ local.class,
73
+ )}
74
+ {...others}
75
+ >
76
+ {/* w-max so triggers keep their natural width and the track scrolls;
77
77
  w-full alone squeezed them past the rounded edge, unreachable. */}
78
- <SlidingIndicator
79
- activeSelector="[data-selected]"
80
- indicatorClass="rounded-md"
81
- class="flex h-full w-max min-w-full items-center gap-1"
82
- >
83
- {local.children}
84
- </SlidingIndicator>
85
- </TabsPrimitive.List>
86
- );
78
+ <SlidingIndicator
79
+ activeSelector="[data-selected]"
80
+ indicatorClass="rounded-md"
81
+ class="flex h-full w-max min-w-full items-center gap-1"
82
+ >
83
+ {local.children}
84
+ </SlidingIndicator>
85
+ </TabsPrimitive.List>
86
+ );
87
87
  };
88
88
 
89
89
  /** `icon` stacks a glyph over the word, so a tab row reads apart from the toggle groups under it. */
90
90
  const TabsTrigger: Component<ComponentProps<typeof TabsPrimitive.Trigger> & { icon?: string }> = (
91
- props,
91
+ props,
92
92
  ) => {
93
- const [local, others] = splitProps(props, ["class", "icon", "children"]);
94
- return (
95
- <TabsPrimitive.Trigger
96
- data-slot="tabs-trigger"
97
- class={cn(
98
- SEGMENT_ITEM,
99
- PRESS_DIP,
100
- "hover:text-primary/80 data-[selected]:text-primary",
101
- local.icon && "h-auto flex-1 flex-col gap-1 py-2 text-xs",
102
- local.class,
103
- )}
104
- {...others}
105
- >
106
- {local.icon && (
107
- <Icon
108
- data-slot="tabs-trigger-icon"
109
- icon={local.icon}
110
- width={18}
111
- height={18}
112
- aria-hidden="true"
113
- />
114
- )}
115
- {local.children}
116
- </TabsPrimitive.Trigger>
117
- );
93
+ const [local, others] = splitProps(props, ["class", "icon", "children"]);
94
+ return (
95
+ <TabsPrimitive.Trigger
96
+ data-slot="tabs-trigger"
97
+ class={cn(
98
+ SEGMENT_ITEM,
99
+ PRESS_DIP,
100
+ "hover:text-primary/80 data-[selected]:text-primary",
101
+ local.icon && "h-auto flex-1 flex-col gap-1 py-2 text-xs",
102
+ local.class,
103
+ )}
104
+ {...others}
105
+ >
106
+ {local.icon && (
107
+ <Icon
108
+ data-slot="tabs-trigger-icon"
109
+ icon={local.icon}
110
+ width={18}
111
+ height={18}
112
+ aria-hidden="true"
113
+ />
114
+ )}
115
+ {local.children}
116
+ </TabsPrimitive.Trigger>
117
+ );
118
118
  };
119
119
 
120
120
  const TabsContent: Component<ComponentProps<typeof TabsPrimitive.Content>> = (props) => {
121
- const [local, others] = splitProps(props, ["class"]);
122
- return (
123
- <TabsPrimitive.Content
124
- data-slot="tabs-content"
125
- class={cn(
126
- SETTLE_MOTION,
127
- "outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50",
128
- local.class,
129
- )}
130
- {...others}
131
- />
132
- );
121
+ const [local, others] = splitProps(props, ["class"]);
122
+ return (
123
+ <TabsPrimitive.Content
124
+ data-slot="tabs-content"
125
+ class={cn(
126
+ SETTLE_MOTION,
127
+ "focus-visible:border-ring focus-visible:ring-ring/50 outline-none focus-visible:ring-[3px]",
128
+ local.class,
129
+ )}
130
+ {...others}
131
+ />
132
+ );
133
133
  };
134
134
 
135
135
  export { Tabs, TabsContent, TabsList, TabsTrigger };
@@ -3,14 +3,14 @@ import { FIELD_CONTROL } from "../lib/input-classes.js";
3
3
  import { cn } from "../lib/utils.js";
4
4
 
5
5
  const Textarea: Component<ComponentProps<"textarea">> = (props) => {
6
- const [local, rest] = splitProps(props, ["class"]);
7
- return (
8
- <textarea
9
- data-slot="textarea"
10
- class={cn(FIELD_CONTROL, "field-sizing-content min-h-16 py-2", local.class)}
11
- {...rest}
12
- />
13
- );
6
+ const [local, rest] = splitProps(props, ["class"]);
7
+ return (
8
+ <textarea
9
+ data-slot="textarea"
10
+ class={cn(FIELD_CONTROL, "field-sizing-content min-h-16 py-2", local.class)}
11
+ {...rest}
12
+ />
13
+ );
14
14
  };
15
15
 
16
16
  export { Textarea };
@@ -1,13 +1,13 @@
1
1
  import { ToggleGroup as ToggleGroupPrimitive } from "@kobalte/core/toggle-group";
2
2
  import type { VariantProps } from "cva";
3
3
  import {
4
- type Component,
5
- type ComponentProps,
6
- createContext,
7
- type ParentComponent,
8
- Show,
9
- splitProps,
10
- useContext,
4
+ type Component,
5
+ type ComponentProps,
6
+ createContext,
7
+ type ParentComponent,
8
+ Show,
9
+ splitProps,
10
+ useContext,
11
11
  } from "solid-js";
12
12
  import { TRACK_SURFACE } from "../lib/card-classes.js";
13
13
  import { cn } from "../lib/utils.js";
@@ -21,92 +21,92 @@ import { toggleVariants } from "./toggle.js";
21
21
  type ToggleGroupContextValue = VariantProps<typeof toggleVariants> & { sliding: boolean };
22
22
 
23
23
  const ToggleGroupContext = createContext<ToggleGroupContextValue>({
24
- size: "default",
25
- variant: "default",
26
- sliding: true,
24
+ size: "default",
25
+ variant: "default",
26
+ sliding: true,
27
27
  });
28
28
 
29
29
  const ToggleGroup: ParentComponent<
30
- ComponentProps<typeof ToggleGroupPrimitive> &
31
- VariantProps<typeof toggleVariants> & {
32
- /** CSS colour for the selected segment's glass. Default `var(--primary)`. */
33
- tone?: string;
34
- }
30
+ ComponentProps<typeof ToggleGroupPrimitive> &
31
+ VariantProps<typeof toggleVariants> & {
32
+ /** CSS colour for the selected segment's glass. Default `var(--primary)`. */
33
+ tone?: string;
34
+ }
35
35
  > = (props) => {
36
- const [local, rest] = splitProps(props, [
37
- "class",
38
- "variant",
39
- "size",
40
- "tone",
41
- "children",
42
- ] as const);
43
- // Read `multiple` without splitting it out: Kobalte's root is a single/multiple
44
- // discriminated union, so pulling `multiple` into a separate prop collapses the
45
- // union and mistypes `value`. Leave it in `rest` and just peek at it here.
46
- const sliding = () => !(props as { multiple?: boolean }).multiple;
47
- return (
48
- <ToggleGroupPrimitive
49
- data-slot="toggle-group"
50
- data-variant={local.variant}
51
- data-size={local.size}
52
- class={cn(
53
- `group/toggle-group flex w-fit max-w-full flex-wrap items-center gap-y-1 rounded-lg ${TRACK_SURFACE} p-1 data-[variant=outline]:shadow-xs`,
54
- local.class,
55
- )}
56
- {...rest}
57
- >
58
- <ToggleGroupContext.Provider
59
- value={{ variant: local.variant, size: local.size, sliding: sliding() }}
60
- >
61
- <Show when={sliding()} fallback={local.children}>
62
- {/* w-full, not w-fit: a shrink-to-fit root still sizes to content, and a
36
+ const [local, rest] = splitProps(props, [
37
+ "class",
38
+ "variant",
39
+ "size",
40
+ "tone",
41
+ "children",
42
+ ] as const);
43
+ // Read `multiple` without splitting it out: Kobalte's root is a single/multiple
44
+ // discriminated union, so pulling `multiple` into a separate prop collapses the
45
+ // union and mistypes `value`. Leave it in `rest` and just peek at it here.
46
+ const sliding = () => !(props as { multiple?: boolean }).multiple;
47
+ return (
48
+ <ToggleGroupPrimitive
49
+ data-slot="toggle-group"
50
+ data-variant={local.variant}
51
+ data-size={local.size}
52
+ class={cn(
53
+ `group/toggle-group flex w-fit max-w-full flex-wrap items-center gap-y-1 rounded-lg ${TRACK_SURFACE} p-1 data-[variant=outline]:shadow-xs`,
54
+ local.class,
55
+ )}
56
+ {...rest}
57
+ >
58
+ <ToggleGroupContext.Provider
59
+ value={{ variant: local.variant, size: local.size, sliding: sliding() }}
60
+ >
61
+ <Show when={sliding()} fallback={local.children}>
62
+ {/* w-full, not w-fit: a shrink-to-fit root still sizes to content, and a
63
63
  `class="w-full"` root can finally let its flex-1 items share the width. */}
64
- <SlidingIndicator
65
- activeSelector="[data-pressed]"
66
- indicatorClass="rounded-md"
67
- indicatorTone={local.tone}
68
- wrapped
69
- class="flex w-full flex-wrap items-center gap-y-1"
70
- >
71
- {local.children}
72
- </SlidingIndicator>
73
- </Show>
74
- </ToggleGroupContext.Provider>
75
- </ToggleGroupPrimitive>
76
- );
64
+ <SlidingIndicator
65
+ activeSelector="[data-pressed]"
66
+ indicatorClass="rounded-md"
67
+ indicatorTone={local.tone}
68
+ wrapped
69
+ class="flex w-full flex-wrap items-center gap-y-1"
70
+ >
71
+ {local.children}
72
+ </SlidingIndicator>
73
+ </Show>
74
+ </ToggleGroupContext.Provider>
75
+ </ToggleGroupPrimitive>
76
+ );
77
77
  };
78
78
 
79
79
  const ToggleGroupItem: Component<
80
- ComponentProps<typeof ToggleGroupPrimitive.Item> & VariantProps<typeof toggleVariants>
80
+ ComponentProps<typeof ToggleGroupPrimitive.Item> & VariantProps<typeof toggleVariants>
81
81
  > = (props) => {
82
- const [local, rest] = splitProps(props, ["class", "variant", "size"] as const);
83
- const context = useContext(ToggleGroupContext);
82
+ const [local, rest] = splitProps(props, ["class", "variant", "size"] as const);
83
+ const context = useContext(ToggleGroupContext);
84
84
 
85
- return (
86
- <ToggleGroupPrimitive.Item
87
- data-slot="toggle-group-item"
88
- data-variant={context.variant || local.variant}
89
- data-size={context.size || local.size}
90
- class={cn(
91
- toggleVariants({
92
- variant: context.variant || local.variant,
93
- size: context.size || local.size,
94
- }),
95
- // Wrapping is plain CSS: an item never shrinks below its label, so a row that runs out of width breaks.
96
- "min-w-max flex-1 shrink-0 rounded-md px-4 shadow-none focus:z-10 focus-visible:z-10 data-[variant=outline]:border-l-0 data-[variant=outline]:first-of-type:border-l",
97
- // Single-select: the sliding indicator paints the active segment, so the
98
- // item needs no pressed fill of its own and hover only tints the text.
99
- // Multi-select has no single indicator, so each pressed segment carries
100
- // its own neutral fill; hover still tints text only, since a fill there
101
- // would read as a second, squarer selection.
102
- context.sliding
103
- ? "hover:text-primary"
104
- : "not-data-[pressed]:hover:text-primary data-[pressed]:bg-muted data-[pressed]:text-foreground",
105
- local.class,
106
- )}
107
- {...rest}
108
- />
109
- );
85
+ return (
86
+ <ToggleGroupPrimitive.Item
87
+ data-slot="toggle-group-item"
88
+ data-variant={context.variant || local.variant}
89
+ data-size={context.size || local.size}
90
+ class={cn(
91
+ toggleVariants({
92
+ variant: context.variant || local.variant,
93
+ size: context.size || local.size,
94
+ }),
95
+ // Wrapping is plain CSS: an item never shrinks below its label, so a row that runs out of width breaks.
96
+ "min-w-max flex-1 shrink-0 rounded-md px-4 shadow-none focus:z-10 focus-visible:z-10 data-[variant=outline]:border-l-0 data-[variant=outline]:first-of-type:border-l",
97
+ // Single-select: the sliding indicator paints the active segment, so the
98
+ // item needs no pressed fill of its own and hover only tints the text.
99
+ // Multi-select has no single indicator, so each pressed segment carries
100
+ // its own neutral fill; hover still tints text only, since a fill there
101
+ // would read as a second, squarer selection.
102
+ context.sliding
103
+ ? "hover:text-primary"
104
+ : "not-data-[pressed]:hover:text-primary data-[pressed]:bg-muted data-[pressed]:text-foreground",
105
+ local.class,
106
+ )}
107
+ {...rest}
108
+ />
109
+ );
110
110
  };
111
111
 
112
112
  export { ToggleGroup, ToggleGroupItem };