@webwriter/timeline
Version:
Create/learn with a digital timeline and test your knowledge.
54 lines (48 loc) • 1.44 kB
text/typescript
import { html, css } from "lit";
import { LitElementWw } from "@webwriter/lit";
import { customElement, property } from "lit/decorators.js";
import "@shoelace-style/shoelace/dist/themes/light.css";
import { SlInput } from "@shoelace-style/shoelace";
("dialog-input")
export class DialogInput extends LitElementWw {
({ type: Number, attribute: true, reflect: true })
accessor tabIndex = -1;
({ type: String }) accessor label = "";
({ type: String }) accessor id = "";
({ type: String }) accessor value = "";
({ type: String }) accessor placeholder = "";
({ type: Boolean, reflect: true }) accessor required = false;
({ type: Boolean, reflect: true }) accessor disabled;
({ type: String }) accessor type: "input" | "textarea";
static styles = css`
:host {
display: block;
/* margin-bottom: 20px; */
}
.half-input {
min-width: 45%;
}
`;
static get scopedElements() {
return {
"sl-input": SlInput,
};
}
render() {
return html`
<sl-input
label=${this.label}
id=${this.id}
.value=${this.value}
placeholder=${this.placeholder}
?required=${this.required}
@sl-change=${this.setTnput}
clearable
></sl-input>
`;
}
// set the value for input
setTnput(event) {
this.value = event.target.value;
}
}