docthub-core-components 3.3.8 → 3.3.9

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.
@@ -5,97 +5,97 @@ import { useRef as _, useId as G, useLayoutEffect as tt } from "react";
5
5
  import { Input as et } from "../../../ui/input.js";
6
6
  import { Label as rt } from "../../../ui/label.js";
7
7
  import { cn as Y } from "../../../../lib/utils.js";
8
- const ft = (k) => {
8
+ const ut = (N) => {
9
9
  const t = x(46), {
10
10
  length: H,
11
- label: i,
11
+ label: f,
12
12
  value: d,
13
13
  onChange: j,
14
14
  onComplete: g,
15
15
  className: C,
16
- error: c,
16
+ error: n,
17
17
  inputClassName: J,
18
18
  autoFocus: Q,
19
19
  autoSubmit: U,
20
20
  secure: V
21
- } = k, o = H === void 0 ? 6 : H, K = J === void 0 ? "h-10 w-10" : J, q = Q === void 0 ? !1 : Q, L = U === void 0 ? !1 : U, E = V === void 0 ? !1 : V;
21
+ } = N, o = H === void 0 ? 6 : H, K = J === void 0 ? "h-10 w-10" : J, q = Q === void 0 ? !1 : Q, L = U === void 0 ? !1 : U, E = V === void 0 ? !1 : V;
22
22
  let M;
23
23
  t[0] === Symbol.for("react.memo_cache_sentinel") ? (M = [], t[0] = M) : M = t[0];
24
24
  const a = _(M), h = G(), v = G(), S = G();
25
25
  let O;
26
26
  if (t[1] !== o || t[2] !== S) {
27
- let n;
28
- t[4] !== S ? (n = (W, z) => `${S}-digit-${z + 1}`, t[4] = S, t[5] = n) : n = t[5], O = Array.from({
27
+ let i;
28
+ t[4] !== S ? (i = (W, z) => `${S}-digit-${z + 1}`, t[4] = S, t[5] = i) : i = t[5], O = Array.from({
29
29
  length: o
30
- }, n), t[1] = o, t[2] = S, t[3] = O;
30
+ }, i), t[1] = o, t[2] = S, t[3] = O;
31
31
  } else
32
32
  O = t[3];
33
33
  const T = O;
34
34
  let A, P;
35
35
  t[6] !== q ? (A = () => {
36
- var n;
37
- q && ((n = a.current[0]) == null || n.focus({
36
+ var i;
37
+ q && ((i = a.current[0]) == null || i.focus({
38
38
  preventScroll: !0
39
39
  }));
40
40
  }, P = [q], t[6] = q, t[7] = A, t[8] = P) : (A = t[7], P = t[8]), tt(A, P);
41
- let b, y, D, I, u, f;
42
- if (t[9] !== L || t[10] !== C || t[11] !== c || t[12] !== v || t[13] !== K || t[14] !== i || t[15] !== h || t[16] !== o || t[17] !== j || t[18] !== g || t[19] !== T || t[20] !== E || t[21] !== d) {
43
- const n = (e, s) => {
44
- var l;
45
- const m = s.replace(/\D/g, "").slice(0, 1);
46
- if (s.length > 1 && m.length <= 1)
41
+ let b, y, D, I, u, m;
42
+ if (t[9] !== L || t[10] !== C || t[11] !== n || t[12] !== v || t[13] !== K || t[14] !== f || t[15] !== h || t[16] !== o || t[17] !== j || t[18] !== g || t[19] !== T || t[20] !== E || t[21] !== d) {
43
+ const i = (r, e) => {
44
+ var c;
45
+ const l = e.replace(/\D/g, "").slice(0, 1);
46
+ if (e && !l || e.length > 1 && l.length <= 1)
47
47
  return;
48
- const r = [...d];
49
- r[e] = m, j(r), s && e < o - 1 && ((l = a.current[e + 1]) == null || l.focus()), r.every(st) && (g && g(r.join("")), L && queueMicrotask(() => {
48
+ const s = [...d];
49
+ s[r] = l, j(s), l && r < o - 1 && ((c = a.current[r + 1]) == null || c.focus()), s.every(st) && (g && g(s.join("")), L && queueMicrotask(() => {
50
50
  var $;
51
- const B = ($ = a.current[e]) == null ? void 0 : $.closest("form");
51
+ const B = ($ = a.current[r]) == null ? void 0 : $.closest("form");
52
52
  B && B.requestSubmit();
53
53
  }));
54
- }, W = (e, s) => {
54
+ }, W = (r, e) => {
55
55
  var $;
56
- s.preventDefault();
57
- const r = (s.clipboardData.getData("text") || "").replace(/\D/g, "").slice(0, o - e).split("");
58
- if (r.length === 0)
56
+ e.preventDefault();
57
+ const s = (e.clipboardData.getData("text") || "").replace(/\D/g, "").slice(0, o - r).split("");
58
+ if (s.length === 0)
59
59
  return;
60
- const l = [...d];
61
- for (let p = 0; p < r.length && e + p < o; p++)
62
- l[e + p] = r[p];
63
- j(l);
64
- const B = Math.min(e + r.length, o - 1);
65
- ($ = a.current[B]) == null || $.focus(), l.every(ot) && (g && g(l.join("")), L && queueMicrotask(() => {
60
+ const c = [...d];
61
+ for (let p = 0; p < s.length && r + p < o; p++)
62
+ c[r + p] = s[p];
63
+ j(c);
64
+ const B = Math.min(r + s.length, o - 1);
65
+ ($ = a.current[B]) == null || $.focus(), c.every(ot) && (g && g(c.join("")), L && queueMicrotask(() => {
66
66
  var X;
67
- const p = (X = a.current[e]) == null ? void 0 : X.closest("form");
67
+ const p = (X = a.current[r]) == null ? void 0 : X.closest("form");
68
68
  p && p.requestSubmit();
69
69
  }));
70
- }, z = (e, s) => {
71
- var m, r, l;
72
- s.key === "Backspace" && !d[e] && e > 0 ? (m = a.current[e - 1]) == null || m.focus() : s.key === "ArrowLeft" && e > 0 ? (s.preventDefault(), (r = a.current[e - 1]) == null || r.focus()) : s.key === "ArrowRight" && e < o - 1 && (s.preventDefault(), (l = a.current[e + 1]) == null || l.focus());
70
+ }, z = (r, e) => {
71
+ var l, s, c;
72
+ e.key.length === 1 && !/\d/.test(e.key) ? e.preventDefault() : e.key === "Backspace" && !d[r] && r > 0 ? (l = a.current[r - 1]) == null || l.focus() : e.key === "ArrowLeft" && r > 0 ? (e.preventDefault(), (s = a.current[r - 1]) == null || s.focus()) : e.key === "ArrowRight" && r < o - 1 && (e.preventDefault(), (c = a.current[r + 1]) == null || c.focus());
73
73
  };
74
- t[28] !== C ? (u = Y("space-y-2", C), t[28] = C, t[29] = u) : u = t[29], t[30] !== i || t[31] !== h ? (f = i && /* @__PURE__ */ F(rt, { id: h, className: "text-sm font-medium text-gray-700", children: i }), t[30] = i, t[31] = h, t[32] = f) : f = t[32], b = "flex gap-2 border-0 p-0 m-0", y = i ? h : void 0, D = c ? v : void 0, I = T.map((e, s) => {
75
- const m = d[s] ?? "";
76
- return /* @__PURE__ */ F(et, { ref: (r) => {
77
- a.current[s] = r;
78
- }, type: E ? "password" : "text", inputMode: "numeric", maxLength: 1, value: m, onChange: (r) => n(s, r.target.value), onKeyDown: (r) => z(s, r), onPaste: (r) => W(s, r), className: Y("text-center p-0 text-lg font-semibold", c && "border-destructive", K), "aria-label": `${i || "OTP"} digit ${s + 1} of ${o}`, "aria-invalid": c ? "true" : "false" }, e);
79
- }), t[9] = L, t[10] = C, t[11] = c, t[12] = v, t[13] = K, t[14] = i, t[15] = h, t[16] = o, t[17] = j, t[18] = g, t[19] = T, t[20] = E, t[21] = d, t[22] = b, t[23] = y, t[24] = D, t[25] = I, t[26] = u, t[27] = f;
74
+ t[28] !== C ? (u = Y("space-y-2", C), t[28] = C, t[29] = u) : u = t[29], t[30] !== f || t[31] !== h ? (m = f && /* @__PURE__ */ F(rt, { id: h, className: "text-sm font-medium text-gray-700", children: f }), t[30] = f, t[31] = h, t[32] = m) : m = t[32], b = "flex gap-2 border-0 p-0 m-0", y = f ? h : void 0, D = n ? v : void 0, I = T.map((r, e) => {
75
+ const l = d[e] ?? "";
76
+ return /* @__PURE__ */ F(et, { ref: (s) => {
77
+ a.current[e] = s;
78
+ }, type: E ? "password" : "text", inputMode: "numeric", maxLength: 1, value: l, onChange: (s) => i(e, s.target.value), onKeyDown: (s) => z(e, s), onPaste: (s) => W(e, s), className: Y("text-center p-0 text-lg font-semibold", n && "border-destructive", K), "aria-label": `${f || "OTP"} digit ${e + 1} of ${o}`, "aria-invalid": n ? "true" : "false" }, r);
79
+ }), t[9] = L, t[10] = C, t[11] = n, t[12] = v, t[13] = K, t[14] = f, t[15] = h, t[16] = o, t[17] = j, t[18] = g, t[19] = T, t[20] = E, t[21] = d, t[22] = b, t[23] = y, t[24] = D, t[25] = I, t[26] = u, t[27] = m;
80
80
  } else
81
- b = t[22], y = t[23], D = t[24], I = t[25], u = t[26], f = t[27];
81
+ b = t[22], y = t[23], D = t[24], I = t[25], u = t[26], m = t[27];
82
+ let k;
83
+ t[33] !== b || t[34] !== y || t[35] !== D || t[36] !== I ? (k = /* @__PURE__ */ F("fieldset", { className: b, "aria-labelledby": y, "aria-describedby": D, children: I }), t[33] = b, t[34] = y, t[35] = D, t[36] = I, t[37] = k) : k = t[37];
82
84
  let w;
83
- t[33] !== b || t[34] !== y || t[35] !== D || t[36] !== I ? (w = /* @__PURE__ */ F("fieldset", { className: b, "aria-labelledby": y, "aria-describedby": D, children: I }), t[33] = b, t[34] = y, t[35] = D, t[36] = I, t[37] = w) : w = t[37];
84
- let N;
85
- t[38] !== c || t[39] !== v ? (N = c && /* @__PURE__ */ F("p", { id: v, className: "text-xs text-destructive mt-1", role: "alert", children: c }), t[38] = c, t[39] = v, t[40] = N) : N = t[40];
85
+ t[38] !== n || t[39] !== v ? (w = n && /* @__PURE__ */ F("p", { id: v, className: "text-xs text-destructive mt-1", role: "alert", children: n }), t[38] = n, t[39] = v, t[40] = w) : w = t[40];
86
86
  let R;
87
- return t[41] !== u || t[42] !== f || t[43] !== w || t[44] !== N ? (R = /* @__PURE__ */ Z("div", { className: u, children: [
88
- f,
89
- w,
90
- N
91
- ] }), t[41] = u, t[42] = f, t[43] = w, t[44] = N, t[45] = R) : R = t[45], R;
87
+ return t[41] !== u || t[42] !== m || t[43] !== k || t[44] !== w ? (R = /* @__PURE__ */ Z("div", { className: u, children: [
88
+ m,
89
+ k,
90
+ w
91
+ ] }), t[41] = u, t[42] = m, t[43] = k, t[44] = w, t[45] = R) : R = t[45], R;
92
92
  };
93
- function st(k) {
94
- return k !== "";
93
+ function st(N) {
94
+ return N !== "";
95
95
  }
96
- function ot(k) {
97
- return k !== "";
96
+ function ot(N) {
97
+ return N !== "";
98
98
  }
99
99
  export {
100
- ft as OtpInput
100
+ ut as OtpInput
101
101
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "docthub-core-components",
3
- "version": "3.3.8",
3
+ "version": "3.3.9",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",