diff --git a/src/components/Popover/Popover.tsx b/src/components/Popover/Popover.tsx index 904e2cf8dd..d227cb3a9d 100644 --- a/src/components/Popover/Popover.tsx +++ b/src/components/Popover/Popover.tsx @@ -47,6 +47,7 @@ export const Popover = forwardRef(function ( onCloseClick, onClick, anchorRef, + strategy, qa, }: PopoverProps & QAProps, ref: ForwardedRef, @@ -93,6 +94,7 @@ export const Popover = forwardRef(function ( const tooltip = ( ; /** Tooltip's trigger content over which the tooltip is shown */ children?: TriggerProps['children']; /** Tooltip's title */ @@ -81,6 +79,7 @@ export type PopoverBehaviorProps = { }; export type PopoverTheme = 'info' | 'special' | 'announcement'; +export type PopoverAnchorRef = PopupAnchorRef; export type PopoverDefaultProps = { /** Whether the tooltip initially opened */ @@ -96,8 +95,6 @@ export type PopoverDefaultProps = { top?: number; left?: number; }; - /** Tooltip's placement */ - placement: PopupPlacement; /** Whether the tooltip has a tail */ hasArrow: boolean; /** Whether the tooltip has a close button */ @@ -110,7 +107,8 @@ export type PopoverDefaultProps = { size: 's' | 'l'; }; -export type PopoverProps = PopoverExternalProps & +export type PopoverProps = Pick & + PopoverExternalProps & PopoverBehaviorProps & Partial; diff --git a/src/components/Popup/Popup.tsx b/src/components/Popup/Popup.tsx index b8118c1aaf..0414e61ecf 100644 --- a/src/components/Popup/Popup.tsx +++ b/src/components/Popup/Popup.tsx @@ -6,10 +6,11 @@ import {Portal} from '../Portal'; import {useLayer, LayerExtendableProps} from '../utils/useLayer'; import { usePopper, - PopperProps, + PopperAnchorRef, + PopperModifiers, PopperOffset, PopperPlacement, - PopperModifiers, + PopperProps, } from '../utils/usePopper'; import {PopupArrow} from './PopupArrow'; import {usePreviousValue} from '../utils/usePreviousValue'; @@ -19,6 +20,7 @@ import {useForkRef} from '../utils/useForkRef'; import './Popup.scss'; export type PopupPlacement = PopperPlacement; +export type PopupAnchorRef = PopperAnchorRef; export interface PopupProps extends DOMProps, LayerExtendableProps, PopperProps, QAProps { open?: boolean; diff --git a/src/components/utils/usePopper.ts b/src/components/utils/usePopper.ts index 05f2e4d8b4..dcb4832fab 100644 --- a/src/components/utils/usePopper.ts +++ b/src/components/utils/usePopper.ts @@ -5,9 +5,10 @@ import popper from '@popperjs/core'; export type PopperPlacement = popper.Placement | popper.Placement[]; export type PopperOffset = [number, number]; export type PopperModifiers = Modifier>[]; +export type PopperAnchorRef = React.RefObject; export interface PopperProps { - anchorRef?: React.RefObject; + anchorRef?: PopperAnchorRef; placement?: PopperPlacement; offset?: [number, number]; modifiers?: PopperModifiers;