react-dropzone 11.5.0 → 11.5.1
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.
|
@@ -22,7 +22,7 @@ const baseStyle = {
|
|
|
22
22
|
transition: 'border .24s ease-in-out'
|
|
23
23
|
};
|
|
24
24
|
|
|
25
|
-
const
|
|
25
|
+
const focusedStyle = {
|
|
26
26
|
borderColor: '#2196f3'
|
|
27
27
|
};
|
|
28
28
|
|
|
@@ -38,20 +38,20 @@ function StyledDropzone(props) {
|
|
|
38
38
|
const {
|
|
39
39
|
getRootProps,
|
|
40
40
|
getInputProps,
|
|
41
|
-
|
|
41
|
+
isFocused,
|
|
42
42
|
isDragAccept,
|
|
43
43
|
isDragReject
|
|
44
44
|
} = useDropzone({accept: 'image/*'});
|
|
45
45
|
|
|
46
46
|
const style = useMemo(() => ({
|
|
47
47
|
...baseStyle,
|
|
48
|
-
...(
|
|
48
|
+
...(isFocused ? focusedStyle : {}),
|
|
49
49
|
...(isDragAccept ? acceptStyle : {}),
|
|
50
50
|
...(isDragReject ? rejectStyle : {})
|
|
51
51
|
}), [
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
52
|
+
isFocused,
|
|
53
|
+
isDragAccept,
|
|
54
|
+
isDragReject
|
|
55
55
|
]);
|
|
56
56
|
|
|
57
57
|
return (
|
|
@@ -81,7 +81,7 @@ const getColor = (props) => {
|
|
|
81
81
|
if (props.isDragReject) {
|
|
82
82
|
return '#ff1744';
|
|
83
83
|
}
|
|
84
|
-
if (props.
|
|
84
|
+
if (props.isFocused) {
|
|
85
85
|
return '#2196f3';
|
|
86
86
|
}
|
|
87
87
|
return '#eeeeee';
|
|
@@ -107,14 +107,14 @@ function StyledDropzone(props) {
|
|
|
107
107
|
const {
|
|
108
108
|
getRootProps,
|
|
109
109
|
getInputProps,
|
|
110
|
-
|
|
110
|
+
isFocused,
|
|
111
111
|
isDragAccept,
|
|
112
112
|
isDragReject
|
|
113
113
|
} = useDropzone({accept: 'image/*'});
|
|
114
114
|
|
|
115
115
|
return (
|
|
116
116
|
<div className="container">
|
|
117
|
-
<Container {...getRootProps({
|
|
117
|
+
<Container {...getRootProps({isFocused, isDragAccept, isDragReject})}>
|
|
118
118
|
<input {...getInputProps()} />
|
|
119
119
|
<p>Drag 'n' drop some files here, or click to select files</p>
|
|
120
120
|
</Container>
|
package/package.json
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
"description": "Simple HTML5 drag-drop zone with React.js",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"module": "dist/es/index.js",
|
|
6
|
+
"sideEffects": false,
|
|
6
7
|
"scripts": {
|
|
7
8
|
"ci": "git-cz",
|
|
8
9
|
"clean": "rimraf ./dist",
|
|
@@ -166,7 +167,7 @@
|
|
|
166
167
|
"path": "@commitlint/prompt"
|
|
167
168
|
}
|
|
168
169
|
},
|
|
169
|
-
"version": "11.5.
|
|
170
|
+
"version": "11.5.1",
|
|
170
171
|
"engines": {
|
|
171
172
|
"node": ">= 10"
|
|
172
173
|
},
|