UNPKG

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

39 lines (38 loc) 1.35 kB
import { ApiConfig } from './types'; export interface ApiResponse<T = any> { data: T; status: number; statusText: string; } export interface ApiError { message: string; status?: number; statusText?: string; } /** * Fetches data from an API endpoint using React Query */ export declare function fetchApiData(apiConfig: ApiConfig, baseUrl?: string, defaultHeaders?: Record<string, string>, dependentValues?: Record<string, any>): Promise<Array<{ label: string; value: string | number; }>>; /** * React Query hook for fetching API data with caching - only fetches on user interaction */ export declare function useApiData(apiConfig: ApiConfig | null, baseUrl?: string, defaultHeaders?: Record<string, string>, dependentValues?: Record<string, any>, // Changed from formData to dependentValues enabled?: boolean): import('@tanstack/react-query').UseQueryResult<{ label: string; value: string | number; }[], Error>; /** * Checks if a field has API configuration */ export declare function hasApiConfig(field: any): boolean; /** * Gets the API configuration from a field */ export declare function getApiConfig(field: any): ApiConfig | null; /** * Checks if a field should be shown based on conditional logic */ export declare function shouldShowField(field: any, formData: Record<string, any>): boolean;