diff --git a/core/src/components/checkbox/checkbox.tsx b/core/src/components/checkbox/checkbox.tsx index 74c703e328..7a2386f01a 100644 --- a/core/src/components/checkbox/checkbox.tsx +++ b/core/src/components/checkbox/checkbox.tsx @@ -150,23 +150,22 @@ export class Checkbox implements ComponentInterface { } @Watch('checked') - checkedChanged() { - this.emitStyle(); - } - @Watch('disabled') - disabledChanged() { + protected styleChanged() { this.emitStyle(); } - // TODO(FW-3100): remove this private emitStyle() { + const style: StyleEventDetail = { + 'interactive-disabled': this.disabled, + }; + + // TODO(FW-3100): remove this if (this.legacyFormController.hasLegacyControl()) { - this.ionStyle.emit({ - 'checkbox-checked': this.checked, - 'interactive-disabled': this.disabled, - }); + style['checkbox-checked'] = this.checked; } + + this.ionStyle.emit(style); } private setFocus() { diff --git a/core/src/components/checkbox/test/item/index.html b/core/src/components/checkbox/test/item/index.html index a0728df934..a1628f44bd 100644 --- a/core/src/components/checkbox/test/item/index.html +++ b/core/src/components/checkbox/test/item/index.html @@ -136,6 +136,18 @@ + +

States

+
+
+

Disabled

+ + + Enable Notifications + + +
+
diff --git a/core/src/components/radio/radio.tsx b/core/src/components/radio/radio.tsx index ace33db225..2c9e55f292 100644 --- a/core/src/components/radio/radio.tsx +++ b/core/src/components/radio/radio.tsx @@ -164,16 +164,23 @@ export class Radio implements ComponentInterface { } } - @Watch('color') @Watch('checked') + @Watch('color') @Watch('disabled') - emitStyle() { + protected styleChanged() { + this.emitStyle(); + } + + private emitStyle() { + const style: StyleEventDetail = { + 'interactive-disabled': this.disabled, + }; + if (this.legacyFormController.hasLegacyControl()) { - this.ionStyle.emit({ - 'radio-checked': this.checked, - 'interactive-disabled': this.disabled, - }); + style['radio-checked'] = this.checked; } + + this.ionStyle.emit(style); } private updateState = () => { diff --git a/core/src/components/radio/test/item/index.html b/core/src/components/radio/test/item/index.html index 7c98314839..713e6f1435 100644 --- a/core/src/components/radio/test/item/index.html +++ b/core/src/components/radio/test/item/index.html @@ -154,6 +154,17 @@ + +

States

+
+ + + + Enable Notifications + + + +
diff --git a/core/src/components/select/select.tsx b/core/src/components/select/select.tsx index e391b61694..3f95864c73 100644 --- a/core/src/components/select/select.tsx +++ b/core/src/components/select/select.tsx @@ -214,14 +214,10 @@ export class Select implements ComponentInterface { @Event() ionStyle!: EventEmitter; @Watch('disabled') - @Watch('placeholder') @Watch('isExpanded') - styleChanged() { - this.emitStyle(); - } - + @Watch('placeholder') @Watch('value') - valueChanged() { + protected styleChanged() { this.emitStyle(); } @@ -653,17 +649,21 @@ export class Select implements ComponentInterface { } private emitStyle() { + const { disabled } = this; + const style: StyleEventDetail = { + 'interactive-disabled': disabled, + }; + if (this.legacyFormController.hasLegacyControl()) { - this.ionStyle.emit({ - interactive: true, - 'interactive-disabled': this.disabled, - select: true, - 'select-disabled': this.disabled, - 'has-placeholder': this.placeholder !== undefined, - 'has-value': this.hasValue(), - 'has-focus': this.isExpanded, - }); + style['interactive'] = true; + style['select'] = true; + style['select-disabled'] = disabled; + style['has-placeholder'] = this.placeholder !== undefined; + style['has-value'] = this.hasValue(); + style['has-focus'] = this.isExpanded; } + + this.ionStyle.emit(style); } private onClick = (ev: UIEvent) => { diff --git a/core/src/components/select/test/item/index.html b/core/src/components/select/test/item/index.html index 467fed5f4c..826ff97699 100644 --- a/core/src/components/select/test/item/index.html +++ b/core/src/components/select/test/item/index.html @@ -19,6 +19,7 @@ grid-row-gap: 20px; grid-column-gap: 20px; } + h2 { font-size: 12px; font-weight: normal; @@ -27,6 +28,7 @@ margin-top: 10px; } + @media screen and (max-width: 800px) { .grid { grid-template-columns: 1fr; @@ -67,6 +69,17 @@ + +
+

Disabled

+ + + + Apple + + + +