@progress/kendo-react-upload
Version:
React Upload component helps users transfer files from their file systems to dedicated server handlers. KendoReact Upload package
1,102 lines (1,048 loc) • 32.8 kB
TypeScript
/**
* @license
*-------------------------------------------------------------------------------------------
* Copyright © 2025 Progress Software Corporation. All rights reserved.
* Licensed under commercial license. See LICENSE.md in the package root for more information
*-------------------------------------------------------------------------------------------
*/
import { AxiosProgressEvent } from 'axios';
import { AxiosResponse } from 'axios';
import { default as default_2 } from 'prop-types';
import { IconProps } from '@progress/kendo-react-common';
import { JSX as JSX_2 } from 'react/jsx-runtime';
import { LocalizationService } from '@progress/kendo-react-intl';
import * as React_2 from 'react';
import { SvgIconProps } from '@progress/kendo-react-common';
/**
* @hidden
*/
declare interface BaseUploadEvent<T extends React.Component> {
/**
* An event target.
*/
target: T;
}
/**
* Represents the ExternalDropZone component.
*/
export declare const ExternalDropZone: React_2.ForwardRefExoticComponent<ExternalDropZoneProps & React_2.RefAttributes<ExternalDropZoneHandle | null>>;
/**
* Represents the target(element and props) of the ExternalDropZoneEvent.
*/
declare interface ExternalDropZoneHandle {
/**
* The current element or `null` if there is no one.
*/
element: HTMLDivElement | null;
/**
* The props value of the ExternalDropZone.
*/
props: ExternalDropZoneProps;
/**
* The focus event callback.
*/
focus: () => void;
}
/**
* Represents the properties of the [ExternalDropZone](% slug api_upload_externaldropzone %) component.
*/
declare interface ExternalDropZoneProps {
/**
* Sets the `id` property of the top div element of the ExternalDropZone.
*/
id?: string;
/**
* Sets additional CSS styles to the ExternalDropZone.
*/
style?: React_2.CSSProperties;
/**
* Sets additional classes to the ExternalDropZone.
*/
className?: string;
/**
* Sets the `tabIndex` attribute.
*/
tabIndex?: number;
/**
* Represents the ref of the linked Upload.
*/
uploadRef: any;
/**
* Determines the disabled mode of the ExternalDropZone.
*/
disabled?: boolean;
/**
* Sets different hint node.
*/
customHint?: React_2.ReactNode;
/**
* Sets different note node.
*/
customNote?: React_2.ReactNode;
/**
* Triggered after a file is dropped into the ExternalDropZone area.
*/
onDrop?: (event: React_2.DragEvent<HTMLDivElement>) => void;
/**
* Triggered after a file is dragged inside the ExternalDropZone area.
*/
onElementDragEnter?: (event: React_2.DragEvent<HTMLDivElement>) => void;
/**
* Triggered after a file dragging is over.
*/
onElementDragOver?: (event: React_2.DragEvent<HTMLDivElement>) => void;
}
/**
* @hidden
*/
declare interface GroupedFiles {
[uid: string]: Array<UploadFileInfo>;
}
/**
* @hidden
*/
export declare const headerStatusUploaded = "upload.headerStatusUploaded";
/**
* @hidden
*/
export declare const headerStatusUploading = "upload.headerStatusUploading";
/**
* @hidden
*/
export declare const invalidMaxFileSize = "upload.invalidMaxFileSize";
export declare class Upload extends React_2.Component<UploadProps, UploadState> {
/**
* @hidden
*/
static defaultProps: UploadProps;
/**
* @hidden
*/
static propTypes: {
autoUpload: default_2.Requireable<boolean>;
batch: default_2.Requireable<boolean>;
withCredentials: default_2.Requireable<boolean>;
saveField: default_2.Requireable<string>;
saveHeaders: default_2.Requireable<object>;
saveMethod: default_2.Requireable<string>;
saveUrl: default_2.Requireable<NonNullable<string | ((...args: any[]) => any) | null | undefined>>;
responseType: default_2.Requireable<string>;
removeField: default_2.Requireable<string>;
removeHeaders: default_2.Requireable<object>;
removeMethod: default_2.Requireable<string>;
removeUrl: default_2.Requireable<NonNullable<string | ((...args: any[]) => any) | null | undefined>>;
multiple: default_2.Requireable<boolean>;
disabled: default_2.Requireable<boolean>;
showFileList: default_2.Requireable<boolean>;
showActionButtons: default_2.Requireable<boolean>;
actionsLayout: default_2.Requireable<string>;
tabIndex: default_2.Requireable<number>;
accept: default_2.Requireable<string>;
listItemUI: default_2.Requireable<NonNullable<string | ((...args: any[]) => any) | default_2.InferProps<{
render: default_2.Validator<(...args: any[]) => any>;
}> | null | undefined>>;
restrictions: default_2.Requireable<default_2.InferProps<{
allowedExtensions: default_2.Requireable<(string | null | undefined)[]>;
maxFileSize: default_2.Requireable<number>;
minFileSize: default_2.Requireable<number>;
}>>;
files: default_2.Requireable<(default_2.InferProps<{
uid: default_2.Requireable<string>;
name: default_2.Requireable<string>;
extension: default_2.Requireable<string>;
size: default_2.Requireable<number>;
validationErrors: default_2.Requireable<(string | null | undefined)[]>;
status: default_2.Requireable<UploadFileStatus>;
progress: default_2.Requireable<number>;
getRawFile: default_2.Requireable<(...args: any[]) => any>;
}> | null | undefined)[]>;
defaultFiles: default_2.Requireable<(default_2.InferProps<{
uid: default_2.Requireable<string>;
name: default_2.Requireable<string>;
extension: default_2.Requireable<string>;
size: default_2.Requireable<number>;
validationErrors: default_2.Requireable<(string | null | undefined)[]>;
status: default_2.Requireable<UploadFileStatus>;
progress: default_2.Requireable<number>;
getRawFile: default_2.Requireable<(...args: any[]) => any>;
}> | null | undefined)[]>;
};
private _httpSubscriptions;
private get async();
private _uploadNavigation;
private get files();
private get isControlled();
private get isCustomSave();
private get isCustomRemove();
private get fileStateCopy();
private readonly showLicenseWatermark;
constructor(props: UploadProps);
/**
* @hidden
*/
get actionElement(): HTMLInputElement | null | undefined;
/**
* @hidden
*/
focus: () => void;
/**
* Upload the selected files. Usable when the upload action is triggered by external code.
*/
triggerUpload: () => void;
/**
* @hidden
*/
uploadFiles: (filesForUpload: GroupedFiles) => void;
/**
* @hidden
*/
removeFiles: (filesForRemove: GroupedFiles) => void;
/**
* @hidden
*/
onUpload: () => void;
/**
* @hidden
*/
onAdd: (files: FileList) => void;
/**
* @hidden
*/
onUploadProgress: (uid: string, event: ProgressEvent | AxiosProgressEvent) => void;
/**
* @hidden
*/
onUploadSuccess: (uid: string, event?: AxiosResponse) => void;
/**
* @hidden
*/
onUploadError: (uid: string, event?: AxiosResponse) => void;
/**
* @hidden
*/
onRemove: (uid: string) => void;
/**
* @hidden
*/
onRemoveSuccess: (uid: string, event?: AxiosResponse) => void;
/**
* @hidden
*/
onRemoveError: (uid: string, event?: AxiosResponse) => void;
/**
* @hidden
*/
onRetry: (uid: string) => void;
/**
* @hidden
*/
onCancel: (uid: string) => void;
/**
* @hidden
*/
onClear: () => void;
/**
* @hidden
*/
render(): JSX_2.Element;
}
/**
* @hidden
*/
export declare class UploadActionButtons extends React_2.Component<UploadActionButtonsProps, {}> {
private _uploadElement;
private _clearElement;
componentDidUpdate(prevProps: UploadActionButtonsProps): void;
onClearClick: () => void;
checkEnterKey: (e: React_2.KeyboardEvent) => boolean;
onUploadClick: () => void;
render(): JSX_2.Element;
}
/**
* @hidden
*/
declare interface UploadActionButtonsProps {
disabled: boolean;
navigationIndex?: number;
clearButtonIndex: number;
uploadButtonIndex: number;
actionsLayout: string;
onUpload: () => void;
onClear: () => void;
onClick: (navIndex: number | undefined) => void;
}
/**
* Lists the possible layout of the Upload action buttons.
*/
export declare type UploadActionsLayout = 'start' | 'center' | 'end' | 'stretched';
/**
* @hidden
*/
export declare class UploadAddButton extends React_2.Component<UploadAddButtonProps, {}> {
private _element;
private _uploadInput;
get actionElement(): HTMLInputElement | null | undefined;
componentDidUpdate(prevProps: UploadAddButtonProps): void;
focus: () => void;
onClick: () => void;
onInputMouseDown: (e: React_2.MouseEvent<HTMLInputElement, MouseEvent>) => void;
render(): JSX_2.Element;
}
/**
* @hidden
*/
declare interface UploadAddButtonProps {
addButtonIndex: number;
navigationIndex: number | undefined;
notFocusedIndex: number | undefined;
tabIndex?: number;
async: UploadAsyncProps;
multiple?: boolean;
disabled?: boolean;
accept?: string;
id?: string;
ariaLabelledBy?: string;
ariaDescribedBy?: string;
ariaControls?: string;
ariaExpanded?: boolean;
hasFiles?: boolean;
onAdd: (files: FileList) => void;
onClick: (navIndex: number | undefined) => void;
selectMessageUI?: React_2.ComponentType<UploadSelectMessageProps>;
}
/**
* Represents the additional data that is sent as a key-value pair.
*/
export declare interface UploadAdditionalData {
[name: string]: any;
}
/**
* Represents the async properties of the Upload component.
*/
export declare interface UploadAsyncProps {
/**
* By default, the selected files are immediately uploaded.
* To change this behavior, set `autoUpload` to `false`.
*/
autoUpload?: boolean;
/**
* When enabled, all files in the selection are uploaded in one request.
* Any files that are selected one after the other are uploaded in separate requests.
*/
batch?: boolean;
/**
* Configures whether credentials (cookies, headers) will be sent for cross-site requests.
* Defaults to `true`. Setting `withCredentials` has no effect on same-site requests.
* To add credentials to the request, use the `saveHeaders` or `removeHeaders` property.
*/
withCredentials?: boolean;
/**
* Sets the [`FormData`](https://developer.mozilla.org/en-US/docs/Web/API/FormData) key which
* contains the files submitted to `saveUrl`. Defaults to `files`.
*/
saveField?: string;
/**
* Configures the `HttpHeaders` that are attached to each upload request.
*/
saveHeaders?: UploadHttpHeaders;
/**
* Sets the [`request`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods) method of the upload request.
* Defaults to `POST`.
*/
saveMethod?: string;
/**
* Sets the URL of the endpoint for the upload request.
* The requested [`FormData`](https://developer.mozilla.org/en-US/docs/Web/API/FormData) key is named after
* the `saveField` property and contains the list of files that will be uploaded.
*/
saveUrl?: string | ((files: UploadFileInfo[], options: {
formData: FormData;
requestOptions: any;
}, onProgress: (uid: string, event: ProgressEvent) => void) => Promise<{
uid: string;
}>);
/**
* Sets the expected [response type](https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/responseType)
* of the server.
* Used to parse the response appropriately.
* Defaults to `json`.
*/
responseType?: 'arraybuffer' | 'blob' | 'json' | 'text';
/**
* Sets the [`FormData`](https://developer.mozilla.org/en-US/docs/Web/API/FormData) key
* which contains the list of file names that are submitted to `removeUrl`.
* Defaults to `fileNames`.
*/
removeField?: string;
/**
* Configures the `HttpHeaders` that are attached to each `remove` request.
*/
removeHeaders?: UploadHttpHeaders;
/**
* Sets the [request method](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods) of the `remove` request.
* Defaults to `POST`.
*/
removeMethod?: string;
/**
* Sets the URL of the endpoint for the `remove` request.
* The [`FormData`](https://developer.mozilla.org/en-US/docs/Web/API/FormData) request
* key is named after the `removeField` property.
* It contains the list of file names which will be removed.
*/
removeUrl?: string | ((files: UploadFileInfo[], options: {
formData: FormData;
requestOptions: any;
}) => Promise<{
uid: string;
}>);
}
/**
* @hidden
*/
export declare class UploadDropZone extends React_2.Component<UploadDropZoneProps, {}> {
private _documentInterval;
private _elementInterval;
private _lastDocumentDragOver;
private _lastElementDragOver;
private _documentActive;
private _elementActive;
private get documentActive();
private set documentActive(value);
private get elementActive();
private set elementActive(value);
componentDidMount(): void;
componentWillUnmount(): void;
onDocumentDragEnter: () => void;
onDocumentDragOver: () => void;
onElementDragEnter: () => void;
onElementDragOver: (event: any) => void;
onDrop: (event: any) => void;
isDragOver: (prevDate: Date | null) => boolean;
render(): JSX_2.Element;
}
/**
* @hidden
*/
declare interface UploadDropZoneProps {
addButtonComponent: any;
fileGroup: GroupedFiles;
disabled: boolean | undefined;
multiple: boolean;
onAdd: (files: FileList) => void;
}
/**
* Contains information which is related to the selected file.
*/
export declare interface UploadFileInfo {
/**
* The unique identifier of the group (batch) with one or more files.
* Has to be set for the initial list of files.
*/
uid: string;
/**
* The file name.
*/
name: string;
/**
* The file extension including the leading dot—for example, `.jpg`, `.png`, or other.
*/
extension?: string;
/**
* The file size in bytes.
*/
size?: number;
/**
* A list which contains the validation errors (if any).
*/
validationErrors?: Array<string>;
/**
* The current state of the file—`Failed`, `Selected`, `Uploaded`, or `Uploading`.
* `Initial` is a special value for `FileState` and is
* automatically applied to initial files without you having to explicitly set their state.
*/
status: UploadFileStatus;
/**
* The current upload progress.
*/
progress: number;
/**
* Gets the raw file instance.
*/
getRawFile?: () => File;
}
/**
* Configures the restrictions for the files that can be uploaded.
*/
export declare interface UploadFileRestrictions {
/**
* The list of the allowed file extensions.
* Recognizes entries of both `.type` (for example, `.docx`, `.png`, `.svg`, `.xls`, and others)
* and `type` (for example, `docx`, `png`, `svg`, `xls`, and others) values.
*/
allowedExtensions?: Array<string>;
/**
* Defines the maximum file size in bytes.
*/
maxFileSize?: number;
/**
* Defines the minimum file size in bytes.
*/
minFileSize?: number;
}
/**
* Lists the possible states of a file.
*/
export declare enum UploadFileStatus {
/**
* Indicates that the file upload process has failed.
*/
UploadFailed = 0,
/**
* An initially selected fake file without a set state.
*/
Initial = 1,
/**
* The file is selected.
*/
Selected = 2,
/**
* The file is in the process of uploading.
*/
Uploading = 3,
/**
* The file is successfully uploaded.
*/
Uploaded = 4,
/**
* The remove process has failed.
*/
RemoveFailed = 5,
/**
* The file is in the process of removing.
*/
Removing = 6
}
/**
* Represents the HttpHeaders as a key-value pair.
*/
export declare interface UploadHttpHeaders {
[name: string]: string | string[];
}
/**
* @hidden
*/
export declare class UploadInput extends React_2.Component<UploadInputProps, {}> {
private _input;
get actionElement(): HTMLInputElement | null;
onMouseDown: (e: any) => void;
onAdd: () => void;
render(): JSX_2.Element;
}
/**
* @hidden
*/
declare interface UploadInputProps {
async: UploadAsyncProps;
multiple?: boolean;
disabled?: boolean;
accept?: string;
hasFiles?: boolean;
ariaLabelledBy?: string;
ariaDescribedBy?: string;
id?: string;
onAdd?: (files: FileList) => void;
onMouseDown?: (e: React_2.MouseEvent<HTMLInputElement, MouseEvent>) => void;
}
/**
* @hidden
*/
export declare class UploadList extends React_2.Component<UploadListProps, {}> {
mapListGroups(): JSX_2.Element[];
render(): JSX_2.Element;
}
/**
* @hidden
*/
export declare class UploadListActionButton extends React_2.Component<UploadListActionButtonProps, UploadListActionButtonState> {
constructor(props: UploadListActionButtonProps);
actionButtonTitle(status: UploadFileStatus, localizationService: LocalizationService): string;
retryButtonTitle(localizationService: LocalizationService): string;
buttonClassNames: (type: string) => string;
onRetryFocus: () => void;
onRetryBlur: () => void;
onActionFocus: () => void;
onActionBlur: () => void;
onActionClick: () => void;
onRetryClick: () => void;
render(): JSX_2.Element;
}
/**
* @hidden
*/
declare interface UploadListActionButtonProps {
progress: number;
uid: string;
status: UploadFileStatus;
async: UploadAsyncProps;
disabled: boolean;
onCancel: (uid: string) => void;
onRemove: (uid: string) => void;
onRetry: (uid: string) => void;
}
/**
* @hidden
*/
declare interface UploadListActionButtonState {
retryFocused: boolean;
actionFocused: boolean;
}
/**
* @hidden
*/
export declare class UploadListGroup extends React_2.Component<UploadListGroupProps, {}> {
private _element;
componentDidUpdate(): void;
onClick: () => void;
render(): JSX_2.Element;
}
/**
* @hidden
*/
declare interface UploadListGroupProps {
files: Array<UploadFileInfo>;
async: UploadAsyncProps;
disabled: boolean;
navigationIndex: number | undefined;
listItemUI?: React_2.ComponentType<UploadListItemProps>;
index: number;
onCancel: (uid: string) => void;
onRemove: (uid: string) => void;
onRetry: (uid: string) => void;
onClick: (navIndex: number | undefined) => void;
}
/**
* Represents the properties of the KendoReact UploadList Item component.
*/
export declare interface UploadListItemProps {
/**
* One or more files for the current item.
*/
files: Array<UploadFileInfo>;
/**
* The `disabled` property of the Upload.
*/
disabled: boolean;
/**
* The asynchronous properties of the Upload.
*/
async: UploadAsyncProps;
/**
* Fires when the user clicks the **Cancel** button.
*/
onCancel: (uid: string) => void;
/**
* Fires when the user clicks the **Remove** button.
*/
onRemove: (uid: string) => void;
/**
* Fires when the user clicks the **Retry** button.
*/
onRetry: (uid: string) => void;
}
/**
* @hidden
*/
export declare class UploadListMultiItem extends React_2.Component<UploadListItemProps, {}> {
/**
* @hidden
*/
getFileValidationMessage(file: UploadFileInfo): string;
/**
* @hidden
*/
mapFiles: () => JSX_2.Element[];
/**
* @hidden
*/
progress: () => number;
render(): JSX_2.Element;
}
/**
* @hidden
*/
declare interface UploadListProps {
groupedFiles: GroupedFiles;
async: UploadAsyncProps;
disabled: boolean;
navigationIndex?: number;
listId?: string;
listItemUI?: React_2.ComponentType<UploadListItemProps>;
onCancel: (uid: string) => void;
onRemove: (uid: string) => void;
onRetry: (uid: string) => void;
onClick: (navIndex: number | undefined) => void;
}
/**
* @hidden
*/
export declare class UploadListSingleItem extends React_2.Component<UploadListItemProps, {}> {
/**
* @hidden
*/
getFileExtension(file: UploadFileInfo): string;
/**
* @hidden
*/
getFileValidationMessage(file: UploadFileInfo, isUploadFailed: boolean): string;
/**
* @hidden
*/
getFileExtensionIcon(file: UploadFileInfo): IconProps & SvgIconProps;
/**
* @hidden
*/
renderValidationError(file: UploadFileInfo, isUploadFailed: boolean): JSX_2.Element;
/**
* @hidden
*/
renderFileDetails(file: UploadFileInfo): JSX_2.Element;
/**
* @hidden
*/
render(): JSX_2.Element;
}
/**
* @hidden
*/
export declare const uploadMessages: {
"upload.cancel": string;
"upload.clearSelectedFiles": string;
"upload.dropFilesHere": string;
"upload.headerStatusUploaded": string;
"upload.headerStatusUploading": string;
"upload.invalidFileExtension": string;
"upload.invalidFiles": string;
"upload.invalidMaxFileSize": string;
"upload.invalidMinFileSize": string;
"upload.remove": string;
"upload.retry": string;
"upload.select": string;
"upload.selectTitle": string;
"upload.selectNoFilesTitle": string;
"upload.uploadSelectedFiles": string;
"upload.total": string;
"upload.files": string;
"upload.statusUploaded": string;
"upload.statusUploadFailed": string;
"upload.dropZoneHint": string;
"upload.defaultDropZoneNote": string;
"upload.dropZoneNote": string;
};
/**
* The `onAdd` event.
*/
export declare interface UploadOnAddEvent extends BaseUploadEvent<Upload> {
/**
* The new updated state candidate.
*/
newState: Array<UploadFileInfo>;
/**
* The list of affected files.
*/
affectedFiles: Array<UploadFileInfo>;
}
/**
* The `onBeforeRemove` event.
*/
export declare interface UploadOnBeforeRemoveEvent extends BaseUploadEvent<Upload> {
/**
* The files that will be sent with the request.
*/
files: Array<UploadFileInfo>;
/**
* The headers that will be sent with the request. Can be modified.
*/
headers: UploadHttpHeaders;
/**
* The additional data that will be sent with the request. Can be modified.
*/
additionalData: UploadAdditionalData;
}
/**
* The `onBeforeUpload` event.
*/
export declare interface UploadOnBeforeUploadEvent extends BaseUploadEvent<Upload> {
/**
* The files that will be sent with the request.
*/
files: Array<UploadFileInfo>;
/**
* The headers that will be sent with the request. Can be modified.
*/
headers: UploadHttpHeaders;
/**
* The additional data that will be sent with the request. Can be modified.
*/
additionalData: UploadAdditionalData;
}
/**
* The `onCancel` event.
*/
export declare interface UploadOnCancelEvent extends BaseUploadEvent<Upload> {
/**
* The unique identifier of the group (batch) of one or more files that is cancelled.
*/
uid: string;
}
/**
* The `onProgress` event.
*/
export declare interface UploadOnProgressEvent extends BaseUploadEvent<Upload> {
/**
* The new updated state candidate.
*/
newState: Array<UploadFileInfo>;
/**
* The list of the affected files.
*/
affectedFiles: Array<UploadFileInfo>;
}
/**
* The `onRemove` event.
*/
export declare interface UploadOnRemoveEvent extends BaseUploadEvent<Upload> {
/**
* The new updated state candidate.
*/
newState: Array<UploadFileInfo>;
/**
* The list of the affected files.
*/
affectedFiles: Array<UploadFileInfo>;
/**
* The server response (if available).
*/
response?: UploadResponse;
}
/**
* The `onStatusChange` event.
*/
export declare interface UploadOnStatusChangeEvent extends BaseUploadEvent<Upload> {
/**
* The new updated state candidate.
*/
newState: Array<UploadFileInfo>;
/**
* The list of the affected files.
*/
affectedFiles: Array<UploadFileInfo>;
/**
* The server response (if available).
*/
response?: UploadResponse;
}
/**
* Represents the props of the [KendoReact Upload component]({% slug overview_upload %}).
*/
export declare interface UploadProps extends UploadAsyncProps {
/**
* Sets a class of the Upload DOM element.
*/
className?: string;
/**
* Enables the selection of multiple files
* ([see example]({% slug fileprocessing_upload %}#toc-upload-of-single-or-multiple-files)).
* If set to `false`, only one file can be selected at a time.
*/
multiple?: boolean;
/**
* Disables the Upload ([see example]({% slug disabledstate_upload %})). Defaults to `false`.
*/
disabled?: boolean;
/**
* Toggles the visibility of the file list.
*/
showFileList?: boolean;
/**
* When the `autoUpload` option is set to `false`,
* `showActionButtons` toggles the visibility of the action buttons which are rendered.
*/
showActionButtons?: boolean;
/**
* Specifies the possible layouts of the action buttons ([see example]({% slug actionbuttons_upload %})). Defaults to `end`.
*/
actionsLayout?: UploadActionsLayout;
/**
* Specifies the [`tabindex`](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/tabindex)
* of the Upload.
*/
tabIndex?: number | string;
/**
* Specifies the id of the component.
*/
id?: string;
/**
* Identifies the element(s) which will describe the component, similar to [HTML aria-describedby attribute](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/ARIA_Techniques/Using_the_aria-describedby_attribute).
* For example these elements could contain error or hint message.
*/
ariaDescribedBy?: string;
/**
* Identifies the element(s) which will label the component.
*/
ariaLabelledBy?: string;
/**
* Sets the `accept` attribute of the `input` element of the Upload.
*/
accept?: string;
/**
* Sets the restrictions for the selected files ([see example]({% slug filerestrictions_upload %})).
*/
restrictions?: UploadFileRestrictions;
/**
* The list of files which are displayed when the Upload is in controlled mode ([see example]({% slug controleduncontroled_upload %})).
*/
files?: Array<UploadFileInfo>;
/**
* The initial list of files which are displayed when the Upload is in uncontrolled mode ([see example]({% slug controleduncontroled_upload %})).
*/
defaultFiles?: Array<UploadFileInfo>;
/**
* The component that will be rendered as a list item inside the Upload.
*/
listItemUI?: React.ComponentType<UploadListItemProps>;
/**
* The component that is inside the Upload add button.
*/
selectMessageUI?: React.ComponentType<UploadSelectMessageProps>;
/**
* Fires when new files are selected for upload.
*/
onAdd?: (event: UploadOnAddEvent) => void;
/**
* Fires when files are removed. Optionally, if a request is made, can contain a server response.
*/
onRemove?: (event: UploadOnRemoveEvent) => void;
/**
* Fires when the status of the files is changed. Optionally, if a request is made, can contain a server response.
*/
onStatusChange?: (event: UploadOnStatusChangeEvent) => void;
/**
* Fires when the progress of the file upload is changed.
*/
onProgress?: (event: UploadOnProgressEvent) => void;
/**
* Fires before a request for a file upload is made. Can be used to add extra data to the request.
*/
onBeforeUpload?: (event: UploadOnBeforeUploadEvent) => void;
/**
* Fires before a request for a file removal is made. Can be used to add extra data to the request.
*/
onBeforeRemove?: (event: UploadOnBeforeRemoveEvent) => void;
/**
* Fires when user clicks on the **Remove** button while the file upload is in progress.
* Can be used when the `saveUrl` option is set to a function that cancels custom requests.
*/
onCancel?: (event: UploadOnCancelEvent) => void;
}
/**
* Represents the response type of the Upload.
*/
export declare interface UploadResponse {
/**
* The response that was provided by the server.
*/
response: any;
/**
* The HTTP status code from the server response.
*/
status: number;
/**
* The HTTP status message from the server response.
*/
statusText: string;
/**
* The headers with which the server responded.
*/
headers: any;
/**
* The XMLHttpRequest instance of the browser.
*/
request?: XMLHttpRequest;
}
/**
* @hidden
*/
export declare const uploadSelect = "upload.select";
/**
* Represents the props of the UI component that is inside the Upload add button.
*/
export declare interface UploadSelectMessageProps {
/**
* The `select` localized message.
*/
message: any;
}
/**
* @hidden
*/
declare interface UploadState {
files: Array<UploadFileInfo>;
}
/**
* @hidden
*/
export declare class UploadStatus extends React_2.Component<UploadStatusProps, {}> {
render(): JSX_2.Element;
}
/**
* @hidden
*/
declare interface UploadStatusProps {
isUploading: boolean;
isUploaded: boolean;
isUploadFailed: boolean;
}
export declare const UploadUI: React_2.ForwardRefExoticComponent<UploadUIProps & React_2.RefAttributes<any>>;
/**
* @hidden
*/
export declare interface UploadUIProps extends UploadAsyncProps {
className?: string;
multiple?: boolean;
disabled?: boolean;
showFileList?: boolean;
showActionButtons?: boolean;
actionsLayout?: string;
tabIndex?: number;
accept?: string;
groupedFiles: GroupedFiles;
navigationIndex?: number;
notFocusedIndex?: number;
listItemUI?: React_2.ComponentType<UploadListItemProps>;
selectMessageUI?: React_2.ComponentType<UploadSelectMessageProps>;
id?: string;
ariaLabelledBy?: string;
ariaDescribedBy?: string;
onAdd?: (files: FileList) => void;
onCancel?: (uid: string) => void;
onRemove?: (uid: string) => void;
onRetry?: (uid: string) => void;
onUpload?: () => void;
onClear?: () => void;
onFocus?: (event: React_2.FocusEvent<HTMLDivElement>) => void;
onBlur?: (event: React_2.FocusEvent<HTMLDivElement>) => void;
onKeyDown?: (event: React_2.KeyboardEvent, isRtl: boolean) => void;
onClick?: (navIndex: number) => void;
}
export declare const uploadUtils: {
fileHasValidationErrors: Function;
filesHaveValidationErrors: Function;
getTotalFilesSizeMessage: Function;
getAllFileInfo: Function;
getFileInfo: Function;
getFileExtension: Function;
htmlEncode: Function;
assignGuidToFiles: Function;
getFileStatus: (currentFiles: GroupedFiles | UploadFileInfo[]) => boolean[];
};
export { }