{"$schema":"https://ui.shadcn.com/schema/registry-item.json","name":"dialog","title":"Dialog","author":"brijr","description":"A modal overlay for focused tasks, built on UI SDK.","dependencies":["@ui-sdk/react","@ui-sdk/core","cn","lucide-react"],"files":[{"path":"components/ui/dialog.tsx","content":"\"use client\"\n\nimport * as React from \"react\"\nimport {\n  Dialog,\n  DialogBackdrop as DialogBackdropPrimitive,\n  DialogClose,\n  DialogContent as DialogContentPrimitive,\n  DialogDescription as DialogDescriptionPrimitive,\n  DialogShortcut as DialogShortcutPrimitive,\n  DialogTitle as DialogTitlePrimitive,\n  DialogTrigger,\n} from \"@ui-sdk/react/dialog\"\nimport { renderElement, type PartProps } from \"@ui-sdk/react/primitive\"\nimport { XIcon } from \"lucide-react\"\nimport { cn } from \"cn\"\n\nfunction DialogOverlay({\n  className,\n  ...props\n}: Omit<React.ComponentProps<typeof DialogBackdropPrimitive>, \"className\"> & {\n  className?: string\n}) {\n  return (\n    <DialogBackdropPrimitive\n      className={cn(\n        \"fixed inset-0 bg-black/50 transition-opacity duration-(--duration-overlay) ease-(--easing-enter) data-ending-style:opacity-0 data-ending-style:duration-(--duration-overlay-exit) data-starting-style:opacity-0 motion-reduce:transition-none\",\n        className\n      )}\n      {...props}\n    />\n  )\n}\n\nfunction DialogContent({\n  className,\n  children,\n  showCloseButton = true,\n  closeLabel = \"Close\",\n  overlay = <DialogOverlay />,\n  ...props\n}: Omit<React.ComponentProps<typeof DialogContentPrimitive>, \"className\"> & {\n  className?: string\n  showCloseButton?: boolean\n  /** The close button's accessible name. */\n  closeLabel?: string\n  /** The backdrop behind the dialog. Pass your own, or `null` for none. */\n  overlay?: React.ReactElement | null\n}) {\n  const closeButton = showCloseButton && (\n    <DialogClose className=\"absolute top-5 right-4 flex size-7 items-center justify-center rounded-md opacity-70 transition-opacity outline-none after:absolute after:-inset-2 hover:opacity-100 focus-visible:opacity-100 focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none [&_svg:not([class*='size-'])]:size-4\">\n      <XIcon aria-hidden=\"true\" />\n      <span className=\"sr-only\">{closeLabel}</span>\n    </DialogClose>\n  )\n\n  return (\n    <>\n      {overlay}\n      <DialogContentPrimitive\n        className={cn(\n          \"fixed top-1/2 left-1/2 grid max-h-[calc(100dvh-2rem)] w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-4 overflow-y-auto overscroll-contain rounded-xl bg-popover p-6 text-popover-foreground shadow-(--elevation-overlay) transition-[opacity,scale] duration-(--duration-overlay) ease-(--easing-enter) outline-none data-ending-style:scale-95 data-ending-style:opacity-0 data-ending-style:duration-(--duration-overlay-exit) data-starting-style:scale-95 data-starting-style:opacity-0 motion-reduce:transition-none sm:max-w-lg\",\n          className\n        )}\n        {...props}\n      >\n        {typeof children === \"function\" ? (\n          (state) => (\n            <>\n              {children(state)}\n              {closeButton}\n            </>\n          )\n        ) : (\n          <>\n            {children}\n            {closeButton}\n          </>\n        )}\n      </DialogContentPrimitive>\n    </>\n  )\n}\n\nfunction DialogHeader({\n  className,\n  render,\n  ...props\n}: Omit<PartProps<\"div\">, \"className\"> & { className?: string }) {\n  return renderElement(\n    \"div\",\n    {\n      \"data-slot\": \"dialog-header\",\n      className: cn(\n        \"flex flex-col gap-1.5 px-6 text-center sm:pr-6 sm:pl-0 sm:text-left\",\n        className\n      ),\n      ...props,\n    },\n    render\n  )\n}\n\nfunction DialogFooter({\n  className,\n  render,\n  ...props\n}: Omit<PartProps<\"div\">, \"className\"> & { className?: string }) {\n  return renderElement(\n    \"div\",\n    {\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    render\n  )\n}\n\nfunction DialogTitle({\n  className,\n  ...props\n}: Omit<React.ComponentProps<typeof DialogTitlePrimitive>, \"className\"> & {\n  className?: string\n}) {\n  return (\n    <DialogTitlePrimitive\n      className={cn(\n        \"text-base leading-snug font-medium text-balance\",\n        className\n      )}\n      {...props}\n    />\n  )\n}\n\nfunction DialogDescription({\n  className,\n  ...props\n}: Omit<\n  React.ComponentProps<typeof DialogDescriptionPrimitive>,\n  \"className\"\n> & {\n  className?: string\n}) {\n  return (\n    <DialogDescriptionPrimitive\n      className={cn(\"text-sm text-muted-foreground\", className)}\n      {...props}\n    />\n  )\n}\n\nfunction DialogShortcut({\n  className,\n  ...props\n}: Omit<React.ComponentProps<typeof DialogShortcutPrimitive>, \"className\"> & {\n  className?: string\n}) {\n  return (\n    <DialogShortcutPrimitive\n      className={cn(\n        \"text-xs tracking-widest text-muted-foreground in-[.bg-primary]:text-primary-foreground/70 in-[.text-destructive]:text-current\",\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  DialogShortcut,\n  DialogTitle,\n  DialogTrigger,\n}\n","type":"registry:ui"}],"type":"registry:ui"}