@patternfly/react-core 4.227.7 → 4.227.8

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.227.7",
3
+ "version": "4.227.8",
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,9 +34,9 @@
34
34
  "generate": "node scripts/copyStyles.js"
35
35
  },
36
36
  "dependencies": {
37
- "@patternfly/react-icons": "^4.78.7",
38
- "@patternfly/react-styles": "^4.77.7",
39
- "@patternfly/react-tokens": "^4.79.7",
37
+ "@patternfly/react-icons": "^4.78.8",
38
+ "@patternfly/react-styles": "^4.77.8",
39
+ "@patternfly/react-tokens": "^4.79.8",
40
40
  "focus-trap": "6.9.2",
41
41
  "react-dropzone": "9.0.0",
42
42
  "tippy.js": "5.1.2",
@@ -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": "86dc74f93f58bd72ce6ac164e9bda25422494ca0"
63
+ "gitHead": "09b80fb1de7a57f0917554a36d2e7422d70f551f"
64
64
  }
@@ -25,652 +25,47 @@ import './page.css';
25
25
 
26
26
  ### Vertical nav
27
27
 
28
- ```js
29
- import React from 'react';
30
- import {
31
- Page,
32
- Masthead,
33
- MastheadToggle,
34
- MastheadMain,
35
- MastheadBrand,
36
- MastheadContent,
37
- PageSidebar,
38
- PageSection,
39
- PageSectionVariants,
40
- PageToggleButton,
41
- Toolbar,
42
- ToolbarContent,
43
- ToolbarItem
44
- } from '@patternfly/react-core';
45
- import BarsIcon from '@patternfly/react-icons/dist/esm/icons/bars-icon';
46
-
47
- class VerticalPage extends React.Component {
48
- constructor(props) {
49
- super(props);
50
- this.state = {
51
- isNavOpen: true
52
- };
53
- this.onNavToggle = () => {
54
- this.setState({
55
- isNavOpen: !this.state.isNavOpen
56
- });
57
- };
58
- }
59
-
60
- render() {
61
- const { isNavOpen } = this.state;
62
-
63
- const headerToolbar = (
64
- <Toolbar id="vertical-toolbar">
65
- <ToolbarContent>
66
- <ToolbarItem>header-tools</ToolbarItem>
67
- </ToolbarContent>
68
- </Toolbar>
69
- );
70
-
71
- const Header = (
72
- <Masthead>
73
- <MastheadToggle>
74
- <PageToggleButton
75
- variant="plain"
76
- aria-label="Global navigation"
77
- isNavOpen={isNavOpen}
78
- onNavToggle={this.onNavToggle}
79
- id="vertical-nav-toggle"
80
- >
81
- <BarsIcon />
82
- </PageToggleButton>
83
- </MastheadToggle>
84
- <MastheadMain>
85
- <MastheadBrand href="https://patternfly.org" onClick={() => console.log('clicked logo')} target="_blank">
86
- Logo
87
- </MastheadBrand>
88
- </MastheadMain>
89
- <MastheadContent>{headerToolbar}</MastheadContent>
90
- </Masthead>
91
- );
92
- const Sidebar = <PageSidebar nav="Navigation" isNavOpen={isNavOpen} id="vertical-sidebar" />;
93
-
94
- return (
95
- <Page header={Header} sidebar={Sidebar}>
96
- <PageSection variant={PageSectionVariants.darker}>Section with darker background</PageSection>
97
- <PageSection variant={PageSectionVariants.dark}>Section with dark background</PageSection>
98
- <PageSection variant={PageSectionVariants.light}>Section with light background</PageSection>
99
- </Page>
100
- );
101
- }
102
- }
28
+ ```ts file="./PageVerticalNav.tsx"
103
29
  ```
104
30
 
105
31
  ### Horizontal nav
106
32
 
107
- ```js
108
- import React from 'react';
109
- import {
110
- Page,
111
- Masthead,
112
- MastheadMain,
113
- MastheadBrand,
114
- MastheadContent,
115
- PageSection,
116
- PageSectionVariants,
117
- Toolbar,
118
- ToolbarContent,
119
- ToolbarItem
120
- } from '@patternfly/react-core';
121
-
122
- HorizontalPage = () => {
123
- const headerToolbar = (
124
- <Toolbar id="horizontal-toolbar">
125
- <ToolbarContent>
126
- <ToolbarItem>Navigation</ToolbarItem>
127
- <ToolbarItem>header-tools</ToolbarItem>
128
- </ToolbarContent>
129
- </Toolbar>
130
- );
131
-
132
- const Header = (
133
- <Masthead inset={{ default: 'insetXs' }}>
134
- <MastheadMain>
135
- <MastheadBrand href="https://patternfly.org" onClick={() => console.log('clicked logo')} target="_blank">
136
- Logo
137
- </MastheadBrand>
138
- </MastheadMain>
139
- <MastheadContent>{headerToolbar}</MastheadContent>
140
- </Masthead>
141
- );
142
-
143
- return (
144
- <Page header={Header}>
145
- <PageSection variant={PageSectionVariants.darker}>Section with darker background</PageSection>
146
- <PageSection variant={PageSectionVariants.dark}>Section with dark background</PageSection>
147
- <PageSection variant={PageSectionVariants.light}>Section with light background</PageSection>
148
- </Page>
149
- );
150
- };
33
+ ```ts file="./PageHorizontalNav.tsx"
151
34
  ```
