@patternfly/react-core 4.271.2 → 4.272.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 +16 -0
- package/components/TimePicker/TimePicker.d.ts +2 -2
- package/components/TimePicker/TimePicker.d.ts.map +1 -1
- package/components/TimePicker/TimePicker.js +3 -3
- package/components/TimePicker/TimePicker.js.map +1 -1
- package/components/Wizard/Wizard.d.ts +2 -0
- package/components/Wizard/Wizard.d.ts.map +1 -1
- package/components/Wizard/Wizard.js +4 -3
- package/components/Wizard/Wizard.js.map +1 -1
- package/components/Wizard/WizardBody.d.ts +2 -0
- package/components/Wizard/WizardBody.d.ts.map +1 -1
- package/components/Wizard/WizardBody.js +2 -2
- package/components/Wizard/WizardBody.js.map +1 -1
- package/components/Wizard/WizardToggle.d.ts +2 -0
- package/components/Wizard/WizardToggle.d.ts.map +1 -1
- package/components/Wizard/WizardToggle.js +2 -2
- package/components/Wizard/WizardToggle.js.map +1 -1
- package/dist/esm/components/TimePicker/TimePicker.d.ts +2 -2
- package/dist/esm/components/TimePicker/TimePicker.d.ts.map +1 -1
- package/dist/esm/components/TimePicker/TimePicker.js +3 -3
- package/dist/esm/components/TimePicker/TimePicker.js.map +1 -1
- package/dist/esm/components/Wizard/Wizard.d.ts +2 -0
- package/dist/esm/components/Wizard/Wizard.d.ts.map +1 -1
- package/dist/esm/components/Wizard/Wizard.js +4 -3
- package/dist/esm/components/Wizard/Wizard.js.map +1 -1
- package/dist/esm/components/Wizard/WizardBody.d.ts +2 -0
- package/dist/esm/components/Wizard/WizardBody.d.ts.map +1 -1
- package/dist/esm/components/Wizard/WizardBody.js +2 -2
- package/dist/esm/components/Wizard/WizardBody.js.map +1 -1
- package/dist/esm/components/Wizard/WizardToggle.d.ts +2 -0
- package/dist/esm/components/Wizard/WizardToggle.d.ts.map +1 -1
- package/dist/esm/components/Wizard/WizardToggle.js +2 -2
- package/dist/esm/components/Wizard/WizardToggle.js.map +1 -1
- package/dist/js/components/TimePicker/TimePicker.d.ts +2 -2
- package/dist/js/components/TimePicker/TimePicker.d.ts.map +1 -1
- package/dist/js/components/TimePicker/TimePicker.js +3 -3
- package/dist/js/components/TimePicker/TimePicker.js.map +1 -1
- package/dist/js/components/Wizard/Wizard.d.ts +2 -0
- package/dist/js/components/Wizard/Wizard.d.ts.map +1 -1
- package/dist/js/components/Wizard/Wizard.js +4 -3
- package/dist/js/components/Wizard/Wizard.js.map +1 -1
- package/dist/js/components/Wizard/WizardBody.d.ts +2 -0
- package/dist/js/components/Wizard/WizardBody.d.ts.map +1 -1
- package/dist/js/components/Wizard/WizardBody.js +2 -2
- package/dist/js/components/Wizard/WizardBody.js.map +1 -1
- package/dist/js/components/Wizard/WizardToggle.d.ts +2 -0
- package/dist/js/components/Wizard/WizardToggle.d.ts.map +1 -1
- package/dist/js/components/Wizard/WizardToggle.js +2 -2
- package/dist/js/components/Wizard/WizardToggle.js.map +1 -1
- package/dist/umd/react-core.min.js +1 -1
- package/package.json +2 -2
- package/src/components/TimePicker/TimePicker.tsx +11 -3
- package/src/components/TimePicker/__tests__/TimePicker.test.tsx +8 -1
- package/src/components/TimePicker/examples/TimePicker.md +1 -1
- package/src/components/Wizard/Wizard.tsx +6 -1
- package/src/components/Wizard/WizardBody.tsx +3 -1
- package/src/components/Wizard/WizardToggle.tsx +5 -1
- package/src/components/Wizard/examples/WizardWithDrawer.tsx +5 -0
- package/src/demos/DatePicker/DatePicker.md +2 -2
- package/src/demos/Wizard/WizardDemo.md +4 -0
- package/src/next/components/Wizard/examples/WizardKitchenSink.tsx +9 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@patternfly/react-core",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.272.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",
|
|
@@ -71,5 +71,5 @@
|
|
|
71
71
|
"react": "^16.8 || ^17 || ^18",
|
|
72
72
|
"react-dom": "^16.8 || ^17 || ^18"
|
|
73
73
|
},
|
|
74
|
-
"gitHead": "
|
|
74
|
+
"gitHead": "98f8a725aca70798a70fa397ac93e3f870a32b29"
|
|
75
75
|
}
|
|
@@ -42,7 +42,14 @@ export interface TimePickerProps
|
|
|
42
42
|
/** True if the time is 24 hour time. False if the time is 12 hour time */
|
|
43
43
|
is24Hour?: boolean;
|
|
44
44
|
/** Optional event handler called each time the value in the time picker input changes. */
|
|
45
|
-
onChange?: (
|
|
45
|
+
onChange?: (
|
|
46
|
+
event: React.FormEvent<HTMLInputElement>,
|
|
47
|
+
time: string,
|
|
48
|
+
hour?: number,
|
|
49
|
+
minute?: number,
|
|
50
|
+
seconds?: number,
|
|
51
|
+
isValid?: boolean
|
|
52
|
+
) => void;
|
|
46
53
|
/** Optional validator can be provided to override the internal time validator. */
|
|
47
54
|
validateTime?: (time: string) => boolean;
|
|
48
55
|
/** Id of the time picker */
|
|
@@ -389,7 +396,7 @@ export class TimePicker extends React.Component<TimePickerProps, TimePickerState
|
|
|
389
396
|
const { delimiter, is24Hour, includeSeconds, setIsOpen } = this.props;
|
|
390
397
|
const time = parseTime(e.target.textContent, timeRegex, delimiter, !is24Hour, includeSeconds);
|
|
391
398
|
if (time !== timeState) {
|
|
392
|
-
this.onInputChange(time);
|
|
399
|
+
this.onInputChange(time, e);
|
|
393
400
|
}
|
|
394
401
|
|
|
395
402
|
this.inputRef.current.focus();
|
|
@@ -407,12 +414,13 @@ export class TimePicker extends React.Component<TimePickerProps, TimePickerState
|
|
|
407
414
|
e.stopPropagation();
|
|
408
415
|
};
|
|
409
416
|
|
|
410
|
-
onInputChange = (newTime: string) => {
|
|
417
|
+
onInputChange = (newTime: string, event: React.FormEvent<HTMLInputElement>) => {
|
|
411
418
|
const { onChange } = this.props;
|
|
412
419
|
const { timeRegex } = this.state;
|
|
413
420
|
|
|
414
421
|
if (onChange) {
|
|
415
422
|
onChange(
|
|
423
|
+
event,
|
|
416
424
|
newTime,
|
|
417
425
|
getHours(newTime, timeRegex),
|
|
418
426
|
getMinutes(newTime, timeRegex),
|
|
@@ -35,7 +35,14 @@ describe('TimePicker', () => {
|
|
|
35
35
|
render(<TimePicker onChange={onChange} {...inputProps} aria-label="time picker" />);
|
|
36
36
|
|
|
37
37
|
await user.type(screen.getByLabelText('time picker'), String(inputProps.value));
|
|
38
|
-
expect(onChange).toHaveBeenCalledWith(
|
|
38
|
+
expect(onChange).toHaveBeenCalledWith(
|
|
39
|
+
expect.any(Object),
|
|
40
|
+
inputProps.value,
|
|
41
|
+
expects.hour,
|
|
42
|
+
expects.minutes,
|
|
43
|
+
expects.seconds,
|
|
44
|
+
true
|
|
45
|
+
);
|
|
39
46
|
};
|
|
40
47
|
|
|
41
48
|
test('should return the correct value using the AM/PM pattern - midnight', async () => {
|
|
@@ -19,7 +19,7 @@ import React from 'react';
|
|
|
19
19
|
import { TimePicker } from '@patternfly/react-core';
|
|
20
20
|
|
|
21
21
|
SimpleTimePicker = () => {
|
|
22
|
-
const onChange = (time, hour, minute, seconds, isValid) => {
|
|
22
|
+
const onChange = (_event, time, hour, minute, seconds, isValid) => {
|
|
23
23
|
console.log('time', time);
|
|
24
24
|
console.log('hour', hour);
|
|
25
25
|
console.log('minute', minute);
|
|
@@ -112,6 +112,8 @@ export interface WizardProps extends React.HTMLProps<HTMLDivElement> {
|
|
|
112
112
|
hasDrawer?: boolean;
|
|
113
113
|
/** Flag indicating the wizard drawer is expanded */
|
|
114
114
|
isDrawerExpanded?: boolean;
|
|
115
|
+
/** Callback function for when the drawer is toggled. Can be used to set browser focus in the drawer. */
|
|
116
|
+
onExpandDrawer?: () => void;
|
|
115
117
|
}
|
|
116
118
|
|
|
117
119
|
interface WizardState {
|
|
@@ -149,7 +151,8 @@ export class Wizard extends React.Component<WizardProps, WizardState> {
|
|
|
149
151
|
isOpen: undefined,
|
|
150
152
|
isNavExpandable: false,
|
|
151
153
|
hasDrawer: false,
|
|
152
|
-
isDrawerExpanded: false
|
|
154
|
+
isDrawerExpanded: false,
|
|
155
|
+
onExpandDrawer: () => undefined as any
|
|
153
156
|
};
|
|
154
157
|
private titleId: string;
|
|
155
158
|
private descriptionId: string;
|
|
@@ -408,6 +411,7 @@ export class Wizard extends React.Component<WizardProps, WizardState> {
|
|
|
408
411
|
onCurrentStepChanged,
|
|
409
412
|
hasDrawer,
|
|
410
413
|
isDrawerExpanded,
|
|
414
|
+
onExpandDrawer,
|
|
411
415
|
...rest
|
|
412
416
|
/* eslint-enable @typescript-eslint/no-unused-vars */
|
|
413
417
|
} = this.props;
|
|
@@ -539,6 +543,7 @@ export class Wizard extends React.Component<WizardProps, WizardState> {
|
|
|
539
543
|
<WizardToggle
|
|
540
544
|
hasDrawer={hasDrawer}
|
|
541
545
|
isDrawerExpanded={isDrawerExpanded}
|
|
546
|
+
onExpandDrawer={onExpandDrawer}
|
|
542
547
|
mainAriaLabel={mainAriaLabel}
|
|
543
548
|
isInPage={isOpen === undefined}
|
|
544
549
|
mainAriaLabelledBy={(title || mainAriaLabelledBy) && (mainAriaLabelledBy || this.titleId)}
|
|
@@ -22,6 +22,7 @@ export interface WizardBodyProps {
|
|
|
22
22
|
/** Flag indicating the wizard drawer is expanded */
|
|
23
23
|
isDrawerExpanded?: boolean;
|
|
24
24
|
/** Callback function for when the drawer is toggled */
|
|
25
|
+
onExpandDrawer?: () => void;
|
|
25
26
|
}
|
|
26
27
|
|
|
27
28
|
export const WizardBody: React.FunctionComponent<WizardBodyProps> = ({
|
|
@@ -32,6 +33,7 @@ export const WizardBody: React.FunctionComponent<WizardBodyProps> = ({
|
|
|
32
33
|
mainComponent = 'div',
|
|
33
34
|
hasDrawer,
|
|
34
35
|
isDrawerExpanded,
|
|
36
|
+
onExpandDrawer,
|
|
35
37
|
activeStep
|
|
36
38
|
}: WizardBodyProps) => {
|
|
37
39
|
const MainComponent = mainComponent;
|
|
@@ -40,7 +42,7 @@ export const WizardBody: React.FunctionComponent<WizardBodyProps> = ({
|
|
|
40
42
|
<WizardDrawerWrapper
|
|
41
43
|
hasDrawer={hasDrawer && activeStep.drawerPanelContent}
|
|
42
44
|
wrapper={(children: React.ReactNode) => (
|
|
43
|
-
<Drawer isInline isExpanded={isDrawerExpanded}>
|
|
45
|
+
<Drawer isInline isExpanded={isDrawerExpanded} onExpand={onExpandDrawer}>
|
|
44
46
|
<DrawerContent panelContent={activeStep.drawerPanelContent}>{children}</DrawerContent>
|
|
45
47
|
</Drawer>
|
|
46
48
|
)}
|
|
@@ -33,6 +33,8 @@ export interface WizardToggleProps {
|
|
|
33
33
|
hasDrawer?: boolean;
|
|
34
34
|
/** Flag indicating the wizard drawer is expanded */
|
|
35
35
|
isDrawerExpanded?: boolean;
|
|
36
|
+
/** Callback function for when the drawer is toggled */
|
|
37
|
+
onExpandDrawer?: () => void;
|
|
36
38
|
}
|
|
37
39
|
|
|
38
40
|
export const WizardToggle: React.FunctionComponent<WizardToggleProps> = ({
|
|
@@ -48,7 +50,8 @@ export const WizardToggle: React.FunctionComponent<WizardToggleProps> = ({
|
|
|
48
50
|
mainAriaLabel = null,
|
|
49
51
|
isInPage = true,
|
|
50
52
|
hasDrawer,
|
|
51
|
-
isDrawerExpanded
|
|
53
|
+
isDrawerExpanded,
|
|
54
|
+
onExpandDrawer
|
|
52
55
|
}: WizardToggleProps) => {
|
|
53
56
|
let activeStepIndex;
|
|
54
57
|
let activeStepName;
|
|
@@ -99,6 +102,7 @@ export const WizardToggle: React.FunctionComponent<WizardToggleProps> = ({
|
|
|
99
102
|
hasNoBodyPadding={hasNoBodyPadding}
|
|
100
103
|
activeStep={activeStep}
|
|
101
104
|
isDrawerExpanded={isDrawerExpanded}
|
|
105
|
+
onExpandDrawer={onExpandDrawer}
|
|
102
106
|
hasDrawer={hasDrawer}
|
|
103
107
|
>
|
|
104
108
|
{hasDrawer && !isDrawerExpanded && activeStep.drawerToggleButton}
|
|
@@ -14,6 +14,10 @@ export const WizardWithDrawer: React.FunctionComponent = () => {
|
|
|
14
14
|
|
|
15
15
|
const drawerRef = React.useRef<HTMLSpanElement>(null);
|
|
16
16
|
|
|
17
|
+
const onExpandDrawer = () => {
|
|
18
|
+
drawerRef.current && drawerRef.current.focus();
|
|
19
|
+
};
|
|
20
|
+
|
|
17
21
|
const onOpenClick = () => {
|
|
18
22
|
setIsDrawerExpanded(true);
|
|
19
23
|
};
|
|
@@ -117,6 +121,7 @@ export const WizardWithDrawer: React.FunctionComponent = () => {
|
|
|
117
121
|
<Wizard
|
|
118
122
|
height={400}
|
|
119
123
|
isDrawerExpanded={isDrawerExpanded}
|
|
124
|
+
onExpandDrawer={onExpandDrawer}
|
|
120
125
|
hasDrawer
|
|
121
126
|
navAriaLabel={`${title} steps`}
|
|
122
127
|
steps={steps}
|
|
@@ -80,7 +80,7 @@ DateTimeRangePicker = () => {
|
|
|
80
80
|
}
|
|
81
81
|
};
|
|
82
82
|
|
|
83
|
-
const onFromTimeChange = (time, hour, minute) => {
|
|
83
|
+
const onFromTimeChange = (_event, time, hour, minute) => {
|
|
84
84
|
if (isValidDate(from)) {
|
|
85
85
|
const updatedFromDate = new Date(from);
|
|
86
86
|
updatedFromDate.setHours(hour);
|
|
@@ -99,7 +99,7 @@ DateTimeRangePicker = () => {
|
|
|
99
99
|
}
|
|
100
100
|
};
|
|
101
101
|
|
|
102
|
-
const onToTimeChange = (time, hour, minute) => {
|
|
102
|
+
const onToTimeChange = (_event, time, hour, minute) => {
|
|
103
103
|
if (isValidDate(to)) {
|
|
104
104
|
const updatedToDate = new Date(to);
|
|
105
105
|
updatedToDate.setHours(hour);
|
|
@@ -289,6 +289,7 @@ class WizardModalWithDrawerDemo extends React.Component {
|
|
|
289
289
|
navAriaLabel={`${title} steps`}
|
|
290
290
|
hasDrawer
|
|
291
291
|
isDrawerExpanded={isDrawerExpanded}
|
|
292
|
+
onExpandDrawer={this.onExpand}
|
|
292
293
|
mainAriaLabel={`${title} content`}
|
|
293
294
|
titleId="wiz-modal-demo-title"
|
|
294
295
|
descriptionId="wiz-modal-demo-description"
|
|
@@ -539,6 +540,7 @@ class WizardModalWithDrawerDemo extends React.Component {
|
|
|
539
540
|
navAriaLabel={`${title} steps`}
|
|
540
541
|
hasDrawer
|
|
541
542
|
isDrawerExpanded={isDrawerExpanded}
|
|
543
|
+
onExpandDrawer={this.onExpand}
|
|
542
544
|
mainAriaLabel={`${title} content`}
|
|
543
545
|
titleId="wiz-modal-demo-title"
|
|
544
546
|
descriptionId="wiz-modal-demo-description"
|
|
@@ -877,6 +879,7 @@ class FullPageWizard extends React.Component {
|
|
|
877
879
|
<Wizard
|
|
878
880
|
hasDrawer
|
|
879
881
|
isDrawerExpanded={isDrawerExpanded}
|
|
882
|
+
onExpandDrawer={this.onExpand}
|
|
880
883
|
navAriaLabel={`${title} steps`}
|
|
881
884
|
mainAriaLabel={`${title} content`}
|
|
882
885
|
steps={steps}
|
|
@@ -1194,6 +1197,7 @@ class FullPageWizard extends React.Component {
|
|
|
1194
1197
|
<Wizard
|
|
1195
1198
|
hasDrawer
|
|
1196
1199
|
isDrawerExpanded={isDrawerExpanded}
|
|
1200
|
+
onExpandDrawer={this.onExpand}
|
|
1197
1201
|
navAriaLabel={`${title} steps`}
|
|
1198
1202
|
mainAriaLabel={`${title} content`}
|
|
1199
1203
|
steps={steps}
|
|
@@ -76,14 +76,21 @@ const CustomWizardFooter = () => {
|
|
|
76
76
|
|
|
77
77
|
const StepContentWithDrawer = () => {
|
|
78
78
|
const [isDrawerExpanded, setIsDrawerExpanded] = React.useState(false);
|
|
79
|
+
const drawerRef = React.useRef<HTMLSpanElement>(null);
|
|
80
|
+
|
|
81
|
+
const onWizardExpand = () => {
|
|
82
|
+
drawerRef.current && drawerRef.current.focus();
|
|
83
|
+
};
|
|
79
84
|
|
|
80
85
|
return (
|
|
81
|
-
<Drawer isInline isExpanded={isDrawerExpanded}>
|
|
86
|
+
<Drawer isInline isExpanded={isDrawerExpanded} onExpand={onWizardExpand}>
|
|
82
87
|
<DrawerContent
|
|
83
88
|
panelContent={
|
|
84
89
|
<DrawerPanelContent widths={{ default: 'width_33' }} colorVariant={DrawerColorVariant.light200}>
|
|
85
90
|
<DrawerHead>
|
|
86
|
-
<span tabIndex={isDrawerExpanded ? 0 : -1}
|
|
91
|
+
<span tabIndex={isDrawerExpanded ? 0 : -1} ref={drawerRef}>
|
|
92
|
+
drawer content
|
|
93
|
+
</span>
|
|
87
94
|
<DrawerActions>
|
|
88
95
|
<DrawerCloseButton onClick={() => setIsDrawerExpanded(false)} />
|
|
89
96
|
</DrawerActions>
|