@patternfly/react-core 5.0.0-alpha.20 → 5.0.0-alpha.22
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 +12 -0
- package/components/CalendarMonth/CalendarMonth.d.ts +2 -2
- package/components/CalendarMonth/CalendarMonth.d.ts.map +1 -1
- package/components/CalendarMonth/CalendarMonth.js +7 -7
- package/components/CalendarMonth/CalendarMonth.js.map +1 -1
- package/components/DataList/DataListCheck.d.ts +1 -1
- package/components/DataList/DataListCheck.d.ts.map +1 -1
- package/components/DataList/DataListCheck.js +2 -2
- package/components/DataList/DataListCheck.js.map +1 -1
- package/components/DatePicker/DatePicker.js +1 -1
- package/components/DatePicker/DatePicker.js.map +1 -1
- package/dist/esm/components/CalendarMonth/CalendarMonth.d.ts +2 -2
- package/dist/esm/components/CalendarMonth/CalendarMonth.d.ts.map +1 -1
- package/dist/esm/components/CalendarMonth/CalendarMonth.js +7 -7
- package/dist/esm/components/CalendarMonth/CalendarMonth.js.map +1 -1
- package/dist/esm/components/DataList/DataListCheck.d.ts +1 -1
- package/dist/esm/components/DataList/DataListCheck.d.ts.map +1 -1
- package/dist/esm/components/DataList/DataListCheck.js +2 -2
- package/dist/esm/components/DataList/DataListCheck.js.map +1 -1
- package/dist/esm/components/DatePicker/DatePicker.js +1 -1
- package/dist/esm/components/DatePicker/DatePicker.js.map +1 -1
- package/dist/js/components/CalendarMonth/CalendarMonth.d.ts +2 -2
- package/dist/js/components/CalendarMonth/CalendarMonth.d.ts.map +1 -1
- package/dist/js/components/CalendarMonth/CalendarMonth.js +7 -7
- package/dist/js/components/CalendarMonth/CalendarMonth.js.map +1 -1
- package/dist/js/components/DataList/DataListCheck.d.ts +1 -1
- package/dist/js/components/DataList/DataListCheck.d.ts.map +1 -1
- package/dist/js/components/DataList/DataListCheck.js +2 -2
- package/dist/js/components/DataList/DataListCheck.js.map +1 -1
- package/dist/js/components/DatePicker/DatePicker.js +1 -1
- package/dist/js/components/DatePicker/DatePicker.js.map +1 -1
- package/dist/umd/react-core.min.js +1 -1
- package/package.json +2 -2
- package/src/components/CalendarMonth/CalendarMonth.tsx +10 -10
- package/src/components/CalendarMonth/examples/CalendarMonthSelectableDate.tsx +10 -2
- package/src/components/DataList/DataListCheck.tsx +3 -3
- package/src/components/DataList/__tests__/Generated/DataListCheck.test.tsx +1 -1
- package/src/components/DatePicker/DatePicker.tsx +1 -1
- package/src/demos/examples/DateTimePicker/DateTimePicker.tsx +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@patternfly/react-core",
|
|
3
|
-
"version": "5.0.0-alpha.
|
|
3
|
+
"version": "5.0.0-alpha.22",
|
|
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",
|
|
@@ -70,5 +70,5 @@
|
|
|
70
70
|
"react": "^16.8 || ^17 || ^18",
|
|
71
71
|
"react-dom": "^16.8 || ^17 || ^18"
|
|
72
72
|
},
|
|
73
|
-
"gitHead": "
|
|
73
|
+
"gitHead": "4ce5d3887ed6061107702090244b680ca006f3f1"
|
|
74
74
|
}
|
|
@@ -70,11 +70,11 @@ export interface CalendarProps extends CalendarFormat, Omit<React.HTMLProps<HTML
|
|
|
70
70
|
/** Flag to set browser focus on the passed date. **/
|
|
71
71
|
isDateFocused?: boolean;
|
|
72
72
|
/** Callback when date is selected. */
|
|
73
|
-
onChange?: (date: Date) => void;
|
|
73
|
+
onChange?: (event: React.MouseEvent<HTMLButtonElement, MouseEvent>, date: Date) => void;
|
|
74
74
|
/** Callback when month or year is changed. */
|
|
75
75
|
onMonthChange?: (
|
|
76
|
-
|
|
77
|
-
|
|
76
|
+
event?: React.MouseEvent | React.ChangeEvent | React.FormEvent<HTMLInputElement>,
|
|
77
|
+
newDate?: Date
|
|
78
78
|
) => void;
|
|
79
79
|
/** @hide Internal prop to allow pressing escape in select menu to not close popover. */
|
|
80
80
|
onSelectToggle?: (open: boolean) => void;
|
|
@@ -187,11 +187,11 @@ export const CalendarMonth = ({
|
|
|
187
187
|
}
|
|
188
188
|
}, [focusedDate, isDateFocused, focusedDateValidated, focusRef]);
|
|
189
189
|
|
|
190
|
-
const onMonthClick = (
|
|
190
|
+
const onMonthClick = (ev: React.MouseEvent, newDate: Date) => {
|
|
191
191
|
setFocusedDate(newDate);
|
|
192
192
|
setHoveredDate(newDate);
|
|
193
193
|
setShouldFocus(false);
|
|
194
|
-
onMonthChange(
|
|
194
|
+
onMonthChange(ev, newDate);
|
|
195
195
|
};
|
|
196
196
|
|
|
197
197
|
const onKeyDown = (ev: React.KeyboardEvent<HTMLTableSectionElement>) => {
|
|
@@ -252,7 +252,7 @@ export const CalendarMonth = ({
|
|
|
252
252
|
<Button
|
|
253
253
|
variant="plain"
|
|
254
254
|
aria-label={prevMonthAriaLabel}
|
|
255
|
-
onClick={(ev: React.MouseEvent) => onMonthClick(
|
|
255
|
+
onClick={(ev: React.MouseEvent) => onMonthClick(ev, prevMonth)}
|
|
256
256
|
>
|
|
257
257
|
<AngleLeftIcon aria-hidden={true} />
|
|
258
258
|
</Button>
|
|
@@ -282,7 +282,7 @@ export const CalendarMonth = ({
|
|
|
282
282
|
setFocusedDate(newDate);
|
|
283
283
|
setHoveredDate(newDate);
|
|
284
284
|
setShouldFocus(false);
|
|
285
|
-
onMonthChange(
|
|
285
|
+
onMonthChange(ev, newDate);
|
|
286
286
|
}, 0);
|
|
287
287
|
}}
|
|
288
288
|
variant="single"
|
|
@@ -306,7 +306,7 @@ export const CalendarMonth = ({
|
|
|
306
306
|
setFocusedDate(newDate);
|
|
307
307
|
setHoveredDate(newDate);
|
|
308
308
|
setShouldFocus(false);
|
|
309
|
-
onMonthChange(
|
|
309
|
+
onMonthChange(ev, newDate);
|
|
310
310
|
}}
|
|
311
311
|
/>
|
|
312
312
|
</div>
|
|
@@ -315,7 +315,7 @@ export const CalendarMonth = ({
|
|
|
315
315
|
<Button
|
|
316
316
|
variant="plain"
|
|
317
317
|
aria-label={nextMonthAriaLabel}
|
|
318
|
-
onClick={(ev: React.MouseEvent) => onMonthClick(
|
|
318
|
+
onClick={(ev: React.MouseEvent) => onMonthClick(ev, nextMonth)}
|
|
319
319
|
>
|
|
320
320
|
<AngleRightIcon aria-hidden={true} />
|
|
321
321
|
</Button>
|
|
@@ -377,7 +377,7 @@ export const CalendarMonth = ({
|
|
|
377
377
|
!isValid && styles.modifiers.disabled
|
|
378
378
|
)}
|
|
379
379
|
type="button"
|
|
380
|
-
onClick={() => onChange(date)}
|
|
380
|
+
onClick={(event) => onChange(event, date)}
|
|
381
381
|
onMouseOver={() => setHoveredDate(date)}
|
|
382
382
|
tabIndex={isFocused ? 0 : -1}
|
|
383
383
|
disabled={!isValid}
|
|
@@ -4,7 +4,10 @@ import { CalendarMonth, Title, CalendarMonthInlineProps } from '@patternfly/reac
|
|
|
4
4
|
export const CalendarMonthSelectableDate: React.FunctionComponent = () => {
|
|
5
5
|
const [date, setDate] = React.useState(new Date(2020, 10, 24));
|
|
6
6
|
|
|
7
|
-
const onMonthChange = (
|
|
7
|
+
const onMonthChange = (
|
|
8
|
+
_event: React.MouseEvent | React.ChangeEvent | React.FormEvent<HTMLInputElement> | undefined,
|
|
9
|
+
newDate: Date
|
|
10
|
+
) => {
|
|
8
11
|
// eslint-disable-next-line no-console
|
|
9
12
|
console.log(`updated month: ${newDate.getMonth()}, updated year: ${newDate.getFullYear()}`);
|
|
10
13
|
};
|
|
@@ -21,7 +24,12 @@ export const CalendarMonthSelectableDate: React.FunctionComponent = () => {
|
|
|
21
24
|
|
|
22
25
|
return (
|
|
23
26
|
<>
|
|
24
|
-
<CalendarMonth
|
|
27
|
+
<CalendarMonth
|
|
28
|
+
date={date}
|
|
29
|
+
onChange={(_event: React.MouseEvent<HTMLButtonElement, MouseEvent>, date: Date) => setDate(date)}
|
|
30
|
+
onMonthChange={onMonthChange}
|
|
31
|
+
inlineProps={inlineProps}
|
|
32
|
+
/>
|
|
25
33
|
<pre>Selected date: {date.toString()}</pre>
|
|
26
34
|
</>
|
|
27
35
|
);
|
|
@@ -24,7 +24,7 @@ export interface DataListCheckProps extends Omit<React.HTMLProps<HTMLInputElemen
|
|
|
24
24
|
*/
|
|
25
25
|
defaultChecked?: boolean;
|
|
26
26
|
/** A callback for when the DataList checkbox selection changes */
|
|
27
|
-
onChange?: (
|
|
27
|
+
onChange?: (event: React.FormEvent<HTMLInputElement>, checked: boolean) => void;
|
|
28
28
|
/** Aria-labelledby of the DataList checkbox */
|
|
29
29
|
'aria-labelledby': string;
|
|
30
30
|
/** Flag to indicate if other controls are used in the DataListItem */
|
|
@@ -34,7 +34,7 @@ export interface DataListCheckProps extends Omit<React.HTMLProps<HTMLInputElemen
|
|
|
34
34
|
export const DataListCheck: React.FunctionComponent<DataListCheckProps> = ({
|
|
35
35
|
className = '',
|
|
36
36
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
37
|
-
onChange = (
|
|
37
|
+
onChange = (event: React.FormEvent<HTMLInputElement>, checked: boolean) => {},
|
|
38
38
|
isValid = true,
|
|
39
39
|
isDisabled = false,
|
|
40
40
|
isChecked = false,
|
|
@@ -48,7 +48,7 @@ export const DataListCheck: React.FunctionComponent<DataListCheckProps> = ({
|
|
|
48
48
|
<input
|
|
49
49
|
{...props}
|
|
50
50
|
type="checkbox"
|
|
51
|
-
onChange={event => onChange(event.currentTarget.checked
|
|
51
|
+
onChange={(event) => onChange(event, event.currentTarget.checked)}
|
|
52
52
|
aria-invalid={!isValid}
|
|
53
53
|
disabled={isDisabled}
|
|
54
54
|
{...([true, false].includes(defaultChecked) && { defaultChecked })}
|
|
@@ -15,7 +15,7 @@ it('DataListCheck should match snapshot (auto-generated)', () => {
|
|
|
15
15
|
isDisabled={false}
|
|
16
16
|
isChecked={null}
|
|
17
17
|
checked={null}
|
|
18
|
-
onChange={(
|
|
18
|
+
onChange={(event: React.FormEvent<HTMLInputElement>, checked: boolean) => {}}
|
|
19
19
|
aria-labelledby={'string'}
|
|
20
20
|
/>
|
|
21
21
|
);
|
|
@@ -165,7 +165,7 @@ const DatePickerBase = (
|
|
|
165
165
|
}
|
|
166
166
|
};
|
|
167
167
|
|
|
168
|
-
const onDateClick = (newValueDate: Date) => {
|
|
168
|
+
const onDateClick = (_event: React.MouseEvent<HTMLButtonElement, MouseEvent>, newValueDate: Date) => {
|
|
169
169
|
const newValue = dateFormat(newValueDate);
|
|
170
170
|
setValue(newValue);
|
|
171
171
|
setValueDate(newValueDate);
|
|
@@ -32,7 +32,7 @@ export const DateTimePicker: React.FunctionComponent = () => {
|
|
|
32
32
|
setIsCalendarOpen(false);
|
|
33
33
|
};
|
|
34
34
|
|
|
35
|
-
const onSelectCalendar = (newValueDate: Date) => {
|
|
35
|
+
const onSelectCalendar = (_event: React.MouseEvent<HTMLButtonElement, MouseEvent>, newValueDate: Date) => {
|
|
36
36
|
const newValue = dateFormat(newValueDate);
|
|
37
37
|
setValueDate(newValue);
|
|
38
38
|
setIsCalendarOpen(!isCalendarOpen);
|