react-country-kit 1.2.0 โ 1.3.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 +0 -1
- package/dist/components/CountryPicker/CountryPicker.d.ts +0 -1
- package/dist/components/CurrencyMultiSelect/CurrencyMultiSelect.d.ts +0 -1
- package/dist/components/CurrencyPicker/CurrencyPicker.d.ts +0 -1
- package/dist/components/DivisionPicker/DivisionPicker.d.ts +0 -1
- package/dist/components/LanguagePicker/LanguagePicker.d.ts +0 -1
- package/dist/components/PhoneInput/PhoneInput.d.ts +0 -1
- package/dist/components/TimezonePicker/TimezonePicker.d.ts +0 -1
- package/dist/components/shared/Flag.d.ts +0 -1
- package/dist/components/shared/PickerBase.d.ts +0 -1
- package/dist/react-country-kit.cjs.js +3 -2
- package/dist/react-country-kit.cjs.js.map +1 -1
- package/dist/react-country-kit.css +2 -0
- package/dist/react-country-kit.d.ts +1 -0
- package/dist/react-country-kit.es.js +993 -749
- package/dist/react-country-kit.es.js.map +1 -1
- package/package.json +10 -10
- package/dist/style.css +0 -1
|
@@ -1,824 +1,1067 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getAllCountries as S, getAllCurrencies as $, searchCountries as E, searchCurrencies as _, useCountryPicker as O, useCurrencyPicker as B, useDivisionPicker as P, useLanguagePicker as W, useMultiSelect as L, usePhoneInput as Q, useTimezonePicker as D } from "react-country-kit-core";
|
|
2
|
+
import { useEffect as f, useRef as C } from "react";
|
|
3
|
+
import { Fragment as y, jsx as e, jsxs as n } from "react/jsx-runtime";
|
|
2
4
|
export * from "react-country-kit-core";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
function N({ value: n, onChange: o, placeholder: k = "Search...", autoFocus: h = !0 }) {
|
|
6
|
-
const a = x(null);
|
|
5
|
+
function N({ value: i, onChange: a, placeholder: p = "Search...", autoFocus: m = !0 }) {
|
|
6
|
+
const o = C(null);
|
|
7
7
|
return f(() => {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
8
|
+
m && setTimeout(() => o.current?.focus(), 50);
|
|
9
|
+
}, [m]), /* @__PURE__ */ e("div", {
|
|
10
|
+
className: "rck-search-wrapper",
|
|
11
|
+
children: /* @__PURE__ */ n("div", {
|
|
12
|
+
className: "rck-search",
|
|
13
|
+
children: [
|
|
14
|
+
/* @__PURE__ */ n("svg", {
|
|
15
|
+
className: "rck-search-icon",
|
|
16
|
+
viewBox: "0 0 20 20",
|
|
17
|
+
fill: "none",
|
|
18
|
+
stroke: "currentColor",
|
|
19
|
+
strokeWidth: "2",
|
|
20
|
+
children: [/* @__PURE__ */ e("circle", {
|
|
21
|
+
cx: "8.5",
|
|
22
|
+
cy: "8.5",
|
|
23
|
+
r: "5.5"
|
|
24
|
+
}), /* @__PURE__ */ e("path", {
|
|
25
|
+
d: "M17 17l-4-4",
|
|
26
|
+
strokeLinecap: "round"
|
|
27
|
+
})]
|
|
28
|
+
}),
|
|
29
|
+
/* @__PURE__ */ e("input", {
|
|
30
|
+
ref: o,
|
|
31
|
+
type: "text",
|
|
32
|
+
value: i,
|
|
33
|
+
onChange: (h) => a(h.target.value),
|
|
34
|
+
placeholder: p,
|
|
35
|
+
"aria-label": "Search"
|
|
36
|
+
}),
|
|
37
|
+
i && /* @__PURE__ */ e("button", {
|
|
38
|
+
style: {
|
|
39
|
+
background: "none",
|
|
40
|
+
border: "none",
|
|
41
|
+
cursor: "pointer",
|
|
42
|
+
color: "var(--rck-text-placeholder)",
|
|
43
|
+
padding: 0,
|
|
44
|
+
display: "flex"
|
|
45
|
+
},
|
|
46
|
+
onClick: () => a(""),
|
|
47
|
+
"aria-label": "Clear search",
|
|
48
|
+
type: "button",
|
|
49
|
+
children: /* @__PURE__ */ e("svg", {
|
|
50
|
+
width: "14",
|
|
51
|
+
height: "14",
|
|
52
|
+
viewBox: "0 0 20 20",
|
|
53
|
+
fill: "currentColor",
|
|
54
|
+
children: /* @__PURE__ */ e("path", {
|
|
55
|
+
d: "M6 6l8 8M14 6l-8 8",
|
|
56
|
+
stroke: "currentColor",
|
|
57
|
+
strokeWidth: "2",
|
|
58
|
+
strokeLinecap: "round",
|
|
59
|
+
fill: "none"
|
|
60
|
+
})
|
|
61
|
+
})
|
|
62
|
+
})
|
|
63
|
+
]
|
|
64
|
+
})
|
|
65
|
+
});
|
|
39
66
|
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
})
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
src: u,
|
|
53
|
-
alt: a || n,
|
|
54
|
-
className: `rck-flag-img ${h}`,
|
|
55
|
-
loading: "lazy"
|
|
56
|
-
}
|
|
57
|
-
) : /* @__PURE__ */ e("span", { className: `rck-flag-wrapper ${h}`, title: a || n, children: o || n });
|
|
67
|
+
var b = ({ iso2: i, flag: a, flagUrl: p, className: m = "", alt: o = "", mode: h = "auto" }) => {
|
|
68
|
+
const u = p || `https://flagcdn.com/w320/${i.toLowerCase()}.png`;
|
|
69
|
+
return h === "image" ? /* @__PURE__ */ e("img", {
|
|
70
|
+
src: u,
|
|
71
|
+
alt: o || i,
|
|
72
|
+
className: `rck-flag-img ${m}`,
|
|
73
|
+
loading: "lazy"
|
|
74
|
+
}) : /* @__PURE__ */ e("span", {
|
|
75
|
+
className: `rck-flag-wrapper ${m}`,
|
|
76
|
+
title: o || i,
|
|
77
|
+
children: a || i
|
|
78
|
+
});
|
|
58
79
|
}, w = 3;
|
|
59
80
|
function j() {
|
|
60
|
-
return /* @__PURE__ */ e("svg", {
|
|
81
|
+
return /* @__PURE__ */ e("svg", {
|
|
82
|
+
viewBox: "0 0 20 20",
|
|
83
|
+
fill: "none",
|
|
84
|
+
stroke: "currentColor",
|
|
85
|
+
strokeWidth: "2.5",
|
|
86
|
+
strokeLinecap: "round",
|
|
87
|
+
strokeLinejoin: "round",
|
|
88
|
+
children: /* @__PURE__ */ e("polyline", { points: "4 10 8 14 16 6" })
|
|
89
|
+
});
|
|
61
90
|
}
|
|
62
|
-
function G({
|
|
63
|
-
|
|
64
|
-
onChange: o,
|
|
65
|
-
placeholder: k = "Select countries...",
|
|
66
|
-
maxItems: h,
|
|
67
|
-
showFlags: a = !0,
|
|
68
|
-
searchable: d = !0,
|
|
69
|
-
disabled: u = !1,
|
|
70
|
-
className: g,
|
|
71
|
-
label: r
|
|
72
|
-
}) {
|
|
73
|
-
const i = L(
|
|
74
|
-
S(),
|
|
75
|
-
(t, m) => m ? $(m) : t,
|
|
76
|
-
(t) => t.iso2,
|
|
77
|
-
n,
|
|
78
|
-
o,
|
|
79
|
-
h
|
|
80
|
-
), s = x(null);
|
|
91
|
+
function G({ value: i, onChange: a, placeholder: p = "Select countries...", maxItems: m, showFlags: o = !0, searchable: h = !0, disabled: u = !1, className: g, label: r }) {
|
|
92
|
+
const c = L(S(), (s, d) => d ? E(d) : s, (s) => s.iso2, i, a, m), l = C(null);
|
|
81
93
|
f(() => {
|
|
82
|
-
if (!
|
|
83
|
-
const
|
|
84
|
-
|
|
94
|
+
if (!c.isOpen) return;
|
|
95
|
+
const s = (d) => {
|
|
96
|
+
l.current && !l.current.contains(d.target) && c.close();
|
|
85
97
|
};
|
|
86
|
-
return document.addEventListener("mousedown",
|
|
87
|
-
}, [
|
|
88
|
-
if (!
|
|
89
|
-
const
|
|
90
|
-
|
|
98
|
+
return document.addEventListener("mousedown", s), () => document.removeEventListener("mousedown", s);
|
|
99
|
+
}, [c.isOpen, c.close]), f(() => {
|
|
100
|
+
if (!c.isOpen) return;
|
|
101
|
+
const s = (d) => {
|
|
102
|
+
d.key === "Escape" && c.close();
|
|
91
103
|
};
|
|
92
|
-
return document.addEventListener("keydown",
|
|
93
|
-
}, [
|
|
94
|
-
const
|
|
95
|
-
return /* @__PURE__ */
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
{
|
|
104
|
+
return document.addEventListener("keydown", s), () => document.removeEventListener("keydown", s);
|
|
105
|
+
}, [c.isOpen, c.close]);
|
|
106
|
+
const t = i.slice(0, w), k = i.length - w;
|
|
107
|
+
return /* @__PURE__ */ n("div", {
|
|
108
|
+
ref: l,
|
|
109
|
+
className: `rck-picker${g ? ` ${g}` : ""}`,
|
|
110
|
+
children: [
|
|
111
|
+
r && /* @__PURE__ */ e("span", {
|
|
112
|
+
className: "rck-label",
|
|
113
|
+
children: r
|
|
114
|
+
}),
|
|
115
|
+
/* @__PURE__ */ n("button", {
|
|
100
116
|
type: "button",
|
|
101
|
-
className: `rck-multiselect-trigger${
|
|
117
|
+
className: `rck-multiselect-trigger${c.isOpen ? " rck-open" : ""}`,
|
|
102
118
|
disabled: u,
|
|
103
|
-
onClick:
|
|
119
|
+
onClick: c.toggle,
|
|
104
120
|
"aria-haspopup": "listbox",
|
|
105
|
-
"aria-expanded":
|
|
121
|
+
"aria-expanded": c.isOpen,
|
|
106
122
|
children: [
|
|
107
|
-
/* @__PURE__ */ e("div", {
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
"
|
|
113
|
-
|
|
123
|
+
/* @__PURE__ */ e("div", {
|
|
124
|
+
className: "rck-chips-area",
|
|
125
|
+
children: i.length === 0 ? /* @__PURE__ */ e("span", {
|
|
126
|
+
style: {
|
|
127
|
+
color: "var(--rck-text-placeholder)",
|
|
128
|
+
fontSize: "0.9375rem"
|
|
129
|
+
},
|
|
130
|
+
children: p
|
|
131
|
+
}) : /* @__PURE__ */ n(y, { children: [t.map((s) => /* @__PURE__ */ n("span", {
|
|
132
|
+
className: "rck-chip",
|
|
133
|
+
children: [
|
|
134
|
+
o && /* @__PURE__ */ e("span", {
|
|
135
|
+
className: "rck-flag",
|
|
136
|
+
children: /* @__PURE__ */ e(b, {
|
|
137
|
+
iso2: s.iso2,
|
|
138
|
+
flag: s.flag,
|
|
139
|
+
flagUrl: s.flag_url
|
|
140
|
+
})
|
|
141
|
+
}),
|
|
142
|
+
/* @__PURE__ */ e("span", {
|
|
143
|
+
className: "rck-chip-label",
|
|
144
|
+
children: s.name
|
|
145
|
+
}),
|
|
146
|
+
/* @__PURE__ */ e("button", {
|
|
114
147
|
type: "button",
|
|
115
148
|
className: "rck-chip-remove",
|
|
116
|
-
onClick: (
|
|
117
|
-
|
|
149
|
+
onClick: (d) => {
|
|
150
|
+
d.stopPropagation(), c.removeItem(s), a(i.filter((v) => v.iso2 !== s.iso2));
|
|
118
151
|
},
|
|
119
|
-
"aria-label": `Remove ${
|
|
120
|
-
children: /* @__PURE__ */
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
152
|
+
"aria-label": `Remove ${s.name}`,
|
|
153
|
+
children: /* @__PURE__ */ n("svg", {
|
|
154
|
+
width: "10",
|
|
155
|
+
height: "10",
|
|
156
|
+
viewBox: "0 0 20 20",
|
|
157
|
+
fill: "none",
|
|
158
|
+
stroke: "currentColor",
|
|
159
|
+
strokeWidth: "2.5",
|
|
160
|
+
strokeLinecap: "round",
|
|
161
|
+
children: [/* @__PURE__ */ e("line", {
|
|
162
|
+
x1: "5",
|
|
163
|
+
y1: "5",
|
|
164
|
+
x2: "15",
|
|
165
|
+
y2: "15"
|
|
166
|
+
}), /* @__PURE__ */ e("line", {
|
|
167
|
+
x1: "15",
|
|
168
|
+
y1: "5",
|
|
169
|
+
x2: "5",
|
|
170
|
+
y2: "15"
|
|
171
|
+
})]
|
|
172
|
+
})
|
|
173
|
+
})
|
|
174
|
+
]
|
|
175
|
+
}, s.iso2)), k > 0 && /* @__PURE__ */ n("span", {
|
|
176
|
+
className: "rck-chip-overflow",
|
|
177
|
+
children: [
|
|
178
|
+
"+",
|
|
179
|
+
k,
|
|
180
|
+
" more"
|
|
181
|
+
]
|
|
182
|
+
})] })
|
|
183
|
+
}),
|
|
184
|
+
i.length > 0 && /* @__PURE__ */ e("button", {
|
|
185
|
+
type: "button",
|
|
186
|
+
className: "rck-multiselect-clear",
|
|
187
|
+
onClick: (s) => {
|
|
188
|
+
s.stopPropagation(), c.clearAll(), a([]);
|
|
189
|
+
},
|
|
190
|
+
"aria-label": "Clear all",
|
|
191
|
+
children: /* @__PURE__ */ n("svg", {
|
|
192
|
+
width: "14",
|
|
193
|
+
height: "14",
|
|
194
|
+
viewBox: "0 0 20 20",
|
|
195
|
+
fill: "none",
|
|
196
|
+
stroke: "currentColor",
|
|
197
|
+
strokeWidth: "2",
|
|
198
|
+
strokeLinecap: "round",
|
|
199
|
+
children: [/* @__PURE__ */ e("line", {
|
|
200
|
+
x1: "5",
|
|
201
|
+
y1: "5",
|
|
202
|
+
x2: "15",
|
|
203
|
+
y2: "15"
|
|
204
|
+
}), /* @__PURE__ */ e("line", {
|
|
205
|
+
x1: "15",
|
|
206
|
+
y1: "5",
|
|
207
|
+
x2: "5",
|
|
208
|
+
y2: "15"
|
|
209
|
+
})]
|
|
210
|
+
})
|
|
211
|
+
}),
|
|
212
|
+
/* @__PURE__ */ e("svg", {
|
|
213
|
+
className: "rck-chevron",
|
|
214
|
+
viewBox: "0 0 20 20",
|
|
215
|
+
fill: "none",
|
|
216
|
+
stroke: "currentColor",
|
|
217
|
+
strokeWidth: "2",
|
|
218
|
+
strokeLinecap: "round",
|
|
219
|
+
children: /* @__PURE__ */ e("polyline", { points: "5 8 10 13 15 8" })
|
|
220
|
+
})
|
|
149
221
|
]
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
/* @__PURE__ */ e(
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
"
|
|
161
|
-
{
|
|
162
|
-
|
|
163
|
-
"
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
222
|
+
}),
|
|
223
|
+
c.isOpen && /* @__PURE__ */ n("div", {
|
|
224
|
+
className: "rck-dropdown",
|
|
225
|
+
role: "listbox",
|
|
226
|
+
"aria-multiselectable": "true",
|
|
227
|
+
children: [h && /* @__PURE__ */ e(N, {
|
|
228
|
+
value: c.searchQuery,
|
|
229
|
+
onChange: c.setSearchQuery,
|
|
230
|
+
placeholder: "Search countries..."
|
|
231
|
+
}), /* @__PURE__ */ e("ul", {
|
|
232
|
+
className: "rck-list",
|
|
233
|
+
children: c.filteredItems.length === 0 ? /* @__PURE__ */ n("li", {
|
|
234
|
+
className: "rck-empty",
|
|
235
|
+
children: [/* @__PURE__ */ e("span", {
|
|
236
|
+
className: "rck-empty-icon",
|
|
237
|
+
children: "๐"
|
|
238
|
+
}), /* @__PURE__ */ e("span", { children: "No countries found" })]
|
|
239
|
+
}) : c.filteredItems.map((s) => {
|
|
240
|
+
const d = c.isSelected(s);
|
|
241
|
+
return /* @__PURE__ */ n("li", {
|
|
242
|
+
role: "option",
|
|
243
|
+
"aria-selected": d,
|
|
244
|
+
className: `rck-item${d ? " rck-item-selected" : ""}`,
|
|
245
|
+
onClick: () => c.toggleItem(s),
|
|
246
|
+
tabIndex: 0,
|
|
247
|
+
onKeyDown: (v) => v.key === "Enter" && c.toggleItem(s),
|
|
248
|
+
children: [
|
|
249
|
+
/* @__PURE__ */ e("div", {
|
|
250
|
+
className: d ? "rck-item-check-multi" : "rck-item-check-empty",
|
|
251
|
+
children: d && /* @__PURE__ */ e(j, {})
|
|
252
|
+
}),
|
|
253
|
+
o && /* @__PURE__ */ e("span", {
|
|
254
|
+
className: "rck-item-flag",
|
|
255
|
+
children: /* @__PURE__ */ e(b, {
|
|
256
|
+
iso2: s.iso2,
|
|
257
|
+
flag: s.flag,
|
|
258
|
+
flagUrl: s.flag_url
|
|
259
|
+
})
|
|
260
|
+
}),
|
|
261
|
+
/* @__PURE__ */ n("div", {
|
|
262
|
+
className: "rck-item-main",
|
|
263
|
+
children: [/* @__PURE__ */ e("span", {
|
|
264
|
+
className: "rck-item-name",
|
|
265
|
+
children: s.name
|
|
266
|
+
}), /* @__PURE__ */ n("span", {
|
|
267
|
+
className: "rck-item-sub",
|
|
268
|
+
children: [
|
|
269
|
+
s.iso3,
|
|
270
|
+
" ยท +",
|
|
271
|
+
s.phone_code
|
|
272
|
+
]
|
|
273
|
+
})]
|
|
274
|
+
})
|
|
275
|
+
]
|
|
276
|
+
}, s.iso2);
|
|
277
|
+
})
|
|
278
|
+
})]
|
|
279
|
+
})
|
|
280
|
+
]
|
|
281
|
+
});
|
|
186
282
|
}
|
|
187
|
-
|
|
188
|
-
"
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
);
|
|
200
|
-
function v({
|
|
201
|
-
isOpen: n,
|
|
202
|
-
onClose: o,
|
|
203
|
-
onToggle: k,
|
|
204
|
-
label: h,
|
|
205
|
-
disabled: a,
|
|
206
|
-
className: d,
|
|
207
|
-
triggerContent: u,
|
|
208
|
-
children: g,
|
|
209
|
-
id: r
|
|
210
|
-
}) {
|
|
211
|
-
const i = x(null);
|
|
283
|
+
var M = () => /* @__PURE__ */ e("svg", {
|
|
284
|
+
className: "rck-chevron",
|
|
285
|
+
viewBox: "0 0 20 20",
|
|
286
|
+
fill: "none",
|
|
287
|
+
stroke: "currentColor",
|
|
288
|
+
strokeWidth: "2",
|
|
289
|
+
strokeLinecap: "round",
|
|
290
|
+
strokeLinejoin: "round",
|
|
291
|
+
children: /* @__PURE__ */ e("polyline", { points: "5 8 10 13 15 8" })
|
|
292
|
+
});
|
|
293
|
+
function x({ isOpen: i, onClose: a, onToggle: p, label: m, disabled: o, className: h, triggerContent: u, children: g, id: r }) {
|
|
294
|
+
const c = C(null);
|
|
212
295
|
return f(() => {
|
|
213
|
-
if (!
|
|
214
|
-
const
|
|
215
|
-
|
|
296
|
+
if (!i) return;
|
|
297
|
+
const l = (t) => {
|
|
298
|
+
c.current && !c.current.contains(t.target) && a();
|
|
216
299
|
};
|
|
217
|
-
return document.addEventListener("mousedown",
|
|
218
|
-
}, [
|
|
219
|
-
if (!
|
|
220
|
-
const
|
|
221
|
-
|
|
300
|
+
return document.addEventListener("mousedown", l), () => document.removeEventListener("mousedown", l);
|
|
301
|
+
}, [i, a]), f(() => {
|
|
302
|
+
if (!i) return;
|
|
303
|
+
const l = (t) => {
|
|
304
|
+
t.key === "Escape" && a();
|
|
222
305
|
};
|
|
223
|
-
return document.addEventListener("keydown",
|
|
224
|
-
}, [
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
{
|
|
306
|
+
return document.addEventListener("keydown", l), () => document.removeEventListener("keydown", l);
|
|
307
|
+
}, [i, a]), /* @__PURE__ */ n("div", {
|
|
308
|
+
ref: c,
|
|
309
|
+
className: `rck-picker${h ? ` ${h}` : ""}`,
|
|
310
|
+
children: [
|
|
311
|
+
m && /* @__PURE__ */ e("span", {
|
|
312
|
+
className: "rck-label",
|
|
313
|
+
id: r ? `${r}-label` : void 0,
|
|
314
|
+
children: m
|
|
315
|
+
}),
|
|
316
|
+
/* @__PURE__ */ n("button", {
|
|
229
317
|
type: "button",
|
|
230
|
-
className: `rck-trigger${
|
|
231
|
-
disabled:
|
|
318
|
+
className: `rck-trigger${i ? " rck-open" : ""}`,
|
|
319
|
+
disabled: o,
|
|
232
320
|
"aria-haspopup": "listbox",
|
|
233
|
-
"aria-expanded":
|
|
234
|
-
"aria-labelledby": r &&
|
|
321
|
+
"aria-expanded": i,
|
|
322
|
+
"aria-labelledby": r && m ? `${r}-label` : void 0,
|
|
235
323
|
id: r,
|
|
236
|
-
onClick:
|
|
237
|
-
children: [
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
324
|
+
onClick: p,
|
|
325
|
+
children: [u, /* @__PURE__ */ e(M, {})]
|
|
326
|
+
}),
|
|
327
|
+
i && /* @__PURE__ */ e("div", {
|
|
328
|
+
className: "rck-dropdown",
|
|
329
|
+
role: "listbox",
|
|
330
|
+
children: g
|
|
331
|
+
})
|
|
332
|
+
]
|
|
333
|
+
});
|
|
245
334
|
}
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
335
|
+
var T = () => /* @__PURE__ */ e("svg", {
|
|
336
|
+
className: "rck-item-check",
|
|
337
|
+
viewBox: "0 0 20 20",
|
|
338
|
+
fill: "none",
|
|
339
|
+
stroke: "currentColor",
|
|
340
|
+
strokeWidth: "2.5",
|
|
341
|
+
strokeLinecap: "round",
|
|
342
|
+
strokeLinejoin: "round",
|
|
343
|
+
children: /* @__PURE__ */ e("polyline", { points: "4 10 8 14 16 6" })
|
|
344
|
+
});
|
|
345
|
+
function J({ value: i, onChange: a, placeholder: p = "Select a country", searchable: m = !0, showFlag: o = !0, showPhoneCode: h = !1, disabled: u = !1, className: g, label: r }) {
|
|
346
|
+
const c = O(i, a), l = /* @__PURE__ */ e("div", {
|
|
347
|
+
className: "rck-trigger-content",
|
|
348
|
+
children: i ? /* @__PURE__ */ n(y, { children: [
|
|
349
|
+
o && /* @__PURE__ */ e("span", {
|
|
350
|
+
className: "rck-flag",
|
|
351
|
+
children: /* @__PURE__ */ e(b, {
|
|
352
|
+
iso2: i.iso2,
|
|
353
|
+
flag: i.flag,
|
|
354
|
+
flagUrl: i.flag_url
|
|
355
|
+
})
|
|
356
|
+
}),
|
|
357
|
+
/* @__PURE__ */ e("span", {
|
|
358
|
+
className: "rck-trigger-text",
|
|
359
|
+
children: i.name
|
|
360
|
+
}),
|
|
361
|
+
h && /* @__PURE__ */ n("span", {
|
|
362
|
+
className: "rck-badge",
|
|
363
|
+
children: ["+", i.phone_code]
|
|
364
|
+
})
|
|
365
|
+
] }) : /* @__PURE__ */ e("span", {
|
|
366
|
+
className: "rck-trigger-text rck-placeholder",
|
|
367
|
+
children: p
|
|
368
|
+
})
|
|
369
|
+
});
|
|
370
|
+
return /* @__PURE__ */ n(x, {
|
|
371
|
+
isOpen: c.isOpen,
|
|
372
|
+
onClose: c.close,
|
|
373
|
+
onToggle: c.toggle,
|
|
374
|
+
label: r,
|
|
375
|
+
disabled: u,
|
|
376
|
+
className: g,
|
|
377
|
+
triggerContent: l,
|
|
378
|
+
id: "rck-country-picker",
|
|
379
|
+
children: [m && /* @__PURE__ */ e(N, {
|
|
380
|
+
value: c.searchQuery,
|
|
381
|
+
onChange: c.setSearchQuery,
|
|
382
|
+
placeholder: "Search country..."
|
|
383
|
+
}), /* @__PURE__ */ e("ul", {
|
|
384
|
+
className: "rck-list",
|
|
385
|
+
role: "listbox",
|
|
386
|
+
"aria-label": "Countries",
|
|
387
|
+
children: c.filteredItems.length === 0 ? /* @__PURE__ */ n("li", {
|
|
388
|
+
className: "rck-empty",
|
|
389
|
+
children: [/* @__PURE__ */ e("span", {
|
|
390
|
+
className: "rck-empty-icon",
|
|
391
|
+
children: "๐"
|
|
392
|
+
}), /* @__PURE__ */ e("span", { children: "No countries found" })]
|
|
393
|
+
}) : c.filteredItems.map((t) => {
|
|
394
|
+
const k = i?.iso2 === t.iso2;
|
|
395
|
+
return /* @__PURE__ */ n("li", {
|
|
396
|
+
role: "option",
|
|
397
|
+
"aria-selected": k,
|
|
398
|
+
className: `rck-item${k ? " rck-item-selected" : ""}`,
|
|
399
|
+
onClick: () => c.selectItem(t),
|
|
400
|
+
tabIndex: 0,
|
|
401
|
+
onKeyDown: (s) => s.key === "Enter" && c.selectItem(t),
|
|
402
|
+
children: [
|
|
403
|
+
o && /* @__PURE__ */ e("span", {
|
|
404
|
+
className: "rck-item-flag",
|
|
405
|
+
children: /* @__PURE__ */ e(b, {
|
|
406
|
+
iso2: t.iso2,
|
|
407
|
+
flag: t.flag,
|
|
408
|
+
flagUrl: t.flag_url
|
|
409
|
+
})
|
|
410
|
+
}),
|
|
411
|
+
/* @__PURE__ */ n("div", {
|
|
412
|
+
className: "rck-item-main",
|
|
413
|
+
children: [/* @__PURE__ */ e("span", {
|
|
414
|
+
className: "rck-item-name",
|
|
415
|
+
children: t.name
|
|
416
|
+
}), /* @__PURE__ */ n("span", {
|
|
417
|
+
className: "rck-item-sub",
|
|
418
|
+
children: [
|
|
419
|
+
t.iso3,
|
|
420
|
+
" ยท ",
|
|
421
|
+
t.division_type
|
|
422
|
+
]
|
|
423
|
+
})]
|
|
424
|
+
}),
|
|
425
|
+
/* @__PURE__ */ n("div", {
|
|
426
|
+
className: "rck-item-right",
|
|
427
|
+
children: [h && /* @__PURE__ */ n("span", {
|
|
428
|
+
className: "rck-item-phone",
|
|
429
|
+
children: ["+", t.phone_code]
|
|
430
|
+
}), k && /* @__PURE__ */ e(T, {})]
|
|
431
|
+
})
|
|
432
|
+
]
|
|
433
|
+
}, t.iso2);
|
|
434
|
+
})
|
|
435
|
+
})]
|
|
436
|
+
});
|
|
325
437
|
}
|
|
326
|
-
|
|
438
|
+
var I = 3;
|
|
327
439
|
function K() {
|
|
328
|
-
return /* @__PURE__ */ e("svg", {
|
|
440
|
+
return /* @__PURE__ */ e("svg", {
|
|
441
|
+
viewBox: "0 0 20 20",
|
|
442
|
+
fill: "none",
|
|
443
|
+
stroke: "currentColor",
|
|
444
|
+
strokeWidth: "2.5",
|
|
445
|
+
strokeLinecap: "round",
|
|
446
|
+
strokeLinejoin: "round",
|
|
447
|
+
children: /* @__PURE__ */ e("polyline", { points: "4 10 8 14 16 6" })
|
|
448
|
+
});
|
|
329
449
|
}
|
|
330
|
-
function Y({
|
|
331
|
-
|
|
332
|
-
onChange: o,
|
|
333
|
-
placeholder: k = "Select currencies...",
|
|
334
|
-
maxItems: h,
|
|
335
|
-
showSymbol: a = !0,
|
|
336
|
-
searchable: d = !0,
|
|
337
|
-
disabled: u = !1,
|
|
338
|
-
className: g,
|
|
339
|
-
label: r
|
|
340
|
-
}) {
|
|
341
|
-
const i = L(
|
|
342
|
-
_(),
|
|
343
|
-
(t, m) => m ? O(m) : t,
|
|
344
|
-
(t) => t.code,
|
|
345
|
-
n,
|
|
346
|
-
o,
|
|
347
|
-
h
|
|
348
|
-
), s = x(null);
|
|
450
|
+
function Y({ value: i, onChange: a, placeholder: p = "Select currencies...", maxItems: m, showSymbol: o = !0, searchable: h = !0, disabled: u = !1, className: g, label: r }) {
|
|
451
|
+
const c = L($(), (s, d) => d ? _(d) : s, (s) => s.code, i, a, m), l = C(null);
|
|
349
452
|
f(() => {
|
|
350
|
-
if (!
|
|
351
|
-
const
|
|
352
|
-
|
|
453
|
+
if (!c.isOpen) return;
|
|
454
|
+
const s = (d) => {
|
|
455
|
+
l.current && !l.current.contains(d.target) && c.close();
|
|
353
456
|
};
|
|
354
|
-
return document.addEventListener("mousedown",
|
|
355
|
-
}, [
|
|
356
|
-
if (!
|
|
357
|
-
const
|
|
358
|
-
|
|
457
|
+
return document.addEventListener("mousedown", s), () => document.removeEventListener("mousedown", s);
|
|
458
|
+
}, [c.isOpen, c.close]), f(() => {
|
|
459
|
+
if (!c.isOpen) return;
|
|
460
|
+
const s = (d) => {
|
|
461
|
+
d.key === "Escape" && c.close();
|
|
359
462
|
};
|
|
360
|
-
return document.addEventListener("keydown",
|
|
361
|
-
}, [
|
|
362
|
-
const
|
|
363
|
-
return /* @__PURE__ */
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
{
|
|
463
|
+
return document.addEventListener("keydown", s), () => document.removeEventListener("keydown", s);
|
|
464
|
+
}, [c.isOpen, c.close]);
|
|
465
|
+
const t = i.slice(0, I), k = i.length - I;
|
|
466
|
+
return /* @__PURE__ */ n("div", {
|
|
467
|
+
ref: l,
|
|
468
|
+
className: `rck-picker${g ? ` ${g}` : ""}`,
|
|
469
|
+
children: [
|
|
470
|
+
r && /* @__PURE__ */ e("span", {
|
|
471
|
+
className: "rck-label",
|
|
472
|
+
children: r
|
|
473
|
+
}),
|
|
474
|
+
/* @__PURE__ */ n("button", {
|
|
368
475
|
type: "button",
|
|
369
|
-
className: `rck-multiselect-trigger${
|
|
476
|
+
className: `rck-multiselect-trigger${c.isOpen ? " rck-open" : ""}`,
|
|
370
477
|
disabled: u,
|
|
371
|
-
onClick:
|
|
478
|
+
onClick: c.toggle,
|
|
372
479
|
"aria-haspopup": "listbox",
|
|
373
|
-
"aria-expanded":
|
|
480
|
+
"aria-expanded": c.isOpen,
|
|
374
481
|
children: [
|
|
375
|
-
/* @__PURE__ */ e("div", {
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
"
|
|
381
|
-
|
|
482
|
+
/* @__PURE__ */ e("div", {
|
|
483
|
+
className: "rck-chips-area",
|
|
484
|
+
children: i.length === 0 ? /* @__PURE__ */ e("span", {
|
|
485
|
+
style: {
|
|
486
|
+
color: "var(--rck-text-placeholder)",
|
|
487
|
+
fontSize: "0.9375rem"
|
|
488
|
+
},
|
|
489
|
+
children: p
|
|
490
|
+
}) : /* @__PURE__ */ n(y, { children: [t.map((s) => /* @__PURE__ */ n("span", {
|
|
491
|
+
className: "rck-chip",
|
|
492
|
+
children: [
|
|
493
|
+
o && /* @__PURE__ */ e("span", { children: s.symbol }),
|
|
494
|
+
/* @__PURE__ */ e("span", {
|
|
495
|
+
className: "rck-chip-label",
|
|
496
|
+
children: s.code
|
|
497
|
+
}),
|
|
498
|
+
/* @__PURE__ */ e("button", {
|
|
382
499
|
type: "button",
|
|
383
500
|
className: "rck-chip-remove",
|
|
384
|
-
onClick: (
|
|
385
|
-
|
|
501
|
+
onClick: (d) => {
|
|
502
|
+
d.stopPropagation(), a(i.filter((v) => v.code !== s.code));
|
|
386
503
|
},
|
|
387
|
-
"aria-label": `Remove ${
|
|
388
|
-
children: /* @__PURE__ */
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
/* @__PURE__ */ e("line", { x1: "15", y1: "5", x2: "5", y2: "15" })
|
|
413
|
-
] })
|
|
414
|
-
}
|
|
415
|
-
),
|
|
416
|
-
/* @__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" }) })
|
|
417
|
-
]
|
|
418
|
-
}
|
|
419
|
-
),
|
|
420
|
-
i.isOpen && /* @__PURE__ */ c("div", { className: "rck-dropdown", role: "listbox", "aria-multiselectable": "true", children: [
|
|
421
|
-
d && /* @__PURE__ */ e(N, { value: i.searchQuery, onChange: i.setSearchQuery, placeholder: "Search currencies..." }),
|
|
422
|
-
/* @__PURE__ */ e("ul", { className: "rck-list", children: i.filteredItems.length === 0 ? /* @__PURE__ */ c("li", { className: "rck-empty", children: [
|
|
423
|
-
/* @__PURE__ */ e("span", { className: "rck-empty-icon", children: "๐ฐ" }),
|
|
424
|
-
/* @__PURE__ */ e("span", { children: "No currencies found" })
|
|
425
|
-
] }) : i.filteredItems.map((t) => {
|
|
426
|
-
const m = i.isSelected(t);
|
|
427
|
-
return /* @__PURE__ */ c(
|
|
428
|
-
"li",
|
|
429
|
-
{
|
|
430
|
-
role: "option",
|
|
431
|
-
"aria-selected": m,
|
|
432
|
-
className: `rck-item${m ? " rck-item-selected" : ""}`,
|
|
433
|
-
onClick: () => i.toggleItem(t),
|
|
434
|
-
tabIndex: 0,
|
|
435
|
-
onKeyDown: (y) => y.key === "Enter" && i.toggleItem(t),
|
|
436
|
-
children: [
|
|
437
|
-
/* @__PURE__ */ e("div", { className: m ? "rck-item-check-multi" : "rck-item-check-empty", children: m && /* @__PURE__ */ e(K, {}) }),
|
|
438
|
-
a && /* @__PURE__ */ e("span", { className: "rck-item-symbol", children: t.symbol }),
|
|
439
|
-
/* @__PURE__ */ c("div", { className: "rck-item-main", children: [
|
|
440
|
-
/* @__PURE__ */ e("span", { className: "rck-item-name", children: t.name }),
|
|
441
|
-
/* @__PURE__ */ e("span", { className: "rck-item-sub", children: t.code })
|
|
442
|
-
] })
|
|
443
|
-
]
|
|
444
|
-
},
|
|
445
|
-
t.code
|
|
446
|
-
);
|
|
447
|
-
}) })
|
|
448
|
-
] })
|
|
449
|
-
] });
|
|
450
|
-
}
|
|
451
|
-
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" }) });
|
|
452
|
-
function Z({
|
|
453
|
-
value: n,
|
|
454
|
-
onChange: o,
|
|
455
|
-
placeholder: k = "Select a currency",
|
|
456
|
-
searchable: h = !0,
|
|
457
|
-
showSymbol: a = !0,
|
|
458
|
-
disabled: d = !1,
|
|
459
|
-
className: u,
|
|
460
|
-
label: g
|
|
461
|
-
}) {
|
|
462
|
-
const r = B(n, o), i = /* @__PURE__ */ e("div", { className: "rck-trigger-content", children: n ? /* @__PURE__ */ c(b, { children: [
|
|
463
|
-
a && /* @__PURE__ */ e("span", { className: "rck-item-symbol", children: n.symbol }),
|
|
464
|
-
/* @__PURE__ */ c("span", { className: "rck-trigger-text", children: [
|
|
465
|
-
n.code,
|
|
466
|
-
" โ ",
|
|
467
|
-
n.name
|
|
468
|
-
] })
|
|
469
|
-
] }) : /* @__PURE__ */ e("span", { className: "rck-trigger-text rck-placeholder", children: k }) });
|
|
470
|
-
return /* @__PURE__ */ c(
|
|
471
|
-
v,
|
|
472
|
-
{
|
|
473
|
-
isOpen: r.isOpen,
|
|
474
|
-
onClose: r.close,
|
|
475
|
-
onToggle: r.toggle,
|
|
476
|
-
label: g,
|
|
477
|
-
disabled: d,
|
|
478
|
-
className: u,
|
|
479
|
-
triggerContent: i,
|
|
480
|
-
id: "rck-currency-picker",
|
|
481
|
-
children: [
|
|
482
|
-
h && /* @__PURE__ */ e(
|
|
483
|
-
N,
|
|
484
|
-
{
|
|
485
|
-
value: r.searchQuery,
|
|
486
|
-
onChange: r.setSearchQuery,
|
|
487
|
-
placeholder: "Search currency..."
|
|
488
|
-
}
|
|
489
|
-
),
|
|
490
|
-
/* @__PURE__ */ e("ul", { className: "rck-list", role: "listbox", "aria-label": "Currencies", children: r.filteredItems.length === 0 ? /* @__PURE__ */ c("li", { className: "rck-empty", children: [
|
|
491
|
-
/* @__PURE__ */ e("span", { className: "rck-empty-icon", children: "๐ฐ" }),
|
|
492
|
-
/* @__PURE__ */ e("span", { children: "No currencies found" })
|
|
493
|
-
] }) : r.filteredItems.map((s) => {
|
|
494
|
-
const l = (n == null ? void 0 : n.code) === s.code;
|
|
495
|
-
return /* @__PURE__ */ c(
|
|
496
|
-
"li",
|
|
497
|
-
{
|
|
498
|
-
role: "option",
|
|
499
|
-
"aria-selected": l,
|
|
500
|
-
className: `rck-item${l ? " rck-item-selected" : ""}`,
|
|
501
|
-
onClick: () => r.selectItem(s),
|
|
502
|
-
tabIndex: 0,
|
|
503
|
-
onKeyDown: (p) => p.key === "Enter" && r.selectItem(s),
|
|
504
|
+
"aria-label": `Remove ${s.code}`,
|
|
505
|
+
children: /* @__PURE__ */ n("svg", {
|
|
506
|
+
width: "10",
|
|
507
|
+
height: "10",
|
|
508
|
+
viewBox: "0 0 20 20",
|
|
509
|
+
fill: "none",
|
|
510
|
+
stroke: "currentColor",
|
|
511
|
+
strokeWidth: "2.5",
|
|
512
|
+
strokeLinecap: "round",
|
|
513
|
+
children: [/* @__PURE__ */ e("line", {
|
|
514
|
+
x1: "5",
|
|
515
|
+
y1: "5",
|
|
516
|
+
x2: "15",
|
|
517
|
+
y2: "15"
|
|
518
|
+
}), /* @__PURE__ */ e("line", {
|
|
519
|
+
x1: "15",
|
|
520
|
+
y1: "5",
|
|
521
|
+
x2: "5",
|
|
522
|
+
y2: "15"
|
|
523
|
+
})]
|
|
524
|
+
})
|
|
525
|
+
})
|
|
526
|
+
]
|
|
527
|
+
}, s.code)), k > 0 && /* @__PURE__ */ n("span", {
|
|
528
|
+
className: "rck-chip-overflow",
|
|
504
529
|
children: [
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
/* @__PURE__ */ e("span", { className: "rck-item-sub", children: s.code })
|
|
509
|
-
] }),
|
|
510
|
-
l && /* @__PURE__ */ e(R, {})
|
|
530
|
+
"+",
|
|
531
|
+
k,
|
|
532
|
+
" more"
|
|
511
533
|
]
|
|
534
|
+
})] })
|
|
535
|
+
}),
|
|
536
|
+
i.length > 0 && /* @__PURE__ */ e("button", {
|
|
537
|
+
type: "button",
|
|
538
|
+
className: "rck-multiselect-clear",
|
|
539
|
+
onClick: (s) => {
|
|
540
|
+
s.stopPropagation(), c.clearAll(), a([]);
|
|
512
541
|
},
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
),
|
|
555
|
-
|
|
556
|
-
/* @__PURE__ */
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
"
|
|
562
|
-
|
|
542
|
+
"aria-label": "Clear all",
|
|
543
|
+
children: /* @__PURE__ */ n("svg", {
|
|
544
|
+
width: "14",
|
|
545
|
+
height: "14",
|
|
546
|
+
viewBox: "0 0 20 20",
|
|
547
|
+
fill: "none",
|
|
548
|
+
stroke: "currentColor",
|
|
549
|
+
strokeWidth: "2",
|
|
550
|
+
strokeLinecap: "round",
|
|
551
|
+
children: [/* @__PURE__ */ e("line", {
|
|
552
|
+
x1: "5",
|
|
553
|
+
y1: "5",
|
|
554
|
+
x2: "15",
|
|
555
|
+
y2: "15"
|
|
556
|
+
}), /* @__PURE__ */ e("line", {
|
|
557
|
+
x1: "15",
|
|
558
|
+
y1: "5",
|
|
559
|
+
x2: "5",
|
|
560
|
+
y2: "15"
|
|
561
|
+
})]
|
|
562
|
+
})
|
|
563
|
+
}),
|
|
564
|
+
/* @__PURE__ */ e("svg", {
|
|
565
|
+
className: "rck-chevron",
|
|
566
|
+
viewBox: "0 0 20 20",
|
|
567
|
+
fill: "none",
|
|
568
|
+
stroke: "currentColor",
|
|
569
|
+
strokeWidth: "2",
|
|
570
|
+
strokeLinecap: "round",
|
|
571
|
+
children: /* @__PURE__ */ e("polyline", { points: "5 8 10 13 15 8" })
|
|
572
|
+
})
|
|
573
|
+
]
|
|
574
|
+
}),
|
|
575
|
+
c.isOpen && /* @__PURE__ */ n("div", {
|
|
576
|
+
className: "rck-dropdown",
|
|
577
|
+
role: "listbox",
|
|
578
|
+
"aria-multiselectable": "true",
|
|
579
|
+
children: [h && /* @__PURE__ */ e(N, {
|
|
580
|
+
value: c.searchQuery,
|
|
581
|
+
onChange: c.setSearchQuery,
|
|
582
|
+
placeholder: "Search currencies..."
|
|
583
|
+
}), /* @__PURE__ */ e("ul", {
|
|
584
|
+
className: "rck-list",
|
|
585
|
+
children: c.filteredItems.length === 0 ? /* @__PURE__ */ n("li", {
|
|
586
|
+
className: "rck-empty",
|
|
587
|
+
children: [/* @__PURE__ */ e("span", {
|
|
588
|
+
className: "rck-empty-icon",
|
|
589
|
+
children: "๐ฐ"
|
|
590
|
+
}), /* @__PURE__ */ e("span", { children: "No currencies found" })]
|
|
591
|
+
}) : c.filteredItems.map((s) => {
|
|
592
|
+
const d = c.isSelected(s);
|
|
593
|
+
return /* @__PURE__ */ n("li", {
|
|
563
594
|
role: "option",
|
|
564
|
-
"aria-selected":
|
|
565
|
-
className: `rck-item${
|
|
566
|
-
onClick: () =>
|
|
595
|
+
"aria-selected": d,
|
|
596
|
+
className: `rck-item${d ? " rck-item-selected" : ""}`,
|
|
597
|
+
onClick: () => c.toggleItem(s),
|
|
567
598
|
tabIndex: 0,
|
|
568
|
-
onKeyDown: (
|
|
599
|
+
onKeyDown: (v) => v.key === "Enter" && c.toggleItem(s),
|
|
569
600
|
children: [
|
|
570
|
-
/* @__PURE__ */
|
|
571
|
-
|
|
572
|
-
/* @__PURE__ */ e(
|
|
573
|
-
|
|
574
|
-
/* @__PURE__ */
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
601
|
+
/* @__PURE__ */ e("div", {
|
|
602
|
+
className: d ? "rck-item-check-multi" : "rck-item-check-empty",
|
|
603
|
+
children: d && /* @__PURE__ */ e(K, {})
|
|
604
|
+
}),
|
|
605
|
+
o && /* @__PURE__ */ e("span", {
|
|
606
|
+
className: "rck-item-symbol",
|
|
607
|
+
children: s.symbol
|
|
608
|
+
}),
|
|
609
|
+
/* @__PURE__ */ n("div", {
|
|
610
|
+
className: "rck-item-main",
|
|
611
|
+
children: [/* @__PURE__ */ e("span", {
|
|
612
|
+
className: "rck-item-name",
|
|
613
|
+
children: s.name
|
|
614
|
+
}), /* @__PURE__ */ e("span", {
|
|
615
|
+
className: "rck-item-sub",
|
|
616
|
+
children: s.code
|
|
617
|
+
})]
|
|
618
|
+
})
|
|
578
619
|
]
|
|
579
|
-
},
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
);
|
|
620
|
+
}, s.code);
|
|
621
|
+
})
|
|
622
|
+
})]
|
|
623
|
+
})
|
|
624
|
+
]
|
|
625
|
+
});
|
|
586
626
|
}
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
}) {
|
|
598
|
-
const r =
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
isOpen: r.isOpen,
|
|
606
|
-
onClose: r.close,
|
|
607
|
-
onToggle: r.toggle,
|
|
608
|
-
label: g,
|
|
609
|
-
disabled: d,
|
|
610
|
-
className: u,
|
|
611
|
-
triggerContent: i,
|
|
612
|
-
id: "rck-language-picker",
|
|
627
|
+
var R = () => /* @__PURE__ */ e("svg", {
|
|
628
|
+
className: "rck-item-check",
|
|
629
|
+
viewBox: "0 0 20 20",
|
|
630
|
+
fill: "none",
|
|
631
|
+
stroke: "currentColor",
|
|
632
|
+
strokeWidth: "2.5",
|
|
633
|
+
strokeLinecap: "round",
|
|
634
|
+
strokeLinejoin: "round",
|
|
635
|
+
children: /* @__PURE__ */ e("polyline", { points: "4 10 8 14 16 6" })
|
|
636
|
+
});
|
|
637
|
+
function Z({ value: i, onChange: a, placeholder: p = "Select a currency", searchable: m = !0, showSymbol: o = !0, disabled: h = !1, className: u, label: g }) {
|
|
638
|
+
const r = B(i, a), c = /* @__PURE__ */ e("div", {
|
|
639
|
+
className: "rck-trigger-content",
|
|
640
|
+
children: i ? /* @__PURE__ */ n(y, { children: [o && /* @__PURE__ */ e("span", {
|
|
641
|
+
className: "rck-item-symbol",
|
|
642
|
+
children: i.symbol
|
|
643
|
+
}), /* @__PURE__ */ n("span", {
|
|
644
|
+
className: "rck-trigger-text",
|
|
613
645
|
children: [
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
value: r.searchQuery,
|
|
618
|
-
onChange: r.setSearchQuery,
|
|
619
|
-
placeholder: "Search language..."
|
|
620
|
-
}
|
|
621
|
-
),
|
|
622
|
-
/* @__PURE__ */ e("ul", { className: "rck-list", role: "listbox", "aria-label": "Languages", children: r.filteredItems.length === 0 ? /* @__PURE__ */ c("li", { className: "rck-empty", children: [
|
|
623
|
-
/* @__PURE__ */ e("span", { className: "rck-empty-icon", children: "๐" }),
|
|
624
|
-
/* @__PURE__ */ e("span", { children: "No languages found" })
|
|
625
|
-
] }) : r.filteredItems.map((s) => {
|
|
626
|
-
const l = (n == null ? void 0 : n.code) === s.code;
|
|
627
|
-
return /* @__PURE__ */ c(
|
|
628
|
-
"li",
|
|
629
|
-
{
|
|
630
|
-
role: "option",
|
|
631
|
-
"aria-selected": l,
|
|
632
|
-
className: `rck-item${l ? " rck-item-selected" : ""}`,
|
|
633
|
-
onClick: () => r.selectItem(s),
|
|
634
|
-
tabIndex: 0,
|
|
635
|
-
onKeyDown: (p) => p.key === "Enter" && r.selectItem(s),
|
|
636
|
-
children: [
|
|
637
|
-
/* @__PURE__ */ c("div", { className: "rck-item-main", children: [
|
|
638
|
-
/* @__PURE__ */ e("span", { className: "rck-item-name", children: s.english_name }),
|
|
639
|
-
a && s.native_name !== s.english_name && /* @__PURE__ */ e("span", { className: "rck-item-sub", children: s.native_name })
|
|
640
|
-
] }),
|
|
641
|
-
/* @__PURE__ */ c("div", { className: "rck-item-right", children: [
|
|
642
|
-
/* @__PURE__ */ e("span", { className: "rck-badge", style: { fontSize: "0.68rem" }, children: s.code }),
|
|
643
|
-
l && /* @__PURE__ */ e(z, {})
|
|
644
|
-
] })
|
|
645
|
-
]
|
|
646
|
-
},
|
|
647
|
-
s.code
|
|
648
|
-
);
|
|
649
|
-
}) })
|
|
646
|
+
i.code,
|
|
647
|
+
" โ ",
|
|
648
|
+
i.name
|
|
650
649
|
]
|
|
651
|
-
}
|
|
652
|
-
|
|
650
|
+
})] }) : /* @__PURE__ */ e("span", {
|
|
651
|
+
className: "rck-trigger-text rck-placeholder",
|
|
652
|
+
children: p
|
|
653
|
+
})
|
|
654
|
+
});
|
|
655
|
+
return /* @__PURE__ */ n(x, {
|
|
656
|
+
isOpen: r.isOpen,
|
|
657
|
+
onClose: r.close,
|
|
658
|
+
onToggle: r.toggle,
|
|
659
|
+
label: g,
|
|
660
|
+
disabled: h,
|
|
661
|
+
className: u,
|
|
662
|
+
triggerContent: c,
|
|
663
|
+
id: "rck-currency-picker",
|
|
664
|
+
children: [m && /* @__PURE__ */ e(N, {
|
|
665
|
+
value: r.searchQuery,
|
|
666
|
+
onChange: r.setSearchQuery,
|
|
667
|
+
placeholder: "Search currency..."
|
|
668
|
+
}), /* @__PURE__ */ e("ul", {
|
|
669
|
+
className: "rck-list",
|
|
670
|
+
role: "listbox",
|
|
671
|
+
"aria-label": "Currencies",
|
|
672
|
+
children: r.filteredItems.length === 0 ? /* @__PURE__ */ n("li", {
|
|
673
|
+
className: "rck-empty",
|
|
674
|
+
children: [/* @__PURE__ */ e("span", {
|
|
675
|
+
className: "rck-empty-icon",
|
|
676
|
+
children: "๐ฐ"
|
|
677
|
+
}), /* @__PURE__ */ e("span", { children: "No currencies found" })]
|
|
678
|
+
}) : r.filteredItems.map((l) => {
|
|
679
|
+
const t = i?.code === l.code;
|
|
680
|
+
return /* @__PURE__ */ n("li", {
|
|
681
|
+
role: "option",
|
|
682
|
+
"aria-selected": t,
|
|
683
|
+
className: `rck-item${t ? " rck-item-selected" : ""}`,
|
|
684
|
+
onClick: () => r.selectItem(l),
|
|
685
|
+
tabIndex: 0,
|
|
686
|
+
onKeyDown: (k) => k.key === "Enter" && r.selectItem(l),
|
|
687
|
+
children: [
|
|
688
|
+
o && /* @__PURE__ */ e("span", {
|
|
689
|
+
className: "rck-item-symbol",
|
|
690
|
+
children: l.symbol
|
|
691
|
+
}),
|
|
692
|
+
/* @__PURE__ */ n("div", {
|
|
693
|
+
className: "rck-item-main",
|
|
694
|
+
children: [/* @__PURE__ */ e("span", {
|
|
695
|
+
className: "rck-item-name",
|
|
696
|
+
children: l.name
|
|
697
|
+
}), /* @__PURE__ */ e("span", {
|
|
698
|
+
className: "rck-item-sub",
|
|
699
|
+
children: l.code
|
|
700
|
+
})]
|
|
701
|
+
}),
|
|
702
|
+
t && /* @__PURE__ */ e(R, {})
|
|
703
|
+
]
|
|
704
|
+
}, l.code);
|
|
705
|
+
})
|
|
706
|
+
})]
|
|
707
|
+
});
|
|
653
708
|
}
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
})
|
|
664
|
-
|
|
709
|
+
var U = () => /* @__PURE__ */ e("svg", {
|
|
710
|
+
className: "rck-item-check",
|
|
711
|
+
viewBox: "0 0 20 20",
|
|
712
|
+
fill: "none",
|
|
713
|
+
stroke: "currentColor",
|
|
714
|
+
strokeWidth: "2.5",
|
|
715
|
+
strokeLinecap: "round",
|
|
716
|
+
strokeLinejoin: "round",
|
|
717
|
+
children: /* @__PURE__ */ e("polyline", { points: "4 10 8 14 16 6" })
|
|
718
|
+
});
|
|
719
|
+
function F({ countryIso2: i, value: a, onChange: p, placeholder: m = "Select a division", searchable: o = !0, disabled: h = !1, className: u, label: g }) {
|
|
720
|
+
const r = P(i, a, p), c = /* @__PURE__ */ e("div", {
|
|
721
|
+
className: "rck-trigger-content",
|
|
722
|
+
children: a ? /* @__PURE__ */ n(y, { children: [/* @__PURE__ */ e("span", {
|
|
723
|
+
className: "rck-trigger-text",
|
|
724
|
+
children: a.name
|
|
725
|
+
}), /* @__PURE__ */ e("span", {
|
|
726
|
+
className: "rck-badge",
|
|
727
|
+
children: a.iso2
|
|
728
|
+
})] }) : /* @__PURE__ */ e("span", {
|
|
729
|
+
className: "rck-trigger-text rck-placeholder",
|
|
730
|
+
children: m
|
|
731
|
+
})
|
|
732
|
+
}), l = h || !i;
|
|
733
|
+
return /* @__PURE__ */ n(x, {
|
|
734
|
+
isOpen: r.isOpen,
|
|
735
|
+
onClose: r.close,
|
|
736
|
+
onToggle: r.toggle,
|
|
737
|
+
label: g,
|
|
738
|
+
disabled: l,
|
|
739
|
+
className: u,
|
|
740
|
+
triggerContent: c,
|
|
741
|
+
id: "rck-division-picker",
|
|
742
|
+
children: [o && /* @__PURE__ */ e(N, {
|
|
743
|
+
value: r.searchQuery,
|
|
744
|
+
onChange: r.setSearchQuery,
|
|
745
|
+
placeholder: "Search division..."
|
|
746
|
+
}), /* @__PURE__ */ e("ul", {
|
|
747
|
+
className: "rck-list",
|
|
748
|
+
role: "listbox",
|
|
749
|
+
"aria-label": "Divisions",
|
|
750
|
+
children: r.filteredItems.length === 0 ? /* @__PURE__ */ n("li", {
|
|
751
|
+
className: "rck-empty",
|
|
752
|
+
children: [/* @__PURE__ */ e("span", {
|
|
753
|
+
className: "rck-empty-icon",
|
|
754
|
+
children: "๐บ๏ธ"
|
|
755
|
+
}), /* @__PURE__ */ e("span", { children: "No divisions found" })]
|
|
756
|
+
}) : r.filteredItems.map((t) => {
|
|
757
|
+
const k = a?.iso2 === t.iso2 && a?.name === t.name;
|
|
758
|
+
return /* @__PURE__ */ n("li", {
|
|
759
|
+
role: "option",
|
|
760
|
+
"aria-selected": k,
|
|
761
|
+
className: `rck-item${k ? " rck-item-selected" : ""}`,
|
|
762
|
+
onClick: () => r.selectItem(t),
|
|
763
|
+
tabIndex: 0,
|
|
764
|
+
onKeyDown: (s) => s.key === "Enter" && r.selectItem(t),
|
|
765
|
+
children: [/* @__PURE__ */ n("div", {
|
|
766
|
+
className: "rck-item-main",
|
|
767
|
+
children: [/* @__PURE__ */ e("span", {
|
|
768
|
+
className: "rck-item-name",
|
|
769
|
+
children: t.name
|
|
770
|
+
}), /* @__PURE__ */ e("span", {
|
|
771
|
+
className: "rck-item-sub",
|
|
772
|
+
children: t.timezone
|
|
773
|
+
})]
|
|
774
|
+
}), /* @__PURE__ */ n("div", {
|
|
775
|
+
className: "rck-item-right",
|
|
776
|
+
children: [/* @__PURE__ */ e("span", {
|
|
777
|
+
className: "rck-badge",
|
|
778
|
+
children: t.iso2
|
|
779
|
+
}), k && /* @__PURE__ */ e(U, {})]
|
|
780
|
+
})]
|
|
781
|
+
}, `${t.iso2}-${t.name}`);
|
|
782
|
+
})
|
|
783
|
+
})]
|
|
784
|
+
});
|
|
785
|
+
}
|
|
786
|
+
var z = () => /* @__PURE__ */ e("svg", {
|
|
787
|
+
className: "rck-item-check",
|
|
788
|
+
viewBox: "0 0 20 20",
|
|
789
|
+
fill: "none",
|
|
790
|
+
stroke: "currentColor",
|
|
791
|
+
strokeWidth: "2.5",
|
|
792
|
+
strokeLinecap: "round",
|
|
793
|
+
strokeLinejoin: "round",
|
|
794
|
+
children: /* @__PURE__ */ e("polyline", { points: "4 10 8 14 16 6" })
|
|
795
|
+
});
|
|
796
|
+
function q({ value: i, onChange: a, placeholder: p = "Select a language", searchable: m = !0, showNativeName: o = !0, disabled: h = !1, className: u, label: g }) {
|
|
797
|
+
const r = W(i, a), c = /* @__PURE__ */ e("div", {
|
|
798
|
+
className: "rck-trigger-content",
|
|
799
|
+
children: i ? /* @__PURE__ */ n(y, { children: [/* @__PURE__ */ e("span", {
|
|
800
|
+
className: "rck-trigger-text",
|
|
801
|
+
children: i.english_name
|
|
802
|
+
}), o && i.native_name !== i.english_name && /* @__PURE__ */ e("span", {
|
|
803
|
+
className: "rck-native-name",
|
|
804
|
+
children: i.native_name
|
|
805
|
+
})] }) : /* @__PURE__ */ e("span", {
|
|
806
|
+
className: "rck-trigger-text rck-placeholder",
|
|
807
|
+
children: p
|
|
808
|
+
})
|
|
809
|
+
});
|
|
810
|
+
return /* @__PURE__ */ n(x, {
|
|
811
|
+
isOpen: r.isOpen,
|
|
812
|
+
onClose: r.close,
|
|
813
|
+
onToggle: r.toggle,
|
|
814
|
+
label: g,
|
|
815
|
+
disabled: h,
|
|
816
|
+
className: u,
|
|
817
|
+
triggerContent: c,
|
|
818
|
+
id: "rck-language-picker",
|
|
819
|
+
children: [m && /* @__PURE__ */ e(N, {
|
|
820
|
+
value: r.searchQuery,
|
|
821
|
+
onChange: r.setSearchQuery,
|
|
822
|
+
placeholder: "Search language..."
|
|
823
|
+
}), /* @__PURE__ */ e("ul", {
|
|
824
|
+
className: "rck-list",
|
|
825
|
+
role: "listbox",
|
|
826
|
+
"aria-label": "Languages",
|
|
827
|
+
children: r.filteredItems.length === 0 ? /* @__PURE__ */ n("li", {
|
|
828
|
+
className: "rck-empty",
|
|
829
|
+
children: [/* @__PURE__ */ e("span", {
|
|
830
|
+
className: "rck-empty-icon",
|
|
831
|
+
children: "๐"
|
|
832
|
+
}), /* @__PURE__ */ e("span", { children: "No languages found" })]
|
|
833
|
+
}) : r.filteredItems.map((l) => {
|
|
834
|
+
const t = i?.code === l.code;
|
|
835
|
+
return /* @__PURE__ */ n("li", {
|
|
836
|
+
role: "option",
|
|
837
|
+
"aria-selected": t,
|
|
838
|
+
className: `rck-item${t ? " rck-item-selected" : ""}`,
|
|
839
|
+
onClick: () => r.selectItem(l),
|
|
840
|
+
tabIndex: 0,
|
|
841
|
+
onKeyDown: (k) => k.key === "Enter" && r.selectItem(l),
|
|
842
|
+
children: [/* @__PURE__ */ n("div", {
|
|
843
|
+
className: "rck-item-main",
|
|
844
|
+
children: [/* @__PURE__ */ e("span", {
|
|
845
|
+
className: "rck-item-name",
|
|
846
|
+
children: l.english_name
|
|
847
|
+
}), o && l.native_name !== l.english_name && /* @__PURE__ */ e("span", {
|
|
848
|
+
className: "rck-item-sub",
|
|
849
|
+
children: l.native_name
|
|
850
|
+
})]
|
|
851
|
+
}), /* @__PURE__ */ n("div", {
|
|
852
|
+
className: "rck-item-right",
|
|
853
|
+
children: [/* @__PURE__ */ e("span", {
|
|
854
|
+
className: "rck-badge",
|
|
855
|
+
style: { fontSize: "0.68rem" },
|
|
856
|
+
children: l.code
|
|
857
|
+
}), t && /* @__PURE__ */ e(z, {})]
|
|
858
|
+
})]
|
|
859
|
+
}, l.code);
|
|
860
|
+
})
|
|
861
|
+
})]
|
|
862
|
+
});
|
|
863
|
+
}
|
|
864
|
+
function ee({ value: i, onChange: a, defaultCountryIso2: p = "US", placeholder: m = "Phone number", showFlag: o = !0, disabled: h = !1, className: u, label: g }) {
|
|
865
|
+
const r = Q(i, a, p), c = C(null);
|
|
665
866
|
return f(() => {
|
|
666
867
|
if (!r.isOpen) return;
|
|
667
|
-
const
|
|
668
|
-
|
|
868
|
+
const l = (t) => {
|
|
869
|
+
c.current && !c.current.contains(t.target) && r.close();
|
|
669
870
|
};
|
|
670
|
-
return document.addEventListener("mousedown",
|
|
871
|
+
return document.addEventListener("mousedown", l), () => document.removeEventListener("mousedown", l);
|
|
671
872
|
}, [r.isOpen, r.close]), f(() => {
|
|
672
873
|
if (!r.isOpen) return;
|
|
673
|
-
const
|
|
674
|
-
|
|
874
|
+
const l = (t) => {
|
|
875
|
+
t.key === "Escape" && r.close();
|
|
675
876
|
};
|
|
676
|
-
return document.addEventListener("keydown",
|
|
677
|
-
}, [r.isOpen, r.close]), /* @__PURE__ */
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
877
|
+
return document.addEventListener("keydown", l), () => document.removeEventListener("keydown", l);
|
|
878
|
+
}, [r.isOpen, r.close]), /* @__PURE__ */ n("div", {
|
|
879
|
+
ref: c,
|
|
880
|
+
className: `rck-phone-wrapper${u ? ` ${u}` : ""}`,
|
|
881
|
+
children: [g && /* @__PURE__ */ e("span", {
|
|
882
|
+
className: "rck-label",
|
|
883
|
+
children: g
|
|
884
|
+
}), /* @__PURE__ */ n("div", {
|
|
885
|
+
className: `rck-phone-field${h ? " rck-phone-disabled" : ""}`,
|
|
886
|
+
children: [
|
|
887
|
+
/* @__PURE__ */ n("button", {
|
|
683
888
|
type: "button",
|
|
684
889
|
className: "rck-phone-country-btn",
|
|
685
890
|
onClick: r.toggle,
|
|
686
891
|
"aria-expanded": r.isOpen,
|
|
687
892
|
"aria-label": "Select country code",
|
|
688
|
-
disabled:
|
|
893
|
+
disabled: h,
|
|
689
894
|
children: [
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
895
|
+
o && r.country && /* @__PURE__ */ e("span", {
|
|
896
|
+
className: "rck-phone-flag",
|
|
897
|
+
children: /* @__PURE__ */ e(b, {
|
|
898
|
+
iso2: r.country.iso2,
|
|
899
|
+
flag: r.country.flag,
|
|
900
|
+
flagUrl: r.country.flag_url
|
|
901
|
+
})
|
|
902
|
+
}),
|
|
903
|
+
/* @__PURE__ */ e("span", {
|
|
904
|
+
className: "rck-phone-dial",
|
|
905
|
+
children: r.country ? `+${r.country.phone_code}` : "+?"
|
|
906
|
+
}),
|
|
907
|
+
/* @__PURE__ */ e("svg", {
|
|
908
|
+
className: "rck-phone-chevron",
|
|
909
|
+
viewBox: "0 0 20 20",
|
|
910
|
+
fill: "none",
|
|
911
|
+
stroke: "currentColor",
|
|
912
|
+
strokeWidth: "2",
|
|
913
|
+
strokeLinecap: "round",
|
|
914
|
+
children: /* @__PURE__ */ e("polyline", { points: "5 8 10 13 15 8" })
|
|
915
|
+
})
|
|
693
916
|
]
|
|
694
|
-
}
|
|
695
|
-
|
|
696
|
-
/* @__PURE__ */ e(
|
|
697
|
-
"input",
|
|
698
|
-
{
|
|
917
|
+
}),
|
|
918
|
+
/* @__PURE__ */ e("input", {
|
|
699
919
|
type: "tel",
|
|
700
920
|
className: "rck-phone-input",
|
|
701
921
|
value: r.number,
|
|
702
|
-
onChange: (
|
|
703
|
-
placeholder:
|
|
704
|
-
disabled:
|
|
922
|
+
onChange: (l) => r.setNumber(l.target.value),
|
|
923
|
+
placeholder: m,
|
|
924
|
+
disabled: h,
|
|
705
925
|
inputMode: "numeric",
|
|
706
926
|
autoComplete: "tel-national"
|
|
707
|
-
}
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
N,
|
|
712
|
-
{
|
|
927
|
+
}),
|
|
928
|
+
r.isOpen && /* @__PURE__ */ n("div", {
|
|
929
|
+
className: "rck-phone-dropdown",
|
|
930
|
+
children: [/* @__PURE__ */ e(N, {
|
|
713
931
|
value: r.searchQuery,
|
|
714
932
|
onChange: r.setSearchQuery,
|
|
715
933
|
placeholder: "Search country or dial code..."
|
|
716
|
-
}
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
{
|
|
727
|
-
|
|
728
|
-
"
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
/* @__PURE__ */ e("span", {
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
934
|
+
}), /* @__PURE__ */ e("ul", {
|
|
935
|
+
className: "rck-list",
|
|
936
|
+
role: "listbox",
|
|
937
|
+
"aria-label": "Countries",
|
|
938
|
+
children: r.filteredCountries.length === 0 ? /* @__PURE__ */ n("li", {
|
|
939
|
+
className: "rck-empty",
|
|
940
|
+
children: [/* @__PURE__ */ e("span", {
|
|
941
|
+
className: "rck-empty-icon",
|
|
942
|
+
children: "๐"
|
|
943
|
+
}), /* @__PURE__ */ e("span", { children: "No countries found" })]
|
|
944
|
+
}) : r.filteredCountries.map((l) => {
|
|
945
|
+
const t = r.country?.iso2 === l.iso2;
|
|
946
|
+
return /* @__PURE__ */ n("li", {
|
|
947
|
+
role: "option",
|
|
948
|
+
"aria-selected": t,
|
|
949
|
+
className: `rck-item${t ? " rck-item-selected" : ""}`,
|
|
950
|
+
onClick: () => r.selectCountry(l),
|
|
951
|
+
tabIndex: 0,
|
|
952
|
+
onKeyDown: (k) => k.key === "Enter" && r.selectCountry(l),
|
|
953
|
+
children: [
|
|
954
|
+
/* @__PURE__ */ e("span", {
|
|
955
|
+
className: "rck-item-flag",
|
|
956
|
+
children: /* @__PURE__ */ e(b, {
|
|
957
|
+
iso2: l.iso2,
|
|
958
|
+
flag: l.flag,
|
|
959
|
+
flagUrl: l.flag_url
|
|
960
|
+
})
|
|
961
|
+
}),
|
|
962
|
+
/* @__PURE__ */ n("div", {
|
|
963
|
+
className: "rck-item-main",
|
|
964
|
+
children: [/* @__PURE__ */ e("span", {
|
|
965
|
+
className: "rck-item-name",
|
|
966
|
+
children: l.name
|
|
967
|
+
}), /* @__PURE__ */ e("span", {
|
|
968
|
+
className: "rck-item-sub",
|
|
969
|
+
children: l.iso2
|
|
970
|
+
})]
|
|
971
|
+
}),
|
|
972
|
+
/* @__PURE__ */ n("span", {
|
|
973
|
+
className: "rck-item-phone",
|
|
974
|
+
children: ["+", l.phone_code]
|
|
975
|
+
})
|
|
976
|
+
]
|
|
977
|
+
}, l.iso2);
|
|
978
|
+
})
|
|
979
|
+
})]
|
|
980
|
+
})
|
|
981
|
+
]
|
|
982
|
+
})]
|
|
983
|
+
});
|
|
751
984
|
}
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
}) {
|
|
763
|
-
const r = D(
|
|
764
|
-
|
|
765
|
-
/* @__PURE__ */
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
985
|
+
var A = () => /* @__PURE__ */ e("svg", {
|
|
986
|
+
className: "rck-item-check",
|
|
987
|
+
viewBox: "0 0 20 20",
|
|
988
|
+
fill: "none",
|
|
989
|
+
stroke: "currentColor",
|
|
990
|
+
strokeWidth: "2.5",
|
|
991
|
+
strokeLinecap: "round",
|
|
992
|
+
strokeLinejoin: "round",
|
|
993
|
+
children: /* @__PURE__ */ e("polyline", { points: "4 10 8 14 16 6" })
|
|
994
|
+
});
|
|
995
|
+
function re({ value: i, onChange: a, placeholder: p = "Select a timezone", searchable: m = !0, countryIso2: o, disabled: h = !1, className: u, label: g }) {
|
|
996
|
+
const r = D(i, a, o), c = /* @__PURE__ */ e("div", {
|
|
997
|
+
className: "rck-trigger-content",
|
|
998
|
+
children: i ? /* @__PURE__ */ n(y, { children: [/* @__PURE__ */ e("span", {
|
|
999
|
+
className: "rck-trigger-text",
|
|
1000
|
+
children: i.name
|
|
1001
|
+
}), /* @__PURE__ */ e("span", {
|
|
1002
|
+
className: "rck-badge",
|
|
1003
|
+
children: i.offset_name
|
|
1004
|
+
})] }) : /* @__PURE__ */ e("span", {
|
|
1005
|
+
className: "rck-trigger-text rck-placeholder",
|
|
1006
|
+
children: p
|
|
1007
|
+
})
|
|
1008
|
+
});
|
|
1009
|
+
return /* @__PURE__ */ n(x, {
|
|
1010
|
+
isOpen: r.isOpen,
|
|
1011
|
+
onClose: r.close,
|
|
1012
|
+
onToggle: r.toggle,
|
|
1013
|
+
label: g,
|
|
1014
|
+
disabled: h,
|
|
1015
|
+
className: u,
|
|
1016
|
+
triggerContent: c,
|
|
1017
|
+
id: "rck-timezone-picker",
|
|
1018
|
+
children: [m && /* @__PURE__ */ e(N, {
|
|
1019
|
+
value: r.searchQuery,
|
|
1020
|
+
onChange: r.setSearchQuery,
|
|
1021
|
+
placeholder: "Search timezone..."
|
|
1022
|
+
}), /* @__PURE__ */ e("ul", {
|
|
1023
|
+
className: "rck-list",
|
|
1024
|
+
role: "listbox",
|
|
1025
|
+
"aria-label": "Timezones",
|
|
1026
|
+
children: r.filteredItems.length === 0 ? /* @__PURE__ */ n("li", {
|
|
1027
|
+
className: "rck-empty",
|
|
1028
|
+
children: [/* @__PURE__ */ e("span", {
|
|
1029
|
+
className: "rck-empty-icon",
|
|
1030
|
+
children: "๐"
|
|
1031
|
+
}), /* @__PURE__ */ e("span", { children: "No timezones found" })]
|
|
1032
|
+
}) : r.filteredItems.map((l) => {
|
|
1033
|
+
const t = i?.name === l.name;
|
|
1034
|
+
return /* @__PURE__ */ n("li", {
|
|
1035
|
+
role: "option",
|
|
1036
|
+
"aria-selected": t,
|
|
1037
|
+
className: `rck-item${t ? " rck-item-selected" : ""}`,
|
|
1038
|
+
onClick: () => r.selectItem(l),
|
|
1039
|
+
tabIndex: 0,
|
|
1040
|
+
onKeyDown: (k) => k.key === "Enter" && r.selectItem(l),
|
|
1041
|
+
children: [/* @__PURE__ */ n("div", {
|
|
1042
|
+
className: "rck-item-main",
|
|
1043
|
+
children: [/* @__PURE__ */ e("span", {
|
|
1044
|
+
className: "rck-item-name",
|
|
1045
|
+
children: l.name
|
|
1046
|
+
}), /* @__PURE__ */ n("span", {
|
|
1047
|
+
className: "rck-item-sub",
|
|
801
1048
|
children: [
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
s.tzName,
|
|
806
|
-
" ยท ",
|
|
807
|
-
s.abbreviation
|
|
808
|
-
] })
|
|
809
|
-
] }),
|
|
810
|
-
/* @__PURE__ */ c("div", { className: "rck-item-right", children: [
|
|
811
|
-
/* @__PURE__ */ e("span", { className: "rck-offset-badge", children: s.offset_name }),
|
|
812
|
-
l && /* @__PURE__ */ e(A, {})
|
|
813
|
-
] })
|
|
1049
|
+
l.tzName,
|
|
1050
|
+
" ยท ",
|
|
1051
|
+
l.abbreviation
|
|
814
1052
|
]
|
|
815
|
-
}
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
1053
|
+
})]
|
|
1054
|
+
}), /* @__PURE__ */ n("div", {
|
|
1055
|
+
className: "rck-item-right",
|
|
1056
|
+
children: [/* @__PURE__ */ e("span", {
|
|
1057
|
+
className: "rck-offset-badge",
|
|
1058
|
+
children: l.offset_name
|
|
1059
|
+
}), t && /* @__PURE__ */ e(A, {})]
|
|
1060
|
+
})]
|
|
1061
|
+
}, l.name);
|
|
1062
|
+
})
|
|
1063
|
+
})]
|
|
1064
|
+
});
|
|
822
1065
|
}
|
|
823
1066
|
export {
|
|
824
1067
|
G as CountryMultiSelect,
|
|
@@ -830,4 +1073,5 @@ export {
|
|
|
830
1073
|
ee as PhoneInput,
|
|
831
1074
|
re as TimezonePicker
|
|
832
1075
|
};
|
|
833
|
-
|
|
1076
|
+
|
|
1077
|
+
//# sourceMappingURL=react-country-kit.es.js.map
|