import React, { useRef, useState, useEffect, useCallback, useId } from 'react'; import { Button, ComboBox, Input, ListBox, Popover, type Key, ListBoxItem, TagGroup, TagList, Tag, } from 'react-aria-components'; import { Description, Label } from '../Field/Field.quanta'; import { useListData } from 'react-stately'; import type { ListData } from 'react-stately'; import { useFilter } from 'react-aria'; import { twMerge } from 'tailwind-merge'; import { CloseIcon as Close } from '../../components/icons/CloseIcon'; import { ChevrondownIcon } from '../../components/icons/ChevrondownIcon'; export type Option = { id: Key; name: string; }; export interface MultiSelectProps { items: Array; selectedItems: ListData; className?: string; placeholder?: string; label?: string; description?: string; creatable?: boolean; onItemInserted?: (key: Key) => void; onItemCleared?: (key: Key) => void; renderEmptyState?: (inputValue: string) => React.ReactNode; } export function MultiSelect({ label, placeholder = 'Select items...', items, className = '', description, onItemCleared, onItemInserted, renderEmptyState, selectedItems, creatable = true, ...props }: MultiSelectProps