UNPKG

@adaptabletools/adaptable

Version:

Powerful AG Grid extension which provides advanced, cutting-edge functionality to meet all DataGrid requirements

12 lines (11 loc) 2.16 kB
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime"; import { ImportFileSection } from './UploadFileSection'; import { ImportTextSection } from './UploadTextSection'; import { Box, Flex } from '../../../../../components/Flex'; import { Card } from '../../../../../components/Card'; import { TypeRadio } from '../../../../Wizard/TypeRadio'; export const UploadSection = (props) => { return (_jsxs(Flex, { flexDirection: "column", className: "twa:h-full twa:gap-3 twa:p-3", children: [_jsxs(Card, { shadow: false, children: [_jsxs(Card.Title, { children: [_jsx(Box, { className: "twa:font-medium", children: "Import Type" }), _jsx(Box, { className: "twa:text-xs twa:opacity-70 twa:font-normal twa:max-w-[520px]", children: "Choose whether to import from a file or pasted text" })] }), _jsx(Card.Body, { children: _jsxs(Flex, { flexDirection: "column", children: [_jsx(TypeRadio, { text: "File", description: "Upload a file in a supported format", checked: props.importType === 'file', onClick: () => props.onImportTypeChange('file') }), _jsx(TypeRadio, { text: "Text", description: "Paste CSV, JSON, or other supported text directly", checked: props.importType === 'text', onClick: () => props.onImportTypeChange('text') })] }) })] }), _jsxs(Card, { shadow: false, className: "twa:flex-1 twa:min-h-0", children: [_jsxs(Card.Title, { children: [_jsx(Box, { className: "twa:font-medium", children: props.importType === 'file' ? 'File Upload' : 'Paste Text' }), _jsx(Box, { className: "twa:text-xs twa:opacity-70 twa:font-normal twa:max-w-[520px]", children: props.importType === 'file' ? 'Select or drag a file to load the data for import' : 'Paste your data below — CSV or JSON is detected automatically' })] }), _jsx(Card.Body, { className: "twa:flex-1 twa:min-h-0", children: props.importType === 'file' ? (_jsx(ImportFileSection, { readFile: props.readFile, supportedFileFormats: props.supportedFileFormats, message: props.fileMessage })) : (_jsx(ImportTextSection, { message: props.textMessage, text: props.text, onTextChange: props.onTextChange })) })] })] })); };