1- import { computePosition , offset , flip , shift , arrow } from '@floating-ui/dom'
1+ import { computePosition , offset , shift , arrow , flip } from '@floating-ui/dom'
22import type { IComputePositions } from './compute-positions-types'
33
44export const computeTooltipPosition = async ( {
@@ -8,6 +8,7 @@ export const computeTooltipPosition = async ({
88 place = 'top' ,
99 offset : offsetValue = 10 ,
1010 strategy = 'absolute' ,
11+ middlewares = [ offset ( Number ( offsetValue ) ) , flip ( ) , shift ( { padding : 5 } ) ] ,
1112} : IComputePositions ) => {
1213 if ( ! elementReference ) {
1314 // elementReference can be null or undefined and we will not compute the position
@@ -20,10 +21,11 @@ export const computeTooltipPosition = async ({
2021 return { tooltipStyles : { } , tooltipArrowStyles : { } }
2122 }
2223
23- const middleware = [ offset ( Number ( offsetValue ) ) , flip ( ) , shift ( { padding : 5 } ) ]
24+ const middleware = middlewares
2425
2526 if ( tooltipArrowReference ) {
2627 middleware . push ( arrow ( { element : tooltipArrowReference as HTMLElement , padding : 5 } ) )
28+
2729 return computePosition ( elementReference as HTMLElement , tooltipReference as HTMLElement , {
2830 placement : place ,
2931 strategy,
0 commit comments