react-lightning-design-system
Version:
Salesforce Lightning Design System components built with React
93 lines (92 loc) • 2.5 kB
TypeScript
import React, { AnchorHTMLAttributes, FocusEvent, HTMLAttributes, Ref, FC, ReactNode } from 'react';
import { AutoAlignProps } from './AutoAlign';
import { Bivariant } from './typeUtils';
/**
*
*/
type EventKey = string | number;
/**
*
*/
export type DropdownMenuHeaderProps = {
className?: string;
divider?: 'top' | 'bottom';
children?: ReactNode;
};
/**
*
*/
export declare const DropdownMenuHeader: FC<DropdownMenuHeaderProps>;
export declare const MenuHeader: React.FC<DropdownMenuHeaderProps>;
/**
*
*/
type DropdownMenuHandler = {
onMenuSelect?: Bivariant<(eventKey: EventKey) => void>;
onMenuFocus?: (e: FocusEvent<HTMLElement>) => void;
onMenuBlur?: (e: FocusEvent<HTMLElement>) => void;
};
export declare const DropdownMenuHandlerContext: React.Context<DropdownMenuHandler>;
type OpenSubmenuContext = {
openSubmenuKeys: {
[key: string]: {
isOpen: boolean;
level: number;
} | undefined;
};
handleSubmenuOpen: (key: string, level: number) => void;
};
export declare const OpenSubmenuContext: React.Context<OpenSubmenuContext>;
/**
*
*/
export type DropdownMenuItemProps = {
label?: string;
eventKey?: string | number;
icon?: string;
iconRight?: string;
disabled?: boolean;
divider?: 'top' | 'bottom';
selected?: boolean;
onClick?: (e: React.SyntheticEvent) => void;
submenu?: ReactNode;
submenuItems?: Array<{
key: string | number;
} & DropdownMenuItemProps>;
level?: number;
} & Omit<AnchorHTMLAttributes<HTMLAnchorElement>, 'onClick'>;
/**
*
*/
export declare const DropdownMenuItem: FC<DropdownMenuItemProps>;
export declare const MenuItem: React.FC<DropdownMenuItemProps>;
/**
*
*/
export type DropdownSubmenuProps = {
label?: string;
align?: 'left' | 'right';
children?: ReactNode;
};
/**
*
*/
export declare const DropdownSubmenu: FC<DropdownSubmenuProps>;
/**
*
*/
export type DropdownMenuProps = HTMLAttributes<HTMLElement> & {
size?: 'small' | 'medium' | 'large';
header?: string;
nubbin?: 'top' | 'top left' | 'top right' | 'bottom' | 'bottom left' | 'bottom right' | 'auto';
nubbinTop?: boolean;
hoverPopup?: boolean;
onMenuSelect?: Bivariant<(eventKey: EventKey) => void>;
onMenuClose?: () => void;
elementRef?: Ref<HTMLDivElement>;
};
/**
*
*/
export declare const DropdownMenu: FC<DropdownMenuProps & Pick<AutoAlignProps, 'portalClassName' | 'portalStyle' | 'align'>>;
export {};