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.

51 lines (50 loc) 2.17 kB
import { OptionValue, StrNumObjOption } from "../../types/common.js"; import { CheckboxProps, FormControlLabelProps, FormHelperTextProps, FormLabelProps } from "../../types/mui.js"; import { ChangeEvent, FocusEvent, ReactNode } from "react"; import * as react_jsx_runtime0 from "react/jsx-runtime"; import { Control, FieldValues, Path, RegisterOptions } from "react-hook-form"; //#region src/mui/checkbox-group/index.d.ts type RHFCheckboxGroupProps<T extends FieldValues, Option extends StrNumObjOption = StrNumObjOption, LabelKey extends Extract<keyof Option, string> = Extract<keyof Option, string>, ValueKey extends Extract<keyof Option, string> = Extract<keyof Option, string>> = { fieldName: Path<T>; control: Control<T>; registerOptions?: RegisterOptions<T, Path<T>>; options: Option[]; labelKey?: LabelKey; valueKey?: ValueKey; onValueChange?: (selectedItemValue: OptionValue<Option, ValueKey>, newValue: OptionValue<Option, ValueKey>[], event: ChangeEvent<HTMLInputElement>) => void; disabled?: boolean; label?: ReactNode; showLabelAboveFormField?: boolean; formLabelProps?: FormLabelProps; checkboxProps?: CheckboxProps; formControlLabelProps?: FormControlLabelProps; required?: boolean; helperText?: ReactNode; errorMessage?: ReactNode; hideErrorMessage?: boolean; formHelperTextProps?: FormHelperTextProps; onBlur?: (event: FocusEvent<HTMLDivElement, Element>) => void; }; declare const RHFCheckboxGroup: <T extends FieldValues, Option extends StrNumObjOption = StrNumObjOption, LabelKey extends Extract<keyof Option, string> = Extract<keyof Option, string>, ValueKey extends Extract<keyof Option, string> = Extract<keyof Option, string>>({ fieldName, control, registerOptions, options, labelKey, valueKey, onValueChange, disabled: muiDisabled, label, showLabelAboveFormField, formLabelProps, checkboxProps, formControlLabelProps, required, helperText, errorMessage, hideErrorMessage, formHelperTextProps, onBlur }: RHFCheckboxGroupProps<T, Option, LabelKey, ValueKey>) => react_jsx_runtime0.JSX.Element; //#endregion export { RHFCheckboxGroupProps, RHFCheckboxGroup as default };