-
Notifications
You must be signed in to change notification settings - Fork 2.9k
refactor(Calendar): migrate to motion components #35666
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
robertpenner
wants to merge
40
commits into
microsoft:master
Choose a base branch
from
robertpenner:refactor/calendar-motion
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
40 commits
Select commit
Hold shift + click to select a range
3a72995
refactor(Calendar): add motion components for slide and fade
robertpenner 9a66a51
refactor(Calendar): migrate month row slide to motion components
robertpenner a35a005
refactor(Calendar): start migrating week row slide to motion components
robertpenner db0a382
fix(motion): update presence .In and .Out to use MotionComponent type
robertpenner a350faa
refactor(Calendar): migrate to variants of Slide motion component
robertpenner f6cdbb8
TEMP: default animationDirection to Horizontal for testing
robertpenner 172d733
reactor(Calendar): create horizontal slide motion components for mont…
robertpenner 405f336
refactor(Calendar): simplify conditional motion; consolidate to Direc…
robertpenner c24ba37
chore: yarn change
robertpenner a19dddf
refactor: document Calendar motion constants & plans to migrate to to…
robertpenner 2391720
refactor: rename motions.ts to calendarMotions.ts
robertpenner 42559c0
chore: remove unused code
robertpenner 6d912e8
chore: uncomment CSS animation code
robertpenner 11b64d4
chore(Calendar): change default animationDirection back to Vertical
robertpenner ddab24e
docs(Calendar): add migration plan for transitioning to Fluent UI v9 …
robertpenner 89272bd
docs(react-calendar-compat): Update MOTION_MIGRATION_PLAN.md
robertpenner 2ab2bf5
refactor(react-calendar-compat): Use motion tokens in DirectionalSlide
robertpenner 4a684c4
refactor(react-calendar-compat): Convert CalendarGridRow to forwardRef
robertpenner dfc0ef4
refactor(react-calendar-compat): Remove wrapper divs from Directional…
robertpenner be74384
refactor(react-calendar-compat): Remove CSS slide animations from Cal…
robertpenner 1eff636
refactor(react-calendar-compat): Update animation duration constants
robertpenner ad0e8f4
deps(react-calendar-compat): Add react-motion dependencies
robertpenner b00bf02
refactor(react-calendar-compat): Add 'use client' directive to Calend…
robertpenner f0c0748
feat(react-calendar-compat): Add DirectionalSlide to CalendarYear gri…
robertpenner 7baac93
refactor(react-calendar-compat): Remove CSS slide animations from Cal…
robertpenner a4c5553
refactor(react-calendar-compat): Mark unused animation constants as d…
robertpenner a0dc05a
feat(react-calendar-compat): add HeaderFade motion component
robertpenner 234be5d
feat(react-calendar-compat): migrate CalendarDay header to HeaderFade
robertpenner 3ac6178
feat(react-calendar-compat): migrate CalendarMonth header to HeaderFade
robertpenner 714c607
feat(react-calendar-compat): migrate CalendarYear header to HeaderFade
robertpenner dc07cb3
refactor(react-calendar-compat): remove CSS fade animation from Calen…
robertpenner 420514a
docs(react-calendar-compat): update migration plan to mark Phase 2 co…
robertpenner 354d9ed
refactor(react-calendar-compat): update animation constants to reflec…
robertpenner f291d4a
feat(react-calendar-compat): migrate CalendarDayGrid weekday labels t…
robertpenner 0579a4c
chore: update yarn.lock
robertpenner 2b20e6f
chore: update version of react-motion-components-preview in Calendar …
robertpenner 82814eb
chore: delete migration plan doc
robertpenner 44740c2
revert(react-motion): remove PresenceComponent type change for separa…
robertpenner dc92720
chore(react-calendar-compat): remove redundant CSS animation removal …
robertpenner 73903d6
refactor(react-calendar-compat): remove HeaderFade component and redu…
robertpenner File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
7 changes: 7 additions & 0 deletions
7
change/@fluentui-react-calendar-compat-51c1ee36-d9f0-4d16-9a35-8e1fda9424e3.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| { | ||
| "type": "patch", | ||
| "comment": "refactor(react-calendar): migrate to motion components", | ||
| "packageName": "@fluentui/react-calendar-compat", | ||
| "email": "robertpenner@microsoft.com", | ||
| "dependentChangeType": "patch" | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -12,6 +12,8 @@ import { useWeekCornerStyles, WeekCorners } from './useWeekCornerStyles.styles'; | |
| import { mergeClasses } from '@griffel/react'; | ||
| import type { Day } from '../../utils'; | ||
| import type { CalendarDayGridProps } from './CalendarDayGrid.types'; | ||
| import { DirectionalSlide } from '../../utils/calendarMotions'; | ||
| import { AnimationDirection } from '../../Calendar'; | ||
|
|
||
| export interface DayInfo extends Day { | ||
| onSelected: () => void; | ||
|
|
@@ -75,6 +77,7 @@ export const CalendarDayGrid: React.FunctionComponent<CalendarDayGridProps> = pr | |
|
|
||
| const weeks = useWeeks(props, onSelectDate, getSetRefCallback); | ||
| const animateBackwards = useAnimateBackwards(weeks); | ||
|
|
||
| const [getWeekCornerStyles, calculateRoundedStyles] = useWeekCornerStyles(props); | ||
|
|
||
| React.useImperativeHandle( | ||
|
|
@@ -130,7 +133,7 @@ export const CalendarDayGrid: React.FunctionComponent<CalendarDayGridProps> = pr | |
| showWeekNumbers, | ||
| labelledBy, | ||
| lightenDaysOutsideNavigatedMonth, | ||
| animationDirection, | ||
| animationDirection = AnimationDirection.Vertical, | ||
| } = props; | ||
|
|
||
| const classNames = useCalendarDayGridStyles_unstable({ | ||
|
|
@@ -156,6 +159,8 @@ export const CalendarDayGrid: React.FunctionComponent<CalendarDayGridProps> = pr | |
| } as const; | ||
|
|
||
| const arrowNavigationAttributes = useArrowNavigationGroup({ axis: 'grid-linear' }); | ||
| const firstWeek = weeks[0]; | ||
| const finalWeek = weeks![weeks!.length - 1]; | ||
|
|
||
| return ( | ||
| <table | ||
|
|
@@ -169,34 +174,40 @@ export const CalendarDayGrid: React.FunctionComponent<CalendarDayGridProps> = pr | |
| > | ||
| <tbody> | ||
| <CalendarMonthHeaderRow {...props} classNames={classNames} weeks={weeks} /> | ||
| <CalendarGridRow | ||
| {...props} | ||
| {...partialWeekProps} | ||
| week={weeks[0]} | ||
| weekIndex={-1} | ||
| rowClassName={classNames.firstTransitionWeek} | ||
| aria-role="presentation" | ||
| ariaHidden={true} | ||
| /> | ||
| {weeks!.slice(1, weeks!.length - 1).map((week: DayInfo[], weekIndex: number) => ( | ||
| <DirectionalSlide key={'firstTransitionWeek_' + firstWeek[0].key} {...{ animationDirection, animateBackwards }}> | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why do need a key there? To re-trigger a motion? |
||
| <CalendarGridRow | ||
| {...props} | ||
| {...partialWeekProps} | ||
| key={weekIndex} | ||
| week={week} | ||
| weekIndex={weekIndex} | ||
| rowClassName={classNames.weekRow} | ||
| week={firstWeek} | ||
| weekIndex={-1} | ||
| rowClassName={classNames.firstTransitionWeek} | ||
| aria-role="presentation" | ||
| ariaHidden={true} | ||
| /> | ||
| </DirectionalSlide> | ||
| {weeks!.slice(1, weeks!.length - 1).map((week: DayInfo[], weekIndex: number) => ( | ||
| <DirectionalSlide key={weekIndex + '_' + week[0].key} {...{ animationDirection, animateBackwards }}> | ||
| <CalendarGridRow | ||
| {...props} | ||
| {...partialWeekProps} | ||
| key={weekIndex} | ||
| week={week} | ||
| weekIndex={weekIndex} | ||
| rowClassName={classNames.weekRow} | ||
| /> | ||
| </DirectionalSlide> | ||
| ))} | ||
| <CalendarGridRow | ||
| {...props} | ||
| {...partialWeekProps} | ||
| week={weeks![weeks!.length - 1]} | ||
| weekIndex={-2} | ||
| rowClassName={classNames.lastTransitionWeek} | ||
| aria-role="presentation" | ||
| ariaHidden={true} | ||
| /> | ||
| <DirectionalSlide key={'lastTransitionWeek_' + finalWeek[0].key} {...{ animationDirection, animateBackwards }}> | ||
| <CalendarGridRow | ||
| {...props} | ||
| {...partialWeekProps} | ||
| week={finalWeek} | ||
| weekIndex={-2} | ||
| rowClassName={classNames.lastTransitionWeek} | ||
| aria-role="presentation" | ||
| ariaHidden={true} | ||
| /> | ||
| </DirectionalSlide> | ||
| </tbody> | ||
| </table> | ||
| ); | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.