@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
|
@@ -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
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
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
|
>
|
|
@@ -46,7 +46,9 @@ export interface MenuItemProps extends Omit<React.HTMLProps<HTMLLIElement>, 'onC
|
|
|
46
46
|
actions?: React.ReactNode;
|
|
47
47
|
/** Description of the menu item */
|
|
48
48
|
description?: React.ReactNode;
|
|
49
|
-
/** Render external link icon
|
|
49
|
+
/** Render an external link icon on focus or hover, and set the link's
|
|
50
|
+
* "target" attribute to a value of "_blank".
|
|
51
|
+
*/
|
|
50
52
|
isExternalLink?: boolean;
|
|
51
53
|
/** Flag indicating if the option is selected */
|
|
52
54
|
isSelected?: boolean;
|
|
@@ -191,7 +193,7 @@ const MenuItemBase: React.FunctionComponent<MenuItemProps> = ({
|
|
|
191
193
|
if (flyoutVisible) {
|
|
192
194
|
const flyoutMenu = (flyoutTarget as HTMLElement).nextElementSibling;
|
|
193
195
|
const flyoutItems = Array.from(flyoutMenu.getElementsByTagName('UL')[0].children).filter(
|
|
194
|
-
el => !(el.classList.contains('pf-m-disabled') || el.classList.contains('pf-c-divider'))
|
|
196
|
+
(el) => !(el.classList.contains('pf-m-disabled') || el.classList.contains('pf-c-divider'))
|
|
195
197
|
);
|
|
196
198
|
(flyoutItems[0].firstChild as HTMLElement).focus();
|
|
197
199
|
} else {
|
|
@@ -232,7 +234,7 @@ const MenuItemBase: React.FunctionComponent<MenuItemProps> = ({
|
|
|
232
234
|
let drill: (event: React.KeyboardEvent | React.MouseEvent) => void;
|
|
233
235
|
if (direction) {
|
|
234
236
|
if (direction === 'down') {
|
|
235
|
-
drill = event =>
|
|
237
|
+
drill = (event) =>
|
|
236
238
|
onDrillIn &&
|
|
237
239
|
onDrillIn(
|
|
238
240
|
event,
|
|
@@ -243,7 +245,7 @@ const MenuItemBase: React.FunctionComponent<MenuItemProps> = ({
|
|
|
243
245
|
itemId
|
|
244
246
|
);
|
|
245
247
|
} else {
|
|
246
|
-
drill = event => onDrillOut && onDrillOut(event, parentMenu, itemId);
|
|
248
|
+
drill = (event) => onDrillOut && onDrillOut(event, parentMenu, itemId);
|
|
247
249
|
}
|
|
248
250
|
}
|
|
249
251
|
let additionalProps = {} as any;
|
|
@@ -252,7 +254,8 @@ const MenuItemBase: React.FunctionComponent<MenuItemProps> = ({
|
|
|
252
254
|
href: to,
|
|
253
255
|
'aria-disabled': isDisabled ? true : null,
|
|
254
256
|
// prevent invalid 'disabled' attribute on <a> tags
|
|
255
|
-
disabled: null
|
|
257
|
+
disabled: null,
|
|
258
|
+
target: isExternalLink ? '_blank' : null
|
|
256
259
|
};
|
|
257
260
|
} else if (Component === 'button') {
|
|
258
261
|
additionalProps = {
|
|
@@ -317,7 +320,7 @@ const MenuItemBase: React.FunctionComponent<MenuItemProps> = ({
|
|
|
317
320
|
{...props}
|
|
318
321
|
>
|
|
319
322
|
<GenerateId>
|
|
320
|
-
{randomId => (
|
|
323
|
+
{(randomId) => (
|
|
321
324
|
<Component
|
|
322
325
|
id={id}
|
|
323
326
|
tabIndex={-1}
|
|
@@ -393,7 +396,7 @@ const MenuItemBase: React.FunctionComponent<MenuItemProps> = ({
|
|
|
393
396
|
icon="favorites"
|
|
394
397
|
isFavorited={isFavorited}
|
|
395
398
|
aria-label={isFavorited ? 'starred' : 'not starred'}
|
|
396
|
-
onClick={event => onActionClick(event, itemId)}
|
|
399
|
+
onClick={(event) => onActionClick(event, itemId)}
|
|
397
400
|
tabIndex={-1}
|
|
398
401
|
actionId="fav"
|
|
399
402
|
/>
|
|
@@ -67,7 +67,7 @@ To trigger an action when a specific item's action icon is selected, pass in the
|
|
|
67
67
|
|
|
68
68
|
### With links
|
|
69
69
|
|
|
70
|
-
Use the `to` property to add a link to a `<MenuItem>` that directs users to a new page when the item is selected. Use the `isExternalLink` property when linking to external resources. This will annotate a menu item link with an external link icon when they navigate to the link or hover over it.
|
|
70
|
+
Use the `to` property to add a link to a `<MenuItem>` that directs users to a new page when the item is selected. Use the `isExternalLink` property when linking to external resources. This will annotate a menu item link with an external link icon when they navigate to the link or hover over it, as well as add `target="_blank"` so that the link opens in a new tab or window.
|
|
71
71
|
|
|
72
72
|
```ts file="MenuWithLinks.tsx"
|
|
73
73
|
|
|
@@ -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
|
-
|
|
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
|
);
|
|
@@ -111,6 +111,7 @@ exports[`Wizard Expandable Nav Wizard should match snapshot 1`] = `
|
|
|
111
111
|
data-ouia-component-id="OUIA-Generated-WizardNavItem-7"
|
|
112
112
|
data-ouia-component-type="PF4/WizardNavItem"
|
|
113
113
|
data-ouia-safe="true"
|
|
114
|
+
type="button"
|
|
114
115
|
>
|
|
115
116
|
A
|
|
116
117
|
</button>
|
|
@@ -125,6 +126,7 @@ exports[`Wizard Expandable Nav Wizard should match snapshot 1`] = `
|
|
|
125
126
|
data-ouia-component-id="OUIA-Generated-WizardNavItem-8"
|
|
126
127
|
data-ouia-component-type="PF4/WizardNavItem"
|
|
127
128
|
data-ouia-safe="true"
|
|
129
|
+
type="button"
|
|
128
130
|
>
|
|
129
131
|
<span
|
|
130
132
|
class="pf-c-wizard__nav-link-text"
|
|
@@ -166,6 +168,7 @@ exports[`Wizard Expandable Nav Wizard should match snapshot 1`] = `
|
|
|
166
168
|
data-ouia-component-id="OUIA-Generated-WizardNavItem-9"
|
|
167
169
|
data-ouia-component-type="PF4/WizardNavItem"
|
|
168
170
|
data-ouia-safe="true"
|
|
171
|
+
type="button"
|
|
169
172
|
>
|
|
170
173
|
B-1
|
|
171
174
|
</button>
|
|
@@ -179,6 +182,7 @@ exports[`Wizard Expandable Nav Wizard should match snapshot 1`] = `
|
|
|
179
182
|
data-ouia-component-id="OUIA-Generated-WizardNavItem-10"
|
|
180
183
|
data-ouia-component-type="PF4/WizardNavItem"
|
|
181
184
|
data-ouia-safe="true"
|
|
185
|
+
type="button"
|
|
182
186
|
>
|
|
183
187
|
B-2
|
|
184
188
|
</button>
|
|
@@ -194,6 +198,7 @@ exports[`Wizard Expandable Nav Wizard should match snapshot 1`] = `
|
|
|
194
198
|
data-ouia-component-id="OUIA-Generated-WizardNavItem-11"
|
|
195
199
|
data-ouia-component-type="PF4/WizardNavItem"
|
|
196
200
|
data-ouia-safe="true"
|
|
201
|
+
type="button"
|
|
197
202
|
>
|
|
198
203
|
C
|
|
199
204
|
</button>
|
|
@@ -207,6 +212,7 @@ exports[`Wizard Expandable Nav Wizard should match snapshot 1`] = `
|
|
|
207
212
|
data-ouia-component-id="OUIA-Generated-WizardNavItem-12"
|
|
208
213
|
data-ouia-component-type="PF4/WizardNavItem"
|
|
209
214
|
data-ouia-safe="true"
|
|
215
|
+
type="button"
|
|
210
216
|
>
|
|
211
217
|
D
|
|
212
218
|
</button>
|
|
@@ -381,6 +387,7 @@ exports[`Wizard Wizard should match snapshot 1`] = `
|
|
|
381
387
|
data-ouia-component-type="PF4/WizardNavItem"
|
|
382
388
|
data-ouia-safe="true"
|
|
383
389
|
id="step-A"
|
|
390
|
+
type="button"
|
|
384
391
|
>
|
|
385
392
|
A
|
|
386
393
|
</button>
|
|
@@ -395,6 +402,7 @@ exports[`Wizard Wizard should match snapshot 1`] = `
|
|
|
395
402
|
data-ouia-component-type="PF4/WizardNavItem"
|
|
396
403
|
data-ouia-safe="true"
|
|
397
404
|
id="step-B"
|
|
405
|
+
type="button"
|
|
398
406
|
>
|
|
399
407
|
B
|
|
400
408
|
</button>
|
|
@@ -412,6 +420,7 @@ exports[`Wizard Wizard should match snapshot 1`] = `
|
|
|
412
420
|
data-ouia-component-type="PF4/WizardNavItem"
|
|
413
421
|
data-ouia-safe="true"
|
|
414
422
|
id="step-B-1"
|
|
423
|
+
type="button"
|
|
415
424
|
>
|
|
416
425
|
B-1
|
|
417
426
|
</button>
|
|
@@ -426,6 +435,7 @@ exports[`Wizard Wizard should match snapshot 1`] = `
|
|
|
426
435
|
data-ouia-component-type="PF4/WizardNavItem"
|
|
427
436
|
data-ouia-safe="true"
|
|
428
437
|
id="step-B-2"
|
|
438
|
+
type="button"
|
|
429
439
|
>
|
|
430
440
|
B-2
|
|
431
441
|
</button>
|
|
@@ -442,6 +452,7 @@ exports[`Wizard Wizard should match snapshot 1`] = `
|
|
|
442
452
|
data-ouia-component-type="PF4/WizardNavItem"
|
|
443
453
|
data-ouia-safe="true"
|
|
444
454
|
id="step-C"
|
|
455
|
+
type="button"
|
|
445
456
|
>
|
|
446
457
|
C
|
|
447
458
|
</button>
|
|
@@ -456,6 +467,7 @@ exports[`Wizard Wizard should match snapshot 1`] = `
|
|
|
456
467
|
data-ouia-component-type="PF4/WizardNavItem"
|
|
457
468
|
data-ouia-safe="true"
|
|
458
469
|
id="step-D"
|
|
470
|
+
type="button"
|
|
459
471
|
>
|
|
460
472
|
D
|
|
461
473
|
</button>
|
|
@@ -586,6 +598,7 @@ exports[`Wizard bare wiz 1`] = `
|
|
|
586
598
|
data-ouia-component-id="OUIA-Generated-WizardNavItem-13"
|
|
587
599
|
data-ouia-component-type="PF4/WizardNavItem"
|
|
588
600
|
data-ouia-safe="true"
|
|
601
|
+
type="button"
|
|
589
602
|
>
|
|
590
603
|
A
|
|
591
604
|
</button>
|
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
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
|
|
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
|
|
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
|
|
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
|
);
|