@@ -13,6 +13,13 @@ export const spinnerClassNames: SlotClassNames<SpinnerSlots> = {
1313 label : 'fui-Spinner__label' ,
1414} ;
1515
16+ /**
17+ * @internal Class names for the tail arc span elements (replacing ::before/::after).
18+ */
19+ export const spinnerTailArcClassNames = {
20+ arc : 'fui-Spinner__spinnerTailArc' ,
21+ } ;
22+
1623/**
1724 * CSS variables used internally by Spinner
1825 */
@@ -55,68 +62,41 @@ const useSpinnerBaseClassName = makeResetStyles({
5562 forcedColorAdjust : 'none' ,
5663 } ,
5764
58- animationDuration : '1.5s' ,
59- animationIterationCount : 'infinite' ,
60- animationTimingFunction : 'linear' ,
61- animationName : {
62- '0%' : { transform : 'rotate(0deg)' } ,
63- '100%' : { transform : 'rotate(360deg)' } ,
64- } ,
65-
66- '@media screen and (prefers-reduced-motion: reduce)' : {
67- animationDuration : '1.8s' ,
68- } ,
65+ // CSS rotation animation removed — now handled by SpinnerRotation motion component in renderSpinner
6966} ) ;
7067
71- // The spinner tail is rendered using two 135deg arc segments, behind a 105deg arc mask .
68+ // The spinner tail uses a 105deg arc mask with two arc segment child spans (replacing ::before/::after) .
7269// The segments are rotated out from behind the mask to expand the visible arc from
7370// 30deg (min) to 255deg (max), and then back behind the mask again to shrink the arc.
74- // The tail and spinner itself also have 360deg rotation animations for the spin .
71+ // All animations ( tail rotation + arc expand/collapse) are handled by WAAPI motion components .
7572const useSpinnerTailBaseClassName = makeResetStyles ( {
7673 position : 'absolute' ,
7774 display : 'block' ,
7875 width : '100%' ,
7976 height : '100%' ,
8077 maskImage : 'conic-gradient(transparent 105deg, white 105deg)' ,
8178
82- '&::before, &::after' : {
83- content : '""' ,
84- position : 'absolute' ,
85- display : 'block' ,
86- width : '100%' ,
87- height : '100%' ,
88- animation : 'inherit' ,
89- backgroundImage : 'conic-gradient(currentcolor 135deg, transparent 135deg)' ,
90- } ,
79+ // CSS animations removed — now handled by SpinnerTailMotion in renderSpinner
9180
92- animationDuration : '1.5s' ,
93- animationIterationCount : 'infinite' ,
94- animationTimingFunction : tokens . curveEasyEase ,
95- animationName : {
96- '0%' : { transform : 'rotate(-135deg)' } ,
97- '50%' : { transform : 'rotate(0deg)' } ,
98- '100%' : { transform : 'rotate(225deg)' } ,
99- } ,
100- '&::before' : {
101- animationName : {
102- '0%' : { transform : 'rotate(0deg)' } ,
103- '50%' : { transform : 'rotate(105deg)' } ,
104- '100%' : { transform : 'rotate(0deg)' } ,
105- } ,
106- } ,
107- '&::after' : {
108- animationName : {
109- '0%' : { transform : 'rotate(0deg)' } ,
110- '50%' : { transform : 'rotate(225deg)' } ,
111- '100%' : { transform : 'rotate(0deg)' } ,
112- } ,
113- } ,
11481 '@media screen and (prefers-reduced-motion: reduce)' : {
115- animationIterationCount : '0' ,
82+ // Show a static arc directly on the tail element
11683 backgroundImage : 'conic-gradient(transparent 120deg, currentcolor 360deg)' ,
117- '&::before, &::after' : {
118- content : 'none' ,
119- } ,
84+ } ,
85+ } ) ;
86+
87+ // Styles for the arc span elements (replacing the ::before/::after pseudo-elements).
88+ // Both arc elements share identical base styles; their different rotation animations
89+ // are handled by SpinnerArcStartMotion and SpinnerArcEndMotion respectively.
90+ const useSpinnerTailArcBaseClassName = makeResetStyles ( {
91+ position : 'absolute' ,
92+ display : 'block' ,
93+ width : '100%' ,
94+ height : '100%' ,
95+ backgroundImage : 'conic-gradient(currentcolor 135deg, transparent 135deg)' ,
96+
97+ '@media screen and (prefers-reduced-motion: reduce)' : {
98+ // Hide arc elements in reduced motion — static arc is shown on the tail container
99+ display : 'none' ,
120100 } ,
121101} ) ;
122102
@@ -128,14 +108,15 @@ const useSpinnerStyles = makeStyles({
128108
129109 rtlTail : {
130110 maskImage : 'conic-gradient(white 255deg, transparent 255deg)' ,
131- '&::before, &::after' : {
132- backgroundImage : 'conic-gradient(transparent 225deg, currentcolor 225deg)' ,
133- } ,
134111 '@media screen and (prefers-reduced-motion: reduce)' : {
135112 backgroundImage : 'conic-gradient(currentcolor 0deg, transparent 240deg)' ,
136113 } ,
137114 } ,
138115
116+ rtlTailArc : {
117+ backgroundImage : 'conic-gradient(transparent 225deg, currentcolor 225deg)' ,
118+ } ,
119+
139120 'extra-tiny' : {
140121 height : '16px' ,
141122 width : '16px' ,
@@ -237,6 +218,7 @@ export const useSpinnerStyles_unstable = (state: SpinnerState): SpinnerState =>
237218 const spinnerBaseClassName = useSpinnerBaseClassName ( ) ;
238219 const spinnerStyles = useSpinnerStyles ( ) ;
239220 const spinnerTailBaseClassName = useSpinnerTailBaseClassName ( ) ;
221+ const spinnerTailArcBaseClassName = useSpinnerTailArcBaseClassName ( ) ;
240222 const labelStyles = useLabelStyles ( ) ;
241223
242224 state . root . className = mergeClasses (
@@ -262,6 +244,11 @@ export const useSpinnerStyles_unstable = (state: SpinnerState): SpinnerState =>
262244 state . spinnerTail . className ,
263245 ) ;
264246 }
247+
248+ // Set arc element classNames for use in renderSpinner
249+ state . tailArcClassName = mergeClasses ( spinnerTailArcClassNames . arc , spinnerTailArcBaseClassName ) ;
250+ state . tailArcRtlClassName = dir === 'rtl' ? spinnerStyles . rtlTailArc : undefined ;
251+
265252 if ( state . label ) {
266253 state . label . className = mergeClasses (
267254 spinnerClassNames . label ,
0 commit comments