import React from 'react'; import type { RefObject } from 'react'; import type { PopoverState } from './usePopoverAnimation'; import type { WithChildren } from '../../../utils/childTypes'; import type { Variant } from 'motion'; export type PopoverAnimation = { enter: Variant; exit: Variant; initial: Variant; }; export interface PopoverProps { /** * An optional property that determines the alignment of the component's content. It * can take the values `'center'` or `'left'`, allowing for flexible layout options. When not specified, * the component may default to a standard alignment or inherit from its parent container. */ alignment?: 'left' | 'right'; /** * An optional property that specifies the name of the anchor element for the popover. * This property is used to link the popover to a specific anchor in the DOM, * allowing for precise positioning of the popover relative to the anchor element. */ anchorName: string; /** * An optional property that specifies the maximum width of the popover content. This property is used to constrain the width of the popover, ensuring that it does not exceed a certain size and maintains a visually appealing layout. The value can be defined in any valid CSS unit (e.g., `px`, `em`, `%`), allowing for flexible design options. */ maxWidth?: string; /** * An optional property that specifies the minimum width of the popover content. This property is used to ensure that the popover maintains a certain width, even when the content is minimal, providing a consistent and visually balanced appearance. The value can be defined in any valid CSS unit (e.g., `px`, `em`, `%`), allowing for flexible design options. */ minWidth?: string; /** * A required property that assigns a unique identifier to the component. This identifier is * used primarily for testing purposes, enabling developers to easily locate and interact with the * component in automated test scripts or debugging tools. */ testId?: string; /** * An optional property that specifies the height of the triangle element in the popover. * This property is used to adjust the size of the triangle relative to the popover content, * allowing for precise control over the visual appearance of the popover and its associated triangle. */ triangleHeight?: number; /** * An optional property that specifies the horizontal offset of the triangle element. * This property is used to adjust the position of the triangle relative to the popover content, * allowing for precise control over the visual alignment of the popover and its associated triangle. * * @default '+ 0px' */ triangleOffset?: `- ${number}px` | `+ ${number}px`; /** * An optional property that specifies the position of the triangle along the horizontal axis. * This property is used to adjust the position of the triangle relative to the popover content, * allowing for precise control over the visual alignment of the popover and its associated triangle. */ trianglePosition?: number; } /** * Factory function for creating a popover component. * * This function creates a popover component that can be used to display content * in a popover dialog. The popover component supports animation and can be * controlled using the `openPopover` and `closePopover` functions returned by * this factory. * * @param state Ref object for managing the popover state. * @param animation The animation to use for the popover. * @returns The popover component. * * @example * ```tsx * const state = useRef>>(null); * const Popover = popoverFactory(state); * ``` */ declare const popoverFactory: (state: RefObject, animation: PopoverAnimation) => { ({ alignment, anchorName, children, maxWidth, minWidth, testId, triangleHeight, triangleOffset, trianglePosition }: WithChildren): React.JSX.Element; displayName: string; }; export { popoverFactory };