kamotive_ui 1.2.2 → 1.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Icons/IconClose/IconClose10.d.ts +2 -1
- package/dist/Icons/IconClose/IconClose10.js +2 -2
- package/dist/Icons/IconFile/IconFile.d.ts +6 -0
- package/dist/Icons/IconFile/IconFile.js +5 -0
- package/dist/Icons/IconUpload/IconUpload.d.ts +6 -0
- package/dist/Icons/IconUpload/IconUpload.js +5 -0
- package/dist/Icons/index.d.ts +2 -0
- package/dist/Icons/index.js +2 -0
- package/dist/colors.css +5 -1
- package/dist/components/Button/Button.d.ts +1 -1
- package/dist/components/Button/Button.js +87 -35
- package/dist/components/Button/Button.module.css +101 -49
- package/dist/components/Checkbox/Checkbox.d.ts +1 -1
- package/dist/components/Checkbox/Checkbox.js +5 -3
- package/dist/components/Checkbox/Checkbox.module.css +0 -11
- package/dist/components/ColorPicker/ColorPicker.d.ts +1 -1
- package/dist/components/ColorPicker/ColorPicker.js +89 -44
- package/dist/components/ColorPicker/ColorPicker.module.css +25 -42
- package/dist/components/Dropdown/Dropdown.d.ts +12 -8
- package/dist/components/Dropdown/Dropdown.js +239 -77
- package/dist/components/Dropdown/Dropdown.module.css +152 -89
- package/dist/components/FileAttach/FileAttach.d.ts +3 -0
- package/dist/components/FileAttach/FileAttach.js +79 -0
- package/dist/components/FileAttach/FileAttach.module.css +36 -0
- package/dist/components/Input/Input.d.ts +1 -1
- package/dist/components/Input/Input.js +36 -25
- package/dist/components/Input/Input.module.css +92 -45
- package/dist/components/Loader/Loader.d.ts +3 -0
- package/dist/components/Loader/Loader.js +18 -0
- package/dist/components/Loader/Loader.module.css +75 -0
- package/dist/components/ProgressBar/ProgressBar.d.ts +1 -1
- package/dist/components/ProgressBar/ProgressBar.js +5 -4
- package/dist/components/ProgressBar/ProgressBar.module.css +4 -11
- package/dist/components/ProgressLoader/ProgressLoader.d.ts +1 -1
- package/dist/components/ProgressLoader/ProgressLoader.js +3 -2
- package/dist/components/ProgressLoader/ProgressLoader.module.css +2 -11
- package/dist/components/RadioButton/RadioButton.d.ts +1 -1
- package/dist/components/RadioButton/RadioButton.js +5 -3
- package/dist/components/RadioButton/RadioButton.module.css +2 -15
- package/dist/components/SettingTag/SettingTag.d.ts +1 -1
- package/dist/components/SettingTag/SettingTag.js +7 -6
- package/dist/components/SettingTag/SettingTag.module.css +0 -9
- package/dist/components/Snackbar/Snackbar.d.ts +1 -1
- package/dist/components/Snackbar/Snackbar.js +3 -2
- package/dist/components/Snackbar/Snackbar.module.css +1 -9
- package/dist/components/Spinner/Spinner.d.ts +3 -0
- package/dist/components/Spinner/Spinner.js +30 -0
- package/dist/components/Spinner/Spinner.module.css +20 -0
- package/dist/components/Tab/Tab.d.ts +1 -1
- package/dist/components/Tab/Tab.js +7 -4
- package/dist/components/Tab/Tab.module.css +4 -17
- package/dist/components/Tabs/Tabs.d.ts +1 -1
- package/dist/components/Tabs/Tabs.js +2 -1
- package/dist/components/Tabs/Tabs.module.css +0 -6
- package/dist/components/Tag/Tag.d.ts +1 -1
- package/dist/components/Tag/Tag.js +74 -13
- package/dist/components/Tag/Tag.module.css +89 -74
- package/dist/components/ToggleButton/ToggleButton.d.ts +1 -1
- package/dist/components/ToggleButton/ToggleButton.js +6 -4
- package/dist/components/ToggleButton/ToggleButton.module.css +0 -5
- package/dist/components/Typography/Typography.d.ts +1 -1
- package/dist/components/Typography/Typography.js +3 -2
- package/dist/components/Typography/Typography.module.css +8 -13
- package/dist/components/Typography/enums.d.ts +2 -0
- package/dist/components/Typography/enums.js +2 -0
- package/dist/index.d.ts +11 -7
- package/dist/index.js +10 -7
- package/dist/types/index.d.ts +310 -0
- package/dist/types/index.js +1 -0
- package/package.json +4 -2
|
@@ -1,72 +1,69 @@
|
|
|
1
|
-
.
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
width: 900px;
|
|
1
|
+
.dropdown--container {
|
|
2
|
+
position: relative;
|
|
3
|
+
width: 100%;
|
|
4
|
+
max-width: 260px;
|
|
6
5
|
}
|
|
7
|
-
.
|
|
6
|
+
.dropdown--container-left {
|
|
8
7
|
display: flex;
|
|
8
|
+
gap: 20px;
|
|
9
9
|
align-items: center;
|
|
10
|
-
|
|
10
|
+
flex-wrap: nowrap;
|
|
11
|
+
width: fit-content;
|
|
12
|
+
max-width: none;
|
|
11
13
|
}
|
|
12
|
-
.
|
|
13
|
-
margin-
|
|
14
|
+
.dropdown--container-label {
|
|
15
|
+
margin-top: 20px;
|
|
14
16
|
}
|
|
15
|
-
.dropdown--container{
|
|
16
|
-
|
|
17
|
-
font-style: normal;
|
|
18
|
-
font-weight: 400;
|
|
19
|
-
line-height: 16.5px;
|
|
20
|
-
display: inline-block;
|
|
21
|
-
position: relative;
|
|
17
|
+
.dropdown--container-helperText {
|
|
18
|
+
margin-bottom: 15px;
|
|
22
19
|
}
|
|
23
|
-
|
|
20
|
+
|
|
21
|
+
.option--wrapper {
|
|
24
22
|
display: flex;
|
|
25
|
-
flex-direction: row;
|
|
26
|
-
gap: 20px;
|
|
27
23
|
align-items: center;
|
|
28
|
-
|
|
24
|
+
justify-content: space-between;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.option--icon {
|
|
28
|
+
margin-left: 8px;
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
.button {
|
|
32
|
-
font-family:
|
|
32
|
+
font-family: var(--font-family-main);
|
|
33
33
|
font-style: normal;
|
|
34
34
|
font-weight: 400;
|
|
35
35
|
line-height: 16.5px;
|
|
36
|
-
|
|
37
36
|
border-radius: 10px;
|
|
38
37
|
cursor: pointer;
|
|
39
|
-
/* padding: 0.5em 1em; */
|
|
40
38
|
padding: 10px 15px;
|
|
41
39
|
transition: all 0.3s ease;
|
|
42
|
-
width: 100%;
|
|
43
|
-
/* background-color: var(--white); */
|
|
44
40
|
background-color: transparent;
|
|
45
|
-
color:
|
|
41
|
+
color: var(--text-dark);
|
|
46
42
|
border: 1px solid var(--grey-light);
|
|
43
|
+
/* mix-blend-mode: multiply; */
|
|
47
44
|
display: flex;
|
|
48
45
|
align-items: center;
|
|
49
|
-
gap:
|
|
46
|
+
gap: 20px;
|
|
50
47
|
justify-content: space-between;
|
|
51
|
-
min-width: fit-content;
|
|
52
|
-
|
|
48
|
+
/* min-width: fit-content; */
|
|
49
|
+
position: relative;
|
|
50
|
+
width: 100%;
|
|
53
51
|
}
|
|
54
|
-
.button:hover{
|
|
52
|
+
.button:hover {
|
|
55
53
|
border: 1px solid #0d9aff00;
|
|
56
54
|
box-shadow: 0px 0px 2px var(--blue-main);
|
|
57
55
|
}
|
|
58
56
|
.button:focus,
|
|
59
|
-
.button:active{
|
|
57
|
+
.button:active {
|
|
60
58
|
border-color: var(--blue-main);
|
|
61
59
|
box-shadow: none;
|
|
62
|
-
|
|
63
60
|
}
|
|
64
|
-
.button--disabled{
|
|
61
|
+
.button--disabled {
|
|
65
62
|
background-color: rgba(120, 120, 128, 0.08);
|
|
66
63
|
border: 1px solid #0d9aff00;
|
|
67
64
|
color: rgba(60, 60, 67, 0.3);
|
|
68
65
|
}
|
|
69
|
-
.button--readOnly{
|
|
66
|
+
.button--readOnly {
|
|
70
67
|
background-color: rgba(120, 120, 128, 0.08);
|
|
71
68
|
border: 1px solid #0d9aff00;
|
|
72
69
|
color: var(--text-dark);
|
|
@@ -76,48 +73,74 @@
|
|
|
76
73
|
.button--disabled:active,
|
|
77
74
|
.button--readOnly:hover,
|
|
78
75
|
.button--readOnly:focus,
|
|
79
|
-
.button--readOnly:active{
|
|
76
|
+
.button--readOnly:active {
|
|
80
77
|
box-shadow: none;
|
|
81
78
|
border: 1px solid #0d9aff00;
|
|
82
79
|
}
|
|
83
|
-
.button--
|
|
80
|
+
.button--error {
|
|
81
|
+
border-color: var(--error-main);
|
|
82
|
+
color: var(--error-main);
|
|
83
|
+
}
|
|
84
|
+
.button--icons--item-selected {
|
|
84
85
|
display: flex;
|
|
85
86
|
align-items: center;
|
|
86
87
|
gap: 10px;
|
|
87
88
|
}
|
|
88
|
-
.button-item--selected{
|
|
89
|
+
.button-item--selected {
|
|
89
90
|
color: var(--text-dark);
|
|
90
91
|
}
|
|
91
92
|
|
|
92
93
|
/* Размеры кнопок */
|
|
93
|
-
.button--sm {
|
|
94
|
-
/* font-size: 0.8rem; */
|
|
95
|
-
font-size: 12px;
|
|
96
|
-
}
|
|
97
94
|
.button--md {
|
|
98
|
-
|
|
99
|
-
font-size: 14px;
|
|
95
|
+
font-size: 12px;
|
|
100
96
|
}
|
|
101
97
|
.button--lg {
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
98
|
+
font-size: 14px;
|
|
99
|
+
}
|
|
100
|
+
.button:focus-visible {
|
|
101
|
+
outline: none;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
.resetButton,
|
|
105
|
+
.dropdownIcon {
|
|
106
|
+
position: absolute;
|
|
107
|
+
background: none;
|
|
108
|
+
border: none;
|
|
109
|
+
cursor: pointer;
|
|
110
|
+
padding: 4px;
|
|
111
|
+
display: flex;
|
|
112
|
+
align-items: center;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
.resetButton{
|
|
116
|
+
right: 35px;
|
|
117
|
+
}
|
|
118
|
+
.dropdownIcon{
|
|
119
|
+
right: 5px;
|
|
120
|
+
}
|
|
121
|
+
.resetButton:hover,
|
|
122
|
+
.dropdownIcon:hover {
|
|
123
|
+
background-color: rgba(120, 120, 128, 0.08);
|
|
124
|
+
border-radius: 50%;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
.dropdown {
|
|
128
|
+
position: absolute;
|
|
129
|
+
top: 40px;
|
|
130
|
+
left: 0;
|
|
131
|
+
display: flex;
|
|
132
|
+
margin-top: 5px;
|
|
133
|
+
flex-direction: column;
|
|
134
|
+
align-items: flex-start;
|
|
135
|
+
padding: 10px 0px;
|
|
136
|
+
max-height: 175px;
|
|
137
|
+
width: 100%;
|
|
138
|
+
background: #ffffff;
|
|
139
|
+
box-shadow: 0px 0px 32px rgba(0, 0, 0, 0.2);
|
|
140
|
+
border-radius: 12px;
|
|
141
|
+
overflow-y: auto;
|
|
142
|
+
z-index: 1000;
|
|
143
|
+
overflow-x: hidden;
|
|
121
144
|
}
|
|
122
145
|
|
|
123
146
|
.item--container {
|
|
@@ -126,13 +149,12 @@ overflow-x: hidden;
|
|
|
126
149
|
margin: auto;
|
|
127
150
|
}
|
|
128
151
|
|
|
129
|
-
.item--container:hover
|
|
152
|
+
.item--container:hover,
|
|
153
|
+
.item--container--active {
|
|
130
154
|
background-color: rgba(120, 120, 128, 0.08);
|
|
131
155
|
border-radius: 5px;
|
|
132
|
-
width: 87%;
|
|
133
156
|
margin: auto;
|
|
134
|
-
|
|
135
|
-
|
|
157
|
+
}
|
|
136
158
|
|
|
137
159
|
.item-block {
|
|
138
160
|
cursor: pointer;
|
|
@@ -141,30 +163,19 @@ overflow-x: hidden;
|
|
|
141
163
|
}
|
|
142
164
|
.item-block--disabled {
|
|
143
165
|
color: var(--text-light);
|
|
144
|
-
cursor: not-allowed
|
|
166
|
+
cursor: not-allowed;
|
|
145
167
|
}
|
|
146
|
-
.item-block-
|
|
168
|
+
.item-block-icons,
|
|
147
169
|
.item-block-text {
|
|
148
170
|
display: grid;
|
|
149
171
|
grid-template-columns: auto 1fr;
|
|
150
172
|
justify-content: flex-start;
|
|
151
173
|
align-items: center;
|
|
152
|
-
gap:10px;
|
|
153
|
-
}
|
|
154
|
-
.item-block-default--selected {
|
|
155
|
-
display: grid;
|
|
156
|
-
grid-template-columns: auto 1fr 20px;
|
|
157
|
-
justify-content: space-between;
|
|
158
|
-
align-items: center;
|
|
159
|
-
overflow-x: hidden;
|
|
160
|
-
text-overflow: ellipsis;
|
|
161
|
-
white-space: nowrap;
|
|
162
174
|
gap: 10px;
|
|
163
|
-
color: var(--text-dark);
|
|
164
175
|
}
|
|
165
|
-
.item-block-
|
|
176
|
+
.item-block-icons--selected {
|
|
166
177
|
display: grid;
|
|
167
|
-
grid-template-columns: auto
|
|
178
|
+
grid-template-columns: auto 1fr 20px;
|
|
168
179
|
justify-content: space-between;
|
|
169
180
|
align-items: center;
|
|
170
181
|
overflow-x: hidden;
|
|
@@ -174,24 +185,21 @@ overflow-x: hidden;
|
|
|
174
185
|
color: var(--text-dark);
|
|
175
186
|
}
|
|
176
187
|
|
|
177
|
-
|
|
178
|
-
.item {
|
|
188
|
+
.item {
|
|
179
189
|
overflow: hidden;
|
|
180
190
|
text-overflow: ellipsis;
|
|
181
191
|
white-space: nowrap;
|
|
182
|
-
max-width: 100
|
|
192
|
+
max-width: 100%;
|
|
193
|
+
justify-self: self-start;
|
|
183
194
|
}
|
|
184
195
|
|
|
185
196
|
.label {
|
|
186
|
-
line-height: 14px;
|
|
187
|
-
font-weight: 400;
|
|
188
197
|
transition: 0.3ms ease-out;
|
|
189
198
|
/* color: var(--text-grey); */
|
|
190
199
|
}
|
|
191
200
|
.label--default {
|
|
192
|
-
font-size: 12px;
|
|
193
201
|
position: absolute;
|
|
194
|
-
top: -
|
|
202
|
+
top: -18px;
|
|
195
203
|
cursor: text;
|
|
196
204
|
white-space: nowrap;
|
|
197
205
|
overflow: hidden;
|
|
@@ -199,9 +207,64 @@ overflow-x: hidden;
|
|
|
199
207
|
max-width: calc(100% - 32px);
|
|
200
208
|
color: var(--text-grey);
|
|
201
209
|
}
|
|
210
|
+
.label--default.lg {
|
|
211
|
+
font-size: 12px;
|
|
212
|
+
}
|
|
213
|
+
.label--default.md {
|
|
214
|
+
font-size: 10px;
|
|
215
|
+
}
|
|
216
|
+
|
|
202
217
|
.label--left {
|
|
203
|
-
font-size: 13px;
|
|
204
218
|
color: var(--text-dark);
|
|
205
219
|
min-width: fit-content;
|
|
206
220
|
}
|
|
221
|
+
.label--left.lg {
|
|
222
|
+
font-size: 14px;
|
|
223
|
+
}
|
|
224
|
+
.label--left.md {
|
|
225
|
+
font-size: 12px;
|
|
226
|
+
}
|
|
227
|
+
/* Стили для обязательного поля */
|
|
228
|
+
.label--default.label--required {
|
|
229
|
+
position: relative;
|
|
230
|
+
top: 0;
|
|
231
|
+
}
|
|
232
|
+
.label--required::after {
|
|
233
|
+
content: '*';
|
|
234
|
+
color: var(--error-main);
|
|
235
|
+
position: absolute;
|
|
236
|
+
margin-left: 2px;
|
|
237
|
+
top: 2px;
|
|
238
|
+
font-size: 22px;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
.item-selected {
|
|
242
|
+
color: var(--text-dark);
|
|
243
|
+
white-space: nowrap;
|
|
244
|
+
overflow: hidden;
|
|
245
|
+
text-overflow: ellipsis;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
.item-placeholder {
|
|
249
|
+
color: var(--text-grey);
|
|
250
|
+
transition: 0.3ms ease-out;
|
|
251
|
+
}
|
|
207
252
|
|
|
253
|
+
.helperText.md {
|
|
254
|
+
font-size: 10px;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
.helperText.lg {
|
|
258
|
+
font-size: 12px;
|
|
259
|
+
}
|
|
260
|
+
.helperText {
|
|
261
|
+
position: absolute;
|
|
262
|
+
left: 0px;
|
|
263
|
+
bottom: -17px;
|
|
264
|
+
cursor: text;
|
|
265
|
+
transition: 0.3ms ease-out;
|
|
266
|
+
white-space: nowrap;
|
|
267
|
+
overflow: hidden;
|
|
268
|
+
text-overflow: ellipsis;
|
|
269
|
+
color: var(--error-main);
|
|
270
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import { useDropzone } from 'react-dropzone';
|
|
3
|
+
import styles from './FileAttach.module.css';
|
|
4
|
+
import { Typography } from '../Typography/Typography';
|
|
5
|
+
import { IconUpload } from '../../Icons';
|
|
6
|
+
import { Loader } from '../Loader/Loader';
|
|
7
|
+
export const FileAttach = ({ maxFileSize = 2, maxFileCount = 10, acceptedFormats = {
|
|
8
|
+
'image/*': ['.png', '.gif', '.jpeg', '.jpg'],
|
|
9
|
+
'application/pdf': ['.pdf'],
|
|
10
|
+
'application/msword': ['.doc', '.docx'],
|
|
11
|
+
}, addedFiles, setAddedFiles, disabled = false, }) => {
|
|
12
|
+
const [errorFiles, setErrorFiles] = useState([]);
|
|
13
|
+
const fileValidator = (file) => {
|
|
14
|
+
if (file.size > maxFileSize * 1024 * 1024 * 1024) {
|
|
15
|
+
return {
|
|
16
|
+
code: 'name-too-large',
|
|
17
|
+
message: `Максимальный размер файла ${maxFileSize.toFixed(0)} ГБ`,
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
if (addedFiles.find((addedFile) => addedFile.name === file.name)) {
|
|
21
|
+
return {
|
|
22
|
+
code: 'repeating-file-name',
|
|
23
|
+
message: `Файл уже добавлен`,
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
if (addedFiles.length > maxFileCount - 1) {
|
|
27
|
+
return {
|
|
28
|
+
code: 'files-count-too-large',
|
|
29
|
+
message: `Максимальное количество файлов ${maxFileCount}`,
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
return null;
|
|
33
|
+
};
|
|
34
|
+
const { getRootProps, getInputProps } = useDropzone({
|
|
35
|
+
onDrop: (acceptedFiles, fileRejections) => {
|
|
36
|
+
setAddedFiles([...addedFiles, ...acceptedFiles]);
|
|
37
|
+
setErrorFiles([...errorFiles, ...fileRejections]);
|
|
38
|
+
},
|
|
39
|
+
validator: fileValidator,
|
|
40
|
+
accept: acceptedFormats,
|
|
41
|
+
maxFiles: maxFileCount,
|
|
42
|
+
disabled: disabled,
|
|
43
|
+
});
|
|
44
|
+
const acceptedFileItems = addedFiles.map((file, index) => (React.createElement(Loader, { name: file.name, size: file.size, onClick: () => deleteAcceptedFile(addedFiles, setAddedFiles, file.name), key: index })));
|
|
45
|
+
const fileRejectionItems = errorFiles.map(({ file, errors }) => (React.createElement(Loader, { name: file.name, size: file.size, error: errors[0].message, onClick: () => deleteRejectedFile(errorFiles, setErrorFiles, file.name), key: file.path })));
|
|
46
|
+
const deleteAcceptedFile = (addedFiles, setAddedFiles, fileName) => {
|
|
47
|
+
setAddedFiles(addedFiles.filter((file) => file.name !== fileName));
|
|
48
|
+
};
|
|
49
|
+
const deleteRejectedFile = (errorFiles, setErrorFiles, fileName) => {
|
|
50
|
+
setErrorFiles(errorFiles.filter(({ file }) => file.name !== fileName));
|
|
51
|
+
};
|
|
52
|
+
// Функция для получения всех доступных форматов в виде строки
|
|
53
|
+
const getAcceptedFormatsString = (acceptedFormats) => {
|
|
54
|
+
const formats = [];
|
|
55
|
+
for (const key in acceptedFormats) {
|
|
56
|
+
if (acceptedFormats.hasOwnProperty(key)) {
|
|
57
|
+
formats.push(...acceptedFormats[key].map(format => format.replace('.', '')));
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
return formats.join(', ');
|
|
61
|
+
};
|
|
62
|
+
return (React.createElement("section", { className: styles['fileAttach'] },
|
|
63
|
+
React.createElement("div", Object.assign({}, getRootProps({ className: `${styles['dropzone']} ${disabled ? styles['disabled'] : ''}` })),
|
|
64
|
+
React.createElement("input", Object.assign({}, getInputProps())),
|
|
65
|
+
React.createElement(IconUpload, { htmlColor: disabled ? 'var(--grey-medium)' : 'var(--icons-grey)' }),
|
|
66
|
+
React.createElement(Typography, { variant: "Body2-Medium", color: disabled ? 'var(--grey-medium)' : 'var(--text-dark)' },
|
|
67
|
+
React.createElement("span", { style: { textDecoration: 'underline' } }, "\u041D\u0430\u0436\u043C\u0438\u0442\u0435 \u043D\u0430 \u043E\u0431\u043B\u0430\u0441\u0442\u044C"),
|
|
68
|
+
React.createElement("span", null, " \u0438\u043B\u0438 \u043F\u0435\u0440\u0435\u0442\u0430\u0449\u0438\u0442\u0435 \u0444\u0430\u0439\u043B\u044B")),
|
|
69
|
+
React.createElement("div", null,
|
|
70
|
+
maxFileSize && (React.createElement(Typography, { variant: "Caption", color: "var(--grey-medium)" },
|
|
71
|
+
`Максимальный размер файла ${maxFileSize.toFixed(0)} ГБ`,
|
|
72
|
+
" ",
|
|
73
|
+
React.createElement("br", null))),
|
|
74
|
+
maxFileCount && (React.createElement(Typography, { variant: "Caption", color: "var(--grey-medium)" }, `За раз можно загрузить ${maxFileCount} ${maxFileCount > 1 ? `файлов` : `файл`}`)))),
|
|
75
|
+
acceptedFormats && (React.createElement(Typography, { variant: "Caption", color: "var(--grey-medium)" }, `Поддерживаемые форматы: ${getAcceptedFormatsString(acceptedFormats)}`)),
|
|
76
|
+
(addedFiles === null || addedFiles === void 0 ? void 0 : addedFiles.length) > 0 || (errorFiles === null || errorFiles === void 0 ? void 0 : errorFiles.length) > 0 ? (React.createElement("div", { className: styles['addedFiles'] },
|
|
77
|
+
acceptedFileItems,
|
|
78
|
+
fileRejectionItems)) : (React.createElement(Typography, { variant: "Body2-Medium", color: "var(--text-dark)" }, "\u0424\u0430\u0439\u043B\u044B \u043D\u0435 \u0434\u043E\u0431\u0430\u0432\u043B\u0435\u043D\u044B"))));
|
|
79
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
.fileAttach {
|
|
2
|
+
display: flex;
|
|
3
|
+
flex-direction: column;
|
|
4
|
+
height: inherit;
|
|
5
|
+
gap: 10px;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.dropzone {
|
|
9
|
+
display: flex;
|
|
10
|
+
flex-direction: column;
|
|
11
|
+
align-items: center;
|
|
12
|
+
justify-content: center;
|
|
13
|
+
|
|
14
|
+
gap: 10px;
|
|
15
|
+
padding: 30px 20px;
|
|
16
|
+
border: 1px dashed var(--blue-main);
|
|
17
|
+
border-radius: 15px;
|
|
18
|
+
cursor: pointer;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.dropzone:hover {
|
|
22
|
+
background-color: var(--fills-active);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.dropzone.disabled {
|
|
26
|
+
background-color: var(--fills-disabled);
|
|
27
|
+
border-color: var(--grey-medium);
|
|
28
|
+
cursor: not-allowed;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.addedFiles {
|
|
32
|
+
display: flex;
|
|
33
|
+
flex-direction: column;
|
|
34
|
+
gap: 10px;
|
|
35
|
+
overflow-y: auto;
|
|
36
|
+
}
|
|
@@ -1,37 +1,48 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
;
|
|
2
3
|
import styles from './Input.module.css';
|
|
3
4
|
import classNames from 'classnames';
|
|
5
|
+
import { Typography } from '../Typography/Typography';
|
|
4
6
|
/**
|
|
5
7
|
* Компонент Input для создания текстовых полей ввода различных стилей и размеров.
|
|
6
8
|
*/
|
|
7
|
-
export const Input = ({ id,
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
export const Input = ({ id, label, placeholder, size = 'lg', value, className, multiline = false, rows = 4, resize = false, disabled = false, readOnly = false, isLeftLabel = false, icon, error = false, helperText, onChange, required = false, }) => {
|
|
10
|
+
const [inputLabel, setInputLabel] = useState(label);
|
|
11
|
+
const handleChange = (event) => {
|
|
12
|
+
event.stopPropagation();
|
|
13
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(event);
|
|
14
|
+
if (label) {
|
|
15
|
+
setInputLabel(label);
|
|
16
|
+
}
|
|
17
|
+
else if (placeholder && event.target.value) {
|
|
18
|
+
setInputLabel(placeholder);
|
|
19
|
+
}
|
|
20
|
+
else {
|
|
21
|
+
setInputLabel('');
|
|
11
22
|
}
|
|
12
23
|
};
|
|
13
|
-
const wrapperClassess = classNames(styles['wrapper'], {
|
|
14
|
-
'wrapper--left': isLeftLabel,
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
const inputClassess = classNames(styles['inputText'], size, className, {
|
|
18
|
-
'input--error': hasError,
|
|
19
|
-
'readOnly': readOnly,
|
|
20
|
-
'input--withIcon': icon,
|
|
21
|
-
'textarea': multiline,
|
|
22
|
-
'resize': resize,
|
|
24
|
+
const wrapperClassess = classNames(styles['wrapper--input'], {
|
|
25
|
+
[styles['wrapper--left']]: isLeftLabel,
|
|
26
|
+
[styles['wrapper--input-label']]: label && !isLeftLabel && !required,
|
|
27
|
+
[styles['wrapper--input-helperText']]: error,
|
|
23
28
|
});
|
|
24
|
-
const
|
|
25
|
-
'
|
|
26
|
-
'
|
|
29
|
+
const inputClassess = classNames(styles.input, styles[size], className, {
|
|
30
|
+
[styles['input--error']]: error,
|
|
31
|
+
[styles['readOnly']]: readOnly,
|
|
32
|
+
[styles['input--withIcon']]: icon,
|
|
33
|
+
[styles['textarea']]: multiline,
|
|
34
|
+
// [styles['textarea-rows-&{rows}']]: multiline && rows,
|
|
35
|
+
[styles['resize']]: resize,
|
|
36
|
+
[styles['input--left']]: isLeftLabel,
|
|
27
37
|
});
|
|
28
|
-
const
|
|
29
|
-
'
|
|
38
|
+
const labelClasses = classNames(styles.label, styles[size], {
|
|
39
|
+
[styles['label--default']]: !isLeftLabel,
|
|
40
|
+
[styles['label--left']]: isLeftLabel,
|
|
41
|
+
[styles['label--required']]: required,
|
|
30
42
|
});
|
|
31
43
|
return (React.createElement("div", { className: wrapperClassess },
|
|
32
|
-
|
|
33
|
-
React.createElement("div", { className:
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
hasError && helperText && React.createElement("div", { className: "helperText" }, helperText)));
|
|
44
|
+
inputLabel && (React.createElement(Typography, { variant: "Caption", className: labelClasses }, inputLabel)),
|
|
45
|
+
icon && React.createElement("div", { className: styles.icon }, icon),
|
|
46
|
+
multiline ? (React.createElement("textarea", { id: id, className: inputClassess, value: value, placeholder: placeholder, onChange: handleChange, disabled: disabled, style: { height: `${rows * 20}px` } })) : (React.createElement("input", { id: id, className: inputClassess, value: value, placeholder: placeholder, onChange: handleChange, disabled: disabled, readOnly: readOnly })),
|
|
47
|
+
error && helperText && (React.createElement(Typography, { variant: "Caption", className: classNames(styles.helperText, styles[size]) }, helperText))));
|
|
37
48
|
};
|