"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; /** * Mittig und breit statt als schmale Leiste am rechten Rand. * * Für die Vorgänge an einer Person — Daten ändern, Versetzung, Beförderung, * Austritt, Abwesenheit. Dort wird viel erfasst, und in der schmalen Leiste * stünden die Felder untereinander, die nebeneinander gehören. Nachschlagen * (Organisationseinheit, Protokolleintrag) bleibt am Rand: dort soll die * Seite dahinter sichtbar bleiben. */ mittig?: boolean; }; export function SlideOver({ open, onClose, title, subtitle, children, footer, mittig = false }: 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 do // not pile up invisible tab stops at the end of the page.

{title}

{subtitle &&

{subtitle}

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