From e96a7eb83af6cde737d0f03491966d6dc5bd7060 Mon Sep 17 00:00:00 2001 From: Jordan Jones Date: Tue, 17 Dec 2024 13:00:26 -0800 Subject: [PATCH] fix: add select's min.js files --- components/select/demo/api.min.js | 27 ++++++++++++++++++--------- components/select/demo/index.min.js | 27 ++++++++++++++++++--------- 2 files changed, 36 insertions(+), 18 deletions(-) diff --git a/components/select/demo/api.min.js b/components/select/demo/api.min.js index 79fca6b..f90cadc 100644 --- a/components/select/demo/api.min.js +++ b/components/select/demo/api.min.js @@ -183,10 +183,14 @@ class AuroFormValidation { elem.validity = 'badInput'; elem.setCustomValidity = elem.setCustomValidityBadInput || ''; } - } else if (elem.value && elem.value.length > 0 && elem.value.length < elem.minLength) { + } + + if (elem.value && elem.value.length > 0 && elem.value.length < elem.minLength) { elem.validity = 'tooShort'; elem.setCustomValidity = elem.setCustomValidityTooShort || ''; - } else if (elem.value && elem.value.length > elem.maxLength) { + } + + if (elem.value && elem.value.length > elem.maxLength) { elem.validity = 'tooLong'; elem.setCustomValidity = elem.setCustomValidityTooLong || ''; } @@ -212,7 +216,7 @@ class AuroFormValidation { elem.validity = 'tooShort'; elem.setCustomValidity = elem.setCustomValidityForType || ''; } - } else if (elem.type === 'number' || elem.type === 'numeric') { // 'numeric` is a deprecated alias for number' + } else if (elem.type === 'number') { if (elem.max !== undefined && Number(elem.max) < Number(elem.value)) { elem.validity = 'rangeOverflow'; elem.setCustomValidity = elem.getAttribute('setCustomValidityRangeOverflow') || ''; @@ -301,6 +305,9 @@ class AuroFormValidation { this.validateType(elem); this.validateAttributes(elem); } + } else if (elem.value === undefined) { + // Reset the validity state if input is programmatically reset + elem.validity = undefined; } if (this.auroInputElements && this.auroInputElements.length > 0) { @@ -317,14 +324,10 @@ class AuroFormValidation { if (validationShouldRun || elem.hasAttribute('error')) { if (elem.validity && elem.validity !== 'valid') { - elem.isValid = false; - // Use the validity message override if it is declared if (elem.ValidityMessageOverride) { elem.setCustomValidity = elem.ValidityMessageOverride; } - } else { - elem.isValid = true; } this.getErrorMessage(elem); @@ -4200,9 +4203,9 @@ class AuroMenuOption extends r$4 { const versioning = new AuroDependencyVersioning$1(); this.iconTag = versioning.generateTag('auro-icon', iconVersion, AuroIcon); + this.selected = false; this.nocheckmark = false; this.disabled = false; - this.selected = false; /** * @private @@ -4265,6 +4268,7 @@ class AuroMenuOption extends r$4 { this.runtimeUtils.handleComponentTagRename(this, 'auro-menuoption'); this.setAttribute('role', 'option'); + this.setAttribute('aria-selected', 'false'); this.addEventListener('mouseover', () => { this.dispatchEvent(new CustomEvent('auroMenuOption-mouseover', { @@ -4276,6 +4280,12 @@ class AuroMenuOption extends r$4 { }); } + // observer for selected property changes + updated(changedProperties) { + if (changedProperties.has('selected')) { + this.setAttribute('aria-selected', this.selected.toString()); + } + } /** * Generates an HTML element containing an SVG icon based on the provided `svgContent`. @@ -4477,7 +4487,6 @@ class AuroMenu extends r$4 { this.items.forEach((item) => { item.classList.remove('active'); item.removeAttribute('selected'); - item.removeAttribute('aria-selected'); }); } } diff --git a/components/select/demo/index.min.js b/components/select/demo/index.min.js index 86a2dc4..bb4b088 100644 --- a/components/select/demo/index.min.js +++ b/components/select/demo/index.min.js @@ -124,10 +124,14 @@ class AuroFormValidation { elem.validity = 'badInput'; elem.setCustomValidity = elem.setCustomValidityBadInput || ''; } - } else if (elem.value && elem.value.length > 0 && elem.value.length < elem.minLength) { + } + + if (elem.value && elem.value.length > 0 && elem.value.length < elem.minLength) { elem.validity = 'tooShort'; elem.setCustomValidity = elem.setCustomValidityTooShort || ''; - } else if (elem.value && elem.value.length > elem.maxLength) { + } + + if (elem.value && elem.value.length > elem.maxLength) { elem.validity = 'tooLong'; elem.setCustomValidity = elem.setCustomValidityTooLong || ''; } @@ -153,7 +157,7 @@ class AuroFormValidation { elem.validity = 'tooShort'; elem.setCustomValidity = elem.setCustomValidityForType || ''; } - } else if (elem.type === 'number' || elem.type === 'numeric') { // 'numeric` is a deprecated alias for number' + } else if (elem.type === 'number') { if (elem.max !== undefined && Number(elem.max) < Number(elem.value)) { elem.validity = 'rangeOverflow'; elem.setCustomValidity = elem.getAttribute('setCustomValidityRangeOverflow') || ''; @@ -242,6 +246,9 @@ class AuroFormValidation { this.validateType(elem); this.validateAttributes(elem); } + } else if (elem.value === undefined) { + // Reset the validity state if input is programmatically reset + elem.validity = undefined; } if (this.auroInputElements && this.auroInputElements.length > 0) { @@ -258,14 +265,10 @@ class AuroFormValidation { if (validationShouldRun || elem.hasAttribute('error')) { if (elem.validity && elem.validity !== 'valid') { - elem.isValid = false; - // Use the validity message override if it is declared if (elem.ValidityMessageOverride) { elem.setCustomValidity = elem.ValidityMessageOverride; } - } else { - elem.isValid = true; } this.getErrorMessage(elem); @@ -4141,9 +4144,9 @@ class AuroMenuOption extends r$4 { const versioning = new AuroDependencyVersioning$1(); this.iconTag = versioning.generateTag('auro-icon', iconVersion, AuroIcon); + this.selected = false; this.nocheckmark = false; this.disabled = false; - this.selected = false; /** * @private @@ -4206,6 +4209,7 @@ class AuroMenuOption extends r$4 { this.runtimeUtils.handleComponentTagRename(this, 'auro-menuoption'); this.setAttribute('role', 'option'); + this.setAttribute('aria-selected', 'false'); this.addEventListener('mouseover', () => { this.dispatchEvent(new CustomEvent('auroMenuOption-mouseover', { @@ -4217,6 +4221,12 @@ class AuroMenuOption extends r$4 { }); } + // observer for selected property changes + updated(changedProperties) { + if (changedProperties.has('selected')) { + this.setAttribute('aria-selected', this.selected.toString()); + } + } /** * Generates an HTML element containing an SVG icon based on the provided `svgContent`. @@ -4418,7 +4428,6 @@ class AuroMenu extends r$4 { this.items.forEach((item) => { item.classList.remove('active'); item.removeAttribute('selected'); - item.removeAttribute('aria-selected'); }); } }