matcha-components 20.170.0 → 20.173.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2947,6 +2947,9 @@ class MatchaSlideToggleComponent {
2947
2947
  const newCheckedState = value === '' ? true : !!value;
2948
2948
  if (newCheckedState !== this._checked) {
2949
2949
  this._checked = newCheckedState;
2950
+ // Força a detecção imediata para sincronizar o DOM do input interno
2951
+ // especialmente útil quando o pai reverte o estado no mesmo ciclo
2952
+ this.cdr.detectChanges();
2950
2953
  }
2951
2954
  }
2952
2955
  get checked() {
@@ -3008,10 +3011,14 @@ class MatchaSlideToggleComponent {
3008
3011
  }
3009
3012
  const inputElement = event.target;
3010
3013
  const newCheckedState = inputElement.checked;
3014
+ // Suprime completamente o evento nativo para evitar interferência no pai
3015
+ // e evitar disparos duplos quando o componente emite seu próprio evento
3016
+ event.preventDefault();
3017
+ event.stopImmediatePropagation();
3011
3018
  this._checked = newCheckedState;
3012
3019
  this.onChange(newCheckedState);
3013
3020
  this.onTouched();
3014
- this.change.emit({ checked: newCheckedState });
3021
+ this.change.emit({ source: this, checked: newCheckedState });
3015
3022
  // Marca para detecção após mudança (necessário para OnPush)
3016
3023
  this.cdr.markForCheck();
3017
3024
  }