@nextcloud/vue
Version:
Nextcloud vue components
53 lines (52 loc) • 1.8 kB
JavaScript
import '../assets/NcCounterBubble-ZnteskDR.css';
import { defineComponent, computed, createElementBlock, openBlock, normalizeClass, toDisplayString } from "vue";
import { getCanonicalLocale } from "@nextcloud/l10n";
import { _ as _export_sfc } from "./_plugin-vue_export-helper-1tPrXgE0.mjs";
const _hoisted_1 = ["title"];
const _sfc_main = /* @__PURE__ */ defineComponent({
__name: "NcCounterBubble",
props: {
count: {},
active: { type: Boolean },
type: { default: "" },
raw: { type: Boolean }
},
setup(__props) {
const props = __props;
const humanizedCount = computed(() => {
if (props.raw) {
return props.count.toString();
}
const formatter = new Intl.NumberFormat(getCanonicalLocale(), {
notation: "compact",
compactDisplay: "short"
});
return formatter.format(props.count);
});
const originalCountAsTitleIfNeeded = computed(() => {
if (props.raw) {
return;
}
const countAsString = props.count.toString();
if (countAsString === humanizedCount.value) {
return;
}
return countAsString;
});
return (_ctx, _cache) => {
return openBlock(), createElementBlock("div", {
class: normalizeClass(["counter-bubble__counter", {
active: _ctx.active,
"counter-bubble__counter--highlighted": _ctx.type === "highlighted",
"counter-bubble__counter--outlined": _ctx.type === "outlined"
}]),
title: originalCountAsTitleIfNeeded.value
}, toDisplayString(humanizedCount.value), 11, _hoisted_1);
};
}
});
const NcCounterBubble = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-36ffc13f"]]);
export {
NcCounterBubble as N
};
//# sourceMappingURL=NcCounterBubble-CxxHHh8i.mjs.map