From ece54bc18a8e4565f9a05872c0787d16dac132aa Mon Sep 17 00:00:00 2001 From: Luis Rodrigues Date: Mon, 29 Aug 2016 16:52:35 +0100 Subject: [PATCH 1/4] Updated react-dropzone typings --- react-dropzone/react-dropzone-tests.tsx | 9 +++- react-dropzone/react-dropzone.d.ts | 70 +++++++++++-------------- 2 files changed, 38 insertions(+), 41 deletions(-) diff --git a/react-dropzone/react-dropzone-tests.tsx b/react-dropzone/react-dropzone-tests.tsx index ca3d462596..ffc7d8bf0c 100644 --- a/react-dropzone/react-dropzone-tests.tsx +++ b/react-dropzone/react-dropzone-tests.tsx @@ -7,25 +7,32 @@ class Test extends React.Component { constructor(props: any) { super(props); } - + render() { return (
{ e.preventDefault(); } } onDropAccepted={(e: any) => { e.preventDefault(); } } onDropRejected={(e: any) => { e.preventDefault(); } } + onDragStart={(e: any) => { e.preventDefault(); } } onDragEnter={(e: any) => { e.preventDefault(); } } onDragLeave={(e: any) => { e.preventDefault(); } } style={{ borderStyle: "dashed" }} activeStyle={{ borderStyle: "dotted" }} + rejectStyle={{ borderStyle: "dotted" }} className="regular" + activeClassName="regular" + rejectClassName="regular" minSize={2000} maxSize={Infinity} activeClassName="active" rejectClassName="reject" + disablePreview={true} disableClick={true} multiple={false} accept="*.png" + name="dropzone" + inputProps={{ id: "dropzone" }} />
); } diff --git a/react-dropzone/react-dropzone.d.ts b/react-dropzone/react-dropzone.d.ts index 792fd436ba..23fe863d81 100644 --- a/react-dropzone/react-dropzone.d.ts +++ b/react-dropzone/react-dropzone.d.ts @@ -1,49 +1,40 @@ // Type definitions for react-dropzone -// Project: https://github.com/paramaggarwal/react-dropzone -// Definitions by: Mathieu Larouche Dube +// Project: https://github.com/okonet/react-dropzone +// Definitions by: Mathieu Larouche Dube , Ivo Jesus , Luís Rodrigues // Definitions: https://github.com/Vooban/DefinitelyTyped -/// - declare namespace ReactDropzone { import React = __React; - interface DropzoneProps { - onDrop?: Function; - onDropAccepted?: Function; - onDropRejected?: Function; - onDragEnter?: Function; - onDragLeave?: Function; - style?: Object; - activeStyle?: Object; - className?: string; - activeClassName?: string; - rejectClassName?: string; - /** - * Clicking the brings up the browser file picker. To disable, set to true. - */ - disableClick?: boolean; - /** - * Min file size accepted - */ - minSize?: number; - /** - * Max file size accepted - */ - maxSize?: number; - /** - * To accept only a single file, set this to false. - */ - multiple?: boolean; - /** - * Filters the file types that are valid. It should have a valid MIME type according to input element, for example: - * application/pdf - * image/* - * audio/aiff,audio/midi - */ - accept?: string; + interface IDropzoneProps { + // Drop behavior + onDrop?: Function, + onDropAccepted?: Function, + onDropRejected?: Function, + + // Drag behavior + onDragStart?: Function, + onDragEnter?: Function, + onDragLeave?: Function, + + style?: Object, // CSS styles to apply + activeStyle?: Object, // CSS styles to apply when drop will be accepted + rejectStyle?: Object, // CSS styles to apply when drop will be rejected + className?: string, // Optional className + activeClassName?: string, // className for accepted state + rejectClassName?: string, // className for rejected state + + disablePreview?: boolean, // Enable/disable preview generation + disableClick?: boolean, // Disallow clicking on the dropzone container to open file dialog + + inputProps?: Object, // Pass additional attributes to the tag + multiple?: boolean, // Allow dropping multiple files + accept?: string, // Allow specific types of files. See https://github.com/okonet/attr-accept for more information + name?: string, // name attribute for the input tag + maxSize?: number, + minSize?: number } - export class Dropzone extends React.Component { + export class Dropzone extends React.Component { } } @@ -52,4 +43,3 @@ declare module "react-dropzone" { const Dropzone: typeof ReactDropzone.Dropzone; export = Dropzone; } - From bcd7b2fb4aae617359d886effee2c926e4ea296d Mon Sep 17 00:00:00 2001 From: Luis Rodrigues Date: Mon, 29 Aug 2016 16:56:53 +0100 Subject: [PATCH 2/4] Fixed duplicate properties --- react-dropzone/react-dropzone-tests.tsx | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/react-dropzone/react-dropzone-tests.tsx b/react-dropzone/react-dropzone-tests.tsx index ffc7d8bf0c..b529f2d057 100644 --- a/react-dropzone/react-dropzone-tests.tsx +++ b/react-dropzone/react-dropzone-tests.tsx @@ -21,12 +21,10 @@ class Test extends React.Component { activeStyle={{ borderStyle: "dotted" }} rejectStyle={{ borderStyle: "dotted" }} className="regular" - activeClassName="regular" - rejectClassName="regular" - minSize={2000} - maxSize={Infinity} activeClassName="active" rejectClassName="reject" + minSize={2000} + maxSize={Infinity} disablePreview={true} disableClick={true} multiple={false} From 4f764361a8d2ad56149a29b92b337947f107973d Mon Sep 17 00:00:00 2001 From: Luis Rodrigues Date: Mon, 29 Aug 2016 17:02:26 +0100 Subject: [PATCH 3/4] Missing React ref --- react-dropzone/react-dropzone.d.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/react-dropzone/react-dropzone.d.ts b/react-dropzone/react-dropzone.d.ts index 23fe863d81..de618664bd 100644 --- a/react-dropzone/react-dropzone.d.ts +++ b/react-dropzone/react-dropzone.d.ts @@ -3,6 +3,8 @@ // Definitions by: Mathieu Larouche Dube , Ivo Jesus , Luís Rodrigues // Definitions: https://github.com/Vooban/DefinitelyTyped +/// + declare namespace ReactDropzone { import React = __React; interface IDropzoneProps { From 25ee0659ed39de9c1a1fee3cd012a729aa090db1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lu=C3=ADs=20Rodrigues?= Date: Tue, 30 Aug 2016 17:57:22 +0100 Subject: [PATCH 4/4] IDropzoneProps -> DropzoneProps --- react-dropzone/react-dropzone.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/react-dropzone/react-dropzone.d.ts b/react-dropzone/react-dropzone.d.ts index de618664bd..c6eecbf119 100644 --- a/react-dropzone/react-dropzone.d.ts +++ b/react-dropzone/react-dropzone.d.ts @@ -7,7 +7,7 @@ declare namespace ReactDropzone { import React = __React; - interface IDropzoneProps { + interface DropzoneProps { // Drop behavior onDrop?: Function, onDropAccepted?: Function, @@ -36,7 +36,7 @@ declare namespace ReactDropzone { minSize?: number } - export class Dropzone extends React.Component { + export class Dropzone extends React.Component { } }