diff --git a/change/@fluentui-react-progress-f5145f44-c47b-4c22-a051-e884f22b88ce.json b/change/@fluentui-react-progress-f5145f44-c47b-4c22-a051-e884f22b88ce.json new file mode 100644 index 00000000000000..0b5d974af43105 --- /dev/null +++ b/change/@fluentui-react-progress-f5145f44-c47b-4c22-a051-e884f22b88ce.json @@ -0,0 +1,7 @@ +{ + "type": "patch", + "comment": "fix: Smooth out animation of indeterminate progress bar", + "packageName": "@fluentui/react-progress", + "email": "behowell@microsoft.com", + "dependentChangeType": "patch" +} diff --git a/packages/react-components/react-progress/src/components/ProgressBar/useProgressBarStyles.ts b/packages/react-components/react-progress/src/components/ProgressBar/useProgressBarStyles.ts index ae72c534ae7c46..23b6ebd63d956e 100644 --- a/packages/react-components/react-progress/src/components/ProgressBar/useProgressBarStyles.ts +++ b/packages/react-components/react-progress/src/components/ProgressBar/useProgressBarStyles.ts @@ -1,6 +1,5 @@ import { makeStyles, mergeClasses, shorthands } from '@griffel/react'; import { tokens } from '@fluentui/react-theme'; -import { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts'; import type { ProgressBarState, ProgressBarSlots } from './ProgressBar.types'; import type { SlotClassNames } from '@fluentui/react-utilities'; @@ -20,18 +19,10 @@ const barThicknessValues = { const indeterminateProgressBar = { '0%': { - left: '-100% /* @noflip */', + left: '-33%', // matches indeterminate bar width }, '100%': { - left: '100% /* @noflip */', - }, -}; -const indeterminateProgressBarRTL = { - '100%': { - right: '-100% /* @noflip */', - }, - '0%': { - right: '100% /* @noflip */', + left: '100%', }, }; @@ -90,6 +81,7 @@ const useBarStyles = makeStyles({ )`, animationName: indeterminateProgressBar, animationDuration: '3s', + animationTimingFunction: 'linear', animationIterationCount: 'infinite', '@media screen and (prefers-reduced-motion: reduce)': { animationDuration: '0.01ms', @@ -97,10 +89,6 @@ const useBarStyles = makeStyles({ }, }, - rtl: { - animationName: indeterminateProgressBarRTL, - }, - brand: { backgroundColor: tokens.colorCompoundBrandBackground, }, @@ -123,7 +111,6 @@ export const useProgressBarStyles_unstable = (state: ProgressBarState): Progress const { color, max, shape, thickness, value } = state; const rootStyles = useRootStyles(); const barStyles = useBarStyles(); - const { dir } = useFluent(); state.root.className = mergeClasses( progressBarClassNames.root, @@ -139,7 +126,6 @@ export const useProgressBarStyles_unstable = (state: ProgressBarState): Progress barStyles.base, barStyles.brand, value === undefined && barStyles.indeterminate, - value === undefined && dir === 'rtl' && barStyles.rtl, value !== undefined && value > ZERO_THRESHOLD && barStyles.nonZeroDeterminate, color && value !== undefined && barStyles[color], state.bar.className,