import { AutocompleteChangeReason as MuiAutocompleteChangeReason, AutocompleteRenderGroupParams } from '@material-ui/lab';
import { ChangeEvent, MouseEventHandler, ReactNode } from 'react';
import { MenuItemProps } from '../Menu/MenuItem';
import { TextInputNextProps } from '../TextInputNext';
import { TextInputProps } from '../TextInput';
import { AutocompleteOption } from './utils';
type ChangeReason = MuiAutocompleteChangeReason | 'select-option-all' | 'remove-option-all';
type AutocompleteBaseProps<T extends AutocompleteOption = AutocompleteOption, Multiple extends boolean | undefined = false> = {
    /**
     * Options to allow selection from. Has to be assignable to `{ id: string | number; title: string; prefix?: ReactNode; }[]`
     */
    options?: T[];
    /**
     * Selected value. If `multiple` is `false | undefined`, and the value is an array, only the first element will be used
     *
     * There's a [bug in TS](https://github.com/microsoft/TypeScript/issues/47599) which causes `onChange` prop
     * to have incorrect typing if we mix T and T['id'] in `value`. Therefore, we can't use the "correct" typing
     * ```
     * value?: T['id'] | T | (T['id'] | T)[];
     * ```
     *
     * You may need to provide additional typings
     */
    value?: string | number | T | (string | number | T)[];
    /**
     * If `true`, the component will support multiple selection
     */
    multiple?: Multiple;
    /**
     * Selection change handler
     * Receives an array of options if `multiple` is `true`, a single selected option or `undefined` otherwise
     */
    onChange?: (value: Multiple extends undefined | false ? T | undefined : T[], reason: ChangeReason, event?: ChangeEvent<unknown>) => void;
    label?: ReactNode;
    placeholder?: string;
    /**
     * Controls the size of the options rendered
     */
    optionSize?: MenuItemProps['size'];
    disabled?: boolean;
    /**
     * If exists - allows user to create own options. Called when 'Add "whatever"' option is selected
     */
    onCreate?: (title: string) => void;
    prefix?: ReactNode;
    loading?: boolean;
    showPopupIcon?: boolean;
    /**
     * Controls the "Clear" button that's shown to the right if there is a value
     */
    clearable?: boolean;
    /**
     * Controls if the field should keep/gain focus after "Clear" button is clicked
     */
    focusOnClear?: boolean;
    /**
     * Triggered when user types something
     */
    onInputChange?: (value: string, event: ChangeEvent<HTMLInputElement>) => void;
    status?: TextInputNextProps['status'];
    message?: TextInputNextProps['message'];
    size?: TextInputNextProps['size'];
    labelPlacement?: TextInputNextProps['labelPlacement'];
    /**
     * Makes internal text field readonly, effectively turning component into a simple `<select/>`
     */
    disableFiltering?: boolean;
    renderOption?: (item: T) => ReactNode;
    /**
     * Message to show when there are no options
     */
    noOptionsMessage?: ReactNode;
    spacing?: TextInputProps['spacing'];
    /**
     * Function that filters options based on input value
     */
    filterOptions?: (options: T[], inputValue: string) => T[];
    /**
     * Function that determines if an option is disabled. Used to override the default
     * @param option
     */
    getOptionDisabled?: (option: T) => boolean;
    /**
     * If `multiple === true` shows an "All" option that selects/deselects all options
     */
    useAllOption?: boolean;
    /**
     * Used to render selected values when `multiple === true`
     */
    renderSelected?: (data: {
        option: T;
        onDelete: MouseEventHandler;
    }[], options: {
        useAllOption: boolean;
        allOptions: T[];
    }) => ReactNode;
    /**
     * Defines option grouping
     */
    groupBy?: (option: T) => string;
    /**
     * Group render override
     */
    renderGroup?: (props: AutocompleteRenderGroupParams) => ReactNode;
    /**
     * A classname that will be applied to dropdown (`<Paper/>` component)
     */
    dropdownClassName?: string;
    type?: 'default' | 'search';
    className?: string;
    testId?: string;
    /**
     * Escape hatch to fine-tune the styling of underlying elements
     */
    elementsClassNames?: TextInputNextProps['elementsClassNames'];
    /**
     * Custom listbox component for rendering options (e.g., virtualized list)
     */
    listboxComponent?: React.ComponentType<React.HTMLAttributes<HTMLElement>>;
    isNext?: boolean;
};
export type AutocompleteChangeHandler<Option extends AutocompleteOption = AutocompleteOption, Multiple extends boolean | undefined = false> = Required<AutocompleteBaseProps<Option, Multiple>>['onChange'];
/**
 * @deprecated use `AutocompleteNext`, and see migration guide for `TextInputNext` for details
 */
export type AutocompleteProps<T extends AutocompleteOption = AutocompleteOption, Multiple extends boolean | undefined = false> = Omit<AutocompleteBaseProps<T, Multiple>, 'size' | 'labelPlacement' | 'elementsClassNames' | 'isNext'>;
/**
 * @deprecated use `AutocompleteNext`, and see migration guide for `TextInputNext` for details
 */
export declare const Autocomplete: <T extends AutocompleteOption, Multiple extends boolean | undefined = false>(props: AutocompleteProps<T, Multiple>) => JSX.Element;
export type AutocompleteNextProps<T extends AutocompleteOption = AutocompleteOption, Multiple extends boolean | undefined = false> = Omit<AutocompleteBaseProps<T, Multiple>, 'type' | 'spacing' | 'isNext'>;
export declare const AutocompleteNext: {
    <T extends AutocompleteOption, Multiple extends boolean | undefined = false>(props: AutocompleteNextProps<T, Multiple>): JSX.Element;
    selectedValueRenderers: {
        default: (data: {
            option: AutocompleteOption;
            onDelete: MouseEventHandler;
        }[], options: {
            useAllOption: boolean;
            allOptions: AutocompleteOption[];
        }) => ReactNode;
        chipsMultiline: (data: {
            option: AutocompleteOption;
            onDelete: MouseEventHandler;
        }[], options: {
            useAllOption: boolean;
            allOptions: AutocompleteOption[];
        }) => ReactNode;
    };
};
export {};
//# sourceMappingURL=Autocomplete.d.ts.map