@aurodesignsystem/auro-formkit 1.6.0-beta.10 → 1.6.0-beta.12
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/.turbo/cache/013a48308b893dac-meta.json +1 -1
- package/.turbo/cache/0593477832b1052b-meta.json +1 -0
- package/.turbo/cache/0593477832b1052b.tar.zst +0 -0
- package/.turbo/cache/07ca42419b9f050c-meta.json +1 -1
- package/.turbo/cache/0a2b0a4df8a0443f-meta.json +1 -0
- package/.turbo/cache/0a2b0a4df8a0443f.tar.zst +0 -0
- package/.turbo/cache/0cea4c1f34f3683b-meta.json +1 -1
- package/.turbo/cache/141bb7d9a95e288b-meta.json +1 -0
- package/.turbo/cache/141bb7d9a95e288b.tar.zst +0 -0
- package/.turbo/cache/15b611d69353176d-meta.json +1 -0
- package/.turbo/cache/17259cf94d8f8925-meta.json +1 -1
- package/.turbo/cache/1c99a949ec63ab35-meta.json +1 -1
- package/.turbo/cache/1de15d89eed2d760-meta.json +1 -0
- package/.turbo/cache/1de15d89eed2d760.tar.zst +0 -0
- package/.turbo/cache/257a7a26ea72dbc5-meta.json +1 -1
- package/.turbo/cache/28b3bf750d6c5738-meta.json +1 -0
- package/.turbo/cache/28b3bf750d6c5738.tar.zst +0 -0
- package/.turbo/cache/32c0b9995fb5f8dd-meta.json +1 -0
- package/.turbo/cache/32c0b9995fb5f8dd.tar.zst +0 -0
- package/.turbo/cache/3bf45120d0cc9bd8-meta.json +1 -1
- package/.turbo/cache/45035bf5c4147ccd-meta.json +1 -1
- package/.turbo/cache/4ceca20b1e98dbd7-meta.json +1 -0
- package/.turbo/cache/4ceca20b1e98dbd7.tar.zst +0 -0
- package/.turbo/cache/4e8c9ab436c836bc-meta.json +1 -0
- package/.turbo/cache/4e8c9ab436c836bc.tar.zst +0 -0
- package/.turbo/cache/4f92cea2d8c63de2-meta.json +1 -0
- package/.turbo/cache/4f92cea2d8c63de2.tar.zst +0 -0
- package/.turbo/cache/5bfa30d06f8727c7-meta.json +1 -0
- package/.turbo/cache/5bfa30d06f8727c7.tar.zst +0 -0
- package/.turbo/cache/5c16ce3cff5c9dff-meta.json +1 -1
- package/.turbo/cache/5f304c0f37ef25f3-meta.json +1 -1
- package/.turbo/cache/626afdc67e0cb540-meta.json +1 -0
- package/.turbo/cache/626afdc67e0cb540.tar.zst +0 -0
- package/.turbo/cache/64de7a53e02db647-meta.json +1 -1
- package/.turbo/cache/691a74627ec57993-meta.json +1 -1
- package/.turbo/cache/69aae513b7ec6c7d-meta.json +1 -1
- package/.turbo/cache/69f7eb632e38f934-meta.json +1 -0
- package/.turbo/cache/69f7eb632e38f934.tar.zst +0 -0
- package/.turbo/cache/6dd7058e6703cb35-meta.json +1 -1
- package/.turbo/cache/73e9073a5274616d-meta.json +1 -1
- package/.turbo/cache/773edc0f83c8c5a5-meta.json +1 -1
- package/.turbo/cache/786a822763403879-meta.json +1 -1
- package/.turbo/cache/7f01d2fe1c245278-meta.json +1 -0
- package/.turbo/cache/80b5d974184a01df-meta.json +1 -1
- package/.turbo/cache/8954c6073396fadd-meta.json +1 -1
- package/.turbo/cache/8ca4e3f31520b797-meta.json +1 -0
- package/.turbo/cache/8ca4e3f31520b797.tar.zst +0 -0
- package/.turbo/cache/92daa6d7c389d548-meta.json +1 -1
- package/.turbo/cache/9a097d6576dadd64-meta.json +1 -1
- package/.turbo/cache/a6a56bb802e1c20f-meta.json +1 -0
- package/.turbo/cache/a6a56bb802e1c20f.tar.zst +0 -0
- package/.turbo/cache/a77bc920ea508bb8-meta.json +1 -1
- package/.turbo/cache/a77bc920ea508bb8.tar.zst +0 -0
- package/.turbo/cache/b54fc4f664a7a5a0-meta.json +1 -1
- package/.turbo/cache/b8b1814a990c06f8-meta.json +1 -0
- package/.turbo/cache/b8b1814a990c06f8.tar.zst +0 -0
- package/.turbo/cache/ba4418918621fbcd-meta.json +1 -1
- package/.turbo/cache/bb8b41cd0ade3986-meta.json +1 -0
- package/.turbo/cache/bb8b41cd0ade3986.tar.zst +0 -0
- package/.turbo/cache/bb8ec1d0fe0a761f-meta.json +1 -0
- package/.turbo/cache/bb8ec1d0fe0a761f.tar.zst +0 -0
- package/.turbo/cache/be7c23c37b8ec74b-meta.json +1 -1
- package/.turbo/cache/be7c23c37b8ec74b.tar.zst +0 -0
- package/.turbo/cache/bf85bc040b7e64db-meta.json +1 -0
- package/.turbo/cache/bf85bc040b7e64db.tar.zst +0 -0
- package/.turbo/cache/caa0b4ac8d2a04dd-meta.json +1 -1
- package/.turbo/cache/caa0b4ac8d2a04dd.tar.zst +0 -0
- package/.turbo/cache/cc81de9c0b452a7c-meta.json +1 -1
- package/.turbo/cache/cd845bb6102c589a-meta.json +1 -0
- package/.turbo/cache/cd845bb6102c589a.tar.zst +0 -0
- package/.turbo/cache/d65801fd9a8c1a75-meta.json +1 -0
- package/.turbo/cache/d65801fd9a8c1a75.tar.zst +0 -0
- package/.turbo/cache/d7a47b77deb3d9a4-meta.json +1 -0
- package/.turbo/cache/d7a47b77deb3d9a4.tar.zst +0 -0
- package/.turbo/cache/dad1301ac69bcb85-meta.json +1 -1
- package/.turbo/cache/e44f36589cdc0bbc-meta.json +1 -0
- package/.turbo/cache/e44f36589cdc0bbc.tar.zst +0 -0
- package/.turbo/cache/e992dab20aeefbaf-meta.json +1 -1
- package/.turbo/cache/e992dab20aeefbaf.tar.zst +0 -0
- package/.turbo/cache/f5db6f7110f4ae32-meta.json +1 -0
- package/.turbo/cache/f5db6f7110f4ae32.tar.zst +0 -0
- package/.turbo/cache/fa132b5b5f0e75f8-meta.json +1 -1
- package/.turbo/cache/fa6b53275a3b4dc5-meta.json +1 -0
- package/.turbo/cache/fa6b53275a3b4dc5.tar.zst +0 -0
- package/.turbo/cache/fbbe2704bf9cb90b-meta.json +1 -1
- package/.turbo/cache/ff58f630c9d69af4-meta.json +1 -0
- package/.turbo/cache/ff58f630c9d69af4.tar.zst +0 -0
- package/CHANGELOG.md +39 -0
- package/components/checkbox/.turbo/turbo-build.log +6 -3
- package/components/checkbox/.turbo/turbo-bundler.log +3 -3
- package/components/checkbox/demo/api.html +6 -1
- package/components/checkbox/demo/api.js +16 -0
- package/components/checkbox/demo/api.md +63 -4
- package/components/checkbox/demo/api.min.js +84 -13
- package/components/checkbox/demo/index.min.js +59 -13
- package/components/checkbox/dist/auro-checkbox-group.d.ts +6 -1
- package/components/checkbox/dist/auro-checkbox-group.d.ts.map +1 -1
- package/components/checkbox/dist/auro-checkbox.d.ts +5 -0
- package/components/checkbox/dist/auro-checkbox.d.ts.map +1 -1
- package/components/checkbox/dist/index.js +59 -13
- package/components/checkbox/src/auro-checkbox-group.js +18 -6
- package/components/checkbox/src/auro-checkbox.js +9 -0
- package/components/combobox/.turbo/turbo-build.log +6 -3
- package/components/combobox/demo/api.js +4 -2
- package/components/combobox/demo/api.md +60 -1
- package/components/combobox/demo/api.min.js +101 -31
- package/components/combobox/demo/index.min.js +92 -31
- package/components/combobox/dist/auro-combobox.d.ts +5 -1
- package/components/combobox/dist/auro-combobox.d.ts.map +1 -1
- package/components/combobox/dist/index.js +91 -29
- package/components/combobox/src/auro-combobox.js +14 -3
- package/components/counter/.turbo/turbo-build.log +3 -3
- package/components/counter/.turbo/turbo-bundler.log +3 -3
- package/components/datepicker/.turbo/turbo-build.log +6 -3
- package/components/datepicker/demo/api.js +2 -0
- package/components/datepicker/demo/api.md +46 -1
- package/components/datepicker/demo/api.min.js +100 -30
- package/components/datepicker/demo/index.min.js +91 -30
- package/components/datepicker/dist/auro-datepicker.d.ts +5 -2
- package/components/datepicker/dist/auro-datepicker.d.ts.map +1 -1
- package/components/datepicker/dist/index.js +91 -30
- package/components/datepicker/src/auro-datepicker.js +14 -4
- package/components/dropdown/.turbo/turbo-build.log +3 -3
- package/components/dropdown/.turbo/turbo-bundler.log +3 -3
- package/components/dropdown/demo/api.min.js +1 -1
- package/components/dropdown/demo/index.min.js +1 -1
- package/components/dropdown/dist/index.js +1 -1
- package/components/dropdown/src/styles/bibStyles-css.js +1 -1
- package/components/dropdown/src/styles/bibStyles.css +0 -5
- package/components/dropdown/src/styles/bibStyles.scss +0 -7
- package/components/form/.turbo/turbo-build.log +3 -3
- package/components/form/.turbo/turbo-bundler.log +3 -3
- package/components/input/.turbo/turbo-build$colon$sass.log +2 -2
- package/components/input/.turbo/turbo-build.log +16 -13
- package/components/input/.turbo/turbo-bundler.log +3 -3
- package/components/input/demo/api.js +2 -0
- package/components/input/demo/api.md +148 -98
- package/components/input/demo/api.min.js +56 -21
- package/components/input/demo/index.min.js +44 -18
- package/components/input/dist/base-input.d.ts +7 -8
- package/components/input/dist/base-input.d.ts.map +1 -1
- package/components/input/dist/index.js +44 -18
- package/components/input/src/base-input.js +11 -10
- package/components/input/src/styles/input-css.js +1 -1
- package/components/input/src/styles/input.css +13 -0
- package/components/input/src/styles/input.scss +21 -0
- package/components/input/src/styles/label-css.js +1 -1
- package/components/input/src/styles/label.css +3 -3
- package/components/input/src/styles/label.scss +1 -2
- package/components/input/src/styles/notificationIcons-css.js +1 -1
- package/components/input/src/styles/notificationIcons.css +7 -0
- package/components/input/src/styles/notificationIcons.scss +14 -0
- package/components/input/src/styles/style-css.js +1 -1
- package/components/input/src/styles/style.css +23 -3
- package/components/menu/.turbo/turbo-build.log +3 -3
- package/components/menu/.turbo/turbo-bundler.log +3 -3
- package/components/menu/demo/api.min.js +1 -2
- package/components/menu/demo/index.min.js +1 -2
- package/components/menu/dist/auro-menuoption.d.ts +0 -1
- package/components/menu/dist/auro-menuoption.d.ts.map +1 -1
- package/components/menu/dist/index.js +1 -2
- package/components/menu/src/auro-menuoption.js +1 -2
- package/components/radio/.turbo/turbo-build.log +6 -3
- package/components/radio/.turbo/turbo-bundler.log +3 -3
- package/components/radio/demo/api.html +1 -0
- package/components/radio/demo/api.js +2 -0
- package/components/radio/demo/api.md +57 -3
- package/components/radio/demo/api.min.js +55 -12
- package/components/radio/demo/index.min.js +46 -12
- package/components/radio/dist/auro-radio-group.d.ts +1 -1
- package/components/radio/dist/auro-radio.d.ts +5 -0
- package/components/radio/dist/auro-radio.d.ts.map +1 -1
- package/components/radio/dist/index.js +46 -12
- package/components/radio/src/auro-radio-group.js +5 -5
- package/components/radio/src/auro-radio.js +9 -0
- package/components/select/.turbo/turbo-build.log +7 -4
- package/components/select/demo/api.js +4 -2
- package/components/select/demo/api.md +81 -17
- package/components/select/demo/api.min.js +52 -12
- package/components/select/demo/index.min.js +43 -12
- package/components/select/dist/auro-select.d.ts +5 -1
- package/components/select/dist/auro-select.d.ts.map +1 -1
- package/components/select/dist/index.js +42 -10
- package/components/select/src/auro-select.js +9 -2
- package/package.json +1 -1
- package/packages/form-validation/src/validation.js +32 -7
- package/.turbo/cache/049b9083252d38be-meta.json +0 -1
- package/.turbo/cache/049b9083252d38be.tar.zst +0 -0
- package/.turbo/cache/0a1dd4481355cb0b-meta.json +0 -1
- package/.turbo/cache/0a1dd4481355cb0b.tar.zst +0 -0
- package/.turbo/cache/13cf37c850bd8cf4-meta.json +0 -1
- package/.turbo/cache/3323eb841acb9c4e-meta.json +0 -1
- package/.turbo/cache/3323eb841acb9c4e.tar.zst +0 -0
- package/.turbo/cache/34ba23e2e2d652ad-meta.json +0 -1
- package/.turbo/cache/34ba23e2e2d652ad.tar.zst +0 -0
- package/.turbo/cache/368cd6fed7975ad2-meta.json +0 -1
- package/.turbo/cache/368cd6fed7975ad2.tar.zst +0 -0
- package/.turbo/cache/3924bce8e51f0ffa-meta.json +0 -1
- package/.turbo/cache/3924bce8e51f0ffa.tar.zst +0 -0
- package/.turbo/cache/4567487084a055b7-meta.json +0 -1
- package/.turbo/cache/4567487084a055b7.tar.zst +0 -0
- package/.turbo/cache/4763278a7d3dbc16-meta.json +0 -1
- package/.turbo/cache/4763278a7d3dbc16.tar.zst +0 -0
- package/.turbo/cache/549e6ef9f9ffd9a8-meta.json +0 -1
- package/.turbo/cache/549e6ef9f9ffd9a8.tar.zst +0 -0
- package/.turbo/cache/59ccd8430174883c-meta.json +0 -1
- package/.turbo/cache/59ccd8430174883c.tar.zst +0 -0
- package/.turbo/cache/683d4c0e20c077a9-meta.json +0 -1
- package/.turbo/cache/683d4c0e20c077a9.tar.zst +0 -0
- package/.turbo/cache/8f8ffe35cc79d1a9-meta.json +0 -1
- package/.turbo/cache/8f8ffe35cc79d1a9.tar.zst +0 -0
- package/.turbo/cache/926d632729ca6536-meta.json +0 -1
- package/.turbo/cache/926d632729ca6536.tar.zst +0 -0
- package/.turbo/cache/9e7be41cc3a7ef43-meta.json +0 -1
- package/.turbo/cache/9e7be41cc3a7ef43.tar.zst +0 -0
- package/.turbo/cache/9ee793063ea89126-meta.json +0 -1
- package/.turbo/cache/9ee793063ea89126.tar.zst +0 -0
- package/.turbo/cache/a1558cef51c034da-meta.json +0 -1
- package/.turbo/cache/a1558cef51c034da.tar.zst +0 -0
- package/.turbo/cache/a24f2ff8e94e56e8-meta.json +0 -1
- package/.turbo/cache/a24f2ff8e94e56e8.tar.zst +0 -0
- package/.turbo/cache/a2705cf095a2ceb0-meta.json +0 -1
- package/.turbo/cache/a2705cf095a2ceb0.tar.zst +0 -0
- package/.turbo/cache/a33c0749886a41b5-meta.json +0 -1
- package/.turbo/cache/a33c0749886a41b5.tar.zst +0 -0
- package/.turbo/cache/a66b465385a30a2b-meta.json +0 -1
- package/.turbo/cache/a66b465385a30a2b.tar.zst +0 -0
- package/.turbo/cache/c1b72a92dec4fe37-meta.json +0 -1
- package/.turbo/cache/e25ac25a8a0ad126-meta.json +0 -1
- package/.turbo/cache/e25ac25a8a0ad126.tar.zst +0 -0
- package/.turbo/cache/e671573e4ef02c47-meta.json +0 -1
- package/.turbo/cache/e671573e4ef02c47.tar.zst +0 -0
- package/.turbo/cache/e86cee22dff5e281-meta.json +0 -1
- package/.turbo/cache/e86cee22dff5e281.tar.zst +0 -0
- package/.turbo/cache/f680556a8e954eac-meta.json +0 -1
- package/.turbo/cache/f680556a8e954eac.tar.zst +0 -0
- package/.turbo/cache/ffec4500b911b85a-meta.json +0 -1
- package/.turbo/cache/ffec4500b911b85a.tar.zst +0 -0
- /package/.turbo/cache/{c1b72a92dec4fe37.tar.zst → 15b611d69353176d.tar.zst} +0 -0
- /package/.turbo/cache/{13cf37c850bd8cf4.tar.zst → 7f01d2fe1c245278.tar.zst} +0 -0
|
@@ -15,6 +15,14 @@ function dynamicExample() {
|
|
|
15
15
|
}
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
+
function resetStateExample() {
|
|
19
|
+
const elem = document.querySelector('#resetStateExample');
|
|
20
|
+
|
|
21
|
+
document.querySelector('#resetStateBtn').addEventListener('click', () => {
|
|
22
|
+
elem.reset();
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
|
|
18
26
|
/**
|
|
19
27
|
* @license
|
|
20
28
|
* Copyright 2019 Google LLC
|
|
@@ -276,6 +284,15 @@ class AuroRadio extends r {
|
|
|
276
284
|
}));
|
|
277
285
|
}
|
|
278
286
|
|
|
287
|
+
/**
|
|
288
|
+
* Resets component to initial state.
|
|
289
|
+
* @returns {void}
|
|
290
|
+
*/
|
|
291
|
+
reset() {
|
|
292
|
+
this.checked = false;
|
|
293
|
+
this.error = false;
|
|
294
|
+
}
|
|
295
|
+
|
|
279
296
|
updated(changedProperties) {
|
|
280
297
|
if (changedProperties.has('checked')) {
|
|
281
298
|
this.dispatchEvent(new CustomEvent('resetRadio', {
|
|
@@ -384,6 +401,30 @@ class AuroFormValidation {
|
|
|
384
401
|
this.runtimeUtils = new AuroLibraryRuntimeUtils();
|
|
385
402
|
}
|
|
386
403
|
|
|
404
|
+
/**
|
|
405
|
+
* Resets the element to its initial state.
|
|
406
|
+
* @private
|
|
407
|
+
* @param {object} elem - HTML element to reset.
|
|
408
|
+
* @returns {void}
|
|
409
|
+
*/
|
|
410
|
+
reset(elem) {
|
|
411
|
+
elem.validity = undefined;
|
|
412
|
+
elem.value = undefined;
|
|
413
|
+
|
|
414
|
+
// Resets the second value of the datepicker in range state
|
|
415
|
+
if (elem.valueEnd) {
|
|
416
|
+
elem.valueEnd = undefined;
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
// Resets selected option of element
|
|
420
|
+
if (elem.optionSelected) {
|
|
421
|
+
elem.optionSelected = undefined;
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
// Runs validation to handle error attribute
|
|
425
|
+
this.validate(elem);
|
|
426
|
+
}
|
|
427
|
+
|
|
387
428
|
/**
|
|
388
429
|
* Determines the validity state of the element based on the common attribute restrictions (pattern).
|
|
389
430
|
* @private
|
|
@@ -398,10 +439,15 @@ class AuroFormValidation {
|
|
|
398
439
|
elem.validity = 'badInput';
|
|
399
440
|
elem.setCustomValidity = elem.setCustomValidityBadInput || '';
|
|
400
441
|
}
|
|
401
|
-
}
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
// Length > 0 is required to prevent the error message from showing when the input is empty
|
|
445
|
+
if (elem.value?.length > 0 && elem.value?.length < elem.minLength) {
|
|
402
446
|
elem.validity = 'tooShort';
|
|
403
447
|
elem.setCustomValidity = elem.setCustomValidityTooShort || '';
|
|
404
|
-
}
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
if (elem.value?.length > elem.maxLength) {
|
|
405
451
|
elem.validity = 'tooLong';
|
|
406
452
|
elem.setCustomValidity = elem.setCustomValidityTooLong || '';
|
|
407
453
|
}
|
|
@@ -427,7 +473,7 @@ class AuroFormValidation {
|
|
|
427
473
|
elem.validity = 'tooShort';
|
|
428
474
|
elem.setCustomValidity = elem.setCustomValidityForType || '';
|
|
429
475
|
}
|
|
430
|
-
} else if (elem.type === 'number'
|
|
476
|
+
} else if (elem.type === 'number') {
|
|
431
477
|
if (elem.max !== undefined && Number(elem.max) < Number(elem.value)) {
|
|
432
478
|
elem.validity = 'rangeOverflow';
|
|
433
479
|
elem.setCustomValidity = elem.getAttribute('setCustomValidityRangeOverflow') || '';
|
|
@@ -532,14 +578,10 @@ class AuroFormValidation {
|
|
|
532
578
|
|
|
533
579
|
if (validationShouldRun || elem.hasAttribute('error')) {
|
|
534
580
|
if (elem.validity && elem.validity !== 'valid') {
|
|
535
|
-
elem.isValid = false;
|
|
536
|
-
|
|
537
581
|
// Use the validity message override if it is declared
|
|
538
582
|
if (elem.ValidityMessageOverride) {
|
|
539
583
|
elem.setCustomValidity = elem.ValidityMessageOverride;
|
|
540
584
|
}
|
|
541
|
-
} else {
|
|
542
|
-
elem.isValid = true;
|
|
543
585
|
}
|
|
544
586
|
|
|
545
587
|
this.getErrorMessage(elem);
|
|
@@ -812,20 +854,20 @@ class AuroRadioGroup extends r {
|
|
|
812
854
|
}
|
|
813
855
|
|
|
814
856
|
/**
|
|
815
|
-
*
|
|
857
|
+
* Resets component to initial state.
|
|
816
858
|
* @returns {void}
|
|
817
859
|
*/
|
|
818
860
|
reset() {
|
|
819
|
-
|
|
861
|
+
// Sets first radio button to receive focus during keyboard navigation
|
|
820
862
|
this.index = 0;
|
|
821
|
-
|
|
863
|
+
|
|
822
864
|
const buttons = this.querySelectorAll('auro-radio, [auro-radio]');
|
|
823
865
|
|
|
824
866
|
buttons.forEach((button) => {
|
|
825
|
-
button.
|
|
867
|
+
button.reset();
|
|
826
868
|
});
|
|
827
869
|
|
|
828
|
-
this.validation.
|
|
870
|
+
this.validation.reset(this);
|
|
829
871
|
}
|
|
830
872
|
|
|
831
873
|
/**
|
|
@@ -1037,6 +1079,7 @@ function initExamples(initCount) {
|
|
|
1037
1079
|
|
|
1038
1080
|
try {
|
|
1039
1081
|
dynamicExample();
|
|
1082
|
+
resetStateExample();
|
|
1040
1083
|
} catch (error) {
|
|
1041
1084
|
if (initCount <= 20) {
|
|
1042
1085
|
// setTimeout handles issue where content is sometimes loaded after the functions get called
|
|
@@ -259,6 +259,15 @@ class AuroRadio extends r {
|
|
|
259
259
|
}));
|
|
260
260
|
}
|
|
261
261
|
|
|
262
|
+
/**
|
|
263
|
+
* Resets component to initial state.
|
|
264
|
+
* @returns {void}
|
|
265
|
+
*/
|
|
266
|
+
reset() {
|
|
267
|
+
this.checked = false;
|
|
268
|
+
this.error = false;
|
|
269
|
+
}
|
|
270
|
+
|
|
262
271
|
updated(changedProperties) {
|
|
263
272
|
if (changedProperties.has('checked')) {
|
|
264
273
|
this.dispatchEvent(new CustomEvent('resetRadio', {
|
|
@@ -367,6 +376,30 @@ class AuroFormValidation {
|
|
|
367
376
|
this.runtimeUtils = new AuroLibraryRuntimeUtils();
|
|
368
377
|
}
|
|
369
378
|
|
|
379
|
+
/**
|
|
380
|
+
* Resets the element to its initial state.
|
|
381
|
+
* @private
|
|
382
|
+
* @param {object} elem - HTML element to reset.
|
|
383
|
+
* @returns {void}
|
|
384
|
+
*/
|
|
385
|
+
reset(elem) {
|
|
386
|
+
elem.validity = undefined;
|
|
387
|
+
elem.value = undefined;
|
|
388
|
+
|
|
389
|
+
// Resets the second value of the datepicker in range state
|
|
390
|
+
if (elem.valueEnd) {
|
|
391
|
+
elem.valueEnd = undefined;
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
// Resets selected option of element
|
|
395
|
+
if (elem.optionSelected) {
|
|
396
|
+
elem.optionSelected = undefined;
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
// Runs validation to handle error attribute
|
|
400
|
+
this.validate(elem);
|
|
401
|
+
}
|
|
402
|
+
|
|
370
403
|
/**
|
|
371
404
|
* Determines the validity state of the element based on the common attribute restrictions (pattern).
|
|
372
405
|
* @private
|
|
@@ -381,10 +414,15 @@ class AuroFormValidation {
|
|
|
381
414
|
elem.validity = 'badInput';
|
|
382
415
|
elem.setCustomValidity = elem.setCustomValidityBadInput || '';
|
|
383
416
|
}
|
|
384
|
-
}
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
// Length > 0 is required to prevent the error message from showing when the input is empty
|
|
420
|
+
if (elem.value?.length > 0 && elem.value?.length < elem.minLength) {
|
|
385
421
|
elem.validity = 'tooShort';
|
|
386
422
|
elem.setCustomValidity = elem.setCustomValidityTooShort || '';
|
|
387
|
-
}
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
if (elem.value?.length > elem.maxLength) {
|
|
388
426
|
elem.validity = 'tooLong';
|
|
389
427
|
elem.setCustomValidity = elem.setCustomValidityTooLong || '';
|
|
390
428
|
}
|
|
@@ -410,7 +448,7 @@ class AuroFormValidation {
|
|
|
410
448
|
elem.validity = 'tooShort';
|
|
411
449
|
elem.setCustomValidity = elem.setCustomValidityForType || '';
|
|
412
450
|
}
|
|
413
|
-
} else if (elem.type === 'number'
|
|
451
|
+
} else if (elem.type === 'number') {
|
|
414
452
|
if (elem.max !== undefined && Number(elem.max) < Number(elem.value)) {
|
|
415
453
|
elem.validity = 'rangeOverflow';
|
|
416
454
|
elem.setCustomValidity = elem.getAttribute('setCustomValidityRangeOverflow') || '';
|
|
@@ -515,14 +553,10 @@ class AuroFormValidation {
|
|
|
515
553
|
|
|
516
554
|
if (validationShouldRun || elem.hasAttribute('error')) {
|
|
517
555
|
if (elem.validity && elem.validity !== 'valid') {
|
|
518
|
-
elem.isValid = false;
|
|
519
|
-
|
|
520
556
|
// Use the validity message override if it is declared
|
|
521
557
|
if (elem.ValidityMessageOverride) {
|
|
522
558
|
elem.setCustomValidity = elem.ValidityMessageOverride;
|
|
523
559
|
}
|
|
524
|
-
} else {
|
|
525
|
-
elem.isValid = true;
|
|
526
560
|
}
|
|
527
561
|
|
|
528
562
|
this.getErrorMessage(elem);
|
|
@@ -795,20 +829,20 @@ class AuroRadioGroup extends r {
|
|
|
795
829
|
}
|
|
796
830
|
|
|
797
831
|
/**
|
|
798
|
-
*
|
|
832
|
+
* Resets component to initial state.
|
|
799
833
|
* @returns {void}
|
|
800
834
|
*/
|
|
801
835
|
reset() {
|
|
802
|
-
|
|
836
|
+
// Sets first radio button to receive focus during keyboard navigation
|
|
803
837
|
this.index = 0;
|
|
804
|
-
|
|
838
|
+
|
|
805
839
|
const buttons = this.querySelectorAll('auro-radio, [auro-radio]');
|
|
806
840
|
|
|
807
841
|
buttons.forEach((button) => {
|
|
808
|
-
button.
|
|
842
|
+
button.reset();
|
|
809
843
|
});
|
|
810
844
|
|
|
811
|
-
this.validation.
|
|
845
|
+
this.validation.reset(this);
|
|
812
846
|
}
|
|
813
847
|
|
|
814
848
|
/**
|
|
@@ -107,7 +107,7 @@ export class AuroRadioGroup extends LitElement {
|
|
|
107
107
|
*/
|
|
108
108
|
updated(changedProperties: Map<string, any>): void;
|
|
109
109
|
/**
|
|
110
|
-
*
|
|
110
|
+
* Resets component to initial state.
|
|
111
111
|
* @returns {void}
|
|
112
112
|
*/
|
|
113
113
|
reset(): void;
|
|
@@ -90,6 +90,11 @@ export class AuroRadio extends LitElement {
|
|
|
90
90
|
* @returns {void}
|
|
91
91
|
*/
|
|
92
92
|
private handleBlur;
|
|
93
|
+
/**
|
|
94
|
+
* Resets component to initial state.
|
|
95
|
+
* @returns {void}
|
|
96
|
+
*/
|
|
97
|
+
reset(): void;
|
|
93
98
|
updated(changedProperties: any): void;
|
|
94
99
|
/**
|
|
95
100
|
* Method for handling content when it is invalid accessibility wise.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auro-radio.d.ts","sourceRoot":"","sources":["../src/auro-radio.js"],"names":[],"mappings":"AAmBA;;;;;;;;;;GAUG;AAGH;IAeE,+CAMC;IAGD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MA2BC;IAED;;;;;;;OAOG;IACH,uBANW,MAAM,QAQhB;IA5DC,iBAAoB;IACpB,kBAAqB;IACrB,kBAAqB;IACrB,eAAkB;IAGlB;;OAEG;IACH,qBAAiD;IAqDnD;;;;;OAKG;IACH,qBAKC;IAED;;;;;OAKG;IACH,oBAOC;IAED;;;;;OAKG;IACH,oBAMC;IAED;;;;;OAKG;IACH,mBAMC;IAED,sCAcC;IAED;;;;;OAKG;IACH,gBAMC;IAED;;;;;OAKG;IACH,mBAMC;IAED,qBAWC;IALC,wBAAmD;IAQrD,+CAkCC;CACF;
|
|
1
|
+
{"version":3,"file":"auro-radio.d.ts","sourceRoot":"","sources":["../src/auro-radio.js"],"names":[],"mappings":"AAmBA;;;;;;;;;;GAUG;AAGH;IAeE,+CAMC;IAGD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MA2BC;IAED;;;;;;;OAOG;IACH,uBANW,MAAM,QAQhB;IA5DC,iBAAoB;IACpB,kBAAqB;IACrB,kBAAqB;IACrB,eAAkB;IAGlB;;OAEG;IACH,qBAAiD;IAqDnD;;;;;OAKG;IACH,qBAKC;IAED;;;;;OAKG;IACH,oBAOC;IAED;;;;;OAKG;IACH,oBAMC;IAED;;;;;OAKG;IACH,mBAMC;IAED;;;OAGG;IACH,SAFa,IAAI,CAKhB;IAED,sCAcC;IAED;;;;;OAKG;IACH,gBAMC;IAED;;;;;OAKG;IACH,mBAMC;IAED,qBAWC;IALC,wBAAmD;IAQrD,+CAkCC;CACF;2BA1PgC,KAAK"}
|
|
@@ -259,6 +259,15 @@ class AuroRadio extends r {
|
|
|
259
259
|
}));
|
|
260
260
|
}
|
|
261
261
|
|
|
262
|
+
/**
|
|
263
|
+
* Resets component to initial state.
|
|
264
|
+
* @returns {void}
|
|
265
|
+
*/
|
|
266
|
+
reset() {
|
|
267
|
+
this.checked = false;
|
|
268
|
+
this.error = false;
|
|
269
|
+
}
|
|
270
|
+
|
|
262
271
|
updated(changedProperties) {
|
|
263
272
|
if (changedProperties.has('checked')) {
|
|
264
273
|
this.dispatchEvent(new CustomEvent('resetRadio', {
|
|
@@ -367,6 +376,30 @@ class AuroFormValidation {
|
|
|
367
376
|
this.runtimeUtils = new AuroLibraryRuntimeUtils();
|
|
368
377
|
}
|
|
369
378
|
|
|
379
|
+
/**
|
|
380
|
+
* Resets the element to its initial state.
|
|
381
|
+
* @private
|
|
382
|
+
* @param {object} elem - HTML element to reset.
|
|
383
|
+
* @returns {void}
|
|
384
|
+
*/
|
|
385
|
+
reset(elem) {
|
|
386
|
+
elem.validity = undefined;
|
|
387
|
+
elem.value = undefined;
|
|
388
|
+
|
|
389
|
+
// Resets the second value of the datepicker in range state
|
|
390
|
+
if (elem.valueEnd) {
|
|
391
|
+
elem.valueEnd = undefined;
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
// Resets selected option of element
|
|
395
|
+
if (elem.optionSelected) {
|
|
396
|
+
elem.optionSelected = undefined;
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
// Runs validation to handle error attribute
|
|
400
|
+
this.validate(elem);
|
|
401
|
+
}
|
|
402
|
+
|
|
370
403
|
/**
|
|
371
404
|
* Determines the validity state of the element based on the common attribute restrictions (pattern).
|
|
372
405
|
* @private
|
|
@@ -381,10 +414,15 @@ class AuroFormValidation {
|
|
|
381
414
|
elem.validity = 'badInput';
|
|
382
415
|
elem.setCustomValidity = elem.setCustomValidityBadInput || '';
|
|
383
416
|
}
|
|
384
|
-
}
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
// Length > 0 is required to prevent the error message from showing when the input is empty
|
|
420
|
+
if (elem.value?.length > 0 && elem.value?.length < elem.minLength) {
|
|
385
421
|
elem.validity = 'tooShort';
|
|
386
422
|
elem.setCustomValidity = elem.setCustomValidityTooShort || '';
|
|
387
|
-
}
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
if (elem.value?.length > elem.maxLength) {
|
|
388
426
|
elem.validity = 'tooLong';
|
|
389
427
|
elem.setCustomValidity = elem.setCustomValidityTooLong || '';
|
|
390
428
|
}
|
|
@@ -410,7 +448,7 @@ class AuroFormValidation {
|
|
|
410
448
|
elem.validity = 'tooShort';
|
|
411
449
|
elem.setCustomValidity = elem.setCustomValidityForType || '';
|
|
412
450
|
}
|
|
413
|
-
} else if (elem.type === 'number'
|
|
451
|
+
} else if (elem.type === 'number') {
|
|
414
452
|
if (elem.max !== undefined && Number(elem.max) < Number(elem.value)) {
|
|
415
453
|
elem.validity = 'rangeOverflow';
|
|
416
454
|
elem.setCustomValidity = elem.getAttribute('setCustomValidityRangeOverflow') || '';
|
|
@@ -515,14 +553,10 @@ class AuroFormValidation {
|
|
|
515
553
|
|
|
516
554
|
if (validationShouldRun || elem.hasAttribute('error')) {
|
|
517
555
|
if (elem.validity && elem.validity !== 'valid') {
|
|
518
|
-
elem.isValid = false;
|
|
519
|
-
|
|
520
556
|
// Use the validity message override if it is declared
|
|
521
557
|
if (elem.ValidityMessageOverride) {
|
|
522
558
|
elem.setCustomValidity = elem.ValidityMessageOverride;
|
|
523
559
|
}
|
|
524
|
-
} else {
|
|
525
|
-
elem.isValid = true;
|
|
526
560
|
}
|
|
527
561
|
|
|
528
562
|
this.getErrorMessage(elem);
|
|
@@ -795,20 +829,20 @@ class AuroRadioGroup extends r {
|
|
|
795
829
|
}
|
|
796
830
|
|
|
797
831
|
/**
|
|
798
|
-
*
|
|
832
|
+
* Resets component to initial state.
|
|
799
833
|
* @returns {void}
|
|
800
834
|
*/
|
|
801
835
|
reset() {
|
|
802
|
-
|
|
836
|
+
// Sets first radio button to receive focus during keyboard navigation
|
|
803
837
|
this.index = 0;
|
|
804
|
-
|
|
838
|
+
|
|
805
839
|
const buttons = this.querySelectorAll('auro-radio, [auro-radio]');
|
|
806
840
|
|
|
807
841
|
buttons.forEach((button) => {
|
|
808
|
-
button.
|
|
842
|
+
button.reset();
|
|
809
843
|
});
|
|
810
844
|
|
|
811
|
-
this.validation.
|
|
845
|
+
this.validation.reset(this);
|
|
812
846
|
}
|
|
813
847
|
|
|
814
848
|
/**
|
|
@@ -216,20 +216,20 @@ export class AuroRadioGroup extends LitElement {
|
|
|
216
216
|
}
|
|
217
217
|
|
|
218
218
|
/**
|
|
219
|
-
*
|
|
219
|
+
* Resets component to initial state.
|
|
220
220
|
* @returns {void}
|
|
221
221
|
*/
|
|
222
222
|
reset() {
|
|
223
|
-
|
|
223
|
+
// Sets first radio button to receive focus during keyboard navigation
|
|
224
224
|
this.index = 0;
|
|
225
|
-
|
|
225
|
+
|
|
226
226
|
const buttons = this.querySelectorAll('auro-radio, [auro-radio]');
|
|
227
227
|
|
|
228
228
|
buttons.forEach((button) => {
|
|
229
|
-
button.
|
|
229
|
+
button.reset();
|
|
230
230
|
});
|
|
231
231
|
|
|
232
|
-
this.validation.
|
|
232
|
+
this.validation.reset(this);
|
|
233
233
|
}
|
|
234
234
|
|
|
235
235
|
/**
|
|
@@ -151,6 +151,15 @@ export class AuroRadio extends LitElement {
|
|
|
151
151
|
}));
|
|
152
152
|
}
|
|
153
153
|
|
|
154
|
+
/**
|
|
155
|
+
* Resets component to initial state.
|
|
156
|
+
* @returns {void}
|
|
157
|
+
*/
|
|
158
|
+
reset() {
|
|
159
|
+
this.checked = false;
|
|
160
|
+
this.error = false;
|
|
161
|
+
}
|
|
162
|
+
|
|
154
163
|
updated(changedProperties) {
|
|
155
164
|
if (changedProperties.has('checked')) {
|
|
156
165
|
this.dispatchEvent(new CustomEvent('resetRadio', {
|
|
@@ -137,13 +137,13 @@ More info and automated migrator: https://sass-lang.com/d/import
|
|
|
137
137
|
|
|
138
138
|
[36m
|
|
139
139
|
[1m./src/index.js[22m → [1mdist[22m...[39m
|
|
140
|
-
[32mcreated [1mdist[22m in [
|
|
140
|
+
[32mcreated [1mdist[22m in [1m548ms[22m[39m
|
|
141
141
|
[36m
|
|
142
142
|
[1m./demo/index.js[22m → [1m./demo/[22m...[39m
|
|
143
|
-
[32mcreated [1m./demo/[22m in [
|
|
143
|
+
[32mcreated [1m./demo/[22m in [1m575ms[22m[39m
|
|
144
144
|
[36m
|
|
145
145
|
[1m./demo/api.js[22m → [1m./demo/[22m...[39m
|
|
146
|
-
[32mcreated [1m./demo/[22m in [
|
|
146
|
+
[32mcreated [1m./demo/[22m in [1m393ms[22m[39m
|
|
147
147
|
|
|
148
148
|
> @auro-formkit/auro-select@3.3.0 build:docs
|
|
149
149
|
> wca analyze 'scripts/wca/*.js' --outFiles docs/api.md; node ../../packages/build-tools/src/docProcessor.mjs --component select
|
|
@@ -205,6 +205,7 @@ Retrieving latest "/home/runner/work/auro-formkit/auro-formkit/components/select
|
|
|
205
205
|
⁕ FILE:src=./../apiExamples/label.html
|
|
206
206
|
⁕ FILE:src=./../apiExamples/labelWithPlaceholder.html
|
|
207
207
|
⁕ FILE:src=./../apiExamples/helpText.html
|
|
208
|
+
⁕ FILE:src=./../apiExamples/resetState.html
|
|
208
209
|
⁕ FILE:src=./../apiExamples/valueExtraction.html
|
|
209
210
|
⁕ FILE:src=./../apiExamples/customErrorValidity.html
|
|
210
211
|
⁕ FILE:src=./../apiExamples/valueAlert.html
|
|
@@ -221,8 +222,10 @@ Retrieving latest "/home/runner/work/auro-formkit/auro-formkit/components/select
|
|
|
221
222
|
⁕ CODE:src=./../apiExamples/label.html
|
|
222
223
|
⁕ CODE:src=./../apiExamples/labelWithPlaceholder.html
|
|
223
224
|
⁕ CODE:src=./../apiExamples/helpText.html
|
|
224
|
-
⁕ CODE:src=./../apiExamples/
|
|
225
|
+
⁕ CODE:src=./../apiExamples/resetState.html
|
|
226
|
+
⁕ CODE:src=./../apiExamples/resetState.js
|
|
225
227
|
⁕ CODE:src=./../apiExamples/valueExtraction.html
|
|
228
|
+
⁕ CODE:src=./../apiExamples/valueExtraction.js
|
|
226
229
|
⁕ CODE:src=./../apiExamples/customErrorValidity.html
|
|
227
230
|
⁕ CODE:src=./../apiExamples/customErrorValidity.js
|
|
228
231
|
⁕ CODE:src=./alertValue.js
|
|
@@ -2,8 +2,9 @@ import { customErrorValidityExample } from "../apiExamples/customErrorValidity";
|
|
|
2
2
|
import { setErrorExample } from "../apiExamples/errorApi";
|
|
3
3
|
import { valueExample } from "../apiExamples/value";
|
|
4
4
|
import { valueExtractionExample } from "../apiExamples/valueExtraction";
|
|
5
|
-
import { inDialogExample } from '../apiExamples/inDialog
|
|
6
|
-
import {
|
|
5
|
+
import { inDialogExample } from '../apiExamples/inDialog';
|
|
6
|
+
import { resetStateExample } from "../apiExamples/resetState";
|
|
7
|
+
import { auroMenuLoadingExample } from "../apiExamples/loading";
|
|
7
8
|
|
|
8
9
|
/* eslint-disable jsdoc/require-jsdoc, no-magic-numbers, no-param-reassign */
|
|
9
10
|
import { AuroSelect } from '../src/auro-select.js';
|
|
@@ -21,6 +22,7 @@ export function initExamples(initCount) {
|
|
|
21
22
|
valueExample();
|
|
22
23
|
valueExtractionExample();
|
|
23
24
|
inDialogExample();
|
|
25
|
+
resetStateExample();
|
|
24
26
|
auroMenuLoadingExample();
|
|
25
27
|
} catch (err) {
|
|
26
28
|
if (initCount <= 20) {
|
|
@@ -30,6 +30,12 @@ The auro-select element is a wrapper for auro-dropdown and auro-menu to create a
|
|
|
30
30
|
| [validity](#validity) | `validity` | `String` | "undefined" | Specifies the `validityState` this element is in. |
|
|
31
31
|
| [value](#value) | `value` | `String` | | Value selected for the component. |
|
|
32
32
|
|
|
33
|
+
## Methods
|
|
34
|
+
|
|
35
|
+
| Method | Type | Description |
|
|
36
|
+
|---------|------------|------------------------------------|
|
|
37
|
+
| [reset](#reset) | `(): void` | Resets component to initial state. |
|
|
38
|
+
|
|
33
39
|
## Events
|
|
34
40
|
|
|
35
41
|
| Event | Type | Description |
|
|
@@ -497,6 +503,64 @@ Use the `helptext` slot to provide additional information back to your user abou
|
|
|
497
503
|
|
|
498
504
|
## Functional Examples
|
|
499
505
|
|
|
506
|
+
### Reset State
|
|
507
|
+
|
|
508
|
+
Use the `reset()` method to reset the `<auro-select>`'s `value` and `validity` state. Doing so will preserve all other attributes and properties.
|
|
509
|
+
|
|
510
|
+
<div class="exampleWrapper">
|
|
511
|
+
<!-- AURO-GENERATED-CONTENT:START (FILE:src=./../apiExamples/resetState.html) -->
|
|
512
|
+
<!-- The below content is automatically added from ./../apiExamples/resetState.html -->
|
|
513
|
+
<auro-button id="resetStateBtn">Reset</auro-button>
|
|
514
|
+
<br/><br/>
|
|
515
|
+
<auro-select id="resetStateExample" required value="price">
|
|
516
|
+
<span slot="label">Name</span>
|
|
517
|
+
<auro-menu>
|
|
518
|
+
<auro-menuoption value="stops">Stops</auro-menuoption>
|
|
519
|
+
<auro-menuoption value="price">Price</auro-menuoption>
|
|
520
|
+
<auro-menuoption value="duration">Duration</auro-menuoption>
|
|
521
|
+
<auro-menuoption value="departure">Departure</auro-menuoption>
|
|
522
|
+
<auro-menuoption value="arrival">Arrival</auro-menuoption>
|
|
523
|
+
<auro-menuoption value="prefer alaska">Prefer Alaska</auro-menuoption>
|
|
524
|
+
</auro-menu>
|
|
525
|
+
</auro-select>
|
|
526
|
+
<!-- AURO-GENERATED-CONTENT:END -->
|
|
527
|
+
</div>
|
|
528
|
+
<auro-accordion alignRight>
|
|
529
|
+
<span slot="trigger">See code</span>
|
|
530
|
+
<!-- AURO-GENERATED-CONTENT:START (CODE:src=./../apiExamples/resetState.html) -->
|
|
531
|
+
<!-- The below code snippet is automatically added from ./../apiExamples/resetState.html -->
|
|
532
|
+
|
|
533
|
+
```html
|
|
534
|
+
<auro-button id="resetStateBtn">Reset</auro-button>
|
|
535
|
+
<br/><br/>
|
|
536
|
+
<auro-select id="resetStateExample" required value="price">
|
|
537
|
+
<span slot="label">Name</span>
|
|
538
|
+
<auro-menu>
|
|
539
|
+
<auro-menuoption value="stops">Stops</auro-menuoption>
|
|
540
|
+
<auro-menuoption value="price">Price</auro-menuoption>
|
|
541
|
+
<auro-menuoption value="duration">Duration</auro-menuoption>
|
|
542
|
+
<auro-menuoption value="departure">Departure</auro-menuoption>
|
|
543
|
+
<auro-menuoption value="arrival">Arrival</auro-menuoption>
|
|
544
|
+
<auro-menuoption value="prefer alaska">Prefer Alaska</auro-menuoption>
|
|
545
|
+
</auro-menu>
|
|
546
|
+
</auro-select>
|
|
547
|
+
```
|
|
548
|
+
<!-- AURO-GENERATED-CONTENT:END -->
|
|
549
|
+
<!-- AURO-GENERATED-CONTENT:START (CODE:src=./../apiExamples/resetState.js) -->
|
|
550
|
+
<!-- The below code snippet is automatically added from ./../apiExamples/resetState.js -->
|
|
551
|
+
|
|
552
|
+
```js
|
|
553
|
+
export function resetStateExample() {
|
|
554
|
+
const elem = document.querySelector('#resetStateExample');
|
|
555
|
+
|
|
556
|
+
document.querySelector('#resetStateBtn').addEventListener('click', () => {
|
|
557
|
+
elem.reset();
|
|
558
|
+
});
|
|
559
|
+
}
|
|
560
|
+
```
|
|
561
|
+
<!-- AURO-GENERATED-CONTENT:END -->
|
|
562
|
+
</auro-accordion>
|
|
563
|
+
|
|
500
564
|
### Extract value
|
|
501
565
|
|
|
502
566
|
The following example illustrates how a user may query the `element.value` or `element.optionSelected` for the current value or complete option object that is selected.
|
|
@@ -519,23 +583,6 @@ The following example illustrates how a user may query the `element.value` or `e
|
|
|
519
583
|
</div>
|
|
520
584
|
<auro-accordion alignRight>
|
|
521
585
|
<span slot="trigger">See code</span>
|
|
522
|
-
<!-- AURO-GENERATED-CONTENT:START (CODE:src=./../apiExamples/valueExtraction.js) -->
|
|
523
|
-
<!-- The below code snippet is automatically added from ./../apiExamples/valueExtraction.js -->
|
|
524
|
-
|
|
525
|
-
```js
|
|
526
|
-
export function valueExtractionExample() {
|
|
527
|
-
const valueExtractionExample = document.querySelector('#valueExtraction');
|
|
528
|
-
const valueExtractionBtn = document.querySelector('#valueExtractionBtn');
|
|
529
|
-
|
|
530
|
-
valueExtractionBtn.addEventListener('click', () => {
|
|
531
|
-
console.warn('Value selected:', valueExtractionExample.value);
|
|
532
|
-
console.warn('Option selected:', valueExtractionExample.optionSelected);
|
|
533
|
-
|
|
534
|
-
alert(`Value selected: ${valueExtractionExample.value}`);
|
|
535
|
-
})
|
|
536
|
-
}
|
|
537
|
-
```
|
|
538
|
-
<!-- AURO-GENERATED-CONTENT:END -->
|
|
539
586
|
<!-- AURO-GENERATED-CONTENT:START (CODE:src=./../apiExamples/valueExtraction.html) -->
|
|
540
587
|
<!-- The below code snippet is automatically added from ./../apiExamples/valueExtraction.html -->
|
|
541
588
|
|
|
@@ -553,6 +600,23 @@ export function valueExtractionExample() {
|
|
|
553
600
|
<auro-button id="valueExtractionBtn">Get current value</auro-button>
|
|
554
601
|
```
|
|
555
602
|
<!-- AURO-GENERATED-CONTENT:END -->
|
|
603
|
+
<!-- AURO-GENERATED-CONTENT:START (CODE:src=./../apiExamples/valueExtraction.js) -->
|
|
604
|
+
<!-- The below code snippet is automatically added from ./../apiExamples/valueExtraction.js -->
|
|
605
|
+
|
|
606
|
+
```js
|
|
607
|
+
export function valueExtractionExample() {
|
|
608
|
+
const valueExtractionExample = document.querySelector('#valueExtraction');
|
|
609
|
+
const valueExtractionBtn = document.querySelector('#valueExtractionBtn');
|
|
610
|
+
|
|
611
|
+
valueExtractionBtn.addEventListener('click', () => {
|
|
612
|
+
console.warn('Value selected:', valueExtractionExample.value);
|
|
613
|
+
console.warn('Option selected:', valueExtractionExample.optionSelected);
|
|
614
|
+
|
|
615
|
+
alert(`Value selected: ${valueExtractionExample.value}`);
|
|
616
|
+
})
|
|
617
|
+
}
|
|
618
|
+
```
|
|
619
|
+
<!-- AURO-GENERATED-CONTENT:END -->
|
|
556
620
|
</auro-accordion>
|
|
557
621
|
|
|
558
622
|
### Custom Validity with Error State
|