@patternfly/react-core 4.203.2 → 4.204.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/ProgressStepper/ProgressStep.d.ts +3 -5
- package/dist/esm/components/ProgressStepper/ProgressStep.d.ts.map +1 -1
- package/dist/esm/components/ProgressStepper/ProgressStep.js +6 -6
- package/dist/esm/components/ProgressStepper/ProgressStep.js.map +1 -1
- package/dist/js/components/ProgressStepper/ProgressStep.d.ts +3 -5
- package/dist/js/components/ProgressStepper/ProgressStep.d.ts.map +1 -1
- package/dist/js/components/ProgressStepper/ProgressStep.js +7 -6
- package/dist/js/components/ProgressStepper/ProgressStep.js.map +1 -1
- package/dist/umd/react-core.js +6 -6
- package/dist/umd/react-core.min.js +4 -4
- package/package.json +5 -5
- package/src/components/ProgressStepper/ProgressStep.tsx +10 -15
- package/src/components/ProgressStepper/__tests__/ProgressStepper.test.tsx +1 -1
- package/src/components/ProgressStepper/examples/ProgressStepper.md +13 -20
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@patternfly/react-core",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.204.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.55.0",
|
|
38
|
+
"@patternfly/react-styles": "^4.54.0",
|
|
39
|
+
"@patternfly/react-tokens": "^4.56.0",
|
|
40
40
|
"focus-trap": "6.2.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": "9116e7cc699cff22722794c15cda402c1cabf67b"
|
|
64
64
|
}
|
|
@@ -22,13 +22,11 @@ export interface ProgressStepProps
|
|
|
22
22
|
description?: string;
|
|
23
23
|
/** ID of the title of the progress step. */
|
|
24
24
|
titleId?: string;
|
|
25
|
-
/** Popover for a progress step. */
|
|
26
|
-
popover?: React.ReactNode;
|
|
27
|
-
/** @hide Forwarded reference to title container */
|
|
28
|
-
innerRef?: React.Ref<any>;
|
|
29
25
|
/** Accessible label for the progress step. Should communicate all information being communicated by the progress
|
|
30
26
|
* step's icon, including the variant and the completed status. */
|
|
31
27
|
'aria-label'?: string;
|
|
28
|
+
/** Forwards the step ref to rendered function. Use this prop to add a popover to the step.*/
|
|
29
|
+
popoverRender?: (stepRef: React.RefObject<any>) => React.ReactNode;
|
|
32
30
|
}
|
|
33
31
|
|
|
34
32
|
const variantIcons = {
|
|
@@ -49,7 +47,7 @@ const variantStyle = {
|
|
|
49
47
|
danger: styles.modifiers.danger
|
|
50
48
|
};
|
|
51
49
|
|
|
52
|
-
const
|
|
50
|
+
export const ProgressStep: React.FunctionComponent<ProgressStepProps> = ({
|
|
53
51
|
children,
|
|
54
52
|
className,
|
|
55
53
|
variant,
|
|
@@ -57,13 +55,13 @@ const ProgressStepBase: React.FunctionComponent<ProgressStepProps> = ({
|
|
|
57
55
|
description,
|
|
58
56
|
icon,
|
|
59
57
|
titleId,
|
|
60
|
-
popover,
|
|
61
|
-
innerRef,
|
|
62
58
|
'aria-label': ariaLabel,
|
|
59
|
+
popoverRender,
|
|
63
60
|
...props
|
|
64
61
|
}: ProgressStepProps) => {
|
|
65
62
|
const _icon = icon !== undefined ? icon : variantIcons[variant];
|
|
66
|
-
const Component =
|
|
63
|
+
const Component = popoverRender !== undefined ? 'span' : 'div';
|
|
64
|
+
const stepRef = React.useRef();
|
|
67
65
|
|
|
68
66
|
if (props.id === undefined || titleId === undefined) {
|
|
69
67
|
/* eslint-disable no-console */
|
|
@@ -89,14 +87,14 @@ const ProgressStepBase: React.FunctionComponent<ProgressStepProps> = ({
|
|
|
89
87
|
</div>
|
|
90
88
|
<div className={css(styles.progressStepperStepMain)}>
|
|
91
89
|
<Component
|
|
92
|
-
className={css(styles.progressStepperStepTitle,
|
|
90
|
+
className={css(styles.progressStepperStepTitle, popoverRender && styles.modifiers.helpText)}
|
|
93
91
|
id={titleId}
|
|
94
|
-
ref={
|
|
95
|
-
{...(
|
|
92
|
+
ref={stepRef}
|
|
93
|
+
{...(popoverRender && { tabIndex: 0, role: 'button', type: 'button' })}
|
|
96
94
|
{...(props.id !== undefined && titleId !== undefined && { 'aria-labelledby': `${props.id} ${titleId}` })}
|
|
97
95
|
>
|
|
98
96
|
{children}
|
|
99
|
-
{
|
|
97
|
+
{popoverRender && popoverRender(stepRef)}
|
|
100
98
|
</Component>
|
|
101
99
|
{description && <div className={css(styles.progressStepperStepDescription)}>{description}</div>}
|
|
102
100
|
</div>
|
|
@@ -104,7 +102,4 @@ const ProgressStepBase: React.FunctionComponent<ProgressStepProps> = ({
|
|
|
104
102
|
);
|
|
105
103
|
};
|
|
106
104
|
|
|
107
|
-
export const ProgressStep = React.forwardRef((props: ProgressStepProps, ref: React.Ref<HTMLSpanElement>) => (
|
|
108
|
-
<ProgressStepBase innerRef={ref} {...props} />
|
|
109
|
-
));
|
|
110
105
|
ProgressStep.displayName = 'ProgressStep';
|
|
@@ -87,7 +87,7 @@ describe('ProgressStep', () => {
|
|
|
87
87
|
});
|
|
88
88
|
|
|
89
89
|
test('renders help text styling', () => {
|
|
90
|
-
const view = render(<ProgressStep
|
|
90
|
+
const view = render(<ProgressStep popoverRender={({ stepRef }) => (<div></div>)}>Title</ProgressStep>);
|
|
91
91
|
expect(view.container).toMatchSnapshot();
|
|
92
92
|
});
|
|
93
93
|
|
|
@@ -331,17 +331,13 @@ import PendingIcon from '@patternfly/react-icons/dist/esm/icons/pending-icon';
|
|
|
331
331
|
|
|
332
332
|
### With help popover
|
|
333
333
|
|
|
334
|
-
To add a popover to a progress step, set the `
|
|
334
|
+
To add a popover to a progress step, set the `popoverRender` properties on the `ProgressStep` component.
|
|
335
335
|
|
|
336
336
|
```js
|
|
337
337
|
import React from 'react';
|
|
338
338
|
import { ProgressStepper, ProgressStep, Popover } from '@patternfly/react-core';
|
|
339
339
|
|
|
340
340
|
PopoverProgressStep = () => {
|
|
341
|
-
const firstStepRef = React.useRef();
|
|
342
|
-
const secondStepRef = React.useRef();
|
|
343
|
-
const thirdStepRef = React.useRef();
|
|
344
|
-
|
|
345
341
|
return (
|
|
346
342
|
<ProgressStepper>
|
|
347
343
|
<ProgressStep
|
|
@@ -349,55 +345,52 @@ PopoverProgressStep = () => {
|
|
|
349
345
|
id="popover-step1"
|
|
350
346
|
titleId="popover-step1-title"
|
|
351
347
|
aria-label="completed step with popover, step with success"
|
|
352
|
-
|
|
348
|
+
popoverRender={( stepRef ) => (
|
|
353
349
|
<Popover
|
|
354
350
|
aria-label="First step help"
|
|
355
351
|
headerContent={<div>First step popover</div>}
|
|
356
352
|
bodyContent={<div>Additional info or help text content.</div>}
|
|
357
|
-
reference={
|
|
353
|
+
reference={stepRef}
|
|
358
354
|
position="right"
|
|
359
355
|
/>
|
|
360
|
-
|
|
361
|
-
ref={firstStepRef}
|
|
356
|
+
)}
|
|
362
357
|
>
|
|
363
|
-
First
|
|
358
|
+
First step
|
|
364
359
|
</ProgressStep>
|
|
365
360
|
<ProgressStep
|
|
366
361
|
variant="danger"
|
|
367
362
|
id="popover-step2"
|
|
368
363
|
titleId="popover-step2-title"
|
|
369
364
|
aria-label="completed step with popover, step with danger"
|
|
370
|
-
|
|
365
|
+
popoverRender={( stepRef ) => (
|
|
371
366
|
<Popover
|
|
372
367
|
aria-label="Second step help"
|
|
373
368
|
headerContent={<div>Second step popover</div>}
|
|
374
369
|
bodyContent={<div>Additional info or help text content.</div>}
|
|
375
|
-
reference={
|
|
370
|
+
reference={stepRef}
|
|
376
371
|
position="right"
|
|
377
372
|
/>
|
|
378
|
-
}
|
|
379
|
-
ref={secondStepRef}
|
|
373
|
+
)}
|
|
380
374
|
>
|
|
381
|
-
Second
|
|
375
|
+
Second step
|
|
382
376
|
</ProgressStep>
|
|
383
377
|
<ProgressStep
|
|
384
378
|
variant="info"
|
|
385
379
|
id="popover-step3"
|
|
386
380
|
titleId="popover-step3-title"
|
|
387
381
|
aria-label="step with popover"
|
|
388
|
-
|
|
382
|
+
popoverRender={(stepRef) => (
|
|
389
383
|
<Popover
|
|
390
384
|
aria-label="Third step help"
|
|
391
385
|
headerContent={<div>Third step popover</div>}
|
|
392
386
|
bodyContent={<div>Additional info or help text content.</div>}
|
|
393
|
-
reference={
|
|
387
|
+
reference={stepRef}
|
|
394
388
|
position="right"
|
|
395
389
|
/>
|
|
396
|
-
}
|
|
390
|
+
)}
|
|
397
391
|
isCurrent
|
|
398
|
-
ref={thirdStepRef}
|
|
399
392
|
>
|
|
400
|
-
Third
|
|
393
|
+
Third step
|
|
401
394
|
</ProgressStep>
|
|
402
395
|
<ProgressStep variant="pending" id="popover-step4" titleId="popover-step4-title" aria-label="pending step">
|
|
403
396
|
Fourth step
|