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