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
|
@@ -0,0 +1,841 @@
|
|
|
1
|
+
import { jsx as e, jsxs as n, Fragment as C } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as b, useEffect as N } from "react";
|
|
3
|
+
import { u as I, s as L, g as S, a as $, b as E, c as B, d as O, e as P, f as _, h as W, i as Q } from "./useTimezonePicker-BMFPsn3E.mjs";
|
|
4
|
+
import { j as ce, k as se, l as ie, m as te, n as le, o as oe, p as ae, q as de, r as me, t as he, v as pe, w as ke, x as ue, y as ge, z as Ne } from "./useTimezonePicker-BMFPsn3E.mjs";
|
|
5
|
+
function f({ value: s, onChange: o, placeholder: u = "Search...", autoFocus: h = !0 }) {
|
|
6
|
+
const m = b(null);
|
|
7
|
+
return N(() => {
|
|
8
|
+
h && setTimeout(() => {
|
|
9
|
+
var d;
|
|
10
|
+
return (d = m.current) == null ? void 0 : d.focus();
|
|
11
|
+
}, 50);
|
|
12
|
+
}, [h]), /* @__PURE__ */ e("div", { className: "rck-search-wrapper", children: /* @__PURE__ */ n("div", { className: "rck-search", children: [
|
|
13
|
+
/* @__PURE__ */ n("svg", { className: "rck-search-icon", viewBox: "0 0 20 20", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
|
|
14
|
+
/* @__PURE__ */ e("circle", { cx: "8.5", cy: "8.5", r: "5.5" }),
|
|
15
|
+
/* @__PURE__ */ e("path", { d: "M17 17l-4-4", strokeLinecap: "round" })
|
|
16
|
+
] }),
|
|
17
|
+
/* @__PURE__ */ e(
|
|
18
|
+
"input",
|
|
19
|
+
{
|
|
20
|
+
ref: m,
|
|
21
|
+
type: "text",
|
|
22
|
+
value: s,
|
|
23
|
+
onChange: (d) => o(d.target.value),
|
|
24
|
+
placeholder: u,
|
|
25
|
+
"aria-label": "Search"
|
|
26
|
+
}
|
|
27
|
+
),
|
|
28
|
+
s && /* @__PURE__ */ e(
|
|
29
|
+
"button",
|
|
30
|
+
{
|
|
31
|
+
style: { background: "none", border: "none", cursor: "pointer", color: "var(--rck-text-placeholder)", padding: 0, display: "flex" },
|
|
32
|
+
onClick: () => o(""),
|
|
33
|
+
"aria-label": "Clear search",
|
|
34
|
+
type: "button",
|
|
35
|
+
children: /* @__PURE__ */ e("svg", { width: "14", height: "14", viewBox: "0 0 20 20", fill: "currentColor", children: /* @__PURE__ */ e("path", { d: "M6 6l8 8M14 6l-8 8", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", fill: "none" }) })
|
|
36
|
+
}
|
|
37
|
+
)
|
|
38
|
+
] }) });
|
|
39
|
+
}
|
|
40
|
+
const v = 3;
|
|
41
|
+
function T() {
|
|
42
|
+
return /* @__PURE__ */ e("svg", { viewBox: "0 0 20 20", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ e("polyline", { points: "4 10 8 14 16 6" }) });
|
|
43
|
+
}
|
|
44
|
+
function U({
|
|
45
|
+
value: s,
|
|
46
|
+
onChange: o,
|
|
47
|
+
placeholder: u = "Select countries...",
|
|
48
|
+
maxItems: h,
|
|
49
|
+
showFlags: m = !0,
|
|
50
|
+
searchable: d = !0,
|
|
51
|
+
disabled: g = !1,
|
|
52
|
+
className: k,
|
|
53
|
+
label: r
|
|
54
|
+
}) {
|
|
55
|
+
const c = I(
|
|
56
|
+
S(),
|
|
57
|
+
(t, a) => a ? L(a) : t,
|
|
58
|
+
(t) => t.iso2,
|
|
59
|
+
s,
|
|
60
|
+
o,
|
|
61
|
+
h
|
|
62
|
+
), i = b(null);
|
|
63
|
+
N(() => {
|
|
64
|
+
if (!c.isOpen) return;
|
|
65
|
+
const t = (a) => {
|
|
66
|
+
i.current && !i.current.contains(a.target) && c.close();
|
|
67
|
+
};
|
|
68
|
+
return document.addEventListener("mousedown", t), () => document.removeEventListener("mousedown", t);
|
|
69
|
+
}, [c.isOpen, c.close]), N(() => {
|
|
70
|
+
if (!c.isOpen) return;
|
|
71
|
+
const t = (a) => {
|
|
72
|
+
a.key === "Escape" && c.close();
|
|
73
|
+
};
|
|
74
|
+
return document.addEventListener("keydown", t), () => document.removeEventListener("keydown", t);
|
|
75
|
+
}, [c.isOpen, c.close]);
|
|
76
|
+
const l = s.slice(0, v), p = s.length - v;
|
|
77
|
+
return /* @__PURE__ */ n("div", { ref: i, className: `rck-picker${k ? ` ${k}` : ""}`, children: [
|
|
78
|
+
r && /* @__PURE__ */ e("span", { className: "rck-label", children: r }),
|
|
79
|
+
/* @__PURE__ */ n(
|
|
80
|
+
"button",
|
|
81
|
+
{
|
|
82
|
+
type: "button",
|
|
83
|
+
className: `rck-multiselect-trigger${c.isOpen ? " rck-open" : ""}`,
|
|
84
|
+
disabled: g,
|
|
85
|
+
onClick: c.toggle,
|
|
86
|
+
"aria-haspopup": "listbox",
|
|
87
|
+
"aria-expanded": c.isOpen,
|
|
88
|
+
children: [
|
|
89
|
+
/* @__PURE__ */ e("div", { className: "rck-chips-area", children: s.length === 0 ? /* @__PURE__ */ e("span", { style: { color: "var(--rck-text-placeholder)", fontSize: "0.9375rem" }, children: u }) : /* @__PURE__ */ n(C, { children: [
|
|
90
|
+
l.map((t) => /* @__PURE__ */ n("span", { className: "rck-chip", children: [
|
|
91
|
+
m && /* @__PURE__ */ e("span", { children: t.flag }),
|
|
92
|
+
/* @__PURE__ */ e("span", { className: "rck-chip-label", children: t.name }),
|
|
93
|
+
/* @__PURE__ */ e(
|
|
94
|
+
"button",
|
|
95
|
+
{
|
|
96
|
+
type: "button",
|
|
97
|
+
className: "rck-chip-remove",
|
|
98
|
+
onClick: (a) => {
|
|
99
|
+
a.stopPropagation(), c.removeItem(t), o(s.filter((y) => y.iso2 !== t.iso2));
|
|
100
|
+
},
|
|
101
|
+
"aria-label": `Remove ${t.name}`,
|
|
102
|
+
children: /* @__PURE__ */ n("svg", { width: "10", height: "10", viewBox: "0 0 20 20", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", children: [
|
|
103
|
+
/* @__PURE__ */ e("line", { x1: "5", y1: "5", x2: "15", y2: "15" }),
|
|
104
|
+
/* @__PURE__ */ e("line", { x1: "15", y1: "5", x2: "5", y2: "15" })
|
|
105
|
+
] })
|
|
106
|
+
}
|
|
107
|
+
)
|
|
108
|
+
] }, t.iso2)),
|
|
109
|
+
p > 0 && /* @__PURE__ */ n("span", { className: "rck-chip-overflow", children: [
|
|
110
|
+
"+",
|
|
111
|
+
p,
|
|
112
|
+
" more"
|
|
113
|
+
] })
|
|
114
|
+
] }) }),
|
|
115
|
+
s.length > 0 && /* @__PURE__ */ e(
|
|
116
|
+
"button",
|
|
117
|
+
{
|
|
118
|
+
type: "button",
|
|
119
|
+
className: "rck-multiselect-clear",
|
|
120
|
+
onClick: (t) => {
|
|
121
|
+
t.stopPropagation(), c.clearAll(), o([]);
|
|
122
|
+
},
|
|
123
|
+
"aria-label": "Clear all",
|
|
124
|
+
children: /* @__PURE__ */ n("svg", { width: "14", height: "14", viewBox: "0 0 20 20", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", children: [
|
|
125
|
+
/* @__PURE__ */ e("line", { x1: "5", y1: "5", x2: "15", y2: "15" }),
|
|
126
|
+
/* @__PURE__ */ e("line", { x1: "15", y1: "5", x2: "5", y2: "15" })
|
|
127
|
+
] })
|
|
128
|
+
}
|
|
129
|
+
),
|
|
130
|
+
/* @__PURE__ */ e("svg", { className: "rck-chevron", viewBox: "0 0 20 20", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", children: /* @__PURE__ */ e("polyline", { points: "5 8 10 13 15 8" }) })
|
|
131
|
+
]
|
|
132
|
+
}
|
|
133
|
+
),
|
|
134
|
+
c.isOpen && /* @__PURE__ */ n("div", { className: "rck-dropdown", role: "listbox", "aria-multiselectable": "true", children: [
|
|
135
|
+
d && /* @__PURE__ */ e(f, { value: c.searchQuery, onChange: c.setSearchQuery, placeholder: "Search countries..." }),
|
|
136
|
+
/* @__PURE__ */ e("ul", { className: "rck-list", children: c.filteredItems.length === 0 ? /* @__PURE__ */ n("li", { className: "rck-empty", children: [
|
|
137
|
+
/* @__PURE__ */ e("span", { className: "rck-empty-icon", children: "๐" }),
|
|
138
|
+
/* @__PURE__ */ e("span", { children: "No countries found" })
|
|
139
|
+
] }) : c.filteredItems.map((t) => {
|
|
140
|
+
const a = c.isSelected(t);
|
|
141
|
+
return /* @__PURE__ */ n(
|
|
142
|
+
"li",
|
|
143
|
+
{
|
|
144
|
+
role: "option",
|
|
145
|
+
"aria-selected": a,
|
|
146
|
+
className: `rck-item${a ? " rck-item-selected" : ""}`,
|
|
147
|
+
onClick: () => c.toggleItem(t),
|
|
148
|
+
tabIndex: 0,
|
|
149
|
+
onKeyDown: (y) => y.key === "Enter" && c.toggleItem(t),
|
|
150
|
+
children: [
|
|
151
|
+
/* @__PURE__ */ e("div", { className: a ? "rck-item-check-multi" : "rck-item-check-empty", children: a && /* @__PURE__ */ e(T, {}) }),
|
|
152
|
+
m && /* @__PURE__ */ e("span", { className: "rck-item-flag", children: t.flag }),
|
|
153
|
+
/* @__PURE__ */ n("div", { className: "rck-item-main", children: [
|
|
154
|
+
/* @__PURE__ */ e("span", { className: "rck-item-name", children: t.name }),
|
|
155
|
+
/* @__PURE__ */ n("span", { className: "rck-item-sub", children: [
|
|
156
|
+
t.iso3,
|
|
157
|
+
" ยท +",
|
|
158
|
+
t.phone_code
|
|
159
|
+
] })
|
|
160
|
+
] })
|
|
161
|
+
]
|
|
162
|
+
},
|
|
163
|
+
t.iso2
|
|
164
|
+
);
|
|
165
|
+
}) })
|
|
166
|
+
] })
|
|
167
|
+
] });
|
|
168
|
+
}
|
|
169
|
+
const D = () => /* @__PURE__ */ e(
|
|
170
|
+
"svg",
|
|
171
|
+
{
|
|
172
|
+
className: "rck-chevron",
|
|
173
|
+
viewBox: "0 0 20 20",
|
|
174
|
+
fill: "none",
|
|
175
|
+
stroke: "currentColor",
|
|
176
|
+
strokeWidth: "2",
|
|
177
|
+
strokeLinecap: "round",
|
|
178
|
+
strokeLinejoin: "round",
|
|
179
|
+
children: /* @__PURE__ */ e("polyline", { points: "5 8 10 13 15 8" })
|
|
180
|
+
}
|
|
181
|
+
);
|
|
182
|
+
function x({
|
|
183
|
+
isOpen: s,
|
|
184
|
+
onClose: o,
|
|
185
|
+
onToggle: u,
|
|
186
|
+
label: h,
|
|
187
|
+
disabled: m,
|
|
188
|
+
className: d,
|
|
189
|
+
triggerContent: g,
|
|
190
|
+
children: k,
|
|
191
|
+
id: r
|
|
192
|
+
}) {
|
|
193
|
+
const c = b(null);
|
|
194
|
+
return N(() => {
|
|
195
|
+
if (!s) return;
|
|
196
|
+
const i = (l) => {
|
|
197
|
+
c.current && !c.current.contains(l.target) && o();
|
|
198
|
+
};
|
|
199
|
+
return document.addEventListener("mousedown", i), () => document.removeEventListener("mousedown", i);
|
|
200
|
+
}, [s, o]), N(() => {
|
|
201
|
+
if (!s) return;
|
|
202
|
+
const i = (l) => {
|
|
203
|
+
l.key === "Escape" && o();
|
|
204
|
+
};
|
|
205
|
+
return document.addEventListener("keydown", i), () => document.removeEventListener("keydown", i);
|
|
206
|
+
}, [s, o]), /* @__PURE__ */ n("div", { ref: c, className: `rck-picker${d ? ` ${d}` : ""}`, children: [
|
|
207
|
+
h && /* @__PURE__ */ e("span", { className: "rck-label", id: r ? `${r}-label` : void 0, children: h }),
|
|
208
|
+
/* @__PURE__ */ n(
|
|
209
|
+
"button",
|
|
210
|
+
{
|
|
211
|
+
type: "button",
|
|
212
|
+
className: `rck-trigger${s ? " rck-open" : ""}`,
|
|
213
|
+
disabled: m,
|
|
214
|
+
"aria-haspopup": "listbox",
|
|
215
|
+
"aria-expanded": s,
|
|
216
|
+
"aria-labelledby": r && h ? `${r}-label` : void 0,
|
|
217
|
+
id: r,
|
|
218
|
+
onClick: u,
|
|
219
|
+
children: [
|
|
220
|
+
g,
|
|
221
|
+
/* @__PURE__ */ e(D, {})
|
|
222
|
+
]
|
|
223
|
+
}
|
|
224
|
+
),
|
|
225
|
+
s && /* @__PURE__ */ e("div", { className: "rck-dropdown", role: "listbox", children: k })
|
|
226
|
+
] });
|
|
227
|
+
}
|
|
228
|
+
const j = () => /* @__PURE__ */ e("svg", { className: "rck-item-check", viewBox: "0 0 20 20", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ e("polyline", { points: "4 10 8 14 16 6" }) });
|
|
229
|
+
function G({
|
|
230
|
+
value: s,
|
|
231
|
+
onChange: o,
|
|
232
|
+
placeholder: u = "Select a country",
|
|
233
|
+
searchable: h = !0,
|
|
234
|
+
showFlag: m = !0,
|
|
235
|
+
showPhoneCode: d = !1,
|
|
236
|
+
disabled: g = !1,
|
|
237
|
+
className: k,
|
|
238
|
+
label: r
|
|
239
|
+
}) {
|
|
240
|
+
const c = $(s, o), i = /* @__PURE__ */ e("div", { className: "rck-trigger-content", children: s ? /* @__PURE__ */ n(C, { children: [
|
|
241
|
+
m && /* @__PURE__ */ e("span", { className: "rck-flag", children: s.flag }),
|
|
242
|
+
/* @__PURE__ */ e("span", { className: "rck-trigger-text", children: s.name }),
|
|
243
|
+
d && /* @__PURE__ */ n("span", { className: "rck-badge", children: [
|
|
244
|
+
"+",
|
|
245
|
+
s.phone_code
|
|
246
|
+
] })
|
|
247
|
+
] }) : /* @__PURE__ */ e("span", { className: "rck-trigger-text rck-placeholder", children: u }) });
|
|
248
|
+
return /* @__PURE__ */ n(
|
|
249
|
+
x,
|
|
250
|
+
{
|
|
251
|
+
isOpen: c.isOpen,
|
|
252
|
+
onClose: c.close,
|
|
253
|
+
onToggle: c.toggle,
|
|
254
|
+
label: r,
|
|
255
|
+
disabled: g,
|
|
256
|
+
className: k,
|
|
257
|
+
triggerContent: i,
|
|
258
|
+
id: "rck-country-picker",
|
|
259
|
+
children: [
|
|
260
|
+
h && /* @__PURE__ */ e(
|
|
261
|
+
f,
|
|
262
|
+
{
|
|
263
|
+
value: c.searchQuery,
|
|
264
|
+
onChange: c.setSearchQuery,
|
|
265
|
+
placeholder: "Search country..."
|
|
266
|
+
}
|
|
267
|
+
),
|
|
268
|
+
/* @__PURE__ */ e("ul", { className: "rck-list", role: "listbox", "aria-label": "Countries", children: c.filteredItems.length === 0 ? /* @__PURE__ */ n("li", { className: "rck-empty", children: [
|
|
269
|
+
/* @__PURE__ */ e("span", { className: "rck-empty-icon", children: "๐" }),
|
|
270
|
+
/* @__PURE__ */ e("span", { children: "No countries found" })
|
|
271
|
+
] }) : c.filteredItems.map((l) => {
|
|
272
|
+
const p = (s == null ? void 0 : s.iso2) === l.iso2;
|
|
273
|
+
return /* @__PURE__ */ n(
|
|
274
|
+
"li",
|
|
275
|
+
{
|
|
276
|
+
role: "option",
|
|
277
|
+
"aria-selected": p,
|
|
278
|
+
className: `rck-item${p ? " rck-item-selected" : ""}`,
|
|
279
|
+
onClick: () => c.selectItem(l),
|
|
280
|
+
tabIndex: 0,
|
|
281
|
+
onKeyDown: (t) => t.key === "Enter" && c.selectItem(l),
|
|
282
|
+
children: [
|
|
283
|
+
m && /* @__PURE__ */ e("span", { className: "rck-item-flag", children: l.flag }),
|
|
284
|
+
/* @__PURE__ */ n("div", { className: "rck-item-main", children: [
|
|
285
|
+
/* @__PURE__ */ e("span", { className: "rck-item-name", children: l.name }),
|
|
286
|
+
/* @__PURE__ */ n("span", { className: "rck-item-sub", children: [
|
|
287
|
+
l.iso3,
|
|
288
|
+
" ยท ",
|
|
289
|
+
l.division_type
|
|
290
|
+
] })
|
|
291
|
+
] }),
|
|
292
|
+
/* @__PURE__ */ n("div", { className: "rck-item-right", children: [
|
|
293
|
+
d && /* @__PURE__ */ n("span", { className: "rck-item-phone", children: [
|
|
294
|
+
"+",
|
|
295
|
+
l.phone_code
|
|
296
|
+
] }),
|
|
297
|
+
p && /* @__PURE__ */ e(j, {})
|
|
298
|
+
] })
|
|
299
|
+
]
|
|
300
|
+
},
|
|
301
|
+
l.iso2
|
|
302
|
+
);
|
|
303
|
+
}) })
|
|
304
|
+
]
|
|
305
|
+
}
|
|
306
|
+
);
|
|
307
|
+
}
|
|
308
|
+
const w = 3;
|
|
309
|
+
function z() {
|
|
310
|
+
return /* @__PURE__ */ e("svg", { viewBox: "0 0 20 20", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ e("polyline", { points: "4 10 8 14 16 6" }) });
|
|
311
|
+
}
|
|
312
|
+
function J({
|
|
313
|
+
value: s,
|
|
314
|
+
onChange: o,
|
|
315
|
+
placeholder: u = "Select currencies...",
|
|
316
|
+
maxItems: h,
|
|
317
|
+
showSymbol: m = !0,
|
|
318
|
+
searchable: d = !0,
|
|
319
|
+
disabled: g = !1,
|
|
320
|
+
className: k,
|
|
321
|
+
label: r
|
|
322
|
+
}) {
|
|
323
|
+
const c = I(
|
|
324
|
+
B(),
|
|
325
|
+
(t, a) => a ? E(a) : t,
|
|
326
|
+
(t) => t.code,
|
|
327
|
+
s,
|
|
328
|
+
o,
|
|
329
|
+
h
|
|
330
|
+
), i = b(null);
|
|
331
|
+
N(() => {
|
|
332
|
+
if (!c.isOpen) return;
|
|
333
|
+
const t = (a) => {
|
|
334
|
+
i.current && !i.current.contains(a.target) && c.close();
|
|
335
|
+
};
|
|
336
|
+
return document.addEventListener("mousedown", t), () => document.removeEventListener("mousedown", t);
|
|
337
|
+
}, [c.isOpen, c.close]), N(() => {
|
|
338
|
+
if (!c.isOpen) return;
|
|
339
|
+
const t = (a) => {
|
|
340
|
+
a.key === "Escape" && c.close();
|
|
341
|
+
};
|
|
342
|
+
return document.addEventListener("keydown", t), () => document.removeEventListener("keydown", t);
|
|
343
|
+
}, [c.isOpen, c.close]);
|
|
344
|
+
const l = s.slice(0, w), p = s.length - w;
|
|
345
|
+
return /* @__PURE__ */ n("div", { ref: i, className: `rck-picker${k ? ` ${k}` : ""}`, children: [
|
|
346
|
+
r && /* @__PURE__ */ e("span", { className: "rck-label", children: r }),
|
|
347
|
+
/* @__PURE__ */ n(
|
|
348
|
+
"button",
|
|
349
|
+
{
|
|
350
|
+
type: "button",
|
|
351
|
+
className: `rck-multiselect-trigger${c.isOpen ? " rck-open" : ""}`,
|
|
352
|
+
disabled: g,
|
|
353
|
+
onClick: c.toggle,
|
|
354
|
+
"aria-haspopup": "listbox",
|
|
355
|
+
"aria-expanded": c.isOpen,
|
|
356
|
+
children: [
|
|
357
|
+
/* @__PURE__ */ e("div", { className: "rck-chips-area", children: s.length === 0 ? /* @__PURE__ */ e("span", { style: { color: "var(--rck-text-placeholder)", fontSize: "0.9375rem" }, children: u }) : /* @__PURE__ */ n(C, { children: [
|
|
358
|
+
l.map((t) => /* @__PURE__ */ n("span", { className: "rck-chip", children: [
|
|
359
|
+
m && /* @__PURE__ */ e("span", { children: t.symbol }),
|
|
360
|
+
/* @__PURE__ */ e("span", { className: "rck-chip-label", children: t.code }),
|
|
361
|
+
/* @__PURE__ */ e(
|
|
362
|
+
"button",
|
|
363
|
+
{
|
|
364
|
+
type: "button",
|
|
365
|
+
className: "rck-chip-remove",
|
|
366
|
+
onClick: (a) => {
|
|
367
|
+
a.stopPropagation(), o(s.filter((y) => y.code !== t.code));
|
|
368
|
+
},
|
|
369
|
+
"aria-label": `Remove ${t.code}`,
|
|
370
|
+
children: /* @__PURE__ */ n("svg", { width: "10", height: "10", viewBox: "0 0 20 20", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", children: [
|
|
371
|
+
/* @__PURE__ */ e("line", { x1: "5", y1: "5", x2: "15", y2: "15" }),
|
|
372
|
+
/* @__PURE__ */ e("line", { x1: "15", y1: "5", x2: "5", y2: "15" })
|
|
373
|
+
] })
|
|
374
|
+
}
|
|
375
|
+
)
|
|
376
|
+
] }, t.code)),
|
|
377
|
+
p > 0 && /* @__PURE__ */ n("span", { className: "rck-chip-overflow", children: [
|
|
378
|
+
"+",
|
|
379
|
+
p,
|
|
380
|
+
" more"
|
|
381
|
+
] })
|
|
382
|
+
] }) }),
|
|
383
|
+
s.length > 0 && /* @__PURE__ */ e(
|
|
384
|
+
"button",
|
|
385
|
+
{
|
|
386
|
+
type: "button",
|
|
387
|
+
className: "rck-multiselect-clear",
|
|
388
|
+
onClick: (t) => {
|
|
389
|
+
t.stopPropagation(), c.clearAll(), o([]);
|
|
390
|
+
},
|
|
391
|
+
"aria-label": "Clear all",
|
|
392
|
+
children: /* @__PURE__ */ n("svg", { width: "14", height: "14", viewBox: "0 0 20 20", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", children: [
|
|
393
|
+
/* @__PURE__ */ e("line", { x1: "5", y1: "5", x2: "15", y2: "15" }),
|
|
394
|
+
/* @__PURE__ */ e("line", { x1: "15", y1: "5", x2: "5", y2: "15" })
|
|
395
|
+
] })
|
|
396
|
+
}
|
|
397
|
+
),
|
|
398
|
+
/* @__PURE__ */ e("svg", { className: "rck-chevron", viewBox: "0 0 20 20", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", children: /* @__PURE__ */ e("polyline", { points: "5 8 10 13 15 8" }) })
|
|
399
|
+
]
|
|
400
|
+
}
|
|
401
|
+
),
|
|
402
|
+
c.isOpen && /* @__PURE__ */ n("div", { className: "rck-dropdown", role: "listbox", "aria-multiselectable": "true", children: [
|
|
403
|
+
d && /* @__PURE__ */ e(f, { value: c.searchQuery, onChange: c.setSearchQuery, placeholder: "Search currencies..." }),
|
|
404
|
+
/* @__PURE__ */ e("ul", { className: "rck-list", children: c.filteredItems.length === 0 ? /* @__PURE__ */ n("li", { className: "rck-empty", children: [
|
|
405
|
+
/* @__PURE__ */ e("span", { className: "rck-empty-icon", children: "๐ฐ" }),
|
|
406
|
+
/* @__PURE__ */ e("span", { children: "No currencies found" })
|
|
407
|
+
] }) : c.filteredItems.map((t) => {
|
|
408
|
+
const a = c.isSelected(t);
|
|
409
|
+
return /* @__PURE__ */ n(
|
|
410
|
+
"li",
|
|
411
|
+
{
|
|
412
|
+
role: "option",
|
|
413
|
+
"aria-selected": a,
|
|
414
|
+
className: `rck-item${a ? " rck-item-selected" : ""}`,
|
|
415
|
+
onClick: () => c.toggleItem(t),
|
|
416
|
+
tabIndex: 0,
|
|
417
|
+
onKeyDown: (y) => y.key === "Enter" && c.toggleItem(t),
|
|
418
|
+
children: [
|
|
419
|
+
/* @__PURE__ */ e("div", { className: a ? "rck-item-check-multi" : "rck-item-check-empty", children: a && /* @__PURE__ */ e(z, {}) }),
|
|
420
|
+
m && /* @__PURE__ */ e("span", { className: "rck-item-symbol", children: t.symbol }),
|
|
421
|
+
/* @__PURE__ */ n("div", { className: "rck-item-main", children: [
|
|
422
|
+
/* @__PURE__ */ e("span", { className: "rck-item-name", children: t.name }),
|
|
423
|
+
/* @__PURE__ */ e("span", { className: "rck-item-sub", children: t.code })
|
|
424
|
+
] })
|
|
425
|
+
]
|
|
426
|
+
},
|
|
427
|
+
t.code
|
|
428
|
+
);
|
|
429
|
+
}) })
|
|
430
|
+
] })
|
|
431
|
+
] });
|
|
432
|
+
}
|
|
433
|
+
const M = () => /* @__PURE__ */ e("svg", { className: "rck-item-check", viewBox: "0 0 20 20", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ e("polyline", { points: "4 10 8 14 16 6" }) });
|
|
434
|
+
function Y({
|
|
435
|
+
value: s,
|
|
436
|
+
onChange: o,
|
|
437
|
+
placeholder: u = "Select a currency",
|
|
438
|
+
searchable: h = !0,
|
|
439
|
+
showSymbol: m = !0,
|
|
440
|
+
disabled: d = !1,
|
|
441
|
+
className: g,
|
|
442
|
+
label: k
|
|
443
|
+
}) {
|
|
444
|
+
const r = O(s, o), c = /* @__PURE__ */ e("div", { className: "rck-trigger-content", children: s ? /* @__PURE__ */ n(C, { children: [
|
|
445
|
+
m && /* @__PURE__ */ e("span", { className: "rck-item-symbol", children: s.symbol }),
|
|
446
|
+
/* @__PURE__ */ n("span", { className: "rck-trigger-text", children: [
|
|
447
|
+
s.code,
|
|
448
|
+
" โ ",
|
|
449
|
+
s.name
|
|
450
|
+
] })
|
|
451
|
+
] }) : /* @__PURE__ */ e("span", { className: "rck-trigger-text rck-placeholder", children: u }) });
|
|
452
|
+
return /* @__PURE__ */ n(
|
|
453
|
+
x,
|
|
454
|
+
{
|
|
455
|
+
isOpen: r.isOpen,
|
|
456
|
+
onClose: r.close,
|
|
457
|
+
onToggle: r.toggle,
|
|
458
|
+
label: k,
|
|
459
|
+
disabled: d,
|
|
460
|
+
className: g,
|
|
461
|
+
triggerContent: c,
|
|
462
|
+
id: "rck-currency-picker",
|
|
463
|
+
children: [
|
|
464
|
+
h && /* @__PURE__ */ e(
|
|
465
|
+
f,
|
|
466
|
+
{
|
|
467
|
+
value: r.searchQuery,
|
|
468
|
+
onChange: r.setSearchQuery,
|
|
469
|
+
placeholder: "Search currency..."
|
|
470
|
+
}
|
|
471
|
+
),
|
|
472
|
+
/* @__PURE__ */ e("ul", { className: "rck-list", role: "listbox", "aria-label": "Currencies", children: r.filteredItems.length === 0 ? /* @__PURE__ */ n("li", { className: "rck-empty", children: [
|
|
473
|
+
/* @__PURE__ */ e("span", { className: "rck-empty-icon", children: "๐ฐ" }),
|
|
474
|
+
/* @__PURE__ */ e("span", { children: "No currencies found" })
|
|
475
|
+
] }) : r.filteredItems.map((i) => {
|
|
476
|
+
const l = (s == null ? void 0 : s.code) === i.code;
|
|
477
|
+
return /* @__PURE__ */ n(
|
|
478
|
+
"li",
|
|
479
|
+
{
|
|
480
|
+
role: "option",
|
|
481
|
+
"aria-selected": l,
|
|
482
|
+
className: `rck-item${l ? " rck-item-selected" : ""}`,
|
|
483
|
+
onClick: () => r.selectItem(i),
|
|
484
|
+
tabIndex: 0,
|
|
485
|
+
onKeyDown: (p) => p.key === "Enter" && r.selectItem(i),
|
|
486
|
+
children: [
|
|
487
|
+
m && /* @__PURE__ */ e("span", { className: "rck-item-symbol", children: i.symbol }),
|
|
488
|
+
/* @__PURE__ */ n("div", { className: "rck-item-main", children: [
|
|
489
|
+
/* @__PURE__ */ e("span", { className: "rck-item-name", children: i.name }),
|
|
490
|
+
/* @__PURE__ */ e("span", { className: "rck-item-sub", children: i.code })
|
|
491
|
+
] }),
|
|
492
|
+
l && /* @__PURE__ */ e(M, {})
|
|
493
|
+
]
|
|
494
|
+
},
|
|
495
|
+
i.code
|
|
496
|
+
);
|
|
497
|
+
}) })
|
|
498
|
+
]
|
|
499
|
+
}
|
|
500
|
+
);
|
|
501
|
+
}
|
|
502
|
+
const A = () => /* @__PURE__ */ e("svg", { className: "rck-item-check", viewBox: "0 0 20 20", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ e("polyline", { points: "4 10 8 14 16 6" }) });
|
|
503
|
+
function Z({
|
|
504
|
+
countryIso2: s,
|
|
505
|
+
value: o,
|
|
506
|
+
onChange: u,
|
|
507
|
+
placeholder: h = "Select a division",
|
|
508
|
+
searchable: m = !0,
|
|
509
|
+
disabled: d = !1,
|
|
510
|
+
className: g,
|
|
511
|
+
label: k
|
|
512
|
+
}) {
|
|
513
|
+
const r = P(s, o, u), c = /* @__PURE__ */ e("div", { className: "rck-trigger-content", children: o ? /* @__PURE__ */ n(C, { children: [
|
|
514
|
+
/* @__PURE__ */ e("span", { className: "rck-trigger-text", children: o.name }),
|
|
515
|
+
/* @__PURE__ */ e("span", { className: "rck-badge", children: o.iso2 })
|
|
516
|
+
] }) : /* @__PURE__ */ e("span", { className: "rck-trigger-text rck-placeholder", children: h }) }), i = d || !s;
|
|
517
|
+
return /* @__PURE__ */ n(
|
|
518
|
+
x,
|
|
519
|
+
{
|
|
520
|
+
isOpen: r.isOpen,
|
|
521
|
+
onClose: r.close,
|
|
522
|
+
onToggle: r.toggle,
|
|
523
|
+
label: k,
|
|
524
|
+
disabled: i,
|
|
525
|
+
className: g,
|
|
526
|
+
triggerContent: c,
|
|
527
|
+
id: "rck-division-picker",
|
|
528
|
+
children: [
|
|
529
|
+
m && /* @__PURE__ */ e(
|
|
530
|
+
f,
|
|
531
|
+
{
|
|
532
|
+
value: r.searchQuery,
|
|
533
|
+
onChange: r.setSearchQuery,
|
|
534
|
+
placeholder: "Search division..."
|
|
535
|
+
}
|
|
536
|
+
),
|
|
537
|
+
/* @__PURE__ */ e("ul", { className: "rck-list", role: "listbox", "aria-label": "Divisions", children: r.filteredItems.length === 0 ? /* @__PURE__ */ n("li", { className: "rck-empty", children: [
|
|
538
|
+
/* @__PURE__ */ e("span", { className: "rck-empty-icon", children: "๐บ๏ธ" }),
|
|
539
|
+
/* @__PURE__ */ e("span", { children: "No divisions found" })
|
|
540
|
+
] }) : r.filteredItems.map((l) => {
|
|
541
|
+
const p = (o == null ? void 0 : o.iso2) === l.iso2 && (o == null ? void 0 : o.name) === l.name;
|
|
542
|
+
return /* @__PURE__ */ n(
|
|
543
|
+
"li",
|
|
544
|
+
{
|
|
545
|
+
role: "option",
|
|
546
|
+
"aria-selected": p,
|
|
547
|
+
className: `rck-item${p ? " rck-item-selected" : ""}`,
|
|
548
|
+
onClick: () => r.selectItem(l),
|
|
549
|
+
tabIndex: 0,
|
|
550
|
+
onKeyDown: (t) => t.key === "Enter" && r.selectItem(l),
|
|
551
|
+
children: [
|
|
552
|
+
/* @__PURE__ */ n("div", { className: "rck-item-main", children: [
|
|
553
|
+
/* @__PURE__ */ e("span", { className: "rck-item-name", children: l.name }),
|
|
554
|
+
/* @__PURE__ */ e("span", { className: "rck-item-sub", children: l.timezone })
|
|
555
|
+
] }),
|
|
556
|
+
/* @__PURE__ */ n("div", { className: "rck-item-right", children: [
|
|
557
|
+
/* @__PURE__ */ e("span", { className: "rck-badge", children: l.iso2 }),
|
|
558
|
+
p && /* @__PURE__ */ e(A, {})
|
|
559
|
+
] })
|
|
560
|
+
]
|
|
561
|
+
},
|
|
562
|
+
`${l.iso2}-${l.name}`
|
|
563
|
+
);
|
|
564
|
+
}) })
|
|
565
|
+
]
|
|
566
|
+
}
|
|
567
|
+
);
|
|
568
|
+
}
|
|
569
|
+
const K = () => /* @__PURE__ */ e("svg", { className: "rck-item-check", viewBox: "0 0 20 20", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ e("polyline", { points: "4 10 8 14 16 6" }) });
|
|
570
|
+
function q({
|
|
571
|
+
value: s,
|
|
572
|
+
onChange: o,
|
|
573
|
+
placeholder: u = "Select a language",
|
|
574
|
+
searchable: h = !0,
|
|
575
|
+
showNativeName: m = !0,
|
|
576
|
+
disabled: d = !1,
|
|
577
|
+
className: g,
|
|
578
|
+
label: k
|
|
579
|
+
}) {
|
|
580
|
+
const r = _(s, o), c = /* @__PURE__ */ e("div", { className: "rck-trigger-content", children: s ? /* @__PURE__ */ n(C, { children: [
|
|
581
|
+
/* @__PURE__ */ e("span", { className: "rck-trigger-text", children: s.english_name }),
|
|
582
|
+
m && s.native_name !== s.english_name && /* @__PURE__ */ e("span", { className: "rck-native-name", children: s.native_name })
|
|
583
|
+
] }) : /* @__PURE__ */ e("span", { className: "rck-trigger-text rck-placeholder", children: u }) });
|
|
584
|
+
return /* @__PURE__ */ n(
|
|
585
|
+
x,
|
|
586
|
+
{
|
|
587
|
+
isOpen: r.isOpen,
|
|
588
|
+
onClose: r.close,
|
|
589
|
+
onToggle: r.toggle,
|
|
590
|
+
label: k,
|
|
591
|
+
disabled: d,
|
|
592
|
+
className: g,
|
|
593
|
+
triggerContent: c,
|
|
594
|
+
id: "rck-language-picker",
|
|
595
|
+
children: [
|
|
596
|
+
h && /* @__PURE__ */ e(
|
|
597
|
+
f,
|
|
598
|
+
{
|
|
599
|
+
value: r.searchQuery,
|
|
600
|
+
onChange: r.setSearchQuery,
|
|
601
|
+
placeholder: "Search language..."
|
|
602
|
+
}
|
|
603
|
+
),
|
|
604
|
+
/* @__PURE__ */ e("ul", { className: "rck-list", role: "listbox", "aria-label": "Languages", children: r.filteredItems.length === 0 ? /* @__PURE__ */ n("li", { className: "rck-empty", children: [
|
|
605
|
+
/* @__PURE__ */ e("span", { className: "rck-empty-icon", children: "๐" }),
|
|
606
|
+
/* @__PURE__ */ e("span", { children: "No languages found" })
|
|
607
|
+
] }) : r.filteredItems.map((i) => {
|
|
608
|
+
const l = (s == null ? void 0 : s.code) === i.code;
|
|
609
|
+
return /* @__PURE__ */ n(
|
|
610
|
+
"li",
|
|
611
|
+
{
|
|
612
|
+
role: "option",
|
|
613
|
+
"aria-selected": l,
|
|
614
|
+
className: `rck-item${l ? " rck-item-selected" : ""}`,
|
|
615
|
+
onClick: () => r.selectItem(i),
|
|
616
|
+
tabIndex: 0,
|
|
617
|
+
onKeyDown: (p) => p.key === "Enter" && r.selectItem(i),
|
|
618
|
+
children: [
|
|
619
|
+
/* @__PURE__ */ n("div", { className: "rck-item-main", children: [
|
|
620
|
+
/* @__PURE__ */ e("span", { className: "rck-item-name", children: i.english_name }),
|
|
621
|
+
m && i.native_name !== i.english_name && /* @__PURE__ */ e("span", { className: "rck-item-sub", children: i.native_name })
|
|
622
|
+
] }),
|
|
623
|
+
/* @__PURE__ */ n("div", { className: "rck-item-right", children: [
|
|
624
|
+
/* @__PURE__ */ e("span", { className: "rck-badge", style: { fontSize: "0.68rem" }, children: i.code }),
|
|
625
|
+
l && /* @__PURE__ */ e(K, {})
|
|
626
|
+
] })
|
|
627
|
+
]
|
|
628
|
+
},
|
|
629
|
+
i.code
|
|
630
|
+
);
|
|
631
|
+
}) })
|
|
632
|
+
]
|
|
633
|
+
}
|
|
634
|
+
);
|
|
635
|
+
}
|
|
636
|
+
function F({
|
|
637
|
+
value: s,
|
|
638
|
+
onChange: o,
|
|
639
|
+
defaultCountryIso2: u = "US",
|
|
640
|
+
placeholder: h = "Phone number",
|
|
641
|
+
showFlag: m = !0,
|
|
642
|
+
disabled: d = !1,
|
|
643
|
+
className: g,
|
|
644
|
+
label: k
|
|
645
|
+
}) {
|
|
646
|
+
const r = W(s, o, u), c = b(null);
|
|
647
|
+
return N(() => {
|
|
648
|
+
if (!r.isOpen) return;
|
|
649
|
+
const i = (l) => {
|
|
650
|
+
c.current && !c.current.contains(l.target) && r.close();
|
|
651
|
+
};
|
|
652
|
+
return document.addEventListener("mousedown", i), () => document.removeEventListener("mousedown", i);
|
|
653
|
+
}, [r.isOpen, r.close]), N(() => {
|
|
654
|
+
if (!r.isOpen) return;
|
|
655
|
+
const i = (l) => {
|
|
656
|
+
l.key === "Escape" && r.close();
|
|
657
|
+
};
|
|
658
|
+
return document.addEventListener("keydown", i), () => document.removeEventListener("keydown", i);
|
|
659
|
+
}, [r.isOpen, r.close]), /* @__PURE__ */ n("div", { ref: c, className: `rck-phone-wrapper${g ? ` ${g}` : ""}`, children: [
|
|
660
|
+
k && /* @__PURE__ */ e("span", { className: "rck-label", children: k }),
|
|
661
|
+
/* @__PURE__ */ n("div", { className: `rck-phone-field${d ? " rck-phone-disabled" : ""}`, children: [
|
|
662
|
+
/* @__PURE__ */ n(
|
|
663
|
+
"button",
|
|
664
|
+
{
|
|
665
|
+
type: "button",
|
|
666
|
+
className: "rck-phone-country-btn",
|
|
667
|
+
onClick: r.toggle,
|
|
668
|
+
"aria-expanded": r.isOpen,
|
|
669
|
+
"aria-label": "Select country code",
|
|
670
|
+
disabled: d,
|
|
671
|
+
children: [
|
|
672
|
+
m && r.country && /* @__PURE__ */ e("span", { className: "rck-phone-flag", children: r.country.flag }),
|
|
673
|
+
/* @__PURE__ */ e("span", { className: "rck-phone-dial", children: r.country ? `+${r.country.phone_code}` : "+?" }),
|
|
674
|
+
/* @__PURE__ */ e("svg", { className: "rck-phone-chevron", viewBox: "0 0 20 20", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", children: /* @__PURE__ */ e("polyline", { points: "5 8 10 13 15 8" }) })
|
|
675
|
+
]
|
|
676
|
+
}
|
|
677
|
+
),
|
|
678
|
+
/* @__PURE__ */ e(
|
|
679
|
+
"input",
|
|
680
|
+
{
|
|
681
|
+
type: "tel",
|
|
682
|
+
className: "rck-phone-input",
|
|
683
|
+
value: r.number,
|
|
684
|
+
onChange: (i) => r.setNumber(i.target.value),
|
|
685
|
+
placeholder: h,
|
|
686
|
+
disabled: d,
|
|
687
|
+
inputMode: "numeric",
|
|
688
|
+
autoComplete: "tel-national"
|
|
689
|
+
}
|
|
690
|
+
),
|
|
691
|
+
r.isOpen && /* @__PURE__ */ n("div", { className: "rck-phone-dropdown", children: [
|
|
692
|
+
/* @__PURE__ */ e(
|
|
693
|
+
f,
|
|
694
|
+
{
|
|
695
|
+
value: r.searchQuery,
|
|
696
|
+
onChange: r.setSearchQuery,
|
|
697
|
+
placeholder: "Search country or dial code..."
|
|
698
|
+
}
|
|
699
|
+
),
|
|
700
|
+
/* @__PURE__ */ e("ul", { className: "rck-list", role: "listbox", "aria-label": "Countries", children: r.filteredCountries.length === 0 ? /* @__PURE__ */ n("li", { className: "rck-empty", children: [
|
|
701
|
+
/* @__PURE__ */ e("span", { className: "rck-empty-icon", children: "๐" }),
|
|
702
|
+
/* @__PURE__ */ e("span", { children: "No countries found" })
|
|
703
|
+
] }) : r.filteredCountries.map((i) => {
|
|
704
|
+
var p;
|
|
705
|
+
const l = ((p = r.country) == null ? void 0 : p.iso2) === i.iso2;
|
|
706
|
+
return /* @__PURE__ */ n(
|
|
707
|
+
"li",
|
|
708
|
+
{
|
|
709
|
+
role: "option",
|
|
710
|
+
"aria-selected": l,
|
|
711
|
+
className: `rck-item${l ? " rck-item-selected" : ""}`,
|
|
712
|
+
onClick: () => r.selectCountry(i),
|
|
713
|
+
tabIndex: 0,
|
|
714
|
+
onKeyDown: (t) => t.key === "Enter" && r.selectCountry(i),
|
|
715
|
+
children: [
|
|
716
|
+
/* @__PURE__ */ e("span", { className: "rck-item-flag", children: i.flag }),
|
|
717
|
+
/* @__PURE__ */ n("div", { className: "rck-item-main", children: [
|
|
718
|
+
/* @__PURE__ */ e("span", { className: "rck-item-name", children: i.name }),
|
|
719
|
+
/* @__PURE__ */ e("span", { className: "rck-item-sub", children: i.iso2 })
|
|
720
|
+
] }),
|
|
721
|
+
/* @__PURE__ */ n("span", { className: "rck-item-phone", children: [
|
|
722
|
+
"+",
|
|
723
|
+
i.phone_code
|
|
724
|
+
] })
|
|
725
|
+
]
|
|
726
|
+
},
|
|
727
|
+
i.iso2
|
|
728
|
+
);
|
|
729
|
+
}) })
|
|
730
|
+
] })
|
|
731
|
+
] })
|
|
732
|
+
] });
|
|
733
|
+
}
|
|
734
|
+
const R = () => /* @__PURE__ */ e("svg", { className: "rck-item-check", viewBox: "0 0 20 20", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ e("polyline", { points: "4 10 8 14 16 6" }) });
|
|
735
|
+
function ee({
|
|
736
|
+
value: s,
|
|
737
|
+
onChange: o,
|
|
738
|
+
placeholder: u = "Select a timezone",
|
|
739
|
+
searchable: h = !0,
|
|
740
|
+
countryIso2: m,
|
|
741
|
+
disabled: d = !1,
|
|
742
|
+
className: g,
|
|
743
|
+
label: k
|
|
744
|
+
}) {
|
|
745
|
+
const r = Q(s, o, m), c = /* @__PURE__ */ e("div", { className: "rck-trigger-content", children: s ? /* @__PURE__ */ n(C, { children: [
|
|
746
|
+
/* @__PURE__ */ e("span", { className: "rck-trigger-text", children: s.name }),
|
|
747
|
+
/* @__PURE__ */ e("span", { className: "rck-badge", children: s.offset_name })
|
|
748
|
+
] }) : /* @__PURE__ */ e("span", { className: "rck-trigger-text rck-placeholder", children: u }) });
|
|
749
|
+
return /* @__PURE__ */ n(
|
|
750
|
+
x,
|
|
751
|
+
{
|
|
752
|
+
isOpen: r.isOpen,
|
|
753
|
+
onClose: r.close,
|
|
754
|
+
onToggle: r.toggle,
|
|
755
|
+
label: k,
|
|
756
|
+
disabled: d,
|
|
757
|
+
className: g,
|
|
758
|
+
triggerContent: c,
|
|
759
|
+
id: "rck-timezone-picker",
|
|
760
|
+
children: [
|
|
761
|
+
h && /* @__PURE__ */ e(
|
|
762
|
+
f,
|
|
763
|
+
{
|
|
764
|
+
value: r.searchQuery,
|
|
765
|
+
onChange: r.setSearchQuery,
|
|
766
|
+
placeholder: "Search timezone..."
|
|
767
|
+
}
|
|
768
|
+
),
|
|
769
|
+
/* @__PURE__ */ e("ul", { className: "rck-list", role: "listbox", "aria-label": "Timezones", children: r.filteredItems.length === 0 ? /* @__PURE__ */ n("li", { className: "rck-empty", children: [
|
|
770
|
+
/* @__PURE__ */ e("span", { className: "rck-empty-icon", children: "๐" }),
|
|
771
|
+
/* @__PURE__ */ e("span", { children: "No timezones found" })
|
|
772
|
+
] }) : r.filteredItems.map((i) => {
|
|
773
|
+
const l = (s == null ? void 0 : s.name) === i.name;
|
|
774
|
+
return /* @__PURE__ */ n(
|
|
775
|
+
"li",
|
|
776
|
+
{
|
|
777
|
+
role: "option",
|
|
778
|
+
"aria-selected": l,
|
|
779
|
+
className: `rck-item${l ? " rck-item-selected" : ""}`,
|
|
780
|
+
onClick: () => r.selectItem(i),
|
|
781
|
+
tabIndex: 0,
|
|
782
|
+
onKeyDown: (p) => p.key === "Enter" && r.selectItem(i),
|
|
783
|
+
children: [
|
|
784
|
+
/* @__PURE__ */ n("div", { className: "rck-item-main", children: [
|
|
785
|
+
/* @__PURE__ */ e("span", { className: "rck-item-name", children: i.name }),
|
|
786
|
+
/* @__PURE__ */ n("span", { className: "rck-item-sub", children: [
|
|
787
|
+
i.tzName,
|
|
788
|
+
" ยท ",
|
|
789
|
+
i.abbreviation
|
|
790
|
+
] })
|
|
791
|
+
] }),
|
|
792
|
+
/* @__PURE__ */ n("div", { className: "rck-item-right", children: [
|
|
793
|
+
/* @__PURE__ */ e("span", { className: "rck-offset-badge", children: i.offset_name }),
|
|
794
|
+
l && /* @__PURE__ */ e(R, {})
|
|
795
|
+
] })
|
|
796
|
+
]
|
|
797
|
+
},
|
|
798
|
+
i.name
|
|
799
|
+
);
|
|
800
|
+
}) })
|
|
801
|
+
]
|
|
802
|
+
}
|
|
803
|
+
);
|
|
804
|
+
}
|
|
805
|
+
export {
|
|
806
|
+
U as CountryMultiSelect,
|
|
807
|
+
G as CountryPicker,
|
|
808
|
+
J as CurrencyMultiSelect,
|
|
809
|
+
Y as CurrencyPicker,
|
|
810
|
+
Z as DivisionPicker,
|
|
811
|
+
q as LanguagePicker,
|
|
812
|
+
F as PhoneInput,
|
|
813
|
+
ee as TimezonePicker,
|
|
814
|
+
S as getAllCountries,
|
|
815
|
+
B as getAllCurrencies,
|
|
816
|
+
ce as getAllLanguages,
|
|
817
|
+
se as getAllTimezones,
|
|
818
|
+
ie as getCountryByIso2,
|
|
819
|
+
te as getCountryByIso3,
|
|
820
|
+
le as getCountryByName,
|
|
821
|
+
oe as getCurrencyByCode,
|
|
822
|
+
ae as getCurrencyByCountry,
|
|
823
|
+
de as getDivisionsByCountry,
|
|
824
|
+
me as getLanguageByCode,
|
|
825
|
+
he as getTimezoneByName,
|
|
826
|
+
pe as getTimezonesByCountry,
|
|
827
|
+
ke as iso2ToFlag,
|
|
828
|
+
L as searchCountries,
|
|
829
|
+
E as searchCurrencies,
|
|
830
|
+
ue as searchLanguages,
|
|
831
|
+
ge as searchTimezones,
|
|
832
|
+
Ne as useBasePicker,
|
|
833
|
+
$ as useCountryPicker,
|
|
834
|
+
O as useCurrencyPicker,
|
|
835
|
+
P as useDivisionPicker,
|
|
836
|
+
_ as useLanguagePicker,
|
|
837
|
+
I as useMultiSelect,
|
|
838
|
+
W as usePhoneInput,
|
|
839
|
+
Q as useTimezonePicker
|
|
840
|
+
};
|
|
841
|
+
//# sourceMappingURL=react-country-kit.es.js.map
|