import React from 'react'; import { PopperContainerProps, PositionStrategy } from './PopperContainer'; import { AnchorPos } from './usePopper'; export * from './usePopper'; export interface PopperProps extends React.HTMLAttributes { /** * Controls the visibility of the popper. * When `true`, the popper is rendered and positioned. * * @required * @example * ```tsx * ... * ``` */ readonly isOpen: boolean; /** * The HTML element to which the popper will be attached and positioned relative to. * If `null` or undefined, the popper will not be positioned. * * @default undefined * @example * ```tsx * const [anchor, setAnchor] = useState(null); * ... * ``` */ readonly anchorElement: HTMLElement | null; /** * Determines the preferred placement of the popper relative to the anchor element. * The actual placement may change if `autoFlip` is enabled and there's not enough space. * * @default 'auto' * @example * ```tsx * ... * ... * ``` */ readonly anchorPos?: AnchorPos; readonly alternativePlacements?: readonly AnchorPos[]; readonly onAnchorPosChanged?: (anchorPos: AnchorPos) => void; /** * The z-index value for the popper container. * Used to control the stacking order of the popper relative to other elements. * * @default theme.zIndex.modal * @example * ```tsx * ... * ``` */ readonly zIndex?: number; /** * When enabled, the popper will automatically try to find the best placement * if the preferred placement doesn't fit in the viewport. * The component will iterate through possible placements until it finds one that fits. * * @default true * @example * ```tsx * ... // Will flip if needed * ... // Will always use preferred placement * ``` */ readonly autoFlip?: boolean; /** * Additional offset (in pixels) from the anchor element. * Positive values move the popper away from the anchor, negative values move it closer. * * @default 0 * @example * ```tsx * ... // 8px gap between anchor and popper * ... // Overlap the anchor by 4px * ``` */ readonly offset?: number; /** * The positioning strategy to use. * - `'fixed'`: Positions relative to the viewport. Works reliably in all cases. * - `'absolute'`: Positions relative to the nearest positioned ancestor. * When using 'absolute', make sure a parent element has `position: relative`. * * @default 'fixed' * @example * ```tsx * ... // Relative to positioned parent * ... // Relative to viewport (recommended) * ``` */ readonly positionStrategy?: PositionStrategy; /** * Minimum distance (in pixels) that the popper must maintain from the viewport edges. * Used to prevent the popper from being positioned too close to the screen boundaries. * The popper will try to flip to another placement if it cannot maintain this margin. * * @default 8 * @example * ```tsx * // Larger margin for better visibility * ... * * // No margin (allow touching edges) * ... * * // Different margins for different devices * ... * ``` */ readonly viewportMargin?: number; /** * Overridable components map for customizing the popper's internal structure. * Allows replacing default components with custom implementations while maintaining functionality. * * @default undefined * @example * ```tsx * * ... * * ``` */ readonly overrides?: PopperOverrides; } export interface PopperOverrides { /** * Custom container component for the popper content. * This component wraps the popper's children and handles positioning styles. * * @default PopperContainer * @example * ```tsx * const CustomContainer = React.forwardRef((props, ref) => ( *
* )); * * * ``` */ readonly Container?: React.ComponentType>; } export declare const PORTAL_ID = "ui-kit-portal"; declare const _default: React.ForwardRefExoticComponent>; export default _default;