@@ -15,10 +15,12 @@ import {createContext, forwardRef} from 'react';
1515import { DOMRef , DOMRefValue } from '@react-types/shared' ;
1616import { getAllowedOverrides , staticColor , StylesPropWithHeight , UnsafeStyles } from './style-utils' with { type : 'macro' } ;
1717import { keyframes } from '../style/style-macro' with { type : 'macro' } ;
18+ import { pxToRem } from './progress-utils' with { type : 'macro' } ;
1819import { style } from '../style' with { type : 'macro' } ;
1920import { useDOMRef } from '@react-spectrum/utils' ;
2021import { useSpectrumContextProps } from './useSpectrumContextProps' ;
2122
23+ const pxToRemDynamic = ( px : number ) : string => ( px / 16 ) + 'rem' ;
2224export interface ProgressCircleStyleProps {
2325 /**
2426 * The size of the ProgressCircle.
@@ -54,17 +56,52 @@ const track = style({
5456 default : 'gray-300' ,
5557 isStaticColor : 'transparent-overlay-300' ,
5658 forcedColors : 'Background'
59+ } ,
60+ strokeWidth : {
61+ default : `[${ pxToRem ( 3 ) } ]` ,
62+ size : {
63+ S : `[${ pxToRem ( 2 ) } ]` ,
64+ L : `[${ pxToRem ( 4 ) } ]`
65+ } ,
66+ forcedColors : {
67+ default : `[${ pxToRem ( 2 ) } ]` ,
68+ size : {
69+ S : `[${ pxToRem ( 1 ) } ]` ,
70+ L : `[${ pxToRem ( 3 ) } ]`
71+ }
72+ }
5773 }
5874} ) ;
5975
6076const fill = style ( {
6177 stroke : {
6278 default : 'blue-900' ,
6379 isStaticColor : 'transparent-overlay-900' ,
64- forcedColors : 'Highlight '
80+ forcedColors : 'ButtonText '
6581 } ,
6682 rotate : - 90 ,
67- transformOrigin : 'center'
83+ transformOrigin : 'center' ,
84+ strokeWidth : {
85+ default : `[${ pxToRem ( 3 ) } ]` ,
86+ size : {
87+ S : `[${ pxToRem ( 2 ) } ]` ,
88+ L : `[${ pxToRem ( 4 ) } ]`
89+ }
90+ }
91+ } ) ;
92+
93+ const hcmStroke = style ( {
94+ stroke : {
95+ default : 'transparent' ,
96+ forcedColors : 'ButtonText'
97+ } ,
98+ strokeWidth : {
99+ default : `[${ pxToRem ( 3 ) } ]` ,
100+ size : {
101+ S : `[${ pxToRem ( 2 ) } ]` ,
102+ L : `[${ pxToRem ( 4 ) } ]`
103+ }
104+ }
68105} ) ;
69106
70107export interface ProgressCircleProps extends Omit < RACProgressBarProps , 'children' | 'style' | 'valueLabel' | 'formatOptions' | 'label' | 'className' > , ProgressCircleStyleProps , UnsafeStyles {
@@ -93,8 +130,6 @@ const dashoffsetAnimation = keyframes(`
93130 }
94131` ) ;
95132
96- let pxToRem = px => ( px / 16 ) + 'rem' ;
97-
98133/**
99134 * ProgressCircles show the progression of a system operation such as downloading, uploading, or processing, in a visual way.
100135 * They can represent determinate or indeterminate progress.
@@ -117,7 +152,7 @@ export const ProgressCircle = /*#__PURE__*/ forwardRef(function ProgressCircle(p
117152 }
118153
119154 // SVG strokes are centered, so subtract half the stroke width from the radius to create an inner stroke.
120- let radius = `calc(50% - ${ pxToRem ( strokeWidth / 2 ) } )` ;
155+ let radius = `calc(50% - ${ pxToRemDynamic ( strokeWidth / 2 ) } )` ;
121156 let isStaticColor = ! ! staticColor ;
122157
123158 return (
@@ -139,14 +174,17 @@ export const ProgressCircle = /*#__PURE__*/ forwardRef(function ProgressCircle(p
139174 cx = "50%"
140175 cy = "50%"
141176 r = { radius }
142- strokeWidth = { pxToRem ( strokeWidth ) }
143- className = { track ( { isStaticColor} ) } />
177+ className = { hcmStroke ( { size} ) } />
178+ < circle
179+ cx = "50%"
180+ cy = "50%"
181+ r = { radius }
182+ className = { track ( { isStaticColor, size} ) } />
144183 < circle
145184 cx = "50%"
146185 cy = "50%"
147186 r = { radius }
148- strokeWidth = { pxToRem ( strokeWidth ) }
149- className = { fill ( { isStaticColor} ) }
187+ className = { fill ( { isStaticColor, size} ) }
150188 style = { {
151189 // These cubic-bezier timing functions were derived from the previous animation keyframes
152190 // using a best fit algorithm, and then manually adjusted to approximate the original animation.
0 commit comments