import { FocusableOption, FocusOrigin, LiveAnnouncer, ActiveDescendantKeyManager } from '@angular/cdk/a11y';
import * as i0 from '@angular/core';
import { AfterViewInit, AfterViewChecked, OnDestroy, EventEmitter, QueryList, ElementRef, ChangeDetectorRef, InjectionToken, Signal, DestroyRef, OnInit, TemplateRef, AfterContentInit, OnChanges, ViewContainerRef, Injector, SimpleChanges } from '@angular/core';
import { Subject, Observable } from 'rxjs';
import { ListTitleDirective } from '@fundamental-ngx/core/list';
import { MobileMode, MobileModeConfig, MobileModeBase } from '@fundamental-ngx/core/mobile-mode';
import * as i1 from '@fundamental-ngx/core/dialog';
import * as i2 from '@fundamental-ngx/core/button';
import { SelectionModel } from '@angular/cdk/collections';
import { ScrollStrategy, CdkConnectedOverlay } from '@angular/cdk/overlay';
import { ControlValueAccessor, NgControl } from '@angular/forms';
import { ModuleDeprecation, Nullable, DynamicComponentService } from '@fundamental-ngx/cdk/utils';
import { FormItemControl } from '@fundamental-ngx/core/form';
import { PopoverFillMode } from '@fundamental-ngx/core/shared';
import { SingleDropdownValueControl, FormStates, FormFieldAdvancedStateMessage } from '@fundamental-ngx/cdk/forms';
import { ContentDensityObserver } from '@fundamental-ngx/core/content-density';
import { IconFont } from '@fundamental-ngx/core/icon';

interface OptionsInterface {
    value: string;
    active: boolean;
    viewValue: string;
    id: string;
    _selectViaInteraction(): void;
}

/**
 * Event object emitted by OptionComponent when
 * selected or deselected.
 */
declare class FdOptionSelectionChange {
    /** Reference to the option that emitted the event. */
    readonly source: OptionComponent;
    /** Whether the change in the option's value was a result of a user action. */
    readonly isUserInput: boolean;
    /**
     * Reference to the OptionComponent that emitted the event.
     * @param source The option that emitted the event.
     * @param isUserInput Whether the change in the option's value was a result of a user interaction.
     */
    constructor(
    /** Reference to the option that emitted the event. */
    source: OptionComponent, 
    /** Whether the change in the option's value was a result of a user action. */
    isUserInput?: boolean);
}
/**
 * Used to represent an option of the select component.
 */
