@agroshine/ags-web-ui-kit 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (109) hide show
  1. package/README.md +75 -0
  2. package/dist/atoms/index.cjs +134 -0
  3. package/dist/atoms/index.cjs.map +1 -0
  4. package/dist/atoms/index.d.cts +583 -0
  5. package/dist/atoms/index.d.ts +583 -0
  6. package/dist/atoms/index.js +9 -0
  7. package/dist/atoms/index.js.map +1 -0
  8. package/dist/chunk-2KRMLIJQ.cjs +52 -0
  9. package/dist/chunk-2KRMLIJQ.cjs.map +1 -0
  10. package/dist/chunk-2TBYPKQ3.cjs +79 -0
  11. package/dist/chunk-2TBYPKQ3.cjs.map +1 -0
  12. package/dist/chunk-5FWELSEZ.js +1296 -0
  13. package/dist/chunk-5FWELSEZ.js.map +1 -0
  14. package/dist/chunk-5PEOJVY7.cjs +1502 -0
  15. package/dist/chunk-5PEOJVY7.cjs.map +1 -0
  16. package/dist/chunk-6LUGTNMH.js +259 -0
  17. package/dist/chunk-6LUGTNMH.js.map +1 -0
  18. package/dist/chunk-6O2IDBTX.js +112 -0
  19. package/dist/chunk-6O2IDBTX.js.map +1 -0
  20. package/dist/chunk-6YUNWKT3.js +26 -0
  21. package/dist/chunk-6YUNWKT3.js.map +1 -0
  22. package/dist/chunk-7R6OXNES.cjs +321 -0
  23. package/dist/chunk-7R6OXNES.cjs.map +1 -0
  24. package/dist/chunk-A3A7PJWG.cjs +13 -0
  25. package/dist/chunk-A3A7PJWG.cjs.map +1 -0
  26. package/dist/chunk-A7TDGQAB.js +557 -0
  27. package/dist/chunk-A7TDGQAB.js.map +1 -0
  28. package/dist/chunk-C4LX3XTN.cjs +1187 -0
  29. package/dist/chunk-C4LX3XTN.cjs.map +1 -0
  30. package/dist/chunk-DZW4GS2T.cjs +1340 -0
  31. package/dist/chunk-DZW4GS2T.cjs.map +1 -0
  32. package/dist/chunk-E3BTK736.cjs +174 -0
  33. package/dist/chunk-E3BTK736.cjs.map +1 -0
  34. package/dist/chunk-ERGKCXM2.cjs +267 -0
  35. package/dist/chunk-ERGKCXM2.cjs.map +1 -0
  36. package/dist/chunk-FOA46NSG.cjs +574 -0
  37. package/dist/chunk-FOA46NSG.cjs.map +1 -0
  38. package/dist/chunk-JTFCE6RA.js +1156 -0
  39. package/dist/chunk-JTFCE6RA.js.map +1 -0
  40. package/dist/chunk-KINOE57L.js +225 -0
  41. package/dist/chunk-KINOE57L.js.map +1 -0
  42. package/dist/chunk-MOED3QPY.js +11 -0
  43. package/dist/chunk-MOED3QPY.js.map +1 -0
  44. package/dist/chunk-NVR34DY2.cjs +4 -0
  45. package/dist/chunk-NVR34DY2.cjs.map +1 -0
  46. package/dist/chunk-PI3IJWBG.js +79 -0
  47. package/dist/chunk-PI3IJWBG.js.map +1 -0
  48. package/dist/chunk-PXAMTGYY.js +3 -0
  49. package/dist/chunk-PXAMTGYY.js.map +1 -0
  50. package/dist/chunk-QAZMI5VH.js +151 -0
  51. package/dist/chunk-QAZMI5VH.js.map +1 -0
  52. package/dist/chunk-QEG27NX6.js +30 -0
  53. package/dist/chunk-QEG27NX6.js.map +1 -0
  54. package/dist/chunk-THTOUSMG.cjs +52 -0
  55. package/dist/chunk-THTOUSMG.cjs.map +1 -0
  56. package/dist/chunk-UAXKB6IH.cjs +32 -0
  57. package/dist/chunk-UAXKB6IH.cjs.map +1 -0
  58. package/dist/chunk-W5IHWAMM.js +48 -0
  59. package/dist/chunk-W5IHWAMM.js.map +1 -0
  60. package/dist/chunk-X2UJQVZJ.cjs +139 -0
  61. package/dist/chunk-X2UJQVZJ.cjs.map +1 -0
  62. package/dist/chunk-X43C5OJD.js +1460 -0
  63. package/dist/chunk-X43C5OJD.js.map +1 -0
  64. package/dist/chunk-XCYSBWV4.js +56 -0
  65. package/dist/chunk-XCYSBWV4.js.map +1 -0
  66. package/dist/chunk-XX4CBCEB.cjs +102 -0
  67. package/dist/chunk-XX4CBCEB.cjs.map +1 -0
  68. package/dist/hooks/index.cjs +33 -0
  69. package/dist/hooks/index.cjs.map +1 -0
  70. package/dist/hooks/index.d.cts +59 -0
  71. package/dist/hooks/index.d.ts +59 -0
  72. package/dist/hooks/index.js +4 -0
  73. package/dist/hooks/index.js.map +1 -0
  74. package/dist/index.cjs +366 -0
  75. package/dist/index.cjs.map +1 -0
  76. package/dist/index.d.cts +13 -0
  77. package/dist/index.d.ts +13 -0
  78. package/dist/index.js +17 -0
  79. package/dist/index.js.map +1 -0
  80. package/dist/interface-DnK5S6ww.d.cts +51 -0
  81. package/dist/interface-DnK5S6ww.d.ts +51 -0
  82. package/dist/lib/index.cjs +13 -0
  83. package/dist/lib/index.cjs.map +1 -0
  84. package/dist/lib/index.d.cts +5 -0
  85. package/dist/lib/index.d.ts +5 -0
  86. package/dist/lib/index.js +4 -0
  87. package/dist/lib/index.js.map +1 -0
  88. package/dist/molecules/index.cjs +123 -0
  89. package/dist/molecules/index.cjs.map +1 -0
  90. package/dist/molecules/index.d.cts +449 -0
  91. package/dist/molecules/index.d.ts +449 -0
  92. package/dist/molecules/index.js +10 -0
  93. package/dist/molecules/index.js.map +1 -0
  94. package/dist/organisms/index.cjs +102 -0
  95. package/dist/organisms/index.cjs.map +1 -0
  96. package/dist/organisms/index.d.cts +396 -0
  97. package/dist/organisms/index.d.ts +396 -0
  98. package/dist/organisms/index.js +9 -0
  99. package/dist/organisms/index.js.map +1 -0
  100. package/dist/tooltip-Bl2ZTtfg.d.cts +16 -0
  101. package/dist/tooltip-Bl2ZTtfg.d.ts +16 -0
  102. package/dist/ui/index.cjs +955 -0
  103. package/dist/ui/index.cjs.map +1 -0
  104. package/dist/ui/index.d.cts +252 -0
  105. package/dist/ui/index.d.ts +252 -0
  106. package/dist/ui/index.js +642 -0
  107. package/dist/ui/index.js.map +1 -0
  108. package/package.json +200 -0
  109. package/tailwind.preset.cjs +134 -0
