Add toggle event and change when checked-change event is fired.
This commit is contained in:
parent
9983a48880
commit
a9f07a5614
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@tp/tp-checkbox",
|
||||
"version": "1.0.2",
|
||||
"version": "1.0.3",
|
||||
"description": "",
|
||||
"main": "tp-checkbox.js",
|
||||
"scripts": {
|
||||
|
@ -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() {
|
||||
|
Loading…
Reference in New Issue
Block a user