@legion-ui-kit/react-core
Version:
To install the package into your project:
3 lines (2 loc) • 831 B
JavaScript
import{TOOLTIP_POSITION as t}from"./Tooltip.constant.js";const e=e=>{const{position:o,tooltipHeight:r,tooltipWidth:p,targetHeight:l,targetWidth:f,targetTop:n,targetLeft:c}=e;switch(o){case t["top-left"]:return{top:n-r,left:c};case t["top-right"]:return{top:n-r,left:c+f-p};case t["right-top"]:return{top:n,left:c+f};case t["right-center"]:return{top:n+l/2-r/2,left:c+f};case t["right-bottom"]:return{top:n+l-r,left:c+f};case t["bottom-left"]:return{top:n+l,left:c};case t["bottom-center"]:return{top:n+l,left:c+f/2-p/2};case t["bottom-right"]:return{top:n+l,left:c+f-p};case t["left-top"]:return{top:n,left:c-p};case t["left-center"]:return{top:n+l/2-r/2,left:c-p};case t["left-bottom"]:return{top:n+l-r,left:c-p};default:return{top:n-r,left:c+f/2-p/2}}};export{e as getTooltipPosition};
//# sourceMappingURL=Tooltip.helper.js.map