UNPKG

@cbinsights/fds

Version:
25 lines (24 loc) 2.01 kB
import React from 'react'; import * as ContextMenu from '@radix-ui/react-context-menu'; declare type RequiredFocusOutsideEventFn = Required<React.ComponentProps<typeof ContextMenu.Content>>['onFocusOutside']; declare type RequiredPointerDownOutsideEventFn = Required<React.ComponentProps<typeof ContextMenu.Content>>['onPointerDownOutside']; declare type FocusOutsideEvent = Parameters<RequiredFocusOutsideEventFn>[0]; declare type PointerDownOutsideEvent = Parameters<RequiredPointerDownOutsideEventFn>[0]; export interface ContextMenuContentProps { /** 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; /** Content of your ContextMenu */ children: React.ReactNode; } declare const ContextMenuContent: ({ children, ...rest }: ContextMenuContentProps) => JSX.Element; export default ContextMenuContent;