import type { TippyProps } from '@tippyjs/react'

import type { BoxProps } from '../box'
import type { SystemProps } from '../system'
import type { RenderProps } from '../utils'
import type { UsePopoverType } from './usePopover'
import type { UsePopoverProps } from './usePopover.types'

export type PopoverContentProps = BoxProps

export type PopoverProps = UsePopoverProps & {
  /** Exposes render props to the children. */
  children?: PopoverRenderProps
  /** Mounts provided content only when popover is opened for performance. @default true */
  isLazy?: boolean
  /** Object with any Tippy props. */
  options?: Partial<TippyProps>
}

export type PopoverRenderProps = RenderProps<{
  close: UsePopoverType['close']
  isOpen: UsePopoverType['isOpen']
  open: UsePopoverType['open']
}>

export type PopoverTriggerProps = SystemProps
