import { defineComponent, h } from "vue";
import { cx, eventValue, iconNode } from "../utils.js";
export default defineComponent({
name: "GnTextarea",
inheritAttrs: false,
props: {
modelValue: { type: String, default: "" },
label: { type: String, default: "" },
icon: { type: String, default: "" },
state: { type: String, default: "" },
help: { type: String, default: "" }
},
emits: ["update:modelValue"],
setup(props, { attrs, emit }) {
return () => h("div", { class: "form-group" }, [
h("label", { class: cx("label", props.state) }, [
props.label,
iconNode(props.icon),
h("textarea", {
...attrs,
value: props.modelValue,
class: cx("input", attrs.class),
onInput: event => emit("update:modelValue", eventValue(event))
})
]),
props.help && h("div", { class: cx("input-info", props.state === "error" && "error") }, props.help)
]);
}
});