"use client" import * as React from "react" import { CheckIcon, ChevronDownIcon, XIcon } from "lucide-react" import { Badge } from "@/components/ui/badge" import { Button } from "@/components/ui/button" import { Popover, PopoverContent, PopoverTrigger } from "@/components/ui/popover" import { cn } from "@/lib/utils" export type MultiSelectOption = { value: string label: React.ReactNode description?: React.ReactNode disabled?: boolean } export type MultiSelectProps = React.ComponentProps<"div"> & { options: MultiSelectOption[] value?: string[] onValueChange?: (value: string[]) => void placeholder?: React.ReactNode maxVisibleTags?: number } function MultiSelect({ options, value = [], onValueChange, placeholder = "Select options", maxVisibleTags = 3, className, ...props }: MultiSelectProps) { const [open, setOpen] = React.useState(false) const selected = options.filter((option) => value.includes(option.value)) const hiddenCount = Math.max(0, selected.length - maxVisibleTags) const toggle = (optionValue: string) => { onValueChange?.(value.includes(optionValue) ? value.filter((item) => item !== optionValue) : [...value, optionValue]) } return (