welcome-ui
Version:
Customizable design system with react • styled-components • styled-system and ariakit.
36 lines (35 loc) • 1.37 kB
TypeScript
import { default as React } from 'react';
import { FileType } from '../Files';
import { CreateWuiProps } from '../System';
import { TagProps } from '../Tag';
import { createEvent } from '../../utils/create-event';
export interface FileUploadOptions {
/** Pass a comma-separated string of file types e.g. "image/png" or "image/png,image/jpeg" */
accept?: string;
children?: (props: {
disabled: boolean;
files: FileWithPreviewType[];
onRemoveFile: HandleRemoveType;
openFile: () => void;
}) => React.ReactNode;
handleAddFile?: (files: FileWithPreviewType | FileWithPreviewType[]) => void;
handleRemoveFile?: HandleRemoveType;
maxSize?: number;
onBlur?: () => void;
onChange?: (event: ReturnType<typeof createEvent>) => void;
preview?: typeof DefaultPreview;
}
export type FileUploadPreviewProps = {
file: FileType;
onRemove: TagProps['onRemove'];
};
export type FileUploadProps = CreateWuiProps<'input', FileUploadOptions>;
type FileWithPreview = File & {
name?: string;
preview?: string;
};
type FileWithPreviewType = FileWithPreview | string;
type HandleRemoveType = (file: FileWithPreviewType) => void;
declare const DefaultPreview: React.FC<FileUploadPreviewProps>;
export declare const FileUpload: import('../System').CreateWuiComponent<"input", FileUploadProps>;
export {};