'use strict';

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

const core = require('./core-0f211bec.js');

const BceElementIcon = class {
    constructor(hostRef) {
        core.registerInstance(this, hostRef);
        this.handleClick = (event) => {
            const target = event.target;
            if (!target || !this.template)
                return;
            this.value = parseInt(target.parentElement.dataset.index, 10);
            this.el.dispatchEvent(new Event('input', { bubbles: true }));
        };
    }
    render() {
        if (!this.template)
            return;
        return [
            core.h("p", null, this.template.question),
            core.h("div", null, this.template.options.map((option, index) => (core.h("bce-button", { icon: option.text, "data-index": index, "data-checked": this.value === index, "icon-only": true, onClick: this.handleClick, style: { color: option.color } }))))
        ];
    }
    get el() { return core.getElement(this); }
    static get style() { return "bce-element-icon{position:relative}bce-element-icon p{font-weight:500;text-align:center}\@media screen and (min-width:1024px){bce-element-icon p{text-align:left}}bce-element-icon>div{display:-ms-flexbox;display:flex;-ms-flex-flow:row wrap;flex-flow:row wrap;-ms-flex-pack:center;justify-content:center}bce-element-icon bce-button{--bce-color-l:var(--bce-color-light-l);--bce-color-n:var(--bce-color-light-n);--bce-color-d:var(--bce-color-light-d);--bce-color-t:var(--bce-color-light-t);-ms-flex:0 0 auto;flex:0 0 auto;margin:8px;-webkit-transition:-webkit-transform .2s ease-in-out;transition:-webkit-transform .2s ease-in-out;transition:transform .2s ease-in-out;transition:transform .2s ease-in-out,-webkit-transform .2s ease-in-out}bce-element-icon bce-button[data-checked]{-webkit-transform:scale(1.2);transform:scale(1.2)}bce-element-icon bce-button[data-checked]:focus:before{opacity:0}bce-element-icon bce-button bce-icon{font-size:22px}\@media screen and (min-width:600px){bce-element-icon bce-button bce-icon{font-size:44px}}\@media screen and (min-width:1024px){bce-element-icon>div{-ms-flex-pack:start;justify-content:flex-start}}"; }
};

exports.bce_element_icon = BceElementIcon;
