UNPKG

z-react-dynamic-form

Version:

A dynamic form builder for React applications with various input types and validation

49 lines (48 loc) 1.7 kB
import { ClassValue } from "clsx"; import { Controller } from "../types"; /** * Combines class names with Tailwind's merge function */ export declare function cn(...inputs: ClassValue[]): string; /** * Initialize default values for a form based on controllers */ export declare const initializeDefaultValues: (controllers: Controller[]) => Record<string, any>; /** * Initialize default values for a form based on steps */ export declare const initializeDefaultValuesFromSteps: (steps: any[]) => Record<string, any>; /** * Filter controllers based on visibility condition */ export declare const filterVisibleControllers: (controllers: Controller[] | undefined, formValues: Record<string, any>) => Controller[]; /** * Generate field ID based on name and optional prefix */ export declare const generateFieldId: (name?: string, prefix?: string) => string; /** * Parse file size to readable format */ export declare const formatFileSize: (size: number) => string; /** * Get file extension from filename */ export declare const getFileExtension: (filename: string | undefined | null) => string; /** * Default accepted file types for file upload */ export declare const DEFAULT_ACCEPTED_FILE_TYPES: { "application/pdf": string[]; "application/vnd.openxmlformats-officedocument.wordprocessingml.document": string[]; "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": string[]; "application/msword": string[]; "application/vnd.ms-excel": string[]; "image/jpeg": string[]; "image/png": string[]; "image/gif": string[]; "text/plain": string[]; }; /** * Default max file size (5MB) */ export declare const DEFAULT_MAX_FILE_SIZE: number;