@platned/ui 0.10.4 → 1.0.0

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 (63) hide show
  1. package/README.md +42 -98
  2. package/dist/blocks-charts.cjs +459 -0
  3. package/dist/blocks-charts.cjs.map +1 -0
  4. package/dist/blocks-charts.d.cts +64 -0
  5. package/dist/blocks-charts.d.ts +64 -0
  6. package/dist/blocks-charts.js +440 -0
  7. package/dist/blocks-charts.js.map +1 -0
  8. package/dist/blocks.cjs +8007 -0
  9. package/dist/blocks.cjs.map +1 -0
  10. package/dist/blocks.d.cts +3082 -0
  11. package/dist/blocks.d.ts +3082 -0
  12. package/dist/blocks.js +8223 -0
  13. package/dist/blocks.js.map +1 -0
  14. package/dist/chart.cjs +226 -0
  15. package/dist/chart.cjs.map +1 -0
  16. package/dist/chart.d.ts +66 -0
  17. package/dist/chart.js +183 -0
  18. package/dist/chart.js.map +1 -0
  19. package/dist/chunk-2L5XAYNK.js +11 -0
  20. package/dist/chunk-2L5XAYNK.js.map +1 -0
  21. package/dist/chunk-327NSKZW.js +3176 -0
  22. package/dist/chunk-327NSKZW.js.map +1 -0
  23. package/dist/chunk-GJJWRZ4B.js +200 -0
  24. package/dist/chunk-GJJWRZ4B.js.map +1 -0
  25. package/dist/chunk-WGCAQEZ4.js +178 -0
  26. package/dist/chunk-WGCAQEZ4.js.map +1 -0
  27. package/dist/code-block-BgEiLXpO.d.ts +111 -0
  28. package/dist/code-block-highlight.cjs +489 -0
  29. package/dist/code-block-highlight.cjs.map +1 -0
  30. package/dist/code-block-highlight.d.ts +28 -0
  31. package/dist/code-block-highlight.js +120 -0
  32. package/dist/code-block-highlight.js.map +1 -0
  33. package/dist/data-table-Dec6t8NO.d.ts +729 -0
  34. package/dist/data-table.cjs +3506 -2219
  35. package/dist/data-table.cjs.map +1 -1
  36. package/dist/data-table.d.ts +2 -1
  37. package/dist/data-table.js +1396 -246
  38. package/dist/data-table.js.map +1 -1
  39. package/dist/index.cjs +8934 -11994
  40. package/dist/index.cjs.map +1 -1
  41. package/dist/index.d.ts +2524 -5312
  42. package/dist/index.js +4678 -9574
  43. package/dist/index.js.map +1 -1
  44. package/dist/map.cjs +432 -0
  45. package/dist/map.cjs.map +1 -0
  46. package/dist/map.d.cts +294 -0
  47. package/dist/map.d.ts +294 -0
  48. package/dist/map.js +422 -0
  49. package/dist/map.js.map +1 -0
  50. package/dist/theme.css +1897 -0
  51. package/package.json +65 -24
  52. package/dist/chunk-OVIRTNT4.js +0 -2787
  53. package/dist/chunk-OVIRTNT4.js.map +0 -1
  54. package/dist/data-table-JX-vnL0F.d.ts +0 -464
  55. package/dist/sidebar.cjs +0 -108
  56. package/dist/sidebar.cjs.map +0 -1
  57. package/dist/sidebar.d.cts +0 -257
  58. package/dist/sidebar.d.ts +0 -257
  59. package/dist/sidebar.js +0 -70
  60. package/dist/sidebar.js.map +0 -1
  61. package/dist/styles.css +0 -1
  62. package/dist/tokens.css +0 -1
  63. package/tailwind-preset.cjs +0 -446
