@alfalab/core-components-file-upload-item 3.2.0 → 3.3.3
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/CHANGELOG.md +35 -0
- package/dist/Component.d.ts +5 -0
- package/dist/Component.js +3 -3
- package/dist/cssm/Component.d.ts +5 -0
- package/dist/cssm/Component.js +2 -2
- package/dist/esm/Component.d.ts +5 -0
- package/dist/esm/Component.js +3 -3
- package/dist/esm/index.css +15 -15
- package/dist/index.css +15 -15
- package/dist/modern/Component.d.ts +5 -0
- package/dist/modern/Component.js +3 -3
- package/dist/modern/index.css +15 -15
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,41 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [3.3.3](https://github.com/alfa-laboratory/core-components/compare/@alfalab/core-components-file-upload-item@3.3.2...@alfalab/core-components-file-upload-item@3.3.3) (2021-12-08)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @alfalab/core-components-file-upload-item
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## [3.3.2](https://github.com/alfa-laboratory/core-components/compare/@alfalab/core-components-file-upload-item@3.3.1...@alfalab/core-components-file-upload-item@3.3.2) (2021-11-26)
|
|
15
|
+
|
|
16
|
+
**Note:** Version bump only for package @alfalab/core-components-file-upload-item
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
## [3.3.1](https://github.com/alfa-laboratory/core-components/compare/@alfalab/core-components-file-upload-item@3.3.0...@alfalab/core-components-file-upload-item@3.3.1) (2021-11-16)
|
|
23
|
+
|
|
24
|
+
**Note:** Version bump only for package @alfalab/core-components-file-upload-item
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
# [3.3.0](https://github.com/alfa-laboratory/core-components/compare/@alfalab/core-components-file-upload-item@3.2.0...@alfalab/core-components-file-upload-item@3.3.0) (2021-10-12)
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
### Features
|
|
34
|
+
|
|
35
|
+
* **file-upload-item:** добавлен пропс download ([#844](https://github.com/alfa-laboratory/core-components/issues/844)) ([db2a4ca](https://github.com/alfa-laboratory/core-components/commit/db2a4ca27ee7a64721138c7c2e918b4657c75489))
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
6
41
|
# [3.2.0](https://github.com/alfa-laboratory/core-components/compare/@alfalab/core-components-file-upload-item@3.1.1...@alfalab/core-components-file-upload-item@3.2.0) (2021-10-11)
|
|
7
42
|
|
|
8
43
|
|
package/dist/Component.d.ts
CHANGED
|
@@ -27,6 +27,11 @@ type FileUploadItemProps = {
|
|
|
27
27
|
* Ссылка на файл. Если прокидывается этот параметр, то заголовок становится ссылкой
|
|
28
28
|
*/
|
|
29
29
|
downloadLink?: string;
|
|
30
|
+
/**
|
|
31
|
+
* Рекомендует браузеру скачивать контент по ссылке.
|
|
32
|
+
* В проп может быть передано рекомендуемое название скачиваемого файла.
|
|
33
|
+
*/
|
|
34
|
+
download?: string | true;
|
|
30
35
|
/**
|
|
31
36
|
* Отображение кнопки удаления
|
|
32
37
|
*/
|
package/dist/Component.js
CHANGED
|
@@ -18,11 +18,11 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
|
18
18
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
19
19
|
var cn__default = /*#__PURE__*/_interopDefaultLegacy(cn);
|
|
20
20
|
|
|
21
|
-
var styles = {"component":"file-upload-
|
|
21
|
+
var styles = {"component":"file-upload-item__component_76rbl","info":"file-upload-item__info_76rbl","icon":"file-upload-item__icon_76rbl","errorIcon":"file-upload-item__errorIcon_76rbl","successIcon":"file-upload-item__successIcon_76rbl","name":"file-upload-item__name_76rbl","meta":"file-upload-item__meta_76rbl","size":"file-upload-item__size_76rbl","delete":"file-upload-item__delete_76rbl","error":"file-upload-item__error_76rbl"};
|
|
22
22
|
require('./index.css')
|
|
23
23
|
|
|
24
24
|
var FileUploadItem = function (_a) {
|
|
25
|
-
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, uploadStatus = _a.uploadStatus, _e = _a.uploadPercent, uploadPercent = _e === void 0 ? 0 : _e, _f = _a.error, error = _f === void 0 ? uploadStatus === 'ERROR' ? 'Не удалось загрузить файл' : undefined : _f, showDelete = _a.showDelete, showRestore = _a.showRestore, onDelete = _a.onDelete, onDownload = _a.onDownload, onRestore = _a.onRestore, dataTestId = _a.dataTestId;
|
|
25
|
+
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, _f = _a.error, error = _f === void 0 ? uploadStatus === 'ERROR' ? 'Не удалось загрузить файл' : undefined : _f, showDelete = _a.showDelete, showRestore = _a.showRestore, onDelete = _a.onDelete, onDownload = _a.onDownload, onRestore = _a.onRestore, dataTestId = _a.dataTestId;
|
|
26
26
|
var handleDownload = React.useCallback(function (event) {
|
|
27
27
|
if (onDownload) {
|
|
28
28
|
event.preventDefault();
|
|
@@ -51,7 +51,7 @@ var FileUploadItem = function (_a) {
|
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
53
|
}, [uploadStatus]);
|
|
54
|
-
var renderName = React.useCallback(function () { return (React__default['default'].createElement("div", { className: styles.name }, downloadLink ? (React__default['default'].createElement(coreComponentsLink.Link, { pseudo: true, href: downloadLink, onClick: handleDownload }, name)) : (name))); }, [downloadLink, handleDownload, name]);
|
|
54
|
+
var renderName = React.useCallback(function () { return (React__default['default'].createElement("div", { className: styles.name }, downloadLink ? (React__default['default'].createElement(coreComponentsLink.Link, { pseudo: true, href: downloadLink, onClick: handleDownload, download: download }, name)) : (name))); }, [downloadLink, handleDownload, download, name]);
|
|
55
55
|
var showMeta = !showRestore && (!uploadStatus || uploadStatus === 'SUCCESS');
|
|
56
56
|
return (React__default['default'].createElement("div", { className: cn__default['default'](className, styles.component, uploadStatus && styles[uploadStatus.toLocaleLowerCase()]), "data-test-id": dataTestId },
|
|
57
57
|
React__default['default'].createElement("div", { className: styles.info },
|
package/dist/cssm/Component.d.ts
CHANGED
|
@@ -27,6 +27,11 @@ type FileUploadItemProps = {
|
|
|
27
27
|
* Ссылка на файл. Если прокидывается этот параметр, то заголовок становится ссылкой
|
|
28
28
|
*/
|
|
29
29
|
downloadLink?: string;
|
|
30
|
+
/**
|
|
31
|
+
* Рекомендует браузеру скачивать контент по ссылке.
|
|
32
|
+
* В проп может быть передано рекомендуемое название скачиваемого файла.
|
|
33
|
+
*/
|
|
34
|
+
download?: string | true;
|
|
30
35
|
/**
|
|
31
36
|
* Отображение кнопки удаления
|
|
32
37
|
*/
|
package/dist/cssm/Component.js
CHANGED
|
@@ -21,7 +21,7 @@ var cn__default = /*#__PURE__*/_interopDefaultLegacy(cn);
|
|
|
21
21
|
var styles__default = /*#__PURE__*/_interopDefaultLegacy(styles);
|
|
22
22
|
|
|
23
23
|
var FileUploadItem = function (_a) {
|
|
24
|
-
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, uploadStatus = _a.uploadStatus, _e = _a.uploadPercent, uploadPercent = _e === void 0 ? 0 : _e, _f = _a.error, error = _f === void 0 ? uploadStatus === 'ERROR' ? 'Не удалось загрузить файл' : undefined : _f, showDelete = _a.showDelete, showRestore = _a.showRestore, onDelete = _a.onDelete, onDownload = _a.onDownload, onRestore = _a.onRestore, dataTestId = _a.dataTestId;
|
|
24
|
+
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, _f = _a.error, error = _f === void 0 ? uploadStatus === 'ERROR' ? 'Не удалось загрузить файл' : undefined : _f, showDelete = _a.showDelete, showRestore = _a.showRestore, onDelete = _a.onDelete, onDownload = _a.onDownload, onRestore = _a.onRestore, dataTestId = _a.dataTestId;
|
|
25
25
|
var handleDownload = React.useCallback(function (event) {
|
|
26
26
|
if (onDownload) {
|
|
27
27
|
event.preventDefault();
|
|
@@ -50,7 +50,7 @@ var FileUploadItem = function (_a) {
|
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
52
|
}, [uploadStatus]);
|
|
53
|
-
var renderName = React.useCallback(function () { return (React__default['default'].createElement("div", { className: styles__default['default'].name }, downloadLink ? (React__default['default'].createElement(coreComponentsLink.Link, { pseudo: true, href: downloadLink, onClick: handleDownload }, name)) : (name))); }, [downloadLink, handleDownload, name]);
|
|
53
|
+
var renderName = React.useCallback(function () { return (React__default['default'].createElement("div", { className: styles__default['default'].name }, downloadLink ? (React__default['default'].createElement(coreComponentsLink.Link, { pseudo: true, href: downloadLink, onClick: handleDownload, download: download }, name)) : (name))); }, [downloadLink, handleDownload, download, name]);
|
|
54
54
|
var showMeta = !showRestore && (!uploadStatus || uploadStatus === 'SUCCESS');
|
|
55
55
|
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 },
|
|
56
56
|
React__default['default'].createElement("div", { className: styles__default['default'].info },
|
package/dist/esm/Component.d.ts
CHANGED
|
@@ -27,6 +27,11 @@ type FileUploadItemProps = {
|
|
|
27
27
|
* Ссылка на файл. Если прокидывается этот параметр, то заголовок становится ссылкой
|
|
28
28
|
*/
|
|
29
29
|
downloadLink?: string;
|
|
30
|
+
/**
|
|
31
|
+
* Рекомендует браузеру скачивать контент по ссылке.
|
|
32
|
+
* В проп может быть передано рекомендуемое название скачиваемого файла.
|
|
33
|
+
*/
|
|
34
|
+
download?: string | true;
|
|
30
35
|
/**
|
|
31
36
|
* Отображение кнопки удаления
|
|
32
37
|
*/
|
package/dist/esm/Component.js
CHANGED
|
@@ -9,11 +9,11 @@ import { AlertCircleMIcon } from '@alfalab/icons-glyph/AlertCircleMIcon';
|
|
|
9
9
|
import '@alfalab/icons-glyph';
|
|
10
10
|
import { fileIcon, humanFileSize } from './utils.js';
|
|
11
11
|
|
|
12
|
-
var styles = {"component":"file-upload-
|
|
12
|
+
var styles = {"component":"file-upload-item__component_76rbl","info":"file-upload-item__info_76rbl","icon":"file-upload-item__icon_76rbl","errorIcon":"file-upload-item__errorIcon_76rbl","successIcon":"file-upload-item__successIcon_76rbl","name":"file-upload-item__name_76rbl","meta":"file-upload-item__meta_76rbl","size":"file-upload-item__size_76rbl","delete":"file-upload-item__delete_76rbl","error":"file-upload-item__error_76rbl"};
|
|
13
13
|
require('./index.css')
|
|
14
14
|
|
|
15
15
|
var FileUploadItem = function (_a) {
|
|
16
|
-
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, uploadStatus = _a.uploadStatus, _e = _a.uploadPercent, uploadPercent = _e === void 0 ? 0 : _e, _f = _a.error, error = _f === void 0 ? uploadStatus === 'ERROR' ? 'Не удалось загрузить файл' : undefined : _f, showDelete = _a.showDelete, showRestore = _a.showRestore, onDelete = _a.onDelete, onDownload = _a.onDownload, onRestore = _a.onRestore, dataTestId = _a.dataTestId;
|
|
16
|
+
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, _f = _a.error, error = _f === void 0 ? uploadStatus === 'ERROR' ? 'Не удалось загрузить файл' : undefined : _f, showDelete = _a.showDelete, showRestore = _a.showRestore, onDelete = _a.onDelete, onDownload = _a.onDownload, onRestore = _a.onRestore, dataTestId = _a.dataTestId;
|
|
17
17
|
var handleDownload = useCallback(function (event) {
|
|
18
18
|
if (onDownload) {
|
|
19
19
|
event.preventDefault();
|
|
@@ -42,7 +42,7 @@ var FileUploadItem = function (_a) {
|
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
44
|
}, [uploadStatus]);
|
|
45
|
-
var renderName = useCallback(function () { return (React.createElement("div", { className: styles.name }, downloadLink ? (React.createElement(Link, { pseudo: true, href: downloadLink, onClick: handleDownload }, name)) : (name))); }, [downloadLink, handleDownload, name]);
|
|
45
|
+
var renderName = useCallback(function () { return (React.createElement("div", { className: styles.name }, downloadLink ? (React.createElement(Link, { pseudo: true, href: downloadLink, onClick: handleDownload, download: download }, name)) : (name))); }, [downloadLink, handleDownload, download, name]);
|
|
46
46
|
var showMeta = !showRestore && (!uploadStatus || uploadStatus === 'SUCCESS');
|
|
47
47
|
return (React.createElement("div", { className: cn(className, styles.component, uploadStatus && styles[uploadStatus.toLocaleLowerCase()]), "data-test-id": dataTestId },
|
|
48
48
|
React.createElement("div", { className: styles.info },
|
package/dist/esm/index.css
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* hash:
|
|
1
|
+
/* hash: 1e54w */
|
|
2
2
|
:root {
|
|
3
3
|
--color-light-border-primary: #dbdee1;
|
|
4
4
|
--color-light-graphic-negative: #f15045;
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
--gap-xs: 8px;
|
|
21
21
|
--gap-s: 12px;
|
|
22
22
|
}
|
|
23
|
-
.file-upload-
|
|
23
|
+
.file-upload-item__component_76rbl {
|
|
24
24
|
font-size: 13px;
|
|
25
25
|
line-height: 16px;
|
|
26
26
|
font-weight: 400;
|
|
@@ -33,29 +33,29 @@
|
|
|
33
33
|
padding: 0 0 var(--gap-xs) 0;
|
|
34
34
|
margin-bottom: var(--gap-xs)
|
|
35
35
|
}
|
|
36
|
-
.file-upload-
|
|
36
|
+
.file-upload-item__component_76rbl svg {
|
|
37
37
|
display: block;
|
|
38
38
|
}
|
|
39
|
-
.file-upload-
|
|
39
|
+
.file-upload-item__info_76rbl {
|
|
40
40
|
display: flex;
|
|
41
41
|
align-items: center;
|
|
42
42
|
flex-wrap: wrap;
|
|
43
43
|
flex: 1;
|
|
44
44
|
}
|
|
45
|
-
.file-upload-
|
|
45
|
+
.file-upload-item__icon_76rbl {
|
|
46
46
|
display: block;
|
|
47
47
|
flex-shrink: 0;
|
|
48
48
|
color: var(--color-light-text-primary);
|
|
49
49
|
}
|
|
50
|
-
.file-upload-
|
|
50
|
+
.file-upload-item__errorIcon_76rbl {
|
|
51
51
|
flex-shrink: 0;
|
|
52
52
|
color: var(--color-light-graphic-negative);
|
|
53
53
|
}
|
|
54
|
-
.file-upload-
|
|
54
|
+
.file-upload-item__successIcon_76rbl {
|
|
55
55
|
flex-shrink: 0;
|
|
56
56
|
color: var(--color-light-graphic-positive);
|
|
57
57
|
}
|
|
58
|
-
.file-upload-
|
|
58
|
+
.file-upload-item__name_76rbl {
|
|
59
59
|
flex: 1;
|
|
60
60
|
margin-left: var(--gap-xs);
|
|
61
61
|
white-space: nowrap;
|
|
@@ -64,32 +64,32 @@
|
|
|
64
64
|
color: var(--color-light-text-primary);
|
|
65
65
|
min-width: 40%
|
|
66
66
|
}
|
|
67
|
-
.file-upload-
|
|
67
|
+
.file-upload-item__meta_76rbl {
|
|
68
68
|
display: flex;
|
|
69
69
|
align-items: center;
|
|
70
70
|
|
|
71
71
|
white-space: nowrap
|
|
72
72
|
}
|
|
73
|
-
.file-upload-
|
|
73
|
+
.file-upload-item__meta_76rbl > * {
|
|
74
74
|
margin-right: var(--gap-s)
|
|
75
75
|
}
|
|
76
|
-
.file-upload-
|
|
76
|
+
.file-upload-item__meta_76rbl > *:last-child {
|
|
77
77
|
margin-right: 0;
|
|
78
78
|
}
|
|
79
|
-
.file-upload-
|
|
79
|
+
.file-upload-item__size_76rbl {
|
|
80
80
|
width: 65px;
|
|
81
81
|
text-align: right;
|
|
82
82
|
}
|
|
83
|
-
.file-upload-
|
|
83
|
+
.file-upload-item__delete_76rbl {
|
|
84
84
|
height: 24px;
|
|
85
85
|
width: 24px;
|
|
86
86
|
margin-left: var(--gap-s);
|
|
87
87
|
}
|
|
88
|
-
.file-upload-
|
|
88
|
+
.file-upload-item__error_76rbl {
|
|
89
89
|
color: var(--color-light-text-accent)
|
|
90
90
|
}
|
|
91
91
|
@media (--small-only) {
|
|
92
|
-
.file-upload-
|
|
92
|
+
.file-upload-item__error_76rbl {
|
|
93
93
|
flex: 1 0 100%;
|
|
94
94
|
margin-top: var(--gap-3xs)
|
|
95
95
|
}
|
package/dist/index.css
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* hash:
|
|
1
|
+
/* hash: 1e54w */
|
|
2
2
|
:root {
|
|
3
3
|
--color-light-border-primary: #dbdee1;
|
|
4
4
|
--color-light-graphic-negative: #f15045;
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
--gap-xs: 8px;
|
|
21
21
|
--gap-s: 12px;
|
|
22
22
|
}
|
|
23
|
-
.file-upload-
|
|
23
|
+
.file-upload-item__component_76rbl {
|
|
24
24
|
font-size: 13px;
|
|
25
25
|
line-height: 16px;
|
|
26
26
|
font-weight: 400;
|
|
@@ -33,29 +33,29 @@
|
|
|
33
33
|
padding: 0 0 var(--gap-xs) 0;
|
|
34
34
|
margin-bottom: var(--gap-xs)
|
|
35
35
|
}
|
|
36
|
-
.file-upload-
|
|
36
|
+
.file-upload-item__component_76rbl svg {
|
|
37
37
|
display: block;
|
|
38
38
|
}
|
|
39
|
-
.file-upload-
|
|
39
|
+
.file-upload-item__info_76rbl {
|
|
40
40
|
display: flex;
|
|
41
41
|
align-items: center;
|
|
42
42
|
flex-wrap: wrap;
|
|
43
43
|
flex: 1;
|
|
44
44
|
}
|
|
45
|
-
.file-upload-
|
|
45
|
+
.file-upload-item__icon_76rbl {
|
|
46
46
|
display: block;
|
|
47
47
|
flex-shrink: 0;
|
|
48
48
|
color: var(--color-light-text-primary);
|
|
49
49
|
}
|
|
50
|
-
.file-upload-
|
|
50
|
+
.file-upload-item__errorIcon_76rbl {
|
|
51
51
|
flex-shrink: 0;
|
|
52
52
|
color: var(--color-light-graphic-negative);
|
|
53
53
|
}
|
|
54
|
-
.file-upload-
|
|
54
|
+
.file-upload-item__successIcon_76rbl {
|
|
55
55
|
flex-shrink: 0;
|
|
56
56
|
color: var(--color-light-graphic-positive);
|
|
57
57
|
}
|
|
58
|
-
.file-upload-
|
|
58
|
+
.file-upload-item__name_76rbl {
|
|
59
59
|
flex: 1;
|
|
60
60
|
margin-left: var(--gap-xs);
|
|
61
61
|
white-space: nowrap;
|
|
@@ -64,32 +64,32 @@
|
|
|
64
64
|
color: var(--color-light-text-primary);
|
|
65
65
|
min-width: 40%
|
|
66
66
|
}
|
|
67
|
-
.file-upload-
|
|
67
|
+
.file-upload-item__meta_76rbl {
|
|
68
68
|
display: flex;
|
|
69
69
|
align-items: center;
|
|
70
70
|
|
|
71
71
|
white-space: nowrap
|
|
72
72
|
}
|
|
73
|
-
.file-upload-
|
|
73
|
+
.file-upload-item__meta_76rbl > * {
|
|
74
74
|
margin-right: var(--gap-s)
|
|
75
75
|
}
|
|
76
|
-
.file-upload-
|
|
76
|
+
.file-upload-item__meta_76rbl > *:last-child {
|
|
77
77
|
margin-right: 0;
|
|
78
78
|
}
|
|
79
|
-
.file-upload-
|
|
79
|
+
.file-upload-item__size_76rbl {
|
|
80
80
|
width: 65px;
|
|
81
81
|
text-align: right;
|
|
82
82
|
}
|
|
83
|
-
.file-upload-
|
|
83
|
+
.file-upload-item__delete_76rbl {
|
|
84
84
|
height: 24px;
|
|
85
85
|
width: 24px;
|
|
86
86
|
margin-left: var(--gap-s);
|
|
87
87
|
}
|
|
88
|
-
.file-upload-
|
|
88
|
+
.file-upload-item__error_76rbl {
|
|
89
89
|
color: var(--color-light-text-accent)
|
|
90
90
|
}
|
|
91
91
|
@media (--small-only) {
|
|
92
|
-
.file-upload-
|
|
92
|
+
.file-upload-item__error_76rbl {
|
|
93
93
|
flex: 1 0 100%;
|
|
94
94
|
margin-top: var(--gap-3xs)
|
|
95
95
|
}
|
|
@@ -27,6 +27,11 @@ type FileUploadItemProps = {
|
|
|
27
27
|
* Ссылка на файл. Если прокидывается этот параметр, то заголовок становится ссылкой
|
|
28
28
|
*/
|
|
29
29
|
downloadLink?: string;
|
|
30
|
+
/**
|
|
31
|
+
* Рекомендует браузеру скачивать контент по ссылке.
|
|
32
|
+
* В проп может быть передано рекомендуемое название скачиваемого файла.
|
|
33
|
+
*/
|
|
34
|
+
download?: string | true;
|
|
30
35
|
/**
|
|
31
36
|
* Отображение кнопки удаления
|
|
32
37
|
*/
|
package/dist/modern/Component.js
CHANGED
|
@@ -9,10 +9,10 @@ import { AlertCircleMIcon } from '@alfalab/icons-glyph/AlertCircleMIcon';
|
|
|
9
9
|
import '@alfalab/icons-glyph';
|
|
10
10
|
import { fileIcon, humanFileSize } from './utils.js';
|
|
11
11
|
|
|
12
|
-
var styles = {"component":"file-upload-
|
|
12
|
+
var styles = {"component":"file-upload-item__component_76rbl","info":"file-upload-item__info_76rbl","icon":"file-upload-item__icon_76rbl","errorIcon":"file-upload-item__errorIcon_76rbl","successIcon":"file-upload-item__successIcon_76rbl","name":"file-upload-item__name_76rbl","meta":"file-upload-item__meta_76rbl","size":"file-upload-item__size_76rbl","delete":"file-upload-item__delete_76rbl","error":"file-upload-item__error_76rbl"};
|
|
13
13
|
require('./index.css')
|
|
14
14
|
|
|
15
|
-
const FileUploadItem = ({ className, children, id = '0', name = '', size, icon: Icon = fileIcon(name), uploadDate, downloadLink, uploadStatus, uploadPercent = 0, error = uploadStatus === 'ERROR' ? 'Не удалось загрузить файл' : undefined, showDelete, showRestore, onDelete, onDownload, onRestore, dataTestId, }) => {
|
|
15
|
+
const FileUploadItem = ({ className, children, id = '0', name = '', size, icon: Icon = fileIcon(name), uploadDate, downloadLink, download, uploadStatus, uploadPercent = 0, error = uploadStatus === 'ERROR' ? 'Не удалось загрузить файл' : undefined, showDelete, showRestore, onDelete, onDownload, onRestore, dataTestId, }) => {
|
|
16
16
|
const handleDownload = useCallback((event) => {
|
|
17
17
|
if (onDownload) {
|
|
18
18
|
event.preventDefault();
|
|
@@ -41,7 +41,7 @@ const FileUploadItem = ({ className, children, id = '0', name = '', size, icon:
|
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
43
|
}, [uploadStatus]);
|
|
44
|
-
const renderName = useCallback(() => (React.createElement("div", { className: styles.name }, downloadLink ? (React.createElement(Link, { pseudo: true, href: downloadLink, onClick: handleDownload }, name)) : (name))), [downloadLink, handleDownload, name]);
|
|
44
|
+
const renderName = useCallback(() => (React.createElement("div", { className: styles.name }, downloadLink ? (React.createElement(Link, { pseudo: true, href: downloadLink, onClick: handleDownload, download: download }, name)) : (name))), [downloadLink, handleDownload, download, name]);
|
|
45
45
|
const showMeta = !showRestore && (!uploadStatus || uploadStatus === 'SUCCESS');
|
|
46
46
|
return (React.createElement("div", { className: cn(className, styles.component, uploadStatus && styles[uploadStatus.toLocaleLowerCase()]), "data-test-id": dataTestId },
|
|
47
47
|
React.createElement("div", { className: styles.info },
|
package/dist/modern/index.css
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* hash:
|
|
1
|
+
/* hash: 1e54w */
|
|
2
2
|
:root {
|
|
3
3
|
--color-light-border-primary: #dbdee1;
|
|
4
4
|
--color-light-graphic-negative: #f15045;
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
--gap-xs: 8px;
|
|
21
21
|
--gap-s: 12px;
|
|
22
22
|
}
|
|
23
|
-
.file-upload-
|
|
23
|
+
.file-upload-item__component_76rbl {
|
|
24
24
|
font-size: 13px;
|
|
25
25
|
line-height: 16px;
|
|
26
26
|
font-weight: 400;
|
|
@@ -33,29 +33,29 @@
|
|
|
33
33
|
padding: 0 0 var(--gap-xs) 0;
|
|
34
34
|
margin-bottom: var(--gap-xs)
|
|
35
35
|
}
|
|
36
|
-
.file-upload-
|
|
36
|
+
.file-upload-item__component_76rbl svg {
|
|
37
37
|
display: block;
|
|
38
38
|
}
|
|
39
|
-
.file-upload-
|
|
39
|
+
.file-upload-item__info_76rbl {
|
|
40
40
|
display: flex;
|
|
41
41
|
align-items: center;
|
|
42
42
|
flex-wrap: wrap;
|
|
43
43
|
flex: 1;
|
|
44
44
|
}
|
|
45
|
-
.file-upload-
|
|
45
|
+
.file-upload-item__icon_76rbl {
|
|
46
46
|
display: block;
|
|
47
47
|
flex-shrink: 0;
|
|
48
48
|
color: var(--color-light-text-primary);
|
|
49
49
|
}
|
|
50
|
-
.file-upload-
|
|
50
|
+
.file-upload-item__errorIcon_76rbl {
|
|
51
51
|
flex-shrink: 0;
|
|
52
52
|
color: var(--color-light-graphic-negative);
|
|
53
53
|
}
|
|
54
|
-
.file-upload-
|
|
54
|
+
.file-upload-item__successIcon_76rbl {
|
|
55
55
|
flex-shrink: 0;
|
|
56
56
|
color: var(--color-light-graphic-positive);
|
|
57
57
|
}
|
|
58
|
-
.file-upload-
|
|
58
|
+
.file-upload-item__name_76rbl {
|
|
59
59
|
flex: 1;
|
|
60
60
|
margin-left: var(--gap-xs);
|
|
61
61
|
white-space: nowrap;
|
|
@@ -64,32 +64,32 @@
|
|
|
64
64
|
color: var(--color-light-text-primary);
|
|
65
65
|
min-width: 40%
|
|
66
66
|
}
|
|
67
|
-
.file-upload-
|
|
67
|
+
.file-upload-item__meta_76rbl {
|
|
68
68
|
display: flex;
|
|
69
69
|
align-items: center;
|
|
70
70
|
|
|
71
71
|
white-space: nowrap
|
|
72
72
|
}
|
|
73
|
-
.file-upload-
|
|
73
|
+
.file-upload-item__meta_76rbl > * {
|
|
74
74
|
margin-right: var(--gap-s)
|
|
75
75
|
}
|
|
76
|
-
.file-upload-
|
|
76
|
+
.file-upload-item__meta_76rbl > *:last-child {
|
|
77
77
|
margin-right: 0;
|
|
78
78
|
}
|
|
79
|
-
.file-upload-
|
|
79
|
+
.file-upload-item__size_76rbl {
|
|
80
80
|
width: 65px;
|
|
81
81
|
text-align: right;
|
|
82
82
|
}
|
|
83
|
-
.file-upload-
|
|
83
|
+
.file-upload-item__delete_76rbl {
|
|
84
84
|
height: 24px;
|
|
85
85
|
width: 24px;
|
|
86
86
|
margin-left: var(--gap-s);
|
|
87
87
|
}
|
|
88
|
-
.file-upload-
|
|
88
|
+
.file-upload-item__error_76rbl {
|
|
89
89
|
color: var(--color-light-text-accent)
|
|
90
90
|
}
|
|
91
91
|
@media (--small-only) {
|
|
92
|
-
.file-upload-
|
|
92
|
+
.file-upload-item__error_76rbl {
|
|
93
93
|
flex: 1 0 100%;
|
|
94
94
|
margin-top: var(--gap-3xs)
|
|
95
95
|
}
|
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.3.3",
|
|
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": "^
|
|
20
|
-
"@alfalab/core-components-link": "^3.2.
|
|
19
|
+
"@alfalab/core-components-icon-button": "^4.0.1",
|
|
20
|
+
"@alfalab/core-components-link": "^3.2.1",
|
|
21
21
|
"@alfalab/core-components-spinner": "^2.0.1",
|
|
22
|
-
"@alfalab/icons-glyph": "^1.
|
|
22
|
+
"@alfalab/icons-glyph": "^1.190.0"
|
|
23
23
|
},
|
|
24
|
-
"gitHead": "
|
|
24
|
+
"gitHead": "19a2d088b6c18a127940199cfd6e6fc4e8639ec5"
|
|
25
25
|
}
|