@ark-ui/vue
Version:
A collection of unstyled, accessible UI components for Vue, utilizing state machines for seamless interaction.
37 lines (34 loc) • 1.37 kB
JavaScript
import { defineComponent, computed, createBlock, createCommentVNode, unref, openBlock, mergeProps, withCtx, renderSlot } from 'vue';
import { useRenderStrategyProps } from '../../utils/use-render-strategy.js';
import { usePresence } from '../presence/use-presence.js';
import { PresenceProvider } from '../presence/use-presence-context.js';
import { useSelectContext } from './use-select-context.js';
import { useForwardExpose } from '../../utils/use-forward-expose.js';
import { ark } from '../factory.js';
const _sfc_main = /* @__PURE__ */ defineComponent({
__name: "select-positioner",
props: {
asChild: { type: Boolean }
},
setup(__props) {
const select = useSelectContext();
const renderStrategy = useRenderStrategyProps();
const presence = usePresence(
computed(() => ({
...renderStrategy.value,
present: select.value.open
}))
);
PresenceProvider(presence);
useForwardExpose();
return (_ctx, _cache) => {
return !unref(presence).unmounted ? (openBlock(), createBlock(unref(ark).div, mergeProps({ key: 0 }, unref(select).getPositionerProps(), { "as-child": _ctx.asChild }), {
default: withCtx(() => [
renderSlot(_ctx.$slots, "default")
]),
_: 3
}, 16, ["as-child"])) : createCommentVNode("", true);
};
}
});
export { _sfc_main as default };