@patternfly/react-core 4.158.1 → 4.159.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.
Files changed (71) hide show
  1. package/CHANGELOG.md +35 -0
  2. package/dist/esm/components/DragDrop/Draggable.d.ts.map +1 -1
  3. package/dist/esm/components/DragDrop/Draggable.js +13 -7
  4. package/dist/esm/components/DragDrop/Draggable.js.map +1 -1
  5. package/dist/esm/components/DragDrop/Droppable.d.ts.map +1 -1
  6. package/dist/esm/components/DragDrop/Droppable.js +3 -1
  7. package/dist/esm/components/DragDrop/Droppable.js.map +1 -1
  8. package/dist/esm/components/Select/Select.d.ts +3 -0
  9. package/dist/esm/components/Select/Select.d.ts.map +1 -1
  10. package/dist/esm/components/Select/Select.js +2 -1
  11. package/dist/esm/components/Select/Select.js.map +1 -1
  12. package/dist/esm/components/Select/SelectMenu.d.ts +3 -0
  13. package/dist/esm/components/Select/SelectMenu.d.ts.map +1 -1
  14. package/dist/esm/components/Select/SelectMenu.js +4 -3
  15. package/dist/esm/components/Select/SelectMenu.js.map +1 -1
  16. package/dist/esm/components/Select/selectConstants.d.ts +4 -0
  17. package/dist/esm/components/Select/selectConstants.d.ts.map +1 -1
  18. package/dist/esm/components/Select/selectConstants.js +5 -0
  19. package/dist/esm/components/Select/selectConstants.js.map +1 -1
  20. package/dist/esm/components/Tabs/Tabs.d.ts +20 -0
  21. package/dist/esm/components/Tabs/Tabs.d.ts.map +1 -1
  22. package/dist/esm/components/Tabs/Tabs.js +44 -14
  23. package/dist/esm/components/Tabs/Tabs.js.map +1 -1
  24. package/dist/esm/components/Wizard/WizardNavItem.js +1 -1
  25. package/dist/js/components/DragDrop/Draggable.d.ts.map +1 -1
  26. package/dist/js/components/DragDrop/Draggable.js +13 -7
  27. package/dist/js/components/DragDrop/Draggable.js.map +1 -1
  28. package/dist/js/components/DragDrop/Droppable.d.ts.map +1 -1
  29. package/dist/js/components/DragDrop/Droppable.js +3 -1
  30. package/dist/js/components/DragDrop/Droppable.js.map +1 -1
  31. package/dist/js/components/Select/Select.d.ts +3 -0
  32. package/dist/js/components/Select/Select.d.ts.map +1 -1
  33. package/dist/js/components/Select/Select.js +1 -0
  34. package/dist/js/components/Select/Select.js.map +1 -1
  35. package/dist/js/components/Select/SelectMenu.d.ts +3 -0
  36. package/dist/js/components/Select/SelectMenu.d.ts.map +1 -1
  37. package/dist/js/components/Select/SelectMenu.js +3 -2
  38. package/dist/js/components/Select/SelectMenu.js.map +1 -1
  39. package/dist/js/components/Select/selectConstants.d.ts +4 -0
  40. package/dist/js/components/Select/selectConstants.d.ts.map +1 -1
  41. package/dist/js/components/Select/selectConstants.js +6 -1
  42. package/dist/js/components/Select/selectConstants.js.map +1 -1
  43. package/dist/js/components/Tabs/Tabs.d.ts +20 -0
  44. package/dist/js/components/Tabs/Tabs.d.ts.map +1 -1
  45. package/dist/js/components/Tabs/Tabs.js +44 -14
  46. package/dist/js/components/Tabs/Tabs.js.map +1 -1
  47. package/dist/js/components/Wizard/WizardNavItem.js +1 -1
  48. package/dist/umd/react-core.css +13638 -13562
  49. package/dist/umd/react-core.js +104 -49
  50. package/dist/umd/react-core.min.css +10666 -10590
  51. package/dist/umd/react-core.min.js +2 -2
  52. package/package.json +6 -6
  53. package/src/components/DragDrop/Draggable.tsx +20 -11
  54. package/src/components/DragDrop/Droppable.tsx +3 -1
  55. package/src/components/Drawer/examples/Drawer.md +0 -78
  56. package/src/components/Page/examples/Page.md +289 -103
  57. package/src/components/Select/Select.tsx +4 -1
  58. package/src/components/Select/SelectMenu.tsx +10 -2
  59. package/src/components/Select/__tests__/Generated/__snapshots__/SelectMenu.test.tsx.snap +1 -0
  60. package/src/components/Select/__tests__/__snapshots__/Select.test.tsx.snap +57 -0
  61. package/src/components/Select/selectConstants.tsx +5 -0
  62. package/src/components/Sidebar/examples/Sidebar.md +6 -3
  63. package/src/components/Tabs/Tabs.tsx +97 -13
  64. package/src/components/Tabs/__tests__/Generated/__snapshots__/Tabs.test.tsx.snap +4 -4
  65. package/src/components/Tabs/__tests__/Tabs.test.tsx +50 -0
  66. package/src/components/Tabs/__tests__/__snapshots__/Tabs.test.tsx.snap +276 -30
  67. package/src/components/Tabs/examples/Tabs.md +96 -0
  68. package/src/components/Wizard/WizardNavItem.tsx +1 -1
  69. package/src/demos/CardDemos.md +443 -0
  70. package/src/demos/ComposableMenu.md +125 -17
  71. package/src/demos/Page/Page.md +322 -12
