import { LitElement } from 'lit'; type Constructor = new (...args: any[]) => T; /** * Interface that components using FormAssociatedMixin must satisfy. */ export interface FormAssociated { error: boolean; errorText: string; required: boolean; readonly validationMessage: string; readonly validity: ValidityState; checkValidity(): boolean; reportValidity(focus?: boolean): boolean; setCustomValidity(message: string): void; } /** * Base class for the mixin — named so TypeScript can expose its shape. * Do not use directly; use FormAssociatedMixin() instead. * @internal */ export declare class FormAssociatedBase { error: boolean; required: boolean; get errorText(): string; set errorText(value: string); protected _errorText: string; protected _validationMessage: string; protected _parentForm: HTMLFormElement | undefined; protected _errorSetByValidation: boolean; protected _isValid(): boolean; protected _getValidationMessage(): string; protected _getNativeInput(): HTMLInputElement | HTMLTextAreaElement | undefined; checkValidity(): boolean; reportValidity(focus?: boolean): boolean; setCustomValidity(message: string): void; get validationMessage(): string; get validity(): ValidityState; connectedCallback(): void; disconnectedCallback(): void; protected _updateValidationState(): void; protected _clearErrorStateIfValid(): void; protected _setErrorTextByValidation(message: string): void; protected _handleInvalid(e: Event): void; } /** * FormAssociatedMixin * * A Lit mixin that provides HTML form validation scaffolding for CTT * Design System components. Eliminates duplicated validation code across * Checkbox, RadioButton, TextareaInput, and similar form-field components. * * Components must implement the abstract methods: * - `_isValid(): boolean` * - `_getValidationMessage(): string` * * Optionally override `_getNativeInput()` to return the native element * used for focus-on-error and setCustomValidity() delegation. * * @example * ```ts * class CttMyInput extends FormAssociatedMixin(LitElement) { * protected _isValid(): boolean { * return !this.required || this._value.trim() !== ''; * } * protected _getValidationMessage(): string { * return this._isValid() ? '' : 'This field is required.'; * } * } * ``` */ export declare const FormAssociatedMixin: >(Base: TBase) => Constructor & TBase; export {};