import * as React from 'react';

export default class ClosablePopover extends React.PureComponent<ClosablePopoverProps> {
  open: () => void;
  close: () => void;
}

export interface ClosablePopoverProps {
  /** Controls whether the popover's content is shown or not.
   * When undefined, then the component is Uncontrolled,
   * It is initially open, and it can be closed by close-action */
  opened?: boolean;
  /** Controls whether the popover's content is initially opened (in Uncontrolled mode only)
   * @default true
   */
  initiallyOpened?: boolean;
  /** The popover's target element*/
  target: React.ReactNode;
  /** Callback to call when the popover content is requested to be opened (Uncontrolled mode only) */
  onOpen?: () => void;
  /** callback to call when the popover content is requested to be closed (Uncontrolled mode only). NOTE: this callback is called when the close timeout (if exists) starts */
  onClose?: () => void;
  /** Disable close on mouseLeave
   * @default true
   */
  closeOnMouseLeave?: boolean;
  /** The popover's content, given as a function that receives control-actions and renders the content.
   * In Uncontrolled mode, this function is still called only once.
   */
  content: Function;
  /** Specifies a CSS class name to be appended to the component’s root element.
   * @internal
   */
  className?: string;
}
