@patternfly/react-core 4.203.2 → 4.205.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@patternfly/react-core",
3
- "version": "4.203.2",
3
+ "version": "4.205.1",
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",
@@ -34,16 +34,16 @@
34
34
  "generate": "node scripts/copyStyles.js"
35
35
  },
36
36
  "dependencies": {
37
- "@patternfly/react-icons": "^4.54.2",
38
- "@patternfly/react-styles": "^4.53.2",
39
- "@patternfly/react-tokens": "^4.55.2",
37
+ "@patternfly/react-icons": "^4.56.1",
38
+ "@patternfly/react-styles": "^4.55.1",
39
+ "@patternfly/react-tokens": "^4.57.1",
40
40
  "focus-trap": "6.2.2",
41
41
  "react-dropzone": "9.0.0",
42
42
  "tippy.js": "5.1.2",
43
43
  "tslib": "^2.0.0"
44
44
  },
45
45
  "devDependencies": {
46
- "@patternfly/patternfly": "4.190.0",
46
+ "@patternfly/patternfly": "4.192.0",
47
47
  "@rollup/plugin-commonjs": "^21.0.0",
48
48
  "@rollup/plugin-node-resolve": "^13.0.0",
49
49
  "@rollup/plugin-replace": "^3.0.0",
@@ -60,5 +60,5 @@
60
60
  "react": "^16.8.0 || ^17.0.0",
61
61
  "react-dom": "^16.8.0 || ^17.0.0"
62
62
  },
63
- "gitHead": "ca5c716646e391e92b954b9cb3bbbe52b16834b7"
63
+ "gitHead": "4d73b9030cf92b075c46a0eeab561d47070bec50"
64
64
  }
@@ -22,13 +22,11 @@ export interface ProgressStepProps
22
22
  description?: string;
23
23
  /** ID of the title of the progress step. */
24
24
  titleId?: string;
25
- /** Popover for a progress step. */
26
- popover?: React.ReactNode;
27
- /** @hide Forwarded reference to title container */
28
- innerRef?: React.Ref<any>;
29
25
  /** Accessible label for the progress step. Should communicate all information being communicated by the progress
30
26
  * step's icon, including the variant and the completed status. */
31
27
  'aria-label'?: string;
28
+ /** Forwards the step ref to rendered function. Use this prop to add a popover to the step.*/
29
+ popoverRender?: (stepRef: React.RefObject<any>) => React.ReactNode;
32
30
  }
33
31
 
