Apply suggestions from code review

Co-authored-by: Cory LaViska <cory@abeautifulsite.net>
This commit is contained in:
Konnor Rogers
2024-05-20 13:44:18 -04:00
committed by GitHub
parent c9f9a88637
commit 1d05c315ac
6 changed files with 4 additions and 10 deletions

View File

@@ -132,7 +132,7 @@ export default class WaCheckbox extends WebAwesomeFormAssociated {
this.emit('wa-focus');
}
@watch(['defaultChecked'])
@watch('defaultChecked')
handleDefaultCheckedChange() {
if (!this.hasInteracted && this.checked !== this.defaultChecked) {
this.checked = this.defaultChecked;
@@ -140,7 +140,6 @@ export default class WaCheckbox extends WebAwesomeFormAssociated {
}
}
// @watch(['value', 'checked'], { waitUntilFirstUpdate: true })
handleValueOrCheckedChange() {
this.value = this.checked ? this.value || 'on' : null;

View File

@@ -4,7 +4,6 @@ import '../dropdown/dropdown.js';
import '../icon/icon.js';
import '../input/input.js';
import '../visually-hidden/visually-hidden.js';
import { clamp } from '../../internal/math.js';
import { classMap } from 'lit/directives/class-map.js';
import { customElement, eventOptions, property, query, state } from 'lit/decorators.js';

View File

@@ -282,9 +282,6 @@ export default class WaInput extends WebAwesomeFormAssociated {
// See https://github.com/shoelace-style/shoelace/pull/988
//
if (!event.defaultPrevented && !event.isComposing) {
// getForm.elements.find(() => {
// el.getAttribute("type") === "submit"
// })
this.getForm()?.requestSubmit(null);
}
});

View File

@@ -2,7 +2,7 @@ import type { Validator } from '../webawesome-element.js';
/**
* This validator is for if you have an exact copy of your element in the shadow DOM. Rather than needing
* custom translations and error messages, you can simply rely on the element "formControl" in your shadow dom.
* custom translations and error messages, you can simply rely on the element "formControl" in your shadow dom.
*/
export const CustomErrorValidator = (): Validator => {
return {

View File

@@ -2,7 +2,7 @@ import type { Validator } from '../webawesome-element.js';
/**
* This validator is for if you have an exact copy of your element in the shadow DOM. Rather than needing
* custom translations and error messages, you can simply rely on the element "formControl" in your shadow dom.
* custom translations and error messages, you can simply rely on the element "formControl" in your shadow dom.
*/
export const MirrorValidator = (): Validator => {
return {

View File

@@ -147,8 +147,7 @@ export interface WebAwesomeFormControl extends WebAwesomeElement {
// setFormValue omitted so that we can use `setValue`
export class WebAwesomeFormAssociated
extends WebAwesomeElement
implements Omit<ElementInternals, 'form' | 'setFormValue'>, WebAwesomeFormControl
{
implements Omit<ElementInternals, 'form' | 'setFormValue'>, WebAwesomeFormControl {
static formAssociated = true;
/**