{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "banner",
  "type": "registry:ui",
  "title": "Banner",
  "description": "An inline message for a page or form: info, neutral or error, with an optional action and a dismiss button. Errors are announced at once.",
  "dependencies": [
    "lucide-react@^1.49.0"
  ],
  "registryDependencies": [
    "https://ui.klarhimmel.com/r/icon-button.json",
    "https://ui.klarhimmel.com/r/theme.json",
    "https://ui.klarhimmel.com/r/utils.json"
  ],
  "files": [
    {
      "path": "src/ui/banner.tsx",
      "type": "registry:file",
      "target": "components/klarhimmel/ui/banner.tsx",
      "content": "import type { ReactNode } from 'react';\nimport { CircleAlert, Info, X } from 'lucide-react';\nimport { cn } from '../lib/utils';\nimport { IconButton } from './icon-button';\n\nexport type BannerTone = 'info' | 'neutral' | 'error';\n\nconst tones: Record<BannerTone, { box: string; icon: typeof Info }> = {\n  info: { box: 'bg-kh-accent-soft text-kh-accent-ink', icon: Info },\n  neutral: { box: 'bg-kh-surface-2 text-kh-ink', icon: Info },\n  error: { box: 'bg-[color-mix(in_oklab,var(--kh-danger)_9%,var(--kh-surface))] text-kh-danger', icon: CircleAlert },\n};\n\nexport interface BannerProps {\n  tone?: BannerTone;\n  title?: ReactNode;\n  children?: ReactNode;\n  /** A Button or TextLink for the next step. */\n  action?: ReactNode;\n  onDismiss?: () => void;\n  /** Accessible name of the close button; pass it translated. */\n  dismissLabel?: string;\n  className?: string;\n}\n\n/**\n * An inline message that stays in the page flow. An error is announced at once (role=alert); info and neutral wait\n * their turn (role=status). Pass `onDismiss` to show a close button.\n */\nexport function Banner({ tone = 'info', title, children, action, onDismiss, dismissLabel = 'Dismiss', className }: BannerProps) {\n  const { box, icon: Icon } = tones[tone];\n  return (\n    <div role={tone === 'error' ? 'alert' : 'status'} className={cn('flex items-start gap-3 rounded-kh-lg px-4 py-3 text-kh-small', box, className)}>\n      <Icon aria-hidden className=\"mt-0.5 size-4 shrink-0\" />\n      <div className=\"flex min-w-0 flex-1 flex-col gap-1\">\n        {title && <p className=\"font-medium\">{title}</p>}\n        {children && <div className=\"break-words\">{children}</div>}\n        {action && <div className=\"pt-1\">{action}</div>}\n      </div>\n      {onDismiss && (\n        <IconButton label={dismissLabel} size=\"sm\" noTooltip onClick={onDismiss} className=\"-my-1.5 -mr-2\">\n          <X aria-hidden className=\"size-4\" />\n        </IconButton>\n      )}\n    </div>\n  );\n}\n"
    }
  ]
}
