@snmt-react-ui/country-select 2.3.0 → 2.3.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/dist/country-select.js +55 -55
- package/package.json +3 -3
package/dist/country-select.js
CHANGED
@@ -6784,10 +6784,10 @@ const F1 = ({ children: i, width: e, size: t = "small", onClose: s, closable: o
|
|
6784
6784
|
extraOptions: v,
|
6785
6785
|
dropdownRender: N,
|
6786
6786
|
optionRender: E,
|
6787
|
-
isLoading:
|
6788
|
-
readOnly:
|
6787
|
+
isLoading: R,
|
6788
|
+
readOnly: M
|
6789
6789
|
}, m) => {
|
6790
|
-
const [x, b] = S(!1), [
|
6790
|
+
const [x, b] = S(!1), [y, D] = S(!1), [i1, P] = S(!0), [V, s1] = S(i), o1 = N1(null);
|
6791
6791
|
A(() => {
|
6792
6792
|
s1(i);
|
6793
6793
|
}, [i]);
|
@@ -6812,14 +6812,14 @@ const F1 = ({ children: i, width: e, size: t = "small", onClose: s, closable: o
|
|
6812
6812
|
},
|
6813
6813
|
[s, e]
|
6814
6814
|
), j = Z(() => {
|
6815
|
-
if (!
|
6815
|
+
if (!M) {
|
6816
6816
|
if (s) {
|
6817
6817
|
H([]);
|
6818
6818
|
return;
|
6819
6819
|
}
|
6820
6820
|
H("");
|
6821
6821
|
}
|
6822
|
-
}, [H, s,
|
6822
|
+
}, [H, s, M]), B = Z(
|
6823
6823
|
(f) => {
|
6824
6824
|
const _ = V.filter((O) => O !== f);
|
6825
6825
|
H(_), s1(_);
|
@@ -6854,13 +6854,13 @@ const F1 = ({ children: i, width: e, size: t = "small", onClose: s, closable: o
|
|
6854
6854
|
values: f,
|
6855
6855
|
onTagClose: B,
|
6856
6856
|
maxWidth: ((_ = o1.current) == null ? void 0 : _.clientWidth) || 0,
|
6857
|
-
disabled: r ||
|
6857
|
+
disabled: r || M,
|
6858
6858
|
options: l,
|
6859
6859
|
extraOptions: v
|
6860
6860
|
}
|
6861
6861
|
);
|
6862
6862
|
},
|
6863
|
-
[r, v, B, l,
|
6863
|
+
[r, v, B, l, M]
|
6864
6864
|
), te = Z(
|
6865
6865
|
({ label: f, value: _, mode: O }) => O === "filter" ? J(_) : /* @__PURE__ */ n("div", { onMouseDown: q1, className: "tag-wrapper", children: /* @__PURE__ */ n(F1, { onClose: () => B(_), closable: !r, children: /* @__PURE__ */ n($1, { variant: "body4", children: typeof f == "object" ? f : p1(_) }) }) }),
|
6866
6866
|
[r, p1, B, J]
|
@@ -6868,8 +6868,8 @@ const F1 = ({ children: i, width: e, size: t = "small", onClose: s, closable: o
|
|
6868
6868
|
return /* @__PURE__ */ u(
|
6869
6869
|
"div",
|
6870
6870
|
{
|
6871
|
-
className: `snmt-select ${
|
6872
|
-
${s ? "" : "snmt-select-single"} ${
|
6871
|
+
className: `snmt-select ${y ? "snmt-select-focused" : ""}
|
6872
|
+
${s ? "" : "snmt-select-single"} ${M ? "snmt-select-read-only" : ""}`,
|
6873
6873
|
ref: o1,
|
6874
6874
|
style: { width: c },
|
6875
6875
|
children: [
|
@@ -6877,7 +6877,7 @@ const F1 = ({ children: i, width: e, size: t = "small", onClose: s, closable: o
|
|
6877
6877
|
ne,
|
6878
6878
|
{
|
6879
6879
|
className: "snmt-select-blank",
|
6880
|
-
popupClassName:
|
6880
|
+
popupClassName: M ? "dropdown-read-only" : "",
|
6881
6881
|
id: w,
|
6882
6882
|
ref: m,
|
6883
6883
|
showSearch: !!o,
|
@@ -6900,7 +6900,7 @@ const F1 = ({ children: i, width: e, size: t = "small", onClose: s, closable: o
|
|
6900
6900
|
maxTagCount: "responsive",
|
6901
6901
|
maxTagPlaceholder: ee,
|
6902
6902
|
onPopupScroll: X1,
|
6903
|
-
prefix: R &&
|
6903
|
+
prefix: R && /* @__PURE__ */ n(R1, { size: 15 }),
|
6904
6904
|
suffixIcon: /* @__PURE__ */ n("div", { className: "wrapper-suffix-icon", children: s !== "filter" && /* @__PURE__ */ u(z, { children: [
|
6905
6905
|
s && V && !!V.length && /* @__PURE__ */ n("div", { onClick: j, children: /* @__PURE__ */ n(r1, { name: "cancel" }) }),
|
6906
6906
|
/* @__PURE__ */ n(
|
@@ -6938,7 +6938,7 @@ const F1 = ({ children: i, width: e, size: t = "small", onClose: s, closable: o
|
|
6938
6938
|
}
|
6939
6939
|
)
|
6940
6940
|
] }),
|
6941
|
-
dropdownRender:
|
6941
|
+
dropdownRender: R ? () => /* @__PURE__ */ n(
|
6942
6942
|
"div",
|
6943
6943
|
{
|
6944
6944
|
style: {
|
@@ -6954,7 +6954,7 @@ const F1 = ({ children: i, width: e, size: t = "small", onClose: s, closable: o
|
|
6954
6954
|
/* @__PURE__ */ n(
|
6955
6955
|
"fieldset",
|
6956
6956
|
{
|
6957
|
-
className: `${
|
6957
|
+
className: `${y ? "fieldset-focused" : ""}
|
6958
6958
|
${r ? "fieldset-disabled" : ""}
|
6959
6959
|
${typeof i == "string" && i ? "fieldset-filled" : ""}
|
6960
6960
|
${typeof i == "object" && i != null && i.length ? "fieldset-filled" : ""}`,
|
@@ -7323,8 +7323,8 @@ class g1 extends C1 {
|
|
7323
7323
|
}
|
7324
7324
|
const h = this.resolve(e, t);
|
7325
7325
|
let C = h && h.res;
|
7326
|
-
const p = h && h.usedKey || c, w = h && h.exactUsedKey || c, v = Object.prototype.toString.apply(C), N = ["[object Number]", "[object Function]", "[object RegExp]"], E = t.joinArrays !== void 0 ? t.joinArrays : this.options.joinArrays,
|
7327
|
-
if (
|
7326
|
+
const p = h && h.usedKey || c, w = h && h.exactUsedKey || c, v = Object.prototype.toString.apply(C), N = ["[object Number]", "[object Function]", "[object RegExp]"], E = t.joinArrays !== void 0 ? t.joinArrays : this.options.joinArrays, R = !this.i18nFormat || this.i18nFormat.handleAsObject;
|
7327
|
+
if (R && C && (typeof C != "string" && typeof C != "boolean" && typeof C != "number") && N.indexOf(v) < 0 && !(typeof E == "string" && Array.isArray(C))) {
|
7328
7328
|
if (!t.returnObjects && !this.options.returnObjects) {
|
7329
7329
|
this.options.returnedObjectHandler || this.logger.warn("accessing an object - but returnObjects options is not enabled!");
|
7330
7330
|
const m = this.options.returnedObjectHandler ? this.options.returnedObjectHandler(p, C, {
|
@@ -7335,26 +7335,26 @@ class g1 extends C1 {
|
|
7335
7335
|
}
|
7336
7336
|
if (l) {
|
7337
7337
|
const m = Array.isArray(C), x = m ? [] : {}, b = m ? w : p;
|
7338
|
-
for (const
|
7339
|
-
if (Object.prototype.hasOwnProperty.call(C,
|
7340
|
-
const D = `${b}${l}${
|
7341
|
-
x[
|
7338
|
+
for (const y in C)
|
7339
|
+
if (Object.prototype.hasOwnProperty.call(C, y)) {
|
7340
|
+
const D = `${b}${l}${y}`;
|
7341
|
+
x[y] = this.translate(D, {
|
7342
7342
|
...t,
|
7343
7343
|
joinArrays: !1,
|
7344
7344
|
ns: r
|
7345
|
-
}), x[
|
7345
|
+
}), x[y] === D && (x[y] = C[y]);
|
7346
7346
|
}
|
7347
7347
|
C = x;
|
7348
7348
|
}
|
7349
|
-
} else if (
|
7349
|
+
} else if (R && typeof E == "string" && Array.isArray(C))
|
7350
7350
|
C = C.join(E), C && (C = this.extendTranslation(C, e, t, s));
|
7351
7351
|
else {
|
7352
7352
|
let m = !1, x = !1;
|
7353
|
-
const b = t.count !== void 0 && typeof t.count != "string",
|
7353
|
+
const b = t.count !== void 0 && typeof t.count != "string", y = g1.hasDefaultValue(t), D = b ? this.pluralResolver.getSuffix(g, t.count, t) : "", i1 = t.ordinal && b ? this.pluralResolver.getSuffix(g, t.count, {
|
7354
7354
|
ordinal: !1
|
7355
7355
|
}) : "", P = b && !t.ordinal && t.count === 0 && this.pluralResolver.shouldUseIntlApi(), V = P && t[`defaultValue${this.options.pluralSeparator}zero`] || t[`defaultValue${D}`] || t[`defaultValue${i1}`] || t.defaultValue;
|
7356
|
-
!this.isValidLookup(C) &&
|
7357
|
-
const o1 = (t.missingKeyNoValueFallbackToKey || this.options.missingKeyNoValueFallbackToKey) && x ? void 0 : C, T =
|
7356
|
+
!this.isValidLookup(C) && y && (m = !0, C = V), this.isValidLookup(C) || (x = !0, C = c);
|
7357
|
+
const o1 = (t.missingKeyNoValueFallbackToKey || this.options.missingKeyNoValueFallbackToKey) && x ? void 0 : C, T = y && V !== C && this.options.updateMissing;
|
7358
7358
|
if (x || m || T) {
|
7359
7359
|
if (this.logger.log(T ? "updateKey" : "missingKey", g, d, c, T ? V : C), l) {
|
7360
7360
|
const H = this.resolve(c, {
|
@@ -7370,7 +7370,7 @@ class g1 extends C1 {
|
|
7370
7370
|
G.push(F[H]);
|
7371
7371
|
else this.options.saveMissingTo === "all" ? G = this.languageUtils.toResolveHierarchy(t.lng || this.language) : G.push(t.lng || this.language);
|
7372
7372
|
const n1 = (H, j, B) => {
|
7373
|
-
const J =
|
7373
|
+
const J = y && B !== C ? B : o1;
|
7374
7374
|
this.options.missingKeyHandler ? this.options.missingKeyHandler(H, d, j, J, T, t) : this.backendConnector && this.backendConnector.saveMissing && this.backendConnector.saveMissing(H, d, j, J, T, t), this.emit("missingKey", H, d, j, C);
|
7375
7375
|
};
|
7376
7376
|
this.options.saveMissing && (this.options.saveMissingPlurals && b ? G.forEach((H) => {
|
@@ -7443,21 +7443,21 @@ class g1 extends C1 {
|
|
7443
7443
|
this.isValidLookup(s) || (r = N, !H1[`${v[0]}-${N}`] && this.utils && this.utils.hasLoadedNamespace && !this.utils.hasLoadedNamespace(r) && (H1[`${v[0]}-${N}`] = !0, this.logger.warn(`key "${o}" for languages "${v.join(", ")}" won't get resolved as namespace "${r}" was not yet loaded`, "This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")), v.forEach((E) => {
|
7444
7444
|
if (this.isValidLookup(s)) return;
|
7445
7445
|
c = E;
|
7446
|
-
const
|
7446
|
+
const R = [a];
|
7447
7447
|
if (this.i18nFormat && this.i18nFormat.addLookupKeys)
|
7448
|
-
this.i18nFormat.addLookupKeys(
|
7448
|
+
this.i18nFormat.addLookupKeys(R, a, E, N, t);
|
7449
7449
|
else {
|
7450
7450
|
let m;
|
7451
7451
|
C && (m = this.pluralResolver.getSuffix(E, t.count, t));
|
7452
7452
|
const x = `${this.options.pluralSeparator}zero`, b = `${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;
|
7453
|
-
if (C && (
|
7454
|
-
const
|
7455
|
-
|
7453
|
+
if (C && (R.push(a + m), t.ordinal && m.indexOf(b) === 0 && R.push(a + m.replace(b, this.options.pluralSeparator)), p && R.push(a + x)), w) {
|
7454
|
+
const y = `${a}${this.options.contextSeparator}${t.context}`;
|
7455
|
+
R.push(y), C && (R.push(y + m), t.ordinal && m.indexOf(b) === 0 && R.push(y + m.replace(b, this.options.pluralSeparator)), p && R.push(y + x));
|
7456
7456
|
}
|
7457
7457
|
}
|
7458
|
-
let
|
7459
|
-
for (;
|
7460
|
-
this.isValidLookup(s) || (l =
|
7458
|
+
let M;
|
7459
|
+
for (; M = R.pop(); )
|
7460
|
+
this.isValidLookup(s) || (l = M, s = this.getResource(E, N, M, t));
|
7461
7461
|
}));
|
7462
7462
|
});
|
7463
7463
|
}), {
|
@@ -7784,9 +7784,9 @@ class Fi {
|
|
7784
7784
|
nestingSuffixEscaped: v,
|
7785
7785
|
nestingOptionsSeparator: N,
|
7786
7786
|
maxReplaces: E,
|
7787
|
-
alwaysFormat:
|
7787
|
+
alwaysFormat: R
|
7788
7788
|
} = e.interpolation;
|
7789
|
-
this.escape = t !== void 0 ? t : Oi, this.escapeValue = s !== void 0 ? s : !0, this.useRawValueToEscape = o !== void 0 ? o : !1, this.prefix = l ? $(l) : c || "{{", this.suffix = r ? $(r) : d || "}}", this.formatSeparator = g || ",", this.unescapePrefix = a ? "" : h || "-", this.unescapeSuffix = this.unescapePrefix ? "" : a || "", this.nestingPrefix = C ? $(C) : p || $("$t("), this.nestingSuffix = w ? $(w) : v || $(")"), this.nestingOptionsSeparator = N || ",", this.maxReplaces = E || 1e3, this.alwaysFormat =
|
7789
|
+
this.escape = t !== void 0 ? t : Oi, this.escapeValue = s !== void 0 ? s : !0, this.useRawValueToEscape = o !== void 0 ? o : !1, this.prefix = l ? $(l) : c || "{{", this.suffix = r ? $(r) : d || "}}", this.formatSeparator = g || ",", this.unescapePrefix = a ? "" : h || "-", this.unescapeSuffix = this.unescapePrefix ? "" : a || "", this.nestingPrefix = C ? $(C) : p || $("$t("), this.nestingSuffix = w ? $(w) : v || $(")"), this.nestingOptionsSeparator = N || ",", this.maxReplaces = E || 1e3, this.alwaysFormat = R !== void 0 ? R : !1, this.resetRegExp();
|
7790
7790
|
}
|
7791
7791
|
reset() {
|
7792
7792
|
this.options && this.init(this.options);
|
@@ -8567,7 +8567,7 @@ const g5 = (i, e) => {
|
|
8567
8567
|
} = t1(c5) || {}, l = t || s || a5();
|
8568
8568
|
if (l && !l.reportNamespaces && (l.reportNamespaces = new d5()), !l) {
|
8569
8569
|
L1("You will need to pass in an i18next instance by using initReactI18next");
|
8570
|
-
const m = (b,
|
8570
|
+
const m = (b, y) => K(y) ? y : e5(y) && K(y.defaultValue) ? y.defaultValue : Array.isArray(b) ? b[b.length - 1] : b, x = [m, {}, !1];
|
8571
8571
|
return x.t = m, x.i18n = {}, x.ready = !1, x;
|
8572
8572
|
}
|
8573
8573
|
l.options.react && l.options.react.wait !== void 0 && L1("It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");
|
@@ -8584,28 +8584,28 @@ const g5 = (i, e) => {
|
|
8584
8584
|
const a = (l.isInitialized || l.initializedStoreOnce) && g.every((m) => Xi(m, l, c)), h = u5(l, e.lng || null, c.nsMode === "fallback" ? g : g[0], d), C = () => h, p = () => Q1(l, e.lng || null, c.nsMode === "fallback" ? g : g[0], d), [w, v] = S(C);
|
8585
8585
|
let N = g.join();
|
8586
8586
|
e.lng && (N = `${e.lng}${N}`);
|
8587
|
-
const E = g5(N),
|
8587
|
+
const E = g5(N), R = N1(!0);
|
8588
8588
|
A(() => {
|
8589
8589
|
const {
|
8590
8590
|
bindI18n: m,
|
8591
8591
|
bindI18nStore: x
|
8592
8592
|
} = c;
|
8593
|
-
|
8594
|
-
|
8593
|
+
R.current = !0, !a && !r && (e.lng ? j1(l, e.lng, g, () => {
|
8594
|
+
R.current && v(p);
|
8595
8595
|
}) : W1(l, g, () => {
|
8596
|
-
|
8597
|
-
})), a && E && E !== N &&
|
8596
|
+
R.current && v(p);
|
8597
|
+
})), a && E && E !== N && R.current && v(p);
|
8598
8598
|
const b = () => {
|
8599
|
-
|
8599
|
+
R.current && v(p);
|
8600
8600
|
};
|
8601
8601
|
return m && l && l.on(m, b), x && l && l.store.on(x, b), () => {
|
8602
|
-
|
8602
|
+
R.current = !1, m && l && m.split(" ").forEach((y) => l.off(y, b)), x && l && x.split(" ").forEach((y) => l.store.off(y, b));
|
8603
8603
|
};
|
8604
8604
|
}, [l, N]), A(() => {
|
8605
|
-
|
8605
|
+
R.current && a && v(C);
|
8606
8606
|
}, [l, d, a]);
|
8607
|
-
const
|
8608
|
-
if (
|
8607
|
+
const M = [w, l, a];
|
8608
|
+
if (M.t = w, M.i18n = l, M.ready = a, a || !a && !r) return M;
|
8609
8609
|
throw new Promise((m) => {
|
8610
8610
|
e.lng ? j1(l, e.lng, g, () => m()) : W1(l, g, () => m());
|
8611
8611
|
});
|
@@ -8637,8 +8637,8 @@ const y5 = u1(
|
|
8637
8637
|
const { t: N } = C5("common", { lng: w }), E = Z(async () => {
|
8638
8638
|
p(!0);
|
8639
8639
|
try {
|
8640
|
-
const
|
8641
|
-
h(
|
8640
|
+
const M = await v.post("v1/countries/search");
|
8641
|
+
h(M == null ? void 0 : M.data.data);
|
8642
8642
|
} catch {
|
8643
8643
|
g([]);
|
8644
8644
|
} finally {
|
@@ -8649,8 +8649,8 @@ const y5 = u1(
|
|
8649
8649
|
E();
|
8650
8650
|
}, []), A(() => {
|
8651
8651
|
if (e) {
|
8652
|
-
const
|
8653
|
-
(x) => x.name.includes(
|
8652
|
+
const M = e.split("-")[1], m = a.filter(
|
8653
|
+
(x) => x.name.includes(M)
|
8654
8654
|
);
|
8655
8655
|
if (m.length) {
|
8656
8656
|
const x = m.map((b) => ({
|
@@ -8661,14 +8661,14 @@ const y5 = u1(
|
|
8661
8661
|
}
|
8662
8662
|
}
|
8663
8663
|
}, [e, a, s]), A(() => {
|
8664
|
-
const
|
8664
|
+
const M = a.map((m) => ({
|
8665
8665
|
label: m.name,
|
8666
8666
|
value: m.name
|
8667
8667
|
}));
|
8668
|
-
g(
|
8668
|
+
g(M);
|
8669
8669
|
}, [a]);
|
8670
|
-
const
|
8671
|
-
|
8670
|
+
const R = (M) => {
|
8671
|
+
M === null ? (s(""), t && t("")) : (s(M), t && t(""));
|
8672
8672
|
};
|
8673
8673
|
return /* @__PURE__ */ n("div", { className: "snmt-country-select", children: /* @__PURE__ */ n(
|
8674
8674
|
bi,
|
@@ -8678,7 +8678,7 @@ const y5 = u1(
|
|
8678
8678
|
placeholder: N("placeholder"),
|
8679
8679
|
value: o,
|
8680
8680
|
ref: r,
|
8681
|
-
onChange:
|
8681
|
+
onChange: R,
|
8682
8682
|
options: [{ label: "None", value: null }, ...d],
|
8683
8683
|
disabled: c,
|
8684
8684
|
isLoading: C
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "@snmt-react-ui/country-select",
|
3
3
|
"private": false,
|
4
|
-
"version": "2.3.
|
4
|
+
"version": "2.3.1",
|
5
5
|
"type": "module",
|
6
6
|
"main": "dist/country-select.js",
|
7
7
|
"types": "dist/index.d.ts",
|
@@ -18,7 +18,7 @@
|
|
18
18
|
"build": "tsc && vite build"
|
19
19
|
},
|
20
20
|
"dependencies": {
|
21
|
-
"@snmt-react-ui/city-select": "^2.3.
|
21
|
+
"@snmt-react-ui/city-select": "^2.3.1",
|
22
22
|
"@snmt-react-ui/core": "^2.1.0",
|
23
23
|
"@snmt-react-ui/flex": "^1.5.0",
|
24
24
|
"i18next": "^23.11.5",
|
@@ -27,5 +27,5 @@
|
|
27
27
|
"peerDependencies": {
|
28
28
|
"antd": "^5.18.3"
|
29
29
|
},
|
30
|
-
"gitHead": "
|
30
|
+
"gitHead": "87f6c40269debe98b4f49c9a61be7437ea9e38bd"
|
31
31
|
}
|