@grafana/ui
Version:
Grafana Components Library
1 lines • 902 B
Source Map (JSON)
{"version":3,"file":"utils.mjs","sources":["../../../../src/components/Menu/utils.ts"],"sourcesContent":["/**\n * Returns whether the provided element overflows the viewport bounds\n *\n * @param element The element we want to know about\n */\nexport const isElementOverflowing = (element: HTMLElement | null) => {\n if (!element) {\n return false;\n }\n\n const wrapperPos = element.parentElement!.getBoundingClientRect();\n const pos = element.getBoundingClientRect();\n\n return pos.width !== 0 && wrapperPos.right + pos.width + 10 > window.innerWidth;\n};\n"],"names":[],"mappings":";AAKO,MAAM,oBAAA,GAAuB,CAAC,OAAA,KAAgC;AACnE,EAAA,IAAI,CAAC,OAAA,EAAS;AACZ,IAAA,OAAO,KAAA;AAAA,EACT;AAEA,EAAA,MAAM,UAAA,GAAa,OAAA,CAAQ,aAAA,CAAe,qBAAA,EAAsB;AAChE,EAAA,MAAM,GAAA,GAAM,QAAQ,qBAAA,EAAsB;AAE1C,EAAA,OAAO,GAAA,CAAI,UAAU,CAAA,IAAK,UAAA,CAAW,QAAQ,GAAA,CAAI,KAAA,GAAQ,KAAK,MAAA,CAAO,UAAA;AACvE;;;;"}