'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

const index$1 = require('./index-578e90b1.js');

const BceElementInput = class {
    constructor(hostRef) {
        index$1.registerInstance(this, hostRef);
        this.handleInput = (event) => {
            event.cancelBubble = true;
            const target = event.target;
            this.value = target.value || '';
            this.el.dispatchEvent(new Event('input', { bubbles: true }));
        };
    }
    async validate(silent = false) {
        const input = this.el.shadowRoot.querySelector('bce-input');
        return input.validate(silent);
    }
    render() {
        const type = this.template.multiline ? 'textarea' : 'text';
        const validation = [
            this.template.min && 'min:' + this.template.min,
            this.template.max && 'max:' + this.template.max,
            this.template.required ? 'required' : null
        ]
            .filter(value => !!value)
            .join('|');
        return [
            index$1.h("p", null, this.handler.t('question')),
            index$1.h("bce-input", { value: this.value, onInput: this.handleInput, validation: validation, type: type })
        ];
    }
    get el() { return index$1.getElement(this); }
    static get style() { return ":host p{font-weight:500;text-align:center}\@media screen and (min-width: 1024px){:host p{text-align:left}}"; }
};

exports.bce_element_input = BceElementInput;
