<script setup>
import { reactiveOmit } from "@vueuse/core";
import { Icon } from "@iconify/vue";
import { SelectIcon, SelectTrigger, useForwardProps } from "reka-ui";
import { cn } from "../../../utils/cn";
defineOptions({ name: "UiSelectTrigger", inheritAttrs: false });
const props = defineProps({
  disabled: { type: Boolean, required: false },
  reference: { type: null, required: false },
  asChild: { type: Boolean, required: false },
  as: { type: null, required: false },
  class: { type: [Boolean, null, String, Object, Array], required: false, skipCheck: true },
  size: { type: String, required: false, default: "default" }
});
const delegatedProps = reactiveOmit(props, "class", "size");
const forwardedProps = useForwardProps(delegatedProps);
</script>

<template>
  <SelectTrigger
    data-slot="select-trigger"
    :data-size="size"
    v-bind="{ ...$attrs, ...forwardedProps }"
    :class="cn(
  'text-zinc-700 border-zinc-200 data-[placeholder]:text-zinc-300 [&_svg:not([class*=\'text-\'])]:text-zinc-400 flex w-fit items-center justify-between gap-2 rounded border bg-transparent px-3 py-2 text-sm whitespace-nowrap transition-colors ease-out duration-180 outline-none disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*=\'size-\'])]:size-4',
  'aria-invalid:border-red-400 hover:border-zinc-300 focus-visible:border-(--primary)',
  props.class
)"
  >
    <slot />
    <SelectIcon as-child>
      <Icon
        icon="lucide:chevron-down"
        class="size-4 opacity-50"
      />
    </SelectIcon>
  </SelectTrigger>
</template>
