@reach/tooltip
Advanced tools
Comparing version 0.1.4 to 0.1.5
@@ -462,2 +462,5 @@ var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; | ||
// feels awkward when it's perfectly aligned w/ the trigger | ||
var OFFSET = 8; | ||
var getStyles = function getStyles(position, triggerRect, tooltipRect) { | ||
@@ -480,3 +483,3 @@ var haventMeasuredTooltipYet = !tooltipRect; | ||
right: window.innerWidth < triggerRect.left + tooltipRect.width, | ||
bottom: window.innerHeight < triggerRect.bottom + tooltipRect.height, | ||
bottom: window.innerHeight < triggerRect.bottom + tooltipRect.height + OFFSET, | ||
left: triggerRect.left - tooltipRect.width < 0 | ||
@@ -490,4 +493,4 @@ }; | ||
left: directionRight ? triggerRect.right - tooltipRect.width + window.scrollX + "px" : triggerRect.left + window.scrollX + "px", | ||
top: directionUp ? triggerRect.top - tooltipRect.height + window.scrollY + "px" : triggerRect.top + triggerRect.height + window.scrollY + "px" | ||
top: directionUp ? triggerRect.top - OFFSET - tooltipRect.height + window.scrollY + "px" : triggerRect.top + OFFSET + triggerRect.height + window.scrollY + "px" | ||
}); | ||
}; |
@@ -482,2 +482,5 @@ "use strict"; | ||
// feels awkward when it's perfectly aligned w/ the trigger | ||
var OFFSET = 8; | ||
var getStyles = function getStyles(position, triggerRect, tooltipRect) { | ||
@@ -500,3 +503,3 @@ var haventMeasuredTooltipYet = !tooltipRect; | ||
right: window.innerWidth < triggerRect.left + tooltipRect.width, | ||
bottom: window.innerHeight < triggerRect.bottom + tooltipRect.height, | ||
bottom: window.innerHeight < triggerRect.bottom + tooltipRect.height + OFFSET, | ||
left: triggerRect.left - tooltipRect.width < 0 | ||
@@ -510,4 +513,4 @@ }; | ||
left: directionRight ? triggerRect.right - tooltipRect.width + window.scrollX + "px" : triggerRect.left + window.scrollX + "px", | ||
top: directionUp ? triggerRect.top - tooltipRect.height + window.scrollY + "px" : triggerRect.top + triggerRect.height + window.scrollY + "px" | ||
top: directionUp ? triggerRect.top - OFFSET - tooltipRect.height + window.scrollY + "px" : triggerRect.top + OFFSET + triggerRect.height + window.scrollY + "px" | ||
}); | ||
}; |
{ | ||
"name": "@reach/tooltip", | ||
"version": "0.1.4", | ||
"version": "0.1.5", | ||
"description": "Accessible tooltips", | ||
@@ -14,6 +14,6 @@ "main": "index.js", | ||
"@reach/auto-id": "0.2.0", | ||
"@reach/portal": "^0.2.0", | ||
"@reach/portal": "^0.2.1", | ||
"@reach/rect": "^0.2.1", | ||
"@reach/utils": "^0.2.1", | ||
"@reach/visually-hidden": "^0.1.3", | ||
"@reach/utils": "^0.2.2", | ||
"@reach/visually-hidden": "^0.1.4", | ||
"prop-types": "^15.7.2" | ||
@@ -20,0 +20,0 @@ }, |
@@ -468,2 +468,5 @@ //////////////////////////////////////////////////////////////////////////////// | ||
// feels awkward when it's perfectly aligned w/ the trigger | ||
const OFFSET = 8; | ||
const getStyles = (position, triggerRect, tooltipRect) => { | ||
@@ -486,3 +489,4 @@ const haventMeasuredTooltipYet = !tooltipRect; | ||
right: window.innerWidth < triggerRect.left + tooltipRect.width, | ||
bottom: window.innerHeight < triggerRect.bottom + tooltipRect.height, | ||
bottom: | ||
window.innerHeight < triggerRect.bottom + tooltipRect.height + OFFSET, | ||
left: triggerRect.left - tooltipRect.width < 0 | ||
@@ -500,5 +504,5 @@ }; | ||
top: directionUp | ||
? `${triggerRect.top - tooltipRect.height + window.scrollY}px` | ||
: `${triggerRect.top + triggerRect.height + window.scrollY}px` | ||
? `${triggerRect.top - OFFSET - tooltipRect.height + window.scrollY}px` | ||
: `${triggerRect.top + OFFSET + triggerRect.height + window.scrollY}px` | ||
}; | ||
}; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
44350
1331
Updated@reach/portal@^0.2.1
Updated@reach/utils@^0.2.2