// @flow strict import * as React from 'react'; import classify from '../../utils/classify'; import { CalendarEmptyImage, ChartEmptyImage, DataEmptyImage, FileEmptyImage, MessageEmptyImage, UploadEmptyImage, } from './EmptyImages'; import css from './EmptyState.module.css'; type ClassNames = $ReadOnly<{ wrapper?: string, image?: string, title?: string, description?: string, children?: string, }>; export type EmptyStateProps = { classNames?: ClassNames, children?: React.Node, imageVariant?: 'calendar' | 'data' | 'file' | 'message' | 'upload' | 'chart', title?: React.Node, description?: React.Node, customImageUrl?: string, ... }; export const EmptyState: React$AbstractComponent< EmptyStateProps, HTMLDivElement, > = React.forwardRef( ( { classNames, children, imageVariant, title, description, customImageUrl, ...props }: EmptyStateProps, ref, ): React.Node => (
{!!imageVariant && !customImageUrl && (
{imageVariant === 'calendar' && } {imageVariant === 'data' && } {imageVariant === 'file' && } {imageVariant === 'message' && } {imageVariant === 'upload' && } {imageVariant === 'chart' && }
)} {customImageUrl && ( Empty State )} {!!title && (
{title}
)} {!!description && (
{description}
)} {!!children && (
{children}
)}
), );