Skip to content

Commit 9dde1f4

Browse files
authored
Merge pull request #848 from rvsia/pf4Warning
feat(pf4): show meta.warnings
2 parents f2f4531 + ef9ca19 commit 9dde1f4

File tree

12 files changed

+577
-487
lines changed

12 files changed

+577
-487
lines changed

packages/pf4-component-mapper/demo/index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
<meta charset="UTF-8">
55
<meta name="viewport" content="width=device-width, initial-scale=1.0">
66
<meta http-equiv="X-UA-Compatible" content="ie=edge">
7-
<link rel="stylesheet" type="text/css" href="https://unpkg.com/@patternfly/patternfly@4.10.31/patternfly-base.css"/>
8-
<link rel="stylesheet" type="text/css" href="https://unpkg.com/@patternfly/patternfly@4.10.31/patternfly-addons.css"/>
7+
<link rel="stylesheet" type="text/css" href="https://unpkg.com/@patternfly/patternfly@4.50.4/patternfly-base.css"/>
8+
<link rel="stylesheet" type="text/css" href="https://unpkg.com/@patternfly/patternfly@4.50.4/patternfly-addons.css"/>
99
<title>Data driven forms</title>
1010
</head>
1111
<body>

packages/pf4-component-mapper/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@
3030
"@babel/plugin-syntax-dynamic-import": "^7.0.0",
3131
"@babel/preset-env": "^7.1.6",
3232
"@babel/preset-react": "^7.0.0",
33-
"@patternfly/react-core": "^4.18.5",
34-
"@patternfly/react-icons": "^4.3.5",
33+
"@patternfly/react-core": "^4.63.3",
34+
"@patternfly/react-icons": "^4.7.11",
3535
"@semantic-release/git": "^7.0.5",
3636
"@semantic-release/npm": "^5.1.1",
3737
"babel-core": "^7.0.0-bridge.0",
@@ -74,8 +74,8 @@
7474
},
7575
"peerDependencies": {
7676
"@data-driven-forms/react-form-renderer": "^2.4.6",
77-
"@patternfly/react-core": "^4.18.5",
78-
"@patternfly/react-icons": "^4.3.5"
77+
"@patternfly/react-core": "^4.63.3",
78+
"@patternfly/react-icons": "^4.7.11"
7979
},
8080
"dependencies": {
8181
"prop-types": "^15.7.2",

packages/pf4-component-mapper/src/common/form-group.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const FormGroup = ({ label, isRequired, helperText, meta, description, hideLabel
99
isRequired={isRequired}
1010
label={!hideLabel && label}
1111
fieldId={id}
12-
helperText={helperText}
12+
helperText={(meta.touched && meta.warning) || helperText}
1313
helperTextInvalid={meta.error}
1414
{...showError(meta)}
1515
{...FormGroupProps}
Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1-
const showError = ({ error, touched }) => ({ validated: touched && error ? 'error' : 'default' });
1+
const showError = ({ error, touched, warning }) => {
2+
if (touched && error) {
3+
return { validated: 'error' };
4+
}
5+
6+
if (touched && warning) {
7+
return { validated: 'warning' };
8+
}
9+
10+
return { validated: 'default' };
11+
};
212

313
export default showError;

0 commit comments

Comments
 (0)