react-dropzone 16.0.0 → 17.0.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/README.md +127 -112
- package/dist/index.cjs +43 -435
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +117 -0
- package/dist/index.d.ts +117 -0
- package/dist/index.js +46 -436
- package/dist/index.js.map +1 -1
- package/package.json +33 -35
- package/src/index.tsx +774 -0
- package/src/utils/index.ts +305 -0
- package/src/index.jsx +0 -1103
- package/src/utils/index.js +0 -362
- package/typings/react-dropzone.d.ts +0 -102
- package/typings/tests/accept.tsx +0 -54
- package/typings/tests/all.tsx +0 -46
- package/typings/tests/basic.tsx +0 -53
- package/typings/tests/events.tsx +0 -31
- package/typings/tests/file-dialog.tsx +0 -20
- package/typings/tests/hook.tsx +0 -15
- package/typings/tests/plugin.tsx +0 -87
- package/typings/tests/refs.tsx +0 -18
- package/typings/tests/tsconfig.json +0 -23
package/typings/tests/plugin.tsx
DELETED
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
import React, { Component } from "react";
|
|
2
|
-
import Dropzone from "../../";
|
|
3
|
-
|
|
4
|
-
export class TestReactDragEvt extends Component {
|
|
5
|
-
getFiles = async (event: React.DragEvent<HTMLDivElement>) => {
|
|
6
|
-
const files = Array.from(event.dataTransfer.files);
|
|
7
|
-
return files;
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
render() {
|
|
11
|
-
return (
|
|
12
|
-
<div>
|
|
13
|
-
<Dropzone getFilesFromEvent={this.getFiles}>
|
|
14
|
-
{({ getRootProps }) => <div {...getRootProps()} />}
|
|
15
|
-
</Dropzone>
|
|
16
|
-
</div>
|
|
17
|
-
);
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export class TestDataTransferItems extends Component {
|
|
22
|
-
getFiles = async (event: React.DragEvent<HTMLDivElement>) => {
|
|
23
|
-
const items = Array.from(event.dataTransfer.items);
|
|
24
|
-
return items;
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
render() {
|
|
28
|
-
return (
|
|
29
|
-
<div>
|
|
30
|
-
<Dropzone getFilesFromEvent={this.getFiles}>
|
|
31
|
-
{({ getRootProps }) => <div {...getRootProps()} />}
|
|
32
|
-
</Dropzone>
|
|
33
|
-
</div>
|
|
34
|
-
);
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
export class TestNativeDragEventEvt extends Component {
|
|
39
|
-
getFiles = async (event: DragEvent) => {
|
|
40
|
-
const files = Array.from(event.dataTransfer.files);
|
|
41
|
-
return files;
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
render() {
|
|
45
|
-
return (
|
|
46
|
-
<div>
|
|
47
|
-
<Dropzone getFilesFromEvent={this.getFiles}>
|
|
48
|
-
{({ getRootProps }) => <div {...getRootProps()} />}
|
|
49
|
-
</Dropzone>
|
|
50
|
-
</div>
|
|
51
|
-
);
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
export class TestChangeEvt extends Component {
|
|
56
|
-
getFiles = async (event: React.ChangeEvent<HTMLInputElement>) => {
|
|
57
|
-
const files = Array.from(event.target.files);
|
|
58
|
-
return files;
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
render() {
|
|
62
|
-
return (
|
|
63
|
-
<div>
|
|
64
|
-
<Dropzone getFilesFromEvent={this.getFiles}>
|
|
65
|
-
{({ getRootProps }) => <div {...getRootProps()} />}
|
|
66
|
-
</Dropzone>
|
|
67
|
-
</div>
|
|
68
|
-
);
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
export class TestNativeEvt extends Component {
|
|
73
|
-
getFiles = async (event: Event) => {
|
|
74
|
-
const files = Array.from((event.target as HTMLInputElement).files);
|
|
75
|
-
return files;
|
|
76
|
-
};
|
|
77
|
-
|
|
78
|
-
render() {
|
|
79
|
-
return (
|
|
80
|
-
<div>
|
|
81
|
-
<Dropzone getFilesFromEvent={this.getFiles}>
|
|
82
|
-
{({ getRootProps }) => <div {...getRootProps()} />}
|
|
83
|
-
</Dropzone>
|
|
84
|
-
</div>
|
|
85
|
-
);
|
|
86
|
-
}
|
|
87
|
-
}
|
package/typings/tests/refs.tsx
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import React, { createRef } from "react";
|
|
2
|
-
import Dropzone, { DropzoneRef } from "../../";
|
|
3
|
-
|
|
4
|
-
const ref = createRef<DropzoneRef>();
|
|
5
|
-
|
|
6
|
-
export const dropzone = (
|
|
7
|
-
<Dropzone ref={ref}>
|
|
8
|
-
{({ getRootProps, getInputProps }) => (
|
|
9
|
-
<div {...getRootProps()}>
|
|
10
|
-
<input {...getInputProps()} />
|
|
11
|
-
<p>Drop some files here.</p>
|
|
12
|
-
<button type="button" onClick={ref.current.open}>
|
|
13
|
-
Open file dialog
|
|
14
|
-
</button>
|
|
15
|
-
</div>
|
|
16
|
-
)}
|
|
17
|
-
</Dropzone>
|
|
18
|
-
);
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"allowSyntheticDefaultImports": true,
|
|
4
|
-
"esModuleInterop": true,
|
|
5
|
-
"noEmit": true,
|
|
6
|
-
"strict": false,
|
|
7
|
-
"strictNullChecks": false,
|
|
8
|
-
"strictFunctionTypes": false,
|
|
9
|
-
"jsx": "react",
|
|
10
|
-
"moduleResolution": "bundler",
|
|
11
|
-
"module": "preserve",
|
|
12
|
-
"target": "es2020",
|
|
13
|
-
"lib": [
|
|
14
|
-
"es2020",
|
|
15
|
-
"dom",
|
|
16
|
-
"dom.iterable"
|
|
17
|
-
],
|
|
18
|
-
"skipLibCheck": true
|
|
19
|
-
},
|
|
20
|
-
"include": [
|
|
21
|
-
"./*.tsx"
|
|
22
|
-
]
|
|
23
|
-
}
|