import { GridLegacyProps as GridProps } from '@mui/material/GridLegacy'; import React, { ReactNode } from 'react'; import { RegisterOptions } from 'react-hook-form'; import { TypographyProps } from '@mui/material/Typography'; import { CustomAutocompleteProps } from '../custom-auto-complete/CustomAutoComplete'; import { TextFieldProps } from '@mui/material/TextField'; import { ICustomCheckboxProps } from './components/UFCheckbox'; import { ICustomNumericInputProps } from '../custom-input/CustomNumericInput'; import { RadioProps } from '@mui/material/Radio'; import { CheckboxListProps } from "./checkbox-list/CheckboxList"; import { ICustomUploaderProps } from "../custom-uploader/CustomUploader"; import { RadioGroupProps } from "@mui/material"; import { FormControlLabelProps } from "@mui/material/FormControlLabel"; import { ICustomSwitchProps } from './components/UFSwitch'; import { ICustomDatePickerProps } from '../custom-date-picker/CustomDatePicker'; export interface IFormOption { value: string | number; label: string; labelProp?: any; disabled?: boolean; } interface IBaseForm { name: string; label: React.ReactNode; rules?: RegisterOptions; defaultValue?: any; placeholder?: string; gridItemProp?: GridProps; labelProps?: Partial> | undefined; helperText?: string; withoutHelperText?: boolean; variant?: 'outlined' | 'filled' | 'standard'; inputLabelMode?: TInputLabelMode; disabled?: boolean; readonly?: boolean; itemProps?: any; } export interface IRadioForm extends IBaseForm { type?: 'radio'; radioProps?: RadioProps; radioGroupProps?: Partial; formControlLabelProps?: Partial; options?: IFormOption[]; itemProps?: RadioProps; } export interface ISelectForm extends IBaseForm { type?: 'select'; props?: TextFieldProps; itemProps?: TextFieldProps; options?: IFormOption[]; } export interface IMultiSelectForm extends IBaseForm { type?: 'multi-select'; props?: Partial; itemProps?: Partial; options?: IFormOption[]; } export interface IAutoCompleteForm extends IBaseForm { type?: 'auto-complete'; isLoading?: boolean; props?: Partial; itemProps?: Partial; options?: IFormOption[]; onReachEnd?: () => void; onSearch?: (value: any) => void; } export interface ICheckboxForm extends IBaseForm { type?: 'checkbox'; props?: Partial; formControlLabelProps?: Partial; itemProps?: Partial; } export interface ISwitchForm extends IBaseForm { type?: 'switch'; props?: Partial; } export interface IDatePickerForm extends IBaseForm { type?: 'date-picker'; props?: Partial; itemProps?: Partial; } /** @deprecated Use IDatePickerForm */ export type IDatePickerMobileForm = IDatePickerForm; export interface ITimeForm extends IBaseForm { type?: 'time'; props?: Partial; hourProp?: Partial; minuteProp?: Partial; } export interface ITextAreaForm extends IBaseForm { type?: 'text-area'; props?: Partial; itemProps?: Partial; } export interface ICurrencyForm extends IBaseForm { type?: 'currency'; props?: Partial; itemProps?: Partial; currencyIcon?: ReactNode; } export interface IMultiCheckboxForm extends IBaseForm { options: IFormOption[]; type?: 'multi-checkbox'; multiple?: boolean; props?: Partial>; itemProps?: Partial>; } export interface IUploaderForm extends IBaseForm { type?: "uploader"; multiple?: boolean; onDelete?: (index: number) => void; props?: Partial; itemProps?: Partial; } export interface ITextFieldForm extends IBaseForm { type?: 'text' | 'email' | 'password' | 'number' | "tel"; props?: Partial; itemProps?: Partial; } export type TSchema = ITextFieldForm | ICurrencyForm | ITextAreaForm | IDatePickerForm | ITimeForm | ICheckboxForm | IAutoCompleteForm | IMultiSelectForm | ISelectForm | IRadioForm | ISwitchForm | IUploaderForm | IMultiCheckboxForm; export type TFormSchema = TSchema[]; export type TFormTheme = { text?: Partial; email?: Partial; password?: Partial; tel?: Partial; number?: Partial; uploader?: { uploaderProps?: Partial; }; multiCheckbox?: { multiCheckboxProps?: Partial>; }; currency?: { currencyProps?: Partial; }; textArea?: { textAreaProps?: Partial; }; datePicker?: { datePickerProps?: Partial; }; checkbox?: { checkboxProps?: Partial; formControlLabelProps?: Partial; }; autoComplete?: { autoCompleteProps?: Partial; }; multiSelect?: { multiSelectProps?: Partial; }; 'select'?: { selectProps: Partial; }; radio?: { radioProps?: Partial; radioGroupProps?: Partial; formControlLabelProps?: Partial; }; }; export type TInputLabelMode = 'static' | 'relative'; export {};