);
diff --git a/packages/react-core/src/components/Form/FormGroup.tsx b/packages/react-core/src/components/Form/FormGroup.tsx
index 6a63fa728b2..ddd9a3e5723 100644
--- a/packages/react-core/src/components/Form/FormGroup.tsx
+++ b/packages/react-core/src/components/Form/FormGroup.tsx
@@ -2,7 +2,6 @@ import * as React from 'react';
import styles from '@patternfly/react-styles/css/components/Form/form';
import { ASTERISK } from '../../helpers/htmlConstants';
import { css } from '@patternfly/react-styles';
-import { ValidatedOptions } from '../../helpers/constants';
import { GenerateId } from '../../helpers/GenerateId/GenerateId';
export interface FormGroupProps extends Omit, 'label'> {
@@ -18,28 +17,12 @@ export interface FormGroupProps extends Omit, 'l
labelIcon?: React.ReactElement;
/** Sets the FormGroup required. */
isRequired?: boolean;
- /**
- * Sets the FormGroup validated. If you set to success, text color of helper text will be modified to indicate valid state.
- * If set to error, text color of helper text will be modified to indicate error state.
- * If set to warning, text color of helper text will be modified to indicate warning state.
- */
- validated?: 'success' | 'warning' | 'error' | 'default';
/** Sets the FormGroup isInline. */
isInline?: boolean;
/** Sets the FormGroupControl to be stacked */
isStack?: boolean;
/** Removes top spacer from label. */
hasNoPaddingTop?: boolean;
- /** Helper text regarding the field. It can be a simple text or an object. */
- helperText?: React.ReactNode;
- /** Flag to position the helper text before the field. False by default */
- isHelperTextBeforeField?: boolean;
- /** Helper text after the field when the field is invalid. It can be a simple text or an object. */
- helperTextInvalid?: React.ReactNode;
- /** Icon displayed to the left of the helper text. */
- helperTextIcon?: React.ReactNode;
- /** Icon displayed to the left of the helper text when the field is invalid. */
- helperTextInvalidIcon?: React.ReactNode;
/** ID of an individual field or a group of multiple fields. Required when a role of "group" or "radiogroup" is passed in.
* If only one field is included, its ID attribute and this prop must be the same.
*/
@@ -57,53 +40,13 @@ export const FormGroup: React.FunctionComponent = ({
labelInfo,
labelIcon,
isRequired = false,
- validated = 'default',
isInline = false,
hasNoPaddingTop = false,
isStack = false,
- helperText,
- isHelperTextBeforeField = false,
- helperTextInvalid,
- helperTextIcon,
- helperTextInvalidIcon,
fieldId,
role,
...props
}: FormGroupProps) => {
- const validHelperText =
- typeof helperText !== 'string' ? (
- helperText
- ) : (
-
-
-
-
-`;
-
-exports[`FormGroup should render form group invalid variant 1`] = `
-
-
-
-
-
-
-
-
-
- Invalid FormGroup
-
-
-
-
-`;
-
-exports[`FormGroup should render form group validated error variant 1`] = `
-
-
-
-
-
-
-
-
-
-
-
-`;
-
-exports[`FormGroup should render form group validated success variant 1`] = `
-
-
-
-
-
-
-
-
-
- Validated FormGroup
-
-
-
-
-`;
-
-exports[`FormGroup should render form group validated warning variant 1`] = `
-
-
-
-
-
-
-
-
-
- Validated FormGroup
-
@@ -350,49 +196,6 @@ exports[`FormGroup should render form group with additonal label info 1`] = `
`;
-exports[`FormGroup should render helper text above input 1`] = `
-
-
-
-`;
-
exports[`FormGroup should render horizontal form group variant 1`] = `
-
- this is helperText
-
@@ -466,13 +262,6 @@ exports[`FormGroup should render stacked horizontal form group variant 1`] = `
-
-
+ = (props: sampleFormP
aria-describedby="age-helper"
onChange={handleTextInputChange}
/>
+
+
+
+ {validated === 'error' ? 'Age has to be a number' : 'Write your age in numbers.'}
+
+
+
-
+ = (props: sampleFormP
aria-describedby="age-helper"
onChange={handleTextInputChange}
/>
+
+
+
+ {validated === 'error' ? 'Age has to be a number' : 'Write your age in numbers.'}
+
+
+
@@ -55,7 +55,7 @@ export const HelperTextDynamicVariantDynamicText: React.FunctionComponent = () =
aria-invalid={ruleCharacterTypes === 'error' || ruleLength === 'error'}
value={value}
/>
-
+
Must be at least 5 characters in length
diff --git a/packages/react-core/src/demos/examples/HelperText/HelperTextStaticVariantDynamicText.tsx b/packages/react-core/src/demos/examples/HelperText/HelperTextStaticVariantDynamicText.tsx
index 35b514b6e71..3d8283834ac 100644
--- a/packages/react-core/src/demos/examples/HelperText/HelperTextStaticVariantDynamicText.tsx
+++ b/packages/react-core/src/demos/examples/HelperText/HelperTextStaticVariantDynamicText.tsx
@@ -32,7 +32,7 @@ export const HelperTextStaticVariantDynamicText: React.FunctionComponent = () =>
aria-invalid={inputValidation === 'error'}
value={value}
/>
-
+
{inputValidation !== 'success' && (
diff --git a/packages/react-core/src/demos/examples/HelperText/HelperTextStaticVariantStaticText.tsx b/packages/react-core/src/demos/examples/HelperText/HelperTextStaticVariantStaticText.tsx
index 85175317001..efd75d31612 100644
--- a/packages/react-core/src/demos/examples/HelperText/HelperTextStaticVariantStaticText.tsx
+++ b/packages/react-core/src/demos/examples/HelperText/HelperTextStaticVariantStaticText.tsx
@@ -19,7 +19,7 @@ export const HelperTextStaticVariantStaticText: React.FunctionComponent = () =>
aria-describedby="helper-text1"
value={value}
/>
-
+ Enter your middle name or your middle initial
diff --git a/packages/react-core/src/next/components/Wizard/examples/WizardEnabledOnFormValidation.tsx b/packages/react-core/src/next/components/Wizard/examples/WizardEnabledOnFormValidation.tsx
index 2a8044dbff1..9e24c68e8c4 100644
--- a/packages/react-core/src/next/components/Wizard/examples/WizardEnabledOnFormValidation.tsx
+++ b/packages/react-core/src/next/components/Wizard/examples/WizardEnabledOnFormValidation.tsx
@@ -1,6 +1,6 @@
import React from 'react';
-import { Form, FormGroup, TextInput } from '@patternfly/react-core';
+import { Form, FormGroup, FormHelperText, HelperText, HelperTextItem, TextInput } from '@patternfly/react-core';
import { Wizard, WizardStep } from '@patternfly/react-core/next';
interface SampleFormProps {
@@ -22,14 +22,7 @@ const SampleForm: React.FunctionComponent = ({ value, isValid,
return (
-
+ = ({ value, isValid,
aria-describedby="age-helper"
onChange={handleTextInputChange}
/>
+
+
+
+ {validated === 'error' ? 'Age has to be a number' : 'Write your age in numbers.'}
+
+
+
-
+ = ({ value, isValid,
aria-describedby="age-helper"
onChange={handleTextInputChange}
/>
+
+
+
+ {validated === 'error' ? 'Age has to be a number' : 'Write your age in numbers.'}
+
+
+
);
diff --git a/packages/react-integration/cypress/integration/form.spec.ts b/packages/react-integration/cypress/integration/form.spec.ts
index 1dc5332fe6b..0f3376a4b3e 100644
--- a/packages/react-integration/cypress/integration/form.spec.ts
+++ b/packages/react-integration/cypress/integration/form.spec.ts
@@ -20,7 +20,7 @@ describe('Form Demo Test', () => {
.first()
.clear()
.type('5');
- cy.get('.pf-c-form__helper-text').contains('Please write your age');
+ cy.get('.pf-c-helper-text').contains('Please write your age');
});
it('Verify form identifies input error', () => {
@@ -28,7 +28,7 @@ describe('Form Demo Test', () => {
.first()
.clear()
.type('Something');
- cy.get('.pf-c-form__helper-text').contains('Age has to be a number');
+ cy.get('.pf-c-helper-text').contains('Age has to be a number');
});
it('Verify section titles rendering with correct component', () => {
@@ -37,28 +37,28 @@ describe('Form Demo Test', () => {
it('Verify form validates form group', () => {
cy.get('#age-validated.pf-m-success').should('not.exist');
- cy.get('.pf-c-form__helper-text').contains('Enter age');
+ cy.get('.pf-c-helper-text').contains('Enter age');
// type string that is not a number so it is invalid
cy.get('#age-validated').type('hi');
cy.get('#age-validated').should('have.value', 'hi');
cy.get('#age-validated').then(textinput => {
expect(textinput.attr('aria-invalid')).to.be.equal('true');
});
- cy.get('.pf-c-form__helper-text.pf-m-error').contains('Age must be a number');
- cy.get('#age2-helper.pf-m-error').should('exist');
+ cy.get('.pf-c-helper-text__item.pf-m-error').contains('Age must be a number');
+ cy.get('#age2-helper .pf-m-error').should('exist');
// Clear text input and enter valid number
cy.get('#age-validated')
.clear()
.type('34')
.should('have.value', '34');
- cy.get('#age2-helper.pf-m-success').should('exist');
+ cy.get('#age2-helper .pf-m-success').should('exist');
cy.get('#age-validated.pf-m-success').should('exist');
- cy.get('.pf-c-form__helper-text.pf-m-success').contains('Enter age');
+ cy.get('.pf-c-helper-text__item.pf-m-success').contains('Enter age');
cy.get('#age-validated').then(textinput => {
expect(textinput.attr('aria-invalid')).to.be.equal('false');
});
cy.get('#age-validated').clear();
- cy.get('#age2-helper.pf-m-warning').should('exist');
+ cy.get('#age2-helper .pf-m-warning').should('exist');
cy.get('#age-validated').then(textinput => {
expect(textinput.attr('aria-invalid')).to.be.equal('false');
});
diff --git a/packages/react-integration/cypress/integration/login-page.spec.ts b/packages/react-integration/cypress/integration/login-page.spec.ts
index ea4e5e2e4a9..60aec8a771b 100644
--- a/packages/react-integration/cypress/integration/login-page.spec.ts
+++ b/packages/react-integration/cypress/integration/login-page.spec.ts
@@ -7,7 +7,7 @@ describe('Login Page Demo Test', () => {
cy.get('input[name="pf-login-username-id"]').then(userNameInput => expect(userNameInput.text()).to.equal(''));
cy.get('input[name="pf-login-password-id"]').then(passwordInput => expect(passwordInput.text()).to.equal(''));
cy.get('#pf-login-remember-me-id').then(rememberMeBox => expect(rememberMeBox.is(':checked')).to.be.false);
- cy.get('.pf-c-form__helper-text.pf-m-error').should('not.exist');
+ cy.get('.pf-c-form__helper-text .pf-m-error').should('not.exist');
cy.get('.pf-c-login__main-footer-links')
.find('.pf-c-login__main-footer-links-item')
.then(links => expect(links.length).to.equal(5));
@@ -16,7 +16,7 @@ describe('Login Page Demo Test', () => {
it('Verify error is shown on invalid credentials', () => {
cy.get('.pf-c-login__main-body .pf-c-button.pf-m-primary').then((loginButton: JQuery) => {
cy.wrap(loginButton).click();
- cy.get('.pf-c-form__helper-text.pf-m-error').then(errorMessage => {
+ cy.get('.pf-c-form__helper-text .pf-m-error').then(errorMessage => {
expect(errorMessage.length).to.equal(1);
});
cy.get('input[name="pf-login-username-id"][aria-invalid="true"]').then(userNameInput => {
diff --git a/packages/react-integration/demo-app-ts/src/components/demos/FormDemo/FormDemo.tsx b/packages/react-integration/demo-app-ts/src/components/demos/FormDemo/FormDemo.tsx
index aeee9a57113..6cfb03ca88f 100644
--- a/packages/react-integration/demo-app-ts/src/components/demos/FormDemo/FormDemo.tsx
+++ b/packages/react-integration/demo-app-ts/src/components/demos/FormDemo/FormDemo.tsx
@@ -12,7 +12,10 @@ import {
SelectOption,
SelectOptionObject,
SelectVariant,
- ValidatedOptions
+ ValidatedOptions,
+ HelperText,
+ HelperTextItem,
+ FormHelperText
} from '@patternfly/react-core';
import ExclamationCircleIcon from '@patternfly/react-icons/dist/esm/icons/exclamation-circle-icon';
import HelpIcon from '@patternfly/react-icons/dist/esm/icons/help-icon';
@@ -63,13 +66,13 @@ export class FormDemo extends Component {
const { selected } = this.state;
if (selected.includes(selection.toString())) {
this.setState(
- prevState => ({ selected: prevState.selected.filter(item => item !== selection) }),
+ (prevState) => ({ selected: prevState.selected.filter((item) => item !== selection) }),
// eslint-disable-next-line no-console
() => console.log('selections: ', this.state.selected)
);
} else {
this.setState(
- prevState => ({ selected: [...prevState.selected, selection.toString()] }),
+ (prevState) => ({ selected: [...prevState.selected, selection.toString()] }),
// eslint-disable-next-line no-console
() => console.log('selections: ', this.state.selected)
);
@@ -124,7 +127,7 @@ export class FormDemo extends Component {
+
@@ -173,15 +180,7 @@ export class FormDemo extends Component {
-
+ {
aria-describedby="age-helper-validated"
onChange={this.handleValidatedTextInputChange}
/>
+
+
+
+ {validated === 'error' ? 'Age must be a number' : 'Enter age'}
+
+
+