@@ -92,8 +92,6 @@ import {
9292 fontWeightVars ,
9393 typeScaleVars ,
9494 typographyVars ,
95- durationVars ,
96- easeVars ,
9795} from '../theme/tokens.stylex' ;
9896import { useTooltip } from '../Tooltip' ;
9997import { VisuallyHidden } from '../VisuallyHidden' ;
@@ -124,7 +122,11 @@ import {
124122 fromMonthIndex ,
125123 monthIndexOf ,
126124} from './monthGeometry' ;
127- import { dateInputTouchSizes , dateInputTouchGeometry } from './tokens.stylex' ;
125+ import {
126+ dateInputTouchSizes ,
127+ dateInputTouchGeometry ,
128+ monthYearToggleMotion ,
129+ } from './tokens.stylex' ;
128130
129131/**
130132 * The comfortable minimum tap target on both iOS and Android, honoured by
@@ -133,23 +135,19 @@ import {dateInputTouchSizes, dateInputTouchGeometry} from './tokens.stylex';
133135const TOUCH_TARGET = dateInputTouchSizes . daySize ;
134136
135137/**
136- * The whole surface swap, in one leg.
137- *
138- * It used to be two: the outgoing surface faded out, then the incoming one
139- * faded in, 110ms each. The sequencing existed for one reason — the wheels'
140- * panel was transparent, so overlapping the two put the wheels' translucent
141- * selection band over the calendar grid and tinted a band-shaped strip of it,
142- * which read as "the grey area animates differently from the content".
143- *
144- * Giving the wheels an opaque background removes the reason. Nothing shows
145- * through them, so they can simply fade in ON TOP of a calendar that does not
146- * move at all — no empty middle, no outgoing animation, and one duration
147- * instead of a wait plus a fade.
138+ * The whole surface swap, in one leg: UIDatePicker's month/year toggle
139+ * (motion/uikit/datePicker.ts `calendar.monthYearToggle`), where the wheels
140+ * fade in as the grid, the weekday row and the chevrons fade out, all at once,
141+ * 0.25 s on UIKit's default ease-in-ease-out, and the title's chevron turns a
142+ * quarter turn on the same clock.
148143 *
149- * `--duration-fast` rather than a literal now that this is a whole duration
150- * and not half of one.
144+ * The wheels' panel is opaque, so it can simply fade in ON TOP of a calendar
145+ * that does not move: nothing shows through it, and the arrows and the
146+ * weekday row (above the panel's reach) fade out beneath it on the same
147+ * timing, so the change reads as one motion.
151148 */
152- const SWAP_DURATION = durationVars [ '--duration-fast' ] ;
149+ const SWAP_DURATION = monthYearToggleMotion . duration ;
150+ const SWAP_CURVE = monthYearToggleMotion . curve ;
153151
154152const sizeStyles = stylex . create ( {
155153 sm : {
@@ -271,7 +269,7 @@ const styles = stylex.create({
271269 // blinking out a beat before the grid is covered.
272270 transitionProperty : 'opacity, visibility' ,
273271 transitionDuration : SWAP_DURATION ,
274- transitionTimingFunction : 'linear' ,
272+ transitionTimingFunction : SWAP_CURVE ,
275273 '@media (prefers-reduced-motion: reduce)' : {
276274 transitionDuration : '0.01s' ,
277275 } ,
@@ -328,7 +326,7 @@ const styles = stylex.create({
328326 alignItems : 'center' ,
329327 transitionProperty : 'opacity, visibility' ,
330328 transitionDuration : SWAP_DURATION ,
331- transitionTimingFunction : 'linear' ,
329+ transitionTimingFunction : SWAP_CURVE ,
332330 '@media (prefers-reduced-motion: reduce)' : {
333331 transitionDuration : '0.01s' ,
334332 } ,
@@ -384,19 +382,22 @@ const styles = stylex.create({
384382 titleChevron : {
385383 display : 'inline-flex' ,
386384 flexShrink : 0 ,
387- // The one part of the swap that keeps `--ease-standard`, because it is
388- // the one part that travels: a rotation has a distance to cover, and
389- // fast-out-slow-in is what that curve is for. Same duration as the
390- // surface it announces, so the two land together.
385+ // It points along the reading direction while the calendar shows and
386+ // turns a quarter turn to point down while the wheels show, on the
387+ // toggle's own clock.
391388 transitionProperty : 'transform' ,
392389 transitionDuration : SWAP_DURATION ,
393- transitionTimingFunction : easeVars [ '--ease-standard' ] ,
390+ transitionTimingFunction : SWAP_CURVE ,
394391 '@media (prefers-reduced-motion: reduce)' : {
395392 transitionDuration : '0.01s' ,
396393 } ,
397394 } ,
398395 titleChevronOpen : {
399- transform : 'rotate(180deg)' ,
396+ transform : `rotate(${ monthYearToggleMotion . chevronTurn } )` ,
397+ } ,
398+ titleChevronMirror : {
399+ display : 'inline-flex' ,
400+ flexShrink : 0 ,
400401 } ,
401402 weekdays : {
402403 display : 'grid' ,
@@ -407,7 +408,7 @@ const styles = stylex.create({
407408 // timing rather than clearing on its own.
408409 transitionProperty : 'opacity, visibility' ,
409410 transitionDuration : SWAP_DURATION ,
410- transitionTimingFunction : 'linear' ,
411+ transitionTimingFunction : SWAP_CURVE ,
411412 '@media (prefers-reduced-motion: reduce)' : {
412413 transitionDuration : '0.01s' ,
413414 } ,
@@ -509,7 +510,7 @@ const styles = stylex.create({
509510 isolation : 'isolate' ,
510511 transitionProperty : 'opacity, visibility' ,
511512 transitionDuration : SWAP_DURATION ,
512- transitionTimingFunction : 'linear' ,
513+ transitionTimingFunction : SWAP_CURVE ,
513514 '@media (prefers-reduced-motion: reduce)' : {
514515 transitionDuration : '0.01s' ,
515516 } ,
@@ -1006,17 +1007,21 @@ export function TouchDateField({
10061007 focusOutlineStyles . focusVisible ,
10071008 ) } >
10081009 < span { ...stylex . props ( styles . titleText ) } > { monthYearLabel } </ span >
1009- < Icon
1010- icon = "chevronDown"
1011- size = "sm"
1012- color = "secondary"
1013- // The transform rides on the Icon itself, not a wrapper span, so
1014- // the element a theme can target is the element that moves.
1015- xstyle = { [
1016- styles . titleChevron ,
1017- isWheelOpen && styles . titleChevronOpen ,
1018- ] }
1019- />
1010+ { /* Mirrored under RTL so it points along the reading direction;
1011+ the turn rides on the Icon itself, so the element a theme can
1012+ target is the element that moves (mirrored, the same turn still
1013+ ends pointing down). */ }
1014+ < span { ...stylex . props ( styles . titleChevronMirror , rtlStyles . mirror ) } >
1015+ < Icon
1016+ icon = "chevronRight"
1017+ size = "sm"
1018+ color = "secondary"
1019+ xstyle = { [
1020+ styles . titleChevron ,
1021+ isWheelOpen && styles . titleChevronOpen ,
1022+ ] }
1023+ />
1024+ </ span >
10201025 </ button >
10211026 { /* Both arrows at the trailing corner, as a pair — and only while the
10221027 calendar is the surface they step. `IconButton` gives them
0 commit comments