import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { useState } from "react";
import { Download } from "lucide-react";
import { Dialog, DialogContent } from "../../components/ui/dialog";
import { Button } from "../../components/ui/button";
import { StyledDialogTitle } from "../../components/ui/styled-dialog-title";
import DialogButtons from "./DialogButtons";
export function ExportItemsDialog({ items, onClose, }) {
    const [versionOption, setVersionOption] = useState("latest");
    const [includeSubitems, setIncludeSubitems] = useState(true);
    const handleAccept = () => {
        onClose({ versionOption, includeSubitems });
    };
    const subtitle = items.length === 1
        ? `Export ${items[0]?.name ?? "1 item"} to YAML`
        : `Export ${items.length} items to YAML`;
    return (_jsx(Dialog, { open: true, onOpenChange: (open) => !open && onClose(null), children: _jsxs(DialogContent, { className: "flex max-w-lg flex-col overflow-hidden border-none p-0 shadow-2xl", style: { maxHeight: "90vh" }, showCloseButton: true, "data-testid": "confirmation-dialog", children: [_jsx(StyledDialogTitle, { icon: _jsx(Download, { strokeWidth: 1 }), title: "Export Items", subtitle: subtitle }), _jsxs("div", { className: "flex min-h-0 flex-1 flex-col gap-4 overflow-y-auto px-6 py-5", children: [_jsxs("div", { className: "flex flex-col gap-2", children: [_jsx("label", { htmlFor: "export-version", className: "text-sm font-medium", children: "Versions" }), _jsxs("select", { id: "export-version", value: versionOption, onChange: (e) => setVersionOption(e.target.value === "all" ? "all" : "latest"), className: "w-full rounded-md border border-input bg-background px-3 py-2 text-sm shadow-sm focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring", children: [_jsx("option", { value: "latest", children: "Latest only" }), _jsx("option", { value: "all", children: "All versions" })] })] }), _jsxs("label", { className: "flex cursor-pointer items-center gap-2", children: [_jsx("input", { type: "checkbox", id: "export-include-subitems", checked: includeSubitems, onChange: (e) => setIncludeSubitems(e.target.checked), className: "h-4 w-4 rounded border-gray-300" }), _jsx("span", { className: "text-sm", children: "Include subitems" })] })] }), _jsxs(DialogButtons, { children: [_jsx(Button, { variant: "outline", onClick: () => onClose(null), children: "Cancel" }), _jsx(Button, { onClick: handleAccept, children: "Export" })] })] }) }));
}
//# sourceMappingURL=ExportItemsDialog.js.map