@patternfly/react-core 4.263.0 → 4.264.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 (54) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/dist/esm/components/Tabs/Tab.d.ts +4 -2
  3. package/dist/esm/components/Tabs/Tab.d.ts.map +1 -1
  4. package/dist/esm/components/Tabs/Tab.js +6 -7
  5. package/dist/esm/components/Tabs/Tab.js.map +1 -1
  6. package/dist/esm/components/Tabs/TabAction.d.ts +20 -0
  7. package/dist/esm/components/Tabs/TabAction.d.ts.map +1 -0
  8. package/dist/esm/components/Tabs/TabAction.js +17 -0
  9. package/dist/esm/components/Tabs/TabAction.js.map +1 -0
  10. package/dist/esm/components/Tabs/Tabs.d.ts +1 -1
  11. package/dist/esm/components/Tabs/Tabs.d.ts.map +1 -1
  12. package/dist/esm/components/Tabs/index.d.ts +1 -0
  13. package/dist/esm/components/Tabs/index.d.ts.map +1 -1
  14. package/dist/esm/components/Tabs/index.js +1 -0
  15. package/dist/esm/components/Tabs/index.js.map +1 -1
  16. package/dist/js/components/Tabs/Tab.d.ts +4 -2
  17. package/dist/js/components/Tabs/Tab.d.ts.map +1 -1
  18. package/dist/js/components/Tabs/Tab.js +6 -7
  19. package/dist/js/components/Tabs/Tab.js.map +1 -1
  20. package/dist/js/components/Tabs/TabAction.d.ts +20 -0
  21. package/dist/js/components/Tabs/TabAction.d.ts.map +1 -0
  22. package/dist/js/components/Tabs/TabAction.js +20 -0
  23. package/dist/js/components/Tabs/TabAction.js.map +1 -0
  24. package/dist/js/components/Tabs/Tabs.d.ts +1 -1
  25. package/dist/js/components/Tabs/Tabs.d.ts.map +1 -1
  26. package/dist/js/components/Tabs/index.d.ts +1 -0
  27. package/dist/js/components/Tabs/index.d.ts.map +1 -1
  28. package/dist/js/components/Tabs/index.js +1 -0
  29. package/dist/js/components/Tabs/index.js.map +1 -1
  30. package/dist/styles/assets/pficon/pficon.scss +12 -0
  31. package/dist/styles/assets/pficon/pficon.woff +0 -0
  32. package/dist/styles/assets/pficon/pficon.woff2 +0 -0
  33. package/dist/styles/base-no-reset.css +10 -0
  34. package/dist/styles/base.css +10 -0
  35. package/dist/umd/react-core.min.css +947 -778
  36. package/dist/umd/react-core.min.js +1 -1
  37. package/package.json +6 -6
  38. package/src/components/Tabs/Tab.tsx +17 -16
  39. package/src/components/Tabs/TabAction.tsx +57 -0
  40. package/src/components/Tabs/Tabs.tsx +1 -1
  41. package/src/components/Tabs/__tests__/Tab.test.tsx +10 -0
  42. package/src/components/Tabs/__tests__/__snapshots__/Tab.test.tsx.snap +45 -0
  43. package/src/components/Tabs/examples/Tabs.md +64 -20
  44. package/src/components/Tabs/examples/TabsHelp.tsx +61 -0
  45. package/src/components/Tabs/examples/TabsHelpAndClose.tsx +84 -0
  46. package/src/components/Tabs/index.ts +1 -0
  47. package/src/demos/Tabs.md +0 -10
  48. package/src/demos/examples/DashboardWrapper.js +1 -0
  49. package/src/demos/examples/Tabs/ModalTabs.tsx +3 -3
  50. package/src/demos/examples/Tabs/NestedTabs.tsx +11 -3
  51. package/src/demos/examples/Tabs/NestedUnindentedTabs.tsx +25 -40
  52. package/src/demos/examples/Tabs/TabsAndTable.tsx +9 -52
  53. package/src/demos/examples/Tabs/GrayTabs.tsx +0 -152
  54. package/src/demos/examples/Tabs/TabsAndTablesAutoWidthTabs.tsx +0 -442
@@ -14,7 +14,8 @@ import {
14
14
  Title,
15
15
  Text,
16
16
  TextContent,
17
- TitleSizes
17
+ TitleSizes,
18
+ CardTitle
18
19
  } from '@patternfly/react-core';
