npm package: @invisionag/iris-react-file-input
Description: ```js import FileInput from '@invisionag/iris-react-file-input'; ```
Latest version: 3.6.2

```js
import FileInput from '@invisionag/iris-react-file-input';
```

FileInput is a generalized Component to handle file selections made by the user. To this end, we make use of the "dropzone" pattern, wherein a file can simply be dragged into the designated zone to fill an `<input type="file" />` element with a filepath.

Usage:

```
<FileInput />
```

### isLoading

Can be passed to indicate that the selected files are currently being processed. It will cause:
* Any interactivity with the dropzone to be disabled
* A spinner to be displayed in the dropzone instead of the regular logic
* The remove-buttons in the `FileList` to be hidden, so no files can be added or removed while `isLoading` is `true`

### onChange

onChange is called on any state change, including when a file is removed.

### onDrop

Callback that is invoked every time a file is selected, either via drop or traditional file explorer selection. First (and only) argument is an array of selected files:
```jsx
handleDrop = files => {
  files.forEach(file =>console.log("file", file))
}

render() {
  return <FileInput onDrop={handleDrop} />
}
```

### multiple

By default, only one file can be selected. If you want the user to be able to select multiple files, you can provide the `multiple` prop like so:
```
<FileInput multiple />
```

### accept

Mime-Type-String or Array of Mime-Type-Strings. If set, the file input will only accept files with the
matching mime-type. Other files will simply be ignored; this is also true if
`multiple` and `accept` is set: if a user drops multiple files with different
mime-types, those with the correct type will be accepted whereas the others
will simply be ignored.
```
<FileInput accept="text/csv" />
```

### localeUtils

Via this prop all customizable texts can be set. It should be a polyglot
object following the implementataion in e.g. [forecast-ui](https://github.com/ivx/forecast-ui/blob/master/src/scripts/i18n.js).

Following text items can be customized in the FileInput by implementing the
corresponding key. If the key is not provided, a default text will be displayed.

| Description                           | key                                          | default            |
|---------------------------------------|----------------------------------------------|------------------- |
| message in initial screen for multiple| `file_input.description.multiple`                | Drag your files here |
| message in initial screen             | `file_input.description.single`                | Drag your file here |
| conjunction before file explorer link | `file_input.joiner`                     | or                           |
| displayed in zone when isLoading is passed | `file_input.loading`                     | Uploading...                           |
| file explorer link                    | `file_input.link`                       | choose files                 |
| dragging with valid files             | `file_input.active_description.valid`   | Drop files here              |
| dragging with invalid files           | `file_input.active_description.invalid` | Cannot select this file type |
| when file limit is reached            | `file_input.file_limit_warning`         | 1 of 1 file selected         |

### className

Provides a class name for the react Dropzone.

### validate

With the `validate` prop, a custom validator can be passed to the component.

The component will run the validator function for each file that was added, passing the file as the only argument.

The file will only be added to the selection if the validator function returns true.
```
<FileInput validate={(file: File): boolean => file.name === 'my-special-name.txt'} />
```