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: 'd25c1b6664e41d72f2d2c5b2ad6532fa184d66bf' }, h(NativeEl, Object.assign({ key: '37eefa8920cf3fb639d235d7b21cb7a44be6bd06' }, attrs, { class: this.formClass }), h("slot", { key: '7eff7f47f3fd4732988e17944be73373e6133e32' }))));
    }
    get el() { return getElement(this); }
};
Form.style = balFormCss;

export { Form as bal_form };
