UNPKG

@jonbell/react-radial-menu

Version:

React radial menu with sub menu support, animations and themes.

57 lines (51 loc) 2.16 kB
/// <reference types="react" /> import React$1 from 'react'; type DisplayPosition = "top" | "right" | "bottom" | "left" | "center"; type AnimationType = "fade" | "rotate" | "scale"; interface MenuProps extends React.SVGProps<SVGSVGElement> { innerRadius: number; outerRadius: number; centerX: number; centerY: number; children: React.ReactNode; show?: boolean; animationTimeout?: number; animateSubMenuChange?: boolean; animation?: AnimationType[] | AnimationType; theme?: "light" | "dark"; drawBackground?: boolean; hoverToOpen?: boolean; hoverToBackTimeout?: number; } interface MenuItemProps extends Omit<React.SVGProps<SVGGElement>, "onClick"> { __index?: number; __angleStep?: number; __parentMenuId?: string; __isBackButton?: boolean; data?: any; onItemClick?: (event: React.MouseEvent<SVGGElement, MouseEvent>, index: number, data?: any) => void; } interface SubMenuClosedProps extends Omit<MenuItemProps, "children"> { __myMenuId?: string; itemView?: React.ReactNode; } interface SubMenuOpenedProps { __myMenuId?: string; __parentMenuId?: string; displayPosition: DisplayPosition; children: React.ReactNode; displayView?: React.ReactNode; onDisplayClick?: MenuDisplayProps["onClick"]; } type SubMenuProps = SubMenuClosedProps & SubMenuOpenedProps; interface MenuDisplayProps { __parentMenuId: string; position: DisplayPosition; children: React.ReactNode; onClick: (event: React.MouseEvent<SVGGElement, MouseEvent>, position: DisplayPosition) => void; onMouseEnter: (event: React.MouseEvent<SVGGElement, MouseEvent>) => void; } declare const Menu: ({ centerX, centerY, innerRadius, outerRadius, animationTimeout, show, animateSubMenuChange, animation, theme, drawBackground, hoverToOpen, hoverToBackTimeout, ...props }: MenuProps) => React$1.JSX.Element; declare const MenuItem: ({ __angleStep, __index, __parentMenuId, __isBackButton, data: propsData, onItemClick, ...props }: MenuItemProps) => React$1.JSX.Element; declare const SubMenu: (props: SubMenuProps) => React$1.JSX.Element; export { Menu, MenuItem, SubMenu };