UNPKG

@ark-ui/vue

Version:

A collection of unstyled, accessible UI components for Vue, utilizing state machines for seamless interaction.

40 lines (37 loc) 1.68 kB
import { defineComponent, computed, createBlock, openBlock, unref, mergeProps, withCtx, renderSlot } from 'vue'; import { useRenderStrategyProps } from '../../utils/use-render-strategy.js'; import { useForwardExpose } from '../../utils/use-forward-expose.js'; import * as collapsible from '../collapsible/collapsible.js'; import { useTreeViewContext } from './use-tree-view-context.js'; import { useTreeViewNodePropsContext } from './use-tree-view-node-props-context.js'; import { useTreeViewNodeContext } from './use-tree-view-node-context.js'; const _sfc_main = /* @__PURE__ */ defineComponent({ __name: "tree-view-branch", props: { asChild: { type: Boolean } }, setup(__props) { const treeView = useTreeViewContext(); const nodeProps = useTreeViewNodePropsContext(); const nodeState = useTreeViewNodeContext(); const renderStrategyProps = useRenderStrategyProps(); const branchContentProps = computed(() => treeView.value.getBranchContentProps(nodeProps)); useForwardExpose(); return (_ctx, _cache) => { return openBlock(), createBlock(unref(collapsible).Root, mergeProps({ open: unref(nodeState).expanded, ids: { content: branchContentProps.value.id } }, unref(treeView).getBranchProps(unref(nodeProps)), { "lazy-mount": unref(renderStrategyProps).lazyMount, "unmount-on-exit": unref(renderStrategyProps).unmountOnExit, "as-child": _ctx.asChild }), { default: withCtx(() => [ renderSlot(_ctx.$slots, "default") ]), _: 3 }, 16, ["open", "ids", "lazy-mount", "unmount-on-exit", "as-child"]); }; } }); export { _sfc_main as default };