@@ -3,6 +3,8 @@ import { clsx } from 'clsx';
33import useNoticeTimer from './hooks/useNoticeTimer' ;
44import { useEvent } from '@rc-component/util' ;
55import useClosable , { type ClosableType } from './hooks/useClosable' ;
6+ import DefaultProgress from './Progress' ;
7+ import type { NotificationProgressProps } from './Progress' ;
68
79export interface NotificationClassNames {
810 wrapper ?: string ;
@@ -22,13 +24,18 @@ export interface NotificationStyles {
2224 progress ?: React . CSSProperties ;
2325}
2426
27+ export interface ComponentsType {
28+ progress ?: React . ComponentType < NotificationProgressProps > ;
29+ }
30+
2531export interface NotificationProps {
2632 // Style
2733 prefixCls : string ;
2834 className ?: string ;
2935 style ?: React . CSSProperties ;
3036 classNames ?: NotificationClassNames ;
3137 styles ?: NotificationStyles ;
38+ components ?: ComponentsType ;
3239
3340 // UI
3441 title ?: React . ReactNode ;
@@ -65,6 +72,7 @@ const Notification = React.forwardRef<HTMLDivElement, NotificationProps>((props,
6572 style,
6673 classNames,
6774 styles,
75+ components,
6876
6977 // UI
7078 title,
@@ -104,6 +112,7 @@ const Notification = React.forwardRef<HTMLDivElement, NotificationProps>((props,
104112 const [ onResume , onPause ] = useNoticeTimer ( duration , onInternalClose , setPercent , ! ! showProgress ) ;
105113
106114 const validPercent = 100 - Math . min ( Math . max ( percent * 100 , 0 ) , 100 ) ;
115+ const Progress = components ?. progress || DefaultProgress ;
107116
108117 React . useEffect ( ( ) => {
109118 if ( ! pauseOnHover ) {
@@ -230,17 +239,18 @@ const Notification = React.forwardRef<HTMLDivElement, NotificationProps>((props,
230239 { actions && < div className = "actions" > { actions } </ div > }
231240
232241 { showProgress && typeof duration === 'number' && duration > 0 && (
233- < progress
242+ < Progress
234243 className = { clsx ( `${ noticePrefixCls } -progress` , classNames ?. progress ) }
235- max = "100"
236- value = { validPercent }
244+ percent = { validPercent }
237245 style = { styles ?. progress }
238246 />
239247 ) }
240248 </ div >
241249 ) ;
242250} ) ;
243251
244- Notification . displayName = 'Notification' ;
252+ if ( process . env . NODE_ENV !== 'production' ) {
253+ Notification . displayName = 'Notification' ;
254+ }
245255
246256export default Notification ;
0 commit comments