@nish1896/rhf-mui-components
Version:
A suite of 20+ reusable Material UI components for React Hook Form to minimize your time and effort in creating and styling forms
22 lines (21 loc) • 1.35 kB
TypeScript
import { type ReactNode } from 'react';
import { type FieldValues, type Path, type Control, type RegisterOptions } from 'react-hook-form';
import { type TimePickerProps, type PickerValidDate, type TimeValidationError, type PickerChangeHandlerContext } from '@mui/x-date-pickers';
import type { FormLabelProps, FormHelperTextProps } from '../../types';
type TimePickerInputProps = Omit<TimePickerProps<PickerValidDate>, 'value' | 'onChange' | 'label'>;
export type RHFTimePickerProps<T extends FieldValues> = {
fieldName: Path<T>;
control: Control<T>;
registerOptions?: RegisterOptions<T, Path<T>>;
required?: boolean;
onValueChange?: (newValue: PickerValidDate, context: PickerChangeHandlerContext<TimeValidationError>) => void;
label?: ReactNode;
showLabelAboveFormField?: boolean;
formLabelProps?: FormLabelProps;
helperText?: ReactNode;
errorMessage?: ReactNode;
hideErrorMessage?: boolean;
formHelperTextProps?: FormHelperTextProps;
} & TimePickerInputProps;
declare const RHFTimePicker: <T extends FieldValues>({ fieldName, control, registerOptions, required, onValueChange, label, showLabelAboveFormField, formLabelProps, helperText, errorMessage, hideErrorMessage, formHelperTextProps, ...rest }: RHFTimePickerProps<T>) => import("react/jsx-runtime").JSX.Element;
export default RHFTimePicker;