@eventideorg/design-system 0.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 (79) hide show
  1. package/README.md +208 -0
  2. package/dist/App.d.ts +1 -0
  3. package/dist/index.css +1 -0
  4. package/dist/index.d.ts +1 -0
  5. package/dist/index.js +2054 -0
  6. package/dist/main.d.ts +0 -0
  7. package/dist/ui/hooks/index.d.ts +1 -0
  8. package/dist/ui/index.d.ts +2 -0
  9. package/dist/ui/lib/utils.d.ts +2 -0
  10. package/dist/ui/ui/Badge.d.ts +9 -0
  11. package/dist/ui/ui/Button.d.ts +10 -0
  12. package/dist/ui/ui/Calendar.d.ts +8 -0
  13. package/dist/ui/ui/Card.d.ts +9 -0
  14. package/dist/ui/ui/Checkbox.d.ts +4 -0
  15. package/dist/ui/ui/Collapsible.d.ts +5 -0
  16. package/dist/ui/ui/Command.d.ts +18 -0
  17. package/dist/ui/ui/Dialog.d.ts +17 -0
  18. package/dist/ui/ui/FormSystem/FormBuilder/DragHandle.d.ts +7 -0
  19. package/dist/ui/ui/FormSystem/FormBuilder/FieldEditor.d.ts +9 -0
  20. package/dist/ui/ui/FormSystem/FormBuilder/FieldList.d.ts +9 -0
  21. package/dist/ui/ui/FormSystem/FormBuilder/FieldTypePicker.d.ts +7 -0
  22. package/dist/ui/ui/FormSystem/FormBuilder/FormBuilder.d.ts +2 -0
  23. package/dist/ui/ui/FormSystem/FormBuilder/NavigationRuleEditor.d.ts +12 -0
  24. package/dist/ui/ui/FormSystem/FormBuilder/SectionEditor.d.ts +15 -0
  25. package/dist/ui/ui/FormSystem/FormBuilder/SectionList.d.ts +14 -0
  26. package/dist/ui/ui/FormSystem/FormBuilder/SortableItem.d.ts +14 -0
  27. package/dist/ui/ui/FormSystem/FormBuilder/builderValidation.d.ts +13 -0
  28. package/dist/ui/ui/FormSystem/FormBuilder/index.d.ts +18 -0
  29. package/dist/ui/ui/FormSystem/FormBuilder/useFormBuilder.d.ts +22 -0
  30. package/dist/ui/ui/FormSystem/FormRunner/FormRunner.d.ts +2 -0
  31. package/dist/ui/ui/FormSystem/FormRunner/NavigationControls.d.ts +11 -0
  32. package/dist/ui/ui/FormSystem/FormRunner/ProgressBar.d.ts +10 -0
  33. package/dist/ui/ui/FormSystem/FormRunner/SectionRenderer.d.ts +9 -0
  34. package/dist/ui/ui/FormSystem/FormRunner/index.d.ts +9 -0
  35. package/dist/ui/ui/FormSystem/FormRunner/useFormRunner.d.ts +23 -0
  36. package/dist/ui/ui/FormSystem/InputRenderer.d.ts +9 -0
  37. package/dist/ui/ui/FormSystem/NavigationEngine.d.ts +65 -0
  38. package/dist/ui/ui/FormSystem/constants.d.ts +29 -0
  39. package/dist/ui/ui/FormSystem/index.d.ts +20 -0
  40. package/dist/ui/ui/FormSystem/types.d.ts +104 -0
  41. package/dist/ui/ui/FormSystem/validation.d.ts +9 -0
  42. package/dist/ui/ui/Input.d.ts +3 -0
  43. package/dist/ui/ui/InputFields/Checkbox.d.ts +9 -0
  44. package/dist/ui/ui/InputFields/ColorInput.d.ts +10 -0
  45. package/dist/ui/ui/InputFields/DatePicker.d.ts +19 -0
  46. package/dist/ui/ui/InputFields/DateTimePicker.d.ts +8 -0
  47. package/dist/ui/ui/InputFields/Divider.d.ts +5 -0
  48. package/dist/ui/ui/InputFields/EmailInput.d.ts +7 -0
  49. package/dist/ui/ui/InputFields/FieldWrapper.d.ts +16 -0
  50. package/dist/ui/ui/InputFields/FileInput.d.ts +12 -0
  51. package/dist/ui/ui/InputFields/Likert.d.ts +16 -0
  52. package/dist/ui/ui/InputFields/LocationInput.d.ts +24 -0
  53. package/dist/ui/ui/InputFields/NumberInput.d.ts +15 -0
  54. package/dist/ui/ui/InputFields/PasswordInput.d.ts +7 -0
  55. package/dist/ui/ui/InputFields/QuerySelect.d.ts +13 -0
  56. package/dist/ui/ui/InputFields/RadioInput.d.ts +10 -0
  57. package/dist/ui/ui/InputFields/Rating.d.ts +9 -0
  58. package/dist/ui/ui/InputFields/RichTextInput.d.ts +13 -0
  59. package/dist/ui/ui/InputFields/SelectInput.d.ts +11 -0
  60. package/dist/ui/ui/InputFields/StaticImage.d.ts +6 -0
  61. package/dist/ui/ui/InputFields/StaticText.d.ts +5 -0
  62. package/dist/ui/ui/InputFields/SwitchInput.d.ts +9 -0
  63. package/dist/ui/ui/InputFields/TelephoneInput.d.ts +12 -0
  64. package/dist/ui/ui/InputFields/TextInput.d.ts +7 -0
  65. package/dist/ui/ui/InputFields/TextareaInput.d.ts +7 -0
  66. package/dist/ui/ui/InputFields/TimePicker.d.ts +11 -0
  67. package/dist/ui/ui/InputFields/URLInput.d.ts +7 -0
  68. package/dist/ui/ui/InputFields/index.d.ts +51 -0
  69. package/dist/ui/ui/InputFields/types.d.ts +21 -0
  70. package/dist/ui/ui/Label.d.ts +4 -0
  71. package/dist/ui/ui/Popover.d.ts +10 -0
  72. package/dist/ui/ui/RadioGroup.d.ts +5 -0
  73. package/dist/ui/ui/Select.d.ts +15 -0
  74. package/dist/ui/ui/Separator.d.ts +4 -0
  75. package/dist/ui/ui/Switch.d.ts +6 -0
  76. package/dist/ui/ui/Textarea.d.ts +3 -0
  77. package/dist/ui/ui/index.d.ts +6 -0
  78. package/dist/vite.svg +1 -0
  79. package/package.json +107 -0