19
20
  import DashboardWrapper from '@patternfly/react-core/src/demos/examples/DashboardWrapper';
20
21
 
@@ -32,7 +33,7 @@ export const NestedUnindentedTabs: React.FunctionComponent = () => {
32
33
  <Grid hasGutter>
33
34
  <GridItem>
34
35
  <CardHeader>
35
- <Title headingLevel="h1" size={TitleSizes['2xl']}>
36
+ <Title headingLevel="h1" size={TitleSizes.lg}>
36
37
  Get started with Red Hat Enterprise Linux
37
38
  </Title>
38
39
  </CardHeader>
@@ -41,6 +42,7 @@ export const NestedUnindentedTabs: React.FunctionComponent = () => {
41
42
  <Tabs
42
43
  activeKey={activeNestedTabKey}
43
44
  isSecondary
45
+ hasSecondaryBorderBottom
44
46
  onSelect={(_event, tabIndex) => handleNestedTabClick(Number(tabIndex))}
45
47
  id="nested-tabs-example-nested-tabs-list"
46
48
  >
@@ -68,42 +70,26 @@ export const NestedUnindentedTabs: React.FunctionComponent = () => {
68
70
  </TextContent>
69
71
  </GridItem>
70
72
  <Grid md={6} xl2={3} hasGutter>
71
- <GridItem>
72
- <Card isFullHeight>
73
- <CardHeader>Check system requirements</CardHeader>
74
- <CardBody>
75
- Your physical or virtual machine should meet the <a href="#">system requirement</a>.
76
- </CardBody>
77
- </Card>
78
- </GridItem>
79
-
80
- <GridItem>
81
- <Card isFullHeight>
82
- <CardHeader>Download an installation ISO image</CardHeader>
83
- <CardBody>
84
- {' '}
85
- <a href="#">Download</a> the binary DVD ISO.
86
- </CardBody>
87
- </Card>
88
- </GridItem>
89
- <GridItem>
90
- <Card isFullHeight>
91
- <CardHeader>Create a bootable installation media</CardHeader>
92
- <CardBody>
93
- {' '}
94
- <a href="#">Create</a> a bootable installation media, for example a USB flash drive.
95
- </CardBody>
96
- </Card>
97
- </GridItem>
98
- <GridItem>
99
- <Card isFullHeight>
100
- <CardHeader>Install and register your system</CardHeader>
101
- <CardBody>
102
- Boot the installation, register your system, attach RHEL subscriptions, and install RHEL from the
103
- Red Hat Content Delivery Network (CDN) using the GUI.
104
- </CardBody>
105
- </Card>
106
- </GridItem>
73
+ <Card isFlat component="div">
74
+ <CardTitle>Check system requirements</CardTitle>
75
+ <CardBody>
76
+ Your physical or virtual machine should meet the <a href="#">system requirement</a>.
77
+ </CardBody>
78
+ </Card>
79
+ <Card isFlat component="div">
80
+ <CardTitle>Download an installation ISO image</CardTitle>
81
+ <CardBody>
82
+ {' '}
83
+ <a href="#">Download</a> the binary DVD ISO.
84
+ </CardBody>
85
+ </Card>
86
+ <Card isFlat component="div">
87
+ <CardTitle>Create a bootable installation media</CardTitle>
88
+ <CardBody>
89
+ {' '}
90
+ <a href="#">Create</a> a bootable installation media, for example a USB flash drive.
91
+ </CardBody>
92
+ </Card>
107
93
  </Grid>
108
94
  </Grid>
109
95
  </TabContentBody>
@@ -143,7 +129,6 @@ export const NestedUnindentedTabs: React.FunctionComponent = () => {
143
129
  <DashboardWrapper hasPageTemplateTitle>
144
130
  <PageSection type="tabs" isWidthLimited variant="light">
145
131
  <Tabs
146
- isBox
147
132
  activeKey={activeTabKey}
148
133
  onSelect={(_event, tabIndex) => handleTabClick(Number(tabIndex))}
149
134
  usePageInsets
@@ -155,7 +140,7 @@ export const NestedUnindentedTabs: React.FunctionComponent = () => {
155
140
  <Tab eventKey={3} title={<TabTitleText>Support</TabTitleText>} tabContentId={`tabContent${3}`} />
156
141
  </Tabs>
157
142
  </PageSection>
158
- <PageSection variant="light">
143
+ <PageSection isWidthLimited variant="light">
159
144
  <TabContent key={0} eventKey={0} id={`tabContent${0}`} activeKey={activeTabKey} hidden={0 !== activeTabKey}>
160
145
  <TabContentBody>What's new panel</TabContentBody>
161
146
  </TabContent>
@@ -26,8 +26,6 @@ import {
26
26
  OverflowMenuItem,
27
27
  PageSection,
28
28
  PageSectionVariants,
29
- Pagination,
30
- PaginationVariant,
31
29
  Progress,
32
30
  ProgressSize,
33
31
  Select,
@@ -70,13 +68,6 @@ interface Repository {
70
68
  }
71
69
 
72
70
  export const TablesAndTabs = () => {
73
- // tab properties
74
- const [activeTabKey, setActiveTabKey] = React.useState<number>(0);
75
- // Toggle currently active tab
76
- const handleTabClick = (tabIndex: number) => {
77
- setActiveTabKey(tabIndex);
78
- };
79
-
80
71
  // secondary tab properties
81
72
  const [secondaryActiveTabKey, setSecondaryActiveTabKey] = React.useState<number>(10);
82
73
  const handleSecondaryTabClick = (tabIndex: number) => {
@@ -84,7 +75,7 @@ export const TablesAndTabs = () => {
84
75
  };
85
76
 
86
77
  // drawer properties
87
- const [isExpanded, setIsExpanded] = React.useState<boolean>(false);
78
+ const [isExpanded, setIsExpanded] = React.useState<boolean>(true);
88
79
 
89
80
  // table properties
90
81
  // In real usage, this data would come from some external source like an API via props.
@@ -116,7 +107,7 @@ export const TablesAndTabs = () => {
116
107
  const allRowsSelected = selectedRepoNames.length === repositories.length;
117
108
  const isRepoSelected = (repo: Repository) => selectedRepoNames.includes(repo.name);
118
109
 
119
- const [rowClicked, setRowClicked] = React.useState<string>(null);
110
+ const [rowClicked, setRowClicked] = React.useState<string>('Node 1');
120
111
  const isRowClicked = (repo: Repository) => rowClicked === repo.name;
121
112
 
122
113
  const defaultActions: IAction[] = [
@@ -204,15 +195,6 @@ export const TablesAndTabs = () => {
204
195
  />
205
196
  </OverflowMenuControl>
206
197
  </OverflowMenu>
207
- <ToolbarItem variant="pagination">
208
- <Pagination
209
- itemCount={36}
210
- widgetId="pagination-options-menu-bottom"
211
- page={1}
212
- variant={PaginationVariant.top}
213
- isCompact
214
- />
215
- </ToolbarItem>
216
198
  </ToolbarContent>
217
199
  </Toolbar>
218
200
  );
@@ -239,8 +221,8 @@ export const TablesAndTabs = () => {
239
221
  <Tr
240
222
  key={repo.name}
241
223
  onRowClick={event => {
242
- if ((event.target as HTMLInputElement).type !== 'checkbox') {
243
- setRowClicked(rowClicked === repo.name ? null : repo.name);
224
+ if ((event?.target as HTMLInputElement).type !== 'checkbox') {
225
+ setRowClicked(rowClicked === repo.name ? '' : repo.name);
244
226
  setIsExpanded(!isRowClicked(repo));
245
227
  }
246
228
  }}
@@ -301,7 +283,7 @@ export const TablesAndTabs = () => {
301
283
  <DrawerActions>
302
284
  <DrawerCloseButton
303
285
  onClick={() => {
304
- setRowClicked(null);
286
+ setRowClicked('');
305
287
  setIsExpanded(false);
306
288
  }}
307
289
  />
@@ -383,18 +365,7 @@ export const TablesAndTabs = () => {
383
365
  const tabContent = (
384
366
  <Drawer isExpanded={isExpanded} isInline>
385
367
  <DrawerContent panelContent={panelContent}>
386
- <DrawerContentBody>
387
- {toolbar}
388
- <Divider />
389
- {tableComposable}
390
- <Pagination
391
- id="page-layout-table-column-management-action-toolbar-bottom"
392
- itemCount={36}
393
- widgetId="pagination-options-menu-bottom"
394
- page={1}
395
- variant={PaginationVariant.bottom}
396
- />
397
- </DrawerContentBody>
368
+ <DrawerContentBody>{tableComposable}</DrawerContentBody>
398
369
  </DrawerContent>
399
370
  </Drawer>
400
371
  );
@@ -407,24 +378,10 @@ export const TablesAndTabs = () => {
407
378
  Nodes
408
379
  </Title>
409
380
  </PageSection>
410
- <PageSection type="tabs" variant={PageSectionVariants.light} padding={{ default: 'noPadding' }}>
411
- <Tabs
412
- activeKey={activeTabKey}
413
- onSelect={(_event, tabIndex) => handleTabClick(Number(tabIndex))}
414
- usePageInsets
415
- id="tabs-table-tabs-list"
416
- >
417
- <Tab eventKey={0} title={<TabTitleText>Nodes</TabTitleText>} tabContentId={`tabContent${0}`} />
418
- <Tab eventKey={1} title={<TabTitleText>Node connectors</TabTitleText>} tabContentId={`tabContent${1}`} />
419
- </Tabs>
420
- </PageSection>
421
381
  <PageSection variant={PageSectionVariants.light} padding={{ default: 'noPadding' }}>
422
- <TabContent key={0} eventKey={0} id={`tabContent${0}`} activeKey={activeTabKey} hidden={0 !== activeTabKey}>
423
- <TabContentBody>{tabContent}</TabContentBody>
424
- </TabContent>
425
- <TabContent key={1} eventKey={1} id={`tabContent${1}`} activeKey={activeTabKey} hidden={1 !== activeTabKey}>
426
- <TabContentBody>Node connectors panel</TabContentBody>
427
- </TabContent>
382
+ {toolbar}
383
+ <Divider />
384
+ {tabContent}
428
385
  </PageSection>
429
386
  </React.Fragment>
430
387
  </DashboardWrapper>
@@ -1,152 +0,0 @@
1
- import React from 'react';
2
- import {
3
- PageSection,
4
- Tabs,
5
- Tab,
6
- TabContent,
7
- TabContentBody,
8
- TabTitleText,
9
- Title,
10
- Grid,
11
- GridItem,
12
- Flex,
13
- FlexItem,
14
- Card,
15
- CardBody,
16
- CardHeader
17
- } from '@patternfly/react-core';
18
- import DashboardWrapper from '@patternfly/react-core/src/demos/examples/DashboardWrapper';
19
-
20
- export const GrayTabsDemo: React.FunctionComponent = () => {
21
- const [activeTabKey, setActiveTabKey] = React.useState<string | number>(0);
22
- const [activeNestedTabKey, setActiveNestedTabKey] = React.useState<string | number>(0);
23
-
24
- // Toggle currently active tab
25
- const handleTabClick = (_: React.MouseEvent, tabIndex: string | number) => setActiveTabKey(tabIndex);
26
-
27
- // Toggle currently active nested tab
28
- const handleNestedTabClick = (_: React.MouseEvent, tabIndex: string | number) => setActiveNestedTabKey(tabIndex);
29
-
30
- const tabContent = (
31
- <Grid hasGutter>
32
- <GridItem xl={8} md={6}>
33
- <Card>
34
- <CardHeader>
35
- <Title headingLevel="h2">Status</Title>
36
- </CardHeader>
37
- <CardBody>
38
- <Flex direction={{ default: 'column' }}>
39
- <FlexItem>
40
- <Tabs
41
- activeKey={activeNestedTabKey}
42
- isSecondary
43
- onSelect={handleNestedTabClick}
44
- id="nested-tabs-example-tabs-list"
45
- >
46
- <Tab eventKey={10} title={<TabTitleText>Cluster</TabTitleText>} tabContentId={`tabContent${10}`} />
47
- <Tab
48
- eventKey={11}
49
- title={<TabTitleText>Control plane</TabTitleText>}
50
- tabContentId={`tabContent${11}`}
51
- />
52
- <Tab eventKey={12} title={<TabTitleText>Operators</TabTitleText>} tabContentId={`tabContent${12}`} />
53
- <Tab
54
- eventKey={13}
55
- title={<TabTitleText>Virtualization</TabTitleText>}
56
- tabContentId={`tabContent${13}`}
57
- />
58
- </Tabs>
59
- </FlexItem>
60
- <FlexItem>
61
- <TabContent
62
- key={10}
63
- eventKey={10}
64
- id={`tabContent${10}`}
65
- activeKey={activeNestedTabKey}
66
- hidden={10 !== activeNestedTabKey}
67
- >
68
- <TabContentBody>
69
- {
70
- 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce in odio porttitor, feugiat risus in, feugiat arcu. Nullam euismod enim eget fringilla condimentum. Maecenas tincidunt et metus id aliquet. Integer et fermentum purus. Nulla tempor velit arcu, vitae semper purus iaculis at. Sed malesuada auctor luctus. Pellentesque et leo urna. Aliquam vitae felis congue lacus mattis fringilla. Nullam et ultricies erat, sed dignissim elit. Cras mattis pulvinar aliquam. In ac est nulla. Pellentesque fermentum nibh ac sapien porta, ut congue orci aliquam. Sed nisl est, tempor eu pharetra eget, ullamcorper ut augue. Vestibulum eleifend libero eu nulla cursus lacinia.'
71
- }
72
- </TabContentBody>
73
- </TabContent>
74
- <TabContent
75
- key={11}
76
- eventKey={11}
77
- id={`tabContent${11}`}
78
- activeKey={activeNestedTabKey}
79
- hidden={11 !== activeNestedTabKey}
80
- >
81
- <TabContentBody>Control plane panel</TabContentBody>
82
- </TabContent>
83
- <TabContent
84
- key={12}
85
- eventKey={12}
86
- id={`tabContent${12}`}
87
- activeKey={activeNestedTabKey}
88
- hidden={12 !== activeNestedTabKey}
89
- >
90
- <TabContentBody>Operators panel</TabContentBody>
91
- </TabContent>
92
- <TabContent
93
- key={13}
94
- eventKey={13}
95
- id={`tabContent${13}`}
96
- activeKey={activeNestedTabKey}
97
- hidden={13 !== activeNestedTabKey}
98
- >
99
- <TabContentBody>Virtualization panel</TabContentBody>
100
- </TabContent>
101
- </FlexItem>
102
- </Flex>
103
- </CardBody>
104
- </Card>
105
- </GridItem>
106
- <GridItem xl={4} md={6}>
107
- <Flex direction={{ default: 'column' }} className="pf-u-h-100">
108
- <FlexItem flex={{ default: 'flex_1' }}>
109
- <Card isFullHeight>
110
- <CardHeader>
111
- <Title headingLevel="h2">Title of Card</Title>
112
- </CardHeader>
113
- </Card>
114
- </FlexItem>
115
- <FlexItem flex={{ default: 'flex_1' }}>
116
- <Card isFullHeight>
117
- <CardHeader>
118
- <Title headingLevel="h2">Title of Card</Title>
119
- </CardHeader>
120
- </Card>
121
- </FlexItem>
122
- </Flex>
123
- </GridItem>
124
- </Grid>
125
- );
126
-
127
- return (
128
- <DashboardWrapper hasPageTemplateTitle>
129
- <PageSection type="tabs" isWidthLimited>
130
- <Tabs
131
- activeKey={activeTabKey}
132
- onSelect={handleTabClick}
133
- usePageInsets
134
- isBox
135
- variant="light300"
136
- id="open-tabs-example-tabs-list"
137
- >
138
- <Tab eventKey={0} title={<TabTitleText>Cluster 1</TabTitleText>} tabContentId={`tabContent${0}`} />
139
- <Tab eventKey={1} title={<TabTitleText>Cluster 2</TabTitleText>} tabContentId={`tabContent${1}`} />
140
- </Tabs>
141
- </PageSection>
142
- <PageSection isWidthLimited>
143
- <TabContent key={0} eventKey={0} id={`tabContent${0}`} activeKey={activeTabKey} hidden={0 !== activeTabKey}>
144
- <TabContentBody>{tabContent}</TabContentBody>
145
- </TabContent>
146
- <TabContent key={1} eventKey={1} id={`tabContent${1}`} activeKey={activeTabKey} hidden={1 !== activeTabKey}>
147
- <TabContentBody>Cluster 2 panel</TabContentBody>
148
- </TabContent>
149
- </PageSection>
150
- </DashboardWrapper>
151
- );
152
- };