finform-react-builder
Version:
A powerful, flexible React form builder with dynamic field rendering, custom validation, multi-step forms, Material-UI integration, image component support, toggle/radio buttons, switches, autocomplete, and advanced button positioning
46 lines (45 loc) • 1.19 kB
TypeScript
export interface DocumentUploadConfig {
id: string;
title?: string;
fileTypes?: string[];
description?: string;
maxSize?: number;
required?: boolean;
multiple?: boolean;
accept?: string;
placeholder?: string;
helperText?: string;
customValidation?: (file: File) => string | null | Promise<string | null>;
submitButton?: {
text: string;
position: 'left' | 'center' | 'right';
disabled?: boolean;
loading?: boolean;
};
}
export interface UploadedFile {
id: string;
file: File;
preview?: string;
progress: number;
status: 'pending' | 'uploading' | 'success' | 'error';
error?: any;
uploadedAt: Date;
}
export interface DocumentUploadProps {
config?: DocumentUploadConfig;
title?: string;
subtitle?: string;
buttonText?: string;
fileSupportedText?: string;
value?: UploadedFile[];
onChange?: (files: UploadedFile[]) => void;
onSubmit?: (files: UploadedFile[]) => void;
disabled?: boolean;
className?: string;
style?: React.CSSProperties;
}
export interface FilePreviewProps {
file: UploadedFile;
onRemove: (id: string) => void;
}