@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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hfunlabs/hypurr-connect",
3
- "version": "0.1.13",
3
+ "version": "0.1.14",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",
@@ -1155,7 +1155,9 @@ export function HypurrConnectProvider({
1155
1155
  ? configuredReturnTo()
1156
1156
  : configuredReturnTo || currentReturnTo();
1157
1157
 
1158
- const authUrl = new URL(config.telegram?.authHubUrl || DEFAULT_AUTH_HUB_URL);
1158
+ const authUrl = new URL(
1159
+ config.telegram?.authHubUrl || DEFAULT_AUTH_HUB_URL,
1160
+ );
1159
1161
  authUrl.searchParams.set("return_to", returnTo);
1160
1162
  authUrl.searchParams.set("state", state);
1161
1163
  authUrl.searchParams.set("scope", normalizeScopes(config.telegram?.scope));
@@ -17,10 +17,14 @@ import { TelegramColorIcon } from "./icons/TelegramColorIcon";
17
17
  export interface LoginModalProps {
18
18
  onConnectWallet: () => void;
19
19
  walletIcon?: ReactNode;
20
+ /** CSS color used as the modal/drawer background. Defaults to `rgba(20,20,20,0.95)`. */
21
+ backgroundColor?: string;
20
22
  }
21
23
 
22
24
  const MOBILE_BREAKPOINT = 640;
23
25
 
26
+ const DEFAULT_BACKGROUND_COLOR = "rgba(20,20,20,0.95)";
27
+
24
28
  const btnStyle: CSSProperties = {
25
29
  display: "flex",
26
30
  height: 53,
@@ -70,7 +74,6 @@ const modalBoxStyle: CSSProperties = {
70
74
  overflow: "hidden",
71
75
  borderRadius: 12,
72
76
  border: "1px solid rgba(255,255,255,0.1)",
73
- background: "#282828",
74
77
  padding: 24,
75
78
  };
76
79
 
@@ -127,7 +130,11 @@ function HoverButton({
127
130
  );
128
131
  }
129
132
 
130
- export function LoginModal({ onConnectWallet, walletIcon }: LoginModalProps) {
133
+ export function LoginModal({
134
+ onConnectWallet,
135
+ walletIcon,
136
+ backgroundColor = DEFAULT_BACKGROUND_COLOR,
137
+ }: LoginModalProps) {
131
138
  const { loginTelegram, loginModalOpen, closeLoginModal } =
132
139
  useHypurrConnectInternal();
133
140
 
@@ -174,7 +181,11 @@ export function LoginModal({ onConnectWallet, walletIcon }: LoginModalProps) {
174
181
  <AnimatePresence>
175
182
  {loginModalOpen &&
176
183
  (isMobile ? (
177
- <MobileDrawer key="drawer" onClose={closeLoginModal}>
184
+ <MobileDrawer
185
+ key="drawer"
186
+ onClose={closeLoginModal}
187
+ backgroundColor={backgroundColor}
188
+ >
178
189
  {modalContent}
179
190
  </MobileDrawer>
180
191
  ) : (
@@ -198,7 +209,7 @@ export function LoginModal({ onConnectWallet, walletIcon }: LoginModalProps) {
198
209
  onClick={closeLoginModal}
199
210
  >
200
211
  <motion.div
201
- style={modalBoxStyle}
212
+ style={{ ...modalBoxStyle, background: backgroundColor }}
202
213
  initial={{ scale: 0.96, opacity: 0, y: 8 }}
203
214
  animate={{ scale: 1, opacity: 1, y: 0 }}
204
215
  exit={{ scale: 0.96, opacity: 0, y: 8 }}
@@ -230,7 +241,6 @@ const drawerSheetStyle: CSSProperties = {
230
241
  borderLeft: "1px solid rgba(255,255,255,0.1)",
231
242
  borderRight: "1px solid rgba(255,255,255,0.1)",
232
243
  borderTop: "1px solid rgba(255,255,255,0.1)",
233
- background: "#282828",
234
244
  padding: "12px 24px max(24px, env(safe-area-inset-bottom))",
235
245
  };
236
246
 
@@ -241,7 +251,6 @@ const drawerBgStyle: CSSProperties = {
241
251
  top: 0,
242
252
  bottom: "-100vh",
243
253
  zIndex: -1,
244
- background: "#282828",
245
254
  borderTopLeftRadius: 12,
246
255
  borderTopRightRadius: 12,
247
256
  };
@@ -263,9 +272,11 @@ const grabHandleStyle: CSSProperties = {
263
272
  function MobileDrawer({
264
273
  children,
265
274
  onClose,
275
+ backgroundColor,
266
276
  }: {
267
277
  children: ReactNode;
268
278
  onClose: () => void;
279
+ backgroundColor: string;
269
280
  }) {
270
281
  const controls = useAnimationControls();
271
282
 
@@ -294,7 +305,7 @@ function MobileDrawer({
294
305
 
295
306
  <motion.div
296
307
  key="drawer-sheet"
297
- style={drawerSheetStyle}
308
+ style={{ ...drawerSheetStyle, background: backgroundColor }}
298
309
  initial={{ y: "100%" }}
299
310
  animate={{ y: 0 }}
300
311
  exit={{ y: "100%" }}
@@ -304,7 +315,7 @@ function MobileDrawer({
304
315
  dragElastic={{ top: 0, bottom: 0.4 }}
305
316
  onDragEnd={handleDragEnd}
306
317
  >
307
- <div style={drawerBgStyle} />
318
+ <div style={{ ...drawerBgStyle, background: backgroundColor }} />
308
319
 
309
320
  <div style={grabHandleAreaStyle}>
310
321
  <div style={grabHandleStyle} />