'use strict';

var index = require('./index-DQjemDtV.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: '1598e29d7763c06aeebe9ae70e4ad27695c9796d' }, index.h(NativeEl, Object.assign({ key: '140fa29ca7900623d52da99ffc5f9bd6db72cd97' }, attrs, { class: this.formClass }), index.h("slot", { key: '1797bdbc8f4f70b50c5d193acea0569e977d8a81' }))));
    }
    get el() { return index.getElement(this); }
};
Form.style = balFormCss;

exports.bal_form = Form;
