@contactstudio/mindbeui
Advanced tools
Comparing version 0.0.46 to 0.0.47
@@ -1,1 +0,1 @@ | ||
(function(n){typeof define=="function"&&define.amd?define(n):n()})(function(){"use strict";console.log("Mindbe UI"),function(){window&&document&&(document.addEventListener("DOMContentLoaded",()=>{n(),c()}),document.addEventListener("click",()=>{n(),c()}))}();async function n(){const e=document.querySelectorAll(".accordion .item");for(const t of e)t.onclick=()=>{const i=t.parentElement.querySelectorAll(".item:not([disabled])");for(const o of i)o!==t&&o.removeAttribute("open")}}function c(){const e=document.querySelectorAll("*[dropdown-trigger]");for(const t of e){const i=document.querySelector(`.dropdown[dropdown="${t.getAttribute("dropdown-trigger")}"]`);l({trigger:t,dropdown:i})}}function l({trigger:e,dropdown:t}){e.onclick=()=>{d(),u({dropdown:t}),console.log("trigger click"),r({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}){const i=t.querySelectorAll(".item");for(const o of i)o.onclick=()=>{r({trigger:e,dropdown:t}),!t.hasAttribute("static")&&t.classList.remove("visible")}}function d(){const e=document.querySelectorAll("*[dropdown]");for(const t of e)t.classList.remove("visible")}function r({trigger:e,dropdown:t}){const{top:i,left:o,right:p,height:y}=e.getBoundingClientRect(),{width:a,height:m}=t.getBoundingClientRect(),g=Math.abs(document.body.getBoundingClientRect().top),s=i+g;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",`${o-a}px`);return}if(t.hasAttribute("dropup")){t.style.setProperty("top",`${s-m}px`),t.style.setProperty("left",`${o}px`);return}t.style.setProperty("top",`${s+y}px`),t.style.setProperty("left",`${o}px`)}const b=""}); | ||
(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=""}); |
{ | ||
"name": "@contactstudio/mindbeui", | ||
"version": "0.0.46", | ||
"version": "0.0.47", | ||
"type": "module", | ||
@@ -5,0 +5,0 @@ "main": "dist/mindbeui.js", |
@@ -50,7 +50,6 @@ console.log("Mindbe UI"); | ||
toggleDropdown({ dropdown }); | ||
console.log("trigger click"); | ||
setPositionDropdown({ trigger, dropdown }); | ||
addHideEventDropdownItems({ trigger, dropdown }); | ||
// addHideEventDropdown({ trigger, dropdown }); | ||
addHideEventDropdown({ trigger, dropdown }); | ||
}; | ||
@@ -57,0 +56,0 @@ } |
44399
181