import { H as registerInstance, y as waitAfterIdleCallback, x as waitAfterFramePaint, M as h, N as Host, O as getElement } from './index-DGWPFpP6.js';
import { s as scrollToFirstInvalidField } from './form-FCLKfv6B.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: '1598e29d7763c06aeebe9ae70e4ad27695c9796d' }, h(NativeEl, Object.assign({ key: '140fa29ca7900623d52da99ffc5f9bd6db72cd97' }, attrs, { class: this.formClass }), h("slot", { key: '1797bdbc8f4f70b50c5d193acea0569e977d8a81' }))));
    }
    get el() { return getElement(this); }
};
Form.style = balFormCss;

export { Form as bal_form };
