fui-fancyui
Version:
FancyUI Libary
45 lines (44 loc) • 1.5 kB
JavaScript
"use client";
import { jsx as r } from "react/jsx-runtime";
import { useMemo as f } from "react";
import { useTransition as l, animated as g } from "@react-spring/web";
import d from "../../molecules/SingleToastMessage/SingleToastMessage.js";
import { ToastsWrapper as h } from "./FancyToastMessage.style.js";
function B(s) {
const { toastMessages: i, closeToast: a, externalStyle: m, ...p } = s, n = f(() => /* @__PURE__ */ new WeakMap(), []), c = l(i, {
from: { opacity: 0, height: "0px", transform: "translateX(200%)", marginBottom: "0px" },
keys: (t) => t.id,
enter: (t) => async (e) => {
const o = n.get(t);
await e({
opacity: 1,
transform: "translateX(0%)",
marginBottom: "16px",
height: o.offsetHeight + "px"
//config: { duration: refMap.get(item).time },
});
},
leave: [
{
transform: "translateX(60%)",
opacity: 0,
config: { duration: 220, tension: 250, friction: 125, precision: 0.1 }
},
{ height: "0px", marginBottom: "0px", config: { duration: 265, tension: 250, friction: 125, precision: 0.8 } }
],
onDestroyed: (t) => a(t.id)
});
return /* @__PURE__ */ r(h, { $externalStyle: m, ...p, children: c(({ ...t }, e) => /* @__PURE__ */ r(g.aside, { role: "alert", style: t, children: /* @__PURE__ */ r(
d,
{
ref: (o) => {
o && n.set(e, o);
},
toast: e,
remove: a
}
) }, e.id)) });
}
export {
B as default
};