UNPKG

@kiwicom/orbit-components

Version:

Orbit-components is a React component library which provides developers with the easiest possible way of building Kiwi.com’s products.

29 lines (26 loc) 993 B
var boundingClientRect = function boundingClientRect(ref) { if (ref && ref.current && typeof ref.current.getBoundingClientRect === "function" && typeof window !== "undefined") { // $FlowFixMe: TODO var _ref$current$getBound = ref.current.getBoundingClientRect(), height = _ref$current$getBound.height, width = _ref$current$getBound.width, top = _ref$current$getBound.top, left = _ref$current$getBound.left, right = _ref$current$getBound.right, bottom = _ref$current$getBound.bottom; return { top: top + (window.scrollY || window.pageYOffset), right: right + (window.scrollX || window.pageXOffset), bottom: bottom + (window.scrollY || window.pageYOffset), left: left + (window.scrollX || window.pageXOffset), pureTop: top, pureLeft: left, pureRight: right, pureBottom: bottom, height: height, width: width }; } return null; }; export default boundingClientRect;