@alfalab/core-components-file-upload-item 3.5.3 → 3.6.1
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/Component.js +8 -5
- package/dist/cssm/Component.js +7 -4
- package/dist/esm/Component.js +8 -5
- package/dist/esm/index.css +22 -22
- package/dist/index.css +22 -22
- package/dist/modern/Component.js +8 -5
- package/dist/modern/index.css +22 -22
- package/package.json +3 -3
package/dist/Component.js
CHANGED
|
@@ -24,11 +24,11 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
|
24
24
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
25
25
|
var cn__default = /*#__PURE__*/_interopDefaultLegacy(cn);
|
|
26
26
|
|
|
27
|
-
var styles = {"component":"file-upload-
|
|
27
|
+
var styles = {"component":"file-upload-item__component_1p0kf","infoSection":"file-upload-item__infoSection_1p0kf","info":"file-upload-item__info_1p0kf","icon":"file-upload-item__icon_1p0kf","errorIcon":"file-upload-item__errorIcon_1p0kf","successIcon":"file-upload-item__successIcon_1p0kf","name":"file-upload-item__name_1p0kf","meta":"file-upload-item__meta_1p0kf","size":"file-upload-item__size_1p0kf","delete":"file-upload-item__delete_1p0kf","download":"file-upload-item__download_1p0kf","errorWrapper":"file-upload-item__errorWrapper_1p0kf","restore":"file-upload-item__restore_1p0kf","spinnerWrapper":"file-upload-item__spinnerWrapper_1p0kf","spinner":"file-upload-item__spinner_1p0kf","uploadPercent":"file-upload-item__uploadPercent_1p0kf"};
|
|
28
28
|
require('./index.css')
|
|
29
29
|
|
|
30
30
|
var FileUploadItem = function (_a) {
|
|
31
|
-
var className = _a.className, children = _a.children, _b = _a.id, id = _b === void 0 ? '0' : _b, _c = _a.name, name = _c === void 0 ? '' : _c, size = _a.size, _d = _a.icon, Icon = _d === void 0 ? utils.fileIcon(name) : _d, uploadDate = _a.uploadDate, downloadLink = _a.downloadLink, download = _a.download, uploadStatus = _a.uploadStatus, _e = _a.uploadPercent, uploadPercent = _e === void 0 ? 0 : _e,
|
|
31
|
+
var className = _a.className, children = _a.children, _b = _a.id, id = _b === void 0 ? '0' : _b, _c = _a.name, name = _c === void 0 ? '' : _c, size = _a.size, _d = _a.icon, Icon = _d === void 0 ? utils.fileIcon(name) : _d, uploadDate = _a.uploadDate, downloadLink = _a.downloadLink, download = _a.download, uploadStatus = _a.uploadStatus, _e = _a.uploadPercent, uploadPercent = _e === void 0 ? 0 : _e, error = _a.error, showDelete = _a.showDelete, showRestore = _a.showRestore, onDelete = _a.onDelete, onDownload = _a.onDownload, onRestore = _a.onRestore, dataTestId = _a.dataTestId;
|
|
32
32
|
var handleDownload = React.useCallback(function (event) {
|
|
33
33
|
if (onDownload) {
|
|
34
34
|
event.preventDefault();
|
|
@@ -61,9 +61,12 @@ var FileUploadItem = function (_a) {
|
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
63
|
}, [showRestore, uploadStatus]);
|
|
64
|
-
var renderInfoSection = React.useCallback(function () {
|
|
65
|
-
|
|
66
|
-
|
|
64
|
+
var renderInfoSection = React.useCallback(function () {
|
|
65
|
+
var errorContent = (uploadStatus === 'ERROR' && !error) ? 'Не удалось загрузить файл' : error;
|
|
66
|
+
return (React__default['default'].createElement("div", { className: styles.infoSection },
|
|
67
|
+
React__default['default'].createElement("div", { className: styles.name }, name),
|
|
68
|
+
error && (React__default['default'].createElement("div", { className: styles.errorWrapper, role: 'alert' }, errorContent))));
|
|
69
|
+
}, [name, uploadStatus, error]);
|
|
67
70
|
var showMeta = !showRestore && (!uploadStatus || uploadStatus === 'SUCCESS');
|
|
68
71
|
var showDownload = Boolean(downloadLink) && !showRestore;
|
|
69
72
|
return (React__default['default'].createElement("div", { className: cn__default['default'](className, styles.component, uploadStatus && styles[uploadStatus.toLocaleLowerCase()]), "data-test-id": dataTestId },
|
package/dist/cssm/Component.js
CHANGED
|
@@ -27,7 +27,7 @@ var cn__default = /*#__PURE__*/_interopDefaultLegacy(cn);
|
|
|
27
27
|
var styles__default = /*#__PURE__*/_interopDefaultLegacy(styles);
|
|
28
28
|
|
|
29
29
|
var FileUploadItem = function (_a) {
|
|
30
|
-
var className = _a.className, children = _a.children, _b = _a.id, id = _b === void 0 ? '0' : _b, _c = _a.name, name = _c === void 0 ? '' : _c, size = _a.size, _d = _a.icon, Icon = _d === void 0 ? utils.fileIcon(name) : _d, uploadDate = _a.uploadDate, downloadLink = _a.downloadLink, download = _a.download, uploadStatus = _a.uploadStatus, _e = _a.uploadPercent, uploadPercent = _e === void 0 ? 0 : _e,
|
|
30
|
+
var className = _a.className, children = _a.children, _b = _a.id, id = _b === void 0 ? '0' : _b, _c = _a.name, name = _c === void 0 ? '' : _c, size = _a.size, _d = _a.icon, Icon = _d === void 0 ? utils.fileIcon(name) : _d, uploadDate = _a.uploadDate, downloadLink = _a.downloadLink, download = _a.download, uploadStatus = _a.uploadStatus, _e = _a.uploadPercent, uploadPercent = _e === void 0 ? 0 : _e, error = _a.error, showDelete = _a.showDelete, showRestore = _a.showRestore, onDelete = _a.onDelete, onDownload = _a.onDownload, onRestore = _a.onRestore, dataTestId = _a.dataTestId;
|
|
31
31
|
var handleDownload = React.useCallback(function (event) {
|
|
32
32
|
if (onDownload) {
|
|
33
33
|
event.preventDefault();
|
|
@@ -60,9 +60,12 @@ var FileUploadItem = function (_a) {
|
|
|
60
60
|
}
|
|
61
61
|
}
|
|
62
62
|
}, [showRestore, uploadStatus]);
|
|
63
|
-
var renderInfoSection = React.useCallback(function () {
|
|
64
|
-
|
|
65
|
-
|
|
63
|
+
var renderInfoSection = React.useCallback(function () {
|
|
64
|
+
var errorContent = (uploadStatus === 'ERROR' && !error) ? 'Не удалось загрузить файл' : error;
|
|
65
|
+
return (React__default['default'].createElement("div", { className: styles__default['default'].infoSection },
|
|
66
|
+
React__default['default'].createElement("div", { className: styles__default['default'].name }, name),
|
|
67
|
+
error && (React__default['default'].createElement("div", { className: styles__default['default'].errorWrapper, role: 'alert' }, errorContent))));
|
|
68
|
+
}, [name, uploadStatus, error]);
|
|
66
69
|
var showMeta = !showRestore && (!uploadStatus || uploadStatus === 'SUCCESS');
|
|
67
70
|
var showDownload = Boolean(downloadLink) && !showRestore;
|
|
68
71
|
return (React__default['default'].createElement("div", { className: cn__default['default'](className, styles__default['default'].component, uploadStatus && styles__default['default'][uploadStatus.toLocaleLowerCase()]), "data-test-id": dataTestId },
|
package/dist/esm/Component.js
CHANGED
|
@@ -15,11 +15,11 @@ import '@alfalab/icons-glyph/DocumentUnknownMIcon';
|
|
|
15
15
|
import '@alfalab/icons-glyph/DocumentImageMIcon';
|
|
16
16
|
import { fileIcon, humanFileSize } from './utils.js';
|
|
17
17
|
|
|
18
|
-
var styles = {"component":"file-upload-
|
|
18
|
+
var styles = {"component":"file-upload-item__component_1p0kf","infoSection":"file-upload-item__infoSection_1p0kf","info":"file-upload-item__info_1p0kf","icon":"file-upload-item__icon_1p0kf","errorIcon":"file-upload-item__errorIcon_1p0kf","successIcon":"file-upload-item__successIcon_1p0kf","name":"file-upload-item__name_1p0kf","meta":"file-upload-item__meta_1p0kf","size":"file-upload-item__size_1p0kf","delete":"file-upload-item__delete_1p0kf","download":"file-upload-item__download_1p0kf","errorWrapper":"file-upload-item__errorWrapper_1p0kf","restore":"file-upload-item__restore_1p0kf","spinnerWrapper":"file-upload-item__spinnerWrapper_1p0kf","spinner":"file-upload-item__spinner_1p0kf","uploadPercent":"file-upload-item__uploadPercent_1p0kf"};
|
|
19
19
|
require('./index.css')
|
|
20
20
|
|
|
21
21
|
var FileUploadItem = function (_a) {
|
|
22
|
-
var className = _a.className, children = _a.children, _b = _a.id, id = _b === void 0 ? '0' : _b, _c = _a.name, name = _c === void 0 ? '' : _c, size = _a.size, _d = _a.icon, Icon = _d === void 0 ? fileIcon(name) : _d, uploadDate = _a.uploadDate, downloadLink = _a.downloadLink, download = _a.download, uploadStatus = _a.uploadStatus, _e = _a.uploadPercent, uploadPercent = _e === void 0 ? 0 : _e,
|
|
22
|
+
var className = _a.className, children = _a.children, _b = _a.id, id = _b === void 0 ? '0' : _b, _c = _a.name, name = _c === void 0 ? '' : _c, size = _a.size, _d = _a.icon, Icon = _d === void 0 ? fileIcon(name) : _d, uploadDate = _a.uploadDate, downloadLink = _a.downloadLink, download = _a.download, uploadStatus = _a.uploadStatus, _e = _a.uploadPercent, uploadPercent = _e === void 0 ? 0 : _e, error = _a.error, showDelete = _a.showDelete, showRestore = _a.showRestore, onDelete = _a.onDelete, onDownload = _a.onDownload, onRestore = _a.onRestore, dataTestId = _a.dataTestId;
|
|
23
23
|
var handleDownload = useCallback(function (event) {
|
|
24
24
|
if (onDownload) {
|
|
25
25
|
event.preventDefault();
|
|
@@ -52,9 +52,12 @@ var FileUploadItem = function (_a) {
|
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
54
|
}, [showRestore, uploadStatus]);
|
|
55
|
-
var renderInfoSection = useCallback(function () {
|
|
56
|
-
|
|
57
|
-
|
|
55
|
+
var renderInfoSection = useCallback(function () {
|
|
56
|
+
var errorContent = (uploadStatus === 'ERROR' && !error) ? 'Не удалось загрузить файл' : error;
|
|
57
|
+
return (React.createElement("div", { className: styles.infoSection },
|
|
58
|
+
React.createElement("div", { className: styles.name }, name),
|
|
59
|
+
error && (React.createElement("div", { className: styles.errorWrapper, role: 'alert' }, errorContent))));
|
|
60
|
+
}, [name, uploadStatus, error]);
|
|
58
61
|
var showMeta = !showRestore && (!uploadStatus || uploadStatus === 'SUCCESS');
|
|
59
62
|
var showDownload = Boolean(downloadLink) && !showRestore;
|
|
60
63
|
return (React.createElement("div", { className: cn(className, styles.component, uploadStatus && styles[uploadStatus.toLocaleLowerCase()]), "data-test-id": dataTestId },
|
package/dist/esm/index.css
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* hash:
|
|
1
|
+
/* hash: n5nqc */
|
|
2
2
|
:root {
|
|
3
3
|
--color-light-border-primary: #dbdee1;
|
|
4
4
|
--color-light-graphic-negative: #f15045;
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
--gap-s: 12px;
|
|
23
23
|
--gap-xl: 24px;
|
|
24
24
|
}
|
|
25
|
-
.file-upload-
|
|
25
|
+
.file-upload-item__component_1p0kf {
|
|
26
26
|
font-size: 13px;
|
|
27
27
|
line-height: 16px;
|
|
28
28
|
font-weight: 400;
|
|
@@ -34,10 +34,10 @@
|
|
|
34
34
|
box-shadow: 0 -1px 0 0 var(--color-light-border-primary) inset;
|
|
35
35
|
box-sizing: border-box
|
|
36
36
|
}
|
|
37
|
-
.file-upload-
|
|
37
|
+
.file-upload-item__component_1p0kf svg {
|
|
38
38
|
display: block;
|
|
39
39
|
}
|
|
40
|
-
.file-upload-
|
|
40
|
+
.file-upload-item__infoSection_1p0kf {
|
|
41
41
|
display: flex;
|
|
42
42
|
flex-direction: column;
|
|
43
43
|
flex: 1;
|
|
@@ -45,86 +45,86 @@
|
|
|
45
45
|
margin-left: var(--gap-s);
|
|
46
46
|
min-width: 40%;
|
|
47
47
|
}
|
|
48
|
-
.file-upload-
|
|
48
|
+
.file-upload-item__info_1p0kf {
|
|
49
49
|
display: flex;
|
|
50
50
|
flex-wrap: wrap;
|
|
51
51
|
flex: 1;
|
|
52
52
|
overflow: hidden;
|
|
53
53
|
}
|
|
54
|
-
.file-upload-
|
|
54
|
+
.file-upload-item__icon_1p0kf {
|
|
55
55
|
display: block;
|
|
56
56
|
flex-shrink: 0;
|
|
57
57
|
color: var(--color-light-text-primary);
|
|
58
58
|
}
|
|
59
|
-
.file-upload-
|
|
59
|
+
.file-upload-item__errorIcon_1p0kf {
|
|
60
60
|
flex-shrink: 0;
|
|
61
61
|
color: var(--color-light-graphic-negative);
|
|
62
62
|
}
|
|
63
|
-
.file-upload-
|
|
63
|
+
.file-upload-item__successIcon_1p0kf {
|
|
64
64
|
flex-shrink: 0;
|
|
65
65
|
color: var(--color-light-graphic-positive);
|
|
66
66
|
}
|
|
67
|
-
.file-upload-
|
|
67
|
+
.file-upload-item__name_1p0kf {
|
|
68
68
|
white-space: nowrap;
|
|
69
69
|
overflow: hidden;
|
|
70
70
|
text-overflow: ellipsis;
|
|
71
71
|
color: var(--color-light-text-primary)
|
|
72
72
|
}
|
|
73
|
-
.file-upload-
|
|
73
|
+
.file-upload-item__meta_1p0kf {
|
|
74
74
|
display: flex;
|
|
75
75
|
align-items: center;
|
|
76
76
|
white-space: nowrap;
|
|
77
77
|
margin-right: var(--gap-2xs);
|
|
78
78
|
margin-left: var(--gap-xl)
|
|
79
79
|
}
|
|
80
|
-
.file-upload-
|
|
80
|
+
.file-upload-item__meta_1p0kf > * {
|
|
81
81
|
margin-right: var(--gap-s)
|
|
82
82
|
}
|
|
83
|
-
.file-upload-
|
|
83
|
+
.file-upload-item__meta_1p0kf > *:last-child {
|
|
84
84
|
margin-right: 0;
|
|
85
85
|
}
|
|
86
|
-
.file-upload-
|
|
86
|
+
.file-upload-item__size_1p0kf {
|
|
87
87
|
text-align: right;
|
|
88
88
|
}
|
|
89
|
-
.file-upload-
|
|
90
|
-
.file-upload-
|
|
89
|
+
.file-upload-item__delete_1p0kf,
|
|
90
|
+
.file-upload-item__download_1p0kf {
|
|
91
91
|
height: 24px;
|
|
92
92
|
width: 24px;
|
|
93
93
|
margin-left: var(--gap-xs)
|
|
94
94
|
}
|
|
95
|
-
.file-upload-
|
|
95
|
+
.file-upload-item__delete_1p0kf svg, .file-upload-item__download_1p0kf svg {
|
|
96
96
|
width: 18px;
|
|
97
97
|
height: 18px;
|
|
98
98
|
}
|
|
99
|
-
.file-upload-
|
|
99
|
+
.file-upload-item__errorWrapper_1p0kf {
|
|
100
100
|
margin-top: var(--gap-s);
|
|
101
101
|
color: var(--color-light-text-accent)
|
|
102
102
|
}
|
|
103
103
|
@media (--small-only) {
|
|
104
|
-
.file-upload-
|
|
104
|
+
.file-upload-item__errorWrapper_1p0kf {
|
|
105
105
|
flex: 1 0 100%;
|
|
106
106
|
margin-top: var(--gap-3xs)
|
|
107
107
|
}
|
|
108
108
|
}
|
|
109
|
-
.file-upload-
|
|
109
|
+
.file-upload-item__restore_1p0kf {
|
|
110
110
|
font-size: 14px;
|
|
111
111
|
line-height: 20px;
|
|
112
112
|
font-weight: 400;
|
|
113
113
|
|
|
114
114
|
margin-left: var(--gap-s);
|
|
115
115
|
}
|
|
116
|
-
.file-upload-
|
|
116
|
+
.file-upload-item__spinnerWrapper_1p0kf {
|
|
117
117
|
display: flex;
|
|
118
118
|
justify-content: center;
|
|
119
119
|
align-items: center;
|
|
120
120
|
width: 24px;
|
|
121
121
|
height: 24px;
|
|
122
122
|
}
|
|
123
|
-
.file-upload-
|
|
123
|
+
.file-upload-item__spinner_1p0kf {
|
|
124
124
|
width: 20px;
|
|
125
125
|
height: 20px;
|
|
126
126
|
}
|
|
127
|
-
.file-upload-
|
|
127
|
+
.file-upload-item__uploadPercent_1p0kf {
|
|
128
128
|
margin-top: var(--gap-2xs);
|
|
129
129
|
margin-left: var(--gap-xl);
|
|
130
130
|
}
|
package/dist/index.css
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* hash:
|
|
1
|
+
/* hash: n5nqc */
|
|
2
2
|
:root {
|
|
3
3
|
--color-light-border-primary: #dbdee1;
|
|
4
4
|
--color-light-graphic-negative: #f15045;
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
--gap-s: 12px;
|
|
23
23
|
--gap-xl: 24px;
|
|
24
24
|
}
|
|
25
|
-
.file-upload-
|
|
25
|
+
.file-upload-item__component_1p0kf {
|
|
26
26
|
font-size: 13px;
|
|
27
27
|
line-height: 16px;
|
|
28
28
|
font-weight: 400;
|
|
@@ -34,10 +34,10 @@
|
|
|
34
34
|
box-shadow: 0 -1px 0 0 var(--color-light-border-primary) inset;
|
|
35
35
|
box-sizing: border-box
|
|
36
36
|
}
|
|
37
|
-
.file-upload-
|
|
37
|
+
.file-upload-item__component_1p0kf svg {
|
|
38
38
|
display: block;
|
|
39
39
|
}
|
|
40
|
-
.file-upload-
|
|
40
|
+
.file-upload-item__infoSection_1p0kf {
|
|
41
41
|
display: flex;
|
|
42
42
|
flex-direction: column;
|
|
43
43
|
flex: 1;
|
|
@@ -45,86 +45,86 @@
|
|
|
45
45
|
margin-left: var(--gap-s);
|
|
46
46
|
min-width: 40%;
|
|
47
47
|
}
|
|
48
|
-
.file-upload-
|
|
48
|
+
.file-upload-item__info_1p0kf {
|
|
49
49
|
display: flex;
|
|
50
50
|
flex-wrap: wrap;
|
|
51
51
|
flex: 1;
|
|
52
52
|
overflow: hidden;
|
|
53
53
|
}
|
|
54
|
-
.file-upload-
|
|
54
|
+
.file-upload-item__icon_1p0kf {
|
|
55
55
|
display: block;
|
|
56
56
|
flex-shrink: 0;
|
|
57
57
|
color: var(--color-light-text-primary);
|
|
58
58
|
}
|
|
59
|
-
.file-upload-
|
|
59
|
+
.file-upload-item__errorIcon_1p0kf {
|
|
60
60
|
flex-shrink: 0;
|
|
61
61
|
color: var(--color-light-graphic-negative);
|
|
62
62
|
}
|
|
63
|
-
.file-upload-
|
|
63
|
+
.file-upload-item__successIcon_1p0kf {
|
|
64
64
|
flex-shrink: 0;
|
|
65
65
|
color: var(--color-light-graphic-positive);
|
|
66
66
|
}
|
|
67
|
-
.file-upload-
|
|
67
|
+
.file-upload-item__name_1p0kf {
|
|
68
68
|
white-space: nowrap;
|
|
69
69
|
overflow: hidden;
|
|
70
70
|
text-overflow: ellipsis;
|
|
71
71
|
color: var(--color-light-text-primary)
|
|
72
72
|
}
|
|
73
|
-
.file-upload-
|
|
73
|
+
.file-upload-item__meta_1p0kf {
|
|
74
74
|
display: flex;
|
|
75
75
|
align-items: center;
|
|
76
76
|
white-space: nowrap;
|
|
77
77
|
margin-right: var(--gap-2xs);
|
|
78
78
|
margin-left: var(--gap-xl)
|
|
79
79
|
}
|
|
80
|
-
.file-upload-
|
|
80
|
+
.file-upload-item__meta_1p0kf > * {
|
|
81
81
|
margin-right: var(--gap-s)
|
|
82
82
|
}
|
|
83
|
-
.file-upload-
|
|
83
|
+
.file-upload-item__meta_1p0kf > *:last-child {
|
|
84
84
|
margin-right: 0;
|
|
85
85
|
}
|
|
86
|
-
.file-upload-
|
|
86
|
+
.file-upload-item__size_1p0kf {
|
|
87
87
|
text-align: right;
|
|
88
88
|
}
|
|
89
|
-
.file-upload-
|
|
90
|
-
.file-upload-
|
|
89
|
+
.file-upload-item__delete_1p0kf,
|
|
90
|
+
.file-upload-item__download_1p0kf {
|
|
91
91
|
height: 24px;
|
|
92
92
|
width: 24px;
|
|
93
93
|
margin-left: var(--gap-xs)
|
|
94
94
|
}
|
|
95
|
-
.file-upload-
|
|
95
|
+
.file-upload-item__delete_1p0kf svg, .file-upload-item__download_1p0kf svg {
|
|
96
96
|
width: 18px;
|
|
97
97
|
height: 18px;
|
|
98
98
|
}
|
|
99
|
-
.file-upload-
|
|
99
|
+
.file-upload-item__errorWrapper_1p0kf {
|
|
100
100
|
margin-top: var(--gap-s);
|
|
101
101
|
color: var(--color-light-text-accent)
|
|
102
102
|
}
|
|
103
103
|
@media (--small-only) {
|
|
104
|
-
.file-upload-
|
|
104
|
+
.file-upload-item__errorWrapper_1p0kf {
|
|
105
105
|
flex: 1 0 100%;
|
|
106
106
|
margin-top: var(--gap-3xs)
|
|
107
107
|
}
|
|
108
108
|
}
|
|
109
|
-
.file-upload-
|
|
109
|
+
.file-upload-item__restore_1p0kf {
|
|
110
110
|
font-size: 14px;
|
|
111
111
|
line-height: 20px;
|
|
112
112
|
font-weight: 400;
|
|
113
113
|
|
|
114
114
|
margin-left: var(--gap-s);
|
|
115
115
|
}
|
|
116
|
-
.file-upload-
|
|
116
|
+
.file-upload-item__spinnerWrapper_1p0kf {
|
|
117
117
|
display: flex;
|
|
118
118
|
justify-content: center;
|
|
119
119
|
align-items: center;
|
|
120
120
|
width: 24px;
|
|
121
121
|
height: 24px;
|
|
122
122
|
}
|
|
123
|
-
.file-upload-
|
|
123
|
+
.file-upload-item__spinner_1p0kf {
|
|
124
124
|
width: 20px;
|
|
125
125
|
height: 20px;
|
|
126
126
|
}
|
|
127
|
-
.file-upload-
|
|
127
|
+
.file-upload-item__uploadPercent_1p0kf {
|
|
128
128
|
margin-top: var(--gap-2xs);
|
|
129
129
|
margin-left: var(--gap-xl);
|
|
130
130
|
}
|
package/dist/modern/Component.js
CHANGED
|
@@ -15,10 +15,10 @@ import '@alfalab/icons-glyph/DocumentUnknownMIcon';
|
|
|
15
15
|
import '@alfalab/icons-glyph/DocumentImageMIcon';
|
|
16
16
|
import { fileIcon, humanFileSize } from './utils.js';
|
|
17
17
|
|
|
18
|
-
var styles = {"component":"file-upload-
|
|
18
|
+
var styles = {"component":"file-upload-item__component_1p0kf","infoSection":"file-upload-item__infoSection_1p0kf","info":"file-upload-item__info_1p0kf","icon":"file-upload-item__icon_1p0kf","errorIcon":"file-upload-item__errorIcon_1p0kf","successIcon":"file-upload-item__successIcon_1p0kf","name":"file-upload-item__name_1p0kf","meta":"file-upload-item__meta_1p0kf","size":"file-upload-item__size_1p0kf","delete":"file-upload-item__delete_1p0kf","download":"file-upload-item__download_1p0kf","errorWrapper":"file-upload-item__errorWrapper_1p0kf","restore":"file-upload-item__restore_1p0kf","spinnerWrapper":"file-upload-item__spinnerWrapper_1p0kf","spinner":"file-upload-item__spinner_1p0kf","uploadPercent":"file-upload-item__uploadPercent_1p0kf"};
|
|
19
19
|
require('./index.css')
|
|
20
20
|
|
|
21
|
-
const FileUploadItem = ({ className, children, id = '0', name = '', size, icon: Icon = fileIcon(name), uploadDate, downloadLink, download, uploadStatus, uploadPercent = 0, error
|
|
21
|
+
const FileUploadItem = ({ className, children, id = '0', name = '', size, icon: Icon = fileIcon(name), uploadDate, downloadLink, download, uploadStatus, uploadPercent = 0, error, showDelete, showRestore, onDelete, onDownload, onRestore, dataTestId, }) => {
|
|
22
22
|
const handleDownload = useCallback((event) => {
|
|
23
23
|
if (onDownload) {
|
|
24
24
|
event.preventDefault();
|
|
@@ -51,9 +51,12 @@ const FileUploadItem = ({ className, children, id = '0', name = '', size, icon:
|
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
53
|
}, [showRestore, uploadStatus]);
|
|
54
|
-
const renderInfoSection = useCallback(() =>
|
|
55
|
-
|
|
56
|
-
|
|
54
|
+
const renderInfoSection = useCallback(() => {
|
|
55
|
+
const errorContent = (uploadStatus === 'ERROR' && !error) ? 'Не удалось загрузить файл' : error;
|
|
56
|
+
return (React.createElement("div", { className: styles.infoSection },
|
|
57
|
+
React.createElement("div", { className: styles.name }, name),
|
|
58
|
+
error && (React.createElement("div", { className: styles.errorWrapper, role: 'alert' }, errorContent))));
|
|
59
|
+
}, [name, uploadStatus, error]);
|
|
57
60
|
const showMeta = !showRestore && (!uploadStatus || uploadStatus === 'SUCCESS');
|
|
58
61
|
const showDownload = Boolean(downloadLink) && !showRestore;
|
|
59
62
|
return (React.createElement("div", { className: cn(className, styles.component, uploadStatus && styles[uploadStatus.toLocaleLowerCase()]), "data-test-id": dataTestId },
|
package/dist/modern/index.css
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* hash:
|
|
1
|
+
/* hash: n5nqc */
|
|
2
2
|
:root {
|
|
3
3
|
--color-light-border-primary: #dbdee1;
|
|
4
4
|
--color-light-graphic-negative: #f15045;
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
--gap-s: 12px;
|
|
23
23
|
--gap-xl: 24px;
|
|
24
24
|
}
|
|
25
|
-
.file-upload-
|
|
25
|
+
.file-upload-item__component_1p0kf {
|
|
26
26
|
font-size: 13px;
|
|
27
27
|
line-height: 16px;
|
|
28
28
|
font-weight: 400;
|
|
@@ -34,10 +34,10 @@
|
|
|
34
34
|
box-shadow: 0 -1px 0 0 var(--color-light-border-primary) inset;
|
|
35
35
|
box-sizing: border-box
|
|
36
36
|
}
|
|
37
|
-
.file-upload-
|
|
37
|
+
.file-upload-item__component_1p0kf svg {
|
|
38
38
|
display: block;
|
|
39
39
|
}
|
|
40
|
-
.file-upload-
|
|
40
|
+
.file-upload-item__infoSection_1p0kf {
|
|
41
41
|
display: flex;
|
|
42
42
|
flex-direction: column;
|
|
43
43
|
flex: 1;
|
|
@@ -45,86 +45,86 @@
|
|
|
45
45
|
margin-left: var(--gap-s);
|
|
46
46
|
min-width: 40%;
|
|
47
47
|
}
|
|
48
|
-
.file-upload-
|
|
48
|
+
.file-upload-item__info_1p0kf {
|
|
49
49
|
display: flex;
|
|
50
50
|
flex-wrap: wrap;
|
|
51
51
|
flex: 1;
|
|
52
52
|
overflow: hidden;
|
|
53
53
|
}
|
|
54
|
-
.file-upload-
|
|
54
|
+
.file-upload-item__icon_1p0kf {
|
|
55
55
|
display: block;
|
|
56
56
|
flex-shrink: 0;
|
|
57
57
|
color: var(--color-light-text-primary);
|
|
58
58
|
}
|
|
59
|
-
.file-upload-
|
|
59
|
+
.file-upload-item__errorIcon_1p0kf {
|
|
60
60
|
flex-shrink: 0;
|
|
61
61
|
color: var(--color-light-graphic-negative);
|
|
62
62
|
}
|
|
63
|
-
.file-upload-
|
|
63
|
+
.file-upload-item__successIcon_1p0kf {
|
|
64
64
|
flex-shrink: 0;
|
|
65
65
|
color: var(--color-light-graphic-positive);
|
|
66
66
|
}
|
|
67
|
-
.file-upload-
|
|
67
|
+
.file-upload-item__name_1p0kf {
|
|
68
68
|
white-space: nowrap;
|
|
69
69
|
overflow: hidden;
|
|
70
70
|
text-overflow: ellipsis;
|
|
71
71
|
color: var(--color-light-text-primary)
|
|
72
72
|
}
|
|
73
|
-
.file-upload-
|
|
73
|
+
.file-upload-item__meta_1p0kf {
|
|
74
74
|
display: flex;
|
|
75
75
|
align-items: center;
|
|
76
76
|
white-space: nowrap;
|
|
77
77
|
margin-right: var(--gap-2xs);
|
|
78
78
|
margin-left: var(--gap-xl)
|
|
79
79
|
}
|
|
80
|
-
.file-upload-
|
|
80
|
+
.file-upload-item__meta_1p0kf > * {
|
|
81
81
|
margin-right: var(--gap-s)
|
|
82
82
|
}
|
|
83
|
-
.file-upload-
|
|
83
|
+
.file-upload-item__meta_1p0kf > *:last-child {
|
|
84
84
|
margin-right: 0;
|
|
85
85
|
}
|
|
86
|
-
.file-upload-
|
|
86
|
+
.file-upload-item__size_1p0kf {
|
|
87
87
|
text-align: right;
|
|
88
88
|
}
|
|
89
|
-
.file-upload-
|
|
90
|
-
.file-upload-
|
|
89
|
+
.file-upload-item__delete_1p0kf,
|
|
90
|
+
.file-upload-item__download_1p0kf {
|
|
91
91
|
height: 24px;
|
|
92
92
|
width: 24px;
|
|
93
93
|
margin-left: var(--gap-xs)
|
|
94
94
|
}
|
|
95
|
-
.file-upload-
|
|
95
|
+
.file-upload-item__delete_1p0kf svg, .file-upload-item__download_1p0kf svg {
|
|
96
96
|
width: 18px;
|
|
97
97
|
height: 18px;
|
|
98
98
|
}
|
|
99
|
-
.file-upload-
|
|
99
|
+
.file-upload-item__errorWrapper_1p0kf {
|
|
100
100
|
margin-top: var(--gap-s);
|
|
101
101
|
color: var(--color-light-text-accent)
|
|
102
102
|
}
|
|
103
103
|
@media (--small-only) {
|
|
104
|
-
.file-upload-
|
|
104
|
+
.file-upload-item__errorWrapper_1p0kf {
|
|
105
105
|
flex: 1 0 100%;
|
|
106
106
|
margin-top: var(--gap-3xs)
|
|
107
107
|
}
|
|
108
108
|
}
|
|
109
|
-
.file-upload-
|
|
109
|
+
.file-upload-item__restore_1p0kf {
|
|
110
110
|
font-size: 14px;
|
|
111
111
|
line-height: 20px;
|
|
112
112
|
font-weight: 400;
|
|
113
113
|
|
|
114
114
|
margin-left: var(--gap-s);
|
|
115
115
|
}
|
|
116
|
-
.file-upload-
|
|
116
|
+
.file-upload-item__spinnerWrapper_1p0kf {
|
|
117
117
|
display: flex;
|
|
118
118
|
justify-content: center;
|
|
119
119
|
align-items: center;
|
|
120
120
|
width: 24px;
|
|
121
121
|
height: 24px;
|
|
122
122
|
}
|
|
123
|
-
.file-upload-
|
|
123
|
+
.file-upload-item__spinner_1p0kf {
|
|
124
124
|
width: 20px;
|
|
125
125
|
height: 20px;
|
|
126
126
|
}
|
|
127
|
-
.file-upload-
|
|
127
|
+
.file-upload-item__uploadPercent_1p0kf {
|
|
128
128
|
margin-top: var(--gap-2xs);
|
|
129
129
|
margin-left: var(--gap-xl);
|
|
130
130
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alfalab/core-components-file-upload-item",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.6.1",
|
|
4
4
|
"description": "",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"license": "MIT",
|
|
@@ -16,10 +16,10 @@
|
|
|
16
16
|
"react": "^16.9.0 || ^17.0.1"
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@alfalab/core-components-icon-button": "^4.1.
|
|
19
|
+
"@alfalab/core-components-icon-button": "^4.1.9",
|
|
20
20
|
"@alfalab/core-components-link": "^3.2.4",
|
|
21
21
|
"@alfalab/core-components-spinner": "^2.0.3",
|
|
22
22
|
"@alfalab/icons-glyph": "^2.16.0"
|
|
23
23
|
},
|
|
24
|
-
"gitHead": "
|
|
24
|
+
"gitHead": "08782e2aa9782f8f2cce91ac2512918999ab4c22"
|
|
25
25
|
}
|