@patternfly/react-core 4.232.5 → 4.232.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/CHANGELOG.md +24 -0
- package/dist/esm/components/Page/Page.d.ts +1 -1
- package/dist/esm/components/Page/Page.d.ts.map +1 -1
- package/dist/js/components/Page/Page.d.ts +1 -1
- package/dist/js/components/Page/Page.d.ts.map +1 -1
- package/dist/styles/base-no-reset.css +1 -1
- package/dist/styles/base.css +1 -1
- package/dist/umd/react-core.css +91 -86
- package/dist/umd/react-core.js +1 -0
- package/dist/umd/react-core.min.css +111 -106
- package/dist/umd/react-core.min.js +1 -1
- package/package.json +7 -7
- package/src/components/Nav/examples/Nav.md +10 -626
- package/src/components/Nav/examples/NavDefault.tsx +29 -0
- package/src/components/Nav/examples/NavDrilldown.tsx +20 -15
- package/src/components/Nav/examples/NavExpandable.tsx +119 -0
- package/src/components/Nav/examples/NavExpandableThirdLevel.tsx +115 -0
- package/src/components/Nav/examples/NavFlyout.tsx +102 -0
- package/src/components/Nav/examples/NavGrouped.tsx +67 -0
- package/src/components/Nav/examples/NavHorizontalPageHeader.tsx +34 -0
- package/src/components/Nav/examples/NavHorizontalSubNav.tsx +32 -0
- package/src/components/Nav/examples/NavLegacyTertiary.tsx +32 -0
- package/src/components/Nav/examples/NavMixed.tsx +101 -0
- package/src/components/Page/Page.tsx +1 -1
- package/src/components/Popover/examples/Popover.md +10 -293
- package/src/components/Popover/examples/PopoverAdvanced.tsx +79 -0
- package/src/components/Popover/examples/PopoverAlert.tsx +47 -0
- package/src/components/Popover/examples/PopoverBasic.tsx +15 -0
- package/src/components/Popover/examples/PopoverCloseControlled.tsx +29 -0
- package/src/components/Popover/examples/PopoverCloseUncontrolled.tsx +25 -0
- package/src/components/Popover/examples/PopoverReactRef.tsx +23 -0
- package/src/components/Popover/examples/PopoverSelectorRef.tsx +19 -0
- package/src/components/Popover/examples/PopoverWidthAuto.tsx +14 -0
- package/src/components/Popover/examples/PopoverWithIconInTheTitle.tsx +17 -0
- package/src/components/Popover/examples/PopoverWithoutHeaderFooterCloseNoPadding.tsx +21 -0
- package/src/components/Progress/examples/Progress.md +18 -117
- package/src/components/Progress/examples/ProgressBasic.tsx +4 -0
- package/src/components/Progress/examples/ProgressFailure.tsx +6 -0
- package/src/components/Progress/examples/ProgressFailureWithoutMeasure.tsx +6 -0
- package/src/components/Progress/examples/ProgressFiniteStep.tsx +14 -0
- package/src/components/Progress/examples/ProgressInside.tsx +6 -0
- package/src/components/Progress/examples/ProgressInsideSuccess.tsx +11 -0
- package/src/components/Progress/examples/ProgressLarge.tsx +6 -0
- package/src/components/Progress/examples/ProgressOutside.tsx +6 -0
- package/src/components/Progress/examples/ProgressOutsideFailure.tsx +11 -0
- package/src/components/Progress/examples/ProgressSingleLine.tsx +6 -0
- package/src/components/Progress/examples/ProgressSmall.tsx +6 -0
- package/src/components/Progress/examples/ProgressStepInstruction.tsx +6 -0
- package/src/components/Progress/examples/ProgressSuccess.tsx +6 -0
- package/src/components/Progress/examples/ProgressTitleOutsideOfProgressBar.tsx +24 -0
- package/src/components/Progress/examples/ProgressTruncateTitle.tsx +10 -0
- package/src/components/Progress/examples/ProgressWarning.tsx +6 -0
- package/src/components/Progress/examples/ProgressWithoutMeasure.tsx +6 -0
|
@@ -12,667 +12,51 @@ import './nav.css';
|
|
|
12
12
|
|
|
13
13
|
### Default
|
|
14
14
|
|
|
15
|
-
```
|
|
16
|
-
import React from 'react';
|
|
17
|
-
import { Nav, NavExpandable, NavItem, NavItemSeparator, NavList, NavGroup } from '@patternfly/react-core';
|
|
18
|
-
|
|
19
|
-
class NavDefaultList extends React.Component {
|
|
20
|
-
constructor(props) {
|
|
21
|
-
super(props);
|
|
22
|
-
this.state = {
|
|
23
|
-
activeItem: 0
|
|
24
|
-
};
|
|
25
|
-
this.onSelect = result => {
|
|
26
|
-
this.setState({
|
|
27
|
-
activeItem: result.itemId
|
|
28
|
-
});
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
render() {
|
|
33
|
-
const { activeItem } = this.state;
|
|
34
|
-
return (
|
|
35
|
-
<Nav onSelect={this.onSelect} aria-label="Default global nav">
|
|
36
|
-
<NavList>
|
|
37
|
-
<NavItem id="default-link1" to="#default-link1" itemId={0} isActive={activeItem === 0}>
|
|
38
|
-
Default Link 1
|
|
39
|
-
</NavItem>
|
|
40
|
-
<NavItem id="default-link2" to="#default-link2" itemId={1} isActive={activeItem === 1}>
|
|
41
|
-
Default Link 2
|
|
42
|
-
</NavItem>
|
|
43
|
-
<NavItem id="default-link3" to="#default-link3" itemId={2} isActive={activeItem === 2}>
|
|
44
|
-
Default Link 3
|
|
45
|
-
</NavItem>
|
|
46
|
-
<NavItem id="default-link4" to="#default-link4" itemId={3} isActive={activeItem === 3}>
|
|
47
|
-
Default Link 4
|
|
48
|
-
</NavItem>
|
|
49
|
-
</NavList>
|
|
50
|
-
</Nav>
|
|
51
|
-
);
|
|
52
|
-
}
|
|
53
|
-
}
|
|
15
|
+
```ts file="./NavDefault.tsx"
|
|
54
16
|
```
|
|
55
17
|
|
|
56
18
|
### Grouped
|
|
57
19
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
```js
|
|
61
|
-
import React from 'react';
|
|
62
|
-
import { Nav, NavExpandable, NavItem, NavItemSeparator, NavList, NavGroup } from '@patternfly/react-core';
|
|
63
|
-
|
|
64
|
-
class NavGroupedList extends React.Component {
|
|
65
|
-
constructor(props) {
|
|
66
|
-
super(props);
|
|
67
|
-
this.state = {
|
|
68
|
-
activeItem: 'grp-1_itm-1'
|
|
69
|
-
};
|
|
70
|
-
this.onSelect = result => {
|
|
71
|
-
this.setState({
|
|
72
|
-
activeItem: result.itemId
|
|
73
|
-
});
|
|
74
|
-
};
|
|
75
|
-
}
|
|
20
|
+
The following example shows two navigation groups, each with a `title` prop passed into the nav group component. To keep nav groups accessible an `aria-label` must be passed in if the `title` prop is not passed in.
|
|
76
21
|
|
|
77
|
-
|
|
78
|
-
const { activeItem } = this.state;
|
|
79
|
-
return (
|
|
80
|
-
<Nav onSelect={this.onSelect} aria-label="Grouped global nav">
|
|
81
|
-
<NavGroup title="Section title 1">
|
|
82
|
-
<NavItem preventDefault to="#grouped-1" itemId="grp-1_itm-1" isActive={activeItem === 'grp-1_itm-1'}>
|
|
83
|
-
Group 1 Link 1
|
|
84
|
-
</NavItem>
|
|
85
|
-
<NavItem preventDefault to="#grouped-2" itemId="grp-1_itm-2" isActive={activeItem === 'grp-1_itm-2'}>
|
|
86
|
-
Group 1 Link 2
|
|
87
|
-
</NavItem>
|
|
88
|
-
<NavItem preventDefault to="#grouped-3" itemId="grp-1_itm-3" isActive={activeItem === 'grp-1_itm-3'}>
|
|
89
|
-
Group 1 Link 3
|
|
90
|
-
</NavItem>
|
|
91
|
-
</NavGroup>
|
|
92
|
-
<NavGroup title="Section title 2">
|
|
93
|
-
<NavItem preventDefault to="#grouped-4" itemId="grp-2_itm-1" isActive={activeItem === 'grp-2_itm-1'}>
|
|
94
|
-
Group 2 Link 1
|
|
95
|
-
</NavItem>
|
|
96
|
-
<NavItem preventDefault to="#grouped-5" itemId="grp-2_itm-2" isActive={activeItem === 'grp-2_itm-2'}>
|
|
97
|
-
Group 2 Link 2
|
|
98
|
-
</NavItem>
|
|
99
|
-
<NavItem preventDefault to="#grouped-6" itemId="grp-2_itm-3" isActive={activeItem === 'grp-2_itm-3'}>
|
|
100
|
-
Group 2 Link 3
|
|
101
|
-
</NavItem>
|
|
102
|
-
</NavGroup>
|
|
103
|
-
</Nav>
|
|
104
|
-
);
|
|
105
|
-
}
|
|
106
|
-
}
|
|
22
|
+
```ts file="./NavGrouped.tsx"
|
|
107
23
|
```
|
|
108
24
|
|
|
109
25
|
### Expandable
|
|
110
26
|
|
|
111
|
-
```
|
|
112
|
-
import React from 'react';
|
|
113
|
-
import { Nav, NavExpandable, NavItem, NavItemSeparator, NavList, NavGroup } from '@patternfly/react-core';
|
|
114
|
-
|
|
115
|
-
class NavExpandableList extends React.Component {
|
|
116
|
-
constructor(props) {
|
|
117
|
-
super(props);
|
|
118
|
-
this.state = {
|
|
119
|
-
activeGroup: 'grp-1',
|
|
120
|
-
activeItem: 'grp-1_itm-1'
|
|
121
|
-
};
|
|
122
|
-
this.onSelect = result => {
|
|
123
|
-
this.setState({
|
|
124
|
-
activeGroup: result.groupId,
|
|
125
|
-
activeItem: result.itemId
|
|
126
|
-
});
|
|
127
|
-
};
|
|
128
|
-
this.onToggle = result => {
|
|
129
|
-
// eslint-disable-next-line no-console
|
|
130
|
-
console.log(`Group ${result.groupId} expanded? ${result.isExpanded}`);
|
|
131
|
-
};
|
|
132
|
-
this.handleItemOnclick = (event, itemId, groupId) => {
|
|
133
|
-
// eslint-disable-next-line no-console
|
|
134
|
-
console.log(`my own click handler on ${itemId}`);
|
|
135
|
-
};
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
render() {
|
|
139
|
-
const { activeGroup, activeItem } = this.state;
|
|
140
|
-
return (
|
|
141
|
-
<Nav onSelect={this.onSelect} onToggle={this.onToggle} aria-label="Expandable global nav">
|
|
142
|
-
<NavList>
|
|
143
|
-
<NavExpandable title="Expandable Group 1" groupId="grp-1" isActive={activeGroup === 'grp-1'} isExpanded>
|
|
144
|
-
<NavItem
|
|
145
|
-
preventDefault
|
|
146
|
-
to="#expandable-1"
|
|
147
|
-
groupId="grp-1"
|
|
148
|
-
itemId="grp-1_itm-1"
|
|
149
|
-
isActive={activeItem === 'grp-1_itm-1'}
|
|
150
|
-
>
|
|
151
|
-
Subnav 1 Link 1
|
|
152
|
-
</NavItem>
|
|
153
|
-
<NavItemSeparator />
|
|
154
|
-
<NavItem preventDefault groupId="grp-1" itemId="grp-1_itm-2" isActive={activeItem === 'grp-1_itm-2'}>
|
|
155
|
-
Subnav 1 Link 2
|
|
156
|
-
</NavItem>
|
|
157
|
-
<NavItem to="#expandable-3" groupId="grp-1" itemId="grp-1_itm-3" isActive={activeItem === 'grp-1_itm-3'}>
|
|
158
|
-
Subnav 1 Link 3
|
|
159
|
-
</NavItem>
|
|
160
|
-
</NavExpandable>
|
|
161
|
-
<NavExpandable title="Expandable Group 2" groupId="grp-2" isActive={activeGroup === 'grp-2'} isExpanded>
|
|
162
|
-
<NavItem
|
|
163
|
-
preventDefault
|
|
164
|
-
onClick={this.handleItemOnclick}
|
|
165
|
-
groupId="grp-2"
|
|
166
|
-
itemId="own-item-handler"
|
|
167
|
-
isActive={activeItem === 'own-item-handler'}
|
|
168
|
-
>
|
|
169
|
-
Custom onClick
|
|
170
|
-
</NavItem>
|
|
171
|
-
<NavItem
|
|
172
|
-
preventDefault
|
|
173
|
-
to="#expandable-4"
|
|
174
|
-
groupId="grp-2"
|
|
175
|
-
itemId="grp-2_itm-1"
|
|
176
|
-
isActive={activeItem === 'grp-2_itm-1'}
|
|
177
|
-
>
|
|
178
|
-
Subnav 2 Link 1
|
|
179
|
-
</NavItem>
|
|
180
|
-
<NavItem
|
|
181
|
-
preventDefault
|
|
182
|
-
to="#expandable-5"
|
|
183
|
-
groupId="grp-2"
|
|
184
|
-
itemId="grp-2_itm-2"
|
|
185
|
-
isActive={activeItem === 'grp-2_itm-2'}
|
|
186
|
-
>
|
|
187
|
-
Subnav 2 Link 2
|
|
188
|
-
</NavItem>
|
|
189
|
-
<NavItem
|
|
190
|
-
preventDefault
|
|
191
|
-
to="#expandable-6"
|
|
192
|
-
groupId="grp-2"
|
|
193
|
-
itemId="grp-2_itm-3"
|
|
194
|
-
isActive={activeItem === 'grp-2_itm-3'}
|
|
195
|
-
>
|
|
196
|
-
Subnav 2 Link 3
|
|
197
|
-
</NavItem>
|
|
198
|
-
</NavExpandable>
|
|
199
|
-
</NavList>
|
|
200
|
-
</Nav>
|
|
201
|
-
);
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
```
|
|
205
|
-
|
|
206
|
-
### Expandable (w/subnavigation titles)
|
|
207
|
-
|
|
208
|
-
```js
|
|
209
|
-
import React from 'react';
|
|
210
|
-
import { Nav, NavExpandable, NavItem, NavItemSeparator, NavList, NavGroup } from '@patternfly/react-core';
|
|
211
|
-
|
|
212
|
-
class NavExpandableTitlesList extends React.Component {
|
|
213
|
-
constructor(props) {
|
|
214
|
-
super(props);
|
|
215
|
-
this.state = {
|
|
216
|
-
activeGroup: 'grp-1',
|
|
217
|
-
activeItem: 'grp-1_itm-1'
|
|
218
|
-
};
|
|
219
|
-
this.onSelect = result => {
|
|
220
|
-
this.setState({
|
|
221
|
-
activeGroup: result.groupId,
|
|
222
|
-
activeItem: result.itemId
|
|
223
|
-
});
|
|
224
|
-
};
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
render() {
|
|
228
|
-
const { activeGroup, activeItem } = this.state;
|
|
229
|
-
return (
|
|
230
|
-
<Nav onSelect={this.onSelect} aria-label="Expandable with subnav global nav">
|
|
231
|
-
<NavList>
|
|
232
|
-
<NavExpandable title="Expandable with subnav group 1" srText="SR Link" groupId="grp-1" isActive={activeGroup === 'grp-1'} isExpanded>
|
|
233
|
-
<NavItem
|
|
234
|
-
preventDefault
|
|
235
|
-
to="#sr-expandable-1"
|
|
236
|
-
groupId="grp-1"
|
|
237
|
-
itemId="grp-1_itm-1"
|
|
238
|
-
isActive={activeItem === 'grp-1_itm-1'}
|
|
239
|
-
>
|
|
240
|
-
Expandable 1 link 1
|
|
241
|
-
</NavItem>
|
|
242
|
-
<NavItem
|
|
243
|
-
preventDefault
|
|
244
|
-
to="#sr-expandable-2"
|
|
245
|
-
groupId="grp-1"
|
|
246
|
-
itemId="grp-1_itm-2"
|
|
247
|
-
isActive={activeItem === 'grp-1_itm-2'}
|
|
248
|
-
>
|
|
249
|
-
Expandable 1 link 2
|
|
250
|
-
</NavItem>
|
|
251
|
-
<NavItem
|
|
252
|
-
preventDefault
|
|
253
|
-
to="#sr-expandable-3"
|
|
254
|
-
groupId="grp-1"
|
|
255
|
-
itemId="grp-1_itm-3"
|
|
256
|
-
isActive={activeItem === 'grp-1_itm-3'}
|
|
257
|
-
>
|
|
258
|
-
Expandable 1 link 3
|
|
259
|
-
</NavItem>
|
|
260
|
-
</NavExpandable>
|
|
261
|
-
<NavExpandable title="Expandable with subnav group 2" srText="SR Link 2" groupId="grp-2" isActive={activeGroup === 'grp-2'}>
|
|
262
|
-
<NavItem
|
|
263
|
-
preventDefault
|
|
264
|
-
to="#sr-expandable-4"
|
|
265
|
-
groupId="grp-2"
|
|
266
|
-
itemId="grp-2_itm-1"
|
|
267
|
-
isActive={activeItem === 'grp-2_itm-1'}
|
|
268
|
-
>
|
|
269
|
-
Expandable 2 Link 1
|
|
270
|
-
</NavItem>
|
|
271
|
-
<NavItem
|
|
272
|
-
preventDefault
|
|
273
|
-
to="#sr-expandable-5"
|
|
274
|
-
groupId="grp-2"
|
|
275
|
-
itemId="grp-2_itm-2"
|
|
276
|
-
isActive={activeItem === 'grp-2_itm-2'}
|
|
277
|
-
>
|
|
278
|
-
Expandable 2 Link 2
|
|
279
|
-
</NavItem>
|
|
280
|
-
<NavItem
|
|
281
|
-
preventDefault
|
|
282
|
-
to="#sr-expandable-6"
|
|
283
|
-
groupId="grp-2"
|
|
284
|
-
itemId="grp-2_itm-3"
|
|
285
|
-
isActive={activeItem === 'grp-2_itm-3'}
|
|
286
|
-
>
|
|
287
|
-
Expandable 2 Link 3
|
|
288
|
-
</NavItem>
|
|
289
|
-
</NavExpandable>
|
|
290
|
-
</NavList>
|
|
291
|
-
</Nav>
|
|
292
|
-
);
|
|
293
|
-
}
|
|
294
|
-
}
|
|
27
|
+
```ts file="./NavExpandable.tsx"
|
|
295
28
|
```
|
|
296
29
|
|
|
297
30
|
### Expandable third level
|
|
298
31
|
|
|
299
|
-
```
|
|
300
|
-
import React from 'react';
|
|
301
|
-
import { Nav, NavExpandable, NavItem, NavList } from '@patternfly/react-core';
|
|
302
|
-
|
|
303
|
-
NavExpandableThirdLevelList = () => {
|
|
304
|
-
const [activeGroup, setActiveGroup] = React.useState('grp-1');
|
|
305
|
-
const [activeItem, setActiveItem] = React.useState('grp-1_itm-1');
|
|
306
|
-
|
|
307
|
-
onSelect = result => {
|
|
308
|
-
setActiveGroup(result.groupId);
|
|
309
|
-
setActiveItem(result.itemId);
|
|
310
|
-
};
|
|
311
|
-
|
|
312
|
-
onToggle = result => {
|
|
313
|
-
// eslint-disable-next-line no-console
|
|
314
|
-
console.log(`Group ${result.groupId} expanded? ${result.isExpanded}`);
|
|
315
|
-
};
|
|
316
|
-
|
|
317
|
-
return (
|
|
318
|
-
<Nav onSelect={onSelect} onToggle={onToggle} aria-label="Expandable third level global nav">
|
|
319
|
-
<NavList>
|
|
320
|
-
<NavExpandable title="Third level group 1" groupId="grp-1" isActive={activeGroup === 'grp-1'} isExpanded>
|
|
321
|
-
<NavItem
|
|
322
|
-
preventDefault
|
|
323
|
-
to="#expandable-1"
|
|
324
|
-
groupId="grp-1"
|
|
325
|
-
itemId="grp-1_itm-1"
|
|
326
|
-
isActive={activeItem === 'grp-1_itm-1'}
|
|
327
|
-
>
|
|
328
|
-
With 3rd 1 Link 1
|
|
329
|
-
</NavItem>
|
|
330
|
-
<NavItem
|
|
331
|
-
preventDefault
|
|
332
|
-
to="#expandable-2"
|
|
333
|
-
groupId="grp-1"
|
|
334
|
-
itemId="grp-1_itm-2"
|
|
335
|
-
isActive={activeItem === 'grp-1_itm-2'}
|
|
336
|
-
>
|
|
337
|
-
With 3rd 1 Link 2
|
|
338
|
-
</NavItem>
|
|
339
|
-
<NavItem
|
|
340
|
-
preventDefault
|
|
341
|
-
to="#expandable-3"
|
|
342
|
-
groupId="grp-1"
|
|
343
|
-
itemId="grp-1_itm-3"
|
|
344
|
-
isActive={activeItem === 'grp-1_itm-3'}
|
|
345
|
-
>
|
|
346
|
-
With 3rd 1 Link 3
|
|
347
|
-
</NavItem>
|
|
348
|
-
</NavExpandable>
|
|
349
|
-
<NavExpandable title="Third level group 2" groupId="grp-2" isActive={activeGroup === 'grp-2'} isExpanded>
|
|
350
|
-
<NavItem
|
|
351
|
-
preventDefault
|
|
352
|
-
to="#expandable-4"
|
|
353
|
-
groupId="grp-2"
|
|
354
|
-
itemId="grp-2_itm-1"
|
|
355
|
-
isActive={activeItem === 'grp-2_itm-1'}
|
|
356
|
-
>
|
|
357
|
-
With 3rd 2 Link 1
|
|
358
|
-
</NavItem>
|
|
359
|
-
<NavExpandable title="Third Level" groupId="grp-3" isActive={activeGroup === 'grp-3'} isExpanded>
|
|
360
|
-
<NavItem
|
|
361
|
-
preventDefault
|
|
362
|
-
to="#expandable-6"
|
|
363
|
-
groupId="grp-3"
|
|
364
|
-
itemId="grp-3_itm-1"
|
|
365
|
-
isActive={activeItem === 'grp-3_itm-1'}
|
|
366
|
-
>
|
|
367
|
-
Third Level Link 1
|
|
368
|
-
</NavItem>
|
|
369
|
-
<NavItem
|
|
370
|
-
preventDefault
|
|
371
|
-
to="#expandable-7"
|
|
372
|
-
groupId="grp-3"
|
|
373
|
-
itemId="grp-3_itm-2"
|
|
374
|
-
isActive={activeItem === 'grp-3_itm-2'}
|
|
375
|
-
>
|
|
376
|
-
Third Level Link 2
|
|
377
|
-
</NavItem>
|
|
378
|
-
</NavExpandable>
|
|
379
|
-
<NavItem
|
|
380
|
-
preventDefault
|
|
381
|
-
to="#expandable-8"
|
|
382
|
-
groupId="grp-2"
|
|
383
|
-
itemId="grp-2_itm-2"
|
|
384
|
-
isActive={activeItem === 'grp-2_itm-3'}
|
|
385
|
-
>
|
|
386
|
-
With 3rd 2 Link 3
|
|
387
|
-
</NavItem>
|
|
388
|
-
</NavExpandable>
|
|
389
|
-
</NavList>
|
|
390
|
-
</Nav>
|
|
391
|
-
);
|
|
392
|
-
};
|
|
32
|
+
```ts file="./NavExpandableThirdLevel.tsx"
|
|
393
33
|
```
|
|
394
34
|
|
|
395
35
|
### Mixed
|
|
396
36
|
|
|
397
|
-
```
|
|
398
|
-
import React from 'react';
|
|
399
|
-
import { Nav, NavExpandable, NavItem, NavItemSeparator, NavList, NavGroup } from '@patternfly/react-core';
|
|
400
|
-
|
|
401
|
-
class NavMixedList extends React.Component {
|
|
402
|
-
constructor(props) {
|
|
403
|
-
super(props);
|
|
404
|
-
this.state = {
|
|
405
|
-
activeGroup: '',
|
|
406
|
-
activeItem: 'itm-1'
|
|
407
|
-
};
|
|
408
|
-
this.onSelect = result => {
|
|
409
|
-
this.setState({
|
|
410
|
-
activeGroup: result.groupId,
|
|
411
|
-
activeItem: result.itemId
|
|
412
|
-
});
|
|
413
|
-
};
|
|
414
|
-
}
|
|
415
|
-
|
|
416
|
-
render() {
|
|
417
|
-
const { activeGroup, activeItem } = this.state;
|
|
418
|
-
return (
|
|
419
|
-
<Nav onSelect={this.onSelect} aria-label="Mixed global nav">
|
|
420
|
-
<NavList>
|
|
421
|
-
<NavItem preventDefault to="#mixed-1" itemId="itm-1" isActive={activeItem === 'itm-1'}>
|
|
422
|
-
Link 1 (not expandable)
|
|
423
|
-
</NavItem>
|
|
424
|
-
<NavExpandable title="Link 2 - expandable" groupId="grp-1" isActive={activeGroup === 'grp-1'}>
|
|
425
|
-
<NavItem
|
|
426
|
-
preventDefault
|
|
427
|
-
to="#mixed-2"
|
|
428
|
-
groupId="grp-1"
|
|
429
|
-
itemId="grp-1_itm-1"
|
|
430
|
-
isActive={activeItem === 'grp-1_itm-1'}
|
|
431
|
-
>
|
|
432
|
-
Mixed Link 1
|
|
433
|
-
</NavItem>
|
|
434
|
-
<NavItem
|
|
435
|
-
preventDefault
|
|
436
|
-
to="#mixed-3"
|
|
437
|
-
groupId="grp-1"
|
|
438
|
-
itemId="grp-1_itm-2"
|
|
439
|
-
isActive={activeItem === 'grp-1_itm-2'}
|
|
440
|
-
>
|
|
441
|
-
Mixed Link 2
|
|
442
|
-
</NavItem>
|
|
443
|
-
<NavItem
|
|
444
|
-
preventDefault
|
|
445
|
-
to="#mixed-4"
|
|
446
|
-
groupId="grp-1"
|
|
447
|
-
itemId="grp-1_itm-3"
|
|
448
|
-
isActive={activeItem === 'grp-1_itm-3'}
|
|
449
|
-
>
|
|
450
|
-
Mixed Link 3
|
|
451
|
-
</NavItem>
|
|
452
|
-
</NavExpandable>
|
|
453
|
-
<NavExpandable title="Link 3 - expandable" groupId="grp-2" isActive={activeGroup === 'grp-2'}>
|
|
454
|
-
<NavItem
|
|
455
|
-
preventDefault
|
|
456
|
-
to="#mixed-5"
|
|
457
|
-
groupId="grp-2"
|
|
458
|
-
itemId="grp-2_itm-1"
|
|
459
|
-
isActive={activeItem === 'grp-2_itm-1'}
|
|
460
|
-
>
|
|
461
|
-
Mixed 2 Link 1
|
|
462
|
-
</NavItem>
|
|
463
|
-
<NavItem
|
|
464
|
-
preventDefault
|
|
465
|
-
to="#mixed-6"
|
|
466
|
-
groupId="grp-2"
|
|
467
|
-
itemId="grp-2_itm-2"
|
|
468
|
-
isActive={activeItem === 'grp-2_itm-2'}
|
|
469
|
-
>
|
|
470
|
-
Mixed 2 Link 2
|
|
471
|
-
</NavItem>
|
|
472
|
-
<NavItem
|
|
473
|
-
preventDefault
|
|
474
|
-
to="#mixed-7"
|
|
475
|
-
groupId="grp-2"
|
|
476
|
-
itemId="grp-2_itm-3"
|
|
477
|
-
isActive={activeItem === 'grp-2_itm-3'}
|
|
478
|
-
>
|
|
479
|
-
Mixed 2 Link 3
|
|
480
|
-
</NavItem>
|
|
481
|
-
</NavExpandable>
|
|
482
|
-
</NavList>
|
|
483
|
-
</Nav>
|
|
484
|
-
);
|
|
485
|
-
}
|
|
486
|
-
}
|
|
37
|
+
```ts file="./NavMixed.tsx"
|
|
487
38
|
```
|
|
488
39
|
|
|
489
40
|
### Horizontal (only in PageHeader)
|
|
490
41
|
|
|
491
|
-
```
|
|
492
|
-
import React from 'react';
|
|
493
|
-
import { Nav, NavExpandable, NavItem, NavItemSeparator, NavList, NavGroup, PageHeader } from '@patternfly/react-core';
|
|
494
|
-
|
|
495
|
-
class NavHorizontalList extends React.Component {
|
|
496
|
-
constructor(props) {
|
|
497
|
-
super(props);
|
|
498
|
-
this.state = {
|
|
499
|
-
activeItem: 0
|
|
500
|
-
};
|
|
501
|
-
this.onSelect = result => {
|
|
502
|
-
this.setState({
|
|
503
|
-
activeItem: result.itemId
|
|
504
|
-
});
|
|
505
|
-
};
|
|
506
|
-
}
|
|
507
|
-
|
|
508
|
-
render() {
|
|
509
|
-
const { activeItem } = this.state;
|
|
510
|
-
const nav = (
|
|
511
|
-
<Nav onSelect={this.onSelect} variant="horizontal" aria-label="Horizontal global nav">
|
|
512
|
-
<NavList>
|
|
513
|
-
{Array.apply(0, Array(10)).map(function(x, i) {
|
|
514
|
-
const num = i + 1;
|
|
515
|
-
return (
|
|
516
|
-
<NavItem key={num} itemId={num} isActive={activeItem === num} href="#">
|
|
517
|
-
Horizontal nav item {num}
|
|
518
|
-
</NavItem>
|
|
519
|
-
);
|
|
520
|
-
})}
|
|
521
|
-
</NavList>
|
|
522
|
-
</Nav>
|
|
523
|
-
);
|
|
524
|
-
return <PageHeader topNav={nav} />;
|
|
525
|
-
}
|
|
526
|
-
}
|
|
42
|
+
```ts file="./NavHorizontalPageHeader.tsx"
|
|
527
43
|
```
|
|
528
44
|
|
|
529
45
|
### Horizontal subnav
|
|
530
46
|
|
|
531
|
-
```
|
|
532
|
-
import React from 'react';
|
|
533
|
-
import { Nav, NavExpandable, NavItem, NavItemSeparator, NavList, NavGroup, PageHeader } from '@patternfly/react-core';
|
|
534
|
-
|
|
535
|
-
class HorizontalSubNav extends React.Component {
|
|
536
|
-
constructor(props) {
|
|
537
|
-
super(props);
|
|
538
|
-
this.state = {
|
|
539
|
-
activeItem: 0
|
|
540
|
-
};
|
|
541
|
-
this.onSelect = result => {
|
|
542
|
-
this.setState({
|
|
543
|
-
activeItem: result.itemId
|
|
544
|
-
});
|
|
545
|
-
};
|
|
546
|
-
}
|
|
547
|
-
|
|
548
|
-
render() {
|
|
549
|
-
const { activeItem } = this.state;
|
|
550
|
-
return (
|
|
551
|
-
<Nav onSelect={this.onSelect} variant="horizontal-subnav" aria-label="Horizontal subnav global nav">
|
|
552
|
-
<NavList>
|
|
553
|
-
{Array.apply(0, Array(10)).map(function(x, i) {
|
|
554
|
-
const num = i + 1;
|
|
555
|
-
return (
|
|
556
|
-
<NavItem key={num} itemId={num} isActive={activeItem === num} href="#">
|
|
557
|
-
Horizontal nav item {num}
|
|
558
|
-
</NavItem>
|
|
559
|
-
);
|
|
560
|
-
})}
|
|
561
|
-
</NavList>
|
|
562
|
-
</Nav>
|
|
563
|
-
);
|
|
564
|
-
}
|
|
565
|
-
}
|
|
47
|
+
```ts file="./NavHorizontalSubNav.tsx"
|
|
566
48
|
```
|
|
567
49
|
|
|
568
50
|
### Legacy tertiary
|
|
569
51
|
|
|
570
|
-
```
|
|
571
|
-
import React from 'react';
|
|
572
|
-
import { Nav, NavExpandable, NavItem, NavItemSeparator, NavList, NavGroup, PageSection } from '@patternfly/react-core';
|
|
573
|
-
|
|
574
|
-
class NavTertiaryList extends React.Component {
|
|
575
|
-
constructor(props) {
|
|
576
|
-
super(props);
|
|
577
|
-
this.state = {
|
|
578
|
-
activeItem: 0
|
|
579
|
-
};
|
|
580
|
-
this.onSelect = result => {
|
|
581
|
-
this.setState({
|
|
582
|
-
activeItem: result.itemId
|
|
583
|
-
});
|
|
584
|
-
};
|
|
585
|
-
}
|
|
586
|
-
|
|
587
|
-
render() {
|
|
588
|
-
const { activeItem } = this.state;
|
|
589
|
-
return (
|
|
590
|
-
<Nav onSelect={this.onSelect} variant="tertiary" aria-label="Tertiary global nav">
|
|
591
|
-
<NavList>
|
|
592
|
-
{Array.apply(0, Array(10)).map(function(x, i) {
|
|
593
|
-
const num = i + 1;
|
|
594
|
-
return (
|
|
595
|
-
<NavItem key={num} itemId={num} isActive={activeItem === num} href="#">
|
|
596
|
-
Tertiary nav item {num}
|
|
597
|
-
</NavItem>
|
|
598
|
-
);
|
|
599
|
-
})}
|
|
600
|
-
</NavList>
|
|
601
|
-
</Nav>
|
|
602
|
-
);
|
|
603
|
-
}
|
|
604
|
-
}
|
|
52
|
+
```ts file="./NavLegacyTertiary.tsx"
|
|
605
53
|
```
|
|
606
54
|
|
|
607
55
|
### Flyout
|
|
608
56
|
|
|
609
57
|
A flyout should be a `Menu` component. Press `space` or `right arrow` to open a flyout using the keyboard, use the arrow keys to navigate between flyout items, and press `escape` or `left arrow` to close a flyout.
|
|
610
58
|
|
|
611
|
-
```
|
|
612
|
-
import React from 'react';
|
|
613
|
-
import {
|
|
614
|
-
Nav,
|
|
615
|
-
NavExpandable,
|
|
616
|
-
NavItem,
|
|
617
|
-
NavItemSeparator,
|
|
618
|
-
NavList,
|
|
619
|
-
NavGroup,
|
|
620
|
-
Menu,
|
|
621
|
-
MenuContent,
|
|
622
|
-
MenuList,
|
|
623
|
-
MenuItem
|
|
624
|
-
} from '@patternfly/react-core';
|
|
625
|
-
|
|
626
|
-
NavWithFlyout = () => {
|
|
627
|
-
const [activeItem, setActiveItem] = React.useState(0);
|
|
628
|
-
const onSelect = result => setActiveItem(result.itemId);
|
|
629
|
-
const onMenuSelect = (event, itemId) => setActiveItem(itemId);
|
|
630
|
-
|
|
631
|
-
const numFlyouts = 5;
|
|
632
|
-
const FlyoutMenu = ({ depth, children }) => (
|
|
633
|
-
<Menu key={depth} containsFlyout isNavFlyout id={`menu-${depth}`} onSelect={onMenuSelect}>
|
|
634
|
-
<MenuContent>
|
|
635
|
-
<MenuList>
|
|
636
|
-
<MenuItem flyoutMenu={children} itemId={`next-menu-${depth}`} to={`#menu-link-${depth}`}>
|
|
637
|
-
Next menu
|
|
638
|
-
</MenuItem>
|
|
639
|
-
{[...Array(numFlyouts - depth).keys()].map(j => (
|
|
640
|
-
<MenuItem key={`${depth}-${j}`} itemId={`${depth}-${j}`} to={`#menu-link-${depth}-${j}`}>
|
|
641
|
-
Menu {depth} item {j}
|
|
642
|
-
</MenuItem>
|
|
643
|
-
))}
|
|
644
|
-
<MenuItem flyoutMenu={children} itemId={`next-menu-2-${depth}`} to={`#second-menu-link-${depth}`}>
|
|
645
|
-
Next menu
|
|
646
|
-
</MenuItem>
|
|
647
|
-
</MenuList>
|
|
648
|
-
</MenuContent>
|
|
649
|
-
</Menu>
|
|
650
|
-
);
|
|
651
|
-
|
|
652
|
-
let curFlyout = <FlyoutMenu depth={1} />;
|
|
653
|
-
for (let i = 2; i < numFlyouts - 1; i++) {
|
|
654
|
-
curFlyout = <FlyoutMenu depth={i}>{curFlyout}</FlyoutMenu>;
|
|
655
|
-
}
|
|
656
|
-
|
|
657
|
-
return (
|
|
658
|
-
<Nav onSelect={onSelect} aria-label="Flyout global nav">
|
|
659
|
-
<NavList>
|
|
660
|
-
<NavItem id="flyout-link1" to="#flyout-link1" itemId={0} isActive={activeItem === 0}>
|
|
661
|
-
Flyout Link 1
|
|
662
|
-
</NavItem>
|
|
663
|
-
<NavItem id="flyout-link2" to="#flyout-link2" itemId={1} isActive={activeItem === 1}>
|
|
664
|
-
Flyout Link 2
|
|
665
|
-
</NavItem>
|
|
666
|
-
<NavItem flyout={curFlyout} id="flyout-link3" to="#flyout-link3" itemId={2} isActive={activeItem === 2}>
|
|
667
|
-
Flyout Link 3
|
|
668
|
-
</NavItem>
|
|
669
|
-
<NavItem id="flyout-link4" to="#flyout-link4" itemId={3} isActive={activeItem === 3}>
|
|
670
|
-
Flyout Link 4
|
|
671
|
-
</NavItem>
|
|
672
|
-
</NavList>
|
|
673
|
-
</Nav>
|
|
674
|
-
);
|
|
675
|
-
};
|
|
59
|
+
```ts file="./NavFlyout.tsx" isBeta
|
|
676
60
|
```
|
|
677
61
|
|
|
678
62
|
### Drilldown
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Nav, NavItem, NavList } from '@patternfly/react-core';
|
|
3
|
+
|
|
4
|
+
export const NavDefault: React.FunctionComponent = () => {
|
|
5
|
+
const [activeItem, setActiveItem] = React.useState(0);
|
|
6
|
+
|
|
7
|
+
const onSelect = (result: { itemId: number | string }) => {
|
|
8
|
+
setActiveItem(result.itemId as number);
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
return (
|
|
12
|
+
<Nav onSelect={onSelect} aria-label="Default global nav">
|
|
13
|
+
<NavList>
|
|
14
|
+
<NavItem preventDefault id="nav-default-link1" to="#nav-default-link1" itemId={0} isActive={activeItem === 0}>
|
|
15
|
+
Default Link 1
|
|
16
|
+
</NavItem>
|
|
17
|
+
<NavItem preventDefault id="nav-default-link2" to="#nav-default-link2" itemId={1} isActive={activeItem === 1}>
|
|
18
|
+
Default Link 2
|
|
19
|
+
</NavItem>
|
|
20
|
+
<NavItem preventDefault id="nav-default-link3" to="#nav-default-link3" itemId={2} isActive={activeItem === 2}>
|
|
21
|
+
Default Link 3
|
|
22
|
+
</NavItem>
|
|
23
|
+
<NavItem preventDefault id="nav-default-link4" to="#nav-default-link4" itemId={3} isActive={activeItem === 3}>
|
|
24
|
+
Default Link 4
|
|
25
|
+
</NavItem>
|
|
26
|
+
</NavList>
|
|
27
|
+
</Nav>
|
|
28
|
+
);
|
|
29
|
+
};
|