import * as React from "react" import * as DialogPrimitive from "@radix-ui/react-dialog" import { escapeBelongsToCombobox } from "../../lib/overlayEscape" import { useReturnFocus } from "../../lib/overlayFocus" import { useOverlayPresentation } from "../../lib/overlayPresentation" import { XIcon } from "lucide-react" import { cn } from "../../lib/utils" import { getAkashicPortalContainer } from "../../lib/getAkashicPortalContainer" // ABOVE A FLOATING WINDOW, and this is load-bearing rather than cosmetic. This dialog portals into the // SAME container as `ui/floating-window/FloatingWindow`, so the two are siblings and z-index alone decides // who paints on top. At the old `z-50` a dialog opened from INSIDE the meeting window mounted behind it // while still trapping focus and blocking pointer events everywhere outside itself - an invisible dialog // that froze the window it came from. See `lib/stackingLayers.ts` for the whole order. import { Z_MODAL_CLASS } from "../../lib/stackingLayers" import { Button } from "../ui/button" function Dialog({ ...props }: React.ComponentProps) { return } function DialogTrigger({ ...props }: React.ComponentProps) { return } function DialogPortal({ container, ...props }: React.ComponentProps) { // - the trailing `?? undefined` is GONE, and its removal is the fix, not a tidy-up. // It converted "the overlay root has not mounted yet" into "portal to document.body", silently and // permanently for that dialog's lifetime - which put the first-sign-in agreement gate outside the // scoped root and stripped all 68 `.btn` rules off its Accept and Decline buttons. // `getAkashicPortalContainer()` now creates the node when it is missing and cannot return null, so // there is no longer a nullish branch for a body portal to hide in. const portalContainer = container ?? getAkashicPortalContainer() return ( ) } function DialogClose({ ...props }: React.ComponentProps) { return } function DialogOverlay({ className, ...props }: React.ComponentProps) { return ( ) } function DialogContent({ className, children, showCloseButton = true, onEscapeKeyDown, onOpenAutoFocus, onCloseAutoFocus, ...props }: React.ComponentProps & { showCloseButton?: boolean }) { const returnFocus = useReturnFocus(onOpenAutoFocus, onCloseAutoFocus) const sheet = useOverlayPresentation() === "sheet" // A caller that names a width (a w-* or max-w-* class) owns it at every breakpoint; index.css sizes the others to their content. const declaresWidth = /(^|\s)([\w-]+:)*(max-)?w-/.test(className ?? "") return ( { if (escapeBelongsToCombobox(event)) { event.preventDefault() return } onEscapeKeyDown?.(event) }} {...returnFocus} {...props} > {children} {/* Named on the button, so the icon-only target floor reaches it. */} {showCloseButton && ( )} ) } function DialogHeader({ className, ...props }: React.ComponentProps<"div">) { return (
) } function DialogFooter({ className, showCloseButton = false, children, ...props }: React.ComponentProps<"div"> & { showCloseButton?: boolean }) { return (
{children} {showCloseButton && ( )}
) } function DialogTitle({ className, ...props }: React.ComponentProps) { return ( ) } function DialogDescription({ className, ...props }: React.ComponentProps) { return ( ) } export { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, }