@@ -345,6 +345,102 @@ class VerticalTabs extends React.Component {
345
345
  }
346
346
  ```
347
347
 
348
+ ### Vertical expandable
349
+ ```js
350
+ import React from 'react';
351
+ import { Tabs, Tab, TabTitleText, Checkbox } from '@patternfly/react-core';
352
+ class VerticalExpandableTabs extends React.Component {
353
+ constructor(props) {
354
+ super(props);
355
+ this.state = {
356
+ activeTabKey: 0,
357
+ isExpanded: false
358
+ };
359
+ // Toggle currently active tab
360
+ this.handleTabClick = (event, tabIndex) => {
361
+ this.setState({
362
+ activeTabKey: tabIndex
363
+ });
364
+ };
365
+ this.onToggle = isExpanded => {
366
+ this.setState({
367
+ isExpanded
368
+ });
369
+ };
370
+ }
371
+ render() {
372
+ const {activeTabKey, isExpanded} = this.state;
373
+ return (
374
+ <Tabs activeKey={activeTabKey} onSelect={this.handleTabClick} isVertical expandable={{default: 'expandable', md: 'nonExpandable', lg: 'expandable'}} isExpanded={isExpanded} onToggle={this.onToggle} toggleText="Containers">
375
+ <Tab eventKey={0} title={<TabTitleText>Users</TabTitleText>}>
376
+ Users
377
+ </Tab>
378
+ <Tab eventKey={1} title={<TabTitleText>Containers</TabTitleText>}>
379
+ Containers
380
+ </Tab>
381
+ <Tab eventKey={2} title={<TabTitleText>Database</TabTitleText>}>
382
+ Database
383
+ </Tab>
384
+ <Tab eventKey={3} title={<TabTitleText>Server</TabTitleText>}>
385
+ Server
386
+ </Tab>
387
+ <Tab eventKey={4} title={<TabTitleText>System</TabTitleText>}>
388
+ System
389
+ </Tab>
390
+ <Tab eventKey={6} title={<TabTitleText>Network</TabTitleText>}>
391
+ Network
392
+ </Tab>
393
+ </Tabs>
394
+ );
395
+ }
396
+ }
397
+ ```
398
+
399
+ ### Vertical expandable uncontrolled
400
+ ```js
401
+ import React from 'react';
402
+ import { Tabs, Tab, TabTitleText, Checkbox } from '@patternfly/react-core';
403
+ class VerticalExpandableUncontrolledTabs extends React.Component {
404
+ constructor(props) {
405
+ super(props);
406
+ this.state = {
407
+ activeTabKey: 0
408
+ };
409
+ // Toggle currently active tab
410
+ this.handleTabClick = (event, tabIndex) => {
411
+ this.setState({
412
+ activeTabKey: tabIndex
413
+ });
414
+ };
415
+ }
416
+ render() {
417
+ const {activeTabKey} = this.state;
418
+ return (
419
+ <Tabs activeKey={activeTabKey} onSelect={this.handleTabClick} isVertical expandable={{default: 'expandable', md: 'nonExpandable', lg: 'expandable'}} defaultIsExpanded={false} toggleText="Containers">
420
+ <Tab eventKey={0} title={<TabTitleText>Users</TabTitleText>}>
421
+ Users
422
+ </Tab>
423
+ <Tab eventKey={1} title={<TabTitleText>Containers</TabTitleText>}>
424
+ Containers
425
+ </Tab>
426
+ <Tab eventKey={2} title={<TabTitleText>Database</TabTitleText>}>
427
+ Database
428
+ </Tab>
429
+ <Tab eventKey={3} title={<TabTitleText>Server</TabTitleText>}>
430
+ Server
431
+ </Tab>
432
+ <Tab eventKey={4} title={<TabTitleText>System</TabTitleText>}>
433
+ System
434
+ </Tab>
435
+ <Tab eventKey={6} title={<TabTitleText>Network</TabTitleText>}>
436
+ Network
437
+ </Tab>
438
+ </Tabs>
439
+ );
440
+ }
441
+ }
442
+ ```
443
+
348
444
  ### Inset
349
445
  ```js
