@spear-ai/spectral 1.3.59 → 1.3.61

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/InputOTP.js CHANGED
@@ -1,188 +1,227 @@
1
1
  "use client";
2
2
  import "./styles/main.css";
3
- import { jsx as j, jsxs as ge } from "react/jsx-runtime";
4
- import { useFormFieldId as Be, ErrorMessage as _e, getErrorMessageId as Fe } from "./utils/formFieldUtils.js";
5
- import { c as he } from "./twUtils-CRiPKpXj.js";
6
- import * as t from "react";
7
- import { createContext as He, forwardRef as Q, useContext as fe } from "react";
8
- import { c as Le } from "./createLucideIcon-CI1yJrZf.js";
9
- /**
10
- * @license lucide-react v0.542.0 - ISC
11
- *
12
- * This source code is licensed under the ISC license.
13
- * See the LICENSE file in the root directory of this source tree.
14
- */
15
- const Ge = [["path", { d: "M5 12h14", key: "1ays0h" }]], $e = Le("minus", Ge);
16
- var ze = Object.defineProperty, Ve = Object.defineProperties, qe = Object.getOwnPropertyDescriptors, K = Object.getOwnPropertySymbols, be = Object.prototype.hasOwnProperty, we = Object.prototype.propertyIsEnumerable, ve = (n, r, l) => r in n ? ze(n, r, { enumerable: !0, configurable: !0, writable: !0, value: l }) : n[r] = l, Ze = (n, r) => {
17
- for (var l in r || (r = {})) be.call(r, l) && ve(n, l, r[l]);
18
- if (K) for (var l of K(r)) we.call(r, l) && ve(n, l, r[l]);
19
- return n;
20
- }, Je = (n, r) => Ve(n, qe(r)), Ke = (n, r) => {
21
- var l = {};
22
- for (var u in n) be.call(n, u) && r.indexOf(u) < 0 && (l[u] = n[u]);
23
- if (n != null && K) for (var u of K(n)) r.indexOf(u) < 0 && we.call(n, u) && (l[u] = n[u]);
24
- return l;
3
+ import { jsx as P, jsxs as it } from "react/jsx-runtime";
4
+ import "./Icons/AnnotationsIcon.js";
5
+ import "./Icons/CalendarIcon.js";
6
+ import "./Icons/CheckCircleIcon.js";
7
+ import "./Icons/CheckSquareIcon.js";
8
+ import "./Icons/CheckmarkIcon.js";
9
+ import "./Icons/ChevronDownIcon.js";
10
+ import "./Icons/ChevronUpIcon.js";
11
+ import "./Icons/ClockIcon.js";
12
+ import "./Icons/CloseCircleIcon.js";
13
+ import "./Icons/CloseIcon.js";
14
+ import "./Icons/DashboardIcon.js";
15
+ import "./Icons/DeleteIcon.js";
16
+ import "./Icons/DurationIcon.js";
17
+ import "./Icons/EmailIcon.js";
18
+ import "./Icons/EraserIcon.js";
19
+ import "./Icons/ErrorIcon.js";
20
+ import "./Icons/EyeClosedIcon.js";
21
+ import "./Icons/EyeClosedIcon2.js";
22
+ import "./Icons/EyeOpenIcon.js";
23
+ import "./Icons/GoToFirstIcon.js";
24
+ import "./Icons/GoToLastIcon.js";
25
+ import "./Icons/HarmonicCursorsIcon.js";
26
+ import "./Icons/InfoIcon.js";
27
+ import "./Icons/LabelIcon.js";
28
+ import "./Icons/LassoIcon.js";
29
+ import "./Icons/LineToolIcon.js";
30
+ import "./Icons/LiveViewIcon.js";
31
+ import "./Icons/LoaderIcon.js";
32
+ import "./Icons/LocationIcon.js";
33
+ import "./Icons/LogoutIcon.js";
34
+ import "./Icons/MetadataIcon.js";
35
+ import { MinusIcon as _t } from "./Icons/MinusIcon.js";
36
+ import "./Icons/OntologyIcon.js";
37
+ import "./Icons/PanelIconClose.js";
38
+ import "./Icons/PanelIconOpen.js";
39
+ import "./Icons/PlayIcon.js";
40
+ import "./Icons/PlusIcon.js";
41
+ import "./Icons/ResetIcon.js";
42
+ import "./Icons/ScissorsIcon.js";
43
+ import "./Icons/SettingsIcon.js";
44
+ import "./Icons/TrashIcon.js";
45
+ import "./Icons/UndoIcon.js";
46
+ import "./Icons/UserIcon.js";
47
+ import "./Icons/WarningIcon.js";
48
+ import "./Icons/ZoomAllIcon.js";
49
+ import "./Icons/ZoomXIcon.js";
50
+ import "./Icons/ZoomYIcon.js";
51
+ import { useFormFieldId as Ht, ErrorMessage as Gt, getErrorMessageId as $t } from "./utils/formFieldUtils.js";
52
+ import { c as yt } from "./twUtils-CRiPKpXj.js";
53
+ import * as n from "react";
54
+ import { createContext as Et, forwardRef as et, Fragment as Lt, useContext as Pt } from "react";
55
+ var zt = Object.defineProperty, Vt = Object.defineProperties, qt = Object.getOwnPropertyDescriptors, tt = Object.getOwnPropertySymbols, St = Object.prototype.hasOwnProperty, xt = Object.prototype.propertyIsEnumerable, wt = (t, r, a) => r in t ? zt(t, r, { enumerable: !0, configurable: !0, writable: !0, value: a }) : t[r] = a, Zt = (t, r) => {
56
+ for (var a in r || (r = {})) St.call(r, a) && wt(t, a, r[a]);
57
+ if (tt) for (var a of tt(r)) xt.call(r, a) && wt(t, a, r[a]);
58
+ return t;
59
+ }, Jt = (t, r) => Vt(t, qt(r)), Kt = (t, r) => {
60
+ var a = {};
61
+ for (var u in t) St.call(t, u) && r.indexOf(u) < 0 && (a[u] = t[u]);
62
+ if (t != null && tt) for (var u of tt(t)) r.indexOf(u) < 0 && xt.call(t, u) && (a[u] = t[u]);
63
+ return a;
25
64
  };
26
- function Qe(n) {
27
- let r = setTimeout(n, 0), l = setTimeout(n, 10), u = setTimeout(n, 50);
28
- return [r, l, u];
65
+ function Qt(t) {
66
+ let r = setTimeout(t, 0), a = setTimeout(t, 10), u = setTimeout(t, 50);
67
+ return [r, a, u];
29
68
  }
30
- function Ue(n) {
31
- let r = t.useRef();
32
- return t.useEffect(() => {
33
- r.current = n;
69
+ function Ut(t) {
70
+ let r = n.useRef();
71
+ return n.useEffect(() => {
72
+ r.current = t;
34
73
  }), r.current;
35
74
  }
36
- var Xe = 18, ye = 40, Ye = `${ye}px`, et = ["[data-lastpass-icon-root]", "com-1password-button", "[data-dashlanecreated]", '[style$="2147483647 !important;"]'].join(",");
37
- function tt({ containerRef: n, inputRef: r, pushPasswordManagerStrategy: l, isFocused: u }) {
38
- let [g, s] = t.useState(!1), [C, y] = t.useState(!1), [h, D] = t.useState(!1), I = t.useMemo(() => l === "none" ? !1 : (l === "increase-width" || l === "experimental-no-flickering") && g && C, [g, C, l]), M = t.useCallback(() => {
39
- let m = n.current, E = r.current;
40
- if (!m || !E || h || l === "none") return;
41
- let f = m, x = f.getBoundingClientRect().left + f.offsetWidth, T = f.getBoundingClientRect().top + f.offsetHeight / 2, o = x - Xe, L = T;
42
- document.querySelectorAll(et).length === 0 && document.elementFromPoint(o, L) === m || (s(!0), D(!0));
43
- }, [n, r, h, l]);
44
- return t.useEffect(() => {
45
- let m = n.current;
46
- if (!m || l === "none") return;
47
- function E() {
48
- let x = window.innerWidth - m.getBoundingClientRect().right;
49
- y(x >= ye);
75
+ var Xt = 18, Ct = 40, Yt = `${Ct}px`, te = ["[data-lastpass-icon-root]", "com-1password-button", "[data-dashlanecreated]", '[style$="2147483647 !important;"]'].join(",");
76
+ function ee({ containerRef: t, inputRef: r, pushPasswordManagerStrategy: a, isFocused: u }) {
77
+ let [h, s] = n.useState(!1), [w, d] = n.useState(!1), [R, S] = n.useState(!1), D = n.useMemo(() => a === "none" ? !1 : (a === "increase-width" || a === "experimental-no-flickering") && h && w, [h, w, a]), T = n.useCallback(() => {
78
+ let f = t.current, g = r.current;
79
+ if (!f || !g || R || a === "none") return;
80
+ let v = f, x = v.getBoundingClientRect().left + v.offsetWidth, O = v.getBoundingClientRect().top + v.offsetHeight / 2, l = x - Xt, W = O;
81
+ document.querySelectorAll(te).length === 0 && document.elementFromPoint(l, W) === f || (s(!0), S(!0));
82
+ }, [t, r, R, a]);
83
+ return n.useEffect(() => {
84
+ let f = t.current;
85
+ if (!f || a === "none") return;
86
+ function g() {
87
+ let x = window.innerWidth - f.getBoundingClientRect().right;
88
+ d(x >= Ct);
50
89
  }
51
- E();
52
- let f = setInterval(E, 1e3);
90
+ g();
91
+ let v = setInterval(g, 1e3);
53
92
  return () => {
54
- clearInterval(f);
93
+ clearInterval(v);
55
94
  };
56
- }, [n, l]), t.useEffect(() => {
57
- let m = u || document.activeElement === r.current;
58
- if (l === "none" || !m) return;
59
- let E = setTimeout(M, 0), f = setTimeout(M, 2e3), x = setTimeout(M, 5e3), T = setTimeout(() => {
60
- D(!0);
95
+ }, [t, a]), n.useEffect(() => {
96
+ let f = u || document.activeElement === r.current;
97
+ if (a === "none" || !f) return;
98
+ let g = setTimeout(T, 0), v = setTimeout(T, 2e3), x = setTimeout(T, 5e3), O = setTimeout(() => {
99
+ S(!0);
61
100
  }, 6e3);
62
101
  return () => {
63
- clearTimeout(E), clearTimeout(f), clearTimeout(x), clearTimeout(T);
102
+ clearTimeout(g), clearTimeout(v), clearTimeout(x), clearTimeout(O);
64
103
  };
65
- }, [r, u, l, M]), { hasPWMBadge: g, willPushPWMBadge: I, PWM_BADGE_SPACE_WIDTH: Ye };
104
+ }, [r, u, a, T]), { hasPWMBadge: h, willPushPWMBadge: D, PWM_BADGE_SPACE_WIDTH: Yt };
66
105
  }
67
- var xe = t.createContext({}), Se = t.forwardRef((n, r) => {
68
- var l = n, { value: u, onChange: g, maxLength: s, textAlign: C = "left", pattern: y, placeholder: h, inputMode: D = "numeric", onComplete: I, pushPasswordManagerStrategy: M = "increase-width", pasteTransformer: m, containerClassName: E, noScriptCSSFallback: f = nt, render: x, children: T } = l, o = Ke(l, ["value", "onChange", "maxLength", "textAlign", "pattern", "placeholder", "inputMode", "onComplete", "pushPasswordManagerStrategy", "pasteTransformer", "containerClassName", "noScriptCSSFallback", "render", "children"]), L, ne, re, ae, le;
69
- let [Te, Re] = t.useState(typeof o.defaultValue == "string" ? o.defaultValue : ""), c = u ?? Te, A = Ue(c), G = t.useCallback((e) => {
70
- g?.(e), Re(e);
71
- }, [g]), P = t.useMemo(() => y ? typeof y == "string" ? new RegExp(y) : y : null, [y]), p = t.useRef(null), U = t.useRef(null), X = t.useRef({ value: c, onChange: G, isIOS: typeof window < "u" && ((ne = (L = window?.CSS) == null ? void 0 : L.supports) == null ? void 0 : ne.call(L, "-webkit-touch-callout", "none")) }), Z = t.useRef({ prev: [(re = p.current) == null ? void 0 : re.selectionStart, (ae = p.current) == null ? void 0 : ae.selectionEnd, (le = p.current) == null ? void 0 : le.selectionDirection] });
72
- t.useImperativeHandle(r, () => p.current, []), t.useEffect(() => {
73
- let e = p.current, a = U.current;
74
- if (!e || !a) return;
75
- X.current.value !== e.value && X.current.onChange(e.value), Z.current.prev = [e.selectionStart, e.selectionEnd, e.selectionDirection];
76
- function d() {
106
+ var ne = n.createContext({}), Mt = n.forwardRef((t, r) => {
107
+ var a = t, { value: u, onChange: h, maxLength: s, textAlign: w = "left", pattern: d, placeholder: R, inputMode: S = "numeric", onComplete: D, pushPasswordManagerStrategy: T = "increase-width", pasteTransformer: f, containerClassName: g, noScriptCSSFallback: v = re, render: x, children: O } = a, l = Kt(a, ["value", "onChange", "maxLength", "textAlign", "pattern", "placeholder", "inputMode", "onComplete", "pushPasswordManagerStrategy", "pasteTransformer", "containerClassName", "noScriptCSSFallback", "render", "children"]), W, Q, U, B, I;
108
+ let [z, It] = n.useState(typeof l.defaultValue == "string" ? l.defaultValue : ""), c = u ?? z, F = Ut(c), V = n.useCallback((e) => {
109
+ h?.(e), It(e);
110
+ }, [h]), M = n.useMemo(() => d ? typeof d == "string" ? new RegExp(d) : d : null, [d]), p = n.useRef(null), nt = n.useRef(null), rt = n.useRef({ value: c, onChange: V, isIOS: typeof window < "u" && ((Q = (W = window?.CSS) == null ? void 0 : W.supports) == null ? void 0 : Q.call(W, "-webkit-touch-callout", "none")) }), X = n.useRef({ prev: [(U = p.current) == null ? void 0 : U.selectionStart, (B = p.current) == null ? void 0 : B.selectionEnd, (I = p.current) == null ? void 0 : I.selectionDirection] });
111
+ n.useImperativeHandle(r, () => p.current, []), n.useEffect(() => {
112
+ let e = p.current, o = nt.current;
113
+ if (!e || !o) return;
114
+ rt.current.value !== e.value && rt.current.onChange(e.value), X.current.prev = [e.selectionStart, e.selectionEnd, e.selectionDirection];
115
+ function m() {
77
116
  if (document.activeElement !== e) {
78
- z(null), V(null);
117
+ Z(null), J(null);
79
118
  return;
80
119
  }
81
- let i = e.selectionStart, v = e.selectionEnd, J = e.selectionDirection, S = e.maxLength, W = e.value, k = Z.current.prev, R = -1, O = -1, B;
82
- if (W.length !== 0 && i !== null && v !== null) {
83
- let Ae = i === v, Ne = i === W.length && W.length < S;
84
- if (Ae && !Ne) {
85
- let _ = i;
86
- if (_ === 0) R = 0, O = 1, B = "forward";
87
- else if (_ === S) R = _ - 1, O = _, B = "backward";
88
- else if (S > 1 && W.length > 1) {
89
- let te = 0;
120
+ let i = e.selectionStart, b = e.selectionEnd, Y = e.selectionDirection, C = e.maxLength, _ = e.value, k = X.current.prev, A = -1, j = -1, H;
121
+ if (_.length !== 0 && i !== null && b !== null) {
122
+ let Bt = i === b, Ft = i === _.length && _.length < C;
123
+ if (Bt && !Ft) {
124
+ let G = i;
125
+ if (G === 0) A = 0, j = 1, H = "forward";
126
+ else if (G === C) A = G - 1, j = G, H = "backward";
127
+ else if (C > 1 && _.length > 1) {
128
+ let lt = 0;
90
129
  if (k[0] !== null && k[1] !== null) {
91
- B = _ < k[1] ? "backward" : "forward";
92
- let We = k[0] === k[1] && k[0] < S;
93
- B === "backward" && !We && (te = -1);
130
+ H = G < k[1] ? "backward" : "forward";
131
+ let Nt = k[0] === k[1] && k[0] < C;
132
+ H === "backward" && !Nt && (lt = -1);
94
133
  }
95
- R = te + _, O = te + _ + 1;
134
+ A = lt + G, j = lt + G + 1;
96
135
  }
97
136
  }
98
- R !== -1 && O !== -1 && R !== O && p.current.setSelectionRange(R, O, B);
137
+ A !== -1 && j !== -1 && A !== j && p.current.setSelectionRange(A, j, H);
99
138
  }
100
- let de = R !== -1 ? R : i, me = O !== -1 ? O : v, Ie = B ?? J;
101
- z(de), V(me), Z.current.prev = [de, me, Ie];
139
+ let gt = A !== -1 ? A : i, bt = j !== -1 ? j : b, Wt = H ?? Y;
140
+ Z(gt), J(bt), X.current.prev = [gt, bt, Wt];
102
141
  }
103
- if (document.addEventListener("selectionchange", d, { capture: !0 }), d(), document.activeElement === e && Y(!0), !document.getElementById("input-otp-style")) {
142
+ if (document.addEventListener("selectionchange", m, { capture: !0 }), m(), document.activeElement === e && ot(!0), !document.getElementById("input-otp-style")) {
104
143
  let i = document.createElement("style");
105
144
  if (i.id = "input-otp-style", document.head.appendChild(i), i.sheet) {
106
- let v = "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;";
107
- q(i.sheet, "[data-input-otp]::selection { background: transparent !important; color: transparent !important; }"), q(i.sheet, `[data-input-otp]:autofill { ${v} }`), q(i.sheet, `[data-input-otp]:-webkit-autofill { ${v} }`), q(i.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(i.sheet, "[data-input-otp] + * { pointer-events: all !important; }");
145
+ let b = "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;";
146
+ K(i.sheet, "[data-input-otp]::selection { background: transparent !important; color: transparent !important; }"), K(i.sheet, `[data-input-otp]:autofill { ${b} }`), K(i.sheet, `[data-input-otp]:-webkit-autofill { ${b} }`), K(i.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; } }"), K(i.sheet, "[data-input-otp] + * { pointer-events: all !important; }");
108
147
  }
109
148
  }
110
- let b = () => {
111
- a && a.style.setProperty("--root-height", `${e.clientHeight}px`);
149
+ let y = () => {
150
+ o && o.style.setProperty("--root-height", `${e.clientHeight}px`);
112
151
  };
113
- b();
114
- let w = new ResizeObserver(b);
115
- return w.observe(e), () => {
116
- document.removeEventListener("selectionchange", d, { capture: !0 }), w.disconnect();
152
+ y();
153
+ let E = new ResizeObserver(y);
154
+ return E.observe(e), () => {
155
+ document.removeEventListener("selectionchange", m, { capture: !0 }), E.disconnect();
117
156
  };
118
157
  }, []);
119
- let [oe, ie] = t.useState(!1), [$, Y] = t.useState(!1), [N, z] = t.useState(null), [F, V] = t.useState(null);
120
- t.useEffect(() => {
121
- Qe(() => {
122
- var e, a, d, b;
158
+ let [pt, dt] = n.useState(!1), [q, ot] = n.useState(!1), [N, Z] = n.useState(null), [$, J] = n.useState(null);
159
+ n.useEffect(() => {
160
+ Qt(() => {
161
+ var e, o, m, y;
123
162
  (e = p.current) == null || e.dispatchEvent(new Event("input"));
124
- let w = (a = p.current) == null ? void 0 : a.selectionStart, i = (d = p.current) == null ? void 0 : d.selectionEnd, v = (b = p.current) == null ? void 0 : b.selectionDirection;
125
- w !== null && i !== null && (z(w), V(i), Z.current.prev = [w, i, v]);
163
+ let E = (o = p.current) == null ? void 0 : o.selectionStart, i = (m = p.current) == null ? void 0 : m.selectionEnd, b = (y = p.current) == null ? void 0 : y.selectionDirection;
164
+ E !== null && i !== null && (Z(E), J(i), X.current.prev = [E, i, b]);
126
165
  });
127
- }, [c, $]), t.useEffect(() => {
128
- A !== void 0 && c !== A && A.length < s && c.length === s && I?.(c);
129
- }, [s, I, A, c]);
130
- let H = tt({ containerRef: U, inputRef: p, pushPasswordManagerStrategy: M, isFocused: $ }), ue = t.useCallback((e) => {
131
- let a = e.currentTarget.value.slice(0, s);
132
- if (a.length > 0 && P && !P.test(a)) {
166
+ }, [c, q]), n.useEffect(() => {
167
+ F !== void 0 && c !== F && F.length < s && c.length === s && D?.(c);
168
+ }, [s, D, F, c]);
169
+ let L = ee({ containerRef: nt, inputRef: p, pushPasswordManagerStrategy: T, isFocused: q }), mt = n.useCallback((e) => {
170
+ let o = e.currentTarget.value.slice(0, s);
171
+ if (o.length > 0 && M && !M.test(o)) {
133
172
  e.preventDefault();
134
173
  return;
135
174
  }
136
- typeof A == "string" && a.length < A.length && document.dispatchEvent(new Event("selectionchange")), G(a);
137
- }, [s, G, A, P]), se = t.useCallback(() => {
175
+ typeof F == "string" && o.length < F.length && document.dispatchEvent(new Event("selectionchange")), V(o);
176
+ }, [s, V, F, M]), ft = n.useCallback(() => {
138
177
  var e;
139
178
  if (p.current) {
140
- let a = Math.min(p.current.value.length, s - 1), d = p.current.value.length;
141
- (e = p.current) == null || e.setSelectionRange(a, d), z(a), V(d);
179
+ let o = Math.min(p.current.value.length, s - 1), m = p.current.value.length;
180
+ (e = p.current) == null || e.setSelectionRange(o, m), Z(o), J(m);
142
181
  }
143
- Y(!0);
144
- }, [s]), ce = t.useCallback((e) => {
145
- var a, d;
146
- let b = p.current;
147
- if (!m && (!X.current.isIOS || !e.clipboardData || !b)) return;
148
- let w = e.clipboardData.getData("text/plain"), i = m ? m(w) : w;
182
+ ot(!0);
183
+ }, [s]), vt = n.useCallback((e) => {
184
+ var o, m;
185
+ let y = p.current;
186
+ if (!f && (!rt.current.isIOS || !e.clipboardData || !y)) return;
187
+ let E = e.clipboardData.getData("text/plain"), i = f ? f(E) : E;
149
188
  e.preventDefault();
150
- let v = (a = p.current) == null ? void 0 : a.selectionStart, J = (d = p.current) == null ? void 0 : d.selectionEnd, S = (v !== J ? c.slice(0, v) + i + c.slice(J) : c.slice(0, v) + i + c.slice(v)).slice(0, s);
151
- if (S.length > 0 && P && !P.test(S)) return;
152
- b.value = S, G(S);
153
- let W = Math.min(S.length, s - 1), k = S.length;
154
- b.setSelectionRange(W, k), z(W), V(k);
155
- }, [s, G, P, c]), Oe = t.useMemo(() => ({ position: "relative", cursor: o.disabled ? "default" : "text", userSelect: "none", WebkitUserSelect: "none", pointerEvents: "none" }), [o.disabled]), pe = 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: C, 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, C]), je = t.useMemo(() => t.createElement("input", Je(Ze({ autoComplete: o.autoComplete || "one-time-code" }, o), { "data-input-otp": !0, "data-input-otp-placeholder-shown": c.length === 0 || void 0, "data-input-otp-mss": N, "data-input-otp-mse": F, inputMode: D, pattern: P?.source, "aria-placeholder": h, style: pe, maxLength: s, value: c, ref: p, onPaste: (e) => {
156
- var a;
157
- ce(e), (a = o.onPaste) == null || a.call(o, e);
158
- }, onChange: ue, onMouseOver: (e) => {
159
- var a;
160
- ie(!0), (a = o.onMouseOver) == null || a.call(o, e);
189
+ let b = (o = p.current) == null ? void 0 : o.selectionStart, Y = (m = p.current) == null ? void 0 : m.selectionEnd, C = (b !== Y ? c.slice(0, b) + i + c.slice(Y) : c.slice(0, b) + i + c.slice(b)).slice(0, s);
190
+ if (C.length > 0 && M && !M.test(C)) return;
191
+ y.value = C, V(C);
192
+ let _ = Math.min(C.length, s - 1), k = C.length;
193
+ y.setSelectionRange(_, k), Z(_), J(k);
194
+ }, [s, V, M, c]), At = n.useMemo(() => ({ position: "relative", cursor: l.disabled ? "default" : "text", userSelect: "none", WebkitUserSelect: "none", pointerEvents: "none" }), [l.disabled]), ht = n.useMemo(() => ({ position: "absolute", inset: 0, width: L.willPushPWMBadge ? `calc(100% + ${L.PWM_BADGE_SPACE_WIDTH})` : "100%", clipPath: L.willPushPWMBadge ? `inset(0 ${L.PWM_BADGE_SPACE_WIDTH} 0 0)` : void 0, height: "100%", display: "flex", textAlign: w, 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" }), [L.PWM_BADGE_SPACE_WIDTH, L.willPushPWMBadge, w]), jt = n.useMemo(() => n.createElement("input", Jt(Zt({ autoComplete: l.autoComplete || "one-time-code" }, l), { "data-input-otp": !0, "data-input-otp-placeholder-shown": c.length === 0 || void 0, "data-input-otp-mss": N, "data-input-otp-mse": $, inputMode: S, pattern: M?.source, "aria-placeholder": R, style: ht, maxLength: s, value: c, ref: p, onPaste: (e) => {
195
+ var o;
196
+ vt(e), (o = l.onPaste) == null || o.call(l, e);
197
+ }, onChange: mt, onMouseOver: (e) => {
198
+ var o;
199
+ dt(!0), (o = l.onMouseOver) == null || o.call(l, e);
161
200
  }, onMouseLeave: (e) => {
162
- var a;
163
- ie(!1), (a = o.onMouseLeave) == null || a.call(o, e);
201
+ var o;
202
+ dt(!1), (o = l.onMouseLeave) == null || o.call(l, e);
164
203
  }, onFocus: (e) => {
165
- var a;
166
- se(), (a = o.onFocus) == null || a.call(o, e);
204
+ var o;
205
+ ft(), (o = l.onFocus) == null || o.call(l, e);
167
206
  }, onBlur: (e) => {
168
- var a;
169
- Y(!1), (a = o.onBlur) == null || a.call(o, e);
170
- } })), [ue, se, ce, D, pe, s, F, N, o, P?.source, c]), ee = t.useMemo(() => ({ slots: Array.from({ length: s }).map((e, a) => {
171
- var d;
172
- let b = $ && N !== null && F !== null && (N === F && a === N || a >= N && a < F), w = c[a] !== void 0 ? c[a] : null, i = c[0] !== void 0 ? null : (d = h?.[a]) != null ? d : null;
173
- return { char: w, placeholderChar: i, isActive: b, hasFakeCaret: b && w === null };
174
- }), isFocused: $, isHovering: !o.disabled && oe }), [$, oe, s, F, N, o.disabled, c]), De = t.useMemo(() => x ? x(ee) : t.createElement(xe.Provider, { value: ee }, T), [T, ee, x]);
175
- return t.createElement(t.Fragment, null, f !== null && t.createElement("noscript", null, t.createElement("style", null, f)), t.createElement("div", { ref: U, "data-input-otp-container": !0, style: Oe, className: E }, De, t.createElement("div", { style: { position: "absolute", inset: 0, pointerEvents: "none" } }, je)));
207
+ var o;
208
+ ot(!1), (o = l.onBlur) == null || o.call(l, e);
209
+ } })), [mt, ft, vt, S, ht, s, $, N, l, M?.source, c]), at = n.useMemo(() => ({ slots: Array.from({ length: s }).map((e, o) => {
210
+ var m;
211
+ let y = q && N !== null && $ !== null && (N === $ && o === N || o >= N && o < $), E = c[o] !== void 0 ? c[o] : null, i = c[0] !== void 0 ? null : (m = R?.[o]) != null ? m : null;
212
+ return { char: E, placeholderChar: i, isActive: y, hasFakeCaret: y && E === null };
213
+ }), isFocused: q, isHovering: !l.disabled && pt }), [q, pt, s, $, N, l.disabled, c]), Dt = n.useMemo(() => x ? x(at) : n.createElement(ne.Provider, { value: at }, O), [O, at, x]);
214
+ return n.createElement(n.Fragment, null, v !== null && n.createElement("noscript", null, n.createElement("style", null, v)), n.createElement("div", { ref: nt, "data-input-otp-container": !0, style: At, className: g }, Dt, n.createElement("div", { style: { position: "absolute", inset: 0, pointerEvents: "none" } }, jt)));
176
215
  });
177
- Se.displayName = "Input";
178
- function q(n, r) {
216
+ Mt.displayName = "Input";
217
+ function K(t, r) {
179
218
  try {
180
- n.insertRule(r);
219
+ t.insertRule(r);
181
220
  } catch {
182
221
  console.error("input-otp could not insert CSS rule:", r);
183
222
  }
184
223
  }
185
- var nt = `
224
+ var re = `
186
225
  [data-input-otp] {
187
226
  --nojs-bg: white !important;
188
227
  --nojs-fg: black !important;
@@ -202,101 +241,127 @@ var nt = `
202
241
  --nojs-fg: white !important;
203
242
  }
204
243
  }`;
205
- const Ee = He({}), Pe = Q(
244
+ const kt = Et({}), Rt = Et(null), Tt = () => {
245
+ const t = Pt(Rt);
246
+ if (!t)
247
+ throw new Error("useRoot must be used within an InputOTP");
248
+ return t;
249
+ }, Ot = et(
206
250
  ({
207
- className: n,
251
+ autoFocus: t = !1,
208
252
  children: r,
209
- id: l,
210
- name: u,
211
- errorMessage: g,
212
- hasError: s,
213
- inputMode: C = "numeric",
214
- onComplete: y,
215
- onChange: h,
216
- value: D,
217
- autoFocus: I = !1,
218
- maxLength: M,
219
- ...m
220
- }, E) => {
221
- const f = Be(l, u), x = (T) => {
222
- const o = T.clipboardData.getData("text/plain").trim();
223
- o.length === M && typeof h == "function" && (h(""), setTimeout(() => {
224
- typeof h == "function" && h(o);
253
+ className: a,
254
+ errorMessage: u,
255
+ hasError: h,
256
+ id: s,
257
+ inputMode: w = "numeric",
258
+ maxLength: d,
259
+ name: R,
260
+ onChange: S,
261
+ onComplete: D,
262
+ value: T,
263
+ variant: f = "outlined",
264
+ groupSize: g,
265
+ separatorPositions: v,
266
+ ...x
267
+ }, O) => {
268
+ const l = Ht(s, R), W = (B) => {
269
+ const I = B.clipboardData.getData("text/plain").trim();
270
+ I.length === d && typeof S == "function" && (S(""), setTimeout(() => {
271
+ typeof S == "function" && S(I);
225
272
  }, 0));
226
- };
227
- return /* @__PURE__ */ j(Ee.Provider, { value: { hasError: s }, children: /* @__PURE__ */ ge("div", { className: "flex w-max flex-col gap-y-1", children: [
228
- /* @__PURE__ */ j(
229
- Se,
273
+ }, Q = v ?? (g ? Array.from({ length: Math.ceil(d / g) - 1 }, (B, I) => (I + 1) * g) : []), U = g !== void 0 || v !== void 0;
274
+ return /* @__PURE__ */ P(kt.Provider, { value: { hasError: h }, children: /* @__PURE__ */ it("div", { className: "flex w-max flex-col gap-y-1", children: [
275
+ /* @__PURE__ */ P(
276
+ Mt,
230
277
  {
231
- ref: E,
232
- value: D,
233
- onChange: h,
234
- onComplete: y,
235
- containerClassName: he(
278
+ autoFocus: t,
279
+ containerClassName: yt(
236
280
  "flex items-center gap-2 has-[:disabled]:opacity-50 disabled:cursor-not-allowed",
237
- n
281
+ a
238
282
  ),
239
- maxLength: M,
240
- autoFocus: I,
241
- id: f,
242
- inputMode: C,
243
- textAlign: "center",
244
- onPaste: x,
245
- ...m,
246
- "data-testid": "input-otp",
247
- pushPasswordManagerStrategy: "none",
248
283
  "data-1p-ignore": "true",
284
+ "data-dashlane-disabled-on-field": "true",
249
285
  "data-lpignore": "true",
250
286
  "data-protonpass-ignore": "true",
251
- "data-dashlane-disabled-on-field": "true",
252
- children: r
287
+ "data-testid": "input-otp",
288
+ id: l,
289
+ inputMode: w,
290
+ maxLength: d,
291
+ onChange: S,
292
+ onComplete: D,
293
+ onPaste: W,
294
+ pushPasswordManagerStrategy: "none",
295
+ ref: O,
296
+ textAlign: "center",
297
+ value: T,
298
+ ...x,
299
+ render: ({ slots: B }) => /* @__PURE__ */ P(Rt.Provider, { value: { slots: B, variant: f }, children: U ? /* @__PURE__ */ P(ut, { children: [...Array(d)].map((I, z) => /* @__PURE__ */ it(Lt, { children: [
300
+ Q.includes(z) && /* @__PURE__ */ P(ct, {}),
301
+ /* @__PURE__ */ P(st, { index: z })
302
+ ] }, z)) }) : r })
253
303
  }
254
304
  ),
255
- s && g && /* @__PURE__ */ j(_e, { id: Fe(f), message: g })
305
+ h && u && /* @__PURE__ */ P(Gt, { id: $t(l), message: u })
256
306
  ] }) });
257
307
  }
258
308
  );
259
- Pe.displayName = "InputOTP";
260
- const Ce = Q(({ ...n }, r) => /* @__PURE__ */ j(
309
+ Ot.displayName = "InputOTP";
310
+ const ut = et(({ ...t }, r) => /* @__PURE__ */ P(
261
311
  "div",
262
312
  {
263
313
  ref: r,
264
- className: "flex items-center justify-between gap-x-2 min-[390px]:gap-x-3 md:justify-center md:gap-x-4",
265
- ...n,
314
+ className: "flex items-center justify-between justify-center gap-x-2",
315
+ ...t,
266
316
  "data-testid": "input-otp-group"
267
317
  }
268
318
  ));
269
- Ce.displayName = "InputOTP.Group";
270
- const Me = Q(
271
- ({ index: n, ...r }, l) => {
272
- const { slots: u } = fe(xe), { hasError: g } = fe(Ee), { char: s, hasFakeCaret: C, isActive: y } = u[n];
273
- return /* @__PURE__ */ ge(
319
+ ut.displayName = "InputOTP.Group";
320
+ const st = et(
321
+ ({ index: t, className: r, ...a }, u) => {
322
+ const { variant: h = "outlined", slots: s = [] } = Tt(), { hasError: w } = Pt(kt), d = s[t] || { char: "", hasFakeCaret: !0, isActive: !1 };
323
+ return /* @__PURE__ */ it(
274
324
  "div",
275
325
  {
276
- ref: l,
277
- className: he(
278
- "relative z-10 flex h-10 w-10 items-center justify-center rounded-[8px] text-sm transition duration-200 focus:outline-none",
279
- y && "outline-input-border--focus outline-2 outline-offset-2",
280
- g && "border-danger-400 focus-visible:outline-danger-400 border-2"
326
+ ref: u,
327
+ className: yt(
328
+ "relative z-10 flex h-12 w-10 items-center justify-center rounded-[8px] border-1 transition duration-200 focus:outline-none focus-visible:outline-2 focus-visible:outline-offset-2",
329
+ h === "filled" ? "bg-level-one border-level-one" : "border-input-otp-border bg-transparent",
330
+ !w && "border",
331
+ w && "border-danger-400 focus-visible:outline-danger-400 border-2",
332
+ d.isActive && !w && "outline-input-otp-border--focus z-10 outline-2 outline-offset-2",
333
+ d.isActive && w && "outline-danger-400 outline-2 outline-offset-2",
334
+ r
281
335
  ),
282
- ...r,
336
+ "data-index": t,
283
337
  "data-testid": "input-otp-slot",
338
+ "data-variant": h,
339
+ ...a,
284
340
  children: [
285
- s,
286
- C && /* @__PURE__ */ j("div", { className: "animate-caret-blink pointer-events-none absolute inset-0 flex items-center justify-center", children: /* @__PURE__ */ j("div", { className: "bg-concrete h-8 w-px" }) })
341
+ d.char,
342
+ d.hasFakeCaret && /* @__PURE__ */ P("div", { className: "animate-caret-blink pointer-events-none absolute inset-0 flex items-center justify-center", children: /* @__PURE__ */ P("div", { className: "bg-input-otp-caret h-8 w-px" }) })
287
343
  ]
288
344
  }
289
345
  );
290
346
  }
291
347
  );
292
- Me.displayName = "InputOTP.Slot";
293
- const ke = Q(({ ...n }, r) => /* @__PURE__ */ j("div", { ref: r, role: "separator", ...n, "data-testid": "input-otp-separator", children: /* @__PURE__ */ j($e, { className: "text-input-text-placeholder" }) }));
294
- ke.displayName = "InputOTP.Separator";
295
- const ut = Object.assign(Pe, {
296
- Group: Ce,
297
- Slot: Me,
298
- Separator: ke
348
+ st.displayName = "InputOTP.Slot";
349
+ const ct = et(({ ...t }, r) => {
350
+ const { variant: a = "outlined" } = Tt();
351
+ return /* @__PURE__ */ P("div", { ref: r, role: "separator", ...t, "data-testid": "input-otp-separator", "data-variant": a, children: /* @__PURE__ */ P(
352
+ _t,
353
+ {
354
+ size: 24,
355
+ color: a === "filled" ? "var(--color-input-otp-filled-separator)" : "var(--color-input-otp-border)"
356
+ }
357
+ ) });
358
+ });
359
+ ct.displayName = "InputOTP.Separator";
360
+ const en = Object.assign(Ot, {
361
+ Group: ut,
362
+ Slot: st,
363
+ Separator: ct
299
364
  });
300
365
  export {
301
- ut as InputOTP
366
+ en as InputOTP
302
367
  };
@@ -1 +1 @@
1
- {"version":3,"file":"DashboardIcon.d.ts","sourceRoot":"","sources":["../../../src/components/Icons/DashboardIcon.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAiD5C,eAAO,MAAM,aAAa,qGAA4B,CAAA"}
1
+ {"version":3,"file":"DashboardIcon.d.ts","sourceRoot":"","sources":["../../../src/components/Icons/DashboardIcon.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AA0C5C,eAAO,MAAM,aAAa,qGAA4B,CAAA"}
@@ -1,9 +1,12 @@
1
1
  import { OTPInputProps } from 'input-otp';
2
2
  type InputOTPRootProps = Omit<OTPInputProps, 'textAlign' | 'pushPasswordManagerStrategy' | 'pasteTransformer' | 'noScriptCSSFallback' | 'placeholder' | 'containerClassName' | 'render'> & {
3
- onComplete?: (...args: any[]) => void;
3
+ onComplete?: (...args: unknown[]) => void;
4
4
  inputMode?: 'numeric' | 'text' | 'decimal' | 'tel' | 'search' | 'email' | 'url';
5
5
  className?: string;
6
6
  separator?: boolean;
7
+ variant?: 'outlined' | 'filled';
8
+ groupSize?: number;
9
+ separatorPositions?: number[];
7
10
  };
8
11
  export type InputOTPProps = InputOTPRootProps & ({
9
12
  value: number | string;
@@ -1 +1 @@
1
- {"version":3,"file":"InputOTP.d.ts","sourceRoot":"","sources":["../../../src/components/InputOTP/InputOTP.tsx"],"names":[],"mappings":"AAEA,OAAO,EAA6B,KAAK,aAAa,EAAE,MAAM,WAAW,CAAA;AAWzE,KAAK,iBAAiB,GAAG,IAAI,CAC3B,aAAa,EACX,WAAW,GACX,6BAA6B,GAC7B,kBAAkB,GAClB,qBAAqB,GACrB,aAAa,GACb,oBAAoB,GACpB,QAAQ,CACX,GAAG;IACF,UAAU,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,IAAI,CAAA;IACrC,SAAS,CAAC,EAAE,SAAS,GAAG,MAAM,GAAG,SAAS,GAAG,KAAK,GAAG,QAAQ,GAAG,OAAO,GAAG,KAAK,CAAA;IAC/E,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,SAAS,CAAC,EAAE,OAAO,CAAA;CACpB,CAAA;AAED,MAAM,MAAM,aAAa,GAAG,iBAAiB,GAC3C,CAAC;IAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;IAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,KAAK,IAAI,CAAA;CAAE,GAAG;IAAE,KAAK,CAAC,EAAE,KAAK,CAAC;IAAC,QAAQ,CAAC,EAAE,KAAK,CAAA;CAAE,CAAC,GACjH,CAAC;IAAE,QAAQ,EAAE,IAAI,CAAC;IAAC,YAAY,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,GAAG;IAAE,QAAQ,CAAC,EAAE,KAAK,CAAC;IAAC,YAAY,CAAC,EAAE,KAAK,CAAA;CAAE,CAAC,CAAA;AA4HrG,eAAO,MAAM,QAAQ;;;eApCmE,MAAM;;;CAwC5F,CAAA"}
1
+ {"version":3,"file":"InputOTP.d.ts","sourceRoot":"","sources":["../../../src/components/InputOTP/InputOTP.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAY,KAAK,aAAa,EAAE,MAAM,WAAW,CAAA;AAWxD,KAAK,iBAAiB,GAAG,IAAI,CAC3B,aAAa,EACX,WAAW,GACX,6BAA6B,GAC7B,kBAAkB,GAClB,qBAAqB,GACrB,aAAa,GACb,oBAAoB,GACpB,QAAQ,CACX,GAAG;IACF,UAAU,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,CAAA;IACzC,SAAS,CAAC,EAAE,SAAS,GAAG,MAAM,GAAG,SAAS,GAAG,KAAK,GAAG,QAAQ,GAAG,OAAO,GAAG,KAAK,CAAA;IAC/E,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,OAAO,CAAC,EAAE,UAAU,GAAG,QAAQ,CAAA;IAC/B,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,kBAAkB,CAAC,EAAE,MAAM,EAAE,CAAA;CAC9B,CAAA;AAED,MAAM,MAAM,aAAa,GAAG,iBAAiB,GAC3C,CAAC;IAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;IAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,KAAK,IAAI,CAAA;CAAE,GAAG;IAAE,KAAK,CAAC,EAAE,KAAK,CAAC;IAAC,QAAQ,CAAC,EAAE,KAAK,CAAA;CAAE,CAAC,GACjH,CAAC;IAAE,QAAQ,EAAE,IAAI,CAAC;IAAC,YAAY,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,GAAG;IAAE,QAAQ,CAAC,EAAE,KAAK,CAAC;IAAC,YAAY,CAAC,EAAE,KAAK,CAAA;CAAE,CAAC,CAAA;AAiLrG,eAAO,MAAM,QAAQ;;;eAjDmE,MAAM;;;CAqD5F,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"LabelingTools.d.ts","sourceRoot":"","sources":["../../../src/features/LabelingTools/LabelingTools.tsx"],"names":[],"mappings":"AAiBA,eAAO,MAAM,aAAa,+CAwJzB,CAAA"}
1
+ {"version":3,"file":"LabelingTools.d.ts","sourceRoot":"","sources":["../../../src/features/LabelingTools/LabelingTools.tsx"],"names":[],"mappings":"AAgBA,eAAO,MAAM,aAAa,+CA8IzB,CAAA"}