"use client"; import { X } from "lucide-react"; import { useId, useRef, type ReactNode } from "react"; import { Button } from "./Button"; import { useDialogFocus } from "./useDialogFocus"; type SlideOverProps = { open: boolean; onClose: () => void; title: string; subtitle?: string; children: ReactNode; footer?: ReactNode; }; export function SlideOver({ open, onClose, title, subtitle, children, footer }: SlideOverProps) { const dialogRef = useRef(null); const titleId = useId(); useDialogFocus(open, onClose, dialogRef); return ( // Stays mounted so the slide transition can run, which means a closed // panel's fields are still in the tab order — aria-hidden does not remove // them. `inert` does, and also blocks clicks, so several closed panels no // longer pile up invisible tab stops at the end of the page.

{title}

{subtitle &&

{subtitle}

}
{children}
{footer && (
{footer}
)}
); }