@patternfly/react-core 4.217.4 → 4.218.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +11 -0
- package/dist/esm/components/FileUpload/FileUploadField.d.ts +4 -0
- package/dist/esm/components/FileUpload/FileUploadField.d.ts.map +1 -1
- package/dist/esm/components/FileUpload/FileUploadField.js +2 -2
- package/dist/esm/components/FileUpload/FileUploadField.js.map +1 -1
- package/dist/js/components/FileUpload/FileUploadField.d.ts +4 -0
- package/dist/js/components/FileUpload/FileUploadField.d.ts.map +1 -1
- package/dist/js/components/FileUpload/FileUploadField.js +2 -2
- package/dist/js/components/FileUpload/FileUploadField.js.map +1 -1
- package/dist/umd/react-core.js +2 -2
- package/dist/umd/react-core.min.js +1 -1
- package/package.json +5 -5
- package/src/components/FileUpload/FileUploadField.tsx +8 -0
- package/src/components/FileUpload/__tests__/__snapshots__/FileUpload.test.tsx.snap +1 -0
- package/src/components/FileUpload/__tests__/__snapshots__/FileUploadField.test.tsx.snap +1 -0
- package/src/components/FileUpload/examples/FileUpload.md +6 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@patternfly/react-core",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.218.0",
|
|
4
4
|
"description": "This library provides a set of common React components for use with the PatternFly reference implementation.",
|
|
5
5
|
"main": "dist/js/index.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -34,9 +34,9 @@
|
|
|
34
34
|
"generate": "node scripts/copyStyles.js"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@patternfly/react-icons": "^4.
|
|
38
|
-
"@patternfly/react-styles": "^4.
|
|
39
|
-
"@patternfly/react-tokens": "^4.
|
|
37
|
+
"@patternfly/react-icons": "^4.69.0",
|
|
38
|
+
"@patternfly/react-styles": "^4.68.0",
|
|
39
|
+
"@patternfly/react-tokens": "^4.70.0",
|
|
40
40
|
"focus-trap": "6.2.2",
|
|
41
41
|
"react-dropzone": "9.0.0",
|
|
42
42
|
"tippy.js": "5.1.2",
|
|
@@ -60,5 +60,5 @@
|
|
|
60
60
|
"react": "^16.8.0 || ^17.0.0",
|
|
61
61
|
"react-dom": "^16.8.0 || ^17.0.0"
|
|
62
62
|
},
|
|
63
|
-
"gitHead": "
|
|
63
|
+
"gitHead": "5a409a664a4c75aea67d0c8d3d25de641e320f9e"
|
|
64
64
|
}
|
|
@@ -78,6 +78,10 @@ export interface FileUploadFieldProps extends Omit<React.HTMLProps<HTMLDivElemen
|
|
|
78
78
|
containerRef?: React.Ref<HTMLDivElement>;
|
|
79
79
|
/** Text area text changed */
|
|
80
80
|
onTextChange?: (text: string) => void;
|
|
81
|
+
/** Callback for when focus is lost on the text area field */
|
|
82
|
+
onTextAreaBlur?: (event?: any) => void;
|
|
83
|
+
/** Placeholder string to display in the empty text area field */
|
|
84
|
+
textAreaPlaceholder?: string;
|
|
81
85
|
}
|
|
82
86
|
|
|
83
87
|
export const FileUploadField: React.FunctionComponent<FileUploadFieldProps> = ({
|
|
@@ -90,6 +94,8 @@ export const FileUploadField: React.FunctionComponent<FileUploadFieldProps> = ({
|
|
|
90
94
|
onClearButtonClick = () => {},
|
|
91
95
|
onTextAreaClick,
|
|
92
96
|
onTextChange,
|
|
97
|
+
onTextAreaBlur,
|
|
98
|
+
textAreaPlaceholder = '',
|
|
93
99
|
className = '',
|
|
94
100
|
isDisabled = false,
|
|
95
101
|
isReadOnly = false,
|
|
@@ -169,6 +175,8 @@ export const FileUploadField: React.FunctionComponent<FileUploadFieldProps> = ({
|
|
|
169
175
|
value={value as string}
|
|
170
176
|
onChange={onTextAreaChange}
|
|
171
177
|
onClick={onTextAreaClick}
|
|
178
|
+
onBlur={onTextAreaBlur}
|
|
179
|
+
placeholder={textAreaPlaceholder}
|
|
172
180
|
/>
|
|
173
181
|
)}
|
|
174
182
|
{isLoading && (
|
|
@@ -268,7 +268,8 @@ class CustomFileUpload extends React.Component {
|
|
|
268
268
|
isLoading: false,
|
|
269
269
|
isDragActive: false,
|
|
270
270
|
hideDefaultPreview: false,
|
|
271
|
-
children: false
|
|
271
|
+
children: false,
|
|
272
|
+
hasPlaceholderText: false
|
|
272
273
|
};
|
|
273
274
|
this.handleTextAreaChange = value => {
|
|
274
275
|
this.setState({ value });
|
|
@@ -283,11 +284,12 @@ class CustomFileUpload extends React.Component {
|
|
|
283
284
|
isLoading,
|
|
284
285
|
isDragActive,
|
|
285
286
|
hideDefaultPreview,
|
|
286
|
-
children
|
|
287
|
+
children,
|
|
288
|
+
hasPlaceholderText
|
|
287
289
|
} = this.state;
|
|
288
290
|
return (
|
|
289
291
|
<div>
|
|
290
|
-
{['filename', 'isClearButtonDisabled', 'isDragActive', 'isLoading', 'hideDefaultPreview', 'children'].map(
|
|
292
|
+
{['filename', 'isClearButtonDisabled', 'isDragActive', 'isLoading', 'hideDefaultPreview', 'children', 'hasPlaceholderText'].map(
|
|
291
293
|
stateKey => (
|
|
292
294
|
<Checkbox
|
|
293
295
|
key={stateKey}
|
|
@@ -321,6 +323,7 @@ class CustomFileUpload extends React.Component {
|
|
|
321
323
|
isDragActive={isDragActive}
|
|
322
324
|
hideDefaultPreview={hideDefaultPreview}
|
|
323
325
|
browseButtonText="Upload"
|
|
326
|
+
textAreaPlaceholder={hasPlaceholderText ? "File preview" : ''}
|
|
324
327
|
>
|
|
325
328
|
{children && (
|
|
326
329
|
<div className="pf-u-m-md">(A custom preview of the uploaded file can be passed as children)</div>
|