import { Popover as HeadlessPopover, PopoverBackdrop as HeadlessPopoverBackdrop, PopoverGroup as HeadlessPopoverGroup, PopoverPanel as HeadlessPopoverPanel } from '@headlessui/react'; import React from 'react'; import type { RefObject } from 'react'; import type { ExtractProps, RenderProps } from '../../util/utility-types'; export type PopoverProps = ExtractProps & { /** * Custom classname for additional styles */ className?: string; }; export type PopoverContentProps = ExtractProps & { /** * Custom classname for additional styles for the arrow. */ arrowClassName?: string; /** * Custom classname for additional styles on the generic popover container. */ bodyClassName?: string; /** * Custom classname for additional styles for the entire popover content. */ className?: string; } & RenderProps<{ /** * Render prop indicating popover open status. */ open: boolean; /** * Render prop that closes popover when called. */ close: (focusableElement?: HTMLElement | RefObject) => void; }>; export type PopoverButtonProps = { as?: React.ElementType; className?: string; } & RenderProps<{ open: boolean; }>; /** * ## Usage * * * Keeps information close to a button, etc., that triggers it. * * Typically used for showing contextual information or quick actions without taking focus away from the main page. * * Doesn't block interaction with the rest of the page. * * | Type/Use | Description | Example | * |----------|-------------|---------| * | Show additional info | Displays extra details or hints related to a UI element. | Showing help text when hovering over an info icon. | * | Form fields / Input | Embeds lightweight form elements in a contextual way. | A popover with a color picker or emoji selector. | * * ### Best Practices * * * Don't use popovers for popup menus. Use a Menu instead. * * ## Interaction * * Popovers open in response to user interaction—click, tap, or hover. They close when clicking outside the popover, pressing `Esc`, selecting an item within the popover, or interacting with the trigger again (for toggling popovers). * * ## Resources * * * https://headlessui.com/react/popover */ export declare const Popover: { ({ ...other }: PopoverProps): React.JSX.Element; displayName: string; /** * A button that when clicked, can show or hide the Popover Menu * (Product teams can decide how a Popover will close, if it is on click, release, hover, etc.) * * If you need to use some sort of special button, pass it as the `as` prop. Make sure the * component accepts `aria-expanded` and `aria-controls` props for accessibility. * */ Button: { (props: PopoverButtonProps): React.JSX.Element; displayName: string; }; /** * A floating container that can be resized to fit content inside */ Content: { ({ anchor, arrowClassName, bodyClassName, children, className, ...other }: PopoverContentProps): React.JSX.Element; displayName: string; }; Overlay: { (props: ExtractProps): React.JSX.Element; displayName: string; }; Group: { (props: ExtractProps): React.JSX.Element; displayName: string; }; };