@fluentui/react-calendar-compat 0.3.8 → 0.3.9

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.
Files changed (29) hide show
  1. package/CHANGELOG.md +21 -6
  2. package/dist/index.d.ts +5 -5
  3. package/lib/components/Calendar/Calendar.types.js.map +1 -1
  4. package/lib/components/CalendarDay/CalendarDay.types.js.map +1 -1
  5. package/lib/components/CalendarDayGrid/CalendarDayGrid.js +1 -1
  6. package/lib/components/CalendarDayGrid/CalendarDayGrid.js.map +1 -1
  7. package/lib/components/CalendarDayGrid/CalendarDayGrid.types.js.map +1 -1
  8. package/lib/components/CalendarDayGrid/CalendarGridRow.js.map +1 -1
  9. package/lib/components/CalendarDayGrid/useWeekCornerStyles.styles.raw.js.map +1 -1
  10. package/lib/components/CalendarMonth/CalendarMonth.js +1 -1
  11. package/lib/components/CalendarMonth/CalendarMonth.js.map +1 -1
  12. package/lib/components/CalendarMonth/CalendarMonth.types.js.map +1 -1
  13. package/lib/components/CalendarYear/CalendarYear.js.map +1 -1
  14. package/lib/components/CalendarYear/CalendarYear.types.js.map +1 -1
  15. package/lib/utils/dateFormatting/dateFormatting.defaults.js.map +1 -1
  16. package/lib-commonjs/components/Calendar/Calendar.types.js.map +1 -1
  17. package/lib-commonjs/components/CalendarDay/CalendarDay.types.js.map +1 -1
  18. package/lib-commonjs/components/CalendarDayGrid/CalendarDayGrid.js +1 -1
  19. package/lib-commonjs/components/CalendarDayGrid/CalendarDayGrid.js.map +1 -1
  20. package/lib-commonjs/components/CalendarDayGrid/CalendarDayGrid.types.js.map +1 -1
  21. package/lib-commonjs/components/CalendarDayGrid/CalendarGridRow.js.map +1 -1
  22. package/lib-commonjs/components/CalendarDayGrid/useWeekCornerStyles.styles.raw.js.map +1 -1
  23. package/lib-commonjs/components/CalendarMonth/CalendarMonth.js +1 -1
  24. package/lib-commonjs/components/CalendarMonth/CalendarMonth.js.map +1 -1
  25. package/lib-commonjs/components/CalendarMonth/CalendarMonth.types.js.map +1 -1
  26. package/lib-commonjs/components/CalendarYear/CalendarYear.js.map +1 -1
  27. package/lib-commonjs/components/CalendarYear/CalendarYear.types.js.map +1 -1
  28. package/lib-commonjs/utils/dateFormatting/dateFormatting.defaults.js.map +1 -1
  29. package/package.json +9 -9
package/CHANGELOG.md CHANGED
@@ -1,20 +1,35 @@
1
1
  # Change Log - @fluentui/react-calendar-compat
2
2
 
