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,
|
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
|
2
|
-
import { c as
|
3
|
-
import { EChipSize as
|
4
|
-
import { Button as
|
5
|
-
import '../../assets/Chip.css';const
|
6
|
-
chip:
|
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:
|
8
|
+
disabled: d,
|
9
9
|
xs: x,
|
10
10
|
s: g,
|
11
|
-
m:
|
12
|
-
sapphire:
|
13
|
-
citrine:
|
14
|
-
asphalt:
|
15
|
-
gray:
|
16
|
-
white:
|
17
|
-
green:
|
18
|
-
},
|
19
|
-
size: i =
|
20
|
-
variant: _ =
|
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
|
-
|
23
|
-
disabled: o,
|
22
|
+
disabled: e,
|
24
23
|
withAction: t,
|
25
|
-
children:
|
24
|
+
children: o,
|
26
25
|
onClose: a
|
27
26
|
}) => {
|
28
|
-
const
|
27
|
+
const n = p(
|
29
28
|
s.chip,
|
30
29
|
c,
|
31
30
|
{
|
32
31
|
[s["with-action"]]: t,
|
33
|
-
[s.disabled]:
|
32
|
+
[s.disabled]: e
|
34
33
|
},
|
35
34
|
s[_],
|
36
35
|
s[i]
|
37
36
|
);
|
38
|
-
return /* @__PURE__ */
|
39
|
-
|
40
|
-
t && /* @__PURE__ */
|
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
|
-
|
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({
|
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({
|
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
|
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
|
4
|
-
import { EMultiSelectSearchSize as
|
5
|
-
import { getInitialInputValue as
|
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
|
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
|
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 =
|
42
|
-
(
|
41
|
+
}, Re = se(
|
42
|
+
(H, K) => {
|
43
43
|
const {
|
44
44
|
placeholder: x,
|
45
|
-
size: i =
|
46
|
-
value:
|
45
|
+
size: i = M.L,
|
46
|
+
value: c,
|
47
47
|
onChange: s,
|
48
|
-
full:
|
49
|
-
showArrow:
|
50
|
-
items:
|
51
|
-
classNameOption:
|
52
|
-
displayValue:
|
53
|
-
filterOnSearch:
|
54
|
-
onSearch:
|
55
|
-
variant:
|
56
|
-
menuPlacement:
|
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:
|
60
|
-
withChip:
|
61
|
-
chipVariant:
|
62
|
-
disableInput:
|
63
|
-
} =
|
64
|
-
() =>
|
65
|
-
), [
|
66
|
-
|
67
|
-
)
|
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 (!
|
70
|
-
const t = ((n =
|
71
|
-
return
|
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
|
-
}, [
|
75
|
-
|
76
|
-
const n =
|
77
|
-
|
78
|
-
if (
|
79
|
-
|
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
|
-
|
85
|
+
u.current.setSelectionRange(a, a);
|
82
86
|
}
|
83
87
|
}, 0);
|
84
88
|
}, L = (t) => {
|
85
|
-
if (
|
89
|
+
if (d) return;
|
86
90
|
const n = t.target.value;
|
87
|
-
|
88
|
-
const a = n.split(",").map((
|
89
|
-
(
|
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
|
-
|
92
|
-
},
|
93
|
-
const n =
|
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
|
-
|
97
|
-
}, 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
|
-
|
103
|
-
},
|
104
|
-
t.stopPropagation(),
|
105
|
-
},
|
106
|
-
|
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
|
112
|
+
return O(() => {
|
109
113
|
const t = (n) => {
|
110
|
-
|
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__ */
|
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]:
|
127
|
+
[e.full]: U,
|
124
128
|
[e.disabled]: l
|
125
129
|
}),
|
126
|
-
onChange:
|
127
|
-
ref:
|
130
|
+
onChange: Z,
|
131
|
+
ref: K,
|
128
132
|
disabled: l,
|
129
133
|
virtual: { options: A },
|
130
|
-
children: /* @__PURE__ */
|
134
|
+
children: /* @__PURE__ */ j(
|
131
135
|
"div",
|
132
136
|
{
|
133
137
|
className: r(e.container, e[i], {
|
134
|
-
[e["container-open"]]:
|
138
|
+
[e["container-open"]]: g
|
135
139
|
}),
|
136
140
|
children: [
|
137
|
-
|
141
|
+
d && /* @__PURE__ */ j("div", { className: e["input-container"], children: [
|
138
142
|
/* @__PURE__ */ o(
|
139
|
-
|
143
|
+
G,
|
140
144
|
{
|
141
145
|
disabled: l,
|
142
146
|
style: { width: "100%" },
|
143
147
|
onClick: T,
|
144
148
|
children: /* @__PURE__ */ o(
|
145
|
-
|
149
|
+
W,
|
146
150
|
{
|
147
|
-
as:
|
151
|
+
as: P,
|
148
152
|
label: x,
|
149
|
-
size:
|
153
|
+
size: E(i),
|
150
154
|
className: r(e["multi-select-input"], {
|
151
|
-
[e["multi-select-input-disabled"]]:
|
155
|
+
[e["multi-select-input-disabled"]]: d && N
|
152
156
|
}),
|
153
157
|
onChange: L,
|
154
|
-
value:
|
158
|
+
value: h,
|
155
159
|
disabled: l,
|
156
|
-
variant:
|
160
|
+
variant: z,
|
157
161
|
rightSlotClassName: e["right-slot"],
|
158
162
|
requiredMarkClassName: e["required-mark"],
|
159
163
|
"data-testid": "select-search-input",
|
160
|
-
onFocus:
|
164
|
+
onFocus: oe,
|
161
165
|
rightAddon: {
|
162
166
|
addonType: "icon",
|
163
|
-
addonContent: re(
|
167
|
+
addonContent: re(g, i)
|
164
168
|
},
|
165
169
|
...y
|
166
170
|
}
|
167
171
|
)
|
168
172
|
}
|
169
173
|
),
|
170
|
-
|
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:
|
188
|
+
onClick: ne,
|
185
189
|
"data-testid": "clear-button"
|
186
190
|
}
|
187
191
|
)
|
188
192
|
] }),
|
189
|
-
!
|
190
|
-
|
193
|
+
!d && /* @__PURE__ */ o(
|
194
|
+
W,
|
191
195
|
{
|
192
|
-
as:
|
196
|
+
as: P,
|
193
197
|
label: x,
|
194
|
-
size:
|
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:
|
202
|
+
value: h,
|
199
203
|
disabled: l,
|
200
|
-
variant:
|
201
|
-
withClearButton:
|
202
|
-
onFocus: () =>
|
203
|
-
onMouseDown:
|
204
|
+
variant: z,
|
205
|
+
withClearButton: N,
|
206
|
+
onFocus: () => _(!0),
|
207
|
+
onMouseDown: ee,
|
204
208
|
onChange: L,
|
205
|
-
ref:
|
209
|
+
ref: u,
|
206
210
|
rightAddon: {
|
207
211
|
addonType: "react-node",
|
208
|
-
addonContent:
|
209
|
-
|
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
|
-
|
219
|
+
onMouseDown: T,
|
216
220
|
children: /* @__PURE__ */ o(
|
217
221
|
le,
|
218
222
|
{
|
219
|
-
iconName: i ==
|
223
|
+
iconName: i == M.M ? "DropdownArrowBottom16px" : "DropdownArrowDown24px",
|
220
224
|
className: r(e["selector-icon"], {
|
221
|
-
[e["selector-icon-open"]]:
|
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
|
-
|
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[
|
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
|
-
|
252
|
+
Q,
|
249
253
|
i && e[i],
|
250
254
|
{
|
251
255
|
[e["option-active"]]: n
|
252
256
|
}
|
253
257
|
),
|
254
|
-
children: /* @__PURE__ */
|
255
|
-
/* @__PURE__ */
|
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:
|
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[
|
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[
|
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
|
-
|
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 ===
|
305
|
-
variant:
|
308
|
+
size: i === M.L ? "s" : "xs",
|
309
|
+
variant: Y,
|
306
310
|
className: e.chip,
|
307
311
|
withAction: !0,
|
308
|
-
onClose: () =>
|
312
|
+
onClose: () => $(t),
|
309
313
|
children: t.name
|
310
314
|
},
|
311
315
|
t.id
|