UNPKG

reablocks

Version:
108 lines (107 loc) 2.47 kB
import { default as React, FC, LegacyRef } from 'react'; import { OverlayEvent } from '../../utils/Overlay'; import { Modifiers, Placement } from '../../utils/Position'; import { MotionNodeAnimationOptions } from 'motion/react'; import { MenuTheme } from './MenuTheme'; export interface MenuProps { /** * Whether to append the menu to the body or not. * @default true */ appendToBody?: boolean; /** * Autofocus the menu on open or not. * @default true */ autofocus?: boolean; /** * The menu contents. */ children: any | (() => any); /** * CSS class applied to menu element. */ className?: string; /** * Close the menu on click or not. * @default true */ closeOnBodyClick?: boolean; /** * Close the menu on escape. * @default true */ closeOnEscape?: boolean; /** * floating-ui placement type. * @default 'bottom-start' */ placement?: Placement; /** * Reference element for the menu position. */ reference?: any; /** * CSS Properties for the menu. */ style?: React.CSSProperties; /** * Whether to show the menu or not. * @default false */ open?: boolean; /** * @deprecated Use animation configuration instead. * Whether to animate the menu. * @default true */ animated?: boolean; /** * Animation configuration for the collapse. */ animation?: MotionNodeAnimationOptions; /** * Max height of the menu. * @default 'max-height: calc(100vh - 48px)' */ maxHeight?: string; /** * floating-ui Position modifiers. */ modifiers?: Modifiers; /** * Whether the menu should be the same width as the reference element */ autoWidth?: boolean; /** * Min width of the menu. */ minWidth?: number; /** * Max width of the menu. */ maxWidth?: number; /** * Menu was closed. */ onClose?: (event: OverlayEvent) => void; /** * Mouse enter event. */ onMouseEnter?: (event: any) => void; /** * Mouse leave event. */ onMouseLeave?: (event: any) => void; /** * Theme for the Menu. */ theme?: MenuTheme; } export interface MenuRef { /** * Reference to the menu element. */ ref?: LegacyRef<HTMLDivElement>; } export declare const Menu: FC<MenuProps & MenuRef>;