Skip to content

Commit

Permalink
fix name
Browse files Browse the repository at this point in the history
  • Loading branch information
sai6855 committed Sep 21, 2023
1 parent 28d70f3 commit 317f2a7
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 22 deletions.
38 changes: 19 additions & 19 deletions packages/mui-joy/src/CircularProgress/CircularProgress.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import {
CircularProgressProps,
CircularProgressTypeMap,
} from './CircularProgressProps';
import cssVars from './CircularProgressCssVars';
import circularProgressCssVars from './CircularProgressCssVars';

const circulate = keyframes({
'0%': {
Expand Down Expand Up @@ -48,7 +48,7 @@ const useUtilityClasses = (ownerState: CircularProgressOwnerState) => {
};

function getThickness(slot: 'track' | 'progress', defaultValue: string) {
return `var(${cssVars[`${slot}Thickness`]}, var(${cssVars.thickness}, ${defaultValue}))`;
return `var(${circularProgressCssVars[`${slot}Thickness`]}, var(${circularProgressCssVars.thickness}, ${defaultValue}))`;
}

const CircularProgressRoot = styled('span', {
Expand All @@ -62,33 +62,33 @@ const CircularProgressRoot = styled('span', {
// integration with icon
'--Icon-fontSize': 'calc(0.4 * var(--_root-size))',
// public variables
[cssVars.trackColor]: backgroundColor,
[cssVars.progressColor]: color,
[cssVars.percent]: ownerState.value, // 0 - 100
[cssVars.linecap]: 'round',
[circularProgressCssVars.trackColor]: backgroundColor,
[circularProgressCssVars.progressColor]: color,
[circularProgressCssVars.percent]: ownerState.value, // 0 - 100
[circularProgressCssVars.linecap]: 'round',
...(ownerState.size === 'sm' && {
'--_root-size': `var(${cssVars.size}, 24px)`, // use --_root-size to let other components overrides via --CircularProgress-size
'--_root-size': `var(${circularProgressCssVars.size}, 24px)`, // use --_root-size to let other components overrides via --CircularProgress-size
'--_track-thickness': getThickness('track', '3px'),
'--_progress-thickness': getThickness('progress', '3px'),
}),
...(ownerState.instanceSize === 'sm' && {
[cssVars.size]: '24px',
[circularProgressCssVars.size]: '24px',
}),
...(ownerState.size === 'md' && {
'--_track-thickness': getThickness('track', '6px'),
'--_progress-thickness': getThickness('progress', '6px'),
'--_root-size': `var(${cssVars.size}, 40px)`,
'--_root-size': `var(${circularProgressCssVars.size}, 40px)`,
}),
...(ownerState.instanceSize === 'md' && {
[cssVars.size]: '40px',
[circularProgressCssVars.size]: '40px',
}),
...(ownerState.size === 'lg' && {
'--_track-thickness': getThickness('track', '8px'),
'--_progress-thickness': getThickness('progress', '8px'),
'--_root-size': `var(${cssVars.size}, 64px)`,
'--_root-size': `var(${circularProgressCssVars.size}, 64px)`,
}),
...(ownerState.instanceSize === 'lg' && {
[cssVars.size]: '64px',
[circularProgressCssVars.size]: '64px',
}),
...(ownerState.thickness && {
'--_track-thickness': `${ownerState.thickness}px`,
Expand All @@ -101,7 +101,7 @@ const CircularProgressRoot = styled('span', {
width: 'var(--_root-size)',
height: 'var(--_root-size)',
borderRadius: 'var(--_root-size)',
margin: `var(${cssVars.margin})`,
margin: `var(${circularProgressCssVars.margin})`,
boxSizing: 'border-box',
display: 'inline-flex',
justifyContent: 'center',
Expand Down Expand Up @@ -157,7 +157,7 @@ const CircularProgressTrack = styled('circle', {
r: 'calc(var(--_inner-size) / 2 - var(--_track-thickness) / 2 + min(0px, var(--_thickness-diff) / 2))',
fill: 'transparent',
strokeWidth: 'var(--_track-thickness)',
stroke: `var(${cssVars.trackColor}})`,
stroke: `var(${circularProgressCssVars.trackColor}})`,
});

const CircularProgressProgress = styled('circle', {
Expand All @@ -174,17 +174,17 @@ const CircularProgressProgress = styled('circle', {
r: 'var(--_progress-radius)',
fill: 'transparent',
strokeWidth: 'var(--_progress-thickness)',
stroke: `var(${cssVars.progressColor})`,
strokeLinecap: `var(${cssVars.linecap}, round)` as 'round', // can't use CSS variable directly, need to cast type.
stroke: `var(${circularProgressCssVars.progressColor})`,
strokeLinecap: `var(${circularProgressCssVars.linecap}, round)` as 'round', // can't use CSS variable directly, need to cast type.
strokeDasharray: 'var(--_progress-length)',
strokeDashoffset: `calc(var(--_progress-length) - var(${cssVars.percent}) * var(--_progress-length) / 100)`,
strokeDashoffset: `calc(var(--_progress-length) - var(${circularProgressCssVars.percent}) * var(--_progress-length) / 100)`,
transformOrigin: 'center',
transform: 'rotate(-90deg)', // to initially appear at the top-center of the circle.
},
({ ownerState }) =>
!ownerState.determinate &&
css`
animation: var(${cssVars.circulation}, 0.8s linear 0s infinite normal none running)
animation: var(${circularProgressCssVars.circulation}, 0.8s linear 0s infinite normal none running)
${circulate};
`,
);
Expand Down Expand Up @@ -253,7 +253,7 @@ const CircularProgress = React.forwardRef(function CircularProgress(inProps, ref
// Setting this CSS variable via inline-style
// prevents the generation of new CSS every time
// `value` prop updates
[cssVars.percent]: value,
[circularProgressCssVars.percent]: value,
},
...(value &&
determinate && {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { CssVarsValuesType } from '../utils/CssVarsType';

const cssVars = {
const circularProgressCssVars = {
thickness: '--CircularProgress-thickness',
trackThickness: '--CircularProgress-trackThickness',
progressThickness: '--CircularProgress-progressThickness',
Expand All @@ -14,8 +14,8 @@ const cssVars = {
} as const;

export type CircularProgressCssVarsType = CssVarsValuesType<
keyof typeof cssVars,
keyof typeof circularProgressCssVars,
'CircularProgress'
>;

export default cssVars;
export default circularProgressCssVars;

0 comments on commit 317f2a7

Please sign in to comment.