@tiller-ds/upload
Version:
Upload module of Tiller Design System
51 lines (50 loc) • 1.89 kB
TypeScript
import * as React from "react";
import { SendMethod } from "@rpldy/sender";
import { UploaderEnhancer } from "@rpldy/uploader";
import Uploady from "@rpldy/uploady";
export declare type UploadyWrapperProps = {
/**
* Url on the backend which is called for saving files
*/
url: string;
/**
* Additional arguments for the backend call, including headers, request parameters, http method and files
* parameter name
*/
destinationOptions?: Omit<Destination, "url">;
/**
* Enhancers used by Uploady to upgrade the upload usage.
* {@see} {@link https://react-uploady.org/docs/getting-started/concepts/#enhancer}
*/
enhancer?: UploaderEnhancer;
/**
* Method that defines how the files are sent to the backend. By default, sends files with XHR request.
* {@see} {@link https://react-uploady.org/docs/getting-started/concepts/#sender}
*/
send?: SendMethod;
/**
* Map of listeners for the Uploady events.
* Check list of possible events {@link https://react-uploady.org/docs/api/constants/#uploaderEvents here}
*/
listeners?: React.ComponentProps<typeof Uploady>["listeners"];
/**
* Whether will user be able to upload multiple files at once
*/
allowMultiple?: boolean;
/**
* `withCredentials` flag on fetch requests for uploading
*/
withCredentials?: boolean;
/**
* UploadWrapper content
*/
children?: JSX.Element[] | JSX.Element;
};
export declare type Destination = {
url: string;
filesParamName?: string;
params?: Record<string, unknown>;
headers?: Record<string, unknown>;
method?: string;
};
export default function UploadyWrapper({ url, send, allowMultiple, listeners, enhancer, destinationOptions, withCredentials, children, }: UploadyWrapperProps): JSX.Element;