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.

42 lines (41 loc) 1.51 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 { DatePickerProps, DateValidationError, PickerChangeHandlerContext, PickerValidDate } from "@mui/x-date-pickers"; //#region src/mui-pickers/date/index.d.ts type DatePickerInputProps = Omit<DatePickerProps<PickerValidDate>, 'name' | 'value' | 'defaultValue'>; type RHFDatePickerProps<T extends FieldValues> = { fieldName: Path<T>; control: Control<T>; registerOptions?: RegisterOptions<T, Path<T>>; required?: boolean; onValueChange?: (newValue: PickerValidDate, context: PickerChangeHandlerContext<DateValidationError>) => void; showLabelAboveFormField?: boolean; formLabelProps?: FormLabelProps; helperText?: ReactNode; errorMessage?: ReactNode; hideErrorMessage?: boolean; formHelperTextProps?: FormHelperTextProps; } & DatePickerInputProps; declare const RHFDatePicker: <T extends FieldValues>({ fieldName, control, registerOptions, required, onValueChange, disabled: muiDisabled, label, showLabelAboveFormField, formLabelProps, helperText, errorMessage, hideErrorMessage, formHelperTextProps, slotProps: muiSlotProps, onChange: muiOnChange, onAccept: muiOnAccept, ...rest }: RHFDatePickerProps<T>) => react_jsx_runtime0.JSX.Element; //#endregion export { RHFDatePickerProps, RHFDatePicker as default };