UNPKG

@rocketspark/domain-checker

Version:
13 lines 4.25 kB
/*! * * @rocketspark/domain-checker v0.0.34 * https://github.com/rocketspark/domain-checker.git * * Copyright (c) Lee Reichardt and project contributors. * * This source code is licensed under the no license license found in the * LICENSE file in the root directory of this source tree. * */ "use strict";(self.webpackChunkDomainChecker=self.webpackChunkDomainChecker||[]).push([[588],{6588:function(t,s,e){e.r(s),e.d(s,{rs_flint_popup:function(){return o}});var p=e(7915);const o=class{constructor(t){(0,p.r)(this,t),this.rsClose=(0,p.c)(this,"rsClose",7),this.rsOpen=(0,p.c)(this,"rsOpen",7),this.closePopup=()=>{this.close()},this.runPreviousStep=()=>{this.previousStep()},this.type=void 0,this.closeIcon=!0,this.backIcon=!1,this.steps=3,this.progress=1,this.stepActive=1}async open(){this.el.style.display="block",setTimeout((()=>{this.el.style.opacity="1"})),this.rsOpen.emit()}async close(){this.el.style.opacity="0",setTimeout((()=>{this.el.style.display="none"}),150),this.rsClose.emit()}async previousStep(){"step"===this.type&&this.showContent(this.stepActive-=1)}async nextStep(){if("step"===this.type){const t=this.el.querySelector(".rs-flint-popup__back");null!=t&&(t.style.visibility="visible"),this.showContent(this.stepActive+=1)}}renderCloseButton(){let t=null;return this.closeIcon&&(t=(0,p.h)("rs-icon",{name:"x",color:"grey",onClick:this.closePopup,class:"rs-flint-popup__close"})),t}renderBackButton(){let t=null;return(this.backIcon||"step"==this.type)&&(t=(0,p.h)("rs-icon",{name:"arrow-left",color:"grey",class:"rs-flint-popup__back",onClick:this.runPreviousStep})),t}showContent(t){if(1==t){const t=this.el.querySelector(".rs-flint-popup__back");null!=t&&(t.style.visibility="hidden")}const s=this.el.querySelector(".rs-flint-popup__body").querySelectorAll("rs-flint-popup-content");t>s.length&&(this.stepActive=1,this.close()),t<1&&(this.stepActive=1);const e=s[this.stepActive-1];s.forEach((t=>{e!==t&&(t.style.opacity="0",setTimeout((()=>{t.style.display="none"}),150))})),null!=e&&(e.style.display="block",setTimeout((()=>{e.style.opacity="1"})));const p=this.el.querySelector(".rs-flint-popup__progress-step");null!=p&&p.setAttribute("progress",this.stepActive.toString())}componentDidLoad(){const t=this.el.querySelector(".rs-flint-popup__body").querySelectorAll("rs-flint-popup-content");if("step"===this.type){let s=0;t.forEach((t=>{s++,t.setAttribute("order",s.toString()),t.setAttribute("parent-type",this.type)})),this.showContent(this.stepActive)}}render(){const t=this.renderCloseButton(),s=this.renderBackButton();let e=null;return"step"==this.type&&(e=(0,p.h)("rs-progress-step",{steps:this.steps,class:"rs-flint-popup__progress-step",progress:this.progress})),(0,p.h)(p.H,null,(0,p.h)("div",{class:"rs-flint-popup__backdrop",onClick:this.closePopup}),(0,p.h)("div",{class:"rs-flint-popup__inner rs-component-shadow--popup"},(0,p.h)("div",{class:"rs-flint-popup__header"},s,(0,p.h)("slot",{name:"title"}),e,t),(0,p.h)("div",{class:"rs-flint-popup__body"},(0,p.h)("slot",null))))}get el(){return(0,p.g)(this)}};o.style=".sc-rs-flint-popup-h{display:none;opacity:0;transition:opacity 0.15s cubic-bezier(0, 0.55, 0.45, 1)}.sc-rs-flint-popup-h .rs-flint-popup__body.sc-rs-flint-popup{position:relative}.sc-rs-flint-popup-h .rs-flint-popup__backdrop.sc-rs-flint-popup{display:block;width:100%;height:100%;position:fixed;top:0;left:0;background:var(--rs-color-grey-light);opacity:0.8}.sc-rs-flint-popup-h .rs-flint-popup__inner.sc-rs-flint-popup{display:block;width:644px;height:400px;position:fixed;top:50%;left:50%;transform:translate(-50%, -50%);background-color:var(--rs-color-white);border-radius:10px;box-shadow:none;box-sizing:border-box}.sc-rs-flint-popup-h .rs-flint-popup__header.sc-rs-flint-popup{display:flex;align-items:center;justify-content:space-between;padding:30px;box-sizing:border-box}.sc-rs-flint-popup-h .rs-flint-popup__close.sc-rs-flint-popup,.sc-rs-flint-popup-h .rs-flint-popup__back.sc-rs-flint-popup{cursor:pointer;color:var(--rs-color-grey);font-size:16px}.sc-rs-flint-popup-h .rs-flint-popup__close.sc-rs-flint-popup{margin-left:auto}[type='step'].sc-rs-flint-popup-h .rs-flint-popup__close.sc-rs-flint-popup{margin-left:0}"}}]); //# sourceMappingURL=588.index.js.map