@carbon/ibm-products
Version:
Carbon for IBM Products
137 lines (136 loc) • 3.5 kB
TypeScript
/**
* Copyright IBM Corp. 2021, 2024
*
* This source code is licensed under the Apache-2.0 license found in the
* LICENSE file in the root directory of this source tree.
*/
import React, { ReactNode } from 'react';
type FileType = {
fetchError?: undefined | boolean;
fileData?: File;
fileSize?: number;
iconDescription?: string;
invalidFileType?: boolean;
name: string;
status?: 'uploading' | 'edit' | 'complete';
uuid?: string;
invalid?: boolean;
errorBody?: string;
errorSubject?: string;
};
export interface ImportModalProps {
/**
* Specifies the file types that are valid for importing
*/
accept?: string[];
/**
* Optional class name
*/
className?: string;
/**
* The default message shown for an import error
*/
defaultErrorBody: string;
/**
* The default header that is displayed to show an error message
*/
defaultErrorHeader: string;
/**
* Content that is displayed inside the modal
*/
description?: string;
/**
* Optional error body to display specifically for a fetch error
*/
fetchErrorBody?: string;
/**
* Optional error header to display specifically for a fetch error
*/
fetchErrorHeader?: string;
/**
* Header for the drag and drop box
*/
fileDropHeader?: string;
/**
* Label for the drag and drop box
*/
fileDropLabel?: string;
/**
* Label that appears when a file is uploaded to show number of files (1 / 1)
*/
fileUploadLabel?: string;
/**
* Button icon for import by url button
*/
inputButtonIcon?: boolean;
/**
* Button text for import by url button
*/
inputButtonText: string;
/**
* ID for text input
*/
inputId?: string;
/**
* Header to display above import by url
*/
inputLabel?: string;
/**
* Placeholder for text input
*/
inputPlaceholder?: string;
/**
* Optional error message to display specifically for a invalid file type error
*/
invalidFileTypeErrorBody?: string;
/**
* Optional error header to display specifically for a invalid file type error
*/
invalidFileTypeErrorHeader?: string;
/**
* Description for delete file icon
*/
invalidIconDescription?: string;
/**
* File size limit in bytes
*/
maxFileSize?: number;
/**
* Optional error message to display specifically for a max file size error
*/
maxFileSizeErrorBody?: string;
/**
* Optional error header to display specifically for a max file size error
*/
maxFileSizeErrorHeader?: string;
/**
* Specify a handler for closing modal
*/
onClose?(): void;
/**
* Specify a handler for "submitting" modal. Access the imported file via `file => {}`
*/
onRequestSubmit(files: FileType[]): void;
/**
* Specify whether the Modal is currently open
*/
open: boolean;
/**
* The DOM node the tearsheet should be rendered within. Defaults to document.body.
*/
portalTarget?: ReactNode;
/**
* Specify the text for the primary button
*/
primaryButtonText: string;
/**
* Specify the text for the secondary button
*/
secondaryButtonText: string;
/**
* The text displayed at the top of the modal
*/
title: string;
}
export declare let ImportModal: React.FC<ImportModalProps>;
export {};