//
// Copyright 2023 DXOS.org
//
import React, { useState } from 'react';
import { FileUploader } from 'react-drag-drop-files';
import { Button, Dialog, Icon } from '@dxos/react-ui';
export const DialogRestoreSpace = ({ handleFile }) => {
    const [dialogOpen, setDialogOpen] = useState(false);
    return (React.createElement("div", { className: 'flex shrink-0 m-2' },
        React.createElement(Dialog.Root, { open: dialogOpen, onOpenChange: (nextOpen) => setDialogOpen(nextOpen) },
            React.createElement(Dialog.Trigger, { asChild: true },
                React.createElement(Button, null, "Import space")),
            React.createElement(Dialog.Overlay, null,
                React.createElement(Dialog.Content, null,
                    React.createElement(Dialog.Title, null, 'Import space'),
                    React.createElement("p", { className: 'mlb-4' }, 'Importing from a backup will create new space from.'),
                    React.createElement(FileUploader, { types: ['json', 'tar'], classes: 'block mlb-4 p-8 border-2 border-dashed border-neutral-500/50 rounded flex items-center justify-center gap-2 cursor-pointer', dropMessageStyle: { border: 'none', backgroundColor: '#EEE' }, handleChange: (backupFile) => handleFile(backupFile).finally(() => setDialogOpen(false)) },
                        React.createElement(Icon, { icon: 'ph--file-plus--duotone', size: 8 }),
                        React.createElement("span", null, 'Drag file here or click to browse')),
                    React.createElement(Dialog.Close, { asChild: true },
                        React.createElement(Button, { variant: 'primary' }, 'Cancel')))))));
};
//# sourceMappingURL=DialogRestoreSpace.js.map