@@ -0,0 +1,3176 @@
1
+ import {
2
+ Button,
3
+ Slot,
4
+ composeRefs
5
+ } from "./chunk-WGCAQEZ4.js";
6
+ import {
7
+ cn
8
+ } from "./chunk-2L5XAYNK.js";
9
+
10
+ // src/components/avatar/avatar.tsx
11
+ import { forwardRef } from "react";
12
+ import { Avatar as AvatarPrimitive } from "radix-ui";
13
+ import { jsx, jsxs } from "react/jsx-runtime";
14
+ var Avatar = forwardRef(function Avatar2({ className, size = "default", shape = "circle", src, alt, fallback, children, ...props }, ref) {
15
+ return /* @__PURE__ */ jsxs(
16
+ AvatarPrimitive.Root,
17
+ {
18
+ ref,
19
+ "data-slot": "avatar",
20
+ "data-size": size,
21
+ "data-shape": shape,
22
+ className: cn(
23
+ "group/avatar relative flex size-8 shrink-0 rounded-full select-none after:absolute after:inset-0 after:rounded-full after:border after:border-border after:mix-blend-darken data-[size=lg]:size-10 data-[size=sm]:size-6 dark:after:mix-blend-lighten",
24
+ "data-[shape=square]:rounded-lg data-[shape=square]:after:rounded-lg data-[shape=square]:data-[size=sm]:rounded-md data-[shape=square]:data-[size=sm]:after:rounded-md",
25
+ className
26
+ ),
27
+ ...props,
28
+ children: [
29
+ src !== void 0 && /* @__PURE__ */ jsx(AvatarImage, { src, alt: alt ?? "" }),
30
+ fallback !== void 0 && /* @__PURE__ */ jsx(AvatarFallback, { children: fallback }),
31
+ children
32
+ ]
33
+ }
34
+ );
35
+ });
36
+ var SHAPED = "rounded-full group-data-[shape=square]/avatar:rounded-lg group-data-[shape=square]/avatar:group-data-[size=sm]/avatar:rounded-md";
37
+ var AvatarImage = forwardRef(function AvatarImage2({ className, ...props }, ref) {
38
+ return /* @__PURE__ */ jsx(
39
+ AvatarPrimitive.Image,
40
+ {
41
+ ref,
42
+ "data-slot": "avatar-image",
43
+ className: cn("aspect-square size-full object-cover", SHAPED, className),
44
+ ...props
45
+ }
46
+ );
47
+ });
48
+ var AvatarFallback = forwardRef(function AvatarFallback2({ className, ...props }, ref) {
49
+ return /* @__PURE__ */ jsx(
50
+ AvatarPrimitive.Fallback,
51
+ {
52
+ ref,
53
+ "data-slot": "avatar-fallback",
54
+ className: cn(
55
+ "flex size-full items-center justify-center bg-muted text-sm text-muted-foreground group-data-[size=sm]/avatar:text-xs",
56
+ SHAPED,
57
+ className
58
+ ),
59
+ ...props
60
+ }
61
+ );
62
+ });
63
+ var AvatarBadge = forwardRef(function AvatarBadge2({ className, ...props }, ref) {
64
+ return /* @__PURE__ */ jsx(
65
+ "span",
66
+ {
67
+ ref,
68
+ "data-slot": "avatar-badge",
69
+ className: cn(
70
+ "absolute right-0 bottom-0 z-10 inline-flex items-center justify-center rounded-full bg-primary bg-blend-color text-primary-foreground ring-2 ring-background select-none",
71
+ "group-data-[size=sm]/avatar:size-2 group-data-[size=sm]/avatar:[&>svg]:hidden",
72
+ "group-data-[size=default]/avatar:size-2.5 group-data-[size=default]/avatar:[&>svg]:size-2",
73
+ "group-data-[size=lg]/avatar:size-3 group-data-[size=lg]/avatar:[&>svg]:size-2",
74
+ className
75
+ ),
76
+ ...props
77
+ }
78
+ );
79
+ });
80
+ var AvatarGroup = forwardRef(function AvatarGroup2({ className, overflow, children, ...props }, ref) {
81
+ return /* @__PURE__ */ jsxs(
82
+ "div",
83
+ {
84
+ ref,
85
+ "data-slot": "avatar-group",
86
+ className: cn(
87
+ "group/avatar-group flex -space-x-2 *:data-[slot=avatar]:ring-2 *:data-[slot=avatar]:ring-background",
88
+ className
89
+ ),
90
+ ...props,
91
+ children: [
92
+ children,
93
+ overflow !== void 0 && /* @__PURE__ */ jsxs(AvatarGroupCount, { children: [
94
+ "+",
95
+ overflow
96
+ ] })
97
+ ]
98
+ }
99
+ );
100
+ });
101
+ var AvatarGroupCount = forwardRef(function AvatarGroupCount2({ className, ...props }, ref) {
102
+ return /* @__PURE__ */ jsx(
103
+ "div",
104
+ {
105
+ ref,
106
+ "data-slot": "avatar-group-count",
107
+ className: cn(
108
+ "relative flex size-8 shrink-0 items-center justify-center rounded-full bg-muted text-sm text-muted-foreground ring-2 ring-background",
109
+ "group-has-data-[size=lg]/avatar-group:size-10 group-has-data-[size=sm]/avatar-group:size-6",
110
+ "[&>svg]:size-4 group-has-data-[size=lg]/avatar-group:[&>svg]:size-5 group-has-data-[size=sm]/avatar-group:[&>svg]:size-3",
111
+ className
112
+ ),
113
+ ...props
114
+ }
115
+ );
116
+ });
117
+
118
+ // src/components/chrome/separator.tsx
119
+ import { forwardRef as forwardRef2 } from "react";
120
+ import { Separator as SeparatorPrimitive } from "radix-ui";
121
+ import { jsx as jsx2 } from "react/jsx-runtime";
122
+ var Separator = forwardRef2(function Separator2({ className, orientation = "horizontal", decorative = true, ...props }, ref) {
123
+ return /* @__PURE__ */ jsx2(
124
+ SeparatorPrimitive.Root,
125
+ {
126
+ ref,
127
+ "data-slot": "separator",
128
+ decorative,
129
+ orientation,
130
+ className: cn(
131
+ "shrink-0 bg-border data-horizontal:h-px data-horizontal:w-full data-vertical:w-px data-vertical:self-stretch",
132
+ className
133
+ ),
134
+ ...props
135
+ }
136
+ );
137
+ });
138
+
139
+ // src/components/forms/label.tsx
140
+ import { forwardRef as forwardRef4 } from "react";
141
+ import { Label as LabelPrimitive } from "radix-ui";
142
+
143
+ // src/components/forms/field.tsx
144
+ import {
145
+ Children,
146
+ createContext,
147
+ forwardRef as forwardRef3,
148
+ useCallback,
149
+ useContext,
150
+ useEffect,
151
+ useId,
152
+ useLayoutEffect,
153
+ useMemo,
154
+ useState
155
+ } from "react";
156
+ import { Fragment, jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
157
+ var FieldContext = createContext(null);
158
+ function useFieldContext() {
159
+ return useContext(FieldContext);
160
+ }
161
+ var useIsomorphicLayoutEffect = typeof window === "undefined" ? useEffect : useLayoutEffect;
162
+ function useRegisterPart(field, part, showing) {
163
+ const register = field?.register;
164
+ useIsomorphicLayoutEffect(() => {
165
+ if (!register || !showing) return;
166
+ return register(part);
167
+ }, [register, part, showing]);
168
+ }
169
+ function hasContent(children) {
170
+ return Children.toArray(children).some((child) => child !== "");
171
+ }
172
+ function useFieldControl() {
173
+ const field = useFieldContext();
174
+ if (!field) {
175
+ return {
176
+ id: void 0,
177
+ "aria-describedby": void 0,
178
+ "aria-invalid": void 0,
179
+ "aria-required": void 0,
180
+ disabled: void 0
181
+ };
182
+ }
183
+ const describedBy = [field.hasDescription && field.descriptionId, field.hasError && field.errorId].filter(Boolean).join(" ");
184
+ return {
185
+ id: field.controlId,
186
+ "aria-describedby": describedBy || void 0,
187
+ "aria-invalid": field.invalid || void 0,
188
+ "aria-required": field.required || void 0,
189
+ disabled: field.disabled || void 0
190
+ };
191
+ }
192
+ var ORIENTATION = {
193
+ vertical: "flex-col *:w-full [&>.sr-only]:w-auto",
194
+ horizontal: "flex-row items-center has-[>[data-slot=field-content]]:items-start *:data-[slot=field-label]:flex-auto has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px",
195
+ responsive: "flex-col *:w-full @md/field-group:flex-row @md/field-group:items-center @md/field-group:*:w-auto @md/field-group:has-[>[data-slot=field-content]]:items-start @md/field-group:*:data-[slot=field-label]:flex-auto [&>.sr-only]:w-auto @md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px"
196
+ };
197
+ function Field({
198
+ children,
199
+ id,
200
+ invalid = false,
201
+ required = false,
202
+ disabled = false,
203
+ orientation = "vertical",
204
+ label,
205
+ description,
206
+ error,
207
+ className,
208
+ ...rest
209
+ }) {
210
+ const generated = useId();
211
+ const controlId = id ?? generated;
212
+ const [parts2, setParts] = useState({ description: 0, error: 0 });
213
+ const register = useCallback((part) => {
214
+ setParts((p) => ({ ...p, [part]: p[part] + 1 }));
215
+ return () => setParts((p) => ({ ...p, [part]: p[part] - 1 }));
216
+ }, []);
217
+ const hasError = parts2.error > 0;
218
+ const isInvalid = invalid || hasError;
219
+ const value = useMemo(
220
+ () => ({
221
+ controlId,
222
+ labelId: `${controlId}-label`,
223
+ descriptionId: `${controlId}-description`,
224
+ errorId: `${controlId}-error`,
225
+ hasDescription: parts2.description > 0,
226
+ hasError,
227
+ invalid: isInvalid,
228
+ required,
229
+ disabled,
230
+ register
231
+ }),
232
+ [controlId, parts2, hasError, isInvalid, required, disabled, register]
233
+ );
234
+ let content = children;
235
+ if (label !== void 0 || description !== void 0 || error !== void 0) {
236
+ const labelPart = label !== void 0 ? /* @__PURE__ */ jsx3(FieldLabel, { children: label }) : null;
237
+ const descriptionPart = description !== void 0 ? /* @__PURE__ */ jsx3(FieldDescription, { children: description }) : null;
238
+ content = orientation === "vertical" ? /* @__PURE__ */ jsxs2(Fragment, { children: [
239
+ labelPart,
240
+ children,
241
+ descriptionPart,
242
+ /* @__PURE__ */ jsx3(FieldError, { children: error })
243
+ ] }) : (
244
+ // Beside the control, label and description share a column, as in the reference layout.
245
+ /* @__PURE__ */ jsxs2(Fragment, { children: [
246
+ children,
247
+ descriptionPart ? /* @__PURE__ */ jsxs2(FieldContent, { children: [
248
+ labelPart,
249
+ descriptionPart
250
+ ] }) : labelPart,
251
+ /* @__PURE__ */ jsx3(FieldError, { children: error })
252
+ ] })
253
+ );
254
+ }
255
+ return /* @__PURE__ */ jsx3(FieldContext.Provider, { value, children: /* @__PURE__ */ jsx3(
256
+ "div",
257
+ {
258
+ role: "group",
259
+ "data-slot": "field",
260
+ "data-orientation": orientation,
261
+ "data-invalid": isInvalid || void 0,
262
+ "data-disabled": disabled || void 0,
263
+ className: cn(
264
+ "group/field flex w-full gap-2 data-[invalid=true]:text-destructive",
265
+ ORIENTATION[orientation],
266
+ className
267
+ ),
268
+ ...rest,
269
+ children: content
270
+ }
271
+ ) });
272
+ }
273
+ var CHOICE_CARD = "group/field-label peer/field-label has-[>[data-slot=field]]:flex has-[>[data-slot=field]]:w-full has-[>[data-slot=field]]:flex-col has-[>[data-slot=field]]:rounded-lg has-[>[data-slot=field]]:border has-[>[data-slot=field]]:has-data-checked:border-primary/30 has-[>[data-slot=field]]:has-data-checked:bg-primary/5 has-[>[data-slot=field]]:not-has-[:disabled,[data-disabled]]:hover:bg-muted/50 has-[>[data-slot=field]]:has-[:focus-visible]:border-ring has-[>[data-slot=field]]:has-[:focus-visible]:ring-3 has-[>[data-slot=field]]:has-[:focus-visible]:ring-ring/50 *:data-[slot=field]:p-2.5 dark:has-[>[data-slot=field]]:has-data-checked:border-primary/20 dark:has-[>[data-slot=field]]:has-data-checked:bg-primary/10";
274
+ var FieldLabel = forwardRef3(function FieldLabel2({ className, htmlFor, ...rest }, ref) {
275
+ const field = useFieldContext();
276
+ return /* @__PURE__ */ jsx3(
277
+ Label,
278
+ {
279
+ ref,
280
+ id: field?.labelId,
281
+ htmlFor: htmlFor ?? field?.controlId,
282
+ "data-slot": "field-label",
283
+ className: cn(
284
+ "w-fit leading-snug group-data-[disabled=true]/field:opacity-50",
285
+ // A FieldLabel wrapping a whole Field is a choice card; see CHOICE_CARD.
286
+ CHOICE_CARD,
287
+ className
288
+ ),
289
+ ...rest
290
+ }
291
+ );
292
+ });
293
+ function FieldContent({ className, ...rest }) {
294
+ return /* @__PURE__ */ jsx3(
295
+ "div",
296
+ {
297
+ "data-slot": "field-content",
298
+ className: cn("group/field-content flex flex-1 flex-col gap-0.5 leading-snug", className),
299
+ ...rest
300
+ }
301
+ );
302
+ }
303
+ function FieldTitle({ className, ...rest }) {
304
+ return /* @__PURE__ */ jsx3(
305
+ "div",
306
+ {
307
+ "data-slot": "field-label",
308
+ className: cn(
309
+ "flex w-fit items-center gap-2 text-sm leading-snug font-medium group-data-[disabled=true]/field:opacity-50",
310
+ className
311
+ ),
312
+ ...rest
313
+ }
314
+ );
315
+ }
316
+ function FieldDescription({ children, className, ...rest }) {
317
+ const field = useFieldContext();
318
+ const showing = hasContent(children);
319
+ useRegisterPart(field, "description", showing);
320
+ if (!showing) return null;
321
+ return /* @__PURE__ */ jsx3(
322
+ "p",
323
+ {
324
+ id: field?.descriptionId,
325
+ "data-slot": "field-description",
326
+ className: cn(
327
+ "text-start text-sm leading-normal font-normal text-muted-foreground group-has-data-horizontal/field:text-balance [[data-variant=legend]+&]:-mt-1.5",
328
+ "last:mt-0 nth-last-2:-mt-1",
329
+ "[&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary",
330
+ className
331
+ ),
332
+ ...rest,
333
+ children
334
+ }
335
+ );
336
+ }
337
+ function errorContent(errors) {
338
+ if (!errors?.length) return null;
339
+ const unique = [...new Map(errors.map((e) => [e?.message, e])).values()].filter((e) => e?.message);
340
+ if (unique.length === 0) return null;
341
+ if (unique.length === 1) return unique[0]?.message;
342
+ return /* @__PURE__ */ jsx3("ul", { className: "ms-4 flex list-disc flex-col gap-1", children: unique.map((e, index) => /* @__PURE__ */ jsx3("li", { children: e?.message }, index)) });
343
+ }
344
+ function FieldError({ children, errors, className, ...rest }) {
345
+ const field = useFieldContext();
346
+ const content = hasContent(children) ? children : errorContent(errors);
347
+ const showing = content != null && content !== "";
348
+ useRegisterPart(field, "error", showing);
349
+ if (!showing) return null;
350
+ return /* @__PURE__ */ jsx3(
351
+ "div",
352
+ {
353
+ id: field?.errorId,
354
+ role: "alert",
355
+ "data-slot": "field-error",
356
+ className: cn("text-sm font-normal text-destructive", className),
357
+ ...rest,
358
+ children: content
359
+ }
360
+ );
361
+ }
362
+ function FieldGroup({ children, className, ...rest }) {
363
+ return /* @__PURE__ */ jsx3(
364
+ "div",
365
+ {
366
+ "data-slot": "field-group",
367
+ className: cn(
368
+ "group/field-group @container/field-group flex w-full flex-col gap-5 data-[slot=checkbox-group]:gap-3 *:data-[slot=field-group]:gap-4",
369
+ className
370
+ ),
371
+ ...rest,
372
+ children
373
+ }
374
+ );
375
+ }
376
+ var FieldSet = forwardRef3(function FieldSet2({ children, className, ...rest }, ref) {
377
+ return /* @__PURE__ */ jsx3(
378
+ "fieldset",
379
+ {
380
+ ref,
381
+ "data-slot": "field-set",
382
+ className: cn(
383
+ "flex flex-col gap-4 has-[>[data-slot=checkbox-group]]:gap-3 has-[>[data-slot=radio-group]]:gap-3",
384
+ className
385
+ ),
386
+ ...rest,
387
+ children
388
+ }
389
+ );
390
+ });
391
+ function FieldLegend({ children, variant = "legend", className, ...rest }) {
392
+ return /* @__PURE__ */ jsx3(
393
+ "legend",
394
+ {
395
+ "data-slot": "field-legend",
396
+ "data-variant": variant,
397
+ className: cn("mb-1.5 font-medium data-[variant=label]:text-sm data-[variant=legend]:text-base", className),
398
+ ...rest,
399
+ children
400
+ }
401
+ );
402
+ }
403
+ function FieldSeparator({ children, className, ...rest }) {
404
+ return /* @__PURE__ */ jsxs2(
405
+ "div",
406
+ {
407
+ "data-slot": "field-separator",
408
+ "data-content": !!children,
409
+ className: cn("relative -my-2 h-5 text-sm group-data-[variant=outline]/field-group:-mb-2", className),
410
+ ...rest,
411
+ children: [
412
+ /* @__PURE__ */ jsx3(Separator, { className: "absolute inset-0 top-1/2" }),
413
+ children && /* @__PURE__ */ jsx3(
414
+ "span",
415
+ {
416
+ "data-slot": "field-separator-content",
417
+ className: "relative mx-auto block w-fit bg-background px-2 text-muted-foreground",
418
+ children
419
+ }
420
+ )
421
+ ]
422
+ }
423
+ );
424
+ }
425
+
426
+ // src/components/forms/label.tsx
427
+ import { jsx as jsx4 } from "react/jsx-runtime";
428
+ var Label = forwardRef4(function Label2({ className, htmlFor, ...props }, ref) {
429
+ const field = useFieldContext();
430
+ return /* @__PURE__ */ jsx4(
431
+ LabelPrimitive.Root,
432
+ {
433
+ ref,
434
+ "data-slot": "label",
435
+ htmlFor: htmlFor ?? field?.controlId,
436
+ className: cn(
437
+ "flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",
438
+ className
439
+ ),
440
+ ...props
441
+ }
442
+ );
443
+ });
444
+
445
+ // src/components/forms/textarea.tsx
446
+ import { forwardRef as forwardRef5 } from "react";
447
+ import { jsx as jsx5 } from "react/jsx-runtime";
448
+ var Textarea = forwardRef5(function Textarea2({ className, ...props }, ref) {
449
+ const field = useFieldControl();
450
+ return /* @__PURE__ */ jsx5(
451
+ "textarea",
452
+ {
453
+ ref,
454
+ "data-slot": "textarea",
455
+ ...field,
456
+ required: field["aria-required"],
457
+ className: cn(
458
+ "flex field-sizing-content min-h-16 w-full outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50 border-input dark:bg-input/30 focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:aria-invalid:border-destructive/50 disabled:bg-input/50 dark:disabled:bg-input/80 rounded-lg border bg-transparent px-2.5 py-2 text-base transition-colors focus-visible:ring-3 aria-invalid:ring-3 md:text-sm",
459
+ className
460
+ ),
461
+ ...props
462
+ }
463
+ );
464
+ });
465
+
466
+ // src/components/forms/input-group.tsx
467
+ import { forwardRef as forwardRef7 } from "react";
468
+
469
+ // src/components/forms/input.tsx
470
+ import { forwardRef as forwardRef6 } from "react";
471
+ import { jsx as jsx6, jsxs as jsxs3 } from "react/jsx-runtime";
472
+ var INPUT_CLASSES = "w-full min-w-0 outline-none file:inline-flex file:border-0 file:bg-transparent file:text-foreground placeholder:text-muted-foreground disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 dark:bg-input/30 border-input focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:aria-invalid:border-destructive/50 disabled:bg-input/50 dark:disabled:bg-input/80 h-8 rounded-lg border bg-transparent px-2.5 py-1 text-base transition-colors file:h-6 file:text-sm file:font-medium focus-visible:ring-3 aria-invalid:ring-3 md:text-sm";
473
+ var InputBase = forwardRef6(function InputBase2({ className, type, ...props }, ref) {
474
+ const field = useFieldControl();
475
+ return /* @__PURE__ */ jsx6(
476
+ "input",
477
+ {
478
+ ref,
479
+ type,
480
+ "data-slot": "input",
481
+ ...field,
482
+ required: field["aria-required"],
483
+ className: cn(INPUT_CLASSES, className),
484
+ ...props
485
+ }
486
+ );
487
+ });
488
+ var Input = forwardRef6(function Input2({ leadingIcon: leadingIcon2, trailingIcon, trailingAction, className, ...props }, ref) {
489
+ if (!leadingIcon2 && !trailingIcon && !trailingAction) {
490
+ return /* @__PURE__ */ jsx6(InputBase, { ref, className, ...props });
491
+ }
492
+ return /* @__PURE__ */ jsxs3(InputGroup, { className, children: [
493
+ /* @__PURE__ */ jsx6(InputGroupInput, { ref, ...props }),
494
+ leadingIcon2 && /* @__PURE__ */ jsx6(InputGroupAddon, { children: leadingIcon2 }),
495
+ (trailingIcon || trailingAction) && /* @__PURE__ */ jsxs3(InputGroupAddon, { align: "inline-end", children: [
496
+ trailingIcon,
497
+ trailingAction
498
+ ] })
499
+ ] });
500
+ });
501
+
502
+ // src/components/forms/input-group.tsx
503
+ import { jsx as jsx7 } from "react/jsx-runtime";
504
+ var InputGroup = forwardRef7(function InputGroup2({ className, ...props }, ref) {
505
+ return /* @__PURE__ */ jsx7(
506
+ "div",
507
+ {
508
+ ref,
509
+ "data-slot": "input-group",
510
+ role: "group",
511
+ className: cn(
512
+ "group/input-group relative flex w-full min-w-0 items-center outline-none has-[>textarea]:h-auto border-input dark:bg-input/30 has-[[data-slot=input-group-control]:focus-visible]:border-ring has-[[data-slot=input-group-control]:focus-visible]:ring-ring/50 has-[[data-slot][aria-invalid=true]]:ring-destructive/20 has-[[data-slot][aria-invalid=true]]:border-destructive dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40 has-disabled:bg-input/50 dark:has-disabled:bg-input/80 h-8 rounded-lg border transition-colors in-data-[slot=combobox-content]:focus-within:border-inherit in-data-[slot=combobox-content]:focus-within:ring-0 has-disabled:opacity-50 has-[[data-slot=input-group-control]:focus-visible]:ring-3 has-[[data-slot][aria-invalid=true]]:ring-3 has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>[data-align=block-end]]:[&>input]:pt-3 has-[>[data-align=block-start]]:[&>input]:pb-3 has-[>[data-align=inline-end]]:[&>input]:pr-1.5 has-[>[data-align=inline-start]]:[&>input]:pl-1.5",
513
+ className
514
+ ),
515
+ ...props
516
+ }
517
+ );
518
+ });
519
+ var ADDON_ALIGN = {
520
+ "inline-start": "pl-2 has-[>button]:ml-[-0.3rem] has-[>kbd]:ml-[-0.15rem] order-first",
521
+ "inline-end": "pr-2 has-[>button]:mr-[-0.3rem] has-[>kbd]:mr-[-0.15rem] order-last",
522
+ "block-start": "px-2.5 pt-2 group-has-[>input]/input-group:pt-2 [.border-b]:pb-2 order-first w-full justify-start",
523
+ "block-end": "px-2.5 pb-2 group-has-[>input]/input-group:pb-2 [.border-t]:pt-2 order-last w-full justify-start"
524
+ };
525
+ var InputGroupAddon = forwardRef7(function InputGroupAddon2({ className, align = "inline-start", onClick, ...props }, ref) {
526
+ return (
527
+ // The click only moves focus to the input for a pointer user; a keyboard user tabs to the
528
+ // input directly, and any control inside the addon is a real button with its own keys.
529
+ // eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-noninteractive-element-interactions
530
+ /* @__PURE__ */ jsx7(
531
+ "div",
532
+ {
533
+ ref,
534
+ role: "group",
535
+ "data-slot": "input-group-addon",
536
+ "data-align": align,
537
+ className: cn(
538
+ "flex cursor-text items-center justify-center select-none text-muted-foreground h-auto gap-2 py-1.5 text-sm font-medium group-data-[disabled=true]/input-group:opacity-50 [&>kbd]:rounded-[calc(var(--radius)-5px)] [&>svg:not([class*='size-'])]:size-4",
539
+ ADDON_ALIGN[align],
540
+ className
541
+ ),
542
+ onClick: (event) => {
543
+ onClick?.(event);
544
+ if (event.target.closest("button")) return;
545
+ event.currentTarget.parentElement?.querySelector("input")?.focus();
546
+ },
547
+ ...props
548
+ }
549
+ )
550
+ );
551
+ });
552
+ var BUTTON_SIZE = {
553
+ xs: "h-6 gap-1 rounded-[calc(var(--radius)-3px)] px-1.5 [&>svg:not([class*='size-'])]:size-3.5",
554
+ sm: "",
555
+ "icon-xs": "size-6 rounded-[calc(var(--radius)-3px)] p-0 has-[>svg]:p-0",
556
+ "icon-sm": "size-8 p-0 has-[>svg]:p-0"
557
+ };
558
+ var InputGroupButton = forwardRef7(function InputGroupButton2({ className, type = "button", variant = "ghost", size = "xs", ...props }, ref) {
559
+ return /* @__PURE__ */ jsx7(
560
+ Button,
561
+ {
562
+ ref,
563
+ type,
564
+ size: "default",
565
+ "data-size": size,
566
+ variant,
567
+ className: cn("flex items-center shadow-none gap-2 text-sm", BUTTON_SIZE[size], className),
568
+ ...props
569
+ }
570
+ );
571
+ });
572
+ var InputGroupText = forwardRef7(function InputGroupText2({ className, ...props }, ref) {
573
+ return /* @__PURE__ */ jsx7(
574
+ "span",
575
+ {
576
+ ref,
577
+ className: cn(
578
+ "flex items-center [&_svg]:pointer-events-none text-muted-foreground gap-2 text-sm [&_svg:not([class*='size-'])]:size-4",
579
+ className
580
+ ),
581
+ ...props
582
+ }
583
+ );
584
+ });
585
+ var InputGroupInput = forwardRef7(function InputGroupInput2({ className, ...props }, ref) {
586
+ return /* @__PURE__ */ jsx7(
587
+ InputBase,
588
+ {
589
+ ref,
590
+ "data-slot": "input-group-control",
591
+ className: cn(
592
+ "flex-1 rounded-none border-0 bg-transparent shadow-none ring-0 focus-visible:ring-0 disabled:bg-transparent aria-invalid:ring-0 dark:bg-transparent dark:disabled:bg-transparent",
593
+ className
594
+ ),
595
+ ...props
596
+ }
597
+ );
598
+ });
599
+ var InputGroupTextarea = forwardRef7(function InputGroupTextarea2({ className, ...props }, ref) {
600
+ return /* @__PURE__ */ jsx7(
601
+ Textarea,
602
+ {
603
+ ref,
604
+ "data-slot": "input-group-control",
605
+ className: cn(
606
+ "flex-1 resize-none rounded-none border-0 bg-transparent py-2 shadow-none ring-0 focus-visible:ring-0 disabled:bg-transparent aria-invalid:ring-0 dark:bg-transparent dark:disabled:bg-transparent",
607
+ className
608
+ ),
609
+ ...props
610
+ }
611
+ );
612
+ });
613
+
614
+ // src/components/forms/select.tsx
615
+ import { Fragment as Fragment2, forwardRef as forwardRef8 } from "react";
616
+ import { Select as SelectPrimitive } from "radix-ui";
617
+ import { CheckIcon, ChevronDownIcon, ChevronUpIcon } from "lucide-react";
618
+ import { Fragment as Fragment3, jsx as jsx8, jsxs as jsxs4 } from "react/jsx-runtime";
619
+ function isGroup(entry) {
620
+ return "options" in entry;
621
+ }
622
+ function Select({
623
+ value,
624
+ options,
625
+ placeholder,
626
+ size,
627
+ className,
628
+ id,
629
+ "aria-label": ariaLabel,
630
+ "aria-labelledby": ariaLabelledBy,
631
+ "aria-describedby": ariaDescribedBy,
632
+ "aria-invalid": ariaInvalid,
633
+ "aria-busy": ariaBusy,
634
+ position,
635
+ children,
636
+ ...props
637
+ }) {
638
+ return /* @__PURE__ */ jsx8(SelectPrimitive.Root, { "data-slot": "select", value: value === null ? "" : value, ...props, children: options ? /* @__PURE__ */ jsxs4(Fragment3, { children: [
639
+ /* @__PURE__ */ jsx8(
640
+ SelectTrigger,
641
+ {
642
+ id,
643
+ size,
644
+ className,
645
+ "aria-label": ariaLabel,
646
+ "aria-labelledby": ariaLabelledBy,
647
+ "aria-describedby": ariaDescribedBy,
648
+ "aria-invalid": ariaInvalid,
649
+ "aria-busy": ariaBusy,
650
+ children: /* @__PURE__ */ jsx8(SelectValue, { placeholder })
651
+ }
652
+ ),
653
+ /* @__PURE__ */ jsx8(SelectContent, { position, children: options.map(
654
+ (entry, index) => isGroup(entry) ? /* @__PURE__ */ jsxs4(Fragment2, { children: [
655
+ index > 0 && /* @__PURE__ */ jsx8(SelectSeparator, {}),
656
+ /* @__PURE__ */ jsxs4(SelectGroup, { children: [
657
+ /* @__PURE__ */ jsx8(SelectLabel, { children: entry.label }),
658
+ entry.options.map((option) => /* @__PURE__ */ jsx8(SelectItem, { value: option.value, disabled: option.disabled, children: option.label }, option.value))
659
+ ] })
660
+ ] }, entry.label) : /* @__PURE__ */ jsx8(SelectItem, { value: entry.value, disabled: entry.disabled, children: entry.label }, entry.value)
661
+ ) })
662
+ ] }) : children });
663
+ }
664
+ var SelectGroup = forwardRef8(function SelectGroup2({ className, ...props }, ref) {
665
+ return /* @__PURE__ */ jsx8(SelectPrimitive.Group, { ref, "data-slot": "select-group", className: cn("scroll-my-1 p-1", className), ...props });
666
+ });
667
+ var SelectValue = forwardRef8(function SelectValue2(props, ref) {
668
+ return /* @__PURE__ */ jsx8(SelectPrimitive.Value, { ref, "data-slot": "select-value", ...props });
669
+ });
670
+ var SelectTrigger = forwardRef8(
671
+ function SelectTrigger2({ className, size = "default", children, ...props }, ref) {
672
+ return /* @__PURE__ */ jsxs4(
673
+ SelectPrimitive.Trigger,
674
+ {
675
+ ref,
676
+ "data-slot": "select-trigger",
677
+ "data-size": size,
678
+ className: cn(
679
+ "flex w-fit items-center justify-between gap-1.5 rounded-lg border border-input bg-transparent py-2 pr-2 pl-2.5 text-sm whitespace-nowrap transition-colors outline-none select-none",
680
+ "focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 data-placeholder:text-muted-foreground",
681
+ "aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40",
682
+ "data-[size=default]:h-8 data-[size=sm]:h-7 data-[size=sm]:rounded-[min(var(--radius-md),10px)]",
683
+ "*:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-1.5",
684
+ "[&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
685
+ className
686
+ ),
687
+ ...props,
688
+ children: [
689
+ children,
690
+ /* @__PURE__ */ jsx8(SelectPrimitive.Icon, { asChild: true, children: /* @__PURE__ */ jsx8(ChevronDownIcon, { className: "pointer-events-none size-4 text-muted-foreground" }) })
691
+ ]
692
+ }
693
+ );
694
+ }
695
+ );
696
+ var SelectContent = forwardRef8(function SelectContent2({ className, children, position = "item-aligned", align = "center", ...props }, ref) {
697
+ return /* @__PURE__ */ jsx8(SelectPrimitive.Portal, { children: /* @__PURE__ */ jsxs4(
698
+ SelectPrimitive.Content,
699
+ {
700
+ ref,
701
+ "data-slot": "select-content",
702
+ "data-align-trigger": position === "item-aligned",
703
+ className: cn(
704
+ "relative z-popover max-h-(--radix-select-content-available-height) min-w-36 origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto scrollbar-thin rounded-lg bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100",
705
+ "data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[align-trigger=true]:animate-none",
706
+ position === "popper" && "data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",
707
+ className
708
+ ),
709
+ position,
710
+ align,
711
+ ...props,
712
+ children: [
713
+ /* @__PURE__ */ jsx8(SelectScrollUpButton, {}),
714
+ /* @__PURE__ */ jsx8(
715
+ SelectPrimitive.Viewport,
716
+ {
717
+ "data-position": position,
718
+ className: "data-[position=popper]:h-(--radix-select-trigger-height) data-[position=popper]:w-full data-[position=popper]:min-w-(--radix-select-trigger-width)",
719
+ children
720
+ }
721
+ ),
722
+ /* @__PURE__ */ jsx8(SelectScrollDownButton, {})
723
+ ]
724
+ }
725
+ ) });
726
+ });
727
+ var SelectLabel = forwardRef8(function SelectLabel2({ className, ...props }, ref) {
728
+ return /* @__PURE__ */ jsx8(
729
+ SelectPrimitive.Label,
730
+ {
731
+ ref,
732
+ "data-slot": "select-label",
733
+ className: cn("px-1.5 py-1 text-xs text-muted-foreground", className),
734
+ ...props
735
+ }
736
+ );
737
+ });
738
+ var SelectItem = forwardRef8(function SelectItem2({ className, children, ...props }, ref) {
739
+ return /* @__PURE__ */ jsxs4(
740
+ SelectPrimitive.Item,
741
+ {
742
+ ref,
743
+ "data-slot": "select-item",
744
+ className: cn(
745
+ "relative flex w-full cursor-default items-center gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50",
746
+ "[&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",
747
+ className
748
+ ),
749
+ ...props,
750
+ children: [
751
+ /* @__PURE__ */ jsx8("span", { className: "pointer-events-none absolute right-2 flex size-4 items-center justify-center", children: /* @__PURE__ */ jsx8(SelectPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx8(CheckIcon, { className: "pointer-events-none" }) }) }),
752
+ /* @__PURE__ */ jsx8(SelectPrimitive.ItemText, { children })
753
+ ]
754
+ }
755
+ );
756
+ });
757
+ var SelectSeparator = forwardRef8(function SelectSeparator2({ className, ...props }, ref) {
758
+ return /* @__PURE__ */ jsx8(
759
+ SelectPrimitive.Separator,
760
+ {
761
+ ref,
762
+ "data-slot": "select-separator",
763
+ className: cn("pointer-events-none -mx-1 my-1 h-px bg-border", className),
764
+ ...props
765
+ }
766
+ );
767
+ });
768
+ var SelectScrollUpButton = forwardRef8(function SelectScrollUpButton2({ className, ...props }, ref) {
769
+ return /* @__PURE__ */ jsx8(
770
+ SelectPrimitive.ScrollUpButton,
771
+ {
772
+ ref,
773
+ "data-slot": "select-scroll-up-button",
774
+ className: cn(
775
+ "z-10 flex cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4",
776
+ className
777
+ ),
778
+ ...props,
779
+ children: /* @__PURE__ */ jsx8(ChevronUpIcon, {})
780
+ }
781
+ );
782
+ });
783
+ var SelectScrollDownButton = forwardRef8(function SelectScrollDownButton2({ className, ...props }, ref) {
784
+ return /* @__PURE__ */ jsx8(
785
+ SelectPrimitive.ScrollDownButton,
786
+ {
787
+ ref,
788
+ "data-slot": "select-scroll-down-button",
789
+ className: cn(
790
+ "z-10 flex cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4",
791
+ className
792
+ ),
793
+ ...props,
794
+ children: /* @__PURE__ */ jsx8(ChevronDownIcon, {})
795
+ }
796
+ );
797
+ });
798
+
799
+ // src/components/overlays/portal.tsx
800
+ import { createContext as createContext2, useContext as useContext2, useEffect as useEffect2, useState as useState2 } from "react";
801
+ import { createPortal } from "react-dom";
802
+ import { jsx as jsx9 } from "react/jsx-runtime";
803
+ var PortalContainerContext = createContext2(null);
804
+ function PortalContainerProvider({
805
+ container,
806
+ children
807
+ }) {
808
+ return /* @__PURE__ */ jsx9(PortalContainerContext.Provider, { value: container, children });
809
+ }
810
+ function usePortalContainer() {
811
+ return useContext2(PortalContainerContext);
812
+ }
813
+ function Portal({ children, container }) {
814
+ const [mounted, setMounted] = useState2(false);
815
+ const contextContainer = useContext2(PortalContainerContext);
816
+ useEffect2(() => setMounted(true), []);
817
+ if (!mounted) return null;
818
+ const target = container ?? contextContainer ?? (typeof document === "undefined" ? null : document.body);
819
+ if (!target) return null;
820
+ return createPortal(children, target);
821
+ }
822
+
823
+ // src/components/overlays/popover.tsx
824
+ import {
825
+ createContext as createContext3,
826
+ forwardRef as forwardRef9,
827
+ useContext as useContext3,
828
+ useId as useId2,
829
+ useMemo as useMemo2,
830
+ useState as useState4
831
+ } from "react";
832
+ import { Popover as PopoverPrimitive } from "radix-ui";
833
+
834
+ // src/components/overlays/overlay-stack.ts
835
+ import { useEffect as useEffect3, useRef, useState as useState3 } from "react";
836
+ var layers = [];
837
+ var deferredEscapes = /* @__PURE__ */ new WeakSet();
838
+ function deferEscapeToInnerPopup(event) {
839
+ const target = event.target;
840
+ const fromOpenCombobox = target instanceof Element && target.closest('[role="combobox"][aria-expanded="true"]') !== null;
841
+ if (layers.length === 0 && !fromOpenCombobox) return false;
842
+ deferredEscapes.add(event);
843
+ event.preventDefault();
844
+ return true;
845
+ }
846
+
847
+ // src/components/overlays/popover.tsx
848
+ import { Fragment as Fragment4, jsx as jsx10, jsxs as jsxs5 } from "react/jsx-runtime";
849
+ var PopoverTriggerNode = createContext3(null);
850
+ function Popover({
851
+ children,
852
+ open,
853
+ defaultOpen,
854
+ onOpenChange,
855
+ modal = false,
856
+ content,
857
+ title,
858
+ description,
859
+ side,
860
+ align,
861
+ className
862
+ }) {
863
+ const [node, setNode] = useState4(null);
864
+ const trigger = useMemo2(() => ({ node, setNode, modal }), [node, modal]);
865
+ const shorthand = content !== void 0 || title !== void 0 || description !== void 0;
866
+ return /* @__PURE__ */ jsx10(
867
+ PopoverPrimitive.Root,
868
+ {
869
+ "data-slot": "popover",
870
+ open,
871
+ defaultOpen,
872
+ onOpenChange,
873
+ modal,
874
+ children: /* @__PURE__ */ jsx10(PopoverTriggerNode.Provider, { value: trigger, children: shorthand ? /* @__PURE__ */ jsxs5(Fragment4, { children: [
875
+ /* @__PURE__ */ jsx10(PopoverTrigger, { asChild: true, children }),
876
+ /* @__PURE__ */ jsxs5(PopoverContent, { side, align, className, children: [
877
+ (title !== void 0 || description !== void 0) && /* @__PURE__ */ jsxs5(PopoverHeader, { children: [
878
+ title !== void 0 && /* @__PURE__ */ jsx10(PopoverTitle, { children: title }),
879
+ description !== void 0 && /* @__PURE__ */ jsx10(PopoverDescription, { children: description })
880
+ ] }),
881
+ content
882
+ ] })
883
+ ] }) : children })
884
+ }
885
+ );
886
+ }
887
+ var PopoverTrigger = forwardRef9(function PopoverTrigger2(props, ref) {
888
+ const trigger = useContext3(PopoverTriggerNode);
889
+ const fallbackId = useId2();
890
+ return /* @__PURE__ */ jsx10(
891
+ PopoverPrimitive.Trigger,
892
+ {
893
+ ref: composeRefs(ref, trigger?.setNode),
894
+ id: props.id ?? fallbackId,
895
+ "data-slot": "popover-trigger",
896
+ ...props
897
+ }
898
+ );
899
+ });
900
+ var PopoverContent = forwardRef9(function PopoverContent2({
901
+ children,
902
+ side = "bottom",
903
+ align = "center",
904
+ sideOffset = 4,
905
+ alignOffset,
906
+ container,
907
+ className,
908
+ onOpenAutoFocus,
909
+ ...rest
910
+ }, ref) {
911
+ const trigger = useContext3(PopoverTriggerNode);
912
+ const inherited = usePortalContainer();
913
+ const named = Boolean(rest["aria-label"] || rest["aria-labelledby"]);
914
+ return /* @__PURE__ */ jsx10(PopoverPrimitive.Portal, { container: container ?? inherited ?? void 0, children: /* @__PURE__ */ jsx10(
915
+ PopoverPrimitive.Content,
916
+ {
917
+ ref,
918
+ "data-slot": "popover-content",
919
+ side,
920
+ align,
921
+ sideOffset,
922
+ alignOffset,
923
+ collisionPadding: 8,
924
+ onOpenAutoFocus,
925
+ onEscapeKeyDown: (event) => void deferEscapeToInnerPopup(event),
926
+ "aria-modal": trigger?.modal || void 0,
927
+ "aria-labelledby": named ? void 0 : trigger?.node?.id || void 0,
928
+ className: cn(
929
+ "z-popover flex w-72 origin-(--radix-popover-content-transform-origin) flex-col gap-2.5 rounded-lg bg-popover p-2.5 text-sm text-popover-foreground shadow-md ring-1 ring-foreground/10 outline-hidden duration-100",
930
+ "data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",
931
+ "data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
932
+ className
933
+ ),
934
+ ...rest,
935
+ children
936
+ }
937
+ ) });
938
+ });
939
+ var PopoverHeader = forwardRef9(function PopoverHeader2({ className, ...props }, ref) {
940
+ return /* @__PURE__ */ jsx10("div", { ref, "data-slot": "popover-header", className: cn("flex flex-col gap-0.5 text-sm", className), ...props });
941
+ });
942
+ var PopoverTitle = forwardRef9(function PopoverTitle2({ className, ...props }, ref) {
943
+ return /* @__PURE__ */ jsx10("div", { ref, "data-slot": "popover-title", className: cn("font-medium", className), ...props });
944
+ });
945
+ var PopoverDescription = forwardRef9(
946
+ function PopoverDescription2({ className, ...props }, ref) {
947
+ return /* @__PURE__ */ jsx10("p", { ref, "data-slot": "popover-description", className: cn("text-muted-foreground", className), ...props });
948
+ }
949
+ );
950
+ var PopoverClose = forwardRef9(
951
+ function PopoverClose2(props, ref) {
952
+ return /* @__PURE__ */ jsx10(PopoverPrimitive.Close, { ref, "data-slot": "popover-close", ...props });
953
+ }
954
+ );
955
+ var PopoverAnchor = forwardRef9(
956
+ function PopoverAnchor2(props, ref) {
957
+ return /* @__PURE__ */ jsx10(PopoverPrimitive.Anchor, { ref, "data-slot": "popover-anchor", ...props });
958
+ }
959
+ );
960
+
961
+ // src/components/forms/toggle.tsx
962
+ import {
963
+ createContext as createContext4,
964
+ forwardRef as forwardRef10,
965
+ useContext as useContext4
966
+ } from "react";
967
+ import { Toggle as TogglePrimitive, ToggleGroup as ToggleGroupPrimitive } from "radix-ui";
968
+ import { jsx as jsx11 } from "react/jsx-runtime";
969
+ var VARIANT = {
970
+ default: "bg-transparent",
971
+ outline: "border border-input bg-transparent hover:bg-muted"
972
+ };
973
+ var SIZE = {
974
+ default: "h-8 min-w-8 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",
975
+ sm: "h-7 min-w-7 rounded-[min(var(--radius-md),12px)] px-2.5 text-[0.8rem] has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5",
976
+ lg: "h-9 min-w-9 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2"
977
+ };
978
+ function toggleVariants({
979
+ variant = "default",
980
+ size = "default"
981
+ } = {}) {
982
+ return cn(
983
+ "group/toggle inline-flex items-center justify-center gap-1 rounded-lg text-sm font-medium whitespace-nowrap transition-all outline-none hover:bg-muted hover:text-foreground",
984
+ "focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50",
985
+ "aria-invalid:border-destructive aria-invalid:ring-destructive/20 aria-pressed:bg-muted data-[state=on]:bg-muted dark:aria-invalid:ring-destructive/40",
986
+ "[&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
987
+ VARIANT[variant],
988
+ SIZE[size]
989
+ );
990
+ }
991
+ var Toggle = forwardRef10(function Toggle2({ className, variant = "default", size = "default", ...props }, ref) {
992
+ return /* @__PURE__ */ jsx11(
993
+ TogglePrimitive.Root,
994
+ {
995
+ ref,
996
+ "data-slot": "toggle",
997
+ className: cn(toggleVariants({ variant, size }), className),
998
+ ...props
999
+ }
1000
+ );
1001
+ });
1002
+ var ToggleGroupContext = createContext4({
1003
+ variant: "default",
1004
+ size: "default",
1005
+ spacing: 2,
1006
+ orientation: "horizontal"
1007
+ });
1008
+ var ToggleGroup = forwardRef10(
1009
+ function ToggleGroup2({ className, variant, size, spacing = 2, orientation = "horizontal", options, children, style, ...props }, ref) {
1010
+ return /* @__PURE__ */ jsx11(
1011
+ ToggleGroupPrimitive.Root,
1012
+ {
1013
+ ref,
1014
+ "data-slot": "toggle-group",
1015
+ "data-variant": variant,
1016
+ "data-size": size,
1017
+ "data-spacing": spacing,
1018
+ "data-orientation": orientation,
1019
+ orientation,
1020
+ style: { "--gap": spacing, ...style },
1021
+ className: cn(
1022
+ "group/toggle-group flex w-fit flex-row items-center gap-[--spacing(var(--gap))] rounded-lg data-[size=sm]:rounded-[min(var(--radius-md),10px)] data-vertical:flex-col data-vertical:items-stretch",
1023
+ className
1024
+ ),
1025
+ ...props,
1026
+ children: /* @__PURE__ */ jsx11(ToggleGroupContext.Provider, { value: { variant, size, spacing, orientation }, children: options ? options.map((option) => /* @__PURE__ */ jsx11(
1027
+ ToggleGroupItem,
1028
+ {
1029
+ value: option.value,
1030
+ "aria-label": option["aria-label"],
1031
+ disabled: option.disabled,
1032
+ children: option.label
1033
+ },
1034
+ option.value
1035
+ )) : children })
1036
+ }
1037
+ );
1038
+ }
1039
+ );
1040
+ var ToggleGroupItem = forwardRef10(
1041
+ function ToggleGroupItem2({ className, variant = "default", size = "default", ...props }, ref) {
1042
+ const context = useContext4(ToggleGroupContext);
1043
+ const itemVariant = context.variant || variant;
1044
+ const itemSize = context.size || size;
1045
+ return /* @__PURE__ */ jsx11(
1046
+ ToggleGroupPrimitive.Item,
1047
+ {
1048
+ ref,
1049
+ "data-slot": "toggle-group-item",
1050
+ "data-variant": itemVariant,
1051
+ "data-size": itemSize,
1052
+ "data-spacing": context.spacing,
1053
+ className: cn(
1054
+ toggleVariants({ variant: itemVariant, size: itemSize }),
1055
+ "shrink-0 focus:z-10 focus-visible:z-10",
1056
+ "group-data-[spacing=0]/toggle-group:rounded-none group-data-[spacing=0]/toggle-group:px-2 group-data-[spacing=0]/toggle-group:has-data-[icon=inline-end]:pr-1.5 group-data-[spacing=0]/toggle-group:has-data-[icon=inline-start]:pl-1.5",
1057
+ "group-data-horizontal/toggle-group:data-[spacing=0]:first:rounded-l-lg group-data-vertical/toggle-group:data-[spacing=0]:first:rounded-t-lg group-data-horizontal/toggle-group:data-[spacing=0]:last:rounded-r-lg group-data-vertical/toggle-group:data-[spacing=0]:last:rounded-b-lg",
1058
+ "group-data-horizontal/toggle-group:data-[spacing=0]:data-[variant=outline]:border-l-0 group-data-vertical/toggle-group:data-[spacing=0]:data-[variant=outline]:border-t-0 group-data-horizontal/toggle-group:data-[spacing=0]:data-[variant=outline]:first:border-l group-data-vertical/toggle-group:data-[spacing=0]:data-[variant=outline]:first:border-t",
1059
+ className
1060
+ ),
1061
+ ...props
1062
+ }
1063
+ );
1064
+ }
1065
+ );
1066
+
1067
+ // src/components/status/badge.tsx
1068
+ import { cloneElement, forwardRef as forwardRef11, isValidElement } from "react";
1069
+ import { Fragment as Fragment5, jsx as jsx12, jsxs as jsxs6 } from "react/jsx-runtime";
1070
+ var BADGE_COLORS = ["blue", "green", "violet", "yellow", "teal", "pink", "lime", "red", "slate", "gray", "orange"];
1071
+ var BASE = "group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3!";
1072
+ var VARIANT2 = {
1073
+ default: "bg-primary text-primary-foreground [a]:hover:bg-primary/80",
1074
+ secondary: "bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80",
1075
+ destructive: "bg-destructive/10 text-destructive focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:focus-visible:ring-destructive/40 [a]:hover:bg-destructive/20",
1076
+ outline: "border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground",
1077
+ ghost: "hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50",
1078
+ link: "text-primary underline-offset-4 hover:underline"
1079
+ };
1080
+ var FILL = {
1081
+ gray: "bg-badge-gray text-badge-gray",
1082
+ red: "bg-badge-red text-badge-red",
1083
+ orange: "bg-badge-orange text-badge-orange",
1084
+ yellow: "bg-badge-yellow text-badge-yellow",
1085
+ lime: "bg-badge-lime text-badge-lime",
1086
+ green: "bg-badge-green text-badge-green",
1087
+ teal: "bg-badge-teal text-badge-teal",
1088
+ blue: "bg-badge-blue text-badge-blue",
1089
+ pink: "bg-badge-pink text-badge-pink",
1090
+ slate: "bg-badge-slate text-badge-slate",
1091
+ violet: "bg-badge-violet text-badge-violet"
1092
+ };
1093
+ var OUTLINE = {
1094
+ gray: "border-badge-gray text-badge-gray",
1095
+ red: "border-badge-red text-badge-red",
1096
+ orange: "border-badge-orange text-badge-orange",
1097
+ yellow: "border-badge-yellow text-badge-yellow",
1098
+ lime: "border-badge-lime text-badge-lime",
1099
+ green: "border-badge-green text-badge-green",
1100
+ teal: "border-badge-teal text-badge-teal",
1101
+ blue: "border-badge-blue text-badge-blue",
1102
+ pink: "border-badge-pink text-badge-pink",
1103
+ slate: "border-badge-slate text-badge-slate",
1104
+ violet: "border-badge-violet text-badge-violet"
1105
+ };
1106
+ function leadingIcon(icon) {
1107
+ if (isValidElement(icon)) {
1108
+ return cloneElement(icon, { "data-icon": "inline-start", "aria-hidden": true });
1109
+ }
1110
+ return /* @__PURE__ */ jsx12("span", { "data-icon": "inline-start", "aria-hidden": true, className: "inline-flex size-3 shrink-0 [&>svg]:size-full", children: icon });
1111
+ }
1112
+ var Badge = forwardRef11(function Badge2({ className, variant = "default", color, asChild = false, icon, indicator = false, children, ...props }, ref) {
1113
+ const Comp = asChild ? Slot : "span";
1114
+ const tint = color ? variant === "default" ? FILL[color] : variant === "outline" ? OUTLINE[color] : "" : "";
1115
+ return /* @__PURE__ */ jsx12(
1116
+ Comp,
1117
+ {
1118
+ ref,
1119
+ "data-slot": "badge",
1120
+ "data-variant": variant,
1121
+ "data-color": color,
1122
+ className: cn(BASE, VARIANT2[variant], tint, className),
1123
+ ...props,
1124
+ children: asChild ? children : /* @__PURE__ */ jsxs6(Fragment5, { children: [
1125
+ indicator && /* @__PURE__ */ jsx12("span", { "data-icon": "inline-start", "aria-hidden": true, className: "size-1.5 shrink-0 rounded-full bg-current" }),
1126
+ icon !== void 0 && icon !== null && leadingIcon(icon),
1127
+ children
1128
+ ] })
1129
+ }
1130
+ );
1131
+ });
1132
+
1133
+ // src/components/overlays/dialog.tsx
1134
+ import {
1135
+ createContext as createContext5,
1136
+ forwardRef as forwardRef12,
1137
+ useContext as useContext5,
1138
+ useEffect as useEffect4,
1139
+ useState as useState5
1140
+ } from "react";
1141
+ import { Dialog as DialogPrimitive } from "radix-ui";
1142
+ import { XIcon } from "lucide-react";
1143
+
1144
+ // src/components/overlays/toaster-guard.ts
1145
+ function isInsideToaster(target) {
1146
+ return target instanceof Element && target.closest("[data-sonner-toaster], [data-sonner-toast]") !== null;
1147
+ }
1148
+
1149
+ // src/components/overlays/dialog.tsx
1150
+ import { jsx as jsx13, jsxs as jsxs7 } from "react/jsx-runtime";
1151
+ var DialogNaming = createContext5(null);
1152
+ var DialogTrigger = forwardRef12(
1153
+ function DialogTrigger2(props, ref) {
1154
+ return /* @__PURE__ */ jsx13(DialogPrimitive.Trigger, { ref, "data-slot": "dialog-trigger", ...props });
1155
+ }
1156
+ );
1157
+ function DialogPortal({ container, ...props }) {
1158
+ const provided = usePortalContainer();
1159
+ return /* @__PURE__ */ jsx13(DialogPrimitive.Portal, { "data-slot": "dialog-portal", container: container ?? provided ?? void 0, ...props });
1160
+ }
1161
+ var DialogClose = forwardRef12(
1162
+ function DialogClose2(props, ref) {
1163
+ return /* @__PURE__ */ jsx13(DialogPrimitive.Close, { ref, "data-slot": "dialog-close", ...props });
1164
+ }
1165
+ );
1166
+ var DialogOverlay = forwardRef12(
1167
+ function DialogOverlay2({ className, ...props }, ref) {
1168
+ return /* @__PURE__ */ jsx13(
1169
+ DialogPrimitive.Overlay,
1170
+ {
1171
+ ref,
1172
+ "data-slot": "dialog-overlay",
1173
+ className: cn(
1174
+ "fixed inset-0 isolate z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0",
1175
+ className
1176
+ ),
1177
+ ...props
1178
+ }
1179
+ );
1180
+ }
1181
+ );
1182
+ var DialogContent = forwardRef12(function DialogContent2({ container, ...props }, ref) {
1183
+ return /* @__PURE__ */ jsxs7(DialogPortal, { container: container ?? void 0, children: [
1184
+ /* @__PURE__ */ jsx13(DialogOverlay, {}),
1185
+ /* @__PURE__ */ jsx13(DialogPanel, { ref, ...props })
1186
+ ] });
1187
+ });
1188
+ var DialogPanel = forwardRef12(function DialogPanel2({
1189
+ className,
1190
+ children,
1191
+ showCloseButton = true,
1192
+ label,
1193
+ initialFocus,
1194
+ onOpenAutoFocus,
1195
+ onCloseAutoFocus,
1196
+ onEscapeKeyDown,
1197
+ onPointerDownOutside,
1198
+ ...props
1199
+ }, ref) {
1200
+ const [hasTitle, setHasTitle] = useState5(false);
1201
+ const [hasDescription, setHasDescription] = useState5(false);
1202
+ const [contentNode, setContentNode] = useState5(null);
1203
+ const [returnFocusTo] = useState5(
1204
+ () => typeof document === "undefined" ? null : document.activeElement
1205
+ );
1206
+ return /* @__PURE__ */ jsxs7(
1207
+ DialogPrimitive.Content,
1208
+ {
1209
+ ref: composeRefs(ref, setContentNode),
1210
+ "data-slot": "dialog-content",
1211
+ ...hasDescription ? {} : { "aria-describedby": void 0 },
1212
+ className: cn(
1213
+ "fixed top-1/2 left-1/2 z-50 grid w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-4 rounded-xl bg-popover p-4 text-sm text-popover-foreground ring-1 ring-foreground/10 duration-100 outline-none sm:max-w-sm",
1214
+ "data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",
1215
+ className
1216
+ ),
1217
+ onOpenAutoFocus: (event) => {
1218
+ onOpenAutoFocus?.(event);
1219
+ const target = initialFocus?.current;
1220
+ if (target && !event.defaultPrevented) {
1221
+ event.preventDefault();
1222
+ target.focus();
1223
+ }
1224
+ },
1225
+ onCloseAutoFocus: (event) => {
1226
+ onCloseAutoFocus?.(event);
1227
+ if (event.defaultPrevented) return;
1228
+ if (returnFocusTo?.isConnected && returnFocusTo !== document.body) {
1229
+ event.preventDefault();
1230
+ returnFocusTo.focus();
1231
+ }
1232
+ },
1233
+ onEscapeKeyDown: (event) => {
1234
+ if (!deferEscapeToInnerPopup(event)) onEscapeKeyDown?.(event);
1235
+ },
1236
+ onPointerDownOutside: (event) => {
1237
+ if (isInsideToaster(event.target)) {
1238
+ event.preventDefault();
1239
+ return;
1240
+ }
1241
+ onPointerDownOutside?.(event);
1242
+ },
1243
+ ...props,
1244
+ children: [
1245
+ !hasTitle && label && /* @__PURE__ */ jsx13(DialogPrimitive.Title, { className: "sr-only", children: label }),
1246
+ /* @__PURE__ */ jsx13(
1247
+ DialogNaming.Provider,
1248
+ {
1249
+ value: {
1250
+ registerTitle: setHasTitle,
1251
+ registerDescription: setHasDescription
1252
+ },
1253
+ children: /* @__PURE__ */ jsx13(PortalContainerProvider, { container: contentNode, children })
1254
+ }
1255
+ ),
1256
+ showCloseButton && /* @__PURE__ */ jsx13(DialogPrimitive.Close, { "data-slot": "dialog-close", asChild: true, children: /* @__PURE__ */ jsxs7(Button, { variant: "ghost", size: "icon-sm", className: "absolute end-2 top-2", children: [
1257
+ /* @__PURE__ */ jsx13(XIcon, {}),
1258
+ /* @__PURE__ */ jsx13("span", { className: "sr-only", children: "Close" })
1259
+ ] }) })
1260
+ ]
1261
+ }
1262
+ );
1263
+ });
1264
+ var DialogHeader = forwardRef12(function DialogHeader2({ className, ...props }, ref) {
1265
+ return /* @__PURE__ */ jsx13("div", { ref, "data-slot": "dialog-header", className: cn("flex flex-col gap-2", className), ...props });
1266
+ });
1267
+ var DialogFooter = forwardRef12(function DialogFooter2({ className, showCloseButton = false, children, ...props }, ref) {
1268
+ return /* @__PURE__ */ jsxs7(
1269
+ "div",
1270
+ {
1271
+ ref,
1272
+ "data-slot": "dialog-footer",
1273
+ className: cn(
1274
+ "-mx-4 -mb-4 flex flex-col-reverse gap-2 rounded-b-xl border-t bg-muted/50 p-4 sm:flex-row sm:justify-end",
1275
+ className
1276
+ ),
1277
+ ...props,
1278
+ children: [
1279
+ children,
1280
+ showCloseButton && /* @__PURE__ */ jsx13(DialogPrimitive.Close, { asChild: true, children: /* @__PURE__ */ jsx13(Button, { variant: "outline", children: "Close" }) })
1281
+ ]
1282
+ }
1283
+ );
1284
+ });
1285
+ var DialogTitle = forwardRef12(
1286
+ function DialogTitle2({ className, ...props }, ref) {
1287
+ const naming = useContext5(DialogNaming);
1288
+ useEffect4(() => {
1289
+ naming?.registerTitle(true);
1290
+ return () => naming?.registerTitle(false);
1291
+ }, [naming]);
1292
+ return /* @__PURE__ */ jsx13(
1293
+ DialogPrimitive.Title,
1294
+ {
1295
+ ref,
1296
+ "data-slot": "dialog-title",
1297
+ className: cn("text-base leading-none font-medium", className),
1298
+ ...props
1299
+ }
1300
+ );
1301
+ }
1302
+ );
1303
+ var DialogDescription = forwardRef12(function DialogDescription2({ className, ...props }, ref) {
1304
+ const naming = useContext5(DialogNaming);
1305
+ useEffect4(() => {
1306
+ naming?.registerDescription(true);
1307
+ return () => naming?.registerDescription(false);
1308
+ }, [naming]);
1309
+ return /* @__PURE__ */ jsx13(
1310
+ DialogPrimitive.Description,
1311
+ {
1312
+ ref,
1313
+ "data-slot": "dialog-description",
1314
+ className: cn(
1315
+ "text-sm text-muted-foreground *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground",
1316
+ className
1317
+ ),
1318
+ ...props
1319
+ }
1320
+ );
1321
+ });
1322
+ function Dialog({
1323
+ trigger,
1324
+ title,
1325
+ description,
1326
+ footer,
1327
+ showCloseButton,
1328
+ className,
1329
+ contentProps,
1330
+ children,
1331
+ ...props
1332
+ }) {
1333
+ if (title === void 0) {
1334
+ return /* @__PURE__ */ jsxs7(DialogPrimitive.Root, { "data-slot": "dialog", ...props, children: [
1335
+ trigger && /* @__PURE__ */ jsx13(DialogTrigger, { asChild: true, children: trigger }),
1336
+ children
1337
+ ] });
1338
+ }
1339
+ return /* @__PURE__ */ jsxs7(DialogPrimitive.Root, { "data-slot": "dialog", ...props, children: [
1340
+ trigger && /* @__PURE__ */ jsx13(DialogTrigger, { asChild: true, children: trigger }),
1341
+ /* @__PURE__ */ jsxs7(DialogContent, { className, showCloseButton, ...contentProps, children: [
1342
+ /* @__PURE__ */ jsxs7(DialogHeader, { children: [
1343
+ /* @__PURE__ */ jsx13(DialogTitle, { children: title }),
1344
+ description !== void 0 && /* @__PURE__ */ jsx13(DialogDescription, { children: description })
1345
+ ] }),
1346
+ children,
1347
+ footer !== void 0 && /* @__PURE__ */ jsx13(DialogFooter, { children: footer })
1348
+ ] })
1349
+ ] });
1350
+ }
1351
+
1352
+ // src/components/forms/command.tsx
1353
+ import {
1354
+ Children as Children2,
1355
+ createContext as createContext6,
1356
+ forwardRef as forwardRef13,
1357
+ isValidElement as isValidElement2,
1358
+ useCallback as useCallback3,
1359
+ useContext as useContext6,
1360
+ useEffect as useEffect5,
1361
+ useId as useId3,
1362
+ useLayoutEffect as useLayoutEffect2,
1363
+ useMemo as useMemo3,
1364
+ useRef as useRef3,
1365
+ useState as useState7
1366
+ } from "react";
1367
+ import { CheckIcon as CheckIcon2, SearchIcon } from "lucide-react";
1368
+
1369
+ // src/lib/use-controllable-state.ts
1370
+ import { useCallback as useCallback2, useRef as useRef2, useState as useState6 } from "react";
1371
+ function useControllableState({
1372
+ value,
1373
+ defaultValue,
1374
+ onChange
1375
+ }) {
1376
+ const [internal, setInternal] = useState6(defaultValue);
1377
+ const isControlled = value !== void 0;
1378
+ const current = isControlled ? value : internal;
1379
+ const onChangeRef = useRef2(onChange);
1380
+ onChangeRef.current = onChange;
1381
+ const currentRef = useRef2(current);
1382
+ currentRef.current = current;
1383
+ const isControlledRef = useRef2(isControlled);
1384
+ isControlledRef.current = isControlled;
1385
+ const setValue = useCallback2((next) => {
1386
+ const resolved = typeof next === "function" ? next(currentRef.current) : next;
1387
+ if (resolved === currentRef.current) return;
1388
+ if (!isControlledRef.current) setInternal(resolved);
1389
+ onChangeRef.current?.(resolved);
1390
+ }, []);
1391
+ return [current, setValue];
1392
+ }
1393
+
1394
+ // src/components/forms/command.tsx
1395
+ import { Fragment as Fragment6, jsx as jsx14, jsxs as jsxs8 } from "react/jsx-runtime";
1396
+ var defaultFilter = (value, search, keywords) => {
1397
+ const q = search.trim().toLowerCase();
1398
+ if (!q) return 1;
1399
+ if (value.toLowerCase().includes(q)) return 1;
1400
+ return keywords?.some((keyword) => keyword.toLowerCase().includes(q)) ? 1 : 0;
1401
+ };
1402
+ var CommandContext = createContext6(null);
1403
+ function useCommand(part) {
1404
+ const ctx = useContext6(CommandContext);
1405
+ if (!ctx) throw new Error(`${part} must be used inside <Command>.`);
1406
+ return ctx;
1407
+ }
1408
+ function textOf(node) {
1409
+ if (node === null || node === void 0 || typeof node === "boolean") return "";
1410
+ if (typeof node === "string" || typeof node === "number") return String(node);
1411
+ if (Array.isArray(node)) return node.map(textOf).join("");
1412
+ if (isValidElement2(node)) return textOf(node.props.children);
1413
+ return Children2.toArray(node).map(textOf).join("");
1414
+ }
1415
+ var itemsIn = (root) => root ? Array.from(root.querySelectorAll('[cmdk-item]:not([data-disabled="true"])')) : [];
1416
+ var Command = forwardRef13(function Command2({
1417
+ items,
1418
+ placeholder = "Type a command or search...",
1419
+ empty = "No results found.",
1420
+ onAfterSelect,
1421
+ autoFocus = false,
1422
+ label = "Command menu",
1423
+ value,
1424
+ defaultValue,
1425
+ onValueChange,
1426
+ filter = defaultFilter,
1427
+ shouldFilter = true,
1428
+ loop = false,
1429
+ className,
1430
+ children,
1431
+ ...props
1432
+ }, ref) {
1433
+ const [search, setSearch] = useState7("");
1434
+ const [selected, setSelectedState] = useControllableState({
1435
+ value,
1436
+ defaultValue,
1437
+ onChange: onValueChange
1438
+ });
1439
+ const [ids, setIds] = useState7([]);
1440
+ const rootRef = useRef3(null);
1441
+ const baseId = useId3();
1442
+ const listId = `${baseId}-list`;
1443
+ const register = useCallback3((id) => {
1444
+ setIds((current) => [...current, id]);
1445
+ return () => setIds((current) => current.filter((x) => x !== id));
1446
+ }, []);
1447
+ const matches = useCallback3(
1448
+ (itemValue, keywords) => !shouldFilter || filter(itemValue, search, keywords) > 0,
1449
+ [filter, search, shouldFilter]
1450
+ );
1451
+ const setSelected = useCallback3((next) => setSelectedState(next), [setSelectedState]);
1452
+ useLayoutEffect2(() => {
1453
+ const list = itemsIn(rootRef.current);
1454
+ if (list.some((node) => node.dataset.value === selected)) return;
1455
+ setSelectedState(list[0]?.dataset.value);
1456
+ }, [search, ids.length]);
1457
+ const activeNode = rootRef.current?.querySelector(
1458
+ `[cmdk-item][data-value="${CSS.escape(selected ?? "")}"]`
1459
+ );
1460
+ const activeId = selected === void 0 ? void 0 : activeNode?.id;
1461
+ useEffect5(() => {
1462
+ if (activeNode && typeof activeNode.scrollIntoView === "function") activeNode.scrollIntoView({ block: "nearest" });
1463
+ }, [activeNode]);
1464
+ const onKeyNav = (event) => {
1465
+ const list = itemsIn(rootRef.current);
1466
+ if (list.length === 0) return;
1467
+ const index = list.findIndex((node) => node.dataset.value === selected);
1468
+ const go = (next) => {
1469
+ event.preventDefault();
1470
+ const target = loop ? (next + list.length) % list.length : Math.min(Math.max(next, 0), list.length - 1);
1471
+ setSelectedState(list[target]?.dataset.value);
1472
+ };
1473
+ switch (event.key) {
1474
+ case "ArrowDown":
1475
+ go(index + 1);
1476
+ break;
1477
+ case "ArrowUp":
1478
+ go(index - 1);
1479
+ break;
1480
+ case "Home":
1481
+ go(0);
1482
+ break;
1483
+ case "End":
1484
+ go(list.length - 1);
1485
+ break;
1486
+ case "Enter":
1487
+ if (index >= 0) {
1488
+ event.preventDefault();
1489
+ list[index].click();
1490
+ }
1491
+ break;
1492
+ default:
1493
+ break;
1494
+ }
1495
+ };
1496
+ const ctx = {
1497
+ search,
1498
+ setSearch,
1499
+ selected,
1500
+ setSelected,
1501
+ matches,
1502
+ register,
1503
+ count: ids.length,
1504
+ listId,
1505
+ label,
1506
+ onKeyNav,
1507
+ activeId,
1508
+ rootRef
1509
+ };
1510
+ const groups = useMemo3(() => {
1511
+ if (!items) return [];
1512
+ const order = [];
1513
+ for (const item of items) if (!order.includes(item.group)) order.push(item.group);
1514
+ return order.map((group) => ({ group, items: items.filter((item) => item.group === group) }));
1515
+ }, [items]);
1516
+ return /* @__PURE__ */ jsx14(CommandContext.Provider, { value: ctx, children: /* @__PURE__ */ jsxs8(
1517
+ "div",
1518
+ {
1519
+ ref: (node) => {
1520
+ rootRef.current = node;
1521
+ if (typeof ref === "function") ref(node);
1522
+ else if (ref) ref.current = node;
1523
+ },
1524
+ "cmdk-root": "",
1525
+ "data-slot": "command",
1526
+ className: cn("relative flex size-full flex-col overflow-hidden bg-popover text-popover-foreground rounded-xl! p-1", className),
1527
+ ...props,
1528
+ children: [
1529
+ items ? /* @__PURE__ */ jsxs8(Fragment6, { children: [
1530
+ /* @__PURE__ */ jsx14(CommandInput, { placeholder, autoFocus }),
1531
+ /* @__PURE__ */ jsxs8(CommandList, { children: [
1532
+ /* @__PURE__ */ jsx14(CommandEmpty, { children: empty }),
1533
+ groups.map(({ group, items: groupItems }, index) => /* @__PURE__ */ jsx14(
1534
+ CommandShorthandGroup,
1535
+ {
1536
+ heading: group,
1537
+ separator: index > 0,
1538
+ items: groupItems,
1539
+ onAfterSelect
1540
+ },
1541
+ group ?? `__ungrouped-${index}`
1542
+ ))
1543
+ ] })
1544
+ ] }) : children,
1545
+ /* @__PURE__ */ jsx14("span", { "aria-live": "polite", className: "sr-only", children: `${ids.length} ${ids.length === 1 ? "result" : "results"}` })
1546
+ ]
1547
+ }
1548
+ ) });
1549
+ });
1550
+ function CommandShorthandGroup({
1551
+ heading,
1552
+ separator,
1553
+ items,
1554
+ onAfterSelect
1555
+ }) {
1556
+ return /* @__PURE__ */ jsxs8(Fragment6, { children: [
1557
+ separator && /* @__PURE__ */ jsx14(CommandSeparator, {}),
1558
+ /* @__PURE__ */ jsx14(CommandGroup, { heading, children: items.map((item) => /* @__PURE__ */ jsxs8(
1559
+ CommandItem,
1560
+ {
1561
+ value: item.label,
1562
+ keywords: item.keywords,
1563
+ disabled: item.disabled,
1564
+ onSelect: () => {
1565
+ item.onSelect();
1566
+ onAfterSelect?.();
1567
+ },
1568
+ children: [
1569
+ item.icon,
1570
+ item.description ? /* @__PURE__ */ jsxs8("span", { className: "flex min-w-0 flex-col", children: [
1571
+ /* @__PURE__ */ jsx14("span", { className: "truncate", children: item.label }),
1572
+ /* @__PURE__ */ jsx14("span", { className: "truncate text-xs text-muted-foreground", children: item.description })
1573
+ ] }) : /* @__PURE__ */ jsx14("span", { children: item.label }),
1574
+ item.shortcut && /* @__PURE__ */ jsx14(CommandShortcut, { children: item.shortcut })
1575
+ ]
1576
+ },
1577
+ item.id
1578
+ )) })
1579
+ ] });
1580
+ }
1581
+ function CommandDialog({
1582
+ title = "Command Palette",
1583
+ description = "Search for a command to run...",
1584
+ showCloseButton = false,
1585
+ className,
1586
+ children,
1587
+ ...props
1588
+ }) {
1589
+ return /* @__PURE__ */ jsx14(Dialog, { ...props, children: /* @__PURE__ */ jsxs8(
1590
+ DialogContent,
1591
+ {
1592
+ className: cn("top-1/3 translate-y-0 overflow-hidden rounded-xl! p-0", className),
1593
+ showCloseButton,
1594
+ children: [
1595
+ /* @__PURE__ */ jsxs8(DialogHeader, { className: "sr-only", children: [
1596
+ /* @__PURE__ */ jsx14(DialogTitle, { children: title }),
1597
+ /* @__PURE__ */ jsx14(DialogDescription, { children: description })
1598
+ ] }),
1599
+ children
1600
+ ]
1601
+ }
1602
+ ) });
1603
+ }
1604
+ var CommandInput = forwardRef13(function CommandInput2({ className, value, onValueChange, ...props }, ref) {
1605
+ const ctx = useCommand("CommandInput");
1606
+ const search = value ?? ctx.search;
1607
+ return /* @__PURE__ */ jsx14("div", { "data-slot": "command-input-wrapper", className: "p-1 pb-0", children: /* @__PURE__ */ jsxs8(InputGroup, { className: "bg-input/30 border-input/30 h-8! rounded-lg! shadow-none! *:data-[slot=input-group-addon]:pl-2!", children: [
1608
+ /* @__PURE__ */ jsx14(
1609
+ "input",
1610
+ {
1611
+ ref,
1612
+ "cmdk-input": "",
1613
+ "data-slot": "command-input",
1614
+ role: "combobox",
1615
+ type: "text",
1616
+ autoComplete: "off",
1617
+ autoCorrect: "off",
1618
+ spellCheck: false,
1619
+ "aria-autocomplete": "list",
1620
+ "aria-expanded": true,
1621
+ "aria-controls": ctx.listId,
1622
+ "aria-activedescendant": ctx.activeId,
1623
+ "aria-label": ctx.label,
1624
+ value: search,
1625
+ onChange: (event) => {
1626
+ ctx.setSearch(event.target.value);
1627
+ onValueChange?.(event.target.value);
1628
+ },
1629
+ onKeyDown: (event) => {
1630
+ props.onKeyDown?.(event);
1631
+ if (!event.defaultPrevented) ctx.onKeyNav(event);
1632
+ },
1633
+ className: cn(
1634
+ "w-full text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50 bg-transparent placeholder:text-muted-foreground",
1635
+ className
1636
+ ),
1637
+ ...props
1638
+ }
1639
+ ),
1640
+ /* @__PURE__ */ jsx14(InputGroupAddon, { children: /* @__PURE__ */ jsx14(SearchIcon, { className: "size-4 shrink-0 opacity-50" }) })
1641
+ ] }) });
1642
+ });
1643
+ var CommandList = forwardRef13(function CommandList2({ className, ...props }, ref) {
1644
+ const ctx = useCommand("CommandList");
1645
+ return /* @__PURE__ */ jsx14(
1646
+ "div",
1647
+ {
1648
+ ref,
1649
+ "cmdk-list": "",
1650
+ "data-slot": "command-list",
1651
+ id: ctx.listId,
1652
+ role: "listbox",
1653
+ "aria-label": ctx.label,
1654
+ tabIndex: -1,
1655
+ className: cn("no-scrollbar max-h-72 scroll-py-1 outline-none overflow-x-hidden overflow-y-auto", className),
1656
+ ...props
1657
+ }
1658
+ );
1659
+ });
1660
+ var CommandEmpty = forwardRef13(function CommandEmpty2({ className, ...props }, ref) {
1661
+ const ctx = useCommand("CommandEmpty");
1662
+ if (ctx.count > 0) return null;
1663
+ return /* @__PURE__ */ jsx14(
1664
+ "div",
1665
+ {
1666
+ ref,
1667
+ "cmdk-empty": "",
1668
+ "data-slot": "command-empty",
1669
+ role: "presentation",
1670
+ className: cn("py-6 text-center text-sm", className),
1671
+ ...props
1672
+ }
1673
+ );
1674
+ });
1675
+ var CommandGroup = forwardRef13(function CommandGroup2({ className, heading, children, ...props }, ref) {
1676
+ const headingId = useId3();
1677
+ return /* @__PURE__ */ jsxs8(
1678
+ "div",
1679
+ {
1680
+ ref,
1681
+ "cmdk-group": "",
1682
+ "data-slot": "command-group",
1683
+ role: "presentation",
1684
+ className: cn(
1685
+ "text-foreground **:[[cmdk-group-heading]]:text-muted-foreground overflow-hidden p-1 **:[[cmdk-group-heading]]:px-2 **:[[cmdk-group-heading]]:py-1.5 **:[[cmdk-group-heading]]:text-xs **:[[cmdk-group-heading]]:font-medium not-has-[[cmdk-item]]:hidden",
1686
+ className
1687
+ ),
1688
+ ...props,
1689
+ children: [
1690
+ heading && /* @__PURE__ */ jsx14("div", { "cmdk-group-heading": "", "aria-hidden": true, id: headingId, children: heading }),
1691
+ /* @__PURE__ */ jsx14("div", { "cmdk-group-items": "", role: "group", "aria-labelledby": heading ? headingId : void 0, children })
1692
+ ]
1693
+ }
1694
+ );
1695
+ });
1696
+ var CommandSeparator = forwardRef13(function CommandSeparator2({ className, alwaysRender = false, ...props }, ref) {
1697
+ const ctx = useCommand("CommandSeparator");
1698
+ if (ctx.search && !alwaysRender) return null;
1699
+ return /* @__PURE__ */ jsx14(
1700
+ "div",
1701
+ {
1702
+ ref,
1703
+ "cmdk-separator": "",
1704
+ "data-slot": "command-separator",
1705
+ "aria-hidden": true,
1706
+ className: cn("bg-border -mx-1 h-px", className),
1707
+ ...props
1708
+ }
1709
+ );
1710
+ });
1711
+ var CommandItem = forwardRef13(function CommandItem2({ className, children, value: valueProp, keywords, disabled = false, onSelect, forceMount = false, ...props }, ref) {
1712
+ const ctx = useCommand("CommandItem");
1713
+ const id = useId3();
1714
+ const value = (valueProp ?? textOf(children)).trim();
1715
+ const visible = forceMount || ctx.matches(value, keywords);
1716
+ const { register } = ctx;
1717
+ useLayoutEffect2(() => {
1718
+ if (!visible) return void 0;
1719
+ return register(id);
1720
+ }, [visible, register, id]);
1721
+ if (!visible) return null;
1722
+ const isSelected = ctx.selected === value;
1723
+ return (
1724
+ // Focus stays in the input; the list highlight is aria-activedescendant. Enter on the
1725
+ // input clicks the highlighted item, so the click handler is the keyboard path too.
1726
+ // eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/interactive-supports-focus
1727
+ /* @__PURE__ */ jsxs8(
1728
+ "div",
1729
+ {
1730
+ ref,
1731
+ id,
1732
+ "cmdk-item": "",
1733
+ "data-slot": "command-item",
1734
+ role: "option",
1735
+ "aria-selected": isSelected,
1736
+ "aria-disabled": disabled || void 0,
1737
+ "data-selected": isSelected,
1738
+ "data-disabled": disabled,
1739
+ "data-value": value,
1740
+ onPointerMove: () => {
1741
+ if (!disabled && !isSelected) ctx.setSelected(value);
1742
+ },
1743
+ onClick: () => {
1744
+ if (!disabled) onSelect?.(value);
1745
+ },
1746
+ className: cn(
1747
+ "group/command-item data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 data-selected:bg-muted data-selected:text-foreground data-selected:*:[svg]:text-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none in-data-[slot=dialog-content]:rounded-lg! [&_svg:not([class*='size-'])]:size-4",
1748
+ className
1749
+ ),
1750
+ ...props,
1751
+ children: [
1752
+ children,
1753
+ /* @__PURE__ */ jsx14(CheckIcon2, { className: "ml-auto opacity-0 group-has-data-[slot=command-shortcut]/command-item:hidden group-data-[checked=true]/command-item:opacity-100" })
1754
+ ]
1755
+ }
1756
+ )
1757
+ );
1758
+ });
1759
+ var CommandShortcut = forwardRef13(function CommandShortcut2({ className, ...props }, ref) {
1760
+ return /* @__PURE__ */ jsx14(
1761
+ "span",
1762
+ {
1763
+ ref,
1764
+ "data-slot": "command-shortcut",
1765
+ className: cn("text-muted-foreground group-data-selected/command-item:text-foreground ml-auto text-xs tracking-widest", className),
1766
+ ...props
1767
+ }
1768
+ );
1769
+ });
1770
+
1771
+ // src/components/forms/checkbox.tsx
1772
+ import { forwardRef as forwardRef14, useEffect as useEffect6, useId as useId4, useRef as useRef4 } from "react";
1773
+ import { CheckIcon as CheckIcon3, MinusIcon } from "lucide-react";
1774
+ import { jsx as jsx15, jsxs as jsxs9 } from "react/jsx-runtime";
1775
+ var BOX = "peer relative size-4 shrink-0 cursor-pointer appearance-none rounded-[4px] border border-input bg-transparent outline-none transition-colors after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-checked:border-primary data-checked:bg-primary data-[state=indeterminate]:border-primary data-[state=indeterminate]:bg-primary aria-invalid:data-checked:border-primary group-has-disabled/field:opacity-50 group-has-[:focus-visible]/field-label:ring-0 group-has-[:focus-visible]/field-label:not-data-checked:border-input group-has-[:focus-visible]/field-label:data-checked:border-primary dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 dark:data-checked:bg-primary";
1776
+ var Checkbox = forwardRef14(function Checkbox2({ checked: checkedProp, defaultChecked = false, onCheckedChange, label, description, card = false, id, className, disabled, ...props }, ref) {
1777
+ const [checked, setChecked] = useControllableState({
1778
+ value: checkedProp,
1779
+ defaultValue: defaultChecked,
1780
+ // Only clicks change it, and a click always yields a boolean.
1781
+ onChange: onCheckedChange
1782
+ });
1783
+ const inputRef = useRef4(null);
1784
+ const generatedId = useId4();
1785
+ const controlId = id ?? (label != null ? generatedId : void 0);
1786
+ const descriptionId = `${controlId ?? generatedId}-description`;
1787
+ const indeterminate = checked === "indeterminate";
1788
+ const state = indeterminate ? "indeterminate" : checked ? "checked" : "unchecked";
1789
+ useEffect6(() => {
1790
+ if (inputRef.current) inputRef.current.indeterminate = indeterminate;
1791
+ }, [indeterminate]);
1792
+ const box = /* @__PURE__ */ jsxs9("span", { className: cn("relative inline-flex size-4 shrink-0", label == null && className), children: [
1793
+ /* @__PURE__ */ jsx15(
1794
+ "input",
1795
+ {
1796
+ ref: composeRefs(inputRef, ref),
1797
+ id: controlId,
1798
+ type: "checkbox",
1799
+ "data-slot": "checkbox",
1800
+ "data-state": state,
1801
+ checked: checked === true,
1802
+ disabled,
1803
+ "aria-describedby": description != null && !card ? descriptionId : void 0,
1804
+ onChange: (event) => setChecked(event.target.checked),
1805
+ className: BOX,
1806
+ ...props
1807
+ }
1808
+ ),
1809
+ /* @__PURE__ */ jsx15(
1810
+ "span",
1811
+ {
1812
+ "aria-hidden": true,
1813
+ "data-slot": "checkbox-indicator",
1814
+ className: "pointer-events-none absolute inset-0 grid place-content-center text-primary-foreground transition-none [&>svg]:size-3.5",
1815
+ children: indeterminate ? /* @__PURE__ */ jsx15(MinusIcon, {}) : checked ? /* @__PURE__ */ jsx15(CheckIcon3, {}) : null
1816
+ }
1817
+ )
1818
+ ] });
1819
+ if (label == null) return box;
1820
+ const labelElement = card ? /* @__PURE__ */ jsx15(
1821
+ "div",
1822
+ {
1823
+ "data-slot": "field-label",
1824
+ className: "flex w-fit items-center gap-2 text-sm leading-snug font-medium group-data-[disabled=true]/field:opacity-50",
1825
+ children: label
1826
+ }
1827
+ ) : /* @__PURE__ */ jsx15(
1828
+ "label",
1829
+ {
1830
+ htmlFor: controlId,
1831
+ "data-slot": "field-label",
1832
+ className: "group/field-label peer/field-label flex w-fit items-center gap-2 text-sm leading-snug font-medium select-none group-data-[disabled=true]/field:opacity-50",
1833
+ children: label
1834
+ }
1835
+ );
1836
+ const field = /* @__PURE__ */ jsxs9(
1837
+ "div",
1838
+ {
1839
+ role: card ? void 0 : "group",
1840
+ "data-slot": "field",
1841
+ "data-orientation": "horizontal",
1842
+ "data-disabled": disabled || void 0,
1843
+ className: cn(
1844
+ "group/field flex w-full flex-row items-center gap-2 has-[>[data-slot=field-content]]:items-start data-[invalid=true]:text-destructive has-[>[data-slot=field-content]]:[&>span:first-child]:mt-px *:data-[slot=field-label]:flex-auto",
1845
+ !card && className
1846
+ ),
1847
+ children: [
1848
+ box,
1849
+ description != null ? /* @__PURE__ */ jsxs9("div", { "data-slot": "field-content", className: "group/field-content flex flex-1 flex-col gap-0.5 leading-snug", children: [
1850
+ labelElement,
1851
+ /* @__PURE__ */ jsx15(
1852
+ "p",
1853
+ {
1854
+ id: descriptionId,
1855
+ "data-slot": "field-description",
1856
+ className: "text-left text-sm leading-normal font-normal text-muted-foreground group-has-data-horizontal/field:text-balance",
1857
+ children: description
1858
+ }
1859
+ )
1860
+ ] }) : labelElement
1861
+ ]
1862
+ }
1863
+ );
1864
+ if (!card) return field;
1865
+ return /* @__PURE__ */ jsx15("label", { "data-slot": "field-label", className: cn("group/field-label peer/field-label text-sm", CHOICE_CARD, className), children: field });
1866
+ });
1867
+
1868
+ // src/lib/scrollbar.ts
1869
+ import clsx from "clsx";
1870
+ var SCROLLBAR_CLASSES = clsx("scrollbar-thin");
1871
+
1872
+ // src/components/overlays/dropdown-menu.tsx
1873
+ import {
1874
+ createContext as createContext7,
1875
+ forwardRef as forwardRef16,
1876
+ useContext as useContext7,
1877
+ useMemo as useMemo4,
1878
+ useRef as useRef5
1879
+ } from "react";
1880
+ import { DropdownMenu as DropdownMenuPrimitive } from "radix-ui";
1881
+ import { EllipsisIcon } from "lucide-react";
1882
+
1883
+ // src/lib/compose-event-handlers.ts
1884
+ function composeEventHandlers(theirs, ours) {
1885
+ return (event) => {
1886
+ theirs?.(event);
1887
+ if (!event.defaultPrevented) ours(event);
1888
+ };
1889
+ }
1890
+
1891
+ // src/components/overlays/menu-core.tsx
1892
+ import {
1893
+ Fragment as Fragment7,
1894
+ forwardRef as forwardRef15,
1895
+ useId as useId5
1896
+ } from "react";
1897
+ import { CheckIcon as CheckIcon4, ChevronRightIcon } from "lucide-react";
1898
+ import { Fragment as Fragment8, jsx as jsx16, jsxs as jsxs10 } from "react/jsx-runtime";
1899
+ var ITEM_RESET = "relative flex cursor-default items-center outline-hidden select-none data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0";
1900
+ function stopToAncestors(event) {
1901
+ event.stopPropagation();
1902
+ }
1903
+ function focusMenuEdge(event, edge) {
1904
+ if (event.target !== event.currentTarget) return;
1905
+ const panel = event.currentTarget;
1906
+ queueMicrotask(() => {
1907
+ const items = panel.querySelectorAll('[role^="menuitem"]:not([data-disabled])');
1908
+ if (edge === "end") items[items.length - 1]?.focus();
1909
+ else if (document.activeElement === panel) items[0]?.focus();
1910
+ });
1911
+ }
1912
+ function visibleMenuItems(items) {
1913
+ const kept = items.filter((item) => {
1914
+ if (item.hidden) return false;
1915
+ if (item.type === "group" || item.type === "submenu") return visibleMenuItems(item.items).length > 0;
1916
+ return true;
1917
+ });
1918
+ return kept.filter((item, i) => {
1919
+ if (item.type !== "separator") return true;
1920
+ const prev = kept[i - 1];
1921
+ return i > 0 && i < kept.length - 1 && prev.type !== "separator";
1922
+ });
1923
+ }
1924
+ function createMenuParts(P, slot, classes) {
1925
+ const Shortcut = forwardRef15(function MenuShortcut({ className, ...rest }, ref) {
1926
+ return /* @__PURE__ */ jsx16("span", { ref, "data-slot": `${slot}-shortcut`, className: cn(classes.shortcut, className), ...rest });
1927
+ });
1928
+ const Item = forwardRef15(function MenuItem({ children, variant = "default", inset, icon, description, shortcut, className, ...rest }, ref) {
1929
+ const descriptionId = useId5();
1930
+ const shorthand = icon !== void 0 || description !== void 0 || shortcut !== void 0;
1931
+ return /* @__PURE__ */ jsx16(
1932
+ P.Item,
1933
+ {
1934
+ ref,
1935
+ "data-slot": `${slot}-item`,
1936
+ "data-inset": inset,
1937
+ "data-variant": variant,
1938
+ "aria-describedby": description ? descriptionId : void 0,
1939
+ className: cn(ITEM_RESET, classes.item, className),
1940
+ ...rest,
1941
+ children: shorthand ? /* @__PURE__ */ jsxs10(Fragment8, { children: [
1942
+ icon,
1943
+ description ? /* @__PURE__ */ jsxs10("span", { className: "flex min-w-0 flex-col", children: [
1944
+ /* @__PURE__ */ jsx16("span", { className: "truncate", children }),
1945
+ /* @__PURE__ */ jsx16("span", { id: descriptionId, className: "text-xs text-muted-foreground", children: description })
1946
+ ] }) : children,
1947
+ shortcut && /* @__PURE__ */ jsx16(Shortcut, { children: shortcut })
1948
+ ] }) : children
1949
+ }
1950
+ );
1951
+ });
1952
+ const CheckboxItem = forwardRef15(function MenuCheckboxItem({ children, checked, onCheckedChange, inset, shortcut, className, ...rest }, ref) {
1953
+ return /* @__PURE__ */ jsxs10(
1954
+ P.CheckboxItem,
1955
+ {
1956
+ ref,
1957
+ "data-slot": `${slot}-checkbox-item`,
1958
+ "data-inset": inset,
1959
+ checked,
1960
+ onCheckedChange: onCheckedChange ? (next) => onCheckedChange(next === true) : void 0,
1961
+ className: cn(ITEM_RESET, classes.checkboxItem, className),
1962
+ ...rest,
1963
+ children: [
1964
+ /* @__PURE__ */ jsx16("span", { className: cn("pointer-events-none", classes.indicator), children: /* @__PURE__ */ jsx16(P.ItemIndicator, { children: /* @__PURE__ */ jsx16(CheckIcon4, {}) }) }),
1965
+ children,
1966
+ shortcut && /* @__PURE__ */ jsx16(Shortcut, { children: shortcut })
1967
+ ]
1968
+ }
1969
+ );
1970
+ });
1971
+ function RadioGroup({ children, value, onValueChange }) {
1972
+ return /* @__PURE__ */ jsx16(P.RadioGroup, { "data-slot": `${slot}-radio-group`, value, onValueChange, children });
1973
+ }
1974
+ const RadioItem = forwardRef15(function MenuRadioItem({ children, inset, shortcut, className, ...rest }, ref) {
1975
+ return /* @__PURE__ */ jsxs10(
1976
+ P.RadioItem,
1977
+ {
1978
+ ref,
1979
+ "data-slot": `${slot}-radio-item`,
1980
+ "data-inset": inset,
1981
+ className: cn(ITEM_RESET, classes.radioItem, className),
1982
+ ...rest,
1983
+ children: [
1984
+ /* @__PURE__ */ jsx16("span", { className: cn("pointer-events-none", classes.indicator), children: /* @__PURE__ */ jsx16(P.ItemIndicator, { children: /* @__PURE__ */ jsx16(CheckIcon4, {}) }) }),
1985
+ children,
1986
+ shortcut && /* @__PURE__ */ jsx16(Shortcut, { children: shortcut })
1987
+ ]
1988
+ }
1989
+ );
1990
+ });
1991
+ const Label3 = forwardRef15(function MenuLabel({ className, inset, ...rest }, ref) {
1992
+ return /* @__PURE__ */ jsx16(
1993
+ P.Label,
1994
+ {
1995
+ ref,
1996
+ "data-slot": `${slot}-label`,
1997
+ "data-inset": inset,
1998
+ className: cn(classes.label, className),
1999
+ ...rest
2000
+ }
2001
+ );
2002
+ });
2003
+ const Group = forwardRef15(function MenuGroup({ children, label, className, ...rest }, ref) {
2004
+ const labelId = useId5();
2005
+ return /* @__PURE__ */ jsxs10(
2006
+ P.Group,
2007
+ {
2008
+ ref,
2009
+ "data-slot": `${slot}-group`,
2010
+ "aria-labelledby": label ? labelId : void 0,
2011
+ className,
2012
+ ...rest,
2013
+ children: [
2014
+ label && /* @__PURE__ */ jsx16(Label3, { id: labelId, children: label }),
2015
+ children
2016
+ ]
2017
+ }
2018
+ );
2019
+ });
2020
+ const Separator3 = forwardRef15(function MenuSeparator({ className, ...rest }, ref) {
2021
+ return /* @__PURE__ */ jsx16(P.Separator, { ref, "data-slot": `${slot}-separator`, className: cn(classes.separator, className), ...rest });
2022
+ });
2023
+ function Sub({ children, open, defaultOpen, onOpenChange }) {
2024
+ return /* @__PURE__ */ jsx16(P.Sub, { "data-slot": `${slot}-sub`, open, defaultOpen, onOpenChange, children });
2025
+ }
2026
+ const SubTrigger = forwardRef15(function MenuSubTrigger({ children, inset, icon, className, ...rest }, ref) {
2027
+ return /* @__PURE__ */ jsxs10(
2028
+ P.SubTrigger,
2029
+ {
2030
+ ref,
2031
+ "data-slot": `${slot}-sub-trigger`,
2032
+ "data-inset": inset,
2033
+ className: cn(
2034
+ "flex cursor-default items-center outline-hidden select-none [&_svg]:pointer-events-none [&_svg]:shrink-0",
2035
+ classes.subTrigger,
2036
+ className
2037
+ ),
2038
+ ...rest,
2039
+ children: [
2040
+ icon,
2041
+ children,
2042
+ /* @__PURE__ */ jsx16(ChevronRightIcon, { className: "ms-auto rtl:rotate-180" })
2043
+ ]
2044
+ }
2045
+ );
2046
+ });
2047
+ const SubContent = forwardRef15(function MenuSubContent({ className, onClick, onKeyDown, ...rest }, ref) {
2048
+ const container = usePortalContainer();
2049
+ return /* @__PURE__ */ jsx16(P.Portal, { container: container ?? void 0, children: /* @__PURE__ */ jsx16(
2050
+ P.SubContent,
2051
+ {
2052
+ ref,
2053
+ "data-slot": `${slot}-sub-content`,
2054
+ className: cn(classes.subContent, className),
2055
+ onClick: (event) => {
2056
+ onClick?.(event);
2057
+ stopToAncestors(event);
2058
+ },
2059
+ onKeyDown: (event) => {
2060
+ onKeyDown?.(event);
2061
+ stopToAncestors(event);
2062
+ },
2063
+ ...rest
2064
+ }
2065
+ ) });
2066
+ });
2067
+ function Items({ items }) {
2068
+ return /* @__PURE__ */ jsx16(Fragment8, { children: visibleMenuItems(items).map(renderItem) });
2069
+ }
2070
+ function renderItem(item) {
2071
+ switch (item.type) {
2072
+ case "checkbox":
2073
+ return /* @__PURE__ */ jsx16(
2074
+ CheckboxItem,
2075
+ {
2076
+ checked: item.checked,
2077
+ onCheckedChange: item.onCheckedChange,
2078
+ disabled: item.disabled,
2079
+ shortcut: item.shortcut,
2080
+ textValue: item.textValue,
2081
+ children: item.label
2082
+ },
2083
+ item.id
2084
+ );
2085
+ case "radio":
2086
+ return /* @__PURE__ */ jsx16(RadioGroup, { value: item.value, onValueChange: item.onValueChange, children: item.options.map((option) => /* @__PURE__ */ jsx16(RadioItem, { value: option.value, disabled: option.disabled, children: option.label }, option.value)) }, item.id);
2087
+ case "group":
2088
+ return /* @__PURE__ */ jsx16(Group, { label: item.label, children: /* @__PURE__ */ jsx16(Items, { items: item.items }) }, item.id);
2089
+ case "submenu":
2090
+ return /* @__PURE__ */ jsxs10(Sub, { children: [
2091
+ /* @__PURE__ */ jsx16(SubTrigger, { icon: item.icon, disabled: item.disabled, children: item.label }),
2092
+ /* @__PURE__ */ jsx16(SubContent, { children: /* @__PURE__ */ jsx16(Items, { items: item.items }) })
2093
+ ] }, item.id);
2094
+ case "label":
2095
+ return /* @__PURE__ */ jsx16(Label3, { children: item.label }, item.id);
2096
+ case "separator":
2097
+ return /* @__PURE__ */ jsx16(Separator3, {}, item.id);
2098
+ case "custom":
2099
+ return /* @__PURE__ */ jsx16(Fragment7, { children: item.render() }, item.id);
2100
+ default:
2101
+ return /* @__PURE__ */ jsx16(
2102
+ Item,
2103
+ {
2104
+ onSelect: item.onSelect,
2105
+ variant: item.variant,
2106
+ inset: item.inset,
2107
+ disabled: item.disabled,
2108
+ icon: item.icon,
2109
+ description: item.description,
2110
+ shortcut: item.shortcut,
2111
+ textValue: item.textValue,
2112
+ children: item.label
2113
+ },
2114
+ item.id
2115
+ );
2116
+ }
2117
+ }
2118
+ return {
2119
+ Items,
2120
+ Item,
2121
+ CheckboxItem,
2122
+ RadioGroup,
2123
+ RadioItem,
2124
+ Group,
2125
+ Label: Label3,
2126
+ Separator: Separator3,
2127
+ Shortcut,
2128
+ Sub,
2129
+ SubTrigger,
2130
+ SubContent
2131
+ };
2132
+ }
2133
+
2134
+ // src/components/overlays/dropdown-menu.tsx
2135
+ import { Fragment as Fragment9, jsx as jsx17, jsxs as jsxs11 } from "react/jsx-runtime";
2136
+ var DROPDOWN_MENU_CLASSES = {
2137
+ item: "group/dropdown-menu-item focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:text-destructive not-data-[variant=destructive]:focus:**:text-accent-foreground gap-1.5 rounded-md px-1.5 py-1 text-sm data-inset:ps-7 [&_svg:not([class*='size-'])]:size-4",
2138
+ checkboxItem: "focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground gap-1.5 rounded-md py-1 pe-8 ps-1.5 text-sm data-inset:ps-7 [&_svg:not([class*='size-'])]:size-4",
2139
+ radioItem: "focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground gap-1.5 rounded-md py-1 pe-8 ps-1.5 text-sm data-inset:ps-7 [&_svg:not([class*='size-'])]:size-4",
2140
+ indicator: "absolute end-2 flex items-center justify-center",
2141
+ label: "text-muted-foreground px-1.5 py-1 text-xs font-medium data-inset:ps-7",
2142
+ separator: "bg-border -mx-1 my-1 h-px",
2143
+ shortcut: "text-muted-foreground group-focus/dropdown-menu-item:text-accent-foreground ms-auto text-xs tracking-widest",
2144
+ subTrigger: "focus:bg-accent focus:text-accent-foreground data-open:bg-accent data-open:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground gap-1.5 rounded-md px-1.5 py-1 text-sm data-inset:ps-7 [&_svg:not([class*='size-'])]:size-4",
2145
+ subContent: "z-popover origin-(--radix-dropdown-menu-content-transform-origin) overflow-hidden data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 ring-foreground/10 bg-popover text-popover-foreground min-w-[96px] rounded-lg p-1 shadow-lg ring-1 duration-100"
2146
+ };
2147
+ var CONTENT_CLASSES = "z-popover max-h-(--radix-dropdown-menu-content-available-height) w-(--radix-dropdown-menu-trigger-width) origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto scrollbar-thin data-[state=closed]:overflow-hidden data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=inline-end]:slide-in-from-left-2 ring-foreground/10 bg-popover text-popover-foreground min-w-32 rounded-lg p-1 shadow-md ring-1 duration-100";
2148
+ var DropdownMenuStateContext = createContext7(null);
2149
+ function useDropdownMenuState(part) {
2150
+ const value = useContext7(DropdownMenuStateContext);
2151
+ if (!value) throw new Error(`<${part}> must be used inside <DropdownMenu>`);
2152
+ return value;
2153
+ }
2154
+ function DropdownMenu({
2155
+ children,
2156
+ items,
2157
+ trigger,
2158
+ label,
2159
+ side,
2160
+ align,
2161
+ open: openProp,
2162
+ defaultOpen = false,
2163
+ onOpenChange,
2164
+ modal = true
2165
+ }) {
2166
+ const [open, setOpen] = useControllableState({
2167
+ value: openProp,
2168
+ defaultValue: defaultOpen,
2169
+ onChange: onOpenChange
2170
+ });
2171
+ const pendingEdge = useRef5("start");
2172
+ const state = useMemo4(() => ({ setOpen, pendingEdge }), [setOpen]);
2173
+ return /* @__PURE__ */ jsx17(DropdownMenuPrimitive.Root, { "data-slot": "dropdown-menu", open, onOpenChange: setOpen, modal, children: /* @__PURE__ */ jsx17(DropdownMenuStateContext.Provider, { value: state, children: items ? /* @__PURE__ */ jsxs11(Fragment9, { children: [
2174
+ /* @__PURE__ */ jsx17(DropdownMenuTrigger, { asChild: true, children: trigger ?? /* @__PURE__ */ jsx17(Button, { variant: "outline", size: "icon-xs", "aria-label": label ?? "Open menu", children: /* @__PURE__ */ jsx17(EllipsisIcon, { "aria-hidden": true }) }) }),
2175
+ /* @__PURE__ */ jsx17(
2176
+ DropdownMenuContent,
2177
+ {
2178
+ side,
2179
+ align,
2180
+ className: "w-max min-w-[max(8rem,var(--radix-dropdown-menu-trigger-width))]",
2181
+ children: /* @__PURE__ */ jsx17(DropdownMenuItems, { items })
2182
+ }
2183
+ )
2184
+ ] }) : children }) });
2185
+ }
2186
+ var DropdownMenuTrigger = forwardRef16(function DropdownMenuTrigger2({ onClick, onPointerDown, onMouseDown, onKeyDown, ...rest }, ref) {
2187
+ const state = useDropdownMenuState("DropdownMenuTrigger");
2188
+ const handlers = {
2189
+ onClick: (event) => {
2190
+ onClick?.(event);
2191
+ stopToAncestors(event);
2192
+ },
2193
+ onPointerDown: (event) => {
2194
+ onPointerDown?.(event);
2195
+ event.stopPropagation();
2196
+ },
2197
+ onMouseDown: (event) => {
2198
+ onMouseDown?.(event);
2199
+ stopToAncestors(event);
2200
+ },
2201
+ onKeyDown: (event) => {
2202
+ onKeyDown?.(event);
2203
+ if (event.defaultPrevented) return;
2204
+ if (event.key === "ArrowUp") {
2205
+ event.preventDefault();
2206
+ state.pendingEdge.current = "end";
2207
+ state.setOpen(true);
2208
+ }
2209
+ if (event.key === "Enter" || event.key === " ") stopToAncestors(event);
2210
+ }
2211
+ };
2212
+ return /* @__PURE__ */ jsx17(DropdownMenuPrimitive.Trigger, { ref, "data-slot": "dropdown-menu-trigger", ...rest, ...handlers });
2213
+ });
2214
+ function DropdownMenuPortal({ container, ...props }) {
2215
+ const inherited = usePortalContainer();
2216
+ return /* @__PURE__ */ jsx17(
2217
+ DropdownMenuPrimitive.Portal,
2218
+ {
2219
+ "data-slot": "dropdown-menu-portal",
2220
+ container: container ?? inherited ?? void 0,
2221
+ ...props
2222
+ }
2223
+ );
2224
+ }
2225
+ var DropdownMenuContent = forwardRef16(function DropdownMenuContent2({
2226
+ children,
2227
+ side = "bottom",
2228
+ align = "start",
2229
+ sideOffset = 4,
2230
+ container,
2231
+ className,
2232
+ onClick,
2233
+ onKeyDown,
2234
+ onFocus,
2235
+ onCloseAutoFocus,
2236
+ ...rest
2237
+ }, ref) {
2238
+ const state = useDropdownMenuState("DropdownMenuContent");
2239
+ const inherited = usePortalContainer();
2240
+ return /* @__PURE__ */ jsx17(DropdownMenuPrimitive.Portal, { container: container ?? inherited ?? void 0, children: /* @__PURE__ */ jsx17(
2241
+ DropdownMenuPrimitive.Content,
2242
+ {
2243
+ ref,
2244
+ "data-slot": "dropdown-menu-content",
2245
+ side,
2246
+ align,
2247
+ sideOffset,
2248
+ collisionPadding: 8,
2249
+ loop: true,
2250
+ className: cn(CONTENT_CLASSES, className),
2251
+ onCloseAutoFocus: composeEventHandlers(onCloseAutoFocus, () => {
2252
+ state.pendingEdge.current = "start";
2253
+ }),
2254
+ onFocus: composeEventHandlers(onFocus, (event) => {
2255
+ const edge = state.pendingEdge.current;
2256
+ state.pendingEdge.current = "start";
2257
+ focusMenuEdge(event, edge);
2258
+ }),
2259
+ onClick: (event) => {
2260
+ onClick?.(event);
2261
+ stopToAncestors(event);
2262
+ },
2263
+ onKeyDown: (event) => {
2264
+ onKeyDown?.(event);
2265
+ stopToAncestors(event);
2266
+ if (event.key === "Tab") state.setOpen(false);
2267
+ },
2268
+ ...rest,
2269
+ children
2270
+ }
2271
+ ) });
2272
+ });
2273
+ var parts = createMenuParts(DropdownMenuPrimitive, "dropdown-menu", DROPDOWN_MENU_CLASSES);
2274
+ var DropdownMenuItems = parts.Items;
2275
+ var DropdownMenuItem = parts.Item;
2276
+ var DropdownMenuCheckboxItem = parts.CheckboxItem;
2277
+ var DropdownMenuRadioGroup = parts.RadioGroup;
2278
+ var DropdownMenuRadioItem = parts.RadioItem;
2279
+ var DropdownMenuGroup = parts.Group;
2280
+ var DropdownMenuLabel = parts.Label;
2281
+ var DropdownMenuSeparator = parts.Separator;
2282
+ var DropdownMenuShortcut = parts.Shortcut;
2283
+ var DropdownMenuSub = parts.Sub;
2284
+ var DropdownMenuSubTrigger = parts.SubTrigger;
2285
+ var DropdownMenuSubContent = parts.SubContent;
2286
+
2287
+ // src/lib/focus-ring.ts
2288
+ var FOCUS_RING = "focus-visible:outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50";
2289
+ var FOCUS_RING_INSET = "focus-visible:outline-none focus-visible:ring-[3px] focus-visible:ring-inset focus-visible:ring-ring/50";
2290
+
2291
+ // src/components/chrome/tabs.tsx
2292
+ import { forwardRef as forwardRef17 } from "react";
2293
+ import { Tabs as TabsPrimitive } from "radix-ui";
2294
+ import { Fragment as Fragment10, jsx as jsx18, jsxs as jsxs12 } from "react/jsx-runtime";
2295
+ var Tabs = forwardRef17(function Tabs2({ className, orientation = "horizontal", items, variant, "aria-label": ariaLabel, children, ...props }, ref) {
2296
+ return /* @__PURE__ */ jsx18(
2297
+ TabsPrimitive.Root,
2298
+ {
2299
+ ref,
2300
+ "data-slot": "tabs",
2301
+ "data-orientation": orientation,
2302
+ orientation,
2303
+ className: cn("group/tabs flex gap-2 data-horizontal:flex-col", className),
2304
+ "aria-label": items ? void 0 : ariaLabel,
2305
+ ...props,
2306
+ children: items ? /* @__PURE__ */ jsxs12(Fragment10, { children: [
2307
+ /* @__PURE__ */ jsx18(TabsList, { variant, "aria-label": ariaLabel, children: items.map((item) => /* @__PURE__ */ jsxs12(TabsTrigger, { value: item.value, disabled: item.disabled, children: [
2308
+ item.icon,
2309
+ item.label
2310
+ ] }, item.value)) }),
2311
+ items.filter((item) => item.content !== void 0).map((item) => /* @__PURE__ */ jsx18(TabsContent, { value: item.value, children: item.content }, item.value))
2312
+ ] }) : children
2313
+ }
2314
+ );
2315
+ });
2316
+ var LIST_VARIANT = {
2317
+ default: "bg-muted",
2318
+ line: "gap-1 bg-transparent"
2319
+ };
2320
+ var TabsList = forwardRef17(function TabsList2({ className, variant = "default", ...props }, ref) {
2321
+ return /* @__PURE__ */ jsx18(
2322
+ TabsPrimitive.List,
2323
+ {
2324
+ ref,
2325
+ "data-slot": "tabs-list",
2326
+ "data-variant": variant,
2327
+ className: cn(
2328
+ "group/tabs-list inline-flex w-fit items-center justify-center rounded-lg p-[3px] text-muted-foreground group-data-horizontal/tabs:h-8 group-data-vertical/tabs:h-fit group-data-vertical/tabs:flex-col data-[variant=line]:rounded-none",
2329
+ LIST_VARIANT[variant],
2330
+ className
2331
+ ),
2332
+ ...props
2333
+ }
2334
+ );
2335
+ });
2336
+ var TabsTrigger = forwardRef17(
2337
+ function TabsTrigger2({ className, ...props }, ref) {
2338
+ return /* @__PURE__ */ jsx18(
2339
+ TabsPrimitive.Trigger,
2340
+ {
2341
+ ref,
2342
+ "data-slot": "tabs-trigger",
2343
+ className: cn(
2344
+ 'relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-1.5 py-0.5 text-sm font-medium whitespace-nowrap text-foreground/60 transition-all group-data-vertical/tabs:w-full group-data-vertical/tabs:justify-start hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50 has-data-[icon=inline-end]:pr-1 has-data-[icon=inline-start]:pl-1 dark:text-muted-foreground dark:hover:text-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*="size-"])]:size-4',
2345
+ "group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-active:bg-transparent group-data-[variant=line]/tabs-list:data-active:shadow-none dark:group-data-[variant=line]/tabs-list:data-active:border-transparent dark:group-data-[variant=line]/tabs-list:data-active:bg-transparent",
2346
+ "data-active:bg-background data-active:text-foreground group-data-[variant=default]/tabs-list:data-active:shadow-sm dark:data-active:border-input dark:data-active:bg-input/30 dark:data-active:text-foreground",
2347
+ "after:absolute after:bg-foreground after:opacity-0 after:transition-opacity group-data-horizontal/tabs:after:inset-x-0 group-data-horizontal/tabs:after:bottom-[-5px] group-data-horizontal/tabs:after:h-0.5 group-data-vertical/tabs:after:inset-y-0 group-data-vertical/tabs:after:-right-1 group-data-vertical/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-active:after:opacity-100",
2348
+ className
2349
+ ),
2350
+ ...props
2351
+ }
2352
+ );
2353
+ }
2354
+ );
2355
+ var TabsContent = forwardRef17(
2356
+ function TabsContent2({ className, ...props }, ref) {
2357
+ return /* @__PURE__ */ jsx18(
2358
+ TabsPrimitive.Content,
2359
+ {
2360
+ ref,
2361
+ "data-slot": "tabs-content",
2362
+ className: cn("flex-1 text-sm outline-none", className),
2363
+ ...props
2364
+ }
2365
+ );
2366
+ }
2367
+ );
2368
+
2369
+ // src/components/feedback/skeleton.tsx
2370
+ import { forwardRef as forwardRef18 } from "react";
2371
+ import { jsx as jsx19 } from "react/jsx-runtime";
2372
+ var BASE2 = "rounded-md bg-muted motion-safe:animate-pulse";
2373
+ var Skeleton = forwardRef18(function Skeleton2({ lines, className, ...props }, ref) {
2374
+ if (lines && lines > 1) {
2375
+ return /* @__PURE__ */ jsx19("div", { ref, "aria-hidden": true, "data-slot": "skeleton-group", className: cn("flex flex-col gap-2", className), ...props, children: Array.from({ length: lines }, (_, index) => (
2376
+ // A ragged last line reads as a paragraph rather than a solid slab.
2377
+ /* @__PURE__ */ jsx19("div", { "data-slot": "skeleton", className: cn(BASE2, "h-4", index === lines - 1 ? "w-3/5" : "w-full") }, index)
2378
+ )) });
2379
+ }
2380
+ return /* @__PURE__ */ jsx19("div", { ref, "aria-hidden": true, "data-slot": "skeleton", className: cn(BASE2, className), ...props });
2381
+ });
2382
+
2383
+ // src/lib/format.tsx
2384
+ import { createContext as createContext8, useContext as useContext8, useMemo as useMemo5 } from "react";
2385
+
2386
+ // src/lib/dev-warn.ts
2387
+ var seen = /* @__PURE__ */ new Set();
2388
+ function devWarn(message) {
2389
+ const env = globalThis.process?.env?.NODE_ENV;
2390
+ if (env === "production" || seen.has(message)) return;
2391
+ seen.add(message);
2392
+ console.warn(`[@platned/ui] ${message}`);
2393
+ }
2394
+
2395
+ // src/lib/format.tsx
2396
+ import { jsx as jsx20 } from "react/jsx-runtime";
2397
+ var FormatContext = createContext8({});
2398
+ function FormatProvider({ children, ...options }) {
2399
+ const parent = useContext8(FormatContext);
2400
+ const { locale, currency, timeZone, dateStyle, now, emptyLabel } = options;
2401
+ const value = useMemo5(
2402
+ () => ({
2403
+ ...parent,
2404
+ ...Object.fromEntries(
2405
+ Object.entries({ locale, currency, timeZone, dateStyle, now, emptyLabel }).filter(([, v]) => v !== void 0)
2406
+ )
2407
+ }),
2408
+ [parent, locale, currency, timeZone, dateStyle, now, emptyLabel]
2409
+ );
2410
+ return /* @__PURE__ */ jsx20(FormatContext.Provider, { value, children });
2411
+ }
2412
+ function useFormat() {
2413
+ return useContext8(FormatContext);
2414
+ }
2415
+ function getValueAt(record, path) {
2416
+ if (record == null) return void 0;
2417
+ if (typeof record === "object" && path in record) return record[path];
2418
+ let current = record;
2419
+ for (const part of path.split(".")) {
2420
+ if (current == null || typeof current !== "object") return void 0;
2421
+ current = current[part];
2422
+ }
2423
+ return current;
2424
+ }
2425
+ function fillTemplate(template, record) {
2426
+ return template.replace(/\{([^{}]+)\}/g, (_, path) => {
2427
+ const value = getValueAt(record, path.trim());
2428
+ return value == null ? "" : encodeURIComponent(String(value));
2429
+ });
2430
+ }
2431
+ function isEmptyValue(value) {
2432
+ return value == null || value === "" || Array.isArray(value) && value.length === 0;
2433
+ }
2434
+ function humanize(text) {
2435
+ const words = text.replace(/([a-z0-9])([A-Z])/g, "$1 $2").replace(/[_-]+/g, " ").trim().toLowerCase();
2436
+ return words.charAt(0).toUpperCase() + words.slice(1);
2437
+ }
2438
+ function toDate(value) {
2439
+ const date = value instanceof Date ? value : typeof value === "number" || typeof value === "string" ? new Date(value) : null;
2440
+ return date && !Number.isNaN(date.getTime()) ? date : null;
2441
+ }
2442
+ function toNumber(value) {
2443
+ const n = typeof value === "number" ? value : typeof value === "string" && value.trim() !== "" ? Number(value) : NaN;
2444
+ return Number.isFinite(n) ? n : null;
2445
+ }
2446
+ function isNumericType(type) {
2447
+ return type === "number" || type === "currency" || type === "percent";
2448
+ }
2449
+ var RELATIVE_UNITS = [
2450
+ ["year", 365 * 24 * 3600],
2451
+ ["month", 30 * 24 * 3600],
2452
+ ["week", 7 * 24 * 3600],
2453
+ ["day", 24 * 3600],
2454
+ ["hour", 3600],
2455
+ ["minute", 60],
2456
+ ["second", 1]
2457
+ ];
2458
+ function formatRelative(date, options = {}) {
2459
+ const now = options.now === void 0 ? Date.now() : new Date(options.now).getTime();
2460
+ const seconds = Math.round((date.getTime() - now) / 1e3);
2461
+ const format = new Intl.RelativeTimeFormat(options.locale, { numeric: "auto" });
2462
+ for (const [unit, size] of RELATIVE_UNITS) {
2463
+ if (Math.abs(seconds) >= size || unit === "second") return format.format(Math.round(seconds / size), unit);
2464
+ }
2465
+ return format.format(0, "second");
2466
+ }
2467
+ function formatDate(date, withTime, options = {}) {
2468
+ return new Intl.DateTimeFormat(options.locale, {
2469
+ dateStyle: options.dateStyle ?? "medium",
2470
+ ...withTime ? { timeStyle: "short" } : {},
2471
+ timeZone: options.timeZone
2472
+ }).format(date);
2473
+ }
2474
+ function valueLabel(value, labels) {
2475
+ const text = String(value);
2476
+ if (labels?.[text] !== void 0) return labels[text];
2477
+ return /[_-]|^[a-z]/.test(text) ? humanize(text) : text;
2478
+ }
2479
+ function formatValue(value, format = {}, options = {}) {
2480
+ if (isEmptyValue(value)) return "";
2481
+ switch (format.type) {
2482
+ case "number":
2483
+ case "currency": {
2484
+ const n = toNumber(value);
2485
+ if (n === null) return String(value);
2486
+ const currency = format.type === "currency" ? format.currency ?? options.currency : void 0;
2487
+ if (format.type === "currency" && !currency)
2488
+ devWarn("A currency value has no currency: set `currency` on the field or a FormatProvider.");
2489
+ const unit = format.type === "number" ? format.unit : void 0;
2490
+ return new Intl.NumberFormat(options.locale, {
2491
+ style: currency ? "currency" : unit ? "unit" : "decimal",
2492
+ currency,
2493
+ unit,
2494
+ unitDisplay: unit && format.type === "number" ? format.unitDisplay ?? "narrow" : void 0,
2495
+ notation: format.compact ? "compact" : void 0,
2496
+ minimumFractionDigits: format.decimals,
2497
+ maximumFractionDigits: format.decimals ?? (currency || format.compact ? void 0 : 3)
2498
+ }).format(n);
2499
+ }
2500
+ case "percent": {
2501
+ const n = toNumber(value);
2502
+ if (n === null) return String(value);
2503
+ return new Intl.NumberFormat(options.locale, {
2504
+ style: "percent",
2505
+ minimumFractionDigits: format.decimals,
2506
+ maximumFractionDigits: format.decimals ?? 1
2507
+ }).format(format.scale === "whole" ? n / 100 : n);
2508
+ }
2509
+ case "date":
2510
+ case "datetime": {
2511
+ const date = toDate(value);
2512
+ return date ? formatDate(date, format.type === "datetime", { ...options, dateStyle: format.dateStyle ?? options.dateStyle }) : String(value);
2513
+ }
2514
+ case "relative": {
2515
+ const date = toDate(value);
2516
+ return date ? formatRelative(date, options) : String(value);
2517
+ }
2518
+ case "boolean":
2519
+ return value ? format.trueLabel ?? "Yes" : format.falseLabel ?? "No";
2520
+ case "status":
2521
+ return valueLabel(value, format.labels);
2522
+ case "badge":
2523
+ return (Array.isArray(value) ? value : [value]).map((v) => format.labels?.[String(v)] ?? String(v)).join(", ");
2524
+ default:
2525
+ return Array.isArray(value) ? value.join(", ") : String(value);
2526
+ }
2527
+ }
2528
+
2529
+ // src/components/lists/value.tsx
2530
+ import { ArrowUpRightIcon, CheckIcon as CheckIcon6, MinusIcon as MinusIcon2 } from "lucide-react";
2531
+
2532
+ // src/components/lists/value-parts.tsx
2533
+ import { useEffect as useEffect7, useState as useState8 } from "react";
2534
+ import { CheckIcon as CheckIcon5, CopyIcon } from "lucide-react";
2535
+ import { jsx as jsx21, jsxs as jsxs13 } from "react/jsx-runtime";
2536
+ function CopyButton({ value, label, copiedLabel = "Copied", className }) {
2537
+ const [copied, setCopied] = useState8(false);
2538
+ useEffect7(() => {
2539
+ if (!copied) return;
2540
+ const timer = window.setTimeout(() => setCopied(false), 2e3);
2541
+ return () => window.clearTimeout(timer);
2542
+ }, [copied]);
2543
+ return (
2544
+ // relative: keeps the sr-only status (absolutely positioned) inside a scrolling container.
2545
+ /* @__PURE__ */ jsxs13("span", { className: "relative inline-flex", children: [
2546
+ /* @__PURE__ */ jsx21(
2547
+ Button,
2548
+ {
2549
+ variant: "ghost",
2550
+ size: "icon-xs",
2551
+ "aria-label": label,
2552
+ "data-state": copied ? "copied" : void 0,
2553
+ className: cn("-my-0.5 touch-hit", className),
2554
+ onClick: () => {
2555
+ void navigator.clipboard?.writeText(value).then(
2556
+ () => setCopied(true),
2557
+ () => void 0
2558
+ );
2559
+ },
2560
+ children: copied ? /* @__PURE__ */ jsx21(CheckIcon5, { "aria-hidden": true }) : /* @__PURE__ */ jsx21(CopyIcon, { "aria-hidden": true })
2561
+ }
2562
+ ),
2563
+ /* @__PURE__ */ jsx21("span", { role: "status", className: "sr-only", children: copied ? copiedLabel : "" })
2564
+ ] })
2565
+ );
2566
+ }
2567
+ function EmailText({ email, className }) {
2568
+ const at = email.lastIndexOf("@");
2569
+ const local = at > 0 ? email.slice(0, at) : email;
2570
+ const domain = at > 0 ? email.slice(at) : "";
2571
+ return /* @__PURE__ */ jsxs13("span", { title: email, "data-slot": "email-text", className: cn("flex min-w-0 max-w-full", className), children: [
2572
+ /* @__PURE__ */ jsx21("span", { className: "min-w-0 overflow-hidden text-ellipsis whitespace-nowrap", children: local }),
2573
+ domain && /* @__PURE__ */ jsx21("span", { className: "min-w-0 overflow-hidden text-ellipsis whitespace-nowrap [flex-shrink:0.001]", children: domain })
2574
+ ] });
2575
+ }
2576
+
2577
+ // src/components/lists/value.tsx
2578
+ import { Fragment as Fragment11, jsx as jsx22, jsxs as jsxs14 } from "react/jsx-runtime";
2579
+ function Value(props) {
2580
+ const options = useFormat();
2581
+ let value;
2582
+ let format;
2583
+ if (props.field) {
2584
+ const { key, label: _label, ...rest } = props.field;
2585
+ value = getValueAt(props.row, key);
2586
+ format = rest;
2587
+ } else {
2588
+ const { value: loose, row: _row, className: _className, ...rest } = props;
2589
+ value = loose;
2590
+ format = rest;
2591
+ }
2592
+ return /* @__PURE__ */ jsx22(
2593
+ "span",
2594
+ {
2595
+ "data-slot": "value",
2596
+ "data-type": format.type ?? "text",
2597
+ className: cn("min-w-0", isNumericType(format.type) && "tabular-nums", props.className),
2598
+ children: renderValue(value, format, props.row, options)
2599
+ }
2600
+ );
2601
+ }
2602
+ function Empty({ label }) {
2603
+ return /* @__PURE__ */ jsxs14("span", { className: "text-muted-foreground", children: [
2604
+ /* @__PURE__ */ jsx22("span", { "aria-hidden": "true", children: "\u2014" }),
2605
+ /* @__PURE__ */ jsx22("span", { className: "sr-only", children: label ?? "Empty" })
2606
+ ] });
2607
+ }
2608
+ function initials(name) {
2609
+ const parts2 = name.trim().split(/\s+/).filter(Boolean);
2610
+ return ((parts2[0]?.[0] ?? "") + (parts2.length > 1 ? parts2[parts2.length - 1][0] ?? "" : "")).toUpperCase();
2611
+ }
2612
+ function isExternal(href) {
2613
+ if (!/^https?:\/\//i.test(href)) return false;
2614
+ return typeof window === "undefined" || new URL(href).origin !== window.location.origin;
2615
+ }
2616
+ var LINK = "rounded-sm text-foreground underline underline-offset-4 decoration-1 hover:text-primary outline-none focus-visible:ring-3 focus-visible:ring-ring/50";
2617
+ function renderValue(value, format, row, options) {
2618
+ if (isEmptyValue(value)) return /* @__PURE__ */ jsx22(Empty, { label: options.emptyLabel });
2619
+ switch (format.type) {
2620
+ case "date":
2621
+ case "datetime":
2622
+ case "relative": {
2623
+ const date = toDate(value);
2624
+ if (!date) return String(value);
2625
+ const full = formatDate(date, true, { ...options, dateStyle: "long" });
2626
+ return /* @__PURE__ */ jsx22("time", { dateTime: date.toISOString(), title: full, children: format.type === "relative" ? formatRelative(date, options) : formatValue(value, format, options) });
2627
+ }
2628
+ case "boolean": {
2629
+ const label = value ? format.trueLabel : format.falseLabel;
2630
+ if (label) return label;
2631
+ return value ? /* @__PURE__ */ jsxs14(Fragment11, { children: [
2632
+ /* @__PURE__ */ jsx22(CheckIcon6, { "aria-hidden": "true", className: "inline size-4" }),
2633
+ /* @__PURE__ */ jsx22("span", { className: "sr-only", children: "Yes" })
2634
+ ] }) : /* @__PURE__ */ jsxs14(Fragment11, { children: [
2635
+ /* @__PURE__ */ jsx22(MinusIcon2, { "aria-hidden": "true", className: "inline size-4 text-muted-foreground" }),
2636
+ /* @__PURE__ */ jsx22("span", { className: "sr-only", children: "No" })
2637
+ ] });
2638
+ }
2639
+ case "status":
2640
+ return /* @__PURE__ */ jsx22(Badge, { variant: "outline", color: format.colors?.[String(value)] ?? "gray", indicator: true, children: valueLabel(value, format.labels) });
2641
+ case "badge": {
2642
+ const items = Array.isArray(value) ? value : [value];
2643
+ return /* @__PURE__ */ jsx22("span", { className: "inline-flex flex-wrap gap-1", children: items.map((item, index) => /* @__PURE__ */ jsx22(Badge, { variant: "outline", children: format.labels?.[String(item)] ?? String(item) }, `${String(item)}-${index}`)) });
2644
+ }
2645
+ case "avatar": {
2646
+ const name = String(value);
2647
+ const image = format.image ? getValueAt(row, format.image) : void 0;
2648
+ const description = format.description ? getValueAt(row, format.description) : void 0;
2649
+ return /* @__PURE__ */ jsxs14("span", { className: "flex min-w-0 items-center gap-2", children: [
2650
+ /* @__PURE__ */ jsx22(Avatar, { src: typeof image === "string" && image ? image : void 0, alt: "", fallback: initials(name) }),
2651
+ /* @__PURE__ */ jsxs14("span", { className: "flex min-w-0 flex-col", children: [
2652
+ /* @__PURE__ */ jsx22("span", { className: "overflow-hidden font-medium text-ellipsis whitespace-nowrap text-foreground", children: name }),
2653
+ !isEmptyValue(description) && /* @__PURE__ */ jsx22("span", { className: "overflow-hidden text-xs text-ellipsis whitespace-nowrap text-muted-foreground", children: String(description) })
2654
+ ] })
2655
+ ] });
2656
+ }
2657
+ case "email": {
2658
+ const email = String(value);
2659
+ return /* @__PURE__ */ jsxs14("span", { className: "flex min-w-0 items-center gap-1", children: [
2660
+ /* @__PURE__ */ jsx22("a", { href: `mailto:${email}`, "aria-label": email, className: cn(LINK, "min-w-0"), children: /* @__PURE__ */ jsx22(EmailText, { email }) }),
2661
+ format.copy !== false && /* @__PURE__ */ jsx22(CopyButton, { value: email, label: `Copy ${email}` })
2662
+ ] });
2663
+ }
2664
+ case "phone": {
2665
+ const phone = String(value);
2666
+ return /* @__PURE__ */ jsx22("a", { href: `tel:${phone.replace(/[^\d+]/g, "")}`, className: LINK, children: phone });
2667
+ }
2668
+ case "link": {
2669
+ const text = String(value);
2670
+ const hrefValue = format.href ? format.href.includes("{") ? fillTemplate(format.href, row) : getValueAt(row, format.href) : value;
2671
+ const href = typeof hrefValue === "string" ? hrefValue : text;
2672
+ const external = isExternal(href);
2673
+ return /* @__PURE__ */ jsxs14(
2674
+ "a",
2675
+ {
2676
+ href,
2677
+ className: cn(LINK, "inline-flex max-w-full items-center gap-0.5"),
2678
+ ...external ? { target: "_blank", rel: "noreferrer" } : {},
2679
+ children: [
2680
+ /* @__PURE__ */ jsx22("span", { className: "truncate", children: text }),
2681
+ external && /* @__PURE__ */ jsxs14(Fragment11, { children: [
2682
+ /* @__PURE__ */ jsx22(ArrowUpRightIcon, { "aria-hidden": "true", className: "size-3.5 shrink-0" }),
2683
+ /* @__PURE__ */ jsx22("span", { className: "sr-only", children: " (opens in a new tab)" })
2684
+ ] })
2685
+ ]
2686
+ }
2687
+ );
2688
+ }
2689
+ default:
2690
+ return formatValue(value, format, options);
2691
+ }
2692
+ }
2693
+
2694
+ // src/components/lists/table.tsx
2695
+ import { forwardRef as forwardRef19 } from "react";
2696
+ import { Fragment as Fragment12, jsx as jsx23, jsxs as jsxs15 } from "react/jsx-runtime";
2697
+ function renderShorthand({
2698
+ columns,
2699
+ rows = [],
2700
+ getRowKey,
2701
+ caption,
2702
+ footer
2703
+ }) {
2704
+ const cols = columns ?? [];
2705
+ return /* @__PURE__ */ jsxs15(Fragment12, { children: [
2706
+ caption !== void 0 && /* @__PURE__ */ jsx23(TableCaption, { children: caption }),
2707
+ /* @__PURE__ */ jsx23(TableHeader, { children: /* @__PURE__ */ jsx23(TableRow, { children: cols.map((column) => /* @__PURE__ */ jsx23(TableHead, { className: cn(column.className, column.headerClassName), children: column.header }, column.key)) }) }),
2708
+ /* @__PURE__ */ jsx23(TableBody, { children: rows.map((row, index) => /* @__PURE__ */ jsx23(TableRow, { children: cols.map((column) => /* @__PURE__ */ jsx23(TableCell, { className: column.className, children: column.cell ? column.cell(row, index) : row[column.key] }, column.key)) }, getRowKey ? getRowKey(row, index) : index)) }),
2709
+ footer && /* @__PURE__ */ jsx23(TableFooter, { children: /* @__PURE__ */ jsx23(TableRow, { children: cols.map((column, index) => /* @__PURE__ */ jsx23(TableCell, { className: column.className, children: footer[index] }, column.key)) }) })
2710
+ ] });
2711
+ }
2712
+ var TableRoot = forwardRef19(function Table({ className, columns, rows, getRowKey, caption, footer, children, ...props }, ref) {
2713
+ return /* @__PURE__ */ jsx23("div", { "data-slot": "table-container", className: "relative w-full scrollbar-thin overflow-x-auto", children: /* @__PURE__ */ jsx23("table", { ref, "data-slot": "table", className: cn("w-full caption-bottom text-sm", className), ...props, children: columns ? renderShorthand({ columns, rows, getRowKey, caption, footer }) : children }) });
2714
+ });
2715
+ var Table2 = TableRoot;
2716
+ var TableHeader = forwardRef19(function TableHeader2({ className, ...props }, ref) {
2717
+ return /* @__PURE__ */ jsx23("thead", { ref, "data-slot": "table-header", className: cn("[&_tr]:border-b", className), ...props });
2718
+ });
2719
+ var TableBody = forwardRef19(function TableBody2({ className, ...props }, ref) {
2720
+ return /* @__PURE__ */ jsx23("tbody", { ref, "data-slot": "table-body", className: cn("[&_tr:last-child]:border-0", className), ...props });
2721
+ });
2722
+ var TableFooter = forwardRef19(function TableFooter2({ className, ...props }, ref) {
2723
+ return /* @__PURE__ */ jsx23(
2724
+ "tfoot",
2725
+ {
2726
+ ref,
2727
+ "data-slot": "table-footer",
2728
+ className: cn("bg-muted/50 border-t font-medium [&>tr]:last:border-b-0", className),
2729
+ ...props
2730
+ }
2731
+ );
2732
+ });
2733
+ var TableRow = forwardRef19(function TableRow2({ className, ...props }, ref) {
2734
+ return /* @__PURE__ */ jsx23(
2735
+ "tr",
2736
+ {
2737
+ ref,
2738
+ "data-slot": "table-row",
2739
+ className: cn(
2740
+ "has-aria-expanded:bg-muted/50 hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors",
2741
+ className
2742
+ ),
2743
+ ...props
2744
+ }
2745
+ );
2746
+ });
2747
+ var TableHead = forwardRef19(function TableHead2({ className, ...props }, ref) {
2748
+ return /* @__PURE__ */ jsx23(
2749
+ "th",
2750
+ {
2751
+ ref,
2752
+ "data-slot": "table-head",
2753
+ className: cn(
2754
+ "text-foreground h-10 px-2 text-start align-middle font-medium whitespace-nowrap [&:has([role=checkbox])]:pe-0",
2755
+ className
2756
+ ),
2757
+ ...props
2758
+ }
2759
+ );
2760
+ });
2761
+ var TableCell = forwardRef19(function TableCell2({ className, ...props }, ref) {
2762
+ return /* @__PURE__ */ jsx23(
2763
+ "td",
2764
+ {
2765
+ ref,
2766
+ "data-slot": "table-cell",
2767
+ className: cn("p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pe-0", className),
2768
+ ...props
2769
+ }
2770
+ );
2771
+ });
2772
+ var TableCaption = forwardRef19(function TableCaption2({ className, ...props }, ref) {
2773
+ return /* @__PURE__ */ jsx23("caption", { ref, "data-slot": "table-caption", className: cn("text-muted-foreground mt-4 text-sm", className), ...props });
2774
+ });
2775
+
2776
+ // src/components/feedback/progress.tsx
2777
+ import { forwardRef as forwardRef20 } from "react";
2778
+ import { Progress as ProgressPrimitive } from "radix-ui";
2779
+ import { jsx as jsx24 } from "react/jsx-runtime";
2780
+ var FILL2 = {
2781
+ brand: "bg-primary",
2782
+ positive: "bg-success",
2783
+ warning: "bg-warning",
2784
+ danger: "bg-destructive",
2785
+ neutral: "bg-muted-foreground"
2786
+ };
2787
+ var Progress = forwardRef20(function Progress2({ className, value, max = 100, tone = "brand", ...props }, ref) {
2788
+ const clamped = value == null ? value : Math.min(max, Math.max(0, value));
2789
+ const percent = clamped == null ? 0 : clamped / max * 100;
2790
+ return /* @__PURE__ */ jsx24(
2791
+ ProgressPrimitive.Root,
2792
+ {
2793
+ ref,
2794
+ "data-slot": "progress",
2795
+ "data-tone": tone,
2796
+ value: clamped,
2797
+ max,
2798
+ className: cn(
2799
+ "relative flex h-1 w-full items-center overflow-x-hidden rounded-full bg-muted rtl:rotate-180",
2800
+ className
2801
+ ),
2802
+ ...props,
2803
+ children: /* @__PURE__ */ jsx24(
2804
+ ProgressPrimitive.Indicator,
2805
+ {
2806
+ "data-slot": "progress-indicator",
2807
+ className: cn("size-full flex-1 transition-all motion-reduce:transition-none", FILL2[tone]),
2808
+ style: { transform: `translateX(-${100 - percent}%)` }
2809
+ }
2810
+ )
2811
+ }
2812
+ );
2813
+ });
2814
+
2815
+ // src/components/lists/data-table-cells.tsx
2816
+ import clsx2 from "clsx";
2817
+ import { jsx as jsx25, jsxs as jsxs16 } from "react/jsx-runtime";
2818
+ function textFromNode(node) {
2819
+ if (typeof node === "string") return node;
2820
+ if (typeof node === "number") return String(node);
2821
+ if (Array.isArray(node)) {
2822
+ const parts2 = node.map(textFromNode);
2823
+ return parts2.every((part) => part !== void 0) ? parts2.join("") : void 0;
2824
+ }
2825
+ return void 0;
2826
+ }
2827
+ function TableCellLeadText({ primary, secondary, size = "md", className }) {
2828
+ return /* @__PURE__ */ jsxs16("div", { className: clsx2("flex min-w-0 flex-col gap-0.5", className), children: [
2829
+ /* @__PURE__ */ jsx25(
2830
+ "span",
2831
+ {
2832
+ title: primary,
2833
+ className: clsx2(
2834
+ "block truncate font-medium leading-snug text-foreground",
2835
+ size === "sm" ? "text-xs" : "text-sm"
2836
+ ),
2837
+ children: primary
2838
+ }
2839
+ ),
2840
+ secondary && (typeof secondary === "string" || typeof secondary === "number" ? /* @__PURE__ */ jsx25(
2841
+ "span",
2842
+ {
2843
+ title: String(secondary),
2844
+ className: clsx2(
2845
+ "block truncate font-normal leading-tight text-muted-foreground",
2846
+ size === "sm" ? "text-xs" : "text-xs"
2847
+ ),
2848
+ children: secondary
2849
+ }
2850
+ ) : (
2851
+ // An element brings its own overflow handling, so it gets no `truncate` here,
2852
+ // which a card layout's touch un-truncation would otherwise turn into wrapping.
2853
+ /* @__PURE__ */ jsx25(
2854
+ "span",
2855
+ {
2856
+ className: clsx2(
2857
+ "block min-w-0 font-normal leading-tight text-muted-foreground",
2858
+ size === "sm" ? "text-xs" : "text-xs"
2859
+ ),
2860
+ children: secondary
2861
+ }
2862
+ )
2863
+ ))
2864
+ ] });
2865
+ }
2866
+ function TableCellText({ children, muted = true, size = "md", truncate = true, className }) {
2867
+ return /* @__PURE__ */ jsx25(
2868
+ "span",
2869
+ {
2870
+ title: truncate ? textFromNode(children) : void 0,
2871
+ className: clsx2(
2872
+ "font-normal leading-snug",
2873
+ size === "sm" ? "text-xs" : "text-xs",
2874
+ truncate ? "block min-w-0 truncate" : "whitespace-nowrap",
2875
+ muted ? "text-muted-foreground" : "text-foreground",
2876
+ className
2877
+ ),
2878
+ children
2879
+ }
2880
+ );
2881
+ }
2882
+ function TableCellBadge({ label, className }) {
2883
+ return /* @__PURE__ */ jsx25(
2884
+ "span",
2885
+ {
2886
+ title: label,
2887
+ className: clsx2(
2888
+ "inline-flex max-w-full items-center rounded-md border border-border bg-muted px-2 py-0.5 text-xs font-medium text-muted-foreground",
2889
+ className
2890
+ ),
2891
+ children: /* @__PURE__ */ jsx25("span", { className: "truncate", children: label })
2892
+ }
2893
+ );
2894
+ }
2895
+ function TableCellProgress({ percent, tone = "brand", size = "md", label, className }) {
2896
+ const clamped = Math.round(Math.min(100, Math.max(0, percent)));
2897
+ return /* @__PURE__ */ jsxs16("div", { className: clsx2("flex w-full min-w-0 items-center gap-2", className), children: [
2898
+ /* @__PURE__ */ jsx25(
2899
+ Progress,
2900
+ {
2901
+ value: clamped,
2902
+ tone,
2903
+ className: clsx2("min-w-12 flex-1", size === "sm" ? "h-1" : "h-1.5"),
2904
+ "aria-label": label ?? `${clamped}%`
2905
+ }
2906
+ ),
2907
+ /* @__PURE__ */ jsxs16("span", { className: "shrink-0 text-xs leading-none tabular-nums text-muted-foreground", children: [
2908
+ clamped,
2909
+ "%"
2910
+ ] })
2911
+ ] });
2912
+ }
2913
+
2914
+ // src/lib/use-element-width.ts
2915
+ import { useEffect as useEffect8, useLayoutEffect as useLayoutEffect3, useState as useState9 } from "react";
2916
+ var useIsomorphicLayoutEffect2 = typeof window === "undefined" ? useEffect8 : useLayoutEffect3;
2917
+ function useElementWidth() {
2918
+ const [node, setNode] = useState9(null);
2919
+ const [width, setWidth] = useState9(void 0);
2920
+ useIsomorphicLayoutEffect2(() => {
2921
+ if (!node) return;
2922
+ const apply = (next) => {
2923
+ if (next <= 0) return;
2924
+ setWidth((prev) => prev !== void 0 && Math.abs(prev - next) < 1 ? prev : next);
2925
+ };
2926
+ apply(node.getBoundingClientRect().width);
2927
+ if (typeof ResizeObserver === "undefined") return;
2928
+ const observer = new ResizeObserver((entries) => {
2929
+ const entry = entries[0];
2930
+ if (entry) apply(entry.contentRect.width);
2931
+ });
2932
+ observer.observe(node);
2933
+ return () => observer.disconnect();
2934
+ }, [node]);
2935
+ return [setNode, width];
2936
+ }
2937
+
2938
+ // src/components/feedback/empty.tsx
2939
+ import { forwardRef as forwardRef21 } from "react";
2940
+ import { Fragment as Fragment13, jsx as jsx26, jsxs as jsxs17 } from "react/jsx-runtime";
2941
+ var MEDIA = {
2942
+ default: "bg-transparent",
2943
+ icon: "flex size-8 shrink-0 items-center justify-center rounded-lg bg-muted text-foreground [&_svg:not([class*='size-'])]:size-4"
2944
+ };
2945
+ var EmptyHeader = forwardRef21(function EmptyHeader2({ className, ...props }, ref) {
2946
+ return /* @__PURE__ */ jsx26(
2947
+ "div",
2948
+ {
2949
+ ref,
2950
+ "data-slot": "empty-header",
2951
+ className: cn("flex max-w-sm flex-col items-center gap-2", className),
2952
+ ...props
2953
+ }
2954
+ );
2955
+ });
2956
+ var EmptyMedia = forwardRef21(function EmptyMedia2({ className, variant = "default", ...props }, ref) {
2957
+ return /* @__PURE__ */ jsx26(
2958
+ "div",
2959
+ {
2960
+ ref,
2961
+ "data-slot": "empty-icon",
2962
+ "data-variant": variant,
2963
+ className: cn(
2964
+ "mb-2 flex shrink-0 items-center justify-center [&_svg]:pointer-events-none [&_svg]:shrink-0",
2965
+ MEDIA[variant],
2966
+ className
2967
+ ),
2968
+ ...props
2969
+ }
2970
+ );
2971
+ });
2972
+ var EmptyTitle = forwardRef21(function EmptyTitle2({ className, ...props }, ref) {
2973
+ return /* @__PURE__ */ jsx26(
2974
+ "div",
2975
+ {
2976
+ ref,
2977
+ "data-slot": "empty-title",
2978
+ className: cn("text-sm font-medium tracking-tight", className),
2979
+ ...props
2980
+ }
2981
+ );
2982
+ });
2983
+ var EmptyDescription = forwardRef21(function EmptyDescription2({ className, ...props }, ref) {
2984
+ return /* @__PURE__ */ jsx26(
2985
+ "div",
2986
+ {
2987
+ ref,
2988
+ "data-slot": "empty-description",
2989
+ className: cn(
2990
+ "text-sm/relaxed text-muted-foreground [&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary",
2991
+ className
2992
+ ),
2993
+ ...props
2994
+ }
2995
+ );
2996
+ });
2997
+ var EmptyContent = forwardRef21(function EmptyContent2({ className, ...props }, ref) {
2998
+ return /* @__PURE__ */ jsx26(
2999
+ "div",
3000
+ {
3001
+ ref,
3002
+ "data-slot": "empty-content",
3003
+ className: cn("flex w-full max-w-sm min-w-0 flex-col items-center gap-2.5 text-sm text-balance", className),
3004
+ ...props
3005
+ }
3006
+ );
3007
+ });
3008
+ var Empty2 = forwardRef21(function Empty3({ className, icon, title, description, children, ...props }, ref) {
3009
+ const shorthand = icon !== void 0 || title !== void 0 || description !== void 0;
3010
+ return /* @__PURE__ */ jsx26(
3011
+ "div",
3012
+ {
3013
+ ref,
3014
+ "data-slot": "empty",
3015
+ className: cn(
3016
+ "flex w-full min-w-0 flex-1 flex-col items-center justify-center gap-4 rounded-xl border-dashed p-6 text-center text-balance",
3017
+ className
3018
+ ),
3019
+ ...props,
3020
+ children: shorthand ? /* @__PURE__ */ jsxs17(Fragment13, { children: [
3021
+ /* @__PURE__ */ jsxs17(EmptyHeader, { children: [
3022
+ icon !== void 0 && /* @__PURE__ */ jsx26(EmptyMedia, { variant: "icon", children: icon }),
3023
+ title !== void 0 && /* @__PURE__ */ jsx26(EmptyTitle, { children: title }),
3024
+ description !== void 0 && /* @__PURE__ */ jsx26(EmptyDescription, { children: description })
3025
+ ] }),
3026
+ children !== void 0 && children !== null && /* @__PURE__ */ jsx26(EmptyContent, { children })
3027
+ ] }) : children
3028
+ }
3029
+ );
3030
+ });
3031
+
3032
+ export {
3033
+ Avatar,
3034
+ AvatarImage,
3035
+ AvatarFallback,
3036
+ AvatarBadge,
3037
+ AvatarGroup,
3038
+ AvatarGroupCount,
3039
+ Separator,
3040
+ Label,
3041
+ useFieldContext,
3042
+ useFieldControl,
3043
+ Field,
3044
+ CHOICE_CARD,
3045
+ FieldLabel,
3046
+ FieldContent,
3047
+ FieldTitle,
3048
+ FieldDescription,
3049
+ FieldError,
3050
+ FieldGroup,
3051
+ FieldSet,
3052
+ FieldLegend,
3053
+ FieldSeparator,
3054
+ Textarea,
3055
+ InputGroup,
3056
+ InputGroupAddon,
3057
+ InputGroupButton,
3058
+ InputGroupText,
3059
+ InputGroupInput,
3060
+ InputGroupTextarea,
3061
+ Input,
3062
+ Select,
3063
+ SelectGroup,
3064
+ SelectValue,
3065
+ SelectTrigger,
3066
+ SelectContent,
3067
+ SelectLabel,
3068
+ SelectItem,
3069
+ SelectSeparator,
3070
+ SelectScrollUpButton,
3071
+ SelectScrollDownButton,
3072
+ devWarn,
3073
+ deferEscapeToInnerPopup,
3074
+ PortalContainerProvider,
3075
+ usePortalContainer,
3076
+ Portal,
3077
+ Popover,
3078
+ PopoverTrigger,
3079
+ PopoverContent,
3080
+ PopoverHeader,
3081
+ PopoverTitle,
3082
+ PopoverDescription,
3083
+ PopoverClose,
3084
+ PopoverAnchor,
3085
+ toggleVariants,
3086
+ Toggle,
3087
+ ToggleGroup,
3088
+ ToggleGroupItem,
3089
+ useControllableState,
3090
+ BADGE_COLORS,
3091
+ Badge,
3092
+ isInsideToaster,
3093
+ DialogTrigger,
3094
+ DialogPortal,
3095
+ DialogClose,
3096
+ DialogOverlay,
3097
+ DialogContent,
3098
+ DialogHeader,
3099
+ DialogFooter,
3100
+ DialogTitle,
3101
+ DialogDescription,
3102
+ Dialog,
3103
+ Command,
3104
+ CommandDialog,
3105
+ CommandInput,
3106
+ CommandList,
3107
+ CommandEmpty,
3108
+ CommandGroup,
3109
+ CommandSeparator,
3110
+ CommandItem,
3111
+ CommandShortcut,
3112
+ Checkbox,
3113
+ composeEventHandlers,
3114
+ stopToAncestors,
3115
+ focusMenuEdge,
3116
+ createMenuParts,
3117
+ SCROLLBAR_CLASSES,
3118
+ DropdownMenu,
3119
+ DropdownMenuTrigger,
3120
+ DropdownMenuPortal,
3121
+ DropdownMenuContent,
3122
+ DropdownMenuItems,
3123
+ DropdownMenuItem,
3124
+ DropdownMenuCheckboxItem,
3125
+ DropdownMenuRadioGroup,
3126
+ DropdownMenuRadioItem,
3127
+ DropdownMenuGroup,
3128
+ DropdownMenuLabel,
3129
+ DropdownMenuSeparator,
3130
+ DropdownMenuShortcut,
3131
+ DropdownMenuSub,
3132
+ DropdownMenuSubTrigger,
3133
+ DropdownMenuSubContent,
3134
+ FOCUS_RING,
3135
+ FOCUS_RING_INSET,
3136
+ Tabs,
3137
+ TabsList,
3138
+ TabsTrigger,
3139
+ TabsContent,
3140
+ Skeleton,
3141
+ FormatProvider,
3142
+ useFormat,
3143
+ getValueAt,
3144
+ fillTemplate,
3145
+ isEmptyValue,
3146
+ humanize,
3147
+ toDate,
3148
+ isNumericType,
3149
+ formatRelative,
3150
+ formatDate,
3151
+ valueLabel,
3152
+ formatValue,
3153
+ Value,
3154
+ renderValue,
3155
+ Table2 as Table,
3156
+ TableHeader,
3157
+ TableBody,
3158
+ TableFooter,
3159
+ TableRow,
3160
+ TableHead,
3161
+ TableCell,
3162
+ TableCaption,
3163
+ Progress,
3164
+ TableCellLeadText,
3165
+ TableCellText,
3166
+ TableCellBadge,
3167
+ TableCellProgress,
3168
+ useElementWidth,
3169
+ EmptyHeader,
3170
+ EmptyMedia,
3171
+ EmptyTitle,
3172
+ EmptyDescription,
3173
+ EmptyContent,
3174
+ Empty2 as Empty
3175
+ };
3176
+ //# sourceMappingURL=chunk-327NSKZW.js.map