// #region Imports
import { FormAssociated } from '../../../Forms/Behaviors/FormAssociated';
import { CustomElement } from './CustomElement';
// #endregion
/**
 * The base class of all custom components.
 *
 * @public
 */
export class CustomFormElement extends FormAssociated(CustomElement) {
    // #region Fields
    _form;
    // #endregion
    // #region Ctor
    /**
     * Constructs a new instance of the `CustomFormElement` class.
     *
     * @protected
     */
    constructor() {
        super();
        this._form = null;
    }
    // #endregion
    // #region Properties
    /**
     * Gets or sets the `form` property.
     *
     * @public
     * @override
     */
    get form() {
        return this._form;
    }
    set form(value) {
        this._form = value;
    }
    /**
     * @public
     * @readonly
     */
    get validity() {
        return this.internals.validity;
    }
    /**
     * @public
     * @readonly
     */
    get validationMessage() {
        return this.internals.validationMessage;
    }
    /**
     * @public
     * @readonly
     */
    get willValidate() {
        return this.internals.willValidate;
    }
    /**
     * Returns true if internals's target element has no validity problems; false otherwise.
     * Fires an invalid event at the element in the latter case.
     *
     * @public
     */
    checkValidity() {
        return this.internals.checkValidity();
    }
    /**
     * Returns true if internals's target element has no validity problems; otherwise, returns false.
     * Fires an invalid event at the element, and (if the event isn't canceled) reports the problem to the user.
     *
     * @public
     */
    reportValidity() {
        return this.internals.reportValidity();
    }
    /**
     * A callback that is invoked when the element is associated with a form.
     *
     * @param error - The error message.
     * @public
     */
    formAssociatedCallback(form) {
        this._form = form;
    }
    /**
     * @public
     * @override
     */
    connectedCallback() {
        super.connectedCallback();
        this._form = this.internals.form;
    }
}
//# sourceMappingURL=CustomFormElement.js.map