import { type JSX, splitProps } from 'solid-js'; import { cva, type VariantProps } from 'class-variance-authority'; import { cn } from '../utils/cn'; /** * Empty — a composable empty-state block, modeled on shadcn/ui's `Empty`. * Structure: * Empty * ├── EmptyHeader * │ ├── EmptyMedia (icon / avatar) * │ ├── EmptyTitle * │ └── EmptyDescription * └── EmptyContent (actions / suggestions) * * Styling is token-driven (`--color-*`), so it themes with the rest of the kit. * No visible border by default; add `border border-dashed` via `class` for a card. */ // --- Empty (root) --- export interface EmptyProps extends JSX.HTMLAttributes { children: JSX.Element; } function Empty(props: EmptyProps) { const [local, rest] = splitProps(props, ['class', 'children']); return (
{local.children}
); } // --- EmptyHeader --- export interface EmptyHeaderProps extends JSX.HTMLAttributes { children: JSX.Element; } function EmptyHeader(props: EmptyHeaderProps) { const [local, rest] = splitProps(props, ['class', 'children']); return (
{local.children}
); } // --- EmptyMedia --- const emptyMediaVariants = cva( 'flex shrink-0 items-center justify-center mb-2 [&_svg]:size-6', { variants: { variant: { default: 'bg-transparent', icon: 'bg-muted text-foreground size-10 rounded-lg', }, }, defaultVariants: { variant: 'default' }, }, ); export interface EmptyMediaProps extends JSX.HTMLAttributes, VariantProps { children: JSX.Element; } function EmptyMedia(props: EmptyMediaProps) { const [local, rest] = splitProps(props, ['class', 'variant', 'children']); return (
{local.children}
); } // --- EmptyTitle --- export interface EmptyTitleProps extends JSX.HTMLAttributes { children: JSX.Element; } function EmptyTitle(props: EmptyTitleProps) { const [local, rest] = splitProps(props, ['class', 'children']); return (
{local.children}
); } // --- EmptyDescription --- export interface EmptyDescriptionProps extends JSX.HTMLAttributes { children: JSX.Element; } function EmptyDescription(props: EmptyDescriptionProps) { const [local, rest] = splitProps(props, ['class', 'children']); return (

a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary', local.class, )} {...rest} > {local.children}

); } // --- EmptyContent --- export interface EmptyContentProps extends JSX.HTMLAttributes { children: JSX.Element; } function EmptyContent(props: EmptyContentProps) { const [local, rest] = splitProps(props, ['class', 'children']); return (
{local.children}
); } export { Empty, EmptyHeader, EmptyMedia, EmptyTitle, EmptyDescription, EmptyContent, emptyMediaVariants, };