UNPKG

@grafana/ui

Version:
1 lines 896 B
{"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":"AAKa,MAAA,oBAAA,GAAuB,CAAC,OAAgC,KAAA;AACnE,EAAA,IAAI,CAAC,OAAS,EAAA;AACZ,IAAO,OAAA,KAAA;AAAA;AAGT,EAAM,MAAA,UAAA,GAAa,OAAQ,CAAA,aAAA,CAAe,qBAAsB,EAAA;AAChE,EAAM,MAAA,GAAA,GAAM,QAAQ,qBAAsB,EAAA;AAE1C,EAAO,OAAA,GAAA,CAAI,UAAU,CAAK,IAAA,UAAA,CAAW,QAAQ,GAAI,CAAA,KAAA,GAAQ,KAAK,MAAO,CAAA,UAAA;AACvE;;;;"}