@choice-ui/react 1.7.1 → 1.7.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -14,13 +14,13 @@ const SWIPE_THRESHOLD = 56;
|
|
|
14
14
|
const ANIMATION_CONFIG = {
|
|
15
15
|
default: {
|
|
16
16
|
type: "spring",
|
|
17
|
-
stiffness:
|
|
18
|
-
damping:
|
|
17
|
+
stiffness: 120,
|
|
18
|
+
damping: 18,
|
|
19
19
|
mass: 1
|
|
20
20
|
},
|
|
21
21
|
opacity: {
|
|
22
22
|
type: "tween",
|
|
23
|
-
duration: 0.
|
|
23
|
+
duration: 0.4,
|
|
24
24
|
ease: "easeOut"
|
|
25
25
|
}
|
|
26
26
|
};
|
|
@@ -72,7 +72,7 @@ const ToasterItem = memo(
|
|
|
72
72
|
const [swipeDirection, setSwipeDirection] = useState(null);
|
|
73
73
|
const swipeStartRef = useRef(null);
|
|
74
74
|
const toastDuration = toast.duration ?? defaultDuration;
|
|
75
|
-
const shouldShowProgress = showProgress && toastDuration > 0 && toast.type !== "loading";
|
|
75
|
+
const shouldShowProgress = showProgress && toastDuration > 0 && Number.isFinite(toastDuration) && toast.type !== "loading";
|
|
76
76
|
const offsetY = useMemo(() => {
|
|
77
77
|
if (expanded) {
|
|
78
78
|
let offset = 0;
|
|
@@ -199,13 +199,13 @@ const ToasterItem = memo(
|
|
|
199
199
|
const enterExitY = isTop ? -100 : 100;
|
|
200
200
|
const exitAnimation = useMemo(() => {
|
|
201
201
|
const dir = swipeDirection || toast.swipeDirection;
|
|
202
|
-
const exitBase = { opacity: 0, zIndex: -1, filter: "blur(
|
|
202
|
+
const exitBase = { opacity: 0, zIndex: -1, filter: "blur(8px)" };
|
|
203
203
|
if (dir === "right") return { ...exitBase, x: "100%" };
|
|
204
204
|
if (dir === "left") return { ...exitBase, x: "-100%" };
|
|
205
205
|
if (dir === "up") return { ...exitBase, y: "-100%" };
|
|
206
206
|
if (dir === "down") return { ...exitBase, y: "100%" };
|
|
207
|
-
return exitBase;
|
|
208
|
-
}, [swipeDirection, toast.swipeDirection]);
|
|
207
|
+
return { ...exitBase, y: isTop ? "-100%" : "100%" };
|
|
208
|
+
}, [swipeDirection, toast.swipeDirection, isTop]);
|
|
209
209
|
const tv = useMemo(
|
|
210
210
|
() => toastRootTv({
|
|
211
211
|
layout,
|
|
@@ -296,7 +296,13 @@ const ToasterItem = memo(
|
|
|
296
296
|
...isHtmlString(toast.description) ? { dangerouslySetInnerHTML: { __html: toast.description } } : { children: toast.description }
|
|
297
297
|
}
|
|
298
298
|
);
|
|
299
|
-
}, [
|
|
299
|
+
}, [
|
|
300
|
+
toast.description,
|
|
301
|
+
descriptionId,
|
|
302
|
+
tv,
|
|
303
|
+
slotProps.descriptionClassName,
|
|
304
|
+
slotProps.descriptionStyle
|
|
305
|
+
]);
|
|
300
306
|
const actionsContent = useMemo(() => {
|
|
301
307
|
var _a;
|
|
302
308
|
if (!toast.action && !toast.cancel) return null;
|
|
@@ -101,7 +101,7 @@ const ToasterRoot = memo(
|
|
|
101
101
|
var _a;
|
|
102
102
|
if (toast.type === "loading") return;
|
|
103
103
|
const toastDuration = toast.duration ?? duration;
|
|
104
|
-
if (toastDuration <= 0) return;
|
|
104
|
+
if (toastDuration <= 0 || !Number.isFinite(toastDuration)) return;
|
|
105
105
|
const hasTimer = timersRef.current.has(toast.id);
|
|
106
106
|
if (hovering) {
|
|
107
107
|
if (hasTimer) {
|
package/package.json
CHANGED