"use client"; import type { ReactNode, RefObject } from "react"; import { createPortal } from "react-dom"; /** Matches {@link CreateView} overlay options — shared with {@link DialogView}. */ export type CreateModalBackdropVariant = "default" | "blurredYellow"; const backdropOverlayClasses: Record = { default: "fixed inset-0 bg-black/50 z-[9998]", blurredYellow: "fixed inset-0 z-[9998] bg-[var(--color-surface-inverse-brand-primary)]/85 backdrop-blur-md supports-[backdrop-filter]:bg-[var(--color-surface-inverse-brand-primary)]/75", }; export type CreateModalFrameViewProps = { isOpen: boolean; onOverlayClick: () => void; backdropVariant: CreateModalBackdropVariant; className: string; ariaLabel?: string; ariaLabelledBy?: string; overlayRef: RefObject; dialogRef: RefObject; children: ReactNode; /** Rendered below the dialog card on the backdrop (e.g. “Back to home”). */ belowCard?: ReactNode; }; /** * Portal + dimmed overlay + centered dialog shell used by Create and Dialog. */ export function CreateModalFrameView({ isOpen, onOverlayClick, backdropVariant, className, ariaLabel, ariaLabelledBy, overlayRef, dialogRef, children, belowCard, }: CreateModalFrameViewProps) { if (!isOpen) return null; const content = (
e.stopPropagation()} > {children}
{belowCard ? (
e.stopPropagation()}> {belowCard}
) : null}
); if (typeof window !== "undefined") { return createPortal(content, document.body); } return null; }