@contactstudio/mindbeui
Advanced tools
Comparing version 0.0.39 to 0.0.40
@@ -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")}"]`);r({trigger:t,dropdown:i})}}function r({trigger:e,dropdown:t}){e.onclick=()=>{if(t.classList.contains("visible")){t.classList.remove("visible");return}f(),t.classList.add("visible"),d({trigger:e,dropdown:t}),u({dropdown:t}),l({trigger:e,dropdown:t})}}function l({trigger:e,dropdown:t}){document.onclick=i=>{!e.contains(i.target)&&!t.contains(i.target)&&t.classList.remove("visible")}}function u({dropdown:e}){if(e.hasAttribute("static")){setTimeout(()=>{e.classList.add("visible")},100);return}const t=e.querySelectorAll(".item");for(const i of t)i.onclick=()=>{e.classList.remove("visible")}}function f(){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:a,height:m}=e.getBoundingClientRect(),{width:p,height:y}=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",`${a}px`);return}if(t.hasAttribute("dropstart")){t.style.setProperty("top",`${s}px`),t.style.setProperty("left",`${o-p}px`);return}if(t.hasAttribute("dropup")){t.style.setProperty("top",`${s-y}px`),t.style.setProperty("left",`${o}px`);return}t.style.setProperty("top",`${s+m}px`),t.style.setProperty("left",`${o}px`)}const b=""}); | ||
(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")}"]`);r({trigger:t,dropdown:i})}}function r({trigger:e,dropdown:t}){e.onclick=()=>{if(t.classList.contains("visible")){t.classList.remove("visible");return}f(),t.classList.add("visible"),d({trigger:e,dropdown:t}),u({dropdown:t}),l({trigger:e,dropdown:t})}}function l({trigger:e,dropdown:t}){document.onclick=i=>{!e.contains(i.target)&&!t.contains(i.target)&&t.classList.remove("visible")}}function u({dropdown:e}){const t=e.querySelectorAll(".item");for(const i of t)i.onclick=()=>{e.hasAttribute("static")||e.classList.remove("visible")}}function f(){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:a,height:p}=e.getBoundingClientRect(),{width:m,height:y}=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",`${a}px`);return}if(t.hasAttribute("dropstart")){t.style.setProperty("top",`${s}px`),t.style.setProperty("left",`${o-m}px`);return}if(t.hasAttribute("dropup")){t.style.setProperty("top",`${s-y}px`),t.style.setProperty("left",`${o}px`);return}t.style.setProperty("top",`${s+p}px`),t.style.setProperty("left",`${o}px`)}const b=""}); |
{ | ||
"name": "@contactstudio/mindbeui", | ||
"version": "0.0.39", | ||
"version": "0.0.40", | ||
"type": "module", | ||
@@ -5,0 +5,0 @@ "main": "dist/mindbeui.js", |
@@ -74,9 +74,2 @@ console.log("Mindbe UI"); | ||
function addHideEventDropdownItems({ dropdown }) { | ||
if (dropdown.hasAttribute("static")) { | ||
setTimeout(() => { | ||
dropdown.classList.add("visible"); | ||
}, 100); | ||
return; | ||
} | ||
const items = dropdown.querySelectorAll(".item"); | ||
@@ -86,2 +79,3 @@ | ||
item.onclick = () => { | ||
if (dropdown.hasAttribute("static")) return; | ||
dropdown.classList.remove("visible"); | ||
@@ -88,0 +82,0 @@ }; |
44112
176