web: now passing the precommit phase
This commit is contained in:
parent
b7b85d6f5d
commit
a9a120cd68
|
@ -75,3 +75,5 @@ export class AkRadioInput<T> extends AKElement {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export default AkRadioInput;
|
||||||
|
|
|
@ -6,7 +6,7 @@ import { TemplateResult, html } from "lit";
|
||||||
import "../ak-radio-input";
|
import "../ak-radio-input";
|
||||||
import AkRadioInput from "../ak-radio-input";
|
import AkRadioInput from "../ak-radio-input";
|
||||||
|
|
||||||
const metadata: Meta<AkRadioInput> = {
|
const metadata: Meta<AkRadioInput<Record<string, number>>> = {
|
||||||
title: "Components / Radio Input",
|
title: "Components / Radio Input",
|
||||||
component: "ak-radio-input",
|
component: "ak-radio-input",
|
||||||
parameters: {
|
parameters: {
|
||||||
|
@ -30,7 +30,7 @@ const container = (testItem: TemplateResult) =>
|
||||||
margin-top: 1em;
|
margin-top: 1em;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
${testItem}
|
${testItem}
|
||||||
<ul id="radio-message-pad" style="margin-top: 1em"></ul>
|
<ul id="radio-message-pad" style="margin-top: 1em"></ul>
|
||||||
</div>`;
|
</div>`;
|
||||||
|
|
||||||
|
@ -41,14 +41,15 @@ const testOptions = [
|
||||||
];
|
];
|
||||||
|
|
||||||
export const ButtonWithSuccess = () => {
|
export const ButtonWithSuccess = () => {
|
||||||
let result = "";
|
const result = "";
|
||||||
|
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
const displayChange = (ev: any) => {
|
const displayChange = (ev: any) => {
|
||||||
console.log(ev.type, ev.target.name, ev.target.value, ev.detail);
|
console.log(ev.type, ev.target.name, ev.target.value, ev.detail);
|
||||||
document.getElementById("radio-message-pad")!.innerText = `Value selected: ${JSON.stringify(
|
document.getElementById("radio-message-pad")!.innerText = `Value selected: ${JSON.stringify(
|
||||||
ev.target.value,
|
ev.target.value,
|
||||||
null,
|
null,
|
||||||
2
|
2,
|
||||||
)}`;
|
)}`;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -60,6 +61,6 @@ export const ButtonWithSuccess = () => {
|
||||||
help="This is where you would read the help messages"
|
help="This is where you would read the help messages"
|
||||||
.options=${testOptions}
|
.options=${testOptions}
|
||||||
></ak-radio-input>
|
></ak-radio-input>
|
||||||
<div>${result}</div>`
|
<div>${result}</div>`,
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
|
@ -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
|
// Set the value if it's not set already. Property changes inside the `willUpdate()` method do
|
||||||
// not trigger an element update.
|
// not trigger an element update.
|
||||||
willUpdate(changedProperties: Map<string, any>) {
|
willUpdate() {
|
||||||
if (!this.value) {
|
if (!this.value) {
|
||||||
const maybeDefault = this.options.filter((opt) => opt.default);
|
const maybeDefault = this.options.filter((opt) => opt.default);
|
||||||
if (maybeDefault.length > 0) {
|
if (maybeDefault.length > 0) {
|
||||||
|
|
|
@ -6,6 +6,7 @@ import { TemplateResult, html } from "lit";
|
||||||
import "../Radio";
|
import "../Radio";
|
||||||
import Radio from "../Radio";
|
import Radio from "../Radio";
|
||||||
|
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
const metadata: Meta<Radio<any>> = {
|
const metadata: Meta<Radio<any>> = {
|
||||||
title: "Elements / Basic Radio",
|
title: "Elements / Basic Radio",
|
||||||
component: "ak-radio",
|
component: "ak-radio",
|
||||||
|
@ -42,11 +43,11 @@ const testOptions = [
|
||||||
];
|
];
|
||||||
|
|
||||||
export const BasicRadioElement = () => {
|
export const BasicRadioElement = () => {
|
||||||
const displayChange = (ev: any) => {
|
const displayChange = (ev: InputEvent) => {
|
||||||
document.getElementById("radio-message-pad")!.innerText = `Value selected: ${JSON.stringify(
|
document.getElementById("radio-message-pad")!.innerText = `Value selected: ${JSON.stringify(
|
||||||
ev.target.value,
|
(ev.target as HTMLInputElement)!.value,
|
||||||
null,
|
null,
|
||||||
2
|
2,
|
||||||
)}`;
|
)}`;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -55,6 +56,6 @@ export const BasicRadioElement = () => {
|
||||||
@input=${displayChange}
|
@input=${displayChange}
|
||||||
name="ak-test-radio-input"
|
name="ak-test-radio-input"
|
||||||
.options=${testOptions}
|
.options=${testOptions}
|
||||||
></ak-radio>`
|
></ak-radio>`,
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
|
@ -9,6 +9,7 @@ export const isCustomEvent = (v: any): v is CustomEvent =>
|
||||||
|
|
||||||
export function CustomEmitterElement<T extends Constructor<LitElement>>(superclass: T) {
|
export function CustomEmitterElement<T extends Constructor<LitElement>>(superclass: T) {
|
||||||
return class EmmiterElementHandler extends superclass {
|
return class EmmiterElementHandler extends superclass {
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
dispatchCustomEvent(eventName: string, detail: any = {}, options = {}) {
|
dispatchCustomEvent(eventName: string, detail: any = {}, options = {}) {
|
||||||
this.dispatchEvent(
|
this.dispatchEvent(
|
||||||
new CustomEvent(eventName, {
|
new CustomEvent(eventName, {
|
||||||
|
|
Reference in New Issue