Tools for awaiting ready -- still can't make focus() work

This commit is contained in:
Ian Gulliver
2024-12-23 14:09:06 -08:00
parent 5e3d144d7a
commit 2082444b3b
14 changed files with 145 additions and 45 deletions

View File

@@ -1,3 +1,4 @@
import { waitForAnimationFrame } from "./event";
import { SLElem } from "./slelem";
import { SLIcon } from "./slicon";
@@ -6,34 +7,34 @@ export class SLInput extends SLElem {
super("sl-input");
}
public addIcon(name: string, slot: "prefix" | "suffix"): SLIcon {
addIcon(name: string, slot: "prefix" | "suffix"): SLIcon {
const icon = new SLIcon(name);
icon.setSlot(slot);
this.append(icon);
return icon;
}
public addPrefixIcon(name: string): SLIcon {
addPrefixIcon(name: string): SLIcon {
return this.addIcon(name, "prefix");
}
public addSuffixIcon(name: string): SLIcon {
addSuffixIcon(name: string): SLIcon {
return this.addIcon(name, "suffix");
}
public clear() {
clear() {
(this.elem as HTMLInputElement).value = "";
}
public getValue(): string {
getValue(): string {
return (this.elem as HTMLInputElement).value;
}
public focus() {
focus() {
(this.elem as HTMLInputElement).focus();
}
public setPill() {
setPill() {
this.setAttribute("pill", "");
}
}
}