@fluentui/react-datepicker-compat 0.1.4 → 0.1.6
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.json +169 -1
- package/CHANGELOG.md +43 -2
- package/dist/index.d.ts +4 -1
- package/lib/Calendar.js +0 -1
- package/lib/Calendar.js.map +1 -1
- package/lib/CalendarDay.js +0 -1
- package/lib/CalendarDay.js.map +1 -1
- package/lib/CalendarDayGrid.js +0 -1
- package/lib/CalendarDayGrid.js.map +1 -1
- package/lib/CalendarMonth.js +0 -1
- package/lib/CalendarMonth.js.map +1 -1
- package/lib/CalendarPicker.js +0 -1
- package/lib/CalendarPicker.js.map +1 -1
- package/lib/CalendarYear.js +0 -1
- package/lib/CalendarYear.js.map +1 -1
- package/lib/DatePicker.js +0 -1
- package/lib/DatePicker.js.map +1 -1
- package/lib/components/Calendar/Calendar.js +278 -300
- package/lib/components/Calendar/Calendar.js.map +1 -1
- package/lib/components/Calendar/Calendar.types.js +7 -12
- package/lib/components/Calendar/Calendar.types.js.map +1 -1
- package/lib/components/Calendar/defaults.js +0 -1
- package/lib/components/Calendar/defaults.js.map +1 -1
- package/lib/components/Calendar/index.js +0 -1
- package/lib/components/Calendar/index.js.map +1 -1
- package/lib/components/Calendar/useCalendarStyles.styles.js.map +1 -1
- package/lib/components/CalendarDay/CalendarDay.js +100 -128
- package/lib/components/CalendarDay/CalendarDay.js.map +1 -1
- package/lib/components/CalendarDay/CalendarDay.types.js +0 -1
- package/lib/components/CalendarDay/CalendarDay.types.js.map +1 -1
- package/lib/components/CalendarDay/index.js +0 -1
- package/lib/components/CalendarDay/index.js.map +1 -1
- package/lib/components/CalendarDay/useCalendarDayStyles.styles.js.map +1 -1
- package/lib/components/CalendarDayGrid/CalendarDayGrid.js +146 -159
- package/lib/components/CalendarDayGrid/CalendarDayGrid.js.map +1 -1
- package/lib/components/CalendarDayGrid/CalendarDayGrid.types.js +0 -1
- package/lib/components/CalendarDayGrid/CalendarDayGrid.types.js.map +1 -1
- package/lib/components/CalendarDayGrid/CalendarGridDayCell.js +150 -179
- package/lib/components/CalendarDayGrid/CalendarGridDayCell.js.map +1 -1
- package/lib/components/CalendarDayGrid/CalendarGridRow.js +20 -34
- package/lib/components/CalendarDayGrid/CalendarGridRow.js.map +1 -1
- package/lib/components/CalendarDayGrid/CalendarMonthHeaderRow.js +29 -39
- package/lib/components/CalendarDayGrid/CalendarMonthHeaderRow.js.map +1 -1
- package/lib/components/CalendarDayGrid/index.js +0 -1
- package/lib/components/CalendarDayGrid/index.js.map +1 -1
- package/lib/components/CalendarDayGrid/useCalendarDayGridStyles.styles.js.map +1 -1
- package/lib/components/CalendarDayGrid/useWeekCornerStyles.styles.js.map +1 -1
- package/lib/components/CalendarDayGrid/useWeeks.js +34 -36
- package/lib/components/CalendarDayGrid/useWeeks.js.map +1 -1
- package/lib/components/CalendarMonth/CalendarMonth.js +238 -258
- package/lib/components/CalendarMonth/CalendarMonth.js.map +1 -1
- package/lib/components/CalendarMonth/CalendarMonth.types.js +0 -1
- package/lib/components/CalendarMonth/CalendarMonth.types.js.map +1 -1
- package/lib/components/CalendarMonth/index.js +0 -1
- package/lib/components/CalendarMonth/index.js.map +1 -1
- package/lib/components/CalendarMonth/useCalendarMonthStyles.js +2 -4
- package/lib/components/CalendarMonth/useCalendarMonthStyles.js.map +1 -1
- package/lib/components/CalendarPicker/CalendarPicker.types.js +1 -2
- package/lib/components/CalendarPicker/CalendarPicker.types.js.map +1 -1
- package/lib/components/CalendarPicker/index.js +0 -1
- package/lib/components/CalendarPicker/index.js.map +1 -1
- package/lib/components/CalendarPicker/useCalendarPickerStyles.styles.js.map +1 -1
- package/lib/components/CalendarYear/CalendarYear.js +260 -312
- package/lib/components/CalendarYear/CalendarYear.js.map +1 -1
- package/lib/components/CalendarYear/CalendarYear.types.js +0 -1
- package/lib/components/CalendarYear/CalendarYear.types.js.map +1 -1
- package/lib/components/CalendarYear/index.js +0 -1
- package/lib/components/CalendarYear/index.js.map +1 -1
- package/lib/components/CalendarYear/useCalendarYearStyles.styles.js.map +1 -1
- package/lib/components/DatePicker/DatePicker.js +4 -5
- package/lib/components/DatePicker/DatePicker.js.map +1 -1
- package/lib/components/DatePicker/DatePicker.types.js +0 -1
- package/lib/components/DatePicker/DatePicker.types.js.map +1 -1
- package/lib/components/DatePicker/defaults.js +9 -10
- package/lib/components/DatePicker/defaults.js.map +1 -1
- package/lib/components/DatePicker/index.js +0 -1
- package/lib/components/DatePicker/index.js.map +1 -1
- package/lib/components/DatePicker/renderDatePicker.js +5 -12
- package/lib/components/DatePicker/renderDatePicker.js.map +1 -1
- package/lib/components/DatePicker/useDatePicker.js +402 -354
- package/lib/components/DatePicker/useDatePicker.js.map +1 -1
- package/lib/components/DatePicker/useDatePickerStyles.styles.js.map +1 -1
- package/lib/index.js +0 -1
- package/lib/index.js.map +1 -1
- package/lib/utils/animations.js +72 -73
- package/lib/utils/animations.js.map +1 -1
- package/lib/utils/constants.js +50 -52
- package/lib/utils/constants.js.map +1 -1
- package/lib/utils/dateFormatting/dateFormatting.defaults.js +71 -34
- package/lib/utils/dateFormatting/dateFormatting.defaults.js.map +1 -1
- package/lib/utils/dateFormatting/dateFormatting.types.js +1 -2
- package/lib/utils/dateFormatting/dateFormatting.types.js.map +1 -1
- package/lib/utils/dateFormatting/index.js +0 -1
- package/lib/utils/dateFormatting/index.js.map +1 -1
- package/lib/utils/dateGrid/dateGrid.types.js +1 -2
- package/lib/utils/dateGrid/dateGrid.types.js.map +1 -1
- package/lib/utils/dateGrid/findAvailableDate.js +14 -21
- package/lib/utils/dateGrid/findAvailableDate.js.map +1 -1
- package/lib/utils/dateGrid/getBoundedDateRange.js +11 -11
- package/lib/utils/dateGrid/getBoundedDateRange.js.map +1 -1
- package/lib/utils/dateGrid/getDateRangeTypeToUse.js +6 -8
- package/lib/utils/dateGrid/getDateRangeTypeToUse.js.map +1 -1
- package/lib/utils/dateGrid/getDayGrid.js +59 -73
- package/lib/utils/dateGrid/getDayGrid.js.map +1 -1
- package/lib/utils/dateGrid/index.js +0 -1
- package/lib/utils/dateGrid/index.js.map +1 -1
- package/lib/utils/dateGrid/isAfterMaxDate.js +3 -7
- package/lib/utils/dateGrid/isAfterMaxDate.js.map +1 -1
- package/lib/utils/dateGrid/isBeforeMinDate.js +3 -7
- package/lib/utils/dateGrid/isBeforeMinDate.js.map +1 -1
- package/lib/utils/dateGrid/isContiguous.js +11 -12
- package/lib/utils/dateGrid/isContiguous.js.map +1 -1
- package/lib/utils/dateGrid/isRestrictedDate.js +7 -13
- package/lib/utils/dateGrid/isRestrictedDate.js.map +1 -1
- package/lib/utils/dateMath/dateMath.js +179 -198
- package/lib/utils/dateMath/dateMath.js.map +1 -1
- package/lib/utils/dateMath/index.js +0 -1
- package/lib/utils/dateMath/index.js.map +1 -1
- package/lib/utils/dom.js +5 -6
- package/lib/utils/dom.js.map +1 -1
- package/lib/utils/focus.js +17 -19
- package/lib/utils/focus.js.map +1 -1
- package/lib/utils/index.js +0 -1
- package/lib/utils/index.js.map +1 -1
- package/lib/utils/usePopupPositioning.js +12 -16
- package/lib/utils/usePopupPositioning.js.map +1 -1
- package/lib-commonjs/Calendar.js +0 -3
- package/lib-commonjs/Calendar.js.map +1 -1
- package/lib-commonjs/CalendarDay.js +0 -3
- package/lib-commonjs/CalendarDay.js.map +1 -1
- package/lib-commonjs/CalendarDayGrid.js +0 -3
- package/lib-commonjs/CalendarDayGrid.js.map +1 -1
- package/lib-commonjs/CalendarMonth.js +0 -3
- package/lib-commonjs/CalendarMonth.js.map +1 -1
- package/lib-commonjs/CalendarPicker.js +0 -3
- package/lib-commonjs/CalendarPicker.js.map +1 -1
- package/lib-commonjs/CalendarYear.js +0 -3
- package/lib-commonjs/CalendarYear.js.map +1 -1
- package/lib-commonjs/DatePicker.js +0 -3
- package/lib-commonjs/DatePicker.js.map +1 -1
- package/lib-commonjs/components/Calendar/Calendar.js +1 -3
- package/lib-commonjs/components/Calendar/Calendar.js.map +1 -1
- package/lib-commonjs/components/Calendar/Calendar.types.js +5 -7
- package/lib-commonjs/components/Calendar/Calendar.types.js.map +1 -1
- package/lib-commonjs/components/Calendar/defaults.js +1 -3
- package/lib-commonjs/components/Calendar/defaults.js.map +1 -1
- package/lib-commonjs/components/Calendar/index.js +0 -3
- package/lib-commonjs/components/Calendar/index.js.map +1 -1
- package/lib-commonjs/components/Calendar/useCalendarStyles.styles.js +0 -2
- package/lib-commonjs/components/Calendar/useCalendarStyles.styles.js.map +1 -1
- package/lib-commonjs/components/CalendarDay/CalendarDay.js +1 -3
- package/lib-commonjs/components/CalendarDay/CalendarDay.js.map +1 -1
- package/lib-commonjs/components/CalendarDay/CalendarDay.types.js +0 -3
- package/lib-commonjs/components/CalendarDay/CalendarDay.types.js.map +1 -1
- package/lib-commonjs/components/CalendarDay/index.js +0 -3
- package/lib-commonjs/components/CalendarDay/index.js.map +1 -1
- package/lib-commonjs/components/CalendarDay/useCalendarDayStyles.styles.js +0 -2
- package/lib-commonjs/components/CalendarDay/useCalendarDayStyles.styles.js.map +1 -1
- package/lib-commonjs/components/CalendarDayGrid/CalendarDayGrid.js +7 -9
- package/lib-commonjs/components/CalendarDayGrid/CalendarDayGrid.js.map +1 -1
- package/lib-commonjs/components/CalendarDayGrid/CalendarDayGrid.types.js +0 -3
- package/lib-commonjs/components/CalendarDayGrid/CalendarDayGrid.types.js.map +1 -1
- package/lib-commonjs/components/CalendarDayGrid/CalendarGridDayCell.js +1 -3
- package/lib-commonjs/components/CalendarDayGrid/CalendarGridDayCell.js.map +1 -1
- package/lib-commonjs/components/CalendarDayGrid/CalendarGridRow.js +1 -3
- package/lib-commonjs/components/CalendarDayGrid/CalendarGridRow.js.map +1 -1
- package/lib-commonjs/components/CalendarDayGrid/CalendarMonthHeaderRow.js +1 -3
- package/lib-commonjs/components/CalendarDayGrid/CalendarMonthHeaderRow.js.map +1 -1
- package/lib-commonjs/components/CalendarDayGrid/index.js +0 -3
- package/lib-commonjs/components/CalendarDayGrid/index.js.map +1 -1
- package/lib-commonjs/components/CalendarDayGrid/useCalendarDayGridStyles.styles.js +0 -2
- package/lib-commonjs/components/CalendarDayGrid/useCalendarDayGridStyles.styles.js.map +1 -1
- package/lib-commonjs/components/CalendarDayGrid/useWeekCornerStyles.styles.js +0 -2
- package/lib-commonjs/components/CalendarDayGrid/useWeekCornerStyles.styles.js.map +1 -1
- package/lib-commonjs/components/CalendarDayGrid/useWeeks.js +9 -11
- package/lib-commonjs/components/CalendarDayGrid/useWeeks.js.map +1 -1
- package/lib-commonjs/components/CalendarMonth/CalendarMonth.js +1 -3
- package/lib-commonjs/components/CalendarMonth/CalendarMonth.js.map +1 -1
- package/lib-commonjs/components/CalendarMonth/CalendarMonth.types.js +0 -3
- package/lib-commonjs/components/CalendarMonth/CalendarMonth.types.js.map +1 -1
- package/lib-commonjs/components/CalendarMonth/index.js +0 -3
- package/lib-commonjs/components/CalendarMonth/index.js.map +1 -1
- package/lib-commonjs/components/CalendarMonth/useCalendarMonthStyles.js +1 -3
- package/lib-commonjs/components/CalendarMonth/useCalendarMonthStyles.js.map +1 -1
- package/lib-commonjs/components/CalendarPicker/CalendarPicker.types.js +0 -3
- package/lib-commonjs/components/CalendarPicker/CalendarPicker.types.js.map +1 -1
- package/lib-commonjs/components/CalendarPicker/index.js +0 -3
- package/lib-commonjs/components/CalendarPicker/index.js.map +1 -1
- package/lib-commonjs/components/CalendarPicker/useCalendarPickerStyles.styles.js +0 -2
- package/lib-commonjs/components/CalendarPicker/useCalendarPickerStyles.styles.js.map +1 -1
- package/lib-commonjs/components/CalendarYear/CalendarYear.js +1 -3
- package/lib-commonjs/components/CalendarYear/CalendarYear.js.map +1 -1
- package/lib-commonjs/components/CalendarYear/CalendarYear.types.js +0 -3
- package/lib-commonjs/components/CalendarYear/CalendarYear.types.js.map +1 -1
- package/lib-commonjs/components/CalendarYear/index.js +0 -3
- package/lib-commonjs/components/CalendarYear/index.js.map +1 -1
- package/lib-commonjs/components/CalendarYear/useCalendarYearStyles.styles.js +0 -2
- package/lib-commonjs/components/CalendarYear/useCalendarYearStyles.styles.js.map +1 -1
- package/lib-commonjs/components/DatePicker/DatePicker.js +1 -3
- package/lib-commonjs/components/DatePicker/DatePicker.js.map +1 -1
- package/lib-commonjs/components/DatePicker/DatePicker.types.js +0 -3
- package/lib-commonjs/components/DatePicker/DatePicker.types.js.map +1 -1
- package/lib-commonjs/components/DatePicker/defaults.js +1 -3
- package/lib-commonjs/components/DatePicker/defaults.js.map +1 -1
- package/lib-commonjs/components/DatePicker/index.js +0 -3
- package/lib-commonjs/components/DatePicker/index.js.map +1 -1
- package/lib-commonjs/components/DatePicker/renderDatePicker.js +1 -3
- package/lib-commonjs/components/DatePicker/renderDatePicker.js.map +1 -1
- package/lib-commonjs/components/DatePicker/useDatePicker.js +14 -17
- package/lib-commonjs/components/DatePicker/useDatePicker.js.map +1 -1
- package/lib-commonjs/components/DatePicker/useDatePickerStyles.styles.js +0 -2
- package/lib-commonjs/components/DatePicker/useDatePickerStyles.styles.js.map +1 -1
- package/lib-commonjs/index.js +0 -3
- package/lib-commonjs/index.js.map +1 -1
- package/lib-commonjs/utils/animations.js +4 -6
- package/lib-commonjs/utils/animations.js.map +1 -1
- package/lib-commonjs/utils/constants.js +7 -9
- package/lib-commonjs/utils/constants.js.map +1 -1
- package/lib-commonjs/utils/dateFormatting/dateFormatting.defaults.js +1 -3
- package/lib-commonjs/utils/dateFormatting/dateFormatting.defaults.js.map +1 -1
- package/lib-commonjs/utils/dateFormatting/dateFormatting.types.js +0 -3
- package/lib-commonjs/utils/dateFormatting/dateFormatting.types.js.map +1 -1
- package/lib-commonjs/utils/dateFormatting/index.js +0 -3
- package/lib-commonjs/utils/dateFormatting/index.js.map +1 -1
- package/lib-commonjs/utils/dateGrid/dateGrid.types.js +0 -3
- package/lib-commonjs/utils/dateGrid/dateGrid.types.js.map +1 -1
- package/lib-commonjs/utils/dateGrid/findAvailableDate.js +1 -3
- package/lib-commonjs/utils/dateGrid/findAvailableDate.js.map +1 -1
- package/lib-commonjs/utils/dateGrid/getBoundedDateRange.js +1 -3
- package/lib-commonjs/utils/dateGrid/getBoundedDateRange.js.map +1 -1
- package/lib-commonjs/utils/dateGrid/getDateRangeTypeToUse.js +1 -3
- package/lib-commonjs/utils/dateGrid/getDateRangeTypeToUse.js.map +1 -1
- package/lib-commonjs/utils/dateGrid/getDayGrid.js +1 -3
- package/lib-commonjs/utils/dateGrid/getDayGrid.js.map +1 -1
- package/lib-commonjs/utils/dateGrid/index.js +0 -3
- package/lib-commonjs/utils/dateGrid/index.js.map +1 -1
- package/lib-commonjs/utils/dateGrid/isAfterMaxDate.js +1 -3
- package/lib-commonjs/utils/dateGrid/isAfterMaxDate.js.map +1 -1
- package/lib-commonjs/utils/dateGrid/isBeforeMinDate.js +1 -3
- package/lib-commonjs/utils/dateGrid/isBeforeMinDate.js.map +1 -1
- package/lib-commonjs/utils/dateGrid/isContiguous.js +1 -3
- package/lib-commonjs/utils/dateGrid/isContiguous.js.map +1 -1
- package/lib-commonjs/utils/dateGrid/isRestrictedDate.js +1 -3
- package/lib-commonjs/utils/dateGrid/isRestrictedDate.js.map +1 -1
- package/lib-commonjs/utils/dateMath/dateMath.js +1 -3
- package/lib-commonjs/utils/dateMath/dateMath.js.map +1 -1
- package/lib-commonjs/utils/dateMath/index.js +0 -3
- package/lib-commonjs/utils/dateMath/index.js.map +1 -1
- package/lib-commonjs/utils/dom.js +1 -3
- package/lib-commonjs/utils/dom.js.map +1 -1
- package/lib-commonjs/utils/focus.js +1 -3
- package/lib-commonjs/utils/focus.js.map +1 -1
- package/lib-commonjs/utils/index.js +0 -3
- package/lib-commonjs/utils/index.js.map +1 -1
- package/lib-commonjs/utils/usePopupPositioning.js +1 -3
- package/lib-commonjs/utils/usePopupPositioning.js.map +1 -1
- package/package.json +14 -14
|
@@ -8,343 +8,291 @@ import { useCalendarYearStyles_unstable } from './useCalendarYearStyles.styles';
|
|
|
8
8
|
const CELL_COUNT = 12;
|
|
9
9
|
const CELLS_PER_ROW = 4;
|
|
10
10
|
const DefaultCalendarYearStrings = {
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
prevRangeAriaLabel: undefined,
|
|
12
|
+
nextRangeAriaLabel: undefined
|
|
13
13
|
};
|
|
14
|
-
const CalendarYearGridCell = props
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
React.useImperativeHandle(componentRef, () => {
|
|
28
|
-
return {
|
|
29
|
-
focus() {
|
|
30
|
-
var _buttonRef_current, _buttonRef_current_focus;
|
|
31
|
-
(_buttonRef_current = buttonRef.current) === null || _buttonRef_current === void 0 ? void 0 : (_buttonRef_current_focus = _buttonRef_current.focus) === null || _buttonRef_current_focus === void 0 ? void 0 : _buttonRef_current_focus.call(_buttonRef_current);
|
|
32
|
-
}
|
|
14
|
+
const CalendarYearGridCell = (props)=>{
|
|
15
|
+
const { className , highlightCurrentYear , highlightSelectedYear , year , selected , disabled , componentRef , onSelectYear , onRenderYear } = props;
|
|
16
|
+
const buttonRef = React.useRef(null);
|
|
17
|
+
React.useImperativeHandle(componentRef, ()=>{
|
|
18
|
+
return {
|
|
19
|
+
focus () {
|
|
20
|
+
var _buttonRef_current, _buttonRef_current_focus;
|
|
21
|
+
(_buttonRef_current = buttonRef.current) === null || _buttonRef_current === void 0 ? void 0 : (_buttonRef_current_focus = _buttonRef_current.focus) === null || _buttonRef_current_focus === void 0 ? void 0 : _buttonRef_current_focus.call(_buttonRef_current);
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
}, []);
|
|
25
|
+
const onClick = ()=>{
|
|
26
|
+
onSelectYear === null || onSelectYear === void 0 ? void 0 : onSelectYear(year);
|
|
33
27
|
};
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
disabled: disabled,
|
|
56
|
-
"aria-selected": selected,
|
|
57
|
-
ref: buttonRef
|
|
58
|
-
}, (_onRenderYear = onRenderYear === null || onRenderYear === void 0 ? void 0 : onRenderYear(year)) !== null && _onRenderYear !== void 0 ? _onRenderYear : year);
|
|
28
|
+
const onKeyDown = (ev)=>{
|
|
29
|
+
if (ev.key === Enter) {
|
|
30
|
+
onSelectYear === null || onSelectYear === void 0 ? void 0 : onSelectYear(year);
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
const classNames = useCalendarYearStyles_unstable({
|
|
34
|
+
className,
|
|
35
|
+
highlightCurrent: highlightCurrentYear,
|
|
36
|
+
highlightSelected: highlightSelectedYear
|
|
37
|
+
});
|
|
38
|
+
var _onRenderYear;
|
|
39
|
+
return /*#__PURE__*/ React.createElement("button", {
|
|
40
|
+
className: mergeClasses(classNames.itemButton, selected && classNames.selected, disabled && classNames.disabled),
|
|
41
|
+
type: "button",
|
|
42
|
+
role: "gridcell",
|
|
43
|
+
onClick: !disabled ? onClick : undefined,
|
|
44
|
+
onKeyDown: !disabled ? onKeyDown : undefined,
|
|
45
|
+
disabled: disabled,
|
|
46
|
+
"aria-selected": selected,
|
|
47
|
+
ref: buttonRef
|
|
48
|
+
}, (_onRenderYear = onRenderYear === null || onRenderYear === void 0 ? void 0 : onRenderYear(year)) !== null && _onRenderYear !== void 0 ? _onRenderYear : year);
|
|
59
49
|
};
|
|
60
50
|
CalendarYearGridCell.displayName = 'CalendarYearGridCell';
|
|
61
|
-
const CalendarYearGrid = props
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
51
|
+
const CalendarYearGrid = (props)=>{
|
|
52
|
+
const { className , fromYear , toYear , animationDirection , animateBackwards , minYear , maxYear , onSelectYear , selectedYear , componentRef } = props;
|
|
53
|
+
const selectedCellRef = React.useRef(null);
|
|
54
|
+
const currentCellRef = React.useRef(null);
|
|
55
|
+
React.useImperativeHandle(componentRef, ()=>{
|
|
56
|
+
return {
|
|
57
|
+
focus () {
|
|
58
|
+
var _ref, _ref_focus;
|
|
59
|
+
(_ref = selectedCellRef.current || currentCellRef.current) === null || _ref === void 0 ? void 0 : (_ref_focus = _ref.focus) === null || _ref_focus === void 0 ? void 0 : _ref_focus.call(_ref);
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
}, []);
|
|
63
|
+
const renderCell = (yearToRender)=>{
|
|
64
|
+
const selected = yearToRender === selectedYear;
|
|
65
|
+
const disabled = minYear !== undefined && yearToRender < minYear || maxYear !== undefined && yearToRender > maxYear;
|
|
66
|
+
const current = yearToRender === new Date().getFullYear();
|
|
67
|
+
return /*#__PURE__*/ React.createElement(CalendarYearGridCell, {
|
|
68
|
+
...props,
|
|
69
|
+
key: yearToRender,
|
|
70
|
+
year: yearToRender,
|
|
71
|
+
selected: selected,
|
|
72
|
+
current: current,
|
|
73
|
+
disabled: disabled,
|
|
74
|
+
onSelectYear: onSelectYear,
|
|
75
|
+
componentRef: selected ? selectedCellRef : current ? currentCellRef : undefined
|
|
76
|
+
});
|
|
82
77
|
};
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
const current = yearToRender === new Date().getFullYear();
|
|
88
|
-
return /*#__PURE__*/React.createElement(CalendarYearGridCell, {
|
|
89
|
-
...props,
|
|
90
|
-
key: yearToRender,
|
|
91
|
-
year: yearToRender,
|
|
92
|
-
selected: selected,
|
|
93
|
-
current: current,
|
|
94
|
-
disabled: disabled,
|
|
95
|
-
onSelectYear: onSelectYear,
|
|
96
|
-
componentRef: selected ? selectedCellRef : current ? currentCellRef : undefined
|
|
78
|
+
const classNames = useCalendarYearStyles_unstable({
|
|
79
|
+
className,
|
|
80
|
+
animateBackwards,
|
|
81
|
+
animationDirection
|
|
97
82
|
});
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
for (let i = 0; i < (toYear - fromYear + 1) / CELLS_PER_ROW; i++) {
|
|
113
|
-
cells.push([]);
|
|
114
|
-
for (let j = 0; j < CELLS_PER_ROW; j++) {
|
|
115
|
-
cells[i].push(renderCell(year));
|
|
116
|
-
year++;
|
|
83
|
+
const onRenderYear = (value)=>{
|
|
84
|
+
var _props_onRenderYear;
|
|
85
|
+
var _props_onRenderYear1;
|
|
86
|
+
return (_props_onRenderYear1 = (_props_onRenderYear = props.onRenderYear) === null || _props_onRenderYear === void 0 ? void 0 : _props_onRenderYear.call(props, value)) !== null && _props_onRenderYear1 !== void 0 ? _props_onRenderYear1 : value;
|
|
87
|
+
};
|
|
88
|
+
const gridAriaLabel = `${onRenderYear(fromYear)} - ${onRenderYear(toYear)}`;
|
|
89
|
+
let year = fromYear;
|
|
90
|
+
const cells = [];
|
|
91
|
+
for(let i = 0; i < (toYear - fromYear + 1) / CELLS_PER_ROW; i++){
|
|
92
|
+
cells.push([]);
|
|
93
|
+
for(let j = 0; j < CELLS_PER_ROW; j++){
|
|
94
|
+
cells[i].push(renderCell(year));
|
|
95
|
+
year++;
|
|
96
|
+
}
|
|
117
97
|
}
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
}
|
|
132
|
-
})));
|
|
98
|
+
const arrowNavigationAttributes = useArrowNavigationGroup({
|
|
99
|
+
axis: 'both'
|
|
100
|
+
});
|
|
101
|
+
return /*#__PURE__*/ React.createElement("div", arrowNavigationAttributes, /*#__PURE__*/ React.createElement("div", {
|
|
102
|
+
className: classNames.gridContainer,
|
|
103
|
+
role: "grid",
|
|
104
|
+
"aria-label": gridAriaLabel
|
|
105
|
+
}, cells.map((cellRow, index)=>{
|
|
106
|
+
return /*#__PURE__*/ React.createElement("div", {
|
|
107
|
+
key: 'yearPickerRow_' + index + '_' + fromYear,
|
|
108
|
+
role: "row",
|
|
109
|
+
className: classNames.buttonRow
|
|
110
|
+
}, cellRow);
|
|
111
|
+
})));
|
|
133
112
|
};
|
|
134
113
|
CalendarYearGrid.displayName = 'CalendarYearGrid';
|
|
135
114
|
const CalendarYearNavDirection = {
|
|
136
|
-
|
|
137
|
-
|
|
115
|
+
Previous: 0,
|
|
116
|
+
Next: 1
|
|
138
117
|
};
|
|
139
|
-
const CalendarYearNavArrow = props
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
dir
|
|
172
|
-
} = useFluent_unstable();
|
|
173
|
-
// can be condensed, but leaving verbose for clarity due to regressions
|
|
174
|
-
const isLeftNavigation = dir === 'rtl' ? direction === CalendarYearNavDirection.Next : direction === CalendarYearNavDirection.Previous;
|
|
175
|
-
return /*#__PURE__*/React.createElement("button", {
|
|
176
|
-
className: mergeClasses(classNames.navigationButton, disabled && classNames.disabled),
|
|
177
|
-
onClick: !disabled ? onNavigate : undefined,
|
|
178
|
-
onKeyDown: !disabled ? onKeyDown : undefined,
|
|
179
|
-
type: "button",
|
|
180
|
-
title: ariaLabelString,
|
|
181
|
-
disabled: disabled
|
|
182
|
-
}, isLeftNavigation ? /*#__PURE__*/React.createElement(ArrowUpRegular, null) : /*#__PURE__*/React.createElement(ArrowDownRegular, null));
|
|
118
|
+
const CalendarYearNavArrow = (props)=>{
|
|
119
|
+
const { className , strings =DefaultCalendarYearStrings , direction , onSelectPrev , onSelectNext , fromYear , toYear , maxYear , minYear } = props;
|
|
120
|
+
const classNames = useCalendarYearStyles_unstable({
|
|
121
|
+
className
|
|
122
|
+
});
|
|
123
|
+
const ariaLabel = direction === CalendarYearNavDirection.Previous ? strings.prevRangeAriaLabel : strings.nextRangeAriaLabel;
|
|
124
|
+
const newRangeOffset = direction === CalendarYearNavDirection.Previous ? -CELL_COUNT : CELL_COUNT;
|
|
125
|
+
const newRange = {
|
|
126
|
+
fromYear: fromYear + newRangeOffset,
|
|
127
|
+
toYear: toYear + newRangeOffset
|
|
128
|
+
};
|
|
129
|
+
const ariaLabelString = ariaLabel ? typeof ariaLabel === 'string' ? ariaLabel : ariaLabel(newRange) : undefined;
|
|
130
|
+
const disabled = direction === CalendarYearNavDirection.Previous ? minYear !== undefined && fromYear < minYear : maxYear !== undefined && props.fromYear + CELL_COUNT > maxYear;
|
|
131
|
+
const onNavigate = ()=>{
|
|
132
|
+
direction === CalendarYearNavDirection.Previous ? onSelectPrev === null || onSelectPrev === void 0 ? void 0 : onSelectPrev() : onSelectNext === null || onSelectNext === void 0 ? void 0 : onSelectNext();
|
|
133
|
+
};
|
|
134
|
+
const onKeyDown = (ev)=>{
|
|
135
|
+
if (ev.key === Enter) {
|
|
136
|
+
onNavigate();
|
|
137
|
+
}
|
|
138
|
+
};
|
|
139
|
+
const { dir } = useFluent_unstable();
|
|
140
|
+
// can be condensed, but leaving verbose for clarity due to regressions
|
|
141
|
+
const isLeftNavigation = dir === 'rtl' ? direction === CalendarYearNavDirection.Next : direction === CalendarYearNavDirection.Previous;
|
|
142
|
+
return /*#__PURE__*/ React.createElement("button", {
|
|
143
|
+
className: mergeClasses(classNames.navigationButton, disabled && classNames.disabled),
|
|
144
|
+
onClick: !disabled ? onNavigate : undefined,
|
|
145
|
+
onKeyDown: !disabled ? onKeyDown : undefined,
|
|
146
|
+
type: "button",
|
|
147
|
+
title: ariaLabelString,
|
|
148
|
+
disabled: disabled
|
|
149
|
+
}, isLeftNavigation ? /*#__PURE__*/ React.createElement(ArrowUpRegular, null) : /*#__PURE__*/ React.createElement(ArrowDownRegular, null));
|
|
183
150
|
};
|
|
184
151
|
CalendarYearNavArrow.displayName = 'CalendarYearNavArrow';
|
|
185
|
-
const CalendarYearNav = props
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
direction: CalendarYearNavDirection.Next
|
|
200
|
-
}));
|
|
152
|
+
const CalendarYearNav = (props)=>{
|
|
153
|
+
const { className } = props;
|
|
154
|
+
const classNames = useCalendarYearStyles_unstable({
|
|
155
|
+
className
|
|
156
|
+
});
|
|
157
|
+
return /*#__PURE__*/ React.createElement("div", {
|
|
158
|
+
className: classNames.navigationButtonsContainer
|
|
159
|
+
}, /*#__PURE__*/ React.createElement(CalendarYearNavArrow, {
|
|
160
|
+
...props,
|
|
161
|
+
direction: CalendarYearNavDirection.Previous
|
|
162
|
+
}), /*#__PURE__*/ React.createElement(CalendarYearNavArrow, {
|
|
163
|
+
...props,
|
|
164
|
+
direction: CalendarYearNavDirection.Next
|
|
165
|
+
}));
|
|
201
166
|
};
|
|
202
167
|
CalendarYearNav.displayName = 'CalendarYearNav';
|
|
203
|
-
const CalendarYearTitle = props
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
168
|
+
const CalendarYearTitle = (props)=>{
|
|
169
|
+
const { className , fromYear , toYear , strings =DefaultCalendarYearStrings , animateBackwards , animationDirection } = props;
|
|
170
|
+
const onHeaderSelect = ()=>{
|
|
171
|
+
var _props_onHeaderSelect;
|
|
172
|
+
(_props_onHeaderSelect = props.onHeaderSelect) === null || _props_onHeaderSelect === void 0 ? void 0 : _props_onHeaderSelect.call(props, true);
|
|
173
|
+
};
|
|
174
|
+
const onHeaderKeyDown = (ev)=>{
|
|
175
|
+
if (ev.key === Enter || ev.key === Space) {
|
|
176
|
+
onHeaderSelect();
|
|
177
|
+
}
|
|
178
|
+
};
|
|
179
|
+
const onRenderYear = (year)=>{
|
|
180
|
+
var _props_onRenderYear;
|
|
181
|
+
var _props_onRenderYear1;
|
|
182
|
+
return (_props_onRenderYear1 = (_props_onRenderYear = props.onRenderYear) === null || _props_onRenderYear === void 0 ? void 0 : _props_onRenderYear.call(props, year)) !== null && _props_onRenderYear1 !== void 0 ? _props_onRenderYear1 : year;
|
|
183
|
+
};
|
|
184
|
+
const classNames = useCalendarYearStyles_unstable({
|
|
185
|
+
className,
|
|
186
|
+
hasHeaderClickCallback: !!props.onHeaderSelect,
|
|
187
|
+
animateBackwards,
|
|
188
|
+
animationDirection
|
|
189
|
+
});
|
|
190
|
+
if (props.onHeaderSelect) {
|
|
191
|
+
const rangeAriaLabel = strings.rangeAriaLabel;
|
|
192
|
+
const headerAriaLabelFormatString = strings.headerAriaLabelFormatString;
|
|
193
|
+
const currentDateRange = rangeAriaLabel ? typeof rangeAriaLabel === 'string' ? rangeAriaLabel : rangeAriaLabel(props) : undefined;
|
|
194
|
+
const ariaLabel = headerAriaLabelFormatString ? headerAriaLabelFormatString.replace('{0}', currentDateRange !== null && currentDateRange !== void 0 ? currentDateRange : '') : currentDateRange;
|
|
195
|
+
return /*#__PURE__*/ React.createElement("button", {
|
|
196
|
+
className: classNames.currentItemButton,
|
|
197
|
+
onClick: onHeaderSelect,
|
|
198
|
+
onKeyDown: onHeaderKeyDown,
|
|
199
|
+
"aria-label": ariaLabel,
|
|
200
|
+
role: "button",
|
|
201
|
+
type: "button"
|
|
202
|
+
}, /*#__PURE__*/ React.createElement("span", {
|
|
203
|
+
"aria-live": "assertive",
|
|
204
|
+
"aria-atomic": "true"
|
|
205
|
+
}, onRenderYear(fromYear), " - ", onRenderYear(toYear)));
|
|
219
206
|
}
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
var _props_onRenderYear1;
|
|
224
|
-
return (_props_onRenderYear1 = (_props_onRenderYear = props.onRenderYear) === null || _props_onRenderYear === void 0 ? void 0 : _props_onRenderYear.call(props, year)) !== null && _props_onRenderYear1 !== void 0 ? _props_onRenderYear1 : year;
|
|
225
|
-
};
|
|
226
|
-
const classNames = useCalendarYearStyles_unstable({
|
|
227
|
-
className,
|
|
228
|
-
hasHeaderClickCallback: !!props.onHeaderSelect,
|
|
229
|
-
animateBackwards,
|
|
230
|
-
animationDirection
|
|
231
|
-
});
|
|
232
|
-
if (props.onHeaderSelect) {
|
|
233
|
-
const rangeAriaLabel = strings.rangeAriaLabel;
|
|
234
|
-
const headerAriaLabelFormatString = strings.headerAriaLabelFormatString;
|
|
235
|
-
const currentDateRange = rangeAriaLabel ? typeof rangeAriaLabel === 'string' ? rangeAriaLabel : rangeAriaLabel(props) : undefined;
|
|
236
|
-
const ariaLabel = headerAriaLabelFormatString ? headerAriaLabelFormatString.replace('{0}', currentDateRange !== null && currentDateRange !== void 0 ? currentDateRange : '') : currentDateRange;
|
|
237
|
-
return /*#__PURE__*/React.createElement("button", {
|
|
238
|
-
className: classNames.currentItemButton,
|
|
239
|
-
onClick: onHeaderSelect,
|
|
240
|
-
onKeyDown: onHeaderKeyDown,
|
|
241
|
-
"aria-label": ariaLabel,
|
|
242
|
-
role: "button",
|
|
243
|
-
type: "button"
|
|
244
|
-
}, /*#__PURE__*/React.createElement("span", {
|
|
245
|
-
"aria-live": "assertive",
|
|
246
|
-
"aria-atomic": "true"
|
|
247
|
-
}, onRenderYear(fromYear), " - ", onRenderYear(toYear)));
|
|
248
|
-
}
|
|
249
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
250
|
-
className: classNames.current
|
|
251
|
-
}, onRenderYear(fromYear), " - ", onRenderYear(toYear));
|
|
207
|
+
return /*#__PURE__*/ React.createElement("div", {
|
|
208
|
+
className: classNames.current
|
|
209
|
+
}, onRenderYear(fromYear), " - ", onRenderYear(toYear));
|
|
252
210
|
};
|
|
253
211
|
CalendarYearTitle.displayName = 'CalendarYearTitle';
|
|
254
|
-
const CalendarYearHeader = props
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
});
|
|
267
|
-
var _onRenderTitle;
|
|
268
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
269
|
-
className: classNames.headerContainer
|
|
270
|
-
}, (_onRenderTitle = onRenderTitle === null || onRenderTitle === void 0 ? void 0 : onRenderTitle(props)) !== null && _onRenderTitle !== void 0 ? _onRenderTitle : /*#__PURE__*/React.createElement(CalendarYearTitle, props), /*#__PURE__*/React.createElement(CalendarYearNav, props));
|
|
212
|
+
const CalendarYearHeader = (props)=>{
|
|
213
|
+
const { className , animateBackwards , animationDirection , onRenderTitle } = props;
|
|
214
|
+
const classNames = useCalendarYearStyles_unstable({
|
|
215
|
+
className,
|
|
216
|
+
hasHeaderClickCallback: !!props.onHeaderSelect,
|
|
217
|
+
animateBackwards,
|
|
218
|
+
animationDirection
|
|
219
|
+
});
|
|
220
|
+
var _onRenderTitle;
|
|
221
|
+
return /*#__PURE__*/ React.createElement("div", {
|
|
222
|
+
className: classNames.headerContainer
|
|
223
|
+
}, (_onRenderTitle = onRenderTitle === null || onRenderTitle === void 0 ? void 0 : onRenderTitle(props)) !== null && _onRenderTitle !== void 0 ? _onRenderTitle : /*#__PURE__*/ React.createElement(CalendarYearTitle, props), /*#__PURE__*/ React.createElement(CalendarYearNav, props));
|
|
271
224
|
};
|
|
272
225
|
CalendarYearHeader.displayName = 'CalendarYearHeader';
|
|
273
|
-
function useAnimateBackwards({
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
} else {
|
|
289
|
-
return false;
|
|
290
|
-
}
|
|
226
|
+
function useAnimateBackwards({ selectedYear , navigatedYear }) {
|
|
227
|
+
const rangeYear = selectedYear || navigatedYear || new Date().getFullYear();
|
|
228
|
+
const fromYear = Math.floor(rangeYear / 10) * 10;
|
|
229
|
+
const previousFromYearRef = React.useRef(fromYear);
|
|
230
|
+
React.useRef(()=>{
|
|
231
|
+
previousFromYearRef.current = fromYear;
|
|
232
|
+
});
|
|
233
|
+
const previousFromYear = previousFromYearRef.current;
|
|
234
|
+
if (!previousFromYear || previousFromYear === fromYear) {
|
|
235
|
+
return undefined;
|
|
236
|
+
} else if (previousFromYear > fromYear) {
|
|
237
|
+
return true;
|
|
238
|
+
} else {
|
|
239
|
+
return false;
|
|
240
|
+
}
|
|
291
241
|
}
|
|
292
242
|
const NavigationDirection = {
|
|
293
|
-
|
|
294
|
-
|
|
243
|
+
Previous: 0,
|
|
244
|
+
Next: 1
|
|
295
245
|
};
|
|
296
|
-
function useYearRangeState({
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
})
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
const
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
246
|
+
function useYearRangeState({ selectedYear , navigatedYear }) {
|
|
247
|
+
const [fromYear, navigate] = React.useReducer((state, action)=>{
|
|
248
|
+
return state + (action === NavigationDirection.Next ? CELL_COUNT : -CELL_COUNT);
|
|
249
|
+
}, undefined, ()=>{
|
|
250
|
+
const rangeYear = selectedYear || navigatedYear || new Date().getFullYear();
|
|
251
|
+
return Math.floor(rangeYear / 10) * 10;
|
|
252
|
+
});
|
|
253
|
+
const toYear = fromYear + CELL_COUNT - 1;
|
|
254
|
+
const onNavNext = ()=>navigate(NavigationDirection.Next);
|
|
255
|
+
const onNavPrevious = ()=>navigate(NavigationDirection.Previous);
|
|
256
|
+
return [
|
|
257
|
+
fromYear,
|
|
258
|
+
toYear,
|
|
259
|
+
onNavNext,
|
|
260
|
+
onNavPrevious
|
|
261
|
+
];
|
|
310
262
|
}
|
|
311
263
|
/**
|
|
312
264
|
* @internal
|
|
313
|
-
*/
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
};
|
|
325
|
-
}
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
animateBackwards: animateBackwards,
|
|
346
|
-
componentRef: gridRef
|
|
347
|
-
}));
|
|
265
|
+
*/ export const CalendarYear = (props)=>{
|
|
266
|
+
const animateBackwards = useAnimateBackwards(props);
|
|
267
|
+
const [fromYear, toYear, onNavNext, onNavPrevious] = useYearRangeState(props);
|
|
268
|
+
const gridRef = React.useRef(null);
|
|
269
|
+
React.useImperativeHandle(props.componentRef, ()=>{
|
|
270
|
+
return {
|
|
271
|
+
focus () {
|
|
272
|
+
var _gridRef_current, _gridRef_current_focus;
|
|
273
|
+
(_gridRef_current = gridRef.current) === null || _gridRef_current === void 0 ? void 0 : (_gridRef_current_focus = _gridRef_current.focus) === null || _gridRef_current_focus === void 0 ? void 0 : _gridRef_current_focus.call(_gridRef_current);
|
|
274
|
+
}
|
|
275
|
+
};
|
|
276
|
+
});
|
|
277
|
+
const { className } = props;
|
|
278
|
+
const classNames = useCalendarYearStyles_unstable({
|
|
279
|
+
className
|
|
280
|
+
});
|
|
281
|
+
return /*#__PURE__*/ React.createElement("div", {
|
|
282
|
+
className: classNames.root
|
|
283
|
+
}, /*#__PURE__*/ React.createElement(CalendarYearHeader, {
|
|
284
|
+
...props,
|
|
285
|
+
fromYear: fromYear,
|
|
286
|
+
toYear: toYear,
|
|
287
|
+
onSelectPrev: onNavPrevious,
|
|
288
|
+
onSelectNext: onNavNext,
|
|
289
|
+
animateBackwards: animateBackwards
|
|
290
|
+
}), /*#__PURE__*/ React.createElement(CalendarYearGrid, {
|
|
291
|
+
...props,
|
|
292
|
+
fromYear: fromYear,
|
|
293
|
+
toYear: toYear,
|
|
294
|
+
animateBackwards: animateBackwards,
|
|
295
|
+
componentRef: gridRef
|
|
296
|
+
}));
|
|
348
297
|
};
|
|
349
298
|
CalendarYear.displayName = 'CalendarYear';
|
|
350
|
-
//# sourceMappingURL=CalendarYear.js.map
|