@snmt-react-ui/city-select 2.5.0 → 2.5.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.
Files changed (2) hide show
  1. package/dist/city-select.js +156 -154
  2. package/package.json +3 -3
@@ -4,7 +4,7 @@ var H1 = (i, e, t) => de(i, typeof e != "symbol" ? e + "" : e, t);
4
4
  import "./index.css";
5
5
  import { jsx as o, Fragment as n1, jsxs as u } from "react/jsx-runtime";
6
6
  import { SNMTUiContext as ge } from "@snmt-react-ui/core";
7
- import { createContext as o1, forwardRef as m1, useState as O, useRef as X, useEffect as B, useCallback as W, useImperativeHandle as ue, useContext as e1 } from "react";
7
+ import { createContext as o1, forwardRef as m1, useState as S, useRef as X, useEffect as B, useCallback as Z, useImperativeHandle as ue, useContext as e1 } from "react";
8
8
  import { Select as Ce, Flex as pe, Avatar as fe, Checkbox as we, Typography as me, Tag as ke, Popover as Le } from "antd";
9
9
  var ve = Object.defineProperty, Ne = (i, e, t) => e in i ? ve(i, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[e] = t, xe = (i, e, t) => Ne(i, e + "", t), Re = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
10
10
  function Me() {
@@ -88,8 +88,8 @@ let Se = {
88
88
  };
89
89
  const Oe = () => Se;
90
90
  let Ae;
91
- const Be = () => Ae, Ze = o1();
92
- class We {
91
+ const Be = () => Ae, We = o1();
92
+ class Ze {
93
93
  constructor() {
94
94
  xe(this, "getUsedNamespaces", () => Object.keys(this.usedNamespaces)), this.usedNamespaces = {};
95
95
  }
@@ -104,15 +104,15 @@ const je = (i, e) => {
104
104
  return B(() => {
105
105
  t.current = i;
106
106
  }, [i, e]), t.current;
107
- }, q1 = (i, e, t, s) => i.getFixedT(e, t, s), Te = (i, e, t, s) => W(q1(i, e, t, s), [i, e, t, s]), De = function(i) {
107
+ }, q1 = (i, e, t, s) => i.getFixedT(e, t, s), Te = (i, e, t, s) => Z(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
111
111
  } = e, {
112
112
  i18n: s,
113
113
  defaultNS: n
114
- } = e1(Ze) || {}, l = t || s || Be();
115
- if (l && !l.reportNamespaces && (l.reportNamespaces = new We()), !l) {
114
+ } = e1(We) || {}, l = t || s || Be();
115
+ if (l && !l.reportNamespaces && (l.reportNamespaces = new Ze()), !l) {
116
116
  R1("You will need to pass in an i18next instance by using initReactI18next");
117
117
  const f = (b, R) => q(R) ? R : Ee(R) && q(R.defaultValue) ? R.defaultValue : Array.isArray(b) ? b[b.length - 1] : b, w = [f, {}, !1];
118
118
  return w.t = f, w.i18n = {}, w.ready = !1, w;
@@ -128,7 +128,7 @@ const je = (i, e) => {
128
128
  } = c;
129
129
  let g = i;
130
130
  g = q(g) ? [g] : g || ["translation"], l.reportNamespaces.addUsedNamespaces && l.reportNamespaces.addUsedNamespaces(g);
131
- const a = (l.isInitialized || l.initializedStoreOnce) && g.every((f) => be(f, l, c)), h = Te(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), [m, v] = O(C);
131
+ const a = (l.isInitialized || l.initializedStoreOnce) && g.every((f) => be(f, l, c)), h = Te(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), [m, v] = S(C);
132
132
  let k = g.join();
133
133
  e.lng && (k = `${e.lng}${k}`);
134
134
  const E = je(k), N = X(!0);
@@ -206,7 +206,7 @@ const Ke = ({
206
206
  disabled: n = !1,
207
207
  disableUncheck: l = !1
208
208
  }) => {
209
- const [c, r] = O(i), [d, g] = O(e);
209
+ const [c, r] = S(i), [d, g] = S(e);
210
210
  B(() => {
211
211
  r(i), g(e);
212
212
  }, [i, e]);
@@ -1916,7 +1916,7 @@ const Pe = ({
1916
1916
  }
1917
1917
  )
1918
1918
  }
1919
- ), Zt = ({
1919
+ ), Wt = ({
1920
1920
  className: i,
1921
1921
  color: e = M.GREY_DARK_5,
1922
1922
  height: t = 20,
@@ -1943,7 +1943,7 @@ const Pe = ({
1943
1943
  }
1944
1944
  )
1945
1945
  }
1946
- ), Wt = ({
1946
+ ), Zt = ({
1947
1947
  className: i,
1948
1948
  color: e = M.GREY_DARK_5,
1949
1949
  height: t = 5,
@@ -3283,7 +3283,7 @@ const Pe = ({
3283
3283
  disabled: l = !1,
3284
3284
  onClick: c
3285
3285
  }) => {
3286
- const [r, d] = O(n), { theme: g } = e1(Q1), a = l ? g && g === "dark" ? M.GREY_LIGHT_4 : M.GREY_DARK_1 : s, h = l ? void 0 : c;
3286
+ const [r, d] = S(n), { theme: g } = e1(Q1), a = l ? g && g === "dark" ? M.GREY_LIGHT_4 : M.GREY_DARK_1 : s, h = l ? void 0 : c;
3287
3287
  return B(() => {
3288
3288
  if (n) {
3289
3289
  h && !l && d(`${n} clickable`);
@@ -3295,7 +3295,7 @@ const Pe = ({
3295
3295
  case "nextIcon":
3296
3296
  return Bt({ width: e, height: t, color: a, className: r, onClick: h });
3297
3297
  case "prevIcon":
3298
- return Zt({ width: e, height: t, color: a, className: r, onClick: h });
3298
+ return Wt({ width: e, height: t, color: a, className: r, onClick: h });
3299
3299
  case "arrowUp":
3300
3300
  return Pe({ width: e, height: t, color: a, className: r, onClick: h });
3301
3301
  case "arrowDown":
@@ -3463,7 +3463,7 @@ const Pe = ({
3463
3463
  case "arrowUpFilled":
3464
3464
  return jt({ width: e, height: t, color: a, className: r, onClick: h });
3465
3465
  case "arrowDownFilled":
3466
- return Wt({ width: e, height: t, color: a, className: r, onClick: h });
3466
+ return Zt({ width: e, height: t, color: a, className: r, onClick: h });
3467
3467
  case "link":
3468
3468
  return Tt({ width: e, height: t, color: a, className: r, onClick: h });
3469
3469
  case "telegram":
@@ -4031,7 +4031,7 @@ const R2 = ({
4031
4031
  )
4032
4032
  ] })
4033
4033
  }
4034
- ), Z2 = ({
4034
+ ), W2 = ({
4035
4035
  width: i = 16,
4036
4036
  height: e = 16,
4037
4037
  color: t = "#001E52",
@@ -4067,7 +4067,7 @@ const R2 = ({
4067
4067
  )
4068
4068
  ]
4069
4069
  }
4070
- ), W2 = ({
4070
+ ), Z2 = ({
4071
4071
  width: i = 11,
4072
4072
  height: e = 32,
4073
4073
  color: t = "#001E52",
@@ -6043,7 +6043,7 @@ const R2 = ({
6043
6043
  )
6044
6044
  ]
6045
6045
  }
6046
- ), Z5 = ({
6046
+ ), W5 = ({
6047
6047
  className: i,
6048
6048
  color: e = y.GREY_DARK_5,
6049
6049
  height: t = 24,
@@ -6092,7 +6092,7 @@ const R2 = ({
6092
6092
  )
6093
6093
  ]
6094
6094
  }
6095
- ), W5 = ({
6095
+ ), Z5 = ({
6096
6096
  className: i,
6097
6097
  color: e = y.GREY_DARK_5,
6098
6098
  height: t = 24,
@@ -6633,7 +6633,7 @@ const R2 = ({
6633
6633
  disabled: l = !1,
6634
6634
  onClick: c
6635
6635
  }) => {
6636
- const [r, d] = O(n), { theme: g } = e1(X1), a = l ? g && g === "dark" ? y.GREY_LIGHT_4 : y.GREY_DARK_1 : s, h = l ? void 0 : c;
6636
+ const [r, d] = S(n), { theme: g } = e1(X1), a = l ? g && g === "dark" ? y.GREY_LIGHT_4 : y.GREY_DARK_1 : s, h = l ? void 0 : c;
6637
6637
  return B(() => {
6638
6638
  if (n) {
6639
6639
  h && !l && d(`${n} clickable`);
@@ -6673,9 +6673,9 @@ const R2 = ({
6673
6673
  case "plus":
6674
6674
  return B2({ width: e, height: t, color: a, className: r, onClick: h });
6675
6675
  case "time":
6676
- return Z2({ width: e, height: t, color: a, className: r, onClick: h });
6676
+ return W2({ width: e, height: t, color: a, className: r, onClick: h });
6677
6677
  case "arrowDownLong":
6678
- return W2({
6678
+ return Z2({
6679
6679
  width: e,
6680
6680
  height: t,
6681
6681
  color: a,
@@ -6849,9 +6849,9 @@ const R2 = ({
6849
6849
  case "settings2":
6850
6850
  return B5({ width: e, height: t, color: a, className: r, onClick: h });
6851
6851
  case "image":
6852
- return Z5({ width: e, height: t, color: a, className: r, onClick: h });
6853
- case "upload":
6854
6852
  return W5({ width: e, height: t, color: a, className: r, onClick: h });
6853
+ case "upload":
6854
+ return Z5({ width: e, height: t, color: a, className: r, onClick: h });
6855
6855
  case "edit":
6856
6856
  return j5({ width: e, height: t, color: a, className: r, onClick: h });
6857
6857
  case "location":
@@ -6939,7 +6939,7 @@ const ee = ({
6939
6939
  placement: n = "topRight",
6940
6940
  noPadding: l = !1
6941
6941
  }) => {
6942
- const [c, r] = O(!1);
6942
+ const [c, r] = S(!1);
6943
6943
  return /* @__PURE__ */ o(
6944
6944
  Le,
6945
6945
  {
@@ -6976,7 +6976,7 @@ const n3 = ({
6976
6976
  options: l,
6977
6977
  extraOptions: c
6978
6978
  }) => {
6979
- const { locale: r } = e1(E1), { t: d } = De("common", { lng: r }), [g, a] = O(!1);
6979
+ const { locale: r } = e1(E1), { t: d } = De("common", { lng: r }), [g, a] = S(!1);
6980
6980
  if (B(() => {
6981
6981
  i.length || a(!1);
6982
6982
  }, [i]), !i.length)
@@ -7043,31 +7043,31 @@ const n3 = ({
7043
7043
  isLoading: _,
7044
7044
  readOnly: f
7045
7045
  }, w) => {
7046
- const [b, R] = O(!1), [K, j] = O(!1), [F, T] = O(!0), [Z, Y] = O(i), D = X(null);
7046
+ const [b, R] = S(!1), [D, Y] = S(!1), [G, j] = S(!0), [W, U] = S(i), P = X(null);
7047
7047
  B(() => {
7048
- Y(i);
7048
+ U(i);
7049
7049
  }, [i]);
7050
- const V = (x) => {
7050
+ const F = (x) => {
7051
7051
  R(x), C && C(x);
7052
- }, $ = (x, H) => {
7053
- var G;
7054
- return !!((G = H == null ? void 0 : H.label) != null && G.toString().toLowerCase().includes(x.toLowerCase()));
7052
+ }, V = (x, H) => {
7053
+ var K;
7054
+ return !!((K = H == null ? void 0 : H.label) != null && K.toString().toLowerCase().includes(x.toLowerCase()));
7055
7055
  }, t1 = () => {
7056
- j(!0);
7057
- }, S = () => {
7058
- j(!1);
7059
- }, I = W(
7056
+ Y(!0);
7057
+ }, O = () => {
7058
+ Y(!1);
7059
+ }, I = Z(
7060
7060
  (x) => {
7061
- if (Y(x), s) {
7062
- const G = x;
7063
- e == null || e(G);
7061
+ if (U(x), s) {
7062
+ const K = x;
7063
+ e == null || e(K);
7064
7064
  return;
7065
7065
  }
7066
7066
  const H = x;
7067
7067
  e == null || e(H);
7068
7068
  },
7069
7069
  [s, e]
7070
- ), U = W(() => {
7070
+ ), T = Z(() => {
7071
7071
  if (!f) {
7072
7072
  if (s) {
7073
7073
  I([]);
@@ -7075,33 +7075,33 @@ const n3 = ({
7075
7075
  }
7076
7076
  I("");
7077
7077
  }
7078
- }, [I, s, f]), z = W(
7078
+ }, [I, s, f]), z = Z(
7079
7079
  (x) => {
7080
- const H = Z.filter((G) => G !== x);
7081
- I(H), Y(H);
7080
+ const H = W.filter((K) => K !== x);
7081
+ I(H), U(H);
7082
7082
  },
7083
- [I, Z]
7084
- ), _1 = W(
7085
- (x) => (Z == null ? void 0 : Z.indexOf(x)) === 0 ? (
7083
+ [I, W]
7084
+ ), _1 = Z(
7085
+ (x) => (W == null ? void 0 : W.indexOf(x)) === 0 ? (
7086
7086
  // if the search input is empty
7087
7087
  // then display the placeholder, else do not display it
7088
- /* @__PURE__ */ o("span", { className: "custom-placeholder", children: F ? t : "" })
7088
+ /* @__PURE__ */ o("span", { className: "custom-placeholder", children: G ? t : "" })
7089
7089
  ) : /* @__PURE__ */ o(n1, {}),
7090
- [F, Z, t]
7090
+ [G, W, t]
7091
7091
  ), re = (x) => {
7092
7092
  x.preventDefault(), x.stopPropagation();
7093
7093
  }, le = async (x) => {
7094
7094
  const { target: H } = x;
7095
7095
  H.scrollTop + H.offsetHeight >= H.scrollHeight - a && (p == null || p(!0)), m && await m(x);
7096
- }, L1 = W(
7096
+ }, L1 = Z(
7097
7097
  (x) => {
7098
- var H, G;
7099
- return ((H = l.find((v1) => v1.value === x)) == null ? void 0 : H.label) || ((G = k == null ? void 0 : k.find(
7098
+ var H, K;
7099
+ return ((H = l.find((v1) => v1.value === x)) == null ? void 0 : H.label) || ((K = k == null ? void 0 : k.find(
7100
7100
  (v1) => v1.value === x
7101
- )) == null ? void 0 : G.label) || x;
7101
+ )) == null ? void 0 : K.label) || x;
7102
7102
  },
7103
7103
  [k, l]
7104
- ), ae = W(
7104
+ ), ae = Z(
7105
7105
  (x) => {
7106
7106
  var H;
7107
7107
  return /* @__PURE__ */ o(
@@ -7109,7 +7109,7 @@ const n3 = ({
7109
7109
  {
7110
7110
  values: x,
7111
7111
  onTagClose: z,
7112
- maxWidth: ((H = D.current) == null ? void 0 : H.clientWidth) || 0,
7112
+ maxWidth: ((H = P.current) == null ? void 0 : H.clientWidth) || 0,
7113
7113
  disabled: r,
7114
7114
  closable: !f,
7115
7115
  options: l,
@@ -7118,16 +7118,16 @@ const n3 = ({
7118
7118
  );
7119
7119
  },
7120
7120
  [r, k, z, l, f]
7121
- ), he = W(
7122
- ({ label: x, value: H, mode: G }) => G === "filter" ? _1(H) : /* @__PURE__ */ o("div", { onMouseDown: re, className: "tag-wrapper", children: /* @__PURE__ */ o(ee, { onClose: () => z(H), disabled: r, children: typeof x == "object" ? x : L1(H) }) }),
7121
+ ), he = Z(
7122
+ ({ label: x, value: H, mode: K }) => K === "filter" ? _1(H) : /* @__PURE__ */ o("div", { onMouseDown: re, className: "tag-wrapper", children: /* @__PURE__ */ o(ee, { onClose: () => z(H), disabled: r, children: typeof x == "object" ? x : L1(H) }) }),
7123
7123
  [r, L1, z, _1]
7124
7124
  );
7125
7125
  return /* @__PURE__ */ u(
7126
7126
  "div",
7127
7127
  {
7128
- className: `snmt-select ${K ? "snmt-select-focused" : ""}
7128
+ className: `snmt-select ${D ? "snmt-select-focused" : ""}
7129
7129
  ${s ? "" : "snmt-select-single"} ${f ? "snmt-select-read-only" : ""}`,
7130
- ref: D,
7130
+ ref: P,
7131
7131
  style: { width: c },
7132
7132
  children: [
7133
7133
  /* @__PURE__ */ o(
@@ -7138,28 +7138,28 @@ const n3 = ({
7138
7138
  id: v,
7139
7139
  ref: w,
7140
7140
  showSearch: !!n,
7141
- filterOption: n && $,
7142
- onDropdownVisibleChange: V,
7141
+ filterOption: n && V,
7142
+ onDropdownVisibleChange: F,
7143
7143
  placeholder: t ? d ? `${t}*` : t : void 0,
7144
7144
  disabled: r,
7145
- value: Z || void 0,
7145
+ value: W || void 0,
7146
7146
  labelRender: (x) => L1(x.value),
7147
7147
  mode: s === "filter" ? "multiple" : s,
7148
7148
  onChange: I,
7149
7149
  onFocus: t1,
7150
- onBlur: S,
7150
+ onBlur: O,
7151
7151
  onSearch: (x) => {
7152
- T(!x), h && h(x);
7152
+ j(!x), h && h(x);
7153
7153
  },
7154
- onSelect: () => T(!0),
7155
- onDeselect: () => T(!0),
7154
+ onSelect: () => j(!0),
7155
+ onDeselect: () => j(!0),
7156
7156
  tagRender: (x) => he({ ...x, mode: s }),
7157
7157
  maxTagCount: "responsive",
7158
7158
  maxTagPlaceholder: ae,
7159
7159
  onPopupScroll: le,
7160
7160
  prefix: _ && /* @__PURE__ */ o(O1, { size: 15 }),
7161
7161
  suffixIcon: /* @__PURE__ */ o("div", { className: "wrapper-suffix-icon", children: s !== "filter" && /* @__PURE__ */ u(n1, { children: [
7162
- Z && !!Z.length && (s || g) && /* @__PURE__ */ o("div", { onClick: U, children: /* @__PURE__ */ o(
7162
+ W && !!W.length && (s || g) && /* @__PURE__ */ o("div", { onClick: T, children: /* @__PURE__ */ o(
7163
7163
  d1,
7164
7164
  {
7165
7165
  name: "cancel",
@@ -7183,7 +7183,7 @@ const n3 = ({
7183
7183
  s && /* @__PURE__ */ o(
7184
7184
  Ke,
7185
7185
  {
7186
- checked: !!(Z != null && Z.includes(x.value))
7186
+ checked: !!(W != null && W.includes(x.value))
7187
7187
  }
7188
7188
  ),
7189
7189
  /* @__PURE__ */ u(u1, { alignItems: "center", gap: 8, children: [
@@ -7191,7 +7191,7 @@ const n3 = ({
7191
7191
  /* @__PURE__ */ o("span", { children: x.label })
7192
7192
  ] })
7193
7193
  ] }),
7194
- !s && Z === x.value && /* @__PURE__ */ o(
7194
+ !s && W === x.value && /* @__PURE__ */ o(
7195
7195
  d1,
7196
7196
  {
7197
7197
  name: "ok",
@@ -7217,7 +7217,7 @@ const n3 = ({
7217
7217
  /* @__PURE__ */ o(
7218
7218
  "fieldset",
7219
7219
  {
7220
- className: `${K ? "fieldset-focused" : ""}
7220
+ className: `${D ? "fieldset-focused" : ""}
7221
7221
  ${r ? "fieldset-disabled" : ""}
7222
7222
  ${typeof i == "string" && i ? "fieldset-filled" : ""}
7223
7223
  ${typeof i == "object" && i != null && i.length ? "fieldset-filled" : ""}`,
@@ -7260,70 +7260,72 @@ const r1 = {
7260
7260
  optionRender: C,
7261
7261
  dropdownRender: p,
7262
7262
  readOnly: m,
7263
- clearable: v
7264
- }, k) => {
7265
- const [E, N] = O([]), [_, f] = O(r1), [w, b] = O(!1), [R, K] = O(null), j = W(
7266
- async (V = !1, $) => {
7267
- if (!w) {
7268
- b(!0);
7263
+ clearable: v,
7264
+ required: k = !1
7265
+ }, E) => {
7266
+ const [N, _] = S([]), [f, w] = S(r1), [b, R] = S(!1), [D, Y] = S(null), G = Z(
7267
+ async (V = !1, t1) => {
7268
+ if (!b) {
7269
+ R(!0);
7269
7270
  try {
7270
- const t1 = V ? { ...r1, search: $ } : _, S = await i(t1);
7271
- N(
7272
- (I) => V ? S.options : [...I, ...S.options]
7273
- ), K(S.count), f((I) => ({
7274
- ...I,
7275
- offset: I.offset + I.limit
7271
+ const O = V ? { ...r1, search: t1 } : f, I = await i(O);
7272
+ _(
7273
+ (T) => V ? I.options : [...T, ...I.options]
7274
+ ), Y(I.count), w((T) => ({
7275
+ ...T,
7276
+ offset: T.offset + T.limit
7276
7277
  }));
7277
7278
  } finally {
7278
- b(!1);
7279
+ R(!1);
7279
7280
  }
7280
7281
  }
7281
7282
  },
7282
- [_, i, w]
7283
- ), F = o3(j), T = W(
7283
+ [f, i, b]
7284
+ ), j = o3(G), W = Z(
7284
7285
  (V) => {
7285
- V === "" || V === void 0 || V === null ? (f(r1), F(!0)) : F(!0, V);
7286
+ V === "" || V === void 0 || V === null ? (w(r1), j(!0)) : j(!0, V);
7286
7287
  },
7287
- [F]
7288
- ), Z = async (V) => {
7289
- V && R !== null && R > E.length && await j(!1);
7290
- }, Y = W(
7288
+ [j]
7289
+ ), U = async (V) => {
7290
+ V && D !== null && D > N.length && await G(!1);
7291
+ }, P = Z(
7291
7292
  (V) => {
7292
- V && !g && (N([]), f(r1), j(!0)), h == null || h(V);
7293
+ V && !g && (_([]), w(r1), G(!0)), h == null || h(V);
7293
7294
  },
7294
7295
  // eslint-disable-next-line
7295
7296
  [g]
7296
7297
  );
7297
7298
  B(() => {
7298
- g && j(!1);
7299
+ g && G(!1);
7299
7300
  }, []);
7300
- const D = {
7301
+ const F = {
7301
7302
  id: n,
7302
7303
  width: e,
7303
- options: E,
7304
+ options: N,
7304
7305
  onChange: t,
7305
- ref: k,
7306
+ ref: E,
7306
7307
  placeholder: r,
7307
7308
  search: !0,
7308
7309
  value: s,
7309
- onSearchChange: T,
7310
- onDropdownVisibleChange: Y,
7310
+ onSearchChange: W,
7311
+ onDropdownVisibleChange: P,
7311
7312
  scrollThresholdValue: c,
7312
- onScrollToEnd: Z,
7313
+ onScrollToEnd: U,
7313
7314
  loadOnClosedState: g,
7314
7315
  disabled: l,
7315
7316
  extraOptions: a,
7316
- isLoading: w,
7317
+ isLoading: b,
7317
7318
  optionRender: C,
7318
7319
  dropdownRender: p,
7319
7320
  readOnly: m,
7320
- clearable: v
7321
+ clearable: v,
7322
+ required: k
7321
7323
  };
7322
- return ue(k, () => ({
7324
+ return ue(E, () => ({
7323
7325
  refetchOptions: async () => {
7324
- f(r1), await j(!0);
7326
+ w(r1), await G(!0);
7325
7327
  }
7326
- })), d ? /* @__PURE__ */ o(A1, { ...D, onChange: t, value: s, mode: d }) : /* @__PURE__ */ o("div", { className: "snmt-async-select", children: /* @__PURE__ */ o(A1, { ...D, onChange: t, value: s }) });
7328
+ })), d ? /* @__PURE__ */ o(A1, { ...F, onChange: t, value: s, mode: d }) : /* @__PURE__ */ o("div", { className: "snmt-async-select", children: /* @__PURE__ */ o(A1, { ...F, onChange: t, value: s }) });
7327
7329
  }
7328
7330
  ), L = (i) => typeof i == "string", l1 = () => {
7329
7331
  let i, e;
@@ -7335,17 +7337,17 @@ const r1 = {
7335
7337
  i.forEach((s) => {
7336
7338
  e[s] && (t[s] = e[s]);
7337
7339
  });
7338
- }, a3 = /###/g, Z1 = (i) => i && i.indexOf("###") > -1 ? i.replace(a3, ".") : i, W1 = (i) => !i || L(i), h1 = (i, e, t) => {
7340
+ }, a3 = /###/g, W1 = (i) => i && i.indexOf("###") > -1 ? i.replace(a3, ".") : i, Z1 = (i) => !i || L(i), h1 = (i, e, t) => {
7339
7341
  const s = L(e) ? e.split(".") : e;
7340
7342
  let n = 0;
7341
7343
  for (; n < s.length - 1; ) {
7342
- if (W1(i)) return {};
7343
- const l = Z1(s[n]);
7344
+ if (Z1(i)) return {};
7345
+ const l = W1(s[n]);
7344
7346
  !i[l] && t && (i[l] = new t()), Object.prototype.hasOwnProperty.call(i, l) ? i = i[l] : i = {}, ++n;
7345
7347
  }
7346
- return W1(i) ? {} : {
7348
+ return Z1(i) ? {} : {
7347
7349
  obj: i,
7348
- k: Z1(s[n])
7350
+ k: W1(s[n])
7349
7351
  };
7350
7352
  }, j1 = (i, e, t) => {
7351
7353
  const {
@@ -7490,7 +7492,7 @@ class f1 {
7490
7492
  return e = e || this.options, e.prefix = e.prefix || this.prefix, new f1(this.logger, e);
7491
7493
  }
7492
7494
  }
7493
- var P = new f1();
7495
+ var $ = new f1();
7494
7496
  class k1 {
7495
7497
  constructor() {
7496
7498
  this.observers = {};
@@ -7615,7 +7617,7 @@ const D1 = {};
7615
7617
  class w1 extends k1 {
7616
7618
  constructor(e) {
7617
7619
  let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
7618
- super(), l3(["resourceStore", "languageUtils", "pluralResolver", "interpolator", "backendConnector", "i18nFormat", "utils"], e, this), this.options = t, this.options.keySeparator === void 0 && (this.options.keySeparator = "."), this.logger = P.create("translator");
7620
+ super(), l3(["resourceStore", "languageUtils", "pluralResolver", "interpolator", "backendConnector", "i18nFormat", "utils"], e, this), this.options = t, this.options.keySeparator === void 0 && (this.options.keySeparator = "."), this.logger = $.create("translator");
7619
7621
  }
7620
7622
  changeLanguage(e) {
7621
7623
  e && (this.language = e);
@@ -7696,12 +7698,12 @@ class w1 extends k1 {
7696
7698
  const f = Array.isArray(C), w = f ? [] : {}, b = f ? m : p;
7697
7699
  for (const R in C)
7698
7700
  if (Object.prototype.hasOwnProperty.call(C, R)) {
7699
- const K = `${b}${l}${R}`;
7700
- w[R] = this.translate(K, {
7701
+ const D = `${b}${l}${R}`;
7702
+ w[R] = this.translate(D, {
7701
7703
  ...t,
7702
7704
  joinArrays: !1,
7703
7705
  ns: r
7704
- }), w[R] === K && (w[R] = C[R]);
7706
+ }), w[R] === D && (w[R] = C[R]);
7705
7707
  }
7706
7708
  C = w;
7707
7709
  }
@@ -7709,35 +7711,35 @@ class w1 extends k1 {
7709
7711
  C = C.join(E), C && (C = this.extendTranslation(C, e, t, s));
7710
7712
  else {
7711
7713
  let f = !1, w = !1;
7712
- const b = t.count !== void 0 && !L(t.count), R = w1.hasDefaultValue(t), K = b ? this.pluralResolver.getSuffix(g, t.count, t) : "", j = t.ordinal && b ? this.pluralResolver.getSuffix(g, t.count, {
7714
+ const b = t.count !== void 0 && !L(t.count), R = w1.hasDefaultValue(t), D = b ? this.pluralResolver.getSuffix(g, t.count, t) : "", Y = t.ordinal && b ? this.pluralResolver.getSuffix(g, t.count, {
7713
7715
  ordinal: !1
7714
- }) : "", F = b && !t.ordinal && t.count === 0 && this.pluralResolver.shouldUseIntlApi(), T = F && t[`defaultValue${this.options.pluralSeparator}zero`] || t[`defaultValue${K}`] || t[`defaultValue${j}`] || t.defaultValue;
7715
- !this.isValidLookup(C) && R && (f = !0, C = T), this.isValidLookup(C) || (w = !0, C = c);
7716
- const Y = (t.missingKeyNoValueFallbackToKey || this.options.missingKeyNoValueFallbackToKey) && w ? void 0 : C, D = R && T !== C && this.options.updateMissing;
7717
- if (w || f || D) {
7718
- if (this.logger.log(D ? "updateKey" : "missingKey", g, d, c, D ? T : C), l) {
7719
- const S = this.resolve(c, {
7716
+ }) : "", G = b && !t.ordinal && t.count === 0 && this.pluralResolver.shouldUseIntlApi(), j = G && t[`defaultValue${this.options.pluralSeparator}zero`] || t[`defaultValue${D}`] || t[`defaultValue${Y}`] || t.defaultValue;
7717
+ !this.isValidLookup(C) && R && (f = !0, C = j), this.isValidLookup(C) || (w = !0, C = c);
7718
+ const U = (t.missingKeyNoValueFallbackToKey || this.options.missingKeyNoValueFallbackToKey) && w ? void 0 : C, P = R && j !== C && this.options.updateMissing;
7719
+ if (w || f || P) {
7720
+ if (this.logger.log(P ? "updateKey" : "missingKey", g, d, c, P ? j : C), l) {
7721
+ const O = this.resolve(c, {
7720
7722
  ...t,
7721
7723
  keySeparator: !1
7722
7724
  });
7723
- S && S.res && this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.");
7724
- }
7725
- let V = [];
7726
- const $ = this.languageUtils.getFallbackCodes(this.options.fallbackLng, t.lng || this.language);
7727
- if (this.options.saveMissingTo === "fallback" && $ && $[0])
7728
- for (let S = 0; S < $.length; S++)
7729
- V.push($[S]);
7730
- else this.options.saveMissingTo === "all" ? V = this.languageUtils.toResolveHierarchy(t.lng || this.language) : V.push(t.lng || this.language);
7731
- const t1 = (S, I, U) => {
7732
- const z = R && U !== C ? U : Y;
7733
- this.options.missingKeyHandler ? this.options.missingKeyHandler(S, d, I, z, D, t) : this.backendConnector && this.backendConnector.saveMissing && this.backendConnector.saveMissing(S, d, I, z, D, t), this.emit("missingKey", S, d, I, C);
7725
+ O && O.res && this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.");
7726
+ }
7727
+ let F = [];
7728
+ const V = this.languageUtils.getFallbackCodes(this.options.fallbackLng, t.lng || this.language);
7729
+ if (this.options.saveMissingTo === "fallback" && V && V[0])
7730
+ for (let O = 0; O < V.length; O++)
7731
+ F.push(V[O]);
7732
+ else this.options.saveMissingTo === "all" ? F = this.languageUtils.toResolveHierarchy(t.lng || this.language) : F.push(t.lng || this.language);
7733
+ const t1 = (O, I, T) => {
7734
+ const z = R && T !== C ? T : U;
7735
+ this.options.missingKeyHandler ? this.options.missingKeyHandler(O, d, I, z, P, t) : this.backendConnector && this.backendConnector.saveMissing && this.backendConnector.saveMissing(O, d, I, z, P, t), this.emit("missingKey", O, d, I, C);
7734
7736
  };
7735
- this.options.saveMissing && (this.options.saveMissingPlurals && b ? V.forEach((S) => {
7736
- const I = this.pluralResolver.getSuffixes(S, t);
7737
- F && t[`defaultValue${this.options.pluralSeparator}zero`] && I.indexOf(`${this.options.pluralSeparator}zero`) < 0 && I.push(`${this.options.pluralSeparator}zero`), I.forEach((U) => {
7738
- t1([S], c + U, t[`defaultValue${U}`] || T);
7737
+ this.options.saveMissing && (this.options.saveMissingPlurals && b ? F.forEach((O) => {
7738
+ const I = this.pluralResolver.getSuffixes(O, t);
7739
+ G && t[`defaultValue${this.options.pluralSeparator}zero`] && I.indexOf(`${this.options.pluralSeparator}zero`) < 0 && I.push(`${this.options.pluralSeparator}zero`), I.forEach((T) => {
7740
+ t1([O], c + T, t[`defaultValue${T}`] || j);
7739
7741
  });
7740
- }) : t1(V, c, T));
7742
+ }) : t1(F, c, j));
7741
7743
  }
7742
7744
  C = this.extendTranslation(C, e, t, h, s), w && C === c && this.options.appendNamespaceToMissingKey && (C = `${d}:${c}`), (w || f) && this.options.parseMissingKeyHandler && (this.options.compatibilityAPI !== "v1" ? C = this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey ? `${d}:${c}` : c, f ? C : void 0) : C = this.options.parseMissingKeyHandler(C));
7743
7745
  }
@@ -7861,7 +7863,7 @@ class w1 extends k1 {
7861
7863
  const N1 = (i) => i.charAt(0).toUpperCase() + i.slice(1);
7862
7864
  class G1 {
7863
7865
  constructor(e) {
7864
- this.options = e, this.supportedLngs = this.options.supportedLngs || !1, this.logger = P.create("languageUtils");
7866
+ this.options = e, this.supportedLngs = this.options.supportedLngs || !1, this.logger = $.create("languageUtils");
7865
7867
  }
7866
7868
  getScriptPartFromCode(e) {
7867
7869
  if (e = p1(e), !e || e.indexOf("-") < 0) return null;
@@ -8061,7 +8063,7 @@ const L3 = ["v1", "v2", "v3"], v3 = ["v4"], K1 = {
8061
8063
  class x3 {
8062
8064
  constructor(e) {
8063
8065
  let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
8064
- this.languageUtils = e, this.options = t, this.logger = P.create("pluralResolver"), (!this.options.compatibilityJSON || v3.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 = N3(), this.pluralRulesCache = {};
8066
+ this.languageUtils = e, this.options = t, this.logger = $.create("pluralResolver"), (!this.options.compatibilityJSON || v3.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 = N3(), this.pluralRulesCache = {};
8065
8067
  }
8066
8068
  addRule(e, t) {
8067
8069
  this.rules[e] = t;
@@ -8129,7 +8131,7 @@ const P1 = function(i, e, t) {
8129
8131
  class R3 {
8130
8132
  constructor() {
8131
8133
  let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
8132
- this.logger = P.create("interpolator"), this.options = e, this.format = e.interpolation && e.interpolation.format || ((t) => t), this.init(e);
8134
+ this.logger = $.create("interpolator"), this.options = e, this.format = e.interpolation && e.interpolation.format || ((t) => t), this.init(e);
8133
8135
  }
8134
8136
  init() {
8135
8137
  let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
@@ -8284,7 +8286,7 @@ const M3 = (i) => {
8284
8286
  class y3 {
8285
8287
  constructor() {
8286
8288
  let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
8287
- this.logger = P.create("formatter"), this.options = e, this.formats = {
8289
+ this.logger = $.create("formatter"), this.options = e, this.formats = {
8288
8290
  number: s1((t, s) => {
8289
8291
  const n = new Intl.NumberFormat(t, {
8290
8292
  ...s
@@ -8367,7 +8369,7 @@ const b3 = (i, e) => {
8367
8369
  class E3 extends k1 {
8368
8370
  constructor(e, t, s) {
8369
8371
  let n = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {};
8370
- super(), this.backend = e, this.store = t, this.services = s, this.languageUtils = s.languageUtils, this.options = n, this.logger = P.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);
8372
+ super(), this.backend = e, this.store = t, this.services = s, this.languageUtils = s.languageUtils, this.options = n, this.logger = $.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);
8371
8373
  }
8372
8374
  queueLoad(e, t, s, n) {
8373
8375
  const l = {}, c = {}, r = {}, d = {};
@@ -8564,7 +8566,7 @@ const F1 = () => ({
8564
8566
  class c1 extends k1 {
8565
8567
  constructor() {
8566
8568
  let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, t = arguments.length > 1 ? arguments[1] : void 0;
8567
- if (super(), this.options = $1(e), this.services = {}, this.logger = P, this.modules = {
8569
+ if (super(), this.options = $1(e), this.services = {}, this.logger = $, this.modules = {
8568
8570
  external: []
8569
8571
  }, _3(this), t && !this.isInitialized && !e.isClone) {
8570
8572
  if (!this.options.initImmediate)
@@ -8589,13 +8591,13 @@ class c1 extends k1 {
8589
8591
  }), t.keySeparator !== void 0 && (this.options.userDefinedKeySeparator = t.keySeparator), t.nsSeparator !== void 0 && (this.options.userDefinedNsSeparator = t.nsSeparator);
8590
8592
  const l = (a) => a ? typeof a == "function" ? new a() : a : null;
8591
8593
  if (!this.options.isClone) {
8592
- this.modules.logger ? P.init(l(this.modules.logger), this.options) : P.init(null, this.options);
8594
+ this.modules.logger ? $.init(l(this.modules.logger), this.options) : $.init(null, this.options);
8593
8595
  let a;
8594
8596
  this.modules.formatter ? a = this.modules.formatter : typeof Intl < "u" && (a = y3);
8595
8597
  const h = new G1(this.options);
8596
8598
  this.store = new T1(this.options.resources, this.options);
8597
8599
  const C = this.services;
8598
- C.logger = P, C.resourceStore = this.store, C.languageUtils = h, C.pluralResolver = new x3(h, {
8600
+ C.logger = $, C.resourceStore = this.store, C.languageUtils = h, C.pluralResolver = new x3(h, {
8599
8601
  prepend: this.options.pluralSeparator,
8600
8602
  compatibilityJSON: this.options.compatibilityJSON,
8601
8603
  simplifyPluralSuffix: this.options.simplifyPluralSuffix
@@ -8883,7 +8885,7 @@ const se = (i, e) => () => {
8883
8885
  "&#8230;": "…",
8884
8886
  "&#x2F;": "/",
8885
8887
  "&#47;": "/"
8886
- }, B3 = (i) => A3[i], Z3 = (i) => i.replace(O3, B3);
8888
+ }, B3 = (i) => A3[i], W3 = (i) => i.replace(O3, B3);
8887
8889
  let b1 = {
8888
8890
  bindI18n: "languageChanged",
8889
8891
  bindI18nStore: "",
@@ -8892,9 +8894,9 @@ let b1 = {
8892
8894
  transWrapTextNodes: "",
8893
8895
  transKeepBasicHtmlNodesFor: ["br", "strong", "i", "p"],
8894
8896
  useSuspense: !0,
8895
- unescape: Z3
8897
+ unescape: W3
8896
8898
  };
8897
- const W3 = function() {
8899
+ const Z3 = function() {
8898
8900
  let i = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
8899
8901
  b1 = {
8900
8902
  ...b1,
@@ -8907,7 +8909,7 @@ const T3 = (i) => {
8907
8909
  }, D3 = () => ne, G3 = {
8908
8910
  type: "3rdParty",
8909
8911
  init(i) {
8910
- W3(i.options.react), T3(i);
8912
+ Z3(i.options.react), T3(i);
8911
8913
  }
8912
8914
  }, K3 = o1();
8913
8915
  class P3 {
@@ -8926,7 +8928,7 @@ const F3 = (i, e) => {
8926
8928
  return B(() => {
8927
8929
  t.current = i;
8928
8930
  }, [i, e]), t.current;
8929
- }, oe = (i, e, t, s) => i.getFixedT(e, t, s), $3 = (i, e, t, s) => W(oe(i, e, t, s), [i, e, t, s]), Y3 = function(i) {
8931
+ }, oe = (i, e, t, s) => i.getFixedT(e, t, s), $3 = (i, e, t, s) => Z(oe(i, e, t, s), [i, e, t, s]), Y3 = function(i) {
8930
8932
  let e = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
8931
8933
  const {
8932
8934
  i18n: t
@@ -8950,7 +8952,7 @@ const F3 = (i, e) => {
8950
8952
  } = c;
8951
8953
  let g = i;
8952
8954
  g = Q(g) ? [g] : g || ["translation"], l.reportNamespaces.addUsedNamespaces && l.reportNamespaces.addUsedNamespaces(g);
8953
- const a = (l.isInitialized || l.initializedStoreOnce) && g.every((f) => I3(f, l, c)), h = $3(l, e.lng || null, c.nsMode === "fallback" ? g : g[0], d), C = () => h, p = () => oe(l, e.lng || null, c.nsMode === "fallback" ? g : g[0], d), [m, v] = O(C);
8955
+ const a = (l.isInitialized || l.initializedStoreOnce) && g.every((f) => I3(f, l, c)), h = $3(l, e.lng || null, c.nsMode === "fallback" ? g : g[0], d), C = () => h, p = () => oe(l, e.lng || null, c.nsMode === "fallback" ? g : g[0], d), [m, v] = S(C);
8954
8956
  let k = g.join();
8955
8957
  e.lng && (k = `${e.lng}${k}`);
8956
8958
  const E = F3(k), N = X(!0);
@@ -8997,15 +8999,15 @@ A.use(G3).init({
8997
8999
  });
8998
9000
  const n0 = m1(
8999
9001
  ({ width: i, selectedCountry: e, onChange: t, value: s, id: n, disabled: l }, c) => {
9000
- const [r, d] = O(
9002
+ const [r, d] = S(
9001
9003
  []
9002
- ), [g, a] = O(!1), h = X(r), { locale: C, axiosPeople: p } = e1(ge);
9004
+ ), [g, a] = S(!1), h = X(r), { locale: C, axiosPeople: p } = e1(ge);
9003
9005
  if (!p)
9004
9006
  throw new Error(
9005
9007
  `CitySelect requires "axiosPeople" to fetch cities.
9006
9008
  Please provide it via SNMTUiContext.`
9007
9009
  );
9008
- const { t: m } = Y3("common", { lng: C }), v = W(
9010
+ const { t: m } = Y3("common", { lng: C }), v = Z(
9009
9011
  async (E) => {
9010
9012
  try {
9011
9013
  const f = (await p.post("v1/cities/search", {
@@ -9035,7 +9037,7 @@ const n0 = m1(
9035
9037
  d(_);
9036
9038
  })();
9037
9039
  }, [v, s]);
9038
- const k = W(
9040
+ const k = Z(
9039
9041
  async ({
9040
9042
  limit: E,
9041
9043
  offset: N,
@@ -9051,9 +9053,9 @@ const n0 = m1(
9051
9053
  f.filters = {}, e && e.length > 0 && (f.filters.countryId = [e]), _ && (f.search = _);
9052
9054
  const w = await p.post("v1/cities/search", f), b = (w == null ? void 0 : w.data.data) || [], R = w == null ? void 0 : w.data.metadata.count;
9053
9055
  return {
9054
- options: b.map((j) => ({
9055
- value: j.geoNameId,
9056
- label: j.name
9056
+ options: b.map((Y) => ({
9057
+ value: Y.geoNameId,
9058
+ label: Y.name
9057
9059
  })),
9058
9060
  count: R,
9059
9061
  limit: E
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@snmt-react-ui/city-select",
3
3
  "private": false,
4
- "version": "2.5.0",
4
+ "version": "2.5.1",
5
5
  "type": "module",
6
6
  "main": "dist/city-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/async-select": "^1.6.4",
21
+ "@snmt-react-ui/async-select": "^1.7.0",
22
22
  "@snmt-react-ui/core": "^2.1.0",
23
23
  "i18next": "^23.11.5",
24
24
  "react-i18next": "^14.1.1",
@@ -27,5 +27,5 @@
27
27
  "peerDependencies": {
28
28
  "antd": "^5.22.0"
29
29
  },
30
- "gitHead": "c9dbd6930def88ad1e138719997c66da0ffe65a4"
30
+ "gitHead": "ace8423c66d4f4f62ce7a72d3110e19580ea6e7c"
31
31
  }