UNPKG

@diondre27/smart-components

Version:

Smart Web Components

1 lines 820 B
import{r as t,h as s,g as r,H as n}from"./p-b8a55399.js";const o=class{constructor(s){t(this,s)}render(){return s("div",{class:"container"},s("div",{class:"row"},s("button",{type:"button",class:"btn btn-primary"},this.buttonText)))}},e=new Map,a=class{constructor(s){t(this,s)}connectedCallback(){this.loadIcon()}loadIcon(){const t=r(`svg/smart-${this.icon}.svg`);this.icon&&(t=>{let s=e.get(t);return s||(s=fetch(t).then(t=>t.status<=299?t.text():(console.warn("Icon not found"),Promise.resolve(null))),e.set(t,s)),s})(t).then(t=>this.svgContent=t)}render(){return s(n,{role:"img"},s("div",this.svgContent?{innerHTML:this.svgContent}:null))}static get assetsDirs(){return["svg"]}static get watchers(){return{icon:["loadIcon"]}}static get style(){return":host{display:block}"}};export{o as smart_button,a as smart_icon};