@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
|
@@ -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 ? '
|
|
79
|
+
aria-current={isCurrent && !children ? 'step' : false}
|
|
80
80
|
{...(isExpandable && { 'aria-expanded': isExpanded })}
|
|
81
81
|
>
|
|
82
82
|
{isExpandable ? (
|
|
@@ -66,8 +66,10 @@ BasicComposableMenu = () => {
|
|
|
66
66
|
const onToggleClick = ev => {
|
|
67
67
|
ev.stopPropagation(); // Stop handleClickOutside from handling
|
|
68
68
|
setTimeout(() => {
|
|
69
|
-
|
|
70
|
-
|
|
69
|
+
if (menuRef.current) {
|
|
70
|
+
const firstElement = menuRef.current.querySelector('li > button:not(:disabled)');
|
|
71
|
+
firstElement && firstElement.focus();
|
|
72
|
+
}
|
|
71
73
|
}, 0);
|
|
72
74
|
setIsOpen(!isOpen);
|
|
73
75
|
};
|
|
@@ -160,8 +162,10 @@ ActionComposableMenu = () => {
|
|
|
160
162
|
const onToggleClick = ev => {
|
|
161
163
|
ev.stopPropagation(); // Stop handleClickOutside from handling
|
|
162
164
|
setTimeout(() => {
|
|
163
|
-
|
|
164
|
-
|
|
165
|
+
if (menuRef.current) {
|
|
166
|
+
const firstElement = menuRef.current.querySelector('li > button:not(:disabled)');
|
|
167
|
+
firstElement && firstElement.focus();
|
|
168
|
+
}
|
|
165
169
|
}, 0);
|
|
166
170
|
setIsOpen(!isOpen);
|
|
167
171
|
};
|
|
@@ -267,8 +271,10 @@ SelectComposableMenu = () => {
|
|
|
267
271
|
const onToggleClick = ev => {
|
|
268
272
|
ev.stopPropagation(); // Stop handleClickOutside from handling
|
|
269
273
|
setTimeout(() => {
|
|
270
|
-
|
|
271
|
-
|
|
274
|
+
if (menuRef.current) {
|
|
275
|
+
const firstElement = menuRef.current.querySelector('li > button:not(:disabled)');
|
|
276
|
+
firstElement && firstElement.focus();
|
|
277
|
+
}
|
|
272
278
|
}, 0);
|
|
273
279
|
setIsOpen(!isOpen);
|
|
274
280
|
};
|
|
@@ -350,8 +356,10 @@ DrilldownComposableMenu = () => {
|
|
|
350
356
|
const onToggleClick = ev => {
|
|
351
357
|
ev.stopPropagation(); // Stop handleClickOutside from handling
|
|
352
358
|
setTimeout(() => {
|
|
353
|
-
|
|
354
|
-
|
|
359
|
+
if (menuRef.current) {
|
|
360
|
+
const firstElement = menuRef.current.querySelector('li > button:not(:disabled)');
|
|
361
|
+
firstElement && firstElement.focus();
|
|
362
|
+
}
|
|
355
363
|
}, 0);
|
|
356
364
|
setIsOpen(!isOpen);
|
|
357
365
|
setMenuDrilledIn([]);
|
|
@@ -731,8 +739,10 @@ FilterTreeComposableMenu = () => {
|
|
|
731
739
|
const onToggleClick = ev => {
|
|
732
740
|
ev.stopPropagation(); // Stop handleClickOutside from handling
|
|
733
741
|
setTimeout(() => {
|
|
734
|
-
|
|
735
|
-
|
|
742
|
+
if (menuRef.current) {
|
|
743
|
+
const firstElement = menuRef.current.querySelector('li > button:not(:disabled)');
|
|
744
|
+
firstElement && firstElement.focus();
|
|
745
|
+
}
|
|
736
746
|
}, 0);
|
|
737
747
|
setIsOpen(!isOpen);
|
|
738
748
|
};
|
|
@@ -841,8 +851,10 @@ MenuWithFlyout = () => {
|
|
|
841
851
|
const onToggleClick = ev => {
|
|
842
852
|
ev.stopPropagation(); // Stop handleClickOutside from handling
|
|
843
853
|
setTimeout(() => {
|
|
844
|
-
|
|
845
|
-
|
|
854
|
+
if (menuRef.current) {
|
|
855
|
+
const firstElement = menuRef.current.querySelector('li > button:not(:disabled)');
|
|
856
|
+
firstElement && firstElement.focus();
|
|
857
|
+
}
|
|
846
858
|
}, 0);
|
|
847
859
|
setIsOpen(!isOpen);
|
|
848
860
|
};
|
|
@@ -924,9 +936,11 @@ MenuAppLauncher = () => {
|
|
|
924
936
|
const onToggleClick = ev => {
|
|
925
937
|
ev.stopPropagation(); // Stop handleClickOutside from handling
|
|
926
938
|
setTimeout(() => {
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
939
|
+
if (menuRef.current) {
|
|
940
|
+
const firstElement = menuRef.current.querySelector('li > button,input:not(:disabled)');
|
|
941
|
+
firstElement && firstElement.focus();
|
|
942
|
+
setRefFullOptions(Array.from(menuRef.current.querySelectorAll('li:not(li[role=separator])')));
|
|
943
|
+
}
|
|
930
944
|
}, 0);
|
|
931
945
|
setIsOpen(!isOpen);
|
|
932
946
|
};
|
|
@@ -1242,8 +1256,10 @@ MenuContextSelector = () => {
|
|
|
1242
1256
|
const onToggleClick = ev => {
|
|
1243
1257
|
ev.stopPropagation(); // Stop handleClickOutside from handling
|
|
1244
1258
|
setTimeout(() => {
|
|
1245
|
-
|
|
1246
|
-
|
|
1259
|
+
if (menuRef.current) {
|
|
1260
|
+
const firstElement = menuRef.current.querySelector('li > button,input:not(:disabled)');
|
|
1261
|
+
firstElement && firstElement.focus();
|
|
1262
|
+
}
|
|
1247
1263
|
}, 0);
|
|
1248
1264
|
setIsOpen(!isOpen);
|
|
1249
1265
|
};
|
|
@@ -1321,3 +1337,95 @@ MenuContextSelector = () => {
|
|
|
1321
1337
|
return <Popper trigger={toggle} popper={menu} isVisible={isOpen} />;
|
|
1322
1338
|
};
|
|
1323
1339
|
```
|
|
1340
|
+
|
|
1341
|
+
### Options menu using menu components
|
|
1342
|
+
|
|
1343
|
+
```js
|
|
1344
|
+
import React from 'react';
|
|
1345
|
+
import {
|
|
1346
|
+
MenuToggle,
|
|
1347
|
+
Menu,
|
|
1348
|
+
MenuContent,
|
|
1349
|
+
MenuList,
|
|
1350
|
+
MenuItem,
|
|
1351
|
+
MenuGroup,
|
|
1352
|
+
Popper,
|
|
1353
|
+
Divider
|
|
1354
|
+
} from '@patternfly/react-core';
|
|
1355
|
+
|
|
1356
|
+
MenuOptionsMenu = () => {
|
|
1357
|
+
|
|
1358
|
+
const [isOpen, setIsOpen] = React.useState(false);
|
|
1359
|
+
const [selected, setSelected] = React.useState(undefined);
|
|
1360
|
+
const toggleRef = React.useRef();
|
|
1361
|
+
const menuRef = React.useRef();
|
|
1362
|
+
|
|
1363
|
+
const handleMenuKeys = event => {
|
|
1364
|
+
if (isOpen && menuRef.current.contains(event.target)) {
|
|
1365
|
+
if (event.key === 'Escape' || event.key === 'Tab') {
|
|
1366
|
+
setIsOpen(!isOpen);
|
|
1367
|
+
toggleRef.current.focus();
|
|
1368
|
+
}
|
|
1369
|
+
}
|
|
1370
|
+
};
|
|
1371
|
+
|
|
1372
|
+
const handleClickOutside = event => {
|
|
1373
|
+
if (isOpen && !menuRef.current.contains(event.target)) {
|
|
1374
|
+
setIsOpen(false);
|
|
1375
|
+
}
|
|
1376
|
+
};
|
|
1377
|
+
|
|
1378
|
+
React.useEffect(() => {
|
|
1379
|
+
window.addEventListener('keydown', handleMenuKeys);
|
|
1380
|
+
window.addEventListener('click', handleClickOutside);
|
|
1381
|
+
|
|
1382
|
+
return () => {
|
|
1383
|
+
window.removeEventListener('keydown', handleMenuKeys);
|
|
1384
|
+
window.removeEventListener('click', handleClickOutside);
|
|
1385
|
+
};
|
|
1386
|
+
}, [isOpen, menuRef]);
|
|
1387
|
+
|
|
1388
|
+
const onToggleClick = ev => {
|
|
1389
|
+
ev.stopPropagation(); // Stop handleClickOutside from handling
|
|
1390
|
+
setTimeout(() => {
|
|
1391
|
+
if (menuRef.current) {
|
|
1392
|
+
const firstElement = menuRef.current.querySelector('li > button,input:not(:disabled)');
|
|
1393
|
+
firstElement && firstElement.focus();
|
|
1394
|
+
}
|
|
1395
|
+
}, 0);
|
|
1396
|
+
setIsOpen(!isOpen);
|
|
1397
|
+
};
|
|
1398
|
+
|
|
1399
|
+
const toggle = (
|
|
1400
|
+
<MenuToggle ref={toggleRef} onClick={onToggleClick} isExpanded={isOpen}>
|
|
1401
|
+
Options menu
|
|
1402
|
+
</MenuToggle>
|
|
1403
|
+
);
|
|
1404
|
+
|
|
1405
|
+
const menu = (
|
|
1406
|
+
<Menu ref={menuRef} id="options-menu" selected={selected} onSelect={(_ev, itemId) => setSelected(itemId)}>
|
|
1407
|
+
<MenuContent>
|
|
1408
|
+
<MenuList>
|
|
1409
|
+
<MenuItem itemId={0}>Option 1</MenuItem>
|
|
1410
|
+
<MenuItem itemId={1} isDisabled>Disabled Option</MenuItem>
|
|
1411
|
+
<Divider key="group1-divider" />
|
|
1412
|
+
<MenuGroup label="Group 1">
|
|
1413
|
+
<MenuList>
|
|
1414
|
+
<MenuItem itemId={2}>Option 1</MenuItem>
|
|
1415
|
+
<MenuItem itemId={3}>Option 2</MenuItem>
|
|
1416
|
+
</MenuList>
|
|
1417
|
+
</MenuGroup>
|
|
1418
|
+
<Divider key="group2-divider" />
|
|
1419
|
+
<MenuGroup label="Group 2">
|
|
1420
|
+
<MenuList>
|
|
1421
|
+
<MenuItem itemId={4}>Option 1</MenuItem>
|
|
1422
|
+
<MenuItem itemId={5}>Option 2</MenuItem>
|
|
1423
|
+
</MenuList>
|
|
1424
|
+
</MenuGroup>
|
|
1425
|
+
</MenuList>
|
|
1426
|
+
</MenuContent>
|
|
1427
|
+
</Menu>
|
|
1428
|
+
);
|
|
1429
|
+
return <Popper trigger={toggle} popper={menu} isVisible={isOpen} />;
|
|
1430
|
+
};
|
|
1431
|
+
```
|
package/src/demos/Page/Page.md
CHANGED
|
@@ -7,8 +7,10 @@ import { css } from '@patternfly/react-styles';
|
|
|
7
7
|
import BellIcon from '@patternfly/react-icons/dist/esm/icons/bell-icon';
|
|
8
8
|
import CogIcon from '@patternfly/react-icons/dist/esm/icons/cog-icon';
|
|
9
9
|
import HelpIcon from '@patternfly/react-icons/dist/esm/icons/help-icon';
|
|
10
|
-
import imgBrand from '@patternfly/react-core/src/
|
|
10
|
+
import imgBrand from '@patternfly/react-core/src/demos/examples/pfColorLogo.svg';
|
|
11
11
|
import imgAvatar from '@patternfly/react-core/src/components/Avatar/examples/avatarImg.svg';
|
|
12
|
+
import BarsIcon from '@patternfly/react-icons/dist/esm/icons/bars-icon';
|
|
13
|
+
import AttentionBellIcon from '@patternfly/react-icons/dist/esm/icons/attention-bell-icon';
|
|
12
14
|
|
|
13
15
|
- All but the last example set the `isManagedSidebar` prop on the Page component to have the sidebar automatically close for smaller screen widths. You can also manually control this behavior by not adding the `isManagedSidebar` prop and instead:
|
|
14
16
|
|
|
@@ -25,6 +27,312 @@ This demonstrates a variety of navigation patterns in the context of a full page
|
|
|
25
27
|
|
|
26
28
|
### Sticky section group
|
|
27
29
|
|
|
30
|
+
```js isFullscreen
|
|
31
|
+
import React from 'react';
|
|
32
|
+
import {
|
|
33
|
+
Avatar,
|
|
34
|
+
Brand,
|
|
35
|
+
Breadcrumb,
|
|
36
|
+
BreadcrumbItem,
|
|
37
|
+
Button,
|
|
38
|
+
ButtonVariant,
|
|
39
|
+
Card,
|
|
40
|
+
CardBody,
|
|
41
|
+
Divider,
|
|
42
|
+
Dropdown,
|
|
43
|
+
DropdownGroup,
|
|
44
|
+
DropdownToggle,
|
|
45
|
+
DropdownItem,
|
|
46
|
+
DropdownSeparator,
|
|
47
|
+
Gallery,
|
|
48
|
+
GalleryItem,
|
|
49
|
+
KebabToggle,
|
|
50
|
+
Masthead,
|
|
51
|
+
MastheadBrand,
|
|
52
|
+
MastheadContent,
|
|
53
|
+
MastheadMain,
|
|
54
|
+
MastheadToggle,
|
|
55
|
+
Nav,
|
|
56
|
+
NavItem,
|
|
57
|
+
NavList,
|
|
58
|
+
Page,
|
|
59
|
+
PageSection,
|
|
60
|
+
PageSectionVariants,
|
|
61
|
+
PageSidebar,
|
|
62
|
+
PageToggleButton,
|
|
63
|
+
SkipToContent,
|
|
64
|
+
TextContent,
|
|
65
|
+
Text,
|
|
66
|
+
Toolbar,
|
|
67
|
+
ToolbarContent,
|
|
68
|
+
ToolbarGroup,
|
|
69
|
+
ToolbarItem
|
|
70
|
+
} from '@patternfly/react-core';
|
|
71
|
+
import { css } from '@patternfly/react-styles';
|
|
72
|
+
import BellIcon from '@patternfly/react-icons/dist/esm/icons/bell-icon';
|
|
73
|
+
import CogIcon from '@patternfly/react-icons/dist/esm/icons/cog-icon';
|
|
74
|
+
import HelpIcon from '@patternfly/react-icons/dist/esm/icons/help-icon';
|
|
75
|
+
import AttentionBellIcon from '@patternfly/react-icons/dist/esm/icons/attention-bell-icon';
|
|
76
|
+
import BarsIcon from '@patternfly/react-icons/dist/js/icons/bars-icon';
|
|
77
|
+
import imgBrand from './imgBrand.svg';
|
|
78
|
+
import imgAvatar from './imgAvatar.svg';
|
|
79
|
+
|
|
80
|
+
class PageLayoutGrouped extends React.Component {
|
|
81
|
+
constructor(props) {
|
|
82
|
+
super(props);
|
|
83
|
+
this.state = {
|
|
84
|
+
isDropdownOpen: false,
|
|
85
|
+
isKebabDropdownOpen: false,
|
|
86
|
+
isFullKebabDropdownOpen: false,
|
|
87
|
+
activeItem: 0
|
|
88
|
+
};
|
|
89
|
+
this.onDropdownToggle = isDropdownOpen => {
|
|
90
|
+
this.setState({
|
|
91
|
+
isDropdownOpen
|
|
92
|
+
});
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
this.onDropdownSelect = event => {
|
|
96
|
+
this.setState({
|
|
97
|
+
isDropdownOpen: !this.state.isDropdownOpen
|
|
98
|
+
});
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
this.onKebabDropdownToggle = isKebabDropdownOpen => {
|
|
102
|
+
this.setState({
|
|
103
|
+
isKebabDropdownOpen
|
|
104
|
+
});
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
this.onKebabDropdownSelect = event => {
|
|
108
|
+
this.setState({
|
|
109
|
+
isKebabDropdownOpen: !this.state.isKebabDropdownOpen
|
|
110
|
+
});
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
this.onNavSelect = result => {
|
|
114
|
+
this.setState({
|
|
115
|
+
activeItem: result.itemId
|
|
116
|
+
});
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
this.onFullKebabToggle = isFullKebabDropdownOpen => {
|
|
120
|
+
this.setState({
|
|
121
|
+
isFullKebabDropdownOpen
|
|
122
|
+
});
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
this.onFullKebabSelect = () => {
|
|
126
|
+
this.setState({
|
|
127
|
+
isFullKebabDropdownOpen: !this.state.isFullKebabDropdownOpen
|
|
128
|
+
});
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
render() {
|
|
133
|
+
const { isDropdownOpen, isKebabDropdownOpen, activeItem, isFullKebabDropdownOpen } = this.state;
|
|
134
|
+
|
|
135
|
+
const PageNav = (
|
|
136
|
+
<Nav variant="tertiary" onSelect={this.onNavSelect} aria-label="Nav">
|
|
137
|
+
<NavList>
|
|
138
|
+
<NavItem href="#" itemId={0} isActive={activeItem === 0}>
|
|
139
|
+
System panel
|
|
140
|
+
</NavItem>
|
|
141
|
+
<NavItem href="#" itemId={1} isActive={activeItem === 1}>
|
|
142
|
+
Policy
|
|
143
|
+
</NavItem>
|
|
144
|
+
<NavItem href="#" itemId={2} isActive={activeItem === 2}>
|
|
145
|
+
Authentication
|
|
146
|
+
</NavItem>
|
|
147
|
+
<NavItem href="#" itemId={3} isActive={activeItem === 3}>
|
|
148
|
+
Network services
|
|
149
|
+
</NavItem>
|
|
150
|
+
<NavItem href="#" itemId={4} isActive={activeItem === 4}>
|
|
151
|
+
Server
|
|
152
|
+
</NavItem>
|
|
153
|
+
</NavList>
|
|
154
|
+
</Nav>
|
|
155
|
+
);
|
|
156
|
+
|
|
157
|
+
const kebabDropdownItems = [
|
|
158
|
+
<DropdownItem>
|
|
159
|
+
<CogIcon /> Settings
|
|
160
|
+
</DropdownItem>,
|
|
161
|
+
<DropdownItem>
|
|
162
|
+
<HelpIcon /> Help
|
|
163
|
+
</DropdownItem>
|
|
164
|
+
];
|
|
165
|
+
|
|
166
|
+
const userDropdownItems = [
|
|
167
|
+
<DropdownGroup key="group 2">
|
|
168
|
+
<DropdownItem key="group 2 profile">My profile</DropdownItem>
|
|
169
|
+
<DropdownItem key="group 2 user" component="button">
|
|
170
|
+
User management
|
|
171
|
+
</DropdownItem>
|
|
172
|
+
<DropdownItem key="group 2 logout">Logout</DropdownItem>
|
|
173
|
+
</DropdownGroup>
|
|
174
|
+
];
|
|
175
|
+
|
|
176
|
+
const fullKebabItems = [
|
|
177
|
+
<DropdownGroup key="group 2">
|
|
178
|
+
<DropdownItem key="group 2 profile">My profile</DropdownItem>
|
|
179
|
+
<DropdownItem key="group 2 user" component="button">
|
|
180
|
+
User management
|
|
181
|
+
</DropdownItem>
|
|
182
|
+
<DropdownItem key="group 2 logout">Logout</DropdownItem>
|
|
183
|
+
</DropdownGroup>,
|
|
184
|
+
<Divider key="divider" />,
|
|
185
|
+
<DropdownItem key="kebab-1">
|
|
186
|
+
<CogIcon /> Settings
|
|
187
|
+
</DropdownItem>,
|
|
188
|
+
<DropdownItem key="kebab-2">
|
|
189
|
+
<HelpIcon /> Help
|
|
190
|
+
</DropdownItem>
|
|
191
|
+
];
|
|
192
|
+
|
|
193
|
+
const headerToolbar = (
|
|
194
|
+
<Toolbar id="toolbar" isFullHeight isStatic>
|
|
195
|
+
<ToolbarContent>
|
|
196
|
+
<ToolbarGroup
|
|
197
|
+
variant="icon-button-group"
|
|
198
|
+
alignment={{ default: 'alignRight' }}
|
|
199
|
+
spacer={{ default: 'spacerNone', md: 'spacerMd' }}
|
|
200
|
+
>
|
|
201
|
+
<ToolbarItem>
|
|
202
|
+
<Button aria-label="Notifications" variant={ButtonVariant.plain}>
|
|
203
|
+
<AttentionBellIcon />
|
|
204
|
+
</Button>
|
|
205
|
+
</ToolbarItem>
|
|
206
|
+
<ToolbarGroup variant="icon-button-group" visibility={{ default: 'hidden', lg: 'visible' }}>
|
|
207
|
+
<ToolbarItem>
|
|
208
|
+
<Button aria-label="Settings actions" variant={ButtonVariant.plain}>
|
|
209
|
+
<CogIcon />
|
|
210
|
+
</Button>
|
|
211
|
+
</ToolbarItem>
|
|
212
|
+
<ToolbarItem>
|
|
213
|
+
<Button aria-label="Help actions" variant={ButtonVariant.plain}>
|
|
214
|
+
<HelpIcon />
|
|
215
|
+
</Button>
|
|
216
|
+
</ToolbarItem>
|
|
217
|
+
</ToolbarGroup>
|
|
218
|
+
<ToolbarItem visibility={{ default: 'hidden', md: 'visible', lg: 'hidden' }}>
|
|
219
|
+
<Dropdown
|
|
220
|
+
isPlain
|
|
221
|
+
position="right"
|
|
222
|
+
onSelect={this.onKebabDropdownSelect}
|
|
223
|
+
toggle={<KebabToggle onToggle={this.onKebabDropdownToggle} />}
|
|
224
|
+
isOpen={isKebabDropdownOpen}
|
|
225
|
+
dropdownItems={kebabDropdownItems}
|
|
226
|
+
/>
|
|
227
|
+
</ToolbarItem>
|
|
228
|
+
<ToolbarItem visibility={{ default: 'visible', md: 'hidden', lg: 'hidden', xl: 'hidden', '2xl': 'hidden' }}>
|
|
229
|
+
<Dropdown
|
|
230
|
+
isPlain
|
|
231
|
+
position="right"
|
|
232
|
+
onSelect={this.onFullKebabSelect}
|
|
233
|
+
toggle={<KebabToggle onToggle={this.onFullKebabToggle} />}
|
|
234
|
+
isOpen={isFullKebabDropdownOpen}
|
|
235
|
+
dropdownItems={fullKebabItems}
|
|
236
|
+
/>
|
|
237
|
+
</ToolbarItem>
|
|
238
|
+
</ToolbarGroup>
|
|
239
|
+
<ToolbarItem visibility={{ default: 'hidden', md: 'visible' }}>
|
|
240
|
+
<Dropdown
|
|
241
|
+
position="right"
|
|
242
|
+
onSelect={this.onDropdownSelect}
|
|
243
|
+
isOpen={isDropdownOpen}
|
|
244
|
+
toggle={
|
|
245
|
+
<DropdownToggle icon={<Avatar src={imgAvatar} alt="Avatar" />} onToggle={this.onDropdownToggle}>
|
|
246
|
+
John Smith
|
|
247
|
+
</DropdownToggle>
|
|
248
|
+
}
|
|
249
|
+
dropdownItems={userDropdownItems}
|
|
250
|
+
/>
|
|
251
|
+
</ToolbarItem>
|
|
252
|
+
</ToolbarContent>
|
|
253
|
+
</Toolbar>
|
|
254
|
+
);
|
|
255
|
+
|
|
256
|
+
const Header = (
|
|
257
|
+
<Masthead>
|
|
258
|
+
<MastheadToggle>
|
|
259
|
+
<PageToggleButton variant="plain" aria-label="Global navigation">
|
|
260
|
+
<BarsIcon />
|
|
261
|
+
</PageToggleButton>
|
|
262
|
+
</MastheadToggle>
|
|
263
|
+
<MastheadMain>
|
|
264
|
+
<MastheadBrand>
|
|
265
|
+
<Brand src={imgBrand} alt="Patternfly Logo" />
|
|
266
|
+
</MastheadBrand>
|
|
267
|
+
</MastheadMain>
|
|
268
|
+
<MastheadContent>{headerToolbar}</MastheadContent>
|
|
269
|
+
</Masthead>
|
|
270
|
+
);
|
|
271
|
+
|
|
272
|
+
const pageId = 'main-content-page-layout-tertiary-nav';
|
|
273
|
+
const PageSkipToContent = <SkipToContent href={`#${pageId}`}>Skip to content</SkipToContent>;
|
|
274
|
+
|
|
275
|
+
const PageBreadcrumb = (
|
|
276
|
+
<Breadcrumb>
|
|
277
|
+
<BreadcrumbItem>Section home</BreadcrumbItem>
|
|
278
|
+
<BreadcrumbItem to="#">Section title</BreadcrumbItem>
|
|
279
|
+
<BreadcrumbItem to="#">Section title</BreadcrumbItem>
|
|
280
|
+
<BreadcrumbItem to="#" isActive>
|
|
281
|
+
Section landing
|
|
282
|
+
</BreadcrumbItem>
|
|
283
|
+
</Breadcrumb>
|
|
284
|
+
);
|
|
285
|
+
|
|
286
|
+
return (
|
|
287
|
+
<React.Fragment>
|
|
288
|
+
<Page
|
|
289
|
+
header={Header}
|
|
290
|
+
breadcrumb={PageBreadcrumb}
|
|
291
|
+
tertiaryNav={PageNav}
|
|
292
|
+
isManagedSidebar
|
|
293
|
+
isTertiaryNavWidthLimited
|
|
294
|
+
isBreadcrumbWidthLimited
|
|
295
|
+
skipToContent={PageSkipToContent}
|
|
296
|
+
mainContainerId={pageId}
|
|
297
|
+
isTertiaryNavGrouped
|
|
298
|
+
isBreadcrumbGrouped
|
|
299
|
+
additionalGroupedContent={
|
|
300
|
+
<PageSection variant={PageSectionVariants.light}>
|
|
301
|
+
<TextContent>
|
|
302
|
+
<Text component="h1">Main title</Text>
|
|
303
|
+
<Text component="p">
|
|
304
|
+
Body text should be Overpass Regular at 16px. It should have leading of 24px because <br />
|
|
305
|
+
of its relative line height of 1.5.
|
|
306
|
+
</Text>
|
|
307
|
+
</TextContent>
|
|
308
|
+
</PageSection>
|
|
309
|
+
}
|
|
310
|
+
groupProps={{
|
|
311
|
+
sticky: 'top'
|
|
312
|
+
}}
|
|
313
|
+
>
|
|
314
|
+
<PageSection>
|
|
315
|
+
<Gallery hasGutter>
|
|
316
|
+
{Array.apply(0, Array(20)).map((x, i) => (
|
|
317
|
+
<GalleryItem key={i}>
|
|
318
|
+
<Card>
|
|
319
|
+
<CardBody>This is a card</CardBody>
|
|
320
|
+
</Card>
|
|
321
|
+
</GalleryItem>
|
|
322
|
+
))}
|
|
323
|
+
</Gallery>
|
|
324
|
+
</PageSection>
|
|
325
|
+
</Page>
|
|
326
|
+
</React.Fragment>
|
|
327
|
+
);
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
```
|
|
331
|
+
|
|
332
|
+
### Sticky section group (using PageHeader)
|
|
333
|
+
|
|
334
|
+
This demo 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.
|
|
335
|
+
|
|
28
336
|
```js isFullscreen
|
|
29
337
|
import React from 'react';
|
|
30
338
|
import {
|
|
@@ -111,19 +419,19 @@ class PageLayoutGrouped extends React.Component {
|
|
|
111
419
|
const PageNav = (
|
|
112
420
|
<Nav variant="tertiary" onSelect={this.onNavSelect} aria-label="Nav">
|
|
113
421
|
<NavList>
|
|
114
|
-
<NavItem itemId={0} isActive={activeItem === 0}>
|
|
422
|
+
<NavItem href="#" itemId={0} isActive={activeItem === 0}>
|
|
115
423
|
System panel
|
|
116
424
|
</NavItem>
|
|
117
|
-
<NavItem itemId={1} isActive={activeItem === 1}>
|
|
425
|
+
<NavItem href="#" itemId={1} isActive={activeItem === 1}>
|
|
118
426
|
Policy
|
|
119
427
|
</NavItem>
|
|
120
|
-
<NavItem itemId={2} isActive={activeItem === 2}>
|
|
428
|
+
<NavItem href="#" itemId={2} isActive={activeItem === 2}>
|
|
121
429
|
Authentication
|
|
122
430
|
</NavItem>
|
|
123
|
-
<NavItem itemId={3} isActive={activeItem === 3}>
|
|
431
|
+
<NavItem href="#" itemId={3} isActive={activeItem === 3}>
|
|
124
432
|
Network services
|
|
125
433
|
</NavItem>
|
|
126
|
-
<NavItem itemId={4} isActive={activeItem === 4}>
|
|
434
|
+
<NavItem href="#" itemId={4} isActive={activeItem === 4}>
|
|
127
435
|
Server
|
|
128
436
|
</NavItem>
|
|
129
437
|
</NavList>
|
|
@@ -260,7 +568,9 @@ class PageLayoutGrouped extends React.Component {
|
|
|
260
568
|
}
|
|
261
569
|
```
|
|
262
570
|
|
|
263
|
-
### Sticky section group (alternate syntax)
|
|
571
|
+
### Sticky section group (alternate syntax and using PageHeader)
|
|
572
|
+
|
|
573
|
+
Please see <a href="#sticky-section-group-using-pageheader">this</a> note regarding PageHeader.
|
|
264
574
|
|
|
265
575
|
```js isFullscreen
|
|
266
576
|
import React from 'react';
|
|
@@ -429,19 +739,19 @@ class PageLayoutGroupedAlt extends React.Component {
|
|
|
429
739
|
<PageNavigation isWidthLimited>
|
|
430
740
|
<Nav variant="tertiary" onSelect={this.onNavSelect} aria-label="Nav">
|
|
431
741
|
<NavList>
|
|
432
|
-
<NavItem itemId={0} isActive={activeItem === 0}>
|
|
742
|
+
<NavItem href="#" itemId={0} isActive={activeItem === 0}>
|
|
433
743
|
System panel
|
|
434
744
|
</NavItem>
|
|
435
|
-
<NavItem itemId={1} isActive={activeItem === 1}>
|
|
745
|
+
<NavItem href="#" itemId={1} isActive={activeItem === 1}>
|
|
436
746
|
Policy
|
|
437
747
|
</NavItem>
|
|
438
|
-
<NavItem itemId={2} isActive={activeItem === 2}>
|
|
748
|
+
<NavItem href="#" itemId={2} isActive={activeItem === 2}>
|
|
439
749
|
Authentication
|
|
440
750
|
</NavItem>
|
|
441
|
-
<NavItem itemId={3} isActive={activeItem === 3}>
|
|
751
|
+
<NavItem href="#" itemId={3} isActive={activeItem === 3}>
|
|
442
752
|
Network services
|
|
443
753
|
</NavItem>
|
|
444
|
-
<NavItem itemId={4} isActive={activeItem === 4}>
|
|
754
|
+
<NavItem href="#" itemId={4} isActive={activeItem === 4}>
|
|
445
755
|
Server
|
|
446
756
|
</NavItem>
|
|
447
757
|
</NavList>
|