import * as React from 'react'; import type { Boundary, Padding, FloatingContext, VirtualElement, FloatingRootContext } from '@floating-ui/react'; import { type Side } from '../../utils/useAnchorPositioning'; import type { GenericHTMLProps } from '../../utils/types'; export declare function usePreviewCardPositioner(params: usePreviewCardPositioner.Parameters): usePreviewCardPositioner.ReturnValue; export declare namespace usePreviewCardPositioner { interface SharedParameters { /** * The anchor element to which the preview card popup will be placed at. */ anchor?: Element | null | VirtualElement | React.MutableRefObject | (() => Element | VirtualElement | null); /** * The CSS position strategy for positioning the preview card popup element. * @default 'absolute' */ positionMethod?: 'absolute' | 'fixed'; /** * The container element to which the preview card popup will be appended to. */ container?: HTMLElement | null | React.MutableRefObject; /** * The side of the anchor element that the preview card element should align to. * @default 'bottom' */ side?: Side; /** * The gap between the anchor element and the preview card element. * @default 0 */ sideOffset?: number; /** * The alignment of the preview card element to the anchor element along its cross axis. * @default 'center' */ alignment?: 'start' | 'end' | 'center'; /** * The offset of the preview card element along its alignment axis. * @default 0 */ alignmentOffset?: number; /** * The boundary that the preview card element should be constrained to. * @default 'clippingAncestors' */ collisionBoundary?: Boundary; /** * The padding of the collision boundary. * @default 5 */ collisionPadding?: Padding; /** * If `true`, the preview card will be hidden if it is detached from its anchor element due to * differing clipping contexts. * @default false */ hideWhenDetached?: boolean; /** * If `true`, allow the preview card to remain in stuck view while the anchor element is scrolled * out of view. * @default false */ sticky?: boolean; /** * Determines the padding between the arrow and the preview card popup's edges. Useful when the * preview card popup has rounded corners via `border-radius`. * @default 5 */ arrowPadding?: number; /** * If `true`, preview card stays mounted in the DOM when closed. * @default false */ keepMounted?: boolean; /** * Whether the preview card popup continuously tracks its anchor after the initial positioning * upon mount. * @default true */ trackAnchor?: boolean; } interface Parameters extends SharedParameters { /** * If `true`, the preview card is open. */ open?: boolean; /** * The floating root context. */ floatingRootContext?: FloatingRootContext; /** * Whether the preview card is mounted. */ mounted?: boolean; } interface ReturnValue { /** * Props to spread on the preview card positioner element. */ getPositionerProps: (externalProps?: GenericHTMLProps) => GenericHTMLProps; /** * The ref of the preview card arrow element. */ arrowRef: React.MutableRefObject; /** * Determines if the arrow cannot be centered. */ arrowUncentered: boolean; /** * The rendered side of the preview card element. */ side: 'top' | 'right' | 'bottom' | 'left'; /** * The rendered alignment of the preview card element. */ alignment: 'start' | 'end' | 'center'; /** * The styles to apply to the preview card arrow element. */ arrowStyles: React.CSSProperties; /** * The floating context. */ positionerContext: FloatingContext; } }