UNPKG

@cbinsights/fds

Version:
27 lines (26 loc) 2.1 kB
import React from 'react'; import * as DropdownMenu from '@radix-ui/react-dropdown-menu'; declare type RequiredFocusOutsideEventFn = Required<React.ComponentProps<typeof DropdownMenu.Content>>['onFocusOutside']; declare type RequiredPointerDownOutsideEventFn = Required<React.ComponentProps<typeof DropdownMenu.Content>>['onPointerDownOutside']; declare type FocusOutsideEvent = Parameters<RequiredFocusOutsideEventFn>[0]; declare type PointerDownOutsideEvent = Parameters<RequiredPointerDownOutsideEventFn>[0]; export interface MenuContentProps { /** Change the component to the HTML tag or custom component of the only child. This will merge the original component props with the props of the supplied element/component and change the underlying DOM node. */ asChild?: boolean; /** Event handler called when focus moves back after closing. It can be prevented by calling event.preventDefault. */ onCloseAutoFocus?: (event: Event) => void; /** Event handler called when the escape key is down. It can be prevented by calling event.preventDefault. */ onEscapeKeyDown?: (event: KeyboardEvent) => void; /** Event handler called when focus moves outside the bounds of the component. It can be prevented by calling event.preventDefault. */ onFocusOutside?: (event: FocusOutsideEvent) => void; /** Event handler called when an interaction (pointer or focus event) happens outside the bounds of the component. It can be prevented by calling event.preventDefault. */ onInteractOutside?: (event: PointerDownOutsideEvent | FocusOutsideEvent) => void; /** Event handler called when a pointer event occurs outside the bounds of the component. It can be prevented by calling event.preventDefault. */ onPointerDownOutside?: (event: PointerDownOutsideEvent) => void; /** Whether to render in a Portal when open. This prop is ignored within submenus. */ portalled?: boolean; /** Content of your ContextMenu */ children: React.ReactNode; } declare const MenuContent: ({ children, ...rest }: MenuContentProps) => JSX.Element; export default MenuContent;