| 1 |
/// <reference types="react" /> |
| 2 |
/** A more customizable file upload component for implementing custom logic. Drag and drop |
| 3 |
* functionality is not built in by default. |
| 4 |
*/ |
| 5 |
export interface FileUploadFieldProps extends Omit<React.HTMLProps<HTMLDivElement>, 'value'> { |
| 6 |
/** Flag to allow editing of a text file's contents after it is selected from disk. */ |
| 7 |
allowEditingUploadedText?: boolean; |
| 8 |
/** Aria-label for the text area. */ |
| 9 |
'aria-label'?: string; |
| 10 |
/** Text for the browse button. */ |
| 11 |
browseButtonText?: string; |
| 12 |
/** ID or ID's of elements that describe the browse button. Typically this should refer |
| 13 |
* to elements such as helper text when there are file restrictions. |
| 14 |
*/ |
| 15 |
browseButtonAriaDescribedby?: string; |
| 16 |
/** Additional children to render after (or instead of) the file preview. */ |
| 17 |
children?: React.ReactNode; |
| 18 |
/** Additional classes added to the file upload field container element. */ |
| 19 |
className?: string; |
| 20 |
/** Text for the clear button. */ |
| 21 |
clearButtonText?: string; |
| 22 |
/** Value to be shown in the read-only filename field. */ |
| 23 |
filename?: string; |
| 24 |
/** Aria-label for the read-only filename field. */ |
| 25 |
filenameAriaLabel?: string; |
| 26 |
/** Placeholder string to display in the empty filename field. */ |
| 27 |
filenamePlaceholder?: string; |
| 28 |
/** Flag to hide the built-in preview of the file (where available). If true, you can use |
| 29 |
* the children property to render an alternate preview. |
| 30 |
*/ |
| 31 |
hideDefaultPreview?: boolean; |
| 32 |
/** Unique id for the text area. Also used to generate ids for accessible labels. */ |
| 33 |
id: string; |
| 34 |
/** Name property for the text input. */ |
| 35 |
name?: string; |
| 36 |
/** Flag to disable the browse button. */ |
| 37 |
isBrowseButtonDisabled?: boolean; |
| 38 |
/** Flag to disable the clear button. */ |
| 39 |
isClearButtonDisabled?: boolean; |
| 40 |
/** Flag to show if the field is disabled. */ |
| 41 |
isDisabled?: boolean; |
| 42 |
/** Flag to show if a file is being loaded. */ |
| 43 |
isLoading?: boolean; |
| 44 |
/** Flag to show if the field is read only. */ |
| 45 |
isReadOnly?: boolean; |
| 46 |
/** Flag to show if the field is required. */ |
| 47 |
isRequired?: boolean; |
| 48 |
/** Aria-valuetext for the loading spinner. */ |
| 49 |
spinnerAriaValueText?: string; |
| 50 |
/** What type of file. Determines what is is expected by the value property (a string for |
| 51 |
* 'text' and 'dataURL', or a File object otherwise). |
| 52 |
*/ |
| 53 |
type?: 'text' | 'dataURL'; |
| 54 |
/** Value to indicate if the field is modified to show that validation state. |
| 55 |
* If set to success, field will be modified to indicate valid state. |
| 56 |
* If set to error, field will be modified to indicate error state. |
| 57 |
*/ |
| 58 |
validated?: 'success' | 'error' | 'default'; |
| 59 |
/** Value of the file's contents (string if text file, File object otherwise). */ |
| 60 |
value?: string | File; |
| 61 |
/** A reference object to attach to the file upload field container element. */ |
| 62 |
containerRef?: React.Ref<HTMLDivElement>; |
| 63 |
/** Flag to show if a file is being dragged over the file upload field. */ |
| 64 |
isDragActive?: boolean; |
| 65 |
/** A callback for when the browse button is clicked. */ |
| 66 |
onBrowseButtonClick?: (event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void; |
| 67 |
/** A callback for when the clear button is clicked. */ |
| 68 |
onClearButtonClick?: (event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void; |
| 69 |
/** Callback for when focus is lost on the text area field. */ |
| 70 |
onTextAreaBlur?: (event?: any) => void; |
| 71 |
/** A callback for when the text area is clicked. Can also be set via the onClick property |
| 72 |
* of the file upload component. */ |
| 73 |
onTextAreaClick?: (event: React.MouseEvent<HTMLTextAreaElement, MouseEvent>) => void; |
| 74 |
/** Text area text changed. */ |
| 75 |
onTextChange?: (event: React.ChangeEvent<HTMLTextAreaElement>, text: string) => void; |
| 76 |
/** Placeholder string to display in the empty text area field. */ |
| 77 |
textAreaPlaceholder?: string; |
| 78 |
} |
| 79 |
export declare const FileUploadField: React.FunctionComponent<FileUploadFieldProps>; |
| 80 |
//# sourceMappingURL=FileUploadField.d.ts.map |