2024-12-01 17:20:21 +01:00
|
|
|
<script setup lang="ts">
|
|
|
|
|
import { cn } from "@/lib/utils";
|
2025-04-10 13:55:56 +02:00
|
|
|
import type { PrimitiveProps } from "reka-ui";
|
|
|
|
|
import { Primitive } from "reka-ui";
|
|
|
|
|
import { type HTMLAttributes, computed } from "vue";
|
2024-12-01 17:20:21 +01:00
|
|
|
import { type BadgeVariants, badgeVariants } from ".";
|
|
|
|
|
|
2025-04-10 13:55:56 +02:00
|
|
|
const props = defineProps<
|
|
|
|
|
PrimitiveProps & {
|
|
|
|
|
variant?: BadgeVariants["variant"];
|
|
|
|
|
class?: HTMLAttributes["class"];
|
|
|
|
|
}
|
|
|
|
|
>();
|
|
|
|
|
|
|
|
|
|
const delegatedProps = computed(() => {
|
|
|
|
|
const { class: _, ...delegated } = props;
|
|
|
|
|
|
|
|
|
|
return delegated;
|
|
|
|
|
});
|
2024-12-01 17:20:21 +01:00
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<template>
|
2025-04-10 13:55:56 +02:00
|
|
|
<Primitive
|
|
|
|
|
data-slot="badge"
|
|
|
|
|
:class="cn(badgeVariants({ variant }), props.class)"
|
|
|
|
|
v-bind="delegatedProps"
|
|
|
|
|
>
|
2024-12-01 17:20:21 +01:00
|
|
|
<slot />
|
2025-04-10 13:55:56 +02:00
|
|
|
</Primitive>
|
2024-12-01 17:20:21 +01:00
|
|
|
</template>
|