Skip to content

Commit

Permalink
fix: add select's min.js files
Browse files Browse the repository at this point in the history
  • Loading branch information
jordanjones243 committed Dec 17, 2024
1 parent 355cf1d commit e96a7eb
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 18 deletions.
27 changes: 18 additions & 9 deletions components/select/demo/api.min.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 || '';
}
Expand All @@ -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') || '';
Expand Down Expand Up @@ -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) {
Expand All @@ -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);
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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', {
Expand All @@ -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`.
Expand Down Expand Up @@ -4477,7 +4487,6 @@ class AuroMenu extends r$4 {
this.items.forEach((item) => {
item.classList.remove('active');
item.removeAttribute('selected');
item.removeAttribute('aria-selected');
});
}
}
Expand Down
27 changes: 18 additions & 9 deletions components/select/demo/index.min.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 || '';
}
Expand All @@ -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') || '';
Expand Down Expand Up @@ -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) {
Expand All @@ -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);
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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', {
Expand All @@ -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`.
Expand Down Expand Up @@ -4418,7 +4428,6 @@ class AuroMenu extends r$4 {
this.items.forEach((item) => {
item.classList.remove('active');
item.removeAttribute('selected');
item.removeAttribute('aria-selected');
});
}
}
Expand Down

0 comments on commit e96a7eb

Please sign in to comment.