mirror of
https://github.com/shoelace-style/webawesome.git
synced 2026-01-12 12:09:26 +00:00
Apply suggestions from code review
Co-authored-by: Cory LaViska <cory@abeautifulsite.net>
This commit is contained in:
@@ -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;
|
||||
|
||||
|
||||
@@ -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';
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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;
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user