import { r as registerInstance, h, H as Host, g as getElement } from './index-BdVwMG9u.js';
import { s as scrollToFirstInvalidField } from './form-FCLKfv6B.js';
import { b as waitAfterIdleCallback, a as waitAfterFramePaint } from './helpers-BNj87EbG.js';
import './browser-B1u-Mq75.js';
import './config.utils-B7jugjyM.js';

const balFormCss = ".bal-form{display:block;position:static}";

const Form = class {
    constructor(hostRef) {
        registerInstance(this, hostRef);
        /**
         * If `true` a native form element is added as a wrapper of the slot.
         */
        this.native = false;
        /**
         * If `true` it adds the novalidate attribute to the native form element.
         */
        this.novalidate = false;
        /**
         * The css class for the inner form element
         */
        this.formClass = '';
    }
    /**
     * Scrolls to the first invalid field inside this form component.
     */
    async scrollToFirstInvalidField() {
        await waitAfterIdleCallback();
        await waitAfterFramePaint();
        scrollToFirstInvalidField({ formEl: this.el });
    }
    render() {
        const NativeEl = this.native ? 'form' : 'div';
        let attrs = {};
        if (this.native) {
            attrs = {
                novalidate: this.novalidate,
            };
        }
        return (h(Host, { key: '8b3d28034718b1594fef9900e776ff718e16441d' }, h(NativeEl, Object.assign({ key: '4a21539e4b24d63f95813654d92ac8aa2c0f948b' }, attrs, { class: this.formClass }), h("slot", { key: '9b2a367a300b2803a4868c057e54d14952a557ca' }))));
    }
    get el() { return getElement(this); }
};
Form.style = balFormCss;

export { Form as bal_form };
