From 32cbe29a210c1b4a689b31cb28269b90e7a28778 Mon Sep 17 00:00:00 2001 From: Mohammad Seyfayi Date: Sat, 11 May 2024 13:01:48 +0330 Subject: [PATCH] feat(stepper): dispatch stepper-change --- src/stepper/stepper.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/stepper/stepper.ts b/src/stepper/stepper.ts index b4b265b8..1bf3bfb3 100644 --- a/src/stepper/stepper.ts +++ b/src/stepper/stepper.ts @@ -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(); } }; }