@algodomain/smart-forms 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.
@@ -0,0 +1,982 @@
1
+ 'use strict';
2
+
3
+ var chunkYV7RVYMD_cjs = require('./chunk-YV7RVYMD.cjs');
4
+ var React4 = require('react');
5
+ var CheckboxPrimitive = require('@radix-ui/react-checkbox');
6
+ var lucideReact = require('lucide-react');
7
+ var jsxRuntime = require('react/jsx-runtime');
8
+ var RadioGroupPrimitive = require('@radix-ui/react-radio-group');
9
+ var SelectPrimitive = require('@radix-ui/react-select');
10
+ var dateFns = require('date-fns');
11
+ var reactSlot = require('@radix-ui/react-slot');
12
+ var classVarianceAuthority = require('class-variance-authority');
13
+ var reactDayPicker = require('react-day-picker');
14
+ var PopoverPrimitive = require('@radix-ui/react-popover');
15
+
16
+ function _interopNamespace(e) {
17
+ if (e && e.__esModule) return e;
18
+ var n = Object.create(null);
19
+ if (e) {
20
+ Object.keys(e).forEach(function (k) {
21
+ if (k !== 'default') {
22
+ var d = Object.getOwnPropertyDescriptor(e, k);
23
+ Object.defineProperty(n, k, d.get ? d : {
24
+ enumerable: true,
25
+ get: function () { return e[k]; }
26
+ });
27
+ }
28
+ });
29
+ }
30
+ n.default = e;
31
+ return Object.freeze(n);
32
+ }
33
+
34
+ var React4__namespace = /*#__PURE__*/_interopNamespace(React4);
35
+ var CheckboxPrimitive__namespace = /*#__PURE__*/_interopNamespace(CheckboxPrimitive);
36
+ var RadioGroupPrimitive__namespace = /*#__PURE__*/_interopNamespace(RadioGroupPrimitive);
37
+ var SelectPrimitive__namespace = /*#__PURE__*/_interopNamespace(SelectPrimitive);
38
+ var PopoverPrimitive__namespace = /*#__PURE__*/_interopNamespace(PopoverPrimitive);
39
+
40
+ function Checkbox({
41
+ className,
42
+ ...props
43
+ }) {
44
+ return /* @__PURE__ */ jsxRuntime.jsx(
45
+ CheckboxPrimitive__namespace.Root,
46
+ {
47
+ "data-slot": "checkbox",
48
+ className: chunkYV7RVYMD_cjs.cn(
49
+ "peer border-input dark:bg-input/30 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground dark:data-[state=checked]:bg-primary data-[state=checked]:border-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive size-4 shrink-0 rounded-[4px] border shadow-xs transition-shadow outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",
50
+ className
51
+ ),
52
+ ...props,
53
+ children: /* @__PURE__ */ jsxRuntime.jsx(
54
+ CheckboxPrimitive__namespace.Indicator,
55
+ {
56
+ "data-slot": "checkbox-indicator",
57
+ className: "flex items-center justify-center text-current transition-none",
58
+ children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.CheckIcon, { className: "size-3.5" })
59
+ }
60
+ )
61
+ }
62
+ );
63
+ }
64
+ var SmartCheckbox = ({
65
+ field,
66
+ label,
67
+ className = "",
68
+ validation,
69
+ required = false,
70
+ defaultValue,
71
+ info,
72
+ subLabel
73
+ }) => {
74
+ const { value, error, onChange, fieldRef, registerValidation } = chunkYV7RVYMD_cjs.useFormField(field);
75
+ const fieldDetection = chunkYV7RVYMD_cjs.useFieldDetection();
76
+ const hasRegistered = React4.useRef(false);
77
+ const hasSetDefault = React4.useRef(false);
78
+ React4.useEffect(() => {
79
+ if (validation && !hasRegistered.current) {
80
+ hasRegistered.current = true;
81
+ registerValidation(field, validation);
82
+ }
83
+ }, [validation, field, registerValidation]);
84
+ React4.useEffect(() => {
85
+ if (fieldDetection?.registerField) {
86
+ fieldDetection.registerField(field);
87
+ }
88
+ }, [field, fieldDetection]);
89
+ React4.useEffect(() => {
90
+ if (defaultValue !== void 0 && !hasSetDefault.current && (value === void 0 || value === null || value === "")) {
91
+ onChange(defaultValue);
92
+ hasSetDefault.current = true;
93
+ }
94
+ }, [defaultValue, value, onChange]);
95
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `flex-1 min-w-0 ${className}`, children: [
96
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
97
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between gap-2", children: [
98
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center space-x-2", children: [
99
+ /* @__PURE__ */ jsxRuntime.jsx(
100
+ Checkbox,
101
+ {
102
+ ref: fieldRef,
103
+ checked: value || false,
104
+ onCheckedChange: (checked) => onChange(!!checked),
105
+ className: error ? "border-destructive" : "",
106
+ "data-field": field,
107
+ id: `${field}-checkbox`
108
+ }
109
+ ),
110
+ /* @__PURE__ */ jsxRuntime.jsxs(chunkYV7RVYMD_cjs.Label, { htmlFor: `${field}-checkbox`, className: "text-sm font-normal cursor-pointer", children: [
111
+ label || field,
112
+ " ",
113
+ required && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-destructive", children: "*" })
114
+ ] })
115
+ ] }),
116
+ info && /* @__PURE__ */ jsxRuntime.jsx(chunkYV7RVYMD_cjs.TooltipProvider, { children: /* @__PURE__ */ jsxRuntime.jsxs(chunkYV7RVYMD_cjs.Tooltip, { children: [
117
+ /* @__PURE__ */ jsxRuntime.jsx(chunkYV7RVYMD_cjs.TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.InfoIcon, { className: "h-4 w-4 text-muted-foreground cursor-pointer mr-2" }) }),
118
+ /* @__PURE__ */ jsxRuntime.jsx(chunkYV7RVYMD_cjs.TooltipContent, { children: /* @__PURE__ */ jsxRuntime.jsx("p", { className: "max-w-xs", children: info }) })
119
+ ] }) })
120
+ ] }),
121
+ subLabel && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-muted-foreground ml-6", children: subLabel })
122
+ ] }),
123
+ error && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-destructive text-sm mt-1", children: error })
124
+ ] });
125
+ };
126
+ function RadioGroup({
127
+ className,
128
+ ...props
129
+ }) {
130
+ return /* @__PURE__ */ jsxRuntime.jsx(
131
+ RadioGroupPrimitive__namespace.Root,
132
+ {
133
+ "data-slot": "radio-group",
134
+ className: chunkYV7RVYMD_cjs.cn("grid gap-3", className),
135
+ ...props
136
+ }
137
+ );
138
+ }
139
+ function RadioGroupItem({
140
+ className,
141
+ ...props
142
+ }) {
143
+ return /* @__PURE__ */ jsxRuntime.jsx(
144
+ RadioGroupPrimitive__namespace.Item,
145
+ {
146
+ "data-slot": "radio-group-item",
147
+ className: chunkYV7RVYMD_cjs.cn(
148
+ "border-input text-primary 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:bg-input/30 aspect-square size-4 shrink-0 rounded-full border shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",
149
+ className
150
+ ),
151
+ ...props,
152
+ children: /* @__PURE__ */ jsxRuntime.jsx(
153
+ RadioGroupPrimitive__namespace.Indicator,
154
+ {
155
+ "data-slot": "radio-group-indicator",
156
+ className: "relative flex items-center justify-center",
157
+ children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.CircleIcon, { className: "fill-primary absolute top-1/2 left-1/2 size-2 -translate-x-1/2 -translate-y-1/2" })
158
+ }
159
+ )
160
+ }
161
+ );
162
+ }
163
+ var SmartRadioGroup = ({
164
+ field,
165
+ label,
166
+ options,
167
+ name,
168
+ alignment = "vertical",
169
+ className = "",
170
+ validation,
171
+ required = false,
172
+ defaultValue,
173
+ info,
174
+ subLabel
175
+ }) => {
176
+ const { value, error, onChange, fieldRef, registerValidation } = chunkYV7RVYMD_cjs.useFormField(field);
177
+ const fieldDetection = chunkYV7RVYMD_cjs.useFieldDetection();
178
+ const hasRegistered = React4.useRef(false);
179
+ const hasSetDefault = React4.useRef(false);
180
+ React4.useEffect(() => {
181
+ if (validation && !hasRegistered.current) {
182
+ hasRegistered.current = true;
183
+ registerValidation(field, validation);
184
+ }
185
+ }, [validation, field, registerValidation]);
186
+ React4.useEffect(() => {
187
+ if (fieldDetection?.registerField) {
188
+ fieldDetection.registerField(field);
189
+ }
190
+ }, [field, fieldDetection]);
191
+ React4.useEffect(() => {
192
+ if (defaultValue !== void 0 && !hasSetDefault.current && (value === void 0 || value === null || value === "")) {
193
+ onChange(defaultValue);
194
+ hasSetDefault.current = true;
195
+ }
196
+ }, [defaultValue, value, onChange]);
197
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `flex-1 min-w-0 ${className}`, children: [
198
+ label && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mb-2", children: [
199
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between gap-2", children: [
200
+ /* @__PURE__ */ jsxRuntime.jsxs(chunkYV7RVYMD_cjs.Label, { className: "text-sm font-medium text-foreground", children: [
201
+ label,
202
+ " ",
203
+ required && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-destructive", children: "*" })
204
+ ] }),
205
+ info && /* @__PURE__ */ jsxRuntime.jsx(chunkYV7RVYMD_cjs.TooltipProvider, { children: /* @__PURE__ */ jsxRuntime.jsxs(chunkYV7RVYMD_cjs.Tooltip, { children: [
206
+ /* @__PURE__ */ jsxRuntime.jsx(chunkYV7RVYMD_cjs.TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.InfoIcon, { className: "h-4 w-4 text-muted-foreground cursor-pointer mr-2" }) }),
207
+ /* @__PURE__ */ jsxRuntime.jsx(chunkYV7RVYMD_cjs.TooltipContent, { children: /* @__PURE__ */ jsxRuntime.jsx("p", { className: "max-w-xs", children: info }) })
208
+ ] }) })
209
+ ] }),
210
+ subLabel && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-muted-foreground mt-1", children: subLabel })
211
+ ] }),
212
+ /* @__PURE__ */ jsxRuntime.jsx(
213
+ RadioGroup,
214
+ {
215
+ value: value || "",
216
+ onValueChange: (newValue) => onChange(newValue),
217
+ className: alignment === "horizontal" ? "flex flex-wrap gap-4" : "grid gap-3",
218
+ ref: fieldRef,
219
+ "data-field": field,
220
+ name: name || field,
221
+ children: options.map((option) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center space-x-2", children: [
222
+ /* @__PURE__ */ jsxRuntime.jsx(
223
+ RadioGroupItem,
224
+ {
225
+ value: option.value,
226
+ id: `${field}-${option.value}`
227
+ }
228
+ ),
229
+ /* @__PURE__ */ jsxRuntime.jsx(
230
+ chunkYV7RVYMD_cjs.Label,
231
+ {
232
+ htmlFor: `${field}-${option.value}`,
233
+ className: "text-sm font-normal cursor-pointer",
234
+ children: option.label
235
+ }
236
+ )
237
+ ] }, option.value))
238
+ }
239
+ ),
240
+ error && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-destructive text-sm mt-1", children: error })
241
+ ] });
242
+ };
243
+ function Select({
244
+ ...props
245
+ }) {
246
+ return /* @__PURE__ */ jsxRuntime.jsx(SelectPrimitive__namespace.Root, { "data-slot": "select", ...props });
247
+ }
248
+ function SelectValue({
249
+ ...props
250
+ }) {
251
+ return /* @__PURE__ */ jsxRuntime.jsx(SelectPrimitive__namespace.Value, { "data-slot": "select-value", ...props });
252
+ }
253
+ function SelectTrigger({
254
+ className,
255
+ size = "default",
256
+ children,
257
+ ...props
258
+ }) {
259
+ return /* @__PURE__ */ jsxRuntime.jsxs(
260
+ SelectPrimitive__namespace.Trigger,
261
+ {
262
+ "data-slot": "select-trigger",
263
+ "data-size": size,
264
+ className: chunkYV7RVYMD_cjs.cn(
265
+ "border-input data-[placeholder]:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground 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:bg-input/30 dark:hover:bg-input/50 flex w-fit items-center justify-between gap-2 rounded-md border bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
266
+ className
267
+ ),
268
+ ...props,
269
+ children: [
270
+ children,
271
+ /* @__PURE__ */ jsxRuntime.jsx(SelectPrimitive__namespace.Icon, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronDownIcon, { className: "size-4 opacity-50" }) })
272
+ ]
273
+ }
274
+ );
275
+ }
276
+ function SelectContent({
277
+ className,
278
+ children,
279
+ position = "popper",
280
+ ...props
281
+ }) {
282
+ return /* @__PURE__ */ jsxRuntime.jsx(SelectPrimitive__namespace.Portal, { children: /* @__PURE__ */ jsxRuntime.jsxs(
283
+ SelectPrimitive__namespace.Content,
284
+ {
285
+ "data-slot": "select-content",
286
+ className: chunkYV7RVYMD_cjs.cn(
287
+ "bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=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 relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border shadow-md",
288
+ 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",
289
+ className
290
+ ),
291
+ position,
292
+ ...props,
293
+ children: [
294
+ /* @__PURE__ */ jsxRuntime.jsx(SelectScrollUpButton, {}),
295
+ /* @__PURE__ */ jsxRuntime.jsx(
296
+ SelectPrimitive__namespace.Viewport,
297
+ {
298
+ className: chunkYV7RVYMD_cjs.cn(
299
+ "p-1",
300
+ position === "popper" && "h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"
301
+ ),
302
+ children
303
+ }
304
+ ),
305
+ /* @__PURE__ */ jsxRuntime.jsx(SelectScrollDownButton, {})
306
+ ]
307
+ }
308
+ ) });
309
+ }
310
+ function SelectItem({
311
+ className,
312
+ children,
313
+ ...props
314
+ }) {
315
+ return /* @__PURE__ */ jsxRuntime.jsxs(
316
+ SelectPrimitive__namespace.Item,
317
+ {
318
+ "data-slot": "select-item",
319
+ className: chunkYV7RVYMD_cjs.cn(
320
+ "focus:bg-accent focus:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",
321
+ className
322
+ ),
323
+ ...props,
324
+ children: [
325
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "absolute right-2 flex size-3.5 items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(SelectPrimitive__namespace.ItemIndicator, { children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.CheckIcon, { className: "size-4" }) }) }),
326
+ /* @__PURE__ */ jsxRuntime.jsx(SelectPrimitive__namespace.ItemText, { children })
327
+ ]
328
+ }
329
+ );
330
+ }
331
+ function SelectScrollUpButton({
332
+ className,
333
+ ...props
334
+ }) {
335
+ return /* @__PURE__ */ jsxRuntime.jsx(
336
+ SelectPrimitive__namespace.ScrollUpButton,
337
+ {
338
+ "data-slot": "select-scroll-up-button",
339
+ className: chunkYV7RVYMD_cjs.cn(
340
+ "flex cursor-default items-center justify-center py-1",
341
+ className
342
+ ),
343
+ ...props,
344
+ children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronUpIcon, { className: "size-4" })
345
+ }
346
+ );
347
+ }
348
+ function SelectScrollDownButton({
349
+ className,
350
+ ...props
351
+ }) {
352
+ return /* @__PURE__ */ jsxRuntime.jsx(
353
+ SelectPrimitive__namespace.ScrollDownButton,
354
+ {
355
+ "data-slot": "select-scroll-down-button",
356
+ className: chunkYV7RVYMD_cjs.cn(
357
+ "flex cursor-default items-center justify-center py-1",
358
+ className
359
+ ),
360
+ ...props,
361
+ children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronDownIcon, { className: "size-4" })
362
+ }
363
+ );
364
+ }
365
+ var SmartSelect = ({
366
+ field,
367
+ label,
368
+ options,
369
+ className = "",
370
+ placeholder,
371
+ validation,
372
+ required = false,
373
+ defaultValue,
374
+ info,
375
+ subLabel
376
+ }) => {
377
+ const { value, error, onChange, fieldRef, registerValidation } = chunkYV7RVYMD_cjs.useFormField(field);
378
+ const fieldDetection = chunkYV7RVYMD_cjs.useFieldDetection();
379
+ const hasRegistered = React4.useRef(false);
380
+ const hasSetDefault = React4.useRef(false);
381
+ React4.useEffect(() => {
382
+ if (validation && !hasRegistered.current) {
383
+ hasRegistered.current = true;
384
+ registerValidation(field, validation);
385
+ }
386
+ }, [validation, field, registerValidation]);
387
+ React4.useEffect(() => {
388
+ if (fieldDetection?.registerField) {
389
+ fieldDetection.registerField(field);
390
+ }
391
+ }, [field, fieldDetection]);
392
+ React4.useEffect(() => {
393
+ if (defaultValue !== void 0 && !hasSetDefault.current && (value === void 0 || value === null || value === "")) {
394
+ onChange(defaultValue);
395
+ hasSetDefault.current = true;
396
+ }
397
+ }, [defaultValue, value, onChange]);
398
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `flex-1 min-w-0 ${className}`, children: [
399
+ label && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mb-2", children: [
400
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between gap-2", children: [
401
+ /* @__PURE__ */ jsxRuntime.jsxs(chunkYV7RVYMD_cjs.Label, { className: "text-sm font-medium text-foreground", children: [
402
+ label,
403
+ " ",
404
+ required && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-destructive", children: "*" })
405
+ ] }),
406
+ info && /* @__PURE__ */ jsxRuntime.jsx(chunkYV7RVYMD_cjs.TooltipProvider, { children: /* @__PURE__ */ jsxRuntime.jsxs(chunkYV7RVYMD_cjs.Tooltip, { children: [
407
+ /* @__PURE__ */ jsxRuntime.jsx(chunkYV7RVYMD_cjs.TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.InfoIcon, { className: "h-4 w-4 text-muted-foreground cursor-pointer mr-2" }) }),
408
+ /* @__PURE__ */ jsxRuntime.jsx(chunkYV7RVYMD_cjs.TooltipContent, { children: /* @__PURE__ */ jsxRuntime.jsx("p", { className: "max-w-xs", children: info }) })
409
+ ] }) })
410
+ ] }),
411
+ subLabel && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-muted-foreground mt-1", children: subLabel })
412
+ ] }),
413
+ /* @__PURE__ */ jsxRuntime.jsxs(
414
+ Select,
415
+ {
416
+ value: value || "",
417
+ onValueChange: (newValue) => onChange(newValue),
418
+ children: [
419
+ /* @__PURE__ */ jsxRuntime.jsx(
420
+ SelectTrigger,
421
+ {
422
+ ref: fieldRef,
423
+ className: `w-full ${error ? "border-destructive" : ""} ${className}`,
424
+ "data-field": field,
425
+ children: /* @__PURE__ */ jsxRuntime.jsx(SelectValue, { placeholder: placeholder || `Select ${label || field}` })
426
+ }
427
+ ),
428
+ /* @__PURE__ */ jsxRuntime.jsx(SelectContent, { children: options.map((option) => /* @__PURE__ */ jsxRuntime.jsx(SelectItem, { value: option.value, children: option.label }, option.value)) })
429
+ ]
430
+ }
431
+ ),
432
+ error && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-destructive text-sm mt-1", children: error })
433
+ ] });
434
+ };
435
+ var buttonVariants = classVarianceAuthority.cva(
436
+ "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",
437
+ {
438
+ variants: {
439
+ variant: {
440
+ default: "bg-primary text-primary-foreground hover:bg-primary/90",
441
+ destructive: "bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",
442
+ 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",
443
+ secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80",
444
+ ghost: "hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",
445
+ link: "text-primary underline-offset-4 hover:underline"
446
+ },
447
+ size: {
448
+ default: "h-9 px-4 py-2 has-[>svg]:px-3",
449
+ sm: "h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",
450
+ lg: "h-10 rounded-md px-6 has-[>svg]:px-4",
451
+ icon: "size-9"
452
+ }
453
+ },
454
+ defaultVariants: {
455
+ variant: "default",
456
+ size: "default"
457
+ }
458
+ }
459
+ );
460
+ function Button({
461
+ className,
462
+ variant,
463
+ size,
464
+ asChild = false,
465
+ ...props
466
+ }) {
467
+ const Comp = asChild ? reactSlot.Slot : "button";
468
+ return /* @__PURE__ */ jsxRuntime.jsx(
469
+ Comp,
470
+ {
471
+ "data-slot": "button",
472
+ className: chunkYV7RVYMD_cjs.cn(buttonVariants({ variant, size, className })),
473
+ ...props
474
+ }
475
+ );
476
+ }
477
+ function Calendar({
478
+ className,
479
+ classNames,
480
+ showOutsideDays = true,
481
+ captionLayout = "label",
482
+ buttonVariant = "ghost",
483
+ formatters,
484
+ components,
485
+ ...props
486
+ }) {
487
+ const defaultClassNames = reactDayPicker.getDefaultClassNames();
488
+ return /* @__PURE__ */ jsxRuntime.jsx(
489
+ reactDayPicker.DayPicker,
490
+ {
491
+ showOutsideDays,
492
+ className: chunkYV7RVYMD_cjs.cn(
493
+ "bg-background group/calendar p-3 [--cell-size:--spacing(8)] [[data-slot=card-content]_&]:bg-transparent [[data-slot=popover-content]_&]:bg-transparent",
494
+ String.raw`rtl:**:[.rdp-button\_next>svg]:rotate-180`,
495
+ String.raw`rtl:**:[.rdp-button\_previous>svg]:rotate-180`,
496
+ className
497
+ ),
498
+ captionLayout,
499
+ formatters: {
500
+ formatMonthDropdown: (date) => date.toLocaleString("default", { month: "short" }),
501
+ ...formatters
502
+ },
503
+ classNames: {
504
+ root: chunkYV7RVYMD_cjs.cn("w-fit", defaultClassNames.root),
505
+ months: chunkYV7RVYMD_cjs.cn(
506
+ "flex gap-4 flex-col md:flex-row relative",
507
+ defaultClassNames.months
508
+ ),
509
+ month: chunkYV7RVYMD_cjs.cn("flex flex-col w-full gap-4", defaultClassNames.month),
510
+ nav: chunkYV7RVYMD_cjs.cn(
511
+ "flex items-center gap-1 w-full absolute top-0 inset-x-0 justify-between",
512
+ defaultClassNames.nav
513
+ ),
514
+ button_previous: chunkYV7RVYMD_cjs.cn(
515
+ buttonVariants({ variant: buttonVariant }),
516
+ "size-(--cell-size) aria-disabled:opacity-50 p-0 select-none",
517
+ defaultClassNames.button_previous
518
+ ),
519
+ button_next: chunkYV7RVYMD_cjs.cn(
520
+ buttonVariants({ variant: buttonVariant }),
521
+ "size-(--cell-size) aria-disabled:opacity-50 p-0 select-none",
522
+ defaultClassNames.button_next
523
+ ),
524
+ month_caption: chunkYV7RVYMD_cjs.cn(
525
+ "flex items-center justify-center h-(--cell-size) w-full px-(--cell-size)",
526
+ defaultClassNames.month_caption
527
+ ),
528
+ dropdowns: chunkYV7RVYMD_cjs.cn(
529
+ "w-full flex items-center text-sm font-medium justify-center h-(--cell-size) gap-1.5",
530
+ defaultClassNames.dropdowns
531
+ ),
532
+ dropdown_root: chunkYV7RVYMD_cjs.cn(
533
+ "relative has-focus:border-ring border border-input shadow-xs has-focus:ring-ring/50 has-focus:ring-[3px] rounded-md",
534
+ defaultClassNames.dropdown_root
535
+ ),
536
+ dropdown: chunkYV7RVYMD_cjs.cn(
537
+ "absolute bg-popover inset-0 opacity-0",
538
+ defaultClassNames.dropdown
539
+ ),
540
+ caption_label: chunkYV7RVYMD_cjs.cn(
541
+ "select-none font-medium",
542
+ captionLayout === "label" ? "text-sm" : "rounded-md pl-2 pr-1 flex items-center gap-1 text-sm h-8 [&>svg]:text-muted-foreground [&>svg]:size-3.5",
543
+ defaultClassNames.caption_label
544
+ ),
545
+ table: "w-full border-collapse",
546
+ weekdays: chunkYV7RVYMD_cjs.cn("flex", defaultClassNames.weekdays),
547
+ weekday: chunkYV7RVYMD_cjs.cn(
548
+ "text-muted-foreground rounded-md flex-1 font-normal text-[0.8rem] select-none",
549
+ defaultClassNames.weekday
550
+ ),
551
+ week: chunkYV7RVYMD_cjs.cn("flex w-full mt-2", defaultClassNames.week),
552
+ week_number_header: chunkYV7RVYMD_cjs.cn(
553
+ "select-none w-(--cell-size)",
554
+ defaultClassNames.week_number_header
555
+ ),
556
+ week_number: chunkYV7RVYMD_cjs.cn(
557
+ "text-[0.8rem] select-none text-muted-foreground",
558
+ defaultClassNames.week_number
559
+ ),
560
+ day: chunkYV7RVYMD_cjs.cn(
561
+ "relative w-full h-full p-0 text-center [&:first-child[data-selected=true]_button]:rounded-l-md [&:last-child[data-selected=true]_button]:rounded-r-md group/day aspect-square select-none",
562
+ defaultClassNames.day
563
+ ),
564
+ range_start: chunkYV7RVYMD_cjs.cn(
565
+ "rounded-l-md bg-accent",
566
+ defaultClassNames.range_start
567
+ ),
568
+ range_middle: chunkYV7RVYMD_cjs.cn("rounded-none", defaultClassNames.range_middle),
569
+ range_end: chunkYV7RVYMD_cjs.cn("rounded-r-md bg-accent", defaultClassNames.range_end),
570
+ today: chunkYV7RVYMD_cjs.cn(
571
+ "bg-accent text-accent-foreground rounded-md data-[selected=true]:rounded-none",
572
+ defaultClassNames.today
573
+ ),
574
+ outside: chunkYV7RVYMD_cjs.cn(
575
+ "text-muted-foreground aria-selected:text-muted-foreground",
576
+ defaultClassNames.outside
577
+ ),
578
+ disabled: chunkYV7RVYMD_cjs.cn(
579
+ "text-muted-foreground opacity-50",
580
+ defaultClassNames.disabled
581
+ ),
582
+ hidden: chunkYV7RVYMD_cjs.cn("invisible", defaultClassNames.hidden),
583
+ ...classNames
584
+ },
585
+ components: {
586
+ Root: ({ className: className2, rootRef, ...props2 }) => {
587
+ return /* @__PURE__ */ jsxRuntime.jsx(
588
+ "div",
589
+ {
590
+ "data-slot": "calendar",
591
+ ref: rootRef,
592
+ className: chunkYV7RVYMD_cjs.cn(className2),
593
+ ...props2
594
+ }
595
+ );
596
+ },
597
+ Chevron: ({ className: className2, orientation, ...props2 }) => {
598
+ if (orientation === "left") {
599
+ return /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronLeftIcon, { className: chunkYV7RVYMD_cjs.cn("size-4", className2), ...props2 });
600
+ }
601
+ if (orientation === "right") {
602
+ return /* @__PURE__ */ jsxRuntime.jsx(
603
+ lucideReact.ChevronRightIcon,
604
+ {
605
+ className: chunkYV7RVYMD_cjs.cn("size-4", className2),
606
+ ...props2
607
+ }
608
+ );
609
+ }
610
+ return /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronDownIcon, { className: chunkYV7RVYMD_cjs.cn("size-4", className2), ...props2 });
611
+ },
612
+ DayButton: CalendarDayButton,
613
+ WeekNumber: ({ children, ...props2 }) => {
614
+ return /* @__PURE__ */ jsxRuntime.jsx("td", { ...props2, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex size-(--cell-size) items-center justify-center text-center", children }) });
615
+ },
616
+ ...components
617
+ },
618
+ ...props
619
+ }
620
+ );
621
+ }
622
+ function CalendarDayButton({
623
+ className,
624
+ day,
625
+ modifiers,
626
+ ...props
627
+ }) {
628
+ const defaultClassNames = reactDayPicker.getDefaultClassNames();
629
+ const ref = React4__namespace.useRef(null);
630
+ React4__namespace.useEffect(() => {
631
+ if (modifiers.focused) ref.current?.focus();
632
+ }, [modifiers.focused]);
633
+ return /* @__PURE__ */ jsxRuntime.jsx(
634
+ Button,
635
+ {
636
+ ref,
637
+ variant: "ghost",
638
+ size: "icon",
639
+ "data-day": day.date.toLocaleDateString(),
640
+ "data-selected-single": modifiers.selected && !modifiers.range_start && !modifiers.range_end && !modifiers.range_middle,
641
+ "data-range-start": modifiers.range_start,
642
+ "data-range-end": modifiers.range_end,
643
+ "data-range-middle": modifiers.range_middle,
644
+ className: chunkYV7RVYMD_cjs.cn(
645
+ "data-[selected-single=true]:bg-primary data-[selected-single=true]:text-primary-foreground data-[range-middle=true]:bg-accent data-[range-middle=true]:text-accent-foreground data-[range-start=true]:bg-primary data-[range-start=true]:text-primary-foreground data-[range-end=true]:bg-primary data-[range-end=true]:text-primary-foreground group-data-[focused=true]/day:border-ring group-data-[focused=true]/day:ring-ring/50 dark:hover:text-accent-foreground flex aspect-square size-auto w-full min-w-(--cell-size) flex-col gap-1 leading-none font-normal group-data-[focused=true]/day:relative group-data-[focused=true]/day:z-10 group-data-[focused=true]/day:ring-[3px] data-[range-end=true]:rounded-md data-[range-end=true]:rounded-r-md data-[range-middle=true]:rounded-none data-[range-start=true]:rounded-md data-[range-start=true]:rounded-l-md [&>span]:text-xs [&>span]:opacity-70",
646
+ defaultClassNames.day,
647
+ className
648
+ ),
649
+ ...props
650
+ }
651
+ );
652
+ }
653
+ function Popover({
654
+ ...props
655
+ }) {
656
+ return /* @__PURE__ */ jsxRuntime.jsx(PopoverPrimitive__namespace.Root, { "data-slot": "popover", ...props });
657
+ }
658
+ function PopoverTrigger({
659
+ ...props
660
+ }) {
661
+ return /* @__PURE__ */ jsxRuntime.jsx(PopoverPrimitive__namespace.Trigger, { "data-slot": "popover-trigger", ...props });
662
+ }
663
+ function PopoverContent({
664
+ className,
665
+ align = "center",
666
+ sideOffset = 4,
667
+ ...props
668
+ }) {
669
+ return /* @__PURE__ */ jsxRuntime.jsx(PopoverPrimitive__namespace.Portal, { children: /* @__PURE__ */ jsxRuntime.jsx(
670
+ PopoverPrimitive__namespace.Content,
671
+ {
672
+ "data-slot": "popover-content",
673
+ align,
674
+ sideOffset,
675
+ className: chunkYV7RVYMD_cjs.cn(
676
+ "bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=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 z-50 origin-(--radix-popover-content-transform-origin) rounded-md border p-4 shadow-md outline-hidden",
677
+ className
678
+ ),
679
+ ...props
680
+ }
681
+ ) });
682
+ }
683
+ var SmartDatePicker = ({
684
+ field,
685
+ label,
686
+ className = "",
687
+ placeholder,
688
+ validation,
689
+ required = false,
690
+ allowPast = true,
691
+ allowFuture = true,
692
+ valueAsString = true,
693
+ minDate,
694
+ maxDate,
695
+ defaultValue,
696
+ info,
697
+ subLabel
698
+ }) => {
699
+ const { value, error, onChange, fieldRef, registerValidation } = chunkYV7RVYMD_cjs.useFormField(field);
700
+ const fieldDetection = chunkYV7RVYMD_cjs.useFieldDetection();
701
+ const hasRegistered = React4.useRef(false);
702
+ const hasSetDefault = React4.useRef(false);
703
+ const parsedValue = React4.useMemo(() => {
704
+ if (!value) return void 0;
705
+ if (value instanceof Date) return value;
706
+ const d = new Date(value);
707
+ return isNaN(d.getTime()) ? void 0 : d;
708
+ }, [value]);
709
+ const [open, setOpen] = React4.useState(false);
710
+ React4.useEffect(() => {
711
+ if (validation && !hasRegistered.current) {
712
+ hasRegistered.current = true;
713
+ registerValidation(field, validation);
714
+ }
715
+ }, [validation, field, registerValidation]);
716
+ React4.useEffect(() => {
717
+ if (fieldDetection?.registerField) {
718
+ fieldDetection.registerField(field);
719
+ }
720
+ }, [field, fieldDetection]);
721
+ React4.useEffect(() => {
722
+ if (defaultValue !== void 0 && !hasSetDefault.current && (value === void 0 || value === null || value === "")) {
723
+ onChange(defaultValue);
724
+ hasSetDefault.current = true;
725
+ }
726
+ }, [defaultValue, value, onChange]);
727
+ const today = React4.useMemo(() => /* @__PURE__ */ new Date(), []);
728
+ const disabledMatcher = (date) => {
729
+ if (!allowPast) {
730
+ const startOfToday = new Date(today.getFullYear(), today.getMonth(), today.getDate());
731
+ if (date < startOfToday) return true;
732
+ }
733
+ if (!allowFuture) {
734
+ const startOfTomorrow = new Date(today.getFullYear(), today.getMonth(), today.getDate() + 1);
735
+ if (date >= startOfTomorrow) return true;
736
+ }
737
+ if (minDate && date < new Date(minDate.getFullYear(), minDate.getMonth(), minDate.getDate())) return true;
738
+ if (maxDate && date > new Date(maxDate.getFullYear(), maxDate.getMonth(), maxDate.getDate())) return true;
739
+ return false;
740
+ };
741
+ const handleSelect = (selected) => {
742
+ if (!selected) {
743
+ onChange(void 0);
744
+ return;
745
+ }
746
+ if (valueAsString) {
747
+ const iso = dateFns.format(selected, "yyyy-MM-dd");
748
+ onChange(iso);
749
+ } else {
750
+ onChange(selected);
751
+ }
752
+ setOpen(false);
753
+ };
754
+ const buttonText = React4.useMemo(() => {
755
+ if (!parsedValue) return placeholder || `Select ${label || field}`;
756
+ return dateFns.format(parsedValue, "dd/MM/yyyy");
757
+ }, [parsedValue, placeholder, label, field]);
758
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: chunkYV7RVYMD_cjs.cn("flex-1 min-w-0", className), children: [
759
+ label && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mb-2", children: [
760
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between gap-2", children: [
761
+ /* @__PURE__ */ jsxRuntime.jsxs(chunkYV7RVYMD_cjs.Label, { className: "text-sm font-medium text-foreground", children: [
762
+ label,
763
+ " ",
764
+ required && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-destructive", children: "*" })
765
+ ] }),
766
+ info && /* @__PURE__ */ jsxRuntime.jsx(chunkYV7RVYMD_cjs.TooltipProvider, { children: /* @__PURE__ */ jsxRuntime.jsxs(chunkYV7RVYMD_cjs.Tooltip, { children: [
767
+ /* @__PURE__ */ jsxRuntime.jsx(chunkYV7RVYMD_cjs.TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.InfoIcon, { className: "h-4 w-4 text-muted-foreground cursor-pointer mr-2" }) }),
768
+ /* @__PURE__ */ jsxRuntime.jsx(chunkYV7RVYMD_cjs.TooltipContent, { children: /* @__PURE__ */ jsxRuntime.jsx("p", { className: "max-w-xs", children: info }) })
769
+ ] }) })
770
+ ] }),
771
+ subLabel && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-muted-foreground mt-1", children: subLabel })
772
+ ] }),
773
+ /* @__PURE__ */ jsxRuntime.jsxs(Popover, { open, onOpenChange: setOpen, children: [
774
+ /* @__PURE__ */ jsxRuntime.jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(
775
+ Button,
776
+ {
777
+ ref: fieldRef,
778
+ variant: "outline",
779
+ className: chunkYV7RVYMD_cjs.cn(
780
+ "w-full justify-start text-left font-normal",
781
+ !parsedValue && "text-muted-foreground",
782
+ error && "border-destructive"
783
+ ),
784
+ "data-field": field,
785
+ children: [
786
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Calendar, { className: "mr-2 h-4 w-4" }),
787
+ buttonText
788
+ ]
789
+ }
790
+ ) }),
791
+ /* @__PURE__ */ jsxRuntime.jsx(PopoverContent, { className: "w-auto p-0", align: "start", children: /* @__PURE__ */ jsxRuntime.jsx(
792
+ Calendar,
793
+ {
794
+ mode: "single",
795
+ selected: parsedValue,
796
+ onSelect: handleSelect,
797
+ disabled: disabledMatcher,
798
+ initialFocus: true
799
+ }
800
+ ) })
801
+ ] }),
802
+ error && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-destructive text-sm mt-1", children: error })
803
+ ] });
804
+ };
805
+ var SmartTags = ({
806
+ field,
807
+ label,
808
+ className = "",
809
+ placeholder = "Type and press Enter...",
810
+ validation,
811
+ required = false,
812
+ maxTags,
813
+ defaultValue,
814
+ maxLength,
815
+ minLength,
816
+ allowDuplicates = false,
817
+ disabled = false,
818
+ onTagAdd,
819
+ onTagRemove,
820
+ info,
821
+ subLabel
822
+ }) => {
823
+ const { value, error, onChange, fieldRef, registerValidation } = chunkYV7RVYMD_cjs.useFormField(field);
824
+ const fieldDetection = chunkYV7RVYMD_cjs.useFieldDetection();
825
+ const hasRegistered = React4.useRef(false);
826
+ const hasSetDefault = React4.useRef(false);
827
+ const [tags, setTags] = React4.useState([]);
828
+ const [inputValue, setInputValue] = React4.useState("");
829
+ const inputRef = React4.useRef(null);
830
+ React4.useEffect(() => {
831
+ if (validation && !hasRegistered.current) {
832
+ hasRegistered.current = true;
833
+ registerValidation(field, validation);
834
+ }
835
+ }, [validation, field, registerValidation]);
836
+ React4.useEffect(() => {
837
+ if (fieldDetection?.registerField) {
838
+ fieldDetection.registerField(field);
839
+ }
840
+ }, [field, fieldDetection]);
841
+ React4.useEffect(() => {
842
+ if (defaultValue !== void 0 && !hasSetDefault.current && (!value || Array.isArray(value) && value.length === 0)) {
843
+ setTags(defaultValue);
844
+ onChange(defaultValue);
845
+ hasSetDefault.current = true;
846
+ }
847
+ }, [defaultValue, value, onChange]);
848
+ React4.useEffect(() => {
849
+ if (Array.isArray(value)) {
850
+ setTags(value);
851
+ }
852
+ }, [value]);
853
+ const addTag = (text) => {
854
+ const trimmedText = text.trim();
855
+ if (!trimmedText) return;
856
+ if (minLength && trimmedText.length < minLength) return;
857
+ if (maxLength && trimmedText.length > maxLength) return;
858
+ if (maxTags && tags.length >= maxTags) return;
859
+ if (!allowDuplicates && tags.some((tag) => tag.toLowerCase() === trimmedText.toLowerCase())) {
860
+ return;
861
+ }
862
+ const newTags = [...tags, trimmedText];
863
+ setTags(newTags);
864
+ onChange(newTags);
865
+ if (onTagAdd) {
866
+ onTagAdd(trimmedText);
867
+ }
868
+ };
869
+ const removeTag = (tagText) => {
870
+ const newTags = tags.filter((tag) => tag !== tagText);
871
+ setTags(newTags);
872
+ onChange(newTags);
873
+ if (onTagRemove) {
874
+ onTagRemove(tagText);
875
+ }
876
+ };
877
+ const handleKeyDown = (e) => {
878
+ if (e.key === "Enter" || e.key === ",") {
879
+ e.preventDefault();
880
+ addTag(inputValue);
881
+ setInputValue("");
882
+ } else if (e.key === "Backspace" && !inputValue && tags.length > 0) {
883
+ removeTag(tags[tags.length - 1]);
884
+ }
885
+ };
886
+ const handleInputChange = (e) => {
887
+ const value2 = e.target.value;
888
+ setInputValue(value2);
889
+ };
890
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `flex-1 min-w-0 ${className}`, children: [
891
+ label && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mb-2", children: [
892
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between gap-2", children: [
893
+ /* @__PURE__ */ jsxRuntime.jsxs(chunkYV7RVYMD_cjs.Label, { className: "text-sm font-medium text-foreground", children: [
894
+ label,
895
+ " ",
896
+ required && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-destructive", children: "*" }),
897
+ maxTags && /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "ml-2 text-xs text-muted-foreground", children: [
898
+ "(",
899
+ tags.length,
900
+ "/",
901
+ maxTags,
902
+ ")"
903
+ ] })
904
+ ] }),
905
+ info && /* @__PURE__ */ jsxRuntime.jsx(chunkYV7RVYMD_cjs.TooltipProvider, { children: /* @__PURE__ */ jsxRuntime.jsxs(chunkYV7RVYMD_cjs.Tooltip, { children: [
906
+ /* @__PURE__ */ jsxRuntime.jsx(chunkYV7RVYMD_cjs.TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.InfoIcon, { className: "h-4 w-4 text-muted-foreground cursor-pointer mr-2" }) }),
907
+ /* @__PURE__ */ jsxRuntime.jsx(chunkYV7RVYMD_cjs.TooltipContent, { children: /* @__PURE__ */ jsxRuntime.jsx("p", { className: "max-w-xs", children: info }) })
908
+ ] }) })
909
+ ] }),
910
+ subLabel && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-muted-foreground mt-1", children: subLabel })
911
+ ] }),
912
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "relative", children: /* @__PURE__ */ jsxRuntime.jsxs(
913
+ "div",
914
+ {
915
+ ref: fieldRef,
916
+ className: chunkYV7RVYMD_cjs.cn(
917
+ "min-h-[40px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background",
918
+ "focus-within:ring-2 focus-within:ring-ring focus-within:ring-offset-2",
919
+ "flex flex-wrap items-center gap-2 cursor-text",
920
+ error && "border-destructive focus-within:ring-destructive",
921
+ disabled && "cursor-not-allowed opacity-50"
922
+ ),
923
+ "data-field": field,
924
+ onClick: () => inputRef.current?.focus(),
925
+ children: [
926
+ tags.map((tagText, index) => /* @__PURE__ */ jsxRuntime.jsxs(
927
+ "div",
928
+ {
929
+ className: "inline-flex items-center gap-1 px-2 py-1 bg-primary text-primary-foreground rounded-md text-sm",
930
+ children: [
931
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: tagText }),
932
+ /* @__PURE__ */ jsxRuntime.jsx(
933
+ Button,
934
+ {
935
+ type: "button",
936
+ variant: "ghost",
937
+ size: "sm",
938
+ className: "h-4 w-4 p-0 hover:bg-primary-foreground/20 text-primary-foreground",
939
+ onClick: (e) => {
940
+ e.stopPropagation();
941
+ removeTag(tagText);
942
+ },
943
+ disabled,
944
+ children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, { className: "h-3 w-3" })
945
+ }
946
+ )
947
+ ]
948
+ },
949
+ `${tagText}-${index}`
950
+ )),
951
+ /* @__PURE__ */ jsxRuntime.jsx(
952
+ chunkYV7RVYMD_cjs.Input,
953
+ {
954
+ ref: inputRef,
955
+ type: "text",
956
+ value: inputValue,
957
+ onChange: handleInputChange,
958
+ onKeyDown: handleKeyDown,
959
+ placeholder: tags.length === 0 ? placeholder : "",
960
+ className: "flex-1 min-w-[120px] border-0 shadow-none focus-visible:ring-0 focus-visible:ring-offset-0 p-0 h-auto",
961
+ disabled,
962
+ maxLength
963
+ }
964
+ )
965
+ ]
966
+ }
967
+ ) }),
968
+ error && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-destructive text-sm mt-1", children: error })
969
+ ] });
970
+ };
971
+
972
+ exports.Button = Button;
973
+ exports.Popover = Popover;
974
+ exports.PopoverContent = PopoverContent;
975
+ exports.PopoverTrigger = PopoverTrigger;
976
+ exports.SmartCheckbox = SmartCheckbox;
977
+ exports.SmartDatePicker = SmartDatePicker;
978
+ exports.SmartRadioGroup = SmartRadioGroup;
979
+ exports.SmartSelect = SmartSelect;
980
+ exports.SmartTags = SmartTags;
981
+ //# sourceMappingURL=chunk-Y6NGPMDH.cjs.map
982
+ //# sourceMappingURL=chunk-Y6NGPMDH.cjs.map