package/dist/index.js ADDED
@@ -0,0 +1,2054 @@
1
+ import { jsx as e, jsxs as c } from "react/jsx-runtime";
2
+ import { useId as Z, useState as S, useRef as Q, useMemo as ce, useEffect as W } from "react";
3
+ import { cva as le } from "class-variance-authority";
4
+ import { Slot as de } from "radix-ui";
5
+ import { cn as C } from "@/ui/lib/utils";
6
+ import { Checkbox as he } from "@/ui/ui/Checkbox";
7
+ import { Label as V } from "@/ui/ui/Label";
8
+ import { Input as D } from "@/ui/ui/Input";
9
+ import { EyeOff as ge, Eye as ve, ChevronUp as xe, ChevronDown as be, X as ae, ChevronsUpDown as ie, Check as ue, Mail as ye, Link as Ne, Phone as Ce, CalendarIcon as we, Clock as ke, Upload as Ae, Image as ze, FileText as Se, FileSpreadsheet as Ie, File as Le, Search as Me, Loader2 as $e, Bold as Re, Italic as Ee, Underline as Pe, Strikethrough as Be, Heading1 as Ue, Heading2 as Fe, Heading3 as Te, List as De, ListOrdered as He, Quote as _e, Code2 as je, AlignLeft as Oe, AlignCenter as Ke, AlignRight as Ge, Undo2 as We, Redo2 as Qe, Link2 as Ze, Unlink2 as Ve } from "lucide-react";
10
+ import { Button as B } from "@/ui/ui/Button";
11
+ import { Popover as X, PopoverTrigger as J, PopoverContent as Y } from "@/ui/ui/Popover";
12
+ import { format as re } from "date-fns";
13
+ import { Calendar as ne } from "@/ui/ui/Calendar";
14
+ import { Badge as me } from "@/ui/ui/Badge";
15
+ import { useEditor as Xe, EditorContent as Je } from "@tiptap/react";
16
+ import Ye from "@tiptap/starter-kit";
17
+ import qe from "@tiptap/extension-text-align";
18
+ import et from "@tiptap/extension-placeholder";
19
+ import tt from "@tiptap/extension-character-count";
20
+ import { Select as rt, SelectTrigger as nt, SelectValue as at, SelectContent as it, SelectItem as st } from "@/ui/ui/Select";
21
+ import { Switch as ot } from "@/ui/ui/Switch";
22
+ import { Textarea as ct } from "@/ui/ui/Textarea";
23
+ import { FieldWrapper as lt } from "@/ui/ui/InputFields/FieldWrapper";
24
+ import { clsx as dt } from "clsx";
25
+ import { twMerge as ut } from "tailwind-merge";
26
+ const mt = le(
27
+ "inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
28
+ {
29
+ variants: {
30
+ variant: {
31
+ default: "bg-primary text-primary-foreground hover:bg-primary/90",
32
+ destructive: "bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",
33
+ outline: "border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",
34
+ secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80",
35
+ ghost: "hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",
36
+ link: "text-primary underline-offset-4 hover:underline"
37
+ },
38
+ size: {
39
+ default: "h-9 px-4 py-2 has-[>svg]:px-3",
40
+ xs: "h-6 gap-1 rounded-md px-2 text-xs has-[>svg]:px-1.5 [&_svg:not([class*='size-'])]:size-3",
41
+ sm: "h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",
42
+ lg: "h-10 rounded-md px-6 has-[>svg]:px-4",
43
+ icon: "size-9",
44
+ "icon-xs": "size-6 rounded-md [&_svg:not([class*='size-'])]:size-3",
45
+ "icon-sm": "size-8",
46
+ "icon-lg": "size-10"
47
+ }
48
+ },
49
+ defaultVariants: {
50
+ variant: "default",
51
+ size: "default"
52
+ }
53
+ }
54
+ );
55
+ function Jt({
56
+ className: t,
57
+ variant: r = "default",
58
+ size: n = "default",
59
+ asChild: a = !1,
60
+ ...i
61
+ }) {
62
+ const x = a ? de.Root : "button";
63
+ return /* @__PURE__ */ e(
64
+ x,
65
+ {
66
+ "data-slot": "button",
67
+ "data-variant": r,
68
+ "data-size": n,
69
+ className: C(mt({ variant: r, size: n, className: t })),
70
+ ...i
71
+ }
72
+ );
73
+ }
74
+ const ft = le(
75
+ "inline-flex items-center justify-center rounded-full border border-transparent px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden",
76
+ {
77
+ variants: {
78
+ variant: {
79
+ default: "bg-primary text-primary-foreground [a&]:hover:bg-primary/90",
80
+ secondary: "bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",
81
+ destructive: "bg-destructive text-white [a&]:hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",
82
+ outline: "border-border text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground",
83
+ ghost: "[a&]:hover:bg-accent [a&]:hover:text-accent-foreground",
84
+ link: "text-primary underline-offset-4 [a&]:hover:underline"
85
+ }
86
+ },
87
+ defaultVariants: {
88
+ variant: "default"
89
+ }
90
+ }
91
+ );
92
+ function Yt({
93
+ className: t,
94
+ variant: r = "default",
95
+ asChild: n = !1,
96
+ ...a
97
+ }) {
98
+ const i = n ? de.Root : "span";
99
+ return /* @__PURE__ */ e(
100
+ i,
101
+ {
102
+ "data-slot": "badge",
103
+ "data-variant": r,
104
+ className: C(ft({ variant: r }), t),
105
+ ...a
106
+ }
107
+ );
108
+ }
109
+ function qt({ className: t, ...r }) {
110
+ return /* @__PURE__ */ e(
111
+ "div",
112
+ {
113
+ "data-slot": "card",
114
+ className: C(
115
+ "bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",
116
+ t
117
+ ),
118
+ ...r
119
+ }
120
+ );
121
+ }
122
+ function er({ className: t, ...r }) {
123
+ return /* @__PURE__ */ e(
124
+ "div",
125
+ {
126
+ "data-slot": "card-header",
127
+ className: C(
128
+ "@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-2 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6",
129
+ t
130
+ ),
131
+ ...r
132
+ }
133
+ );
134
+ }
135
+ function tr({ className: t, ...r }) {
136
+ return /* @__PURE__ */ e(
137
+ "div",
138
+ {
139
+ "data-slot": "card-title",
140
+ className: C("leading-none font-semibold", t),
141
+ ...r
142
+ }
143
+ );
144
+ }
145
+ function rr({ className: t, ...r }) {
146
+ return /* @__PURE__ */ e(
147
+ "div",
148
+ {
149
+ "data-slot": "card-description",
150
+ className: C("text-muted-foreground text-sm", t),
151
+ ...r
152
+ }
153
+ );
154
+ }
155
+ function nr({ className: t, ...r }) {
156
+ return /* @__PURE__ */ e(
157
+ "div",
158
+ {
159
+ "data-slot": "card-action",
160
+ className: C(
161
+ "col-start-2 row-span-2 row-start-1 self-start justify-self-end",
162
+ t
163
+ ),
164
+ ...r
165
+ }
166
+ );
167
+ }
168
+ function ar({ className: t, ...r }) {
169
+ return /* @__PURE__ */ e(
170
+ "div",
171
+ {
172
+ "data-slot": "card-content",
173
+ className: C("px-6", t),
174
+ ...r
175
+ }
176
+ );
177
+ }
178
+ function ir({ className: t, ...r }) {
179
+ return /* @__PURE__ */ e(
180
+ "div",
181
+ {
182
+ "data-slot": "card-footer",
183
+ className: C("flex items-center px-6 [.border-t]:pt-6", t),
184
+ ...r
185
+ }
186
+ );
187
+ }
188
+ function sr({ className: t, type: r, ...n }) {
189
+ return /* @__PURE__ */ e(
190
+ "input",
191
+ {
192
+ type: r,
193
+ "data-slot": "input",
194
+ className: C(
195
+ "file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
196
+ "focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]",
197
+ "aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
198
+ t
199
+ ),
200
+ ...n
201
+ }
202
+ );
203
+ }
204
+ function H({
205
+ id: t,
206
+ label: r,
207
+ error: n,
208
+ helperText: a,
209
+ required: i,
210
+ disabled: x,
211
+ children: b,
212
+ className: l
213
+ }) {
214
+ const m = Z(), d = t ?? m, p = n ? `${d}-error` : void 0, h = a && !n ? `${d}-helper` : void 0, f = [p, h].filter(Boolean).join(" ") || void 0;
215
+ return /* @__PURE__ */ c(
216
+ "div",
217
+ {
218
+ className: C("space-y-2", l),
219
+ "data-disabled": x || void 0,
220
+ children: [
221
+ r && /* @__PURE__ */ c(V, { htmlFor: d, children: [
222
+ r,
223
+ i && /* @__PURE__ */ e("span", { className: "text-destructive ml-0.5", "aria-hidden": "true", children: "*" })
224
+ ] }),
225
+ b({ id: d, describedBy: f }),
226
+ n && /* @__PURE__ */ e("p", { id: p, className: "text-sm text-destructive", role: "alert", children: n }),
227
+ a && !n && /* @__PURE__ */ e("p", { id: h, className: "text-sm text-muted-foreground", children: a })
228
+ ]
229
+ }
230
+ );
231
+ }
232
+ function or({
233
+ label: t,
234
+ error: r,
235
+ helperText: n,
236
+ required: a,
237
+ disabled: i,
238
+ id: x,
239
+ className: b,
240
+ ...l
241
+ }) {
242
+ return /* @__PURE__ */ e(
243
+ H,
244
+ {
245
+ id: x,
246
+ label: t,
247
+ error: r,
248
+ helperText: n,
249
+ required: a,
250
+ disabled: i,
251
+ className: b,
252
+ children: ({ id: m, describedBy: d }) => /* @__PURE__ */ e(
253
+ D,
254
+ {
255
+ id: m,
256
+ "aria-invalid": !!r,
257
+ "aria-describedby": d,
258
+ "aria-required": a,
259
+ disabled: i,
260
+ required: a,
261
+ ...l
262
+ }
263
+ )
264
+ }
265
+ );
266
+ }
267
+ const pt = {
268
+ none: "resize-none",
269
+ vertical: "resize-y",
270
+ horizontal: "resize-x",
271
+ both: "resize"
272
+ };
273
+ function cr({
274
+ label: t,
275
+ error: r,
276
+ helperText: n,
277
+ required: a,
278
+ disabled: i,
279
+ id: x,
280
+ className: b,
281
+ resize: l = "vertical",
282
+ ...m
283
+ }) {
284
+ return /* @__PURE__ */ e(
285
+ H,
286
+ {
287
+ id: x,
288
+ label: t,
289
+ error: r,
290
+ helperText: n,
291
+ required: a,
292
+ disabled: i,
293
+ className: b,
294
+ children: ({ id: d, describedBy: p }) => /* @__PURE__ */ e(
295
+ ct,
296
+ {
297
+ id: d,
298
+ "aria-invalid": !!r,
299
+ "aria-describedby": p,
300
+ "aria-required": a,
301
+ disabled: i,
302
+ required: a,
303
+ className: C(pt[l]),
304
+ ...m
305
+ }
306
+ )
307
+ }
308
+ );
309
+ }
310
+ function lr({
311
+ label: t,
312
+ error: r,
313
+ helperText: n,
314
+ required: a,
315
+ disabled: i,
316
+ id: x,
317
+ className: b,
318
+ showToggle: l = !0,
319
+ ...m
320
+ }) {
321
+ const [d, p] = S(!1);
322
+ return /* @__PURE__ */ e(
323
+ H,
324
+ {
325
+ id: x,
326
+ label: t,
327
+ error: r,
328
+ helperText: n,
329
+ required: a,
330
+ disabled: i,
331
+ className: b,
332
+ children: ({ id: h, describedBy: f }) => /* @__PURE__ */ c("div", { className: "relative", children: [
333
+ /* @__PURE__ */ e(
334
+ D,
335
+ {
336
+ id: h,
337
+ type: d ? "text" : "password",
338
+ "aria-invalid": !!r,
339
+ "aria-describedby": f,
340
+ "aria-required": a,
341
+ disabled: i,
342
+ required: a,
343
+ className: l ? "pr-10" : void 0,
344
+ ...m
345
+ }
346
+ ),
347
+ l && /* @__PURE__ */ e(
348
+ B,
349
+ {
350
+ type: "button",
351
+ variant: "ghost",
352
+ size: "icon-xs",
353
+ className: "absolute right-2 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground",
354
+ onClick: () => p((o) => !o),
355
+ disabled: i,
356
+ "aria-label": d ? "Hide password" : "Show password",
357
+ tabIndex: -1,
358
+ children: d ? /* @__PURE__ */ e(ge, { className: "size-4" }) : /* @__PURE__ */ e(ve, { className: "size-4" })
359
+ }
360
+ )
361
+ ] })
362
+ }
363
+ );
364
+ }
365
+ function ht(t, r, n) {
366
+ let a = t;
367
+ return r !== void 0 && a < r && (a = r), n !== void 0 && a > n && (a = n), a;
368
+ }
369
+ function dr({
370
+ label: t,
371
+ error: r,
372
+ helperText: n,
373
+ required: a,
374
+ disabled: i,
375
+ id: x,
376
+ className: b,
377
+ value: l,
378
+ defaultValue: m,
379
+ placeholder: d,
380
+ onChange: p,
381
+ onBlur: h,
382
+ min: f,
383
+ max: o,
384
+ step: y = 1,
385
+ showStepper: g = !1
386
+ }) {
387
+ function M(L) {
388
+ const z = L.target.value;
389
+ if (z === "") {
390
+ p?.(void 0);
391
+ return;
392
+ }
393
+ const N = parseFloat(z);
394
+ isNaN(N) || p?.(N);
395
+ }
396
+ function I(L) {
397
+ const N = ht((typeof l == "number" ? l : m ?? 0) + y * L, f, o);
398
+ p?.(N);
399
+ }
400
+ return /* @__PURE__ */ e(
401
+ H,
402
+ {
403
+ id: x,
404
+ label: t,
405
+ error: r,
406
+ helperText: n,
407
+ required: a,
408
+ disabled: i,
409
+ className: b,
410
+ children: ({ id: L, describedBy: z }) => /* @__PURE__ */ c("div", { className: "relative", children: [
411
+ /* @__PURE__ */ e(
412
+ D,
413
+ {
414
+ id: L,
415
+ type: "number",
416
+ "aria-invalid": !!r,
417
+ "aria-describedby": z,
418
+ "aria-required": a,
419
+ disabled: i,
420
+ required: a,
421
+ value: l ?? "",
422
+ defaultValue: m,
423
+ placeholder: d,
424
+ onChange: M,
425
+ onBlur: h,
426
+ min: f,
427
+ max: o,
428
+ step: y,
429
+ className: g ? "pr-9" : void 0
430
+ }
431
+ ),
432
+ g && /* @__PURE__ */ c("div", { className: "absolute right-1 top-1/2 -translate-y-1/2 flex flex-col", children: [
433
+ /* @__PURE__ */ e(
434
+ B,
435
+ {
436
+ type: "button",
437
+ variant: "ghost",
438
+ size: "icon-xs",
439
+ className: "h-5 w-7 text-muted-foreground hover:text-foreground",
440
+ onClick: () => I(1),
441
+ disabled: i || o !== void 0 && typeof l == "number" && l >= o,
442
+ "aria-label": "Increment",
443
+ tabIndex: -1,
444
+ children: /* @__PURE__ */ e(xe, { className: "size-3" })
445
+ }
446
+ ),
447
+ /* @__PURE__ */ e(
448
+ B,
449
+ {
450
+ type: "button",
451
+ variant: "ghost",
452
+ size: "icon-xs",
453
+ className: "h-5 w-7 text-muted-foreground hover:text-foreground",
454
+ onClick: () => I(-1),
455
+ disabled: i || f !== void 0 && typeof l == "number" && l <= f,
456
+ "aria-label": "Decrement",
457
+ tabIndex: -1,
458
+ children: /* @__PURE__ */ e(be, { className: "size-3" })
459
+ }
460
+ )
461
+ ] })
462
+ ] })
463
+ }
464
+ );
465
+ }
466
+ function ur({
467
+ label: t,
468
+ error: r,
469
+ helperText: n,
470
+ required: a,
471
+ disabled: i,
472
+ id: x,
473
+ className: b,
474
+ checked: l,
475
+ defaultChecked: m,
476
+ onCheckedChange: d
477
+ }) {
478
+ const p = Z(), h = x ?? p, f = r ? `${h}-error` : void 0;
479
+ return /* @__PURE__ */ c("div", { className: C("space-y-1.5", b), children: [
480
+ /* @__PURE__ */ c("div", { className: "flex items-center gap-2", children: [
481
+ /* @__PURE__ */ e(
482
+ he,
483
+ {
484
+ id: h,
485
+ checked: l,
486
+ defaultChecked: m,
487
+ onCheckedChange: (o) => d?.(o === !0),
488
+ disabled: i,
489
+ required: a,
490
+ "aria-invalid": !!r,
491
+ "aria-describedby": f
492
+ }
493
+ ),
494
+ t && /* @__PURE__ */ c(V, { htmlFor: h, className: "cursor-pointer", children: [
495
+ t,
496
+ a && /* @__PURE__ */ e("span", { className: "text-destructive ml-0.5", "aria-hidden": "true", children: "*" })
497
+ ] })
498
+ ] }),
499
+ r && /* @__PURE__ */ e("p", { id: f, className: "text-sm text-destructive", role: "alert", children: r }),
500
+ n && !r && /* @__PURE__ */ e("p", { className: "text-sm text-muted-foreground", children: n })
501
+ ] });
502
+ }
503
+ function mr({
504
+ label: t,
505
+ error: r,
506
+ helperText: n,
507
+ required: a,
508
+ disabled: i,
509
+ id: x,
510
+ className: b,
511
+ checked: l,
512
+ defaultChecked: m,
513
+ onCheckedChange: d
514
+ }) {
515
+ const p = Z(), h = x ?? p, f = r ? `${h}-error` : void 0;
516
+ return /* @__PURE__ */ c("div", { className: C("space-y-1.5", b), children: [
517
+ /* @__PURE__ */ c("div", { className: "flex items-center gap-2", children: [
518
+ /* @__PURE__ */ e(
519
+ ot,
520
+ {
521
+ id: h,
522
+ checked: l,
523
+ defaultChecked: m,
524
+ onCheckedChange: d,
525
+ disabled: i,
526
+ required: a,
527
+ "aria-invalid": !!r,
528
+ "aria-describedby": f
529
+ }
530
+ ),
531
+ t && /* @__PURE__ */ c(V, { htmlFor: h, className: "cursor-pointer", children: [
532
+ t,
533
+ a && /* @__PURE__ */ e("span", { className: "text-destructive ml-0.5", "aria-hidden": "true", children: "*" })
534
+ ] })
535
+ ] }),
536
+ r && /* @__PURE__ */ e("p", { id: f, className: "text-sm text-destructive", role: "alert", children: r }),
537
+ n && !r && /* @__PURE__ */ e("p", { className: "text-sm text-muted-foreground", children: n })
538
+ ] });
539
+ }
540
+ function fr({
541
+ label: t,
542
+ error: r,
543
+ helperText: n,
544
+ required: a,
545
+ disabled: i,
546
+ id: x,
547
+ className: b,
548
+ value: l,
549
+ defaultValue: m = "#000000",
550
+ onChange: d,
551
+ showHexInput: p = !0
552
+ }) {
553
+ return /* @__PURE__ */ e(
554
+ H,
555
+ {
556
+ id: x,
557
+ label: t,
558
+ error: r,
559
+ helperText: n,
560
+ required: a,
561
+ disabled: i,
562
+ className: b,
563
+ children: ({ id: h, describedBy: f }) => /* @__PURE__ */ c("div", { className: "flex items-center gap-2", children: [
564
+ /* @__PURE__ */ e(
565
+ "label",
566
+ {
567
+ htmlFor: h,
568
+ className: C(
569
+ "relative size-9 shrink-0 cursor-pointer overflow-hidden rounded-md border border-input shadow-xs",
570
+ i && "cursor-not-allowed opacity-50"
571
+ ),
572
+ children: /* @__PURE__ */ e(
573
+ "input",
574
+ {
575
+ id: h,
576
+ type: "color",
577
+ value: l ?? m,
578
+ onChange: (o) => d?.(o.target.value),
579
+ disabled: i,
580
+ "aria-invalid": !!r,
581
+ "aria-describedby": f,
582
+ className: "absolute inset-0 size-full cursor-pointer border-0 p-0"
583
+ }
584
+ )
585
+ }
586
+ ),
587
+ p && /* @__PURE__ */ e(
588
+ D,
589
+ {
590
+ value: l ?? m,
591
+ onChange: (o) => d?.(o.target.value),
592
+ disabled: i,
593
+ placeholder: "#000000",
594
+ maxLength: 7,
595
+ className: "w-28 font-mono text-sm",
596
+ "aria-label": "Hex color value"
597
+ }
598
+ )
599
+ ] })
600
+ }
601
+ );
602
+ }
603
+ function gt({
604
+ options: t,
605
+ value: r,
606
+ onChange: n,
607
+ placeholder: a,
608
+ disabled: i,
609
+ required: x,
610
+ fieldId: b,
611
+ describedBy: l,
612
+ error: m
613
+ }) {
614
+ return /* @__PURE__ */ c(
615
+ rt,
616
+ {
617
+ value: r,
618
+ onValueChange: (d) => n?.(d),
619
+ disabled: i,
620
+ required: x,
621
+ children: [
622
+ /* @__PURE__ */ e(
623
+ nt,
624
+ {
625
+ id: b,
626
+ className: "w-full",
627
+ "aria-invalid": !!m,
628
+ "aria-describedby": l,
629
+ children: /* @__PURE__ */ e(at, { placeholder: a ?? "Select an option..." })
630
+ }
631
+ ),
632
+ /* @__PURE__ */ e(it, { children: t.map((d) => /* @__PURE__ */ e(
633
+ st,
634
+ {
635
+ value: d.value,
636
+ disabled: d.disabled,
637
+ children: d.label
638
+ },
639
+ d.value
640
+ )) })
641
+ ]
642
+ }
643
+ );
644
+ }
645
+ function vt({
646
+ options: t,
647
+ value: r = [],
648
+ onChange: n,
649
+ placeholder: a,
650
+ disabled: i,
651
+ fieldId: x,
652
+ describedBy: b,
653
+ error: l
654
+ }) {
655
+ const [m, d] = S(!1), p = Array.isArray(r) ? r : [];
656
+ function h(o) {
657
+ const y = p.includes(o) ? p.filter((g) => g !== o) : [...p, o];
658
+ n?.(y);
659
+ }
660
+ function f(o) {
661
+ n?.(p.filter((y) => y !== o));
662
+ }
663
+ return /* @__PURE__ */ c(X, { open: m, onOpenChange: d, children: [
664
+ /* @__PURE__ */ e(J, { asChild: !0, children: /* @__PURE__ */ c(
665
+ B,
666
+ {
667
+ id: x,
668
+ variant: "outline",
669
+ role: "combobox",
670
+ "aria-expanded": m,
671
+ "aria-invalid": !!l,
672
+ "aria-describedby": b,
673
+ disabled: i,
674
+ className: "w-full justify-between font-normal h-auto min-h-9",
675
+ children: [
676
+ /* @__PURE__ */ c("div", { className: "flex flex-wrap gap-1", children: [
677
+ p.length === 0 && /* @__PURE__ */ e("span", { className: "text-muted-foreground", children: a ?? "Select options..." }),
678
+ p.map((o) => {
679
+ const y = t.find((g) => g.value === o);
680
+ return /* @__PURE__ */ c(me, { variant: "secondary", className: "gap-1", children: [
681
+ y?.label ?? o,
682
+ /* @__PURE__ */ e(
683
+ "span",
684
+ {
685
+ role: "button",
686
+ tabIndex: 0,
687
+ className: "ml-0.5 rounded-full outline-none hover:bg-muted-foreground/20 cursor-pointer",
688
+ onClick: (g) => {
689
+ g.stopPropagation(), f(o);
690
+ },
691
+ onKeyDown: (g) => {
692
+ (g.key === "Enter" || g.key === " ") && (g.stopPropagation(), f(o));
693
+ },
694
+ "aria-label": `Remove ${y?.label ?? o}`,
695
+ children: /* @__PURE__ */ e(ae, { className: "size-3" })
696
+ }
697
+ )
698
+ ] }, o);
699
+ })
700
+ ] }),
701
+ /* @__PURE__ */ e(ie, { className: "ml-2 size-4 shrink-0 opacity-50" })
702
+ ]
703
+ }
704
+ ) }),
705
+ /* @__PURE__ */ e(Y, { className: "w-(--radix-popover-trigger-width) p-1", children: t.map((o) => /* @__PURE__ */ c(
706
+ "button",
707
+ {
708
+ type: "button",
709
+ className: C(
710
+ "relative flex w-full cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none hover:bg-accent hover:text-accent-foreground",
711
+ o.disabled && "pointer-events-none opacity-50"
712
+ ),
713
+ onClick: () => h(o.value),
714
+ disabled: o.disabled,
715
+ children: [
716
+ /* @__PURE__ */ e(
717
+ "div",
718
+ {
719
+ className: C(
720
+ "flex size-4 items-center justify-center rounded-sm border border-primary",
721
+ p.includes(o.value) ? "bg-primary text-primary-foreground" : "opacity-50"
722
+ ),
723
+ children: p.includes(o.value) && /* @__PURE__ */ e(ue, { className: "size-3" })
724
+ }
725
+ ),
726
+ o.label
727
+ ]
728
+ },
729
+ o.value
730
+ )) })
731
+ ] });
732
+ }
733
+ function pr({
734
+ label: t,
735
+ error: r,
736
+ helperText: n,
737
+ required: a,
738
+ disabled: i,
739
+ id: x,
740
+ className: b,
741
+ options: l,
742
+ value: m,
743
+ onChange: d,
744
+ placeholder: p,
745
+ multiple: h = !1
746
+ }) {
747
+ const f = Z(), o = x ?? f, y = r ? `${o}-error` : void 0, g = n && !r ? `${o}-helper` : void 0, M = [y, g].filter(Boolean).join(" ") || void 0;
748
+ return /* @__PURE__ */ c("div", { className: C("space-y-2", b), children: [
749
+ t && /* @__PURE__ */ c(V, { htmlFor: o, children: [
750
+ t,
751
+ a && /* @__PURE__ */ e("span", { className: "text-destructive ml-0.5", "aria-hidden": "true", children: "*" })
752
+ ] }),
753
+ h ? /* @__PURE__ */ e(
754
+ vt,
755
+ {
756
+ options: l,
757
+ value: Array.isArray(m) ? m : [],
758
+ onChange: d,
759
+ placeholder: p,
760
+ disabled: i,
761
+ fieldId: o,
762
+ describedBy: M,
763
+ error: r
764
+ }
765
+ ) : /* @__PURE__ */ e(
766
+ gt,
767
+ {
768
+ options: l,
769
+ value: typeof m == "string" ? m : void 0,
770
+ onChange: d,
771
+ placeholder: p,
772
+ disabled: i,
773
+ required: a,
774
+ fieldId: o,
775
+ describedBy: M,
776
+ error: r
777
+ }
778
+ ),
779
+ r && /* @__PURE__ */ e("p", { id: y, className: "text-sm text-destructive", role: "alert", children: r }),
780
+ n && !r && /* @__PURE__ */ e("p", { id: g, className: "text-sm text-muted-foreground", children: n })
781
+ ] });
782
+ }
783
+ const xt = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
784
+ function hr({
785
+ label: t,
786
+ error: r,
787
+ helperText: n,
788
+ required: a,
789
+ disabled: i,
790
+ id: x,
791
+ className: b,
792
+ validateOnBlur: l = !0,
793
+ onBlur: m,
794
+ ...d
795
+ }) {
796
+ const [p, h] = S(), f = r ?? p;
797
+ function o(y) {
798
+ l && y.target.value && !xt.test(y.target.value) ? h("Please enter a valid email address") : h(void 0), m?.(y);
799
+ }
800
+ return /* @__PURE__ */ e(
801
+ H,
802
+ {
803
+ id: x,
804
+ label: t,
805
+ error: f,
806
+ helperText: n,
807
+ required: a,
808
+ disabled: i,
809
+ className: b,
810
+ children: ({ id: y, describedBy: g }) => /* @__PURE__ */ c("div", { className: "relative", children: [
811
+ /* @__PURE__ */ e(ye, { className: "absolute left-3 top-1/2 -translate-y-1/2 size-4 text-muted-foreground" }),
812
+ /* @__PURE__ */ e(
813
+ D,
814
+ {
815
+ id: y,
816
+ type: "email",
817
+ "aria-invalid": !!f,
818
+ "aria-describedby": g,
819
+ "aria-required": a,
820
+ disabled: i,
821
+ required: a,
822
+ onBlur: o,
823
+ className: "pl-9",
824
+ ...d
825
+ }
826
+ )
827
+ ] })
828
+ }
829
+ );
830
+ }
831
+ function bt(t) {
832
+ try {
833
+ return new URL(t), !0;
834
+ } catch {
835
+ return !1;
836
+ }
837
+ }
838
+ function gr({
839
+ label: t,
840
+ error: r,
841
+ helperText: n,
842
+ required: a,
843
+ disabled: i,
844
+ id: x,
845
+ className: b,
846
+ validateOnBlur: l = !0,
847
+ onBlur: m,
848
+ ...d
849
+ }) {
850
+ const [p, h] = S(), f = r ?? p;
851
+ function o(y) {
852
+ l && y.target.value && !bt(y.target.value) ? h("Please enter a valid URL") : h(void 0), m?.(y);
853
+ }
854
+ return /* @__PURE__ */ e(
855
+ H,
856
+ {
857
+ id: x,
858
+ label: t,
859
+ error: f,
860
+ helperText: n,
861
+ required: a,
862
+ disabled: i,
863
+ className: b,
864
+ children: ({ id: y, describedBy: g }) => /* @__PURE__ */ c("div", { className: "relative", children: [
865
+ /* @__PURE__ */ e(Ne, { className: "absolute left-3 top-1/2 -translate-y-1/2 size-4 text-muted-foreground" }),
866
+ /* @__PURE__ */ e(
867
+ D,
868
+ {
869
+ id: y,
870
+ type: "url",
871
+ "aria-invalid": !!f,
872
+ "aria-describedby": g,
873
+ "aria-required": a,
874
+ disabled: i,
875
+ required: a,
876
+ onBlur: o,
877
+ className: "pl-9",
878
+ ...d
879
+ }
880
+ )
881
+ ] })
882
+ }
883
+ );
884
+ }
885
+ const yt = [
886
+ { code: "KE", dialCode: "+254", name: "Kenya", flag: "🇰🇪" },
887
+ { code: "UG", dialCode: "+256", name: "Uganda", flag: "🇺🇬" },
888
+ { code: "TZ", dialCode: "+255", name: "Tanzania", flag: "🇹🇿" },
889
+ { code: "RW", dialCode: "+250", name: "Rwanda", flag: "🇷🇼" },
890
+ { code: "BI", dialCode: "+257", name: "Burundi", flag: "🇧🇮" },
891
+ { code: "ET", dialCode: "+251", name: "Ethiopia", flag: "🇪🇹" },
892
+ { code: "NG", dialCode: "+234", name: "Nigeria", flag: "🇳🇬" },
893
+ { code: "ZA", dialCode: "+27", name: "South Africa", flag: "🇿🇦" },
894
+ { code: "GH", dialCode: "+233", name: "Ghana", flag: "🇬🇭" },
895
+ { code: "US", dialCode: "+1", name: "United States", flag: "🇺🇸" },
896
+ { code: "GB", dialCode: "+44", name: "United Kingdom", flag: "🇬🇧" },
897
+ { code: "IN", dialCode: "+91", name: "India", flag: "🇮🇳" },
898
+ { code: "CN", dialCode: "+86", name: "China", flag: "🇨🇳" },
899
+ { code: "DE", dialCode: "+49", name: "Germany", flag: "🇩🇪" },
900
+ { code: "FR", dialCode: "+33", name: "France", flag: "🇫🇷" }
901
+ ];
902
+ function vr({
903
+ label: t,
904
+ error: r,
905
+ helperText: n,
906
+ required: a,
907
+ disabled: i,
908
+ id: x,
909
+ className: b,
910
+ value: l,
911
+ onChange: m,
912
+ defaultCountry: d = "KE",
913
+ countries: p = yt,
914
+ placeholder: h
915
+ }) {
916
+ const f = Z(), o = x ?? f, y = r ? `${o}-error` : void 0, g = n && !r ? `${o}-helper` : void 0, M = [y, g].filter(Boolean).join(" ") || void 0, [I, L] = S(!1), [z, N] = S(
917
+ () => p.find((A) => A.code === d) ?? p[0]
918
+ ), [w, T] = S(""), $ = p.filter(
919
+ (A) => A.name.toLowerCase().includes(w.toLowerCase()) || A.dialCode.includes(w) || A.code.toLowerCase().includes(w.toLowerCase())
920
+ );
921
+ function _(A) {
922
+ m?.(A.target.value, z);
923
+ }
924
+ function O(A) {
925
+ N(A), L(!1), T(""), m?.(l ?? "", A);
926
+ }
927
+ return /* @__PURE__ */ c("div", { className: C("space-y-2", b), children: [
928
+ t && /* @__PURE__ */ c(V, { htmlFor: o, children: [
929
+ t,
930
+ a && /* @__PURE__ */ e("span", { className: "text-destructive ml-0.5", "aria-hidden": "true", children: "*" })
931
+ ] }),
932
+ /* @__PURE__ */ c("div", { className: "flex gap-1", children: [
933
+ /* @__PURE__ */ c(X, { open: I, onOpenChange: L, children: [
934
+ /* @__PURE__ */ e(J, { asChild: !0, children: /* @__PURE__ */ c(
935
+ B,
936
+ {
937
+ variant: "outline",
938
+ role: "combobox",
939
+ "aria-expanded": I,
940
+ "aria-label": "Select country code",
941
+ disabled: i,
942
+ className: "w-auto shrink-0 gap-1 px-2",
943
+ children: [
944
+ /* @__PURE__ */ e("span", { className: "text-base leading-none", children: z.flag }),
945
+ /* @__PURE__ */ e("span", { className: "text-xs text-muted-foreground", children: z.dialCode }),
946
+ /* @__PURE__ */ e(ie, { className: "size-3 opacity-50" })
947
+ ]
948
+ }
949
+ ) }),
950
+ /* @__PURE__ */ c(Y, { className: "w-64 max-w-[calc(100vw-2rem)] p-0", align: "start", children: [
951
+ /* @__PURE__ */ e("div", { className: "p-2", children: /* @__PURE__ */ e(
952
+ D,
953
+ {
954
+ placeholder: "Search countries...",
955
+ value: w,
956
+ onChange: (A) => T(A.target.value),
957
+ className: "h-8"
958
+ }
959
+ ) }),
960
+ /* @__PURE__ */ c("div", { className: "max-h-48 overflow-y-auto p-1", children: [
961
+ $.map((A) => /* @__PURE__ */ c(
962
+ "button",
963
+ {
964
+ type: "button",
965
+ className: C(
966
+ "flex w-full items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none hover:bg-accent hover:text-accent-foreground",
967
+ z.code === A.code && "bg-accent"
968
+ ),
969
+ onClick: () => O(A),
970
+ children: [
971
+ /* @__PURE__ */ e("span", { className: "text-base leading-none", children: A.flag }),
972
+ /* @__PURE__ */ e("span", { className: "flex-1 text-left truncate", children: A.name }),
973
+ /* @__PURE__ */ e("span", { className: "text-xs text-muted-foreground", children: A.dialCode })
974
+ ]
975
+ },
976
+ A.code
977
+ )),
978
+ $.length === 0 && /* @__PURE__ */ e("p", { className: "px-2 py-4 text-center text-sm text-muted-foreground", children: "No countries found" })
979
+ ] })
980
+ ] })
981
+ ] }),
982
+ /* @__PURE__ */ c("div", { className: "relative flex-1", children: [
983
+ /* @__PURE__ */ e(Ce, { className: "absolute left-3 top-1/2 -translate-y-1/2 size-4 text-muted-foreground" }),
984
+ /* @__PURE__ */ e(
985
+ D,
986
+ {
987
+ id: o,
988
+ type: "tel",
989
+ value: l,
990
+ onChange: _,
991
+ placeholder: h ?? "Phone number",
992
+ disabled: i,
993
+ required: a,
994
+ "aria-invalid": !!r,
995
+ "aria-describedby": M,
996
+ className: "pl-9"
997
+ }
998
+ )
999
+ ] })
1000
+ ] }),
1001
+ r && /* @__PURE__ */ e("p", { id: y, className: "text-sm text-destructive", role: "alert", children: r }),
1002
+ n && !r && /* @__PURE__ */ e("p", { id: g, className: "text-sm text-muted-foreground", children: n })
1003
+ ] });
1004
+ }
1005
+ function xr({
1006
+ mode: t = "single",
1007
+ numberOfMonths: r = 1,
1008
+ value: n,
1009
+ onChange: a,
1010
+ placeholder: i = "Pick a date",
1011
+ fromDate: x,
1012
+ toDate: b,
1013
+ label: l,
1014
+ error: m,
1015
+ helperText: d,
1016
+ required: p,
1017
+ disabled: h,
1018
+ id: f,
1019
+ className: o
1020
+ }) {
1021
+ const [y, g] = S(!1), M = () => {
1022
+ if (!n) return i;
1023
+ if (t === "single" && n instanceof Date)
1024
+ return re(n, "MMM d, yyyy");
1025
+ if (t === "multiple" && Array.isArray(n)) {
1026
+ const N = n.length;
1027
+ return N > 0 ? `${N} date${N === 1 ? "" : "s"} selected` : i;
1028
+ }
1029
+ if (t === "range" && n && typeof n == "object" && "from" in n) {
1030
+ const { from: N, to: w } = n;
1031
+ if (N && w)
1032
+ return `${re(N, "MMM d")} - ${re(w, "MMM d, yyyy")}`;
1033
+ if (N)
1034
+ return re(N, "MMM d, yyyy");
1035
+ }
1036
+ return i;
1037
+ };
1038
+ function I(N) {
1039
+ a?.(N), g(!1);
1040
+ }
1041
+ function L(N) {
1042
+ a?.(N);
1043
+ }
1044
+ function z(N) {
1045
+ a?.(N);
1046
+ }
1047
+ return /* @__PURE__ */ e(
1048
+ H,
1049
+ {
1050
+ id: f,
1051
+ label: l,
1052
+ error: m,
1053
+ helperText: d,
1054
+ required: p,
1055
+ disabled: h,
1056
+ className: o,
1057
+ children: ({ id: N, describedBy: w }) => /* @__PURE__ */ c(X, { open: y, onOpenChange: g, children: [
1058
+ /* @__PURE__ */ e(J, { asChild: !0, children: /* @__PURE__ */ c(
1059
+ B,
1060
+ {
1061
+ id: N,
1062
+ variant: "outline",
1063
+ disabled: h,
1064
+ "aria-describedby": w,
1065
+ className: C(
1066
+ "w-full justify-start text-left font-normal",
1067
+ !n && "text-muted-foreground"
1068
+ ),
1069
+ children: [
1070
+ /* @__PURE__ */ e(we, {}),
1071
+ M()
1072
+ ]
1073
+ }
1074
+ ) }),
1075
+ /* @__PURE__ */ c(Y, { className: "w-auto p-0", align: "start", children: [
1076
+ t === "single" && /* @__PURE__ */ e(
1077
+ ne,
1078
+ {
1079
+ mode: "single",
1080
+ selected: n instanceof Date ? n : void 0,
1081
+ onSelect: I,
1082
+ numberOfMonths: r,
1083
+ fromDate: x,
1084
+ toDate: b,
1085
+ disabled: h
1086
+ }
1087
+ ),
1088
+ t === "multiple" && /* @__PURE__ */ e(
1089
+ ne,
1090
+ {
1091
+ mode: "multiple",
1092
+ selected: Array.isArray(n) ? n : void 0,
1093
+ onSelect: L,
1094
+ numberOfMonths: r,
1095
+ fromDate: x,
1096
+ toDate: b,
1097
+ disabled: h
1098
+ }
1099
+ ),
1100
+ t === "range" && /* @__PURE__ */ e(
1101
+ ne,
1102
+ {
1103
+ mode: "range",
1104
+ selected: n && typeof n == "object" && "from" in n ? n : void 0,
1105
+ onSelect: z,
1106
+ numberOfMonths: r,
1107
+ fromDate: x,
1108
+ toDate: b,
1109
+ disabled: h
1110
+ }
1111
+ )
1112
+ ] })
1113
+ ] })
1114
+ }
1115
+ );
1116
+ }
1117
+ function br({
1118
+ label: t,
1119
+ error: r,
1120
+ helperText: n,
1121
+ required: a,
1122
+ disabled: i,
1123
+ id: x,
1124
+ className: b,
1125
+ value: l,
1126
+ onChange: m,
1127
+ format: d = "24h",
1128
+ minuteStep: p = 1,
1129
+ placeholder: h = "Select time"
1130
+ }) {
1131
+ const [f, o] = S(!1), y = (u) => {
1132
+ if (!u) return null;
1133
+ const [v, s] = u.split(":").map(Number);
1134
+ return isNaN(v) || isNaN(s) ? null : { hour: v, minute: s };
1135
+ }, g = y(l), M = (u) => {
1136
+ if (!u) return h;
1137
+ const v = y(u);
1138
+ if (!v) return h;
1139
+ if (d === "24h")
1140
+ return `${String(v.hour).padStart(2, "0")}:${String(v.minute).padStart(2, "0")}`;
1141
+ {
1142
+ const s = v.hour >= 12 ? "PM" : "AM";
1143
+ return `${v.hour % 12 || 12}:${String(v.minute).padStart(2, "0")} ${s}`;
1144
+ }
1145
+ }, I = d === "24h" ? Array.from({ length: 24 }, (u, v) => v) : Array.from({ length: 12 }, (u, v) => v + 1), L = Array.from(
1146
+ { length: Math.ceil(60 / p) },
1147
+ (u, v) => v * p
1148
+ ), [z, N] = S(g?.hour ?? null), [w, T] = S(g?.minute ?? null), [$, _] = S(
1149
+ g && g.hour >= 12 ? "PM" : "AM"
1150
+ ), O = (u) => {
1151
+ let v = u;
1152
+ d === "12h" && ($ === "PM" && u !== 12 ? v = u + 12 : $ === "AM" && u === 12 && (v = 0)), N(v), j(v, w);
1153
+ }, A = (u) => {
1154
+ T(u), j(z, u);
1155
+ }, K = (u) => {
1156
+ if (_(u), z !== null) {
1157
+ let v = z;
1158
+ if (d === "12h") {
1159
+ const s = z % 12 || 12;
1160
+ u === "PM" && s !== 12 ? v = s + 12 : u === "AM" && s === 12 ? v = 0 : u === "AM" ? v = s : v = s === 12 ? 12 : s + 12;
1161
+ }
1162
+ N(v), j(v, w);
1163
+ }
1164
+ }, j = (u, v) => {
1165
+ if (u !== null && v !== null && m) {
1166
+ const s = `${String(u).padStart(2, "0")}:${String(v).padStart(2, "0")}`;
1167
+ m(s);
1168
+ }
1169
+ };
1170
+ return /* @__PURE__ */ e(
1171
+ lt,
1172
+ {
1173
+ id: x,
1174
+ label: t,
1175
+ error: r,
1176
+ helperText: n,
1177
+ required: a,
1178
+ disabled: i,
1179
+ className: b,
1180
+ children: ({ id: u, describedBy: v }) => /* @__PURE__ */ c(X, { open: f, onOpenChange: o, children: [
1181
+ /* @__PURE__ */ e(J, { asChild: !0, children: /* @__PURE__ */ c(
1182
+ B,
1183
+ {
1184
+ id: u,
1185
+ "aria-describedby": v,
1186
+ variant: "outline",
1187
+ className: C(
1188
+ "w-full justify-start text-left font-normal",
1189
+ !l && "text-muted-foreground"
1190
+ ),
1191
+ disabled: i,
1192
+ children: [
1193
+ /* @__PURE__ */ e(ke, { className: "mr-2 size-4" }),
1194
+ M(l)
1195
+ ]
1196
+ }
1197
+ ) }),
1198
+ /* @__PURE__ */ e(Y, { className: "w-auto p-0", align: "start", children: /* @__PURE__ */ c("div", { className: "flex w-fit", children: [
1199
+ /* @__PURE__ */ c("div", { className: "flex flex-col border-r w-14", children: [
1200
+ /* @__PURE__ */ e("div", { className: "py-1.5 text-xs font-medium border-b text-muted-foreground text-center", children: "Hr" }),
1201
+ /* @__PURE__ */ e("div", { className: "max-h-[200px] overflow-y-auto", children: I.map((s) => {
1202
+ const P = d === "24h" ? s : $ === "PM" && s !== 12 ? s + 12 : $ === "AM" && s === 12 ? 0 : s;
1203
+ return /* @__PURE__ */ e(
1204
+ "button",
1205
+ {
1206
+ type: "button",
1207
+ onClick: () => O(s),
1208
+ className: C(
1209
+ "w-full py-1.5 text-sm hover:bg-accent text-center transition-colors",
1210
+ z === P && "bg-primary/10 text-primary font-medium"
1211
+ ),
1212
+ children: String(s).padStart(2, "0")
1213
+ },
1214
+ s
1215
+ );
1216
+ }) })
1217
+ ] }),
1218
+ /* @__PURE__ */ c("div", { className: C("flex flex-col w-14", d === "12h" && "border-r"), children: [
1219
+ /* @__PURE__ */ e("div", { className: "py-1.5 text-xs font-medium border-b text-muted-foreground text-center", children: "Min" }),
1220
+ /* @__PURE__ */ e("div", { className: "max-h-[200px] overflow-y-auto", children: L.map((s) => /* @__PURE__ */ e(
1221
+ "button",
1222
+ {
1223
+ type: "button",
1224
+ onClick: () => A(s),
1225
+ className: C(
1226
+ "w-full py-1.5 text-sm hover:bg-accent text-center transition-colors",
1227
+ w === s && "bg-primary/10 text-primary font-medium"
1228
+ ),
1229
+ children: String(s).padStart(2, "0")
1230
+ },
1231
+ s
1232
+ )) })
1233
+ ] }),
1234
+ d === "12h" && /* @__PURE__ */ c("div", { className: "flex flex-col w-14", children: [
1235
+ /* @__PURE__ */ e("div", { className: "py-1.5 text-xs font-medium border-b text-muted-foreground text-center", children: " " }),
1236
+ /* @__PURE__ */ c("div", { className: "flex flex-col", children: [
1237
+ /* @__PURE__ */ e(
1238
+ "button",
1239
+ {
1240
+ type: "button",
1241
+ onClick: () => K("AM"),
1242
+ className: C(
1243
+ "py-1.5 text-sm hover:bg-accent text-center transition-colors",
1244
+ $ === "AM" && "bg-primary/10 text-primary font-medium"
1245
+ ),
1246
+ children: "AM"
1247
+ }
1248
+ ),
1249
+ /* @__PURE__ */ e(
1250
+ "button",
1251
+ {
1252
+ type: "button",
1253
+ onClick: () => K("PM"),
1254
+ className: C(
1255
+ "py-1.5 text-sm hover:bg-accent text-center transition-colors",
1256
+ $ === "PM" && "bg-primary/10 text-primary font-medium"
1257
+ ),
1258
+ children: "PM"
1259
+ }
1260
+ )
1261
+ ] })
1262
+ ] })
1263
+ ] }) })
1264
+ ] })
1265
+ }
1266
+ );
1267
+ }
1268
+ function oe(t) {
1269
+ return t < 1024 ? `${t} B` : t < 1024 * 1024 ? `${(t / 1024).toFixed(1)} KB` : `${(t / (1024 * 1024)).toFixed(1)} MB`;
1270
+ }
1271
+ function Nt(t) {
1272
+ const r = t.type;
1273
+ return r.startsWith("image/") ? /* @__PURE__ */ e(ze, { className: "size-4 text-blue-500" }) : r === "application/pdf" || t.name.endsWith(".pdf") ? /* @__PURE__ */ e(Se, { className: "size-4 text-red-500" }) : r.includes("spreadsheet") || r.includes("csv") || r.includes("excel") || t.name.match(/\.(csv|xlsx?|xls)$/i) ? /* @__PURE__ */ e(Ie, { className: "size-4 text-green-500" }) : /* @__PURE__ */ e(Le, { className: "size-4 text-muted-foreground" });
1274
+ }
1275
+ function yr({
1276
+ label: t,
1277
+ error: r,
1278
+ helperText: n,
1279
+ required: a,
1280
+ disabled: i,
1281
+ id: x,
1282
+ className: b,
1283
+ value: l,
1284
+ onChange: m,
1285
+ accept: d,
1286
+ multiple: p = !1,
1287
+ maxSize: h,
1288
+ maxFiles: f
1289
+ }) {
1290
+ const o = Q(null), [y, g] = S(!1), [M, I] = S(), [L, z] = S(/* @__PURE__ */ new Map()), N = ce(() => l ?? [], [l]), w = r ?? M;
1291
+ W(() => {
1292
+ const u = /* @__PURE__ */ new Map(), v = [];
1293
+ return L.forEach((s) => v.push(s)), N.forEach((s) => {
1294
+ if (s.type.startsWith("image/"))
1295
+ try {
1296
+ const P = URL.createObjectURL(s);
1297
+ u.set(s.name, P);
1298
+ } catch {
1299
+ }
1300
+ }), z(u), () => {
1301
+ v.forEach((s) => {
1302
+ try {
1303
+ URL.revokeObjectURL(s);
1304
+ } catch {
1305
+ }
1306
+ }), u.forEach((s) => {
1307
+ try {
1308
+ URL.revokeObjectURL(s);
1309
+ } catch {
1310
+ }
1311
+ });
1312
+ };
1313
+ }, [N]);
1314
+ function T(u) {
1315
+ if (h) {
1316
+ const v = u.find((s) => s.size > h);
1317
+ if (v)
1318
+ return `File "${v.name}" exceeds maximum size of ${oe(h)}`;
1319
+ }
1320
+ if (f && N.length + u.length > f)
1321
+ return `Maximum ${f} files allowed`;
1322
+ }
1323
+ function $(u) {
1324
+ if (!u || u.length === 0) return;
1325
+ const v = Array.from(u), s = T(v);
1326
+ if (s) {
1327
+ I(s);
1328
+ return;
1329
+ }
1330
+ I(void 0), m?.(p ? [...N, ...v] : v.slice(0, 1)), o.current && (o.current.value = "");
1331
+ }
1332
+ function _(u) {
1333
+ const v = N.filter((s, P) => P !== u);
1334
+ m?.(v), I(void 0);
1335
+ }
1336
+ function O(u) {
1337
+ u.preventDefault(), u.stopPropagation(), i || g(!0);
1338
+ }
1339
+ function A(u) {
1340
+ u.preventDefault(), u.stopPropagation();
1341
+ }
1342
+ function K(u) {
1343
+ u.preventDefault(), u.stopPropagation(), g(!1);
1344
+ }
1345
+ function j(u) {
1346
+ u.preventDefault(), u.stopPropagation(), g(!1), i || $(u.dataTransfer.files);
1347
+ }
1348
+ return /* @__PURE__ */ e(
1349
+ H,
1350
+ {
1351
+ id: x,
1352
+ label: t,
1353
+ error: w,
1354
+ helperText: n,
1355
+ required: a,
1356
+ disabled: i,
1357
+ className: b,
1358
+ children: ({ id: u, describedBy: v }) => /* @__PURE__ */ c("div", { className: "space-y-4", children: [
1359
+ /* @__PURE__ */ c(
1360
+ "label",
1361
+ {
1362
+ htmlFor: u,
1363
+ className: C(
1364
+ "flex flex-col items-center justify-center rounded-md border-2 border-dashed p-4 sm:p-8 transition-colors cursor-pointer",
1365
+ y && !i ? "border-primary bg-primary/5" : "border-border hover:border-primary/50",
1366
+ i && "opacity-50 cursor-not-allowed"
1367
+ ),
1368
+ onDragEnter: O,
1369
+ onDragOver: A,
1370
+ onDragLeave: K,
1371
+ onDrop: j,
1372
+ children: [
1373
+ /* @__PURE__ */ e(Ae, { className: "size-8 text-muted-foreground mb-4" }),
1374
+ /* @__PURE__ */ c("p", { className: "text-sm text-center text-foreground font-medium", children: [
1375
+ /* @__PURE__ */ e("span", { className: "sm:hidden", children: "Tap to browse files" }),
1376
+ /* @__PURE__ */ e("span", { className: "hidden sm:inline", children: "Drag & drop files here, or click to browse" })
1377
+ ] }),
1378
+ d && /* @__PURE__ */ c("p", { className: "text-xs text-muted-foreground mt-2", children: [
1379
+ "Accepted formats: ",
1380
+ d
1381
+ ] })
1382
+ ]
1383
+ }
1384
+ ),
1385
+ /* @__PURE__ */ e(
1386
+ "input",
1387
+ {
1388
+ ref: o,
1389
+ id: u,
1390
+ type: "file",
1391
+ accept: d,
1392
+ multiple: p,
1393
+ disabled: i,
1394
+ required: a,
1395
+ "aria-invalid": !!w,
1396
+ "aria-describedby": v,
1397
+ "aria-required": a,
1398
+ onChange: (s) => $(s.target.files),
1399
+ className: "sr-only"
1400
+ }
1401
+ ),
1402
+ N.length > 0 && /* @__PURE__ */ e("ul", { className: "space-y-2", role: "list", children: N.map((s, P) => {
1403
+ const q = L.get(s.name);
1404
+ return /* @__PURE__ */ c(
1405
+ "li",
1406
+ {
1407
+ className: "flex items-center gap-3 rounded-md border p-3",
1408
+ children: [
1409
+ q ? /* @__PURE__ */ e(
1410
+ "img",
1411
+ {
1412
+ src: q,
1413
+ alt: s.name,
1414
+ className: "size-10 rounded object-cover",
1415
+ "data-testid": `file-icon-${s.name}`
1416
+ }
1417
+ ) : /* @__PURE__ */ e("div", { "data-testid": `file-icon-${s.name}`, children: Nt(s) }),
1418
+ /* @__PURE__ */ c("div", { className: "flex-1 min-w-0", children: [
1419
+ /* @__PURE__ */ e("p", { className: "text-sm font-medium truncate", children: s.name }),
1420
+ /* @__PURE__ */ e("p", { className: "text-xs text-muted-foreground", children: oe(s.size) })
1421
+ ] }),
1422
+ /* @__PURE__ */ e(
1423
+ B,
1424
+ {
1425
+ type: "button",
1426
+ variant: "ghost",
1427
+ size: "icon-sm",
1428
+ onClick: (ee) => {
1429
+ ee.stopPropagation(), _(P);
1430
+ },
1431
+ disabled: i,
1432
+ "aria-label": `Remove ${s.name}`,
1433
+ children: /* @__PURE__ */ e(ae, { className: "size-4" })
1434
+ }
1435
+ )
1436
+ ]
1437
+ },
1438
+ `${s.name}-${P}`
1439
+ );
1440
+ }) })
1441
+ ] })
1442
+ }
1443
+ );
1444
+ }
1445
+ function Nr({
1446
+ label: t,
1447
+ error: r,
1448
+ helperText: n,
1449
+ required: a,
1450
+ disabled: i,
1451
+ id: x,
1452
+ className: b,
1453
+ value: l,
1454
+ onChange: m,
1455
+ onSearch: d,
1456
+ multiple: p = !1,
1457
+ debounceMs: h = 300,
1458
+ minQueryLength: f = 1,
1459
+ placeholder: o
1460
+ }) {
1461
+ const y = Z(), g = x ?? y, M = r ? `${g}-error` : void 0, I = n && !r ? `${g}-helper` : void 0, L = [M, I].filter(Boolean).join(" ") || void 0, [z, N] = S(!1), [w, T] = S(""), [$, _] = S([]), [O, A] = S(!1), [K, j] = S(/* @__PURE__ */ new Map()), u = Q(void 0), v = Q(0), s = p ? Array.isArray(l) ? l : [] : typeof l == "string" ? l : void 0, P = ce(() => {
1462
+ const k = new Map(K);
1463
+ return $.forEach((E) => {
1464
+ k.set(E.value, E.label);
1465
+ }), k;
1466
+ }, [$, K]);
1467
+ W(() => {
1468
+ if (w.length < f) {
1469
+ _([]), A(!1);
1470
+ return;
1471
+ }
1472
+ u.current !== void 0 && clearTimeout(u.current), A(!0), v.current += 1;
1473
+ const k = v.current;
1474
+ return u.current = window.setTimeout(() => {
1475
+ d(w).then((E) => {
1476
+ k === v.current && (_(E), A(!1), j((U) => {
1477
+ const F = new Map(U);
1478
+ return E.forEach((te) => {
1479
+ F.set(te.value, te.label);
1480
+ }), F;
1481
+ }));
1482
+ }).catch(() => {
1483
+ k === v.current && (_([]), A(!1));
1484
+ });
1485
+ }, h), () => {
1486
+ u.current !== void 0 && clearTimeout(u.current);
1487
+ };
1488
+ }, [w, d, h, f]);
1489
+ function q(k, E) {
1490
+ if (j((U) => new Map(U).set(k, E)), p) {
1491
+ const U = Array.isArray(s) ? s : [], F = U.includes(k) ? U.filter((te) => te !== k) : [...U, k];
1492
+ m?.(F);
1493
+ } else
1494
+ m?.(k), N(!1);
1495
+ }
1496
+ function ee(k) {
1497
+ if (p) {
1498
+ const U = (Array.isArray(s) ? s : []).filter((F) => F !== k);
1499
+ m?.(U);
1500
+ }
1501
+ }
1502
+ function se(k) {
1503
+ return p ? Array.isArray(s) && s.includes(k) : s === k;
1504
+ }
1505
+ function fe() {
1506
+ if (p) {
1507
+ const k = Array.isArray(s) ? s : [];
1508
+ return k.length === 0 ? /* @__PURE__ */ e("span", { className: "text-muted-foreground", children: o ?? "Select options..." }) : /* @__PURE__ */ e("div", { className: "flex flex-wrap gap-1", children: k.map((E) => {
1509
+ const U = P.get(E) ?? E;
1510
+ return /* @__PURE__ */ c(me, { variant: "secondary", className: "gap-1", children: [
1511
+ U,
1512
+ /* @__PURE__ */ e(
1513
+ "span",
1514
+ {
1515
+ role: "button",
1516
+ tabIndex: 0,
1517
+ className: "ml-0.5 rounded-full outline-none hover:bg-muted-foreground/20 cursor-pointer",
1518
+ onClick: (F) => {
1519
+ F.stopPropagation(), ee(E);
1520
+ },
1521
+ onKeyDown: (F) => {
1522
+ (F.key === "Enter" || F.key === " ") && (F.stopPropagation(), ee(E));
1523
+ },
1524
+ "aria-label": `Remove ${U}`,
1525
+ children: /* @__PURE__ */ e(ae, { className: "size-3" })
1526
+ }
1527
+ )
1528
+ ] }, E);
1529
+ }) });
1530
+ } else
1531
+ return s ? /* @__PURE__ */ e("span", { children: P.get(s) ?? s }) : /* @__PURE__ */ e("span", { className: "text-muted-foreground", children: o ?? "Select an option..." });
1532
+ }
1533
+ function pe() {
1534
+ return w.length < f ? /* @__PURE__ */ e("div", { className: "py-6 text-center text-sm text-muted-foreground", children: "Type to search..." }) : O ? /* @__PURE__ */ c("div", { className: "py-6 text-center flex items-center justify-center gap-2", children: [
1535
+ /* @__PURE__ */ e($e, { className: "size-4 animate-spin", role: "status" }),
1536
+ /* @__PURE__ */ e("span", { className: "text-sm text-muted-foreground", children: "Searching..." })
1537
+ ] }) : $.length === 0 ? /* @__PURE__ */ e("div", { className: "py-6 text-center text-sm text-muted-foreground", children: "No results found" }) : /* @__PURE__ */ e("div", { className: "max-h-64 overflow-y-auto", children: $.map((k) => /* @__PURE__ */ c(
1538
+ "button",
1539
+ {
1540
+ type: "button",
1541
+ className: C(
1542
+ "relative flex w-full cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none hover:bg-accent hover:text-accent-foreground",
1543
+ k.disabled && "pointer-events-none opacity-50"
1544
+ ),
1545
+ onClick: () => q(k.value, k.label),
1546
+ disabled: k.disabled,
1547
+ children: [
1548
+ /* @__PURE__ */ e(
1549
+ "div",
1550
+ {
1551
+ className: C(
1552
+ "flex size-4 items-center justify-center",
1553
+ se(k.value) && "text-primary"
1554
+ ),
1555
+ children: se(k.value) && /* @__PURE__ */ e(ue, { className: "size-4" })
1556
+ }
1557
+ ),
1558
+ k.label
1559
+ ]
1560
+ },
1561
+ k.value
1562
+ )) });
1563
+ }
1564
+ return /* @__PURE__ */ c("div", { className: C("space-y-2", b), children: [
1565
+ t && /* @__PURE__ */ c(V, { htmlFor: g, children: [
1566
+ t,
1567
+ a && /* @__PURE__ */ e("span", { className: "text-destructive ml-0.5", "aria-hidden": "true", children: "*" })
1568
+ ] }),
1569
+ /* @__PURE__ */ c(X, { open: z, onOpenChange: N, children: [
1570
+ /* @__PURE__ */ e(J, { asChild: !0, children: /* @__PURE__ */ c(
1571
+ B,
1572
+ {
1573
+ id: g,
1574
+ variant: "outline",
1575
+ role: "combobox",
1576
+ "aria-expanded": z,
1577
+ "aria-invalid": !!r,
1578
+ "aria-describedby": L,
1579
+ disabled: i,
1580
+ className: "w-full justify-between font-normal h-auto min-h-9",
1581
+ children: [
1582
+ fe(),
1583
+ /* @__PURE__ */ e(ie, { className: "ml-2 size-4 shrink-0 opacity-50" })
1584
+ ]
1585
+ }
1586
+ ) }),
1587
+ /* @__PURE__ */ c(Y, { className: "w-(--radix-popover-trigger-width) p-0", children: [
1588
+ /* @__PURE__ */ c("div", { className: "flex items-center border-b px-3", children: [
1589
+ /* @__PURE__ */ e(Me, { className: "mr-2 size-4 shrink-0 opacity-50" }),
1590
+ /* @__PURE__ */ e(
1591
+ D,
1592
+ {
1593
+ placeholder: "Search...",
1594
+ value: w,
1595
+ onChange: (k) => T(k.target.value),
1596
+ className: "border-0 focus-visible:ring-0 focus-visible:ring-offset-0"
1597
+ }
1598
+ )
1599
+ ] }),
1600
+ pe()
1601
+ ] })
1602
+ ] }),
1603
+ r && /* @__PURE__ */ e("p", { id: M, className: "text-sm text-destructive", role: "alert", children: r }),
1604
+ n && !r && /* @__PURE__ */ e("p", { id: I, className: "text-sm text-muted-foreground", children: n })
1605
+ ] });
1606
+ }
1607
+ function G() {
1608
+ return /* @__PURE__ */ e("div", { className: "mx-0.5 h-5 w-px bg-border" });
1609
+ }
1610
+ function R({
1611
+ onClick: t,
1612
+ isActive: r,
1613
+ disabled: n,
1614
+ ariaLabel: a,
1615
+ children: i
1616
+ }) {
1617
+ return /* @__PURE__ */ e(
1618
+ B,
1619
+ {
1620
+ type: "button",
1621
+ variant: "ghost",
1622
+ size: "icon-xs",
1623
+ onClick: t,
1624
+ disabled: n,
1625
+ className: C(r && "bg-accent text-accent-foreground"),
1626
+ "aria-label": a,
1627
+ "aria-pressed": r,
1628
+ children: i
1629
+ }
1630
+ );
1631
+ }
1632
+ const Ct = /^(https?:\/\/|mailto:)/i;
1633
+ function wt(t) {
1634
+ return Ct.test(t.trim());
1635
+ }
1636
+ function kt({
1637
+ editor: t,
1638
+ disabled: r
1639
+ }) {
1640
+ const [n, a] = S(!1), [i, x] = S("");
1641
+ function b(f) {
1642
+ if (f) {
1643
+ const o = t.getAttributes("link").href ?? "";
1644
+ x(o), m("");
1645
+ }
1646
+ a(f);
1647
+ }
1648
+ const [l, m] = S("");
1649
+ function d() {
1650
+ const f = i.trim();
1651
+ if (f) {
1652
+ if (!wt(f)) {
1653
+ m("URL must start with http://, https://, or mailto:");
1654
+ return;
1655
+ }
1656
+ t.chain().focus().extendMarkRange("link").setLink({ href: f }).run(), a(!1), x(""), m("");
1657
+ }
1658
+ }
1659
+ function p() {
1660
+ t.chain().focus().extendMarkRange("link").unsetLink().run(), a(!1), x("");
1661
+ }
1662
+ const h = t.isActive("link");
1663
+ return /* @__PURE__ */ c(X, { open: n, onOpenChange: b, children: [
1664
+ /* @__PURE__ */ e(J, { asChild: !0, children: /* @__PURE__ */ e(
1665
+ B,
1666
+ {
1667
+ type: "button",
1668
+ variant: "ghost",
1669
+ size: "icon-xs",
1670
+ disabled: r,
1671
+ className: C(h && "bg-accent text-accent-foreground"),
1672
+ "aria-label": h ? "Edit link" : "Insert link",
1673
+ "aria-pressed": h,
1674
+ children: /* @__PURE__ */ e(Ze, { className: "size-3" })
1675
+ }
1676
+ ) }),
1677
+ /* @__PURE__ */ e(Y, { className: "w-72 max-w-[calc(100vw-2rem)] p-3", align: "start", children: /* @__PURE__ */ c("div", { className: "space-y-2", children: [
1678
+ /* @__PURE__ */ e(
1679
+ D,
1680
+ {
1681
+ placeholder: "https://example.com",
1682
+ value: i,
1683
+ onChange: (f) => {
1684
+ x(f.target.value), m("");
1685
+ },
1686
+ onKeyDown: (f) => {
1687
+ f.key === "Enter" && (f.preventDefault(), d());
1688
+ },
1689
+ "aria-invalid": !!l,
1690
+ className: "h-8"
1691
+ }
1692
+ ),
1693
+ l && /* @__PURE__ */ e("p", { className: "text-xs text-destructive", children: l }),
1694
+ /* @__PURE__ */ c("div", { className: "flex gap-1", children: [
1695
+ /* @__PURE__ */ e(
1696
+ B,
1697
+ {
1698
+ type: "button",
1699
+ size: "xs",
1700
+ onClick: d,
1701
+ disabled: !i,
1702
+ children: "Apply"
1703
+ }
1704
+ ),
1705
+ h && /* @__PURE__ */ c(
1706
+ B,
1707
+ {
1708
+ type: "button",
1709
+ variant: "ghost",
1710
+ size: "xs",
1711
+ onClick: p,
1712
+ children: [
1713
+ /* @__PURE__ */ e(Ve, { className: "size-3" }),
1714
+ "Remove"
1715
+ ]
1716
+ }
1717
+ )
1718
+ ] })
1719
+ ] }) })
1720
+ ] });
1721
+ }
1722
+ function At({
1723
+ editor: t,
1724
+ disabled: r
1725
+ }) {
1726
+ return t ? /* @__PURE__ */ c(
1727
+ "div",
1728
+ {
1729
+ className: "flex flex-wrap items-center gap-0.5 border-b border-input px-2 py-1",
1730
+ role: "toolbar",
1731
+ "aria-label": "Formatting options",
1732
+ children: [
1733
+ /* @__PURE__ */ e(
1734
+ R,
1735
+ {
1736
+ onClick: () => t.chain().focus().toggleBold().run(),
1737
+ isActive: t.isActive("bold"),
1738
+ disabled: r,
1739
+ ariaLabel: "Bold",
1740
+ children: /* @__PURE__ */ e(Re, { className: "size-3" })
1741
+ }
1742
+ ),
1743
+ /* @__PURE__ */ e(
1744
+ R,
1745
+ {
1746
+ onClick: () => t.chain().focus().toggleItalic().run(),
1747
+ isActive: t.isActive("italic"),
1748
+ disabled: r,
1749
+ ariaLabel: "Italic",
1750
+ children: /* @__PURE__ */ e(Ee, { className: "size-3" })
1751
+ }
1752
+ ),
1753
+ /* @__PURE__ */ e(
1754
+ R,
1755
+ {
1756
+ onClick: () => t.chain().focus().toggleUnderline().run(),
1757
+ isActive: t.isActive("underline"),
1758
+ disabled: r,
1759
+ ariaLabel: "Underline",
1760
+ children: /* @__PURE__ */ e(Pe, { className: "size-3" })
1761
+ }
1762
+ ),
1763
+ /* @__PURE__ */ e(
1764
+ R,
1765
+ {
1766
+ onClick: () => t.chain().focus().toggleStrike().run(),
1767
+ isActive: t.isActive("strike"),
1768
+ disabled: r,
1769
+ ariaLabel: "Strikethrough",
1770
+ children: /* @__PURE__ */ e(Be, { className: "size-3" })
1771
+ }
1772
+ ),
1773
+ /* @__PURE__ */ e(G, {}),
1774
+ /* @__PURE__ */ e(
1775
+ R,
1776
+ {
1777
+ onClick: () => t.chain().focus().toggleHeading({ level: 1 }).run(),
1778
+ isActive: t.isActive("heading", { level: 1 }),
1779
+ disabled: r,
1780
+ ariaLabel: "Heading 1",
1781
+ children: /* @__PURE__ */ e(Ue, { className: "size-3" })
1782
+ }
1783
+ ),
1784
+ /* @__PURE__ */ e(
1785
+ R,
1786
+ {
1787
+ onClick: () => t.chain().focus().toggleHeading({ level: 2 }).run(),
1788
+ isActive: t.isActive("heading", { level: 2 }),
1789
+ disabled: r,
1790
+ ariaLabel: "Heading 2",
1791
+ children: /* @__PURE__ */ e(Fe, { className: "size-3" })
1792
+ }
1793
+ ),
1794
+ /* @__PURE__ */ e(
1795
+ R,
1796
+ {
1797
+ onClick: () => t.chain().focus().toggleHeading({ level: 3 }).run(),
1798
+ isActive: t.isActive("heading", { level: 3 }),
1799
+ disabled: r,
1800
+ ariaLabel: "Heading 3",
1801
+ children: /* @__PURE__ */ e(Te, { className: "size-3" })
1802
+ }
1803
+ ),
1804
+ /* @__PURE__ */ e(G, {}),
1805
+ /* @__PURE__ */ e(
1806
+ R,
1807
+ {
1808
+ onClick: () => t.chain().focus().toggleBulletList().run(),
1809
+ isActive: t.isActive("bulletList"),
1810
+ disabled: r,
1811
+ ariaLabel: "Bullet list",
1812
+ children: /* @__PURE__ */ e(De, { className: "size-3" })
1813
+ }
1814
+ ),
1815
+ /* @__PURE__ */ e(
1816
+ R,
1817
+ {
1818
+ onClick: () => t.chain().focus().toggleOrderedList().run(),
1819
+ isActive: t.isActive("orderedList"),
1820
+ disabled: r,
1821
+ ariaLabel: "Ordered list",
1822
+ children: /* @__PURE__ */ e(He, { className: "size-3" })
1823
+ }
1824
+ ),
1825
+ /* @__PURE__ */ e(G, {}),
1826
+ /* @__PURE__ */ e(
1827
+ R,
1828
+ {
1829
+ onClick: () => t.chain().focus().toggleBlockquote().run(),
1830
+ isActive: t.isActive("blockquote"),
1831
+ disabled: r,
1832
+ ariaLabel: "Blockquote",
1833
+ children: /* @__PURE__ */ e(_e, { className: "size-3" })
1834
+ }
1835
+ ),
1836
+ /* @__PURE__ */ e(
1837
+ R,
1838
+ {
1839
+ onClick: () => t.chain().focus().toggleCodeBlock().run(),
1840
+ isActive: t.isActive("codeBlock"),
1841
+ disabled: r,
1842
+ ariaLabel: "Code block",
1843
+ children: /* @__PURE__ */ e(je, { className: "size-3" })
1844
+ }
1845
+ ),
1846
+ /* @__PURE__ */ e(G, {}),
1847
+ /* @__PURE__ */ e(
1848
+ R,
1849
+ {
1850
+ onClick: () => t.chain().focus().setTextAlign("left").run(),
1851
+ isActive: t.isActive({ textAlign: "left" }),
1852
+ disabled: r,
1853
+ ariaLabel: "Align left",
1854
+ children: /* @__PURE__ */ e(Oe, { className: "size-3" })
1855
+ }
1856
+ ),
1857
+ /* @__PURE__ */ e(
1858
+ R,
1859
+ {
1860
+ onClick: () => t.chain().focus().setTextAlign("center").run(),
1861
+ isActive: t.isActive({ textAlign: "center" }),
1862
+ disabled: r,
1863
+ ariaLabel: "Align center",
1864
+ children: /* @__PURE__ */ e(Ke, { className: "size-3" })
1865
+ }
1866
+ ),
1867
+ /* @__PURE__ */ e(
1868
+ R,
1869
+ {
1870
+ onClick: () => t.chain().focus().setTextAlign("right").run(),
1871
+ isActive: t.isActive({ textAlign: "right" }),
1872
+ disabled: r,
1873
+ ariaLabel: "Align right",
1874
+ children: /* @__PURE__ */ e(Ge, { className: "size-3" })
1875
+ }
1876
+ ),
1877
+ /* @__PURE__ */ e(G, {}),
1878
+ /* @__PURE__ */ e(kt, { editor: t, disabled: r }),
1879
+ /* @__PURE__ */ e(G, {}),
1880
+ /* @__PURE__ */ e(
1881
+ R,
1882
+ {
1883
+ onClick: () => t.chain().focus().undo().run(),
1884
+ disabled: r || !t.can().undo(),
1885
+ ariaLabel: "Undo",
1886
+ children: /* @__PURE__ */ e(We, { className: "size-3" })
1887
+ }
1888
+ ),
1889
+ /* @__PURE__ */ e(
1890
+ R,
1891
+ {
1892
+ onClick: () => t.chain().focus().redo().run(),
1893
+ disabled: r || !t.can().redo(),
1894
+ ariaLabel: "Redo",
1895
+ children: /* @__PURE__ */ e(Qe, { className: "size-3" })
1896
+ }
1897
+ )
1898
+ ]
1899
+ }
1900
+ ) : null;
1901
+ }
1902
+ function Cr({
1903
+ label: t,
1904
+ error: r,
1905
+ helperText: n,
1906
+ required: a,
1907
+ disabled: i,
1908
+ id: x,
1909
+ className: b,
1910
+ value: l,
1911
+ onChange: m,
1912
+ placeholder: d,
1913
+ minHeight: p = "150px",
1914
+ maxCharacters: h,
1915
+ showWordCount: f,
1916
+ showCharacterCount: o
1917
+ }) {
1918
+ const y = Q(m);
1919
+ W(() => {
1920
+ y.current = m;
1921
+ }, [m]);
1922
+ const g = Xe({
1923
+ extensions: [
1924
+ Ye.configure({
1925
+ link: { openOnClick: !1 }
1926
+ }),
1927
+ qe.configure({ types: ["heading", "paragraph"] }),
1928
+ et.configure({ placeholder: d ?? "" }),
1929
+ tt.configure({
1930
+ limit: h ?? void 0
1931
+ })
1932
+ ],
1933
+ content: l ?? "",
1934
+ editable: !i,
1935
+ onUpdate: ({ editor: w }) => {
1936
+ y.current?.(w.getHTML());
1937
+ },
1938
+ editorProps: {
1939
+ attributes: {
1940
+ role: "textbox",
1941
+ "aria-multiline": "true"
1942
+ }
1943
+ }
1944
+ });
1945
+ W(() => {
1946
+ if (!g) return;
1947
+ const w = g.getHTML();
1948
+ l !== void 0 && l !== w && g.commands.setContent(l, { emitUpdate: !1 });
1949
+ }, [g, l]), W(() => {
1950
+ g && g.setEditable(!i);
1951
+ }, [g, i]);
1952
+ const M = Q(""), I = Q(void 0);
1953
+ W(() => {
1954
+ if (!g) return;
1955
+ const w = g.view.dom;
1956
+ M.current && w.setAttribute("id", M.current), w.setAttribute("aria-invalid", String(!!r)), w.setAttribute("aria-required", String(!!a)), I.current ? w.setAttribute("aria-describedby", I.current) : w.removeAttribute("aria-describedby");
1957
+ }, [g, r, a]);
1958
+ const L = g?.storage.characterCount?.characters() ?? 0, z = g?.storage.characterCount?.words() ?? 0, N = o || f;
1959
+ return /* @__PURE__ */ e(
1960
+ H,
1961
+ {
1962
+ id: x,
1963
+ label: t,
1964
+ error: r,
1965
+ helperText: n,
1966
+ required: a,
1967
+ disabled: i,
1968
+ className: b,
1969
+ children: ({ id: w, describedBy: T }) => (M.current = w, I.current = T, /* @__PURE__ */ c(
1970
+ "div",
1971
+ {
1972
+ className: C(
1973
+ "overflow-hidden rounded-md border border-input bg-transparent shadow-xs transition-colors",
1974
+ "focus-within:border-ring focus-within:ring-ring/50 focus-within:ring-[3px]",
1975
+ r && "border-destructive focus-within:border-destructive focus-within:ring-destructive/20",
1976
+ i && "opacity-50 pointer-events-none"
1977
+ ),
1978
+ children: [
1979
+ /* @__PURE__ */ e(At, { editor: g, disabled: i }),
1980
+ /* @__PURE__ */ e(
1981
+ Je,
1982
+ {
1983
+ editor: g,
1984
+ className: C(
1985
+ "prose prose-sm max-w-none px-3 py-2 overflow-x-auto",
1986
+ "text-foreground",
1987
+ "prose-headings:text-foreground",
1988
+ "prose-strong:text-foreground",
1989
+ "prose-a:text-primary",
1990
+ "prose-blockquote:text-muted-foreground prose-blockquote:border-border",
1991
+ "prose-code:text-foreground",
1992
+ "prose-pre:bg-muted prose-pre:text-foreground",
1993
+ "prose-hr:border-border",
1994
+ "prose-th:text-foreground",
1995
+ "prose-lead:text-muted-foreground",
1996
+ "[&_.tiptap]:outline-none",
1997
+ "[&_.tiptap.is-editor-empty_.is-empty::before]:text-muted-foreground",
1998
+ "[&_.tiptap.is-editor-empty_.is-empty::before]:float-left",
1999
+ "[&_.tiptap.is-editor-empty_.is-empty::before]:h-0",
2000
+ "[&_.tiptap.is-editor-empty_.is-empty::before]:pointer-events-none",
2001
+ "[&_.tiptap.is-editor-empty_.is-empty::before]:content-[attr(data-placeholder)]"
2002
+ ),
2003
+ style: { minHeight: p }
2004
+ }
2005
+ ),
2006
+ N && /* @__PURE__ */ c("div", { className: "flex justify-end gap-3 border-t border-input px-3 py-1.5 text-xs text-muted-foreground", children: [
2007
+ o && /* @__PURE__ */ e("span", { children: h ? `${L} / ${h} characters` : `${L} characters` }),
2008
+ f && /* @__PURE__ */ c("span", { children: [
2009
+ z,
2010
+ " words"
2011
+ ] })
2012
+ ] })
2013
+ ]
2014
+ }
2015
+ ))
2016
+ }
2017
+ );
2018
+ }
2019
+ function wr(...t) {
2020
+ return ut(dt(t));
2021
+ }
2022
+ export {
2023
+ Yt as Badge,
2024
+ Jt as Button,
2025
+ qt as Card,
2026
+ nr as CardAction,
2027
+ ar as CardContent,
2028
+ rr as CardDescription,
2029
+ ir as CardFooter,
2030
+ er as CardHeader,
2031
+ tr as CardTitle,
2032
+ ur as Checkbox,
2033
+ fr as ColorInput,
2034
+ yt as DEFAULT_COUNTRIES,
2035
+ xr as DatePicker,
2036
+ hr as EmailInput,
2037
+ H as FieldWrapper,
2038
+ yr as FileInput,
2039
+ sr as Input,
2040
+ dr as NumberInput,
2041
+ lr as PasswordInput,
2042
+ Nr as QuerySelect,
2043
+ Cr as RichTextInput,
2044
+ pr as SelectInput,
2045
+ mr as SwitchInput,
2046
+ vr as TelephoneInput,
2047
+ or as TextInput,
2048
+ cr as TextareaInput,
2049
+ br as TimePicker,
2050
+ gr as URLInput,
2051
+ ft as badgeVariants,
2052
+ mt as buttonVariants,
2053
+ wr as cn
2054
+ };