Fix a couple types that were throwing off the CEM

This commit is contained in:
Lea Verou
2024-12-14 20:29:29 -05:00
parent 7b0274a657
commit d0574677c1
4 changed files with 12 additions and 9 deletions

View File

@@ -64,7 +64,7 @@ export default class WaAnimation extends WebAwesomeElement {
@property() fill: FillMode = 'auto';
/** The number of iterations to run before the animation completes. Defaults to `Infinity`, which loops. */
@property({ type: Number }) iterations = Infinity;
@property({ type: Number }) iterations: number = Infinity;
/** The offset at which to start the animation, usually between 0 (start) and 1 (end). */
@property({ attribute: 'iteration-start', type: Number }) iterationStart = 0;

View File

@@ -88,7 +88,7 @@ export default class WaCheckbox extends WebAwesomeFormAssociatedElement {
private _value: string | null = this.getAttribute('value') ?? null;
/** The value of the checkbox, submitted as a name/value pair with form data. */
get value() {
get value(): string | null {
return this._value ?? 'on';
}
@@ -110,10 +110,11 @@ export default class WaCheckbox extends WebAwesomeFormAssociatedElement {
@property({ type: Boolean, reflect: true }) indeterminate = false;
/** Draws the checkbox in a checked state. */
@property({ type: Boolean, attribute: false }) checked = this.hasAttribute('checked');
@property({ type: Boolean, attribute: false }) checked: boolean = this.hasAttribute('checked');
/** The default value of the form control. Primarily used for resetting the form control. */
@property({ type: Boolean, reflect: true, attribute: 'checked' }) defaultChecked = this.hasAttribute('checked');
@property({ type: Boolean, reflect: true, attribute: 'checked' }) defaultChecked: boolean =
this.hasAttribute('checked');
/**
* By default, form controls are associated with the nearest containing `<form>` element. This attribute allows you

View File

@@ -68,10 +68,11 @@ export default class WaRange extends WebAwesomeFormAssociatedElement {
@property() title = ''; // make reactive to pass through
/** The name of the range, submitted as a name/value pair with form data. */
@property() name = '';
@property() name: string = '';
/** The default value of the form control. Primarily used for resetting the form control. */
@property({ type: Number, attribute: 'value', reflect: true }) defaultValue = Number(this.getAttribute('value')) || 0;
@property({ type: Number, attribute: 'value', reflect: true }) defaultValue: number =
Number(this.getAttribute('value')) || 0;
private _value: number | null = null;

View File

@@ -71,7 +71,7 @@ export default class WaSwitch extends WebAwesomeFormAssociatedElement {
private _value: string | null = null;
/** The current value of the switch, submitted as a name/value pair with form data. */
get value() {
get value(): string | null {
if (this.valueHasChanged) {
return this._value;
}
@@ -99,10 +99,11 @@ export default class WaSwitch extends WebAwesomeFormAssociatedElement {
@property({ type: Boolean }) disabled = false;
/** Draws the switch in a checked state. */
@property({ type: Boolean, attribute: false }) checked = this.hasAttribute('checked');
@property({ type: Boolean, attribute: false }) checked: boolean = this.hasAttribute('checked');
/** The default value of the form control. Primarily used for resetting the form control. */
@property({ type: Boolean, attribute: 'checked', reflect: true }) defaultChecked = this.hasAttribute('checked');
@property({ type: Boolean, attribute: 'checked', reflect: true }) defaultChecked: boolean =
this.hasAttribute('checked');
/**
* By default, form controls are associated with the nearest containing `<form>` element. This attribute allows you