Skip to content

Commit

Permalink
fix: fix required filepicker label
Browse files Browse the repository at this point in the history
  • Loading branch information
vsgoulart committed Sep 23, 2024
1 parent c6580c8 commit d844993
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ const EMPTY_ARRAY = [];
* @property {string} [field.label]
* @property {string} [field.accept]
* @property {string|boolean} [field.multiple]
* @property {Object} [field.validate]
* @property {boolean} [field.validate.required]
* @property {string} [value]
*
* @param {Props} props
Expand All @@ -33,8 +35,8 @@ export function FilePicker(props) {
const fileInputRef = useRef(null);
/** @type {import('../../FileRegistry').FileRegistry} */
const fileRegistry = useService('fileRegistry', false);
const { field, onChange, domId, errors = [], disabled, readonly, required, value: filesKey = '' } = props;
const { label, multiple = false, accept = '' } = field;
const { field, onChange, domId, errors = [], disabled, readonly, value: filesKey = '' } = props;
const { label, multiple = false, accept = '', validate = { required: false } } = field;
/** @type {string} */
const evaluatedAccept = useSingleLineTemplateEvaluation(accept);
const evaluatedMultiple = useBooleanExpressionEvaluation(multiple);
Expand Down Expand Up @@ -80,7 +82,7 @@ export function FilePicker(props) {

return (
<div className={formFieldClasses(type, { errors, disabled, readonly })}>
<Label htmlFor={domId} label={label} required={required} />
<Label htmlFor={domId} label={label} required={validate.required} />
<input
type="file"
className="fjs-hidden"
Expand Down

0 comments on commit d844993

Please sign in to comment.