import { ReactElement, ReactNode } from 'react'; import * as PopoverPrimitive from '@radix-ui/react-popover'; export interface PopoverProps { children: ReactElement; content: ReactNode | (() => ReactNode); active: boolean; padding?: 'medium' | 'small' | 'none'; coloring?: 'light' | 'dark' | 'warning' | 'error'; placement?: 'top' | 'bottom' | 'left' | 'right'; alignment?: 'center' | 'start' | 'end'; zIndex?: number | string; hasPointer?: boolean; offsetFromAnchor?: number; passthroughProps?: PopoverPrimitive.PopoverContentProps; onExit?: () => void; getInitialFocus?: (e: Event) => void; clickOutsideCloses?: boolean; escapeCloses?: boolean; hideWhenAnchorIsOffscreen?: boolean; allowPlacementAxisChange?: boolean; } /** * Display a popover. The popover is positioned relative to an anchor element */ declare function Popover({ coloring, placement, alignment, padding, active, hasPointer, zIndex, hideWhenAnchorIsOffscreen, allowPlacementAxisChange, clickOutsideCloses, escapeCloses, getInitialFocus, offsetFromAnchor, passthroughProps, onExit, children, content }: PopoverProps): ReactElement; declare namespace Popover { var propTypes: { /** * The trigger element. */ children: any; /** * Triggers the active state of the popover. When true, the popover appears. */ active: any; /** * The popover content. This can either be a string, valid JSX, or a function * returning either. */ content: any; /** * Preferred placement of the popover in relation to the anchor. * Adjusted according to available space. */ placement: any; /** * `'center'`, `'start'`, `'end'` Alignment of the popover edge in relation to the trigger element. */ alignment: any; /** * `'light'`, `'dark'`, `'warning'`, or `'error'`. */ coloring: any; /** * `'medium'`, `'small'`, or `'none'`. */ padding: any; /** * z-index of the popover. */ zIndex: any; /** * Whether or not the popover has a triangle pointer. */ hasPointer: any; /** * If `true`, the popover will hide when its anchor is scrolled offscreen. * By default, the popover will follow its anchor wherever it goes. * * If your anchor is within an internally scrolling area, you may want to * use `true`, so the popover doesn't existing in a disembodied state after * its anchor is scrolled away. */ hideWhenAnchorIsOffscreen: any; /** * If `false`, the popover is *not* allowed to change axes on the anchor when * modifying its position to fit available space. By default, popovers on the * `left` and `right`, for example, might change to `bottom` is there is * neither space on the left nor the right. */ allowPlacementAxisChange: any; /** * If `false`, clicking outside the popover will not close it. * By default, it does. */ clickOutsideCloses: any; /** * If `false`, hitting Escape will not close the popover. By default, it does. */ escapeCloses: any; /** * A function called when popover is dismissed. You need to use this callback * to remove the Popover from the rendered page. */ onExit: any; /** * A function that returns a DOM node. Use to specify which element should * receive focus when popover is first rendered. */ getInitialFocus: any; /** * Number of pixels by which the popover should be offset from its anchor. */ offsetFromAnchor: any; /** * Props to pass directly to popover content options from `@radix-ui/react-popover`. */ passthroughProps: any; }; } export default Popover;