<script setup lang="ts">
import { type HTMLAttributes, computed } from 'vue'
import { Label as LabelPrimitive } from 'reka-ui'
import { cn } from '@/lib/utils'

interface LabelProps {
  for?: string
  class?: HTMLAttributes['class']
}

const props = defineProps<LabelProps>()

const delegatedProps = computed(() => {
  const { class: _, ...delegated } = props
  return delegated
})
</script>

<template>
  <LabelPrimitive
    v-bind="delegatedProps"
    :class="
      cn(
        'text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70',
        props.class
      )
    "
  >
    <slot />
  </LabelPrimitive>
</template>
