liber-salti
Version:
Saltí - Liber Design System
98 lines (97 loc) • 3.29 kB
TypeScript
/// <reference types="react" />
import { ClassNameMap, PopoverProps } from '@mui/material';
import { MenuListProps } from '@mui/material/MenuList';
import { TransitionProps } from '@mui/material/transitions';
export interface MenuProps {
/**
* A HTML element, or a function that returns it.
* It's used to set the position of the menu.
* @document
*/
anchorEl?: null | HTMLElement;
/**
* If `true` (Default) will focus the `[role="menu"]` if no focusable child is found. Disabled
* children are not focusable. If you set this prop to `false` focus will be placed
* on the parent modal container. This has severe accessibility implications
* and should only be considered if you manage focus otherwise.
*/
autoFocus?: boolean;
/**
* Menu contents, normally `MenuItem`s.
*/
children?: React.ReactNode;
/**
* When opening the menu will not focus the active item but the `[role="menu"]`
* unless `autoFocus` is also set to `false`. Not using the default means not
* following WAI-ARIA authoring practices. Please be considerate about possible
* accessibility implications.
*/
disableAutoFocusItem?: boolean;
/**
* Props applied to the [`MenuList`](/api/menu-list/) element.
*/
MenuListProps?: Partial<MenuListProps>;
/**
* Callback fired when the component requests to be closed.
*
* @param {object} event The event source of the callback.
* @param {string} reason Can be: `"escapeKeyDown"`, `"backdropClick"`, `"tabKeyDown"`.
*/
onClose?: (event?: MouseEvent | TouchEvent) => void;
/**
* Callback fired before the Menu enters.
* @document
*/
onEnter?: TransitionProps['onEnter'];
/**
* Callback fired when the Menu has entered.
* @document
*/
onEntered?: TransitionProps['onEntered'];
/**
* Callback fired when the Menu is entering.
* @document
*/
onEntering?: TransitionProps['onEntering'];
/**
* Callback fired before the Menu exits.
* @document
*/
onExit?: TransitionProps['onExit'];
/**
* Callback fired when the Menu has exited.
* @document
*/
onExited?: TransitionProps['onExited'];
/**
* Callback fired when the Menu is exiting.
* @document
*/
onExiting?: TransitionProps['onExiting'];
/**
* Callback fired when the Responsive Menu is open.
* @document
*/
onOpen?: (event?: MouseEvent | TouchEvent) => void;
/**
* If `true`, the menu is visible.
*/
open: boolean;
/**
* `classes` prop applied to the [`Popover`](/api/popover/) element.
*/
PopoverClasses?: PopoverProps['classes'];
/**
* The variant to use. Use `menu` to prevent selected items from impacting the initial focus
* and the vertical alignment relative to the anchor element.
*/
variant?: 'menu' | 'selectedMenu';
/**
* The position of the menu relative to the anchor;
*/
position?: 'bottom' | 'bottom-right' | 'right' | 'right-bottom';
/**
* The classes of the component;
*/
classes?: ClassNameMap<'paper'>;
}