@patternfly/react-core 4.226.1 → 4.227.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +27 -0
- package/dist/esm/components/CalendarMonth/CalendarMonth.d.ts +3 -1
- package/dist/esm/components/CalendarMonth/CalendarMonth.d.ts.map +1 -1
- package/dist/esm/components/CalendarMonth/CalendarMonth.js +9 -6
- package/dist/esm/components/CalendarMonth/CalendarMonth.js.map +1 -1
- package/dist/esm/components/Dropdown/DropdownToggle.d.ts.map +1 -1
- package/dist/esm/components/Dropdown/DropdownToggle.js +1 -1
- package/dist/esm/components/Dropdown/DropdownToggle.js.map +1 -1
- package/dist/esm/components/Wizard/Wizard.d.ts +1 -0
- package/dist/esm/components/Wizard/Wizard.d.ts.map +1 -1
- package/dist/esm/components/Wizard/Wizard.js +5 -0
- package/dist/esm/components/Wizard/Wizard.js.map +1 -1
- package/dist/js/components/CalendarMonth/CalendarMonth.d.ts +3 -1
- package/dist/js/components/CalendarMonth/CalendarMonth.d.ts.map +1 -1
- package/dist/js/components/CalendarMonth/CalendarMonth.js +9 -6
- package/dist/js/components/CalendarMonth/CalendarMonth.js.map +1 -1
- package/dist/js/components/Dropdown/DropdownToggle.d.ts.map +1 -1
- package/dist/js/components/Dropdown/DropdownToggle.js +1 -1
- package/dist/js/components/Dropdown/DropdownToggle.js.map +1 -1
- package/dist/js/components/Wizard/Wizard.d.ts +1 -0
- package/dist/js/components/Wizard/Wizard.d.ts.map +1 -1
- package/dist/js/components/Wizard/Wizard.js +5 -0
- package/dist/js/components/Wizard/Wizard.js.map +1 -1
- package/dist/umd/react-core.css +4 -3
- package/dist/umd/react-core.js +15 -7
- package/dist/umd/react-core.min.css +4 -3
- package/dist/umd/react-core.min.js +2 -2
- package/package.json +6 -6
- package/src/components/CalendarMonth/CalendarMonth.tsx +22 -5
- package/src/components/CalendarMonth/examples/CalendarMonth.md +0 -5
- package/src/components/CalendarMonth/examples/CalendarMonthSelectableDate.tsx +6 -1
- package/src/components/Dropdown/DropdownToggle.tsx +1 -0
- package/src/components/Dropdown/__tests__/DropdownToggle.test.tsx +18 -0
- package/src/components/Dropdown/__tests__/__snapshots__/DropdownToggle.test.tsx.snap +1 -1
- package/src/components/Dropdown/examples/Dropdown.md +5 -0
- package/src/components/Dropdown/examples/DropdownSplitButtonActionSecondary.tsx +107 -0
- package/src/components/Page/examples/Page.md +25 -12
- package/src/components/Pagination/examples/Pagination.md +14 -14
- package/src/components/Toolbar/examples/Toolbar.md +2 -2
- package/src/components/Wizard/Wizard.tsx +6 -0
- package/src/components/Wizard/__tests__/Wizard.test.tsx +31 -0
- package/src/components/CalendarMonth/examples/CalendarMonthDefault.tsx +0 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@patternfly/react-core",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.227.1",
|
|
4
4
|
"description": "This library provides a set of common React components for use with the PatternFly reference implementation.",
|
|
5
5
|
"main": "dist/js/index.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -34,16 +34,16 @@
|
|
|
34
34
|
"generate": "node scripts/copyStyles.js"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@patternfly/react-icons": "^4.
|
|
38
|
-
"@patternfly/react-styles": "^4.
|
|
39
|
-
"@patternfly/react-tokens": "^4.
|
|
37
|
+
"@patternfly/react-icons": "^4.78.1",
|
|
38
|
+
"@patternfly/react-styles": "^4.77.1",
|
|
39
|
+
"@patternfly/react-tokens": "^4.79.1",
|
|
40
40
|
"focus-trap": "6.9.2",
|
|
41
41
|
"react-dropzone": "9.0.0",
|
|
42
42
|
"tippy.js": "5.1.2",
|
|
43
43
|
"tslib": "^2.0.0"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"@patternfly/patternfly": "4.204.
|
|
46
|
+
"@patternfly/patternfly": "4.204.3",
|
|
47
47
|
"@rollup/plugin-commonjs": "^21.0.0",
|
|
48
48
|
"@rollup/plugin-node-resolve": "^13.0.0",
|
|
49
49
|
"@rollup/plugin-replace": "^3.0.0",
|
|
@@ -60,5 +60,5 @@
|
|
|
60
60
|
"react": "^16.8.0 || ^17.0.0",
|
|
61
61
|
"react-dom": "^16.8.0 || ^17.0.0"
|
|
62
62
|
},
|
|
63
|
-
"gitHead": "
|
|
63
|
+
"gitHead": "7bfaee093d3c85392a9d21a34ff661ffe29b0f47"
|
|
64
64
|
}
|
|
@@ -57,6 +57,11 @@ export interface CalendarProps extends CalendarFormat, Omit<React.HTMLProps<HTML
|
|
|
57
57
|
onSelectToggle?: (open: boolean) => void;
|
|
58
58
|
/** Flag to set browser focus on the passed date **/
|
|
59
59
|
isDateFocused?: boolean;
|
|
60
|
+
/** Callback when month or year is changed */
|
|
61
|
+
onMonthChange?: (
|
|
62
|
+
newDate?: Date,
|
|
63
|
+
event?: React.MouseEvent | React.ChangeEvent | React.FormEvent<HTMLInputElement>
|
|
64
|
+
) => void;
|
|
60
65
|
}
|
|
61
66
|
|
|
62
67
|
// Must be numeric given current header design
|
|
@@ -114,6 +119,7 @@ export const CalendarMonth = ({
|
|
|
114
119
|
validators = [() => true],
|
|
115
120
|
className,
|
|
116
121
|
onSelectToggle = () => {},
|
|
122
|
+
onMonthChange = () => {},
|
|
117
123
|
rangeStart,
|
|
118
124
|
prevMonthAriaLabel = 'Previous month',
|
|
119
125
|
nextMonthAriaLabel = 'Next month',
|
|
@@ -162,10 +168,11 @@ export const CalendarMonth = ({
|
|
|
162
168
|
}
|
|
163
169
|
}, [focusedDate, isDateFocused, focusedDateValidated, focusRef]);
|
|
164
170
|
|
|
165
|
-
const onMonthClick = (newDate: Date) => {
|
|
171
|
+
const onMonthClick = (newDate: Date, ev: React.MouseEvent) => {
|
|
166
172
|
setFocusedDate(newDate);
|
|
167
173
|
setHoveredDate(newDate);
|
|
168
174
|
setShouldFocus(false);
|
|
175
|
+
onMonthChange(newDate, ev);
|
|
169
176
|
};
|
|
170
177
|
|
|
171
178
|
const onKeyDown = (ev: React.KeyboardEvent<HTMLTableSectionElement>) => {
|
|
@@ -222,7 +229,11 @@ export const CalendarMonth = ({
|
|
|
222
229
|
<div className={css(styles.calendarMonth, className)} {...props}>
|
|
223
230
|
<div className={styles.calendarMonthHeader}>
|
|
224
231
|
<div className={css(styles.calendarMonthHeaderNavControl, styles.modifiers.prevMonth)}>
|
|
225
|
-
<Button
|
|
232
|
+
<Button
|
|
233
|
+
variant="plain"
|
|
234
|
+
aria-label={prevMonthAriaLabel}
|
|
235
|
+
onClick={(ev: React.MouseEvent) => onMonthClick(prevMonth, ev)}
|
|
236
|
+
>
|
|
226
237
|
<AngleLeftIcon aria-hidden={true} />
|
|
227
238
|
</Button>
|
|
228
239
|
</div>
|
|
@@ -240,7 +251,7 @@ export const CalendarMonth = ({
|
|
|
240
251
|
setIsSelectOpen(!isSelectOpen);
|
|
241
252
|
onSelectToggle(!isSelectOpen);
|
|
242
253
|
}}
|
|
243
|
-
onSelect={(
|
|
254
|
+
onSelect={(ev, monthNum) => {
|
|
244
255
|
// When we put CalendarMonth in a Popover we want the Popover's onDocumentClick
|
|
245
256
|
// to see the SelectOption as a child so it doesn't close the Popover.
|
|
246
257
|
setTimeout(() => {
|
|
@@ -251,6 +262,7 @@ export const CalendarMonth = ({
|
|
|
251
262
|
setFocusedDate(newDate);
|
|
252
263
|
setHoveredDate(newDate);
|
|
253
264
|
setShouldFocus(false);
|
|
265
|
+
onMonthChange(newDate, ev);
|
|
254
266
|
}, 0);
|
|
255
267
|
}}
|
|
256
268
|
variant="single"
|
|
@@ -268,18 +280,23 @@ export const CalendarMonth = ({
|
|
|
268
280
|
aria-label={yearInputAriaLabel}
|
|
269
281
|
type="number"
|
|
270
282
|
value={yearFormatted}
|
|
271
|
-
onChange={year => {
|
|
283
|
+
onChange={(year: string, ev: React.FormEvent<HTMLInputElement>) => {
|
|
272
284
|
const newDate = new Date(focusedDate);
|
|
273
285
|
newDate.setFullYear(+year);
|
|
274
286
|
setFocusedDate(newDate);
|
|
275
287
|
setHoveredDate(newDate);
|
|
276
288
|
setShouldFocus(false);
|
|
289
|
+
onMonthChange(newDate, ev);
|
|
277
290
|
}}
|
|
278
291
|
/>
|
|
279
292
|
</div>
|
|
280
293
|
</InputGroup>
|
|
281
294
|
<div className={css(styles.calendarMonthHeaderNavControl, styles.modifiers.nextMonth)}>
|
|
282
|
-
<Button
|
|
295
|
+
<Button
|
|
296
|
+
variant="plain"
|
|
297
|
+
aria-label={nextMonthAriaLabel}
|
|
298
|
+
onClick={(ev: React.MouseEvent) => onMonthClick(nextMonth, ev)}
|
|
299
|
+
>
|
|
283
300
|
<AngleRightIcon aria-hidden={true} />
|
|
284
301
|
</Button>
|
|
285
302
|
</div>
|
|
@@ -4,10 +4,15 @@ import { CalendarMonth } from '@patternfly/react-core';
|
|
|
4
4
|
export const CalendarMonthSelectableDate: React.FunctionComponent = () => {
|
|
5
5
|
const [date, setDate] = React.useState(new Date(2020, 10, 24));
|
|
6
6
|
|
|
7
|
+
const onMonthChange = (newDate: Date) => {
|
|
8
|
+
// eslint-disable-next-line no-console
|
|
9
|
+
console.log(`updated month: ${newDate.getMonth()}, updated year: ${newDate.getFullYear()}`);
|
|
10
|
+
};
|
|
11
|
+
|
|
7
12
|
return (
|
|
8
13
|
<React.Fragment>
|
|
9
14
|
<pre>Selected date: {date.toString()}</pre>
|
|
10
|
-
<CalendarMonth date={date} onChange={setDate} />
|
|
15
|
+
<CalendarMonth date={date} onChange={setDate} onMonthChange={onMonthChange} />
|
|
11
16
|
</React.Fragment>
|
|
12
17
|
);
|
|
13
18
|
};
|
|
@@ -120,6 +120,7 @@ export const DropdownToggle: React.FunctionComponent<DropdownToggleProps> = ({
|
|
|
120
120
|
styles.modifiers.splitButton,
|
|
121
121
|
splitButtonVariant === 'action' && styles.modifiers.action,
|
|
122
122
|
(toggleVariant === 'primary' || isPrimary) && splitButtonVariant === 'action' && styles.modifiers.primary,
|
|
123
|
+
toggleVariant === 'secondary' && splitButtonVariant === 'action' && styles.modifiers.secondary,
|
|
123
124
|
isDisabled && styles.modifiers.disabled
|
|
124
125
|
)}
|
|
125
126
|
>
|
|
@@ -184,6 +184,24 @@ describe('DropdownToggle', () => {
|
|
|
184
184
|
expect(asFragment()).toMatchSnapshot();
|
|
185
185
|
});
|
|
186
186
|
|
|
187
|
+
test('action split button - renders secondary variant', () => {
|
|
188
|
+
const { asFragment } = render(
|
|
189
|
+
<DropdownToggle
|
|
190
|
+
id="Dropdown Toggle"
|
|
191
|
+
toggleVariant="secondary"
|
|
192
|
+
splitButtonItems={[<div key="1">test</div>]}
|
|
193
|
+
splitButtonVariant="action"
|
|
194
|
+
parentRef={document.createElement('div')}
|
|
195
|
+
>
|
|
196
|
+
Dropdown
|
|
197
|
+
</DropdownToggle>
|
|
198
|
+
);
|
|
199
|
+
|
|
200
|
+
const dropdownToggle = screen.getByRole('button').parentElement;
|
|
201
|
+
|
|
202
|
+
expect(dropdownToggle).toHaveClass('pf-m-secondary');
|
|
203
|
+
});
|
|
204
|
+
|
|
187
205
|
test('class changes', () => {
|
|
188
206
|
const { asFragment } = render(
|
|
189
207
|
<DropdownContext.Provider
|
|
@@ -198,7 +198,7 @@ exports[`DropdownToggle state class changes 1`] = `
|
|
|
198
198
|
<button
|
|
199
199
|
aria-expanded="false"
|
|
200
200
|
class="pf-c-dropdown__toggle"
|
|
201
|
-
data-ouia-component-id="OUIA-Generated-DropdownToggle-
|
|
201
|
+
data-ouia-component-id="OUIA-Generated-DropdownToggle-14"
|
|
202
202
|
data-ouia-component-type="PF4/DropdownToggle"
|
|
203
203
|
data-ouia-safe="true"
|
|
204
204
|
id="Dropdown Toggle"
|
|
@@ -113,6 +113,11 @@ import avatarImg from '../../Avatar/examples/avatarImg.svg';
|
|
|
113
113
|
```ts file="./DropdownSplitButtonActionPrimary.tsx"
|
|
114
114
|
```
|
|
115
115
|
|
|
116
|
+
### Split button secondary action
|
|
117
|
+
|
|
118
|
+
```ts file="./DropdownSplitButtonActionSecondary.tsx"
|
|
119
|
+
```
|
|
120
|
+
|
|
116
121
|
### Basic panel
|
|
117
122
|
|
|
118
123
|
```ts file="./DropdownBasicPanel.tsx"
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Dropdown, DropdownToggle, DropdownToggleAction, DropdownItem } from '@patternfly/react-core';
|
|
3
|
+
import CogIcon from '@patternfly/react-icons/dist/esm/icons/cog-icon';
|
|
4
|
+
import BellIcon from '@patternfly/react-icons/dist/esm/icons/bell-icon';
|
|
5
|
+
import CubesIcon from '@patternfly/react-icons/dist/esm/icons/cubes-icon';
|
|
6
|
+
|
|
7
|
+
export const DropdownSplitButtonActionSecondary: React.FunctionComponent = () => {
|
|
8
|
+
const [isActionOpen, setIsActionOpen] = React.useState(false);
|
|
9
|
+
const [isCogOpen, setIsCogOpen] = React.useState(false);
|
|
10
|
+
|
|
11
|
+
const onActionToggle = (isActionOpen: boolean) => {
|
|
12
|
+
setIsActionOpen(isActionOpen);
|
|
13
|
+
};
|
|
14
|
+
const onCogToggle = (isCogOpen: boolean) => {
|
|
15
|
+
setIsCogOpen(isCogOpen);
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
const onActionClick = () => {
|
|
19
|
+
window.alert('You selected an action button!');
|
|
20
|
+
};
|
|
21
|
+
const onCogClick = () => {
|
|
22
|
+
window.alert('You selected the Cog!');
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
const onActionFocus = () => {
|
|
26
|
+
const element = document.getElementById('toggle-split-button-action-secondary');
|
|
27
|
+
element.focus();
|
|
28
|
+
};
|
|
29
|
+
const onCogFocus = () => {
|
|
30
|
+
const element = document.getElementById('toggle-split-button-cog-secondary');
|
|
31
|
+
element.focus();
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
const onActionSelect = () => {
|
|
35
|
+
setIsActionOpen(false);
|
|
36
|
+
onActionFocus();
|
|
37
|
+
};
|
|
38
|
+
const onCogSelect = () => {
|
|
39
|
+
setIsCogOpen(false);
|
|
40
|
+
onCogFocus();
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
const dropdownItems = [
|
|
44
|
+
<DropdownItem key="action" component="button" onClick={onActionClick}>
|
|
45
|
+
Action
|
|
46
|
+
</DropdownItem>,
|
|
47
|
+
<DropdownItem key="disabled link" component="button" isDisabled onClick={onActionClick}>
|
|
48
|
+
Disabled action
|
|
49
|
+
</DropdownItem>,
|
|
50
|
+
<DropdownItem key="other action" component="button" onClick={onActionClick}>
|
|
51
|
+
Other action
|
|
52
|
+
</DropdownItem>
|
|
53
|
+
];
|
|
54
|
+
|
|
55
|
+
const dropdownIconItems = [
|
|
56
|
+
<DropdownItem key="action" component="button" icon={<CogIcon />} onClick={onActionClick}>
|
|
57
|
+
Action
|
|
58
|
+
</DropdownItem>,
|
|
59
|
+
<DropdownItem key="disabled link" component="button" icon={<BellIcon />} isDisabled onClick={onActionClick}>
|
|
60
|
+
Disabled action
|
|
61
|
+
</DropdownItem>,
|
|
62
|
+
<DropdownItem key="other action" component="button" icon={<CubesIcon />} onClick={onActionClick}>
|
|
63
|
+
Other action
|
|
64
|
+
</DropdownItem>
|
|
65
|
+
];
|
|
66
|
+
|
|
67
|
+
return (
|
|
68
|
+
<React.Fragment>
|
|
69
|
+
<Dropdown
|
|
70
|
+
onSelect={onActionSelect}
|
|
71
|
+
toggle={
|
|
72
|
+
<DropdownToggle
|
|
73
|
+
id="toggle-split-button-action-secondary"
|
|
74
|
+
splitButtonItems={[
|
|
75
|
+
<DropdownToggleAction key="action" onClick={onActionClick}>
|
|
76
|
+
Action
|
|
77
|
+
</DropdownToggleAction>
|
|
78
|
+
]}
|
|
79
|
+
toggleVariant="secondary"
|
|
80
|
+
splitButtonVariant="action"
|
|
81
|
+
onToggle={onActionToggle}
|
|
82
|
+
/>
|
|
83
|
+
}
|
|
84
|
+
isOpen={isActionOpen}
|
|
85
|
+
dropdownItems={dropdownItems}
|
|
86
|
+
/>{' '}
|
|
87
|
+
<Dropdown
|
|
88
|
+
onSelect={onCogSelect}
|
|
89
|
+
toggle={
|
|
90
|
+
<DropdownToggle
|
|
91
|
+
id="toggle-split-button-cog-secondary"
|
|
92
|
+
splitButtonItems={[
|
|
93
|
+
<DropdownToggleAction key="cog-action" aria-label="Action" onClick={onCogClick}>
|
|
94
|
+
<CogIcon />
|
|
95
|
+
</DropdownToggleAction>
|
|
96
|
+
]}
|
|
97
|
+
toggleVariant="secondary"
|
|
98
|
+
splitButtonVariant="action"
|
|
99
|
+
onToggle={onCogToggle}
|
|
100
|
+
/>
|
|
101
|
+
}
|
|
102
|
+
isOpen={isCogOpen}
|
|
103
|
+
dropdownItems={dropdownIconItems}
|
|
104
|
+
/>
|
|
105
|
+
</React.Fragment>
|
|
106
|
+
);
|
|
107
|
+
};
|
|
@@ -89,7 +89,7 @@ class VerticalPage extends React.Component {
|
|
|
89
89
|
<MastheadContent>{headerToolbar}</MastheadContent>
|
|
90
90
|
</Masthead>
|
|
91
91
|
);
|
|
92
|
-
const Sidebar = <PageSidebar nav="Navigation" isNavOpen={isNavOpen} id="vertical-sidebar"/>;
|
|
92
|
+
const Sidebar = <PageSidebar nav="Navigation" isNavOpen={isNavOpen} id="vertical-sidebar" />;
|
|
93
93
|
|
|
94
94
|
return (
|
|
95
95
|
<Page header={Header} sidebar={Sidebar}>
|
|
@@ -262,7 +262,7 @@ class FillPage extends React.Component {
|
|
|
262
262
|
<MastheadContent>{headerToolbar}</MastheadContent>
|
|
263
263
|
</Masthead>
|
|
264
264
|
);
|
|
265
|
-
const Sidebar = <PageSidebar nav="Navigation" isNavOpen={isNavOpen} id="fill-sidebar"/>;
|
|
265
|
+
const Sidebar = <PageSidebar nav="Navigation" isNavOpen={isNavOpen} id="fill-sidebar" />;
|
|
266
266
|
|
|
267
267
|
return (
|
|
268
268
|
<Page header={Header} sidebar={Sidebar}>
|
|
@@ -344,7 +344,7 @@ class VerticalPage extends React.Component {
|
|
|
344
344
|
<MastheadContent>{headerToolbar}</MastheadContent>
|
|
345
345
|
</Masthead>
|
|
346
346
|
);
|
|
347
|
-
const Sidebar = <PageSidebar nav="Navigation" isNavOpen={isNavOpen} id="main-padding-sidebar"/>;
|
|
347
|
+
const Sidebar = <PageSidebar nav="Navigation" isNavOpen={isNavOpen} id="main-padding-sidebar" />;
|
|
348
348
|
|
|
349
349
|
return (
|
|
350
350
|
<Page header={Header} sidebar={Sidebar}>
|
|
@@ -410,7 +410,7 @@ class UncontrolledNavPage extends React.Component {
|
|
|
410
410
|
<MastheadContent>{headerToolbar}</MastheadContent>
|
|
411
411
|
</Masthead>
|
|
412
412
|
);
|
|
413
|
-
const Sidebar = <PageSidebar nav="Navigation" id="uncontrolled-sidebar"/>;
|
|
413
|
+
const Sidebar = <PageSidebar nav="Navigation" id="uncontrolled-sidebar" />;
|
|
414
414
|
|
|
415
415
|
return (
|
|
416
416
|
<Page isManagedSidebar header={Header} sidebar={Sidebar}>
|
|
@@ -497,7 +497,7 @@ class GroupPage extends React.Component {
|
|
|
497
497
|
<MastheadContent>{headerToolbar}</MastheadContent>
|
|
498
498
|
</Masthead>
|
|
499
499
|
);
|
|
500
|
-
const Sidebar = <PageSidebar nav="Navigation" isNavOpen={isNavOpen} id="group-section-sidebar"/>;
|
|
500
|
+
const Sidebar = <PageSidebar nav="Navigation" isNavOpen={isNavOpen} id="group-section-sidebar" />;
|
|
501
501
|
|
|
502
502
|
return (
|
|
503
503
|
<Page header={Header} sidebar={Sidebar}>
|
|
@@ -505,13 +505,21 @@ class GroupPage extends React.Component {
|
|
|
505
505
|
<PageNavigation>
|
|
506
506
|
<Nav aria-label="Group section navigation" variant="tertiary">
|
|
507
507
|
<NavList>
|
|
508
|
-
<NavItem itemId={0} isActive>
|
|
508
|
+
<NavItem href="#" itemId={0} isActive>
|
|
509
509
|
System panel
|
|
510
510
|
</NavItem>
|
|
511
|
-
<NavItem itemId={1}>
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
<NavItem itemId={
|
|
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>
|
|
515
523
|
</NavList>
|
|
516
524
|
</Nav>
|
|
517
525
|
</PageNavigation>
|
|
@@ -582,7 +590,7 @@ class VerticalPage extends React.Component {
|
|
|
582
590
|
navToggleId="vertical-pageheader-toggle"
|
|
583
591
|
/>
|
|
584
592
|
);
|
|
585
|
-
const Sidebar = <PageSidebar nav="Navigation" isNavOpen={isNavOpen} id="vertical-pageheader-sidebar"/>;
|
|
593
|
+
const Sidebar = <PageSidebar nav="Navigation" isNavOpen={isNavOpen} id="vertical-pageheader-sidebar" />;
|
|
586
594
|
|
|
587
595
|
return (
|
|
588
596
|
<Page header={Header} sidebar={Sidebar}>
|
|
@@ -630,7 +638,12 @@ CenterAlignedPageSection = () => {
|
|
|
630
638
|
const Header = (
|
|
631
639
|
<Masthead>
|
|
632
640
|
<MastheadToggle>
|
|
633
|
-
<PageToggleButton
|
|
641
|
+
<PageToggleButton
|
|
642
|
+
variant="plain"
|
|
643
|
+
aria-label="Global navigation"
|
|
644
|
+
onNavToggle={this.onNavToggle}
|
|
645
|
+
id="centered-nav-toggle"
|
|
646
|
+
>
|
|
634
647
|
<BarsIcon />
|
|
635
648
|
</PageToggleButton>
|
|
636
649
|
</MastheadToggle>
|
|
@@ -28,9 +28,9 @@ class PaginationTop extends React.Component {
|
|
|
28
28
|
});
|
|
29
29
|
};
|
|
30
30
|
|
|
31
|
-
this.onPerPageSelect = (_event, perPage) => {
|
|
31
|
+
this.onPerPageSelect = (_event, perPage, page) => {
|
|
32
32
|
this.setState({
|
|
33
|
-
perPage
|
|
33
|
+
page, perPage
|
|
34
34
|
});
|
|
35
35
|
};
|
|
36
36
|
}
|
|
@@ -68,9 +68,9 @@ class PaginationBottom extends React.Component {
|
|
|
68
68
|
page: pageNumber
|
|
69
69
|
});
|
|
70
70
|
};
|
|
71
|
-
this.onPerPageSelect = (_event, perPage) => {
|
|
71
|
+
this.onPerPageSelect = (_event, perPage, page) => {
|
|
72
72
|
this.setState({
|
|
73
|
-
perPage
|
|
73
|
+
page, perPage
|
|
74
74
|
});
|
|
75
75
|
};
|
|
76
76
|
}
|
|
@@ -149,9 +149,9 @@ class PaginationDisabled extends React.Component {
|
|
|
149
149
|
});
|
|
150
150
|
};
|
|
151
151
|
|
|
152
|
-
this.onPerPageSelect = (_event, perPage) => {
|
|
152
|
+
this.onPerPageSelect = (_event, perPage, page) => {
|
|
153
153
|
this.setState({
|
|
154
|
-
perPage
|
|
154
|
+
page, perPage
|
|
155
155
|
});
|
|
156
156
|
};
|
|
157
157
|
}
|
|
@@ -193,9 +193,9 @@ class PaginationTop extends React.Component {
|
|
|
193
193
|
});
|
|
194
194
|
};
|
|
195
195
|
|
|
196
|
-
this.onPerPageSelect = (_event, perPage) => {
|
|
196
|
+
this.onPerPageSelect = (_event, perPage, page) => {
|
|
197
197
|
this.setState({
|
|
198
|
-
perPage
|
|
198
|
+
page, perPage
|
|
199
199
|
});
|
|
200
200
|
};
|
|
201
201
|
}
|
|
@@ -236,9 +236,9 @@ class PaginationTop extends React.Component {
|
|
|
236
236
|
});
|
|
237
237
|
};
|
|
238
238
|
|
|
239
|
-
this.onPerPageSelect = (_event, perPage) => {
|
|
239
|
+
this.onPerPageSelect = (_event, perPage, page) => {
|
|
240
240
|
this.setState({
|
|
241
|
-
perPage
|
|
241
|
+
page, perPage
|
|
242
242
|
});
|
|
243
243
|
};
|
|
244
244
|
}
|
|
@@ -279,9 +279,9 @@ class PaginationTop extends React.Component {
|
|
|
279
279
|
});
|
|
280
280
|
};
|
|
281
281
|
|
|
282
|
-
this.onPerPageSelect = (_event, perPage) => {
|
|
282
|
+
this.onPerPageSelect = (_event, perPage, page) => {
|
|
283
283
|
this.setState({
|
|
284
|
-
perPage
|
|
284
|
+
page, perPage
|
|
285
285
|
});
|
|
286
286
|
};
|
|
287
287
|
}
|
|
@@ -330,9 +330,9 @@ class PaginationSticky extends React.Component {
|
|
|
330
330
|
});
|
|
331
331
|
};
|
|
332
332
|
|
|
333
|
-
this.onPerPageSelect = (_event, perPage) => {
|
|
333
|
+
this.onPerPageSelect = (_event, perPage, page) => {
|
|
334
334
|
this.setState({
|
|
335
|
-
perPage
|
|
335
|
+
page, perPage
|
|
336
336
|
});
|
|
337
337
|
};
|
|
338
338
|
}
|
|
@@ -1169,9 +1169,9 @@ class ToolbarStacked extends React.Component {
|
|
|
1169
1169
|
});
|
|
1170
1170
|
};
|
|
1171
1171
|
|
|
1172
|
-
this.onPerPageSelect = (_event, perPage) => {
|
|
1172
|
+
this.onPerPageSelect = (_event, perPage, page) => {
|
|
1173
1173
|
this.setState({
|
|
1174
|
-
perPage
|
|
1174
|
+
page, perPage
|
|
1175
1175
|
});
|
|
1176
1176
|
};
|
|
1177
1177
|
|
|
@@ -367,6 +367,12 @@ export class Wizard extends React.Component<WizardProps, WizardState> {
|
|
|
367
367
|
}
|
|
368
368
|
}
|
|
369
369
|
|
|
370
|
+
componentDidUpdate(prevProps: Readonly<WizardProps>) {
|
|
371
|
+
if (prevProps.startAtStep !== this.props.startAtStep) {
|
|
372
|
+
this.setState({ currentStep: this.props.startAtStep });
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
|
|
370
376
|
render() {
|
|
371
377
|
const {
|
|
372
378
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
@@ -342,3 +342,34 @@ describe('Wizard', () => {
|
|
|
342
342
|
|
|
343
343
|
expect(screen.getByRole('button',{ name: "A-2" })).toBeDisabled();
|
|
344
344
|
});
|
|
345
|
+
|
|
346
|
+
test('startAtStep can be used to externally control the current step of the wizard', () => {
|
|
347
|
+
const WizardTest = () => {
|
|
348
|
+
const [step, setStep] = React.useState(1);
|
|
349
|
+
|
|
350
|
+
const incrementStep = () => {
|
|
351
|
+
setStep(prevStep => prevStep + 1);
|
|
352
|
+
};
|
|
353
|
+
|
|
354
|
+
const steps: WizardStep[] = [
|
|
355
|
+
{ name: 'A', component: <p>Step 1</p> },
|
|
356
|
+
{ name: 'B', component: <p>Step 2</p> },
|
|
357
|
+
{ name: 'C', component: <p>Step 3</p> }
|
|
358
|
+
];
|
|
359
|
+
|
|
360
|
+
return (
|
|
361
|
+
<>
|
|
362
|
+
<Wizard steps={steps} startAtStep={step} />
|
|
363
|
+
<button onClick={() => incrementStep()}>Increment step</button>
|
|
364
|
+
</>
|
|
365
|
+
);
|
|
366
|
+
};
|
|
367
|
+
|
|
368
|
+
render(<WizardTest />);
|
|
369
|
+
|
|
370
|
+
expect(screen.queryByText('Step 2')).not.toBeInTheDocument();
|
|
371
|
+
|
|
372
|
+
userEvent.click(screen.getByRole('button', { name: 'Increment step'}))
|
|
373
|
+
|
|
374
|
+
expect(screen.getByText('Step 2')).toBeVisible();
|
|
375
|
+
});
|