@ark-ui/vue
Version:
A collection of unstyled, accessible UI components for Vue, utilizing state machines for seamless interaction.
37 lines (34 loc) • 1.46 kB
JavaScript
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 { usePresence } from '../presence/use-presence.js';
import { ark } from '../factory.js';
import { useBottomSheetContext } from './use-bottom-sheet-context.js';
const _sfc_main = /* @__PURE__ */ defineComponent({
__name: "bottom-sheet-backdrop",
props: {
asChild: { type: Boolean }
},
setup(__props) {
const bottomSheet = useBottomSheetContext();
const renderStrategy = useRenderStrategyProps();
const presence = usePresence(
computed(() => ({
...renderStrategy.value,
present: bottomSheet.value.open
}))
);
const mergedProps = computed(() => mergeProps(bottomSheet.value.getBackdropProps(), 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 };