3
- This log was last generated on Thu, 21 Aug 2025 12:20:32 GMT and should not be manually modified.
3
+ This log was last generated on Mon, 08 Sep 2025 12:42:05 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
+ ## [0.3.9](https://github.com/microsoft/fluentui/tree/@fluentui/react-calendar-compat_v0.3.9)
8
+
9
+ Mon, 08 Sep 2025 12:42:05 GMT
10
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-calendar-compat_v0.3.8..@fluentui/react-calendar-compat_v0.3.9)
11
+
12
+ ### Patches
13
+
14
+ - chore: extend peer dependencies versions to support React 19 ([PR #35145](https://github.com/microsoft/fluentui/pull/35145) by dmytrokirpa@microsoft.com)
15
+ - chore: enforce explicit module boundary types ([PR #35080](https://github.com/microsoft/fluentui/pull/35080) by dmytrokirpa@microsoft.com)
16
+ - fix: react 19 type issues ([PR #34864](https://github.com/microsoft/fluentui/pull/34864) by dmytrokirpa@microsoft.com)
17
+ - Bump @fluentui/react-jsx-runtime to v9.2.0 ([commit](https://github.com/microsoft/fluentui/commit/17af11b3c9f4cac2beeaf4342a81c1f08e95fd29) by beachball)
18
+ - Bump @fluentui/react-shared-contexts to v9.25.1 ([commit](https://github.com/microsoft/fluentui/commit/17af11b3c9f4cac2beeaf4342a81c1f08e95fd29) by beachball)
19
+ - Bump @fluentui/react-tabster to v9.26.5 ([commit](https://github.com/microsoft/fluentui/commit/17af11b3c9f4cac2beeaf4342a81c1f08e95fd29) by beachball)
20
+ - Bump @fluentui/react-utilities to v9.24.1 ([commit](https://github.com/microsoft/fluentui/commit/17af11b3c9f4cac2beeaf4342a81c1f08e95fd29) by beachball)
21
+
7
22
  ## [0.3.8](https://github.com/microsoft/fluentui/tree/@fluentui/react-calendar-compat_v0.3.8)
8
23
 
9
- Thu, 21 Aug 2025 12:20:32 GMT
24
+ Thu, 21 Aug 2025 12:25:28 GMT
10
25
  [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-calendar-compat_v0.3.7..@fluentui/react-calendar-compat_v0.3.8)
11
26
 
12
27
  ### Patches
13
28
 
14
- - Bump @fluentui/react-jsx-runtime to v9.1.6 ([PR #35055](https://github.com/microsoft/fluentui/pull/35055) by beachball)
15
- - Bump @fluentui/react-shared-contexts to v9.25.0 ([PR #35055](https://github.com/microsoft/fluentui/pull/35055) by beachball)
16
- - Bump @fluentui/react-tabster to v9.26.4 ([PR #35055](https://github.com/microsoft/fluentui/pull/35055) by beachball)
17
- - Bump @fluentui/react-utilities to v9.24.0 ([PR #35055](https://github.com/microsoft/fluentui/pull/35055) by beachball)
29
+ - Bump @fluentui/react-jsx-runtime to v9.1.6 ([commit](https://github.com/microsoft/fluentui/commit/884c695de4f736774c224fa33b2e410bf42752b0) by beachball)
30
+ - Bump @fluentui/react-shared-contexts to v9.25.0 ([commit](https://github.com/microsoft/fluentui/commit/884c695de4f736774c224fa33b2e410bf42752b0) by beachball)
31
+ - Bump @fluentui/react-tabster to v9.26.4 ([commit](https://github.com/microsoft/fluentui/commit/884c695de4f736774c224fa33b2e410bf42752b0) by beachball)
32
+ - Bump @fluentui/react-utilities to v9.24.0 ([commit](https://github.com/microsoft/fluentui/commit/884c695de4f736774c224fa33b2e410bf42752b0) by beachball)
18
33
 
19
34
  ## [0.3.7](https://github.com/microsoft/fluentui/tree/@fluentui/react-calendar-compat_v0.3.7)
20
35
 
package/dist/index.d.ts CHANGED
@@ -84,7 +84,7 @@ export declare interface CalendarDayGridProps extends DayGridOptions {
84
84
  * Optional callback to access the ICalendarDayGrid interface. Use this instead of ref for accessing
85
85
  * the public methods and properties of the component.
86
86
  */
87
- componentRef?: React_2.RefObject<ICalendarDayGrid>;
87
+ componentRef?: React_2.RefObject<ICalendarDayGrid | null>;
88
88
  /**
89
89
  * Additional CSS class(es) to apply to the CalendarDayGrid.
90
90
  */
@@ -323,7 +323,7 @@ export declare interface CalendarDayProps extends CalendarDayGridProps {
323
323
  * Optional callback to access the ICalendarDay interface. Use this instead of ref for accessing
324
324
  * the public methods and properties of the component.
325
325
  */
326
- componentRef?: React_2.RefObject<ICalendarDay>;
326
+ componentRef?: React_2.RefObject<ICalendarDay | null>;
327
327
  /**
328
328
  * Additional CSS class(es) to apply to the CalendarDay.
329
329
  */
@@ -450,7 +450,7 @@ export declare interface CalendarMonthProps {
450
450
  * Optional callback to access the ICalendarMonth interface. Use this instead of ref for accessing
451
451
  * the public methods and properties of the component.
452
452
  */
453
- componentRef?: React_2.RefObject<ICalendarMonth>;
453
+ componentRef?: React_2.RefObject<ICalendarMonth | null>;
454
454
  /**
455
455
  * Localized strings to use in the Calendar
456
456
  */
@@ -620,7 +620,7 @@ export declare interface CalendarProps extends React_2.RefAttributes<HTMLDivElem
620
620
  * Optional callback to access the ICalendar interface. Use this instead of ref for accessing
621
621
  * the public methods and properties of the component.
622
622
  */
623
- componentRef?: React_2.RefObject<ICalendar>;
623
+ componentRef?: React_2.RefObject<ICalendar | null>;
624
624
  /**
625
625
  * Customized props for the calendar day
626
626
  */
@@ -898,7 +898,7 @@ export declare interface CalendarYearProps {
898
898
  * Optional callback to access the ICalendarYear interface. Use this instead of ref for accessing
899
899
  * the public methods and properties of the component.
900
900
  */
901
- componentRef?: React_2.RefObject<ICalendarYear>;
901
+ componentRef?: React_2.RefObject<ICalendarYear | null>;
902
902
  /**
903
903
  * Localized strings to use in the Calendar
904
904
  */
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/Calendar/Calendar.types.ts"],"sourcesContent":["import * as React from 'react';\nimport type { CalendarStrings, DateFormatting, DateRangeType, DayOfWeek, FirstWeekOfYear } from '../../utils';\nimport type { CalendarDayProps } from '../CalendarDay/CalendarDay.types';\nimport type { CalendarMonthProps } from '../CalendarMonth/CalendarMonth.types';\n\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport interface ICalendar {\n /** Sets focus to the selected date. */\n focus: () => void;\n}\n\nexport interface CalendarProps extends React.RefAttributes<HTMLDivElement> {\n /**\n * Optional callback to access the ICalendar interface. Use this instead of ref for accessing\n * the public methods and properties of the component.\n */\n componentRef?: React.RefObject<ICalendar>;\n\n /**\n * Customized props for the calendar day\n */\n calendarDayProps?: Partial<CalendarDayProps>;\n\n /**\n * Customized props for the calendar month\n */\n calendarMonthProps?: Partial<CalendarMonthProps>;\n\n /**\n * Optional class name to add to the root element.\n */\n className?: string;\n\n /**\n * Callback for when a date is selected\n * @param date - The date the user selected\n * @param selectedDateRangeArray - The resultant list of dates that are selected based on the date range type set\n * for the component.\n */\n onSelectDate?: (date: Date, selectedDateRangeArray?: Date[]) => void;\n\n /**\n * Callback for when calendar is closed\n */\n onDismiss?: () => void;\n\n /**\n * ID for the calendar\n */\n id?: string;\n\n /**\n * Default value of the Calendar, if any\n */\n value?: Date;\n\n /**\n * Value of today. If unspecified, current time in client machine will be used.\n */\n today?: Date;\n\n /**\n * The date range type indicating how many days should be selected as the user\n * selects days\n * @default DateRangeType.Day\n */\n dateRangeType?: DateRangeType;\n\n /**\n * The first day of the week for your locale.\n * @default DayOfWeek.Sunday\n */\n firstDayOfWeek?: DayOfWeek;\n\n /**\n * Defines when the first week of the year should start.\n * @default FirstWeekOfYear.FirstDay\n */\n firstWeekOfYear?: FirstWeekOfYear;\n\n /**\n * Whether the month picker is shown beside the day picker or hidden.\n * @default true\n */\n isMonthPickerVisible?: boolean;\n\n /**\n * Whether the day picker is shown beside the month picker or hidden.\n * @default true\n */\n isDayPickerVisible?: boolean;\n\n /**\n * Show month picker on top of date picker when visible.\n * @default false\n */\n showMonthPickerAsOverlay?: boolean;\n\n /**\n * Whether the \"Go to today\" link should be shown or not\n */\n showGoToToday?: boolean;\n\n /**\n * Whether the calendar should show the week number (weeks 1 to 53) before each week row\n * @default false\n */\n showWeekNumbers?: boolean;\n\n /**\n * Localized strings to use in the Calendar\n */\n strings?: CalendarStrings;\n\n /**\n * Apply additional formatting to dates, for example localized date formatting.\n */\n dateTimeFormatter?: DateFormatting;\n\n /**\n * If set the Calendar will not allow navigation to or selection of a date earlier than this value.\n */\n minDate?: Date;\n\n /**\n * If set the Calendar will not allow navigation to or selection of a date later than this value.\n */\n maxDate?: Date;\n\n /**\n * If set the Calendar will not allow selection of dates in this array.\n */\n restrictedDates?: Date[];\n\n /**\n * Whether the calendar should show 6 weeks by default.\n * @default false\n */\n showSixWeeksByDefault?: boolean;\n\n /**\n * The days that are selectable when `dateRangeType` is `WorkWeek`.\n * If `dateRangeType` is not `WorkWeek` this property does nothing.\n * @default [Monday,Tuesday,Wednesday,Thursday,Friday]\n */\n workWeekDays?: DayOfWeek[];\n\n /**\n * Whether the month picker should highlight the current month\n * @default false\n */\n highlightCurrentMonth?: boolean;\n\n /**\n * Whether the month picker should highlight the selected month\n * @default false\n */\n highlightSelectedMonth?: boolean;\n\n /**\n * Whether the close button should be shown or not\n * @default false\n */\n showCloseButton?: boolean;\n\n /**\n * Allows all dates and buttons to be focused, including disabled ones\n * @default false\n */\n allFocusable?: boolean;\n}\n\n/**\n * @internal\n */\nexport interface CalendarStyleProps {\n /**\n * Custom CSS class for the calendar.\n */\n className?: string;\n\n /**\n * Whether the month picker is visible\n */\n isMonthPickerVisible?: boolean;\n\n /**\n * Whether the day picker is visible\n */\n isDayPickerVisible?: boolean;\n\n /**\n * Whether only month picker is shown\n */\n monthPickerOnly?: boolean;\n\n /**\n * Whether the month picker is overlaid on the day picker\n */\n showMonthPickerAsOverlay?: boolean;\n\n /**\n * @deprecated Use `overlaidWithButton`\n */\n overlayedWithButton?: boolean;\n\n /**\n * Whether the month and day picker are overlaid and the 'go to today' button is shown\n */\n overlaidWithButton?: boolean;\n\n /**\n * Whether the go to today button is shown\n */\n showGoToToday?: boolean;\n\n /**\n * Whether the week numbers are shown\n */\n showWeekNumbers?: boolean;\n}\n\n/**\n * @internal\n */\nexport interface CalendarStyles {\n /**\n * Style for the root element.\n */\n root: string;\n\n divider: string;\n\n goTodayButton: string;\n\n monthPickerWrapper: string;\n\n liveRegion: string;\n}\n\nexport enum AnimationDirection {\n /**\n * Grid will transition out and in horizontally\n */\n Horizontal,\n\n /**\n * Grid will transition out and in vertically\n */\n Vertical,\n}\n"],"names":["React","AnimationDirection"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAgP/B,OAAO,IAAA,AAAKC,4CAAAA;IACV;;GAEC;IAGD;;GAEC;WARSA;MAUX"}
1
+ {"version":3,"sources":["../src/components/Calendar/Calendar.types.ts"],"sourcesContent":["import * as React from 'react';\nimport type { CalendarStrings, DateFormatting, DateRangeType, DayOfWeek, FirstWeekOfYear } from '../../utils';\nimport type { CalendarDayProps } from '../CalendarDay/CalendarDay.types';\nimport type { CalendarMonthProps } from '../CalendarMonth/CalendarMonth.types';\n\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport interface ICalendar {\n /** Sets focus to the selected date. */\n focus: () => void;\n}\n\nexport interface CalendarProps extends React.RefAttributes<HTMLDivElement> {\n /**\n * Optional callback to access the ICalendar interface. Use this instead of ref for accessing\n * the public methods and properties of the component.\n */\n componentRef?: React.RefObject<ICalendar | null>;\n\n /**\n * Customized props for the calendar day\n */\n calendarDayProps?: Partial<CalendarDayProps>;\n\n /**\n * Customized props for the calendar month\n */\n calendarMonthProps?: Partial<CalendarMonthProps>;\n\n /**\n * Optional class name to add to the root element.\n */\n className?: string;\n\n /**\n * Callback for when a date is selected\n * @param date - The date the user selected\n * @param selectedDateRangeArray - The resultant list of dates that are selected based on the date range type set\n * for the component.\n */\n onSelectDate?: (date: Date, selectedDateRangeArray?: Date[]) => void;\n\n /**\n * Callback for when calendar is closed\n */\n onDismiss?: () => void;\n\n /**\n * ID for the calendar\n */\n id?: string;\n\n /**\n * Default value of the Calendar, if any\n */\n value?: Date;\n\n /**\n * Value of today. If unspecified, current time in client machine will be used.\n */\n today?: Date;\n\n /**\n * The date range type indicating how many days should be selected as the user\n * selects days\n * @default DateRangeType.Day\n */\n dateRangeType?: DateRangeType;\n\n /**\n * The first day of the week for your locale.\n * @default DayOfWeek.Sunday\n */\n firstDayOfWeek?: DayOfWeek;\n\n /**\n * Defines when the first week of the year should start.\n * @default FirstWeekOfYear.FirstDay\n */\n firstWeekOfYear?: FirstWeekOfYear;\n\n /**\n * Whether the month picker is shown beside the day picker or hidden.\n * @default true\n */\n isMonthPickerVisible?: boolean;\n\n /**\n * Whether the day picker is shown beside the month picker or hidden.\n * @default true\n */\n isDayPickerVisible?: boolean;\n\n /**\n * Show month picker on top of date picker when visible.\n * @default false\n */\n showMonthPickerAsOverlay?: boolean;\n\n /**\n * Whether the \"Go to today\" link should be shown or not\n */\n showGoToToday?: boolean;\n\n /**\n * Whether the calendar should show the week number (weeks 1 to 53) before each week row\n * @default false\n */\n showWeekNumbers?: boolean;\n\n /**\n * Localized strings to use in the Calendar\n */\n strings?: CalendarStrings;\n\n /**\n * Apply additional formatting to dates, for example localized date formatting.\n */\n dateTimeFormatter?: DateFormatting;\n\n /**\n * If set the Calendar will not allow navigation to or selection of a date earlier than this value.\n */\n minDate?: Date;\n\n /**\n * If set the Calendar will not allow navigation to or selection of a date later than this value.\n */\n maxDate?: Date;\n\n /**\n * If set the Calendar will not allow selection of dates in this array.\n */\n restrictedDates?: Date[];\n\n /**\n * Whether the calendar should show 6 weeks by default.\n * @default false\n */\n showSixWeeksByDefault?: boolean;\n\n /**\n * The days that are selectable when `dateRangeType` is `WorkWeek`.\n * If `dateRangeType` is not `WorkWeek` this property does nothing.\n * @default [Monday,Tuesday,Wednesday,Thursday,Friday]\n */\n workWeekDays?: DayOfWeek[];\n\n /**\n * Whether the month picker should highlight the current month\n * @default false\n */\n highlightCurrentMonth?: boolean;\n\n /**\n * Whether the month picker should highlight the selected month\n * @default false\n */\n highlightSelectedMonth?: boolean;\n\n /**\n * Whether the close button should be shown or not\n * @default false\n */\n showCloseButton?: boolean;\n\n /**\n * Allows all dates and buttons to be focused, including disabled ones\n * @default false\n */\n allFocusable?: boolean;\n}\n\n/**\n * @internal\n */\nexport interface CalendarStyleProps {\n /**\n * Custom CSS class for the calendar.\n */\n className?: string;\n\n /**\n * Whether the month picker is visible\n */\n isMonthPickerVisible?: boolean;\n\n /**\n * Whether the day picker is visible\n */\n isDayPickerVisible?: boolean;\n\n /**\n * Whether only month picker is shown\n */\n monthPickerOnly?: boolean;\n\n /**\n * Whether the month picker is overlaid on the day picker\n */\n showMonthPickerAsOverlay?: boolean;\n\n /**\n * @deprecated Use `overlaidWithButton`\n */\n overlayedWithButton?: boolean;\n\n /**\n * Whether the month and day picker are overlaid and the 'go to today' button is shown\n */\n overlaidWithButton?: boolean;\n\n /**\n * Whether the go to today button is shown\n */\n showGoToToday?: boolean;\n\n /**\n * Whether the week numbers are shown\n */\n showWeekNumbers?: boolean;\n}\n\n/**\n * @internal\n */\nexport interface CalendarStyles {\n /**\n * Style for the root element.\n */\n root: string;\n\n divider: string;\n\n goTodayButton: string;\n\n monthPickerWrapper: string;\n\n liveRegion: string;\n}\n\nexport enum AnimationDirection {\n /**\n * Grid will transition out and in horizontally\n */\n Horizontal,\n\n /**\n * Grid will transition out and in vertically\n */\n Vertical,\n}\n"],"names":["React","AnimationDirection"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAgP/B,OAAO,IAAA,AAAKC,4CAAAA;IACV;;GAEC;IAGD;;GAEC;WARSA;MAUX"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/CalendarDay/CalendarDay.types.ts"],"sourcesContent":["import * as React from 'react';\nimport type { CalendarStrings, DateFormatting } from '../../utils';\nimport type { CalendarDayGridProps, CalendarDayGridStyleProps } from '../CalendarDayGrid/CalendarDayGrid.types';\nimport type { CalendarNavigationIcons } from '../Calendar/calendarNavigationIcons';\n\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport interface ICalendarDay {\n focus(): void;\n}\n\nexport interface CalendarDayProps extends CalendarDayGridProps {\n /**\n * Optional callback to access the ICalendarDay interface. Use this instead of ref for accessing\n * the public methods and properties of the component.\n */\n componentRef?: React.RefObject<ICalendarDay>;\n\n /**\n * Additional CSS class(es) to apply to the CalendarDay.\n */\n className?: string;\n\n /**\n * Localized strings to use in the Calendar\n */\n strings: CalendarStrings;\n\n /**\n * The currently navigated date\n */\n navigatedDate: Date;\n\n /**\n * Callback issued when a date in the calendar is navigated\n * @param date - The date that is navigated to\n * @param focusOnNavigatedDay - Whether to set the focus to the navigated date.\n */\n onNavigateDate: (date: Date, focusOnNavigatedDay: boolean) => void;\n\n /**\n * Callback issued when calendar day is closed\n */\n onDismiss?: () => void;\n\n /**\n * Callback function when the header is selected\n */\n onHeaderSelect?: () => void;\n\n /**\n * Whether the calendar should show the week number (weeks 1 to 53) before each week row\n * @default false\n */\n showWeekNumbers?: boolean;\n\n /**\n * Apply additional formatting to dates, for example localized date formatting.\n */\n dateTimeFormatter: DateFormatting;\n\n /**\n * Whether the calendar should show 6 weeks by default.\n * @default false\n */\n showSixWeeksByDefault?: boolean;\n\n /**\n * If set the Calendar will not allow navigation to or selection of a date earlier than this value.\n */\n minDate?: Date;\n\n /**\n * If set the Calendar will not allow navigation to or selection of a date later than this value.\n */\n maxDate?: Date;\n\n /**\n * If set the Calendar will not allow selection of dates in this array.\n */\n restrictedDates?: Date[];\n\n /**\n * Whether the close button should be shown or not\n * @default false\n */\n showCloseButton?: boolean;\n\n /**\n * Allows all dates and buttons to be focused, including disabled ones\n * @default false\n */\n allFocusable?: boolean;\n\n /**\n * Custom navigation icons.\n */\n navigationIcons: CalendarNavigationIcons;\n}\n\n/**\n * @internal\n */\nexport interface CalendarDayStyleProps extends CalendarDayGridStyleProps {\n /**\n * Accept custom classNames\n */\n className?: string;\n\n /**\n * Whether the header is clickable\n */\n headerIsClickable?: boolean;\n\n /**\n * Whether week numbers are being shown\n */\n showWeekNumbers?: boolean;\n}\n\n/**\n * @internal\n */\nexport interface CalendarDayStyles {\n /**\n * Style for the root element.\n */\n root: string;\n\n /**\n * The style for the header button and forward/back navigation button container\n */\n header: string;\n\n /**\n * The style for the title text inside the header\n */\n monthAndYear: string;\n\n /**\n * The style for the wrapper around forward/back/close buttons\n */\n monthComponents: string;\n\n /**\n * The style for the forward/back/close buttons\n */\n headerIconButton: string;\n\n /**\n * The style to apply for disabled elements\n */\n disabledStyle: string;\n}\n"],"names":["React"],"mappings":"AAAA,YAAYA,WAAW,QAAQ"}
1
+ {"version":3,"sources":["../src/components/CalendarDay/CalendarDay.types.ts"],"sourcesContent":["import * as React from 'react';\nimport type { CalendarStrings, DateFormatting } from '../../utils';\nimport type { CalendarDayGridProps, CalendarDayGridStyleProps } from '../CalendarDayGrid/CalendarDayGrid.types';\nimport type { CalendarNavigationIcons } from '../Calendar/calendarNavigationIcons';\n\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport interface ICalendarDay {\n focus(): void;\n}\n\nexport interface CalendarDayProps extends CalendarDayGridProps {\n /**\n * Optional callback to access the ICalendarDay interface. Use this instead of ref for accessing\n * the public methods and properties of the component.\n */\n componentRef?: React.RefObject<ICalendarDay | null>;\n\n /**\n * Additional CSS class(es) to apply to the CalendarDay.\n */\n className?: string;\n\n /**\n * Localized strings to use in the Calendar\n */\n strings: CalendarStrings;\n\n /**\n * The currently navigated date\n */\n navigatedDate: Date;\n\n /**\n * Callback issued when a date in the calendar is navigated\n * @param date - The date that is navigated to\n * @param focusOnNavigatedDay - Whether to set the focus to the navigated date.\n */\n onNavigateDate: (date: Date, focusOnNavigatedDay: boolean) => void;\n\n /**\n * Callback issued when calendar day is closed\n */\n onDismiss?: () => void;\n\n /**\n * Callback function when the header is selected\n */\n onHeaderSelect?: () => void;\n\n /**\n * Whether the calendar should show the week number (weeks 1 to 53) before each week row\n * @default false\n */\n showWeekNumbers?: boolean;\n\n /**\n * Apply additional formatting to dates, for example localized date formatting.\n */\n dateTimeFormatter: DateFormatting;\n\n /**\n * Whether the calendar should show 6 weeks by default.\n * @default false\n */\n showSixWeeksByDefault?: boolean;\n\n /**\n * If set the Calendar will not allow navigation to or selection of a date earlier than this value.\n */\n minDate?: Date;\n\n /**\n * If set the Calendar will not allow navigation to or selection of a date later than this value.\n */\n maxDate?: Date;\n\n /**\n * If set the Calendar will not allow selection of dates in this array.\n */\n restrictedDates?: Date[];\n\n /**\n * Whether the close button should be shown or not\n * @default false\n */\n showCloseButton?: boolean;\n\n /**\n * Allows all dates and buttons to be focused, including disabled ones\n * @default false\n */\n allFocusable?: boolean;\n\n /**\n * Custom navigation icons.\n */\n navigationIcons: CalendarNavigationIcons;\n}\n\n/**\n * @internal\n */\nexport interface CalendarDayStyleProps extends CalendarDayGridStyleProps {\n /**\n * Accept custom classNames\n */\n className?: string;\n\n /**\n * Whether the header is clickable\n */\n headerIsClickable?: boolean;\n\n /**\n * Whether week numbers are being shown\n */\n showWeekNumbers?: boolean;\n}\n\n/**\n * @internal\n */\nexport interface CalendarDayStyles {\n /**\n * Style for the root element.\n */\n root: string;\n\n /**\n * The style for the header button and forward/back navigation button container\n */\n header: string;\n\n /**\n * The style for the title text inside the header\n */\n monthAndYear: string;\n\n /**\n * The style for the wrapper around forward/back/close buttons\n */\n monthComponents: string;\n\n /**\n * The style for the forward/back/close buttons\n */\n headerIconButton: string;\n\n /**\n * The style to apply for disabled elements\n */\n disabledStyle: string;\n}\n"],"names":["React"],"mappings":"AAAA,YAAYA,WAAW,QAAQ"}
@@ -23,7 +23,7 @@ function useDayRefs() {
23
23
  ];
24
24
  }
25
25
  function useAnimateBackwards(weeks) {
26
- const previousNavigatedDateRef = React.useRef();
26
+ const previousNavigatedDateRef = React.useRef(undefined);
27
27
  React.useEffect(()=>{
28
28
  previousNavigatedDateRef.current = weeks[0][0].originalDate;
29
29
  });
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/CalendarDayGrid/CalendarDayGrid.tsx"],"sourcesContent":["import * as React from 'react';\nimport { useArrowNavigationGroup } from '@fluentui/react-tabster';\nimport { useId } from '@fluentui/react-utilities';\nimport { getBoundedDateRange, getDateRangeArray, isRestrictedDate, DateRangeType, DayOfWeek } from '../../utils';\nimport { useCalendarDayGridStyles_unstable } from './useCalendarDayGridStyles.styles';\nimport { CalendarMonthHeaderRow } from './CalendarMonthHeaderRow';\nimport { CalendarGridRow } from './CalendarGridRow';\nimport { useWeeks } from './useWeeks';\nimport { useWeekCornerStyles, WeekCorners } from './useWeekCornerStyles.styles';\nimport { mergeClasses } from '@griffel/react';\nimport type { Day } from '../../utils';\nimport type { CalendarDayGridProps } from './CalendarDayGrid.types';\n\nexport interface DayInfo extends Day {\n onSelected: () => void;\n setRef(element: HTMLElement | null): void;\n}\n\nfunction useDayRefs() {\n const daysRef = React.useRef<Record<string, HTMLElement>>({});\n\n const getSetRefCallback = (dayKey: string) => (element: HTMLElement | null) => {\n if (element === null) {\n delete daysRef.current[dayKey];\n } else {\n daysRef.current[dayKey] = element;\n }\n };\n\n return [daysRef, getSetRefCallback] as const;\n}\n\nfunction useAnimateBackwards(weeks: DayInfo[][]): boolean | undefined {\n const previousNavigatedDateRef = React.useRef<Date | undefined>();\n React.useEffect(() => {\n previousNavigatedDateRef.current = weeks[0][0].originalDate;\n });\n const previousNavigatedDate = previousNavigatedDateRef.current;\n\n if (!previousNavigatedDate || previousNavigatedDate.getTime() === weeks[0][0].originalDate.getTime()) {\n return undefined;\n } else if (previousNavigatedDate <= weeks[0][0].originalDate) {\n return false;\n } else {\n return true;\n }\n}\n\nexport const CalendarDayGrid: React.FunctionComponent<CalendarDayGridProps> = props => {\n const navigatedDayRef = React.useRef<HTMLTableCellElement>(null) as React.MutableRefObject<HTMLTableCellElement>;\n\n const activeDescendantId = useId();\n\n const onSelectDate = (selectedDate: Date): void => {\n const { firstDayOfWeek, minDate, maxDate, workWeekDays, daysToSelectInDayView, restrictedDates } = props;\n const restrictedDatesOptions = { minDate, maxDate, restrictedDates };\n\n let dateRange = getDateRangeArray(selectedDate, dateRangeType, firstDayOfWeek, workWeekDays, daysToSelectInDayView);\n dateRange = getBoundedDateRange(dateRange, minDate, maxDate);\n\n dateRange = dateRange.filter((d: Date) => {\n return !isRestrictedDate(d, restrictedDatesOptions);\n });\n\n props.onSelectDate?.(selectedDate, dateRange);\n props.onNavigateDate?.(selectedDate, true);\n };\n\n const [daysRef, getSetRefCallback] = useDayRefs();\n\n const weeks = useWeeks(props, onSelectDate, getSetRefCallback);\n const animateBackwards = useAnimateBackwards(weeks);\n const [getWeekCornerStyles, calculateRoundedStyles] = useWeekCornerStyles(props);\n\n React.useImperativeHandle(\n props.componentRef,\n () => ({\n focus() {\n navigatedDayRef.current?.focus?.();\n },\n }),\n [],\n );\n\n /**\n *\n * Section for setting hover/pressed styles. Because we want arbitrary blobs of days to be selectable, to support\n * highlighting every day in the month for month view, css :hover style isn't enough, so we need mouse callbacks\n * to set classnames on all relevant child refs to apply the styling\n *\n */\n const getDayInfosInRangeOfDay = (dayToCompare: DayInfo): DayInfo[] => {\n // The hover state looks weird with non-contiguous days in work week view. In work week, show week hover state\n const dateRangeHoverType = getDateRangeTypeToUse(props.dateRangeType, props.workWeekDays);\n\n // gets all the dates for the given date range type that are in the same date range as the given day\n const dateRange = getDateRangeArray(\n dayToCompare.originalDate,\n dateRangeHoverType,\n props.firstDayOfWeek,\n props.workWeekDays,\n props.daysToSelectInDayView,\n ).map((date: Date) => date.getTime());\n\n // gets all the day refs for the given dates\n const dayInfosInRange = weeks.reduce((accumulatedValue: DayInfo[], currentWeek: DayInfo[]) => {\n return accumulatedValue.concat(\n currentWeek.filter((weekDay: DayInfo) => dateRange.indexOf(weekDay.originalDate.getTime()) !== -1),\n );\n }, []);\n\n return dayInfosInRange;\n };\n\n const getRefsFromDayInfos = (dayInfosInRange: DayInfo[]): (HTMLElement | null)[] => {\n let dayRefs: (HTMLElement | null)[] = [];\n dayRefs = dayInfosInRange.map((dayInfo: DayInfo) => daysRef.current[dayInfo.key]);\n\n return dayRefs;\n };\n\n const {\n gridLabel,\n dateRangeType,\n showWeekNumbers,\n labelledBy,\n lightenDaysOutsideNavigatedMonth,\n animationDirection,\n } = props;\n\n const classNames = useCalendarDayGridStyles_unstable({\n animateBackwards,\n animationDirection,\n dateRangeType,\n lightenDaysOutsideNavigatedMonth:\n lightenDaysOutsideNavigatedMonth === undefined ? true : lightenDaysOutsideNavigatedMonth,\n showWeekNumbers,\n });\n\n // When the month is highlighted get the corner dates so that styles can be added to them\n const weekCorners: WeekCorners = getWeekCornerStyles(weeks!);\n const partialWeekProps = {\n weeks,\n navigatedDayRef,\n calculateRoundedStyles,\n activeDescendantId,\n classNames,\n weekCorners,\n getDayInfosInRangeOfDay,\n getRefsFromDayInfos,\n } as const;\n\n const arrowNavigationAttributes = useArrowNavigationGroup({ axis: 'grid' });\n\n return (\n <table\n className={mergeClasses(classNames.table, props.className)}\n aria-multiselectable=\"false\"\n aria-label={gridLabel}\n aria-labelledby={labelledBy}\n aria-activedescendant={activeDescendantId}\n role=\"grid\"\n {...arrowNavigationAttributes}\n >\n <tbody>\n <CalendarMonthHeaderRow {...props} classNames={classNames} weeks={weeks} />\n <CalendarGridRow\n {...props}\n {...partialWeekProps}\n week={weeks[0]}\n weekIndex={-1}\n rowClassName={classNames.firstTransitionWeek}\n aria-role=\"presentation\"\n ariaHidden={true}\n />\n {weeks!.slice(1, weeks!.length - 1).map((week: DayInfo[], weekIndex: number) => (\n <CalendarGridRow\n {...props}\n {...partialWeekProps}\n key={weekIndex}\n week={week}\n weekIndex={weekIndex}\n rowClassName={classNames.weekRow}\n />\n ))}\n <CalendarGridRow\n {...props}\n {...partialWeekProps}\n week={weeks![weeks!.length - 1]}\n weekIndex={-2}\n rowClassName={classNames.lastTransitionWeek}\n aria-role=\"presentation\"\n ariaHidden={true}\n />\n </tbody>\n </table>\n );\n};\nCalendarDayGrid.displayName = 'CalendarDayGrid';\n\n/**\n * When given work week, if the days are non-contiguous, the hover states look really weird. So for non-contiguous\n * work weeks, we'll just show week view instead.\n */\nfunction getDateRangeTypeToUse(dateRangeType: DateRangeType, workWeekDays: DayOfWeek[] | undefined): DateRangeType {\n if (workWeekDays && dateRangeType === DateRangeType.WorkWeek) {\n const sortedWWDays = workWeekDays.slice().sort();\n let isContiguous = true;\n for (let i = 1; i < sortedWWDays.length; i++) {\n if (sortedWWDays[i] !== sortedWWDays[i - 1] + 1) {\n isContiguous = false;\n break;\n }\n }\n\n if (!isContiguous || workWeekDays.length === 0) {\n return DateRangeType.Week;\n }\n }\n\n return dateRangeType;\n}\n"],"names":["React","useArrowNavigationGroup","useId","getBoundedDateRange","getDateRangeArray","isRestrictedDate","DateRangeType","useCalendarDayGridStyles_unstable","CalendarMonthHeaderRow","CalendarGridRow","useWeeks","useWeekCornerStyles","mergeClasses","useDayRefs","daysRef","useRef","getSetRefCallback","dayKey","element","current","useAnimateBackwards","weeks","previousNavigatedDateRef","useEffect","originalDate","previousNavigatedDate","getTime","undefined","CalendarDayGrid","props","navigatedDayRef","activeDescendantId","onSelectDate","selectedDate","firstDayOfWeek","minDate","maxDate","workWeekDays","daysToSelectInDayView","restrictedDates","restrictedDatesOptions","dateRange","dateRangeType","filter","d","onNavigateDate","animateBackwards","getWeekCornerStyles","calculateRoundedStyles","useImperativeHandle","componentRef","focus","getDayInfosInRangeOfDay","dayToCompare","dateRangeHoverType","getDateRangeTypeToUse","map","date","dayInfosInRange","reduce","accumulatedValue","currentWeek","concat","weekDay","indexOf","getRefsFromDayInfos","dayRefs","dayInfo","key","gridLabel","showWeekNumbers","labelledBy","lightenDaysOutsideNavigatedMonth","animationDirection","classNames","weekCorners","partialWeekProps","arrowNavigationAttributes","axis","table","className","aria-multiselectable","aria-label","aria-labelledby","aria-activedescendant","role","tbody","week","weekIndex","rowClassName","firstTransitionWeek","aria-role","ariaHidden","slice","length","weekRow","lastTransitionWeek","displayName","WorkWeek","sortedWWDays","sort","isContiguous","i","Week"],"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AmB;QAC5CC,aAAU;QACVC,YAAY;QAEbvE,MAAOwE,KAAK,CAAC,GAAGxE,MAAOyE,MAAM,GAAG,GAAGtC,GAAG,CAAC,CAAC+B,MAAiBC,0BACxD,oBAAC/E;YACE,GAAGoB,KAAK;YACR,GAAG+C,gBAAgB;YACpBR,KAAKoB;YACLD,MAAMA;YACNC,WAAWA;YACXC,cAAcf,WAAWqB,OAAO;2BAGpC,oBAACtF;QACE,GAAGoB,KAAK;QACR,GAAG+C,gBAAgB;QACpBW,MAAMlE,KAAM,CAACA,MAAOyE,MAAM,GAAG,EAAE;QAC/BN,WAAW,CAAC;QACZC,cAAcf,WAAWsB,kBAAkB;QAC3CL,aAAU;QACVC,YAAY;;AAKtB,EAAE;AACFhE,gBAAgBqE,WAAW,GAAG;AAE9B;;;CAGC,GACD,SAAS1C,sBAAsBb,aAA4B,EAAEL,YAAqC;IAChG,IAAIA,gBAAgBK,kBAAkBpC,cAAc4F,QAAQ,EAAE;QAC5D,MAAMC,eAAe9D,aAAawD,KAAK,GAAGO,IAAI;QAC9C,IAAIC,eAAe;QACnB,IAAK,IAAIC,IAAI,GAAGA,IAAIH,aAAaL,MAAM,EAAEQ,IAAK;YAC5C,IAAIH,YAAY,CAACG,EAAE,KAAKH,YAAY,CAACG,IAAI,EAAE,GAAG,GAAG;gBAC/CD,eAAe;gBACf;YACF;QACF;QAEA,IAAI,CAACA,gBAAgBhE,aAAayD,MAAM,KAAK,GAAG;YAC9C,OAAOxF,cAAciG,IAAI;QAC3B;IACF;IAEA,OAAO7D;AACT"}
1
+ {"version":3,"sources":["../src/components/CalendarDayGrid/CalendarDayGrid.tsx"],"sourcesContent":["import * as React from 'react';\nimport { useArrowNavigationGroup } from '@fluentui/react-tabster';\nimport { useId } from '@fluentui/react-utilities';\nimport { getBoundedDateRange, getDateRangeArray, isRestrictedDate, DateRangeType, DayOfWeek } from '../../utils';\nimport { useCalendarDayGridStyles_unstable } from './useCalendarDayGridStyles.styles';\nimport { CalendarMonthHeaderRow } from './CalendarMonthHeaderRow';\nimport { CalendarGridRow } from './CalendarGridRow';\nimport { useWeeks } from './useWeeks';\nimport { useWeekCornerStyles, WeekCorners } from './useWeekCornerStyles.styles';\nimport { mergeClasses } from '@griffel/react';\nimport type { Day } from '../../utils';\nimport type { CalendarDayGridProps } from './CalendarDayGrid.types';\n\nexport interface DayInfo extends Day {\n onSelected: () => void;\n setRef(element: HTMLElement | null): void;\n}\n\nfunction useDayRefs() {\n const daysRef = React.useRef<Record<string, HTMLElement>>({});\n\n const getSetRefCallback = (dayKey: string) => (element: HTMLElement | null) => {\n if (element === null) {\n delete daysRef.current[dayKey];\n } else {\n daysRef.current[dayKey] = element;\n }\n };\n\n return [daysRef, getSetRefCallback] as const;\n}\n\nfunction useAnimateBackwards(weeks: DayInfo[][]): boolean | undefined {\n const previousNavigatedDateRef = React.useRef<Date | undefined>(undefined);\n React.useEffect(() => {\n previousNavigatedDateRef.current = weeks[0][0].originalDate;\n });\n const previousNavigatedDate = previousNavigatedDateRef.current;\n\n if (!previousNavigatedDate || previousNavigatedDate.getTime() === weeks[0][0].originalDate.getTime()) {\n return undefined;\n } else if (previousNavigatedDate <= weeks[0][0].originalDate) {\n return false;\n } else {\n return true;\n }\n}\n\nexport const CalendarDayGrid: React.FunctionComponent<CalendarDayGridProps> = props => {\n const navigatedDayRef = React.useRef<HTMLTableCellElement>(\n null,\n ) as React.MutableRefObject<HTMLTableCellElement | null>;\n\n const activeDescendantId = useId();\n\n const onSelectDate = (selectedDate: Date): void => {\n const { firstDayOfWeek, minDate, maxDate, workWeekDays, daysToSelectInDayView, restrictedDates } = props;\n const restrictedDatesOptions = { minDate, maxDate, restrictedDates };\n\n let dateRange = getDateRangeArray(selectedDate, dateRangeType, firstDayOfWeek, workWeekDays, daysToSelectInDayView);\n dateRange = getBoundedDateRange(dateRange, minDate, maxDate);\n\n dateRange = dateRange.filter((d: Date) => {\n return !isRestrictedDate(d, restrictedDatesOptions);\n });\n\n props.onSelectDate?.(selectedDate, dateRange);\n props.onNavigateDate?.(selectedDate, true);\n };\n\n const [daysRef, getSetRefCallback] = useDayRefs();\n\n const weeks = useWeeks(props, onSelectDate, getSetRefCallback);\n const animateBackwards = useAnimateBackwards(weeks);\n const [getWeekCornerStyles, calculateRoundedStyles] = useWeekCornerStyles(props);\n\n React.useImperativeHandle(\n props.componentRef,\n () => ({\n focus() {\n navigatedDayRef.current?.focus?.();\n },\n }),\n [],\n );\n\n /**\n *\n * Section for setting hover/pressed styles. Because we want arbitrary blobs of days to be selectable, to support\n * highlighting every day in the month for month view, css :hover style isn't enough, so we need mouse callbacks\n * to set classnames on all relevant child refs to apply the styling\n *\n */\n const getDayInfosInRangeOfDay = (dayToCompare: DayInfo): DayInfo[] => {\n // The hover state looks weird with non-contiguous days in work week view. In work week, show week hover state\n const dateRangeHoverType = getDateRangeTypeToUse(props.dateRangeType, props.workWeekDays);\n\n // gets all the dates for the given date range type that are in the same date range as the given day\n const dateRange = getDateRangeArray(\n dayToCompare.originalDate,\n dateRangeHoverType,\n props.firstDayOfWeek,\n props.workWeekDays,\n props.daysToSelectInDayView,\n ).map((date: Date) => date.getTime());\n\n // gets all the day refs for the given dates\n const dayInfosInRange = weeks.reduce((accumulatedValue: DayInfo[], currentWeek: DayInfo[]) => {\n return accumulatedValue.concat(\n currentWeek.filter((weekDay: DayInfo) => dateRange.indexOf(weekDay.originalDate.getTime()) !== -1),\n );\n }, []);\n\n return dayInfosInRange;\n };\n\n const getRefsFromDayInfos = (dayInfosInRange: DayInfo[]): (HTMLElement | null)[] => {\n let dayRefs: (HTMLElement | null)[] = [];\n dayRefs = dayInfosInRange.map((dayInfo: DayInfo) => daysRef.current[dayInfo.key]);\n\n return dayRefs;\n };\n\n const {\n gridLabel,\n dateRangeType,\n showWeekNumbers,\n labelledBy,\n lightenDaysOutsideNavigatedMonth,\n animationDirection,\n } = props;\n\n const classNames = useCalendarDayGridStyles_unstable({\n animateBackwards,\n animationDirection,\n dateRangeType,\n lightenDaysOutsideNavigatedMonth:\n lightenDaysOutsideNavigatedMonth === undefined ? true : lightenDaysOutsideNavigatedMonth,\n showWeekNumbers,\n });\n\n // When the month is highlighted get the corner dates so that styles can be added to them\n const weekCorners: WeekCorners = getWeekCornerStyles(weeks!);\n const partialWeekProps = {\n weeks,\n navigatedDayRef,\n calculateRoundedStyles,\n activeDescendantId,\n classNames,\n weekCorners,\n getDayInfosInRangeOfDay,\n getRefsFromDayInfos,\n } as const;\n\n const arrowNavigationAttributes = useArrowNavigationGroup({ axis: 'grid' });\n\n return (\n <table\n className={mergeClasses(classNames.table, props.className)}\n aria-multiselectable=\"false\"\n aria-label={gridLabel}\n aria-labelledby={labelledBy}\n aria-activedescendant={activeDescendantId}\n role=\"grid\"\n {...arrowNavigationAttributes}\n >\n <tbody>\n <CalendarMonthHeaderRow {...props} classNames={classNames} weeks={weeks} />\n <CalendarGridRow\n {...props}\n {...partialWeekProps}\n week={weeks[0]}\n weekIndex={-1}\n rowClassName={classNames.firstTransitionWeek}\n aria-role=\"presentation\"\n ariaHidden={true}\n />\n {weeks!.slice(1, weeks!.length - 1).map((week: DayInfo[], weekIndex: number) => (\n <CalendarGridRow\n {...props}\n {...partialWeekProps}\n key={weekIndex}\n week={week}\n weekIndex={weekIndex}\n rowClassName={classNames.weekRow}\n />\n ))}\n <CalendarGridRow\n {...props}\n {...partialWeekProps}\n week={weeks![weeks!.length - 1]}\n weekIndex={-2}\n rowClassName={classNames.lastTransitionWeek}\n aria-role=\"presentation\"\n ariaHidden={true}\n />\n </tbody>\n </table>\n );\n};\nCalendarDayGrid.displayName = 'CalendarDayGrid';\n\n/**\n * When given work week, if the days are non-contiguous, the hover states look really weird. So for non-contiguous\n * work weeks, we'll just show week view instead.\n */\nfunction getDateRangeTypeToUse(dateRangeType: DateRangeType, workWeekDays: DayOfWeek[] | undefined): DateRangeType {\n if (workWeekDays && dateRangeType === DateRangeType.WorkWeek) {\n const sortedWWDays = workWeekDays.slice().sort();\n let isContiguous = true;\n for (let i = 1; i < sortedWWDays.length; i++) {\n if (sortedWWDays[i] !== sortedWWDays[i - 1] + 1) {\n isContiguous = false;\n break;\n }\n }\n\n if (!isContiguous || workWeekDays.length === 0) {\n return DateRangeType.Week;\n }\n }\n\n return dateRangeType;\n}\n"],"names":["React","useArrowNavigationGroup","useId","getBoundedDateRange","getDateRangeArray","isRestrictedDate","DateRangeType","useCalendarDayGridStyles_unstable","CalendarMonthHeaderRow","CalendarGridRow","useWeeks","useWeekCornerStyles","mergeClasses","useDayRefs","daysRef","useRef","getSetRefCallback","dayKey","element","current","useAnimateBackwards","weeks","previousNavigatedDateRef","undefined","useEffect","originalDate","previousNavigatedDate","getTime","CalendarDayGrid","props","navigatedDayRef","activeDescendantId","onSelectDate","selectedDate","firstDayOfWeek","minDate","maxDate","workWeekDays","daysToSelectInDayView","restrictedDates","restrictedDatesOptions","dateRange","dateRangeType","filter","d","onNavigateDate","animateBackwards","getWeekCornerStyles","calculateRoundedStyles","useImperativeHandle","componentRef","focus","getDayInfosInRangeOfDay","dayToCompare","dateRangeHoverType","getDateRangeTypeToUse","map","date","dayInfosInRange","reduce","accumulatedValue","currentWeek","concat","weekDay","indexOf","getRefsFromDayInfos","dayRefs","dayInfo","key","gridLabel","showWeekNumbers","labelledBy","lightenDaysOutsideNavigatedMonth","animationDirection","classNames","weekCorners","partialWeekProps","arrowNavigationAttributes","axis","table","className","aria-multiselectable","aria-label","aria-labelledby","aria-activedescendant","role","tbody","week","weekIndex","rowClassName","firstTransitionWeek","aria-role","ariaHidden","slice","length","weekRow","lastTransitionWeek","displayName","WorkWeek","sortedWWDays","sort","isContiguous","i","Week"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,uBAAuB,QAAQ,0BAA0B;AAClE,SAASC,KAAK,QAAQ,4BAA4B;AAClD,SAASC,mBAAmB,EAAEC,iBAAiB,EAAEC,gBAAgB,EAAEC,aAAa,QAAmB,cAAc;AACjH,SAASC,iCAAiC,QAAQ,oCAAoC;AAC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ACNC,WAAWA;YACXC,cAAcf,WAAWqB,OAAO;2BAGpC,oBAACtF;QACE,GAAGoB,KAAK;QACR,GAAG+C,gBAAgB;QACpBW,MAAMlE,KAAM,CAACA,MAAOyE,MAAM,GAAG,EAAE;QAC/BN,WAAW,CAAC;QACZC,cAAcf,WAAWsB,kBAAkB;QAC3CL,aAAU;QACVC,YAAY;;AAKtB,EAAE;AACFhE,gBAAgBqE,WAAW,GAAG;AAE9B;;;CAGC,GACD,SAAS1C,sBAAsBb,aAA4B,EAAEL,YAAqC;IAChG,IAAIA,gBAAgBK,kBAAkBpC,cAAc4F,QAAQ,EAAE;QAC5D,MAAMC,eAAe9D,aAAawD,KAAK,GAAGO,IAAI;QAC9C,IAAIC,eAAe;QACnB,IAAK,IAAIC,IAAI,GAAGA,IAAIH,aAAaL,MAAM,EAAEQ,IAAK;YAC5C,IAAIH,YAAY,CAACG,EAAE,KAAKH,YAAY,CAACG,IAAI,EAAE,GAAG,GAAG;gBAC/CD,eAAe;gBACf;YACF;QACF;QAEA,IAAI,CAACA,gBAAgBhE,aAAayD,MAAM,KAAK,GAAG;YAC9C,OAAOxF,cAAciG,IAAI;QAC3B;IACF;IAEA,OAAO7D;AACT"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/CalendarDayGrid/CalendarDayGrid.types.ts"],"sourcesContent":["import * as React from 'react';\nimport { AnimationDirection } from '../Calendar/Calendar.types';\nimport { DayOfWeek, FirstWeekOfYear, DateRangeType } from '../../utils';\nimport type { CalendarStrings, DateFormatting, DayGridOptions } from '../../utils';\n\n/**\n * @internal\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport interface ICalendarDayGrid {\n focus(): void;\n}\n\n/**\n * @internal\n */\nexport interface CalendarDayGridProps extends DayGridOptions {\n /**\n * Optional callback to access the ICalendarDayGrid interface. Use this instead of ref for accessing\n * the public methods and properties of the component.\n */\n componentRef?: React.RefObject<ICalendarDayGrid>;\n\n /**\n * Additional CSS class(es) to apply to the CalendarDayGrid.\n */\n className?: string;\n\n /**\n * Localized strings to use in the CalendarDayGrid\n */\n strings: CalendarStrings;\n\n /**\n * The currently selected date\n */\n selectedDate: Date;\n\n /**\n * The currently navigated date\n */\n navigatedDate: Date;\n\n /**\n * Callback issued when a date is selected\n * @param date - The date the user selected\n * @param selectedDateRangeArray - The resultant list of dates that are selected based on the date range type set\n * for the component.\n */\n onSelectDate?: (date: Date, selectedDateRangeArray?: Date[]) => void;\n\n /**\n * Callback issued when a date in the calendar is navigated\n * @param date - The date that is navigated to\n * @param focusOnNavigatedDay - Whether to set the focus to the navigated date.\n */\n onNavigateDate: (date: Date, focusOnNavigatedDay: boolean) => void;\n\n /**\n * Callback issued when calendar day is closed\n */\n onDismiss?: () => void;\n\n /**\n * The first day of the week for your locale.\n * @default DayOfWeek.Sunday\n */\n firstDayOfWeek: DayOfWeek;\n\n /**\n * Defines when the first week of the year should start, FirstWeekOfYear.FirstDay,\n * FirstWeekOfYear.FirstFullWeek or FirstWeekOfYear.FirstFourDayWeek are the possible values\n * @default FirstWeekOfYear.FirstDay\n */\n firstWeekOfYear: FirstWeekOfYear;\n\n /**\n * The date range type indicating how many days should be selected as the user\n * selects days\n * @default DateRangeType.Day\n */\n dateRangeType: DateRangeType;\n\n /**\n * The number of days to select while dateRangeType === DateRangeType.Day. Used in order to have multi-day\n * views.\n * @default 1\n */\n daysToSelectInDayView?: number;\n\n /**\n * Value of today. If unspecified, current time in client machine will be used.\n */\n today?: Date;\n\n /**\n * Whether the calendar should show the week number (weeks 1 to 53) before each week row\n * @default false\n */\n showWeekNumbers?: boolean;\n\n /**\n * Apply additional formatting to dates, for example localized date formatting.\n */\n dateTimeFormatter: DateFormatting;\n\n /**\n * Ref callback for individual days. Allows for customization of the styling, properties, or listeners of the\n * specific day.\n */\n customDayCellRef?: (element: HTMLElement, date: Date, classNames: CalendarDayGridStyles) => void;\n\n /**\n * How many weeks to show by default. If not provided, will show enough weeks to display the current\n * month, between 4 and 6 depending\n * @default undefined\n */\n weeksToShow?: number;\n\n /**\n * If set the Calendar will not allow navigation to or selection of a date earlier than this value.\n */\n minDate?: Date;\n\n /**\n * If set the Calendar will not allow navigation to or selection of a date later than this value.\n */\n maxDate?: Date;\n\n /**\n * If set the Calendar will not allow selection of dates in this array.\n */\n restrictedDates?: Date[];\n\n /**\n * The days that are selectable when `dateRangeType` is WorkWeek.\n * If `dateRangeType` is not WorkWeek this property does nothing.\n * @default [Monday,Tuesday,Wednesday,Thursday,Friday]\n */\n workWeekDays?: DayOfWeek[];\n\n /**\n * Whether the close button should be shown or not\n * @default false\n */\n showCloseButton?: boolean;\n\n /**\n * Allows all dates and buttons to be focused, including disabled ones\n * @default false\n */\n allFocusable?: boolean;\n\n /**\n * Label string for the grid\n */\n gridLabel?: string;\n\n /**\n * The ID of the control that labels this one\n */\n labelledBy?: string;\n\n /**\n * Whether to show days outside the selected month with lighter styles\n * @default true\n */\n lightenDaysOutsideNavigatedMonth?: boolean;\n\n /**\n * The cardinal directions for animation to occur during transitions, either horizontal or veritcal\n */\n animationDirection?: AnimationDirection;\n\n /**\n * Optional callback function to mark specific days with a small symbol. Fires when the date range changes,\n * gives the starting and ending displayed dates and expects the list of which days in between should be\n * marked.\n */\n getMarkedDays?: (startingDate: Date, endingDate: Date) => Date[];\n}\n\n/**\n * @internal\n */\nexport interface CalendarDayGridStyleProps {\n /**\n * Accept custom classNames\n */\n className?: string;\n\n /**\n * The date range type\n */\n dateRangeType?: DateRangeType;\n\n /**\n * Whether week numbers are being shown\n */\n showWeekNumbers?: boolean;\n\n /**\n * Whether to show days outside the selected month with lighter styles\n */\n lightenDaysOutsideNavigatedMonth?: boolean;\n\n /**\n * Whether grid entering animation should be forwards or backwards\n */\n animateBackwards?: boolean;\n\n /**\n * The cardinal directions for animation to occur during transitions, either horizontal or vertical\n */\n animationDirection?: AnimationDirection;\n}\n\n/**\n * @internal\n */\nexport interface CalendarDayGridStyles {\n /**\n * The style for the root div\n */\n wrapper?: string;\n\n /**\n * The style for the table containing the grid\n */\n table?: string;\n\n /**\n * The style to apply to the grid cells for days\n */\n dayCell?: string;\n\n /**\n * The style to apply to grid cells for days in the selected range\n */\n daySelected?: string;\n\n /**\n * The classname applied when a single day is selected\n */\n daySingleSelected?: string;\n\n /**\n * The style to apply to row around weeks\n */\n weekRow?: string;\n\n /**\n * The style to apply to the column headers above the weeks\n */\n weekDayLabelCell?: string;\n\n /**\n * The style to apply to grid cells for week numbers\n */\n weekNumberCell?: string;\n\n /**\n * The style to apply to individual days that are outside the min/max date range\n */\n dayOutsideBounds?: string;\n\n /**\n * The style to apply to individual days that are outside the current month\n */\n dayOutsideNavigatedMonth?: string;\n\n /**\n * The style to apply to the button element within the day cells\n */\n dayButton?: string;\n\n /**\n * The style to apply to the individual button element that matches the \"today\" parameter\n */\n dayIsToday?: string;\n\n /**\n * The style applied to the first placeholder week used during transitions\n */\n firstTransitionWeek?: string;\n\n /**\n * The style applied to the last placeholder week used during transitions\n */\n lastTransitionWeek?: string;\n\n /**\n * The style applied to the marker on days to mark as important\n */\n dayMarker?: string;\n\n /**\n * The classname applied to the day \"today\" span\n */\n dayTodayMarker?: string;\n}\n"],"names":["React"],"mappings":"AAAA,YAAYA,WAAW,QAAQ"}
1
+ {"version":3,"sources":["../src/components/CalendarDayGrid/CalendarDayGrid.types.ts"],"sourcesContent":["import * as React from 'react';\nimport { AnimationDirection } from '../Calendar/Calendar.types';\nimport { DayOfWeek, FirstWeekOfYear, DateRangeType } from '../../utils';\nimport type { CalendarStrings, DateFormatting, DayGridOptions } from '../../utils';\n\n/**\n * @internal\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport interface ICalendarDayGrid {\n focus(): void;\n}\n\n/**\n * @internal\n */\nexport interface CalendarDayGridProps extends DayGridOptions {\n /**\n * Optional callback to access the ICalendarDayGrid interface. Use this instead of ref for accessing\n * the public methods and properties of the component.\n */\n componentRef?: React.RefObject<ICalendarDayGrid | null>;\n\n /**\n * Additional CSS class(es) to apply to the CalendarDayGrid.\n */\n className?: string;\n\n /**\n * Localized strings to use in the CalendarDayGrid\n */\n strings: CalendarStrings;\n\n /**\n * The currently selected date\n */\n selectedDate: Date;\n\n /**\n * The currently navigated date\n */\n navigatedDate: Date;\n\n /**\n * Callback issued when a date is selected\n * @param date - The date the user selected\n * @param selectedDateRangeArray - The resultant list of dates that are selected based on the date range type set\n * for the component.\n */\n onSelectDate?: (date: Date, selectedDateRangeArray?: Date[]) => void;\n\n /**\n * Callback issued when a date in the calendar is navigated\n * @param date - The date that is navigated to\n * @param focusOnNavigatedDay - Whether to set the focus to the navigated date.\n */\n onNavigateDate: (date: Date, focusOnNavigatedDay: boolean) => void;\n\n /**\n * Callback issued when calendar day is closed\n */\n onDismiss?: () => void;\n\n /**\n * The first day of the week for your locale.\n * @default DayOfWeek.Sunday\n */\n firstDayOfWeek: DayOfWeek;\n\n /**\n * Defines when the first week of the year should start, FirstWeekOfYear.FirstDay,\n * FirstWeekOfYear.FirstFullWeek or FirstWeekOfYear.FirstFourDayWeek are the possible values\n * @default FirstWeekOfYear.FirstDay\n */\n firstWeekOfYear: FirstWeekOfYear;\n\n /**\n * The date range type indicating how many days should be selected as the user\n * selects days\n * @default DateRangeType.Day\n */\n dateRangeType: DateRangeType;\n\n /**\n * The number of days to select while dateRangeType === DateRangeType.Day. Used in order to have multi-day\n * views.\n * @default 1\n */\n daysToSelectInDayView?: number;\n\n /**\n * Value of today. If unspecified, current time in client machine will be used.\n */\n today?: Date;\n\n /**\n * Whether the calendar should show the week number (weeks 1 to 53) before each week row\n * @default false\n */\n showWeekNumbers?: boolean;\n\n /**\n * Apply additional formatting to dates, for example localized date formatting.\n */\n dateTimeFormatter: DateFormatting;\n\n /**\n * Ref callback for individual days. Allows for customization of the styling, properties, or listeners of the\n * specific day.\n */\n customDayCellRef?: (element: HTMLElement, date: Date, classNames: CalendarDayGridStyles) => void;\n\n /**\n * How many weeks to show by default. If not provided, will show enough weeks to display the current\n * month, between 4 and 6 depending\n * @default undefined\n */\n weeksToShow?: number;\n\n /**\n * If set the Calendar will not allow navigation to or selection of a date earlier than this value.\n */\n minDate?: Date;\n\n /**\n * If set the Calendar will not allow navigation to or selection of a date later than this value.\n */\n maxDate?: Date;\n\n /**\n * If set the Calendar will not allow selection of dates in this array.\n */\n restrictedDates?: Date[];\n\n /**\n * The days that are selectable when `dateRangeType` is WorkWeek.\n * If `dateRangeType` is not WorkWeek this property does nothing.\n * @default [Monday,Tuesday,Wednesday,Thursday,Friday]\n */\n workWeekDays?: DayOfWeek[];\n\n /**\n * Whether the close button should be shown or not\n * @default false\n */\n showCloseButton?: boolean;\n\n /**\n * Allows all dates and buttons to be focused, including disabled ones\n * @default false\n */\n allFocusable?: boolean;\n\n /**\n * Label string for the grid\n */\n gridLabel?: string;\n\n /**\n * The ID of the control that labels this one\n */\n labelledBy?: string;\n\n /**\n * Whether to show days outside the selected month with lighter styles\n * @default true\n */\n lightenDaysOutsideNavigatedMonth?: boolean;\n\n /**\n * The cardinal directions for animation to occur during transitions, either horizontal or veritcal\n */\n animationDirection?: AnimationDirection;\n\n /**\n * Optional callback function to mark specific days with a small symbol. Fires when the date range changes,\n * gives the starting and ending displayed dates and expects the list of which days in between should be\n * marked.\n */\n getMarkedDays?: (startingDate: Date, endingDate: Date) => Date[];\n}\n\n/**\n * @internal\n */\nexport interface CalendarDayGridStyleProps {\n /**\n * Accept custom classNames\n */\n className?: string;\n\n /**\n * The date range type\n */\n dateRangeType?: DateRangeType;\n\n /**\n * Whether week numbers are being shown\n */\n showWeekNumbers?: boolean;\n\n /**\n * Whether to show days outside the selected month with lighter styles\n */\n lightenDaysOutsideNavigatedMonth?: boolean;\n\n /**\n * Whether grid entering animation should be forwards or backwards\n */\n animateBackwards?: boolean;\n\n /**\n * The cardinal directions for animation to occur during transitions, either horizontal or vertical\n */\n animationDirection?: AnimationDirection;\n}\n\n/**\n * @internal\n */\nexport interface CalendarDayGridStyles {\n /**\n * The style for the root div\n */\n wrapper?: string;\n\n /**\n * The style for the table containing the grid\n */\n table?: string;\n\n /**\n * The style to apply to the grid cells for days\n */\n dayCell?: string;\n\n /**\n * The style to apply to grid cells for days in the selected range\n */\n daySelected?: string;\n\n /**\n * The classname applied when a single day is selected\n */\n daySingleSelected?: string;\n\n /**\n * The style to apply to row around weeks\n */\n weekRow?: string;\n\n /**\n * The style to apply to the column headers above the weeks\n */\n weekDayLabelCell?: string;\n\n /**\n * The style to apply to grid cells for week numbers\n */\n weekNumberCell?: string;\n\n /**\n * The style to apply to individual days that are outside the min/max date range\n */\n dayOutsideBounds?: string;\n\n /**\n * The style to apply to individual days that are outside the current month\n */\n dayOutsideNavigatedMonth?: string;\n\n /**\n * The style to apply to the button element within the day cells\n */\n dayButton?: string;\n\n /**\n * The style to apply to the individual button element that matches the \"today\" parameter\n */\n dayIsToday?: string;\n\n /**\n * The style applied to the first placeholder week used during transitions\n */\n firstTransitionWeek?: string;\n\n /**\n * The style applied to the last placeholder week used during transitions\n */\n lastTransitionWeek?: string;\n\n /**\n * The style applied to the marker on days to mark as important\n */\n dayMarker?: string;\n\n /**\n * The classname applied to the day \"today\" span\n */\n dayTodayMarker?: string;\n}\n"],"names":["React"],"mappings":"AAAA,YAAYA,WAAW,QAAQ"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/CalendarDayGrid/CalendarGridRow.tsx"],"sourcesContent":["import * as React from 'react';\nimport { getWeekNumbersInMonth } from '../../utils';\nimport { CalendarGridDayCell } from './CalendarGridDayCell';\nimport type { CalendarDayGridProps, CalendarDayGridStyles } from './CalendarDayGrid.types';\nimport type { DayInfo } from './CalendarDayGrid';\nimport type { WeekCorners } from './useWeekCornerStyles.styles';\n\n/**\n * @internal\n */\nexport interface CalendarGridRowProps extends CalendarDayGridProps {\n classNames: CalendarDayGridStyles;\n weeks: DayInfo[][];\n week: DayInfo[];\n weekIndex: number;\n weekCorners?: WeekCorners;\n ariaHidden?: boolean;\n rowClassName?: string;\n ariaRole?: string;\n navigatedDayRef: React.MutableRefObject<HTMLTableCellElement>;\n activeDescendantId: string;\n calculateRoundedStyles(above: boolean, below: boolean, left: boolean, right: boolean): string;\n getDayInfosInRangeOfDay(dayToCompare: DayInfo): DayInfo[];\n getRefsFromDayInfos(dayInfosInRange: DayInfo[]): (HTMLElement | null)[];\n}\n\n/**\n * @internal\n */\nexport const CalendarGridRow: React.FunctionComponent<CalendarGridRowProps> = props => {\n const {\n ariaHidden,\n classNames,\n week,\n weeks,\n weekIndex,\n rowClassName,\n ariaRole,\n showWeekNumbers,\n firstDayOfWeek,\n firstWeekOfYear,\n navigatedDate,\n strings,\n } = props;\n const weekNumbers = showWeekNumbers\n ? getWeekNumbersInMonth(weeks!.length, firstDayOfWeek, firstWeekOfYear, navigatedDate)\n : null;\n\n const titleString = weekNumbers\n ? strings.weekNumberFormatString && strings.weekNumberFormatString.replace('{0}', `${weekNumbers[weekIndex]}`)\n : '';\n\n return (\n <tr role={ariaRole} aria-hidden={ariaHidden} className={rowClassName} key={weekIndex + '_' + week[0].key}>\n {showWeekNumbers && weekNumbers && (\n <th\n className={classNames.weekNumberCell}\n key={weekIndex}\n title={titleString}\n aria-label={titleString}\n scope=\"row\"\n >\n <span>{weekNumbers[weekIndex]}</span>\n </th>\n )}\n {week.map((day: DayInfo, dayIndex: number) => (\n <CalendarGridDayCell {...props} key={day.key} day={day} dayIndex={dayIndex} />\n ))}\n </tr>\n );\n};\n"],"names":["React","getWeekNumbersInMonth","CalendarGridDayCell","CalendarGridRow","props","ariaHidden","classNames","week","weeks","weekIndex","rowClassName","ariaRole","showWeekNumbers","firstDayOfWeek","firstWeekOfYear","navigatedDate","strings","weekNumbers","length","titleString","weekNumberFormatString","replace","tr","role","aria-hidden","className","key","th","weekNumberCell","title","aria-label","scope","span","map","day","dayIndex"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,qBAAqB,QAAQ,cAAc;AACpD,SAASC,mBAAmB,QAAQ,wBAAwB;AAwB5D;;CAEC,GACD,OAAO,MAAMC,kBAAiEC,CAAAA;IAC5E,MAAM,EACJC,UAAU,EACVC,UAAU,EACVC,IAAI,EACJC,KAAK,EACLC,SAAS,EACTC,YAAY,EACZC,QAAQ,EACRC,eAAe,EACfC,cAAc,EACdC,eAAe,EACfC,aAAa,EACbC,OAAO,EACR,GAAGZ;IACJ,MAAMa,cAAcL,kBAChBX,sBAAsBO,MAAOU,MAAM,EAAEL,gBAAgBC,iBAAiBC,iBACtE;IAEJ,MAAMI,cAAcF,cAChBD,QAAQI,sBAAsB,IAAIJ,QAAQI,sBAAsB,CAACC,OAAO,CAAC,OAAO,GAAGJ,WAAW,CAACR,UAAU,EAAE,IAC3G;IAEJ,qBACE,oBAACa;QAAGC,MAAMZ;QAAUa,eAAanB;QAAYoB,WAAWf;QAAcgB,KAAKjB,YAAY,MAAMF,IAAI,CAAC,EAAE,CAACmB,GAAG;OACrGd,mBAAmBK,6BAClB,oBAACU;QACCF,WAAWnB,WAAWsB,cAAc;QACpCF,KAAKjB;QACLoB,OAAOV;QACPW,cAAYX;QACZY,OAAM;qBAEN,oBAACC,cAAMf,WAAW,CAACR,UAAU,IAGhCF,KAAK0B,GAAG,CAAC,CAACC,KAAcC,yBACvB,oBAACjC;YAAqB,GAAGE,KAAK;YAAEsB,KAAKQ,IAAIR,GAAG;YAAEQ,KAAKA;YAAKC,UAAUA;;AAI1E,EAAE"}
1
+ {"version":3,"sources":["../src/components/CalendarDayGrid/CalendarGridRow.tsx"],"sourcesContent":["import * as React from 'react';\nimport { getWeekNumbersInMonth } from '../../utils';\nimport { CalendarGridDayCell } from './CalendarGridDayCell';\nimport type { CalendarDayGridProps, CalendarDayGridStyles } from './CalendarDayGrid.types';\nimport type { DayInfo } from './CalendarDayGrid';\nimport type { WeekCorners } from './useWeekCornerStyles.styles';\n\n/**\n * @internal\n */\nexport interface CalendarGridRowProps extends CalendarDayGridProps {\n classNames: CalendarDayGridStyles;\n weeks: DayInfo[][];\n week: DayInfo[];\n weekIndex: number;\n weekCorners?: WeekCorners;\n ariaHidden?: boolean;\n rowClassName?: string;\n ariaRole?: string;\n navigatedDayRef: React.MutableRefObject<HTMLTableCellElement | null>;\n activeDescendantId: string;\n calculateRoundedStyles(above: boolean, below: boolean, left: boolean, right: boolean): string;\n getDayInfosInRangeOfDay(dayToCompare: DayInfo): DayInfo[];\n getRefsFromDayInfos(dayInfosInRange: DayInfo[]): (HTMLElement | null)[];\n}\n\n/**\n * @internal\n */\nexport const CalendarGridRow: React.FunctionComponent<CalendarGridRowProps> = props => {\n const {\n ariaHidden,\n classNames,\n week,\n weeks,\n weekIndex,\n rowClassName,\n ariaRole,\n showWeekNumbers,\n firstDayOfWeek,\n firstWeekOfYear,\n navigatedDate,\n strings,\n } = props;\n const weekNumbers = showWeekNumbers\n ? getWeekNumbersInMonth(weeks!.length, firstDayOfWeek, firstWeekOfYear, navigatedDate)\n : null;\n\n const titleString = weekNumbers\n ? strings.weekNumberFormatString && strings.weekNumberFormatString.replace('{0}', `${weekNumbers[weekIndex]}`)\n : '';\n\n return (\n <tr role={ariaRole} aria-hidden={ariaHidden} className={rowClassName} key={weekIndex + '_' + week[0].key}>\n {showWeekNumbers && weekNumbers && (\n <th\n className={classNames.weekNumberCell}\n key={weekIndex}\n title={titleString}\n aria-label={titleString}\n scope=\"row\"\n >\n <span>{weekNumbers[weekIndex]}</span>\n </th>\n )}\n {week.map((day: DayInfo, dayIndex: number) => (\n <CalendarGridDayCell {...props} key={day.key} day={day} dayIndex={dayIndex} />\n ))}\n </tr>\n );\n};\n"],"names":["React","getWeekNumbersInMonth","CalendarGridDayCell","CalendarGridRow","props","ariaHidden","classNames","week","weeks","weekIndex","rowClassName","ariaRole","showWeekNumbers","firstDayOfWeek","firstWeekOfYear","navigatedDate","strings","weekNumbers","length","titleString","weekNumberFormatString","replace","tr","role","aria-hidden","className","key","th","weekNumberCell","title","aria-label","scope","span","map","day","dayIndex"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,qBAAqB,QAAQ,cAAc;AACpD,SAASC,mBAAmB,QAAQ,wBAAwB;AAwB5D;;CAEC,GACD,OAAO,MAAMC,kBAAiEC,CAAAA;IAC5E,MAAM,EACJC,UAAU,EACVC,UAAU,EACVC,IAAI,EACJC,KAAK,EACLC,SAAS,EACTC,YAAY,EACZC,QAAQ,EACRC,eAAe,EACfC,cAAc,EACdC,eAAe,EACfC,aAAa,EACbC,OAAO,EACR,GAAGZ;IACJ,MAAMa,cAAcL,kBAChBX,sBAAsBO,MAAOU,MAAM,EAAEL,gBAAgBC,iBAAiBC,iBACtE;IAEJ,MAAMI,cAAcF,cAChBD,QAAQI,sBAAsB,IAAIJ,QAAQI,sBAAsB,CAACC,OAAO,CAAC,OAAO,GAAGJ,WAAW,CAACR,UAAU,EAAE,IAC3G;IAEJ,qBACE,oBAACa;QAAGC,MAAMZ;QAAUa,eAAanB;QAAYoB,WAAWf;QAAcgB,KAAKjB,YAAY,MAAMF,IAAI,CAAC,EAAE,CAACmB,GAAG;OACrGd,mBAAmBK,6BAClB,oBAACU;QACCF,WAAWnB,WAAWsB,cAAc;QACpCF,KAAKjB;QACLoB,OAAOV;QACPW,cAAYX;QACZY,OAAM;qBAEN,oBAACC,cAAMf,WAAW,CAACR,UAAU,IAGhCF,KAAK0B,GAAG,CAAC,CAACC,KAAcC,yBACvB,oBAACjC;YAAqB,GAAGE,KAAK;YAAEsB,KAAKQ,IAAIR,GAAG;YAAEQ,KAAKA;YAAKC,UAAUA;;AAI1E,EAAE"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/CalendarDayGrid/useWeekCornerStyles.styles.ts"],"sourcesContent":["import { useFluent_unstable } from '@fluentui/react-shared-contexts';\nimport { mergeClasses } from '@griffel/react';\nimport { DateRangeType } from '../../utils/constants';\nimport { getDateRangeArray } from '../../utils/index';\nimport { DayInfo } from './CalendarDayGrid';\nimport { CalendarDayGridProps } from './CalendarDayGrid.types';\n\n/**\n * @internal\n */\nexport const weekCornersClassNames = {\n topRightCornerDate: 'fui-CalendarDayGrid__topRightCornerDate',\n topLeftCornerDate: 'fui-CalendarDayGrid__topLeftCornerDate',\n bottomRightCornerDate: 'fui-CalendarDayGrid__bottomRightCornerDate',\n bottomLeftCornerDate: 'fui-CalendarDayGrid__bottomLeftCornerDate',\n};\n\n/**\n * @internal\n */\nexport interface WeekCorners {\n [key: string]: string;\n}\n\n/**\n * @internal\n */\nexport function useWeekCornerStyles(props: CalendarDayGridProps) {\n const { dir } = useFluent_unstable();\n\n /**\n *\n * Section for setting the rounded corner styles on individual day cells. Individual day cells need different\n * corners to be rounded depending on which date range type and where the cell is located in the current grid.\n * If we just round all of the corners, there isn't a good overlap and we get gaps between contiguous day boxes\n * in Edge browser.\n *\n */\n const getWeekCornerStyles = (initialWeeks: DayInfo[][]): WeekCorners => {\n const weekCornersStyled: { [key: string]: string } = {};\n /* need to handle setting all of the corners on arbitrarily shaped blobs\n __\n __|A |\n |B |C |__\n |D |E |F |\n\n in this case, A needs top left rounded, top right rounded\n B needs top left rounded\n C doesn't need any rounding\n D needs bottom left rounded\n E doesn't need any rounding\n F needs top right rounding\n */\n\n // cut off the animation transition weeks\n const weeks = initialWeeks.slice(1, initialWeeks.length - 1);\n\n // if there's an item above, lose both top corners. Item below, lose both bottom corners, etc.\n weeks.forEach((week: DayInfo[], weekIndex: number) => {\n week.forEach((day: DayInfo, dayIndex: number) => {\n const above =\n weeks[weekIndex - 1] &&\n weeks[weekIndex - 1][dayIndex] &&\n isInSameHoverRange(\n weeks[weekIndex - 1][dayIndex].originalDate,\n day.originalDate,\n weeks[weekIndex - 1][dayIndex].isSelected,\n day.isSelected,\n );\n const below =\n weeks[weekIndex + 1] &&\n weeks[weekIndex + 1][dayIndex] &&\n isInSameHoverRange(\n weeks[weekIndex + 1][dayIndex].originalDate,\n day.originalDate,\n weeks[weekIndex + 1][dayIndex].isSelected,\n day.isSelected,\n );\n const left =\n weeks[weekIndex][dayIndex - 1] &&\n isInSameHoverRange(\n weeks[weekIndex][dayIndex - 1].originalDate,\n day.originalDate,\n weeks[weekIndex][dayIndex - 1].isSelected,\n day.isSelected,\n );\n const right =\n weeks[weekIndex][dayIndex + 1] &&\n isInSameHoverRange(\n weeks[weekIndex][dayIndex + 1].originalDate,\n day.originalDate,\n weeks[weekIndex][dayIndex + 1].isSelected,\n day.isSelected,\n );\n\n weekCornersStyled[weekIndex + '_' + dayIndex] = calculateRoundedStyles(above, below, left, right);\n });\n });\n\n return weekCornersStyled;\n };\n\n const calculateRoundedStyles = (above: boolean, below: boolean, left: boolean, right: boolean): string => {\n const style = [];\n const roundedTopLeft = !above && !left;\n const roundedTopRight = !above && !right;\n const roundedBottomLeft = !below && !left;\n const roundedBottomRight = !below && !right;\n\n if (roundedTopLeft) {\n style.push(dir === 'rtl' ? weekCornersClassNames.topRightCornerDate : weekCornersClassNames.topLeftCornerDate);\n }\n if (roundedTopRight) {\n style.push(dir === 'rtl' ? weekCornersClassNames.topLeftCornerDate : weekCornersClassNames.topRightCornerDate);\n }\n if (roundedBottomLeft) {\n style.push(\n dir === 'rtl' ? weekCornersClassNames.bottomRightCornerDate : weekCornersClassNames.bottomLeftCornerDate,\n );\n }\n if (roundedBottomRight) {\n style.push(\n dir === 'rtl' ? weekCornersClassNames.bottomLeftCornerDate : weekCornersClassNames.bottomRightCornerDate,\n );\n }\n\n return mergeClasses(...style);\n };\n\n const isInSameHoverRange = (date1: Date, date2: Date, date1Selected: boolean, date2Selected: boolean): boolean => {\n const { dateRangeType, firstDayOfWeek, workWeekDays } = props;\n\n // The hover state looks weird with non-contiguous days in work week view. In work week, show week hover state\n const dateRangeHoverType = dateRangeType === DateRangeType.WorkWeek ? DateRangeType.Week : dateRangeType;\n\n // we do not pass daysToSelectInDayView because we handle setting those styles dyanamically in onMouseOver\n const dateRange = getDateRangeArray(date1, dateRangeHoverType, firstDayOfWeek, workWeekDays);\n\n if (date1Selected !== date2Selected) {\n // if one is selected and the other is not, they can't be in the same range\n return false;\n } else if (date1Selected && date2Selected) {\n // if they're both selected at the same time they must be in the same range\n return true;\n }\n\n // otherwise, both must be unselected, so check the dateRange\n return dateRange.filter((date: Date) => date.getTime() === date2.getTime()).length > 0;\n };\n\n return [getWeekCornerStyles, calculateRoundedStyles] as const;\n}\n"],"names":["useFluent_unstable","mergeClasses","DateRangeType","getDateRangeArray","weekCornersClassNames","topRightCornerDate","topLeftCornerDate","bottomRightCornerDate","bottomLeftCornerDate","useWeekCornerStyles","props","dir","getWeekCornerStyles","initialWeeks","weekCornersStyled","weeks","slice","length","forEach","week","weekIndex","day","dayIndex","above","isInSameHoverRange","originalDate","isSelected","below","left","right","calculateRoundedStyles","style","roundedTopLeft","roundedTopRight","roundedBottomLeft","roundedBottomRight","push","date1","date2","date1Selected","date2Selected","dateRangeType","firstDayOfWeek","workWeekDays","dateRangeHoverType","WorkWeek","Week","dateRange","filter","date","getTime"],"mappings":"AAAA,SAASA,kBAAkB,QAAQ,kCAAkC;AACrE,SAASC,YAAY,QAAQ,iBAAiB;AAC9C,SAASC,aAAa,QAAQ,wBAAwB;AACtD,SAASC,iBAAiB,QAAQ,oBAAoB;AAItD;;CAEC,GACD,OAAO,MAAMC,wBAAwB;IACnCC,oBAAoB;IACpBC,mBAAmB;IACnBC,uBAAuB;IACvBC,sBAAsB;AACxB,EAAE;AASF;;CAEC,GACD,OAAO,SAASC,oBAAoBC,KAA2B;IAC7D,MAAM,EAAEC,GAAG,EAAE,GAAGX;IAEhB;;;;;;;GAOC,GACD,MAAMY,sBAAsB,CAACC;QAC3B,MAAMC,oBAA+C,CAAC;QACtD;;;;;;;;;;;;IAYA,GAEA,yCAAyC;QACzC,MAAMC,QAAQF,aAAaG,KAAK,CAAC,GAAGH,aAAaI,MAAM,GAAG;QAE1D,8FAA8F;QAC9FF,MAAMG,OAAO,CAAC,CAACC,MAAiBC;YAC9BD,KAAKD,OAAO,CAAC,CAACG,KAAcC;gBAC1B,MAAMC,QACJR,KAAK,CAACK,YAAY,EAAE,IACpBL,KAAK,CAACK,YAAY,EAAE,CAACE,SAAS,IAC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CAACzB,QAAQ,QAAQP,sBAAsBC,kBAAkB,GAAGD,sBAAsBE,iBAAiB;QAC/G;QACA,IAAI2B,iBAAiB;YACnBF,MAAMK,IAAI,CAACzB,QAAQ,QAAQP,sBAAsBE,iBAAiB,GAAGF,sBAAsBC,kBAAkB;QAC/G;QACA,IAAI6B,mBAAmB;YACrBH,MAAMK,IAAI,CACRzB,QAAQ,QAAQP,sBAAsBG,qBAAqB,GAAGH,sBAAsBI,oBAAoB;QAE5G;QACA,IAAI2B,oBAAoB;YACtBJ,MAAMK,IAAI,CACRzB,QAAQ,QAAQP,sBAAsBI,oBAAoB,GAAGJ,sBAAsBG,qBAAqB;QAE5G;QAEA,OAAON,gBAAgB8B;IACzB;IAEA,MAAMP,qBAAqB,CAACa,OAAaC,OAAaC,eAAwBC;QAC5E,MAAM,EAAEC,aAAa,EAAEC,cAAc,EAAEC,YAAY,EAAE,GAAGjC;QAExD,8GAA8G;QAC9G,MAAMkC,qBAAqBH,kBAAkBvC,cAAc2C,QAAQ,GAAG3C,cAAc4C,IAAI,GAAGL;QAE3F,0GAA0G;QAC1G,MAAMM,YAAY5C,kBAAkBkC,OAAOO,oBAAoBF,gBAAgBC;QAE/E,IAAIJ,kBAAkBC,eAAe;YACnC,2EAA2E;YAC3E,OAAO;QACT,OAAO,IAAID,iBAAiBC,eAAe;YACzC,2EAA2E;YAC3E,OAAO;QACT;QAEA,6DAA6D;QAC7D,OAAOO,UAAUC,MAAM,CAAC,CAACC,OAAeA,KAAKC,OAAO,OAAOZ,MAAMY,OAAO,IAAIjC,MAAM,GAAG;IACvF;IAEA,OAAO;QAACL;QAAqBkB;KAAuB;AACtD"}
1
+ {"version":3,"sources":["../src/components/CalendarDayGrid/useWeekCornerStyles.styles.ts"],"sourcesContent":["import { useFluent_unstable } from '@fluentui/react-shared-contexts';\nimport { mergeClasses } from '@griffel/react';\nimport { DateRangeType } from '../../utils/constants';\nimport { getDateRangeArray } from '../../utils/index';\nimport { DayInfo } from './CalendarDayGrid';\nimport { CalendarDayGridProps } from './CalendarDayGrid.types';\n\n/**\n * @internal\n */\nexport const weekCornersClassNames = {\n topRightCornerDate: 'fui-CalendarDayGrid__topRightCornerDate',\n topLeftCornerDate: 'fui-CalendarDayGrid__topLeftCornerDate',\n bottomRightCornerDate: 'fui-CalendarDayGrid__bottomRightCornerDate',\n bottomLeftCornerDate: 'fui-CalendarDayGrid__bottomLeftCornerDate',\n};\n\n/**\n * @internal\n */\nexport interface WeekCorners {\n [key: string]: string;\n}\n\n/**\n * @internal\n */\nexport function useWeekCornerStyles(\n props: CalendarDayGridProps,\n): readonly [\n (initialWeeks: DayInfo[][]) => WeekCorners,\n (above: boolean, below: boolean, left: boolean, right: boolean) => string,\n] {\n const { dir } = useFluent_unstable();\n\n /**\n *\n * Section for setting the rounded corner styles on individual day cells. Individual day cells need different\n * corners to be rounded depending on which date range type and where the cell is located in the current grid.\n * If we just round all of the corners, there isn't a good overlap and we get gaps between contiguous day boxes\n * in Edge browser.\n *\n */\n const getWeekCornerStyles = (initialWeeks: DayInfo[][]): WeekCorners => {\n const weekCornersStyled: { [key: string]: string } = {};\n /* need to handle setting all of the corners on arbitrarily shaped blobs\n __\n __|A |\n |B |C |__\n |D |E |F |\n\n in this case, A needs top left rounded, top right rounded\n B needs top left rounded\n C doesn't need any rounding\n D needs bottom left rounded\n E doesn't need any rounding\n F needs top right rounding\n */\n\n // cut off the animation transition weeks\n const weeks = initialWeeks.slice(1, initialWeeks.length - 1);\n\n // if there's an item above, lose both top corners. Item below, lose both bottom corners, etc.\n weeks.forEach((week: DayInfo[], weekIndex: number) => {\n week.forEach((day: DayInfo, dayIndex: number) => {\n const above =\n weeks[weekIndex - 1] &&\n weeks[weekIndex - 1][dayIndex] &&\n isInSameHoverRange(\n weeks[weekIndex - 1][dayIndex].originalDate,\n day.originalDate,\n weeks[weekIndex - 1][dayIndex].isSelected,\n day.isSelected,\n );\n const below =\n weeks[weekIndex + 1] &&\n weeks[weekIndex + 1][dayIndex] &&\n isInSameHoverRange(\n weeks[weekIndex + 1][dayIndex].originalDate,\n day.originalDate,\n weeks[weekIndex + 1][dayIndex].isSelected,\n day.isSelected,\n );\n const left =\n weeks[weekIndex][dayIndex - 1] &&\n isInSameHoverRange(\n weeks[weekIndex][dayIndex - 1].originalDate,\n day.originalDate,\n weeks[weekIndex][dayIndex - 1].isSelected,\n day.isSelected,\n );\n const right =\n weeks[weekIndex][dayIndex + 1] &&\n isInSameHoverRange(\n weeks[weekIndex][dayIndex + 1].originalDate,\n day.originalDate,\n weeks[weekIndex][dayIndex + 1].isSelected,\n day.isSelected,\n );\n\n weekCornersStyled[weekIndex + '_' + dayIndex] = calculateRoundedStyles(above, below, left, right);\n });\n });\n\n return weekCornersStyled;\n };\n\n const calculateRoundedStyles = (above: boolean, below: boolean, left: boolean, right: boolean): string => {\n const style = [];\n const roundedTopLeft = !above && !left;\n const roundedTopRight = !above && !right;\n const roundedBottomLeft = !below && !left;\n const roundedBottomRight = !below && !right;\n\n if (roundedTopLeft) {\n style.push(dir === 'rtl' ? weekCornersClassNames.topRightCornerDate : weekCornersClassNames.topLeftCornerDate);\n }\n if (roundedTopRight) {\n style.push(dir === 'rtl' ? weekCornersClassNames.topLeftCornerDate : weekCornersClassNames.topRightCornerDate);\n }\n if (roundedBottomLeft) {\n style.push(\n dir === 'rtl' ? weekCornersClassNames.bottomRightCornerDate : weekCornersClassNames.bottomLeftCornerDate,\n );\n }\n if (roundedBottomRight) {\n style.push(\n dir === 'rtl' ? weekCornersClassNames.bottomLeftCornerDate : weekCornersClassNames.bottomRightCornerDate,\n );\n }\n\n return mergeClasses(...style);\n };\n\n const isInSameHoverRange = (date1: Date, date2: Date, date1Selected: boolean, date2Selected: boolean): boolean => {\n const { dateRangeType, firstDayOfWeek, workWeekDays } = props;\n\n // The hover state looks weird with non-contiguous days in work week view. In work week, show week hover state\n const dateRangeHoverType = dateRangeType === DateRangeType.WorkWeek ? DateRangeType.Week : dateRangeType;\n\n // we do not pass daysToSelectInDayView because we handle setting those styles dyanamically in onMouseOver\n const dateRange = getDateRangeArray(date1, dateRangeHoverType, firstDayOfWeek, workWeekDays);\n\n if (date1Selected !== date2Selected) {\n // if one is selected and the other is not, they can't be in the same range\n return false;\n } else if (date1Selected && date2Selected) {\n // if they're both selected at the same time they must be in the same range\n return true;\n }\n\n // otherwise, both must be unselected, so check the dateRange\n return dateRange.filter((date: Date) => date.getTime() === date2.getTime()).length > 0;\n };\n\n return [getWeekCornerStyles, calculateRoundedStyles] as const;\n}\n"],"names":["useFluent_unstable","mergeClasses","DateRangeType","getDateRangeArray","weekCornersClassNames","topRightCornerDate","topLeftCornerDate","bottomRightCornerDate","bottomLeftCornerDate","useWeekCornerStyles","props","dir","getWeekCornerStyles","initialWeeks","weekCornersStyled","weeks","slice","length","forEach","week","weekIndex","day","dayIndex","above","isInSameHoverRange","originalDate","isSelected","below","left","right","calculateRoundedStyles","style","roundedTopLeft","roundedTopRight","roundedBottomLeft","roundedBottomRight","push","date1","date2","date1Selected","date2Selected","dateRangeType","firstDayOfWeek","workWeekDays","dateRangeHoverType","WorkWeek","Week","dateRange","filter","date","getTime"],"mappings":"AAAA,SAASA,kBAAkB,QAAQ,kCAAkC;AACrE,SAASC,YAAY,QAAQ,iBAAiB;AAC9C,SAASC,aAAa,QAAQ,wBAAwB;AACtD,SAASC,iBAAiB,QAAQ,oBAAoB;AAItD;;CAEC,GACD,OAAO,MAAMC,wBAAwB;IACnCC,oBAAoB;IACpBC,mBAAmB;IACnBC,uBAAuB;IACvBC,sBAAsB;AACxB,EAAE;AASF;;CAEC,GACD,OAAO,SAASC,oBACdC,KAA2B;IAK3B,MAAM,EAAEC,GAAG,EAAE,GAAGX;IAEhB;;;;;;;GAOC,GACD,MAAMY,sBAAsB,CAACC;QAC3B,MAAMC,oBAA+C,CAAC;QACtD;;;;;;;;;;;;IAYA,GAEA,yCAAyC;QACzC,MAAMC,QAAQF,aAAaG,KAAK,CAAC,GAAGH,aAAaI,MAAM,GAAG;QAE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 import { useCalendarMonthStyles_unstable } from './useCalendarMonthStyles.styles
8
8
  const MONTHS_PER_ROW = 4;
9
9
  function useAnimateBackwards({ navigatedDate }) {
10
10
  const currentYear = navigatedDate.getFullYear();
11
- const previousYearRef = React.useRef();
11
+ const previousYearRef = React.useRef(undefined);
12
12
  React.useEffect(()=>{
13
13
  previousYearRef.current = currentYear;
14
14
  });
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/CalendarMonth/CalendarMonth.tsx"],"sourcesContent":["import * as React from 'react';\nimport { Enter } from '@fluentui/keyboard-keys';\nimport { useArrowNavigationGroup } from '@fluentui/react-tabster';\nimport { mergeClasses } from '@griffel/react';\nimport {\n addYears,\n compareDatePart,\n getMonthEnd,\n getMonthStart,\n getYearEnd,\n getYearStart,\n setMonth,\n DEFAULT_DATE_FORMATTING,\n} from '../../utils';\nimport { CalendarYear } from '../CalendarYear/CalendarYear';\nimport { useCalendarMonthStyles_unstable } from './useCalendarMonthStyles.styles';\nimport type { CalendarMonthProps } from './CalendarMonth.types';\nimport type { CalendarYearRange, ICalendarYear } from '../CalendarYear/CalendarYear.types';\n\nconst MONTHS_PER_ROW = 4;\n\nfunction useAnimateBackwards({ navigatedDate }: { navigatedDate: CalendarMonthProps['navigatedDate'] }) {\n const currentYear = navigatedDate.getFullYear();\n\n const previousYearRef = React.useRef<number | undefined>();\n React.useEffect(() => {\n previousYearRef.current = currentYear;\n });\n const previousYear = previousYearRef.current;\n\n if (previousYear === undefined || previousYear === currentYear) {\n return undefined;\n } else {\n return previousYear > currentYear;\n }\n}\n\nfunction useFocusLogic({ componentRef }: { componentRef: CalendarMonthProps['componentRef'] }) {\n const navigatedMonthRef = React.useRef<HTMLButtonElement>(null);\n const calendarYearRef = React.useRef<ICalendarYear>(null);\n const focusOnUpdate = React.useRef(false);\n\n const focus = React.useCallback(() => {\n if (calendarYearRef.current) {\n calendarYearRef.current.focus();\n } else if (navigatedMonthRef.current) {\n navigatedMonthRef.current.focus();\n }\n }, []);\n\n React.useImperativeHandle(componentRef, () => ({ focus }), [focus]);\n\n React.useEffect(() => {\n if (focusOnUpdate.current) {\n focus();\n focusOnUpdate.current = false;\n }\n });\n\n const focusOnNextUpdate = () => {\n focusOnUpdate.current = true;\n };\n\n return [navigatedMonthRef, calendarYearRef, focusOnNextUpdate] as const;\n}\n\n/**\n * @internal\n */\nexport const CalendarMonth: React.FunctionComponent<CalendarMonthProps> = props => {\n const {\n allFocusable,\n animationDirection,\n className,\n componentRef,\n dateTimeFormatter = DEFAULT_DATE_FORMATTING,\n highlightCurrentMonth,\n highlightSelectedMonth,\n maxDate,\n minDate,\n navigatedDate,\n navigationIcons,\n onHeaderSelect: onUserHeaderSelect,\n onNavigateDate,\n selectedDate,\n strings,\n today = new Date(),\n yearPickerHidden = false,\n } = props;\n\n const [navigatedMonthRef, calendarYearRef, focusOnNextUpdate] = useFocusLogic({ componentRef });\n const [isYearPickerVisible, setIsYearPickerVisible] = React.useState(false);\n\n const animateBackwards = useAnimateBackwards({ navigatedDate });\n\n const selectMonthCallback = (newMonth: number): (() => void) => {\n return () => onSelectMonth(newMonth);\n };\n\n const onSelectNextYear = (): void => {\n onNavigateDate(addYears(navigatedDate, 1), false);\n };\n\n const onSelectPrevYear = (): void => {\n onNavigateDate(addYears(navigatedDate, -1), false);\n };\n\n const onSelectMonth = (newMonth: number): void => {\n // If header is clickable the calendars are overlayed, switch back to day picker when month is clicked\n onUserHeaderSelect?.();\n onNavigateDate(setMonth(navigatedDate, newMonth), true);\n };\n\n const onHeaderSelect = (): void => {\n if (!yearPickerHidden) {\n focusOnNextUpdate();\n setIsYearPickerVisible(true);\n } else {\n onUserHeaderSelect?.();\n }\n };\n\n const onSelectYear = (selectedYear: number) => {\n focusOnNextUpdate();\n const navYear = navigatedDate.getFullYear();\n if (navYear !== selectedYear) {\n let newNavigationDate = new Date(navigatedDate.getTime());\n newNavigationDate.setFullYear(selectedYear);\n // for min and max dates, adjust the new navigation date - perhaps this should be\n // checked on the master navigation date handler (i.e. in Calendar)\n if (maxDate && newNavigationDate > maxDate) {\n newNavigationDate = setMonth(newNavigationDate, maxDate.getMonth());\n } else if (minDate && newNavigationDate < minDate) {\n newNavigationDate = setMonth(newNavigationDate, minDate.getMonth());\n }\n onNavigateDate(newNavigationDate, true);\n }\n setIsYearPickerVisible(false);\n };\n\n const onYearPickerHeaderSelect = (focus: boolean): void => {\n focusOnNextUpdate();\n setIsYearPickerVisible(false);\n };\n\n const dateFormatter = dateTimeFormatter!;\n\n // determine if previous/next years are in bounds\n const isPrevYearInBounds = minDate ? compareDatePart(minDate, getYearStart(navigatedDate)) < 0 : true;\n const isNextYearInBounds = maxDate ? compareDatePart(getYearEnd(navigatedDate), maxDate) < 0 : true;\n\n const classNames = useCalendarMonthStyles_unstable({\n className,\n hasHeaderClickCallback: !!onUserHeaderSelect || !yearPickerHidden,\n highlightCurrent: highlightCurrentMonth,\n highlightSelected: highlightSelectedMonth,\n animateBackwards,\n animationDirection,\n });\n\n const arrowNavigationAttributes = useArrowNavigationGroup({ axis: 'grid' });\n\n if (isYearPickerVisible) {\n const [onRenderYear, yearStrings] = getYearStrings({ dateTimeFormatter, navigatedDate, strings });\n // use navigated date for the year picker\n return (\n <CalendarYear\n key={'calendarYear'}\n minYear={minDate ? minDate.getFullYear() : undefined}\n maxYear={maxDate ? maxDate.getFullYear() : undefined}\n // eslint-disable-next-line react/jsx-no-bind\n onSelectYear={onSelectYear}\n // eslint-disable-next-line react/jsx-no-bind\n onHeaderSelect={onYearPickerHeaderSelect}\n selectedYear={\n selectedDate ? selectedDate.getFullYear() : navigatedDate ? navigatedDate.getFullYear() : undefined\n }\n navigatedYear={navigatedDate.getFullYear()}\n navigationIcons={navigationIcons}\n onRenderYear={onRenderYear}\n strings={yearStrings}\n componentRef={calendarYearRef}\n highlightCurrentYear={highlightCurrentMonth}\n highlightSelectedYear={highlightSelectedMonth}\n animationDirection={animationDirection}\n />\n );\n }\n\n const rowIndexes = [];\n for (let i = 0; i < strings.shortMonths.length / MONTHS_PER_ROW; i++) {\n rowIndexes.push(i);\n }\n\n const yearString = dateFormatter.formatYear(navigatedDate);\n const headerAriaLabel = strings.monthPickerHeaderAriaLabel\n ? strings.monthPickerHeaderAriaLabel.replace('{0}', yearString)\n : yearString;\n\n return (\n <div className={classNames.root}>\n <div className={classNames.headerContainer}>\n <button\n className={classNames.currentItemButton}\n onClick={onHeaderSelect}\n onKeyDown={onButtonKeyDown(onHeaderSelect)}\n aria-label={headerAriaLabel}\n tabIndex={!!onUserHeaderSelect || !yearPickerHidden ? 0 : -1}\n type=\"button\"\n >\n <span aria-live=\"polite\" aria-atomic=\"true\">\n {yearString}\n </span>\n </button>\n <div className={classNames.navigationButtonsContainer}>\n <button\n className={mergeClasses(classNames.navigationButton, !isPrevYearInBounds && classNames.disabled)}\n aria-disabled={!isPrevYearInBounds}\n tabIndex={isPrevYearInBounds ? undefined : allFocusable ? 0 : -1}\n onClick={isPrevYearInBounds ? onSelectPrevYear : undefined}\n onKeyDown={isPrevYearInBounds ? onButtonKeyDown(onSelectPrevYear) : undefined}\n title={\n strings.prevYearAriaLabel\n ? strings.prevYearAriaLabel + ' ' + dateFormatter.formatYear(addYears(navigatedDate, -1))\n : undefined\n }\n type=\"button\"\n >\n {navigationIcons.upNavigation}\n </button>\n <button\n className={mergeClasses(classNames.navigationButton, !isNextYearInBounds && classNames.disabled)}\n aria-disabled={!isNextYearInBounds}\n tabIndex={isNextYearInBounds ? undefined : allFocusable ? 0 : -1}\n onClick={isNextYearInBounds ? onSelectNextYear : undefined}\n onKeyDown={isNextYearInBounds ? onButtonKeyDown(onSelectNextYear) : undefined}\n title={\n strings.nextYearAriaLabel\n ? strings.nextYearAriaLabel + ' ' + dateFormatter.formatYear(addYears(navigatedDate, 1))\n : undefined\n }\n type=\"button\"\n >\n {navigationIcons.downNavigation}\n </button>\n </div>\n </div>\n <div {...arrowNavigationAttributes} className={classNames.gridContainer} role=\"grid\" aria-label={yearString}>\n {rowIndexes.map((rowNum: number) => {\n const monthsForRow = strings!.shortMonths.slice(rowNum * MONTHS_PER_ROW, (rowNum + 1) * MONTHS_PER_ROW);\n return (\n <div key={'monthRow_' + rowNum + navigatedDate.getFullYear()} role=\"row\" className={classNames.buttonRow}>\n {monthsForRow.map((month: string, index: number) => {\n const monthIndex = rowNum * MONTHS_PER_ROW + index;\n const indexedMonth = setMonth(navigatedDate, monthIndex);\n const isNavigatedMonth = navigatedDate.getMonth() === monthIndex;\n const isSelectedMonth = selectedDate.getMonth() === monthIndex;\n const isSelectedYear = selectedDate.getFullYear() === navigatedDate.getFullYear();\n const isInBounds =\n (minDate ? compareDatePart(minDate, getMonthEnd(indexedMonth)) < 1 : true) &&\n (maxDate ? compareDatePart(getMonthStart(indexedMonth), maxDate) < 1 : true);\n\n return (\n <button\n ref={isNavigatedMonth ? navigatedMonthRef : undefined}\n role={'gridcell'}\n className={mergeClasses(\n classNames.itemButton,\n highlightCurrentMonth &&\n isCurrentMonth(monthIndex, navigatedDate.getFullYear(), today) &&\n classNames.current,\n highlightSelectedMonth && isSelectedMonth && isSelectedYear && classNames.selected,\n !isInBounds && classNames.disabled,\n )}\n disabled={!allFocusable && !isInBounds}\n key={monthIndex}\n onClick={isInBounds ? selectMonthCallback(monthIndex) : undefined}\n onKeyDown={isInBounds ? onButtonKeyDown(selectMonthCallback(monthIndex)) : undefined}\n aria-label={dateFormatter.formatMonth(indexedMonth, strings!)}\n aria-selected={isNavigatedMonth}\n tabIndex={isInBounds ? 0 : -1}\n type=\"button\"\n >\n {month}\n </button>\n );\n })}\n </div>\n );\n })}\n </div>\n </div>\n );\n};\nCalendarMonth.displayName = 'CalendarMonth';\n\nfunction getYearStrings({\n dateTimeFormatter,\n navigatedDate,\n strings,\n}: Pick<CalendarMonthProps, 'dateTimeFormatter' | 'navigatedDate' | 'strings'>) {\n const yearToString = (year: number) => {\n if (dateTimeFormatter) {\n // create a date based on the current nav date\n const yearFormattingDate = new Date(navigatedDate.getTime());\n yearFormattingDate.setFullYear(year);\n return dateTimeFormatter.formatYear(yearFormattingDate);\n }\n return String(year);\n };\n\n const yearRangeToString = (yearRange: CalendarYearRange) => {\n return `${yearToString(yearRange.fromYear)} - ${yearToString(yearRange.toYear)}`;\n };\n\n const yearRangeToNextDecadeLabel = (yearRange: CalendarYearRange) => {\n return strings.nextYearRangeAriaLabel ? `${strings.nextYearRangeAriaLabel} ${yearRangeToString(yearRange)}` : '';\n };\n\n const yearRangeToPrevDecadeLabel = (yearRange: CalendarYearRange) => {\n return strings.prevYearRangeAriaLabel ? `${strings.prevYearRangeAriaLabel} ${yearRangeToString(yearRange)}` : '';\n };\n\n return [\n yearToString,\n {\n rangeAriaLabel: yearRangeToString,\n prevRangeAriaLabel: yearRangeToPrevDecadeLabel,\n nextRangeAriaLabel: yearRangeToNextDecadeLabel,\n headerAriaLabelFormatString: strings.monthPickerHeaderAriaLabel,\n } as const,\n ] as const;\n}\n\nfunction isCurrentMonth(month: number, year: number, today: Date): boolean {\n return today.getFullYear() === year && today.getMonth() === month;\n}\n\nfunction onButtonKeyDown(callback: () => void): (ev: React.KeyboardEvent<HTMLButtonElement>) => void {\n return (ev: React.KeyboardEvent<HTMLButtonElement>) => {\n switch (ev.key) {\n case Enter:\n callback();\n break;\n }\n };\n}\n"],"names":["React","Enter","useArrowNavigationGroup","mergeClasses","addYears","compareDatePart","getMonthEnd","getMonthStart","getYearEnd","getYearStart","setMonth","DEFAULT_DATE_FORMATTING","CalendarYear","useCalendarMonthStyles_unstable","MONTHS_PER_ROW","useAnimateBackwards","navigatedDate","currentYear","getFullYear","previousYearRef","useRef","useEffect","current","previousYear","undefined","useFocusLogic","componentRef","navigatedMonthRef","calendarYearRef","focusOnUpdate","focus","useCallback","useImperativeHandle","focusOnNextUpdate","CalendarMonth","props","allFocusable","animationDirection","className","dateTimeFormatter","highlightCurrentMonth","highlightSelectedMonth","maxDate","minDate","navigationIcons","onHeaderSelect","onUserHeaderSelect","onNavigateDate","selectedDate","strings","today","Date","yearPickerHidden","isYearPickerVisible","setIsYearPickerVisible","useState","animateBackwards","selectMonthCallback","newMonth","onSelectMonth","onSelectNextYear","onSelectPrevYear","onSelectYear","selectedYear","navYear","newNavigationDate","getTime","setFullYear","getMonth","onYearPickerHeaderSelect","dateFormatter","isPrevYearInBounds","isNextYearInBounds","classNames","hasHeaderClickCallback","highlightCurrent","highlightSelected","arrowNavigationAttributes","axis","onRenderYear","yearStrings","getYearStrings","key","minYear","maxYear","navigatedYear","highlightCurrentYear","highlightSelectedYear","rowIndexes","i","shortMonths","length","push","yearString","formatYear","headerAriaLabel","monthPickerHeaderAriaLabel","replace","div","root","headerContainer","button","currentItemButton","onClick","onKeyDown","onButtonKeyDown","aria-label","tabIndex","type","span","aria-live","aria-atomic","navigationButtonsContainer","navigationButton","disabled","aria-disabled","title","prevYearAriaLabel","upNavigation","nextYearAriaLabel","downNavigation","gridContainer","role","map","rowNum","monthsForRow","slice","buttonRow","month","index","monthIndex","indexedMonth","isNavigatedMonth","isSelectedMonth","isSelectedYear","isInBounds","ref","itemButton","isCurrentMonth","selected","formatMonth","aria-selected","displayName","yearToString","year","yearFormattingDate","String","yearRangeToString","yearRange","fromYear","toYear","yearRangeToNextDecadeLabel","nextYearRangeAriaLabel","yearRangeToPrevDecadeLabel","prevYearRangeAriaLabel","rangeAriaLabel","prevRangeAriaLabel","nextRangeAriaLabel","headerAriaLabelFormatString","callback","ev"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,KAAK,QAAQ,0BAA0B;AAChD,SAASC,uBAAuB,QAAQ,0BAA0B;AAClE,SAASC,YAAY,QAAQ,iBAAiB;AAC9C,SACEC,QAAQ,EACRC,eAAe,EACfC,WAAW,EACXC,aAAa,EACbC,UAAU,EACVC,YAAY,EACZC,QAAQ,EACRC,uBAAuB,QAClB,cAAc;AACrB,SAASC,YAAY,QAAQ,+BAA+B;AAC5D,SAASC,+BAA+B,QAAQ,kCAAkC;AAIlF,MAAMC,iBAAiB;AAEvB,SAASC,oBAAoB,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components/CalendarMonth/CalendarMonth.tsx"],"sourcesContent":["import * as React from 'react';\nimport { Enter } from '@fluentui/keyboard-keys';\nimport { useArrowNavigationGroup } from '@fluentui/react-tabster';\nimport { mergeClasses } from '@griffel/react';\nimport {\n addYears,\n compareDatePart,\n getMonthEnd,\n getMonthStart,\n getYearEnd,\n getYearStart,\n setMonth,\n DEFAULT_DATE_FORMATTING,\n} from '../../utils';\nimport { CalendarYear } from '../CalendarYear/CalendarYear';\nimport { useCalendarMonthStyles_unstable } from './useCalendarMonthStyles.styles';\nimport type { CalendarMonthProps } from './CalendarMonth.types';\nimport type { CalendarYearRange, ICalendarYear } from '../CalendarYear/CalendarYear.types';\n\nconst MONTHS_PER_ROW = 4;\n\nfunction useAnimateBackwards({ navigatedDate }: { navigatedDate: CalendarMonthProps['navigatedDate'] }) {\n const currentYear = navigatedDate.getFullYear();\n\n const previousYearRef = React.useRef<number | undefined>(undefined);\n React.useEffect(() => {\n previousYearRef.current = currentYear;\n });\n const previousYear = previousYearRef.current;\n\n if (previousYear === undefined || previousYear === currentYear) {\n return undefined;\n } else {\n return previousYear > currentYear;\n }\n}\n\nfunction useFocusLogic({ componentRef }: { componentRef: CalendarMonthProps['componentRef'] }) {\n const navigatedMonthRef = React.useRef<HTMLButtonElement>(null);\n const calendarYearRef = React.useRef<ICalendarYear>(null);\n const focusOnUpdate = React.useRef(false);\n\n const focus = React.useCallback(() => {\n if (calendarYearRef.current) {\n calendarYearRef.current.focus();\n } else if (navigatedMonthRef.current) {\n navigatedMonthRef.current.focus();\n }\n }, []);\n\n React.useImperativeHandle(componentRef, () => ({ focus }), [focus]);\n\n React.useEffect(() => {\n if (focusOnUpdate.current) {\n focus();\n focusOnUpdate.current = false;\n }\n });\n\n const focusOnNextUpdate = () => {\n focusOnUpdate.current = true;\n };\n\n return [navigatedMonthRef, calendarYearRef, focusOnNextUpdate] as const;\n}\n\n/**\n * @internal\n */\nexport const CalendarMonth: React.FunctionComponent<CalendarMonthProps> = props => {\n const {\n allFocusable,\n animationDirection,\n className,\n componentRef,\n dateTimeFormatter = DEFAULT_DATE_FORMATTING,\n highlightCurrentMonth,\n highlightSelectedMonth,\n maxDate,\n minDate,\n navigatedDate,\n navigationIcons,\n onHeaderSelect: onUserHeaderSelect,\n onNavigateDate,\n selectedDate,\n strings,\n today = new Date(),\n yearPickerHidden = false,\n } = props;\n\n const [navigatedMonthRef, calendarYearRef, focusOnNextUpdate] = useFocusLogic({ componentRef });\n const [isYearPickerVisible, setIsYearPickerVisible] = React.useState(false);\n\n const animateBackwards = useAnimateBackwards({ navigatedDate });\n\n const selectMonthCallback = (newMonth: number): (() => void) => {\n return () => onSelectMonth(newMonth);\n };\n\n const onSelectNextYear = (): void => {\n onNavigateDate(addYears(navigatedDate, 1), false);\n };\n\n const onSelectPrevYear = (): void => {\n onNavigateDate(addYears(navigatedDate, -1), false);\n };\n\n const onSelectMonth = (newMonth: number): void => {\n // If header is clickable the calendars are overlayed, switch back to day picker when month is clicked\n onUserHeaderSelect?.();\n onNavigateDate(setMonth(navigatedDate, newMonth), true);\n };\n\n const onHeaderSelect = (): void => {\n if (!yearPickerHidden) {\n focusOnNextUpdate();\n setIsYearPickerVisible(true);\n } else {\n onUserHeaderSelect?.();\n }\n };\n\n const onSelectYear = (selectedYear: number) => {\n focusOnNextUpdate();\n const navYear = navigatedDate.getFullYear();\n if (navYear !== selectedYear) {\n let newNavigationDate = new Date(navigatedDate.getTime());\n newNavigationDate.setFullYear(selectedYear);\n // for min and max dates, adjust the new navigation date - perhaps this should be\n // checked on the master navigation date handler (i.e. in Calendar)\n if (maxDate && newNavigationDate > maxDate) {\n newNavigationDate = setMonth(newNavigationDate, maxDate.getMonth());\n } else if (minDate && newNavigationDate < minDate) {\n newNavigationDate = setMonth(newNavigationDate, minDate.getMonth());\n }\n onNavigateDate(newNavigationDate, true);\n }\n setIsYearPickerVisible(false);\n };\n\n const onYearPickerHeaderSelect = (focus: boolean): void => {\n focusOnNextUpdate();\n setIsYearPickerVisible(false);\n };\n\n const dateFormatter = dateTimeFormatter!;\n\n // determine if previous/next years are in bounds\n const isPrevYearInBounds = minDate ? compareDatePart(minDate, getYearStart(navigatedDate)) < 0 : true;\n const isNextYearInBounds = maxDate ? compareDatePart(getYearEnd(navigatedDate), maxDate) < 0 : true;\n\n const classNames = useCalendarMonthStyles_unstable({\n className,\n hasHeaderClickCallback: !!onUserHeaderSelect || !yearPickerHidden,\n highlightCurrent: highlightCurrentMonth,\n highlightSelected: highlightSelectedMonth,\n animateBackwards,\n animationDirection,\n });\n\n const arrowNavigationAttributes = useArrowNavigationGroup({ axis: 'grid' });\n\n if (isYearPickerVisible) {\n const [onRenderYear, yearStrings] = getYearStrings({ dateTimeFormatter, navigatedDate, strings });\n // use navigated date for the year picker\n return (\n <CalendarYear\n key={'calendarYear'}\n minYear={minDate ? minDate.getFullYear() : undefined}\n maxYear={maxDate ? maxDate.getFullYear() : undefined}\n // eslint-disable-next-line react/jsx-no-bind\n onSelectYear={onSelectYear}\n // eslint-disable-next-line react/jsx-no-bind\n onHeaderSelect={onYearPickerHeaderSelect}\n selectedYear={\n selectedDate ? selectedDate.getFullYear() : navigatedDate ? navigatedDate.getFullYear() : undefined\n }\n navigatedYear={navigatedDate.getFullYear()}\n navigationIcons={navigationIcons}\n onRenderYear={onRenderYear}\n strings={yearStrings}\n componentRef={calendarYearRef}\n highlightCurrentYear={highlightCurrentMonth}\n highlightSelectedYear={highlightSelectedMonth}\n animationDirection={animationDirection}\n />\n );\n }\n\n const rowIndexes = [];\n for (let i = 0; i < strings.shortMonths.length / MONTHS_PER_ROW; i++) {\n rowIndexes.push(i);\n }\n\n const yearString = dateFormatter.formatYear(navigatedDate);\n const headerAriaLabel = strings.monthPickerHeaderAriaLabel\n ? strings.monthPickerHeaderAriaLabel.replace('{0}', yearString)\n : yearString;\n\n return (\n <div className={classNames.root}>\n <div className={classNames.headerContainer}>\n <button\n className={classNames.currentItemButton}\n onClick={onHeaderSelect}\n onKeyDown={onButtonKeyDown(onHeaderSelect)}\n aria-label={headerAriaLabel}\n tabIndex={!!onUserHeaderSelect || !yearPickerHidden ? 0 : -1}\n type=\"button\"\n >\n <span aria-live=\"polite\" aria-atomic=\"true\">\n {yearString}\n </span>\n </button>\n <div className={classNames.navigationButtonsContainer}>\n <button\n className={mergeClasses(classNames.navigationButton, !isPrevYearInBounds && classNames.disabled)}\n aria-disabled={!isPrevYearInBounds}\n tabIndex={isPrevYearInBounds ? undefined : allFocusable ? 0 : -1}\n onClick={isPrevYearInBounds ? onSelectPrevYear : undefined}\n onKeyDown={isPrevYearInBounds ? onButtonKeyDown(onSelectPrevYear) : undefined}\n title={\n strings.prevYearAriaLabel\n ? strings.prevYearAriaLabel + ' ' + dateFormatter.formatYear(addYears(navigatedDate, -1))\n : undefined\n }\n type=\"button\"\n >\n {navigationIcons.upNavigation}\n </button>\n <button\n className={mergeClasses(classNames.navigationButton, !isNextYearInBounds && classNames.disabled)}\n aria-disabled={!isNextYearInBounds}\n tabIndex={isNextYearInBounds ? undefined : allFocusable ? 0 : -1}\n onClick={isNextYearInBounds ? onSelectNextYear : undefined}\n onKeyDown={isNextYearInBounds ? onButtonKeyDown(onSelectNextYear) : undefined}\n title={\n strings.nextYearAriaLabel\n ? strings.nextYearAriaLabel + ' ' + dateFormatter.formatYear(addYears(navigatedDate, 1))\n : undefined\n }\n type=\"button\"\n >\n {navigationIcons.downNavigation}\n </button>\n </div>\n </div>\n <div {...arrowNavigationAttributes} className={classNames.gridContainer} role=\"grid\" aria-label={yearString}>\n {rowIndexes.map((rowNum: number) => {\n const monthsForRow = strings!.shortMonths.slice(rowNum * MONTHS_PER_ROW, (rowNum + 1) * MONTHS_PER_ROW);\n return (\n <div key={'monthRow_' + rowNum + navigatedDate.getFullYear()} role=\"row\" className={classNames.buttonRow}>\n {monthsForRow.map((month: string, index: number) => {\n const monthIndex = rowNum * MONTHS_PER_ROW + index;\n const indexedMonth = setMonth(navigatedDate, monthIndex);\n const isNavigatedMonth = navigatedDate.getMonth() === monthIndex;\n const isSelectedMonth = selectedDate.getMonth() === monthIndex;\n const isSelectedYear = selectedDate.getFullYear() === navigatedDate.getFullYear();\n const isInBounds =\n (minDate ? compareDatePart(minDate, getMonthEnd(indexedMonth)) < 1 : true) &&\n (maxDate ? compareDatePart(getMonthStart(indexedMonth), maxDate) < 1 : true);\n\n return (\n <button\n ref={isNavigatedMonth ? navigatedMonthRef : undefined}\n role={'gridcell'}\n className={mergeClasses(\n classNames.itemButton,\n highlightCurrentMonth &&\n isCurrentMonth(monthIndex, navigatedDate.getFullYear(), today) &&\n classNames.current,\n highlightSelectedMonth && isSelectedMonth && isSelectedYear && classNames.selected,\n !isInBounds && classNames.disabled,\n )}\n disabled={!allFocusable && !isInBounds}\n key={monthIndex}\n onClick={isInBounds ? selectMonthCallback(monthIndex) : undefined}\n onKeyDown={isInBounds ? onButtonKeyDown(selectMonthCallback(monthIndex)) : undefined}\n aria-label={dateFormatter.formatMonth(indexedMonth, strings!)}\n aria-selected={isNavigatedMonth}\n tabIndex={isInBounds ? 0 : -1}\n type=\"button\"\n >\n {month}\n </button>\n );\n })}\n </div>\n );\n })}\n </div>\n </div>\n );\n};\nCalendarMonth.displayName = 'CalendarMonth';\n\nfunction getYearStrings({\n dateTimeFormatter,\n navigatedDate,\n strings,\n}: Pick<CalendarMonthProps, 'dateTimeFormatter' | 'navigatedDate' | 'strings'>) {\n const yearToString = (year: number) => {\n if (dateTimeFormatter) {\n // create a date based on the current nav date\n const yearFormattingDate = new Date(navigatedDate.getTime());\n yearFormattingDate.setFullYear(year);\n return dateTimeFormatter.formatYear(yearFormattingDate);\n }\n return String(year);\n };\n\n const yearRangeToString = (yearRange: CalendarYearRange) => {\n return `${yearToString(yearRange.fromYear)} - ${yearToString(yearRange.toYear)}`;\n };\n\n const yearRangeToNextDecadeLabel = (yearRange: CalendarYearRange) => {\n return strings.nextYearRangeAriaLabel ? `${strings.nextYearRangeAriaLabel} ${yearRangeToString(yearRange)}` : '';\n };\n\n const yearRangeToPrevDecadeLabel = (yearRange: CalendarYearRange) => {\n return strings.prevYearRangeAriaLabel ? `${strings.prevYearRangeAriaLabel} ${yearRangeToString(yearRange)}` : '';\n };\n\n return [\n yearToString,\n {\n rangeAriaLabel: yearRangeToString,\n prevRangeAriaLabel: yearRangeToPrevDecadeLabel,\n nextRangeAriaLabel: yearRangeToNextDecadeLabel,\n headerAriaLabelFormatString: strings.monthPickerHeaderAriaLabel,\n } as const,\n ] as const;\n}\n\nfunction isCurrentMonth(month: number, year: number, today: Date): boolean {\n return today.getFullYear() === year && today.getMonth() === month;\n}\n\nfunction onButtonKeyDown(callback: () => void): (ev: React.KeyboardEvent<HTMLButtonElement>) => void {\n return (ev: React.KeyboardEvent<HTMLButtonElement>) => {\n switch (ev.key) {\n case Enter:\n callback();\n break;\n }\n };\n}\n"],"names":["React","Enter","useArrowNavigationGroup","mergeClasses","addYears","compareDatePart","getMonthEnd","getMonthStart","getYearEnd","getYearStart","setMonth","DEFAULT_DATE_FORMATTING","CalendarYear","useCalendarMonthStyles_unstable","MONTHS_PER_ROW","useAnimateBackwards","navigatedDate","currentYear","getFullYear","previousYearRef","useRef","undefined","useEffect","current","previousYear","useFocusLogic","componentRef","navigatedMonthRef","calendarYearRef","focusOnUpdate","focus","useCallback","useImperativeHandle","focusOnNextUpdate","CalendarMonth","props","allFocusable","animationDirection","className","dateTimeFormatter","highlightCurrentMonth","highlightSelectedMonth","maxDate","minDate","navigationIcons","onHeaderSelect","onUserHeaderSelect","onNavigateDate","selectedDate","strings","today","Date","yearPickerHidden","isYearPickerVisible","setIsYearPickerVisible","useState","animateBackwards","selectMonthCallback","newMonth","onSelectMonth","onSelectNextYear","onSelectPrevYear","onSelectYear","selectedYear","navYear","newNavigationDate","getTime","setFullYear","getMonth","onYearPickerHeaderSelect","dateFormatter","isPrevYearInBounds","isNextYearInBounds","classNames","hasHeaderClickCallback","highlightCurrent","highlightSelected","arrowNavigationAttributes","axis","onRenderYear","yearStrings","getYearStrings","key","minYear","maxYear","navigatedYear","highlightCurrentYear","highlightSelectedYear","rowIndexes","i","shortMonths","length","push","yearString","formatYear","headerAriaLabel","monthPickerHeaderAriaLabel","replace","div","root","headerContainer","button","currentItemButton","onClick","onKeyDown","onButtonKeyDown","aria-label","tabIndex","type","span","aria-live","aria-atomic","navigationButtonsContainer","navigationButton","disabled","aria-disabled","title","prevYearAriaLabel","upNavigation","nextYearAriaLabel","downNavigation","gridContainer","role","map","rowNum","monthsForRow","slice","buttonRow","month","index","monthIndex","indexedMonth","isNavigatedMonth","isSelectedMonth","isSelectedYear","isInBounds","ref","itemButton","isCurrentMonth","selected","formatMonth","aria-selected","displayName","yearToString","year","yearFormattingDate","String","yearRangeToString","yearRange","fromYear","toYear","yearRangeToNextDecadeLabel","nextYearRangeAriaLabel","yearRangeToPrevDecadeLabel","prevYearRangeAriaLabel","rangeAriaLabel","prevRangeAriaLabel","nextRangeAriaLabel","headerAriaLabelFormatString","callback","ev"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,KAAK,QAAQ,0BAA0B;AAChD,SAASC,uBAAuB,QAAQ,0BAA0B;AAClE,SAASC,YAAY,QAAQ,iBAAiB;AAC9C,SACEC,QAAQ,EACRC,eAAe,EACfC,WAAW,EACXC,aAAa,EACbC,UAAU,EACVC,YAAY,EACZC,QAAQ,EACRC,uBAAuB,QAClB,cAAc;AACrB,SAASC,YAAY,QAAQ,+BAA+B;AAC5D,SAASC,+BAA+B,QAAQ,kCAAkC;AAIlF,MAAMC,iBAAiB;AAEvB,SAASC,oBAAoB,EAAEC,aAAa,EAA0D;IACpG,MAAMC,cAAcD,cAAcE,WAAW;IAE7C,MAAMC,kBAAkBnB,MAAMoB,MAAM,CAAqBC;IACzDrB,MAAMsB,SAAS,CAAC;QACdH,gBAAgBI,OAAO,GAAGN;IAC5B;IACA,MAAMO,eAAeL,gBAAgBI,OAAO;IAE5C,IAAIC,iBAAiBH,aAAaG,iBAAiBP,aAAa;QAC9D,OAAOI;IAC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B,8CAA8C;YAC9C,MAAM0G,qBAAqB,IAAI9F,KAAKnC,cAAckD,OAAO;YACzD+E,mBAAmB9E,WAAW,CAAC6E;YAC/B,OAAOzG,kBAAkBuD,UAAU,CAACmD;QACtC;QACA,OAAOC,OAAOF;IAChB;IAEA,MAAMG,oBAAoB,CAACC;QACzB,OAAO,GAAGL,aAAaK,UAAUC,QAAQ,EAAE,GAAG,EAAEN,aAAaK,UAAUE,MAAM,GAAG;IAClF;IAEA,MAAMC,6BAA6B,CAACH;QAClC,OAAOnG,QAAQuG,sBAAsB,GAAG,GAAGvG,QAAQuG,sBAAsB,CAAC,CAAC,EAAEL,kBAAkBC,YAAY,GAAG;IAChH;IAEA,MAAMK,6BAA6B,CAACL;QAClC,OAAOnG,QAAQyG,sBAAsB,GAAG,GAAGzG,QAAQyG,sBAAsB,CAAC,CAAC,EAAEP,kBAAkBC,YAAY,GAAG;IAChH;IAEA,OAAO;QACLL;QACA;YACEY,gBAAgBR;YAChBS,oBAAoBH;YACpBI,oBAAoBN;YACpBO,6BAA6B7G,QAAQ+C,0BAA0B;QACjE;KACD;AACH;AAEA,SAAS0C,eAAeV,KAAa,EAAEgB,IAAY,EAAE9F,KAAW;IAC9D,OAAOA,MAAMhC,WAAW,OAAO8H,QAAQ9F,MAAMkB,QAAQ,OAAO4D;AAC9D;AAEA,SAASvB,gBAAgBsD,QAAoB;IAC3C,OAAO,CAACC;QACN,OAAQA,GAAG9E,GAAG;YACZ,KAAKjF;gBACH8J;gBACA;QACJ;IACF;AACF"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/CalendarMonth/CalendarMonth.types.ts"],"sourcesContent":["import * as React from 'react';\nimport { AnimationDirection } from '../Calendar/Calendar.types';\nimport type { CalendarNavigationIcons } from '../Calendar/calendarNavigationIcons';\nimport type { CalendarStrings, DateFormatting } from '../../utils';\nimport type { CalendarPickerStyleProps, CalendarPickerStyles } from '../CalendarPicker/CalendarPicker.types';\n\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport interface ICalendarMonth {\n focus(): void;\n}\n\nexport interface CalendarMonthProps {\n /**\n * Optional callback to access the ICalendarMonth interface. Use this instead of ref for accessing\n * the public methods and properties of the component.\n */\n componentRef?: React.RefObject<ICalendarMonth>;\n\n /**\n * Localized strings to use in the Calendar\n */\n strings: CalendarStrings;\n\n /**\n * The currently selected date\n */\n selectedDate: Date;\n\n /**\n * The currently navigated date\n */\n navigatedDate: Date;\n\n /**\n * Callback issued when a month is selected\n * @param date - The date the user selected\n * @param selectedDateRangeArray - The resultant list of dates that are selected based on the date range type set\n * for the component.\n */\n onSelectDate?: (date: Date, selectedDateRangeArray?: Date[]) => void;\n\n /**\n * Callback issued when the year is navigated\n * @param date - The date that is navigated to\n * @param focusOnNavigatedDay - Whether to set the focus to the navigated date.\n */\n onNavigateDate: (date: Date, focusOnNavigatedDay: boolean) => void;\n\n /**\n * Value of today. If unspecified, current time in client machine will be used.\n */\n today?: Date;\n\n /**\n * Callback function when the header is selected\n */\n onHeaderSelect?: () => void;\n\n /**\n * Apply additional formatting to dates, for example localized date formatting.\n */\n dateTimeFormatter?: DateFormatting;\n\n /**\n * If set the Calendar will not allow navigation to or selection of a date earlier than this value.\n */\n minDate?: Date;\n\n /**\n * If set the Calendar will not allow navigation to or selection of a date later than this value.\n */\n maxDate?: Date;\n\n /**\n * Whether the month picker should highlight the current month\n * @default false\n */\n highlightCurrentMonth?: boolean;\n\n /**\n * Whether the month picker should highlight the selected month\n * @default false\n */\n highlightSelectedMonth?: boolean;\n\n /**\n * Allows all dates and buttons to be focused, including disabled ones\n * @default false\n */\n allFocusable?: boolean;\n\n /**\n * Additional CSS class(es) to apply to the CalendarMonth.\n */\n className?: string;\n\n /**\n * Whether the year picker is hidden\n * @default false\n */\n yearPickerHidden?: boolean;\n\n /**\n * The cardinal directions for animation to occur during transitions, either horizontal or veritcal\n */\n animationDirection?: AnimationDirection;\n\n /**\n * Custom navigation icons.\n */\n navigationIcons: CalendarNavigationIcons;\n}\n\n/**\n * @internal\n */\nexport interface CalendarMonthStyleProps extends CalendarPickerStyleProps {}\n\n/**\n * @internal\n */\nexport interface CalendarMonthStyles extends CalendarPickerStyles {}\n"],"names":["React"],"mappings":"AAAA,YAAYA,WAAW,QAAQ"}
1
+ {"version":3,"sources":["../src/components/CalendarMonth/CalendarMonth.types.ts"],"sourcesContent":["import * as React from 'react';\nimport { AnimationDirection } from '../Calendar/Calendar.types';\nimport type { CalendarNavigationIcons } from '../Calendar/calendarNavigationIcons';\nimport type { CalendarStrings, DateFormatting } from '../../utils';\nimport type { CalendarPickerStyleProps, CalendarPickerStyles } from '../CalendarPicker/CalendarPicker.types';\n\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport interface ICalendarMonth {\n focus(): void;\n}\n\nexport interface CalendarMonthProps {\n /**\n * Optional callback to access the ICalendarMonth interface. Use this instead of ref for accessing\n * the public methods and properties of the component.\n */\n componentRef?: React.RefObject<ICalendarMonth | null>;\n\n /**\n * Localized strings to use in the Calendar\n */\n strings: CalendarStrings;\n\n /**\n * The currently selected date\n */\n selectedDate: Date;\n\n /**\n * The currently navigated date\n */\n navigatedDate: Date;\n\n /**\n * Callback issued when a month is selected\n * @param date - The date the user selected\n * @param selectedDateRangeArray - The resultant list of dates that are selected based on the date range type set\n * for the component.\n */\n onSelectDate?: (date: Date, selectedDateRangeArray?: Date[]) => void;\n\n /**\n * Callback issued when the year is navigated\n * @param date - The date that is navigated to\n * @param focusOnNavigatedDay - Whether to set the focus to the navigated date.\n */\n onNavigateDate: (date: Date, focusOnNavigatedDay: boolean) => void;\n\n /**\n * Value of today. If unspecified, current time in client machine will be used.\n */\n today?: Date;\n\n /**\n * Callback function when the header is selected\n */\n onHeaderSelect?: () => void;\n\n /**\n * Apply additional formatting to dates, for example localized date formatting.\n */\n dateTimeFormatter?: DateFormatting;\n\n /**\n * If set the Calendar will not allow navigation to or selection of a date earlier than this value.\n */\n minDate?: Date;\n\n /**\n * If set the Calendar will not allow navigation to or selection of a date later than this value.\n */\n maxDate?: Date;\n\n /**\n * Whether the month picker should highlight the current month\n * @default false\n */\n highlightCurrentMonth?: boolean;\n\n /**\n * Whether the month picker should highlight the selected month\n * @default false\n */\n highlightSelectedMonth?: boolean;\n\n /**\n * Allows all dates and buttons to be focused, including disabled ones\n * @default false\n */\n allFocusable?: boolean;\n\n /**\n * Additional CSS class(es) to apply to the CalendarMonth.\n */\n className?: string;\n\n /**\n * Whether the year picker is hidden\n * @default false\n */\n yearPickerHidden?: boolean;\n\n /**\n * The cardinal directions for animation to occur during transitions, either horizontal or veritcal\n */\n animationDirection?: AnimationDirection;\n\n /**\n * Custom navigation icons.\n */\n navigationIcons: CalendarNavigationIcons;\n}\n\n/**\n * @internal\n */\nexport interface CalendarMonthStyleProps extends CalendarPickerStyleProps {}\n\n/**\n * @internal\n */\nexport interface CalendarMonthStyles extends CalendarPickerStyles {}\n"],"names":["React"],"mappings":"AAAA,YAAYA,WAAW,QAAQ"}