'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 Forms schema / entry-detail drawers.
 */
import * as Dialog from '@radix-ui/react-dialog';
import { X } from 'lucide-react';
import { btnGhostIcon } from './primitives.js';
export function Drawer({ open, onOpenChange, title, description, headerExtra, footer, children, width = 'max-w-xl', }) {
    return (_jsx(Dialog.Root, { open: open, onOpenChange: onOpenChange, children: _jsxs(Dialog.Portal, { children: [_jsx(Dialog.Overlay, { className: "bg-foreground/40 motion-safe:animate-in motion-safe:fade-in fixed inset-0 z-50" }), _jsxs(Dialog.Content, { ...(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 truncate text-lg font-medium", children: title }), description && (_jsx(Dialog.Description, { className: "text-muted-foreground mt-0.5 truncate text-sm", children: description }))] }), _jsxs("div", { className: "flex shrink-0 items-center gap-1", children: [headerExtra, _jsx(Dialog.Close, { asChild: true, children: _jsx("button", { className: btnGhostIcon, "aria-label": "Close", "data-shortcut": "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