'use strict';

var index = require('./index-CP3lGz14.js');
var form = require('./form-BSlIiqcR.js');

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

const Form = class {
    constructor(hostRef) {
        index.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 index.waitAfterIdleCallback();
        await index.waitAfterFramePaint();
        form.scrollToFirstInvalidField({ formEl: this.el });
    }
    render() {
        const NativeEl = this.native ? 'form' : 'div';
        let attrs = {};
        if (this.native) {
            attrs = {
                novalidate: this.novalidate,
            };
        }
        return (index.h(index.Host, { key: 'ed6e199a51186247ccad8e06989ba9819e43bed2' }, index.h(NativeEl, Object.assign({ key: 'de4a61e1690819e10096cd1c35eecc0371d73aae' }, attrs, { class: this.formClass }), index.h("slot", { key: 'f35cce725fc54ad822aada77aabaf6f0babd4141' }))));
    }
    get el() { return index.getElement(this); }
};
Form.style = balFormCss;

exports.bal_form = Form;
