UNPKG

@devino.solutions/upup

Version:
40 lines (39 loc) 1.79 kB
import { Dispatch, RefObject, SetStateAction } from 'react'; import { FileWithParams, GoogleDriveConfigs, OneDriveConfigs, UploadAdapter, UpupUploaderProps, UpupUploaderPropsIcons } from '../../shared/types'; import { FilesProgressMap } from '../hooks/useRootProvider'; export declare enum UploadStatus { PENDING = "PENDING", ONGOING = "ONGOING", SUCCESSFUL = "SUCCESSFUL", FAILED = "FAILED" } declare type ContextUpload = { uploadStatus: UploadStatus; setUploadStatus: Dispatch<SetStateAction<UploadStatus>>; totalProgress: number; filesProgressMap: FilesProgressMap; proceedUpload: () => Promise<string[] | undefined>; }; declare type ContextProps = Required<Pick<UpupUploaderProps, 'uploadAdapters' | 'accept' | 'limit' | 'mini' | 'maxFileSize' | 'onFileClick' | 'onIntegrationClick' | 'onFilesDragOver' | 'onFilesDragLeave' | 'onFilesDrop' | 'onError' | 'dark' | 'classNames' | 'icons'>> & { multiple: boolean; icons: Required<UpupUploaderPropsIcons>; }; export interface IRootContext { inputRef: RefObject<HTMLInputElement | null>; activeAdapter?: UploadAdapter; setActiveAdapter: Dispatch<SetStateAction<UploadAdapter | undefined>>; files: Map<string, FileWithParams>; setFiles: (newFiles: File[]) => void; isAddingMore: boolean; setIsAddingMore: Dispatch<SetStateAction<boolean>>; handleFileRemove: (fileId: string) => void; handleDone: () => void; oneDriveConfigs?: OneDriveConfigs; googleDriveConfigs?: GoogleDriveConfigs; upload: ContextUpload; props: ContextProps; toastContainerId?: string; } declare const RootContext: import("react").Context<IRootContext>; export declare function useRootContext(): IRootContext; export default RootContext;