UNPKG

@scalar/api-client

Version:

the open source API testing client

62 lines (61 loc) 2.5 kB
import { defineComponent as u, computed as d, createBlock as c, openBlock as t, unref as o, withCtx as l, createElementVNode as s, createElementBlock as i, createCommentVNode as a, toDisplayString as m } from "vue"; import { ScalarPopover as x } from "@scalar/components"; import { ScalarIconWarning as f, ScalarIconInfo as h } from "@scalar/icons"; import { parameterIsInvalid as r } from "../libs/request.js"; const v = ["aria-label", "role"], y = { class: "w-content text-xxs text-c-1 grid min-w-48 gap-1.5 rounded px-1.5 pt-2 pb-1.5 leading-none" }, k = { key: 0, class: "text-error-1" }, g = { key: 1, class: "schema text-c-2 flex items-center" }, b = { key: 0 }, I = { key: 1 }, S = { key: 2 }, w = { key: 3 }, B = { key: 4 }, C = { key: 2, class: "text-sm leading-snug text-pretty", style: { maxWidth: "16rem" } }, W = /* @__PURE__ */ u({ __name: "RequestTableTooltip", props: { item: {} }, setup(e) { const n = d(() => !!r(e.item).value); return (p, z) => (t(), c(o(x), { teleport: "", offset: 4, placement: "left" }, { popover: l(() => [ s("div", y, [ n.value ? (t(), i("div", k, m(o(r)(e.item).value), 1)) : e.item.type || e.item.format || e.item.minimum || e.item.maximum || e.item.default ? (t(), i("div", g, [ e.item.type ? (t(), i("span", b, m(e.item.type), 1)) : a("", !0), e.item.format ? (t(), i("span", I, m(e.item.format), 1)) : a("", !0), e.item.minimum ? (t(), i("span", S, "min: " + m(e.item.minimum), 1)) : a("", !0), e.item.maximum ? (t(), i("span", w, "max: " + m(e.item.maximum), 1)) : a("", !0), e.item.default ? (t(), i("span", B, "default: " + m(e.item.default), 1)) : a("", !0) ])) : a("", !0), e.item.description && !n.value ? (t(), i("span", C, m(e.item.description), 1)) : a("", !0) ]) ]), default: l(() => [ s("button", { type: "button", "aria-label": n.value ? "Input is invalid" : "More Information", class: "text-c-2 hover:text-c-1 hover:bg-b-2 rounded p-1", role: n.value ? "alert" : "none" }, [ n.value ? (t(), c(o(f), { key: 0, class: "text-orange size-3.5 brightness-90 hover:brightness-75" })) : (t(), c(o(h), { key: 1, class: "text-c-2 hover:text-c-1 size-3.5" })) ], 8, v) ]), _: 1 })); } }); export { W as default };