import * as React from "react"

import { cva, type VariantProps } from "class-variance-authority";
import { cn } from "../../../lib/utils";

const textareaVariants = cva(
  "",
  {
    variants:{
      variant:{
        default:"rounded-md px-3 py-2",
        primary:"rounded-sm px-2 py-1"
      },
      size:{
        sm:"text-sm",
        lg:"text-lg",
      }
    }
  }
)
export interface TextareaProps
  extends React.TextareaHTMLAttributes<HTMLTextAreaElement> , VariantProps<typeof textareaVariants> {}

const Textarea = React.forwardRef<HTMLTextAreaElement, TextareaProps>(
  ({ className,variant, size ,  ...props }, ref) => {
    return (
      <textarea
        className={cn(textareaVariants({variant , size}),
          "flex min-h-[60px] w-full border border-input bg-transparent shadow-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",
          className
        )}
        ref={ref}
        {...props}
      />
    )
  }
)
Textarea.displayName = "Textarea"

export { Textarea }
