prometeo-design-system 2.5.1 → 2.5.3
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/DatePicker.es.js +1 -1
- package/dist/DrawerMobile.es.js +102 -100
- package/dist/Icons/Icons.d.ts +3 -0
- package/dist/Icons.es.js +43 -26
- package/dist/{Input-Bhd0bmVq.js → Input-PNwH7rb6.js} +1 -1
- package/dist/Input.es.js +1 -1
- package/dist/OtpInput.es.js +144 -139
- package/dist/SegmentedButton.es.js +16 -16
- package/dist/{Select-B32JqJIS.js → Select-C-aLaiJu.js} +1 -1
- package/dist/Select.es.js +1 -1
- package/dist/SelectFormik.es.js +1 -1
- package/dist/SelectSearch.es.js +48 -47
- package/dist/components/Drawer/DrawerMobile.d.ts +6 -5
- package/dist/components/Drawer/useDrawerMobile.d.ts +4 -3
- package/dist/components/FAB/FAButton.d.ts +21 -0
- package/dist/components/OtpInput/OtpInput.d.ts +5 -2
- package/dist/components/SelectSearch/SelectSearch.d.ts +1 -0
- 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
package/dist/Icons.es.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { j as h } from "./jsx-runtime-DKDX3adD.js";
|
|
2
2
|
import { memo as v } from "react";
|
|
3
|
-
const l = (t) => v(t),
|
|
3
|
+
const l = (t) => v(t), o = l(({
|
|
4
4
|
size: t = 24,
|
|
5
5
|
className: r,
|
|
6
6
|
...q
|
|
@@ -16,7 +16,7 @@ const l = (t) => v(t), w = l(({
|
|
|
16
16
|
className: r,
|
|
17
17
|
children: /* @__PURE__ */ h.jsx("path", { d: "M480-280q17 0 28.5-11.5T520-320q0-17-11.5-28.5T480-360q-17 0-28.5 11.5T440-320q0 17 11.5 28.5T480-280Zm0-160q17 0 28.5-11.5T520-480q0-17-11.5-28.5T480-520q-17 0-28.5 11.5T440-480q0 17 11.5 28.5T480-440Zm0-160q17 0 28.5-11.5T520-640q0-17-11.5-28.5T480-680q-17 0-28.5 11.5T440-640q0 17 11.5 28.5T480-600Zm320 440H160q-33 0-56.5-23.5T80-240v-160q33 0 56.5-23.5T160-480q0-33-23.5-56.5T80-560v-160q0-33 23.5-56.5T160-800h640q33 0 56.5 23.5T880-720v160q-33 0-56.5 23.5T800-480q0 33 23.5 56.5T880-400v160q0 33-23.5 56.5T800-160Zm0-80v-102q-37-22-58.5-58.5T720-480q0-43 21.5-79.5T800-618v-102H160v102q37 22 58.5 58.5T240-480q0 43-21.5 79.5T160-342v102h640ZM480-480Z" })
|
|
18
18
|
}
|
|
19
|
-
)),
|
|
19
|
+
)), w = l(({
|
|
20
20
|
size: t = 24,
|
|
21
21
|
className: r,
|
|
22
22
|
...q
|
|
@@ -32,7 +32,7 @@ const l = (t) => v(t), w = l(({
|
|
|
32
32
|
...q,
|
|
33
33
|
children: /* @__PURE__ */ h.jsx("path", { d: "M480-280q17 0 28.5-11.5T520-320q0-17-11.5-28.5T480-360q-17 0-28.5 11.5T440-320q0 17 11.5 28.5T480-280Zm0-160q17 0 28.5-11.5T520-480q0-17-11.5-28.5T480-520q-17 0-28.5 11.5T440-480q0 17 11.5 28.5T480-440Zm0-160q17 0 28.5-11.5T520-640q0-17-11.5-28.5T480-680q-17 0-28.5 11.5T440-640q0 17 11.5 28.5T480-600Zm320 440H160q-33 0-56.5-23.5T80-240v-160q33 0 56.5-23.5T160-480q0-33-23.5-56.5T80-560v-160q0-33 23.5-56.5T160-800h640q33 0 56.5 23.5T880-720v160q-33 0-56.5 23.5T800-480q0 33 23.5 56.5T880-400v160q0 33-23.5 56.5T800-160Z" })
|
|
34
34
|
}
|
|
35
|
-
)),
|
|
35
|
+
)), s = l(({
|
|
36
36
|
size: t = 24,
|
|
37
37
|
className: r,
|
|
38
38
|
...q
|
|
@@ -48,7 +48,7 @@ const l = (t) => v(t), w = l(({
|
|
|
48
48
|
className: r,
|
|
49
49
|
children: /* @__PURE__ */ h.jsx("path", { d: "M240-200h120v-240h240v240h120v-360L480-740 240-560v360Zm-80 80v-480l320-240 320 240v480H520v-240h-80v240H160Zm320-350Z" })
|
|
50
50
|
}
|
|
51
|
-
)),
|
|
51
|
+
)), T = l(({
|
|
52
52
|
size: t = 24,
|
|
53
53
|
className: r,
|
|
54
54
|
...q
|
|
@@ -144,7 +144,7 @@ const l = (t) => v(t), w = l(({
|
|
|
144
144
|
className: r,
|
|
145
145
|
children: /* @__PURE__ */ h.jsx("path", { d: "M504-480 320-664l56-56 240 240-240 240-56-56 184-184Z" })
|
|
146
146
|
}
|
|
147
|
-
)),
|
|
147
|
+
)), c = l(({
|
|
148
148
|
size: t = 24,
|
|
149
149
|
className: r,
|
|
150
150
|
...q
|
|
@@ -160,7 +160,7 @@ const l = (t) => v(t), w = l(({
|
|
|
160
160
|
className: r,
|
|
161
161
|
children: /* @__PURE__ */ h.jsx("path", { d: "M400-240 160-480l240-240 56 58-142 142h486v80H314l142 142-56 58Z" })
|
|
162
162
|
}
|
|
163
|
-
)),
|
|
163
|
+
)), Z = l(({
|
|
164
164
|
size: t = 24,
|
|
165
165
|
className: r,
|
|
166
166
|
...q
|
|
@@ -304,7 +304,7 @@ const l = (t) => v(t), w = l(({
|
|
|
304
304
|
className: r,
|
|
305
305
|
children: /* @__PURE__ */ h.jsx("path", { d: "M400-240v-80h160v80H400ZM240-440v-80h480v80H240ZM120-640v-80h720v80H120Z" })
|
|
306
306
|
}
|
|
307
|
-
)),
|
|
307
|
+
)), L = l(({
|
|
308
308
|
size: t = 24,
|
|
309
309
|
className: r,
|
|
310
310
|
...q
|
|
@@ -320,7 +320,7 @@ const l = (t) => v(t), w = l(({
|
|
|
320
320
|
className: r,
|
|
321
321
|
children: /* @__PURE__ */ h.jsx("path", { d: "M784-120 532-372q-30 24-69 38t-83 14q-109 0-184.5-75.5T120-580q0-109 75.5-184.5T380-840q109 0 184.5 75.5T640-580q0 44-14 83t-38 69l252 252-56 56ZM380-400q75 0 127.5-52.5T560-580q0-75-52.5-127.5T380-760q-75 0-127.5 52.5T200-580q0 75 52.5 127.5T380-400Z" })
|
|
322
322
|
}
|
|
323
|
-
)),
|
|
323
|
+
)), f = l(({
|
|
324
324
|
size: t = 24,
|
|
325
325
|
className: r,
|
|
326
326
|
...q
|
|
@@ -336,7 +336,7 @@ const l = (t) => v(t), w = l(({
|
|
|
336
336
|
className: r,
|
|
337
337
|
children: /* @__PURE__ */ h.jsx("path", { d: "m668-380 152-130 120 10-176 153 52 227-102-62-46-198Zm-94-292-42-98 46-110 92 217-96-9ZM294-287l126-76 126 77-33-144 111-96-146-13-58-136-58 135-146 13 111 97-33 143ZM173-120l65-281L20-590l288-25 112-265 112 265 288 25-218 189 65 281-247-149-247 149Zm247-340Z" })
|
|
338
338
|
}
|
|
339
|
-
)),
|
|
339
|
+
)), H = l(({
|
|
340
340
|
size: t = 24,
|
|
341
341
|
className: r,
|
|
342
342
|
...q
|
|
@@ -400,7 +400,7 @@ const l = (t) => v(t), w = l(({
|
|
|
400
400
|
className: r,
|
|
401
401
|
children: /* @__PURE__ */ h.jsx("path", { d: "M440-320v-326L336-542l-56-58 200-200 200 200-56 58-104-104v326h-80ZM240-160q-33 0-56.5-23.5T160-240v-120h80v120h480v-120h80v120q0 33-23.5 56.5T720-160H240Z" })
|
|
402
402
|
}
|
|
403
|
-
)),
|
|
403
|
+
)), V = l(({
|
|
404
404
|
size: t = 24,
|
|
405
405
|
className: r,
|
|
406
406
|
...q
|
|
@@ -416,7 +416,7 @@ const l = (t) => v(t), w = l(({
|
|
|
416
416
|
className: r,
|
|
417
417
|
children: /* @__PURE__ */ h.jsx("path", { d: "M360-240q-33 0-56.5-23.5T280-320v-480q0-33 23.5-56.5T360-880h360q33 0 56.5 23.5T800-800v480q0 33-23.5 56.5T720-240H360Zm0-80h360v-480H360v480ZM200-80q-33 0-56.5-23.5T120-160v-560h80v560h440v80H200Zm160-240v-480 480Z" })
|
|
418
418
|
}
|
|
419
|
-
)),
|
|
419
|
+
)), E = l(({
|
|
420
420
|
size: t = 24,
|
|
421
421
|
className: r,
|
|
422
422
|
...q
|
|
@@ -599,17 +599,33 @@ const l = (t) => v(t), w = l(({
|
|
|
599
599
|
className: r,
|
|
600
600
|
children: /* @__PURE__ */ h.jsx("path", { d: "M3.5 21V17.5714H20.5V21H3.5ZM6.475 15L10.9375 3H13.0625L17.525 15H15.485L14.4225 11.9143H9.62L8.515 15H6.475ZM10.215 10.2H13.785L12.0425 5.22857H11.9575L10.215 10.2Z", fill: "currentColor" })
|
|
601
601
|
}
|
|
602
|
-
)), z = {
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
602
|
+
)), z = l(({
|
|
603
|
+
size: t = 24,
|
|
604
|
+
className: r,
|
|
605
|
+
...q
|
|
606
|
+
}) => /* @__PURE__ */ h.jsx(
|
|
607
|
+
"svg",
|
|
608
|
+
{
|
|
609
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
610
|
+
width: t,
|
|
611
|
+
height: t,
|
|
612
|
+
viewBox: "0 -960 960 960",
|
|
613
|
+
fill: "currentColor",
|
|
614
|
+
...q,
|
|
615
|
+
className: r,
|
|
616
|
+
children: /* @__PURE__ */ h.jsx("path", { d: "M286.5 -253.875L180 -360.375L222 -402.375L285.75 -338.625L413.25 -466.125L455.25 -423.375L286.5 -253.875ZM286.5 -493.875L180 -600.375L222 -642.375L285.75 -578.625L413.25 -706.125L455.25 -663.375L286.5 -493.875ZM510 -313.875V-373.875H780V-313.875H510ZM510 -553.875V-613.875H780V-553.875H510Z", fill: "currentColor", transform: "translate(480,-480) scale(1.45) translate(-480,480)" })
|
|
617
|
+
}
|
|
618
|
+
)), t0 = {
|
|
619
|
+
Ticket: o,
|
|
620
|
+
Home: s,
|
|
621
|
+
Boards: T,
|
|
606
622
|
Notifications: n,
|
|
607
623
|
Help: e,
|
|
608
624
|
Settings: i,
|
|
609
625
|
CrevronLeft: x,
|
|
610
626
|
CrevronRight: g,
|
|
611
|
-
ArrowLeft:
|
|
612
|
-
Shared:
|
|
627
|
+
ArrowLeft: c,
|
|
628
|
+
Shared: Z,
|
|
613
629
|
ChevronDown: m,
|
|
614
630
|
Collapse: d,
|
|
615
631
|
Calendar: C,
|
|
@@ -618,14 +634,14 @@ const l = (t) => v(t), w = l(({
|
|
|
618
634
|
Logout: j,
|
|
619
635
|
ArrowUpDown: a,
|
|
620
636
|
Filter: M,
|
|
621
|
-
Search:
|
|
622
|
-
Stars:
|
|
623
|
-
MoreVert:
|
|
637
|
+
Search: L,
|
|
638
|
+
Stars: f,
|
|
639
|
+
MoreVert: H,
|
|
624
640
|
Add: B,
|
|
625
641
|
Edit: k,
|
|
626
642
|
Upload: y,
|
|
627
|
-
Copy:
|
|
628
|
-
FaLock:
|
|
643
|
+
Copy: V,
|
|
644
|
+
FaLock: E,
|
|
629
645
|
AccountCircle: A,
|
|
630
646
|
UserAdd: F,
|
|
631
647
|
AttachFile: S,
|
|
@@ -637,7 +653,7 @@ const l = (t) => v(t), w = l(({
|
|
|
637
653
|
Check: N,
|
|
638
654
|
Info: O,
|
|
639
655
|
Error: P,
|
|
640
|
-
TicketFilled:
|
|
656
|
+
TicketFilled: w,
|
|
641
657
|
UploadCloud: R,
|
|
642
658
|
Clock: $,
|
|
643
659
|
Pause: G,
|
|
@@ -646,10 +662,11 @@ const l = (t) => v(t), w = l(({
|
|
|
646
662
|
Sort: Q,
|
|
647
663
|
Cancel: W,
|
|
648
664
|
CheckCircle: X,
|
|
649
|
-
FormatColorText: Y
|
|
665
|
+
FormatColorText: Y,
|
|
666
|
+
CheckList: z
|
|
650
667
|
};
|
|
651
|
-
for (const [t, r] of Object.entries(
|
|
668
|
+
for (const [t, r] of Object.entries(t0))
|
|
652
669
|
r.displayName = `${t}_Icon`;
|
|
653
670
|
export {
|
|
654
|
-
|
|
671
|
+
t0 as Icons
|
|
655
672
|
};
|
package/dist/Input.es.js
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:
|
|
278
|
-
"relative w-14 h-14 text-[1.2rem] text-white",
|
|
281
|
+
className: $(
|
|
282
|
+
"relative w-12 h-12 md:w-14 md:h-14 text-[1rem] md: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
|
};
|