@patternfly/react-core 4.234.0 → 4.234.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.
Files changed (53) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/dist/esm/components/LoginPage/LoginFooterItem.d.ts +3 -3
  3. package/dist/esm/components/LoginPage/LoginForm.d.ts +18 -18
  4. package/dist/esm/components/LoginPage/LoginHeader.d.ts +1 -1
  5. package/dist/esm/components/LoginPage/LoginMainBody.d.ts +2 -2
  6. package/dist/esm/components/LoginPage/LoginMainFooter.d.ts +5 -5
  7. package/dist/esm/components/LoginPage/LoginMainFooterBandItem.d.ts +2 -2
  8. package/dist/esm/components/LoginPage/LoginMainFooterLinksItem.d.ts +5 -5
  9. package/dist/esm/components/LoginPage/LoginMainHeader.d.ts +6 -4
  10. package/dist/esm/components/LoginPage/LoginMainHeader.d.ts.map +1 -1
  11. package/dist/esm/components/LoginPage/LoginMainHeader.js +2 -1
  12. package/dist/esm/components/LoginPage/LoginMainHeader.js.map +1 -1
  13. package/dist/esm/components/LoginPage/LoginPage.d.ts +16 -14
  14. package/dist/esm/components/LoginPage/LoginPage.d.ts.map +1 -1
  15. package/dist/esm/components/LoginPage/LoginPage.js +2 -2
  16. package/dist/esm/components/LoginPage/LoginPage.js.map +1 -1
  17. package/dist/js/components/LoginPage/LoginFooterItem.d.ts +3 -3
  18. package/dist/js/components/LoginPage/LoginForm.d.ts +18 -18
  19. package/dist/js/components/LoginPage/LoginHeader.d.ts +1 -1
  20. package/dist/js/components/LoginPage/LoginMainBody.d.ts +2 -2
  21. package/dist/js/components/LoginPage/LoginMainFooter.d.ts +5 -5
  22. package/dist/js/components/LoginPage/LoginMainFooterBandItem.d.ts +2 -2
  23. package/dist/js/components/LoginPage/LoginMainFooterLinksItem.d.ts +5 -5
  24. package/dist/js/components/LoginPage/LoginMainHeader.d.ts +6 -4
  25. package/dist/js/components/LoginPage/LoginMainHeader.d.ts.map +1 -1
  26. package/dist/js/components/LoginPage/LoginMainHeader.js +2 -1
  27. package/dist/js/components/LoginPage/LoginMainHeader.js.map +1 -1
  28. package/dist/js/components/LoginPage/LoginPage.d.ts +16 -14
  29. package/dist/js/components/LoginPage/LoginPage.d.ts.map +1 -1
  30. package/dist/js/components/LoginPage/LoginPage.js +2 -2
  31. package/dist/js/components/LoginPage/LoginPage.js.map +1 -1
  32. package/dist/umd/react-core.css +29 -29
  33. package/dist/umd/react-core.js +4 -3
  34. package/dist/umd/react-core.min.css +127 -127
  35. package/dist/umd/react-core.min.js +4 -4
  36. package/package.json +6 -6
  37. package/src/components/LoginPage/LoginFooterItem.tsx +3 -3
  38. package/src/components/LoginPage/LoginForm.tsx +18 -18
  39. package/src/components/LoginPage/LoginHeader.tsx +1 -1
  40. package/src/components/LoginPage/LoginMainBody.tsx +2 -2
  41. package/src/components/LoginPage/LoginMainFooter.tsx +5 -5
  42. package/src/components/LoginPage/LoginMainFooterBandItem.tsx +2 -2
  43. package/src/components/LoginPage/LoginMainFooterLinksItem.tsx +5 -5
  44. package/src/components/LoginPage/LoginMainHeader.tsx +8 -4
  45. package/src/components/LoginPage/LoginPage.tsx +18 -15
  46. package/src/components/LoginPage/examples/LoginPage.md +8 -0
  47. package/src/components/LoginPage/examples/LoginPageBasic.tsx +0 -1
  48. package/src/components/LoginPage/examples/LoginPageLanguageSelect.tsx +194 -0
  49. package/src/components/LoginPage/examples/LoginPageShowHidePassword.tsx +0 -1
  50. package/src/components/NotificationDrawer/examples/NotificationDrawer.md +3 -708
  51. package/src/components/NotificationDrawer/examples/NotificationDrawerBasic.tsx +185 -0
  52. package/src/components/NotificationDrawer/examples/NotificationDrawerGroups.tsx +337 -0
  53. package/src/components/NotificationDrawer/examples/NotificationDrawerLightweight.tsx +185 -0
