UNPKG

@scalar/api-client

Version:

the open source API testing client

37 lines (36 loc) 1.14 kB
import { defineComponent as l, computed as a, createElementBlock as i, openBlock as p, withModifiers as d, createVNode as f, createElementVNode as o, unref as m } from "vue"; import { ScalarIcon as c } from "@scalar/components"; import { getMediaTypeConfig as u } from "../consts/mediaTypes.js"; const x = ["download", "href"], h = /* @__PURE__ */ l({ __name: "ResponseBodyDownload", props: { href: {}, type: {}, filename: {} }, setup(t) { const n = t, r = a(() => { const s = u(n.type ?? "")?.extension ?? ".unknown"; return n.filename ? n.filename : `response${s}`; }); return (s, e) => (p(), i("a", { class: "text-c-3 text-xxs hover:bg-b-3 flex items-center gap-1 rounded px-1.5 py-0.5 no-underline", download: `${r.value}`, href: t.href, onClick: e[0] || (e[0] = d(() => { }, ["stop"])) }, [ f(m(c), { icon: "Download", size: "xs" }), e[1] || (e[1] = o("span", null, [ o("span", null, "Download"), o("span", { class: "sr-only" }, "Response Body") ], -1)) ], 8, x)); } }); export { h as default };