@snmt-react-ui/country-select 2.6.7 → 2.6.8
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 +117 -105
- package/package.json +3 -3
package/dist/country-select.js
CHANGED
@@ -5,7 +5,7 @@ import "./index.css";
|
|
5
5
|
import { jsx as o, Fragment as Y, jsxs as C } from "react/jsx-runtime";
|
6
6
|
import { SNMTUiContext as ue } from "@snmt-react-ui/core";
|
7
7
|
import { Select as Ce, Flex as pe, Avatar as fe, Checkbox as we, Typography as J1, Tag as me, Popover as ke } from "antd";
|
8
|
-
import { createContext as e1, forwardRef as m1, useState as V, useRef as l1, useEffect as A, useCallback as
|
8
|
+
import { createContext as e1, forwardRef as m1, useState as V, useRef as l1, useEffect as A, useCallback as D, useContext as J } from "react";
|
9
9
|
var Le = Object.defineProperty, ve = (i, e, t) => e in i ? Le(i, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[e] = t, Ne = (i, e, t) => ve(i, e + "", t), xe = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
|
10
10
|
function Re() {
|
11
11
|
if (console && console.warn) {
|
@@ -99,12 +99,12 @@ class Be {
|
|
99
99
|
});
|
100
100
|
}
|
101
101
|
}
|
102
|
-
const
|
102
|
+
const je = (i, e) => {
|
103
103
|
const t = l1();
|
104
104
|
return A(() => {
|
105
105
|
t.current = i;
|
106
106
|
}, [i, e]), t.current;
|
107
|
-
}, Q1 = (i, e, t, s) => i.getFixedT(e, t, s),
|
107
|
+
}, Q1 = (i, e, t, s) => i.getFixedT(e, t, s), Ze = (i, e, t, s) => D(Q1(i, e, t, s), [i, e, t, s]), De = function(i) {
|
108
108
|
let e = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
109
109
|
const {
|
110
110
|
i18n: t
|
@@ -128,10 +128,10 @@ const Ze = (i, e) => {
|
|
128
128
|
} = c;
|
129
129
|
let g = i;
|
130
130
|
g = U(g) ? [g] : g || ["translation"], r.reportNamespaces.addUsedNamespaces && r.reportNamespaces.addUsedNamespaces(g);
|
131
|
-
const l = (r.isInitialized || r.initializedStoreOnce) && g.every((f) => ye(f, r, c)), h =
|
131
|
+
const l = (r.isInitialized || r.initializedStoreOnce) && g.every((f) => ye(f, r, c)), h = Ze(r, e.lng || null, c.nsMode === "fallback" ? g : g[0], d), u = () => h, p = () => Q1(r, e.lng || null, c.nsMode === "fallback" ? g : g[0], d), [m, R] = V(u);
|
132
132
|
let w = g.join();
|
133
133
|
e.lng && (w = `${e.lng}${w}`);
|
134
|
-
const E =
|
134
|
+
const E = je(w), M = l1(!0);
|
135
135
|
A(() => {
|
136
136
|
const {
|
137
137
|
bindI18n: f,
|
@@ -151,8 +151,8 @@ const Ze = (i, e) => {
|
|
151
151
|
}, [r, w]), A(() => {
|
152
152
|
M.current && l && R(u);
|
153
153
|
}, [r, d, l]);
|
154
|
-
const
|
155
|
-
if (
|
154
|
+
const _ = [m, r, l];
|
155
|
+
if (_.t = m, _.i18n = r, _.ready = l, l || !l && !a) return _;
|
156
156
|
throw new Promise((f) => {
|
157
157
|
e.lng ? V1(r, e.lng, g, () => f()) : S1(r, g, () => f());
|
158
158
|
});
|
@@ -192,7 +192,7 @@ const Ze = (i, e) => {
|
|
192
192
|
}
|
193
193
|
);
|
194
194
|
};
|
195
|
-
var
|
195
|
+
var Z = /* @__PURE__ */ ((i) => (i.GREY_LIGHT_0 = "var(--grey-light-0)", i.GREY_LIGHT_1 = "var(--grey-light-1)", i.GREY_LIGHT_2 = "var(--grey-light-2)", i.GREY_LIGHT_3 = "var(--grey-light-3)", i.GREY_LIGHT_4 = "var(--grey-light-4)", i.GREY_DARK_1 = "var(--grey-dark-1)", i.GREY_DARK_2 = "var(--grey-dark-2)", i.GREY_DARK_3 = "var(--grey-dark-3)", i.GREY_DARK_4 = "var(--grey-dark-4)", i.GREY_DARK_5 = "var(--grey-dark-5)", i.BLUE_PRIMARY = "var(--blue-primary)", i.BLUE_HOVER = "var(--blue-hover)", i.BLUE_LIGHT_1 = "var(--blue-light-1)", i.BLUE_LIGHT_2 = "var(--blue-light-2)", i.BLUE_LIGHT_3 = "var(--blue-light-3)", i.BLUE_LIGHT_4 = "var(--blue-light-4)", i.BLUE_DARK_1 = "var(--blue-dark-1)", i.PURPLE_LIGHT = "var(--purple-light)", i.PURPLE_DARK = "var(--purple-dark)", i.NOTIFICATION_WARNING_LIGHT = "var(--notification-warning-light)", i.NOTIFICATION_WARNING_DARK = "var(--notification-warning-dark)", i.NOTIFICATION_SUCCESS_LIGHT = "var(--notification-success-light)", i.NOTIFICATION_SUCCESS_DARK = "var(--notification-success-dark)", i.NOTIFICATION_ERROR_LIGHT = "var(--notification-error-light)", i.NOTIFICATION_ERROR_DARK = "var(--notification-error-dark)", i.NOTIFICATION_ERROR_DARK_MODE = "var(--notification-error-dark-mode)", i))(Z || {});
|
196
196
|
const E1 = e1({
|
197
197
|
locale: "en",
|
198
198
|
theme: "light"
|
@@ -1977,7 +1977,7 @@ const Ke = ({
|
|
1977
1977
|
)
|
1978
1978
|
]
|
1979
1979
|
}
|
1980
|
-
),
|
1980
|
+
), jt = ({
|
1981
1981
|
className: i,
|
1982
1982
|
color: e = y.GREY_DARK_5,
|
1983
1983
|
height: t = 24,
|
@@ -2003,7 +2003,7 @@ const Ke = ({
|
|
2003
2003
|
}
|
2004
2004
|
)
|
2005
2005
|
}
|
2006
|
-
),
|
2006
|
+
), Zt = ({
|
2007
2007
|
className: i,
|
2008
2008
|
color: e = y.GREY_DARK_5,
|
2009
2009
|
height: t = 24,
|
@@ -2889,9 +2889,9 @@ const Ke = ({
|
|
2889
2889
|
case "warning":
|
2890
2890
|
return Bt({ width: e, height: t, color: l, className: a, onClick: h });
|
2891
2891
|
case "back":
|
2892
|
-
return Zt({ width: e, height: t, color: l, className: a, onClick: h });
|
2893
|
-
case "bell":
|
2894
2892
|
return jt({ width: e, height: t, color: l, className: a, onClick: h });
|
2893
|
+
case "bell":
|
2894
|
+
return Zt({ width: e, height: t, color: l, className: a, onClick: h });
|
2895
2895
|
case "contract":
|
2896
2896
|
return Wt({ width: e, height: t, color: l, className: a, onClick: h });
|
2897
2897
|
case "trash2":
|
@@ -4064,7 +4064,7 @@ const l2 = ({
|
|
4064
4064
|
}
|
4065
4065
|
)
|
4066
4066
|
}
|
4067
|
-
),
|
4067
|
+
), j2 = ({
|
4068
4068
|
width: i = 20,
|
4069
4069
|
height: e = 20,
|
4070
4070
|
color: t = "#F2F2F7",
|
@@ -4093,7 +4093,7 @@ const l2 = ({
|
|
4093
4093
|
)
|
4094
4094
|
]
|
4095
4095
|
}
|
4096
|
-
),
|
4096
|
+
), Z2 = ({
|
4097
4097
|
width: i = 20,
|
4098
4098
|
height: e = 20,
|
4099
4099
|
color: t = "#004ED7",
|
@@ -5589,7 +5589,7 @@ const l2 = ({
|
|
5589
5589
|
onClick: h
|
5590
5590
|
});
|
5591
5591
|
case "expandArrowIcon":
|
5592
|
-
return
|
5592
|
+
return j2({
|
5593
5593
|
width: e,
|
5594
5594
|
height: t,
|
5595
5595
|
color: l,
|
@@ -5597,7 +5597,7 @@ const l2 = ({
|
|
5597
5597
|
onClick: h
|
5598
5598
|
});
|
5599
5599
|
case "expandActiveArrowIcon":
|
5600
|
-
return
|
5600
|
+
return Z2({
|
5601
5601
|
width: e,
|
5602
5602
|
height: t,
|
5603
5603
|
color: l,
|
@@ -5870,49 +5870,49 @@ const Ii = ({
|
|
5870
5870
|
extraOptions: w,
|
5871
5871
|
dropdownRender: E,
|
5872
5872
|
optionRender: M,
|
5873
|
-
isLoading:
|
5873
|
+
isLoading: _,
|
5874
5874
|
readOnly: f,
|
5875
5875
|
error: x
|
5876
5876
|
}, L) => {
|
5877
|
-
const [v, B] = V(!1), [
|
5877
|
+
const [v, B] = V(!1), [G, t1] = V(!1), [$, h1] = V(!0), [I, K] = V(i), F = l1(null);
|
5878
5878
|
A(() => {
|
5879
|
-
|
5879
|
+
K(i);
|
5880
5880
|
}, [i]);
|
5881
5881
|
const q = (N) => {
|
5882
5882
|
B(N), u && u(N);
|
5883
|
-
}, c1 = (N,
|
5884
|
-
var
|
5885
|
-
return !!((
|
5883
|
+
}, c1 = (N, H) => {
|
5884
|
+
var j;
|
5885
|
+
return !!((j = H == null ? void 0 : H.label) != null && j.toString().toLowerCase().includes(N.toLowerCase()));
|
5886
5886
|
}, S = () => {
|
5887
5887
|
t1(!0);
|
5888
|
-
},
|
5888
|
+
}, P = () => {
|
5889
5889
|
t1(!1);
|
5890
|
-
}, T =
|
5890
|
+
}, T = D(
|
5891
5891
|
(N) => {
|
5892
|
-
if (
|
5893
|
-
const
|
5894
|
-
e == null || e(
|
5892
|
+
if (K(N), s) {
|
5893
|
+
const j = N;
|
5894
|
+
e == null || e(j);
|
5895
5895
|
return;
|
5896
5896
|
}
|
5897
|
-
const
|
5898
|
-
e == null || e(
|
5897
|
+
const H = N;
|
5898
|
+
e == null || e(H);
|
5899
5899
|
},
|
5900
5900
|
[s, e]
|
5901
|
-
), d1 =
|
5902
|
-
if (!f) {
|
5901
|
+
), d1 = D(() => {
|
5902
|
+
if (!(f || a)) {
|
5903
5903
|
if (s) {
|
5904
5904
|
T([]);
|
5905
5905
|
return;
|
5906
5906
|
}
|
5907
5907
|
T("");
|
5908
5908
|
}
|
5909
|
-
}, [T, s, f]), g1 =
|
5909
|
+
}, [a, T, s, f]), g1 = D(
|
5910
5910
|
(N) => {
|
5911
|
-
const
|
5912
|
-
T(
|
5911
|
+
const H = I.filter((j) => j !== N);
|
5912
|
+
T(H), K(H);
|
5913
5913
|
},
|
5914
5914
|
[T, I]
|
5915
|
-
), H1 =
|
5915
|
+
), H1 = D(
|
5916
5916
|
(N) => (I == null ? void 0 : I.indexOf(N)) === 0 ? (
|
5917
5917
|
// if the search input is empty
|
5918
5918
|
// then display the placeholder, else do not display it
|
@@ -5922,25 +5922,25 @@ const Ii = ({
|
|
5922
5922
|
), ae = (N) => {
|
5923
5923
|
N.preventDefault(), N.stopPropagation();
|
5924
5924
|
}, le = async (N) => {
|
5925
|
-
const { target:
|
5926
|
-
|
5927
|
-
}, L1 =
|
5925
|
+
const { target: H } = N;
|
5926
|
+
H.scrollTop + H.offsetHeight >= H.scrollHeight - l && (p == null || p(!0)), m && await m(N);
|
5927
|
+
}, L1 = D(
|
5928
5928
|
(N) => {
|
5929
|
-
var
|
5930
|
-
return ((
|
5929
|
+
var H, j;
|
5930
|
+
return ((H = r.find((v1) => v1.value === N)) == null ? void 0 : H.label) || ((j = w == null ? void 0 : w.find(
|
5931
5931
|
(v1) => v1.value === N
|
5932
|
-
)) == null ? void 0 :
|
5932
|
+
)) == null ? void 0 : j.label) || N;
|
5933
5933
|
},
|
5934
5934
|
[w, r]
|
5935
|
-
), he =
|
5935
|
+
), he = D(
|
5936
5936
|
(N) => {
|
5937
|
-
var
|
5937
|
+
var H;
|
5938
5938
|
return /* @__PURE__ */ o(
|
5939
5939
|
Ii,
|
5940
5940
|
{
|
5941
5941
|
values: N,
|
5942
5942
|
onTagClose: g1,
|
5943
|
-
maxWidth: ((
|
5943
|
+
maxWidth: ((H = F.current) == null ? void 0 : H.clientWidth) || 0,
|
5944
5944
|
disabled: a,
|
5945
5945
|
closable: !f,
|
5946
5946
|
options: r,
|
@@ -5949,15 +5949,15 @@ const Ii = ({
|
|
5949
5949
|
);
|
5950
5950
|
},
|
5951
5951
|
[a, w, g1, r, f]
|
5952
|
-
), ce =
|
5953
|
-
({ label: N, value:
|
5952
|
+
), ce = D(
|
5953
|
+
({ label: N, value: H, mode: j }) => j === "filter" ? H1(H) : /* @__PURE__ */ o("div", { onMouseDown: ae, className: "tag-wrapper", children: /* @__PURE__ */ o(te, { onClose: () => g1(H), disabled: a, children: typeof N == "object" ? N : L1(H) }) }),
|
5954
5954
|
[a, L1, g1, H1]
|
5955
5955
|
), _1 = Array.isArray(I) && I.length > 0 || !!I && typeof I == "string" && I.trim() !== "";
|
5956
5956
|
return /* @__PURE__ */ C("div", { className: "snmt-select-container", children: [
|
5957
5957
|
/* @__PURE__ */ C(
|
5958
5958
|
"div",
|
5959
5959
|
{
|
5960
|
-
className: `snmt-select-1-15-6 ${
|
5960
|
+
className: `snmt-select-1-15-6 ${G ? "snmt-select-focused" : ""}
|
5961
5961
|
${s ? "" : "snmt-select-single"} ${f ? "snmt-select-read-only" : ""}`,
|
5962
5962
|
ref: F,
|
5963
5963
|
style: { width: c },
|
@@ -5974,11 +5974,14 @@ const Ii = ({
|
|
5974
5974
|
onDropdownVisibleChange: q,
|
5975
5975
|
disabled: a,
|
5976
5976
|
value: I || void 0,
|
5977
|
-
labelRender: (N) =>
|
5977
|
+
labelRender: (N) => {
|
5978
|
+
const H = L1(N.value);
|
5979
|
+
return a ? /* @__PURE__ */ o("span", { style: { color: Z.GREY_DARK_2 }, children: H }) : H;
|
5980
|
+
},
|
5978
5981
|
mode: s === "filter" ? "multiple" : s,
|
5979
5982
|
onChange: T,
|
5980
5983
|
onFocus: S,
|
5981
|
-
onBlur:
|
5984
|
+
onBlur: P,
|
5982
5985
|
onSearch: (N) => {
|
5983
5986
|
h1(!N), h && h(N);
|
5984
5987
|
},
|
@@ -5988,26 +5991,35 @@ const Ii = ({
|
|
5988
5991
|
maxTagCount: "responsive",
|
5989
5992
|
maxTagPlaceholder: he,
|
5990
5993
|
onPopupScroll: le,
|
5991
|
-
prefix:
|
5994
|
+
prefix: _ && /* @__PURE__ */ o(A1, { size: 15 }),
|
5992
5995
|
suffixIcon: /* @__PURE__ */ o("div", { className: "wrapper-suffix-icon", children: s !== "filter" && /* @__PURE__ */ C(Y, { children: [
|
5993
|
-
I && !!I.length && (s || g) && /* @__PURE__ */ o(
|
5994
|
-
|
5996
|
+
I && !!I.length && (s || g) && /* @__PURE__ */ o(
|
5997
|
+
"div",
|
5995
5998
|
{
|
5996
|
-
|
5997
|
-
|
5999
|
+
onClick: d1,
|
6000
|
+
style: {
|
6001
|
+
cursor: a ? "not-allowed" : "pointer"
|
6002
|
+
},
|
6003
|
+
children: /* @__PURE__ */ o(
|
6004
|
+
i1,
|
6005
|
+
{
|
6006
|
+
name: "cancel",
|
6007
|
+
color: a ? Z.GREY_DARK_1 : Z.GREY_DARK_5
|
6008
|
+
}
|
6009
|
+
)
|
5998
6010
|
}
|
5999
|
-
)
|
6011
|
+
),
|
6000
6012
|
/* @__PURE__ */ o(
|
6001
6013
|
i1,
|
6002
6014
|
{
|
6003
6015
|
name: "selectArrowIcon",
|
6004
|
-
color: a ?
|
6016
|
+
color: a ? Z.GREY_DARK_1 : Z.GREY_DARK_5,
|
6005
6017
|
className: v ? "select-arrow-rotated" : "select-arrow",
|
6006
6018
|
onClick: () => B(!v)
|
6007
6019
|
}
|
6008
6020
|
)
|
6009
6021
|
] }) }),
|
6010
|
-
removeIcon: /* @__PURE__ */ o(i1, { name: "errorSmall", color:
|
6022
|
+
removeIcon: /* @__PURE__ */ o(i1, { name: "errorSmall", color: Z.GREY_DARK_2 }),
|
6011
6023
|
options: r,
|
6012
6024
|
optionRender: (N) => M ? M(N.data) : /* @__PURE__ */ C(n1, { justifyContent: "space-between", alignItems: "center", flex: "1", children: [
|
6013
6025
|
/* @__PURE__ */ C(n1, { alignItems: "center", gap: 12, children: [
|
@@ -6026,7 +6038,7 @@ const Ii = ({
|
|
6026
6038
|
i1,
|
6027
6039
|
{
|
6028
6040
|
name: "ok",
|
6029
|
-
color:
|
6041
|
+
color: Z.BLUE_PRIMARY,
|
6030
6042
|
width: 16,
|
6031
6043
|
height: 16
|
6032
6044
|
}
|
@@ -6034,7 +6046,7 @@ const Ii = ({
|
|
6034
6046
|
] }),
|
6035
6047
|
dropdownRender: (N) => /* @__PURE__ */ C("div", { className: "dropdown-container", children: [
|
6036
6048
|
/* @__PURE__ */ o("div", { className: "dropdown-menu", children: E ? E(N) : N }),
|
6037
|
-
|
6049
|
+
_ && /* @__PURE__ */ o("div", { className: "loading-overlay", children: /* @__PURE__ */ o(A1, { size: 28 }) })
|
6038
6050
|
] })
|
6039
6051
|
}
|
6040
6052
|
),
|
@@ -6042,14 +6054,14 @@ const Ii = ({
|
|
6042
6054
|
/* @__PURE__ */ o(
|
6043
6055
|
"label",
|
6044
6056
|
{
|
6045
|
-
className: `${
|
6057
|
+
className: `${G || _1 ? "label-floating" : ""} ${a ? "label-disabled" : ""} ${G ? "label-focused" : ""} ${_ ? "label-loading" : ""} ${x ? "label-error" : ""}`,
|
6046
6058
|
children: d ? `${t}*` : t
|
6047
6059
|
}
|
6048
6060
|
),
|
6049
6061
|
/* @__PURE__ */ o(
|
6050
6062
|
"fieldset",
|
6051
6063
|
{
|
6052
|
-
className: `${
|
6064
|
+
className: `${G ? "fieldset-focused" : ""} ${a ? "fieldset-disabled" : ""} ${_1 ? "fieldset-filled" : ""} ${x ? "fieldset-error" : ""}`,
|
6053
6065
|
children: /* @__PURE__ */ o("legend", { children: /* @__PURE__ */ o("span", { children: d ? `${t}*` : t }) })
|
6054
6066
|
}
|
6055
6067
|
)
|
@@ -6058,8 +6070,8 @@ const Ii = ({
|
|
6058
6070
|
}
|
6059
6071
|
),
|
6060
6072
|
x && /* @__PURE__ */ C(n1, { justifyContent: "flex-start", gap: 6, children: [
|
6061
|
-
/* @__PURE__ */ o(i1, { name: "attention", color:
|
6062
|
-
typeof x == "string" ? /* @__PURE__ */ o(Ei, { color:
|
6073
|
+
/* @__PURE__ */ o(i1, { name: "attention", color: Z.NOTIFICATION_ERROR_DARK }),
|
6074
|
+
typeof x == "string" ? /* @__PURE__ */ o(Ei, { color: Z.NOTIFICATION_ERROR_DARK, variant: "body4", children: x }) : x
|
6063
6075
|
] })
|
6064
6076
|
] });
|
6065
6077
|
}
|
@@ -6073,19 +6085,19 @@ const Ii = ({
|
|
6073
6085
|
i.forEach((s) => {
|
6074
6086
|
e[s] && (t[s] = e[s]);
|
6075
6087
|
});
|
6076
|
-
}, Vi = /###/g, B1 = (i) => i && i.indexOf("###") > -1 ? i.replace(Vi, ".") : i,
|
6088
|
+
}, Vi = /###/g, B1 = (i) => i && i.indexOf("###") > -1 ? i.replace(Vi, ".") : i, j1 = (i) => !i || k(i), r1 = (i, e, t) => {
|
6077
6089
|
const s = k(e) ? e.split(".") : e;
|
6078
6090
|
let n = 0;
|
6079
6091
|
for (; n < s.length - 1; ) {
|
6080
|
-
if (
|
6092
|
+
if (j1(i)) return {};
|
6081
6093
|
const r = B1(s[n]);
|
6082
6094
|
!i[r] && t && (i[r] = new t()), Object.prototype.hasOwnProperty.call(i, r) ? i = i[r] : i = {}, ++n;
|
6083
6095
|
}
|
6084
|
-
return
|
6096
|
+
return j1(i) ? {} : {
|
6085
6097
|
obj: i,
|
6086
6098
|
k: B1(s[n])
|
6087
6099
|
};
|
6088
|
-
},
|
6100
|
+
}, Z1 = (i, e, t) => {
|
6089
6101
|
const {
|
6090
6102
|
obj: s,
|
6091
6103
|
k: n
|
@@ -6127,8 +6139,8 @@ var Bi = {
|
|
6127
6139
|
"'": "'",
|
6128
6140
|
"/": "/"
|
6129
6141
|
};
|
6130
|
-
const
|
6131
|
-
class
|
6142
|
+
const ji = (i) => k(i) ? i.replace(/[&<>"'\/]/g, (e) => Bi[e]) : i;
|
6143
|
+
class Zi {
|
6132
6144
|
constructor(e) {
|
6133
6145
|
this.capacity = e, this.regExpMap = /* @__PURE__ */ new Map(), this.regExpQueue = [];
|
6134
6146
|
}
|
@@ -6140,7 +6152,7 @@ class ji {
|
|
6140
6152
|
return this.regExpQueue.length === this.capacity && this.regExpMap.delete(this.regExpQueue.shift()), this.regExpMap.set(e, s), this.regExpQueue.push(e), s;
|
6141
6153
|
}
|
6142
6154
|
}
|
6143
|
-
const Di = [" ", ",", "?", "!", ";"], Wi = new
|
6155
|
+
const Di = [" ", ",", "?", "!", ";"], Wi = new Zi(20), Gi = (i, e, t) => {
|
6144
6156
|
e = e || "", t = t || "";
|
6145
6157
|
const s = Di.filter((c) => e.indexOf(c) < 0 && t.indexOf(c) < 0);
|
6146
6158
|
if (s.length === 0) return !0;
|
@@ -6228,7 +6240,7 @@ class f1 {
|
|
6228
6240
|
return e = e || this.options, e.prefix = e.prefix || this.prefix, new f1(this.logger, e);
|
6229
6241
|
}
|
6230
6242
|
}
|
6231
|
-
var
|
6243
|
+
var W = new f1();
|
6232
6244
|
class k1 {
|
6233
6245
|
constructor() {
|
6234
6246
|
this.observers = {};
|
@@ -6292,7 +6304,7 @@ class D1 extends k1 {
|
|
6292
6304
|
};
|
6293
6305
|
const c = r.keySeparator !== void 0 ? r.keySeparator : this.options.keySeparator;
|
6294
6306
|
let a = [e, t];
|
6295
|
-
s && (a = a.concat(c ? s.split(c) : s)), e.indexOf(".") > -1 && (a = e.split("."), n = t, t = a[1]), this.addNamespaces(t),
|
6307
|
+
s && (a = a.concat(c ? s.split(c) : s)), e.indexOf(".") > -1 && (a = e.split("."), n = t, t = a[1]), this.addNamespaces(t), Z1(this.data, a, n), r.silent || this.emit("added", e, t, s, n);
|
6296
6308
|
}
|
6297
6309
|
addResources(e, t, s) {
|
6298
6310
|
let n = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {
|
@@ -6314,7 +6326,7 @@ class D1 extends k1 {
|
|
6314
6326
|
c.skipCopy || (s = JSON.parse(JSON.stringify(s))), n ? ie(d, s, r) : d = {
|
6315
6327
|
...d,
|
6316
6328
|
...s
|
6317
|
-
},
|
6329
|
+
}, Z1(this.data, a, d), c.silent || this.emit("added", e, t, s);
|
6318
6330
|
}
|
6319
6331
|
removeResourceBundle(e, t) {
|
6320
6332
|
this.hasResourceBundle(e, t) && delete this.data[e][t], this.removeNamespaces(t), this.emit("removed", e, t);
|
@@ -6353,7 +6365,7 @@ const W1 = {};
|
|
6353
6365
|
class w1 extends k1 {
|
6354
6366
|
constructor(e) {
|
6355
6367
|
let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
6356
|
-
super(), Si(["resourceStore", "languageUtils", "pluralResolver", "interpolator", "backendConnector", "i18nFormat", "utils"], e, this), this.options = t, this.options.keySeparator === void 0 && (this.options.keySeparator = "."), this.logger =
|
6368
|
+
super(), Si(["resourceStore", "languageUtils", "pluralResolver", "interpolator", "backendConnector", "i18nFormat", "utils"], e, this), this.options = t, this.options.keySeparator === void 0 && (this.options.keySeparator = "."), this.logger = W.create("translator");
|
6357
6369
|
}
|
6358
6370
|
changeLanguage(e) {
|
6359
6371
|
e && (this.language = e);
|
@@ -6420,8 +6432,8 @@ class w1 extends k1 {
|
|
6420
6432
|
}
|
6421
6433
|
const h = this.resolve(e, t);
|
6422
6434
|
let u = h && h.res;
|
6423
|
-
const p = h && h.usedKey || c, m = h && h.exactUsedKey || c, R = Object.prototype.toString.apply(u), w = ["[object Number]", "[object Function]", "[object RegExp]"], E = t.joinArrays !== void 0 ? t.joinArrays : this.options.joinArrays, M = !this.i18nFormat || this.i18nFormat.handleAsObject,
|
6424
|
-
if (M && u &&
|
6435
|
+
const p = h && h.usedKey || c, m = h && h.exactUsedKey || c, R = Object.prototype.toString.apply(u), w = ["[object Number]", "[object Function]", "[object RegExp]"], E = t.joinArrays !== void 0 ? t.joinArrays : this.options.joinArrays, M = !this.i18nFormat || this.i18nFormat.handleAsObject, _ = !k(u) && typeof u != "boolean" && typeof u != "number";
|
6436
|
+
if (M && u && _ && w.indexOf(R) < 0 && !(k(E) && Array.isArray(u))) {
|
6425
6437
|
if (!t.returnObjects && !this.options.returnObjects) {
|
6426
6438
|
this.options.returnedObjectHandler || this.logger.warn("accessing an object - but returnObjects options is not enabled!");
|
6427
6439
|
const f = this.options.returnedObjectHandler ? this.options.returnedObjectHandler(p, u, {
|
@@ -6447,13 +6459,13 @@ class w1 extends k1 {
|
|
6447
6459
|
u = u.join(E), u && (u = this.extendTranslation(u, e, t, s));
|
6448
6460
|
else {
|
6449
6461
|
let f = !1, x = !1;
|
6450
|
-
const L = t.count !== void 0 && !k(t.count), v = w1.hasDefaultValue(t), B = L ? this.pluralResolver.getSuffix(g, t.count, t) : "",
|
6462
|
+
const L = t.count !== void 0 && !k(t.count), v = w1.hasDefaultValue(t), B = L ? this.pluralResolver.getSuffix(g, t.count, t) : "", G = t.ordinal && L ? this.pluralResolver.getSuffix(g, t.count, {
|
6451
6463
|
ordinal: !1
|
6452
|
-
}) : "", t1 = L && !t.ordinal && t.count === 0 && this.pluralResolver.shouldUseIntlApi(), $ = t1 && t[`defaultValue${this.options.pluralSeparator}zero`] || t[`defaultValue${B}`] || t[`defaultValue${
|
6464
|
+
}) : "", t1 = L && !t.ordinal && t.count === 0 && this.pluralResolver.shouldUseIntlApi(), $ = t1 && t[`defaultValue${this.options.pluralSeparator}zero`] || t[`defaultValue${B}`] || t[`defaultValue${G}`] || t.defaultValue;
|
6453
6465
|
!this.isValidLookup(u) && v && (f = !0, u = $), this.isValidLookup(u) || (x = !0, u = c);
|
6454
|
-
const I = (t.missingKeyNoValueFallbackToKey || this.options.missingKeyNoValueFallbackToKey) && x ? void 0 : u,
|
6455
|
-
if (x || f ||
|
6456
|
-
if (this.logger.log(
|
6466
|
+
const I = (t.missingKeyNoValueFallbackToKey || this.options.missingKeyNoValueFallbackToKey) && x ? void 0 : u, K = v && $ !== u && this.options.updateMissing;
|
6467
|
+
if (x || f || K) {
|
6468
|
+
if (this.logger.log(K ? "updateKey" : "missingKey", g, d, c, K ? $ : u), r) {
|
6457
6469
|
const S = this.resolve(c, {
|
6458
6470
|
...t,
|
6459
6471
|
keySeparator: !1
|
@@ -6466,13 +6478,13 @@ class w1 extends k1 {
|
|
6466
6478
|
for (let S = 0; S < q.length; S++)
|
6467
6479
|
F.push(q[S]);
|
6468
6480
|
else this.options.saveMissingTo === "all" ? F = this.languageUtils.toResolveHierarchy(t.lng || this.language) : F.push(t.lng || this.language);
|
6469
|
-
const c1 = (S,
|
6481
|
+
const c1 = (S, P, T) => {
|
6470
6482
|
const d1 = v && T !== u ? T : I;
|
6471
|
-
this.options.missingKeyHandler ? this.options.missingKeyHandler(S, d,
|
6483
|
+
this.options.missingKeyHandler ? this.options.missingKeyHandler(S, d, P, d1, K, t) : this.backendConnector && this.backendConnector.saveMissing && this.backendConnector.saveMissing(S, d, P, d1, K, t), this.emit("missingKey", S, d, P, u);
|
6472
6484
|
};
|
6473
6485
|
this.options.saveMissing && (this.options.saveMissingPlurals && L ? F.forEach((S) => {
|
6474
|
-
const
|
6475
|
-
t1 && t[`defaultValue${this.options.pluralSeparator}zero`] &&
|
6486
|
+
const P = this.pluralResolver.getSuffixes(S, t);
|
6487
|
+
t1 && t[`defaultValue${this.options.pluralSeparator}zero`] && P.indexOf(`${this.options.pluralSeparator}zero`) < 0 && P.push(`${this.options.pluralSeparator}zero`), P.forEach((T) => {
|
6476
6488
|
c1([S], c + T, t[`defaultValue${T}`] || $);
|
6477
6489
|
});
|
6478
6490
|
}) : c1(F, c, $));
|
@@ -6552,9 +6564,9 @@ class w1 extends k1 {
|
|
6552
6564
|
M.push(v), u && (M.push(v + f), t.ordinal && f.indexOf(L) === 0 && M.push(v + f.replace(L, this.options.pluralSeparator)), p && M.push(v + x));
|
6553
6565
|
}
|
6554
6566
|
}
|
6555
|
-
let
|
6556
|
-
for (;
|
6557
|
-
this.isValidLookup(s) || (r =
|
6567
|
+
let _;
|
6568
|
+
for (; _ = M.pop(); )
|
6569
|
+
this.isValidLookup(s) || (r = _, s = this.getResource(E, w, _, t));
|
6558
6570
|
}));
|
6559
6571
|
});
|
6560
6572
|
}), {
|
@@ -6599,7 +6611,7 @@ class w1 extends k1 {
|
|
6599
6611
|
const N1 = (i) => i.charAt(0).toUpperCase() + i.slice(1);
|
6600
6612
|
class G1 {
|
6601
6613
|
constructor(e) {
|
6602
|
-
this.options = e, this.supportedLngs = this.options.supportedLngs || !1, this.logger =
|
6614
|
+
this.options = e, this.supportedLngs = this.options.supportedLngs || !1, this.logger = W.create("languageUtils");
|
6603
6615
|
}
|
6604
6616
|
getScriptPartFromCode(e) {
|
6605
6617
|
if (e = p1(e), !e || e.indexOf("-") < 0) return null;
|
@@ -6799,7 +6811,7 @@ const Fi = ["v1", "v2", "v3"], Yi = ["v4"], K1 = {
|
|
6799
6811
|
class zi {
|
6800
6812
|
constructor(e) {
|
6801
6813
|
let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
6802
|
-
this.languageUtils = e, this.options = t, this.logger =
|
6814
|
+
this.languageUtils = e, this.options = t, this.logger = W.create("pluralResolver"), (!this.options.compatibilityJSON || Yi.includes(this.options.compatibilityJSON)) && (typeof Intl > "u" || !Intl.PluralRules) && (this.options.compatibilityJSON = "v3", this.logger.error("Your environment seems not to be Intl API compatible, use an Intl.PluralRules polyfill. Will fallback to the compatibilityJSON v3 format handling.")), this.rules = Ui(), this.pluralRulesCache = {};
|
6803
6815
|
}
|
6804
6816
|
addRule(e, t) {
|
6805
6817
|
this.rules[e] = t;
|
@@ -6867,7 +6879,7 @@ const P1 = function(i, e, t) {
|
|
6867
6879
|
class Ji {
|
6868
6880
|
constructor() {
|
6869
6881
|
let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
6870
|
-
this.logger =
|
6882
|
+
this.logger = W.create("interpolator"), this.options = e, this.format = e.interpolation && e.interpolation.format || ((t) => t), this.init(e);
|
6871
6883
|
}
|
6872
6884
|
init() {
|
6873
6885
|
let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
@@ -6893,7 +6905,7 @@ class Ji {
|
|
6893
6905
|
maxReplaces: E,
|
6894
6906
|
alwaysFormat: M
|
6895
6907
|
} = e.interpolation;
|
6896
|
-
this.escape = t !== void 0 ? t :
|
6908
|
+
this.escape = t !== void 0 ? t : ji, this.escapeValue = s !== void 0 ? s : !0, this.useRawValueToEscape = n !== void 0 ? n : !1, this.prefix = r ? Q(r) : c || "{{", this.suffix = a ? Q(a) : d || "}}", this.formatSeparator = g || ",", this.unescapePrefix = l ? "" : h || "-", this.unescapeSuffix = this.unescapePrefix ? "" : l || "", this.nestingPrefix = u ? Q(u) : p || Q("$t("), this.nestingSuffix = m ? Q(m) : R || Q(")"), this.nestingOptionsSeparator = w || ",", this.maxReplaces = E || 1e3, this.alwaysFormat = M !== void 0 ? M : !1, this.resetRegExp();
|
6897
6909
|
}
|
6898
6910
|
reset() {
|
6899
6911
|
this.options && this.init(this.options);
|
@@ -7022,7 +7034,7 @@ const qi = (i) => {
|
|
7022
7034
|
class Qi {
|
7023
7035
|
constructor() {
|
7024
7036
|
let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
7025
|
-
this.logger =
|
7037
|
+
this.logger = W.create("formatter"), this.options = e, this.formats = {
|
7026
7038
|
number: X((t, s) => {
|
7027
7039
|
const n = new Intl.NumberFormat(t, {
|
7028
7040
|
...s
|
@@ -7105,7 +7117,7 @@ const Xi = (i, e) => {
|
|
7105
7117
|
class e5 extends k1 {
|
7106
7118
|
constructor(e, t, s) {
|
7107
7119
|
let n = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {};
|
7108
|
-
super(), this.backend = e, this.store = t, this.services = s, this.languageUtils = s.languageUtils, this.options = n, this.logger =
|
7120
|
+
super(), this.backend = e, this.store = t, this.services = s, this.languageUtils = s.languageUtils, this.options = n, this.logger = W.create("backendConnector"), this.waitingReads = [], this.maxParallelReads = n.maxParallelReads || 10, this.readingCalls = 0, this.maxRetries = n.maxRetries >= 0 ? n.maxRetries : 5, this.retryTimeout = n.retryTimeout >= 1 ? n.retryTimeout : 350, this.state = {}, this.queue = [], this.backend && this.backend.init && this.backend.init(s, n.backend, n);
|
7109
7121
|
}
|
7110
7122
|
queueLoad(e, t, s, n) {
|
7111
7123
|
const r = {}, c = {}, a = {}, d = {};
|
@@ -7302,7 +7314,7 @@ const $1 = () => ({
|
|
7302
7314
|
class a1 extends k1 {
|
7303
7315
|
constructor() {
|
7304
7316
|
let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, t = arguments.length > 1 ? arguments[1] : void 0;
|
7305
|
-
if (super(), this.options = F1(e), this.services = {}, this.logger =
|
7317
|
+
if (super(), this.options = F1(e), this.services = {}, this.logger = W, this.modules = {
|
7306
7318
|
external: []
|
7307
7319
|
}, t5(this), t && !this.isInitialized && !e.isClone) {
|
7308
7320
|
if (!this.options.initImmediate)
|
@@ -7327,13 +7339,13 @@ class a1 extends k1 {
|
|
7327
7339
|
}), t.keySeparator !== void 0 && (this.options.userDefinedKeySeparator = t.keySeparator), t.nsSeparator !== void 0 && (this.options.userDefinedNsSeparator = t.nsSeparator);
|
7328
7340
|
const r = (l) => l ? typeof l == "function" ? new l() : l : null;
|
7329
7341
|
if (!this.options.isClone) {
|
7330
|
-
this.modules.logger ?
|
7342
|
+
this.modules.logger ? W.init(r(this.modules.logger), this.options) : W.init(null, this.options);
|
7331
7343
|
let l;
|
7332
7344
|
this.modules.formatter ? l = this.modules.formatter : typeof Intl < "u" && (l = Qi);
|
7333
7345
|
const h = new G1(this.options);
|
7334
7346
|
this.store = new D1(this.options.resources, this.options);
|
7335
7347
|
const u = this.services;
|
7336
|
-
u.logger =
|
7348
|
+
u.logger = W, u.resourceStore = this.store, u.languageUtils = h, u.pluralResolver = new zi(h, {
|
7337
7349
|
prepend: this.options.pluralSeparator,
|
7338
7350
|
compatibilityJSON: this.options.compatibilityJSON,
|
7339
7351
|
simplifyPluralSuffix: this.options.simplifyPluralSuffix
|
@@ -7664,7 +7676,7 @@ const w5 = (i, e) => {
|
|
7664
7676
|
return A(() => {
|
7665
7677
|
t.current = i;
|
7666
7678
|
}, [i, e]), t.current;
|
7667
|
-
}, re = (i, e, t, s) => i.getFixedT(e, t, s), m5 = (i, e, t, s) =>
|
7679
|
+
}, re = (i, e, t, s) => i.getFixedT(e, t, s), m5 = (i, e, t, s) => D(re(i, e, t, s), [i, e, t, s]), k5 = function(i) {
|
7668
7680
|
let e = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
7669
7681
|
const {
|
7670
7682
|
i18n: t
|
@@ -7711,8 +7723,8 @@ const w5 = (i, e) => {
|
|
7711
7723
|
}, [r, w]), A(() => {
|
7712
7724
|
M.current && l && R(u);
|
7713
7725
|
}, [r, d, l]);
|
7714
|
-
const
|
7715
|
-
if (
|
7726
|
+
const _ = [m, r, l];
|
7727
|
+
if (_.t = m, _.i18n = r, _.ready = l, l || !l && !a) return _;
|
7716
7728
|
throw new Promise((f) => {
|
7717
7729
|
e.lng ? z1(r, e.lng, g, () => f()) : U1(r, g, () => f());
|
7718
7730
|
});
|
@@ -7752,7 +7764,7 @@ const I5 = m1(
|
|
7752
7764
|
`CountrySelect requires "axiosPeople" to fetch counties.
|
7753
7765
|
Please provide it via SNMTUiContext.`
|
7754
7766
|
);
|
7755
|
-
const { t:
|
7767
|
+
const { t: _ } = k5("common", { lng: E }), f = D(async () => {
|
7756
7768
|
w(!0);
|
7757
7769
|
try {
|
7758
7770
|
const L = await M.post("v1/countries/search");
|
@@ -7771,9 +7783,9 @@ const I5 = m1(
|
|
7771
7783
|
(B) => B.name.includes(L)
|
7772
7784
|
);
|
7773
7785
|
if (v.length) {
|
7774
|
-
const B = v.map((
|
7775
|
-
label:
|
7776
|
-
value:
|
7786
|
+
const B = v.map((G) => ({
|
7787
|
+
label: G.name,
|
7788
|
+
value: G.name
|
7777
7789
|
}));
|
7778
7790
|
s(B[0].value);
|
7779
7791
|
}
|
@@ -7793,7 +7805,7 @@ const I5 = m1(
|
|
7793
7805
|
{
|
7794
7806
|
id: r,
|
7795
7807
|
width: i,
|
7796
|
-
placeholder:
|
7808
|
+
placeholder: _("placeholder"),
|
7797
7809
|
value: n,
|
7798
7810
|
ref: l,
|
7799
7811
|
onChange: x,
|
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.6.
|
4
|
+
"version": "2.6.8",
|
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.6.
|
21
|
+
"@snmt-react-ui/city-select": "^2.6.8",
|
22
22
|
"@snmt-react-ui/core": "^2.2.0",
|
23
23
|
"@snmt-react-ui/flex": "^1.5.1",
|
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": "80d3cbe0d67b94370191b14fa1618cdf126ece68"
|
31
31
|
}
|