{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "popover",
  "type": "registry:ui",
  "title": "Popover",
  "description": "A floating panel anchored to a button for detail or a one-field form. Non-modal, closes on Escape or an outside click. Built on Radix Popover.",
  "dependencies": [
    "radix-ui@^1.6.7"
  ],
  "registryDependencies": [
    "https://ui.klarhimmel.com/r/theme.json",
    "https://ui.klarhimmel.com/r/utils.json"
  ],
  "files": [
    {
      "path": "src/ui/popover.tsx",
      "type": "registry:file",
      "target": "components/klarhimmel/ui/popover.tsx",
      "content": "import type { ReactNode } from 'react';\nimport { Popover as P } from 'radix-ui';\nimport { ThemeRootScope, useThemeRoot } from '../lib/theme-root';\nimport { cn } from '../lib/utils';\n\n/** Root of a popover. Compose with PopoverTrigger (asChild around a Button) and PopoverContent. */\nexport function Popover({ children, ...rest }: React.ComponentProps<typeof P.Root>) {\n  return (\n    <ThemeRootScope>\n      <P.Root {...rest}>{children}</P.Root>\n    </ThemeRootScope>\n  );\n}\nexport const PopoverTrigger = P.Trigger;\n/** Closes the popover it sits in. */\nexport const PopoverClose = P.Close;\n\n/** A small floating panel next to its trigger. Escape or a click outside closes it and returns focus to the trigger. */\nexport function PopoverContent({ children, label, align = 'end', className, onOpenAutoFocus }: { children: ReactNode; /** Required: the accessible name of the panel. */ label: string; align?: 'start' | 'center' | 'end'; className?: string; /** Called when focus is about to move into the panel; preventDefault and focus something yourself to choose where it lands. */ onOpenAutoFocus?: (event: Event) => void }) {\n  const root = useThemeRoot();\n  return (\n    <P.Portal container={root}>\n      <P.Content\n        aria-label={label}\n        onOpenAutoFocus={onOpenAutoFocus}\n        align={align}\n        sideOffset={8}\n        collisionPadding={12}\n        className={cn('z-50 w-[min(24rem,calc(100vw-1.5rem))] rounded-kh-lg border border-kh-line bg-kh-surface p-4 text-kh-ink shadow-kh-3 outline-none', className)}\n      >\n        {children}\n      </P.Content>\n    </P.Portal>\n  );\n}\n"
    }
  ]
}
