smart-dropzone-react
Version:
🚀 A production-ready React dropzone component with smart defaults, drag & drop reordering, chunked uploads, resume functionality, and comprehensive provider support (Cloudinary, AWS S3, Supabase)
130 lines (127 loc) • 4.25 kB
text/typescript
import { T as ThemeConfig } from '../index-BjQbXosE.cjs';
/**
* Smart Defaults & Presets for Smart Dropzone
*
* Based on research of what 80% of developers actually need
* These defaults provide excellent UX out of the box
*/
interface SmartDefaults {
maxFiles: number;
maxFileSize: number;
allowedTypes: readonly string[];
showPreview: boolean;
showProgress: boolean;
showFileSize: boolean;
showFileType: boolean;
enableReorder: boolean;
enableResume: boolean;
enableI18n: boolean;
accessibility: boolean;
theme: ThemeConfig | "light" | "dark" | "custom";
variant: "outlined" | "filled" | "minimal";
size: "sm" | "md" | "lg";
}
/**
* Research-based smart defaults
* Covers 80% of common use cases
*/
declare const SMART_DEFAULTS: SmartDefaults;
/**
* Preset configurations for common use cases
*/
declare const PRESETS: {
readonly simple: {
readonly maxFiles: 5;
readonly maxFileSize: number;
readonly allowedTypes: readonly ["image/*"];
readonly showPreview: true;
readonly showProgress: true;
readonly showFileSize: true;
readonly showFileType: false;
readonly enableReorder: false;
readonly enableResume: false;
readonly enableI18n: false;
readonly accessibility: true;
readonly theme: "light";
readonly variant: "outlined";
readonly size: "md";
};
readonly gallery: {
readonly maxFiles: 20;
readonly maxFileSize: number;
readonly allowedTypes: readonly ["image/*", "video/*"];
readonly showPreview: true;
readonly showProgress: true;
readonly showFileSize: true;
readonly showFileType: true;
readonly enableReorder: true;
readonly enableResume: false;
readonly enableI18n: false;
readonly accessibility: true;
readonly theme: "light";
readonly variant: "outlined";
readonly size: "md";
};
readonly documents: {
readonly maxFiles: 10;
readonly maxFileSize: number;
readonly allowedTypes: readonly ["application/pdf", "text/*", "application/*"];
readonly showPreview: false;
readonly showProgress: true;
readonly showFileSize: true;
readonly showFileType: true;
readonly enableReorder: false;
readonly enableResume: true;
readonly enableI18n: false;
readonly accessibility: true;
readonly theme: "light";
readonly variant: "minimal";
readonly size: "md";
};
readonly media: {
readonly maxFiles: 50;
readonly maxFileSize: number;
readonly allowedTypes: readonly ["image/*", "video/*", "audio/*"];
readonly showPreview: true;
readonly showProgress: true;
readonly showFileSize: true;
readonly showFileType: true;
readonly enableReorder: true;
readonly enableResume: true;
readonly enableI18n: false;
readonly accessibility: true;
readonly theme: "light";
readonly variant: "outlined";
readonly size: "lg";
};
readonly enterprise: {
readonly maxFiles: 100;
readonly maxFileSize: number;
readonly allowedTypes: readonly ["*/*"];
readonly showPreview: true;
readonly showProgress: true;
readonly showFileSize: true;
readonly showFileType: true;
readonly enableReorder: true;
readonly enableResume: true;
readonly enableI18n: true;
readonly accessibility: true;
readonly theme: "light";
readonly variant: "filled";
readonly size: "lg";
};
};
type PresetName = keyof typeof PRESETS;
/**
* Get preset configuration
*/
declare function getPreset(presetName: PresetName): SmartDefaults;
/**
* Merge preset with custom overrides
*/
declare function mergePreset(presetName: PresetName, overrides: Partial<SmartDefaults>): SmartDefaults;
/**
* Get smart defaults with custom overrides
*/
declare function getSmartDefaults(overrides?: Partial<SmartDefaults>): SmartDefaults;
export { PRESETS, type PresetName, SMART_DEFAULTS, type SmartDefaults, getPreset, getSmartDefaults, mergePreset };