<script setup lang="ts">
import type { LabelProps as RekaLabelProps } from "reka-ui"
import type { HTMLAttributes } from "vue"
import type { LabelVariants } from "."
import { reactiveOmit } from "@vueuse/core"
import { Label as LabelRoot } from "reka-ui"
import { cn } from "@/lib/utils"
import { labelVariants } from "."

export interface LabelProps extends RekaLabelProps {
  required?: LabelVariants["required"]
  class?: HTMLAttributes["class"]
}

const props = defineProps<LabelProps>()

const delegatedProps = reactiveOmit(props, "class", "required")
</script>

<template>
  <LabelRoot
    v-bind="delegatedProps"
    :class="cn(labelVariants({ required }), props.class)"
  >
    <slot />
  </LabelRoot>
</template>
