vicdev-ui-lib 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.
- package/README.md +297 -0
- package/dist/vicdev-ui-lib.cjs.js +34 -0
- package/dist/vicdev-ui-lib.es.js +1251 -0
- package/dist/vite.svg +1 -0
- package/package.json +102 -0
|
@@ -0,0 +1,1251 @@
|
|
|
1
|
+
import { jsx as e, jsxs as s, Fragment as O } from "react/jsx-runtime";
|
|
2
|
+
import { createContext as X, useState as k, useContext as Y, useEffect as K, useRef as G } from "react";
|
|
3
|
+
import { AnimatePresence as q, motion as T } from "framer-motion";
|
|
4
|
+
import { X as E, AlertTriangle as H, Info as J, XCircle as Q, CheckCircle as ee, EyeOff as R, Eye as I, Search as re, FileText as z, Upload as te, Check as ne, File as U, Loader2 as oe, AlertCircle as ae, Download as _, Image as se } from "lucide-react";
|
|
5
|
+
import { createPortal as ie } from "react-dom";
|
|
6
|
+
import { DataTable as le } from "primereact/datatable";
|
|
7
|
+
import { Column as ce } from "primereact/column";
|
|
8
|
+
const j = {
|
|
9
|
+
primary: "#0f172a",
|
|
10
|
+
primaryForeground: "#f8fafc",
|
|
11
|
+
secondary: "#f1f5f9",
|
|
12
|
+
secondaryForeground: "#0f172a",
|
|
13
|
+
accent: "#f1f5f9",
|
|
14
|
+
accentForeground: "#0f172a",
|
|
15
|
+
destructive: "#ef4444",
|
|
16
|
+
destructiveForeground: "#f8fafc",
|
|
17
|
+
background: "#ffffff",
|
|
18
|
+
foreground: "#0f172a",
|
|
19
|
+
card: "#ffffff",
|
|
20
|
+
cardForeground: "#0f172a",
|
|
21
|
+
border: "#e2e8f0",
|
|
22
|
+
input: "#e2e8f0",
|
|
23
|
+
ring: "#0f172a",
|
|
24
|
+
muted: "#f1f5f9",
|
|
25
|
+
mutedForeground: "#64748b",
|
|
26
|
+
popover: "#ffffff",
|
|
27
|
+
popoverForeground: "#0f172a",
|
|
28
|
+
radio: "#e2e8f0",
|
|
29
|
+
radioForeground: "#0f172a"
|
|
30
|
+
}, de = {
|
|
31
|
+
colors: j,
|
|
32
|
+
name: "default",
|
|
33
|
+
description: "Tema por defecto de vicdev-ui-lib"
|
|
34
|
+
};
|
|
35
|
+
function Re(r) {
|
|
36
|
+
return {
|
|
37
|
+
colors: {
|
|
38
|
+
...j,
|
|
39
|
+
...r
|
|
40
|
+
},
|
|
41
|
+
name: "custom"
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
function Ie(r) {
|
|
45
|
+
const { colors: t } = r;
|
|
46
|
+
return `:root {
|
|
47
|
+
${Object.entries(t).map(([n, o]) => ` --${n.replace(/([A-Z])/g, "-$1").toLowerCase()}: ${o};`).join(`
|
|
48
|
+
`)}
|
|
49
|
+
}`;
|
|
50
|
+
}
|
|
51
|
+
const Z = X(void 0);
|
|
52
|
+
function Ue({ theme: r = de, children: t }) {
|
|
53
|
+
const [a, n] = k(r), o = {
|
|
54
|
+
theme: a,
|
|
55
|
+
setTheme: n
|
|
56
|
+
};
|
|
57
|
+
return /* @__PURE__ */ e(Z.Provider, { value: o, children: t });
|
|
58
|
+
}
|
|
59
|
+
function _e() {
|
|
60
|
+
const r = Y(Z);
|
|
61
|
+
if (r === void 0)
|
|
62
|
+
throw new Error("useTheme debe ser usado dentro de un ThemeProvider");
|
|
63
|
+
return r;
|
|
64
|
+
}
|
|
65
|
+
function ue(r) {
|
|
66
|
+
const t = { ...j, ...r };
|
|
67
|
+
return {
|
|
68
|
+
primary: {
|
|
69
|
+
DEFAULT: t.primary,
|
|
70
|
+
foreground: t.primaryForeground
|
|
71
|
+
},
|
|
72
|
+
secondary: {
|
|
73
|
+
DEFAULT: t.secondary,
|
|
74
|
+
foreground: t.secondaryForeground
|
|
75
|
+
},
|
|
76
|
+
accent: {
|
|
77
|
+
DEFAULT: t.accent,
|
|
78
|
+
foreground: t.accentForeground
|
|
79
|
+
},
|
|
80
|
+
destructive: {
|
|
81
|
+
DEFAULT: t.destructive,
|
|
82
|
+
foreground: t.destructiveForeground
|
|
83
|
+
},
|
|
84
|
+
background: t.background,
|
|
85
|
+
foreground: t.foreground,
|
|
86
|
+
card: {
|
|
87
|
+
DEFAULT: t.card,
|
|
88
|
+
foreground: t.cardForeground
|
|
89
|
+
},
|
|
90
|
+
border: t.border,
|
|
91
|
+
input: t.input,
|
|
92
|
+
ring: t.ring,
|
|
93
|
+
muted: {
|
|
94
|
+
DEFAULT: t.muted,
|
|
95
|
+
foreground: t.mutedForeground
|
|
96
|
+
},
|
|
97
|
+
popover: {
|
|
98
|
+
DEFAULT: t.popover,
|
|
99
|
+
foreground: t.popoverForeground
|
|
100
|
+
},
|
|
101
|
+
radio: {
|
|
102
|
+
DEFAULT: t.radio,
|
|
103
|
+
foreground: t.radioForeground
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
function Ve(r) {
|
|
108
|
+
return {
|
|
109
|
+
extend: {
|
|
110
|
+
colors: ue(r),
|
|
111
|
+
borderRadius: {
|
|
112
|
+
lg: "var(--radius)",
|
|
113
|
+
md: "calc(var(--radius) - 2px)",
|
|
114
|
+
sm: "calc(var(--radius) - 4px)"
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
function me(r) {
|
|
120
|
+
const t = { ...j, ...r };
|
|
121
|
+
return `@theme {
|
|
122
|
+
${Object.entries(t).map(([n, o]) => ` --color-${n.replace(/([A-Z])/g, "-$1").toLowerCase()}: ${o};`).join(`
|
|
123
|
+
`)}
|
|
124
|
+
|
|
125
|
+
/* Border radius */
|
|
126
|
+
--radius: 0.5rem;
|
|
127
|
+
}`;
|
|
128
|
+
}
|
|
129
|
+
function fe(r) {
|
|
130
|
+
const t = { ...j, ...r };
|
|
131
|
+
return `:root {
|
|
132
|
+
${Object.entries(t).map(([n]) => {
|
|
133
|
+
const o = n.replace(/([A-Z])/g, "-$1").toLowerCase(), i = `color-${o}`;
|
|
134
|
+
return ` --${o}: var(--${i});`;
|
|
135
|
+
}).join(`
|
|
136
|
+
`)}
|
|
137
|
+
}`;
|
|
138
|
+
}
|
|
139
|
+
function We(r) {
|
|
140
|
+
const t = me(r), a = fe(r);
|
|
141
|
+
return `${t}
|
|
142
|
+
|
|
143
|
+
${a}`;
|
|
144
|
+
}
|
|
145
|
+
const V = {
|
|
146
|
+
primary: "bg-primary text-primary-foreground hover:bg-primary/90 font-bold shadow-lg",
|
|
147
|
+
secondary: "bg-white border-2 border-border/20 text-foreground hover:border-border/40 hover:bg-card shadow-sm",
|
|
148
|
+
accent: "bg-gradient-to-r from-accent to-accent/90 text-accent-foreground hover:shadow-lg",
|
|
149
|
+
danger: "bg-destructive text-destructive-foreground hover:bg-destructive/90 border-0 shadow-lg hover:shadow-destructive/25",
|
|
150
|
+
outline: "border-2 border-border/30 text-foreground hover:bg-card hover:border-border/50",
|
|
151
|
+
ghost: "text-foreground hover:bg-card hover:text-primary",
|
|
152
|
+
success: "bg-green-500 text-white hover:bg-green-600 hover:shadow-green-400/20"
|
|
153
|
+
}, B = ({
|
|
154
|
+
onClick: r,
|
|
155
|
+
icon: t,
|
|
156
|
+
label: a,
|
|
157
|
+
variant: n = "primary",
|
|
158
|
+
type: o = "button",
|
|
159
|
+
className: i = "",
|
|
160
|
+
disabled: d = !1,
|
|
161
|
+
children: c,
|
|
162
|
+
...u
|
|
163
|
+
}) => /* @__PURE__ */ s(
|
|
164
|
+
"button",
|
|
165
|
+
{
|
|
166
|
+
onClick: r,
|
|
167
|
+
type: o,
|
|
168
|
+
disabled: d,
|
|
169
|
+
className: `
|
|
170
|
+
flex items-center justify-center px-4 py-3 rounded-xl font-semibold text-sm
|
|
171
|
+
transition-all duration-300 hover:scale-[1.02] active:scale-[0.98] group
|
|
172
|
+
disabled:opacity-50 disabled:cursor-not-allowed disabled:hover:scale-100
|
|
173
|
+
${V[n] ?? V.primary} ${i}
|
|
174
|
+
`,
|
|
175
|
+
...u,
|
|
176
|
+
children: [
|
|
177
|
+
t && /* @__PURE__ */ e(
|
|
178
|
+
t,
|
|
179
|
+
{
|
|
180
|
+
size: 20,
|
|
181
|
+
className: `${a ? "mr-2" : ""} ${d ? "" : "group-hover:rotate-12"} transition-transform duration-300`
|
|
182
|
+
}
|
|
183
|
+
),
|
|
184
|
+
a,
|
|
185
|
+
c
|
|
186
|
+
]
|
|
187
|
+
}
|
|
188
|
+
), W = {
|
|
189
|
+
sm: "max-w-sm",
|
|
190
|
+
md: "max-w-md",
|
|
191
|
+
lg: "max-w-2xl",
|
|
192
|
+
xl: "max-w-4xl",
|
|
193
|
+
full: "max-w-[90vw]",
|
|
194
|
+
fullscreen: "w-[95vw] h-[95vh]"
|
|
195
|
+
};
|
|
196
|
+
function pe({
|
|
197
|
+
isOpen: r,
|
|
198
|
+
onClose: t,
|
|
199
|
+
title: a = "",
|
|
200
|
+
tamaño: n = "lg",
|
|
201
|
+
children: o,
|
|
202
|
+
canClose: i = !0
|
|
203
|
+
// Por defecto se puede cerrar
|
|
204
|
+
}) {
|
|
205
|
+
const d = /* @__PURE__ */ e(q, { children: r && /* @__PURE__ */ s(O, { children: [
|
|
206
|
+
/* @__PURE__ */ e(
|
|
207
|
+
T.div,
|
|
208
|
+
{
|
|
209
|
+
initial: { opacity: 0 },
|
|
210
|
+
animate: { opacity: 1 },
|
|
211
|
+
exit: { opacity: 0 },
|
|
212
|
+
className: "fixed inset-0 z-[99998]"
|
|
213
|
+
}
|
|
214
|
+
),
|
|
215
|
+
/* @__PURE__ */ e(
|
|
216
|
+
T.div,
|
|
217
|
+
{
|
|
218
|
+
initial: { opacity: 0 },
|
|
219
|
+
animate: { opacity: 1 },
|
|
220
|
+
exit: { opacity: 0 },
|
|
221
|
+
className: `fixed inset-0 z-[99999] bg-black/60 backdrop-blur-sm flex items-center justify-center ${n === "fullscreen" ? "p-2" : "p-4"} ${i ? "" : "cursor-not-allowed"}`,
|
|
222
|
+
onClick: i ? t : (c) => c.stopPropagation(),
|
|
223
|
+
children: /* @__PURE__ */ s(
|
|
224
|
+
T.div,
|
|
225
|
+
{
|
|
226
|
+
initial: { opacity: 0, scale: 0.95, y: 20 },
|
|
227
|
+
animate: { opacity: 1, scale: 1, y: 0 },
|
|
228
|
+
exit: { opacity: 0, scale: 0.95, y: 20 },
|
|
229
|
+
transition: { type: "spring", damping: 20, stiffness: 300 },
|
|
230
|
+
className: `
|
|
231
|
+
bg-background shadow-2xl w-full overflow-hidden relative border border-border/50
|
|
232
|
+
${n === "fullscreen" ? "rounded-none h-[95vh]" : "rounded-2xl max-h-[95vh]"}
|
|
233
|
+
${W[n] || W.md}
|
|
234
|
+
`,
|
|
235
|
+
onClick: (c) => c.stopPropagation(),
|
|
236
|
+
children: [
|
|
237
|
+
/* @__PURE__ */ s("div", { className: "bg-gradient-to-r from-primary to-secondary p-4 flex justify-between items-center sticky top-0 z-10 border-b border-primary-foreground/20", children: [
|
|
238
|
+
/* @__PURE__ */ s("div", { className: "flex items-center gap-3", children: [
|
|
239
|
+
/* @__PURE__ */ e("div", { className: "w-8 h-8 bg-primary-foreground/20 rounded-lg flex items-center justify-center", children: /* @__PURE__ */ e("div", { className: "w-4 h-4 bg-primary-foreground rounded-full" }) }),
|
|
240
|
+
/* @__PURE__ */ e("h2", { className: "text-lg font-bold text-primary-foreground", children: a })
|
|
241
|
+
] }),
|
|
242
|
+
i ? /* @__PURE__ */ e(
|
|
243
|
+
"button",
|
|
244
|
+
{
|
|
245
|
+
onClick: t,
|
|
246
|
+
className: "text-primary-foreground hover:text-primary-foreground/80 hover:bg-primary-foreground/10 p-2 rounded-lg transition-all duration-200",
|
|
247
|
+
children: /* @__PURE__ */ e(E, { size: 24 })
|
|
248
|
+
}
|
|
249
|
+
) : /* @__PURE__ */ e("div", { className: "w-10 h-10 flex items-center justify-center", children: /* @__PURE__ */ e("div", { className: "w-5 h-5 border-2 border-primary-foreground/30 border-t-primary-foreground rounded-full animate-spin" }) })
|
|
250
|
+
] }),
|
|
251
|
+
/* @__PURE__ */ e(
|
|
252
|
+
"div",
|
|
253
|
+
{
|
|
254
|
+
className: `overflow-y-auto bg-gradient-to-b from-background to-card/30 ${n === "fullscreen" ? "p-8 h-[calc(95vh-100px)]" : "p-6 max-h-[calc(95vh-100px)]"}`,
|
|
255
|
+
children: o
|
|
256
|
+
}
|
|
257
|
+
)
|
|
258
|
+
]
|
|
259
|
+
}
|
|
260
|
+
)
|
|
261
|
+
}
|
|
262
|
+
)
|
|
263
|
+
] }) });
|
|
264
|
+
return typeof window < "u" ? ie(d, document.body) : d;
|
|
265
|
+
}
|
|
266
|
+
const Ke = ({
|
|
267
|
+
isOpen: r,
|
|
268
|
+
onClose: t,
|
|
269
|
+
onConfirm: a,
|
|
270
|
+
loading: n = !1,
|
|
271
|
+
entidad: o
|
|
272
|
+
}) => {
|
|
273
|
+
if (!r) return null;
|
|
274
|
+
const {
|
|
275
|
+
tipo: i = "elemento",
|
|
276
|
+
// "categoría", "producto", etc.
|
|
277
|
+
nombre: d = "",
|
|
278
|
+
dependencias: c = 0,
|
|
279
|
+
nombreDependencia: u = ""
|
|
280
|
+
} = o || {};
|
|
281
|
+
return /* @__PURE__ */ e("div", { className: "fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4", children: /* @__PURE__ */ s("div", { className: "bg-background rounded-2xl shadow-2xl max-w-md w-full p-6 transform transition-all", children: [
|
|
282
|
+
/* @__PURE__ */ e("div", { className: "flex items-center justify-center w-16 h-16 mx-auto mb-4 bg-destructive/10 rounded-full", children: /* @__PURE__ */ e(H, { className: "w-8 h-8 text-destructive" }) }),
|
|
283
|
+
/* @__PURE__ */ s("h3", { className: "text-xl font-bold text-foreground text-center mb-2", children: [
|
|
284
|
+
"¿Eliminar ",
|
|
285
|
+
i,
|
|
286
|
+
"?"
|
|
287
|
+
] }),
|
|
288
|
+
/* @__PURE__ */ s("p", { className: "text-muted-foreground text-center mb-6", children: [
|
|
289
|
+
"Esta acción eliminará ",
|
|
290
|
+
i === "producto" ? "el" : "la",
|
|
291
|
+
" ",
|
|
292
|
+
/* @__PURE__ */ s("strong", { children: [
|
|
293
|
+
i,
|
|
294
|
+
' "',
|
|
295
|
+
d,
|
|
296
|
+
'"'
|
|
297
|
+
] }),
|
|
298
|
+
c > 0 && u ? /* @__PURE__ */ s(O, { children: [
|
|
299
|
+
" y afectará a ",
|
|
300
|
+
/* @__PURE__ */ s("strong", { children: [
|
|
301
|
+
c,
|
|
302
|
+
" ",
|
|
303
|
+
u
|
|
304
|
+
] }),
|
|
305
|
+
"."
|
|
306
|
+
] }) : null,
|
|
307
|
+
/* @__PURE__ */ e("br", {}),
|
|
308
|
+
"Esta acción no se puede deshacer."
|
|
309
|
+
] }),
|
|
310
|
+
/* @__PURE__ */ s("div", { className: "flex gap-3", children: [
|
|
311
|
+
/* @__PURE__ */ e(
|
|
312
|
+
"button",
|
|
313
|
+
{
|
|
314
|
+
onClick: () => t(!1),
|
|
315
|
+
className: "flex-1 px-4 py-3 border border-border text-foreground rounded-xl hover:bg-card transition-colors",
|
|
316
|
+
children: "Cancelar"
|
|
317
|
+
}
|
|
318
|
+
),
|
|
319
|
+
/* @__PURE__ */ e(
|
|
320
|
+
"button",
|
|
321
|
+
{
|
|
322
|
+
onClick: a,
|
|
323
|
+
disabled: n,
|
|
324
|
+
className: `flex-1 px-4 py-3 ${n ? "bg-destructive/70" : "bg-destructive hover:bg-destructive/90"} text-destructive-foreground rounded-xl transition-colors`,
|
|
325
|
+
children: n ? "Cargando..." : "Eliminar"
|
|
326
|
+
}
|
|
327
|
+
)
|
|
328
|
+
] })
|
|
329
|
+
] }) });
|
|
330
|
+
}, ge = {
|
|
331
|
+
success: {
|
|
332
|
+
container: "bg-primary/10 border-primary/30 text-primary",
|
|
333
|
+
icon: ee
|
|
334
|
+
},
|
|
335
|
+
error: {
|
|
336
|
+
container: "bg-destructive/10 border-destructive/30 text-destructive",
|
|
337
|
+
icon: Q
|
|
338
|
+
},
|
|
339
|
+
info: {
|
|
340
|
+
container: "bg-blue-500/10 border-blue-500/30 text-blue-600 dark:text-blue-400",
|
|
341
|
+
icon: J
|
|
342
|
+
},
|
|
343
|
+
warning: {
|
|
344
|
+
container: "bg-amber-500/10 border-amber-500/30 text-amber-700 dark:text-amber-400",
|
|
345
|
+
icon: H
|
|
346
|
+
}
|
|
347
|
+
};
|
|
348
|
+
function Ge({
|
|
349
|
+
message: r,
|
|
350
|
+
variant: t = "info",
|
|
351
|
+
open: a,
|
|
352
|
+
onClose: n,
|
|
353
|
+
autoClose: o,
|
|
354
|
+
className: i = ""
|
|
355
|
+
}) {
|
|
356
|
+
const { container: d, icon: c } = ge[t];
|
|
357
|
+
return K(() => {
|
|
358
|
+
if (!a || !o) return;
|
|
359
|
+
const u = setTimeout(n, o);
|
|
360
|
+
return () => clearTimeout(u);
|
|
361
|
+
}, [a, o, n]), a ? /* @__PURE__ */ s(
|
|
362
|
+
"div",
|
|
363
|
+
{
|
|
364
|
+
role: "alert",
|
|
365
|
+
className: `fixed top-20 right-4 z-[9999] max-w-md flex items-center gap-3 px-4 py-3 rounded-xl border shadow-xl shadow-black/10 dark:shadow-black/30 animate-in slide-in-from-top-5 fade-in duration-300 ${d} ${i}`,
|
|
366
|
+
children: [
|
|
367
|
+
/* @__PURE__ */ e(c, { className: "w-5 h-5 shrink-0", "aria-hidden": !0 }),
|
|
368
|
+
/* @__PURE__ */ e("p", { className: "font-medium flex-1", children: r }),
|
|
369
|
+
/* @__PURE__ */ e(
|
|
370
|
+
"button",
|
|
371
|
+
{
|
|
372
|
+
type: "button",
|
|
373
|
+
onClick: n,
|
|
374
|
+
className: "shrink-0 p-1 rounded-lg hover:bg-black/5 dark:hover:bg-white/5 transition-colors focus:outline-none focus:ring-2 focus:ring-ring",
|
|
375
|
+
"aria-label": "Cerrar",
|
|
376
|
+
children: /* @__PURE__ */ e(E, { className: "w-4 h-4" })
|
|
377
|
+
}
|
|
378
|
+
)
|
|
379
|
+
]
|
|
380
|
+
}
|
|
381
|
+
) : null;
|
|
382
|
+
}
|
|
383
|
+
const he = "No hay registros para mostrar.", be = 10, xe = [10, 25, 50];
|
|
384
|
+
function ve({
|
|
385
|
+
value: r,
|
|
386
|
+
columns: t,
|
|
387
|
+
dataKey: a,
|
|
388
|
+
emptyMessage: n = he,
|
|
389
|
+
loading: o = !1,
|
|
390
|
+
paginator: i = !1,
|
|
391
|
+
rows: d = be,
|
|
392
|
+
rowsPerPageOptions: c = xe,
|
|
393
|
+
size: u = "normal",
|
|
394
|
+
stripedRows: f = !1,
|
|
395
|
+
showGridlines: b = !1,
|
|
396
|
+
className: p,
|
|
397
|
+
style: g
|
|
398
|
+
}) {
|
|
399
|
+
const x = t.filter((l) => !l.hidden);
|
|
400
|
+
return /* @__PURE__ */ e("div", { className: `data-table-viva overflow-hidden rounded-lg border border-border bg-card ${p ?? ""}`.trim(), style: g, children: /* @__PURE__ */ e(
|
|
401
|
+
le,
|
|
402
|
+
{
|
|
403
|
+
value: r,
|
|
404
|
+
dataKey: a,
|
|
405
|
+
loading: o,
|
|
406
|
+
emptyMessage: n,
|
|
407
|
+
paginator: i,
|
|
408
|
+
rows: d,
|
|
409
|
+
rowsPerPageOptions: c,
|
|
410
|
+
size: u,
|
|
411
|
+
stripedRows: f,
|
|
412
|
+
showGridlines: b,
|
|
413
|
+
paginatorTemplate: "FirstPageLink PrevPageLink PageLinks NextPageLink LastPageLink CurrentPageReport RowsPerPageDropdown",
|
|
414
|
+
currentPageReportTemplate: "Mostrando {first} a {last} de {totalRecords} registros",
|
|
415
|
+
children: x.map((l) => /* @__PURE__ */ e(
|
|
416
|
+
ce,
|
|
417
|
+
{
|
|
418
|
+
field: l.field,
|
|
419
|
+
header: l.header,
|
|
420
|
+
sortable: l.sortable ?? !1,
|
|
421
|
+
align: l.align,
|
|
422
|
+
alignHeader: l.alignHeader,
|
|
423
|
+
style: l.style,
|
|
424
|
+
bodyClassName: l.bodyClassName,
|
|
425
|
+
body: l.body ? (h) => l.body(h) : void 0
|
|
426
|
+
},
|
|
427
|
+
String(l.field)
|
|
428
|
+
))
|
|
429
|
+
}
|
|
430
|
+
) });
|
|
431
|
+
}
|
|
432
|
+
function He(r) {
|
|
433
|
+
return /* @__PURE__ */ e(ve, { ...r });
|
|
434
|
+
}
|
|
435
|
+
const ye = "w-full px-4 py-3 border text-base border-input rounded-xl focus:outline-none focus:ring-2 focus:ring-ring focus:border-transparent transition-all bg-background shadow-sm", we = "w-full pl-4 pr-12 py-3 border text-base border-input rounded-xl focus:outline-none focus:ring-2 focus:ring-ring focus:border-transparent transition-all bg-background shadow-sm", Ne = "w-full px-4 pt-6 pb-2 border text-base border-input rounded-xl focus:outline-none focus:ring-2 focus:ring-ring focus:border-transparent transition-all bg-background shadow-sm", ke = "w-full pl-4 pr-12 pt-6 pb-2 border text-base border-input rounded-xl focus:outline-none focus:ring-2 focus:ring-ring focus:border-transparent transition-all bg-background shadow-sm";
|
|
436
|
+
function Ze({
|
|
437
|
+
label: r,
|
|
438
|
+
id: t,
|
|
439
|
+
name: a,
|
|
440
|
+
type: n = "text",
|
|
441
|
+
value: o = "",
|
|
442
|
+
onChange: i,
|
|
443
|
+
onBlur: d,
|
|
444
|
+
placeholder: c,
|
|
445
|
+
required: u = !1,
|
|
446
|
+
options: f = [],
|
|
447
|
+
rows: b = 4,
|
|
448
|
+
className: p = "",
|
|
449
|
+
floatingLabel: g = !1,
|
|
450
|
+
helperText: x,
|
|
451
|
+
disabled: l = !1,
|
|
452
|
+
inputMode: h
|
|
453
|
+
}) {
|
|
454
|
+
const [P, $] = k(!1), [v, C] = k(!1), y = G(null), L = g && (P || o !== "" && o !== void 0 && o !== null), m = n === "password", w = m && v ? "text" : n, S = () => {
|
|
455
|
+
$(!0);
|
|
456
|
+
}, A = (N) => {
|
|
457
|
+
$(!1), d?.(N);
|
|
458
|
+
}, F = g ? m ? ke : Ne : m ? we : ye, M = () => {
|
|
459
|
+
C(!v);
|
|
460
|
+
};
|
|
461
|
+
return /* @__PURE__ */ s("div", { className: p, children: [
|
|
462
|
+
g ? /* @__PURE__ */ s("div", { className: "relative", children: [
|
|
463
|
+
r && /* @__PURE__ */ s(
|
|
464
|
+
"label",
|
|
465
|
+
{
|
|
466
|
+
htmlFor: t,
|
|
467
|
+
className: `absolute left-4 transition-all duration-200 pointer-events-none ${L ? "top-2 text-xs text-muted-foreground font-medium" : "top-1/2 -translate-y-1/2 text-base text-muted-foreground/70"}`,
|
|
468
|
+
children: [
|
|
469
|
+
r,
|
|
470
|
+
u && /* @__PURE__ */ e("span", { className: "text-destructive ml-1", children: "*" })
|
|
471
|
+
]
|
|
472
|
+
}
|
|
473
|
+
),
|
|
474
|
+
n === "textarea" ? /* @__PURE__ */ e(
|
|
475
|
+
"textarea",
|
|
476
|
+
{
|
|
477
|
+
ref: y,
|
|
478
|
+
id: t,
|
|
479
|
+
name: a,
|
|
480
|
+
value: o,
|
|
481
|
+
onChange: i,
|
|
482
|
+
onFocus: S,
|
|
483
|
+
onBlur: A,
|
|
484
|
+
placeholder: L ? c : "",
|
|
485
|
+
rows: b,
|
|
486
|
+
disabled: l,
|
|
487
|
+
className: `${F} resize-none`
|
|
488
|
+
}
|
|
489
|
+
) : n === "select" ? /* @__PURE__ */ s(
|
|
490
|
+
"select",
|
|
491
|
+
{
|
|
492
|
+
ref: y,
|
|
493
|
+
id: t,
|
|
494
|
+
name: a,
|
|
495
|
+
value: o,
|
|
496
|
+
onChange: i,
|
|
497
|
+
onFocus: S,
|
|
498
|
+
onBlur: A,
|
|
499
|
+
disabled: l,
|
|
500
|
+
className: F,
|
|
501
|
+
children: [
|
|
502
|
+
/* @__PURE__ */ e("option", { value: "", children: "Seleccionar opción" }),
|
|
503
|
+
f.map((N) => /* @__PURE__ */ e("option", { value: N.value, children: N.label }, N.value))
|
|
504
|
+
]
|
|
505
|
+
}
|
|
506
|
+
) : /* @__PURE__ */ s("div", { className: "relative", children: [
|
|
507
|
+
/* @__PURE__ */ e(
|
|
508
|
+
"input",
|
|
509
|
+
{
|
|
510
|
+
ref: y,
|
|
511
|
+
type: w,
|
|
512
|
+
id: t,
|
|
513
|
+
name: a,
|
|
514
|
+
value: o,
|
|
515
|
+
onChange: i,
|
|
516
|
+
onFocus: S,
|
|
517
|
+
onBlur: A,
|
|
518
|
+
placeholder: L ? c : "",
|
|
519
|
+
disabled: l,
|
|
520
|
+
inputMode: h,
|
|
521
|
+
className: F
|
|
522
|
+
}
|
|
523
|
+
),
|
|
524
|
+
m && /* @__PURE__ */ e(
|
|
525
|
+
"button",
|
|
526
|
+
{
|
|
527
|
+
type: "button",
|
|
528
|
+
onClick: M,
|
|
529
|
+
className: "absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground transition-colors focus:outline-none focus:ring-2 focus:ring-ring rounded p-1",
|
|
530
|
+
"aria-label": v ? "Ocultar contraseña" : "Mostrar contraseña",
|
|
531
|
+
children: v ? /* @__PURE__ */ e(R, { className: "w-5 h-5" }) : /* @__PURE__ */ e(I, { className: "w-5 h-5" })
|
|
532
|
+
}
|
|
533
|
+
)
|
|
534
|
+
] })
|
|
535
|
+
] }) : /* @__PURE__ */ s(O, { children: [
|
|
536
|
+
r && /* @__PURE__ */ s(
|
|
537
|
+
"label",
|
|
538
|
+
{
|
|
539
|
+
htmlFor: t,
|
|
540
|
+
className: "block text-base font-semibold text-foreground mb-2",
|
|
541
|
+
children: [
|
|
542
|
+
r,
|
|
543
|
+
u && /* @__PURE__ */ e("span", { className: "text-destructive ml-1", children: "*" })
|
|
544
|
+
]
|
|
545
|
+
}
|
|
546
|
+
),
|
|
547
|
+
n === "textarea" ? /* @__PURE__ */ e(
|
|
548
|
+
"textarea",
|
|
549
|
+
{
|
|
550
|
+
id: t,
|
|
551
|
+
name: a,
|
|
552
|
+
value: o,
|
|
553
|
+
onChange: i,
|
|
554
|
+
placeholder: c,
|
|
555
|
+
rows: b,
|
|
556
|
+
disabled: l,
|
|
557
|
+
className: `${F} resize-none`
|
|
558
|
+
}
|
|
559
|
+
) : n === "select" ? /* @__PURE__ */ s(
|
|
560
|
+
"select",
|
|
561
|
+
{
|
|
562
|
+
id: t,
|
|
563
|
+
name: a,
|
|
564
|
+
value: o,
|
|
565
|
+
onChange: i,
|
|
566
|
+
disabled: l,
|
|
567
|
+
className: F,
|
|
568
|
+
children: [
|
|
569
|
+
/* @__PURE__ */ e("option", { value: "", children: "Seleccionar opción" }),
|
|
570
|
+
f.map((N) => /* @__PURE__ */ e("option", { value: N.value, children: N.label }, N.value))
|
|
571
|
+
]
|
|
572
|
+
}
|
|
573
|
+
) : /* @__PURE__ */ s("div", { className: "relative", children: [
|
|
574
|
+
/* @__PURE__ */ e(
|
|
575
|
+
"input",
|
|
576
|
+
{
|
|
577
|
+
type: w,
|
|
578
|
+
id: t,
|
|
579
|
+
name: a,
|
|
580
|
+
value: o,
|
|
581
|
+
onChange: i,
|
|
582
|
+
onFocus: S,
|
|
583
|
+
onBlur: A,
|
|
584
|
+
placeholder: c,
|
|
585
|
+
disabled: l,
|
|
586
|
+
inputMode: h,
|
|
587
|
+
className: F
|
|
588
|
+
}
|
|
589
|
+
),
|
|
590
|
+
m && /* @__PURE__ */ e(
|
|
591
|
+
"button",
|
|
592
|
+
{
|
|
593
|
+
type: "button",
|
|
594
|
+
onClick: M,
|
|
595
|
+
className: "absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground transition-colors focus:outline-none focus:ring-2 focus:ring-ring rounded p-1",
|
|
596
|
+
"aria-label": v ? "Ocultar contraseña" : "Mostrar contraseña",
|
|
597
|
+
children: v ? /* @__PURE__ */ e(R, { className: "w-5 h-5" }) : /* @__PURE__ */ e(I, { className: "w-5 h-5" })
|
|
598
|
+
}
|
|
599
|
+
)
|
|
600
|
+
] })
|
|
601
|
+
] }),
|
|
602
|
+
x && /* @__PURE__ */ e("p", { className: `mt-2 text-sm ${p?.includes("border-red-500") ? "text-destructive" : "text-muted-foreground"}`, children: x })
|
|
603
|
+
] });
|
|
604
|
+
}
|
|
605
|
+
function Xe({
|
|
606
|
+
value: r,
|
|
607
|
+
onChange: t,
|
|
608
|
+
placeholder: a = "Buscar...",
|
|
609
|
+
className: n = ""
|
|
610
|
+
}) {
|
|
611
|
+
return /* @__PURE__ */ s("div", { className: `relative ${n}`, children: [
|
|
612
|
+
/* @__PURE__ */ e(re, { className: "absolute left-4 top-1/2 transform -translate-y-1/2 w-5 h-5 text-gray-400" }),
|
|
613
|
+
/* @__PURE__ */ e(
|
|
614
|
+
"input",
|
|
615
|
+
{
|
|
616
|
+
type: "text",
|
|
617
|
+
value: r,
|
|
618
|
+
onChange: (o) => t(o.target.value),
|
|
619
|
+
placeholder: a,
|
|
620
|
+
className: "w-full pl-12 pr-4 py-3 bg-white border-2 border-gray-200 rounded-xl focus:ring-2 focus:ring-uno focus:border-uno transition-all text-sm font-medium text-divisiones placeholder-gray-400"
|
|
621
|
+
}
|
|
622
|
+
),
|
|
623
|
+
r && /* @__PURE__ */ e(
|
|
624
|
+
"button",
|
|
625
|
+
{
|
|
626
|
+
onClick: () => t(""),
|
|
627
|
+
className: "absolute right-4 top-1/2 transform -translate-y-1/2 text-gray-400 hover:text-divisiones transition-colors",
|
|
628
|
+
type: "button",
|
|
629
|
+
children: /* @__PURE__ */ e(E, { className: "w-4 h-4" })
|
|
630
|
+
}
|
|
631
|
+
)
|
|
632
|
+
] });
|
|
633
|
+
}
|
|
634
|
+
function Ye({
|
|
635
|
+
id: r,
|
|
636
|
+
name: t,
|
|
637
|
+
label: a,
|
|
638
|
+
accept: n = ".pdf,application/pdf",
|
|
639
|
+
required: o = !1,
|
|
640
|
+
helperText: i,
|
|
641
|
+
onChange: d,
|
|
642
|
+
error: c,
|
|
643
|
+
disabled: u = !1,
|
|
644
|
+
maxSizeMB: f = 10,
|
|
645
|
+
currentFileName: b
|
|
646
|
+
}) {
|
|
647
|
+
const [p, g] = k(null), [x, l] = k(!1), h = G(null), P = (m) => {
|
|
648
|
+
if (n.includes("pdf") && m.type !== "application/pdf")
|
|
649
|
+
return "El archivo debe ser un PDF";
|
|
650
|
+
const w = f * 1024 * 1024;
|
|
651
|
+
return m.size > w ? `El archivo no debe superar ${f}MB` : null;
|
|
652
|
+
}, $ = (m) => {
|
|
653
|
+
if (!m) {
|
|
654
|
+
g(null), d(null);
|
|
655
|
+
return;
|
|
656
|
+
}
|
|
657
|
+
if (P(m)) {
|
|
658
|
+
d(null);
|
|
659
|
+
return;
|
|
660
|
+
}
|
|
661
|
+
g(m), d(m);
|
|
662
|
+
}, v = (m) => {
|
|
663
|
+
const w = m.target.files?.[0] || null;
|
|
664
|
+
$(w);
|
|
665
|
+
}, C = (m) => {
|
|
666
|
+
m.preventDefault(), m.stopPropagation(), m.type === "dragenter" || m.type === "dragover" ? l(!0) : m.type === "dragleave" && l(!1);
|
|
667
|
+
}, y = (m) => {
|
|
668
|
+
if (m.preventDefault(), m.stopPropagation(), l(!1), u) return;
|
|
669
|
+
const w = m.dataTransfer.files?.[0];
|
|
670
|
+
w && $(w);
|
|
671
|
+
}, D = () => {
|
|
672
|
+
g(null), d(null), h.current && (h.current.value = "");
|
|
673
|
+
};
|
|
674
|
+
return /* @__PURE__ */ s("div", { className: "space-y-2", children: [
|
|
675
|
+
/* @__PURE__ */ s("label", { htmlFor: r, className: "block text-sm font-medium text-foreground", children: [
|
|
676
|
+
a,
|
|
677
|
+
o && /* @__PURE__ */ e("span", { className: "text-destructive ml-1", children: "*" })
|
|
678
|
+
] }),
|
|
679
|
+
/* @__PURE__ */ s(
|
|
680
|
+
"div",
|
|
681
|
+
{
|
|
682
|
+
className: `
|
|
683
|
+
relative border-2 border-dashed rounded-lg p-6 transition-all
|
|
684
|
+
${x ? "border-primary bg-primary/5" : "border-border"}
|
|
685
|
+
${u ? "opacity-50 cursor-not-allowed" : "cursor-pointer hover:border-primary/50"}
|
|
686
|
+
${c ? "border-destructive" : ""}
|
|
687
|
+
`,
|
|
688
|
+
onDragEnter: C,
|
|
689
|
+
onDragLeave: C,
|
|
690
|
+
onDragOver: C,
|
|
691
|
+
onDrop: y,
|
|
692
|
+
onClick: () => {
|
|
693
|
+
u || h.current?.click();
|
|
694
|
+
},
|
|
695
|
+
children: [
|
|
696
|
+
/* @__PURE__ */ e(
|
|
697
|
+
"input",
|
|
698
|
+
{
|
|
699
|
+
ref: h,
|
|
700
|
+
id: r,
|
|
701
|
+
name: t,
|
|
702
|
+
type: "file",
|
|
703
|
+
accept: n,
|
|
704
|
+
onChange: v,
|
|
705
|
+
disabled: u,
|
|
706
|
+
className: "hidden"
|
|
707
|
+
}
|
|
708
|
+
),
|
|
709
|
+
p || b ? /* @__PURE__ */ s("div", { className: "flex items-center justify-between", children: [
|
|
710
|
+
/* @__PURE__ */ s("div", { className: "flex items-center gap-3 flex-1 min-w-0", children: [
|
|
711
|
+
/* @__PURE__ */ e("div", { className: "p-2 rounded-lg bg-primary/10 flex-shrink-0", children: /* @__PURE__ */ e(z, { className: "w-5 h-5 text-primary" }) }),
|
|
712
|
+
/* @__PURE__ */ s("div", { className: "flex-1 min-w-0", children: [
|
|
713
|
+
/* @__PURE__ */ e("p", { className: "text-sm font-medium text-foreground truncate", children: p?.name || b }),
|
|
714
|
+
p && /* @__PURE__ */ s("p", { className: "text-xs text-muted-foreground", children: [
|
|
715
|
+
(p.size / 1024 / 1024).toFixed(2),
|
|
716
|
+
" MB"
|
|
717
|
+
] })
|
|
718
|
+
] })
|
|
719
|
+
] }),
|
|
720
|
+
!u && /* @__PURE__ */ e(
|
|
721
|
+
"button",
|
|
722
|
+
{
|
|
723
|
+
type: "button",
|
|
724
|
+
onClick: (m) => {
|
|
725
|
+
m.stopPropagation(), D();
|
|
726
|
+
},
|
|
727
|
+
className: "p-2 rounded-lg hover:bg-destructive/10 transition-colors flex-shrink-0",
|
|
728
|
+
children: /* @__PURE__ */ e(E, { className: "w-4 h-4 text-destructive" })
|
|
729
|
+
}
|
|
730
|
+
)
|
|
731
|
+
] }) : /* @__PURE__ */ s("div", { className: "text-center", children: [
|
|
732
|
+
/* @__PURE__ */ e(te, { className: "mx-auto h-12 w-12 text-muted-foreground" }),
|
|
733
|
+
/* @__PURE__ */ s("div", { className: "mt-4", children: [
|
|
734
|
+
/* @__PURE__ */ s("p", { className: "text-sm text-foreground", children: [
|
|
735
|
+
"Arrastra y suelta tu archivo aquí, o",
|
|
736
|
+
" ",
|
|
737
|
+
/* @__PURE__ */ e("span", { className: "text-primary font-medium", children: "haz clic para seleccionar" })
|
|
738
|
+
] }),
|
|
739
|
+
/* @__PURE__ */ e("p", { className: "text-xs text-muted-foreground mt-2", children: n.includes("pdf") ? `Archivos PDF (máx. ${f}MB)` : `Máximo ${f}MB` })
|
|
740
|
+
] })
|
|
741
|
+
] })
|
|
742
|
+
]
|
|
743
|
+
}
|
|
744
|
+
),
|
|
745
|
+
i && !c && /* @__PURE__ */ e("p", { className: "text-xs text-muted-foreground", children: i }),
|
|
746
|
+
c && /* @__PURE__ */ e("p", { className: "text-xs text-destructive", children: c })
|
|
747
|
+
] });
|
|
748
|
+
}
|
|
749
|
+
function qe({
|
|
750
|
+
label: r,
|
|
751
|
+
id: t,
|
|
752
|
+
options: a,
|
|
753
|
+
selectedIds: n,
|
|
754
|
+
onChange: o,
|
|
755
|
+
loading: i = !1,
|
|
756
|
+
disabled: d = !1,
|
|
757
|
+
loadingMessage: c = "Cargando...",
|
|
758
|
+
emptyMessage: u,
|
|
759
|
+
renderLabel: f,
|
|
760
|
+
helperText: b,
|
|
761
|
+
itemName: p = "item",
|
|
762
|
+
itemNamePlural: g,
|
|
763
|
+
maxHeight: x = "max-h-60",
|
|
764
|
+
headerAction: l,
|
|
765
|
+
emptyAction: h,
|
|
766
|
+
className: P = ""
|
|
767
|
+
}) {
|
|
768
|
+
const $ = g || `${p}s`, v = n.length, C = v > 0;
|
|
769
|
+
return /* @__PURE__ */ s("div", { className: `space-y-2 ${P}`, children: [
|
|
770
|
+
/* @__PURE__ */ s("div", { className: l ? "flex items-center justify-between" : "", children: [
|
|
771
|
+
/* @__PURE__ */ e("label", { htmlFor: t, className: "block text-sm font-medium text-foreground", children: r }),
|
|
772
|
+
l && /* @__PURE__ */ e(
|
|
773
|
+
B,
|
|
774
|
+
{
|
|
775
|
+
type: "button",
|
|
776
|
+
variant: l.variant || "outline",
|
|
777
|
+
icon: l.icon,
|
|
778
|
+
label: l.label,
|
|
779
|
+
onClick: l.onClick,
|
|
780
|
+
disabled: d,
|
|
781
|
+
className: "text-xs"
|
|
782
|
+
}
|
|
783
|
+
)
|
|
784
|
+
] }),
|
|
785
|
+
/* @__PURE__ */ e("div", { className: `${x} overflow-y-auto border border-border rounded-lg p-3 bg-background`, children: i ? /* @__PURE__ */ e("div", { className: "text-center py-4 text-muted-foreground", children: c }) : a.length === 0 ? /* @__PURE__ */ s("div", { className: "text-center py-4 space-y-3", children: [
|
|
786
|
+
u && /* @__PURE__ */ e("p", { className: "text-sm text-muted-foreground", children: u }),
|
|
787
|
+
h && /* @__PURE__ */ e(
|
|
788
|
+
B,
|
|
789
|
+
{
|
|
790
|
+
type: "button",
|
|
791
|
+
variant: h.variant || "primary",
|
|
792
|
+
icon: h.icon,
|
|
793
|
+
label: h.label,
|
|
794
|
+
onClick: h.onClick,
|
|
795
|
+
disabled: d
|
|
796
|
+
}
|
|
797
|
+
)
|
|
798
|
+
] }) : /* @__PURE__ */ e("div", { className: "space-y-2", children: a.map((y) => {
|
|
799
|
+
const D = n.includes(y.id);
|
|
800
|
+
return /* @__PURE__ */ s(
|
|
801
|
+
"label",
|
|
802
|
+
{
|
|
803
|
+
className: "flex items-center space-x-2 p-2 rounded hover:bg-card/50 cursor-pointer transition-colors",
|
|
804
|
+
children: [
|
|
805
|
+
/* @__PURE__ */ e(
|
|
806
|
+
"input",
|
|
807
|
+
{
|
|
808
|
+
type: "checkbox",
|
|
809
|
+
checked: D,
|
|
810
|
+
onChange: () => o(y.id),
|
|
811
|
+
disabled: d,
|
|
812
|
+
className: "w-4 h-4 text-primary border-border rounded focus:ring-primary focus:ring-2"
|
|
813
|
+
}
|
|
814
|
+
),
|
|
815
|
+
/* @__PURE__ */ e("span", { className: "text-sm text-foreground", children: f(y) })
|
|
816
|
+
]
|
|
817
|
+
},
|
|
818
|
+
y.id
|
|
819
|
+
);
|
|
820
|
+
}) }) }),
|
|
821
|
+
b && /* @__PURE__ */ e("p", { className: "text-xs text-muted-foreground", children: b }),
|
|
822
|
+
C && /* @__PURE__ */ s("p", { className: "text-xs text-primary", children: [
|
|
823
|
+
v,
|
|
824
|
+
" ",
|
|
825
|
+
v === 1 ? p : $,
|
|
826
|
+
" seleccionado",
|
|
827
|
+
v !== 1 ? "s" : ""
|
|
828
|
+
] })
|
|
829
|
+
] });
|
|
830
|
+
}
|
|
831
|
+
function Je({
|
|
832
|
+
label: r,
|
|
833
|
+
description: t,
|
|
834
|
+
value: a,
|
|
835
|
+
onChange: n,
|
|
836
|
+
icon: o,
|
|
837
|
+
disabled: i = !1,
|
|
838
|
+
className: d = ""
|
|
839
|
+
}) {
|
|
840
|
+
const c = !!a;
|
|
841
|
+
return /* @__PURE__ */ s("div", { className: `flex items-center justify-between p-4 bg-background rounded-xl border border-border hover:bg-card transition-colors duration-200 ${i ? "opacity-50 cursor-not-allowed" : ""} ${d}`, children: [
|
|
842
|
+
/* @__PURE__ */ s("div", { className: "flex items-center gap-3 flex-1", children: [
|
|
843
|
+
o && /* @__PURE__ */ e("div", { className: "flex-shrink-0 w-10 h-10 bg-gradient-to-br from-primary/80 to-primary-foreground/20 rounded-lg flex items-center justify-center text-primary-foreground", children: o }),
|
|
844
|
+
/* @__PURE__ */ s("div", { className: "flex-1", children: [
|
|
845
|
+
/* @__PURE__ */ e("label", { className: "block text-sm font-semibold text-foreground mb-1", children: r }),
|
|
846
|
+
t && /* @__PURE__ */ e("span", { className: "text-xs text-muted-foreground", children: t })
|
|
847
|
+
] })
|
|
848
|
+
] }),
|
|
849
|
+
/* @__PURE__ */ e(
|
|
850
|
+
T.button,
|
|
851
|
+
{
|
|
852
|
+
type: "button",
|
|
853
|
+
onClick: () => !i && n(!c),
|
|
854
|
+
disabled: i,
|
|
855
|
+
className: `
|
|
856
|
+
relative flex items-center w-14 h-8 rounded-full p-1 transition-colors duration-300
|
|
857
|
+
focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary/50
|
|
858
|
+
${i ? "cursor-not-allowed" : "cursor-pointer"}
|
|
859
|
+
${c ? "bg-gradient-to-r from-green-500 to-green-600" : "bg-muted"}
|
|
860
|
+
`,
|
|
861
|
+
whileTap: i ? {} : { scale: 0.95 },
|
|
862
|
+
children: /* @__PURE__ */ e(
|
|
863
|
+
T.div,
|
|
864
|
+
{
|
|
865
|
+
className: "w-6 h-6 bg-white rounded-full shadow-lg flex items-center justify-center",
|
|
866
|
+
animate: {
|
|
867
|
+
x: c ? 24 : 0
|
|
868
|
+
},
|
|
869
|
+
transition: {
|
|
870
|
+
type: "spring",
|
|
871
|
+
stiffness: 500,
|
|
872
|
+
damping: 30
|
|
873
|
+
},
|
|
874
|
+
children: c ? /* @__PURE__ */ e(ne, { className: "w-4 h-4 text-green-600" }) : /* @__PURE__ */ e(E, { className: "w-4 h-4 text-muted-foreground" })
|
|
875
|
+
}
|
|
876
|
+
)
|
|
877
|
+
}
|
|
878
|
+
)
|
|
879
|
+
] });
|
|
880
|
+
}
|
|
881
|
+
const $e = (r) => {
|
|
882
|
+
const t = typeof r == "string" ? parseFloat(r) : r;
|
|
883
|
+
return new Intl.NumberFormat("es-CO", {
|
|
884
|
+
style: "currency",
|
|
885
|
+
currency: "COP",
|
|
886
|
+
minimumFractionDigits: 0,
|
|
887
|
+
maximumFractionDigits: 0
|
|
888
|
+
}).format(t);
|
|
889
|
+
};
|
|
890
|
+
function Qe({
|
|
891
|
+
value: r,
|
|
892
|
+
className: t = "",
|
|
893
|
+
bold: a = !1,
|
|
894
|
+
primary: n = !1,
|
|
895
|
+
secondary: o = !1,
|
|
896
|
+
success: i = !1,
|
|
897
|
+
error: d = !1,
|
|
898
|
+
size: c = "base",
|
|
899
|
+
emptyText: u = "-"
|
|
900
|
+
}) {
|
|
901
|
+
if (r == null)
|
|
902
|
+
return /* @__PURE__ */ e("span", { className: `text-muted-foreground ${t}`, children: u });
|
|
903
|
+
const f = typeof r == "string" ? parseFloat(r) : r;
|
|
904
|
+
if (isNaN(f))
|
|
905
|
+
return /* @__PURE__ */ e("span", { className: `text-muted-foreground ${t}`, children: u });
|
|
906
|
+
const b = $e(f), p = {
|
|
907
|
+
sm: "text-sm",
|
|
908
|
+
base: "text-base",
|
|
909
|
+
lg: "text-lg",
|
|
910
|
+
xl: "text-xl",
|
|
911
|
+
"2xl": "text-2xl"
|
|
912
|
+
}, g = n ? "text-primary" : o ? "text-secondary" : i ? "text-green-600 dark:text-green-400" : d ? "text-destructive" : "text-foreground", x = a ? "font-bold" : "font-normal";
|
|
913
|
+
return /* @__PURE__ */ e(
|
|
914
|
+
"span",
|
|
915
|
+
{
|
|
916
|
+
className: `${p[c]} ${g} ${x} ${t}`,
|
|
917
|
+
children: b
|
|
918
|
+
}
|
|
919
|
+
);
|
|
920
|
+
}
|
|
921
|
+
const Ce = {
|
|
922
|
+
small: { width: 60, height: 45 },
|
|
923
|
+
default: { width: 120, height: 90 },
|
|
924
|
+
large: { width: 180, height: 135 }
|
|
925
|
+
}, Fe = {
|
|
926
|
+
default: "/logo.png",
|
|
927
|
+
logo2: "/logo2.png",
|
|
928
|
+
white: "/logoW.png",
|
|
929
|
+
whiteNoBg: "/logoW_sin_bg.png"
|
|
930
|
+
}, er = ({
|
|
931
|
+
size: r = "default",
|
|
932
|
+
variant: t = "whiteNoBg",
|
|
933
|
+
src: a,
|
|
934
|
+
alt: n = "Logo de Buenity",
|
|
935
|
+
className: o = "",
|
|
936
|
+
fondoColor: i = "transparent",
|
|
937
|
+
// valor por defecto: transparente
|
|
938
|
+
animated: d = !1,
|
|
939
|
+
// animaciones desactivadas por defecto
|
|
940
|
+
animationType: c = "fade",
|
|
941
|
+
animationDuration: u = 1
|
|
942
|
+
}) => {
|
|
943
|
+
const { width: f, height: b } = Ce[r], p = a || Fe[t], x = (() => {
|
|
944
|
+
if (!d) return {};
|
|
945
|
+
const h = {
|
|
946
|
+
initial: { opacity: 0 },
|
|
947
|
+
animate: { opacity: 1 },
|
|
948
|
+
transition: { duration: u }
|
|
949
|
+
};
|
|
950
|
+
switch (c) {
|
|
951
|
+
case "fade":
|
|
952
|
+
return {
|
|
953
|
+
...h,
|
|
954
|
+
initial: { opacity: 0 },
|
|
955
|
+
animate: { opacity: 1 }
|
|
956
|
+
};
|
|
957
|
+
case "scale":
|
|
958
|
+
return {
|
|
959
|
+
initial: { opacity: 0, scale: 0.8 },
|
|
960
|
+
animate: { opacity: 1, scale: 1 },
|
|
961
|
+
transition: { duration: u, ease: "easeOut" }
|
|
962
|
+
};
|
|
963
|
+
case "pulse":
|
|
964
|
+
return {
|
|
965
|
+
initial: { opacity: 0, scale: 1 },
|
|
966
|
+
animate: {
|
|
967
|
+
opacity: 1,
|
|
968
|
+
scale: [1, 1.05, 1]
|
|
969
|
+
},
|
|
970
|
+
transition: {
|
|
971
|
+
duration: u,
|
|
972
|
+
repeat: 1 / 0,
|
|
973
|
+
repeatType: "reverse",
|
|
974
|
+
ease: "easeInOut"
|
|
975
|
+
}
|
|
976
|
+
};
|
|
977
|
+
case "bounce":
|
|
978
|
+
return {
|
|
979
|
+
initial: { opacity: 0, y: -20 },
|
|
980
|
+
animate: {
|
|
981
|
+
opacity: 1,
|
|
982
|
+
y: 0
|
|
983
|
+
},
|
|
984
|
+
transition: {
|
|
985
|
+
duration: u,
|
|
986
|
+
type: "spring",
|
|
987
|
+
stiffness: 200,
|
|
988
|
+
damping: 10
|
|
989
|
+
}
|
|
990
|
+
};
|
|
991
|
+
case "rotate":
|
|
992
|
+
return {
|
|
993
|
+
initial: { opacity: 0, rotate: -180 },
|
|
994
|
+
animate: {
|
|
995
|
+
opacity: 1,
|
|
996
|
+
rotate: 0
|
|
997
|
+
},
|
|
998
|
+
transition: {
|
|
999
|
+
duration: u,
|
|
1000
|
+
ease: "easeOut"
|
|
1001
|
+
}
|
|
1002
|
+
};
|
|
1003
|
+
default:
|
|
1004
|
+
return h;
|
|
1005
|
+
}
|
|
1006
|
+
})(), l = {
|
|
1007
|
+
className: "flex items-center rounded-xl justify-center",
|
|
1008
|
+
style: { backgroundColor: i },
|
|
1009
|
+
...d ? x : {}
|
|
1010
|
+
};
|
|
1011
|
+
return d ? /* @__PURE__ */ e(T.div, { ...l, children: /* @__PURE__ */ e(
|
|
1012
|
+
"img",
|
|
1013
|
+
{
|
|
1014
|
+
src: p,
|
|
1015
|
+
width: f,
|
|
1016
|
+
height: b,
|
|
1017
|
+
alt: n,
|
|
1018
|
+
className: `object-contain ${o}`
|
|
1019
|
+
}
|
|
1020
|
+
) }) : /* @__PURE__ */ e("div", { ...l, children: /* @__PURE__ */ e(
|
|
1021
|
+
"img",
|
|
1022
|
+
{
|
|
1023
|
+
src: p,
|
|
1024
|
+
width: f,
|
|
1025
|
+
height: b,
|
|
1026
|
+
alt: n,
|
|
1027
|
+
className: `object-contain ${o}`
|
|
1028
|
+
}
|
|
1029
|
+
) });
|
|
1030
|
+
};
|
|
1031
|
+
function Te(r) {
|
|
1032
|
+
const t = r.split("?")[0], a = t.match(/rp-(\d+)/i);
|
|
1033
|
+
if (a) return `rp-${a[1]}`;
|
|
1034
|
+
const n = t.split("/");
|
|
1035
|
+
return (n[n.length - 1] || "").replace(/\.(pdf|jpg|jpeg|png|gif|webp)$/i, "") || "Soporte";
|
|
1036
|
+
}
|
|
1037
|
+
function rr({
|
|
1038
|
+
url: r,
|
|
1039
|
+
isOpen: t,
|
|
1040
|
+
onClose: a,
|
|
1041
|
+
displayName: n
|
|
1042
|
+
}) {
|
|
1043
|
+
const [o, i] = k(!0), [d, c] = k(null), [u, f] = k("unknown");
|
|
1044
|
+
K(() => {
|
|
1045
|
+
if (!r) {
|
|
1046
|
+
f("unknown"), i(!1);
|
|
1047
|
+
return;
|
|
1048
|
+
}
|
|
1049
|
+
const l = r.toLowerCase();
|
|
1050
|
+
l.match(/\.(jpg|jpeg|png|gif|webp|svg|bmp)$/) ? f("image") : l.match(/\.pdf$/) || l.includes("application/pdf") ? f("pdf") : f("unknown"), i(!1), c(null);
|
|
1051
|
+
}, [r]);
|
|
1052
|
+
const b = () => {
|
|
1053
|
+
c("Error al cargar la imagen"), i(!1);
|
|
1054
|
+
}, p = () => {
|
|
1055
|
+
if (!r) return;
|
|
1056
|
+
const l = document.createElement("a");
|
|
1057
|
+
l.href = r, l.download = g, l.target = "_blank", document.body.appendChild(l), l.click(), document.body.removeChild(l);
|
|
1058
|
+
}, g = n ?? (r ? Te(r) : "Archivo"), x = () => {
|
|
1059
|
+
switch (u) {
|
|
1060
|
+
case "image":
|
|
1061
|
+
return /* @__PURE__ */ e(se, { className: "w-6 h-6 text-primary" });
|
|
1062
|
+
case "pdf":
|
|
1063
|
+
return /* @__PURE__ */ e(z, { className: "w-6 h-6 text-primary" });
|
|
1064
|
+
default:
|
|
1065
|
+
return /* @__PURE__ */ e(U, { className: "w-6 h-6 text-primary" });
|
|
1066
|
+
}
|
|
1067
|
+
};
|
|
1068
|
+
return t ? /* @__PURE__ */ e(
|
|
1069
|
+
pe,
|
|
1070
|
+
{
|
|
1071
|
+
isOpen: !0,
|
|
1072
|
+
onClose: a,
|
|
1073
|
+
title: g,
|
|
1074
|
+
tamaño: "fullscreen",
|
|
1075
|
+
canClose: !0,
|
|
1076
|
+
children: /* @__PURE__ */ e("div", { className: "flex flex-col h-full min-h-[90dvh]", children: /* @__PURE__ */ s("div", { className: "flex-1 overflow-auto mt-4 bg-muted/30 rounded-xl p-4 min-h-[60vh]", children: [
|
|
1077
|
+
!r && /* @__PURE__ */ s("div", { className: "flex flex-col items-center justify-center min-h-[400px] text-muted-foreground", children: [
|
|
1078
|
+
/* @__PURE__ */ e(U, { className: "w-12 h-12 mb-4 opacity-50" }),
|
|
1079
|
+
/* @__PURE__ */ e("p", { children: "No hay archivo para visualizar." })
|
|
1080
|
+
] }),
|
|
1081
|
+
r && o && /* @__PURE__ */ s("div", { className: "flex flex-col items-center justify-center min-h-[400px] text-muted-foreground", children: [
|
|
1082
|
+
/* @__PURE__ */ e(oe, { className: "w-12 h-12 text-primary animate-spin mb-4" }),
|
|
1083
|
+
/* @__PURE__ */ e("p", { children: "Cargando archivo..." })
|
|
1084
|
+
] }),
|
|
1085
|
+
r && d && /* @__PURE__ */ s("div", { className: "flex flex-col items-center justify-center min-h-[400px] text-center", children: [
|
|
1086
|
+
/* @__PURE__ */ e("div", { className: "w-16 h-16 bg-destructive/10 rounded-full flex items-center justify-center mx-auto mb-4", children: /* @__PURE__ */ e(ae, { className: "w-8 h-8 text-destructive" }) }),
|
|
1087
|
+
/* @__PURE__ */ e("h3", { className: "text-lg font-semibold text-foreground mb-2", children: "Error al cargar el archivo" }),
|
|
1088
|
+
/* @__PURE__ */ e("p", { className: "text-muted-foreground mb-4", children: d }),
|
|
1089
|
+
/* @__PURE__ */ e(
|
|
1090
|
+
B,
|
|
1091
|
+
{
|
|
1092
|
+
type: "button",
|
|
1093
|
+
variant: "primary",
|
|
1094
|
+
icon: _,
|
|
1095
|
+
label: "Intentar descargar",
|
|
1096
|
+
onClick: p
|
|
1097
|
+
}
|
|
1098
|
+
)
|
|
1099
|
+
] }),
|
|
1100
|
+
r && !o && !d && /* @__PURE__ */ s(O, { children: [
|
|
1101
|
+
u === "image" && /* @__PURE__ */ e("div", { className: "flex items-center justify-center min-h-[400px]", children: /* @__PURE__ */ e(
|
|
1102
|
+
"img",
|
|
1103
|
+
{
|
|
1104
|
+
src: r,
|
|
1105
|
+
alt: g,
|
|
1106
|
+
onError: b,
|
|
1107
|
+
onLoad: () => i(!1),
|
|
1108
|
+
className: "max-w-full max-h-[75vh] object-contain rounded-lg shadow-lg border border-border"
|
|
1109
|
+
}
|
|
1110
|
+
) }),
|
|
1111
|
+
u === "pdf" && /* @__PURE__ */ e("div", { className: "flex items-center justify-center min-h-[82dvh] w-full", children: /* @__PURE__ */ e(
|
|
1112
|
+
"iframe",
|
|
1113
|
+
{
|
|
1114
|
+
src: r,
|
|
1115
|
+
onLoad: () => i(!1),
|
|
1116
|
+
className: "w-full h-[75vh] rounded-lg shadow-lg bg-background border border-border",
|
|
1117
|
+
title: g
|
|
1118
|
+
}
|
|
1119
|
+
) }),
|
|
1120
|
+
u === "unknown" && /* @__PURE__ */ s("div", { className: "flex flex-col items-center justify-center min-h-[400px] text-center", children: [
|
|
1121
|
+
/* @__PURE__ */ e("div", { className: "w-16 h-16 bg-muted rounded-full flex items-center justify-center mx-auto mb-4", children: x() }),
|
|
1122
|
+
/* @__PURE__ */ e("h3", { className: "text-lg font-semibold text-foreground mb-2", children: "Tipo de archivo no soportado para vista previa" }),
|
|
1123
|
+
/* @__PURE__ */ e("p", { className: "text-muted-foreground mb-4", children: "Puede descargar el archivo para abrirlo en su dispositivo." }),
|
|
1124
|
+
/* @__PURE__ */ e(
|
|
1125
|
+
B,
|
|
1126
|
+
{
|
|
1127
|
+
type: "button",
|
|
1128
|
+
variant: "primary",
|
|
1129
|
+
icon: _,
|
|
1130
|
+
label: "Descargar archivo",
|
|
1131
|
+
onClick: p
|
|
1132
|
+
}
|
|
1133
|
+
)
|
|
1134
|
+
] })
|
|
1135
|
+
] })
|
|
1136
|
+
] }) })
|
|
1137
|
+
}
|
|
1138
|
+
) : null;
|
|
1139
|
+
}
|
|
1140
|
+
function tr({
|
|
1141
|
+
url: r,
|
|
1142
|
+
displayName: t,
|
|
1143
|
+
icon: a,
|
|
1144
|
+
className: n = "inline-flex items-center gap-2 text-primary hover:text-primary/80 hover:underline font-medium"
|
|
1145
|
+
}) {
|
|
1146
|
+
const o = r.startsWith("http") || r.startsWith("//") ? r : `${typeof window < "u" ? window.location.origin : ""}${r.startsWith("/") ? r : `/${r}`}`;
|
|
1147
|
+
return /* @__PURE__ */ s(
|
|
1148
|
+
"a",
|
|
1149
|
+
{
|
|
1150
|
+
href: o,
|
|
1151
|
+
target: "_blank",
|
|
1152
|
+
rel: "noopener noreferrer",
|
|
1153
|
+
className: n,
|
|
1154
|
+
children: [
|
|
1155
|
+
a ?? /* @__PURE__ */ e(z, { className: "w-4 h-4 shrink-0" }),
|
|
1156
|
+
t
|
|
1157
|
+
]
|
|
1158
|
+
}
|
|
1159
|
+
);
|
|
1160
|
+
}
|
|
1161
|
+
const Pe = {
|
|
1162
|
+
sm: "h-4 w-4",
|
|
1163
|
+
md: "h-6 w-6",
|
|
1164
|
+
lg: "h-10 w-10",
|
|
1165
|
+
xl: "h-16 w-16"
|
|
1166
|
+
}, Ee = {
|
|
1167
|
+
primary: "text-primary",
|
|
1168
|
+
secondary: "text-secondary",
|
|
1169
|
+
muted: "text-muted-foreground",
|
|
1170
|
+
destructive: "text-destructive"
|
|
1171
|
+
};
|
|
1172
|
+
function je({
|
|
1173
|
+
size: r = "md",
|
|
1174
|
+
variant: t = "muted",
|
|
1175
|
+
className: a = ""
|
|
1176
|
+
}) {
|
|
1177
|
+
return /* @__PURE__ */ s(
|
|
1178
|
+
"svg",
|
|
1179
|
+
{
|
|
1180
|
+
className: `${Pe[r]} ${Ee[t]} animate-spin ${a}`,
|
|
1181
|
+
viewBox: "0 0 24 24",
|
|
1182
|
+
fill: "none",
|
|
1183
|
+
"aria-hidden": "true",
|
|
1184
|
+
role: "status",
|
|
1185
|
+
"aria-label": "Cargando",
|
|
1186
|
+
children: [
|
|
1187
|
+
/* @__PURE__ */ e(
|
|
1188
|
+
"circle",
|
|
1189
|
+
{
|
|
1190
|
+
className: "opacity-25",
|
|
1191
|
+
cx: "12",
|
|
1192
|
+
cy: "12",
|
|
1193
|
+
r: "10",
|
|
1194
|
+
stroke: "currentColor",
|
|
1195
|
+
strokeWidth: "4"
|
|
1196
|
+
}
|
|
1197
|
+
),
|
|
1198
|
+
/* @__PURE__ */ e(
|
|
1199
|
+
"path",
|
|
1200
|
+
{
|
|
1201
|
+
className: "opacity-75",
|
|
1202
|
+
fill: "currentColor",
|
|
1203
|
+
d: "M4 12a8 8 0 018-8v4a4 4 0 00-4 4H4z"
|
|
1204
|
+
}
|
|
1205
|
+
)
|
|
1206
|
+
]
|
|
1207
|
+
}
|
|
1208
|
+
);
|
|
1209
|
+
}
|
|
1210
|
+
function nr({
|
|
1211
|
+
text: r = "Cargando datos...",
|
|
1212
|
+
size: t = "lg",
|
|
1213
|
+
variant: a = "muted",
|
|
1214
|
+
className: n = "",
|
|
1215
|
+
textClassName: o = ""
|
|
1216
|
+
}) {
|
|
1217
|
+
return /* @__PURE__ */ e("div", { className: `w-full h-screen flex items-center justify-center p-6 ${n}`, children: /* @__PURE__ */ s("div", { className: "flex flex-col items-center gap-4", children: [
|
|
1218
|
+
/* @__PURE__ */ e(je, { size: t, variant: a }),
|
|
1219
|
+
r && /* @__PURE__ */ e("span", { className: `text-lg font-semibold text-muted-foreground ${o}`, children: r })
|
|
1220
|
+
] }) });
|
|
1221
|
+
}
|
|
1222
|
+
export {
|
|
1223
|
+
B as ActionButton,
|
|
1224
|
+
Qe as CurrencyDisplay,
|
|
1225
|
+
He as DataTable,
|
|
1226
|
+
Ke as DeleteConfirmModal,
|
|
1227
|
+
tr as FileLink,
|
|
1228
|
+
Ye as FileUpload,
|
|
1229
|
+
rr as FileViewerModal,
|
|
1230
|
+
Ze as FormField,
|
|
1231
|
+
je as Loader,
|
|
1232
|
+
nr as LoaderScreen,
|
|
1233
|
+
er as Logo,
|
|
1234
|
+
pe as Modal,
|
|
1235
|
+
qe as MultiSelectCheckbox,
|
|
1236
|
+
Xe as SearchBar,
|
|
1237
|
+
Ue as ThemeProvider,
|
|
1238
|
+
Ge as Toast,
|
|
1239
|
+
Je as ToggleSwitch,
|
|
1240
|
+
Re as createTheme,
|
|
1241
|
+
j as defaultColors,
|
|
1242
|
+
de as defaultTheme,
|
|
1243
|
+
Ie as generateCSSVariables,
|
|
1244
|
+
fe as generateCompatibilityVariables,
|
|
1245
|
+
We as generateTailwindV4CSS,
|
|
1246
|
+
me as generateTailwindV4Theme,
|
|
1247
|
+
Te as getRpSoporteDisplayName,
|
|
1248
|
+
ue as getTailwindColors,
|
|
1249
|
+
Ve as getTailwindConfig,
|
|
1250
|
+
_e as useTheme
|
|
1251
|
+
};
|