@ark-ui/vue
Version:
A collection of unstyled, accessible UI components for Vue, utilizing state machines for seamless interaction.
35 lines (32 loc) • 1.38 kB
JavaScript
import { defineComponent, computed, createBlock, openBlock, unref, mergeProps, withCtx, renderSlot } from 'vue';
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 { createSplitProps } from '../create-split-props.js';
const _sfc_main = /* @__PURE__ */ defineComponent({
__name: "tree-view-branch-content",
props: {
asChild: { type: Boolean }
},
setup(__props) {
const splitVisibilityProps = createSplitProps();
const treeView = useTreeViewContext();
const ndoeProps = useTreeViewNodePropsContext();
const branchContentProps = computed(() => {
const contentProps = treeView.value.getBranchContentProps(ndoeProps);
const [, ownProps] = splitVisibilityProps(contentProps, ["hidden", "data-state"]);
return ownProps;
});
useForwardExpose();
return (_ctx, _cache) => {
return openBlock(), createBlock(unref(collapsible).Content, mergeProps(branchContentProps.value, { "as-child": __props.asChild }), {
default: withCtx(() => [
renderSlot(_ctx.$slots, "default")
]),
_: 3
}, 16, ["as-child"]);
};
}
});
export { _sfc_main as default };