'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: '8b3d28034718b1594fef9900e776ff718e16441d' }, index.h(NativeEl, Object.assign({ key: '4a21539e4b24d63f95813654d92ac8aa2c0f948b' }, attrs, { class: this.formClass }), index.h("slot", { key: '9b2a367a300b2803a4868c057e54d14952a557ca' }))));
    }
    get el() { return index.getElement(this); }
};
Form.style = balFormCss;

exports.bal_form = Form;
