import{ElementBuilder}from"../base/builder.mjs";import{Loader}from"../base/loader.mjs";const E=new ElementBuilder;class Shadowbox{constructor(t){this.className=t,this.container=E.div().addClass(t).on("click",(()=>this.hide())),this.close=E.button().addClass(`${t}-close`).content("×").on("click",(()=>this.hide())),this.contentContainer=E.div().addClass(`${t}-content`).on("click",(t=>t.stopPropagation())),Loader.done((()=>{document.body.appendChild(this.container.render())}))}show(t){this.container.content(this.contentContainer.content(this.close,t)).addClass("active")}hide(){this.container.removeClass("active").empty()}}export{Shadowbox};
