{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "empty-state",
  "type": "registry:ui",
  "title": "Empty State",
  "description": "A centred icon, heading, text and one action for lists, searches and inboxes with nothing in them yet.",
  "dependencies": [],
  "registryDependencies": [
    "https://ui.klarhimmel.com/r/button.json",
    "https://ui.klarhimmel.com/r/editing.json",
    "https://ui.klarhimmel.com/r/theme.json",
    "https://ui.klarhimmel.com/r/utils.json"
  ],
  "files": [
    {
      "path": "src/ui/empty-state.tsx",
      "type": "registry:file",
      "target": "components/klarhimmel/ui/empty-state.tsx",
      "content": "import type { ReactNode } from 'react';\nimport { useContext } from 'react';\nimport { EditingContext } from '../editing';\nimport { nameEmptied } from './button';\nimport { cn } from '../lib/utils';\n\nexport interface EmptyStateProps {\n  /** A lucide icon element. */\n  icon?: ReactNode;\n  title: ReactNode;\n  /** One sentence: what this place is for and what to do. Same as children. */\n  description?: ReactNode;\n  children?: ReactNode;\n  /** The one next step, usually a Button. */\n  action?: ReactNode;\n  /** Heading level of the title, to fit the page outline. */\n  level?: 2 | 3 | 4;\n  className?: string;\n}\n\n/** A calm empty state: an icon, one sentence of what this is, one next action. */\nexport function EmptyState({ icon, title, description, children, action, level = 3, className }: EmptyStateProps) {\n  const Heading = `h${level}` as const;\n  const editing = !!useContext(EditingContext);\n  const untitled = !editing && nameEmptied(title); // an emptied title: no empty heading\n  const text = children ?? description;\n  return (\n    <div className={cn('mx-auto flex max-w-md flex-col items-center gap-4 px-4 py-10 text-center', className)}>\n      {icon && <span aria-hidden className=\"flex size-14 items-center justify-center rounded-kh-lg border border-kh-line bg-kh-surface text-kh-muted shadow-kh-2 [&_svg]:size-6\">{icon}</span>}\n      <div className=\"flex flex-col gap-1.5\">\n        {!untitled && <Heading className=\"text-kh-heading font-medium text-kh-ink\">{title}</Heading>}\n        {text && <p className=\"text-kh-small text-kh-muted\">{text}</p>}\n      </div>\n      {action}\n    </div>\n  );\n}\n"
    }
  ]
}
