UNPKG

@ark-ui/vue

Version:

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

42 lines (39 loc) 1.6 kB
import { defineComponent, computed, createBlock, createCommentVNode, unref, openBlock, mergeProps as mergeProps$1, withCtx, renderSlot } from 'vue'; import { mergeProps } from '@zag-js/vue'; import { useForwardExpose } from '../../utils/use-forward-expose.js'; import { useRenderStrategyProps } from '../../utils/use-render-strategy.js'; import { useTabsContext } from './use-tabs-context.js'; import { usePresence } from '../presence/use-presence.js'; import { PresenceProvider } from '../presence/use-presence-context.js'; import { ark } from '../factory.js'; const _sfc_main = /* @__PURE__ */ defineComponent({ __name: "tab-content", props: { value: {}, asChild: { type: Boolean } }, setup(__props) { const props = __props; const tabs = useTabsContext(); const renderStrategy = useRenderStrategyProps(); const presence = usePresence( computed(() => ({ ...renderStrategy.value, present: tabs.value.value === props.value, immediate: true })) ); PresenceProvider(presence); const mergedProps = computed(() => mergeProps(tabs.value.getContentProps(props), presence.value.presenceProps)); useForwardExpose(); return (_ctx, _cache) => { return !unref(presence).unmounted ? (openBlock(), createBlock(unref(ark).div, mergeProps$1({ key: 0 }, mergedProps.value, { "as-child": __props.asChild }), { default: withCtx(() => [ renderSlot(_ctx.$slots, "default") ]), _: 3 }, 16, ["as-child"])) : createCommentVNode("", true); }; } }); export { _sfc_main as default };