@ark-ui/vue
Version:
A collection of unstyled, accessible UI components for Vue, utilizing state machines for seamless interaction.
27 lines (24 loc) • 772 B
JavaScript
import { defineComponent, computed, toDisplayString } from 'vue';
import { formatRelativeTime } from '@zag-js/i18n-utils';
import { useLocaleContext, DEFAULT_LOCALE } from '../../providers/locale/use-locale-context.js';
const _sfc_main = /* @__PURE__ */ defineComponent({
__name: "format-relative-time",
props: {
value: {},
localeMatcher: {},
numeric: {},
style: {}
},
setup(__props) {
const props = __props;
const locale = useLocaleContext(DEFAULT_LOCALE);
const text = computed(() => {
const { value, ...intlProps } = props;
return formatRelativeTime(value, locale.value.locale, intlProps);
});
return (_ctx, _cache) => {
return toDisplayString(text.value);
};
}
});
export { _sfc_main as default };