/*!
Trivial Components (https://github.com/trivial-components/trivial-components)

Copyright 2016 Yann Massard (https://github.com/yamass) and other contributors

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
import { EditingMode, RenderingFunction, TrivialComponent } from "./TrivialCore";
import { TrivialEvent } from "./TrivialEvent";
import { DropDownComponent } from "./dropdown/DropDownComponent";
export interface TrivialComboBoxConfig<E> {
    /**
     * Rendering function used to display a _selected_ entry
     * (i.e. an entry inside the editor area of the component, not the dropdown).
     *
     * @param entry
     * @return HTML string
     * @default `wrapWithDefaultTagWrapper(entryRenderingFunction(entry))`
     */
    selectedEntryRenderingFunction: RenderingFunction<E>;
    /**
     * Performance setting. Defines the maximum number of entries until which text highlighting is performed.
     * Set to `0` to disable text highlighting.
     *
     * @default `100`
     */
    textHighlightingEntryLimit?: number;
    /**
     * Whether or not to provide auto-completion.
     *
     * @default `true`
     */
    autoComplete?: boolean;
    /**
     * The number of milliseconds to wait until auto-completion is performed.
     *
     * @default `0`
     */
    autoCompleteDelay?: number;
    /**
     * Used to set the editor's text when focusing the component.
     * Additionally used to generate an autocompletion string for the current input of the user.
     *
     * @param entry the currently selected entry in the dropdown
     */
    entryToEditorTextFunction: (entry: E) => string;
    /**
     * Creates an entry (object) from a string entered by the user.
     *
     * @param freeText the text entered by the user
     * @default `{ displayValue: freeText, _isFreeTextEntry: true }`
     */
    textToEntryFunction?: (freeText: string) => E | any;
    /**
     * The clear button is a the small 'x' at the right of the entry display that can be clicked to clear the selection.
     */
    showClearButton?: boolean;
    /**
     * The trigger is the button on the right side of the component that can be clicket to open the dropdown.
     *
     * @default `true`
     */
    showTrigger?: boolean;
    editingMode?: EditingMode;
    /**
     * It `true`, opening the dropdown will be delayed until the result callback of the [[queryFunction]] is called.
     *
     * @default `false`
     */
    showDropDownOnResultsOnly?: boolean;
    /**
     * HTML string defining the spinner to be displayed while entries are being retrieved.
     */
    spinnerTemplate?: string;
    /**
     * When typing, preselect the first returned query result.
     */
    preselectFirstQueryResult?: boolean;
    /**
     * Text displayed when nothing has been selected/typed.
     */
    placeholderText?: string;
}
export declare class TrivialComboBox<E> implements TrivialComponent {
    readonly onSelectedEntryChanged: TrivialEvent<E>;
    readonly onFocus: TrivialEvent<void>;
    readonly onBlur: TrivialEvent<void>;
    readonly onBeforeQuery: TrivialEvent<string>;
    readonly onBeforeDownOpens: TrivialEvent<string>;
    private config;
    private $comboBox;
    private $dropDown;
    private $editor;
    private $selectedEntryWrapper;
    private $trigger;
    private $clearButton;
    private popper;
    private dropDownComponent;
    private selectedEntry;
    private blurCausedByClickInsideComponent;
    private autoCompleteTimeoutId;
    private doNoAutoCompleteBecauseBackspaceWasPressed;
    private editingMode;
    private dropDownOpen;
    private isEditorVisible;
    constructor(options: TrivialComboBoxConfig<E>, dropDownComponent?: DropDownComponent<E>);
    private getFreeTextEntry;
    private setAndSelectEditorValue;
    private handleDropDownValueChange;
    private query;
    private fireChangeEvents;
    setValue(entry: E, fireEventIfChanged?: boolean, originalEvent?: unknown): void;
    private isEntrySelected;
    private showEditor;
    private hideEditor;
    private parentElement;
    openDropDown(): void;
    closeDropDown(): void;
    private getEditorValueLeftOfSelection;
    private autoCompleteIfPossible;
    private isDropDownNeeded;
    setEditingMode(newEditingMode: EditingMode): void;
    getValue(): E;
    getDropDownComponent(): DropDownComponent<E>;
    setDropDownComponent(dropDownComponent: DropDownComponent<E>): void;
    focus(): void;
    getEditor(): Element;
    setShowClearButton(showClearButton: boolean): void;
    setShowTrigger(showTrigger: boolean): void;
    isDropDownOpen(): boolean;
    destroy(): void;
    getMainDomElement(): HTMLElement;
    setPlaceholderText(placeholderText: string): void;
}
