wj-elements 0.1.184 → 0.1.186
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/form-associated-element-CaIxmEod.js +242 -0
- package/dist/form-associated-element-CaIxmEod.js.map +1 -0
- package/dist/light.css +3 -3
- package/dist/packages/internals/form-associated-element.d.ts +138 -0
- package/dist/packages/wje-checkbox/checkbox.element.d.ts +17 -90
- package/dist/packages/wje-infinite-scroll/infinite-scroll.element.d.ts +1 -1
- package/dist/packages/wje-input/input.element.d.ts +3 -106
- package/dist/packages/wje-options/options.element.d.ts +23 -19
- package/dist/packages/wje-popup/popup.element.d.ts +10 -0
- package/dist/packages/wje-radio/radio.element.d.ts +12 -1
- package/dist/packages/wje-radio-group/radio-group.element.d.ts +8 -90
- package/dist/packages/wje-select/select.d.ts +1 -1
- package/dist/packages/wje-select/select.element.d.ts +56 -194
- package/dist/packages/wje-textarea/textarea.element.d.ts +3 -110
- package/dist/{popup.element-Di4nHYij.js → popup.element-CVbbnTWI.js} +53 -24
- package/dist/{popup.element-Di4nHYij.js.map → popup.element-CVbbnTWI.js.map} +1 -1
- package/dist/wje-checkbox.js +59 -403
- package/dist/wje-checkbox.js.map +1 -1
- package/dist/wje-dropdown.js +1 -1
- package/dist/wje-icon-picker.js +1 -1
- package/dist/wje-infinite-scroll.js +7 -2
- package/dist/wje-infinite-scroll.js.map +1 -1
- package/dist/wje-input.js +10 -213
- package/dist/wje-input.js.map +1 -1
- package/dist/wje-master.js +1 -1
- package/dist/wje-option.js.map +1 -1
- package/dist/wje-options.js +56 -45
- package/dist/wje-options.js.map +1 -1
- package/dist/wje-popup.js +1 -1
- package/dist/wje-radio-group.js +82 -148
- package/dist/wje-radio-group.js.map +1 -1
- package/dist/wje-radio.js +36 -8
- package/dist/wje-radio.js.map +1 -1
- package/dist/wje-select.js +186 -303
- package/dist/wje-select.js.map +1 -1
- package/dist/wje-textarea.js +16 -210
- package/dist/wje-textarea.js.map +1 -1
- package/dist/wje-tooltip.js +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4
|
+
import WJElement from "./wje-element.js";
|
|
5
|
+
import { event } from "./event.js";
|
|
6
|
+
class FormAssociatedElement extends WJElement {
|
|
7
|
+
constructor() {
|
|
8
|
+
super();
|
|
9
|
+
this.internals = this.attachInternals();
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Sets the 'name' attribute to the given value.
|
|
13
|
+
* @param {string} value The new value for the 'name' attribute.
|
|
14
|
+
*/
|
|
15
|
+
set name(value) {
|
|
16
|
+
this.setAttribute("name", value);
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Getter for the name attribute.
|
|
20
|
+
* @returns {string} The name of the input.
|
|
21
|
+
*/
|
|
22
|
+
get name() {
|
|
23
|
+
return this.getAttribute("name");
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Getter for the type attribute.
|
|
27
|
+
* @returns {string} The type of the input.
|
|
28
|
+
*/
|
|
29
|
+
get type() {
|
|
30
|
+
console.log("LOCAL NAME", this.localName, this.getAttribute("type"));
|
|
31
|
+
return this.getAttribute("type");
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Sets or removes the 'required' attribute on the element.
|
|
35
|
+
* @param {boolean} value If true, adds the 'required' attribute. If false, removes the 'required' attribute.
|
|
36
|
+
*/
|
|
37
|
+
set required(value) {
|
|
38
|
+
if (value) {
|
|
39
|
+
this.setAttribute("required", "");
|
|
40
|
+
} else {
|
|
41
|
+
this.removeAttribute("required");
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Checks if the 'required' attribute is present on the element.
|
|
46
|
+
* @returns {boolean} `true` if the 'required' attribute is set, otherwise `false`.
|
|
47
|
+
*/
|
|
48
|
+
get required() {
|
|
49
|
+
return this.hasAttribute("required");
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Setter for the invalid attribute.
|
|
53
|
+
* @param {boolean} isInvalid Whether the input is invalid.
|
|
54
|
+
*/
|
|
55
|
+
set invalid(isInvalid) {
|
|
56
|
+
if (isInvalid) this.setAttribute("invalid", "");
|
|
57
|
+
else this.removeAttribute("invalid");
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Getter for the invalid attribute.
|
|
61
|
+
* @returns {boolean} Whether the attribute is present.
|
|
62
|
+
*/
|
|
63
|
+
get invalid() {
|
|
64
|
+
return this.hasAttribute("invalid");
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Set checked attribute.
|
|
68
|
+
* @param {boolean} value true if the toggle is checked, false otherwise
|
|
69
|
+
*/
|
|
70
|
+
set disabled(value) {
|
|
71
|
+
if (value) {
|
|
72
|
+
this.setAttribute("disabled", "");
|
|
73
|
+
} else {
|
|
74
|
+
this.removeAttribute("disabled");
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Get disabled attribute value.
|
|
79
|
+
* @returns {boolean} true if the toggle is disabled, false otherwise
|
|
80
|
+
*/
|
|
81
|
+
get disabled() {
|
|
82
|
+
return this.hasAttribute("disabled");
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Retrieves the form element associated with this object.
|
|
86
|
+
* @returns {HTMLFormElement|null} The associated form element, or null if there isn't one.
|
|
87
|
+
*/
|
|
88
|
+
get form() {
|
|
89
|
+
return this.internals.form;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Retrieves the validity state of the element by returning the validity object from the internal element.
|
|
93
|
+
* The validity object provides information on whether the element satisfies its validation constraints.
|
|
94
|
+
* @returns {ValidityState} The validity state object representing the element's validation constraints.
|
|
95
|
+
*/
|
|
96
|
+
get validity() {
|
|
97
|
+
return this.internals.validity;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Retrieves the current validation message associated with the element.
|
|
101
|
+
* @returns {string} The validation message that describes why the element's value fails validity checks.
|
|
102
|
+
*/
|
|
103
|
+
get validationMessage() {
|
|
104
|
+
return this.internals.validationMessage;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Indicates whether the element is a candidate for constraint validation.
|
|
108
|
+
* @returns {boolean} Returns true if the element will be validated during constraint validation, false otherwise.
|
|
109
|
+
*/
|
|
110
|
+
get willValidate() {
|
|
111
|
+
return this.internals.willValidate;
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Validates the input element associated with the component and updates its validity state
|
|
115
|
+
* and error messages based on the user's input and the current validation rules.
|
|
116
|
+
* @returns {void} This method does not return a value. It modifies the validity state
|
|
117
|
+
* internally and sets appropriate validation messages.
|
|
118
|
+
*/
|
|
119
|
+
validate() {
|
|
120
|
+
const validState = this.input.validity;
|
|
121
|
+
if (!validState.valid) {
|
|
122
|
+
for (let state in validState) {
|
|
123
|
+
const attr = `message-${state.toString()}`;
|
|
124
|
+
if (validState[state]) {
|
|
125
|
+
this.validationError = state.toString();
|
|
126
|
+
let errorMessage = this.message;
|
|
127
|
+
if (!this.hasAttribute("message"))
|
|
128
|
+
errorMessage = this.hasAttribute(attr) ? this.getAttribute(attr) : this.input.validationMessage;
|
|
129
|
+
this.internals.setValidity({ [this.validationError]: true }, errorMessage, this.input);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
} else {
|
|
133
|
+
this.internals.setValidity({});
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Propagates a validation event based on the validity state of the component.
|
|
138
|
+
*
|
|
139
|
+
* This method checks the validity status of the component and emits a custom
|
|
140
|
+
* event if the component is invalid. The event's name and additional details
|
|
141
|
+
* can be specified.
|
|
142
|
+
* @param {string} [eventName] The name of the event to dispatch when the component is invalid.
|
|
143
|
+
* @param {object} [detail] Additional detail to include in the dispatched event.
|
|
144
|
+
* @returns {void} This method does not return a value.
|
|
145
|
+
*/
|
|
146
|
+
propagateValidation(eventName = "invalid", detail = {}) {
|
|
147
|
+
const internals = this.internals;
|
|
148
|
+
this.invalid = !this.pristine && !internals.validity.valid;
|
|
149
|
+
if (this.invalid) {
|
|
150
|
+
event.dispatchCustomEvent(this, this.tagName.toLocaleLowerCase() + ":" + eventName, detail);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Displays an invalid message for the current element.
|
|
155
|
+
* If an error message element does not exist within the designated slot,
|
|
156
|
+
* it creates one and appends it to the slot. Updates the text content
|
|
157
|
+
* of the error message element with the validation message from the
|
|
158
|
+
* element's internals.
|
|
159
|
+
* @returns {void} This method does not return any value.
|
|
160
|
+
*/
|
|
161
|
+
showInvalidMessage() {
|
|
162
|
+
const internals = this.internals;
|
|
163
|
+
const slot = this.querySelector("[slot='error']");
|
|
164
|
+
let errorMessageEl = slot == null ? void 0 : slot.querySelector("[error-message]");
|
|
165
|
+
if (!errorMessageEl) {
|
|
166
|
+
const error = document.createElement("div");
|
|
167
|
+
error.setAttribute("error-message", "");
|
|
168
|
+
slot == null ? void 0 : slot.append(error);
|
|
169
|
+
errorMessageEl = error;
|
|
170
|
+
}
|
|
171
|
+
errorMessageEl.textContent = internals.validationMessage;
|
|
172
|
+
}
|
|
173
|
+
checkValidity() {
|
|
174
|
+
this.validate();
|
|
175
|
+
return this.internals.checkValidity();
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Callback to handle the reset action for a form.
|
|
179
|
+
* Resets the value of the form control to its default value, updates the form value, and clears any validity states.
|
|
180
|
+
* @returns {void} Does not return a value.
|
|
181
|
+
*/
|
|
182
|
+
formResetCallback() {
|
|
183
|
+
this.value = this.defaultValue;
|
|
184
|
+
this.internals.setFormValue(this.defaultValue);
|
|
185
|
+
this.internals.setValidity({});
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* Restores the form state by assigning the provided state value
|
|
189
|
+
* and updating the internal form value and validity.
|
|
190
|
+
* @param {object} state The state object containing the value to restore the form.
|
|
191
|
+
* @param {*} state.value The value to set for the form element.
|
|
192
|
+
* @returns {void} This method does not return any value.
|
|
193
|
+
*/
|
|
194
|
+
formStateRestoreCallback(state) {
|
|
195
|
+
this.value = state.value;
|
|
196
|
+
this.internals.setFormValue(state.value);
|
|
197
|
+
this.internals.setValidity({});
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* Callback method to save the current state of a form.
|
|
201
|
+
* This method captures and returns the form's value property.
|
|
202
|
+
* @returns {object} An object containing the `value` property of the current form state.
|
|
203
|
+
*/
|
|
204
|
+
formStateSaveCallback() {
|
|
205
|
+
return {
|
|
206
|
+
value: this.value
|
|
207
|
+
};
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* Toggles the disabled state of the component and updates corresponding attributes.
|
|
211
|
+
* @param {boolean} disabled Indicates whether the form should be marked as disabled.
|
|
212
|
+
* If true, the 'disabled' class is added, and the 'disabled' attribute is set.
|
|
213
|
+
* If false, both the class and attribute are removed.
|
|
214
|
+
* @returns {void}
|
|
215
|
+
*/
|
|
216
|
+
formDisabledCallback(disabled) {
|
|
217
|
+
var _a;
|
|
218
|
+
(_a = this.native) == null ? void 0 : _a.classList.toggle("disabled", disabled);
|
|
219
|
+
this.toggleAttribute("disabled", disabled);
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* A lifecycle callback that is executed when the element is associated with a form.
|
|
223
|
+
* It updates the form's value field with the element's value and sets up an event
|
|
224
|
+
* listener to perform validation and propagate it whenever the form is submitted.
|
|
225
|
+
* @returns {void} Does not return any value.
|
|
226
|
+
*/
|
|
227
|
+
formAssociatedCallback() {
|
|
228
|
+
var _a;
|
|
229
|
+
if (this.form) {
|
|
230
|
+
this.internals.setFormValue(this.value);
|
|
231
|
+
(_a = this.form) == null ? void 0 : _a.addEventListener("submit", () => {
|
|
232
|
+
this.validate();
|
|
233
|
+
this.propagateValidation();
|
|
234
|
+
});
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
__publicField(FormAssociatedElement, "formAssociated", true);
|
|
239
|
+
export {
|
|
240
|
+
FormAssociatedElement as F
|
|
241
|
+
};
|
|
242
|
+
//# sourceMappingURL=form-associated-element-CaIxmEod.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"form-associated-element-CaIxmEod.js","sources":["../packages/internals/form-associated-element.js"],"sourcesContent":["import { default as WJElement, event } from \"../wje-element/element.js\";\n\nexport class FormAssociatedElement extends WJElement {\n static formAssociated = true;\n\n constructor() {\n super();\n this.internals = this.attachInternals();\n }\n\n /**\n * Sets the 'name' attribute to the given value.\n * @param {string} value The new value for the 'name' attribute.\n */\n set name(value) {\n this.setAttribute('name', value);\n }\n\n /**\n * Getter for the name attribute.\n * @returns {string} The name of the input.\n */\n get name() {\n return this.getAttribute('name');\n }\n\n /**\n * Getter for the type attribute.\n * @returns {string} The type of the input.\n */\n get type() {\n console.log('LOCAL NAME', this.localName, this.getAttribute(\"type\"));\n return this.getAttribute(\"type\");\n }\n\n /**\n * Sets or removes the 'required' attribute on the element.\n * @param {boolean} value If true, adds the 'required' attribute. If false, removes the 'required' attribute.\n */\n set required(value) {\n if (value) {\n this.setAttribute('required', '');\n } else {\n this.removeAttribute('required');\n }\n }\n\n /**\n * Checks if the 'required' attribute is present on the element.\n * @returns {boolean} `true` if the 'required' attribute is set, otherwise `false`.\n */\n get required() {\n return this.hasAttribute('required');\n }\n\n /**\n * Setter for the invalid attribute.\n * @param {boolean} isInvalid Whether the input is invalid.\n */\n set invalid(isInvalid) {\n if (isInvalid) this.setAttribute('invalid', '');\n else this.removeAttribute('invalid');\n }\n\n /**\n * Getter for the invalid attribute.\n * @returns {boolean} Whether the attribute is present.\n */\n get invalid() {\n return this.hasAttribute('invalid');\n }\n\n /**\n * Set checked attribute.\n * @param {boolean} value true if the toggle is checked, false otherwise\n */\n set disabled(value) {\n if (value) {\n this.setAttribute('disabled', '');\n } else {\n this.removeAttribute('disabled');\n }\n }\n\n /**\n * Get disabled attribute value.\n * @returns {boolean} true if the toggle is disabled, false otherwise\n */\n get disabled() {\n return this.hasAttribute('disabled');\n }\n\n /**\n * Retrieves the form element associated with this object.\n * @returns {HTMLFormElement|null} The associated form element, or null if there isn't one.\n */\n get form() {\n return this.internals.form;\n }\n\n /**\n * Retrieves the validity state of the element by returning the validity object from the internal element.\n * The validity object provides information on whether the element satisfies its validation constraints.\n * @returns {ValidityState} The validity state object representing the element's validation constraints.\n */\n get validity() {\n return this.internals.validity;\n }\n\n /**\n * Retrieves the current validation message associated with the element.\n * @returns {string} The validation message that describes why the element's value fails validity checks.\n */\n get validationMessage() {\n return this.internals.validationMessage;\n }\n\n /**\n * Indicates whether the element is a candidate for constraint validation.\n * @returns {boolean} Returns true if the element will be validated during constraint validation, false otherwise.\n */\n get willValidate() {\n return this.internals.willValidate;\n }\n\n /**\n * Validates the input element associated with the component and updates its validity state\n * and error messages based on the user's input and the current validation rules.\n * @returns {void} This method does not return a value. It modifies the validity state\n * internally and sets appropriate validation messages.\n */\n validate() {\n const validState = this.input.validity;\n\n if (!validState.valid) {\n for (let state in validState) {\n const attr = `message-${state.toString()}`;\n\n if (validState[state]) {\n this.validationError = state.toString();\n let errorMessage = this.message;\n\n // TODO this take error messages based on lang from operating system of user should we implement custom translations based on app language ?\n if (!this.hasAttribute('message'))\n errorMessage = this.hasAttribute(attr) ? this.getAttribute(attr) : this.input.validationMessage;\n\n this.internals.setValidity({ [this.validationError]: true }, errorMessage, this.input);\n }\n }\n } else {\n this.internals.setValidity({});\n }\n }\n\n /**\n * Propagates a validation event based on the validity state of the component.\n *\n * This method checks the validity status of the component and emits a custom\n * event if the component is invalid. The event's name and additional details\n * can be specified.\n * @param {string} [eventName] The name of the event to dispatch when the component is invalid.\n * @param {object} [detail] Additional detail to include in the dispatched event.\n * @returns {void} This method does not return a value.\n */\n propagateValidation(eventName = 'invalid', detail = {}) {\n const internals = this.internals;\n\n this.invalid = !this.pristine && !internals.validity.valid;\n\n if (this.invalid) {\n event.dispatchCustomEvent(this, this.tagName.toLocaleLowerCase() + ':' + eventName, detail);\n }\n }\n\n /**\n * Displays an invalid message for the current element.\n * If an error message element does not exist within the designated slot,\n * it creates one and appends it to the slot. Updates the text content\n * of the error message element with the validation message from the\n * element's internals.\n * @returns {void} This method does not return any value.\n */\n showInvalidMessage() {\n const internals = this.internals;\n const slot = this.querySelector(\"[slot='error']\");\n let errorMessageEl = slot?.querySelector('[error-message]');\n\n if (!errorMessageEl) {\n const error = document.createElement('div');\n error.setAttribute('error-message', '');\n slot?.append(error);\n errorMessageEl = error;\n }\n\n errorMessageEl.textContent = internals.validationMessage;\n }\n\n checkValidity() {\n // zavolá tvoju vlastnú validáciu pred kontrolou internals\n this.validate();\n return this.internals.checkValidity();\n }\n\n /**\n * Callback to handle the reset action for a form.\n * Resets the value of the form control to its default value, updates the form value, and clears any validity states.\n * @returns {void} Does not return a value.\n */\n formResetCallback() {\n this.value = this.defaultValue;\n this.internals.setFormValue(this.defaultValue);\n this.internals.setValidity({});\n }\n\n /**\n * Restores the form state by assigning the provided state value\n * and updating the internal form value and validity.\n * @param {object} state The state object containing the value to restore the form.\n * @param {*} state.value The value to set for the form element.\n * @returns {void} This method does not return any value.\n */\n formStateRestoreCallback(state) {\n this.value = state.value;\n this.internals.setFormValue(state.value);\n this.internals.setValidity({});\n }\n\n /**\n * Callback method to save the current state of a form.\n * This method captures and returns the form's value property.\n * @returns {object} An object containing the `value` property of the current form state.\n */\n formStateSaveCallback() {\n return {\n value: this.value\n };\n }\n\n /**\n * Toggles the disabled state of the component and updates corresponding attributes.\n * @param {boolean} disabled Indicates whether the form should be marked as disabled.\n * If true, the 'disabled' class is added, and the 'disabled' attribute is set.\n * If false, both the class and attribute are removed.\n * @returns {void}\n */\n formDisabledCallback(disabled) {\n this.native?.classList.toggle('disabled', disabled);\n this.toggleAttribute('disabled', disabled);\n }\n\n /**\n * A lifecycle callback that is executed when the element is associated with a form.\n * It updates the form's value field with the element's value and sets up an event\n * listener to perform validation and propagate it whenever the form is submitted.\n * @returns {void} Does not return any value.\n */\n formAssociatedCallback() {\n if (this.form) {\n this.internals.setFormValue(this.value);\n this.form?.addEventListener('submit', () => {\n this.validate();\n this.propagateValidation();\n });\n }\n }\n}"],"names":[],"mappings":";;;;;AAEO,MAAM,8BAA8B,UAAU;AAAA,EAGnD,cAAc;AACZ,UAAO;AACP,SAAK,YAAY,KAAK,gBAAiB;AAAA,EAC3C;AAAA;AAAA;AAAA;AAAA;AAAA,EAME,IAAI,KAAK,OAAO;AACd,SAAK,aAAa,QAAQ,KAAK;AAAA,EACnC;AAAA;AAAA;AAAA;AAAA;AAAA,EAME,IAAI,OAAO;AACT,WAAO,KAAK,aAAa,MAAM;AAAA,EACnC;AAAA;AAAA;AAAA;AAAA;AAAA,EAME,IAAI,OAAO;AACT,YAAQ,IAAI,cAAc,KAAK,WAAW,KAAK,aAAa,MAAM,CAAC;AACnE,WAAO,KAAK,aAAa,MAAM;AAAA,EACnC;AAAA;AAAA;AAAA;AAAA;AAAA,EAME,IAAI,SAAS,OAAO;AAClB,QAAI,OAAO;AACT,WAAK,aAAa,YAAY,EAAE;AAAA,IACtC,OAAW;AACL,WAAK,gBAAgB,UAAU;AAAA,IACrC;AAAA,EACA;AAAA;AAAA;AAAA;AAAA;AAAA,EAME,IAAI,WAAW;AACb,WAAO,KAAK,aAAa,UAAU;AAAA,EACvC;AAAA;AAAA;AAAA;AAAA;AAAA,EAME,IAAI,QAAQ,WAAW;AACrB,QAAI,UAAW,MAAK,aAAa,WAAW,EAAE;AAAA,QACzC,MAAK,gBAAgB,SAAS;AAAA,EACvC;AAAA;AAAA;AAAA;AAAA;AAAA,EAME,IAAI,UAAU;AACZ,WAAO,KAAK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K,gBAAgB,YAAY,QAAQ;AAAA,EAC7C;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQE,yBAAyB;;AACvB,QAAI,KAAK,MAAM;AACb,WAAK,UAAU,aAAa,KAAK,KAAK;AACtC,iBAAK,SAAL,mBAAW,iBAAiB,UAAU,MAAM;AAC1C,aAAK,SAAU;AACf,aAAK,oBAAqB;AAAA,MAClC;AAAA,IACA;AAAA,EACA;AACA;AAtQE,cADW,uBACJ,kBAAiB;"}
|
package/dist/light.css
CHANGED
|
@@ -366,7 +366,7 @@
|
|
|
366
366
|
/* Infinite Scroll */
|
|
367
367
|
--wje-infinite-scroll-width: 100%;
|
|
368
368
|
--wje-infinite-scroll-height: 300px;
|
|
369
|
-
--wje-infinite-scroll-loading-bg: rgba(
|
|
369
|
+
--wje-infinite-scroll-loading-bg: rgba(255, 255, 255, 1);
|
|
370
370
|
|
|
371
371
|
/* Img - Comparer */
|
|
372
372
|
--wje-img-compare-divider-area: 12px;
|
|
@@ -511,11 +511,11 @@
|
|
|
511
511
|
--wje-select-border-width: 1px;
|
|
512
512
|
--wje-select-border-style: solid;
|
|
513
513
|
--wje-select-border-color: var(--wje-border-color);
|
|
514
|
-
--wje-select-border-radius: var(--wje-border-radius-medium) var(--wje-border-radius-medium)
|
|
514
|
+
--wje-select-border-radius: var(--wje-border-radius-medium) var(--wje-border-radius-medium);
|
|
515
515
|
--wje-select-options-border-width: 1px;
|
|
516
516
|
--wje-select-options-border-style: var(--wje-border-style);
|
|
517
517
|
--wje-select-options-border-color: var(--wje-border-color);
|
|
518
|
-
--wje-select-options-border-radius:
|
|
518
|
+
--wje-select-options-border-radius: var(--wje-border-radius-medium);
|
|
519
519
|
--wje-select-background: var(--wje-color-contrast-0);
|
|
520
520
|
--wje-select-line-height: 20px;
|
|
521
521
|
--wje-select-color: var(--wje-color);
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import { default as WJElement } from '../wje-element/element.js';
|
|
2
|
+
export class FormAssociatedElement extends WJElement {
|
|
3
|
+
static formAssociated: boolean;
|
|
4
|
+
internals: ElementInternals;
|
|
5
|
+
/**
|
|
6
|
+
* Sets the 'name' attribute to the given value.
|
|
7
|
+
* @param {string} value The new value for the 'name' attribute.
|
|
8
|
+
*/
|
|
9
|
+
set name(value: string);
|
|
10
|
+
/**
|
|
11
|
+
* Getter for the name attribute.
|
|
12
|
+
* @returns {string} The name of the input.
|
|
13
|
+
*/
|
|
14
|
+
get name(): string;
|
|
15
|
+
/**
|
|
16
|
+
* Getter for the type attribute.
|
|
17
|
+
* @returns {string} The type of the input.
|
|
18
|
+
*/
|
|
19
|
+
get type(): string;
|
|
20
|
+
/**
|
|
21
|
+
* Sets or removes the 'required' attribute on the element.
|
|
22
|
+
* @param {boolean} value If true, adds the 'required' attribute. If false, removes the 'required' attribute.
|
|
23
|
+
*/
|
|
24
|
+
set required(value: boolean);
|
|
25
|
+
/**
|
|
26
|
+
* Checks if the 'required' attribute is present on the element.
|
|
27
|
+
* @returns {boolean} `true` if the 'required' attribute is set, otherwise `false`.
|
|
28
|
+
*/
|
|
29
|
+
get required(): boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Setter for the invalid attribute.
|
|
32
|
+
* @param {boolean} isInvalid Whether the input is invalid.
|
|
33
|
+
*/
|
|
34
|
+
set invalid(isInvalid: boolean);
|
|
35
|
+
/**
|
|
36
|
+
* Getter for the invalid attribute.
|
|
37
|
+
* @returns {boolean} Whether the attribute is present.
|
|
38
|
+
*/
|
|
39
|
+
get invalid(): boolean;
|
|
40
|
+
/**
|
|
41
|
+
* Set checked attribute.
|
|
42
|
+
* @param {boolean} value true if the toggle is checked, false otherwise
|
|
43
|
+
*/
|
|
44
|
+
set disabled(value: boolean);
|
|
45
|
+
/**
|
|
46
|
+
* Get disabled attribute value.
|
|
47
|
+
* @returns {boolean} true if the toggle is disabled, false otherwise
|
|
48
|
+
*/
|
|
49
|
+
get disabled(): boolean;
|
|
50
|
+
/**
|
|
51
|
+
* Retrieves the form element associated with this object.
|
|
52
|
+
* @returns {HTMLFormElement|null} The associated form element, or null if there isn't one.
|
|
53
|
+
*/
|
|
54
|
+
get form(): HTMLFormElement | null;
|
|
55
|
+
/**
|
|
56
|
+
* Retrieves the validity state of the element by returning the validity object from the internal element.
|
|
57
|
+
* The validity object provides information on whether the element satisfies its validation constraints.
|
|
58
|
+
* @returns {ValidityState} The validity state object representing the element's validation constraints.
|
|
59
|
+
*/
|
|
60
|
+
get validity(): ValidityState;
|
|
61
|
+
/**
|
|
62
|
+
* Retrieves the current validation message associated with the element.
|
|
63
|
+
* @returns {string} The validation message that describes why the element's value fails validity checks.
|
|
64
|
+
*/
|
|
65
|
+
get validationMessage(): string;
|
|
66
|
+
/**
|
|
67
|
+
* Indicates whether the element is a candidate for constraint validation.
|
|
68
|
+
* @returns {boolean} Returns true if the element will be validated during constraint validation, false otherwise.
|
|
69
|
+
*/
|
|
70
|
+
get willValidate(): boolean;
|
|
71
|
+
/**
|
|
72
|
+
* Validates the input element associated with the component and updates its validity state
|
|
73
|
+
* and error messages based on the user's input and the current validation rules.
|
|
74
|
+
* @returns {void} This method does not return a value. It modifies the validity state
|
|
75
|
+
* internally and sets appropriate validation messages.
|
|
76
|
+
*/
|
|
77
|
+
validate(): void;
|
|
78
|
+
validationError: string;
|
|
79
|
+
/**
|
|
80
|
+
* Propagates a validation event based on the validity state of the component.
|
|
81
|
+
*
|
|
82
|
+
* This method checks the validity status of the component and emits a custom
|
|
83
|
+
* event if the component is invalid. The event's name and additional details
|
|
84
|
+
* can be specified.
|
|
85
|
+
* @param {string} [eventName] The name of the event to dispatch when the component is invalid.
|
|
86
|
+
* @param {object} [detail] Additional detail to include in the dispatched event.
|
|
87
|
+
* @returns {void} This method does not return a value.
|
|
88
|
+
*/
|
|
89
|
+
propagateValidation(eventName?: string, detail?: object): void;
|
|
90
|
+
/**
|
|
91
|
+
* Displays an invalid message for the current element.
|
|
92
|
+
* If an error message element does not exist within the designated slot,
|
|
93
|
+
* it creates one and appends it to the slot. Updates the text content
|
|
94
|
+
* of the error message element with the validation message from the
|
|
95
|
+
* element's internals.
|
|
96
|
+
* @returns {void} This method does not return any value.
|
|
97
|
+
*/
|
|
98
|
+
showInvalidMessage(): void;
|
|
99
|
+
checkValidity(): boolean;
|
|
100
|
+
/**
|
|
101
|
+
* Callback to handle the reset action for a form.
|
|
102
|
+
* Resets the value of the form control to its default value, updates the form value, and clears any validity states.
|
|
103
|
+
* @returns {void} Does not return a value.
|
|
104
|
+
*/
|
|
105
|
+
formResetCallback(): void;
|
|
106
|
+
value: any;
|
|
107
|
+
/**
|
|
108
|
+
* Restores the form state by assigning the provided state value
|
|
109
|
+
* and updating the internal form value and validity.
|
|
110
|
+
* @param {object} state The state object containing the value to restore the form.
|
|
111
|
+
* @param {*} state.value The value to set for the form element.
|
|
112
|
+
* @returns {void} This method does not return any value.
|
|
113
|
+
*/
|
|
114
|
+
formStateRestoreCallback(state: {
|
|
115
|
+
value: any;
|
|
116
|
+
}): void;
|
|
117
|
+
/**
|
|
118
|
+
* Callback method to save the current state of a form.
|
|
119
|
+
* This method captures and returns the form's value property.
|
|
120
|
+
* @returns {object} An object containing the `value` property of the current form state.
|
|
121
|
+
*/
|
|
122
|
+
formStateSaveCallback(): object;
|
|
123
|
+
/**
|
|
124
|
+
* Toggles the disabled state of the component and updates corresponding attributes.
|
|
125
|
+
* @param {boolean} disabled Indicates whether the form should be marked as disabled.
|
|
126
|
+
* If true, the 'disabled' class is added, and the 'disabled' attribute is set.
|
|
127
|
+
* If false, both the class and attribute are removed.
|
|
128
|
+
* @returns {void}
|
|
129
|
+
*/
|
|
130
|
+
formDisabledCallback(disabled: boolean): void;
|
|
131
|
+
/**
|
|
132
|
+
* A lifecycle callback that is executed when the element is associated with a form.
|
|
133
|
+
* It updates the form's value field with the element's value and sets up an event
|
|
134
|
+
* listener to perform validation and propagate it whenever the form is submitted.
|
|
135
|
+
* @returns {void} Does not return any value.
|
|
136
|
+
*/
|
|
137
|
+
formAssociatedCallback(): void;
|
|
138
|
+
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { FormAssociatedElement } from '../internals/form-associated-element.js';
|
|
2
2
|
/**
|
|
3
3
|
* @summary This method dispatches a custom event named "wje-checkbox:change".
|
|
4
4
|
* It is triggered when the input event is fired, which happens when the state of the checkbox changes.
|
|
5
5
|
* The event is dispatched on the current instance of the Checkbox class.
|
|
6
6
|
* @documentation https://elements.webjet.sk/components/checkbox
|
|
7
7
|
* @status stable
|
|
8
|
-
* @augments
|
|
8
|
+
* @augments {FormAssociatedElement}
|
|
9
9
|
* @slot - The checkbox main content.
|
|
10
10
|
* @csspart native - The component's native wrapper.
|
|
11
11
|
* @cssproperty [--wje-checkbox-border-radius=--wje-border-radius-medium] - Border radius of the component;
|
|
@@ -15,19 +15,14 @@ import { default as WJElement } from '../wje-element/element.js';
|
|
|
15
15
|
* @cssproperty [--wje-checkbox-margin-inline=0] - Margin inline of the component;
|
|
16
16
|
* //@fires wje-checkbox:change - Dispatched when the checkbox state changes;
|
|
17
17
|
*/
|
|
18
|
-
export default class Checkbox extends
|
|
18
|
+
export default class Checkbox extends FormAssociatedElement {
|
|
19
19
|
/**
|
|
20
20
|
* Getter for the CSS stylesheet.
|
|
21
21
|
* @returns {string} The CSS stylesheet.
|
|
22
22
|
*/
|
|
23
23
|
static get cssStyleSheet(): string;
|
|
24
24
|
static get observedAttributes(): string[];
|
|
25
|
-
|
|
26
|
-
* Whether the input is associated with a form.
|
|
27
|
-
* @type {boolean}
|
|
28
|
-
*/
|
|
29
|
-
static formAssociated: boolean;
|
|
30
|
-
internals: ElementInternals;
|
|
25
|
+
pristine: boolean;
|
|
31
26
|
/**
|
|
32
27
|
* Setter for the value attribute.
|
|
33
28
|
* @param {string} value The value to set.
|
|
@@ -48,46 +43,6 @@ export default class Checkbox extends WJElement {
|
|
|
48
43
|
* @returns {boolean} Whether the attribute is present.
|
|
49
44
|
*/
|
|
50
45
|
get validateOnChange(): boolean;
|
|
51
|
-
/**
|
|
52
|
-
* Setter for the invalid attribute.
|
|
53
|
-
* @param {boolean} isInvalid Whether the input is invalid.
|
|
54
|
-
*/
|
|
55
|
-
set invalid(isInvalid: boolean);
|
|
56
|
-
/**
|
|
57
|
-
* Getter for the invalid attribute.
|
|
58
|
-
* @returns {boolean} Whether the attribute is present.
|
|
59
|
-
*/
|
|
60
|
-
get invalid(): boolean;
|
|
61
|
-
/**
|
|
62
|
-
* Getter for the form attribute.
|
|
63
|
-
* @returns {HTMLFormElement} The form the input is associated with.
|
|
64
|
-
*/
|
|
65
|
-
get form(): HTMLFormElement;
|
|
66
|
-
/**
|
|
67
|
-
* Getter for the name attribute.
|
|
68
|
-
* @returns {string} The name of the input.
|
|
69
|
-
*/
|
|
70
|
-
get name(): string;
|
|
71
|
-
/**
|
|
72
|
-
* Getter for the type attribute.
|
|
73
|
-
* @returns {string} The type of the input.
|
|
74
|
-
*/
|
|
75
|
-
get type(): string;
|
|
76
|
-
/**
|
|
77
|
-
* Getter for the validity attribute.
|
|
78
|
-
* @returns {ValidityState} The validity state of the input.
|
|
79
|
-
*/
|
|
80
|
-
get validity(): ValidityState;
|
|
81
|
-
/**
|
|
82
|
-
* Getter for the validationMessage attribute.
|
|
83
|
-
* @returns {string} The validation message of the input.
|
|
84
|
-
*/
|
|
85
|
-
get validationMessage(): string;
|
|
86
|
-
/**
|
|
87
|
-
* Getter for the willValidate attribute.
|
|
88
|
-
* @returns {boolean} Whether the input will be validated.
|
|
89
|
-
*/
|
|
90
|
-
get willValidate(): boolean;
|
|
91
46
|
/**
|
|
92
47
|
* Setter for the defaultValue attribute.
|
|
93
48
|
* This method sets the 'value' attribute of the custom input element to the provided value.
|
|
@@ -104,15 +59,22 @@ export default class Checkbox extends WJElement {
|
|
|
104
59
|
*/
|
|
105
60
|
get defaultValue(): string;
|
|
106
61
|
/**
|
|
107
|
-
*
|
|
108
|
-
*
|
|
62
|
+
* Sets or removes the 'indeterminate' attribute for the object.
|
|
63
|
+
* This property typically reflects the visual or functional state where
|
|
64
|
+
* the component is neither fully active nor inactive.
|
|
65
|
+
* @param {boolean} value A boolean where `true` indicates the 'indeterminate'
|
|
66
|
+
* state should be set, and `false` removes it.
|
|
109
67
|
*/
|
|
110
|
-
set
|
|
68
|
+
set indeterminate(value: boolean);
|
|
111
69
|
/**
|
|
112
|
-
*
|
|
113
|
-
*
|
|
70
|
+
* Retrieves the current state of the 'indeterminate' attribute.
|
|
71
|
+
*
|
|
72
|
+
* The 'indeterminate' attribute is typically used to signify a state
|
|
73
|
+
* where a checkbox is neither checked nor unchecked, such as a partially
|
|
74
|
+
* selected state.
|
|
75
|
+
* @returns {boolean} Returns true if the 'indeterminate' attribute is present; otherwise, false.
|
|
114
76
|
*/
|
|
115
|
-
get
|
|
77
|
+
get indeterminate(): boolean;
|
|
116
78
|
/**
|
|
117
79
|
* Set checked attribute.
|
|
118
80
|
* @param {boolean} value true if the toggle is checked, false otherwise
|
|
@@ -133,40 +95,5 @@ export default class Checkbox extends WJElement {
|
|
|
133
95
|
* Adds an event listener after drawing the checkbox.
|
|
134
96
|
*/
|
|
135
97
|
afterDraw(): void;
|
|
136
|
-
/**
|
|
137
|
-
* @summary Callback function that is called when the custom element is associated with a form.
|
|
138
|
-
* This function adds an event listener to the form's submit event, which validates the input and propagates the validation.
|
|
139
|
-
* @param {HTMLFormElement} form The form the custom element is associated with.
|
|
140
|
-
*/
|
|
141
|
-
formAssociatedCallback(form: HTMLFormElement): void;
|
|
142
|
-
/**
|
|
143
|
-
* The formResetCallback method is a built-in lifecycle callback that gets called when a form gets reset.
|
|
144
|
-
* This method is responsible for resetting the value of the custom input element to its default value.
|
|
145
|
-
* It also resets the form value and validity state in the form internals.
|
|
146
|
-
* @function
|
|
147
|
-
*/
|
|
148
|
-
formResetCallback(): void;
|
|
149
|
-
/**
|
|
150
|
-
* The formStateRestoreCallback method is a built-in lifecycle callback that gets called when the state of a form-associated custom element is restored.
|
|
151
|
-
* This method is responsible for restoring the value of the custom input element to its saved state.
|
|
152
|
-
* It also restores the form value and validity state in the form internals to their saved states.
|
|
153
|
-
* @param {object} state The saved state of the custom input element.
|
|
154
|
-
* @function
|
|
155
|
-
*/
|
|
156
|
-
formStateRestoreCallback(state: object): void;
|
|
157
|
-
/**
|
|
158
|
-
* The formStateSaveCallback method is a built-in lifecycle callback that gets called when the state of a form-associated custom element is saved.
|
|
159
|
-
* This method is responsible for saving the value of the custom input element.
|
|
160
|
-
* @returns {object} The saved state of the custom input element.
|
|
161
|
-
* @function
|
|
162
|
-
*/
|
|
163
|
-
formStateSaveCallback(): object;
|
|
164
|
-
/**
|
|
165
|
-
* The formDisabledCallback method is a built-in lifecycle callback that gets called when the disabled state of a form-associated custom element changes.
|
|
166
|
-
* This method is not implemented yet.
|
|
167
|
-
* @param {boolean} disabled The new disabled state of the custom input element.
|
|
168
|
-
* @function
|
|
169
|
-
*/
|
|
170
|
-
formDisabledCallback(disabled: boolean): void;
|
|
171
98
|
#private;
|
|
172
99
|
}
|
|
@@ -29,6 +29,7 @@ export default class InfiniteScroll extends WJElement {
|
|
|
29
29
|
totalPages: number;
|
|
30
30
|
isLoading: any[];
|
|
31
31
|
iterate: Element;
|
|
32
|
+
placementObj: this;
|
|
32
33
|
/**
|
|
33
34
|
* Dependencies of the InfiniteScroll component.
|
|
34
35
|
* @param value
|
|
@@ -138,7 +139,6 @@ export default class InfiniteScroll extends WJElement {
|
|
|
138
139
|
*/
|
|
139
140
|
loadPages(page: number): Promise<void>;
|
|
140
141
|
parser: DOMParser;
|
|
141
|
-
placementObj: any;
|
|
142
142
|
compareFunction: (i: any, item: any) => boolean;
|
|
143
143
|
/**
|
|
144
144
|
* Converts a data item into an HTML element based on a template.
|