<script setup lang="ts">
import type { ComboboxItemIndicatorProps } from "reka-ui"
import type { HTMLAttributes } from "vue"
import { reactiveOmit } from "@vueuse/core"
import { Check } from "@lucide/vue"
import { ComboboxItemIndicator, useForwardProps } from "reka-ui"
import { cn } from "@/lib/utils"

export interface ComboboxItemIndicatorPrimitiveProps
  extends ComboboxItemIndicatorProps {
  class?: HTMLAttributes["class"]
}

const props = defineProps<ComboboxItemIndicatorPrimitiveProps>()

const delegatedProps = reactiveOmit(props, "class")

const forwardedProps = useForwardProps(delegatedProps)
</script>

<template>
  <ComboboxItemIndicator
    v-bind="forwardedProps"
    :class="cn(
      'absolute left-2 flex h-3.5 w-3.5 items-center justify-center',
      props.class,
    )"
  >
    <slot>
      <Check class="h-4 w-4" />
    </slot>
  </ComboboxItemIndicator>
</template>
