docthub-core-components 3.3.9 → 3.3.11

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.
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- import { jsx as F, jsxs as Z } from "react/jsx-runtime";
2
+ import { jsx as B, jsxs as Z } from "react/jsx-runtime";
3
3
  import { c as x } from "react-compiler-runtime";
4
4
  import { useRef as _, useId as G, useLayoutEffect as tt } from "react";
5
5
  import { Input as et } from "../../../ui/input.js";
@@ -10,46 +10,46 @@ const ut = (N) => {
10
10
  length: H,
11
11
  label: f,
12
12
  value: d,
13
- onChange: j,
13
+ onChange: K,
14
14
  onComplete: g,
15
15
  className: C,
16
- error: n,
16
+ error: a,
17
17
  inputClassName: J,
18
18
  autoFocus: Q,
19
19
  autoSubmit: U,
20
20
  secure: 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;
21
+ } = N, o = H === void 0 ? 6 : H, F = J === void 0 ? "h-10 w-10" : J, j = Q === void 0 ? !1 : Q, q = U === void 0 ? !1 : U, E = V === void 0 ? !1 : V;
22
+ let L;
23
+ t[0] === Symbol.for("react.memo_cache_sentinel") ? (L = [], t[0] = L) : L = t[0];
24
+ const n = _(L), h = G(), y = G(), S = G();
22
25
  let M;
23
- t[0] === Symbol.for("react.memo_cache_sentinel") ? (M = [], t[0] = M) : M = t[0];
24
- const a = _(M), h = G(), v = G(), S = G();
25
- let O;
26
26
  if (t[1] !== o || t[2] !== S) {
27
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({
28
+ t[4] !== S ? (i = (W, z) => `${S}-digit-${z + 1}`, t[4] = S, t[5] = i) : i = t[5], M = Array.from({
29
29
  length: o
30
- }, i), t[1] = o, t[2] = S, t[3] = O;
30
+ }, i), t[1] = o, t[2] = S, t[3] = M;
31
31
  } else
32
- O = t[3];
33
- const T = O;
34
- let A, P;
35
- t[6] !== q ? (A = () => {
32
+ M = t[3];
33
+ const T = M;
34
+ let O, A;
35
+ t[6] !== j ? (O = () => {
36
36
  var i;
37
- q && ((i = a.current[0]) == null || i.focus({
37
+ j && ((i = n.current[0]) == null || i.focus({
38
38
  preventScroll: !0
39
39
  }));
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, 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) {
40
+ }, A = [j], t[6] = j, t[7] = O, t[8] = A) : (O = t[7], A = t[8]), tt(O, A);
41
+ let v, b, D, I, u, m;
42
+ if (t[9] !== q || t[10] !== C || t[11] !== a || t[12] !== y || t[13] !== F || t[14] !== f || t[15] !== h || t[16] !== o || t[17] !== K || t[18] !== g || t[19] !== T || t[20] !== E || t[21] !== d) {
43
43
  const i = (r, e) => {
44
44
  var c;
45
45
  const l = e.replace(/\D/g, "").slice(0, 1);
46
46
  if (e && !l || e.length > 1 && l.length <= 1)
47
47
  return;
48
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(() => {
49
+ s[r] = l, K(s), l && r < o - 1 && ((c = n.current[r + 1]) == null || c.focus()), s.every(st) && (g && g(s.join("")), q && queueMicrotask(() => {
50
50
  var $;
51
- const B = ($ = a.current[r]) == null ? void 0 : $.closest("form");
52
- B && B.requestSubmit();
51
+ const R = ($ = n.current[r]) == null ? void 0 : $.closest("form");
52
+ R && R.requestSubmit();
53
53
  }));
54
54
  }, W = (r, e) => {
55
55
  var $;
@@ -60,35 +60,35 @@ const ut = (N) => {
60
60
  const c = [...d];
61
61
  for (let p = 0; p < s.length && r + p < o; p++)
62
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(() => {
63
+ K(c);
64
+ const R = Math.min(r + s.length, o - 1);
65
+ ($ = n.current[R]) == null || $.focus(), c.every(ot) && (g && g(c.join("")), q && queueMicrotask(() => {
66
66
  var X;
67
- const p = (X = a.current[r]) == null ? void 0 : X.closest("form");
67
+ const p = (X = n.current[r]) == null ? void 0 : X.closest("form");
68
68
  p && p.requestSubmit();
69
69
  }));
70
70
  }, z = (r, e) => {
71
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());
72
+ !e.ctrlKey && !e.metaKey && !e.altKey && e.key.length === 1 && !/\d/.test(e.key) ? e.preventDefault() : e.key === "Backspace" && !d[r] && r > 0 ? (l = n.current[r - 1]) == null || l.focus() : e.key === "ArrowLeft" && r > 0 ? (e.preventDefault(), (s = n.current[r - 1]) == null || s.focus()) : e.key === "ArrowRight" && r < o - 1 && (e.preventDefault(), (c = n.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] !== 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) => {
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__ */ B(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], v = "flex gap-2 border-0 p-0 m-0", b = f ? h : void 0, D = a ? y : void 0, I = T.map((r, e) => {
75
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;
76
+ return /* @__PURE__ */ B(et, { ref: (s) => {
77
+ n.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", a && "border-destructive", F), "aria-label": `${f || "OTP"} digit ${e + 1} of ${o}`, "aria-invalid": a ? "true" : "false" }, r);
79
+ }), t[9] = q, t[10] = C, t[11] = a, t[12] = y, t[13] = F, t[14] = f, t[15] = h, t[16] = o, t[17] = K, t[18] = g, t[19] = T, t[20] = E, t[21] = d, t[22] = v, t[23] = b, 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], m = t[27];
81
+ v = t[22], b = t[23], D = t[24], I = t[25], u = t[26], m = t[27];
82
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];
83
+ t[33] !== v || t[34] !== b || t[35] !== D || t[36] !== I ? (k = /* @__PURE__ */ B("fieldset", { className: v, "aria-labelledby": b, "aria-describedby": D, children: I }), t[33] = v, t[34] = b, t[35] = D, t[36] = I, t[37] = k) : k = t[37];
84
84
  let w;
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
- let R;
87
- return t[41] !== u || t[42] !== m || t[43] !== k || t[44] !== w ? (R = /* @__PURE__ */ Z("div", { className: u, children: [
85
+ t[38] !== a || t[39] !== y ? (w = a && /* @__PURE__ */ B("p", { id: y, className: "text-xs text-destructive mt-1", role: "alert", children: a }), t[38] = a, t[39] = y, t[40] = w) : w = t[40];
86
+ let P;
87
+ return t[41] !== u || t[42] !== m || t[43] !== k || t[44] !== w ? (P = /* @__PURE__ */ Z("div", { className: u, children: [
88
88
  m,
89
89
  k,
90
90
  w
91
- ] }), t[41] = u, t[42] = m, t[43] = k, t[44] = w, t[45] = R) : R = t[45], R;
91
+ ] }), t[41] = u, t[42] = m, t[43] = k, t[44] = w, t[45] = P) : P = t[45], P;
92
92
  };
93
93
  function st(N) {
94
94
  return N !== "";