152
35
 
153
36
  ### Tertiary nav
154
37
 
155
- ```js
156
- import React from 'react';
157
- import {
158
- Page,
159
- Masthead,
160
- MastheadMain,
161
- MastheadBrand,
162
- MastheadContent,
163
- PageSection,
164
- PageSectionVariants,
165
- Toolbar,
166
- ToolbarContent,
167
- ToolbarItem
168
- } from '@patternfly/react-core';
169
-
170
- TertiaryPage = () => {
171
- const headerToolbar = (
172
- <Toolbar id="tertiary-toolbar">
173
- <ToolbarContent>
174
- <ToolbarItem>header-tools</ToolbarItem>
175
- </ToolbarContent>
176
- </Toolbar>
177
- );
178
-
179
- const Header = (
180
- <Masthead display={{ default: 'stack' }} inset={{ default: 'insetXs' }}>
181
- <MastheadMain>
182
- <MastheadBrand href="https://patternfly.org" onClick={() => console.log('clicked logo')} target="_blank">
183
- Logo
184
- </MastheadBrand>
185
- </MastheadMain>
186
- <MastheadContent>{headerToolbar}</MastheadContent>
187
- </Masthead>
188
- );
189
-
190
- return (
191
- <Page header={Header} tertiaryNav="Navigation">
192
- <PageSection variant={PageSectionVariants.darker}>Section with darker background</PageSection>
193
- <PageSection variant={PageSectionVariants.dark}>Section with dark background</PageSection>
194
- <PageSection variant={PageSectionVariants.light}>Section with light background</PageSection>
195
- </Page>
196
- );
197
- };
38
+ ```ts file="./PageTertiaryNav.tsx"
198
39
  ```
199
40
 
200
41
  ### With or without fill
201
42
 
202
- ```js
203
- import React from 'react';
204
- import {
205
- Page,
206
- Masthead,
207
- MastheadToggle,
208
- MastheadMain,
209
- MastheadBrand,
210
- MastheadContent,
211
- PageSidebar,
212
- PageSection,
213
- PageToggleButton,
214
- Toolbar,
215
- ToolbarContent,
216
- ToolbarItem
217
- } from '@patternfly/react-core';
218
- import BarsIcon from '@patternfly/react-icons/dist/esm/icons/bars-icon';
219
-
220
- class FillPage extends React.Component {
221
- constructor(props) {
222
- super(props);
223
- this.state = {
224
- isNavOpen: true
225
- };
226
- this.onNavToggle = () => {
227
- this.setState({
228
- isNavOpen: !this.state.isNavOpen
229
- });
230
- };
231
- }
232
-
233
- render() {
234
- const { isNavOpen } = this.state;
235
-
236
- const headerToolbar = (
237
- <Toolbar id="fill-toolbar">
238
- <ToolbarContent>
239
- <ToolbarItem>header-tools</ToolbarItem>
240
- </ToolbarContent>
241
- </Toolbar>
242
- );
243
-
244
- const Header = (
245
- <Masthead>
246
- <MastheadToggle>
247
- <PageToggleButton
248
- variant="plain"
249
- aria-label="Global navigation"
250
- isNavOpen={isNavOpen}
251
- onNavToggle={this.onNavToggle}
252
- id="fill-nav-toggle"
253
- >
254
- <BarsIcon />
255
- </PageToggleButton>
256
- </MastheadToggle>
257
- <MastheadMain>
258
- <MastheadBrand href="https://patternfly.org" onClick={() => console.log('clicked logo')} target="_blank">
259
- Logo
260
- </MastheadBrand>
261
- </MastheadMain>
262
- <MastheadContent>{headerToolbar}</MastheadContent>
263
- </Masthead>
264
- );
265
- const Sidebar = <PageSidebar nav="Navigation" isNavOpen={isNavOpen} id="fill-sidebar" />;
266
-
267
- return (
268
- <Page header={Header} sidebar={Sidebar}>
269
- <PageSection>A default page section</PageSection>
270
- <PageSection isFilled={true}>This section fills the available space.</PageSection>
271
- <PageSection isFilled={false}>
272
- This section is set to not fill the available space, since the last page section is set to fill the available
273
- space by default.
274
- </PageSection>
275
- </Page>
276
- );
277
- }
278
- }
43
+ ```ts file="./PageWithOrWithoutFill.tsx"
279
44
  ```