34
32
  const variantIcons = {
@@ -49,7 +47,7 @@ const variantStyle = {
49
47
  danger: styles.modifiers.danger
50
48
  };
51
49
 
52
- const ProgressStepBase: React.FunctionComponent<ProgressStepProps> = ({
50
+ export const ProgressStep: React.FunctionComponent<ProgressStepProps> = ({
53
51
  children,
54
52
  className,
55
53
  variant,
@@ -57,13 +55,13 @@ const ProgressStepBase: React.FunctionComponent<ProgressStepProps> = ({
57
55
  description,
58
56
  icon,
59
57
  titleId,
60
- popover,
61
- innerRef,
62
58
  'aria-label': ariaLabel,
59
+ popoverRender,
63
60
  ...props
64
61
  }: ProgressStepProps) => {
65
62
  const _icon = icon !== undefined ? icon : variantIcons[variant];
66
- const Component = popover !== undefined ? 'span' : 'div';
63
+ const Component = popoverRender !== undefined ? 'span' : 'div';
64
+ const stepRef = React.useRef();
67
65
 
68
66
  if (props.id === undefined || titleId === undefined) {
69
67
  /* eslint-disable no-console */
@@ -89,14 +87,14 @@ const ProgressStepBase: React.FunctionComponent<ProgressStepProps> = ({
89
87
  </div>
90
88
  <div className={css(styles.progressStepperStepMain)}>
91
89
  <Component
92
- className={css(styles.progressStepperStepTitle, popover && styles.modifiers.helpText)}
90
+ className={css(styles.progressStepperStepTitle, popoverRender && styles.modifiers.helpText)}
93
91
  id={titleId}
94
- ref={innerRef}
95
- {...(popover && { tabIndex: 0, role: 'button', type: 'button' })}
92
+ ref={stepRef}
93
+ {...(popoverRender && { tabIndex: 0, role: 'button', type: 'button' })}
96
94
  {...(props.id !== undefined && titleId !== undefined && { 'aria-labelledby': `${props.id} ${titleId}` })}
97
95
  >
98
96
  {children}
99
- {popover}
97
+ {popoverRender && popoverRender(stepRef)}
100
98
  </Component>
101
99
  {description && <div className={css(styles.progressStepperStepDescription)}>{description}</div>}
102
100
  </div>
@@ -104,7 +102,4 @@ const ProgressStepBase: React.FunctionComponent<ProgressStepProps> = ({
104
102
  );
105
103
  };
106
104
 
107
- export const ProgressStep = React.forwardRef((props: ProgressStepProps, ref: React.Ref<HTMLSpanElement>) => (
108
- <ProgressStepBase innerRef={ref} {...props} />
109
- ));
110
105
  ProgressStep.displayName = 'ProgressStep';
@@ -87,7 +87,7 @@ describe('ProgressStep', () => {
87
87
  });
88
88
 
89
89
  test('renders help text styling', () => {
90
- const view = render(<ProgressStep popover={<div></div>}>Title</ProgressStep>);
90
+ const view = render(<ProgressStep popoverRender={({ stepRef }) => (<div></div>)}>Title</ProgressStep>);
91
91
  expect(view.container).toMatchSnapshot();
92
92
  });
93
93
 
@@ -331,17 +331,13 @@ import PendingIcon from '@patternfly/react-icons/dist/esm/icons/pending-icon';
331
331
 
332
332
  ### With help popover
333
333
 
334
- To add a popover to a progress step, set the `popover` and `ref` properties on the `ProgressStep` component and the `reference` property on the `Popover` component.
334
+ To add a popover to a progress step, set the `popoverRender` properties on the `ProgressStep` component.
335
335
 
336
336
  ```js
337
337
  import React from 'react';
338
338
  import { ProgressStepper, ProgressStep, Popover } from '@patternfly/react-core';
339
339
 
340
340
  PopoverProgressStep = () => {
341
- const firstStepRef = React.useRef();
342
- const secondStepRef = React.useRef();
343
- const thirdStepRef = React.useRef();
344
-
345
341
  return (
346
342
  <ProgressStepper>
347
343
  <ProgressStep
@@ -349,55 +345,52 @@ PopoverProgressStep = () => {
349
345
  id="popover-step1"
350
346
  titleId="popover-step1-title"
351
347
  aria-label="completed step with popover, step with success"
352
- popover={
348
+ popoverRender={( stepRef ) => (
353
349
  <Popover
354
350
  aria-label="First step help"
355
351
  headerContent={<div>First step popover</div>}
356
352
  bodyContent={<div>Additional info or help text content.</div>}
357
- reference={firstStepRef}
353
+ reference={stepRef}
358
354
  position="right"
359
355
  />
360
- }
361
- ref={firstStepRef}
356
+ )}
362
357
  >
363
- First Step
358
+ First step
364
359
  </ProgressStep>
365
360
  <ProgressStep
366
361
  variant="danger"
367
362
  id="popover-step2"
368
363
  titleId="popover-step2-title"
369
364
  aria-label="completed step with popover, step with danger"
370
- popover={
365
+ popoverRender={( stepRef ) => (
371
366
  <Popover
372
367
  aria-label="Second step help"
373
368
  headerContent={<div>Second step popover</div>}
374
369
  bodyContent={<div>Additional info or help text content.</div>}
375
- reference={secondStepRef}
370
+ reference={stepRef}
376
371
  position="right"
377
372
  />
378
- }
379
- ref={secondStepRef}
373
+ )}
380
374
  >
381
- Second Step
375
+ Second step
382
376
  </ProgressStep>
383
377
  <ProgressStep
384
378
  variant="info"
385
379
  id="popover-step3"
386
380
  titleId="popover-step3-title"
387
381
  aria-label="step with popover"
388
- popover={
382
+ popoverRender={(stepRef) => (
389
383
  <Popover
390
384
  aria-label="Third step help"
391
385
  headerContent={<div>Third step popover</div>}
392
386
  bodyContent={<div>Additional info or help text content.</div>}
393
- reference={thirdStepRef}
387
+ reference={stepRef}
394
388
  position="right"
395
389
  />
396
- }
390
+ )}
397
391
  isCurrent
398
- ref={thirdStepRef}
399
392
  >
400
- Third Step
393
+ Third step
401
394
  </ProgressStep>
402
395
  <ProgressStep variant="pending" id="popover-step4" titleId="popover-step4-title" aria-label="pending step">
403
396
  Fourth step
package/src/demos/Tabs.md CHANGED
@@ -445,7 +445,12 @@ TabsOpenWithSecondaryTabsDemo = () => {
445
445
 
446
446
  ### Nested tabs
447
447
 
448
- ```js isFullscreen file="./Tabs/NestedTabsDemo.js"
448
+ ```js isFullscreen file="./examples/Tabs/NestedTabs.tsx"
449
+ ```
450
+
451
+ ### Nested, unindented tabs
452
+
453
+ ```js isFullscreen file="./examples/Tabs/NestedUnindentedTabs.tsx"
449
454
  ```
450
455
 
451
456
  ### Tables and tabs
@@ -6,8 +6,11 @@ import {
6
6
  NavItem,
7
7
  NavList,
8
8
  Page,
9
+ PageSection,
9
10
  PageSidebar,
10
- SkipToContent
11
+ SkipToContent,
12
+ Text,
13
+ TextContent
11
14
  } from '@patternfly/react-core';
12
15
  import DashboardHeader from './DashboardHeader';
13
16
 
@@ -21,6 +24,15 @@ export const DashboardBreadcrumb = (
21
24
  </BreadcrumbItem>
22
25
  </Breadcrumb>
23
26
  );
27
+
28
+ export const PageTemplateTitle = (
29
+ <PageSection variant="light">
30
+ <TextContent>
31
+ <Text component="h1">Main title</Text>
32
+ <Text component="p">This is a full page demo.</Text>
33
+ </TextContent>
34
+ </PageSection>
35
+ );
24
36
  export default class DashboardWrapper extends React.Component {
25
37
  constructor(props) {
26
38
  super(props);
@@ -45,7 +57,8 @@ export default class DashboardWrapper extends React.Component {
45
57
  sidebar,
46
58
  sidebarNavOpen,
47
59
  onPageResize,
48
- hasNoBreadcrumb
60
+ hasNoBreadcrumb,
61
+ hasPageTemplateTitle
49
62
  } = this.props;
50
63
 
51
64
  let renderedBreadcrumb;
@@ -92,6 +105,7 @@ export default class DashboardWrapper extends React.Component {
92
105
  mainContainerId={mainContainerId ? mainContainerId : 'main-content-page-layout-default-nav'}
93
106
  onPageResize={onPageResize}
94
107
  >
108
+ {hasPageTemplateTitle && PageTemplateTitle}
95
109
  {children}
96
110
  </Page>
97
111
  );
@@ -1,7 +1,6 @@
1
1
  import React from 'react';
2
2
  import {
3
3
  PageSection,
4
- PageSectionVariants,
5
4
  Tabs,
6
5
  Tab,
7
6
  TabContent,
@@ -16,7 +15,7 @@ import {
16
15
  CardBody,
17
16
  CardHeader
18
17
  } from '@patternfly/react-core';
19
- import DashboardWrapper from '../../examples/DashboardWrapper';
18
+ import DashboardWrapper from '../DashboardWrapper';
20
19
 
21
20
  export const GrayTabsDemo: React.FunctionComponent = () => {
22
21
  const [activeTabKey, setActiveTabKey] = React.useState<string | number>(0);
@@ -126,12 +125,7 @@ export const GrayTabsDemo: React.FunctionComponent = () => {
126
125
  );
127
126
 
128
127
  return (
129
- <DashboardWrapper hasNoBreadcrumb>
130
- <PageSection isWidthLimited variant={PageSectionVariants.light}>
131
- <Title headingLevel="h1" size="2xl">
132
- Overview
133
- </Title>
134
- </PageSection>
128
+ <DashboardWrapper hasPageTemplateTitle>
135
129
  <PageSection type="tabs" isWidthLimited>
136
130
  <Tabs
137
131
  activeKey={activeTabKey}
@@ -81,7 +81,7 @@ export const ModalTabs: React.FunctionComponent = () => {
81
81
 
82
82
  return (
83
83
  <React.Fragment>
84
- <DashboardWrapper mainContainerId="main-content-card-view-default-nav" breadcrumb={null}>
84
+ <DashboardWrapper mainContainerId="main-content-card-view-default-nav">
85
85
  <PageSection variant={PageSectionVariants.light}>
86
86
  <TextContent>
87
87
  <Text component="h1">Projects</Text>
@@ -6,7 +6,6 @@ import {
6
6
  Grid,
7
7
  GridItem,
8
8
  PageSection,
9
- PageSectionVariants,
10
9
  Tabs,
11
10
  Tab,
12
11
  TabContent,
@@ -16,17 +15,17 @@ import {
16
15
  Flex,
17
16
  FlexItem
18
17
  } from '@patternfly/react-core';
19
- import DashboardWrapper from '../examples/DashboardWrapper';
18
+ import DashboardWrapper from '../DashboardWrapper';
20
19
 
21
- export const NestedTabsDemo = () => {
20
+ export const NestedTabs: React.FunctionComponent = () => {
22
21
  const [activeTabKey, setActiveTabKey] = React.useState(0);
23
22
  const [activeNestedTabKey, setActiveNestedTabKey] = React.useState(10);
24
23
 
25
24
  // Toggle currently active tab
26
- const handleTabClick = (_, tabIndex) => setActiveTabKey(tabIndex);
25
+ const handleTabClick = (tabIndex: number) => setActiveTabKey(tabIndex);
27
26
 
28
27
  // Toggle currently active nested tab
29
- const handleNestedTabClick = (_, tabIndex) => setActiveNestedTabKey(tabIndex);
28
+ const handleNestedTabClick = (tabIndex: number) => setActiveNestedTabKey(tabIndex);
30
29
 
31
30
  const tabContent = (
32
31
  <Grid hasGutter>
@@ -41,7 +40,7 @@ export const NestedTabsDemo = () => {
41
40
  <Tabs
42
41
  activeKey={activeNestedTabKey}
43
42
  isSecondary
44
- onSelect={handleNestedTabClick}
43
+ onSelect={(_event, tabIndex) => handleNestedTabClick(Number(tabIndex))}
45
44
  id="nested-tabs-example-nested-tabs-list"
46
45
  >
47
46
  <Tab eventKey={10} title={<TabTitleText>Cluster</TabTitleText>} tabContentId={`tabContent${10}`} />
@@ -126,14 +125,14 @@ export const NestedTabsDemo = () => {
126
125
  );
127
126
 
128
127
  return (
129
- <DashboardWrapper hasNoBreadcrumb>
130
- <PageSection isWidthLimited variant={PageSectionVariants.light}>
131
- <Title headingLevel="h1" size="2xl">
132
- Overview
133
- </Title>
134
- </PageSection>
128
+ <DashboardWrapper hasPageTemplateTitle>
135
129
  <PageSection type="tabs" isWidthLimited>
136
- <Tabs activeKey={activeTabKey} onSelect={handleTabClick} usePageInsets id="nested-tabs-example-tabs-list">
130
+ <Tabs
131
+ activeKey={activeTabKey}
132
+ onSelect={(_event, tabIndex) => handleTabClick(Number(tabIndex))}
133
+ usePageInsets
134
+ id="nested-tabs-example-tabs-list"
135
+ >
137
136
  <Tab eventKey={0} title={<TabTitleText>Cluster 1</TabTitleText>} tabContentId={`tabContent${0}`} />
138
137
  <Tab eventKey={1} title={<TabTitleText>Cluster 2</TabTitleText>} tabContentId={`tabContent${1}`} />
139
138
  </Tabs>
@@ -0,0 +1,174 @@
1
+ import React from 'react';
2
+ import {
3
+ Card,
4
+ CardHeader,
5
+ CardBody,
6
+ Grid,
7
+ GridItem,
8
+ PageSection,
9
+ Tabs,
10
+ Tab,
11
+ TabContent,
12
+ TabContentBody,
13
+ TabTitleText,
14
+ Title,
15
+ Text,
16
+ TextContent,
17
+ TitleSizes
18
+ } from '@patternfly/react-core';
19
+ import DashboardWrapper from '../DashboardWrapper';
20
+
21
+ export const NestedUnindentedTabs: React.FunctionComponent = () => {
22
+ const [activeTabKey, setActiveTabKey] = React.useState(1);
23
+ const [activeNestedTabKey, setActiveNestedTabKey] = React.useState(10);
24
+
25
+ // Toggle currently active tab
26
+ const handleTabClick = (tabIndex: number) => setActiveTabKey(tabIndex);
27
+
28
+ // Toggle currently active nested tab
29
+ const handleNestedTabClick = (tabIndex: number) => setActiveNestedTabKey(tabIndex);
30
+
31
+ const tabContent = (
32
+ <Grid hasGutter>
33
+ <GridItem>
34
+ <CardHeader>
35
+ <Title headingLevel="h1" size={TitleSizes['2xl']}>
36
+ Get started with Red Hat Enterprise Linux
37
+ </Title>
38
+ </CardHeader>
39
+ </GridItem>
40
+ <GridItem>
41
+ <Tabs
42
+ activeKey={activeNestedTabKey}
43
+ isSecondary
44
+ onSelect={(_event, tabIndex) => handleNestedTabClick(Number(tabIndex))}
45
+ id="nested-tabs-example-nested-tabs-list"
46
+ >
47
+ <Tab eventKey={10} title={<TabTitleText>x86 architecture</TabTitleText>} tabContentId={`tabContent${10}`} />
48
+ <Tab
49
+ eventKey={11}
50
+ title={<TabTitleText>Additional Architectures</TabTitleText>}
51
+ tabContentId={`tabContent${11}`}
52
+ />
53
+ </Tabs>
54
+ </GridItem>
55
+ <GridItem>
56
+ <TabContent
57
+ key={10}
58
+ eventKey={10}
59
+ id={`tabContent${10}`}
60
+ activeKey={activeNestedTabKey}
61
+ hidden={10 !== activeNestedTabKey}
62
+ >
63
+ <TabContentBody>
64
+ <Grid hasGutter>
65
+ <GridItem>
66
+ <TextContent>
67
+ <Text>To perform a standard x86_64 installation using the GUI, you'll need to:</Text>
68
+ </TextContent>
69
+ </GridItem>
70
+ <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>
107
+ </Grid>
108
+ </Grid>
109
+ </TabContentBody>
110
+ </TabContent>
111
+ <TabContent
112
+ key={11}
113
+ eventKey={11}
114
+ id={`tabContent${11}`}
115
+ activeKey={activeNestedTabKey}
116
+ hidden={11 !== activeNestedTabKey}
117
+ >
118
+ <TabContentBody>Additional architectures panel</TabContentBody>
119
+ </TabContent>
120
+ <TabContent
121
+ key={12}
122
+ eventKey={12}
123
+ id={`tabContent${12}`}
124
+ activeKey={activeNestedTabKey}
125
+ hidden={12 !== activeNestedTabKey}
126
+ >
127
+ <TabContentBody>Operators panel</TabContentBody>
128
+ </TabContent>
129
+ <TabContent
130
+ key={13}
131
+ eventKey={13}
132
+ id={`tabContent${13}`}
133
+ activeKey={activeNestedTabKey}
134
+ hidden={13 !== activeNestedTabKey}
135
+ >
136
+ <TabContentBody>Virtualization panel</TabContentBody>
137
+ </TabContent>
138
+ </GridItem>
139
+ </Grid>
140
+ );
141
+
142
+ return (
143
+ <DashboardWrapper hasPageTemplateTitle>
144
+ <PageSection type="tabs" isWidthLimited variant="light">
145
+ <Tabs
146
+ isBox
147
+ activeKey={activeTabKey}
148
+ onSelect={(_event, tabIndex) => handleTabClick(Number(tabIndex))}
149
+ usePageInsets
150
+ id="nested-tabs-example-tabs-list"
151
+ >
152
+ <Tab eventKey={0} title={<TabTitleText>What's new</TabTitleText>} tabContentId={`tabContent${0}`} />
153
+ <Tab eventKey={1} title={<TabTitleText>Get started</TabTitleText>} tabContentId={`tabContent${1}`} />
154
+ <Tab eventKey={2} title={<TabTitleText>Knowledge</TabTitleText>} tabContentId={`tabContent${2}`} />
155
+ <Tab eventKey={3} title={<TabTitleText>Support</TabTitleText>} tabContentId={`tabContent${3}`} />
156
+ </Tabs>
157
+ </PageSection>
158
+ <PageSection variant="light">
159
+ <TabContent key={0} eventKey={0} id={`tabContent${0}`} activeKey={activeTabKey} hidden={0 !== activeTabKey}>
160
+ <TabContentBody>What's new panel</TabContentBody>
161
+ </TabContent>
162
+ <TabContent key={1} eventKey={1} id={`tabContent${1}`} activeKey={activeTabKey} hidden={1 !== activeTabKey}>
163
+ <TabContentBody>{tabContent}</TabContentBody>
164
+ </TabContent>
165
+ <TabContent key={2} eventKey={2} id={`tabContent${2}`} activeKey={activeTabKey} hidden={2 !== activeTabKey}>
166
+ <TabContentBody>Knowledge panel</TabContentBody>
167
+ </TabContent>
168
+ <TabContent key={3} eventKey={3} id={`tabContent${3}`} activeKey={activeTabKey} hidden={3 !== activeTabKey}>
169
+ <TabContentBody>Support Panel</TabContentBody>
170
+ </TabContent>
171
+ </PageSection>
172
+ </DashboardWrapper>
173
+ );
174
+ };
@@ -400,7 +400,7 @@ export const TablesAndTabs = () => {
400
400
  );
401
401
 
402
402
  return (
403
- <DashboardWrapper hasNoBreadcrumb>
403
+ <DashboardWrapper>
404
404
  <React.Fragment>
405
405
  <PageSection variant={PageSectionVariants.light}>
406
406
  <Title headingLevel="h1" size="2xl">