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