@patternfly/react-core 4.241.3 → 4.242.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 +19 -0
- package/dist/esm/components/ProgressStepper/ProgressStep.d.ts +1 -1
- package/dist/esm/components/ProgressStepper/ProgressStep.d.ts.map +1 -1
- package/dist/js/components/ProgressStepper/ProgressStep.d.ts +1 -1
- package/dist/js/components/ProgressStepper/ProgressStep.d.ts.map +1 -1
- package/dist/umd/react-core.min.css +2197 -2197
- package/package.json +2 -2
- package/src/components/Alert/examples/Alert.md +172 -126
- package/src/components/ProgressStepper/ProgressStep.tsx +1 -1
- package/src/components/ProgressStepper/__tests__/ProgressStepper.test.tsx +32 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@patternfly/react-core",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.242.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",
|
|
@@ -70,5 +70,5 @@
|
|
|
70
70
|
"react": "^16.8 || ^17 || ^18",
|
|
71
71
|
"react-dom": "^16.8 || ^17 || ^18"
|
|
72
72
|
},
|
|
73
|
-
"gitHead": "
|
|
73
|
+
"gitHead": "aacd4fd4e0c5b623fe98ddb5962efbb98c348465"
|
|
74
74
|
}
|
|
@@ -13,9 +13,20 @@ import DatabaseIcon from '@patternfly/react-icons/dist/esm/icons/database-icon';
|
|
|
13
13
|
import ServerIcon from '@patternfly/react-icons/dist/esm/icons/server-icon';
|
|
14
14
|
import LaptopIcon from '@patternfly/react-icons/dist/esm/icons/laptop-icon';
|
|
15
15
|
|
|
16
|
-
## Examples
|
|
16
|
+
## Examples
|
|
17
|
+
|
|
18
|
+
### Variant examples
|
|
19
|
+
|
|
20
|
+
PatternFly supports several alert variants for different scenarios. Each variant has an associated status icon, background, and alert title coded to communicate the severity of an alert. Use the `variant` property to apply the following styling options. If no `variant` is specified, then the variant will be set to "default".
|
|
21
|
+
|
|
22
|
+
| Variant | Description |
|
|
23
|
+
|---|---|
|
|
24
|
+
| Default | Use for generic messages with no associated severity |
|
|
25
|
+
| Info | Use for general informational messages |
|
|
26
|
+
| Success | Use to indicate that a task or process has been completed successfully |
|
|
27
|
+
| Warning | Use to indicate that a non-critical error has occurred|
|
|
28
|
+
| Danger | Use to indicate that a critical or blocking error has occurred |
|
|
17
29
|
|
|
18
|
-
### Types
|
|
19
30
|
```ts
|
|
20
31
|
import React from 'react';
|
|
21
32
|
import { Alert } from '@patternfly/react-core';
|
|
@@ -29,7 +40,18 @@ import { Alert } from '@patternfly/react-core';
|
|
|
29
40
|
</React.Fragment>
|
|
30
41
|
```
|
|
31
42
|
|
|
32
|
-
###
|
|
43
|
+
### Alert variations
|
|
44
|
+
|
|
45
|
+
PatternFly supports several properties and variations that can be used to add extra content to an alert.
|
|
46
|
+
|
|
47
|
+
* As demonstrated in the 1st variation below, use the `actionLinks` property to add one or more `<AlertActionLink>` components that place links beneath the alert message. You must pass in `href` and `component="a"` properties to have an `<AlertActionLink>` act as a proper link, rather than as a button.
|
|
48
|
+
|
|
49
|
+
* As demonstrated in the 2nd variation below, use a native HTML `<a>` element to add links within an alert message.
|
|
50
|
+
|
|
51
|
+
* As demonstrated in the 3rd and 4th variations below, use the `actionClose` property to add an `<AlertActionCloseButton>` component, which can be used to manage and customize alert dismissals. `actionClose` can be used with or without the presence of `actionLinks`.
|
|
52
|
+
|
|
53
|
+
* As demonstrated in the 5th and 6th variations below, use the `titleHeadingLevel` property to set the heading level of an alert title. Headings should be ordered by their level and heading levels should not be skipped. For example, a heading of an `h2` level should not be followed directly by an `h4`.
|
|
54
|
+
|
|
33
55
|
```ts
|
|
34
56
|
import React from 'react';
|
|
35
57
|
import { Alert, AlertActionCloseButton, AlertActionLink } from '@patternfly/react-core';
|
|
@@ -70,12 +92,139 @@ import { Alert, AlertActionCloseButton, AlertActionLink } from '@patternfly/reac
|
|
|
70
92
|
<Alert variant="success" title="h6 Success alert title" titleHeadingLevel="h6" />
|
|
71
93
|
</React.Fragment>
|
|
72
94
|
```
|
|
95
|
+
### Alert timeout
|
|
96
|
+
|
|
97
|
+
Use the `timeout` property to automatically dismiss an alert after a period of time. If set to `true`, the `timeout` will be 8000 milliseconds. Provide a specific value to dismiss the alert after a different number of milliseconds.
|
|
98
|
+
|
|
99
|
+
```ts
|
|
100
|
+
import React from 'react';
|
|
101
|
+
import { Alert, AlertActionLink, AlertGroup, Button } from '@patternfly/react-core';
|
|
102
|
+
|
|
103
|
+
const AlertTimeout: React.FunctionComponent = () => {
|
|
104
|
+
const [alerts, setAlerts] = React.useState<React.ReactNode[]>([]);
|
|
105
|
+
const onClick = () => {
|
|
106
|
+
const timeout = 8000;
|
|
107
|
+
setAlerts(prevAlerts => {
|
|
108
|
+
return [...prevAlerts,
|
|
109
|
+
<Alert title="Default timeout Alert" timeout={timeout} actionLinks={
|
|
110
|
+
<React.Fragment>
|
|
111
|
+
<AlertActionLink>View details</AlertActionLink>
|
|
112
|
+
<AlertActionLink>Ignore</AlertActionLink>
|
|
113
|
+
</React.Fragment>
|
|
114
|
+
}>
|
|
115
|
+
This alert will dismiss after {`${timeout / 1000} seconds`}
|
|
116
|
+
</Alert>
|
|
117
|
+
]
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
return (
|
|
122
|
+
<React.Fragment>
|
|
123
|
+
<Button variant="secondary" onClick={onClick}>Add alert</Button>
|
|
124
|
+
<Button variant="secondary" onClick={() => setAlerts([])}>Remove all alerts</Button>
|
|
125
|
+
<AlertGroup isLiveRegion>
|
|
126
|
+
{alerts}
|
|
127
|
+
</AlertGroup>
|
|
128
|
+
</React.Fragment>
|
|
129
|
+
);
|
|
130
|
+
};
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
### Expandable alerts
|
|
134
|
+
|
|
135
|
+
An alert can contain additional, hidden information that is made visible when users click a caret icon. This information can be expanded and collapsed each time the icon is clicked.
|
|
136
|
+
|
|
137
|
+
It is not recommended to use an expandable alert with a `timeout` in a toast [alert group](/components/alert-group) because the alert could timeout before users have time to interact with and view the entire alert.
|
|
138
|
+
|
|
139
|
+
See the [toast alert considerations](/components/alert/accessibility#toast-alerts) section of the alert accessibility documentation to understand the accessibility risks associated with using toast alerts.
|
|
140
|
+
|
|
141
|
+
```ts
|
|
142
|
+
import React from 'react';
|
|
143
|
+
import { Alert, AlertActionCloseButton, AlertActionLink } from '@patternfly/react-core';
|
|
144
|
+
|
|
145
|
+
<React.Fragment>
|
|
146
|
+
<Alert
|
|
147
|
+
isExpandable
|
|
148
|
+
variant="success"
|
|
149
|
+
title="Success alert title"
|
|
150
|
+
actionClose={<AlertActionCloseButton onClose={() => alert('Clicked the close button')} />}
|
|
151
|
+
actionLinks={
|
|
152
|
+
<React.Fragment>
|
|
153
|
+
<AlertActionLink onClick={() => alert('Clicked on View details')}>View details</AlertActionLink>
|
|
154
|
+
<AlertActionLink onClick={() => alert('Clicked on Ignore')}>Ignore</AlertActionLink>
|
|
155
|
+
</React.Fragment>
|
|
156
|
+
}
|
|
157
|
+
>
|
|
158
|
+
<p>Success alert description. This should tell the user more information about the alert.</p>
|
|
159
|
+
</Alert>
|
|
160
|
+
<Alert
|
|
161
|
+
isExpandable
|
|
162
|
+
isInline
|
|
163
|
+
variant="success"
|
|
164
|
+
title="Success alert title"
|
|
165
|
+
actionClose={<AlertActionCloseButton onClose={() => alert('Clicked the close button')} />}
|
|
166
|
+
actionLinks={
|
|
167
|
+
<React.Fragment>
|
|
168
|
+
<AlertActionLink onClick={() => alert('Clicked on View details')}>View details</AlertActionLink>
|
|
169
|
+
<AlertActionLink onClick={() => alert('Clicked on Ignore')}>Ignore</AlertActionLink>
|
|
170
|
+
</React.Fragment>
|
|
171
|
+
}
|
|
172
|
+
>
|
|
173
|
+
<p>Success alert description. This should tell the user more information about the alert.</p>
|
|
174
|
+
</Alert>
|
|
175
|
+
</React.Fragment>
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
### Truncated alerts
|
|
179
|
+
|
|
180
|
+
Use the `truncateTitle` property to shorten a long `title`. Set `truncateTitle` equal to a number (passed in as `{n}`) to reduce the number of lines of text in the alert's `title`. Users may hover over or tab to a truncated `title` to see the full message in a tooltip.
|
|
181
|
+
|
|
182
|
+
```ts
|
|
183
|
+
import React from 'react';
|
|
184
|
+
import { Alert } from '@patternfly/react-core';
|
|
185
|
+
|
|
186
|
+
<React.Fragment>
|
|
187
|
+
<Alert variant="info" truncateTitle={1} title={`
|
|
188
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur pellentesque neque cursus enim fringilla tincidunt. Proin lobortis aliquam dictum. Nam vel ullamcorper nulla, nec blandit dolor. Vivamus pellentesque neque justo, nec accumsan nulla rhoncus id. Suspendisse mollis, tortor quis faucibus volutpat, sem leo fringilla turpis, ac lacinia augue metus in nulla. Cras vestibulum lacinia orci. Pellentesque sodales consequat interdum. Sed porttitor tincidunt metus nec iaculis. Pellentesque non commodo justo. Morbi feugiat rhoncus neque, vitae facilisis diam aliquam nec. Sed dapibus vitae quam at tristique. Nunc vel commodo mi. Mauris et rhoncus leo.
|
|
189
|
+
`} />
|
|
190
|
+
<Alert variant="warning" truncateTitle={2} title={`
|
|
191
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur pellentesque neque cursus enim fringilla tincidunt. Proin lobortis aliquam dictum. Nam vel ullamcorper nulla, nec blandit dolor. Vivamus pellentesque neque justo, nec accumsan nulla rhoncus id. Suspendisse mollis, tortor quis faucibus volutpat, sem leo fringilla turpis, ac lacinia augue metus in nulla. Cras vestibulum lacinia orci. Pellentesque sodales consequat interdum. Sed porttitor tincidunt metus nec iaculis. Pellentesque non commodo justo. Morbi feugiat rhoncus neque, vitae facilisis diam aliquam nec. Sed dapibus vitae quam at tristique. Nunc vel commodo mi. Mauris et rhoncus leo.
|
|
192
|
+
`} />
|
|
193
|
+
<Alert variant="danger" truncateTitle={3} title={`
|
|
194
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur pellentesque neque cursus enim fringilla tincidunt. Proin lobortis aliquam dictum. Nam vel ullamcorper nulla, nec blandit dolor. Vivamus pellentesque neque justo, nec accumsan nulla rhoncus id. Suspendisse mollis, tortor quis faucibus volutpat, sem leo fringilla turpis, ac lacinia augue metus in nulla. Cras vestibulum lacinia orci. Pellentesque sodales consequat interdum. Sed porttitor tincidunt metus nec iaculis. Pellentesque non commodo justo. Morbi feugiat rhoncus neque, vitae facilisis diam aliquam nec. Sed dapibus vitae quam at tristique. Nunc vel commodo mi. Mauris et rhoncus leo.
|
|
195
|
+
`} />
|
|
196
|
+
</React.Fragment>
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
### Custom icons
|
|
200
|
+
|
|
201
|
+
Use the `customIcon` property to replace a default alert icon with a custom icon.
|
|
73
202
|
|
|
74
|
-
### Inline types
|
|
75
203
|
```ts
|
|
76
204
|
import React from 'react';
|
|
77
205
|
import { Alert } from '@patternfly/react-core';
|
|
206
|
+
import UsersIcon from '@patternfly/react-icons/dist/esm/icons/users-icon';
|
|
207
|
+
import BoxIcon from '@patternfly/react-icons/dist/esm/icons/box-icon';
|
|
208
|
+
import DatabaseIcon from '@patternfly/react-icons/dist/esm/icons/database-icon';
|
|
209
|
+
import ServerIcon from '@patternfly/react-icons/dist/esm/icons/server-icon';
|
|
210
|
+
import LaptopIcon from '@patternfly/react-icons/dist/esm/icons/laptop-icon';
|
|
211
|
+
|
|
212
|
+
<React.Fragment>
|
|
213
|
+
<Alert customIcon={<UsersIcon />} title="Default alert title" />
|
|
214
|
+
<Alert customIcon={<BoxIcon />} variant="info" title="Info alert title" />
|
|
215
|
+
<Alert customIcon={<DatabaseIcon />} variant="success" title="Success alert title" />
|
|
216
|
+
<Alert customIcon={<ServerIcon />} variant="warning" title="Warning alert title" />
|
|
217
|
+
<Alert customIcon={<LaptopIcon />} variant="danger" title="Danger alert title" />
|
|
218
|
+
</React.Fragment>
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
### Inline alerts variants
|
|
78
222
|
|
|
223
|
+
Use inline alerts to display an alert inline with content. All alert variants may use the `isInline` property to position alerts in content-heavy areas, such as within forms, wizards, or drawers.
|
|
224
|
+
|
|
225
|
+
```ts
|
|
226
|
+
import React from 'react';
|
|
227
|
+
import { Alert } from '@patternfly/react-core';
|
|
79
228
|
<React.Fragment>
|
|
80
229
|
<Alert variant="default" isInline title="Default inline alert title" />
|
|
81
230
|
<Alert variant="info" isInline title="Info inline alert title" />
|
|
@@ -84,12 +233,13 @@ import { Alert } from '@patternfly/react-core';
|
|
|
84
233
|
<Alert variant="danger" isInline title="Danger inline alert title" />
|
|
85
234
|
</React.Fragment>
|
|
86
235
|
```
|
|
236
|
+
### Inline alert variations
|
|
237
|
+
|
|
238
|
+
All general alert variations can use the `isInline` property to apply inline styling.
|
|
87
239
|
|
|
88
|
-
### Inline variations
|
|
89
240
|
```ts
|
|
90
241
|
import React from 'react';
|
|
91
242
|
import { Alert, AlertActionCloseButton, AlertActionLink } from '@patternfly/react-core';
|
|
92
|
-
|
|
93
243
|
<React.Fragment>
|
|
94
244
|
<Alert
|
|
95
245
|
isInline
|
|
@@ -133,11 +283,13 @@ import { Alert, AlertActionCloseButton, AlertActionLink } from '@patternfly/reac
|
|
|
133
283
|
</React.Fragment>
|
|
134
284
|
```
|
|
135
285
|
|
|
136
|
-
###
|
|
286
|
+
### Plain inline alert variants
|
|
287
|
+
|
|
288
|
+
Use the `isPlain` property to make any inline alert plain. Plain styling removes the colored background but keeps colored text and icons.
|
|
289
|
+
|
|
137
290
|
```ts
|
|
138
291
|
import React from 'react';
|
|
139
292
|
import { Alert } from '@patternfly/react-core';
|
|
140
|
-
|
|
141
293
|
<React.Fragment>
|
|
142
294
|
<Alert variant="default" isInline isPlain title="Default inline alert title" />
|
|
143
295
|
<Alert variant="info" isInline isPlain title="Info inline alert title" />
|
|
@@ -147,14 +299,13 @@ import { Alert } from '@patternfly/react-core';
|
|
|
147
299
|
</React.Fragment>
|
|
148
300
|
```
|
|
149
301
|
|
|
150
|
-
###
|
|
302
|
+
### Plain inline alert variations
|
|
151
303
|
|
|
152
|
-
It is not recommended to use
|
|
304
|
+
It is not recommended to use a plain inline alert with `actionClose` nor `actionLinks` because these alerts are non-dismissible and should persist until the error or action related to the alert is resolved.
|
|
153
305
|
|
|
154
306
|
```ts
|
|
155
307
|
import React from 'react';
|
|
156
308
|
import { Alert, AlertActionCloseButton, AlertActionLink } from '@patternfly/react-core';
|
|
157
|
-
|
|
158
309
|
<Alert
|
|
159
310
|
isInline
|
|
160
311
|
isPlain
|
|
@@ -165,48 +316,12 @@ import { Alert, AlertActionCloseButton, AlertActionLink } from '@patternfly/reac
|
|
|
165
316
|
</Alert>
|
|
166
317
|
```
|
|
167
318
|
|
|
168
|
-
###
|
|
319
|
+
### Static live region alerts
|
|
169
320
|
|
|
170
|
-
|
|
321
|
+
Live region alerts allow you to expose dynamic content changes in a way that can be announced by assistive technologies.
|
|
171
322
|
|
|
172
|
-
|
|
173
|
-
import React from 'react';
|
|
174
|
-
import { Alert, AlertActionCloseButton, AlertActionLink } from '@patternfly/react-core';
|
|
323
|
+
By default, `isLiveRegion`alerts are static.
|
|
175
324
|
|
|
176
|
-
<React.Fragment>
|
|
177
|
-
<Alert
|
|
178
|
-
isExpandable
|
|
179
|
-
variant="success"
|
|
180
|
-
title="Success alert title"
|
|
181
|
-
actionClose={<AlertActionCloseButton onClose={() => alert('Clicked the close button')} />}
|
|
182
|
-
actionLinks={
|
|
183
|
-
<React.Fragment>
|
|
184
|
-
<AlertActionLink onClick={() => alert('Clicked on View details')}>View details</AlertActionLink>
|
|
185
|
-
<AlertActionLink onClick={() => alert('Clicked on Ignore')}>Ignore</AlertActionLink>
|
|
186
|
-
</React.Fragment>
|
|
187
|
-
}
|
|
188
|
-
>
|
|
189
|
-
<p>Success alert description. This should tell the user more information about the alert.</p>
|
|
190
|
-
</Alert>
|
|
191
|
-
<Alert
|
|
192
|
-
isExpandable
|
|
193
|
-
isInline
|
|
194
|
-
variant="success"
|
|
195
|
-
title="Success alert title"
|
|
196
|
-
actionClose={<AlertActionCloseButton onClose={() => alert('Clicked the close button')} />}
|
|
197
|
-
actionLinks={
|
|
198
|
-
<React.Fragment>
|
|
199
|
-
<AlertActionLink onClick={() => alert('Clicked on View details')}>View details</AlertActionLink>
|
|
200
|
-
<AlertActionLink onClick={() => alert('Clicked on Ignore')}>Ignore</AlertActionLink>
|
|
201
|
-
</React.Fragment>
|
|
202
|
-
}
|
|
203
|
-
>
|
|
204
|
-
<p>Success alert description. This should tell the user more information about the alert.</p>
|
|
205
|
-
</Alert>
|
|
206
|
-
</React.Fragment>
|
|
207
|
-
```
|
|
208
|
-
|
|
209
|
-
### Static live region alert
|
|
210
325
|
```ts
|
|
211
326
|
import React from 'react';
|
|
212
327
|
import { Alert, AlertActionCloseButton } from '@patternfly/react-core';
|
|
@@ -234,84 +349,15 @@ import { Alert, AlertActionCloseButton } from '@patternfly/react-core';
|
|
|
234
349
|
</React.Fragment>
|
|
235
350
|
```
|
|
236
351
|
|
|
237
|
-
### Dynamic live region
|
|
238
|
-
Alerts asynchronously appended into dynamic AlertGroups with isLiveRegion will be announced to assistive technology at the moment the change happens, following the strategy used for aria-atomic, which defaults to false. This means only changes of type "addition" will be announced.
|
|
239
|
-
```ts file="AlertDynamicLiveRegion.tsx"
|
|
240
|
-
```
|
|
352
|
+
### Dynamic live region alerts
|
|
241
353
|
|
|
242
|
-
|
|
243
|
-
This shows how an alert could be triggered by an asynchronous event in the application. Note that you can customize how the alert will be announced to assistive technology. See the alert accessibility tab for more information.
|
|
244
|
-
```ts file="AlertAsyncLiveRegion.tsx"
|
|
245
|
-
```
|
|
354
|
+
Alerts that are asynchronously appended into dynamic [alert groups](/components/alert-group) via the `isLiveRegion` property will be announced to assistive technology the moment the change happens, following the strategy used for `aria-atomic`, which defaults to false. This means only changes of type "addition" will be announced.
|
|
246
355
|
|
|
247
|
-
|
|
248
|
-
```ts
|
|
249
|
-
import React from 'react';
|
|
250
|
-
import { Alert, AlertActionLink, AlertGroup, Button } from '@patternfly/react-core';
|
|
251
|
-
|
|
252
|
-
const AlertTimeout: React.FunctionComponent = () => {
|
|
253
|
-
const [alerts, setAlerts] = React.useState<React.ReactNode[]>([]);
|
|
254
|
-
const onClick = () => {
|
|
255
|
-
const timeout = 8000;
|
|
256
|
-
setAlerts(prevAlerts => {
|
|
257
|
-
return [...prevAlerts,
|
|
258
|
-
<Alert title="Default timeout Alert" timeout={timeout} actionLinks={
|
|
259
|
-
<React.Fragment>
|
|
260
|
-
<AlertActionLink>View details</AlertActionLink>
|
|
261
|
-
<AlertActionLink>Ignore</AlertActionLink>
|
|
262
|
-
</React.Fragment>
|
|
263
|
-
}>
|
|
264
|
-
This alert will dismiss after {`${timeout / 1000} seconds`}
|
|
265
|
-
</Alert>
|
|
266
|
-
]
|
|
267
|
-
});
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
return (
|
|
271
|
-
<React.Fragment>
|
|
272
|
-
<Button variant="secondary" onClick={onClick}>Add alert</Button>
|
|
273
|
-
<Button variant="secondary" onClick={() => setAlerts([])}>Remove all alerts</Button>
|
|
274
|
-
<AlertGroup isLiveRegion>
|
|
275
|
-
{alerts}
|
|
276
|
-
</AlertGroup>
|
|
277
|
-
</React.Fragment>
|
|
278
|
-
);
|
|
279
|
-
};
|
|
280
|
-
```
|
|
281
|
-
|
|
282
|
-
### Truncate
|
|
283
|
-
```ts
|
|
284
|
-
import React from 'react';
|
|
285
|
-
import { Alert } from '@patternfly/react-core';
|
|
286
|
-
|
|
287
|
-
<React.Fragment>
|
|
288
|
-
<Alert variant="info" truncateTitle={1} title={`
|
|
289
|
-
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur pellentesque neque cursus enim fringilla tincidunt. Proin lobortis aliquam dictum. Nam vel ullamcorper nulla, nec blandit dolor. Vivamus pellentesque neque justo, nec accumsan nulla rhoncus id. Suspendisse mollis, tortor quis faucibus volutpat, sem leo fringilla turpis, ac lacinia augue metus in nulla. Cras vestibulum lacinia orci. Pellentesque sodales consequat interdum. Sed porttitor tincidunt metus nec iaculis. Pellentesque non commodo justo. Morbi feugiat rhoncus neque, vitae facilisis diam aliquam nec. Sed dapibus vitae quam at tristique. Nunc vel commodo mi. Mauris et rhoncus leo.
|
|
290
|
-
`} />
|
|
291
|
-
<Alert variant="warning" truncateTitle={2} title={`
|
|
292
|
-
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur pellentesque neque cursus enim fringilla tincidunt. Proin lobortis aliquam dictum. Nam vel ullamcorper nulla, nec blandit dolor. Vivamus pellentesque neque justo, nec accumsan nulla rhoncus id. Suspendisse mollis, tortor quis faucibus volutpat, sem leo fringilla turpis, ac lacinia augue metus in nulla. Cras vestibulum lacinia orci. Pellentesque sodales consequat interdum. Sed porttitor tincidunt metus nec iaculis. Pellentesque non commodo justo. Morbi feugiat rhoncus neque, vitae facilisis diam aliquam nec. Sed dapibus vitae quam at tristique. Nunc vel commodo mi. Mauris et rhoncus leo.
|
|
293
|
-
`} />
|
|
294
|
-
<Alert variant="danger" truncateTitle={3} title={`
|
|
295
|
-
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur pellentesque neque cursus enim fringilla tincidunt. Proin lobortis aliquam dictum. Nam vel ullamcorper nulla, nec blandit dolor. Vivamus pellentesque neque justo, nec accumsan nulla rhoncus id. Suspendisse mollis, tortor quis faucibus volutpat, sem leo fringilla turpis, ac lacinia augue metus in nulla. Cras vestibulum lacinia orci. Pellentesque sodales consequat interdum. Sed porttitor tincidunt metus nec iaculis. Pellentesque non commodo justo. Morbi feugiat rhoncus neque, vitae facilisis diam aliquam nec. Sed dapibus vitae quam at tristique. Nunc vel commodo mi. Mauris et rhoncus leo.
|
|
296
|
-
`} />
|
|
297
|
-
</React.Fragment>
|
|
356
|
+
```ts file="AlertDynamicLiveRegion.tsx"
|
|
298
357
|
```
|
|
299
358
|
|
|
300
|
-
###
|
|
301
|
-
```ts
|
|
302
|
-
import React from 'react';
|
|
303
|
-
import { Alert } from '@patternfly/react-core';
|
|
304
|
-
import UsersIcon from '@patternfly/react-icons/dist/esm/icons/users-icon';
|
|
305
|
-
import BoxIcon from '@patternfly/react-icons/dist/esm/icons/box-icon';
|
|
306
|
-
import DatabaseIcon from '@patternfly/react-icons/dist/esm/icons/database-icon';
|
|
307
|
-
import ServerIcon from '@patternfly/react-icons/dist/esm/icons/server-icon';
|
|
308
|
-
import LaptopIcon from '@patternfly/react-icons/dist/esm/icons/laptop-icon';
|
|
359
|
+
### Asynchronous live region alerts
|
|
309
360
|
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
<Alert customIcon={<DatabaseIcon />} variant="success" title="Success alert title" />
|
|
314
|
-
<Alert customIcon={<ServerIcon />} variant="warning" title="Warning alert title" />
|
|
315
|
-
<Alert customIcon={<LaptopIcon />} variant="danger" title="Danger alert title" />
|
|
316
|
-
</React.Fragment>
|
|
317
|
-
```
|
|
361
|
+
This example shows how an alert could be triggered by an asynchronous event in the application. Note that you can customize how the alert will be announced to assistive technology. See the [https://www.patternfly.org/v4/components/alert/accessibility](alert accessibility) for more information.
|
|
362
|
+
```ts file="AlertAsyncLiveRegion.tsx"
|
|
363
|
+
```
|
|
@@ -19,7 +19,7 @@ export interface ProgressStepProps
|
|
|
19
19
|
/** Custom icon of a progress step. Will override default icons provided by the variant. */
|
|
20
20
|
icon?: React.ReactNode;
|
|
21
21
|
/** Description text of a progress step. */
|
|
22
|
-
description?:
|
|
22
|
+
description?: React.ReactNode;
|
|
23
23
|
/** ID of the title of the progress step. */
|
|
24
24
|
titleId?: string;
|
|
25
25
|
/** Accessible label for the progress step. Should communicate all information being communicated by the progress
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { render } from '@testing-library/react';
|
|
2
|
+
import { render, screen } from '@testing-library/react';
|
|
3
3
|
import { ProgressStepper } from '../ProgressStepper';
|
|
4
4
|
import { ProgressStep } from '../ProgressStep';
|
|
5
5
|
import InProgressIcon from '@patternfly/react-icons/dist/esm/icons/in-progress-icon';
|
|
@@ -110,3 +110,34 @@ describe('ProgressStep', () => {
|
|
|
110
110
|
expect(asFragment()).toMatchSnapshot();
|
|
111
111
|
});
|
|
112
112
|
});
|
|
113
|
+
|
|
114
|
+
test('renders description class and text', () => {
|
|
115
|
+
render(
|
|
116
|
+
<ProgressStep
|
|
117
|
+
description="Test description"
|
|
118
|
+
>
|
|
119
|
+
Title
|
|
120
|
+
</ProgressStep>
|
|
121
|
+
);
|
|
122
|
+
|
|
123
|
+
expect(screen.getByText('Test description')).toBeVisible();
|
|
124
|
+
expect(screen.getByText('Test description')).toHaveClass('pf-c-progress-stepper__step-description');
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
test('renders description line break', () => {
|
|
128
|
+
render(
|
|
129
|
+
<ProgressStep
|
|
130
|
+
description={
|
|
131
|
+
<>
|
|
132
|
+
Testing description
|
|
133
|
+
<br />
|
|
134
|
+
Line break
|
|
135
|
+
</>
|
|
136
|
+
}
|
|
137
|
+
>
|
|
138
|
+
Title
|
|
139
|
+
</ProgressStep>
|
|
140
|
+
);
|
|
141
|
+
|
|
142
|
+
expect(screen.getByText("Testing descriptionLine break")).toBeVisible();
|
|
143
|
+
});
|