@patternfly/react-core 5.0.0-alpha.53 → 5.0.0-alpha.55

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.
Files changed (155) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/esm/components/Form/FormGroup.d.ts +0 -16
  3. package/dist/esm/components/Form/FormGroup.d.ts.map +1 -1
  4. package/dist/esm/components/Form/FormGroup.js +3 -15
  5. package/dist/esm/components/Form/FormGroup.js.map +1 -1
  6. package/dist/esm/components/Form/FormHelperText.d.ts +2 -10
  7. package/dist/esm/components/Form/FormHelperText.d.ts.map +1 -1
  8. package/dist/esm/components/Form/FormHelperText.js +2 -5
  9. package/dist/esm/components/Form/FormHelperText.js.map +1 -1
  10. package/dist/esm/components/LoginPage/LoginForm.d.ts.map +1 -1
  11. package/dist/esm/components/LoginPage/LoginForm.js +6 -3
  12. package/dist/esm/components/LoginPage/LoginForm.js.map +1 -1
  13. package/dist/esm/components/Page/Page.d.ts +2 -2
  14. package/dist/esm/components/Page/Page.d.ts.map +1 -1
  15. package/dist/esm/components/Page/index.d.ts +0 -4
  16. package/dist/esm/components/Page/index.d.ts.map +1 -1
  17. package/dist/esm/components/Page/index.js +0 -4
  18. package/dist/esm/components/Page/index.js.map +1 -1
  19. package/dist/esm/deprecated/components/PageHeader/PageHeader.d.ts.map +1 -0
  20. package/dist/esm/{components/Page → deprecated/components/PageHeader}/PageHeader.js +2 -2
  21. package/dist/esm/deprecated/components/PageHeader/PageHeader.js.map +1 -0
  22. package/dist/esm/deprecated/components/PageHeader/PageHeaderTools.d.ts.map +1 -0
  23. package/dist/esm/deprecated/components/PageHeader/PageHeaderTools.js.map +1 -0
  24. package/dist/esm/deprecated/components/PageHeader/PageHeaderToolsGroup.d.ts.map +1 -0
  25. package/dist/esm/{components/Page → deprecated/components/PageHeader}/PageHeaderToolsGroup.js +2 -2
  26. package/dist/esm/deprecated/components/PageHeader/PageHeaderToolsGroup.js.map +1 -0
  27. package/dist/esm/deprecated/components/PageHeader/PageHeaderToolsItem.d.ts.map +1 -0
  28. package/dist/esm/{components/Page → deprecated/components/PageHeader}/PageHeaderToolsItem.js +2 -2
  29. package/dist/esm/deprecated/components/PageHeader/PageHeaderToolsItem.js.map +1 -0
  30. package/dist/esm/deprecated/components/PageHeader/index.d.ts +5 -0
  31. package/dist/esm/deprecated/components/PageHeader/index.d.ts.map +1 -0
  32. package/dist/esm/deprecated/components/PageHeader/index.js +5 -0
  33. package/dist/esm/deprecated/components/PageHeader/index.js.map +1 -0
  34. package/dist/esm/deprecated/components/index.d.ts +1 -0
  35. package/dist/esm/deprecated/components/index.d.ts.map +1 -1
  36. package/dist/esm/deprecated/components/index.js +1 -0
  37. package/dist/esm/deprecated/components/index.js.map +1 -1
  38. package/dist/js/components/Form/FormGroup.d.ts +0 -16
  39. package/dist/js/components/Form/FormGroup.d.ts.map +1 -1
  40. package/dist/js/components/Form/FormGroup.js +3 -15
  41. package/dist/js/components/Form/FormGroup.js.map +1 -1
  42. package/dist/js/components/Form/FormHelperText.d.ts +2 -10
  43. package/dist/js/components/Form/FormHelperText.d.ts.map +1 -1
  44. package/dist/js/components/Form/FormHelperText.js +2 -5
  45. package/dist/js/components/Form/FormHelperText.js.map +1 -1
  46. package/dist/js/components/LoginPage/LoginForm.d.ts.map +1 -1
  47. package/dist/js/components/LoginPage/LoginForm.js +6 -3
  48. package/dist/js/components/LoginPage/LoginForm.js.map +1 -1
  49. package/dist/js/components/Page/Page.d.ts +2 -2
  50. package/dist/js/components/Page/Page.d.ts.map +1 -1
  51. package/dist/js/components/Page/index.d.ts +0 -4
  52. package/dist/js/components/Page/index.d.ts.map +1 -1
  53. package/dist/js/components/Page/index.js +0 -4
  54. package/dist/js/components/Page/index.js.map +1 -1
  55. package/dist/js/deprecated/components/PageHeader/PageHeader.d.ts.map +1 -0
  56. package/dist/js/{components/Page → deprecated/components/PageHeader}/PageHeader.js +2 -2
  57. package/dist/js/deprecated/components/PageHeader/PageHeader.js.map +1 -0
  58. package/dist/js/deprecated/components/PageHeader/PageHeaderTools.d.ts.map +1 -0
  59. package/dist/js/deprecated/components/PageHeader/PageHeaderTools.js.map +1 -0
  60. package/dist/js/deprecated/components/PageHeader/PageHeaderToolsGroup.d.ts.map +1 -0
  61. package/dist/js/{components/Page → deprecated/components/PageHeader}/PageHeaderToolsGroup.js +2 -2
  62. package/dist/js/deprecated/components/PageHeader/PageHeaderToolsGroup.js.map +1 -0
  63. package/dist/js/deprecated/components/PageHeader/PageHeaderToolsItem.d.ts.map +1 -0
  64. package/dist/js/{components/Page → deprecated/components/PageHeader}/PageHeaderToolsItem.js +2 -2
  65. package/dist/js/deprecated/components/PageHeader/PageHeaderToolsItem.js.map +1 -0
  66. package/dist/js/deprecated/components/PageHeader/index.d.ts +5 -0
  67. package/dist/js/deprecated/components/PageHeader/index.d.ts.map +1 -0
  68. package/dist/js/deprecated/components/PageHeader/index.js +8 -0
  69. package/dist/js/deprecated/components/PageHeader/index.js.map +1 -0
  70. package/dist/js/deprecated/components/index.d.ts +1 -0
  71. package/dist/js/deprecated/components/index.d.ts.map +1 -1
  72. package/dist/js/deprecated/components/index.js +1 -0
  73. package/dist/js/deprecated/components/index.js.map +1 -1
  74. package/dist/umd/react-core.min.js +1 -1
  75. package/package.json +2 -2
  76. package/src/components/FileUpload/examples/FileUploadTextWithRestrictions.tsx +9 -7
  77. package/src/components/Form/FormGroup.tsx +1 -60
  78. package/src/components/Form/FormHelperText.tsx +7 -31
  79. package/src/components/Form/__tests__/FormGroup.test.tsx +6 -95
  80. package/src/components/Form/__tests__/FormHelperText.test.tsx +1 -14
  81. package/src/components/Form/__tests__/__snapshots__/FormGroup.test.tsx.snap +0 -211
  82. package/src/components/Form/__tests__/__snapshots__/FormHelperText.test.tsx.snap +12 -39
  83. package/src/components/Form/examples/Form.md +15 -1
  84. package/src/components/Form/examples/FormBasic.tsx +19 -3
  85. package/src/components/Form/examples/FormGrid.tsx +16 -7
  86. package/src/components/Form/examples/FormGroupLabelInfo.tsx +15 -3
  87. package/src/components/Form/examples/FormHorizontal.tsx +10 -7
  88. package/src/components/Form/examples/FormHorizontalHelper.tsx +14 -21
  89. package/src/components/Form/examples/FormInvalid.tsx +11 -14
  90. package/src/components/Form/examples/FormInvalidWithFormAlert.tsx +20 -14
  91. package/src/components/Form/examples/FormLimitWidth.tsx +19 -3
  92. package/src/components/Form/examples/FormValidated.tsx +10 -12
  93. package/src/components/FormSelect/examples/FormSelectIconSpriteVariant.tsx +17 -11
  94. package/src/components/FormSelect/examples/FormSelectValidated.tsx +17 -11
  95. package/src/components/LoginPage/LoginForm.tsx +12 -15
  96. package/src/components/LoginPage/__tests__/__snapshots__/LoginForm.test.tsx.snap +0 -9
  97. package/src/components/Nav/examples/Nav.md +0 -5
  98. package/src/components/Page/Page.tsx +2 -2
  99. package/src/components/Page/__tests__/Page.test.tsx +1 -1
  100. package/src/components/Page/examples/Page.md +6 -13
  101. package/src/components/Page/index.ts +0 -4
  102. package/src/components/TextArea/examples/TextAreaValidated.tsx +9 -12
  103. package/src/components/Wizard/examples/WizardEnabledOnFormValidation.tsx +18 -9
  104. package/src/components/Wizard/examples/WizardValidateOnButtonPress.tsx +12 -9
  105. package/src/demos/Nav.md +37 -30
  106. package/src/demos/Page.md +0 -8
  107. package/src/demos/examples/HelperText/HelperTextDynamicVariantStaticText.tsx +2 -2
  108. package/src/demos/examples/HelperText/HelperTextStaticVariantDynamicText.tsx +1 -1
  109. package/src/demos/examples/HelperText/HelperTextStaticVariantStaticText.tsx +1 -1
  110. package/src/demos/examples/Page/PageStickySectionGroupUsingPageHeader.tsx +0 -267
  111. package/src/{components/Page → deprecated/components/PageHeader}/PageHeader.tsx +2 -2
  112. package/src/{components/Page → deprecated/components/PageHeader}/PageHeaderToolsGroup.tsx +2 -2
  113. package/src/{components/Page → deprecated/components/PageHeader}/PageHeaderToolsItem.tsx +2 -2
  114. package/src/deprecated/components/PageHeader/examples/PageHeader.md +15 -0
  115. package/src/{components/Page → deprecated/components/PageHeader}/examples/PageVerticalNavUsingPageHeaderComponent.tsx +4 -2
  116. package/src/deprecated/components/PageHeader/index.ts +4 -0
  117. package/src/{components/Page/__tests__ → deprecated/components/PageHeader/tests}/PageHeader.test.tsx +0 -2
  118. package/src/{components/Page/__tests__/Generated → deprecated/components/PageHeader/tests}/PageHeaderTools.test.tsx +2 -2
  119. package/src/{components/Page/__tests__/Generated → deprecated/components/PageHeader/tests}/PageHeaderToolsGroup.test.tsx +2 -2
  120. package/src/{components/Page/__tests__/Generated → deprecated/components/PageHeader/tests}/PageHeaderToolsItem.test.tsx +2 -2
  121. package/src/{components/Page/__tests__/Generated → deprecated/components/PageHeader/tests}/__snapshots__/PageHeaderToolsItem.test.tsx.snap +1 -0
  122. package/src/deprecated/components/index.ts +1 -0
  123. package/src/next/components/Wizard/examples/WizardEnabledOnFormValidation.tsx +9 -9
  124. package/src/next/components/Wizard/examples/WizardValidateOnButtonPress.tsx +12 -9
  125. package/dist/esm/components/Page/PageHeader.d.ts.map +0 -1
  126. package/dist/esm/components/Page/PageHeader.js.map +0 -1
  127. package/dist/esm/components/Page/PageHeaderTools.d.ts.map +0 -1
  128. package/dist/esm/components/Page/PageHeaderTools.js.map +0 -1
  129. package/dist/esm/components/Page/PageHeaderToolsGroup.d.ts.map +0 -1
  130. package/dist/esm/components/Page/PageHeaderToolsGroup.js.map +0 -1
  131. package/dist/esm/components/Page/PageHeaderToolsItem.d.ts.map +0 -1
  132. package/dist/esm/components/Page/PageHeaderToolsItem.js.map +0 -1
  133. package/dist/js/components/Page/PageHeader.d.ts.map +0 -1
  134. package/dist/js/components/Page/PageHeader.js.map +0 -1
  135. package/dist/js/components/Page/PageHeaderTools.d.ts.map +0 -1
  136. package/dist/js/components/Page/PageHeaderTools.js.map +0 -1
  137. package/dist/js/components/Page/PageHeaderToolsGroup.d.ts.map +0 -1
  138. package/dist/js/components/Page/PageHeaderToolsGroup.js.map +0 -1
  139. package/dist/js/components/Page/PageHeaderToolsItem.d.ts.map +0 -1
  140. package/dist/js/components/Page/PageHeaderToolsItem.js.map +0 -1
  141. package/src/components/Nav/examples/NavHorizontalPageHeader.tsx +0 -34
  142. /package/dist/esm/{components/Page → deprecated/components/PageHeader}/PageHeader.d.ts +0 -0
  143. /package/dist/esm/{components/Page → deprecated/components/PageHeader}/PageHeaderTools.d.ts +0 -0
  144. /package/dist/esm/{components/Page → deprecated/components/PageHeader}/PageHeaderTools.js +0 -0
  145. /package/dist/esm/{components/Page → deprecated/components/PageHeader}/PageHeaderToolsGroup.d.ts +0 -0
  146. /package/dist/esm/{components/Page → deprecated/components/PageHeader}/PageHeaderToolsItem.d.ts +0 -0
  147. /package/dist/js/{components/Page → deprecated/components/PageHeader}/PageHeader.d.ts +0 -0
  148. /package/dist/js/{components/Page → deprecated/components/PageHeader}/PageHeaderTools.d.ts +0 -0
  149. /package/dist/js/{components/Page → deprecated/components/PageHeader}/PageHeaderTools.js +0 -0
  150. /package/dist/js/{components/Page → deprecated/components/PageHeader}/PageHeaderToolsGroup.d.ts +0 -0
  151. /package/dist/js/{components/Page → deprecated/components/PageHeader}/PageHeaderToolsItem.d.ts +0 -0
  152. /package/src/{components/Page → deprecated/components/PageHeader}/PageHeaderTools.tsx +0 -0
  153. /package/src/{components/Page/__tests__ → deprecated/components/PageHeader/tests}/__snapshots__/PageHeader.test.tsx.snap +0 -0
  154. /package/src/{components/Page/__tests__/Generated → deprecated/components/PageHeader/tests}/__snapshots__/PageHeaderTools.test.tsx.snap +0 -0
  155. /package/src/{components/Page/__tests__/Generated → deprecated/components/PageHeader/tests}/__snapshots__/PageHeaderToolsGroup.test.tsx.snap +0 -0
