"use client"; import * as DialogPrimitive from "@radix-ui/react-dialog"; import { X } from "lucide-react"; import * as React from "react"; import { preventDismissOnPrototypePluginChrome } from "../../lib/prototype-comments/core/comment-capture-blocked"; import { getPrototypeDialogPortalContainer, getPrototypeToolDialogPortalContainer, } from "../../lib/tool-portal"; import { cn } from "../../lib/utils"; import styles from "./dialog.module.scss"; const Dialog = DialogPrimitive.Root; const DialogTrigger = DialogPrimitive.Trigger; const DialogClose = DialogPrimitive.Close; const DialogPortal = DialogPrimitive.Portal; const DialogOverlay = React.forwardRef< React.ComponentRef, React.ComponentPropsWithoutRef >(({ className, ...props }, ref) => ( )); DialogOverlay.displayName = DialogPrimitive.Overlay.displayName; export type DialogPortalScope = "viewport" | "tool"; const DialogContent = React.forwardRef< React.ComponentRef, React.ComponentPropsWithoutRef & { showCloseButton?: boolean; overlayClassName?: string; portalScope?: DialogPortalScope; } >(({ className, children, showCloseButton = true, overlayClassName, portalScope = "viewport", onPointerDownOutside, onInteractOutside, onFocusOutside, ...props }, ref) => ( {portalScope === "tool" ? ( ) : ( // Radix `Dialog.Overlay` returns null when `modal={false}` (required for // product dialogs so review chrome stays interactive). Render a plain // scrim instead so viewport-scoped dialogs still dim the preview.
)} { preventDismissOnPrototypePluginChrome(event); onPointerDownOutside?.(event); }} onInteractOutside={(event) => { preventDismissOnPrototypePluginChrome(event); onInteractOutside?.(event); }} onFocusOutside={(event) => { preventDismissOnPrototypePluginChrome(event); onFocusOutside?.(event); }} {...props} > {children} {showCloseButton ? ( Close ) : null} )); DialogContent.displayName = DialogPrimitive.Content.displayName; function DialogHeader({ className, ...props }: React.HTMLAttributes) { return (
); } function DialogFooter({ className, ...props }: React.HTMLAttributes) { return (
); } const DialogTitle = React.forwardRef< React.ComponentRef, React.ComponentPropsWithoutRef >(({ className, ...props }, ref) => ( )); DialogTitle.displayName = DialogPrimitive.Title.displayName; const DialogDescription = React.forwardRef< React.ComponentRef, React.ComponentPropsWithoutRef >(({ className, ...props }, ref) => ( )); DialogDescription.displayName = DialogPrimitive.Description.displayName; export { Dialog, DialogPortal, DialogOverlay, DialogClose, DialogTrigger, DialogContent, DialogHeader, DialogFooter, DialogTitle, DialogDescription, };