{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "ui-sdk-dialog",
  "type": "registry:ui",
  "title": "Dialog (UI SDK)",
  "description": "A focused task over the page, built on UI SDK with focus, Escape, outside-press and sheet presentation handled for you.",
  "dependencies": [
    "@ui-sdk/core",
    "@ui-sdk/react",
    "lucide-react"
  ],
  "registryDependencies": [
    "button"
  ],
  "files": [
    {
      "path": "registry/designali/ui/ui-sdk/dialog.tsx",
      "content": "\"use client\"\n\n/**\n * Dialog built on UI SDK (@ui-sdk/react/dialog), styled to match the shadcn\n * Dialog in @workspace/ui. Same export names and props, so switching is an\n * import-path change.\n *\n * Differences from the Base UI version:\n *   - No portal. UI SDK renders the content in the browser's top layer\n *     (popover API), so `DialogPortal` is a pass-through kept for compatibility.\n *   - The browser centers top-layer content (`inset: 0; margin: auto`), so we\n *     don't use the translate-50% trick.\n *   - Enter/exit use CSS transitions on `data-starting-style` and\n *     `data-ending-style`; UI SDK keeps the dialog mounted until they finish.\n *   - UI SDK sets its own `data-slot` names (e.g. `dialog-backdrop`).\n */\n\nimport * as React from \"react\"\nimport {\n  Dialog as DialogRoot,\n  DialogBackdrop,\n  DialogClose as DialogClosePrimitive,\n  DialogContent as DialogContentPrimitive,\n  DialogDescription as DialogDescriptionPrimitive,\n  DialogTitle as DialogTitlePrimitive,\n  DialogTrigger as DialogTriggerPrimitive,\n} from \"@ui-sdk/react/dialog\"\nimport { XIcon } from \"lucide-react\"\n\nimport { cn } from \"@workspace/ui/lib/utils\"\nimport { Button } from \"@workspace/ui/components/button\"\n\n/** UI SDK `className` can be a string or a function of the part's state. */\ntype ClassName<S> = string | ((state: S) => string | undefined) | undefined\n\nfunction withBase<S>(base: string, className: ClassName<S>): ClassName<S> {\n  if (typeof className === \"function\") {\n    return (state: S) => cn(base, className(state))\n  }\n  return cn(base, className)\n}\n\ntype StateOf<P> = P extends { className?: ClassName<infer S> } ? S : never\n\nfunction Dialog(props: React.ComponentProps<typeof DialogRoot>) {\n  return <DialogRoot {...props} />\n}\n\nfunction DialogTrigger(props: React.ComponentProps<typeof DialogTriggerPrimitive>) {\n  return <DialogTriggerPrimitive {...props} />\n}\n\n/** Kept for API compatibility. UI SDK uses the top layer instead of a portal. */\nfunction DialogPortal({ children }: { children?: React.ReactNode }) {\n  return <>{children}</>\n}\n\nfunction DialogClose(props: React.ComponentProps<typeof DialogClosePrimitive>) {\n  return <DialogClosePrimitive {...props} />\n}\n\ntype DialogOverlayProps = React.ComponentProps<typeof DialogBackdrop>\n\nfunction DialogOverlay({ className, ...props }: DialogOverlayProps) {\n  return (\n    <DialogBackdrop\n      className={withBase<StateOf<DialogOverlayProps>>(\n        // Reset popover UA sizing, then cover the viewport.\n        \"fixed inset-0 isolate z-50 m-0 size-full max-h-none max-w-none bg-black/10 transition-opacity duration-100 supports-backdrop-filter:backdrop-blur-xs data-starting-style:opacity-0 data-ending-style:opacity-0 motion-reduce:transition-none\",\n        className\n      )}\n      {...props}\n    />\n  )\n}\n\ntype DialogContentProps = React.ComponentProps<typeof DialogContentPrimitive> & {\n  showCloseButton?: boolean\n}\n\nfunction DialogContent({\n  className,\n  children,\n  showCloseButton = true,\n  ...props\n}: DialogContentProps) {\n  return (\n    <>\n      <DialogOverlay />\n      <DialogContentPrimitive\n        className={withBase<StateOf<DialogContentProps>>(\n          \"fixed inset-0 z-50 m-auto grid h-fit max-h-[calc(100dvh-2rem)] w-full max-w-[calc(100%-2rem)] gap-4 overflow-y-auto rounded-none bg-popover p-4 text-xs/relaxed text-popover-foreground ring-1 ring-foreground/10 outline-none transition-[opacity,scale] duration-100 ease-out sm:max-w-sm data-starting-style:scale-95 data-starting-style:opacity-0 data-ending-style:scale-95 data-ending-style:opacity-0 motion-reduce:transition-none\",\n          className\n        )}\n        {...props}\n      >\n        {(state) => (\n          <>\n            {typeof children === \"function\" ? children(state) : children}\n            {showCloseButton && (\n              <DialogClosePrimitive\n                aria-label=\"Close\"\n                render={\n                  <Button\n                    variant=\"ghost\"\n                    className=\"absolute top-2 end-2\"\n                    size=\"icon-sm\"\n                  />\n                }\n              >\n                <XIcon aria-hidden=\"true\" />\n              </DialogClosePrimitive>\n            )}\n          </>\n        )}\n      </DialogContentPrimitive>\n    </>\n  )\n}\n\nfunction DialogHeader({ className, ...props }: React.ComponentProps<\"div\">) {\n  return (\n    <div\n      data-slot=\"dialog-header\"\n      className={cn(\"flex flex-col gap-1 text-start\", className)}\n      {...props}\n    />\n  )\n}\n\nfunction DialogFooter({\n  className,\n  showCloseButton = false,\n  children,\n  ...props\n}: React.ComponentProps<\"div\"> & {\n  showCloseButton?: boolean\n}) {\n  return (\n    <div\n      data-slot=\"dialog-footer\"\n      className={cn(\n        \"flex flex-col-reverse gap-2 sm:flex-row sm:justify-end\",\n        className\n      )}\n      {...props}\n    >\n      {children}\n      {showCloseButton && (\n        <DialogClosePrimitive render={<Button variant=\"outline\" />}>\n          Close\n        </DialogClosePrimitive>\n      )}\n    </div>\n  )\n}\n\ntype DialogTitleProps = React.ComponentProps<typeof DialogTitlePrimitive>\n\nfunction DialogTitle({ className, ...props }: DialogTitleProps) {\n  return (\n    <DialogTitlePrimitive\n      className={withBase<StateOf<DialogTitleProps>>(\n        \"font-heading text-sm font-medium\",\n        className\n      )}\n      {...props}\n    />\n  )\n}\n\ntype DialogDescriptionProps = React.ComponentProps<\n  typeof DialogDescriptionPrimitive\n>\n\nfunction DialogDescription({ className, ...props }: DialogDescriptionProps) {\n  return (\n    <DialogDescriptionPrimitive\n      className={withBase<StateOf<DialogDescriptionProps>>(\n        \"text-xs/relaxed text-muted-foreground *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground\",\n        className\n      )}\n      {...props}\n    />\n  )\n}\n\nexport {\n  Dialog,\n  DialogClose,\n  DialogContent,\n  DialogDescription,\n  DialogFooter,\n  DialogHeader,\n  DialogOverlay,\n  DialogPortal,\n  DialogTitle,\n  DialogTrigger,\n}\n",
      "type": "registry:ui",
      "target": "components/ui-sdk/dialog.tsx"
    }
  ]
}