web: now passing the precommit phase

This commit is contained in:
Ken Sternberg 2023-08-02 09:09:38 -07:00
parent b7b85d6f5d
commit a9a120cd68
5 changed files with 15 additions and 10 deletions

View file

@ -75,3 +75,5 @@ export class AkRadioInput<T> extends AKElement {
});
}
}
export default AkRadioInput;

View file

@ -6,7 +6,7 @@ import { TemplateResult, html } from "lit";
import "../ak-radio-input";
import AkRadioInput from "../ak-radio-input";
const metadata: Meta<AkRadioInput> = {
const metadata: Meta<AkRadioInput<Record<string, number>>> = {
title: "Components / Radio Input",
component: "ak-radio-input",
parameters: {
@ -41,14 +41,15 @@ const testOptions = [
];
export const ButtonWithSuccess = () => {
let result = "";
const result = "";
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const displayChange = (ev: any) => {
console.log(ev.type, ev.target.name, ev.target.value, ev.detail);
document.getElementById("radio-message-pad")!.innerText = `Value selected: ${JSON.stringify(
ev.target.value,
null,
2
2,
)}`;
};
@ -60,6 +61,6 @@ export const ButtonWithSuccess = () => {
help="This is where you would read the help messages"
.options=${testOptions}
></ak-radio-input>
<div>${result}</div>`
<div>${result}</div>`,
);
};

View file

@ -54,7 +54,7 @@ export class Radio<T> extends CustomEmitterElement(AKElement) {
// Set the value if it's not set already. Property changes inside the `willUpdate()` method do
// not trigger an element update.
willUpdate(changedProperties: Map<string, any>) {
willUpdate() {
if (!this.value) {
const maybeDefault = this.options.filter((opt) => opt.default);
if (maybeDefault.length > 0) {

View file

@ -6,6 +6,7 @@ import { TemplateResult, html } from "lit";
import "../Radio";
import Radio from "../Radio";
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const metadata: Meta<Radio<any>> = {
title: "Elements / Basic Radio",
component: "ak-radio",
@ -42,11 +43,11 @@ const testOptions = [
];
export const BasicRadioElement = () => {
const displayChange = (ev: any) => {
const displayChange = (ev: InputEvent) => {
document.getElementById("radio-message-pad")!.innerText = `Value selected: ${JSON.stringify(
ev.target.value,
(ev.target as HTMLInputElement)!.value,
null,
2
2,
)}`;
};
@ -55,6 +56,6 @@ export const BasicRadioElement = () => {
@input=${displayChange}
name="ak-test-radio-input"
.options=${testOptions}
></ak-radio>`
></ak-radio>`,
);
};

View file

@ -9,6 +9,7 @@ export const isCustomEvent = (v: any): v is CustomEvent =>
export function CustomEmitterElement<T extends Constructor<LitElement>>(superclass: T) {
return class EmmiterElementHandler extends superclass {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
dispatchCustomEvent(eventName: string, detail: any = {}, options = {}) {
this.dispatchEvent(
new CustomEvent(eventName, {