import createEl from '../utils/createEl';
import PlainElem from './PlainElem';
class BadgeElem extends PlainElem {
    constructor() {
        super();
        this.createObs();
        this.getRawData();
        this.fillWrap(this.propsProxy);
    }
    static get observedAttributes() {
        return ['label', ...this.custAttrs, ...this.boolAttrs];
    }
    attributeChangedCallback(name, oldVal, newVal) {
        this.propsProxy[name] = this.getPropVal(BadgeElem, name, newVal);
        if (name === 'label') {
            if (newVal === null) {
                this.wrapEl.remove();
            }
            else {
                this.wrapEl.innerHTML = newVal;
                !this.wrapEl.isConnected && this.appendChild(this.wrapEl);
            }
        }
    }
    connectedCallback() {
        this.connectedRender();
    }
    getRawData() {
        this.getInitPropsRaw(BadgeElem);
        this.propsRaw.label = this.getHtmlVal();
        this.getInitPropsProxy();
        this.innerHTML = '';
    }
    fillWrap(data) {
        this.wrapEl = createEl('div', { role: 'wrap' }, data.label);
    }
    render() {
        this.appendChild(this.wrapEl);
    }
}
BadgeElem.lazyAttrs = ['stor-name'];
BadgeElem.custAttrs = [
    'class',
    'theme', 'type', 'shape',
    'on-init', 'on-reset',
];
BadgeElem.boolAttrs = ['glassy'];
window.customElements.define("ax-badge", BadgeElem);
export default BadgeElem;
