react-country-kit-core 2.1.1 → 2.1.2
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/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +240 -231
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { useState as
|
|
2
|
-
function
|
|
1
|
+
import { useState as M, useEffect as x, useRef as w, useMemo as l, useCallback as k } from "react";
|
|
2
|
+
function De(a) {
|
|
3
3
|
return [...a.toUpperCase()].map((o) => String.fromCodePoint(127462 + o.charCodeAt(0) - 65)).join("");
|
|
4
4
|
}
|
|
5
|
-
const
|
|
5
|
+
const ce = [
|
|
6
6
|
{
|
|
7
7
|
name: "Afghanistan",
|
|
8
8
|
iso2: "AF",
|
|
@@ -4253,7 +4253,7 @@ const se = [
|
|
|
4253
4253
|
date_separator: "/",
|
|
4254
4254
|
week_start: 0
|
|
4255
4255
|
}
|
|
4256
|
-
],
|
|
4256
|
+
], de = [
|
|
4257
4257
|
{
|
|
4258
4258
|
name: "Badakhshan",
|
|
4259
4259
|
iso2: "BDS",
|
|
@@ -36190,7 +36190,7 @@ const se = [
|
|
|
36190
36190
|
{ code: "zh-Hant", english_name: "Chinese (Traditional)", native_name: "繁體中文" },
|
|
36191
36191
|
{ code: "zh-TW", english_name: "Chinese (Taiwan)", native_name: "繁體中文 (台灣)" },
|
|
36192
36192
|
{ code: "zu", english_name: "Zulu", native_name: "isizulu" }
|
|
36193
|
-
],
|
|
36193
|
+
], ae = [
|
|
36194
36194
|
{
|
|
36195
36195
|
name: "Asia/Kabul",
|
|
36196
36196
|
offset: 16200,
|
|
@@ -39647,7 +39647,7 @@ const se = [
|
|
|
39647
39647
|
tzName: "Central Africa Time",
|
|
39648
39648
|
countryCode: "ZW"
|
|
39649
39649
|
}
|
|
39650
|
-
],
|
|
39650
|
+
], ue = [
|
|
39651
39651
|
{
|
|
39652
39652
|
countryCode: "AF",
|
|
39653
39653
|
iso2: "AF",
|
|
@@ -43543,7 +43543,7 @@ const se = [
|
|
|
43543
43543
|
countryCode: "ZW",
|
|
43544
43544
|
precision: 2
|
|
43545
43545
|
}
|
|
43546
|
-
],
|
|
43546
|
+
], ne = [
|
|
43547
43547
|
{
|
|
43548
43548
|
countryCode: "AF",
|
|
43549
43549
|
format: "YYYY-MM-DD",
|
|
@@ -45044,50 +45044,50 @@ const se = [
|
|
|
45044
45044
|
separator: "/",
|
|
45045
45045
|
weekStart: 0
|
|
45046
45046
|
}
|
|
45047
|
-
], P =
|
|
45048
|
-
function
|
|
45047
|
+
], P = ce;
|
|
45048
|
+
function ie() {
|
|
45049
45049
|
return P;
|
|
45050
45050
|
}
|
|
45051
45051
|
function Y(a) {
|
|
45052
45052
|
return P.find((o) => o.iso2.toLowerCase() === a.toLowerCase());
|
|
45053
45053
|
}
|
|
45054
|
-
function
|
|
45054
|
+
function Pe(a) {
|
|
45055
45055
|
return P.find((o) => o.iso3.toLowerCase() === a.toLowerCase());
|
|
45056
45056
|
}
|
|
45057
|
-
function
|
|
45057
|
+
function Ye(a) {
|
|
45058
45058
|
return P.find(
|
|
45059
45059
|
(o) => o.name.toLowerCase().includes(a.toLowerCase())
|
|
45060
45060
|
);
|
|
45061
45061
|
}
|
|
45062
|
-
const
|
|
45063
|
-
function
|
|
45062
|
+
const W = /* @__PURE__ */ new Map(), J = /* @__PURE__ */ new Map(), Q = /* @__PURE__ */ new Map();
|
|
45063
|
+
function Ce(a) {
|
|
45064
45064
|
if (!a.trim()) return P;
|
|
45065
|
-
const o = a.toLowerCase().trim(), e =
|
|
45065
|
+
const o = a.toLowerCase().trim(), e = W.get(o);
|
|
45066
45066
|
if (e) return e;
|
|
45067
45067
|
const i = P.filter(
|
|
45068
45068
|
(n) => n.name.toLowerCase().includes(o) || n.iso2.toLowerCase().includes(o) || n.iso3.toLowerCase().includes(o) || n.phone_code.includes(o)
|
|
45069
45069
|
);
|
|
45070
|
-
return Z.set(o, i), i;
|
|
45071
|
-
}
|
|
45072
|
-
function Ce(a) {
|
|
45073
|
-
const o = a.toLowerCase(), e = W.get(o);
|
|
45074
|
-
if (e) return e;
|
|
45075
|
-
const i = ce.filter((n) => n.countryCode.toLowerCase() === o);
|
|
45076
45070
|
return W.set(o, i), i;
|
|
45077
45071
|
}
|
|
45078
|
-
function
|
|
45072
|
+
function le(a) {
|
|
45079
45073
|
const o = a.toLowerCase(), e = J.get(o);
|
|
45080
45074
|
if (e) return e;
|
|
45081
|
-
const i =
|
|
45075
|
+
const i = de.filter((n) => n.countryCode.toLowerCase() === o);
|
|
45082
45076
|
return J.set(o, i), i;
|
|
45083
45077
|
}
|
|
45084
|
-
function
|
|
45078
|
+
function te(a) {
|
|
45079
|
+
const o = a.toLowerCase(), e = Q.get(o);
|
|
45080
|
+
if (e) return e;
|
|
45081
|
+
const i = ae.filter((n) => n.countryCode.toLowerCase() === o);
|
|
45082
|
+
return Q.set(o, i), i;
|
|
45083
|
+
}
|
|
45084
|
+
function ye(a) {
|
|
45085
45085
|
return H.find((o) => o.countryCode.toLowerCase() === a.toLowerCase());
|
|
45086
45086
|
}
|
|
45087
45087
|
function j(a) {
|
|
45088
|
-
return
|
|
45088
|
+
return ue.find((o) => o.iso2.toLowerCase() === a.toLowerCase());
|
|
45089
45089
|
}
|
|
45090
|
-
function
|
|
45090
|
+
function re(a) {
|
|
45091
45091
|
const o = j(a);
|
|
45092
45092
|
if (!o || !o.possibleLengths)
|
|
45093
45093
|
return { min: void 0, max: void 0 };
|
|
@@ -45101,93 +45101,93 @@ function te(a) {
|
|
|
45101
45101
|
const n = parseInt(e, 10);
|
|
45102
45102
|
return isNaN(n) ? { min: void 0, max: void 0 } : { min: n, max: n };
|
|
45103
45103
|
}
|
|
45104
|
-
function
|
|
45104
|
+
function pe(a) {
|
|
45105
45105
|
return Y(a)?.tax_id_label || "Tax ID";
|
|
45106
45106
|
}
|
|
45107
|
-
function
|
|
45107
|
+
function ze(a) {
|
|
45108
45108
|
return Y(a)?.tax_id_placeholder || "Enter tax ID";
|
|
45109
45109
|
}
|
|
45110
|
-
function
|
|
45110
|
+
function Ae(a) {
|
|
45111
45111
|
return Y(a)?.postal_code_label || "Postal Code";
|
|
45112
45112
|
}
|
|
45113
45113
|
function N(a, o, e, i) {
|
|
45114
|
-
const [n, t] =
|
|
45114
|
+
const [n, t] = M(!1), [r, m] = M(""), [c, d] = M(e ?? null);
|
|
45115
45115
|
x(() => {
|
|
45116
45116
|
d(e ?? null);
|
|
45117
45117
|
}, [e]);
|
|
45118
|
-
const
|
|
45119
|
-
|
|
45120
|
-
const
|
|
45118
|
+
const y = w(i);
|
|
45119
|
+
y.current = i;
|
|
45120
|
+
const p = l(
|
|
45121
45121
|
() => o(a, r),
|
|
45122
45122
|
[a, r, o]
|
|
45123
|
-
),
|
|
45123
|
+
), z = () => t(!0), A = () => {
|
|
45124
45124
|
t(!1), m("");
|
|
45125
|
-
},
|
|
45126
|
-
d(
|
|
45125
|
+
}, _ = () => t((h) => !h), f = (h) => {
|
|
45126
|
+
d(h), y.current?.(h), A();
|
|
45127
45127
|
}, b = () => {
|
|
45128
45128
|
d(null);
|
|
45129
45129
|
};
|
|
45130
|
-
return
|
|
45130
|
+
return l(
|
|
45131
45131
|
() => ({
|
|
45132
45132
|
isOpen: n,
|
|
45133
45133
|
searchQuery: r,
|
|
45134
|
-
filteredItems:
|
|
45135
|
-
selectedItem:
|
|
45136
|
-
open:
|
|
45137
|
-
close:
|
|
45138
|
-
toggle:
|
|
45134
|
+
filteredItems: p,
|
|
45135
|
+
selectedItem: c,
|
|
45136
|
+
open: z,
|
|
45137
|
+
close: A,
|
|
45138
|
+
toggle: _,
|
|
45139
45139
|
setSearchQuery: m,
|
|
45140
|
-
selectItem:
|
|
45140
|
+
selectItem: f,
|
|
45141
45141
|
clearSelection: b
|
|
45142
45142
|
}),
|
|
45143
45143
|
[
|
|
45144
45144
|
n,
|
|
45145
45145
|
r,
|
|
45146
|
-
y,
|
|
45147
|
-
s,
|
|
45148
45146
|
p,
|
|
45147
|
+
c,
|
|
45149
45148
|
z,
|
|
45150
|
-
f,
|
|
45151
45149
|
A,
|
|
45150
|
+
_,
|
|
45151
|
+
f,
|
|
45152
45152
|
b
|
|
45153
45153
|
]
|
|
45154
45154
|
);
|
|
45155
45155
|
}
|
|
45156
|
-
function
|
|
45156
|
+
function Be(a, o) {
|
|
45157
45157
|
const e = k(
|
|
45158
|
-
(i, n) =>
|
|
45158
|
+
(i, n) => Ce(n),
|
|
45159
45159
|
[]
|
|
45160
45160
|
);
|
|
45161
|
-
return N(
|
|
45161
|
+
return N(ie(), e, a, o);
|
|
45162
45162
|
}
|
|
45163
|
-
function
|
|
45164
|
-
return
|
|
45163
|
+
function ke() {
|
|
45164
|
+
return ne;
|
|
45165
45165
|
}
|
|
45166
|
-
const
|
|
45166
|
+
const X = {
|
|
45167
45167
|
countryCode: "DEFAULT",
|
|
45168
45168
|
format: "DD/MM/YYYY",
|
|
45169
45169
|
separator: "/",
|
|
45170
45170
|
weekStart: 1
|
|
45171
45171
|
};
|
|
45172
45172
|
function U(a) {
|
|
45173
|
-
if (!a) return
|
|
45173
|
+
if (!a) return X;
|
|
45174
45174
|
const o = a.toUpperCase();
|
|
45175
|
-
return
|
|
45176
|
-
...
|
|
45175
|
+
return ne.find((e) => e.countryCode === o) ?? {
|
|
45176
|
+
...X,
|
|
45177
45177
|
countryCode: o
|
|
45178
45178
|
};
|
|
45179
45179
|
}
|
|
45180
|
-
function
|
|
45180
|
+
function me(a, o) {
|
|
45181
45181
|
if (!a || isNaN(a.getTime()) || !o)
|
|
45182
45182
|
return "";
|
|
45183
45183
|
const e = String(a.getFullYear()), i = String(a.getMonth() + 1).padStart(2, "0"), n = String(a.getDate()).padStart(2, "0");
|
|
45184
45184
|
return o.replace(/YYYY/g, e).replace(/MM/g, i).replace(/DD/g, n);
|
|
45185
45185
|
}
|
|
45186
|
-
function
|
|
45186
|
+
function Ne(a, o) {
|
|
45187
45187
|
const e = U(o);
|
|
45188
|
-
return
|
|
45188
|
+
return me(a, e.format);
|
|
45189
45189
|
}
|
|
45190
|
-
function
|
|
45190
|
+
function se(a, o) {
|
|
45191
45191
|
if (!a || !o || a.length !== o.length)
|
|
45192
45192
|
return null;
|
|
45193
45193
|
const e = o.indexOf("YYYY"), i = o.indexOf("MM"), n = o.indexOf("DD");
|
|
@@ -45196,14 +45196,14 @@ function me(a, o) {
|
|
|
45196
45196
|
const t = parseInt(a.slice(e, e + 4), 10), r = parseInt(a.slice(i, i + 2), 10) - 1, m = parseInt(a.slice(n, n + 2), 10);
|
|
45197
45197
|
if (isNaN(t) || isNaN(r) || isNaN(m) || r < 0 || r > 11 || m < 1 || m > 31)
|
|
45198
45198
|
return null;
|
|
45199
|
-
const
|
|
45200
|
-
return
|
|
45199
|
+
const c = new Date(t, r, m);
|
|
45200
|
+
return c.getFullYear() !== t || c.getMonth() !== r || c.getDate() !== m ? null : c;
|
|
45201
45201
|
}
|
|
45202
|
-
function
|
|
45202
|
+
function Le(a, o) {
|
|
45203
45203
|
const e = U(o);
|
|
45204
|
-
return
|
|
45204
|
+
return se(a, e.format);
|
|
45205
45205
|
}
|
|
45206
|
-
const
|
|
45206
|
+
const q = /* @__PURE__ */ new Map(), fe = {
|
|
45207
45207
|
country: null,
|
|
45208
45208
|
divisions: [],
|
|
45209
45209
|
timezones: [],
|
|
@@ -45216,31 +45216,31 @@ const X = /* @__PURE__ */ new Map(), Ae = {
|
|
|
45216
45216
|
dateFormat: null
|
|
45217
45217
|
};
|
|
45218
45218
|
function O(a) {
|
|
45219
|
-
const o =
|
|
45220
|
-
return
|
|
45221
|
-
if (!o) return
|
|
45222
|
-
let e =
|
|
45219
|
+
const o = l(() => a ? a === a.toUpperCase() ? a : a.toUpperCase() : null, [a]);
|
|
45220
|
+
return l(() => {
|
|
45221
|
+
if (!o) return fe;
|
|
45222
|
+
let e = q.get(o.length);
|
|
45223
45223
|
if (e) {
|
|
45224
|
-
const
|
|
45225
|
-
if (
|
|
45224
|
+
const f = e.get(o);
|
|
45225
|
+
if (f) return f;
|
|
45226
45226
|
}
|
|
45227
|
-
const i = Y(o) ?? null, n =
|
|
45227
|
+
const i = Y(o) ?? null, n = le(o), t = te(o), r = ye(o) ?? null, m = j(o) ?? null, c = re(o), d = m?.example !== void 0 ? String(m.example) : void 0, y = pe(o), p = ze(o), z = Ae(o), A = U(o), _ = {
|
|
45228
45228
|
country: i,
|
|
45229
45229
|
divisions: n,
|
|
45230
45230
|
timezones: t,
|
|
45231
45231
|
currency: r,
|
|
45232
45232
|
phoneFormat: m,
|
|
45233
|
-
phoneLengths:
|
|
45233
|
+
phoneLengths: c,
|
|
45234
45234
|
exampleNumber: d,
|
|
45235
|
-
tax: { label:
|
|
45236
|
-
postalCode: { label:
|
|
45237
|
-
dateFormat:
|
|
45235
|
+
tax: { label: y, placeholder: p },
|
|
45236
|
+
postalCode: { label: z },
|
|
45237
|
+
dateFormat: A
|
|
45238
45238
|
};
|
|
45239
|
-
return e || (e = /* @__PURE__ */ new Map(),
|
|
45239
|
+
return e || (e = /* @__PURE__ */ new Map(), q.set(o.length, e)), e.set(o, _), _;
|
|
45240
45240
|
}, [o]);
|
|
45241
45241
|
}
|
|
45242
45242
|
let G = null;
|
|
45243
|
-
const
|
|
45243
|
+
const $ = /* @__PURE__ */ new Map();
|
|
45244
45244
|
function F() {
|
|
45245
45245
|
if (G) return G;
|
|
45246
45246
|
const a = /* @__PURE__ */ new Set(), o = [];
|
|
@@ -45248,75 +45248,75 @@ function F() {
|
|
|
45248
45248
|
a.has(e.code) || (a.add(e.code), o.push(e));
|
|
45249
45249
|
return G = o.sort((e, i) => e.code.localeCompare(i.code)), G;
|
|
45250
45250
|
}
|
|
45251
|
-
function
|
|
45251
|
+
function Re(a) {
|
|
45252
45252
|
const o = a.toLowerCase();
|
|
45253
45253
|
return F().find(
|
|
45254
45254
|
(e) => e.code.toLowerCase() === o
|
|
45255
45255
|
);
|
|
45256
45256
|
}
|
|
45257
|
-
function
|
|
45257
|
+
function _e(a, o) {
|
|
45258
45258
|
let e = F();
|
|
45259
45259
|
if (o && (e = H.filter((m) => m.countryCode.toLowerCase() === o.toLowerCase())), !a.trim()) return e;
|
|
45260
|
-
const i = a.toLowerCase().trim(), n = `${o || ""}:${i}`, t =
|
|
45260
|
+
const i = a.toLowerCase().trim(), n = `${o || ""}:${i}`, t = $.get(n);
|
|
45261
45261
|
if (t) return t;
|
|
45262
45262
|
const r = e.filter(
|
|
45263
45263
|
(m) => m.code.toLowerCase().includes(i) || m.name.toLowerCase().includes(i) || m.symbol.toLowerCase().includes(i)
|
|
45264
45264
|
);
|
|
45265
|
-
return
|
|
45265
|
+
return $.set(n, r), r;
|
|
45266
45266
|
}
|
|
45267
|
-
function
|
|
45267
|
+
function Ie(a, o) {
|
|
45268
45268
|
const e = k(
|
|
45269
|
-
(i, n) =>
|
|
45269
|
+
(i, n) => _e(n),
|
|
45270
45270
|
[]
|
|
45271
45271
|
);
|
|
45272
45272
|
return N(F(), e, a, o);
|
|
45273
45273
|
}
|
|
45274
|
-
function
|
|
45274
|
+
function Ge(a, o, e) {
|
|
45275
45275
|
const n = O(a).divisions, t = k(
|
|
45276
45276
|
(r, m) => {
|
|
45277
45277
|
if (!m.trim()) return r;
|
|
45278
|
-
const
|
|
45278
|
+
const c = m.toLowerCase().trim();
|
|
45279
45279
|
return r.filter(
|
|
45280
|
-
(d) => d.name.toLowerCase().includes(
|
|
45280
|
+
(d) => d.name.toLowerCase().includes(c) || d.iso2.toLowerCase().includes(c)
|
|
45281
45281
|
);
|
|
45282
45282
|
},
|
|
45283
45283
|
[]
|
|
45284
45284
|
);
|
|
45285
45285
|
return N(n, t, o, e);
|
|
45286
45286
|
}
|
|
45287
|
-
const
|
|
45288
|
-
function
|
|
45287
|
+
const ee = /* @__PURE__ */ new Map();
|
|
45288
|
+
function ge() {
|
|
45289
45289
|
return K;
|
|
45290
45290
|
}
|
|
45291
|
-
function
|
|
45291
|
+
function ve(a) {
|
|
45292
45292
|
const o = a.toLowerCase();
|
|
45293
45293
|
return K.find((e) => e.code.toLowerCase() === o);
|
|
45294
45294
|
}
|
|
45295
|
-
function
|
|
45295
|
+
function Ee(a) {
|
|
45296
45296
|
if (!a.trim()) return K;
|
|
45297
|
-
const o = a.toLowerCase().trim(), e =
|
|
45297
|
+
const o = a.toLowerCase().trim(), e = ee.get(o);
|
|
45298
45298
|
if (e) return e;
|
|
45299
45299
|
const i = K.filter(
|
|
45300
45300
|
(n) => n.english_name.toLowerCase().includes(o) || n.native_name.toLowerCase().includes(o) || n.code.toLowerCase().includes(o)
|
|
45301
45301
|
);
|
|
45302
|
-
return
|
|
45302
|
+
return ee.set(o, i), i;
|
|
45303
45303
|
}
|
|
45304
|
-
function
|
|
45304
|
+
function Ke(a, o) {
|
|
45305
45305
|
const e = k(
|
|
45306
|
-
(i, n) =>
|
|
45306
|
+
(i, n) => Ee(n),
|
|
45307
45307
|
[]
|
|
45308
45308
|
);
|
|
45309
|
-
return N(
|
|
45309
|
+
return N(ge(), e, a, o);
|
|
45310
45310
|
}
|
|
45311
45311
|
let v = null;
|
|
45312
45312
|
function V() {
|
|
45313
45313
|
if (v) return v;
|
|
45314
45314
|
const a = /* @__PURE__ */ new Set(), o = [];
|
|
45315
|
-
for (const e of
|
|
45315
|
+
for (const e of ae)
|
|
45316
45316
|
a.has(e.name) || (a.add(e.name), o.push(e));
|
|
45317
45317
|
return v = o.sort((e, i) => e.offset - i.offset), v;
|
|
45318
45318
|
}
|
|
45319
|
-
const
|
|
45319
|
+
const Me = {
|
|
45320
45320
|
"US/Eastern": "America/New_York",
|
|
45321
45321
|
"US/Central": "America/Chicago",
|
|
45322
45322
|
"US/Mountain": "America/Denver",
|
|
@@ -45362,13 +45362,13 @@ const Ee = {
|
|
|
45362
45362
|
"Europe/Belfast": "Europe/London",
|
|
45363
45363
|
"Europe/Tiraspol": "Europe/Chisinau"
|
|
45364
45364
|
};
|
|
45365
|
-
function
|
|
45365
|
+
function Ue(a) {
|
|
45366
45366
|
if (!a) return;
|
|
45367
45367
|
const o = a.toLowerCase(), e = V(), i = e.find(
|
|
45368
45368
|
(t) => t.name.toLowerCase() === o
|
|
45369
45369
|
);
|
|
45370
45370
|
if (i) return i;
|
|
45371
|
-
const n = Object.entries(
|
|
45371
|
+
const n = Object.entries(Me).find(
|
|
45372
45372
|
([t]) => t.toLowerCase() === o
|
|
45373
45373
|
)?.[1];
|
|
45374
45374
|
if (n)
|
|
@@ -45376,23 +45376,23 @@ function Ke(a) {
|
|
|
45376
45376
|
(t) => t.name.toLowerCase() === n.toLowerCase()
|
|
45377
45377
|
);
|
|
45378
45378
|
}
|
|
45379
|
-
const
|
|
45380
|
-
function
|
|
45381
|
-
const e = o ?
|
|
45379
|
+
const oe = /* @__PURE__ */ new Map();
|
|
45380
|
+
function he(a, o) {
|
|
45381
|
+
const e = o ? te(o) : V();
|
|
45382
45382
|
if (!a.trim()) return e;
|
|
45383
|
-
const i = a.toLowerCase().trim(), n = `${o || ""}:${i}`, t =
|
|
45383
|
+
const i = a.toLowerCase().trim(), n = `${o || ""}:${i}`, t = oe.get(n);
|
|
45384
45384
|
if (t) return t;
|
|
45385
45385
|
const r = e.filter(
|
|
45386
45386
|
(m) => m.name.toLowerCase().includes(i) || m.tzName.toLowerCase().includes(i) || m.abbreviation.toLowerCase().includes(i) || m.offset_name.toLowerCase().includes(i)
|
|
45387
45387
|
);
|
|
45388
|
-
return
|
|
45388
|
+
return oe.set(n, r), r;
|
|
45389
45389
|
}
|
|
45390
|
-
function
|
|
45391
|
-
const i = O(e), n =
|
|
45390
|
+
function xe(a, o, e) {
|
|
45391
|
+
const i = O(e), n = l(
|
|
45392
45392
|
() => e ? i.timezones : V(),
|
|
45393
45393
|
[e, i.timezones]
|
|
45394
45394
|
), t = k(
|
|
45395
|
-
(r, m) =>
|
|
45395
|
+
(r, m) => he(m, e),
|
|
45396
45396
|
[e]
|
|
45397
45397
|
);
|
|
45398
45398
|
return N(n, t, a, o);
|
|
@@ -45401,10 +45401,10 @@ function B(a) {
|
|
|
45401
45401
|
const o = Y(a);
|
|
45402
45402
|
if (!o)
|
|
45403
45403
|
return {};
|
|
45404
|
-
const e =
|
|
45404
|
+
const e = re(a), i = j(a);
|
|
45405
45405
|
let n = i?.example ? String(i.example) : void 0;
|
|
45406
45406
|
n?.startsWith("+") && (n = n.slice(1 + o.phone_code.length));
|
|
45407
|
-
const t = n ?
|
|
45407
|
+
const t = n ? Se(n, a) : void 0;
|
|
45408
45408
|
return {
|
|
45409
45409
|
minLength: e.min,
|
|
45410
45410
|
maxLength: e.max,
|
|
@@ -45414,7 +45414,7 @@ function B(a) {
|
|
|
45414
45414
|
nationalPrefix: i?.nationalPrefix
|
|
45415
45415
|
};
|
|
45416
45416
|
}
|
|
45417
|
-
function
|
|
45417
|
+
function Se(a, o) {
|
|
45418
45418
|
const e = a.replace(/\D/g, "");
|
|
45419
45419
|
if (o.toUpperCase() === "US" || o.toUpperCase() === "CA") {
|
|
45420
45420
|
if (e.length >= 10)
|
|
@@ -45430,7 +45430,7 @@ function he(a, o) {
|
|
|
45430
45430
|
const i = e.match(/(\d{1,4})(\d{1,4})?(\d{1,4})?(\d{0,4})?/);
|
|
45431
45431
|
return i ? [i[1], i[2], i[3], i[4]].filter(Boolean).join(" ") : e;
|
|
45432
45432
|
}
|
|
45433
|
-
function
|
|
45433
|
+
function Te(a, o, e) {
|
|
45434
45434
|
const i = [];
|
|
45435
45435
|
let n = o.replace(/\D/g, "");
|
|
45436
45436
|
const t = B(e);
|
|
@@ -45444,7 +45444,7 @@ function Se(a, o, e) {
|
|
|
45444
45444
|
errors: i
|
|
45445
45445
|
};
|
|
45446
45446
|
}
|
|
45447
|
-
function
|
|
45447
|
+
function we(a, o) {
|
|
45448
45448
|
const e = a.replace(/\D/g, "");
|
|
45449
45449
|
if (o.toUpperCase() === "US" || o.toUpperCase() === "CA") {
|
|
45450
45450
|
if (e.length >= 10)
|
|
@@ -45456,59 +45456,68 @@ function xe(a, o) {
|
|
|
45456
45456
|
return `${e.slice(0, 3)} ${e.slice(3)}`;
|
|
45457
45457
|
return a;
|
|
45458
45458
|
}
|
|
45459
|
-
function
|
|
45460
|
-
const i = a?.country ?? (e ? Y(e) ?? null : null), [n, t] =
|
|
45459
|
+
function He(a, o, e) {
|
|
45460
|
+
const i = a?.country ?? (e ? Y(e) ?? null : null), [n, t] = M(i), [r, m] = M(a?.number ?? ""), [c, d] = M(!1), [y, p] = M("");
|
|
45461
45461
|
x(() => {
|
|
45462
45462
|
a ? (t(a.country), m(a.number)) : (t(i), m(""));
|
|
45463
45463
|
}, [a, i]);
|
|
45464
|
-
const
|
|
45465
|
-
|
|
45466
|
-
const
|
|
45467
|
-
if (!
|
|
45468
|
-
const
|
|
45469
|
-
return
|
|
45470
|
-
(u) => u.name.toLowerCase().includes(
|
|
45464
|
+
const z = w(o);
|
|
45465
|
+
z.current = o;
|
|
45466
|
+
const A = ie(), _ = l(() => {
|
|
45467
|
+
if (!y.trim()) return A;
|
|
45468
|
+
const s = y.toLowerCase().trim().replace("+", "");
|
|
45469
|
+
return A.filter(
|
|
45470
|
+
(u) => u.name.toLowerCase().includes(s) || u.phone_code.includes(s) || u.iso2.toLowerCase().includes(s)
|
|
45471
45471
|
);
|
|
45472
|
-
}, [
|
|
45473
|
-
const
|
|
45474
|
-
let T = u;
|
|
45475
|
-
return
|
|
45476
|
-
|
|
45477
|
-
|
|
45472
|
+
}, [A, y]), f = (s, u) => {
|
|
45473
|
+
const C = B(s.iso2);
|
|
45474
|
+
let T = u, Z = C;
|
|
45475
|
+
return C.nationalPrefix && u.startsWith(C.nationalPrefix) && (T = u.slice(C.nationalPrefix.length), Z = {
|
|
45476
|
+
...C,
|
|
45477
|
+
minLength: C.minLength ? C.minLength + C.nationalPrefix.length : void 0,
|
|
45478
|
+
maxLength: C.maxLength ? C.maxLength + C.nationalPrefix.length : void 0
|
|
45479
|
+
}), {
|
|
45480
|
+
country: s,
|
|
45481
|
+
dialCode: `+${s.phone_code}`,
|
|
45478
45482
|
number: u,
|
|
45479
|
-
full: `+${
|
|
45480
|
-
validation:
|
|
45483
|
+
full: `+${s.phone_code}${T}`,
|
|
45484
|
+
validation: Z
|
|
45481
45485
|
};
|
|
45482
|
-
}, b = (
|
|
45483
|
-
t(
|
|
45484
|
-
},
|
|
45485
|
-
let u =
|
|
45486
|
-
const
|
|
45487
|
-
let T =
|
|
45488
|
-
T &&
|
|
45489
|
-
}, R = () => n ? r ?
|
|
45490
|
-
d(!1),
|
|
45491
|
-
}, D =
|
|
45492
|
-
() => n ?
|
|
45486
|
+
}, b = (s) => {
|
|
45487
|
+
t(s), d(!1), p(""), z.current?.(f(s, r));
|
|
45488
|
+
}, h = O(n?.iso2), L = (s) => {
|
|
45489
|
+
let u = s.replace(/\D/g, "");
|
|
45490
|
+
const C = B(n?.iso2 ?? "");
|
|
45491
|
+
let T = h.phoneLengths.max;
|
|
45492
|
+
T && C.nationalPrefix && u.startsWith(C.nationalPrefix) && (T += C.nationalPrefix.length), T && u.length > T && (u = u.slice(0, T)), m(u), n && z.current?.(f(n, u));
|
|
45493
|
+
}, R = () => n ? r ? Te(`+${n.phone_code}`, r, n.iso2) : { isValid: !1, errors: ["Phone number is required"] } : { isValid: !1, errors: ["Please select a country"] }, I = () => n ? B(n.iso2).placeholder || "Enter phone number" : "Phone number", g = () => d((s) => !s), E = () => {
|
|
45494
|
+
d(!1), p("");
|
|
45495
|
+
}, D = l(
|
|
45496
|
+
() => n ? f(n, r) : null,
|
|
45493
45497
|
[n, r]
|
|
45494
|
-
),
|
|
45495
|
-
|
|
45496
|
-
|
|
45497
|
-
|
|
45498
|
-
|
|
45498
|
+
), S = l(() => {
|
|
45499
|
+
if (!n) return null;
|
|
45500
|
+
const s = B(n.iso2);
|
|
45501
|
+
return s.nationalPrefix && r.startsWith(s.nationalPrefix) ? {
|
|
45502
|
+
...s,
|
|
45503
|
+
minLength: s.minLength ? s.minLength + s.nationalPrefix.length : void 0,
|
|
45504
|
+
maxLength: s.maxLength ? s.maxLength + s.nationalPrefix.length : void 0
|
|
45505
|
+
} : s;
|
|
45506
|
+
}, [n, r]);
|
|
45507
|
+
return l(
|
|
45499
45508
|
() => ({
|
|
45500
45509
|
country: n,
|
|
45501
45510
|
number: r,
|
|
45502
45511
|
value: D,
|
|
45503
|
-
validation:
|
|
45504
|
-
isOpen:
|
|
45505
|
-
searchQuery:
|
|
45506
|
-
filteredCountries:
|
|
45507
|
-
setSearchQuery:
|
|
45512
|
+
validation: S,
|
|
45513
|
+
isOpen: c,
|
|
45514
|
+
searchQuery: y,
|
|
45515
|
+
filteredCountries: _,
|
|
45516
|
+
setSearchQuery: p,
|
|
45508
45517
|
selectCountry: b,
|
|
45509
45518
|
setNumber: L,
|
|
45510
|
-
toggle:
|
|
45511
|
-
close:
|
|
45519
|
+
toggle: g,
|
|
45520
|
+
close: E,
|
|
45512
45521
|
validate: R,
|
|
45513
45522
|
getPlaceholder: I
|
|
45514
45523
|
}),
|
|
@@ -45516,77 +45525,77 @@ function we(a, o, e) {
|
|
|
45516
45525
|
n,
|
|
45517
45526
|
r,
|
|
45518
45527
|
D,
|
|
45519
|
-
|
|
45520
|
-
|
|
45521
|
-
|
|
45522
|
-
|
|
45528
|
+
S,
|
|
45529
|
+
c,
|
|
45530
|
+
y,
|
|
45531
|
+
_
|
|
45523
45532
|
]
|
|
45524
45533
|
);
|
|
45525
45534
|
}
|
|
45526
|
-
function
|
|
45527
|
-
const [r, m] =
|
|
45535
|
+
function je(a, o, e, i, n, t) {
|
|
45536
|
+
const [r, m] = M(!1), [c, d] = M(""), [y, p] = M(i ?? []);
|
|
45528
45537
|
x(() => {
|
|
45529
|
-
|
|
45538
|
+
p(i ?? []);
|
|
45530
45539
|
}, [i]);
|
|
45531
|
-
const
|
|
45532
|
-
|
|
45533
|
-
const
|
|
45534
|
-
() => o(a,
|
|
45535
|
-
[a,
|
|
45536
|
-
),
|
|
45540
|
+
const z = w(n);
|
|
45541
|
+
z.current = n;
|
|
45542
|
+
const A = l(
|
|
45543
|
+
() => o(a, c),
|
|
45544
|
+
[a, c, o]
|
|
45545
|
+
), _ = () => m(!0), f = () => {
|
|
45537
45546
|
m(!1), d("");
|
|
45538
|
-
}, b = () => m((
|
|
45539
|
-
|
|
45540
|
-
const D =
|
|
45541
|
-
let
|
|
45547
|
+
}, b = () => m((g) => !g), h = (g) => y.some((E) => e(E) === e(g)), L = (g) => {
|
|
45548
|
+
p((E) => {
|
|
45549
|
+
const D = E.some((s) => e(s) === e(g));
|
|
45550
|
+
let S;
|
|
45542
45551
|
if (D)
|
|
45543
|
-
|
|
45552
|
+
S = E.filter((s) => e(s) !== e(g));
|
|
45544
45553
|
else {
|
|
45545
|
-
if (t !== void 0 &&
|
|
45546
|
-
|
|
45554
|
+
if (t !== void 0 && E.length >= t) return E;
|
|
45555
|
+
S = [...E, g];
|
|
45547
45556
|
}
|
|
45548
|
-
return
|
|
45557
|
+
return z.current?.(S), S;
|
|
45549
45558
|
});
|
|
45550
|
-
}, R = (
|
|
45551
|
-
|
|
45552
|
-
const D =
|
|
45553
|
-
return
|
|
45559
|
+
}, R = (g) => {
|
|
45560
|
+
p((E) => {
|
|
45561
|
+
const D = E.filter((S) => e(S) !== e(g));
|
|
45562
|
+
return z.current?.(D), D;
|
|
45554
45563
|
});
|
|
45555
45564
|
}, I = () => {
|
|
45556
|
-
|
|
45565
|
+
p([]), z.current?.([]);
|
|
45557
45566
|
};
|
|
45558
|
-
return
|
|
45567
|
+
return l(
|
|
45559
45568
|
() => ({
|
|
45560
45569
|
isOpen: r,
|
|
45561
|
-
searchQuery:
|
|
45562
|
-
filteredItems:
|
|
45563
|
-
selectedItems:
|
|
45564
|
-
open:
|
|
45565
|
-
close:
|
|
45570
|
+
searchQuery: c,
|
|
45571
|
+
filteredItems: A,
|
|
45572
|
+
selectedItems: y,
|
|
45573
|
+
open: _,
|
|
45574
|
+
close: f,
|
|
45566
45575
|
toggle: b,
|
|
45567
45576
|
setSearchQuery: d,
|
|
45568
45577
|
toggleItem: L,
|
|
45569
|
-
isSelected:
|
|
45578
|
+
isSelected: h,
|
|
45570
45579
|
removeItem: R,
|
|
45571
45580
|
clearAll: I
|
|
45572
45581
|
}),
|
|
45573
45582
|
[
|
|
45574
45583
|
r,
|
|
45575
|
-
|
|
45576
|
-
z,
|
|
45577
|
-
l,
|
|
45578
|
-
f,
|
|
45584
|
+
c,
|
|
45579
45585
|
A,
|
|
45586
|
+
y,
|
|
45587
|
+
_,
|
|
45588
|
+
f,
|
|
45580
45589
|
b,
|
|
45581
45590
|
L,
|
|
45582
|
-
|
|
45591
|
+
h,
|
|
45583
45592
|
R,
|
|
45584
45593
|
I
|
|
45585
45594
|
]
|
|
45586
45595
|
);
|
|
45587
45596
|
}
|
|
45588
|
-
function
|
|
45589
|
-
const o =
|
|
45597
|
+
function Oe(a) {
|
|
45598
|
+
const o = l(() => a ? a === a.toUpperCase() ? a : a.toUpperCase() : null, [a]), e = l(() => o ? U(o) : null, [o]), i = l(() => (m) => e ? me(m, e.format) : "", [e]), n = l(() => (m) => e ? se(m, e.format) : null, [e]), t = e?.format ?? "", r = e?.weekStart ?? 1;
|
|
45590
45599
|
return {
|
|
45591
45600
|
dateFormat: e,
|
|
45592
45601
|
formatDate: i,
|
|
@@ -45596,54 +45605,54 @@ function je(a) {
|
|
|
45596
45605
|
};
|
|
45597
45606
|
}
|
|
45598
45607
|
export {
|
|
45599
|
-
|
|
45608
|
+
ce as COUNTRIES,
|
|
45600
45609
|
H as CURRENCIES,
|
|
45601
|
-
|
|
45602
|
-
|
|
45603
|
-
|
|
45604
|
-
|
|
45605
|
-
|
|
45606
|
-
|
|
45607
|
-
|
|
45608
|
-
|
|
45609
|
-
|
|
45610
|
+
ne as DATE_FORMATS,
|
|
45611
|
+
de as DIVISIONS,
|
|
45612
|
+
ue as PHONE_FORMATS,
|
|
45613
|
+
ae as TIMEZONES,
|
|
45614
|
+
Ne as formatDateByCountry,
|
|
45615
|
+
me as formatDateWithPattern,
|
|
45616
|
+
Se as formatPhoneExample,
|
|
45617
|
+
we as formatPhoneNumber,
|
|
45618
|
+
ie as getAllCountries,
|
|
45610
45619
|
F as getAllCurrencies,
|
|
45611
|
-
|
|
45612
|
-
|
|
45620
|
+
ke as getAllDateFormats,
|
|
45621
|
+
ge as getAllLanguages,
|
|
45613
45622
|
V as getAllTimezones,
|
|
45614
45623
|
Y as getCountryByIso2,
|
|
45615
|
-
|
|
45616
|
-
|
|
45617
|
-
|
|
45618
|
-
|
|
45624
|
+
Pe as getCountryByIso3,
|
|
45625
|
+
Ye as getCountryByName,
|
|
45626
|
+
Re as getCurrencyByCode,
|
|
45627
|
+
ye as getCurrencyByCountry,
|
|
45619
45628
|
U as getDateFormatByCountry,
|
|
45620
|
-
|
|
45621
|
-
|
|
45629
|
+
le as getDivisionsByCountry,
|
|
45630
|
+
ve as getLanguageByCode,
|
|
45622
45631
|
j as getPhoneFormatByCountry,
|
|
45623
|
-
|
|
45632
|
+
re as getPhoneLengths,
|
|
45624
45633
|
B as getPhoneValidation,
|
|
45625
|
-
|
|
45626
|
-
|
|
45627
|
-
|
|
45628
|
-
|
|
45629
|
-
|
|
45630
|
-
|
|
45631
|
-
|
|
45632
|
-
|
|
45633
|
-
|
|
45634
|
-
|
|
45635
|
-
|
|
45636
|
-
|
|
45634
|
+
Ae as getPostalLabelByCountry,
|
|
45635
|
+
pe as getTaxLabelByCountry,
|
|
45636
|
+
ze as getTaxPlaceholderByCountry,
|
|
45637
|
+
Ue as getTimezoneByName,
|
|
45638
|
+
te as getTimezonesByCountry,
|
|
45639
|
+
De as iso2ToFlag,
|
|
45640
|
+
Le as parseDateByCountry,
|
|
45641
|
+
se as parseDateWithPattern,
|
|
45642
|
+
Ce as searchCountries,
|
|
45643
|
+
_e as searchCurrencies,
|
|
45644
|
+
Ee as searchLanguages,
|
|
45645
|
+
he as searchTimezones,
|
|
45637
45646
|
N as useBasePicker,
|
|
45638
45647
|
O as useCountry,
|
|
45639
|
-
|
|
45640
|
-
|
|
45641
|
-
|
|
45642
|
-
|
|
45643
|
-
|
|
45644
|
-
|
|
45645
|
-
|
|
45646
|
-
|
|
45647
|
-
|
|
45648
|
+
Be as useCountryPicker,
|
|
45649
|
+
Ie as useCurrencyPicker,
|
|
45650
|
+
Oe as useDateFormat,
|
|
45651
|
+
Ge as useDivisionPicker,
|
|
45652
|
+
Ke as useLanguagePicker,
|
|
45653
|
+
je as useMultiSelect,
|
|
45654
|
+
He as usePhoneInput,
|
|
45655
|
+
xe as useTimezonePicker,
|
|
45656
|
+
Te as validatePhoneNumber
|
|
45648
45657
|
};
|
|
45649
45658
|
//# sourceMappingURL=index.mjs.map
|