react-dropzone 14.2.9 → 14.3.8
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 +16 -0
- package/dist/es/index.js +17 -6
- package/dist/es/package.json +1 -0
- package/dist/es/utils/index.js +23 -9
- package/dist/index.js +2 -2
- package/package.json +16 -10
- package/src/__snapshots__/index.spec.js.snap +1 -1
- package/src/index.js +18 -5
- package/src/index.spec.js +11 -2
- package/src/utils/index.js +22 -10
- package/src/utils/index.spec.js +47 -8
- package/typings/react-dropzone.d.ts +4 -3
- package/CONTRIBUTING.md +0 -135
package/package.json
CHANGED
|
@@ -5,9 +5,14 @@
|
|
|
5
5
|
"module": "dist/es/index.js",
|
|
6
6
|
"exports": {
|
|
7
7
|
".": {
|
|
8
|
-
"import":
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
"import": {
|
|
9
|
+
"types": "./typings/react-dropzone.d.ts",
|
|
10
|
+
"default": "./dist/es/index.js"
|
|
11
|
+
},
|
|
12
|
+
"require": {
|
|
13
|
+
"types": "./typings/react-dropzone.d.ts",
|
|
14
|
+
"default": "./dist/index.js"
|
|
15
|
+
}
|
|
11
16
|
}
|
|
12
17
|
},
|
|
13
18
|
"typesVersions": {
|
|
@@ -21,9 +26,10 @@
|
|
|
21
26
|
"scripts": {
|
|
22
27
|
"cz": "git-cz",
|
|
23
28
|
"clean": "rimraf ./dist",
|
|
24
|
-
"build": "yarn clean && yarn build:umd && yarn build:es",
|
|
29
|
+
"build": "yarn clean && yarn build:umd && yarn build:es && yarn build:es-package",
|
|
25
30
|
"build:umd": "cross-env NODE_ENV=es rollup -c",
|
|
26
31
|
"build:es": "cross-env BABEL_ENV=es babel ./src --out-dir ./dist/es --ignore '**/*.spec.js'",
|
|
32
|
+
"build:es-package": "echo '{\"type\":\"module\"}' > dist/es/package.json",
|
|
27
33
|
"start": "styleguidist server",
|
|
28
34
|
"styleguide": "styleguidist build",
|
|
29
35
|
"test": "cross-env NODE_ENV=test yarn lint && jest --coverage && yarn typescript",
|
|
@@ -44,11 +50,11 @@
|
|
|
44
50
|
"size-limit": [
|
|
45
51
|
{
|
|
46
52
|
"path": "dist/index.js",
|
|
47
|
-
"limit": "
|
|
53
|
+
"limit": "17 KB"
|
|
48
54
|
},
|
|
49
55
|
{
|
|
50
56
|
"path": "dist/es/index.js",
|
|
51
|
-
"limit": "
|
|
57
|
+
"limit": "17 KB"
|
|
52
58
|
}
|
|
53
59
|
],
|
|
54
60
|
"lint-staged": {
|
|
@@ -112,8 +118,8 @@
|
|
|
112
118
|
"react": ">= 16.8 || 18.0.0"
|
|
113
119
|
},
|
|
114
120
|
"dependencies": {
|
|
115
|
-
"attr-accept": "^2.2.
|
|
116
|
-
"file-selector": "^
|
|
121
|
+
"attr-accept": "^2.2.4",
|
|
122
|
+
"file-selector": "^2.1.0",
|
|
117
123
|
"prop-types": "^15.8.1"
|
|
118
124
|
},
|
|
119
125
|
"devDependencies": {
|
|
@@ -180,12 +186,12 @@
|
|
|
180
186
|
"size-limit": "^7.0.5",
|
|
181
187
|
"style-loader": "^3.3.1",
|
|
182
188
|
"styled-components": "^5.3.3",
|
|
183
|
-
"typescript": "^
|
|
189
|
+
"typescript": "^5.6.3",
|
|
184
190
|
"webpack": "^5.67.0",
|
|
185
191
|
"webpack-blocks": "^2.1.0"
|
|
186
192
|
},
|
|
187
193
|
"typings": "typings/react-dropzone.d.ts",
|
|
188
|
-
"version": "14.
|
|
194
|
+
"version": "14.3.8",
|
|
189
195
|
"engines": {
|
|
190
196
|
"node": ">= 10.13"
|
|
191
197
|
},
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
|
-
exports[`useDropzone() hook behavior renders the root and input nodes with the necessary props 1`] = `"<div role=\\"presentation\\" tabindex=\\"0\\"><input multiple=\\"\\" type=\\"file\\" style=\\"
|
|
3
|
+
exports[`useDropzone() hook behavior renders the root and input nodes with the necessary props 1`] = `"<div role=\\"presentation\\" tabindex=\\"0\\"><input multiple=\\"\\" type=\\"file\\" style=\\"border: 0px; clip: rect(0px, 0px, 0px, 0px); clip-path: inset(50%); height: 1px; margin: 0px -1px -1px 0px; overflow: hidden; padding: 0px; position: absolute; width: 1px; white-space: nowrap;\\" tabindex=\\"-1\\"></div>"`;
|
package/src/index.js
CHANGED
|
@@ -26,7 +26,7 @@ import {
|
|
|
26
26
|
onDocumentDragOver,
|
|
27
27
|
pickerOptionsFromAccept,
|
|
28
28
|
TOO_MANY_FILES_REJECTION,
|
|
29
|
-
} from "./utils/index";
|
|
29
|
+
} from "./utils/index.js";
|
|
30
30
|
|
|
31
31
|
/**
|
|
32
32
|
* Convenience wrapper component for the `useDropzone` hook
|
|
@@ -154,7 +154,7 @@ Dropzone.propTypes = {
|
|
|
154
154
|
/**
|
|
155
155
|
* Use this to provide a custom file aggregator
|
|
156
156
|
*
|
|
157
|
-
* @param {(DragEvent|Event)} event A drag event or input change event (if files were selected via the file dialog)
|
|
157
|
+
* @param {(DragEvent|Event|Array<FileSystemFileHandle>)} event A drag event or input change event (if files were selected via the file dialog)
|
|
158
158
|
*/
|
|
159
159
|
getFilesFromEvent: PropTypes.func,
|
|
160
160
|
|
|
@@ -310,7 +310,7 @@ export default Dropzone;
|
|
|
310
310
|
* in a asynchronous fashion, from drag or input change events.
|
|
311
311
|
*
|
|
312
312
|
* @callback getFilesFromEvent
|
|
313
|
-
* @param {(DragEvent|Event)} event A drag event or input change event (if files were selected via the file dialog)
|
|
313
|
+
* @param {(DragEvent|Event|Array<FileSystemFileHandle>)} event A drag event or input change event (if files were selected via the file dialog)
|
|
314
314
|
* @returns {(File[]|Promise<File[]>)}
|
|
315
315
|
*/
|
|
316
316
|
|
|
@@ -703,6 +703,7 @@ export function useDropzone(props = {}) {
|
|
|
703
703
|
dispatch({
|
|
704
704
|
acceptedFiles,
|
|
705
705
|
fileRejections,
|
|
706
|
+
isDragReject: fileRejections.length > 0,
|
|
706
707
|
type: "setFiles",
|
|
707
708
|
});
|
|
708
709
|
|
|
@@ -946,7 +947,18 @@ export function useDropzone(props = {}) {
|
|
|
946
947
|
accept: acceptAttr,
|
|
947
948
|
multiple,
|
|
948
949
|
type: "file",
|
|
949
|
-
style: {
|
|
950
|
+
style: {
|
|
951
|
+
border: 0,
|
|
952
|
+
clip: "rect(0, 0, 0, 0)",
|
|
953
|
+
clipPath: "inset(50%)",
|
|
954
|
+
height: "1px",
|
|
955
|
+
margin: "0 -1px -1px 0",
|
|
956
|
+
overflow: "hidden",
|
|
957
|
+
padding: 0,
|
|
958
|
+
position: "absolute",
|
|
959
|
+
width: "1px",
|
|
960
|
+
whiteSpace: "nowrap",
|
|
961
|
+
},
|
|
950
962
|
onChange: composeHandler(composeEventHandlers(onChange, onDropCb)),
|
|
951
963
|
onClick: composeHandler(
|
|
952
964
|
composeEventHandlers(onClick, onInputElementClick)
|
|
@@ -1014,6 +1026,7 @@ function reducer(state, action) {
|
|
|
1014
1026
|
...state,
|
|
1015
1027
|
acceptedFiles: action.acceptedFiles,
|
|
1016
1028
|
fileRejections: action.fileRejections,
|
|
1029
|
+
isDragReject: action.isDragReject,
|
|
1017
1030
|
};
|
|
1018
1031
|
case "reset":
|
|
1019
1032
|
return {
|
|
@@ -1026,4 +1039,4 @@ function reducer(state, action) {
|
|
|
1026
1039
|
|
|
1027
1040
|
function noop() {}
|
|
1028
1041
|
|
|
1029
|
-
export { ErrorCode } from "./utils";
|
|
1042
|
+
export { ErrorCode } from "./utils/index.js";
|
package/src/index.spec.js
CHANGED
|
@@ -2510,7 +2510,7 @@ describe("useDropzone() hook", () => {
|
|
|
2510
2510
|
expect(onDropSpy).toHaveBeenCalledWith(files, [], expect.anything());
|
|
2511
2511
|
});
|
|
2512
2512
|
|
|
2513
|
-
it("sets {acceptedFiles, fileRejections}", async () => {
|
|
2513
|
+
it("sets {acceptedFiles, fileRejections, isDragReject}", async () => {
|
|
2514
2514
|
const FileList = ({ files = [] }) => (
|
|
2515
2515
|
<ul>
|
|
2516
2516
|
{files.map((file) => (
|
|
@@ -2558,11 +2558,18 @@ describe("useDropzone() hook", () => {
|
|
|
2558
2558
|
"image/*": [],
|
|
2559
2559
|
}}
|
|
2560
2560
|
>
|
|
2561
|
-
{({
|
|
2561
|
+
{({
|
|
2562
|
+
getRootProps,
|
|
2563
|
+
getInputProps,
|
|
2564
|
+
acceptedFiles,
|
|
2565
|
+
fileRejections,
|
|
2566
|
+
isDragReject,
|
|
2567
|
+
}) => (
|
|
2562
2568
|
<div {...getRootProps()}>
|
|
2563
2569
|
<input {...getInputProps()} />
|
|
2564
2570
|
<FileList files={acceptedFiles} />
|
|
2565
2571
|
<RejectedFileList fileRejections={fileRejections} />
|
|
2572
|
+
{isDragReject && "dragReject"}
|
|
2566
2573
|
</div>
|
|
2567
2574
|
)}
|
|
2568
2575
|
</Dropzone>
|
|
@@ -2574,6 +2581,7 @@ describe("useDropzone() hook", () => {
|
|
|
2574
2581
|
const acceptedFileList = getAcceptedFiles(dropzone);
|
|
2575
2582
|
expect(acceptedFileList).toHaveLength(images.length);
|
|
2576
2583
|
expect(matchToFiles(acceptedFileList, images)).toBe(true);
|
|
2584
|
+
expect(dropzone).not.toHaveTextContent("dragReject");
|
|
2577
2585
|
|
|
2578
2586
|
await act(() => fireEvent.drop(dropzone, createDtWithFiles(files)));
|
|
2579
2587
|
|
|
@@ -2585,6 +2593,7 @@ describe("useDropzone() hook", () => {
|
|
|
2585
2593
|
expect(matchToErrorCode(rejectedFileErrorList, "file-invalid-type")).toBe(
|
|
2586
2594
|
true
|
|
2587
2595
|
);
|
|
2596
|
+
expect(dropzone).toHaveTextContent("dragReject");
|
|
2588
2597
|
});
|
|
2589
2598
|
|
|
2590
2599
|
it("resets {isDragActive, isDragAccept, isDragReject}", async () => {
|
package/src/utils/index.js
CHANGED
|
@@ -15,15 +15,18 @@ export const ErrorCode = {
|
|
|
15
15
|
TooManyFiles: TOO_MANY_FILES,
|
|
16
16
|
};
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
18
|
+
/**
|
|
19
|
+
*
|
|
20
|
+
* @param {string} accept
|
|
21
|
+
*/
|
|
22
|
+
export const getInvalidTypeRejectionErr = (accept = "") => {
|
|
23
|
+
const acceptArr = accept.split(",");
|
|
24
|
+
const msg =
|
|
25
|
+
acceptArr.length > 1 ? `one of ${acceptArr.join(", ")}` : acceptArr[0];
|
|
26
|
+
|
|
24
27
|
return {
|
|
25
28
|
code: FILE_INVALID_TYPE,
|
|
26
|
-
message: `File type must be ${
|
|
29
|
+
message: `File type must be ${msg}`,
|
|
27
30
|
};
|
|
28
31
|
};
|
|
29
32
|
|
|
@@ -50,8 +53,16 @@ export const TOO_MANY_FILES_REJECTION = {
|
|
|
50
53
|
message: "Too many files",
|
|
51
54
|
};
|
|
52
55
|
|
|
53
|
-
|
|
54
|
-
|
|
56
|
+
/**
|
|
57
|
+
* Check if file is accepted.
|
|
58
|
+
*
|
|
59
|
+
* Firefox versions prior to 53 return a bogus MIME type for every file drag,
|
|
60
|
+
* so dragovers with that MIME type will always be accepted.
|
|
61
|
+
*
|
|
62
|
+
* @param {File} file
|
|
63
|
+
* @param {string} accept
|
|
64
|
+
* @returns
|
|
65
|
+
*/
|
|
55
66
|
export function fileAccepted(file, accept) {
|
|
56
67
|
const isAcceptable =
|
|
57
68
|
file.type === "application/x-moz-file" || accepts(file, accept);
|
|
@@ -82,7 +93,7 @@ function isDefined(value) {
|
|
|
82
93
|
*
|
|
83
94
|
* @param {object} options
|
|
84
95
|
* @param {File[]} options.files
|
|
85
|
-
* @param {string
|
|
96
|
+
* @param {string} [options.accept]
|
|
86
97
|
* @param {number} [options.minSize]
|
|
87
98
|
* @param {number} [options.maxSize]
|
|
88
99
|
* @param {boolean} [options.multiple]
|
|
@@ -297,6 +308,7 @@ export function isMIMEType(v) {
|
|
|
297
308
|
v === "video/*" ||
|
|
298
309
|
v === "image/*" ||
|
|
299
310
|
v === "text/*" ||
|
|
311
|
+
v === "application/*" ||
|
|
300
312
|
/\w+\/[-+.\w]+/g.test(v)
|
|
301
313
|
);
|
|
302
314
|
}
|
package/src/utils/index.spec.js
CHANGED
|
@@ -269,7 +269,7 @@ describe("fileAccepted()", () => {
|
|
|
269
269
|
|
|
270
270
|
it("accepts file when multiple accept criteria", () => {
|
|
271
271
|
const file = createFile("hamster.pdf", 100, "application/pdf");
|
|
272
|
-
expect(utils.fileAccepted(file,
|
|
272
|
+
expect(utils.fileAccepted(file, ".pdf,.png")).toEqual([true, null]);
|
|
273
273
|
});
|
|
274
274
|
|
|
275
275
|
it("rejects file when single accept criteria", () => {
|
|
@@ -282,7 +282,7 @@ describe("fileAccepted()", () => {
|
|
|
282
282
|
|
|
283
283
|
it("rejects file when multiple accept criteria", () => {
|
|
284
284
|
const file = createFile("hamster.pdf", 100, "application/pdf");
|
|
285
|
-
expect(utils.fileAccepted(file,
|
|
285
|
+
expect(utils.fileAccepted(file, ".gif,.png")).toEqual([
|
|
286
286
|
false,
|
|
287
287
|
{
|
|
288
288
|
code: "file-invalid-type",
|
|
@@ -290,13 +290,51 @@ describe("fileAccepted()", () => {
|
|
|
290
290
|
},
|
|
291
291
|
]);
|
|
292
292
|
});
|
|
293
|
+
});
|
|
293
294
|
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
295
|
+
describe("getTooLargeRejectionErr()", () => {
|
|
296
|
+
/**
|
|
297
|
+
* @constant
|
|
298
|
+
* @type {import('./index')}
|
|
299
|
+
*/
|
|
300
|
+
let utils;
|
|
301
|
+
beforeEach(async () => {
|
|
302
|
+
utils = await import("./index");
|
|
303
|
+
});
|
|
304
|
+
|
|
305
|
+
it("prints byte when maxSize is 1", () => {
|
|
306
|
+
expect(utils.getTooLargeRejectionErr(1).message).toEqual(
|
|
307
|
+
"File is larger than 1 byte"
|
|
308
|
+
);
|
|
309
|
+
});
|
|
310
|
+
|
|
311
|
+
it("prints bytes when maxSize > 1", () => {
|
|
312
|
+
expect(utils.getTooLargeRejectionErr(100).message).toEqual(
|
|
313
|
+
"File is larger than 100 bytes"
|
|
314
|
+
);
|
|
315
|
+
});
|
|
316
|
+
});
|
|
317
|
+
|
|
318
|
+
describe("getTooSmallRejectionErr()", () => {
|
|
319
|
+
/**
|
|
320
|
+
* @constant
|
|
321
|
+
* @type {import('./index')}
|
|
322
|
+
*/
|
|
323
|
+
let utils;
|
|
324
|
+
beforeEach(async () => {
|
|
325
|
+
utils = await import("./index");
|
|
326
|
+
});
|
|
327
|
+
|
|
328
|
+
it("prints byte when minSize is 1", () => {
|
|
329
|
+
expect(utils.getTooSmallRejectionErr(1).message).toEqual(
|
|
330
|
+
"File is smaller than 1 byte"
|
|
331
|
+
);
|
|
332
|
+
});
|
|
333
|
+
|
|
334
|
+
it("prints bytes when minSize > 1", () => {
|
|
335
|
+
expect(utils.getTooSmallRejectionErr(100).message).toEqual(
|
|
336
|
+
"File is smaller than 100 bytes"
|
|
337
|
+
);
|
|
300
338
|
});
|
|
301
339
|
});
|
|
302
340
|
|
|
@@ -461,6 +499,7 @@ describe("isMIMEType()", () => {
|
|
|
461
499
|
expect(utils.isMIMEType("image/*")).toBe(true);
|
|
462
500
|
expect(utils.isMIMEType("video/*")).toBe(true);
|
|
463
501
|
expect(utils.isMIMEType("audio/*")).toBe(true);
|
|
502
|
+
expect(utils.isMIMEType("application/*")).toBe(true);
|
|
464
503
|
expect(utils.isMIMEType("test/*")).toBe(false);
|
|
465
504
|
expect(utils.isMIMEType("text")).toBe(false);
|
|
466
505
|
expect(utils.isMIMEType("")).toBe(false);
|
|
@@ -4,11 +4,11 @@ import { FileWithPath } from "file-selector";
|
|
|
4
4
|
export { FileWithPath };
|
|
5
5
|
export default function Dropzone(
|
|
6
6
|
props: DropzoneProps & React.RefAttributes<DropzoneRef>
|
|
7
|
-
):
|
|
7
|
+
): React.ReactElement;
|
|
8
8
|
export function useDropzone(options?: DropzoneOptions): DropzoneState;
|
|
9
9
|
|
|
10
10
|
export interface DropzoneProps extends DropzoneOptions {
|
|
11
|
-
children?(state: DropzoneState):
|
|
11
|
+
children?(state: DropzoneState): React.ReactElement;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
export enum ErrorCode {
|
|
@@ -63,7 +63,8 @@ export type DropEvent =
|
|
|
63
63
|
| React.DragEvent<HTMLElement>
|
|
64
64
|
| React.ChangeEvent<HTMLInputElement>
|
|
65
65
|
| DragEvent
|
|
66
|
-
| Event
|
|
66
|
+
| Event
|
|
67
|
+
| Array<FileSystemFileHandle>;
|
|
67
68
|
|
|
68
69
|
export type DropzoneState = DropzoneRef & {
|
|
69
70
|
isFocused: boolean;
|
package/CONTRIBUTING.md
DELETED
|
@@ -1,135 +0,0 @@
|
|
|
1
|
-
# Contributing
|
|
2
|
-
|
|
3
|
-
First off, thanks for taking the time to contribute!
|
|
4
|
-
|
|
5
|
-
All types of contributions are encouraged and valued. See the [Table of Contents](#table-of-contents) for different ways to help and details about how this project handles them. Please make sure to read the relevant section before making your contribution. It will make it a lot easier for us maintainers and smooth out the experience for all involved. The community looks forward to your contributions.
|
|
6
|
-
|
|
7
|
-
And if you like the project, but just don't have time to contribute, that's fine. There are other easy ways to support the project and show your appreciation, which we would also be very happy about:
|
|
8
|
-
* Star the project
|
|
9
|
-
* Refer this project in your project's readme
|
|
10
|
-
* Mention the project at local meetups and tell your friends/colleagues
|
|
11
|
-
* Become a sponsor
|
|
12
|
-
|
|
13
|
-
## Table of Contents
|
|
14
|
-
|
|
15
|
-
* [Code of Conduct](#code-of-conduct)
|
|
16
|
-
* [I Have a Question](#i-have-a-question)
|
|
17
|
-
* [I Want To Contribute](#i-want-to-contribute)
|
|
18
|
-
* [Reporting Bugs](#reporting-bugs)
|
|
19
|
-
* [Suggesting Enhancements](#suggesting-enhancements)
|
|
20
|
-
* [Your First Code Contribution](#your-first-code-contribution)
|
|
21
|
-
* [Styleguides](#styleguides)
|
|
22
|
-
* [Join The Project Team](#join-the-project-team)
|
|
23
|
-
|
|
24
|
-
## Code of Conduct
|
|
25
|
-
|
|
26
|
-
This project and everyone participating in it is governed by the
|
|
27
|
-
[Code of Conduct](https://github.com/react-dropzone/react-dropzone?tab=coc-ov-file#readme).
|
|
28
|
-
By participating, you are expected to uphold this code. Please report unacceptable behavior
|
|
29
|
-
to rolandjitsu@gmail.com.
|
|
30
|
-
|
|
31
|
-
## I Have a Question
|
|
32
|
-
|
|
33
|
-
If you want to ask a question, we assume that you have read the available [Documentation](https://react-dropzone.js.org/).
|
|
34
|
-
|
|
35
|
-
Before you ask a question, it is best to search for existing [Issues](/issues) or [Discussions](/discussions) that might help you. In case you have found a suitable issue and still need clarification, you can write your question in this issue. It is also advisable to search the internet for answers first.
|
|
36
|
-
|
|
37
|
-
If you then still feel the need to ask a question and need clarification, we recommend the following:
|
|
38
|
-
|
|
39
|
-
* Open an [Issue](/issues/new).
|
|
40
|
-
* Provide as much context as you can about what you're running into.
|
|
41
|
-
* Provide project and platform versions (nodejs, npm, etc), depending on what seems relevant.
|
|
42
|
-
|
|
43
|
-
We will then take care of the issue as soon as possible.
|
|
44
|
-
|
|
45
|
-
## I Want To Contribute
|
|
46
|
-
|
|
47
|
-
### Reporting Bugs
|
|
48
|
-
|
|
49
|
-
#### Before Submitting a Bug Report
|
|
50
|
-
|
|
51
|
-
A good bug report shouldn't leave others needing to chase you up for more information. Therefore, we ask you to investigate carefully, collect information and describe the issue in detail in your report. Please complete the following steps in advance to help us fix any potential bug as fast as possible.
|
|
52
|
-
|
|
53
|
-
* Make sure that you are using the latest version.
|
|
54
|
-
* Determine if your bug is really a bug and not an error on your side e.g. using incompatible environment components/versions (Make sure that you have read the [documentation](https://react-dropzone.js.org/). If you are looking for support, you might want to check [this section](#i-have-a-question)).
|
|
55
|
-
* To see if other users have experienced (and potentially already solved) the same issue you are having, check if there is not already a bug report existing for your bug or error in the [bug tracker](issues?q=label%3Abug).
|
|
56
|
-
* Also make sure to search the internet (including Stack Overflow) to see if users outside of the GitHub community have discussed the issue.
|
|
57
|
-
* Collect information about the bug:
|
|
58
|
-
* Stack trace (Traceback)
|
|
59
|
-
* OS, Platform and Version (Windows, Linux, macOS, x86, ARM)
|
|
60
|
-
* Version of the interpreter, compiler, SDK, runtime environment, package manager, depending on what seems relevant.
|
|
61
|
-
* Possibly your input and the output
|
|
62
|
-
* Can you reliably reproduce the issue? And can you also reproduce it with older versions?
|
|
63
|
-
|
|
64
|
-
#### How Do I Submit a Good Bug Report?
|
|
65
|
-
|
|
66
|
-
We use GitHub issues to track bugs and errors. If you run into an issue with the project, open an [Issue](/issues/new), select the `Bug Report` and fill in all the details.
|
|
67
|
-
|
|
68
|
-
Once it's filed:
|
|
69
|
-
|
|
70
|
-
* The project team will label the issue accordingly.
|
|
71
|
-
* A team member will try to reproduce the issue with your provided steps. If there are no reproduction steps or no obvious way to reproduce the issue, the team will ask you for those steps and mark the issue as `needs example`. Bugs with the `needs example` tag will not be addressed until they are reproduced.
|
|
72
|
-
* If the team is able to reproduce the issue, it will be marked `needs investigation`, as well as possibly other tags (such as `in progress`), and the issue will be left to be [implemented by someone](#your-first-code-contribution).
|
|
73
|
-
|
|
74
|
-
### Suggesting Enhancements
|
|
75
|
-
|
|
76
|
-
This section guides you through submitting an enhancement suggestion for this project, **including completely new features and minor improvements to existing functionality**. Following these guidelines will help maintainers and the community to understand your suggestion and find related suggestions.
|
|
77
|
-
|
|
78
|
-
#### Before Submitting an Enhancement
|
|
79
|
-
|
|
80
|
-
* Make sure that you are using the latest version.
|
|
81
|
-
* Read the [documentation](https://react-dropzone.js.org/) carefully and find out if the functionality is already covered, maybe by an individual configuration.
|
|
82
|
-
* Perform a [search](/issues) to see if the enhancement has already been suggested (filter by the `enhancement` label). If it has, add a comment to the existing issue instead of opening a new one.
|
|
83
|
-
* Find out whether your idea fits with the scope and aims of the project. It's up to you to make a strong case to convince the project's developers of the merits of this feature. Keep in mind that we want features that will be useful to the majority of our users and not just a small subset. If you're just targeting a minority of users, consider writing an add-on/plugin library.
|
|
84
|
-
|
|
85
|
-
#### How Do I Submit a Good Enhancement Suggestion?
|
|
86
|
-
|
|
87
|
-
Enhancement suggestions are tracked as [GitHub issues](/issues). If you have a suggestion, open an [Issue](/issues/new), select the `Feature Request` and fill in all the details.
|
|
88
|
-
|
|
89
|
-
### Your First Code Contribution
|
|
90
|
-
|
|
91
|
-
Make sure your node version is at least 18, then:
|
|
92
|
-
|
|
93
|
-
1. Fork this repo
|
|
94
|
-
2. Clone your fork:
|
|
95
|
-
```bash
|
|
96
|
-
git clone https://github.com/myusername/react-dropzone.git
|
|
97
|
-
```
|
|
98
|
-
3. Install system dependencies (needed for local development):
|
|
99
|
-
```bash
|
|
100
|
-
# macOS
|
|
101
|
-
brew install libpng libimagequant
|
|
102
|
-
# Linux
|
|
103
|
-
sudo apt-get install -y libpng-dev libimagequant-dev
|
|
104
|
-
```
|
|
105
|
-
4. Install project dependencies:
|
|
106
|
-
```bash
|
|
107
|
-
yarn install
|
|
108
|
-
```
|
|
109
|
-
5. Create a new branch:
|
|
110
|
-
```bash
|
|
111
|
-
git checkout -b fix/fix-some-bug
|
|
112
|
-
```
|
|
113
|
-
6. Start hacking
|
|
114
|
-
7. Commit and push your code
|
|
115
|
-
8. Make a PR
|
|
116
|
-
|
|
117
|
-
**NOTE** If you're using Apple silicon, you'll need to install Rosetta 2 (see [imagemin/pngquant-bin#121](https://github.com/imagemin/pngquant-bin/issues/121) and [SO](https://stackoverflow.com/a/66662497/1092007)):
|
|
118
|
-
```bash
|
|
119
|
-
/usr/sbin/softwareupdate --install-rosetta
|
|
120
|
-
```
|
|
121
|
-
|
|
122
|
-
## Styleguides
|
|
123
|
-
|
|
124
|
-
When you commit we'll make sure everything is formatted according to our styleguide, so don't worry to much about it.
|
|
125
|
-
|
|
126
|
-
### Commit Messages
|
|
127
|
-
|
|
128
|
-
Please follow the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) spec.
|
|
129
|
-
|
|
130
|
-
## Join The Project Team
|
|
131
|
-
|
|
132
|
-
Send an email to rolandjitsu@gmail.com and see how you can become a project member.
|
|
133
|
-
|
|
134
|
-
## Attribution
|
|
135
|
-
This guide is based on the **contributing.md**. [Make your own](https://contributing.md/)!
|