@@ -27,13 +27,13 @@ export const FileInput = (props: FileInputProps) => {
27
27
format,
28
28
helperText,
29
29
inputProps : inputPropsOptions ,
30
- label,
31
- labelMultiple = 'ra.input.file.upload_several' ,
32
- labelSingle = 'ra.input.file.upload_single' ,
33
30
maxSize,
34
31
minSize,
35
32
multiple = false ,
36
- onDrop : onDropProp ,
33
+ label,
34
+ labelMultiple = 'ra.input.file.upload_several' ,
35
+ labelSingle = 'ra.input.file.upload_single' ,
36
+ options = { } ,
37
37
onRemove : onRemoveProp ,
38
38
parse,
39
39
placeholder,
@@ -43,6 +43,7 @@ export const FileInput = (props: FileInputProps) => {
43
43
validateFileRemoval,
44
44
...rest
45
45
} = props ;
46
+ const { onDrop : onDropProp } = options ;
46
47
const translate = useTranslate ( ) ;
47
48
48
49
// turn a browser dropped file structure into expected structure
@@ -142,8 +143,8 @@ export const FileInput = (props: FileInputProps) => {
142
143
maxSize,
143
144
minSize,
144
145
multiple,
146
+ ...options ,
145
147
onDrop,
146
- ...rest ,
147
148
} ) ;
148
149
149
150
return (
@@ -207,10 +208,7 @@ export const FileInput = (props: FileInputProps) => {
207
208
} ;
208
209
209
210
FileInput . propTypes = {
210
- accept : PropTypes . oneOfType ( [
211
- PropTypes . string ,
212
- PropTypes . arrayOf ( PropTypes . string ) ,
213
- ] ) ,
211
+ accept : PropTypes . string ,
214
212
children : PropTypes . element ,
215
213
className : PropTypes . string ,
216
214
id : PropTypes . string ,
@@ -252,15 +250,19 @@ const StyledLabeled = styled(Labeled, {
252
250
[ `& .${ FileInputClasses . removeButton } ` ] : { } ,
253
251
} ) ) ;
254
252
255
- export type FileInputProps = DropzoneOptions &
256
- CommonInputProps & {
257
- className ?: string ;
258
- children ?: ReactNode ;
259
- labelMultiple ?: string ;
260
- labelSingle ?: string ;
261
- onRemove ?: Function ;
262
- placeholder ?: ReactNode ;
263
- inputProps ?: any ;
264
- validateFileRemoval ?( file ) : boolean | Promise < boolean > ;
265
- sx ?: SxProps ;
266
- } ;
253
+ export type FileInputProps = CommonInputProps & {
254
+ accept ?: DropzoneOptions [ 'accept' ] ;
255
+ className ?: string ;
256
+ children ?: ReactNode ;
257
+ labelMultiple ?: string ;
258
+ labelSingle ?: string ;
259
+ maxSize ?: DropzoneOptions [ 'maxSize' ] ;
260
+ minSize ?: DropzoneOptions [ 'minSize' ] ;
261
+ multiple ?: DropzoneOptions [ 'multiple' ] ;
262
+ options ?: DropzoneOptions ;
263
+ onRemove ?: Function ;
264
+ placeholder ?: ReactNode ;
265
+ inputProps ?: any ;
266
+ validateFileRemoval ?( file ) : boolean | Promise < boolean > ;
267
+ sx ?: SxProps ;
268
+ } ;
0 commit comments