@alfalab/core-components-file-upload-item 3.5.2 → 3.6.0

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 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-item__component_qwdup","infoSection":"file-upload-item__infoSection_qwdup","info":"file-upload-item__info_qwdup","icon":"file-upload-item__icon_qwdup","errorIcon":"file-upload-item__errorIcon_qwdup","successIcon":"file-upload-item__successIcon_qwdup","name":"file-upload-item__name_qwdup","meta":"file-upload-item__meta_qwdup","size":"file-upload-item__size_qwdup","delete":"file-upload-item__delete_qwdup","download":"file-upload-item__download_qwdup","errorWrapper":"file-upload-item__errorWrapper_qwdup","restore":"file-upload-item__restore_qwdup","spinnerWrapper":"file-upload-item__spinnerWrapper_qwdup","spinner":"file-upload-item__spinner_qwdup","uploadPercent":"file-upload-item__uploadPercent_qwdup"};
27
+ var styles = {"component":"file-upload-item__component_11lx3","infoSection":"file-upload-item__infoSection_11lx3","info":"file-upload-item__info_11lx3","icon":"file-upload-item__icon_11lx3","errorIcon":"file-upload-item__errorIcon_11lx3","successIcon":"file-upload-item__successIcon_11lx3","name":"file-upload-item__name_11lx3","meta":"file-upload-item__meta_11lx3","size":"file-upload-item__size_11lx3","delete":"file-upload-item__delete_11lx3","download":"file-upload-item__download_11lx3","errorWrapper":"file-upload-item__errorWrapper_11lx3","restore":"file-upload-item__restore_11lx3","spinnerWrapper":"file-upload-item__spinnerWrapper_11lx3","spinner":"file-upload-item__spinner_11lx3","uploadPercent":"file-upload-item__uploadPercent_11lx3"};
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, _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;
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 () { return (React__default['default'].createElement("div", { className: styles.infoSection },
65
- React__default['default'].createElement("div", { className: styles.name }, name),
66
- uploadStatus === 'ERROR' && error && (React__default['default'].createElement("div", { className: styles.errorWrapper, role: 'alert' }, error)))); }, [name, uploadStatus, error]);
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 },
@@ -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, _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;
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 () { return (React__default['default'].createElement("div", { className: styles__default['default'].infoSection },
64
- React__default['default'].createElement("div", { className: styles__default['default'].name }, name),
65
- uploadStatus === 'ERROR' && error && (React__default['default'].createElement("div", { className: styles__default['default'].errorWrapper, role: 'alert' }, error)))); }, [name, uploadStatus, error]);
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 },
@@ -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-item__component_qwdup","infoSection":"file-upload-item__infoSection_qwdup","info":"file-upload-item__info_qwdup","icon":"file-upload-item__icon_qwdup","errorIcon":"file-upload-item__errorIcon_qwdup","successIcon":"file-upload-item__successIcon_qwdup","name":"file-upload-item__name_qwdup","meta":"file-upload-item__meta_qwdup","size":"file-upload-item__size_qwdup","delete":"file-upload-item__delete_qwdup","download":"file-upload-item__download_qwdup","errorWrapper":"file-upload-item__errorWrapper_qwdup","restore":"file-upload-item__restore_qwdup","spinnerWrapper":"file-upload-item__spinnerWrapper_qwdup","spinner":"file-upload-item__spinner_qwdup","uploadPercent":"file-upload-item__uploadPercent_qwdup"};
18
+ var styles = {"component":"file-upload-item__component_11lx3","infoSection":"file-upload-item__infoSection_11lx3","info":"file-upload-item__info_11lx3","icon":"file-upload-item__icon_11lx3","errorIcon":"file-upload-item__errorIcon_11lx3","successIcon":"file-upload-item__successIcon_11lx3","name":"file-upload-item__name_11lx3","meta":"file-upload-item__meta_11lx3","size":"file-upload-item__size_11lx3","delete":"file-upload-item__delete_11lx3","download":"file-upload-item__download_11lx3","errorWrapper":"file-upload-item__errorWrapper_11lx3","restore":"file-upload-item__restore_11lx3","spinnerWrapper":"file-upload-item__spinnerWrapper_11lx3","spinner":"file-upload-item__spinner_11lx3","uploadPercent":"file-upload-item__uploadPercent_11lx3"};
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, _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;
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 () { return (React.createElement("div", { className: styles.infoSection },
56
- React.createElement("div", { className: styles.name }, name),
57
- uploadStatus === 'ERROR' && error && (React.createElement("div", { className: styles.errorWrapper, role: 'alert' }, error)))); }, [name, uploadStatus, error]);
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 },
@@ -1,4 +1,4 @@
1
- /* hash: 1xbga */
1
+ /* hash: 1s0uv */
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-item__component_qwdup {
25
+ .file-upload-item__component_11lx3 {
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-item__component_qwdup svg {
37
+ .file-upload-item__component_11lx3 svg {
38
38
  display: block;
39
39
  }
40
- .file-upload-item__infoSection_qwdup {
40
+ .file-upload-item__infoSection_11lx3 {
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-item__info_qwdup {
48
+ .file-upload-item__info_11lx3 {
49
49
  display: flex;
50
50
  flex-wrap: wrap;
51
51
  flex: 1;
52
52
  overflow: hidden;
53
53
  }
54
- .file-upload-item__icon_qwdup {
54
+ .file-upload-item__icon_11lx3 {
55
55
  display: block;
56
56
  flex-shrink: 0;
57
57
  color: var(--color-light-text-primary);
58
58
  }
59
- .file-upload-item__errorIcon_qwdup {
59
+ .file-upload-item__errorIcon_11lx3 {
60
60
  flex-shrink: 0;
61
61
  color: var(--color-light-graphic-negative);
62
62
  }
63
- .file-upload-item__successIcon_qwdup {
63
+ .file-upload-item__successIcon_11lx3 {
64
64
  flex-shrink: 0;
65
65
  color: var(--color-light-graphic-positive);
66
66
  }
67
- .file-upload-item__name_qwdup {
67
+ .file-upload-item__name_11lx3 {
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-item__meta_qwdup {
73
+ .file-upload-item__meta_11lx3 {
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-item__meta_qwdup > * {
80
+ .file-upload-item__meta_11lx3 > * {
81
81
  margin-right: var(--gap-s)
82
82
  }
83
- .file-upload-item__meta_qwdup > *:last-child {
83
+ .file-upload-item__meta_11lx3 > *:last-child {
84
84
  margin-right: 0;
85
85
  }
86
- .file-upload-item__size_qwdup {
86
+ .file-upload-item__size_11lx3 {
87
87
  text-align: right;
88
88
  }
89
- .file-upload-item__delete_qwdup,
90
- .file-upload-item__download_qwdup {
89
+ .file-upload-item__delete_11lx3,
90
+ .file-upload-item__download_11lx3 {
91
91
  height: 24px;
92
92
  width: 24px;
93
93
  margin-left: var(--gap-xs)
94
94
  }
95
- .file-upload-item__delete_qwdup svg, .file-upload-item__download_qwdup svg {
95
+ .file-upload-item__delete_11lx3 svg, .file-upload-item__download_11lx3 svg {
96
96
  width: 18px;
97
97
  height: 18px;
98
98
  }
99
- .file-upload-item__errorWrapper_qwdup {
99
+ .file-upload-item__errorWrapper_11lx3 {
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-item__errorWrapper_qwdup {
104
+ .file-upload-item__errorWrapper_11lx3 {
105
105
  flex: 1 0 100%;
106
106
  margin-top: var(--gap-3xs)
107
107
  }
108
108
  }
109
- .file-upload-item__restore_qwdup {
109
+ .file-upload-item__restore_11lx3 {
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-item__spinnerWrapper_qwdup {
116
+ .file-upload-item__spinnerWrapper_11lx3 {
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-item__spinner_qwdup {
123
+ .file-upload-item__spinner_11lx3 {
124
124
  width: 20px;
125
125
  height: 20px;
126
126
  }
127
- .file-upload-item__uploadPercent_qwdup {
127
+ .file-upload-item__uploadPercent_11lx3 {
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: 1xbga */
1
+ /* hash: 1s0uv */
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-item__component_qwdup {
25
+ .file-upload-item__component_11lx3 {
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-item__component_qwdup svg {
37
+ .file-upload-item__component_11lx3 svg {
38
38
  display: block;
39
39
  }
40
- .file-upload-item__infoSection_qwdup {
40
+ .file-upload-item__infoSection_11lx3 {
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-item__info_qwdup {
48
+ .file-upload-item__info_11lx3 {
49
49
  display: flex;
50
50
  flex-wrap: wrap;
51
51
  flex: 1;
52
52
  overflow: hidden;
53
53
  }
54
- .file-upload-item__icon_qwdup {
54
+ .file-upload-item__icon_11lx3 {
55
55
  display: block;
56
56
  flex-shrink: 0;
57
57
  color: var(--color-light-text-primary);
58
58
  }
59
- .file-upload-item__errorIcon_qwdup {
59
+ .file-upload-item__errorIcon_11lx3 {
60
60
  flex-shrink: 0;
61
61
  color: var(--color-light-graphic-negative);
62
62
  }
63
- .file-upload-item__successIcon_qwdup {
63
+ .file-upload-item__successIcon_11lx3 {
64
64
  flex-shrink: 0;
65
65
  color: var(--color-light-graphic-positive);
66
66
  }
67
- .file-upload-item__name_qwdup {
67
+ .file-upload-item__name_11lx3 {
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-item__meta_qwdup {
73
+ .file-upload-item__meta_11lx3 {
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-item__meta_qwdup > * {
80
+ .file-upload-item__meta_11lx3 > * {
81
81
  margin-right: var(--gap-s)
82
82
  }
83
- .file-upload-item__meta_qwdup > *:last-child {
83
+ .file-upload-item__meta_11lx3 > *:last-child {
84
84
  margin-right: 0;
85
85
  }
86
- .file-upload-item__size_qwdup {
86
+ .file-upload-item__size_11lx3 {
87
87
  text-align: right;
88
88
  }
89
- .file-upload-item__delete_qwdup,
90
- .file-upload-item__download_qwdup {
89
+ .file-upload-item__delete_11lx3,
90
+ .file-upload-item__download_11lx3 {
91
91
  height: 24px;
92
92
  width: 24px;
93
93
  margin-left: var(--gap-xs)
94
94
  }
95
- .file-upload-item__delete_qwdup svg, .file-upload-item__download_qwdup svg {
95
+ .file-upload-item__delete_11lx3 svg, .file-upload-item__download_11lx3 svg {
96
96
  width: 18px;
97
97
  height: 18px;
98
98
  }
99
- .file-upload-item__errorWrapper_qwdup {
99
+ .file-upload-item__errorWrapper_11lx3 {
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-item__errorWrapper_qwdup {
104
+ .file-upload-item__errorWrapper_11lx3 {
105
105
  flex: 1 0 100%;
106
106
  margin-top: var(--gap-3xs)
107
107
  }
108
108
  }
109
- .file-upload-item__restore_qwdup {
109
+ .file-upload-item__restore_11lx3 {
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-item__spinnerWrapper_qwdup {
116
+ .file-upload-item__spinnerWrapper_11lx3 {
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-item__spinner_qwdup {
123
+ .file-upload-item__spinner_11lx3 {
124
124
  width: 20px;
125
125
  height: 20px;
126
126
  }
127
- .file-upload-item__uploadPercent_qwdup {
127
+ .file-upload-item__uploadPercent_11lx3 {
128
128
  margin-top: var(--gap-2xs);
129
129
  margin-left: var(--gap-xl);
130
130
  }
@@ -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-item__component_qwdup","infoSection":"file-upload-item__infoSection_qwdup","info":"file-upload-item__info_qwdup","icon":"file-upload-item__icon_qwdup","errorIcon":"file-upload-item__errorIcon_qwdup","successIcon":"file-upload-item__successIcon_qwdup","name":"file-upload-item__name_qwdup","meta":"file-upload-item__meta_qwdup","size":"file-upload-item__size_qwdup","delete":"file-upload-item__delete_qwdup","download":"file-upload-item__download_qwdup","errorWrapper":"file-upload-item__errorWrapper_qwdup","restore":"file-upload-item__restore_qwdup","spinnerWrapper":"file-upload-item__spinnerWrapper_qwdup","spinner":"file-upload-item__spinner_qwdup","uploadPercent":"file-upload-item__uploadPercent_qwdup"};
18
+ var styles = {"component":"file-upload-item__component_11lx3","infoSection":"file-upload-item__infoSection_11lx3","info":"file-upload-item__info_11lx3","icon":"file-upload-item__icon_11lx3","errorIcon":"file-upload-item__errorIcon_11lx3","successIcon":"file-upload-item__successIcon_11lx3","name":"file-upload-item__name_11lx3","meta":"file-upload-item__meta_11lx3","size":"file-upload-item__size_11lx3","delete":"file-upload-item__delete_11lx3","download":"file-upload-item__download_11lx3","errorWrapper":"file-upload-item__errorWrapper_11lx3","restore":"file-upload-item__restore_11lx3","spinnerWrapper":"file-upload-item__spinnerWrapper_11lx3","spinner":"file-upload-item__spinner_11lx3","uploadPercent":"file-upload-item__uploadPercent_11lx3"};
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 = uploadStatus === 'ERROR' ? 'Не удалось загрузить файл' : undefined, showDelete, showRestore, onDelete, onDownload, onRestore, dataTestId, }) => {
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(() => (React.createElement("div", { className: styles.infoSection },
55
- React.createElement("div", { className: styles.name }, name),
56
- uploadStatus === 'ERROR' && error && (React.createElement("div", { className: styles.errorWrapper, role: 'alert' }, error)))), [name, uploadStatus, error]);
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 },
@@ -1,4 +1,4 @@
1
- /* hash: 1xbga */
1
+ /* hash: 1s0uv */
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-item__component_qwdup {
25
+ .file-upload-item__component_11lx3 {
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-item__component_qwdup svg {
37
+ .file-upload-item__component_11lx3 svg {
38
38
  display: block;
39
39
  }
40
- .file-upload-item__infoSection_qwdup {
40
+ .file-upload-item__infoSection_11lx3 {
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-item__info_qwdup {
48
+ .file-upload-item__info_11lx3 {
49
49
  display: flex;
50
50
  flex-wrap: wrap;
51
51
  flex: 1;
52
52
  overflow: hidden;
53
53
  }
54
- .file-upload-item__icon_qwdup {
54
+ .file-upload-item__icon_11lx3 {
55
55
  display: block;
56
56
  flex-shrink: 0;
57
57
  color: var(--color-light-text-primary);
58
58
  }
59
- .file-upload-item__errorIcon_qwdup {
59
+ .file-upload-item__errorIcon_11lx3 {
60
60
  flex-shrink: 0;
61
61
  color: var(--color-light-graphic-negative);
62
62
  }
63
- .file-upload-item__successIcon_qwdup {
63
+ .file-upload-item__successIcon_11lx3 {
64
64
  flex-shrink: 0;
65
65
  color: var(--color-light-graphic-positive);
66
66
  }
67
- .file-upload-item__name_qwdup {
67
+ .file-upload-item__name_11lx3 {
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-item__meta_qwdup {
73
+ .file-upload-item__meta_11lx3 {
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-item__meta_qwdup > * {
80
+ .file-upload-item__meta_11lx3 > * {
81
81
  margin-right: var(--gap-s)
82
82
  }
83
- .file-upload-item__meta_qwdup > *:last-child {
83
+ .file-upload-item__meta_11lx3 > *:last-child {
84
84
  margin-right: 0;
85
85
  }
86
- .file-upload-item__size_qwdup {
86
+ .file-upload-item__size_11lx3 {
87
87
  text-align: right;
88
88
  }
89
- .file-upload-item__delete_qwdup,
90
- .file-upload-item__download_qwdup {
89
+ .file-upload-item__delete_11lx3,
90
+ .file-upload-item__download_11lx3 {
91
91
  height: 24px;
92
92
  width: 24px;
93
93
  margin-left: var(--gap-xs)
94
94
  }
95
- .file-upload-item__delete_qwdup svg, .file-upload-item__download_qwdup svg {
95
+ .file-upload-item__delete_11lx3 svg, .file-upload-item__download_11lx3 svg {
96
96
  width: 18px;
97
97
  height: 18px;
98
98
  }
99
- .file-upload-item__errorWrapper_qwdup {
99
+ .file-upload-item__errorWrapper_11lx3 {
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-item__errorWrapper_qwdup {
104
+ .file-upload-item__errorWrapper_11lx3 {
105
105
  flex: 1 0 100%;
106
106
  margin-top: var(--gap-3xs)
107
107
  }
108
108
  }
109
- .file-upload-item__restore_qwdup {
109
+ .file-upload-item__restore_11lx3 {
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-item__spinnerWrapper_qwdup {
116
+ .file-upload-item__spinnerWrapper_11lx3 {
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-item__spinner_qwdup {
123
+ .file-upload-item__spinner_11lx3 {
124
124
  width: 20px;
125
125
  height: 20px;
126
126
  }
127
- .file-upload-item__uploadPercent_qwdup {
127
+ .file-upload-item__uploadPercent_11lx3 {
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.5.2",
3
+ "version": "3.6.0",
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.8",
20
- "@alfalab/core-components-link": "^3.2.3",
19
+ "@alfalab/core-components-icon-button": "^4.1.9",
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": "8d998af881e79e8b524179aa50cdb117c1380c74"
24
+ "gitHead": "f540d55438d44b5051d10606dcfea4be99558f8c"
25
25
  }