@neu-ui/web-components
Version:
A Neumorphic web component library built with @microsoft/fast-element and Vite using javascript
44 lines (43 loc) • 1.33 kB
JavaScript
var a = Object.defineProperty;
var o = (s, t, i) => t in s ? a(s, t, { enumerable: !0, configurable: !0, writable: !0, value: i }) : s[t] = i;
var h = (s, t, i) => o(s, typeof t != "symbol" ? t + "" : t, i);
import { FASTElement as r } from "@microsoft/fast-element";
import { InputDefinition as p } from "./input.definition.es.js";
const l = class l extends r {
constructor() {
super(), this.disabled = !1, this.required = !1, this.value = "", this.placeholder = "", this.type = "text", this.id = "", this.size;
}
attributeChangedCallback(t, i, e) {
t === "disabled" && (this.disabled = e !== null), t === "required" && (this.required = e !== null), t === "placeholder" && (this.placeholder = e), t === "type" && (l.validInputTypes.includes(e) ? this.type = e : this.type = "text"), t === "id" && (this.id = e), t === "size" && (this.size = e), super.attributeChangedCallback(t, i, e);
}
handleInput(t) {
this.value = t.target.value;
}
handleChange() {
const t = new Event("change", {
bubbles: !0,
composed: !0
});
this.dispatchEvent(t);
}
};
h(l, "validInputTypes", [
"text",
"email",
"password",
"number",
"tel",
"url",
"search",
"date",
"datetime-local",
"month",
"week",
"time",
"color"
]);
let d = l;
r.define(d, p);
export {
d as Input
};