export type UploaderConfig = { /** * - * Single or multiple elements (or selectors) that will act as upload triggers. */ triggers: string | HTMLElement | Array; /** * - * Whether to allow selection of multiple files. */ multiple?: boolean; /** * - * A comma-separated list of accepted file types (e.g., ".png,.jpg" or "image/*"). */ accept?: string | string[]; /** * - * Additional attributes to apply to the created ``. */ inputAttributes?: Record; /** * - * Inline CSS styles to apply to the hidden input. Default hides the element. */ inputStyles?: Partial; /** * - * Callback executed when a trigger is clicked (before the file dialog opens). */ onClick?: ((triggerElement: HTMLElement) => void) | null; /** * - * Callback executed when files are selected through the file input. */ onFileLoad?: ((files: FileList, triggerElement: HTMLElement) => void) | null; }; /** * @typedef {Object} UploaderConfig * * @property {string | HTMLElement | Array} triggers - * Single or multiple elements (or selectors) that will act as upload triggers. * * @property {boolean} [multiple=false] - * Whether to allow selection of multiple files. * * @property {string|string[]} [accept=""] - * A comma-separated list of accepted file types (e.g., ".png,.jpg" or "image/*"). * * @property {Record} [inputAttributes={}] - * Additional attributes to apply to the created ``. * * @property {Partial} [inputStyles={ display: 'none' }] - * Inline CSS styles to apply to the hidden input. Default hides the element. * * @property {((triggerElement: HTMLElement) => void)|null} [onClick=null] - * Callback executed when a trigger is clicked (before the file dialog opens). * * @property {((files: FileList, triggerElement: HTMLElement) => void)|null} [onFileLoad=null] - * Callback executed when files are selected through the file input. */ /** * TinyUploadClicker is a lightweight utility class for attaching custom clickable elements * (like buttons, divs, icons, etc.) that trigger hidden file input elements. * * It provides full control over the input file element without needing to display it, * and allows per-trigger customization, style injection, and event handling. * * Each trigger element creates its own associated hidden file input, enabling multiple * upload zones with different behaviors. You can handle `onClick` and `onFileLoad` callbacks, * define accepted file types, allow multiple selections, and cleanly destroy everything via `destroy()`. * * Designed for maximum flexibility in pure JavaScript environments, including dynamic UI rendering. * * @example * const uploader = new TinyUploadClicker({ * triggers: '#uploadBtn', * accept: ['.png', '.jpg'], * multiple: true, * inputAttributes: { 'data-tracker': 'upload' }, * inputStyles: { display: 'none' }, * onClick: (el) => console.log('Trigger clicked:', el), * onFileLoad: (files, el) => console.log('Files selected:', files) * }); * * // Later, if needed: * uploader.destroy(); */ declare class TinyUploadClicker { #private; /** * Gets the current destruction status of the instance. * * @returns {boolean} True if the instance is destroyed, false otherwise. */ get destroyed(): boolean; /** * Creates a new instance of TinyUploadClicker. * * @param {UploaderConfig} options - Configuration object for customizing the uploader behavior and appearance. * @throws {TypeError} If the config is invalid or required options are missing. */ constructor(options: UploaderConfig); /** * Cleans up all internal elements and event listeners, removing created inputs and breaking references. */ destroy(): void; } export default TinyUploadClicker; //# sourceMappingURL=TinyUploadClicker.d.mts.map