UNPKG

@scalar/api-client

Version:

the open source API testing client

79 lines (78 loc) 2.92 kB
import { defineComponent as f, useId as k, createBlock as n, openBlock as l, createSlots as s, withCtx as t, createElementVNode as a, createCommentVNode as y, createElementBlock as i, Fragment as _, renderList as h, createVNode as m, unref as r, toDisplayString as c, renderSlot as b } from "vue"; import { ScalarIcon as g } from "@scalar/components"; import v from "../../../../components/ViewLayout/ViewLayoutSection.vue.js"; import V from "../../../components/data-table/DataTable.vue.js"; import S from "../../../components/data-table/DataTableInput.vue.js"; import U from "../../../components/data-table/DataTableRow.vue.js"; const $ = { key: 0 }, w = { class: "flex flex-1 flex-col gap-1.5" }, B = ["for"], C = { class: "centered-y bg-b-2 flex-center absolute right-1 z-1 rounded px-1 py-0.5" }, L = /* @__PURE__ */ f({ __name: "Form", props: { title: {}, options: {}, data: {}, onUpdate: { type: Function }, environment: {} }, setup(D) { const d = k(); return (e, F) => (l(), n(v, { class: "last:rounded-b-lg" }, s({ default: t(() => [ a("div", w, [ Object.keys(e.data).length > 0 ? (l(), n(V, { key: 0, class: "rounded-b-lg", columns: [""] }, { default: t(() => [ (l(!0), i(_, null, h(e.options, (o, p) => (l(), n(U, { key: p }, { default: t(() => [ m(S, { id: r(d), class: "pr-9", environment: e.environment, lineWrapping: "", modelValue: e.data[o.key] ?? "", placeholder: o.placeholder, "onUpdate:modelValue": (u) => e.onUpdate(o.key, u) }, s({ default: t(() => [ a("label", { for: r(d) }, c(o.label), 9, B) ]), _: 2 }, [ o.key === "description" ? { name: "icon", fn: t(() => [ a("div", C, [ m(r(g), { icon: "Markdown", size: "lg" }) ]) ]), key: "0" } : void 0 ]), 1032, ["id", "environment", "modelValue", "placeholder", "onUpdate:modelValue"]) ]), _: 2 }, 1024))), 128)) ]), _: 1 })) : y("", !0) ]) ]), _: 2 }, [ e.title || e.$slots.title ? { name: "title", fn: t(() => [ e.title ? (l(), i("span", $, c(e.title), 1)) : b(e.$slots, "title", { key: 1 }) ]), key: "0" } : void 0 ]), 1024)); } }); export { L as default };