UNPKG

@nish1896/rhf-mui-components

Version:

A suite of 20+ production-ready react-hook-form components built with material-ui. Fully typed, tree-shakable, and optimized for enterprise-grade forms.

53 lines 1.75 kB
import { FormHelperTextProps, FormLabelProps } from "../../types/mui.js"; import { ReactNode } from "react"; import * as react_jsx_runtime0 from "react/jsx-runtime"; import { Control, FieldValues, Path, RegisterOptions } from "react-hook-form"; import { TextFieldProps } from "@mui/material/TextField"; import { ParsedCountry, UsePhoneInputConfig } from "react-international-phone"; //#region src/misc/phone-input/index.d.ts type PhoneInputChangeReturnValue = { phone: string; inputValue: string; country: ParsedCountry; }; type InputTextFieldProps = Omit<TextFieldProps, 'name' | 'value' | 'defaultValue' | 'onChange' | 'error' | 'inputRef' | 'type' | 'FormHelperTextProps'>; type PhoneInputProps = Omit<UsePhoneInputConfig, 'value' | 'onChange'> & { hideDropdown?: boolean; }; type RHFPhoneInputProps<T extends FieldValues> = { fieldName: Path<T>; control: Control<T>; registerOptions?: RegisterOptions<T, Path<T>>; value?: string; onValueChange?: (phoneData: PhoneInputChangeReturnValue) => void; showLabelAboveFormField?: boolean; formLabelProps?: FormLabelProps; errorMessage?: ReactNode; hideErrorMessage?: boolean; formHelperTextProps?: FormHelperTextProps; phoneInputProps?: PhoneInputProps; } & InputTextFieldProps; declare const RHFPhoneInput: <T extends FieldValues>({ fieldName, control, registerOptions, required, value, onValueChange, label, showLabelAboveFormField, formLabelProps, helperText, errorMessage, hideErrorMessage, formHelperTextProps, disabled: muiDisabled, phoneInputProps, slotProps, onBlur, autoComplete, InputProps, ...rest }: RHFPhoneInputProps<T>) => react_jsx_runtime0.JSX.Element; //#endregion export { RHFPhoneInputProps, RHFPhoneInput as default };