280
45
 
281
46
  ### Main section padding
282
47
 
283
- ```js
284
- import React from 'react';
285
- import {
286
- Page,
287
- Masthead,
288
- MastheadToggle,
289
- MastheadMain,
290
- MastheadBrand,
291
- MastheadContent,
292
- PageSidebar,
293
- PageSection,
294
- PageSectionVariants,
295
- PageToggleButton,
296
- Toolbar,
297
- ToolbarContent,
298
- ToolbarItem
299
- } from '@patternfly/react-core';
300
- import BarsIcon from '@patternfly/react-icons/dist/esm/icons/bars-icon';
301
-
302
- class VerticalPage extends React.Component {
303
- constructor(props) {
304
- super(props);
305
- this.state = {
306
- isNavOpen: true
307
- };
308
- this.onNavToggle = () => {
309
- this.setState({
310
- isNavOpen: !this.state.isNavOpen
311
- });
312
- };
313
- }
314
-
315
- render() {
316
- const { isNavOpen } = this.state;
317
-
318
- const headerToolbar = (
319
- <Toolbar id="main-padding-toolbar">
320
- <ToolbarContent>
321
- <ToolbarItem>header-tools</ToolbarItem>
322
- </ToolbarContent>
323
- </Toolbar>
324
- );
325
-
326
- const Header = (
327
- <Masthead>
328
- <MastheadToggle>
329
- <PageToggleButton
330
- variant="plain"
331
- aria-label="Global navigation"
332
- isNavOpen={isNavOpen}
333
- onNavToggle={this.onNavToggle}
334
- id="main-padding-nav-toggle"
335
- >
336
- <BarsIcon />
337
- </PageToggleButton>
338
- </MastheadToggle>
339
- <MastheadMain>
340
- <MastheadBrand href="https://patternfly.org" onClick={() => console.log('clicked logo')} target="_blank">
341
- Logo
342
- </MastheadBrand>
343
- </MastheadMain>
344
- <MastheadContent>{headerToolbar}</MastheadContent>
345
- </Masthead>
346
- );
347
- const Sidebar = <PageSidebar nav="Navigation" isNavOpen={isNavOpen} id="main-padding-sidebar" />;
348
-
349
- return (
350
- <Page header={Header} sidebar={Sidebar}>
351
- <PageSection>Section with default padding</PageSection>
352
- <PageSection variant={PageSectionVariants.light} padding={{ default: 'noPadding' }}>
353
- Section with no padding
354
- </PageSection>
355
- <PageSection padding={{ default: 'noPadding', md: 'padding', lg: 'padding' }}>
356
- Section with padding only on medium/large
357
- </PageSection>
358
- <PageSection variant={PageSectionVariants.light} padding={{ md: 'noPadding' }}>
359
- Section with no padding on medium
360
- </PageSection>
361
- </Page>
362
- );
363
- }
364
- }
48
+ ```ts file="./PageMainSectionPadding.tsx"
365
49
  ```
366
50
 
367
51
  ### Uncontrolled nav
368
52
 
369
- ```js
370
- import React from 'react';
371
- import {
372
- Page,
373
- Masthead,
374
- MastheadToggle,
375
- MastheadMain,
376
- MastheadBrand,
377
- MastheadContent,
378
- PageSidebar,
379
- PageSection,
380
- PageSectionVariants,
381
- PageToggleButton,
382
- Toolbar,
383
- ToolbarContent,
384
- ToolbarItem
385
- } from '@patternfly/react-core';
386
- import BarsIcon from '@patternfly/react-icons/dist/esm/icons/bars-icon';
387
-
388
- class UncontrolledNavPage extends React.Component {
389
- render() {
390
- const headerToolbar = (
391
- <Toolbar id="uncontrolled-toolbar">
392
- <ToolbarContent>
393
- <ToolbarItem>header-tools</ToolbarItem>
394
- </ToolbarContent>
395
- </Toolbar>
396
- );
397
-
398
- const Header = (
399
- <Masthead>
400
- <MastheadToggle>
401
- <PageToggleButton variant="plain" aria-label="Global navigation" id="uncontrolled-nav-toggle">
402
- <BarsIcon />
403
- </PageToggleButton>
404
- </MastheadToggle>
405
- <MastheadMain>
406
- <MastheadBrand href="https://patternfly.org" onClick={() => console.log('clicked logo')} target="_blank">
407
- Logo
408
- </MastheadBrand>
409
- </MastheadMain>
410
- <MastheadContent>{headerToolbar}</MastheadContent>
411
- </Masthead>
412
- );
413
- const Sidebar = <PageSidebar nav="Navigation" id="uncontrolled-sidebar" />;
414
-
415
- return (
416
- <Page isManagedSidebar header={Header} sidebar={Sidebar}>
417
- <PageSection variant={PageSectionVariants.darker}>Section with darker background</PageSection>
418
- <PageSection variant={PageSectionVariants.dark}>Section with dark background</PageSection>
419
- <PageSection variant={PageSectionVariants.light}>Section with light background</PageSection>
420
- </Page>
421
- );
422
- }
423
- }
53
+ ```ts file="./PageUncontrolledNav.tsx"
424
54
  ```
