"use client" import * as React from "react" import * as SelectPrimitive from "@radix-ui/react-select" import { Check, ChevronDown, ChevronUp } from "lucide-react" import { cn } from "@/lib/utils" import { cva, type VariantProps } from "class-variance-authority" import { InputColor, size } from "@/lib/type" const Select = SelectPrimitive.Root const SelectGroup = SelectPrimitive.Group const SelectValue = SelectPrimitive.Value const selectVariants = cva( " w-full px-3 h-10 text-sm flex [&>svg]:h-5 [&>svg]:w-5 rounded-md border border-input justify-between items-center read-only:bg-background disabled:cursor-not-allowed disabled:opacity-50 transition duration-300 ", { variants: { color: { default: "border-default-200 text-default-500 focus:outline-none focus:border-default-500/50 disabled:bg-default-200 placeholder:text-accent-foreground/50 [&>svg]:stroke-default-600", primary: "border-primary text-primary focus:outline-none focus:border-primary/70 disabled:bg-primary/30 disabled:placeholder:text-primary placeholder:text-primary/70 [&>svg]:stroke-primary", secondary: "border-secondary text-secondary focus:outline-none focus:border-secondary/70 disabled:bg-primary/30 disabled:placeholder:text-primary placeholder:text-primary/70 [&>svg]:stroke-primary", info: "border-info/50 text-info focus:outline-none focus:border-info/70 disabled:bg-info/30 disabled:placeholder:text-info placeholder:text-info/70", warning: "border-warning/50 text-warning focus:outline-none focus:border-warning/70 disabled:bg-warning/30 disabled:placeholder:text-info placeholder:text-warning/70", success: "border-success/50 text-success focus:outline-none focus:border-success/70 disabled:bg-success/30 disabled:placeholder:text-info placeholder:text-success/70", destructive: "border-destructive/50 text-destructive focus:outline-none focus:border-destructive/70 disabled:bg-destructive/30 disabled:placeholder:text-destructive placeholder:text-destructive/70", }, size: { sm: "h-8 text-xs", default: "h-9 text-xs", md: "h-10 text-sm", lg: "h-12 text-base", } }, defaultVariants: { color: "default", size: "default", }, } ); interface SelectTriggerProps extends React.ComponentPropsWithoutRef, VariantProps { size?: size color?: InputColor } const SelectTrigger = React.forwardRef< React.ElementRef, SelectTriggerProps >( ( { className, children, color, size, ...props }, ref ) => ( {children} ) ); SelectTrigger.displayName = SelectPrimitive.Trigger.displayName; const SelectScrollUpButton = React.forwardRef< React.ElementRef, React.ComponentPropsWithoutRef >(({ className, ...props }, ref) => ( )) SelectScrollUpButton.displayName = SelectPrimitive.ScrollUpButton.displayName const SelectScrollDownButton = React.forwardRef< React.ElementRef, React.ComponentPropsWithoutRef >(({ className, ...props }, ref) => ( )) SelectScrollDownButton.displayName = SelectPrimitive.ScrollDownButton.displayName const SelectContent = React.forwardRef< React.ElementRef, React.ComponentPropsWithoutRef >(({ className, children, position = "popper", ...props }, ref) => ( {children} )) SelectContent.displayName = SelectPrimitive.Content.displayName const SelectLabel = React.forwardRef< React.ElementRef, React.ComponentPropsWithoutRef >(({ className, ...props }, ref) => ( )) SelectLabel.displayName = SelectPrimitive.Label.displayName const SelectItem = React.forwardRef< React.ElementRef, React.ComponentPropsWithoutRef >(({ className, children, ...props }, ref) => ( {children} )) SelectItem.displayName = SelectPrimitive.Item.displayName const SelectSeparator = React.forwardRef< React.ElementRef, React.ComponentPropsWithoutRef >(({ className, ...props }, ref) => ( )) SelectSeparator.displayName = SelectPrimitive.Separator.displayName export { Select, SelectGroup, SelectValue, SelectTrigger, SelectContent, SelectLabel, SelectItem, SelectSeparator, SelectScrollUpButton, SelectScrollDownButton, }