mimir-ui-kit 1.35.3 → 1.36.0
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/{Input-B-gKQ9FT.js → Input-DlGNMuUD.js} +67 -64
- package/dist/assets/Accordion.css +1 -1
- package/dist/assets/Input.css +1 -1
- package/dist/assets/ListPhotos.css +1 -1
- package/dist/assets/MultiSelectSearch.css +1 -0
- package/dist/assets/SelectSearch.css +1 -1
- package/dist/combobox-CDU06zJj.js +2855 -0
- package/dist/components/Accordion/Accordion.js +180 -174
- package/dist/components/Button/Button.d.ts +36 -0
- package/dist/components/Button/Button.js +44 -43
- package/dist/components/CheckboxMimir/CheckboxMimir.d.ts +2 -0
- package/dist/components/CheckboxMimir/CheckboxMimir.js +37 -30
- package/dist/components/Chip/Chip.d.ts +5 -1
- package/dist/components/Chip/Chip.js +23 -22
- package/dist/components/DatePicker/DatePicker.js +1 -1
- package/dist/components/Input/Input.js +1 -1
- package/dist/components/Input/index.js +1 -1
- package/dist/components/InputPassword/InputPassword.js +1 -1
- package/dist/components/InputPhoneNumber/InputPhoneNumber.js +1 -1
- package/dist/components/ListPhotos/ListPhotos.js +4 -4
- package/dist/components/MultiSelectSearch/MultiSelectSearch.d.ts +22 -0
- package/dist/components/MultiSelectSearch/MultiSelectSearch.js +318 -0
- package/dist/components/MultiSelectSearch/constants.d.ts +4 -0
- package/dist/components/MultiSelectSearch/constants.js +4 -0
- package/dist/components/MultiSelectSearch/index.d.ts +3 -0
- package/dist/components/MultiSelectSearch/index.js +6 -0
- package/dist/components/MultiSelectSearch/types.d.ts +60 -0
- package/dist/components/MultiSelectSearch/utils.d.ts +8 -0
- package/dist/components/MultiSelectSearch/utils.js +19 -0
- package/dist/components/OtpInput/OtpInput.js +1 -1
- package/dist/components/SelectSearch/SelectSearch.js +172 -3017
- package/dist/components/SelectSearch/utils.d.ts +5 -0
- package/dist/components/SelectSearch/utils.js +17 -0
- package/dist/components/Switcher/Switcher.js +48 -48
- package/dist/components/TabTrail/TabTrail.js +171 -171
- package/dist/components/TextArea/TextArea.js +1 -1
- package/dist/components/index.js +1 -1
- package/dist/index.js +1 -1
- package/dist/open-closed-CdldUPoq.js +86 -0
- package/dist/use-resolve-button-type-DhFdPxnv.js +12 -0
- package/package.json +3 -2
- package/dist/open-closed-Cy6VDfYc.js +0 -93
- package/dist/use-resolve-button-type-BAxjHhds.js +0 -19
@@ -0,0 +1,318 @@
|
|
1
|
+
import { jsxs as h, jsx as o, Fragment as q } from "react/jsx-runtime";
|
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";
|
6
|
+
import { Icon as le } from "../../icons/Icon.js";
|
7
|
+
import { Button as ae } from "../Button/Button.js";
|
8
|
+
import { CheckboxMimir as ce } from "../CheckboxMimir/CheckboxMimir.js";
|
9
|
+
import { Chip as pe } from "../Chip/Chip.js";
|
10
|
+
import { I as E } from "../../Input-DlGNMuUD.js";
|
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";
|
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
|
+
"multi-select-search": "_multi-select-search_mkspj_2",
|
15
|
+
disabled: he,
|
16
|
+
container: fe,
|
17
|
+
"container-open": "_container-open_mkspj_18",
|
18
|
+
"input-container": "_input-container_mkspj_22",
|
19
|
+
full: ke,
|
20
|
+
"selected-icon": "_selected-icon_mkspj_31",
|
21
|
+
"selector-icon-open": "_selector-icon-open_mkspj_35",
|
22
|
+
button: be,
|
23
|
+
"selector-icon": "_selector-icon_mkspj_35",
|
24
|
+
options: je,
|
25
|
+
top: ge,
|
26
|
+
bottom: ve,
|
27
|
+
"no-options": "_no-options_mkspj_90",
|
28
|
+
m: Ie,
|
29
|
+
l: Ne,
|
30
|
+
"multi-select-input-disabled": "_multi-select-input-disabled_mkspj_126",
|
31
|
+
"multi-select-input": "_multi-select-input_mkspj_126",
|
32
|
+
focused: we,
|
33
|
+
option: Ce,
|
34
|
+
"option-active": "_option-active_mkspj_148",
|
35
|
+
"option-inner": "_option-inner_mkspj_151",
|
36
|
+
"chip-container": "_chip-container_mkspj_158",
|
37
|
+
"right-slot": "_right-slot_mkspj_165",
|
38
|
+
"required-mark": "_required-mark_mkspj_170",
|
39
|
+
clear: Se,
|
40
|
+
"icon-button": "_icon-button_mkspj_184"
|
41
|
+
}, Re = ne(
|
42
|
+
(G, W) => {
|
43
|
+
const {
|
44
|
+
placeholder: x,
|
45
|
+
size: i = S.L,
|
46
|
+
value: M,
|
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",
|
57
|
+
disabled: l = !1,
|
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(() => {
|
68
|
+
var n;
|
69
|
+
if (!z) return p;
|
70
|
+
const t = ((n = d.split(",").pop()) == null ? void 0 : n.trim().toLowerCase()) ?? "";
|
71
|
+
return p.filter(
|
72
|
+
(a) => a.name.toLowerCase().includes(t)
|
73
|
+
);
|
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;
|
80
|
+
const a = n.length;
|
81
|
+
c.current.setSelectionRange(a, a);
|
82
|
+
}
|
83
|
+
}, 0);
|
84
|
+
}, L = (t) => {
|
85
|
+
if (u) return;
|
86
|
+
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])
|
90
|
+
);
|
91
|
+
j(V), s == null || s(V), m(!0);
|
92
|
+
}, Y = (t) => {
|
93
|
+
const n = _.filter(
|
94
|
+
(a) => a.id !== t.id
|
95
|
+
);
|
96
|
+
j(n), s == null || s(n), b(R(n, f));
|
97
|
+
}, T = () => m((t) => !t), Z = (t) => {
|
98
|
+
t.preventDefault(), t.currentTarget.focus();
|
99
|
+
const n = t.currentTarget.value.length;
|
100
|
+
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();
|
107
|
+
};
|
108
|
+
return se(() => {
|
109
|
+
const t = (n) => {
|
110
|
+
N.current && !N.current.contains(n.target) && !n.defaultPrevented && m(!1);
|
111
|
+
};
|
112
|
+
return document.addEventListener("mousedown", t), () => {
|
113
|
+
document.removeEventListener("mousedown", t);
|
114
|
+
};
|
115
|
+
}, []), /* @__PURE__ */ h("div", { ref: N, children: [
|
116
|
+
/* @__PURE__ */ o(
|
117
|
+
me,
|
118
|
+
{
|
119
|
+
multiple: !0,
|
120
|
+
as: "div",
|
121
|
+
value: _,
|
122
|
+
className: r(e["multi-select-search"], {
|
123
|
+
[e.full]: H,
|
124
|
+
[e.disabled]: l
|
125
|
+
}),
|
126
|
+
onChange: X,
|
127
|
+
ref: W,
|
128
|
+
disabled: l,
|
129
|
+
virtual: { options: A },
|
130
|
+
children: /* @__PURE__ */ h(
|
131
|
+
"div",
|
132
|
+
{
|
133
|
+
className: r(e.container, e[i], {
|
134
|
+
[e["container-open"]]: k
|
135
|
+
}),
|
136
|
+
children: [
|
137
|
+
u && /* @__PURE__ */ h("div", { className: e["input-container"], children: [
|
138
|
+
/* @__PURE__ */ o(
|
139
|
+
F,
|
140
|
+
{
|
141
|
+
disabled: l,
|
142
|
+
style: { width: "100%" },
|
143
|
+
onClick: T,
|
144
|
+
children: /* @__PURE__ */ o(
|
145
|
+
P,
|
146
|
+
{
|
147
|
+
as: E,
|
148
|
+
label: x,
|
149
|
+
size: O(i),
|
150
|
+
className: r(e["multi-select-input"], {
|
151
|
+
[e["multi-select-input-disabled"]]: u && I
|
152
|
+
}),
|
153
|
+
onChange: L,
|
154
|
+
value: d,
|
155
|
+
disabled: l,
|
156
|
+
variant: D,
|
157
|
+
rightSlotClassName: e["right-slot"],
|
158
|
+
requiredMarkClassName: e["required-mark"],
|
159
|
+
"data-testid": "select-search-input",
|
160
|
+
onFocus: te,
|
161
|
+
rightAddon: {
|
162
|
+
addonType: "icon",
|
163
|
+
addonContent: re(k, i)
|
164
|
+
},
|
165
|
+
...y
|
166
|
+
}
|
167
|
+
)
|
168
|
+
}
|
169
|
+
),
|
170
|
+
I && d && /* @__PURE__ */ o(
|
171
|
+
ae,
|
172
|
+
{
|
173
|
+
tabIndex: -1,
|
174
|
+
className: r(e.clear, {
|
175
|
+
[e.disabled]: l
|
176
|
+
}),
|
177
|
+
iconButtonClassName: e["icon-button"],
|
178
|
+
isIconButton: !0,
|
179
|
+
iconName: "Close16px",
|
180
|
+
size: "m-s",
|
181
|
+
clear: !0,
|
182
|
+
disabled: l,
|
183
|
+
variant: "secondary-gray",
|
184
|
+
onClick: ee,
|
185
|
+
"data-testid": "clear-button"
|
186
|
+
}
|
187
|
+
)
|
188
|
+
] }),
|
189
|
+
!u && /* @__PURE__ */ o(
|
190
|
+
P,
|
191
|
+
{
|
192
|
+
as: E,
|
193
|
+
label: x,
|
194
|
+
size: O(i),
|
195
|
+
className: e["multi-select-input"],
|
196
|
+
rightSlotClassName: e["right-slot"],
|
197
|
+
requiredMarkClassName: e["required-mark"],
|
198
|
+
value: d,
|
199
|
+
disabled: l,
|
200
|
+
variant: D,
|
201
|
+
withClearButton: I,
|
202
|
+
onFocus: () => m(!0),
|
203
|
+
onMouseDown: Z,
|
204
|
+
onChange: L,
|
205
|
+
ref: c,
|
206
|
+
rightAddon: {
|
207
|
+
addonType: "react-node",
|
208
|
+
addonContent: K && /* @__PURE__ */ o(
|
209
|
+
F,
|
210
|
+
{
|
211
|
+
className: r(e.button, {
|
212
|
+
[e.disabled]: l
|
213
|
+
}),
|
214
|
+
disabled: l,
|
215
|
+
onClick: T,
|
216
|
+
children: /* @__PURE__ */ o(
|
217
|
+
le,
|
218
|
+
{
|
219
|
+
iconName: i == S.M ? "DropdownArrowBottom16px" : "DropdownArrowDown24px",
|
220
|
+
className: r(e["selector-icon"], {
|
221
|
+
[e["selector-icon-open"]]: k
|
222
|
+
})
|
223
|
+
}
|
224
|
+
)
|
225
|
+
}
|
226
|
+
)
|
227
|
+
},
|
228
|
+
"data-testid": "select-search-input",
|
229
|
+
...y
|
230
|
+
}
|
231
|
+
),
|
232
|
+
k && /* @__PURE__ */ o(q, { children: p.length ? A.length ? /* @__PURE__ */ o(
|
233
|
+
de,
|
234
|
+
{
|
235
|
+
className: r(
|
236
|
+
e.options,
|
237
|
+
e[i],
|
238
|
+
e[v]
|
239
|
+
),
|
240
|
+
modal: !1,
|
241
|
+
static: !0,
|
242
|
+
children: ({ option: t }) => /* @__PURE__ */ o(
|
243
|
+
_e,
|
244
|
+
{
|
245
|
+
value: t,
|
246
|
+
className: ({ focus: n }) => r(
|
247
|
+
e.option,
|
248
|
+
U,
|
249
|
+
i && e[i],
|
250
|
+
{
|
251
|
+
[e["option-active"]]: n
|
252
|
+
}
|
253
|
+
),
|
254
|
+
children: /* @__PURE__ */ h(q, { children: [
|
255
|
+
/* @__PURE__ */ h("div", { className: e["option-inner"], children: [
|
256
|
+
t.name,
|
257
|
+
t.bottom && /* @__PURE__ */ o("div", { children: t.bottom })
|
258
|
+
] }),
|
259
|
+
/* @__PURE__ */ o(
|
260
|
+
ce,
|
261
|
+
{
|
262
|
+
isInteractive: !1,
|
263
|
+
checked: _.some(
|
264
|
+
(n) => n.id === t.id
|
265
|
+
)
|
266
|
+
}
|
267
|
+
)
|
268
|
+
] })
|
269
|
+
},
|
270
|
+
t.id
|
271
|
+
)
|
272
|
+
}
|
273
|
+
) : /* @__PURE__ */ o(
|
274
|
+
"div",
|
275
|
+
{
|
276
|
+
className: r(
|
277
|
+
e.options,
|
278
|
+
e[i],
|
279
|
+
e["no-options"],
|
280
|
+
e[v]
|
281
|
+
),
|
282
|
+
children: "Ничего не найдено"
|
283
|
+
}
|
284
|
+
) : /* @__PURE__ */ o(
|
285
|
+
"div",
|
286
|
+
{
|
287
|
+
className: r(
|
288
|
+
e.options,
|
289
|
+
e[i],
|
290
|
+
e["no-options"],
|
291
|
+
e[v]
|
292
|
+
),
|
293
|
+
children: "Нет данных"
|
294
|
+
}
|
295
|
+
) })
|
296
|
+
]
|
297
|
+
}
|
298
|
+
)
|
299
|
+
}
|
300
|
+
),
|
301
|
+
J && _.length > 0 && /* @__PURE__ */ o("div", { className: e["chip-container"], children: _.map((t) => /* @__PURE__ */ o(
|
302
|
+
pe,
|
303
|
+
{
|
304
|
+
size: i === S.L ? "s" : "xs",
|
305
|
+
variant: Q,
|
306
|
+
className: e.chip,
|
307
|
+
withAction: !0,
|
308
|
+
onClose: () => Y(t),
|
309
|
+
children: t.name
|
310
|
+
},
|
311
|
+
t.id
|
312
|
+
)) })
|
313
|
+
] });
|
314
|
+
}
|
315
|
+
);
|
316
|
+
export {
|
317
|
+
Re as MultiSelectSearch
|
318
|
+
};
|
@@ -0,0 +1,60 @@
|
|
1
|
+
import { ReactNode } from 'react';
|
2
|
+
import { EMultiSelectSearchSize } from './constants';
|
3
|
+
import { EChipVariant } from '../Chip';
|
4
|
+
import { TInputProps } from '../Input';
|
5
|
+
|
6
|
+
export type TMultiSelectOption = {
|
7
|
+
name: string;
|
8
|
+
id: number | string;
|
9
|
+
bottom?: ReactNode;
|
10
|
+
[index: string]: unknown;
|
11
|
+
};
|
12
|
+
export type TMenuPlacement = 'top' | 'bottom';
|
13
|
+
export type TMultiSelectSearchProps = Pick<TInputProps, 'withClearButton' | 'variant'> & {
|
14
|
+
/**
|
15
|
+
* Текущее выбранное значение.
|
16
|
+
*/
|
17
|
+
value?: TMultiSelectOption[] | null;
|
18
|
+
/**
|
19
|
+
* Функция обратного вызова при изменении выбранного значения.
|
20
|
+
*/
|
21
|
+
onChange?: (value: TMultiSelectOption[]) => void;
|
22
|
+
/**
|
23
|
+
* Текст-подсказка для поля, предназначенного для отображения выбранных значений.
|
24
|
+
*/
|
25
|
+
placeholder?: string;
|
26
|
+
/**
|
27
|
+
* Размер компонента выбора.
|
28
|
+
*/
|
29
|
+
size?: EMultiSelectSearchSize;
|
30
|
+
/**
|
31
|
+
* Флаг для растягивания компонента на всю ширину контейнера.
|
32
|
+
*/
|
33
|
+
full?: boolean;
|
34
|
+
/**
|
35
|
+
* Значение, отображаемое в поле выбора.
|
36
|
+
*/
|
37
|
+
displayValue?: string;
|
38
|
+
/** Показывать ли иконку стрелки выпадающего списка */
|
39
|
+
showArrow?: boolean;
|
40
|
+
/** Функция обратного вызова, срабатывающая при изменении поискового запроса */
|
41
|
+
onSearch?: (value: string) => void;
|
42
|
+
/** Фильтровать ли варианты на основе поискового запроса */
|
43
|
+
filterOnSearch?: boolean;
|
44
|
+
/** Значения, передаваемые в MultiSelectSearch */
|
45
|
+
items: TMultiSelectOption[];
|
46
|
+
/** Класснейм для значения */
|
47
|
+
classNameOption?: string;
|
48
|
+
/** Варианты отображения выпадающего меню */
|
49
|
+
menuPlacement?: TMenuPlacement;
|
50
|
+
/** Отключает компонент MultiSelectSearch */
|
51
|
+
disabled?: boolean;
|
52
|
+
/** Пропсы для инпута поиска опций */
|
53
|
+
searchProps?: Pick<TInputProps, 'numbersOnly' | 'maxLength' | 'required'>;
|
54
|
+
/** Отображать ли компонент Chip под MultiSelectSearch */
|
55
|
+
withChip?: boolean;
|
56
|
+
/** Вариант Chip*/
|
57
|
+
chipVariant?: EChipVariant | `${EChipVariant}`;
|
58
|
+
/** Отключает инпут, но позволяет открывать меню*/
|
59
|
+
disableInput?: boolean;
|
60
|
+
};
|
@@ -0,0 +1,8 @@
|
|
1
|
+
import { EMultiSelectSearchSize } from './constants';
|
2
|
+
import { TMultiSelectOption } from './types';
|
3
|
+
import { EInputSize } from '../Input';
|
4
|
+
|
5
|
+
export declare const mapSizeToInputSize: (size: EMultiSelectSearchSize) => EInputSize;
|
6
|
+
export declare const getDropdownArrowIcon: (isOpen: boolean, size: EMultiSelectSearchSize) => "DropdownArrowBottom16px" | "DropdownArrowUp24px" | "DropdownArrowDown24px" | "DropdownArrowUp16px";
|
7
|
+
export declare const getInitialInputValue: (value: TMultiSelectOption[] | undefined | null, displayValue: string) => string;
|
8
|
+
export declare const joinSelectedItems: (items: TMultiSelectOption[], displayValue: string) => string;
|
@@ -0,0 +1,19 @@
|
|
1
|
+
import { EMultiSelectSearchSize as t } from "./constants.js";
|
2
|
+
import "../../Input-DlGNMuUD.js";
|
3
|
+
import { EInputSize as e } from "../Input/constants.js";
|
4
|
+
const w = (r) => {
|
5
|
+
switch (r) {
|
6
|
+
case t.M:
|
7
|
+
return e.M;
|
8
|
+
case t.L:
|
9
|
+
return e.L;
|
10
|
+
default:
|
11
|
+
return e.M;
|
12
|
+
}
|
13
|
+
}, c = (r, o) => r ? o === t.L ? "DropdownArrowUp24px" : "DropdownArrowUp16px" : o === t.L ? "DropdownArrowDown24px" : "DropdownArrowBottom16px", m = (r, o) => r && r.length > 0 ? r.map((n) => n[o]).join(", ") + ", " : "", a = (r, o) => r.map((n) => n[o]).join(", ") + (r.length ? ", " : "");
|
14
|
+
export {
|
15
|
+
c as getDropdownArrowIcon,
|
16
|
+
m as getInitialInputValue,
|
17
|
+
a as joinSelectedItems,
|
18
|
+
w as mapSizeToInputSize
|
19
|
+
};
|
@@ -3,7 +3,7 @@ import { c as u } from "../../index-DIxK0V-G.js";
|
|
3
3
|
import { forwardRef as P, useImperativeHandle as R, Fragment as T } from "react";
|
4
4
|
import { ITEMS_PER_SEPARATOR as q, DEFAULT_VALUE_LENGTH as v } from "./constants.js";
|
5
5
|
import { useOTPInput as y } from "./hooks.js";
|
6
|
-
import { I as A } from "../../Input-
|
6
|
+
import { I as A } from "../../Input-DlGNMuUD.js";
|
7
7
|
import '../../assets/OtpInput.css';const C = "_otp_1shq3_3", F = "_input_1shq3_14", L = "_separator_1shq3_28", r = {
|
8
8
|
otp: C,
|
9
9
|
"input-wrapper": "_input-wrapper_1shq3_14",
|