/** * ReUI Empty + IconStack — Frame-friendly (empty-state-14 / empty-state-12). * Preview: https://reui.io/preview/base/empty-state-14 · https://reui.io/preview/base/empty-state-12 * Docs: https://reui.io/docs/components/base/icon-stack */ import { InboxIcon, type LucideIcon } from 'lucide-react' import type { ReactNode } from 'react' import { IconStack } from '@/components/reui/icon-stack' import { Frame, FramePanel, } from '@/components/reui/frame' import { Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia, EmptyTitle, } from '@evobgp/ui/components/empty' import { cn } from '@evobgp/ui/lib/utils' interface EmptyStateProps { icon?: LucideIcon | ReactNode title: string description?: string action?: ReactNode className?: string stackedIcon?: boolean centered?: boolean /** Wrap in Frame (empty-state-14). Nested grids should leave this false. */ framed?: boolean } function isLucideIcon(icon: LucideIcon | ReactNode): icon is LucideIcon { if (typeof icon === 'function') return true if (icon != null && typeof icon === 'object' && '$$typeof' in icon) { if ('props' in icon) return false return true } return false } export function EmptyState({ icon, title, description, action, className, stackedIcon = true, centered = true, framed = false, }: EmptyStateProps) { const Icon = isLucideIcon(icon) ? icon : InboxIcon const customIcon = icon && !isLucideIcon(icon) ? icon : null const empty = ( {customIcon ? ( stackedIcon ? ( ) : (
{customIcon}
) ) : stackedIcon ? ( ) : ( )}
{title} {description ? ( {description} ) : null}
{action ? ( {action} ) : null}
) const body = framed ? ( {empty} ) : ( empty ) if (!centered) return body return (
{body}
) }