@@ -23,720 +23,15 @@ import SearchIcon from '@patternfly/react-icons/dist/esm/icons/search-icon';
23
23
 
24
24
  ### Basic
25
25
 
26
- ```js
27
- import React from 'react';
28
- import {
29
- Dropdown,
30
- DropdownItem,
31
- DropdownPosition,
32
- DropdownDirection,
33
- DropdownSeparator,
34
- KebabToggle,
35
- NotificationDrawer,
36
- NotificationDrawerBody,
37
- NotificationDrawerHeader,
38
- NotificationDrawerList,
39
- NotificationDrawerListItem,
40
- NotificationDrawerListItemBody,
41
- NotificationDrawerListItemHeader,
42
- Title
43
- } from '@patternfly/react-core';
44
-
45
- class BasicNotificationDrawer extends React.Component {
46
- constructor(props) {
47
- super(props);
48
- this.state = {
49
- isOpen: new Array(6).fill(false),
50
- isDrawerOpen: true
51
- };
52
- this.onDrawerClose = () => {
53
- this.setState({
54
- isDrawerOpen: false
55
- });
56
- };
57
- this.onToggle = index => isOpen => {
58
- newState = [...this.state.isOpen.slice(0, index), isOpen, ...this.state.isOpen.slice(index + 1)];
59
- this.setState({ isOpen: newState });
60
- };
61
- this.onSelect = event => {
62
- this.setState({ isOpen: new Array(6).fill(false) });
63
- };
64
- }
65
-
66
- render() {
67
- const [isOpen0, isOpen1, isOpen2, isOpen3, isOpen4, isOpen5, isOpen6] = this.state.isOpen;
68
- const dropdownItems = [
69
- <DropdownItem key="link">Link</DropdownItem>,
70
- <DropdownItem key="action" component="button">
71
- Action
72
- </DropdownItem>,
73
- <DropdownSeparator key="separator" />,
74
- <DropdownItem key="disabled link" isDisabled>
75
- Disabled link
76
- </DropdownItem>
77
- ];
78
- return (
79
- <NotificationDrawer>
80
- <NotificationDrawerHeader count={3} onClose={this.onDrawerClose}>
81
- <Dropdown
82
- onSelect={this.onSelect}
83
- toggle={<KebabToggle onToggle={this.onToggle(0)} id="basic-kebab-toggle" />}
84
- isOpen={isOpen0}
85
- isPlain
86
- dropdownItems={dropdownItems}
87
- id="basic-notification-0"
88
- position={DropdownPosition.right}
89
- />
90
- </NotificationDrawerHeader>
91
- <NotificationDrawerBody>
92
- <NotificationDrawerList>
93
- <NotificationDrawerListItem variant="info">
94
- <NotificationDrawerListItemHeader
95
- variant="info"
96
- title="Unread info notification title"
97
- srTitle="Info notification:"
98
- >
99
- <Dropdown
100
- position={DropdownPosition.right}
101
- onSelect={this.onSelect}
102
- toggle={<KebabToggle onToggle={this.onToggle(1)} id="basic-toggle-id-1" />}
103
- isOpen={isOpen1}
104
- isPlain
105
- dropdownItems={dropdownItems}
106
- id="basic-notification-1"
107
- />
108
- </NotificationDrawerListItemHeader>
109
- <NotificationDrawerListItemBody timestamp="5 minutes ago">
110
- This is an info notification description.
111
- </NotificationDrawerListItemBody>
112
- </NotificationDrawerListItem>
113
- <NotificationDrawerListItem variant="danger">
114
- <NotificationDrawerListItemHeader
115
- variant="danger"
116
- title="Unread danger notification title. This is a long title to show how the title will wrap if it is long and wraps to multiple lines."
117
- srTitle="Danger notification:"
118
- >
119
- <Dropdown
120
- position={DropdownPosition.right}
121
- onSelect={this.onSelect}
122
- toggle={<KebabToggle onToggle={this.onToggle(2)} id="basic-toggle-id-2" />}
123
- isOpen={isOpen2}
124
- isPlain
125
- dropdownItems={dropdownItems}
126
- id="basic-notification-2"
127
- />
128
- </NotificationDrawerListItemHeader>
129
- <NotificationDrawerListItemBody timestamp="10 minutes ago">
130
- This is a danger notification description. This is a long description to show how the title will wrap if
131
- it is long and wraps to multiple lines.
132
- </NotificationDrawerListItemBody>
133
- </NotificationDrawerListItem>
134
- <NotificationDrawerListItem variant="danger">
135
- <NotificationDrawerListItemHeader
136
- truncateTitle={1}
137
- variant="danger"
138
- title="Unread danger notification title. This is a long title to show how the title will be truncated if it is long and will be shown in a single line."
139
- srTitle="Danger notification:"
140
- >
141
- <Dropdown
142
- position={DropdownPosition.right}
143
- onSelect={this.onSelect}
144
- toggle={<KebabToggle onToggle={this.onToggle(3)} id="basic-toggle-id-3" />}
145
- isOpen={isOpen3}
146
- isPlain
147
- dropdownItems={dropdownItems}
148
- id="basic-notification-3"
149
- />
150
- </NotificationDrawerListItemHeader>
151
- <NotificationDrawerListItemBody timestamp="10 minutes ago">
152
- This is a danger notification description. This is a long description to show how the title will wrap if
153
- it is long and wraps to multiple lines.
154
- </NotificationDrawerListItemBody>
155
- </NotificationDrawerListItem>
156
- <NotificationDrawerListItem variant="warning" isRead>
157
- <NotificationDrawerListItemHeader
158
- variant="warning"
159
- title="Read warning notification title"
160
- srTitle="Warning notification:"
161
- >
162
- <Dropdown
163
- position={DropdownPosition.right}
164
- onSelect={this.onSelect}
165
- toggle={<KebabToggle onToggle={this.onToggle(4)} id="basic-toggle-id-4" />}
166
- isOpen={isOpen4}
167
- isPlain
168
- dropdownItems={dropdownItems}
169
- id="basic-notification-4"
170
- />
171
- </NotificationDrawerListItemHeader>
172
- <NotificationDrawerListItemBody timestamp="20 minutes ago">
173
- This is a warning notification description.
174
- </NotificationDrawerListItemBody>
175
- </NotificationDrawerListItem>
176
- <NotificationDrawerListItem variant="success" isRead>
177
- <NotificationDrawerListItemHeader
178
- variant="success"
179
- title="Read success notification title"
180
- srTitle="Success notification:"
181
- >
182
- <Dropdown
183
- position={DropdownPosition.right}
184
- direction={DropdownDirection.up}
185
- onSelect={this.onSelect}
186
- toggle={<KebabToggle onToggle={this.onToggle(5)} id="basic-toggle-id-5" />}
187
- isOpen={isOpen5}
188
- isPlain
189
- dropdownItems={dropdownItems}
190
- id="basic-notification-5"
191
- />
192
- </NotificationDrawerListItemHeader>
193
- <NotificationDrawerListItemBody timestamp="30 minutes ago">
194
- This is a success notification description.
195
- </NotificationDrawerListItemBody>
196
- </NotificationDrawerListItem>
197
- <NotificationDrawerListItem isRead>
198
- <NotificationDrawerListItemHeader title="Read (default) notification title" srTitle="notification:">
199
- <Dropdown
200
- position={DropdownPosition.right}
201
- onSelect={this.onSelect}
202
- toggle={<KebabToggle onToggle={this.onToggle(6)} id="basic-toggle-id-6" />}
203
- isOpen={isOpen6}
204
- isPlain
205
- dropdownItems={dropdownItems}
206
- id="basic-notification-6"
207
- />
208
- </NotificationDrawerListItemHeader>
209
- <NotificationDrawerListItemBody timestamp="35 minutes ago">
210
- This is a default notification description.
211
- </NotificationDrawerListItemBody>
212
- </NotificationDrawerListItem>
213
- </NotificationDrawerList>
214
- </NotificationDrawerBody>
215
- </NotificationDrawer>
216
- );
217
- }
218
- }
26
+ ```ts file="NotificationDrawerBasic.tsx"
219
27
  ```
220
28
 
221
29
  ### Groups
222
30
 
223
- ```js
224
- import React from 'react';
225
- import {
226
- Button,
227
- Dropdown,
228
- DropdownItem,
229
- DropdownPosition,
230
- DropdownDirection,
231
- DropdownSeparator,
232
- EmptyState,
233
- EmptyStateBody,
234
- EmptyStateIcon,
235
- EmptyStatePrimary,
236
- KebabToggle,
237
- NotificationDrawer,
238
- NotificationDrawerBody,
239
- NotificationDrawerHeader,
240
- NotificationDrawerGroup,
241
- NotificationDrawerGroupList,
242
- NotificationDrawerList,
243
- NotificationDrawerListItem,
244
- NotificationDrawerListItemBody,
245
- NotificationDrawerListItemHeader,
246
- Title
247
- } from '@patternfly/react-core';
248
- import SearchIcon from '@patternfly/react-icons/dist/esm/icons/search-icon';
249
-
250
- class GroupNotificationDrawer extends React.Component {
251
- constructor(props) {
252
- super(props);
253
- this.state = {
254
- isOpenMap: null,
255
- firstGroupExpanded: false,
256
- secondGroupExpanded: false,
257
- thirdGroupExpanded: true
258
- };
259
- this.onToggle = (id, isOpen) => {
260
- this.setState({
261
- isOpenMap: { [id]: isOpen }
262
- });
263
- };
264
- this.onSelect = event => {
265
- this.setState({
266
- isOpenMap: null
267
- });
268
- };
269
- this.toggleFirstDrawer = (event, value) => {
270
- this.setState({
271
- firstGroupExpanded: value
272
- });
273
- };
274
- this.toggleSecondDrawer = (event, value) => {
275
- this.setState({
276
- secondGroupExpanded: value
277
- });
278
- };
279
- this.toggleThirdDrawer = (event, value) => {
280
- this.setState({
281
- thirdGroupExpanded: value
282
- });
283
- };
284
- }
285
- render() {
286
- const { isOpenMap, firstGroupExpanded, secondGroupExpanded, thirdGroupExpanded } = this.state;
287
- const dropdownItems = [
288
- <DropdownItem key="link">Link</DropdownItem>,
289
- <DropdownItem key="action" component="button">
290
- Action
291
- </DropdownItem>,
292
- <DropdownSeparator key="separator" />,
293
- <DropdownItem key="disabled link" isDisabled>
294
- Disabled link
295
- </DropdownItem>
296
- ];
297
- return (
298
- <NotificationDrawer>
299
- <NotificationDrawerHeader count={4}>
300
- <Dropdown
301
- onSelect={this.onSelect}
302
- toggle={<KebabToggle onToggle={isOpen => this.onToggle('groups-kebab-toggle-1', isOpen)} id="groups-kebab-toggle-1" />}
303
- isOpen={isOpenMap && isOpenMap['groups-kebab-toggle-1']}
304
- isPlain
305
- dropdownItems={dropdownItems}
306
- id="grouped-notification-1"
307
- position={DropdownPosition.right}
308
- />
309
- </NotificationDrawerHeader>
310
- <NotificationDrawerBody>
311
- <NotificationDrawerGroupList>
312
- <NotificationDrawerGroup
313
- title="First notification group"
314
- isExpanded={firstGroupExpanded}
315
- count={2}
316
- onExpand={this.toggleFirstDrawer}
317
- >
318
- <NotificationDrawerList isHidden={!firstGroupExpanded}>
319
- <NotificationDrawerListItem variant="info">
320
- <NotificationDrawerListItemHeader
321
- variant="info"
322
- title="Unread info notification title"
323
- srTitle="Info notification:"
324
- >
325
- <Dropdown
326
- position={DropdownPosition.right}
327
- onSelect={this.onSelect}
328
- toggle={
329
- <KebabToggle onToggle={isOpen => this.onToggle('groups-notification-kebab-toggle-2', isOpen)} id="groups-kebab-toggle-2" />
330
- }
331
- isOpen={isOpenMap && isOpenMap['groups-notification-kebab-toggle-2']}
332
- isPlain
333
- dropdownItems={dropdownItems}
334
- id="grouped-notification-2"
335
- />
336
- </NotificationDrawerListItemHeader>
337
- <NotificationDrawerListItemBody timestamp="5 minutes ago">
338
- This is an info notification description.
339
- </NotificationDrawerListItemBody>
340
- </NotificationDrawerListItem>
341
- <NotificationDrawerListItem variant="danger">
342
- <NotificationDrawerListItemHeader
343
- variant="danger"
344
- title="Unread danger notification title. This is a long title to show how the title will wrap if it is long and wraps to multiple lines."
345
- srTitle="Danger notification:"
346
- >
347
- <Dropdown
348
- position={DropdownPosition.right}
349
- onSelect={this.onSelect}
350
- toggle={
351
- <KebabToggle onToggle={isOpen => this.onToggle('groups-kebab-toggle-3', isOpen)} id="groups-kebab-toggle-3" />
352
- }
353
- isOpen={isOpenMap && isOpenMap['groups-kebab-toggle-3']}
354
- isPlain
355
- dropdownItems={dropdownItems}
356
- id="grouped-notification-3"
357
- />
358
- </NotificationDrawerListItemHeader>
359
- <NotificationDrawerListItemBody timestamp="10 minutes ago">
360
- This is a danger notification description. This is a long description to show how the title will
361
- wrap if it is long and wraps to multiple lines.
362
- </NotificationDrawerListItemBody>
363
- </NotificationDrawerListItem>
364
- <NotificationDrawerListItem variant="warning" isRead>
365
- <NotificationDrawerListItemHeader
366
- variant="warning"
367
- title="Read warning notification title"
368
- srTitle="Warning notification:"
369
- >
370
- <Dropdown
371
- position={DropdownPosition.right}
372
- onSelect={this.onSelect}
373
- toggle={
374
- <KebabToggle onToggle={isOpen => this.onToggle('groups-kebab-toggle-4', isOpen)} id="groups-kebab-toggle-4" />
375
- }
376
- isOpen={isOpenMap && isOpenMap['groups-kebab-toggle-4']}
377
- isPlain
378
- dropdownItems={dropdownItems}
379
- id="grouped-notification-4"
380
- />
381
- </NotificationDrawerListItemHeader>
382
- <NotificationDrawerListItemBody timestamp="20 minutes ago">
383
- This is a warning notification description.
384
- </NotificationDrawerListItemBody>
385
- </NotificationDrawerListItem>
386
- <NotificationDrawerListItem variant="success" isRead>
387
- <NotificationDrawerListItemHeader
388
- variant="success"
389
- title="Read success notification title"
390
- srTitle="Success notification:"
391
- >
392
- <Dropdown
393
- position={DropdownPosition.right}
394
- direction={DropdownDirection.up}
395
- onSelect={this.onSelect}
396
- toggle={
397
- <KebabToggle onToggle={isOpen => this.onToggle('groups-kebab-toggle-5', isOpen)} id="groups-kebab-toggle-5" />
398
- }
399
- isOpen={isOpenMap && isOpenMap['groups-kebab-toggle-5']}
400
- isPlain
401
- dropdownItems={dropdownItems}
402
- id="grouped-notification-5"
403
- />
404
- </NotificationDrawerListItemHeader>
405
- <NotificationDrawerListItemBody timestamp="30 minutes ago">
406
- This is a success notification description.
407
- </NotificationDrawerListItemBody>
408
- </NotificationDrawerListItem>
409
- </NotificationDrawerList>
410
- </NotificationDrawerGroup>
411
-
412
- <NotificationDrawerGroup
413
- title="Second notification group. This is a long title to show how the title will be truncated if it is long and will be shown in a single line."
414
- isExpanded={secondGroupExpanded}
415
- count={0}
416
- onExpand={this.toggleSecondDrawer}
417
- truncateTitle={1}
418
- >
419
- <NotificationDrawerList isHidden={!secondGroupExpanded}>
420
- <EmptyState variant={EmptyStateVariant.full}>
421
- <EmptyStateIcon icon={SearchIcon} />
422
- <Title headingLevel="h2" size="lg">
423
- No alerts found
424
- </Title>
425
- <EmptyStateBody>
426
- There are currently no critical alerts firing. There may be firing alerts of other severities or
427
- silenced critical alerts however.
428
- </EmptyStateBody>
429
- <EmptyStatePrimary>
430
- <Button variant="link">Action</Button>
431
- </EmptyStatePrimary>
432
- </EmptyState>
433
- </NotificationDrawerList>
434
- </NotificationDrawerGroup>
435
- <NotificationDrawerGroup
436
- title="Third notification group"
437
- isExpanded={thirdGroupExpanded}
438
- count={2}
439
- onExpand={this.toggleThirdDrawer}
440
- >
441
- <NotificationDrawerList isHidden={!thirdGroupExpanded}>
442
- <NotificationDrawerListItem variant="info">
443
- <NotificationDrawerListItemHeader
444
- variant="info"
445
- title="Unread info notification title"
446
- srTitle="Info notification:"
447
- >
448
- <Dropdown
449
- position={DropdownPosition.right}
450
- onSelect={this.onSelect}
451
- toggle={
452
- <KebabToggle onToggle={isOpen => this.onToggle('groups-kebab-toggle-6', isOpen)} id="groups-kebab-toggle-6" />
453
- }
454
- isOpen={isOpenMap && isOpenMap['groups-kebab-toggle-6']}
455
- isPlain
456
- dropdownItems={dropdownItems}
457
- id="grouped-notification-6"
458
- />
459
- </NotificationDrawerListItemHeader>
460
- <NotificationDrawerListItemBody timestamp="5 minutes ago">
461
- This is an info notification description.
462
- </NotificationDrawerListItemBody>
463
- </NotificationDrawerListItem>
464
- <NotificationDrawerListItem variant="danger">
465
- <NotificationDrawerListItemHeader
466
- variant="danger"
467
- title="Unread danger notification title. This is a long title to show how the title will wrap if it is long and wraps to multiple lines."
468
- srTitle="Danger notification:"
469
- >
470
- <Dropdown
471
- position={DropdownPosition.right}
472
- onSelect={this.onSelect}
473
- toggle={
474
- <KebabToggle onToggle={isOpen => this.onToggle('groups-kebab-toggle-7', isOpen)} id="groups-kebab-toggle-7" />
475
- }
476
- isOpen={isOpenMap && isOpenMap['groups-kebab-toggle-7']}
477
- isPlain
478
- dropdownItems={dropdownItems}
479
- id="grouped-notification-7"
480
- />
481
- </NotificationDrawerListItemHeader>
482
- <NotificationDrawerListItemBody timestamp="10 minutes ago">
483
- This is a danger notification description. This is a long description to show how the title will
484
- wrap if it is long and wraps to multiple lines.
485
- </NotificationDrawerListItemBody>
486
- </NotificationDrawerListItem>
487
- <NotificationDrawerListItem variant="warning" isRead>
488
- <NotificationDrawerListItemHeader
489
- variant="warning"
490
- title="Read warning notification title"
491
- srTitle="Warning notification:"
492
- >
493
- <Dropdown
494
- position={DropdownPosition.right}
495
- onSelect={this.onSelect}
496
- toggle={
497
- <KebabToggle onToggle={isOpen => this.onToggle('groups-kebab-toggle-8', isOpen)} id="groups-kebab-toggle-8" />
498
- }
499
- isOpen={isOpenMap && isOpenMap['groups-kebab-toggle-8']}
500
- isPlain
501
- dropdownItems={dropdownItems}
502
- id="grouped-notification-8"
503
- />
504
- </NotificationDrawerListItemHeader>
505
- <NotificationDrawerListItemBody timestamp="20 minutes ago">
506
- This is a warning notification description.
507
- </NotificationDrawerListItemBody>
508
- </NotificationDrawerListItem>
509
- <NotificationDrawerListItem variant="success" isRead>
510
- <NotificationDrawerListItemHeader
511
- variant="success"
512
- title="Read success notification title"
513
- srTitle="Success notification:"
514
- >
515
- <Dropdown
516
- position={DropdownPosition.right}
517
- direction={DropdownDirection.up}
518
- onSelect={this.onSelect}
519
- toggle={
520
- <KebabToggle onToggle={isOpen => this.onToggle('groups-kebab-toggle-9', isOpen)} id="groups-kebab-toggle-9" />
521
- }
522
- isOpen={isOpenMap && isOpenMap['groups-kebab-toggle-9']}
523
- isPlain
524
- dropdownItems={dropdownItems}
525
- id="grouped-notification-9"
526
- />
527
- </NotificationDrawerListItemHeader>
528
- <NotificationDrawerListItemBody timestamp="30 minutes ago">
529
- This is a success notification description.
530
- </NotificationDrawerListItemBody>
531
- </NotificationDrawerListItem>
532
- </NotificationDrawerList>
533
- </NotificationDrawerGroup>
534
- </NotificationDrawerGroupList>
535
- </NotificationDrawerBody>
536
- </NotificationDrawer>
537
- );
538
- }
539
- }
31
+ ```ts file="NotificationDrawerGroups.tsx"
540
32
  ```
