docthub-core-components 3.3.6 → 3.3.7

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