{"version":3,"file":"typeahead.d.ts","sources":["typeahead.d.ts"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA","sourcesContent":["import { ChangeDetectorRef, ComponentFactoryResolver, ElementRef, EventEmitter, Injector, NgZone, OnDestroy, OnInit, Renderer2, TemplateRef, ViewContainerRef, ApplicationRef } from '@angular/core';\r\nimport { ControlValueAccessor } from '@angular/forms';\r\nimport { Observable } from 'rxjs';\r\nimport { Live } from '../util/accessibility/live';\r\nimport { PlacementArray } from '../util/positioning';\r\nimport { NgbTypeaheadConfig } from './typeahead-config';\r\nimport { ResultTemplateContext } from './typeahead-window';\r\n/**\r\n * An event emitted right before an item is selected from the result list.\r\n */\r\nexport interface NgbTypeaheadSelectItemEvent {\r\n    /**\r\n     * The item from the result list about to be selected.\r\n     */\r\n    item: any;\r\n    /**\r\n     * Calling this function will prevent item selection from happening.\r\n     */\r\n    preventDefault: () => void;\r\n}\r\n/**\r\n * A directive providing a simple way of creating powerful typeaheads from any text input.\r\n */\r\nexport declare class NgbTypeahead implements ControlValueAccessor, OnInit, OnDestroy {\r\n    private _elementRef;\r\n    private _viewContainerRef;\r\n    private _renderer;\r\n    private _injector;\r\n    private _live;\r\n    private _document;\r\n    private _ngZone;\r\n    private _changeDetector;\r\n    private _applicationRef;\r\n    private _popupService;\r\n    private _subscription;\r\n    private _closed$;\r\n    private _inputValueBackup;\r\n    private _valueChanges;\r\n    private _resubscribeTypeahead;\r\n    private _windowRef;\r\n    private _zoneSubscription;\r\n    /**\r\n     * The value for the `autocomplete` attribute for the `<input>` element.\r\n     *\r\n     * Defaults to `\"off\"` to disable the native browser autocomplete, but you can override it if necessary.\r\n     *\r\n     * @since 2.1.0\r\n     */\r\n    autocomplete: string;\r\n    /**\r\n     * A selector specifying the element the typeahead popup will be appended to.\r\n     *\r\n     * Currently only supports `\"body\"`.\r\n     */\r\n    container: string;\r\n    /**\r\n     * If `true`, model values will not be restricted only to items selected from the popup.\r\n     */\r\n    editable: boolean;\r\n    /**\r\n     * If `true`, the first item in the result list will always stay focused while typing.\r\n     */\r\n    focusFirst: boolean;\r\n    /**\r\n     * The function that converts an item from the result list to a `string` to display in the `<input>` field.\r\n     *\r\n     * It is called when the user selects something in the popup or the model value changes, so the input needs to\r\n     * be updated.\r\n     */\r\n    inputFormatter: (item: any) => string;\r\n    /**\r\n     * The function that converts a stream of text values from the `<input>` element to the stream of the array of items\r\n     * to display in the typeahead popup.\r\n     *\r\n     * If the resulting observable emits a non-empty array - the popup will be shown. If it emits an empty array - the\r\n     * popup will be closed.\r\n     *\r\n     * See the [basic example](#/components/typeahead/examples#basic) for more details.\r\n     *\r\n     * Note that the `this` argument is `undefined` so you need to explicitly bind it to a desired \"this\" target.\r\n     */\r\n    ngbTypeahead: (text: Observable<string>) => Observable<any[]>;\r\n    /**\r\n     * The function that converts an item from the result list to a `string` to display in the popup.\r\n     *\r\n     * Must be provided, if your `ngbTypeahead` returns something other than `Observable<string[]>`.\r\n     *\r\n     * Alternatively for more complex markup in the popup you should use `resultTemplate`.\r\n     */\r\n    resultFormatter: (item: any) => string;\r\n    /**\r\n     * The template to override the way resulting items are displayed in the popup.\r\n     *\r\n     * See the [ResultTemplateContext](#/components/typeahead/api#ResultTemplateContext) for the template context.\r\n     *\r\n     * Also see the [template for results demo](#/components/typeahead/examples#template) for more details.\r\n     */\r\n    resultTemplate: TemplateRef<ResultTemplateContext>;\r\n    /**\r\n     * If `true`, will show the hint in the `<input>` when an item in the result list matches.\r\n     */\r\n    showHint: boolean;\r\n    /**\r\n     * The preferred placement of the typeahead.\r\n     *\r\n     * Possible values are `\"top\"`, `\"top-left\"`, `\"top-right\"`, `\"bottom\"`, `\"bottom-left\"`,\r\n     * `\"bottom-right\"`, `\"left\"`, `\"left-top\"`, `\"left-bottom\"`, `\"right\"`, `\"right-top\"`,\r\n     * `\"right-bottom\"`\r\n     *\r\n     * Accepts an array of strings or a string with space separated possible values.\r\n     *\r\n     * The default order of preference is `\"bottom-left bottom-right top-left top-right\"`\r\n     *\r\n     * Please see the [positioning overview](#/positioning) for more details.\r\n     */\r\n    placement: PlacementArray;\r\n    /**\r\n     * An event emitted right before an item is selected from the result list.\r\n     *\r\n     * Event payload is of type [`NgbTypeaheadSelectItemEvent`](#/components/typeahead/api#NgbTypeaheadSelectItemEvent).\r\n     */\r\n    selectItem: EventEmitter<NgbTypeaheadSelectItemEvent>;\r\n    activeDescendant: string;\r\n    popupId: string;\r\n    private _onTouched;\r\n    private _onChange;\r\n    constructor(_elementRef: ElementRef<HTMLInputElement>, _viewContainerRef: ViewContainerRef, _renderer: Renderer2, _injector: Injector, componentFactoryResolver: ComponentFactoryResolver, config: NgbTypeaheadConfig, ngZone: NgZone, _live: Live, _document: any, _ngZone: NgZone, _changeDetector: ChangeDetectorRef, _applicationRef: ApplicationRef);\r\n    ngOnInit(): void;\r\n    ngOnDestroy(): void;\r\n    registerOnChange(fn: (value: any) => any): void;\r\n    registerOnTouched(fn: () => any): void;\r\n    writeValue(value: any): void;\r\n    setDisabledState(isDisabled: boolean): void;\r\n    /**\r\n     * Dismisses typeahead popup window\r\n     */\r\n    dismissPopup(): void;\r\n    /**\r\n     * Returns true if the typeahead popup window is displayed\r\n     */\r\n    isPopupOpen(): boolean;\r\n    handleBlur(): void;\r\n    handleKeyDown(event: KeyboardEvent): void;\r\n    private _openPopup;\r\n    private _closePopup;\r\n    private _selectResult;\r\n    private _selectResultClosePopup;\r\n    private _showHint;\r\n    private _formatItemForInput;\r\n    private _writeInputValue;\r\n    private _subscribeToUserInput;\r\n    private _unsubscribeFromUserInput;\r\n}\r\n"]}