react-country-kit 1.3.0 โ 2.0.0
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.
- package/dist/components/CountryMultiSelect/CountryMultiSelect.d.ts +2 -2
- package/dist/components/CountryMultiSelect.d.ts +2 -0
- package/dist/components/CountryPicker/CountryPicker.d.ts +2 -2
- package/dist/components/CountryPicker.d.ts +2 -0
- package/dist/components/CurrencyMultiSelect/CurrencyMultiSelect.d.ts +2 -2
- package/dist/components/CurrencyMultiSelect.d.ts +2 -0
- package/dist/components/CurrencyPicker/CurrencyPicker.d.ts +2 -2
- package/dist/components/CurrencyPicker.d.ts +2 -0
- package/dist/components/DivisionPicker/DivisionPicker.d.ts +2 -2
- package/dist/components/DivisionPicker.d.ts +2 -0
- package/dist/components/LanguagePicker/LanguagePicker.d.ts +2 -2
- package/dist/components/LanguagePicker.d.ts +2 -0
- package/dist/components/PhoneInput/PhoneInput.d.ts +2 -2
- package/dist/components/PhoneInput.d.ts +3 -0
- package/dist/components/TimezonePicker/TimezonePicker.d.ts +2 -2
- package/dist/components/TimezonePicker.d.ts +2 -0
- package/dist/components/primitives.d.ts +82 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs.map +1 -0
- package/dist/lib/utils.d.ts +6 -0
- package/dist/react-country-kit.cjs.js.map +1 -1
- package/dist/react-country-kit.es.js.map +1 -1
- package/dist/ui.cjs.js +3 -0
- package/dist/ui.d.ts +17 -0
- package/dist/ui.es.js +899 -0
- package/package.json +3 -3
- package/dist/index.d.ts +0 -9
package/dist/ui.es.js
ADDED
|
@@ -0,0 +1,899 @@
|
|
|
1
|
+
import C, { useEffect as G, useState as k } from "react";
|
|
2
|
+
import * as M from "@radix-ui/react-popover";
|
|
3
|
+
import { clsx as Z } from "clsx";
|
|
4
|
+
import { twMerge as ee } from "tailwind-merge";
|
|
5
|
+
import { Fragment as R, jsx as e, jsxs as t } from "react/jsx-runtime";
|
|
6
|
+
import { getAllCountries as z, getAllCurrencies as A, getAllLanguages as U, getAllTimezones as ne, getCurrencyByCountry as $, getDivisionsByCountry as te, getTimezonesByCountry as F, searchCountries as H, searchCurrencies as I, searchLanguages as re, searchTimezones as oe, useCountry as ae, usePhoneInput as le } from "react-country-kit-core";
|
|
7
|
+
export * from "react-country-kit-core";
|
|
8
|
+
function y(...n) {
|
|
9
|
+
return ee(Z(n));
|
|
10
|
+
}
|
|
11
|
+
var J = M.Root, Y = M.Trigger, V = ({ className: n }) => /* @__PURE__ */ e("svg", {
|
|
12
|
+
className: y("h-4 w-4 text-primary", n),
|
|
13
|
+
viewBox: "0 0 20 20",
|
|
14
|
+
fill: "none",
|
|
15
|
+
stroke: "currentColor",
|
|
16
|
+
strokeWidth: "2.5",
|
|
17
|
+
strokeLinecap: "round",
|
|
18
|
+
strokeLinejoin: "round",
|
|
19
|
+
children: /* @__PURE__ */ e("polyline", { points: "4 10 8 14 16 6" })
|
|
20
|
+
});
|
|
21
|
+
V.displayName = "CheckIcon";
|
|
22
|
+
var Q = ({ children: n, className: r }) => /* @__PURE__ */ e("label", {
|
|
23
|
+
className: y("text-[0.65rem] font-bold uppercase tracking-[0.12em] text-muted-foreground/80 ml-1 mb-1.5 block", r),
|
|
24
|
+
children: n
|
|
25
|
+
});
|
|
26
|
+
Q.displayName = "FieldLabel";
|
|
27
|
+
var S = ({ children: n, className: r }) => /* @__PURE__ */ e("span", {
|
|
28
|
+
className: y("inline-flex items-center rounded-full bg-primary/20 px-2.5 py-0.5 text-[0.7rem] font-bold text-primary tracking-tight", r),
|
|
29
|
+
children: n
|
|
30
|
+
});
|
|
31
|
+
S.displayName = "Badge";
|
|
32
|
+
var D = ({ iso2: n, flag: r, flagUrl: p, className: m }) => /* @__PURE__ */ e("span", {
|
|
33
|
+
className: y("inline-flex items-center justify-center shrink-0 overflow-hidden", m),
|
|
34
|
+
children: /* @__PURE__ */ e("img", {
|
|
35
|
+
src: p,
|
|
36
|
+
alt: n,
|
|
37
|
+
className: "h-[1em] w-[1.5em] object-cover rounded-[1px] shadow-[0_0_0_1px_rgba(0,0,0,0.05)]",
|
|
38
|
+
onError: (l) => {
|
|
39
|
+
if (l.target.style.display = "none", l.target.parentElement) {
|
|
40
|
+
const s = document.createElement("span");
|
|
41
|
+
s.textContent = r, l.target.parentElement.appendChild(s);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
})
|
|
45
|
+
});
|
|
46
|
+
D.displayName = "Flag";
|
|
47
|
+
var W = C.forwardRef(({ className: n, align: r = "start", sideOffset: p = 6, onCloseAutoFocus: m, ...l }, s) => /* @__PURE__ */ e(M.Portal, { children: /* @__PURE__ */ e(M.Content, {
|
|
48
|
+
ref: s,
|
|
49
|
+
align: r,
|
|
50
|
+
sideOffset: p,
|
|
51
|
+
onCloseAutoFocus: (g) => {
|
|
52
|
+
g.preventDefault(), m?.(g);
|
|
53
|
+
},
|
|
54
|
+
className: y("z-50 w-[var(--radix-popover-trigger-width)] rounded-xl border border-border bg-popover p-0 shadow-lg", "data-[state=open]:animate-in data-[state=closed]:animate-out", "data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0", "data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95", "data-[side=bottom]:slide-in-from-top-2 data-[side=top]:slide-in-from-bottom-2", n),
|
|
55
|
+
...l
|
|
56
|
+
}) }));
|
|
57
|
+
W.displayName = "PopoverContent";
|
|
58
|
+
var L = C.forwardRef(({ className: n, ...r }, p) => /* @__PURE__ */ e("div", {
|
|
59
|
+
ref: p,
|
|
60
|
+
className: y("flex h-full w-full flex-col overflow-hidden rounded-xl bg-popover text-popover-foreground", n),
|
|
61
|
+
...r
|
|
62
|
+
}));
|
|
63
|
+
L.displayName = "CommandRoot";
|
|
64
|
+
var P = C.forwardRef(({ className: n, onValueChange: r, ...p }, m) => /* @__PURE__ */ e("div", {
|
|
65
|
+
className: "px-3 pt-3 pb-2 border-b border-border",
|
|
66
|
+
children: /* @__PURE__ */ t("div", {
|
|
67
|
+
className: y("flex items-center gap-2 px-3 py-1.5 rounded-lg border border-border bg-muted/40 transition-colors", "focus-within:border-primary/50 focus-within:ring-2 focus-within:ring-primary/10"),
|
|
68
|
+
children: [/* @__PURE__ */ t("svg", {
|
|
69
|
+
className: "h-3.5 w-3.5 shrink-0 text-muted-foreground",
|
|
70
|
+
viewBox: "0 0 20 20",
|
|
71
|
+
fill: "none",
|
|
72
|
+
stroke: "currentColor",
|
|
73
|
+
strokeWidth: "2",
|
|
74
|
+
children: [/* @__PURE__ */ e("circle", {
|
|
75
|
+
cx: "8.5",
|
|
76
|
+
cy: "8.5",
|
|
77
|
+
r: "5.5"
|
|
78
|
+
}), /* @__PURE__ */ e("path", {
|
|
79
|
+
d: "M17 17l-4-4",
|
|
80
|
+
strokeLinecap: "round"
|
|
81
|
+
})]
|
|
82
|
+
}), /* @__PURE__ */ e("input", {
|
|
83
|
+
ref: m,
|
|
84
|
+
type: "text",
|
|
85
|
+
autoComplete: "off",
|
|
86
|
+
autoCorrect: "off",
|
|
87
|
+
spellCheck: !1,
|
|
88
|
+
className: y("flex h-8 w-full bg-transparent text-sm outline-none", "placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50", n),
|
|
89
|
+
onChange: (l) => r?.(l.target.value),
|
|
90
|
+
...p
|
|
91
|
+
})]
|
|
92
|
+
})
|
|
93
|
+
}));
|
|
94
|
+
P.displayName = "CommandInput";
|
|
95
|
+
var _ = C.forwardRef(({ className: n, ...r }, p) => /* @__PURE__ */ e("div", {
|
|
96
|
+
ref: p,
|
|
97
|
+
role: "listbox",
|
|
98
|
+
className: y("max-h-72 overflow-y-auto overflow-x-hidden p-1", n),
|
|
99
|
+
...r
|
|
100
|
+
}));
|
|
101
|
+
_.displayName = "CommandList";
|
|
102
|
+
var O = C.forwardRef((n, r) => /* @__PURE__ */ e("div", {
|
|
103
|
+
ref: r,
|
|
104
|
+
className: "flex flex-col items-center justify-center gap-1 py-8 text-sm text-muted-foreground",
|
|
105
|
+
...n
|
|
106
|
+
}));
|
|
107
|
+
O.displayName = "CommandEmpty";
|
|
108
|
+
var B = C.forwardRef(({ className: n, onSelect: r, onMouseDown: p, onKeyDown: m, disabled: l, selected: s, value: g, ...v }, x) => /* @__PURE__ */ e("div", {
|
|
109
|
+
ref: x,
|
|
110
|
+
role: "option",
|
|
111
|
+
"aria-disabled": l || void 0,
|
|
112
|
+
"aria-selected": s,
|
|
113
|
+
"data-disabled": l || void 0,
|
|
114
|
+
"data-selected": s || void 0,
|
|
115
|
+
tabIndex: l ? void 0 : 0,
|
|
116
|
+
className: y("relative flex cursor-pointer select-none items-center gap-2 rounded-lg px-2 py-2 text-sm outline-none", "focus:bg-accent focus:text-accent-foreground", "data-[disabled]:pointer-events-none data-[disabled]:opacity-50", "hover:bg-accent/50 transition-colors", s && "bg-accent text-accent-foreground font-semibold", n),
|
|
117
|
+
onMouseDown: (a) => {
|
|
118
|
+
a.preventDefault(), p?.(a);
|
|
119
|
+
},
|
|
120
|
+
onClick: l ? void 0 : () => r?.(),
|
|
121
|
+
onKeyDown: (a) => {
|
|
122
|
+
!l && a.key === "Enter" && (a.preventDefault(), r?.()), m?.(a);
|
|
123
|
+
},
|
|
124
|
+
...v
|
|
125
|
+
}));
|
|
126
|
+
B.displayName = "CommandItem";
|
|
127
|
+
var E = C.forwardRef(({ className: n, isOpen: r, children: p, placeholder: m, hasValue: l, ...s }, g) => /* @__PURE__ */ t("button", {
|
|
128
|
+
ref: g,
|
|
129
|
+
type: "button",
|
|
130
|
+
role: "combobox",
|
|
131
|
+
"aria-expanded": r,
|
|
132
|
+
"aria-haspopup": "listbox",
|
|
133
|
+
className: y("flex h-12 w-full items-center justify-between gap-3 rounded-xl border border-input bg-background px-4 py-2 text-sm ring-offset-background", "placeholder:text-muted-foreground", "focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2", "disabled:cursor-not-allowed disabled:opacity-50", "hover:bg-accent/10 transition-all", !l && "text-muted-foreground", n),
|
|
134
|
+
...s,
|
|
135
|
+
children: [/* @__PURE__ */ e("span", {
|
|
136
|
+
className: "flex min-w-0 flex-1 items-center gap-2 truncate",
|
|
137
|
+
children: p || /* @__PURE__ */ e("span", { children: m })
|
|
138
|
+
}), /* @__PURE__ */ e("svg", {
|
|
139
|
+
className: y("h-4 w-4 shrink-0 text-muted-foreground/60 transition-transform duration-200", r && "rotate-180"),
|
|
140
|
+
viewBox: "0 0 20 20",
|
|
141
|
+
fill: "none",
|
|
142
|
+
stroke: "currentColor",
|
|
143
|
+
strokeWidth: "2.5",
|
|
144
|
+
strokeLinecap: "round",
|
|
145
|
+
strokeLinejoin: "round",
|
|
146
|
+
children: /* @__PURE__ */ e("polyline", { points: "6 8 10 12 14 8" })
|
|
147
|
+
})]
|
|
148
|
+
}));
|
|
149
|
+
E.displayName = "PickerTrigger";
|
|
150
|
+
var j = C.forwardRef(({ label: n, trigger: r, children: p, open: m, onOpenChange: l, className: s }, g) => /* @__PURE__ */ t("div", {
|
|
151
|
+
ref: g,
|
|
152
|
+
className: y("flex flex-col gap-0", s),
|
|
153
|
+
children: [n && /* @__PURE__ */ e(Q, { children: n }), /* @__PURE__ */ t(J, {
|
|
154
|
+
open: m,
|
|
155
|
+
onOpenChange: l,
|
|
156
|
+
children: [/* @__PURE__ */ e(Y, {
|
|
157
|
+
asChild: !0,
|
|
158
|
+
children: r
|
|
159
|
+
}), /* @__PURE__ */ e(W, {
|
|
160
|
+
className: "p-0",
|
|
161
|
+
children: p
|
|
162
|
+
})]
|
|
163
|
+
})]
|
|
164
|
+
}));
|
|
165
|
+
j.displayName = "BasePicker";
|
|
166
|
+
var q = C.forwardRef(({ value: n, onRemove: r, onClear: p, isOpen: m, placeholder: l, renderChip: s, maxVisible: g = 3, className: v, disabled: x, ...a }, u) => {
|
|
167
|
+
const c = n.slice(0, g), N = n.length - g;
|
|
168
|
+
return /* @__PURE__ */ t("button", {
|
|
169
|
+
ref: u,
|
|
170
|
+
type: "button",
|
|
171
|
+
"aria-haspopup": "listbox",
|
|
172
|
+
"aria-expanded": m,
|
|
173
|
+
disabled: x,
|
|
174
|
+
className: y("flex min-h-[3rem] w-full items-center gap-3 rounded-xl border border-input bg-background px-4 py-2", "text-sm ring-offset-background focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2", "disabled:cursor-not-allowed disabled:opacity-50 hover:bg-accent/10 transition-all text-start", m && "ring-2 ring-ring ring-offset-2", v),
|
|
175
|
+
...a,
|
|
176
|
+
children: [/* @__PURE__ */ e("div", {
|
|
177
|
+
className: "flex flex-1 flex-wrap gap-1.5 min-w-0 items-center",
|
|
178
|
+
children: n.length === 0 ? /* @__PURE__ */ e("span", {
|
|
179
|
+
className: "text-muted-foreground",
|
|
180
|
+
children: l
|
|
181
|
+
}) : /* @__PURE__ */ t(R, { children: [c.map((f, b) => /* @__PURE__ */ t("span", {
|
|
182
|
+
className: "inline-flex items-center gap-1 rounded-full bg-primary/10 px-2 py-0.5 text-[0.75rem] font-semibold text-primary",
|
|
183
|
+
children: [s(f), /* @__PURE__ */ e("span", {
|
|
184
|
+
role: "button",
|
|
185
|
+
tabIndex: x ? -1 : 0,
|
|
186
|
+
onClick: (d) => {
|
|
187
|
+
d.stopPropagation(), x || r(f, d);
|
|
188
|
+
},
|
|
189
|
+
onKeyDown: (d) => {
|
|
190
|
+
(d.key === "Enter" || d.key === " ") && (d.preventDefault(), d.stopPropagation(), x || r(f, d));
|
|
191
|
+
},
|
|
192
|
+
className: "ml-0.5 rounded-full text-primary/60 hover:text-primary transition-colors cursor-pointer",
|
|
193
|
+
"aria-label": "Remove",
|
|
194
|
+
children: /* @__PURE__ */ t("svg", {
|
|
195
|
+
width: "9",
|
|
196
|
+
height: "9",
|
|
197
|
+
viewBox: "0 0 20 20",
|
|
198
|
+
fill: "none",
|
|
199
|
+
stroke: "currentColor",
|
|
200
|
+
strokeWidth: "2.5",
|
|
201
|
+
strokeLinecap: "round",
|
|
202
|
+
children: [/* @__PURE__ */ e("line", {
|
|
203
|
+
x1: "5",
|
|
204
|
+
y1: "5",
|
|
205
|
+
x2: "15",
|
|
206
|
+
y2: "15"
|
|
207
|
+
}), /* @__PURE__ */ e("line", {
|
|
208
|
+
x1: "15",
|
|
209
|
+
y1: "5",
|
|
210
|
+
x2: "5",
|
|
211
|
+
y2: "15"
|
|
212
|
+
})]
|
|
213
|
+
})
|
|
214
|
+
})]
|
|
215
|
+
}, b)), N > 0 && /* @__PURE__ */ t(S, {
|
|
216
|
+
className: "bg-muted text-muted-foreground/80 px-2",
|
|
217
|
+
children: ["+", N]
|
|
218
|
+
})] })
|
|
219
|
+
}), /* @__PURE__ */ t("div", {
|
|
220
|
+
className: "flex shrink-0 items-center gap-1 ml-auto",
|
|
221
|
+
children: [n.length > 0 && /* @__PURE__ */ e("span", {
|
|
222
|
+
role: "button",
|
|
223
|
+
tabIndex: x ? -1 : 0,
|
|
224
|
+
onClick: (f) => {
|
|
225
|
+
f.stopPropagation(), x || p(f);
|
|
226
|
+
},
|
|
227
|
+
onKeyDown: (f) => {
|
|
228
|
+
(f.key === "Enter" || f.key === " ") && (f.preventDefault(), f.stopPropagation(), x || p(f));
|
|
229
|
+
},
|
|
230
|
+
className: "rounded p-0.5 text-muted-foreground hover:text-foreground hover:bg-accent/30 transition-colors cursor-pointer",
|
|
231
|
+
"aria-label": "Clear all",
|
|
232
|
+
children: /* @__PURE__ */ t("svg", {
|
|
233
|
+
width: "14",
|
|
234
|
+
height: "14",
|
|
235
|
+
viewBox: "0 0 20 20",
|
|
236
|
+
fill: "none",
|
|
237
|
+
stroke: "currentColor",
|
|
238
|
+
strokeWidth: "2",
|
|
239
|
+
strokeLinecap: "round",
|
|
240
|
+
children: [/* @__PURE__ */ e("line", {
|
|
241
|
+
x1: "5",
|
|
242
|
+
y1: "5",
|
|
243
|
+
x2: "15",
|
|
244
|
+
y2: "15"
|
|
245
|
+
}), /* @__PURE__ */ e("line", {
|
|
246
|
+
x1: "15",
|
|
247
|
+
y1: "5",
|
|
248
|
+
x2: "5",
|
|
249
|
+
y2: "15"
|
|
250
|
+
})]
|
|
251
|
+
})
|
|
252
|
+
}), /* @__PURE__ */ e("svg", {
|
|
253
|
+
className: y("h-4 w-4 text-muted-foreground/60 transition-transform duration-200", m && "rotate-180"),
|
|
254
|
+
viewBox: "0 0 20 20",
|
|
255
|
+
fill: "none",
|
|
256
|
+
stroke: "currentColor",
|
|
257
|
+
strokeWidth: "2.5",
|
|
258
|
+
strokeLinecap: "round",
|
|
259
|
+
strokeLinejoin: "round",
|
|
260
|
+
children: /* @__PURE__ */ e("polyline", { points: "6 8 10 12 14 8" })
|
|
261
|
+
})]
|
|
262
|
+
})]
|
|
263
|
+
});
|
|
264
|
+
});
|
|
265
|
+
q.displayName = "MultiSelectTrigger";
|
|
266
|
+
var K = 3;
|
|
267
|
+
function fe({ value: n, onChange: r, placeholder: p = "Select countries...", maxItems: m, showFlags: l = !0, searchable: s = !0, disabled: g = !1, className: v, label: x }) {
|
|
268
|
+
const [a, u] = k(!1), [c, N] = k(""), f = c ? H(c) : z(), b = (o) => n.some((w) => w.iso2 === o.iso2), d = (o) => {
|
|
269
|
+
if (b(o)) r(n.filter((w) => w.iso2 !== o.iso2));
|
|
270
|
+
else {
|
|
271
|
+
if (m !== void 0 && n.length >= m) return;
|
|
272
|
+
r([...n, o]);
|
|
273
|
+
}
|
|
274
|
+
}, i = (o, w) => {
|
|
275
|
+
w.stopPropagation(), r(n.filter((T) => T.iso2 !== o.iso2));
|
|
276
|
+
}, h = (o) => {
|
|
277
|
+
o.stopPropagation(), r([]);
|
|
278
|
+
};
|
|
279
|
+
return n.slice(0, K), n.length - K, /* @__PURE__ */ t(j, {
|
|
280
|
+
label: x,
|
|
281
|
+
className: v,
|
|
282
|
+
open: a,
|
|
283
|
+
onOpenChange: u,
|
|
284
|
+
trigger: /* @__PURE__ */ e(q, {
|
|
285
|
+
value: n,
|
|
286
|
+
onRemove: i,
|
|
287
|
+
onClear: h,
|
|
288
|
+
isOpen: a,
|
|
289
|
+
placeholder: p,
|
|
290
|
+
disabled: g,
|
|
291
|
+
renderChip: (o) => /* @__PURE__ */ t(R, { children: [l && /* @__PURE__ */ e(D, {
|
|
292
|
+
iso2: o.iso2,
|
|
293
|
+
flag: o.flag,
|
|
294
|
+
flagUrl: o.flag_url
|
|
295
|
+
}), /* @__PURE__ */ e("span", {
|
|
296
|
+
className: "max-w-[80px] truncate",
|
|
297
|
+
children: o.name
|
|
298
|
+
})] })
|
|
299
|
+
}),
|
|
300
|
+
children: [/* @__PURE__ */ t(L, { children: [s && /* @__PURE__ */ e(P, {
|
|
301
|
+
placeholder: "Search countries...",
|
|
302
|
+
value: c,
|
|
303
|
+
onValueChange: N
|
|
304
|
+
}), /* @__PURE__ */ t(_, { children: [f.length === 0 && /* @__PURE__ */ t(O, { children: [/* @__PURE__ */ e("span", {
|
|
305
|
+
className: "text-2xl opacity-40",
|
|
306
|
+
children: "๐"
|
|
307
|
+
}), /* @__PURE__ */ e("span", { children: "No countries found" })] }), f.map((o) => {
|
|
308
|
+
const w = b(o);
|
|
309
|
+
return /* @__PURE__ */ t(B, {
|
|
310
|
+
onSelect: () => d(o),
|
|
311
|
+
selected: w,
|
|
312
|
+
children: [
|
|
313
|
+
/* @__PURE__ */ e("div", {
|
|
314
|
+
className: y("h-4 w-4 shrink-0 rounded-full border border-border flex items-center justify-center", w && "bg-primary border-primary"),
|
|
315
|
+
children: w && /* @__PURE__ */ e("svg", {
|
|
316
|
+
className: "h-2.5 w-2.5 stroke-white",
|
|
317
|
+
viewBox: "0 0 20 20",
|
|
318
|
+
fill: "none",
|
|
319
|
+
strokeWidth: "3",
|
|
320
|
+
strokeLinecap: "round",
|
|
321
|
+
strokeLinejoin: "round",
|
|
322
|
+
children: /* @__PURE__ */ e("polyline", { points: "4 10 8 14 16 6" })
|
|
323
|
+
})
|
|
324
|
+
}),
|
|
325
|
+
l && /* @__PURE__ */ e(D, {
|
|
326
|
+
iso2: o.iso2,
|
|
327
|
+
flag: o.flag,
|
|
328
|
+
flagUrl: o.flag_url
|
|
329
|
+
}),
|
|
330
|
+
/* @__PURE__ */ t("div", {
|
|
331
|
+
className: "flex flex-1 flex-col min-w-0",
|
|
332
|
+
children: [/* @__PURE__ */ e("span", {
|
|
333
|
+
className: "truncate font-medium",
|
|
334
|
+
children: o.name
|
|
335
|
+
}), /* @__PURE__ */ t("span", {
|
|
336
|
+
className: "text-[0.7rem] text-muted-foreground",
|
|
337
|
+
children: [
|
|
338
|
+
o.iso3,
|
|
339
|
+
" ยท +",
|
|
340
|
+
o.phone_code
|
|
341
|
+
]
|
|
342
|
+
})]
|
|
343
|
+
})
|
|
344
|
+
]
|
|
345
|
+
}, o.iso2);
|
|
346
|
+
})] })] }), n.length > 0 && /* @__PURE__ */ t("div", {
|
|
347
|
+
className: "flex items-center justify-between border-t border-border px-3 py-2 text-xs text-muted-foreground",
|
|
348
|
+
children: [/* @__PURE__ */ t("span", { children: [
|
|
349
|
+
n.length,
|
|
350
|
+
" selected",
|
|
351
|
+
m ? ` / ${m}` : ""
|
|
352
|
+
] }), /* @__PURE__ */ e("button", {
|
|
353
|
+
type: "button",
|
|
354
|
+
onClick: () => {
|
|
355
|
+
r([]), u(!1);
|
|
356
|
+
},
|
|
357
|
+
className: "text-destructive hover:underline font-medium",
|
|
358
|
+
children: "Clear all"
|
|
359
|
+
})]
|
|
360
|
+
})]
|
|
361
|
+
});
|
|
362
|
+
}
|
|
363
|
+
function he({ value: n, onChange: r, placeholder: p = "Select a country...", searchable: m = !0, showFlag: l = !0, showPhoneCode: s = !1, disabled: g = !1, className: v, label: x }) {
|
|
364
|
+
const [a, u] = k(!1), [c, N] = k(""), f = c ? H(c) : z(), b = (d) => {
|
|
365
|
+
const i = z().find((h) => h.iso2.toLowerCase() === d.toLowerCase());
|
|
366
|
+
i && (r(i), u(!1), N(""));
|
|
367
|
+
};
|
|
368
|
+
return /* @__PURE__ */ e(j, {
|
|
369
|
+
label: x,
|
|
370
|
+
className: v,
|
|
371
|
+
open: a,
|
|
372
|
+
onOpenChange: u,
|
|
373
|
+
trigger: /* @__PURE__ */ e(E, {
|
|
374
|
+
isOpen: a,
|
|
375
|
+
hasValue: !!n,
|
|
376
|
+
placeholder: p,
|
|
377
|
+
disabled: g,
|
|
378
|
+
children: n && /* @__PURE__ */ t(R, { children: [
|
|
379
|
+
l && /* @__PURE__ */ e(D, {
|
|
380
|
+
iso2: n.iso2,
|
|
381
|
+
flag: n.flag,
|
|
382
|
+
flagUrl: n.flag_url
|
|
383
|
+
}),
|
|
384
|
+
/* @__PURE__ */ e("span", {
|
|
385
|
+
className: "flex-1 text-start truncate",
|
|
386
|
+
children: n.name
|
|
387
|
+
}),
|
|
388
|
+
s && /* @__PURE__ */ t(S, { children: ["+", n.phone_code] })
|
|
389
|
+
] })
|
|
390
|
+
}),
|
|
391
|
+
children: /* @__PURE__ */ t(L, { children: [m && /* @__PURE__ */ e(P, {
|
|
392
|
+
placeholder: "Search country...",
|
|
393
|
+
value: c,
|
|
394
|
+
onValueChange: N
|
|
395
|
+
}), /* @__PURE__ */ t(_, { children: [f.length === 0 && /* @__PURE__ */ t(O, { children: [/* @__PURE__ */ e("span", {
|
|
396
|
+
className: "text-2xl opacity-40",
|
|
397
|
+
children: "๐"
|
|
398
|
+
}), /* @__PURE__ */ e("span", { children: "No countries found" })] }), f.map((d) => {
|
|
399
|
+
const i = n?.iso2 === d.iso2;
|
|
400
|
+
return /* @__PURE__ */ t(B, {
|
|
401
|
+
onSelect: () => b(d.iso2),
|
|
402
|
+
selected: i,
|
|
403
|
+
children: [
|
|
404
|
+
l && /* @__PURE__ */ e(D, {
|
|
405
|
+
iso2: d.iso2,
|
|
406
|
+
flag: d.flag,
|
|
407
|
+
flagUrl: d.flag_url
|
|
408
|
+
}),
|
|
409
|
+
/* @__PURE__ */ t("div", {
|
|
410
|
+
className: "flex flex-1 flex-col gap-0 min-w-0",
|
|
411
|
+
children: [/* @__PURE__ */ e("span", {
|
|
412
|
+
className: "truncate font-medium",
|
|
413
|
+
children: d.name
|
|
414
|
+
}), /* @__PURE__ */ t("span", {
|
|
415
|
+
className: "text-[0.7rem] text-muted-foreground",
|
|
416
|
+
children: [
|
|
417
|
+
d.iso3,
|
|
418
|
+
" ยท ",
|
|
419
|
+
d.division_type
|
|
420
|
+
]
|
|
421
|
+
})]
|
|
422
|
+
}),
|
|
423
|
+
/* @__PURE__ */ t("div", {
|
|
424
|
+
className: "flex items-center gap-1.5 ml-auto shrink-0",
|
|
425
|
+
children: [s && /* @__PURE__ */ t("span", {
|
|
426
|
+
className: "text-[0.7rem] text-muted-foreground tabular-nums bg-muted px-1.5 py-0.5 rounded",
|
|
427
|
+
children: ["+", d.phone_code]
|
|
428
|
+
}), i && /* @__PURE__ */ e(V, {})]
|
|
429
|
+
})
|
|
430
|
+
]
|
|
431
|
+
}, d.iso2);
|
|
432
|
+
})] })] })
|
|
433
|
+
});
|
|
434
|
+
}
|
|
435
|
+
var X = 3;
|
|
436
|
+
function ue({ value: n, onChange: r, placeholder: p = "Select currencies...", maxItems: m, showSymbol: l = !0, searchable: s = !0, disabled: g = !1, className: v, label: x }) {
|
|
437
|
+
const [a, u] = k(!1), [c, N] = k(""), f = c ? I(c) : A(), b = (o) => n.some((w) => w.code === o.code), d = (o) => {
|
|
438
|
+
if (b(o)) r(n.filter((w) => w.code !== o.code));
|
|
439
|
+
else {
|
|
440
|
+
if (m !== void 0 && n.length >= m) return;
|
|
441
|
+
r([...n, o]);
|
|
442
|
+
}
|
|
443
|
+
}, i = (o, w) => {
|
|
444
|
+
w.stopPropagation(), r(n.filter((T) => T.code !== o.code));
|
|
445
|
+
}, h = (o) => {
|
|
446
|
+
o.stopPropagation(), r([]);
|
|
447
|
+
};
|
|
448
|
+
return n.slice(0, X), n.length - X, /* @__PURE__ */ t(j, {
|
|
449
|
+
label: x,
|
|
450
|
+
className: v,
|
|
451
|
+
open: a,
|
|
452
|
+
onOpenChange: u,
|
|
453
|
+
trigger: /* @__PURE__ */ e(q, {
|
|
454
|
+
value: n,
|
|
455
|
+
onRemove: i,
|
|
456
|
+
onClear: h,
|
|
457
|
+
isOpen: a,
|
|
458
|
+
placeholder: p,
|
|
459
|
+
disabled: g,
|
|
460
|
+
renderChip: (o) => /* @__PURE__ */ t(R, { children: [l && /* @__PURE__ */ e("span", {
|
|
461
|
+
className: "font-bold",
|
|
462
|
+
children: o.symbol
|
|
463
|
+
}), /* @__PURE__ */ e("span", { children: o.code })] })
|
|
464
|
+
}),
|
|
465
|
+
children: [/* @__PURE__ */ t(L, { children: [s && /* @__PURE__ */ e(P, {
|
|
466
|
+
placeholder: "Search currencies...",
|
|
467
|
+
value: c,
|
|
468
|
+
onValueChange: N
|
|
469
|
+
}), /* @__PURE__ */ t(_, { children: [f.length === 0 && /* @__PURE__ */ t(O, { children: [/* @__PURE__ */ e("span", {
|
|
470
|
+
className: "text-2xl opacity-40",
|
|
471
|
+
children: "๐ฐ"
|
|
472
|
+
}), /* @__PURE__ */ e("span", { children: "No currencies found" })] }), f.map((o) => {
|
|
473
|
+
const w = b(o);
|
|
474
|
+
return /* @__PURE__ */ t(B, {
|
|
475
|
+
onSelect: () => d(o),
|
|
476
|
+
selected: w,
|
|
477
|
+
children: [
|
|
478
|
+
/* @__PURE__ */ e("div", {
|
|
479
|
+
className: y("h-4 w-4 shrink-0 rounded-full border border-border flex items-center justify-center", w && "bg-primary border-primary"),
|
|
480
|
+
children: w && /* @__PURE__ */ e("svg", {
|
|
481
|
+
className: "h-2.5 w-2.5 stroke-white",
|
|
482
|
+
viewBox: "0 0 20 20",
|
|
483
|
+
fill: "none",
|
|
484
|
+
strokeWidth: "3",
|
|
485
|
+
strokeLinecap: "round",
|
|
486
|
+
strokeLinejoin: "round",
|
|
487
|
+
children: /* @__PURE__ */ e("polyline", { points: "4 10 8 14 16 6" })
|
|
488
|
+
})
|
|
489
|
+
}),
|
|
490
|
+
l && /* @__PURE__ */ e("span", {
|
|
491
|
+
className: "min-w-[1.5rem] text-center font-bold text-primary",
|
|
492
|
+
children: o.symbol
|
|
493
|
+
}),
|
|
494
|
+
/* @__PURE__ */ t("div", {
|
|
495
|
+
className: "flex flex-1 flex-col min-w-0",
|
|
496
|
+
children: [/* @__PURE__ */ e("span", {
|
|
497
|
+
className: "truncate font-medium",
|
|
498
|
+
children: o.name
|
|
499
|
+
}), /* @__PURE__ */ e("span", {
|
|
500
|
+
className: "text-[0.7rem] text-muted-foreground",
|
|
501
|
+
children: o.code
|
|
502
|
+
})]
|
|
503
|
+
})
|
|
504
|
+
]
|
|
505
|
+
}, o.code);
|
|
506
|
+
})] })] }), n.length > 0 && /* @__PURE__ */ t("div", {
|
|
507
|
+
className: "flex items-center justify-between border-t border-border px-3 py-2 text-xs text-muted-foreground",
|
|
508
|
+
children: [/* @__PURE__ */ t("span", { children: [
|
|
509
|
+
n.length,
|
|
510
|
+
" selected",
|
|
511
|
+
m ? ` / ${m}` : ""
|
|
512
|
+
] }), /* @__PURE__ */ e("button", {
|
|
513
|
+
type: "button",
|
|
514
|
+
onClick: () => {
|
|
515
|
+
r([]), u(!1);
|
|
516
|
+
},
|
|
517
|
+
className: "text-destructive hover:underline font-medium",
|
|
518
|
+
children: "Clear all"
|
|
519
|
+
})]
|
|
520
|
+
})]
|
|
521
|
+
});
|
|
522
|
+
}
|
|
523
|
+
function ge({ value: n, onChange: r, placeholder: p = "Select a currency...", searchable: m = !0, showSymbol: l = !0, countryIso2: s, autoSelect: g = !0, disabled: v = !1, className: x, label: a }) {
|
|
524
|
+
const [u, c] = k(!1), [N, f] = k("");
|
|
525
|
+
G(() => {
|
|
526
|
+
if (s && g && !n) {
|
|
527
|
+
const h = $(s);
|
|
528
|
+
h && r(h);
|
|
529
|
+
}
|
|
530
|
+
}, [
|
|
531
|
+
s,
|
|
532
|
+
g,
|
|
533
|
+
n,
|
|
534
|
+
r
|
|
535
|
+
]);
|
|
536
|
+
const d = N ? I(N, s) : (() => {
|
|
537
|
+
if (s) {
|
|
538
|
+
const h = $(s);
|
|
539
|
+
return h ? [h] : [];
|
|
540
|
+
}
|
|
541
|
+
return A();
|
|
542
|
+
})(), i = (h) => {
|
|
543
|
+
const o = A().find((w) => w.code.toLowerCase() === h.toLowerCase());
|
|
544
|
+
o && (r(o), c(!1), f(""));
|
|
545
|
+
};
|
|
546
|
+
return /* @__PURE__ */ e(j, {
|
|
547
|
+
label: a,
|
|
548
|
+
className: x,
|
|
549
|
+
open: u,
|
|
550
|
+
onOpenChange: c,
|
|
551
|
+
trigger: /* @__PURE__ */ e(E, {
|
|
552
|
+
isOpen: u,
|
|
553
|
+
hasValue: !!n,
|
|
554
|
+
placeholder: p,
|
|
555
|
+
disabled: v,
|
|
556
|
+
children: n && /* @__PURE__ */ t(R, { children: [l && /* @__PURE__ */ e("span", {
|
|
557
|
+
className: "min-w-[1.5rem] text-center font-bold text-primary text-base",
|
|
558
|
+
children: n.symbol
|
|
559
|
+
}), /* @__PURE__ */ t("span", {
|
|
560
|
+
className: "flex-1 text-start truncate",
|
|
561
|
+
children: [
|
|
562
|
+
n.code,
|
|
563
|
+
" โ ",
|
|
564
|
+
n.name
|
|
565
|
+
]
|
|
566
|
+
})] })
|
|
567
|
+
}),
|
|
568
|
+
children: /* @__PURE__ */ t(L, { children: [m && /* @__PURE__ */ e(P, {
|
|
569
|
+
placeholder: "Search currency...",
|
|
570
|
+
value: N,
|
|
571
|
+
onValueChange: f
|
|
572
|
+
}), /* @__PURE__ */ t(_, { children: [d.length === 0 && /* @__PURE__ */ t(O, { children: [/* @__PURE__ */ e("span", {
|
|
573
|
+
className: "text-2xl opacity-40",
|
|
574
|
+
children: "๐ฐ"
|
|
575
|
+
}), /* @__PURE__ */ e("span", { children: "No currencies found" })] }), d.map((h) => {
|
|
576
|
+
const o = n?.code === h.code;
|
|
577
|
+
return /* @__PURE__ */ t(B, {
|
|
578
|
+
onSelect: () => i(h.code),
|
|
579
|
+
selected: o,
|
|
580
|
+
children: [
|
|
581
|
+
l && /* @__PURE__ */ e("span", {
|
|
582
|
+
className: "min-w-[1.5rem] text-center font-bold text-primary",
|
|
583
|
+
children: h.symbol
|
|
584
|
+
}),
|
|
585
|
+
/* @__PURE__ */ t("div", {
|
|
586
|
+
className: "flex flex-1 flex-col gap-0 min-w-0",
|
|
587
|
+
children: [/* @__PURE__ */ e("span", {
|
|
588
|
+
className: "truncate font-medium",
|
|
589
|
+
children: h.name
|
|
590
|
+
}), /* @__PURE__ */ e("span", {
|
|
591
|
+
className: "text-[0.7rem] text-muted-foreground",
|
|
592
|
+
children: h.code
|
|
593
|
+
})]
|
|
594
|
+
}),
|
|
595
|
+
o && /* @__PURE__ */ e(V, { className: "ml-auto shrink-0" })
|
|
596
|
+
]
|
|
597
|
+
}, h.code);
|
|
598
|
+
})] })] })
|
|
599
|
+
});
|
|
600
|
+
}
|
|
601
|
+
function xe({ countryIso2: n, value: r, onChange: p, placeholder: m = "Select a division...", searchable: l = !0, disabled: s = !1, className: g, label: v }) {
|
|
602
|
+
const [x, a] = k(!1), [u, c] = k(""), N = te(n), f = u ? N.filter((i) => i.name.toLowerCase().includes(u.toLowerCase()) || i.iso2.toLowerCase().includes(u.toLowerCase()) || i.timezone.toLowerCase().includes(u.toLowerCase())) : N, b = s || !n || N.length === 0, d = (i) => {
|
|
603
|
+
const h = N.find((o) => o.name === i);
|
|
604
|
+
h && (p(h), a(!1), c(""));
|
|
605
|
+
};
|
|
606
|
+
return /* @__PURE__ */ e(j, {
|
|
607
|
+
label: v,
|
|
608
|
+
className: g,
|
|
609
|
+
open: x,
|
|
610
|
+
onOpenChange: (i) => !b && a(i),
|
|
611
|
+
trigger: /* @__PURE__ */ e(E, {
|
|
612
|
+
isOpen: x,
|
|
613
|
+
hasValue: !!r,
|
|
614
|
+
placeholder: n ? m : "Select a country first",
|
|
615
|
+
disabled: b,
|
|
616
|
+
children: r && /* @__PURE__ */ t(R, { children: [/* @__PURE__ */ e("span", {
|
|
617
|
+
className: "flex-1 text-start truncate",
|
|
618
|
+
children: r.name
|
|
619
|
+
}), /* @__PURE__ */ e(S, { children: r.iso2 })] })
|
|
620
|
+
}),
|
|
621
|
+
children: /* @__PURE__ */ t(L, { children: [l && /* @__PURE__ */ e(P, {
|
|
622
|
+
placeholder: "Search division...",
|
|
623
|
+
value: u,
|
|
624
|
+
onValueChange: c
|
|
625
|
+
}), /* @__PURE__ */ t(_, { children: [f.length === 0 && /* @__PURE__ */ t(O, { children: [/* @__PURE__ */ e("span", {
|
|
626
|
+
className: "text-2xl opacity-40",
|
|
627
|
+
children: "๐บ๏ธ"
|
|
628
|
+
}), /* @__PURE__ */ e("span", { children: "No divisions found" })] }), f.map((i) => {
|
|
629
|
+
const h = r?.iso2 === i.iso2 && r?.name === i.name;
|
|
630
|
+
return /* @__PURE__ */ t(B, {
|
|
631
|
+
onSelect: () => d(i.name),
|
|
632
|
+
selected: h,
|
|
633
|
+
children: [/* @__PURE__ */ t("div", {
|
|
634
|
+
className: "flex flex-1 flex-col gap-0 min-w-0",
|
|
635
|
+
children: [/* @__PURE__ */ e("span", {
|
|
636
|
+
className: "truncate font-medium",
|
|
637
|
+
children: i.name
|
|
638
|
+
}), /* @__PURE__ */ e("span", {
|
|
639
|
+
className: "text-[0.7rem] text-muted-foreground truncate",
|
|
640
|
+
children: i.timezone
|
|
641
|
+
})]
|
|
642
|
+
}), /* @__PURE__ */ t("div", {
|
|
643
|
+
className: "flex items-center gap-1.5 ml-auto shrink-0",
|
|
644
|
+
children: [/* @__PURE__ */ e(S, { children: i.iso2 }), h && /* @__PURE__ */ e(V, {})]
|
|
645
|
+
})]
|
|
646
|
+
}, `${i.iso2}-${i.name}`);
|
|
647
|
+
})] })] })
|
|
648
|
+
});
|
|
649
|
+
}
|
|
650
|
+
function be({ value: n, onChange: r, placeholder: p = "Select a language...", searchable: m = !0, showNativeName: l = !0, disabled: s = !1, className: g, label: v }) {
|
|
651
|
+
const [x, a] = k(!1), [u, c] = k(""), N = u ? re(u) : U(), f = (b) => {
|
|
652
|
+
const d = U().find((i) => i.code.toLowerCase() === b.toLowerCase());
|
|
653
|
+
d && (r(d), a(!1), c(""));
|
|
654
|
+
};
|
|
655
|
+
return /* @__PURE__ */ e(j, {
|
|
656
|
+
label: v,
|
|
657
|
+
className: g,
|
|
658
|
+
open: x,
|
|
659
|
+
onOpenChange: a,
|
|
660
|
+
trigger: /* @__PURE__ */ e(E, {
|
|
661
|
+
isOpen: x,
|
|
662
|
+
hasValue: !!n,
|
|
663
|
+
placeholder: p,
|
|
664
|
+
disabled: s,
|
|
665
|
+
children: n && /* @__PURE__ */ t(R, { children: [/* @__PURE__ */ e("span", {
|
|
666
|
+
className: "flex-1 text-start truncate",
|
|
667
|
+
children: n.english_name
|
|
668
|
+
}), l && n.native_name !== n.english_name && /* @__PURE__ */ e("span", {
|
|
669
|
+
className: "text-xs italic text-muted-foreground shrink-0",
|
|
670
|
+
children: n.native_name
|
|
671
|
+
})] })
|
|
672
|
+
}),
|
|
673
|
+
children: /* @__PURE__ */ t(L, { children: [m && /* @__PURE__ */ e(P, {
|
|
674
|
+
placeholder: "Search language...",
|
|
675
|
+
value: u,
|
|
676
|
+
onValueChange: c
|
|
677
|
+
}), /* @__PURE__ */ t(_, { children: [N.length === 0 && /* @__PURE__ */ t(O, { children: [/* @__PURE__ */ e("span", {
|
|
678
|
+
className: "text-2xl opacity-40",
|
|
679
|
+
children: "๐"
|
|
680
|
+
}), /* @__PURE__ */ e("span", { children: "No languages found" })] }), N.map((b) => {
|
|
681
|
+
const d = n?.code === b.code;
|
|
682
|
+
return /* @__PURE__ */ t(B, {
|
|
683
|
+
onSelect: () => f(b.code),
|
|
684
|
+
selected: d,
|
|
685
|
+
children: [/* @__PURE__ */ t("div", {
|
|
686
|
+
className: "flex flex-1 flex-col gap-0 min-w-0",
|
|
687
|
+
children: [/* @__PURE__ */ e("span", {
|
|
688
|
+
className: "truncate font-medium",
|
|
689
|
+
children: b.english_name
|
|
690
|
+
}), l && b.native_name !== b.english_name && /* @__PURE__ */ e("span", {
|
|
691
|
+
className: "text-[0.7rem] text-muted-foreground italic",
|
|
692
|
+
children: b.native_name
|
|
693
|
+
})]
|
|
694
|
+
}), /* @__PURE__ */ t("div", {
|
|
695
|
+
className: "flex items-center gap-1.5 ml-auto shrink-0",
|
|
696
|
+
children: [/* @__PURE__ */ e(S, {
|
|
697
|
+
className: "text-[0.6rem]",
|
|
698
|
+
children: b.code
|
|
699
|
+
}), d && /* @__PURE__ */ e(V, {})]
|
|
700
|
+
})]
|
|
701
|
+
}, b.code);
|
|
702
|
+
})] })] })
|
|
703
|
+
});
|
|
704
|
+
}
|
|
705
|
+
var ie = C.forwardRef(({ value: n, onChange: r, defaultCountryIso2: p = "US", placeholder: m = "Phone number", showFlag: l = !0, disabled: s = !1, className: g, label: v }, x) => {
|
|
706
|
+
const a = le(n, r, p), u = ae(a.country?.iso2);
|
|
707
|
+
return /* @__PURE__ */ t("div", {
|
|
708
|
+
ref: x,
|
|
709
|
+
className: y("flex flex-col gap-0", g),
|
|
710
|
+
children: [
|
|
711
|
+
v && /* @__PURE__ */ e(Q, { children: v }),
|
|
712
|
+
/* @__PURE__ */ t("div", {
|
|
713
|
+
className: y("flex h-12 items-stretch overflow-hidden rounded-xl border border-input bg-background ring-offset-background", "focus-within:ring-2 focus-within:ring-ring focus-within:ring-offset-2", "transition-shadow", s && "opacity-50 pointer-events-none"),
|
|
714
|
+
children: [/* @__PURE__ */ t(J, {
|
|
715
|
+
open: a.isOpen,
|
|
716
|
+
onOpenChange: (c) => c ? a.toggle() : a.close(),
|
|
717
|
+
children: [/* @__PURE__ */ e(Y, {
|
|
718
|
+
asChild: !0,
|
|
719
|
+
children: /* @__PURE__ */ t("button", {
|
|
720
|
+
type: "button",
|
|
721
|
+
disabled: s,
|
|
722
|
+
className: y("flex h-full shrink-0 items-center gap-1.5 border-r border-input bg-muted px-3", "text-sm font-semibold text-foreground transition-colors outline-none", "hover:bg-accent/30 focus-visible:bg-accent/30"),
|
|
723
|
+
children: [
|
|
724
|
+
l && a.country && /* @__PURE__ */ e(D, {
|
|
725
|
+
iso2: a.country.iso2,
|
|
726
|
+
flag: a.country.flag,
|
|
727
|
+
flagUrl: a.country.flag_url
|
|
728
|
+
}),
|
|
729
|
+
/* @__PURE__ */ e("span", {
|
|
730
|
+
className: "tabular-nums text-primary",
|
|
731
|
+
children: a.country ? `+${a.country.phone_code}` : "+?"
|
|
732
|
+
}),
|
|
733
|
+
/* @__PURE__ */ e("svg", {
|
|
734
|
+
className: y("h-3.5 w-3.5 shrink-0 text-muted-foreground transition-transform duration-200", a.isOpen && "rotate-180"),
|
|
735
|
+
viewBox: "0 0 20 20",
|
|
736
|
+
fill: "none",
|
|
737
|
+
stroke: "currentColor",
|
|
738
|
+
strokeWidth: "2",
|
|
739
|
+
strokeLinecap: "round",
|
|
740
|
+
children: /* @__PURE__ */ e("polyline", { points: "5 8 10 13 15 8" })
|
|
741
|
+
})
|
|
742
|
+
]
|
|
743
|
+
})
|
|
744
|
+
}), /* @__PURE__ */ e(W, {
|
|
745
|
+
align: "start",
|
|
746
|
+
side: "bottom",
|
|
747
|
+
sideOffset: 4,
|
|
748
|
+
className: "w-72",
|
|
749
|
+
children: /* @__PURE__ */ t(L, { children: [/* @__PURE__ */ e(P, {
|
|
750
|
+
placeholder: "Search country or code...",
|
|
751
|
+
value: a.searchQuery,
|
|
752
|
+
onValueChange: a.setSearchQuery
|
|
753
|
+
}), /* @__PURE__ */ t(_, { children: [a.filteredCountries.length === 0 && /* @__PURE__ */ t(O, { children: [/* @__PURE__ */ e("span", {
|
|
754
|
+
className: "text-2xl opacity-40",
|
|
755
|
+
children: "๐"
|
|
756
|
+
}), /* @__PURE__ */ e("span", { children: "No countries found" })] }), a.filteredCountries.map((c) => /* @__PURE__ */ t(B, {
|
|
757
|
+
onSelect: () => a.selectCountry(c),
|
|
758
|
+
selected: a.country?.iso2 === c.iso2,
|
|
759
|
+
children: [
|
|
760
|
+
/* @__PURE__ */ e(D, {
|
|
761
|
+
iso2: c.iso2,
|
|
762
|
+
flag: c.flag,
|
|
763
|
+
flagUrl: c.flag_url
|
|
764
|
+
}),
|
|
765
|
+
/* @__PURE__ */ e("div", {
|
|
766
|
+
className: "flex flex-1 flex-col min-w-0",
|
|
767
|
+
children: /* @__PURE__ */ e("span", {
|
|
768
|
+
className: "truncate font-medium text-sm",
|
|
769
|
+
children: c.name
|
|
770
|
+
})
|
|
771
|
+
}),
|
|
772
|
+
/* @__PURE__ */ t(S, {
|
|
773
|
+
className: "ml-auto tabular-nums text-[0.7rem]",
|
|
774
|
+
children: ["+", c.phone_code]
|
|
775
|
+
})
|
|
776
|
+
]
|
|
777
|
+
}, c.iso2))] })] })
|
|
778
|
+
})]
|
|
779
|
+
}), /* @__PURE__ */ e("input", {
|
|
780
|
+
type: "tel",
|
|
781
|
+
value: a.number,
|
|
782
|
+
onChange: (c) => a.setNumber(c.target.value),
|
|
783
|
+
placeholder: m,
|
|
784
|
+
disabled: s,
|
|
785
|
+
minLength: u.phoneLengths.min,
|
|
786
|
+
maxLength: u.phoneLengths.max,
|
|
787
|
+
inputMode: "numeric",
|
|
788
|
+
autoComplete: "tel-national",
|
|
789
|
+
className: y("flex-1 min-w-0 bg-transparent px-3 text-sm text-foreground", "placeholder:text-muted-foreground", "focus:outline-none")
|
|
790
|
+
})]
|
|
791
|
+
}),
|
|
792
|
+
a.value && /* @__PURE__ */ t("p", {
|
|
793
|
+
className: "text-[0.7rem] text-muted-foreground tabular-nums pl-0.5",
|
|
794
|
+
children: [
|
|
795
|
+
"Full:",
|
|
796
|
+
" ",
|
|
797
|
+
/* @__PURE__ */ e("span", {
|
|
798
|
+
className: "font-mono text-primary",
|
|
799
|
+
children: a.value.full
|
|
800
|
+
})
|
|
801
|
+
]
|
|
802
|
+
})
|
|
803
|
+
]
|
|
804
|
+
});
|
|
805
|
+
});
|
|
806
|
+
ie.displayName = "PhoneInput";
|
|
807
|
+
function Ne({ value: n, onChange: r, placeholder: p = "Select a timezone...", searchable: m = !0, countryIso2: l, autoSelect: s = !0, disabled: g = !1, className: v, label: x }) {
|
|
808
|
+
const [a, u] = k(!1), [c, N] = k("");
|
|
809
|
+
G(() => {
|
|
810
|
+
if (l && s && !n) {
|
|
811
|
+
const i = F(l);
|
|
812
|
+
i && i.length > 0 && r(i[0]);
|
|
813
|
+
}
|
|
814
|
+
}, [
|
|
815
|
+
l,
|
|
816
|
+
s,
|
|
817
|
+
n,
|
|
818
|
+
r
|
|
819
|
+
]);
|
|
820
|
+
const f = l ? F(l) : ne(), b = c ? oe(c, l) : f, d = (i) => {
|
|
821
|
+
const h = f.find((o) => o.name === i);
|
|
822
|
+
h && (r(h), u(!1), N(""));
|
|
823
|
+
};
|
|
824
|
+
return /* @__PURE__ */ e(j, {
|
|
825
|
+
label: x,
|
|
826
|
+
className: v,
|
|
827
|
+
open: a,
|
|
828
|
+
onOpenChange: u,
|
|
829
|
+
trigger: /* @__PURE__ */ e(E, {
|
|
830
|
+
isOpen: a,
|
|
831
|
+
hasValue: !!n,
|
|
832
|
+
placeholder: p,
|
|
833
|
+
disabled: g,
|
|
834
|
+
children: n && /* @__PURE__ */ t(R, { children: [/* @__PURE__ */ e("span", {
|
|
835
|
+
className: "flex-1 text-start truncate",
|
|
836
|
+
children: n.name
|
|
837
|
+
}), /* @__PURE__ */ e(S, { children: n.offset_name })] })
|
|
838
|
+
}),
|
|
839
|
+
children: /* @__PURE__ */ t(L, { children: [m && /* @__PURE__ */ e(P, {
|
|
840
|
+
placeholder: "Search timezone...",
|
|
841
|
+
value: c,
|
|
842
|
+
onValueChange: N
|
|
843
|
+
}), /* @__PURE__ */ t(_, { children: [b.length === 0 && /* @__PURE__ */ t(O, { children: [/* @__PURE__ */ e("span", {
|
|
844
|
+
className: "text-2xl opacity-40",
|
|
845
|
+
children: "๐"
|
|
846
|
+
}), /* @__PURE__ */ e("span", { children: "No timezones found" })] }), b.map((i) => {
|
|
847
|
+
const h = n?.name === i.name;
|
|
848
|
+
return /* @__PURE__ */ t(B, {
|
|
849
|
+
onSelect: () => d(i.name),
|
|
850
|
+
selected: h,
|
|
851
|
+
children: [/* @__PURE__ */ t("div", {
|
|
852
|
+
className: "flex flex-1 flex-col gap-0 min-w-0",
|
|
853
|
+
children: [/* @__PURE__ */ e("span", {
|
|
854
|
+
className: "truncate font-medium",
|
|
855
|
+
children: i.name
|
|
856
|
+
}), /* @__PURE__ */ t("span", {
|
|
857
|
+
className: "text-[0.7rem] text-muted-foreground",
|
|
858
|
+
children: [
|
|
859
|
+
i.tzName,
|
|
860
|
+
" ยท ",
|
|
861
|
+
i.abbreviation
|
|
862
|
+
]
|
|
863
|
+
})]
|
|
864
|
+
}), /* @__PURE__ */ t("div", {
|
|
865
|
+
className: "flex items-center gap-1.5 ml-auto shrink-0",
|
|
866
|
+
children: [/* @__PURE__ */ e(S, {
|
|
867
|
+
className: "tabular-nums text-[0.65rem]",
|
|
868
|
+
children: i.offset_name
|
|
869
|
+
}), h && /* @__PURE__ */ e(V, {})]
|
|
870
|
+
})]
|
|
871
|
+
}, i.name);
|
|
872
|
+
})] })] })
|
|
873
|
+
});
|
|
874
|
+
}
|
|
875
|
+
export {
|
|
876
|
+
S as Badge,
|
|
877
|
+
V as CheckIcon,
|
|
878
|
+
O as CommandEmpty,
|
|
879
|
+
P as CommandInput,
|
|
880
|
+
B as CommandItem,
|
|
881
|
+
_ as CommandList,
|
|
882
|
+
L as CommandRoot,
|
|
883
|
+
fe as CountryMultiSelect,
|
|
884
|
+
he as CountryPicker,
|
|
885
|
+
ue as CurrencyMultiSelect,
|
|
886
|
+
ge as CurrencyPicker,
|
|
887
|
+
xe as DivisionPicker,
|
|
888
|
+
D as Flag,
|
|
889
|
+
be as LanguagePicker,
|
|
890
|
+
ie as PhoneInput,
|
|
891
|
+
E as PickerTrigger,
|
|
892
|
+
J as Popover,
|
|
893
|
+
W as PopoverContent,
|
|
894
|
+
Y as PopoverTrigger,
|
|
895
|
+
Ne as TimezonePicker,
|
|
896
|
+
y as cn
|
|
897
|
+
};
|
|
898
|
+
|
|
899
|
+
//# sourceMappingURL=index.mjs.map
|