From d07bc9be25eafb06eacedfe0cb23896870114a84 Mon Sep 17 00:00:00 2001 From: gabrieljablonski Date: Wed, 1 Nov 2023 15:14:34 -0300 Subject: [PATCH] feat: imperative mode `place` option --- src/components/Tooltip/Tooltip.tsx | 5 +++-- src/components/Tooltip/TooltipTypes.d.ts | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/components/Tooltip/Tooltip.tsx b/src/components/Tooltip/Tooltip.tsx index 2a436341..79b3c021 100644 --- a/src/components/Tooltip/Tooltip.tsx +++ b/src/components/Tooltip/Tooltip.tsx @@ -239,7 +239,7 @@ const Tooltip = ({ }, } as Element computeTooltipPosition({ - place, + place: imperativeOptions?.place ?? place, offset, elementReference: virtualElement, tooltipReference: tooltipRef.current, @@ -328,7 +328,7 @@ const Tooltip = ({ } computeTooltipPosition({ - place, + place: imperativeOptions?.place ?? place, offset, elementReference: activeAnchor, tooltipReference: tooltipRef.current, @@ -355,6 +355,7 @@ const Tooltip = ({ content, externalStyles, place, + imperativeOptions?.place, offset, positionStrategy, position, diff --git a/src/components/Tooltip/TooltipTypes.d.ts b/src/components/Tooltip/TooltipTypes.d.ts index 2cd7d59b..1413e20f 100644 --- a/src/components/Tooltip/TooltipTypes.d.ts +++ b/src/components/Tooltip/TooltipTypes.d.ts @@ -52,6 +52,7 @@ export interface IPosition { export interface TooltipImperativeOpenOptions { anchorSelect?: string position?: IPosition + place?: PlacesType content?: ChildrenType }