import { InputTexts } from "@helpers/types"; import { ReactNode } from "react"; import { FormatOptionLabelMeta, OptionProps, MenuPlacement, MenuPosition, PropsValue, ControlProps, DropdownIndicatorProps, SingleValue, MultiValue, GroupBase, StylesConfig, OptionsOrGroups, ValueContainerProps } from "react-select"; import { IDropdownOption, OptionVariants } from "../../Dropdown.interface"; export interface ISingleSelectDropdownProps { onSelect: (items: SingleValue) => void; } export interface IMultiSelectDropdownProps { onSelect: (items: MultiValue) => void; } export interface ICommonSelectDropdownProps extends InputTexts, ISelectDropdownStateManagerProps, ISelectProps { id: string; isMulti?: boolean; options: OptionsOrGroups>; variant?: OptionVariants; hideSelectedOptions?: boolean; placeholderText?: string; disabled?: boolean; instanceId?: string; isClearable?: boolean; isLoading?: boolean; isSearchable?: boolean; noOptionsMessage?: ReactNode; formatGroupLabel?: (data: GroupBase) => ReactNode; customStylesOverrides?: () => StylesConfig>; onInputChange?: (inputValue: string) => void; prefixIcon?: ReactNode; areAllMultiValuesShown?: boolean; } export type ISelectDropdownProps = ICommonSelectDropdownProps & (ISingleSelectDropdownProps | IMultiSelectDropdownProps); interface ISelectDropdownStateManagerProps { defaultInputValue?: string; defaultMenuIsOpen?: boolean; defaultValue?: null | IDropdownOption | ReadonlyArray; } export interface ISelectProps { form?: string; autoFocus?: boolean; backspaceRemovesValue?: boolean; blurInputOnSelect?: boolean; closeMenuOnSelect?: boolean; closeMenuOnScroll?: boolean; controlShouldRenderValue?: boolean; delimiter?: string; escapeClearsValue?: boolean; inputId?: string; isRtl?: boolean; minMenuHeight?: number; maxMenuHeight?: number; menuPlacement?: MenuPlacement; menuPosition?: MenuPosition; menuPortalTarget?: HTMLElement | null; menuShouldScrollIntoView?: boolean; name?: string; openMenuOnFocus?: boolean; openMenuOnClick?: boolean; pageSize?: number; tabIndex?: number; tabSelectsValue?: boolean; required?: boolean; inputValue?: string; value?: PropsValue | undefined; filterOption?: (option: { label: string; value: string; data: IDropdownOption; }, inputValue: string) => boolean; getOptionLabel?: (option: IDropdownOption) => string; getOptionValue?: (option: IDropdownOption) => string; formatOptionLabel?: (data: IDropdownOption, formatOptionLabelMeta: FormatOptionLabelMeta) => ReactNode; loadingMessage?: (obj: { inputValue: string; }) => ReactNode; onKeyDown?: React.KeyboardEventHandler; onMenuScrollToTop?: (event: WheelEvent | TouchEvent) => void; onMenuScrollToBottom?: (event: WheelEvent | TouchEvent) => void; } export interface ISelectDropdownOptionProps { option: OptionProps; variant: OptionVariants; formatOptionLabel?: (data: IDropdownOption, formatOptionLabelMeta: FormatOptionLabelMeta) => ReactNode; } export interface IDropdownControlProps extends ControlProps { isError?: boolean; } export interface IDropdownIndicatorProps extends DropdownIndicatorProps { isHidden?: boolean; } export interface IValueContainerProps extends ValueContainerProps { areAllMultiValuesShown?: boolean; } export {};