docthub-core-components 3.2.8 → 3.3.1

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.
@@ -0,0 +1,265 @@
1
+ "use client";
2
+ import { jsx as s, jsxs as v, Fragment as te } from "react/jsx-runtime";
3
+ import { c as b } from "react-compiler-runtime";
4
+ import { Smartphone as le, X as ie } from "lucide-react";
5
+ import * as se from "react";
6
+ import { DoctButton as H } from "../../../ui/button.js";
7
+ import { DialogHeader as oe, DialogTitle as ne, DialogContent as re, Dialog as ae } from "../../../ui/dialog.js";
8
+ import { DrawerHeader as ce, DrawerTitle as de, DrawerContent as fe, Drawer as me } from "../../../ui/drawer.js";
9
+ import { Input as ue } from "../../../ui/input.js";
10
+ import { DoctTypography as E } from "../../../ui/typography.js";
11
+ import { useIsMobile as he } from "../../../../hooks/use-mobile.js";
12
+ import { cn as Z } from "../../../../lib/utils.js";
13
+ import { buildPhoneDisplay as pe, ACCOUNT_CONFLICT_PROMPT_DEFAULT_COUNTRY_CODE as be, ACCOUNT_CONFLICT_PROMPT_DEFAULT_PHONE_PLACEHOLDER as Ce, ACCOUNT_CONFLICT_PROMPT_BODY_TITLE as ge, ACCOUNT_CONFLICT_PROMPT_HEADER_TITLE as xe, ACCOUNT_CONFLICT_PROMPT_DEFAULT_INFO_MESSAGE as ee, ACCOUNT_CONFLICT_PROMPT_PRIMARY_LABEL as Ne, buildLoginWithPhoneLabel as _e, ACCOUNT_CONFLICT_PROMPT_LOGIN_UNIFY_HINT as ve, isPrimaryDisabled as Te, ACCOUNT_CONFLICT_PROMPT_SECONDARY_LABEL as we } from "./presets.js";
14
+ import { ACCOUNT_CONFLICT_PROMPT_DRAWER_BACKDROP_CLASS as J } from "./types.js";
15
+ const ye = "[&>div:first-child]:pointer-events-none [&>div:first-child]:sr-only [&>div:first-child]:m-0 [&>div:first-child]:h-0 [&>div:first-child]:w-0 [&>div:first-child]:overflow-hidden", Ae = "flex w-full flex-col overflow-hidden border border-black/[0.12] bg-white";
16
+ function Pe(r) {
17
+ const e = b(3), {
18
+ onClose: i
19
+ } = r;
20
+ let t;
21
+ e[0] === Symbol.for("react.memo_cache_sentinel") ? (t = /* @__PURE__ */ s(ie, { className: "size-6", "aria-hidden": !0 }), e[0] = t) : t = e[0];
22
+ let l;
23
+ return e[1] !== i ? (l = /* @__PURE__ */ s(H, { type: "button", variant: "ghost", onClick: i, className: "flex size-12 shrink-0 items-center justify-center rounded-full p-0 text-black/70", "aria-label": "Close", icon: t }), e[1] = i, e[2] = l) : l = e[2], l;
24
+ }
25
+ function Oe(r) {
26
+ const e = b(7), {
27
+ title: i,
28
+ onClose: t
29
+ } = r;
30
+ let l;
31
+ e[0] !== i ? (l = /* @__PURE__ */ s("div", { className: "flex min-h-12 min-w-0 flex-1 items-center py-[18px]", children: /* @__PURE__ */ s(E, { as: "p", variant: "textLabel1", weight: "semiBold", align: "left", className: "min-w-0 !text-black/80", children: i }) }), e[0] = i, e[1] = l) : l = e[1];
32
+ let n;
33
+ e[2] !== t ? (n = /* @__PURE__ */ s(Pe, { onClose: t }), e[2] = t, e[3] = n) : n = e[3];
34
+ let o;
35
+ return e[4] !== l || e[5] !== n ? (o = /* @__PURE__ */ v("div", { className: "flex w-full shrink-0 items-start justify-between overflow-hidden pl-4", children: [
36
+ l,
37
+ n
38
+ ] }), e[4] = l, e[5] = n, e[6] = o) : o = e[6], o;
39
+ }
40
+ function Le(r) {
41
+ const e = b(4), {
42
+ icon: i
43
+ } = r;
44
+ let t;
45
+ e[0] !== i ? (t = i ?? /* @__PURE__ */ s(le, { className: "size-6 text-white", strokeWidth: 1.75, "aria-hidden": !0 }), e[0] = i, e[1] = t) : t = e[1];
46
+ let l;
47
+ return e[2] !== t ? (l = /* @__PURE__ */ s("div", { className: "flex size-12 shrink-0 items-center justify-center rounded-xl bg-[#00A0C0] px-3", children: t }), e[2] = t, e[3] = l) : l = e[3], l;
48
+ }
49
+ function De() {
50
+ const r = b(1);
51
+ let e;
52
+ return r[0] === Symbol.for("react.memo_cache_sentinel") ? (e = /* @__PURE__ */ s(E, { as: "p", variant: "textLabel3", weight: "medium", align: "left", className: "w-full !text-[#4389FF]", children: ee }), r[0] = e) : e = r[0], e;
53
+ }
54
+ function Me(r) {
55
+ const e = b(3), {
56
+ message: i,
57
+ isDefaultMessage: t
58
+ } = r;
59
+ let l;
60
+ return e[0] !== t || e[1] !== i ? (l = /* @__PURE__ */ s("div", { className: "w-full self-stretch rounded-xl bg-[rgba(67,137,255,0.12)] p-[14px]", children: t ? /* @__PURE__ */ s(De, {}) : /* @__PURE__ */ s(E, { as: "p", variant: "textLabel3", weight: "medium", align: "left", className: "w-full !text-[#4389FF]", children: i }) }), e[0] = t, e[1] = i, e[2] = l) : l = e[2], l;
61
+ }
62
+ function Q(r) {
63
+ const e = b(12), {
64
+ countryCode: i,
65
+ placeholder: t,
66
+ value: l,
67
+ onChange: n
68
+ } = r;
69
+ let o;
70
+ e[0] !== i ? (o = /* @__PURE__ */ s(E, { as: "span", variant: "body2", weight: "regular", className: "w-[42px] shrink-0 !text-center !text-black", children: i }), e[0] = i, e[1] = o) : o = e[1];
71
+ let m;
72
+ e[2] === Symbol.for("react.memo_cache_sentinel") ? (m = /* @__PURE__ */ s("div", { "aria-hidden": !0, className: "h-[42px] w-px shrink-0 bg-black/10" }), e[2] = m) : m = e[2];
73
+ let c;
74
+ e[3] !== n ? (c = (u) => n == null ? void 0 : n(u.target.value), e[3] = n, e[4] = c) : c = e[4];
75
+ let a;
76
+ e[5] !== t || e[6] !== c || e[7] !== l ? (a = /* @__PURE__ */ s(ue, { type: "tel", inputMode: "numeric", placeholder: t, value: l, onChange: c, className: "h-[42px] min-h-[42px] flex-1 rounded-none border-0 bg-transparent px-0 text-left text-sm leading-5 text-black shadow-none placeholder:text-black/40 focus-visible:ring-0 md:text-sm", "aria-label": "Mobile number" }), e[5] = t, e[6] = c, e[7] = l, e[8] = a) : a = e[8];
77
+ let d;
78
+ return e[9] !== o || e[10] !== a ? (d = /* @__PURE__ */ v("div", { className: "flex w-full items-center gap-3 overflow-hidden rounded-lg border border-black/10 bg-white px-3", children: [
79
+ o,
80
+ m,
81
+ a
82
+ ] }), e[9] = o, e[10] = a, e[11] = d) : d = e[11], d;
83
+ }
84
+ function Ee(r) {
85
+ const e = b(2), {
86
+ message: i
87
+ } = r;
88
+ let t;
89
+ return e[0] !== i ? (t = /* @__PURE__ */ s(E, { as: "p", variant: "textLabel4", weight: "medium", align: "left", className: "w-full !text-[#EA4335]", children: i }), e[0] = i, e[1] = t) : t = e[1], t;
90
+ }
91
+ function Fe(r) {
92
+ const e = b(7), {
93
+ phoneDisplay: i
94
+ } = r;
95
+ let t;
96
+ e[0] !== i ? (t = _e(i), e[0] = i, e[1] = t) : t = e[1];
97
+ let l;
98
+ e[2] !== t ? (l = /* @__PURE__ */ s(H, { type: "button", variant: "outline", size: "medium", fullWidth: !0, children: t }), e[2] = t, e[3] = l) : l = e[3];
99
+ let n;
100
+ e[4] === Symbol.for("react.memo_cache_sentinel") ? (n = /* @__PURE__ */ s(E, { as: "p", variant: "body5", weight: "regular", className: "w-full !text-center !text-black/44", children: ve }), e[4] = n) : n = e[4];
101
+ let o;
102
+ return e[5] !== l ? (o = /* @__PURE__ */ v("div", { className: "flex w-full flex-col items-center gap-1.5 rounded-xl bg-black/[0.04] p-3", children: [
103
+ l,
104
+ n
105
+ ] }), e[5] = l, e[6] = o) : o = e[6], o;
106
+ }
107
+ function Ie(r) {
108
+ const e = b(11), {
109
+ trigger: i,
110
+ state: t
111
+ } = r, l = Ne[i][t];
112
+ let n;
113
+ e[0] !== t ? (n = Te(t), e[0] = t, e[1] = n) : n = e[1];
114
+ const o = n;
115
+ if (i === "system") {
116
+ const d = o ? "disabled" : "primary";
117
+ let u;
118
+ return e[2] !== o || e[3] !== l || e[4] !== d ? (u = /* @__PURE__ */ s(H, { type: "button", size: "medium", fullWidth: !0, variant: d, disabled: o, children: l }), e[2] = o, e[3] = l, e[4] = d, e[5] = u) : u = e[5], u;
119
+ }
120
+ let m;
121
+ e[6] === Symbol.for("react.memo_cache_sentinel") ? (m = /* @__PURE__ */ s(H, { type: "button", size: "medium", variant: "secondary", className: "shrink-0", children: we }), e[6] = m) : m = e[6];
122
+ const c = o ? "disabled" : "primary";
123
+ let a;
124
+ return e[7] !== o || e[8] !== l || e[9] !== c ? (a = /* @__PURE__ */ v("div", { className: "flex w-full items-start gap-2.5", children: [
125
+ m,
126
+ /* @__PURE__ */ s(H, { type: "button", size: "medium", fullWidth: !0, variant: c, disabled: o, className: "min-w-0 flex-1", children: l })
127
+ ] }), e[7] = o, e[8] = l, e[9] = c, e[10] = a) : a = e[10], a;
128
+ }
129
+ function V(r) {
130
+ const e = b(34), {
131
+ trigger: i,
132
+ state: t,
133
+ headerTitle: l,
134
+ bodyTitle: n,
135
+ infoMessage: o,
136
+ isDefaultInfoMessage: m,
137
+ phoneNumber: c,
138
+ onPhoneNumberChange: a,
139
+ existingAccountErrorMessage: d,
140
+ phoneDisplay: u,
141
+ phonePlaceholder: A,
142
+ countryCode: P,
143
+ icon: O,
144
+ onClose: $,
145
+ className: L,
146
+ surface: D
147
+ } = r, M = t === "existingAccount", C = D === "drawer" ? "h-auto max-w-none rounded-t-[16px]" : "max-w-[320px] rounded-[16px] shadow-[0_8px_24px_rgba(0,0,0,0.12)]";
148
+ let T;
149
+ e[0] !== L || e[1] !== C ? (T = Z(Ae, C, L), e[0] = L, e[1] = C, e[2] = T) : T = e[2];
150
+ const g = T;
151
+ let w;
152
+ e[3] !== l || e[4] !== $ ? (w = /* @__PURE__ */ s(Oe, { title: l, onClose: $ }), e[3] = l, e[4] = $, e[5] = w) : w = e[5];
153
+ let h;
154
+ e[6] !== O ? (h = /* @__PURE__ */ s(Le, { icon: O }), e[6] = O, e[7] = h) : h = e[7];
155
+ let f;
156
+ e[8] !== n ? (f = /* @__PURE__ */ s(E, { as: "h2", variant: "textLabel1", weight: "semiBold", align: "center", className: "shrink-0 whitespace-nowrap !text-black/80", children: n }), e[8] = n, e[9] = f) : f = e[9];
157
+ let x;
158
+ e[10] !== o || e[11] !== m ? (x = /* @__PURE__ */ s(Me, { message: o, isDefaultMessage: m }), e[10] = o, e[11] = m, e[12] = x) : x = e[12];
159
+ let N;
160
+ e[13] !== P || e[14] !== d || e[15] !== M || e[16] !== a || e[17] !== u || e[18] !== c || e[19] !== A ? (N = /* @__PURE__ */ s("div", { className: "flex w-full flex-col items-start gap-4", children: M ? /* @__PURE__ */ v(te, { children: [
161
+ /* @__PURE__ */ v("div", { className: "flex w-full flex-col items-start gap-1.5", children: [
162
+ /* @__PURE__ */ s(Q, { countryCode: P, placeholder: A, value: c, onChange: a }),
163
+ d ? /* @__PURE__ */ s(Ee, { message: d }) : null
164
+ ] }),
165
+ /* @__PURE__ */ s(Fe, { phoneDisplay: u })
166
+ ] }) : /* @__PURE__ */ s(Q, { countryCode: P, placeholder: A, value: c, onChange: a }) }), e[13] = P, e[14] = d, e[15] = M, e[16] = a, e[17] = u, e[18] = c, e[19] = A, e[20] = N) : N = e[20];
167
+ let _;
168
+ e[21] !== h || e[22] !== f || e[23] !== x || e[24] !== N ? (_ = /* @__PURE__ */ v("div", { className: "flex w-full flex-col items-center gap-4 px-4 pb-5 pt-4", children: [
169
+ h,
170
+ f,
171
+ x,
172
+ N
173
+ ] }), e[21] = h, e[22] = f, e[23] = x, e[24] = N, e[25] = _) : _ = e[25];
174
+ let p;
175
+ e[26] !== t || e[27] !== i ? (p = /* @__PURE__ */ s("div", { className: "flex w-full flex-col items-start border-t border-black/10 bg-[#FAFAFA] p-4", children: /* @__PURE__ */ s(Ie, { trigger: i, state: t }) }), e[26] = t, e[27] = i, e[28] = p) : p = e[28];
176
+ let y;
177
+ return e[29] !== g || e[30] !== w || e[31] !== _ || e[32] !== p ? (y = /* @__PURE__ */ v("div", { className: g, children: [
178
+ w,
179
+ _,
180
+ p
181
+ ] }), e[29] = g, e[30] = w, e[31] = _, e[32] = p, e[33] = y) : y = e[33], y;
182
+ }
183
+ function Xe(r) {
184
+ const e = b(48), {
185
+ open: i,
186
+ onOpenChange: t,
187
+ trigger: l,
188
+ state: n,
189
+ headerTitle: o,
190
+ bodyTitle: m,
191
+ infoMessage: c,
192
+ phoneNumber: a,
193
+ onPhoneNumberChange: d,
194
+ existingAccountErrorMessage: u,
195
+ phonePlaceholder: A,
196
+ countryCode: P,
197
+ icon: O,
198
+ isMobileOverride: $,
199
+ className: L
200
+ } = r, D = l === void 0 ? "system" : l, M = n === void 0 ? "addNumber" : n, C = a === void 0 ? "" : a, T = A === void 0 ? Ce : A, g = P === void 0 ? be : P, w = he(), h = $ ?? w, f = o ?? xe[D], x = m ?? ge[D], N = c ?? ee, _ = c == null;
201
+ let p;
202
+ e[0] !== g || e[1] !== C ? (p = pe(g, C), e[0] = g, e[1] = C, e[2] = p) : p = e[2];
203
+ const y = p;
204
+ let z;
205
+ e[3] !== t ? (z = () => {
206
+ t(!1);
207
+ }, e[3] = t, e[4] = z) : z = e[4];
208
+ const q = z;
209
+ let W, j;
210
+ e[5] !== h || e[6] !== i ? (W = () => {
211
+ if (h)
212
+ return i ? document.body.classList.add(J) : document.body.classList.remove(J), ke;
213
+ }, j = [h, i], e[5] = h, e[6] = i, e[7] = W, e[8] = j) : (W = e[7], j = e[8]), se.useEffect(W, j);
214
+ let Y;
215
+ e[9] !== L || e[10] !== g || e[11] !== u || e[12] !== q || e[13] !== O || e[14] !== _ || e[15] !== d || e[16] !== C || e[17] !== T || e[18] !== x || e[19] !== f || e[20] !== N || e[21] !== y || e[22] !== M || e[23] !== D ? (Y = {
216
+ trigger: D,
217
+ state: M,
218
+ headerTitle: f,
219
+ bodyTitle: x,
220
+ infoMessage: N,
221
+ isDefaultInfoMessage: _,
222
+ phoneNumber: C,
223
+ onPhoneNumberChange: d,
224
+ existingAccountErrorMessage: u,
225
+ phoneDisplay: y,
226
+ phonePlaceholder: T,
227
+ countryCode: g,
228
+ icon: O,
229
+ onClose: q,
230
+ className: L
231
+ }, e[9] = L, e[10] = g, e[11] = u, e[12] = q, e[13] = O, e[14] = _, e[15] = d, e[16] = C, e[17] = T, e[18] = x, e[19] = f, e[20] = N, e[21] = y, e[22] = M, e[23] = D, e[24] = Y) : Y = e[24];
232
+ const F = Y;
233
+ if (h) {
234
+ let K;
235
+ e[25] === Symbol.for("react.memo_cache_sentinel") ? (K = Z(ye, "flex h-auto max-h-[90vh] w-full flex-col overflow-hidden rounded-t-[16px] border-0 p-0"), e[25] = K) : K = e[25];
236
+ let S;
237
+ e[26] !== f ? (S = /* @__PURE__ */ s(ce, { className: "sr-only", children: /* @__PURE__ */ s(de, { children: f }) }), e[26] = f, e[27] = S) : S = e[27];
238
+ let U;
239
+ e[28] !== F ? (U = /* @__PURE__ */ s(V, { ...F, surface: "drawer" }), e[28] = F, e[29] = U) : U = e[29];
240
+ let B;
241
+ e[30] !== S || e[31] !== U ? (B = /* @__PURE__ */ v(fe, { "aria-describedby": void 0, className: K, "data-account-conflict-prompt-drawer-content": !0, children: [
242
+ S,
243
+ U
244
+ ] }), e[30] = S, e[31] = U, e[32] = B) : B = e[32];
245
+ let X;
246
+ return e[33] !== t || e[34] !== i || e[35] !== B ? (X = /* @__PURE__ */ s(me, { dismissible: !0, open: i, onOpenChange: t, children: B }), e[33] = t, e[34] = i, e[35] = B, e[36] = X) : X = e[36], X;
247
+ }
248
+ let I;
249
+ e[37] !== f ? (I = /* @__PURE__ */ s(oe, { className: "sr-only", children: /* @__PURE__ */ s(ne, { children: f }) }), e[37] = f, e[38] = I) : I = e[38];
250
+ let k;
251
+ e[39] !== F ? (k = /* @__PURE__ */ s(V, { ...F, surface: "dialog" }), e[39] = F, e[40] = k) : k = e[40];
252
+ let R;
253
+ e[41] !== I || e[42] !== k ? (R = /* @__PURE__ */ v(re, { "aria-describedby": void 0, className: "max-w-[320px] overflow-visible rounded-[16px] border-0 bg-transparent p-0 shadow-none", closeOnOutsideClick: !0, showCloseButton: !1, size: "sm", children: [
254
+ I,
255
+ k
256
+ ] }), e[41] = I, e[42] = k, e[43] = R) : R = e[43];
257
+ let G;
258
+ return e[44] !== t || e[45] !== i || e[46] !== R ? (G = /* @__PURE__ */ s(ae, { open: i, onOpenChange: t, modal: !0, children: R }), e[44] = t, e[45] = i, e[46] = R, e[47] = G) : G = e[47], G;
259
+ }
260
+ function ke() {
261
+ return document.body.classList.remove(J);
262
+ }
263
+ export {
264
+ Xe as DoctAccountConflictPrompt
265
+ };
@@ -0,0 +1,50 @@
1
+ "use client";
2
+ const o = "+91", C = "Enter number", T = "9825910X0X", O = "+91 9825910X0X", i = "user******@gmail.com", r = "Your mobile number required to complete certain actions as well as it's associated with security of your Docthub account.", s = {
3
+ system: "To continue..",
4
+ action: "Add mobile number"
5
+ }, c = {
6
+ system: "Add your mobile number",
7
+ action: "Keep your account secure"
8
+ }, u = "your accounts will be unified on login";
9
+ function _(n) {
10
+ return `This phone is already registered with “${n}”. Please use different phone number or login with this mobile number`;
11
+ }
12
+ const N = _(i);
13
+ function A(n) {
14
+ return n ? `Login with ‘${n}’` : "Login";
15
+ }
16
+ function L(n, e) {
17
+ const t = e.trim();
18
+ return t ? t.startsWith(n) ? t : `${n} ${t}` : n;
19
+ }
20
+ const P = {
21
+ system: {
22
+ addNumber: "Continue",
23
+ existingAccount: "Continue"
24
+ },
25
+ action: {
26
+ addNumber: "Save",
27
+ existingAccount: "Save"
28
+ }
29
+ }, E = "Add later";
30
+ function a(n) {
31
+ return n === "existingAccount";
32
+ }
33
+ export {
34
+ c as ACCOUNT_CONFLICT_PROMPT_BODY_TITLE,
35
+ o as ACCOUNT_CONFLICT_PROMPT_DEFAULT_COUNTRY_CODE,
36
+ N as ACCOUNT_CONFLICT_PROMPT_DEFAULT_EXISTING_ACCOUNT_ERROR,
37
+ r as ACCOUNT_CONFLICT_PROMPT_DEFAULT_INFO_MESSAGE,
38
+ i as ACCOUNT_CONFLICT_PROMPT_DEFAULT_MASKED_EMAIL,
39
+ O as ACCOUNT_CONFLICT_PROMPT_DEFAULT_PHONE_DISPLAY,
40
+ T as ACCOUNT_CONFLICT_PROMPT_DEFAULT_PHONE_NUMBER,
41
+ C as ACCOUNT_CONFLICT_PROMPT_DEFAULT_PHONE_PLACEHOLDER,
42
+ s as ACCOUNT_CONFLICT_PROMPT_HEADER_TITLE,
43
+ u as ACCOUNT_CONFLICT_PROMPT_LOGIN_UNIFY_HINT,
44
+ P as ACCOUNT_CONFLICT_PROMPT_PRIMARY_LABEL,
45
+ E as ACCOUNT_CONFLICT_PROMPT_SECONDARY_LABEL,
46
+ _ as buildExistingAccountError,
47
+ A as buildLoginWithPhoneLabel,
48
+ L as buildPhoneDisplay,
49
+ a as isPrimaryDisabled
50
+ };
@@ -0,0 +1,5 @@
1
+ "use client";
2
+ const C = "login-drawer-backdrop";
3
+ export {
4
+ C as ACCOUNT_CONFLICT_PROMPT_DRAWER_BACKDROP_CLASS
5
+ };
@@ -2,7 +2,7 @@
2
2
  import { jsx as a, jsxs as q, Fragment as Ie } from "react/jsx-runtime";
