rc-notification
Advanced tools
Comparing version 5.5.0 to 5.6.0
@@ -18,2 +18,3 @@ import type { CSSMotionProps } from 'rc-motion'; | ||
showProgress?: boolean; | ||
pauseOnHover?: boolean; | ||
/** @private. Config for notification holder style. Safe to remove if refactor */ | ||
@@ -20,0 +21,0 @@ className?: (placement: Placement) => string; |
@@ -8,2 +8,3 @@ import type React from 'react'; | ||
showProgress?: boolean; | ||
pauseOnHover?: boolean; | ||
closeIcon?: React.ReactNode; | ||
@@ -10,0 +11,0 @@ closable?: boolean | ({ |
@@ -16,2 +16,4 @@ import _extends from "@babel/runtime/helpers/esm/extends"; | ||
showProgress = props.showProgress, | ||
_props$pauseOnHover = props.pauseOnHover, | ||
pauseOnHover = _props$pauseOnHover === void 0 ? true : _props$pauseOnHover, | ||
eventKey = props.eventKey, | ||
@@ -60,3 +62,5 @@ content = props.content, | ||
return function () { | ||
clearTimeout(timeout); | ||
if (pauseOnHover) { | ||
clearTimeout(timeout); | ||
} | ||
setSpentTime(Date.now() - start); | ||
@@ -68,3 +72,3 @@ }; | ||
React.useEffect(function () { | ||
if (!mergedHovering && mergedShowProgress) { | ||
if (!mergedHovering && mergedShowProgress && (pauseOnHover || spentTime === 0)) { | ||
var start = performance.now(); | ||
@@ -85,7 +89,9 @@ var animationFrame; | ||
return function () { | ||
cancelAnimationFrame(animationFrame); | ||
if (pauseOnHover) { | ||
cancelAnimationFrame(animationFrame); | ||
} | ||
}; | ||
} | ||
// eslint-disable-next-line react-hooks/exhaustive-deps | ||
}, [duration, mergedHovering, mergedShowProgress, times]); | ||
}, [duration, spentTime, mergedHovering, mergedShowProgress, times]); | ||
@@ -92,0 +98,0 @@ // ======================== Closable ======================== |
@@ -18,2 +18,3 @@ import type { CSSMotionProps } from 'rc-motion'; | ||
showProgress?: boolean; | ||
pauseOnHover?: boolean; | ||
/** @private. Config for notification holder style. Safe to remove if refactor */ | ||
@@ -20,0 +21,0 @@ className?: (placement: Placement) => string; |
@@ -8,2 +8,3 @@ import type React from 'react'; | ||
showProgress?: boolean; | ||
pauseOnHover?: boolean; | ||
closeIcon?: React.ReactNode; | ||
@@ -10,0 +11,0 @@ closable?: boolean | ({ |
@@ -26,2 +26,4 @@ "use strict"; | ||
showProgress = props.showProgress, | ||
_props$pauseOnHover = props.pauseOnHover, | ||
pauseOnHover = _props$pauseOnHover === void 0 ? true : _props$pauseOnHover, | ||
eventKey = props.eventKey, | ||
@@ -70,3 +72,5 @@ content = props.content, | ||
return function () { | ||
clearTimeout(timeout); | ||
if (pauseOnHover) { | ||
clearTimeout(timeout); | ||
} | ||
setSpentTime(Date.now() - start); | ||
@@ -78,3 +82,3 @@ }; | ||
React.useEffect(function () { | ||
if (!mergedHovering && mergedShowProgress) { | ||
if (!mergedHovering && mergedShowProgress && (pauseOnHover || spentTime === 0)) { | ||
var start = performance.now(); | ||
@@ -95,7 +99,9 @@ var animationFrame; | ||
return function () { | ||
cancelAnimationFrame(animationFrame); | ||
if (pauseOnHover) { | ||
cancelAnimationFrame(animationFrame); | ||
} | ||
}; | ||
} | ||
// eslint-disable-next-line react-hooks/exhaustive-deps | ||
}, [duration, mergedHovering, mergedShowProgress, times]); | ||
}, [duration, spentTime, mergedHovering, mergedShowProgress, times]); | ||
@@ -102,0 +108,0 @@ // ======================== Closable ======================== |
{ | ||
"name": "rc-notification", | ||
"version": "5.5.0", | ||
"version": "5.6.0", | ||
"description": "notification ui component for react", | ||
@@ -5,0 +5,0 @@ "engines": { |
@@ -140,2 +140,8 @@ # rc-notification | ||
<tr> | ||
<td>pauseOnHover</td> | ||
<td>boolean</td> | ||
<td>true</td> | ||
<td>keep the timer running or not on hover</td> | ||
</tr> | ||
<tr> | ||
<td>style</td> | ||
@@ -142,0 +148,0 @@ <td>Object</td> |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
88289
1796
192