prometeo-design-system 1.7.6 → 1.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/OtpInput.es.js +231 -179
- package/dist/Steps.es.js +118 -94
- package/dist/components/OtpInput/OtpInput.d.ts +14 -2
- package/dist/components/Steps/Steps.d.ts +4 -2
- package/dist/exports/useDevice.d.ts +1 -1
- package/dist/hooks/useDevice.d.ts +1 -7
- package/dist/index.d.ts +1 -1
- package/dist/preview/SelectPreview.d.ts +2 -0
- package/dist/preview/StepsPreview.d.ts +2 -0
- package/dist/prometeo-design-system.css +1 -1
- package/dist/prometeo-design-system.es.js +2 -2
- package/dist/useDevice.es.js +10 -20
- package/package.json +245 -225
package/dist/OtpInput.es.js
CHANGED
|
@@ -1,176 +1,178 @@
|
|
|
1
|
-
import { j as
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import { j as p } from "./jsx-runtime-ByW6EXIE.js";
|
|
2
|
+
import { Icons as ve } from "./Icons.es.js";
|
|
3
|
+
import { c as L } from "./cn-B6yFEsav.js";
|
|
4
|
+
import * as n from "react";
|
|
5
|
+
import ge from "react";
|
|
6
|
+
var De = Object.defineProperty, Te = Object.defineProperties, Oe = Object.getOwnPropertyDescriptors, te = Object.getOwnPropertySymbols, we = Object.prototype.hasOwnProperty, ye = Object.prototype.propertyIsEnumerable, xe = (t, r, a) => r in t ? De(t, r, { enumerable: !0, configurable: !0, writable: !0, value: a }) : t[r] = a, We = (t, r) => {
|
|
7
|
+
for (var a in r || (r = {})) we.call(r, a) && xe(t, a, r[a]);
|
|
8
|
+
if (te) for (var a of te(r)) ye.call(r, a) && xe(t, a, r[a]);
|
|
9
|
+
return t;
|
|
10
|
+
}, Ae = (t, r) => Te(t, Oe(r)), Be = (t, r) => {
|
|
9
11
|
var a = {};
|
|
10
|
-
for (var u in
|
|
11
|
-
if (
|
|
12
|
+
for (var u in t) we.call(t, u) && r.indexOf(u) < 0 && (a[u] = t[u]);
|
|
13
|
+
if (t != null && te) for (var u of te(t)) r.indexOf(u) < 0 && ye.call(t, u) && (a[u] = t[u]);
|
|
12
14
|
return a;
|
|
13
15
|
};
|
|
14
|
-
function
|
|
15
|
-
let
|
|
16
|
-
return [
|
|
16
|
+
function _e(t) {
|
|
17
|
+
let r = setTimeout(t, 0), a = setTimeout(t, 10), u = setTimeout(t, 50);
|
|
18
|
+
return [r, a, u];
|
|
17
19
|
}
|
|
18
|
-
function
|
|
19
|
-
let
|
|
20
|
-
return
|
|
21
|
-
|
|
22
|
-
}),
|
|
20
|
+
function Ie(t) {
|
|
21
|
+
let r = n.useRef();
|
|
22
|
+
return n.useEffect(() => {
|
|
23
|
+
r.current = t;
|
|
24
|
+
}), r.current;
|
|
23
25
|
}
|
|
24
|
-
var
|
|
25
|
-
function
|
|
26
|
-
let [
|
|
27
|
-
let
|
|
28
|
-
if (!
|
|
29
|
-
let
|
|
30
|
-
document.querySelectorAll(
|
|
31
|
-
}, [
|
|
32
|
-
return
|
|
33
|
-
let
|
|
34
|
-
if (!
|
|
26
|
+
var Fe = 18, Ee = 40, He = `${Ee}px`, Le = ["[data-lastpass-icon-root]", "com-1password-button", "[data-dashlanecreated]", '[style$="2147483647 !important;"]'].join(",");
|
|
27
|
+
function $e({ containerRef: t, inputRef: r, pushPasswordManagerStrategy: a, isFocused: u }) {
|
|
28
|
+
let [C, d] = n.useState(!1), [R, M] = n.useState(!1), [D, W] = n.useState(!1), A = n.useMemo(() => a === "none" ? !1 : (a === "increase-width" || a === "experimental-no-flickering") && C && R, [C, R, a]), x = n.useCallback(() => {
|
|
29
|
+
let f = t.current, v = r.current;
|
|
30
|
+
if (!f || !v || D || a === "none") return;
|
|
31
|
+
let m = f, b = m.getBoundingClientRect().left + m.offsetWidth, w = m.getBoundingClientRect().top + m.offsetHeight / 2, o = b - Fe, j = w;
|
|
32
|
+
document.querySelectorAll(Le).length === 0 && document.elementFromPoint(o, j) === f || (d(!0), W(!0));
|
|
33
|
+
}, [t, r, D, a]);
|
|
34
|
+
return n.useEffect(() => {
|
|
35
|
+
let f = t.current;
|
|
36
|
+
if (!f || a === "none") return;
|
|
35
37
|
function v() {
|
|
36
|
-
let
|
|
37
|
-
|
|
38
|
+
let b = window.innerWidth - f.getBoundingClientRect().right;
|
|
39
|
+
M(b >= Ee);
|
|
38
40
|
}
|
|
39
41
|
v();
|
|
40
|
-
let
|
|
42
|
+
let m = setInterval(v, 1e3);
|
|
41
43
|
return () => {
|
|
42
|
-
clearInterval(
|
|
44
|
+
clearInterval(m);
|
|
43
45
|
};
|
|
44
|
-
}, [
|
|
45
|
-
let
|
|
46
|
-
if (a === "none" || !
|
|
47
|
-
let v = setTimeout(
|
|
48
|
-
|
|
46
|
+
}, [t, a]), n.useEffect(() => {
|
|
47
|
+
let f = u || document.activeElement === r.current;
|
|
48
|
+
if (a === "none" || !f) return;
|
|
49
|
+
let v = setTimeout(x, 0), m = setTimeout(x, 2e3), b = setTimeout(x, 5e3), w = setTimeout(() => {
|
|
50
|
+
W(!0);
|
|
49
51
|
}, 6e3);
|
|
50
52
|
return () => {
|
|
51
|
-
clearTimeout(v), clearTimeout(
|
|
53
|
+
clearTimeout(v), clearTimeout(m), clearTimeout(b), clearTimeout(w);
|
|
52
54
|
};
|
|
53
|
-
}, [
|
|
55
|
+
}, [r, u, a, x]), { hasPWMBadge: C, willPushPWMBadge: A, PWM_BADGE_SPACE_WIDTH: He };
|
|
54
56
|
}
|
|
55
|
-
var
|
|
56
|
-
var a =
|
|
57
|
-
let [
|
|
58
|
-
|
|
59
|
-
}, [
|
|
60
|
-
|
|
61
|
-
let e = c.current,
|
|
62
|
-
if (!e || !
|
|
63
|
-
|
|
64
|
-
function
|
|
57
|
+
var ze = n.createContext({}), Se = n.forwardRef((t, r) => {
|
|
58
|
+
var a = t, { value: u, onChange: C, maxLength: d, textAlign: R = "left", pattern: M, placeholder: D, inputMode: W = "numeric", onComplete: A, pushPasswordManagerStrategy: x = "increase-width", pasteTransformer: f, containerClassName: v, noScriptCSSFallback: m = Ge, render: b, children: w } = a, o = Be(a, ["value", "onChange", "maxLength", "textAlign", "pattern", "placeholder", "inputMode", "onComplete", "pushPasswordManagerStrategy", "pasteTransformer", "containerClassName", "noScriptCSSFallback", "render", "children"]), j, k, $, V, X;
|
|
59
|
+
let [ne, q] = n.useState(typeof o.defaultValue == "string" ? o.defaultValue : ""), i = u ?? ne, B = Ie(i), Z = n.useCallback((e) => {
|
|
60
|
+
C?.(e), q(e);
|
|
61
|
+
}, [C]), P = n.useMemo(() => M ? typeof M == "string" ? new RegExp(M) : M : null, [M]), c = n.useRef(null), le = n.useRef(null), re = n.useRef({ value: i, onChange: Z, isIOS: typeof window < "u" && ((k = (j = window?.CSS) == null ? void 0 : j.supports) == null ? void 0 : k.call(j, "-webkit-touch-callout", "none")) }), Y = n.useRef({ prev: [($ = c.current) == null ? void 0 : $.selectionStart, (V = c.current) == null ? void 0 : V.selectionEnd, (X = c.current) == null ? void 0 : X.selectionDirection] });
|
|
62
|
+
n.useImperativeHandle(r, () => c.current, []), n.useEffect(() => {
|
|
63
|
+
let e = c.current, l = le.current;
|
|
64
|
+
if (!e || !l) return;
|
|
65
|
+
re.current.value !== e.value && re.current.onChange(e.value), Y.current.prev = [e.selectionStart, e.selectionEnd, e.selectionDirection];
|
|
66
|
+
function h() {
|
|
65
67
|
if (document.activeElement !== e) {
|
|
66
|
-
|
|
68
|
+
K(null), Q(null);
|
|
67
69
|
return;
|
|
68
70
|
}
|
|
69
|
-
let
|
|
70
|
-
if (
|
|
71
|
-
let
|
|
72
|
-
if (
|
|
73
|
-
let
|
|
74
|
-
if (
|
|
75
|
-
else if (
|
|
76
|
-
else if (
|
|
77
|
-
let
|
|
78
|
-
if (
|
|
79
|
-
|
|
80
|
-
let
|
|
81
|
-
|
|
71
|
+
let s = e.selectionStart, g = e.selectionEnd, ee = e.selectionDirection, S = e.maxLength, I = e.value, N = Y.current.prev, T = -1, O = -1, F;
|
|
72
|
+
if (I.length !== 0 && s !== null && g !== null) {
|
|
73
|
+
let ke = s === g, Ne = s === I.length && I.length < S;
|
|
74
|
+
if (ke && !Ne) {
|
|
75
|
+
let H = s;
|
|
76
|
+
if (H === 0) T = 0, O = 1, F = "forward";
|
|
77
|
+
else if (H === S) T = H - 1, O = H, F = "backward";
|
|
78
|
+
else if (S > 1 && I.length > 1) {
|
|
79
|
+
let ie = 0;
|
|
80
|
+
if (N[0] !== null && N[1] !== null) {
|
|
81
|
+
F = H < N[1] ? "backward" : "forward";
|
|
82
|
+
let Re = N[0] === N[1] && N[0] < S;
|
|
83
|
+
F === "backward" && !Re && (ie = -1);
|
|
82
84
|
}
|
|
83
|
-
|
|
85
|
+
T = ie + H, O = ie + H + 1;
|
|
84
86
|
}
|
|
85
87
|
}
|
|
86
|
-
|
|
88
|
+
T !== -1 && O !== -1 && T !== O && c.current.setSelectionRange(T, O, F);
|
|
87
89
|
}
|
|
88
|
-
let
|
|
89
|
-
|
|
90
|
+
let me = T !== -1 ? T : s, he = O !== -1 ? O : g, Me = F ?? ee;
|
|
91
|
+
K(me), Q(he), Y.current.prev = [me, he, Me];
|
|
90
92
|
}
|
|
91
|
-
if (document.addEventListener("selectionchange",
|
|
92
|
-
let
|
|
93
|
-
if (
|
|
94
|
-
let
|
|
95
|
-
|
|
93
|
+
if (document.addEventListener("selectionchange", h, { capture: !0 }), h(), document.activeElement === e && ae(!0), !document.getElementById("input-otp-style")) {
|
|
94
|
+
let s = document.createElement("style");
|
|
95
|
+
if (s.id = "input-otp-style", document.head.appendChild(s), s.sheet) {
|
|
96
|
+
let g = "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;";
|
|
97
|
+
U(s.sheet, "[data-input-otp]::selection { background: transparent !important; color: transparent !important; }"), U(s.sheet, `[data-input-otp]:autofill { ${g} }`), U(s.sheet, `[data-input-otp]:-webkit-autofill { ${g} }`), U(s.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; } }"), U(s.sheet, "[data-input-otp] + * { pointer-events: all !important; }");
|
|
96
98
|
}
|
|
97
99
|
}
|
|
98
|
-
let
|
|
99
|
-
|
|
100
|
+
let y = () => {
|
|
101
|
+
l && l.style.setProperty("--root-height", `${e.clientHeight}px`);
|
|
100
102
|
};
|
|
101
|
-
|
|
102
|
-
let
|
|
103
|
-
return
|
|
104
|
-
document.removeEventListener("selectionchange",
|
|
103
|
+
y();
|
|
104
|
+
let E = new ResizeObserver(y);
|
|
105
|
+
return E.observe(e), () => {
|
|
106
|
+
document.removeEventListener("selectionchange", h, { capture: !0 }), E.disconnect();
|
|
105
107
|
};
|
|
106
108
|
}, []);
|
|
107
|
-
let [
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
var e,
|
|
109
|
+
let [se, ue] = n.useState(!1), [J, ae] = n.useState(!1), [_, K] = n.useState(null), [z, Q] = n.useState(null);
|
|
110
|
+
n.useEffect(() => {
|
|
111
|
+
_e(() => {
|
|
112
|
+
var e, l, h, y;
|
|
111
113
|
(e = c.current) == null || e.dispatchEvent(new Event("input"));
|
|
112
|
-
let
|
|
113
|
-
|
|
114
|
+
let E = (l = c.current) == null ? void 0 : l.selectionStart, s = (h = c.current) == null ? void 0 : h.selectionEnd, g = (y = c.current) == null ? void 0 : y.selectionDirection;
|
|
115
|
+
E !== null && s !== null && (K(E), Q(s), Y.current.prev = [E, s, g]);
|
|
114
116
|
});
|
|
115
|
-
}, [
|
|
116
|
-
|
|
117
|
-
}, [d,
|
|
118
|
-
let
|
|
119
|
-
let
|
|
120
|
-
if (
|
|
117
|
+
}, [i, J]), n.useEffect(() => {
|
|
118
|
+
B !== void 0 && i !== B && B.length < d && i.length === d && A?.(i);
|
|
119
|
+
}, [d, A, B, i]);
|
|
120
|
+
let G = $e({ containerRef: le, inputRef: c, pushPasswordManagerStrategy: x, isFocused: J }), ce = n.useCallback((e) => {
|
|
121
|
+
let l = e.currentTarget.value.slice(0, d);
|
|
122
|
+
if (l.length > 0 && P && !P.test(l)) {
|
|
121
123
|
e.preventDefault();
|
|
122
124
|
return;
|
|
123
125
|
}
|
|
124
|
-
typeof
|
|
125
|
-
}, [d,
|
|
126
|
+
typeof B == "string" && l.length < B.length && document.dispatchEvent(new Event("selectionchange")), Z(l);
|
|
127
|
+
}, [d, Z, B, P]), de = n.useCallback(() => {
|
|
126
128
|
var e;
|
|
127
129
|
if (c.current) {
|
|
128
|
-
let
|
|
129
|
-
(e = c.current) == null || e.setSelectionRange(
|
|
130
|
+
let l = Math.min(c.current.value.length, d - 1), h = c.current.value.length;
|
|
131
|
+
(e = c.current) == null || e.setSelectionRange(l, h), K(l), Q(h);
|
|
130
132
|
}
|
|
131
|
-
|
|
132
|
-
}, [d]),
|
|
133
|
-
var
|
|
134
|
-
let
|
|
135
|
-
if (!
|
|
136
|
-
let
|
|
133
|
+
ae(!0);
|
|
134
|
+
}, [d]), fe = n.useCallback((e) => {
|
|
135
|
+
var l, h;
|
|
136
|
+
let y = c.current;
|
|
137
|
+
if (!f && (!re.current.isIOS || !e.clipboardData || !y)) return;
|
|
138
|
+
let E = e.clipboardData.getData("text/plain"), s = f ? f(E) : E;
|
|
137
139
|
e.preventDefault();
|
|
138
|
-
let
|
|
139
|
-
if (
|
|
140
|
-
|
|
141
|
-
let
|
|
142
|
-
|
|
143
|
-
}, [d,
|
|
144
|
-
var
|
|
145
|
-
|
|
146
|
-
}, onChange:
|
|
147
|
-
var
|
|
148
|
-
|
|
140
|
+
let g = (l = c.current) == null ? void 0 : l.selectionStart, ee = (h = c.current) == null ? void 0 : h.selectionEnd, S = (g !== ee ? i.slice(0, g) + s + i.slice(ee) : i.slice(0, g) + s + i.slice(g)).slice(0, d);
|
|
141
|
+
if (S.length > 0 && P && !P.test(S)) return;
|
|
142
|
+
y.value = S, Z(S);
|
|
143
|
+
let I = Math.min(S.length, d - 1), N = S.length;
|
|
144
|
+
y.setSelectionRange(I, N), K(I), Q(N);
|
|
145
|
+
}, [d, Z, P, i]), je = n.useMemo(() => ({ position: "relative", cursor: o.disabled ? "default" : "text", userSelect: "none", WebkitUserSelect: "none", pointerEvents: "none" }), [o.disabled]), pe = n.useMemo(() => ({ position: "absolute", inset: 0, width: G.willPushPWMBadge ? `calc(100% + ${G.PWM_BADGE_SPACE_WIDTH})` : "100%", clipPath: G.willPushPWMBadge ? `inset(0 ${G.PWM_BADGE_SPACE_WIDTH} 0 0)` : void 0, height: "100%", display: "flex", textAlign: R, 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" }), [G.PWM_BADGE_SPACE_WIDTH, G.willPushPWMBadge, R]), Pe = n.useMemo(() => n.createElement("input", Ae(We({ autoComplete: o.autoComplete || "one-time-code" }, o), { "data-input-otp": !0, "data-input-otp-placeholder-shown": i.length === 0 || void 0, "data-input-otp-mss": _, "data-input-otp-mse": z, inputMode: W, pattern: P?.source, "aria-placeholder": D, style: pe, maxLength: d, value: i, ref: c, onPaste: (e) => {
|
|
146
|
+
var l;
|
|
147
|
+
fe(e), (l = o.onPaste) == null || l.call(o, e);
|
|
148
|
+
}, onChange: ce, onMouseOver: (e) => {
|
|
149
|
+
var l;
|
|
150
|
+
ue(!0), (l = o.onMouseOver) == null || l.call(o, e);
|
|
149
151
|
}, onMouseLeave: (e) => {
|
|
150
|
-
var
|
|
151
|
-
|
|
152
|
+
var l;
|
|
153
|
+
ue(!1), (l = o.onMouseLeave) == null || l.call(o, e);
|
|
152
154
|
}, onFocus: (e) => {
|
|
153
|
-
var
|
|
154
|
-
|
|
155
|
+
var l;
|
|
156
|
+
de(), (l = o.onFocus) == null || l.call(o, e);
|
|
155
157
|
}, onBlur: (e) => {
|
|
156
|
-
var
|
|
157
|
-
|
|
158
|
-
} })), [
|
|
159
|
-
var
|
|
160
|
-
let
|
|
161
|
-
return { char:
|
|
162
|
-
}), isFocused:
|
|
163
|
-
return
|
|
158
|
+
var l;
|
|
159
|
+
ae(!1), (l = o.onBlur) == null || l.call(o, e);
|
|
160
|
+
} })), [ce, de, fe, W, pe, d, z, _, o, P?.source, i]), oe = n.useMemo(() => ({ slots: Array.from({ length: d }).map((e, l) => {
|
|
161
|
+
var h;
|
|
162
|
+
let y = J && _ !== null && z !== null && (_ === z && l === _ || l >= _ && l < z), E = i[l] !== void 0 ? i[l] : null, s = i[0] !== void 0 ? null : (h = D?.[l]) != null ? h : null;
|
|
163
|
+
return { char: E, placeholderChar: s, isActive: y, hasFakeCaret: y && E === null };
|
|
164
|
+
}), isFocused: J, isHovering: !o.disabled && se }), [J, se, d, z, _, o.disabled, i]), Ce = n.useMemo(() => b ? b(oe) : n.createElement(ze.Provider, { value: oe }, w), [w, oe, b]);
|
|
165
|
+
return n.createElement(n.Fragment, null, m !== null && n.createElement("noscript", null, n.createElement("style", null, m)), n.createElement("div", { ref: le, "data-input-otp-container": !0, style: je, className: v }, Ce, n.createElement("div", { style: { position: "absolute", inset: 0, pointerEvents: "none" } }, Pe)));
|
|
164
166
|
});
|
|
165
|
-
|
|
166
|
-
function
|
|
167
|
+
Se.displayName = "Input";
|
|
168
|
+
function U(t, r) {
|
|
167
169
|
try {
|
|
168
|
-
|
|
170
|
+
t.insertRule(r);
|
|
169
171
|
} catch {
|
|
170
|
-
console.error("input-otp could not insert CSS rule:",
|
|
172
|
+
console.error("input-otp could not insert CSS rule:", r);
|
|
171
173
|
}
|
|
172
174
|
}
|
|
173
|
-
var
|
|
175
|
+
var Ge = `
|
|
174
176
|
[data-input-otp] {
|
|
175
177
|
--nojs-bg: white !important;
|
|
176
178
|
--nojs-fg: black !important;
|
|
@@ -190,55 +192,105 @@ var $e = `
|
|
|
190
192
|
--nojs-fg: white !important;
|
|
191
193
|
}
|
|
192
194
|
}`;
|
|
193
|
-
const
|
|
194
|
-
value:
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
)
|
|
195
|
+
const Ke = ({
|
|
196
|
+
value: t = "",
|
|
197
|
+
name: r,
|
|
198
|
+
onChange: a,
|
|
199
|
+
onComplete: u,
|
|
200
|
+
onBlur: C,
|
|
201
|
+
maxLength: d = 6,
|
|
202
|
+
placeholder: R = "•",
|
|
203
|
+
disabled: M = !1,
|
|
204
|
+
className: D,
|
|
205
|
+
autoFocus: W = !1,
|
|
206
|
+
pasteTransformer: A,
|
|
207
|
+
errorComponent: x,
|
|
208
|
+
hasError: f,
|
|
209
|
+
helperComponent: v,
|
|
210
|
+
helperAlignment: m = "left",
|
|
211
|
+
slotClassName: b,
|
|
212
|
+
variant: w = "default",
|
|
213
|
+
hideSlotsMiddleSeparator: o = !1
|
|
214
|
+
}) => {
|
|
215
|
+
const j = m === "left" ? "justify-start w-full text-left" : m === "center" ? "justify-center" : "justify-end text-right w-full", k = {
|
|
216
|
+
default: {
|
|
217
|
+
text: "text-neutral-default-default",
|
|
218
|
+
icon: null
|
|
219
|
+
},
|
|
220
|
+
error: {
|
|
221
|
+
text: "text-error-default-default",
|
|
222
|
+
icon: /* @__PURE__ */ p.jsx(ve.Error, { size: 18, className: "text-error-default-default" })
|
|
223
|
+
},
|
|
224
|
+
success: {
|
|
225
|
+
text: "text-success-default-default",
|
|
226
|
+
icon: /* @__PURE__ */ p.jsx(ve.Check, { size: 18, className: "text-success-default-default" })
|
|
227
|
+
}
|
|
228
|
+
};
|
|
229
|
+
return /* @__PURE__ */ p.jsx(
|
|
230
|
+
Se,
|
|
231
|
+
{
|
|
232
|
+
value: t,
|
|
233
|
+
name: r,
|
|
234
|
+
autoFocus: W,
|
|
235
|
+
onChange: a,
|
|
236
|
+
onComplete: u,
|
|
237
|
+
onBlur: C,
|
|
238
|
+
maxLength: d,
|
|
239
|
+
disabled: M,
|
|
240
|
+
pasteTransformer: A,
|
|
241
|
+
spellCheck: !1,
|
|
242
|
+
containerClassName: L("group flex items-center has-[:disabled]:opacity-30 w-max justify-center", D),
|
|
243
|
+
render: ({ slots: $ }) => {
|
|
244
|
+
const V = Math.floor($.length / 2), X = $.slice(0, V), ne = $.slice(V);
|
|
245
|
+
return /* @__PURE__ */ p.jsxs("div", { className: "flex flex-col items-center", children: [
|
|
246
|
+
/* @__PURE__ */ p.jsxs("div", { className: "flex items-center", children: [
|
|
247
|
+
/* @__PURE__ */ p.jsx("div", { className: "flex", children: X.map((q, i) => /* @__PURE__ */ p.jsx(be, { ...q, placeholder: R, hasError: f, className: b, variant: w }, i)) }),
|
|
248
|
+
/* @__PURE__ */ p.jsx("hr", { className: L("w-2 h-1 mx-2 border-neutral-default-default", o && "hidden") }),
|
|
249
|
+
/* @__PURE__ */ p.jsx("div", { className: "flex", children: ne.map((q, i) => /* @__PURE__ */ p.jsx(be, { ...q, placeholder: R, hasError: f, variant: w, className: b }, i)) })
|
|
250
|
+
] }),
|
|
251
|
+
f && x && (typeof x == "string" ? /* @__PURE__ */ p.jsxs("span", { className: L("text-error-default-default text-xs mt-1 flex items-center gap-1", j, k.error.text), children: [
|
|
252
|
+
k.error.icon,
|
|
253
|
+
x
|
|
254
|
+
] }) : ge.cloneElement(x, { className: L(
|
|
255
|
+
"text-error-default-default text-xs mt-1",
|
|
256
|
+
j,
|
|
257
|
+
k.error.text,
|
|
258
|
+
x?.props?.className
|
|
259
|
+
) })),
|
|
260
|
+
v && m && (typeof v == "string" ? /* @__PURE__ */ p.jsxs("span", { className: L("text-neutral-medium-default text-xs mt-1 flex items-center gap-1", k[w].text, j), children: [
|
|
261
|
+
k[w].icon,
|
|
262
|
+
v
|
|
263
|
+
] }) : ge.cloneElement(v, { className: L("text-neutral-medium-default text-xs mt-1", j, k[w].text, v?.props?.className) }))
|
|
264
|
+
] });
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
);
|
|
268
|
+
}, be = (t) => {
|
|
269
|
+
const r = {
|
|
270
|
+
default: "border-neutral-default-default",
|
|
271
|
+
error: "border-error-default-default",
|
|
272
|
+
success: "border-success-default-default"
|
|
273
|
+
};
|
|
274
|
+
return /* @__PURE__ */ p.jsxs(
|
|
275
|
+
"div",
|
|
276
|
+
{
|
|
277
|
+
className: L(
|
|
278
|
+
"relative w-14 h-14 text-[1.2rem] text-white",
|
|
279
|
+
"flex items-center justify-center",
|
|
280
|
+
"transition-all duration-300",
|
|
281
|
+
"border-2 border-neutral-default-default rounded-md mx-1",
|
|
282
|
+
{ "border-2 border-primary-default-default": t.isActive },
|
|
283
|
+
r[t.variant || "default"],
|
|
284
|
+
t.className,
|
|
285
|
+
t.hasError && r.error
|
|
286
|
+
),
|
|
287
|
+
children: [
|
|
288
|
+
/* @__PURE__ */ p.jsx("div", { className: "group-has-[input[data-input-otp-placeholder-shown]]:opacity-20", children: t.char ?? t.placeholder }),
|
|
289
|
+
t.hasFakeCaret && /* @__PURE__ */ p.jsx("div", { className: "absolute inset-0 flex items-center justify-center", children: /* @__PURE__ */ p.jsx("div", { className: "w-3 h-1 rounded-full bg-neutral-default-default animate-pulse" }) })
|
|
290
|
+
]
|
|
291
|
+
}
|
|
292
|
+
);
|
|
293
|
+
};
|
|
242
294
|
export {
|
|
243
|
-
|
|
295
|
+
Ke as default
|
|
244
296
|
};
|