@patternfly/react-core 4.221.17 → 4.222.0
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 +11 -0
- package/dist/esm/components/Form/FormGroup.d.ts +4 -0
- package/dist/esm/components/Form/FormGroup.d.ts.map +1 -1
- package/dist/esm/components/Form/FormGroup.js +6 -4
- package/dist/esm/components/Form/FormGroup.js.map +1 -1
- package/dist/esm/components/Form/FormSection.d.ts.map +1 -1
- package/dist/esm/components/Form/FormSection.js +4 -3
- package/dist/esm/components/Form/FormSection.js.map +1 -1
- package/dist/esm/components/Form/InternalFormFieldGroup.d.ts.map +1 -1
- package/dist/esm/components/Form/InternalFormFieldGroup.js +1 -1
- package/dist/esm/components/Form/InternalFormFieldGroup.js.map +1 -1
- package/dist/js/components/Form/FormGroup.d.ts +4 -0
- package/dist/js/components/Form/FormGroup.d.ts.map +1 -1
- package/dist/js/components/Form/FormGroup.js +6 -4
- package/dist/js/components/Form/FormGroup.js.map +1 -1
- package/dist/js/components/Form/FormSection.d.ts.map +1 -1
- package/dist/js/components/Form/FormSection.js +4 -3
- package/dist/js/components/Form/FormSection.js.map +1 -1
- package/dist/js/components/Form/InternalFormFieldGroup.d.ts.map +1 -1
- package/dist/js/components/Form/InternalFormFieldGroup.js +1 -1
- package/dist/js/components/Form/InternalFormFieldGroup.js.map +1 -1
- package/dist/umd/react-core.css +34 -34
- package/dist/umd/react-core.js +10 -8
- package/dist/umd/react-core.min.js +1 -1
- package/package.json +5 -5
- package/src/components/Form/FormGroup.tsx +17 -3
- package/src/components/Form/FormSection.tsx +18 -4
- package/src/components/Form/InternalFormFieldGroup.tsx +2 -0
- package/src/components/Form/__tests__/FormFieldGroup.test.tsx +23 -1
- package/src/components/Form/__tests__/FormGroup.test.tsx +89 -0
- package/src/components/Form/__tests__/FormSection.test.tsx +13 -1
- package/src/components/Form/__tests__/__snapshots__/FormFieldGroup.test.tsx.snap +4 -0
- package/src/components/Form/__tests__/__snapshots__/FormSection.test.tsx.snap +4 -0
- package/src/components/Form/examples/Form.md +45 -12
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@patternfly/react-core",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.222.0",
|
|
4
4
|
"description": "This library provides a set of common React components for use with the PatternFly reference implementation.",
|
|
5
5
|
"main": "dist/js/index.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -34,9 +34,9 @@
|
|
|
34
34
|
"generate": "node scripts/copyStyles.js"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@patternfly/react-icons": "^4.
|
|
38
|
-
"@patternfly/react-styles": "^4.
|
|
39
|
-
"@patternfly/react-tokens": "^4.
|
|
37
|
+
"@patternfly/react-icons": "^4.73.0",
|
|
38
|
+
"@patternfly/react-styles": "^4.72.0",
|
|
39
|
+
"@patternfly/react-tokens": "^4.74.0",
|
|
40
40
|
"focus-trap": "6.9.2",
|
|
41
41
|
"react-dropzone": "9.0.0",
|
|
42
42
|
"tippy.js": "5.1.2",
|
|
@@ -60,5 +60,5 @@
|
|
|
60
60
|
"react": "^16.8.0 || ^17.0.0",
|
|
61
61
|
"react-dom": "^16.8.0 || ^17.0.0"
|
|
62
62
|
},
|
|
63
|
-
"gitHead": "
|
|
63
|
+
"gitHead": "9c5a0c99d957bafa3548e1fd4db410a74f7f7ad8"
|
|
64
64
|
}
|
|
@@ -41,6 +41,10 @@ export interface FormGroupProps extends Omit<React.HTMLProps<HTMLDivElement>, 'l
|
|
|
41
41
|
helperTextInvalidIcon?: React.ReactNode;
|
|
42
42
|
/** ID of the included field. It has to be the same for proper working. */
|
|
43
43
|
fieldId: string;
|
|
44
|
+
/** Sets the role of the form group. Pass in "radiogroup" when the form group contains multiple
|
|
45
|
+
* radio inputs, or pass in "group" when the form group contains multiple of any other input type.
|
|
46
|
+
*/
|
|
47
|
+
role?: string;
|
|
44
48
|
}
|
|
45
49
|
|
|
46
50
|
export const FormGroup: React.FunctionComponent<FormGroupProps> = ({
|
|
@@ -60,6 +64,7 @@ export const FormGroup: React.FunctionComponent<FormGroupProps> = ({
|
|
|
60
64
|
helperTextIcon,
|
|
61
65
|
helperTextInvalidIcon,
|
|
62
66
|
fieldId,
|
|
67
|
+
role,
|
|
63
68
|
...props
|
|
64
69
|
}: FormGroupProps) => {
|
|
65
70
|
const validHelperText =
|
|
@@ -96,9 +101,12 @@ export const FormGroup: React.FunctionComponent<FormGroupProps> = ({
|
|
|
96
101
|
const helperTextToDisplay =
|
|
97
102
|
validated === ValidatedOptions.error && helperTextInvalid ? inValidHelperText : showValidHelperTxt(validated);
|
|
98
103
|
|
|
104
|
+
const isGroupOrRadioGroup = role === 'group' || role === 'radiogroup';
|
|
105
|
+
const LabelComponent = isGroupOrRadioGroup ? 'span' : 'label';
|
|
106
|
+
|
|
99
107
|
const labelContent = (
|
|
100
108
|
<React.Fragment>
|
|
101
|
-
<
|
|
109
|
+
<LabelComponent className={css(styles.formLabel)} {...(!isGroupOrRadioGroup && { htmlFor: fieldId })}>
|
|
102
110
|
<span className={css(styles.formLabelText)}>{label}</span>
|
|
103
111
|
{isRequired && (
|
|
104
112
|
<span className={css(styles.formLabelRequired)} aria-hidden="true">
|
|
@@ -106,13 +114,18 @@ export const FormGroup: React.FunctionComponent<FormGroupProps> = ({
|
|
|
106
114
|
{ASTERISK}
|
|
107
115
|
</span>
|
|
108
116
|
)}
|
|
109
|
-
</
|
|
117
|
+
</LabelComponent>{' '}
|
|
110
118
|
{React.isValidElement(labelIcon) && labelIcon}
|
|
111
119
|
</React.Fragment>
|
|
112
120
|
);
|
|
113
121
|
|
|
114
122
|
return (
|
|
115
|
-
<div
|
|
123
|
+
<div
|
|
124
|
+
className={css(styles.formGroup, className)}
|
|
125
|
+
{...(role && { role })}
|
|
126
|
+
{...(isGroupOrRadioGroup && { 'aria-labelledby': `${fieldId}-legend` })}
|
|
127
|
+
{...props}
|
|
128
|
+
>
|
|
116
129
|
{label && (
|
|
117
130
|
<div
|
|
118
131
|
className={css(
|
|
@@ -120,6 +133,7 @@ export const FormGroup: React.FunctionComponent<FormGroupProps> = ({
|
|
|
120
133
|
labelInfo && styles.modifiers.info,
|
|
121
134
|
hasNoPaddingTop && styles.modifiers.noPaddingTop
|
|
122
135
|
)}
|
|
136
|
+
{...(isGroupOrRadioGroup && { id: `${fieldId}-legend` })}
|
|
123
137
|
>
|
|
124
138
|
{labelInfo && (
|
|
125
139
|
<React.Fragment>
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import styles from '@patternfly/react-styles/css/components/Form/form';
|
|
3
3
|
import { css } from '@patternfly/react-styles';
|
|
4
|
+
import { GenerateId } from '../../helpers/GenerateId/GenerateId';
|
|
4
5
|
|
|
5
6
|
export interface FormSectionProps extends Omit<React.HTMLProps<HTMLDivElement>, 'title'> {
|
|
6
7
|
/** Content rendered inside the section */
|
|
@@ -20,9 +21,22 @@ export const FormSection: React.FunctionComponent<FormSectionProps> = ({
|
|
|
20
21
|
titleElement: TitleElement = 'div',
|
|
21
22
|
...props
|
|
22
23
|
}: FormSectionProps) => (
|
|
23
|
-
<
|
|
24
|
-
{
|
|
25
|
-
|
|
26
|
-
|
|
24
|
+
<GenerateId prefix="pf-form-section-title">
|
|
25
|
+
{sectionId => (
|
|
26
|
+
<section
|
|
27
|
+
className={css(styles.formSection, className)}
|
|
28
|
+
role="group"
|
|
29
|
+
{...(title && { 'aria-labelledby': sectionId })}
|
|
30
|
+
{...props}
|
|
31
|
+
>
|
|
32
|
+
{title && (
|
|
33
|
+
<TitleElement id={sectionId} className={css(styles.formSectionTitle, className)}>
|
|
34
|
+
{title}
|
|
35
|
+
</TitleElement>
|
|
36
|
+
)}
|
|
37
|
+
{children}
|
|
38
|
+
</section>
|
|
39
|
+
)}
|
|
40
|
+
</GenerateId>
|
|
27
41
|
);
|
|
28
42
|
FormSection.displayName = 'FormSection';
|
|
@@ -42,6 +42,8 @@ export const InternalFormFieldGroup: React.FunctionComponent<InternalFormFieldGr
|
|
|
42
42
|
return (
|
|
43
43
|
<div
|
|
44
44
|
className={css(styles.formFieldGroup, isExpanded && isExpandable && styles.modifiers.expanded, className)}
|
|
45
|
+
role="group"
|
|
46
|
+
{...(headerTitleText && { 'aria-labelledby': `${header.props.titleText.id}` })}
|
|
45
47
|
{...props}
|
|
46
48
|
>
|
|
47
49
|
{isExpandable && (
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
|
|
3
|
-
import { render } from '@testing-library/react';
|
|
3
|
+
import { render, screen } from '@testing-library/react';
|
|
4
4
|
|
|
5
5
|
import { FormFieldGroup } from '../FormFieldGroup';
|
|
6
6
|
import { FormFieldGroupExpandable } from '../FormFieldGroupExpandable';
|
|
@@ -53,3 +53,25 @@ test('Verify console error logged when there is no aria-label or title', () => {
|
|
|
53
53
|
const { asFragment } = render(FieldGroup);
|
|
54
54
|
expect(consoleErrorMock).toHaveBeenCalled();
|
|
55
55
|
});
|
|
56
|
+
|
|
57
|
+
test('Verify field group has accessible name when header is passed in', () => {
|
|
58
|
+
render(
|
|
59
|
+
<FormFieldGroup
|
|
60
|
+
header={
|
|
61
|
+
<FormFieldGroupHeader
|
|
62
|
+
titleText={{ text: 'Field group 4 (non-expandable)', id: 'title-text-id1' }}
|
|
63
|
+
titleDescription="Field group 4 description text."
|
|
64
|
+
actions={<Button />}
|
|
65
|
+
/>
|
|
66
|
+
}
|
|
67
|
+
/>
|
|
68
|
+
);
|
|
69
|
+
|
|
70
|
+
expect(screen.getByRole('group')).toHaveAccessibleName('Field group 4 (non-expandable)');
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
test('Verify field group does not have accessible name when header is not passed in', () => {
|
|
74
|
+
render(<FormFieldGroup data-testid="field-group-test-id" />);
|
|
75
|
+
|
|
76
|
+
expect(screen.getByRole('group')).not.toHaveAccessibleName();
|
|
77
|
+
});
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
|
|
3
3
|
import { render, screen } from '@testing-library/react';
|
|
4
|
+
import userEvent from '@testing-library/user-event';
|
|
4
5
|
|
|
5
6
|
import { ValidatedOptions } from '../../../helpers/constants';
|
|
6
7
|
import { FormGroup } from '../FormGroup';
|
|
@@ -203,4 +204,92 @@ describe('FormGroup', () => {
|
|
|
203
204
|
);
|
|
204
205
|
expect(asFragment()).toMatchSnapshot();
|
|
205
206
|
});
|
|
207
|
+
|
|
208
|
+
test('should render without group or radiogroup role when role is not passed in', () => {
|
|
209
|
+
render(
|
|
210
|
+
<FormGroup label="label" fieldId="no-group-role">
|
|
211
|
+
<input />
|
|
212
|
+
</FormGroup>
|
|
213
|
+
);
|
|
214
|
+
|
|
215
|
+
expect(screen.queryByRole('group')).not.toBeInTheDocument();
|
|
216
|
+
expect(screen.queryByRole('radiogroup')).not.toBeInTheDocument();
|
|
217
|
+
});
|
|
218
|
+
|
|
219
|
+
test('input should receive focus when clicking text label', () => {
|
|
220
|
+
render(
|
|
221
|
+
<FormGroup label="label" fieldId="native-label-element">
|
|
222
|
+
<input id="native-label-element" />
|
|
223
|
+
</FormGroup>
|
|
224
|
+
);
|
|
225
|
+
|
|
226
|
+
const labelElement = screen.getByText('label');
|
|
227
|
+
const input = screen.getByRole('textbox');
|
|
228
|
+
|
|
229
|
+
userEvent.click(labelElement);
|
|
230
|
+
expect(input).toHaveFocus();
|
|
231
|
+
});
|
|
232
|
+
|
|
233
|
+
describe('With multiple inputs per group', () => {
|
|
234
|
+
test('inputs should not receive focus when clicking text label', () => {
|
|
235
|
+
render(
|
|
236
|
+
<FormGroup label="label" fieldId="span-label-element" role="group">
|
|
237
|
+
<input id="span-label-element" />
|
|
238
|
+
<input />
|
|
239
|
+
</FormGroup>
|
|
240
|
+
);
|
|
241
|
+
|
|
242
|
+
const labelElement = screen.getByText('label');
|
|
243
|
+
const inputs = screen.getAllByRole('textbox');
|
|
244
|
+
|
|
245
|
+
userEvent.click(labelElement);
|
|
246
|
+
inputs.forEach(input => {
|
|
247
|
+
expect(input).not.toHaveFocus();
|
|
248
|
+
});
|
|
249
|
+
});
|
|
250
|
+
|
|
251
|
+
test('should render with group role', () => {
|
|
252
|
+
render(
|
|
253
|
+
<FormGroup label="label" fieldId="group-role" role="group">
|
|
254
|
+
<input />
|
|
255
|
+
<input />
|
|
256
|
+
</FormGroup>
|
|
257
|
+
);
|
|
258
|
+
|
|
259
|
+
expect(screen.getByRole('group')).toBeInTheDocument();
|
|
260
|
+
});
|
|
261
|
+
|
|
262
|
+
test('should render with radiogroup role', () => {
|
|
263
|
+
render(
|
|
264
|
+
<FormGroup label="label" fieldId="radiogroup-role" role="radiogroup">
|
|
265
|
+
<input />
|
|
266
|
+
<input />
|
|
267
|
+
</FormGroup>
|
|
268
|
+
);
|
|
269
|
+
|
|
270
|
+
expect(screen.getByRole('radiogroup')).toBeInTheDocument();
|
|
271
|
+
});
|
|
272
|
+
|
|
273
|
+
test('should have accessible name when group role is passed in', () => {
|
|
274
|
+
render(
|
|
275
|
+
<FormGroup label="label" fieldId="accessible-name" role="group">
|
|
276
|
+
<input />
|
|
277
|
+
<input />
|
|
278
|
+
</FormGroup>
|
|
279
|
+
);
|
|
280
|
+
|
|
281
|
+
expect(screen.getByRole('group')).toHaveAccessibleName('label');
|
|
282
|
+
});
|
|
283
|
+
|
|
284
|
+
test('should have accessible name when radiogroup role is passed in', () => {
|
|
285
|
+
render(
|
|
286
|
+
<FormGroup label="label" fieldId="accessible-name" role="radiogroup">
|
|
287
|
+
<input />
|
|
288
|
+
<input />
|
|
289
|
+
</FormGroup>
|
|
290
|
+
);
|
|
291
|
+
|
|
292
|
+
expect(screen.getByRole('radiogroup')).toHaveAccessibleName('label');
|
|
293
|
+
});
|
|
294
|
+
});
|
|
206
295
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { FormSection } from '../FormSection';
|
|
3
|
-
import { render } from '@testing-library/react';
|
|
3
|
+
import { render, screen } from '@testing-library/react';
|
|
4
4
|
|
|
5
5
|
test('Check form section example against snapshot', () => {
|
|
6
6
|
const Section = <FormSection />;
|
|
@@ -13,3 +13,15 @@ test('Check form section example with title', () => {
|
|
|
13
13
|
const { asFragment } = render(Section);
|
|
14
14
|
expect(asFragment()).toMatchSnapshot();
|
|
15
15
|
});
|
|
16
|
+
|
|
17
|
+
test('Verify form section has accessible name when title is passed in', () => {
|
|
18
|
+
render(<FormSection title="Form title" />);
|
|
19
|
+
|
|
20
|
+
expect(screen.getByRole('group')).toHaveAccessibleName('Form title');
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
test('Verify form section does not have accessible name when title is not passed in', () => {
|
|
24
|
+
render(<FormSection />);
|
|
25
|
+
|
|
26
|
+
expect(screen.getByRole('group')).not.toHaveAccessibleName();
|
|
27
|
+
});
|
|
@@ -3,7 +3,9 @@
|
|
|
3
3
|
exports[`Check expandable form field group example against snapshot 1`] = `
|
|
4
4
|
<DocumentFragment>
|
|
5
5
|
<div
|
|
6
|
+
aria-labelledby="title-text-id2"
|
|
6
7
|
class="pf-c-form__field-group pf-m-expanded"
|
|
8
|
+
role="group"
|
|
7
9
|
>
|
|
8
10
|
<div
|
|
9
11
|
class="pf-c-form__field-group-toggle"
|
|
@@ -88,7 +90,9 @@ exports[`Check expandable form field group example against snapshot 1`] = `
|
|
|
88
90
|
exports[`Check form field group example against snapshot 1`] = `
|
|
89
91
|
<DocumentFragment>
|
|
90
92
|
<div
|
|
93
|
+
aria-labelledby="title-text-id1"
|
|
91
94
|
class="pf-c-form__field-group"
|
|
95
|
+
role="group"
|
|
92
96
|
>
|
|
93
97
|
<div
|
|
94
98
|
class="pf-c-form__field-group-header"
|
|
@@ -4,6 +4,7 @@ exports[`Check form section example against snapshot 1`] = `
|
|
|
4
4
|
<DocumentFragment>
|
|
5
5
|
<section
|
|
6
6
|
class="pf-c-form__section"
|
|
7
|
+
role="group"
|
|
7
8
|
/>
|
|
8
9
|
</DocumentFragment>
|
|
9
10
|
`;
|
|
@@ -11,10 +12,13 @@ exports[`Check form section example against snapshot 1`] = `
|
|
|
11
12
|
exports[`Check form section example with title 1`] = `
|
|
12
13
|
<DocumentFragment>
|
|
13
14
|
<section
|
|
15
|
+
aria-labelledby="pf-form-section-title1"
|
|
14
16
|
class="pf-c-form__section"
|
|
17
|
+
role="group"
|
|
15
18
|
>
|
|
16
19
|
<h4
|
|
17
20
|
class="pf-c-form__section-title"
|
|
21
|
+
id="pf-form-section-title1"
|
|
18
22
|
>
|
|
19
23
|
Title
|
|
20
24
|
</h4>
|
|
@@ -44,7 +44,7 @@ import TrashIcon from '@patternfly/react-icons/dist/esm/icons/trash-icon';
|
|
|
44
44
|
|
|
45
45
|
```js
|
|
46
46
|
import React from 'react';
|
|
47
|
-
import { Form, FormGroup, TextInput, Checkbox, Popover, ActionGroup, Button } from '@patternfly/react-core';
|
|
47
|
+
import { Form, FormGroup, TextInput, Checkbox, Popover, ActionGroup, Button, Radio } from '@patternfly/react-core';
|
|
48
48
|
import HelpIcon from '@patternfly/react-icons/dist/esm/icons/help-icon';
|
|
49
49
|
|
|
50
50
|
class SimpleForm extends React.Component {
|
|
@@ -147,10 +147,15 @@ class SimpleForm extends React.Component {
|
|
|
147
147
|
onChange={this.handleTextInputChange3}
|
|
148
148
|
/>
|
|
149
149
|
</FormGroup>
|
|
150
|
-
<FormGroup isInline fieldId="
|
|
150
|
+
<FormGroup role="group" isInline fieldId="basic-form-checkbox-group" label="How can we contact you?">
|
|
151
151
|
<Checkbox label="Email" aria-label="Email" id="inlinecheck01" />
|
|
152
152
|
<Checkbox label="Phone" aria-label="Phone" id="inlinecheck02" />
|
|
153
|
-
<Checkbox label="
|
|
153
|
+
<Checkbox label="Mail" aria-label="Mail" id="inlinecheck03" />
|
|
154
|
+
</FormGroup>
|
|
155
|
+
<FormGroup role="radiogroup" isInline fieldId="simple-form-radio-group" label="Time zone">
|
|
156
|
+
<Radio name="basic-inline-radio" label="Eastern" id="basic-inline-radio-01" />
|
|
157
|
+
<Radio name="basic-inline-radio" label="Central" id="basic-inline-radio-02" />
|
|
158
|
+
<Radio name="basic-inline-radio" label="Pacific" id="basic-inline-radio-03" />
|
|
154
159
|
</FormGroup>
|
|
155
160
|
<FormGroup label="Additional note" fieldId="simple-form-note-01">
|
|
156
161
|
<TextInput isDisabled type="text" id="simple-form-note-01" name="simple-form-number" value="disabled" />
|
|
@@ -186,7 +191,8 @@ import {
|
|
|
186
191
|
FormSelectOption,
|
|
187
192
|
Checkbox,
|
|
188
193
|
ActionGroup,
|
|
189
|
-
Button
|
|
194
|
+
Button,
|
|
195
|
+
Radio
|
|
190
196
|
} from '@patternfly/react-core';
|
|
191
197
|
|
|
192
198
|
class HorizontalForm extends React.Component {
|
|
@@ -226,7 +232,12 @@ class HorizontalForm extends React.Component {
|
|
|
226
232
|
|
|
227
233
|
return (
|
|
228
234
|
<Form isHorizontal>
|
|
229
|
-
<FormGroup
|
|
235
|
+
<FormGroup
|
|
236
|
+
label="Full name"
|
|
237
|
+
isRequired
|
|
238
|
+
fieldId="horizontal-form-name"
|
|
239
|
+
helperText="Include your middle name if you have one."
|
|
240
|
+
>
|
|
230
241
|
<TextInput
|
|
231
242
|
value={value1}
|
|
232
243
|
isRequired
|
|
@@ -268,10 +279,21 @@ class HorizontalForm extends React.Component {
|
|
|
268
279
|
id="horizontal-form-exp"
|
|
269
280
|
/>
|
|
270
281
|
</FormGroup>
|
|
271
|
-
<FormGroup
|
|
282
|
+
<FormGroup
|
|
283
|
+
label="How can we contact you?"
|
|
284
|
+
isStack
|
|
285
|
+
hasNoPaddingTop
|
|
286
|
+
role="group"
|
|
287
|
+
fieldId="horizontal-form-checkbox-group"
|
|
288
|
+
>
|
|
272
289
|
<Checkbox label="Email" id="alt-form-checkbox-1" name="alt-form-checkbox-1" />
|
|
273
290
|
<Checkbox label="Phone" id="alt-form-checkbox-2" name="alt-form-checkbox-2" />
|
|
274
|
-
<Checkbox label="
|
|
291
|
+
<Checkbox label="Mail" id="alt-form-checkbox-3" name="alt-form-checkbox-3" />
|
|
292
|
+
</FormGroup>
|
|
293
|
+
<FormGroup role="radiogroup" isStack hasNoPaddingTop fieldId="horizontal-form-radio-group" label="Time zone">
|
|
294
|
+
<Radio name="horizontal-inline-radio" label="Eastern" id="horizontal-inline-radio-01" />
|
|
295
|
+
<Radio name="horizontal-inline-radio" label="Central" id="horizontal-inline-radio-02" />
|
|
296
|
+
<Radio name="horizontal-inline-radio" label="Pacific" id="horizontal-inline-radio-03" />
|
|
275
297
|
</FormGroup>
|
|
276
298
|
<ActionGroup>
|
|
277
299
|
<Button variant="primary">Submit</Button>
|
|
@@ -287,7 +309,7 @@ class HorizontalForm extends React.Component {
|
|
|
287
309
|
|
|
288
310
|
```js
|
|
289
311
|
import React from 'react';
|
|
290
|
-
import { Form, FormGroup, TextInput, Checkbox, Popover, ActionGroup, Button } from '@patternfly/react-core';
|
|
312
|
+
import { Form, FormGroup, TextInput, Checkbox, Popover, ActionGroup, Button, Radio } from '@patternfly/react-core';
|
|
291
313
|
import HelpIcon from '@patternfly/react-icons/dist/esm/icons/help-icon';
|
|
292
314
|
|
|
293
315
|
class SimpleForm extends React.Component {
|
|
@@ -390,10 +412,15 @@ class SimpleForm extends React.Component {
|
|
|
390
412
|
onChange={this.handleTextInputChange3}
|
|
391
413
|
/>
|
|
392
414
|
</FormGroup>
|
|
393
|
-
<FormGroup isInline label="How can we contact you?"
|
|
415
|
+
<FormGroup fieldId="limit-width-form-checkbox-group" role="group" isInline label="How can we contact you?">
|
|
394
416
|
<Checkbox label="Email" aria-label="Email" id="inlinecheck04" />
|
|
395
417
|
<Checkbox label="Phone" aria-label="Phone" id="inlinecheck05" />
|
|
396
|
-
<Checkbox label="
|
|
418
|
+
<Checkbox label="Mail" aria-label="Mail" id="inlinecheck06" />
|
|
419
|
+
</FormGroup>
|
|
420
|
+
<FormGroup role="radiogroup" isInline fieldId="limit-width-form-radio-group" label="Time zone">
|
|
421
|
+
<Radio name="limit-width-radio" label="Eastern" id="limit-width-inline-radio-01" />
|
|
422
|
+
<Radio name="limit-width-radio" label="Central" id="limit-width-inline-radio-02" />
|
|
423
|
+
<Radio name="limit-width-radio" label="Pacific" id="limit-width-inline-radio-03" />
|
|
397
424
|
</FormGroup>
|
|
398
425
|
<FormGroup label="Additional note" fieldId="simple-form-note-02">
|
|
399
426
|
<TextInput isDisabled type="text" id="simple-form-note-02" name="simple-form-number" value="disabled" />
|
|
@@ -605,7 +632,7 @@ class HorizontalForm extends React.Component {
|
|
|
605
632
|
render() {
|
|
606
633
|
return (
|
|
607
634
|
<Form isHorizontal>
|
|
608
|
-
<FormGroup label="Label" hasNoPaddingTop fieldId="options" isStack>
|
|
635
|
+
<FormGroup role="group" label="Label" hasNoPaddingTop fieldId="options" isStack>
|
|
609
636
|
<Checkbox label="option 1" id="option-01" />
|
|
610
637
|
<Checkbox label="option 2" id="option-02" />
|
|
611
638
|
</FormGroup>
|
|
@@ -639,6 +666,7 @@ class HorizontalFormHelperTextOnTop extends React.Component {
|
|
|
639
666
|
hasNoPaddingTop
|
|
640
667
|
fieldId="options"
|
|
641
668
|
isStack
|
|
669
|
+
role="group"
|
|
642
670
|
>
|
|
643
671
|
<Checkbox label="Option 1" id="option-03" />
|
|
644
672
|
<Checkbox label="Option 2" id="option-04" />
|
|
@@ -823,7 +851,12 @@ class SimpleForm extends React.Component {
|
|
|
823
851
|
<Form>
|
|
824
852
|
<Grid hasGutter md={6}>
|
|
825
853
|
<GridItem span={12}>
|
|
826
|
-
<FormGroup
|
|
854
|
+
<FormGroup
|
|
855
|
+
label="Full name"
|
|
856
|
+
isRequired
|
|
857
|
+
fieldId="grid-form-name-01"
|
|
858
|
+
helperText="Include your middle name if you have one."
|
|
859
|
+
>
|
|
827
860
|
<TextInput
|
|
828
861
|
isRequired
|
|
829
862
|
type="text"
|