declare class OptionComponent implements AfterViewInit, AfterViewChecked, OnDestroy, FocusableOption, OptionsInterface {
    private _elementRef;
    private _changeDetectorRef;
    /** Option id attribute */
    id: string;
    /** Value of the option. Similar to how a native select operates. */
    value: any;
    /** Whether to disable this option specifically. */
    disabled: boolean;
    /**
     * Emits event when option is selected or deselected.
     */
    readonly selectionChange: EventEmitter<FdOptionSelectionChange>;
    /** @hidden */
    selected: boolean;
    /** @Hidden */
    _listTitleDirectives: QueryList<ListTitleDirective> | undefined;
    /** @hidden */
    _renderer: 'plain' | 'title';
    /**
     * The displayed value of the option. It shows the selected option in the select's trigger.
     */
    get viewValue(): string;
    /** used in components like autocomplete where focus must remain on the input.*/
    get active(): boolean;
    /** @hidden */
    readonly _stateChanges: Subject<void>;
    /** @hidden */
    private _mostRecentViewValue;
    /** @hidden */
    private _active;
    /** @hidden */
    constructor(_elementRef: ElementRef, _changeDetectorRef: ChangeDetectorRef);
    /** @Hidden */
    ngAfterViewInit(): void;
    /**
     * @hidden
     * Since select components could be using the option's label to display the selected values
     * and they don't have a way of knowing if the option's label has changed
     * we have to check for changes in the DOM ourselves and dispatch an event
     */
    ngAfterViewChecked(): void;
    /** @hidden */
    ngOnDestroy(): void;
    /** @hidden
     * This method sets display styles on the option to make it appear
     * active. This is used by the ActiveDescendantKeyManager so key
     * events will display the proper options as active on arrow key events.
     */
    setActiveStyles(): void;
    /** @hidden
     * This method removes display styles on the option that made it appear
     * active. This is used by the ActiveDescendantKeyManager so key
     * events will display the proper options as active on arrow key events.
     */
    setInactiveStyles(): void;
    /** @hidden
     * Focuses the element. */
    focus(_origin?: FocusOrigin, options?: FocusOptions): void;
    /** @hidden
     * option value
     */
    getLabel(): string;
    /** @hidden
     * Returns HTMLElement representation of the component. */
    _getHtmlElement(): HTMLElement;
    /** Selects the option.
     * * @hidden
     */
    _select(): void;
    /** @hidden
     * Deselects the option.
     */
    _deselect(): void;
    /**
     * Ensures the option is selected when activated from the keyboard.
     *
     * @hidden
     */
    _handleKeydown(event: KeyboardEvent): void;
    /** @hidden */
    _selectViaInteraction(): void;
    static ɵfac: i0.ɵɵFactoryDeclaration<OptionComponent, never>;
    static ɵcmp: i0.ɵɵComponentDeclaration<OptionComponent, "[fd-option], fd-option", never, { "id": { "alias": "id"; "required": false; }; "value": { "alias": "value"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; }, { "selectionChange": "selectionChange"; }, ["_listTitleDirectives"], ["*", "[secondary]"], true, never>;
}

declare const SELECT_COMPONENT: InjectionToken<SelectInterface<any>>;
/**
 * Select Interface to have typing and avoid circular dependency between
 * SelectComponent <==> SelectMobileComponent
 */
interface SelectInterface<TOption = any> extends MobileMode {
    typeaheadDebounceInterval: number;
    /** Whether the component is in RTL mode */
    isRtl: Signal<boolean>;
    selected: OptionComponent;
    mobileConfig: MobileModeConfig;
    _options: QueryList<TOption>;
    _destroy: DestroyRef;
    _optionPanel: ElementRef;
    _isOpen: boolean;
    _calculatedMaxHeight: number;
    _liveAnnouncer: LiveAnnouncer;
    isOpenChange: EventEmitter<boolean>;
    valueChange: EventEmitter<any>;
    close(forceClose?: boolean, tabOut?: boolean): void;
    open(): void;
    focus(): void;
    blur(): void;
    _getItemHeight(): number;
    _getOptionScrollPosition(optionIndex: number, optionHeight: number, currentScrollPosition: number): void;
}

declare class SelectKeyManagerService {
    /** @hidden */
    _component: SelectInterface;
    /** @hidden */
    _keyManager: ActiveDescendantKeyManager<OptionsInterface>;
    /**
     * Sets up a key manager to listen to keyboard events on the overlay panel.
     * @hidden
     */
    _initKeyManager(): void;
    /** @hidden */
    _scrollActiveOptionIntoView(): void;
    /**
     * Handles keyboard events while the select is closed.
     * @hidden
     */
    _handleClosedKeydown(event: KeyboardEvent): void;
    /**
     * Handles keyboard events when the selected is open.
     *
     * @hidden
     */
    _handleOpenKeydown(event: KeyboardEvent): void;
    /**
     * Checks if the component is in mobile mode.
     * @hidden
     */
    private _isMobile;
    static ɵfac: i0.ɵɵFactoryDeclaration<SelectKeyManagerService, never>;
    static ɵprov: i0.ɵɵInjectableDeclaration<SelectKeyManagerService>;
}

/**
 * This component provides extended mobile support for Select component to render list of option since full screen
 * dialog.
 */
declare class SelectMobileComponent extends MobileModeBase<SelectInterface> implements OnInit, AfterViewInit, OnDestroy {
    /** @hidden */
    _dialogTemplate: TemplateRef<any>;
    /**
     * @hidden
     * from mobile class can not prefix _,
     * to avoid build issues
     */
    childContent: TemplateRef<any> | null;
    /** @hidden */
    private _subscriptions;
    /** @hidden */
    constructor(_selectComponent: SelectInterface);
    /** @hidden */
    onItemKeydown(event: KeyboardEvent): void;
    /** @hidden */
    ngOnInit(): void;
    /** @hidden */
    ngAfterViewInit(): void;
    /** @hidden */
    ngOnDestroy(): void;
    /**
     * Only when we have Approve.
     * @hidden
     */
    _cancel(): void;
    /** @hidden */
    _approve(): void;
    /** @hidden Hide/Show the Dialog when Select Open/Close*/
    private _listenOnSelectOpenChange;
    /** @hidden */
    private _openDialog;
    static ɵfac: i0.ɵɵFactoryDeclaration<SelectMobileComponent, never>;
    static ɵcmp: i0.ɵɵComponentDeclaration<SelectMobileComponent, "fd-select-mobile", never, {}, {}, never, never, true, never>;
}

/**
 * @deprecated
 * Use direct imports of components and directives.
 */
declare class SelectMobileModule {
    static ɵfac: i0.ɵɵFactoryDeclaration<SelectMobileModule, never>;
    static ɵmod: i0.ɵɵNgModuleDeclaration<SelectMobileModule, never, [typeof i1.DialogModule, typeof i2.ButtonComponent, typeof SelectMobileComponent], [typeof SelectMobileComponent]>;
    static ɵinj: i0.ɵɵInjectorDeclaration<SelectMobileModule>;
}

declare const SELECT_PANEL_MAX_HEIGHT = 250;
/** The height of the select items in `rem` units. */
declare const SELECT_ITEM_HEIGHT_EM = 4;
type TextOverflowMode = 'full' | 'ellipsis';
declare enum TextOverflowModeEnum {
    FULL = "full",
    ELLIPSIS = "ellipsis"
}
/**
 * Select component intended to mimic
 * the behaviour of the native select element.
 */
declare class SelectComponent<T = any> implements SingleDropdownValueControl, ControlValueAccessor, SelectInterface, OnInit, AfterViewInit, AfterContentInit, OnChanges, OnDestroy, FormItemControl {
    private readonly _keyManagerService;
    private readonly _changeDetectorRef;
    private readonly _viewContainerRef;
    private readonly _dynamicComponentService;
    private readonly ngControl;
    private readonly _injector;
    readonly _contentDensityObserver: ContentDensityObserver;
    /** @deprecated
     * it is handled internally by controlTemplate != null|undefined is
     * Equal as extendedBodyTemplate as true.
     * Whether option components contain more than basic text. */
    set extendedBodyTemplate(value: boolean);
    get extendedBodyTemplate(): boolean;
    /** Scrolling strategy to be used for popover. */
    scrollStrategy: ScrollStrategy;
    /**
     * Controls how long text is displayed in the dropdown list of the Select component.
     *
     * - `'ellipsis'`: Truncates the text with an ellipsis (`...`) if it exceeds a certain length.
     * - `'full'`: Displays the entire text on multiple lines, ensuring full visibility.
     */
    textOverflow: TextOverflowMode;
    /** The ID of the control. */
    controlId: string;
    /** Holds the control state of select */
    state: Nullable<FormStates>;
    /** Whether the select component should be displayed in mobile mode. */
    mobile: boolean;
    /** Holds the message with respect to state */
    stateMessage: Nullable<string>;
    /** Whether the select component is disabled. */
    disabled: boolean;
    /** If it is mandatory field */
    required: boolean;
    /** Whether the select component is readonly. */
    readonly: boolean;
    /** Placeholder for the select. Appears in the triggerbox if no option is selected. */
    placeholder: string;
    /** Value of the select control. */
    set value(newValue: any);
    get value(): any;
    /** Max height of the popover. Any overflowing elements will be accessible through scrolling. */
    maxHeight: string;
    /** Glyph to add icon in the select component. */
    glyph: string;
    /** Glyph font family */
    glyphFont: IconFont;
    /** Whether close the popover on outside click. */
    closeOnOutsideClick: boolean;
    /**
     * Preset options for the Select body width, whatever is chosen, the body has a 600px limit.
     * * `at-least` will apply a minimum width to the body equivalent to the width of the control. - Default
     * * `equal` will apply a width to the body equivalent to the width of the control.
     * * 'fit-content' will apply width needed to properly display items inside, independent of control.
     */
    fillControlMode: PopoverFillMode;
    /** Custom template used to build control body. */
    controlTemplate: TemplateRef<any> | undefined;
    /** The element to which the popover should be appended. */
    appendTo: ElementRef;
    /**
     * If the option should be unselected and value changed to undefined, when the current value is
     * not presented in option array. Switching it off can be handy, when there is some delay between providing
     * possible options and chosen value.
     */
    unselectMissingOption: boolean;
    /** Time to wait in milliseconds after the last keydown before focusing or selecting option based on alphanumeric keys. */
    typeaheadDebounceInterval: number;
    /** Binds to control aria-labelledBy attribute */
    ariaLabelledBy: Nullable<string>;
    /** Sets control aria-label attribute value */
    ariaLabel: Nullable<string>;
    /** Select Input Mobile Configuration */
    mobileConfig: MobileModeConfig;
    /** Should select be inlined. */
    inline: boolean;
    /** Additional classname for the select control element. */
    selectControlClass: Nullable<string>;
    /** Additional classname for the select dropdown button element. */
    selectDropdownButtonClass: Nullable<string>;
    /** Holds advanced message renderer with respect to state. */
    advancedStateMessage: Nullable<FormFieldAdvancedStateMessage>;
    /**
     * Action to perform when user shifts focus from the dropdown.
     * - `close` will close the dropdown preserving previously selected value.
     * - `closeAndSelect` will close the dropdown and select last focused dropdown item.
     */
    tabOutStrategy: 'close' | 'closeAndSelect';
    /** Event emitted when the popover open state changes. */
    readonly isOpenChange: EventEmitter<boolean>;
    /** Event emitted when the selected value of the select changes. */
    readonly valueChange: EventEmitter<T>;
    /** @hidden */
    _options: QueryList<OptionComponent>;
    /** @hidden */
    _controlElementRef: ElementRef<HTMLDivElement>;
    /** Reference to element containing list of options */
    selectOptionsListTemplate: TemplateRef<any>;
    /** @hidden
     * Reference to root element for the mobile mode dialog */
    _dialogContainerElementRef: ElementRef;
    /**
     * Overlay pane containing the options.
     * @hidden
     */
    _overlayDir: CdkConnectedOverlay;
    /** @hidden
     * Referent to the option;s container
     */
    _optionPanel: ElementRef;
    /** Whether popover is opened
     * @hidden
     */
    _isOpen: boolean;
    /** @hidden */
    _tabIndex: number;
    /** @hidden */
    _liveAnnouncer: LiveAnnouncer;
    /** @hidden */
    _internalValue: any;
    /** @hidden */
    _calculatedMaxHeight: number;
    /** @hidden */
    _selectionModel: SelectionModel<OptionComponent>;
    /** @hidden */
    get showEllipsis(): boolean;
    /**
     * @hidden
     * Triggers when component is destroyed
     */
    readonly _destroy: DestroyRef;
    /** @hidden */
    get _selectControlClass(): string;
    /**
     * @hidden
     * Combined stream of all of the child options' change events.
     */
    readonly _optionSelectionChanges: Observable<FdOptionSelectionChange>;
    /** Selected option. */
    get selected(): OptionComponent;
    /** Retrieves selected value if any. */
    get triggerValue(): string;
    /** equal to close
     * Tells the OptionList if it's closable by simply selecting the item either with CLICK | SPACE | ENTER.
     * When we are in mobile mode (mobile=true) and have we have enabled confirmation buttons then we
     * dont close option list. We close only after we hit confirm button.
     */
    get canClose(): boolean;
    /** Whether control can be interacted with */
    get isInteractive(): boolean;
    /**
     * Check if we can emit a value. They are 3 different paths where we can emit value:
     *  - We are not in mobile mode [mobile]=false
     *  - We are in mobile mode [mobile]=true and mobile dialog as just close X button to dismiss it
     *  - We are in mobile mode [mobile]=true and mobile dialog has ApproveButton available and
     *  dialog is closed. (meaning we already clicked this button)
     */
    get canEmitValueChange(): boolean;
    /** Function to compare the option values with the selected values. */
    set compareWith(fn: (o1: any, o2: any) => boolean);
    get compareWith(): (o1: any, o2: any) => boolean;
    /** @hidden */
    get focused(): boolean;
    /** @hidden */
    get calculatedMaxHeight(): number;
    /** Whether the component is in RTL mode */
    readonly isRtl: i0.Signal<boolean>;
    private readonly _rtlService;
    /** @hidden */
    private _extendedBodyTemplate;
    /** @hidden */
    private _controlElemFontSize;
    /** @hidden */
    private _focused;
    /**
     * @hidden
     * Stored calculated maxHeight from Option Panel
     */
    private _maxHeight;
    /** @hidden */
    private _subscriptions;
    /** @hidden */
    constructor(_tabIndex: string, _keyManagerService: SelectKeyManagerService, _changeDetectorRef: ChangeDetectorRef, _viewContainerRef: ViewContainerRef, _dynamicComponentService: DynamicComponentService, ngControl: NgControl, _injector: Injector, _contentDensityObserver: ContentDensityObserver);
    /** @hidden */
    _resizeScrollHandler(): void;
    /** @hidden */
    _handleKeydown(event: KeyboardEvent): void;
    /** Toggles the open state of the select. */
    toggle(): void;
    /** @hidden */
    setDisabledState(isDisabled: boolean): void;
    /** @hidden */
    _compareWith: (o1: any, o2: any) => boolean;
    /** @hidden */
    ngOnInit(): void;
    /** @hidden */
    ngAfterViewInit(): void;
    /** @hidden */
    ngAfterContentInit(): void;
    /** @hidden */
    ngOnChanges(changes: SimpleChanges): void;
    /** @hidden */
    ngOnDestroy(): void;
    /** @hidden */
    onChange: (value: any) => void;
    /** @hidden */
    onTouched: () => void;
    /** Opens the select popover body. */
    open(): void;
    /** @hidden */
    close(forceClose?: boolean, tabOut?: boolean): void;
    /** Focuses select control. */
    focus(): void;
    /** Blurs select control. */
    blur(): void;
    /** @hidden */
    registerOnChange(fn: (value: any) => void): void;
    /** @hidden */
    registerOnTouched(fn: () => void): void;
    /** @hidden from ControlValue Accessor */
    writeValue(value: any): void;
    /** @hidden */
    _setSelectionByValue(value: any | any[]): void;
    /** @hidden */
    _selectValue(value: any): OptionComponent | undefined;
    /** @hidden */
    _popoverOpenChangeHandle(isOpen: boolean): void;
    /** @hidden Returns _keyManagerService. */
    _getKeyService(): SelectKeyManagerService;
    /** @hidden */
    _setDisabledState(isDisabled: boolean): void;
    /** @hidden */
    _highlightCorrectOption(): void;
    /** @hidden */
    _initializeSelection(): void;
    /**
     * Expose outside of this mixin to give component ability
     * to update caluclatedMaxHeight if needed
     * @hidden
     */
    _updateCalculatedHeight(): void;
    /** @hidden */
    _getOptionScrollPosition(optionIndex: number, itemHeight: number, currentScrollPosition: number): number;
    /** @hidden */
    _getItemHeight(): number;
    /** @hidden */
    _initializeCommonBehavior(): void;
    /** @hidden */
    _registerEventsAfterContentInit(): void;
    /** @hidden */
    _getAriaActiveDescendant(): string | null;
    /** @hidden */
    _onFocus(): void;
    /** @hidden */
    _onBlur(): void;
    /** @hidden */
    _buttonClick(): void;
    /** @hidden */
    private _resetOptions;
    /**
     * @hidden
     * Invoked when an option is clicked.
     */
    private _onSelect;
    /** @hidden */
    private _emitSelectChange;
    /** @hidden */
    private _getItemCount;
    /** @hidden */
    private _headerElements;
    /** @hidden */
    private _setupMobileMode;
    static ɵfac: i0.ɵɵFactoryDeclaration<SelectComponent<any>, [{ attribute: "tabindex"; }, null, null, null, { optional: true; }, { optional: true; self: true; }, { optional: true; }, null]>;
    static ɵcmp: i0.ɵɵComponentDeclaration<SelectComponent<any>, "fd-select", never, { "extendedBodyTemplate": { "alias": "extendedBodyTemplate"; "required": false; }; "scrollStrategy": { "alias": "scrollStrategy"; "required": false; }; "textOverflow": { "alias": "textOverflow"; "required": false; }; "controlId": { "alias": "controlId"; "required": false; }; "state": { "alias": "state"; "required": false; }; "mobile": { "alias": "mobile"; "required": false; }; "stateMessage": { "alias": "stateMessage"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; "required": { "alias": "required"; "required": false; }; "readonly": { "alias": "readonly"; "required": false; }; "placeholder": { "alias": "placeholder"; "required": false; }; "value": { "alias": "value"; "required": false; }; "maxHeight": { "alias": "maxHeight"; "required": false; }; "glyph": { "alias": "glyph"; "required": false; }; "glyphFont": { "alias": "glyphFont"; "required": false; }; "closeOnOutsideClick": { "alias": "closeOnOutsideClick"; "required": false; }; "fillControlMode": { "alias": "fillControlMode"; "required": false; }; "controlTemplate": { "alias": "controlTemplate"; "required": false; }; "appendTo": { "alias": "appendTo"; "required": false; }; "unselectMissingOption": { "alias": "unselectMissingOption"; "required": false; }; "typeaheadDebounceInterval": { "alias": "typeaheadDebounceInterval"; "required": false; }; "ariaLabelledBy": { "alias": "ariaLabelledBy"; "required": false; }; "ariaLabel": { "alias": "ariaLabel"; "required": false; }; "mobileConfig": { "alias": "mobileConfig"; "required": false; }; "inline": { "alias": "inline"; "required": false; }; "selectControlClass": { "alias": "selectControlClass"; "required": false; }; "selectDropdownButtonClass": { "alias": "selectDropdownButtonClass"; "required": false; }; "advancedStateMessage": { "alias": "advancedStateMessage"; "required": false; }; "tabOutStrategy": { "alias": "tabOutStrategy"; "required": false; }; "compareWith": { "alias": "compareWith"; "required": false; }; }, { "isOpenChange": "isOpenChange"; "valueChange": "valueChange"; }, ["_options"], ["*"], true, never>;
}
declare class DeprecatedSelectCSSClasses implements ModuleDeprecation {
    /** @hidden */
    message: string;
    /** @hidden */
    alternative: {
        name: string;
        link: string[];
    };
}

/**
 * @deprecated
 * Use direct imports of components and directives.
 */
declare class SelectModule {
    static ɵfac: i0.ɵɵFactoryDeclaration<SelectModule, never>;
    static ɵmod: i0.ɵɵNgModuleDeclaration<SelectModule, never, [typeof SelectComponent, typeof OptionComponent], [typeof SelectComponent, typeof OptionComponent]>;
    static ɵinj: i0.ɵɵInjectorDeclaration<SelectModule>;
}

export { DeprecatedSelectCSSClasses, FdOptionSelectionChange, OptionComponent, SELECT_COMPONENT, SELECT_ITEM_HEIGHT_EM, SELECT_PANEL_MAX_HEIGHT, SelectComponent, SelectKeyManagerService, SelectMobileComponent, SelectMobileModule, SelectModule, TextOverflowModeEnum };
export type { OptionsInterface, SelectInterface, TextOverflowMode };
