@contactstudio/mindbeui
Advanced tools
Comparing version 0.0.47 to 0.0.48
@@ -1,1 +0,1 @@ | ||
(function(i){typeof define=="function"&&define.amd?define(i):i()})(function(){"use strict";console.log("Mindbe UI"),function(){window&&document&&(document.addEventListener("DOMContentLoaded",()=>{i(),c()}),document.addEventListener("click",()=>{i(),c()}))}();async function i(){const e=document.querySelectorAll(".accordion .item");for(const t of e)t.onclick=()=>{const o=t.parentElement.querySelectorAll(".item:not([disabled])");for(const n of o)n!==t&&n.removeAttribute("open")}}function c(){const e=document.querySelectorAll("*[dropdown-trigger]");for(const t of e){const o=document.querySelector(`.dropdown[dropdown="${t.getAttribute("dropdown-trigger")}"]`);l({trigger:t,dropdown:o})}}function l({trigger:e,dropdown:t}){e.onclick=()=>{a(),u({dropdown:t}),r({trigger:e,dropdown:t}),d({trigger:e,dropdown:t}),f({trigger:e,dropdown:t})}}function u({dropdown:e}){if(e.classList.contains("visible")){e.classList.remove("visible");return}e.classList.add("visible")}function f({trigger:e,dropdown:t}){document.onclick=o=>{const n=!e.contains(o.target)&&!t.contains(o.target);console.log("isOutsideClick",n)}}function d({trigger:e,dropdown:t}){const o=t.querySelectorAll(".item");for(const n of o)n.onclick=()=>{r({trigger:e,dropdown:t}),!t.hasAttribute("static")&&t.classList.remove("visible")}}function a(){const e=document.querySelectorAll("*[dropdown]");for(const t of e)t.classList.remove("visible")}function r({trigger:e,dropdown:t}){const{top:o,left:n,right:p,height:y}=e.getBoundingClientRect(),{width:m,height:g}=t.getBoundingClientRect(),b=Math.abs(document.body.getBoundingClientRect().top),s=o+b;if(t.hasAttribute("dropend")){t.style.setProperty("top",`${s}px`),t.style.setProperty("left",`${p}px`);return}if(t.hasAttribute("dropstart")){t.style.setProperty("top",`${s}px`),t.style.setProperty("left",`${n-m}px`);return}if(t.hasAttribute("dropup")){t.style.setProperty("top",`${s-g}px`),t.style.setProperty("left",`${n}px`);return}t.style.setProperty("top",`${s+y}px`),t.style.setProperty("left",`${n}px`)}const A=""}); | ||
(function(i){typeof define=="function"&&define.amd?define(i):i()})(function(){"use strict";console.log("Mindbe UI"),function(){window&&document&&(document.addEventListener("DOMContentLoaded",()=>{i(),c()}),document.addEventListener("click",()=>{i(),c()}))}();async function i(){const e=document.querySelectorAll(".accordion .item");for(const t of e)t.onclick=()=>{const o=t.parentElement.querySelectorAll(".item:not([disabled])");for(const n of o)n!==t&&n.removeAttribute("open")}}function c(){const e=document.querySelectorAll("*[dropdown-trigger]");for(const t of e){const o=document.querySelector(`.dropdown[dropdown="${t.getAttribute("dropdown-trigger")}"]`);l({trigger:t,dropdown:o})}}function l({trigger:e,dropdown:t}){e.onclick=()=>{a(),u({dropdown:t}),r({trigger:e,dropdown:t}),d({trigger:e,dropdown:t}),f({trigger:e,dropdown:t})}}function u({dropdown:e}){if(e.classList.contains("visible")){e.classList.remove("visible");return}e.classList.add("visible")}function f({trigger:e,dropdown:t}){document.onclick=o=>{const n=!e.contains(o.target)&&!t.contains(o.target);console.log("isOutsideClick",n),console.log(t),console.log(o.target)}}function d({trigger:e,dropdown:t}){const o=t.querySelectorAll(".item");for(const n of o)n.onclick=()=>{r({trigger:e,dropdown:t}),!t.hasAttribute("static")&&t.classList.remove("visible")}}function a(){const e=document.querySelectorAll("*[dropdown]");for(const t of e)t.classList.remove("visible")}function r({trigger:e,dropdown:t}){const{top:o,left:n,right:p,height:y}=e.getBoundingClientRect(),{width:m,height:g}=t.getBoundingClientRect(),b=Math.abs(document.body.getBoundingClientRect().top),s=o+b;if(t.hasAttribute("dropend")){t.style.setProperty("top",`${s}px`),t.style.setProperty("left",`${p}px`);return}if(t.hasAttribute("dropstart")){t.style.setProperty("top",`${s}px`),t.style.setProperty("left",`${n-m}px`);return}if(t.hasAttribute("dropup")){t.style.setProperty("top",`${s-g}px`),t.style.setProperty("left",`${n}px`);return}t.style.setProperty("top",`${s+y}px`),t.style.setProperty("left",`${n}px`)}const A=""}); |
{ | ||
"name": "@contactstudio/mindbeui", | ||
"version": "0.0.47", | ||
"version": "0.0.48", | ||
"type": "module", | ||
@@ -5,0 +5,0 @@ "main": "dist/mindbeui.js", |
@@ -72,2 +72,4 @@ console.log("Mindbe UI"); | ||
console.log("isOutsideClick", isOutsideClick); | ||
console.log(dropdown); | ||
console.log(event.target); | ||
@@ -74,0 +76,0 @@ // if (isOutsideClick) { |
44494
183