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.
74 lines • 3.64 kB
text/typescript
export default TinyHtmlSubmitInput;
/**
* TinyHtmlSubmitInput is a helper class for managing
* <input type="submit"> elements with validation and attribute/property handling.
*
* @example
* const submitBtn = new TinyHtmlSubmitInput({
* value: 'Send',
* formaction: '/submit',
* formenctype: 'multipart/form-data',
* formmethod: 'post',
* formnovalidate: true,
* formtarget: '_blank'
* });
*/
declare class TinyHtmlSubmitInput extends TinyHtmlInput {
/**
* Creates a new TinyHtmlSubmitInput instance.
* @param {Object} config - Configuration object.
* @param {string|number} [config.value] - Initial value (button label).
* @param {string} [config.name] - Name of the input control.
* @param {string} [config.placeholder] - Placeholder text (not common for submit inputs).
* @param {'application/x-www-form-urlencoded'|'multipart/form-data'|'text/plain'} [config.formenctype] - Form encoding type.
* @param {'get'|'post'|'dialog'} [config.formmethod] - Submission method.
* @param {boolean} [config.formnovalidate=false] - Whether to bypass form validation.
* @param {'_self'|'_blank'|'_parent'|'_top'|string} [config.formtarget] - Target browsing context for submission.
* @param {string} [config.formaction] - URL to which the form is submitted.
* @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({ formenctype, formmethod, formnovalidate, formtarget, formaction, readonly, required, value, tags, name, placeholder, mainClass, }?: {
value?: string | number | undefined;
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;
formaction?: string | undefined;
readonly?: boolean | undefined;
required?: boolean | undefined;
tags?: string | string[] | Set<string> | undefined;
mainClass?: string | undefined;
});
/** @param {string|number} value */
set value(value: string | number);
/** @returns {string|null} */
get value(): 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;
}
import TinyHtmlInput from '../../TinyHtmlInput.mjs';
//# sourceMappingURL=TinyHtmlSubmitInput.d.mts.map