UNPKG

@ark-ui/vue

Version:

A collection of unstyled, accessible UI components for Vue, utilizing state machines for seamless interaction.

31 lines (28 loc) 1.13 kB
import { defineComponent, computed, createBlock, openBlock, unref, mergeProps, withCtx, createTextVNode, toDisplayString } from 'vue'; import { uniq } from '@zag-js/utils'; import { useForwardExpose } from '../../utils/use-forward-expose.js'; import { ark } from '../factory.js'; import { useDatePickerContext } from './use-date-picker-context.js'; const _sfc_main = /* @__PURE__ */ defineComponent({ __name: "date-picker-range-text", props: { asChild: { type: Boolean } }, setup(__props) { const datePicker = useDatePickerContext(); const visibleRangeText = computed(() => { const { start, end } = datePicker.value.visibleRangeText; return uniq([start, end]).filter(Boolean).join(" - "); }); useForwardExpose(); return (_ctx, _cache) => { return openBlock(), createBlock(unref(ark).div, mergeProps(unref(datePicker).getRangeTextProps(), { "as-child": _ctx.asChild }), { default: withCtx(() => [ createTextVNode(toDisplayString(visibleRangeText.value), 1) ]), _: 1 }, 16, ["as-child"]); }; } }); export { _sfc_main as default };