@ark-ui/vue
Version:
A collection of unstyled, accessible UI components for Vue, utilizing state machines for seamless interaction.
32 lines (29 loc) • 1.13 kB
JavaScript
import { defineComponent, computed, createBlock, createCommentVNode, openBlock, unref, mergeProps, withCtx, renderSlot } from 'vue';
import { ark } from '../factory.js';
import { listboxAnatomy } from './listbox.anatomy.js';
import { useListboxContext } from './use-listbox-context.js';
import { useForwardExpose } from '../../utils/use-forward-expose.js';
const _sfc_main = /* @__PURE__ */ defineComponent({
__name: "listbox-empty",
props: {
asChild: { type: Boolean }
},
setup(__props) {
const parts = listboxAnatomy.build();
const listbox = useListboxContext();
const isEmpty = computed(() => listbox.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 };