@sandlada/mdc
Version:
@sandlada/mdc is an open source component library that follows the Material Design 3 design specifications.
117 lines • 4.61 kB
TypeScript
/**
* @license
* Copyright 2026 Kai-Orion & Sandlada
* SPDX-License-Identifier: MIT
*/
import { LitElement, type PropertyValues, type TemplateResult } from 'lit';
import { createValidator, getValidityAnchor } from '../../../utils/behaviors/constraint-validation';
import { TextFieldValidator } from '../../../utils/behaviors/validators/text-field-validator';
import { getFormState, getFormValue } from '../../../utils/form/form-associated';
import type { MDCField } from '../../field/field';
import '../../field/field';
import { type FieldVariant, type FloatingLabelBehavior, type ITextField, type TextFieldType } from '../text-field.interface';
declare const BaseTextField_base: Omit<typeof LitElement, "prototype"> & (new () => LitElement & object & import("../../../utils/behaviors/constraint-validation").ConstraintValidation & import("../../../utils/form/form-associated").FormAssociated & import("../../../utils/behaviors/element-internals").WithElementInternals & import("../../focus-ring/focus-ring-options.mixin").IMixinFocusRingOption);
/**
* Abstract base for `mdc-text-field`.
*
* Implements full form-association, constraint validation, standard input
* properties, methods, and renders native `<input>` or `<textarea>` inside
* `mdc-field` chrome.
*
* Mixin composition (abstract -> concrete):
* - `mixinDelegatesAria`
* - `mixinConstraintValidation`
* - `mixinFormAssociated`
* - `mixinElementInternals`
* - `mixinFocusRingOptions`
*
* @version
* Material Design 3
*
* @link
* https://m3.material.io/components/text-fields/overview
*/
export declare abstract class BaseTextField extends BaseTextField_base implements ITextField {
static styles: import("lit").CSSResult[];
static shadowRootOptions: ShadowRootInit;
name: string;
disabled: boolean;
variant: FieldVariant;
value: string;
type: TextFieldType;
label: string;
placeholder: string;
supportingText: string;
errorText: string;
error: boolean;
prefixText: string;
suffixText: string;
required: boolean;
noAsterisk: boolean;
readOnly: boolean;
min: string;
max: string;
step: string;
pattern: string;
minLength: number;
maxLength: number;
autocomplete: string;
autofocus: boolean;
inputMode: string;
rows: number;
cols: number;
clearable: boolean;
counter: boolean;
counterText: string;
floatingLabelBehavior: FloatingLabelBehavior;
alignEnd: boolean;
autoValidate: boolean;
protected focused: boolean;
protected nativeError: boolean;
protected readonly inputElement: HTMLInputElement | HTMLTextAreaElement | null;
protected readonly fieldElement: MDCField | null;
get focusRingControl(): HTMLElement | null;
focus(options?: FocusOptions): void;
blur(): void;
select(): void;
setSelectionRange(start: number, end: number, direction?: 'forward' | 'backward' | 'none'): void;
setRangeText(replacement: string, start?: number, end?: number, selectionMode?: 'select' | 'start' | 'end' | 'preserve'): void;
stepUp(n?: number): void;
stepDown(n?: number): void;
showPicker(): void;
reset(): void;
get selectionStart(): number | null;
set selectionStart(value: number | null);
get selectionEnd(): number | null;
set selectionEnd(value: number | null);
get selectionDirection(): 'forward' | 'backward' | 'none' | null;
set selectionDirection(value: 'forward' | 'backward' | 'none' | null);
get valueAsNumber(): number;
set valueAsNumber(value: number);
get valueAsDate(): Date | null;
set valueAsDate(value: Date | null);
connectedCallback(): void;
protected update(changedProperties: PropertyValues<this>): void;
[getFormValue](): string | null;
[getFormState](): string;
formResetCallback(): void;
formStateRestoreCallback(state: string): void;
formDisabledCallback(disabled: boolean): void;
[createValidator](): TextFieldValidator;
[getValidityAnchor](): HTMLElement | null;
private getValidationState;
isPopulated(): boolean;
isInvalid(): boolean;
getErrorText(): string;
getComputedCounterText(): string;
protected render(): TemplateResult;
protected renderInputOrTextarea(): TemplateResult;
protected handleInput(event: Event): void;
protected handleChange(event: Event): void;
protected handleFocus(): void;
protected handleBlur(): void;
protected handleSelect(event: Event): void;
protected handleClearClick(event: MouseEvent): void;
}
export {};
//# sourceMappingURL=base-text-field.d.ts.map