541
33
 
542
34
  ### Lightweight
543
35
 
544
- ```js
545
- import React from 'react';
546
- import {
547
- Button,
548
- EmptyState,
549
- EmptyStateBody,
550
- EmptyStateIcon,
551
- EmptyStatePrimary,
552
- EmptyStateVariant,
553
- NotificationDrawer,
554
- NotificationDrawerBody,
555
- NotificationDrawerHeader,
556
- NotificationDrawerGroup,
557
- NotificationDrawerGroupList,
558
- NotificationDrawerList,
559
- NotificationDrawerListItem,
560
- NotificationDrawerListItemBody,
561
- NotificationDrawerListItemHeader,
562
- Title
563
- } from '@patternfly/react-core';
564
- import SearchIcon from '@patternfly/react-icons/dist/esm/icons/search-icon';
565
-
566
- class LightweightNotificationDrawerDemo extends React.Component {
567
- constructor(props) {
568
- super(props);
569
- this.state = {
570
- firstGroupExpanded: false,
571
- secondGroupExpanded: true,
572
- thirdGroupExpanded: false
573
- };
574
-
575
- this.onFocus = id => {
576
- if (id) {
577
- const element = document.getElementById(id);
578
- element.focus();
579
- }
580
- };
581
-
582
- this.toggleFirstDrawer = (event, value) => {
583
- this.setState({
584
- firstGroupExpanded: value
585
- });
586
- };
587
-
588
- this.toggleSecondDrawer = (event, value) => {
589
- this.setState({
590
- secondGroupExpanded: value
591
- });
592
- };
593
-
594
- this.toggleThirdDrawer = (event, value) => {
595
- this.setState({
596
- thirdGroupExpanded: value
597
- });
598
- };
599
- }
600
-
601
- render() {
602
- const { firstGroupExpanded, secondGroupExpanded, thirdGroupExpanded } = this.state;
603
-
604
- return (
605
- <NotificationDrawer>
606
- <NotificationDrawerHeader customText="2 unread alerts" />
607
- <NotificationDrawerBody>
608
- <NotificationDrawerGroupList>
609
- <NotificationDrawerGroup
610
- title="First notification group"
611
- isExpanded={firstGroupExpanded}
612
- count={4}
613
- isRead
614
- onExpand={this.toggleFirstDrawer}
615
- >
616
- <NotificationDrawerList isHidden={!firstGroupExpanded}>
617
- <NotificationDrawerListItem variant="info">
618
- <NotificationDrawerListItemHeader
619
- variant="info"
620
- title="Info notification title"
621
- srTitle="Info notification:"
622
- />
623
- <NotificationDrawerListItemBody timestamp="5 minutes ago">
624
- This is an info notification description.
625
- </NotificationDrawerListItemBody>
626
- </NotificationDrawerListItem>
627
- <NotificationDrawerListItem variant="danger">
628
- <NotificationDrawerListItemHeader
629
- variant="danger"
630
- title="Danger notification title. This is a long title to show how the title will wrap if it is long and wraps to multiple lines."
631
- srTitle="Danger notification:"
632
- />
633
- <NotificationDrawerListItemBody timestamp="10 minutes ago">
634
- This is a danger notification description. This is a long description to show how the title will
635
- wrap if it is long and wraps to multiple lines.
636
- </NotificationDrawerListItemBody>
637
- </NotificationDrawerListItem>
638
- <NotificationDrawerListItem variant="warning">
639
- <NotificationDrawerListItemHeader
640
- variant="warning"
641
- title="Warning notification title"
642
- srTitle="Warning notification:"
643
- />
644
- <NotificationDrawerListItemBody timestamp="20 minutes ago">
645
- This is a warning notification description.
646
- </NotificationDrawerListItemBody>
647
- </NotificationDrawerListItem>
648
- <NotificationDrawerListItem variant="success">
649
- <NotificationDrawerListItemHeader
650
- variant="success"
651
- title="Success notification title"
652
- srTitle="Success notification:"
653
- />
654
- <NotificationDrawerListItemBody timestamp="30 minutes ago">
655
- This is a success notification description.
656
- </NotificationDrawerListItemBody>
657
- </NotificationDrawerListItem>
658
- </NotificationDrawerList>
659
- </NotificationDrawerGroup>
660
- <NotificationDrawerGroup
661
- title="Second notification group"
662
- isExpanded={secondGroupExpanded}
663
- count={4}
664
- isRead
665
- onExpand={this.toggleSecondDrawer}
666
- >
667
- <NotificationDrawerList isHidden={!secondGroupExpanded}>
668
- <NotificationDrawerListItem variant="info">
669
- <NotificationDrawerListItemHeader
670
- variant="info"
671
- title="Info notification title w/action"
672
- srTitle="Info notification:"
673
- >
674
- <Button variant="link">Action</Button>
675
- </NotificationDrawerListItemHeader>
676
- <NotificationDrawerListItemBody timestamp="5 minutes ago">
677
- This is an info notification description.
678
- </NotificationDrawerListItemBody>
679
- </NotificationDrawerListItem>
680
- <NotificationDrawerListItem variant="danger">
681
- <NotificationDrawerListItemHeader
682
- variant="danger"
683
- title="Danger notification title. This is a long title to show how the title will wrap if it is long and wraps to multiple lines."
684
- srTitle="Danger notification:"
685
- />
686
- <NotificationDrawerListItemBody timestamp="10 minutes ago">
687
- This is a danger notification description. This is a long description to show how the title will
688
- wrap if it is long and wraps to multiple lines.
689
- </NotificationDrawerListItemBody>
690
- </NotificationDrawerListItem>
691
- <NotificationDrawerListItem variant="warning">
692
- <NotificationDrawerListItemHeader
693
- variant="warning"
694
- title="Warning notification title"
695
- srTitle="Warning notification:"
696
- />
697
- <NotificationDrawerListItemBody timestamp="20 minutes ago">
698
- This is a warning notification description.
699
- </NotificationDrawerListItemBody>
700
- </NotificationDrawerListItem>
701
- <NotificationDrawerListItem variant="success">
702
- <NotificationDrawerListItemHeader
703
- variant="success"
704
- title="Success notification title"
705
- srTitle="Success notification:"
706
- />
707
- <NotificationDrawerListItemBody timestamp="30 minutes ago">
708
- This is a success notification description.
709
- </NotificationDrawerListItemBody>
710
- </NotificationDrawerListItem>
711
- </NotificationDrawerList>
712
- </NotificationDrawerGroup>
713
- <NotificationDrawerGroup
714
- title="Third notification group"
715
- isExpanded={thirdGroupExpanded}
716
- count={0}
717
- isRead
718
- onExpand={this.toggleThirdDrawer}
719
- >
720
- <NotificationDrawerList isHidden={!thirdGroupExpanded}>
721
- <EmptyState variant={EmptyStateVariant.full}>
722
- <EmptyStateIcon icon={SearchIcon} />
723
- <Title headingLevel="h2" size="lg">
724
- No alerts found
725
- </Title>
726
- <EmptyStateBody>
727
- There are currently no critical alerts firing. There may be firing alerts of other severities or
728
- silenced critical alerts however.
729
- </EmptyStateBody>
730
- <EmptyStatePrimary>
731
- <Button variant="link">Action</Button>
732
- </EmptyStatePrimary>
733
- </EmptyState>
734
- </NotificationDrawerList>
735
- </NotificationDrawerGroup>
736
- </NotificationDrawerGroupList>
737
- </NotificationDrawerBody>
738
- </NotificationDrawer>
739
- );
740
- }
741
- }
36
+ ```ts file="NotificationDrawerLightweight.tsx"
742
37
  ```