UNPKG

@craftercms/studio-ui

Version:

Services, components, models & utils to build CrafterCMS authoring extensions.

70 lines (68 loc) 2.45 kB
/* * Copyright (C) 2007-2022 Crafter Software Corporation. All Rights Reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as published by * the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ import React, { ReactNode } from 'react'; import { PopoverOrigin, PopoverPosition, PopoverProps, PopoverReference } from '@mui/material/Popover'; import { SystemIconDescriptor } from '../SystemIcon'; import { DetailedItem } from '../../models/Item'; import { ContextMenuOption } from '../ContextMenu/ContextMenu'; import GlobalState from '../../models/GlobalState'; import { CSSObject as CSSProperties } from 'tss-react'; export type ItemMegaMenuUIClassKey = | 'root' | 'mainItem' | 'actionsContainer' | 'actionsColumn' | 'emptyRoot' | 'itemsList' | 'itemInfo' | 'itemInfoContentType' | 'itemEdited' | 'itemEditedText' | 'itemState' | 'infoItem' | 'menuItem' | 'itemDisplayRoot' | 'itemTypeIcon' | 'itemTypography' | 'icon'; export type ItemMegaMenuUIStyles = Partial<Record<ItemMegaMenuUIClassKey, CSSProperties>>; export interface MenuOption { id: string; icon?: SystemIconDescriptor; label: ReactNode; } export interface ItemMegaMenuUIProps { open: boolean; styles?: ItemMegaMenuUIStyles; classes?: Partial<Record<ItemMegaMenuUIClassKey, string>>; isLoading?: boolean; numOfLoaderItems?: number; item: DetailedItem; options: ContextMenuOption[][]; editorialOptions: ContextMenuOption[]; nonEditorialOptions: ContextMenuOption[][]; anchorEl?: PopoverProps['anchorEl']; anchorOrigin?: PopoverOrigin; anchorReference?: PopoverReference; anchorPosition?: PopoverPosition; contentType: string; locale: GlobalState['uiConfig']['locale']; onClose?(): void; onClosed?(): void; onMenuItemClicked(option: string, event: React.MouseEvent<Element, MouseEvent>): void; } export declare function ItemMegaMenuUI(props: ItemMegaMenuUIProps): React.JSX.Element; export default ItemMegaMenuUI;