mimir-ui-kit 1.36.2 → 1.36.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -14,10 +14,6 @@ export type TProps = {
14
14
  * Размер чипа. Возможные значения определены в перечислении `EChipSize`.
15
15
  */
16
16
  size?: `${EChipSize}` | EChipSize;
17
- /**
18
- * Функция, которая будет вызвана при нажатии на чип.
19
- */
20
- onClick?: VoidFunction;
21
17
  /**
22
18
  * Отключено ли чип.
23
19
  */
@@ -31,4 +27,4 @@ export type TProps = {
31
27
  */
32
28
  onClose?: VoidFunction;
33
29
  };
34
- export declare const Chip: ({ size, variant, className, onClick, disabled, withAction, children, onClose }: PropsWithChildren<TProps>) => import("react/jsx-runtime").JSX.Element;
30
+ export declare const Chip: ({ size, variant, className, disabled, withAction, children, onClose }: PropsWithChildren<TProps>) => import("react/jsx-runtime").JSX.Element;
@@ -1,45 +1,44 @@
1
- import { jsxs as m, jsx as p } from "react/jsx-runtime";
2
- import { c as h } from "../../index-DIxK0V-G.js";
3
- import { EChipSize as b, EChipVariant as l } from "./constants.js";
4
- import { Button as v } from "../Button/Button.js";
5
- import '../../assets/Chip.css';const d = "_chip_19bvm_2", u = "_disabled_19bvm_40", x = "_xs_19bvm_51", g = "_s_19bvm_59", w = "_m_19bvm_67", C = "_sapphire_19bvm_75", f = "_citrine_19bvm_84", y = "_asphalt_19bvm_93", N = "_gray_19bvm_102", j = "_white_19bvm_111", B = "_green_19bvm_120", s = {
6
- chip: d,
1
+ import { jsxs as r, jsx as m } from "react/jsx-runtime";
2
+ import { c as p } from "../../index-DIxK0V-G.js";
3
+ import { EChipSize as h, EChipVariant as b } from "./constants.js";
4
+ import { Button as l } from "../Button/Button.js";
5
+ import '../../assets/Chip.css';const v = "_chip_19bvm_2", d = "_disabled_19bvm_40", x = "_xs_19bvm_51", g = "_s_19bvm_59", u = "_m_19bvm_67", w = "_sapphire_19bvm_75", C = "_citrine_19bvm_84", f = "_asphalt_19bvm_93", y = "_gray_19bvm_102", N = "_white_19bvm_111", j = "_green_19bvm_120", s = {
6
+ chip: v,
7
7
  "with-action": "_with-action_19bvm_18",
8
- disabled: u,
8
+ disabled: d,
9
9
  xs: x,
10
10
  s: g,
11
- m: w,
12
- sapphire: C,
13
- citrine: f,
14
- asphalt: y,
15
- gray: N,
16
- white: j,
17
- green: B
18
- }, I = ({
19
- size: i = b.M,
20
- variant: _ = l.Sapphire,
11
+ m: u,
12
+ sapphire: w,
13
+ citrine: C,
14
+ asphalt: f,
15
+ gray: y,
16
+ white: N,
17
+ green: j
18
+ }, z = ({
19
+ size: i = h.M,
20
+ variant: _ = b.Sapphire,
21
21
  className: c,
22
- onClick: e,
23
- disabled: o,
22
+ disabled: e,
24
23
  withAction: t,
25
- children: n,
24
+ children: o,
26
25
  onClose: a
27
26
  }) => {
28
- const r = h(
27
+ const n = p(
29
28
  s.chip,
30
29
  c,
31
30
  {
32
31
  [s["with-action"]]: t,
33
- [s.disabled]: o
32
+ [s.disabled]: e
34
33
  },
35
34
  s[_],
36
35
  s[i]
37
36
  );
38
- return /* @__PURE__ */ m("button", { type: "button", onClick: e, className: r, children: [
39
- n,
40
- t && /* @__PURE__ */ p(v, { isIconButton: !0, iconName: "Close16px", onClick: a, clear: !0 })
37
+ return /* @__PURE__ */ r("div", { className: n, children: [
38
+ o,
39
+ t && /* @__PURE__ */ m(l, { isIconButton: !0, iconName: "Close16px", onClick: a, clear: !0 })
41
40
  ] });
42
41
  };
43
42
  export {
44
- I as Chip
43
+ z as Chip
45
44
  };
@@ -58,7 +58,13 @@ const mt = {
58
58
  const G = () => {
59
59
  S || f(!0);
60
60
  }, K = (t) => {
61
- isNaN(t.getTime()) || (D(t), e == null || e({ value: d.Date(t, "yyyy-mm-dd"), name: r })), A === "years" && (m === "years" ? (f(!1), p(m)) : p("months")), A === "months" && (m === "months" ? (f(!1), p(m)) : p("days")), D(t), e == null || e({ value: d.Date(t, "yyyy-mm-dd"), name: r }), c == null || c(d.Date(t, "yyyy-mm-dd"));
61
+ isNaN(t.getTime()) || (D(t), e == null || e({
62
+ value: d.Date(t, "yyyy-mm-dd"),
63
+ name: r
64
+ })), A === "years" && (m === "years" ? (f(!1), p(m)) : p("months")), A === "months" && (m === "months" ? (f(!1), p(m)) : p("days")), D(t), e == null || e({
65
+ value: d.Date(t, "yyyy-mm-dd"),
66
+ name: r
67
+ }), c == null || c(d.Date(t, "yyyy-mm-dd"));
62
68
  }, U = (t) => {
63
69
  if (_) {
64
70
  const I = t.target.value.replace(/[^\d]/g, ""), [h, u, O] = [
@@ -70,7 +76,10 @@ const mt = {
70
76
  const J = parseInt(O), l = /* @__PURE__ */ new Date(
71
77
  `${J}-${u.padStart(2, "0")}-${h.padStart(2, "0")}`
72
78
  );
73
- isNaN(l.getTime()) || (D(l), e == null || e({ value: d.Date(l, "yyyy-mm-dd"), name: r }), c == null || c(d.Date(l, "yyyy-mm-dd")));
79
+ isNaN(l.getTime()) || (D(l), e == null || e({
80
+ value: d.Date(l, "yyyy-mm-dd"),
81
+ name: r
82
+ }), c == null || c(d.Date(l, "yyyy-mm-dd")));
74
83
  }
75
84
  }
76
85
  }, q = v(a.wrapper, n && a.active), z = v(a.input, a.inputBorderControl), C = {
@@ -1,15 +1,15 @@
1
- import { jsxs as h, jsx as o, Fragment as q } from "react/jsx-runtime";
1
+ import { jsxs as j, jsx as o, Fragment as q } from "react/jsx-runtime";
2
2
  import { c as r } from "../../index-DIxK0V-G.js";
3
- import { forwardRef as ne, useRef as B, useState as C, useMemo as oe, useEffect as se } from "react";
4
- import { EMultiSelectSearchSize as S } from "./constants.js";
5
- import { getInitialInputValue as ie, mapSizeToInputSize as O, getDropdownArrowIcon as re, joinSelectedItems as R } from "./utils.js";
3
+ import { forwardRef as se, useRef as B, useState as S, useEffect as O, useMemo as ie } from "react";
4
+ import { EMultiSelectSearchSize as M } from "./constants.js";
5
+ import { getInitialInputValue as R, mapSizeToInputSize as E, getDropdownArrowIcon as re, joinSelectedItems as F } from "./utils.js";
6
6
  import { Icon as le } from "../../icons/Icon.js";
7
7
  import { Button as ae } from "../Button/Button.js";
8
8
  import { CheckboxMimir as ce } from "../CheckboxMimir/CheckboxMimir.js";
9
9
  import { Chip as pe } from "../Chip/Chip.js";
10
- import { I as E } from "../../Input-DlGNMuUD.js";
10
+ import { I as P } from "../../Input-DlGNMuUD.js";
11
11
  import { EInputVariant as ue } from "../Input/constants.js";
12
- import { H as me, U as F, G as P, K as de, W as _e } from "../../combobox-CDU06zJj.js";
12
+ import { H as me, U as G, G as W, K as de, W as _e } from "../../combobox-CDU06zJj.js";
13
13
  import '../../assets/MultiSelectSearch.css';const he = "_disabled_mkspj_5", fe = "_container_mkspj_9", ke = "_full_mkspj_27", be = "_button_mkspj_39", je = "_options_mkspj_53", ge = "_top_mkspj_64", ve = "_bottom_mkspj_69", Ie = "_m_mkspj_2", Ne = "_l_mkspj_111", we = "_focused_mkspj_129", Ce = "_option_mkspj_53", Se = "_clear_mkspj_175", e = {
14
14
  "multi-select-search": "_multi-select-search_mkspj_2",
15
15
  disabled: he,
@@ -38,136 +38,140 @@ import '../../assets/MultiSelectSearch.css';const he = "_disabled_mkspj_5", fe =
38
38
  "required-mark": "_required-mark_mkspj_170",
39
39
  clear: Se,
40
40
  "icon-button": "_icon-button_mkspj_184"
41
- }, Re = ne(
42
- (G, W) => {
41
+ }, Re = se(
42
+ (H, K) => {
43
43
  const {
44
44
  placeholder: x,
45
- size: i = S.L,
46
- value: M,
45
+ size: i = M.L,
46
+ value: c,
47
47
  onChange: s,
48
- full: H,
49
- showArrow: K = !0,
50
- items: p = [],
51
- classNameOption: U,
52
- displayValue: f = "name",
53
- filterOnSearch: z = !0,
54
- onSearch: g,
55
- variant: D = ue.DefaultGray,
56
- menuPlacement: v = "bottom",
48
+ full: U,
49
+ showArrow: J = !0,
50
+ items: m = [],
51
+ classNameOption: Q,
52
+ displayValue: p = "name",
53
+ filterOnSearch: D = !0,
54
+ onSearch: v,
55
+ variant: z = ue.DefaultGray,
56
+ menuPlacement: I = "bottom",
57
57
  disabled: l = !1,
58
58
  searchProps: y,
59
- withClearButton: I = !1,
60
- withChip: J = !1,
61
- chipVariant: Q = "sapphire",
62
- disableInput: u = !1
63
- } = G, N = B(null), c = B(null), [k, m] = C(!1), [d, b] = C(
64
- () => ie(M, f)
65
- ), [_, j] = C(
66
- M || []
67
- ), A = oe(() => {
59
+ withClearButton: N = !1,
60
+ withChip: X = !1,
61
+ chipVariant: Y = "sapphire",
62
+ disableInput: d = !1
63
+ } = H, w = B(null), u = B(null), [g, _] = S(!1), [h, f] = S(
64
+ () => R(c, p)
65
+ ), [k, b] = S(
66
+ c || []
67
+ );
68
+ O(() => {
69
+ c && (b(c), f(R(c, p)));
70
+ }, [c, p]);
71
+ const A = ie(() => {
68
72
  var n;
69
- if (!z) return p;
70
- const t = ((n = d.split(",").pop()) == null ? void 0 : n.trim().toLowerCase()) ?? "";
71
- return p.filter(
73
+ if (!D) return m;
74
+ const t = ((n = h.split(",").pop()) == null ? void 0 : n.trim().toLowerCase()) ?? "";
75
+ return m.filter(
72
76
  (a) => a.name.toLowerCase().includes(t)
73
77
  );
74
- }, [z, p, d]), X = (t) => {
75
- j(t), s == null || s(t);
76
- const n = R(t, f);
77
- b(n), m(!0), setTimeout(() => {
78
- if (c.current) {
79
- c.current.focus(), c.current.scrollLeft = c.current.scrollWidth;
78
+ }, [D, m, h]), Z = (t) => {
79
+ b(t), s == null || s(t);
80
+ const n = F(t, p);
81
+ f(n), _(!0), setTimeout(() => {
82
+ if (u.current) {
83
+ u.current.focus(), u.current.scrollLeft = u.current.scrollWidth;
80
84
  const a = n.length;
81
- c.current.setSelectionRange(a, a);
85
+ u.current.setSelectionRange(a, a);
82
86
  }
83
87
  }, 0);
84
88
  }, L = (t) => {
85
- if (u) return;
89
+ if (d) return;
86
90
  const n = t.target.value;
87
- b(n), g == null || g(n);
88
- const a = n.split(",").map((w) => w.trim()).filter(Boolean), V = p.filter(
89
- (w) => a.includes(w[f])
91
+ f(n), v == null || v(n);
92
+ const a = n.split(",").map((C) => C.trim()).filter(Boolean), V = m.filter(
93
+ (C) => a.includes(C[p])
90
94
  );
91
- j(V), s == null || s(V), m(!0);
92
- }, Y = (t) => {
93
- const n = _.filter(
95
+ b(V), s == null || s(V), _(!0);
96
+ }, $ = (t) => {
97
+ const n = k.filter(
94
98
  (a) => a.id !== t.id
95
99
  );
96
- j(n), s == null || s(n), b(R(n, f));
97
- }, T = () => m((t) => !t), Z = (t) => {
100
+ b(n), s == null || s(n), f(F(n, p));
101
+ }, T = () => _((t) => !t), ee = (t) => {
98
102
  t.preventDefault(), t.currentTarget.focus();
99
103
  const n = t.currentTarget.value.length;
100
104
  t.currentTarget.setSelectionRange(n, n);
101
- }, $ = () => {
102
- b(""), j([]), s == null || s([]);
103
- }, ee = (t) => {
104
- t.stopPropagation(), $();
105
- }, te = (t) => {
106
- u && t.target.blur();
105
+ }, te = () => {
106
+ f(""), b([]), s == null || s([]);
107
+ }, ne = (t) => {
108
+ t.stopPropagation(), te();
109
+ }, oe = (t) => {
110
+ d && t.target.blur();
107
111
  };
108
- return se(() => {
112
+ return O(() => {
109
113
  const t = (n) => {
110
- N.current && !N.current.contains(n.target) && !n.defaultPrevented && m(!1);
114
+ w.current && !w.current.contains(n.target) && !n.defaultPrevented && _(!1);
111
115
  };
112
116
  return document.addEventListener("mousedown", t), () => {
113
117
  document.removeEventListener("mousedown", t);
114
118
  };
115
- }, []), /* @__PURE__ */ h("div", { ref: N, children: [
119
+ }, []), /* @__PURE__ */ j("div", { ref: w, children: [
116
120
  /* @__PURE__ */ o(
117
121
  me,
118
122
  {
119
123
  multiple: !0,
120
124
  as: "div",
121
- value: _,
125
+ value: k,
122
126
  className: r(e["multi-select-search"], {
123
- [e.full]: H,
127
+ [e.full]: U,
124
128
  [e.disabled]: l
125
129
  }),
126
- onChange: X,
127
- ref: W,
130
+ onChange: Z,
131
+ ref: K,
128
132
  disabled: l,
129
133
  virtual: { options: A },
130
- children: /* @__PURE__ */ h(
134
+ children: /* @__PURE__ */ j(
131
135
  "div",
132
136
  {
133
137
  className: r(e.container, e[i], {
134
- [e["container-open"]]: k
138
+ [e["container-open"]]: g
135
139
  }),
136
140
  children: [
137
- u && /* @__PURE__ */ h("div", { className: e["input-container"], children: [
141
+ d && /* @__PURE__ */ j("div", { className: e["input-container"], children: [
138
142
  /* @__PURE__ */ o(
139
- F,
143
+ G,
140
144
  {
141
145
  disabled: l,
142
146
  style: { width: "100%" },
143
147
  onClick: T,
144
148
  children: /* @__PURE__ */ o(
145
- P,
149
+ W,
146
150
  {
147
- as: E,
151
+ as: P,
148
152
  label: x,
149
- size: O(i),
153
+ size: E(i),
150
154
  className: r(e["multi-select-input"], {
151
- [e["multi-select-input-disabled"]]: u && I
155
+ [e["multi-select-input-disabled"]]: d && N
152
156
  }),
153
157
  onChange: L,
154
- value: d,
158
+ value: h,
155
159
  disabled: l,
156
- variant: D,
160
+ variant: z,
157
161
  rightSlotClassName: e["right-slot"],
158
162
  requiredMarkClassName: e["required-mark"],
159
163
  "data-testid": "select-search-input",
160
- onFocus: te,
164
+ onFocus: oe,
161
165
  rightAddon: {
162
166
  addonType: "icon",
163
- addonContent: re(k, i)
167
+ addonContent: re(g, i)
164
168
  },
165
169
  ...y
166
170
  }
167
171
  )
168
172
  }
169
173
  ),
170
- I && d && /* @__PURE__ */ o(
174
+ N && h && /* @__PURE__ */ o(
171
175
  ae,
172
176
  {
173
177
  tabIndex: -1,
@@ -181,44 +185,44 @@ import '../../assets/MultiSelectSearch.css';const he = "_disabled_mkspj_5", fe =
181
185
  clear: !0,
182
186
  disabled: l,
183
187
  variant: "secondary-gray",
184
- onClick: ee,
188
+ onClick: ne,
185
189
  "data-testid": "clear-button"
186
190
  }
187
191
  )
188
192
  ] }),
189
- !u && /* @__PURE__ */ o(
190
- P,
193
+ !d && /* @__PURE__ */ o(
194
+ W,
191
195
  {
192
- as: E,
196
+ as: P,
193
197
  label: x,
194
- size: O(i),
198
+ size: E(i),
195
199
  className: e["multi-select-input"],
196
200
  rightSlotClassName: e["right-slot"],
197
201
  requiredMarkClassName: e["required-mark"],
198
- value: d,
202
+ value: h,
199
203
  disabled: l,
200
- variant: D,
201
- withClearButton: I,
202
- onFocus: () => m(!0),
203
- onMouseDown: Z,
204
+ variant: z,
205
+ withClearButton: N,
206
+ onFocus: () => _(!0),
207
+ onMouseDown: ee,
204
208
  onChange: L,
205
- ref: c,
209
+ ref: u,
206
210
  rightAddon: {
207
211
  addonType: "react-node",
208
- addonContent: K && /* @__PURE__ */ o(
209
- F,
212
+ addonContent: J && /* @__PURE__ */ o(
213
+ G,
210
214
  {
211
215
  className: r(e.button, {
212
216
  [e.disabled]: l
213
217
  }),
214
218
  disabled: l,
215
- onClick: T,
219
+ onMouseDown: T,
216
220
  children: /* @__PURE__ */ o(
217
221
  le,
218
222
  {
219
- iconName: i == S.M ? "DropdownArrowBottom16px" : "DropdownArrowDown24px",
223
+ iconName: i == M.M ? "DropdownArrowBottom16px" : "DropdownArrowDown24px",
220
224
  className: r(e["selector-icon"], {
221
- [e["selector-icon-open"]]: k
225
+ [e["selector-icon-open"]]: g
222
226
  })
223
227
  }
224
228
  )
@@ -229,13 +233,13 @@ import '../../assets/MultiSelectSearch.css';const he = "_disabled_mkspj_5", fe =
229
233
  ...y
230
234
  }
231
235
  ),
232
- k && /* @__PURE__ */ o(q, { children: p.length ? A.length ? /* @__PURE__ */ o(
236
+ g && /* @__PURE__ */ o(q, { children: m.length ? A.length ? /* @__PURE__ */ o(
233
237
  de,
234
238
  {
235
239
  className: r(
236
240
  e.options,
237
241
  e[i],
238
- e[v]
242
+ e[I]
239
243
  ),
240
244
  modal: !1,
241
245
  static: !0,
@@ -245,14 +249,14 @@ import '../../assets/MultiSelectSearch.css';const he = "_disabled_mkspj_5", fe =
245
249
  value: t,
246
250
  className: ({ focus: n }) => r(
247
251
  e.option,
248
- U,
252
+ Q,
249
253
  i && e[i],
250
254
  {
251
255
  [e["option-active"]]: n
252
256
  }
253
257
  ),
254
- children: /* @__PURE__ */ h(q, { children: [
255
- /* @__PURE__ */ h("div", { className: e["option-inner"], children: [
258
+ children: /* @__PURE__ */ j(q, { children: [
259
+ /* @__PURE__ */ j("div", { className: e["option-inner"], children: [
256
260
  t.name,
257
261
  t.bottom && /* @__PURE__ */ o("div", { children: t.bottom })
258
262
  ] }),
@@ -260,7 +264,7 @@ import '../../assets/MultiSelectSearch.css';const he = "_disabled_mkspj_5", fe =
260
264
  ce,
261
265
  {
262
266
  isInteractive: !1,
263
- checked: _.some(
267
+ checked: k.some(
264
268
  (n) => n.id === t.id
265
269
  )
266
270
  }
@@ -277,7 +281,7 @@ import '../../assets/MultiSelectSearch.css';const he = "_disabled_mkspj_5", fe =
277
281
  e.options,
278
282
  e[i],
279
283
  e["no-options"],
280
- e[v]
284
+ e[I]
281
285
  ),
282
286
  children: "Ничего не найдено"
283
287
  }
@@ -288,7 +292,7 @@ import '../../assets/MultiSelectSearch.css';const he = "_disabled_mkspj_5", fe =
288
292
  e.options,
289
293
  e[i],
290
294
  e["no-options"],
291
- e[v]
295
+ e[I]
292
296
  ),
293
297
  children: "Нет данных"
294
298
  }
@@ -298,14 +302,14 @@ import '../../assets/MultiSelectSearch.css';const he = "_disabled_mkspj_5", fe =
298
302
  )
299
303
  }
300
304
  ),
301
- J && _.length > 0 && /* @__PURE__ */ o("div", { className: e["chip-container"], children: _.map((t) => /* @__PURE__ */ o(
305
+ X && k.length > 0 && /* @__PURE__ */ o("div", { className: e["chip-container"], children: k.map((t) => /* @__PURE__ */ o(
302
306
  pe,
303
307
  {
304
- size: i === S.L ? "s" : "xs",
305
- variant: Q,
308
+ size: i === M.L ? "s" : "xs",
309
+ variant: Y,
306
310
  className: e.chip,
307
311
  withAction: !0,
308
- onClose: () => Y(t),
312
+ onClose: () => $(t),
309
313
  children: t.name
310
314
  },
311
315
  t.id
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "mimir-ui-kit",
3
3
  "private": false,
4
- "version": "1.36.2",
4
+ "version": "1.36.3",
5
5
  "type": "module",
6
6
  "exports": {
7
7
  ".": {