@@ -2,9 +2,12 @@ import * as React from 'react';
22import classNames from 'classnames' ;
33import { useTransitionDuration , defaultProps } from './common' ;
44import type { ProgressProps } from './interface' ;
5+ import getIndeterminateLine from './utils/getIndeterminateLine' ;
6+ import useId from './hooks/useId' ;
57
68const Line : React . FC < ProgressProps > = ( props ) => {
79 const {
10+ id,
811 className,
912 percent,
1013 prefixCls,
@@ -15,12 +18,15 @@ const Line: React.FC<ProgressProps> = (props) => {
1518 trailColor,
1619 trailWidth,
1720 transition,
21+ loading,
1822 ...restProps
1923 } = {
2024 ...defaultProps ,
2125 ...props ,
2226 } ;
2327
28+ const mergedId = useId ( id ) ;
29+
2430 // eslint-disable-next-line no-param-reassign
2531 delete restProps . gapPosition ;
2632 const percentList = Array . isArray ( percent ) ? percent : [ percent ] ;
@@ -34,6 +40,14 @@ const Line: React.FC<ProgressProps> = (props) => {
3440 L ${ strokeLinecap === 'round' ? right : 100 } ,${ center } ` ;
3541 const viewBoxString = `0 0 100 ${ strokeWidth } ` ;
3642 let stackPtg = 0 ;
43+ const { indeterminateStyleProps, indeterminateStyleAnimation } = getIndeterminateLine ( {
44+ id : mergedId ,
45+ loading,
46+ percent : percentList [ 0 ] ,
47+ strokeLinecap,
48+ strokeWidth,
49+ } ) ;
50+
3751 return (
3852 < svg
3953 className = { classNames ( `${ prefixCls } -line` , className ) }
@@ -69,6 +83,7 @@ const Line: React.FC<ProgressProps> = (props) => {
6983 transition :
7084 transition ||
7185 'stroke-dashoffset 0.3s ease 0s, stroke-dasharray .3s ease 0s, stroke 0.3s linear' ,
86+ ...indeterminateStyleProps ,
7287 } ;
7388 const color = strokeColorList [ index ] || strokeColorList [ strokeColorList . length - 1 ] ;
7489 stackPtg += ptg ;
@@ -93,6 +108,7 @@ const Line: React.FC<ProgressProps> = (props) => {
93108 />
94109 ) ;
95110 } ) }
111+ { indeterminateStyleAnimation }
96112 </ svg >
97113 ) ;
98114} ;
0 commit comments