import React from 'react'; import { OverlayArrow, Popover as RACPopover, PopoverProps as RACPopoverProps, } from 'react-aria-components'; import { Dialog } from '@plone/components'; export interface PopoverProps extends Omit { children: React.ReactNode; /** Mandatory when children don't contain a or dialogAriaLabelledBy */ dialogAriaLabel?: string; /** Mandatory when children don't contain a or dialogAriaLabel */ dialogAriaLabelledby?: string; arrow?: boolean; } export function Popover({ children, dialogAriaLabel, dialogAriaLabelledby, arrow, isNonModal, shouldCloseOnInteractOutside, ...props }: PopoverProps) { const defaultCloseOnInteractOutside: RACPopoverProps['shouldCloseOnInteractOutside'] = (element) => { return shouldCloseOnInteractOutside ? shouldCloseOnInteractOutside(element) : true; }; return ( {arrow && ( )} {children} ); }