content: import React from 'react';
  import PropTypes from 'prop-types';
  
  /**
   * Base file upload input.
   */
  const FileUploadInput = ({
    accept,
    className,
    clearErrors,
    id,
    name,
    refs,
    setData,
  }) => {
    function handleChange(event) {
      clearErrors(event.target.name);
  
      setData(event.target.name, event.target.files[0]);
    }
  
    return (
      <input
        accept={accept}
        className={className}
        id={id}
        name={name || id}
        onChange={handleChange}
        ref={refs}
        type="file"
      />
    );
  };
  
  FileUploadInput.propTypes = {
    /**
     * What file types should the input accept?
     */
    accept: PropTypes.string.isRequired,
    /**
     * Classes to style the input element.
     */
    className: PropTypes.string,
    /**
     * Method for clearing input errors.
     */
    clearErrors: PropTypes.func.isRequired,
    /**
     * Identifier attribute for the input element.
     */
    id: PropTypes.string.isRequired,
    /**
     * Name attribute for the input element; will default to the same value as ID if none provided.
     */
    name: PropTypes.string,
    /**
     * Method for setting value for data when input provided.
     */
    setData: PropTypes.func.isRequired,
  };
  
  FileUploadInput.defaultProps = {
    className: null,
    name: null,
  };
  
  export default FileUploadInput;
  