feat: add ProgressBar ProgressCircle and Meter
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
<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>
|
||||
Reference in New Issue
Block a user