UNPKG

@scalar/api-client

Version:

the open source API testing client

71 lines (70 loc) 2.84 kB
import { defineComponent as b, computed as p, createElementBlock as v, openBlock as h, createVNode as a, createElementVNode as V, withCtx as c, unref as f } from "vue"; import { ScalarButton as w } from "@scalar/components"; import { LibraryIcon as I } from "@scalar/icons/library"; import g from "../../components/Form/LabelInput.vue.js"; import k from "../../components/IconSelector.vue.js"; import { useActiveEntities as B } from "../../store/active-entities.js"; import { useWorkspace as E } from "../../store/store.js"; const N = ["aria-label"], U = { class: "group relative ml-1.25" }, S = /* @__PURE__ */ b({ __name: "CollectionInfoForm", setup(L) { const { activeCollection: e } = B(), { collectionMutators: l } = E(), n = p( () => { var t; return ((t = e == null ? void 0 : e.value) == null ? void 0 : t["x-scalar-icon"]) || "interface-content-folder"; } ), x = (t) => { var r, o; (r = e == null ? void 0 : e.value) != null && r.uid && l.edit((o = e == null ? void 0 : e.value) == null ? void 0 : o.uid, "x-scalar-icon", t); }, _ = (t) => { e.value && l.edit(e.value.uid, "info.title", t); }, u = p(() => { var t, r, o, s, i, d, m; return { icon: (t = e == null ? void 0 : e.value) == null ? void 0 : t["x-scalar-icon"], title: (o = (r = e == null ? void 0 : e.value) == null ? void 0 : r.info) == null ? void 0 : o.title, description: (i = (s = e == null ? void 0 : e.value) == null ? void 0 : s.info) == null ? void 0 : i.description, version: (m = (d = e == null ? void 0 : e.value) == null ? void 0 : d.info) == null ? void 0 : m.version }; }); return (t, r) => (h(), v("div", { "aria-label": `Collection: ${u.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]" }, [ a(k, { modelValue: n.value, placement: "bottom-start", "onUpdate:modelValue": r[0] || (r[0] = (o) => x(o)) }, { default: c(() => [ a(f(w), { 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(() => [ a(f(I), { class: "text-c-2 size-5", src: n.value, "stroke-width": "2" }, null, 8, ["src"]) ]), _: 1 }) ]), _: 1 }, 8, ["modelValue"]), V("div", U, [ a(g, { class: "text-xl font-bold", inputId: "collectionName", placeholder: "Untitled Collection", value: u.value.title, onUpdateValue: _ }, null, 8, ["value"]) ]) ], 8, N)); } }); export { S as default };