"use client"; import { Dialog, DialogClose, DialogContent, DialogTitle, } from "@prototype/components/ui/dialog"; import { cn } from "@prototype/lib/utils"; import { ChevronDown, X } from "lucide-react"; import type { ReactNode } from "react"; export const PROTOTYPE_TOOL_MODAL_CLOSE_CLASS = "text-muted-foreground hover:text-foreground inline-flex size-8 shrink-0 items-center justify-center rounded-sm border-0 bg-transparent p-0 opacity-70 transition-opacity duration-200 ease hover:opacity-100 outline-none focus:outline-hidden focus-visible:ring-2 focus-visible:ring-focus-ring focus-visible:ring-offset-0 disabled:pointer-events-none disabled:opacity-40 disabled:hover:opacity-40 disabled:hover:text-muted-foreground motion-reduce:transition-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4"; export const PROTOTYPE_TOOL_MODAL_TEXTAREA_CLASS = "field-sizing-content min-h-[min(50vh,20rem)] w-full resize-y border-0 bg-transparent px-0 py-0 text-sm leading-relaxed text-foreground shadow-none outline-none placeholder:text-muted-foreground focus-visible:ring-0"; /** Shared min height for workspace onboarding / bootstrap gate modals. */ export const PROTOTYPE_ONBOARDING_MODAL_MIN_HEIGHT_CLASS = "min-h-[min(26rem,72svh)]"; const MODAL_SIZE_CLASS = { md: "w-[min(42rem,calc(100vw-2rem))] max-w-[min(42rem,calc(100vw-2rem))] sm:max-w-[min(42rem,calc(100vw-2rem))]", wide: "w-[min(96rem,calc(100vw-2rem))] max-w-[min(96rem,calc(100vw-2rem))] sm:max-w-[min(96rem,calc(100vw-2rem))]", } as const; export type PrototypeToolDialogXylophoneProps = { children: ReactNode; className?: string; }; export function PrototypeToolDialogXylophone({ children, className, }: PrototypeToolDialogXylophoneProps) { return (
{children}
); } export type PrototypeToolDialogXylophoneSectionProps = { step: string; title: string; description: string; expanded: boolean; onExpandedChange: (expanded: boolean) => void; children: ReactNode; className?: string; contentClassName?: string; }; export function PrototypeToolDialogXylophoneSection({ step, title, description, expanded, onExpandedChange, children, className, contentClassName, }: PrototypeToolDialogXylophoneSectionProps) { return (
{children}
); } export type PrototypeToolDialogProps = { open: boolean; onOpenChange: (open: boolean) => void; title: ReactNode; description?: ReactNode; titleLeading?: ReactNode; children: ReactNode; footer?: ReactNode; footerClassName?: string; headerActions?: ReactNode; overlayClassName?: string; size?: keyof typeof MODAL_SIZE_CLASS; bodyClassName?: string; className?: string; hideHeader?: boolean; dismissible?: boolean; }; export function PrototypeToolDialog({ open, onOpenChange, title, description, titleLeading, children, footer, footerClassName, headerActions, overlayClassName, size = "md", bodyClassName, className, hideHeader = false, dismissible = true, }: PrototypeToolDialogProps) { return ( { if (dismissible || nextOpen) { onOpenChange(nextOpen); } }} > { event.preventDefault(); } } onInteractOutside={ dismissible ? undefined : (event) => { event.preventDefault(); } } onEscapeKeyDown={ dismissible ? undefined : (event) => { event.preventDefault(); } } className={cn( "tool-dialog-surface flex max-h-[min(92svh,calc(100%-2rem))] flex-col gap-0 overflow-hidden border-0 p-0", MODAL_SIZE_CLASS[size], className, )} > {hideHeader ? ( <> {title} {headerActions} {dismissible ? ( Close ) : null} ) : ( <>
{titleLeading}
{title} {description ? (

{description}

) : null}
{headerActions} {dismissible ? ( Close ) : null}
)}
{children}
{footer ? ( <>
{footer}
) : null}
); }