import React, { type ReactElement, type ReactNode } from 'react'; import { classNames } from '../../utils'; import type { IconName } from '../Icon'; import { HighlightIcon, type HighlightIconVariant } from '../HighlightIcon'; import { useId } from '../../hooks/useId'; import styles from './EmptyState.module.css'; export type EmptyStateProps = { /** * Actions to display in the EmptyState. */ actions?: ReactElement | ReactElement[]; /** * className for the element. */ className?: string; /** * Content of the Empty State. */ subtitle: ReactNode; /** * The title to display in the EmptyState. */ title: ReactNode; } & ( | // EmptyState with icon { /** * The icon to display in the EmptyState. */ iconName: IconName; /** * The variant of the icon. * @default info */ iconVariant?: HighlightIconVariant; illustration?: never; } // EmptyState with illustration | { iconName?: never; iconVariant?: never; /** * The illustration to display in the EmptyState. */ illustration: ReactElement; } ); export const EmptyState = ({ actions, className, iconName, iconVariant = 'info', illustration, subtitle, title, ...rest }: EmptyStateProps) => { const titleId = useId(); const descriptionId = useId(); return (
{illustration} {iconName && iconVariant && (
); };