@scalar/api-client
Version:
the open source API testing client
57 lines (56 loc) • 1.61 kB
JavaScript
import { defineComponent as p, ref as f, computed as s, watch as b, createBlock as v, openBlock as k, unref as x, withCtx as r, createVNode as m, createTextVNode as V } from "vue";
import { ScalarModal as _ } from "@scalar/components";
import w from "../../../../components/CommandPalette/CommandActionForm.vue.js";
import C from "../../../../components/CommandPalette/CommandActionInput.vue.js";
const g = /* @__PURE__ */ p({
__name: "CreateWorkspaceModal",
props: {
state: {}
},
emits: ["create:workspace"],
setup(l, { emit: d }) {
const n = d, e = f(""), a = s(() => e.value.trim()), i = s(
() => a.value.length === 0
);
b(
() => l.state.open,
(o) => {
o && (e.value = "");
}
);
const u = () => {
a.value && (n("create:workspace", {
name: a.value
}), l.state.hide());
};
return (o, t) => (k(), v(x(_), {
bodyClass: "border-t-0 rounded-t-lg",
size: "xs",
state: o.state
}, {
default: r(() => [
m(w, {
disabled: i.value,
onSubmit: u
}, {
submit: r(() => [...t[1] || (t[1] = [
V("Add Workspace", -1)
])]),
default: r(() => [
m(C, {
modelValue: e.value,
"onUpdate:modelValue": t[0] || (t[0] = (c) => e.value = c),
class: "-mt-[.5px] !p-0",
placeholder: "Workspace name"
}, null, 8, ["modelValue"])
]),
_: 1
}, 8, ["disabled"])
]),
_: 1
}, 8, ["state"]));
}
});
export {
g as default
};