import { ReactElement } from 'react'; import { MenuItemProps as RACMenuItemProps, MenuProps as RACMenuProps, MenuTriggerProps as RACMenuTriggerProps } from 'react-aria-components'; import { IconElement } from '@servicetitan/anvil2-icons'; import { ButtonProps } from '../Button'; /** Initial vertical side for the popover; React Aria may flip when space is tight. */ export type MenuPlacement = "top" | "bottom"; /** * One row in {@link Menu}. `href` navigates, `onAction` runs in place, and `id` * is the selection key React Aria tracks. */ export type MenuOption = Omit & Required> & { /** * Visible label and accessible name; wraps at the popover's maximum width. */ label: string; /** Leading decorative icon before the label. */ icon?: IconElement; }; export type MenuProps = Omit & Omit, "children" | "items" | "className" | "style" | "render" | "renderEmptyState"> & { /** {@link Button} that opens the menu; rendered as the RAC trigger. */ trigger: ReactElement; /** Options top-to-bottom; order is visual and typeahead. */ items: MenuOption[]; /** Preferred side relative to the trigger. Defaults to `"bottom"`. */ placement?: MenuPlacement; className?: string; };