mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-11 12:30:18 +00:00
react-dropzone Updated typings for latest version
This commit is contained in:
Vendored
+34
-37
@@ -1,51 +1,48 @@
|
||||
// Type definitions for react-dropzone 4.1.3
|
||||
// Type definitions for react-dropzone 4.2.3
|
||||
// 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>,
|
||||
// Karol Janyst <https://github.com/LKay>,
|
||||
// Andris Causs <https://github.com/codeaid>
|
||||
// Andris Causs <https://github.com/codeaid>,
|
||||
// Juraj Husar <https://github.com/jurosh>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
// TypeScript Version: 2.6
|
||||
|
||||
import { CSSProperties, Component, DragEvent, InputHTMLAttributes } from "react";
|
||||
|
||||
declare namespace Dropzone {
|
||||
export interface ImageFile extends File {
|
||||
preview?: string;
|
||||
}
|
||||
|
||||
export type DropFileEventHandler = (acceptedOrRejected: ImageFile[], event: DragEvent<HTMLDivElement>) => void;
|
||||
export type DropFilesEventHandler = (accepted: ImageFile[], rejected: ImageFile[], event: DragEvent<HTMLDivElement>) => void;
|
||||
|
||||
type PickedAttributes = "accept" | "className" | "multiple" | "name" | "onClick" | "onDragStart" | "onDragEnter" | "onDragOver" | "onDragLeave" | "style";
|
||||
|
||||
export interface DropzoneProps extends Pick<InputHTMLAttributes<HTMLDivElement>, PickedAttributes> {
|
||||
disableClick?: boolean;
|
||||
disabled?: boolean;
|
||||
disablePreview?: boolean;
|
||||
preventDropOnDocument?: boolean;
|
||||
inputProps?: InputHTMLAttributes<HTMLInputElement>;
|
||||
maxSize?: number;
|
||||
minSize?: number;
|
||||
activeClassName?: string;
|
||||
acceptClassName?: string;
|
||||
rejectClassName?: string;
|
||||
disabledClassName?: string;
|
||||
activeStyle?: CSSProperties;
|
||||
acceptStyle?: CSSProperties;
|
||||
rejectStyle?: CSSProperties;
|
||||
disabledStyle?: CSSProperties;
|
||||
onDrop?: DropFilesEventHandler;
|
||||
onDropAccepted?: DropFileEventHandler;
|
||||
onDropRejected?: DropFileEventHandler;
|
||||
onFileDialogCancel?: () => void;
|
||||
}
|
||||
export interface ImageFile extends File {
|
||||
preview?: string;
|
||||
}
|
||||
|
||||
declare class Dropzone extends Component<Dropzone.DropzoneProps> {
|
||||
export type DropFileEventHandler = (acceptedOrRejected: ImageFile[], event: DragEvent<HTMLDivElement>) => void;
|
||||
export type DropFilesEventHandler = (accepted: ImageFile[], rejected: ImageFile[], event: DragEvent<HTMLDivElement>) => void;
|
||||
|
||||
type PickedAttributes = "accept" | "className" | "multiple" | "name" | "onClick" | "onDragStart" | "onDragEnter" | "onDragOver" | "onDragLeave" | "style";
|
||||
|
||||
export interface DropzoneProps extends Pick<InputHTMLAttributes<HTMLDivElement>, PickedAttributes> {
|
||||
disableClick?: boolean;
|
||||
disabled?: boolean;
|
||||
disablePreview?: boolean;
|
||||
preventDropOnDocument?: boolean;
|
||||
inputProps?: InputHTMLAttributes<HTMLInputElement>;
|
||||
maxSize?: number;
|
||||
minSize?: number;
|
||||
activeClassName?: string;
|
||||
acceptClassName?: string;
|
||||
rejectClassName?: string;
|
||||
disabledClassName?: string;
|
||||
activeStyle?: CSSProperties;
|
||||
acceptStyle?: CSSProperties;
|
||||
rejectStyle?: CSSProperties;
|
||||
disabledStyle?: CSSProperties;
|
||||
onDrop?: DropFilesEventHandler;
|
||||
onDropAccepted?: DropFileEventHandler;
|
||||
onDropRejected?: DropFileEventHandler;
|
||||
onFileDialogCancel?: () => void;
|
||||
}
|
||||
|
||||
export default class Dropzone extends Component<DropzoneProps> {
|
||||
open(): void;
|
||||
}
|
||||
|
||||
export = Dropzone;
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import * as React from "react";
|
||||
import { DragEvent, SyntheticEvent } from "react";
|
||||
import Dropzone = require("react-dropzone");
|
||||
import { ImageFile } from "react-dropzone";
|
||||
import Dropzone, { ImageFile } from "react-dropzone";
|
||||
|
||||
class Test extends React.Component {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user