import { BooleanInput } from '@angular/cdk/coercion'; import { SelectionModel } from '@angular/cdk/collections'; import { ChangeDetectorRef, DoCheck, ElementRef, EventEmitter, OnChanges, OnDestroy, OnInit, SimpleChanges } from '@angular/core'; import { ControlValueAccessor, FormGroupDirective, NgControl, NgForm } from '@angular/forms'; import { SbbAutocomplete, SbbAutocompleteOrigin } from '@sbb-esta/angular-business/autocomplete'; import { CanUpdateErrorState, CanUpdateErrorStateCtor } from '@sbb-esta/angular-core/common-behaviors'; import { SbbErrorStateMatcher } from '@sbb-esta/angular-core/error'; import { SbbFormFieldControl } from '@sbb-esta/angular-core/forms'; import { Subject } from 'rxjs'; /** Change event object that is emitted when the chip-input value has changed. */ export declare class SbbChipInputChange { /** Reference to the chip-input that emitted the change event. */ source: SbbChipInput; /** Current value of the chip-input that emitted the event. */ value: string[]; constructor( /** Reference to the chip-input that emitted the change event. */ source: SbbChipInput, /** Current value of the chip-input that emitted the event. */ value: string[]); } /** @docs-private */ export declare class SbbChipsBase { _elementRef: ElementRef; _defaultErrorStateMatcher: SbbErrorStateMatcher; _parentForm: NgForm; _parentFormGroup: FormGroupDirective; ngControl: NgControl; constructor(_elementRef: ElementRef, _defaultErrorStateMatcher: SbbErrorStateMatcher, _parentForm: NgForm, _parentFormGroup: FormGroupDirective, ngControl: NgControl); } export declare const SbbChipsMixinBase: CanUpdateErrorStateCtor & typeof SbbChipsBase; export declare class SbbChipInput extends SbbChipsMixinBase implements SbbFormFieldControl, OnInit, DoCheck, OnDestroy, OnChanges, CanUpdateErrorState, ControlValueAccessor { ngControl: NgControl; private _changeDetectorRef; /** Optional autocomplete Component */ autocomplete: SbbAutocomplete; /** Disables the chip input */ get disabled(): any; set disabled(value: any); private _disabled; /** Unique id of the element. */ get id(): string; set id(value: string); private _id; /** Id for the inner input field. */ get inputId(): string; /** Whether filling out the chip-input is required in the form. */ get required(): boolean; set required(value: boolean); private _required; /** Reference to the input element. */ _inputElement: ElementRef; /** Value of the chip input control. */ get value(): any; set value(newValue: any); private _value; /** Whether the chip-input has a value. */ get empty(): boolean; /** * Event that emits whenever the raw value of the chip-input changes. This is here primarily * to facilitate the two-way binding for the `value` input. * @docs-private */ readonly valueChange: EventEmitter; /** Whether the select is focused. */ get focused(): boolean; private _focused; inputModel: string; selectionModel: SelectionModel; /** Emits when the state of the option changes and any parents have to be notified. */ readonly stateChanges: Subject; /** The element reference for the autocomplete origin. */ readonly _origin: SbbAutocompleteOrigin; /** The aria-describedby attribute on the chip-input for improved a11y. */ _ariaDescribedby: string; /** Unique id for this input. */ private _uniqueId; private _destroyed; /** `View -> model callback called when value changes` */ private _onTouched; /** `View -> model callback called when chip input has been touched` */ private _onChange; constructor(ngControl: NgControl, _changeDetectorRef: ChangeDetectorRef, elementRef: ElementRef, defaultErrorStateMatcher: SbbErrorStateMatcher, parentForm: NgForm, parentFormGroup: FormGroupDirective); ngOnInit(): void; ngDoCheck(): void; ngOnChanges(changes: SimpleChanges): void; ngOnDestroy(): void; /** * Sets the chip input's value. Part of the ControlValueAccessor interface * required to integrate with Angular's core forms API. * * @param value New value to be written to the model. */ writeValue(value: string[]): void; /** * Disables the chip input. Part of the ControlValueAccessor interface required * to integrate with Angular's core forms API. * * @param isDisabled Sets whether the component is disabled. */ setDisabledState(isDisabled: boolean): void; /** Adds a given value to the current selected values. */ _onSelect(option: string): void; /** Handle the keydown event. */ _handleKeydown(event: KeyboardEvent): void; /** Removes a given value from the current selected values. */ deselectOption(option: string): void; /** * Saves a callback function to be invoked when the chip input's value * changes from user input. Part of the ControlValueAccessor interface * required to integrate with Angular's core forms API. * * @param fn Callback to be triggered when the value changes. */ registerOnChange(fn: any): void; /** * Saves a callback function to be invoked when the chip input is blurred * by the user. Part of the ControlValueAccessor interface required * to integrate with Angular's core forms API. * * @param fn Callback to be triggered when the component has been touched. */ registerOnTouched(fn: any): void; /** * Implemented as part of SbbFormFieldControl. * @docs-private */ setDescribedByIds(ids: string[]): void; /** * Forward focus if a user clicks on an associated label. * Implemented as part of SbbFormFieldControl. * @docs-private */ onContainerClick(event: Event): void; /** Emits change event to set the model value. */ private _propagateChanges; /** @docs-private */ _onBlur(): void; /** @docs-private */ _onFocus(): void; static ngAcceptInputType_disabled: BooleanInput; static ngAcceptInputType_required: BooleanInput; }