@@ -23,6 +23,8 @@ const EMPTY_ARRAY = [];
23
23
* @property {string } [field.label]
24
24
* @property {string } [field.accept]
25
25
* @property {string|boolean } [field.multiple]
26
+ * @property {Object } [field.validate]
27
+ * @property {boolean } [field.validate.required]
26
28
* @property {string } [value]
27
29
*
28
30
* @param {Props } props
@@ -33,8 +35,8 @@ export function FilePicker(props) {
33
35
const fileInputRef = useRef ( null ) ;
34
36
/** @type {import('../../FileRegistry').FileRegistry } */
35
37
const fileRegistry = useService ( 'fileRegistry' , false ) ;
36
- const { field, onChange, domId, errors = [ ] , disabled, readonly, required , value : filesKey = '' } = props ;
37
- const { label, multiple = false , accept = '' } = field ;
38
+ const { field, onChange, domId, errors = [ ] , disabled, readonly, value : filesKey = '' } = props ;
39
+ const { label, multiple = false , accept = '' , validate = { required : false } } = field ;
38
40
/** @type {string } */
39
41
const evaluatedAccept = useSingleLineTemplateEvaluation ( accept ) ;
40
42
const evaluatedMultiple = useBooleanExpressionEvaluation ( multiple ) ;
@@ -80,7 +82,7 @@ export function FilePicker(props) {
80
82
81
83
return (
82
84
< div className = { formFieldClasses ( type , { errors, disabled, readonly } ) } >
83
- < Label htmlFor = { domId } label = { label } required = { required } />
85
+ < Label htmlFor = { domId } label = { label } required = { validate . required } />
84
86
< input
85
87
type = "file"
86
88
className = "fjs-hidden"
0 commit comments