@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.
36 lines (31 loc) • 1.1 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var boundingClientRect = function boundingClientRect(ref) {
if (ref && ref.current && typeof ref.current.getBoundingClientRect === "function" && typeof window !== "undefined") {
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;
};
var _default = boundingClientRect;
exports.default = _default;