@patternfly/react-core 4.159.1 → 4.160.3
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 +38 -0
- package/dist/esm/components/ProgressStepper/ProgressStep.d.ts +19 -0
- package/dist/esm/components/ProgressStepper/ProgressStep.d.ts.map +1 -0
- package/dist/esm/components/ProgressStepper/ProgressStep.js +40 -0
- package/dist/esm/components/ProgressStepper/ProgressStep.js.map +1 -0
- package/dist/esm/components/ProgressStepper/ProgressStepper.d.ts +15 -0
- package/dist/esm/components/ProgressStepper/ProgressStepper.d.ts.map +1 -0
- package/dist/esm/components/ProgressStepper/ProgressStepper.js +10 -0
- package/dist/esm/components/ProgressStepper/ProgressStepper.js.map +1 -0
- package/dist/esm/components/ProgressStepper/index.d.ts +3 -0
- package/dist/esm/components/ProgressStepper/index.d.ts.map +1 -0
- package/dist/esm/components/ProgressStepper/index.js +3 -0
- package/dist/esm/components/ProgressStepper/index.js.map +1 -0
- package/dist/esm/components/index.d.ts +1 -0
- package/dist/esm/components/index.d.ts.map +1 -1
- package/dist/esm/components/index.js +1 -0
- package/dist/esm/components/index.js.map +1 -1
- package/dist/js/components/ProgressStepper/ProgressStep.d.ts +19 -0
- package/dist/js/components/ProgressStepper/ProgressStep.d.ts.map +1 -0
- package/dist/js/components/ProgressStepper/ProgressStep.js +44 -0
- package/dist/js/components/ProgressStepper/ProgressStep.js.map +1 -0
- package/dist/js/components/ProgressStepper/ProgressStepper.d.ts +15 -0
- package/dist/js/components/ProgressStepper/ProgressStepper.d.ts.map +1 -0
- package/dist/js/components/ProgressStepper/ProgressStepper.js +14 -0
- package/dist/js/components/ProgressStepper/ProgressStepper.js.map +1 -0
- package/dist/js/components/ProgressStepper/index.d.ts +3 -0
- package/dist/js/components/ProgressStepper/index.d.ts.map +1 -0
- package/dist/js/components/ProgressStepper/index.js +6 -0
- package/dist/js/components/ProgressStepper/index.js.map +1 -0
- package/dist/js/components/index.d.ts +1 -0
- package/dist/js/components/index.d.ts.map +1 -1
- package/dist/js/components/index.js +1 -0
- package/dist/js/components/index.js.map +1 -1
- package/dist/umd/react-core.css +12350 -7232
- package/dist/umd/react-core.js +2534 -2832
- package/dist/umd/react-core.min.css +12927 -7809
- package/dist/umd/react-core.min.js +7 -6
- package/package.json +12 -12
- package/src/components/Page/examples/Page.md +1 -1
- package/src/components/ProgressStepper/ProgressStep.tsx +90 -0
- package/src/components/ProgressStepper/ProgressStepper.tsx +40 -0
- package/src/components/ProgressStepper/__tests__/ProgressStepper.test.tsx +107 -0
- package/src/components/ProgressStepper/__tests__/__snapshots__/ProgressStepper.test.tsx.snap +836 -0
- package/src/components/ProgressStepper/examples/ProgressStepper.md +330 -0
- package/src/components/ProgressStepper/index.ts +2 -0
- package/src/components/index.ts +1 -0
- package/src/demos/ProgressStepperDemo.md +82 -0
|
@@ -0,0 +1,330 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: Progress stepper
|
|
3
|
+
section: components
|
|
4
|
+
cssPrefix: pf-c-progress-stepper
|
|
5
|
+
propComponents: ['ProgressStepper', 'ProgressStep']
|
|
6
|
+
beta: true
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
import InProgressIcon from '@patternfly/react-icons/dist/esm/icons/in-progress-icon';
|
|
10
|
+
import PendingIcon from '@patternfly/react-icons/dist/esm/icons/pending-icon';
|
|
11
|
+
|
|
12
|
+
## Examples
|
|
13
|
+
|
|
14
|
+
Progress steppers have default icons associated with the `variant` property, and may be overriden and customized using the `icon` property.
|
|
15
|
+
|
|
16
|
+
### Basic
|
|
17
|
+
|
|
18
|
+
```js
|
|
19
|
+
import React from 'react';
|
|
20
|
+
import { ProgressStepper, ProgressStep } from '@patternfly/react-core';
|
|
21
|
+
|
|
22
|
+
<ProgressStepper>
|
|
23
|
+
<ProgressStep
|
|
24
|
+
variant="success"
|
|
25
|
+
id="basic-step1"
|
|
26
|
+
titleId="basic-step1-title"
|
|
27
|
+
aria-label="completed step, step with success"
|
|
28
|
+
>
|
|
29
|
+
First step
|
|
30
|
+
</ProgressStep>
|
|
31
|
+
<ProgressStep
|
|
32
|
+
variant="info"
|
|
33
|
+
isCurrent
|
|
34
|
+
id="basic-step2"
|
|
35
|
+
titleId="basic-step2-title"
|
|
36
|
+
aria-label="current step, step with info"
|
|
37
|
+
>
|
|
38
|
+
Second step
|
|
39
|
+
</ProgressStep>
|
|
40
|
+
<ProgressStep variant="pending" id="basic-step3" titleId="basic-step3-title" aria-label="pending step">
|
|
41
|
+
Third step
|
|
42
|
+
</ProgressStep>
|
|
43
|
+
</ProgressStepper>;
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### Basic with descriptions
|
|
47
|
+
|
|
48
|
+
```js
|
|
49
|
+
import React from 'react';
|
|
50
|
+
import { ProgressStepper, ProgressStep } from '@patternfly/react-core';
|
|
51
|
+
|
|
52
|
+
<ProgressStepper>
|
|
53
|
+
<ProgressStep
|
|
54
|
+
variant="success"
|
|
55
|
+
description="This is the first thing to happen"
|
|
56
|
+
id="basic-desc-step1"
|
|
57
|
+
titleId="basic-desc-step1-title"
|
|
58
|
+
aria-label="completed step, step with success"
|
|
59
|
+
>
|
|
60
|
+
First step
|
|
61
|
+
</ProgressStep>
|
|
62
|
+
<ProgressStep
|
|
63
|
+
variant="info"
|
|
64
|
+
isCurrent
|
|
65
|
+
description="This is the second thing to happen"
|
|
66
|
+
id="basic-desc-step2"
|
|
67
|
+
titleId="basic-desc-step2-title"
|
|
68
|
+
aria-label="current step, step with info"
|
|
69
|
+
>
|
|
70
|
+
Second step
|
|
71
|
+
</ProgressStep>
|
|
72
|
+
<ProgressStep
|
|
73
|
+
variant="pending"
|
|
74
|
+
description="This is the last thing to happen"
|
|
75
|
+
id="basic-desc-step3"
|
|
76
|
+
titleId="basic-desc-step3-title"
|
|
77
|
+
aria-label="pending step"
|
|
78
|
+
>
|
|
79
|
+
Third step
|
|
80
|
+
</ProgressStep>
|
|
81
|
+
</ProgressStepper>;
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
### Center aligned with descriptions
|
|
85
|
+
|
|
86
|
+
```js
|
|
87
|
+
import React from 'react';
|
|
88
|
+
import { ProgressStepper, ProgressStep } from '@patternfly/react-core';
|
|
89
|
+
|
|
90
|
+
<ProgressStepper isCenterAligned>
|
|
91
|
+
<ProgressStep
|
|
92
|
+
variant="success"
|
|
93
|
+
description="This is the first thing to happen"
|
|
94
|
+
id="center-desc-step1"
|
|
95
|
+
titleId="center-desc-step1-title"
|
|
96
|
+
aria-label="completed step, step with success"
|
|
97
|
+
>
|
|
98
|
+
First step
|
|
99
|
+
</ProgressStep>
|
|
100
|
+
<ProgressStep
|
|
101
|
+
variant="info"
|
|
102
|
+
isCurrent
|
|
103
|
+
description="This is the second thing to happen"
|
|
104
|
+
id="center-desc-step2"
|
|
105
|
+
titleId="center-desc-step2-title"
|
|
106
|
+
aria-label="current step, step with info"
|
|
107
|
+
>
|
|
108
|
+
Second step
|
|
109
|
+
</ProgressStep>
|
|
110
|
+
<ProgressStep
|
|
111
|
+
variant="pending"
|
|
112
|
+
description="This is the last thing to happen"
|
|
113
|
+
id="center-desc-step3"
|
|
114
|
+
titleId="center-desc-step3-title"
|
|
115
|
+
aria-label="pending step"
|
|
116
|
+
>
|
|
117
|
+
Third step
|
|
118
|
+
</ProgressStep>
|
|
119
|
+
</ProgressStepper>;
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
### Vertical with descriptions
|
|
123
|
+
|
|
124
|
+
```js
|
|
125
|
+
import React from 'react';
|
|
126
|
+
import { ProgressStepper, ProgressStep } from '@patternfly/react-core';
|
|
127
|
+
|
|
128
|
+
<ProgressStepper isVertical>
|
|
129
|
+
<ProgressStep
|
|
130
|
+
variant="success"
|
|
131
|
+
description="This is the first thing to happen"
|
|
132
|
+
id="vertical-desc-step1"
|
|
133
|
+
titleId="vertical-desc-step1-title"
|
|
134
|
+
aria-label="completed step, step with success"
|
|
135
|
+
>
|
|
136
|
+
First step
|
|
137
|
+
</ProgressStep>
|
|
138
|
+
<ProgressStep
|
|
139
|
+
variant="info"
|
|
140
|
+
isCurrent
|
|
141
|
+
description="This is the second thing to happen"
|
|
142
|
+
id="vertical-desc-step2"
|
|
143
|
+
titleId="vertical-desc-step2-title"
|
|
144
|
+
aria-label="current step, step with info"
|
|
145
|
+
>
|
|
146
|
+
Second step
|
|
147
|
+
</ProgressStep>
|
|
148
|
+
<ProgressStep
|
|
149
|
+
variant="pending"
|
|
150
|
+
description="This is the last thing to happen"
|
|
151
|
+
id="vertical-desc-step3"
|
|
152
|
+
titleId="vertical-desc-step3-title"
|
|
153
|
+
aria-label="pending step"
|
|
154
|
+
>
|
|
155
|
+
Third step
|
|
156
|
+
</ProgressStep>
|
|
157
|
+
</ProgressStepper>;
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
### Compact
|
|
161
|
+
|
|
162
|
+
Compact progress steppers will only display the current step's `title`, and will not display any steps' `description` texts.
|
|
163
|
+
|
|
164
|
+
```js
|
|
165
|
+
import React from 'react';
|
|
166
|
+
import { ProgressStepper, ProgressStep } from '@patternfly/react-core';
|
|
167
|
+
|
|
168
|
+
<ProgressStepper isCompact>
|
|
169
|
+
<ProgressStep
|
|
170
|
+
variant="success"
|
|
171
|
+
id="compact-step1"
|
|
172
|
+
titleId="compact-step1-title"
|
|
173
|
+
aria-label="completed step, step with success"
|
|
174
|
+
>
|
|
175
|
+
First step
|
|
176
|
+
</ProgressStep>
|
|
177
|
+
<ProgressStep
|
|
178
|
+
variant="info"
|
|
179
|
+
isCurrent
|
|
180
|
+
id="compact-step2"
|
|
181
|
+
titleId="compact-step2-title"
|
|
182
|
+
aria-label="current step, step with info"
|
|
183
|
+
>
|
|
184
|
+
Second step
|
|
185
|
+
</ProgressStep>
|
|
186
|
+
<ProgressStep variant="pending" id="compact-step3" titleId="compact-step3-title" aria-label="pending step">
|
|
187
|
+
Third step
|
|
188
|
+
</ProgressStep>
|
|
189
|
+
</ProgressStepper>;
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
### Basic with an issue
|
|
193
|
+
|
|
194
|
+
```js
|
|
195
|
+
import React from 'react';
|
|
196
|
+
import { ProgressStepper, ProgressStep } from '@patternfly/react-core';
|
|
197
|
+
|
|
198
|
+
<ProgressStepper>
|
|
199
|
+
<ProgressStep
|
|
200
|
+
variant="success"
|
|
201
|
+
id="basic-with-issue-step1"
|
|
202
|
+
titleId="basic-with-issue-step1-title"
|
|
203
|
+
aria-label="completed step, step with success"
|
|
204
|
+
>
|
|
205
|
+
First step
|
|
206
|
+
</ProgressStep>
|
|
207
|
+
<ProgressStep
|
|
208
|
+
variant="success"
|
|
209
|
+
id="basic-with-issue-step2"
|
|
210
|
+
titleId="basic-with-issue-step2-title"
|
|
211
|
+
aria-label="completed step, step with success"
|
|
212
|
+
>
|
|
213
|
+
Second step
|
|
214
|
+
</ProgressStep>
|
|
215
|
+
<ProgressStep
|
|
216
|
+
variant="warning"
|
|
217
|
+
id="basic-with-issue-step3"
|
|
218
|
+
titleId="basic-with-issue-step3-title"
|
|
219
|
+
aria-label="completed step, step with warning"
|
|
220
|
+
>
|
|
221
|
+
Third step
|
|
222
|
+
</ProgressStep>
|
|
223
|
+
<ProgressStep
|
|
224
|
+
variant="info"
|
|
225
|
+
isCurrent
|
|
226
|
+
id="basic-with-issue-step4"
|
|
227
|
+
titleId="basic-with-issue-step4-title"
|
|
228
|
+
aria-label="current step, step with info"
|
|
229
|
+
>
|
|
230
|
+
Fourth step
|
|
231
|
+
</ProgressStep>
|
|
232
|
+
<ProgressStep
|
|
233
|
+
variant="pending"
|
|
234
|
+
id="basic-with-issue-step5"
|
|
235
|
+
titleId="basic-with-issue-step5-title"
|
|
236
|
+
aria-label="pending step"
|
|
237
|
+
>
|
|
238
|
+
Fifth step
|
|
239
|
+
</ProgressStep>
|
|
240
|
+
</ProgressStepper>;
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
### Basic with a failure
|
|
244
|
+
|
|
245
|
+
```js
|
|
246
|
+
import React from 'react';
|
|
247
|
+
import { ProgressStepper, ProgressStep } from '@patternfly/react-core';
|
|
248
|
+
|
|
249
|
+
<ProgressStepper>
|
|
250
|
+
<ProgressStep
|
|
251
|
+
variant="success"
|
|
252
|
+
id="basic-with-failure-step1"
|
|
253
|
+
titleId="basic-with-failure-step1-title"
|
|
254
|
+
aria-label="completed step, step with success"
|
|
255
|
+
>
|
|
256
|
+
First step
|
|
257
|
+
</ProgressStep>
|
|
258
|
+
<ProgressStep
|
|
259
|
+
variant="success"
|
|
260
|
+
id="basic-with-failure-step2"
|
|
261
|
+
titleId="basic-with-failure-step2-title"
|
|
262
|
+
aria-label="completed step, step with success"
|
|
263
|
+
>
|
|
264
|
+
Second step
|
|
265
|
+
</ProgressStep>
|
|
266
|
+
<ProgressStep
|
|
267
|
+
variant="success"
|
|
268
|
+
id="basic-with-failure-step3"
|
|
269
|
+
titleId="basic-with-failure-step3-title"
|
|
270
|
+
aria-label="completed step, step with success"
|
|
271
|
+
>
|
|
272
|
+
Third step
|
|
273
|
+
</ProgressStep>
|
|
274
|
+
<ProgressStep
|
|
275
|
+
variant="danger"
|
|
276
|
+
isCurrent
|
|
277
|
+
id="basic-with-failure-step4"
|
|
278
|
+
titleId="basic-with-failure-step4-title"
|
|
279
|
+
aria-label="current step, step with danger"
|
|
280
|
+
>
|
|
281
|
+
Fourth step
|
|
282
|
+
</ProgressStep>
|
|
283
|
+
<ProgressStep
|
|
284
|
+
variant="pending"
|
|
285
|
+
id="basic-with-failure-step5"
|
|
286
|
+
titleId="basic-with-failure-step5-title"
|
|
287
|
+
aria-label="pending step"
|
|
288
|
+
>
|
|
289
|
+
Fifth step
|
|
290
|
+
</ProgressStep>
|
|
291
|
+
</ProgressStepper>;
|
|
292
|
+
```
|
|
293
|
+
|
|
294
|
+
### Basic with Patternfly icons
|
|
295
|
+
|
|
296
|
+
```js
|
|
297
|
+
import React from 'react';
|
|
298
|
+
import { ProgressStepper, ProgressStep } from '@patternfly/react-core';
|
|
299
|
+
import InProgressIcon from '@patternfly/react-icons/dist/esm/icons/in-progress-icon';
|
|
300
|
+
import PendingIcon from '@patternfly/react-icons/dist/esm/icons/pending-icon';
|
|
301
|
+
|
|
302
|
+
<ProgressStepper>
|
|
303
|
+
<ProgressStep
|
|
304
|
+
variant="success"
|
|
305
|
+
id="custom-step1"
|
|
306
|
+
titleId="custom-step1-title"
|
|
307
|
+
aria-label="completed step, step with success"
|
|
308
|
+
>
|
|
309
|
+
Successful completion
|
|
310
|
+
</ProgressStep>
|
|
311
|
+
<ProgressStep
|
|
312
|
+
isCurrent
|
|
313
|
+
icon={<InProgressIcon />}
|
|
314
|
+
id="custom-step2"
|
|
315
|
+
titleId="custom-step2-title"
|
|
316
|
+
aria-label="current step"
|
|
317
|
+
>
|
|
318
|
+
In process
|
|
319
|
+
</ProgressStep>
|
|
320
|
+
<ProgressStep
|
|
321
|
+
variant="pending"
|
|
322
|
+
icon={<PendingIcon />}
|
|
323
|
+
id="custom-step3"
|
|
324
|
+
titleId="custom-step3-title"
|
|
325
|
+
aria-label="pending step"
|
|
326
|
+
>
|
|
327
|
+
Pending
|
|
328
|
+
</ProgressStep>
|
|
329
|
+
</ProgressStepper>;
|
|
330
|
+
```
|
package/src/components/index.ts
CHANGED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: Progress stepper
|
|
3
|
+
section: components
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
## Demos
|
|
7
|
+
|
|
8
|
+
### Basic
|
|
9
|
+
|
|
10
|
+
```js
|
|
11
|
+
import React from 'react';
|
|
12
|
+
import { ProgressStepper, ProgressStep, Button, Stack, StackItem } from '@patternfly/react-core';
|
|
13
|
+
|
|
14
|
+
ProgressStepperDemo = () => {
|
|
15
|
+
const [currentStep, setCurrentStep] = React.useState(0);
|
|
16
|
+
|
|
17
|
+
const steps = [
|
|
18
|
+
{ title: 'First step', id: 'step1' },
|
|
19
|
+
{ title: 'Second step', id: 'step2' },
|
|
20
|
+
{ title: 'Third step', id: 'step3' },
|
|
21
|
+
{ title: 'Fourth step', id: 'step4' },
|
|
22
|
+
{ title: 'Fifth step', id: 'step5' }
|
|
23
|
+
];
|
|
24
|
+
|
|
25
|
+
const onStepForward = event => {
|
|
26
|
+
const next = currentStep + 1;
|
|
27
|
+
setCurrentStep(next <= 5 ? next : 4);
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
const onStepBack = event => {
|
|
31
|
+
const next = currentStep - 1;
|
|
32
|
+
setCurrentStep(next > 0 ? next : 0);
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
return (
|
|
36
|
+
<Stack>
|
|
37
|
+
<StackItem>
|
|
38
|
+
<Button onClick={onStepBack} isDisabled={currentStep === 0}>
|
|
39
|
+
Step back
|
|
40
|
+
</Button>{' '}
|
|
41
|
+
<Button onClick={onStepForward} isDisabled={currentStep === 5}>
|
|
42
|
+
Step forward
|
|
43
|
+
</Button>
|
|
44
|
+
<br />
|
|
45
|
+
<br />
|
|
46
|
+
</StackItem>
|
|
47
|
+
<StackItem>
|
|
48
|
+
<div className="pf-screen-reader" aria-live="polite">
|
|
49
|
+
{steps[currentStep] && `On ${steps[currentStep].title}.`}
|
|
50
|
+
{steps[currentStep - 1] && `${steps[currentStep - 1].title} was successful.`}
|
|
51
|
+
</div>
|
|
52
|
+
<ProgressStepper>
|
|
53
|
+
{steps.map((step, index) => {
|
|
54
|
+
let variant = 'pending';
|
|
55
|
+
let ariaLabel = 'pending step';
|
|
56
|
+
if (index < currentStep) {
|
|
57
|
+
variant = 'success';
|
|
58
|
+
ariaLabel = 'completed step, step with success';
|
|
59
|
+
} else if (index === currentStep) {
|
|
60
|
+
variant = 'info';
|
|
61
|
+
ariaLabel = 'current step';
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
return (
|
|
65
|
+
<ProgressStep
|
|
66
|
+
id={index}
|
|
67
|
+
titleId={step.id}
|
|
68
|
+
key={index}
|
|
69
|
+
variant={variant}
|
|
70
|
+
isCurrent={index === currentStep}
|
|
71
|
+
aria-label={ariaLabel}
|
|
72
|
+
>
|
|
73
|
+
{step.title}
|
|
74
|
+
</ProgressStep>
|
|
75
|
+
);
|
|
76
|
+
})}
|
|
77
|
+
</ProgressStepper>
|
|
78
|
+
</StackItem>
|
|
79
|
+
</Stack>
|
|
80
|
+
);
|
|
81
|
+
};
|
|
82
|
+
```
|