/**
* Provides a simple wrapper around . The only difference
* is that the value passed to the onChange property is the new file inside the
* field, not the event causing the change.
*/
import React from 'react';
import { Omit } from 'wdk-client/Core/CommonTypes';
import { wrappable } from 'wdk-client/Utils/ComponentUtils';
type InputProps = React.InputHTMLAttributes;
type InputWithoutOnChange = Omit;
type Props = InputWithoutOnChange & {
onChange: (value: File | null) => void;
};
const FileInput = function (originalProps: Props) {
const { onChange, ...props } = originalProps;
const changeHandler = function(event: React.ChangeEvent): void {
onChange(event.target.files && event.target.files[0]);
};
return ( );
}
export default wrappable(FileInput);