@scalar/api-reference
Version:
Generate beautiful API references from OpenAPI documents
76 lines (75 loc) • 2.64 kB
JavaScript
import { defineComponent as h, ref as $, createBlock as b, openBlock as c, withCtx as e, createVNode as s, unref as t, normalizeClass as l, createElementVNode as d, createElementBlock as u, createCommentVNode as m, renderSlot as n } from "vue";
import { Disclosure as k, DisclosureButton as S, DisclosurePanel as B } from "@headlessui/vue";
import { ScalarIconCaretRight as C } from "@scalar/icons";
import { useElementHover as y } from "@vueuse/core";
import { useNavState as E } from "../../hooks/useNavState.js";
import N from "../IntersectionObserver.vue.js";
const D = { class: "section-accordion-button-content" }, I = {
key: 0,
class: "section-accordion-button-actions"
}, V = {
key: 0,
class: "section-accordion-description"
}, g = { class: "section-accordion-content-card" }, j = /* @__PURE__ */ h({
__name: "SectionAccordion",
props: {
id: {},
transparent: { type: Boolean }
},
setup(r) {
const i = $(), f = y(i), { isIntersectionEnabled: p, replaceUrlState: v } = E(), _ = () => {
!r.id || !p.value || v(r.id);
};
return (o, w) => (c(), b(N, {
id: o.id,
class: "section-wrapper",
onIntersecting: _
}, {
default: e(() => [
s(t(k), {
as: "section",
class: l(["section-accordion", { "section-accordion-transparent": o.transparent }])
}, {
default: e(({ open: a }) => [
s(t(S), {
ref_key: "button",
ref: i,
class: "section-accordion-button"
}, {
default: e(() => [
d("div", D, [
n(o.$slots, "title", {}, void 0, !0)
]),
o.$slots.actions ? (c(), u("div", I, [
n(o.$slots, "actions", {
active: t(f) || a
}, void 0, !0)
])) : m("", !0),
s(t(C), {
class: l(["section-accordion-chevron size-4.5 transition-transform", { "rotate-90": a }])
}, null, 8, ["class"])
]),
_: 2
}, 1536),
s(t(B), { class: "section-accordion-content" }, {
default: e(() => [
o.$slots.description ? (c(), u("div", V, [
n(o.$slots, "description", {}, void 0, !0)
])) : m("", !0),
d("div", g, [
n(o.$slots, "default", {}, void 0, !0)
])
]),
_: 3
})
]),
_: 3
}, 8, ["class"])
]),
_: 3
}, 8, ["id"]));
}
});
export {
j as default
};