/* Copyright 2026 Marimo. All rights reserved. */ import { Popover as PopoverPrimitive } from "radix-ui"; import * as React from "react"; import { StyleNamespace } from "@/theme/namespace"; import { cn } from "@/utils/cn"; import { MAX_HEIGHT_OFFSET, withFullScreenAsRoot, withSmartCollisionBoundary, } from "./fullscreen"; const Popover = PopoverPrimitive.Root; const PopoverTrigger = PopoverPrimitive.Trigger; const PopoverPortal = withFullScreenAsRoot(PopoverPrimitive.Portal); const PopoverClose = PopoverPrimitive.Close; const InternalPopoverContent = withSmartCollisionBoundary( PopoverPrimitive.Content, ); const PopoverContent = React.forwardRef< React.ElementRef, React.ComponentPropsWithoutRef & { portal?: boolean; scrollable?: boolean; } >( ( { className, align = "center", sideOffset = 4, portal = true, scrollable = false, ...props }, ref, ) => { const content = ( ); if (portal) { return {content}; } return content; }, ); PopoverContent.displayName = PopoverPrimitive.Content.displayName; export { Popover, PopoverTrigger, PopoverContent, PopoverClose };