@@ -15,7 +15,7 @@ propComponents:
15
15
  'FormFieldGroupHeader',
16
16
  'FormFieldGroupHeaderTitleTextObject',
17
17
  'Button',
18
- 'Popover',
18
+ 'Popover'
19
19
  ]
20
20
  ---
21
21
 
@@ -41,62 +41,76 @@ import TrashIcon from '@patternfly/react-icons/dist/esm/icons/trash-icon';
41
41
 
42
42
  ## Examples
43
43
 
44
+ When using helper text inside a `FormGroup`, the `HelperText` component should be wrapped with the `FormHelperText` component to provide additional spacing.
45
+
44
46
  ### Basic
45
47
 
46
48
  ```ts file="./FormBasic.tsx"
49
+
47
50
  ```
48
51
 
49
52
  ### Horizontal
50
53
 
51
54
  ```ts file="./FormHorizontal.tsx"
55
+
52
56
  ```
53
57
 
54
58
  ### Limit width
55
59
 
56
60
  ```ts file="./FormLimitWidth.tsx"
61
+
57
62
  ```
58
63
 
59
64
  ### Invalid
60
65
 
61
66
  ```ts file="./FormInvalid.tsx"
67
+
62
68
  ```
63
69
 
64
70
  ### Invalid with form alert
