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.
97 lines • 4.53 kB
text/typescript
export default TinyHtmlImageInput;
/**
* TinyHtmlImageInput is a helper class for managing <input type="image"> elements.
* It supports validation and configuration of attributes such as alt, list, form actions,
* form behaviors, and size constraints.
*
* @example
* const imageInput = new TinyHtmlImageInput({
* name: 'submitImage',
* alt: 'Submit',
* formaction: '/submit',
* height: 40,
* width: 100,
* required: true
* });
*/
declare class TinyHtmlImageInput extends TinyHtmlInput {
/**
* Creates a new TinyHtmlImageInput instance.
* @param {Object} config - Configuration object.
* @param {string} [config.name] - The name of the input.
* @param {string} [config.placeholder] - Placeholder text.
* @param {'application/x-www-form-urlencoded'|'multipart/form-data'|'text/plain'} [config.formenctype] - Encoding type.
* @param {'get'|'post'|'dialog'} [config.formmethod] - Submission method.
* @param {boolean} [config.formnovalidate=false] - Whether to bypass form validation.
* @param {string} [config.formtarget] - Where to display the response.
* @param {string} [config.autocomplete] - Autocomplete hint (e.g., "on", "off", "email").
* @param {string} [config.alt] - Alternative text for the image input.
* @param {string} [config.formaction] - URL to submit the form.
* @param {number} [config.height] - Height in CSS pixels.
* @param {number} [config.width] - Width in CSS pixels.
* @param {string} [config.list] - ID of a <datalist>.
* @param {string} [config.src] - Image source URL (**required**).
* @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 has an invalid type or value.
*/
constructor({ list, formenctype, formmethod, formnovalidate, height, width, formtarget, formaction, placeholder, name, readonly, required, alt, autocomplete, src, tags, mainClass, }?: {
name?: string | undefined;
placeholder?: string | undefined;
formenctype?: "text/plain" | "application/x-www-form-urlencoded" | "multipart/form-data" | undefined;
formmethod?: "dialog" | "get" | "post" | undefined;
formnovalidate?: boolean | undefined;
formtarget?: string | undefined;
autocomplete?: string | undefined;
alt?: string | undefined;
formaction?: string | undefined;
height?: number | undefined;
width?: number | undefined;
list?: string | undefined;
src?: string | undefined;
readonly?: boolean | undefined;
required?: boolean | undefined;
tags?: string | string[] | Set<string> | undefined;
mainClass?: string | undefined;
});
/** @param {string} value */
set src(value: string);
/** @returns {string|null} */
get src(): string | null;
/** @param {string} alt */
set alt(alt: string);
/** @returns {string|null} */
get alt(): string | null;
/** @param {string} list */
set list(list: string);
/** @returns {string|null} */
get list(): string | null;
/** @param {string} formaction */
set formaction(formaction: string);
/** @returns {string|null} */
get formaction(): string | null;
/** @param {'application/x-www-form-urlencoded'|'multipart/form-data'|'text/plain'} formenctype */
set formenctype(formenctype: "application/x-www-form-urlencoded" | "multipart/form-data" | "text/plain");
/** @returns {string|null} */
get formenctype(): string | null;
/** @param {'get'|'post'|'dialog'} formmethod */
set formmethod(formmethod: "get" | "post" | "dialog");
/** @returns {string|null} */
get formmethod(): string | null;
/** @param {boolean} formnovalidate */
set formnovalidate(formnovalidate: boolean);
/** @returns {boolean} */
get formnovalidate(): boolean;
/** @param {string} formtarget */
set formtarget(formtarget: string);
/** @returns {string|null} */
get formtarget(): string | null;
/** @param {string} autocomplete */
set autocomplete(autocomplete: string);
/** @returns {string|null} */
get autocomplete(): string | null;
}
import TinyHtmlInput from '../TinyHtmlInput.mjs';
//# sourceMappingURL=TinyHtmlImageInput.d.mts.map