@fluentui/react-calendar-compat 0.4.2 → 0.4.4
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 +26 -2
- package/lib/components/Calendar/useCalendarStyles.styles.js +1 -0
- package/lib/components/Calendar/useCalendarStyles.styles.js.map +1 -1
- package/lib/components/Calendar/useCalendarStyles.styles.raw.js +1 -1
- package/lib/components/Calendar/useCalendarStyles.styles.raw.js.map +1 -1
- package/lib/components/CalendarDay/CalendarDay.js +2 -1
- package/lib/components/CalendarDay/CalendarDay.js.map +1 -1
- package/lib/components/CalendarDay/useCalendarDayStyles.styles.js +3 -10
- package/lib/components/CalendarDay/useCalendarDayStyles.styles.js.map +1 -1
- package/lib/components/CalendarDay/useCalendarDayStyles.styles.raw.js +2 -9
- package/lib/components/CalendarDay/useCalendarDayStyles.styles.raw.js.map +1 -1
- package/lib/components/CalendarDayGrid/CalendarDayGrid.js +30 -8
- package/lib/components/CalendarDayGrid/CalendarDayGrid.js.map +1 -1
- package/lib/components/CalendarDayGrid/CalendarGridDayCell.js +1 -1
- package/lib/components/CalendarDayGrid/CalendarGridDayCell.js.map +1 -1
- package/lib/components/CalendarDayGrid/CalendarGridRow.js +6 -5
- package/lib/components/CalendarDayGrid/CalendarGridRow.js.map +1 -1
- package/lib/components/CalendarDayGrid/CalendarMonthHeaderRow.js +10 -3
- package/lib/components/CalendarDayGrid/CalendarMonthHeaderRow.js.map +1 -1
- package/lib/components/CalendarDayGrid/useCalendarDayGridStyles.styles.js +16 -58
- package/lib/components/CalendarDayGrid/useCalendarDayGridStyles.styles.js.map +1 -1
- package/lib/components/CalendarDayGrid/useCalendarDayGridStyles.styles.raw.js +12 -67
- package/lib/components/CalendarDayGrid/useCalendarDayGridStyles.styles.raw.js.map +1 -1
- package/lib/components/CalendarDayGrid/useWeeks.js +0 -1
- package/lib/components/CalendarDayGrid/useWeeks.js.map +1 -1
- package/lib/components/CalendarMonth/CalendarMonth.js +10 -4
- package/lib/components/CalendarMonth/CalendarMonth.js.map +1 -1
- package/lib/components/CalendarMonth/useCalendarMonthStyles.styles.js +1 -0
- package/lib/components/CalendarMonth/useCalendarMonthStyles.styles.js.map +1 -1
- package/lib/components/CalendarMonth/useCalendarMonthStyles.styles.raw.js +1 -1
- package/lib/components/CalendarMonth/useCalendarMonthStyles.styles.raw.js.map +1 -1
- package/lib/components/CalendarPicker/useCalendarPickerStyles.styles.js +5 -33
- package/lib/components/CalendarPicker/useCalendarPickerStyles.styles.js.map +1 -1
- package/lib/components/CalendarPicker/useCalendarPickerStyles.styles.raw.js +4 -41
- package/lib/components/CalendarPicker/useCalendarPickerStyles.styles.raw.js.map +1 -1
- package/lib/components/CalendarYear/CalendarYear.js +17 -12
- package/lib/components/CalendarYear/CalendarYear.js.map +1 -1
- package/lib/components/CalendarYear/useCalendarYearStyles.styles.js +1 -0
- package/lib/components/CalendarYear/useCalendarYearStyles.styles.js.map +1 -1
- package/lib/components/CalendarYear/useCalendarYearStyles.styles.raw.js +1 -1
- package/lib/components/CalendarYear/useCalendarYearStyles.styles.raw.js.map +1 -1
- package/lib/utils/animations.js +24 -18
- package/lib/utils/animations.js.map +1 -1
- package/lib/utils/calendarMotions.js +93 -0
- package/lib/utils/calendarMotions.js.map +1 -0
- package/lib/utils/index.js +2 -2
- package/lib/utils/index.js.map +1 -1
- package/lib-commonjs/components/Calendar/useCalendarStyles.styles.js +1 -0
- package/lib-commonjs/components/Calendar/useCalendarStyles.styles.js.map +1 -1
- package/lib-commonjs/components/Calendar/useCalendarStyles.styles.raw.js +1 -1
- package/lib-commonjs/components/Calendar/useCalendarStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/CalendarDay/CalendarDay.js +2 -1
- package/lib-commonjs/components/CalendarDay/CalendarDay.js.map +1 -1
- package/lib-commonjs/components/CalendarDay/useCalendarDayStyles.styles.js +3 -15
- package/lib-commonjs/components/CalendarDay/useCalendarDayStyles.styles.js.map +1 -1
- package/lib-commonjs/components/CalendarDay/useCalendarDayStyles.styles.raw.js +2 -9
- package/lib-commonjs/components/CalendarDay/useCalendarDayStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/CalendarDayGrid/CalendarDayGrid.js +30 -8
- package/lib-commonjs/components/CalendarDayGrid/CalendarDayGrid.js.map +1 -1
- package/lib-commonjs/components/CalendarDayGrid/CalendarGridDayCell.js +1 -1
- package/lib-commonjs/components/CalendarDayGrid/CalendarGridDayCell.js.map +1 -1
- package/lib-commonjs/components/CalendarDayGrid/CalendarGridRow.js +6 -5
- package/lib-commonjs/components/CalendarDayGrid/CalendarGridRow.js.map +1 -1
- package/lib-commonjs/components/CalendarDayGrid/CalendarMonthHeaderRow.js +9 -3
- package/lib-commonjs/components/CalendarDayGrid/CalendarMonthHeaderRow.js.map +1 -1
- package/lib-commonjs/components/CalendarDayGrid/useCalendarDayGridStyles.styles.js +16 -98
- package/lib-commonjs/components/CalendarDayGrid/useCalendarDayGridStyles.styles.js.map +1 -1
- package/lib-commonjs/components/CalendarDayGrid/useCalendarDayGridStyles.styles.raw.js +12 -67
- package/lib-commonjs/components/CalendarDayGrid/useCalendarDayGridStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/CalendarDayGrid/useWeeks.js +0 -1
- package/lib-commonjs/components/CalendarDayGrid/useWeeks.js.map +1 -1
- package/lib-commonjs/components/CalendarMonth/CalendarMonth.js +10 -4
- package/lib-commonjs/components/CalendarMonth/CalendarMonth.js.map +1 -1
- package/lib-commonjs/components/CalendarMonth/useCalendarMonthStyles.styles.js +1 -0
- package/lib-commonjs/components/CalendarMonth/useCalendarMonthStyles.styles.js.map +1 -1
- package/lib-commonjs/components/CalendarMonth/useCalendarMonthStyles.styles.raw.js +1 -1
- package/lib-commonjs/components/CalendarMonth/useCalendarMonthStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/CalendarPicker/useCalendarPickerStyles.styles.js +6 -56
- package/lib-commonjs/components/CalendarPicker/useCalendarPickerStyles.styles.js.map +1 -1
- package/lib-commonjs/components/CalendarPicker/useCalendarPickerStyles.styles.raw.js +4 -41
- package/lib-commonjs/components/CalendarPicker/useCalendarPickerStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/CalendarYear/CalendarYear.js +17 -12
- package/lib-commonjs/components/CalendarYear/CalendarYear.js.map +1 -1
- package/lib-commonjs/components/CalendarYear/useCalendarYearStyles.styles.js +1 -0
- package/lib-commonjs/components/CalendarYear/useCalendarYearStyles.styles.js.map +1 -1
- package/lib-commonjs/components/CalendarYear/useCalendarYearStyles.styles.raw.js +1 -1
- package/lib-commonjs/components/CalendarYear/useCalendarYearStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/utils/animations.js +12 -11
- package/lib-commonjs/utils/animations.js.map +1 -1
- package/lib-commonjs/utils/calendarMotions.js +105 -0
- package/lib-commonjs/utils/calendarMotions.js.map +1 -0
- package/lib-commonjs/utils/index.js +1 -1
- package/lib-commonjs/utils/index.js.map +1 -1
- package/package.json +6 -4
|
@@ -20,6 +20,8 @@ const _CalendarGridRow = require("./CalendarGridRow");
|
|
|
20
20
|
const _useWeeks = require("./useWeeks");
|
|
21
21
|
const _useWeekCornerStylesstyles = require("./useWeekCornerStyles.styles");
|
|
22
22
|
const _react1 = require("@griffel/react");
|
|
23
|
+
const _calendarMotions = require("../../utils/calendarMotions");
|
|
24
|
+
const _Calendar = require("../../Calendar");
|
|
23
25
|
function useDayRefs() {
|
|
24
26
|
const daysRef = _react.useRef({});
|
|
25
27
|
const getSetRefCallback = (dayKey)=>(element)=>{
|
|
@@ -102,7 +104,7 @@ const CalendarDayGrid = (props)=>{
|
|
|
102
104
|
dayRefs = dayInfosInRange.map((dayInfo)=>daysRef.current[dayInfo.key]);
|
|
103
105
|
return dayRefs;
|
|
104
106
|
};
|
|
105
|
-
const { gridLabel, dateRangeType, showWeekNumbers, labelledBy, lightenDaysOutsideNavigatedMonth, animationDirection } = props;
|
|
107
|
+
const { gridLabel, dateRangeType, showWeekNumbers, labelledBy, lightenDaysOutsideNavigatedMonth, animationDirection = _Calendar.AnimationDirection.Vertical } = props;
|
|
106
108
|
const classNames = (0, _useCalendarDayGridStylesstyles.useCalendarDayGridStyles_unstable)({
|
|
107
109
|
animateBackwards,
|
|
108
110
|
animationDirection,
|
|
@@ -125,6 +127,12 @@ const CalendarDayGrid = (props)=>{
|
|
|
125
127
|
const arrowNavigationAttributes = (0, _reacttabster.useArrowNavigationGroup)({
|
|
126
128
|
axis: 'grid-linear'
|
|
127
129
|
});
|
|
130
|
+
const firstWeek = weeks[0];
|
|
131
|
+
const finalWeek = weeks[weeks.length - 1];
|
|
132
|
+
// Single navigation epoch for all rows in the grid. Derived from the first visible day's key
|
|
133
|
+
// (`Date.toString()`), which changes when the user navigates to a different month but stays
|
|
134
|
+
// stable across intra-month interactions (e.g. day selection).
|
|
135
|
+
const navigationEpoch = firstWeek[0].key;
|
|
128
136
|
return /*#__PURE__*/ _react.createElement("table", {
|
|
129
137
|
className: (0, _react1.mergeClasses)(classNames.table, props.className),
|
|
130
138
|
"aria-multiselectable": "false",
|
|
@@ -137,30 +145,44 @@ const CalendarDayGrid = (props)=>{
|
|
|
137
145
|
...props,
|
|
138
146
|
classNames: classNames,
|
|
139
147
|
weeks: weeks
|
|
140
|
-
}), /*#__PURE__*/ _react.createElement(
|
|
148
|
+
}), /*#__PURE__*/ _react.createElement(_calendarMotions.DirectionalSlideOut, {
|
|
149
|
+
edge: "first",
|
|
150
|
+
replayKey: navigationEpoch,
|
|
151
|
+
animationDirection: animationDirection,
|
|
152
|
+
animateBackwards: animateBackwards
|
|
153
|
+
}, /*#__PURE__*/ _react.createElement(_CalendarGridRow.CalendarGridRow, {
|
|
141
154
|
...props,
|
|
142
155
|
...partialWeekProps,
|
|
143
|
-
week:
|
|
156
|
+
week: firstWeek,
|
|
144
157
|
weekIndex: -1,
|
|
145
158
|
rowClassName: classNames.firstTransitionWeek,
|
|
146
159
|
"aria-role": "presentation",
|
|
147
160
|
ariaHidden: true
|
|
148
|
-
}), weeks.slice(1, weeks.length - 1).map((week, weekIndex)=>/*#__PURE__*/ _react.createElement(
|
|
161
|
+
})), weeks.slice(1, weeks.length - 1).map((week, weekIndex)=>/*#__PURE__*/ _react.createElement(_calendarMotions.DirectionalSlideIn, {
|
|
162
|
+
key: weekIndex,
|
|
163
|
+
replayKey: navigationEpoch,
|
|
164
|
+
animationDirection: animationDirection,
|
|
165
|
+
animateBackwards: animateBackwards
|
|
166
|
+
}, /*#__PURE__*/ _react.createElement(_CalendarGridRow.CalendarGridRow, {
|
|
149
167
|
...props,
|
|
150
168
|
...partialWeekProps,
|
|
151
|
-
key: weekIndex,
|
|
152
169
|
week: week,
|
|
153
170
|
weekIndex: weekIndex,
|
|
154
171
|
rowClassName: classNames.weekRow
|
|
155
|
-
})), /*#__PURE__*/ _react.createElement(
|
|
172
|
+
}))), /*#__PURE__*/ _react.createElement(_calendarMotions.DirectionalSlideOut, {
|
|
173
|
+
edge: "last",
|
|
174
|
+
replayKey: navigationEpoch,
|
|
175
|
+
animationDirection: animationDirection,
|
|
176
|
+
animateBackwards: animateBackwards
|
|
177
|
+
}, /*#__PURE__*/ _react.createElement(_CalendarGridRow.CalendarGridRow, {
|
|
156
178
|
...props,
|
|
157
179
|
...partialWeekProps,
|
|
158
|
-
week:
|
|
180
|
+
week: finalWeek,
|
|
159
181
|
weekIndex: -2,
|
|
160
182
|
rowClassName: classNames.lastTransitionWeek,
|
|
161
183
|
"aria-role": "presentation",
|
|
162
184
|
ariaHidden: true
|
|
163
|
-
})));
|
|
185
|
+
}))));
|
|
164
186
|
};
|
|
165
187
|
CalendarDayGrid.displayName = 'CalendarDayGrid';
|
|
166
188
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/CalendarDayGrid/CalendarDayGrid.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { useArrowNavigationGroup } from '@fluentui/react-tabster';\nimport { useId } from '@fluentui/react-utilities';\nimport { getBoundedDateRange, getDateRangeArray, isRestrictedDate, DateRangeType } from '../../utils';\nimport { useCalendarDayGridStyles_unstable } from './useCalendarDayGridStyles.styles';\nimport { CalendarMonthHeaderRow } from './CalendarMonthHeaderRow';\nimport { CalendarGridRow } from './CalendarGridRow';\nimport { useWeeks } from './useWeeks';\nimport type { WeekCorners } from './useWeekCornerStyles.styles';\nimport { useWeekCornerStyles } from './useWeekCornerStyles.styles';\nimport { mergeClasses } from '@griffel/react';\nimport type { Day, DayOfWeek } from '../../utils';\nimport type { CalendarDayGridProps } from './CalendarDayGrid.types';\n\nexport interface DayInfo extends Day {\n onSelected: () => void;\n setRef(element: HTMLElement | null): void;\n}\n\nfunction useDayRefs() {\n const daysRef = React.useRef<Record<string, HTMLElement>>({});\n\n const getSetRefCallback = (dayKey: string) => (element: HTMLElement | null) => {\n if (element === null) {\n delete daysRef.current[dayKey];\n } else {\n daysRef.current[dayKey] = element;\n }\n };\n\n return [daysRef, getSetRefCallback] as const;\n}\n\nfunction useAnimateBackwards(weeks: DayInfo[][]): boolean | undefined {\n const previousNavigatedDateRef = React.useRef<Date | undefined>(undefined);\n React.useEffect(() => {\n previousNavigatedDateRef.current = weeks[0][0].originalDate;\n });\n const previousNavigatedDate = previousNavigatedDateRef.current;\n\n // eslint-disable-next-line react-hooks/refs\n if (!previousNavigatedDate || previousNavigatedDate.getTime() === weeks[0][0].originalDate.getTime()) {\n return undefined;\n // eslint-disable-next-line react-hooks/refs\n } else if (previousNavigatedDate <= weeks[0][0].originalDate) {\n return false;\n } else {\n return true;\n }\n}\n\nexport const CalendarDayGrid: React.FunctionComponent<CalendarDayGridProps> = props => {\n const navigatedDayRef = React.useRef<HTMLTableCellElement>(\n null,\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n ) as React.MutableRefObject<HTMLTableCellElement | null>;\n\n const activeDescendantId = useId();\n\n const onSelectDate = (selectedDate: Date): void => {\n const { firstDayOfWeek, minDate, maxDate, workWeekDays, daysToSelectInDayView, restrictedDates } = props;\n const restrictedDatesOptions = { minDate, maxDate, restrictedDates };\n\n // eslint-disable-next-line react-hooks/immutability\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-linear' });\n\n return (\n <table\n className={mergeClasses(classNames.table, props.className)}\n aria-multiselectable=\"false\"\n aria-label={gridLabel}\n aria-labelledby={labelledBy}\n aria-activedescendant={activeDescendantId}\n role=\"grid\"\n {...arrowNavigationAttributes}\n >\n <tbody>\n <CalendarMonthHeaderRow {...props} classNames={classNames} weeks={weeks} />\n <CalendarGridRow\n {...props}\n {...partialWeekProps}\n week={weeks[0]}\n weekIndex={-1}\n rowClassName={classNames.firstTransitionWeek}\n aria-role=\"presentation\"\n ariaHidden={true}\n />\n {weeks!.slice(1, weeks!.length - 1).map((week: DayInfo[], weekIndex: number) => (\n <CalendarGridRow\n {...props}\n {...partialWeekProps}\n key={weekIndex}\n week={week}\n weekIndex={weekIndex}\n rowClassName={classNames.weekRow}\n />\n ))}\n <CalendarGridRow\n {...props}\n {...partialWeekProps}\n week={weeks![weeks!.length - 1]}\n weekIndex={-2}\n rowClassName={classNames.lastTransitionWeek}\n aria-role=\"presentation\"\n ariaHidden={true}\n />\n </tbody>\n </table>\n );\n};\nCalendarDayGrid.displayName = 'CalendarDayGrid';\n\n/**\n * When given work week, if the days are non-contiguous, the hover states look really weird. So for non-contiguous\n * work weeks, we'll just show week view instead.\n */\nfunction getDateRangeTypeToUse(dateRangeType: DateRangeType, workWeekDays: DayOfWeek[] | undefined): DateRangeType {\n if (workWeekDays && dateRangeType === DateRangeType.WorkWeek) {\n const sortedWWDays = workWeekDays.slice().sort();\n let isContiguous = true;\n for (let i = 1; i < sortedWWDays.length; i++) {\n if (sortedWWDays[i] !== sortedWWDays[i - 1] + 1) {\n isContiguous = false;\n break;\n }\n }\n\n if (!isContiguous || workWeekDays.length === 0) {\n return DateRangeType.Week;\n }\n }\n\n return dateRangeType;\n}\n"],"names":["React","useArrowNavigationGroup","useId","getBoundedDateRange","getDateRangeArray","isRestrictedDate","DateRangeType","useCalendarDayGridStyles_unstable","CalendarMonthHeaderRow","CalendarGridRow","useWeeks","useWeekCornerStyles","mergeClasses","useDayRefs","daysRef","useRef","getSetRefCallback","dayKey","element","current","useAnimateBackwards","weeks","previousNavigatedDateRef","undefined","useEffect","originalDate","previousNavigatedDate","getTime","CalendarDayGrid","props","navigatedDayRef","activeDescendantId","onSelectDate","selectedDate","firstDayOfWeek","minDate","maxDate","workWeekDays","daysToSelectInDayView","restrictedDates","restrictedDatesOptions","dateRange","dateRangeType","filter","d","onNavigateDate","animateBackwards","getWeekCornerStyles","calculateRoundedStyles","useImperativeHandle","componentRef","focus","getDayInfosInRangeOfDay","dayToCompare","dateRangeHoverType","getDateRangeTypeToUse","map","date","dayInfosInRange","reduce","accumulatedValue","currentWeek","concat","weekDay","indexOf","getRefsFromDayInfos","dayRefs","dayInfo","key","gridLabel","showWeekNumbers","labelledBy","lightenDaysOutsideNavigatedMonth","animationDirection","classNames","weekCorners","partialWeekProps","arrowNavigationAttributes","axis","table","className","aria-multiselectable","aria-label","aria-labelledby","aria-activedescendant","role","tbody","week","weekIndex","rowClassName","firstTransitionWeek","aria-role","ariaHidden","slice","length","weekRow","lastTransitionWeek","displayName","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BhE,aAAayD,MAAM,KAAK,GAAG;YAC9C,OAAOxF,oBAAAA,CAAciG,IAAI;QAC3B;IACF;IAEA,OAAO7D;AACT"}
|
|
1
|
+
{"version":3,"sources":["../src/components/CalendarDayGrid/CalendarDayGrid.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { useArrowNavigationGroup } from '@fluentui/react-tabster';\nimport { useId } from '@fluentui/react-utilities';\nimport { getBoundedDateRange, getDateRangeArray, isRestrictedDate, DateRangeType } from '../../utils';\nimport { useCalendarDayGridStyles_unstable } from './useCalendarDayGridStyles.styles';\nimport { CalendarMonthHeaderRow } from './CalendarMonthHeaderRow';\nimport { CalendarGridRow } from './CalendarGridRow';\nimport { useWeeks } from './useWeeks';\nimport type { WeekCorners } from './useWeekCornerStyles.styles';\nimport { useWeekCornerStyles } from './useWeekCornerStyles.styles';\nimport { mergeClasses } from '@griffel/react';\nimport type { Day, DayOfWeek } from '../../utils';\nimport type { CalendarDayGridProps } from './CalendarDayGrid.types';\nimport { DirectionalSlideIn, DirectionalSlideOut } from '../../utils/calendarMotions';\nimport { AnimationDirection } from '../../Calendar';\n\nexport interface DayInfo extends Day {\n onSelected: () => void;\n setRef(element: HTMLElement | null): void;\n}\n\nfunction useDayRefs() {\n const daysRef = React.useRef<Record<string, HTMLElement>>({});\n\n const getSetRefCallback = (dayKey: string) => (element: HTMLElement | null) => {\n if (element === null) {\n delete daysRef.current[dayKey];\n } else {\n daysRef.current[dayKey] = element;\n }\n };\n\n return [daysRef, getSetRefCallback] as const;\n}\n\nfunction useAnimateBackwards(weeks: DayInfo[][]): boolean | undefined {\n const previousNavigatedDateRef = React.useRef<Date | undefined>(undefined);\n React.useEffect(() => {\n previousNavigatedDateRef.current = weeks[0][0].originalDate;\n });\n const previousNavigatedDate = previousNavigatedDateRef.current;\n\n // eslint-disable-next-line react-hooks/refs\n if (!previousNavigatedDate || previousNavigatedDate.getTime() === weeks[0][0].originalDate.getTime()) {\n return undefined;\n // eslint-disable-next-line react-hooks/refs\n } else if (previousNavigatedDate <= weeks[0][0].originalDate) {\n return false;\n } else {\n return true;\n }\n}\n\nexport const CalendarDayGrid: React.FunctionComponent<CalendarDayGridProps> = props => {\n const navigatedDayRef = React.useRef<HTMLTableCellElement>(\n null,\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n ) as React.MutableRefObject<HTMLTableCellElement | null>;\n\n const activeDescendantId = useId();\n\n const onSelectDate = (selectedDate: Date): void => {\n const { firstDayOfWeek, minDate, maxDate, workWeekDays, daysToSelectInDayView, restrictedDates } = props;\n const restrictedDatesOptions = { minDate, maxDate, restrictedDates };\n\n // eslint-disable-next-line react-hooks/immutability\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\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 = AnimationDirection.Vertical,\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-linear' });\n const firstWeek = weeks[0];\n const finalWeek = weeks![weeks!.length - 1];\n // Single navigation epoch for all rows in the grid. Derived from the first visible day's key\n // (`Date.toString()`), which changes when the user navigates to a different month but stays\n // stable across intra-month interactions (e.g. day selection).\n const navigationEpoch = firstWeek[0].key;\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 <DirectionalSlideOut\n edge=\"first\"\n replayKey={navigationEpoch}\n animationDirection={animationDirection}\n animateBackwards={animateBackwards}\n >\n <CalendarGridRow\n {...props}\n {...partialWeekProps}\n week={firstWeek}\n weekIndex={-1}\n rowClassName={classNames.firstTransitionWeek}\n aria-role=\"presentation\"\n ariaHidden={true}\n />\n </DirectionalSlideOut>\n {weeks!.slice(1, weeks!.length - 1).map((week: DayInfo[], weekIndex: number) => (\n <DirectionalSlideIn\n key={weekIndex}\n replayKey={navigationEpoch}\n animationDirection={animationDirection}\n animateBackwards={animateBackwards}\n >\n <CalendarGridRow\n {...props}\n {...partialWeekProps}\n week={week}\n weekIndex={weekIndex}\n rowClassName={classNames.weekRow}\n />\n </DirectionalSlideIn>\n ))}\n <DirectionalSlideOut\n edge=\"last\"\n replayKey={navigationEpoch}\n animationDirection={animationDirection}\n animateBackwards={animateBackwards}\n >\n <CalendarGridRow\n {...props}\n {...partialWeekProps}\n week={finalWeek}\n weekIndex={-2}\n rowClassName={classNames.lastTransitionWeek}\n aria-role=\"presentation\"\n ariaHidden={true}\n />\n </DirectionalSlideOut>\n </tbody>\n </table>\n );\n};\nCalendarDayGrid.displayName = 'CalendarDayGrid';\n\n/**\n * When given work week, if the days are non-contiguous, the hover states look really weird. So for non-contiguous\n * work weeks, we'll just show week view instead.\n */\nfunction getDateRangeTypeToUse(dateRangeType: DateRangeType, workWeekDays: DayOfWeek[] | undefined): DateRangeType {\n if (workWeekDays && dateRangeType === DateRangeType.WorkWeek) {\n const sortedWWDays = workWeekDays.slice().sort();\n let isContiguous = true;\n for (let i = 1; i < sortedWWDays.length; i++) {\n if (sortedWWDays[i] !== sortedWWDays[i - 1] + 1) {\n isContiguous = false;\n break;\n }\n }\n\n if (!isContiguous || workWeekDays.length === 0) {\n return DateRangeType.Week;\n }\n }\n\n return dateRangeType;\n}\n"],"names":["React","useArrowNavigationGroup","useId","getBoundedDateRange","getDateRangeArray","isRestrictedDate","DateRangeType","useCalendarDayGridStyles_unstable","CalendarMonthHeaderRow","CalendarGridRow","useWeeks","useWeekCornerStyles","mergeClasses","DirectionalSlideIn","DirectionalSlideOut","AnimationDirection","useDayRefs","daysRef","useRef","getSetRefCallback","dayKey","element","current","useAnimateBackwards","weeks","previousNavigatedDateRef","undefined","useEffect","originalDate","previousNavigatedDate","getTime","CalendarDayGrid","props","navigatedDayRef","activeDescendantId","onSelectDate","selectedDate","firstDayOfWeek","minDate","maxDate","workWeekDays","daysToSelectInDayView","restrictedDates","restrictedDatesOptions","dateRange","dateRangeType","filter","d","onNavigateDate","animateBackwards","getWeekCornerStyles","calculateRoundedStyles","useImperativeHandle","componentRef","focus","getDayInfosInRangeOfDay","dayToCompare","dateRangeHoverType","getDateRangeTypeToUse","map","date","dayInfosInRange","reduce","accumulatedValue","currentWeek","concat","weekDay","indexOf","getRefsFromDayInfos","dayRefs","dayInfo","key","gridLabel","showWeekNumbers","labelledBy","lightenDaysOutsideNavigatedMonth","animationDirection","Vertical","classNames","weekCorners","partialWeekProps","arrowNavigationAttributes","axis","firstWeek","finalWeek","length","navigationEpoch","table","className","aria-multiselectable","aria-label","aria-labelledby","aria-activedescendant","role","tbody","edge","replayKey","week","weekIndex","rowClassName","firstTransitionWeek","aria-role","ariaHidden","slice","weekRow","lastTransitionWeek","displayName","WorkWeek","sortedWWDays","sort","isContiguous","i","Week"],"mappings":"AAAA;;;;;+BAuDa+B;;;;;;;iEArDU,QAAQ;8BACS,0BAA0B;gCAC5C,4BAA4B;uBACsC,cAAc;gDACpD,oCAAoC;wCAC/C,2BAA2B;iCAClC,oBAAoB;0BAC3B,aAAa;2CAEF,+BAA+B;wBACtC,iBAAiB;iCAGU,8BAA8B;0BACnD,iBAAiB;AAOpD,SAASf;IACP,MAAMC,UAAUjB,OAAMkB,MAAM,CAA8B,CAAC;IAE3D,MAAMC,oBAAoB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,IAAIH,aAAavB,MAAM,EAAE0B,IAAK;YAC5C,IAAIH,YAAY,CAACG,EAAE,KAAKH,YAAY,CAACG,IAAI,EAAE,GAAG,GAAG;gBAC/CD,eAAe;gBACf;YACF;QACF;QAEA,IAAI,CAACA,gBAAgBtE,aAAa6C,MAAM,KAAK,GAAG;YAC9C,OAAO/E,oBAAAA,CAAc0G,IAAI;QAC3B;IACF;IAEA,OAAOnE;AACT"}
|
|
@@ -19,7 +19,7 @@ const _utils = require("../../utils");
|
|
|
19
19
|
const _useWeekCornerStylesstyles = require("./useWeekCornerStyles.styles");
|
|
20
20
|
const _useCalendarDayGridStylesstyles = require("./useCalendarDayGridStyles.styles");
|
|
21
21
|
const CalendarGridDayCell = (props)=>{
|
|
22
|
-
'use no memo';
|
|
22
|
+
'use no memo'; // justified: compiler would optimize unknown function — manual opt-out to preserve runtime behavior
|
|
23
23
|
const { navigatedDate, dateTimeFormatter, allFocusable, strings, activeDescendantId, navigatedDayRef, calculateRoundedStyles, weeks, classNames, day, dayIndex, weekIndex, weekCorners, ariaHidden, customDayCellRef, dateRangeType, daysToSelectInDayView, onSelectDate, restrictedDates, minDate, maxDate, onNavigateDate, getDayInfosInRangeOfDay, getRefsFromDayInfos } = props;
|
|
24
24
|
var _weekCorners_;
|
|
25
25
|
const cornerStyle = (_weekCorners_ = weekCorners === null || weekCorners === void 0 ? void 0 : weekCorners[weekIndex + '_' + dayIndex]) !== null && _weekCorners_ !== void 0 ? _weekCorners_ : '';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/CalendarDayGrid/CalendarGridDayCell.tsx"],"sourcesContent":["'use client';\n\nimport * 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":["React","ArrowDown","ArrowLeft","ArrowRight","ArrowUp","Enter","getRTLSafeKey","useFluent_unstable","mergeClasses","addDays","addWeeks","compareDates","findAvailableDate","DateRangeType","weekCornersClassNames","extraCalendarDayGridClassNames","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","originalDate","dir","navigateMonthEdge","ev","date","targetDate","undefined","direction","key","findAvailableDateOptions","initialDate","nextDate","isInCurrentView","slice","length","some","week","dayToCompare","preventDefault","onMouseOverDay","dayInfos","dayRefs","forEach","dayRef","index","classList","add","hoverStyle","isSelected","Day","remove","bottomLeftCornerDate","bottomRightCornerDate","topLeftCornerDate","topRightCornerDate","classNamesToAdd","trim","split","onMouseDownDay","pressedStyle","onMouseUpDay","onMouseOutDay","onDayKeyDown","ariaLabel","getDate","months","getMonth","getFullYear","isMarked","dayMarkedAriaLabel","isFocusable","isInBounds","td","className","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"],"mappings":"AAAA;;;;;+BAyBagB;;;;;;;iEAvBU,QAAQ;8BACkC,0BAA0B;gCAC7D,4BAA4B;qCACvB,kCAAkC;wBACxC,iBAAiB;uBACoC,cAAc;2CAC1D,+BAA+B;gDACtB,oCAAoC;AAgB5E,4BAA+EC,CAAAA;IACpF;IAEA,MAAM,EACJC,aAAa,EACbC,iBAAiB,EACjBC,YAAY,EACZC,OAAO,EACPC,kBAAkB,EAClBC,eAAe,EACfC,sBAAsB,EACtBC,KAAK,EACLC,UAAU,EACVC,GAAG,EACHC,QAAQ,EACRC,SAAS,EACTC,WAAW,EACXC,UAAU,EACVC,gBAAgB,EAChBC,aAAa,EACbC,qBAAqB,EACrBC,YAAY,EACZC,eAAe,EACfC,OAAO,EACPC,OAAO,EACPC,cAAc,EACdC,uBAAuB,EACvBC,mBAAmB,EACpB,GAAGxB;QACgBa;IAApB,MAAMY,cAAcZ,iBAAAA,gBAAAA,QAAAA,gBAAAA,KAAAA,IAAAA,KAAAA,IAAAA,WAAa,CAACD,YAAY,MAAMD,SAAAA,AAAS,MAAA,QAAzCE,kBAAAA,KAAAA,IAAAA,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f6C,eAAWzF,oBAAAA,EAAakB,WAAWiG,SAAS,EAAEhG,IAAI6F,OAAO,IAAI9F,WAAWkG,UAAU;QAClFC,cAAYtC;QACZuC,IAAInF,kBAAkBrB,qBAAqB4B;QAC3C6E,UAAU,CAAChG,cAAc,CAACJ,IAAIoE,UAAU;QACxCiC,MAAK;QACLV,UAAU,CAAC;qBAEX,OAAA,aAAA,CAACW,QAAAA;QAAKhC,WAAWtE,IAAI6F,OAAO,OAAGhH,oBAAAA,EAAakB,WAAWwG,cAAc,IAAIhF;OACtE/B,kBAAkBgH,SAAS,CAACxG,IAAIiB,YAAY,IAE9CjB,IAAIiE,QAAQ,IAAA,WAAA,GAAI,OAAA,aAAA,CAACwC,OAAAA;QAAIC,eAAY;QAAOpC,WAAWvE,WAAW4G,SAAS;;AAIhF,EAAE"}
|
|
1
|
+
{"version":3,"sources":["../src/components/CalendarDayGrid/CalendarGridDayCell.tsx"],"sourcesContent":["'use client';\n\nimport * 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'; // justified: compiler would optimize unknown function — manual opt-out to preserve runtime behavior\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":["React","ArrowDown","ArrowLeft","ArrowRight","ArrowUp","Enter","getRTLSafeKey","useFluent_unstable","mergeClasses","addDays","addWeeks","compareDates","findAvailableDate","DateRangeType","weekCornersClassNames","extraCalendarDayGridClassNames","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","originalDate","dir","navigateMonthEdge","ev","date","targetDate","undefined","direction","key","findAvailableDateOptions","initialDate","nextDate","isInCurrentView","slice","length","some","week","dayToCompare","preventDefault","onMouseOverDay","dayInfos","dayRefs","forEach","dayRef","index","classList","add","hoverStyle","isSelected","Day","remove","bottomLeftCornerDate","bottomRightCornerDate","topLeftCornerDate","topRightCornerDate","classNamesToAdd","trim","split","onMouseDownDay","pressedStyle","onMouseUpDay","onMouseOutDay","onDayKeyDown","ariaLabel","getDate","months","getMonth","getFullYear","isMarked","dayMarkedAriaLabel","isFocusable","isInBounds","td","className","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"],"mappings":"AAAA;;;;;+BAyBagB;;;;;;;iEAvBU,QAAQ;8BACkC,0BAA0B;gCAC7D,4BAA4B;qCACvB,kCAAkC;wBACxC,iBAAiB;uBACoC,cAAc;2CAC1D,+BAA+B;gDACtB,oCAAoC;AAgB5E,4BAA+EC,CAAAA;IACpF,eAAe,oGAAoG;IAEnH,MAAM,EACJC,aAAa,EACbC,iBAAiB,EACjBC,YAAY,EACZC,OAAO,EACPC,kBAAkB,EAClBC,eAAe,EACfC,sBAAsB,EACtBC,KAAK,EACLC,UAAU,EACVC,GAAG,EACHC,QAAQ,EACRC,SAAS,EACTC,WAAW,EACXC,UAAU,EACVC,gBAAgB,EAChBC,aAAa,EACbC,qBAAqB,EACrBC,YAAY,EACZC,eAAe,EACfC,OAAO,EACPC,OAAO,EACPC,cAAc,EACdC,uBAAuB,EACvBC,mBAAmB,EACpB,GAAGxB;QACgBa;IAApB,MAAMY,cAAcZ,CAAAA,gBAAAA,gBAAAA,QAAAA,gBAAAA,KAAAA,IAAAA,KAAAA,IAAAA,WAAa,CAACD,YAAY,MAAMD,SAAAA,AAAS,MAAA,QAAzCE,kBAAAA,KAAAA,IAAAA,gBAA6C;IACjE,MAAMa,sBAAkBhC,mBAAAA,EAAaO,eAAeS,IAAIiB,YAAY;IAEpE,MAAM,EAAEC,GAAG,EAAE,OAAGtC,uCAAAA;IAEhB,MAAMuC,oBAAoB,CAACC,IAAsCC;QAC/D,IAAIC,aAA+BC;QACnC,IAAIC,YAAY,GAAG,4BAA4B;QAE/C,IAAIJ,GAAGK,GAAG,KAAKhD,qBAAAA,EAAS;YACtB6C,iBAAavC,eAAAA,EAASsC,MAAM,CAAC;YAC7BG,YAAY,CAAC;QACf,OAAO,IAAIJ,GAAGK,GAAG,KAAK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IAAIiB,YAAY,IAE9CjB,IAAIiE,QAAQ,IAAA,WAAA,GAAI,OAAA,aAAA,CAACwC,OAAAA;QAAIC,eAAY;QAAOpC,WAAWvE,WAAW4G,SAAS;;AAIhF,EAAE"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
'use client';
|
|
1
2
|
"use strict";
|
|
2
3
|
Object.defineProperty(exports, "__esModule", {
|
|
3
4
|
value: true
|
|
@@ -12,18 +13,17 @@ const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildc
|
|
|
12
13
|
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
|
|
13
14
|
const _utils = require("../../utils");
|
|
14
15
|
const _CalendarGridDayCell = require("./CalendarGridDayCell");
|
|
15
|
-
const CalendarGridRow = (props)=>{
|
|
16
|
+
const CalendarGridRow = /*#__PURE__*/ _react.forwardRef((props, ref)=>{
|
|
16
17
|
const { ariaHidden, classNames, week, weeks, weekIndex, rowClassName, ariaRole, showWeekNumbers, firstDayOfWeek, firstWeekOfYear, navigatedDate, strings } = props;
|
|
17
18
|
const weekNumbers = showWeekNumbers ? (0, _utils.getWeekNumbersInMonth)(weeks.length, firstDayOfWeek, firstWeekOfYear, navigatedDate) : null;
|
|
18
19
|
const titleString = weekNumbers ? strings.weekNumberFormatString && strings.weekNumberFormatString.replace('{0}', `${weekNumbers[weekIndex]}`) : '';
|
|
19
20
|
return /*#__PURE__*/ _react.createElement("tr", {
|
|
21
|
+
ref: ref,
|
|
20
22
|
role: ariaRole,
|
|
21
23
|
"aria-hidden": ariaHidden,
|
|
22
|
-
className: rowClassName
|
|
23
|
-
key: weekIndex + '_' + week[0].key
|
|
24
|
+
className: rowClassName
|
|
24
25
|
}, showWeekNumbers && weekNumbers && /*#__PURE__*/ _react.createElement("th", {
|
|
25
26
|
className: classNames.weekNumberCell,
|
|
26
|
-
key: weekIndex,
|
|
27
27
|
title: titleString,
|
|
28
28
|
"aria-label": titleString,
|
|
29
29
|
scope: "row"
|
|
@@ -33,4 +33,5 @@ const CalendarGridRow = (props)=>{
|
|
|
33
33
|
day: day,
|
|
34
34
|
dayIndex: dayIndex
|
|
35
35
|
})));
|
|
36
|
-
};
|
|
36
|
+
});
|
|
37
|
+
CalendarGridRow.displayName = 'CalendarGridRow';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/CalendarDayGrid/CalendarGridRow.tsx"],"sourcesContent":["
|
|
1
|
+
{"version":3,"sources":["../src/components/CalendarDayGrid/CalendarGridRow.tsx"],"sourcesContent":["'use client';\n\nimport * 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 // eslint-disable-next-line @typescript-eslint/no-deprecated\n navigatedDayRef: React.MutableRefObject<HTMLTableCellElement | null>;\n activeDescendantId: string;\n calculateRoundedStyles(above: boolean, below: boolean, left: boolean, right: boolean): string;\n getDayInfosInRangeOfDay(dayToCompare: DayInfo): DayInfo[];\n getRefsFromDayInfos(dayInfosInRange: DayInfo[]): (HTMLElement | null)[];\n}\n\n/**\n * @internal\n */\nexport const CalendarGridRow = React.forwardRef<HTMLTableRowElement, CalendarGridRowProps>((props, ref) => {\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 ref={ref} role={ariaRole} aria-hidden={ariaHidden} className={rowClassName}>\n {showWeekNumbers && weekNumbers && (\n <th className={classNames.weekNumberCell} title={titleString} aria-label={titleString} scope=\"row\">\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\nCalendarGridRow.displayName = 'CalendarGridRow';\n"],"names":["React","getWeekNumbersInMonth","CalendarGridDayCell","CalendarGridRow","forwardRef","props","ref","ariaHidden","classNames","week","weeks","weekIndex","rowClassName","ariaRole","showWeekNumbers","firstDayOfWeek","firstWeekOfYear","navigatedDate","strings","weekNumbers","length","titleString","weekNumberFormatString","replace","tr","role","aria-hidden","className","th","weekNumberCell","title","aria-label","scope","span","map","day","dayIndex","key","displayName"],"mappings":"AAAA;;;;;+BAgCaG;;;;;;;iEA9BU,QAAQ;uBACO,cAAc;qCAChB,wBAAwB;AA4BrD,wBAAMA,WAAAA,GAAkBH,OAAMI,UAAU,CAA4C,CAACC,OAAOC;IACjG,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,GAAGb;IACJ,MAAMc,cAAcL,kBAChBb,gCAAAA,EAAsBS,MAAOU,MAAM,EAAEL,gBAAgBC,iBAAiBC,iBACtE;IAEJ,MAAMI,cAAcF,cAChBD,QAAQI,sBAAsB,IAAIJ,QAAQI,sBAAsB,CAACC,OAAO,CAAC,OAAO,GAAGJ,WAAW,CAACR,UAAU,EAAE,IAC3G;IAEJ,OAAA,WAAA,GACE,OAAA,aAAA,CAACa,MAAAA;QAAGlB,KAAKA;QAAKmB,MAAMZ;QAAUa,eAAanB;QAAYoB,WAAWf;OAC/DE,mBAAmBK,eAAAA,WAAAA,GAClB,OAAA,aAAA,CAACS,MAAAA;QAAGD,WAAWnB,WAAWqB,cAAc;QAAEC,OAAOT;QAAaU,cAAYV;QAAaW,OAAM;qBAC3F,OAAA,aAAA,CAACC,QAAAA,MAAMd,WAAW,CAACR,UAAU,IAGhCF,KAAKyB,GAAG,CAAC,CAACC,KAAcC,WAAAA,WAAAA,GACvB,OAAA,aAAA,CAAClC,wCAAAA,EAAAA;YAAqB,GAAGG,KAAK;YAAEgC,KAAKF,IAAIE,GAAG;YAAEF,KAAKA;YAAKC,UAAUA;;AAI1E,GAAG;AAEHjC,gBAAgBmC,WAAW,GAAG"}
|
|
@@ -11,6 +11,8 @@ Object.defineProperty(exports, "CalendarMonthHeaderRow", {
|
|
|
11
11
|
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
|
|
12
12
|
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
|
|
13
13
|
const _react1 = require("@griffel/react");
|
|
14
|
+
const _reactmotion = require("@fluentui/react-motion");
|
|
15
|
+
const _reactmotioncomponentspreview = require("@fluentui/react-motion-components-preview");
|
|
14
16
|
const _utils = require("../../utils");
|
|
15
17
|
const CalendarMonthHeaderRow = (props)=>{
|
|
16
18
|
const { showWeekNumbers, strings, firstDayOfWeek, allFocusable, weeksToShow, weeks, classNames } = props;
|
|
@@ -33,13 +35,17 @@ const CalendarMonthHeaderRow = (props)=>{
|
|
|
33
35
|
}), dayLabels.map((val, index)=>{
|
|
34
36
|
const i = (index + firstDayOfWeek) % _utils.DAYS_IN_WEEK;
|
|
35
37
|
const label = strings.days[i];
|
|
36
|
-
return
|
|
38
|
+
return(// plays once on mount. The only remount is in single-week view, when a label is swapped
|
|
39
|
+
// for a short month name.
|
|
40
|
+
/*#__PURE__*/ _react.createElement(_reactmotioncomponentspreview.Fade.In, {
|
|
41
|
+
key: dayLabels[i] + ' ' + index,
|
|
42
|
+
duration: _reactmotion.motionTokens.durationGentle
|
|
43
|
+
}, /*#__PURE__*/ _react.createElement("th", {
|
|
37
44
|
className: (0, _react1.mergeClasses)(classNames.dayCell, classNames.weekDayLabelCell),
|
|
38
45
|
scope: "col",
|
|
39
|
-
key: dayLabels[i] + ' ' + index,
|
|
40
46
|
title: label,
|
|
41
47
|
"aria-label": label,
|
|
42
48
|
tabIndex: allFocusable ? 0 : undefined
|
|
43
|
-
}, dayLabels[i]);
|
|
49
|
+
}, dayLabels[i])));
|
|
44
50
|
}));
|
|
45
51
|
};
|
|
@@ -1 +1 @@
|
|
|
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
|
|
1
|
+
{"version":3,"sources":["../src/components/CalendarDayGrid/CalendarMonthHeaderRow.tsx"],"sourcesContent":["import * as React from 'react';\nimport { mergeClasses } from '@griffel/react';\nimport { motionTokens } from '@fluentui/react-motion';\nimport { Fade } from '@fluentui/react-motion-components-preview';\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 // Plain list key, not a `replayKey`: day labels are stable across navigation so the fade\n // plays once on mount. The only remount is in single-week view, when a label is swapped\n // for a short month name.\n <Fade.In key={dayLabels[i] + ' ' + index} duration={motionTokens.durationGentle}>\n <th\n className={mergeClasses(classNames.dayCell, classNames.weekDayLabelCell)}\n scope=\"col\"\n title={label}\n aria-label={label}\n tabIndex={allFocusable ? 0 : undefined}\n >\n {dayLabels[i]}\n </th>\n </Fade.In>\n );\n })}\n </tr>\n );\n};\n"],"names":["React","mergeClasses","motionTokens","Fade","DAYS_IN_WEEK","CalendarMonthHeaderRow","props","showWeekNumbers","strings","firstDayOfWeek","allFocusable","weeksToShow","weeks","classNames","dayLabels","shortDays","slice","firstOfMonthIndex","firstWeekOfMonth","i","length","originalDate","getDate","firstOfMonthIndexOffset","shortMonths","getMonth","tr","th","className","dayCell","map","val","index","label","days","In","key","duration","durationGentle","weekDayLabelCell","scope","title","aria-label","tabIndex","undefined"],"mappings":";;;;+BAmBaK;;;;;;;iEAnBU,QAAQ;wBACF,iBAAiB;6BACjB,yBAAyB;8CACjC,4CAA4C;uBACpC,cAAc;AAepC,+BAAwFC,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,0BAA2BN,CAAAA,oBAAoBR,cAAAA,CAAa,GAAKL,mBAAAA;QACvEU,SAAS,CAACS,wBAAwB,GAAGf,QAAQgB,WAAW,CAACZ,KAAM,CAAC,EAAE,CAACK,kBAAkB,CAACI,YAAY,CAACI,QAAQ,GAAG;IAChH;IAEA,OAAA,WAAA,GACE,OAAA,aAAA,CAACC,MAAAA,MACEnB,mBAAAA,WAAAA,GAAmB,OAAA,aAAA,CAACoB,MAAAA;QAAGC,WAAWf,WAAWgB,OAAO;QACpDf,UAAUgB,GAAG,CAAC,CAACC,KAAaC;QAC3B,MAAMb,IAAKa,CAAAA,QAAQvB,cAAAA,CAAa,GAAKL,mBAAAA;QACrC,MAAM6B,QAAQzB,QAAQ0B,IAAI,CAACf,EAAE;QAC7B,OACE,AACA,wFAAwF,CADC;QAEzF,0BAA0B;sBAC1B,OAAA,aAAA,CAAChB,kCAAAA,CAAKgC,EAAE,EAAA;YAACC,KAAKtB,SAAS,CAACK,EAAE,GAAG,MAAMa;YAAOK,UAAUnC,yBAAAA,CAAaoC,cAAc;yBAC7E,OAAA,aAAA,CAACX,MAAAA;YACCC,eAAW3B,oBAAAA,EAAaY,WAAWgB,OAAO,EAAEhB,WAAW0B,gBAAgB;YACvEC,OAAM;YACNC,OAAOR;YACPS,cAAYT;YACZU,UAAUjC,eAAe,IAAIkC;WAE5B9B,SAAS,CAACK,EAAE;IAIrB;AAGN,EAAE"}
|
|
@@ -21,7 +21,6 @@ _export(exports, {
|
|
|
21
21
|
}
|
|
22
22
|
});
|
|
23
23
|
const _react = require("@griffel/react");
|
|
24
|
-
const _Calendartypes = require("../Calendar/Calendar.types");
|
|
25
24
|
const calendarDayGridClassNames = {
|
|
26
25
|
wrapper: 'fui-CalendarDayGrid__wrapper',
|
|
27
26
|
table: 'fui-CalendarDayGrid__table',
|
|
@@ -516,70 +515,22 @@ const useWeekRowStyles = /*#__PURE__*/ (0, _react.__styles)({
|
|
|
516
515
|
base: {
|
|
517
516
|
qhf8xq: "f10pi13n",
|
|
518
517
|
mlyf9c: "f1gazwyt"
|
|
519
|
-
},
|
|
520
|
-
animation: {
|
|
521
|
-
vin17d: "f5f2jbu",
|
|
522
|
-
Bf5fcs: "fywypte",
|
|
523
|
-
Ezkn3b: "f1ee2ue"
|
|
524
|
-
},
|
|
525
|
-
horizontalBackward: {
|
|
526
|
-
Bv12yb3: [
|
|
527
|
-
"f1o9w3l8",
|
|
528
|
-
"f1kwjajc"
|
|
529
|
-
]
|
|
530
|
-
},
|
|
531
|
-
horizontalForward: {
|
|
532
|
-
Bv12yb3: [
|
|
533
|
-
"f1kwjajc",
|
|
534
|
-
"f1o9w3l8"
|
|
535
|
-
]
|
|
536
|
-
},
|
|
537
|
-
verticalBackward: {
|
|
538
|
-
Bv12yb3: "fgl3yn7"
|
|
539
|
-
},
|
|
540
|
-
verticalForward: {
|
|
541
|
-
Bv12yb3: "faiu5ye"
|
|
542
518
|
}
|
|
543
519
|
}, {
|
|
544
520
|
d: [
|
|
545
|
-
".f10pi13n{position:relative;}"
|
|
546
|
-
".f5f2jbu{animation-duration:0.367s;}",
|
|
547
|
-
".fywypte{animation-fill-mode:both;}",
|
|
548
|
-
".f1ee2ue{animation-timing-function:cubic-bezier(.1,.9,.2,1);}",
|
|
549
|
-
".f1o9w3l8{animation-name:f5j8bii,f2lgmc3;}",
|
|
550
|
-
".f1kwjajc{animation-name:f5j8bii,fpktcv7;}",
|
|
551
|
-
".fgl3yn7{animation-name:f5j8bii,f3bv9km;}",
|
|
552
|
-
".faiu5ye{animation-name:f5j8bii,funtx0y;}"
|
|
521
|
+
".f10pi13n{position:relative;}"
|
|
553
522
|
],
|
|
554
523
|
w: [
|
|
555
524
|
".f1gazwyt:focus-within{z-index:1;}"
|
|
556
|
-
],
|
|
557
|
-
k: [
|
|
558
|
-
"@keyframes f5j8bii{from{opacity:0;}to{opacity:1;}}",
|
|
559
|
-
"@keyframes f2lgmc3{from{pointer-events:none;transform:translate3d(-20px, 0, 0);}to{pointer-events:auto;transform:translate3d(0, 0, 0);}}",
|
|
560
|
-
"@keyframes fpktcv7{from{pointer-events:none;transform:translate3d(20px, 0, 0);}to{pointer-events:auto;transform:translate3d(0, 0, 0);}}",
|
|
561
|
-
"@keyframes f3bv9km{from{pointer-events:none;transform:translate3d(0, -20px, 0);}to{pointer-events:auto;transform:translate3d(0, 0, 0);}}",
|
|
562
|
-
"@keyframes funtx0y{from{pointer-events:none;transform:translate3d(0, 20px, 0);}to{pointer-events:auto;transform:translate3d(0, 0, 0);}}"
|
|
563
525
|
]
|
|
564
526
|
});
|
|
565
527
|
const useWeekDayLabelCellStyles = /*#__PURE__*/ (0, _react.__styles)({
|
|
566
528
|
base: {
|
|
567
|
-
famaaq: "f1xqy1su"
|
|
568
|
-
vin17d: "fhsqnsn",
|
|
569
|
-
Bf5fcs: "fywypte",
|
|
570
|
-
Bv12yb3: "f1h7u52p",
|
|
571
|
-
Ezkn3b: "fjq4c94"
|
|
529
|
+
famaaq: "f1xqy1su"
|
|
572
530
|
}
|
|
573
531
|
}, {
|
|
574
532
|
d: [
|
|
575
|
-
".f1xqy1su{-webkit-user-select:none;-moz-user-select:none;user-select:none;}"
|
|
576
|
-
".fhsqnsn{animation-duration:0.267s;}",
|
|
577
|
-
".fywypte{animation-fill-mode:both;}",
|
|
578
|
-
".f1h7u52p{animation-name:f5j8bii;}",
|
|
579
|
-
".fjq4c94{animation-timing-function:cubic-bezier(.1,.25,.75,.9);}"
|
|
580
|
-
],
|
|
581
|
-
k: [
|
|
582
|
-
"@keyframes f5j8bii{from{opacity:0;}to{opacity:1;}}"
|
|
533
|
+
".f1xqy1su{-webkit-user-select:none;-moz-user-select:none;user-select:none;}"
|
|
583
534
|
]
|
|
584
535
|
});
|
|
585
536
|
const useWeekNumberCellStyles = /*#__PURE__*/ (0, _react.__styles)({
|
|
@@ -888,23 +839,15 @@ const useDayTodayMarkerStyles = /*#__PURE__*/ (0, _react.__styles)({
|
|
|
888
839
|
});
|
|
889
840
|
const useFirstTransitionWeekStyles = /*#__PURE__*/ (0, _react.__styles)({
|
|
890
841
|
base: {
|
|
891
|
-
Bqenvij: "fniina8",
|
|
892
842
|
abs64n: "fk73vx1",
|
|
893
843
|
B68tc82: 0,
|
|
894
844
|
Bmxbyg5: 0,
|
|
895
845
|
Bpg54ce: "f1a3p1vp",
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
},
|
|
899
|
-
verticalForward: {
|
|
900
|
-
vin17d: "f5f2jbu",
|
|
901
|
-
Bf5fcs: "fywypte",
|
|
902
|
-
Bv12yb3: "fupj2f5",
|
|
903
|
-
Ezkn3b: "f1ee2ue"
|
|
846
|
+
Bkecrkj: "f1aehjj5",
|
|
847
|
+
qhf8xq: "f1euv43f"
|
|
904
848
|
}
|
|
905
849
|
}, {
|
|
906
850
|
d: [
|
|
907
|
-
".fniina8{height:0;}",
|
|
908
851
|
".fk73vx1{opacity:0;}",
|
|
909
852
|
[
|
|
910
853
|
".f1a3p1vp{overflow:hidden;}",
|
|
@@ -912,39 +855,22 @@ const useFirstTransitionWeekStyles = /*#__PURE__*/ (0, _react.__styles)({
|
|
|
912
855
|
p: -1
|
|
913
856
|
}
|
|
914
857
|
],
|
|
915
|
-
".
|
|
916
|
-
".
|
|
917
|
-
".f5f2jbu{animation-duration:0.367s;}",
|
|
918
|
-
".fywypte{animation-fill-mode:both;}",
|
|
919
|
-
".fupj2f5{animation-name:f199e34v,f76svrd,f13agkrc;}",
|
|
920
|
-
".f1ee2ue{animation-timing-function:cubic-bezier(.1,.9,.2,1);}"
|
|
921
|
-
],
|
|
922
|
-
k: [
|
|
923
|
-
"@keyframes f199e34v{from{opacity:1;}to{opacity:0;visibility:hidden;}}",
|
|
924
|
-
"@keyframes f76svrd{from{transform:translate3d(0, 0, 0);}to{transform:translate3d(0, -20px, 0);}}",
|
|
925
|
-
"@keyframes f13agkrc{100%{height:0px;overflow:hidden;width:0px;}99.9%{height:28px;overflow:visible;width:100%;}0%{height:28px;overflow:visible;width:100%;}}"
|
|
858
|
+
".f1aehjj5{pointer-events:none;}",
|
|
859
|
+
".f1euv43f{position:absolute;}"
|
|
926
860
|
]
|
|
927
861
|
});
|
|
928
862
|
const useLastTransitionWeekStyles = /*#__PURE__*/ (0, _react.__styles)({
|
|
929
863
|
base: {
|
|
930
|
-
Bqenvij: "fniina8",
|
|
931
864
|
B6of3ja: "flykjtj",
|
|
932
865
|
abs64n: "fk73vx1",
|
|
933
866
|
B68tc82: 0,
|
|
934
867
|
Bmxbyg5: 0,
|
|
935
868
|
Bpg54ce: "f1a3p1vp",
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
},
|
|
939
|
-
verticalBackward: {
|
|
940
|
-
vin17d: "f5f2jbu",
|
|
941
|
-
Bf5fcs: "fywypte",
|
|
942
|
-
Bv12yb3: "fifoktk",
|
|
943
|
-
Ezkn3b: "f1ee2ue"
|
|
869
|
+
Bkecrkj: "f1aehjj5",
|
|
870
|
+
qhf8xq: "f1euv43f"
|
|
944
871
|
}
|
|
945
872
|
}, {
|
|
946
873
|
d: [
|
|
947
|
-
".fniina8{height:0;}",
|
|
948
874
|
".flykjtj{margin-top:-28px;}",
|
|
949
875
|
".fk73vx1{opacity:0;}",
|
|
950
876
|
[
|
|
@@ -953,17 +879,8 @@ const useLastTransitionWeekStyles = /*#__PURE__*/ (0, _react.__styles)({
|
|
|
953
879
|
p: -1
|
|
954
880
|
}
|
|
955
881
|
],
|
|
956
|
-
".
|
|
957
|
-
".
|
|
958
|
-
".f5f2jbu{animation-duration:0.367s;}",
|
|
959
|
-
".fywypte{animation-fill-mode:both;}",
|
|
960
|
-
".fifoktk{animation-name:f199e34v,f18895iq,f13agkrc;}",
|
|
961
|
-
".f1ee2ue{animation-timing-function:cubic-bezier(.1,.9,.2,1);}"
|
|
962
|
-
],
|
|
963
|
-
k: [
|
|
964
|
-
"@keyframes f199e34v{from{opacity:1;}to{opacity:0;visibility:hidden;}}",
|
|
965
|
-
"@keyframes f18895iq{from{transform:translate3d(0, 0, 0);}to{transform:translate3d(0, 20px, 0);}}",
|
|
966
|
-
"@keyframes f13agkrc{100%{height:0px;overflow:hidden;width:0px;}99.9%{height:28px;overflow:visible;width:100%;}0%{height:28px;overflow:visible;width:100%;}}"
|
|
882
|
+
".f1aehjj5{pointer-events:none;}",
|
|
883
|
+
".f1euv43f{position:absolute;}"
|
|
967
884
|
]
|
|
968
885
|
});
|
|
969
886
|
const useDayMarkerStyles = /*#__PURE__*/ (0, _react.__styles)({
|
|
@@ -1064,6 +981,7 @@ const useCornerBorderAndRadiusStyles = /*#__PURE__*/ (0, _react.__styles)({
|
|
|
1064
981
|
});
|
|
1065
982
|
const useCalendarDayGridStyles_unstable = (props)=>{
|
|
1066
983
|
'use no memo';
|
|
984
|
+
// justified: compiler would optimize useCalendarDayGridStyles_unstable — manual opt-out to preserve runtime behavior
|
|
1067
985
|
const wrapperStyles = useWrapperStyles();
|
|
1068
986
|
const tableStyles = useTableStyles();
|
|
1069
987
|
const dayCellStyles = useDayCellStyles();
|
|
@@ -1081,22 +999,22 @@ const useCalendarDayGridStyles_unstable = (props)=>{
|
|
|
1081
999
|
const dayMarkerStyles = useDayMarkerStyles();
|
|
1082
1000
|
const cornerBorderAndRadiusStyles = useCornerBorderAndRadiusStyles();
|
|
1083
1001
|
const dayTodayMarkerStyles = useDayTodayMarkerStyles();
|
|
1084
|
-
const {
|
|
1002
|
+
const { lightenDaysOutsideNavigatedMonth, showWeekNumbers } = props;
|
|
1085
1003
|
return {
|
|
1086
1004
|
wrapper: (0, _react.mergeClasses)(calendarDayGridClassNames.wrapper, wrapperStyles.base),
|
|
1087
1005
|
table: (0, _react.mergeClasses)(calendarDayGridClassNames.table, tableStyles.base, showWeekNumbers && tableStyles.showWeekNumbers),
|
|
1088
1006
|
dayCell: (0, _react.mergeClasses)(calendarDayGridClassNames.dayCell, dayCellStyles.base, dayCellStyles.focusIndicator, cornerBorderAndRadiusStyles.corners),
|
|
1089
1007
|
daySelected: (0, _react.mergeClasses)(calendarDayGridClassNames.daySelected, daySelectedStyles.base),
|
|
1090
1008
|
daySingleSelected: (0, _react.mergeClasses)(calendarDayGridClassNames.daySingleSelected, daySingleSelectedStyles.base),
|
|
1091
|
-
weekRow: (0, _react.mergeClasses)(calendarDayGridClassNames.weekRow, weekRowStyles.base
|
|
1009
|
+
weekRow: (0, _react.mergeClasses)(calendarDayGridClassNames.weekRow, weekRowStyles.base),
|
|
1092
1010
|
weekDayLabelCell: (0, _react.mergeClasses)(calendarDayGridClassNames.weekDayLabelCell, weekDayLabelCellStyles.base),
|
|
1093
1011
|
weekNumberCell: (0, _react.mergeClasses)(calendarDayGridClassNames.weekNumberCell, weekNumberCellStyles.base),
|
|
1094
1012
|
dayOutsideBounds: (0, _react.mergeClasses)(calendarDayGridClassNames.dayOutsideBounds, dayOutsideBoundsStyles.base),
|
|
1095
1013
|
dayOutsideNavigatedMonth: (0, _react.mergeClasses)(calendarDayGridClassNames.dayOutsideNavigatedMonth, lightenDaysOutsideNavigatedMonth && dayOutsideNavigatedMonthStyles.lightenDaysOutsideNavigatedMonth),
|
|
1096
1014
|
dayButton: (0, _react.mergeClasses)(calendarDayGridClassNames.dayButton, dayButtonStyles.base),
|
|
1097
1015
|
dayIsToday: (0, _react.mergeClasses)(calendarDayGridClassNames.dayIsToday, dayIsTodayStyles.base),
|
|
1098
|
-
firstTransitionWeek: (0, _react.mergeClasses)(calendarDayGridClassNames.firstTransitionWeek, firstTransitionWeekStyles.base
|
|
1099
|
-
lastTransitionWeek: (0, _react.mergeClasses)(calendarDayGridClassNames.lastTransitionWeek, lastTransitionWeekStyles.base
|
|
1016
|
+
firstTransitionWeek: (0, _react.mergeClasses)(calendarDayGridClassNames.firstTransitionWeek, firstTransitionWeekStyles.base),
|
|
1017
|
+
lastTransitionWeek: (0, _react.mergeClasses)(calendarDayGridClassNames.lastTransitionWeek, lastTransitionWeekStyles.base),
|
|
1100
1018
|
dayMarker: (0, _react.mergeClasses)(calendarDayGridClassNames.dayMarker, dayMarkerStyles.base),
|
|
1101
1019
|
dayTodayMarker: (0, _react.mergeClasses)(calendarDayGridClassNames.dayTodayMarker, dayTodayMarkerStyles.base)
|
|
1102
1020
|
};
|