@contactstudio/mindbeui
Advanced tools
Comparing version 0.0.32 to 0.0.33
@@ -1,1 +0,1 @@ | ||
(function(o){typeof define=="function"&&define.amd?define(o):o()})(function(){"use strict";console.log("Mindbe UI"),function(){window&&document&&(document.addEventListener("DOMContentLoaded",()=>{o(),s()}),document.addEventListener("click",()=>{o(),s()}))}();async function o(){const e=document.querySelectorAll(".accordion .item");for(const t of e)t.onclick=()=>{const i=t.parentElement.querySelectorAll(".item:not([disabled])");for(const n of i)n!==t&&n.removeAttribute("open")}}function s(){const e=document.querySelectorAll("*[dropdown-trigger]");for(const t of e){const i=document.querySelector(`.dropdown[dropdown="${t.getAttribute("dropdown-trigger")}"]`);c({trigger:t,dropdown:i}),r({trigger:t,dropdown:i})}}function c({trigger:e,dropdown:t}){e.onclick=()=>{if(t.classList.contains("visible")){t.classList.remove("visible");return}t.classList.add("visible"),u({trigger:e,dropdown:t}),l({dropdown:t})}}function r({trigger:e,dropdown:t}){document.onclick=i=>{!e.contains(i.target)&&!t.contains(i.target)&&t.classList.remove("visible")}}function l({dropdown:e}){if(e.hasAttribute("static"))return;const t=e.querySelectorAll(".item");for(const i of t)i.onclick=()=>{e.classList.remove("visible")}}function u({trigger:e,dropdown:t}){const{top:i,left:n,right:f,height:a}=e.getBoundingClientRect(),{width:d,height:m}=t.getBoundingClientRect();if(t.hasAttribute("dropend")){t.style.setProperty("top",`${i}px`),t.style.setProperty("left",`${f}px`);return}if(t.hasAttribute("dropstart")){t.style.setProperty("top",`${i}px`),t.style.setProperty("left",`${n-d}px`);return}if(t.hasAttribute("dropup")){t.style.setProperty("top",`${i-m}px`),t.style.setProperty("left",`${n}px`);return}t.style.setProperty("top",`${i+a}px`),t.style.setProperty("left",`${n}px`)}const y=""}); | ||
(function(s){typeof define=="function"&&define.amd?define(s):s()})(function(){"use strict";console.log("Mindbe UI"),function(){window&&document&&(document.addEventListener("DOMContentLoaded",()=>{s(),o()}),document.addEventListener("click",()=>{s(),o()}))}();async function s(){const e=document.querySelectorAll(".accordion .item");for(const t of e)t.onclick=()=>{const i=t.parentElement.querySelectorAll(".item:not([disabled])");for(const n of i)n!==t&&n.removeAttribute("open")}}function o(){const e=document.querySelectorAll("*[dropdown-trigger]");for(const t of e){const i=document.querySelector(`.dropdown[dropdown="${t.getAttribute("dropdown-trigger")}"]`);c({trigger:t,dropdown:i})}}function c({trigger:e,dropdown:t}){e.onclick=()=>{if(t.classList.contains("visible")){t.classList.remove("visible");return}t.classList.add("visible"),u({trigger:e,dropdown:t}),l({dropdown:t}),r({trigger:e,dropdown:t})}}function r({trigger:e,dropdown:t}){document.onclick=i=>{!e.contains(i.target)&&!t.contains(i.target)&&t.classList.remove("visible")}}function l({dropdown:e}){if(e.hasAttribute("static"))return;const t=e.querySelectorAll(".item");for(const i of t)i.onclick=()=>{e.classList.remove("visible")}}function u({trigger:e,dropdown:t}){const{top:i,left:n,right:f,height:a}=e.getBoundingClientRect(),{width:m,height:y}=t.getBoundingClientRect();if(t.hasAttribute("dropend")){t.style.setProperty("top",`${i}px`),t.style.setProperty("left",`${f}px`);return}if(t.hasAttribute("dropstart")){t.style.setProperty("top",`${i}px`),t.style.setProperty("left",`${n-m}px`);return}if(t.hasAttribute("dropup")){t.style.setProperty("top",`${i-y}px`),t.style.setProperty("left",`${n}px`);return}t.style.setProperty("top",`${i+a}px`),t.style.setProperty("left",`${n}px`)}const d=""}); |
{ | ||
"name": "@contactstudio/mindbeui", | ||
"version": "0.0.32", | ||
"version": "0.0.33", | ||
"type": "module", | ||
@@ -5,0 +5,0 @@ "main": "dist/mindbeui.js", |
@@ -43,3 +43,2 @@ console.log("Mindbe UI"); | ||
addShowEventDropdown({ trigger, dropdown }); | ||
addHideEventDropdown({ trigger, dropdown }); | ||
} | ||
@@ -55,5 +54,6 @@ } | ||
dropdown.classList.add("visible"); | ||
setPositionDropdown({ trigger, dropdown }); | ||
addHideEventDropdownItems({ dropdown }); | ||
addHideEventDropdown({ trigger, dropdown }); | ||
}; | ||
@@ -60,0 +60,0 @@ } |