import { useState } from 'react'; import { forwardRef } from 'react'; import { useLocalization } from '@akinon/next/hooks'; import { twMerge } from 'tailwind-merge'; import { FileInputProps } from '../types'; export const FileInput = forwardRef( function FileInput( { buttonClassName, onChange, fileClassName, fileNameWrapperClassName, fileInputClassName, ...props }, ref ) { const { t } = useLocalization(); const [fileNames, setFileNames] = useState([]); const handleFileChange = (event: React.ChangeEvent) => { const files = Array.from(event.target.files || []); setFileNames(files.map((file) => file.name)); if (onChange) { onChange(event); } }; return (
{fileNames.length > 0 ? (
    {fileNames.map((name, index) => (
  • {name}
  • ))}
) : ( {t('common.file_input.no_file')} )}
); } );