import { AfterViewChecked, ChangeDetectorRef, ElementRef, EventEmitter, InjectionToken, OnDestroy, QueryList } from '@angular/core'; import { ActiveDescendantKeyManager } from '@koobiq/cdk/a11y'; import { Subject } from 'rxjs'; import { KbqTitleTextRef } from '../title'; import { KbqOptgroup } from './optgroup'; import * as i0 from "@angular/core"; /** Event object emitted by KbqOption when selected or deselected. */ export declare class KbqOptionSelectionChange { source: T; isUserInput: boolean; constructor(source: T, isUserInput?: boolean); } /** * Describes a parent component that manages a list of options. * Contains properties that the options can inherit. * @docs-private */ export interface KbqOptionParentComponent { multiple?: boolean; multiSelection?: boolean; withVirtualScroll?: boolean; keyManager?: ActiveDescendantKeyManager; setSelectedOptionsByClick: (option: KbqOption) => void; } /** * Handler that will update scroll position of elements inside overlay */ export interface KeyboardNavigationHandler { /** Scrolls the active option into view. */ scrollActiveOptionIntoView(): void; } /** * Injection token used to provide the parent component to options. */ export declare const KBQ_OPTION_PARENT_COMPONENT: InjectionToken; export declare abstract class KbqOptionBase { value: any; abstract get viewValue(): string; abstract get disabled(): boolean; abstract set disabled(value: any); abstract readonly onSelectionChange: EventEmitter>; abstract select(): void; abstract deselect(): void; /** Emits the selection change event. */ protected emitSelectionChangeEvent(isUserInput?: boolean): void; } export declare class KbqVirtualOption extends KbqOptionBase { value: any; private _disabled; private readonly _viewValue?; get disabled(): any; set disabled(value: any); get selected(): boolean; private _selected; get viewValue(): string; readonly onSelectionChange: EventEmitter>; constructor(value: any, _disabled?: boolean, _viewValue?: string | undefined); select(): void; deselect(): void; } /** * Single option inside of a `` element. */ export declare class KbqOption extends KbqOptionBase implements AfterViewChecked, OnDestroy, KbqTitleTextRef { private readonly elementRef; private readonly changeDetectorRef; protected readonly parent: KbqOptionParentComponent; readonly group: KbqOptgroup; textElement: ElementRef; /** The form value of the option. */ value: any; selectable: boolean; userSelect: boolean; get showCheckbox(): boolean; set showCheckbox(value: boolean); private _showCheckbox; /** Event emitted when the option is selected or deselected. */ readonly onSelectionChange: EventEmitter>; /** Emits when the state of the option changes and any parents have to be notified. */ readonly stateChanges: Subject; /** * The displayed value of the option. It is necessary to show the selected option in the * select's trigger. */ get viewValue(): string; set viewValue(value: string); private _viewValue; /** Whether the wrapping component is in multiple selection mode. */ get multiple(): boolean; get id(): string; private _id; get selected(): boolean; private _selected; get disabled(): any; set disabled(value: any); private _disabled; /** * Whether or not the option is currently active and ready to be selected. * An active option displays styles as if it is focused, but the * focus is actually retained somewhere else. This comes in handy * for components like autocomplete where focus must remain on the input. */ get active(): boolean; private _active; private mostRecentViewValue; /** * Flag that indicates whether the component is currently focused by a mouse interaction. * * When set to `true`, the component has focus resulting from a mouse click or * other pointer event. It is automatically cleared when the component loses * focus or if focus is obtained through keyboard navigation or programmatic means. */ private isFocusedByMouse; constructor(elementRef: ElementRef, changeDetectorRef: ChangeDetectorRef, parent: KbqOptionParentComponent, group: KbqOptgroup); ngAfterViewChecked(): void; ngOnDestroy(): void; /** @docs-private */ getHeight(): number; select(emitEvent?: boolean): void; deselect(emitEvent?: boolean): void; focus(): void; /** * 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; /** * 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; /** Gets the label to be used when determining whether the option should be focused. */ getLabel(): string; /** @docs-private */ handleClick(event: MouseEvent): void; /** Ensures the option is selected when activated from the keyboard. */ handleKeydown(event: KeyboardEvent): void; /** * `Selects the option while indicating the selection came from the user. Used to * determine if the select's view -> model callback should be invoked.` */ selectViaInteraction(): void; getTabIndex(): string; getHostElement(): HTMLElement; /** @docs-private */ protected onMouseenter(): void; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵcmp: i0.ɵɵComponentDeclaration; static ngAcceptInputType_selectable: unknown; static ngAcceptInputType_userSelect: unknown; } /** * Counts the amount of option group labels that precede the specified option. * @param optionIndex Index of the option at which to start counting. * @param options Flat list of all of the options. * @param optionGroups Flat list of all of the option groups. * @docs-private */ export declare function countGroupLabelsBeforeOption(optionIndex: number, options: QueryList, optionGroups: QueryList): number; /** * Determines the position to which to scroll a panel in order for an option to be into view. * @param optionIndex Index of the option to be scrolled into the view. * @param optionHeight Height of the options. * @param currentScrollPosition Current scroll position of the panel. * @param panelHeight Height of the panel. * @docs-private */ export declare function getOptionScrollPosition(optionIndex: number, optionHeight: number, currentScrollPosition: number, panelHeight: number): number;