import { EventEmitter, OnChanges } from '@angular/core'; import { SafeHtml } from '@angular/platform-browser'; import { ControlValueAccessor, NgControl } from '@angular/forms'; import { ListboxValueChangeEvent } from '@angular/cdk/listbox'; import { ConnectedPosition } from '@angular/cdk/overlay'; import { DropdownLabelPosition, DropdownOption, DropdownSize } from './dropdown-types'; import * as i0 from "@angular/core"; /** * A labelled single-select dropdown built on the CDK Listbox (`@angular/cdk/listbox`) * and CDK Overlay. The trigger renders the closed field (label, placeholder/selected * value and chevron); the options open in an overlay panel with full keyboard support * (arrow keys, Home/End, typeahead) provided by the CDK listbox. * * Implements `ControlValueAccessor` so it works with both reactive forms * (`formControlName`, `[formControl]`) and template-driven forms (`ngModel`). The error * visual state is driven automatically by the bound `FormControl`'s validity once the * field has been touched, and can also be set explicitly via the `error` input. */ export declare class DropdownComponent implements ControlValueAccessor, OnChanges { private readonly _autoId; private readonly cdr; private readonly sanitizer; private _onChange; private _onTouched; /** Injected when the component is used inside a reactive or template-driven form. */ protected readonly ngControl: NgControl | null; constructor(); private triggerBtn?; private listboxEl?; /** Label displayed above the trigger. */ label: string; /** Text shown in the trigger when no option is selected. */ placeholder: string; /** Currently selected value. When used in a form, the form controls the value. */ value: string; /** Selectable options rendered in the overlay panel. */ options: DropdownOption[]; /** Size variant — controls height, padding, and font size. Defaults to `'md'`. */ size: DropdownSize; /** Native `id` attribute for the trigger. Auto-generated if omitted. */ id?: string; /** * Id(s) of external elements that describe the field, space-separated. * Forwarded to `aria-describedby` on the trigger. */ ariaDescribedBy?: string; /** Text displayed below the trigger. Shown in red when in error state. */ supportingText: string; /** * Static error text shown in red when in error state. Used when the dropdown is * outside a form (with `[error]="true"`). When inside a form, prefer `errorMessages`. */ errorMessage: string; /** * Map of Angular validator error keys to display strings. The component reads * `ngControl.errors` to determine which validator failed and shows the matching * message in red below the trigger. Example: `{ required: 'Please choose an option' }` */ errorMessages: Record; /** * Adds a blue asterisk after the label. When used in a form, this is set * automatically if the bound `FormControl` has `Validators.required`. * Supports boolean coercion. */ required: boolean; /** * Applies the error visual state (red border) explicitly. When used in a form, * the error state is driven automatically from the `FormControl`'s validity once * the field is touched — this input is only needed outside of forms. Supports boolean coercion. */ error: boolean; /** Disables the dropdown. When used in a form, also responds to `FormControl.disable()`. Supports boolean coercion. */ disabled: boolean; /** Visually hides the label while keeping it accessible to screen readers. Supports boolean coercion. */ hideLabel: boolean; /** Places the label above the trigger (`'top'`, default) or beside it (`'left'`). */ labelPosition: DropdownLabelPosition; /** * Renders the label as the trigger's own resting text instead of a separate * label above/beside it — e.g. the trigger reads "I want to" until an option * is chosen. No visible external label is shown, but the `label` is still * exposed to assistive tech (a screen-reader-only `