@contactstudio/mindbeui
Advanced tools
Comparing version 0.0.82 to 0.0.83
@@ -1,1 +0,1 @@ | ||
(function(c){typeof define=="function"&&define.amd?define(c):c()})(function(){"use strict";console.log("Mindbe UI");function c(){const e=document.querySelectorAll("[tooltip]");for(const t of e)t.onmouseenter=({target:o})=>{const{top:n,left:d}=document.body.getBoundingClientRect(),{top:u,left:r}=t.getBoundingClientRect(),i=document.createElement("div");i.innerHTML=o.getAttribute("tooltip"),i.classList.add("tooltip");const f=r-d,g=u-n-35;i.style.setProperty("top",`${g}px`),i.style.setProperty("left",`${f}px`),document.body.append(i)},t.onmouseleave=()=>{document.querySelector("div.tooltip").remove()}}function m(){const e=document.querySelectorAll(".accordion .item");for(const t of e)t.onclick=()=>{if(!t)return;const o=t.parentElement.querySelectorAll(".item");for(const n of o)n!==t&&n.removeAttribute("open")}}function p(){const e=document.querySelectorAll("*[dropdown-trigger]");for(const t of e){const o=document.querySelector(`.dropdown[dropdown="${t.getAttribute("dropdown-trigger")}"]`);w({trigger:t,dropdown:o})}}function w({trigger:e,dropdown:t}){e.onclick=()=>{D({dropdown:t}),E({dropdown:t}),s({trigger:e,dropdown:t}),window.onresize=()=>{s({trigger:e,dropdown:t})},document.onscroll=()=>{s({trigger:e,dropdown:t})},x({trigger:e,dropdown:t}),L({trigger:e,dropdown:t})}}function D({dropdown:e}){const t=document.querySelectorAll("*[dropdown]");for(const o of t)e!==o&&l({dropdown:o})}function E({dropdown:e}){e.classList.toggle("visible"),e.classList.contains("visible")||a()}function L({trigger:e,dropdown:t}){document.onclick=o=>{!e.contains(o.target)&&!t.contains(o.target)&&l({dropdown:t})}}function x({trigger:e,dropdown:t}){const o=t.querySelectorAll(".item");for(const n of o)n.onclick=()=>{if(t.hasAttribute("static")){s({trigger:e,dropdown:t});return}l({dropdown:t})}}function s({trigger:e,dropdown:t}){const{top:o,bottom:n,left:d,right:u}=e.getBoundingClientRect(),{width:r,height:i}=t.getBoundingClientRect(),{width:f,height:g,top:y,left:b}=document.body.getBoundingClientRect(),h=u-b,q=d-b,v=n-y,C=o-y,A=h+r>f,T=v+i>g;T||t.style.setProperty("top",`${v}px`),T&&t.style.setProperty("top",`${C-i}px`),A||t.style.setProperty("left",`${q}px`),A&&t.style.setProperty("left",`${h-r}px`)}function l({dropdown:e}){e.classList.remove("visible"),a()}function a(){window.onresize=()=>{},document.onscroll=()=>{}}(function(){window&&document&&(document.addEventListener("DOMContentLoaded",()=>{c(),m(),p()}),document.addEventListener("click",()=>{c(),m(),p()}))})();const S=""}); | ||
(function(c){typeof define=="function"&&define.amd?define(c):c()})(function(){"use strict";console.log("Mindbe UI");function c(){const e=document.querySelectorAll("[tooltip]");for(const t of e)t.onmouseenter=({target:o})=>{const{top:n,left:d}=document.body.getBoundingClientRect(),{top:u,left:r}=t.getBoundingClientRect(),i=document.createElement("div");i.innerHTML=o.getAttribute("tooltip"),i.classList.add("tooltip");const f=r-d,g=u-n-35;i.style.setProperty("top",`${g}px`),i.style.setProperty("left",`${f}px`),document.body.append(i)},t.onmouseleave=()=>{document.querySelector("div.tooltip").remove()}}function m(){const e=document.querySelectorAll(".accordion .item");for(const t of e)t.onclick=()=>{if(!t)return;const o=t.parentElement.querySelectorAll(".item");for(const n of o)n!==t&&n.removeAttribute("open")}}function p(){const e=document.querySelectorAll("*[dropdown-trigger]");for(const t of e){const o=document.querySelector(`.dropdown[dropdown="${t.getAttribute("dropdown-trigger")}"]`);w({trigger:t,dropdown:o})}}function w({trigger:e,dropdown:t}){e.onclick=()=>{D({dropdown:t}),E({dropdown:t}),s({trigger:e,dropdown:t}),window.onresize=()=>{s({trigger:e,dropdown:t})},document.onscroll=()=>{s({trigger:e,dropdown:t})},x({trigger:e,dropdown:t}),L({trigger:e,dropdown:t})}}function D({dropdown:e}){const t=document.querySelectorAll("*[dropdown]");for(const o of t)e!==o&&l({dropdown:o})}function E({dropdown:e}){e.classList.toggle("visible"),e.classList.contains("visible")||a()}function L({trigger:e,dropdown:t}){document.onclick=o=>{!e.contains(o.target)&&!t.contains(o.target)&&l({dropdown:t})}}function x({trigger:e,dropdown:t}){const o=t.querySelectorAll(".item");for(const n of o)n.onclick=()=>{if(t.hasAttribute("static")){setTimeout(()=>{s({trigger:e,dropdown:t})},0);return}l({dropdown:t})}}function s({trigger:e,dropdown:t}){const{top:o,bottom:n,left:d,right:u}=e.getBoundingClientRect(),{width:r,height:i}=t.getBoundingClientRect(),{width:f,height:g,top:y,left:b}=document.body.getBoundingClientRect(),h=u-b,q=d-b,v=n-y,C=o-y,T=h+r>f,A=v+i>g;A||t.style.setProperty("top",`${v}px`),A&&t.style.setProperty("top",`${C-i}px`),T||t.style.setProperty("left",`${q}px`),T&&t.style.setProperty("left",`${h-r}px`)}function l({dropdown:e}){e.classList.remove("visible"),a()}function a(){window.onresize=()=>{},document.onscroll=()=>{}}(function(){window&&document&&(document.addEventListener("DOMContentLoaded",()=>{c(),m(),p()}),document.addEventListener("click",()=>{c(),m(),p()}))})();const S=""}); |
{ | ||
"name": "@contactstudio/mindbeui", | ||
"version": "0.0.82", | ||
"version": "0.0.83", | ||
"type": "module", | ||
@@ -5,0 +5,0 @@ "main": "dist/mindbeui.js", |
@@ -108,3 +108,5 @@ console.log("Mindbe UI"); | ||
if (dropdown.hasAttribute("static")) { | ||
setPositionDropdown({ trigger, dropdown }); | ||
setTimeout(() => { | ||
setPositionDropdown({ trigger, dropdown }); | ||
}, 0); | ||
return; | ||
@@ -111,0 +113,0 @@ } |
54031
244