mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-11 20:40:20 +00:00
Use correct export for generated classes
- Use semicolons in interface declaration. - Use correct function syntax for onDrop methods
This commit is contained in:
Vendored
+22
-24
@@ -1,7 +1,6 @@
|
||||
// Type definitions for react-dropzone
|
||||
// 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>, Ben Bayard <https://github.com/benbayard>
|
||||
|
||||
// Definitions: https://github.com/Vooban/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
@@ -10,37 +9,36 @@
|
||||
declare module "react-dropzone" {
|
||||
interface DropzoneProps {
|
||||
// Drop behavior
|
||||
onDrop?: Function,
|
||||
onDropAccepted?: Function,
|
||||
onDropRejected?: Function,
|
||||
onDrop?: (accepted: File[], rejected: File[]) => any;
|
||||
onDropAccepted?: (accepted: File[]) => any;
|
||||
onDropRejected?: (rejected: File[]) => any;
|
||||
|
||||
// Drag behavior
|
||||
onDragStart?: Function,
|
||||
onDragEnter?: Function,
|
||||
onDragLeave?: Function,
|
||||
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
|
||||
style?: React.CSSProperties; // CSS styles to apply
|
||||
activeStyle?: React.CSSProperties; // CSS styles to apply when drop will be accepted
|
||||
rejectStyle?: React.CSSProperties; // 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
|
||||
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
|
||||
inputProps?: React.ChangeTargetHTMLProps<HTMLInputElement>; // 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;
|
||||
|
||||
onFileDialogCancel?: () => void;
|
||||
}
|
||||
|
||||
export declare class Dropzone extends React.Component<DropzoneProps, never> {
|
||||
open(): void;
|
||||
}
|
||||
class Dropzone extends React.Component<DropzoneProps, never> {}
|
||||
|
||||
export = Dropzone;
|
||||
}
|
||||
|
||||
@@ -1,36 +1,41 @@
|
||||
import * as React from 'react';
|
||||
import * as Dropzone from 'react-dropzone';
|
||||
import Dropzone = require('react-dropzone');
|
||||
|
||||
class Test extends React.Component {
|
||||
constructor(props: any) {
|
||||
super(props);
|
||||
}
|
||||
|
||||
dz: Dropzone;
|
||||
|
||||
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"
|
||||
activeClassName="active"
|
||||
rejectClassName="reject"
|
||||
minSize={2000}
|
||||
maxSize={Infinity}
|
||||
disablePreview={true}
|
||||
disableClick={true}
|
||||
multiple={false}
|
||||
accept="*.png"
|
||||
name="dropzone"
|
||||
inputProps={{ id: "dropzone" }}
|
||||
return (
|
||||
<div>
|
||||
<Dropzone
|
||||
ref={(node) => { this.dz = node } }
|
||||
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"
|
||||
activeClassName="active"
|
||||
rejectClassName="reject"
|
||||
minSize={2000}
|
||||
maxSize={Infinity}
|
||||
disablePreview={true}
|
||||
disableClick={true}
|
||||
multiple={false}
|
||||
accept="*.png"
|
||||
name="dropzone"
|
||||
inputProps={{ id: "dropzone" }}
|
||||
/>
|
||||
</div>);
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user