@fluentui/react-calendar-compat 0.1.20 → 0.1.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +30 -2
- package/lib/Calendar.js.map +1 -1
- package/lib/CalendarDay.js.map +1 -1
- package/lib/CalendarDayGrid.js.map +1 -1
- package/lib/CalendarMonth.js.map +1 -1
- package/lib/CalendarPicker.js.map +1 -1
- package/lib/CalendarYear.js.map +1 -1
- package/lib/components/Calendar/Calendar.js.map +1 -1
- package/lib/components/Calendar/Calendar.types.js.map +1 -1
- package/lib/components/Calendar/calendarNavigationIcons.js.map +1 -1
- package/lib/components/Calendar/defaults.js.map +1 -1
- package/lib/components/Calendar/index.js.map +1 -1
- package/lib/components/Calendar/useCalendarStyles.styles.js +1 -2
- package/lib/components/CalendarDay/CalendarDay.js.map +1 -1
- package/lib/components/CalendarDay/CalendarDay.types.js.map +1 -1
- package/lib/components/CalendarDay/index.js.map +1 -1
- package/lib/components/CalendarDay/useCalendarDayStyles.styles.js +1 -2
- package/lib/components/CalendarDayGrid/CalendarDayGrid.js.map +1 -1
- package/lib/components/CalendarDayGrid/CalendarDayGrid.types.js.map +1 -1
- package/lib/components/CalendarDayGrid/CalendarGridDayCell.js.map +1 -1
- package/lib/components/CalendarDayGrid/CalendarGridRow.js.map +1 -1
- package/lib/components/CalendarDayGrid/CalendarMonthHeaderRow.js.map +1 -1
- package/lib/components/CalendarDayGrid/index.js.map +1 -1
- package/lib/components/CalendarDayGrid/useCalendarDayGridStyles.styles.js +1 -2
- package/lib/components/CalendarDayGrid/useWeekCornerStyles.styles.js +1 -2
- package/lib/components/CalendarDayGrid/useWeeks.js.map +1 -1
- package/lib/components/CalendarMonth/CalendarMonth.js.map +1 -1
- package/lib/components/CalendarMonth/CalendarMonth.types.js.map +1 -1
- package/lib/components/CalendarMonth/index.js.map +1 -1
- package/lib/components/CalendarMonth/useCalendarMonthStyles.styles.js +1 -2
- package/lib/components/CalendarPicker/CalendarPicker.types.js.map +1 -1
- package/lib/components/CalendarPicker/index.js.map +1 -1
- package/lib/components/CalendarPicker/useCalendarPickerStyles.styles.js +1 -2
- package/lib/components/CalendarYear/CalendarYear.js.map +1 -1
- package/lib/components/CalendarYear/CalendarYear.types.js.map +1 -1
- package/lib/components/CalendarYear/index.js.map +1 -1
- package/lib/components/CalendarYear/useCalendarYearStyles.styles.js +1 -2
- package/lib/index.js.map +1 -1
- package/lib/utils/animations.js.map +1 -1
- package/lib/utils/constants.js.map +1 -1
- package/lib/utils/dateFormatting/dateFormatting.defaults.js.map +1 -1
- package/lib/utils/dateFormatting/dateFormatting.types.js.map +1 -1
- package/lib/utils/dateFormatting/index.js.map +1 -1
- package/lib/utils/dateGrid/dateGrid.types.js.map +1 -1
- package/lib/utils/dateGrid/findAvailableDate.js.map +1 -1
- package/lib/utils/dateGrid/getBoundedDateRange.js.map +1 -1
- package/lib/utils/dateGrid/getDateRangeTypeToUse.js.map +1 -1
- package/lib/utils/dateGrid/getDayGrid.js.map +1 -1
- package/lib/utils/dateGrid/index.js.map +1 -1
- package/lib/utils/dateGrid/isAfterMaxDate.js.map +1 -1
- package/lib/utils/dateGrid/isBeforeMinDate.js.map +1 -1
- package/lib/utils/dateGrid/isContiguous.js.map +1 -1
- package/lib/utils/dateGrid/isRestrictedDate.js.map +1 -1
- package/lib/utils/dateMath/dateMath.js.map +1 -1
- package/lib/utils/dateMath/index.js.map +1 -1
- package/lib/utils/focus.js.map +1 -1
- package/lib/utils/index.js.map +1 -1
- package/lib-commonjs/Calendar.js.map +1 -1
- package/lib-commonjs/CalendarDay.js.map +1 -1
- package/lib-commonjs/CalendarDayGrid.js.map +1 -1
- package/lib-commonjs/CalendarMonth.js.map +1 -1
- package/lib-commonjs/CalendarPicker.js.map +1 -1
- package/lib-commonjs/CalendarYear.js.map +1 -1
- package/lib-commonjs/components/Calendar/Calendar.js.map +1 -1
- package/lib-commonjs/components/Calendar/Calendar.types.js.map +1 -1
- package/lib-commonjs/components/Calendar/calendarNavigationIcons.js.map +1 -1
- package/lib-commonjs/components/Calendar/defaults.js.map +1 -1
- package/lib-commonjs/components/Calendar/index.js.map +1 -1
- package/lib-commonjs/components/Calendar/useCalendarStyles.styles.js +1 -1
- package/lib-commonjs/components/CalendarDay/CalendarDay.js.map +1 -1
- package/lib-commonjs/components/CalendarDay/CalendarDay.types.js.map +1 -1
- package/lib-commonjs/components/CalendarDay/index.js.map +1 -1
- package/lib-commonjs/components/CalendarDay/useCalendarDayStyles.styles.js +1 -1
- package/lib-commonjs/components/CalendarDayGrid/CalendarDayGrid.js.map +1 -1
- package/lib-commonjs/components/CalendarDayGrid/CalendarDayGrid.types.js.map +1 -1
- package/lib-commonjs/components/CalendarDayGrid/CalendarGridDayCell.js.map +1 -1
- package/lib-commonjs/components/CalendarDayGrid/CalendarGridRow.js.map +1 -1
- package/lib-commonjs/components/CalendarDayGrid/CalendarMonthHeaderRow.js.map +1 -1
- package/lib-commonjs/components/CalendarDayGrid/index.js.map +1 -1
- package/lib-commonjs/components/CalendarDayGrid/useCalendarDayGridStyles.styles.js +1 -1
- package/lib-commonjs/components/CalendarDayGrid/useWeekCornerStyles.styles.js +1 -1
- package/lib-commonjs/components/CalendarDayGrid/useWeeks.js.map +1 -1
- package/lib-commonjs/components/CalendarMonth/CalendarMonth.js.map +1 -1
- package/lib-commonjs/components/CalendarMonth/CalendarMonth.types.js.map +1 -1
- package/lib-commonjs/components/CalendarMonth/index.js.map +1 -1
- package/lib-commonjs/components/CalendarMonth/useCalendarMonthStyles.styles.js +1 -1
- package/lib-commonjs/components/CalendarPicker/CalendarPicker.types.js.map +1 -1
- package/lib-commonjs/components/CalendarPicker/index.js.map +1 -1
- package/lib-commonjs/components/CalendarPicker/useCalendarPickerStyles.styles.js +1 -1
- package/lib-commonjs/components/CalendarYear/CalendarYear.js.map +1 -1
- package/lib-commonjs/components/CalendarYear/CalendarYear.types.js.map +1 -1
- package/lib-commonjs/components/CalendarYear/index.js.map +1 -1
- package/lib-commonjs/components/CalendarYear/useCalendarYearStyles.styles.js +1 -1
- package/lib-commonjs/index.js.map +1 -1
- package/lib-commonjs/utils/animations.js.map +1 -1
- package/lib-commonjs/utils/constants.js.map +1 -1
- package/lib-commonjs/utils/dateFormatting/dateFormatting.defaults.js.map +1 -1
- package/lib-commonjs/utils/dateFormatting/dateFormatting.types.js.map +1 -1
- package/lib-commonjs/utils/dateFormatting/index.js.map +1 -1
- package/lib-commonjs/utils/dateGrid/dateGrid.types.js.map +1 -1
- package/lib-commonjs/utils/dateGrid/findAvailableDate.js.map +1 -1
- package/lib-commonjs/utils/dateGrid/getBoundedDateRange.js.map +1 -1
- package/lib-commonjs/utils/dateGrid/getDateRangeTypeToUse.js.map +1 -1
- package/lib-commonjs/utils/dateGrid/getDayGrid.js.map +1 -1
- package/lib-commonjs/utils/dateGrid/index.js.map +1 -1
- package/lib-commonjs/utils/dateGrid/isAfterMaxDate.js.map +1 -1
- package/lib-commonjs/utils/dateGrid/isBeforeMinDate.js.map +1 -1
- package/lib-commonjs/utils/dateGrid/isContiguous.js.map +1 -1
- package/lib-commonjs/utils/dateGrid/isRestrictedDate.js.map +1 -1
- package/lib-commonjs/utils/dateMath/dateMath.js.map +1 -1
- package/lib-commonjs/utils/dateMath/index.js.map +1 -1
- package/lib-commonjs/utils/focus.js.map +1 -1
- package/lib-commonjs/utils/index.js.map +1 -1
- package/package.json +8 -20
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["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":["CalendarDayGrid","useDayRefs","daysRef","React","useRef","getSetRefCallback","dayKey","element","current","useAnimateBackwards","weeks","previousNavigatedDateRef","useEffect","originalDate","previousNavigatedDate","getTime","undefined","props","navigatedDayRef","activeDescendantId","useId","onSelectDate","selectedDate","firstDayOfWeek","minDate","maxDate","workWeekDays","daysToSelectInDayView","restrictedDates","restrictedDatesOptions","dateRange","getDateRangeArray","dateRangeType","getBoundedDateRange","filter","d","isRestrictedDate","onNavigateDate","useWeeks","animateBackwards","getWeekCornerStyles","calculateRoundedStyles","useWeekCornerStyles","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","useCalendarDayGridStyles_unstable","weekCorners","partialWeekProps","arrowNavigationAttributes","useArrowNavigationGroup","axis","createElement","table","className","mergeClasses","aria-multiselectable","aria-label","aria-labelledby","aria-activedescendant","role","tbody","CalendarMonthHeaderRow","CalendarGridRow","week","weekIndex","rowClassName","firstTransitionWeek","aria-role","ariaHidden","slice","length","weekRow","lastTransitionWeek","displayName","DateRangeType","WorkWeek","sortedWWDays","sort","isContiguous","i","Week"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAgDaA;;;eAAAA;;;;iEAhDU;8BACiB;gCAClB;uBAC6E;gDACjD;wCACX;iCACP;0BAC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Content":["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":["CalendarDayGrid","useDayRefs","daysRef","React","useRef","getSetRefCallback","dayKey","element","current","useAnimateBackwards","weeks","previousNavigatedDateRef","useEffect","originalDate","previousNavigatedDate","getTime","undefined","props","navigatedDayRef","activeDescendantId","useId","onSelectDate","selectedDate","firstDayOfWeek","minDate","maxDate","workWeekDays","daysToSelectInDayView","restrictedDates","restrictedDatesOptions","dateRange","getDateRangeArray","dateRangeType","getBoundedDateRange","filter","d","isRestrictedDate","onNavigateDate","useWeeks","animateBackwards","getWeekCornerStyles","calculateRoundedStyles","useWeekCornerStyles","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","useCalendarDayGridStyles_unstable","weekCorners","partialWeekProps","arrowNavigationAttributes","useArrowNavigationGroup","axis","createElement","table","className","mergeClasses","aria-multiselectable","aria-label","aria-labelledby","aria-activedescendant","role","tbody","CalendarMonthHeaderRow","CalendarGridRow","week","weekIndex","rowClassName","firstTransitionWeek","aria-role","ariaHidden","slice","length","weekRow","lastTransitionWeek","displayName","DateRangeType","WorkWeek","sortedWWDays","sort","isContiguous","i","Week"],"rangeMappings":";;;;;;;;;;;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IAAIH,YAAY,CAACG,EAAE,KAAKH,YAAY,CAACG,IAAI,EAAE,GAAG,GAAG;gBAC/CD,eAAe;gBACf;YACF;QACF;QAEA,IAAI,CAACA,gBAAgB5E,aAAaoE,MAAM,KAAK,GAAG;YAC9C,OAAOI,oBAAAA,CAAcM,IAAI;QAC3B;IACF;IAEA,OAAOxE;AACT"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["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":[],"rangeMappings":";;;;;","mappings":";;;;;iEAAuB"}
|
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":[],"rangeMappings":";;;;;","mappings":";;;;;iEAAuB"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["CalendarGridDayCell.tsx"],"sourcesContent":["import * as React from 'react';\nimport { ArrowDown, ArrowLeft, ArrowRight, ArrowUp, Enter } from '@fluentui/keyboard-keys';\nimport { getRTLSafeKey } from '@fluentui/react-utilities';\nimport { useFluent_unstable } from '@fluentui/react-shared-contexts';\nimport { mergeClasses } from '@griffel/react';\nimport { addDays, addWeeks, compareDates, findAvailableDate, DateRangeType } from '../../utils';\nimport { weekCornersClassNames } from './useWeekCornerStyles.styles';\nimport { extraCalendarDayGridClassNames } from './useCalendarDayGridStyles.styles';\nimport type { AvailableDateOptions } from '../../utils';\nimport type { DayInfo } from './CalendarDayGrid';\nimport type { CalendarGridRowProps } from './CalendarGridRow';\n\n/**\n * @internal\n */\nexport interface CalendarGridDayCellProps extends CalendarGridRowProps {\n day: DayInfo;\n dayIndex: number;\n}\n\n/**\n * @internal\n */\nexport const CalendarGridDayCell: React.FunctionComponent<CalendarGridDayCellProps> = props => {\n 'use no memo';\n\n const {\n navigatedDate,\n dateTimeFormatter,\n allFocusable,\n strings,\n activeDescendantId,\n navigatedDayRef,\n calculateRoundedStyles,\n weeks,\n classNames,\n day,\n dayIndex,\n weekIndex,\n weekCorners,\n ariaHidden,\n customDayCellRef,\n dateRangeType,\n daysToSelectInDayView,\n onSelectDate,\n restrictedDates,\n minDate,\n maxDate,\n onNavigateDate,\n getDayInfosInRangeOfDay,\n getRefsFromDayInfos,\n } = props;\n const cornerStyle = weekCorners?.[weekIndex + '_' + dayIndex] ?? '';\n const isNavigatedDate = compareDates(navigatedDate, day.originalDate);\n\n const { dir } = useFluent_unstable();\n\n const navigateMonthEdge = (ev: React.KeyboardEvent<HTMLElement>, date: Date): void => {\n let targetDate: Date | undefined = undefined;\n let direction = 1; // by default search forward\n\n if (ev.key === ArrowUp) {\n targetDate = addWeeks(date, -1);\n direction = -1;\n } else if (ev.key === ArrowDown) {\n targetDate = addWeeks(date, 1);\n } else if (ev.key === getRTLSafeKey(ArrowLeft, dir)) {\n targetDate = addDays(date, -1);\n direction = -1;\n } else if (ev.key === getRTLSafeKey(ArrowRight, dir)) {\n targetDate = addDays(date, 1);\n }\n\n if (!targetDate) {\n // if we couldn't find a target date at all, do nothing\n return;\n }\n\n const findAvailableDateOptions: AvailableDateOptions = {\n initialDate: date,\n targetDate,\n direction,\n restrictedDates,\n minDate,\n maxDate,\n };\n\n // target date is restricted, search in whatever direction until finding the next possible date,\n // stopping at boundaries\n let nextDate = findAvailableDate(findAvailableDateOptions);\n\n if (!nextDate) {\n // if no dates available in initial direction, try going backwards\n findAvailableDateOptions.direction = -direction;\n nextDate = findAvailableDate(findAvailableDateOptions);\n }\n\n // if the nextDate is still inside the same focusZone area, let the focusZone handle setting the focus so we\n // don't jump the view unnecessarily\n const isInCurrentView =\n weeks &&\n nextDate &&\n weeks.slice(1, weeks.length - 1).some((week: DayInfo[]) => {\n return week.some((dayToCompare: DayInfo) => {\n return compareDates(dayToCompare.originalDate, nextDate!);\n });\n });\n if (isInCurrentView) {\n return;\n }\n\n // else, fire navigation on the date to change the view to show it\n if (nextDate) {\n onNavigateDate(nextDate, true);\n ev.preventDefault();\n }\n };\n\n const onMouseOverDay = (ev: React.MouseEvent<HTMLElement>) => {\n const dayInfos = getDayInfosInRangeOfDay(day);\n const dayRefs = getRefsFromDayInfos(dayInfos);\n\n dayRefs.forEach((dayRef: HTMLElement | null, index: number) => {\n if (dayRef) {\n dayRef.classList.add(extraCalendarDayGridClassNames.hoverStyle);\n if (\n !dayInfos[index].isSelected &&\n dateRangeType === DateRangeType.Day &&\n daysToSelectInDayView &&\n daysToSelectInDayView > 1\n ) {\n // remove the static classes first to overwrite them\n dayRef.classList.remove(\n weekCornersClassNames.bottomLeftCornerDate!,\n weekCornersClassNames.bottomRightCornerDate!,\n weekCornersClassNames.topLeftCornerDate!,\n weekCornersClassNames.topRightCornerDate!,\n );\n\n const classNamesToAdd = calculateRoundedStyles(false, false, index > 0, index < dayRefs.length - 1).trim();\n if (classNamesToAdd) {\n dayRef.classList.add(...classNamesToAdd.trim().split(' '));\n }\n }\n }\n });\n };\n\n const onMouseDownDay = (ev: React.MouseEvent<HTMLElement>) => {\n const dayInfos = getDayInfosInRangeOfDay(day);\n const dayRefs = getRefsFromDayInfos(dayInfos);\n\n dayRefs.forEach((dayRef: HTMLElement | null) => {\n if (dayRef) {\n dayRef.classList.add(extraCalendarDayGridClassNames.pressedStyle);\n }\n });\n };\n\n const onMouseUpDay = (ev: React.MouseEvent<HTMLElement>) => {\n const dayInfos = getDayInfosInRangeOfDay(day);\n const dayRefs = getRefsFromDayInfos(dayInfos);\n\n dayRefs.forEach((dayRef: HTMLElement | null) => {\n if (dayRef) {\n dayRef.classList.remove(extraCalendarDayGridClassNames.pressedStyle);\n }\n });\n };\n\n const onMouseOutDay = (ev: React.MouseEvent<HTMLElement>) => {\n const dayInfos = getDayInfosInRangeOfDay(day);\n const dayRefs = getRefsFromDayInfos(dayInfos);\n\n dayRefs.forEach((dayRef: HTMLElement | null, index: number) => {\n if (dayRef) {\n dayRef.classList.remove(extraCalendarDayGridClassNames.hoverStyle);\n dayRef.classList.remove(extraCalendarDayGridClassNames.pressedStyle);\n if (\n !dayInfos[index].isSelected &&\n dateRangeType === DateRangeType.Day &&\n daysToSelectInDayView &&\n daysToSelectInDayView > 1\n ) {\n const classNamesToAdd = calculateRoundedStyles(false, false, index > 0, index < dayRefs.length - 1).trim();\n if (classNamesToAdd) {\n dayRef.classList.remove(...classNamesToAdd.trim().split(' '));\n }\n }\n }\n });\n };\n\n const onDayKeyDown = (ev: React.KeyboardEvent<HTMLElement>): void => {\n if (ev.key === Enter) {\n onSelectDate?.(day.originalDate);\n } else {\n navigateMonthEdge(ev, day.originalDate);\n }\n };\n\n let ariaLabel =\n day.originalDate.getDate() +\n ', ' +\n strings.months[day.originalDate.getMonth()] +\n ', ' +\n day.originalDate.getFullYear();\n\n if (day.isMarked) {\n ariaLabel = ariaLabel + ', ' + strings.dayMarkedAriaLabel;\n }\n\n const isFocusable = !ariaHidden && (allFocusable || (day.isInBounds ? true : undefined));\n\n return (\n <td\n className={mergeClasses(\n classNames.dayCell,\n weekCorners && cornerStyle,\n day.isSelected && !day.isSingleSelected && classNames.daySelected,\n day.isSingleSelected && classNames.daySingleSelected,\n !day.isInBounds && classNames.dayOutsideBounds,\n !day.isInMonth && classNames.dayOutsideNavigatedMonth,\n )}\n ref={(element: HTMLTableCellElement) => {\n customDayCellRef?.(element, day.originalDate, classNames);\n day.setRef(element);\n isNavigatedDate && (navigatedDayRef.current = element);\n }}\n aria-disabled={!ariaHidden && !day.isInBounds}\n onClick={day.isInBounds && !ariaHidden ? day.onSelected : undefined}\n onMouseOver={!ariaHidden ? onMouseOverDay : undefined}\n onMouseDown={!ariaHidden ? onMouseDownDay : undefined}\n onMouseUp={!ariaHidden ? onMouseUpDay : undefined}\n onMouseOut={!ariaHidden ? onMouseOutDay : undefined}\n onKeyDown={!ariaHidden ? onDayKeyDown : undefined}\n role=\"gridcell\"\n tabIndex={isNavigatedDate || isFocusable ? 0 : undefined}\n aria-current={day.isToday ? 'date' : undefined}\n aria-selected={day.isInBounds ? day.isSelected : undefined}\n >\n <button\n key={day.key + 'button'}\n className={mergeClasses(classNames.dayButton, day.isToday && classNames.dayIsToday)}\n aria-label={ariaLabel}\n id={isNavigatedDate ? activeDescendantId : undefined}\n disabled={!ariaHidden && !day.isInBounds}\n type=\"button\"\n tabIndex={-1}\n >\n <span className={day.isToday ? mergeClasses(classNames.dayTodayMarker) : undefined}>\n {dateTimeFormatter.formatDay(day.originalDate)}\n </span>\n {day.isMarked && <div aria-hidden=\"true\" className={classNames.dayMarker} />}\n </button>\n </td>\n );\n};\n"],"names":["CalendarGridDayCell","props","navigatedDate","dateTimeFormatter","allFocusable","strings","activeDescendantId","navigatedDayRef","calculateRoundedStyles","weeks","classNames","day","dayIndex","weekIndex","weekCorners","ariaHidden","customDayCellRef","dateRangeType","daysToSelectInDayView","onSelectDate","restrictedDates","minDate","maxDate","onNavigateDate","getDayInfosInRangeOfDay","getRefsFromDayInfos","cornerStyle","isNavigatedDate","compareDates","originalDate","dir","useFluent_unstable","navigateMonthEdge","ev","date","targetDate","undefined","direction","key","ArrowUp","addWeeks","ArrowDown","getRTLSafeKey","ArrowLeft","addDays","ArrowRight","findAvailableDateOptions","initialDate","nextDate","findAvailableDate","isInCurrentView","slice","length","some","week","dayToCompare","preventDefault","onMouseOverDay","dayInfos","dayRefs","forEach","dayRef","index","classList","add","extraCalendarDayGridClassNames","hoverStyle","isSelected","DateRangeType","Day","remove","weekCornersClassNames","bottomLeftCornerDate","bottomRightCornerDate","topLeftCornerDate","topRightCornerDate","classNamesToAdd","trim","split","onMouseDownDay","pressedStyle","onMouseUpDay","onMouseOutDay","onDayKeyDown","Enter","ariaLabel","getDate","months","getMonth","getFullYear","isMarked","dayMarkedAriaLabel","isFocusable","isInBounds","React","createElement","td","className","mergeClasses","dayCell","isSingleSelected","daySelected","daySingleSelected","dayOutsideBounds","isInMonth","dayOutsideNavigatedMonth","ref","element","setRef","current","aria-disabled","onClick","onSelected","onMouseOver","onMouseDown","onMouseUp","onMouseOut","onKeyDown","role","tabIndex","aria-current","isToday","aria-selected","button","dayButton","dayIsToday","aria-label","id","disabled","type","span","dayTodayMarker","formatDay","div","aria-hidden","dayMarker"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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
{"version":3,"sources":["../src/components/CalendarDayGrid/CalendarGridDayCell.tsx"],"sourcesContent":["import * as React from 'react';\nimport { ArrowDown, ArrowLeft, ArrowRight, ArrowUp, Enter } from '@fluentui/keyboard-keys';\nimport { getRTLSafeKey } from '@fluentui/react-utilities';\nimport { useFluent_unstable } from '@fluentui/react-shared-contexts';\nimport { mergeClasses } from '@griffel/react';\nimport { addDays, addWeeks, compareDates, findAvailableDate, DateRangeType } from '../../utils';\nimport { weekCornersClassNames } from './useWeekCornerStyles.styles';\nimport { extraCalendarDayGridClassNames } from './useCalendarDayGridStyles.styles';\nimport type { AvailableDateOptions } from '../../utils';\nimport type { DayInfo } from './CalendarDayGrid';\nimport type { CalendarGridRowProps } from './CalendarGridRow';\n\n/**\n * @internal\n */\nexport interface CalendarGridDayCellProps extends CalendarGridRowProps {\n day: DayInfo;\n dayIndex: number;\n}\n\n/**\n * @internal\n */\nexport const CalendarGridDayCell: React.FunctionComponent<CalendarGridDayCellProps> = props => {\n 'use no memo';\n\n const {\n navigatedDate,\n dateTimeFormatter,\n allFocusable,\n strings,\n activeDescendantId,\n navigatedDayRef,\n calculateRoundedStyles,\n weeks,\n classNames,\n day,\n dayIndex,\n weekIndex,\n weekCorners,\n ariaHidden,\n customDayCellRef,\n dateRangeType,\n daysToSelectInDayView,\n onSelectDate,\n restrictedDates,\n minDate,\n maxDate,\n onNavigateDate,\n getDayInfosInRangeOfDay,\n getRefsFromDayInfos,\n } = props;\n const cornerStyle = weekCorners?.[weekIndex + '_' + dayIndex] ?? '';\n const isNavigatedDate = compareDates(navigatedDate, day.originalDate);\n\n const { dir } = useFluent_unstable();\n\n const navigateMonthEdge = (ev: React.KeyboardEvent<HTMLElement>, date: Date): void => {\n let targetDate: Date | undefined = undefined;\n let direction = 1; // by default search forward\n\n if (ev.key === ArrowUp) {\n targetDate = addWeeks(date, -1);\n direction = -1;\n } else if (ev.key === ArrowDown) {\n targetDate = addWeeks(date, 1);\n } else if (ev.key === getRTLSafeKey(ArrowLeft, dir)) {\n targetDate = addDays(date, -1);\n direction = -1;\n } else if (ev.key === getRTLSafeKey(ArrowRight, dir)) {\n targetDate = addDays(date, 1);\n }\n\n if (!targetDate) {\n // if we couldn't find a target date at all, do nothing\n return;\n }\n\n const findAvailableDateOptions: AvailableDateOptions = {\n initialDate: date,\n targetDate,\n direction,\n restrictedDates,\n minDate,\n maxDate,\n };\n\n // target date is restricted, search in whatever direction until finding the next possible date,\n // stopping at boundaries\n let nextDate = findAvailableDate(findAvailableDateOptions);\n\n if (!nextDate) {\n // if no dates available in initial direction, try going backwards\n findAvailableDateOptions.direction = -direction;\n nextDate = findAvailableDate(findAvailableDateOptions);\n }\n\n // if the nextDate is still inside the same focusZone area, let the focusZone handle setting the focus so we\n // don't jump the view unnecessarily\n const isInCurrentView =\n weeks &&\n nextDate &&\n weeks.slice(1, weeks.length - 1).some((week: DayInfo[]) => {\n return week.some((dayToCompare: DayInfo) => {\n return compareDates(dayToCompare.originalDate, nextDate!);\n });\n });\n if (isInCurrentView) {\n return;\n }\n\n // else, fire navigation on the date to change the view to show it\n if (nextDate) {\n onNavigateDate(nextDate, true);\n ev.preventDefault();\n }\n };\n\n const onMouseOverDay = (ev: React.MouseEvent<HTMLElement>) => {\n const dayInfos = getDayInfosInRangeOfDay(day);\n const dayRefs = getRefsFromDayInfos(dayInfos);\n\n dayRefs.forEach((dayRef: HTMLElement | null, index: number) => {\n if (dayRef) {\n dayRef.classList.add(extraCalendarDayGridClassNames.hoverStyle);\n if (\n !dayInfos[index].isSelected &&\n dateRangeType === DateRangeType.Day &&\n daysToSelectInDayView &&\n daysToSelectInDayView > 1\n ) {\n // remove the static classes first to overwrite them\n dayRef.classList.remove(\n weekCornersClassNames.bottomLeftCornerDate!,\n weekCornersClassNames.bottomRightCornerDate!,\n weekCornersClassNames.topLeftCornerDate!,\n weekCornersClassNames.topRightCornerDate!,\n );\n\n const classNamesToAdd = calculateRoundedStyles(false, false, index > 0, index < dayRefs.length - 1).trim();\n if (classNamesToAdd) {\n dayRef.classList.add(...classNamesToAdd.trim().split(' '));\n }\n }\n }\n });\n };\n\n const onMouseDownDay = (ev: React.MouseEvent<HTMLElement>) => {\n const dayInfos = getDayInfosInRangeOfDay(day);\n const dayRefs = getRefsFromDayInfos(dayInfos);\n\n dayRefs.forEach((dayRef: HTMLElement | null) => {\n if (dayRef) {\n dayRef.classList.add(extraCalendarDayGridClassNames.pressedStyle);\n }\n });\n };\n\n const onMouseUpDay = (ev: React.MouseEvent<HTMLElement>) => {\n const dayInfos = getDayInfosInRangeOfDay(day);\n const dayRefs = getRefsFromDayInfos(dayInfos);\n\n dayRefs.forEach((dayRef: HTMLElement | null) => {\n if (dayRef) {\n dayRef.classList.remove(extraCalendarDayGridClassNames.pressedStyle);\n }\n });\n };\n\n const onMouseOutDay = (ev: React.MouseEvent<HTMLElement>) => {\n const dayInfos = getDayInfosInRangeOfDay(day);\n const dayRefs = getRefsFromDayInfos(dayInfos);\n\n dayRefs.forEach((dayRef: HTMLElement | null, index: number) => {\n if (dayRef) {\n dayRef.classList.remove(extraCalendarDayGridClassNames.hoverStyle);\n dayRef.classList.remove(extraCalendarDayGridClassNames.pressedStyle);\n if (\n !dayInfos[index].isSelected &&\n dateRangeType === DateRangeType.Day &&\n daysToSelectInDayView &&\n daysToSelectInDayView > 1\n ) {\n const classNamesToAdd = calculateRoundedStyles(false, false, index > 0, index < dayRefs.length - 1).trim();\n if (classNamesToAdd) {\n dayRef.classList.remove(...classNamesToAdd.trim().split(' '));\n }\n }\n }\n });\n };\n\n const onDayKeyDown = (ev: React.KeyboardEvent<HTMLElement>): void => {\n if (ev.key === Enter) {\n onSelectDate?.(day.originalDate);\n } else {\n navigateMonthEdge(ev, day.originalDate);\n }\n };\n\n let ariaLabel =\n day.originalDate.getDate() +\n ', ' +\n strings.months[day.originalDate.getMonth()] +\n ', ' +\n day.originalDate.getFullYear();\n\n if (day.isMarked) {\n ariaLabel = ariaLabel + ', ' + strings.dayMarkedAriaLabel;\n }\n\n const isFocusable = !ariaHidden && (allFocusable || (day.isInBounds ? true : undefined));\n\n return (\n <td\n className={mergeClasses(\n classNames.dayCell,\n weekCorners && cornerStyle,\n day.isSelected && !day.isSingleSelected && classNames.daySelected,\n day.isSingleSelected && classNames.daySingleSelected,\n !day.isInBounds && classNames.dayOutsideBounds,\n !day.isInMonth && classNames.dayOutsideNavigatedMonth,\n )}\n ref={(element: HTMLTableCellElement) => {\n customDayCellRef?.(element, day.originalDate, classNames);\n day.setRef(element);\n isNavigatedDate && (navigatedDayRef.current = element);\n }}\n aria-disabled={!ariaHidden && !day.isInBounds}\n onClick={day.isInBounds && !ariaHidden ? day.onSelected : undefined}\n onMouseOver={!ariaHidden ? onMouseOverDay : undefined}\n onMouseDown={!ariaHidden ? onMouseDownDay : undefined}\n onMouseUp={!ariaHidden ? onMouseUpDay : undefined}\n onMouseOut={!ariaHidden ? onMouseOutDay : undefined}\n onKeyDown={!ariaHidden ? onDayKeyDown : undefined}\n role=\"gridcell\"\n tabIndex={isNavigatedDate || isFocusable ? 0 : undefined}\n aria-current={day.isToday ? 'date' : undefined}\n aria-selected={day.isInBounds ? day.isSelected : undefined}\n >\n <button\n key={day.key + 'button'}\n className={mergeClasses(classNames.dayButton, day.isToday && classNames.dayIsToday)}\n aria-label={ariaLabel}\n id={isNavigatedDate ? activeDescendantId : undefined}\n disabled={!ariaHidden && !day.isInBounds}\n type=\"button\"\n tabIndex={-1}\n >\n <span className={day.isToday ? mergeClasses(classNames.dayTodayMarker) : undefined}>\n {dateTimeFormatter.formatDay(day.originalDate)}\n </span>\n {day.isMarked && <div aria-hidden=\"true\" className={classNames.dayMarker} />}\n </button>\n </td>\n );\n};\n"],"names":["CalendarGridDayCell","props","navigatedDate","dateTimeFormatter","allFocusable","strings","activeDescendantId","navigatedDayRef","calculateRoundedStyles","weeks","classNames","day","dayIndex","weekIndex","weekCorners","ariaHidden","customDayCellRef","dateRangeType","daysToSelectInDayView","onSelectDate","restrictedDates","minDate","maxDate","onNavigateDate","getDayInfosInRangeOfDay","getRefsFromDayInfos","cornerStyle","isNavigatedDate","compareDates","originalDate","dir","useFluent_unstable","navigateMonthEdge","ev","date","targetDate","undefined","direction","key","ArrowUp","addWeeks","ArrowDown","getRTLSafeKey","ArrowLeft","addDays","ArrowRight","findAvailableDateOptions","initialDate","nextDate","findAvailableDate","isInCurrentView","slice","length","some","week","dayToCompare","preventDefault","onMouseOverDay","dayInfos","dayRefs","forEach","dayRef","index","classList","add","extraCalendarDayGridClassNames","hoverStyle","isSelected","DateRangeType","Day","remove","weekCornersClassNames","bottomLeftCornerDate","bottomRightCornerDate","topLeftCornerDate","topRightCornerDate","classNamesToAdd","trim","split","onMouseDownDay","pressedStyle","onMouseUpDay","onMouseOutDay","onDayKeyDown","Enter","ariaLabel","getDate","months","getMonth","getFullYear","isMarked","dayMarkedAriaLabel","isFocusable","isInBounds","React","createElement","td","className","mergeClasses","dayCell","isSingleSelected","daySelected","daySingleSelected","dayOutsideBounds","isInMonth","dayOutsideNavigatedMonth","ref","element","setRef","current","aria-disabled","onClick","onSelected","onMouseOver","onMouseDown","onMouseUp","onMouseOut","onKeyDown","role","tabIndex","aria-current","isToday","aria-selected","button","dayButton","dayIsToday","aria-label","id","disabled","type","span","dayTodayMarker","formatDay","div","aria-hidden","dayMarker"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAuBaA;;;eAAAA;;;;iEAvBU;8BAC0C;gCACnC;qCACK;wBACN;uBACqD;2CAC5C;gDACS;AAgBxC,MAAMA,sBAAyEC,CAAAA;IACpF;IAEA,MAAM,EACJC,aAAa,EACbC,iBAAiB,EACjBC,YAAY,EACZC,OAAO,EACPC,kBAAkB,E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qG,UAAU,GAAG5E;QAC1D6E,aAAa,CAAClG,aAAa0C,iBAAiBrB;QAC5C8E,aAAa,CAACnG,aAAagE,iBAAiB3C;QAC5C+E,WAAW,CAACpG,aAAakE,eAAe7C;QACxCgF,YAAY,CAACrG,aAAamE,gBAAgB9C;QAC1CiF,WAAW,CAACtG,aAAaoE,eAAe/C;QACxCkF,MAAK;QACLC,UAAU5F,mBAAmBiE,cAAc,IAAIxD;QAC/CoF,gBAAc7G,IAAI8G,OAAO,GAAG,SAASrF;QACrCsF,iBAAe/G,IAAIkF,UAAU,GAAGlF,IAAIwD,UAAU,GAAG/B;qBAEjD0D,OAAAC,aAAA,CAAC4B,UAAAA;QACCrF,KAAK3B,IAAI2B,GAAG,GAAG;QACf2D,WAAWC,IAAAA,oBAAAA,EAAaxF,WAAWkH,SAAS,EAAEjH,IAAI8G,OAAO,IAAI/G,WAAWmH,UAAU;QAClFC,cAAYzC;QACZ0C,IAAIpG,kBAAkBrB,qBAAqB8B;QAC3C4F,UAAU,CAACjH,cAAc,CAACJ,IAAIkF,UAAU;QACxCoC,MAAK;QACLV,UAAU,CAAC;qBAEXzB,OAAAC,aAAA,CAACmC,QAAAA;QAAKjC,WAAWtF,IAAI8G,OAAO,GAAGvB,IAAAA,oBAAAA,EAAaxF,WAAWyH,cAAc,IAAI/F;OACtEjC,kBAAkBiI,SAAS,CAACzH,IAAIkB,YAAY,IAE9ClB,IAAI+E,QAAQ,IAAA,WAAA,GAAII,OAAAC,aAAA,CAACsC,OAAAA;QAAIC,eAAY;QAAOrC,WAAWvF,WAAW6H,SAAS;;AAIhF"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["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":["CalendarGridRow","props","ariaHidden","classNames","week","weeks","weekIndex","rowClassName","ariaRole","showWeekNumbers","firstDayOfWeek","firstWeekOfYear","navigatedDate","strings","weekNumbers","getWeekNumbersInMonth","length","titleString","weekNumberFormatString","replace","React","createElement","tr","role","aria-hidden","className","key","th","weekNumberCell","title","aria-label","scope","span","map","day","dayIndex","CalendarGridDayCell"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BA6BaA;;;eAAAA;;;;iEA7BU;uBACe;qCACF;AA2B7B,MAAMA,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,kBAChBM,IAAAA,4BAAAA,EAAsBV,MAAOW,MAAM,EAAEN,gBAAgBC,iBAAiBC,iBACtE;IAEJ,MAAMK,cAAcH,cAChBD,QAAQK,sBAAsB,IAAIL,QAAQK,sBAAsB,CAACC,OAAO,CAAC,OAAO,CAAC,EAAEL,WAAW,CAACR,UAAU,CAAC,CAAC,IAC3G;IAEJ,OAAA,WAAA,GACEc,OAAAC,aAAA,CAACC,MAAAA;QAAGC,MAAMf;QAAUgB,eAAatB;QAAYuB,WAAWlB;QAAcmB,KAAKpB,YAAY,MAAMF,IAAI,CAAC,EAAE,CAACsB,GAAG;OACrGjB,mBAAmBK,eAAAA,WAAAA,GAClBM,OAAAC,aAAA,CAACM,MAAAA;QACCF,WAAWtB,WAAWyB,cAAc;QACpCF,KAAKpB;QACLuB,OAAOZ;QACPa,cAAYb;QACZc,OAAM;qBAENX,OAAAC,aAAA,CAACW,QAAAA,MAAMlB,WAAW,CAACR,UAAU,IAGhCF,KAAK6B,GAAG,CAAC,CAACC,KAAcC,WAAAA,WAAAA,GACvBf,OAAAC,aAAA,CAACe,wCAAAA,EAAAA;YAAqB,GAAGnC,KAAK;YAAEyB,KAAKQ,IAAIR,GAAG;YAAEQ,KAAKA;YAAKC,UAAUA;;AAI1E"}
|
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":["CalendarGridRow","props","ariaHidden","classNames","week","weeks","weekIndex","rowClassName","ariaRole","showWeekNumbers","firstDayOfWeek","firstWeekOfYear","navigatedDate","strings","weekNumbers","getWeekNumbersInMonth","length","titleString","weekNumberFormatString","replace","React","createElement","tr","role","aria-hidden","className","key","th","weekNumberCell","title","aria-label","scope","span","map","day","dayIndex","CalendarGridDayCell"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BA6BaA;;;eAAAA;;;;iEA7BU;uBACe;qCACF;AA2B7B,MAAMA,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,kBAChBM,IAAAA,4BAAAA,EAAsBV,MAAOW,MAAM,EAAEN,gBAAgBC,iBAAiBC,iBACtE;IAEJ,MAAMK,cAAcH,cAChBD,QAAQK,sBAAsB,IAAIL,QAAQK,sBAAsB,CAACC,OAAO,CAAC,OAAO,CAAC,EAAEL,WAAW,CAACR,UAAU,CAAC,CAAC,IAC3G;IAEJ,OAAA,WAAA,GACEc,OAAAC,aAAA,CAACC,MAAAA;QAAGC,MAAMf;QAAUgB,eAAatB;QAAYuB,WAAWlB;QAAcmB,KAAKpB,YAAY,MAAMF,IAAI,CAAC,EAAE,CAACsB,GAAG;OACrGjB,mBAAmBK,eAAAA,WAAAA,GAClBM,OAAAC,aAAA,CAACM,MAAAA;QACCF,WAAWtB,WAAWyB,cAAc;QACpCF,KAAKpB;QACLuB,OAAOZ;QACPa,cAAYb;QACZc,OAAM;qBAENX,OAAAC,aAAA,CAACW,QAAAA,MAAMlB,WAAW,CAACR,UAAU,IAGhCF,KAAK6B,GAAG,CAAC,CAACC,KAAcC,WAAAA,WAAAA,GACvBf,OAAAC,aAAA,CAACe,wCAAAA,EAAAA;YAAqB,GAAGnC,KAAK;YAAEyB,KAAKQ,IAAIR,GAAG;YAAEQ,KAAKA;YAAKC,UAAUA;;AAI1E"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["CalendarMonthHeaderRow.tsx"],"sourcesContent":["import * as React from 'react';\nimport { mergeClasses } from '@griffel/react';\nimport { DAYS_IN_WEEK } from '../../utils';\nimport type { CalendarDayGridProps, CalendarDayGridStyles } from './CalendarDayGrid.types';\nimport type { DayInfo } from './CalendarDayGrid';\n\n/**\n * @internal\n */\nexport interface CalendarDayMonthHeaderRowProps extends CalendarDayGridProps {\n weeks: DayInfo[][];\n classNames: CalendarDayGridStyles;\n}\n\n/**\n * @internal\n */\nexport const CalendarMonthHeaderRow: React.FunctionComponent<CalendarDayMonthHeaderRowProps> = props => {\n const { showWeekNumbers, strings, firstDayOfWeek, allFocusable, weeksToShow, weeks, classNames } = props;\n const dayLabels = strings.shortDays.slice();\n\n let firstOfMonthIndex = -1;\n const firstWeekOfMonth = weeks![1];\n for (let i = 0; i < weeks![1].length; i++) {\n if (firstWeekOfMonth[i].originalDate.getDate() === 1) {\n firstOfMonthIndex = i;\n break;\n }\n }\n\n if (weeksToShow === 1 && firstOfMonthIndex >= 0) {\n // if we only show one week, replace the header with short month name\n const firstOfMonthIndexOffset = (firstOfMonthIndex + firstDayOfWeek) % DAYS_IN_WEEK;\n dayLabels[firstOfMonthIndexOffset] = strings.shortMonths[weeks![1][firstOfMonthIndex].originalDate.getMonth()];\n }\n\n return (\n <tr>\n {showWeekNumbers && <th className={classNames.dayCell} />}\n {dayLabels.map((val: string, index: number) => {\n const i = (index + firstDayOfWeek) % DAYS_IN_WEEK;\n const label = strings.days[i];\n return (\n <th\n className={mergeClasses(classNames.dayCell, classNames.weekDayLabelCell)}\n scope=\"col\"\n key={dayLabels[i] + ' ' + index}\n title={label}\n aria-label={label}\n tabIndex={allFocusable ? 0 : undefined}\n >\n {dayLabels[i]}\n </th>\n );\n })}\n </tr>\n );\n};\n"],"names":["CalendarMonthHeaderRow","props","showWeekNumbers","strings","firstDayOfWeek","allFocusable","weeksToShow","weeks","classNames","dayLabels","shortDays","slice","firstOfMonthIndex","firstWeekOfMonth","i","length","originalDate","getDate","firstOfMonthIndexOffset","DAYS_IN_WEEK","shortMonths","getMonth","React","createElement","tr","th","className","dayCell","map","val","index","label","days","mergeClasses","weekDayLabelCell","scope","key","title","aria-label","tabIndex","undefined"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAiBaA;;;eAAAA;;;;iEAjBU;wBACM;uBACA;AAetB,MAAMA,yBAAkFC,CAAAA;IAC7F,MAAM,EAAEC,eAAe,EAAEC,OAAO,EAAEC,cAAc,EAAEC,YAAY,EAAEC,WAAW,EAAEC,KAAK,EAAEC,UAAU,EAAE,GAAGP;IACnG,MAAMQ,YAAYN,QAAQO,SAAS,CAACC,KAAK;IAEzC,IAAIC,oBAAoB,CAAC;IACzB,MAAMC,mBAAmBN,KAAM,CAAC,EAAE;IAClC,IAAK,IAAIO,IAAI,GAAGA,IAAIP,KAAM,CAAC,EAAE,CAACQ,MAAM,EAAED,IAAK;QACzC,IAAID,gBAAgB,CAACC,EAAE,CAACE,YAAY,CAACC,OAAO,OAAO,GAAG;YACpDL,oBAAoBE;YACpB;QACF;IACF;IAEA,IAAIR,gBAAgB,KAAKM,qBAAqB,GAAG;QAC/C,qEAAqE;QACrE,MAAMM,0BAA0B,AAACN,CAAAA,oBAAoBR,cAAAA,IAAkBe,mBAAAA;QACvEV,SAAS,CAACS,wBAAwB,GAAGf,QAAQiB,WAAW,CAACb,KAAM,CAAC,EAAE,CAACK,kBAAkB,CAACI,YAAY,CAACK,QAAQ,GAAG;IAChH;IAEA,OAAA,WAAA,GACEC,OAAAC,aAAA,CAACC,MAAAA,MACEtB,mBAAAA,WAAAA,GAAmBoB,OAAAC,aAAA,CAACE,MAAAA;QAAGC,WAAWlB,WAAWmB,OAAO;QACpDlB,UAAUmB,GAAG,CAAC,CAACC,KAAaC;QAC3B,MAAMhB,IAAI,AAACgB,CAAAA,QAAQ1B,cAAAA,IAAkBe,mBAAAA;QACrC,MAAMY,QAAQ5B,QAAQ6B,IAAI,CAAClB,EAAE;QAC7B,OAAA,WAAA,GACEQ,OAAAC,aAAA,CAACE,MAAAA;YACCC,WAAWO,IAAAA,oBAAAA,EAAazB,WAAWmB,OAAO,EAAEnB,WAAW0B,gBAAgB;YACvEC,OAAM;YACNC,KAAK3B,SAAS,CAACK,EAAE,GAAG,MAAMgB;YAC1BO,OAAON;YACPO,cAAYP;YACZQ,UAAUlC,eAAe,IAAImC;WAE5B/B,SAAS,CAACK,EAAE;IAGnB;AAGN"}
|
1
|
+
{"version":3,"sources":["../src/components/CalendarDayGrid/CalendarMonthHeaderRow.tsx"],"sourcesContent":["import * as React from 'react';\nimport { mergeClasses } from '@griffel/react';\nimport { DAYS_IN_WEEK } from '../../utils';\nimport type { CalendarDayGridProps, CalendarDayGridStyles } from './CalendarDayGrid.types';\nimport type { DayInfo } from './CalendarDayGrid';\n\n/**\n * @internal\n */\nexport interface CalendarDayMonthHeaderRowProps extends CalendarDayGridProps {\n weeks: DayInfo[][];\n classNames: CalendarDayGridStyles;\n}\n\n/**\n * @internal\n */\nexport const CalendarMonthHeaderRow: React.FunctionComponent<CalendarDayMonthHeaderRowProps> = props => {\n const { showWeekNumbers, strings, firstDayOfWeek, allFocusable, weeksToShow, weeks, classNames } = props;\n const dayLabels = strings.shortDays.slice();\n\n let firstOfMonthIndex = -1;\n const firstWeekOfMonth = weeks![1];\n for (let i = 0; i < weeks![1].length; i++) {\n if (firstWeekOfMonth[i].originalDate.getDate() === 1) {\n firstOfMonthIndex = i;\n break;\n }\n }\n\n if (weeksToShow === 1 && firstOfMonthIndex >= 0) {\n // if we only show one week, replace the header with short month name\n const firstOfMonthIndexOffset = (firstOfMonthIndex + firstDayOfWeek) % DAYS_IN_WEEK;\n dayLabels[firstOfMonthIndexOffset] = strings.shortMonths[weeks![1][firstOfMonthIndex].originalDate.getMonth()];\n }\n\n return (\n <tr>\n {showWeekNumbers && <th className={classNames.dayCell} />}\n {dayLabels.map((val: string, index: number) => {\n const i = (index + firstDayOfWeek) % DAYS_IN_WEEK;\n const label = strings.days[i];\n return (\n <th\n className={mergeClasses(classNames.dayCell, classNames.weekDayLabelCell)}\n scope=\"col\"\n key={dayLabels[i] + ' ' + index}\n title={label}\n aria-label={label}\n tabIndex={allFocusable ? 0 : undefined}\n >\n {dayLabels[i]}\n </th>\n );\n })}\n </tr>\n );\n};\n"],"names":["CalendarMonthHeaderRow","props","showWeekNumbers","strings","firstDayOfWeek","allFocusable","weeksToShow","weeks","classNames","dayLabels","shortDays","slice","firstOfMonthIndex","firstWeekOfMonth","i","length","originalDate","getDate","firstOfMonthIndexOffset","DAYS_IN_WEEK","shortMonths","getMonth","React","createElement","tr","th","className","dayCell","map","val","index","label","days","mergeClasses","weekDayLabelCell","scope","key","title","aria-label","tabIndex","undefined"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAiBaA;;;eAAAA;;;;iEAjBU;wBACM;uBACA;AAetB,MAAMA,yBAAkFC,CAAAA;IAC7F,MAAM,EAAEC,eAAe,EAAEC,OAAO,EAAEC,cAAc,EAAEC,YAAY,EAAEC,WAAW,EAAEC,KAAK,EAAEC,UAAU,EAAE,GAAGP;IACnG,MAAMQ,YAAYN,QAAQO,SAAS,CAACC,KAAK;IAEzC,IAAIC,oBAAoB,CAAC;IACzB,MAAMC,mBAAmBN,KAAM,CAAC,EAAE;IAClC,IAAK,IAAIO,IAAI,GAAGA,IAAIP,KAAM,CAAC,EAAE,CAACQ,MAAM,EAAED,IAAK;QACzC,IAAID,gBAAgB,CAACC,EAAE,CAACE,YAAY,CAACC,OAAO,OAAO,GAAG;YACpDL,oBAAoBE;YACpB;QACF;IACF;IAEA,IAAIR,gBAAgB,KAAKM,qBAAqB,GAAG;QAC/C,qEAAqE;QACrE,MAAMM,0BAA0B,AAACN,CAAAA,oBAAoBR,cAAAA,IAAkBe,mBAAAA;QACvEV,SAAS,CAACS,wBAAwB,GAAGf,QAAQiB,WAAW,CAACb,KAAM,CAAC,EAAE,CAACK,kBAAkB,CAACI,YAAY,CAACK,QAAQ,GAAG;IAChH;IAEA,OAAA,WAAA,GACEC,OAAAC,aAAA,CAACC,MAAAA,MACEtB,mBAAAA,WAAAA,GAAmBoB,OAAAC,aAAA,CAACE,MAAAA;QAAGC,WAAWlB,WAAWmB,OAAO;QACpDlB,UAAUmB,GAAG,CAAC,CAACC,KAAaC;QAC3B,MAAMhB,IAAI,AAACgB,CAAAA,QAAQ1B,cAAAA,IAAkBe,mBAAAA;QACrC,MAAMY,QAAQ5B,QAAQ6B,IAAI,CAAClB,EAAE;QAC7B,OAAA,WAAA,GACEQ,OAAAC,aAAA,CAACE,MAAAA;YACCC,WAAWO,IAAAA,oBAAAA,EAAazB,WAAWmB,OAAO,EAAEnB,WAAW0B,gBAAgB;YACvEC,OAAM;YACNC,KAAK3B,SAAS,CAACK,EAAE,GAAG,MAAMgB;YAC1BO,OAAON;YACPO,cAAYP;YACZQ,UAAUlC,eAAe,IAAImC;WAE5B/B,SAAS,CAACK,EAAE;IAGnB;AAGN"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["index.ts"],"sourcesContent":["export * from './CalendarDayGrid';\nexport * from './CalendarDayGrid.types';\nexport * from './useCalendarDayGridStyles.styles';\nexport { calendarDayGridClassNames, extraCalendarDayGridClassNames } from './useCalendarDayGridStyles.styles';\nexport type { WeekCorners } from './useWeekCornerStyles.styles';\n"],"names":["calendarDayGridClassNames","extraCalendarDayGridClassNames"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;;;;IAGSA,yBAAyB;eAAzBA,yDAAyB;;IAAEC,8BAA8B;eAA9BA,8DAA8B;;;;uBAHpD;uBACA;+DACA"}
|
1
|
+
{"version":3,"sources":["../src/components/CalendarDayGrid/index.ts"],"sourcesContent":["export * from './CalendarDayGrid';\nexport * from './CalendarDayGrid.types';\nexport * from './useCalendarDayGridStyles.styles';\nexport { calendarDayGridClassNames, extraCalendarDayGridClassNames } from './useCalendarDayGridStyles.styles';\nexport type { WeekCorners } from './useWeekCornerStyles.styles';\n"],"names":["calendarDayGridClassNames","extraCalendarDayGridClassNames"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;;;;IAGSA,yBAAyB;eAAzBA,yDAAyB;;IAAEC,8BAA8B;eAA9BA,8DAA8B;;;;uBAHpD;uBACA;+DACA"}
|
@@ -1118,4 +1118,4 @@ const useCalendarDayGridStyles_unstable = (props)=>{
|
|
1118
1118
|
dayMarker: (0, _react.mergeClasses)(calendarDayGridClassNames.dayMarker, dayMarkerStyles.base),
|
1119
1119
|
dayTodayMarker: (0, _react.mergeClasses)(calendarDayGridClassNames.dayTodayMarker, dayTodayMarkerStyles.base)
|
1120
1120
|
};
|
1121
|
-
};
|
1121
|
+
};
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["useWeeks.ts"],"sourcesContent":["import * as React from 'react';\nimport { compareDates, DAYS_IN_WEEK, getDayGrid } from '../../utils/index';\nimport { DayInfo } from './CalendarDayGrid';\nimport { CalendarDayGridProps } from './CalendarDayGrid.types';\n\n/**\n * @internal\n */\nexport function useWeeks(\n props: CalendarDayGridProps,\n onSelectDate: (date: Date) => void,\n getSetRefCallback: (dayKey: string) => (element: HTMLElement | null) => void,\n): DayInfo[][] {\n 'use no memo';\n\n /**\n * Initial parsing of the given props to generate IDayInfo two dimensional array, which contains a representation\n * of every day in the grid. Convenient for helping with conversions between day refs and Date objects in callbacks.\n */\n const weeks = React.useMemo((): DayInfo[][] => {\n const weeksGrid = getDayGrid(props);\n\n const firstVisibleDay = weeksGrid[1][0].originalDate;\n const lastVisibleDay = weeksGrid[weeksGrid.length - 1][6].originalDate;\n const markedDays = props.getMarkedDays?.(firstVisibleDay, lastVisibleDay) || [];\n\n /**\n * Weeks is a 2D array. Weeks[0] contains the last week of the prior range,\n * Weeks[weeks.length - 1] contains first week of next range. These are for transition states.\n *\n * Weeks[1... weeks.length - 2] contains the actual visible data\n */\n const returnValue: DayInfo[][] = [];\n\n for (let weekIndex = 0; weekIndex < weeksGrid.length; weekIndex++) {\n const week: DayInfo[] = [];\n for (let dayIndex = 0; dayIndex < DAYS_IN_WEEK; dayIndex++) {\n const day = weeksGrid[weekIndex][dayIndex];\n const dayInfo: DayInfo = {\n onSelected: () => onSelectDate(day.originalDate),\n setRef: getSetRefCallback(day.key),\n ...day,\n isMarked: day.isMarked || markedDays?.some(markedDay => compareDates(day.originalDate, markedDay)),\n };\n\n week.push(dayInfo);\n }\n returnValue.push(week);\n }\n\n return returnValue;\n // TODO: this is missing deps on getSetRefCallback and onSelectDate (and depending on the entire\n // props object may not be a good idea due to likely frequent mutation). It would be easy to\n // fix getSetRefCallback to not mutate every render, but onSelectDate is passed down from\n // Calendar and trying to fix it requires a huge cascade of changes.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [props]);\n\n return weeks;\n}\n"],"names":["useWeeks","props","onSelectDate","getSetRefCallback","weeks","React","useMemo","weeksGrid","getDayGrid","firstVisibleDay","originalDate","lastVisibleDay","length","markedDays","getMarkedDays","returnValue","weekIndex","week","dayIndex","DAYS_IN_WEEK","day","dayInfo","onSelected","setRef","key","isMarked","some","markedDay","compareDates","push"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAQgBA;;;eAAAA;;;;iEARO;uBACgC;AAOhD,SAASA,SACdC,KAA2B,EAC3BC,YAAkC,EAClCC,iBAA4E;IAE5E;IAEA;;;GAGC,GACD,MAAMC,QAAQC,OAAMC,OAAO,CAAC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areDates, DAYS_IN_WEEK, getDayGrid } from '../../utils/index';\nimport { DayInfo } from './CalendarDayGrid';\nimport { CalendarDayGridProps } from './CalendarDayGrid.types';\n\n/**\n * @internal\n */\nexport function useWeeks(\n props: CalendarDayGridProps,\n onSelectDate: (date: Date) => void,\n getSetRefCallback: (dayKey: string) => (element: HTMLElement | null) => void,\n): DayInfo[][] {\n 'use no memo';\n\n /**\n * Initial parsing of the given props to generate IDayInfo two dimensional array, which contains a representation\n * of every day in the grid. Convenient for helping with conversions between day refs and Date objects in callbacks.\n */\n const weeks = React.useMemo((): DayInfo[][] => {\n const weeksGrid = getDayGrid(props);\n\n const firstVisibleDay = weeksGrid[1][0].originalDate;\n const lastVisibleDay = weeksGrid[weeksGrid.length - 1][6].originalDate;\n const markedDays = props.getMarkedDays?.(firstVisibleDay, lastVisibleDay) || [];\n\n /**\n * Weeks is a 2D array. Weeks[0] contains the last week of the prior range,\n * Weeks[weeks.length - 1] contains first week of next range. These are for transition states.\n *\n * Weeks[1... weeks.length - 2] contains the actual visible data\n */\n const returnValue: DayInfo[][] = [];\n\n for (let weekIndex = 0; weekIndex < weeksGrid.length; weekIndex++) {\n const week: DayInfo[] = [];\n for (let dayIndex = 0; dayIndex < DAYS_IN_WEEK; dayIndex++) {\n const day = weeksGrid[weekIndex][dayIndex];\n const dayInfo: DayInfo = {\n onSelected: () => onSelectDate(day.originalDate),\n setRef: getSetRefCallback(day.key),\n ...day,\n isMarked: day.isMarked || markedDays?.some(markedDay => compareDates(day.originalDate, markedDay)),\n };\n\n week.push(dayInfo);\n }\n returnValue.push(week);\n }\n\n return returnValue;\n // TODO: this is missing deps on getSetRefCallback and onSelectDate (and depending on the entire\n // props object may not be a good idea due to likely frequent mutation). It would be easy to\n // fix getSetRefCallback to not mutate every render, but onSelectDate is passed down from\n // Calendar and trying to fix it requires a huge cascade of changes.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [props]);\n\n return weeks;\n}\n"],"names":["useWeeks","props","onSelectDate","getSetRefCallback","weeks","React","useMemo","weeksGrid","getDayGrid","firstVisibleDay","originalDate","lastVisibleDay","length","markedDays","getMarkedDays","returnValue","weekIndex","week","dayIndex","DAYS_IN_WEEK","day","dayInfo","onSelected","setRef","key","isMarked","some","markedDay","compareDates","push"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAQgBA;;;eAAAA;;;;iEARO;uBACgC;AAOhD,SAASA,SACdC,KAA2B,EAC3BC,YAAkC,EAClCC,iBAA4E;IAE5E;IAEA;;;GAGC,GACD,MAAMC,QAAQC,OAAMC,OAAO,CAAC;YAKPL;QAJnB,MAAMM,YAAYC,IAAAA,iBAAAA,EAAWP;QAE7B,MAAMQ,kBAAkBF,SAAS,CAAC,EAAE,CAAC,EAAE,CAACG,YAAY;QACpD,MAAMC,iBAAiBJ,SAAS,CAACA,UAAUK,MAAM,GAAG,EAAE,CAAC,EAAE,CAACF,YAAY;QACtE,MAAMG,aAAaZ,CAAAA,CAAAA,uBAAAA,MAAMa,aAAa,AAAbA,MAAa,QAAnBb,yBAAAA,KAAAA,IAAAA,KAAAA,IAAAA,qBAAAA,IAAAA,CAAAA,OAAsBQ,iBAAiBE,eAAAA,KAAmB,EAAE;QAE/E;;;;;KAKC,GACD,MAAMI,cAA2B,EAAE;QAEnC,IAAK,IAAIC,YAAY,GAAGA,YAAYT,UAAUK,MAAM,EAAEI,YAAa;YACjE,MAAMC,OAAkB,EAAE;YAC1B,IAAK,IAAIC,WAAW,GAAGA,WAAWC,mBAAAA,EAAcD,WAAY;gBAC1D,MAAME,MAAMb,SAAS,CAACS,UAAU,CAACE,SAAS;gBAC1C,MAAMG,UAAmB;oBACvBC,YAAY,IAAMpB,aAAakB,IAAIV,YAAY;oBAC/Ca,QAAQpB,kBAAkBiB,IAAII,GAAG;oBACjC,GAAGJ,GAAG;oBACNK,UAAUL,IAAIK,QAAQ,IAAIZ,CAAAA,eAAAA,QAAAA,eAAAA,KAAAA,IAAAA,KAAAA,IAAAA,WAAYa,IAAI,CAACC,CAAAA,YAAaC,IAAAA,mBAAAA,EAAaR,IAAIV,YAAY,EAAEiB,WAAAA;gBACzF;gBAEAV,KAAKY,IAAI,CAACR;YACZ;YACAN,YAAYc,IAAI,CAACZ;QACnB;QAEA,OAAOF;IACP,gGAAgG;IAChG,4FAA4F;IAC5F,yFAAyF;IACzF,oEAAoE;IACpE,uDAAuD;IACzD,GAAG;QAACd;KAAM;IAEV,OAAOG;AACT"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["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.yearPickerHeaderAriaLabel,\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":["CalendarMonth","MONTHS_PER_ROW","useAnimateBackwards","navigatedDate","currentYear","getFullYear","previousYearRef","React","useRef","useEffect","current","previousYear","undefined","useFocusLogic","componentRef","navigatedMonthRef","calendarYearRef","focusOnUpdate","focus","useCallback","useImperativeHandle","focusOnNextUpdate","props","allFocusable","animationDirection","className","dateTimeFormatter","DEFAULT_DATE_FORMATTING","highlightCurrentMonth","highlightSelectedMonth","maxDate","minDate","navigationIcons","onHeaderSelect","onUserHeaderSelect","onNavigateDate","selectedDate","strings","today","Date","yearPickerHidden","isYearPickerVisible","setIsYearPickerVisible","useState","animateBackwards","selectMonthCallback","newMonth","onSelectMonth","onSelectNextYear","addYears","onSelectPrevYear","setMonth","onSelectYear","selectedYear","navYear","newNavigationDate","getTime","setFullYear","getMonth","onYearPickerHeaderSelect","dateFormatter","isPrevYearInBounds","compareDatePart","getYearStart","isNextYearInBounds","getYearEnd","classNames","useCalendarMonthStyles_unstable","hasHeaderClickCallback","highlightCurrent","highlightSelected","arrowNavigationAttributes","useArrowNavigationGroup","axis","onRenderYear","yearStrings","getYearStrings","createElement","CalendarYear","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","mergeClasses","navigationButton","disabled","aria-disabled","title","prevYearAriaLabel","upNavigation","nextYearAriaLabel","downNavigation","gridContainer","role","map","rowNum","monthsForRow","slice","buttonRow","month","index","monthIndex","indexedMonth","isNavigatedMonth","isSelectedMonth","isSelectedYear","isInBounds","getMonthEnd","getMonthStart","ref","itemButton","isCurrentMonth","selected","formatMonth","aria-selected","displayName","yearToString","year","yearFormattingDate","String","yearRangeToString","yearRange","fromYear","toYear","yearRangeToNextDecadeLabel","nextYearRangeAriaLabel","yearRangeToPrevDecadeLabel","prevYearRangeAriaLabel","rangeAriaLabel","prevRangeAriaLabel","nextRangeAriaLabel","headerAriaLabelFormatString","yearPickerHeaderAriaLabel","callback","ev","Enter"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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,kBAAkBiE,UAAU,CAACsD;QACtC;QACA,OAAOC,OAAOF;IAChB;IAEA,MAAMG,oBAAoB,CAACC;QACzB,OAAO,CAAC,EAAEL,aAAaK,UAAUC,QAAQ,EAAE,GAAG,EAAEN,aAAaK,UAAUE,MAAM,EAAE,CAAC;IAClF;IAEA,MAAMC,6BAA6B,CAACH;QAClC,OAAO/G,QAAQmH,sBAAsB,GAAG,CAAC,EAAEnH,QAAQmH,sBAAsB,CAAC,CAAC,EAAEL,kBAAkBC,WAAW,CAAC,GAAG;IAChH;IAEA,MAAMK,6BAA6B,CAACL;QAClC,OAAO/G,QAAQqH,sBAAsB,GAAG,CAAC,EAAErH,QAAQqH,sBAAsB,CAAC,CAAC,EAAEP,kBAAkBC,WAAW,CAAC,GAAG;IAChH;IAEA,OAAO;QACLL;QACA;YACEY,gBAAgBR;YAChBS,oBAAoBH;YACpBI,oBAAoBN;YACpBO,6BAA6BzH,QAAQ0H,yBAAyB;QAChE;KACD;AACH;AAEA,SAASrB,eAAeZ,KAAa,EAAEkB,IAAY,EAAE1G,KAAW;IAC9D,OAAOA,MAAMjC,WAAW,OAAO2I,QAAQ1G,MAAMoB,QAAQ,OAAOoE;AAC9D;AAEA,SAASxB,gBAAgB0D,QAAoB;IAC3C,OAAO,CAACC;QACN,OAAQA,GAAGlF,GAAG;YACZ,KAAKmF,mBAAAA;gBACHF;gBACA;QACJ;IACF;AACF"}
|
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.yearPickerHeaderAriaLabel,\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":["CalendarMonth","MONTHS_PER_ROW","useAnimateBackwards","navigatedDate","currentYear","getFullYear","previousYearRef","React","useRef","useEffect","current","previousYear","undefined","useFocusLogic","componentRef","navigatedMonthRef","calendarYearRef","focusOnUpdate","focus","useCallback","useImperativeHandle","focusOnNextUpdate","props","allFocusable","animationDirection","className","dateTimeFormatter","DEFAULT_DATE_FORMATTING","highlightCurrentMonth","highlightSelectedMonth","maxDate","minDate","navigationIcons","onHeaderSelect","onUserHeaderSelect","onNavigateDate","selectedDate","strings","today","Date","yearPickerHidden","isYearPickerVisible","setIsYearPickerVisible","useState","animateBackwards","selectMonthCallback","newMonth","onSelectMonth","onSelectNextYear","addYears","onSelectPrevYear","setMonth","onSelectYear","selectedYear","navYear","newNavigationDate","getTime","setFullYear","getMonth","onYearPickerHeaderSelect","dateFormatter","isPrevYearInBounds","compareDatePart","getYearStart","isNextYearInBounds","getYearEnd","classNames","useCalendarMonthStyles_unstable","hasHeaderClickCallback","highlightCurrent","highlightSelected","arrowNavigationAttributes","useArrowNavigationGroup","axis","onRenderYear","yearStrings","getYearStrings","createElement","CalendarYear","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","mergeClasses","navigationButton","disabled","aria-disabled","title","prevYearAriaLabel","upNavigation","nextYearAriaLabel","downNavigation","gridContainer","role","map","rowNum","monthsForRow","slice","buttonRow","month","index","monthIndex","indexedMonth","isNavigatedMonth","isSelectedMonth","isSelectedYear","isInBounds","getMonthEnd","getMonthStart","ref","itemButton","isCurrentMonth","selected","formatMonth","aria-selected","displayName","yearToString","year","yearFormattingDate","String","yearRangeToString","yearRange","fromYear","toYear","yearRangeToNextDecadeLabel","nextYearRangeAriaLabel","yearRangeToPrevDecadeLabel","prevYearRangeAriaLabel","rangeAriaLabel","prevRangeAriaLabel","nextRangeAriaLabel","headerAriaLabelFormatString","yearPickerHeaderAriaLabel","callback","ev","Enter"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAqEaA;;;eAAAA;;;;iEArEU;8BACD;8BACkB;wBACX;uBAUtB;8BACsB;8CACmB;AAIhD,MAAMC,iBAAiB;AAEvB,SAASC,oBAAoB,EAAEC,aAAa,EAA0D;IACpG,MAAMC,cAAcD,cAAcE,WAAW;IAE7C,MAAMC,kBAAkBC,OAAMC,MAAM;IACpCD,OAAME,SAAS,CAAC;QACdH,gBAAgBI,OAAO,GAAGN;IAC5B;IACA,MAAMO,eAAeL,gBAAgBI,OAAO;IAE5C,IAAIC,iBAAiBC,aAAaD,iBAAiBP,aAAa;QAC9D,OAAOQ;IACT,OAAO;QACL,OAAOD,eAAeP;IACxB;AACF;AAEA,SAASS,cAAc,EAAEC,YAAY,EAAwD;IAC3F,MAAMC,oBAAoBR,OAAMC,MAAM,CAAoB;IAC1D,MAAMQ,kBAAkBT,OAAMC,MAAM,CAAgB;IACpD,MAAMS,gBAAgBV,OAAMC,MAAM,CAAC;IAEnC,MAAMU,QAAQX,OAAMY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,WAAW,OAAO2I,QAAQ1G,MAAMoB,QAAQ,OAAOoE;AAC9D;AAEA,SAASxB,gBAAgB0D,QAAoB;IAC3C,OAAO,CAACC;QACN,OAAQA,GAAGlF,GAAG;YACZ,KAAKmF,mBAAAA;gBACHF;gBACA;QACJ;IACF;AACF"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["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":[],"rangeMappings":";;;;;","mappings":";;;;;iEAAuB"}
|
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":[],"rangeMappings":";;;;;","mappings":";;;;;iEAAuB"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["index.ts"],"sourcesContent":["export * from './CalendarMonth';\nexport * from './CalendarMonth.types';\nexport * from './useCalendarMonthStyles.styles';\n"],"names":[],"rangeMappings":";;;;;;;","mappings":";;;;;uBAAc;uBACA;uBACA"}
|
1
|
+
{"version":3,"sources":["../src/components/CalendarMonth/index.ts"],"sourcesContent":["export * from './CalendarMonth';\nexport * from './CalendarMonth.types';\nexport * from './useCalendarMonthStyles.styles';\n"],"names":[],"rangeMappings":";;;;;;;","mappings":";;;;;uBAAc;uBACA;uBACA"}
|
@@ -12,4 +12,4 @@ const _useCalendarPickerStylesstyles = require("../CalendarPicker/useCalendarPic
|
|
12
12
|
const useCalendarMonthStyles_unstable = (props)=>{
|
13
13
|
'use no memo';
|
14
14
|
return (0, _useCalendarPickerStylesstyles.useCalendarPickerStyles_unstable)(props);
|
15
|
-
};
|
15
|
+
};
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["CalendarPicker.types.ts"],"sourcesContent":["import { AnimationDirection } from '../Calendar/Calendar.types';\n\n/**\n * @internal\n */\nexport interface CalendarPickerStyleProps {\n /**\n * Accept custom classNames\n */\n className?: string;\n\n /**\n * Whether the header can be clicked\n */\n hasHeaderClickCallback?: boolean;\n\n /**\n * Whether the picker should highlight the current item\n */\n highlightCurrent?: boolean;\n\n /**\n * Whether the picker should highlight the selected item\n */\n highlightSelected?: boolean;\n\n /**\n * The cardinal directions for animation to occur during transitions, either horizontal or veritcal\n */\n animationDirection?: AnimationDirection;\n\n /**\n * Whether grid entering animation should be forwards or backwards\n */\n animateBackwards?: boolean;\n}\n\n/**\n * @internal\n */\nexport interface CalendarPickerStyles {\n /**\n * Style for the root element.\n */\n root: string;\n\n headerContainer: string;\n\n currentItemButton: string;\n\n navigationButtonsContainer: string;\n\n navigationButton: string;\n\n gridContainer: string;\n\n buttonRow: string;\n\n itemButton: string;\n\n current: string;\n\n selected: string;\n\n disabled: string;\n}\n"],"names":[],"rangeMappings":";;","mappings":"AAqCA;;CAEC"}
|
1
|
+
{"version":3,"sources":["../src/components/CalendarPicker/CalendarPicker.types.ts"],"sourcesContent":["import { AnimationDirection } from '../Calendar/Calendar.types';\n\n/**\n * @internal\n */\nexport interface CalendarPickerStyleProps {\n /**\n * Accept custom classNames\n */\n className?: string;\n\n /**\n * Whether the header can be clicked\n */\n hasHeaderClickCallback?: boolean;\n\n /**\n * Whether the picker should highlight the current item\n */\n highlightCurrent?: boolean;\n\n /**\n * Whether the picker should highlight the selected item\n */\n highlightSelected?: boolean;\n\n /**\n * The cardinal directions for animation to occur during transitions, either horizontal or veritcal\n */\n animationDirection?: AnimationDirection;\n\n /**\n * Whether grid entering animation should be forwards or backwards\n */\n animateBackwards?: boolean;\n}\n\n/**\n * @internal\n */\nexport interface CalendarPickerStyles {\n /**\n * Style for the root element.\n */\n root: string;\n\n headerContainer: string;\n\n currentItemButton: string;\n\n navigationButtonsContainer: string;\n\n navigationButton: string;\n\n gridContainer: string;\n\n buttonRow: string;\n\n itemButton: string;\n\n current: string;\n\n selected: string;\n\n disabled: string;\n}\n"],"names":[],"rangeMappings":";;","mappings":"AAqCA;;CAEC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["index.ts"],"sourcesContent":["export * from './CalendarPicker.types';\nexport * from './useCalendarPickerStyles.styles';\n"],"names":[],"rangeMappings":";;;;;;","mappings":";;;;;uBAAc;uBACA"}
|
1
|
+
{"version":3,"sources":["../src/components/CalendarPicker/index.ts"],"sourcesContent":["export * from './CalendarPicker.types';\nexport * from './useCalendarPickerStyles.styles';\n"],"names":[],"rangeMappings":";;;;;;","mappings":";;;;;uBAAc;uBACA"}
|
@@ -770,4 +770,4 @@ const useCalendarPickerStyles_unstable = (props)=>{
|
|
770
770
|
current: (0, _react.mergeClasses)(calendarPickerClassNames.current, highlightCurrent && currentStyles.highlightCurrent),
|
771
771
|
disabled: (0, _react.mergeClasses)(calendarPickerClassNames.disabled, disabledStyles.base)
|
772
772
|
};
|
773
|
-
};
|
773
|
+
};
|