/**
 * Copyright (c) Adaptavist, Inc.
 */
import { ComponentPropsWithoutRef } from 'react';
import { GenericProps } from '../../utilities';
import { MenuOption } from '../menu';
export interface ISelectOnChangeProps {
    /**
     * Prop to set a custom title.
     *
     * If provided, it will be returned.
     *
     * Default is `an empty string`.
     */
    name?: string;
    /**
     * Prop to set the value of the option selected from the dropdown.
     *
     * Default is `an empty object or string`.
     */
    value: string | string[];
}
export type IInnerSelect = GenericProps & {
    /**
     * Prop to set if the selection should be disabled or not.
     *
     * If set to true, the selection will be disabled.
     * If set to false, nothing will happen.
     *
     * Default is `false`.
     */
    disabled?: boolean;
    /**
     * Prop to specify the height of the Select dropdown in px.
     *
     * For instance, `256 = 256px`.
     *
     * Default is `0`.
     */
    dropdownHeight?: number;
    /**
     * Prop to set if the selection should throw an error state.
     *
     * If set to true, the selection will throw an error.
     * If set to false, nothing will happen.
     *
     * Default is `false`.
     */
    error?: boolean;
    /**
     * Prop to set a unique ID for the selection.
     *
     * This can be used to rectify accessibility issues in a scenario where two or more
     * of this component is present in the `DOM`.
     *
     * Default is `an empty string`.
     */
    id?: string;
    /**
     * Prop to set the mode of the inner selection.
     *
     * Default is `multiple`.
     */
    mode?: 'multiple';
    /**
     * Prop to set a custom title.
     *
     * Default is `an empty string`.
     */
    name?: string;
    /**
     * Prop to set a placeholder.
     *
     * Providing a name will only be returned along with the option value selected.
     *
     * Default is `an empty string`.
     */
    placeholder?: string;
    /**
     * Prop used to specify if this selection will be searchable.
     *
     * If set to true, the selection will be searchable.
     * If set to false, the selection will not be searchable.
     *
     * Default is `false`.
     */
    search?: boolean;
    /**
     * Prop to set custom styles on the dropdown.
     *
     * Default is `an empty string`.
     */
    style?: React.CSSProperties;
};
export type IStyledSelect = React.ComponentPropsWithoutRef<'input'> & IInnerSelect & GenericProps & {
    /**
     * Prop to set if the select should be focused.
     *
     * If set to true, the select will be focused.
     * If set to false, the select won't be focused.
     *
     * Default is `undefined`.
     */
    focus?: boolean;
    /**
     * Prop to set if an icon should be present.
     *
     * If set to true, an icon will render.
     * If set to false, no icon will render.
     */
    iconPresent?: boolean;
    /**
     * Prop to set if the select is searchable.
     *
     * If set to true, the select will be searchable.
     * If set to false, the select won't be searchable.
     *
     * Default is `undefined`.
     */
    search?: boolean;
    /**
     * Prop to set if the selection should be disabled or not.
     *
     * If set to true, the selection will be disabled.
     * If set to false, nothing will happen.
     *
     * Default is `false`.
     */
    disabled?: boolean;
};
export type ISelect = IInnerSelect & Omit<ComponentPropsWithoutRef<'div'>, 'onChange'> & GenericProps & {
    /**
     * Prop to set if the clear button should be visible.
     *
     * This is `true` by default for multiple selection.
     *
     * If set to true, the clear button will be visible.
     * If set to false, the clear button will not be visible.
     *
     * Default is `true`.
     */
    clearButton?: boolean;
    /**
     * Prop to set the default value.
     *
     * This will select the option specified and will not utter which option is
     * selected after the `Select` is displayed.
     *
     * Default is `an empty object or string`.
     */
    defaultValue?: string | string[];
    /**
     * Function to handle blur effects.
     *
     * Default is `an empty object`.
     */
    onBlur?: (props: React.FocusEvent<HTMLInputElement>) => void;
    /**
     * Function to handle onChange effects.
     *
     * Default is `an empty object`.
     */
    onChange?: (props: ISelectOnChangeProps) => void;
    /**
     * Prop to set if the reset button should be visible.
     *
     * If set to true, the reset button will be visible.
     * If set to false, the reset button will not be visible.
     *
     * Default is `false`.
     */
    reset?: boolean;
    /**
     * Prop to set a custom value.
     *
     * Providing this value will utter which option is selected.
     *
     * Default is `an empty string`.
     */
    value?: string;
};
export type IOption = React.ComponentPropsWithoutRef<'li'> & 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: ISelectOnChangeProps | ISelectOnChangeProps) => void;
    name?: string;
}
export type IOnSelectChange = IHandleMultipleSelect & {
    setOpenSelect: React.Dispatch<React.SetStateAction<boolean>>;
    mode?: 'multiple';
    setShowSearchIcon: React.Dispatch<React.SetStateAction<boolean>>;
};
export type IHandleSearch = 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: ISelectOnChangeProps | ISelectOnChangeProps) => void;
    name?: string;
}
export type IRemoveSelectedOption = IShareSelectState & {
    value: string;
    name?: string;
    onChange?: (props: ISelectOnChangeProps | ISelectOnChangeProps) => void;
};
export interface IChangeSelectOptionsPosition {
    selectNode: React.MutableRefObject<HTMLDivElement>;
    dropdownHeight: number;
    options: (React.ReactChild | React.ReactFragment | React.ReactPortal)[];
    setMoveOptionsTops: React.Dispatch<React.SetStateAction<boolean>>;
}
export type IOptionsContainer = GenericProps & {
    open: boolean;
    moveUp: boolean;
    dropdownHeight: number;
};
