@ark-ui/vue
Version:
A collection of unstyled, accessible UI components for Vue, utilizing state machines for seamless interaction.
35 lines (32 loc) • 1.29 kB
JavaScript
import { defineComponent, computed, createBlock, openBlock, unref, mergeProps, withCtx, renderSlot, createTextVNode, toDisplayString } from 'vue';
import { ark } from '../factory.js';
import { carouselAnatomy } from './carousel.anatomy.js';
import { useCarouselContext } from './use-carousel-context.js';
import { useForwardExpose } from '../../utils/use-forward-expose.js';
const _sfc_main = /* @__PURE__ */ defineComponent({
__name: "carousel-progress-text",
props: {
asChild: { type: Boolean }
},
setup(__props) {
const parts = carouselAnatomy.build();
const carousel = useCarouselContext();
const progressText = computed(() => {
const currentPage = carousel.value.page + 1;
const totalPages = carousel.value.pageSnapPoints.length;
return `${currentPage} / ${totalPages}`;
});
useForwardExpose();
return (_ctx, _cache) => {
return openBlock(), createBlock(unref(ark).span, mergeProps(unref(parts).progressText.attrs, { "as-child": __props.asChild }), {
default: withCtx(() => [
renderSlot(_ctx.$slots, "default", {}, () => [
createTextVNode(toDisplayString(progressText.value), 1)
])
]),
_: 3
}, 16, ["as-child"]);
};
}
});
export { _sfc_main as default };