monorepo/glimmer/web/build/components/TextField.js

38 lines
939 B
JavaScript

export class TextField extends HTMLElement {
field;
static get observedAttributes() {
return ["placeholder", "text"];
}
constructor() {
super();
this.field = document.createElement("input");
}
get placeholder() {
return this.getAttribute("placeholder");
}
set placeholder(text) {
if (text) {
this.setAttribute("placeholder", text);
}
else {
this.removeAttribute("placeholder");
}
this.field.placeholder = text || "";
}
get text() {
return this.getAttribute("text");
}
set text(text) {
if (text) {
this.setAttribute("text", text);
}
else {
this.removeAttribute("text");
}
this.field.placeholder = text || "";
}
connectedCallback() {
this.appendChild(this.field);
}
}
//# sourceMappingURL=TextField.js.map