Merge pull request #10787 from goblindegook/master

Updated Typings to latest version of react-dropzone
This commit is contained in:
Ryan Cavanaugh
2016-08-30 20:15:13 -07:00
committed by GitHub
2 changed files with 36 additions and 39 deletions

View File

@@ -7,25 +7,30 @@ class Test extends React.Component<any, any> {
constructor(props: any) {
super(props);
}
render() {
return (<div>
<Dropzone
onDrop={(e: any) => { 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"
minSize={2000}
maxSize={Infinity}
activeClassName="active"
rejectClassName="reject"
minSize={2000}
maxSize={Infinity}
disablePreview={true}
disableClick={true}
multiple={false}
accept="*.png"
name="dropzone"
inputProps={{ id: "dropzone" }}
/>
</div>);
}

View File

@@ -1,6 +1,6 @@
// Type definitions for react-dropzone
// Project: https://github.com/paramaggarwal/react-dropzone
// Definitions by: Mathieu Larouche Dube <https://github.com/matdube>
// Project: https://github.com/okonet/react-dropzone
// Definitions by: Mathieu Larouche Dube <https://github.com/matdube>, Ivo Jesus <https://github.com/LynxEyes>, Luís Rodrigues <https://github.com/goblindegook>
// Definitions: https://github.com/Vooban/DefinitelyTyped
///<reference path='../react/react.d.ts' />
@@ -8,39 +8,32 @@
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 <Dropzone> 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;
// 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 <input type="file"/> 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<DropzoneProps, {}> {
@@ -52,4 +45,3 @@ declare module "react-dropzone" {
const Dropzone: typeof ReactDropzone.Dropzone;
export = Dropzone;
}