@@ -37,6 +37,14 @@ export interface FileUploadFieldProps extends Omit<React.HTMLProps<HTMLFormEleme
3737 validated ?: 'success' | 'error' | 'default' ;
3838 /** Aria-label for the TextArea. */
3939 'aria-label' ?: string ;
40+ /** Placeholder string to display in the empty filename field */
41+ filenamePlaceholder ?: string ;
42+ /** Aria-label for the read-only filename field */
43+ filenameAriaLabel ?: string ;
44+ /** Text for the Browse button */
45+ browseButtonText ?: string ;
46+ /** Text for the Clear button */
47+ clearButtonText ?: string ;
4048 /** Flag to hide the TextArea. Use with children to add custom support for non-text files. */
4149 hideTextArea ?: boolean ;
4250 /** Additional children to render after (or instead of) the TextArea. */
@@ -61,7 +69,11 @@ export const FileUploadField: React.FunctionComponent<FileUploadFieldProps> = ({
6169 isRequired = false ,
6270 isDragActive = false ,
6371 validated = 'default' as 'success' | 'error' | 'default' ,
64- 'aria-label' : ariaLabel = 'File contents' ,
72+ 'aria-label' : ariaLabel = 'File upload' ,
73+ filenamePlaceholder = 'Drag a file here or browse to upload' ,
74+ filenameAriaLabel = filename ? 'Read only filename' : filenamePlaceholder ,
75+ browseButtonText = 'Browse...' ,
76+ clearButtonText = 'Clear' ,
6577 containerRef = null as React . Ref < any > ,
6678 children = null ,
6779 hideTextArea = false ,
@@ -88,16 +100,16 @@ export const FileUploadField: React.FunctionComponent<FileUploadFieldProps> = ({
88100 isDisabled = { isDisabled }
89101 id = { `${ id } -filename` }
90102 name = { `${ id } -filename` }
91- aria-label = { filename ? 'Read only filename' : 'Drag a file here or browse to upload' } // TODO make this a prop for a11y
92- placeholder = "Drag a file here or browse to upload" // TODO make this a prop for a11y
103+ aria-label = { filenameAriaLabel }
104+ placeholder = { filenamePlaceholder }
93105 aria-describedby = { `${ id } -browse-button` }
94106 value = { filename }
95107 />
96108 < Button id = { `${ id } -browse-button` } variant = { ButtonVariant . control } onClick = { onBrowseButtonClick } >
97- Browse... { /* TODO make this a prop for a11y */ }
109+ { browseButtonText }
98110 </ Button >
99111 < Button variant = { ButtonVariant . control } isDisabled = { ! value } onClick = { onClearButtonClick } >
100- Clear { /* TODO make this a prop for a11y */ }
112+ { clearButtonText }
101113 </ Button >
102114 </ InputGroup >
103115 </ div >
@@ -110,7 +122,7 @@ export const FileUploadField: React.FunctionComponent<FileUploadFieldProps> = ({
110122 resizeOrientation = { TextAreResizeOrientation . vertical }
111123 validated = { validated }
112124 id = { id }
113- name = { id } // TODO make this a prop? is it based on top-level id/name?
125+ name = { id }
114126 aria-label = { ariaLabel }
115127 value = { value }
116128 onChange = { onTextAreaChange }
0 commit comments