import { AfterViewInit, ChangeDetectorRef, ElementRef, EventEmitter, DoCheck, InjectionToken, OnChanges, OnDestroy, SimpleChanges, QueryList } from '@angular/core'; import { ControlValueAccessor, FormGroupDirective, NgControl, NgForm } from '@angular/forms'; import { Platform } from '@angular/cdk/platform'; import { MdcRipple } from '@shraddhar/web/ripple'; import { MDCComponent } from '@shraddhar/web/base'; import { MdcFloatingLabel } from '@shraddhar/web/floating-label'; import { MdcLineRipple } from '@shraddhar/web/line-ripple'; import { MdcNotchedOutline } from '@shraddhar/web/notched-outline'; import { ErrorStateMatcher, CanUpdateErrorState, CanUpdateErrorStateCtor, MdcFormField, MdcFormFieldControl } from '@shraddhar/web/form-field'; import { MdcTextFieldIcon } from './text-field-icon'; import { MdcTextFieldHelperTextFoundation } from './helper-text'; import { MdcTextFieldCharacterCounterFoundation } from './character-counter'; import { MDCTextFieldFoundation } from '@material/textfield'; /** * Represents the default options for mdc-text-field that can be configured * using an `MDC_TEXT_FIELD_DEFAULT_OPTIONS` injection token. */ export interface MdcTextFieldDefaultOptions { outlined?: boolean; } /** * Injection token that can be used to configure the default options for all * mdc-text-field usage within an app. */ export declare const MDC_TEXT_FIELD_DEFAULT_OPTIONS: InjectionToken; /** An enumerated typeof HTMLInputElement.type */ export declare type TextFieldType = 'text' | 'search' | 'tel' | 'url' | 'email' | 'password' | 'date' | 'month' | 'week' | 'time' | 'datetime-local' | 'number' | 'color'; /** An enumerated typeof HTMLInputElement.inputMode */ export declare type TextFieldInputMode = 'verbatim' | 'latin' | 'latin-name' | 'latin-prose' | 'full-width-latin' | 'kana' | 'kana-name' | 'katakana' | 'numeric' | 'tel' | 'email' | 'url'; declare class MdcTextFieldBase extends MDCComponent { _elementRef: ElementRef; _defaultErrorStateMatcher: ErrorStateMatcher; _parentForm: NgForm; _parentFormGroup: FormGroupDirective; ngControl: NgControl; constructor(_elementRef: ElementRef, _defaultErrorStateMatcher: ErrorStateMatcher, _parentForm: NgForm, _parentFormGroup: FormGroupDirective, ngControl: NgControl); } declare const _MdcTextFieldMixinBase: CanUpdateErrorStateCtor & typeof MdcTextFieldBase; export declare class MdcTextField extends _MdcTextFieldMixinBase implements AfterViewInit, DoCheck, OnChanges, OnDestroy, ControlValueAccessor, MdcFormFieldControl, CanUpdateErrorState { private _platform; private _changeDetectorRef; elementRef: ElementRef; _defaultErrorStateMatcher: ErrorStateMatcher; private _document; private _parentFormField; private _ripple; ngControl: NgControl; private _defaults; private _uid; private _initialized; /** Time in milliseconds when the last touchstart event happened. */ private _lastTouchStartEvent; controlType: string; _foundationHelper?: MdcTextFieldHelperTextFoundation; _foundationCharCounter?: MdcTextFieldCharacterCounterFoundation; name?: string; label: string | undefined; maxlength?: number; minlength?: number; pattern?: string; autocomplete?: string; max?: number; min?: number; size?: number; step?: number; placeholder: string | undefined; tabIndex: number; prefix: string | undefined; suffix: string | undefined; inputmode?: TextFieldInputMode; helper?: string; validationMessage?: string; get id(): string; set id(value: string); private _id; /** Input type of the element. */ get type(): TextFieldType; set type(value: TextFieldType); private _type; get outlined(): boolean; set outlined(value: boolean); private _outlined; get disabled(): boolean; set disabled(value: boolean); private _disabled; get required(): boolean; set required(value: boolean); private _required; get readonly(): boolean; set readonly(value: boolean); private _readonly; get fullwidth(): boolean; set fullwidth(value: boolean); private _fullwidth; get helperPersistent(): boolean; set helperPersistent(value: boolean); private _helperPersistent; /** Sets the Text Field valid or invalid. */ get valid(): boolean | undefined; set valid(value: boolean | undefined); private _valid; /** Enables or disables the use of native validation. Use this for custom validation. */ get useNativeValidation(): boolean; set useNativeValidation(value: boolean); private _useNativeValidation; get charCounter(): boolean; set charCounter(value: boolean); private _charCounter; get endAligned(): boolean; set endAligned(value: boolean); private _endAligned; get ltrText(): boolean; set ltrText(value: boolean); private _ltrText; get value(): any; set value(newValue: any); private _value; /** An object used to control when error messages are shown. */ errorStateMatcher?: ErrorStateMatcher; readonly change: EventEmitter; readonly input: EventEmitter; readonly blur: EventEmitter; readonly _onFocus: EventEmitter; _input: ElementRef; _lineRipple?: MdcLineRipple; _notchedOutline?: MdcNotchedOutline; _floatingLabel?: MdcFloatingLabel; _icons: QueryList; /** View to model callback called when value changes */ _onChange: (value: any) => void; /** View to model callback called when text field has been touched */ _onTouched: () => void; get textarea(): boolean; get leadingIcon(): MdcTextFieldIcon | undefined; get trailingIcon(): MdcTextFieldIcon | undefined; getDefaultFoundation(): MDCTextFieldFoundation; private _getRootAdapterMethods; private _getInputAdapterMethods; private _getLabelAdapterMethods; private _getLineRippleAdapterMethods; private _getOutlineAdapterMethods; /** Returns a map of all subcomponents to subfoundations.*/ private _getFoundationMap; constructor(_platform: Platform, _changeDetectorRef: ChangeDetectorRef, elementRef: ElementRef, _defaultErrorStateMatcher: ErrorStateMatcher, _document: any, _parentFormField: MdcFormField, _ripple: MdcRipple, ngControl: NgControl, _parentForm: NgForm, _parentFormGroup: FormGroupDirective, _defaults: MdcTextFieldDefaultOptions); _asyncBuildFoundation(): Promise; ngOnChanges(changes: SimpleChanges): void; ngAfterViewInit(): void; ngOnDestroy(): void; ngDoCheck(): void; init(): void; onInputInteraction(evt: MouseEvent | TouchEvent): void; onInput(evt: Event): void; onFocus(): void; onChange(evt: Event): void; onBlur(): void; writeValue(value: any): void; registerOnChange(fn: (value: any) => any): void; registerOnTouched(fn: () => {}): void; private _initializeValue; setValue(value: any, isUserInput?: boolean): void; isBadInput(): boolean; focus(): void; /** Initializes Text Field's internal state based on the environment state */ private _layout; /** Implemented as part of ControlValueAccessor. */ setDisabledState(isDisabled: boolean): void; /** Set the default options here. */ private _setDefaultGlobalOptions; private _checkCustomValidity; /** Override MdcTextFieldBase destroy method */ destroy(): void; private _isValid; private _hasFloatingLabel; private _getFloatingLabel; private _syncCharacterCounter; private _syncHelper; private _initHelperFoundation; private _charCounterVisible; private _shouldRenderHelperText; private _getInputElement; /** Retrieves the DOM element of the component host. */ private _getHostElement; } export {};