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