@scalar/api-client
Version:
the open source API testing client
34 lines (33 loc) • 1.33 kB
JavaScript
import { defineComponent as a, mergeModels as m, useModel as p, useId as c, createElementBlock as f, openBlock as v, createElementVNode as n, withDirectives as h, unref as u, withKeys as x, vModelText as _ } from "vue";
const b = { class: "group pointer-events-none flex flex-1 items-center gap-1" }, g = ["for"], w = ["id"], M = /* @__PURE__ */ a({
__name: "LabelInput",
props: {
modelValue: { required: !0 },
modelModifiers: {}
},
emits: /* @__PURE__ */ m(["blur"], ["update:modelValue"]),
setup(r, { emit: s }) {
const i = s, t = p(r, "modelValue"), o = c(), d = () => {
i("blur", t.value);
};
return (V, e) => (v(), f("div", b, [
n("label", {
class: "pointer-events-auto absolute top-0 left-0 h-full w-full cursor-text opacity-0",
for: u(o)
}, null, 8, g),
h(n("input", {
id: u(o),
"onUpdate:modelValue": e[0] || (e[0] = (l) => t.value = l),
class: "text-c-1 group-hover-input pointer-events-auto relative z-10 -ml-0.5 h-8 w-full flex-1 rounded pl-1.25 has-[:focus-visible]:outline md:-ml-1.25",
placeholder: "Untitled Document",
onBlur: d,
onKeydown: e[1] || (e[1] = x((l) => l.target?.blur(), ["enter"]))
}, null, 40, w), [
[_, t.value]
])
]));
}
});
export {
M as default
};