mimir-ui-kit 1.34.6 → 1.34.7
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/{ProgressBar-C0dC7o7N.js → ProgressBar-DEFs1tWq.js} +3 -3
- package/dist/components/Drawer/Drawer.js +15 -15
- package/dist/components/InputPassword/InputPassword.js +28 -26
- package/dist/components/OtpInput/OtpInput.js +21 -15
- package/dist/components/SelectSearch/SelectSearch.d.ts +1 -0
- package/dist/components/SelectSearch/SelectSearch.js +531 -503
- package/dist/components/SelectSearch/types.d.ts +2 -0
- package/dist/components/Skeleton/SkeletonBrick/SkeletonBrick.js +14 -13
- package/dist/components/Skeleton/SkeletonCircle/SkeletonCircle.js +2 -1
- package/dist/components/Skeleton/SkeletonText/SkeletonText.js +26 -17
- package/dist/components/Slider/Slider.js +8 -1
- package/dist/components/Steps/Steps.js +10 -9
- package/dist/components/TextArea/TextArea.js +23 -23
- package/dist/components/Toasts/ProgressBar.js +1 -1
- package/dist/components/Toasts/Toast.js +1 -1
- package/dist/components/Toasts/ToastList.js +20 -19
- package/dist/components/Toasts/ToastsProvider.js +1 -1
- package/dist/components/UniversalUploader/UniversalUploader.d.ts +7 -2
- package/dist/components/UniversalUploader/UniversalUploader.js +65 -43
- package/dist/components/UniversalUploader/types.d.ts +2 -9
- package/dist/components/Uploader/Uploader.d.ts +13 -0
- package/dist/components/Uploader/Uploader.js +45 -39
- package/package.json +1 -1
@@ -50,4 +50,6 @@ export type TSelectSearchProps = Pick<TInputProps, 'withClearButton' | 'variant'
|
|
50
50
|
disabled?: boolean;
|
51
51
|
/** Пропсы для инпута поиска опций */
|
52
52
|
searchProps?: Pick<TInputProps, 'numbersOnly' | 'maxLength'>;
|
53
|
+
/** Отключает инпут, но позволяет открывать меню*/
|
54
|
+
disableInput?: boolean;
|
53
55
|
};
|
@@ -2,31 +2,32 @@ import { jsx as l } from "react/jsx-runtime";
|
|
2
2
|
import { c as n } from "../../../index-DIxK0V-G.js";
|
3
3
|
import { ESkeletonVariant as c } from "../constants.js";
|
4
4
|
import { v as r } from "../../../variant.module-BXn4N1h0.js";
|
5
|
-
const
|
6
|
-
className:
|
7
|
-
width:
|
5
|
+
const v = ({
|
6
|
+
className: t,
|
7
|
+
width: o = "100%",
|
8
8
|
height: s,
|
9
9
|
borderRadius: a = "var(--mimir-control-radius)",
|
10
|
-
style:
|
11
|
-
variant:
|
12
|
-
...
|
10
|
+
style: e,
|
11
|
+
variant: i = c.WHITE,
|
12
|
+
...m
|
13
13
|
}) => /* @__PURE__ */ l(
|
14
14
|
"div",
|
15
15
|
{
|
16
|
-
...
|
16
|
+
...m,
|
17
17
|
className: n(
|
18
18
|
r.skeleton,
|
19
|
-
r[
|
20
|
-
|
19
|
+
r[i],
|
20
|
+
t
|
21
21
|
),
|
22
22
|
style: {
|
23
|
-
...
|
24
|
-
width:
|
23
|
+
...e,
|
24
|
+
width: o,
|
25
25
|
height: s,
|
26
26
|
borderRadius: a
|
27
|
-
}
|
27
|
+
},
|
28
|
+
"data-testid": "skeleton-brick"
|
28
29
|
}
|
29
30
|
);
|
30
31
|
export {
|
31
|
-
|
32
|
+
v as SkeletonBrick
|
32
33
|
};
|
@@ -1,12 +1,12 @@
|
|
1
|
-
import { jsx as
|
1
|
+
import { jsx as s } from "react/jsx-runtime";
|
2
2
|
import { c } from "../../../index-DIxK0V-G.js";
|
3
|
-
import { memo as
|
4
|
-
import { ESkeletonVariant as
|
5
|
-
import { SkeletonBrick as
|
6
|
-
import '../../../assets/SkeletonText.css';const
|
3
|
+
import { memo as i } from "react";
|
4
|
+
import { ESkeletonVariant as m } from "../constants.js";
|
5
|
+
import { SkeletonBrick as k } from "../SkeletonBrick/SkeletonBrick.js";
|
6
|
+
import '../../../assets/SkeletonText.css';const d = "_row_1ks6f_9", o = {
|
7
7
|
"skeleton-text": "_skeleton-text_1ks6f_2",
|
8
|
-
row:
|
9
|
-
},
|
8
|
+
row: d
|
9
|
+
}, f = (t, e) => {
|
10
10
|
if (t === e - 1)
|
11
11
|
return "50%";
|
12
12
|
switch (t % 3) {
|
@@ -19,23 +19,32 @@ import '../../../assets/SkeletonText.css';const k = "_row_1ks6f_9", s = {
|
|
19
19
|
default:
|
20
20
|
return "100%";
|
21
21
|
}
|
22
|
-
}, N =
|
22
|
+
}, N = i(
|
23
23
|
({
|
24
24
|
rows: t = 1,
|
25
25
|
height: e = 20,
|
26
|
-
variant: n =
|
26
|
+
variant: n = m.WHITE,
|
27
27
|
...a
|
28
28
|
}) => {
|
29
29
|
const { className: l } = a;
|
30
|
-
return /* @__PURE__ */
|
31
|
-
|
30
|
+
return /* @__PURE__ */ s(
|
31
|
+
"div",
|
32
32
|
{
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
33
|
+
className: c(o["skeleton-text"], l),
|
34
|
+
"data-testid": "skeleton-text",
|
35
|
+
children: new Array(t).fill(null).map((u, r) => /* @__PURE__ */ s("div", { className: o.row, children: /* @__PURE__ */ s(
|
36
|
+
k,
|
37
|
+
{
|
38
|
+
variant: n,
|
39
|
+
height: e,
|
40
|
+
width: f(r, t),
|
41
|
+
style: { animationDelay: `${r * 0.125}s` },
|
42
|
+
"data-testid": "skeleton-brick"
|
43
|
+
}
|
44
|
+
) }, r))
|
45
|
+
},
|
46
|
+
t
|
47
|
+
);
|
39
48
|
}
|
40
49
|
);
|
41
50
|
export {
|
@@ -2919,7 +2919,14 @@ const Li = "_swiper_1ji90_3", Oi = "_slide_1ji90_9", _i = "_link_1ji90_16", zi =
|
|
2919
2919
|
);
|
2920
2920
|
return /* @__PURE__ */ R(Qe, { buttons: s });
|
2921
2921
|
}), $i = Ae(
|
2922
|
-
Te((t, e) => /* @__PURE__ */ R("div", { className: $.progress, children: /* @__PURE__ */ R(
|
2922
|
+
Te((t, e) => /* @__PURE__ */ R("div", { className: $.progress, children: /* @__PURE__ */ R(
|
2923
|
+
"div",
|
2924
|
+
{
|
2925
|
+
ref: e,
|
2926
|
+
className: $["progress-bar"],
|
2927
|
+
"data-testid": "progress-bar"
|
2928
|
+
}
|
2929
|
+
) }))
|
2923
2930
|
);
|
2924
2931
|
function qi({
|
2925
2932
|
images: t,
|
@@ -21,9 +21,9 @@ import '../../assets/Steps.css';const ee = "_container_1cq8d_2", oe = "_step_1cq
|
|
21
21
|
stepClassName: Z,
|
22
22
|
quantity: z,
|
23
23
|
needZeroValue: O = !0,
|
24
|
-
current:
|
24
|
+
current: d = A,
|
25
25
|
editable: q = !1,
|
26
|
-
size:
|
26
|
+
size: _ = K.M,
|
27
27
|
onClick: f,
|
28
28
|
customSize: p,
|
29
29
|
resizable: i,
|
@@ -36,10 +36,10 @@ import '../../assets/Steps.css';const ee = "_container_1cq8d_2", oe = "_step_1cq
|
|
36
36
|
setParentColor: u,
|
37
37
|
classNameIconStep: $,
|
38
38
|
...w
|
39
|
-
} = T, B = G(), [t, m] = N(
|
39
|
+
} = T, B = G(), [t, m] = N(d), [a, L] = N(null), b = J(null), [I, h] = N(null);
|
40
40
|
C(() => {
|
41
|
-
m(
|
42
|
-
}, [
|
41
|
+
m(d);
|
42
|
+
}, [d]), C(() => {
|
43
43
|
if (c) {
|
44
44
|
const o = r.find((e) => e.to >= (t || 0));
|
45
45
|
o && h(o.color);
|
@@ -79,7 +79,7 @@ import '../../assets/Steps.css';const ee = "_container_1cq8d_2", oe = "_step_1cq
|
|
79
79
|
height: p == null ? void 0 : p.height
|
80
80
|
},
|
81
81
|
id: `${B}${R}${e}`,
|
82
|
-
className: y(l.step, l[
|
82
|
+
className: y(l.step, l[_], Z, {
|
83
83
|
[l.editable]: q && !M,
|
84
84
|
[l.resizable]: i,
|
85
85
|
[l.disabled]: M || !q && e + 1 > t
|
@@ -90,9 +90,10 @@ import '../../assets/Steps.css';const ee = "_container_1cq8d_2", oe = "_step_1cq
|
|
90
90
|
children: !i && /* @__PURE__ */ E(
|
91
91
|
x,
|
92
92
|
{
|
93
|
-
iconName: Q[
|
94
|
-
...U[
|
95
|
-
className:
|
93
|
+
iconName: Q[_].icon,
|
94
|
+
...U[_],
|
95
|
+
className: $,
|
96
|
+
"data-testid": "step-icon"
|
96
97
|
}
|
97
98
|
)
|
98
99
|
},
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { jsxs as V, jsx as n } from "react/jsx-runtime";
|
2
|
-
import { c as
|
2
|
+
import { c as i } from "../../index-DIxK0V-G.js";
|
3
3
|
import { memo as K, forwardRef as Q, useState as B, useRef as U, useEffect as X } from "react";
|
4
4
|
import { useAutoResizeTextArea as Y } from "./hooks.js";
|
5
5
|
import { useMergeRefs as Z } from "../../hooks/useMergeRefs/useMergeRefs.js";
|
@@ -29,7 +29,7 @@ import '../../assets/TextArea.css';const te = "_textarea_1n8kz_2", se = "_label_
|
|
29
29
|
$,
|
30
30
|
{
|
31
31
|
style: {
|
32
|
-
"--icon-size":
|
32
|
+
"--icon-size": i({
|
33
33
|
"16px": _,
|
34
34
|
"24px": b
|
35
35
|
})
|
@@ -54,11 +54,11 @@ import '../../assets/TextArea.css';const te = "_textarea_1n8kz_2", se = "_label_
|
|
54
54
|
variant: q = ae.DefaultGray,
|
55
55
|
autofocus: k,
|
56
56
|
readonly: s,
|
57
|
-
status:
|
58
|
-
id:
|
57
|
+
status: R,
|
58
|
+
id: T,
|
59
59
|
onFocus: N,
|
60
60
|
onBlur: z,
|
61
|
-
label:
|
61
|
+
label: d,
|
62
62
|
onChange: c,
|
63
63
|
withClearButton: j,
|
64
64
|
disabled: u,
|
@@ -71,26 +71,26 @@ import '../../assets/TextArea.css';const te = "_textarea_1n8kz_2", se = "_label_
|
|
71
71
|
X(() => {
|
72
72
|
k && C(!0);
|
73
73
|
}, [k]);
|
74
|
-
const
|
74
|
+
const I = Y(r.current), M = (l) => {
|
75
75
|
const y = l.currentTarget.value;
|
76
76
|
z == null || z(l), C(!1), v(!!y);
|
77
77
|
}, O = (l) => {
|
78
78
|
s || (C(!0), N == null || N(l));
|
79
79
|
}, P = () => {
|
80
|
-
r != null && r.current && (r.current.value = "", r.current.focus(), v(!1),
|
80
|
+
r != null && r.current && (r.current.value = "", r.current.focus(), v(!1), I(), c == null || c({
|
81
81
|
target: { value: "" }
|
82
82
|
}));
|
83
83
|
}, S = (l) => {
|
84
84
|
const y = l.target.value;
|
85
|
-
v(!!y),
|
85
|
+
v(!!y), I(), c == null || c(l);
|
86
86
|
}, x = F(L), A = F(E), W = {
|
87
87
|
[e.readonly]: u || s,
|
88
88
|
[e.focused]: f,
|
89
89
|
[e.disabled]: u || s,
|
90
90
|
[e["has-left-slot"]]: !!x,
|
91
91
|
[e["has-right-slot"]]: !!A,
|
92
|
-
[a["has-label"]]: !!
|
93
|
-
}, w = f || h || !!o, H =
|
92
|
+
[a["has-label"]]: !!d
|
93
|
+
}, w = f || h || !!o, H = i(
|
94
94
|
e.label,
|
95
95
|
a.label,
|
96
96
|
{
|
@@ -100,21 +100,21 @@ import '../../assets/TextArea.css';const te = "_textarea_1n8kz_2", se = "_label_
|
|
100
100
|
},
|
101
101
|
_,
|
102
102
|
e[m]
|
103
|
-
), J =
|
103
|
+
), J = i(
|
104
104
|
a.textarea,
|
105
105
|
e.input,
|
106
106
|
W,
|
107
107
|
_,
|
108
|
-
[e[q], a[m], e[m], e[
|
108
|
+
[e[q], a[m], e[m], e[R ?? ""]]
|
109
109
|
);
|
110
110
|
return /* @__PURE__ */ V(
|
111
111
|
"div",
|
112
112
|
{
|
113
|
-
className:
|
113
|
+
className: i(
|
114
114
|
e["input-wrapper"],
|
115
115
|
a["textarea-wrapper"],
|
116
116
|
e[q],
|
117
|
-
e[
|
117
|
+
e[R ?? ""],
|
118
118
|
a[m],
|
119
119
|
e[m],
|
120
120
|
{
|
@@ -124,8 +124,8 @@ import '../../assets/TextArea.css';const te = "_textarea_1n8kz_2", se = "_label_
|
|
124
124
|
b
|
125
125
|
),
|
126
126
|
children: [
|
127
|
-
|
128
|
-
|
127
|
+
d && /* @__PURE__ */ V("label", { htmlFor: T, className: H, children: [
|
128
|
+
d,
|
129
129
|
g && (h || f) && /* @__PURE__ */ n(
|
130
130
|
"span",
|
131
131
|
{
|
@@ -137,11 +137,11 @@ import '../../assets/TextArea.css';const te = "_textarea_1n8kz_2", se = "_label_
|
|
137
137
|
x && /* @__PURE__ */ n(
|
138
138
|
"span",
|
139
139
|
{
|
140
|
-
className:
|
140
|
+
className: i(e["left-slot"], {
|
141
141
|
[e.focused]: w,
|
142
|
-
[e["has-label"]]: !!
|
142
|
+
[e["has-label"]]: !!d
|
143
143
|
}),
|
144
|
-
"data-
|
144
|
+
"data-testid": "left-addon",
|
145
145
|
children: x
|
146
146
|
}
|
147
147
|
),
|
@@ -149,7 +149,7 @@ import '../../assets/TextArea.css';const te = "_textarea_1n8kz_2", se = "_label_
|
|
149
149
|
"textarea",
|
150
150
|
{
|
151
151
|
ref: G,
|
152
|
-
id:
|
152
|
+
id: T,
|
153
153
|
className: J,
|
154
154
|
onFocus: O,
|
155
155
|
onBlur: M,
|
@@ -163,11 +163,11 @@ import '../../assets/TextArea.css';const te = "_textarea_1n8kz_2", se = "_label_
|
|
163
163
|
A && /* @__PURE__ */ n(
|
164
164
|
"span",
|
165
165
|
{
|
166
|
-
className:
|
166
|
+
className: i(e["right-slot"], {
|
167
167
|
[e.focused]: w,
|
168
|
-
[e["has-label"]]: !!
|
168
|
+
[e["has-label"]]: !!d
|
169
169
|
}),
|
170
|
-
"data-
|
170
|
+
"data-testid": "right-addon",
|
171
171
|
children: A
|
172
172
|
}
|
173
173
|
),
|
@@ -2,7 +2,7 @@ import { jsxs as l, jsx as t } from "react/jsx-runtime";
|
|
2
2
|
import { c as A } from "../../index-DIxK0V-G.js";
|
3
3
|
import { memo as x, useRef as E } from "react";
|
4
4
|
import { ANIMATION_VARIABLES_MAP as I, EToastPosition as _, EToastVariant as B, DEFAULT_TOAST_DURATION as D } from "./constants.js";
|
5
|
-
import { c as r, P as O } from "../../ProgressBar-
|
5
|
+
import { c as r, P as O } from "../../ProgressBar-DEFs1tWq.js";
|
6
6
|
import { useTimer as P } from "../../hooks/useTimer/index.js";
|
7
7
|
import { Button as w } from "../Button/Button.js";
|
8
8
|
const M = x(
|
@@ -1,32 +1,33 @@
|
|
1
1
|
import { jsx as m } from "react/jsx-runtime";
|
2
|
-
import { c as
|
3
|
-
import { memo as
|
4
|
-
import { EToastPosition as
|
5
|
-
import { c as
|
6
|
-
import { Toast as
|
7
|
-
const O =
|
8
|
-
({ toasts:
|
9
|
-
const t =
|
2
|
+
import { c as a } from "../../index-DIxK0V-G.js";
|
3
|
+
import { memo as e, useRef as f, useCallback as T, useEffect as u } from "react";
|
4
|
+
import { EToastPosition as i } from "./constants.js";
|
5
|
+
import { c as l } from "../../ProgressBar-DEFs1tWq.js";
|
6
|
+
import { Toast as d } from "./Toast.js";
|
7
|
+
const O = e(
|
8
|
+
({ toasts: r, position: s = i.TOP_RIGHT, onToastRemove: n }) => {
|
9
|
+
const t = f(null), c = T(
|
10
10
|
(o) => {
|
11
11
|
[
|
12
|
-
|
13
|
-
|
14
|
-
].includes(
|
12
|
+
i.TOP_LEFT,
|
13
|
+
i.TOP_RIGHT
|
14
|
+
].includes(s) ? o == null || o.scrollTo(0, o.scrollHeight) : o == null || o.scrollTo(0, 0);
|
15
15
|
},
|
16
|
-
[
|
16
|
+
[s]
|
17
17
|
);
|
18
18
|
return u(() => {
|
19
|
-
t.current &&
|
20
|
-
}, [
|
19
|
+
t.current && c(t.current);
|
20
|
+
}, [c, r]), r.length ? /* @__PURE__ */ m(
|
21
21
|
"div",
|
22
22
|
{
|
23
23
|
ref: t,
|
24
|
-
className:
|
25
|
-
|
26
|
-
|
24
|
+
className: a(l["toast-list"], l[s]),
|
25
|
+
"data-testid": "toast-list",
|
26
|
+
children: r.map((o) => /* @__PURE__ */ m(
|
27
|
+
d,
|
27
28
|
{
|
28
|
-
position:
|
29
|
-
onToastRemove:
|
29
|
+
position: s,
|
30
|
+
onToastRemove: n,
|
30
31
|
...o
|
31
32
|
},
|
32
33
|
o.id
|
@@ -3,7 +3,7 @@ import { useReducer as u, useCallback as m, useMemo as l } from "react";
|
|
3
3
|
import { EToastVariant as o } from "./constants.js";
|
4
4
|
import { ToastContext as E } from "./hooks.js";
|
5
5
|
import { reducer as A, initialState as C, actionCreators as c } from "./store.js";
|
6
|
-
import { c as L } from "../../ProgressBar-
|
6
|
+
import { c as L } from "../../ProgressBar-DEFs1tWq.js";
|
7
7
|
import { ToastList as S } from "./ToastList.js";
|
8
8
|
const O = ({ children: d }) => {
|
9
9
|
const [i, r] = u(A, C), a = m((t) => {
|
@@ -1,3 +1,8 @@
|
|
1
|
-
import {
|
1
|
+
import { TFilesDetail } from '../ListFiles/ListFiles';
|
2
|
+
import { TPhotosDetail } from '../ListPhotos/ListPhotos';
|
2
3
|
|
3
|
-
export declare const UniversalUploader: import('react').ForwardRefExoticComponent<
|
4
|
+
export declare const UniversalUploader: import('react').ForwardRefExoticComponent<Omit<import('../Uploader/Uploader').TUploader, "onChangeValue"> & {
|
5
|
+
type: "files" | "photos" | "all";
|
6
|
+
onChange: (j: import('./types').TOnChangeUpdate) => void;
|
7
|
+
value?: TFilesDetail[] | TPhotosDetail[];
|
8
|
+
} & import('react').RefAttributes<HTMLDivElement>>;
|
@@ -1,31 +1,36 @@
|
|
1
|
-
import { jsxs as
|
2
|
-
import { c as
|
3
|
-
import { forwardRef as
|
4
|
-
import { imageTypes as
|
1
|
+
import { jsxs as y, jsx as p, Fragment as j } from "react/jsx-runtime";
|
2
|
+
import { c as B } from "../../index-DIxK0V-G.js";
|
3
|
+
import { forwardRef as D, useState as N, useEffect as S, useMemo as T } from "react";
|
4
|
+
import { imageTypes as h } from "./constants.js";
|
5
|
+
import "../Button/Button.js";
|
6
|
+
import { EButtonVariantDefault as V } from "../Button/constants.js";
|
5
7
|
import { ListFiles as _ } from "../ListFiles/ListFiles.js";
|
6
|
-
import { ListPhotos as
|
8
|
+
import { ListPhotos as E } from "../ListPhotos/ListPhotos.js";
|
7
9
|
import { Uploader as M } from "../Uploader/Uploader.js";
|
8
|
-
import '../../assets/UploaderPhotos.css';const
|
10
|
+
import '../../assets/UploaderPhotos.css';const g = {
|
9
11
|
"upload-file-wrapper": "_upload-file-wrapper_1a115_2"
|
10
|
-
},
|
11
|
-
(i,
|
12
|
+
}, f = (i) => "file" in i && i.file instanceof File ? h.includes(i.file.type) : "type" in i && typeof i.type == "string" ? h.includes(i.type) : !1, K = D(
|
13
|
+
(i, v) => {
|
12
14
|
const {
|
13
15
|
type: s,
|
14
|
-
filesType:
|
15
|
-
arrayName:
|
16
|
-
maxSize:
|
17
|
-
onChange:
|
18
|
-
value:
|
16
|
+
filesType: x,
|
17
|
+
arrayName: F,
|
18
|
+
maxSize: U,
|
19
|
+
onChange: o,
|
20
|
+
value: a,
|
19
21
|
maxFiles: m,
|
20
|
-
titleUploader:
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
22
|
+
titleUploader: w,
|
23
|
+
buttonText: z = "Выберите файлы",
|
24
|
+
showOnlyUploadButton: u = !1,
|
25
|
+
uploadButtonVariant: b = V.SecondaryAsphalt
|
26
|
+
} = i, [l, n] = N(
|
27
|
+
a || []
|
28
|
+
), d = l.length >= m;
|
29
|
+
S(() => {
|
30
|
+
a && n(a);
|
31
|
+
}, [a]);
|
32
|
+
const I = (t) => {
|
33
|
+
const r = t.value.map((e) => f(e.file) ? {
|
29
34
|
id: e.id,
|
30
35
|
url: URL.createObjectURL(e.file),
|
31
36
|
type: e.file.type,
|
@@ -38,41 +43,58 @@ import '../../assets/UploaderPhotos.css';const y = {
|
|
38
43
|
name: e.file.name,
|
39
44
|
type: e.file.type
|
40
45
|
});
|
41
|
-
|
42
|
-
},
|
43
|
-
|
44
|
-
}, { photos:
|
45
|
-
const t = () =>
|
46
|
-
return s === "all" ? { files: t(), photos:
|
47
|
-
}, [
|
48
|
-
return /* @__PURE__ */
|
46
|
+
n((e) => [...e, ...r]), o == null || o({ type: "add", data: t.value });
|
47
|
+
}, c = (t) => {
|
48
|
+
n((r) => r.filter((e) => e.id !== t)), o == null || o({ type: "delete", data: t });
|
49
|
+
}, { photos: L, files: R } = T(() => {
|
50
|
+
const t = () => l.filter((e) => !f(e)), r = () => l.filter(f);
|
51
|
+
return s === "all" ? { files: t(), photos: r() } : s === "files" ? { photos: [], files: t() } : s === "photos" ? { files: [], photos: r() } : { files: [], photos: [] };
|
52
|
+
}, [l, s]);
|
53
|
+
return /* @__PURE__ */ y(
|
49
54
|
"div",
|
50
55
|
{
|
51
|
-
className:
|
52
|
-
|
53
|
-
d &&
|
56
|
+
className: B(
|
57
|
+
g["upload-file-wrapper"],
|
58
|
+
d && g.disabled
|
54
59
|
),
|
55
60
|
children: [
|
56
|
-
/* @__PURE__ */
|
61
|
+
/* @__PURE__ */ p(
|
57
62
|
M,
|
58
63
|
{
|
59
|
-
filesType:
|
60
|
-
arrayName:
|
61
|
-
maxSize:
|
62
|
-
onChangeValue:
|
63
|
-
ref:
|
64
|
+
filesType: x,
|
65
|
+
arrayName: F,
|
66
|
+
maxSize: U,
|
67
|
+
onChangeValue: I,
|
68
|
+
ref: v,
|
64
69
|
maxFiles: m,
|
65
70
|
isDisabled: d,
|
66
|
-
titleUploader:
|
71
|
+
titleUploader: w,
|
72
|
+
showOnlyUploadButton: u,
|
73
|
+
buttonText: z,
|
74
|
+
uploadButtonVariant: b
|
67
75
|
}
|
68
76
|
),
|
69
|
-
|
70
|
-
|
77
|
+
!u && /* @__PURE__ */ y(j, { children: [
|
78
|
+
(s === "files" || s === "all") && /* @__PURE__ */ p(
|
79
|
+
_,
|
80
|
+
{
|
81
|
+
value: R,
|
82
|
+
onChange: (t) => c(t.deleteId)
|
83
|
+
}
|
84
|
+
),
|
85
|
+
(s === "photos" || s === "all") && /* @__PURE__ */ p(
|
86
|
+
E,
|
87
|
+
{
|
88
|
+
value: L,
|
89
|
+
onChange: (t) => c(t.deleteId)
|
90
|
+
}
|
91
|
+
)
|
92
|
+
] })
|
71
93
|
]
|
72
94
|
}
|
73
95
|
);
|
74
96
|
}
|
75
97
|
);
|
76
98
|
export {
|
77
|
-
|
99
|
+
K as UniversalUploader
|
78
100
|
};
|
@@ -1,18 +1,11 @@
|
|
1
1
|
import { TFilesDetail } from '../ListFiles/ListFiles';
|
2
2
|
import { TPhotosDetail } from '../ListPhotos/ListPhotos';
|
3
|
-
import { TFileItem } from '../Uploader';
|
4
|
-
import { imageTypesArr } from '../Uploader/constants';
|
3
|
+
import { TFileItem, TUploader } from '../Uploader';
|
5
4
|
|
6
|
-
export type TUniversalUploader = {
|
5
|
+
export type TUniversalUploader = Omit<TUploader, 'onChangeValue'> & {
|
7
6
|
type: 'files' | 'photos' | 'all';
|
8
|
-
filesType: imageTypesArr[];
|
9
|
-
arrayName: string;
|
10
|
-
maxSize: number;
|
11
7
|
onChange: (j: TOnChangeUpdate) => void;
|
12
8
|
value?: TFilesDetail[] | TPhotosDetail[];
|
13
|
-
maxFiles: number;
|
14
|
-
titleUploader?: string;
|
15
|
-
disabled?: boolean;
|
16
9
|
};
|
17
10
|
export type TOnChangeUpdate = {
|
18
11
|
type: string;
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import { default as React } from 'react';
|
2
2
|
import { imageTypesArr } from './constants';
|
3
|
+
import { TButtonDefaultFormProps } from '../Button/types';
|
3
4
|
|
4
5
|
export type TUploader = {
|
5
6
|
/**
|
@@ -31,6 +32,18 @@ export type TUploader = {
|
|
31
32
|
* Тайтл загрузки файлов
|
32
33
|
*/
|
33
34
|
titleUploader?: string;
|
35
|
+
/**
|
36
|
+
* Отображать ли только кнопку загрузки файла
|
37
|
+
*/
|
38
|
+
showOnlyUploadButton?: boolean;
|
39
|
+
/**
|
40
|
+
* Текст внутри кнопки загрузки файла
|
41
|
+
*/
|
42
|
+
buttonText?: string;
|
43
|
+
/**
|
44
|
+
* Вариант кнопки загрузки файла
|
45
|
+
*/
|
46
|
+
uploadButtonVariant?: TButtonDefaultFormProps['variant'];
|
34
47
|
};
|
35
48
|
export type TUploadValue = {
|
36
49
|
value: TFileItem[];
|