{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "popover",
  "title": "Popover",
  "type": "registry:ui",
  "files": [
    {
      "path": "packages/registry-native/components/popover/Popover.tsx",
      "content": "import * as React from 'react'\nimport { Platform, ScrollView, StyleSheet, useWindowDimensions } from 'react-native'\nimport * as Primitive from '@rn-primitives/popover'\nimport { cssInterop } from 'react-native-css-interop'\nimport { useSafeAreaInsets } from 'react-native-safe-area-context'\nimport { PortalWindow, usePopupDismiss } from '@/lib/portal'\nimport { renderTextChildren } from '@/lib/label-children'\nimport { cn } from '@/lib/utils'\n\ncssInterop(Primitive.Root, { className: 'style' })\ncssInterop(Primitive.Trigger, { className: 'style' })\ncssInterop(Primitive.Content, { className: 'style' })\ncssInterop(Primitive.Overlay, { className: 'style' })\ncssInterop(Primitive.Close, { className: 'style' })\n\nexport type PopoverProps = Primitive.RootProps & { className?: string }\n\nexport const Popover = React.forwardRef<Primitive.RootRef, PopoverProps>(({ className, ...props }, ref) => (\n  <Primitive.Root ref={ref} className={cn('self-start', className)} {...props} />\n))\nPopover.displayName = 'Popover'\nexport type PopoverTriggerProps = Omit<Primitive.TriggerProps, 'children'> & {\n  children?: React.ReactNode\n  className?: string\n}\nexport const PopoverTrigger = React.forwardRef<Primitive.TriggerRef, PopoverTriggerProps>(\n  ({ className, children, asChild, disabled, ...props }, ref) => (\n    <Primitive.Trigger\n      {...props}\n      ref={ref}\n      asChild={asChild}\n      disabled={disabled}\n      className={cn(\n        'min-h-[48px] min-w-[48px] flex-row items-center justify-center gap-[8px] rounded-md border border-border bg-background px-[16px] py-[10px] active:bg-accent',\n        disabled && 'opacity-50',\n        className,\n      )}\n    >\n      {asChild ? children : renderTextChildren(children)}\n    </Primitive.Trigger>\n  ),\n)\nPopoverTrigger.displayName = 'PopoverTrigger'\nexport type PopoverContentProps = Omit<Primitive.ContentProps, 'children'> & {\n  children?: React.ReactNode\n  className?: string\n}\nexport const PopoverContent = React.forwardRef<Primitive.ContentRef, PopoverContentProps>(\n  (\n    { className, children, asChild, insets, style, align = 'start', side = 'bottom', sideOffset = 8, ...props },\n    ref,\n  ) => {\n    const root = Primitive.useRootContext()\n    const visible = root.open\n    const popup = usePopupDismiss(visible, () => root.onOpenChange(false))\n    const safe = useSafeAreaInsets()\n    const { width, height } = useWindowDimensions()\n    const bounds = { top: safe.top + 8, bottom: safe.bottom + 8, left: safe.left + 8, right: safe.right + 8, ...insets }\n    const maxWidth = Math.max(0, Math.min(320, width - bounds.left - bounds.right))\n    const maxHeight = Math.max(0, height - bounds.top - bounds.bottom)\n    // Native headless content must unmount to release its platform Back subscription.\n    if (Platform.OS !== 'web' && !visible) return null\n    return (\n      <Primitive.Portal\n        forceMount={props.forceMount}\n        hostName={popup.hostName}\n        {...(Platform.OS === 'web'\n          ? { container: (popup.container ?? undefined) as unknown as Primitive.PortalProps['container'] }\n          : {})}\n      >\n        <PortalWindow layer={popup}>\n          {Platform.OS !== 'web' ? <Primitive.Overlay accessible={false} style={StyleSheet.absoluteFill} /> : null}\n          <Primitive.Content\n            {...props}\n            ref={ref}\n            asChild={asChild}\n            align={align}\n            side={side}\n            sideOffset={sideOffset}\n            insets={bounds}\n            className={cn('rounded-lg border border-border bg-popover p-[12px]', className)}\n            style={StyleSheet.flatten([{ maxWidth, maxHeight }, style]) ?? undefined}\n          >\n            {asChild ? (\n              children\n            ) : (\n              <ScrollView bounces={false} keyboardShouldPersistTaps=\"handled\" style={{ maxHeight, flexGrow: 0 }}>\n                {renderTextChildren(children)}\n              </ScrollView>\n            )}\n          </Primitive.Content>\n        </PortalWindow>\n      </Primitive.Portal>\n    )\n  },\n)\nPopoverContent.displayName = 'PopoverContent'\nexport type PopoverCloseProps = Omit<Primitive.CloseProps, 'children'> & {\n  children?: React.ReactNode\n  className?: string\n}\nexport const PopoverClose = React.forwardRef<Primitive.CloseRef, PopoverCloseProps>(\n  ({ className, children, asChild, disabled, ...props }, ref) => (\n    <Primitive.Close\n      {...props}\n      ref={ref}\n      asChild={asChild}\n      disabled={disabled}\n      className={cn(\n        'min-h-[48px] min-w-[48px] flex-row items-center justify-center gap-[8px] rounded-md border border-border bg-background px-[16px] py-[10px] active:bg-accent',\n        disabled && 'opacity-50',\n        className,\n      )}\n    >\n      {asChild ? children : renderTextChildren(children)}\n    </Primitive.Close>\n  ),\n)\nPopoverClose.displayName = 'PopoverClose'\n",
      "type": "registry:ui",
      "target": "~/components/ui/popover/Popover.tsx"
    },
    {
      "path": "packages/registry-native/components/popover/index.ts",
      "content": "export * from './Popover'\n",
      "type": "registry:ui",
      "target": "~/components/ui/popover/index.ts"
    }
  ],
  "dependencies": [
    "@rn-primitives/popover",
    "react-native-safe-area-context",
    "react-native-css-interop"
  ],
  "devDependencies": [],
  "registryDependencies": [
    "https://native.uipkge.dev/r/native/portal.json",
    "https://native.uipkge.dev/r/native/label-children.json"
  ],
  "description": "Themed popover with press access, portal rendering, viewport bounds, and safe-area collision insets.",
  "categories": [
    "overlay",
    "navigation"
  ]
}