{ "$schema": "https://ui.shadcn.com/schema/registry-item.json", "name": "dialog", "type": "registry:ui", "title": "Dialog", "files": [ { "path": "ui/dialog.tsrx", "type": "registry:ui", "target": "components/ui/dialog.tsrx", "content": "// Base UI base dialog — runs on @octanejs/base-ui's Dialog.\n// Part mapping: Overlay -> Backdrop, Content -> Popup, and the close affordance composes a\n// Button through Base UI's render-as-ELEMENT contract rather than radix's `asChild`.\n//\n// `data-open:`/`data-closed:` need no adaptation — the radix base already uses that exact form\n// and Base UI emits the same attributes.\n//\n// Drops upstream's `cn-font-heading` on the title, matching the react-aria base and this base's\n// alert-dialog: the package ships the utilities-inlined flavor and nothing defines that hook.\n//\n// UNVERIFIED PROVENANCE: class strings come from this package's radix base rather than\n// transcribed from upstream's Base UI source.\nimport { createElement, type OctaneNode } from 'octane';\nimport { Dialog as DialogPrimitive } from '@octanejs/base-ui/dialog';\nimport { XIcon } from '@octanejs/lucide';\n\nimport { cn } from '@/lib/utils';\nimport { Button } from '@/components/ui/button';\n\ntype Props = { className?: string; children?: OctaneNode } & Record;\n\nexport function Dialog(props: Record) @{\n\t\n}\n\nexport function DialogTrigger(props: Record) @{\n\t\n}\n\nexport function DialogPortal(props: Record) @{\n\t\n}\n\nexport function DialogClose(props: Record) @{\n\t\n}\n\nexport function DialogOverlay({ className, ...props }: Props) @{\n\t\n}\n\nexport interface DialogContentProps extends Props {\n\tshowCloseButton?: boolean;\n}\n\nexport function DialogContent({\n\tclassName,\n\tchildren,\n\tshowCloseButton = true,\n\t...props\n}: DialogContentProps) {\n\treturn createElement(\n\t\tDialogPrimitive.Portal,\n\t\t{ 'data-slot': 'dialog-portal' },\n\t\tcreateElement(DialogOverlay, { key: 'overlay' }),\n\t\tcreateElement(\n\t\t\tDialogPrimitive.Popup,\n\t\t\t{\n\t\t\t\tkey: 'content',\n\t\t\t\t'data-slot': 'dialog-content',\n\t\t\t\tclassName: cn(\n\t\t\t\t\t'fixed top-1/2 left-1/2 z-50 grid w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-4 rounded-xl bg-popover p-4 text-sm text-popover-foreground ring-1 ring-foreground/10 duration-100 outline-none sm:max-w-sm 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\tchildren,\n\t\t\tshowCloseButton\n\t\t\t\t? createElement(DialogPrimitive.Close, {\n\t\t\t\t\t\tkey: 'close',\n\t\t\t\t\t\t'data-slot': 'dialog-close',\n\t\t\t\t\t\tclassName: 'absolute top-2 right-2',\n\t\t\t\t\t\trender: createElement(\n\t\t\t\t\t\t\tButton,\n\t\t\t\t\t\t\t{ variant: 'ghost', size: 'icon-sm' },\n\t\t\t\t\t\t\tcreateElement(XIcon, { key: 'icon' }),\n\t\t\t\t\t\t\tcreateElement('span', { key: 'sr', className: 'sr-only' }, 'Close'),\n\t\t\t\t\t\t),\n\t\t\t\t\t})\n\t\t\t\t: null,\n\t\t),\n\t);\n}\n\nexport function DialogHeader({ className, ...props }: Props) @{\n\t
\n}\n\nexport interface DialogFooterProps extends Props {\n\tshowCloseButton?: boolean;\n}\n\nexport function DialogFooter(props: DialogFooterProps) @{\n\tconst { className, showCloseButton = false, children: _children, ...rest } = props;\n\n\t\n\t\t{props.children}\n\t\t{showCloseButton\n\t\t\t? createElement(DialogPrimitive.Close, {\n\t\t\t\t\trender: createElement(Button, { variant: 'outline' }, 'Close'),\n\t\t\t\t})\n\t\t\t: null}\n\t
\n}\n\nexport function DialogTitle({ className, ...props }: Props) @{\n\t\n}\n\nexport function DialogDescription({ className, ...props }: Props) @{\n\t\n}\n" } ], "dependencies": [ "@octanejs/base-ui@0.1.36", "@octanejs/lucide@0.1.33" ], "registryDependencies": [ "@octane/button", "@octane/utils" ] }