docthub-core-components 3.3.10 → 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
|
|
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:
|
|
13
|
+
onChange: K,
|
|
14
14
|
onComplete: g,
|
|
15
15
|
className: C,
|
|
16
|
-
error:
|
|
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,
|
|
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],
|
|
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] =
|
|
30
|
+
}, i), t[1] = o, t[2] = S, t[3] = M;
|
|
31
31
|
} else
|
|
32
|
-
|
|
33
|
-
const T =
|
|
34
|
-
let
|
|
35
|
-
t[6] !==
|
|
32
|
+
M = t[3];
|
|
33
|
+
const T = M;
|
|
34
|
+
let O, A;
|
|
35
|
+
t[6] !== j ? (O = () => {
|
|
36
36
|
var i;
|
|
37
|
-
|
|
37
|
+
j && ((i = n.current[0]) == null || i.focus({
|
|
38
38
|
preventScroll: !0
|
|
39
39
|
}));
|
|
40
|
-
},
|
|
41
|
-
let
|
|
42
|
-
if (t[9] !==
|
|
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,
|
|
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
|
|
52
|
-
|
|
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
|
-
|
|
64
|
-
const
|
|
65
|
-
($ =
|
|
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 =
|
|
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 =
|
|
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__ */
|
|
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__ */
|
|
77
|
-
|
|
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",
|
|
79
|
-
}), t[9] =
|
|
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
|
-
|
|
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] !==
|
|
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] !==
|
|
86
|
-
let
|
|
87
|
-
return t[41] !== u || t[42] !== m || t[43] !== k || t[44] !== w ? (
|
|
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] =
|
|
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 !== "";
|
|
@@ -1,205 +1,205 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
3
|
-
import { c as
|
|
4
|
-
import { ChevronsUpDown as
|
|
5
|
-
import * as
|
|
6
|
-
import * as
|
|
7
|
-
import { isPossiblePhoneNumber as
|
|
8
|
-
import
|
|
9
|
-
import { CommandInput as
|
|
10
|
-
import { Input as
|
|
11
|
-
import { Label as
|
|
12
|
-
import { PopoverTrigger as
|
|
13
|
-
import { cn as
|
|
14
|
-
import { DoctTypography as
|
|
15
|
-
const
|
|
2
|
+
import { jsxs as j, jsx as i, Fragment as V } from "react/jsx-runtime";
|
|
3
|
+
import { c as Z } from "react-compiler-runtime";
|
|
4
|
+
import { ChevronsUpDown as se, CheckIcon as ie } from "lucide-react";
|
|
5
|
+
import * as h from "react";
|
|
6
|
+
import * as oe from "react-phone-number-input";
|
|
7
|
+
import { isPossiblePhoneNumber as Te, isValidPhoneNumber as Be } from "react-phone-number-input";
|
|
8
|
+
import ce from "react-phone-number-input/flags";
|
|
9
|
+
import { CommandInput as ae, CommandEmpty as de, CommandList as me, CommandGroup as fe, Command as ue, CommandItem as pe } from "../../../ui/command.js";
|
|
10
|
+
import { Input as ye } from "../../../ui/input.js";
|
|
11
|
+
import { Label as he } from "../../../ui/label.js";
|
|
12
|
+
import { PopoverTrigger as be, PopoverContent as ge, Popover as xe } from "../../../ui/popover.js";
|
|
13
|
+
import { cn as H } from "../../../../lib/utils.js";
|
|
14
|
+
import { DoctTypography as W } from "../../../ui/typography.js";
|
|
15
|
+
const ve = /\D/g, J = (r) => r.replace(ve, ""), Y = (r) => {
|
|
16
16
|
const e = r.match(/^\+\s*(\d+)\s*-\s*(\d*)\s*$/);
|
|
17
17
|
return e ? {
|
|
18
18
|
callingCode: e[1],
|
|
19
19
|
national: e[2]
|
|
20
20
|
} : null;
|
|
21
|
-
},
|
|
21
|
+
}, ee = (r) => {
|
|
22
22
|
if (r == null) return "";
|
|
23
|
-
const e = String(r).trim(), t =
|
|
24
|
-
return t ? t.national :
|
|
25
|
-
},
|
|
23
|
+
const e = String(r).trim(), t = Y(e);
|
|
24
|
+
return t ? t.national : J(e);
|
|
25
|
+
}, B = (r) => {
|
|
26
26
|
if (!r) return "91";
|
|
27
27
|
if (typeof r == "object" && "countryCode" in r)
|
|
28
|
-
return
|
|
28
|
+
return J(r.countryCode) || "91";
|
|
29
29
|
try {
|
|
30
|
-
return
|
|
30
|
+
return oe.getCountryCallingCode(r);
|
|
31
31
|
} catch {
|
|
32
32
|
return "91";
|
|
33
33
|
}
|
|
34
|
-
},
|
|
34
|
+
}, te = (r, e) => {
|
|
35
35
|
if (r == null)
|
|
36
36
|
return e && e.length > 0 ? e[0] : "IN";
|
|
37
37
|
if (typeof r == "number" && (e != null && e.length)) {
|
|
38
38
|
const t = e[0];
|
|
39
39
|
if (t && typeof t == "object" && "countryId" in t) {
|
|
40
|
-
const o = e.find((
|
|
40
|
+
const o = e.find((c) => c.countryId === r);
|
|
41
41
|
if (o) return o;
|
|
42
42
|
}
|
|
43
43
|
return e[r];
|
|
44
44
|
}
|
|
45
45
|
return r;
|
|
46
|
-
},
|
|
47
|
-
if (!e) return r ? `+${
|
|
48
|
-
const t =
|
|
46
|
+
}, re = (r, e) => {
|
|
47
|
+
if (!e) return r ? `+${J(r)}` : "";
|
|
48
|
+
const t = B(e);
|
|
49
49
|
return r ? `+${t}-${r}` : `+${t}`;
|
|
50
|
-
},
|
|
51
|
-
const o =
|
|
52
|
-
if (
|
|
53
|
-
return t &&
|
|
54
|
-
},
|
|
55
|
-
const e =
|
|
50
|
+
}, K = (r, e) => e ? typeof r == "object" && "countryId" in r && typeof e == "object" && "countryId" in e ? r.countryId === e.countryId : r === e : !1, Q = (r, e, t) => {
|
|
51
|
+
const o = J(e), c = r.map((n) => n.value).filter((n) => !!n).filter((n) => B(n) === o);
|
|
52
|
+
if (c.length !== 0)
|
|
53
|
+
return t && c.some((n) => K(n, t)) ? t : c[0];
|
|
54
|
+
}, ne = (r) => {
|
|
55
|
+
const e = Z(5), {
|
|
56
56
|
country: t,
|
|
57
57
|
countryName: o
|
|
58
|
-
} = r,
|
|
59
|
-
let
|
|
60
|
-
e[0] !==
|
|
61
|
-
let
|
|
62
|
-
return e[3] !==
|
|
63
|
-
},
|
|
64
|
-
const e =
|
|
58
|
+
} = r, c = ce[t];
|
|
59
|
+
let n;
|
|
60
|
+
e[0] !== c || e[1] !== o ? (n = c && /* @__PURE__ */ i(c, { title: o }), e[0] = c, e[1] = o, e[2] = n) : n = e[2];
|
|
61
|
+
let a;
|
|
62
|
+
return e[3] !== n ? (a = /* @__PURE__ */ i("span", { className: "flex h-4 w-6 overflow-hidden rounded-sm bg-foreground/20 [&_svg:not([class*='size-'])]:size-full", children: n }), e[3] = n, e[4] = a) : a = e[4], a;
|
|
63
|
+
}, we = (r) => {
|
|
64
|
+
const e = Z(48), {
|
|
65
65
|
disabled: t,
|
|
66
66
|
value: o,
|
|
67
|
-
options:
|
|
68
|
-
onChange:
|
|
69
|
-
showFlagVariant:
|
|
70
|
-
hasError:
|
|
71
|
-
popoverAnchorRef:
|
|
72
|
-
} = r,
|
|
73
|
-
let
|
|
74
|
-
e[0] !== o ? (
|
|
75
|
-
const
|
|
76
|
-
let
|
|
77
|
-
e[2] === Symbol.for("react.memo_cache_sentinel") ? (
|
|
78
|
-
|
|
79
|
-
}, e[2] =
|
|
80
|
-
const
|
|
81
|
-
let
|
|
82
|
-
e[3] !==
|
|
67
|
+
options: c,
|
|
68
|
+
onChange: n,
|
|
69
|
+
showFlagVariant: a,
|
|
70
|
+
hasError: I,
|
|
71
|
+
popoverAnchorRef: u
|
|
72
|
+
} = r, w = h.useRef(null), [F, p] = h.useState(""), [N, b] = h.useState(!1);
|
|
73
|
+
let f;
|
|
74
|
+
e[0] !== o ? (f = o ? `+${B(o)}` : "+91", e[0] = o, e[1] = f) : f = e[1];
|
|
75
|
+
const m = f;
|
|
76
|
+
let g;
|
|
77
|
+
e[2] === Symbol.for("react.memo_cache_sentinel") ? (g = (_) => {
|
|
78
|
+
b(_), _ && p("");
|
|
79
|
+
}, e[2] = g) : g = e[2];
|
|
80
|
+
const x = I ? "border-destructive" : "border-gray-300", $ = N && "bg-gray-100";
|
|
81
|
+
let R;
|
|
82
|
+
e[3] !== x || e[4] !== $ ? (R = H("flex h-[40px] items-center gap-1.5 rounded-l-md rounded-r-none border-l-[1px] border-t-[1px] border-b-[1px] bg-white px-3 py-[1px] text-sm font-medium text-gray-900 transition-colors", x, "hover:bg-gray-100 focus:z-10 focus:outline-none", "disabled:cursor-not-allowed disabled:opacity-50", $), e[3] = x, e[4] = $, e[5] = R) : R = e[5];
|
|
83
|
+
let P;
|
|
84
|
+
e[6] !== o || e[7] !== a ? (P = a && o && typeof o == "string" && /* @__PURE__ */ i("span", { className: "mr-1 flex items-center", children: /* @__PURE__ */ i(ne, { country: o, countryName: o }) }), e[6] = o, e[7] = a, e[8] = P) : P = e[8];
|
|
83
85
|
let D;
|
|
84
|
-
e[
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
let
|
|
89
|
-
e[
|
|
90
|
-
let
|
|
91
|
-
e[
|
|
92
|
-
|
|
93
|
-
e[15] !== t || e[16] !== z || e[17] !== I || e[18] !== D || e[19] !== j ? (S = /* @__PURE__ */ c(Xe, { asChild: !0, children: /* @__PURE__ */ T("button", { type: "button", disabled: t, className: I, children: [
|
|
86
|
+
e[9] !== m ? (D = /* @__PURE__ */ i(W, { variant: "body2", weight: "regular", className: "text-gray-900", children: m }), e[9] = m, e[10] = D) : D = e[10];
|
|
87
|
+
const G = t && "hidden";
|
|
88
|
+
let O;
|
|
89
|
+
e[11] !== G ? (O = H("h-4 w-4 text-gray-500 shrink-0", G), e[11] = G, e[12] = O) : O = e[12];
|
|
90
|
+
let k;
|
|
91
|
+
e[13] !== O ? (k = /* @__PURE__ */ i(se, { className: O }), e[13] = O, e[14] = k) : k = e[14];
|
|
92
|
+
let A;
|
|
93
|
+
e[15] !== t || e[16] !== k || e[17] !== R || e[18] !== P || e[19] !== D ? (A = /* @__PURE__ */ i(be, { asChild: !0, children: /* @__PURE__ */ j("button", { type: "button", disabled: t, className: R, children: [
|
|
94
|
+
P,
|
|
94
95
|
D,
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
e[21] === Symbol.for("react.memo_cache_sentinel") ? (q = {
|
|
96
|
+
k
|
|
97
|
+
] }) }), e[15] = t, e[16] = k, e[17] = R, e[18] = P, e[19] = D, e[20] = A) : A = e[20];
|
|
98
|
+
let L;
|
|
99
|
+
e[21] === Symbol.for("react.memo_cache_sentinel") ? (L = {
|
|
100
100
|
side: "flip",
|
|
101
101
|
align: "shift",
|
|
102
102
|
fallbackAxisSide: "none"
|
|
103
|
-
}, e[21] =
|
|
104
|
-
let
|
|
105
|
-
e[22] === Symbol.for("react.memo_cache_sentinel") ? (
|
|
106
|
-
|
|
107
|
-
const
|
|
108
|
-
|
|
103
|
+
}, e[21] = L) : L = e[21];
|
|
104
|
+
let M;
|
|
105
|
+
e[22] === Symbol.for("react.memo_cache_sentinel") ? (M = (_) => {
|
|
106
|
+
p(_), window.setTimeout(() => {
|
|
107
|
+
const X = w.current;
|
|
108
|
+
X && (X.scrollTop = 0);
|
|
109
109
|
}, 0);
|
|
110
|
-
}, e[22] =
|
|
111
|
-
let
|
|
112
|
-
e[23] !==
|
|
113
|
-
let
|
|
114
|
-
e[25] === Symbol.for("react.memo_cache_sentinel") ? (
|
|
110
|
+
}, e[22] = M) : M = e[22];
|
|
111
|
+
let v;
|
|
112
|
+
e[23] !== F ? (v = /* @__PURE__ */ i("div", { className: "mb-3 h-[32px] rounded-full border border-gray-300 bg-white overflow-hidden [&_[cmdk-input-wrapper]]:h-full [&_[cmdk-input-wrapper]]:px-3 [&_[cmdk-input-wrapper]_svg]:text-gray-500", children: /* @__PURE__ */ i(ae, { value: F, onValueChange: M, placeholder: "Search country..." }) }), e[23] = F, e[24] = v) : v = e[24];
|
|
113
|
+
let U, d;
|
|
114
|
+
e[25] === Symbol.for("react.memo_cache_sentinel") ? (U = {
|
|
115
115
|
msOverflowStyle: "none"
|
|
116
|
-
},
|
|
117
|
-
let
|
|
118
|
-
if (e[27] !==
|
|
119
|
-
let
|
|
120
|
-
e[32] !==
|
|
116
|
+
}, d = /* @__PURE__ */ i(de, { children: "No country found." }), e[25] = U, e[26] = d) : (U = e[25], d = e[26]);
|
|
117
|
+
let S;
|
|
118
|
+
if (e[27] !== c || e[28] !== n || e[29] !== o || e[30] !== a) {
|
|
119
|
+
let _;
|
|
120
|
+
e[32] !== n || e[33] !== o || e[34] !== a ? (_ = (X) => {
|
|
121
121
|
const {
|
|
122
|
-
value:
|
|
123
|
-
label:
|
|
124
|
-
countryCode:
|
|
125
|
-
} =
|
|
126
|
-
return
|
|
127
|
-
}, e[32] =
|
|
122
|
+
value: T,
|
|
123
|
+
label: l,
|
|
124
|
+
countryCode: s
|
|
125
|
+
} = X;
|
|
126
|
+
return T ? /* @__PURE__ */ i(Ne, { country: T, countryName: l, countryCode: s, selectedCountry: o, onChange: n, onSelectComplete: () => b(!1), showFlagVariant: a }, typeof T == "object" && "countryId" in T ? T.countryId : T) : null;
|
|
127
|
+
}, e[32] = n, e[33] = o, e[34] = a, e[35] = _) : _ = e[35], S = c.map(_), e[27] = c, e[28] = n, e[29] = o, e[30] = a, e[31] = S;
|
|
128
128
|
} else
|
|
129
|
-
|
|
130
|
-
let P;
|
|
131
|
-
e[36] !== O ? (P = /* @__PURE__ */ c(Ve, { children: /* @__PURE__ */ T("div", { ref: C, className: "max-h-[min(288px,calc(100vh-12rem))] overflow-y-auto -mx-1 px-1 [&::-webkit-scrollbar]:hidden [scrollbar-width:none]", style: A, children: [
|
|
132
|
-
G,
|
|
133
|
-
/* @__PURE__ */ c(ze, { children: O })
|
|
134
|
-
] }) }), e[36] = O, e[37] = P) : P = e[37];
|
|
129
|
+
S = e[31];
|
|
135
130
|
let E;
|
|
136
|
-
e[
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
] })
|
|
140
|
-
let
|
|
141
|
-
e[
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
]
|
|
147
|
-
|
|
148
|
-
|
|
131
|
+
e[36] !== S ? (E = /* @__PURE__ */ i(me, { children: /* @__PURE__ */ j("div", { ref: w, className: "max-h-[min(288px,calc(100vh-12rem))] overflow-y-auto -mx-1 px-1 [&::-webkit-scrollbar]:hidden [scrollbar-width:none]", style: U, children: [
|
|
132
|
+
d,
|
|
133
|
+
/* @__PURE__ */ i(fe, { children: S })
|
|
134
|
+
] }) }), e[36] = S, e[37] = E) : E = e[37];
|
|
135
|
+
let y;
|
|
136
|
+
e[38] !== v || e[39] !== E ? (y = /* @__PURE__ */ j(ue, { children: [
|
|
137
|
+
v,
|
|
138
|
+
E
|
|
139
|
+
] }), e[38] = v, e[39] = E, e[40] = y) : y = e[40];
|
|
140
|
+
let C;
|
|
141
|
+
e[41] !== u || e[42] !== y ? (C = /* @__PURE__ */ i(ge, { anchor: u, side: "bottom", sideOffset: 6, collisionAvoidance: L, className: "w-[min(var(--anchor-width),calc(100vw-1rem))] max-w-[var(--available-width)] min-w-0 p-1 shadow-md border border-gray-300 rounded-md", align: "start", children: y }), e[41] = u, e[42] = y, e[43] = C) : C = e[43];
|
|
142
|
+
let z;
|
|
143
|
+
return e[44] !== N || e[45] !== A || e[46] !== C ? (z = /* @__PURE__ */ j(xe, { open: N, modal: !0, onOpenChange: g, children: [
|
|
144
|
+
A,
|
|
145
|
+
C
|
|
146
|
+
] }), e[44] = N, e[45] = A, e[46] = C, e[47] = z) : z = e[47], z;
|
|
147
|
+
}, Ne = (r) => {
|
|
148
|
+
const e = Z(21), {
|
|
149
149
|
country: t,
|
|
150
150
|
countryName: o,
|
|
151
|
-
countryCode:
|
|
152
|
-
selectedCountry:
|
|
153
|
-
onChange:
|
|
154
|
-
onSelectComplete:
|
|
155
|
-
showFlagVariant:
|
|
151
|
+
countryCode: c,
|
|
152
|
+
selectedCountry: n,
|
|
153
|
+
onChange: a,
|
|
154
|
+
onSelectComplete: I,
|
|
155
|
+
showFlagVariant: u
|
|
156
156
|
} = r;
|
|
157
|
-
let C;
|
|
158
|
-
e[0] !== t || e[1] !== s || e[2] !== x ? (C = () => {
|
|
159
|
-
s(t), x();
|
|
160
|
-
}, e[0] = t, e[1] = s, e[2] = x, e[3] = C) : C = e[3];
|
|
161
|
-
const $ = C;
|
|
162
157
|
let w;
|
|
158
|
+
e[0] !== t || e[1] !== a || e[2] !== I ? (w = () => {
|
|
159
|
+
a(t), I();
|
|
160
|
+
}, e[0] = t, e[1] = a, e[2] = I, e[3] = w) : w = e[3];
|
|
161
|
+
const F = w;
|
|
162
|
+
let p;
|
|
163
163
|
e: {
|
|
164
|
-
if (!
|
|
165
|
-
|
|
164
|
+
if (!n) {
|
|
165
|
+
p = !1;
|
|
166
166
|
break e;
|
|
167
167
|
}
|
|
168
|
-
if (typeof t == "object" && "countryId" in t && typeof
|
|
169
|
-
|
|
168
|
+
if (typeof t == "object" && "countryId" in t && typeof n == "object" && "countryId" in n) {
|
|
169
|
+
p = t.countryId === n.countryId;
|
|
170
170
|
break e;
|
|
171
171
|
}
|
|
172
|
-
|
|
172
|
+
p = t === n;
|
|
173
173
|
}
|
|
174
|
-
const
|
|
175
|
-
let
|
|
176
|
-
e[4] === Symbol.for("react.memo_cache_sentinel") ? (
|
|
177
|
-
let
|
|
178
|
-
e[5] !== t || e[6] !== o || e[7] !==
|
|
179
|
-
let a;
|
|
180
|
-
e[9] !== n || e[10] !== o || e[11] !== f ? (a = f ? /* @__PURE__ */ T($e, { children: [
|
|
181
|
-
/* @__PURE__ */ c("span", { className: "flex-1 text-sm font-normal text-gray-700", children: o }),
|
|
182
|
-
/* @__PURE__ */ c(Se, { variant: "body2", weight: "regular", className: "text-gray-900 min-w-[50px] text-right", children: n })
|
|
183
|
-
] }) : /* @__PURE__ */ T($e, { children: [
|
|
184
|
-
/* @__PURE__ */ c(Se, { variant: "body2", weight: "regular", className: "text-gray-900 min-w-[50px]", children: n }),
|
|
185
|
-
/* @__PURE__ */ c("span", { className: "flex-1 text-sm font-normal text-gray-700", children: o })
|
|
186
|
-
] }), e[9] = n, e[10] = o, e[11] = f, e[12] = a) : a = e[12];
|
|
174
|
+
const N = p, b = typeof t == "object" && "countryId" in t ? `${t.countryName} ${t.countryCode}` : `${o} ${c}`;
|
|
175
|
+
let f;
|
|
176
|
+
e[4] === Symbol.for("react.memo_cache_sentinel") ? (f = H("flex items-center gap-3 px-3 py-2.5 text-sm cursor-pointer transition-colors", "data-[selected=true]:bg-[#F5F5F5] data-[selected=true]:text-gray-900", "hover:bg-[#F5F5F5]"), e[4] = f) : f = e[4];
|
|
177
|
+
let m;
|
|
178
|
+
e[5] !== t || e[6] !== o || e[7] !== u ? (m = u && typeof t == "string" && /* @__PURE__ */ i("span", { className: "flex items-center", children: /* @__PURE__ */ i(ne, { country: t, countryName: o }) }), e[5] = t, e[6] = o, e[7] = u, e[8] = m) : m = e[8];
|
|
187
179
|
let g;
|
|
188
|
-
e[
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
] }), e[
|
|
195
|
-
|
|
180
|
+
e[9] !== c || e[10] !== o || e[11] !== u ? (g = u ? /* @__PURE__ */ j(V, { children: [
|
|
181
|
+
/* @__PURE__ */ i("span", { className: "flex-1 text-sm font-normal text-gray-700", children: o }),
|
|
182
|
+
/* @__PURE__ */ i(W, { variant: "body2", weight: "regular", className: "text-gray-900 min-w-[50px] text-right", children: c })
|
|
183
|
+
] }) : /* @__PURE__ */ j(V, { children: [
|
|
184
|
+
/* @__PURE__ */ i(W, { variant: "body2", weight: "regular", className: "text-gray-900 min-w-[50px]", children: c }),
|
|
185
|
+
/* @__PURE__ */ i("span", { className: "flex-1 text-sm font-normal text-gray-700", children: o })
|
|
186
|
+
] }), e[9] = c, e[10] = o, e[11] = u, e[12] = g) : g = e[12];
|
|
187
|
+
let x;
|
|
188
|
+
e[13] !== N ? (x = N && /* @__PURE__ */ i(ie, { className: "ml-auto h-4 w-4 text-gray-900 shrink-0" }), e[13] = N, e[14] = x) : x = e[14];
|
|
189
|
+
let $;
|
|
190
|
+
return e[15] !== F || e[16] !== b || e[17] !== m || e[18] !== g || e[19] !== x ? ($ = /* @__PURE__ */ j(pe, { value: b, className: f, onSelect: F, children: [
|
|
191
|
+
m,
|
|
192
|
+
g,
|
|
193
|
+
x
|
|
194
|
+
] }), e[15] = F, e[16] = b, e[17] = m, e[18] = g, e[19] = x, e[20] = $) : $ = e[20], $;
|
|
195
|
+
}, Ie = oe.getCountries(), Se = (r) => {
|
|
196
196
|
if (!r || r.length === 0)
|
|
197
|
-
return
|
|
197
|
+
return Ie.map((t) => ({
|
|
198
198
|
value: t,
|
|
199
199
|
label: new Intl.DisplayNames(["en"], {
|
|
200
200
|
type: "region"
|
|
201
201
|
}).of(t) ?? t,
|
|
202
|
-
countryCode: `+${
|
|
202
|
+
countryCode: `+${B(t)}`
|
|
203
203
|
}));
|
|
204
204
|
const e = r[0];
|
|
205
205
|
return e && typeof e == "object" && "countryId" in e ? r.map((t) => ({
|
|
@@ -211,139 +211,88 @@ const Ke = /\D/g, te = (r) => r.replace(Ke, ""), _e = (r) => {
|
|
|
211
211
|
label: new Intl.DisplayNames(["en"], {
|
|
212
212
|
type: "region"
|
|
213
213
|
}).of(t) ?? t,
|
|
214
|
-
countryCode: `+${
|
|
214
|
+
countryCode: `+${B(t)}`
|
|
215
215
|
}));
|
|
216
216
|
};
|
|
217
|
-
function
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
e[21] !== t || e[22] !== _ || e[23] !== S ? (A = [t, _ ? S : void 0].filter(Boolean).join(" ") || void 0, e[21] = t, e[22] = _, e[23] = S, e[24] = A) : A = e[24];
|
|
245
|
-
const G = A, O = !!f, P = V === "flag";
|
|
246
|
-
let E;
|
|
247
|
-
e[25] !== n ? (E = Ze(n), e[25] = n, e[26] = E) : E = e[26];
|
|
248
|
-
const u = E;
|
|
249
|
-
let B;
|
|
250
|
-
e[27] !== n || e[28] !== u || e[29] !== s || e[30] !== b ? (B = () => {
|
|
251
|
-
const p = _e(String(b ?? "").trim());
|
|
252
|
-
if (p) {
|
|
253
|
-
const N = Ie(u, p.callingCode, void 0);
|
|
254
|
-
if (N)
|
|
255
|
-
return N;
|
|
217
|
+
function Pe({
|
|
218
|
+
label: r,
|
|
219
|
+
helperText: e,
|
|
220
|
+
error: t,
|
|
221
|
+
required: o,
|
|
222
|
+
className: c,
|
|
223
|
+
"aria-describedby": n,
|
|
224
|
+
id: a,
|
|
225
|
+
value: I = "",
|
|
226
|
+
onPhoneChange: u,
|
|
227
|
+
countryCode: w,
|
|
228
|
+
onCountryCodeChange: F,
|
|
229
|
+
onValuesChange: p,
|
|
230
|
+
onCountryChange: N,
|
|
231
|
+
onValueChange: b,
|
|
232
|
+
countries: f,
|
|
233
|
+
defaultCountry: m,
|
|
234
|
+
variant: g = "default",
|
|
235
|
+
disabled: x,
|
|
236
|
+
placeholder: $,
|
|
237
|
+
...R
|
|
238
|
+
}) {
|
|
239
|
+
const P = h.useId(), D = h.useId(), G = h.useRef(null), O = a ?? P, k = !!(e || t), A = [n, k ? D : void 0].filter(Boolean).join(" ") || void 0, L = !!t, M = g === "flag", v = h.useMemo(() => Se(f), [f]), U = () => {
|
|
240
|
+
const l = Y(String(I ?? "").trim());
|
|
241
|
+
if (l) {
|
|
242
|
+
const s = Q(v, l.callingCode, void 0);
|
|
243
|
+
if (s) return s;
|
|
256
244
|
}
|
|
257
|
-
return
|
|
258
|
-
},
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
if (s != null) {
|
|
266
|
-
const p = je(s, n);
|
|
267
|
-
p && M(p);
|
|
245
|
+
return te(m, f);
|
|
246
|
+
}, [d, S] = h.useState(() => U()), E = w !== void 0, y = h.useRef(F);
|
|
247
|
+
y.current = F;
|
|
248
|
+
const C = h.useRef(null);
|
|
249
|
+
h.useEffect(() => {
|
|
250
|
+
if (m != null) {
|
|
251
|
+
const l = te(m, f);
|
|
252
|
+
l && S((s) => s && K(l, s) ? s : l);
|
|
268
253
|
}
|
|
269
|
-
},
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
const N = p.target.value, Ne = te(N);
|
|
309
|
-
y == null || y(Ne);
|
|
310
|
-
const Re = l ?? U(i);
|
|
311
|
-
a == null || a([Re, Ne]), d == null || d(Oe(Ne, i));
|
|
312
|
-
}, e[61] = l, e[62] = y, e[63] = d, e[64] = a, e[65] = i, e[66] = ue) : ue = e[66];
|
|
313
|
-
const be = ue;
|
|
314
|
-
let pe;
|
|
315
|
-
e[67] !== b ? (pe = De(b), e[67] = b, e[68] = pe) : pe = e[68];
|
|
316
|
-
const ve = pe;
|
|
317
|
-
let H;
|
|
318
|
-
e[69] !== o ? (H = ee("space-y-1", o), e[69] = o, e[70] = H) : H = e[70];
|
|
319
|
-
let J;
|
|
320
|
-
e[71] !== w || e[72] !== v || e[73] !== k ? (J = w && /* @__PURE__ */ T(Me, { htmlFor: k, className: "text-sm font-medium text-foreground", children: [
|
|
321
|
-
w,
|
|
322
|
-
v && /* @__PURE__ */ c("span", { className: "ml-1 text-destructive", "aria-hidden": "true", children: "*" })
|
|
323
|
-
] }), e[71] = w, e[72] = v, e[73] = k, e[74] = J) : J = e[74];
|
|
324
|
-
let K;
|
|
325
|
-
e[75] !== u || e[76] !== x || e[77] !== ge || e[78] !== O || e[79] !== i || e[80] !== P ? (K = /* @__PURE__ */ c(Qe, { disabled: x, value: i, options: u, onChange: ge, showFlagVariant: P, hasError: O, popoverAnchorRef: q }), e[75] = u, e[76] = x, e[77] = ge, e[78] = O, e[79] = i, e[80] = P, e[81] = K) : K = e[81];
|
|
326
|
-
const xe = v || void 0, Ce = O || void 0, we = O ? "border-destructive" : "border-gray-300";
|
|
327
|
-
let Q;
|
|
328
|
-
e[82] !== we ? (Q = ee("h-[40px] rounded-r-md rounded-l-none border-t-[1px] border-b-[1px] border-l-[1px] bg-white px-3 py-[1px] text-sm", we), e[82] = we, e[83] = Q) : Q = e[83];
|
|
329
|
-
let W;
|
|
330
|
-
e[84] !== G || e[85] !== x || e[86] !== be || e[87] !== ve || e[88] !== g || e[89] !== k || e[90] !== I || e[91] !== xe || e[92] !== Ce || e[93] !== Q ? (W = /* @__PURE__ */ c(qe, { ...I, ref: void 0, id: k, type: "text", inputMode: "numeric", value: ve, onChange: be, disabled: x, placeholder: g, "aria-required": xe, "aria-invalid": Ce, "aria-describedby": G, className: Q }), e[84] = G, e[85] = x, e[86] = be, e[87] = ve, e[88] = g, e[89] = k, e[90] = I, e[91] = xe, e[92] = Ce, e[93] = Q, e[94] = W) : W = e[94];
|
|
331
|
-
let Y;
|
|
332
|
-
e[95] !== K || e[96] !== W ? (Y = /* @__PURE__ */ T("div", { ref: q, className: "flex w-full min-w-0 items-center", children: [
|
|
333
|
-
K,
|
|
334
|
-
W
|
|
335
|
-
] }), e[95] = K, e[96] = W, e[97] = Y) : Y = e[97];
|
|
336
|
-
let Z;
|
|
337
|
-
e[98] !== f || e[99] !== _ || e[100] !== S || e[101] !== C ? (Z = _ && /* @__PURE__ */ c("p", { id: S, className: ee("text-xs", f ? "text-destructive" : "text-muted-foreground"), role: f ? "alert" : void 0, children: f || C }), e[98] = f, e[99] = _, e[100] = S, e[101] = C, e[102] = Z) : Z = e[102];
|
|
338
|
-
let ye;
|
|
339
|
-
return e[103] !== H || e[104] !== J || e[105] !== Y || e[106] !== Z ? (ye = /* @__PURE__ */ T("div", { className: H, children: [
|
|
340
|
-
J,
|
|
341
|
-
Y,
|
|
342
|
-
Z
|
|
343
|
-
] }), e[103] = H, e[104] = J, e[105] = Y, e[106] = Z, e[107] = ye) : ye = e[107], ye;
|
|
254
|
+
}, [m, f]), h.useEffect(() => {
|
|
255
|
+
var s;
|
|
256
|
+
if (!d) return;
|
|
257
|
+
const l = B(d);
|
|
258
|
+
C.current !== l && (C.current = l, (s = y.current) == null || s.call(y, l));
|
|
259
|
+
}, [d]), h.useEffect(() => {
|
|
260
|
+
if (!E) return;
|
|
261
|
+
const l = J(String(w ?? ""));
|
|
262
|
+
if (l === "") return;
|
|
263
|
+
const s = Q(v, l, d);
|
|
264
|
+
s && !K(s, d) && S(s);
|
|
265
|
+
}, [w, v, E, d]), h.useEffect(() => {
|
|
266
|
+
const l = Y(String(I ?? "").trim());
|
|
267
|
+
if (!l) return;
|
|
268
|
+
const s = Q(v, l.callingCode, d);
|
|
269
|
+
s && !K(s, d) && S(s);
|
|
270
|
+
}, [I, v, d]);
|
|
271
|
+
const z = ee(I), _ = (l) => {
|
|
272
|
+
var q;
|
|
273
|
+
S(l);
|
|
274
|
+
const s = B(l);
|
|
275
|
+
C.current = s, (q = y.current) == null || q.call(y, s), N == null || N(l), p == null || p([s, z]), b == null || b(re(z, l));
|
|
276
|
+
}, X = (l) => {
|
|
277
|
+
const s = l.target.value, q = J(s);
|
|
278
|
+
u == null || u(q);
|
|
279
|
+
const le = w ?? B(d);
|
|
280
|
+
p == null || p([le, q]), b == null || b(re(q, d));
|
|
281
|
+
}, T = ee(I);
|
|
282
|
+
return /* @__PURE__ */ j("div", { className: H("space-y-1", c), children: [
|
|
283
|
+
r && /* @__PURE__ */ j(he, { htmlFor: O, className: "text-sm font-medium text-foreground", children: [
|
|
284
|
+
r,
|
|
285
|
+
o && /* @__PURE__ */ i("span", { className: "ml-1 text-destructive", "aria-hidden": "true", children: "*" })
|
|
286
|
+
] }),
|
|
287
|
+
/* @__PURE__ */ j("div", { ref: G, className: "flex w-full min-w-0 items-center", children: [
|
|
288
|
+
/* @__PURE__ */ i(we, { disabled: x, value: d, options: v, onChange: _, showFlagVariant: M, hasError: L, popoverAnchorRef: G }),
|
|
289
|
+
/* @__PURE__ */ i(ye, { ...R, ref: void 0, id: O, type: "text", inputMode: "numeric", value: T, onChange: X, disabled: x, placeholder: $, "aria-required": o || void 0, "aria-invalid": L || void 0, "aria-describedby": A, className: H("h-[40px] rounded-r-md rounded-l-none border-t-[1px] border-b-[1px] border-l-[1px] bg-white px-3 py-[1px] text-sm", L ? "border-destructive" : "border-gray-300") })
|
|
290
|
+
] }),
|
|
291
|
+
k && /* @__PURE__ */ i("p", { id: D, className: H("text-xs", t ? "text-destructive" : "text-muted-foreground"), role: t ? "alert" : void 0, children: t || e })
|
|
292
|
+
] });
|
|
344
293
|
}
|
|
345
294
|
export {
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
295
|
+
Pe as DoctPhoneInput,
|
|
296
|
+
Te as isPossiblePhoneNumber,
|
|
297
|
+
Be as isValidPhoneNumber
|
|
349
298
|
};
|