@craftercms/studio-ui
Version:
Services, components, models & utils to build CrafterCMS authoring extensions.
67 lines (65 loc) • 2.6 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 { TypographyProps } from '@mui/material/Typography';
import React, { ElementType, PropsWithChildren, ReactNode } from 'react';
import StandardAction from '../../models/StandardAction';
import { DialogHeaderActionProps } from '../DialogHeaderAction/DialogHeaderAction';
import { SystemIconDescriptor } from '../SystemIcon';
import { PartialSxRecord } from '../../models';
export interface DialogHeaderStateAction {
icon: SystemIconDescriptor;
'aria-label': string;
onClick: StandardAction;
[prop: string]: any;
}
export type DialogHeaderProps<
PrimaryTypographyComponent extends ElementType = 'h2',
SecondaryTypographyComponent extends ElementType = 'p'
> = PropsWithChildren<{
id?: string;
title: ReactNode;
titleTypographyProps?: TypographyProps<
PrimaryTypographyComponent,
{
component?: PrimaryTypographyComponent;
}
>;
subtitleTypographyProps?: TypographyProps<
SecondaryTypographyComponent,
{
component?: SecondaryTypographyComponent;
}
>;
subtitle?: ReactNode;
leftActions?: DialogHeaderActionProps[];
rightActions?: DialogHeaderActionProps[];
closeIcon?: ElementType;
minimizeIcon?: ElementType;
fullScreenIcon?: ElementType;
backIcon?: ElementType;
classes?: Partial<Record<'root' | 'titleWrapper' | 'subtitleWrapper', string>>;
className?: string;
sxs?: PartialSxRecord<
'root' | 'titleWrapper' | 'title' | 'subtitle' | 'subtitleWrapper' | 'leftActions' | 'rightActions' | 'backIcon'
>;
disabled?: boolean;
onCloseButtonClick?(e: React.MouseEvent<HTMLButtonElement, MouseEvent>, reason: string): void;
onMinimizeButtonClick?(e: React.MouseEvent<HTMLButtonElement, MouseEvent>): void;
onFullScreenButtonClick?(e: React.MouseEvent<HTMLButtonElement, MouseEvent>): void;
onBack?(): void;
}>;
export declare function DialogHeader(props: DialogHeaderProps): React.JSX.Element;
export default DialogHeader;