/**
 * Copyright (c) Adaptavist, Inc.
 */
import { GenericProps } from '@/src/utilities';
import { HTMLAttributes } from 'react';
import { MenuOption } from '../menu';
export interface IOnChangeProps {
    /**
     * If provided, it will be returned.
     */
    name?: string;
    /**
     * The value of the option selected from the dropdown
     */
    value: string | string[];
}
export interface IInnerSelect extends GenericProps {
    /**
     * Providing name will only be returned along with the option value selected
     */
    placeholder?: string;
    name?: string;
    mode?: 'multiple';
    error?: boolean;
    /**
     * Id can be used to rectify accessibility issue in a scenario where two or more of this component is present in the `DOM`
     */
    id?: string;
    disabled?: boolean;
    /**
     * Specifying this will make the `Select` searchable
     */
    search?: boolean;
    /**
     * Specify the height of the `Select` dropdown in px e.g 256 = 256px
     */
    dropdownHeight?: number;
    style?: React.CSSProperties;
}
export interface IStyledSelect extends React.InputHTMLAttributes<HTMLInputElement>, IInnerSelect, GenericProps {
    iconPresent?: boolean;
    search?: boolean;
    focus?: boolean;
}
export interface ISelect extends IInnerSelect, Omit<HTMLAttributes<HTMLDivElement>, 'onChange'>, GenericProps {
    /**
     * Providing this value will utter which option is selected
     */
    value?: string;
    /**
     * This will select the option specified and will not utter which option is selected after the `Select` is displayed
     */
    defaultValue?: string | string[];
    /**
     * This is `true` by default for multiple selection
     */
    clearButton?: boolean;
    reset?: boolean;
    onBlur?: (props: React.FocusEvent<HTMLInputElement>) => void;
    onChange?: (props: IOnChangeProps) => void;
}
export interface IOption extends React.OptionHTMLAttributes<HTMLLIElement>, MenuOption, GenericProps {
    value: string;
}
export interface ISelected {
    value: string;
    label: string;
}
export interface ISelectState {
    value?: string;
    label: React.ReactNode | string;
    searchValue: string;
    selected: ISelected[];
}
export interface ICheckSelected {
    params: IOption;
    state: ISelectState;
    mode?: 'multiple';
}
export interface IShareSelectState {
    selectState: ISelectState;
    setSelectState: React.Dispatch<React.SetStateAction<ISelectState>>;
}
export interface IHandleMultipleSelect {
    selectState: ISelectState;
    setSelectState: React.Dispatch<React.SetStateAction<ISelectState>>;
    event: IOption;
    onChange?: (props: IOnChangeProps | IOnChangeProps) => void;
    name?: string;
}
export interface IOnSelectChange extends IHandleMultipleSelect {
    setOpenSelect: React.Dispatch<React.SetStateAction<boolean>>;
    mode?: 'multiple';
    setShowSearchIcon: React.Dispatch<React.SetStateAction<boolean>>;
}
export interface IHandleSearch extends Omit<IShareSelectState, 'selectState'> {
    event: React.ChangeEvent<HTMLInputElement>;
    searchInputRef: React.RefObject<HTMLInputElement>;
    setOpenSelect: React.Dispatch<React.SetStateAction<boolean>>;
    mode?: 'multiple';
}
export interface IResetSelect extends Pick<IShareSelectState, 'setSelectState'> {
    onChange?: (props: IOnChangeProps | IOnChangeProps) => void;
    name?: string;
}
export interface IRemoveSelectedOption extends IShareSelectState {
    value: string;
    name?: string;
    onChange?: (props: IOnChangeProps | IOnChangeProps) => void;
}
export interface IChangeSelectOptionsPosition {
    selectNode: React.MutableRefObject<HTMLDivElement>;
    dropdownHeight: number;
    options: (React.ReactChild | React.ReactFragment | React.ReactPortal)[];
    setMoveOptionsTops: React.Dispatch<React.SetStateAction<boolean>>;
}
export interface IOptionsContainer extends GenericProps {
    open: boolean;
    moveUp: boolean;
    dropdownHeight: number;
}