350
446
  import React from 'react';
@@ -76,7 +76,7 @@ export const WizardNavItem: React.FunctionComponent<WizardNavItemProps> = ({
76
76
  isDisabled && styles.modifiers.disabled
77
77
  )}
78
78
  aria-disabled={isDisabled ? true : null}
79
- aria-current={isCurrent && !children ? 'page' : false}
79
+ aria-current={isCurrent && !children ? 'step' : false}
80
80
  {...(isExpandable && { 'aria-expanded': isExpanded })}
81
81
  >
82
82
  {isExpandable ? (
@@ -8,6 +8,11 @@ import ArrowRightIcon from '@patternfly/react-icons/dist/js/icons/arrow-right-ic
8
8
  import ExternalLinkAltIcon from '@patternfly/react-icons/dist/js/icons/external-link-alt-icon';
9
9
  import { CheckCircleIcon, ExclamationCircleIcon, ExclamationTriangleIcon, TimesCircleIcon, BellIcon } from '@patternfly/react-icons';
10
10
  import { TableComposable, Thead, Tbody, Tr, Th, Td, ExpandableRowContent } from '@patternfly/react-table';
11
+ import { Chart, ChartAxis, ChartGroup, ChartVoronoiContainer, ChartStack, ChartBar, ChartTooltip, ChartDonutThreshold, ChartDonutUtilization, ChartArea, ChartContainer, ChartLabel } from '@patternfly/react-charts';
12
+ import chart_color_gold_100 from '@patternfly/react-tokens/dist/esm/chart_color_gold_100';
13
+ import chart_color_gold_300 from '@patternfly/react-tokens/dist/esm/chart_color_gold_300';
14
+ import chart_color_orange_300 from '@patternfly/react-tokens/dist/esm/chart_color_orange_300';
15
+ import chart_color_red_100 from '@patternfly/react-tokens/dist/esm/chart_color_red_100';
11
16
 
12
17
  ## Demos
13
18
 
@@ -989,6 +994,444 @@ const Status: React.FunctionComponent = () => {
989
994
  };
990
995
  ```
991
996
 
997
+ ### Utilization card 1
998
+
999
+ ```ts
1000
+ import React from 'react';
1001
+ import {
1002
+ Card,
1003
+ CardTitle,
1004
+ CardBody,
1005
+ CardFooter,
1006
+ Title,
1007
+ Gallery,
1008
+ GalleryItem,
1009
+ Flex,
1010
+ FlexItem,
1011
+ Stack,
1012
+ StackItem,
1013
+ Divider
1014
+ } from '@patternfly/react-core';
1015
+ import { ChartArea, ChartContainer, ChartGroup, ChartLabel, ChartVoronoiContainer } from '@patternfly/react-charts';
1016
+
1017
+ <Gallery hasGutter minWidths={{ default: '360px' }}>
1018
+ <GalleryItem>
1019
+ <Card id="utilization-card-1" component="div">
1020
+ <CardTitle>
1021
+ <Title headingLevel="h2" size="lg">
1022
+ Top Utilized Clusters
1023
+ </Title>
1024
+ </CardTitle>
1025
+ <CardBody>
1026
+ <Flex direction={{ default: 'column' }}>
1027
+ <FlexItem>
1028
+ <Stack>
1029
+ <b>Cluster-1204</b>
1030
+ <span>27.3 cores available</span>
1031
+ </Stack>
1032
+ </FlexItem>
1033
+ <FlexItem>
1034
+ <ChartGroup
1035
+ ariaDesc="Mock average cluster utilization"
1036
+ ariaTitle="Mock cluster sparkline chart"
1037
+ containerComponent={
1038
+ <ChartVoronoiContainer labels={({ datum }) => `${datum.name}: ${datum.y}`} constrainToVisibleArea />
1039
+ }
1040
+ height={100}
1041
+ maxDomain={{ y: 9 }}
1042
+ padding={0}
1043
+ width={400}
1044
+ >
1045
+ <ChartArea
1046
+ data={[
1047
+ { name: 'Cluster', x: '2015', y: 7 },
1048
+ { name: 'Cluster', x: '2016', y: 6 },
1049
+ { name: 'Cluster', x: '2017', y: 8 },
1050
+ { name: 'Cluster', x: '2018', y: 3 },
1051
+ { name: 'Cluster', x: '2019', y: 4 },
1052
+ { name: 'Cluster', x: '2020', y: 1 },
1053
+ { name: 'Cluster', x: '2021', y: 0 }
1054
+ ]}
1055
+ />
1056
+ </ChartGroup>
1057
+ </FlexItem>
1058
+ <FlexItem>
1059
+ <a href="#">View details</a>
1060
+ </FlexItem>
1061
+ </Flex>
1062
+ </CardBody>
1063
+ <CardBody>
1064
+ <Flex direction={{ default: 'column' }}>
1065
+ <FlexItem>
1066
+ <Stack>
1067
+ <b>Abcdef-1204</b>
1068
+ <span>50.6 cores available</span>
1069
+ </Stack>
1070
+ </FlexItem>
1071
+ <FlexItem>
1072
+ <ChartGroup
1073
+ ariaDesc="Mock average cluster utilization"
1074
+ ariaTitle="Mock cluster sparkline chart"
1075
+ containerComponent={
1076
+ <ChartVoronoiContainer labels={({ datum }) => `${datum.name}: ${datum.y}`} constrainToVisibleArea />
1077
+ }
1078
+ height={100}
1079
+ maxDomain={{ y: 9 }}
1080
+ padding={0}
1081
+ width={400}
1082
+ >
1083
+ <ChartArea
1084
+ data={[
1085
+ { name: 'Cluster', x: '2015', y: 7 },
1086
+ { name: 'Cluster', x: '2016', y: 6 },
1087
+ { name: 'Cluster', x: '2017', y: 8 },
1088
+ { name: 'Cluster', x: '2018', y: 3 },
1089
+ { name: 'Cluster', x: '2019', y: 4 },
1090
+ { name: 'Cluster', x: '2020', y: 1 },
1091
+ { name: 'Cluster', x: '2021', y: 0 }
1092
+ ]}
1093
+ />
1094
+ </ChartGroup>
1095
+ </FlexItem>
1096
+ <FlexItem>
1097
+ <a href="#">View details</a>
1098
+ </FlexItem>
1099
+ </Flex>
1100
+ </CardBody>
1101
+ <Divider />
1102
+ <CardFooter>
1103
+ <a href="#">View all clusters</a>
1104
+ </CardFooter>
1105
+ </Card>
1106
+ </GalleryItem>
1107
+ </Gallery>;
1108
+ ```
1109
+
1110
+ ### Utilization card 2
1111
+
1112
+ ```ts
1113
+ import React from 'react';
1114
+ import {
1115
+ Card,
1116
+ CardTitle,
1117
+ CardBody,
1118
+ CardFooter,
1119
+ Title,
1120
+ Gallery,
1121
+ GalleryItem,
1122
+ Flex,
1123
+ FlexItem,
1124
+ Stack,
1125
+ StackItem,
1126
+ Divider
1127
+ } from '@patternfly/react-core';
1128
+ import { ChartArea, ChartContainer, ChartGroup, ChartLabel, ChartVoronoiContainer } from '@patternfly/react-charts';
1129
+
1130
+ <Gallery hasGutter minWidths={{ default: '360px' }}>
1131
+ <GalleryItem>
1132
+ <Card id="utilization-card-2" component="div">
1133
+ <CardTitle>
1134
+ <Title headingLevel="h2" size="lg">
1135
+ Top Utilized Clusters
1136
+ </Title>
1137
+ </CardTitle>
1138
+ <CardBody>
1139
+ <Flex direction={{ default: 'column' }}>
1140
+ <FlexItem>
1141
+ <Stack>
1142
+ <a href="#">Cluster-1204</a>
1143
+ <span>27.3 cores available</span>
1144
+ </Stack>
1145
+ </FlexItem>
1146
+ <FlexItem>
1147
+ <ChartGroup
1148
+ ariaDesc="Mock average cluster utilization"
1149
+ ariaTitle="Mock cluster sparkline chart"
1150
+ containerComponent={
1151
+ <ChartVoronoiContainer labels={({ datum }) => `${datum.name}: ${datum.y}`} constrainToVisibleArea />
1152
+ }
1153
+ height={100}
1154
+ maxDomain={{ y: 9 }}
1155
+ padding={0}
1156
+ width={400}
1157
+ >
1158
+ <ChartArea
1159
+ data={[
1160
+ { name: 'Cluster', x: '2015', y: 7 },
1161
+ { name: 'Cluster', x: '2016', y: 6 },
1162
+ { name: 'Cluster', x: '2017', y: 8 },
1163
+ { name: 'Cluster', x: '2018', y: 3 },
1164
+ { name: 'Cluster', x: '2019', y: 4 },
1165
+ { name: 'Cluster', x: '2020', y: 1 },
1166
+ { name: 'Cluster', x: '2021', y: 0 }
1167
+ ]}
1168
+ />
1169
+ </ChartGroup>
1170
+ </FlexItem>
1171
+ </Flex>
1172
+ </CardBody>
1173
+ <CardBody>
1174
+ <Flex direction={{ default: 'column' }}>
1175
+ <FlexItem>
1176
+ <Stack>
1177
+ <a href="#">Abcdef-1204</a>
1178
+ <span>50.6 cores available</span>
1179
+ </Stack>
1180
+ </FlexItem>
1181
+ <FlexItem>
1182
+ <ChartGroup
1183
+ ariaDesc="Mock average cluster utilization"
1184
+ ariaTitle="Mock cluster sparkline chart"
1185
+ containerComponent={
1186
+ <ChartVoronoiContainer labels={({ datum }) => `${datum.name}: ${datum.y}`} constrainToVisibleArea />
1187
+ }
1188
+ height={100}
1189
+ maxDomain={{ y: 9 }}
1190
+ padding={0}
1191
+ width={400}
1192
+ >
1193
+ <ChartArea
1194
+ data={[
1195
+ { name: 'Cluster', x: '2015', y: 7 },
1196
+ { name: 'Cluster', x: '2016', y: 6 },
1197
+ { name: 'Cluster', x: '2017', y: 8 },
1198
+ { name: 'Cluster', x: '2018', y: 3 },
1199
+ { name: 'Cluster', x: '2019', y: 4 },
1200
+ { name: 'Cluster', x: '2020', y: 1 },
1201
+ { name: 'Cluster', x: '2021', y: 0 }
1202
+ ]}
1203
+ />
1204
+ </ChartGroup>
1205
+ </FlexItem>
1206
+ </Flex>
1207
+ </CardBody>
1208
+ <Divider />
1209
+ <CardFooter>
1210
+ <a href="#">View all clusters</a>
1211
+ </CardFooter>
1212
+ </Card>
1213
+ </GalleryItem>
1214
+ </Gallery>;
1215
+ ```
1216
+
1217
+ ### Utilization card 3
1218
+
1219
+ ```ts
1220
+ import React from 'react';
1221
+ import {
1222
+ Card,
1223
+ CardTitle,
1224
+ CardHeader,
1225
+ CardActions,
1226
+ CardBody,
1227
+ CardFooter,
1228
+ Title,
1229
+ Gallery,
1230
+ GalleryItem,
1231
+ Flex,
1232
+ FlexItem,
1233
+ Stack,
1234
+ StackItem,
1235
+ Divider,
1236
+ Dropdown,
1237
+ DropdownItem,
1238
+ DropdownToggle,
1239
+ DropdownSeparator
1240
+ } from '@patternfly/react-core';
1241
+ import ExclamationCircleIcon from '@patternfly/react-icons/dist/esm/icons/exclamation-circle-icon';
1242
+ import { Chart, ChartStack, ChartBar, ChartTooltip } from '@patternfly/react-charts';
1243
+ import chart_color_gold_100 from '@patternfly/react-tokens/dist/esm/chart_color_gold_100';
1244
+ import chart_color_gold_300 from '@patternfly/react-tokens/dist/esm/chart_color_gold_300';
1245
+ import chart_color_orange_300 from '@patternfly/react-tokens/dist/esm/chart_color_orange_300';
1246
+ import chart_color_red_100 from '@patternfly/react-tokens/dist/esm/chart_color_red_100';
1247
+
1248
+ const UtilizationCard3: React.FunctionComponent = () => {
1249
+ const [isOpen, setIsOpen] = React.useState(false);
1250
+
1251
+ const dropdownItems = [
1252
+ <DropdownItem key="link">Link</DropdownItem>,
1253
+ <DropdownItem key="action" component="button">
1254
+ Action
1255
+ </DropdownItem>,
1256
+ <DropdownItem key="disabled link" isDisabled href="www.google.com">
1257
+ Disabled link
1258
+ </DropdownItem>,
1259
+ <DropdownSeparator key="separator" />,
1260
+ <DropdownItem key="separated link">Separated link</DropdownItem>
1261
+ ];
1262
+
1263
+ return (
1264
+ <Gallery hasGutter minWidths={{ default: '360px' }}>
1265
+ <GalleryItem>
1266
+ <Card id="utilization-card-1" component="div">
1267
+ <CardHeader>
1268
+ <CardTitle>
1269
+ <Title headingLevel="h2" size="lg">
1270
+ Recommendations
1271
+ </Title>
1272
+ </CardTitle>
1273
+ <CardActions>
1274
+ <Dropdown
1275
+ onSelect={() => setIsOpen(!isOpen)}
1276
+ toggle={<DropdownToggle onToggle={() => setIsOpen(!isOpen)}>Filter</DropdownToggle>}
1277
+ isOpen={isOpen}
1278
+ dropdownItems={dropdownItems}
1279
+ position="right"
1280
+ />
1281
+ </CardActions>
1282
+ </CardHeader>
1283
+ <CardBody>
1284
+ <Flex direction={{ default: 'column' }}>
1285
+ <FlexItem>
1286
+ <span>System</span>
1287
+ </FlexItem>
1288
+ <Flex>
1289
+ <ExclamationCircleIcon className="pf-u-danger-color-100" aria-hidden />
1290
+ <a href="#">25 incidents detected</a>
1291
+ </Flex>
1292
+ <FlexItem>
1293
+ <Chart
1294
+ ariaDesc="Mock incidents chart"
1295
+ ariaTitle="Mock stack chart"
1296
+ domainPadding={{ x: [30, 25] }}
1297
+ legendData={[
1298
+ { name: 'Low', symbol: { fill: chart_color_gold_100.value } },
1299
+ { name: 'Important', symbol: { fill: chart_color_gold_300.value } },
1300
+ { name: 'Moderate', symbol: { fill: chart_color_orange_300.value } },
1301
+ { name: 'Critical', symbol: { fill: chart_color_red_100.value } }
1302
+ ]}
1303
+ legendPosition="bottom-left"
1304
+ height={50}
1305
+ padding={{
1306
+ bottom: 40,
1307
+ left: 0,
1308
+ right: 0,
1309
+ top: 0
1310
+ }}
1311
+ width={350}
1312
+ showAxis={false}
1313
+ >
1314
+ <ChartStack
1315
+ horizontal
1316
+ colorScale={[
1317
+ chart_color_gold_100.value,
1318
+ chart_color_gold_300.value,
1319
+ chart_color_orange_300.value,
1320
+ chart_color_red_100.value
1321
+ ]}
1322
+ >
1323
+ <ChartBar
1324
+ data={[
1325
+ {
1326
+ name: 'Low',
1327
+ x: 'Cluster A',
1328
+ y: 6,
1329
+ label: 'Low: 6'
1330
+ }
1331
+ ]}
1332
+ labelComponent={<ChartTooltip constrainToVisibleArea />}
1333
+ />
1334
+ <ChartBar
1335
+ data={[
1336
+ {
1337
+ name: 'Important',
1338
+ x: 'Cluster A',
1339
+ y: 2,
1340
+ label: 'Important: 2'
1341
+ }
1342
+ ]}
1343
+ labelComponent={<ChartTooltip constrainToVisibleArea />}
1344
+ />
1345
+ <ChartBar
1346
+ data={[
1347
+ {
1348
+ name: 'Moderate',
1349
+ x: 'Cluster A',
1350
+ y: 4,
1351
+ label: 'Moderate: 4'
1352
+ }
1353
+ ]}
1354
+ labelComponent={<ChartTooltip constrainToVisibleArea />}
1355
+ />
1356
+ <ChartBar
1357
+ data={[
1358
+ {
1359
+ name: 'Critical',
1360
+ x: 'Cluster A',
1361
+ y: 2,
1362
+ label: 'Critical: 2'
1363
+ }
1364
+ ]}
1365
+ labelComponent={<ChartTooltip constrainToVisibleArea />}
1366
+ />
1367
+ </ChartStack>
1368
+ </Chart>
1369
+ </FlexItem>
1370
+ </Flex>
1371
+ </CardBody>
1372
+ <CardFooter>
1373
+ <a href="#">See details</a>
1374
+ </CardFooter>
1375
+ </Card>
1376
+ </GalleryItem>
1377
+ </Gallery>
1378
+ );
1379
+ };
1380
+ ```
1381
+
1382
+ ### Utilization card 4
1383
+
1384
+ ```ts
1385
+ import React from 'react';
1386
+ import { Card, CardTitle, CardBody, CardFooter, Title, Gallery, GalleryItem } from '@patternfly/react-core';
1387
+ import { ChartDonutThreshold, ChartDonutUtilization } from '@patternfly/react-charts';
1388
+
1389
+ <Gallery hasGutter minWidths={{ default: '360px' }}>
1390
+ <GalleryItem>
1391
+ <Card id="utilization-card-1" component="div">
1392
+ <CardTitle>
1393
+ <Title headingLevel="h2" size="lg">
1394
+ CPU Usage
1395
+ </Title>
1396
+ </CardTitle>
1397
+ <CardBody>
1398
+ <ChartDonutThreshold
1399
+ ariaDesc="Mock storage capacity"
1400
+ ariaTitle="Mock donut utilization chart"
1401
+ constrainToVisibleArea={true}
1402
+ data={[
1403
+ { x: 'Warning at 60%', y: 60 },
1404
+ { x: 'Danger at 90%', y: 90 }
1405
+ ]}
1406
+ height={200}
1407
+ labels={({ datum }) => (datum.x ? datum.x : null)}
1408
+ padding={{
1409
+ bottom: 0,
1410
+ left: 10,
1411
+ right: 150,
1412
+ top: 0
1413
+ }}
1414
+ width={350}
1415
+ >
1416
+ <ChartDonutUtilization
1417
+ data={{ x: 'Storage capacity', y: 80 }}
1418
+ labels={({ datum }) => (datum.x ? `${datum.x}: ${datum.y}%` : null)}
1419
+ legendData={[{ name: `Capacity: 80%` }, { name: 'Warning at 60%' }, { name: 'Danger at 90%' }]}
1420
+ legendOrientation="vertical"
1421
+ title="80%"
1422
+ subTitle="of 100 GBps"
1423
+ thresholds={[{ value: 60 }, { value: 90 }]}
1424
+ />
1425
+ </ChartDonutThreshold>{' '}
1426
+ </CardBody>
1427
+ <CardFooter>
1428
+ <a href="#">See details</a>
1429
+ </CardFooter>
1430
+ </Card>
1431
+ </GalleryItem>
1432
+ </Gallery>;
1433
+ ```
1434
+
992
1435
  ### Log view
993
1436
 
994
1437
  ```js