refactor emit into ShoelaceElement

This commit is contained in:
Cory LaViska
2022-09-16 16:21:40 -04:00
parent a1c93fd30f
commit 69ff4f0bbc
39 changed files with 125 additions and 156 deletions

View File

@@ -4,7 +4,6 @@ import { classMap } from 'lit/directives/class-map.js';
import { ifDefined } from 'lit/directives/if-defined.js';
import { live } from 'lit/directives/live.js';
import { defaultValue } from '../../internal/default-value';
import { emit } from '../../internal/event';
import { FormSubmitController } from '../../internal/form';
import ShoelaceElement from '../../internal/shoelace-element';
import { HasSlotController } from '../../internal/slot';
@@ -246,8 +245,8 @@ export default class SlInput extends ShoelaceElement {
if (this.value !== this.input.value) {
this.value = this.input.value;
emit(this, 'sl-input');
emit(this, 'sl-change');
this.emit('sl-input');
this.emit('sl-change');
}
}
@@ -264,19 +263,19 @@ export default class SlInput extends ShoelaceElement {
handleBlur() {
this.hasFocus = false;
emit(this, 'sl-blur');
this.emit('sl-blur');
}
handleChange() {
this.value = this.input.value;
emit(this, 'sl-change');
this.emit('sl-change');
}
handleClearClick(event: MouseEvent) {
this.value = '';
emit(this, 'sl-clear');
emit(this, 'sl-input');
emit(this, 'sl-change');
this.emit('sl-clear');
this.emit('sl-input');
this.emit('sl-change');
this.input.focus();
event.stopPropagation();
@@ -299,12 +298,12 @@ export default class SlInput extends ShoelaceElement {
handleFocus() {
this.hasFocus = true;
emit(this, 'sl-focus');
this.emit('sl-focus');
}
handleInput() {
this.value = this.input.value;
emit(this, 'sl-input');
this.emit('sl-input');
}
handleInvalid() {