@athbnb/ui 0.0.2 → 0.0.3

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,538 @@
1
+ import { c as e } from "react/compiler-runtime";
2
+ import { jsx as t, jsxs as n } from "react/jsx-runtime";
3
+ import * as r from "react";
4
+ //#region src/ui/TextInput.tsx
5
+ function i(r) {
6
+ let i = e(11), { label: a, name: o, required: s, error: c, isFocused: l, hasValue: u, labelBgClassName: d, inactiveTopClassName: f, labelRestClassName: p } = r, m = d === void 0 ? "bg-white" : d, h = l || u ? "-top-2.5 text-sm! text-secondary font-bold" : `${f === void 0 ? "top-2.5" : f} text-secondary/50 ${p === void 0 ? "w-11/12" : p}`, g = c ? "!text-red-500" : "", _;
7
+ i[0] !== m || i[1] !== h || i[2] !== g ? (_ = [
8
+ "absolute inline-block left-2 px-1 transition-all duration-300 ease-in-out sm:text-base text-sm pointer-events-none align-middle",
9
+ m,
10
+ h,
11
+ g
12
+ ].filter(Boolean), i[0] = m, i[1] = h, i[2] = g, i[3] = _) : _ = i[3];
13
+ let v = _.join(" "), y;
14
+ i[4] === s ? y = i[5] : (y = s ? /* @__PURE__ */ t("span", {
15
+ className: "text-red-500 ml-0.5",
16
+ children: "*"
17
+ }) : null, i[4] = s, i[5] = y);
18
+ let b;
19
+ return i[6] !== a || i[7] !== o || i[8] !== v || i[9] !== y ? (b = /* @__PURE__ */ n("label", {
20
+ htmlFor: o,
21
+ className: v,
22
+ children: [a, y]
23
+ }), i[6] = a, i[7] = o, i[8] = v, i[9] = y, i[10] = b) : b = i[10], b;
24
+ }
25
+ function a(e, t, n, r) {
26
+ return [e ? "border-red-500" : t || n ? "border-1 border-primary" : "border-1 border-primary/50", r ? "bg-white cursor-not-allowed border-1 border-primary/50 opacity-75" : ""].filter(Boolean).join(" ");
27
+ }
28
+ var o = (r) => {
29
+ let i = e(2), { open: a } = r, o;
30
+ return i[0] === a ? o = i[1] : (o = a ? /* @__PURE__ */ n("svg", {
31
+ xmlns: "http://www.w3.org/2000/svg",
32
+ width: "16",
33
+ height: "16",
34
+ viewBox: "0 0 24 24",
35
+ fill: "none",
36
+ stroke: "currentColor",
37
+ strokeWidth: "2",
38
+ className: "text-primary",
39
+ "aria-hidden": !0,
40
+ children: [/* @__PURE__ */ t("path", { d: "M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z" }), /* @__PURE__ */ t("circle", {
41
+ cx: "12",
42
+ cy: "12",
43
+ r: "3"
44
+ })]
45
+ }) : /* @__PURE__ */ n("svg", {
46
+ xmlns: "http://www.w3.org/2000/svg",
47
+ width: "16",
48
+ height: "16",
49
+ viewBox: "0 0 24 24",
50
+ fill: "none",
51
+ stroke: "currentColor",
52
+ strokeWidth: "2",
53
+ className: "text-secondary",
54
+ "aria-hidden": !0,
55
+ children: [/* @__PURE__ */ t("path", { d: "M17.94 17.94A10.07 10.07 0 0 1 12 20c-7 0-11-8-11-8a18.45 18.45 0 0 1 5.06-5.94M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 8 11 8a18.5 18.5 0 0 1-2.16 3.19m-6.72-1.07a3 3 0 1 1-4.24-4.24" }), /* @__PURE__ */ t("line", {
56
+ x1: "1",
57
+ y1: "1",
58
+ x2: "23",
59
+ y2: "23"
60
+ })]
61
+ }), i[0] = a, i[1] = o), o;
62
+ }, s = () => {
63
+ let r = e(1), i;
64
+ return r[0] === Symbol.for("react.memo_cache_sentinel") ? (i = /* @__PURE__ */ n("svg", {
65
+ xmlns: "http://www.w3.org/2000/svg",
66
+ width: "24",
67
+ height: "24",
68
+ viewBox: "0 0 24 24",
69
+ fill: "none",
70
+ stroke: "currentColor",
71
+ strokeWidth: "2",
72
+ className: "min-w-6 min-h-6 shrink-0 text-red-500 pe-2",
73
+ "aria-hidden": !0,
74
+ children: [
75
+ /* @__PURE__ */ t("circle", {
76
+ cx: "12",
77
+ cy: "12",
78
+ r: "10"
79
+ }),
80
+ /* @__PURE__ */ t("line", {
81
+ x1: "12",
82
+ y1: "8",
83
+ x2: "12",
84
+ y2: "12"
85
+ }),
86
+ /* @__PURE__ */ t("line", {
87
+ x1: "12",
88
+ y1: "16",
89
+ x2: "12.01",
90
+ y2: "16"
91
+ })
92
+ ]
93
+ }), r[0] = i) : i = r[0], i;
94
+ };
95
+ function c(s) {
96
+ let c = e(83), u, d, f, p, m, h, g, _, v, y, b, x, S, C, w, T, E, D;
97
+ c[0] === s ? (u = c[1], d = c[2], f = c[3], p = c[4], m = c[5], h = c[6], g = c[7], _ = c[8], v = c[9], y = c[10], b = c[11], x = c[12], S = c[13], C = c[14], w = c[15], T = c[16], E = c[17], D = c[18]) : ({label: g, name: f, type: b, value: x, onChange: m, onBlur: p, error: S, description: C, helperText: w, required: T, disabled: E, className: D, leftComponent: _, rightComponent: v, bgColorForLabel: y, dateMin: d, dateMax: u, ...h} = s, c[0] = s, c[1] = u, c[2] = d, c[3] = f, c[4] = p, c[5] = m, c[6] = h, c[7] = g, c[8] = _, c[9] = v, c[10] = y, c[11] = b, c[12] = x, c[13] = S, c[14] = C, c[15] = w, c[16] = T, c[17] = E, c[18] = D);
98
+ let O = g === void 0 ? "" : g, k = b === void 0 ? "text" : b, A = x === void 0 ? "" : x, j = S === void 0 ? "" : S, M = C === void 0 ? "" : C, N = w === void 0 ? "" : w, P = T === void 0 ? !1 : T, F = E === void 0 ? !1 : E, I = D === void 0 ? "" : D, L = _ === void 0 ? null : _, R = v === void 0 ? null : v, z = y === void 0 ? "bg-white" : y, ee = r.useRef(null), [B, V] = r.useState(!1), [H, U] = r.useState(!1), W = k === "password", G = W ? H ? "text" : "password" : k, K;
99
+ c[19] !== u || c[20] !== d || c[21] !== k ? (K = k === "date" ? {
100
+ min: d ?? new Date((/* @__PURE__ */ new Date()).setFullYear((/* @__PURE__ */ new Date()).getFullYear() - 100)).toISOString().split("T")[0],
101
+ max: u ?? (/* @__PURE__ */ new Date()).toISOString().split("T")[0]
102
+ } : {}, c[19] = u, c[20] = d, c[21] = k, c[22] = K) : K = c[22];
103
+ let q = K, J = `${I} ${F ? "opacity-75" : ""}`, Y = !!A, X;
104
+ c[23] !== F || c[24] !== j || c[25] !== B || c[26] !== Y ? (X = a(j, B, Y, F), c[23] = F, c[24] = j, c[25] = B, c[26] = Y, c[27] = X) : X = c[27];
105
+ let Z;
106
+ c[28] === X ? Z = c[29] : (Z = ["relative peer w-full sm:h-[48px] h-[42px] px-3 text-base bg-transparent border rounded-md outline-none transition-all text-[14px] flex items-center", X], c[28] = X, c[29] = Z);
107
+ let te = Z.join(" "), Q;
108
+ c[30] !== q || c[31] !== k ? (Q = k === "date" ? q : {}, c[30] = q, c[31] = k, c[32] = Q) : Q = c[32];
109
+ let $;
110
+ c[33] === k ? $ = c[34] : ($ = () => {
111
+ k === "date" && ee.current?.showPicker && ee.current.showPicker(), V(!0);
112
+ }, c[33] = k, c[34] = $);
113
+ let ne;
114
+ c[35] === p ? ne = c[36] : (ne = (e) => {
115
+ V(!1), p?.(e);
116
+ }, c[35] = p, c[36] = ne);
117
+ let re = F ? "cursor-not-allowed" : "", ie = W ? "pr-6" : "", ae;
118
+ c[37] !== re || c[38] !== ie ? (ae = [
119
+ "outline-0 w-full text-[16px] sm:text-[14px] bg-transparent",
120
+ re,
121
+ ie
122
+ ].filter(Boolean), c[37] = re, c[38] = ie, c[39] = ae) : ae = c[39];
123
+ let oe = ae.join(" "), se;
124
+ c[40] !== G || c[41] !== F || c[42] !== f || c[43] !== m || c[44] !== h || c[45] !== Q || c[46] !== $ || c[47] !== ne || c[48] !== oe || c[49] !== A ? (se = /* @__PURE__ */ t("input", {
125
+ id: f,
126
+ name: f,
127
+ type: G,
128
+ value: A,
129
+ disabled: F,
130
+ ...Q,
131
+ onChange: m,
132
+ onFocus: $,
133
+ onBlur: ne,
134
+ placeholder: "",
135
+ ref: ee,
136
+ className: oe,
137
+ ...h
138
+ }), c[40] = G, c[41] = F, c[42] = f, c[43] = m, c[44] = h, c[45] = Q, c[46] = $, c[47] = ne, c[48] = oe, c[49] = A, c[50] = se) : se = c[50];
139
+ let ce;
140
+ c[51] !== W || c[52] !== R || c[53] !== H ? (ce = W ? /* @__PURE__ */ t("button", {
141
+ type: "button",
142
+ className: "absolute right-3 top-1/2 -translate-y-1/2 text-secondary cursor-pointer border-0 bg-transparent p-0",
143
+ onClick: () => U(l),
144
+ tabIndex: -1,
145
+ "aria-label": H ? "Hide password" : "Show password",
146
+ children: /* @__PURE__ */ t(o, { open: H })
147
+ }) : R, c[51] = W, c[52] = R, c[53] = H, c[54] = ce) : ce = c[54];
148
+ let le;
149
+ c[55] === ce ? le = c[56] : (le = /* @__PURE__ */ t("div", {
150
+ className: "z-[5]",
151
+ children: ce
152
+ }), c[55] = ce, c[56] = le);
153
+ let ue = !!F, de = !!A, fe = k === "date" ? "w-10/12" : "w-11/12", pe;
154
+ c[57] !== z || c[58] !== j || c[59] !== B || c[60] !== O || c[61] !== f || c[62] !== P || c[63] !== ue || c[64] !== de || c[65] !== fe ? (pe = /* @__PURE__ */ t(i, {
155
+ label: O,
156
+ name: f,
157
+ required: P,
158
+ error: j,
159
+ disabled: ue,
160
+ isFocused: B,
161
+ hasValue: de,
162
+ labelBgClassName: z,
163
+ labelRestClassName: fe
164
+ }), c[57] = z, c[58] = j, c[59] = B, c[60] = O, c[61] = f, c[62] = P, c[63] = ue, c[64] = de, c[65] = fe, c[66] = pe) : pe = c[66];
165
+ let me;
166
+ c[67] !== L || c[68] !== te || c[69] !== se || c[70] !== le || c[71] !== pe ? (me = /* @__PURE__ */ n("div", {
167
+ className: te,
168
+ children: [
169
+ L,
170
+ se,
171
+ le,
172
+ pe
173
+ ]
174
+ }), c[67] = L, c[68] = te, c[69] = se, c[70] = le, c[71] = pe, c[72] = me) : me = c[72];
175
+ let he;
176
+ c[73] !== j || c[74] !== N ? (he = (j || N) && /* @__PURE__ */ t("p", {
177
+ className: `mt-1 text-sm ${j ? "text-red-500" : "text-secondary/50"}`,
178
+ children: j || N
179
+ }), c[73] = j, c[74] = N, c[75] = he) : he = c[75];
180
+ let ge;
181
+ c[76] === M ? ge = c[77] : (ge = M ? /* @__PURE__ */ t("div", {
182
+ className: "mt-1 sm:text-base text-sm text-secondary/60",
183
+ children: M
184
+ }) : null, c[76] = M, c[77] = ge);
185
+ let _e;
186
+ return c[78] !== J || c[79] !== me || c[80] !== he || c[81] !== ge ? (_e = /* @__PURE__ */ n("div", {
187
+ className: J,
188
+ children: [
189
+ me,
190
+ he,
191
+ ge
192
+ ]
193
+ }), c[78] = J, c[79] = me, c[80] = he, c[81] = ge, c[82] = _e) : _e = c[82], _e;
194
+ }
195
+ function l(e) {
196
+ return !e;
197
+ }
198
+ function u(o) {
199
+ let s = e(61), c, l, u, d, f, p, m, h, g, _, v, y, b, x, S;
200
+ s[0] === o ? (c = s[1], l = s[2], u = s[3], d = s[4], f = s[5], p = s[6], m = s[7], h = s[8], g = s[9], _ = s[10], v = s[11], y = s[12], b = s[13], x = s[14], S = s[15]) : ({label: p, name: l, value: h, onChange: d, onBlur: u, error: g, helperText: _, required: v, disabled: y, className: b, rows: x, maxLength: c, bgColorForLabel: S, placeholder: m, ...f} = o, s[0] = o, s[1] = c, s[2] = l, s[3] = u, s[4] = d, s[5] = f, s[6] = p, s[7] = m, s[8] = h, s[9] = g, s[10] = _, s[11] = v, s[12] = y, s[13] = b, s[14] = x, s[15] = S);
201
+ let C = p === void 0 ? "" : p, w = h === void 0 ? "" : h, T = g === void 0 ? "" : g, E = _ === void 0 ? "" : _, D = v === void 0 ? !1 : v, O = y === void 0 ? !1 : y, k = b === void 0 ? "" : b, A = x === void 0 ? 4 : x, j = S === void 0 ? "bg-white" : S, M = m === void 0 ? "" : m, [N, P] = r.useState(!1), F = N || !!w, I = `${k} ${O ? "opacity-75" : ""}`, L = !!w, R;
202
+ s[16] !== O || s[17] !== T || s[18] !== N || s[19] !== L ? (R = a(T, N, L, O), s[16] = O, s[17] = T, s[18] = N, s[19] = L, s[20] = R) : R = s[20];
203
+ let z;
204
+ s[21] === R ? z = s[22] : (z = ["relative w-full px-3 pt-4 pb-2 text-base bg-transparent border rounded-md outline-none transition-all text-[14px]", R], s[21] = R, s[22] = z);
205
+ let ee = z.join(" "), B;
206
+ s[23] === Symbol.for("react.memo_cache_sentinel") ? (B = () => P(!0), s[23] = B) : B = s[23];
207
+ let V;
208
+ s[24] === u ? V = s[25] : (V = (e) => {
209
+ P(!1), u?.(e);
210
+ }, s[24] = u, s[25] = V);
211
+ let H = F ? M : "", U = `outline-0 w-full text-[16px] sm:text-[14px] resize-none bg-transparent ${O ? "cursor-not-allowed" : ""}`, W;
212
+ s[26] !== O || s[27] !== c || s[28] !== l || s[29] !== d || s[30] !== f || s[31] !== A || s[32] !== V || s[33] !== H || s[34] !== U || s[35] !== w ? (W = /* @__PURE__ */ t("textarea", {
213
+ id: l,
214
+ name: l,
215
+ value: w,
216
+ disabled: O,
217
+ rows: A,
218
+ maxLength: c,
219
+ onChange: d,
220
+ onFocus: B,
221
+ onBlur: V,
222
+ placeholder: H,
223
+ className: U,
224
+ ...f
225
+ }), s[26] = O, s[27] = c, s[28] = l, s[29] = d, s[30] = f, s[31] = A, s[32] = V, s[33] = H, s[34] = U, s[35] = w, s[36] = W) : W = s[36];
226
+ let G = !!O, K = !!w, q;
227
+ s[37] !== j || s[38] !== T || s[39] !== N || s[40] !== C || s[41] !== l || s[42] !== D || s[43] !== G || s[44] !== K ? (q = /* @__PURE__ */ t(i, {
228
+ label: C,
229
+ name: l,
230
+ required: D,
231
+ error: T,
232
+ disabled: G,
233
+ isFocused: N,
234
+ hasValue: K,
235
+ labelBgClassName: j,
236
+ inactiveTopClassName: "top-3.5",
237
+ labelRestClassName: "w-11/12"
238
+ }), s[37] = j, s[38] = T, s[39] = N, s[40] = C, s[41] = l, s[42] = D, s[43] = G, s[44] = K, s[45] = q) : q = s[45];
239
+ let J;
240
+ s[46] !== c || s[47] !== w ? (J = c == null ? null : /* @__PURE__ */ n("span", {
241
+ className: "absolute bottom-2 right-3 text-xs text-secondary/40",
242
+ children: [
243
+ String(w).length,
244
+ "/",
245
+ c
246
+ ]
247
+ }), s[46] = c, s[47] = w, s[48] = J) : J = s[48];
248
+ let Y;
249
+ s[49] !== ee || s[50] !== W || s[51] !== q || s[52] !== J ? (Y = /* @__PURE__ */ n("div", {
250
+ className: ee,
251
+ children: [
252
+ W,
253
+ q,
254
+ J
255
+ ]
256
+ }), s[49] = ee, s[50] = W, s[51] = q, s[52] = J, s[53] = Y) : Y = s[53];
257
+ let X;
258
+ s[54] !== T || s[55] !== E ? (X = (T || E) && /* @__PURE__ */ t("p", {
259
+ className: `mt-1 text-sm ${T ? "text-red-500" : "text-secondary/50"}`,
260
+ children: T || E
261
+ }), s[54] = T, s[55] = E, s[56] = X) : X = s[56];
262
+ let Z;
263
+ return s[57] !== I || s[58] !== Y || s[59] !== X ? (Z = /* @__PURE__ */ n("div", {
264
+ className: I,
265
+ children: [Y, X]
266
+ }), s[57] = I, s[58] = Y, s[59] = X, s[60] = Z) : Z = s[60], Z;
267
+ }
268
+ function d(i) {
269
+ let o = e(65), s, c, l, u, d, p, m, h, g, _, v, y, b, x, S;
270
+ o[0] === i ? (s = o[1], c = o[2], l = o[3], u = o[4], d = o[5], p = o[6], m = o[7], h = o[8], g = o[9], _ = o[10], v = o[11], y = o[12], b = o[13], x = o[14], S = o[15]) : ({label: m, name: c, value: h, onChange: u, onBlur: l, error: g, description: _, helperText: v, countryOptions: y, countryCode: s, onSelectCountryCode: d, required: b, disabled: x, className: S, ...p} = i, o[0] = i, o[1] = s, o[2] = c, o[3] = l, o[4] = u, o[5] = d, o[6] = p, o[7] = m, o[8] = h, o[9] = g, o[10] = _, o[11] = v, o[12] = y, o[13] = b, o[14] = x, o[15] = S);
271
+ let C = m === void 0 ? "" : m, w = h === void 0 ? "" : h, T = g === void 0 ? "" : g, E = _ === void 0 ? "" : _, D = v === void 0 ? "" : v, O;
272
+ o[16] === y ? O = o[17] : (O = y === void 0 ? [] : y, o[16] = y, o[17] = O);
273
+ let k = O, A = b === void 0 ? !1 : b, j = x === void 0 ? !1 : x, M = S === void 0 ? "" : S, [N, P] = r.useState(!1), F = N || !!w, I = !!s && k && k.length > 0, L = `relative ${M}`, R, z;
274
+ o[18] === Symbol.for("react.memo_cache_sentinel") ? (R = () => P(!0), z = () => P(!1), o[18] = R, o[19] = z) : (R = o[18], z = o[19]);
275
+ let ee = !!w, B;
276
+ o[20] !== j || o[21] !== T || o[22] !== N || o[23] !== ee ? (B = a(T, N, ee, j), o[20] = j, o[21] = T, o[22] = N, o[23] = ee, o[24] = B) : B = o[24];
277
+ let V;
278
+ o[25] === B ? V = o[26] : (V = ["flex items-center border sm:h-[48px] h-[42px] px-3 rounded-md transition-all bg-white", B], o[25] = B, o[26] = V);
279
+ let H = V.join(" "), U;
280
+ o[27] !== s || o[28] !== k || o[29] !== j || o[30] !== d || o[31] !== I ? (U = I ? /* @__PURE__ */ t("select", {
281
+ disabled: j,
282
+ className: "text-sm bg-transparent outline-none border-none mr-2",
283
+ value: s,
284
+ onChange: d,
285
+ children: k.map(f)
286
+ }) : null, o[27] = s, o[28] = k, o[29] = j, o[30] = d, o[31] = I, o[32] = U) : U = o[32];
287
+ let W;
288
+ o[33] !== j || o[34] !== c || o[35] !== l || o[36] !== u || o[37] !== p || o[38] !== w ? (W = /* @__PURE__ */ t("input", {
289
+ id: c,
290
+ name: c,
291
+ type: "tel",
292
+ value: w,
293
+ disabled: j,
294
+ onChange: u,
295
+ onBlur: l,
296
+ placeholder: "",
297
+ className: "peer w-full text-base bg-transparent outline-none text-[16px] sm:text-[14px]",
298
+ ...p
299
+ }), o[33] = j, o[34] = c, o[35] = l, o[36] = u, o[37] = p, o[38] = w, o[39] = W) : W = o[39];
300
+ let G;
301
+ o[40] !== H || o[41] !== U || o[42] !== W ? (G = /* @__PURE__ */ n("div", {
302
+ className: H,
303
+ children: [U, W]
304
+ }), o[40] = H, o[41] = U, o[42] = W, o[43] = G) : G = o[43];
305
+ let K = F ? "-top-2.5 text-sm! text-secondary bg-white font-bold" : "top-2.5 text-secondary/50 w-11/12", q = T ? "!text-red-500" : "", J;
306
+ o[44] !== K || o[45] !== q ? (J = [
307
+ "absolute left-2 px-1 transition-all duration-300 ease-in-out bg-white sm:text-base text-sm pointer-events-none",
308
+ K,
309
+ q
310
+ ], o[44] = K, o[45] = q, o[46] = J) : J = o[46];
311
+ let Y = J.join(" "), X;
312
+ o[47] === A ? X = o[48] : (X = A ? /* @__PURE__ */ t("span", {
313
+ className: "text-red-500 ml-0.5",
314
+ children: "*"
315
+ }) : null, o[47] = A, o[48] = X);
316
+ let Z;
317
+ o[49] !== C || o[50] !== c || o[51] !== Y || o[52] !== X ? (Z = /* @__PURE__ */ n("label", {
318
+ htmlFor: c,
319
+ className: Y,
320
+ children: [C, X]
321
+ }), o[49] = C, o[50] = c, o[51] = Y, o[52] = X, o[53] = Z) : Z = o[53];
322
+ let te;
323
+ o[54] !== T || o[55] !== D ? (te = (T || D) && /* @__PURE__ */ t("p", {
324
+ className: `mt-1 text-sm ${T ? "text-red-500" : "text-secondary/50"}`,
325
+ children: T || D
326
+ }), o[54] = T, o[55] = D, o[56] = te) : te = o[56];
327
+ let Q;
328
+ o[57] === E ? Q = o[58] : (Q = E ? /* @__PURE__ */ t("div", {
329
+ className: "mt-1 sm:text-base text-sm text-secondary/60",
330
+ children: E
331
+ }) : null, o[57] = E, o[58] = Q);
332
+ let $;
333
+ return o[59] !== L || o[60] !== G || o[61] !== Z || o[62] !== te || o[63] !== Q ? ($ = /* @__PURE__ */ n("div", {
334
+ className: L,
335
+ onFocus: R,
336
+ onBlur: z,
337
+ children: [
338
+ G,
339
+ Z,
340
+ te,
341
+ Q
342
+ ]
343
+ }), o[59] = L, o[60] = G, o[61] = Z, o[62] = te, o[63] = Q, o[64] = $) : $ = o[64], $;
344
+ }
345
+ function f(e) {
346
+ return /* @__PURE__ */ n("option", {
347
+ value: e.code,
348
+ children: [
349
+ e.code,
350
+ " (",
351
+ e.dialCode,
352
+ ")"
353
+ ]
354
+ }, e.code);
355
+ }
356
+ function p({ label: e = "", name: o, value: s = "", onChange: c, onBlur: l, onSelect: u, fetchSuggestions: d, debounceMs: f = 300, minQueryLength: p = 4, error: m = "", helperText: h = "", required: g = !1, disabled: _ = !1, className: v = "", ...y }) {
357
+ let [b, x] = r.useState(!1), [S, C] = r.useState([]), [w, T] = r.useState(!1), [E, D] = r.useState(!1), O = r.useRef(null), k = r.useRef(null), A = r.useRef(!1), j = r.useRef(!1);
358
+ r.useEffect(() => {
359
+ if (A.current) {
360
+ A.current = !1, j.current = !1;
361
+ return;
362
+ }
363
+ if (!s || s.length < p) {
364
+ C([]), D(!1);
365
+ return;
366
+ }
367
+ if (!j.current) return;
368
+ let e = setTimeout(async () => {
369
+ try {
370
+ T(!0);
371
+ let e = await d(s);
372
+ C(e), D(e.length > 0);
373
+ } catch {
374
+ C([]), D(!1);
375
+ } finally {
376
+ T(!1);
377
+ }
378
+ }, f);
379
+ return () => clearTimeout(e);
380
+ }, [
381
+ s,
382
+ d,
383
+ f,
384
+ p
385
+ ]), r.useEffect(() => {
386
+ let e = (e) => {
387
+ k.current && !k.current.contains(e.target) && O.current && !O.current.contains(e.target) && D(!1);
388
+ };
389
+ return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
390
+ }, []);
391
+ let M = (e) => {
392
+ let t = e.value ?? e.postalCode ?? e.description ?? "";
393
+ A.current = !0, c?.({ target: {
394
+ value: t,
395
+ name: o ?? ""
396
+ } }), u?.(e), D(!1), C([]);
397
+ };
398
+ return /* @__PURE__ */ n("div", {
399
+ className: `relative ${v} ${_ ? "opacity-75" : ""}`,
400
+ children: [
401
+ /* @__PURE__ */ n("div", {
402
+ className: ["relative peer w-full sm:h-[48px] h-[42px] px-3 text-base bg-transparent border rounded-md outline-none transition-all text-[14px] flex items-center", a(m, b, !!s, _)].join(" "),
403
+ children: [
404
+ /* @__PURE__ */ t("input", {
405
+ id: o,
406
+ name: o,
407
+ type: "text",
408
+ value: s,
409
+ disabled: _,
410
+ onChange: (e) => {
411
+ j.current = !0, c?.(e);
412
+ },
413
+ onFocus: () => x(!0),
414
+ onBlur: (e) => {
415
+ setTimeout(() => x(!1), 200), l?.(e);
416
+ },
417
+ placeholder: "",
418
+ ref: O,
419
+ className: `outline-0 w-full text-[16px] sm:text-[14px] ${_ ? "cursor-not-allowed" : ""}`,
420
+ autoComplete: "off",
421
+ ...y
422
+ }),
423
+ w ? /* @__PURE__ */ t("div", {
424
+ className: "absolute right-3 top-1/2 -translate-y-1/2",
425
+ children: /* @__PURE__ */ t("div", { className: "animate-spin rounded-full h-4 w-4 border-b-2 border-primary" })
426
+ }) : null,
427
+ /* @__PURE__ */ t(i, {
428
+ label: e,
429
+ name: o,
430
+ required: g,
431
+ error: m,
432
+ disabled: !!_,
433
+ isFocused: b,
434
+ hasValue: !!s
435
+ })
436
+ ]
437
+ }),
438
+ E && S.length > 0 ? /* @__PURE__ */ t("div", {
439
+ ref: k,
440
+ className: "absolute z-50 w-full mt-1 bg-white border border-primary/50 rounded-md shadow-lg max-h-60 overflow-y-auto",
441
+ children: S.map((e, r) => /* @__PURE__ */ n("div", {
442
+ role: "option",
443
+ tabIndex: 0,
444
+ className: "px-4 py-3 hover:bg-primary/10 cursor-pointer transition-colors border-b border-primary/10 last:border-b-0",
445
+ onClick: () => M(e),
446
+ onKeyDown: (t) => {
447
+ (t.key === "Enter" || t.key === " ") && (t.preventDefault(), M(e));
448
+ },
449
+ children: [/* @__PURE__ */ t("p", {
450
+ className: "text-sm text-secondary font-medium",
451
+ children: e.formattedAddress || e.description
452
+ }), e.secondaryText ? /* @__PURE__ */ t("p", {
453
+ className: "text-xs text-secondary/60 mt-0.5",
454
+ children: e.secondaryText
455
+ }) : null]
456
+ }, e.id ?? r))
457
+ }) : null,
458
+ (m || h) && /* @__PURE__ */ t("p", {
459
+ className: `mt-1 text-sm ${m ? "text-red-500" : "text-secondary/50"}`,
460
+ children: m || h
461
+ })
462
+ ]
463
+ });
464
+ }
465
+ function m(r) {
466
+ let i = e(32), { placeholder: a, value: o, onChange: c, error: l, inputProps: u, label: d, labelClassName: f, description: p, descriptionClassName: m, leftComponent: h, rightComponent: g, className: _, containerClassName: v, errorClassName: y } = r, b = a === void 0 ? "Enter text" : a, x;
467
+ i[0] === u ? x = i[1] : (x = u === void 0 ? {} : u, i[0] = u, i[1] = x);
468
+ let S = x, C = f === void 0 ? "" : f, w = m === void 0 ? "" : m, T = _ === void 0 ? "" : _, E = v === void 0 ? "" : v, D = y === void 0 ? "" : y, O;
469
+ i[2] !== d || i[3] !== C ? (O = d ? /* @__PURE__ */ t("label", {
470
+ className: `block text-sm sm:text-lg font-bold text-secondary mb-1 ${C}`,
471
+ children: d
472
+ }) : null, i[2] = d, i[3] = C, i[4] = O) : O = i[4];
473
+ let k;
474
+ i[5] !== p || i[6] !== w ? (k = p ? /* @__PURE__ */ t("div", {
475
+ className: `block text-xs sm:text-base text-secondary/50 mb-2 ${w}`,
476
+ children: p
477
+ }) : null, i[5] = p, i[6] = w, i[7] = k) : k = i[7];
478
+ let A = "flex items-center rounded-medium sm:rounded-primary md:rounded-medium lg:rounded-primary bg-white outline -outline-offset-1 outline-primary/50 has-[input:focus-within]:outline-1 has-[input:focus-within]:outline-offset-1 has-[input:focus-within]:outline-primary text-sm sm:text-base " + E, j;
479
+ i[8] === c ? j = i[9] : (j = (e) => c?.(e.currentTarget.value), i[8] = c, i[9] = j);
480
+ let M = "block min-w-0 grow sm:py-2.5 py-1.5 pr-3 pl-3 text-[16px] sm:text-[14px] focus:outline-none " + T, N;
481
+ i[10] !== S || i[11] !== b || i[12] !== j || i[13] !== M || i[14] !== o ? (N = /* @__PURE__ */ t("input", {
482
+ placeholder: b,
483
+ value: o,
484
+ onChange: j,
485
+ className: M,
486
+ ...S
487
+ }), i[10] = S, i[11] = b, i[12] = j, i[13] = M, i[14] = o, i[15] = N) : N = i[15];
488
+ let P;
489
+ i[16] !== l || i[17] !== g ? (P = l ? /* @__PURE__ */ t(s, {}) : g, i[16] = l, i[17] = g, i[18] = P) : P = i[18];
490
+ let F;
491
+ i[19] !== h || i[20] !== A || i[21] !== N || i[22] !== P ? (F = /* @__PURE__ */ n("div", {
492
+ className: A,
493
+ children: [
494
+ h,
495
+ N,
496
+ P
497
+ ]
498
+ }), i[19] = h, i[20] = A, i[21] = N, i[22] = P, i[23] = F) : F = i[23];
499
+ let I;
500
+ i[24] !== l || i[25] !== D ? (I = l ? /* @__PURE__ */ t("div", {
501
+ className: "text-2xs font-semibold text-red-500 mt-0.75 pl-3 " + D,
502
+ children: l
503
+ }) : null, i[24] = l, i[25] = D, i[26] = I) : I = i[26];
504
+ let L;
505
+ return i[27] !== k || i[28] !== F || i[29] !== I || i[30] !== O ? (L = /* @__PURE__ */ n("div", {
506
+ className: "w-full",
507
+ children: [
508
+ O,
509
+ k,
510
+ F,
511
+ I
512
+ ]
513
+ }), i[27] = k, i[28] = F, i[29] = I, i[30] = O, i[31] = L) : L = i[31], L;
514
+ }
515
+ function h(n) {
516
+ let r = e(10);
517
+ if (n.variant === "stacked") {
518
+ let e;
519
+ return r[0] === n ? e = r[1] : (e = /* @__PURE__ */ t(m, { ...n }), r[0] = n, r[1] = e), e;
520
+ }
521
+ let i = n.kind ?? "text";
522
+ if (i === "textarea") {
523
+ let e = n, i;
524
+ return r[2] === e ? i = r[3] : (i = /* @__PURE__ */ t(u, { ...e }), r[2] = e, r[3] = i), i;
525
+ }
526
+ if (i === "phone") {
527
+ let e = n, i;
528
+ return r[4] === e ? i = r[5] : (i = /* @__PURE__ */ t(d, { ...e }), r[4] = e, r[5] = i), i;
529
+ }
530
+ if (i === "autocomplete") {
531
+ let e = n, i;
532
+ return r[6] === e ? i = r[7] : (i = /* @__PURE__ */ t(p, { ...e }), r[6] = e, r[7] = i), i;
533
+ }
534
+ let a = n, o;
535
+ return r[8] === a ? o = r[9] : (o = /* @__PURE__ */ t(c, { ...a }), r[8] = a, r[9] = o), o;
536
+ }
537
+ //#endregion
538
+ export { h as TextInput };