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