import { FC, KeyboardEvent, MouseEvent } from "react"; import { NvUploaderModes } from './types.ts'; interface NvLocalImageUrls { [key: string]: string; } /** * Defines the structure of an uploaded file in the NvUploader component. * @param {string} name - The name of the uploaded file. * @param {string} type - The type of the uploaded file. * @param {string} url - The URL of the uploaded file. */ export interface NvUploadedFile { /** The name of the uploaded file */ name?: string; /** The type of the uploaded file */ type: string; /** The URL of the uploaded file */ url?: string; } interface NvUploaderProps { progress?: number | null; setProgress?: (progress: number | null) => void; /** * The mode of file presentation: * `file` – guarantees a document icon plus a file name as a caption. * * `image` – guarantees a preview thumb (for supported image types) or * a document icon (for unsuppported image types and non-image files) * plus a file name as a tooltip. * * `auto` – chooses `file` or `image` mode for you depending on which * file types prevail – image or non-image ones. It is the default * mode suitable for most use cases. */ mode?: NvUploaderModes; /** * The `FileList` object listing every selected file. * The same as in the native `` */ files?: FileList | null; defaultLocalImageUrls?: NvLocalImageUrls; setDefaultLocalImageUrls?: (imageUrls: NvLocalImageUrls) => void; invalid?: boolean; setInvalid?: (invalid: boolean) => void; /** * The array of objects holding the uploaded files data: * `name`, `type`, and `url`. */ uploadedFiles?: NvUploadedFile[]; /** * The comma-separated list of allowed file types. * Note: when `strict` is false, this attribute has the * same behavior as in the native ``: * works only for file selector dialogs (has no effect * on the 'drag-n-drop' feature) and can be opted out. */ accept?: string; /** * The scrollable text description appearing under * the file type icons when no files have yet been * selected or uploaded. */ hint?: string; /** * If more than 1 file can be selected at a time. * Note: when `strict` is false, this attribute has the * same behavior as in the native ``: * works only for file selector dialogs (has no effect * on the 'drag-n-drop' feature). */ multiple: boolean; /** * The string specifying which camera to use for capture. * The same as in the native `` */ capture?: boolean | "user" | "environment"; /** * If a function is provided for this prop, * the additional `upload` icon will be shown * upon file selection. A click on that icon will * call the provided function. */ upload?: (event: MouseEvent | KeyboardEvent, files: FileList | null) => void; size?: string; /** * If strict checks against the `multiple` and `accept` * attributes should be enabled. If true, the component * will actually restrict the number and types of files * users can select (even with the 'drag-n-drop' feature) * and will set the visual `invalid` state as needed. */ strict?: boolean; } /** * Functional component for handling file uploads with various modes and features. * @param NvUploaderProps - Props object containing configuration options for the uploader. * @returns React component for file uploading with progress tracking and file management. */ declare const NvUploader: FC; export default NvUploader;