@juanarenas31/metrik-ui 0.2.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.
package/dist/index.js ADDED
@@ -0,0 +1,2244 @@
1
+ import * as AccordionPrimitive from '@radix-ui/react-accordion';
2
+ import { ChevronDown, Loader2, Minus, Check, Plus, X, Search, ChevronsUpDown, Circle, ChevronRight, CalendarRange, UploadCloud, File, Upload, CalendarDays, ChevronUp, AlertOctagon, AlertTriangle, CheckCircle2, Info, ChevronLeft, Bold, Italic, Underline, List, ListOrdered, Link2, MoreHorizontal } from 'lucide-react';
3
+ import { forwardRef, useState, useId, createContext, useRef, useEffect, useContext, useCallback } from 'react';
4
+ import { clsx } from 'clsx';
5
+ import { twMerge } from 'tailwind-merge';
6
+ import { cva } from 'class-variance-authority';
7
+ export { cva } from 'class-variance-authority';
8
+ import { jsx, jsxs } from 'react/jsx-runtime';
9
+ import * as AlertDialogPrimitive from '@radix-ui/react-alert-dialog';
10
+ import * as AvatarPrimitive from '@radix-ui/react-avatar';
11
+ import { Slot } from '@radix-ui/react-slot';
12
+ import { DayPicker } from 'react-day-picker';
13
+ import { es } from 'react-day-picker/locale';
14
+ import * as CheckboxPrimitive from '@radix-ui/react-checkbox';
15
+ import * as CollapsiblePrimitive from '@radix-ui/react-collapsible';
16
+ import { Command as Command$1 } from 'cmdk';
17
+ import * as DialogPrimitive from '@radix-ui/react-dialog';
18
+ import * as PopoverPrimitive from '@radix-ui/react-popover';
19
+ import * as ContextMenuPrimitive from '@radix-ui/react-context-menu';
20
+ import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';
21
+ import * as LabelPrimitive from '@radix-ui/react-label';
22
+ import * as HoverCardPrimitive from '@radix-ui/react-hover-card';
23
+ import * as ProgressPrimitive from '@radix-ui/react-progress';
24
+ import * as RadioGroupPrimitive from '@radix-ui/react-radio-group';
25
+ import * as ScrollAreaPrimitive from '@radix-ui/react-scroll-area';
26
+ import * as SelectPrimitive from '@radix-ui/react-select';
27
+ import * as SeparatorPrimitive from '@radix-ui/react-separator';
28
+ import * as SliderPrimitive from '@radix-ui/react-slider';
29
+ import { Toaster as Toaster$1 } from 'sonner';
30
+ export { toast } from 'sonner';
31
+ import * as SwitchPrimitive from '@radix-ui/react-switch';
32
+ import * as TabsPrimitive from '@radix-ui/react-tabs';
33
+ import * as TogglePrimitive from '@radix-ui/react-toggle';
34
+ import * as ToggleGroupPrimitive from '@radix-ui/react-toggle-group';
35
+ import * as TooltipPrimitive from '@radix-ui/react-tooltip';
36
+ import * as VisuallyHiddenPrimitive from '@radix-ui/react-visually-hidden';
37
+
38
+ function cn(...inputs) {
39
+ return twMerge(clsx(inputs));
40
+ }
41
+ var Accordion = AccordionPrimitive.Root;
42
+ var AccordionItem = forwardRef(function AccordionItem2({ className, ...props }, ref) {
43
+ return /* @__PURE__ */ jsx(AccordionPrimitive.Item, { ref, className: cn("border-b border-border", className), ...props });
44
+ });
45
+ var AccordionTrigger = forwardRef(function AccordionTrigger2({ className, children, ...props }, ref) {
46
+ return /* @__PURE__ */ jsx(AccordionPrimitive.Header, { className: "flex", children: /* @__PURE__ */ jsxs(
47
+ AccordionPrimitive.Trigger,
48
+ {
49
+ ref,
50
+ className: cn(
51
+ "flex flex-1 items-center justify-between gap-4 py-4 text-left text-sm font-medium text-fg",
52
+ "transition-colors duration-fast hover:text-primary",
53
+ "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring rounded-sm",
54
+ "[&[data-state=open]>svg]:rotate-180",
55
+ className
56
+ ),
57
+ ...props,
58
+ children: [
59
+ children,
60
+ /* @__PURE__ */ jsx(ChevronDown, { className: "size-4 shrink-0 text-fg-muted transition-transform duration-base" })
61
+ ]
62
+ }
63
+ ) });
64
+ });
65
+ var AccordionContent = forwardRef(function AccordionContent2({ className, children, ...props }, ref) {
66
+ return /* @__PURE__ */ jsx(
67
+ AccordionPrimitive.Content,
68
+ {
69
+ ref,
70
+ className: cn(
71
+ "overflow-hidden text-sm text-fg-muted",
72
+ "data-[state=open]:animate-[metrik-acc-down_var(--metrik-duration-base)_var(--metrik-ease)]",
73
+ "data-[state=closed]:animate-[metrik-acc-up_var(--metrik-duration-base)_var(--metrik-ease)]"
74
+ ),
75
+ ...props,
76
+ children: /* @__PURE__ */ jsx("div", { className: cn("pb-4 pt-0", className), children })
77
+ }
78
+ );
79
+ });
80
+ if (typeof document !== "undefined" && !document.getElementById("metrik-accordion-anim")) {
81
+ const style = document.createElement("style");
82
+ style.id = "metrik-accordion-anim";
83
+ style.textContent = "@keyframes metrik-acc-down{from{height:0}to{height:var(--radix-accordion-content-height)}}@keyframes metrik-acc-up{from{height:var(--radix-accordion-content-height)}to{height:0}}";
84
+ document.head.appendChild(style);
85
+ }
86
+
87
+ // src/components/alert/alert.variants.ts
88
+ var alertVariants = cva(
89
+ [
90
+ "relative flex w-full gap-3 rounded-md border-l-4 px-4 py-3",
91
+ "text-sm",
92
+ "[&>svg]:size-5 [&>svg]:shrink-0 [&>svg]:mt-0.5"
93
+ ],
94
+ {
95
+ variants: {
96
+ tone: {
97
+ info: "border-fg-muted bg-surface-muted text-fg",
98
+ success: "border-success bg-success-soft text-fg",
99
+ warning: "border-warning bg-warning-soft text-fg",
100
+ danger: "border-danger bg-danger-soft text-fg"
101
+ }
102
+ },
103
+ defaultVariants: { tone: "info" }
104
+ }
105
+ );
106
+ var DEFAULT_ICONS = {
107
+ info: /* @__PURE__ */ jsx(Info, {}),
108
+ success: /* @__PURE__ */ jsx(CheckCircle2, {}),
109
+ warning: /* @__PURE__ */ jsx(AlertTriangle, {}),
110
+ danger: /* @__PURE__ */ jsx(AlertOctagon, {})
111
+ };
112
+ var Alert = forwardRef(function Alert2({ className, tone = "info", icon, children, ...props }, ref) {
113
+ const renderIcon = icon === false ? null : icon ?? DEFAULT_ICONS[tone ?? "info"];
114
+ return /* @__PURE__ */ jsxs("div", { ref, role: "alert", className: cn(alertVariants({ tone }), className), ...props, children: [
115
+ renderIcon,
116
+ /* @__PURE__ */ jsx("div", { className: "flex-1", children })
117
+ ] });
118
+ });
119
+ var AlertTitle = forwardRef(
120
+ function AlertTitle2({ className, ...props }, ref) {
121
+ return /* @__PURE__ */ jsx("div", { ref, className: cn("font-semibold leading-tight mb-1", className), ...props });
122
+ }
123
+ );
124
+ var AlertDescription = forwardRef(
125
+ function AlertDescription2({ className, ...props }, ref) {
126
+ return /* @__PURE__ */ jsx("div", { ref, className: cn("text-fg-muted leading-snug", className), ...props });
127
+ }
128
+ );
129
+
130
+ // src/components/button/button.variants.ts
131
+ var buttonVariants = cva(
132
+ [
133
+ "inline-flex items-center justify-center gap-2 whitespace-nowrap font-medium",
134
+ "rounded-md ring-offset-bg transition-colors duration-fast",
135
+ "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
136
+ "disabled:pointer-events-none disabled:opacity-50",
137
+ "[&_svg]:pointer-events-none [&_svg]:shrink-0"
138
+ ],
139
+ {
140
+ variants: {
141
+ variant: {
142
+ primary: "bg-primary text-primary-fg hover:bg-primary-hover",
143
+ secondary: "bg-surface-muted text-fg hover:bg-border",
144
+ outline: "border border-border-strong bg-transparent text-fg hover:bg-surface-muted",
145
+ ghost: "bg-transparent text-fg hover:bg-surface-muted",
146
+ danger: "bg-danger text-white hover:bg-coral-700",
147
+ link: "bg-transparent text-primary underline-offset-4 hover:underline"
148
+ },
149
+ size: {
150
+ sm: "h-8 px-3 text-xs [&_svg]:size-3.5",
151
+ md: "h-10 px-4 text-sm [&_svg]:size-4",
152
+ lg: "h-12 px-6 text-base [&_svg]:size-5",
153
+ icon: "size-10 [&_svg]:size-4"
154
+ },
155
+ fullWidth: { true: "w-full" }
156
+ },
157
+ defaultVariants: { variant: "primary", size: "md" }
158
+ }
159
+ );
160
+ var AlertDialog = AlertDialogPrimitive.Root;
161
+ var AlertDialogTrigger = AlertDialogPrimitive.Trigger;
162
+ var AlertDialogPortal = AlertDialogPrimitive.Portal;
163
+ var AlertDialogOverlay = forwardRef(function AlertDialogOverlay2({ className, ...props }, ref) {
164
+ return /* @__PURE__ */ jsx(
165
+ AlertDialogPrimitive.Overlay,
166
+ {
167
+ ref,
168
+ className: cn(
169
+ "fixed inset-0 z-overlay bg-slate-950/50 backdrop-blur-sm",
170
+ "data-[state=open]:animate-fade-in data-[state=closed]:animate-fade-out",
171
+ className
172
+ ),
173
+ ...props
174
+ }
175
+ );
176
+ });
177
+ var AlertDialogContent = forwardRef(function AlertDialogContent2({ className, ...props }, ref) {
178
+ return /* @__PURE__ */ jsxs(AlertDialogPortal, { children: [
179
+ /* @__PURE__ */ jsx(AlertDialogOverlay, {}),
180
+ /* @__PURE__ */ jsx(
181
+ AlertDialogPrimitive.Content,
182
+ {
183
+ ref,
184
+ className: cn(
185
+ "fixed left-1/2 top-1/2 z-modal w-full max-w-md -translate-x-1/2 -translate-y-1/2",
186
+ "rounded-lg border border-border bg-surface p-6 shadow-lg",
187
+ "data-[state=open]:animate-zoom-in data-[state=closed]:animate-zoom-out",
188
+ className
189
+ ),
190
+ ...props
191
+ }
192
+ )
193
+ ] });
194
+ });
195
+ function AlertDialogHeader({ className, ...props }) {
196
+ return /* @__PURE__ */ jsx("div", { className: cn("flex flex-col gap-2 text-center sm:text-left", className), ...props });
197
+ }
198
+ function AlertDialogFooter({ className, ...props }) {
199
+ return /* @__PURE__ */ jsx("div", { className: cn("mt-5 flex flex-col-reverse gap-2 sm:flex-row sm:justify-end", className), ...props });
200
+ }
201
+ var AlertDialogTitle = forwardRef(function AlertDialogTitle2({ className, ...props }, ref) {
202
+ return /* @__PURE__ */ jsx(AlertDialogPrimitive.Title, { ref, className: cn("text-lg font-semibold tracking-tight text-fg", className), ...props });
203
+ });
204
+ var AlertDialogDescription = forwardRef(function AlertDialogDescription2({ className, ...props }, ref) {
205
+ return /* @__PURE__ */ jsx(AlertDialogPrimitive.Description, { ref, className: cn("text-sm text-fg-muted", className), ...props });
206
+ });
207
+ var AlertDialogAction = forwardRef(function AlertDialogAction2({ className, ...props }, ref) {
208
+ return /* @__PURE__ */ jsx(AlertDialogPrimitive.Action, { ref, className: cn(buttonVariants(), className), ...props });
209
+ });
210
+ var AlertDialogCancel = forwardRef(function AlertDialogCancel2({ className, ...props }, ref) {
211
+ return /* @__PURE__ */ jsx(
212
+ AlertDialogPrimitive.Cancel,
213
+ {
214
+ ref,
215
+ className: cn(buttonVariants({ variant: "outline" }), className),
216
+ ...props
217
+ }
218
+ );
219
+ });
220
+ var avatarVariants = cva(
221
+ "relative flex shrink-0 overflow-hidden rounded-full bg-surface-muted text-fg-muted",
222
+ {
223
+ variants: {
224
+ size: {
225
+ sm: "size-6 text-[10px]",
226
+ md: "size-9 text-xs",
227
+ lg: "size-12 text-sm",
228
+ xl: "size-16 text-base"
229
+ }
230
+ },
231
+ defaultVariants: { size: "md" }
232
+ }
233
+ );
234
+ var Avatar = forwardRef(
235
+ function Avatar2({ className, size, ...props }, ref) {
236
+ return /* @__PURE__ */ jsx(AvatarPrimitive.Root, { ref, className: cn(avatarVariants({ size }), className), ...props });
237
+ }
238
+ );
239
+ var AvatarImage = forwardRef(function AvatarImage2({ className, ...props }, ref) {
240
+ return /* @__PURE__ */ jsx(AvatarPrimitive.Image, { ref, className: cn("aspect-square size-full object-cover", className), ...props });
241
+ });
242
+ var AvatarFallback = forwardRef(function AvatarFallback2({ className, ...props }, ref) {
243
+ return /* @__PURE__ */ jsx(
244
+ AvatarPrimitive.Fallback,
245
+ {
246
+ ref,
247
+ className: cn("flex size-full items-center justify-center font-semibold uppercase", className),
248
+ ...props
249
+ }
250
+ );
251
+ });
252
+
253
+ // src/components/badge/badge.variants.ts
254
+ var badgeVariants = cva(
255
+ [
256
+ "inline-flex items-center gap-1.5 rounded-full px-2.5 py-0.5",
257
+ "text-xs font-semibold tracking-wide",
258
+ "transition-colors duration-fast"
259
+ ],
260
+ {
261
+ variants: {
262
+ tone: {
263
+ neutral: "bg-surface-muted text-fg-muted",
264
+ primary: "bg-primary-soft text-primary",
265
+ accent: "bg-accent-soft text-accent",
266
+ success: "bg-success-soft text-success",
267
+ danger: "bg-danger-soft text-danger",
268
+ warning: "bg-warning-soft text-warning",
269
+ solid: "bg-fg text-bg"
270
+ },
271
+ size: {
272
+ sm: "h-5 px-2 text-[10px]",
273
+ md: "h-6 px-2.5 text-xs",
274
+ lg: "h-7 px-3 text-sm"
275
+ },
276
+ dot: { true: "pl-2" }
277
+ },
278
+ defaultVariants: { tone: "neutral", size: "md" }
279
+ }
280
+ );
281
+ var Badge = forwardRef(function Badge2({ className, tone, size, dot, children, ...props }, ref) {
282
+ return /* @__PURE__ */ jsxs("span", { ref, className: cn(badgeVariants({ tone, size, dot }), className), ...props, children: [
283
+ dot ? /* @__PURE__ */ jsx("span", { className: "size-1.5 rounded-full bg-current", "aria-hidden": true }) : null,
284
+ children
285
+ ] });
286
+ });
287
+ var Breadcrumb = forwardRef(
288
+ function Breadcrumb2(props, ref) {
289
+ return /* @__PURE__ */ jsx("nav", { ref, "aria-label": "breadcrumb", ...props });
290
+ }
291
+ );
292
+ var BreadcrumbList = forwardRef(
293
+ function BreadcrumbList2({ className, ...props }, ref) {
294
+ return /* @__PURE__ */ jsx(
295
+ "ol",
296
+ {
297
+ ref,
298
+ className: cn("flex flex-wrap items-center gap-1.5 text-sm text-fg-muted", className),
299
+ ...props
300
+ }
301
+ );
302
+ }
303
+ );
304
+ var BreadcrumbItem = forwardRef(
305
+ function BreadcrumbItem2({ className, ...props }, ref) {
306
+ return /* @__PURE__ */ jsx("li", { ref, className: cn("inline-flex items-center gap-1.5", className), ...props });
307
+ }
308
+ );
309
+ var BreadcrumbLink = forwardRef(function BreadcrumbLink2({ className, asChild, ...props }, ref) {
310
+ const Comp = asChild ? Slot : "a";
311
+ return /* @__PURE__ */ jsx(
312
+ Comp,
313
+ {
314
+ ref,
315
+ className: cn("transition-colors duration-fast hover:text-fg", className),
316
+ ...props
317
+ }
318
+ );
319
+ });
320
+ var BreadcrumbPage = forwardRef(
321
+ function BreadcrumbPage2({ className, ...props }, ref) {
322
+ return /* @__PURE__ */ jsx(
323
+ "span",
324
+ {
325
+ ref,
326
+ role: "link",
327
+ "aria-disabled": "true",
328
+ "aria-current": "page",
329
+ className: cn("font-medium text-fg", className),
330
+ ...props
331
+ }
332
+ );
333
+ }
334
+ );
335
+ function BreadcrumbSeparator({ children, className, ...props }) {
336
+ return /* @__PURE__ */ jsx("li", { role: "presentation", "aria-hidden": true, className: cn("[&>svg]:size-3.5", className), ...props, children: children ?? /* @__PURE__ */ jsx(ChevronRight, {}) });
337
+ }
338
+ function BreadcrumbEllipsis({ className, ...props }) {
339
+ return /* @__PURE__ */ jsxs("span", { role: "presentation", "aria-hidden": true, className: cn("flex size-9 items-center justify-center", className), ...props, children: [
340
+ /* @__PURE__ */ jsx(MoreHorizontal, { className: "size-4" }),
341
+ /* @__PURE__ */ jsx("span", { className: "sr-only", children: "M\xE1s" })
342
+ ] });
343
+ }
344
+ var Button = forwardRef(function Button2({ className, variant, size, fullWidth, asChild, loading, leftIcon, rightIcon, disabled, children, ...props }, ref) {
345
+ const Comp = asChild ? Slot : "button";
346
+ return /* @__PURE__ */ jsxs(
347
+ Comp,
348
+ {
349
+ ref,
350
+ className: cn(buttonVariants({ variant, size, fullWidth }), className),
351
+ disabled: disabled || loading,
352
+ "data-loading": loading || void 0,
353
+ ...props,
354
+ children: [
355
+ loading ? /* @__PURE__ */ jsx(Loader2, { className: "animate-spin", "aria-hidden": true }) : leftIcon,
356
+ children,
357
+ !loading && rightIcon
358
+ ]
359
+ }
360
+ );
361
+ });
362
+ function Calendar({ className, classNames, showOutsideDays = true, ...props }) {
363
+ return /* @__PURE__ */ jsx(
364
+ DayPicker,
365
+ {
366
+ locale: es,
367
+ showOutsideDays,
368
+ className: cn("p-3", className),
369
+ classNames: {
370
+ months: "relative flex flex-col gap-4 sm:flex-row",
371
+ month: "flex w-full flex-col gap-4",
372
+ month_caption: "flex h-9 items-center justify-center px-9",
373
+ caption_label: "text-sm font-medium capitalize",
374
+ nav: "absolute inset-x-0 top-0 flex items-center justify-between",
375
+ button_previous: cn(
376
+ buttonVariants({ variant: "outline", size: "icon" }),
377
+ "size-7 bg-transparent p-0 opacity-70 hover:opacity-100"
378
+ ),
379
+ button_next: cn(
380
+ buttonVariants({ variant: "outline", size: "icon" }),
381
+ "size-7 bg-transparent p-0 opacity-70 hover:opacity-100"
382
+ ),
383
+ month_grid: "w-full border-collapse",
384
+ weekdays: "flex",
385
+ weekday: "w-9 text-[11px] font-normal uppercase tracking-wide text-fg-subtle",
386
+ week: "mt-1 flex w-full",
387
+ day: cn(
388
+ "relative size-9 p-0 text-center text-sm",
389
+ "[&:has([aria-selected])]:bg-primary-soft",
390
+ "[&:has([aria-selected].day-range-end)]:rounded-r-md",
391
+ "first:[&:has([aria-selected])]:rounded-l-md last:[&:has([aria-selected])]:rounded-r-md"
392
+ ),
393
+ day_button: cn(
394
+ buttonVariants({ variant: "ghost", size: "icon" }),
395
+ "size-9 rounded-md p-0 font-normal aria-selected:opacity-100"
396
+ ),
397
+ range_start: "day-range-start rounded-l-md bg-primary text-primary-fg hover:bg-primary",
398
+ range_end: "day-range-end rounded-r-md bg-primary text-primary-fg hover:bg-primary",
399
+ range_middle: "rounded-none bg-primary-soft text-primary aria-selected:bg-primary-soft aria-selected:text-primary",
400
+ selected: "rounded-md bg-primary text-primary-fg hover:bg-primary hover:text-primary-fg focus:bg-primary",
401
+ today: "rounded-md bg-surface-muted font-semibold text-primary",
402
+ outside: "text-fg-subtle opacity-50",
403
+ disabled: "text-fg-subtle opacity-40",
404
+ hidden: "invisible",
405
+ ...classNames
406
+ },
407
+ components: {
408
+ Chevron: ({ orientation, className: chevClass }) => orientation === "left" ? /* @__PURE__ */ jsx(ChevronLeft, { className: cn("size-4", chevClass) }) : /* @__PURE__ */ jsx(ChevronRight, { className: cn("size-4", chevClass) })
409
+ },
410
+ ...props
411
+ }
412
+ );
413
+ }
414
+ var Card = forwardRef(function Card2({ className, ...props }, ref) {
415
+ return /* @__PURE__ */ jsx(
416
+ "div",
417
+ {
418
+ ref,
419
+ className: cn(
420
+ "rounded-lg border border-border bg-surface text-fg shadow-xs",
421
+ "transition-shadow duration-fast",
422
+ className
423
+ ),
424
+ ...props
425
+ }
426
+ );
427
+ });
428
+ var CardHeader = forwardRef(function CardHeader2({ className, ...props }, ref) {
429
+ return /* @__PURE__ */ jsx("div", { ref, className: cn("flex flex-col gap-1.5 p-5", className), ...props });
430
+ });
431
+ var CardTitle = forwardRef(function CardTitle2({ className, ...props }, ref) {
432
+ return /* @__PURE__ */ jsx(
433
+ "div",
434
+ {
435
+ ref,
436
+ className: cn("text-base font-semibold leading-tight tracking-tight", className),
437
+ ...props
438
+ }
439
+ );
440
+ });
441
+ var CardDescription = forwardRef(function CardDescription2({ className, ...props }, ref) {
442
+ return /* @__PURE__ */ jsx("div", { ref, className: cn("text-sm text-fg-muted", className), ...props });
443
+ });
444
+ var CardContent = forwardRef(function CardContent2({ className, ...props }, ref) {
445
+ return /* @__PURE__ */ jsx("div", { ref, className: cn("px-5 pb-5", className), ...props });
446
+ });
447
+ var CardFooter = forwardRef(function CardFooter2({ className, ...props }, ref) {
448
+ return /* @__PURE__ */ jsx(
449
+ "div",
450
+ {
451
+ ref,
452
+ className: cn("flex items-center gap-2 border-t border-border px-5 py-4", className),
453
+ ...props
454
+ }
455
+ );
456
+ });
457
+ var Checkbox = forwardRef(
458
+ function Checkbox2({ className, ...props }, ref) {
459
+ return /* @__PURE__ */ jsx(
460
+ CheckboxPrimitive.Root,
461
+ {
462
+ ref,
463
+ className: cn(
464
+ "peer size-[18px] shrink-0 rounded border-2 border-border-strong bg-surface",
465
+ "transition-colors duration-fast",
466
+ "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-bg",
467
+ "disabled:cursor-not-allowed disabled:opacity-50",
468
+ "data-[state=checked]:bg-primary data-[state=checked]:border-primary data-[state=checked]:text-primary-fg",
469
+ "data-[state=indeterminate]:bg-primary data-[state=indeterminate]:border-primary data-[state=indeterminate]:text-primary-fg",
470
+ className
471
+ ),
472
+ ...props,
473
+ children: /* @__PURE__ */ jsx(CheckboxPrimitive.Indicator, { className: "flex items-center justify-center text-current", children: props.checked === "indeterminate" ? /* @__PURE__ */ jsx(Minus, { className: "size-3", strokeWidth: 3 }) : /* @__PURE__ */ jsx(Check, { className: "size-3", strokeWidth: 3 }) })
474
+ }
475
+ );
476
+ }
477
+ );
478
+ var ChipSelector = forwardRef(function ChipSelector2({ options, value, onValueChange, allowEmpty = true, className, ...props }, ref) {
479
+ const toggle = (v) => {
480
+ const has = value.includes(v);
481
+ if (has && !allowEmpty && value.length === 1) return;
482
+ onValueChange(has ? value.filter((x) => x !== v) : [...value, v]);
483
+ };
484
+ return /* @__PURE__ */ jsx("div", { ref, role: "group", className: cn("flex flex-wrap gap-2", className), ...props, children: options.map((opt) => {
485
+ const on = value.includes(opt.value);
486
+ return /* @__PURE__ */ jsxs(
487
+ "button",
488
+ {
489
+ type: "button",
490
+ "aria-pressed": on,
491
+ onClick: () => toggle(opt.value),
492
+ className: cn(
493
+ "inline-flex items-center gap-1.5 rounded-full border px-3 py-1 text-sm font-medium",
494
+ "transition-colors duration-fast focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-bg",
495
+ on ? "border-primary bg-primary-soft text-primary" : "border-border-strong bg-surface text-fg-muted hover:bg-surface-muted hover:text-fg"
496
+ ),
497
+ children: [
498
+ on ? /* @__PURE__ */ jsx(Check, { className: "size-3.5" }) : /* @__PURE__ */ jsx(Plus, { className: "size-3.5 opacity-60" }),
499
+ opt.label,
500
+ on && /* @__PURE__ */ jsx(X, { className: "size-3 opacity-50" })
501
+ ]
502
+ },
503
+ opt.value
504
+ );
505
+ }) });
506
+ });
507
+ var Collapsible = CollapsiblePrimitive.Root;
508
+ var CollapsibleTrigger = CollapsiblePrimitive.Trigger;
509
+ var CollapsibleContent = forwardRef(function CollapsibleContent2({ className, children, ...props }, ref) {
510
+ return /* @__PURE__ */ jsx(
511
+ CollapsiblePrimitive.Content,
512
+ {
513
+ ref,
514
+ className: cn(
515
+ "overflow-hidden",
516
+ "data-[state=open]:animate-[metrik-collapse-down_var(--metrik-duration-base)_var(--metrik-ease)]",
517
+ "data-[state=closed]:animate-[metrik-collapse-up_var(--metrik-duration-base)_var(--metrik-ease)]",
518
+ className
519
+ ),
520
+ ...props,
521
+ children
522
+ }
523
+ );
524
+ });
525
+ if (typeof document !== "undefined" && !document.getElementById("metrik-collapsible-anim")) {
526
+ const style = document.createElement("style");
527
+ style.id = "metrik-collapsible-anim";
528
+ style.textContent = "@keyframes metrik-collapse-down{from{height:0}to{height:var(--radix-collapsible-content-height)}}@keyframes metrik-collapse-up{from{height:var(--radix-collapsible-content-height)}to{height:0}}";
529
+ document.head.appendChild(style);
530
+ }
531
+ var Dialog = DialogPrimitive.Root;
532
+ var DialogTrigger = DialogPrimitive.Trigger;
533
+ var DialogClose = DialogPrimitive.Close;
534
+ var DialogPortal = DialogPrimitive.Portal;
535
+ var DialogOverlay = forwardRef(function DialogOverlay2({ className, ...props }, ref) {
536
+ return /* @__PURE__ */ jsx(
537
+ DialogPrimitive.Overlay,
538
+ {
539
+ ref,
540
+ className: cn(
541
+ "fixed inset-0 z-overlay bg-slate-950/50 backdrop-blur-sm",
542
+ "data-[state=open]:animate-fade-in data-[state=closed]:animate-fade-out",
543
+ className
544
+ ),
545
+ ...props
546
+ }
547
+ );
548
+ });
549
+ var DialogContent = forwardRef(function DialogContent2({ className, hideCloseButton, children, ...props }, ref) {
550
+ return /* @__PURE__ */ jsxs(DialogPortal, { children: [
551
+ /* @__PURE__ */ jsx(DialogOverlay, {}),
552
+ /* @__PURE__ */ jsxs(
553
+ DialogPrimitive.Content,
554
+ {
555
+ ref,
556
+ className: cn(
557
+ "fixed left-1/2 top-1/2 z-modal w-full max-w-lg -translate-x-1/2 -translate-y-1/2",
558
+ "rounded-lg border border-border bg-surface p-6 shadow-lg",
559
+ "data-[state=open]:animate-zoom-in data-[state=closed]:animate-zoom-out",
560
+ "focus:outline-none",
561
+ className
562
+ ),
563
+ ...props,
564
+ children: [
565
+ children,
566
+ !hideCloseButton ? /* @__PURE__ */ jsx(
567
+ DialogPrimitive.Close,
568
+ {
569
+ "aria-label": "Cerrar",
570
+ className: cn(
571
+ "absolute right-4 top-4 rounded-sm p-1 text-fg-muted opacity-70",
572
+ "transition-opacity hover:opacity-100",
573
+ "focus:outline-none focus-visible:ring-2 focus-visible:ring-ring"
574
+ ),
575
+ children: /* @__PURE__ */ jsx(X, { className: "size-4" })
576
+ }
577
+ ) : null
578
+ ]
579
+ }
580
+ )
581
+ ] });
582
+ });
583
+ function DialogHeader({ className, ...props }) {
584
+ return /* @__PURE__ */ jsx("div", { className: cn("flex flex-col gap-1.5 pb-4", className), ...props });
585
+ }
586
+ function DialogFooter({ className, ...props }) {
587
+ return /* @__PURE__ */ jsx(
588
+ "div",
589
+ {
590
+ className: cn("flex flex-col-reverse gap-2 pt-4 sm:flex-row sm:justify-end", className),
591
+ ...props
592
+ }
593
+ );
594
+ }
595
+ var DialogTitle = forwardRef(function DialogTitle2({ className, ...props }, ref) {
596
+ return /* @__PURE__ */ jsx(
597
+ DialogPrimitive.Title,
598
+ {
599
+ ref,
600
+ className: cn("text-lg font-semibold leading-tight tracking-tight", className),
601
+ ...props
602
+ }
603
+ );
604
+ });
605
+ var DialogDescription = forwardRef(function DialogDescription2({ className, ...props }, ref) {
606
+ return /* @__PURE__ */ jsx(
607
+ DialogPrimitive.Description,
608
+ {
609
+ ref,
610
+ className: cn("text-sm text-fg-muted", className),
611
+ ...props
612
+ }
613
+ );
614
+ });
615
+ var Command = forwardRef(function Command2({ className, ...props }, ref) {
616
+ return /* @__PURE__ */ jsx(
617
+ Command$1,
618
+ {
619
+ ref,
620
+ className: cn(
621
+ "flex size-full flex-col overflow-hidden rounded-md bg-surface-elev text-fg",
622
+ className
623
+ ),
624
+ ...props
625
+ }
626
+ );
627
+ });
628
+ function CommandDialog({
629
+ children,
630
+ ...props
631
+ }) {
632
+ return /* @__PURE__ */ jsx(Dialog, { ...props, children: /* @__PURE__ */ jsx(DialogContent, { className: "overflow-hidden p-0", children: /* @__PURE__ */ jsx(Command, { className: "[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-fg-subtle [&_[cmdk-input-wrapper]_svg]:size-4 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-2.5", children }) }) });
633
+ }
634
+ var CommandInput = forwardRef(function CommandInput2({ className, ...props }, ref) {
635
+ return /* @__PURE__ */ jsxs("div", { className: "flex items-center border-b border-border px-3", "cmdk-input-wrapper": "", children: [
636
+ /* @__PURE__ */ jsx(Search, { className: "mr-2 size-4 shrink-0 text-fg-subtle" }),
637
+ /* @__PURE__ */ jsx(
638
+ Command$1.Input,
639
+ {
640
+ ref,
641
+ className: cn(
642
+ "flex h-11 w-full bg-transparent py-3 text-sm outline-none placeholder:text-fg-subtle",
643
+ "disabled:cursor-not-allowed disabled:opacity-50",
644
+ className
645
+ ),
646
+ ...props
647
+ }
648
+ )
649
+ ] });
650
+ });
651
+ var CommandList = forwardRef(function CommandList2({ className, ...props }, ref) {
652
+ return /* @__PURE__ */ jsx(
653
+ Command$1.List,
654
+ {
655
+ ref,
656
+ className: cn("max-h-[300px] overflow-y-auto overflow-x-hidden p-1", className),
657
+ ...props
658
+ }
659
+ );
660
+ });
661
+ var CommandEmpty = forwardRef(function CommandEmpty2(props, ref) {
662
+ return /* @__PURE__ */ jsx(Command$1.Empty, { ref, className: "py-6 text-center text-sm text-fg-muted", ...props });
663
+ });
664
+ var CommandGroup = forwardRef(function CommandGroup2({ className, ...props }, ref) {
665
+ return /* @__PURE__ */ jsx(
666
+ Command$1.Group,
667
+ {
668
+ ref,
669
+ className: cn(
670
+ "overflow-hidden p-1 text-fg",
671
+ "[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-[10px] [&_[cmdk-group-heading]]:uppercase [&_[cmdk-group-heading]]:tracking-wider [&_[cmdk-group-heading]]:text-fg-subtle",
672
+ className
673
+ ),
674
+ ...props
675
+ }
676
+ );
677
+ });
678
+ var CommandSeparator = forwardRef(function CommandSeparator2({ className, ...props }, ref) {
679
+ return /* @__PURE__ */ jsx(Command$1.Separator, { ref, className: cn("-mx-1 my-1 h-px bg-border", className), ...props });
680
+ });
681
+ var CommandItem = forwardRef(function CommandItem2({ className, ...props }, ref) {
682
+ return /* @__PURE__ */ jsx(
683
+ Command$1.Item,
684
+ {
685
+ ref,
686
+ className: cn(
687
+ "relative flex cursor-pointer select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none",
688
+ "data-[selected=true]:bg-primary-soft data-[selected=true]:text-primary",
689
+ "data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50",
690
+ "[&_svg]:size-4 [&_svg]:shrink-0",
691
+ className
692
+ ),
693
+ ...props
694
+ }
695
+ );
696
+ });
697
+ function CommandShortcut({ className, ...props }) {
698
+ return /* @__PURE__ */ jsx("span", { className: cn("ml-auto text-[11px] tracking-widest text-fg-subtle", className), ...props });
699
+ }
700
+ var Popover = PopoverPrimitive.Root;
701
+ var PopoverTrigger = PopoverPrimitive.Trigger;
702
+ var PopoverAnchor = PopoverPrimitive.Anchor;
703
+ var PopoverContent = forwardRef(function PopoverContent2({ className, align = "center", sideOffset = 6, ...props }, ref) {
704
+ return /* @__PURE__ */ jsx(PopoverPrimitive.Portal, { children: /* @__PURE__ */ jsx(
705
+ PopoverPrimitive.Content,
706
+ {
707
+ ref,
708
+ align,
709
+ sideOffset,
710
+ className: cn(
711
+ "z-dropdown w-72 rounded-md border border-border bg-surface-elev p-4 text-fg shadow-md outline-none",
712
+ "data-[state=open]:animate-zoom-in data-[state=closed]:animate-zoom-out",
713
+ className
714
+ ),
715
+ ...props
716
+ }
717
+ ) });
718
+ });
719
+ var Combobox = forwardRef(function Combobox2({
720
+ options,
721
+ value,
722
+ onValueChange,
723
+ placeholder = "Selecciona\u2026",
724
+ searchPlaceholder = "Buscar\u2026",
725
+ emptyText = "Sin resultados.",
726
+ disabled,
727
+ className
728
+ }, ref) {
729
+ const [open, setOpen] = useState(false);
730
+ const selected = options.find((o) => o.value === value);
731
+ return /* @__PURE__ */ jsxs(Popover, { open, onOpenChange: setOpen, children: [
732
+ /* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
733
+ Button,
734
+ {
735
+ ref,
736
+ variant: "outline",
737
+ role: "combobox",
738
+ "aria-expanded": open,
739
+ disabled,
740
+ className: cn("w-full justify-between font-normal", !selected && "text-fg-subtle", className),
741
+ children: [
742
+ selected ? selected.label : placeholder,
743
+ /* @__PURE__ */ jsx(ChevronsUpDown, { className: "ml-2 size-4 shrink-0 opacity-50" })
744
+ ]
745
+ }
746
+ ) }),
747
+ /* @__PURE__ */ jsx(PopoverContent, { className: "w-[var(--radix-popover-trigger-width)] p-0", align: "start", children: /* @__PURE__ */ jsxs(Command, { children: [
748
+ /* @__PURE__ */ jsx(CommandInput, { placeholder: searchPlaceholder }),
749
+ /* @__PURE__ */ jsxs(CommandList, { children: [
750
+ /* @__PURE__ */ jsx(CommandEmpty, { children: emptyText }),
751
+ /* @__PURE__ */ jsx(CommandGroup, { children: options.map((opt) => /* @__PURE__ */ jsxs(
752
+ CommandItem,
753
+ {
754
+ value: opt.label,
755
+ onSelect: () => {
756
+ onValueChange?.(opt.value === value ? "" : opt.value);
757
+ setOpen(false);
758
+ },
759
+ children: [
760
+ /* @__PURE__ */ jsx(Check, { className: cn("mr-1 size-4", opt.value === value ? "opacity-100 text-primary" : "opacity-0") }),
761
+ opt.label
762
+ ]
763
+ },
764
+ opt.value
765
+ )) })
766
+ ] })
767
+ ] }) })
768
+ ] });
769
+ });
770
+ var ContextMenu = ContextMenuPrimitive.Root;
771
+ var ContextMenuTrigger = ContextMenuPrimitive.Trigger;
772
+ var ContextMenuGroup = ContextMenuPrimitive.Group;
773
+ var ContextMenuPortal = ContextMenuPrimitive.Portal;
774
+ var ContextMenuSub = ContextMenuPrimitive.Sub;
775
+ var ContextMenuRadioGroup = ContextMenuPrimitive.RadioGroup;
776
+ var menuSurface = cn(
777
+ "z-dropdown min-w-[10rem] overflow-hidden rounded-md border border-border bg-surface-elev p-1 text-fg shadow-md",
778
+ "data-[state=open]:animate-zoom-in data-[state=closed]:animate-zoom-out"
779
+ );
780
+ var itemBase = cn(
781
+ "relative flex cursor-pointer select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none",
782
+ "data-[highlighted]:bg-primary-soft data-[highlighted]:text-primary",
783
+ "data-[disabled]:pointer-events-none data-[disabled]:opacity-50"
784
+ );
785
+ var ContextMenuContent = forwardRef(function ContextMenuContent2({ className, ...props }, ref) {
786
+ return /* @__PURE__ */ jsx(ContextMenuPrimitive.Portal, { children: /* @__PURE__ */ jsx(ContextMenuPrimitive.Content, { ref, className: cn(menuSurface, className), ...props }) });
787
+ });
788
+ var ContextMenuItem = forwardRef(function ContextMenuItem2({ className, inset, destructive, ...props }, ref) {
789
+ return /* @__PURE__ */ jsx(
790
+ ContextMenuPrimitive.Item,
791
+ {
792
+ ref,
793
+ className: cn(
794
+ itemBase,
795
+ inset && "pl-8",
796
+ destructive && "data-[highlighted]:bg-danger-soft data-[highlighted]:text-danger",
797
+ className
798
+ ),
799
+ ...props
800
+ }
801
+ );
802
+ });
803
+ var ContextMenuCheckboxItem = forwardRef(function ContextMenuCheckboxItem2({ className, children, checked, ...props }, ref) {
804
+ return /* @__PURE__ */ jsxs(
805
+ ContextMenuPrimitive.CheckboxItem,
806
+ {
807
+ ref,
808
+ checked,
809
+ className: cn(itemBase, "pl-8", className),
810
+ ...props,
811
+ children: [
812
+ /* @__PURE__ */ jsx("span", { className: "absolute left-2 flex size-4 items-center justify-center", children: /* @__PURE__ */ jsx(ContextMenuPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx(Check, { className: "size-4 text-primary" }) }) }),
813
+ children
814
+ ]
815
+ }
816
+ );
817
+ });
818
+ var ContextMenuRadioItem = forwardRef(function ContextMenuRadioItem2({ className, children, ...props }, ref) {
819
+ return /* @__PURE__ */ jsxs(ContextMenuPrimitive.RadioItem, { ref, className: cn(itemBase, "pl-8", className), ...props, children: [
820
+ /* @__PURE__ */ jsx("span", { className: "absolute left-2 flex size-4 items-center justify-center", children: /* @__PURE__ */ jsx(ContextMenuPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx(Circle, { className: "size-2 fill-current text-primary" }) }) }),
821
+ children
822
+ ] });
823
+ });
824
+ var ContextMenuLabel = forwardRef(function ContextMenuLabel2({ className, inset, ...props }, ref) {
825
+ return /* @__PURE__ */ jsx(
826
+ ContextMenuPrimitive.Label,
827
+ {
828
+ ref,
829
+ className: cn("px-2 py-1.5 text-[10px] uppercase tracking-wider text-fg-subtle", inset && "pl-8", className),
830
+ ...props
831
+ }
832
+ );
833
+ });
834
+ var ContextMenuSeparator = forwardRef(function ContextMenuSeparator2({ className, ...props }, ref) {
835
+ return /* @__PURE__ */ jsx(ContextMenuPrimitive.Separator, { ref, className: cn("-mx-1 my-1 h-px bg-border", className), ...props });
836
+ });
837
+ function ContextMenuShortcut({ className, ...props }) {
838
+ return /* @__PURE__ */ jsx("span", { className: cn("ml-auto text-[11px] tracking-widest text-fg-subtle", className), ...props });
839
+ }
840
+ var ContextMenuSubTrigger = forwardRef(function ContextMenuSubTrigger2({ className, inset, children, ...props }, ref) {
841
+ return /* @__PURE__ */ jsxs(
842
+ ContextMenuPrimitive.SubTrigger,
843
+ {
844
+ ref,
845
+ className: cn(itemBase, "data-[state=open]:bg-primary-soft", inset && "pl-8", className),
846
+ ...props,
847
+ children: [
848
+ children,
849
+ /* @__PURE__ */ jsx(ChevronRight, { className: "ml-auto size-4" })
850
+ ]
851
+ }
852
+ );
853
+ });
854
+ var ContextMenuSubContent = forwardRef(function ContextMenuSubContent2({ className, ...props }, ref) {
855
+ return /* @__PURE__ */ jsx(ContextMenuPrimitive.SubContent, { ref, className: cn(menuSurface, className), ...props });
856
+ });
857
+ function fmt(d) {
858
+ return d.toLocaleDateString("es", { day: "2-digit", month: "short" });
859
+ }
860
+ var DateRangePill = forwardRef(function DateRangePill2({ value, onValueChange, placeholder = "Periodo", disabled, numberOfMonths = 2, className }, ref) {
861
+ const hasRange = !!value?.from;
862
+ const label = hasRange ? value.to ? `${fmt(value.from)} \u2013 ${fmt(value.to)}` : fmt(value.from) : placeholder;
863
+ return /* @__PURE__ */ jsxs(Popover, { children: [
864
+ /* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
865
+ "button",
866
+ {
867
+ ref,
868
+ type: "button",
869
+ disabled,
870
+ className: cn(
871
+ "inline-flex items-center gap-2 rounded-full border px-3.5 py-1.5 text-sm font-medium",
872
+ "transition-colors duration-fast focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-bg",
873
+ "disabled:cursor-not-allowed disabled:opacity-50",
874
+ hasRange ? "border-primary bg-primary-soft text-primary" : "border-border-strong bg-surface text-fg-muted hover:bg-surface-muted",
875
+ className
876
+ ),
877
+ children: [
878
+ /* @__PURE__ */ jsx(CalendarRange, { className: "size-4" }),
879
+ label,
880
+ hasRange && /* @__PURE__ */ jsx(
881
+ "span",
882
+ {
883
+ role: "button",
884
+ tabIndex: 0,
885
+ "aria-label": "Limpiar periodo",
886
+ onClick: (e) => {
887
+ e.stopPropagation();
888
+ onValueChange?.(void 0);
889
+ },
890
+ onKeyDown: (e) => {
891
+ if (e.key === "Enter" || e.key === " ") {
892
+ e.stopPropagation();
893
+ onValueChange?.(void 0);
894
+ }
895
+ },
896
+ className: "-mr-1 ml-0.5 rounded-full p-0.5 hover:bg-primary/20",
897
+ children: /* @__PURE__ */ jsx(X, { className: "size-3" })
898
+ }
899
+ )
900
+ ]
901
+ }
902
+ ) }),
903
+ /* @__PURE__ */ jsx(PopoverContent, { className: "w-auto p-0", align: "start", children: /* @__PURE__ */ jsx(
904
+ Calendar,
905
+ {
906
+ mode: "range",
907
+ selected: value,
908
+ onSelect: onValueChange,
909
+ numberOfMonths,
910
+ autoFocus: true
911
+ }
912
+ ) })
913
+ ] });
914
+ });
915
+ var DropdownMenu = DropdownMenuPrimitive.Root;
916
+ var DropdownMenuTrigger = DropdownMenuPrimitive.Trigger;
917
+ var DropdownMenuGroup = DropdownMenuPrimitive.Group;
918
+ var DropdownMenuPortal = DropdownMenuPrimitive.Portal;
919
+ var DropdownMenuSub = DropdownMenuPrimitive.Sub;
920
+ var DropdownMenuRadioGroup = DropdownMenuPrimitive.RadioGroup;
921
+ var DropdownMenuContent = forwardRef(function DropdownMenuContent2({ className, sideOffset = 6, ...props }, ref) {
922
+ return /* @__PURE__ */ jsx(DropdownMenuPrimitive.Portal, { children: /* @__PURE__ */ jsx(
923
+ DropdownMenuPrimitive.Content,
924
+ {
925
+ ref,
926
+ sideOffset,
927
+ className: cn(
928
+ "z-dropdown min-w-[10rem] overflow-hidden rounded-md border border-border bg-surface-elev p-1 text-fg shadow-md",
929
+ "data-[state=open]:animate-zoom-in data-[state=closed]:animate-zoom-out",
930
+ className
931
+ ),
932
+ ...props
933
+ }
934
+ ) });
935
+ });
936
+ var DropdownMenuItem = forwardRef(function DropdownMenuItem2({ className, inset, destructive, ...props }, ref) {
937
+ return /* @__PURE__ */ jsx(
938
+ DropdownMenuPrimitive.Item,
939
+ {
940
+ ref,
941
+ className: cn(
942
+ "relative flex cursor-pointer select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none",
943
+ "data-[highlighted]:bg-primary-soft data-[highlighted]:text-primary",
944
+ "data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
945
+ inset && "pl-8",
946
+ destructive && "data-[highlighted]:bg-danger-soft data-[highlighted]:text-danger",
947
+ className
948
+ ),
949
+ ...props
950
+ }
951
+ );
952
+ });
953
+ var DropdownMenuCheckboxItem = forwardRef(function DropdownMenuCheckboxItem2({ className, children, checked, ...props }, ref) {
954
+ return /* @__PURE__ */ jsxs(
955
+ DropdownMenuPrimitive.CheckboxItem,
956
+ {
957
+ ref,
958
+ checked,
959
+ className: cn(
960
+ "relative flex cursor-pointer select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none",
961
+ "data-[highlighted]:bg-primary-soft data-[highlighted]:text-primary",
962
+ "data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
963
+ className
964
+ ),
965
+ ...props,
966
+ children: [
967
+ /* @__PURE__ */ jsx("span", { className: "absolute left-2 flex size-4 items-center justify-center", children: /* @__PURE__ */ jsx(DropdownMenuPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx(Check, { className: "size-4 text-primary" }) }) }),
968
+ children
969
+ ]
970
+ }
971
+ );
972
+ });
973
+ var DropdownMenuRadioItem = forwardRef(function DropdownMenuRadioItem2({ className, children, ...props }, ref) {
974
+ return /* @__PURE__ */ jsxs(
975
+ DropdownMenuPrimitive.RadioItem,
976
+ {
977
+ ref,
978
+ className: cn(
979
+ "relative flex cursor-pointer select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none",
980
+ "data-[highlighted]:bg-primary-soft data-[highlighted]:text-primary",
981
+ className
982
+ ),
983
+ ...props,
984
+ children: [
985
+ /* @__PURE__ */ jsx("span", { className: "absolute left-2 flex size-4 items-center justify-center", children: /* @__PURE__ */ jsx(DropdownMenuPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx(Circle, { className: "size-2 fill-current text-primary" }) }) }),
986
+ children
987
+ ]
988
+ }
989
+ );
990
+ });
991
+ var DropdownMenuLabel = forwardRef(function DropdownMenuLabel2({ className, inset, ...props }, ref) {
992
+ return /* @__PURE__ */ jsx(
993
+ DropdownMenuPrimitive.Label,
994
+ {
995
+ ref,
996
+ className: cn(
997
+ "px-2 py-1.5 text-[10px] uppercase tracking-wider text-fg-subtle",
998
+ inset && "pl-8",
999
+ className
1000
+ ),
1001
+ ...props
1002
+ }
1003
+ );
1004
+ });
1005
+ var DropdownMenuSeparator = forwardRef(function DropdownMenuSeparator2({ className, ...props }, ref) {
1006
+ return /* @__PURE__ */ jsx(DropdownMenuPrimitive.Separator, { ref, className: cn("-mx-1 my-1 h-px bg-border", className), ...props });
1007
+ });
1008
+ function DropdownMenuShortcut({ className, ...props }) {
1009
+ return /* @__PURE__ */ jsx("span", { className: cn("ml-auto text-[11px] tracking-widest text-fg-subtle", className), ...props });
1010
+ }
1011
+ var DropdownMenuSubTrigger = forwardRef(function DropdownMenuSubTrigger2({ className, inset, children, ...props }, ref) {
1012
+ return /* @__PURE__ */ jsxs(
1013
+ DropdownMenuPrimitive.SubTrigger,
1014
+ {
1015
+ ref,
1016
+ className: cn(
1017
+ "flex cursor-pointer select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none",
1018
+ "data-[highlighted]:bg-primary-soft data-[state=open]:bg-primary-soft",
1019
+ inset && "pl-8",
1020
+ className
1021
+ ),
1022
+ ...props,
1023
+ children: [
1024
+ children,
1025
+ /* @__PURE__ */ jsx(ChevronRight, { className: "ml-auto size-4" })
1026
+ ]
1027
+ }
1028
+ );
1029
+ });
1030
+ var DropdownMenuSubContent = forwardRef(function DropdownMenuSubContent2({ className, ...props }, ref) {
1031
+ return /* @__PURE__ */ jsx(
1032
+ DropdownMenuPrimitive.SubContent,
1033
+ {
1034
+ ref,
1035
+ className: cn(
1036
+ "z-dropdown min-w-[10rem] overflow-hidden rounded-md border border-border bg-surface-elev p-1 text-fg shadow-md",
1037
+ "data-[state=open]:animate-zoom-in data-[state=closed]:animate-zoom-out",
1038
+ className
1039
+ ),
1040
+ ...props
1041
+ }
1042
+ );
1043
+ });
1044
+ var EmptyState = forwardRef(function EmptyState2({ icon, title, description, action, className, ...props }, ref) {
1045
+ return /* @__PURE__ */ jsxs(
1046
+ "div",
1047
+ {
1048
+ ref,
1049
+ className: cn(
1050
+ "flex flex-col items-center justify-center gap-3 rounded-lg border border-dashed border-border-strong",
1051
+ "bg-surface px-6 py-12 text-center",
1052
+ className
1053
+ ),
1054
+ ...props,
1055
+ children: [
1056
+ icon && /* @__PURE__ */ jsx("div", { className: "grid size-12 place-items-center rounded-full bg-surface-muted text-fg-subtle [&_svg]:size-6", children: icon }),
1057
+ /* @__PURE__ */ jsxs("div", { className: "space-y-1", children: [
1058
+ /* @__PURE__ */ jsx("h3", { className: "text-sm font-semibold text-fg", children: title }),
1059
+ description && /* @__PURE__ */ jsx("p", { className: "mx-auto max-w-sm text-sm text-fg-muted", children: description })
1060
+ ] }),
1061
+ action && /* @__PURE__ */ jsx("div", { className: "mt-1", children: action })
1062
+ ]
1063
+ }
1064
+ );
1065
+ });
1066
+ function formatSize(bytes) {
1067
+ if (bytes < 1024) return `${bytes} B`;
1068
+ if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(1)} KB`;
1069
+ return `${(bytes / 1024 / 1024).toFixed(1)} MB`;
1070
+ }
1071
+ var FileDropzone = forwardRef(function FileDropzone2({ value, onFilesChange, accept, multiple = true, disabled, className, hint = "PNG, JPG, PDF \xB7 hasta 10 MB" }, ref) {
1072
+ const inputId = useId();
1073
+ const [internal, setInternal] = useState([]);
1074
+ const [dragging, setDragging] = useState(false);
1075
+ const files = value ?? internal;
1076
+ const setFiles = (next) => {
1077
+ if (!value) setInternal(next);
1078
+ onFilesChange?.(next);
1079
+ };
1080
+ const addFiles = (list) => {
1081
+ if (!list) return;
1082
+ const incoming = Array.from(list);
1083
+ setFiles(multiple ? [...files, ...incoming] : incoming.slice(0, 1));
1084
+ };
1085
+ const onDrop = (e) => {
1086
+ e.preventDefault();
1087
+ setDragging(false);
1088
+ if (disabled) return;
1089
+ addFiles(e.dataTransfer.files);
1090
+ };
1091
+ return /* @__PURE__ */ jsxs("div", { className, children: [
1092
+ /* @__PURE__ */ jsxs(
1093
+ "label",
1094
+ {
1095
+ htmlFor: inputId,
1096
+ onDragOver: (e) => {
1097
+ e.preventDefault();
1098
+ if (!disabled) setDragging(true);
1099
+ },
1100
+ onDragLeave: () => setDragging(false),
1101
+ onDrop,
1102
+ className: cn(
1103
+ "flex cursor-pointer flex-col items-center justify-center gap-2 rounded-lg border-2 border-dashed px-6 py-8 text-center",
1104
+ "transition-colors duration-fast",
1105
+ dragging ? "border-primary bg-primary-soft" : "border-border-strong bg-surface hover:bg-surface-muted",
1106
+ disabled && "pointer-events-none opacity-60"
1107
+ ),
1108
+ children: [
1109
+ /* @__PURE__ */ jsx(UploadCloud, { className: cn("size-7", dragging ? "text-primary" : "text-fg-subtle") }),
1110
+ /* @__PURE__ */ jsxs("div", { className: "text-sm", children: [
1111
+ /* @__PURE__ */ jsx("span", { className: "font-medium text-primary", children: "Haz click para subir" }),
1112
+ " ",
1113
+ /* @__PURE__ */ jsx("span", { className: "text-fg-muted", children: "o arrastra aqu\xED" })
1114
+ ] }),
1115
+ /* @__PURE__ */ jsx("p", { className: "text-xs text-fg-subtle", children: hint }),
1116
+ /* @__PURE__ */ jsx(
1117
+ "input",
1118
+ {
1119
+ ref,
1120
+ id: inputId,
1121
+ type: "file",
1122
+ accept,
1123
+ multiple,
1124
+ disabled,
1125
+ className: "sr-only",
1126
+ onChange: (e) => addFiles(e.target.files)
1127
+ }
1128
+ )
1129
+ ]
1130
+ }
1131
+ ),
1132
+ files.length > 0 && /* @__PURE__ */ jsx("ul", { className: "mt-3 space-y-2", children: files.map((f, i) => /* @__PURE__ */ jsxs(
1133
+ "li",
1134
+ {
1135
+ className: "flex items-center gap-3 rounded-md border border-border bg-surface px-3 py-2 text-sm",
1136
+ children: [
1137
+ /* @__PURE__ */ jsx(File, { className: "size-4 shrink-0 text-fg-subtle" }),
1138
+ /* @__PURE__ */ jsx("span", { className: "min-w-0 flex-1 truncate", children: f.name }),
1139
+ /* @__PURE__ */ jsx("span", { className: "shrink-0 text-xs text-fg-subtle", children: formatSize(f.size) }),
1140
+ /* @__PURE__ */ jsx(
1141
+ "button",
1142
+ {
1143
+ type: "button",
1144
+ "aria-label": `Quitar ${f.name}`,
1145
+ onClick: () => setFiles(files.filter((_, idx) => idx !== i)),
1146
+ className: "shrink-0 rounded p-0.5 text-fg-subtle transition-colors hover:bg-surface-muted hover:text-danger",
1147
+ children: /* @__PURE__ */ jsx(X, { className: "size-4" })
1148
+ }
1149
+ )
1150
+ ]
1151
+ },
1152
+ `${f.name}-${i}`
1153
+ )) })
1154
+ ] });
1155
+ });
1156
+ var fieldBase = cn(
1157
+ "peer block w-full rounded-md border border-border-strong bg-surface px-3 pb-2 pt-5 text-sm text-fg",
1158
+ "transition-colors duration-fast",
1159
+ "focus:outline-none focus:border-primary focus:ring-2 focus:ring-ring focus:ring-offset-2 focus:ring-offset-bg",
1160
+ "disabled:cursor-not-allowed disabled:opacity-60 disabled:bg-surface-muted"
1161
+ );
1162
+ var labelFloat = cn(
1163
+ "pointer-events-none absolute left-3 top-2 z-10 origin-[0] -translate-y-0 scale-75 text-fg-subtle",
1164
+ "transition-all duration-fast"
1165
+ );
1166
+ var labelAuto = cn(
1167
+ "pointer-events-none absolute left-3 top-4 z-10 origin-[0] text-fg-subtle transition-all duration-fast",
1168
+ "peer-placeholder-shown:translate-y-0 peer-placeholder-shown:scale-100",
1169
+ "-translate-y-2.5 scale-75",
1170
+ "peer-focus:-translate-y-2.5 peer-focus:scale-75 peer-focus:text-primary"
1171
+ );
1172
+ var FloatingInput = forwardRef(function FloatingInput2({ label, id, className, ...props }, ref) {
1173
+ const auto = useId();
1174
+ const fieldId = id ?? auto;
1175
+ return /* @__PURE__ */ jsxs("div", { className: "relative", children: [
1176
+ /* @__PURE__ */ jsx("input", { ref, id: fieldId, placeholder: " ", className: cn(fieldBase, "h-14", className), ...props }),
1177
+ /* @__PURE__ */ jsx("label", { htmlFor: fieldId, className: labelAuto, children: label })
1178
+ ] });
1179
+ });
1180
+ var FloatingTextarea = forwardRef(
1181
+ function FloatingTextarea2({ label, id, className, ...props }, ref) {
1182
+ const auto = useId();
1183
+ const fieldId = id ?? auto;
1184
+ return /* @__PURE__ */ jsxs("div", { className: "relative", children: [
1185
+ /* @__PURE__ */ jsx(
1186
+ "textarea",
1187
+ {
1188
+ ref,
1189
+ id: fieldId,
1190
+ placeholder: " ",
1191
+ className: cn(fieldBase, "min-h-[6rem] resize-y", className),
1192
+ ...props
1193
+ }
1194
+ ),
1195
+ /* @__PURE__ */ jsx("label", { htmlFor: fieldId, className: labelAuto, children: label })
1196
+ ] });
1197
+ }
1198
+ );
1199
+ var FloatingSelect = forwardRef(function FloatingSelect2({ label, id, className, children, ...props }, ref) {
1200
+ const auto = useId();
1201
+ const fieldId = id ?? auto;
1202
+ return /* @__PURE__ */ jsxs("div", { className: "relative", children: [
1203
+ /* @__PURE__ */ jsx(
1204
+ "select",
1205
+ {
1206
+ ref,
1207
+ id: fieldId,
1208
+ className: cn(fieldBase, "h-14 appearance-none pr-9", className),
1209
+ ...props,
1210
+ children
1211
+ }
1212
+ ),
1213
+ /* @__PURE__ */ jsx("label", { htmlFor: fieldId, className: labelFloat, children: label }),
1214
+ /* @__PURE__ */ jsx(
1215
+ "svg",
1216
+ {
1217
+ className: "pointer-events-none absolute right-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle",
1218
+ viewBox: "0 0 24 24",
1219
+ fill: "none",
1220
+ stroke: "currentColor",
1221
+ strokeWidth: "2",
1222
+ children: /* @__PURE__ */ jsx("path", { d: "m6 9 6 6 6-6" })
1223
+ }
1224
+ )
1225
+ ] });
1226
+ });
1227
+ var FloatingFileInput = forwardRef(
1228
+ function FloatingFileInput2({ label, id, className, ...props }, ref) {
1229
+ const auto = useId();
1230
+ const fieldId = id ?? auto;
1231
+ return /* @__PURE__ */ jsxs("div", { className: "relative", children: [
1232
+ /* @__PURE__ */ jsx("label", { htmlFor: fieldId, className: labelFloat, children: label }),
1233
+ /* @__PURE__ */ jsxs("div", { className: cn(fieldBase, "flex h-14 items-center gap-2 text-fg-muted"), children: [
1234
+ /* @__PURE__ */ jsx(Upload, { className: "size-4 shrink-0 text-fg-subtle" }),
1235
+ /* @__PURE__ */ jsx(
1236
+ "input",
1237
+ {
1238
+ ref,
1239
+ id: fieldId,
1240
+ type: "file",
1241
+ className: cn(
1242
+ "w-full cursor-pointer text-xs text-fg-muted outline-none",
1243
+ "file:mr-3 file:rounded-md file:border-0 file:bg-primary-soft file:px-3 file:py-1.5 file:text-xs file:font-medium file:text-primary",
1244
+ className
1245
+ ),
1246
+ ...props
1247
+ }
1248
+ )
1249
+ ] })
1250
+ ] });
1251
+ }
1252
+ );
1253
+ var FloatingDatePicker = forwardRef(
1254
+ function FloatingDatePicker2({ label, value, onValueChange, disabled, className, format }, ref) {
1255
+ useId();
1256
+ const fmt2 = format ?? ((d) => d.toLocaleDateString("es", { day: "2-digit", month: "long", year: "numeric" }));
1257
+ return /* @__PURE__ */ jsxs(Popover, { children: [
1258
+ /* @__PURE__ */ jsxs("div", { className: "relative", children: [
1259
+ /* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
1260
+ "button",
1261
+ {
1262
+ ref,
1263
+ type: "button",
1264
+ disabled,
1265
+ className: cn(fieldBase, "flex h-14 items-center justify-between text-left", className),
1266
+ children: [
1267
+ /* @__PURE__ */ jsx("span", { className: cn("text-sm", value ? "text-fg" : "text-transparent"), children: value ? fmt2(value) : "\xB7" }),
1268
+ /* @__PURE__ */ jsx(CalendarDays, { className: "size-4 shrink-0 text-fg-subtle" })
1269
+ ]
1270
+ }
1271
+ ) }),
1272
+ /* @__PURE__ */ jsx("label", { className: labelFloat, children: label })
1273
+ ] }),
1274
+ /* @__PURE__ */ jsx(PopoverContent, { className: "w-auto p-0", align: "start", children: /* @__PURE__ */ jsx(
1275
+ Calendar,
1276
+ {
1277
+ mode: "single",
1278
+ selected: value,
1279
+ onSelect: onValueChange,
1280
+ autoFocus: true
1281
+ }
1282
+ ) })
1283
+ ] });
1284
+ }
1285
+ );
1286
+ var Label3 = forwardRef(function Label4({ className, required, children, ...props }, ref) {
1287
+ return /* @__PURE__ */ jsxs(
1288
+ LabelPrimitive.Root,
1289
+ {
1290
+ ref,
1291
+ className: cn(
1292
+ "text-sm font-medium text-fg leading-none",
1293
+ "peer-disabled:cursor-not-allowed peer-disabled:opacity-60",
1294
+ className
1295
+ ),
1296
+ ...props,
1297
+ children: [
1298
+ children,
1299
+ required ? /* @__PURE__ */ jsx("span", { className: "ml-0.5 text-danger", "aria-hidden": true, children: "*" }) : null
1300
+ ]
1301
+ }
1302
+ );
1303
+ });
1304
+ var Form = forwardRef(
1305
+ function Form2({ className, ...props }, ref) {
1306
+ return /* @__PURE__ */ jsx("form", { ref, className: cn("space-y-5", className), ...props });
1307
+ }
1308
+ );
1309
+ var FormFieldContext = createContext(null);
1310
+ function useField() {
1311
+ const ctx = useContext(FormFieldContext);
1312
+ if (!ctx) throw new Error("useField debe usarse dentro de <FormField>");
1313
+ return ctx;
1314
+ }
1315
+ var FormField = forwardRef(function FormField2({ className, error, ...props }, ref) {
1316
+ const id = useId();
1317
+ return /* @__PURE__ */ jsx(FormFieldContext.Provider, { value: { id, error }, children: /* @__PURE__ */ jsx("div", { ref, className: cn("space-y-1.5", className), ...props }) });
1318
+ });
1319
+ var FormLabel = forwardRef(function FormLabel2({ className, ...props }, ref) {
1320
+ const { id, error } = useField();
1321
+ return /* @__PURE__ */ jsx(Label3, { ref, htmlFor: id, className: cn(error && "text-danger", className), ...props });
1322
+ });
1323
+ var FormControl = forwardRef(function FormControl2(props, ref) {
1324
+ const { id, error } = useField();
1325
+ return /* @__PURE__ */ jsx(
1326
+ Slot,
1327
+ {
1328
+ ref,
1329
+ id,
1330
+ "aria-invalid": !!error || void 0,
1331
+ "aria-describedby": error ? `${id}-msg` : void 0,
1332
+ ...props
1333
+ }
1334
+ );
1335
+ });
1336
+ function FormDescription({ className, ...props }) {
1337
+ return /* @__PURE__ */ jsx("p", { className: cn("text-xs text-fg-muted", className), ...props });
1338
+ }
1339
+ function FormMessage({ className, children, ...props }) {
1340
+ const { id, error } = useField();
1341
+ const body = error ?? children;
1342
+ if (!body) return null;
1343
+ return /* @__PURE__ */ jsx("p", { id: `${id}-msg`, className: cn("text-xs font-medium text-danger", className), ...props, children: body });
1344
+ }
1345
+ var HoverCard = HoverCardPrimitive.Root;
1346
+ var HoverCardTrigger = HoverCardPrimitive.Trigger;
1347
+ var HoverCardContent = forwardRef(function HoverCardContent2({ className, align = "center", sideOffset = 6, ...props }, ref) {
1348
+ return /* @__PURE__ */ jsx(HoverCardPrimitive.Portal, { children: /* @__PURE__ */ jsx(
1349
+ HoverCardPrimitive.Content,
1350
+ {
1351
+ ref,
1352
+ align,
1353
+ sideOffset,
1354
+ className: cn(
1355
+ "z-dropdown w-64 rounded-md border border-border bg-surface-elev p-4 text-fg shadow-md outline-none",
1356
+ "data-[state=open]:animate-zoom-in data-[state=closed]:animate-zoom-out",
1357
+ className
1358
+ ),
1359
+ ...props
1360
+ }
1361
+ ) });
1362
+ });
1363
+
1364
+ // src/components/input/input.variants.ts
1365
+ var inputVariants = cva(
1366
+ [
1367
+ "flex w-full rounded-md border bg-surface text-sm text-fg",
1368
+ "transition-colors duration-fast placeholder:text-fg-subtle",
1369
+ "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-bg",
1370
+ "disabled:cursor-not-allowed disabled:opacity-60 disabled:bg-surface-muted",
1371
+ "file:border-0 file:bg-transparent file:text-sm file:font-medium"
1372
+ ],
1373
+ {
1374
+ variants: {
1375
+ size: {
1376
+ sm: "h-8 px-2.5 text-xs",
1377
+ md: "h-10 px-3",
1378
+ lg: "h-12 px-4 text-base"
1379
+ },
1380
+ state: {
1381
+ default: "border-border-strong",
1382
+ error: "border-danger focus-visible:ring-danger",
1383
+ success: "border-success focus-visible:ring-success"
1384
+ }
1385
+ },
1386
+ defaultVariants: { size: "md", state: "default" }
1387
+ }
1388
+ );
1389
+ var Input = forwardRef(function Input2({ className, size, state, type = "text", ...props }, ref) {
1390
+ return /* @__PURE__ */ jsx(
1391
+ "input",
1392
+ {
1393
+ ref,
1394
+ type,
1395
+ "data-state": state,
1396
+ className: cn(inputVariants({ size, state }), className),
1397
+ ...props
1398
+ }
1399
+ );
1400
+ });
1401
+ function Pagination({ className, ...props }) {
1402
+ return /* @__PURE__ */ jsx(
1403
+ "nav",
1404
+ {
1405
+ role: "navigation",
1406
+ "aria-label": "paginaci\xF3n",
1407
+ className: cn("mx-auto flex w-full justify-center", className),
1408
+ ...props
1409
+ }
1410
+ );
1411
+ }
1412
+ var PaginationContent = forwardRef(
1413
+ function PaginationContent2({ className, ...props }, ref) {
1414
+ return /* @__PURE__ */ jsx("ul", { ref, className: cn("flex flex-row items-center gap-1", className), ...props });
1415
+ }
1416
+ );
1417
+ var PaginationItem = forwardRef(
1418
+ function PaginationItem2(props, ref) {
1419
+ return /* @__PURE__ */ jsx("li", { ref, ...props });
1420
+ }
1421
+ );
1422
+ function PaginationLink({ className, isActive, size = "icon", ...props }) {
1423
+ return /* @__PURE__ */ jsx(
1424
+ "a",
1425
+ {
1426
+ "aria-current": isActive ? "page" : void 0,
1427
+ className: cn(
1428
+ buttonVariants({ variant: isActive ? "outline" : "ghost", size }),
1429
+ "cursor-pointer",
1430
+ isActive && "border-primary text-primary",
1431
+ className
1432
+ ),
1433
+ ...props
1434
+ }
1435
+ );
1436
+ }
1437
+ function PaginationPrevious({ className, ...props }) {
1438
+ return /* @__PURE__ */ jsxs(PaginationLink, { "aria-label": "Anterior", size: "sm", className: cn("gap-1 px-2.5", className), ...props, children: [
1439
+ /* @__PURE__ */ jsx(ChevronLeft, { className: "size-4" }),
1440
+ /* @__PURE__ */ jsx("span", { children: "Anterior" })
1441
+ ] });
1442
+ }
1443
+ function PaginationNext({ className, ...props }) {
1444
+ return /* @__PURE__ */ jsxs(PaginationLink, { "aria-label": "Siguiente", size: "sm", className: cn("gap-1 px-2.5", className), ...props, children: [
1445
+ /* @__PURE__ */ jsx("span", { children: "Siguiente" }),
1446
+ /* @__PURE__ */ jsx(ChevronRight, { className: "size-4" })
1447
+ ] });
1448
+ }
1449
+ function PaginationEllipsis({ className, ...props }) {
1450
+ return /* @__PURE__ */ jsxs("span", { "aria-hidden": true, className: cn("flex size-10 items-center justify-center text-fg-subtle", className), ...props, children: [
1451
+ /* @__PURE__ */ jsx(MoreHorizontal, { className: "size-4" }),
1452
+ /* @__PURE__ */ jsx("span", { className: "sr-only", children: "M\xE1s p\xE1ginas" })
1453
+ ] });
1454
+ }
1455
+ var TONE = {
1456
+ primary: "bg-primary",
1457
+ success: "bg-success",
1458
+ danger: "bg-danger",
1459
+ warning: "bg-warning"
1460
+ };
1461
+ var Progress = forwardRef(
1462
+ function Progress2({ className, value, tone = "primary", ...props }, ref) {
1463
+ return /* @__PURE__ */ jsx(
1464
+ ProgressPrimitive.Root,
1465
+ {
1466
+ ref,
1467
+ className: cn("relative h-2 w-full overflow-hidden rounded-full bg-surface-muted", className),
1468
+ value,
1469
+ ...props,
1470
+ children: /* @__PURE__ */ jsx(
1471
+ ProgressPrimitive.Indicator,
1472
+ {
1473
+ className: cn("size-full flex-1 transition-transform duration-slow ease-metrik", TONE[tone]),
1474
+ style: { transform: `translateX(-${100 - (value ?? 0)}%)` }
1475
+ }
1476
+ )
1477
+ }
1478
+ );
1479
+ }
1480
+ );
1481
+ var RadioGroup3 = forwardRef(function RadioGroup4({ className, ...props }, ref) {
1482
+ return /* @__PURE__ */ jsx(RadioGroupPrimitive.Root, { ref, className: cn("grid gap-2.5", className), ...props });
1483
+ });
1484
+ var RadioGroupItem = forwardRef(function RadioGroupItem2({ className, ...props }, ref) {
1485
+ return /* @__PURE__ */ jsx(
1486
+ RadioGroupPrimitive.Item,
1487
+ {
1488
+ ref,
1489
+ className: cn(
1490
+ "aspect-square size-[18px] shrink-0 rounded-full border-2 border-border-strong bg-surface text-primary",
1491
+ "transition-colors duration-fast",
1492
+ "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-bg",
1493
+ "disabled:cursor-not-allowed disabled:opacity-50",
1494
+ "data-[state=checked]:border-primary",
1495
+ className
1496
+ ),
1497
+ ...props,
1498
+ children: /* @__PURE__ */ jsx(RadioGroupPrimitive.Indicator, { className: "flex items-center justify-center", children: /* @__PURE__ */ jsx(Circle, { className: "size-2.5 fill-primary text-primary" }) })
1499
+ }
1500
+ );
1501
+ });
1502
+ var RichTextEditor = forwardRef(function RichTextEditor2({ defaultValue = "", onChange, placeholder = "Escribe aqu\xED\u2026", className, disabled }, ref) {
1503
+ const editorRef = useRef(null);
1504
+ useEffect(() => {
1505
+ if (editorRef.current && editorRef.current.innerHTML !== defaultValue) {
1506
+ editorRef.current.innerHTML = defaultValue;
1507
+ }
1508
+ }, []);
1509
+ const exec = (command, value) => {
1510
+ editorRef.current?.focus();
1511
+ document.execCommand(command, false, value);
1512
+ onChange?.(editorRef.current?.innerHTML ?? "");
1513
+ };
1514
+ const commands = [
1515
+ { icon: /* @__PURE__ */ jsx(Bold, { className: "size-4" }), label: "Negrita", run: () => exec("bold") },
1516
+ { icon: /* @__PURE__ */ jsx(Italic, { className: "size-4" }), label: "Cursiva", run: () => exec("italic") },
1517
+ { icon: /* @__PURE__ */ jsx(Underline, { className: "size-4" }), label: "Subrayado", run: () => exec("underline") },
1518
+ { icon: /* @__PURE__ */ jsx(List, { className: "size-4" }), label: "Lista", run: () => exec("insertUnorderedList") },
1519
+ { icon: /* @__PURE__ */ jsx(ListOrdered, { className: "size-4" }), label: "Lista numerada", run: () => exec("insertOrderedList") },
1520
+ {
1521
+ icon: /* @__PURE__ */ jsx(Link2, { className: "size-4" }),
1522
+ label: "Enlace",
1523
+ run: () => {
1524
+ const url = window.prompt("URL del enlace:");
1525
+ if (url) exec("createLink", url);
1526
+ }
1527
+ }
1528
+ ];
1529
+ return /* @__PURE__ */ jsxs(
1530
+ "div",
1531
+ {
1532
+ ref,
1533
+ className: cn(
1534
+ "overflow-hidden rounded-md border border-border-strong bg-surface",
1535
+ "focus-within:border-primary focus-within:ring-2 focus-within:ring-ring focus-within:ring-offset-2 focus-within:ring-offset-bg",
1536
+ disabled && "pointer-events-none opacity-60",
1537
+ className
1538
+ ),
1539
+ children: [
1540
+ /* @__PURE__ */ jsx("div", { className: "flex flex-wrap items-center gap-0.5 border-b border-border bg-surface-muted/50 p-1", children: commands.map((c) => /* @__PURE__ */ jsx(
1541
+ "button",
1542
+ {
1543
+ type: "button",
1544
+ title: c.label,
1545
+ "aria-label": c.label,
1546
+ onMouseDown: (e) => {
1547
+ e.preventDefault();
1548
+ c.run();
1549
+ },
1550
+ className: "grid size-8 place-items-center rounded text-fg-muted transition-colors duration-fast hover:bg-surface-muted hover:text-fg",
1551
+ children: c.icon
1552
+ },
1553
+ c.label
1554
+ )) }),
1555
+ /* @__PURE__ */ jsx(
1556
+ "div",
1557
+ {
1558
+ ref: editorRef,
1559
+ contentEditable: !disabled,
1560
+ role: "textbox",
1561
+ "aria-multiline": "true",
1562
+ "data-placeholder": placeholder,
1563
+ onInput: () => onChange?.(editorRef.current?.innerHTML ?? ""),
1564
+ className: cn(
1565
+ "metrik-rte min-h-[7rem] px-3 py-2.5 text-sm leading-relaxed text-fg outline-none",
1566
+ "[&_a]:text-primary [&_a]:underline [&_ul]:list-disc [&_ol]:list-decimal [&_ul]:pl-5 [&_ol]:pl-5",
1567
+ "empty:before:pointer-events-none empty:before:text-fg-subtle empty:before:content-[attr(data-placeholder)]"
1568
+ )
1569
+ }
1570
+ )
1571
+ ]
1572
+ }
1573
+ );
1574
+ });
1575
+ var ScrollArea = forwardRef(function ScrollArea2({ className, children, ...props }, ref) {
1576
+ return /* @__PURE__ */ jsxs(ScrollAreaPrimitive.Root, { ref, className: cn("relative overflow-hidden", className), ...props, children: [
1577
+ /* @__PURE__ */ jsx(ScrollAreaPrimitive.Viewport, { className: "size-full rounded-[inherit]", children }),
1578
+ /* @__PURE__ */ jsx(ScrollBar, {}),
1579
+ /* @__PURE__ */ jsx(ScrollAreaPrimitive.Corner, {})
1580
+ ] });
1581
+ });
1582
+ var ScrollBar = forwardRef(function ScrollBar2({ className, orientation = "vertical", ...props }, ref) {
1583
+ return /* @__PURE__ */ jsx(
1584
+ ScrollAreaPrimitive.ScrollAreaScrollbar,
1585
+ {
1586
+ ref,
1587
+ orientation,
1588
+ className: cn(
1589
+ "flex touch-none select-none transition-colors duration-fast",
1590
+ orientation === "vertical" && "h-full w-2.5 border-l border-l-transparent p-px",
1591
+ orientation === "horizontal" && "h-2.5 flex-col border-t border-t-transparent p-px",
1592
+ className
1593
+ ),
1594
+ ...props,
1595
+ children: /* @__PURE__ */ jsx(ScrollAreaPrimitive.ScrollAreaThumb, { className: "relative flex-1 rounded-full bg-border-strong" })
1596
+ }
1597
+ );
1598
+ });
1599
+ var Select = SelectPrimitive.Root;
1600
+ var SelectGroup = SelectPrimitive.Group;
1601
+ var SelectValue = SelectPrimitive.Value;
1602
+ var SelectTrigger = forwardRef(function SelectTrigger2({ className, children, ...props }, ref) {
1603
+ return /* @__PURE__ */ jsxs(
1604
+ SelectPrimitive.Trigger,
1605
+ {
1606
+ ref,
1607
+ className: cn(
1608
+ "flex h-10 w-full items-center justify-between gap-2 rounded-md border border-border-strong",
1609
+ "bg-surface px-3 text-sm text-fg",
1610
+ "placeholder:text-fg-subtle [&>span]:line-clamp-1",
1611
+ "transition-colors duration-fast",
1612
+ "focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-bg",
1613
+ "disabled:cursor-not-allowed disabled:opacity-60",
1614
+ className
1615
+ ),
1616
+ ...props,
1617
+ children: [
1618
+ children,
1619
+ /* @__PURE__ */ jsx(SelectPrimitive.Icon, { asChild: true, children: /* @__PURE__ */ jsx(ChevronDown, { className: "size-4 opacity-60" }) })
1620
+ ]
1621
+ }
1622
+ );
1623
+ });
1624
+ var SelectContent = forwardRef(function SelectContent2({ className, children, position = "popper", ...props }, ref) {
1625
+ return /* @__PURE__ */ jsx(SelectPrimitive.Portal, { children: /* @__PURE__ */ jsxs(
1626
+ SelectPrimitive.Content,
1627
+ {
1628
+ ref,
1629
+ position,
1630
+ className: cn(
1631
+ "z-dropdown min-w-[8rem] overflow-hidden rounded-md border border-border bg-surface-elev text-fg shadow-md",
1632
+ "data-[state=open]:animate-zoom-in data-[state=closed]:animate-zoom-out",
1633
+ position === "popper" && "data-[side=bottom]:translate-y-1 data-[side=top]:-translate-y-1",
1634
+ className
1635
+ ),
1636
+ ...props,
1637
+ children: [
1638
+ /* @__PURE__ */ jsx(SelectPrimitive.ScrollUpButton, { className: "flex items-center justify-center py-1", children: /* @__PURE__ */ jsx(ChevronUp, { className: "size-4" }) }),
1639
+ /* @__PURE__ */ jsx(SelectPrimitive.Viewport, { className: cn("p-1", position === "popper" && "w-full min-w-[var(--radix-select-trigger-width)]"), children }),
1640
+ /* @__PURE__ */ jsx(SelectPrimitive.ScrollDownButton, { className: "flex items-center justify-center py-1", children: /* @__PURE__ */ jsx(ChevronDown, { className: "size-4" }) })
1641
+ ]
1642
+ }
1643
+ ) });
1644
+ });
1645
+ var SelectLabel = forwardRef(function SelectLabel2({ className, ...props }, ref) {
1646
+ return /* @__PURE__ */ jsx(
1647
+ SelectPrimitive.Label,
1648
+ {
1649
+ ref,
1650
+ className: cn("py-1.5 px-2 text-[10px] uppercase tracking-wider text-fg-subtle", className),
1651
+ ...props
1652
+ }
1653
+ );
1654
+ });
1655
+ var SelectItem = forwardRef(function SelectItem2({ className, children, ...props }, ref) {
1656
+ return /* @__PURE__ */ jsxs(
1657
+ SelectPrimitive.Item,
1658
+ {
1659
+ ref,
1660
+ className: cn(
1661
+ "relative flex w-full cursor-pointer select-none items-center gap-2 rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none",
1662
+ "data-[highlighted]:bg-primary-soft data-[highlighted]:text-primary",
1663
+ "data-[state=checked]:font-medium",
1664
+ "data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
1665
+ className
1666
+ ),
1667
+ ...props,
1668
+ children: [
1669
+ /* @__PURE__ */ jsx(SelectPrimitive.ItemText, { children }),
1670
+ /* @__PURE__ */ jsx("span", { className: "absolute right-2 flex size-4 items-center justify-center", children: /* @__PURE__ */ jsx(SelectPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx(Check, { className: "size-4 text-primary" }) }) })
1671
+ ]
1672
+ }
1673
+ );
1674
+ });
1675
+ var SelectSeparator = forwardRef(function SelectSeparator2({ className, ...props }, ref) {
1676
+ return /* @__PURE__ */ jsx(SelectPrimitive.Separator, { ref, className: cn("-mx-1 my-1 h-px bg-border", className), ...props });
1677
+ });
1678
+ var Separator4 = forwardRef(
1679
+ function Separator5({ className, orientation = "horizontal", decorative = true, ...props }, ref) {
1680
+ return /* @__PURE__ */ jsx(
1681
+ SeparatorPrimitive.Root,
1682
+ {
1683
+ ref,
1684
+ decorative,
1685
+ orientation,
1686
+ className: cn(
1687
+ "shrink-0 bg-border",
1688
+ orientation === "horizontal" ? "h-px w-full" : "h-full w-px",
1689
+ className
1690
+ ),
1691
+ ...props
1692
+ }
1693
+ );
1694
+ }
1695
+ );
1696
+ var Sheet = DialogPrimitive.Root;
1697
+ var SheetTrigger = DialogPrimitive.Trigger;
1698
+ var SheetClose = DialogPrimitive.Close;
1699
+ var SheetPortal = DialogPrimitive.Portal;
1700
+ var SheetOverlay = forwardRef(function SheetOverlay2({ className, ...props }, ref) {
1701
+ return /* @__PURE__ */ jsx(
1702
+ DialogPrimitive.Overlay,
1703
+ {
1704
+ ref,
1705
+ className: cn(
1706
+ "fixed inset-0 z-overlay bg-slate-950/50 backdrop-blur-sm",
1707
+ "data-[state=open]:animate-fade-in data-[state=closed]:animate-fade-out",
1708
+ className
1709
+ ),
1710
+ ...props
1711
+ }
1712
+ );
1713
+ });
1714
+ var sheetVariants = cva(
1715
+ [
1716
+ "fixed z-modal flex flex-col gap-4 bg-surface p-6 shadow-lg transition-transform",
1717
+ "data-[state=open]:animate-fade-in"
1718
+ ],
1719
+ {
1720
+ variants: {
1721
+ side: {
1722
+ right: "inset-y-0 right-0 h-full w-3/4 max-w-sm border-l border-border data-[state=open]:animate-slide-in-right data-[state=closed]:animate-slide-out-right",
1723
+ left: "inset-y-0 left-0 h-full w-3/4 max-w-sm border-r border-border data-[state=open]:animate-[metrik-slide-in-left_var(--metrik-duration-slow)_var(--metrik-ease)] data-[state=closed]:animate-[metrik-slide-out-left_var(--metrik-duration-slow)_var(--metrik-ease)]",
1724
+ top: "inset-x-0 top-0 w-full border-b border-border data-[state=open]:animate-[metrik-slide-in-top_var(--metrik-duration-slow)_var(--metrik-ease)] data-[state=closed]:animate-[metrik-slide-out-top_var(--metrik-duration-slow)_var(--metrik-ease)]",
1725
+ bottom: "inset-x-0 bottom-0 w-full border-t border-border data-[state=open]:animate-[metrik-slide-in-bottom_var(--metrik-duration-slow)_var(--metrik-ease)] data-[state=closed]:animate-[metrik-slide-out-bottom_var(--metrik-duration-slow)_var(--metrik-ease)]"
1726
+ }
1727
+ },
1728
+ defaultVariants: { side: "right" }
1729
+ }
1730
+ );
1731
+ var SheetContent = forwardRef(function SheetContent2({ className, side = "right", children, ...props }, ref) {
1732
+ return /* @__PURE__ */ jsxs(SheetPortal, { children: [
1733
+ /* @__PURE__ */ jsx(SheetOverlay, {}),
1734
+ /* @__PURE__ */ jsxs(DialogPrimitive.Content, { ref, className: cn(sheetVariants({ side }), className), ...props, children: [
1735
+ children,
1736
+ /* @__PURE__ */ jsxs(
1737
+ DialogPrimitive.Close,
1738
+ {
1739
+ className: cn(
1740
+ "absolute right-4 top-4 rounded-sm text-fg-muted opacity-70 transition-opacity",
1741
+ "hover:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"
1742
+ ),
1743
+ children: [
1744
+ /* @__PURE__ */ jsx(X, { className: "size-4" }),
1745
+ /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Cerrar" })
1746
+ ]
1747
+ }
1748
+ )
1749
+ ] })
1750
+ ] });
1751
+ });
1752
+ function SheetHeader({ className, ...props }) {
1753
+ return /* @__PURE__ */ jsx("div", { className: cn("flex flex-col gap-1.5", className), ...props });
1754
+ }
1755
+ function SheetFooter({ className, ...props }) {
1756
+ return /* @__PURE__ */ jsx("div", { className: cn("mt-auto flex flex-col-reverse gap-2 sm:flex-row sm:justify-end", className), ...props });
1757
+ }
1758
+ var SheetTitle = forwardRef(function SheetTitle2({ className, ...props }, ref) {
1759
+ return /* @__PURE__ */ jsx(DialogPrimitive.Title, { ref, className: cn("text-lg font-semibold tracking-tight text-fg", className), ...props });
1760
+ });
1761
+ var SheetDescription = forwardRef(function SheetDescription2({ className, ...props }, ref) {
1762
+ return /* @__PURE__ */ jsx(DialogPrimitive.Description, { ref, className: cn("text-sm text-fg-muted", className), ...props });
1763
+ });
1764
+ if (typeof document !== "undefined" && !document.getElementById("metrik-sheet-anim")) {
1765
+ const style = document.createElement("style");
1766
+ style.id = "metrik-sheet-anim";
1767
+ style.textContent = "@keyframes metrik-slide-in-left{from{transform:translateX(-100%)}to{transform:translateX(0)}}@keyframes metrik-slide-out-left{from{transform:translateX(0)}to{transform:translateX(-100%)}}@keyframes metrik-slide-in-top{from{transform:translateY(-100%)}to{transform:translateY(0)}}@keyframes metrik-slide-out-top{from{transform:translateY(0)}to{transform:translateY(-100%)}}@keyframes metrik-slide-in-bottom{from{transform:translateY(100%)}to{transform:translateY(0)}}@keyframes metrik-slide-out-bottom{from{transform:translateY(0)}to{transform:translateY(100%)}}";
1768
+ document.head.appendChild(style);
1769
+ }
1770
+ var Skeleton = forwardRef(function Skeleton2({ className, circle, ...props }, ref) {
1771
+ return /* @__PURE__ */ jsx(
1772
+ "div",
1773
+ {
1774
+ ref,
1775
+ "aria-hidden": true,
1776
+ className: cn(
1777
+ "relative overflow-hidden bg-surface-muted",
1778
+ circle ? "rounded-full" : "rounded-md",
1779
+ "before:absolute before:inset-0",
1780
+ "before:bg-gradient-to-r before:from-transparent before:via-border before:to-transparent",
1781
+ "before:translate-x-[-100%] before:animate-[metrik-shimmer_1.6s_infinite]",
1782
+ className
1783
+ ),
1784
+ ...props
1785
+ }
1786
+ );
1787
+ });
1788
+ if (typeof document !== "undefined" && !document.getElementById("metrik-skeleton-anim")) {
1789
+ const style = document.createElement("style");
1790
+ style.id = "metrik-skeleton-anim";
1791
+ style.textContent = "@keyframes metrik-shimmer{to{transform:translateX(100%)}}";
1792
+ document.head.appendChild(style);
1793
+ }
1794
+ var Slider = forwardRef(function Slider2({ className, ...props }, ref) {
1795
+ const count = Array.isArray(props.value) ? props.value.length : Array.isArray(props.defaultValue) ? props.defaultValue.length : 1;
1796
+ return /* @__PURE__ */ jsxs(
1797
+ SliderPrimitive.Root,
1798
+ {
1799
+ ref,
1800
+ className: cn("relative flex w-full touch-none select-none items-center", className),
1801
+ ...props,
1802
+ children: [
1803
+ /* @__PURE__ */ jsx(SliderPrimitive.Track, { className: "relative h-1.5 w-full grow overflow-hidden rounded-full bg-surface-muted", children: /* @__PURE__ */ jsx(SliderPrimitive.Range, { className: "absolute h-full bg-primary" }) }),
1804
+ Array.from({ length: count }).map((_, i) => /* @__PURE__ */ jsx(
1805
+ SliderPrimitive.Thumb,
1806
+ {
1807
+ className: cn(
1808
+ "block size-4 rounded-full border-2 border-primary bg-surface shadow-sm",
1809
+ "transition-colors duration-fast",
1810
+ "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-bg",
1811
+ "disabled:pointer-events-none disabled:opacity-50"
1812
+ )
1813
+ },
1814
+ i
1815
+ ))
1816
+ ]
1817
+ }
1818
+ );
1819
+ });
1820
+ var STORAGE_KEY = "metrik-theme";
1821
+ function resolveSystem() {
1822
+ if (typeof window === "undefined") return "light";
1823
+ return window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
1824
+ }
1825
+ function apply(theme) {
1826
+ if (typeof document === "undefined") return;
1827
+ const resolved = theme === "system" ? resolveSystem() : theme;
1828
+ document.documentElement.classList.toggle("dark", resolved === "dark");
1829
+ document.documentElement.classList.toggle("light", resolved === "light");
1830
+ }
1831
+ function useTheme(defaultTheme = "system") {
1832
+ const [theme, setThemeState] = useState(() => {
1833
+ if (typeof window === "undefined") return defaultTheme;
1834
+ return window.localStorage.getItem(STORAGE_KEY) ?? defaultTheme;
1835
+ });
1836
+ const [resolvedTheme, setResolvedTheme] = useState(
1837
+ () => theme === "system" ? resolveSystem() : theme
1838
+ );
1839
+ useEffect(() => {
1840
+ apply(theme);
1841
+ setResolvedTheme(theme === "system" ? resolveSystem() : theme);
1842
+ if (typeof window !== "undefined") window.localStorage.setItem(STORAGE_KEY, theme);
1843
+ }, [theme]);
1844
+ useEffect(() => {
1845
+ if (theme !== "system" || typeof window === "undefined") return;
1846
+ const mq = window.matchMedia("(prefers-color-scheme: dark)");
1847
+ const onChange = () => {
1848
+ apply("system");
1849
+ setResolvedTheme(resolveSystem());
1850
+ };
1851
+ mq.addEventListener("change", onChange);
1852
+ return () => mq.removeEventListener("change", onChange);
1853
+ }, [theme]);
1854
+ const setTheme = useCallback((next) => setThemeState(next), []);
1855
+ const toggleTheme = useCallback(
1856
+ () => setThemeState((t) => t === "dark" ? "light" : "dark"),
1857
+ []
1858
+ );
1859
+ return { theme, resolvedTheme, setTheme, toggleTheme };
1860
+ }
1861
+ function Toaster(props) {
1862
+ const { resolvedTheme } = useTheme();
1863
+ return /* @__PURE__ */ jsx(
1864
+ Toaster$1,
1865
+ {
1866
+ theme: resolvedTheme,
1867
+ className: "toaster group",
1868
+ toastOptions: {
1869
+ classNames: {
1870
+ toast: "group toast group-[.toaster]:bg-surface-elev group-[.toaster]:text-fg group-[.toaster]:border group-[.toaster]:border-border group-[.toaster]:shadow-md group-[.toaster]:rounded-md",
1871
+ description: "group-[.toast]:text-fg-muted",
1872
+ actionButton: "group-[.toast]:bg-primary group-[.toast]:text-primary-fg",
1873
+ cancelButton: "group-[.toast]:bg-surface-muted group-[.toast]:text-fg-muted",
1874
+ success: "group-[.toaster]:[&_svg]:text-success",
1875
+ error: "group-[.toaster]:[&_svg]:text-danger",
1876
+ warning: "group-[.toaster]:[&_svg]:text-warning"
1877
+ }
1878
+ },
1879
+ ...props
1880
+ }
1881
+ );
1882
+ }
1883
+ var SIZES = { sm: "size-4", md: "size-5", lg: "size-6", xl: "size-8" };
1884
+ var Spinner = forwardRef(function Spinner2({ size = "md", label = "Cargando", className, ...props }, ref) {
1885
+ return /* @__PURE__ */ jsxs(
1886
+ "svg",
1887
+ {
1888
+ ref,
1889
+ viewBox: "0 0 24 24",
1890
+ role: "status",
1891
+ "aria-label": label,
1892
+ className: cn("animate-spin text-primary", SIZES[size], className),
1893
+ ...props,
1894
+ children: [
1895
+ /* @__PURE__ */ jsx("circle", { cx: "12", cy: "12", r: "9", fill: "none", stroke: "currentColor", strokeOpacity: ".2", strokeWidth: "3" }),
1896
+ /* @__PURE__ */ jsx("path", { d: "M21 12a9 9 0 0 0-9-9", fill: "none", stroke: "currentColor", strokeWidth: "3", strokeLinecap: "round" })
1897
+ ]
1898
+ }
1899
+ );
1900
+ });
1901
+ var Switch = forwardRef(
1902
+ function Switch2({ className, ...props }, ref) {
1903
+ return /* @__PURE__ */ jsx(
1904
+ SwitchPrimitive.Root,
1905
+ {
1906
+ ref,
1907
+ className: cn(
1908
+ "peer relative inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full",
1909
+ "border-2 border-transparent transition-colors duration-fast",
1910
+ "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-bg",
1911
+ "disabled:cursor-not-allowed disabled:opacity-50",
1912
+ "data-[state=checked]:bg-primary data-[state=unchecked]:bg-border-strong",
1913
+ className
1914
+ ),
1915
+ ...props,
1916
+ children: /* @__PURE__ */ jsx(
1917
+ SwitchPrimitive.Thumb,
1918
+ {
1919
+ className: cn(
1920
+ "pointer-events-none block size-4 rounded-full bg-white shadow-sm ring-0",
1921
+ "transition-transform duration-fast",
1922
+ "data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0"
1923
+ )
1924
+ }
1925
+ )
1926
+ }
1927
+ );
1928
+ }
1929
+ );
1930
+ var Table = forwardRef(
1931
+ function Table2({ className, ...props }, ref) {
1932
+ return /* @__PURE__ */ jsx("div", { className: "relative w-full overflow-x-auto", children: /* @__PURE__ */ jsx("table", { ref, className: cn("w-full caption-bottom text-sm", className), ...props }) });
1933
+ }
1934
+ );
1935
+ var TableHeader = forwardRef(
1936
+ function TableHeader2({ className, ...props }, ref) {
1937
+ return /* @__PURE__ */ jsx("thead", { ref, className: cn("[&_tr]:border-b [&_tr]:border-border", className), ...props });
1938
+ }
1939
+ );
1940
+ var TableBody = forwardRef(
1941
+ function TableBody2({ className, ...props }, ref) {
1942
+ return /* @__PURE__ */ jsx("tbody", { ref, className: cn("[&_tr:last-child]:border-0", className), ...props });
1943
+ }
1944
+ );
1945
+ var TableFooter = forwardRef(
1946
+ function TableFooter2({ className, ...props }, ref) {
1947
+ return /* @__PURE__ */ jsx(
1948
+ "tfoot",
1949
+ {
1950
+ ref,
1951
+ className: cn("border-t border-border bg-surface-muted/50 font-medium", className),
1952
+ ...props
1953
+ }
1954
+ );
1955
+ }
1956
+ );
1957
+ var TableRow = forwardRef(
1958
+ function TableRow2({ className, ...props }, ref) {
1959
+ return /* @__PURE__ */ jsx(
1960
+ "tr",
1961
+ {
1962
+ ref,
1963
+ className: cn(
1964
+ "border-b border-border transition-colors duration-fast",
1965
+ "hover:bg-surface-muted/60 data-[state=selected]:bg-primary-soft",
1966
+ className
1967
+ ),
1968
+ ...props
1969
+ }
1970
+ );
1971
+ }
1972
+ );
1973
+ var TableHead = forwardRef(
1974
+ function TableHead2({ className, ...props }, ref) {
1975
+ return /* @__PURE__ */ jsx(
1976
+ "th",
1977
+ {
1978
+ ref,
1979
+ className: cn(
1980
+ "h-10 px-3 text-left align-middle text-[11px] font-semibold uppercase tracking-wider text-fg-subtle",
1981
+ "[&:has([role=checkbox])]:pr-0",
1982
+ className
1983
+ ),
1984
+ ...props
1985
+ }
1986
+ );
1987
+ }
1988
+ );
1989
+ var TableCell = forwardRef(
1990
+ function TableCell2({ className, ...props }, ref) {
1991
+ return /* @__PURE__ */ jsx("td", { ref, className: cn("p-3 align-middle [&:has([role=checkbox])]:pr-0", className), ...props });
1992
+ }
1993
+ );
1994
+ var TableCaption = forwardRef(
1995
+ function TableCaption2({ className, ...props }, ref) {
1996
+ return /* @__PURE__ */ jsx("caption", { ref, className: cn("mt-4 text-sm text-fg-muted", className), ...props });
1997
+ }
1998
+ );
1999
+ var Tabs = TabsPrimitive.Root;
2000
+ var TabsList = forwardRef(function TabsList2({ className, variant = "underline", ...props }, ref) {
2001
+ return /* @__PURE__ */ jsx(
2002
+ TabsPrimitive.List,
2003
+ {
2004
+ ref,
2005
+ "data-variant": variant,
2006
+ className: cn(
2007
+ "inline-flex items-center",
2008
+ variant === "underline" && "h-10 gap-6 border-b border-border w-full",
2009
+ variant === "pill" && "h-10 rounded-md bg-surface-muted p-1 gap-1",
2010
+ className
2011
+ ),
2012
+ ...props
2013
+ }
2014
+ );
2015
+ });
2016
+ var TabsTrigger = forwardRef(function TabsTrigger2({ className, ...props }, ref) {
2017
+ return /* @__PURE__ */ jsx(
2018
+ TabsPrimitive.Trigger,
2019
+ {
2020
+ ref,
2021
+ className: cn(
2022
+ "inline-flex items-center justify-center whitespace-nowrap text-sm font-medium",
2023
+ "transition-colors duration-fast focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
2024
+ "disabled:pointer-events-none disabled:opacity-50",
2025
+ // underline variant (default)
2026
+ "[[data-variant=underline]_&]:px-1 [[data-variant=underline]_&]:py-2.5",
2027
+ "[[data-variant=underline]_&]:text-fg-muted [[data-variant=underline]_&]:border-b-2 [[data-variant=underline]_&]:border-transparent",
2028
+ "[[data-variant=underline]_&]:data-[state=active]:text-fg [[data-variant=underline]_&]:data-[state=active]:border-primary",
2029
+ // pill variant
2030
+ "[[data-variant=pill]_&]:rounded [[data-variant=pill]_&]:px-3.5 [[data-variant=pill]_&]:py-1.5",
2031
+ "[[data-variant=pill]_&]:text-fg-muted",
2032
+ "[[data-variant=pill]_&]:data-[state=active]:bg-surface [[data-variant=pill]_&]:data-[state=active]:text-fg [[data-variant=pill]_&]:data-[state=active]:shadow-xs",
2033
+ className
2034
+ ),
2035
+ ...props
2036
+ }
2037
+ );
2038
+ });
2039
+ var TabsContent = forwardRef(function TabsContent2({ className, ...props }, ref) {
2040
+ return /* @__PURE__ */ jsx(
2041
+ TabsPrimitive.Content,
2042
+ {
2043
+ ref,
2044
+ className: cn(
2045
+ "mt-4 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring rounded-md",
2046
+ className
2047
+ ),
2048
+ ...props
2049
+ }
2050
+ );
2051
+ });
2052
+ var Textarea = forwardRef(function Textarea2({ className, invalid, ...props }, ref) {
2053
+ return /* @__PURE__ */ jsx(
2054
+ "textarea",
2055
+ {
2056
+ ref,
2057
+ "data-invalid": invalid || void 0,
2058
+ className: cn(
2059
+ "flex min-h-[88px] w-full rounded-md border bg-surface px-3 py-2.5 text-sm text-fg",
2060
+ "transition-colors duration-fast placeholder:text-fg-subtle resize-y",
2061
+ "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-bg",
2062
+ "disabled:cursor-not-allowed disabled:opacity-60 disabled:bg-surface-muted",
2063
+ invalid ? "border-danger focus-visible:ring-danger" : "border-border-strong",
2064
+ className
2065
+ ),
2066
+ ...props
2067
+ }
2068
+ );
2069
+ });
2070
+
2071
+ // src/components/toggle/toggle.variants.ts
2072
+ var toggleVariants = cva(
2073
+ [
2074
+ "inline-flex items-center justify-center gap-2 rounded-md text-sm font-medium",
2075
+ "transition-colors duration-fast",
2076
+ "hover:bg-surface-muted hover:text-fg",
2077
+ "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-bg",
2078
+ "disabled:pointer-events-none disabled:opacity-50",
2079
+ "data-[state=on]:bg-primary-soft data-[state=on]:text-primary",
2080
+ "[&_svg]:pointer-events-none [&_svg]:shrink-0"
2081
+ ],
2082
+ {
2083
+ variants: {
2084
+ variant: {
2085
+ default: "bg-transparent",
2086
+ outline: "border border-border-strong bg-transparent"
2087
+ },
2088
+ size: {
2089
+ sm: "h-8 min-w-8 px-2 [&_svg]:size-3.5",
2090
+ md: "h-10 min-w-10 px-2.5 [&_svg]:size-4",
2091
+ lg: "h-12 min-w-12 px-4 [&_svg]:size-5"
2092
+ }
2093
+ },
2094
+ defaultVariants: { variant: "default", size: "md" }
2095
+ }
2096
+ );
2097
+ var Toggle = forwardRef(
2098
+ function Toggle2({ className, variant, size, ...props }, ref) {
2099
+ return /* @__PURE__ */ jsx(
2100
+ TogglePrimitive.Root,
2101
+ {
2102
+ ref,
2103
+ className: cn(toggleVariants({ variant, size }), className),
2104
+ ...props
2105
+ }
2106
+ );
2107
+ }
2108
+ );
2109
+ var ToggleGroupContext = createContext({ variant: "default", size: "md" });
2110
+ var ToggleGroup = forwardRef(function ToggleGroup2({ className, variant, size, children, ...props }, ref) {
2111
+ return /* @__PURE__ */ jsx(
2112
+ ToggleGroupPrimitive.Root,
2113
+ {
2114
+ ref,
2115
+ className: cn("inline-flex items-center gap-1 rounded-md bg-surface-muted p-1", className),
2116
+ ...props,
2117
+ children: /* @__PURE__ */ jsx(ToggleGroupContext.Provider, { value: { variant, size }, children })
2118
+ }
2119
+ );
2120
+ });
2121
+ var ToggleGroupItem = forwardRef(function ToggleGroupItem2({ className, variant, size, children, ...props }, ref) {
2122
+ const ctx = useContext(ToggleGroupContext);
2123
+ return /* @__PURE__ */ jsx(
2124
+ ToggleGroupPrimitive.Item,
2125
+ {
2126
+ ref,
2127
+ className: cn(
2128
+ toggleVariants({ variant: variant ?? ctx.variant, size: size ?? ctx.size }),
2129
+ "data-[state=on]:bg-surface data-[state=on]:shadow-xs",
2130
+ className
2131
+ ),
2132
+ ...props,
2133
+ children
2134
+ }
2135
+ );
2136
+ });
2137
+ var TooltipProvider = TooltipPrimitive.Provider;
2138
+ var Tooltip = TooltipPrimitive.Root;
2139
+ var TooltipTrigger = TooltipPrimitive.Trigger;
2140
+ var TooltipContent = forwardRef(function TooltipContent2({ className, sideOffset = 6, ...props }, ref) {
2141
+ return /* @__PURE__ */ jsx(TooltipPrimitive.Portal, { children: /* @__PURE__ */ jsx(
2142
+ TooltipPrimitive.Content,
2143
+ {
2144
+ ref,
2145
+ sideOffset,
2146
+ className: cn(
2147
+ "z-dropdown overflow-hidden rounded-md bg-fg px-2.5 py-1.5 text-xs text-bg shadow-md",
2148
+ "animate-fade-in data-[state=closed]:animate-fade-out",
2149
+ className
2150
+ ),
2151
+ ...props
2152
+ }
2153
+ ) });
2154
+ });
2155
+ var VisuallyHidden = VisuallyHiddenPrimitive.Root;
2156
+ function useDisclosure(initial = false) {
2157
+ const [isOpen, setOpen] = useState(initial);
2158
+ return {
2159
+ isOpen,
2160
+ open: useCallback(() => setOpen(true), []),
2161
+ close: useCallback(() => setOpen(false), []),
2162
+ toggle: useCallback(() => setOpen((v) => !v), []),
2163
+ setOpen
2164
+ };
2165
+ }
2166
+ function useMediaQuery(query) {
2167
+ const [matches, setMatches] = useState(() => {
2168
+ if (typeof window === "undefined") return false;
2169
+ return window.matchMedia(query).matches;
2170
+ });
2171
+ useEffect(() => {
2172
+ if (typeof window === "undefined") return;
2173
+ const mq = window.matchMedia(query);
2174
+ const onChange = (e) => setMatches(e.matches);
2175
+ setMatches(mq.matches);
2176
+ mq.addEventListener("change", onChange);
2177
+ return () => mq.removeEventListener("change", onChange);
2178
+ }, [query]);
2179
+ return matches;
2180
+ }
2181
+ var useBreakpoint = {
2182
+ sm: () => useMediaQuery("(min-width: 640px)"),
2183
+ md: () => useMediaQuery("(min-width: 768px)"),
2184
+ lg: () => useMediaQuery("(min-width: 1024px)"),
2185
+ xl: () => useMediaQuery("(min-width: 1280px)"),
2186
+ "2xl": () => useMediaQuery("(min-width: 1536px)")
2187
+ };
2188
+ function useDebounce(value, delay = 300) {
2189
+ const [debounced, setDebounced] = useState(value);
2190
+ useEffect(() => {
2191
+ const id = setTimeout(() => setDebounced(value), delay);
2192
+ return () => clearTimeout(id);
2193
+ }, [value, delay]);
2194
+ return debounced;
2195
+ }
2196
+ function useLocalStorage(key, initialValue) {
2197
+ const [value, setValue] = useState(() => {
2198
+ if (typeof window === "undefined") return initialValue;
2199
+ try {
2200
+ const raw = window.localStorage.getItem(key);
2201
+ return raw ? JSON.parse(raw) : initialValue;
2202
+ } catch {
2203
+ return initialValue;
2204
+ }
2205
+ });
2206
+ useEffect(() => {
2207
+ if (typeof window === "undefined") return;
2208
+ try {
2209
+ window.localStorage.setItem(key, JSON.stringify(value));
2210
+ } catch {
2211
+ }
2212
+ }, [key, value]);
2213
+ const remove = useCallback(() => {
2214
+ if (typeof window === "undefined") return;
2215
+ window.localStorage.removeItem(key);
2216
+ setValue(initialValue);
2217
+ }, [key, initialValue]);
2218
+ return [value, setValue, remove];
2219
+ }
2220
+ function useClickOutside(ref, handler, enabled = true) {
2221
+ useEffect(() => {
2222
+ if (!enabled) return;
2223
+ const listener = (event) => {
2224
+ const el = ref.current;
2225
+ if (!el || el.contains(event.target)) return;
2226
+ handler(event);
2227
+ };
2228
+ document.addEventListener("mousedown", listener);
2229
+ document.addEventListener("touchstart", listener, { passive: true });
2230
+ return () => {
2231
+ document.removeEventListener("mousedown", listener);
2232
+ document.removeEventListener("touchstart", listener);
2233
+ };
2234
+ }, [ref, handler, enabled]);
2235
+ }
2236
+ function useToggle(initial = false) {
2237
+ const [value, setValue] = useState(initial);
2238
+ const toggle = useCallback(() => setValue((v) => !v), []);
2239
+ return [value, toggle, setValue];
2240
+ }
2241
+
2242
+ export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, Alert, AlertDescription, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, AlertTitle, Avatar, AvatarFallback, AvatarImage, Badge, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Button, Calendar, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Checkbox, ChipSelector, Collapsible, CollapsibleContent, CollapsibleTrigger, Combobox, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, ContextMenu, ContextMenuCheckboxItem, ContextMenuContent, ContextMenuGroup, ContextMenuItem, ContextMenuLabel, ContextMenuPortal, ContextMenuRadioGroup, ContextMenuRadioItem, ContextMenuSeparator, ContextMenuShortcut, ContextMenuSub, ContextMenuSubContent, ContextMenuSubTrigger, ContextMenuTrigger, DateRangePill, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, EmptyState, FileDropzone, FloatingDatePicker, FloatingFileInput, FloatingInput, FloatingSelect, FloatingTextarea, Form, FormControl, FormDescription, FormField, FormLabel, FormMessage, HoverCard, HoverCardContent, HoverCardTrigger, Input, Label3 as Label, Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious, Popover, PopoverAnchor, PopoverContent, PopoverTrigger, Progress, RadioGroup3 as RadioGroup, RadioGroupItem, RichTextEditor, ScrollArea, ScrollBar, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectSeparator, SelectTrigger, SelectValue, Separator4 as Separator, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetOverlay, SheetPortal, SheetTitle, SheetTrigger, Skeleton, Slider, Spinner, Switch, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, Textarea, Toaster, Toggle, ToggleGroup, ToggleGroupItem, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, VisuallyHidden, alertVariants, badgeVariants, buttonVariants, cn, inputVariants, toggleVariants, useBreakpoint, useClickOutside, useDebounce, useDisclosure, useLocalStorage, useMediaQuery, useTheme, useToggle };
2243
+ //# sourceMappingURL=index.js.map
2244
+ //# sourceMappingURL=index.js.map