'use strict';

var index = require('./index-feA4skrY.js');
var form = require('./form-BSlIiqcR.js');
var helpers = require('./helpers-HuaiWXrB.js');
require('./browser-BwmkTmm8.js');
require('./config.utils-Civnz2jT.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 helpers.waitAfterIdleCallback();
        await helpers.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: 'd25c1b6664e41d72f2d2c5b2ad6532fa184d66bf' }, index.h(NativeEl, Object.assign({ key: '37eefa8920cf3fb639d235d7b21cb7a44be6bd06' }, attrs, { class: this.formClass }), index.h("slot", { key: '7eff7f47f3fd4732988e17944be73373e6133e32' }))));
    }
    get el() { return index.getElement(this); }
};
Form.style = balFormCss;

exports.bal_form = Form;
