@craftercms/studio-ui
Version:
Services, components, models & utils to build CrafterCMS authoring extensions.
54 lines (52 loc) • 2.36 kB
TypeScript
/*
* 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 * as React from 'react';
import { ElementType } from 'react';
import { DetailedItem, SandboxItem } from '../../models/Item';
import { CSSObject as CSSProperties } from 'tss-react';
import { TypographyProps } from '@mui/material/Typography';
import { ItemStateIconProps } from '../ItemStateIcon';
import { ItemTypeIconProps } from '../ItemTypeIcon';
import { ItemPublishingTargetIconProps } from '../ItemPublishingTargetIcon';
export type ItemDisplayClassKey = 'root' | 'label' | 'labelPreviewable' | 'icon' | 'typeIcon';
export type ItemDisplayStyles = Partial<Record<ItemDisplayClassKey, CSSProperties>>;
export interface ItemDisplayProps<LabelTypographyComponent extends React.ElementType = 'span'>
extends React.HTMLAttributes<HTMLSpanElement> {
showPublishingTarget?: boolean;
showWorkflowState?: boolean;
showItemType?: boolean;
showNavigableAsLinks?: boolean;
classes?: Partial<Record<ItemDisplayClassKey, string>>;
styles?: ItemDisplayStyles;
item: DetailedItem | SandboxItem;
labelTypographyProps?: TypographyProps<
LabelTypographyComponent,
{
component?: LabelTypographyComponent;
}
>;
isNavigableFn?: (item: DetailedItem | SandboxItem) => boolean;
labelComponent?: ElementType;
labelDisplayProp?: 'label' | 'path' | 'previewUrl';
titleDisplayProp?: 'label' | 'path' | 'previewUrl';
stateIconProps?: Partial<ItemStateIconProps>;
publishingTargetIconProps?: Partial<ItemPublishingTargetIconProps>;
itemTypeIconProps?: Partial<ItemTypeIconProps>;
}
declare const ItemDisplay: React.ForwardRefExoticComponent<
ItemDisplayProps<'span'> & React.RefAttributes<HTMLSpanElement>
>;
export default ItemDisplay;