UNPKG

@govbr-ds/core

Version:

Padrão Digital de Governo

2 lines 1.55 kB
!function e(t,o){"object"==typeof exports&&"object"==typeof module?module.exports=o():"function"==typeof define&&define.amd?define("core",[],o):"object"==typeof exports?exports.core=o():t.core=o()}(self,(()=>(()=>{var e=()=>{},t,o=()=>{};(()=>{class e{constructor(e,t){this.name=e,this.component=t,this._setType(),this._setBehavior()}_setType(){this.component.classList.contains("foco")&&(this._type="foco"),this.component.classList.contains("legibilidade")&&(this._type="legibilidade"),this.component.classList.contains("inibicao")&&(this._type="inibicao")}_setBehavior(){if(this.component.classList.contains("foco")){this.component.addEventListener("click",(e=>{this.outsideclick=!0,e.target.classList.contains("br-scrim")&&this.hideScrim(e)}));const e=this.component.querySelectorAll(`[data-dismiss=${this.component.id}]`);for(const t of e)t.addEventListener("click",(()=>{this.component.classList.remove("active")}))}}hideScrim(e){e.currentTarget.classList.remove("active")}showScrim(){"foco"===this._type&&this.component.classList.add("active")}}var t=null;for(const t of window.document.querySelectorAll(".scrimexemplo button"))t.addEventListener("click",(()=>{const t=window.document.querySelector("#scrimexample"),o=undefined;new e("br-scrim",t).showScrim()}));for(const t of window.document.querySelectorAll("#scrimexemplo-big"))t.addEventListener("click",(()=>{const t=window.document.querySelector("#scrimfocobig"),o=undefined;new e("br-scrim",t).showScrim()}))})(),e();var i={};return o(),i})())); //# sourceMappingURL=scrim.min.js.map