@patternfly/react-core 4.175.3 → 4.175.7
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 +38 -0
- package/dist/esm/components/Card/Card.d.ts +3 -3
- package/dist/esm/components/Card/Card.d.ts.map +1 -1
- package/dist/esm/components/FileUpload/FileUpload.d.ts +3 -3
- package/dist/esm/components/FileUpload/FileUpload.d.ts.map +1 -1
- package/dist/esm/components/FileUpload/FileUpload.js +5 -2
- package/dist/esm/components/FileUpload/FileUpload.js.map +1 -1
- package/dist/esm/components/Pagination/Pagination.d.ts +1 -1
- package/dist/esm/components/Pagination/Pagination.d.ts.map +1 -1
- package/dist/js/components/Card/Card.d.ts +3 -3
- package/dist/js/components/Card/Card.d.ts.map +1 -1
- package/dist/js/components/FileUpload/FileUpload.d.ts +3 -3
- package/dist/js/components/FileUpload/FileUpload.d.ts.map +1 -1
- package/dist/js/components/FileUpload/FileUpload.js +5 -2
- package/dist/js/components/FileUpload/FileUpload.js.map +1 -1
- package/dist/js/components/Pagination/Pagination.d.ts +1 -1
- package/dist/js/components/Pagination/Pagination.d.ts.map +1 -1
- package/dist/umd/react-core.js +1300 -1538
- package/dist/umd/react-core.min.js +4 -3
- package/package.json +6 -6
- package/src/components/Card/Card.tsx +3 -3
- package/src/components/FileUpload/FileUpload.tsx +18 -14
- package/src/components/FileUpload/__tests__/__snapshots__/FileUpload.test.tsx.snap +7 -3
- package/src/components/FileUpload/examples/FileUpload.md +3 -2
- package/src/components/Pagination/Pagination.tsx +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@patternfly/react-core",
|
|
3
|
-
"version": "4.175.
|
|
3
|
+
"version": "4.175.7",
|
|
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,11 +34,11 @@
|
|
|
34
34
|
"generate": "node scripts/copyStyles.js"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@patternfly/react-icons": "^4.26.
|
|
38
|
-
"@patternfly/react-styles": "^4.25.
|
|
39
|
-
"@patternfly/react-tokens": "^4.27.
|
|
37
|
+
"@patternfly/react-icons": "^4.26.7",
|
|
38
|
+
"@patternfly/react-styles": "^4.25.7",
|
|
39
|
+
"@patternfly/react-tokens": "^4.27.7",
|
|
40
40
|
"focus-trap": "6.2.2",
|
|
41
|
-
"react-dropzone": "
|
|
41
|
+
"react-dropzone": "9.0.0",
|
|
42
42
|
"tippy.js": "5.1.2",
|
|
43
43
|
"tslib": "^2.0.0"
|
|
44
44
|
},
|
|
@@ -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": "e2a1625afbb8740e9314ae41b26661b6bda95069"
|
|
64
64
|
}
|
|
@@ -14,7 +14,7 @@ export interface CardProps extends React.HTMLProps<HTMLElement>, OUIAProps {
|
|
|
14
14
|
component?: keyof JSX.IntrinsicElements;
|
|
15
15
|
/** Modifies the card to include hover styles on :hover */
|
|
16
16
|
isHoverable?: boolean;
|
|
17
|
-
/** Modifies the card to include hoverable-raised styles on :hover, this styling is included by default with isSelectableRaised */
|
|
17
|
+
/** @beta Modifies the card to include hoverable-raised styles on :hover, this styling is included by default with isSelectableRaised */
|
|
18
18
|
isHoverableRaised?: boolean;
|
|
19
19
|
/** Modifies the card to include compact styling. Should not be used with isLarge. */
|
|
20
20
|
isCompact?: boolean;
|
|
@@ -22,9 +22,9 @@ export interface CardProps extends React.HTMLProps<HTMLElement>, OUIAProps {
|
|
|
22
22
|
isSelectable?: boolean;
|
|
23
23
|
/** Modifies the card to include selected styling */
|
|
24
24
|
isSelected?: boolean;
|
|
25
|
-
/** Modifies the card to include selectable-raised styling and hoverable-raised styling */
|
|
25
|
+
/** @beta Modifies the card to include selectable-raised styling and hoverable-raised styling */
|
|
26
26
|
isSelectableRaised?: boolean;
|
|
27
|
-
/** Modifies the card to include selected-raised styling */
|
|
27
|
+
/** @beta Modifies the card to include selected-raised styling */
|
|
28
28
|
isSelectedRaised?: boolean;
|
|
29
29
|
/** Modifies the card to include flat styling */
|
|
30
30
|
isFlat?: boolean;
|
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import Dropzone, { DropzoneProps,
|
|
2
|
+
import Dropzone, { DropzoneProps, DropzoneInputProps, DropFileEventHandler } from 'react-dropzone';
|
|
3
3
|
import { FileUploadField, FileUploadFieldProps } from './FileUploadField';
|
|
4
4
|
import { readFile, fileReaderType } from '../../helpers/fileUtils';
|
|
5
5
|
import { fromEvent } from 'file-selector';
|
|
6
|
+
|
|
7
|
+
interface DropzoneInputPropsWithRef extends DropzoneInputProps {
|
|
8
|
+
ref: React.RefCallback<HTMLInputElement>; // Working around an issue in react-dropzone 9.0.0's types. Should not be necessary in later versions.
|
|
9
|
+
}
|
|
10
|
+
|
|
6
11
|
export interface FileUploadProps
|
|
7
12
|
extends Omit<
|
|
8
13
|
FileUploadFieldProps,
|
|
@@ -26,11 +31,9 @@ export interface FileUploadProps
|
|
|
26
31
|
| React.MouseEvent<HTMLButtonElement, MouseEvent> // Clear button was clicked
|
|
27
32
|
| React.DragEvent<HTMLElement> // User dragged/dropped a file
|
|
28
33
|
| React.ChangeEvent<HTMLElement> // User typed in the TextArea
|
|
29
|
-
| DragEvent
|
|
30
|
-
| Event
|
|
31
34
|
) => void;
|
|
32
35
|
/** Change event emitted from the hidden \<input type="file" \> field associated with the component */
|
|
33
|
-
onFileInputChange?: (event: React.ChangeEvent<HTMLInputElement> |
|
|
36
|
+
onFileInputChange?: (event: React.ChangeEvent<HTMLInputElement> | React.DragEvent<HTMLElement>, file: File) => void;
|
|
34
37
|
/** Callback for clicking on the FileUploadField text area. By default, prevents a click in the text area from opening file dialog. */
|
|
35
38
|
onClick?: (event: React.MouseEvent) => void;
|
|
36
39
|
/** Additional classes added to the FileUpload container element. */
|
|
@@ -104,7 +107,7 @@ export const FileUpload: React.FunctionComponent<FileUploadProps> = ({
|
|
|
104
107
|
dropzoneProps = {},
|
|
105
108
|
...props
|
|
106
109
|
}: FileUploadProps) => {
|
|
107
|
-
const onDropAccepted = (acceptedFiles
|
|
110
|
+
const onDropAccepted: DropFileEventHandler = (acceptedFiles, event) => {
|
|
108
111
|
if (acceptedFiles.length > 0) {
|
|
109
112
|
const fileHandle = acceptedFiles[0];
|
|
110
113
|
if (event.type === 'drop') {
|
|
@@ -132,7 +135,7 @@ export const FileUpload: React.FunctionComponent<FileUploadProps> = ({
|
|
|
132
135
|
dropzoneProps.onDropAccepted && dropzoneProps.onDropAccepted(acceptedFiles, event);
|
|
133
136
|
};
|
|
134
137
|
|
|
135
|
-
const onDropRejected = (rejectedFiles
|
|
138
|
+
const onDropRejected: DropFileEventHandler = (rejectedFiles, event) => {
|
|
136
139
|
if (rejectedFiles.length > 0) {
|
|
137
140
|
onChange('', rejectedFiles[0].name, event);
|
|
138
141
|
}
|
|
@@ -151,13 +154,7 @@ export const FileUpload: React.FunctionComponent<FileUploadProps> = ({
|
|
|
151
154
|
};
|
|
152
155
|
|
|
153
156
|
return (
|
|
154
|
-
<Dropzone
|
|
155
|
-
multiple={false}
|
|
156
|
-
{...dropzoneProps}
|
|
157
|
-
onDropAccepted={onDropAccepted}
|
|
158
|
-
onDropRejected={onDropRejected}
|
|
159
|
-
noClick={true}
|
|
160
|
-
>
|
|
157
|
+
<Dropzone multiple={false} {...dropzoneProps} onDropAccepted={onDropAccepted} onDropRejected={onDropRejected}>
|
|
161
158
|
{({ getRootProps, getInputProps, isDragActive, open }) => {
|
|
162
159
|
const oldInputProps = getInputProps();
|
|
163
160
|
const inputProps: DropzoneInputProps = {
|
|
@@ -190,7 +187,14 @@ export const FileUpload: React.FunctionComponent<FileUploadProps> = ({
|
|
|
190
187
|
onTextAreaClick={onClick}
|
|
191
188
|
onTextChange={onTextChange}
|
|
192
189
|
>
|
|
193
|
-
<input
|
|
190
|
+
<input
|
|
191
|
+
/* hidden, necessary for react-dropzone */
|
|
192
|
+
{...inputProps}
|
|
193
|
+
ref={input => {
|
|
194
|
+
fileInputRef.current = input;
|
|
195
|
+
(inputProps as DropzoneInputPropsWithRef).ref(input);
|
|
196
|
+
}}
|
|
197
|
+
/>
|
|
194
198
|
{children}
|
|
195
199
|
</FileUploadField>
|
|
196
200
|
);
|
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
3
|
exports[`simple fileupload 1`] = `
|
|
4
|
-
<
|
|
4
|
+
<t
|
|
5
|
+
disabled={false}
|
|
6
|
+
getDataTransferItems={[Function]}
|
|
7
|
+
maxSize={Infinity}
|
|
8
|
+
minSize={0}
|
|
5
9
|
multiple={false}
|
|
6
|
-
noClick={true}
|
|
7
10
|
onDropAccepted={[Function]}
|
|
8
11
|
onDropRejected={[Function]}
|
|
12
|
+
preventDropOnDocument={true}
|
|
9
13
|
>
|
|
10
14
|
<Component />
|
|
11
|
-
</
|
|
15
|
+
</t>
|
|
12
16
|
`;
|
|
@@ -27,7 +27,7 @@ class SimpleTextFileUpload extends React.Component {
|
|
|
27
27
|
super(props);
|
|
28
28
|
this.state = { value: '', filename: '', isLoading: false };
|
|
29
29
|
this.handleFileInputChange = (event, file) => this.setState({ filename: file.name });
|
|
30
|
-
this.
|
|
30
|
+
this.handleTextOrDataChange = value => this.setState({ value });
|
|
31
31
|
this.handleClear = event => this.setState({ filename: '', value: '' });
|
|
32
32
|
this.handleFileReadStarted = fileHandle => this.setState({ isLoading: true });
|
|
33
33
|
this.handleFileReadFinished = fileHandle => this.setState({ isLoading: false });
|
|
@@ -43,7 +43,8 @@ class SimpleTextFileUpload extends React.Component {
|
|
|
43
43
|
filename={filename}
|
|
44
44
|
filenamePlaceholder="Drag and drop a file or upload one"
|
|
45
45
|
onFileInputChange={this.handleFileInputChange}
|
|
46
|
-
onDataChange={this.
|
|
46
|
+
onDataChange={this.handleTextOrDataChange}
|
|
47
|
+
onTextChange={this.handleTextOrDataChange}
|
|
47
48
|
onReadStarted={this.handleFileReadStarted}
|
|
48
49
|
onReadFinished={this.handleFileReadFinished}
|
|
49
50
|
onClearClick={this.handleClear}
|
|
@@ -123,7 +123,7 @@ export interface PaginationProps extends React.HTMLProps<HTMLDivElement>, OUIAPr
|
|
|
123
123
|
dropDirection?: 'up' | 'down';
|
|
124
124
|
/** Object with titles to display in pagination. */
|
|
125
125
|
titles?: PaginationTitles;
|
|
126
|
-
/** This will be shown in pagination toggle span. You can use firstIndex, lastIndex, itemCount, itemsTitle props. */
|
|
126
|
+
/** This will be shown in pagination toggle span. You can use firstIndex, lastIndex, itemCount, itemsTitle, ofWord props. */
|
|
127
127
|
toggleTemplate?: ((props: ToggleTemplateProps) => React.ReactElement) | string;
|
|
128
128
|
/** Function called when user sets page. */
|
|
129
129
|
onSetPage?: OnSetPage;
|