31 lines
769 B
Vue
31 lines
769 B
Vue
<script setup lang="ts">
|
|
import { computed, inject, useAttrs } from "vue";
|
|
import { indicatorContextKey } from "../progress/value";
|
|
import { PROGRESS_CIRCLE_CENTER } from "./constants";
|
|
|
|
defineOptions({ inheritAttrs: false });
|
|
|
|
const attrs = useAttrs();
|
|
const ctx = inject(indicatorContextKey, undefined);
|
|
|
|
const rootClass = computed(() => ctx?.slots.value.track);
|
|
|
|
const viewBox = computed(() => {
|
|
const explicit = attrs.viewBox;
|
|
if (explicit != null && explicit !== "") return explicit as string;
|
|
return `0 0 ${PROGRESS_CIRCLE_CENTER * 2} ${PROGRESS_CIRCLE_CENTER * 2}`;
|
|
});
|
|
</script>
|
|
|
|
<template>
|
|
<svg
|
|
v-bind="attrs"
|
|
:class="rootClass"
|
|
:viewBox="viewBox"
|
|
fill="none"
|
|
data-slot="progress-circle-track"
|
|
>
|
|
<slot />
|
|
</svg>
|
|
</template>
|