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.

62 lines (61 loc) 2.74 kB
import { KeyValueOption } from "../../types/common.js"; import { AutoCompleteTextFieldProps, CheckboxProps, FormControlLabelProps, FormHelperTextProps, FormLabelProps, MuiChipProps } 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 { AutocompleteProps } from "@mui/material/Autocomplete"; //#region src/mui/multi-autocomplete-object/index.d.ts type MultiAutoCompleteProps<Option> = Omit<AutocompleteProps<Option, true, false, false>, 'freeSolo' | 'fullWidth' | 'renderInput' | 'renderOption' | 'options' | 'value' | 'defaultValue' | 'multiple' | 'onChange' | 'getOptionKey' | 'getOptionLabel' | 'isOptionEqualToValue' | 'autoHighlight' | 'disableCloseOnSelect' | 'ChipProps'>; type RHFMultiAutocompleteObjectProps<T extends FieldValues, Option extends KeyValueOption = KeyValueOption, 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; selectAllText?: string; onValueChange?: (fieldValue: Option[], targetValue?: Option) => void; label?: ReactNode; showLabelAboveFormField?: boolean; formLabelProps?: FormLabelProps; checkboxProps?: CheckboxProps; formControlLabelProps?: FormControlLabelProps; required?: boolean; helperText?: ReactNode; errorMessage?: ReactNode; hideErrorMessage?: boolean; formHelperTextProps?: FormHelperTextProps; textFieldProps?: AutoCompleteTextFieldProps; ChipProps?: MuiChipProps; hideSelectAllOption?: boolean; } & MultiAutoCompleteProps<Option>; declare const RHFMultiAutocompleteObject: <T extends FieldValues, Option extends KeyValueOption = KeyValueOption, 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, selectAllText, onValueChange, disabled: muiDisabled, label, showLabelAboveFormField, formLabelProps, checkboxProps, formControlLabelProps, required, helperText, errorMessage, hideErrorMessage, formHelperTextProps, textFieldProps, slotProps, ChipProps, onBlur, loading, hideSelectAllOption, ...otherAutoCompleteProps }: RHFMultiAutocompleteObjectProps<T, Option, LabelKey, ValueKey>) => react_jsx_runtime0.JSX.Element; //#endregion export { RHFMultiAutocompleteObjectProps, RHFMultiAutocompleteObject as default };