@uploadthing/dropzone
Advanced tools
Comparing version 0.1.1-canary.095fbbe to 0.1.1-canary.3ca95b9
@@ -1,10 +0,11 @@ | ||
import { A as AcceptProp, D as DropzoneState } from './types-1ad6dc7a.js'; | ||
type AcceptProp = Record<string, string[]>; | ||
type DropzoneState = { | ||
isFocused: boolean; | ||
isDragActive: boolean; | ||
isDragAccept: boolean; | ||
isDragReject: boolean; | ||
isFileDialogActive: boolean; | ||
acceptedFiles: File[]; | ||
}; | ||
/** | ||
* This is a forked version of the react-dropzone package, that's been minified | ||
* to suit UploadThing's needs and be easily portable to other frameworks than React. | ||
* See original source here: https://github.com/react-dropzone/react-dropzone | ||
* The original package is licensed under the MIT license. | ||
*/ | ||
declare function isFileAccepted(file: File, accept: string | string[]): boolean; | ||
@@ -27,12 +28,4 @@ declare function isEnterOrSpace(event: { | ||
declare function isIeOrEdge(ua?: string): boolean; | ||
/** | ||
* Convert the `{accept}` dropzone prop to an array of MIME types/extensions. | ||
*/ | ||
declare function acceptPropAsAcceptAttr(accept?: AcceptProp): string | undefined; | ||
declare function noop(): void; | ||
/** | ||
* ================================================ | ||
* Reducer | ||
* ================================================ | ||
*/ | ||
type Payload<T extends keyof DropzoneState> = Pick<DropzoneState, T>; | ||
@@ -39,0 +32,0 @@ type Focus = { |
import * as react from 'react'; | ||
import { HTMLProps } from 'react'; | ||
import { a as DropzoneOptions } from './types-1ad6dc7a.js'; | ||
export { A as AcceptProp, D as DropzoneState } from './types-1ad6dc7a.js'; | ||
type AcceptProp = Record<string, string[]>; | ||
type DropzoneOptions = { | ||
multiple?: boolean; | ||
accept?: AcceptProp; | ||
minSize?: number; | ||
maxSize?: number; | ||
maxFiles?: number; | ||
disabled?: boolean; | ||
onDrop: <T extends File>(acceptedFiles: T[]) => void; | ||
}; | ||
type DropzoneState = { | ||
isFocused: boolean; | ||
isDragActive: boolean; | ||
isDragAccept: boolean; | ||
isDragReject: boolean; | ||
isFileDialogActive: boolean; | ||
acceptedFiles: File[]; | ||
}; | ||
type DropEvent = Event | React.DragEvent<HTMLElement> | React.ChangeEvent<HTMLElement>; | ||
/** | ||
* A React hook that creates a drag 'n' drop area. | ||
* | ||
* ### Example | ||
* | ||
* ```tsx | ||
* function MyDropzone() { | ||
* const { getRootProps, getInputProps } = useDropzone({ | ||
* onDrop: acceptedFiles => { | ||
* // do something with the File objects, e.g. upload to some server | ||
* } | ||
* }); | ||
* | ||
* return ( | ||
* <div {...getRootProps()}> | ||
* <input {...getInputProps()} /> | ||
* <p>Drag and drop some files here, or click to select files</p> | ||
* </div> | ||
* ) | ||
* } | ||
* ``` | ||
*/ | ||
declare function useDropzone({ accept, disabled, maxSize, minSize, multiple, maxFiles, onDrop, }: DropzoneOptions): { | ||
@@ -41,2 +36,2 @@ getRootProps: () => HTMLProps<HTMLDivElement>; | ||
export { DropEvent, DropzoneOptions, useDropzone }; | ||
export { type AcceptProp, type DropEvent, type DropzoneOptions, type DropzoneState, useDropzone }; |
import * as solid_js from 'solid-js'; | ||
import { a as DropzoneOptions } from './types-1ad6dc7a.js'; | ||
export { A as AcceptProp, D as DropzoneState } from './types-1ad6dc7a.js'; | ||
type AcceptProp = Record<string, string[]>; | ||
type DropzoneOptions = { | ||
multiple?: boolean; | ||
accept?: AcceptProp; | ||
minSize?: number; | ||
maxSize?: number; | ||
maxFiles?: number; | ||
disabled?: boolean; | ||
onDrop: <T extends File>(acceptedFiles: T[]) => void; | ||
}; | ||
type DropzoneState = { | ||
isFocused: boolean; | ||
isDragActive: boolean; | ||
isDragAccept: boolean; | ||
isDragReject: boolean; | ||
isFileDialogActive: boolean; | ||
acceptedFiles: File[]; | ||
}; | ||
type DropEvent = InputEvent | DragEvent | Event; | ||
@@ -18,2 +35,5 @@ declare function createDropzone(_props: DropzoneOptions): { | ||
type: string; | ||
style: { | ||
display: string; | ||
}; | ||
accept: string | undefined; | ||
@@ -40,2 +60,2 @@ multiple: boolean; | ||
export { DropEvent, DropzoneOptions, createDropzone }; | ||
export { type AcceptProp, type DropEvent, type DropzoneOptions, type DropzoneState, createDropzone }; |
{ | ||
"name": "@uploadthing/dropzone", | ||
"version": "0.1.1-canary.095fbbe", | ||
"version": "0.1.1-canary.3ca95b9", | ||
"license": "MIT", | ||
@@ -10,3 +10,3 @@ "exports": { | ||
"import": "./dist/core.mjs", | ||
"require": "./dist/core.js" | ||
"require": "./dist/core.cjs" | ||
}, | ||
@@ -16,3 +16,3 @@ "./solid": { | ||
"import": "./dist/solid.mjs", | ||
"require": "./dist/solid.js" | ||
"require": "./dist/solid.cjs" | ||
}, | ||
@@ -22,3 +22,3 @@ "./react": { | ||
"import": "./dist/react.mjs", | ||
"require": "./dist/react.js" | ||
"require": "./dist/react.cjs" | ||
} | ||
@@ -47,9 +47,19 @@ }, | ||
"@uploadthing/tsconfig": "0.1.0", | ||
"@uploadthing/tsup-config": "0.1.0", | ||
"eslint": "^8.47.0", | ||
"react": "18.2.0", | ||
"solid-js": "^1.7.11", | ||
"tsup": "6.7.0", | ||
"typescript": "^5.1.6" | ||
}, | ||
"peerDependencies": { | ||
"react": "^16.8.0 || ^17.0.0 || ^18.0.0", | ||
"solid-js": "^1.7.11" | ||
}, | ||
"peerDependenciesMeta": { | ||
"react": { | ||
"optional": true | ||
}, | ||
"solid-js": { | ||
"optional": true | ||
} | ||
}, | ||
"eslintConfig": { | ||
@@ -73,7 +83,7 @@ "root": true, | ||
"lint": "eslint \"**/*.{ts,tsx}\" --max-warnings 0", | ||
"build": "tsup", | ||
"build": "rm -rf dist && bunchee", | ||
"clean": "git clean -xdf dist node_modules", | ||
"dev": "tsup --watch", | ||
"dev": "bunchee -w", | ||
"typecheck": "tsc --noEmit" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
7
61687
4
17
1385
1