@vuesax-alpha/nightly
Version:
A Component Library for Vue 3
60 lines (57 loc) • 1.95 kB
JavaScript
import { defineComponent, inject, reactive, computed, provide, openBlock, createElementBlock, normalizeClass, unref, createElementVNode, renderSlot } from 'vue';
import '../../../hooks/index.mjs';
import { navbarContextKey, navbarGroupRegisterContextKey } from '../../../tokens/navbar.mjs';
import _export_sfc from '../../../_virtual/plugin-vue_export-helper.mjs';
import { useNamespace } from '../../../hooks/use-namespace/index.mjs';
const __default__ = defineComponent({
name: "VsNavbarGroup"
});
const _sfc_main = defineComponent({
...__default__,
setup(__props) {
const { modelValue } = inject(navbarContextKey);
const ns = useNamespace("navbar-group");
const children = reactive(/* @__PURE__ */ new Set());
const isGroupActive = computed(() => children.has(`${modelValue.value}`));
provide(navbarGroupRegisterContextKey, (id) => {
children.add(id);
return {
unregister: () => children.delete(id)
};
});
return (_ctx, _cache) => {
return openBlock(), createElementBlock(
"div",
{
class: normalizeClass([unref(ns).b(), unref(ns).is("active", isGroupActive.value)])
},
[
createElementVNode(
"div",
{
class: normalizeClass(unref(ns).e("text"))
},
[
renderSlot(_ctx.$slots, "default")
],
2
),
createElementVNode(
"div",
{
class: normalizeClass(unref(ns).e("items"))
},
[
renderSlot(_ctx.$slots, "items")
],
2
)
],
2
);
};
}
});
var NavbarGroup = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "/home/runner/work/vuesax-alpha/vuesax-alpha/packages/components/navbar/src/navbar-group.vue"]]);
export { NavbarGroup as default };
//# sourceMappingURL=navbar-group2.mjs.map