65
71
 
66
72
  ```ts file="./FormInvalidWithFormAlert.tsx"
73
+
67
74
  ```
68
75
 
69
76
  ### Validated
70
77
 
71
78
  ```ts file="./FormValidated.tsx"
79
+
72
80
  ```
73
81
 
74
82
  ### Horizontal stacked no padding top
75
83
 
76
84
  ```ts file="./FormHorizontalStacked.tsx"
85
+
77
86
  ```
78
87
 
79
88
  ### Horizontal stacked helper text on top
80
89
 
81
90
  ```ts file="./FormHorizontalHelper.tsx"
91
+
82
92
  ```
83
93
 
84
94
  ### Form group with additional label info
85
95
 
86
96
  ```ts file="./FormGroupLabelInfo.tsx"
97
+
87
98
  ```
88
99
 
89
100
  ### Form Sections
90
101
 
91
102
  ```ts file="./FormSections.tsx"
103
+
92
104
  ```
93
105
 
94
106
  ### Grid form
95
107
 
96
108
  ```ts file="./FormGrid.tsx"
109
+
97
110
  ```
98
111
 
99
112
  ### Field Groups
100
113
 
101
114
  ```ts file="./FormFieldGroups.tsx"
115
+
102
116
  ```
@@ -1,5 +1,17 @@
1
1
  import React from 'react';
