@patternfly/react-core 5.0.0-alpha.54 → 5.0.0-alpha.56
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 +13 -0
- package/dist/esm/components/Dropdown/Dropdown.d.ts.map +1 -1
- package/dist/esm/components/Dropdown/Dropdown.js +1 -1
- package/dist/esm/components/Dropdown/Dropdown.js.map +1 -1
- package/dist/esm/components/Form/FormGroup.d.ts +0 -16
- package/dist/esm/components/Form/FormGroup.d.ts.map +1 -1
- package/dist/esm/components/Form/FormGroup.js +3 -15
- package/dist/esm/components/Form/FormGroup.js.map +1 -1
- package/dist/esm/components/Form/FormHelperText.d.ts +2 -10
- package/dist/esm/components/Form/FormHelperText.d.ts.map +1 -1
- package/dist/esm/components/Form/FormHelperText.js +2 -5
- package/dist/esm/components/Form/FormHelperText.js.map +1 -1
- package/dist/esm/components/LoginPage/LoginForm.d.ts.map +1 -1
- package/dist/esm/components/LoginPage/LoginForm.js +6 -3
- package/dist/esm/components/LoginPage/LoginForm.js.map +1 -1
- package/dist/esm/components/Menu/MenuItem.d.ts +3 -1
- package/dist/esm/components/Menu/MenuItem.d.ts.map +1 -1
- package/dist/esm/components/Menu/MenuItem.js +7 -6
- package/dist/esm/components/Menu/MenuItem.js.map +1 -1
- package/dist/esm/components/Wizard/WizardNavItem.d.ts.map +1 -1
- package/dist/esm/components/Wizard/WizardNavItem.js +2 -1
- package/dist/esm/components/Wizard/WizardNavItem.js.map +1 -1
- package/dist/js/components/Dropdown/Dropdown.d.ts.map +1 -1
- package/dist/js/components/Dropdown/Dropdown.js +1 -1
- package/dist/js/components/Dropdown/Dropdown.js.map +1 -1
- package/dist/js/components/Form/FormGroup.d.ts +0 -16
- package/dist/js/components/Form/FormGroup.d.ts.map +1 -1
- package/dist/js/components/Form/FormGroup.js +3 -15
- package/dist/js/components/Form/FormGroup.js.map +1 -1
- package/dist/js/components/Form/FormHelperText.d.ts +2 -10
- package/dist/js/components/Form/FormHelperText.d.ts.map +1 -1
- package/dist/js/components/Form/FormHelperText.js +2 -5
- package/dist/js/components/Form/FormHelperText.js.map +1 -1
- package/dist/js/components/LoginPage/LoginForm.d.ts.map +1 -1
- package/dist/js/components/LoginPage/LoginForm.js +6 -3
- package/dist/js/components/LoginPage/LoginForm.js.map +1 -1
- package/dist/js/components/Menu/MenuItem.d.ts +3 -1
- package/dist/js/components/Menu/MenuItem.d.ts.map +1 -1
- package/dist/js/components/Menu/MenuItem.js +7 -6
- package/dist/js/components/Menu/MenuItem.js.map +1 -1
- package/dist/js/components/Wizard/WizardNavItem.d.ts.map +1 -1
- package/dist/js/components/Wizard/WizardNavItem.js +2 -1
- package/dist/js/components/Wizard/WizardNavItem.js.map +1 -1
- package/dist/umd/react-core.min.js +1 -1
- package/package.json +2 -2
- package/src/components/Dropdown/Dropdown.tsx +3 -1
- package/src/components/FileUpload/examples/FileUploadTextWithRestrictions.tsx +9 -7
- package/src/components/Form/FormGroup.tsx +1 -60
- package/src/components/Form/FormHelperText.tsx +7 -31
- package/src/components/Form/__tests__/FormGroup.test.tsx +6 -95
- package/src/components/Form/__tests__/FormHelperText.test.tsx +1 -14
- package/src/components/Form/__tests__/__snapshots__/FormGroup.test.tsx.snap +0 -211
- package/src/components/Form/__tests__/__snapshots__/FormHelperText.test.tsx.snap +12 -39
- package/src/components/Form/examples/Form.md +15 -1
- package/src/components/Form/examples/FormBasic.tsx +19 -3
- package/src/components/Form/examples/FormGrid.tsx +16 -7
- package/src/components/Form/examples/FormGroupLabelInfo.tsx +15 -3
- package/src/components/Form/examples/FormHorizontal.tsx +10 -7
- package/src/components/Form/examples/FormHorizontalHelper.tsx +14 -21
- package/src/components/Form/examples/FormInvalid.tsx +11 -14
- package/src/components/Form/examples/FormInvalidWithFormAlert.tsx +20 -14
- package/src/components/Form/examples/FormLimitWidth.tsx +19 -3
- package/src/components/Form/examples/FormValidated.tsx +10 -12
- package/src/components/FormSelect/examples/FormSelectIconSpriteVariant.tsx +17 -11
- package/src/components/FormSelect/examples/FormSelectValidated.tsx +17 -11
- package/src/components/LoginPage/LoginForm.tsx +12 -15
- package/src/components/LoginPage/__tests__/__snapshots__/LoginForm.test.tsx.snap +0 -9
- package/src/components/Menu/MenuItem.tsx +10 -7
- package/src/components/Menu/examples/Menu.md +1 -1
- package/src/components/TextArea/examples/TextAreaValidated.tsx +9 -12
- package/src/components/Wizard/WizardNavItem.tsx +2 -1
- package/src/components/Wizard/__tests__/Generated/__snapshots__/WizardNavItem.test.tsx.snap +1 -0
- package/src/components/Wizard/__tests__/__snapshots__/Wizard.test.tsx.snap +13 -0
- package/src/components/Wizard/examples/WizardEnabledOnFormValidation.tsx +18 -9
- package/src/components/Wizard/examples/WizardValidateOnButtonPress.tsx +12 -9
- package/src/demos/examples/HelperText/HelperTextDynamicVariantStaticText.tsx +2 -2
- package/src/demos/examples/HelperText/HelperTextStaticVariantDynamicText.tsx +1 -1
- package/src/demos/examples/HelperText/HelperTextStaticVariantStaticText.tsx +1 -1
- package/src/next/components/Wizard/examples/WizardEnabledOnFormValidation.tsx +9 -9
- package/src/next/components/Wizard/examples/WizardValidateOnButtonPress.tsx +12 -9
|
@@ -2,59 +2,32 @@
|
|
|
2
2
|
|
|
3
3
|
exports[`FormHelperText LoginFooterItem with custom node 1`] = `
|
|
4
4
|
<DocumentFragment>
|
|
5
|
-
<
|
|
6
|
-
class="pf-c-form__helper-text
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
<div
|
|
6
|
+
class="pf-c-form__helper-text"
|
|
7
|
+
>
|
|
8
|
+
<div>
|
|
9
|
+
My custom node
|
|
10
|
+
</div>
|
|
10
11
|
</div>
|
|
11
|
-
<p />
|
|
12
12
|
</DocumentFragment>
|
|
13
13
|
`;
|
|
14
14
|
|
|
15
15
|
exports[`FormHelperText className is added to the root element 1`] = `
|
|
16
16
|
<DocumentFragment>
|
|
17
|
-
<
|
|
18
|
-
class="pf-c-form__helper-text
|
|
17
|
+
<div
|
|
18
|
+
class="pf-c-form__helper-text extra-class"
|
|
19
19
|
>
|
|
20
20
|
test
|
|
21
|
-
</
|
|
21
|
+
</div>
|
|
22
22
|
</DocumentFragment>
|
|
23
23
|
`;
|
|
24
24
|
|
|
25
25
|
exports[`FormHelperText renders with PatternFly Core styles 1`] = `
|
|
26
26
|
<DocumentFragment>
|
|
27
|
-
<
|
|
28
|
-
class="pf-c-form__helper-text
|
|
27
|
+
<div
|
|
28
|
+
class="pf-c-form__helper-text"
|
|
29
29
|
>
|
|
30
30
|
test
|
|
31
|
-
</
|
|
32
|
-
</DocumentFragment>
|
|
33
|
-
`;
|
|
34
|
-
|
|
35
|
-
exports[`FormHelperText renders with icon 1`] = `
|
|
36
|
-
<DocumentFragment>
|
|
37
|
-
<p
|
|
38
|
-
class="pf-c-form__helper-text pf-m-error"
|
|
39
|
-
>
|
|
40
|
-
<span
|
|
41
|
-
class="pf-c-form__helper-text-icon"
|
|
42
|
-
>
|
|
43
|
-
<svg
|
|
44
|
-
aria-hidden="true"
|
|
45
|
-
fill="currentColor"
|
|
46
|
-
height="1em"
|
|
47
|
-
role="img"
|
|
48
|
-
style="vertical-align: -0.125em;"
|
|
49
|
-
viewBox="0 0 512 512"
|
|
50
|
-
width="1em"
|
|
51
|
-
>
|
|
52
|
-
<path
|
|
53
|
-
d="M504 256c0 136.997-111.043 248-248 248S8 392.997 8 256C8 119.083 119.043 8 256 8s248 111.083 248 248zm-248 50c-25.405 0-46 20.595-46 46s20.595 46 46 46 46-20.595 46-46-20.595-46-46-46zm-43.673-165.346l7.418 136c.347 6.364 5.609 11.346 11.982 11.346h48.546c6.373 0 11.635-4.982 11.982-11.346l7.418-136c.375-6.874-5.098-12.654-11.982-12.654h-63.383c-6.884 0-12.356 5.78-11.981 12.654z"
|
|
54
|
-
/>
|
|
55
|
-
</svg>
|
|
56
|
-
</span>
|
|
57
|
-
test
|
|
58
|
-
</p>
|
|
31
|
+
</div>
|
|
59
32
|
</DocumentFragment>
|
|
60
33
|
`;
|
|
@@ -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 {
|
|
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 {
|
|
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 {
|
|
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
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
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 {
|
|
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 {
|
|
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
|
-
|
|
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 {
|
|
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
|
-
|
|
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 {
|
|
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
|
-
|
|
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
|
);
|