425
55
 
426
56
  ### Group section
427
57
 
428
- ```js
429
- import React from 'react';
430
- import {
431
- Page,
432
- Masthead,
433
- MastheadToggle,
434
- MastheadMain,
435
- MastheadBrand,
436
- MastheadContent,
437
- PageSidebar,
438
- PageSection,
439
- PageGroup,
440
- PageBreadcrumb,
441
- PageNavigation,
442
- PageSectionVariants,
443
- PageToggleButton,
444
- Breadcrumb,
445
- BreadcrumbItem,
446
- Nav,
447
- NavList,
448
- NavItem,
449
- Toolbar,
450
- ToolbarContent,
451
- ToolbarItem
452
- } from '@patternfly/react-core';
453
- import BarsIcon from '@patternfly/react-icons/dist/esm/icons/bars-icon';
454
-
455
- class GroupPage extends React.Component {
456
- constructor(props) {
457
- super(props);
458
- this.state = {
459
- isNavOpen: true
460
- };
461
- this.onNavToggle = () => {
462
- this.setState({
463
- isNavOpen: !this.state.isNavOpen
464
- });
465
- };
466
- }
467
-
468
- render() {
469
- const { isNavOpen } = this.state;
470
-
471
- const headerToolbar = (
472
- <Toolbar id="group-section-toolbar">
473
- <ToolbarContent>
474
- <ToolbarItem>header-tools</ToolbarItem>
475
- </ToolbarContent>
476
- </Toolbar>
477
- );
478
-
479
- const Header = (
480
- <Masthead>
481
- <MastheadToggle>
482
- <PageToggleButton
483
- variant="plain"
484
- aria-label="Global navigation"
485
- isNavOpen={isNavOpen}
486
- onNavToggle={this.onNavToggle}
487
- id="group-section-nav-toggle"
488
- >
489
- <BarsIcon />
490
- </PageToggleButton>
491
- </MastheadToggle>
492
- <MastheadMain>
493
- <MastheadBrand href="https://patternfly.org" onClick={() => console.log('clicked logo')} target="_blank">
494
- Logo
495
- </MastheadBrand>
496
- </MastheadMain>
497
- <MastheadContent>{headerToolbar}</MastheadContent>
498
- </Masthead>
499
- );
500
- const Sidebar = <PageSidebar nav="Navigation" isNavOpen={isNavOpen} id="group-section-sidebar" />;
501
-
502
- return (
503
- <Page header={Header} sidebar={Sidebar}>
504
- <PageGroup>
505
- <PageNavigation>
506
- <Nav aria-label="Group section navigation" variant="tertiary">
507
- <NavList>
508
- <NavItem href="#" itemId={0} isActive>
509
- System panel
510
- </NavItem>
511
- <NavItem href="#" itemId={1}>
512
- Policy
513
- </NavItem>
514
- <NavItem href="#" itemId={2}>
515
- Authentication
516
- </NavItem>
517
- <NavItem href="#" itemId={3}>
518
- Network services
519
- </NavItem>
520
- <NavItem href="#" itemId={4}>
521
- Server
522
- </NavItem>
523
- </NavList>
524
- </Nav>
525
- </PageNavigation>
526
- <PageBreadcrumb>
527
- <Breadcrumb>
528
- <BreadcrumbItem>Section home</BreadcrumbItem>
529
- <BreadcrumbItem to="#">Section title</BreadcrumbItem>
530
- <BreadcrumbItem to="#">Section title</BreadcrumbItem>
531
- <BreadcrumbItem to="#" isActive>
532
- Section landing
533
- </BreadcrumbItem>
534
- </Breadcrumb>
535
- </PageBreadcrumb>
536
- <PageSection variant={PageSectionVariants.light}>Grouped section</PageSection>
537
- </PageGroup>
538
- <PageSection variant={PageSectionVariants.dark}>Section 1</PageSection>
539
- <PageSection variant={PageSectionVariants.dark}>Section 2</PageSection>
540
- </Page>
541
- );
542
- }
543
- }
58
+ ```ts file="./PageGroupSection.tsx"
544
59
  ```
545
60
 
546
61
  ### Vertical nav using PageHeader component
547
62
 
548
- This example is provided becuase PageHeader and PageHeaderTools are still in use; however, going forward Masthead and Toolbar should be used to make headers rather than PageHeader and PageHeaderTools.
549
-
550
- ```js
551
- import React from 'react';
552
- import {
553
- Page,
554
- PageHeader,
555
- PageHeaderTools,
556
- PageSidebar,
557
- PageSection,
558
- PageSectionVariants
559
- } from '@patternfly/react-core';
560
-
561
- class VerticalPage extends React.Component {
562
- constructor(props) {
563
- super(props);
564
- this.state = {
565
- isNavOpen: true
566
- };
567
- this.onNavToggle = () => {
568
- this.setState({
569
- isNavOpen: !this.state.isNavOpen
570
- });
571
- };
572
- }
573
-
574
- render() {
575
- const { isNavOpen } = this.state;
63
+ This example is provided because PageHeader and PageHeaderTools are still in use; however, going forward Masthead and Toolbar should be used to make headers rather than PageHeader and PageHeaderTools.
576
64
 
577
- const logoProps = {
578
- href: 'https://patternfly.org',
579
- onClick: () => console.log('clicked logo'),
580
- target: '_blank'
581
- };
582
- const Header = (
583
- <PageHeader
584
- logo="Logo"
585
- logoProps={logoProps}
586
- headerTools={<PageHeaderTools>header-tools</PageHeaderTools>}
587
- showNavToggle
588
- isNavOpen={isNavOpen}
589
- onNavToggle={this.onNavToggle}
590
- navToggleId="vertical-pageheader-toggle"
591
- />
592
- );
593
- const Sidebar = <PageSidebar nav="Navigation" isNavOpen={isNavOpen} id="vertical-pageheader-sidebar" />;
594
-
595
- return (
596
- <Page header={Header} sidebar={Sidebar}>
597
- <PageSection variant={PageSectionVariants.darker}>Section with darker background</PageSection>
598
- <PageSection variant={PageSectionVariants.dark}>Section with dark background</PageSection>
599
- <PageSection variant={PageSectionVariants.light}>Section with light background</PageSection>
600
- </Page>
601
- );
602
- }
603
- }
65
+ ```ts file="./PageVerticalNavUsingPageHeaderComponent.tsx"
604
66
  ```
