mimir-ui-kit 1.38.26 → 1.38.28
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/{Input-CQ7LgZWK.js → Input-DAmc_HxO.js} +5 -5
- package/dist/assets/UploaderFiles.css +1 -0
- 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/ListFiles/ListFiles.d.ts +5 -1
- package/dist/components/ListFiles/ListFiles.js +21 -20
- package/dist/components/MultiSelectSearch/MultiSelectSearch.js +1 -1
- package/dist/components/MultiSelectSearch/utils.js +1 -1
- package/dist/components/OtpInput/OtpInput.js +1 -1
- package/dist/components/SelectSearch/SelectSearch.js +1 -1
- package/dist/components/SelectSearch/utils.js +1 -1
- package/dist/components/TextArea/TextArea.js +1 -1
- package/dist/components/Uploader/Uploader.js +43 -43
- package/dist/components/UploaderFiles/UploaderFiles.d.ts +1 -57
- package/dist/components/UploaderFiles/UploaderFiles.js +81 -65
- package/dist/components/UploaderFiles/constants.d.ts +4 -0
- package/dist/components/UploaderFiles/constants.js +4 -0
- package/dist/components/UploaderFiles/index.d.ts +2 -1
- package/dist/components/UploaderFiles/index.js +4 -2
- package/dist/components/UploaderFiles/types.d.ts +75 -0
- package/dist/components/index.d.ts +2 -2
- package/dist/components/index.js +88 -86
- package/dist/index.js +114 -112
- package/package.json +1 -1
@@ -76,7 +76,7 @@ import './assets/Input.css';const ne = "_label_1y1tj_27", oe = "_input_1y1tj_3",
|
|
76
76
|
label: u,
|
77
77
|
withClearButton: M,
|
78
78
|
disabled: a,
|
79
|
-
onChange:
|
79
|
+
onChange: d,
|
80
80
|
rightAddon: O,
|
81
81
|
status: F,
|
82
82
|
leftAddon: S,
|
@@ -86,7 +86,7 @@ import './assets/Input.css';const ne = "_label_1y1tj_27", oe = "_input_1y1tj_3",
|
|
86
86
|
maxLength: v,
|
87
87
|
autocomplete: G = "on",
|
88
88
|
...P
|
89
|
-
} = t, [_, I] = B(g), [f, h] = B(!!l),
|
89
|
+
} = t, [_, I] = B(g), [f, h] = B(!!l), i = te(null), W = se(i, m);
|
90
90
|
R(() => {
|
91
91
|
g && I(!0);
|
92
92
|
}, [g]), R(() => {
|
@@ -98,12 +98,12 @@ import './assets/Input.css';const ne = "_label_1y1tj_27", oe = "_input_1y1tj_3",
|
|
98
98
|
}, J = (r) => {
|
99
99
|
c || (I(!0), N == null || N(r));
|
100
100
|
}, K = () => {
|
101
|
-
|
102
|
-
target:
|
101
|
+
i != null && i.current && (i.current.value = "", i.current.focus(), h(!1), d == null || d({
|
102
|
+
target: i.current
|
103
103
|
}));
|
104
104
|
}, Q = (r) => {
|
105
105
|
let n = r.target.value;
|
106
|
-
T && (n = n.replace(/\D/g, "")), v !== void 0 && (n = n.slice(0, v)), r.target.value = n,
|
106
|
+
T && (n = n.replace(/\D/g, "")), v !== void 0 && (n = n.slice(0, v)), r.target.value = n, d == null || d(r), h(!!n);
|
107
107
|
}, y = z(S), b = z(O), U = {
|
108
108
|
[e.readonly]: a || c,
|
109
109
|
[e.focused]: _,
|
@@ -0,0 +1 @@
|
|
1
|
+
._container_aj93w_2{display:flex;flex-direction:column;gap:var(--mimir-space-m);padding:var(--mimir-space-4xl) var(--mimir-space-xl);overflow:hidden;border:var(--mimir-control-border-width) dashed var(--black-20);border-radius:var(--mimir-control-radius-s)}._container_aj93w_2._white_aj93w_11{background-color:var(--white)}._container_aj93w_2._gray_aj93w_14{background-color:var(--black-5)}._container_aj93w_2._compact_aj93w_17{padding:var(--mimir-space-xl) var(--mimir-space-m)}
|
@@ -10,7 +10,7 @@ import { YearPickerModal as at } from "./YearPickerModal.js";
|
|
10
10
|
import { useClickOutside as mt } from "../../hooks/useClickOutside/useClickOutside.js";
|
11
11
|
import { Icon as X } from "../../icons/Icon.js";
|
12
12
|
import { formating as l } from "../../utils/index.js";
|
13
|
-
import { I as pt } from "../../Input-
|
13
|
+
import { I as pt } from "../../Input-DAmc_HxO.js";
|
14
14
|
import { EInputStatus as dt, EInputSize as E } from "../Input/constants.js";
|
15
15
|
const ft = {
|
16
16
|
days: ot,
|
@@ -2,7 +2,7 @@ import "react/jsx-runtime";
|
|
2
2
|
import "../../index-DIxK0V-G.js";
|
3
3
|
import "react";
|
4
4
|
import "./constants.js";
|
5
|
-
import { I as f } from "../../Input-
|
5
|
+
import { I as f } from "../../Input-DAmc_HxO.js";
|
6
6
|
import "../../hooks/useMergeRefs/useMergeRefs.js";
|
7
7
|
import "../../icons/Icon.js";
|
8
8
|
import "../Button/Button.js";
|
@@ -3,7 +3,7 @@ import { c } from "../../index-DIxK0V-G.js";
|
|
3
3
|
import { memo as w, forwardRef as u, useState as m } from "react";
|
4
4
|
import { Icon as d } from "../../icons/Icon.js";
|
5
5
|
import { Button as _ } from "../Button/Button.js";
|
6
|
-
import { I as l } from "../../Input-
|
6
|
+
import { I as l } from "../../Input-DAmc_HxO.js";
|
7
7
|
import '../../assets/InputPassword.css';const b = "_input_7b9x2_2", x = "_wrapper_7b9x2_6", h = "_button_7b9x2_17", f = "_icon_7b9x2_33", N = "_show_7b9x2_38", t = {
|
8
8
|
input: b,
|
9
9
|
wrapper: x,
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { jsx as d } from "react/jsx-runtime";
|
2
2
|
import { memo as I, forwardRef as i, useState as c, useCallback as f, useImperativeHandle as P } from "react";
|
3
3
|
import { getMaskedInputPhoneValue as m, getUnmaskedInputValue as o } from "./utils.js";
|
4
|
-
import { I as b } from "../../Input-
|
4
|
+
import { I as b } from "../../Input-DAmc_HxO.js";
|
5
5
|
const h = I(
|
6
6
|
i(
|
7
7
|
({ value: s = "", onChange: e, ...p }, a) => {
|
@@ -17,6 +17,10 @@ export type TListFiles = {
|
|
17
17
|
* Вариант отображения файла
|
18
18
|
*/
|
19
19
|
variant?: EFileItemVariant | `${EFileItemVariant}`;
|
20
|
+
/**
|
21
|
+
* Блок удаления файлов
|
22
|
+
*/
|
23
|
+
disabled?: boolean;
|
20
24
|
};
|
21
25
|
export type TFileItem = {
|
22
26
|
id: number;
|
@@ -33,4 +37,4 @@ export type TFilesDetail = {
|
|
33
37
|
size?: number;
|
34
38
|
type?: string;
|
35
39
|
};
|
36
|
-
export declare function ListFiles({ value, onChange, classNameWrapper, variant }: TListFiles): import("react/jsx-runtime").JSX.Element | null;
|
40
|
+
export declare function ListFiles({ value, onChange, classNameWrapper, variant, disabled }: TListFiles): import("react/jsx-runtime").JSX.Element | null;
|
@@ -1,10 +1,10 @@
|
|
1
1
|
import { jsx as t, jsxs as r } from "react/jsx-runtime";
|
2
|
-
import { c as
|
3
|
-
import { useState as
|
4
|
-
import { EFileItemVariant as
|
5
|
-
import { formating as
|
6
|
-
import { Button as
|
7
|
-
import '../../assets/ListFiles.css';const
|
2
|
+
import { c as d } from "../../index-DIxK0V-G.js";
|
3
|
+
import { useState as u, useEffect as w } from "react";
|
4
|
+
import { EFileItemVariant as g } from "./constants.js";
|
5
|
+
import { formating as N } from "../../utils/index.js";
|
6
|
+
import { Button as h } from "../Button/Button.js";
|
7
|
+
import '../../assets/ListFiles.css';const z = "_white_wnnpg_58", y = "_gray_wnnpg_63", e = {
|
8
8
|
"file-info": "_file-info_wnnpg_2",
|
9
9
|
"file-info-size": "_file-info-size_wnnpg_8",
|
10
10
|
"file-info-name-wrapper": "_file-info-name-wrapper_wnnpg_16",
|
@@ -12,27 +12,28 @@ import '../../assets/ListFiles.css';const h = "_white_wnnpg_58", z = "_gray_wnnp
|
|
12
12
|
"file-upload-container": "_file-upload-container_wnnpg_34",
|
13
13
|
"file-upload-container-item": "_file-upload-container-item_wnnpg_42",
|
14
14
|
"delete-button": "_delete-button_wnnpg_51",
|
15
|
-
white:
|
16
|
-
gray:
|
15
|
+
white: z,
|
16
|
+
gray: y
|
17
17
|
};
|
18
|
-
function
|
18
|
+
function B({
|
19
19
|
value: o,
|
20
20
|
onChange: s,
|
21
21
|
classNameWrapper: f,
|
22
|
-
variant: c =
|
22
|
+
variant: c = g.white,
|
23
|
+
disabled: m
|
23
24
|
}) {
|
24
|
-
const [a, l] =
|
25
|
-
|
25
|
+
const [a, l] = u(o);
|
26
|
+
w(() => {
|
26
27
|
l(o);
|
27
28
|
}, [o]);
|
28
|
-
const
|
29
|
-
const n = [...a.filter((
|
29
|
+
const p = async (i) => {
|
30
|
+
const n = [...a.filter((_) => _.id !== i)];
|
30
31
|
l(n), s == null || s({ deleteId: i, list: n });
|
31
32
|
};
|
32
33
|
return a.length ? /* @__PURE__ */ t(
|
33
34
|
"ul",
|
34
35
|
{
|
35
|
-
className:
|
36
|
+
className: d(
|
36
37
|
e["file-upload-container"],
|
37
38
|
f,
|
38
39
|
e[c]
|
@@ -41,19 +42,19 @@ function v({
|
|
41
42
|
/* @__PURE__ */ r("div", { className: e["file-info"], children: [
|
42
43
|
(i == null ? void 0 : i.size) && /* @__PURE__ */ r("span", { className: e["file-info-size"], children: [
|
43
44
|
" ",
|
44
|
-
|
45
|
+
N.Size(i == null ? void 0 : i.size)
|
45
46
|
] }),
|
46
47
|
/* @__PURE__ */ t("div", { className: e["file-info-name-wrapper"], children: /* @__PURE__ */ t("div", { className: e["file-info-name"], children: i.name }) })
|
47
48
|
] }),
|
48
|
-
/* @__PURE__ */ t(
|
49
|
-
|
49
|
+
!m && /* @__PURE__ */ t(
|
50
|
+
h,
|
50
51
|
{
|
51
52
|
isIconButton: !0,
|
52
53
|
iconName: "Close12px",
|
53
54
|
size: "m-s",
|
54
55
|
variant: "secondary-gray",
|
55
56
|
className: e["delete-button"],
|
56
|
-
onClick: () =>
|
57
|
+
onClick: () => p(i.id)
|
57
58
|
}
|
58
59
|
)
|
59
60
|
] }, n))
|
@@ -61,5 +62,5 @@ function v({
|
|
61
62
|
) : null;
|
62
63
|
}
|
63
64
|
export {
|
64
|
-
|
65
|
+
B as ListFiles
|
65
66
|
};
|
@@ -7,7 +7,7 @@ import { Icon as ye } from "../../icons/Icon.js";
|
|
7
7
|
import { Button as ke } from "../Button/Button.js";
|
8
8
|
import { CheckboxMimir as Te } from "../CheckboxMimir/CheckboxMimir.js";
|
9
9
|
import { Chip as Oe } from "../Chip/Chip.js";
|
10
|
-
import { I as ne } from "../../Input-
|
10
|
+
import { I as ne } from "../../Input-DAmc_HxO.js";
|
11
11
|
import { EInputVariant as ze } from "../Input/constants.js";
|
12
12
|
import { H as Ae, U as ie, G as se, K as Ve, W as qe } from "../../combobox-CVtJDVoZ.js";
|
13
13
|
import '../../assets/MultiSelectSearch.css';const xe = "_disabled_io0c8_5", De = "_container_io0c8_9", Pe = "_full_io0c8_27", Re = "_button_io0c8_39", Be = "_options_io0c8_53", Fe = "_visible_io0c8_66", Je = "_top_io0c8_69", je = "_bottom_io0c8_74", Ge = "_m_io0c8_2", He = "_l_io0c8_116", Ue = "_focused_io0c8_134", We = "_option_io0c8_53", Ke = "_chip_io0c8_163", $e = "_clear_io0c8_188", e = {
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { EMultiSelectSearchSize as o, MOBILE_MENU_HEIGHT as u, DESKTOP_MENU_HEIGHT as w } from "./constants.js";
|
2
|
-
import "../../Input-
|
2
|
+
import "../../Input-DAmc_HxO.js";
|
3
3
|
import { EInputSize as r } from "../Input/constants.js";
|
4
4
|
const m = (t) => {
|
5
5
|
switch (t) {
|
@@ -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-DAmc_HxO.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",
|
@@ -5,7 +5,7 @@ import { ESelectSearchSize as g } from "./constants.js";
|
|
5
5
|
import { mapSizeToInputSize as A, getDropdownArrowIcon as J } from "./utils.js";
|
6
6
|
import { Icon as O } from "../../icons/Icon.js";
|
7
7
|
import { Button as Q } from "../Button/Button.js";
|
8
|
-
import { I as B } from "../../Input-
|
8
|
+
import { I as B } from "../../Input-DAmc_HxO.js";
|
9
9
|
import { EInputVariant as X } from "../Input/constants.js";
|
10
10
|
import { H as Y, U as M, G as j, K as Z, W as ee } from "../../combobox-CVtJDVoZ.js";
|
11
11
|
import '../../assets/SelectSearch.css';const te = "_disabled_1bph7_6", oe = "_container_1bph7_13", ne = "_full_1bph7_28", se = "_button_1bph7_40", ae = "_options_1bph7_54", ie = "_top_1bph7_65", le = "_bottom_1bph7_71", re = "_m_1bph7_98", ce = "_l_1bph7_113", de = "_option_1bph7_54", pe = "_clear_1bph7_167", e = {
|
@@ -5,7 +5,7 @@ import { useAutoResizeTextArea as Z } from "./hooks.js";
|
|
5
5
|
import { useMergeRefs as $ } from "../../hooks/useMergeRefs/useMergeRefs.js";
|
6
6
|
import { Icon as ee } from "../../icons/Icon.js";
|
7
7
|
import { Button as te } from "../Button/Button.js";
|
8
|
-
import { c as e } from "../../Input-
|
8
|
+
import { c as e } from "../../Input-DAmc_HxO.js";
|
9
9
|
import { EInputVariant as ae } from "../Input/constants.js";
|
10
10
|
import '../../assets/TextArea.css';const re = "_textarea_rk5xe_2", se = "_clear_rk5xe_11", le = "_label_rk5xe_26", ne = "_s_rk5xe_71", oe = "_m_rk5xe_84", ce = "_l_rk5xe_26", t = {
|
11
11
|
"textarea-wrapper": "_textarea-wrapper_rk5xe_2",
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { jsxs as o, jsx as n, Fragment as B } from "react/jsx-runtime";
|
2
|
-
import { forwardRef as
|
2
|
+
import { forwardRef as R, useRef as M, useId as k } from "react";
|
3
3
|
import { Icon as D } from "../../icons/Icon.js";
|
4
4
|
import { Button as G } from "../Button/Button.js";
|
5
5
|
import { EButtonVariantDefault as O } from "../Button/constants.js";
|
@@ -7,7 +7,7 @@ import '../../assets/Uploader.css';const c = {
|
|
7
7
|
"upload-file-wrapper": "_upload-file-wrapper_bplvw_2",
|
8
8
|
"upload-text": "_upload-text_bplvw_25",
|
9
9
|
"upload-file-input": "_upload-file-input_bplvw_35"
|
10
|
-
},
|
10
|
+
}, y = {
|
11
11
|
jpeg: "image/jpeg",
|
12
12
|
jpg: "image/jpg",
|
13
13
|
png: "image/png",
|
@@ -31,76 +31,76 @@ import '../../assets/Uploader.css';const c = {
|
|
31
31
|
], X = () => {
|
32
32
|
let i = 0;
|
33
33
|
return () => (i = (i + 1) % Number.MAX_SAFE_INTEGER, i);
|
34
|
-
}, q = X(), W =
|
34
|
+
}, q = X(), W = R(
|
35
35
|
(i, v) => {
|
36
36
|
const {
|
37
37
|
filesType: l = L,
|
38
|
-
onChangeValue:
|
39
|
-
arrayName:
|
40
|
-
maxSize:
|
41
|
-
maxFiles:
|
42
|
-
isDisabled:
|
43
|
-
titleUploader:
|
44
|
-
buttonText:
|
45
|
-
showOnlyUploadButton:
|
46
|
-
uploadButtonVariant:
|
47
|
-
buttonSize:
|
48
|
-
buttonClassName:
|
49
|
-
onMaxFilesExceeded:
|
50
|
-
onMaxSizeExceeded:
|
51
|
-
onInvalidFileType:
|
52
|
-
} = i,
|
38
|
+
onChangeValue: _,
|
39
|
+
arrayName: j,
|
40
|
+
maxSize: d = 15,
|
41
|
+
maxFiles: p,
|
42
|
+
isDisabled: f,
|
43
|
+
titleUploader: m = "Или перетащите сюда",
|
44
|
+
buttonText: I = "Выберите файлы",
|
45
|
+
showOnlyUploadButton: N = !1,
|
46
|
+
uploadButtonVariant: T = O.SecondaryAsphalt,
|
47
|
+
buttonSize: z = "m",
|
48
|
+
buttonClassName: S,
|
49
|
+
onMaxFilesExceeded: r,
|
50
|
+
onMaxSizeExceeded: u,
|
51
|
+
onInvalidFileType: g
|
52
|
+
} = i, x = M(null), h = k(), C = (e) => {
|
53
53
|
var a;
|
54
54
|
return e.type ? e.type : ((a = e.name.split(".").pop()) == null ? void 0 : a.toLowerCase()) === "heic" ? "image/heic" : "";
|
55
|
-
},
|
55
|
+
}, E = (e) => {
|
56
|
+
var s;
|
56
57
|
if (e.target.files && e.target.files[0]) {
|
57
|
-
const
|
58
|
-
|
59
|
-
const
|
60
|
-
const V =
|
61
|
-
return !
|
62
|
-
}).slice(0,
|
63
|
-
|
58
|
+
const a = Array.from(e.target.files);
|
59
|
+
p && a.length > p && (r == null || r());
|
60
|
+
const U = a.filter((t) => {
|
61
|
+
const V = C(t), b = l.map((A) => y[A]).includes(V), w = t.size / 1024 ** 2 <= d;
|
62
|
+
return !b && g && g(t.name), !w && u && u(t.name), b && w;
|
63
|
+
}).slice(0, p).map((t) => ({ file: t, id: q() }));
|
64
|
+
_({ arrayName: j, value: U }), (s = e.target) != null && s.value && (e.target.value = "");
|
64
65
|
}
|
65
|
-
},
|
66
|
+
}, F = () => {
|
66
67
|
var e;
|
67
|
-
(e =
|
68
|
+
(e = x.current) == null || e.click();
|
68
69
|
};
|
69
70
|
return /* @__PURE__ */ o("div", { className: c["upload-file-wrapper"], ref: v, children: [
|
70
71
|
/* @__PURE__ */ n(
|
71
72
|
"input",
|
72
73
|
{
|
73
|
-
ref: r,
|
74
74
|
type: "file",
|
75
75
|
className: c["upload-file-input"],
|
76
76
|
"aria-label": "Upload",
|
77
77
|
name: "image[]",
|
78
78
|
multiple: !0,
|
79
|
-
onChange:
|
79
|
+
onChange: E,
|
80
80
|
title: "",
|
81
|
-
id:
|
82
|
-
accept: l.map((e) =>
|
83
|
-
disabled:
|
81
|
+
id: h,
|
82
|
+
accept: l.map((e) => y[e]).join(),
|
83
|
+
disabled: f
|
84
84
|
}
|
85
85
|
),
|
86
|
-
/* @__PURE__ */ o("label", { htmlFor:
|
86
|
+
/* @__PURE__ */ o("label", { htmlFor: h, ref: x, children: [
|
87
87
|
/* @__PURE__ */ n(
|
88
88
|
G,
|
89
89
|
{
|
90
|
-
size:
|
91
|
-
variant:
|
90
|
+
size: z,
|
91
|
+
variant: T,
|
92
92
|
leftIcon: /* @__PURE__ */ n(D, { iconName: "UnionIcon16px" }),
|
93
|
-
onClick:
|
94
|
-
disabled:
|
95
|
-
className:
|
96
|
-
children:
|
93
|
+
onClick: F,
|
94
|
+
disabled: f,
|
95
|
+
className: S,
|
96
|
+
children: I
|
97
97
|
}
|
98
98
|
),
|
99
|
-
!
|
100
|
-
|
99
|
+
!N && /* @__PURE__ */ o(B, { children: [
|
100
|
+
m && /* @__PURE__ */ n("b", { children: m }),
|
101
101
|
/* @__PURE__ */ o("span", { className: c["upload-text"], children: [
|
102
102
|
"Максимальный размер одного файла – ",
|
103
|
-
|
103
|
+
d,
|
104
104
|
" Мб",
|
105
105
|
/* @__PURE__ */ n("br", {}),
|
106
106
|
"Загрузить можно файлы следующих форматов: ",
|
@@ -1,59 +1,3 @@
|
|
1
|
-
import {
|
2
|
-
import { imageTypesArr } from '../Uploader/constants';
|
3
|
-
import { TFileItem } from '../Uploader/Uploader';
|
1
|
+
import { TUploaderFiles } from './types';
|
4
2
|
|
5
|
-
export type TUploaderFiles = {
|
6
|
-
/**
|
7
|
-
* Массив разрешенных типов файлов для настройки валидации
|
8
|
-
* 'jpeg' | 'jpg' | 'png' | 'tiff' | 'gif' | 'heic' | 'doc' | 'xls' | 'pdf' |'docx' | 'txt'
|
9
|
-
*/
|
10
|
-
filesType: imageTypesArr[];
|
11
|
-
/**
|
12
|
-
* Наименование передаваемого массива файлов
|
13
|
-
*/
|
14
|
-
arrayName: string;
|
15
|
-
/**
|
16
|
-
* Максимальный размер файлов.
|
17
|
-
*/
|
18
|
-
maxSize: number;
|
19
|
-
/**
|
20
|
-
* Функция обратного вызова, передает параметры type и data,
|
21
|
-
* type 'add' в data передает массив файлов,
|
22
|
-
* type:'delete' в data передает id удаленного файла
|
23
|
-
*/
|
24
|
-
onChange: (j: TOnChangeFilesUpdate) => void;
|
25
|
-
/**
|
26
|
-
* Передаваемые файлы.
|
27
|
-
*/
|
28
|
-
value?: TFilesDetail[];
|
29
|
-
/**
|
30
|
-
* Максимальное количество файлов.
|
31
|
-
*/
|
32
|
-
maxFiles: number;
|
33
|
-
/**
|
34
|
-
* Текст внутри кнопки загрузки файла
|
35
|
-
*/
|
36
|
-
buttonText?: string;
|
37
|
-
/**
|
38
|
-
* необязательное поле, имя формы загрузчика на случай, если на странице несколько форм
|
39
|
-
*/
|
40
|
-
name?: string;
|
41
|
-
/**
|
42
|
-
* Проп для обработки ошибки при превышении максимального количества файлов
|
43
|
-
*/
|
44
|
-
onMaxFilesExceeded?: () => void;
|
45
|
-
/**
|
46
|
-
* Проп для обработки ошибки при превышении максимального размера файла
|
47
|
-
*/
|
48
|
-
onMaxSizeExceeded?: (fileName: string) => void;
|
49
|
-
/**
|
50
|
-
* Проп для обработки ошибки при загрузке файла неразрешенного типа
|
51
|
-
*/
|
52
|
-
onInvalidFileType?: (fileName: string) => void;
|
53
|
-
};
|
54
|
-
export type TOnChangeFilesUpdate = {
|
55
|
-
type: string;
|
56
|
-
data: TFileItem[] | number;
|
57
|
-
name?: string;
|
58
|
-
};
|
59
3
|
export declare const UploaderFiles: import('react').ForwardRefExoticComponent<TUploaderFiles & import('react').RefAttributes<HTMLDivElement>>;
|
@@ -1,76 +1,92 @@
|
|
1
|
-
import { jsxs as
|
2
|
-
import { c as
|
3
|
-
import { forwardRef as
|
4
|
-
import {
|
5
|
-
import {
|
6
|
-
import
|
7
|
-
|
8
|
-
}
|
9
|
-
|
1
|
+
import { jsxs as Q, jsx as y } from "react/jsx-runtime";
|
2
|
+
import { c as R } from "../../index-DIxK0V-G.js";
|
3
|
+
import { forwardRef as W, useState as L, useEffect as X } from "react";
|
4
|
+
import { EUploaderFilesVariant as u } from "./constants.js";
|
5
|
+
import { useMediaQuery as k } from "../../hooks/useMediaQuery/useMediaQuery.js";
|
6
|
+
import { EMediaQuery as q } from "../../hooks/useMediaQuery/constants.js";
|
7
|
+
import { ListFiles as A } from "../ListFiles/ListFiles.js";
|
8
|
+
import { EFileItemVariant as x } from "../ListFiles/constants.js";
|
9
|
+
import { Uploader as B } from "../Uploader/Uploader.js";
|
10
|
+
import '../../assets/UploaderFiles.css';const C = "_container_aj93w_2", G = "_white_aj93w_11", H = "_gray_aj93w_14", J = "_compact_aj93w_17", c = {
|
11
|
+
container: C,
|
12
|
+
white: G,
|
13
|
+
gray: H,
|
14
|
+
compact: J
|
15
|
+
}, ta = W(
|
16
|
+
(F, _) => {
|
10
17
|
const {
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
18
|
+
compact: w,
|
19
|
+
readonly: l,
|
20
|
+
filesType: h,
|
21
|
+
arrayName: S,
|
22
|
+
maxSize: j,
|
23
|
+
onChange: i,
|
24
|
+
value: t,
|
16
25
|
name: d,
|
17
|
-
maxFiles:
|
18
|
-
buttonText:
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
26
|
+
maxFiles: o,
|
27
|
+
buttonText: E,
|
28
|
+
variant: n = u.White,
|
29
|
+
className: M,
|
30
|
+
onMaxFilesExceeded: b,
|
31
|
+
onMaxSizeExceeded: g,
|
32
|
+
onInvalidFileType: v
|
33
|
+
} = F, z = k(q.XSS), [e, r] = L(t || []), N = o && e.length >= o, I = n === u.White ? x.gray : x.white;
|
34
|
+
X(() => {
|
35
|
+
t && r(t);
|
36
|
+
}, [t]);
|
37
|
+
const V = (s) => {
|
38
|
+
const D = [
|
39
|
+
...e,
|
40
|
+
...s.value.map((a) => {
|
41
|
+
var p, m, f;
|
31
42
|
return {
|
32
|
-
id:
|
43
|
+
id: a.id,
|
33
44
|
url: "",
|
34
|
-
size: (p =
|
35
|
-
name: (m =
|
36
|
-
type: (
|
45
|
+
size: (p = a == null ? void 0 : a.file) == null ? void 0 : p.size,
|
46
|
+
name: (m = a == null ? void 0 : a.file) == null ? void 0 : m.name,
|
47
|
+
type: (f = a == null ? void 0 : a.file) == null ? void 0 : f.type
|
37
48
|
};
|
38
49
|
})
|
39
50
|
];
|
40
|
-
|
41
|
-
},
|
42
|
-
|
43
|
-
}
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
51
|
+
r(D), i == null || i({ type: "add", data: s.value, name: d });
|
52
|
+
}, T = (s) => {
|
53
|
+
r(s.list), s.deleteId && (i == null || i({ type: "delete", data: s.deleteId, name: d }));
|
54
|
+
}, U = R([
|
55
|
+
c.container,
|
56
|
+
c[n],
|
57
|
+
w && c.compact,
|
58
|
+
M
|
59
|
+
]);
|
60
|
+
return /* @__PURE__ */ Q("div", { className: U, children: [
|
61
|
+
/* @__PURE__ */ y(
|
62
|
+
B,
|
63
|
+
{
|
64
|
+
filesType: h,
|
65
|
+
arrayName: S,
|
66
|
+
maxSize: j,
|
67
|
+
onChangeValue: V,
|
68
|
+
ref: _,
|
69
|
+
buttonSize: z ? "s" : "m",
|
70
|
+
maxFiles: o && o - e.length,
|
71
|
+
isDisabled: N || l,
|
72
|
+
buttonText: E,
|
73
|
+
onMaxFilesExceeded: b,
|
74
|
+
onMaxSizeExceeded: g,
|
75
|
+
onInvalidFileType: v
|
76
|
+
}
|
77
|
+
),
|
78
|
+
/* @__PURE__ */ y(
|
79
|
+
A,
|
80
|
+
{
|
81
|
+
value: e,
|
82
|
+
variant: I,
|
83
|
+
onChange: T,
|
84
|
+
disabled: l
|
85
|
+
}
|
86
|
+
)
|
87
|
+
] });
|
72
88
|
}
|
73
89
|
);
|
74
90
|
export {
|
75
|
-
|
91
|
+
ta as UploaderFiles
|
76
92
|
};
|
@@ -1,4 +1,6 @@
|
|
1
|
-
import { UploaderFiles as
|
1
|
+
import { UploaderFiles as o } from "./UploaderFiles.js";
|
2
|
+
import { EUploaderFilesVariant as l } from "./constants.js";
|
2
3
|
export {
|
3
|
-
|
4
|
+
l as EUploaderFilesVariant,
|
5
|
+
o as UploaderFiles
|
4
6
|
};
|