// (C) 2026 GoodData Corporation
import { useCallback, useRef } from "react";
/**
 * @internal
 */
export function useFileInput(onFilesSelected) {
    const inputRef = useRef(null);
    const handleInputChange = useCallback((event) => {
        const files = event.target.files ? Array.from(event.target.files) : [];
        if (files.length) {
            onFilesSelected(files);
        }
        event.target.value = "";
    }, [onFilesSelected]);
    return { inputRef, handleInputChange };
}
