<script setup>
import { useTemplateRef } from "vue";
import { cn } from "../../../utils/cn";
import { setInputGroupReference } from ".";
const props = defineProps({
  class: { type: [Boolean, null, String, Object, Array], required: false, skipCheck: true }
});
setInputGroupReference(useTemplateRef("input-group"));
</script>

<template>
  <div
    ref="input-group"
    data-slot="input-group"
    role="group"
    :class="cn(
  'group/input-group border-zinc-200 relative flex w-full items-center rounded-md border transition-[color,box-shadow] outline-none',
  'data-[disabled=true]:border-zinc-100 data-[disabled=true]:bg-zinc-100',
  'data-[disabled=true]:**:data-[slot=input-group-control]:text-zinc-600',
  'data-[disabled=true]:**:data-[slot=input-group-control]:opacity-100',
  'h-9 min-w-0 has-[>textarea]:h-auto',
  // Variants based on alignment.
  'has-[>[data-align=inline-start]]:[&>input]:pl-2',
  'has-[>[data-align=inline-end]]:[&>input]:pr-2',
  'has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>[data-align=block-start]]:[&>input]:pb-3',
  'has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-end]]:[&>input]:pt-3',
  // Error state.
  'has-[[data-slot][aria-invalid=true]]:border-red-500',
  props.class
)"
  >
    <slot />
  </div>
</template>
