'use client';
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
/**
 * Right-side drawer built on Radix Dialog — focus-trapped, escape-closable,
 * token-only styling. Shared by the SEO editor / fix / copilot drawers.
 */
import * as Dialog from '@radix-ui/react-dialog';
import { adminPortalContainer } from '../../lib/portal-container.js';
import { X } from 'lucide-react';
import { btnGhostIcon } from './primitives.js';
export function Drawer({ open, onOpenChange, title, description, footer, children, width = 'max-w-xl', }) {
    return (_jsx(Dialog.Root, { open: open, onOpenChange: onOpenChange, children: _jsxs(Dialog.Portal, { container: adminPortalContainer(), children: [_jsx(Dialog.Overlay, { className: "bg-foreground/40 motion-safe:animate-in motion-safe:fade-in fixed inset-0 z-50" }), _jsxs(Dialog.Content
                // Radix auto-associates `aria-describedby` with the Dialog.Description
                // when one is present; when it isn't, explicitly clear the attribute so
                // Radix doesn't emit its "Missing Description" console warning.
                , { ...(description ? {} : { 'aria-describedby': undefined }), className: `bg-card text-foreground fixed inset-y-0 right-0 z-50 flex w-full ${width} motion-safe:animate-in motion-safe:slide-in-from-right flex-col shadow-xl outline-none`, children: [_jsxs("header", { className: "border-border flex items-start justify-between gap-3 border-b px-5 py-4", children: [_jsxs("div", { className: "min-w-0", children: [_jsx(Dialog.Title, { className: "text-foreground text-lg font-medium", children: title }), description && (_jsx(Dialog.Description, { className: "text-muted-foreground mt-0.5 text-sm", children: description }))] }), _jsx(Dialog.Close, { asChild: true, children: _jsx("button", { className: btnGhostIcon, "aria-label": "Close", children: _jsx(X, { size: 20, "aria-hidden": true }) }) })] }), _jsx("div", { className: "min-h-0 flex-1 overflow-y-auto px-5 py-4", children: children }), footer && (_jsx("footer", { className: "border-border bg-card flex items-center justify-end gap-2 border-t px-5 py-4", children: footer }))] })] }) }));
}
//# sourceMappingURL=Drawer.js.map