@glasshome/ui 1.10.0 → 1.10.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (103) hide show
  1. package/package.json +5 -2
  2. package/scripts/check-pack.ts +32 -0
  3. package/src/index.ts +111 -0
  4. package/src/solid/accordion.tsx +60 -0
  5. package/src/solid/alert-dialog.tsx +148 -0
  6. package/src/solid/alert.tsx +118 -0
  7. package/src/solid/area-picker.tsx +225 -0
  8. package/src/solid/aspect-ratio.tsx +21 -0
  9. package/src/solid/avatar.tsx +41 -0
  10. package/src/solid/badge.tsx +74 -0
  11. package/src/solid/bottom-sheet/arbitration.ts +40 -0
  12. package/src/solid/bottom-sheet/bottom-sheet.tsx +457 -0
  13. package/src/solid/bottom-sheet/constants.ts +8 -0
  14. package/src/solid/bottom-sheet/drag-controller.ts +221 -0
  15. package/src/solid/bottom-sheet/focus-trap.ts +56 -0
  16. package/src/solid/bottom-sheet/index.ts +14 -0
  17. package/src/solid/bottom-sheet/keyboard.ts +35 -0
  18. package/src/solid/bottom-sheet/scroll-lock.ts +64 -0
  19. package/src/solid/bottom-sheet/state-machine.ts +40 -0
  20. package/src/solid/bottom-sheet/velocity.ts +42 -0
  21. package/src/solid/breadcrumb.tsx +105 -0
  22. package/src/solid/button-group.tsx +66 -0
  23. package/src/solid/button.tsx +20 -0
  24. package/src/solid/card.tsx +101 -0
  25. package/src/solid/carousel.tsx +302 -0
  26. package/src/solid/charts.tsx +338 -0
  27. package/src/solid/checkbox.tsx +70 -0
  28. package/src/solid/collapsible.tsx +38 -0
  29. package/src/solid/color-slider.tsx +98 -0
  30. package/src/solid/color-wheel.tsx +77 -0
  31. package/src/solid/context-menu.tsx +109 -0
  32. package/src/solid/copy-button.tsx +46 -0
  33. package/src/solid/count-pill.tsx +24 -0
  34. package/src/solid/data-table.tsx +248 -0
  35. package/src/solid/dialog-parts.tsx +242 -0
  36. package/src/solid/dialog.tsx +121 -0
  37. package/src/solid/dock.tsx +186 -0
  38. package/src/solid/dropdown-menu.tsx +130 -0
  39. package/src/solid/empty.tsx +99 -0
  40. package/src/solid/entity-data.ts +78 -0
  41. package/src/solid/entity-selector.tsx +697 -0
  42. package/src/solid/field.tsx +253 -0
  43. package/src/solid/form.tsx +231 -0
  44. package/src/solid/hero-action.tsx +117 -0
  45. package/src/solid/hover-card.tsx +26 -0
  46. package/src/solid/icon-picker.tsx +432 -0
  47. package/src/solid/icon.tsx +20 -0
  48. package/src/solid/image-picker.tsx +380 -0
  49. package/src/solid/index.ts +417 -0
  50. package/src/solid/input-group.tsx +170 -0
  51. package/src/solid/input-otp.tsx +175 -0
  52. package/src/solid/input.tsx +12 -0
  53. package/src/solid/item.tsx +179 -0
  54. package/src/solid/kbd.tsx +30 -0
  55. package/src/solid/label.tsx +19 -0
  56. package/src/solid/list-reorder.ts +148 -0
  57. package/src/solid/logo.tsx +79 -0
  58. package/src/solid/media-copy.ts +37 -0
  59. package/src/solid/media-store.ts +110 -0
  60. package/src/solid/media-tile.tsx +100 -0
  61. package/src/solid/menu-parts.tsx +248 -0
  62. package/src/solid/number-field.tsx +72 -0
  63. package/src/solid/option-card.tsx +218 -0
  64. package/src/solid/ornament.tsx +53 -0
  65. package/src/solid/overlay.tsx +16 -0
  66. package/src/solid/page-header.tsx +102 -0
  67. package/src/solid/pagination.tsx +111 -0
  68. package/src/solid/password-input.tsx +69 -0
  69. package/src/solid/picker-row.tsx +102 -0
  70. package/src/solid/picker-search.tsx +78 -0
  71. package/src/solid/popover.tsx +103 -0
  72. package/src/solid/progress.tsx +31 -0
  73. package/src/solid/radio-group.tsx +60 -0
  74. package/src/solid/resizable.tsx +149 -0
  75. package/src/solid/responsive-dialog.tsx +180 -0
  76. package/src/solid/schema-form.tsx +830 -0
  77. package/src/solid/scope-indicator.tsx +13 -0
  78. package/src/solid/scroll-area.tsx +27 -0
  79. package/src/solid/section-card.tsx +358 -0
  80. package/src/solid/select.tsx +139 -0
  81. package/src/solid/separator.tsx +35 -0
  82. package/src/solid/settings-row.tsx +159 -0
  83. package/src/solid/sheet.tsx +157 -0
  84. package/src/solid/skeleton.tsx +15 -0
  85. package/src/solid/slider.tsx +148 -0
  86. package/src/solid/sliding-indicator.tsx +294 -0
  87. package/src/solid/sonner.tsx +219 -0
  88. package/src/solid/spinner.tsx +20 -0
  89. package/src/solid/step-indicator.tsx +30 -0
  90. package/src/solid/switch.tsx +62 -0
  91. package/src/solid/table.tsx +98 -0
  92. package/src/solid/tabs.tsx +86 -0
  93. package/src/solid/textarea.tsx +16 -0
  94. package/src/solid/toggle-group.tsx +102 -0
  95. package/src/solid/toggle.tsx +57 -0
  96. package/src/solid/tooltip.tsx +38 -0
  97. package/src/solid/widget-card.tsx +117 -0
  98. package/src/solid/widget-identity.tsx +135 -0
  99. package/src/solid/widget-trust-badge.tsx +37 -0
  100. package/src/tokens/hex.ts +50 -0
  101. package/src/tokens/index.ts +8 -0
  102. package/src/tokens/presets.ts +192 -0
  103. package/src/tokens/theme-colors.ts +147 -0
