@moneymq/react 0.3.0 → 0.3.2
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.
- package/dist/index.js +44 -8
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +44 -8
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -591,6 +591,34 @@ function CheckoutModal({
|
|
|
591
591
|
const { isSandboxMode, sandboxAccounts } = useSandbox();
|
|
592
592
|
const client = useMoneyMQ();
|
|
593
593
|
const lottieRef = (0, import_react4.useRef)(null);
|
|
594
|
+
const [shouldRender, setShouldRender] = (0, import_react4.useState)(false);
|
|
595
|
+
const [animationPhase, setAnimationPhase] = (0, import_react4.useState)("closed");
|
|
596
|
+
(0, import_react4.useEffect)(() => {
|
|
597
|
+
if (visible && !shouldRender) {
|
|
598
|
+
setShouldRender(true);
|
|
599
|
+
requestAnimationFrame(() => {
|
|
600
|
+
setAnimationPhase("backdrop");
|
|
601
|
+
setTimeout(() => {
|
|
602
|
+
setAnimationPhase("open");
|
|
603
|
+
}, 150);
|
|
604
|
+
});
|
|
605
|
+
} else if (!visible && shouldRender && animationPhase !== "closing") {
|
|
606
|
+
setAnimationPhase("closing");
|
|
607
|
+
setTimeout(() => {
|
|
608
|
+
setShouldRender(false);
|
|
609
|
+
setAnimationPhase("closed");
|
|
610
|
+
}, 300);
|
|
611
|
+
}
|
|
612
|
+
}, [visible, shouldRender, animationPhase]);
|
|
613
|
+
const handleAnimatedClose = (0, import_react4.useCallback)(() => {
|
|
614
|
+
if (animationPhase === "closing") return;
|
|
615
|
+
setAnimationPhase("closing");
|
|
616
|
+
setTimeout(() => {
|
|
617
|
+
setShouldRender(false);
|
|
618
|
+
setAnimationPhase("closed");
|
|
619
|
+
onClose();
|
|
620
|
+
}, 300);
|
|
621
|
+
}, [onClose, animationPhase]);
|
|
594
622
|
const copyToClipboard = (text, type) => {
|
|
595
623
|
navigator.clipboard.writeText(text);
|
|
596
624
|
if (type === "sender") {
|
|
@@ -784,7 +812,7 @@ function CheckoutModal({
|
|
|
784
812
|
}, 3e3);
|
|
785
813
|
return () => clearInterval(interval);
|
|
786
814
|
}, [canPay, visible]);
|
|
787
|
-
if (!
|
|
815
|
+
if (!shouldRender) return null;
|
|
788
816
|
const WalletIcon = () => /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.5", children: [
|
|
789
817
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M21 12V7a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2h14a2 2 0 002-2v-5z" }),
|
|
790
818
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M16 12h.01", strokeWidth: "2", strokeLinecap: "round" })
|
|
@@ -803,6 +831,9 @@ function CheckoutModal({
|
|
|
803
831
|
] }),
|
|
804
832
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("defs", { children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("clipPath", { id: "clip0_524_7", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("rect", { width: "471", height: "99", fill: "white" }) }) })
|
|
805
833
|
] });
|
|
834
|
+
const isBackdropVisible = animationPhase === "backdrop" || animationPhase === "open";
|
|
835
|
+
const isModalVisible = animationPhase === "open";
|
|
836
|
+
const isClosing = animationPhase === "closing";
|
|
806
837
|
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
|
|
807
838
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("style", { children: `
|
|
808
839
|
@keyframes spin {
|
|
@@ -817,10 +848,11 @@ function CheckoutModal({
|
|
|
817
848
|
position: "fixed",
|
|
818
849
|
inset: 0,
|
|
819
850
|
zIndex: 9998,
|
|
820
|
-
backgroundColor: "rgba(0, 0, 0, 0.6)",
|
|
821
|
-
backdropFilter: "blur(8px)"
|
|
851
|
+
backgroundColor: isBackdropVisible && !isClosing ? "rgba(0, 0, 0, 0.6)" : "rgba(0, 0, 0, 0)",
|
|
852
|
+
backdropFilter: isBackdropVisible && !isClosing ? "blur(8px)" : "blur(0px)",
|
|
853
|
+
transition: "background-color 250ms cubic-bezier(0.4, 0, 0.2, 1), backdrop-filter 250ms cubic-bezier(0.4, 0, 0.2, 1)"
|
|
822
854
|
},
|
|
823
|
-
onClick:
|
|
855
|
+
onClick: handleAnimatedClose
|
|
824
856
|
}
|
|
825
857
|
),
|
|
826
858
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
@@ -833,9 +865,10 @@ function CheckoutModal({
|
|
|
833
865
|
display: "flex",
|
|
834
866
|
alignItems: "center",
|
|
835
867
|
justifyContent: "center",
|
|
836
|
-
padding: "1rem"
|
|
868
|
+
padding: "1rem",
|
|
869
|
+
pointerEvents: isClosing ? "none" : "auto"
|
|
837
870
|
},
|
|
838
|
-
onClick:
|
|
871
|
+
onClick: handleAnimatedClose,
|
|
839
872
|
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
840
873
|
"div",
|
|
841
874
|
{
|
|
@@ -845,7 +878,10 @@ function CheckoutModal({
|
|
|
845
878
|
backgroundColor: "#2c2c2e",
|
|
846
879
|
borderRadius: "1rem",
|
|
847
880
|
overflow: "hidden",
|
|
848
|
-
boxShadow: "0 25px 50px -12px rgba(0, 0, 0, 0.5)"
|
|
881
|
+
boxShadow: "0 25px 50px -12px rgba(0, 0, 0, 0.5)",
|
|
882
|
+
opacity: isModalVisible && !isClosing ? 1 : 0,
|
|
883
|
+
transform: isModalVisible && !isClosing ? "translateY(0) scale(1)" : "translateY(-20px) scale(0.98)",
|
|
884
|
+
transition: "opacity 200ms cubic-bezier(0.4, 0, 0.2, 1), transform 250ms cubic-bezier(0.4, 0, 0.2, 1)"
|
|
849
885
|
},
|
|
850
886
|
onClick: (e) => e.stopPropagation(),
|
|
851
887
|
children: [
|
|
@@ -897,7 +933,7 @@ function CheckoutModal({
|
|
|
897
933
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
898
934
|
"button",
|
|
899
935
|
{
|
|
900
|
-
onClick:
|
|
936
|
+
onClick: handleAnimatedClose,
|
|
901
937
|
style: {
|
|
902
938
|
padding: "0.375rem 0.75rem",
|
|
903
939
|
fontSize: "0.8125rem",
|