import { r as registerInstance, h, g as getElement } from './index-d0047af2.js';

const BceElementInput = class {
    constructor(hostRef) {
        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 [
            h("p", null, this.handler.t('question')),
            h("bce-input", { value: this.value, onInput: this.handleInput, validation: validation, type: type })
        ];
    }
    get el() { return 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}}"; }
};

export { BceElementInput as bce_element_input };
