import { type EventEmitter } from "../../stencil-public-runtime"; interface UploadTask { file: File; progress: number; intervalId: number | null; completed: boolean; error?: boolean; } export type FileUploadErrorReason = "network-error" | "timeout" | "file-too-large" | "unsupported-type" | "invalid-type" | "custom" | (string & {}); export declare class FileUpload { hostElement: HTMLIfxFileUploadElement; /** Enables drag-and-drop for file uploads. */ readonly dragAndDrop: boolean; /** Wether at least one file is rewuired. */ readonly required: boolean; /** If true, the upload is disabled and not interactive. */ readonly disabled: boolean; /** Maximum file size allowed in megabytes. */ readonly maxFileSizeMB: number; /** Default set of allowed file extensions (used internally). Can be extended using `additionalAllowedFileTypes`. */ readonly allowedFileTypes?: string | string[]; /** Extra file types to allow in addition to the default ones. */ readonly additionalAllowedFileTypes?: string | string[]; /** When set to true, allows any file type to be uploaded (no file type restrictions). */ readonly allowAnyFileType: boolean; /** Custom file extensions to allow (e.g., 'xml', 'asc', 'cfg'). Recommended format: without dots. Also accepts format with dots like '.xml'. Do not use wildcards like '*.xml'. */ readonly allowedFileExtensions?: string | string[]; /** Custom function that handels file upload and progress reporting. */ readonly uploadHandler?: (file: File, onProgress?: (progress: number) => void) => Promise; private _maxFiles?; get maxFiles(): number | undefined; set maxFiles(value: number | undefined); /** Main label for the upload component. */ readonly label: string; /** Error message shown when no file is uploaded but at least one is required. */ readonly labelRequiredError: string; /** Text for the “browse files” button or link. */ readonly labelBrowseFiles: string; /** Text shown in the drop zone area. */ readonly labelDragAndDrop: string; /** Heading label above the list of uploaded files. */ readonly labelUploadedFilesHeading: string; /** Message shown when a file is too large ({{size}} is replaced with max size). */ readonly labelFileTooLarge: string; /** Message shown when the file type is not allowed. */ readonly labelUnsupportedFileType: string; /** Status text for a successfully uploaded file. */ readonly labelUploaded: string; /** Generic error message shown when upload fails. */ readonly labelUploadFailed: string; /** Template text for listing supported formats and size ({{types}} and {{size}} are replaced). */ readonly labelSupportedFormatsTemplate: string; /** Singular word used for “file” in messages. */ readonly labelFileSingular: string; /** Plural word used for “files” in messages. */ readonly labelFilePlural: string; /** Info text about the maximum number of files allowed ({{count}} and {{files}} are replaced). */ readonly labelMaxFilesInfo?: string; /** Error message shown when the max number of files is exceeded. */ readonly labelMaxFilesExceeded: string; /** ARIA label for the “browse files” control. */ readonly ariaLabelBrowseFiles: string; /** ARIA label for the drop zone area. */ readonly ariaLabelDropzone: string; /** ARIA label for the hidden/native file input element. */ readonly ariaLabelFileInput: string; /** ARIA label for the “remove file” action. */ readonly ariaLabelRemoveFile: string; /** ARIA label for the “cancel upload” action. */ readonly ariaLabelCancelUpload: string; /** ARIA label for the “retry upload” action. */ readonly ariaLabelRetryUpload: string; /** ARIA label describing that an upload is currently in progress. */ readonly ariaLabelUploadingStatus: string; /** ARIA label describing that upload has completed successfully. */ readonly ariaLabelUploadedStatus: string; /** ARIA label describing that the upload has failed. */ readonly ariaLabelUploadFailedStatus: string; private showDemoStates?; private internalId; isDragOver: boolean; files: File[]; uploadTasks: UploadTask[]; rejectedSizeFiles: string[]; rejectedTypeFiles: string[]; requiredError: boolean; statusMessage: { type: "error" | "info" | "success"; text: string; } | null; /** Fired when files are added (e.g. via browse or drop). */ ifxFileUploadAdd: EventEmitter<{ addedFiles: File[]; files: File[]; }>; /** Fired when a file is removed from the list. */ ifxFileUploadRemove: EventEmitter<{ removedFile: File; files: File[]; }>; /** Fired whenever the list of selected files changes. */ ifxFileUploadChange: EventEmitter<{ files: File[]; }>; /** Fired when an upload-related error occurs. */ ifxFileUploadError: EventEmitter<{ errorType: string; file: File; message: string; reason?: string; }>; /** Fired when a file fails validation before upload. */ ifxFileUploadInvalid: EventEmitter<{ file: File; reason: string; }>; /** Fired when upload starts for a file. */ ifxFileUploadStart: EventEmitter<{ file: File; }>; /** Fired when a single file upload finishes successfully. */ ifxFileUploadComplete: EventEmitter<{ file: File; }>; /** Fired when all file uploads have finished successfully. */ ifxFileUploadAllComplete: EventEmitter<{ files: File[]; }>; /** Fired when an ongoing upload is aborted/cancelled. */ ifxFileUploadAbort: EventEmitter<{ file: File; }>; /** Fired when files are dropped onto the drop zone. */ ifxFileUploadDrop: EventEmitter<{ droppedFiles: File[]; acceptedFiles: File[]; rejectedFiles: File[]; }>; /** Fired when the upload area is clicked (typically to open file dialog). */ ifxFileUploadClick: EventEmitter; /** Fired when the user tries to add more than the allowed number of files. */ ifxFileUploadMaxFilesExceeded: EventEmitter<{ maxFiles: number; attempted: number; }>; /** Fired after validating the current files (valid or invalid). */ ifxFileUploadValidation: EventEmitter<{ valid: boolean; }>; /** Fired when the user retries uploading a file after a failure. */ ifxFileUploadRetry: EventEmitter<{ file: File; }>; private fileInputEl; private extensionToMimeMap; private validateRequired; private pluralize; private getNormalizedFileTypes; private getNormalizedFileExtensions; /** * Enhanced file type validation that supports: * - allowAnyFileType flag for unrestricted uploads (overrides all restrictions) * - allowedFileTypes (predefined extensions mapped to MIME types) - if not set and allowedFileExtensions is set, ignored * - additionalAllowedFileTypes (MIME types) * - allowedFileExtensions (custom extensions) - if only this is set, only these extensions are allowed */ private isFileTypeAllowed; /** * Extracts file extension from filename (without dot) */ private getFileExtension; private getLabelFromMimeType; private handleFileChange; private handleDrop; private handleDragOver; private handleDragLeave; private processFiles; private retryUpload; private checkAndEmitAllComplete; private resetFileInput; private updateTaskProgress; private startUpload; private cancelUpload; private removeFile; private clearRejectedFile; private splitFileNameParts; private getFileIcon; private formatSize; private getAcceptAttribute; private getFormattedProgressText; private getAdditionalMimeTypes; private getSupportedFileText; private getFormattedFileTooLargeText; private renderStatusMessage; private isInputDisabled; componentDidLoad(): Promise; /** Storybook Demo */ injectDemoState(): Promise; /** Storybook Demo */ triggerDemoValidation(): Promise; render(): any; private renderUploadArea; private renderDragAndDropArea; } export {};