'use client' import * as React from 'react' import { Badge } from '@admin/components/ui/badge' import { Button } from '@admin/components/ui/button' import { useEmailChipsInput } from '@admin/hooks/use-email-chips-input' import { cn } from '@admin/utils/shared/cn' import { X } from 'lucide-react' interface EmailChipsInputProps extends Omit, 'value' | 'onChange'> { value: string[] onValueChange: (value: string[]) => void } // A list of email addresses edited as removable chips. Enter, a comma or a semicolon turns the typed // text into chips; an entry that is not an email stays in the box and marks it invalid; Backspace on // an empty box removes the last chip. `FormControl` passes id, aria-* and ref down to the input. export const EmailChipsInput = React.forwardRef( ({ value, onValueChange, className, disabled, 'aria-invalid': ariaInvalid, ...props }, ref) => { const { draft, invalid, remove, handleChange, handleKeyDown, handleBlur } = useEmailChipsInput({ value, onValueChange }) return (
{value.map((email) => ( {email} ))}
) } ) EmailChipsInput.displayName = 'EmailChipsInput'