mimir-ui-kit 1.38.1 → 1.38.3
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/assets/SelectSearch.css +1 -1
- package/dist/{combobox-CVtJDVoZ.js → combobox-DgSZTriw.js} +254 -251
- package/dist/components/Accordion/Accordion.js +3 -3
- package/dist/components/CheckboxMimir/CheckboxMimir.js +4 -4
- package/dist/components/DatePicker/hooks.js +12 -12
- package/dist/components/Dropdown/Dropdown.js +32 -32
- package/dist/components/MultiSelectSearch/MultiSelectSearch.js +18 -18
- package/dist/components/RadioGroup/RadioGroup.js +3 -3
- package/dist/components/SelectSearch/SelectSearch.js +116 -116
- package/dist/components/Switcher/Switcher.js +4 -4
- package/dist/components/TabTrail/TabTrail.js +4 -4
- package/dist/components/UniversalUploader/UniversalUploader.js +56 -50
- package/dist/components/Uploader/Uploader.d.ts +12 -0
- package/dist/components/Uploader/Uploader.js +64 -59
- package/dist/components/UploaderFiles/UploaderFiles.d.ts +12 -0
- package/dist/components/UploaderFiles/UploaderFiles.js +45 -39
- package/dist/components/UploaderPhotos/UploaderPhotos.d.ts +12 -0
- package/dist/components/UploaderPhotos/UploaderPhotos.js +40 -34
- package/dist/{field-FJ34aSs4.js → field-C1kt7aNM.js} +2 -2
- package/dist/{focus-management-DE4t_lW3.js → focus-management-BtPpk3D1.js} +1 -1
- package/dist/{hidden-DbgtYPOH.js → hidden-PvGXrYUY.js} +1 -1
- package/dist/{keyboard-B0lm_zyn.js → keyboard-mgWkd2Vh.js} +114 -111
- package/dist/{label-y3ANLTNC.js → label-D4GFpe5F.js} +2 -2
- package/dist/open-closed-D2VjDhAN.js +86 -0
- package/dist/portal-DPqg52FR.js +1946 -0
- package/dist/{use-active-press-86hajhdd.js → use-active-press-CqLGIFz7.js} +1 -1
- package/package.json +1 -1
- package/dist/open-closed-CdldUPoq.js +0 -86
- package/dist/portal-WDFNoIMz.js +0 -1908
@@ -1,140 +1,140 @@
|
|
1
|
-
import { jsx as
|
2
|
-
import { c } from "../../index-DIxK0V-G.js";
|
3
|
-
import { forwardRef as U, useState as
|
4
|
-
import { ESelectSearchSize as
|
5
|
-
import { mapSizeToInputSize as
|
6
|
-
import { Icon as
|
7
|
-
import { Button as
|
8
|
-
import { I as
|
1
|
+
import { jsx as l, jsxs as u, Fragment as D } from "react/jsx-runtime";
|
2
|
+
import { c as i } from "../../index-DIxK0V-G.js";
|
3
|
+
import { forwardRef as U, useState as j, useMemo as R, useCallback as $, useEffect as J } from "react";
|
4
|
+
import { ESelectSearchSize as N } from "./constants.js";
|
5
|
+
import { mapSizeToInputSize as q, getDropdownArrowIcon as Q } from "./utils.js";
|
6
|
+
import { Icon as A } from "../../icons/Icon.js";
|
7
|
+
import { Button as W } from "../Button/Button.js";
|
8
|
+
import { I as O } from "../../Input-BYrIS5GU.js";
|
9
9
|
import { EInputVariant as X } from "../Input/constants.js";
|
10
|
-
import { H as Y, U as
|
11
|
-
import '../../assets/SelectSearch.css';const te = "
|
12
|
-
"select-search": "_select-
|
10
|
+
import { H as Y, U as B, G as M, K as Z, j as ee } from "../../combobox-DgSZTriw.js";
|
11
|
+
import '../../assets/SelectSearch.css';const te = "_disabled_7klny_6", oe = "_container_7klny_13", ne = "_full_7klny_28", se = "_button_7klny_40", le = "_options_7klny_54", ae = "_top_7klny_65", ie = "_bottom_7klny_71", re = "_m_7klny_98", ce = "_l_7klny_113", de = "_option_7klny_54", pe = "_clear_7klny_167", e = {
|
12
|
+
"select-search": "_select-search_7klny_2",
|
13
13
|
disabled: te,
|
14
14
|
container: oe,
|
15
|
-
"container-open": "_container-
|
15
|
+
"container-open": "_container-open_7klny_24",
|
16
16
|
full: ne,
|
17
|
-
"selected-icon": "_selected-
|
18
|
-
"selector-icon-open": "_selector-icon-
|
17
|
+
"selected-icon": "_selected-icon_7klny_32",
|
18
|
+
"selector-icon-open": "_selector-icon-open_7klny_36",
|
19
19
|
button: se,
|
20
|
-
"selector-icon": "_selector-
|
21
|
-
options:
|
22
|
-
top:
|
23
|
-
bottom:
|
24
|
-
"no-options": "_no-
|
25
|
-
m:
|
26
|
-
l:
|
27
|
-
"select-input": "_select-
|
28
|
-
"select-input-disabled": "_select-input-
|
20
|
+
"selector-icon": "_selector-icon_7klny_36",
|
21
|
+
options: le,
|
22
|
+
top: ae,
|
23
|
+
bottom: ie,
|
24
|
+
"no-options": "_no-options_7klny_77",
|
25
|
+
m: re,
|
26
|
+
l: ce,
|
27
|
+
"select-input": "_select-input_7klny_128",
|
28
|
+
"select-input-disabled": "_select-input-disabled_7klny_131",
|
29
29
|
option: de,
|
30
|
-
"option-active": "_option-
|
31
|
-
"option-inner": "_option-
|
32
|
-
"right-slot": "_right-
|
33
|
-
"required-mark": "_required-
|
30
|
+
"option-active": "_option-active_7klny_147",
|
31
|
+
"option-inner": "_option-inner_7klny_150",
|
32
|
+
"right-slot": "_right-slot_7klny_157",
|
33
|
+
"required-mark": "_required-mark_7klny_162",
|
34
34
|
clear: pe,
|
35
|
-
"icon-button": "_icon-
|
36
|
-
},
|
35
|
+
"icon-button": "_icon-button_7klny_176"
|
36
|
+
}, ge = U(
|
37
37
|
(E, L) => {
|
38
38
|
const {
|
39
|
-
placeholder:
|
40
|
-
size:
|
39
|
+
placeholder: v,
|
40
|
+
size: a = N.L,
|
41
41
|
value: n,
|
42
42
|
onChange: s,
|
43
43
|
full: V,
|
44
|
-
showArrow:
|
44
|
+
showArrow: g = !0,
|
45
45
|
items: p = [],
|
46
46
|
classNameOption: F,
|
47
47
|
displayValue: G = "name",
|
48
|
-
filterOnSearch:
|
48
|
+
filterOnSearch: w = !0,
|
49
49
|
onSearch: _,
|
50
|
-
variant:
|
51
|
-
menuPlacement:
|
52
|
-
disabled:
|
53
|
-
searchProps:
|
54
|
-
withClearButton:
|
55
|
-
disableInput:
|
56
|
-
autocomplete:
|
50
|
+
variant: C = X.DefaultGray,
|
51
|
+
menuPlacement: y = "bottom",
|
52
|
+
disabled: r = !1,
|
53
|
+
searchProps: I,
|
54
|
+
withClearButton: f = !1,
|
55
|
+
disableInput: c = !1,
|
56
|
+
autocomplete: S = "on",
|
57
57
|
immediate: P = !1
|
58
|
-
} = E,
|
58
|
+
} = E, b = String((n == null ? void 0 : n[G]) || ""), [d, m] = j(b), [k, h] = j(n), x = R(() => !w || n && (n.id || n.name) ? p : d.trim().toLowerCase() ? p.filter(
|
59
59
|
(o) => o.name.toLowerCase().includes(d.toLowerCase())
|
60
|
-
) : p, [d, p, n,
|
60
|
+
) : p, [d, p, n, w]), T = (o) => {
|
61
61
|
o ? (m(o.name), h(o), s == null || s(o)) : (m(""), h(null), s == null || s({ id: "", name: "" }));
|
62
|
-
},
|
62
|
+
}, z = $(
|
63
63
|
(o) => {
|
64
|
-
if (
|
64
|
+
if (c) return;
|
65
65
|
const t = o.target.value;
|
66
66
|
m(t), _ == null || _(t), !t && n && (s == null || s({ id: "", name: "" }));
|
67
67
|
},
|
68
|
-
[
|
68
|
+
[c, s, _, n]
|
69
69
|
), H = () => {
|
70
70
|
m(""), h(null), s == null || s({ id: "", name: "" });
|
71
71
|
};
|
72
|
-
return
|
72
|
+
return J(() => {
|
73
73
|
const o = !n || typeof n == "object" && !Object.keys(n).length;
|
74
|
-
m(o ? "" :
|
75
|
-
}, [n,
|
74
|
+
m(o ? "" : b), h(o ? null : n);
|
75
|
+
}, [n, b]), /* @__PURE__ */ l(
|
76
76
|
Y,
|
77
77
|
{
|
78
78
|
as: "div",
|
79
|
-
value:
|
80
|
-
className:
|
79
|
+
value: k,
|
80
|
+
className: i(e["select-search"], {
|
81
81
|
[e.full]: V,
|
82
|
-
[e.disabled]:
|
82
|
+
[e.disabled]: r
|
83
83
|
}),
|
84
84
|
onChange: T,
|
85
85
|
ref: L,
|
86
|
-
disabled:
|
87
|
-
virtual: { options:
|
86
|
+
disabled: r,
|
87
|
+
virtual: { options: x },
|
88
88
|
immediate: P,
|
89
|
-
children: ({ open: o }) => /* @__PURE__ */ u(
|
89
|
+
children: ({ open: o }) => /* @__PURE__ */ u(D, { children: [
|
90
90
|
/* @__PURE__ */ u(
|
91
91
|
"div",
|
92
92
|
{
|
93
|
-
className:
|
93
|
+
className: i(e.container, e[a], {
|
94
94
|
[e["container-open"]]: o
|
95
95
|
}),
|
96
96
|
children: [
|
97
|
-
|
98
|
-
/* @__PURE__ */
|
99
|
-
|
97
|
+
c && /* @__PURE__ */ u("div", { style: { position: "relative", width: "100%" }, children: [
|
98
|
+
/* @__PURE__ */ l(B, { disabled: r, style: { width: "100%" }, children: /* @__PURE__ */ l(
|
99
|
+
M,
|
100
100
|
{
|
101
|
-
as:
|
102
|
-
label:
|
103
|
-
size:
|
104
|
-
className:
|
105
|
-
[e["select-input-disabled"]]:
|
101
|
+
as: O,
|
102
|
+
label: v,
|
103
|
+
size: q(a),
|
104
|
+
className: i(e["select-input"], {
|
105
|
+
[e["select-input-disabled"]]: c && f
|
106
106
|
}),
|
107
|
-
onChange:
|
107
|
+
onChange: z,
|
108
108
|
value: d,
|
109
|
-
disabled:
|
110
|
-
variant:
|
109
|
+
disabled: r,
|
110
|
+
variant: C,
|
111
111
|
rightSlotClassName: e["right-slot"],
|
112
112
|
requiredMarkClassName: e["required-mark"],
|
113
113
|
"data-testid": "select-search-input",
|
114
114
|
onFocus: (t) => {
|
115
|
-
|
115
|
+
c && t.target.blur();
|
116
116
|
},
|
117
117
|
rightAddon: {
|
118
118
|
addonType: "icon",
|
119
|
-
addonContent:
|
119
|
+
addonContent: Q(o, a)
|
120
120
|
},
|
121
|
-
autocomplete:
|
122
|
-
...
|
121
|
+
autocomplete: S,
|
122
|
+
...I
|
123
123
|
}
|
124
124
|
) }),
|
125
|
-
|
126
|
-
|
125
|
+
f && d && /* @__PURE__ */ l(
|
126
|
+
W,
|
127
127
|
{
|
128
128
|
tabIndex: -1,
|
129
|
-
className:
|
130
|
-
[e.disabled]:
|
129
|
+
className: i(e.clear, {
|
130
|
+
[e.disabled]: r
|
131
131
|
}),
|
132
132
|
iconButtonClassName: e["icon-button"],
|
133
133
|
isIconButton: !0,
|
134
134
|
iconName: "Close16px",
|
135
135
|
size: "m-s",
|
136
136
|
clear: !0,
|
137
|
-
disabled:
|
137
|
+
disabled: r,
|
138
138
|
variant: "secondary-gray",
|
139
139
|
onClick: (t) => {
|
140
140
|
t.stopPropagation(), H();
|
@@ -143,35 +143,35 @@ import '../../assets/SelectSearch.css';const te = "_disabled_5nqc2_6", oe = "_co
|
|
143
143
|
}
|
144
144
|
)
|
145
145
|
] }),
|
146
|
-
!
|
147
|
-
|
146
|
+
!c && /* @__PURE__ */ l(
|
147
|
+
M,
|
148
148
|
{
|
149
|
-
as:
|
150
|
-
label:
|
151
|
-
size:
|
149
|
+
as: O,
|
150
|
+
label: v,
|
151
|
+
size: q(a),
|
152
152
|
className: e["select-input"],
|
153
|
-
onChange:
|
153
|
+
onChange: z,
|
154
154
|
value: d,
|
155
|
-
disabled:
|
156
|
-
variant:
|
157
|
-
withClearButton:
|
155
|
+
disabled: r,
|
156
|
+
variant: C,
|
157
|
+
withClearButton: f,
|
158
158
|
rightSlotClassName: e["right-slot"],
|
159
159
|
requiredMarkClassName: e["required-mark"],
|
160
160
|
"data-testid": "select-search-input",
|
161
|
-
rightAddon:
|
161
|
+
rightAddon: g ? {
|
162
162
|
addonType: "react-node",
|
163
|
-
addonContent:
|
164
|
-
|
163
|
+
addonContent: g && /* @__PURE__ */ l(
|
164
|
+
B,
|
165
165
|
{
|
166
|
-
className:
|
167
|
-
[e.disabled]:
|
166
|
+
className: i(e.button, {
|
167
|
+
[e.disabled]: r
|
168
168
|
}),
|
169
|
-
disabled:
|
170
|
-
children: /* @__PURE__ */
|
171
|
-
|
169
|
+
disabled: r,
|
170
|
+
children: /* @__PURE__ */ l(
|
171
|
+
A,
|
172
172
|
{
|
173
|
-
iconName:
|
174
|
-
className:
|
173
|
+
iconName: a == N.M ? "DropdownArrowBottom16px" : "DropdownArrowDown24px",
|
174
|
+
className: i(e["selector-icon"], {
|
175
175
|
[e["selector-icon-open"]]: o
|
176
176
|
})
|
177
177
|
}
|
@@ -180,32 +180,32 @@ import '../../assets/SelectSearch.css';const te = "_disabled_5nqc2_6", oe = "_co
|
|
180
180
|
)
|
181
181
|
} : void 0,
|
182
182
|
onFocus: (t) => {
|
183
|
-
|
183
|
+
c && t.target.blur();
|
184
184
|
},
|
185
|
-
autocomplete:
|
186
|
-
...
|
185
|
+
autocomplete: S,
|
186
|
+
...I
|
187
187
|
}
|
188
188
|
)
|
189
189
|
]
|
190
190
|
}
|
191
191
|
),
|
192
|
-
o && /* @__PURE__ */
|
192
|
+
o && /* @__PURE__ */ l(D, { children: p.length ? x.length ? /* @__PURE__ */ l(
|
193
193
|
Z,
|
194
194
|
{
|
195
195
|
"data-testid": "select-search-options",
|
196
|
-
className:
|
196
|
+
className: i(
|
197
197
|
e.options,
|
198
|
-
e[
|
199
|
-
e[
|
198
|
+
e[a],
|
199
|
+
e[y]
|
200
200
|
),
|
201
201
|
children: ({ option: t }) => /* @__PURE__ */ u(
|
202
202
|
ee,
|
203
203
|
{
|
204
204
|
value: t,
|
205
|
-
className: ({ focus: K }) =>
|
205
|
+
className: ({ focus: K }) => i(
|
206
206
|
e.option,
|
207
207
|
F,
|
208
|
-
|
208
|
+
a && e[a],
|
209
209
|
{
|
210
210
|
[e["option-active"]]: K
|
211
211
|
}
|
@@ -214,12 +214,12 @@ import '../../assets/SelectSearch.css';const te = "_disabled_5nqc2_6", oe = "_co
|
|
214
214
|
children: [
|
215
215
|
/* @__PURE__ */ u("div", { className: e["option-inner"], children: [
|
216
216
|
t.name,
|
217
|
-
t.bottom && /* @__PURE__ */
|
217
|
+
t.bottom && /* @__PURE__ */ l("div", { children: t.bottom })
|
218
218
|
] }),
|
219
|
-
|
220
|
-
|
219
|
+
k && k.id === t.id && /* @__PURE__ */ l(
|
220
|
+
A,
|
221
221
|
{
|
222
|
-
iconName:
|
222
|
+
iconName: a === N.M ? "Done16px" : "Done24px",
|
223
223
|
className: e["selected-icon"]
|
224
224
|
}
|
225
225
|
)
|
@@ -228,25 +228,25 @@ import '../../assets/SelectSearch.css';const te = "_disabled_5nqc2_6", oe = "_co
|
|
228
228
|
t.id
|
229
229
|
)
|
230
230
|
}
|
231
|
-
) : /* @__PURE__ */
|
231
|
+
) : /* @__PURE__ */ l(
|
232
232
|
"div",
|
233
233
|
{
|
234
|
-
className:
|
234
|
+
className: i(
|
235
235
|
e.options,
|
236
|
-
e[
|
236
|
+
e[a],
|
237
237
|
e["no-options"],
|
238
|
-
e[
|
238
|
+
e[y]
|
239
239
|
),
|
240
240
|
children: "Ничего не найдено"
|
241
241
|
}
|
242
|
-
) : /* @__PURE__ */
|
242
|
+
) : /* @__PURE__ */ l(
|
243
243
|
"div",
|
244
244
|
{
|
245
|
-
className:
|
245
|
+
className: i(
|
246
246
|
e.options,
|
247
|
-
e[
|
247
|
+
e[a],
|
248
248
|
e["no-options"],
|
249
|
-
e[
|
249
|
+
e[y]
|
250
250
|
),
|
251
251
|
children: "Нет данных"
|
252
252
|
}
|
@@ -257,5 +257,5 @@ import '../../assets/SelectSearch.css';const te = "_disabled_5nqc2_6", oe = "_co
|
|
257
257
|
}
|
258
258
|
);
|
259
259
|
export {
|
260
|
-
|
260
|
+
ge as SelectSearch
|
261
261
|
};
|
@@ -1,9 +1,9 @@
|
|
1
1
|
import { jsxs as L, jsx as N } from "react/jsx-runtime";
|
2
|
-
import { H as te } from "../../field-
|
3
|
-
import { K as I, w as re, z as se, U as ae, u as ce, a as le, b as oe, T as ie, I as ne, G as ue, j as he, p as me } from "../../label-
|
4
|
-
import { W as de, H as j, y as pe, p as fe, o as $, $ as be, b as we, D as _e, c as H } from "../../keyboard-
|
2
|
+
import { H as te } from "../../field-C1kt7aNM.js";
|
3
|
+
import { K as I, w as re, z as se, U as ae, u as ce, a as le, b as oe, T as ie, I as ne, G as ue, j as he, p as me } from "../../label-D4GFpe5F.js";
|
4
|
+
import { W as de, H as j, y as pe, p as fe, o as $, $ as be, b as we, D as _e, c as H } from "../../keyboard-mgWkd2Vh.js";
|
5
5
|
import u, { createContext as $e, useState as x, useMemo as G, useId as ge, useContext as ve, useRef as ke, useCallback as xe, Fragment as ye, forwardRef as Pe } from "react";
|
6
|
-
import { w as Ce } from "../../use-active-press-
|
6
|
+
import { w as Ce } from "../../use-active-press-CqLGIFz7.js";
|
7
7
|
import { e as De } from "../../use-resolve-button-type-DhFdPxnv.js";
|
8
8
|
import { r as Fe } from "../../bugs-diTMAGNw.js";
|
9
9
|
import { c as g } from "../../index-DIxK0V-G.js";
|
@@ -6,11 +6,11 @@ import { ETabTrailSize as Ae } from "./constants.js";
|
|
6
6
|
import { TabButtons as Se } from "./TabButtons/TabButtons.js";
|
7
7
|
import { ETabTrailButtonVariant as Fe } from "./TabButtons/constants.js";
|
8
8
|
import { NotificationBadge as De } from "../NotificationBadge/NotificationBadge.js";
|
9
|
-
import { n as W, M as se, W as V, s as j, y as q, o as A, H as z, $ as ce, b as Ne, D as de, a as G, u as Re, c as T, t as Me } from "../../keyboard-
|
10
|
-
import { w as Ce } from "../../use-active-press-
|
9
|
+
import { n as W, M as se, W as V, s as j, y as q, o as A, H as z, $ as ce, b as Ne, D as de, a as G, u as Re, c as T, t as Me } from "../../keyboard-mgWkd2Vh.js";
|
10
|
+
import { w as Ce } from "../../use-active-press-CqLGIFz7.js";
|
11
11
|
import { e as Le } from "../../use-resolve-button-type-DhFdPxnv.js";
|
12
|
-
import { T as pe, s as Oe } from "../../hidden-
|
13
|
-
import { _ as B, T as J, P as N, F as I } from "../../focus-management-
|
12
|
+
import { T as pe, s as Oe } from "../../hidden-PvGXrYUY.js";
|
13
|
+
import { _ as B, T as J, P as N, F as I } from "../../focus-management-BtPpk3D1.js";
|
14
14
|
import '../../assets/TabTrail.css';function Be() {
|
15
15
|
let e = U(!1);
|
16
16
|
return W(() => (e.current = !0, () => {
|
@@ -1,40 +1,43 @@
|
|
1
1
|
import { jsxs as h, jsx as p, Fragment as j } from "react/jsx-runtime";
|
2
2
|
import { c as B } from "../../index-DIxK0V-G.js";
|
3
|
-
import { forwardRef as D, useState as
|
3
|
+
import { forwardRef as D, useState as _, useEffect as C, useMemo as O } from "react";
|
4
4
|
import { imageTypes as y } from "./constants.js";
|
5
5
|
import "../Button/Button.js";
|
6
|
-
import { EButtonVariantDefault as
|
7
|
-
import { ListFiles as
|
8
|
-
import { EFileItemVariant as
|
9
|
-
import { ListPhotos as
|
10
|
-
import { Uploader as
|
6
|
+
import { EButtonVariantDefault as P } from "../Button/constants.js";
|
7
|
+
import { ListFiles as A } from "../ListFiles/ListFiles.js";
|
8
|
+
import { EFileItemVariant as k } from "../ListFiles/constants.js";
|
9
|
+
import { ListPhotos as q } from "../ListPhotos/ListPhotos.js";
|
10
|
+
import { Uploader as G } from "../Uploader/Uploader.js";
|
11
11
|
import '../../assets/UploaderPhotos.css';const v = {
|
12
12
|
"upload-file-wrapper": "_upload-file-wrapper_1a115_2"
|
13
|
-
}, f = (i) => "file" in i && i.file instanceof File ? y.includes(i.file.type) : "type" in i && typeof i.type == "string" ? y.includes(i.type) : !1,
|
14
|
-
(i,
|
13
|
+
}, f = (i) => "file" in i && i.file instanceof File ? y.includes(i.file.type) : "type" in i && typeof i.type == "string" ? y.includes(i.type) : !1, te = D(
|
14
|
+
(i, x) => {
|
15
15
|
const {
|
16
16
|
type: a,
|
17
|
-
filesType:
|
18
|
-
arrayName:
|
19
|
-
maxSize:
|
17
|
+
filesType: F,
|
18
|
+
arrayName: g,
|
19
|
+
maxSize: w,
|
20
20
|
onChange: s,
|
21
|
-
value:
|
22
|
-
maxFiles:
|
23
|
-
titleUploader:
|
24
|
-
buttonText:
|
25
|
-
showOnlyUploadButton:
|
26
|
-
uploadButtonVariant:
|
21
|
+
value: r,
|
22
|
+
maxFiles: d,
|
23
|
+
titleUploader: z,
|
24
|
+
buttonText: U = "Выберите файлы",
|
25
|
+
showOnlyUploadButton: m = !1,
|
26
|
+
uploadButtonVariant: b = P.SecondaryAsphalt,
|
27
27
|
buttonSize: I = "m",
|
28
|
-
buttonClassName:
|
29
|
-
variantListFiles:
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
28
|
+
buttonClassName: E,
|
29
|
+
variantListFiles: L = k.white,
|
30
|
+
onMaxFilesExceeded: S,
|
31
|
+
onMaxSizeExceeded: V,
|
32
|
+
onInvalidFileType: M
|
33
|
+
} = i, [l, n] = _(
|
34
|
+
r || []
|
35
|
+
), u = l.length >= d;
|
36
|
+
C(() => {
|
37
|
+
r && n(r);
|
38
|
+
}, [r]);
|
36
39
|
const N = (t) => {
|
37
|
-
const
|
40
|
+
const o = t.value.map((e) => f(e.file) ? {
|
38
41
|
id: e.id,
|
39
42
|
url: URL.createObjectURL(e.file),
|
40
43
|
type: e.file.type,
|
@@ -47,12 +50,12 @@ import '../../assets/UploaderPhotos.css';const v = {
|
|
47
50
|
name: e.file.name,
|
48
51
|
type: e.file.type
|
49
52
|
});
|
50
|
-
n((e) => [...e, ...
|
53
|
+
n((e) => [...e, ...o]), s == null || s({ type: "add", data: t.value });
|
51
54
|
}, c = (t) => {
|
52
|
-
n((
|
53
|
-
}, { photos: R, files:
|
54
|
-
const t = () => l.filter((e) => !f(e)),
|
55
|
-
return a === "all" ? { files: t(), photos:
|
55
|
+
n((o) => o.filter((e) => e.id !== t)), s == null || s({ type: "delete", data: t });
|
56
|
+
}, { photos: R, files: T } = O(() => {
|
57
|
+
const t = () => l.filter((e) => !f(e)), o = () => l.filter(f);
|
58
|
+
return a === "all" ? { files: t(), photos: o() } : a === "files" ? { photos: [], files: t() } : a === "photos" ? { files: [], photos: o() } : { files: [], photos: [] };
|
56
59
|
}, [l, a]);
|
57
60
|
return /* @__PURE__ */ h(
|
58
61
|
"div",
|
@@ -60,38 +63,41 @@ import '../../assets/UploaderPhotos.css';const v = {
|
|
60
63
|
"data-testid": "universal-uploader",
|
61
64
|
className: B(
|
62
65
|
v["upload-file-wrapper"],
|
63
|
-
|
66
|
+
u && v.disabled
|
64
67
|
),
|
65
68
|
children: [
|
66
69
|
/* @__PURE__ */ p(
|
67
|
-
|
70
|
+
G,
|
68
71
|
{
|
69
|
-
filesType:
|
70
|
-
arrayName:
|
71
|
-
maxSize:
|
72
|
+
filesType: F,
|
73
|
+
arrayName: g,
|
74
|
+
maxSize: w,
|
72
75
|
onChangeValue: N,
|
73
|
-
ref:
|
74
|
-
maxFiles:
|
75
|
-
isDisabled:
|
76
|
-
titleUploader:
|
77
|
-
showOnlyUploadButton:
|
78
|
-
buttonText:
|
79
|
-
uploadButtonVariant:
|
76
|
+
ref: x,
|
77
|
+
maxFiles: d,
|
78
|
+
isDisabled: u,
|
79
|
+
titleUploader: z,
|
80
|
+
showOnlyUploadButton: m,
|
81
|
+
buttonText: U,
|
82
|
+
uploadButtonVariant: b,
|
80
83
|
buttonSize: I,
|
81
|
-
buttonClassName:
|
84
|
+
buttonClassName: E,
|
85
|
+
onMaxFilesExceeded: S,
|
86
|
+
onMaxSizeExceeded: V,
|
87
|
+
onInvalidFileType: M
|
82
88
|
}
|
83
89
|
),
|
84
|
-
!
|
90
|
+
!m && /* @__PURE__ */ h(j, { children: [
|
85
91
|
(a === "files" || a === "all") && /* @__PURE__ */ p(
|
86
|
-
|
92
|
+
A,
|
87
93
|
{
|
88
|
-
value:
|
94
|
+
value: T,
|
89
95
|
onChange: (t) => c(t.deleteId),
|
90
|
-
variant:
|
96
|
+
variant: L
|
91
97
|
}
|
92
98
|
),
|
93
99
|
(a === "photos" || a === "all") && /* @__PURE__ */ p(
|
94
|
-
|
100
|
+
q,
|
95
101
|
{
|
96
102
|
value: R,
|
97
103
|
onChange: (t) => c(t.deleteId)
|
@@ -104,5 +110,5 @@ import '../../assets/UploaderPhotos.css';const v = {
|
|
104
110
|
}
|
105
111
|
);
|
106
112
|
export {
|
107
|
-
|
113
|
+
te as UniversalUploader
|
108
114
|
};
|
@@ -53,6 +53,18 @@ export type TUploader = {
|
|
53
53
|
* Класс для кнопки
|
54
54
|
*/
|
55
55
|
buttonClassName?: string;
|
56
|
+
/**
|
57
|
+
* Проп для обработки ошибки при превышении максимального количества файлов
|
58
|
+
*/
|
59
|
+
onMaxFilesExceeded?: () => void;
|
60
|
+
/**
|
61
|
+
* Проп для обработки ошибки при превышении максимального размера файла
|
62
|
+
*/
|
63
|
+
onMaxSizeExceeded?: (fileName: string) => void;
|
64
|
+
/**
|
65
|
+
* Проп для обработки ошибки при загрузке файла неразрешенного типа
|
66
|
+
*/
|
67
|
+
onInvalidFileType?: (fileName: string) => void;
|
56
68
|
};
|
57
69
|
export type TUploadValue = {
|
58
70
|
value: TFileItem[];
|