Skip to content

Commit

Permalink
docs(input-field): fix misleading type number examples
Browse files Browse the repository at this point in the history
The value in change events is a number or the empty string.
  • Loading branch information
vicgeralds committed May 15, 2024
1 parent d1caac5 commit a1a244c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export class InputFieldPrefixExample {
);
}

private handleChange = (event: CustomEvent<string>) => {
this.value = event.detail;
private handleChange = (event: CustomEvent<string | number>) => {
this.value = event.detail + '';
};
}
6 changes: 3 additions & 3 deletions src/components/input-field/examples/input-field-number.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export class InputFieldNumberExample {
private formatNumber = true;

@State()
private value;
private value = '';

public render() {
return [
Expand Down Expand Up @@ -70,8 +70,8 @@ export class InputFieldNumberExample {
this.invalid = this.required && !this.value;
}

private handleChange = (event: CustomEvent<string>) => {
this.value = event.detail;
private handleChange = (event: CustomEvent<string | number>) => {
this.value = event.detail + '';
this.checkValidity();
};

Expand Down

0 comments on commit a1a244c

Please sign in to comment.