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.

37 lines (33 loc) 884 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; const boundingClientRect = ref => { if (ref && ref.current && typeof ref.current.getBoundingClientRect === "function" && typeof window !== "undefined") { // $FlowFixMe: TODO const { height, width, top, left, right, bottom } = ref.current.getBoundingClientRect(); 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, width }; } return null; }; var _default = boundingClientRect; exports.default = _default;