{ "$schema": "https://ui.shadcn.com/schema/registry-item.json", "name": "popover", "type": "registry:ui", "title": "Popover", "files": [ { "path": "ui/popover.tsrx", "type": "registry:ui", "target": "components/ui/popover.tsrx", "content": "// Base UI base popover — runs on @octanejs/base-ui's Popover.\n//\n// TWO POSITIONING DIFFERENCES FROM THE RADIX BASE, both verified by rendering the primitive and\n// reading the DOM rather than inferred:\n//\n// 1. THE TRANSFORM-ORIGIN CSS VAR IS NAMED DIFFERENTLY. Radix publishes\n// `--radix-popover-content-transform-origin`; Base UI's Positioner publishes plain\n// `--transform-origin`. Copying radix's `origin-(--radix-popover-content-transform-origin)`\n// leaves the utility referencing a variable nothing ever sets, so the popup would scale\n// from the wrong corner on open — visible only in motion, and invisible to any class\n// comparison.\n//\n// 2. THERE IS A POSITIONER LAYER. Radix goes Portal > Content; Base UI goes\n// Portal > Positioner > Popup, and the Positioner owns side/align/offset. `data-side` and\n// `data-align` land on BOTH the positioner and the popup, so the `data-[side=…]` slide\n// utilities still resolve on the popup where the radix base put them.\n//\n// NO PopoverAnchor. Radix ships an Anchor part for positioning against something other than the\n// trigger; Base UI's Positioner takes an `anchor` prop instead, so there is no element to render\n// and no slot to emit. Recorded in tests/cross-base.test.ts rather than faked.\n//\n// UNVERIFIED PROVENANCE: class strings come from this package's radix base rather than\n// transcribed from upstream's Base UI source.\n// POSITIONING PROPS BELONG TO THE POSITIONER, NOT THE POPUP. Radix has one `Content` element that\n// takes them all; Base UI splits positioning into its own layer, so anything forwarded to `Popup`\n// instead is inert — `side=\"top\"` silently leaves the popup on the default side, and the prop lands\n// on the DOM as an invalid attribute. They are destructured and routed explicitly.\n//\nimport { createElement } from 'octane';\nimport { Popover as PopoverPrimitive } from '@octanejs/base-ui/popover';\n\nimport { cn } from '@/lib/utils';\n\ntype Props = { className?: string } & Record;\n\nexport function Popover(props: Record) @{\n\t\n}\n\nexport function PopoverTrigger(props: Record) @{\n\t\n}\n\nexport interface BaseUiPositioningProps {\n\t/** Forwarded to the Positioner; see the note at the top of this file. */\n\tside?: 'top' | 'right' | 'bottom' | 'left';\n\tsideOffset?: number;\n\talign?: 'start' | 'center' | 'end';\n\talignOffset?: number;\n\tanchor?: unknown;\n\tpositionMethod?: 'absolute' | 'fixed';\n\tcollisionBoundary?: unknown;\n\tcollisionPadding?: unknown;\n\tcollisionAvoidance?: unknown;\n\tarrowPadding?: number;\n\tsticky?: boolean;\n\tdisableAnchorTracking?: boolean;\n}\n\nexport interface PopoverContentProps extends Record, BaseUiPositioningProps {\n\tclassName?: string;\n}\n\nexport function PopoverContent({\n\tclassName,\n\talign = 'center',\n\tsideOffset = 4,\n\tside,\n\talignOffset,\n\tanchor,\n\tpositionMethod,\n\tcollisionBoundary,\n\tcollisionPadding,\n\tcollisionAvoidance,\n\tarrowPadding,\n\tsticky,\n\tdisableAnchorTracking,\n\t...props\n}: PopoverContentProps) {\n\treturn createElement(PopoverPrimitive.Portal, {\n\t\tchildren: createElement(PopoverPrimitive.Positioner, {\n\t\t\tside,\n\t\t\tsideOffset,\n\t\t\talign,\n\t\t\talignOffset,\n\t\t\tanchor,\n\t\t\tpositionMethod,\n\t\t\tcollisionBoundary,\n\t\t\tcollisionPadding,\n\t\t\tcollisionAvoidance,\n\t\t\tarrowPadding,\n\t\t\tsticky,\n\t\t\tdisableAnchorTracking,\n\t\t\tchildren: createElement(PopoverPrimitive.Popup, {\n\t\t\t\t'data-slot': 'popover-content',\n\t\t\t\tclassName: cn(\n\t\t\t\t\t'z-50 flex w-72 origin-(--transform-origin) flex-col gap-2.5 rounded-lg bg-popover p-2.5 text-sm text-popover-foreground shadow-md ring-1 ring-foreground/10 outline-hidden duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95',\n\t\t\t\t\tclassName,\n\t\t\t\t),\n\t\t\t\t...props,\n\t\t\t}),\n\t\t}),\n\t});\n}\n\nexport function PopoverHeader({ className, ...props }: Props) @{\n\t\n}\n\nexport function PopoverTitle({ className, ...props }: Props) @{\n\t
\n}\n\nexport function PopoverDescription({ className, ...props }: Props) @{\n\t\n}\n" } ], "dependencies": [ "@octanejs/base-ui@0.1.36" ], "registryDependencies": [ "@octane/utils" ] }