@renown/sdk 5.1.0-dev.9 → 5.1.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/README.md +1 -487
- package/dist/src/common.d.ts +1 -1
- package/dist/src/common.d.ts.map +1 -1
- package/dist/src/components/RenownLoginAvatar.d.ts +44 -0
- package/dist/src/components/RenownLoginAvatar.d.ts.map +1 -0
- package/dist/src/components/RenownLoginAvatar.js +50 -0
- package/dist/src/components/RenownLoginAvatar.js.map +1 -0
- package/dist/src/components/index.d.ts +3 -7
- package/dist/src/components/index.d.ts.map +1 -1
- package/dist/src/components/index.js +1 -4
- package/dist/src/components/index.js.map +1 -1
- package/dist/src/components/types.d.ts +12 -0
- package/dist/src/components/types.d.ts.map +1 -0
- package/dist/src/components/types.js +2 -0
- package/dist/src/components/types.js.map +1 -0
- package/dist/src/constants.d.ts +1 -1
- package/dist/src/constants.d.ts.map +1 -1
- package/dist/src/constants.js +1 -1
- package/dist/src/constants.js.map +1 -1
- package/dist/src/index.d.ts +1 -8
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +1 -8
- package/dist/src/index.js.map +1 -1
- package/dist/src/types.d.ts +2 -3
- package/dist/src/types.d.ts.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +6 -26
- package/dist/e2e/fixtures/main.d.ts +0 -2
- package/dist/e2e/fixtures/main.d.ts.map +0 -1
- package/dist/e2e/fixtures/main.js +0 -97
- package/dist/e2e/fixtures/main.js.map +0 -1
- package/dist/e2e/fixtures/vite.config.d.ts +0 -3
- package/dist/e2e/fixtures/vite.config.d.ts.map +0 -1
- package/dist/e2e/fixtures/vite.config.js +0 -10
- package/dist/e2e/fixtures/vite.config.js.map +0 -1
- package/dist/e2e/renown-components.spec.d.ts +0 -2
- package/dist/e2e/renown-components.spec.d.ts.map +0 -1
- package/dist/e2e/renown-components.spec.js +0 -155
- package/dist/e2e/renown-components.spec.js.map +0 -1
- package/dist/playwright.config.d.ts +0 -3
- package/dist/playwright.config.d.ts.map +0 -1
- package/dist/playwright.config.js +0 -25
- package/dist/playwright.config.js.map +0 -1
- package/dist/src/assets/assets.d.ts +0 -19
- package/dist/src/assets/renown-hover.svg +0 -17
- package/dist/src/assets/renown-light.svg +0 -15
- package/dist/src/assets/renown-short-hover.png +0 -0
- package/dist/src/assets/renown-short.png +0 -0
- package/dist/src/assets/renown.svg +0 -16
- package/dist/src/components/RenownAuthButton.d.ts +0 -62
- package/dist/src/components/RenownAuthButton.d.ts.map +0 -1
- package/dist/src/components/RenownAuthButton.js +0 -82
- package/dist/src/components/RenownAuthButton.js.map +0 -1
- package/dist/src/components/RenownLoginButton.d.ts +0 -48
- package/dist/src/components/RenownLoginButton.d.ts.map +0 -1
- package/dist/src/components/RenownLoginButton.js +0 -175
- package/dist/src/components/RenownLoginButton.js.map +0 -1
- package/dist/src/components/RenownUserButton.d.ts +0 -66
- package/dist/src/components/RenownUserButton.d.ts.map +0 -1
- package/dist/src/components/RenownUserButton.js +0 -216
- package/dist/src/components/RenownUserButton.js.map +0 -1
- package/dist/src/components/icons.d.ts +0 -25
- package/dist/src/components/icons.d.ts.map +0 -1
- package/dist/src/components/icons.js +0 -24
- package/dist/src/components/icons.js.map +0 -1
- package/dist/src/components/image-data.d.ts +0 -3
- package/dist/src/components/image-data.d.ts.map +0 -1
- package/dist/src/components/image-data.js +0 -4
- package/dist/src/components/image-data.js.map +0 -1
- package/dist/src/hooks/index.d.ts +0 -2
- package/dist/src/hooks/index.d.ts.map +0 -1
- package/dist/src/hooks/index.js +0 -2
- package/dist/src/hooks/index.js.map +0 -1
- package/dist/src/hooks/use-user.d.ts +0 -21
- package/dist/src/hooks/use-user.d.ts.map +0 -1
- package/dist/src/hooks/use-user.js +0 -30
- package/dist/src/hooks/use-user.js.map +0 -1
- package/dist/src/lib/crypto/browser.d.ts +0 -8
- package/dist/src/lib/crypto/browser.d.ts.map +0 -1
- package/dist/src/lib/crypto/browser.js +0 -73
- package/dist/src/lib/crypto/browser.js.map +0 -1
- package/dist/src/lib/crypto/index.d.ts +0 -36
- package/dist/src/lib/crypto/index.d.ts.map +0 -1
- package/dist/src/lib/crypto/index.js +0 -150
- package/dist/src/lib/crypto/index.js.map +0 -1
- package/dist/src/lib/crypto/node.d.ts +0 -8
- package/dist/src/lib/crypto/node.d.ts.map +0 -1
- package/dist/src/lib/crypto/node.js +0 -67
- package/dist/src/lib/crypto/node.js.map +0 -1
- package/dist/src/lib/renown/constants.d.ts +0 -130
- package/dist/src/lib/renown/constants.d.ts.map +0 -1
- package/dist/src/lib/renown/constants.js +0 -40
- package/dist/src/lib/renown/constants.js.map +0 -1
- package/dist/src/lib/renown/did-parser.d.ts +0 -28
- package/dist/src/lib/renown/did-parser.d.ts.map +0 -1
- package/dist/src/lib/renown/did-parser.js +0 -57
- package/dist/src/lib/renown/did-parser.js.map +0 -1
- package/dist/src/lib/renown/index.d.ts +0 -4
- package/dist/src/lib/renown/index.d.ts.map +0 -1
- package/dist/src/lib/renown/index.js +0 -4
- package/dist/src/lib/renown/index.js.map +0 -1
- package/dist/src/lib/renown/utils.d.ts +0 -33
- package/dist/src/lib/renown/utils.d.ts.map +0 -1
- package/dist/src/lib/renown/utils.js +0 -207
- package/dist/src/lib/renown/utils.js.map +0 -1
- package/dist/src/lib/session-storage.d.ts +0 -40
- package/dist/src/lib/session-storage.d.ts.map +0 -1
- package/dist/src/lib/session-storage.js +0 -107
- package/dist/src/lib/session-storage.js.map +0 -1
- package/dist/src/providers/index.d.ts +0 -3
- package/dist/src/providers/index.d.ts.map +0 -1
- package/dist/src/providers/index.js +0 -2
- package/dist/src/providers/index.js.map +0 -1
- package/dist/src/providers/renown-user-provider.d.ts +0 -72
- package/dist/src/providers/renown-user-provider.d.ts.map +0 -1
- package/dist/src/providers/renown-user-provider.js +0 -171
- package/dist/src/providers/renown-user-provider.js.map +0 -1
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import React from "react";
|
|
4
|
-
import { useUser } from "../hooks/use-user.js";
|
|
5
|
-
import { openRenown as openRenownUtil } from "../lib/renown/utils.js";
|
|
6
|
-
import { RenownLoginButton } from "./RenownLoginButton.js";
|
|
7
|
-
import { RenownUserButton } from "./RenownUserButton.js";
|
|
8
|
-
/**
|
|
9
|
-
* Smart authentication button that adapts based on auth state.
|
|
10
|
-
* Shows RenownLoginButton when not authenticated, and RenownUserButton when authenticated.
|
|
11
|
-
*
|
|
12
|
-
* @example
|
|
13
|
-
* Basic usage:
|
|
14
|
-
* ```tsx
|
|
15
|
-
* import { RenownAuthButton } from '@renown/sdk'
|
|
16
|
-
*
|
|
17
|
-
* function Header() {
|
|
18
|
-
* return <RenownAuthButton />
|
|
19
|
-
* }
|
|
20
|
-
* ```
|
|
21
|
-
*
|
|
22
|
-
* @example
|
|
23
|
-
* Custom rendering:
|
|
24
|
-
* ```tsx
|
|
25
|
-
* <RenownAuthButton
|
|
26
|
-
* renderAuthenticated={({ user, logout }) => (
|
|
27
|
-
* <div>
|
|
28
|
-
* <span>{user.name}</span>
|
|
29
|
-
* <button onClick={logout}>Sign out</button>
|
|
30
|
-
* </div>
|
|
31
|
-
* )}
|
|
32
|
-
* renderUnauthenticated={({ openRenown }) => (
|
|
33
|
-
* <button onClick={openRenown}>Sign In</button>
|
|
34
|
-
* )}
|
|
35
|
-
* />
|
|
36
|
-
* ```
|
|
37
|
-
*/
|
|
38
|
-
export function RenownAuthButton({ className = "", renderAuthenticated, renderUnauthenticated, renderLoading, }) {
|
|
39
|
-
const { user, loginStatus, isLoading, openRenown, logout } = useUser();
|
|
40
|
-
const openProfile = () => {
|
|
41
|
-
if (!user)
|
|
42
|
-
return;
|
|
43
|
-
openRenownUtil(user.documentId);
|
|
44
|
-
};
|
|
45
|
-
// Loading state
|
|
46
|
-
if (isLoading && loginStatus === "initial") {
|
|
47
|
-
if (renderLoading) {
|
|
48
|
-
return _jsx("div", { className: className, children: renderLoading() });
|
|
49
|
-
}
|
|
50
|
-
return (_jsxs("div", { className: className, children: [_jsx("div", { style: {
|
|
51
|
-
width: "40px",
|
|
52
|
-
height: "40px",
|
|
53
|
-
borderRadius: "50%",
|
|
54
|
-
backgroundColor: "#e5e7eb",
|
|
55
|
-
animation: "pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite",
|
|
56
|
-
} }), _jsx("style", { children: `@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }` })] }));
|
|
57
|
-
}
|
|
58
|
-
// Authenticated state
|
|
59
|
-
if (loginStatus === "authorized" && user) {
|
|
60
|
-
if (renderAuthenticated) {
|
|
61
|
-
return (_jsx("div", { className: className, children: renderAuthenticated({ user, logout, openProfile }) }));
|
|
62
|
-
}
|
|
63
|
-
const address = (user.ethAddress || user.address);
|
|
64
|
-
if (!address) {
|
|
65
|
-
// Fallback if no address available
|
|
66
|
-
return (_jsx("div", { className: className, children: _jsxs("button", { onClick: logout, style: {
|
|
67
|
-
fontSize: "14px",
|
|
68
|
-
color: "#4b5563",
|
|
69
|
-
background: "none",
|
|
70
|
-
border: "none",
|
|
71
|
-
cursor: "pointer",
|
|
72
|
-
}, children: [user.name || "Connected", " (Logout)"] }) }));
|
|
73
|
-
}
|
|
74
|
-
return (_jsx("div", { className: className, children: _jsx(RenownUserButton, { address: address, username: user.name, userId: user.documentId, avatarUrl: user.avatar, onDisconnect: logout }) }));
|
|
75
|
-
}
|
|
76
|
-
// Unauthenticated state
|
|
77
|
-
if (renderUnauthenticated) {
|
|
78
|
-
return (_jsx("div", { className: className, children: renderUnauthenticated({ openRenown, isLoading }) }));
|
|
79
|
-
}
|
|
80
|
-
return (_jsx("div", { className: className, children: _jsx(RenownLoginButton, { onLogin: openRenown }) }));
|
|
81
|
-
}
|
|
82
|
-
//# sourceMappingURL=RenownAuthButton.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"RenownAu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oginButtonProps {
|
|
3
|
-
/**
|
|
4
|
-
* Callback when login is requested
|
|
5
|
-
*/
|
|
6
|
-
onLogin: (() => void) | undefined;
|
|
7
|
-
/**
|
|
8
|
-
* Enable dark mode styling
|
|
9
|
-
*/
|
|
10
|
-
darkMode?: boolean;
|
|
11
|
-
/**
|
|
12
|
-
* Custom styles for the button
|
|
13
|
-
*/
|
|
14
|
-
style?: CSSProperties;
|
|
15
|
-
/**
|
|
16
|
-
* Custom class name
|
|
17
|
-
*/
|
|
18
|
-
className?: string;
|
|
19
|
-
/**
|
|
20
|
-
* Custom render function for the trigger button
|
|
21
|
-
*/
|
|
22
|
-
renderTrigger?: (props: {
|
|
23
|
-
onMouseEnter: () => void;
|
|
24
|
-
onMouseLeave: () => void;
|
|
25
|
-
isLoading: boolean;
|
|
26
|
-
}) => ReactNode;
|
|
27
|
-
/**
|
|
28
|
-
* Show a popover with connect option instead of triggering login directly
|
|
29
|
-
*/
|
|
30
|
-
showPopover?: boolean;
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* A login button with Renown branding that shows a popover with connect option.
|
|
34
|
-
*
|
|
35
|
-
* @example
|
|
36
|
-
* ```tsx
|
|
37
|
-
* import { RenownLoginButton } from '@renown/sdk'
|
|
38
|
-
*
|
|
39
|
-
* function LoginArea() {
|
|
40
|
-
* const handleLogin = () => {
|
|
41
|
-
* // Your login logic
|
|
42
|
-
* }
|
|
43
|
-
* return <RenownLoginButton onLogin={handleLogin} />
|
|
44
|
-
* }
|
|
45
|
-
* ```
|
|
46
|
-
*/
|
|
47
|
-
export declare function RenownLoginButton({ onLogin, darkMode, style, className, renderTrigger, showPopover, }: RenownLoginButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
48
|
-
//# sourceMappingURL=RenownLoginButton.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"RenownLoginButton.d.ts","sourceRoot":"","sources":["../../../src/components/RenownLoginButton.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAKtD,MAAM,WAAW,sBAAsB;IACrC;;OAEG;IACH,OAAO,EAAE,CAAC,MAAM,IAAI,CAAC,GAAG,SAAS,CAAC;IAClC;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;OAEG;IACH,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE;QACtB,YAAY,EAAE,MAAM,IAAI,CAAC;QACzB,YAAY,EAAE,MAAM,IAAI,CAAC;QACzB,SAAS,EAAE,OAAO,CAAC;KACpB,KAAK,SAAS,CAAC;IAChB;;OAEG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AA+ED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,iBAAiB,CAAC,EAChC,OAAO,EACP,QAAgB,EAChB,KAAK,EACL,SAAS,EACT,aAAa,EACb,WAAmB,GACpB,EAAE,sBAAsB,2CA2IxB"}
|
|
@@ -1,175 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { useCallback, useEffect, useRef, useState } from "react";
|
|
4
|
-
import { RenownLogo, SpinnerIcon } from "./icons.js";
|
|
5
|
-
import { renownShortDataUrl, renownShortHoverDataUrl } from "./image-data.js";
|
|
6
|
-
const POPOVER_GAP = 8;
|
|
7
|
-
const POPOVER_HEIGHT = 120; // approximate height of popover
|
|
8
|
-
const styles = {
|
|
9
|
-
trigger: {
|
|
10
|
-
display: "flex",
|
|
11
|
-
alignItems: "center",
|
|
12
|
-
justifyContent: "center",
|
|
13
|
-
padding: 0,
|
|
14
|
-
border: "none",
|
|
15
|
-
background: "transparent",
|
|
16
|
-
cursor: "pointer",
|
|
17
|
-
},
|
|
18
|
-
popoverBase: {
|
|
19
|
-
position: "absolute",
|
|
20
|
-
left: 0,
|
|
21
|
-
borderRadius: "8px",
|
|
22
|
-
width: "208px",
|
|
23
|
-
zIndex: 1000,
|
|
24
|
-
},
|
|
25
|
-
popoverLight: {
|
|
26
|
-
backgroundColor: "white",
|
|
27
|
-
boxShadow: "0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)",
|
|
28
|
-
},
|
|
29
|
-
popoverDark: {
|
|
30
|
-
backgroundColor: "#1f2937",
|
|
31
|
-
boxShadow: "0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.2)",
|
|
32
|
-
},
|
|
33
|
-
popoverContent: {
|
|
34
|
-
padding: "16px",
|
|
35
|
-
},
|
|
36
|
-
logoContainer: {
|
|
37
|
-
display: "flex",
|
|
38
|
-
justifyContent: "center",
|
|
39
|
-
height: "22px",
|
|
40
|
-
width: "83px",
|
|
41
|
-
margin: "0 auto 16px",
|
|
42
|
-
overflow: "hidden",
|
|
43
|
-
},
|
|
44
|
-
connectButtonBase: {
|
|
45
|
-
display: "flex",
|
|
46
|
-
alignItems: "center",
|
|
47
|
-
justifyContent: "center",
|
|
48
|
-
width: "100%",
|
|
49
|
-
height: "28px",
|
|
50
|
-
borderRadius: "8px",
|
|
51
|
-
backgroundColor: "transparent",
|
|
52
|
-
fontSize: "14px",
|
|
53
|
-
cursor: "pointer",
|
|
54
|
-
marginTop: "16px",
|
|
55
|
-
},
|
|
56
|
-
connectButtonLight: {
|
|
57
|
-
border: "1px solid #d1d5db",
|
|
58
|
-
color: "#111827",
|
|
59
|
-
},
|
|
60
|
-
connectButtonDark: {
|
|
61
|
-
border: "1px solid #4b5563",
|
|
62
|
-
color: "#f9fafb",
|
|
63
|
-
},
|
|
64
|
-
connectButtonActive: {
|
|
65
|
-
opacity: 0.7,
|
|
66
|
-
},
|
|
67
|
-
wrapper: {
|
|
68
|
-
position: "relative",
|
|
69
|
-
display: "inline-block",
|
|
70
|
-
},
|
|
71
|
-
triggerImageLight: {
|
|
72
|
-
display: "block",
|
|
73
|
-
},
|
|
74
|
-
triggerImageDark: {
|
|
75
|
-
display: "block",
|
|
76
|
-
filter: "invert(1)",
|
|
77
|
-
},
|
|
78
|
-
};
|
|
79
|
-
/**
|
|
80
|
-
* A login button with Renown branding that shows a popover with connect option.
|
|
81
|
-
*
|
|
82
|
-
* @example
|
|
83
|
-
* ```tsx
|
|
84
|
-
* import { RenownLoginButton } from '@renown/sdk'
|
|
85
|
-
*
|
|
86
|
-
* function LoginArea() {
|
|
87
|
-
* const handleLogin = () => {
|
|
88
|
-
* // Your login logic
|
|
89
|
-
* }
|
|
90
|
-
* return <RenownLoginButton onLogin={handleLogin} />
|
|
91
|
-
* }
|
|
92
|
-
* ```
|
|
93
|
-
*/
|
|
94
|
-
export function RenownLoginButton({ onLogin, darkMode = false, style, className, renderTrigger, showPopover = false, }) {
|
|
95
|
-
const [isOpen, setIsOpen] = useState(false);
|
|
96
|
-
const [isLoading, setIsLoading] = useState(false);
|
|
97
|
-
const [isHovered, setIsHovered] = useState(false);
|
|
98
|
-
const [showAbove, setShowAbove] = useState(true);
|
|
99
|
-
const popoverRef = useRef(null);
|
|
100
|
-
const wrapperRef = useRef(null);
|
|
101
|
-
const closeTimeoutRef = useRef(null);
|
|
102
|
-
const calculatePosition = useCallback(() => {
|
|
103
|
-
if (!wrapperRef.current)
|
|
104
|
-
return;
|
|
105
|
-
const rect = wrapperRef.current.getBoundingClientRect();
|
|
106
|
-
const spaceAbove = rect.top;
|
|
107
|
-
const hasSpaceAbove = spaceAbove >= POPOVER_HEIGHT + POPOVER_GAP;
|
|
108
|
-
setShowAbove(hasSpaceAbove);
|
|
109
|
-
}, []);
|
|
110
|
-
const handleMouseEnter = useCallback(() => {
|
|
111
|
-
setIsHovered(true);
|
|
112
|
-
if (!showPopover) {
|
|
113
|
-
return;
|
|
114
|
-
}
|
|
115
|
-
if (closeTimeoutRef.current) {
|
|
116
|
-
clearTimeout(closeTimeoutRef.current);
|
|
117
|
-
closeTimeoutRef.current = null;
|
|
118
|
-
}
|
|
119
|
-
calculatePosition();
|
|
120
|
-
setIsOpen(true);
|
|
121
|
-
}, [calculatePosition, showPopover]);
|
|
122
|
-
const handleMouseLeave = useCallback(() => {
|
|
123
|
-
closeTimeoutRef.current = setTimeout(() => {
|
|
124
|
-
setIsOpen(false);
|
|
125
|
-
setIsHovered(false);
|
|
126
|
-
}, 150);
|
|
127
|
-
}, []);
|
|
128
|
-
useEffect(() => {
|
|
129
|
-
return () => {
|
|
130
|
-
if (closeTimeoutRef.current) {
|
|
131
|
-
clearTimeout(closeTimeoutRef.current);
|
|
132
|
-
}
|
|
133
|
-
};
|
|
134
|
-
}, []);
|
|
135
|
-
const handleConnect = () => {
|
|
136
|
-
if (onLogin) {
|
|
137
|
-
setIsLoading(true);
|
|
138
|
-
onLogin();
|
|
139
|
-
}
|
|
140
|
-
};
|
|
141
|
-
const handleDirectClick = () => {
|
|
142
|
-
if (!showPopover && onLogin && !isLoading) {
|
|
143
|
-
setIsLoading(true);
|
|
144
|
-
onLogin();
|
|
145
|
-
}
|
|
146
|
-
};
|
|
147
|
-
const triggerStyle = {
|
|
148
|
-
...styles.trigger,
|
|
149
|
-
cursor: onLogin ? "pointer" : "wait",
|
|
150
|
-
...style,
|
|
151
|
-
};
|
|
152
|
-
const allowLogin = !isLoading && !!onLogin;
|
|
153
|
-
const connectButtonStyle = {
|
|
154
|
-
...styles.connectButtonBase,
|
|
155
|
-
...(darkMode ? styles.connectButtonDark : styles.connectButtonLight),
|
|
156
|
-
cursor: allowLogin ? "pointer" : "wait",
|
|
157
|
-
};
|
|
158
|
-
const popoverStyle = {
|
|
159
|
-
...styles.popoverBase,
|
|
160
|
-
...(darkMode ? styles.popoverDark : styles.popoverLight),
|
|
161
|
-
...(showAbove
|
|
162
|
-
? { bottom: `calc(100% + ${POPOVER_GAP}px)` }
|
|
163
|
-
: { top: `calc(100% + ${POPOVER_GAP}px)` }),
|
|
164
|
-
};
|
|
165
|
-
const triggerImageStyle = darkMode
|
|
166
|
-
? styles.triggerImageDark
|
|
167
|
-
: styles.triggerImageLight;
|
|
168
|
-
const logoColor = darkMode ? "#f9fafb" : "#374151";
|
|
169
|
-
return (_jsxs("div", { ref: wrapperRef, style: styles.wrapper, className: className, onMouseEnter: handleMouseEnter, onMouseLeave: handleMouseLeave, children: [renderTrigger ? (renderTrigger({
|
|
170
|
-
onMouseEnter: handleMouseEnter,
|
|
171
|
-
onMouseLeave: handleMouseLeave,
|
|
172
|
-
isLoading,
|
|
173
|
-
})) : (_jsx("button", { type: "button", style: triggerStyle, "aria-label": showPopover ? "Open Renown Login" : "Login with Renown", onClick: showPopover ? undefined : handleDirectClick, children: isLoading ? (_jsx(SpinnerIcon, { size: 42 })) : (_jsx("img", { width: 42, height: 42, src: isHovered ? renownShortHoverDataUrl : renownShortDataUrl, alt: "Renown Login", style: triggerImageStyle })) })), isOpen && showPopover && (_jsx("div", { ref: popoverRef, style: popoverStyle, children: _jsxs("div", { style: styles.popoverContent, children: [_jsx("div", { style: styles.logoContainer, children: _jsx(RenownLogo, { width: 83, height: 22, color: logoColor }) }), _jsx("button", { type: "button", onClick: allowLogin ? handleConnect : undefined, style: connectButtonStyle, children: isLoading ? _jsx(SpinnerIcon, { size: 14 }) : "Connect" })] }) }))] }));
|
|
174
|
-
}
|
|
175
|
-
//# sourceMappingURL=RenownLoginButton.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"RenownLoginButton.js","sourceRoot":"","sources":["../../../src/components/RenownLoginButton.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAGb,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjE,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACrD,OAAO,EAAE,kBAAkB,EAAE,uBAAu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ButtonProps {
|
|
3
|
-
/**
|
|
4
|
-
* The user's wallet address
|
|
5
|
-
*/
|
|
6
|
-
address: string;
|
|
7
|
-
/**
|
|
8
|
-
* Optional ENS name or username to display
|
|
9
|
-
*/
|
|
10
|
-
username?: string;
|
|
11
|
-
/**
|
|
12
|
-
* Optional avatar URL
|
|
13
|
-
*/
|
|
14
|
-
avatarUrl?: string;
|
|
15
|
-
/**
|
|
16
|
-
* User ID to view the profile on Renown
|
|
17
|
-
*/
|
|
18
|
-
userId?: string;
|
|
19
|
-
/**
|
|
20
|
-
* Callback when disconnect is requested
|
|
21
|
-
*/
|
|
22
|
-
onDisconnect: (() => void) | undefined;
|
|
23
|
-
/**
|
|
24
|
-
* Custom styles for the button
|
|
25
|
-
*/
|
|
26
|
-
style?: CSSProperties;
|
|
27
|
-
/**
|
|
28
|
-
* Custom class name
|
|
29
|
-
*/
|
|
30
|
-
className?: string;
|
|
31
|
-
/**
|
|
32
|
-
* Custom render function for the trigger button
|
|
33
|
-
*/
|
|
34
|
-
renderTrigger?: (props: {
|
|
35
|
-
onMouseEnter: () => void;
|
|
36
|
-
onMouseLeave: () => void;
|
|
37
|
-
address: string;
|
|
38
|
-
username?: string;
|
|
39
|
-
avatarUrl?: string;
|
|
40
|
-
}) => ReactNode;
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* A user button that shows account info in a popover with options to copy address,
|
|
44
|
-
* view profile, and disconnect.
|
|
45
|
-
*
|
|
46
|
-
* @example
|
|
47
|
-
* ```tsx
|
|
48
|
-
* import { RenownUserButton } from '@renown/sdk'
|
|
49
|
-
*
|
|
50
|
-
* function UserArea() {
|
|
51
|
-
* const handleDisconnect = () => {
|
|
52
|
-
* // Your disconnect logic
|
|
53
|
-
* }
|
|
54
|
-
* return (
|
|
55
|
-
* <RenownUserButton
|
|
56
|
-
* address="0x1234...5678"
|
|
57
|
-
* username="vitalik.eth"
|
|
58
|
-
* userId="abc123"
|
|
59
|
-
* onDisconnect={handleDisconnect}
|
|
60
|
-
* />
|
|
61
|
-
* )
|
|
62
|
-
* }
|
|
63
|
-
* ```
|
|
64
|
-
*/
|
|
65
|
-
export declare function RenownUserButton({ address, username, avatarUrl, userId, onDisconnect, style, className, renderTrigger, }: RenownUserButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
66
|
-
//# sourceMappingURL=RenownUserButton.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"RenownUserButton.d.ts","sourceRoot":"","sources":["../../../src/components/RenownUserButton.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAatD,MAAM,WAAW,qBAAqB;IACpC;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;IAChB;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;OAEG;IACH,YAAY,EAAE,CAAC,MAAM,IAAI,CAAC,GAAG,SAAS,CAAC;IACvC;;OAEG;IACH,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE;QACtB,YAAY,EAAE,MAAM,IAAI,CAAC;QACzB,YAAY,EAAE,MAAM,IAAI,CAAC;QACzB,OAAO,EAAE,MAAM,CAAC;QAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,SAAS,CAAC,EAAE,MAAM,CAAC;KACpB,KAAK,SAAS,CAAC;CACjB;AAyHD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,gBAAgB,CAAC,EAC/B,OAAO,EACP,QAAQ,EACR,SAAS,EACT,MAAM,EACN,YAAY,EACZ,KAAK,EACL,SAAS,EACT,aAAa,GACd,EAAE,qBAAqB,2CAuJvB"}
|
|
@@ -1,216 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { useCallback, useEffect, useRef, useState } from "react";
|
|
4
|
-
import { openRenown } from "../lib/renown/utils.js";
|
|
5
|
-
import { CopyIcon, DisconnectIcon, ExternalLinkIcon, UserIcon, } from "./icons.js";
|
|
6
|
-
const POPOVER_GAP = 8;
|
|
7
|
-
const POPOVER_HEIGHT = 150; // approximate height of popover
|
|
8
|
-
const styles = {
|
|
9
|
-
wrapper: {
|
|
10
|
-
position: "relative",
|
|
11
|
-
display: "inline-block",
|
|
12
|
-
},
|
|
13
|
-
trigger: {
|
|
14
|
-
display: "flex",
|
|
15
|
-
alignItems: "center",
|
|
16
|
-
justifyContent: "center",
|
|
17
|
-
padding: 0,
|
|
18
|
-
border: "none",
|
|
19
|
-
background: "transparent",
|
|
20
|
-
cursor: "pointer",
|
|
21
|
-
borderRadius: "50%",
|
|
22
|
-
overflow: "hidden",
|
|
23
|
-
},
|
|
24
|
-
avatar: {
|
|
25
|
-
width: "40px",
|
|
26
|
-
height: "40px",
|
|
27
|
-
borderRadius: "50%",
|
|
28
|
-
objectFit: "cover",
|
|
29
|
-
},
|
|
30
|
-
avatarPlaceholder: {
|
|
31
|
-
width: "40px",
|
|
32
|
-
height: "40px",
|
|
33
|
-
borderRadius: "50%",
|
|
34
|
-
backgroundColor: "#e5e7eb",
|
|
35
|
-
display: "flex",
|
|
36
|
-
alignItems: "center",
|
|
37
|
-
justifyContent: "center",
|
|
38
|
-
},
|
|
39
|
-
popoverBase: {
|
|
40
|
-
position: "absolute",
|
|
41
|
-
left: 0,
|
|
42
|
-
backgroundColor: "white",
|
|
43
|
-
borderRadius: "8px",
|
|
44
|
-
boxShadow: "0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)",
|
|
45
|
-
width: "208px", // w-52
|
|
46
|
-
zIndex: 1000,
|
|
47
|
-
color: "#111827", // text-gray-900
|
|
48
|
-
},
|
|
49
|
-
section: {
|
|
50
|
-
padding: "8px 12px", // py-2 px-3
|
|
51
|
-
borderBottom: "1px solid #e5e7eb", // divide-gray-200
|
|
52
|
-
},
|
|
53
|
-
sectionLast: {
|
|
54
|
-
padding: "8px 12px",
|
|
55
|
-
borderBottom: "none",
|
|
56
|
-
},
|
|
57
|
-
username: {
|
|
58
|
-
fontSize: "14px",
|
|
59
|
-
fontWeight: 500, // font-medium
|
|
60
|
-
color: "#111827",
|
|
61
|
-
},
|
|
62
|
-
addressRow: {
|
|
63
|
-
display: "flex",
|
|
64
|
-
alignItems: "center",
|
|
65
|
-
gap: "8px",
|
|
66
|
-
marginTop: "4px",
|
|
67
|
-
},
|
|
68
|
-
addressButton: {
|
|
69
|
-
display: "flex",
|
|
70
|
-
alignItems: "center",
|
|
71
|
-
gap: "4px",
|
|
72
|
-
padding: 0,
|
|
73
|
-
border: "none",
|
|
74
|
-
background: "transparent",
|
|
75
|
-
cursor: "pointer",
|
|
76
|
-
fontSize: "12px",
|
|
77
|
-
color: "#111827",
|
|
78
|
-
position: "relative",
|
|
79
|
-
width: "100%",
|
|
80
|
-
},
|
|
81
|
-
copiedText: {
|
|
82
|
-
fontSize: "12px",
|
|
83
|
-
color: "#111827",
|
|
84
|
-
position: "absolute",
|
|
85
|
-
left: 0,
|
|
86
|
-
transition: "opacity 150ms",
|
|
87
|
-
},
|
|
88
|
-
addressText: {
|
|
89
|
-
display: "flex",
|
|
90
|
-
alignItems: "center",
|
|
91
|
-
gap: "4px",
|
|
92
|
-
transition: "opacity 150ms",
|
|
93
|
-
},
|
|
94
|
-
menuItem: {
|
|
95
|
-
display: "flex",
|
|
96
|
-
alignItems: "center",
|
|
97
|
-
gap: "8px",
|
|
98
|
-
width: "100%",
|
|
99
|
-
padding: 0,
|
|
100
|
-
border: "none",
|
|
101
|
-
background: "transparent",
|
|
102
|
-
cursor: "pointer",
|
|
103
|
-
fontSize: "14px",
|
|
104
|
-
color: "#111827", // text-gray-900
|
|
105
|
-
textDecoration: "none",
|
|
106
|
-
},
|
|
107
|
-
menuItemHover: {
|
|
108
|
-
color: "#4b5563", // hover:text-gray-600
|
|
109
|
-
},
|
|
110
|
-
disconnectItem: {
|
|
111
|
-
color: "#7f1d1d", // text-red-900
|
|
112
|
-
},
|
|
113
|
-
disconnectItemHover: {
|
|
114
|
-
color: "#b91c1c", // hover:text-red-700
|
|
115
|
-
},
|
|
116
|
-
};
|
|
117
|
-
/**
|
|
118
|
-
* Truncates an Ethereum address for display
|
|
119
|
-
*/
|
|
120
|
-
function truncateAddress(address) {
|
|
121
|
-
if (address.length <= 13)
|
|
122
|
-
return address;
|
|
123
|
-
return `${address.slice(0, 7)}...${address.slice(-5)}`;
|
|
124
|
-
}
|
|
125
|
-
/**
|
|
126
|
-
* A user button that shows account info in a popover with options to copy address,
|
|
127
|
-
* view profile, and disconnect.
|
|
128
|
-
*
|
|
129
|
-
* @example
|
|
130
|
-
* ```tsx
|
|
131
|
-
* import { RenownUserButton } from '@renown/sdk'
|
|
132
|
-
*
|
|
133
|
-
* function UserArea() {
|
|
134
|
-
* const handleDisconnect = () => {
|
|
135
|
-
* // Your disconnect logic
|
|
136
|
-
* }
|
|
137
|
-
* return (
|
|
138
|
-
* <RenownUserButton
|
|
139
|
-
* address="0x1234...5678"
|
|
140
|
-
* username="vitalik.eth"
|
|
141
|
-
* userId="abc123"
|
|
142
|
-
* onDisconnect={handleDisconnect}
|
|
143
|
-
* />
|
|
144
|
-
* )
|
|
145
|
-
* }
|
|
146
|
-
* ```
|
|
147
|
-
*/
|
|
148
|
-
export function RenownUserButton({ address, username, avatarUrl, userId, onDisconnect, style, className, renderTrigger, }) {
|
|
149
|
-
const [isOpen, setIsOpen] = useState(false);
|
|
150
|
-
const [isCopied, setIsCopied] = useState(false);
|
|
151
|
-
const [showAbove, setShowAbove] = useState(true);
|
|
152
|
-
const wrapperRef = useRef(null);
|
|
153
|
-
const closeTimeoutRef = useRef(null);
|
|
154
|
-
const calculatePosition = useCallback(() => {
|
|
155
|
-
if (!wrapperRef.current)
|
|
156
|
-
return;
|
|
157
|
-
const rect = wrapperRef.current.getBoundingClientRect();
|
|
158
|
-
const spaceAbove = rect.top;
|
|
159
|
-
const hasSpaceAbove = spaceAbove >= POPOVER_HEIGHT + POPOVER_GAP;
|
|
160
|
-
setShowAbove(hasSpaceAbove);
|
|
161
|
-
}, []);
|
|
162
|
-
const handleMouseEnter = useCallback(() => {
|
|
163
|
-
if (closeTimeoutRef.current) {
|
|
164
|
-
clearTimeout(closeTimeoutRef.current);
|
|
165
|
-
closeTimeoutRef.current = null;
|
|
166
|
-
}
|
|
167
|
-
calculatePosition();
|
|
168
|
-
setIsOpen(true);
|
|
169
|
-
}, [calculatePosition]);
|
|
170
|
-
const handleMouseLeave = useCallback(() => {
|
|
171
|
-
closeTimeoutRef.current = setTimeout(() => {
|
|
172
|
-
setIsOpen(false);
|
|
173
|
-
}, 150);
|
|
174
|
-
}, []);
|
|
175
|
-
useEffect(() => {
|
|
176
|
-
return () => {
|
|
177
|
-
if (closeTimeoutRef.current) {
|
|
178
|
-
clearTimeout(closeTimeoutRef.current);
|
|
179
|
-
}
|
|
180
|
-
};
|
|
181
|
-
}, []);
|
|
182
|
-
const copyToClipboard = useCallback(async () => {
|
|
183
|
-
try {
|
|
184
|
-
await navigator.clipboard.writeText(address);
|
|
185
|
-
setIsCopied(true);
|
|
186
|
-
setTimeout(() => setIsCopied(false), 2000);
|
|
187
|
-
}
|
|
188
|
-
catch (err) {
|
|
189
|
-
console.error("Failed to copy address:", err);
|
|
190
|
-
}
|
|
191
|
-
}, [address]);
|
|
192
|
-
return (_jsxs("div", { ref: wrapperRef, style: styles.wrapper, className: className, onMouseEnter: handleMouseEnter, onMouseLeave: handleMouseLeave, children: [renderTrigger ? (renderTrigger({
|
|
193
|
-
onMouseEnter: handleMouseEnter,
|
|
194
|
-
onMouseLeave: handleMouseLeave,
|
|
195
|
-
address,
|
|
196
|
-
username,
|
|
197
|
-
avatarUrl,
|
|
198
|
-
})) : (_jsx("button", { type: "button", style: { ...styles.trigger, ...style }, "aria-label": "Open account menu", children: avatarUrl ? (_jsx("img", { src: avatarUrl, alt: "Avatar", style: styles.avatar })) : (_jsx("div", { style: styles.avatarPlaceholder, children: _jsx(UserIcon, { size: 24, color: "#9ca3af" }) })) })), isOpen && (_jsxs("div", { style: {
|
|
199
|
-
...styles.popoverBase,
|
|
200
|
-
...(showAbove
|
|
201
|
-
? { bottom: `calc(100% + ${POPOVER_GAP}px)` }
|
|
202
|
-
: { top: `calc(100% + ${POPOVER_GAP}px)` }),
|
|
203
|
-
}, children: [_jsxs("div", { style: styles.section, children: [username && _jsx("div", { style: styles.username, children: username }), _jsx("div", { style: styles.addressRow, children: _jsx("button", { type: "button", onClick: copyToClipboard, style: styles.addressButton, children: _jsxs("div", { style: {
|
|
204
|
-
position: "relative",
|
|
205
|
-
display: "flex",
|
|
206
|
-
alignItems: "center",
|
|
207
|
-
gap: "4px",
|
|
208
|
-
width: "100%",
|
|
209
|
-
}, children: [_jsxs("div", { style: { ...styles.addressText, opacity: isCopied ? 0 : 1 }, children: [_jsx("span", { children: truncateAddress(address) }), _jsx(CopyIcon, { size: 14, color: "#9EA0A1" })] }), _jsx("div", { style: { ...styles.copiedText, opacity: isCopied ? 1 : 0 }, children: "Copied to clipboard!" })] }) }) })] }), userId && (_jsx("div", { style: styles.section, children: _jsxs("button", { type: "button", onClick: () => openRenown(userId), style: styles.menuItem, children: [_jsx(ExternalLinkIcon, { size: 14 }), "View on Renown"] }) })), _jsx("div", { style: styles.sectionLast, children: _jsxs("button", { type: "button", onClick: onDisconnect, style: {
|
|
210
|
-
...styles.menuItem,
|
|
211
|
-
...styles.disconnectItem,
|
|
212
|
-
cursor: onDisconnect ? "pointer" : "wait",
|
|
213
|
-
pointerEvents: onDisconnect ? "auto" : "none",
|
|
214
|
-
}, children: [_jsx(DisconnectIcon, { size: 14, color: "#EA4335" }), "Disconnect"] }) })] }))] }));
|
|
215
|
-
}
|
|
216
|
-
//# sourceMappingURL=RenownUserButton.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"RenownUserButton.js","sourceRoot":"","sources":["../../../src/components/RenownUserButton.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAGb,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjE,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EACL,QAAQ,EACR,cAAc,EACd,gBAAgB,EAChB,QAAQ,GACT,MAAM,YAAY,CAAC;AAEpB,MAAM,WAAW,GAAG,CAAC,CAAC;AACtB,MAAM,cAAc,GAAG,GAAG,CAAC,CAAC,gCAAgC;AA2C5D,MAAM,MAAM,GAAkC;IAC5C,OAAO,EAAE;QACP,QAAQ,EAAE,UAAU;QACpB,OAAO,EAAE,cAAc;KACxB;IACD,OAAO,EAAE;QACP,OAAO,EAAE,MAAM;QACf,UAAU,EAAE,QAAQ;QACpB,cAAc,EAAE,QAAQ;QACxB,OAAO,EAAE,CAAC;QACV,MAAM,EAAE,MAAM;QACd,UAAU,EAAE,aAAa;QACzB,MAAM,EAAE,SAAS;QACjB,YAAY,EAAE,KAAK;QACnB,QAAQ,EAAE,QAAQ;KACnB;IACD,MAAM,EAAE;QACN,KAAK,EAAE,MAAM;QACb,MAAM,EAAE,MAAM;QACd,YAAY,EAAE,KAAK;QACnB,SAAS,EAAE,OAAO;KACnB;IACD,iBAAiB,EAAE;QACjB,KAAK,EAAE,MAAM;QACb,MAAM,EAAE,MAAM;QACd,YAAY,EAAE,KAAK;QACnB,eAAe,EAAE,SAAS;QAC1B,OAAO,EAAE,MAAM;QACf,UAAU,EAAE,QAAQ;QACpB,cAAc,EAAE,QAAQ;KACzB;IACD,WAAW,EAAE;QACX,QAAQ,EAAE,UAAU;QACpB,IAAI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,CAAC,CAAC,CAAC,MAAM;gCACzC,aAAa,EAAE,YAAY,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM;6BAC9C,aAED,KAAC,cAAc,IAAC,IAAI,EAAE,EAAE,EAAE,KAAK,EAAC,SAAS,GAAG,kBAErC,GACL,IACF,CACP,IACG,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import type { CSSProperties } from "react";
|
|
2
|
-
interface IconProps {
|
|
3
|
-
size?: number;
|
|
4
|
-
width?: number;
|
|
5
|
-
height?: number;
|
|
6
|
-
color?: string;
|
|
7
|
-
style?: CSSProperties;
|
|
8
|
-
className?: string;
|
|
9
|
-
}
|
|
10
|
-
interface RenownLogoProps extends IconProps {
|
|
11
|
-
/** Show hover state with colored sparkle */
|
|
12
|
-
hovered?: boolean;
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* Renown wordmark logo with sparkle icon.
|
|
16
|
-
* Based on the official Renown branding.
|
|
17
|
-
*/
|
|
18
|
-
export declare function RenownLogo({ width, height, hovered, color, className, }: RenownLogoProps): import("react/jsx-runtime").JSX.Element;
|
|
19
|
-
export declare function CopyIcon({ size, color }: IconProps): import("react/jsx-runtime").JSX.Element;
|
|
20
|
-
export declare function ExternalLinkIcon({ size, color, }: IconProps): import("react/jsx-runtime").JSX.Element;
|
|
21
|
-
export declare function DisconnectIcon({ size, color }: IconProps): import("react/jsx-runtime").JSX.Element;
|
|
22
|
-
export declare function SpinnerIcon({ size, color }: IconProps): import("react/jsx-runtime").JSX.Element;
|
|
23
|
-
export declare function UserIcon({ size, color }: IconProps): import("react/jsx-runtime").JSX.Element;
|
|
24
|
-
export {};
|
|
25
|
-
//# sourceMappingURL=icons.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"icons.d.ts","sourceRoot":"","sources":["../../../src/components/icons.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAE3C,UAAU,SAAS;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,UAAU,eAAgB,SAAQ,SAAS;IACzC,4CAA4C;IAC5C,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED;;;GAGG;AACH,wBAAgB,UAAU,CAAC,EACzB,KAAU,EACV,MAAW,EACX,OAAe,EACf,KAAsB,EACtB,SAAS,GACV,EAAE,eAAe,2CA6BjB;AAED,wBAAgB,QAAQ,CAAC,EAAE,IAAS,EAAE,KAAiB,EAAE,EAAE,SAAS,2CAyBnE;AAED,wBAAgB,gBAAgB,CAAC,EAC/B,IAAS,EACT,KAAsB,GACvB,EAAE,SAAS,2CAgCX;AAED,wBAAgB,cAAc,CAAC,EAAE,IAAS,EAAE,KAAiB,EAAE,EAAE,SAAS,2CAgCzE;AAED,wBAAgB,WAAW,CAAC,EAAE,IAAS,EAAE,KAAsB,EAAE,EAAE,SAAS,2CA+D3E;AAED,wBAAgB,QAAQ,CAAC,EAAE,IAAS,EAAE,KAAiB,EAAE,EAAE,SAAS,2CAkBnE"}
|