@hfunlabs/hypurr-connect 0.1.13 → 0.1.14
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.d.ts +3 -1
- package/dist/index.js +25 -12
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/HypurrConnectProvider.tsx +3 -1
- package/src/LoginModal.tsx +19 -8
package/dist/index.d.ts
CHANGED
|
@@ -196,8 +196,10 @@ declare function HypurrConnectProvider({ config, children, }: {
|
|
|
196
196
|
interface LoginModalProps {
|
|
197
197
|
onConnectWallet: () => void;
|
|
198
198
|
walletIcon?: ReactNode;
|
|
199
|
+
/** CSS color used as the modal/drawer background. Defaults to `rgba(20,20,20,0.95)`. */
|
|
200
|
+
backgroundColor?: string;
|
|
199
201
|
}
|
|
200
|
-
declare function LoginModal({ onConnectWallet, walletIcon }: LoginModalProps): react_jsx_runtime.JSX.Element;
|
|
202
|
+
declare function LoginModal({ onConnectWallet, walletIcon, backgroundColor, }: LoginModalProps): react_jsx_runtime.JSX.Element;
|
|
201
203
|
|
|
202
204
|
interface PrincipalColors {
|
|
203
205
|
accent: string;
|
package/dist/index.js
CHANGED
|
@@ -1052,7 +1052,9 @@ function HypurrConnectProvider({
|
|
|
1052
1052
|
sessionStorage.setItem(TELEGRAM_AUTH_STATE_KEY, state);
|
|
1053
1053
|
const configuredReturnTo = config.telegram?.returnTo;
|
|
1054
1054
|
const returnTo = typeof configuredReturnTo === "function" ? configuredReturnTo() : configuredReturnTo || currentReturnTo();
|
|
1055
|
-
const authUrl = new URL(
|
|
1055
|
+
const authUrl = new URL(
|
|
1056
|
+
config.telegram?.authHubUrl || DEFAULT_AUTH_HUB_URL
|
|
1057
|
+
);
|
|
1056
1058
|
authUrl.searchParams.set("return_to", returnTo);
|
|
1057
1059
|
authUrl.searchParams.set("state", state);
|
|
1058
1060
|
authUrl.searchParams.set("scope", normalizeScopes(config.telegram?.scope));
|
|
@@ -1434,6 +1436,7 @@ function TelegramColorIcon({ style }) {
|
|
|
1434
1436
|
// src/LoginModal.tsx
|
|
1435
1437
|
import { Fragment, jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
1436
1438
|
var MOBILE_BREAKPOINT = 640;
|
|
1439
|
+
var DEFAULT_BACKGROUND_COLOR = "rgba(20,20,20,0.95)";
|
|
1437
1440
|
var btnStyle = {
|
|
1438
1441
|
display: "flex",
|
|
1439
1442
|
height: 53,
|
|
@@ -1479,7 +1482,6 @@ var modalBoxStyle = {
|
|
|
1479
1482
|
overflow: "hidden",
|
|
1480
1483
|
borderRadius: 12,
|
|
1481
1484
|
border: "1px solid rgba(255,255,255,0.1)",
|
|
1482
|
-
background: "#282828",
|
|
1483
1485
|
padding: 24
|
|
1484
1486
|
};
|
|
1485
1487
|
var headingStyle = {
|
|
@@ -1521,7 +1523,11 @@ function HoverButton({
|
|
|
1521
1523
|
}
|
|
1522
1524
|
);
|
|
1523
1525
|
}
|
|
1524
|
-
function LoginModal({
|
|
1526
|
+
function LoginModal({
|
|
1527
|
+
onConnectWallet,
|
|
1528
|
+
walletIcon,
|
|
1529
|
+
backgroundColor = DEFAULT_BACKGROUND_COLOR
|
|
1530
|
+
}) {
|
|
1525
1531
|
const { loginTelegram, loginModalOpen, closeLoginModal } = useHypurrConnectInternal();
|
|
1526
1532
|
const handleTelegramAuth = useCallback2(() => {
|
|
1527
1533
|
closeLoginModal();
|
|
@@ -1561,7 +1567,15 @@ function LoginModal({ onConnectWallet, walletIcon }) {
|
|
|
1561
1567
|
}
|
|
1562
1568
|
)
|
|
1563
1569
|
] });
|
|
1564
|
-
return /* @__PURE__ */ jsx4(AnimatePresence, { children: loginModalOpen && (isMobile ? /* @__PURE__ */ jsx4(
|
|
1570
|
+
return /* @__PURE__ */ jsx4(AnimatePresence, { children: loginModalOpen && (isMobile ? /* @__PURE__ */ jsx4(
|
|
1571
|
+
MobileDrawer,
|
|
1572
|
+
{
|
|
1573
|
+
onClose: closeLoginModal,
|
|
1574
|
+
backgroundColor,
|
|
1575
|
+
children: modalContent
|
|
1576
|
+
},
|
|
1577
|
+
"drawer"
|
|
1578
|
+
) : /* @__PURE__ */ jsxs3(Fragment, { children: [
|
|
1565
1579
|
/* @__PURE__ */ jsx4(
|
|
1566
1580
|
motion.div,
|
|
1567
1581
|
{
|
|
@@ -1586,7 +1600,7 @@ function LoginModal({ onConnectWallet, walletIcon }) {
|
|
|
1586
1600
|
children: /* @__PURE__ */ jsxs3(
|
|
1587
1601
|
motion.div,
|
|
1588
1602
|
{
|
|
1589
|
-
style: modalBoxStyle,
|
|
1603
|
+
style: { ...modalBoxStyle, background: backgroundColor },
|
|
1590
1604
|
initial: { scale: 0.96, opacity: 0, y: 8 },
|
|
1591
1605
|
animate: { scale: 1, opacity: 1, y: 0 },
|
|
1592
1606
|
exit: { scale: 0.96, opacity: 0, y: 8 },
|
|
@@ -1618,7 +1632,6 @@ var drawerSheetStyle = {
|
|
|
1618
1632
|
borderLeft: "1px solid rgba(255,255,255,0.1)",
|
|
1619
1633
|
borderRight: "1px solid rgba(255,255,255,0.1)",
|
|
1620
1634
|
borderTop: "1px solid rgba(255,255,255,0.1)",
|
|
1621
|
-
background: "#282828",
|
|
1622
1635
|
padding: "12px 24px max(24px, env(safe-area-inset-bottom))"
|
|
1623
1636
|
};
|
|
1624
1637
|
var drawerBgStyle = {
|
|
@@ -1628,7 +1641,6 @@ var drawerBgStyle = {
|
|
|
1628
1641
|
top: 0,
|
|
1629
1642
|
bottom: "-100vh",
|
|
1630
1643
|
zIndex: -1,
|
|
1631
|
-
background: "#282828",
|
|
1632
1644
|
borderTopLeftRadius: 12,
|
|
1633
1645
|
borderTopRightRadius: 12
|
|
1634
1646
|
};
|
|
@@ -1646,7 +1658,8 @@ var grabHandleStyle = {
|
|
|
1646
1658
|
};
|
|
1647
1659
|
function MobileDrawer({
|
|
1648
1660
|
children,
|
|
1649
|
-
onClose
|
|
1661
|
+
onClose,
|
|
1662
|
+
backgroundColor
|
|
1650
1663
|
}) {
|
|
1651
1664
|
const controls = useAnimationControls();
|
|
1652
1665
|
const handleDragEnd = useCallback2(
|
|
@@ -1675,7 +1688,7 @@ function MobileDrawer({
|
|
|
1675
1688
|
/* @__PURE__ */ jsxs3(
|
|
1676
1689
|
motion.div,
|
|
1677
1690
|
{
|
|
1678
|
-
style: drawerSheetStyle,
|
|
1691
|
+
style: { ...drawerSheetStyle, background: backgroundColor },
|
|
1679
1692
|
initial: { y: "100%" },
|
|
1680
1693
|
animate: { y: 0 },
|
|
1681
1694
|
exit: { y: "100%" },
|
|
@@ -1685,7 +1698,7 @@ function MobileDrawer({
|
|
|
1685
1698
|
dragElastic: { top: 0, bottom: 0.4 },
|
|
1686
1699
|
onDragEnd: handleDragEnd,
|
|
1687
1700
|
children: [
|
|
1688
|
-
/* @__PURE__ */ jsx4("div", { style: drawerBgStyle }),
|
|
1701
|
+
/* @__PURE__ */ jsx4("div", { style: { ...drawerBgStyle, background: backgroundColor } }),
|
|
1689
1702
|
/* @__PURE__ */ jsx4("div", { style: grabHandleAreaStyle, children: /* @__PURE__ */ jsx4("div", { style: grabHandleStyle }) }),
|
|
1690
1703
|
/* @__PURE__ */ jsx4("p", { style: headingStyle, children: "Connect" }),
|
|
1691
1704
|
children
|
|
@@ -3556,7 +3569,7 @@ function IconBtn({
|
|
|
3556
3569
|
|
|
3557
3570
|
// src/WalletSelectorDropdown.tsx
|
|
3558
3571
|
import { Fragment as Fragment6, jsx as jsx9, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
3559
|
-
var
|
|
3572
|
+
var DEFAULT_BACKGROUND_COLOR2 = "rgba(20,20,20,0.95)";
|
|
3560
3573
|
var getWalletNameParts = (name) => (name ?? "").split("/").map((part) => part.trim()).filter(Boolean);
|
|
3561
3574
|
var buildWalletListEntries = (wallets) => {
|
|
3562
3575
|
const standalone = [];
|
|
@@ -3679,7 +3692,7 @@ function WalletSelectorDropdown({
|
|
|
3679
3692
|
onWalletRenamed,
|
|
3680
3693
|
accentColor,
|
|
3681
3694
|
principalColors,
|
|
3682
|
-
backgroundColor =
|
|
3695
|
+
backgroundColor = DEFAULT_BACKGROUND_COLOR2
|
|
3683
3696
|
}) {
|
|
3684
3697
|
const { user, wallets, selectedWalletId, selectWallet, logout, authMethod } = useHypurrConnectInternal();
|
|
3685
3698
|
const [profileOpen, setProfileOpen] = useState5(false);
|