UNPKG

tiny-essentials

Version:

Collection of small, essential scripts designed to be used across various projects. These simple utilities are crafted for speed, ease of use, and versatility.

63 lines 2.66 kB
export default TinyHtmlFileInput; /** * TinyHtmlFileInput is a helper class for managing <input type="file"> elements. * It allows configuring attributes such as `accept`, `multiple`, `capture`, * `readonly`, and `required` with validation, while exposing a safe getter for files. * * @example * const fileInput = new TinyHtmlFileInput({ * accept: '.png,.jpg', * multiple: true, * required: true * }); * * document.body.appendChild(fileInput.el); * * @extends TinyHtmlInput */ declare class TinyHtmlFileInput extends TinyHtmlInput { /** * Creates a new TinyHtmlFileInput instance. * @param {Object} config - Configuration object. * @param {string} [config.name] - The name of the input control. * @param {string} [config.placeholder] - Placeholder text (not widely supported for file inputs). * @param {string|boolean} [config.capture] - Capture mode ("user", "environment", or `true`). * @param {boolean} [config.multiple=false] - Whether multiple files can be selected. * @param {string} [config.accept] - Accepted file types (e.g., ".jpg,.png" or "image/*"). * @param {boolean} [config.readonly=false] - Whether the input is read-only. * @param {boolean} [config.required=false] - Whether the input is required. * @param {string|string[]|Set<string>} [config.tags=[]] - Initial CSS classes. * @param {string} [config.mainClass=''] - Main CSS class. * @throws {TypeError} If any attribute is of the wrong type. */ constructor({ name, capture, multiple, accept, placeholder, readonly, required, tags, mainClass, }?: { name?: string | undefined; placeholder?: string | undefined; capture?: string | boolean | undefined; multiple?: boolean | undefined; accept?: string | undefined; readonly?: boolean | undefined; required?: boolean | undefined; tags?: string | string[] | Set<string> | undefined; mainClass?: string | undefined; }); /** @param {boolean} multiple */ set multiple(multiple: boolean); /** @returns {boolean} */ get multiple(): boolean; /** @param {string} accept */ set accept(accept: string); /** @returns {string|null} */ get accept(): string | null; /** @param {string|boolean} capture */ set capture(capture: string | boolean); /** @returns {string|boolean|null} */ get capture(): string | boolean | null; /** * Gets the list of selected files. * @returns {FileList|null} */ get files(): FileList | null; } import TinyHtmlInput from '../TinyHtmlInput.mjs'; //# sourceMappingURL=TinyHtmlFileInput.d.mts.map