diff --git a/package.json b/package.json index 39e64b3..1a1ab0d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@tp/tp-radio", - "version": "1.1.0", + "version": "1.2.0", "description": "", "main": "tp-radio.js", "scripts": { diff --git a/tp-radio.js b/tp-radio.js index a8f9b55..686d859 100644 --- a/tp-radio.js +++ b/tp-radio.js @@ -18,10 +18,6 @@ class TpRadio extends Inert(ControlState(FormElement(LitElement))) { cursor: pointer; } - [hidden] { - display: none; - } - .circle { display: flex; align-items: center; @@ -38,6 +34,11 @@ class TpRadio extends Inert(ControlState(FormElement(LitElement))) { background: var(--tp-radio-dot-color, var(--tp-radio-color, #000)); width: calc(var(--tp-radio-width, 18px) - 4px); height: calc(var(--tp-radio-height, 18px) - 4px); + opacity: 0; + } + + .dot[visible] { + opacity: 1; } .wrap { @@ -58,7 +59,7 @@ class TpRadio extends Inert(ControlState(FormElement(LitElement))) { return html`
-
+
@@ -87,17 +88,17 @@ class TpRadio extends Inert(ControlState(FormElement(LitElement))) { check() { this.checked = true; - this.dispatchEvent(new CustomEvent('checked', { detail: this.checked, bubbles: true, composed: true })); + this.dispatchEvent(new CustomEvent('checked', { detail: this.value, bubbles: true, composed: true })); } updated(changes) { if (changes.has('checked')) { - this.dispatchEvent(new CustomEvent('checked-changed', { detail: this.checked, bubbles: true, composed: true })); + this.dispatchEvent(new CustomEvent('checked-changed', { detail: this.value, bubbles: true, composed: true })); } } get value() { - if (this._value !== '') { + if (!this._value !== '') { return this._value; } return this.checked;