UNPKG

@appello/web-ui

Version:

Web ui library for a better development experience

14 lines (13 loc) 1.88 kB
import * as React from 'react'; import { Control, FieldPath, FieldPathByValue, FieldPathValue, FieldValues } from 'react-hook-form'; import { FieldProps } from '../../../components/form/Field'; import { SelectOptionType, SelectProps, SelectValueType } from '../../../components/form/Select'; type AllowedSelectProps<TValue, TIsMulti extends boolean, TIsClearable extends boolean, TIsCreatable extends boolean> = Pick<SelectProps<TValue, TIsMulti, TIsClearable, TIsCreatable>, 'inputSize' | 'isMulti' | 'placeholder' | 'isClearable' | 'isCreatable' | 'disabled' | 'components' | 'hideSelectedOptions' | 'isSearchable' | 'multiValueContent' | 'variantMulti' | 'menuPortalTarget' | 'closeMenuOnScroll' | 'formatOptionLabel' | 'onBlur' | 'menuPlacement' | 'maxMenuHeight'>; export interface SelectFieldProps<TFormValues extends FieldValues, TName extends FieldPath<TFormValues>, TValue, TIsMulti extends boolean, TIsClearable extends boolean, TIsCreatable extends boolean> extends AllowedSelectProps<TValue, TIsMulti, TIsClearable, TIsCreatable>, Pick<FieldProps, 'label' | 'className' | 'required' | 'labelChildren' | 'labelClassName'> { name: TName; control: Control<TFormValues>; options: SelectOptionType<FieldPathValue<TFormValues, TName>>[]; isOptionDisabled?: (option: SelectOptionType<FieldPathValue<TFormValues, TName>>, options: SelectOptionType<FieldPathValue<TFormValues, TName>>[]) => boolean; } export declare const SelectField: <TFormValues extends FieldValues, TName extends FieldPathByValue<TFormValues, SelectValueType<TValue, TIsMulti, TIsClearable, TIsCreatable>>, TValue extends FieldPathValue<TFormValues, TName>, TIsMulti extends boolean = false, TIsClearable extends boolean = false, TIsCreatable extends boolean = false>(props: SelectFieldProps<TFormValues, TName, TValue, TIsMulti, TIsClearable, TIsCreatable>) => React.ReactElement; export {};