@synerise/ds-file-uploader 1.0.22 → 1.1.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/CHANGELOG.md +17 -0
- package/dist/AvatarUploader/AvatarUploader.d.ts +2 -2
- package/dist/AvatarUploader/AvatarUploader.d.ts.map +1 -1
- package/dist/AvatarUploader/AvatarUploader.js +22 -12
- package/dist/FileUploader.d.ts +2 -2
- package/dist/FileUploader.d.ts.map +1 -1
- package/dist/FileUploader.js +14 -4
- package/dist/FileUploader.types.d.ts +6 -1
- package/dist/FileUploader.types.d.ts.map +1 -1
- package/dist/FileView/FileView.d.ts.map +1 -1
- package/dist/FileView/FileView.js +4 -8
- package/dist/FileView/FileView.styles.d.ts +1 -0
- package/dist/FileView/FileView.styles.d.ts.map +1 -1
- package/dist/FileView/FileView.styles.js +9 -5
- package/dist/ItemUploader/ItemUploader.d.ts +4 -2
- package/dist/ItemUploader/ItemUploader.d.ts.map +1 -1
- package/dist/ItemUploader/ItemUploader.js +14 -4
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,23 @@
|
|
|
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
|
+
# [1.1.0](https://github.com/Synerise/synerise-design/compare/@synerise/ds-file-uploader@1.0.22...@synerise/ds-file-uploader@1.1.0) (2025-09-05)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **file-uploader:** removeable prop during uploading ([0500b62](https://github.com/Synerise/synerise-design/commit/0500b628b4a07453f585338dece23995a1f5ebd7))
|
|
12
|
+
* **progress-bar:** refactor progress bar and remove ant ([3324544](https://github.com/Synerise/synerise-design/commit/33245443d076da967561558ca8506d6ab0d904e5))
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Features
|
|
16
|
+
|
|
17
|
+
* **file-uploader:** accept ref to allow programmatic open ([dac9f01](https://github.com/Synerise/synerise-design/commit/dac9f01cf35f8bf3630e89bef93e9668e41bec95))
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
6
23
|
## [1.0.22](https://github.com/Synerise/synerise-design/compare/@synerise/ds-file-uploader@1.0.21...@synerise/ds-file-uploader@1.0.22) (2025-08-28)
|
|
7
24
|
|
|
8
25
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { type FileUploaderProps } from '../FileUploader.types';
|
|
3
|
-
declare const AvatarUploader:
|
|
2
|
+
import { type FileUploaderProps, type FileUploaderRef } from '../FileUploader.types';
|
|
3
|
+
declare const AvatarUploader: React.ForwardRefExoticComponent<FileUploaderProps & React.RefAttributes<FileUploaderRef>>;
|
|
4
4
|
export default AvatarUploader;
|
|
5
5
|
//# sourceMappingURL=AvatarUploader.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AvatarUploader.d.ts","sourceRoot":"","sources":["../../src/AvatarUploader/AvatarUploader.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"AvatarUploader.d.ts","sourceRoot":"","sources":["../../src/AvatarUploader/AvatarUploader.tsx"],"names":[],"mappings":"AAAA,OAAO,KAKN,MAAM,OAAO,CAAC;AAQf,OAAO,EAEL,KAAK,iBAAiB,EACtB,KAAK,eAAe,EACrB,MAAM,uBAAuB,CAAC;AAgB/B,QAAA,MAAM,cAAc,2FAqKnB,CAAC;AAEF,eAAe,cAAc,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
2
|
-
import React from 'react';
|
|
2
|
+
import React, { forwardRef, useCallback, useImperativeHandle, useState } from 'react';
|
|
3
3
|
import { useDropzone } from 'react-dropzone';
|
|
4
4
|
import Button from '@synerise/ds-button';
|
|
5
5
|
import { useTheme } from '@synerise/ds-core';
|
|
@@ -20,7 +20,7 @@ function readAsText(file) {
|
|
|
20
20
|
reader.readAsText(file);
|
|
21
21
|
});
|
|
22
22
|
}
|
|
23
|
-
var AvatarUploader = function
|
|
23
|
+
var AvatarUploader = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
24
24
|
var className = _ref.className,
|
|
25
25
|
onUpload = _ref.onUpload,
|
|
26
26
|
disabled = _ref.disabled,
|
|
@@ -38,11 +38,11 @@ var AvatarUploader = function AvatarUploader(_ref) {
|
|
|
38
38
|
_ref$files = _ref.files,
|
|
39
39
|
files = _ref$files === void 0 ? [] : _ref$files,
|
|
40
40
|
texts = _ref.texts;
|
|
41
|
-
var
|
|
42
|
-
uploadSuccess =
|
|
43
|
-
setUploadSuccess =
|
|
41
|
+
var _useState = useState(true),
|
|
42
|
+
uploadSuccess = _useState[0],
|
|
43
|
+
setUploadSuccess = _useState[1];
|
|
44
44
|
var theme = useTheme();
|
|
45
|
-
var readFilesContent =
|
|
45
|
+
var readFilesContent = useCallback(function (addedFiles) {
|
|
46
46
|
var readerPromises = addedFiles.map(function (file) {
|
|
47
47
|
return readAsText(file);
|
|
48
48
|
});
|
|
@@ -55,7 +55,7 @@ var AvatarUploader = function AvatarUploader(_ref) {
|
|
|
55
55
|
onUpload && onUpload(filesWithContent);
|
|
56
56
|
});
|
|
57
57
|
}, [onUpload]);
|
|
58
|
-
var onDrop =
|
|
58
|
+
var onDrop = useCallback(function (acceptedFiles) {
|
|
59
59
|
var possibleUpload = 0;
|
|
60
60
|
if (filesAmount) {
|
|
61
61
|
possibleUpload = filesAmount - files.length;
|
|
@@ -75,15 +75,25 @@ var AvatarUploader = function AvatarUploader(_ref) {
|
|
|
75
75
|
}),
|
|
76
76
|
getRootProps = _useDropzone.getRootProps,
|
|
77
77
|
getInputProps = _useDropzone.getInputProps,
|
|
78
|
-
isDragActive = _useDropzone.isDragActive
|
|
78
|
+
isDragActive = _useDropzone.isDragActive,
|
|
79
|
+
open = _useDropzone.open,
|
|
80
|
+
inputRef = _useDropzone.inputRef,
|
|
81
|
+
rootRef = _useDropzone.rootRef;
|
|
82
|
+
useImperativeHandle(ref, function () {
|
|
83
|
+
return {
|
|
84
|
+
open: open,
|
|
85
|
+
inputRef: inputRef,
|
|
86
|
+
rootRef: rootRef
|
|
87
|
+
};
|
|
88
|
+
});
|
|
79
89
|
if (filesAmount && filesAmount < 1) {
|
|
80
90
|
filesAmount = 1;
|
|
81
91
|
throw new Error('Invalid value of property "filesAmount" ');
|
|
82
92
|
}
|
|
83
93
|
var hasError = Boolean(error) || !uploadSuccess;
|
|
84
|
-
var
|
|
85
|
-
pressed =
|
|
86
|
-
setPressed =
|
|
94
|
+
var _useState2 = useState(false),
|
|
95
|
+
pressed = _useState2[0],
|
|
96
|
+
setPressed = _useState2[1];
|
|
87
97
|
return /*#__PURE__*/React.createElement(S.Container, {
|
|
88
98
|
className: "ds-file-avatar-uploader " + (className || '')
|
|
89
99
|
}, label && /*#__PURE__*/React.createElement(S.Label, null, /*#__PURE__*/React.createElement("span", null, label), tooltip && /*#__PURE__*/React.createElement(Tooltip, {
|
|
@@ -139,5 +149,5 @@ var AvatarUploader = function AvatarUploader(_ref) {
|
|
|
139
149
|
}), "Add file"), description && /*#__PURE__*/React.createElement(S.Description, {
|
|
140
150
|
hasError: hasError
|
|
141
151
|
}, description))));
|
|
142
|
-
};
|
|
152
|
+
});
|
|
143
153
|
export default AvatarUploader;
|
package/dist/FileUploader.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { type FileUploaderProps } from './FileUploader.types';
|
|
3
|
-
declare const FileUploader:
|
|
2
|
+
import { type FileUploaderProps, type FileUploaderRef } from './FileUploader.types';
|
|
3
|
+
declare const FileUploader: React.ForwardRefExoticComponent<FileUploaderProps & React.RefAttributes<FileUploaderRef>>;
|
|
4
4
|
export default FileUploader;
|
|
5
5
|
//# sourceMappingURL=FileUploader.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FileUploader.d.ts","sourceRoot":"","sources":["../src/FileUploader.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"FileUploader.d.ts","sourceRoot":"","sources":["../src/FileUploader.tsx"],"names":[],"mappings":"AAAA,OAAO,KAKN,MAAM,OAAO,CAAC;AASf,OAAO,EAEL,KAAK,iBAAiB,EACtB,KAAK,eAAe,EACrB,MAAM,sBAAsB,CAAC;AAe9B,QAAA,MAAM,YAAY,2FAuMjB,CAAC;AAEF,eAAe,YAAY,CAAC"}
|
package/dist/FileUploader.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
2
|
-
import React, { useCallback, useState } from 'react';
|
|
2
|
+
import React, { forwardRef, useCallback, useImperativeHandle, useState } from 'react';
|
|
3
3
|
import { useDropzone } from 'react-dropzone';
|
|
4
4
|
import { FormattedMessage } from 'react-intl';
|
|
5
5
|
import { useTheme } from '@synerise/ds-core';
|
|
@@ -20,7 +20,7 @@ function readAsText(file) {
|
|
|
20
20
|
reader.readAsText(file);
|
|
21
21
|
});
|
|
22
22
|
}
|
|
23
|
-
var FileUploader = function
|
|
23
|
+
var FileUploader = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
24
24
|
var className = _ref.className,
|
|
25
25
|
onUpload = _ref.onUpload,
|
|
26
26
|
disabled = _ref.disabled,
|
|
@@ -90,7 +90,17 @@ var FileUploader = function FileUploader(_ref) {
|
|
|
90
90
|
}),
|
|
91
91
|
getRootProps = _useDropzone.getRootProps,
|
|
92
92
|
getInputProps = _useDropzone.getInputProps,
|
|
93
|
-
isDragActive = _useDropzone.isDragActive
|
|
93
|
+
isDragActive = _useDropzone.isDragActive,
|
|
94
|
+
open = _useDropzone.open,
|
|
95
|
+
inputRef = _useDropzone.inputRef,
|
|
96
|
+
rootRef = _useDropzone.rootRef;
|
|
97
|
+
useImperativeHandle(ref, function () {
|
|
98
|
+
return {
|
|
99
|
+
open: open,
|
|
100
|
+
inputRef: inputRef,
|
|
101
|
+
rootRef: rootRef
|
|
102
|
+
};
|
|
103
|
+
});
|
|
94
104
|
if (filesAmount && filesAmount < 1) {
|
|
95
105
|
filesAmount = 1;
|
|
96
106
|
throw new Error('Invalid value of property "filesAmount" ');
|
|
@@ -158,5 +168,5 @@ var FileUploader = function FileUploader(_ref) {
|
|
|
158
168
|
}), description && /*#__PURE__*/React.createElement(S.Description, {
|
|
159
169
|
hasError: hasError
|
|
160
170
|
}, description));
|
|
161
|
-
};
|
|
171
|
+
});
|
|
162
172
|
export default FileUploader;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type ReactNode } from 'react';
|
|
1
|
+
import { type ReactNode, type RefObject } from 'react';
|
|
2
2
|
import { type FileViewTexts } from './FileView/FileView.types';
|
|
3
3
|
export interface ExtendedFile {
|
|
4
4
|
file: FileWithContent;
|
|
@@ -37,5 +37,10 @@ export interface FileUploaderProps {
|
|
|
37
37
|
export type ItemUploaderProps = Omit<FileUploaderProps, 'mode'> & {
|
|
38
38
|
mode: 'single' | 'multi';
|
|
39
39
|
};
|
|
40
|
+
export type FileUploaderRef = {
|
|
41
|
+
open: () => void;
|
|
42
|
+
inputRef: RefObject<HTMLInputElement>;
|
|
43
|
+
rootRef: RefObject<HTMLElement>;
|
|
44
|
+
};
|
|
40
45
|
export {};
|
|
41
46
|
//# sourceMappingURL=FileUploader.types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FileUploader.types.d.ts","sourceRoot":"","sources":["../src/FileUploader.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"FileUploader.types.d.ts","sourceRoot":"","sources":["../src/FileUploader.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvD,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAE/D,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,eAAe,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,WAAW,eAAgB,SAAQ,IAAI;IAC3C,OAAO,CAAC,EAAE,WAAW,CAAC;CACvB;AAED,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,WAAW,GAAG,IAAI,CAAC;AAEtD,KAAK,iBAAiB,GAAG,aAAa,GAAG;IACvC,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB,gBAAgB,CAAC,EAAE,SAAS,CAAC;IAC7B,iBAAiB,CAAC,EAAE,SAAS,CAAC;CAC/B,CAAC;AAEF,MAAM,WAAW,iBAAiB;IAChC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,QAAQ,GAAG,cAAc,GAAG,aAAa,CAAC;IAChD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,aAAa,CAAC,EAAE,SAAS,CAAC;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,iBAAiB,CAAC;IAC1B,KAAK,EAAE,YAAY,EAAE,CAAC;IACtB,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,eAAe,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAC1D,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,eAAe,EAAE,KAAK,IAAI,CAAC;IAC9C,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED,MAAM,MAAM,iBAAiB,GAAG,IAAI,CAAC,iBAAiB,EAAE,MAAM,CAAC,GAAG;IAChE,IAAI,EAAE,QAAQ,GAAG,OAAO,CAAC;CAC1B,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B,IAAI,EAAE,MAAM,IAAI,CAAC;IACjB,QAAQ,EAAE,SAAS,CAAC,gBAAgB,CAAC,CAAC;IACtC,OAAO,EAAE,SAAS,CAAC,WAAW,CAAC,CAAC;CACjC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FileView.d.ts","sourceRoot":"","sources":["../../src/FileView/FileView.tsx"],"names":[],"mappings":"AACA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAiBxC,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEtD,QAAA,MAAM,QAAQ,GAAI,gEAOf,aAAa,
|
|
1
|
+
{"version":3,"file":"FileView.d.ts","sourceRoot":"","sources":["../../src/FileView/FileView.tsx"],"names":[],"mappings":"AACA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAiBxC,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEtD,QAAA,MAAM,QAAQ,GAAI,gEAOf,aAAa,sBAkLf,CAAC;AAEF,eAAe,QAAQ,CAAC"}
|
|
@@ -88,14 +88,10 @@ var FileView = function FileView(_ref) {
|
|
|
88
88
|
size: 24
|
|
89
89
|
})), /*#__PURE__*/React.createElement(S.Info, {
|
|
90
90
|
progress: hasProgress
|
|
91
|
-
}, hasProgress ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(S.Name, null, /*#__PURE__*/React.createElement(S.FileName, null, file.name), ' ', /*#__PURE__*/React.createElement(S.FileWeight, null, filesize(progress / 100 * file.size))), /*#__PURE__*/React.createElement(
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
}, /*#__PURE__*/React.createElement(ProgressBar, {
|
|
96
|
-
amount: 100,
|
|
97
|
-
percent: progress
|
|
98
|
-
}), /*#__PURE__*/React.createElement(S.RemoveWrapper, {
|
|
91
|
+
}, hasProgress ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(S.Name, null, /*#__PURE__*/React.createElement(S.FileName, null, file.name), ' ', /*#__PURE__*/React.createElement(S.FileWeight, null, filesize(progress / 100 * file.size))), /*#__PURE__*/React.createElement(S.FlexRow, null, /*#__PURE__*/React.createElement(ProgressBar, {
|
|
92
|
+
width: "300px",
|
|
93
|
+
percent: finalTexts.percent
|
|
94
|
+
}), removable && /*#__PURE__*/React.createElement(S.RemoveWrapper, {
|
|
99
95
|
onClick: onRemove,
|
|
100
96
|
"data-testid": "fileview-remove"
|
|
101
97
|
}, /*#__PURE__*/React.createElement(Tooltip, {
|
|
@@ -7,6 +7,7 @@ export declare const PopconfirmOnRemove: import("styled-components").StyledCompo
|
|
|
7
7
|
export declare const FileWeight: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
8
8
|
export declare const FileName: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
9
9
|
export declare const Name: import("styled-components").StyledComponent<"label", any, {}, never>;
|
|
10
|
+
export declare const FlexRow: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
10
11
|
export declare const SizeOrError: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("antd/lib/typography/Text").TextProps & import("react").RefAttributes<HTMLSpanElement>>, any, {}, never>;
|
|
11
12
|
export declare const RemoveWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
12
13
|
export declare const CheckButtonWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FileView.styles.d.ts","sourceRoot":"","sources":["../../src/FileView/FileView.styles.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,YAAY,oEAKxB,CAAC;AAEF,eAAO,MAAM,gBAAgB,oEAU5B,CAAC;AAEF,eAAO,MAAM,IAAI;cAA0B,OAAO;SAIjD,CAAC;AAEF,eAAO,MAAM,kBAAkB,qIAQ9B,CAAC;AACF,eAAO,MAAM,UAAU,oEAKtB,CAAC;AACF,eAAO,MAAM,QAAQ,oEAKpB,CAAC;AACF,eAAO,MAAM,IAAI,sEAShB,CAAC;AAEF,eAAO,MAAM,WAAW,uMAIvB,CAAC;AACF,eAAO,MAAM,aAAa,oEAyBzB,CAAC;AACF,eAAO,MAAM,kBAAkB,oEAsB9B,CAAC;AACF,eAAO,MAAM,mBAAmB;cAA0B,OAAO;SA0BhE,CAAC;AAEF,eAAO,MAAM,iBAAiB;eACjB,OAAO;YACV,OAAO;gBACH,OAAO;cACT,OAAO;eACN,OAAO;cACR,OAAO;SAqFlB,CAAC"}
|
|
1
|
+
{"version":3,"file":"FileView.styles.d.ts","sourceRoot":"","sources":["../../src/FileView/FileView.styles.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,YAAY,oEAKxB,CAAC;AAEF,eAAO,MAAM,gBAAgB,oEAU5B,CAAC;AAEF,eAAO,MAAM,IAAI;cAA0B,OAAO;SAIjD,CAAC;AAEF,eAAO,MAAM,kBAAkB,qIAQ9B,CAAC;AACF,eAAO,MAAM,UAAU,oEAKtB,CAAC;AACF,eAAO,MAAM,QAAQ,oEAKpB,CAAC;AACF,eAAO,MAAM,IAAI,sEAShB,CAAC;AAEF,eAAO,MAAM,OAAO,oEAEnB,CAAC;AAEF,eAAO,MAAM,WAAW,uMAIvB,CAAC;AACF,eAAO,MAAM,aAAa,oEAyBzB,CAAC;AACF,eAAO,MAAM,kBAAkB,oEAsB9B,CAAC;AACF,eAAO,MAAM,mBAAmB;cAA0B,OAAO;SA0BhE,CAAC;AAEF,eAAO,MAAM,iBAAiB;eACjB,OAAO;YACV,OAAO;gBACH,OAAO;cACT,OAAO;eACN,OAAO;cACR,OAAO;SAqFlB,CAAC"}
|
|
@@ -42,15 +42,19 @@ export var Name = styled(Label).withConfig({
|
|
|
42
42
|
})(["&&{color:", ";max-width:100%;cursor:initial;white-space:nowrap;display:flex;justify-content:space-between;}"], function (props) {
|
|
43
43
|
return props.theme.palette['grey-600'];
|
|
44
44
|
});
|
|
45
|
+
export var FlexRow = styled.div.withConfig({
|
|
46
|
+
displayName: "FileViewstyles__FlexRow",
|
|
47
|
+
componentId: "sc-wpdc66-7"
|
|
48
|
+
})(["display:flex;"]);
|
|
45
49
|
export var SizeOrError = styled(Typography.Text).withConfig({
|
|
46
50
|
displayName: "FileViewstyles__SizeOrError",
|
|
47
|
-
componentId: "sc-wpdc66-
|
|
51
|
+
componentId: "sc-wpdc66-8"
|
|
48
52
|
})(["&&{color:", ";}"], function (props) {
|
|
49
53
|
return props.theme.palette['grey-600'];
|
|
50
54
|
});
|
|
51
55
|
export var RemoveWrapper = styled.div.withConfig({
|
|
52
56
|
displayName: "FileViewstyles__RemoveWrapper",
|
|
53
|
-
componentId: "sc-wpdc66-
|
|
57
|
+
componentId: "sc-wpdc66-9"
|
|
54
58
|
})(["display:flex;background-color:transparent;z-index:10;border:0;padding:0;margin:0;height:16px;width:16px;position:absolute;top:14px;right:10px;cursor:pointer;", "{position:absolute;right:-2px;top:-2px;transition:color 0.3s;color:", ";&:hover{color:", ";}}"], IconContainer, function (props) {
|
|
55
59
|
return props.theme.palette['grey-300'];
|
|
56
60
|
}, function (props) {
|
|
@@ -58,7 +62,7 @@ export var RemoveWrapper = styled.div.withConfig({
|
|
|
58
62
|
});
|
|
59
63
|
export var CheckButtonWrapper = styled.div.withConfig({
|
|
60
64
|
displayName: "FileViewstyles__CheckButtonWrapper",
|
|
61
|
-
componentId: "sc-wpdc66-
|
|
65
|
+
componentId: "sc-wpdc66-10"
|
|
62
66
|
})(["display:flex;background-color:transparent;z-index:10;margin:0;height:16px;width:16px;position:absolute;top:14px;right:10px;cursor:pointer;", "{position:absolute;right:-2px;top:-2px;transition:color 0.3s;color:", ";&:hover{color:", ";}}"], IconContainer, function (props) {
|
|
63
67
|
return props.theme.palette['green-600'];
|
|
64
68
|
}, function (props) {
|
|
@@ -66,7 +70,7 @@ export var CheckButtonWrapper = styled.div.withConfig({
|
|
|
66
70
|
});
|
|
67
71
|
export var RemoveButtonWrapper = styled.div.withConfig({
|
|
68
72
|
displayName: "FileViewstyles__RemoveButtonWrapper",
|
|
69
|
-
componentId: "sc-wpdc66-
|
|
73
|
+
componentId: "sc-wpdc66-11"
|
|
70
74
|
})(["display:", ";background-color:transparent;z-index:10;border:0;padding:0;margin:0;height:16px;width:16px;position:absolute;top:14px;right:10px;cursor:pointer;overflow:", ";", "{position:absolute;right:-2px;top:-2px;transition:color 0.3s;color:", ";&:hover{color:", ";}}"], function (props) {
|
|
71
75
|
return props.pressed ? 'flex' : 'none';
|
|
72
76
|
}, function (props) {
|
|
@@ -78,7 +82,7 @@ export var RemoveButtonWrapper = styled.div.withConfig({
|
|
|
78
82
|
});
|
|
79
83
|
export var FileViewContainer = styled.button.withConfig({
|
|
80
84
|
displayName: "FileViewstyles__FileViewContainer",
|
|
81
|
-
componentId: "sc-wpdc66-
|
|
85
|
+
componentId: "sc-wpdc66-12"
|
|
82
86
|
})(["background-color:", ";border-radius:3px;border:1px solid ", ";display:flex;align-items:center;padding:12px 6px;height:48px;width:100%;text-align:left;line-height:initial;position:relative;margin:0 0 12px;&:last-of-type{margin:0;}&:hover{border-color:", ";", "}&:hover{", "}&:focus{border-color:", ";background-color:", ";", "}&:hover{background-color:", ";}&:active{border-color:", ";background-color:", ";}", ";", ";.ant-progress-line{margin:8px 0 0 !important;width:93%;}"], function (props) {
|
|
83
87
|
return props.theme.palette.white;
|
|
84
88
|
}, function (props) {
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { type
|
|
3
|
-
declare const ItemUploader: React.
|
|
2
|
+
import { type FileUploaderRef } from '../FileUploader.types';
|
|
3
|
+
declare const ItemUploader: React.ForwardRefExoticComponent<Omit<import("../FileUploader.types").FileUploaderProps, "mode"> & {
|
|
4
|
+
mode: "single" | "multi";
|
|
5
|
+
} & React.RefAttributes<FileUploaderRef>>;
|
|
4
6
|
export default ItemUploader;
|
|
5
7
|
//# sourceMappingURL=ItemUploader.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ItemUploader.d.ts","sourceRoot":"","sources":["../../src/ItemUploader/ItemUploader.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"ItemUploader.d.ts","sourceRoot":"","sources":["../../src/ItemUploader/ItemUploader.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA0C,MAAM,OAAO,CAAC;AAQ/D,OAAO,EAEL,KAAK,eAAe,EAErB,MAAM,uBAAuB,CAAC;AAe/B,QAAA,MAAM,YAAY;;yCA2IjB,CAAC;AAEF,eAAe,YAAY,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
2
|
-
import React from 'react';
|
|
2
|
+
import React, { forwardRef, useImperativeHandle } from 'react';
|
|
3
3
|
import { useDropzone } from 'react-dropzone';
|
|
4
4
|
import Button from '@synerise/ds-button';
|
|
5
5
|
import Icon, { Add3M, InfoFillS } from '@synerise/ds-icon';
|
|
@@ -19,7 +19,7 @@ function readAsText(file) {
|
|
|
19
19
|
reader.readAsText(file);
|
|
20
20
|
});
|
|
21
21
|
}
|
|
22
|
-
var ItemUploader = function
|
|
22
|
+
var ItemUploader = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
23
23
|
var className = _ref.className,
|
|
24
24
|
onUpload = _ref.onUpload,
|
|
25
25
|
disabled = _ref.disabled,
|
|
@@ -72,7 +72,17 @@ var ItemUploader = function ItemUploader(_ref) {
|
|
|
72
72
|
disabled: disabled
|
|
73
73
|
}),
|
|
74
74
|
getRootProps = _useDropzone.getRootProps,
|
|
75
|
-
getInputProps = _useDropzone.getInputProps
|
|
75
|
+
getInputProps = _useDropzone.getInputProps,
|
|
76
|
+
open = _useDropzone.open,
|
|
77
|
+
inputRef = _useDropzone.inputRef,
|
|
78
|
+
rootRef = _useDropzone.rootRef;
|
|
79
|
+
useImperativeHandle(ref, function () {
|
|
80
|
+
return {
|
|
81
|
+
open: open,
|
|
82
|
+
inputRef: inputRef,
|
|
83
|
+
rootRef: rootRef
|
|
84
|
+
};
|
|
85
|
+
});
|
|
76
86
|
if (filesAmount && filesAmount < 1) {
|
|
77
87
|
filesAmount = 1;
|
|
78
88
|
throw new Error('Invalid value of property "filesAmount" ');
|
|
@@ -119,5 +129,5 @@ var ItemUploader = function ItemUploader(_ref) {
|
|
|
119
129
|
}), description && /*#__PURE__*/React.createElement(S.Description, {
|
|
120
130
|
hasError: hasError
|
|
121
131
|
}, description));
|
|
122
|
-
};
|
|
132
|
+
});
|
|
123
133
|
export default ItemUploader;
|
package/dist/index.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ export { default } from './FileUploader';
|
|
|
6
6
|
export { default as AvatarUploader } from './AvatarUploader/AvatarUploader';
|
|
7
7
|
export { default as ItemUploader } from './ItemUploader/ItemUploader';
|
|
8
8
|
export type { ItemUploaderProps } from './ItemUploader/ItemUploader.types';
|
|
9
|
-
export type { FileUploaderProps, ExtendedFile, FileWithContent, } from './FileUploader.types';
|
|
9
|
+
export type { FileUploaderProps, ExtendedFile, FileWithContent, FileUploaderRef, FileContent, } from './FileUploader.types';
|
|
10
10
|
export declare const FileUploaderStyles: {
|
|
11
11
|
FileUploader: typeof Styles;
|
|
12
12
|
FileView: typeof FileViewStyles;
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,oBAAoB,MAAM,wCAAwC,CAAC;AAC/E,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;AAChD,OAAO,KAAK,cAAc,MAAM,4BAA4B,CAAC;AAC7D,OAAO,KAAK,kBAAkB,MAAM,oCAAoC,CAAC;AAEzE,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AACzC,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAC5E,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAEtE,YAAY,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AAC3E,YAAY,EACV,iBAAiB,EACjB,YAAY,EACZ,eAAe,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,oBAAoB,MAAM,wCAAwC,CAAC;AAC/E,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;AAChD,OAAO,KAAK,cAAc,MAAM,4BAA4B,CAAC;AAC7D,OAAO,KAAK,kBAAkB,MAAM,oCAAoC,CAAC;AAEzE,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AACzC,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAC5E,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAEtE,YAAY,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AAC3E,YAAY,EACV,iBAAiB,EACjB,YAAY,EACZ,eAAe,EACf,eAAe,EACf,WAAW,GACZ,MAAM,sBAAsB,CAAC;AAE9B,eAAO,MAAM,kBAAkB;;;;;CAK9B,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@synerise/ds-file-uploader",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "FileUploader UI Component for the Synerise Design System",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"repository": "Synerise/synerise-design",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"@synerise/ds-icon": "^1.7.1",
|
|
39
39
|
"@synerise/ds-loader": "^1.0.8",
|
|
40
40
|
"@synerise/ds-popconfirm": "^1.0.21",
|
|
41
|
-
"@synerise/ds-progress-bar": "^1.1.
|
|
41
|
+
"@synerise/ds-progress-bar": "^1.1.15",
|
|
42
42
|
"@synerise/ds-tooltip": "^1.1.17",
|
|
43
43
|
"@synerise/ds-typography": "^1.0.19",
|
|
44
44
|
"@synerise/ds-utils": "^1.4.1",
|
|
@@ -51,5 +51,5 @@
|
|
|
51
51
|
"react-intl": ">=3.12.0 <= 6.8",
|
|
52
52
|
"styled-components": "^5.3.3"
|
|
53
53
|
},
|
|
54
|
-
"gitHead": "
|
|
54
|
+
"gitHead": "7f119fa17e645f1d800aea95c313fe22f348439c"
|
|
55
55
|
}
|