diff --git a/packages/react-core/src/components/FileUpload/FileUpload.tsx b/packages/react-core/src/components/FileUpload/FileUpload.tsx index 847bbd5e439..a7086bd8ee6 100644 --- a/packages/react-core/src/components/FileUpload/FileUpload.tsx +++ b/packages/react-core/src/components/FileUpload/FileUpload.tsx @@ -76,7 +76,7 @@ export interface FileUploadProps /** A callback for when a selected file starts loading. */ onReadStarted?: (fileHandle: File) => void; /** Text area text changed. */ - onTextChange?: (text: string) => void; + onTextChange?: (event: React.ChangeEvent, text: string) => void; } export const FileUpload: React.FunctionComponent = ({ diff --git a/packages/react-core/src/components/FileUpload/FileUploadField.tsx b/packages/react-core/src/components/FileUpload/FileUploadField.tsx index fa5897e37db..f805332aeb1 100644 --- a/packages/react-core/src/components/FileUpload/FileUploadField.tsx +++ b/packages/react-core/src/components/FileUpload/FileUploadField.tsx @@ -77,7 +77,7 @@ export interface FileUploadFieldProps extends Omit) => void; /** Text area text changed. */ - onTextChange?: (text: string) => void; + onTextChange?: (event: React.ChangeEvent, text: string) => void; /** Placeholder string to display in the empty text area field. */ textAreaPlaceholder?: string; } @@ -114,8 +114,8 @@ export const FileUploadField: React.FunctionComponent = ({ ...props }: FileUploadFieldProps) => { - const onTextAreaChange = (newValue: string) => { - onTextChange?.(newValue); + const onTextAreaChange = (event: React.ChangeEvent, newValue: string) => { + onTextChange?.(event, newValue); }; return (
= ({ name={id} aria-label={ariaLabel} value={value as string} - onChange={onTextAreaChange} + onChange={(value, event) => onTextAreaChange(event, value)} onClick={onTextAreaClick} onBlur={onTextAreaBlur} placeholder={textAreaPlaceholder} diff --git a/packages/react-core/src/components/FileUpload/examples/FileUploadCustomUpload.tsx b/packages/react-core/src/components/FileUpload/examples/FileUploadCustomUpload.tsx index ff128507a02..d715f362797 100644 --- a/packages/react-core/src/components/FileUpload/examples/FileUploadCustomUpload.tsx +++ b/packages/react-core/src/components/FileUpload/examples/FileUploadCustomUpload.tsx @@ -30,7 +30,7 @@ export const CustomPreviewFileUpload: React.FunctionComponent = () => { hasPlaceholderText ]); - const handleTextAreaChange = (value: string) => { + const handleTextAreaChange = (_event: React.ChangeEvent, value: string) => { setValue(value); }; diff --git a/packages/react-core/src/components/FileUpload/examples/FileUploadSimpleText.tsx b/packages/react-core/src/components/FileUpload/examples/FileUploadSimpleText.tsx index 3ad862a827a..5dc2f624147 100644 --- a/packages/react-core/src/components/FileUpload/examples/FileUploadSimpleText.tsx +++ b/packages/react-core/src/components/FileUpload/examples/FileUploadSimpleText.tsx @@ -10,7 +10,11 @@ export const SimpleTextFileUpload: React.FunctionComponent = () => { setFilename(file.name); }; - const handleTextOrDataChange = (value: string) => { + const handleTextChange = (_event: React.ChangeEvent, value: string) => { + setValue(value); + }; + + const handleDataChange = (value: string) => { setValue(value); }; @@ -35,8 +39,8 @@ export const SimpleTextFileUpload: React.FunctionComponent = () => { filename={filename} filenamePlaceholder="Drag and drop a file or upload one" onFileInputChange={handleFileInputChange} - onDataChange={handleTextOrDataChange} - onTextChange={handleTextOrDataChange} + onDataChange={handleDataChange} + onTextChange={handleTextChange} onReadStarted={handleFileReadStarted} onReadFinished={handleFileReadFinished} onClearClick={handleClear} diff --git a/packages/react-core/src/components/FileUpload/examples/FileUploadTextWithEdits.tsx b/packages/react-core/src/components/FileUpload/examples/FileUploadTextWithEdits.tsx index cc666bcf8fb..b62838bb8a6 100644 --- a/packages/react-core/src/components/FileUpload/examples/FileUploadTextWithEdits.tsx +++ b/packages/react-core/src/components/FileUpload/examples/FileUploadTextWithEdits.tsx @@ -10,7 +10,11 @@ export const TextFileWithEditsAllowed: React.FunctionComponent = () => { setFilename(file.name); }; - const handleTextOrDataChange = (value: string) => { + const handleTextChange = (_event: React.ChangeEvent, value: string) => { + setValue(value); + }; + + const handleDataChange = (value: string) => { setValue(value); }; @@ -35,8 +39,8 @@ export const TextFileWithEditsAllowed: React.FunctionComponent = () => { filename={filename} filenamePlaceholder="Drag and drop a file or upload one" onFileInputChange={handleFileInputChange} - onDataChange={handleTextOrDataChange} - onTextChange={handleTextOrDataChange} + onDataChange={handleDataChange} + onTextChange={handleTextChange} onReadStarted={handleFileReadStarted} onReadFinished={handleFileReadFinished} onClearClick={handleClear} diff --git a/packages/react-core/src/components/FileUpload/examples/FileUploadTextWithRestrictions.tsx b/packages/react-core/src/components/FileUpload/examples/FileUploadTextWithRestrictions.tsx index 56f71a4f536..b1ae48379fc 100644 --- a/packages/react-core/src/components/FileUpload/examples/FileUploadTextWithRestrictions.tsx +++ b/packages/react-core/src/components/FileUpload/examples/FileUploadTextWithRestrictions.tsx @@ -11,7 +11,11 @@ export const TextFileUploadWithRestrictions: React.FunctionComponent = () => { setFilename(file.name); }; - const handleTextOrDataChange = (value: string) => { + const handleTextChange = (_event: React.ChangeEvent, value: string) => { + setValue(value); + }; + + const handleDataChange = (value: string) => { setValue(value); }; @@ -43,8 +47,8 @@ export const TextFileUploadWithRestrictions: React.FunctionComponent = () => { filename={filename} filenamePlaceholder="Drag and drop a file or upload one" onFileInputChange={handleFileInputChange} - onDataChange={handleTextOrDataChange} - onTextChange={handleTextOrDataChange} + onDataChange={handleDataChange} + onTextChange={handleTextChange} onReadStarted={handleFileReadStarted} onReadFinished={handleFileReadFinished} onClearClick={handleClear}