Skip to content

Commit

Permalink
feat(quantity): add validity state docs
Browse files Browse the repository at this point in the history
  • Loading branch information
aesteves60 authored and dpellier committed Nov 28, 2024
1 parent df9e868 commit 4874ae5
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,12 @@ export class OdsInput {
this.isInvalid = true;
}

@Listen('updateIsInvalid')
onUpdateIsInvalid(event: CustomEvent): void {
event.stopPropagation();
this.isInvalid = !this.internals.validity?.valid;
}

@Method()
public async checkValidity(): Promise<boolean> {
return this.internals.checkValidity();
Expand All @@ -94,6 +100,9 @@ export class OdsInput {
return this.internals.validity;
}

/**
* Also update error state
*/
@Method()
public async reportValidity(): Promise<boolean> {
this.isInvalid = !this.internals.validity.valid;
Expand Down

0 comments on commit 4874ae5

Please sign in to comment.