UNPKG

@scalar/api-client

Version:

the open source API testing client

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