diff --git a/components/config-provider/__tests__/__snapshots__/components.test.tsx.snap b/components/config-provider/__tests__/__snapshots__/components.test.tsx.snap index 24f0069e1e..da945d5e35 100644 --- a/components/config-provider/__tests__/__snapshots__/components.test.tsx.snap +++ b/components/config-provider/__tests__/__snapshots__/components.test.tsx.snap @@ -21734,7 +21734,7 @@ exports[`ConfigProvider components Progress configProvider 1`] = ` >
@@ -21762,7 +21762,7 @@ exports[`ConfigProvider components Progress configProvider componentDisabled 1`] >
@@ -21790,7 +21790,7 @@ exports[`ConfigProvider components Progress configProvider componentSize large 1 >
@@ -21818,7 +21818,7 @@ exports[`ConfigProvider components Progress configProvider componentSize middle >
@@ -21846,7 +21846,7 @@ exports[`ConfigProvider components Progress configProvider componentSize small 1 >
@@ -21874,7 +21874,7 @@ exports[`ConfigProvider components Progress normal 1`] = ` >
@@ -21902,7 +21902,7 @@ exports[`ConfigProvider components Progress prefixCls 1`] = ` >
diff --git a/components/progress/Line.tsx b/components/progress/Line.tsx index ce864997cd..4c55aff316 100644 --- a/components/progress/Line.tsx +++ b/components/progress/Line.tsx @@ -5,6 +5,8 @@ import { devUseWarning } from '../_util/warning'; import type { DirectionType } from '../config-provider'; import type { ProgressGradient, ProgressProps, StringGradients } from './progress'; import { getSize, getSuccessPercent, validProgress } from './utils'; +import { useContext } from 'react'; +import { ConfigContext } from '../config-provider'; interface LineProps extends ProgressProps { prefixCls: string; @@ -82,6 +84,8 @@ const Line: React.FC = (props) => { success, } = props; + const { direction } = useContext(ConfigContext); + const backgroundProps: React.CSSProperties = strokeColor && typeof strokeColor !== 'string' ? handleGradient(strokeColor, directionConfig) @@ -105,18 +109,26 @@ const Line: React.FC = (props) => { } const percentStyle: React.CSSProperties = { - width: `${validProgress(percent)}%`, + width: `100%`, height, borderRadius, + clipPath: + direction === 'rtl' + ? `inset(0 0 0 ${100 - validProgress(percent)}% round 100px)` + : `inset(0 ${100 - validProgress(percent)}% 0 0 round 100px)`, ...backgroundProps, }; const successPercent = getSuccessPercent(props); const successPercentStyle: React.CSSProperties = { - width: `${validProgress(successPercent)}%`, + width: `100%`, height, borderRadius, + clipPath: + direction === 'rtl' + ? `inset(0 0 0 ${100 - validProgress(successPercent)}% round 100px)` + : `inset(0 ${100 - validProgress(successPercent)}% 0 0 round 100px)`, backgroundColor: success?.strokeColor, }; diff --git a/components/progress/__tests__/__snapshots__/demo-extend.test.ts.snap b/components/progress/__tests__/__snapshots__/demo-extend.test.ts.snap index c1a889aa05..4f0ffa4163 100644 --- a/components/progress/__tests__/__snapshots__/demo-extend.test.ts.snap +++ b/components/progress/__tests__/__snapshots__/demo-extend.test.ts.snap @@ -533,7 +533,7 @@ Array [ >
@@ -562,7 +562,7 @@ Array [ >
@@ -591,7 +591,7 @@ Array [ >
@@ -1275,7 +1275,7 @@ Array [ >
@@ -1547,7 +1547,7 @@ exports[`renders components/progress/demo/gradient-line.tsx extend context corre >
@@ -1559,7 +1559,7 @@ exports[`renders components/progress/demo/gradient-line.tsx extend context corre
@@ -1572,15 +1572,15 @@ exports[`renders components/progress/demo/gradient-line.tsx extend context corre >
- 99.9% + 50%
@@ -2129,7 +2129,7 @@ Array [ >
@@ -2154,7 +2154,7 @@ Array [ >
@@ -2197,7 +2197,7 @@ Array [ >
@@ -2239,7 +2239,7 @@ Array [ >
@@ -2267,7 +2267,7 @@ exports[`renders components/progress/demo/line-mini.tsx extend context correctly >
@@ -2292,7 +2292,7 @@ exports[`renders components/progress/demo/line-mini.tsx extend context correctly >
@@ -2317,7 +2317,7 @@ exports[`renders components/progress/demo/line-mini.tsx extend context correctly >
@@ -2360,7 +2360,7 @@ exports[`renders components/progress/demo/line-mini.tsx extend context correctly >
@@ -2410,7 +2410,7 @@ Array [ >
@@ -2559,11 +2559,11 @@ Array [ >
@@ -2775,7 +2775,7 @@ Array [ >
@@ -2804,7 +2804,7 @@ Array [ >
@@ -2833,7 +2833,7 @@ Array [ >
diff --git a/components/progress/__tests__/__snapshots__/demo.test.ts.snap b/components/progress/__tests__/__snapshots__/demo.test.ts.snap index b8c308f317..39a48e7541 100644 --- a/components/progress/__tests__/__snapshots__/demo.test.ts.snap +++ b/components/progress/__tests__/__snapshots__/demo.test.ts.snap @@ -503,7 +503,7 @@ Array [ >
@@ -532,7 +532,7 @@ Array [ >
@@ -561,7 +561,7 @@ Array [ >
@@ -1193,7 +1193,7 @@ Array [ >
@@ -1461,7 +1461,7 @@ exports[`renders components/progress/demo/gradient-line.tsx correctly 1`] = ` >
@@ -1473,7 +1473,7 @@ exports[`renders components/progress/demo/gradient-line.tsx correctly 1`] = `
@@ -1486,15 +1486,15 @@ exports[`renders components/progress/demo/gradient-line.tsx correctly 1`] = ` >
- 99.9% + 50%
@@ -2041,7 +2041,7 @@ Array [ >
@@ -2066,7 +2066,7 @@ Array [ >
@@ -2109,7 +2109,7 @@ Array [ >
@@ -2151,7 +2151,7 @@ Array [ >
@@ -2177,7 +2177,7 @@ exports[`renders components/progress/demo/line-mini.tsx correctly 1`] = ` >
@@ -2202,7 +2202,7 @@ exports[`renders components/progress/demo/line-mini.tsx correctly 1`] = ` >
@@ -2227,7 +2227,7 @@ exports[`renders components/progress/demo/line-mini.tsx correctly 1`] = ` >
@@ -2270,7 +2270,7 @@ exports[`renders components/progress/demo/line-mini.tsx correctly 1`] = ` >
@@ -2318,7 +2318,7 @@ Array [ >
@@ -2465,11 +2465,11 @@ Array [ >
@@ -2622,7 +2622,7 @@ Array [ >
@@ -2651,7 +2651,7 @@ Array [ >
@@ -2680,7 +2680,7 @@ Array [ >
diff --git a/components/progress/__tests__/__snapshots__/index.test.tsx.snap b/components/progress/__tests__/__snapshots__/index.test.tsx.snap index 37a2caf166..1ddcbc248d 100644 --- a/components/progress/__tests__/__snapshots__/index.test.tsx.snap +++ b/components/progress/__tests__/__snapshots__/index.test.tsx.snap @@ -180,11 +180,11 @@ exports[`Progress render format 1`] = ` >
@@ -212,7 +212,7 @@ exports[`Progress render negative progress 1`] = ` >
@@ -240,11 +240,11 @@ exports[`Progress render negative successPercent 1`] = ` >
@@ -272,7 +272,7 @@ exports[`Progress render normal progress 1`] = ` >
@@ -300,7 +300,7 @@ exports[`Progress render out-of-range progress 1`] = ` >
@@ -345,7 +345,7 @@ exports[`Progress render out-of-range progress with info 1`] = ` >
@@ -445,7 +445,7 @@ exports[`Progress render strokeColor 2`] = ` >
@@ -473,7 +473,7 @@ exports[`Progress render strokeColor 3`] = ` >
@@ -558,11 +558,11 @@ exports[`Progress render successColor progress 1`] = ` >
@@ -701,7 +701,7 @@ exports[`Progress render trailColor progress 1`] = ` >
@@ -729,7 +729,7 @@ exports[`Progress rtl render component should be rendered correctly in RTL direc >
diff --git a/components/progress/demo/gradient-line.tsx b/components/progress/demo/gradient-line.tsx index 03d6b166e4..dfbcf899d3 100644 --- a/components/progress/demo/gradient-line.tsx +++ b/components/progress/demo/gradient-line.tsx @@ -7,7 +7,7 @@ const conicColors = { '0%': '#87d068', '50%': '#ffe58f', '100%': '#ffccc7' }; const App: React.FC = () => (
- +