Debian Codegraph @

node/@patternfly/react-core/dist/js/components/FileUpload/FileUpload.d.ts

raw
1 /// <reference types="react" />
2 import { DropzoneOptions, ErrorCode } from 'react-dropzone';
3 import { FileUploadFieldProps } from './FileUploadField';
4 import { DropEvent } from '../../helpers/typeUtils';
5 export interface FileUploadProps extends Omit<FileUploadFieldProps, 'children' | 'onBrowseButtonClick' | 'onClearButtonClick' | 'isDragActive' | 'containerRef'> {
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 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 /** Flag to show if the field is disabled. */
35 isDisabled?: boolean;
36 /** Flag to show if a file is being loaded. */
37 isLoading?: boolean;
38 /** Flag to show if the field is read only. */
39 isReadOnly?: boolean;
40 /** Flag to show if the field is required. */
41 isRequired?: boolean;
42 /** Callback for clicking on the file upload field text area. By default, prevents a click
43 * in the text area from opening file dialog.
44 */
45 onClick?: (event: React.MouseEvent) => void;
46 /** Change event emitted from the hidden \<input type="file" \> field associated with the component */
47 onFileInputChange?: (event: DropEvent, file: File) => void;
48 /** Aria-valuetext for the loading spinner. */
49 spinnerAriaValueText?: string;
50 /** What type of file. Determines whether 'onDataChange` is called and what is
51 * expected by the value property (a string for '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 /** Optional extra props to customize react-dropzone. */
62 dropzoneProps?: Partial<DropzoneOptions>;
63 /** Clear button was clicked. */
64 onClearClick?: React.MouseEventHandler<HTMLButtonElement>;
65 /** On data changed - if type='text' or type='dataURL' and file was loaded it will call this method */
66 onDataChange?: (event: DropEvent, data: string) => void;
67 /** A callback for when the FileReader API fails. */
68 onReadFailed?: (event: DropEvent, error: DOMException, fileHandle: File) => void;
69 /** A callback for when a selected file finishes loading. */
70 onReadFinished?: (event: DropEvent, fileHandle: File) => void;
71 /** A callback for when a selected file starts loading. */
72 onReadStarted?: (event: DropEvent, fileHandle: File) => void;
73 /** Text area text changed. */
74 onTextChange?: (event: React.ChangeEvent<HTMLTextAreaElement>, text: string) => void;
75 }
76 export { ErrorCode as DropzoneErrorCode };
77 export declare const FileUpload: React.FunctionComponent<FileUploadProps>;
78 //# sourceMappingURL=FileUpload.d.ts.map