import { type ReactNode, type RefObject } from 'react'; import { X } from 'lucide-react'; type ImageCanvasReferenceSlotTone = | 'default' | 'spec' | 'icon' | 'ui' | 'character' | 'quick-edit' | 'video' | 'audio'; type ImageCanvasReferenceSlotProps = { buttonRef?: RefObject; tone?: ImageCanvasReferenceSlotTone; className?: string; icon: ReactNode; label: string; ariaLabel: string; title?: string; imageSrc?: string | null; disabled?: boolean; isAdd?: boolean; onClick?: () => void; onRemove?: () => void; removeLabel?: string; }; export function ImageCanvasReferenceSlot({ buttonRef, tone = 'default', className, icon, label, ariaLabel, title, imageSrc, disabled = false, isAdd = false, onClick, onRemove, removeLabel, }: ImageCanvasReferenceSlotProps) { const hasPreviewImage = Boolean(imageSrc); const slotClassName = [ 'image-canvas-editor__reference-chip', `image-canvas-editor__reference-chip--${tone}`, hasPreviewImage ? 'image-canvas-editor__reference-chip--has-image' : 'image-canvas-editor__reference-chip--icon-only', isAdd ? 'image-canvas-editor__reference-chip--upload' : null, className, ] .filter(Boolean) .join(' '); const slotContent = ( <> {hasPreviewImage ? ( ) : ( icon )} {label} {title && title !== label ? ( {title} ) : null} ); return ( {onClick || buttonRef ? ( ) : ( {slotContent} )} {onRemove ? ( ) : null} ); }