import { FC, default as React } from 'react'; import { Content } from './Popover.content'; import { Trigger, CloseTrigger } from './Popover.trigger'; import { FloatingUIProps } from '../FloatingUI/FloatingUI.context'; import { Spacing, ThemeTypes } from '@viasat/beam-shared/utils'; import { MiddlewareModifier } from '@viasat/beam-shared/components/floatingui'; import { Placement, AutoPlacementOptions, FlipOptions, ShiftOptions, HideOptions, OffsetOptions, UseHoverProps, UseClickProps, UseFocusProps, FloatingPortalProps, UseFloatingOptions, UseRoleProps, SizeOptions } from '@floating-ui/react'; import { FocusManagerProps } from '../FloatingUI/FloatingUI.content'; export interface PopoverProps extends Omit { /** * Specify the theme of the Popover. By default it inherits the theme from the parent */ theme?: ThemeTypes; /** * Whether the arrow is visible */ hideArrow?: boolean; /** * Specify the color mode of the Popover * * @default 'default' */ appearance?: 'default' | 'inverse'; /** * Specify content and sub-components of the Popover * */ children: React.ReactNode; /** * Specify the location of the floating content * * @default 'top' * */ placement?: Placement; /** * Specify if the floating content should automatically choose the placement that has the most space. * AutoPlacementOptions * */ autoPlacement?: boolean | AutoPlacementOptions; /** * Specify if the floating content should flip to the opposite side if there is not enough space. * FlipOptions * * Cannot be used with `autoPlacement` */ flip?: boolean | FlipOptions; /** * Allow shifting of the floating content. * ShiftOptions * */ shift?: boolean | ShiftOptions; /** * Specify if the Popover should auto-hide when the anchor is not in view. * HideOptions */ autoHiding?: boolean | HideOptions; /** * Constrain the floating element's size to fit within available space. * SizeOptions */ size?: boolean | SizeOptions; /** * Middleware functions to modify the behavior of the floating element */ middleware?: MiddlewareModifier; /** * Specify the distance between the anchor and the Popover in rems. * OffsetOptions * * @default 0.5 */ offset?: OffsetOptions | Spacing; /** * Specify the display state */ open?: boolean; /** * Specify the default open state */ defaultOpen?: boolean; /** * Enable hover interaction. * UseHoverProps */ openOnHover?: boolean | UseHoverProps; /** * Enable click interaction. * UseClickProps * * @default true */ openOnClick?: boolean | UseClickProps; /** * Enable focus interaction. * UseFocusProps */ openOnFocus?: boolean | UseFocusProps; /** * Specify if the Popover is portalled */ portalled?: boolean | FloatingPortalProps; /** * Specify if the Popover should trap focus within the floating content. */ trapFocus?: boolean; /** * Configure modal or non-modal focus management for popover content. * FloatingFocusManagerProps */ focusConfiguration?: FocusManagerProps; /** * Callback function that receives change in visibility state of the FloatingUI * * * onOpenChange * * */ onOpenChange?: UseFloatingOptions['onOpenChange']; /** * Adds base screen reader props to the reference and floating elements for a given `role` */ role?: UseRoleProps; } export declare const Root: FC; export declare const Popover: typeof Root & { Content: typeof Content; Trigger: typeof Trigger; CloseTrigger: typeof CloseTrigger; }; export default Popover;