import * as react from 'react'; import { SyntheticEvent } from 'react'; import { MergedRef } from '../../shared/src/useMergedRefs.js'; import { FocusScope } from '../../shared/src/useFocusScope.js'; import { VirtualFocusManager, DomFocusManager } from '../../shared/src/useFocusManager.js'; import { ResponsiveProp } from '../../styling/src/useResponsiveValue.js'; import { OverlayPosition } from './useOverlayPosition.js'; import { PopupType } from './usePopupAriaProps.js'; import '../../styling/src/BreakpointProvider.js'; import 'react/jsx-runtime'; import '@popperjs/core'; type PopupAlignment = "start" | "end"; type PopupDirection = "top" | "bottom"; type PopupPosition = OverlayPosition; type PopupAlignmentProp = ResponsiveProp; type PopupDirectionProp = ResponsiveProp; type PopupPositionProp = ResponsiveProp; type PopupTrigger = "none" | "click"; interface PopupProps { /** * The horizontal alignment of the popup relative to the trigger. */ align?: PopupAlignment; /** * Whether or not the popup can flip when it will overflow it's boundary area. */ allowFlip?: boolean; /** * Whether or not the popup position can change to prevent it from being cut off so that it stays visible within its boundary area. */ allowPreventOverflow?: boolean; /** * The initial value of open when in auto controlled mode. */ defaultOpen?: boolean; /** * The direction the open will open relative to the trigger. */ direction?: PopupDirection; /** * Called when the open state change. * @param {SyntheticEvent} event - React's original event. * @param {boolean} isOpen - Indicate if the popup is visible. * @returns {void} */ onOpenChange?: (event: SyntheticEvent, isOpen: boolean) => void; /** * Whether or not to show the popup. */ open?: boolean; /** * The z-index of the menu. */ zIndex?: number; } interface UsePopupOptions { allowFlip?: boolean; allowPreventOverflow?: boolean; boundaryElement?: HTMLElement; defaultOpen?: boolean; disabled?: boolean; hasArrow?: boolean; hideOnEscape?: boolean; hideOnLeave?: boolean; hideOnOutsideClick?: boolean; hideOnTriggerClick?: boolean; id?: string; keyProp?: string; offset?: number[]; onOpenChange?: (event: SyntheticEvent, newValue: boolean) => void; open?: boolean | null; position?: PopupPosition; trigger?: PopupTrigger; } declare function usePopup(type: PopupType, { allowFlip, allowPreventOverflow, boundaryElement, defaultOpen, disabled, hasArrow, hideOnEscape, hideOnLeave, hideOnOutsideClick, hideOnTriggerClick, id, keyProp, offset, onOpenChange, open, position, trigger }?: UsePopupOptions): { arrowProps: { ref?: undefined; } | { ref: MergedRef; }; focusManager: VirtualFocusManager | DomFocusManager; focusScope: FocusScope; isOpen: boolean; overlayProps: { onKeyDown: (event: react.KeyboardEvent) => void; } & { onKeyDown?: undefined; } & { onKeyDown: (event: react.KeyboardEvent) => void; } & { id: string; } & { ref: MergedRef; show: boolean; }; setIsOpen: (event: SyntheticEvent, newValue: boolean) => void; triggerProps: { onClick?: undefined; onKeyDown?: undefined; onKeyUp?: undefined; onBlur?: undefined; onFocus?: undefined; onMouseEnter?: undefined; } & { onClick: (event: SyntheticEvent) => void; onKeyDown: (event: react.KeyboardEvent) => void; onKeyUp: (event: react.KeyboardEvent) => void; onBlur?: undefined; onFocus?: undefined; onMouseEnter?: undefined; } & { onBlur: (event: react.FocusEvent) => void; onFocus: (event: react.FocusEvent) => void; onMouseEnter: (event: react.MouseEvent) => void; onClick?: undefined; onKeyDown?: undefined; onKeyUp?: undefined; } & { "aria-controls": string; "aria-expanded": boolean; "aria-haspopup": PopupType; } & { ref: MergedRef; tabIndex: number; }; }; export { type PopupAlignment, type PopupAlignmentProp, type PopupDirection, type PopupDirectionProp, type PopupPosition, type PopupPositionProp, type PopupProps, type PopupTrigger, type UsePopupOptions, usePopup };