UNPKG

@appello/web-ui

Version:

Web ui library for a better development experience

18 lines (17 loc) 2.52 kB
import * as React from 'react'; import { ForwardedRef, ReactElement } from 'react'; import { Control, FieldPath, FieldPathByValue, FieldPathValue, FieldValues } from 'react-hook-form'; import { FieldProps } from '../../../components/form/Field'; import { SelectOptionType, SelectProps, SelectRefProps, 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 BaseSelectField: <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>, ref?: ForwardedRef<SelectRefProps<TValue, TIsMulti>>) => React.ReactElement; 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> & { ref?: ForwardedRef<SelectRefProps<TValue, TIsMulti>>; }) => ReactElement; export {};