11import type { ChangeEvent , FunctionComponent , KeyboardEvent as ReactKeyboardEvent } from 'react' ;
22import { useCallback , useEffect , useRef , useState } from 'react' ;
3+ import { Accept } from 'react-dropzone/.' ;
34import { ButtonProps , DropEvent , TextArea , TextAreaProps , TooltipProps } from '@patternfly/react-core' ;
45
56// Import Chatbot components
@@ -78,6 +79,12 @@ export interface MessageBarProps extends TextAreaProps {
7879 /** Display mode of chatbot, if you want to message bar to resize when the display mode changes */
7980 displayMode ?: ChatbotDisplayMode ;
8081 isCompact ?: boolean ;
82+ /** Specifies the file types accepted by the attachment upload component.
83+ * Files that don't match the accepted types will be disabled in the file picker.
84+ * For example,
85+ * allowedFileTypes: { 'application/json': ['.json'], 'text/plain': ['.txt'] }
86+ **/
87+ allowedFileTypes ?: Accept ;
8188}
8289
8390export const MessageBar : FunctionComponent < MessageBarProps > = ( {
@@ -98,6 +105,7 @@ export const MessageBar: FunctionComponent<MessageBarProps> = ({
98105 displayMode,
99106 value,
100107 isCompact = false ,
108+ allowedFileTypes,
101109 ...props
102110} : MessageBarProps ) => {
103111 // Text Input
@@ -295,6 +303,7 @@ export const MessageBar: FunctionComponent<MessageBarProps> = ({
295303 tooltipContent = { buttonProps ?. attach ?. tooltipContent }
296304 isCompact = { isCompact }
297305 tooltipProps = { buttonProps ?. attach ?. tooltipProps }
306+ allowedFileTypes = { allowedFileTypes }
298307 { ...buttonProps ?. attach ?. props }
299308 />
300309 ) }
@@ -306,6 +315,7 @@ export const MessageBar: FunctionComponent<MessageBarProps> = ({
306315 inputTestId = { buttonProps ?. attach ?. inputTestId }
307316 isCompact = { isCompact }
308317 tooltipProps = { buttonProps ?. attach ?. tooltipProps }
318+ allowedFileTypes = { allowedFileTypes }
309319 { ...buttonProps ?. attach ?. props }
310320 />
311321 ) }
0 commit comments