@scalar/api-client
Version:
the open source API testing client
64 lines (63 loc) • 2.33 kB
JavaScript
import { defineComponent as p, computed as n, createElementBlock as f, openBlock as v, createVNode as o, createElementVNode as x, withCtx as c, unref as u } from "vue";
import { ScalarButton as _ } from "@scalar/components";
import { LibraryIcon as b } from "@scalar/icons/library";
import h from "../../components/Form/LabelInput.vue.js";
import C from "../../components/IconSelector.vue.js";
import { useActiveEntities as V } from "../../store/active-entities.js";
import { useWorkspace as w } from "../../store/store.js";
const I = ["aria-label"], g = { class: "group relative ml-1.25" }, y = /* @__PURE__ */ p({
__name: "CollectionInfoForm",
setup(k) {
const { activeCollection: e } = V(), { collectionMutators: l } = w(), a = n(
() => e?.value?.["x-scalar-icon"] || "interface-content-folder"
), s = (t) => {
e?.value?.uid && l.edit(e?.value?.uid, "x-scalar-icon", t);
}, d = (t) => {
e.value && l.edit(e.value.uid, "info.title", t);
}, r = n(() => ({
icon: e?.value?.["x-scalar-icon"],
title: e?.value?.info?.title,
description: e?.value?.info?.description,
version: e?.value?.info?.version
}));
return (t, i) => (v(), f("div", {
"aria-label": `Collection: ${r.value.title}`,
class: "mx-auto flex h-fit w-full flex-col gap-2 pt-6 pb-3 md:mx-auto md:max-w-[720px]"
}, [
o(C, {
modelValue: a.value,
placement: "bottom-start",
"onUpdate:modelValue": i[0] || (i[0] = (m) => s(m))
}, {
default: c(() => [
o(u(_), {
class: "hover:bg-b-2 aspect-square h-7 w-7 cursor-pointer rounded border border-transparent p-0 hover:border-inherit",
variant: "ghost"
}, {
default: c(() => [
o(u(b), {
class: "text-c-2 size-5",
src: a.value,
"stroke-width": "2"
}, null, 8, ["src"])
]),
_: 1
})
]),
_: 1
}, 8, ["modelValue"]),
x("div", g, [
o(h, {
class: "text-xl font-bold",
inputId: "collectionName",
placeholder: "Untitled Collection",
value: r.value.title,
onUpdateValue: d
}, null, 8, ["value"])
])
], 8, I));
}
});
export {
y as default
};