UNPKG

@scalar/api-reference

Version:

Generate beautiful API references from OpenAPI documents

61 lines (60 loc) 2.32 kB
import { defineComponent, createElementBlock, openBlock, createElementVNode, createBlock, createCommentVNode, normalizeClass, createVNode, unref, withCtx, renderSlot } from "vue"; import { ScalarIconCaretRight } from "@scalar/icons"; import Section from "./Section.vue.js"; import _sfc_main$1 from "../Anchor/Anchor.vue.js"; const _hoisted_1 = ["aria-label"]; const _hoisted_2 = ["id", "aria-controls", "aria-expanded"]; const _sfc_main = /* @__PURE__ */ defineComponent({ __name: "CompactSection", props: { id: {}, label: {}, modelValue: { type: Boolean } }, emits: ["update:modelValue", "copyAnchorUrl"], setup(__props, { emit: __emit }) { const emit = __emit; return (_ctx, _cache) => { return openBlock(), createElementBlock("section", { "aria-label": __props.label, class: "collapsible-section" }, [ createElementVNode("button", { id: __props.id, "aria-controls": __props.id, "aria-expanded": __props.modelValue, class: normalizeClass(["collapsible-section-trigger", { "collapsible-section-trigger-open": __props.modelValue }]), type: "button", onClick: _cache[1] || (_cache[1] = ($event) => emit("update:modelValue", !__props.modelValue)) }, [ createVNode(unref(ScalarIconCaretRight), { class: normalizeClass(["size-3 transition-transform duration-100", { "rotate-90": __props.modelValue }]), weight: "bold" }, null, 8, ["class"]), createVNode(unref(_sfc_main$1), { class: "collapsible-section-header", onCopyAnchorUrl: _cache[0] || (_cache[0] = () => emit("copyAnchorUrl")) }, { default: withCtx(() => [ renderSlot(_ctx.$slots, "heading", {}, void 0, true) ]), _: 3 }) ], 10, _hoisted_2), __props.modelValue ? (openBlock(), createBlock(Section, { key: 0, class: "collapsible-section-content", label: __props.label }, { default: withCtx(() => [ renderSlot(_ctx.$slots, "default", {}, void 0, true) ]), _: 3 }, 8, ["label"])) : createCommentVNode("", true) ], 8, _hoisted_1); }; } }); export { _sfc_main as default };