@ark-ui/vue
Version:
A collection of unstyled, accessible UI components for Vue, utilizing state machines for seamless interaction.
32 lines (29 loc) • 1.14 kB
JavaScript
import { defineComponent, computed, createBlock, createCommentVNode, openBlock, unref, mergeProps, withCtx, renderSlot } from 'vue';
import { ark } from '../factory.js';
import { comboboxAnatomy } from './combobox.anatomy.js';
import { useComboboxContext } from './use-combobox-context.js';
import { useForwardExpose } from '../../utils/use-forward-expose.js';
const _sfc_main = /* @__PURE__ */ defineComponent({
__name: "combobox-empty",
props: {
asChild: { type: Boolean }
},
setup(__props) {
const parts = comboboxAnatomy.build();
const combobox = useComboboxContext();
const isEmpty = computed(() => combobox.value.collection.size === 0);
useForwardExpose();
return (_ctx, _cache) => {
return isEmpty.value ? (openBlock(), createBlock(unref(ark).div, mergeProps({ key: 0 }, unref(parts).empty.attrs, {
role: "presentation",
"as-child": __props.asChild
}), {
default: withCtx(() => [
renderSlot(_ctx.$slots, "default")
]),
_: 3
}, 16, ["as-child"])) : createCommentVNode("", true);
};
}
});
export { _sfc_main as default };