@contactstudio/mindbeui
Advanced tools
Comparing version 0.0.70 to 0.0.71
@@ -1,1 +0,1 @@ | ||
(function(i){typeof define=="function"&&define.amd?define(i):i()})(function(){"use strict";console.log("Mindbe UI");async function i(){const e=document.querySelectorAll(".accordion .item:not([disabled]");for(const t of e)t.onclick=()=>{const o=t.parentElement.querySelectorAll(".item:not([disabled])");for(const n of o)n!==t&&n.removeAttribute("open")}}function d(){const e=document.querySelectorAll("*[dropdown-trigger]");for(const t of e){const o=document.querySelector(`.dropdown[dropdown="${t.getAttribute("dropdown-trigger")}"]`);h({trigger:t,dropdown:o})}}function h({trigger:e,dropdown:t}){e.onclick=()=>{b({dropdown:t}),y({dropdown:t}),c({trigger:e,dropdown:t}),window.onresize=()=>{c({trigger:e,dropdown:t})},document.onscroll=()=>{c({trigger:e,dropdown:t})},A({dropdown:t}),w({trigger:e,dropdown:t})}}function b({dropdown:e}){const t=document.querySelectorAll("*[dropdown]");for(const o of t)e!==o&&s({dropdown:o})}function y({dropdown:e}){e.classList.toggle("visible"),e.classList.contains("visible")||u()}function w({trigger:e,dropdown:t}){document.onclick=o=>{!e.contains(o.target)&&!t.contains(o.target)&&s({dropdown:t})}}function A({dropdown:e}){const t=e.querySelectorAll(".item");for(const o of t)o.onclick=()=>{e.hasAttribute("static")||s({dropdown:e})}}function c({trigger:e,dropdown:t}){const{top:o,bottom:n,left:E,right:f}=e.getBoundingClientRect(),{width:g,height:m}=t.getBoundingClientRect(),{width:v,height:D,top:a,left:p}=document.body.getBoundingClientRect(),T=f-p,x=E-p,L=n-a,k=o-a,r=f+g>v,l=n+m>D;console.log("rightExceeded",r),console.log("bottomExceeded",l),l||t.style.setProperty("top",`${L}px`),l&&t.style.setProperty("top",`${k-m}px`),r||t.style.setProperty("left",`${x}px`),r&&t.style.setProperty("left",`${T-g}px`)}function s({dropdown:e}){e.classList.remove("visible"),u()}function u(){window.onresize=()=>{},document.onscroll=()=>{}}(function(){window&&document&&(document.addEventListener("DOMContentLoaded",()=>{i(),d()}),document.addEventListener("click",()=>{i(),d()}))})();const q=""}); | ||
(function(i){typeof define=="function"&&define.amd?define(i):i()})(function(){"use strict";console.log("Mindbe UI");async function i(){const e=document.querySelectorAll(".accordion .item:not([disabled]");for(const t of e)t.onclick=()=>{const o=t.parentElement.querySelectorAll(".item:not([disabled])");for(const n of o)n!==t&&n.removeAttribute("open")}}function d(){const e=document.querySelectorAll("*[dropdown-trigger]");for(const t of e){const o=document.querySelector(`.dropdown[dropdown="${t.getAttribute("dropdown-trigger")}"]`);p({trigger:t,dropdown:o})}}function p({trigger:e,dropdown:t}){e.onclick=()=>{h({dropdown:t}),y({dropdown:t}),c({trigger:e,dropdown:t}),window.onresize=()=>{c({trigger:e,dropdown:t})},document.onscroll=()=>{c({trigger:e,dropdown:t})},w({dropdown:t}),b({trigger:e,dropdown:t})}}function h({dropdown:e}){const t=document.querySelectorAll("*[dropdown]");for(const o of t)e!==o&&s({dropdown:o})}function y({dropdown:e}){e.classList.toggle("visible"),e.classList.contains("visible")||u()}function b({trigger:e,dropdown:t}){document.onclick=o=>{!e.contains(o.target)&&!t.contains(o.target)&&s({dropdown:t})}}function w({dropdown:e}){const t=e.querySelectorAll(".item");for(const o of t)o.onclick=()=>{e.hasAttribute("static")||s({dropdown:e})}}function c({trigger:e,dropdown:t}){const{top:o,bottom:n,left:A,right:f}=e.getBoundingClientRect(),{width:g,height:m}=t.getBoundingClientRect(),{width:E,height:v,top:a,left:k}=document.body.getBoundingClientRect(),D=n-a,x=o-a,r=f+g>E,l=n+m>v;console.log("rightExceeded",r),console.log("bottomExceeded",l),l||t.style.setProperty("top",`${D}px`),l&&t.style.setProperty("top",`${x-m}px`),r||t.style.setProperty("left",`${A}px`),r&&t.style.setProperty("left",`${f-g}px`)}function s({dropdown:e}){e.classList.remove("visible"),u()}function u(){window.onresize=()=>{},document.onscroll=()=>{}}(function(){window&&document&&(document.addEventListener("DOMContentLoaded",()=>{i(),d()}),document.addEventListener("click",()=>{i(),d()}))})();const T=""}); |
{ | ||
"name": "@contactstudio/mindbeui", | ||
"version": "0.0.70", | ||
"version": "0.0.71", | ||
"type": "module", | ||
@@ -5,0 +5,0 @@ "main": "dist/mindbeui.js", |
@@ -105,4 +105,4 @@ console.log("Mindbe UI"); | ||
const absoluteRightTrigger = rightTrigger - scrollLeft; | ||
const absoluteLeftTrigger = leftTrigger - scrollLeft; | ||
// const absoluteRightTrigger = rightTrigger - scrollLeft; | ||
// const absoluteLeftTrigger = leftTrigger - scrollLeft; | ||
const absoluteBottomTrigger = bottomTrigger - scrollTop; | ||
@@ -125,6 +125,6 @@ const absoluteTopTrigger = topTrigger - scrollTop; | ||
if (!rightExceeded) { | ||
dropdown.style.setProperty("left", `${absoluteLeftTrigger}px`); | ||
dropdown.style.setProperty("left", `${leftTrigger}px`); | ||
} | ||
if (rightExceeded) { | ||
dropdown.style.setProperty("left", `${absoluteRightTrigger - widthDrop}px`); | ||
dropdown.style.setProperty("left", `${rightTrigger - widthDrop}px`); | ||
} | ||
@@ -131,0 +131,0 @@ } |
52873