@craftercms/studio-ui
Version:
Services, components, models & utils to build CrafterCMS authoring extensions.
70 lines (68 loc) • 1.93 kB
TypeScript
/*
* Copyright (C) 2007-2022 Crafter Software Corporation. All Rights Reserved.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 3 as published by
* the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import React from 'react';
import '@uppy/core/src/style.scss';
import '@uppy/progress-bar/src/style.scss';
import '@uppy/file-input/src/style.scss';
export interface FileUpload {
data: File;
extension: string;
id: string;
isPaused: boolean;
isRemote: boolean;
meta: {
name: string;
path: string;
site: string;
type: string;
};
name: string;
preview: any;
progress: {
uploadStarted: number;
uploadComplete: boolean;
percentage: 100;
bytesUploaded: number;
};
remote: string;
response: {
status: number;
body: any;
uploadUrl: string;
};
size: number;
source: string;
type: string;
uploadUrl: string;
}
export interface FileUploadResult {
successful: FileUpload[];
failed: FileUpload[];
uploadID: string;
}
export interface SingleFileUploadProps {
site: string;
formTarget?: string;
url?: string;
path: string;
customFileName?: string;
fileTypes?: [string];
onUploadStart?(): void;
onComplete?(result: FileUploadResult): void;
onError?({ file, error, response }: { file: any; error: any; response: any }): void;
}
export declare function SingleFileUpload(props: SingleFileUploadProps): React.JSX.Element;
export default SingleFileUpload;