Skip to content

Commit

Permalink
feat(stepper): dispatch stepper-change
Browse files Browse the repository at this point in the history
  • Loading branch information
mseyfayi authored and majidsajadi committed May 13, 2024
1 parent 59c6b05 commit 32cbe29
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/stepper/stepper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,29 @@ export class Stepper extends LitElement {
`;
}

private dispatchChangeEvent = () => {
this.dispatchEvent(
new CustomEvent('stepper-change', {
detail: {
value: this.value,
},
bubbles: true,
composed: true,
}),
);
};

private handleIncrease = () => {
if (this.value < this.max) {
this.value += this.step;
this.dispatchChangeEvent();
}
};

private handleDecrease = () => {
if (this.value > this.min) {
this.value -= this.step;
this.dispatchChangeEvent();
}
};
}

0 comments on commit 32cbe29

Please sign in to comment.