@pagopa/mui-italia
Version:
[Material-UI](https://mui.com/core/) theme inspired by [Bootstrap Italia](https://italia.github.io/bootstrap-italia/).
38 lines (37 loc) • 1.42 kB
TypeScript
import { SxProps } from "@mui/system";
import { UploadStatus } from "./SingleFileInput";
/**
* Truncate file name string if it is longer than 30 characters.
* Keeps the file extension.
*
* @param fileName
* @returns truncated file name
*/
export declare const truncateFileName: (fileName: string) => string;
/**
* Check if a mime type matches the set given in accept
*
* @link https://stackoverflow.com/a/66489392
*
* @param type the mime type to test, ex image/png
* @param accept the mime types to accept, ex audio/*,video/*,image/png
* @returns true if the mime is accepted, false otherwise
*/
export declare function verifyAccept(type: string, accept?: Array<string>): boolean;
/**
* Returns the current status of the SingleFileInput based on his current state
*
* @param file the current file
* @param isLoading if the component is currently loading
* @param isFileRejected if the file is rejected
* @returns the current SingleFileInput status
*/
export declare function getStatus(file: File | null, isLoading: boolean, error: boolean, isFileRejected: boolean): UploadStatus;
/**
*
* @param status the current status of the SingleFileInput
* @returns the associated container styles
*/
export declare function getContainerStyle(status: UploadStatus): SxProps;
export declare function getColorStyle(status: UploadStatus): "primary" | "error";
export declare function generateRandomID(): string;