@patternfly/react-core 5.0.0-alpha.54 → 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 (54) hide show
  1. package/CHANGELOG.md +6 -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/js/components/Form/FormGroup.d.ts +0 -16
  14. package/dist/js/components/Form/FormGroup.d.ts.map +1 -1
  15. package/dist/js/components/Form/FormGroup.js +3 -15
  16. package/dist/js/components/Form/FormGroup.js.map +1 -1
  17. package/dist/js/components/Form/FormHelperText.d.ts +2 -10
  18. package/dist/js/components/Form/FormHelperText.d.ts.map +1 -1
  19. package/dist/js/components/Form/FormHelperText.js +2 -5
  20. package/dist/js/components/Form/FormHelperText.js.map +1 -1
  21. package/dist/js/components/LoginPage/LoginForm.d.ts.map +1 -1
  22. package/dist/js/components/LoginPage/LoginForm.js +6 -3
  23. package/dist/js/components/LoginPage/LoginForm.js.map +1 -1
  24. package/dist/umd/react-core.min.js +1 -1
  25. package/package.json +2 -2
  26. package/src/components/FileUpload/examples/FileUploadTextWithRestrictions.tsx +9 -7
  27. package/src/components/Form/FormGroup.tsx +1 -60
  28. package/src/components/Form/FormHelperText.tsx +7 -31
  29. package/src/components/Form/__tests__/FormGroup.test.tsx +6 -95
  30. package/src/components/Form/__tests__/FormHelperText.test.tsx +1 -14
  31. package/src/components/Form/__tests__/__snapshots__/FormGroup.test.tsx.snap +0 -211
  32. package/src/components/Form/__tests__/__snapshots__/FormHelperText.test.tsx.snap +12 -39
  33. package/src/components/Form/examples/Form.md +15 -1
  34. package/src/components/Form/examples/FormBasic.tsx +19 -3
  35. package/src/components/Form/examples/FormGrid.tsx +16 -7
  36. package/src/components/Form/examples/FormGroupLabelInfo.tsx +15 -3
  37. package/src/components/Form/examples/FormHorizontal.tsx +10 -7
  38. package/src/components/Form/examples/FormHorizontalHelper.tsx +14 -21
  39. package/src/components/Form/examples/FormInvalid.tsx +11 -14
  40. package/src/components/Form/examples/FormInvalidWithFormAlert.tsx +20 -14
  41. package/src/components/Form/examples/FormLimitWidth.tsx +19 -3
  42. package/src/components/Form/examples/FormValidated.tsx +10 -12
  43. package/src/components/FormSelect/examples/FormSelectIconSpriteVariant.tsx +17 -11
  44. package/src/components/FormSelect/examples/FormSelectValidated.tsx +17 -11
  45. package/src/components/LoginPage/LoginForm.tsx +12 -15
  46. package/src/components/LoginPage/__tests__/__snapshots__/LoginForm.test.tsx.snap +0 -9
  47. package/src/components/TextArea/examples/TextAreaValidated.tsx +9 -12
  48. package/src/components/Wizard/examples/WizardEnabledOnFormValidation.tsx +18 -9
  49. package/src/components/Wizard/examples/WizardValidateOnButtonPress.tsx +12 -9
  50. package/src/demos/examples/HelperText/HelperTextDynamicVariantStaticText.tsx +2 -2
  51. package/src/demos/examples/HelperText/HelperTextStaticVariantDynamicText.tsx +1 -1
  52. package/src/demos/examples/HelperText/HelperTextStaticVariantStaticText.tsx +1 -1
  53. package/src/next/components/Wizard/examples/WizardEnabledOnFormValidation.tsx +9 -9
  54. package/src/next/components/Wizard/examples/WizardValidateOnButtonPress.tsx +12 -9
@@ -1,9 +1,8 @@
1
1
  import React from 'react';
2
- import { Form, FormGroup, TextArea } from '@patternfly/react-core';
2
+ import { Form, FormGroup, FormHelperText, HelperText, HelperTextItem, TextArea } from '@patternfly/react-core';
3
3
 
