mimir-ui-kit 1.38.16 → 1.38.18

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,8 +1,8 @@
1
1
  const n = (s) => {
2
- const t = s.replace(/\D/g, "");
2
+ const t = (s ?? "").replace(/\D/g, "");
3
3
  let e = "+7 ";
4
4
  return t.startsWith("7") ? e += "(" + t.substring(1, 4) : e += t.substring(0, 3), t.length > 4 && (e += ") " + t.substring(4, 7)), t.length > 7 && (e += "-" + t.substring(7, 9)), t.length > 9 && (e += "-" + t.substring(9, 11)), e;
5
- }, r = (s) => s.replace(/\D/g, "");
5
+ }, r = (s) => (s ?? "").replace(/\D/g, "");
6
6
  export {
7
7
  n as getMaskedInputPhoneValue,
8
8
  r as getUnmaskedInputValue
@@ -1,4 +1,4 @@
1
- import { jsx as a, jsxs as m, Fragment as D } from "react/jsx-runtime";
1
+ import { jsx as s, jsxs as h, Fragment as D } from "react/jsx-runtime";
2
2
  import { c as l } from "../../index-DIxK0V-G.js";
3
3
  import { forwardRef as U, useState as q, useMemo as W, useCallback as R, useEffect as $ } from "react";
4
4
  import { ESelectSearchSize as g } from "./constants.js";
@@ -37,46 +37,46 @@ import '../../assets/SelectSearch.css';const te = "_disabled_1bph7_6", oe = "_co
37
37
  (E, L) => {
38
38
  const {
39
39
  placeholder: w,
40
- size: i = g.L,
41
- value: n,
42
- onChange: s,
40
+ size: a = g.L,
41
+ value: i,
42
+ onChange: n,
43
43
  full: V,
44
44
  showArrow: C = !0,
45
- items: p = [],
45
+ items: u = [],
46
46
  classNameOption: F,
47
47
  displayValue: G = "name",
48
48
  filterOnSearch: I = !0,
49
- onSearch: _,
49
+ onSearch: b,
50
50
  variant: S = X.DefaultGray,
51
- menuPlacement: b = "bottom",
51
+ menuPlacement: f = "bottom",
52
52
  disabled: r = !1,
53
53
  searchProps: y,
54
- withClearButton: f = !1,
54
+ withClearButton: N = !1,
55
55
  disableInput: c = !1,
56
56
  autocomplete: k = "on",
57
57
  immediate: P = !1
58
- } = E, N = String((n == null ? void 0 : n[G]) || ""), [d, u] = q(N), [v, h] = q(n), x = W(() => !I || n && (n.id || n.name) ? p : d.trim().toLowerCase() ? p.filter(
58
+ } = E, v = String((i == null ? void 0 : i[G]) || ""), [d, m] = q(v), [p, _] = q(i), x = W(() => I && d.trim().toLowerCase() ? u.filter(
59
59
  (t) => t.name.toLowerCase().includes(d.toLowerCase())
60
- ) : p, [d, p, n, I]), T = (t) => {
61
- t ? (u(t.name), h(t), s == null || s(t)) : (u(""), h(null), s == null || s({ id: "", name: "" }));
60
+ ) : u, [d, u, I]), T = (t) => {
61
+ t ? (m(t.name), _(t), n == null || n(t)) : (m(""), _(null), n == null || n({ id: "", name: "" }));
62
62
  }, z = R(
63
63
  (t) => {
64
64
  if (c) return;
65
65
  const o = t.target.value;
66
- u(o), _ == null || _(o), !o && n && (s == null || s({ id: "", name: "" }));
66
+ m(o), b == null || b(o), p && o !== p.name && _(null), !o && i && (n == null || n({ id: "", name: "" }));
67
67
  },
68
- [c, s, _, n]
68
+ [c, n, b, i, p]
69
69
  ), H = () => {
70
- u(""), h(null), s == null || s({ id: "", name: "" });
70
+ m(""), _(null), n == null || n({ id: "", name: "" });
71
71
  };
72
72
  return $(() => {
73
- const t = !n || typeof n == "object" && !Object.keys(n).length;
74
- u(t ? "" : N), h(t ? null : n);
75
- }, [n, N]), /* @__PURE__ */ a(
73
+ const t = !i || typeof i == "object" && !Object.keys(i).length;
74
+ m(t ? "" : v), _(t ? null : i);
75
+ }, [i, v]), /* @__PURE__ */ s(
76
76
  Y,
77
77
  {
78
78
  as: "div",
79
- value: v,
79
+ value: p,
80
80
  className: l(e["select-search"], {
81
81
  [e.full]: V,
82
82
  [e.disabled]: r
@@ -86,23 +86,23 @@ import '../../assets/SelectSearch.css';const te = "_disabled_1bph7_6", oe = "_co
86
86
  disabled: r,
87
87
  virtual: { options: x },
88
88
  immediate: P,
89
- children: ({ open: t }) => /* @__PURE__ */ m(D, { children: [
90
- /* @__PURE__ */ m(
89
+ children: ({ open: t }) => /* @__PURE__ */ h(D, { children: [
90
+ /* @__PURE__ */ h(
91
91
  "div",
92
92
  {
93
- className: l(e.container, e[i], {
93
+ className: l(e.container, e[a], {
94
94
  [e["container-open"]]: t
95
95
  }),
96
96
  children: [
97
- c && /* @__PURE__ */ m("div", { style: { position: "relative", width: "100%" }, children: [
98
- /* @__PURE__ */ a(M, { disabled: r, style: { width: "100%" }, children: /* @__PURE__ */ a(
97
+ c && /* @__PURE__ */ h("div", { style: { position: "relative", width: "100%" }, children: [
98
+ /* @__PURE__ */ s(M, { disabled: r, style: { width: "100%" }, children: /* @__PURE__ */ s(
99
99
  j,
100
100
  {
101
101
  as: B,
102
102
  label: w,
103
- size: A(i),
103
+ size: A(a),
104
104
  className: l(e["select-input"], {
105
- [e["select-input-disabled"]]: c && f
105
+ [e["select-input-disabled"]]: c && N
106
106
  }),
107
107
  onChange: z,
108
108
  value: d,
@@ -116,13 +116,13 @@ import '../../assets/SelectSearch.css';const te = "_disabled_1bph7_6", oe = "_co
116
116
  },
117
117
  rightAddon: {
118
118
  addonType: "icon",
119
- addonContent: J(t, i)
119
+ addonContent: J(t, a)
120
120
  },
121
121
  autocomplete: k,
122
122
  ...y
123
123
  }
124
124
  ) }),
125
- f && d && /* @__PURE__ */ a(
125
+ N && d && /* @__PURE__ */ s(
126
126
  Q,
127
127
  {
128
128
  tabIndex: -1,
@@ -143,34 +143,34 @@ import '../../assets/SelectSearch.css';const te = "_disabled_1bph7_6", oe = "_co
143
143
  }
144
144
  )
145
145
  ] }),
146
- !c && /* @__PURE__ */ a(
146
+ !c && /* @__PURE__ */ s(
147
147
  j,
148
148
  {
149
149
  as: B,
150
150
  label: w,
151
- size: A(i),
151
+ size: A(a),
152
152
  className: e["select-input"],
153
153
  onChange: z,
154
154
  value: d,
155
155
  disabled: r,
156
156
  variant: S,
157
- withClearButton: f,
157
+ withClearButton: N,
158
158
  rightSlotClassName: e["right-slot"],
159
159
  requiredMarkClassName: e["required-mark"],
160
160
  "data-testid": "select-search-input",
161
161
  rightAddon: C ? {
162
162
  addonType: "react-node",
163
- addonContent: C && /* @__PURE__ */ a(
163
+ addonContent: C && /* @__PURE__ */ s(
164
164
  M,
165
165
  {
166
166
  className: l(e.button, {
167
167
  [e.disabled]: r
168
168
  }),
169
169
  disabled: r,
170
- children: /* @__PURE__ */ a(
170
+ children: /* @__PURE__ */ s(
171
171
  O,
172
172
  {
173
- iconName: i == g.M ? "DropdownArrowBottom16px" : "DropdownArrowDown24px",
173
+ iconName: a == g.M ? "DropdownArrowBottom16px" : "DropdownArrowDown24px",
174
174
  className: l(e["selector-icon"], {
175
175
  [e["selector-icon-open"]]: t
176
176
  })
@@ -189,37 +189,37 @@ import '../../assets/SelectSearch.css';const te = "_disabled_1bph7_6", oe = "_co
189
189
  ]
190
190
  }
191
191
  ),
192
- t && /* @__PURE__ */ a(D, { children: p.length ? x.length ? /* @__PURE__ */ a(
192
+ t && /* @__PURE__ */ s(D, { children: u.length ? x.length ? /* @__PURE__ */ s(
193
193
  Z,
194
194
  {
195
195
  "data-testid": "select-search-options",
196
196
  className: l(
197
197
  e.options,
198
- e[i],
199
- e[b]
198
+ e[a],
199
+ e[f]
200
200
  ),
201
- children: ({ option: o }) => /* @__PURE__ */ m(
201
+ children: ({ option: o }) => /* @__PURE__ */ h(
202
202
  ee,
203
203
  {
204
204
  value: o,
205
205
  className: ({ focus: K }) => l(
206
206
  e.option,
207
207
  F,
208
- i && e[i],
208
+ a && e[a],
209
209
  {
210
210
  [e["option-active"]]: K
211
211
  }
212
212
  ),
213
213
  "data-testid": `select-search-option-${o.id}`,
214
214
  children: [
215
- /* @__PURE__ */ m("div", { className: e["option-inner"], children: [
215
+ /* @__PURE__ */ h("div", { className: e["option-inner"], children: [
216
216
  o.name,
217
- o.bottom && /* @__PURE__ */ a("div", { children: o.bottom })
217
+ o.bottom && /* @__PURE__ */ s("div", { children: o.bottom })
218
218
  ] }),
219
- v && v.id === o.id && /* @__PURE__ */ a(
219
+ p && p.id === o.id && /* @__PURE__ */ s(
220
220
  O,
221
221
  {
222
- iconName: i === g.M ? "Done16px" : "Done24px",
222
+ iconName: a === g.M ? "Done16px" : "Done24px",
223
223
  className: e["selected-icon"]
224
224
  }
225
225
  )
@@ -228,26 +228,26 @@ import '../../assets/SelectSearch.css';const te = "_disabled_1bph7_6", oe = "_co
228
228
  o.id
229
229
  )
230
230
  }
231
- ) : /* @__PURE__ */ a(
231
+ ) : /* @__PURE__ */ s(
232
232
  "div",
233
233
  {
234
234
  className: l(
235
235
  e.options,
236
- e[i],
236
+ e[a],
237
237
  e["no-options"],
238
- e[b]
238
+ e[f]
239
239
  ),
240
240
  "data-headlessui-state": t ? "open" : "closed",
241
241
  children: "Ничего не найдено"
242
242
  }
243
- ) : /* @__PURE__ */ a(
243
+ ) : /* @__PURE__ */ s(
244
244
  "div",
245
245
  {
246
246
  className: l(
247
247
  e.options,
248
- e[i],
248
+ e[a],
249
249
  e["no-options"],
250
- e[b]
250
+ e[f]
251
251
  ),
252
252
  "data-headlessui-state": t ? "open" : "closed",
253
253
  children: "Нет данных"
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "mimir-ui-kit",
3
3
  "private": false,
4
- "version": "1.38.16",
4
+ "version": "1.38.18",
5
5
  "type": "module",
6
6
  "exports": {
7
7
  ".": {