@synerise/ds-file-uploader 1.3.9 → 1.3.10
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 +4 -0
- package/dist/AvatarUploader/AvatarUploader.d.ts +7 -8
- package/dist/AvatarUploader/AvatarUploader.js +78 -124
- package/dist/AvatarUploader/AvatarUploader.styles.d.ts +26 -27
- package/dist/AvatarUploader/AvatarUploader.styles.js +54 -70
- package/dist/AvatarUploader/FileViewAvatar/FileViewAvatar.const.d.ts +1 -2
- package/dist/AvatarUploader/FileViewAvatar/FileViewAvatar.const.js +14 -10
- package/dist/AvatarUploader/FileViewAvatar/FileViewAvatar.d.ts +2 -3
- package/dist/AvatarUploader/FileViewAvatar/FileViewAvatar.js +49 -90
- package/dist/AvatarUploader/FileViewAvatar/FileViewAvatar.styles.d.ts +16 -17
- package/dist/AvatarUploader/FileViewAvatar/FileViewAvatar.styles.js +69 -91
- package/dist/AvatarUploader/FileViewAvatar/FileViewAvatar.types.d.ts +2 -3
- package/dist/AvatarUploader/FileViewAvatar/FileViewAvatar.types.js +1 -1
- package/dist/AvatarUploader/FileViewAvatar/FileViewAvatar.util.d.ts +1 -2
- package/dist/AvatarUploader/FileViewAvatar/FileViewAvatar.util.js +6 -3
- package/dist/FileUploader.d.ts +6 -7
- package/dist/FileUploader.js +91 -146
- package/dist/FileUploader.styles.d.ts +26 -27
- package/dist/FileUploader.styles.js +58 -78
- package/dist/FileUploader.types.d.ts +2 -3
- package/dist/FileUploader.types.js +1 -1
- package/dist/FileView/FileView.const.d.ts +1 -2
- package/dist/FileView/FileView.const.js +24 -19
- package/dist/FileView/FileView.d.ts +2 -3
- package/dist/FileView/FileView.js +72 -138
- package/dist/FileView/FileView.styles.d.ts +17 -18
- package/dist/FileView/FileView.styles.js +65 -83
- package/dist/FileView/FileView.types.d.ts +2 -3
- package/dist/FileView/FileView.types.js +1 -1
- package/dist/ItemUploader/ItemUploader.d.ts +3 -4
- package/dist/ItemUploader/ItemUploader.js +73 -104
- package/dist/ItemUploader/ItemUploader.styles.d.ts +26 -27
- package/dist/ItemUploader/ItemUploader.styles.js +53 -71
- package/dist/ItemUploader/ItemUploader.types.d.ts +0 -1
- package/dist/ItemUploader/ItemUploader.types.js +1 -1
- package/dist/ItemUploader/UploaderButton/FileViewItem.const.d.ts +0 -1
- package/dist/ItemUploader/UploaderButton/FileViewItem.const.js +16 -11
- package/dist/ItemUploader/UploaderButton/FileViewItem.d.ts +2 -3
- package/dist/ItemUploader/UploaderButton/FileViewItem.js +38 -67
- package/dist/ItemUploader/UploaderButton/FileViewItem.styles.d.ts +12 -13
- package/dist/ItemUploader/UploaderButton/FileViewItem.styles.js +55 -74
- package/dist/index.d.ts +0 -1
- package/dist/index.js +19 -13
- package/dist/modules.d.js +1 -1
- package/dist/modules.d.ts +0 -0
- package/package.json +12 -12
- package/dist/AvatarUploader/AvatarUploader.d.ts.map +0 -1
- package/dist/AvatarUploader/AvatarUploader.styles.d.ts.map +0 -1
- package/dist/AvatarUploader/FileViewAvatar/FileViewAvatar.const.d.ts.map +0 -1
- package/dist/AvatarUploader/FileViewAvatar/FileViewAvatar.d.ts.map +0 -1
- package/dist/AvatarUploader/FileViewAvatar/FileViewAvatar.styles.d.ts.map +0 -1
- package/dist/AvatarUploader/FileViewAvatar/FileViewAvatar.types.d.ts.map +0 -1
- package/dist/AvatarUploader/FileViewAvatar/FileViewAvatar.util.d.ts.map +0 -1
- package/dist/FileUploader.d.ts.map +0 -1
- package/dist/FileUploader.styles.d.ts.map +0 -1
- package/dist/FileUploader.types.d.ts.map +0 -1
- package/dist/FileView/FileView.const.d.ts.map +0 -1
- package/dist/FileView/FileView.d.ts.map +0 -1
- package/dist/FileView/FileView.styles.d.ts.map +0 -1
- package/dist/FileView/FileView.types.d.ts.map +0 -1
- package/dist/ItemUploader/ItemUploader.d.ts.map +0 -1
- package/dist/ItemUploader/ItemUploader.styles.d.ts.map +0 -1
- package/dist/ItemUploader/ItemUploader.types.d.ts.map +0 -1
- package/dist/ItemUploader/UploaderButton/FileViewItem.const.d.ts.map +0 -1
- package/dist/ItemUploader/UploaderButton/FileViewItem.d.ts.map +0 -1
- package/dist/ItemUploader/UploaderButton/FileViewItem.styles.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,10 @@
|
|
|
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.3.10](https://github.com/Synerise/synerise-design/compare/@synerise/ds-file-uploader@1.3.9...@synerise/ds-file-uploader@1.3.10) (2026-03-24)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @synerise/ds-file-uploader
|
|
9
|
+
|
|
6
10
|
## [1.3.9](https://github.com/Synerise/synerise-design/compare/@synerise/ds-file-uploader@1.3.8...@synerise/ds-file-uploader@1.3.9) (2026-03-20)
|
|
7
11
|
|
|
8
12
|
**Note:** Version bump only for package @synerise/ds-file-uploader
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import {
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { FileUploaderRef } from '../FileUploader.types';
|
|
3
3
|
declare const AvatarUploader: React.ForwardRefExoticComponent<{
|
|
4
4
|
className?: string;
|
|
5
5
|
mode: "single" | "multi-medium" | "multi-large";
|
|
@@ -11,16 +11,15 @@ declare const AvatarUploader: React.ForwardRefExoticComponent<{
|
|
|
11
11
|
removeTooltip?: React.ReactNode;
|
|
12
12
|
label?: string;
|
|
13
13
|
error?: string;
|
|
14
|
-
texts?: import(
|
|
14
|
+
texts?: import('../FileUploader.types').FileViewTexts & {
|
|
15
15
|
buttonLabel?: React.ReactNode;
|
|
16
16
|
buttonLabelLarge?: React.ReactNode;
|
|
17
17
|
buttonDescription?: React.ReactNode;
|
|
18
18
|
};
|
|
19
|
-
files: import(
|
|
19
|
+
files: import('../FileUploader.types').ExtendedFile[];
|
|
20
20
|
accept?: string[];
|
|
21
|
-
onRemove?: (file: import(
|
|
22
|
-
onUpload?: (files: import(
|
|
21
|
+
onRemove?: (file: import('../FileUploader.types').FileWithContent, index: number) => void;
|
|
22
|
+
onUpload?: (files: import('../FileUploader.types').FileWithContent[]) => void;
|
|
23
23
|
retry?: boolean;
|
|
24
|
-
} & Omit<React.HTMLAttributes<HTMLDivElement>, "label" | "className" | "mode" | "disabled" | "accept" | "description" | "tooltip" | "error" | "removable" | "onRemove" | "texts" | "filesAmount" | "removeTooltip" | "files" | "onUpload" | "retry"> & import(
|
|
24
|
+
} & Omit<React.HTMLAttributes<HTMLDivElement>, "label" | "className" | "mode" | "disabled" | "accept" | "description" | "tooltip" | "error" | "removable" | "onRemove" | "texts" | "filesAmount" | "removeTooltip" | "files" | "onUpload" | "retry"> & import('@synerise/ds-utils').DataAttributes & React.RefAttributes<FileUploaderRef>>;
|
|
25
25
|
export default AvatarUploader;
|
|
26
|
-
//# sourceMappingURL=AvatarUploader.d.ts.map
|
|
@@ -1,53 +1,45 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
import { useDropzone } from
|
|
4
|
-
import Button from
|
|
5
|
-
import { useTheme } from
|
|
6
|
-
import Icon, {
|
|
7
|
-
import Tooltip from
|
|
8
|
-
import
|
|
9
|
-
import FileViewAvatar from
|
|
1
|
+
import { jsxs, jsx, Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef, useState, useCallback, useImperativeHandle } from "react";
|
|
3
|
+
import { useDropzone } from "react-dropzone";
|
|
4
|
+
import Button from "@synerise/ds-button";
|
|
5
|
+
import { useTheme } from "@synerise/ds-core";
|
|
6
|
+
import Icon, { InfoFillS, FileTypePictureL, Add3M } from "@synerise/ds-icon";
|
|
7
|
+
import Tooltip from "@synerise/ds-tooltip";
|
|
8
|
+
import { Container, Label, UploaderContainer, DropAreaContainer, DropAreaButton, Description } from "./AvatarUploader.styles.js";
|
|
9
|
+
import FileViewAvatar from "./FileViewAvatar/FileViewAvatar.js";
|
|
10
10
|
function readAsText(file) {
|
|
11
|
-
return new Promise(
|
|
12
|
-
|
|
13
|
-
file.type !==
|
|
14
|
-
reader.onerror =
|
|
15
|
-
|
|
16
|
-
};
|
|
17
|
-
reader.onload = function () {
|
|
18
|
-
return resolve(reader.result);
|
|
19
|
-
};
|
|
11
|
+
return new Promise((resolve) => {
|
|
12
|
+
const reader = new FileReader();
|
|
13
|
+
file.type !== "text/plain" && resolve(null);
|
|
14
|
+
reader.onerror = () => resolve(null);
|
|
15
|
+
reader.onload = () => resolve(reader.result);
|
|
20
16
|
reader.readAsText(file);
|
|
21
17
|
});
|
|
22
18
|
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
setUploadSuccess = _useState[1];
|
|
44
|
-
var theme = useTheme();
|
|
45
|
-
var readFilesContent = useCallback(function (addedFiles) {
|
|
46
|
-
var readerPromises = addedFiles.map(function (file) {
|
|
19
|
+
const AvatarUploader = forwardRef(({
|
|
20
|
+
className,
|
|
21
|
+
onUpload,
|
|
22
|
+
disabled,
|
|
23
|
+
accept,
|
|
24
|
+
error,
|
|
25
|
+
label,
|
|
26
|
+
onRemove,
|
|
27
|
+
description,
|
|
28
|
+
tooltip,
|
|
29
|
+
filesAmount,
|
|
30
|
+
mode = "single",
|
|
31
|
+
removable = true,
|
|
32
|
+
files = [],
|
|
33
|
+
texts
|
|
34
|
+
}, ref) => {
|
|
35
|
+
const [uploadSuccess, setUploadSuccess] = useState(true);
|
|
36
|
+
const theme = useTheme();
|
|
37
|
+
const readFilesContent = useCallback((addedFiles) => {
|
|
38
|
+
const readerPromises = addedFiles.map((file) => {
|
|
47
39
|
return readAsText(file);
|
|
48
40
|
});
|
|
49
|
-
Promise.all(readerPromises).then(
|
|
50
|
-
|
|
41
|
+
Promise.all(readerPromises).then((filesContent) => {
|
|
42
|
+
const filesWithContent = addedFiles.map((file, index) => {
|
|
51
43
|
return Object.assign(file, {
|
|
52
44
|
content: filesContent[index]
|
|
53
45
|
});
|
|
@@ -55,8 +47,8 @@ var AvatarUploader = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
55
47
|
onUpload && onUpload(filesWithContent);
|
|
56
48
|
});
|
|
57
49
|
}, [onUpload]);
|
|
58
|
-
|
|
59
|
-
|
|
50
|
+
const onDrop = useCallback((acceptedFiles) => {
|
|
51
|
+
let possibleUpload = 0;
|
|
60
52
|
if (filesAmount) {
|
|
61
53
|
possibleUpload = filesAmount - files.length;
|
|
62
54
|
}
|
|
@@ -67,87 +59,49 @@ var AvatarUploader = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
67
59
|
readFilesContent(acceptedFiles);
|
|
68
60
|
}
|
|
69
61
|
}, [filesAmount, files, setUploadSuccess, readFilesContent]);
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
useImperativeHandle(ref, function () {
|
|
83
|
-
return {
|
|
84
|
-
open: open,
|
|
85
|
-
inputRef: inputRef,
|
|
86
|
-
rootRef: rootRef
|
|
87
|
-
};
|
|
62
|
+
const {
|
|
63
|
+
getRootProps,
|
|
64
|
+
getInputProps,
|
|
65
|
+
isDragActive,
|
|
66
|
+
open,
|
|
67
|
+
inputRef,
|
|
68
|
+
rootRef
|
|
69
|
+
} = useDropzone({
|
|
70
|
+
accept: accept ? accept.join(",") : void 0,
|
|
71
|
+
multiple: mode !== "single",
|
|
72
|
+
onDrop,
|
|
73
|
+
disabled
|
|
88
74
|
});
|
|
75
|
+
useImperativeHandle(ref, () => ({
|
|
76
|
+
open,
|
|
77
|
+
inputRef,
|
|
78
|
+
rootRef
|
|
79
|
+
}));
|
|
89
80
|
if (filesAmount && filesAmount < 1) {
|
|
90
81
|
filesAmount = 1;
|
|
91
82
|
throw new Error('Invalid value of property "filesAmount" ');
|
|
92
83
|
}
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
removable: removable,
|
|
114
|
-
onRemove: function onRemove() {
|
|
115
|
-
return _onRemove && _onRemove(file.file, index);
|
|
116
|
-
},
|
|
117
|
-
data: file,
|
|
118
|
-
description: description
|
|
119
|
-
});
|
|
120
|
-
}), (mode !== 'single' && (filesAmount ? files.length < filesAmount : true) || files.length === 0) && /*#__PURE__*/React.createElement(S.UploaderContainer, null, /*#__PURE__*/React.createElement(S.DropAreaContainer, _extends({}, getRootProps(), {
|
|
121
|
-
canUploadMore: mode !== 'single' && files.length > 0
|
|
122
|
-
}), /*#__PURE__*/React.createElement("input", _extends({}, getInputProps(), {
|
|
123
|
-
"data-testid": "drop-area-input"
|
|
124
|
-
})), /*#__PURE__*/React.createElement(S.DropAreaButton, {
|
|
125
|
-
type: "button",
|
|
126
|
-
mode: mode,
|
|
127
|
-
disabled: disabled,
|
|
128
|
-
isDropping: isDragActive,
|
|
129
|
-
hasError: hasError,
|
|
130
|
-
onMouseDown: function onMouseDown() {
|
|
131
|
-
return setPressed(true);
|
|
132
|
-
},
|
|
133
|
-
onMouseUp: function onMouseUp() {
|
|
134
|
-
return setPressed(false);
|
|
135
|
-
},
|
|
136
|
-
pressed: pressed,
|
|
137
|
-
"data-testid": "drop-area",
|
|
138
|
-
filesLength: files.length
|
|
139
|
-
}, /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Icon, {
|
|
140
|
-
component: /*#__PURE__*/React.createElement(FileTypePictureL, null),
|
|
141
|
-
size: 48
|
|
142
|
-
}))))), /*#__PURE__*/React.createElement("div", null, (mode !== 'single' && (filesAmount ? files.length < filesAmount : true) || files.length === 0) && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Button, _extends({}, getRootProps(), {
|
|
143
|
-
disabled: disabled,
|
|
144
|
-
type: "secondary",
|
|
145
|
-
mode: "icon-label"
|
|
146
|
-
}), /*#__PURE__*/React.createElement(Icon, {
|
|
147
|
-
component: /*#__PURE__*/React.createElement(Add3M, null),
|
|
148
|
-
size: 24
|
|
149
|
-
}), "Add file"), description && /*#__PURE__*/React.createElement(S.Description, {
|
|
150
|
-
hasError: hasError
|
|
151
|
-
}, description))));
|
|
84
|
+
const hasError = Boolean(error) || !uploadSuccess;
|
|
85
|
+
const [pressed, setPressed] = useState(false);
|
|
86
|
+
return /* @__PURE__ */ jsxs(Container, { className: `ds-file-avatar-uploader ${className || ""}`, children: [
|
|
87
|
+
label && /* @__PURE__ */ jsxs(Label, { children: [
|
|
88
|
+
/* @__PURE__ */ jsx("span", { children: label }),
|
|
89
|
+
tooltip && /* @__PURE__ */ jsx(Tooltip, { trigger: "hover", placement: "top", title: tooltip, children: /* @__PURE__ */ jsx("span", { "data-testid": "tooltip-info", children: /* @__PURE__ */ jsx(Icon, { component: /* @__PURE__ */ jsx(InfoFillS, {}), color: theme.palette["grey-400"], size: 24 }) }) })
|
|
90
|
+
] }),
|
|
91
|
+
files.length > 0 && files.map((file, index) => /* @__PURE__ */ jsx(FileViewAvatar, { texts, removable, onRemove: () => onRemove && onRemove(file.file, index), data: file, description }, file.file.lastModified)),
|
|
92
|
+
(mode !== "single" && (filesAmount ? files.length < filesAmount : true) || files.length === 0) && /* @__PURE__ */ jsx(UploaderContainer, { children: /* @__PURE__ */ jsxs(DropAreaContainer, { ...getRootProps(), canUploadMore: mode !== "single" && files.length > 0, children: [
|
|
93
|
+
/* @__PURE__ */ jsx("input", { ...getInputProps(), "data-testid": "drop-area-input" }),
|
|
94
|
+
/* @__PURE__ */ jsx(DropAreaButton, { type: "button", mode, disabled, isDropping: isDragActive, hasError, onMouseDown: () => setPressed(true), onMouseUp: () => setPressed(false), pressed, "data-testid": "drop-area", filesLength: files.length, children: /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(Icon, { component: /* @__PURE__ */ jsx(FileTypePictureL, {}), size: 48 }) }) })
|
|
95
|
+
] }) }),
|
|
96
|
+
/* @__PURE__ */ jsx("div", { children: (mode !== "single" && (filesAmount ? files.length < filesAmount : true) || files.length === 0) && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
97
|
+
/* @__PURE__ */ jsxs(Button, { ...getRootProps(), disabled, type: "secondary", mode: "icon-label", children: [
|
|
98
|
+
/* @__PURE__ */ jsx(Icon, { component: /* @__PURE__ */ jsx(Add3M, {}), size: 24 }),
|
|
99
|
+
"Add file"
|
|
100
|
+
] }),
|
|
101
|
+
description && /* @__PURE__ */ jsx(Description, { hasError, children: description })
|
|
102
|
+
] }) })
|
|
103
|
+
] });
|
|
152
104
|
});
|
|
153
|
-
export
|
|
105
|
+
export {
|
|
106
|
+
AvatarUploader as default
|
|
107
|
+
};
|
|
@@ -1,45 +1,44 @@
|
|
|
1
|
-
export declare const Container: import(
|
|
2
|
-
export declare const UploaderContainer: import(
|
|
3
|
-
export declare const Description: import(
|
|
4
|
-
size?: import(
|
|
5
|
-
ellipsis?: import(
|
|
6
|
-
children?: import(
|
|
1
|
+
export declare const Container: import('styled-components').StyledComponent<"div", any, {}, never>;
|
|
2
|
+
export declare const UploaderContainer: import('styled-components').StyledComponent<"div", any, {}, never>;
|
|
3
|
+
export declare const Description: import('styled-components').StyledComponent<({ size, className, children, ellipsis, style, }: {
|
|
4
|
+
size?: import('@synerise/ds-typography').TextSize;
|
|
5
|
+
ellipsis?: import('@synerise/ds-typography/dist/Ellipsis').EllipsisProps;
|
|
6
|
+
children?: import('react').ReactNode;
|
|
7
7
|
className?: string;
|
|
8
|
-
style?: import(
|
|
8
|
+
style?: import('react').CSSProperties;
|
|
9
9
|
}) => React.JSX.Element, any, {
|
|
10
10
|
hasError?: boolean;
|
|
11
11
|
}, never>;
|
|
12
|
-
export declare const DropAreaContainer: import(
|
|
12
|
+
export declare const DropAreaContainer: import('styled-components').StyledComponent<"div", any, {
|
|
13
13
|
canUploadMore: boolean;
|
|
14
14
|
}, never>;
|
|
15
|
-
export declare const DropAreaLabel: import(
|
|
16
|
-
size?: import(
|
|
17
|
-
ellipsis?: import(
|
|
18
|
-
children?: import(
|
|
15
|
+
export declare const DropAreaLabel: import('styled-components').StyledComponent<({ size, className, children, ellipsis, style, }: {
|
|
16
|
+
size?: import('@synerise/ds-typography').TextSize;
|
|
17
|
+
ellipsis?: import('@synerise/ds-typography/dist/Ellipsis').EllipsisProps;
|
|
18
|
+
children?: import('react').ReactNode;
|
|
19
19
|
className?: string;
|
|
20
|
-
style?: import(
|
|
20
|
+
style?: import('react').CSSProperties;
|
|
21
21
|
}) => React.JSX.Element, any, {}, never>;
|
|
22
|
-
export declare const LargeDropAreaLabel: import(
|
|
23
|
-
export declare const LargeDropAreaDescription: import(
|
|
24
|
-
size?: import(
|
|
25
|
-
ellipsis?: import(
|
|
26
|
-
children?: import(
|
|
22
|
+
export declare const LargeDropAreaLabel: import('styled-components').StyledComponent<"label", any, {}, never>;
|
|
23
|
+
export declare const LargeDropAreaDescription: import('styled-components').StyledComponent<({ size, className, children, ellipsis, style, }: {
|
|
24
|
+
size?: import('@synerise/ds-typography').TextSize;
|
|
25
|
+
ellipsis?: import('@synerise/ds-typography/dist/Ellipsis').EllipsisProps;
|
|
26
|
+
children?: import('react').ReactNode;
|
|
27
27
|
className?: string;
|
|
28
|
-
style?: import(
|
|
28
|
+
style?: import('react').CSSProperties;
|
|
29
29
|
}) => React.JSX.Element, any, {}, never>;
|
|
30
|
-
export declare const DropAreaButton: import(
|
|
30
|
+
export declare const DropAreaButton: import('styled-components').StyledComponent<"button", any, {
|
|
31
31
|
isDropping?: boolean;
|
|
32
32
|
hasError?: boolean;
|
|
33
33
|
mode: string;
|
|
34
34
|
pressed: boolean;
|
|
35
35
|
filesLength: number;
|
|
36
36
|
}, never>;
|
|
37
|
-
export declare const ErrorMessage: import(
|
|
38
|
-
size?: import(
|
|
39
|
-
ellipsis?: import(
|
|
40
|
-
children?: import(
|
|
37
|
+
export declare const ErrorMessage: import('styled-components').StyledComponent<({ size, className, children, ellipsis, style, }: {
|
|
38
|
+
size?: import('@synerise/ds-typography').TextSize;
|
|
39
|
+
ellipsis?: import('@synerise/ds-typography/dist/Ellipsis').EllipsisProps;
|
|
40
|
+
children?: import('react').ReactNode;
|
|
41
41
|
className?: string;
|
|
42
|
-
style?: import(
|
|
42
|
+
style?: import('react').CSSProperties;
|
|
43
43
|
}) => React.JSX.Element, any, {}, never>;
|
|
44
|
-
export declare const Label: import(
|
|
45
|
-
//# sourceMappingURL=AvatarUploader.styles.d.ts.map
|
|
44
|
+
export declare const Label: import('styled-components').StyledComponent<"label", any, {}, never>;
|
|
@@ -1,92 +1,76 @@
|
|
|
1
|
-
import styled, { css } from
|
|
2
|
-
import { IconContainer } from
|
|
3
|
-
import {
|
|
4
|
-
import { hexToRgba } from
|
|
5
|
-
|
|
1
|
+
import styled, { css } from "styled-components";
|
|
2
|
+
import { IconContainer } from "@synerise/ds-icon";
|
|
3
|
+
import { Label as Label$1, Text } from "@synerise/ds-typography";
|
|
4
|
+
import { hexToRgba } from "@synerise/ds-utils";
|
|
5
|
+
const Container = /* @__PURE__ */ styled.div.withConfig({
|
|
6
6
|
displayName: "AvatarUploaderstyles__Container",
|
|
7
7
|
componentId: "sc-1lljrgr-0"
|
|
8
8
|
})(["width:100%;display:flex;"]);
|
|
9
|
-
|
|
9
|
+
const UploaderContainer = /* @__PURE__ */ styled.div.withConfig({
|
|
10
10
|
displayName: "AvatarUploaderstyles__UploaderContainer",
|
|
11
11
|
componentId: "sc-1lljrgr-1"
|
|
12
12
|
})(["align-items:center;padding-right:14px;"]);
|
|
13
|
-
|
|
13
|
+
const Description = /* @__PURE__ */ styled(Text).withConfig({
|
|
14
14
|
displayName: "AvatarUploaderstyles__Description",
|
|
15
15
|
componentId: "sc-1lljrgr-2"
|
|
16
|
-
})(["&&{margin:", ";display:block;color:", ";}"],
|
|
17
|
-
|
|
18
|
-
}, function (props) {
|
|
19
|
-
return props.theme.palette['grey-500'];
|
|
20
|
-
});
|
|
21
|
-
export var DropAreaContainer = styled.div.withConfig({
|
|
16
|
+
})(["&&{margin:", ";display:block;color:", ";}"], (props) => props.hasError ? "4px 0 8px" : "16px 0 8px", (props) => props.theme.palette["grey-500"]);
|
|
17
|
+
const DropAreaContainer = /* @__PURE__ */ styled.div.withConfig({
|
|
22
18
|
displayName: "AvatarUploaderstyles__DropAreaContainer",
|
|
23
19
|
componentId: "sc-1lljrgr-3"
|
|
24
|
-
})(["width:100%;margin:", ";"],
|
|
25
|
-
|
|
26
|
-
});
|
|
27
|
-
export var DropAreaLabel = styled(Text).withConfig({
|
|
20
|
+
})(["width:100%;margin:", ";"], (props) => props.canUploadMore ? "12px 0 8px" : "0");
|
|
21
|
+
const DropAreaLabel = /* @__PURE__ */ styled(Text).withConfig({
|
|
28
22
|
displayName: "AvatarUploaderstyles__DropAreaLabel",
|
|
29
23
|
componentId: "sc-1lljrgr-4"
|
|
30
|
-
})(["color:", ";font-weight:500;"],
|
|
31
|
-
|
|
32
|
-
});
|
|
33
|
-
export var LargeDropAreaLabel = styled(TypographyLabel).withConfig({
|
|
24
|
+
})(["color:", ";font-weight:500;"], (props) => props.theme.palette["grey-700"]);
|
|
25
|
+
const LargeDropAreaLabel = /* @__PURE__ */ styled(Label$1).withConfig({
|
|
34
26
|
displayName: "AvatarUploaderstyles__LargeDropAreaLabel",
|
|
35
27
|
componentId: "sc-1lljrgr-5"
|
|
36
|
-
})(["&&{font-size:14px;margin:4px 0 0;display:block;color:", ";}"],
|
|
37
|
-
|
|
38
|
-
});
|
|
39
|
-
export var LargeDropAreaDescription = styled(Text).withConfig({
|
|
28
|
+
})(["&&{font-size:14px;margin:4px 0 0;display:block;color:", ";}"], (props) => props.theme.palette["grey-700"]);
|
|
29
|
+
const LargeDropAreaDescription = /* @__PURE__ */ styled(Text).withConfig({
|
|
40
30
|
displayName: "AvatarUploaderstyles__LargeDropAreaDescription",
|
|
41
31
|
componentId: "sc-1lljrgr-6"
|
|
42
|
-
})(["&&{margin:4px 0 0;display:block;color:", ";}"],
|
|
43
|
-
|
|
44
|
-
});
|
|
45
|
-
export var DropAreaButton = styled.button.withConfig({
|
|
32
|
+
})(["&&{margin:4px 0 0;display:block;color:", ";}"], (props) => props.theme.palette["grey-700"]);
|
|
33
|
+
const DropAreaButton = /* @__PURE__ */ styled.button.withConfig({
|
|
46
34
|
displayName: "AvatarUploaderstyles__DropAreaButton",
|
|
47
35
|
componentId: "sc-1lljrgr-7"
|
|
48
|
-
})(["align-items:center;border:1px dashed ", ";padding:11px 12px;border-radius:3px;cursor:pointer;background-color:transparent;width:80px;height:80px;transition:height 0.3s;", ";", "{color:", ";}span{display:inline-block;margin:0 0 0 12px;}", " ", " &:hover:not(:disabled){background-color:", ";border-color:", ";", ",", "{color:", ";}", "{color:", ";}}&:disabled{background-color:", ";", "{color:", ";}}&&:active{color:", ";border-color:", ";background-color:", ";}&:focus:not(:active):not(:disabled){border-color:", ";background-color:", ";}&:disabled{span,", "{opacity:0.4;}}", ""],
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
},
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
}, function (props) {
|
|
71
|
-
return props.theme.palette['red-400'];
|
|
72
|
-
}, function (props) {
|
|
73
|
-
return props.theme.palette['grey-400'];
|
|
74
|
-
}, function (props) {
|
|
75
|
-
return props.theme.palette['grey-050'];
|
|
76
|
-
}, function (props) {
|
|
77
|
-
return props.theme.palette['blue-600'];
|
|
78
|
-
}, function (props) {
|
|
79
|
-
return props.theme.palette['blue-050'];
|
|
80
|
-
}, IconContainer, function (props) {
|
|
81
|
-
return props.isDropping && !props.disabled && "\n height: " + (props.mode === 'multi-large' ? '200px' : '80px') + ";\n background-color: " + props.theme.palette['blue-050'] + " !important;\n border-color: " + props.theme.palette['blue-300'] + " !important;\n\n span, " + DropAreaLabel + ", " + LargeDropAreaLabel + ", " + LargeDropAreaDescription + " {\n color: " + props.theme.palette['blue-500'] + " !important;\n }\n\n " + IconContainer + " {\n color: " + props.theme.palette['blue-500'] + " !important;\n }\n ";
|
|
82
|
-
});
|
|
83
|
-
export var ErrorMessage = styled(Text).withConfig({
|
|
36
|
+
})(["align-items:center;border:1px dashed ", ";padding:11px 12px;border-radius:3px;cursor:pointer;background-color:transparent;width:80px;height:80px;transition:height 0.3s;", ";", "{color:", ";}span{display:inline-block;margin:0 0 0 12px;}", " ", " &:hover:not(:disabled){background-color:", ";border-color:", ";", ",", "{color:", ";}", "{color:", ";}}&:disabled{background-color:", ";", "{color:", ";}}&&:active{color:", ";border-color:", ";background-color:", ";}&:focus:not(:active):not(:disabled){border-color:", ";background-color:", ";}&:disabled{span,", "{opacity:0.4;}}", ""], (props) => props.theme.palette["grey-400"], (props) => props.mode === "multi-large" && props.filesLength === 0 && `
|
|
37
|
+
height: 108px;
|
|
38
|
+
flex-direction: column;
|
|
39
|
+
text-align: center;
|
|
40
|
+
justify-content: center;
|
|
41
|
+
`, IconContainer, (props) => props.theme.palette["grey-800"], (props) => props.hasError && `
|
|
42
|
+
background-color: ${props.theme.palette["red-050"]};
|
|
43
|
+
border-color: ${props.theme.palette["red-600"]};
|
|
44
|
+
`, (props) => props.pressed && !props.disabled && css(["&&&:active,&&&{background-color:", ";}"], hexToRgba(props.theme.palette["grey-200"], 0.4)), (props) => hexToRgba(props.theme.palette["grey-200"], 0.2), (props) => props.theme.palette["grey-400"], DropAreaLabel, LargeDropAreaLabel, (props) => props.theme.palette["grey-700"], IconContainer, (props) => props.theme.palette["grey-700"], (props) => props.theme.palette["grey-050"], LargeDropAreaLabel, (props) => props.theme.palette["grey-400"], (props) => props.theme.palette["red-400"], (props) => props.theme.palette["grey-400"], (props) => props.theme.palette["grey-050"], (props) => props.theme.palette["blue-600"], (props) => props.theme.palette["blue-050"], IconContainer, (props) => props.isDropping && !props.disabled && `
|
|
45
|
+
height: ${props.mode === "multi-large" ? "200px" : "80px"};
|
|
46
|
+
background-color: ${props.theme.palette["blue-050"]} !important;
|
|
47
|
+
border-color: ${props.theme.palette["blue-300"]} !important;
|
|
48
|
+
|
|
49
|
+
span, ${DropAreaLabel}, ${LargeDropAreaLabel}, ${LargeDropAreaDescription} {
|
|
50
|
+
color: ${props.theme.palette["blue-500"]} !important;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
${IconContainer} {
|
|
54
|
+
color: ${props.theme.palette["blue-500"]} !important;
|
|
55
|
+
}
|
|
56
|
+
`);
|
|
57
|
+
const ErrorMessage = /* @__PURE__ */ styled(Text).withConfig({
|
|
84
58
|
displayName: "AvatarUploaderstyles__ErrorMessage",
|
|
85
59
|
componentId: "sc-1lljrgr-8"
|
|
86
|
-
})(["&&{margin:8px 0 0;display:block;color:", ";}"],
|
|
87
|
-
|
|
88
|
-
});
|
|
89
|
-
export var Label = styled(TypographyLabel).withConfig({
|
|
60
|
+
})(["&&{margin:8px 0 0;display:block;color:", ";}"], (props) => props.theme.palette["red-600"]);
|
|
61
|
+
const Label = /* @__PURE__ */ styled(Label$1).withConfig({
|
|
90
62
|
displayName: "AvatarUploaderstyles__Label",
|
|
91
63
|
componentId: "sc-1lljrgr-9"
|
|
92
|
-
})(["&&{cursor:initial;margin:0 0 8px;display:flex;align-items:center;}"]);
|
|
64
|
+
})(["&&{cursor:initial;margin:0 0 8px;display:flex;align-items:center;}"]);
|
|
65
|
+
export {
|
|
66
|
+
Container,
|
|
67
|
+
Description,
|
|
68
|
+
DropAreaButton,
|
|
69
|
+
DropAreaContainer,
|
|
70
|
+
DropAreaLabel,
|
|
71
|
+
ErrorMessage,
|
|
72
|
+
Label,
|
|
73
|
+
LargeDropAreaDescription,
|
|
74
|
+
LargeDropAreaLabel,
|
|
75
|
+
UploaderContainer
|
|
76
|
+
};
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { PreviewableMimeType } from './FileViewAvatar.types';
|
|
2
2
|
export declare const previewableMimeTypes: PreviewableMimeType[];
|
|
3
3
|
export declare const ICON_MAP: Record<PreviewableMimeType, JSX.Element>;
|
|
4
|
-
//# sourceMappingURL=FileViewAvatar.const.d.ts.map
|
|
@@ -1,10 +1,14 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { FileTypeImageM } from
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
};
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { FileTypeImageM } from "@synerise/ds-icon";
|
|
3
|
+
const previewableMimeTypes = ["image/png", "image/gif", "image/jpeg", "image/svg+xml", "text/csv"];
|
|
4
|
+
const ICON_MAP = {
|
|
5
|
+
"image/png": /* @__PURE__ */ jsx(FileTypeImageM, {}),
|
|
6
|
+
"image/gif": /* @__PURE__ */ jsx(FileTypeImageM, {}),
|
|
7
|
+
"image/jpeg": /* @__PURE__ */ jsx(FileTypeImageM, {}),
|
|
8
|
+
"image/svg+xml": /* @__PURE__ */ jsx(FileTypeImageM, {}),
|
|
9
|
+
"text/csv": /* @__PURE__ */ jsx(FileTypeImageM, {})
|
|
10
|
+
};
|
|
11
|
+
export {
|
|
12
|
+
ICON_MAP,
|
|
13
|
+
previewableMimeTypes
|
|
14
|
+
};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import {
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { FileViewAvatarProps } from './FileViewAvatar.types';
|
|
3
3
|
declare const FileViewAvatar: ({ data, texts, onRemove, removable, description, }: FileViewAvatarProps) => React.JSX.Element;
|
|
4
4
|
export default FileViewAvatar;
|
|
5
|
-
//# sourceMappingURL=FileViewAvatar.d.ts.map
|