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",
|
"name": "@tp/tp-checkbox",
|
||||||
"version": "1.0.2",
|
"version": "1.0.3",
|
||||||
"description": "",
|
"description": "",
|
||||||
"main": "tp-checkbox.js",
|
"main": "tp-checkbox.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
@ -90,7 +90,13 @@ class TpCheckbox extends Inert(ControlState(FormElement(LitElement))) {
|
|||||||
|
|
||||||
toggle() {
|
toggle() {
|
||||||
this.checked = !this.checked;
|
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() {
|
get value() {
|
||||||
|
Loading…
Reference in New Issue
Block a user