@synerise/ds-file-uploader 2.1.11 → 2.2.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 +11 -0
- package/CLAUDE.md +1 -1
- package/dist/AvatarUploader/AvatarUploader.js +1 -3
- package/dist/AvatarUploader/AvatarUploader.styles.js +14 -15
- package/dist/AvatarUploader/FileViewAvatar/FileViewAvatar.styles.js +18 -17
- package/dist/FileUploader.js +2 -4
- package/dist/FileUploader.styles.js +15 -16
- package/dist/FileView/FileView.js +1 -3
- package/dist/FileView/FileView.styles.js +16 -16
- package/dist/ItemUploader/ItemUploader.styles.js +15 -15
- package/dist/ItemUploader/UploaderButton/FileViewItem.styles.js +14 -13
- package/package.json +10 -10
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,17 @@
|
|
|
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
|
+
# [2.2.0](https://github.com/Synerise/synerise-design/compare/@synerise/ds-file-uploader@2.1.11...@synerise/ds-file-uploader@2.2.0) (2026-10-29)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* integrate Token Studio design tokens across the design system ([aabb447](https://github.com/Synerise/synerise-design/commit/aabb447edfb2d0c85e3de1f07e809ef84083453b))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
6
17
|
## [2.1.11](https://github.com/Synerise/synerise-design/compare/@synerise/ds-file-uploader@2.1.10...@synerise/ds-file-uploader@2.1.11) (2026-10-28)
|
|
7
18
|
|
|
8
19
|
**Note:** Version bump only for package @synerise/ds-file-uploader
|
package/CLAUDE.md
CHANGED
|
@@ -173,7 +173,7 @@ const uploaderRef = useRef(null);
|
|
|
173
173
|
|
|
174
174
|
## Styling
|
|
175
175
|
|
|
176
|
-
Styles in `FileUploader.styles.ts` (and per-variant siblings)
|
|
176
|
+
Styles in `FileUploader.styles.ts` (and per-variant siblings) use only `var(--ds-*)` tokens — no `theme.palette`, no hex. Hover/pressed backgrounds are the translucent module tokens `--ds-file-uploader-bg-hover` / `--ds-file-uploader-bg-pressed`; stored-file thumbnail backgrounds use `--ds-color-background-base-mutedhover`. The small loader border follows the custom-colour tokens through `resolveCustomColor` from `@synerise/ds-utils` (the `color` prop, `'blue'` by default at the call sites, resolves to `--ds-color-custom-<name>-600`, falling back to `--ds-color-icon-neutral-default`). Drop area transitions colours on `isDragActive`, hover, focus, error, and disabled states.
|
|
177
177
|
|
|
178
178
|
## Key dependencies
|
|
179
179
|
|
|
@@ -2,7 +2,6 @@ import { jsxs, jsx, Fragment } from "react/jsx-runtime";
|
|
|
2
2
|
import { forwardRef, useState, useCallback, useImperativeHandle } from "react";
|
|
3
3
|
import { useDropzone } from "react-dropzone";
|
|
4
4
|
import Button from "@synerise/ds-button";
|
|
5
|
-
import { useTheme } from "@synerise/ds-core";
|
|
6
5
|
import Icon, { InfoFillS, FileTypePictureL, Add3M } from "@synerise/ds-icon";
|
|
7
6
|
import Tooltip from "@synerise/ds-tooltip";
|
|
8
7
|
import { Container, Label, UploaderContainer, DropAreaContainer, DropAreaButton, Description } from "./AvatarUploader.styles.js";
|
|
@@ -33,7 +32,6 @@ const AvatarUploader = forwardRef(({
|
|
|
33
32
|
texts
|
|
34
33
|
}, ref) => {
|
|
35
34
|
const [uploadSuccess, setUploadSuccess] = useState(true);
|
|
36
|
-
const theme = useTheme();
|
|
37
35
|
const readFilesContent = useCallback((addedFiles) => {
|
|
38
36
|
const readerPromises = addedFiles.map((file) => {
|
|
39
37
|
return readAsText(file);
|
|
@@ -86,7 +84,7 @@ const AvatarUploader = forwardRef(({
|
|
|
86
84
|
return /* @__PURE__ */ jsxs(Container, { className: `ds-file-avatar-uploader ${className || ""}`, children: [
|
|
87
85
|
label && /* @__PURE__ */ jsxs(Label, { children: [
|
|
88
86
|
/* @__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:
|
|
87
|
+
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: "var(--ds-color-icon-base-muted)", size: 24 }) }) })
|
|
90
88
|
] }),
|
|
91
89
|
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
90
|
(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: [
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import styled, { css } from "styled-components";
|
|
2
2
|
import { IconContainer } from "@synerise/ds-icon";
|
|
3
3
|
import { Label as Label$1, Text } from "@synerise/ds-typography";
|
|
4
|
-
import { hexToRgba } from "@synerise/ds-utils";
|
|
5
4
|
const Container = /* @__PURE__ */ styled.div.withConfig({
|
|
6
5
|
displayName: "AvatarUploaderstyles__Container",
|
|
7
6
|
componentId: "sc-1lljrgr-0"
|
|
@@ -13,7 +12,7 @@ const UploaderContainer = /* @__PURE__ */ styled.div.withConfig({
|
|
|
13
12
|
const Description = /* @__PURE__ */ styled(Text).withConfig({
|
|
14
13
|
displayName: "AvatarUploaderstyles__Description",
|
|
15
14
|
componentId: "sc-1lljrgr-2"
|
|
16
|
-
})(["&&{margin:", ";display:block;color:
|
|
15
|
+
})(["&&{margin:", ";display:block;color:var(--ds-color-text-neutral-default);}"], (props) => props.hasError ? "4px 0 8px" : "16px 0 8px");
|
|
17
16
|
const DropAreaContainer = /* @__PURE__ */ styled.div.withConfig({
|
|
18
17
|
displayName: "AvatarUploaderstyles__DropAreaContainer",
|
|
19
18
|
componentId: "sc-1lljrgr-3"
|
|
@@ -21,43 +20,43 @@ const DropAreaContainer = /* @__PURE__ */ styled.div.withConfig({
|
|
|
21
20
|
const DropAreaLabel = /* @__PURE__ */ styled(Text).withConfig({
|
|
22
21
|
displayName: "AvatarUploaderstyles__DropAreaLabel",
|
|
23
22
|
componentId: "sc-1lljrgr-4"
|
|
24
|
-
})(["color:
|
|
23
|
+
})(["color:var(--ds-color-text-base-subtle);font-weight:500;"]);
|
|
25
24
|
const LargeDropAreaLabel = /* @__PURE__ */ styled(Label$1).withConfig({
|
|
26
25
|
displayName: "AvatarUploaderstyles__LargeDropAreaLabel",
|
|
27
26
|
componentId: "sc-1lljrgr-5"
|
|
28
|
-
})(["&&{font-size:14px;margin:4px 0 0;display:block;color:
|
|
27
|
+
})(["&&{font-size:14px;margin:4px 0 0;display:block;color:var(--ds-color-text-base-subtle);}"]);
|
|
29
28
|
const LargeDropAreaDescription = /* @__PURE__ */ styled(Text).withConfig({
|
|
30
29
|
displayName: "AvatarUploaderstyles__LargeDropAreaDescription",
|
|
31
30
|
componentId: "sc-1lljrgr-6"
|
|
32
|
-
})(["&&{margin:4px 0 0;display:block;color:
|
|
31
|
+
})(["&&{margin:4px 0 0;display:block;color:var(--ds-color-text-base-subtle);}"]);
|
|
33
32
|
const DropAreaButton = /* @__PURE__ */ styled.button.withConfig({
|
|
34
33
|
displayName: "AvatarUploaderstyles__DropAreaButton",
|
|
35
34
|
componentId: "sc-1lljrgr-7"
|
|
36
|
-
})(["align-items:center;border:1px dashed
|
|
35
|
+
})(["align-items:center;border:1px dashed var(--ds-color-border-base-stronghover);padding:11px 12px;border-radius:3px;cursor:pointer;background-color:transparent;width:80px;height:80px;transition:height 0.3s;", ";", "{color:var(--ds-color-text-base-default);}span{display:inline-block;margin:0 0 0 12px;}", " ", " &:hover:not(:disabled){background-color:var(--ds-file-uploader-bg-hover);border-color:var(--ds-color-border-base-stronghover);", ",", "{color:var(--ds-color-text-base-subtle);}", "{color:var(--ds-color-text-base-subtle);}}&:disabled{background-color:var(--ds-color-background-base-subtle);", "{color:var(--ds-color-text-base-disabled);}}&&:active{color:var(--ds-color-text-danger-default);border-color:var(--ds-color-border-base-stronghover);background-color:var(--ds-color-background-base-subtle);}&:focus:not(:active):not(:disabled){border-color:var(--ds-color-border-brand-default);background-color:var(--ds-color-background-brand-subtle);}&:disabled{span,", "{opacity:var(--ds-opacity-disabled);}}", ""], (props) => props.mode === "multi-large" && props.filesLength === 0 && `
|
|
37
36
|
height: 108px;
|
|
38
37
|
flex-direction: column;
|
|
39
38
|
text-align: center;
|
|
40
39
|
justify-content: center;
|
|
41
|
-
`, IconContainer, (props) => props.
|
|
42
|
-
background-color:
|
|
43
|
-
border-color:
|
|
44
|
-
`, (props) => props.pressed && !props.disabled && css(["&&&:active,&&&{background-color:
|
|
40
|
+
`, IconContainer, (props) => props.hasError && `
|
|
41
|
+
background-color: var(--ds-color-background-danger-subtle);
|
|
42
|
+
border-color: var(--ds-color-border-danger-default);
|
|
43
|
+
`, (props) => props.pressed && !props.disabled && css(["&&&:active,&&&{background-color:var(--ds-file-uploader-bg-pressed);}"]), DropAreaLabel, LargeDropAreaLabel, IconContainer, LargeDropAreaLabel, IconContainer, (props) => props.isDropping && !props.disabled && `
|
|
45
44
|
height: ${props.mode === "multi-large" ? "200px" : "80px"};
|
|
46
|
-
background-color:
|
|
47
|
-
border-color:
|
|
45
|
+
background-color: var(--ds-color-background-brand-subtle) !important;
|
|
46
|
+
border-color: var(--ds-color-border-brand-strong) !important;
|
|
48
47
|
|
|
49
48
|
span, ${DropAreaLabel}, ${LargeDropAreaLabel}, ${LargeDropAreaDescription} {
|
|
50
|
-
color:
|
|
49
|
+
color: var(--ds-color-text-brand-default) !important;
|
|
51
50
|
}
|
|
52
51
|
|
|
53
52
|
${IconContainer} {
|
|
54
|
-
color:
|
|
53
|
+
color: var(--ds-color-icon-brand-default) !important;
|
|
55
54
|
}
|
|
56
55
|
`);
|
|
57
56
|
const ErrorMessage = /* @__PURE__ */ styled(Text).withConfig({
|
|
58
57
|
displayName: "AvatarUploaderstyles__ErrorMessage",
|
|
59
58
|
componentId: "sc-1lljrgr-8"
|
|
60
|
-
})(["&&{margin:8px 0 0;display:block;color:
|
|
59
|
+
})(["&&{margin:8px 0 0;display:block;color:var(--ds-color-text-danger-default);}"]);
|
|
61
60
|
const Label = /* @__PURE__ */ styled(Label$1).withConfig({
|
|
62
61
|
displayName: "AvatarUploaderstyles__Label",
|
|
63
62
|
componentId: "sc-1lljrgr-9"
|
|
@@ -2,14 +2,15 @@ import styled, { keyframes } from "styled-components";
|
|
|
2
2
|
import { IconContainer } from "@synerise/ds-icon";
|
|
3
3
|
import { Loader } from "@synerise/ds-loader/dist/Loader.styles";
|
|
4
4
|
import { Label, Description } from "@synerise/ds-typography";
|
|
5
|
+
import { resolveCustomColor } from "@synerise/ds-utils";
|
|
5
6
|
const PreviewImage = /* @__PURE__ */ styled.div.withConfig({
|
|
6
7
|
displayName: "FileViewAvatarstyles__PreviewImage",
|
|
7
8
|
componentId: "sc-1jbyu2z-0"
|
|
8
|
-
})(["", "{color:
|
|
9
|
+
})(["", "{color:var(--ds-color-text-base-subtle);}"], IconContainer);
|
|
9
10
|
const RepeatIcon = /* @__PURE__ */ styled.div.withConfig({
|
|
10
11
|
displayName: "FileViewAvatarstyles__RepeatIcon",
|
|
11
12
|
componentId: "sc-1jbyu2z-1"
|
|
12
|
-
})(["", "{color:
|
|
13
|
+
})(["", "{color:var(--ds-color-icon-brand-default);}&:hover{cursor:pointer;}"], IconContainer);
|
|
13
14
|
const LoaderIcon = /* @__PURE__ */ styled.div.withConfig({
|
|
14
15
|
displayName: "FileViewAvatarstyles__LoaderIcon",
|
|
15
16
|
componentId: "sc-1jbyu2z-2"
|
|
@@ -18,15 +19,15 @@ const spinnerAnimation = /* @__PURE__ */ keyframes(["0%{transform:rotate(0deg);}
|
|
|
18
19
|
const SmallLoader = /* @__PURE__ */ styled(Loader).withConfig({
|
|
19
20
|
displayName: "FileViewAvatarstyles__SmallLoader",
|
|
20
21
|
componentId: "sc-1jbyu2z-3"
|
|
21
|
-
})(["border:1px solid ", ";border-top:2px solid transparent;border-radius:50%;animation:", " 2s linear infinite;"], (props) => props.
|
|
22
|
+
})(["border:1px solid ", ";border-top:2px solid transparent;border-radius:50%;animation:", " 2s linear infinite;"], (props) => resolveCustomColor(props.color, "var(--ds-color-icon-neutral-default)"), spinnerAnimation);
|
|
22
23
|
const PreviewThumbnail = /* @__PURE__ */ styled.img.withConfig({
|
|
23
24
|
displayName: "FileViewAvatarstyles__PreviewThumbnail",
|
|
24
25
|
componentId: "sc-1jbyu2z-4"
|
|
25
|
-
})(["width:24px;height:24px;border-radius:3px;object-fit:contain;background-color:
|
|
26
|
+
})(["width:24px;height:24px;border-radius:3px;object-fit:contain;background-color:var(--ds-color-background-base-mutedhover);"]);
|
|
26
27
|
const PlaceholderImage = /* @__PURE__ */ styled.div.withConfig({
|
|
27
28
|
displayName: "FileViewAvatarstyles__PlaceholderImage",
|
|
28
29
|
componentId: "sc-1jbyu2z-5"
|
|
29
|
-
})(["background-color:
|
|
30
|
+
})(["background-color:var(--ds-color-background-base-mutedhover);width:32px;height:32px;border-radius:3px;padding:4px;", "{color:var(--ds-color-icon-base-subtle);}"], IconContainer);
|
|
30
31
|
const FileAvatarContainer = /* @__PURE__ */ styled.div.withConfig({
|
|
31
32
|
displayName: "FileViewAvatarstyles__FileAvatarContainer",
|
|
32
33
|
componentId: "sc-1jbyu2z-6"
|
|
@@ -42,41 +43,41 @@ const Info = /* @__PURE__ */ styled.div.withConfig({
|
|
|
42
43
|
const DescriptionUploader = /* @__PURE__ */ styled(Description).withConfig({
|
|
43
44
|
displayName: "FileViewAvatarstyles__DescriptionUploader",
|
|
44
45
|
componentId: "sc-1jbyu2z-9"
|
|
45
|
-
})(["margin:16px 0 8px 0;color:
|
|
46
|
+
})(["margin:16px 0 8px 0;color:var(--ds-color-text-neutral-default);"]);
|
|
46
47
|
const Name = /* @__PURE__ */ styled(Label).withConfig({
|
|
47
48
|
displayName: "FileViewAvatarstyles__Name",
|
|
48
49
|
componentId: "sc-1jbyu2z-10"
|
|
49
|
-
})(["&&{color:
|
|
50
|
+
})(["&&{color:var(--ds-color-text-base-muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:260px;cursor:initial;}"]);
|
|
50
51
|
const RemoveButtonWrapper = /* @__PURE__ */ styled.div.withConfig({
|
|
51
52
|
displayName: "FileViewAvatarstyles__RemoveButtonWrapper",
|
|
52
53
|
componentId: "sc-1jbyu2z-11"
|
|
53
|
-
})(["display:", ";background-color:transparent;z-index:10;border:0;padding:0;margin:0 4px 0 0;height:16px;width:16px;position:absolute;top:8px;right:5px;cursor:pointer;overflow:", ";", "{position:absolute;right:-2px;top:-2px;
|
|
54
|
+
})(["display:", ";background-color:transparent;z-index:10;border:0;padding:0;margin:0 4px 0 0;height:16px;width:16px;position:absolute;top:8px;right:5px;cursor:pointer;overflow:", ";", "{position:absolute;right:-2px;top:-2px;color:var(--ds-color-icon-danger-default);}"], (props) => props.pressed ? "flex" : "none", (props) => props.pressed ? "visible" : "hidden", IconContainer);
|
|
54
55
|
const RemoveWrapper = /* @__PURE__ */ styled.div.withConfig({
|
|
55
56
|
displayName: "FileViewAvatarstyles__RemoveWrapper",
|
|
56
57
|
componentId: "sc-1jbyu2z-12"
|
|
57
|
-
})(["z-index:100;height:0;width:0;position:relative;bottom:10px;left:68px;cursor:pointer;overflow:hidden;", "{
|
|
58
|
+
})(["z-index:100;height:0;width:0;position:relative;bottom:10px;left:68px;cursor:pointer;overflow:hidden;", "{color:var(--ds-color-icon-danger-default);}"], IconContainer);
|
|
58
59
|
const AvatarContainer = /* @__PURE__ */ styled.div.withConfig({
|
|
59
60
|
displayName: "FileViewAvatarstyles__AvatarContainer",
|
|
60
61
|
componentId: "sc-1jbyu2z-13"
|
|
61
62
|
})(["background:url('", "') 50% 50% no-repeat;background-size:cover;min-width:80px;min-height:80px;width:80px;height:80px;border-radius:3px;overflow:visible;margin-right:14px;", ";&:hover{", "{display:flex;overflow:visible;}}"], (props) => props.source, (props) => props.disabled && `
|
|
62
|
-
background-color:
|
|
63
|
-
opacity:
|
|
63
|
+
background-color: var(--ds-color-background-base-muted);
|
|
64
|
+
opacity: var(--ds-opacity-disabled);
|
|
64
65
|
`, RemoveWrapper);
|
|
65
66
|
const FileView = /* @__PURE__ */ styled.button.withConfig({
|
|
66
67
|
displayName: "FileViewAvatarstyles__FileView",
|
|
67
68
|
componentId: "sc-1jbyu2z-14"
|
|
68
|
-
})(["background-color:
|
|
69
|
+
})(["background-color:var(--ds-color-background-base-muted);border-radius:3px;border:2px solid transparent;display:flex;align-items:center;padding:7px 12px 7px 6px;height:32px;text-align:left;line-height:initial;position:relative;margin:0 0 12px;&:last-of-type{margin:0;}&:hover{border-color:var(--ds-color-border-base-default);padding-right:", ";", "{color:var(--ds-color-text-brand-default);}", "{", "{color:var(--ds-color-icon-brand-default);}}", "}&:focus{border-color:var(--ds-color-border-brand-default);background-color:var(--ds-color-background-base-muted);}&:hover{background-color:var(--ds-color-background-base-mutedhover);}&:active{border-color:var(--ds-color-border-base-strong);background-color:var(--ds-color-background-base-mutedhover);", "{color:var(--ds-color-text-brand-default);}", "{", "{color:var(--ds-color-icon-brand-default);}}}", ";", ";", ";"], (props) => props.removable ? "30px" : "12px", Name, PreviewImage, IconContainer, (props) => props.removable && !props.disabled && `
|
|
69
70
|
${RemoveButtonWrapper} {
|
|
70
71
|
display: block;
|
|
71
72
|
}
|
|
72
|
-
`,
|
|
73
|
-
background-color:
|
|
74
|
-
opacity:
|
|
73
|
+
`, Name, PreviewImage, IconContainer, (props) => props.disabled && `
|
|
74
|
+
background-color: var(--ds-color-background-base-muted);
|
|
75
|
+
opacity: var(--ds-opacity-disabled);
|
|
75
76
|
`, (props) => props.error && `
|
|
76
77
|
&& {
|
|
77
78
|
padding-right: 7px;
|
|
78
|
-
border: 1px solid
|
|
79
|
-
background-color:
|
|
79
|
+
border: 1px solid var(--ds-color-border-danger-default);
|
|
80
|
+
background-color: var(--ds-color-background-base-subtle);
|
|
80
81
|
${Name} {
|
|
81
82
|
padding-right: 4px;
|
|
82
83
|
}
|
package/dist/FileUploader.js
CHANGED
|
@@ -2,7 +2,6 @@ import { jsxs, jsx, Fragment } from "react/jsx-runtime";
|
|
|
2
2
|
import { forwardRef, useState, useCallback, useImperativeHandle } from "react";
|
|
3
3
|
import { useDropzone } from "react-dropzone";
|
|
4
4
|
import { FormattedMessage } from "react-intl";
|
|
5
|
-
import { useTheme } from "@synerise/ds-core";
|
|
6
5
|
import Icon, { InfoFillS, FileUploadL, AddM } from "@synerise/ds-icon";
|
|
7
6
|
import Tooltip from "@synerise/ds-tooltip";
|
|
8
7
|
import { Container, Label, DropAreaContainer, DropAreaButton, LargeDropAreaLabel, LargeDropAreaDescription, DropAreaLabel, ErrorMessage, Description } from "./FileUploader.styles.js";
|
|
@@ -36,7 +35,6 @@ const FileUploader = forwardRef(({
|
|
|
36
35
|
...rest
|
|
37
36
|
}, ref) => {
|
|
38
37
|
const [uploadSuccess, setUploadSuccess] = useState(true);
|
|
39
|
-
const theme = useTheme();
|
|
40
38
|
const finalTexts = {
|
|
41
39
|
buttonLabel: /* @__PURE__ */ jsx(FormattedMessage, { id: "DS.FILE-UPLOADER.BUTTON-LABEL", defaultMessage: "Upload file" }),
|
|
42
40
|
buttonLabelLarge: /* @__PURE__ */ jsx(FormattedMessage, { id: "DS.FILE-UPLOADER.BUTTON-LABEL-LARGE", defaultMessage: "Upload file" }),
|
|
@@ -101,11 +99,11 @@ const FileUploader = forwardRef(({
|
|
|
101
99
|
/* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs(DropAreaContainer, { ...getRootProps(), canUploadMore: mode !== "single" && files.length > 0, children: [
|
|
102
100
|
/* @__PURE__ */ jsx("input", { ...getInputProps(), "data-testid": "droparea-input" }),
|
|
103
101
|
/* @__PURE__ */ jsx(DropAreaButton, { type: "button", hidden: !(mode !== "single" && (filesAmount ? files.length < filesAmount : true) || files.length === 0), mode, disabled, isDropping: isDragActive, hasError, onMouseDown: () => setPressed(true), onMouseUp: () => setPressed(false), pressed, "data-testid": "droparea", filesLength: files.length, children: mode === "multi-large" && files.length === 0 ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
104
|
-
/* @__PURE__ */ jsx(Icon, { color:
|
|
102
|
+
/* @__PURE__ */ jsx(Icon, { color: "var(--ds-color-text-base-default)", component: /* @__PURE__ */ jsx(FileUploadL, {}), size: 48 }),
|
|
105
103
|
/* @__PURE__ */ jsx(LargeDropAreaLabel, { children: finalTexts.buttonLabelLarge }),
|
|
106
104
|
/* @__PURE__ */ jsx(LargeDropAreaDescription, { children: finalTexts.buttonDescription })
|
|
107
105
|
] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
108
|
-
/* @__PURE__ */ jsx(Icon, { color:
|
|
106
|
+
/* @__PURE__ */ jsx(Icon, { color: "var(--ds-color-icon-base-default)", component: /* @__PURE__ */ jsx(AddM, {}), size: 24 }),
|
|
109
107
|
/* @__PURE__ */ jsx(DropAreaLabel, { children: finalTexts.buttonLabel })
|
|
110
108
|
] }) })
|
|
111
109
|
] }) }),
|
|
@@ -2,7 +2,6 @@ import styled, { css } from "styled-components";
|
|
|
2
2
|
import Button from "@synerise/ds-button";
|
|
3
3
|
import { IconContainer } from "@synerise/ds-icon";
|
|
4
4
|
import { Label as Label$1, Text } from "@synerise/ds-typography";
|
|
5
|
-
import { hexToRgba } from "@synerise/ds-utils";
|
|
6
5
|
const Container = /* @__PURE__ */ styled.div.withConfig({
|
|
7
6
|
displayName: "FileUploaderstyles__Container",
|
|
8
7
|
componentId: "sc-62r2x6-0"
|
|
@@ -10,7 +9,7 @@ const Container = /* @__PURE__ */ styled.div.withConfig({
|
|
|
10
9
|
const Description = /* @__PURE__ */ styled(Text).withConfig({
|
|
11
10
|
displayName: "FileUploaderstyles__Description",
|
|
12
11
|
componentId: "sc-62r2x6-1"
|
|
13
|
-
})(["&&{margin:", ";display:block;color:
|
|
12
|
+
})(["&&{margin:", ";display:block;color:var(--ds-color-text-neutral-default);}"], (props) => props.hasError ? "4px 0 8px" : "8px 0 8px");
|
|
14
13
|
const DropAreaContainer = /* @__PURE__ */ styled.div.withConfig({
|
|
15
14
|
displayName: "FileUploaderstyles__DropAreaContainer",
|
|
16
15
|
componentId: "sc-62r2x6-2"
|
|
@@ -18,49 +17,49 @@ const DropAreaContainer = /* @__PURE__ */ styled.div.withConfig({
|
|
|
18
17
|
const DropAreaLabel = /* @__PURE__ */ styled(Text).withConfig({
|
|
19
18
|
displayName: "FileUploaderstyles__DropAreaLabel",
|
|
20
19
|
componentId: "sc-62r2x6-3"
|
|
21
|
-
})(["&&{color:
|
|
20
|
+
})(["&&{color:var(--ds-color-text-base-muted);font-weight:500;}"]);
|
|
22
21
|
const LargeDropAreaLabel = /* @__PURE__ */ styled(Label$1).withConfig({
|
|
23
22
|
displayName: "FileUploaderstyles__LargeDropAreaLabel",
|
|
24
23
|
componentId: "sc-62r2x6-4"
|
|
25
|
-
})(["&&{font-size:14px;margin:4px 0 0;display:block;color:
|
|
24
|
+
})(["&&{font-size:14px;margin:4px 0 0;display:block;color:var(--ds-color-text-base-default);}"]);
|
|
26
25
|
const LargeDropAreaDescription = /* @__PURE__ */ styled(Text).withConfig({
|
|
27
26
|
displayName: "FileUploaderstyles__LargeDropAreaDescription",
|
|
28
27
|
componentId: "sc-62r2x6-5"
|
|
29
|
-
})(["&&{margin:4px 0 0;display:block;color:
|
|
28
|
+
})(["&&{margin:4px 0 0;display:block;color:var(--ds-color-text-base-muted);}"]);
|
|
30
29
|
const DropAreaButton = /* @__PURE__ */ styled.button.withConfig({
|
|
31
30
|
displayName: "FileUploaderstyles__DropAreaButton",
|
|
32
31
|
componentId: "sc-62r2x6-6"
|
|
33
|
-
})(["display:", ";align-items:center;border:1px dashed
|
|
32
|
+
})(["display:", ";align-items:center;border:1px dashed var(--ds-color-border-base-stronghover);padding:11px 12px;border-radius:3px;cursor:pointer;background-color:transparent;width:100%;height:48px;transition:height 0.03s;", ";", ";", "{color:var(--ds-color-text-base-subtle);}", " ", " &:hover:not(:disabled){background-color:var(--ds-file-uploader-bg-hover);border-color:var(--ds-color-border-base-stronghover);", ",", "{color:var(--ds-color-text-base-subtle);}", "{color:var(--ds-color-text-base-subtle);}}&:disabled{background-color:var(--ds-color-background-base-subtle);", "{color:var(--ds-color-text-base-disabled);}}&&:active{color:var(--ds-color-text-danger-default);border-color:var(--ds-color-border-base-stronghover);background-color:var(--ds-color-background-base-subtle);}&:focus:not(:active):not(:disabled){border-color:var(--ds-color-border-brand-default);background-color:var(--ds-color-background-brand-subtle);}&:disabled{span,", "{opacity:var(--ds-opacity-disabled);}}", ""], (props) => props.hidden ? "none" : "flex", (props) => props.mode === "multi-large" && props.filesLength === 0 && `
|
|
34
33
|
height: 160px;
|
|
35
34
|
flex-direction: column;
|
|
36
35
|
text-align: center;
|
|
37
36
|
justify-content: center;
|
|
38
37
|
`, (props) => props.mode !== "multi-large" && `
|
|
39
38
|
gap: 12px;
|
|
40
|
-
`, IconContainer, (props) => props.
|
|
41
|
-
background-color:
|
|
42
|
-
border-color:
|
|
43
|
-
`, (props) => props.pressed && !props.disabled && css(["&&&:active,&&&{background-color:
|
|
39
|
+
`, IconContainer, (props) => props.hasError && `
|
|
40
|
+
background-color: var(--ds-color-background-danger-subtle);
|
|
41
|
+
border-color: var(--ds-color-border-danger-default);
|
|
42
|
+
`, (props) => props.pressed && !props.disabled && css(["&&&:active,&&&{background-color:var(--ds-file-uploader-bg-pressed);}"]), DropAreaLabel, LargeDropAreaLabel, IconContainer, LargeDropAreaLabel, IconContainer, (props) => props.isDropping && !props.disabled && `
|
|
44
43
|
height: ${props.mode === "multi-large" && props.filesLength === 0 ? "160px" : "auto"};
|
|
45
|
-
background-color:
|
|
46
|
-
border-color:
|
|
44
|
+
background-color: var(--ds-color-background-brand-subtle) !important;
|
|
45
|
+
border-color: var(--ds-color-border-brand-strong) !important;
|
|
47
46
|
|
|
48
47
|
span, ${DropAreaLabel}, ${LargeDropAreaLabel}, ${LargeDropAreaDescription} {
|
|
49
|
-
color:
|
|
48
|
+
color: var(--ds-color-text-brand-default) !important;
|
|
50
49
|
}
|
|
51
50
|
|
|
52
51
|
${IconContainer} {
|
|
53
|
-
color:
|
|
52
|
+
color: var(--ds-color-icon-brand-default) !important;
|
|
54
53
|
}
|
|
55
54
|
`);
|
|
56
55
|
const ErrorMessage = /* @__PURE__ */ styled(Text).withConfig({
|
|
57
56
|
displayName: "FileUploaderstyles__ErrorMessage",
|
|
58
57
|
componentId: "sc-62r2x6-7"
|
|
59
|
-
})(["&&{margin:8px 0 0;display:block;color:
|
|
58
|
+
})(["&&{margin:8px 0 0;display:block;color:var(--ds-color-text-danger-default);}"]);
|
|
60
59
|
const Label = /* @__PURE__ */ styled(Label$1).withConfig({
|
|
61
60
|
displayName: "FileUploaderstyles__Label",
|
|
62
61
|
componentId: "sc-62r2x6-8"
|
|
63
|
-
})(["&&{cursor:initial;margin:0 0 8px;display:flex;align-items:center;", "{color:
|
|
62
|
+
})(["&&{cursor:initial;margin:0 0 8px;display:flex;align-items:center;", "{color:var(--ds-color-icon-base-muted);}}"], IconContainer);
|
|
64
63
|
const UploadButton = /* @__PURE__ */ styled(Button).withConfig({
|
|
65
64
|
displayName: "FileUploaderstyles__UploadButton",
|
|
66
65
|
componentId: "sc-62r2x6-9"
|
|
@@ -3,7 +3,6 @@ import filesize from "filesize.js";
|
|
|
3
3
|
import { useState } from "react";
|
|
4
4
|
import { FormattedMessage } from "react-intl";
|
|
5
5
|
import Button from "@synerise/ds-button";
|
|
6
|
-
import { useTheme } from "@synerise/ds-core";
|
|
7
6
|
import Icon, { FileM, Close3M, RepeatM, Check3M, WarningFillM } from "@synerise/ds-icon";
|
|
8
7
|
import Popconfirm from "@synerise/ds-popconfirm";
|
|
9
8
|
import ProgressBar from "@synerise/ds-progress-bar";
|
|
@@ -20,7 +19,6 @@ const FileView = ({
|
|
|
20
19
|
hideSize
|
|
21
20
|
}) => {
|
|
22
21
|
const getFriendlySize = (size) => filesize(size || 0);
|
|
23
|
-
const theme = useTheme();
|
|
24
22
|
const {
|
|
25
23
|
disabled,
|
|
26
24
|
error,
|
|
@@ -76,7 +74,7 @@ const FileView = ({
|
|
|
76
74
|
finalTexts.retryLabel
|
|
77
75
|
] }),
|
|
78
76
|
!error && !disabled && !hasProgress && /* @__PURE__ */ jsx(CheckButtonWrapper, { "data-testid": "fileview-check", children: /* @__PURE__ */ jsx(Icon, { component: /* @__PURE__ */ jsx(Check3M, {}), size: 20 }) }),
|
|
79
|
-
removable && !disabled && !error && !hasProgress && /* @__PURE__ */ jsx(Popconfirm, { onConfirm: handleRemove, onCancel: () => setPressed(false), icon: /* @__PURE__ */ jsx(Icon, { component: /* @__PURE__ */ jsx(WarningFillM, {}), color:
|
|
77
|
+
removable && !disabled && !error && !hasProgress && /* @__PURE__ */ jsx(Popconfirm, { onConfirm: handleRemove, onCancel: () => setPressed(false), icon: /* @__PURE__ */ jsx(Icon, { component: /* @__PURE__ */ jsx(WarningFillM, {}), color: "var(--ds-color-icon-warning-default)" }), cancelText: finalTexts.cancelText, okText: finalTexts.okText, okType: "primary", title: finalTexts.removeConfirmTitle, placement: "top", trigger: "click", children: /* @__PURE__ */ jsx(RemoveButtonWrapper, { onMouseDown: () => setPressed(true), pressed, "data-testid": "fileview-remove", children: /* @__PURE__ */ jsx(Tooltip, { title: finalTexts.removeTooltip, children: /* @__PURE__ */ jsx(Icon, { component: /* @__PURE__ */ jsx(Close3M, {}), size: 20 }) }) }) })
|
|
80
78
|
] });
|
|
81
79
|
};
|
|
82
80
|
export {
|
|
@@ -4,15 +4,15 @@ import { Label, Text } from "@synerise/ds-typography";
|
|
|
4
4
|
const PreviewImage = /* @__PURE__ */ styled.div.withConfig({
|
|
5
5
|
displayName: "FileViewstyles__PreviewImage",
|
|
6
6
|
componentId: "sc-wpdc66-0"
|
|
7
|
-
})(["", "{color:
|
|
7
|
+
})(["", "{color:var(--ds-color-text-base-subtle);}margin:-4px -8px -4px -4px;"], IconContainer);
|
|
8
8
|
const PlaceholderImage = /* @__PURE__ */ styled.div.withConfig({
|
|
9
9
|
displayName: "FileViewstyles__PlaceholderImage",
|
|
10
10
|
componentId: "sc-wpdc66-1"
|
|
11
|
-
})(["background-color:
|
|
11
|
+
})(["background-color:var(--ds-color-background-base-mutedhover);width:32px;height:32px;border-radius:3px;padding:4px;", "{color:var(--ds-color-icon-base-subtle);}"], IconContainer);
|
|
12
12
|
const PreviewThumbnail = /* @__PURE__ */ styled.img.withConfig({
|
|
13
13
|
displayName: "FileViewstyles__PreviewThumbnail",
|
|
14
14
|
componentId: "sc-wpdc66-2"
|
|
15
|
-
})(["width:40px;height:40px;margin:-4px -8px -4px -4px;border-radius:3px;object-fit:contain;background-color:
|
|
15
|
+
})(["width:40px;height:40px;margin:-4px -8px -4px -4px;border-radius:3px;object-fit:contain;background-color:var(--ds-color-background-base-mutedhover);"]);
|
|
16
16
|
const Info = /* @__PURE__ */ styled.div.withConfig({
|
|
17
17
|
displayName: "FileViewstyles__Info",
|
|
18
18
|
componentId: "sc-wpdc66-3"
|
|
@@ -20,7 +20,7 @@ const Info = /* @__PURE__ */ styled.div.withConfig({
|
|
|
20
20
|
const FileWeight = /* @__PURE__ */ styled.div.withConfig({
|
|
21
21
|
displayName: "FileViewstyles__FileWeight",
|
|
22
22
|
componentId: "sc-wpdc66-4"
|
|
23
|
-
})(["color:
|
|
23
|
+
})(["color:var(--ds-color-text-neutral-default);padding-right:30px;font-weight:normal;font-size:13px;"]);
|
|
24
24
|
const FileName = /* @__PURE__ */ styled.div.withConfig({
|
|
25
25
|
displayName: "FileViewstyles__FileName",
|
|
26
26
|
componentId: "sc-wpdc66-5"
|
|
@@ -28,7 +28,7 @@ const FileName = /* @__PURE__ */ styled.div.withConfig({
|
|
|
28
28
|
const Name = /* @__PURE__ */ styled(Label).withConfig({
|
|
29
29
|
displayName: "FileViewstyles__Name",
|
|
30
30
|
componentId: "sc-wpdc66-6"
|
|
31
|
-
})(["&&{color:
|
|
31
|
+
})(["&&{color:var(--ds-color-text-base-muted);max-width:100%;cursor:initial;white-space:nowrap;display:flex;justify-content:space-between;}"]);
|
|
32
32
|
const FlexRow = /* @__PURE__ */ styled.div.withConfig({
|
|
33
33
|
displayName: "FileViewstyles__FlexRow",
|
|
34
34
|
componentId: "sc-wpdc66-7"
|
|
@@ -36,23 +36,23 @@ const FlexRow = /* @__PURE__ */ styled.div.withConfig({
|
|
|
36
36
|
const SizeOrError = /* @__PURE__ */ styled(Text).withConfig({
|
|
37
37
|
displayName: "FileViewstyles__SizeOrError",
|
|
38
38
|
componentId: "sc-wpdc66-8"
|
|
39
|
-
})(["&&{color:
|
|
39
|
+
})(["&&{color:var(--ds-color-text-base-muted);}"]);
|
|
40
40
|
const RemoveWrapper = /* @__PURE__ */ styled.div.withConfig({
|
|
41
41
|
displayName: "FileViewstyles__RemoveWrapper",
|
|
42
42
|
componentId: "sc-wpdc66-9"
|
|
43
|
-
})(["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:
|
|
43
|
+
})(["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:var(--ds-color-icon-base-muted);&:hover{color:var(--ds-color-icon-danger-default);}}"], IconContainer);
|
|
44
44
|
const CheckButtonWrapper = /* @__PURE__ */ styled.div.withConfig({
|
|
45
45
|
displayName: "FileViewstyles__CheckButtonWrapper",
|
|
46
46
|
componentId: "sc-wpdc66-10"
|
|
47
|
-
})(["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;
|
|
47
|
+
})(["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;color:var(--ds-color-icon-success-default);}"], IconContainer);
|
|
48
48
|
const RemoveButtonWrapper = /* @__PURE__ */ styled.div.withConfig({
|
|
49
49
|
displayName: "FileViewstyles__RemoveButtonWrapper",
|
|
50
50
|
componentId: "sc-wpdc66-11"
|
|
51
|
-
})(["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;
|
|
51
|
+
})(["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;color:var(--ds-color-icon-danger-default);}"], (props) => props.pressed ? "flex" : "none", (props) => props.pressed ? "visible" : "hidden", IconContainer);
|
|
52
52
|
const FileViewContainer = /* @__PURE__ */ styled.button.withConfig({
|
|
53
53
|
displayName: "FileViewstyles__FileViewContainer",
|
|
54
54
|
componentId: "sc-wpdc66-12"
|
|
55
|
-
})(["background-color:
|
|
55
|
+
})(["background-color:var(--ds-color-background-base-default);border-radius:3px;border:1px solid var(--ds-color-border-base-default);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:var(--ds-color-border-base-strong);", "}&:hover{", "}&:focus{border-color:var(--ds-color-border-brand-default);background-color:var(--ds-color-background-base-subtle);", "}&:hover{background-color:var(--ds-color-background-base-subtle);}&:active{border-color:var(--ds-color-border-base-strong);background-color:var(--ds-color-background-base-muted);}", ";", ";"], (props) => props.removable && !props.disabled && `
|
|
56
56
|
${RemoveButtonWrapper} {
|
|
57
57
|
display: block;
|
|
58
58
|
}
|
|
@@ -60,19 +60,19 @@ const FileViewContainer = /* @__PURE__ */ styled.button.withConfig({
|
|
|
60
60
|
${CheckButtonWrapper} {
|
|
61
61
|
display: none;
|
|
62
62
|
}
|
|
63
|
-
`, (props) => props.
|
|
63
|
+
`, (props) => props.pressed && `
|
|
64
64
|
${CheckButtonWrapper} {
|
|
65
65
|
display: none;
|
|
66
66
|
}
|
|
67
|
-
`, (props) => props.
|
|
68
|
-
background-color:
|
|
69
|
-
opacity:
|
|
67
|
+
`, (props) => props.disabled && `
|
|
68
|
+
background-color: var(--ds-color-background-base-subtle);
|
|
69
|
+
opacity: var(--ds-opacity-disabled);
|
|
70
70
|
`, (props) => props.error && !props.progress && `
|
|
71
71
|
&& {
|
|
72
|
-
border: 1px solid
|
|
72
|
+
border: 1px solid var(--ds-color-border-danger-default);
|
|
73
73
|
|
|
74
74
|
${SizeOrError} {
|
|
75
|
-
color:
|
|
75
|
+
color: var(--ds-color-text-danger-default);
|
|
76
76
|
}
|
|
77
77
|
}
|
|
78
78
|
`);
|
|
@@ -16,51 +16,51 @@ const DropAreaContainer = /* @__PURE__ */ styled.div.withConfig({
|
|
|
16
16
|
const DropAreaLabel = /* @__PURE__ */ styled(Text).withConfig({
|
|
17
17
|
displayName: "ItemUploaderstyles__DropAreaLabel",
|
|
18
18
|
componentId: "sc-a5v1d2-3"
|
|
19
|
-
})(["color:
|
|
19
|
+
})(["color:var(--ds-color-text-base-subtle);font-weight:500;"]);
|
|
20
20
|
const LargeDropAreaLabel = /* @__PURE__ */ styled(Label$1).withConfig({
|
|
21
21
|
displayName: "ItemUploaderstyles__LargeDropAreaLabel",
|
|
22
22
|
componentId: "sc-a5v1d2-4"
|
|
23
|
-
})(["&&{font-size:14px;margin:4px 0 0;display:block;color:
|
|
23
|
+
})(["&&{font-size:14px;margin:4px 0 0;display:block;color:var(--ds-color-text-base-subtle);}"]);
|
|
24
24
|
const LargeDropAreaDescription = /* @__PURE__ */ styled(Text).withConfig({
|
|
25
25
|
displayName: "ItemUploaderstyles__LargeDropAreaDescription",
|
|
26
26
|
componentId: "sc-a5v1d2-5"
|
|
27
|
-
})(["&&{margin:4px 0 0;display:block;color:
|
|
27
|
+
})(["&&{margin:4px 0 0;display:block;color:var(--ds-color-text-base-subtle);}"]);
|
|
28
28
|
const DropAreaButton = /* @__PURE__ */ styled.button.withConfig({
|
|
29
29
|
displayName: "ItemUploaderstyles__DropAreaButton",
|
|
30
30
|
componentId: "sc-a5v1d2-6"
|
|
31
|
-
})(["align-items:center;border:1px dashed
|
|
31
|
+
})(["align-items:center;border:1px dashed var(--ds-color-border-base-strong);padding:11px 12px;border-radius:3px;cursor:pointer;background-color:transparent;width:80px;height:80px;transition:height 0.3s;", ";", "{color:var(--ds-color-text-base-default);}span{display:inline-block;margin:0 0 0 12px;}", " ", " &:hover:not(:disabled){background-color:var(--ds-color-background-base-subtle);border-color:var(--ds-color-border-base-stronghover);", ",", "{color:var(--ds-color-text-base-subtle);}", "{color:var(--ds-color-text-base-subtle);}}&:disabled{background-color:var(--ds-color-background-base-subtle);", "{color:var(--ds-color-text-base-disabled);}}&&:active{color:var(--ds-color-text-danger-default);border-color:var(--ds-color-border-base-stronghover);background-color:var(--ds-color-background-base-subtle);}&:focus:not(:active):not(:disabled){border-color:var(--ds-color-border-brand-default);background-color:var(--ds-color-background-brand-subtle);}&:disabled{span,", "{opacity:var(--ds-opacity-disabled);}}", ""], (props) => props.mode === "multi-large" && props.filesLength === 0 && `
|
|
32
32
|
height: 108px;
|
|
33
33
|
flex-direction: column;
|
|
34
34
|
text-align: center;
|
|
35
35
|
justify-content: center;
|
|
36
|
-
`, IconContainer, (props) => props.
|
|
37
|
-
background-color:
|
|
38
|
-
border-color:
|
|
39
|
-
`, (props) => props.pressed && !props.disabled && css(["&&&:active,&&&{background-color:
|
|
36
|
+
`, IconContainer, (props) => props.hasError && `
|
|
37
|
+
background-color: var(--ds-color-background-danger-subtle);
|
|
38
|
+
border-color: var(--ds-color-border-danger-default);
|
|
39
|
+
`, (props) => props.pressed && !props.disabled && css(["&&&:active,&&&{background-color:var(--ds-color-background-base-muted);}"]), DropAreaLabel, LargeDropAreaLabel, IconContainer, LargeDropAreaLabel, IconContainer, (props) => props.isDropping && !props.disabled && `
|
|
40
40
|
height: ${props.mode === "multi-large" ? "168px" : "auto"};
|
|
41
|
-
background-color:
|
|
42
|
-
border-color:
|
|
41
|
+
background-color: var(--ds-color-background-brand-subtle) !important;
|
|
42
|
+
border-color: var(--ds-color-border-brand-strong) !important;
|
|
43
43
|
|
|
44
44
|
span, ${DropAreaLabel}, ${LargeDropAreaLabel}, ${LargeDropAreaDescription} {
|
|
45
|
-
color:
|
|
45
|
+
color: var(--ds-color-text-brand-default) !important;
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
${IconContainer} {
|
|
49
|
-
color:
|
|
49
|
+
color: var(--ds-color-icon-brand-default) !important;
|
|
50
50
|
}
|
|
51
51
|
`);
|
|
52
52
|
const ErrorMessage = /* @__PURE__ */ styled(Text).withConfig({
|
|
53
53
|
displayName: "ItemUploaderstyles__ErrorMessage",
|
|
54
54
|
componentId: "sc-a5v1d2-7"
|
|
55
|
-
})(["&&{margin:8px 0 0;display:block;color:
|
|
55
|
+
})(["&&{margin:8px 0 0;display:block;color:var(--ds-color-text-danger-default);}"]);
|
|
56
56
|
const Description = /* @__PURE__ */ styled(Text).withConfig({
|
|
57
57
|
displayName: "ItemUploaderstyles__Description",
|
|
58
58
|
componentId: "sc-a5v1d2-8"
|
|
59
|
-
})(["&&{margin:", ";display:block;color:
|
|
59
|
+
})(["&&{margin:", ";display:block;color:var(--ds-color-text-neutral-default);}"], (props) => props.hasError ? "4px 0 8px" : "8px 0 8px");
|
|
60
60
|
const Label = /* @__PURE__ */ styled(Label$1).withConfig({
|
|
61
61
|
displayName: "ItemUploaderstyles__Label",
|
|
62
62
|
componentId: "sc-a5v1d2-9"
|
|
63
|
-
})(["&&{cursor:initial;margin:0 0 8px;display:flex;align-items:center;", "{color:
|
|
63
|
+
})(["&&{cursor:initial;margin:0 0 8px;display:flex;align-items:center;", "{color:var(--ds-color-icon-base-muted);}}"], IconContainer);
|
|
64
64
|
export {
|
|
65
65
|
Container,
|
|
66
66
|
Description,
|
|
@@ -2,14 +2,15 @@ import styled, { keyframes } from "styled-components";
|
|
|
2
2
|
import { IconContainer } from "@synerise/ds-icon";
|
|
3
3
|
import { Loader } from "@synerise/ds-loader/dist/Loader.styles";
|
|
4
4
|
import { Label } from "@synerise/ds-typography";
|
|
5
|
+
import { resolveCustomColor } from "@synerise/ds-utils";
|
|
5
6
|
const PreviewImage = /* @__PURE__ */ styled.div.withConfig({
|
|
6
7
|
displayName: "FileViewItemstyles__PreviewImage",
|
|
7
8
|
componentId: "sc-1rkoxpv-0"
|
|
8
|
-
})(["", "{display:flex;color:
|
|
9
|
+
})(["", "{display:flex;color:var(--ds-color-text-base-subtle);}"], IconContainer);
|
|
9
10
|
const RepeatIcon = /* @__PURE__ */ styled.div.withConfig({
|
|
10
11
|
displayName: "FileViewItemstyles__RepeatIcon",
|
|
11
12
|
componentId: "sc-1rkoxpv-1"
|
|
12
|
-
})(["", "{color:
|
|
13
|
+
})(["", "{color:var(--ds-color-icon-brand-default);}&:hover{cursor:pointer;}"], IconContainer);
|
|
13
14
|
const LoaderIcon = /* @__PURE__ */ styled.div.withConfig({
|
|
14
15
|
displayName: "FileViewItemstyles__LoaderIcon",
|
|
15
16
|
componentId: "sc-1rkoxpv-2"
|
|
@@ -18,15 +19,15 @@ const spinnerAnimation = /* @__PURE__ */ keyframes(["0%{transform:rotate(0deg);}
|
|
|
18
19
|
const SmallLoader = /* @__PURE__ */ styled(Loader).withConfig({
|
|
19
20
|
displayName: "FileViewItemstyles__SmallLoader",
|
|
20
21
|
componentId: "sc-1rkoxpv-3"
|
|
21
|
-
})(["border:1px solid ", ";border-top:2px solid transparent;border-radius:50%;animation:", " 2s linear infinite;"], (props) => props.
|
|
22
|
+
})(["border:1px solid ", ";border-top:2px solid transparent;border-radius:50%;animation:", " 2s linear infinite;"], (props) => resolveCustomColor(props.color, "var(--ds-color-icon-neutral-default)"), spinnerAnimation);
|
|
22
23
|
const PreviewThumbnail = /* @__PURE__ */ styled.img.withConfig({
|
|
23
24
|
displayName: "FileViewItemstyles__PreviewThumbnail",
|
|
24
25
|
componentId: "sc-1rkoxpv-4"
|
|
25
|
-
})(["width:20px;height:20px;border-radius:3px;object-fit:contain;background-color:
|
|
26
|
+
})(["width:20px;height:20px;border-radius:3px;object-fit:contain;background-color:var(--ds-color-background-base-mutedhover);"]);
|
|
26
27
|
const PlaceholderImage = /* @__PURE__ */ styled.div.withConfig({
|
|
27
28
|
displayName: "FileViewItemstyles__PlaceholderImage",
|
|
28
29
|
componentId: "sc-1rkoxpv-5"
|
|
29
|
-
})(["background-color:
|
|
30
|
+
})(["background-color:var(--ds-color-background-base-mutedhover);width:32px;height:32px;border-radius:3px;padding:4px;", "{color:var(--ds-color-icon-base-subtle);}"], IconContainer);
|
|
30
31
|
const FileViewContainer = /* @__PURE__ */ styled.div.withConfig({
|
|
31
32
|
displayName: "FileViewItemstyles__FileViewContainer",
|
|
32
33
|
componentId: "sc-1rkoxpv-6"
|
|
@@ -38,26 +39,26 @@ const Info = /* @__PURE__ */ styled.div.withConfig({
|
|
|
38
39
|
const Name = /* @__PURE__ */ styled(Label).withConfig({
|
|
39
40
|
displayName: "FileViewItemstyles__Name",
|
|
40
41
|
componentId: "sc-1rkoxpv-8"
|
|
41
|
-
})(["&&{color:
|
|
42
|
+
})(["&&{color:var(--ds-color-text-base-muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:260px;cursor:initial;}"]);
|
|
42
43
|
const RemoveButtonWrapper = /* @__PURE__ */ styled.div.withConfig({
|
|
43
44
|
displayName: "FileViewItemstyles__RemoveButtonWrapper",
|
|
44
45
|
componentId: "sc-1rkoxpv-9"
|
|
45
|
-
})(["display:", ";background-color:transparent;z-index:10;border:0;padding:0;margin:0 4px 0 0;height:16px;width:16px;position:absolute;top:8px;right:5px;cursor:pointer;overflow:", ";", "{position:absolute;right:-2px;top:-2px;
|
|
46
|
+
})(["display:", ";background-color:transparent;z-index:10;border:0;padding:0;margin:0 4px 0 0;height:16px;width:16px;position:absolute;top:8px;right:5px;cursor:pointer;overflow:", ";", "{position:absolute;right:-2px;top:-2px;color:var(--ds-color-icon-danger-default);}"], (props) => props.pressed ? "flex" : "none", (props) => props.pressed ? "visible" : "hidden", IconContainer);
|
|
46
47
|
const FileView = /* @__PURE__ */ styled.button.withConfig({
|
|
47
48
|
displayName: "FileViewItemstyles__FileView",
|
|
48
49
|
componentId: "sc-1rkoxpv-10"
|
|
49
|
-
})(["background-color:
|
|
50
|
+
})(["background-color:var(--ds-color-background-base-muted);border-radius:3px;border:2px solid transparent;display:flex;align-items:center;padding:7px 12px 7px 6px;height:32px;text-align:left;line-height:initial;position:relative;margin:0 0 12px;&:last-of-type{margin:0;}&:hover{border-color:var(--ds-color-border-base-default);padding-right:", ";", "{color:var(--ds-color-text-brand-default);}", "{", "{color:var(--ds-color-icon-brand-default);}}", "}&:focus{border-color:var(--ds-color-border-brand-default);background-color:var(--ds-color-background-base-muted);}&:hover{background-color:var(--ds-color-background-base-mutedhover);}&:active{border-color:var(--ds-color-border-base-strong);background-color:var(--ds-color-background-base-mutedhover);", "{color:var(--ds-color-text-brand-default);}", "{", "{color:var(--ds-color-icon-brand-default);}}}", ";", ";", ";"], (props) => props.removable ? "30px" : "12px", Name, PreviewImage, IconContainer, (props) => props.removable && !props.disabled && `
|
|
50
51
|
${RemoveButtonWrapper} {
|
|
51
52
|
display: block;
|
|
52
53
|
}
|
|
53
|
-
`,
|
|
54
|
-
background-color:
|
|
55
|
-
opacity:
|
|
54
|
+
`, Name, PreviewImage, IconContainer, (props) => props.disabled && `
|
|
55
|
+
background-color: var(--ds-color-background-base-muted);
|
|
56
|
+
opacity: var(--ds-opacity-disabled);
|
|
56
57
|
`, (props) => props.error && `
|
|
57
58
|
&& {
|
|
58
59
|
padding-right: 7px;
|
|
59
|
-
border: 1px solid
|
|
60
|
-
background-color:
|
|
60
|
+
border: 1px solid var(--ds-color-border-danger-default);
|
|
61
|
+
background-color: var(--ds-color-background-base-subtle);
|
|
61
62
|
${Name} {
|
|
62
63
|
padding-right: 4px;
|
|
63
64
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@synerise/ds-file-uploader",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.2.0",
|
|
4
4
|
"description": "FileUploader UI Component for the Synerise Design System",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"repository": "Synerise/synerise-design",
|
|
@@ -42,14 +42,14 @@
|
|
|
42
42
|
],
|
|
43
43
|
"types": "dist/index.d.ts",
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@synerise/ds-button": "^2.
|
|
46
|
-
"@synerise/ds-icon": "^2.
|
|
47
|
-
"@synerise/ds-loader": "^2.0
|
|
48
|
-
"@synerise/ds-popconfirm": "^2.0
|
|
49
|
-
"@synerise/ds-progress-bar": "^2.0
|
|
50
|
-
"@synerise/ds-tooltip": "^2.0
|
|
51
|
-
"@synerise/ds-typography": "^2.0
|
|
52
|
-
"@synerise/ds-utils": "^2.
|
|
45
|
+
"@synerise/ds-button": "^2.2.0",
|
|
46
|
+
"@synerise/ds-icon": "^2.3.0",
|
|
47
|
+
"@synerise/ds-loader": "^2.1.0",
|
|
48
|
+
"@synerise/ds-popconfirm": "^2.1.0",
|
|
49
|
+
"@synerise/ds-progress-bar": "^2.1.0",
|
|
50
|
+
"@synerise/ds-tooltip": "^2.1.0",
|
|
51
|
+
"@synerise/ds-typography": "^2.1.0",
|
|
52
|
+
"@synerise/ds-utils": "^2.3.0",
|
|
53
53
|
"filesize.js": "^2.0.0",
|
|
54
54
|
"react-dropzone": "^10.2.1"
|
|
55
55
|
},
|
|
@@ -62,5 +62,5 @@
|
|
|
62
62
|
"react-intl": ">=3.12.0 <= 6.8",
|
|
63
63
|
"styled-components": "^5.3.3"
|
|
64
64
|
},
|
|
65
|
-
"gitHead": "
|
|
65
|
+
"gitHead": "5c3d61e30289486d14c7d6becb682e2d4a08ce41"
|
|
66
66
|
}
|