@insforge/react 0.6.10 → 0.7.0
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/components.cjs +23 -8
- package/dist/components.cjs.map +1 -1
- package/dist/components.d.cts +26 -1
- package/dist/components.d.ts +26 -1
- package/dist/components.js +23 -9
- package/dist/components.js.map +1 -1
- package/dist/index.cjs +23 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +23 -9
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/components.cjs
CHANGED
|
@@ -2527,6 +2527,25 @@ function VerifyEmail({ token, onSuccess, onError, ...uiProps }) {
|
|
|
2527
2527
|
}, [token, verifyEmail, onSuccess, onError]);
|
|
2528
2528
|
return /* @__PURE__ */ jsxRuntime.jsx(VerifyEmailStatus, { status, error, ...uiProps });
|
|
2529
2529
|
}
|
|
2530
|
+
function SignOutButton({ children, className, afterSignOutUrl = "/" }) {
|
|
2531
|
+
const { signOut } = useInsforge();
|
|
2532
|
+
const handleClick = async () => {
|
|
2533
|
+
await signOut();
|
|
2534
|
+
window.location.href = afterSignOutUrl;
|
|
2535
|
+
};
|
|
2536
|
+
if (children && react.isValidElement(children)) {
|
|
2537
|
+
const originalOnClick = children.props?.onClick;
|
|
2538
|
+
return react.cloneElement(children, {
|
|
2539
|
+
onClick: async (e) => {
|
|
2540
|
+
await handleClick();
|
|
2541
|
+
if (originalOnClick) {
|
|
2542
|
+
originalOnClick(e);
|
|
2543
|
+
}
|
|
2544
|
+
}
|
|
2545
|
+
});
|
|
2546
|
+
}
|
|
2547
|
+
return /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className, onClick: () => void handleClick(), children: children || "Sign out" });
|
|
2548
|
+
}
|
|
2530
2549
|
var UserButtonContainer = styled__default.default.div`
|
|
2531
2550
|
position: relative;
|
|
2532
2551
|
display: inline-block;
|
|
@@ -2642,7 +2661,7 @@ var UserButtonMenuItemIcon = styled__default.default.div`
|
|
|
2642
2661
|
}
|
|
2643
2662
|
`;
|
|
2644
2663
|
function UserButton({ afterSignOutUrl = "/", mode = "detailed" }) {
|
|
2645
|
-
const { user
|
|
2664
|
+
const { user } = useInsforge();
|
|
2646
2665
|
const [isOpen, setIsOpen] = react.useState(false);
|
|
2647
2666
|
const [imageError, setImageError] = react.useState(false);
|
|
2648
2667
|
const dropdownRef = react.useRef(null);
|
|
@@ -2683,11 +2702,6 @@ function UserButton({ afterSignOutUrl = "/", mode = "detailed" }) {
|
|
|
2683
2702
|
document.removeEventListener("mousedown", handleClickOutside);
|
|
2684
2703
|
};
|
|
2685
2704
|
}, [isOpen]);
|
|
2686
|
-
async function handleSignOut() {
|
|
2687
|
-
await signOut();
|
|
2688
|
-
setIsOpen(false);
|
|
2689
|
-
window.location.href = afterSignOutUrl;
|
|
2690
|
-
}
|
|
2691
2705
|
if (!user) {
|
|
2692
2706
|
return null;
|
|
2693
2707
|
}
|
|
@@ -2716,10 +2730,10 @@ function UserButton({ afterSignOutUrl = "/", mode = "detailed" }) {
|
|
|
2716
2730
|
]
|
|
2717
2731
|
}
|
|
2718
2732
|
),
|
|
2719
|
-
isOpen && /* @__PURE__ */ jsxRuntime.jsx(UserButtonMenu, { children: /* @__PURE__ */ jsxRuntime.jsxs(UserButtonMenuItem, { $signout: true, onClick: () =>
|
|
2733
|
+
isOpen && /* @__PURE__ */ jsxRuntime.jsx(UserButtonMenu, { children: /* @__PURE__ */ jsxRuntime.jsx(SignOutButton, { afterSignOutUrl, children: /* @__PURE__ */ jsxRuntime.jsxs(UserButtonMenuItem, { $signout: true, onClick: () => setIsOpen(false), children: [
|
|
2720
2734
|
/* @__PURE__ */ jsxRuntime.jsx(UserButtonMenuItemIcon, { children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.LogOut, {}) }),
|
|
2721
2735
|
"Sign out"
|
|
2722
|
-
] }) })
|
|
2736
|
+
] }) }) })
|
|
2723
2737
|
] });
|
|
2724
2738
|
}
|
|
2725
2739
|
function Protect({
|
|
@@ -2839,6 +2853,7 @@ exports.ResetPasswordForm = ResetPasswordForm;
|
|
|
2839
2853
|
exports.SignIn = SignIn;
|
|
2840
2854
|
exports.SignInButton = SignInButton;
|
|
2841
2855
|
exports.SignInForm = SignInForm;
|
|
2856
|
+
exports.SignOutButton = SignOutButton;
|
|
2842
2857
|
exports.SignUp = SignUp;
|
|
2843
2858
|
exports.SignUpButton = SignUpButton;
|
|
2844
2859
|
exports.SignUpForm = SignUpForm;
|