"use client"; import { useRef, type ReactNode } from "react"; import { Ellipsis, X } from "lucide-react"; import { Button } from "@/components/ui/button"; import { useT } from "@/components/I18n"; /** * Button that opens a side dialog (native ) with content rendered on the server. * Default trigger is "⋯" (page settings); pass `trigger` for a labelled button such as «Создать задачу». */ export function SettingsDialog({ title, trigger, primary, children }: { title: string; trigger?: ReactNode; /** PEP-160: the page's main action. */ primary?: boolean; children: ReactNode }) { const t = useT(); const ref = useRef(null); const open = () => { ref.current?.showModal(); // PEP-160: a form in the dialog starts at its first field, not at the close button. ref.current?.querySelector("[data-autofocus]")?.focus(); }; return ( <> {trigger ? ( ) : ( )} e.target === ref.current && ref.current.close()} className="m-0 ml-auto h-dvh max-h-dvh w-[400px] max-w-full border-l bg-sidebar p-0 text-foreground backdrop:bg-black/50" >

{title}

{children}
); }