@contactstudio/mindbeui
Advanced tools
Comparing version 0.0.31 to 0.0.32
@@ -1,1 +0,1 @@ | ||
(function(o){typeof define=="function"&&define.amd?define(o):o()})(function(){"use strict";console.log("Mindbe UI"),function(){window&&document&&(window.onload=()=>{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:y,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-y}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 d=""}); | ||
(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=""}); |
{ | ||
"name": "@contactstudio/mindbeui", | ||
"version": "0.0.31", | ||
"version": "0.0.32", | ||
"type": "module", | ||
@@ -5,0 +5,0 @@ "main": "dist/mindbeui.js", |
@@ -5,6 +5,6 @@ console.log("Mindbe UI"); | ||
if (window && document) { | ||
window.onload = () => { | ||
document.addEventListener("DOMContentLoaded", () => { | ||
Accordion(); | ||
Dropdown(); | ||
}; | ||
}); | ||
document.addEventListener("click", () => { | ||
@@ -11,0 +11,0 @@ Accordion(); |
43570