4
4
  export const TextAreaValidated: React.FunctionComponent = () => {
5
5
  const [value, setValue] = React.useState('');
6
- const [invalidText, setInvalidText] = React.useState('You must have something to say');
7
6
  const [validated, setValidated] = React.useState<'default' | 'error' | 'warning' | 'success' | undefined>('default');
8
7
  const [helperText, setHelperText] = React.useState('Share your thoughts.');
9
8
  const simulateNetworkCall = (callback: Function) => {
@@ -21,7 +20,7 @@ export const TextAreaValidated: React.FunctionComponent = () => {
21
20
  setHelperText('Thanks for your comments!');
22
21
  } else {
23
22
  setValidated('error');
24
- setInvalidText("You're being too brief, please enter at least 10 characters.");
23
+ setHelperText("You're being too brief, please enter at least 10 characters.");
25
24
  }
26
25
  } else {
27
26
  setValidated('warning');
@@ -31,21 +30,19 @@ export const TextAreaValidated: React.FunctionComponent = () => {
31
30
  };
32
31
  return (
33
32
  <Form>
34
- <FormGroup
35
- label="Comments:"
36
- type="string"
37
- helperText={helperText}
38
- helperTextInvalid={invalidText}
39
- fieldId="selection"
40
- validated={validated}
41
- >
33
+ <FormGroup label="Comments:" type="string" fieldId="selection">
42
34
  <TextArea
43
35
  value={value}
44
- onChange={value => handleTextAreaChange(value)}
36
+ onChange={(value) => handleTextAreaChange(value)}
45
37
  isRequired
46
38
  validated={validated}
47
39
  aria-label="invalid text area example"
48
40
  />
41
+ <FormHelperText>
42
+ <HelperText>
43
+ <HelperTextItem variant={validated}>{helperText}</HelperTextItem>
44
+ </HelperText>
45
+ </FormHelperText>
49
46
  </FormGroup>
50
47
  </Form>
51
48
  );
@@ -1,5 +1,14 @@
1
1
  import React from 'react';
2
- import { Form, FormGroup, TextInput, Wizard, WizardStep } from '@patternfly/react-core';
2
+ import {
3
+ Form,
4
+ FormGroup,
5
+ FormHelperText,
6
+ HelperText,
7
+ HelperTextItem,
8
+ TextInput,
9
+ Wizard,
10
+ WizardStep
11
+ } from '@patternfly/react-core';
3
12
  interface PrevStepInfo {
4
13
  prevId?: string | number;
5
14
  prevName: React.ReactNode;
@@ -26,14 +35,7 @@ const SampleForm: React.FunctionComponent<sampleFormProps> = (props: sampleFormP
26
35
 
27
36
  return (
28
37
  <Form>
29
- <FormGroup
30
- label="Age:"
31
- type="number"
32
- helperText="Write your age in numbers."
33
- helperTextInvalid="Age has to be a number"
34
- fieldId="age"
35
- validated={validated}
36
- >
38
+ <FormGroup label="Age:" type="number" fieldId="age">
37
39
  <TextInput
38
40
  validated={validated}
39
41
  value={value}
@@ -41,6 +43,13 @@ const SampleForm: React.FunctionComponent<sampleFormProps> = (props: sampleFormP
41
43
  aria-describedby="age-helper"
42
44
  onChange={handleTextInputChange}
43
45
  />
46
+ <FormHelperText>
47
+ <HelperText>
48
+ <HelperTextItem variant={validated}>
49
+ {validated === 'error' ? 'Age has to be a number' : 'Write your age in numbers.'}
50
+ </HelperTextItem>
51
+ </HelperText>
52
+ </FormHelperText>
44
53
  </FormGroup>
45
54
  </Form>
46
55
  );
@@ -14,7 +14,10 @@ import {
14
14
  WizardFooter,
15
15
  WizardContextConsumer,
16
16
  Alert,
17
- EmptyStateIcon
17
+ EmptyStateIcon,
18
+ HelperText,
19
+ HelperTextItem,
20
+ FormHelperText
18
21
  } from '@patternfly/react-core';
19
22
  // eslint-disable-next-line patternfly-react/import-tokens-icons
20
23
  import { CogsIcon } from '@patternfly/react-icons';
@@ -94,14 +97,7 @@ const SampleForm: React.FunctionComponent<sampleFormProps> = (props: sampleFormP
94
97
 
95
98
  return (
96
99
  <Form>
97
- <FormGroup
98
- label="Age:"
99
- type="number"
100
- helperText="Write your age in numbers."
101
- helperTextInvalid="Age has to be a number"
102
- fieldId="age"
103
- validated={validated}
104
- >
100
+ <FormGroup label="Age:" type="number" fieldId="age">
105
101
  <TextInput
106
102
  validated={validated}
107
103
  value={value}
@@ -109,6 +105,13 @@ const SampleForm: React.FunctionComponent<sampleFormProps> = (props: sampleFormP
109
105
  aria-describedby="age-helper"
110
106
  onChange={handleTextInputChange}
111
107
  />
108
+ <FormHelperText>
109
+ <HelperText>
110
+ <HelperTextItem variant={validated}>
111
+ {validated === 'error' ? 'Age has to be a number' : 'Write your age in numbers.'}
112
+ </HelperTextItem>
113
+ </HelperText>
114
+ </FormHelperText>
112
115
  </FormGroup>
113
116
  </Form>
114
117
  );
@@ -40,7 +40,7 @@ export const HelperTextDynamicVariantDynamicText: React.FunctionComponent = () =
40
40
  setValue(inputValue);
41
41
  };
42
42
 
43
- const filterValidations = () => Object.keys(inputValidation).filter(item => inputValidation[item] !== 'success');
43
+ const filterValidations = () => Object.keys(inputValidation).filter((item) => inputValidation[item] !== 'success');
44
44
 
45
45
  return (
46
46
  <Form>
@@ -55,7 +55,7 @@ export const HelperTextDynamicVariantDynamicText: React.FunctionComponent = () =
55
55
  aria-invalid={ruleCharacterTypes === 'error' || ruleLength === 'error'}
56
56
  value={value}
57
57
  />
58
- <FormHelperText isHidden={false} component="div">
58
+ <FormHelperText>
59
59
  <HelperText component="ul">
60
60
  <HelperTextItem component="li" id="ruleLength" isDynamic variant={ruleLength as any}>
61
61
  Must be at least 5 characters in length
@@ -32,7 +32,7 @@ export const HelperTextStaticVariantDynamicText: React.FunctionComponent = () =>
32
32
  aria-invalid={inputValidation === 'error'}
33
33
  value={value}
34
34
  />
35
- <FormHelperText isHidden={false} component="div">
35
+ <FormHelperText>
36
36
  <HelperText id="helper-text2" aria-live="polite">
37
37
  {inputValidation !== 'success' && (
38
38
  <HelperTextItem variant={inputValidation as any} hasIcon={inputValidation === 'error'}>
@@ -19,7 +19,7 @@ export const HelperTextStaticVariantStaticText: React.FunctionComponent = () =>
19
19
  aria-describedby="helper-text1"
20
20
  value={value}
21
21
  />
22
- <FormHelperText isHidden={false} component="div">
22
+ <FormHelperText>
23
23
  <HelperText id="helper-text1">
24
24
  <HelperTextItem variant={'default'}>Enter your middle name or your middle initial</HelperTextItem>
25
25
  </HelperText>
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
 
3
- import { Form, FormGroup, TextInput } from '@patternfly/react-core';
3
+ import { Form, FormGroup, FormHelperText, HelperText, HelperTextItem, TextInput } from '@patternfly/react-core';
4
4
  import { Wizard, WizardStep } from '@patternfly/react-core/next';
5
5
 
6
6
  interface SampleFormProps {
@@ -22,14 +22,7 @@ const SampleForm: React.FunctionComponent<SampleFormProps> = ({ value, isValid,
22
22
 
23
23
  return (
24
24
  <Form>
25
- <FormGroup
26
- label="Age:"
27
- type="number"
28
- helperText="Write your age in numbers."
29
- helperTextInvalid="Age has to be a number"
30
- fieldId="age"
31
- validated={validated}
32
- >
25
+ <FormGroup label="Age:" type="number" fieldId="age">
33
26
  <TextInput
34
27
  validated={validated}
35
28
  value={value}
@@ -37,6 +30,13 @@ const SampleForm: React.FunctionComponent<SampleFormProps> = ({ value, isValid,
37
30
  aria-describedby="age-helper"
38
31
  onChange={handleTextInputChange}
39
32
  />
33
+ <FormHelperText>
34
+ <HelperText>
35
+ <HelperTextItem variant={validated}>
36
+ {validated === 'error' ? 'Age has to be a number' : 'Write your age in numbers.'}
37
+ </HelperTextItem>
38
+ </HelperText>
39
+ </FormHelperText>
40
40
  </FormGroup>
41
41
  </Form>
42
42
  );
@@ -12,7 +12,10 @@ import {
12
12
  Progress,
13
13
  Form,
14
14
  FormGroup,
15
- TextInput
15
+ TextInput,
16
+ HelperText,
17
+ HelperTextItem,
18
+ FormHelperText
16
19
  } from '@patternfly/react-core';
17
20
  import { Wizard, WizardStep, WizardFooterWrapper, useWizardContext } from '@patternfly/react-core/next';
18
21
  import CogsIcon from '@patternfly/react-icons/dist/esm/icons/cogs-icon';
@@ -118,14 +121,7 @@ const SampleForm: React.FunctionComponent<SampleFormProps> = ({ value, isValid,
118
121
 
119
122
  return (
120
123
  <Form>
121
- <FormGroup
122
- label="Age:"
123
- type="number"
124
- helperText="Write your age in numbers."
125
- helperTextInvalid="Age has to be a number"
126
- fieldId="age"
127
- validated={validated}
128
- >
124
+ <FormGroup label="Age:" type="number" fieldId="age">
129
125
  <TextInput
130
126
  validated={validated}
131
127
  value={value}
@@ -133,6 +129,13 @@ const SampleForm: React.FunctionComponent<SampleFormProps> = ({ value, isValid,
133
129
  aria-describedby="age-helper"
134
130
  onChange={handleTextInputChange}
135
131
  />
132
+ <FormHelperText>
133
+ <HelperText>
134
+ <HelperTextItem variant={validated}>
135
+ {validated === 'error' ? 'Age has to be a number' : 'Write your age in numbers.'}
136
+ </HelperTextItem>
137
+ </HelperText>
138
+ </FormHelperText>
136
139
  </FormGroup>
137
140
  </Form>
138
141
  );