UNPKG

@nexusui/components

Version:

These are custom components specially-developed for NexusUI applications. They will make your life easier by giving you out-of-the-box implementations for various high-level UI elements that you can drop directly into your application.

90 lines (89 loc) 2.52 kB
import { MenuProps } from '@mui/material/Menu'; import { MenuItemProps } from '@mui/material/MenuItem'; import { IBasicUser } from '../models'; import { ILegalMenuItem } from '../LegalMenu'; export type IAccountMenuItem = Omit<MenuItemProps, 'children'> & { icon: JSX.Element; name: string; 'data-testid'?: string; }; /** The props type of [[`AccountDropdownContainer`]]. */ export type IAccountDropdown = MenuProps & { /** * This is the system version. */ version: string; /** * User's name and user's avatar url. * * ``` * interface IBasicUser { * id: string; * email: string; * firstName: string; * lastName: string; * avatar: string; * } * * ``` */ userInfo: IBasicUser; /** * The action can trigger sign out. */ onSignOut: () => void; /** * Callback fired when any menu item is clicked. * Typically used as an opportunity to close/dismiss the dropdown. */ onMenuItemClick?: () => void; /** * List of menu items to render in the dropdown. * Custom elements are supported for things like OrganizationSelector and LegalMenu components (or a Divider). * * ``` * type IAccountMenuItem = Omit<MenuItemProps, 'children'> & { * icon: JSX.Element; * name: string; * 'data-testid'?: string; * }; * ``` */ items?: ReadonlyArray<IAccountMenuItem | JSX.Element>; /** * Callback to fire when the account dropdown header is clicked. * This should open account details / options page in a new window. */ onUserClick?: () => void; /** * Indicate if current user is admin user * @default false */ isAdmin?: boolean; /** * List of menu items to show in the legal sub-menu * * ``` * type ILegalMenuItem = Omit<MenuItemProps, 'children'> & { * name: string; * url?: string; * 'data-testid'?: string; * }; * ``` */ legalItems?: ReadonlyArray<ILegalMenuItem>; /** * Indicates the current account management link opening internal or external. * @default '_blank' */ accountLinkTarget?: '_blank' | '_self'; /** * Indicate if the account dropdown is at loading state. */ loading?: boolean; /** * The loading message. */ loadingMessage?: string; }; export declare const AccountDropdown: (props: IAccountDropdown) => import("react/jsx-runtime").JSX.Element;