@patternfly/react-core 4.158.4 → 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.
- package/CHANGELOG.md +11 -0
- package/dist/esm/components/Select/Select.d.ts +3 -0
- package/dist/esm/components/Select/Select.d.ts.map +1 -1
- package/dist/esm/components/Select/Select.js +2 -1
- package/dist/esm/components/Select/Select.js.map +1 -1
- package/dist/esm/components/Select/SelectMenu.d.ts +3 -0
- package/dist/esm/components/Select/SelectMenu.d.ts.map +1 -1
- package/dist/esm/components/Select/SelectMenu.js +4 -3
- package/dist/esm/components/Select/SelectMenu.js.map +1 -1
- package/dist/esm/components/Select/selectConstants.d.ts +4 -0
- package/dist/esm/components/Select/selectConstants.d.ts.map +1 -1
- package/dist/esm/components/Select/selectConstants.js +5 -0
- package/dist/esm/components/Select/selectConstants.js.map +1 -1
- package/dist/esm/components/Tabs/Tabs.d.ts +20 -0
- package/dist/esm/components/Tabs/Tabs.d.ts.map +1 -1
- package/dist/esm/components/Tabs/Tabs.js +44 -14
- package/dist/esm/components/Tabs/Tabs.js.map +1 -1
- package/dist/esm/components/Wizard/WizardNavItem.js +1 -1
- package/dist/js/components/Select/Select.d.ts +3 -0
- package/dist/js/components/Select/Select.d.ts.map +1 -1
- package/dist/js/components/Select/Select.js +1 -0
- package/dist/js/components/Select/Select.js.map +1 -1
- package/dist/js/components/Select/SelectMenu.d.ts +3 -0
- package/dist/js/components/Select/SelectMenu.d.ts.map +1 -1
- package/dist/js/components/Select/SelectMenu.js +3 -2
- package/dist/js/components/Select/SelectMenu.js.map +1 -1
- package/dist/js/components/Select/selectConstants.d.ts +4 -0
- package/dist/js/components/Select/selectConstants.d.ts.map +1 -1
- package/dist/js/components/Select/selectConstants.js +6 -1
- package/dist/js/components/Select/selectConstants.js.map +1 -1
- package/dist/js/components/Tabs/Tabs.d.ts +20 -0
- package/dist/js/components/Tabs/Tabs.d.ts.map +1 -1
- package/dist/js/components/Tabs/Tabs.js +44 -14
- package/dist/js/components/Tabs/Tabs.js.map +1 -1
- package/dist/js/components/Wizard/WizardNavItem.js +1 -1
- package/dist/umd/react-core.css +11237 -11237
- package/dist/umd/react-core.js +51 -17
- package/dist/umd/react-core.min.css +12076 -12076
- package/dist/umd/react-core.min.js +2 -2
- package/package.json +2 -2
- package/src/components/Drawer/examples/Drawer.md +0 -78
- package/src/components/Page/examples/Page.md +289 -103
- package/src/components/Select/Select.tsx +4 -1
- package/src/components/Select/SelectMenu.tsx +10 -2
- package/src/components/Select/__tests__/Generated/__snapshots__/SelectMenu.test.tsx.snap +1 -0
- package/src/components/Select/__tests__/__snapshots__/Select.test.tsx.snap +57 -0
- package/src/components/Select/selectConstants.tsx +5 -0
- package/src/components/Tabs/Tabs.tsx +97 -13
- package/src/components/Tabs/__tests__/Generated/__snapshots__/Tabs.test.tsx.snap +4 -4
- package/src/components/Tabs/__tests__/Tabs.test.tsx +50 -0
- package/src/components/Tabs/__tests__/__snapshots__/Tabs.test.tsx.snap +276 -30
- package/src/components/Tabs/examples/Tabs.md +96 -0
- package/src/components/Wizard/WizardNavItem.tsx +1 -1
- package/src/demos/ComposableMenu.md +125 -17
- package/src/demos/Page/Page.md +322 -12
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@patternfly/react-core",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.159.0",
|
|
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",
|
|
@@ -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": "
|
|
63
|
+
"gitHead": "86e7ecb47f3d2197cb664ce7237d3a25e18f8a48"
|
|
64
64
|
}
|
|
@@ -624,84 +624,6 @@ class DrawerStackedContentBodyElements extends React.Component {
|
|
|
624
624
|
}
|
|
625
625
|
```
|
|
626
626
|
|
|
627
|
-
### Stacked content body elements
|
|
628
|
-
|
|
629
|
-
```js
|
|
630
|
-
import React from 'react';
|
|
631
|
-
import {
|
|
632
|
-
Drawer,
|
|
633
|
-
DrawerPanelContent,
|
|
634
|
-
DrawerContent,
|
|
635
|
-
DrawerContentBody,
|
|
636
|
-
DrawerPanelBody,
|
|
637
|
-
DrawerHead,
|
|
638
|
-
DrawerActions,
|
|
639
|
-
DrawerCloseButton,
|
|
640
|
-
Button
|
|
641
|
-
} from '@patternfly/react-core';
|
|
642
|
-
|
|
643
|
-
class DrawerStackedContentBodyElements extends React.Component {
|
|
644
|
-
constructor(props) {
|
|
645
|
-
super(props);
|
|
646
|
-
this.state = {
|
|
647
|
-
isExpanded: false
|
|
648
|
-
};
|
|
649
|
-
this.drawerRef = React.createRef();
|
|
650
|
-
|
|
651
|
-
this.onExpand = () => {
|
|
652
|
-
this.drawerRef.current && this.drawerRef.current.focus();
|
|
653
|
-
};
|
|
654
|
-
|
|
655
|
-
this.onClick = () => {
|
|
656
|
-
const isExpanded = !this.state.isExpanded;
|
|
657
|
-
this.setState({
|
|
658
|
-
isExpanded
|
|
659
|
-
});
|
|
660
|
-
};
|
|
661
|
-
|
|
662
|
-
this.onCloseClick = () => {
|
|
663
|
-
this.setState({
|
|
664
|
-
isExpanded: false
|
|
665
|
-
});
|
|
666
|
-
};
|
|
667
|
-
}
|
|
668
|
-
|
|
669
|
-
render() {
|
|
670
|
-
const { isExpanded } = this.state;
|
|
671
|
-
const panelContent = (
|
|
672
|
-
<DrawerPanelContent>
|
|
673
|
-
<DrawerHead>
|
|
674
|
-
<h3 className="pf-c-title pf-m-2xl" tabIndex={isExpanded ? 0 : -1} ref={this.drawerRef}>
|
|
675
|
-
drawer title{' '}
|
|
676
|
-
</h3>
|
|
677
|
-
<DrawerActions>
|
|
678
|
-
<DrawerCloseButton onClick={this.onCloseClick} />
|
|
679
|
-
</DrawerActions>
|
|
680
|
-
drawer-panel
|
|
681
|
-
</DrawerHead>
|
|
682
|
-
<DrawerPanelBody hasNoPadding>drawer-panel with no padding</DrawerPanelBody>
|
|
683
|
-
<DrawerPanelBody>drawer-panel</DrawerPanelBody>
|
|
684
|
-
</DrawerPanelContent>
|
|
685
|
-
);
|
|
686
|
-
|
|
687
|
-
return (
|
|
688
|
-
<React.Fragment>
|
|
689
|
-
<Button aria-expanded={isExpanded} onClick={this.onClick}>
|
|
690
|
-
Toggle drawer
|
|
691
|
-
</Button>
|
|
692
|
-
<Drawer isExpanded={isExpanded} onExpand={this.onExpand}>
|
|
693
|
-
<DrawerContent panelContent={panelContent}>
|
|
694
|
-
<DrawerContentBody>content-body</DrawerContentBody>
|
|
695
|
-
<DrawerContentBody hasPadding>content-body with padding</DrawerContentBody>
|
|
696
|
-
<DrawerContentBody>content-body</DrawerContentBody>
|
|
697
|
-
</DrawerContent>
|
|
698
|
-
</Drawer>
|
|
699
|
-
</React.Fragment>
|
|
700
|
-
);
|
|
701
|
-
}
|
|
702
|
-
}
|
|
703
|
-
```
|
|
704
|
-
|
|
705
627
|
### Modified content padding
|
|
706
628
|
|
|
707
629
|
```js
|
|
@@ -18,6 +18,8 @@ propComponents:
|
|
|
18
18
|
]
|
|
19
19
|
---
|
|
20
20
|
|
|
21
|
+
import BarsIcon from '@patternfly/react-icons/dist/js/icons/bars-icon';
|
|
22
|
+
|
|
21
23
|
## Examples
|
|
22
24
|
|
|
23
25
|
### Vertical nav
|
|
@@ -26,12 +28,20 @@ propComponents:
|
|
|
26
28
|
import React from 'react';
|
|
27
29
|
import {
|
|
28
30
|
Page,
|
|
29
|
-
|
|
30
|
-
|
|
31
|
+
Masthead,
|
|
32
|
+
MastheadToggle,
|
|
33
|
+
MastheadMain,
|
|
34
|
+
MastheadBrand,
|
|
35
|
+
MastheadContent,
|
|
31
36
|
PageSidebar,
|
|
32
37
|
PageSection,
|
|
33
|
-
PageSectionVariants
|
|
38
|
+
PageSectionVariants,
|
|
39
|
+
PageToggleButton,
|
|
40
|
+
Toolbar,
|
|
41
|
+
ToolbarContent,
|
|
42
|
+
ToolbarItem
|
|
34
43
|
} from '@patternfly/react-core';
|
|
44
|
+
import BarsIcon from '@patternfly/react-icons/dist/esm/icons/bars-icon';
|
|
35
45
|
|
|
36
46
|
class VerticalPage extends React.Component {
|
|
37
47
|
constructor(props) {
|
|
@@ -49,20 +59,33 @@ class VerticalPage extends React.Component {
|
|
|
49
59
|
render() {
|
|
50
60
|
const { isNavOpen } = this.state;
|
|
51
61
|
|
|
52
|
-
const
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
62
|
+
const headerToolbar = (
|
|
63
|
+
<Toolbar id="toolbar">
|
|
64
|
+
<ToolbarContent>
|
|
65
|
+
<ToolbarItem>header-tools</ToolbarItem>
|
|
66
|
+
</ToolbarContent>
|
|
67
|
+
</Toolbar>
|
|
68
|
+
);
|
|
69
|
+
|
|
57
70
|
const Header = (
|
|
58
|
-
<
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
71
|
+
<Masthead>
|
|
72
|
+
<MastheadToggle>
|
|
73
|
+
<PageToggleButton
|
|
74
|
+
variant="plain"
|
|
75
|
+
aria-label="Global navigation"
|
|
76
|
+
isNavOpen={isNavOpen}
|
|
77
|
+
onNavToggle={this.onNavToggle}
|
|
78
|
+
>
|
|
79
|
+
<BarsIcon />
|
|
80
|
+
</PageToggleButton>
|
|
81
|
+
</MastheadToggle>
|
|
82
|
+
<MastheadMain>
|
|
83
|
+
<MastheadBrand href="https://patternfly.org" onClick={() => console.log('clicked logo')} target="_blank">
|
|
84
|
+
Logo
|
|
85
|
+
</MastheadBrand>
|
|
86
|
+
</MastheadMain>
|
|
87
|
+
<MastheadContent>{headerToolbar}</MastheadContent>
|
|
88
|
+
</Masthead>
|
|
66
89
|
);
|
|
67
90
|
const Sidebar = <PageSidebar nav="Navigation" isNavOpen={isNavOpen} />;
|
|
68
91
|
|
|
@@ -83,26 +106,36 @@ class VerticalPage extends React.Component {
|
|
|
83
106
|
import React from 'react';
|
|
84
107
|
import {
|
|
85
108
|
Page,
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
109
|
+
Masthead,
|
|
110
|
+
MastheadMain,
|
|
111
|
+
MastheadBrand,
|
|
112
|
+
MastheadContent,
|
|
89
113
|
PageSection,
|
|
90
|
-
PageSectionVariants
|
|
114
|
+
PageSectionVariants,
|
|
115
|
+
Toolbar,
|
|
116
|
+
ToolbarContent,
|
|
117
|
+
ToolbarItem
|
|
91
118
|
} from '@patternfly/react-core';
|
|
92
119
|
|
|
93
120
|
HorizontalPage = () => {
|
|
94
|
-
const
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
121
|
+
const headerToolbar = (
|
|
122
|
+
<Toolbar id="toolbar">
|
|
123
|
+
<ToolbarContent>
|
|
124
|
+
<ToolbarItem>Navigation</ToolbarItem>
|
|
125
|
+
<ToolbarItem>header-tools</ToolbarItem>
|
|
126
|
+
</ToolbarContent>
|
|
127
|
+
</Toolbar>
|
|
128
|
+
);
|
|
129
|
+
|
|
99
130
|
const Header = (
|
|
100
|
-
<
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
131
|
+
<Masthead display={{ default: 'stack' }} inset={{ default: 'insetXs' }}>
|
|
132
|
+
<MastheadMain>
|
|
133
|
+
<MastheadBrand href="https://patternfly.org" onClick={() => console.log('clicked logo')} target="_blank">
|
|
134
|
+
Logo
|
|
135
|
+
</MastheadBrand>
|
|
136
|
+
</MastheadMain>
|
|
137
|
+
<MastheadContent>{headerToolbar}</MastheadContent>
|
|
138
|
+
</Masthead>
|
|
106
139
|
);
|
|
107
140
|
|
|
108
141
|
return (
|
|
@@ -121,21 +154,35 @@ HorizontalPage = () => {
|
|
|
121
154
|
import React from 'react';
|
|
122
155
|
import {
|
|
123
156
|
Page,
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
157
|
+
Masthead,
|
|
158
|
+
MastheadMain,
|
|
159
|
+
MastheadBrand,
|
|
160
|
+
MastheadContent,
|
|
127
161
|
PageSection,
|
|
128
|
-
PageSectionVariants
|
|
162
|
+
PageSectionVariants,
|
|
163
|
+
Toolbar,
|
|
164
|
+
ToolbarContent,
|
|
165
|
+
ToolbarItem
|
|
129
166
|
} from '@patternfly/react-core';
|
|
130
167
|
|
|
131
168
|
TertiaryPage = () => {
|
|
132
|
-
const
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
169
|
+
const headerToolbar = (
|
|
170
|
+
<Toolbar id="toolbar">
|
|
171
|
+
<ToolbarContent>
|
|
172
|
+
<ToolbarItem>header-tools</ToolbarItem>
|
|
173
|
+
</ToolbarContent>
|
|
174
|
+
</Toolbar>
|
|
175
|
+
);
|
|
176
|
+
|
|
137
177
|
const Header = (
|
|
138
|
-
<
|
|
178
|
+
<Masthead display={{ default: 'stack' }} inset={{ default: 'insetXs' }}>
|
|
179
|
+
<MastheadMain>
|
|
180
|
+
<MastheadBrand href="https://patternfly.org" onClick={() => console.log('clicked logo')} target="_blank">
|
|
181
|
+
Logo
|
|
182
|
+
</MastheadBrand>
|
|
183
|
+
</MastheadMain>
|
|
184
|
+
<MastheadContent>{headerToolbar}</MastheadContent>
|
|
185
|
+
</Masthead>
|
|
139
186
|
);
|
|
140
187
|
|
|
141
188
|
return (
|
|
@@ -154,12 +201,20 @@ TertiaryPage = () => {
|
|
|
154
201
|
import React from 'react';
|
|
155
202
|
import {
|
|
156
203
|
Page,
|
|
157
|
-
|
|
158
|
-
|
|
204
|
+
Masthead,
|
|
205
|
+
MastheadToggle,
|
|
206
|
+
MastheadMain,
|
|
207
|
+
MastheadBrand,
|
|
208
|
+
MastheadContent,
|
|
159
209
|
PageSidebar,
|
|
160
210
|
PageSection,
|
|
161
|
-
PageSectionVariants
|
|
211
|
+
PageSectionVariants,
|
|
212
|
+
PageToggleButton,
|
|
213
|
+
Toolbar,
|
|
214
|
+
ToolbarContent,
|
|
215
|
+
ToolbarItem
|
|
162
216
|
} from '@patternfly/react-core';
|
|
217
|
+
import BarsIcon from '@patternfly/react-icons/dist/esm/icons/bars-icon';
|
|
163
218
|
|
|
164
219
|
class VerticalPage extends React.Component {
|
|
165
220
|
constructor(props) {
|
|
@@ -177,20 +232,33 @@ class VerticalPage extends React.Component {
|
|
|
177
232
|
render() {
|
|
178
233
|
const { isNavOpen } = this.state;
|
|
179
234
|
|
|
180
|
-
const
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
235
|
+
const headerToolbar = (
|
|
236
|
+
<Toolbar id="toolbar">
|
|
237
|
+
<ToolbarContent>
|
|
238
|
+
<ToolbarItem>header-tools</ToolbarItem>
|
|
239
|
+
</ToolbarContent>
|
|
240
|
+
</Toolbar>
|
|
241
|
+
);
|
|
242
|
+
|
|
185
243
|
const Header = (
|
|
186
|
-
<
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
244
|
+
<Masthead>
|
|
245
|
+
<MastheadToggle>
|
|
246
|
+
<PageToggleButton
|
|
247
|
+
variant="plain"
|
|
248
|
+
aria-label="Global navigation"
|
|
249
|
+
isNavOpen={isNavOpen}
|
|
250
|
+
onNavToggle={this.onNavToggle}
|
|
251
|
+
>
|
|
252
|
+
<BarsIcon />
|
|
253
|
+
</PageToggleButton>
|
|
254
|
+
</MastheadToggle>
|
|
255
|
+
<MastheadMain>
|
|
256
|
+
<MastheadBrand href="https://patternfly.org" onClick={() => console.log('clicked logo')} target="_blank">
|
|
257
|
+
Logo
|
|
258
|
+
</MastheadBrand>
|
|
259
|
+
</MastheadMain>
|
|
260
|
+
<MastheadContent>{headerToolbar}</MastheadContent>
|
|
261
|
+
</Masthead>
|
|
194
262
|
);
|
|
195
263
|
const Sidebar = <PageSidebar nav="Navigation" isNavOpen={isNavOpen} />;
|
|
196
264
|
|
|
@@ -218,12 +286,19 @@ class VerticalPage extends React.Component {
|
|
|
218
286
|
import React from 'react';
|
|
219
287
|
import {
|
|
220
288
|
Page,
|
|
221
|
-
|
|
222
|
-
|
|
289
|
+
Masthead,
|
|
290
|
+
MastheadToggle,
|
|
291
|
+
MastheadMain,
|
|
292
|
+
MastheadBrand,
|
|
293
|
+
MastheadContent,
|
|
223
294
|
PageSidebar,
|
|
224
295
|
PageSection,
|
|
225
|
-
|
|
296
|
+
PageToggleButton,
|
|
297
|
+
Toolbar,
|
|
298
|
+
ToolbarContent,
|
|
299
|
+
ToolbarItem
|
|
226
300
|
} from '@patternfly/react-core';
|
|
301
|
+
import BarsIcon from '@patternfly/react-icons/dist/esm/icons/bars-icon';
|
|
227
302
|
|
|
228
303
|
class FillPage extends React.Component {
|
|
229
304
|
constructor(props) {
|
|
@@ -241,20 +316,33 @@ class FillPage extends React.Component {
|
|
|
241
316
|
render() {
|
|
242
317
|
const { isNavOpen } = this.state;
|
|
243
318
|
|
|
244
|
-
const
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
319
|
+
const headerToolbar = (
|
|
320
|
+
<Toolbar id="toolbar">
|
|
321
|
+
<ToolbarContent>
|
|
322
|
+
<ToolbarItem>header-tools</ToolbarItem>
|
|
323
|
+
</ToolbarContent>
|
|
324
|
+
</Toolbar>
|
|
325
|
+
);
|
|
326
|
+
|
|
249
327
|
const Header = (
|
|
250
|
-
<
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
328
|
+
<Masthead>
|
|
329
|
+
<MastheadToggle>
|
|
330
|
+
<PageToggleButton
|
|
331
|
+
variant="plain"
|
|
332
|
+
aria-label="Global navigation"
|
|
333
|
+
isNavOpen={isNavOpen}
|
|
334
|
+
onNavToggle={this.onNavToggle}
|
|
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>
|
|
258
346
|
);
|
|
259
347
|
const Sidebar = <PageSidebar nav="Navigation" isNavOpen={isNavOpen} />;
|
|
260
348
|
|
|
@@ -280,27 +368,45 @@ class FillPage extends React.Component {
|
|
|
280
368
|
import React from 'react';
|
|
281
369
|
import {
|
|
282
370
|
Page,
|
|
283
|
-
|
|
284
|
-
|
|
371
|
+
Masthead,
|
|
372
|
+
MastheadToggle,
|
|
373
|
+
MastheadMain,
|
|
374
|
+
MastheadBrand,
|
|
375
|
+
MastheadContent,
|
|
285
376
|
PageSidebar,
|
|
286
377
|
PageSection,
|
|
287
|
-
PageSectionVariants
|
|
378
|
+
PageSectionVariants,
|
|
379
|
+
PageToggleButton,
|
|
380
|
+
Toolbar,
|
|
381
|
+
ToolbarContent,
|
|
382
|
+
ToolbarItem
|
|
288
383
|
} from '@patternfly/react-core';
|
|
384
|
+
import BarsIcon from '@patternfly/react-icons/dist/esm/icons/bars-icon';
|
|
289
385
|
|
|
290
386
|
class UncontrolledNavPage extends React.Component {
|
|
291
387
|
render() {
|
|
292
|
-
const
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
388
|
+
const headerToolbar = (
|
|
389
|
+
<Toolbar id="toolbar">
|
|
390
|
+
<ToolbarContent>
|
|
391
|
+
<ToolbarItem>header-tools</ToolbarItem>
|
|
392
|
+
</ToolbarContent>
|
|
393
|
+
</Toolbar>
|
|
394
|
+
);
|
|
395
|
+
|
|
297
396
|
const Header = (
|
|
298
|
-
<
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
397
|
+
<Masthead>
|
|
398
|
+
<MastheadToggle>
|
|
399
|
+
<PageToggleButton variant="plain" aria-label="Global navigation">
|
|
400
|
+
<BarsIcon />
|
|
401
|
+
</PageToggleButton>
|
|
402
|
+
</MastheadToggle>
|
|
403
|
+
<MastheadMain>
|
|
404
|
+
<MastheadBrand href="https://patternfly.org" onClick={() => console.log('clicked logo')} target="_blank">
|
|
405
|
+
Logo
|
|
406
|
+
</MastheadBrand>
|
|
407
|
+
</MastheadMain>
|
|
408
|
+
<MastheadContent>{headerToolbar}</MastheadContent>
|
|
409
|
+
</Masthead>
|
|
304
410
|
);
|
|
305
411
|
const Sidebar = <PageSidebar nav="Navigation" />;
|
|
306
412
|
|
|
@@ -321,20 +427,28 @@ class UncontrolledNavPage extends React.Component {
|
|
|
321
427
|
import React from 'react';
|
|
322
428
|
import {
|
|
323
429
|
Page,
|
|
324
|
-
|
|
325
|
-
|
|
430
|
+
Masthead,
|
|
431
|
+
MastheadToggle,
|
|
432
|
+
MastheadMain,
|
|
433
|
+
MastheadBrand,
|
|
434
|
+
MastheadContent,
|
|
326
435
|
PageSidebar,
|
|
327
436
|
PageSection,
|
|
328
437
|
PageGroup,
|
|
329
438
|
PageBreadcrumb,
|
|
330
439
|
PageNavigation,
|
|
331
440
|
PageSectionVariants,
|
|
441
|
+
PageToggleButton,
|
|
332
442
|
Breadcrumb,
|
|
333
443
|
BreadcrumbItem,
|
|
334
444
|
Nav,
|
|
335
445
|
NavList,
|
|
336
|
-
NavItem
|
|
446
|
+
NavItem,
|
|
447
|
+
Toolbar,
|
|
448
|
+
ToolbarContent,
|
|
449
|
+
ToolbarItem
|
|
337
450
|
} from '@patternfly/react-core';
|
|
451
|
+
import BarsIcon from '@patternfly/react-icons/dist/esm/icons/bars-icon';
|
|
338
452
|
|
|
339
453
|
class GroupPage extends React.Component {
|
|
340
454
|
constructor(props) {
|
|
@@ -352,20 +466,33 @@ class GroupPage extends React.Component {
|
|
|
352
466
|
render() {
|
|
353
467
|
const { isNavOpen } = this.state;
|
|
354
468
|
|
|
355
|
-
const
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
469
|
+
const headerToolbar = (
|
|
470
|
+
<Toolbar id="toolbar">
|
|
471
|
+
<ToolbarContent>
|
|
472
|
+
<ToolbarItem>header-tools</ToolbarItem>
|
|
473
|
+
</ToolbarContent>
|
|
474
|
+
</Toolbar>
|
|
475
|
+
);
|
|
476
|
+
|
|
360
477
|
const Header = (
|
|
361
|
-
<
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
478
|
+
<Masthead>
|
|
479
|
+
<MastheadToggle>
|
|
480
|
+
<PageToggleButton
|
|
481
|
+
variant="plain"
|
|
482
|
+
aria-label="Global navigation"
|
|
483
|
+
isNavOpen={isNavOpen}
|
|
484
|
+
onNavToggle={this.onNavToggle}
|
|
485
|
+
>
|
|
486
|
+
<BarsIcon />
|
|
487
|
+
</PageToggleButton>
|
|
488
|
+
</MastheadToggle>
|
|
489
|
+
<MastheadMain>
|
|
490
|
+
<MastheadBrand href="https://patternfly.org" onClick={() => console.log('clicked logo')} target="_blank">
|
|
491
|
+
Logo
|
|
492
|
+
</MastheadBrand>
|
|
493
|
+
</MastheadMain>
|
|
494
|
+
<MastheadContent>{headerToolbar}</MastheadContent>
|
|
495
|
+
</Masthead>
|
|
369
496
|
);
|
|
370
497
|
const Sidebar = <PageSidebar nav="Navigation" isNavOpen={isNavOpen} />;
|
|
371
498
|
|
|
@@ -404,3 +531,62 @@ class GroupPage extends React.Component {
|
|
|
404
531
|
}
|
|
405
532
|
}
|
|
406
533
|
```
|
|
534
|
+
|
|
535
|
+
### Vertical nav using PageHeader component
|
|
536
|
+
|
|
537
|
+
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.
|
|
538
|
+
|
|
539
|
+
```js
|
|
540
|
+
import React from 'react';
|
|
541
|
+
import {
|
|
542
|
+
Page,
|
|
543
|
+
PageHeader,
|
|
544
|
+
PageHeaderTools,
|
|
545
|
+
PageSidebar,
|
|
546
|
+
PageSection,
|
|
547
|
+
PageSectionVariants
|
|
548
|
+
} from '@patternfly/react-core';
|
|
549
|
+
|
|
550
|
+
class VerticalPage extends React.Component {
|
|
551
|
+
constructor(props) {
|
|
552
|
+
super(props);
|
|
553
|
+
this.state = {
|
|
554
|
+
isNavOpen: true
|
|
555
|
+
};
|
|
556
|
+
this.onNavToggle = () => {
|
|
557
|
+
this.setState({
|
|
558
|
+
isNavOpen: !this.state.isNavOpen
|
|
559
|
+
});
|
|
560
|
+
};
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
render() {
|
|
564
|
+
const { isNavOpen } = this.state;
|
|
565
|
+
|
|
566
|
+
const logoProps = {
|
|
567
|
+
href: 'https://patternfly.org',
|
|
568
|
+
onClick: () => console.log('clicked logo'),
|
|
569
|
+
target: '_blank'
|
|
570
|
+
};
|
|
571
|
+
const Header = (
|
|
572
|
+
<PageHeader
|
|
573
|
+
logo="Logo"
|
|
574
|
+
logoProps={logoProps}
|
|
575
|
+
headerTools={<PageHeaderTools>header-tools</PageHeaderTools>}
|
|
576
|
+
showNavToggle
|
|
577
|
+
isNavOpen={isNavOpen}
|
|
578
|
+
onNavToggle={this.onNavToggle}
|
|
579
|
+
/>
|
|
580
|
+
);
|
|
581
|
+
const Sidebar = <PageSidebar nav="Navigation" isNavOpen={isNavOpen} />;
|
|
582
|
+
|
|
583
|
+
return (
|
|
584
|
+
<Page header={Header} sidebar={Sidebar}>
|
|
585
|
+
<PageSection variant={PageSectionVariants.darker}>Section with darker background</PageSection>
|
|
586
|
+
<PageSection variant={PageSectionVariants.dark}>Section with dark background</PageSection>
|
|
587
|
+
<PageSection variant={PageSectionVariants.light}>Section with light background</PageSection>
|
|
588
|
+
</Page>
|
|
589
|
+
);
|
|
590
|
+
}
|
|
591
|
+
}
|
|
592
|
+
```
|
|
@@ -12,7 +12,7 @@ import { SelectMenu } from './SelectMenu';
|
|
|
12
12
|
import { SelectOption, SelectOptionObject } from './SelectOption';
|
|
13
13
|
import { SelectGroup, SelectGroupProps } from './SelectGroup';
|
|
14
14
|
import { SelectToggle } from './SelectToggle';
|
|
15
|
-
import { SelectContext, SelectVariant, SelectDirection, KeyTypes } from './selectConstants';
|
|
15
|
+
import { SelectContext, SelectVariant, SelectPosition, SelectDirection, KeyTypes } from './selectConstants';
|
|
16
16
|
import { Chip, ChipGroup, ChipGroupProps } from '../ChipGroup';
|
|
17
17
|
import { Spinner } from '../Spinner';
|
|
18
18
|
import {
|
|
@@ -46,6 +46,8 @@ export interface SelectProps
|
|
|
46
46
|
children?: React.ReactElement[];
|
|
47
47
|
/** Classes applied to the root of the Select */
|
|
48
48
|
className?: string;
|
|
49
|
+
/** Indicates where menu will be aligned horizontally */
|
|
50
|
+
position?: SelectPosition | 'right' | 'left';
|
|
49
51
|
/** Flag specifying which direction the Select menu expands */
|
|
50
52
|
direction?: 'up' | 'down';
|
|
51
53
|
/** Flag to indicate if select is open */
|
|
@@ -171,6 +173,7 @@ export class Select extends React.Component<SelectProps & OUIAProps, SelectState
|
|
|
171
173
|
static defaultProps: PickOptional<SelectProps> = {
|
|
172
174
|
children: [] as React.ReactElement[],
|
|
173
175
|
className: '',
|
|
176
|
+
position: SelectPosition.left,
|
|
174
177
|
direction: SelectDirection.down,
|
|
175
178
|
toggleId: null as string,
|
|
176
179
|
isOpen: false,
|
|
@@ -3,7 +3,7 @@ import styles from '@patternfly/react-styles/css/components/Select/select';
|
|
|
3
3
|
import formStyles from '@patternfly/react-styles/css/components/Form/form';
|
|
4
4
|
import { css } from '@patternfly/react-styles';
|
|
5
5
|
import { SelectOptionObject, SelectOption } from './SelectOption';
|
|
6
|
-
import { SelectConsumer, SelectVariant, SelectContextInterface } from './selectConstants';
|
|
6
|
+
import { SelectConsumer, SelectPosition, SelectVariant, SelectContextInterface } from './selectConstants';
|
|
7
7
|
import { PickOptional } from '../../helpers/typeUtils';
|
|
8
8
|
|
|
9
9
|
import { SelectGroup } from './SelectGroup';
|
|
@@ -28,6 +28,8 @@ export interface SelectMenuProps extends Omit<React.HTMLProps<HTMLElement>, 'che
|
|
|
28
28
|
openedOnEnter?: boolean;
|
|
29
29
|
/** Flag to specify the maximum height of the menu, as a string percentage or number of pixels */
|
|
30
30
|
maxHeight?: string | number;
|
|
31
|
+
/** Indicates where menu will be alligned horizontally */
|
|
32
|
+
position?: SelectPosition | 'right' | 'left';
|
|
31
33
|
/** Inner prop passed from parent */
|
|
32
34
|
noResultsFoundText?: string;
|
|
33
35
|
/** Inner prop passed from parent */
|
|
@@ -56,6 +58,7 @@ class SelectMenuWithRef extends React.Component<SelectMenuProps> {
|
|
|
56
58
|
openedOnEnter: false,
|
|
57
59
|
selected: '',
|
|
58
60
|
maxHeight: '',
|
|
61
|
+
position: SelectPosition.left,
|
|
59
62
|
sendRef: () => {},
|
|
60
63
|
keyHandler: () => {},
|
|
61
64
|
isCustomContent: false,
|
|
@@ -181,6 +184,7 @@ class SelectMenuWithRef extends React.Component<SelectMenuProps> {
|
|
|
181
184
|
selected,
|
|
182
185
|
checked,
|
|
183
186
|
isGrouped,
|
|
187
|
+
position,
|
|
184
188
|
sendRef,
|
|
185
189
|
keyHandler,
|
|
186
190
|
maxHeight,
|
|
@@ -199,7 +203,11 @@ class SelectMenuWithRef extends React.Component<SelectMenuProps> {
|
|
|
199
203
|
let Component = 'div';
|
|
200
204
|
const variantProps = {
|
|
201
205
|
ref: innerRef,
|
|
202
|
-
className: css(
|
|
206
|
+
className: css(
|
|
207
|
+
!footer ? styles.selectMenu : 'pf-c-select__menu-list',
|
|
208
|
+
position === SelectPosition.right && styles.modifiers.alignRight,
|
|
209
|
+
className
|
|
210
|
+
),
|
|
203
211
|
...(maxHeight && { style: { maxHeight, overflow: 'auto' } })
|
|
204
212
|
} as React.HTMLAttributes<HTMLElement>;
|
|
205
213
|
const extendedChildren = () =>
|