import * as React from 'react'; import PropTypes from 'prop-types'; export declare type Variant = 'popover' | 'popper'; declare type Event = React.MouseEvent; export interface InjectedProps { open: (eventOrAnchorEl: Event | HTMLElement) => void; close: () => void; toggle: (eventOrAnchorEl: Event | HTMLElement) => void; setOpen: (open: boolean, eventOrAnchorEl: Event | HTMLElement) => void; isOpen: boolean; anchorEl: HTMLElement | null; popupId?: string; variant: Variant; } /** * Creates props for a component that opens the popup when clicked. * * @param {object} popupState the argument passed to the child function of * `PopupState` */ export declare function bindTrigger({ isOpen, open, popupId, variant }: InjectedProps): { 'aria-owns'?: string; 'aria-describedby'?: string; 'aria-haspopup': true; onClick: (event: Event) => void; }; /** * Creates props for a component that toggles the popup when clicked. * * @param {object} popupState the argument passed to the child function of * `PopupState` */ export declare function bindToggle({ isOpen, toggle, popupId, variant }: InjectedProps): { 'aria-owns'?: string; 'aria-describedby'?: string; 'aria-haspopup': true; onClick: (event: Event) => void; }; /** * Creates props for a component that opens the popup while hovered. * * @param {object} popupState the argument passed to the child function of * `PopupState` */ export declare function bindHover({ isOpen, open, close, popupId, variant }: InjectedProps): { 'aria-owns'?: string | null; 'aria-describedby'?: string | null; 'aria-haspopup': true; onMouseEnter: (event: Event) => any; onMouseLeave: (event: Event) => any; }; /** * Creates props for a `Popover` component. * * @param {object} popupState the argument passed to the child function of * `PopupState` */ export declare function bindPopover({ isOpen, anchorEl, close, popupId }: InjectedProps): { id?: string; anchorEl: HTMLElement | null; open: boolean; onClose: () => void; }; /** * Creates props for a `Menu` component. * * @param {object} popupState the argument passed to the child function of * `PopupState` */ export declare const bindMenu: typeof bindPopover; /** * Creates props for a `Popper` component. * * @param {object} popupState the argument passed to the child function of * `PopupState` */ export declare function bindPopper({ isOpen, anchorEl, popupId }: InjectedProps): { id?: string; anchorEl: HTMLElement | null; open: boolean; }; export declare type Props = { popupId?: string; children: (props: InjectedProps) => React.ReactNode | null; variant: Variant; }; interface State { anchorEl: HTMLElement | null; } export default class PopupState extends React.Component { state: State; static propTypes: { /** * The render function. * * @param {object} props the properties injected by `PopupState`: * * * @returns {React.Node} the content to display */ children: PropTypes.Validator<(...args: any[]) => any>; /** * The `id` property to use for the popup. Will be passed to the render * function as `bindPopup.id`, and also used for the `aria-owns` property * passed to the trigger component via `bindTrigger`. */ popupId: PropTypes.Requireable; /** * Which type of popup you are controlling. Use `'popover'` for `Popover` * and `Menu`; use `'popper'` for `Popper`s. Right now this only affects * whether `aria-owns` or `aria-describedby` is used on the trigger * component. */ variant: PropTypes.Validator; }; handleToggle: (eventOrAnchorEl: HTMLElement | React.MouseEvent) => void; handleOpen: (eventOrAnchorEl: HTMLElement | React.MouseEvent) => void; handleClose: () => void; handleSetOpen: (open: boolean, eventOrAnchorEl: HTMLElement | React.MouseEvent) => void; render(): React.ReactNode | null; } export {};