@@ -0,0 +1,13 @@
1
+ import { Badge } from "./badge.js";
2
+
3
+ /**
4
+ * Scope pill: `@scope (personal|org)`. The publisher-scope marker shared across
5
+ * widget cards and detail surfaces in both apps.
6
+ */
7
+ export function ScopeIndicator(props: { scope: string; type: "personal" | "organization" }) {
8
+ return (
9
+ <Badge tone="var(--muted-foreground)" class="gap-1 font-mono font-normal">
10
+ @{props.scope} <span>({props.type === "personal" ? "personal" : "org"})</span>
11
+ </Badge>
12
+ );
13
+ }
@@ -0,0 +1,27 @@
1
+ import { type Component, type ComponentProps, type ParentComponent, splitProps } from "solid-js";
2
+ import { cn } from "../lib/utils.js";
3
+
4
+ const ScrollArea: ParentComponent<ComponentProps<"div">> = (props) => {
5
+ const [local, rest] = splitProps(props, ["class", "children"]);
6
+ return (
7
+ <div
8
+ data-slot="scroll-area"
9
+ class={cn("gh-scroll relative overflow-auto", local.class)}
10
+ {...rest}
11
+ >
12
+ <div
13
+ data-slot="scroll-area-viewport"
14
+ class="size-full rounded-[inherit] outline-none transition-[color,box-shadow] focus-visible:outline-1 focus-visible:ring-[3px] focus-visible:ring-ring/50"
15
+ >
16
+ {local.children}
17
+ </div>
18
+ </div>
19
+ );
20
+ };
21
+
22
+ /** @deprecated `gh-scroll`'s native-styled bar is the bar; renders nothing. */
23
+ const ScrollBar: Component<ComponentProps<"div"> & { orientation?: "vertical" | "horizontal" }> = (
24
+ _props,
25
+ ) => null;
26
+
27
+ export { ScrollArea, ScrollBar };
@@ -0,0 +1,358 @@
1
+ import { type ComponentProps, children, type JSX, Show, splitProps } from "solid-js";
2
+ import {
3
+ CARD_BLUR,
4
+ CARD_SURFACE_BASE,
5
+ SECTION_ROW_INTERACTIVE,
6
+ SECTION_ROW_SURFACE,
7
+ } from "../lib/card-classes.js";
8
+ import { ICON_PILL, ICON_PILL_TINT } from "../lib/pill-classes.js";
9
+ import {
10
+ SECTION_INNER_RADIUS,
11
+ SECTION_OUTER_RADIUS,
12
+ SECTION_PADDING,
13
+ } from "../lib/section-tokens.js";
14
+ import { cn } from "../lib/utils.js";
15
+ import { CountPill } from "./count-pill.js";
16
+ import { Icon } from "./icon.js";
17
+
18
+ /* Performant-blur injection (dash): when active() the card gates CARD_BLUR off
19
+ * and paints the engine's precomputed slice via style() instead. */
20
+ export type GlassSurface = {
21
+ ref?: (el: HTMLElement) => void;
22
+ style?: () => JSX.CSSProperties;
23
+ active?: () => boolean;
24
+ };
25
+
26
+ export const NOOP_GLASS: Required<GlassSurface> = {
27
+ ref: () => {},
28
+ style: () => ({}),
29
+ active: () => false,
30
+ };
31
+
32
+ type SectionCardProps = {
33
+ icon?: string;
34
+ title?: JSX.Element;
35
+ subtitle?: JSX.Element;
36
+ count?: number | string;
37
+ action?: JSX.Element;
38
+ toolbar?: JSX.Element;
39
+ headerClass?: string;
40
+ subtitleClass?: string;
41
+ class?: string;
42
+ glass?: GlassSurface;
43
+ children?: JSX.Element;
44
+ };
45
+
46
+ export function SectionCard(props: SectionCardProps) {
47
+ const glass = () => props.glass ?? NOOP_GLASS;
48
+ const active = () => glass().active?.() ?? false;
49
+ const hasHeader = () =>
50
+ props.icon != null || props.title != null || props.action != null || props.count != null;
51
+ // Resolved once: a header-only card must not pay the section gap for an
52
+ // empty body slot, and reading props.children twice would build it twice.
53
+ const body = children(() => props.children);
54
+ const hasBody = () => body.toArray().some((child) => child != null && child !== false);
55
+
56
+ return (
57
+ <section
58
+ data-slot="section-card"
59
+ ref={glass().ref}
60
+ class={cn(
61
+ CARD_SURFACE_BASE,
62
+ SECTION_OUTER_RADIUS,
63
+ SECTION_PADDING,
64
+ "relative flex flex-col gap-3 overflow-hidden transition-glass [contain:layout_style_paint] md:gap-4",
65
+ props.class,
66
+ )}
67
+ classList={{ [CARD_BLUR]: !active() }}
68
+ style={glass().style?.() ?? {}}
69
+ >
70
+ <Show when={hasHeader()}>
71
+ <header
72
+ data-slot="section-card-header"
73
+ class={cn("flex items-center gap-2 sm:gap-3", props.headerClass)}
74
+ >
75
+ <Show when={props.icon}>{(icon) => <SectionIcon icon={icon()} />}</Show>
76
+ <div data-slot="section-card-headings" class="flex min-w-0 flex-1 flex-col gap-0.5">
77
+ <div data-slot="section-card-headline" class="flex min-w-0 items-center gap-2 sm:gap-3">
78
+ <Show when={props.title}>
79
+ <SectionTitle>{props.title}</SectionTitle>
80
+ </Show>
81
+ <Show when={props.count != null}>
82
+ <CountPill>{props.count}</CountPill>
83
+ </Show>
84
+ </div>
85
+ <Show when={props.subtitle}>
86
+ <SectionMeta class={props.subtitleClass}>{props.subtitle}</SectionMeta>
87
+ </Show>
88
+ </div>
89
+ <Show when={props.action}>
90
+ <div data-slot="section-card-actions" class="flex shrink-0 items-center gap-2">
91
+ {props.action}
92
+ </div>
93
+ </Show>
94
+ </header>
95
+ </Show>
96
+ <Show when={props.toolbar}>
97
+ <div
98
+ data-slot="section-card-toolbar"
99
+ class={cn(hasHeader() && "border-border/50 border-t pt-3")}
100
+ >
101
+ {props.toolbar}
102
+ </div>
103
+ </Show>
104
+ <Show when={hasBody()}>
105
+ <div data-slot="section-card-body">{body()}</div>
106
+ </Show>
107
+ </section>
108
+ );
109
+ }
110
+
111
+ export function SectionRow(props: ComponentProps<"div"> & { interactive?: boolean }) {
112
+ const [local, rest] = splitProps(props, ["class", "interactive"]);
113
+ return (
114
+ <div
115
+ data-slot="section-row"
116
+ class={cn(
117
+ SECTION_ROW_SURFACE,
118
+ SECTION_INNER_RADIUS,
119
+ SECTION_PADDING,
120
+ local.interactive && SECTION_ROW_INTERACTIVE,
121
+ local.class,
122
+ )}
123
+ {...rest}
124
+ />
125
+ );
126
+ }
127
+
128
+ type ListRowProps = {
129
+ /** Leading visual: SectionIcon, Avatar, drag handle. */
130
+ leading?: JSX.Element;
131
+ title: JSX.Element;
132
+ /** Chips inline after the title. */
133
+ badges?: JSX.Element;
134
+ subtitle?: JSX.Element;
135
+ /** Quiet trailing text: versions, timestamps, counts. */
136
+ meta?: JSX.Element;
137
+ /** Controls at the row's end. Stacked above the open overlay. */
138
+ actions?: JSX.Element;
139
+ /** Activates the whole row. Renders a chevron when there are no actions. */
140
+ onOpen?: () => void;
141
+ /** The whole row is a link. Same chevron and press target as onOpen. */
142
+ href?: string;
143
+ /** Accessible name for the whole-row activation; required with href or onOpen. */
144
+ openLabel?: string;
145
+ class?: string;
146
+ };
147
+
148
+ /**
149
+ * One item in a settings list. Fixed slots so every list reads the same
150
+ * whatever it holds; the row itself, not a nested button, is what you press.
151
+ */
152
+ export function ListRow(props: ListRowProps) {
153
+ const opens = () => props.onOpen !== undefined || props.href !== undefined;
154
+ return (
155
+ <SectionRow
156
+ interactive={opens()}
157
+ class={cn("@container/list-row relative flex items-center gap-3", props.class)}
158
+ >
159
+ <Show when={props.href}>
160
+ {(href) => (
161
+ <a href={href()} class="absolute inset-0 rounded-[inherit] outline-none">
162
+ <span class="sr-only">{props.openLabel}</span>
163
+ </a>
164
+ )}
165
+ </Show>
166
+ <Show when={props.href === undefined && props.onOpen}>
167
+ <button
168
+ type="button"
169
+ class="absolute inset-0 rounded-[inherit] outline-none"
170
+ aria-label={props.openLabel}
171
+ onClick={() => props.onOpen?.()}
172
+ />
173
+ </Show>
174
+ <Show when={props.leading}>
175
+ <span class="flex shrink-0 items-center gap-2">{props.leading}</span>
176
+ </Show>
177
+ {/* Identity column. The floor is what gives the name priority: without
178
+ it this is the only shrinkable child, so flex crushes it to an
179
+ ellipsis and hands every spare pixel to meta. Sized to hold a name
180
+ plus its badge. */}
181
+ <div class="min-w-[9rem] flex-1">
182
+ <div class="flex min-w-0 items-center gap-2">
183
+ <p class="truncate font-semibold text-sm leading-tight">{props.title}</p>
184
+ {props.badges}
185
+ </div>
186
+ <Show when={props.subtitle}>
187
+ <p class="mt-1 truncate text-muted-foreground text-xs">{props.subtitle}</p>
188
+ </Show>
189
+ </div>
190
+ {/* Trailing meta, centred across both identity lines. shrink-0, because
191
+ a squeeze-driven wrap fires off whichever meta happens to be widest
192
+ while the flex-1 identity column still holds unused slack. Meta that
193
+ wants to reflow reads @container/list-row and says so itself. */}
194
+ <Show when={props.meta}>
195
+ <div class="shrink-0 text-muted-foreground text-xs">{props.meta}</div>
196
+ </Show>
197
+ <Show when={props.actions}>
198
+ <div class="relative flex shrink-0 items-center gap-1">{props.actions}</div>
199
+ </Show>
200
+ <Show when={opens() && props.actions === undefined}>
201
+ <Icon
202
+ icon="lucide:chevron-right"
203
+ width={16}
204
+ height={16}
205
+ class="shrink-0 text-muted-foreground"
206
+ aria-hidden="true"
207
+ />
208
+ </Show>
209
+ </SectionRow>
210
+ );
211
+ }
212
+
213
+ type SectionIconSize = "sm" | "md" | "lg";
214
+
215
+ const ICON_DIMENSIONS: Record<SectionIconSize, string> = {
216
+ sm: "size-7 [&>iconify-icon]:text-[16px]",
217
+ md: "size-10 sm:size-11 [&>iconify-icon]:text-[20px] sm:[&>iconify-icon]:text-[22px]",
218
+ lg: "size-12 sm:size-14 [&>iconify-icon]:text-[24px] sm:[&>iconify-icon]:text-[28px]",
219
+ };
220
+
221
+ /** @deprecated pass a CSS color to `tone` instead. */
222
+ const LEGACY_TONES: Record<string, string | undefined> = {
223
+ neutral: undefined,
224
+ primary: "var(--primary)",
225
+ };
226
+
227
+ export function SectionIcon(props: {
228
+ icon?: string;
229
+ children?: JSX.Element;
230
+ size?: SectionIconSize;
231
+ /** Any CSS color. `"neutral"` and `"primary"` are the deprecated old enum. */
232
+ tone?: string;
233
+ class?: string;
234
+ }) {
235
+ const tone = () => {
236
+ const t = props.tone;
237
+ if (t == null) return undefined;
238
+ return t in LEGACY_TONES ? LEGACY_TONES[t] : t;
239
+ };
240
+ return (
241
+ <span
242
+ data-slot="section-icon"
243
+ class={cn(
244
+ tone() ? ICON_PILL_TINT : `${ICON_PILL} text-foreground/80`,
245
+ SECTION_INNER_RADIUS,
246
+ ICON_DIMENSIONS[props.size ?? "md"],
247
+ props.class,
248
+ )}
249
+ style={tone() ? { "--glass-tone": tone() } : undefined}
250
+ >
251
+ <Show when={props.children} fallback={props.icon ? <Icon icon={props.icon} /> : null}>
252
+ {props.children}
253
+ </Show>
254
+ </span>
255
+ );
256
+ }
257
+
258
+ export function SectionTitle(props: { children: JSX.Element; class?: string }) {
259
+ return (
260
+ <h2
261
+ data-slot="section-title"
262
+ class={cn(
263
+ "truncate font-bold text-foreground text-lg tracking-tight sm:text-xl",
264
+ props.class,
265
+ )}
266
+ >
267
+ {props.children}
268
+ </h2>
269
+ );
270
+ }
271
+
272
+ function SectionHeading(props: { children: JSX.Element; class?: string }) {
273
+ return (
274
+ <h3
275
+ data-slot="section-subtitle"
276
+ class={cn("font-semibold text-base leading-tight", props.class)}
277
+ >
278
+ {props.children}
279
+ </h3>
280
+ );
281
+ }
282
+
283
+ /** @deprecated A bare heading has no owner: `SectionGroup` for a labelled group
284
+ * inside a card, `FieldLegend` for a titled group of form rows. */
285
+ export function SectionSubtitle(props: { children: JSX.Element; class?: string }) {
286
+ return <SectionHeading class={props.class}>{props.children}</SectionHeading>;
287
+ }
288
+
289
+ /** One labelled group inside a `SectionCard`: icon, label, optional count and
290
+ * action, then its rows. Proximity does the grouping, so a label sits close to
291
+ * its own rows and far from the group above; no rule is drawn. A zero count
292
+ * renders no pill: the empty group below already says it. */
293
+ export function SectionGroup(props: {
294
+ icon: string;
295
+ label: JSX.Element;
296
+ count?: number | string;
297
+ action?: JSX.Element;
298
+ class?: string;
299
+ children: JSX.Element;
300
+ }) {
301
+ return (
302
+ <section data-slot="section-group" class={cn("mt-7 first:mt-3", props.class)}>
303
+ <header
304
+ data-slot="section-group-header"
305
+ class="mb-2 flex flex-wrap items-center justify-between gap-2"
306
+ >
307
+ <div data-slot="section-group-heading" class="flex min-w-0 items-center gap-2">
308
+ <SectionIcon icon={props.icon} size="sm" />
309
+ <SectionHeading>{props.label}</SectionHeading>
310
+ <Show when={props.count}>
311
+ <CountPill>{props.count}</CountPill>
312
+ </Show>
313
+ </div>
314
+ {props.action}
315
+ </header>
316
+ {props.children}
317
+ </section>
318
+ );
319
+ }
320
+
321
+ /** @deprecated SectionMeta, or FieldLegend for a titled group of rows. */
322
+ export function SectionLabel(props: { children: JSX.Element; class?: string }) {
323
+ return <SectionMeta class={cn("font-medium", props.class)}>{props.children}</SectionMeta>;
324
+ }
325
+
326
+ export function SectionMeta(props: { children: JSX.Element; class?: string }) {
327
+ return (
328
+ <p data-slot="section-meta" class={cn("text-muted-foreground text-xs", props.class)}>
329
+ {props.children}
330
+ </p>
331
+ );
332
+ }
333
+
334
+ export function SectionRowSkeleton(props: { class?: string }) {
335
+ return (
336
+ <div
337
+ data-slot="section-row-skeleton"
338
+ aria-hidden="true"
339
+ class={cn(
340
+ SECTION_ROW_SURFACE,
341
+ SECTION_INNER_RADIUS,
342
+ "h-14 animate-pulse [--glass-rim:0.15]",
343
+ props.class,
344
+ )}
345
+ />
346
+ );
347
+ }
348
+
349
+ export function SectionRowSkeletons(props: { count?: number }) {
350
+ const n = props.count ?? 3;
351
+ return (
352
+ <div data-slot="section-row-skeletons" class="flex flex-col gap-2" aria-busy="true">
353
+ {Array.from({ length: n }, () => (
354
+ <SectionRowSkeleton />
355
+ ))}
356
+ </div>
357
+ );
358
+ }
@@ -0,0 +1,139 @@
1
+ import { Select as SelectPrimitive } from "@kobalte/core/select";
2
+ import { type Component, type ComponentProps, type ParentComponent, splitProps } from "solid-js";
3
+ import { CONTROL_H, INPUT_SURFACE } from "../lib/input-classes.js";
4
+ import { Z_CLASS } from "../lib/layers.js";
5
+ import { MENU_ITEM, MENU_LABEL, MENU_SEPARATOR } from "../lib/menu-classes.js";
6
+ import { FIELD_MOTION, STAGGER } from "../lib/motion-classes.js";
7
+ import { anchorToTriggerTop } from "../lib/overlay-classes.js";
8
+ import { PICKER_LIST, PICKER_TRIGGER } from "../lib/picker-classes.js";
9
+ import { cn } from "../lib/utils.js";
10
+ import { Icon } from "./icon.js";
11
+ import { SlidingIndicator } from "./sliding-indicator.js";
12
+
13
+ const Select = ((props: ComponentProps<typeof SelectPrimitive>) => (
14
+ <SelectPrimitive gutter={0} getAnchorRect={anchorToTriggerTop} flip={false} overlap {...props} />
15
+ )) as typeof SelectPrimitive;
16
+ const SelectValue = SelectPrimitive.Value;
17
+
18
+ const SelectTrigger: ParentComponent<
19
+ ComponentProps<typeof SelectPrimitive.Trigger> & { size?: "sm" | "default" }
20
+ > = (props) => {
21
+ const [local, rest] = splitProps(props, ["class", "children", "size"]);
22
+ const size = () => local.size ?? "default";
23
+ return (
24
+ <SelectPrimitive.Trigger
25
+ data-slot="select-trigger"
26
+ data-size={size()}
27
+ class={cn(
28
+ PICKER_TRIGGER,
29
+ // The one deviation from the shared recipe: a Select sizes to its
30
+ // value, every other picker fills its field.
31
+ "w-fit whitespace-nowrap data-[placeholder]:text-muted-foreground [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0",
32
+ size() === "sm" && CONTROL_H.sm,
33
+ local.class,
34
+ )}
35
+ {...rest}
36
+ >
37
+ {local.children}
38
+ <SelectPrimitive.Icon>
39
+ <Icon
40
+ icon="lucide:chevron-down"
41
+ width={16}
42
+ height={16}
43
+ class="size-4 text-muted-foreground opacity-50"
44
+ />
45
+ </SelectPrimitive.Icon>
46
+ </SelectPrimitive.Trigger>
47
+ );
48
+ };
49
+
50
+ const SelectContent: ParentComponent<
51
+ ComponentProps<typeof SelectPrimitive.Content> & { listboxClass?: string }
52
+ > = (props) => {
53
+ const [local, rest] = splitProps(props, ["class", "children", "listboxClass"]);
54
+ return (
55
+ <SelectPrimitive.Portal>
56
+ <SelectPrimitive.Content
57
+ data-slot="select-content"
58
+ class={cn(
59
+ // Same concave surface as the trigger: opening reads as the input
60
+ // expanding, not a separate floating panel.
61
+ INPUT_SURFACE,
62
+ FIELD_MOTION,
63
+ `relative ${Z_CLASS.overlay} overflow-hidden rounded-md p-1 text-popover-foreground`,
64
+ local.class,
65
+ )}
66
+ {...rest}
67
+ >
68
+ <SlidingIndicator
69
+ activeSelector="[data-highlighted]"
70
+ orientation="vertical"
71
+ indicatorClass="rounded-sm"
72
+ class={cn("w-full", PICKER_LIST)}
73
+ >
74
+ <SelectPrimitive.Listbox class={cn(STAGGER, local.listboxClass)} />
75
+ </SlidingIndicator>
76
+ </SelectPrimitive.Content>
77
+ </SelectPrimitive.Portal>
78
+ );
79
+ };
80
+
81
+ const SelectLabel: Component<ComponentProps<typeof SelectPrimitive.Label>> = (props) => {
82
+ const [local, rest] = splitProps(props, ["class"]);
83
+ return (
84
+ <SelectPrimitive.Label
85
+ data-slot="select-label"
86
+ class={cn(MENU_LABEL, "font-normal", local.class)}
87
+ {...rest}
88
+ />
89
+ );
90
+ };
91
+
92
+ const SelectItem: ParentComponent<ComponentProps<typeof SelectPrimitive.Item>> = (props) => {
93
+ const [local, rest] = splitProps(props, ["class", "children"]);
94
+ return (
95
+ <SelectPrimitive.Item
96
+ data-slot="select-item"
97
+ class={cn(
98
+ MENU_ITEM,
99
+ "w-full pr-8 focus:text-foreground data-[highlighted]:text-foreground *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",
100
+ local.class,
101
+ )}
102
+ {...rest}
103
+ >
104
+ <span class="absolute right-2 flex size-3.5 items-center justify-center">
105
+ <SelectPrimitive.ItemIndicator>
106
+ <Icon icon="lucide:check" width={16} height={16} class="size-4 text-current" />
107
+ </SelectPrimitive.ItemIndicator>
108
+ </span>
109
+ <SelectPrimitive.ItemLabel>{local.children}</SelectPrimitive.ItemLabel>
110
+ </SelectPrimitive.Item>
111
+ );
112
+ };
113
+
114
+ const SelectGroup: Component<ComponentProps<"div">> = (props) => {
115
+ const [local, rest] = splitProps(props, ["class"]);
116
+ return <div data-slot="select-group" class={cn("", local.class)} {...rest} />;
117
+ };
118
+
119
+ const SelectSeparator: Component<ComponentProps<"div">> = (props) => {
120
+ const [local, rest] = splitProps(props, ["class"]);
121
+ return (
122
+ <div
123
+ data-slot="select-separator"
124
+ class={cn("pointer-events-none", MENU_SEPARATOR, local.class)}
125
+ {...rest}
126
+ />
127
+ );
128
+ };
129
+
130
+ export {
131
+ Select,
132
+ SelectContent,
133
+ SelectGroup,
134
+ SelectItem,
135
+ SelectLabel,
136
+ SelectSeparator,
137
+ SelectTrigger,
138
+ SelectValue,
139
+ };
@@ -0,0 +1,35 @@
1
+ import { type Component, type ComponentProps, splitProps } from "solid-js";
2
+ import { cn } from "../lib/utils.js";
3
+
4
+ type SeparatorProps = ComponentProps<"div"> & {
5
+ orientation?: "horizontal" | "vertical";
6
+ };
7
+
8
+ const Separator: Component<SeparatorProps> = (props) => {
9
+ const [local, others] = splitProps(props, ["class", "orientation"]);
10
+ const orientation = () => local.orientation ?? "horizontal";
11
+ return (
12
+ // Non-focusable role=separator is valid static ARIA; hr cannot express the vertical variant.
13
+ // biome-ignore lint/a11y/useFocusableInteractive: see above
14
+ // biome-ignore lint/a11y/useSemanticElements: see above
15
+ <div
16
+ data-slot="separator"
17
+ // biome-ignore lint/a11y/useAriaPropsForRole: non-focusable separators need no aria-valuenow
18
+ role="separator"
19
+ aria-orientation={orientation()}
20
+ // A luminous glass hairline: the border tone fades to transparent at both
21
+ // ends (a lit line, not a hard rule) with a faint highlight offset one
22
+ // pixel toward the light — the same lit-glass edge cards and chips carry.
23
+ class={cn(
24
+ "shrink-0 border-0 bg-transparent",
25
+ orientation() === "horizontal"
26
+ ? "h-px w-full bg-gradient-to-r from-transparent via-border to-transparent shadow-[0_1px_0_oklch(1_0_0_/_0.04)]"
27
+ : "h-full w-px bg-gradient-to-b from-transparent via-border to-transparent shadow-[1px_0_0_oklch(1_0_0_/_0.04)]",
28
+ local.class,
29
+ )}
30
+ {...others}
31
+ />
32
+ );
33
+ };
34
+
35
+ export { Separator };