UNPKG

wj-elements

Version:

WebJET Elements is a modern set of user interface tools harnessing the power of web components designed to simplify web application development.

144 lines (143 loc) 5.62 kB
import { default as WJElement } from '../wje-element/element.js'; import { default as Radio } from '../wje-radio/radio.js'; /** * `RadioGroup` is a custom web component that represents a group of radio buttons. * @summary This element represents a group of radio buttons. * @documentation https://elements.webjet.sk/components/radio-group * @status stable * @augments {WJElement} * @slot - The default slot for the radio group. * @tag wje-radio-group */ export default class RadioGroup extends WJElement { /** * Returns the CSS styles for the component. * @static * @returns {CSSStyleSheet} */ static get cssStyleSheet(): CSSStyleSheet; /** * Whether the input is associated with a form. * @type {boolean} */ static formAssociated: boolean; internals: ElementInternals; /** * Setter for the value attribute. * @param {string} value The value to set. */ set value(value: string); /** * Getter for the value attribute. * @returns {string} The value of the attribute. */ get value(): string; /** * Getter for the form attribute. * @returns {HTMLFormElement} The form the input is associated with. */ get form(): HTMLFormElement; /** * Getter for the name attribute. * @returns {string} The name of the input. */ get name(): string; /** * Getter for the type attribute. * @returns {string} The type of the input. */ get type(): string; /** * Getter for the validity attribute. * @returns {ValidityState} The validity state of the input. */ get validity(): ValidityState; /** * Getter for the validationMessage attribute. * @returns {string} The validation message of the input. */ get validationMessage(): string; /** * Getter for the willValidate attribute. * @returns {boolean} Whether the input will be validated. */ get willValidate(): boolean; /** * @summary Setter for the defaultValue attribute. * This method sets the 'value' attribute of the custom input element to the provided value. * The 'value' attribute represents the default value of the input element. * @param {string} value The value to set as the default value. */ set defaultValue(value: string); /** * @summary Getter for the defaultValue attribute. * This method retrieves the 'value' attribute of the custom input element. * The 'value' attribute represents the default value of the input element. * If the 'value' attribute is not set, it returns an empty string. * @returns {string} The default value of the input element. */ get defaultValue(): string; /** * Draws the component for the radio group. * @returns {DocumentFragment} */ draw(): DocumentFragment; /** * Adds event listeners after the component is drawn. Handles the selection of radio buttons. */ afterDraw(): void; /** * Returns the radio button with the given value. * @param {string} value The value of the radio button. * @returns {Radio} The radio button. */ getRadioByValue(value: string): Radio; /** * Removes the check from all radio buttons. */ removeCheck(): void; /** * Sets the given radio button to checked. */ checkRadio(value: any): boolean; /** * Retrieves all direct child elements of the current element. * @returns {HTMLElement[]} An array of child elements. */ getAllElements(): HTMLElement[]; /** * @summary Callback function that is called when the custom element is associated with a form. * This function adds an event listener to the form's submit event, which validates the input and propagates the validation. * @param {HTMLFormElement} form The form the custom element is associated with. */ formAssociatedCallback(form: HTMLFormElement): void; /** * The formResetCallback method is a built-in lifecycle callback that gets called when a form gets reset. * This method is responsible for resetting the value of the custom input element to its default value. * It also resets the form value and validity state in the form internals. * @function */ formResetCallback(): void; /** * The formStateRestoreCallback method is a built-in lifecycle callback that gets called when the state of a form-associated custom element is restored. * This method is responsible for restoring the value of the custom input element to its saved state. * It also restores the form value and validity state in the form internals to their saved states. * @param {object} state The saved state of the custom input element. * @function */ formStateRestoreCallback(state: object): void; /** * The formStateSaveCallback method is a built-in lifecycle callback that gets called when the state of a form-associated custom element is saved. * This method is responsible for saving the value of the custom input element. * @returns {object} The saved state of the custom input element. * @function */ formStateSaveCallback(): object; /** * The formDisabledCallback method is a built-in lifecycle callback that gets called when the disabled state of a form-associated custom element changes. * This method is not implemented yet. * @param {boolean} disabled The new disabled state of the custom input element. * @function */ formDisabledCallback(disabled: boolean): void; }