mimir-ui-kit 1.36.12 → 1.36.14
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/Input-BYrIS5GU.js +225 -0
- package/dist/assets/Input.css +1 -1
- package/dist/assets/ListFiles.css +1 -1
- package/dist/assets/TextArea.css +1 -1
- 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 +11 -1
- package/dist/components/ListFiles/ListFiles.js +59 -40
- package/dist/components/ListFiles/constants.d.ts +4 -0
- package/dist/components/ListFiles/constants.js +4 -2
- package/dist/components/ListFiles/index.d.ts +2 -1
- package/dist/components/ListFiles/index.js +4 -2
- package/dist/components/ListPhotos/ListPhotos.d.ts +5 -1
- package/dist/components/ListPhotos/ListPhotos.js +14 -13
- package/dist/components/ListPhotos/index.d.ts +1 -1
- 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.d.ts +3 -1
- package/dist/components/TextArea/TextArea.js +105 -91
- package/dist/components/TextArea/constants.d.ts +5 -0
- package/dist/components/TextArea/constants.js +4 -0
- package/dist/components/TextArea/hooks.d.ts +3 -1
- package/dist/components/TextArea/hooks.js +6 -6
- package/dist/components/TextArea/index.d.ts +1 -0
- package/dist/components/TextArea/index.js +4 -2
- package/dist/components/TextArea/types.d.ts +4 -1
- package/dist/components/UniversalUploader/UniversalUploader.js +20 -18
- package/dist/components/Uploader/Uploader.d.ts +5 -0
- package/dist/components/Uploader/Uploader.js +26 -25
- package/dist/components/index.d.ts +5 -1
- package/dist/components/index.js +133 -125
- package/dist/index.js +159 -151
- package/package.json +1 -1
- package/dist/Input-CbgqYgLo.js +0 -226
@@ -5,7 +5,7 @@ import { ESelectSearchSize as v } from "./constants.js";
|
|
5
5
|
import { mapSizeToInputSize as j, getDropdownArrowIcon as J } from "./utils.js";
|
6
6
|
import { Icon as q } from "../../icons/Icon.js";
|
7
7
|
import { Button as Q } from "../Button/Button.js";
|
8
|
-
import { I as A } from "../../Input-
|
8
|
+
import { I as A } from "../../Input-BYrIS5GU.js";
|
9
9
|
import { EInputVariant as W } from "../Input/constants.js";
|
10
10
|
import { H as X, U as O, G as B, K as Y, j as Z } from "../../combobox-BpYucpxz.js";
|
11
11
|
import '../../assets/SelectSearch.css';const ee = "_disabled_rphak_5", te = "_container_rphak_9", oe = "_full_rphak_22", ae = "_button_rphak_34", ne = "_options_rphak_48", se = "_top_rphak_59", re = "_bottom_rphak_64", ie = "_m_rphak_91", le = "_l_rphak_106", ce = "_option_rphak_48", pe = "_clear_rphak_160", e = {
|
@@ -2,4 +2,6 @@ import { TTextAreaProps } from './types';
|
|
2
2
|
import { TAdditionalProps } from '../Input';
|
3
3
|
|
4
4
|
export type TProps = TAdditionalProps & TTextAreaProps;
|
5
|
-
export declare const TextArea: import('react').MemoExoticComponent<import('react').ForwardRefExoticComponent<TAdditionalProps &
|
5
|
+
export declare const TextArea: import('react').MemoExoticComponent<import('react').ForwardRefExoticComponent<TAdditionalProps & Omit<import('react').TextareaHTMLAttributes<HTMLTextAreaElement>, "size" | "readOnly"> & {
|
6
|
+
inputSize?: `${import('./constants').ETextAreaInputSize}` | import('./constants').ETextAreaInputSize;
|
7
|
+
} & import('react').RefAttributes<HTMLTextAreaElement>>>;
|
@@ -1,37 +1,40 @@
|
|
1
|
-
import { jsxs as
|
1
|
+
import { jsxs as B, jsx as n } from "react/jsx-runtime";
|
2
2
|
import { c as i } from "../../index-DIxK0V-G.js";
|
3
|
-
import { memo as
|
4
|
-
import { useAutoResizeTextArea as
|
5
|
-
import { useMergeRefs as
|
6
|
-
import { Icon as
|
7
|
-
import { Button as
|
8
|
-
import { c as e } from "../../Input-
|
9
|
-
import { EInputVariant as
|
10
|
-
import '../../assets/TextArea.css';const
|
11
|
-
"textarea-wrapper": "_textarea-
|
12
|
-
textarea:
|
13
|
-
"has-label": "_has-
|
14
|
-
"required-mark": "_required-
|
15
|
-
label:
|
16
|
-
"has-left-slot": "_has-left-
|
17
|
-
"active-label": "_active-
|
18
|
-
s:
|
19
|
-
m:
|
20
|
-
l: oe
|
21
|
-
|
22
|
-
|
3
|
+
import { memo as Q, forwardRef as U, useState as F, useRef as X, useEffect as Y } from "react";
|
4
|
+
import { useAutoResizeTextArea as Z } from "./hooks.js";
|
5
|
+
import { useMergeRefs as $ } from "../../hooks/useMergeRefs/useMergeRefs.js";
|
6
|
+
import { Icon as ee } from "../../icons/Icon.js";
|
7
|
+
import { Button as ae } from "../Button/Button.js";
|
8
|
+
import { c as e } from "../../Input-BYrIS5GU.js";
|
9
|
+
import { EInputVariant as te } from "../Input/constants.js";
|
10
|
+
import '../../assets/TextArea.css';const se = "_textarea_ta2xa_2", re = "_label_ta2xa_22", le = "_s_ta2xa_53", ne = "_m_ta2xa_65", oe = "_l_ta2xa_22", a = {
|
11
|
+
"textarea-wrapper": "_textarea-wrapper_ta2xa_2",
|
12
|
+
textarea: se,
|
13
|
+
"has-label": "_has-label_ta2xa_8",
|
14
|
+
"required-mark": "_required-mark_ta2xa_11",
|
15
|
+
label: re,
|
16
|
+
"has-left-slot": "_has-left-slot_ta2xa_37",
|
17
|
+
"active-label": "_active-label_ta2xa_40",
|
18
|
+
s: le,
|
19
|
+
m: ne,
|
20
|
+
l: oe,
|
21
|
+
"input-s": "_input-s_ta2xa_89",
|
22
|
+
"input-m": "_input-m_ta2xa_97",
|
23
|
+
"input-l": "_input-l_ta2xa_105"
|
24
|
+
}, j = (t) => {
|
25
|
+
var _, o;
|
23
26
|
if (!t)
|
24
27
|
return null;
|
25
28
|
switch (t.addonType) {
|
26
29
|
case "icon": {
|
27
|
-
const
|
28
|
-
return /* @__PURE__ */
|
29
|
-
|
30
|
+
const f = (_ = t.addonContent) == null ? void 0 : _.includes("16px"), b = (o = t.addonContent) == null ? void 0 : o.includes("24px");
|
31
|
+
return /* @__PURE__ */ n(
|
32
|
+
ee,
|
30
33
|
{
|
31
34
|
style: {
|
32
35
|
"--icon-size": i({
|
33
|
-
"16px":
|
34
|
-
"24px":
|
36
|
+
"16px": f,
|
37
|
+
"24px": b
|
35
38
|
})
|
36
39
|
},
|
37
40
|
className: e["addon-icon"],
|
@@ -44,70 +47,80 @@ import '../../assets/TextArea.css';const te = "_textarea_1b24r_2", se = "_label_
|
|
44
47
|
default:
|
45
48
|
return null;
|
46
49
|
}
|
47
|
-
},
|
48
|
-
|
49
|
-
(t,
|
50
|
+
}, ce = Q(
|
51
|
+
U(
|
52
|
+
(t, _) => {
|
50
53
|
const {
|
51
|
-
value:
|
52
|
-
className:
|
53
|
-
wrapperClassName:
|
54
|
-
variant: R =
|
54
|
+
value: o,
|
55
|
+
className: f,
|
56
|
+
wrapperClassName: b,
|
57
|
+
variant: R = te.DefaultGray,
|
55
58
|
autofocus: N,
|
56
59
|
readonly: s,
|
57
60
|
status: T,
|
58
|
-
id:
|
61
|
+
id: I,
|
59
62
|
onFocus: g,
|
60
63
|
onBlur: C,
|
61
|
-
label:
|
64
|
+
label: u,
|
62
65
|
onChange: c,
|
63
|
-
withClearButton:
|
64
|
-
disabled:
|
65
|
-
rightAddon:
|
66
|
-
leftAddon:
|
66
|
+
withClearButton: E,
|
67
|
+
disabled: d,
|
68
|
+
rightAddon: L,
|
69
|
+
leftAddon: S,
|
67
70
|
size: m = "m",
|
68
|
-
|
71
|
+
inputSize: v,
|
72
|
+
required: A,
|
69
73
|
...D
|
70
|
-
} = t, [
|
71
|
-
|
72
|
-
N &&
|
74
|
+
} = t, [p, w] = F(N), [x, y] = F(!!o), r = X(null), G = $(r, _);
|
75
|
+
Y(() => {
|
76
|
+
N && w(!0);
|
73
77
|
}, [N]);
|
74
|
-
const
|
75
|
-
|
76
|
-
|
78
|
+
const V = Z(
|
79
|
+
r.current,
|
80
|
+
v
|
81
|
+
), M = (l) => {
|
82
|
+
const z = l.currentTarget.value;
|
83
|
+
C == null || C(l), w(!1), y(!!z);
|
77
84
|
}, O = (l) => {
|
78
|
-
s || (
|
85
|
+
s || (w(!0), g == null || g(l));
|
79
86
|
}, P = () => {
|
80
|
-
r != null && r.current && (r.current.value = "", r.current.focus(),
|
87
|
+
r != null && r.current && (r.current.value = "", r.current.focus(), y(!1), V(), c == null || c({
|
81
88
|
target: { value: "" }
|
82
89
|
}));
|
83
|
-
},
|
84
|
-
const
|
85
|
-
|
86
|
-
}, h =
|
87
|
-
[e.readonly]:
|
88
|
-
[e.focused]:
|
89
|
-
[e.disabled]:
|
90
|
+
}, W = (l) => {
|
91
|
+
const z = l.target.value;
|
92
|
+
y(!!z), V(), c == null || c(l);
|
93
|
+
}, h = j(S), k = j(L), H = {
|
94
|
+
[e.readonly]: d || s,
|
95
|
+
[e.focused]: p,
|
96
|
+
[e.disabled]: d || s,
|
90
97
|
[e["has-left-slot"]]: !!h,
|
91
|
-
[e["has-right-slot"]]: !!
|
92
|
-
[a["has-label"]]: !!
|
93
|
-
},
|
98
|
+
[e["has-right-slot"]]: !!k,
|
99
|
+
[a["has-label"]]: !!u
|
100
|
+
}, q = p || x || !!o, J = i(
|
94
101
|
e.label,
|
95
102
|
a.label,
|
96
103
|
{
|
97
|
-
[a["active-label"]]:
|
98
|
-
[e.disabled]:
|
104
|
+
[a["active-label"]]: q,
|
105
|
+
[e.disabled]: d || s,
|
99
106
|
[a["has-left-slot"]]: !!h
|
100
107
|
},
|
101
|
-
|
108
|
+
f,
|
102
109
|
e[m]
|
103
|
-
),
|
110
|
+
), K = i(
|
104
111
|
a.textarea,
|
105
112
|
e.input,
|
106
|
-
|
107
|
-
|
108
|
-
[
|
113
|
+
H,
|
114
|
+
f,
|
115
|
+
[
|
116
|
+
e[R],
|
117
|
+
a[m],
|
118
|
+
e[m],
|
119
|
+
a[v ?? ""],
|
120
|
+
e[T ?? ""]
|
121
|
+
]
|
109
122
|
);
|
110
|
-
return /* @__PURE__ */
|
123
|
+
return /* @__PURE__ */ B(
|
111
124
|
"div",
|
112
125
|
{
|
113
126
|
className: i(
|
@@ -117,16 +130,17 @@ import '../../assets/TextArea.css';const te = "_textarea_1b24r_2", se = "_label_
|
|
117
130
|
e[T ?? ""],
|
118
131
|
a[m],
|
119
132
|
e[m],
|
133
|
+
a[v ?? ""],
|
120
134
|
{
|
121
|
-
[e.disabled]:
|
122
|
-
[e.focused]:
|
135
|
+
[e.disabled]: d || s,
|
136
|
+
[e.focused]: p
|
123
137
|
},
|
124
|
-
|
138
|
+
b
|
125
139
|
),
|
126
140
|
children: [
|
127
|
-
|
128
|
-
|
129
|
-
|
141
|
+
u && /* @__PURE__ */ B("label", { htmlFor: I, className: J, children: [
|
142
|
+
u,
|
143
|
+
A && (x || p) && /* @__PURE__ */ n(
|
130
144
|
"span",
|
131
145
|
{
|
132
146
|
className: a["required-mark"],
|
@@ -134,52 +148,52 @@ import '../../assets/TextArea.css';const te = "_textarea_1b24r_2", se = "_label_
|
|
134
148
|
}
|
135
149
|
)
|
136
150
|
] }),
|
137
|
-
h && /* @__PURE__ */
|
151
|
+
h && /* @__PURE__ */ n(
|
138
152
|
"span",
|
139
153
|
{
|
140
154
|
className: i(e["left-slot"], {
|
141
|
-
[e.focused]:
|
142
|
-
[e["has-label"]]: !!
|
155
|
+
[e.focused]: q,
|
156
|
+
[e["has-label"]]: !!u
|
143
157
|
}),
|
144
158
|
"data-testid": "left-addon",
|
145
159
|
children: h
|
146
160
|
}
|
147
161
|
),
|
148
|
-
/* @__PURE__ */
|
162
|
+
/* @__PURE__ */ n(
|
149
163
|
"textarea",
|
150
164
|
{
|
151
165
|
ref: G,
|
152
|
-
id:
|
153
|
-
className:
|
166
|
+
id: I,
|
167
|
+
className: K,
|
154
168
|
onFocus: O,
|
155
169
|
onBlur: M,
|
156
170
|
readOnly: s,
|
157
|
-
value:
|
158
|
-
onChange:
|
159
|
-
required:
|
171
|
+
value: o,
|
172
|
+
onChange: W,
|
173
|
+
required: A,
|
160
174
|
...D
|
161
175
|
}
|
162
176
|
),
|
163
|
-
|
177
|
+
k && /* @__PURE__ */ n(
|
164
178
|
"span",
|
165
179
|
{
|
166
180
|
className: i(e["right-slot"], {
|
167
|
-
[e.focused]:
|
168
|
-
[e["has-label"]]: !!
|
181
|
+
[e.focused]: q,
|
182
|
+
[e["has-label"]]: !!u
|
169
183
|
}),
|
170
184
|
"data-testid": "right-addon",
|
171
|
-
children:
|
185
|
+
children: k
|
172
186
|
}
|
173
187
|
),
|
174
|
-
|
188
|
+
A && !x && !p && /* @__PURE__ */ n(
|
175
189
|
"span",
|
176
190
|
{
|
177
191
|
className: a["required-mark"],
|
178
192
|
"data-testid": "required-mark"
|
179
193
|
}
|
180
194
|
),
|
181
|
-
|
182
|
-
|
195
|
+
E && x && /* @__PURE__ */ n(
|
196
|
+
ae,
|
183
197
|
{
|
184
198
|
tabIndex: -1,
|
185
199
|
className: e.clear,
|
@@ -187,7 +201,7 @@ import '../../assets/TextArea.css';const te = "_textarea_1b24r_2", se = "_label_
|
|
187
201
|
iconName: "Close16px",
|
188
202
|
size: "m-s",
|
189
203
|
clear: !0,
|
190
|
-
disabled:
|
204
|
+
disabled: d || s,
|
191
205
|
variant: "secondary-gray",
|
192
206
|
onClick: P
|
193
207
|
}
|
@@ -198,7 +212,7 @@ import '../../assets/TextArea.css';const te = "_textarea_1b24r_2", se = "_label_
|
|
198
212
|
}
|
199
213
|
)
|
200
214
|
);
|
201
|
-
|
215
|
+
ce.displayName = "TextArea";
|
202
216
|
export {
|
203
|
-
|
217
|
+
ce as TextArea
|
204
218
|
};
|
@@ -1 +1,3 @@
|
|
1
|
-
|
1
|
+
import { ETextAreaInputSize } from './constants';
|
2
|
+
|
3
|
+
export declare const useAutoResizeTextArea: (textArea: HTMLTextAreaElement | null, inputSize?: ETextAreaInputSize | `${ETextAreaInputSize}`) => () => void;
|
@@ -1,15 +1,15 @@
|
|
1
1
|
import { useCallback as e } from "react";
|
2
|
-
const
|
2
|
+
const i = (h, l) => e(() => {
|
3
3
|
if (h) {
|
4
|
-
if (!h.value.length) {
|
4
|
+
if (!h.value.length && !l) {
|
5
5
|
h.style.height = "auto";
|
6
6
|
return;
|
7
7
|
}
|
8
8
|
h.style.height = "var(--textarea-height)";
|
9
|
-
const
|
10
|
-
h.style.height = `${
|
9
|
+
const s = h.scrollHeight;
|
10
|
+
h.style.height = `${s}px`;
|
11
11
|
}
|
12
|
-
}, [h]);
|
12
|
+
}, [l, h]);
|
13
13
|
export {
|
14
|
-
|
14
|
+
i as useAutoResizeTextArea
|
15
15
|
};
|
@@ -1,3 +1,6 @@
|
|
1
1
|
import { TextareaHTMLAttributes } from 'react';
|
2
|
+
import { ETextAreaInputSize } from './constants';
|
2
3
|
|
3
|
-
export type TTextAreaProps = Omit<TextareaHTMLAttributes<HTMLTextAreaElement>, 'readOnly' | 'size'
|
4
|
+
export type TTextAreaProps = Omit<TextareaHTMLAttributes<HTMLTextAreaElement>, 'readOnly' | 'size'> & {
|
5
|
+
inputSize?: `${ETextAreaInputSize}` | ETextAreaInputSize;
|
6
|
+
};
|
@@ -1,15 +1,15 @@
|
|
1
1
|
import { jsxs as y, 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 N, useEffect as
|
3
|
+
import { forwardRef as D, useState as N, useEffect as T, useMemo as V } from "react";
|
4
4
|
import { imageTypes as h } from "./constants.js";
|
5
5
|
import "../Button/Button.js";
|
6
|
-
import { EButtonVariantDefault as
|
7
|
-
import { ListFiles as
|
8
|
-
import { ListPhotos as
|
9
|
-
import { Uploader as
|
6
|
+
import { EButtonVariantDefault as _ } from "../Button/constants.js";
|
7
|
+
import { ListFiles as E } from "../ListFiles/ListFiles.js";
|
8
|
+
import { ListPhotos as M } from "../ListPhotos/ListPhotos.js";
|
9
|
+
import { Uploader as O } from "../Uploader/Uploader.js";
|
10
10
|
import '../../assets/UploaderPhotos.css';const g = {
|
11
11
|
"upload-file-wrapper": "_upload-file-wrapper_1a115_2"
|
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,
|
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, Q = D(
|
13
13
|
(i, v) => {
|
14
14
|
const {
|
15
15
|
type: s,
|
@@ -22,14 +22,15 @@ import '../../assets/UploaderPhotos.css';const g = {
|
|
22
22
|
titleUploader: w,
|
23
23
|
buttonText: z = "Выберите файлы",
|
24
24
|
showOnlyUploadButton: u = !1,
|
25
|
-
uploadButtonVariant: b =
|
25
|
+
uploadButtonVariant: b = _.SecondaryAsphalt,
|
26
|
+
buttonSize: I = "m"
|
26
27
|
} = i, [l, n] = N(
|
27
28
|
a || []
|
28
29
|
), d = l.length >= m;
|
29
|
-
|
30
|
+
T(() => {
|
30
31
|
a && n(a);
|
31
32
|
}, [a]);
|
32
|
-
const
|
33
|
+
const L = (t) => {
|
33
34
|
const r = t.value.map((e) => f(e.file) ? {
|
34
35
|
id: e.id,
|
35
36
|
url: URL.createObjectURL(e.file),
|
@@ -46,7 +47,7 @@ import '../../assets/UploaderPhotos.css';const g = {
|
|
46
47
|
n((e) => [...e, ...r]), o == null || o({ type: "add", data: t.value });
|
47
48
|
}, c = (t) => {
|
48
49
|
n((r) => r.filter((e) => e.id !== t)), o == null || o({ type: "delete", data: t });
|
49
|
-
}, { photos:
|
50
|
+
}, { photos: R, files: S } = V(() => {
|
50
51
|
const t = () => l.filter((e) => !f(e)), r = () => l.filter(f);
|
51
52
|
return s === "all" ? { files: t(), photos: r() } : s === "files" ? { photos: [], files: t() } : s === "photos" ? { files: [], photos: r() } : { files: [], photos: [] };
|
52
53
|
}, [l, s]);
|
@@ -59,33 +60,34 @@ import '../../assets/UploaderPhotos.css';const g = {
|
|
59
60
|
),
|
60
61
|
children: [
|
61
62
|
/* @__PURE__ */ p(
|
62
|
-
|
63
|
+
O,
|
63
64
|
{
|
64
65
|
filesType: x,
|
65
66
|
arrayName: F,
|
66
67
|
maxSize: U,
|
67
|
-
onChangeValue:
|
68
|
+
onChangeValue: L,
|
68
69
|
ref: v,
|
69
70
|
maxFiles: m,
|
70
71
|
isDisabled: d,
|
71
72
|
titleUploader: w,
|
72
73
|
showOnlyUploadButton: u,
|
73
74
|
buttonText: z,
|
74
|
-
uploadButtonVariant: b
|
75
|
+
uploadButtonVariant: b,
|
76
|
+
buttonSize: I
|
75
77
|
}
|
76
78
|
),
|
77
79
|
!u && /* @__PURE__ */ y(j, { children: [
|
78
80
|
(s === "files" || s === "all") && /* @__PURE__ */ p(
|
79
|
-
|
81
|
+
E,
|
80
82
|
{
|
81
|
-
value:
|
83
|
+
value: S,
|
82
84
|
onChange: (t) => c(t.deleteId)
|
83
85
|
}
|
84
86
|
),
|
85
87
|
(s === "photos" || s === "all") && /* @__PURE__ */ p(
|
86
|
-
|
88
|
+
M,
|
87
89
|
{
|
88
|
-
value:
|
90
|
+
value: R,
|
89
91
|
onChange: (t) => c(t.deleteId)
|
90
92
|
}
|
91
93
|
)
|
@@ -96,5 +98,5 @@ import '../../assets/UploaderPhotos.css';const g = {
|
|
96
98
|
}
|
97
99
|
);
|
98
100
|
export {
|
99
|
-
|
101
|
+
Q as UniversalUploader
|
100
102
|
};
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import { default as React } from 'react';
|
2
2
|
import { imageTypesArr } from './constants';
|
3
|
+
import { EButtonSize } from '../Button';
|
3
4
|
import { TButtonDefaultFormProps } from '../Button/types';
|
4
5
|
|
5
6
|
export type TUploader = {
|
@@ -44,6 +45,10 @@ export type TUploader = {
|
|
44
45
|
* Вариант кнопки загрузки файла
|
45
46
|
*/
|
46
47
|
uploadButtonVariant?: TButtonDefaultFormProps['variant'];
|
48
|
+
/**
|
49
|
+
* Размер кнопки загрузки файла
|
50
|
+
*/
|
51
|
+
buttonSize?: EButtonSize | `${EButtonSize}`;
|
47
52
|
};
|
48
53
|
export type TUploadValue = {
|
49
54
|
value: TFileItem[];
|
@@ -1,5 +1,5 @@
|
|
1
|
-
import { jsxs as
|
2
|
-
import { forwardRef as
|
1
|
+
import { jsxs as a, jsx as n, Fragment as S } from "react/jsx-runtime";
|
2
|
+
import { forwardRef as U, useRef as u, useId as V } from "react";
|
3
3
|
import { Icon as A } from "../../icons/Icon.js";
|
4
4
|
import { Button as B } from "../Button/Button.js";
|
5
5
|
import { EButtonVariantDefault as C } from "../Button/constants.js";
|
@@ -21,20 +21,20 @@ import '../../assets/Uploader.css';const p = {
|
|
21
21
|
xls: "application/excel",
|
22
22
|
txt: "text/plain",
|
23
23
|
xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
|
24
|
-
},
|
24
|
+
}, M = [
|
25
25
|
"jpeg",
|
26
26
|
"jpg",
|
27
27
|
"png",
|
28
28
|
"tiff",
|
29
29
|
"gif",
|
30
30
|
"heic"
|
31
|
-
],
|
31
|
+
], k = () => {
|
32
32
|
let i = 0;
|
33
33
|
return () => (i = (i + 1) % Number.MAX_SAFE_INTEGER, i);
|
34
|
-
},
|
34
|
+
}, D = k(), H = U(
|
35
35
|
(i, x) => {
|
36
36
|
const {
|
37
|
-
filesType: o =
|
37
|
+
filesType: o = M,
|
38
38
|
onChangeValue: h,
|
39
39
|
arrayName: b,
|
40
40
|
maxSize: r = 15,
|
@@ -43,24 +43,25 @@ import '../../assets/Uploader.css';const p = {
|
|
43
43
|
titleUploader: c = "Или перетащите сюда",
|
44
44
|
buttonText: y = "Выберите файлы",
|
45
45
|
showOnlyUploadButton: _ = !1,
|
46
|
-
uploadButtonVariant: j = C.SecondaryAsphalt
|
47
|
-
|
46
|
+
uploadButtonVariant: j = C.SecondaryAsphalt,
|
47
|
+
buttonSize: v = "m"
|
48
|
+
} = i, d = u(null), l = u(null), f = V(), I = (e) => {
|
48
49
|
var t;
|
49
50
|
return e.type ? e.type : ((t = e.name.split(".").pop()) == null ? void 0 : t.toLowerCase()) === "heic" ? "image/heic" : "";
|
50
|
-
},
|
51
|
+
}, N = (e) => {
|
51
52
|
if (e.target.files && e.target.files[0]) {
|
52
53
|
const m = Array.from(e.target.files).filter((t) => {
|
53
|
-
const
|
54
|
+
const z = I(t), E = o.map((R) => g[R]).includes(z), F = t.size / 1024 ** 2 <= r;
|
54
55
|
return E && F;
|
55
|
-
}).slice(0, w).map((t) => ({ file: t, id:
|
56
|
+
}).slice(0, w).map((t) => ({ file: t, id: D() }));
|
56
57
|
h({ arrayName: b, value: m }), l.current && (l.current.value = "");
|
57
58
|
}
|
58
|
-
},
|
59
|
+
}, T = () => {
|
59
60
|
var e;
|
60
61
|
(e = d.current) == null || e.click();
|
61
62
|
};
|
62
|
-
return /* @__PURE__ */
|
63
|
-
/* @__PURE__ */
|
63
|
+
return /* @__PURE__ */ a("div", { className: p["upload-file-wrapper"], ref: x, children: [
|
64
|
+
/* @__PURE__ */ n(
|
64
65
|
"input",
|
65
66
|
{
|
66
67
|
ref: l,
|
@@ -69,32 +70,32 @@ import '../../assets/Uploader.css';const p = {
|
|
69
70
|
"aria-label": "Upload",
|
70
71
|
name: "image[]",
|
71
72
|
multiple: !0,
|
72
|
-
onChange:
|
73
|
+
onChange: N,
|
73
74
|
title: "",
|
74
75
|
id: f,
|
75
76
|
accept: o.map((e) => g[e]).join(),
|
76
77
|
disabled: s
|
77
78
|
}
|
78
79
|
),
|
79
|
-
/* @__PURE__ */
|
80
|
-
/* @__PURE__ */
|
80
|
+
/* @__PURE__ */ a("label", { htmlFor: f, ref: d, children: [
|
81
|
+
/* @__PURE__ */ n(
|
81
82
|
B,
|
82
83
|
{
|
83
|
-
size:
|
84
|
+
size: v,
|
84
85
|
variant: j,
|
85
|
-
leftIcon: /* @__PURE__ */
|
86
|
-
onClick:
|
86
|
+
leftIcon: /* @__PURE__ */ n(A, { iconName: "UnionIcon16px" }),
|
87
|
+
onClick: T,
|
87
88
|
disabled: s,
|
88
89
|
children: y
|
89
90
|
}
|
90
91
|
),
|
91
|
-
!_ && /* @__PURE__ */
|
92
|
-
c && /* @__PURE__ */
|
93
|
-
/* @__PURE__ */
|
92
|
+
!_ && /* @__PURE__ */ a(S, { children: [
|
93
|
+
c && /* @__PURE__ */ n("b", { children: c }),
|
94
|
+
/* @__PURE__ */ a("span", { className: p["upload-text"], children: [
|
94
95
|
"Максимальный размер одного файла – ",
|
95
96
|
r,
|
96
97
|
" Мб",
|
97
|
-
/* @__PURE__ */
|
98
|
+
/* @__PURE__ */ n("br", {}),
|
98
99
|
"Загрузить можно файлы следующих форматов: ",
|
99
100
|
o.join(", ")
|
100
101
|
] })
|
@@ -104,5 +105,5 @@ import '../../assets/Uploader.css';const p = {
|
|
104
105
|
}
|
105
106
|
);
|
106
107
|
export {
|
107
|
-
|
108
|
+
H as Uploader
|
108
109
|
};
|
@@ -1,7 +1,7 @@
|
|
1
1
|
export { Button, EButtonForm, EButtonSize, EButtonVariantDefault, EButtonVariantRound, EButtonVariantOutline, EButtonVariantBorderless, type TButtonProps } from './Button';
|
2
2
|
export { Input, EInputSize, EInputVariant, EInputStatus } from './Input';
|
3
3
|
export type { TInputProps, TSize, TVariant, TStatus } from './Input';
|
4
|
-
export { TextArea } from './TextArea';
|
4
|
+
export { TextArea, ETextAreaInputSize } from './TextArea';
|
5
5
|
export type { TTextAreaProps } from './TextArea';
|
6
6
|
export { InputPassword } from './InputPassword';
|
7
7
|
export type { TInputPasswordProps } from './InputPassword';
|
@@ -61,3 +61,7 @@ export type { TAvatarProps, TAvatarSize } from './Avatar';
|
|
61
61
|
export { MultiSelectSearch } from './MultiSelectSearch';
|
62
62
|
export type { TMultiSelectSearchProps, TMultiSelectOption } from './MultiSelectSearch';
|
63
63
|
export { EMultiSelectSearchSize } from './MultiSelectSearch';
|
64
|
+
export { ListFiles, EFileItemVariant } from './ListFiles';
|
65
|
+
export type { TListFiles, TFilesDetail, TFileValue } from './ListFiles';
|
66
|
+
export { ListPhotos } from './ListPhotos';
|
67
|
+
export type { TListPhotos, TPhotosDetail, TPhotoValue, TPhotoItem } from './ListPhotos';
|