react-tiny-popover
Advanced tools
Comparing version 6.0.4 to 6.0.5
@@ -146,3 +146,3 @@ "use strict"; | ||
var handleWindowResize = react_1.useCallback(function () { | ||
window.requestAnimationFrame(positionPopover); | ||
window.requestAnimationFrame(function () { return positionPopover(); }); | ||
}, [positionPopover]); | ||
@@ -149,0 +149,0 @@ react_1.useEffect(function () { |
@@ -16,3 +16,2 @@ "use strict"; | ||
var positionPopover = react_1.useCallback(function (positionIndex, childRect, popoverRect, parentRect) { | ||
var _a; | ||
if (positionIndex === void 0) { positionIndex = 0; } | ||
@@ -23,3 +22,3 @@ if (childRect === void 0) { childRect = childRef.current.getBoundingClientRect(); } | ||
if (contentLocation) { | ||
var _b = typeof contentLocation === 'function' | ||
var _a = typeof contentLocation === 'function' | ||
? contentLocation({ | ||
@@ -36,3 +35,3 @@ childRect: childRect, | ||
}) | ||
: contentLocation, inputTop = _b.top, inputLeft = _b.left; | ||
: contentLocation, inputTop = _a.top, inputLeft = _a.left; | ||
var left_1 = parentRect.left + inputLeft; | ||
@@ -56,3 +55,3 @@ var top_1 = parentRect.top + inputTop; | ||
var position = isExhausted ? positions[0] : positions[positionIndex]; | ||
var _c = util_1.getNewPopoverRect({ | ||
var _b = util_1.getNewPopoverRect({ | ||
childRect: childRect, | ||
@@ -65,3 +64,3 @@ popoverRect: popoverRect, | ||
reposition: reposition, | ||
}, boundaryInset), rect = _c.rect, boundaryViolation = _c.boundaryViolation; | ||
}, boundaryInset), rect = _b.rect, boundaryViolation = _b.boundaryViolation; | ||
if (boundaryViolation && reposition && !isExhausted) { | ||
@@ -72,6 +71,9 @@ positionPopover(positionIndex + 1, childRect, popoverRect, parentRect); | ||
var top = rect.top, left = rect.left, width = rect.width, height = rect.height; | ||
var shouldNudge = reposition && !isExhausted; | ||
var _c = util_1.getNudgedPopoverRect(rect, parentRect, boundaryInset), nudgedLeft = _c.left, nudgedTop = _c.top; | ||
var finalTop = top; | ||
var finalLeft = left; | ||
if (reposition && !isExhausted) { | ||
(_a = util_1.getNudgedPopoverRect(rect, parentRect, boundaryInset), finalTop = _a.top, finalLeft = _a.left); | ||
if (shouldNudge) { | ||
finalTop = nudgedTop; | ||
finalLeft = nudgedLeft; | ||
} | ||
@@ -93,4 +95,4 @@ popoverRef.current.style.transform = "translate(" + finalLeft + "px, " + finalTop + "px)"; | ||
padding: padding, | ||
nudgedTop: finalTop - top, | ||
nudgedLeft: finalLeft - left, | ||
nudgedTop: nudgedTop - top, | ||
nudgedLeft: nudgedLeft - left, | ||
boundaryInset: boundaryInset, | ||
@@ -97,0 +99,0 @@ }); |
{ | ||
"name": "react-tiny-popover", | ||
"version": "6.0.4", | ||
"version": "6.0.5", | ||
"description": "A simple and highly customizable popover react higher order component with no other dependencies! Typescript friendly.", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
85117
694