UNPKG

@scalar/api-client

Version:

the open source API testing client

41 lines (40 loc) 1.36 kB
import { defineComponent as u, ref as c, createBlock as d, openBlock as s, Transition as m, withCtx as l, createElementBlock as f, createCommentVNode as g, unref as o, createVNode as i, createTextVNode as v } from "vue"; import { useLoadingState as p, ScalarLoading as x, ScalarButton as L } from "@scalar/components"; const S = { key: 0, class: "bg-b-1 z-overlay absolute inset-0 flex flex-col items-center justify-center gap-6" }, y = /* @__PURE__ */ u({ __name: "ResponseLoadingOverlay", props: { events: {} }, setup(r) { const e = p(), a = c(); return r.events.requestStatus.on((n) => { n === "start" ? a.value = setTimeout(() => e.startLoading(), 1e3) : (clearTimeout(a.value), a.value = void 0, e.stopLoading()); }), (n, t) => (s(), d(m, null, { default: l(() => [ o(e).isLoading ? (s(), f("div", S, [ i(o(x), { class: "text-c-3", loadingState: o(e), size: "3xl" }, null, 8, ["loadingState"]), i(o(L), { variant: "ghost", onClick: t[0] || (t[0] = (k) => n.events.cancelRequest.emit()) }, { default: l(() => [...t[1] || (t[1] = [ v(" Cancel ", -1) ])]), _: 1 }) ])) : g("", !0) ]), _: 1 })); } }); export { y as default };