import { ReactNode, Ref } from 'react'; import { MenuTriggerProps as RaMenuTriggerProps, MenuProps as RaMenuProps, MenuItemProps as RaMenuItemProps, ButtonProps as RaButtonProps, PopoverProps as RaPopoverProps, MenuSectionProps as RaMenuSectionProps, SubmenuTriggerProps as RaSubmenuTriggerProps } from 'react-aria-components'; import { HTMLChakraProps, SlotRecipeProps } from '@chakra-ui/react/styled-system'; import { OmitInternalProps } from '../../type-utils/omit-props'; type MenuRecipeProps = SlotRecipeProps<"nimbusMenu">; export type MenuRootSlotProps = HTMLChakraProps<"div", MenuRecipeProps>; export type MenuTriggerSlotProps = HTMLChakraProps<"button">; export type MenuPopoverSlotProps = HTMLChakraProps<"div">; export type MenuContentSlotProps = HTMLChakraProps<"div">; export type MenuItemSlotProps = HTMLChakraProps<"div">; export type MenuSectionSlotProps = HTMLChakraProps<"div">; export type MenuSectionLabelSlotProps = HTMLChakraProps<"div">; export type MenuSubmenuSlotProps = HTMLChakraProps<"div">; export type MenuRootProps = Omit & Omit, "children"> & OmitInternalProps & { /** * The trigger element and menu content */ children: RaMenuTriggerProps["children"]; /** * The trigger event to use for the menu. * @default "press" */ trigger?: "press" | "longPress"; /** * The placement of the menu relative to the trigger. * @default "bottom start" */ placement?: RaPopoverProps["placement"]; }; export type MenuTriggerProps = OmitInternalProps & RaButtonProps & { /** * When true, the trigger will not render its own button element. * Instead, it will pass props to its child element. */ asChild?: boolean; ref?: Ref; }; export type MenuContentProps = OmitInternalProps & { children?: ReactNode; ref?: Ref; /** * The placement of the menu relative to the trigger. */ placement?: RaPopoverProps["placement"]; }; export type MenuItemProps = RaMenuItemProps & { /** * if set to `true`, highlights the item as critical (red) * */ isCritical?: boolean; ref?: Ref; }; export type MenuSectionProps = RaMenuSectionProps & { ref?: Ref; /** * Label for the section header */ label: ReactNode; }; export type MenuSectionLabelProps = { children: ReactNode; ref?: Ref; }; export type MenuSubmenuProps = MenuContentProps; export type MenuSubmenuTriggerProps = RaSubmenuTriggerProps & { ref?: Ref; }; export {};