@@ -0,0 +1,1296 @@
1
+ import { Pagination } from './chunk-A7TDGQAB.js';
2
+ import { Button as Button$1, Spinner } from './chunk-QAZMI5VH.js';
3
+ import { Card, HoverCard, HoverCardTrigger, HoverCardContent, Tabs, TabsList, TabsTrigger, TabsContent, Tooltip, TooltipTrigger, TooltipContent, TooltipProvider, Sheet, SheetContent, Dialog, DialogContent, DialogHeader, DialogTitle, DialogFooter } from './chunk-6LUGTNMH.js';
4
+ import { Popover, PopoverTrigger, PopoverContent } from './chunk-6YUNWKT3.js';
5
+ import { Button } from './chunk-XCYSBWV4.js';
6
+ import { useResponsive, usePagination } from './chunk-PI3IJWBG.js';
7
+ import { cn } from './chunk-MOED3QPY.js';
8
+ import * as React5 from 'react';
9
+ import React5__default, { forwardRef, createContext, useContext, useState, useMemo } from 'react';
10
+ import { X, TrendingUp, TrendingDown, XCircle, AlertCircle, CheckCircle2, Info, ChevronRight, Inbox, ArrowUp, ArrowDown, ArrowUpDown } from 'lucide-react';
11
+ import { cva } from 'class-variance-authority';
12
+ import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
13
+ import { faTimes } from '@fortawesome/free-solid-svg-icons';
14
+ import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
15
+ import clsx2 from 'clsx';
16
+
17
+ var alertVariants = cva(
18
+ "relative grid w-full grid-cols-[18px_1fr] items-start gap-3 rounded-md border px-4 py-3.5",
19
+ {
20
+ variants: {
21
+ variant: {
22
+ // Canon default: neutral, sin tinte.
23
+ default: "border-border bg-background text-foreground",
24
+ // Canon extra (compat AgroShine — primary-tinted).
25
+ info: "border-primary-200 bg-primary-50 text-primary-700",
26
+ success: "border-success-200 bg-success-50 text-success-700",
27
+ warning: "border-warning-100 bg-warning-50 text-warning-800",
28
+ destructive: "border-destructive bg-destructive/[0.05] text-destructive",
29
+ // Alias compat.
30
+ danger: "border-destructive bg-destructive/[0.05] text-destructive"
31
+ }
32
+ },
33
+ defaultVariants: { variant: "default" }
34
+ }
35
+ );
36
+ var alertIconVariants = cva(
37
+ "flex h-[18px] w-[18px] shrink-0 items-center justify-center text-[16px] leading-none [&_svg]:h-[18px] [&_svg]:w-[18px]",
38
+ {
39
+ variants: {
40
+ variant: {
41
+ default: "text-foreground",
42
+ info: "text-primary-700",
43
+ success: "text-success-700",
44
+ warning: "text-warning-800",
45
+ destructive: "text-destructive",
46
+ danger: "text-destructive"
47
+ }
48
+ },
49
+ defaultVariants: { variant: "default" }
50
+ }
51
+ );
52
+ var ICON_MAP = {
53
+ default: Info,
54
+ info: Info,
55
+ success: CheckCircle2,
56
+ warning: AlertCircle,
57
+ destructive: XCircle,
58
+ danger: XCircle
59
+ };
60
+ var Alert = React5.forwardRef(
61
+ ({
62
+ variant = "default",
63
+ title,
64
+ description,
65
+ icon = true,
66
+ closable,
67
+ onClose,
68
+ className,
69
+ children
70
+ }, ref) => {
71
+ const renderIcon = () => {
72
+ if (icon === false) return null;
73
+ if (icon === true) {
74
+ const IconComponent = ICON_MAP[variant];
75
+ return /* @__PURE__ */ jsx(IconComponent, {});
76
+ }
77
+ return icon;
78
+ };
79
+ const iconNode = renderIcon();
80
+ return /* @__PURE__ */ jsxs("div", { ref, role: "alert", className: cn(alertVariants({ variant }), className), children: [
81
+ iconNode !== null && /* @__PURE__ */ jsx("span", { className: alertIconVariants({ variant }), children: iconNode }),
82
+ /* @__PURE__ */ jsxs("div", { className: "min-w-0", children: [
83
+ title && // .at: font-weight 600, font-size 14px, margin 0 0 4px
84
+ /* @__PURE__ */ jsx("h4", { className: "m-0 mb-1 text-sm font-semibold leading-tight", children: title }),
85
+ description && // .ad: font-size 13px, color muted-foreground, line-height 1.5
86
+ /* @__PURE__ */ jsx("p", { className: "m-0 text-[13px] leading-normal text-muted-foreground", children: description }),
87
+ children
88
+ ] }),
89
+ closable && /* @__PURE__ */ jsx(
90
+ "button",
91
+ {
92
+ type: "button",
93
+ "aria-label": "Cerrar",
94
+ onClick: onClose,
95
+ className: "-mr-1 -mt-1 shrink-0 rounded-sm p-1 opacity-70 transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring",
96
+ children: /* @__PURE__ */ jsx(X, { className: "h-4 w-4" })
97
+ }
98
+ )
99
+ ] });
100
+ }
101
+ );
102
+ Alert.displayName = "Alert";
103
+ var ELLIPSIS_KEY = "__ellipsis__";
104
+ function collapseItems(items, maxItems) {
105
+ if (!maxItems || items.length <= maxItems) return items;
106
+ const first = items[0];
107
+ const lastTwo = items.slice(-2);
108
+ return [first, null, ...lastTwo];
109
+ }
110
+ var Breadcrumb = React5.forwardRef(
111
+ ({ items, separator, maxItems, className, onItemClick }, ref) => {
112
+ const sep = separator ?? /* @__PURE__ */ jsx(ChevronRight, { className: "h-3.5 w-3.5 text-default-500" });
113
+ const visible = collapseItems(items, maxItems);
114
+ return /* @__PURE__ */ jsx("nav", { ref, "aria-label": "Breadcrumb", className: cn("w-full", className), children: /* @__PURE__ */ jsx("ol", { className: "flex flex-wrap items-center gap-1.5 text-sm", children: visible.map((item, idx) => {
115
+ const isLast = idx === visible.length - 1;
116
+ const key = item === null ? `${ELLIPSIS_KEY}-${idx}` : `${idx}-${String(item.label)}`;
117
+ return /* @__PURE__ */ jsxs("li", { className: "flex items-center gap-1.5", children: [
118
+ item === null ? /* @__PURE__ */ jsx("span", { className: "text-default-500 px-1", children: "\u2026" }) : isLast ? /* @__PURE__ */ jsxs(
119
+ "span",
120
+ {
121
+ "aria-current": "page",
122
+ className: "flex items-center gap-1 font-medium text-default-900",
123
+ children: [
124
+ item.icon,
125
+ item.label
126
+ ]
127
+ }
128
+ ) : item.href ? /* @__PURE__ */ jsxs(
129
+ "a",
130
+ {
131
+ href: item.href,
132
+ onClick: onItemClick ? () => onItemClick(item, idx) : void 0,
133
+ className: "flex items-center gap-1 text-default-700 hover:text-primary transition-colors",
134
+ children: [
135
+ item.icon,
136
+ item.label
137
+ ]
138
+ }
139
+ ) : /* @__PURE__ */ jsxs(
140
+ "button",
141
+ {
142
+ type: "button",
143
+ onClick: onItemClick ? () => onItemClick(item, idx) : void 0,
144
+ className: "flex items-center gap-1 text-default-700 hover:text-primary transition-colors",
145
+ children: [
146
+ item.icon,
147
+ item.label
148
+ ]
149
+ }
150
+ ),
151
+ !isLast && /* @__PURE__ */ jsx("span", { className: "text-default-400", children: sep })
152
+ ] }, key);
153
+ }) }) });
154
+ }
155
+ );
156
+ Breadcrumb.displayName = "Breadcrumb";
157
+ var variantClasses = {
158
+ default: "",
159
+ flush: "overflow-hidden",
160
+ interactive: "cursor-pointer transition-shadow hover:shadow-md focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2"
161
+ };
162
+ var Card2 = forwardRef(function Card3({ variant = "default", className, onClick, children, ...rest }, ref) {
163
+ const isInteractive = variant === "interactive" || Boolean(onClick);
164
+ return /* @__PURE__ */ jsx(
165
+ Card,
166
+ {
167
+ ref,
168
+ onClick,
169
+ role: isInteractive ? "button" : void 0,
170
+ tabIndex: isInteractive ? 0 : void 0,
171
+ className: cn(variantClasses[variant], className),
172
+ ...rest,
173
+ children
174
+ }
175
+ );
176
+ });
177
+ var sizeMap = {
178
+ xs: "sm:max-w-xs",
179
+ sm: "sm:max-w-sm",
180
+ md: "sm:max-w-md",
181
+ lg: "sm:max-w-lg",
182
+ xl: "sm:max-w-xl"
183
+ };
184
+ var Drawer = ({
185
+ visible,
186
+ onClose,
187
+ title,
188
+ description,
189
+ children,
190
+ size = "xl",
191
+ placement = "right",
192
+ footer,
193
+ extra
194
+ }) => {
195
+ const isHorizontal = placement === "left" || placement === "right";
196
+ return /* @__PURE__ */ jsx(Sheet, { open: visible, onOpenChange: (open) => !open && onClose(), children: /* @__PURE__ */ jsxs(
197
+ SheetContent,
198
+ {
199
+ side: placement,
200
+ hideCloseButton: true,
201
+ className: cn(
202
+ "p-0 flex flex-col rounded-none",
203
+ isHorizontal ? sizeMap[size] : "",
204
+ isHorizontal ? "w-full" : "h-auto"
205
+ ),
206
+ children: [
207
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between px-8 py-8 border-b", children: [
208
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col", children: [
209
+ /* @__PURE__ */ jsx("span", { className: "text-[20px] font-bold", children: title }),
210
+ description && /* @__PURE__ */ jsx("h2", { className: "text-[14px] font-medium text-[#00000080]", children: description })
211
+ ] }),
212
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center", children: [
213
+ extra && Array.isArray(extra) ? /* @__PURE__ */ jsx("div", { className: "shrink-0", children: extra.map((item, index) => /* @__PURE__ */ jsx("div", { children: item }, index)) }) : /* @__PURE__ */ jsx("div", { className: "shrink-0", children: extra }),
214
+ /* @__PURE__ */ jsx(
215
+ "div",
216
+ {
217
+ className: "flex p-[10px] rounded-[6px] hover:cursor-pointer hover:bg-primary-50",
218
+ onClick: onClose,
219
+ children: /* @__PURE__ */ jsx(FontAwesomeIcon, { size: "xl", icon: faTimes })
220
+ }
221
+ )
222
+ ] })
223
+ ] }),
224
+ /* @__PURE__ */ jsx("div", { className: "flex-1 overflow-auto px-8 py-8", children }),
225
+ footer && /* @__PURE__ */ jsx("div", { className: "flex justify-end px-8 py-[15px] border-t", children: footer })
226
+ ]
227
+ }
228
+ ) });
229
+ };
230
+ var Drawer_default = Drawer;
231
+ var Empty = React5.forwardRef(
232
+ ({ title = "Sin datos", description, icon, action, className }, ref) => {
233
+ const iconNode = icon ?? /* @__PURE__ */ jsx(Inbox, { className: "h-12 w-12" });
234
+ return /* @__PURE__ */ jsxs(
235
+ "div",
236
+ {
237
+ ref,
238
+ className: cn(
239
+ "flex flex-col items-center justify-center px-5 py-12 text-center text-muted-foreground",
240
+ className
241
+ ),
242
+ children: [
243
+ /* @__PURE__ */ jsx("div", { className: "mb-2 flex items-center justify-center text-muted-foreground opacity-40", children: iconNode }),
244
+ /* @__PURE__ */ jsx("div", { className: "text-sm font-medium text-foreground", children: title }),
245
+ description && /* @__PURE__ */ jsx("p", { className: "mt-1 max-w-sm text-[13px] text-muted-foreground", children: description }),
246
+ action && /* @__PURE__ */ jsx("div", { className: "mt-3.5 flex items-center justify-center gap-2", children: action })
247
+ ]
248
+ }
249
+ );
250
+ }
251
+ );
252
+ Empty.displayName = "Empty";
253
+ var HoverCard2 = React5.forwardRef(
254
+ ({
255
+ trigger,
256
+ children,
257
+ side = "bottom",
258
+ align = "center",
259
+ openDelay = 200,
260
+ closeDelay = 150,
261
+ open,
262
+ defaultOpen,
263
+ onOpenChange,
264
+ className,
265
+ asChild = true
266
+ }, ref) => {
267
+ return /* @__PURE__ */ jsxs(
268
+ HoverCard,
269
+ {
270
+ openDelay,
271
+ closeDelay,
272
+ open,
273
+ defaultOpen,
274
+ onOpenChange,
275
+ children: [
276
+ /* @__PURE__ */ jsx(HoverCardTrigger, { asChild, children: trigger }),
277
+ /* @__PURE__ */ jsx(HoverCardContent, { ref, side, align, className: cn(className), children })
278
+ ]
279
+ }
280
+ );
281
+ }
282
+ );
283
+ HoverCard2.displayName = "HoverCard";
284
+ var ListSizeContext = createContext("default");
285
+ var SIZE_CLASSES = {
286
+ // .list-sm .list-item { padding:8px 12px; gap:10px; }
287
+ small: "gap-2.5 px-3 py-2 [&_.li-title]:text-[13px]",
288
+ // canon default: padding 14px 16px; gap 14px
289
+ default: "gap-3.5 px-4 py-3.5",
290
+ // .list-lg .list-item { padding:18px 18px; }
291
+ large: "gap-4 px-4 py-4"
292
+ };
293
+ var ListItem = forwardRef(function ListItem2({ avatar, title, description, extra, actions, children, className, ...rest }, ref) {
294
+ const hasSlots = Boolean(avatar || title || description || extra || actions);
295
+ const size = useContext(ListSizeContext);
296
+ return /* @__PURE__ */ jsx(
297
+ "div",
298
+ {
299
+ ref,
300
+ "data-list-item": true,
301
+ className: cn(
302
+ "flex items-center border-b border-border transition-colors last:border-b-0 hover:bg-muted/40",
303
+ SIZE_CLASSES[size],
304
+ className
305
+ ),
306
+ ...rest,
307
+ children: hasSlots ? /* @__PURE__ */ jsxs(Fragment, { children: [
308
+ /* @__PURE__ */ jsxs("div", { className: "flex min-w-0 flex-1 items-center gap-3", children: [
309
+ avatar && /* @__PURE__ */ jsx("div", { className: "shrink-0", children: avatar }),
310
+ (title || description) && /* @__PURE__ */ jsxs("div", { className: "min-w-0 flex-1", children: [
311
+ title && /* @__PURE__ */ jsx("h4", { className: "li-title m-0 truncate text-sm font-semibold text-foreground", children: title }),
312
+ description && /* @__PURE__ */ jsx("p", { className: "m-0 mt-0.5 text-[12.5px] leading-snug text-muted-foreground", children: description })
313
+ ] })
314
+ ] }),
315
+ extra !== void 0 && extra !== null && /* @__PURE__ */ jsx("div", { className: "shrink-0 text-[13px] text-muted-foreground", children: extra }),
316
+ actions !== void 0 && actions !== null && /* @__PURE__ */ jsx("div", { className: "flex shrink-0 items-center gap-1.5", children: actions })
317
+ ] }) : (
318
+ // Modo libre: el consumer renderiza lo que quiera
319
+ children
320
+ )
321
+ }
322
+ );
323
+ });
324
+ ListItem.displayName = "List.Item";
325
+ var ListBase = forwardRef(function List({
326
+ data,
327
+ renderItem,
328
+ children,
329
+ header,
330
+ footer,
331
+ bordered = false,
332
+ size = "default",
333
+ maxVisibleItems,
334
+ readMoreLabel = "",
335
+ onReadMoreClick,
336
+ className,
337
+ ...rest
338
+ }, ref) {
339
+ const visibleItems = data && maxVisibleItems ? data.slice(0, maxVisibleItems) : data;
340
+ const hiddenCount = data && maxVisibleItems && data.length > maxVisibleItems ? data.length - maxVisibleItems : 0;
341
+ return /* @__PURE__ */ jsx(ListSizeContext.Provider, { value: size, children: /* @__PURE__ */ jsxs(
342
+ "div",
343
+ {
344
+ ref,
345
+ className: cn(
346
+ "flex w-full flex-col bg-card text-card-foreground",
347
+ bordered && "overflow-hidden rounded-md border border-border",
348
+ className
349
+ ),
350
+ ...rest,
351
+ children: [
352
+ header !== void 0 && header !== null && /* @__PURE__ */ jsx("div", { className: "border-b border-border bg-muted/40 px-4 py-3 text-[13px] text-muted-foreground", children: header }),
353
+ children,
354
+ visibleItems?.map((item, index) => /* @__PURE__ */ jsx(ListItem, { children: renderItem ? renderItem(item, index) : item.label ?? item.name ?? item.value }, item.key ?? index)),
355
+ hiddenCount > 0 && /* @__PURE__ */ jsxs(
356
+ "button",
357
+ {
358
+ type: "button",
359
+ onClick: onReadMoreClick,
360
+ className: "border-b border-border px-4 py-3 text-left text-[13px] text-muted-foreground transition-colors last:border-b-0 hover:bg-muted/40 hover:text-foreground",
361
+ children: [
362
+ "+",
363
+ hiddenCount,
364
+ readMoreLabel ? `, ${readMoreLabel}` : ""
365
+ ]
366
+ }
367
+ ),
368
+ footer !== void 0 && footer !== null && /* @__PURE__ */ jsx("div", { className: "border-t border-border bg-muted/40 px-4 py-3 text-[13px] text-muted-foreground", children: footer })
369
+ ]
370
+ }
371
+ ) });
372
+ });
373
+ ListBase.displayName = "List";
374
+ var List2 = ListBase;
375
+ List2.Item = ListItem;
376
+ var DeleteModal = ({ isOpen, setIsOpen, deleteData }) => {
377
+ return /* @__PURE__ */ jsx(Dialog, { open: isOpen, onOpenChange: setIsOpen, children: /* @__PURE__ */ jsxs(DialogContent, { className: "bg-white rounded-md", children: [
378
+ /* @__PURE__ */ jsx(DialogHeader, { children: /* @__PURE__ */ jsx(DialogTitle, { children: "Eliminar" }) }),
379
+ /* @__PURE__ */ jsx("div", { className: "py-2", children: /* @__PURE__ */ jsx("p", { children: "Esta seguro que desea eliminar ese registro?" }) }),
380
+ /* @__PURE__ */ jsxs(DialogFooter, { children: [
381
+ /* @__PURE__ */ jsx(Button$1, { variant: "light", onPress: () => setIsOpen(false), children: "Cancelar" }),
382
+ /* @__PURE__ */ jsx(Button$1, { color: "primary", onPress: deleteData, children: "Eliminar" })
383
+ ] })
384
+ ] }) });
385
+ };
386
+ var DeleteModal_default = DeleteModal;
387
+ var sizeMap2 = {
388
+ xs: "max-w-xs",
389
+ sm: "max-w-sm",
390
+ md: "max-w-md",
391
+ lg: "max-w-lg",
392
+ xl: "max-w-xl",
393
+ "5xl": "max-w-5xl"
394
+ };
395
+ var Modal = ({
396
+ visible,
397
+ onClose,
398
+ title,
399
+ children,
400
+ size = "xl",
401
+ footer
402
+ }) => {
403
+ return /* @__PURE__ */ jsx(Dialog, { open: visible, onOpenChange: (open) => !open && onClose(), children: /* @__PURE__ */ jsxs(DialogContent, { hideCloseButton: true, className: cn("w-full", sizeMap2[size]), children: [
404
+ title && /* @__PURE__ */ jsx(DialogHeader, { children: /* @__PURE__ */ jsx(DialogTitle, { children: title }) }),
405
+ /* @__PURE__ */ jsx("div", { className: "py-2", children }),
406
+ /* @__PURE__ */ jsxs(DialogFooter, { children: [
407
+ footer,
408
+ /* @__PURE__ */ jsx(Button$1, { color: "danger", variant: "light", onPress: onClose, children: "Cerrar" })
409
+ ] })
410
+ ] }) });
411
+ };
412
+ var Modal_default = Modal;
413
+ var Popconfirm = React5.forwardRef(
414
+ ({
415
+ title,
416
+ description,
417
+ okText = "Confirmar",
418
+ cancelText = "Cancelar",
419
+ okVariant = "primary",
420
+ onConfirm,
421
+ onCancel,
422
+ icon,
423
+ children,
424
+ side = "top",
425
+ align = "center",
426
+ className,
427
+ asChild = true,
428
+ disabled
429
+ }, ref) => {
430
+ const [open, setOpen] = React5.useState(false);
431
+ const iconNode = icon ?? /* @__PURE__ */ jsx(AlertCircle, { className: "h-4 w-4 text-warning-600 shrink-0 mt-0.5" });
432
+ const handleConfirm = async () => {
433
+ await onConfirm();
434
+ setOpen(false);
435
+ };
436
+ const handleCancel = () => {
437
+ onCancel?.();
438
+ setOpen(false);
439
+ };
440
+ return /* @__PURE__ */ jsxs(Popover, { open, onOpenChange: disabled ? void 0 : setOpen, children: [
441
+ /* @__PURE__ */ jsx(PopoverTrigger, { asChild, children }),
442
+ /* @__PURE__ */ jsxs(PopoverContent, { ref, side, align, className: cn("w-72 p-3", className), children: [
443
+ /* @__PURE__ */ jsxs("div", { className: "flex gap-2 mb-3", children: [
444
+ iconNode,
445
+ /* @__PURE__ */ jsxs("div", { className: "flex-1 min-w-0", children: [
446
+ /* @__PURE__ */ jsx("div", { className: "text-sm font-medium text-default-900", children: title }),
447
+ description && /* @__PURE__ */ jsx("p", { className: "text-xs text-default-700 mt-1", children: description })
448
+ ] })
449
+ ] }),
450
+ /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
451
+ /* @__PURE__ */ jsx(Button, { variant: "ghost", size: "sm", onClick: handleCancel, children: cancelText }),
452
+ /* @__PURE__ */ jsx(
453
+ Button,
454
+ {
455
+ variant: okVariant === "danger" ? "destructive" : "default",
456
+ size: "sm",
457
+ onClick: () => {
458
+ void handleConfirm();
459
+ },
460
+ children: okText
461
+ }
462
+ )
463
+ ] })
464
+ ] })
465
+ ] });
466
+ }
467
+ );
468
+ Popconfirm.displayName = "Popconfirm";
469
+ var Popover2 = React5.forwardRef(
470
+ ({
471
+ trigger,
472
+ children,
473
+ side = "bottom",
474
+ align = "center",
475
+ open,
476
+ defaultOpen,
477
+ onOpenChange,
478
+ className,
479
+ sideOffset = 4,
480
+ asChild = true
481
+ }, ref) => {
482
+ return /* @__PURE__ */ jsxs(Popover, { open, defaultOpen, onOpenChange, children: [
483
+ /* @__PURE__ */ jsx(PopoverTrigger, { asChild, children: trigger }),
484
+ /* @__PURE__ */ jsx(
485
+ PopoverContent,
486
+ {
487
+ ref,
488
+ side,
489
+ align,
490
+ sideOffset,
491
+ className: cn(className),
492
+ children
493
+ }
494
+ )
495
+ ] });
496
+ }
497
+ );
498
+ Popover2.displayName = "Popover";
499
+ var segmentedRootVariants = cva(
500
+ "inline-flex items-center bg-muted rounded-md p-1 gap-0.5",
501
+ {
502
+ variants: {
503
+ size: { sm: "h-8", md: "h-10", lg: "h-12" },
504
+ fullWidth: { true: "flex w-full", false: "" }
505
+ },
506
+ defaultVariants: { size: "md", fullWidth: false }
507
+ }
508
+ );
509
+ var segmentedItemVariants = cva(
510
+ "inline-flex items-center justify-center gap-1.5 rounded-sm font-medium transition-all whitespace-nowrap focus:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:opacity-50 disabled:cursor-not-allowed",
511
+ {
512
+ variants: {
513
+ size: {
514
+ sm: "h-6 px-2.5 text-xs",
515
+ md: "h-8 px-3 text-sm",
516
+ lg: "h-10 px-4 text-base"
517
+ },
518
+ active: {
519
+ true: "bg-background text-foreground shadow-sm",
520
+ false: "text-muted-foreground hover:text-foreground"
521
+ },
522
+ fullWidth: { true: "flex-1", false: "" }
523
+ },
524
+ defaultVariants: { size: "md", active: false, fullWidth: false }
525
+ }
526
+ );
527
+ function SegmentedInner({
528
+ value,
529
+ onChange,
530
+ options,
531
+ size = "md",
532
+ disabled,
533
+ fullWidth = false,
534
+ className
535
+ }, ref) {
536
+ return /* @__PURE__ */ jsx(
537
+ "div",
538
+ {
539
+ ref,
540
+ role: "radiogroup",
541
+ className: cn(segmentedRootVariants({ size, fullWidth }), className),
542
+ children: options.map((option) => {
543
+ const isActive = option.value === value;
544
+ const isDisabled = disabled || option.disabled;
545
+ return /* @__PURE__ */ jsxs(
546
+ "button",
547
+ {
548
+ type: "button",
549
+ role: "radio",
550
+ "aria-checked": isActive,
551
+ disabled: isDisabled,
552
+ onClick: () => onChange(option.value),
553
+ className: segmentedItemVariants({ size, active: isActive, fullWidth }),
554
+ children: [
555
+ option.icon,
556
+ option.label
557
+ ]
558
+ },
559
+ option.value
560
+ );
561
+ })
562
+ }
563
+ );
564
+ }
565
+ var Segmented = React5.forwardRef(SegmentedInner);
566
+ Segmented.displayName = "Segmented";
567
+ function formatValue(value, precision, formatter) {
568
+ if (formatter) return formatter(value);
569
+ if (typeof value === "number" && precision !== void 0) {
570
+ return value.toFixed(precision);
571
+ }
572
+ return String(value);
573
+ }
574
+ var Statistic = React5.forwardRef(
575
+ ({
576
+ title,
577
+ value,
578
+ prefix,
579
+ suffix,
580
+ precision,
581
+ trend,
582
+ trendValue,
583
+ loading,
584
+ formatter,
585
+ className,
586
+ valueClassName
587
+ }, ref) => {
588
+ const formatted = formatValue(value, precision, formatter);
589
+ const trendColor = trend === "up" ? "text-success-600" : trend === "down" ? "text-danger-600" : "";
590
+ const TrendIcon = trend === "up" ? TrendingUp : trend === "down" ? TrendingDown : null;
591
+ return /* @__PURE__ */ jsxs("div", { ref, className: cn("flex flex-col gap-1", className), children: [
592
+ /* @__PURE__ */ jsx("div", { className: "text-sm text-default-700", children: title }),
593
+ loading ? /* @__PURE__ */ jsx("div", { className: "h-8 w-24 rounded bg-default-100 animate-pulse" }) : /* @__PURE__ */ jsxs(
594
+ "div",
595
+ {
596
+ className: cn(
597
+ "text-3xl font-bold text-default-900 flex items-baseline gap-1",
598
+ valueClassName
599
+ ),
600
+ children: [
601
+ prefix && /* @__PURE__ */ jsx("span", { className: "text-xl text-default-700", children: prefix }),
602
+ /* @__PURE__ */ jsx("span", { children: formatted }),
603
+ suffix && /* @__PURE__ */ jsx("span", { className: "text-base text-default-700 font-normal", children: suffix })
604
+ ]
605
+ }
606
+ ),
607
+ trend && trendValue && /* @__PURE__ */ jsxs("div", { className: cn("flex items-center gap-1 text-xs font-medium", trendColor), children: [
608
+ TrendIcon && /* @__PURE__ */ jsx(TrendIcon, { className: "h-3 w-3" }),
609
+ /* @__PURE__ */ jsx("span", { children: trendValue })
610
+ ] })
611
+ ] });
612
+ }
613
+ );
614
+ Statistic.displayName = "Statistic";
615
+ var snumVariants = cva(
616
+ "inline-flex items-center justify-center rounded-full border-2 font-semibold shrink-0 transition-colors",
617
+ {
618
+ variants: {
619
+ size: {
620
+ sm: "w-6 h-6 text-[11px]",
621
+ md: "w-7 h-7 text-[13px]",
622
+ lg: "w-9 h-9 text-[14px]"
623
+ },
624
+ status: {
625
+ wait: "border-default-300 bg-white text-default-500",
626
+ process: "border-primary-500 bg-white text-primary-500",
627
+ finish: "border-primary-500 bg-primary-500 text-white",
628
+ error: "border-destructive bg-white text-destructive"
629
+ }
630
+ },
631
+ defaultVariants: { size: "md", status: "wait" }
632
+ }
633
+ );
634
+ var sttlVariants = cva("text-sm font-medium leading-tight", {
635
+ variants: {
636
+ status: {
637
+ wait: "text-default-500",
638
+ process: "text-foreground font-semibold",
639
+ finish: "text-foreground",
640
+ error: "text-destructive"
641
+ }
642
+ },
643
+ defaultVariants: { status: "wait" }
644
+ });
645
+ var connectorVariants = cva("shrink-0 transition-colors", {
646
+ variants: {
647
+ direction: {
648
+ horizontal: "flex-1 h-px mx-3",
649
+ vertical: "w-px self-stretch mx-auto my-1"
650
+ },
651
+ /** El connector toma color del paso *anterior*: si está finish, va en primary. */
652
+ active: {
653
+ true: "bg-primary-500",
654
+ false: "bg-default-300"
655
+ }
656
+ },
657
+ defaultVariants: { direction: "horizontal", active: false }
658
+ });
659
+ var stepIconSize = {
660
+ sm: "w-3 h-3",
661
+ md: "w-3.5 h-3.5",
662
+ lg: "w-4 h-4"
663
+ };
664
+ var CheckIcon = ({ className }) => /* @__PURE__ */ jsx(
665
+ "svg",
666
+ {
667
+ className,
668
+ viewBox: "0 0 16 16",
669
+ fill: "none",
670
+ stroke: "currentColor",
671
+ strokeWidth: 2.5,
672
+ strokeLinecap: "round",
673
+ strokeLinejoin: "round",
674
+ "aria-hidden": "true",
675
+ children: /* @__PURE__ */ jsx("path", { d: "M3.5 8.5l3 3 6-6" })
676
+ }
677
+ );
678
+ var ErrorIcon = ({ className }) => /* @__PURE__ */ jsxs(
679
+ "svg",
680
+ {
681
+ className,
682
+ viewBox: "0 0 16 16",
683
+ fill: "none",
684
+ stroke: "currentColor",
685
+ strokeWidth: 2.5,
686
+ strokeLinecap: "round",
687
+ "aria-hidden": "true",
688
+ children: [
689
+ /* @__PURE__ */ jsx("path", { d: "M8 4v5" }),
690
+ /* @__PURE__ */ jsx("circle", { cx: "8", cy: "12", r: "0.6", fill: "currentColor", stroke: "none" })
691
+ ]
692
+ }
693
+ );
694
+ var Step = ({ item, index, status, size, clickable, onSelect }) => {
695
+ const disabled = item.disabled === true;
696
+ const interactive = clickable && !disabled;
697
+ const renderSnumContent = () => {
698
+ if (item.icon) return item.icon;
699
+ if (status === "finish") return /* @__PURE__ */ jsx(CheckIcon, { className: stepIconSize[size] });
700
+ if (status === "error") return /* @__PURE__ */ jsx(ErrorIcon, { className: stepIconSize[size] });
701
+ return /* @__PURE__ */ jsx("span", { children: index + 1 });
702
+ };
703
+ const handleClick = () => {
704
+ if (interactive) onSelect?.(index);
705
+ };
706
+ return /* @__PURE__ */ jsxs(
707
+ "div",
708
+ {
709
+ role: interactive ? "button" : void 0,
710
+ tabIndex: interactive ? 0 : void 0,
711
+ onClick: interactive ? handleClick : void 0,
712
+ onKeyDown: interactive ? (e) => {
713
+ if (e.key === "Enter" || e.key === " ") {
714
+ e.preventDefault();
715
+ handleClick();
716
+ }
717
+ } : void 0,
718
+ "aria-current": status === "process" ? "step" : void 0,
719
+ "aria-disabled": disabled || void 0,
720
+ className: cn(
721
+ "flex items-center gap-2.5 min-w-0",
722
+ interactive && "cursor-pointer focus:outline-none focus-visible:ring-2 focus-visible:ring-primary-500 rounded-md",
723
+ disabled && "opacity-50 pointer-events-none"
724
+ ),
725
+ children: [
726
+ /* @__PURE__ */ jsx("span", { className: snumVariants({ size, status }), children: renderSnumContent() }),
727
+ /* @__PURE__ */ jsxs("div", { className: "min-w-0 flex flex-col", children: [
728
+ /* @__PURE__ */ jsx("span", { className: sttlVariants({ status }), children: item.title }),
729
+ item.description && /* @__PURE__ */ jsx("span", { className: "text-xs text-default-500 mt-0.5 leading-tight", children: item.description })
730
+ ] })
731
+ ]
732
+ }
733
+ );
734
+ };
735
+ function resolveStatus(item, index, current) {
736
+ if (item.status) return item.status;
737
+ if (index < current) return "finish";
738
+ if (index === current) return "process";
739
+ return "wait";
740
+ }
741
+ var Steps = React5.forwardRef(
742
+ ({ items, current = 0, onChange, direction = "horizontal", size = "md", className }, ref) => {
743
+ const isHorizontal = direction === "horizontal";
744
+ const clickable = typeof onChange === "function";
745
+ return /* @__PURE__ */ jsx(
746
+ "div",
747
+ {
748
+ ref,
749
+ role: "list",
750
+ "aria-label": "Progress steps",
751
+ className: cn(
752
+ "flex w-full",
753
+ isHorizontal ? "items-center" : "flex-col items-stretch",
754
+ className
755
+ ),
756
+ children: items.map((item, idx) => {
757
+ const status = resolveStatus(item, idx, current);
758
+ const isLast = idx === items.length - 1;
759
+ const connectorActive = status === "finish";
760
+ return /* @__PURE__ */ jsxs(React5.Fragment, { children: [
761
+ /* @__PURE__ */ jsx(
762
+ "div",
763
+ {
764
+ role: "listitem",
765
+ className: cn(
766
+ "min-w-0",
767
+ isHorizontal ? "flex items-center shrink-0" : "flex flex-row items-start"
768
+ ),
769
+ children: /* @__PURE__ */ jsx(
770
+ Step,
771
+ {
772
+ item,
773
+ index: idx,
774
+ status,
775
+ size,
776
+ clickable,
777
+ onSelect: onChange
778
+ }
779
+ )
780
+ }
781
+ ),
782
+ !isLast && /* @__PURE__ */ jsx(
783
+ "span",
784
+ {
785
+ "aria-hidden": "true",
786
+ className: connectorVariants({
787
+ direction,
788
+ active: connectorActive
789
+ })
790
+ }
791
+ )
792
+ ] }, item.key);
793
+ })
794
+ }
795
+ );
796
+ }
797
+ );
798
+ Steps.displayName = "Steps";
799
+
800
+ // src/molecules/Table/Column.tsx
801
+ var Column = () => null;
802
+ var Column_default = Column;
803
+ var TablePagination = (props) => {
804
+ const {
805
+ totalItems = 0,
806
+ currentPage = 1,
807
+ onPageChange,
808
+ onPageSizeChange,
809
+ pageSize = 10,
810
+ pageSizeOptions = [10, 15, 20]
811
+ } = props;
812
+ const hasSizeOptions = pageSizeOptions && pageSizeOptions.length > 1;
813
+ return /* @__PURE__ */ jsx("div", { className: "bg-content1 flex justify-between items-center min-h-[48px] rounded-lg py-3 px-4", children: /* @__PURE__ */ jsx(
814
+ Pagination,
815
+ {
816
+ total: totalItems,
817
+ current: currentPage,
818
+ defaultCurrent: 1,
819
+ pageSize,
820
+ defaultPageSize: pageSize,
821
+ pageSizeOptions: pageSizeOptions ?? [10, 15, 20],
822
+ showSizeChanger: Boolean(hasSizeOptions && onPageSizeChange),
823
+ showTotal: (total, [from, to]) => `Mostrando ${from}-${to} de ${total}`,
824
+ onChange: (page, size) => {
825
+ onPageChange?.(page);
826
+ if (size !== pageSize) onPageSizeChange?.(page, size);
827
+ },
828
+ onShowSizeChange: onPageSizeChange,
829
+ responsive: true,
830
+ size: "small"
831
+ }
832
+ ) });
833
+ };
834
+ function MobileCards({
835
+ data,
836
+ columns,
837
+ rowKey,
838
+ onRow,
839
+ selectedRowKeys = []
840
+ }) {
841
+ const visibleColumns = columns.filter((col) => col.dataIndex !== "expanden");
842
+ return /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-3", children: data.map((record, rowIndex) => {
843
+ const rawKey = rowKey(record);
844
+ const key = rawKey === void 0 || rawKey === null || rawKey === "" ? rowIndex : rawKey;
845
+ const rowProps = onRow?.(record, rowIndex) || {};
846
+ const isSelected = selectedRowKeys.includes(rawKey);
847
+ return /* @__PURE__ */ jsx(
848
+ "div",
849
+ {
850
+ role: rowProps.onClick ? "button" : void 0,
851
+ tabIndex: rowProps.onClick ? 0 : void 0,
852
+ onClick: () => rowProps.onClick?.(),
853
+ onKeyDown: (e) => {
854
+ if (!rowProps.onClick) return;
855
+ if (e.key === "Enter" || e.key === " ") rowProps.onClick();
856
+ },
857
+ className: clsx2(
858
+ "w-full border border-border bg-background p-4 transition-colors",
859
+ isSelected && "bg-primary-50",
860
+ rowProps.onClick && "hover:bg-default-100/60 cursor-pointer"
861
+ ),
862
+ children: /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-2", children: visibleColumns.map((col, colIndex) => {
863
+ const value = col.dataIndex ? record[col.dataIndex] : void 0;
864
+ const content = col.render?.(value, record, rowIndex) ?? value;
865
+ return /* @__PURE__ */ jsxs(
866
+ "div",
867
+ {
868
+ className: clsx2(
869
+ "flex gap-4",
870
+ !col.title && (col.align === "center" ? "justify-center" : "justify-end")
871
+ ),
872
+ children: [
873
+ col.title && /* @__PURE__ */ jsx("div", { className: "min-w-[110px] text-xs font-semibold text-muted-foreground", children: col.title }),
874
+ /* @__PURE__ */ jsx(
875
+ "div",
876
+ {
877
+ className: clsx2(
878
+ "text-xs text-foreground break-words",
879
+ col.align === "center" && "text-center",
880
+ col.align === "right" && "text-right"
881
+ ),
882
+ children: content
883
+ }
884
+ )
885
+ ]
886
+ },
887
+ `${key}-${col.key}-${colIndex}`
888
+ );
889
+ }) })
890
+ },
891
+ key
892
+ );
893
+ }) });
894
+ }
895
+ var MobileCards_default = MobileCards;
896
+
897
+ // src/molecules/Table/utils.ts
898
+ function cycleSort(current) {
899
+ if (current === null) return "asc";
900
+ if (current === "asc") return "desc";
901
+ return null;
902
+ }
903
+ function compareValues(a, b) {
904
+ if (a === b) return 0;
905
+ if (a === null || a === void 0) return -1;
906
+ if (b === null || b === void 0) return 1;
907
+ if (typeof a === "number" && typeof b === "number") return a - b;
908
+ if (a instanceof Date && b instanceof Date) return a.getTime() - b.getTime();
909
+ return String(a).localeCompare(String(b));
910
+ }
911
+ function sortData(data, sortState, columns) {
912
+ if (!sortState.key || !sortState.direction) return data;
913
+ const column = columns.find((c) => c.key === sortState.key);
914
+ if (!column?.dataIndex) return data;
915
+ const dataIndex = column.dataIndex;
916
+ const factor = sortState.direction === "asc" ? 1 : -1;
917
+ return [...data].sort((a, b) => {
918
+ const va = a[dataIndex];
919
+ const vb = b[dataIndex];
920
+ return compareValues(va, vb) * factor;
921
+ });
922
+ }
923
+ var DENSITY_TH = {
924
+ compact: "px-3 py-1.5",
925
+ default: "px-4 py-3",
926
+ comfortable: "px-4 py-4"
927
+ };
928
+ var DENSITY_TD = {
929
+ compact: "px-3 py-1.5",
930
+ default: "px-4 py-3",
931
+ comfortable: "px-4 py-4"
932
+ };
933
+ function alignClass(align) {
934
+ return align === "center" ? "text-center" : align === "right" ? "text-right" : "text-left";
935
+ }
936
+ var TableHead = ({ columns, density, sortState, onSort }) => /* @__PURE__ */ jsx("thead", { children: /* @__PURE__ */ jsx("tr", { children: columns.map((col) => {
937
+ const isSorted = sortState.key === col.key;
938
+ const dir = isSorted ? sortState.direction : null;
939
+ const SortIcon = dir === "asc" ? ArrowUp : dir === "desc" ? ArrowDown : ArrowUpDown;
940
+ return /* @__PURE__ */ jsx(
941
+ "th",
942
+ {
943
+ scope: "col",
944
+ style: { width: col.width },
945
+ className: clsx2(
946
+ DENSITY_TH[density],
947
+ "bg-muted text-foreground border-b border-border whitespace-nowrap",
948
+ "text-[12.5px] font-semibold tracking-wide",
949
+ alignClass(col.align),
950
+ col.sortable && "cursor-pointer select-none group"
951
+ ),
952
+ onClick: col.sortable ? () => onSort(col.key) : void 0,
953
+ "aria-sort": isSorted && dir ? dir === "asc" ? "ascending" : "descending" : void 0,
954
+ children: /* @__PURE__ */ jsxs("span", { className: "inline-flex items-center gap-1.5 align-middle", children: [
955
+ col.title,
956
+ col.sortable && /* @__PURE__ */ jsx(
957
+ SortIcon,
958
+ {
959
+ className: clsx2(
960
+ "h-3.5 w-3.5",
961
+ isSorted ? "text-foreground opacity-100" : "text-muted-foreground opacity-0 group-hover:opacity-100"
962
+ ),
963
+ "aria-hidden": true
964
+ }
965
+ )
966
+ ] })
967
+ },
968
+ col.key
969
+ );
970
+ }) }) });
971
+ function TableBody({
972
+ data,
973
+ columns,
974
+ density,
975
+ variant,
976
+ rowKey,
977
+ selectedRowKeys,
978
+ onRow
979
+ }) {
980
+ return /* @__PURE__ */ jsx("tbody", { children: data.map((record, rowIndex) => {
981
+ const k = rowKey(record);
982
+ const rowProps = onRow?.(record, rowIndex) ?? {};
983
+ const isSelected = selectedRowKeys.includes(k);
984
+ const striped = variant === "striped" && rowIndex % 2 === 0 ? "bg-default-50" : "bg-background";
985
+ return /* @__PURE__ */ jsx(
986
+ "tr",
987
+ {
988
+ onClick: () => rowProps.onClick?.(),
989
+ className: clsx2(
990
+ "transition-colors border-b border-border last:border-b-0",
991
+ isSelected ? "bg-primary-50" : striped,
992
+ "hover:bg-default-100/60",
993
+ rowProps.onClick && "cursor-pointer"
994
+ ),
995
+ children: columns.map((col) => {
996
+ const value = col.dataIndex ? record[col.dataIndex] : void 0;
997
+ const content = col.render?.(value, record, rowIndex) ?? value;
998
+ return /* @__PURE__ */ jsx(
999
+ "td",
1000
+ {
1001
+ style: { width: col.width },
1002
+ className: clsx2(
1003
+ DENSITY_TD[density],
1004
+ "text-foreground align-middle",
1005
+ alignClass(col.align),
1006
+ col.ellipsis && "truncate max-w-0"
1007
+ ),
1008
+ children: content
1009
+ },
1010
+ `${k}-${col.key}`
1011
+ );
1012
+ })
1013
+ },
1014
+ k
1015
+ );
1016
+ }) });
1017
+ }
1018
+ function TableUI({
1019
+ dataSource,
1020
+ children,
1021
+ pagination,
1022
+ loading,
1023
+ variant,
1024
+ density = "default",
1025
+ emptyText = "No hay registros",
1026
+ rowKey = (record) => record.key,
1027
+ ariaLabel = "Table",
1028
+ selectedRowKeys = [],
1029
+ onRow,
1030
+ bordered = false
1031
+ }) {
1032
+ const { isMobile, isTablet } = useResponsive();
1033
+ const [sortState, setSortState] = useState({ key: null, direction: null });
1034
+ const columns = React5__default.Children.toArray(children).filter((child) => {
1035
+ return React5__default.isValidElement(child) && child.type === Column_default;
1036
+ }).map((child) => child.props).filter((c) => c.dataIndex !== "expanden");
1037
+ const sortedData = useMemo(
1038
+ () => sortData(dataSource, sortState, columns),
1039
+ [dataSource, sortState, columns]
1040
+ );
1041
+ const pageSizeProp = pagination?.pageSize || sortedData.length || 1;
1042
+ const { currentPage, paginatedData, total, totalPages, pageSize, onPageChange } = usePagination({
1043
+ data: sortedData,
1044
+ pageSize: pageSizeProp,
1045
+ initialPage: 1
1046
+ });
1047
+ const handleSort = (key) => {
1048
+ setSortState((prev) => ({
1049
+ key,
1050
+ direction: prev.key === key ? cycleSort(prev.direction) : "asc"
1051
+ }));
1052
+ };
1053
+ const emptyNode = /* @__PURE__ */ jsx(Empty, { title: typeof emptyText === "string" ? emptyText : "Sin datos" });
1054
+ const isEmpty = sortedData.length === 0 && !loading;
1055
+ if (isMobile || isTablet) {
1056
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
1057
+ loading ? /* @__PURE__ */ jsx(Spinner, { label: "Cargando..." }) : isEmpty ? emptyNode : /* @__PURE__ */ jsx(
1058
+ MobileCards_default,
1059
+ {
1060
+ data: paginatedData,
1061
+ columns,
1062
+ rowKey,
1063
+ onRow,
1064
+ selectedRowKeys
1065
+ }
1066
+ ),
1067
+ pagination && /* @__PURE__ */ jsx(
1068
+ TablePagination,
1069
+ {
1070
+ totalItems: total,
1071
+ totalPages,
1072
+ paginatedData,
1073
+ currentPage,
1074
+ pageSize,
1075
+ pageSizeOptions: pagination.pageSizeOptions,
1076
+ onPageChange
1077
+ }
1078
+ )
1079
+ ] });
1080
+ }
1081
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
1082
+ /* @__PURE__ */ jsxs(
1083
+ "div",
1084
+ {
1085
+ className: cn(
1086
+ "w-full overflow-x-auto relative",
1087
+ bordered && "border border-border rounded-lg overflow-hidden"
1088
+ ),
1089
+ "aria-label": ariaLabel,
1090
+ children: [
1091
+ /* @__PURE__ */ jsxs("table", { className: "w-full border-collapse text-sm", children: [
1092
+ /* @__PURE__ */ jsx(
1093
+ TableHead,
1094
+ {
1095
+ columns,
1096
+ density,
1097
+ sortState,
1098
+ onSort: handleSort
1099
+ }
1100
+ ),
1101
+ isEmpty ? /* @__PURE__ */ jsx("tbody", { children: /* @__PURE__ */ jsx("tr", { children: /* @__PURE__ */ jsx("td", { colSpan: columns.length, className: "p-0", children: emptyNode }) }) }) : /* @__PURE__ */ jsx(
1102
+ TableBody,
1103
+ {
1104
+ data: paginatedData,
1105
+ columns,
1106
+ density,
1107
+ variant,
1108
+ rowKey,
1109
+ selectedRowKeys,
1110
+ onRow
1111
+ }
1112
+ )
1113
+ ] }),
1114
+ loading && /* @__PURE__ */ jsx("div", { className: "absolute inset-0 flex items-center justify-center bg-background/60 backdrop-blur-[1px]", children: /* @__PURE__ */ jsx(Spinner, { label: "Cargando..." }) })
1115
+ ]
1116
+ }
1117
+ ),
1118
+ pagination && /* @__PURE__ */ jsx(
1119
+ TablePagination,
1120
+ {
1121
+ totalItems: total,
1122
+ totalPages,
1123
+ paginatedData,
1124
+ currentPage,
1125
+ pageSize,
1126
+ pageSizeOptions: pagination.pageSizeOptions,
1127
+ onPageChange
1128
+ }
1129
+ )
1130
+ ] });
1131
+ }
1132
+ var Table_default = TableUI;
1133
+ var tabsListVariants = cva("inline-flex items-center", {
1134
+ variants: {
1135
+ variant: {
1136
+ line: "border-b border-default-200 bg-transparent rounded-none p-0 gap-1",
1137
+ card: "bg-muted rounded-md p-[3px] gap-[2px]",
1138
+ pill: "bg-muted rounded-full p-[3px] gap-[2px]"
1139
+ },
1140
+ size: {
1141
+ sm: "text-xs",
1142
+ md: "text-sm",
1143
+ lg: "text-base"
1144
+ }
1145
+ },
1146
+ defaultVariants: { variant: "card", size: "md" }
1147
+ });
1148
+ var tabsTriggerVariants = cva(
1149
+ "inline-flex items-center gap-2 whitespace-nowrap font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",
1150
+ {
1151
+ variants: {
1152
+ variant: {
1153
+ line: "rounded-none border-b-2 border-transparent px-3 py-2 text-muted-foreground hover:text-foreground data-[state=active]:border-primary data-[state=active]:text-primary data-[state=active]:font-semibold",
1154
+ card: "rounded-sm px-3.5 py-1.5 text-muted-foreground data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:font-semibold data-[state=active]:shadow-sm",
1155
+ pill: "rounded-full px-4 py-1.5 text-muted-foreground data-[state=active]:bg-primary data-[state=active]:text-primary-foreground data-[state=active]:font-semibold"
1156
+ },
1157
+ size: {
1158
+ sm: "text-xs px-2.5 py-1",
1159
+ md: "text-sm",
1160
+ lg: "text-base px-4 py-2"
1161
+ }
1162
+ },
1163
+ defaultVariants: { variant: "card", size: "md" }
1164
+ }
1165
+ );
1166
+ var Tabs2 = React5.forwardRef(
1167
+ ({
1168
+ items,
1169
+ defaultValue,
1170
+ value,
1171
+ onChange,
1172
+ variant = "card",
1173
+ size = "md",
1174
+ className,
1175
+ listClassName,
1176
+ contentClassName
1177
+ }, ref) => {
1178
+ const initialValue = defaultValue ?? items[0]?.key;
1179
+ const rootProps = value !== void 0 ? { value, onValueChange: onChange } : { defaultValue: initialValue, onValueChange: onChange };
1180
+ return /* @__PURE__ */ jsxs(Tabs, { ref, className: cn("w-full", className), ...rootProps, children: [
1181
+ /* @__PURE__ */ jsx(TabsList, { className: cn(tabsListVariants({ variant, size }), listClassName), children: items.map((item) => /* @__PURE__ */ jsxs(
1182
+ TabsTrigger,
1183
+ {
1184
+ value: item.key,
1185
+ disabled: item.disabled,
1186
+ className: tabsTriggerVariants({ variant, size }),
1187
+ children: [
1188
+ item.icon,
1189
+ item.label
1190
+ ]
1191
+ },
1192
+ item.key
1193
+ )) }),
1194
+ items.map((item) => /* @__PURE__ */ jsx(
1195
+ TabsContent,
1196
+ {
1197
+ value: item.key,
1198
+ className: cn("text-default-700", contentClassName),
1199
+ children: item.content
1200
+ },
1201
+ item.key
1202
+ ))
1203
+ ] });
1204
+ }
1205
+ );
1206
+ Tabs2.displayName = "Tabs";
1207
+ var timelineDotVariants = cva(
1208
+ "relative z-10 h-3 w-3 rounded-full border-2 bg-white shrink-0",
1209
+ {
1210
+ variants: {
1211
+ status: {
1212
+ pending: "border-primary-500",
1213
+ "in-progress": "border-primary",
1214
+ done: "border-primary-500 bg-primary-500",
1215
+ error: "border-danger-600 bg-danger-600"
1216
+ }
1217
+ },
1218
+ defaultVariants: { status: "pending" }
1219
+ }
1220
+ );
1221
+ function getAlignment(mode, index) {
1222
+ if (mode === "left") return "left";
1223
+ if (mode === "right") return "right";
1224
+ return index % 2 === 0 ? "left" : "right";
1225
+ }
1226
+ var TimelineItemRow = ({ item, isLast, mode, index }) => {
1227
+ const align = getAlignment(mode, index);
1228
+ const isAlternate = mode === "alternate";
1229
+ return /* @__PURE__ */ jsxs("li", { className: "relative flex gap-3 pb-5 last:pb-0", children: [
1230
+ /* @__PURE__ */ jsxs("div", { className: "relative flex flex-col items-center", children: [
1231
+ item.icon ? /* @__PURE__ */ jsx("div", { className: "relative z-10 shrink-0", children: item.icon }) : /* @__PURE__ */ jsx("span", { className: timelineDotVariants({ status: item.status ?? "pending" }) }),
1232
+ !isLast && /* @__PURE__ */ jsx("span", { className: "absolute top-3 left-1/2 -translate-x-1/2 h-full w-0.5 bg-default-200" })
1233
+ ] }),
1234
+ /* @__PURE__ */ jsxs(
1235
+ "div",
1236
+ {
1237
+ className: cn("flex-1 min-w-0 -mt-0.5", isAlternate && align === "right" && "text-right"),
1238
+ children: [
1239
+ item.time && /* @__PURE__ */ jsx("div", { className: "text-xs text-default-700 mb-0.5", children: item.time }),
1240
+ /* @__PURE__ */ jsx("div", { className: "text-sm text-default-900", children: item.content })
1241
+ ]
1242
+ }
1243
+ )
1244
+ ] });
1245
+ };
1246
+ var Timeline = React5.forwardRef(
1247
+ ({ items, mode = "left", className }, ref) => {
1248
+ return /* @__PURE__ */ jsx("ul", { ref, className: cn("flex flex-col w-full", className), children: items.map((item, idx) => /* @__PURE__ */ jsx(
1249
+ TimelineItemRow,
1250
+ {
1251
+ item,
1252
+ isLast: idx === items.length - 1,
1253
+ mode,
1254
+ index: idx
1255
+ },
1256
+ item.key
1257
+ )) });
1258
+ }
1259
+ );
1260
+ Timeline.displayName = "Timeline";
1261
+ var Tooltip2 = React5.forwardRef(
1262
+ ({
1263
+ content,
1264
+ children,
1265
+ side = "top",
1266
+ align = "center",
1267
+ delayDuration = 200,
1268
+ open,
1269
+ defaultOpen,
1270
+ onOpenChange,
1271
+ className,
1272
+ asChild = true,
1273
+ withProvider = true
1274
+ }, ref) => {
1275
+ const tooltip = /* @__PURE__ */ jsxs(
1276
+ Tooltip,
1277
+ {
1278
+ open,
1279
+ defaultOpen,
1280
+ onOpenChange,
1281
+ delayDuration,
1282
+ children: [
1283
+ /* @__PURE__ */ jsx(TooltipTrigger, { asChild, children }),
1284
+ /* @__PURE__ */ jsx(TooltipContent, { ref, side, align, className: cn(className), children: content })
1285
+ ]
1286
+ }
1287
+ );
1288
+ if (!withProvider) return tooltip;
1289
+ return /* @__PURE__ */ jsx(TooltipProvider, { delayDuration, children: tooltip });
1290
+ }
1291
+ );
1292
+ Tooltip2.displayName = "Tooltip";
1293
+
1294
+ export { Alert, Breadcrumb, Card2 as Card, Column_default, DeleteModal_default, Drawer_default, Empty, HoverCard2 as HoverCard, List2 as List, Modal_default, Popconfirm, Popover2 as Popover, Segmented, Statistic, Step, Steps, TablePagination, Table_default, Tabs2 as Tabs, Timeline, Tooltip2 as Tooltip };
1295
+ //# sourceMappingURL=chunk-5FWELSEZ.js.map
1296
+ //# sourceMappingURL=chunk-5FWELSEZ.js.map