2
- import { Form, FormGroup, TextInput, Checkbox, Popover, ActionGroup, Button, Radio } from '@patternfly/react-core';
2
+ import {
3
+ Form,
4
+ FormGroup,
5
+ TextInput,
6
+ Checkbox,
7
+ Popover,
8
+ ActionGroup,
9
+ Button,
10
+ Radio,
11
+ HelperText,
12
+ HelperTextItem,
13
+ FormHelperText
14
+ } from '@patternfly/react-core';
3
15
  import HelpIcon from '@patternfly/react-icons/dist/esm/icons/help-icon';
4
16
 
5
17
  export const FormBasic: React.FunctionComponent = () => {
@@ -54,7 +66,7 @@ export const FormBasic: React.FunctionComponent = () => {
54
66
  <button
55
67
  type="button"
56
68
  aria-label="More info for name field"
57
- onClick={e => e.preventDefault()}
69
+ onClick={(e) => e.preventDefault()}
58
70
  aria-describedby="simple-form-name-01"
59
71
  className="pf-c-form__group-label-help"
60
72
  >
@@ -64,7 +76,6 @@ export const FormBasic: React.FunctionComponent = () => {
64
76
  }
65
77
  isRequired
66
78
  fieldId="simple-form-name-01"
67
- helperText="Include your middle name if you have one."
68
79
  >
69
80
  <TextInput
70
81
  isRequired
@@ -75,6 +86,11 @@ export const FormBasic: React.FunctionComponent = () => {
75
86
  value={name}
76
87
  onChange={handleNameChange}
77
88
  />
89
+ <FormHelperText>
90
+ <HelperText>
91
+ <HelperTextItem>Include your middle name if you have one.</HelperTextItem>
92
+ </HelperText>
93
+ </FormHelperText>
78
94
  </FormGroup>
79
95
  <FormGroup label="Email" isRequired fieldId="simple-form-email-01">
80
96
  <TextInput
@@ -1,5 +1,14 @@
1
1
  import React from 'react';
2
- import { Form, FormGroup, TextInput, Grid, GridItem } from '@patternfly/react-core';
2
+ import {
3
+ Form,
4
+ FormGroup,
5
+ TextInput,
6
+ Grid,
7
+ GridItem,
8
+ HelperText,
9
+ HelperTextItem,
10
+ FormHelperText
11
+ } from '@patternfly/react-core';
3
12
 
4
13
  export const FormGrid: React.FunctionComponent = () => {
5
14
  const [name, setName] = React.useState('');
@@ -22,12 +31,7 @@ export const FormGrid: React.FunctionComponent = () => {
22
31
  <Form>
23
32
  <Grid hasGutter md={6}>
24
33
  <GridItem span={12}>
25
- <FormGroup
26
- label="Full name"
27
- isRequired
28
- fieldId="grid-form-name-01"
29
- helperText="Include your middle name if you have one."
30
- >
34
+ <FormGroup label="Full name" isRequired fieldId="grid-form-name-01">
31
35
  <TextInput
32
36
  isRequired
33
37
  type="text"
@@ -37,6 +41,11 @@ export const FormGrid: React.FunctionComponent = () => {
37
41
  value={name}
38
42
  onChange={handleNameChange}
39
43
  />
44
+ <FormHelperText>
45
+ <HelperText>
46
+ <HelperTextItem>Include your middle name if you have one.</HelperTextItem>
47
+ </HelperText>
48
+ </FormHelperText>
40
49
  </FormGroup>
41
50
  </GridItem>
42
51
  <FormGroup label="Email" isRequired fieldId="grid-form-email-01">
@@ -1,5 +1,13 @@
1
1
  import React from 'react';
2
- import { Form, FormGroup, TextInput, Popover } from '@patternfly/react-core';
2
+ import {
3
+ Form,
4
+ FormGroup,
5
+ TextInput,
6
+ Popover,
7
+ HelperText,
8
+ HelperTextItem,
9
+ FormHelperText
10
+ } from '@patternfly/react-core';
3
11
  import HelpIcon from '@patternfly/react-icons/dist/esm/icons/help-icon';
4
12
 
5
13
  export const FormGroupLabelInfo: React.FunctionComponent = () => {
@@ -45,7 +53,7 @@ export const FormGroupLabelInfo: React.FunctionComponent = () => {
45
53
  <button
46
54
  type="button"
47
55
  aria-label="More info for name field"
48
- onClick={e => e.preventDefault()}
56
+ onClick={(e) => e.preventDefault()}
49
57
  aria-describedby="form-group-label-info"
50
58
  className="pf-c-form__group-label-help"
51
59
  >
@@ -55,7 +63,6 @@ export const FormGroupLabelInfo: React.FunctionComponent = () => {
55
63
  }
56
64
  isRequired
57
65
  fieldId="form-group-label-info"
58
- helperText="Include your middle name if you have one."
59
66
  >
60
67
  <TextInput
61
68
  isRequired
@@ -66,6 +73,11 @@ export const FormGroupLabelInfo: React.FunctionComponent = () => {
66
73
  value={name}
67
74
  onChange={handleNameChange}
68
75
  />
76
+ <FormHelperText>
77
+ <HelperText>
78
+ <HelperTextItem>Include your middle name if you have one.</HelperTextItem>
79
+ </HelperText>
80
+ </FormHelperText>
69
81
  </FormGroup>
70
82
  </Form>
71
83
  );
@@ -9,7 +9,10 @@ import {
9
9
  Checkbox,
10
10
  ActionGroup,
11
11
  Button,
12
- Radio
12
+ Radio,
13
+ HelperText,
14
+ HelperTextItem,
15
+ FormHelperText
13
16
  } from '@patternfly/react-core';
14
17
 
15
18
  export const FormHorizontal: React.FunctionComponent = () => {
@@ -46,12 +49,7 @@ export const FormHorizontal: React.FunctionComponent = () => {
46
49
 
47
50
  return (
48
51
  <Form isHorizontal>
49
- <FormGroup
50
- label="Full name"
51
- isRequired
52
- fieldId="horizontal-form-name"
53
- helperText="Include your middle name if you have one."
54
- >
52
+ <FormGroup label="Full name" isRequired fieldId="horizontal-form-name">
55
53
  <TextInput
56
54
  value={name}
57
55
  isRequired
@@ -61,6 +59,11 @@ export const FormHorizontal: React.FunctionComponent = () => {
61
59
  name="horizontal-form-name"
62
60
  onChange={handleNameChange}
63
61
  />
62
+ <FormHelperText>
63
+ <HelperText>
64
+ <HelperTextItem>Include your middle name if you have one.</HelperTextItem>
65
+ </HelperText>
66
+ </FormHelperText>
64
67
  </FormGroup>
65
68
  <FormGroup label="Email" isRequired fieldId="horizontal-form-email">
66
69
  <TextInput
@@ -1,23 +1,16 @@
1
1
  import React from 'react';
2
- import { Form, FormGroup, Checkbox } from '@patternfly/react-core';
2
+ import { Form, FormGroup, Checkbox, HelperText, HelperTextItem, FormHelperText } from '@patternfly/react-core';
3
3
 
4
- export const FormHorizontalFormHelperText: React.FunctionComponent = () => {
5
- const [helperText] = React.useState('Select all that apply:');
6
-
7
- return (
8
- <Form isHorizontal>
9
- <FormGroup
10
- label="Label"
11
- helperText={helperText}
12
- isHelperTextBeforeField
13
- hasNoPaddingTop
14
- isStack
15
- fieldId="horizontal-form-helper-options"
16
- role="group"
17
- >
18
- <Checkbox label="Option 1" id="option-03" />
19
- <Checkbox label="Option 2" id="option-04" />
20
- </FormGroup>
21
- </Form>
22
- );
23
- };
4
+ export const FormHorizontalFormHelperText: React.FunctionComponent = () => (
5
+ <Form isHorizontal>
6
+ <FormGroup label="Label" hasNoPaddingTop isStack fieldId="horizontal-form-helper-options" role="group">
7
+ <FormHelperText>
8
+ <HelperText>
9
+ <HelperTextItem>Select all that apply:</HelperTextItem>
10
+ </HelperText>
11
+ </FormHelperText>
12
+ <Checkbox label="Option 1" id="option-03" />
13
+ <Checkbox label="Option 2" id="option-04" />
14
+ </FormGroup>
15
+ </Form>
16
+ );
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { Form, FormGroup, TextInput, FormHelperText } from '@patternfly/react-core';
2
+ import { Form, FormGroup, TextInput, HelperText, HelperTextItem, FormHelperText } from '@patternfly/react-core';
3
3
  import ExclamationCircleIcon from '@patternfly/react-icons/dist/esm/icons/exclamation-circle-icon';
4
4
 
5
5
  export const FormInvalid: React.FunctionComponent = () => {
@@ -21,19 +21,7 @@ export const FormInvalid: React.FunctionComponent = () => {
21
21
 
22
22
  return (
23
23
  <Form>
24
- <FormGroup
25
- label="Age"
26
- type="number"
27
- helperText={
28
- <FormHelperText icon={<ExclamationCircleIcon />} isHidden={validated !== 'default'}>
29
- Please enter your age
30
- </FormHelperText>
31
- }
32
- helperTextInvalid="Must be a number"
33
- helperTextInvalidIcon={<ExclamationCircleIcon />}
34
- fieldId="age-1"
35
- validated={validated}
36
- >
24
+ <FormGroup label="Age" type="number" fieldId="age-1">
37
25
  <TextInput
38
26
  validated={validated}
39
27
  value={age}
@@ -41,6 +29,15 @@ export const FormInvalid: React.FunctionComponent = () => {
41
29
  aria-describedby="age-1-helper"
42
30
  onChange={handleAgeChange}
43
31
  />
32
+ {validated !== 'success' && (
33
+ <FormHelperText>
34
+ <HelperText>
35
+ <HelperTextItem icon={<ExclamationCircleIcon />} variant={validated}>
36
+ {validated === 'error' ? 'Must be a number' : 'Please enter your age'}
37
+ </HelperTextItem>
38
+ </HelperText>
39
+ </FormHelperText>
40
+ )}
44
41
  </FormGroup>
45
42
  </Form>
46
43
  );
@@ -1,5 +1,14 @@
1
1
  import React from 'react';
2
- import { Alert, Form, FormAlert, FormGroup, TextInput, FormHelperText } from '@patternfly/react-core';
2
+ import {
3
+ Alert,
4
+ Form,
5
+ FormAlert,
6
+ FormGroup,
7
+ TextInput,
8
+ HelperText,
9
+ HelperTextItem,
10
+ FormHelperText
11
+ } from '@patternfly/react-core';
3
12
  import ExclamationCircleIcon from '@patternfly/react-icons/dist/esm/icons/exclamation-circle-icon';
4
13
 
5
14
  export const FormInvalidWithAlert: React.FunctionComponent = () => {
@@ -26,19 +35,7 @@ export const FormInvalidWithAlert: React.FunctionComponent = () => {
26
35
  <Alert variant="danger" title="Fill out all required fields before continuing." aria-live="polite" isInline />
27
36
  </FormAlert>
28
37
  )}
29
- <FormGroup
30
- label="Age"
31
- type="number"
32
- helperText={
33
- <FormHelperText icon={<ExclamationCircleIcon />} isHidden={validated !== 'default'}>
34
- Please enter your age
35
- </FormHelperText>
36
- }
37
- helperTextInvalid="Must be a number"
38
- helperTextInvalidIcon={<ExclamationCircleIcon />}
39
- fieldId="age-2"
40
- validated={validated}
41
- >
38
+ <FormGroup label="Age" type="number" fieldId="age-2">
42
39
  <TextInput
43
40
  validated={validated}
44
41
  value={age}
@@ -46,6 +43,15 @@ export const FormInvalidWithAlert: React.FunctionComponent = () => {
46
43
  aria-describedby="age-2-helper"
47
44
  onChange={handleAgeChange}
48
45
  />
46
+ {validated !== 'success' && (
47
+ <FormHelperText>
48
+ <HelperText>
49
+ <HelperTextItem icon={<ExclamationCircleIcon />} variant={validated}>
50
+ {validated === 'error' ? 'Must be a number' : 'Please enter your age'}
51
+ </HelperTextItem>
52
+ </HelperText>
53
+ </FormHelperText>
54
+ )}
49
55
  </FormGroup>
50
56
  </Form>
51
57
  );
@@ -1,5 +1,17 @@
1
1
  import React from 'react';
2
- import { Form, FormGroup, TextInput, Checkbox, Popover, ActionGroup, Button, Radio } from '@patternfly/react-core';
2
+ import {
3
+ Form,
4
+ FormGroup,
5
+ TextInput,
6
+ Checkbox,
7
+ Popover,
8
+ ActionGroup,
9
+ Button,
10
+ Radio,
11
+ HelperText,
12
+ HelperTextItem,
13
+ FormHelperText
14
+ } from '@patternfly/react-core';
3
15
  import HelpIcon from '@patternfly/react-icons/dist/esm/icons/help-icon';
4
16
 
5
17
  export const FormLimitWidth: React.FunctionComponent = () => {
@@ -54,7 +66,7 @@ export const FormLimitWidth: React.FunctionComponent = () => {
54
66
  <button
55
67
  type="button"
56
68
  aria-label="More info for name field"
57
- onClick={e => e.preventDefault()}
69
+ onClick={(e) => e.preventDefault()}
58
70
  aria-describedby="simple-form-name-02"
59
71
  className="pf-c-form__group-label-help"
60
72
  >
@@ -64,7 +76,6 @@ export const FormLimitWidth: React.FunctionComponent = () => {
64
76
  }
65
77
  isRequired
66
78
  fieldId="simple-form-name-02"
67
- helperText="Include your middle name if you have one."
68
79
  >
69
80
  <TextInput
70
81
  isRequired
@@ -75,6 +86,11 @@ export const FormLimitWidth: React.FunctionComponent = () => {
75
86
  value={name}
76
87
  onChange={handleNameChange}
77
88
  />
89
+ <FormHelperText>
90
+ <HelperText>
91
+ <HelperTextItem>Include your middle name if you have one.</HelperTextItem>
92
+ </HelperText>
93
+ </FormHelperText>
78
94
  </FormGroup>
79
95
  <FormGroup label="Email" isRequired fieldId="simple-form-email-02">
80
96
  <TextInput
@@ -1,12 +1,11 @@
1
1
  import React from 'react';
2
- import { Form, FormGroup, TextInput } from '@patternfly/react-core';
2
+ import { Form, FormGroup, FormHelperText, HelperText, HelperTextItem, TextInput } from '@patternfly/react-core';
3
3
  import ExclamationCircleIcon from '@patternfly/react-icons/dist/esm/icons/exclamation-circle-icon';
4
4
 
5
5
  export const FormValidated: React.FunctionComponent = () => {
6
6
  type validate = 'success' | 'warning' | 'error' | 'default';
7
7
 
8
8
  const [age, setAge] = React.useState('Five');
9
- const [invalidText, setInvalidText] = React.useState('Must be a number');
10
9
  const [validated, setValidated] = React.useState<validate>('default');
11
10
  const [helperText, setHelperText] = React.useState('Enter your age to continue');
12
11
 
@@ -29,7 +28,7 @@ export const FormValidated: React.FunctionComponent = () => {
29
28
  }
30
29
  } else {
31
30
  setValidated('error');
32
- setInvalidText('Must be a number');
31
+ setHelperText('Must be a number');
33
32
  }
34
33
  }, 2000);
35
34
 
@@ -38,15 +37,7 @@ export const FormValidated: React.FunctionComponent = () => {
38
37
 
39
38
  return (
40
39
  <Form>
41
- <FormGroup
42
- label="Age"
43
- type="number"
44
- helperText={helperText}
45
- helperTextInvalid={invalidText}
46
- helperTextInvalidIcon={<ExclamationCircleIcon />}
47
- fieldId="age-3"
48
- validated={validated}
49
- >
40
+ <FormGroup label="Age" type="number" fieldId="age-3">
50
41
  <TextInput
51
42
  validated={validated}
52
43
  value={age}
@@ -54,6 +45,13 @@ export const FormValidated: React.FunctionComponent = () => {
54
45
  aria-describedby="age-3-helper"
55
46
  onChange={handleAgeChange}
56
47
  />
48
+ <FormHelperText>
49
+ <HelperText>
50
+ <HelperTextItem variant={validated} {...(validated === 'error' && { icon: <ExclamationCircleIcon /> })}>
51
+ {helperText}
52
+ </HelperTextItem>
53
+ </HelperText>
54
+ </FormHelperText>
57
55
  </FormGroup>
58
56
  </Form>
59
57
  );
@@ -1,10 +1,18 @@
1
1
  import React from 'react';
2
- import { Form, FormGroup, FormSelect, FormSelectOption, ValidatedOptions } from '@patternfly/react-core';
2
+ import {
3
+ Form,
4
+ FormGroup,
5
+ FormHelperText,
6
+ FormSelect,
7
+ FormSelectOption,
8
+ HelperText,
9
+ HelperTextItem,
10
+ ValidatedOptions
11
+ } from '@patternfly/react-core';
3
12
 
4
13
  export const FormSelectIconSpriteVariant: React.FunctionComponent = () => {
5
14
  const [formSelectValue, setFormSelectValue] = React.useState('');
6
15
  const [validated, setValidated] = React.useState<ValidatedOptions>(ValidatedOptions.default);
7
- const [invalidText, setInvalidText] = React.useState('You must choose something');
8
16
  const [helperText, setHelperText] = React.useState('');
9
17
 
10
18
  const onChange = (value: string) => {
@@ -19,7 +27,7 @@ export const FormSelectIconSpriteVariant: React.FunctionComponent = () => {
19
27
  } else {
20
28
  setFormSelectValue(value);
21
29
  setValidated(ValidatedOptions.error);
22
- setInvalidText('You must chose Three (thought that was obvious)');
30
+ setHelperText('You must chose Three (thought that was obvious)');
23
31
  }
24
32
  };
25
33
 
@@ -32,14 +40,7 @@ export const FormSelectIconSpriteVariant: React.FunctionComponent = () => {
32
40
 
33
41
  return (
34
42
  <Form>
35
- <FormGroup
36
- label="Selection:"
37
- type="string"
38
- helperText={helperText}
39
- helperTextInvalid={invalidText}
40
- fieldId="selection"
41
- validated={validated}
42
- >
43
+ <FormGroup label="Selection:" type="string" fieldId="selection">
43
44
  <FormSelect
44
45
  validated={validated}
45
46
  isIconSprite
@@ -51,6 +52,11 @@ export const FormSelectIconSpriteVariant: React.FunctionComponent = () => {
51
52
  <FormSelectOption isDisabled={option.disabled} key={index} value={option.value} label={option.label} />
52
53
  ))}
53
54
  </FormSelect>
55
+ <FormHelperText>
56
+ <HelperText>
57
+ <HelperTextItem variant={validated}>{helperText}</HelperTextItem>
58
+ </HelperText>
59
+ </FormHelperText>
54
60
  </FormGroup>
55
61
  </Form>
56
62
  );
@@ -1,9 +1,17 @@
1
1
  import React from 'react';
2
- import { Form, FormGroup, FormSelect, FormSelectOption, ValidatedOptions } from '@patternfly/react-core';
2
+ import {
3
+ Form,
4
+ FormGroup,
5
+ FormHelperText,
6
+ FormSelect,
7
+ FormSelectOption,
8
+ HelperText,
9
+ HelperTextItem,
10
+ ValidatedOptions
11
+ } from '@patternfly/react-core';
3
12
 
4
13
  export const FormSelectValidated: React.FunctionComponent = () => {
5
14
  const [formValue, setFormValue] = React.useState('');
6
- const [invalidText, setInvalidText] = React.useState('You must choose something');
7
15
  const [helperText, setHelperText] = React.useState('');
8
16
  const [validated, setValidated] = React.useState<ValidatedOptions>(ValidatedOptions.default);
9
17
 
@@ -24,7 +32,7 @@ export const FormSelectValidated: React.FunctionComponent = () => {
24
32
  setHelperText('You must select a value');
25
33
  } else {
26
34
  setValidated(ValidatedOptions.error);
27
- setInvalidText('You must chose Three (thought that was obvious)');
35
+ setHelperText('You must chose Three (thought that was obvious)');
28
36
  }
29
37
  });
30
38
  };
@@ -38,14 +46,7 @@ export const FormSelectValidated: React.FunctionComponent = () => {
38
46
 
39
47
  return (
40
48
  <Form>
41
- <FormGroup
42
- label="Selection:"
43
- type="string"
44
- helperText={helperText}
45
- helperTextInvalid={invalidText}
46
- fieldId="selection"
47
- validated={validated}
48
- >
49
+ <FormGroup label="Selection:" type="string" fieldId="selection">
49
50
  <FormSelect
50
51
  id="selection"
51
52
  validated={validated}
@@ -63,6 +64,11 @@ export const FormSelectValidated: React.FunctionComponent = () => {
63
64
  />
64
65
  ))}
65
66
  </FormSelect>
67
+ <FormHelperText>
68
+ <HelperText>
69
+ <HelperTextItem variant={validated}>{helperText}</HelperTextItem>
70
+ </HelperText>
71
+ </FormHelperText>
66
72
  </FormGroup>
67
73
  </Form>
68
74
  );
@@ -7,6 +7,7 @@ import { ValidatedOptions } from '../../helpers/constants';
7
7
  import { InputGroup } from '../InputGroup';
8
8
  import EyeSlashIcon from '@patternfly/react-icons/dist/esm/icons/eye-slash-icon';
9
9
  import EyeIcon from '@patternfly/react-icons/dist/esm/icons/eye-icon';
10
+ import { HelperText, HelperTextItem } from '../HelperText';
10
11
 
11
12
  export interface LoginFormProps extends Omit<React.HTMLProps<HTMLFormElement>, 'ref'> {
12
13
  /** Flag to indicate if the first dropdown item should not gain initial focus */
@@ -96,15 +97,16 @@ export const LoginForm: React.FunctionComponent<LoginFormProps> = ({
96
97
 
97
98
  return (
98
99
  <Form className={className} {...props}>
99
- <FormHelperText isError={!isValidUsername || !isValidPassword} isHidden={!showHelperText} icon={helperTextIcon}>
100
- {helperText}
101
- </FormHelperText>
102
- <FormGroup
103
- label={usernameLabel}
104
- isRequired
105
- validated={isValidUsername ? ValidatedOptions.default : ValidatedOptions.error}
106
- fieldId="pf-login-username-id"
107
- >
100
+ {showHelperText && (
101
+ <FormHelperText>
102
+ <HelperText>
103
+ <HelperTextItem variant={!isValidUsername || !isValidPassword ? 'error' : 'default'} icon={helperTextIcon}>
104
+ {helperText}
105
+ </HelperTextItem>
106
+ </HelperText>
107
+ </FormHelperText>
108
+ )}
109
+ <FormGroup label={usernameLabel} isRequired fieldId="pf-login-username-id">
108
110
  <TextInput
109
111
  autoFocus={!noAutoFocus}
110
112
  id="pf-login-username-id"
@@ -116,12 +118,7 @@ export const LoginForm: React.FunctionComponent<LoginFormProps> = ({
116
118
  onChange={onChangeUsername}
117
119
  />
118
120
  </FormGroup>
119
- <FormGroup
120
- label={passwordLabel}
121
- isRequired
122
- validated={isValidPassword ? ValidatedOptions.default : ValidatedOptions.error}
123
- fieldId="pf-login-password-id"
124
- >
121
+ <FormGroup label={passwordLabel} isRequired fieldId="pf-login-password-id">
125
122
  {isShowPasswordEnabled && (
126
123
  <InputGroup>
127
124
  {passwordInput}
@@ -6,9 +6,6 @@ exports[`LoginForm LoginForm with rememberMeLabel 1`] = `
6
6
  class="pf-c-form"
7
7
  novalidate=""
8
8
  >
9
- <p
10
- class="pf-c-form__helper-text pf-m-hidden"
11
- />
12
9
  <div
13
10
  class="pf-c-form__group"
14
11
  >
@@ -150,9 +147,6 @@ exports[`LoginForm LoginForm with show password 1`] = `
150
147
  class="pf-c-form"
151
148
  novalidate=""
152
149
  >
153
- <p
154
- class="pf-c-form__helper-text pf-m-hidden"
155
- />
156
150
  <div
157
151
  class="pf-c-form__group"
158
152
  >
@@ -294,9 +288,6 @@ exports[`LoginForm should render Login form 1`] = `
294
288
  class="pf-c-form"
295
289
  novalidate=""
296
290
  >
297
- <p
298
- class="pf-c-form__helper-text pf-m-hidden"
299
- />
300
291
  <div
301
292
  class="pf-c-form__group"
302
293
  >