unicornial-ui 0.0.12 → 0.0.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/types/components/Form.d.ts +24 -0
- package/dist/types/components/Form.d.ts.map +1 -0
- package/dist/types/components/Input.d.ts +2 -7
- package/dist/types/components/Input.d.ts.map +1 -1
- package/dist/types/components/Surface.d.ts.map +1 -1
- package/dist/types/components/UnicornialInput.d.ts +13 -0
- package/dist/types/components/UnicornialInput.d.ts.map +1 -0
- package/dist/types/hooks/useDebounce.d.ts +3 -0
- package/dist/types/hooks/useDebounce.d.ts.map +1 -0
- package/dist/types/index.d.ts +8 -4
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/main.d.ts.map +1 -1
- package/dist/types/theme/ThemeProvider.d.ts.map +1 -1
- package/dist/types/utils/validation.d.ts +32 -9
- package/dist/types/utils/validation.d.ts.map +1 -1
- package/dist/types/utils/validators.d.ts +7 -0
- package/dist/types/utils/validators.d.ts.map +1 -0
- package/dist/unicornial-ui.css +1 -1
- package/dist/unicornial-ui.es.js +503 -324
- package/dist/unicornial-ui.es.js.map +1 -1
- package/dist/unicornial-ui.umd.js +3 -3
- package/dist/unicornial-ui.umd.js.map +1 -1
- package/package.json +18 -18
- package/dist/types/components/Card.d.ts +0 -2
- package/dist/types/components/Card.d.ts.map +0 -1
package/dist/unicornial-ui.es.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "./unicornial-ui.css";
|
|
2
|
-
import { createContext as
|
|
3
|
-
import { Fragment as
|
|
4
|
-
var
|
|
2
|
+
import e, { createContext as t, forwardRef as n, useCallback as r, useContext as i, useEffect as a, useMemo as o, useRef as s, useState as c } from "react";
|
|
3
|
+
import { Fragment as l, jsx as u, jsxs as d } from "react/jsx-runtime";
|
|
4
|
+
var f = {
|
|
5
5
|
colors: {
|
|
6
6
|
primary: "#aa3bff",
|
|
7
7
|
secondary: "#f4f3ec",
|
|
@@ -32,37 +32,37 @@ var u = {
|
|
|
32
32
|
color: "text-text",
|
|
33
33
|
darkColor: "text-text-d"
|
|
34
34
|
}
|
|
35
|
-
},
|
|
35
|
+
}, p = (e, t) => {
|
|
36
36
|
let n = { ...e };
|
|
37
37
|
for (let r of Object.keys(t)) {
|
|
38
38
|
let i = t[r];
|
|
39
|
-
i && typeof i == "object" && !Array.isArray(i) && e[r] && typeof e[r] == "object" && !Array.isArray(e[r]) ? n[r] =
|
|
39
|
+
i && typeof i == "object" && !Array.isArray(i) && e[r] && typeof e[r] == "object" && !Array.isArray(e[r]) ? n[r] = p(e[r], i) : i !== void 0 && (n[r] = i);
|
|
40
40
|
}
|
|
41
41
|
return n;
|
|
42
|
-
},
|
|
43
|
-
function
|
|
44
|
-
let
|
|
45
|
-
|
|
42
|
+
}, m = t(null);
|
|
43
|
+
function h({ children: e, config: t }) {
|
|
44
|
+
let n = o(() => p(f, t ?? {}), [t]), [i, s] = c(n.colors), [l, d] = c(n.darkColors), [h, g] = c(n.darkMode), [_, v] = c(n.text), y = r((e) => {
|
|
45
|
+
s((t) => ({
|
|
46
46
|
...t,
|
|
47
47
|
...e
|
|
48
48
|
}));
|
|
49
|
-
}, []), b =
|
|
50
|
-
|
|
49
|
+
}, []), b = r((e) => {
|
|
50
|
+
d((t) => ({
|
|
51
51
|
...t,
|
|
52
52
|
...e
|
|
53
53
|
}));
|
|
54
|
-
}, []), x =
|
|
54
|
+
}, []), x = r((e) => {
|
|
55
55
|
g(e);
|
|
56
|
-
}, []), S =
|
|
56
|
+
}, []), S = r((e) => {
|
|
57
57
|
v((t) => ({
|
|
58
58
|
...t,
|
|
59
59
|
...e
|
|
60
60
|
}));
|
|
61
|
-
}, []), C =
|
|
62
|
-
e.colors &&
|
|
61
|
+
}, []), C = r((e) => {
|
|
62
|
+
e.colors && s((t) => ({
|
|
63
63
|
...t,
|
|
64
64
|
...e.colors
|
|
65
|
-
})), e.darkColors &&
|
|
65
|
+
})), e.darkColors && d((t) => ({
|
|
66
66
|
...t,
|
|
67
67
|
...e.darkColors
|
|
68
68
|
})), e.darkMode !== void 0 && g(e.darkMode), e.text && v((t) => ({
|
|
@@ -70,15 +70,19 @@ function p({ children: e, config: t }) {
|
|
|
70
70
|
...e.text
|
|
71
71
|
}));
|
|
72
72
|
}, []);
|
|
73
|
-
|
|
73
|
+
a(() => {
|
|
74
74
|
if (typeof document > "u") return;
|
|
75
75
|
let e = document.documentElement;
|
|
76
|
-
h ? e.classList.add("dark") : e.classList.remove("dark"), e.style.setProperty("--theme-primary", h ?
|
|
77
|
-
}, [
|
|
78
|
-
|
|
76
|
+
h ? e.classList.add("dark") : e.classList.remove("dark"), e.style.setProperty("--theme-primary", h ? l.primary : i.primary), e.style.setProperty("--theme-secondary", h ? l.secondary : i.secondary);
|
|
77
|
+
}, [
|
|
78
|
+
i,
|
|
79
|
+
h,
|
|
80
|
+
l
|
|
81
|
+
]);
|
|
82
|
+
let w = o(() => ({
|
|
79
83
|
enabled: !0,
|
|
80
|
-
colors:
|
|
81
|
-
darkColors:
|
|
84
|
+
colors: i,
|
|
85
|
+
darkColors: l,
|
|
82
86
|
darkMode: h,
|
|
83
87
|
text: _,
|
|
84
88
|
setColors: y,
|
|
@@ -87,26 +91,28 @@ function p({ children: e, config: t }) {
|
|
|
87
91
|
setText: S,
|
|
88
92
|
setTheme: C
|
|
89
93
|
}), [
|
|
90
|
-
|
|
94
|
+
i,
|
|
91
95
|
h,
|
|
96
|
+
l,
|
|
92
97
|
_,
|
|
93
98
|
y,
|
|
94
99
|
x,
|
|
100
|
+
b,
|
|
95
101
|
S,
|
|
96
102
|
C
|
|
97
103
|
]);
|
|
98
|
-
return /* @__PURE__ */
|
|
104
|
+
return /* @__PURE__ */ u(m.Provider, {
|
|
99
105
|
value: w,
|
|
100
106
|
children: e
|
|
101
107
|
});
|
|
102
108
|
}
|
|
103
|
-
function
|
|
104
|
-
return
|
|
109
|
+
function g() {
|
|
110
|
+
return i(m) || {
|
|
105
111
|
enabled: !1,
|
|
106
|
-
colors:
|
|
107
|
-
darkColors:
|
|
108
|
-
darkMode:
|
|
109
|
-
text:
|
|
112
|
+
colors: f.colors,
|
|
113
|
+
darkColors: f.darkColors,
|
|
114
|
+
darkMode: f.darkMode,
|
|
115
|
+
text: f.text,
|
|
110
116
|
setColors: () => {},
|
|
111
117
|
setDarkMode: () => {},
|
|
112
118
|
setText: () => {},
|
|
@@ -115,74 +121,8 @@ function m() {
|
|
|
115
121
|
};
|
|
116
122
|
}
|
|
117
123
|
//#endregion
|
|
118
|
-
//#region src/components/Button.tsx
|
|
119
|
-
var h = {
|
|
120
|
-
primary: "bg-accent text-white hover:bg-accent/90 focus-visible:ring-accent/50",
|
|
121
|
-
secondary: "bg-code-bg text-text-h hover:bg-code-bg/80 focus-visible:ring-code-bg/50",
|
|
122
|
-
outline: "border border-border bg-transparent text-text-h hover:bg-accent-bg hover:border-accent-border focus-visible:ring-accent/50",
|
|
123
|
-
ghost: "bg-transparent text-text-h hover:bg-accent-bg focus-visible:ring-accent/50"
|
|
124
|
-
}, g = {
|
|
125
|
-
sm: "px-3 py-1.5 text-sm gap-1.5",
|
|
126
|
-
md: "px-5 py-2.5 text-base gap-2",
|
|
127
|
-
lg: "px-7 py-3 text-lg gap-2.5"
|
|
128
|
-
};
|
|
129
|
-
function _(e, t) {
|
|
130
|
-
let n = e.replace("#", ""), r = n.length === 3 ? n.split("").map((e) => e + e).join("") : n, i = parseInt(r, 16);
|
|
131
|
-
return `rgba(${i >> 16 & 255}, ${i >> 8 & 255}, ${i & 255}, ${t})`;
|
|
132
|
-
}
|
|
133
|
-
var v = t(function({ variant: e = "primary", size: t = "md", className: n = "", style: r, ...i }, o) {
|
|
134
|
-
let s = m(), l = a(() => {
|
|
135
|
-
if (!s.enabled) return;
|
|
136
|
-
let t = s.colors.primary, n = s.colors.secondary, r = _(t, .1), i = _(t, .5), a = _(t, .5);
|
|
137
|
-
switch (e) {
|
|
138
|
-
case "primary": return {
|
|
139
|
-
backgroundColor: t,
|
|
140
|
-
color: "#fff",
|
|
141
|
-
"--tw-ring-color": a
|
|
142
|
-
};
|
|
143
|
-
case "secondary": return {
|
|
144
|
-
backgroundColor: n,
|
|
145
|
-
color: "#08060d"
|
|
146
|
-
};
|
|
147
|
-
case "outline": return {
|
|
148
|
-
borderColor: "#e5e4e7",
|
|
149
|
-
backgroundColor: "transparent",
|
|
150
|
-
color: "#08060d",
|
|
151
|
-
"--hover-bg": r,
|
|
152
|
-
"--hover-border": i,
|
|
153
|
-
"--tw-ring-color": a
|
|
154
|
-
};
|
|
155
|
-
default: return {
|
|
156
|
-
backgroundColor: "transparent",
|
|
157
|
-
color: "#08060d",
|
|
158
|
-
"--hover-bg": r,
|
|
159
|
-
"--tw-ring-color": a
|
|
160
|
-
};
|
|
161
|
-
}
|
|
162
|
-
}, [s, e]), u = s.enabled && e === "primary" ? "hover:brightness-110" : s.enabled && e === "outline" ? "hover:bg-[var(--hover-bg)] hover:border-[var(--hover-border)]" : s.enabled ? "hover:bg-[var(--hover-bg)]" : "";
|
|
163
|
-
return /* @__PURE__ */ c("button", {
|
|
164
|
-
ref: o,
|
|
165
|
-
className: [
|
|
166
|
-
"inline-flex items-center justify-center font-medium rounded-lg",
|
|
167
|
-
"transition-all duration-200 ease-in-out",
|
|
168
|
-
"focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2",
|
|
169
|
-
"disabled:opacity-50 disabled:pointer-events-none",
|
|
170
|
-
"select-none",
|
|
171
|
-
h[e],
|
|
172
|
-
g[t],
|
|
173
|
-
u,
|
|
174
|
-
n
|
|
175
|
-
].join(" "),
|
|
176
|
-
style: {
|
|
177
|
-
...l,
|
|
178
|
-
...r
|
|
179
|
-
},
|
|
180
|
-
...i
|
|
181
|
-
});
|
|
182
|
-
});
|
|
183
|
-
//#endregion
|
|
184
124
|
//#region src/utils/utils.ts
|
|
185
|
-
function
|
|
125
|
+
function _(e, t) {
|
|
186
126
|
let n = e.replace("#", ""), r = n.length === 3 ? n.split("").map((e) => e + e).join("") : n, i = parseInt(r, 16);
|
|
187
127
|
return [
|
|
188
128
|
i >> 16 & 255,
|
|
@@ -191,55 +131,55 @@ function y(e, t) {
|
|
|
191
131
|
t
|
|
192
132
|
];
|
|
193
133
|
}
|
|
194
|
-
function
|
|
134
|
+
function v(e) {
|
|
195
135
|
return `rgba(${e[0]}, ${e[1]}, ${e[2]}, ${e[3]})`;
|
|
196
136
|
}
|
|
197
137
|
//#endregion
|
|
198
138
|
//#region src/components/Header.tsx
|
|
199
|
-
var
|
|
139
|
+
var y = {
|
|
200
140
|
default: "",
|
|
201
141
|
sticky: "sticky top-0 z-50",
|
|
202
142
|
hide: "transition-transform duration-300 absolute top-0 left-0"
|
|
203
|
-
},
|
|
143
|
+
}, b = {
|
|
204
144
|
default: "",
|
|
205
145
|
blur: "bg-white/10 backdrop-blur-sm"
|
|
206
|
-
},
|
|
207
|
-
let d =
|
|
208
|
-
|
|
146
|
+
}, x = n(function({ behaviour: e = "default", className: t = "", style: n, children: r, variant: i = "default", ...s }, l) {
|
|
147
|
+
let d = g(), [f, p] = c(!1), m = e === "hide" && f ? "-100%" : "0";
|
|
148
|
+
a(() => {
|
|
209
149
|
if (e !== "hide") return;
|
|
210
150
|
let t = () => {
|
|
211
151
|
p(window.scrollY > 10);
|
|
212
152
|
};
|
|
213
153
|
return t(), window.addEventListener("scroll", t, { passive: !0 }), () => window.removeEventListener("scroll", t);
|
|
214
154
|
}, [e]);
|
|
215
|
-
let
|
|
155
|
+
let h = o(() => {
|
|
216
156
|
if (d.enabled) return {
|
|
217
157
|
backgroundColor: d.darkMode ? d.darkColors.header.background : d.colors.header.background,
|
|
218
158
|
borderBottom: `1px solid ${d.darkMode ? d.darkColors.header.border : d.colors.header.border}`,
|
|
219
159
|
color: d.darkMode ? d.darkColors.text : d.colors.text
|
|
220
160
|
};
|
|
221
161
|
}, [d]);
|
|
222
|
-
return /* @__PURE__ */
|
|
223
|
-
ref:
|
|
162
|
+
return /* @__PURE__ */ u("header", {
|
|
163
|
+
ref: l,
|
|
224
164
|
className: [
|
|
225
165
|
"w-full h-16 px-12 py-2 flex items-center justify-between shadow-md shadow-gray-500/25",
|
|
226
|
-
|
|
227
|
-
|
|
166
|
+
y[e],
|
|
167
|
+
b[i],
|
|
228
168
|
t
|
|
229
169
|
].join(" "),
|
|
230
170
|
style: {
|
|
231
|
-
...
|
|
171
|
+
...h,
|
|
232
172
|
...n,
|
|
233
|
-
transform: `translateY(${
|
|
173
|
+
transform: `translateY(${m})`
|
|
234
174
|
},
|
|
235
|
-
...
|
|
175
|
+
...s,
|
|
236
176
|
children: r
|
|
237
177
|
});
|
|
238
|
-
}),
|
|
239
|
-
let o =
|
|
240
|
-
return /* @__PURE__ */
|
|
178
|
+
}), S = n(function({ className: e = "", style: t, alt: n = "", darkSrc: r, ...i }, a) {
|
|
179
|
+
let o = g().darkMode && r ? r : i.src;
|
|
180
|
+
return /* @__PURE__ */ u("div", {
|
|
241
181
|
className: "h-full flex items-center justify-center shrink-0",
|
|
242
|
-
children: /* @__PURE__ */
|
|
182
|
+
children: /* @__PURE__ */ u("img", {
|
|
243
183
|
ref: a,
|
|
244
184
|
alt: n,
|
|
245
185
|
className: "h-full max-h-12 w-auto object-contain",
|
|
@@ -251,26 +191,26 @@ var x = {
|
|
|
251
191
|
src: o
|
|
252
192
|
})
|
|
253
193
|
});
|
|
254
|
-
}),
|
|
255
|
-
let
|
|
256
|
-
if (!
|
|
257
|
-
let e =
|
|
194
|
+
}), C = n(function({ className: e = "", style: t, children: n, ...r }, i) {
|
|
195
|
+
let a = g(), s = o(() => {
|
|
196
|
+
if (!a.enabled) return;
|
|
197
|
+
let e = _(a.colors.primary, .5);
|
|
258
198
|
return {
|
|
259
|
-
color:
|
|
199
|
+
color: a.darkMode ? "#e8e4f0" : "#08060d",
|
|
260
200
|
"--tw-ring-color": e,
|
|
261
|
-
"--hover-color":
|
|
201
|
+
"--hover-color": a.colors.primary
|
|
262
202
|
};
|
|
263
|
-
}, [
|
|
264
|
-
return /* @__PURE__ */
|
|
203
|
+
}, [a]), c = a.enabled ? "hover:text-[var(--hover-color)]" : "";
|
|
204
|
+
return /* @__PURE__ */ u("a", {
|
|
265
205
|
ref: i,
|
|
266
206
|
className: [
|
|
267
207
|
"inline-flex items-center justify-center",
|
|
268
208
|
"px-3 py-2 text-sm font-medium",
|
|
269
|
-
|
|
270
|
-
|
|
209
|
+
a.enabled ? "" : "text-text-h hover:text-accent",
|
|
210
|
+
c,
|
|
271
211
|
"transition-colors duration-200 ease-in-out",
|
|
272
212
|
"focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 rounded-md",
|
|
273
|
-
|
|
213
|
+
a.enabled ? "" : "focus-visible:ring-accent/50",
|
|
274
214
|
"select-none",
|
|
275
215
|
e
|
|
276
216
|
].join(" "),
|
|
@@ -281,10 +221,10 @@ var x = {
|
|
|
281
221
|
...r,
|
|
282
222
|
children: n
|
|
283
223
|
});
|
|
284
|
-
}),
|
|
285
|
-
Logo:
|
|
286
|
-
NavButton:
|
|
287
|
-
}),
|
|
224
|
+
}), w = Object.assign(x, {
|
|
225
|
+
Logo: S,
|
|
226
|
+
NavButton: C
|
|
227
|
+
}), T = {
|
|
288
228
|
"dots-grid": (e, t) => ({
|
|
289
229
|
backgroundImage: `radial-gradient(${e} 1.5px, transparent 1.5px)`,
|
|
290
230
|
backgroundSize: `${t}px ${t}px`
|
|
@@ -349,7 +289,7 @@ var x = {
|
|
|
349
289
|
backgroundImage: `linear-gradient(${e} 1px, transparent 1px)`,
|
|
350
290
|
backgroundSize: `${t}px ${t}px`
|
|
351
291
|
})
|
|
352
|
-
},
|
|
292
|
+
}, E = {
|
|
353
293
|
"fade-in": () => ({
|
|
354
294
|
maskImage: "\n radial-gradient(\n ellipse at center,\n rgba(0, 0, 0, 0.7) 0%,\n rgba(0, 0, 0, 0) 75%\n )\n ",
|
|
355
295
|
WebkitMaskImage: "\n radial-gradient(\n ellipse at center,\n rgba(0, 0, 0, 0.7) 0%,\n rgba(0, 0, 0, 0) 75%\n )\n ",
|
|
@@ -367,29 +307,29 @@ var x = {
|
|
|
367
307
|
WebkitMaskRepeat: "no-repeat"
|
|
368
308
|
}),
|
|
369
309
|
none: () => ({})
|
|
370
|
-
},
|
|
371
|
-
let f =
|
|
372
|
-
...
|
|
373
|
-
...
|
|
310
|
+
}, D = n(function({ variant: e = "dots-grid", mask: t = "none", color: n, size: r = 24, className: i = "", style: a, children: s, ...c }, l) {
|
|
311
|
+
let f = g(), p = o(() => n || (f.enabled ? v(_(f.colors.primary, .25)) : "rgba(170, 59, 255, 0.25)"), [n, f]), m = o(() => ({
|
|
312
|
+
...T[e](p, r),
|
|
313
|
+
...E[t]()
|
|
374
314
|
}), [
|
|
375
315
|
e,
|
|
376
316
|
t,
|
|
377
317
|
p,
|
|
378
318
|
r
|
|
379
319
|
]);
|
|
380
|
-
return /* @__PURE__ */
|
|
381
|
-
ref:
|
|
320
|
+
return /* @__PURE__ */ d("div", {
|
|
321
|
+
ref: l,
|
|
382
322
|
className: ["w-full h-full relative overflow-hidden flex flex-col", i].join(" "),
|
|
383
|
-
style:
|
|
384
|
-
...
|
|
385
|
-
children: [/* @__PURE__ */
|
|
323
|
+
style: a,
|
|
324
|
+
...c,
|
|
325
|
+
children: [/* @__PURE__ */ u("div", {
|
|
386
326
|
"aria-hidden": !0,
|
|
387
327
|
className: "absolute inset-0 -z-10 pointer-events-none",
|
|
388
|
-
style:
|
|
328
|
+
style: m
|
|
389
329
|
}), s]
|
|
390
330
|
});
|
|
391
|
-
}),
|
|
392
|
-
let d =
|
|
331
|
+
}), O = n(function({ variant: e = "line", orientation: t = "horizontal", color: n, thickness: r = 1, spacing: i = 16, className: a = "", style: s, ...c }, l) {
|
|
332
|
+
let d = g(), f = o(() => n || (d.enabled && d.darkMode ? "#2a2535" : "#e5e4e7"), [n, d]), p = t === "horizontal";
|
|
393
333
|
if (e === "point") {
|
|
394
334
|
let e = p ? {
|
|
395
335
|
paddingTop: i,
|
|
@@ -398,19 +338,19 @@ var x = {
|
|
|
398
338
|
paddingLeft: i,
|
|
399
339
|
paddingRight: i
|
|
400
340
|
};
|
|
401
|
-
return /* @__PURE__ */
|
|
402
|
-
ref:
|
|
341
|
+
return /* @__PURE__ */ u("div", {
|
|
342
|
+
ref: l,
|
|
403
343
|
className: [
|
|
404
344
|
"flex items-center justify-center shrink-0",
|
|
405
345
|
p ? "w-full" : "h-full",
|
|
406
|
-
|
|
346
|
+
a
|
|
407
347
|
].join(" "),
|
|
408
348
|
style: {
|
|
409
349
|
...e,
|
|
410
350
|
...s
|
|
411
351
|
},
|
|
412
|
-
...
|
|
413
|
-
children: /* @__PURE__ */
|
|
352
|
+
...c,
|
|
353
|
+
children: /* @__PURE__ */ u("span", {
|
|
414
354
|
"aria-hidden": !0,
|
|
415
355
|
className: "rounded-full shrink-0",
|
|
416
356
|
style: {
|
|
@@ -421,7 +361,7 @@ var x = {
|
|
|
421
361
|
})
|
|
422
362
|
});
|
|
423
363
|
}
|
|
424
|
-
let
|
|
364
|
+
let m = p ? {
|
|
425
365
|
height: r,
|
|
426
366
|
backgroundColor: f,
|
|
427
367
|
marginTop: i,
|
|
@@ -432,197 +372,383 @@ var x = {
|
|
|
432
372
|
marginLeft: i,
|
|
433
373
|
marginRight: i
|
|
434
374
|
};
|
|
435
|
-
return /* @__PURE__ */
|
|
436
|
-
ref:
|
|
375
|
+
return /* @__PURE__ */ u("div", {
|
|
376
|
+
ref: l,
|
|
437
377
|
role: "separator",
|
|
438
378
|
"aria-orientation": t,
|
|
439
379
|
className: [
|
|
440
380
|
"shrink-0",
|
|
441
381
|
p ? "w-full" : "h-full",
|
|
442
|
-
|
|
382
|
+
a
|
|
443
383
|
].join(" "),
|
|
444
384
|
style: {
|
|
445
|
-
...
|
|
385
|
+
...m,
|
|
446
386
|
...s
|
|
447
387
|
},
|
|
448
|
-
...
|
|
388
|
+
...c
|
|
449
389
|
});
|
|
450
|
-
}),
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
},
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
},
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
390
|
+
}), k = n(function({ className: e = "", style: t, children: n, ...r }, i) {
|
|
391
|
+
let a = g(), s = o(() => ({
|
|
392
|
+
borderColor: a.darkMode ? a.darkColors.border : a.colors.border,
|
|
393
|
+
backgroundColor: a.darkMode ? a.darkColors.background : a.colors.background
|
|
394
|
+
}), [a]);
|
|
395
|
+
return /* @__PURE__ */ u("div", {
|
|
396
|
+
ref: i,
|
|
397
|
+
...r,
|
|
398
|
+
className: [e, "p-2 rounded-md shadow-md bg-white border"].join(" "),
|
|
399
|
+
style: {
|
|
400
|
+
...t,
|
|
401
|
+
...s
|
|
402
|
+
},
|
|
403
|
+
children: n
|
|
404
|
+
});
|
|
405
|
+
}), A = t(null);
|
|
406
|
+
function j({ initialValues: e, onSubmit: t, children: n }) {
|
|
407
|
+
let [r, i] = c(e), [a, o] = c(null), [s, l] = c(!1), d = (e) => {
|
|
408
|
+
if (e.preventDefault(), a) {
|
|
409
|
+
let e = Object.keys(a).some((e) => {
|
|
410
|
+
let t = a[e], n = r[e];
|
|
411
|
+
return !t.validate(n).valid;
|
|
412
|
+
});
|
|
413
|
+
t(r, e);
|
|
414
|
+
} else t(r, !1);
|
|
415
|
+
};
|
|
416
|
+
return /* @__PURE__ */ u(A.Provider, {
|
|
417
|
+
value: {
|
|
418
|
+
initialValues: e,
|
|
419
|
+
values: r,
|
|
420
|
+
setValues: i,
|
|
421
|
+
isSubmitting: s,
|
|
422
|
+
validators: a,
|
|
423
|
+
setValidators: o,
|
|
424
|
+
setIsSubmitting: l,
|
|
425
|
+
handleSubmit: d,
|
|
426
|
+
reset: () => {
|
|
427
|
+
i(e);
|
|
428
|
+
}
|
|
429
|
+
},
|
|
430
|
+
children: /* @__PURE__ */ u("form", {
|
|
431
|
+
onSubmit: d,
|
|
432
|
+
children: n
|
|
433
|
+
})
|
|
434
|
+
});
|
|
435
|
+
}
|
|
436
|
+
function M() {
|
|
437
|
+
let e = i(A);
|
|
438
|
+
if (!e) throw Error("useForm must be used within a FormProvider");
|
|
439
|
+
return e;
|
|
440
|
+
}
|
|
441
|
+
//#endregion
|
|
442
|
+
//#region src/components/Input.tsx
|
|
443
|
+
var N = {
|
|
444
|
+
default: "border border-gray-300 rounded-md p-2",
|
|
445
|
+
filled: "bg-gray-100 border border-gray-300 rounded-md p-2",
|
|
446
|
+
underline: "border-b border-gray-300 p-2"
|
|
447
|
+
}, P = n(function({ variant: e = "default", label: t, ...n }, r) {
|
|
448
|
+
return /* @__PURE__ */ d("div", {
|
|
449
|
+
className: "w-full",
|
|
450
|
+
children: [t && /* @__PURE__ */ u("label", {
|
|
451
|
+
htmlFor: n.id,
|
|
452
|
+
className: "block text-sm font-bold mb-1 mt-2 text-gray-700",
|
|
453
|
+
children: t
|
|
454
|
+
}), /* @__PURE__ */ u("input", {
|
|
455
|
+
ref: r,
|
|
456
|
+
...n,
|
|
457
|
+
className: `mb-4 last:mb-0 block w-full ${N[e]} focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 sm:text-sm`
|
|
458
|
+
})]
|
|
459
|
+
});
|
|
460
|
+
});
|
|
461
|
+
//#endregion
|
|
462
|
+
//#region src/hooks/useDebounce.tsx
|
|
463
|
+
function F(e, t) {
|
|
464
|
+
let n = s(e), i = s(null);
|
|
465
|
+
a(() => {
|
|
466
|
+
n.current = e;
|
|
467
|
+
}, [e]);
|
|
468
|
+
let o = r((...e) => {
|
|
469
|
+
i.current !== null && clearTimeout(i.current), i.current = setTimeout(() => {
|
|
470
|
+
i.current = null, n.current(...e);
|
|
471
|
+
}, t);
|
|
472
|
+
}, [t]);
|
|
473
|
+
return a(() => () => {
|
|
474
|
+
i.current !== null && clearTimeout(i.current);
|
|
475
|
+
}, []), o;
|
|
476
|
+
}
|
|
477
|
+
//#endregion
|
|
478
|
+
//#region src/components/UnicornialInput.tsx
|
|
479
|
+
var I = n(function({ variant: t = "default", debounce: n = 300, label: r, name: i, ...o }, s) {
|
|
480
|
+
let { values: c, setValues: f, isSubmitting: p, setValidators: m } = M();
|
|
481
|
+
a(() => {
|
|
482
|
+
i && o.validator && m((e) => ({
|
|
483
|
+
...e ?? {},
|
|
484
|
+
[i]: o.validator
|
|
485
|
+
}));
|
|
486
|
+
}, [
|
|
487
|
+
i,
|
|
488
|
+
o.validator,
|
|
489
|
+
m
|
|
490
|
+
]);
|
|
491
|
+
let [h, g] = e.useState(""), _ = F((e) => {
|
|
492
|
+
v(e.target.value), o.onChange && o.onChange(e);
|
|
493
|
+
}, n || 300), v = (e) => {
|
|
494
|
+
if (o.validator) {
|
|
495
|
+
let t = o.validator.validate(e, (e) => f({
|
|
496
|
+
...c,
|
|
497
|
+
[i]: e
|
|
498
|
+
}));
|
|
499
|
+
t.valid ? g("") : g(t.message);
|
|
500
|
+
}
|
|
501
|
+
}, y = (e) => {
|
|
502
|
+
v(e.target.value), o.onBlur && o.onBlur(e);
|
|
503
|
+
}, b = (e) => {
|
|
504
|
+
i && f({
|
|
505
|
+
...c,
|
|
506
|
+
[i]: e.target.value
|
|
507
|
+
}), _(e);
|
|
508
|
+
};
|
|
509
|
+
return /* @__PURE__ */ d(l, { children: [/* @__PURE__ */ u(P, {
|
|
510
|
+
variant: t,
|
|
511
|
+
label: r,
|
|
512
|
+
ref: s,
|
|
513
|
+
value: i && (c[i] || ""),
|
|
514
|
+
disabled: p,
|
|
515
|
+
...o,
|
|
516
|
+
onChange: b,
|
|
517
|
+
onBlur: y
|
|
518
|
+
}), h && /* @__PURE__ */ u("p", {
|
|
519
|
+
className: "text-sm text-red-500 mt-1",
|
|
520
|
+
children: h
|
|
521
|
+
})] });
|
|
522
|
+
}), L = {
|
|
523
|
+
primary: "bg-accent text-white hover:bg-accent/90 focus-visible:ring-accent/50",
|
|
524
|
+
secondary: "bg-code-bg text-text-h hover:bg-code-bg/80 focus-visible:ring-code-bg/50",
|
|
525
|
+
outline: "border border-border bg-transparent text-text-h hover:bg-accent-bg hover:border-accent-border focus-visible:ring-accent/50",
|
|
526
|
+
ghost: "bg-transparent text-text-h hover:bg-accent-bg focus-visible:ring-accent/50"
|
|
527
|
+
}, R = {
|
|
528
|
+
sm: "px-3 py-1.5 text-sm gap-1.5",
|
|
529
|
+
md: "px-5 py-2.5 text-base gap-2",
|
|
530
|
+
lg: "px-7 py-3 text-lg gap-2.5"
|
|
474
531
|
};
|
|
475
|
-
function
|
|
532
|
+
function z(e, t) {
|
|
476
533
|
let n = e.replace("#", ""), r = n.length === 3 ? n.split("").map((e) => e + e).join("") : n, i = parseInt(r, 16);
|
|
477
534
|
return `rgba(${i >> 16 & 255}, ${i >> 8 & 255}, ${i & 255}, ${t})`;
|
|
478
535
|
}
|
|
479
|
-
var
|
|
480
|
-
let
|
|
481
|
-
if (!
|
|
482
|
-
let t =
|
|
536
|
+
var B = n(function({ variant: e = "primary", size: t = "md", className: n = "", style: r, ...i }, a) {
|
|
537
|
+
let s = g(), c = o(() => {
|
|
538
|
+
if (!s.enabled) return;
|
|
539
|
+
let t = s.colors.primary, n = s.colors.secondary, r = z(t, .1), i = z(t, .5), a = z(t, .5);
|
|
483
540
|
switch (e) {
|
|
484
|
-
case "
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
"--focus-border": n ? a : t,
|
|
489
|
-
"--ring-color": L(n ? a : t, .5)
|
|
541
|
+
case "primary": return {
|
|
542
|
+
backgroundColor: t,
|
|
543
|
+
color: "#fff",
|
|
544
|
+
"--tw-ring-color": a
|
|
490
545
|
};
|
|
491
|
-
case "
|
|
492
|
-
|
|
546
|
+
case "secondary": return {
|
|
547
|
+
backgroundColor: n,
|
|
548
|
+
color: "#08060d"
|
|
549
|
+
};
|
|
550
|
+
case "outline": return {
|
|
551
|
+
borderColor: "#e5e4e7",
|
|
493
552
|
backgroundColor: "transparent",
|
|
494
|
-
|
|
495
|
-
"--
|
|
496
|
-
"--
|
|
553
|
+
color: "#08060d",
|
|
554
|
+
"--hover-bg": r,
|
|
555
|
+
"--hover-border": i,
|
|
556
|
+
"--tw-ring-color": a
|
|
497
557
|
};
|
|
498
558
|
default: return {
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
"--
|
|
503
|
-
"--ring-color": L(n ? a : t, .5)
|
|
559
|
+
backgroundColor: "transparent",
|
|
560
|
+
color: "#08060d",
|
|
561
|
+
"--hover-bg": r,
|
|
562
|
+
"--tw-ring-color": a
|
|
504
563
|
};
|
|
505
564
|
}
|
|
506
|
-
}, [
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
n
|
|
510
|
-
]), _ = a(() => {
|
|
511
|
-
if (h.enabled) return e === "underline" ? "focus-within:border-b-[2px] focus-within:border-b-[var(--focus-border)]" : "focus-within:ring-2 focus-within:ring-[var(--ring-color)] focus-within:ring-offset-0 focus-within:border-[var(--focus-border)]";
|
|
512
|
-
if (e === "underline") return n ? "border-b-2 border-b-red-500 focus-within:border-b-accent" : "border-b border-border focus-within:border-b-2 focus-within:border-b-accent";
|
|
513
|
-
let t = "focus-within:ring-2 focus-within:ring-accent/50 focus-within:ring-offset-0";
|
|
514
|
-
switch (e) {
|
|
515
|
-
case "filled": return n ? `bg-code-bg border-b-2 border-b-red-500 ${t} focus-within:border-b-accent` : `bg-code-bg border-b-2 border-b-transparent ${t} focus-within:border-b-accent`;
|
|
516
|
-
default: return n ? `bg-bg border border-red-500 rounded-lg ${t} focus-within:border-accent` : `bg-bg border border-border rounded-lg ${t} focus-within:border-accent`;
|
|
517
|
-
}
|
|
518
|
-
}, [
|
|
519
|
-
h,
|
|
520
|
-
e,
|
|
521
|
-
n
|
|
522
|
-
]), v = r && i ? P[t] : r ? M[t] : i ? N[t] : j[t], y = e === "underline" ? "bg-transparent rounded-none" : "rounded-lg", b = a(() => h.enabled ? {
|
|
523
|
-
color: h.darkMode ? "#e8e4f0" : "#08060d",
|
|
524
|
-
"--placeholder-color": L(h.darkMode ? "#908a9e" : "#706a7c", 1),
|
|
525
|
-
backgroundColor: "transparent"
|
|
526
|
-
} : void 0, [h]), x = h.enabled ? "placeholder:text-[color:var(--placeholder-color)]" : "placeholder:text-text-muted";
|
|
527
|
-
return /* @__PURE__ */ l("div", {
|
|
565
|
+
}, [s, e]), l = s.enabled && e === "primary" ? "hover:brightness-110" : s.enabled && e === "outline" ? "hover:bg-[var(--hover-bg)] hover:border-[var(--hover-border)]" : s.enabled ? "hover:bg-[var(--hover-bg)]" : "";
|
|
566
|
+
return /* @__PURE__ */ u("button", {
|
|
567
|
+
ref: a,
|
|
528
568
|
className: [
|
|
529
|
-
"
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
569
|
+
"inline-flex items-center justify-center font-medium rounded-lg",
|
|
570
|
+
"transition-all duration-200 ease-in-out",
|
|
571
|
+
"focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2",
|
|
572
|
+
"disabled:opacity-50 disabled:pointer-events-none",
|
|
573
|
+
"select-none",
|
|
574
|
+
L[e],
|
|
575
|
+
R[t],
|
|
576
|
+
l,
|
|
577
|
+
n
|
|
533
578
|
].join(" "),
|
|
534
|
-
style:
|
|
535
|
-
|
|
536
|
-
r
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
children: r
|
|
540
|
-
}),
|
|
541
|
-
/* @__PURE__ */ c("input", {
|
|
542
|
-
ref: p,
|
|
543
|
-
disabled: d,
|
|
544
|
-
className: [
|
|
545
|
-
"w-full h-full outline-none bg-transparent font-normal",
|
|
546
|
-
"transition-all duration-200 ease-in-out",
|
|
547
|
-
"disabled:cursor-not-allowed",
|
|
548
|
-
v,
|
|
549
|
-
y,
|
|
550
|
-
x,
|
|
551
|
-
o
|
|
552
|
-
].join(" "),
|
|
553
|
-
style: {
|
|
554
|
-
...b,
|
|
555
|
-
...u
|
|
556
|
-
},
|
|
557
|
-
...f
|
|
558
|
-
}),
|
|
559
|
-
i && /* @__PURE__ */ c("span", {
|
|
560
|
-
"aria-hidden": !0,
|
|
561
|
-
className: ["absolute text-text-muted pointer-events-none shrink-0", I[t]].join(" "),
|
|
562
|
-
children: i
|
|
563
|
-
})
|
|
564
|
-
]
|
|
579
|
+
style: {
|
|
580
|
+
...c,
|
|
581
|
+
...r
|
|
582
|
+
},
|
|
583
|
+
...i
|
|
565
584
|
});
|
|
566
|
-
}),
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
585
|
+
}), V = ({ children: e }) => {
|
|
586
|
+
let [t, n] = c(!1);
|
|
587
|
+
return a(() => {
|
|
588
|
+
let e = () => {
|
|
589
|
+
let e = window.innerHeight > window.innerWidth;
|
|
590
|
+
n(e);
|
|
591
|
+
};
|
|
592
|
+
return e(), window.addEventListener("resize", e), () => window.removeEventListener("resize", e);
|
|
593
|
+
}, []), t ? /* @__PURE__ */ u(l, { children: e }) : null;
|
|
594
|
+
}, H = ({ children: e }) => {
|
|
595
|
+
let [t, n] = c(!1);
|
|
596
|
+
return a(() => {
|
|
597
|
+
let e = () => {
|
|
598
|
+
let e = window.innerHeight > window.innerWidth;
|
|
599
|
+
n(!e);
|
|
600
|
+
};
|
|
601
|
+
return e(), window.addEventListener("resize", e), () => window.removeEventListener("resize", e);
|
|
602
|
+
}, []), t ? /* @__PURE__ */ u(l, { children: e }) : null;
|
|
603
|
+
}, U = {
|
|
604
|
+
required: (e) => (t) => String(t ?? "").trim() === "" ? {
|
|
605
|
+
valid: !1,
|
|
606
|
+
message: e || "Este campo es obligatorio"
|
|
607
|
+
} : {
|
|
608
|
+
valid: !0,
|
|
609
|
+
message: ""
|
|
610
|
+
},
|
|
611
|
+
onlyNumbers: (e) => (t) => {
|
|
612
|
+
let n = String(t ?? "");
|
|
613
|
+
return /^\d+$/.test(n) ? {
|
|
570
614
|
valid: !0,
|
|
571
615
|
message: ""
|
|
572
616
|
} : {
|
|
573
617
|
valid: !1,
|
|
574
|
-
message:
|
|
618
|
+
message: e || "Debe contener solo números"
|
|
575
619
|
};
|
|
576
620
|
},
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
return
|
|
621
|
+
min: (e, t) => (n) => {
|
|
622
|
+
if (isNaN(e)) throw Error("El valor debe ser un número");
|
|
623
|
+
return Number(n) >= e ? {
|
|
580
624
|
valid: !0,
|
|
581
625
|
message: ""
|
|
582
626
|
} : {
|
|
583
627
|
valid: !1,
|
|
584
|
-
message:
|
|
628
|
+
message: t || `El valor debe ser mayor o igual a ${e}`
|
|
585
629
|
};
|
|
586
630
|
},
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
return n
|
|
631
|
+
max: (e, t) => (n) => {
|
|
632
|
+
if (isNaN(e)) throw Error("El valor debe ser un número");
|
|
633
|
+
return Number(n) <= e ? {
|
|
590
634
|
valid: !0,
|
|
591
635
|
message: ""
|
|
592
636
|
} : {
|
|
593
637
|
valid: !1,
|
|
594
|
-
message: `
|
|
595
|
-
}
|
|
638
|
+
message: t || `El valor debe ser menor o igual a ${e}`
|
|
639
|
+
};
|
|
640
|
+
},
|
|
641
|
+
positive: (e) => (t) => Number(t) > 0 ? {
|
|
642
|
+
valid: !0,
|
|
643
|
+
message: ""
|
|
644
|
+
} : {
|
|
645
|
+
valid: !1,
|
|
646
|
+
message: e || "El valor debe ser positivo"
|
|
647
|
+
},
|
|
648
|
+
negative: (e) => (t) => Number(t) < 0 ? {
|
|
649
|
+
valid: !0,
|
|
650
|
+
message: ""
|
|
651
|
+
} : {
|
|
652
|
+
valid: !1,
|
|
653
|
+
message: e || "El valor debe ser negativo"
|
|
654
|
+
},
|
|
655
|
+
integer: (e) => (t) => {
|
|
656
|
+
let n = Number(t);
|
|
657
|
+
return Number.isInteger(n) ? {
|
|
596
658
|
valid: !0,
|
|
597
659
|
message: ""
|
|
598
660
|
} : {
|
|
599
661
|
valid: !1,
|
|
600
|
-
message:
|
|
662
|
+
message: e || "El valor debe ser un número entero"
|
|
601
663
|
};
|
|
602
664
|
},
|
|
603
|
-
|
|
604
|
-
let
|
|
605
|
-
return
|
|
665
|
+
round: () => (e) => {
|
|
666
|
+
let t = Number(e);
|
|
667
|
+
return {
|
|
668
|
+
valid: !0,
|
|
669
|
+
message: Math.round(t).toString()
|
|
670
|
+
};
|
|
671
|
+
},
|
|
672
|
+
truncate: () => (e) => {
|
|
673
|
+
let t = Number(e);
|
|
674
|
+
return {
|
|
675
|
+
valid: !0,
|
|
676
|
+
message: Math.trunc(t).toString()
|
|
677
|
+
};
|
|
678
|
+
},
|
|
679
|
+
email: (e) => (t) => {
|
|
680
|
+
let n = String(t ?? "");
|
|
681
|
+
return /^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/.test(n) ? {
|
|
606
682
|
valid: !0,
|
|
607
683
|
message: ""
|
|
608
684
|
} : {
|
|
609
685
|
valid: !1,
|
|
610
|
-
message:
|
|
611
|
-
}
|
|
686
|
+
message: e || "Correo invalido"
|
|
687
|
+
};
|
|
688
|
+
},
|
|
689
|
+
minLength: (e, t) => (n) => {
|
|
690
|
+
if (isNaN(e)) throw Error("El valor debe ser un número");
|
|
691
|
+
return String(n ?? "").length >= e ? {
|
|
692
|
+
valid: !0,
|
|
693
|
+
message: ""
|
|
694
|
+
} : {
|
|
695
|
+
valid: !1,
|
|
696
|
+
message: t || `El valor debe tener al menos ${e} caracteres`
|
|
697
|
+
};
|
|
698
|
+
},
|
|
699
|
+
maxLength: (e, t) => (n) => {
|
|
700
|
+
if (isNaN(e)) throw Error("El valor debe ser un número");
|
|
701
|
+
return String(n ?? "").length <= e ? {
|
|
702
|
+
valid: !0,
|
|
703
|
+
message: ""
|
|
704
|
+
} : {
|
|
705
|
+
valid: !1,
|
|
706
|
+
message: t || `El valor debe tener como máximo ${e} caracteres`
|
|
707
|
+
};
|
|
708
|
+
},
|
|
709
|
+
lowercase: () => (e) => ({
|
|
710
|
+
valid: !0,
|
|
711
|
+
message: String(e ?? "").toLowerCase()
|
|
712
|
+
}),
|
|
713
|
+
uppercase: () => (e) => ({
|
|
714
|
+
valid: !0,
|
|
715
|
+
message: String(e ?? "").toUpperCase()
|
|
716
|
+
}),
|
|
717
|
+
regex: (e, t) => (n) => {
|
|
718
|
+
let r = String(n ?? "");
|
|
719
|
+
return e.test(r) ? {
|
|
612
720
|
valid: !0,
|
|
613
721
|
message: ""
|
|
614
722
|
} : {
|
|
615
723
|
valid: !1,
|
|
616
|
-
message:
|
|
724
|
+
message: t || "El valor no coincide con el patrón"
|
|
617
725
|
};
|
|
726
|
+
},
|
|
727
|
+
trim: () => (e) => ({
|
|
728
|
+
valid: !0,
|
|
729
|
+
message: String(e ?? "").trim()
|
|
730
|
+
}),
|
|
731
|
+
minDate: (e, t) => (n) => new Date(String(n ?? "")) >= e ? {
|
|
732
|
+
valid: !0,
|
|
733
|
+
message: ""
|
|
734
|
+
} : {
|
|
735
|
+
valid: !1,
|
|
736
|
+
message: t || `La fecha debe ser posterior a ${e.toLocaleDateString()}`
|
|
737
|
+
},
|
|
738
|
+
maxDate: (e, t) => (n) => new Date(String(n ?? "")) <= e ? {
|
|
739
|
+
valid: !0,
|
|
740
|
+
message: ""
|
|
741
|
+
} : {
|
|
742
|
+
valid: !1,
|
|
743
|
+
message: t || `La fecha debe ser anterior a ${e.toLocaleDateString()}`
|
|
618
744
|
}
|
|
619
|
-
},
|
|
745
|
+
}, W = class e {
|
|
620
746
|
checks = [];
|
|
621
747
|
add(e) {
|
|
622
748
|
return this.checks.push(e), this;
|
|
623
749
|
}
|
|
624
|
-
static
|
|
625
|
-
return new e().
|
|
750
|
+
static required() {
|
|
751
|
+
return new e().add(U.required());
|
|
626
752
|
}
|
|
627
753
|
static onlyNumbers() {
|
|
628
754
|
return new e().onlyNumbers();
|
|
@@ -633,63 +759,116 @@ var R = t(function({ variant: e = "default", Isize: t = "md", error: n = !1, lef
|
|
|
633
759
|
static max(t) {
|
|
634
760
|
return new e().max(t);
|
|
635
761
|
}
|
|
636
|
-
|
|
637
|
-
return
|
|
762
|
+
static positive() {
|
|
763
|
+
return new e().add(U.positive());
|
|
764
|
+
}
|
|
765
|
+
static negative() {
|
|
766
|
+
return new e().add(U.negative());
|
|
767
|
+
}
|
|
768
|
+
static integer() {
|
|
769
|
+
return new e().add(U.integer());
|
|
770
|
+
}
|
|
771
|
+
static round() {
|
|
772
|
+
return new e().add(U.round());
|
|
773
|
+
}
|
|
774
|
+
static truncate() {
|
|
775
|
+
return new e().add(U.truncate());
|
|
776
|
+
}
|
|
777
|
+
static email() {
|
|
778
|
+
return new e().email();
|
|
779
|
+
}
|
|
780
|
+
static minLength(t) {
|
|
781
|
+
return new e().minLength(t);
|
|
782
|
+
}
|
|
783
|
+
static maxLength(t) {
|
|
784
|
+
return new e().maxLength(t);
|
|
785
|
+
}
|
|
786
|
+
static lowercase() {
|
|
787
|
+
return new e().add(U.lowercase());
|
|
788
|
+
}
|
|
789
|
+
static uppercase() {
|
|
790
|
+
return new e().add(U.uppercase());
|
|
791
|
+
}
|
|
792
|
+
static trim() {
|
|
793
|
+
return new e().add(U.trim());
|
|
794
|
+
}
|
|
795
|
+
static regex(t, n) {
|
|
796
|
+
return new e().add(U.regex(t, n || "Valor inválido"));
|
|
797
|
+
}
|
|
798
|
+
static minDate(t) {
|
|
799
|
+
return new e().add(U.minDate(t));
|
|
800
|
+
}
|
|
801
|
+
static maxDate(t) {
|
|
802
|
+
return new e().add(U.maxDate(t));
|
|
803
|
+
}
|
|
804
|
+
required() {
|
|
805
|
+
return this.add(U.required());
|
|
638
806
|
}
|
|
639
807
|
onlyNumbers() {
|
|
640
|
-
return this.add(
|
|
808
|
+
return this.add(U.onlyNumbers());
|
|
641
809
|
}
|
|
642
810
|
min(e) {
|
|
643
|
-
return this.add(
|
|
811
|
+
return this.add(U.min(e));
|
|
644
812
|
}
|
|
645
813
|
max(e) {
|
|
646
|
-
return this.add(
|
|
814
|
+
return this.add(U.max(e));
|
|
815
|
+
}
|
|
816
|
+
positive() {
|
|
817
|
+
return this.add(U.positive());
|
|
818
|
+
}
|
|
819
|
+
negative() {
|
|
820
|
+
return this.add(U.negative());
|
|
821
|
+
}
|
|
822
|
+
integer() {
|
|
823
|
+
return this.add(U.integer());
|
|
647
824
|
}
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
825
|
+
round() {
|
|
826
|
+
return this.add(U.round());
|
|
827
|
+
}
|
|
828
|
+
truncate() {
|
|
829
|
+
return this.add(U.truncate());
|
|
830
|
+
}
|
|
831
|
+
email() {
|
|
832
|
+
return this.add(U.email());
|
|
833
|
+
}
|
|
834
|
+
minLength(e) {
|
|
835
|
+
return this.add(U.minLength(e));
|
|
836
|
+
}
|
|
837
|
+
maxLength(e) {
|
|
838
|
+
return this.add(U.maxLength(e));
|
|
839
|
+
}
|
|
840
|
+
lowercase() {
|
|
841
|
+
return this.add(U.lowercase());
|
|
842
|
+
}
|
|
843
|
+
uppercase() {
|
|
844
|
+
return this.add(U.uppercase());
|
|
845
|
+
}
|
|
846
|
+
trim() {
|
|
847
|
+
return this.add(U.trim());
|
|
848
|
+
}
|
|
849
|
+
regex(e, t) {
|
|
850
|
+
return this.add(U.regex(e, t || "Valor inválido"));
|
|
851
|
+
}
|
|
852
|
+
minDate(e) {
|
|
853
|
+
return this.add(U.minDate(e));
|
|
854
|
+
}
|
|
855
|
+
maxDate(e) {
|
|
856
|
+
return this.add(U.maxDate(e));
|
|
857
|
+
}
|
|
858
|
+
validate(e, t) {
|
|
859
|
+
let n = e;
|
|
860
|
+
for (let e of this.checks) {
|
|
861
|
+
let r = e(n);
|
|
862
|
+
if (!r.valid) return r;
|
|
863
|
+
r.message && (n = r.message, t && (n = t(n)));
|
|
652
864
|
}
|
|
653
865
|
return {
|
|
654
866
|
valid: !0,
|
|
655
867
|
message: ""
|
|
656
868
|
};
|
|
657
869
|
}
|
|
658
|
-
}
|
|
659
|
-
let [t, n] = o(!1);
|
|
660
|
-
return i(() => {
|
|
661
|
-
let e = () => {
|
|
662
|
-
let e = window.innerHeight > window.innerWidth;
|
|
663
|
-
n(e);
|
|
664
|
-
};
|
|
665
|
-
return e(), window.addEventListener("resize", e), () => window.removeEventListener("resize", e);
|
|
666
|
-
}, []), t ? /* @__PURE__ */ c(s, { children: e }) : null;
|
|
667
|
-
}, W = ({ children: e }) => {
|
|
668
|
-
let [t, n] = o(!1);
|
|
669
|
-
return i(() => {
|
|
670
|
-
let e = () => {
|
|
671
|
-
let e = window.innerHeight > window.innerWidth;
|
|
672
|
-
n(!e);
|
|
673
|
-
};
|
|
674
|
-
return e(), window.addEventListener("resize", e), () => window.removeEventListener("resize", e);
|
|
675
|
-
}, []), t ? /* @__PURE__ */ c(s, { children: e }) : null;
|
|
676
|
-
}, G = t(function({ className: e = "", style: t, children: n, ...r }, i) {
|
|
677
|
-
let o = m(), s = a(() => ({
|
|
678
|
-
borderColor: o.darkMode ? o.darkColors.border : o.colors.border,
|
|
679
|
-
backgroundColor: o.darkMode ? o.darkColors.background : o.colors.background
|
|
680
|
-
}), [o]);
|
|
681
|
-
return /* @__PURE__ */ c("div", {
|
|
682
|
-
ref: i,
|
|
683
|
-
...r,
|
|
684
|
-
className: ["px-2 py-1 rounded-xs shadow-md bg-white border", e].join(" "),
|
|
685
|
-
style: {
|
|
686
|
-
...t,
|
|
687
|
-
...s
|
|
688
|
-
},
|
|
689
|
-
children: n
|
|
690
|
-
});
|
|
691
|
-
});
|
|
870
|
+
};
|
|
692
871
|
//#endregion
|
|
693
|
-
export {
|
|
872
|
+
export { D as Background, B as Button, H as DesktopOnly, j as Form, w as Header, P as Input, V as MobileOnly, O as Separator, k as Surface, h as ThemeProvider, I as UnicornialInput, W as Validate, f as themeConfig, F as useDebounce, M as useForm, g as useTheme, U as validators };
|
|
694
873
|
|
|
695
874
|
//# sourceMappingURL=unicornial-ui.es.js.map
|