import { ARIAButtonResultProps } from '@fluentui/react-aria'; import { ARIAButtonType } from '@fluentui/react-aria'; import type { ComponentProps } from '@fluentui/react-utilities'; import type { ComponentState } from '@fluentui/react-utilities'; import type { ContextSelector } from '@fluentui/react-context-selector'; import { FC } from 'react'; import type { ForwardRefComponent } from '@fluentui/react-utilities'; import { JSXElementConstructor } from 'react'; import type { PortalProps } from '@fluentui/react-portal'; import type { PositioningShorthand } from '@fluentui/react-positioning'; import type { PositioningVirtualElement } from '@fluentui/react-positioning'; import { Provider } from 'react'; import { ProviderProps } from 'react'; import * as React_2 from 'react'; import { ReactElement } from 'react'; import type { SetVirtualMouseTarget } from '@fluentui/react-positioning'; import type { Slot } from '@fluentui/react-utilities'; import type { SlotClassNames } from '@fluentui/react-utilities'; import type { TriggerProps } from '@fluentui/react-utilities'; export declare const arrowHeights: Record; /** * Data attached to open/close events */ export declare type OnOpenChangeData = { open: boolean; }; /** * The supported events that will trigger open/close of the menu */ export declare type OpenPopoverEvents = MouseEvent | TouchEvent | React_2.FocusEvent | React_2.KeyboardEvent | React_2.MouseEvent; /** * Wrapper component that manages state for a PopoverTrigger and a PopoverSurface components. */ export declare const Popover: React_2.FC; /** * Context shared between Popover and its children components */ export declare type PopoverContextValue = Pick; /** * Popover Props */ export declare type PopoverProps = Pick & { /** * A popover can appear styled with brand or inverted. * When not specified, the default style is used. */ appearance?: 'brand' | 'inverted'; /** * Can contain two children including {@link PopoverTrigger} and {@link PopoverSurface}. * Alternatively can only contain {@link PopoverSurface} if using a custom `target`. */ children: [JSX.Element, JSX.Element] | JSX.Element; /** * Close when scroll outside of it * * @default false */ closeOnScroll?: boolean; /** * Used to set the initial open state of the Popover in uncontrolled mode * * @default false */ defaultOpen?: boolean; /** * Popovers are rendered out of DOM order on `document.body` by default, use this to render the popover in DOM order * * @default false */ inline?: boolean; /** * Sets the delay for closing popover on mouse leave */ mouseLeaveDelay?: number; /** * Display an arrow pointing to the target. * * @default false */ withArrow?: boolean; /** * Call back when the component requests to change value * The `open` value is used as a hint when directly controlling the component */ onOpenChange?: (e: OpenPopoverEvents, data: OnOpenChangeData) => void; /** * Controls the opening of the Popover * * @default false */ open?: boolean; /** * Flag to open the Popover as a context menu. Disables all other interactions * * @default false */ openOnContext?: boolean; /** * Flag to open the Popover by hovering the trigger * * @default false */ openOnHover?: boolean; /** * Flag to close the Popover when an iframe outside a PopoverSurface is focused * * @default true */ closeOnIframeFocus?: boolean; /** * Configures the position of the Popover */ positioning?: PositioningShorthand; /** * Determines popover padding and arrow size * * @default medium */ size?: PopoverSize; /** * Should trap focus * * @default false */ trapFocus?: boolean; /** * Must be used with the `trapFocus` prop * Enables older Fluent UI focus trap behavior where the user * cannot tab into the window outside of the document. This is now * non-standard behavior according to the [HTML dialog spec](https://developer.mozilla.org/en-US/docs/Web/API/HTMLDialogElement/showModal) * where the focus trap involves setting outside elements inert. * * @deprecated this behavior is default provided now, to opt-out of it in favor of standard behavior use the `inertTrapFocus` property */ legacyTrapFocus?: boolean; /** * Enables standard behavior according to the [HTML dialog spec](https://developer.mozilla.org/en-US/docs/Web/API/HTMLDialogElement/showModal) * where the focus trap involves setting outside elements inert, * making navigation leak from the trapped area back to the browser toolbar and vice-versa. * * @default false */ inertTrapFocus?: boolean; /** * By default Popover focuses the first focusable element in PopoverSurface on open. * Specify `disableAutoFocus` to prevent this behavior. * * @default false */ unstable_disableAutoFocus?: boolean; }; export declare const PopoverProvider: Provider & FC>; /** * Determines popover padding and arrow size */ export declare type PopoverSize = 'small' | 'medium' | 'large'; /** * Popover State */ export declare type PopoverState = Pick & Required> & Pick & { /** * Ref of the pointing arrow */ arrowRef: React_2.MutableRefObject; /** * Ref of the PopoverSurface */ contentRef: React_2.MutableRefObject; /** * Anchors the popper to the mouse click for context events */ contextTarget: PositioningVirtualElement | undefined; popoverSurface: React_2.ReactElement | undefined; popoverTrigger: React_2.ReactElement | undefined; /** * A callback to set the target of the popper to the mouse click for context events */ setContextTarget: SetVirtualMouseTarget; /** * Callback to open/close the Popover */ setOpen: (e: OpenPopoverEvents, open: boolean) => void; size: NonNullable; /** * Callback to toggle the open state of the Popover */ toggleOpen: (e: OpenPopoverEvents) => void; /** * Ref of the PopoverTrigger */ triggerRef: React_2.MutableRefObject; }; /** * PopoverSurface component renders react children in a positioned box */ export declare const PopoverSurface: ForwardRefComponent; export declare const popoverSurfaceClassNames: SlotClassNames; /** * PopoverSurface Props */ export declare type PopoverSurfaceProps = ComponentProps; /** * Names of the slots in PopoverSurfaceProps */ export declare type PopoverSurfaceSlots = { root: Slot<'div'>; }; /** * PopoverSurface State */ export declare type PopoverSurfaceState = ComponentState & Pick & { /** * CSS class for the arrow element */ arrowClassName?: string; }; /** * Wraps a trigger element as an only child and adds the necessary event handling to open a popover. */ export declare const PopoverTrigger: React_2.FC; /** * Props that are passed to the child of the DialogTrigger when cloned to ensure correct behaviour for the Dialog */ export declare type PopoverTriggerChildProps = ARIAButtonResultProps; onMouseEnter: React_2.MouseEventHandler; onMouseLeave: React_2.MouseEventHandler; onContextMenu: React_2.MouseEventHandler; }>; /** * PopoverTrigger Props */ export declare type PopoverTriggerProps = TriggerProps & { /** * Disables internal trigger mechanism that ensures a child provided will be a compliant ARIA button. * @default false */ disableButtonEnhancement?: boolean; }; /** * PopoverTrigger State */ export declare type PopoverTriggerState = { children: React_2.ReactElement | null; }; /** * Render the final JSX of Popover */ export declare const renderPopover_unstable: (state: PopoverState) => JSX.Element; /** * Render the final JSX of PopoverSurface */ export declare const renderPopoverSurface_unstable: (state: PopoverSurfaceState) => JSX.Element; /** * Render the final JSX of PopoverTrigger */ export declare const renderPopoverTrigger_unstable: (state: PopoverTriggerState) => ReactElement> | null; /** * Create the state required to render Popover. * * The returned state can be modified with hooks such as usePopoverStyles, * before being passed to renderPopover_unstable. * * @param props - props from this instance of Popover */ export declare const usePopover_unstable: (props: PopoverProps) => PopoverState; export declare const usePopoverContext_unstable: (selector: ContextSelector) => T; /** * Create the state required to render PopoverSurface. * * The returned state can be modified with hooks such as usePopoverSurfaceStyles_unstable, * before being passed to renderPopoverSurface_unstable. * * @param props - props from this instance of PopoverSurface * @param ref - reference to root HTMLDivElement of PopoverSurface */ export declare const usePopoverSurface_unstable: (props: PopoverSurfaceProps, ref: React_2.Ref) => PopoverSurfaceState; /** * Apply styling to the PopoverSurface slots based on the state */ export declare const usePopoverSurfaceStyles_unstable: (state: PopoverSurfaceState) => PopoverSurfaceState; /** * Create the state required to render PopoverTrigger. * * The returned state can be modified with hooks such as usePopoverTriggerStyles, * before being passed to renderPopoverTrigger_unstable. * * @param props - props from this instance of PopoverTrigger */ export declare const usePopoverTrigger_unstable: (props: PopoverTriggerProps) => PopoverTriggerState; export { }