UNPKG

mui-rff

Version:

Set of modern wrapper components to facilitate using Material UI with React Final Form

30 lines (29 loc) 1.8 kB
import { TextFieldProps as MuiTextFieldProps } from '@mui/material'; import { FieldProps, FieldRenderProps } from 'react-final-form'; import { ShowErrorFunc } from './Util'; export declare const TYPE_PASSWORD = "password"; export declare const TYPE_TEXT = "text"; export declare const TYPE_EMAIL = "email"; export declare const TYPE_NUMBER = "number"; export declare const TYPE_URL = "url"; export declare const TYPE_TELEPHONE = "tel"; export declare const TYPE_DATE = "date"; export declare const TYPE_DATETIME_LOCAL = "datetime-local"; export declare const TYPE_MONTH = "month"; export declare const TYPE_TIME = "time"; export declare const TYPE_WEEK = "week"; export declare const TYPE_COLOR = "color"; export type TEXT_FIELD_TYPE = typeof TYPE_PASSWORD | typeof TYPE_TEXT | typeof TYPE_EMAIL | typeof TYPE_NUMBER | typeof TYPE_URL | typeof TYPE_TELEPHONE | typeof TYPE_DATE | typeof TYPE_DATETIME_LOCAL | typeof TYPE_MONTH | typeof TYPE_TIME | typeof TYPE_WEEK | typeof TYPE_COLOR; export type TextFieldProps = Partial<Omit<MuiTextFieldProps, 'type' | 'onChange'>> & { name: string; type?: TEXT_FIELD_TYPE; fieldProps?: Partial<FieldProps<any, any>>; showError?: ShowErrorFunc; }; export declare function TextField({ name, type, fieldProps, showError, fullWidth, ...rest }: TextFieldProps): import("react/jsx-runtime").JSX.Element; interface TextFieldWrapperProps extends Omit<TextFieldProps, 'type' | 'value' | 'onChange' | 'onBlur' | 'onFocus'> { fieldRenderProps: FieldRenderProps; showError: ShowErrorFunc; } export declare function TextFieldWrapper({ fieldRenderProps: { input: { value, type, onChange, onBlur, onFocus, ...restInput }, meta, }, helperText, showError, slotProps, ...rest }: TextFieldWrapperProps): import("react/jsx-runtime").JSX.Element; export {};