3
3
  import { c as fe } from "react-compiler-runtime";
4
4
  import { X as Re, ChevronDown as Ce, Check as er } from "lucide-react";
5
- import { useState as Z, useEffect as p, useDeferredValue as rr, useRef as O, useId as tr, useMemo as J, useCallback as P, memo as sr } from "react";
5
+ import { useState as Z, useEffect as K, useDeferredValue as rr, useRef as O, useId as tr, useMemo as J, useCallback as P, memo as sr } from "react";
6
6
  import { createPortal as cr } from "react-dom";
7
7
  import { Input as or } from "../../ui/input.js";
8
8
  import { useExclusiveDropdown as ir } from "../../../hooks/use-exclusive-dropdown.js";
@@ -68,8 +68,8 @@ const Te = (l) => {
68
68
  }, e[0] = S, e[1] = t, e[2] = y) : y = e[2];
69
69
  const f = y;
70
70
  let u;
71
- e[3] !== f ? (u = (H) => {
72
- (H.key === "Enter" || H.key === " ") && (H.preventDefault(), f());
71
+ e[3] !== f ? (u = (p) => {
72
+ (p.key === "Enter" || p.key === " ") && (p.preventDefault(), f());
73
73
  }, e[3] = f, e[4] = u) : u = e[4];
74
74
  const T = u, V = `
75
75
  px-3 py-2 cursor-pointer flex items-center justify-between
@@ -111,11 +111,11 @@ const Fe = (l) => {
111
111
  e[11] === Symbol.for("react.memo_cache_sentinel") ? (N = /* @__PURE__ */ a(Re, { className: "h-3 w-3" }), e[11] = N) : N = e[11];
112
112
  let b;
113
113
  e[12] !== x || e[13] !== V ? (b = /* @__PURE__ */ a("button", { type: "button", onClick: x, className: "ml-1 hover:bg-secondary-foreground/20 rounded-full p-0.5", "data-testid": "tag-remove", "aria-label": V, children: N }), e[12] = x, e[13] = V, e[14] = b) : b = e[14];
114
- let H;
115
- return e[15] !== d || e[16] !== f || e[17] !== u || e[18] !== b ? (H = /* @__PURE__ */ q(Se, { variant: "secondary", className: f, children: [
114
+ let p;
115
+ return e[15] !== d || e[16] !== f || e[17] !== u || e[18] !== b ? (p = /* @__PURE__ */ q(Se, { variant: "secondary", className: f, children: [
116
116
  u,
117
117
  b
118
- ] }, d), e[15] = d, e[16] = f, e[17] = u, e[18] = b, e[19] = H) : H = e[19], H;
118
+ ] }, d), e[15] = d, e[16] = f, e[17] = u, e[18] = b, e[19] = p) : p = e[19], p;
119
119
  };
120
120
  Fe.displayName = "AutocompleteTag";
121
121
  const Sr = ({
@@ -137,7 +137,7 @@ const Sr = ({
137
137
  label: V = "",
138
138
  helperText: N = "",
139
139
  error: b,
140
- required: H = !1,
140
+ required: p = !1,
141
141
  fullWidth: te = !0,
142
142
  clearable: ue = !0,
143
143
  disableCloseOnSelect: se = !1,
@@ -150,20 +150,20 @@ const Sr = ({
150
150
  fields: L,
151
151
  // New prop for field mapping
152
152
  noOptionsText: Ve = "No options",
153
- emptyMessage: He,
154
- className: Ke = "",
153
+ emptyMessage: pe,
154
+ className: He = "",
155
155
  inputClassName: ye = "",
156
156
  chipClassName: be,
157
157
  debounceMs: ie = 0,
158
158
  // New: Debounce filtering
159
159
  minSearchLength: xe = 0,
160
160
  // New prop: Min chars before search
161
- ntt: pe = !1,
161
+ ntt: Ke = !1,
162
162
  clearInputOnSelect: xr = !0,
163
163
  onPointerDown: _,
164
164
  ...ze
165
165
  }) => {
166
- const [n, w] = Z(!1), [k, A] = Z(""), [je, we] = Z(""), [z, g] = Z(-1), [I, R] = Z(!1), [M, Be] = Z({
166
+ const [n, w] = Z(!1), [k, A] = Z(""), [je, we] = Z(""), [z, g] = Z(-1), [I, R] = Z(!1), [G, Be] = Z({
167
167
  top: 0,
168
168
  left: 0,
169
169
  width: 0,
@@ -173,7 +173,7 @@ const Sr = ({
173
173
  containerProps: Ue,
174
174
  onOpenChange: ve
175
175
  } = ir();
176
- p(() => {
176
+ K(() => {
177
177
  if (ie <= 0) {
178
178
  we(k);
179
179
  return;
@@ -181,27 +181,27 @@ const Sr = ({
181
181
  const r = setTimeout(() => we(k), ie);
182
182
  return () => clearTimeout(r);
183
183
  }, [k, ie]);
184
- const G = rr(je), v = O(null), Ne = O(null), Q = O(null), W = O(null), Y = O(!1), Ee = tr(), X = e.length > 0 ? e : l, F = J(() => me || ((r, o) => yr(r, o, j, L)), [me, j, L]), C = P((r) => {
184
+ const X = rr(je), v = O(null), Ne = O(null), M = O(null), Q = O(null), W = O(!1), Ee = tr(), Y = e.length > 0 ? e : l, F = J(() => me || ((r, o) => yr(r, o, j, L)), [me, j, L]), C = P((r) => {
185
185
  if (r == null) return "";
186
186
  if (typeof r == "object") return E(r);
187
- const o = X.find((m) => F(m, r));
187
+ const o = Y.find((m) => F(m, r));
188
188
  if (o) return E(o);
189
189
  try {
190
190
  return String(r);
191
191
  } catch {
192
192
  return "";
193
193
  }
194
- }, [X, E, F]), B = J(() => {
195
- if (G.length < xe)
196
- return X;
197
- let r = X;
198
- return c && Array.isArray(t) && (r = X.filter((o) => !t.some((m) => F(o, m)))), !c && !I && t && G === E(t) ? r : ce ? ce(r, {
199
- inputValue: G
200
- }) : br(r, G, E, L);
194
+ }, [Y, E, F]), B = J(() => {
195
+ if (X.length < xe)
196
+ return Y;
197
+ let r = Y;
198
+ return c && Array.isArray(t) && (r = Y.filter((o) => !t.some((m) => F(o, m)))), !c && !I && t && X === E(t) ? r : ce ? ce(r, {
199
+ inputValue: X
200
+ }) : br(r, X, E, L);
201
201
  }, [
202
- X,
202
+ Y,
203
203
  t,
204
- G,
204
+ X,
205
205
  // Use deferred value
206
206
  ce,
207
207
  E,
@@ -214,11 +214,11 @@ const Sr = ({
214
214
  const o = r.target.value;
215
215
  R(!0), A(o), s == null || s(r, o), !n && o && w(!0);
216
216
  }, [n, s]);
217
- p(() => {
217
+ K(() => {
218
218
  if (c || I) return;
219
219
  const r = C(t);
220
220
  A(r);
221
- }, [t, c, I, C]), p(() => {
221
+ }, [t, c, I, C]), K(() => {
222
222
  i && process.env.NODE_ENV !== "production" && console.warn('[DoctAutocomplete] The "change" prop is deprecated. Please use "onChange" instead. "change" will be removed in v3.0.');
223
223
  }, [i]);
224
224
  const ee = P((r) => {
@@ -290,8 +290,8 @@ const Sr = ({
290
290
  }, ""));
291
291
  break;
292
292
  }
293
- }, [n, B, z, ee, x, k, c, s]), K = P(() => {
294
- const r = Ne.current ?? W.current;
293
+ }, [n, B, z, ee, x, k, c, s]), H = P(() => {
294
+ const r = Ne.current ?? Q.current;
295
295
  if (!r) return;
296
296
  const o = r.getBoundingClientRect(), m = dr(r);
297
297
  Be(lr({
@@ -300,34 +300,34 @@ const Sr = ({
300
300
  strategy: "absolute",
301
301
  clipRects: m
302
302
  }));
303
- }, []), Ze = P(() => {
304
- n || (K(), k === "" && (s == null || s({
303
+ }, []), Ye = P(() => {
304
+ n || (H(), k === "" && (s == null || s({
305
305
  target: {
306
306
  value: ""
307
307
  }
308
308
  }, ""))), w(!n);
309
- }, [n, K, k, s]), Je = P(() => {
310
- if (Y.current) {
311
- Y.current = !1, K(), R(!1), !c && !t && (A(""), s == null || s({
309
+ }, [n, H, k, s]), Ze = P(() => {
310
+ if (W.current) {
311
+ W.current = !1, H(), R(!1), !c && !t && (A(""), s == null || s({
312
312
  target: {
313
313
  value: ""
314
314
  }
315
315
  }, ""));
316
316
  return;
317
317
  }
318
- K(), R(!1), w(!0), !c && !t && (A(""), s == null || s({
318
+ H(), R(!1), w(!0), !c && !t && (A(""), s == null || s({
319
319
  target: {
320
320
  value: ""
321
321
  }
322
322
  }, ""));
323
- }, [K, c, t, s]), Me = P((r) => {
323
+ }, [H, c, t, s]), Je = P((r) => {
324
324
  document.activeElement === v.current && w((o) => !o), _ == null || _(r);
325
325
  }, [_]);
326
- p(() => {
326
+ K(() => {
327
327
  const r = (o) => {
328
328
  const m = o.target;
329
329
  if (!(n || c && k !== "")) return;
330
- const D = W.current ? !W.current.contains(m) : !0, de = Q.current ? !Q.current.contains(m) : !0;
330
+ const D = Q.current ? !Q.current.contains(m) : !0, de = M.current ? !M.current.contains(m) : !0;
331
331
  if (D && de) {
332
332
  if (w(!1), R(!1), c) {
333
333
  A(""), s == null || s({
@@ -348,12 +348,12 @@ const Sr = ({
348
348
  return document.addEventListener("pointerdown", r, !0), () => {
349
349
  document.removeEventListener("pointerdown", r, !0);
350
350
  };
351
- }, [c, s, C, t, n, k]), p(() => {
351
+ }, [c, s, C, t, n, k]), K(() => {
352
352
  if (!n || typeof window > "u") return;
353
353
  const r = () => {
354
- K();
355
- }, o = W.current, m = ar(o), $ = typeof ResizeObserver > "u" ? null : new ResizeObserver(() => {
356
- K();
354
+ H();
355
+ }, o = Q.current, m = ar(o), $ = typeof ResizeObserver > "u" ? null : new ResizeObserver(() => {
356
+ H();
357
357
  });
358
358
  return $ == null || $.observe(o ?? document.body), m.forEach((D) => {
359
359
  D.addEventListener("scroll", r, {
@@ -364,86 +364,87 @@ const Sr = ({
364
364
  D.removeEventListener("scroll", r);
365
365
  }), window.removeEventListener("resize", r);
366
366
  };
367
- }, [n, K]), p(() => {
368
- if (n && z >= 0 && Q.current) {
369
- const r = Q.current.children[z];
367
+ }, [n, H]), K(() => {
368
+ if (n && z >= 0 && M.current) {
369
+ const r = M.current.children[z];
370
370
  r && r.scrollIntoView({
371
371
  block: "nearest"
372
372
  });
373
373
  }
374
- }, [z, n]), p(() => {
374
+ }, [z, n]), K(() => {
375
375
  if (!n || !c) return;
376
376
  const r = requestAnimationFrame(() => {
377
- K();
377
+ H();
378
378
  });
379
379
  return () => cancelAnimationFrame(r);
380
- }, [n, c, t, K]), p(() => {
380
+ }, [n, c, t, H]), K(() => {
381
381
  w(!1);
382
- }, []), p(() => {
382
+ }, []), K(() => {
383
383
  ve(n);
384
384
  }, [n, ve]);
385
385
  const $e = P(() => {
386
386
  var r;
387
- document.activeElement !== v.current && (Y.current = !0), w(!1), c && (A(""), R(!1), s == null || s({
387
+ document.activeElement !== v.current && (W.current = !0), w(!1), c && (A(""), R(!1), s == null || s({
388
388
  target: {
389
389
  value: ""
390
390
  }
391
391
  }, "")), (r = v.current) == null || r.focus();
392
- }, [c, s]), Qe = J(() => !c || !Array.isArray(t) || t.length === 0 ? null : oe ? oe(t, le) : (
392
+ }, [c, s]), Me = J(() => !c || !Array.isArray(t) || t.length === 0 ? null : oe ? oe(t, le) : (
393
393
  // biome-ignore lint/a11y/noStaticElementInteractions: chips container wraps nested buttons (tag remove)
394
394
  // biome-ignore lint/a11y/useKeyWithClickEvents: Escape/click-outside already close; click is convenience
395
395
  /* @__PURE__ */ a("div", { className: "flex flex-wrap gap-1 mb-1 min-h-0", onClick: $e, children: t.map((r, o) => {
396
396
  const m = j ? String(j(r)) : `${E(r)}-${o}`;
397
397
  return /* @__PURE__ */ a(Fe, { tag: r, index: o, getOptionLabel: E, onRemove: le, chipClassName: be }, m);
398
398
  }) })
399
- ), [c, t, oe, le, $e, E, j, be]), We = J(() => `
399
+ ), [c, t, oe, le, $e, E, j, be]), Qe = J(() => `
400
400
  relative flex items-center rounded-md
401
401
  ${b ? "border border-destructive" : fr[T]}
402
402
  ${nr[u]}
403
403
  ${y ? "opacity-50 cursor-not-allowed" : "cursor-text"}
404
404
  transition-colors ${ye}
405
- `, [T, u, b, y, ye]), Ye = He ?? Ve;
406
- return /* @__PURE__ */ q("div", { className: `relative ${te ? "w-full" : "w-auto"} ${Ke}`, ref: W, children: [
405
+ `, [T, u, b, y, ye]), We = pe ?? Ve;
406
+ return /* @__PURE__ */ q("div", { className: `relative ${te ? "w-full" : "w-auto"} ${He}`, ref: Q, children: [
407
407
  V && /* @__PURE__ */ q("label", { htmlFor: Ee, className: "block text-sm font-medium mb-1 w-full", onClick: (r) => {
408
408
  var o;
409
- r.preventDefault(), document.activeElement !== v.current && (Y.current = !0), w(!1), c && (A(""), R(!1), s == null || s({
409
+ r.preventDefault(), document.activeElement !== v.current && (W.current = !0), w(!1), c && (A(""), R(!1), s == null || s({
410
410
  target: {
411
411
  value: ""
412
412
  }
413
413
  }, "")), (o = v.current) == null || o.focus();
414
414
  }, onKeyDown: (r) => {
415
415
  var o;
416
- (r.key === "Enter" || r.key === " ") && (r.preventDefault(), document.activeElement !== v.current && (Y.current = !0), w(!1), c && (A(""), R(!1), s == null || s({
416
+ (r.key === "Enter" || r.key === " ") && (r.preventDefault(), document.activeElement !== v.current && (W.current = !0), w(!1), c && (A(""), R(!1), s == null || s({
417
417
  target: {
418
418
  value: ""
419
419
  }
420
420
  }, "")), (o = v.current) == null || o.focus());
421
421
  }, children: [
422
422
  V,
423
- H && /* @__PURE__ */ a("span", { className: "text-destructive ml-1", children: "*" })
423
+ p && /* @__PURE__ */ a("span", { className: "text-destructive ml-1", children: "*" })
424
424
  ] }),
425
425
  /* @__PURE__ */ a("div", { ...Ue, children: /* @__PURE__ */ q("div", { className: "relative overflow-visible", children: [
426
- Qe,
427
- /* @__PURE__ */ q("div", { ref: Ne, className: We, children: [
428
- /* @__PURE__ */ a(or, { id: Ee, ref: v, value: k, onChange: qe, onKeyDown: Xe, onFocus: Je, onPointerDown: Me, placeholder: S, disabled: y, className: "px-0 border-0 shadow-none focus-visible:ring-0 focus-visible:ring-offset-0 bg-transparent rounded-md", ...ze }),
426
+ Me,
427
+ /* @__PURE__ */ q("div", { ref: Ne, className: Qe, children: [
428
+ /* @__PURE__ */ a(or, { id: Ee, ref: v, value: k, onChange: qe, onKeyDown: Xe, onFocus: Ze, onPointerDown: Je, placeholder: S, disabled: y, className: "px-0 border-0 shadow-none focus-visible:ring-0 focus-visible:ring-offset-0 bg-transparent rounded-md", ...ze }),
429
429
  /* @__PURE__ */ q("div", { className: "flex items-center gap-1 ml-auto", children: [
430
430
  f && /* @__PURE__ */ a("div", { className: "animate-spin rounded-full h-4 w-4 border-2 border-muted-foreground border-t-transparent" }),
431
431
  Ge && /* @__PURE__ */ a("button", { type: "button", onClick: Le, className: "p-1 hover:bg-accent rounded-sm transition-colors", tabIndex: -1, "data-testid": "autocomplete-clear", children: /* @__PURE__ */ a(Re, { className: "h-4 w-4 text-muted-foreground" }) }),
432
- /* @__PURE__ */ a("button", { type: "button", disabled: y, onClick: Ze, className: `p-1 hover:bg-accent rounded-sm transition-colors ${y ? "opacity-50 cursor-not-allowed" : "cursor-pointer"}`, tabIndex: -1, "data-testid": "autocomplete-toggle", children: /* @__PURE__ */ a(Ce, { className: `h-4 w-4 text-muted-foreground transition-transform ${n ? "rotate-180" : ""}` }) })
432
+ /* @__PURE__ */ a("button", { type: "button", disabled: y, onClick: Ye, className: `p-1 hover:bg-accent rounded-sm transition-colors ${y ? "opacity-50 cursor-not-allowed" : "cursor-pointer"}`, tabIndex: -1, "data-testid": "autocomplete-toggle", children: /* @__PURE__ */ a(Ce, { className: `h-4 w-4 text-muted-foreground transition-transform ${n ? "rotate-180" : ""}` }) })
433
433
  ] })
434
434
  ] }),
435
- n && M.maxHeight > 0 && cr(/* @__PURE__ */ a("div", { className: `
435
+ n && G.maxHeight > 0 && cr(/* @__PURE__ */ a("div", { className: `
436
436
  absolute bg-popover border border-border rounded-md shadow-lg
437
437
  max-h-60 overflow-auto z-[9999]
438
438
 
439
439
  `, style: {
440
- top: M.top,
441
- left: M.left,
442
- width: M.width,
443
- maxHeight: M.maxHeight
444
- }, ref: Q, children: B.length === 0 ? /* @__PURE__ */ a("div", { className: "p-3 text-sm text-muted-foreground text-center", children: Ye }) : B.map((r, o) => {
440
+ top: G.top,
441
+ left: G.left,
442
+ width: G.width,
443
+ maxHeight: G.maxHeight,
444
+ transform: G.placement === "top" ? "translateY(-100%)" : void 0
445
+ }, ref: M, children: B.length === 0 ? /* @__PURE__ */ a("div", { className: "p-3 text-sm text-muted-foreground text-center", children: We }) : B.map((r, o) => {
445
446
  const m = c ? Array.isArray(t) && t.some((U) => F(r, U)) : F(r, t), $ = o === z, D = j ? String(j(r)) : `${E(r)}-${o}`, de = (U) => U.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), h = (U) => {
446
- const ae = E(U), ne = pe ? String(G || "").trim() : "";
447
+ const ae = E(U), ne = Ke ? String(X || "").trim() : "";
447
448
  if (!ne) return /* @__PURE__ */ a("span", { children: ae });
448
449
  try {
449
450
  const he = new RegExp(`(${de(ne)})`, "ig"), Oe = ae.split(he);