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