mirror of
https://github.com/inventree/InvenTree.git
synced 2025-10-14 21:22:20 +00:00
[UI] Enhance file-upload field (#10576)
- Add icon - Add ability to clear input - Add default placeholder - Ref: https://github.com/inventree/inventree/issues/10548
This commit is contained in:
@@ -5,6 +5,7 @@ import { useCallback, useEffect, useMemo } from 'react';
|
||||
import { type Control, type FieldValues, useController } from 'react-hook-form';
|
||||
|
||||
import type { ApiFormFieldSet, ApiFormFieldType } from '@lib/types/Forms';
|
||||
import { IconFileUpload } from '@tabler/icons-react';
|
||||
import { BooleanField } from './BooleanField';
|
||||
import { ChoiceField } from './ChoiceField';
|
||||
import DateField from './DateField';
|
||||
@@ -221,7 +222,10 @@ export function ApiFormField({
|
||||
return (
|
||||
<FileInput
|
||||
{...reducedDefinition}
|
||||
clearable={!definition.required}
|
||||
aria-label={`file-field-${fieldName}`}
|
||||
placeholder={definition.placeholder ?? t`Select file to upload`}
|
||||
leftSection={<IconFileUpload />}
|
||||
id={fieldId}
|
||||
ref={field.ref}
|
||||
radius='sm'
|
||||
|
Reference in New Issue
Block a user