605
67
 
606
68
  ### Centered section
607
69
 
608
- ```js
609
- import React from 'react';
610
- import {
611
- Page,
612
- Masthead,
613
- MastheadToggle,
614
- MastheadMain,
615
- MastheadBrand,
616
- MastheadContent,
617
- PageSidebar,
618
- PageSection,
619
- PageSectionVariants,
620
- PageToggleButton,
621
- Toolbar,
622
- ToolbarContent,
623
- ToolbarItem,
624
- Card,
625
- CardBody
626
- } from '@patternfly/react-core';
627
- import BarsIcon from '@patternfly/react-icons/dist/esm/icons/bars-icon';
628
-
629
- CenterAlignedPageSection = () => {
630
- const headerToolbar = (
631
- <Toolbar id="centered-toolbar">
632
- <ToolbarContent>
633
- <ToolbarItem>header-tools</ToolbarItem>
634
- </ToolbarContent>
635
- </Toolbar>
636
- );
637
-
638
- const Header = (
639
- <Masthead>
640
- <MastheadToggle>
641
- <PageToggleButton
642
- variant="plain"
643
- aria-label="Global navigation"
644
- onNavToggle={this.onNavToggle}
645
- id="centered-nav-toggle"
646
- >
647
- <BarsIcon />
648
- </PageToggleButton>
649
- </MastheadToggle>
650
- <MastheadMain>
651
- <MastheadBrand href="https://patternfly.org" onClick={() => console.log('clicked logo')} target="_blank">
652
- Logo
653
- </MastheadBrand>
654
- </MastheadMain>
655
- <MastheadContent>{headerToolbar}</MastheadContent>
656
- </Masthead>
657
- );
658
-
659
- return (
660
- <Page header={Header}>
661
- <PageSection isWidthLimited isCenterAligned>
662
- <Card>
663
- <CardBody>
664
- When a width limited page section is wider than the value of
665
- <code>--pf-c-page--section--m-limit-width--MaxWidth</code>, the section will be centered in the main section.
666
- <br />
667
- <br />
668
- The content in this example is placed in a card to better illustrate how the section behaves when it is
669
- centered. A card is not required to center a page section.
670
- </CardBody>
671
- </Card>
672
- </PageSection>
673
- </Page>
674
- );
675
- };
70
+ ```ts file="./PageCenteredSection.tsx"
676
71
  ```