diff --git a/package.json b/package.json index 594a071..a899a61 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@tp/tp-checkbox", - "version": "1.0.2", + "version": "1.0.3", "description": "", "main": "tp-checkbox.js", "scripts": { diff --git a/tp-checkbox.js b/tp-checkbox.js index e458169..dc6c805 100644 --- a/tp-checkbox.js +++ b/tp-checkbox.js @@ -90,7 +90,13 @@ class TpCheckbox extends Inert(ControlState(FormElement(LitElement))) { toggle() { this.checked = !this.checked; - this.dispatchEvent(new CustomEvent('checked-changed', { detail: this.checked, bubbles: true, composed: true })); + this.dispatchEvent(new CustomEvent('toggled', { detail: this.checked, bubbles: true, composed: true })); + } + + updated(changes) { + if (changes.has('checked')) { + this.dispatchEvent(new CustomEvent('checked-changed', { detail: this.checked, bubbles: true, composed: true })); + } } get value() {