prometeo-design-system 1.5.5 → 1.5.7
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/Avatar.d.ts +4 -0
- package/dist/Avatar.es.js +52 -0
- package/dist/Button.d.ts +6 -0
- package/dist/Button.es.js +147 -0
- package/dist/CardProfile-BZajBGbO.js +253 -0
- package/dist/CardProfile.d.ts +2 -0
- package/dist/CardProfile.es.js +4 -0
- package/dist/CheckBox.d.ts +6 -0
- package/dist/CheckBox.es.js +105 -0
- package/dist/CheckboxFormik.d.ts +6 -0
- package/dist/CheckboxFormik.es.js +88 -0
- package/dist/DialogModal.d.ts +6 -0
- package/dist/DialogModal.es.js +52 -0
- package/dist/DrawerDesktop.d.ts +6 -0
- package/dist/DrawerDesktop.es.js +67 -0
- package/dist/DrawerMobile.d.ts +6 -0
- package/dist/DrawerMobile.es.js +43 -0
- package/dist/DropZone.d.ts +2 -0
- package/dist/DropZone.es.js +86 -0
- package/dist/Header.d.ts +6 -0
- package/dist/Header.es.js +23 -0
- package/dist/Icons.d.ts +2 -0
- package/dist/Icons.es.js +516 -0
- package/dist/Input.d.ts +6 -0
- package/dist/Input.es.js +200 -0
- package/dist/InputFormik.d.ts +6 -0
- package/dist/InputFormik.es.js +95 -0
- package/dist/LayoutGeneric-jDE96L2N.js +24 -0
- package/dist/LayoutGeneric.d.ts +6 -0
- package/dist/LayoutGeneric.es.js +4 -0
- package/dist/Logo.d.ts +4 -0
- package/dist/Logo.es.js +9 -0
- package/dist/Menu.d.ts +2 -0
- package/dist/Menu.es.js +76 -0
- package/dist/OtpInput.d.ts +6 -0
- package/dist/OtpInput.es.js +244 -0
- package/dist/Pagination.d.ts +6 -0
- package/dist/Pagination.es.js +97 -0
- package/dist/ProgressBar.d.ts +6 -0
- package/dist/ProgressBar.es.js +27 -0
- package/dist/Select.d.ts +6 -0
- package/dist/Select.es.js +203 -0
- package/dist/Spinner.d.ts +6 -0
- package/dist/Spinner.es.js +52 -0
- package/dist/SwipeContainer.d.ts +4 -0
- package/dist/SwipeContainer.es.js +185 -0
- package/dist/TabLinks.d.ts +4 -0
- package/dist/TabLinks.es.js +83 -0
- package/dist/Table.d.ts +2 -0
- package/dist/Table.es.js +121 -0
- package/dist/TextArea.d.ts +4 -0
- package/dist/TextArea.es.js +52 -0
- package/dist/Tooltip.d.ts +6 -0
- package/dist/Tooltip.es.js +62 -0
- package/dist/cn-B6yFEsav.js +8 -0
- package/dist/components/Avatar/index.d.ts +1 -0
- package/dist/components/Button/index.d.ts +2 -0
- package/dist/exports/Avatar.d.ts +1 -0
- package/dist/exports/Button.d.ts +2 -0
- package/dist/exports/CardProfile.d.ts +2 -0
- package/dist/exports/CheckBox.d.ts +2 -0
- package/dist/exports/CheckboxFormik.d.ts +2 -0
- package/dist/exports/DialogModal.d.ts +2 -0
- package/dist/exports/DrawerDesktop.d.ts +2 -0
- package/dist/exports/DrawerMobile.d.ts +2 -0
- package/dist/exports/DropZone.d.ts +1 -0
- package/dist/exports/Header.d.ts +2 -0
- package/dist/exports/Icons.d.ts +1 -0
- package/dist/exports/Input.d.ts +2 -0
- package/dist/exports/InputFormik.d.ts +2 -0
- package/dist/exports/LayoutGeneric.d.ts +2 -0
- package/dist/exports/Logo.d.ts +1 -0
- package/dist/exports/Menu.d.ts +2 -0
- package/dist/exports/OtpInput.d.ts +2 -0
- package/dist/exports/Pagination.d.ts +2 -0
- package/dist/exports/ProgressBar.d.ts +2 -0
- package/dist/exports/Select.d.ts +2 -0
- package/dist/exports/Spinner.d.ts +2 -0
- package/dist/exports/SwipeContainer.d.ts +1 -0
- package/dist/exports/TabLinks.d.ts +1 -0
- package/dist/exports/Table.d.ts +1 -0
- package/dist/exports/TextArea.d.ts +1 -0
- package/dist/exports/Tooltip.d.ts +2 -0
- package/dist/index-BOQuZ0gG.js +34 -0
- package/dist/jsx-runtime-ByW6EXIE.js +283 -0
- package/dist/prometeo-design-system.css +1 -1
- package/dist/prometeo-design-system.es.js +289 -5353
- package/package.json +120 -2
- package/dist/prometeo-design-system.umd.js +0 -113
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
import { j as h } from "./jsx-runtime-ByW6EXIE.js";
|
|
2
|
+
import { c as he } from "./cn-B6yFEsav.js";
|
|
3
|
+
import * as t from "react";
|
|
4
|
+
var Re = Object.defineProperty, De = Object.defineProperties, Te = Object.getOwnPropertyDescriptors, K = Object.getOwnPropertySymbols, ve = Object.prototype.hasOwnProperty, ge = Object.prototype.propertyIsEnumerable, me = (n, l, a) => l in n ? Re(n, l, { enumerable: !0, configurable: !0, writable: !0, value: a }) : n[l] = a, Ae = (n, l) => {
|
|
5
|
+
for (var a in l || (l = {})) ve.call(l, a) && me(n, a, l[a]);
|
|
6
|
+
if (K) for (var a of K(l)) ge.call(l, a) && me(n, a, l[a]);
|
|
7
|
+
return n;
|
|
8
|
+
}, Oe = (n, l) => De(n, Te(l)), We = (n, l) => {
|
|
9
|
+
var a = {};
|
|
10
|
+
for (var u in n) ve.call(n, u) && l.indexOf(u) < 0 && (a[u] = n[u]);
|
|
11
|
+
if (n != null && K) for (var u of K(n)) l.indexOf(u) < 0 && ge.call(n, u) && (a[u] = n[u]);
|
|
12
|
+
return a;
|
|
13
|
+
};
|
|
14
|
+
function Be(n) {
|
|
15
|
+
let l = setTimeout(n, 0), a = setTimeout(n, 10), u = setTimeout(n, 50);
|
|
16
|
+
return [l, a, u];
|
|
17
|
+
}
|
|
18
|
+
function Ne(n) {
|
|
19
|
+
let l = t.useRef();
|
|
20
|
+
return t.useEffect(() => {
|
|
21
|
+
l.current = n;
|
|
22
|
+
}), l.current;
|
|
23
|
+
}
|
|
24
|
+
var Ie = 18, be = 40, _e = `${be}px`, Fe = ["[data-lastpass-icon-root]", "com-1password-button", "[data-dashlanecreated]", '[style$="2147483647 !important;"]'].join(",");
|
|
25
|
+
function He({ containerRef: n, inputRef: l, pushPasswordManagerStrategy: a, isFocused: u }) {
|
|
26
|
+
let [E, d] = t.useState(!1), [T, y] = t.useState(!1), [k, A] = t.useState(!1), C = t.useMemo(() => a === "none" ? !1 : (a === "increase-width" || a === "experimental-no-flickering") && E && T, [E, T, a]), P = t.useCallback(() => {
|
|
27
|
+
let p = n.current, v = l.current;
|
|
28
|
+
if (!p || !v || k || a === "none") return;
|
|
29
|
+
let x = p, j = x.getBoundingClientRect().left + x.offsetWidth, _ = x.getBoundingClientRect().top + x.offsetHeight / 2, i = j - Ie, L = _;
|
|
30
|
+
document.querySelectorAll(Fe).length === 0 && document.elementFromPoint(i, L) === p || (d(!0), A(!0));
|
|
31
|
+
}, [n, l, k, a]);
|
|
32
|
+
return t.useEffect(() => {
|
|
33
|
+
let p = n.current;
|
|
34
|
+
if (!p || a === "none") return;
|
|
35
|
+
function v() {
|
|
36
|
+
let j = window.innerWidth - p.getBoundingClientRect().right;
|
|
37
|
+
y(j >= be);
|
|
38
|
+
}
|
|
39
|
+
v();
|
|
40
|
+
let x = setInterval(v, 1e3);
|
|
41
|
+
return () => {
|
|
42
|
+
clearInterval(x);
|
|
43
|
+
};
|
|
44
|
+
}, [n, a]), t.useEffect(() => {
|
|
45
|
+
let p = u || document.activeElement === l.current;
|
|
46
|
+
if (a === "none" || !p) return;
|
|
47
|
+
let v = setTimeout(P, 0), x = setTimeout(P, 2e3), j = setTimeout(P, 5e3), _ = setTimeout(() => {
|
|
48
|
+
A(!0);
|
|
49
|
+
}, 6e3);
|
|
50
|
+
return () => {
|
|
51
|
+
clearTimeout(v), clearTimeout(x), clearTimeout(j), clearTimeout(_);
|
|
52
|
+
};
|
|
53
|
+
}, [l, u, a, P]), { hasPWMBadge: E, willPushPWMBadge: C, PWM_BADGE_SPACE_WIDTH: _e };
|
|
54
|
+
}
|
|
55
|
+
var Le = t.createContext({}), xe = t.forwardRef((n, l) => {
|
|
56
|
+
var a = n, { value: u, onChange: E, maxLength: d, textAlign: T = "left", pattern: y, placeholder: k, inputMode: A = "numeric", onComplete: C, pushPasswordManagerStrategy: P = "increase-width", pasteTransformer: p, containerClassName: v, noScriptCSSFallback: x = $e, render: j, children: _ } = a, i = We(a, ["value", "onChange", "maxLength", "textAlign", "pattern", "placeholder", "inputMode", "onComplete", "pushPasswordManagerStrategy", "pasteTransformer", "containerClassName", "noScriptCSSFallback", "render", "children"]), L, te, ne, re, le;
|
|
57
|
+
let [we, Ee] = t.useState(typeof i.defaultValue == "string" ? i.defaultValue : ""), s = u ?? we, O = Ne(s), $ = t.useCallback((e) => {
|
|
58
|
+
E?.(e), Ee(e);
|
|
59
|
+
}, [E]), S = t.useMemo(() => y ? typeof y == "string" ? new RegExp(y) : y : null, [y]), c = t.useRef(null), Q = t.useRef(null), U = t.useRef({ value: s, onChange: $, isIOS: typeof window < "u" && ((te = (L = window?.CSS) == null ? void 0 : L.supports) == null ? void 0 : te.call(L, "-webkit-touch-callout", "none")) }), Z = t.useRef({ prev: [(ne = c.current) == null ? void 0 : ne.selectionStart, (re = c.current) == null ? void 0 : re.selectionEnd, (le = c.current) == null ? void 0 : le.selectionDirection] });
|
|
60
|
+
t.useImperativeHandle(l, () => c.current, []), t.useEffect(() => {
|
|
61
|
+
let e = c.current, r = Q.current;
|
|
62
|
+
if (!e || !r) return;
|
|
63
|
+
U.current.value !== e.value && U.current.onChange(e.value), Z.current.prev = [e.selectionStart, e.selectionEnd, e.selectionDirection];
|
|
64
|
+
function m() {
|
|
65
|
+
if (document.activeElement !== e) {
|
|
66
|
+
z(null), V(null);
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
let o = e.selectionStart, f = e.selectionEnd, J = e.selectionDirection, w = e.maxLength, B = e.value, M = Z.current.prev, R = -1, D = -1, N;
|
|
70
|
+
if (B.length !== 0 && o !== null && f !== null) {
|
|
71
|
+
let je = o === f, Me = o === B.length && B.length < w;
|
|
72
|
+
if (je && !Me) {
|
|
73
|
+
let I = o;
|
|
74
|
+
if (I === 0) R = 0, D = 1, N = "forward";
|
|
75
|
+
else if (I === w) R = I - 1, D = I, N = "backward";
|
|
76
|
+
else if (w > 1 && B.length > 1) {
|
|
77
|
+
let ee = 0;
|
|
78
|
+
if (M[0] !== null && M[1] !== null) {
|
|
79
|
+
N = I < M[1] ? "backward" : "forward";
|
|
80
|
+
let ke = M[0] === M[1] && M[0] < w;
|
|
81
|
+
N === "backward" && !ke && (ee = -1);
|
|
82
|
+
}
|
|
83
|
+
R = ee + I, D = ee + I + 1;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
R !== -1 && D !== -1 && R !== D && c.current.setSelectionRange(R, D, N);
|
|
87
|
+
}
|
|
88
|
+
let de = R !== -1 ? R : o, pe = D !== -1 ? D : f, Pe = N ?? J;
|
|
89
|
+
z(de), V(pe), Z.current.prev = [de, pe, Pe];
|
|
90
|
+
}
|
|
91
|
+
if (document.addEventListener("selectionchange", m, { capture: !0 }), m(), document.activeElement === e && X(!0), !document.getElementById("input-otp-style")) {
|
|
92
|
+
let o = document.createElement("style");
|
|
93
|
+
if (o.id = "input-otp-style", document.head.appendChild(o), o.sheet) {
|
|
94
|
+
let f = "background: transparent !important; color: transparent !important; border-color: transparent !important; opacity: 0 !important; box-shadow: none !important; -webkit-box-shadow: none !important; -webkit-text-fill-color: transparent !important;";
|
|
95
|
+
q(o.sheet, "[data-input-otp]::selection { background: transparent !important; color: transparent !important; }"), q(o.sheet, `[data-input-otp]:autofill { ${f} }`), q(o.sheet, `[data-input-otp]:-webkit-autofill { ${f} }`), q(o.sheet, "@supports (-webkit-touch-callout: none) { [data-input-otp] { letter-spacing: -.6em !important; font-weight: 100 !important; font-stretch: ultra-condensed; font-optical-sizing: none !important; left: -1px !important; right: 1px !important; } }"), q(o.sheet, "[data-input-otp] + * { pointer-events: all !important; }");
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
let g = () => {
|
|
99
|
+
r && r.style.setProperty("--root-height", `${e.clientHeight}px`);
|
|
100
|
+
};
|
|
101
|
+
g();
|
|
102
|
+
let b = new ResizeObserver(g);
|
|
103
|
+
return b.observe(e), () => {
|
|
104
|
+
document.removeEventListener("selectionchange", m, { capture: !0 }), b.disconnect();
|
|
105
|
+
};
|
|
106
|
+
}, []);
|
|
107
|
+
let [ae, oe] = t.useState(!1), [G, X] = t.useState(!1), [W, z] = t.useState(null), [F, V] = t.useState(null);
|
|
108
|
+
t.useEffect(() => {
|
|
109
|
+
Be(() => {
|
|
110
|
+
var e, r, m, g;
|
|
111
|
+
(e = c.current) == null || e.dispatchEvent(new Event("input"));
|
|
112
|
+
let b = (r = c.current) == null ? void 0 : r.selectionStart, o = (m = c.current) == null ? void 0 : m.selectionEnd, f = (g = c.current) == null ? void 0 : g.selectionDirection;
|
|
113
|
+
b !== null && o !== null && (z(b), V(o), Z.current.prev = [b, o, f]);
|
|
114
|
+
});
|
|
115
|
+
}, [s, G]), t.useEffect(() => {
|
|
116
|
+
O !== void 0 && s !== O && O.length < d && s.length === d && C?.(s);
|
|
117
|
+
}, [d, C, O, s]);
|
|
118
|
+
let H = He({ containerRef: Q, inputRef: c, pushPasswordManagerStrategy: P, isFocused: G }), ie = t.useCallback((e) => {
|
|
119
|
+
let r = e.currentTarget.value.slice(0, d);
|
|
120
|
+
if (r.length > 0 && S && !S.test(r)) {
|
|
121
|
+
e.preventDefault();
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
124
|
+
typeof O == "string" && r.length < O.length && document.dispatchEvent(new Event("selectionchange")), $(r);
|
|
125
|
+
}, [d, $, O, S]), ue = t.useCallback(() => {
|
|
126
|
+
var e;
|
|
127
|
+
if (c.current) {
|
|
128
|
+
let r = Math.min(c.current.value.length, d - 1), m = c.current.value.length;
|
|
129
|
+
(e = c.current) == null || e.setSelectionRange(r, m), z(r), V(m);
|
|
130
|
+
}
|
|
131
|
+
X(!0);
|
|
132
|
+
}, [d]), se = t.useCallback((e) => {
|
|
133
|
+
var r, m;
|
|
134
|
+
let g = c.current;
|
|
135
|
+
if (!p && (!U.current.isIOS || !e.clipboardData || !g)) return;
|
|
136
|
+
let b = e.clipboardData.getData("text/plain"), o = p ? p(b) : b;
|
|
137
|
+
e.preventDefault();
|
|
138
|
+
let f = (r = c.current) == null ? void 0 : r.selectionStart, J = (m = c.current) == null ? void 0 : m.selectionEnd, w = (f !== J ? s.slice(0, f) + o + s.slice(J) : s.slice(0, f) + o + s.slice(f)).slice(0, d);
|
|
139
|
+
if (w.length > 0 && S && !S.test(w)) return;
|
|
140
|
+
g.value = w, $(w);
|
|
141
|
+
let B = Math.min(w.length, d - 1), M = w.length;
|
|
142
|
+
g.setSelectionRange(B, M), z(B), V(M);
|
|
143
|
+
}, [d, $, S, s]), Se = t.useMemo(() => ({ position: "relative", cursor: i.disabled ? "default" : "text", userSelect: "none", WebkitUserSelect: "none", pointerEvents: "none" }), [i.disabled]), ce = t.useMemo(() => ({ position: "absolute", inset: 0, width: H.willPushPWMBadge ? `calc(100% + ${H.PWM_BADGE_SPACE_WIDTH})` : "100%", clipPath: H.willPushPWMBadge ? `inset(0 ${H.PWM_BADGE_SPACE_WIDTH} 0 0)` : void 0, height: "100%", display: "flex", textAlign: T, opacity: "1", color: "transparent", pointerEvents: "all", background: "transparent", caretColor: "transparent", border: "0 solid transparent", outline: "0 solid transparent", boxShadow: "none", lineHeight: "1", letterSpacing: "-.5em", fontSize: "var(--root-height)", fontFamily: "monospace", fontVariantNumeric: "tabular-nums" }), [H.PWM_BADGE_SPACE_WIDTH, H.willPushPWMBadge, T]), ye = t.useMemo(() => t.createElement("input", Oe(Ae({ autoComplete: i.autoComplete || "one-time-code" }, i), { "data-input-otp": !0, "data-input-otp-placeholder-shown": s.length === 0 || void 0, "data-input-otp-mss": W, "data-input-otp-mse": F, inputMode: A, pattern: S?.source, "aria-placeholder": k, style: ce, maxLength: d, value: s, ref: c, onPaste: (e) => {
|
|
144
|
+
var r;
|
|
145
|
+
se(e), (r = i.onPaste) == null || r.call(i, e);
|
|
146
|
+
}, onChange: ie, onMouseOver: (e) => {
|
|
147
|
+
var r;
|
|
148
|
+
oe(!0), (r = i.onMouseOver) == null || r.call(i, e);
|
|
149
|
+
}, onMouseLeave: (e) => {
|
|
150
|
+
var r;
|
|
151
|
+
oe(!1), (r = i.onMouseLeave) == null || r.call(i, e);
|
|
152
|
+
}, onFocus: (e) => {
|
|
153
|
+
var r;
|
|
154
|
+
ue(), (r = i.onFocus) == null || r.call(i, e);
|
|
155
|
+
}, onBlur: (e) => {
|
|
156
|
+
var r;
|
|
157
|
+
X(!1), (r = i.onBlur) == null || r.call(i, e);
|
|
158
|
+
} })), [ie, ue, se, A, ce, d, F, W, i, S?.source, s]), Y = t.useMemo(() => ({ slots: Array.from({ length: d }).map((e, r) => {
|
|
159
|
+
var m;
|
|
160
|
+
let g = G && W !== null && F !== null && (W === F && r === W || r >= W && r < F), b = s[r] !== void 0 ? s[r] : null, o = s[0] !== void 0 ? null : (m = k?.[r]) != null ? m : null;
|
|
161
|
+
return { char: b, placeholderChar: o, isActive: g, hasFakeCaret: g && b === null };
|
|
162
|
+
}), isFocused: G, isHovering: !i.disabled && ae }), [G, ae, d, F, W, i.disabled, s]), Ce = t.useMemo(() => j ? j(Y) : t.createElement(Le.Provider, { value: Y }, _), [_, Y, j]);
|
|
163
|
+
return t.createElement(t.Fragment, null, x !== null && t.createElement("noscript", null, t.createElement("style", null, x)), t.createElement("div", { ref: Q, "data-input-otp-container": !0, style: Se, className: v }, Ce, t.createElement("div", { style: { position: "absolute", inset: 0, pointerEvents: "none" } }, ye)));
|
|
164
|
+
});
|
|
165
|
+
xe.displayName = "Input";
|
|
166
|
+
function q(n, l) {
|
|
167
|
+
try {
|
|
168
|
+
n.insertRule(l);
|
|
169
|
+
} catch {
|
|
170
|
+
console.error("input-otp could not insert CSS rule:", l);
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
var $e = `
|
|
174
|
+
[data-input-otp] {
|
|
175
|
+
--nojs-bg: white !important;
|
|
176
|
+
--nojs-fg: black !important;
|
|
177
|
+
|
|
178
|
+
background-color: var(--nojs-bg) !important;
|
|
179
|
+
color: var(--nojs-fg) !important;
|
|
180
|
+
caret-color: var(--nojs-fg) !important;
|
|
181
|
+
letter-spacing: .25em !important;
|
|
182
|
+
text-align: center !important;
|
|
183
|
+
border: 1px solid var(--nojs-fg) !important;
|
|
184
|
+
border-radius: 4px !important;
|
|
185
|
+
width: 100% !important;
|
|
186
|
+
}
|
|
187
|
+
@media (prefers-color-scheme: dark) {
|
|
188
|
+
[data-input-otp] {
|
|
189
|
+
--nojs-bg: black !important;
|
|
190
|
+
--nojs-fg: white !important;
|
|
191
|
+
}
|
|
192
|
+
}`;
|
|
193
|
+
const Ve = ({
|
|
194
|
+
value: n = "",
|
|
195
|
+
onChange: l,
|
|
196
|
+
onComplete: a,
|
|
197
|
+
maxLength: u = 6,
|
|
198
|
+
placeholder: E = "•",
|
|
199
|
+
disabled: d = !1,
|
|
200
|
+
className: T,
|
|
201
|
+
autoFocus: y = !1,
|
|
202
|
+
pasteTransformer: k,
|
|
203
|
+
errorComponent: A,
|
|
204
|
+
hasError: C
|
|
205
|
+
}) => /* @__PURE__ */ h.jsx(
|
|
206
|
+
xe,
|
|
207
|
+
{
|
|
208
|
+
value: n,
|
|
209
|
+
autoFocus: y,
|
|
210
|
+
onChange: l,
|
|
211
|
+
onComplete: a,
|
|
212
|
+
maxLength: u,
|
|
213
|
+
disabled: d,
|
|
214
|
+
pasteTransformer: k,
|
|
215
|
+
containerClassName: he("group flex items-center has-[:disabled]:opacity-30", T),
|
|
216
|
+
render: ({ slots: P }) => /* @__PURE__ */ h.jsxs("div", { className: "flex flex-col items-center", children: [
|
|
217
|
+
/* @__PURE__ */ h.jsxs("div", { className: "flex items-center", children: [
|
|
218
|
+
/* @__PURE__ */ h.jsx("div", { className: "flex", children: P.slice(0, 3).map((p, v) => /* @__PURE__ */ h.jsx(fe, { ...p, placeholder: E, hasError: C }, v)) }),
|
|
219
|
+
/* @__PURE__ */ h.jsx("hr", { className: "w-2 h-1 mx-2 border-neutral-default-default" }),
|
|
220
|
+
/* @__PURE__ */ h.jsx("div", { className: "flex", children: P.slice(3).map((p, v) => /* @__PURE__ */ h.jsx(fe, { ...p, placeholder: E, hasError: C }, v)) })
|
|
221
|
+
] }),
|
|
222
|
+
C && /* @__PURE__ */ h.jsx("span", { className: "text-error-default-default text-xs mt-1", children: A })
|
|
223
|
+
] })
|
|
224
|
+
}
|
|
225
|
+
), fe = (n) => /* @__PURE__ */ h.jsxs(
|
|
226
|
+
"div",
|
|
227
|
+
{
|
|
228
|
+
className: he(
|
|
229
|
+
"relative w-14 h-14 text-[1.2rem] text-white",
|
|
230
|
+
"flex items-center justify-center",
|
|
231
|
+
"transition-all duration-300",
|
|
232
|
+
"border-2 border-neutral-default-default rounded-md mx-1",
|
|
233
|
+
{ "border-2 border-primary-default-default": n.isActive },
|
|
234
|
+
n.hasError && "border-error-default-default"
|
|
235
|
+
),
|
|
236
|
+
children: [
|
|
237
|
+
/* @__PURE__ */ h.jsx("div", { className: "group-has-[input[data-input-otp-placeholder-shown]]:opacity-20", children: n.char ?? n.placeholder }),
|
|
238
|
+
n.hasFakeCaret && /* @__PURE__ */ h.jsx("div", { className: "absolute inset-0 flex items-center justify-center", children: /* @__PURE__ */ h.jsx("div", { className: "w-3 h-1 rounded-full bg-neutral-default-default animate-pulse" }) })
|
|
239
|
+
]
|
|
240
|
+
}
|
|
241
|
+
);
|
|
242
|
+
export {
|
|
243
|
+
Ve as default
|
|
244
|
+
};
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { j as t } from "./jsx-runtime-ByW6EXIE.js";
|
|
2
|
+
import { motion as a } from "framer-motion";
|
|
3
|
+
function h({
|
|
4
|
+
currentPage: i = 1,
|
|
5
|
+
totalPages: l = 0,
|
|
6
|
+
onPageChange: p
|
|
7
|
+
}) {
|
|
8
|
+
const o = (e) => {
|
|
9
|
+
e >= 1 && e <= l && e !== i && p?.(e);
|
|
10
|
+
}, d = (() => {
|
|
11
|
+
const e = [];
|
|
12
|
+
if (l > 7)
|
|
13
|
+
if (e.push(1), i <= 4) {
|
|
14
|
+
for (let s = 2; s <= 5; s++)
|
|
15
|
+
e.push(s);
|
|
16
|
+
e.push("ellipsis"), e.push(l);
|
|
17
|
+
} else if (i >= l - 3) {
|
|
18
|
+
e.push("ellipsis");
|
|
19
|
+
for (let s = l - 4; s <= l; s++)
|
|
20
|
+
e.push(s);
|
|
21
|
+
} else {
|
|
22
|
+
e.push("ellipsis");
|
|
23
|
+
for (let s = i - 1; s <= i + 1; s++)
|
|
24
|
+
e.push(s);
|
|
25
|
+
e.push("ellipsis"), e.push(l);
|
|
26
|
+
}
|
|
27
|
+
else
|
|
28
|
+
for (let s = 1; s <= l; s++)
|
|
29
|
+
e.push(s);
|
|
30
|
+
return e;
|
|
31
|
+
})();
|
|
32
|
+
return /* @__PURE__ */ t.jsxs("div", { className: "flex items-center justify-center gap-2 p-4", children: [
|
|
33
|
+
/* @__PURE__ */ t.jsx(
|
|
34
|
+
a.button,
|
|
35
|
+
{
|
|
36
|
+
whileHover: { scale: 1.05 },
|
|
37
|
+
whileTap: { scale: 0.95 },
|
|
38
|
+
onClick: () => o(i - 1),
|
|
39
|
+
disabled: i === 1,
|
|
40
|
+
className: "px-4 py-2 text-primary-medium-default hover:text-primary-default-default disabled:text-gray-600 disabled:cursor-not-allowed transition-colors cursor-pointer",
|
|
41
|
+
children: "Anterior"
|
|
42
|
+
}
|
|
43
|
+
),
|
|
44
|
+
/* @__PURE__ */ t.jsx("div", { className: "flex items-center gap-1 select-none", children: d.map((e, n) => {
|
|
45
|
+
if (e === "ellipsis")
|
|
46
|
+
return /* @__PURE__ */ t.jsx(
|
|
47
|
+
"span",
|
|
48
|
+
{
|
|
49
|
+
className: "px-3 py-2 text-neutral-default-default",
|
|
50
|
+
children: "..."
|
|
51
|
+
},
|
|
52
|
+
`ellipsis-${n}`
|
|
53
|
+
);
|
|
54
|
+
const s = e, r = s === i;
|
|
55
|
+
return /* @__PURE__ */ t.jsxs(
|
|
56
|
+
a.button,
|
|
57
|
+
{
|
|
58
|
+
whileHover: r ? {} : { scale: 1.1 },
|
|
59
|
+
whileTap: r ? {} : { scale: 0.9 },
|
|
60
|
+
onClick: () => o(s),
|
|
61
|
+
className: `relative px-3 py-2 min-w-[40px] text-center transition-colors ${r ? "text-primary-default-default" : "text-neutral-default-default hover:text-white cursor-pointer "}`,
|
|
62
|
+
children: [
|
|
63
|
+
r && /* @__PURE__ */ t.jsx(
|
|
64
|
+
a.div,
|
|
65
|
+
{
|
|
66
|
+
layoutId: "activePage",
|
|
67
|
+
className: "absolute inset-0 border-1 border-primary-default-default rounded-md",
|
|
68
|
+
initial: !1,
|
|
69
|
+
transition: {
|
|
70
|
+
type: "spring",
|
|
71
|
+
stiffness: 500,
|
|
72
|
+
damping: 30
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
),
|
|
76
|
+
/* @__PURE__ */ t.jsx("span", { className: "relative z-10", children: s })
|
|
77
|
+
]
|
|
78
|
+
},
|
|
79
|
+
s
|
|
80
|
+
);
|
|
81
|
+
}) }),
|
|
82
|
+
/* @__PURE__ */ t.jsx(
|
|
83
|
+
a.button,
|
|
84
|
+
{
|
|
85
|
+
whileHover: { scale: 1.05 },
|
|
86
|
+
whileTap: { scale: 0.95 },
|
|
87
|
+
onClick: () => o(i + 1),
|
|
88
|
+
disabled: i === l,
|
|
89
|
+
className: "px-4 py-2 text-primary-medium-default hover:text-primary-default-default disabled:text-gray-600 disabled:cursor-not-allowed transition-colors cursor-pointer",
|
|
90
|
+
children: "Siguiente"
|
|
91
|
+
}
|
|
92
|
+
)
|
|
93
|
+
] });
|
|
94
|
+
}
|
|
95
|
+
export {
|
|
96
|
+
h as default
|
|
97
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { j as e } from "./jsx-runtime-ByW6EXIE.js";
|
|
2
|
+
import { c as x } from "./cn-B6yFEsav.js";
|
|
3
|
+
import u from "react";
|
|
4
|
+
const j = u.forwardRef(
|
|
5
|
+
({ className: r, endDate: n, label: l, ...d }, i) => {
|
|
6
|
+
const t = new Date(n), s = /* @__PURE__ */ new Date(), o = 1440 * 60 * 1e3, m = Math.max(0, Math.ceil((t.getTime() - s.getTime()) / o)), a = s > t, c = l || `Faltan ${m} días`;
|
|
7
|
+
return /* @__PURE__ */ e.jsxs("div", { ref: i, className: r, ...d, children: [
|
|
8
|
+
/* @__PURE__ */ e.jsx("div", { className: "flex justify-between items-center mb-2", children: /* @__PURE__ */ e.jsxs("div", { className: "flex flex-col gap-2", children: [
|
|
9
|
+
/* @__PURE__ */ e.jsx("span", { className: "text-sm text-neutral-medium-default", children: "Tiempo restante" }),
|
|
10
|
+
/* @__PURE__ */ e.jsx("span", { className: "font-semibold text-base text-neutral-default-default", children: c })
|
|
11
|
+
] }) }),
|
|
12
|
+
/* @__PURE__ */ e.jsx("div", { className: "w-full border-neutral-strong-default border rounded-sm h-[14px]", children: /* @__PURE__ */ e.jsx(
|
|
13
|
+
"div",
|
|
14
|
+
{
|
|
15
|
+
className: x(
|
|
16
|
+
"h-[14px] rounded-sm transition-all duration-300",
|
|
17
|
+
a ? "bg-red-500" : "bg-primary-default-default"
|
|
18
|
+
),
|
|
19
|
+
style: { width: `${a ? 100 : 0}%` }
|
|
20
|
+
}
|
|
21
|
+
) })
|
|
22
|
+
] });
|
|
23
|
+
}
|
|
24
|
+
);
|
|
25
|
+
export {
|
|
26
|
+
j as default
|
|
27
|
+
};
|
package/dist/Select.d.ts
ADDED
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
import { j as t } from "./jsx-runtime-ByW6EXIE.js";
|
|
2
|
+
import { Icons as v } from "./Icons.es.js";
|
|
3
|
+
import { c as o } from "./cn-B6yFEsav.js";
|
|
4
|
+
import { memo as V, useState as w, useRef as ee, useEffect as te } from "react";
|
|
5
|
+
import ne from "./Spinner.es.js";
|
|
6
|
+
const se = ({
|
|
7
|
+
label: C,
|
|
8
|
+
onOptionClick: I,
|
|
9
|
+
value: c = [],
|
|
10
|
+
isFetching: z = !1,
|
|
11
|
+
options: m,
|
|
12
|
+
multiple: u = !0,
|
|
13
|
+
onClear: y,
|
|
14
|
+
onClose: O,
|
|
15
|
+
className: k,
|
|
16
|
+
id: N,
|
|
17
|
+
emptyMessage: P = "No hay opciones disponibles",
|
|
18
|
+
optionValue: l,
|
|
19
|
+
optionLabel: p,
|
|
20
|
+
renderOption: B,
|
|
21
|
+
renderSelection: E,
|
|
22
|
+
containerClassName: F,
|
|
23
|
+
buttonClassName: H,
|
|
24
|
+
dropdownClassName: M,
|
|
25
|
+
displayMode: D = "compact",
|
|
26
|
+
onRemoveOption: A,
|
|
27
|
+
width: d = "100%",
|
|
28
|
+
height: a
|
|
29
|
+
}) => {
|
|
30
|
+
const [r, x] = w(!1), [h, b] = w(!1), [L, R] = w("down"), i = ee(null), f = c && c.length > 0, T = m?.filter((e) => c.includes(l(e))), $ = () => r || f || h ? "-top-2 left-2 scale-90" : "top-1/2 -translate-y-1/2 scale-100", g = {};
|
|
31
|
+
d && d !== "100%" && (g.width = d), a && (g.height = a);
|
|
32
|
+
const q = () => a ? { height: a } : {};
|
|
33
|
+
te(() => {
|
|
34
|
+
const e = (n) => {
|
|
35
|
+
i.current && !i.current.contains(n.target) && x(!1);
|
|
36
|
+
};
|
|
37
|
+
return r && document.addEventListener("mousedown", e), () => {
|
|
38
|
+
document.removeEventListener("mousedown", e);
|
|
39
|
+
};
|
|
40
|
+
}, [r]);
|
|
41
|
+
const G = () => {
|
|
42
|
+
r || W(), x(!r);
|
|
43
|
+
}, J = (e) => {
|
|
44
|
+
const n = l(e);
|
|
45
|
+
I(n, e), u || (x(!1), O?.());
|
|
46
|
+
}, K = (e) => {
|
|
47
|
+
e.stopPropagation(), b(!1), e.target.blur(), y?.();
|
|
48
|
+
}, Q = (e, n) => {
|
|
49
|
+
n?.stopPropagation();
|
|
50
|
+
const s = l(e);
|
|
51
|
+
A?.(s);
|
|
52
|
+
}, U = ({ option: e, onRemove: n }) => /* @__PURE__ */ t.jsxs("div", { className: "inline-flex items-center gap-1 px-2 py-1 bg-primary-default-default text-white text-xs rounded-md", children: [
|
|
53
|
+
/* @__PURE__ */ t.jsx("span", { className: "truncate max-w-20", children: p(e) }),
|
|
54
|
+
/* @__PURE__ */ t.jsx(
|
|
55
|
+
"button",
|
|
56
|
+
{
|
|
57
|
+
onMouseDown: (s) => {
|
|
58
|
+
s.preventDefault(), n(e, s);
|
|
59
|
+
},
|
|
60
|
+
className: "flex-shrink-0 hover:bg-primary-strong-default rounded-sm p-0.5 transition-colors",
|
|
61
|
+
type: "button",
|
|
62
|
+
tabIndex: -1,
|
|
63
|
+
children: /* @__PURE__ */ t.jsx(v.Close, { size: 12, className: "" })
|
|
64
|
+
}
|
|
65
|
+
)
|
|
66
|
+
] }), W = () => {
|
|
67
|
+
if (i.current) {
|
|
68
|
+
const e = i.current.getBoundingClientRect(), n = 250, s = window.innerHeight - e.bottom, j = e.top;
|
|
69
|
+
s < n && j > n ? R("up") : R("down");
|
|
70
|
+
}
|
|
71
|
+
}, X = ({ option: e, isSelected: n, onSelect: s, isMultiple: j }) => /* @__PURE__ */ t.jsxs(
|
|
72
|
+
"div",
|
|
73
|
+
{
|
|
74
|
+
onMouseDown: (S) => {
|
|
75
|
+
S.preventDefault(), s(), S.stopPropagation();
|
|
76
|
+
},
|
|
77
|
+
className: o(
|
|
78
|
+
"px-3 py-2 cursor-pointer flex items-center transition-colors",
|
|
79
|
+
n ? "bg-primary-default-default text-white" : "hover:bg-neutral-medium-selected text-neutral-default-default"
|
|
80
|
+
),
|
|
81
|
+
children: [
|
|
82
|
+
j && /* @__PURE__ */ t.jsx(
|
|
83
|
+
"input",
|
|
84
|
+
{
|
|
85
|
+
type: "checkbox",
|
|
86
|
+
checked: n,
|
|
87
|
+
onChange: () => {
|
|
88
|
+
},
|
|
89
|
+
className: "mr-2 pointer-events-none"
|
|
90
|
+
}
|
|
91
|
+
),
|
|
92
|
+
/* @__PURE__ */ t.jsx("span", { children: p(e) })
|
|
93
|
+
]
|
|
94
|
+
}
|
|
95
|
+
), Y = ({ selectedOptions: e }) => e?.length === 0 ? null : D === "chips" && u ? /* @__PURE__ */ t.jsx("div", { className: "flex items-center gap-1 flex-wrap py-1", children: e.map((n) => /* @__PURE__ */ t.jsx(
|
|
96
|
+
U,
|
|
97
|
+
{
|
|
98
|
+
option: n,
|
|
99
|
+
onRemove: Q
|
|
100
|
+
},
|
|
101
|
+
l(n)
|
|
102
|
+
)) }) : e?.length === 1 ? /* @__PURE__ */ t.jsx("span", { children: p(e[0]) }) : /* @__PURE__ */ t.jsxs("span", { children: [
|
|
103
|
+
e?.length,
|
|
104
|
+
" seleccionados"
|
|
105
|
+
] }), Z = B || X, _ = E || Y;
|
|
106
|
+
return /* @__PURE__ */ t.jsx(
|
|
107
|
+
"div",
|
|
108
|
+
{
|
|
109
|
+
className: o("relative bg-inherit select-none", F, !d && "w-full "),
|
|
110
|
+
ref: i,
|
|
111
|
+
style: g,
|
|
112
|
+
children: /* @__PURE__ */ t.jsxs("div", { className: o("relative bg-inherit", k), children: [
|
|
113
|
+
/* @__PURE__ */ t.jsxs(
|
|
114
|
+
"button",
|
|
115
|
+
{
|
|
116
|
+
id: N,
|
|
117
|
+
type: "button",
|
|
118
|
+
onClick: G,
|
|
119
|
+
onFocus: () => b(!0),
|
|
120
|
+
onBlur: () => b(!1),
|
|
121
|
+
className: o(
|
|
122
|
+
"w-full px-3 text-left border-1 rounded-lg transition-all duration-200 ease-in-out",
|
|
123
|
+
"flex items-center justify-between bg-inherit",
|
|
124
|
+
"focus:outline-none",
|
|
125
|
+
D === "chips" && u && f ? "min-h-12 py-2" : !a && "h-12",
|
|
126
|
+
r || h ? "border-primary-default-default border-2" : "border-neutral-default-default hover:border-neutral-strong-default",
|
|
127
|
+
H
|
|
128
|
+
),
|
|
129
|
+
style: q(),
|
|
130
|
+
children: [
|
|
131
|
+
/* @__PURE__ */ t.jsx(
|
|
132
|
+
"label",
|
|
133
|
+
{
|
|
134
|
+
htmlFor: N,
|
|
135
|
+
className: o(
|
|
136
|
+
"absolute left-3 transition-all duration-200 ease-in-out pointer-events-none bg-inherit px-1 z-10",
|
|
137
|
+
"text-sm",
|
|
138
|
+
$(),
|
|
139
|
+
f || r || h ? "text-primary-default-default" : "text-neutral-medium-default"
|
|
140
|
+
),
|
|
141
|
+
children: C
|
|
142
|
+
}
|
|
143
|
+
),
|
|
144
|
+
/* @__PURE__ */ t.jsx("div", { className: "flex-1 min-w-0", children: /* @__PURE__ */ t.jsx(_, { selectedOptions: T }) }),
|
|
145
|
+
/* @__PURE__ */ t.jsxs("div", { className: "flex items-center gap-2 ml-2", children: [
|
|
146
|
+
z && /* @__PURE__ */ t.jsx(ne, { size: "small" }),
|
|
147
|
+
f && y && /* @__PURE__ */ t.jsx(
|
|
148
|
+
"button",
|
|
149
|
+
{
|
|
150
|
+
onMouseDown: (e) => {
|
|
151
|
+
e.preventDefault(), e.stopPropagation(), K(e);
|
|
152
|
+
},
|
|
153
|
+
className: "text-neutral-medium-default hover:text-neutral-default-default transition-colors",
|
|
154
|
+
type: "button",
|
|
155
|
+
tabIndex: -1,
|
|
156
|
+
children: /* @__PURE__ */ t.jsx(v.Close, { size: 16, className: "" })
|
|
157
|
+
}
|
|
158
|
+
),
|
|
159
|
+
/* @__PURE__ */ t.jsx(
|
|
160
|
+
v.ChevronDown,
|
|
161
|
+
{
|
|
162
|
+
size: 20,
|
|
163
|
+
className: o(
|
|
164
|
+
"transition-transform text-neutral-default-default",
|
|
165
|
+
r ? "rotate-180" : ""
|
|
166
|
+
)
|
|
167
|
+
}
|
|
168
|
+
)
|
|
169
|
+
] })
|
|
170
|
+
]
|
|
171
|
+
}
|
|
172
|
+
),
|
|
173
|
+
r && /* @__PURE__ */ t.jsx(
|
|
174
|
+
"div",
|
|
175
|
+
{
|
|
176
|
+
className: o(
|
|
177
|
+
"absolute z-50 w-full mt-1 bg-neutral-default-default border border-neutral-default-default rounded-md shadow-lg",
|
|
178
|
+
"max-h-60 overflow-auto",
|
|
179
|
+
L === "up" ? "bottom-full mb-1" : "top-full mt-1",
|
|
180
|
+
M
|
|
181
|
+
),
|
|
182
|
+
children: m.length === 0 ? /* @__PURE__ */ t.jsx("div", { className: "px-3 py-2 text-neutral-medium-default", children: P }) : m.map((e) => {
|
|
183
|
+
const n = l(e), s = c.includes(n);
|
|
184
|
+
return /* @__PURE__ */ t.jsx(
|
|
185
|
+
Z,
|
|
186
|
+
{
|
|
187
|
+
option: e,
|
|
188
|
+
isSelected: s,
|
|
189
|
+
onSelect: () => J(e),
|
|
190
|
+
isMultiple: u
|
|
191
|
+
},
|
|
192
|
+
n
|
|
193
|
+
);
|
|
194
|
+
})
|
|
195
|
+
}
|
|
196
|
+
)
|
|
197
|
+
] })
|
|
198
|
+
}
|
|
199
|
+
);
|
|
200
|
+
}, ce = V(se);
|
|
201
|
+
export {
|
|
202
|
+
ce as default
|
|
203
|
+
};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { j as e } from "./jsx-runtime-ByW6EXIE.js";
|
|
2
|
+
import { ClipLoader as l, SyncLoader as m, HashLoader as p, GridLoader as x, DotLoader as j, BounceLoader as f } from "react-spinners";
|
|
3
|
+
import { c as L } from "./cn-B6yFEsav.js";
|
|
4
|
+
const y = ({
|
|
5
|
+
variant: a = "sync",
|
|
6
|
+
color: t = "#3B82F6",
|
|
7
|
+
loading: o = !0,
|
|
8
|
+
size: s = "medium",
|
|
9
|
+
className: c = "",
|
|
10
|
+
speedMultiplier: i = 1
|
|
11
|
+
}) => {
|
|
12
|
+
const n = (() => {
|
|
13
|
+
if (typeof s == "number") return s;
|
|
14
|
+
switch (s) {
|
|
15
|
+
case "small":
|
|
16
|
+
return 20;
|
|
17
|
+
case "medium":
|
|
18
|
+
return 35;
|
|
19
|
+
case "large":
|
|
20
|
+
return 50;
|
|
21
|
+
default:
|
|
22
|
+
return 35;
|
|
23
|
+
}
|
|
24
|
+
})(), r = {
|
|
25
|
+
color: t,
|
|
26
|
+
loading: o,
|
|
27
|
+
size: n,
|
|
28
|
+
speedMultiplier: i,
|
|
29
|
+
"aria-label": "Loading Spinner",
|
|
30
|
+
"data-testid": "spinner"
|
|
31
|
+
}, u = L("inline-block", c), d = () => {
|
|
32
|
+
switch (a) {
|
|
33
|
+
case "bounce":
|
|
34
|
+
return /* @__PURE__ */ e.jsx(f, { ...r });
|
|
35
|
+
case "dot":
|
|
36
|
+
return /* @__PURE__ */ e.jsx(j, { ...r });
|
|
37
|
+
case "grid":
|
|
38
|
+
return /* @__PURE__ */ e.jsx(x, { ...r, size: n * 0.4 });
|
|
39
|
+
case "hash":
|
|
40
|
+
return /* @__PURE__ */ e.jsx(p, { ...r });
|
|
41
|
+
case "sync":
|
|
42
|
+
return /* @__PURE__ */ e.jsx(m, { ...r, size: n * 0.4 });
|
|
43
|
+
case "clip":
|
|
44
|
+
default:
|
|
45
|
+
return /* @__PURE__ */ e.jsx(l, { ...r });
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
return /* @__PURE__ */ e.jsx("div", { className: u, children: d() });
|
|
49
|
+
};
|
|
50
|
+
export {
|
|
51
|
+
y as default
|
|
52
|
+
};
|