@breadcoop/ui 1.0.28 → 2.0.1

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.
Files changed (108) hide show
  1. package/dist/chunk-FWCSY2DS.mjs +37 -0
  2. package/dist/components/LiftedButton/LiftedButton.d.mts +29 -0
  3. package/dist/components/LiftedButton/LiftedButton.mjs +149 -0
  4. package/dist/components/LiftedButton/LiftedButtonPresets.d.mts +55 -0
  5. package/dist/components/LiftedButton/LiftedButtonPresets.mjs +85 -0
  6. package/dist/components/LiftedButton/index.d.mts +2 -0
  7. package/dist/components/LiftedButton/index.mjs +0 -0
  8. package/dist/components/Logo/Logo.d.mts +29 -0
  9. package/dist/components/Logo/Logo.mjs +273 -0
  10. package/dist/components/Logo/index.d.mts +3 -0
  11. package/dist/components/Logo/index.mjs +5 -0
  12. package/dist/components/auth/button-shell.d.mts +5 -0
  13. package/dist/components/auth/button-shell.mjs +8 -0
  14. package/dist/components/auth/index.d.mts +5 -0
  15. package/dist/components/auth/index.mjs +5 -0
  16. package/dist/components/auth/login-button-general.d.mts +13 -0
  17. package/dist/components/auth/login-button-general.mjs +80 -0
  18. package/dist/components/auth/login-button-privy.d.mts +13 -0
  19. package/dist/components/auth/login-button-privy.mjs +64 -0
  20. package/dist/components/auth/login-button.d.mts +8 -0
  21. package/dist/components/auth/login-button.mjs +32 -0
  22. package/dist/components/buttons/button.d.mts +20 -0
  23. package/dist/components/buttons/button.mjs +98 -0
  24. package/dist/components/buttons/copy-icon.d.mts +10 -0
  25. package/dist/components/buttons/copy-icon.mjs +44 -0
  26. package/dist/components/buttons/index.d.mts +6 -0
  27. package/dist/components/buttons/index.mjs +7 -0
  28. package/dist/components/chip/chip.d.mts +12 -0
  29. package/dist/components/chip/chip.mjs +34 -0
  30. package/dist/components/connected-user/context.d.mts +14 -0
  31. package/dist/components/connected-user/context.mjs +22 -0
  32. package/dist/components/connected-user/index.d.mts +6 -0
  33. package/dist/components/connected-user/index.mjs +7 -0
  34. package/dist/components/connected-user/interface.d.mts +16 -0
  35. package/dist/components/connected-user/interface.mjs +0 -0
  36. package/dist/components/connected-user/privy-provider.d.mts +10 -0
  37. package/dist/components/connected-user/privy-provider.mjs +55 -0
  38. package/dist/components/connected-user/provider-general.d.mts +10 -0
  39. package/dist/components/connected-user/provider-general.mjs +38 -0
  40. package/dist/components/connected-user/provider.d.mts +9 -0
  41. package/dist/components/connected-user/provider.mjs +15 -0
  42. package/dist/components/footer/footer.d.mts +11 -0
  43. package/dist/components/footer/footer.mjs +222 -0
  44. package/dist/components/loading-icon.d.mts +9 -0
  45. package/dist/components/loading-icon.mjs +49 -0
  46. package/dist/components/navbar/account-menu.d.mts +15 -0
  47. package/dist/components/navbar/account-menu.mjs +48 -0
  48. package/dist/components/navbar/account-section.d.mts +14 -0
  49. package/dist/components/navbar/account-section.mjs +68 -0
  50. package/dist/components/navbar/account-widget-item.d.mts +12 -0
  51. package/dist/components/navbar/account-widget-item.mjs +21 -0
  52. package/dist/components/navbar/account-widget.d.mts +22 -0
  53. package/dist/components/navbar/account-widget.mjs +118 -0
  54. package/dist/components/navbar/index.d.mts +11 -0
  55. package/dist/components/navbar/index.mjs +10 -0
  56. package/dist/components/navbar/log-out.d.mts +7 -0
  57. package/dist/components/navbar/log-out.mjs +34 -0
  58. package/dist/components/navbar/navbar-menu.d.mts +12 -0
  59. package/dist/components/navbar/navbar-menu.mjs +57 -0
  60. package/dist/components/navbar/navbar.d.mts +25 -0
  61. package/dist/components/navbar/navbar.mjs +63 -0
  62. package/dist/components/navbar/solidarity-apps.d.mts +17 -0
  63. package/dist/components/navbar/solidarity-apps.mjs +167 -0
  64. package/dist/components/typography/Typography.d.mts +42 -0
  65. package/dist/components/typography/Typography.mjs +52 -0
  66. package/dist/components/typography/formatted-dec-num.d.mts +15 -0
  67. package/dist/components/typography/formatted-dec-num.mjs +40 -0
  68. package/dist/constansts/links.d.mts +26 -0
  69. package/dist/constansts/links.mjs +27 -0
  70. package/dist/constansts/tools.d.mts +23 -0
  71. package/dist/constansts/tools.mjs +52 -0
  72. package/dist/context/index.d.mts +5 -0
  73. package/dist/context/index.mjs +5 -0
  74. package/dist/context/lib.d.mts +31 -0
  75. package/dist/context/lib.mjs +33 -0
  76. package/dist/hooks/index.d.mts +4 -0
  77. package/dist/hooks/index.mjs +7 -0
  78. package/dist/hooks/use-auto-connect.d.mts +8 -0
  79. package/dist/hooks/use-auto-connect.mjs +39 -0
  80. package/dist/hooks/use-bread-balance.d.mts +13 -0
  81. package/dist/hooks/use-bread-balance.mjs +32 -0
  82. package/dist/hooks/use-copy-to-clipboard.d.mts +9 -0
  83. package/dist/hooks/use-copy-to-clipboard.mjs +26 -0
  84. package/dist/index.d.mts +33 -304
  85. package/dist/index.mjs +41 -1
  86. package/dist/interface/app.d.mts +3 -0
  87. package/dist/interface/app.mjs +0 -0
  88. package/dist/tailwind-preset.js +1 -0
  89. package/dist/theme.css +1 -0
  90. package/dist/utils/app.d.mts +19 -0
  91. package/dist/utils/app.mjs +21 -0
  92. package/dist/utils/cn.d.mts +5 -0
  93. package/dist/utils/cn.mjs +9 -0
  94. package/dist/utils/copy-to-clipboard.d.mts +3 -0
  95. package/dist/utils/copy-to-clipboard.mjs +10 -0
  96. package/dist/utils/cssValidation.d.mts +7 -0
  97. package/dist/utils/cssValidation.mjs +44 -0
  98. package/dist/utils/formatter.d.mts +3 -0
  99. package/dist/utils/formatter.mjs +13 -0
  100. package/dist/utils/index.d.mts +3 -0
  101. package/dist/utils/index.mjs +7 -0
  102. package/dist/utils/truncate-address.d.mts +3 -0
  103. package/dist/utils/truncate-address.mjs +5 -0
  104. package/package.json +9 -10
  105. package/tailwind-preset.js +1 -0
  106. package/theme.css +1 -0
  107. package/dist/index.d.ts +0 -304
  108. package/dist/index.js +0 -1
@@ -0,0 +1,222 @@
1
+ import "../../chunk-FWCSY2DS.mjs";
2
+ import { jsx, jsxs } from "react/jsx-runtime";
3
+ import {
4
+ GithubLogoIcon,
5
+ LinkedinLogoIcon,
6
+ YoutubeLogoIcon,
7
+ DiscordLogoIcon,
8
+ XLogoIcon,
9
+ EnvelopeSimpleIcon,
10
+ ArrowUpRightIcon
11
+ } from "@phosphor-icons/react/dist/ssr";
12
+ import { LINKS } from "../../constansts/links.mjs";
13
+ import { Body } from "../typography/Typography.mjs";
14
+ import { Logo } from "../Logo/index.mjs";
15
+ import { SOLIDARITY_TOOLS } from "../../constansts/tools.mjs";
16
+ function SocialIcons({ className = "" }) {
17
+ return /* @__PURE__ */ jsxs(
18
+ "div",
19
+ {
20
+ className: `flex items-center justify-center md:justify-start gap-5 pb-6 md:pb-0 ${className}`,
21
+ children: [
22
+ /* @__PURE__ */ jsx("a", { href: LINKS.youtube, className: "block", children: /* @__PURE__ */ jsx(YoutubeLogoIcon, { className: "w-6 h-6 text-surface-ink" }) }),
23
+ /* @__PURE__ */ jsx("a", { href: LINKS.linkedin, className: "block", children: /* @__PURE__ */ jsx(LinkedinLogoIcon, { className: "w-6 h-6 text-surface-ink" }) }),
24
+ /* @__PURE__ */ jsx(
25
+ "a",
26
+ {
27
+ href: LINKS.github,
28
+ target: "_blank",
29
+ rel: "noopener noreferrer",
30
+ className: "block",
31
+ children: /* @__PURE__ */ jsx(GithubLogoIcon, { className: "w-6 h-6 text-surface-ink" })
32
+ }
33
+ ),
34
+ /* @__PURE__ */ jsx("a", { href: LINKS.discord, className: "block", children: /* @__PURE__ */ jsx(DiscordLogoIcon, { className: "w-6 h-6 text-surface-ink" }) }),
35
+ /* @__PURE__ */ jsx("a", { href: LINKS.twitter, className: "block", children: /* @__PURE__ */ jsx(XLogoIcon, { className: "w-6 h-6 text-surface-ink" }) }),
36
+ /* @__PURE__ */ jsx("a", { href: LINKS.newsletter, className: "block", children: /* @__PURE__ */ jsx(
37
+ "img",
38
+ {
39
+ src: "/paragraph.png",
40
+ alt: "Paragraph icon",
41
+ width: 24,
42
+ height: 24,
43
+ className: "p-0.75 w-5 h-5 text-surface-ink"
44
+ }
45
+ ) }),
46
+ /* @__PURE__ */ jsx("a", { href: LINKS.farcaster, className: "block", children: /* @__PURE__ */ jsx(
47
+ "img",
48
+ {
49
+ src: "/farcaster-icon.png",
50
+ alt: "Farcaser icon",
51
+ width: 24,
52
+ height: 24,
53
+ className: "p-0.75 w-5 h-5 text-surface-ink"
54
+ }
55
+ ) })
56
+ ]
57
+ }
58
+ );
59
+ }
60
+ function FooterLink({
61
+ href,
62
+ children,
63
+ isExternal = false,
64
+ mode
65
+ }) {
66
+ const isDisabled = !href || href.trim() === "";
67
+ if (isDisabled) {
68
+ return /* @__PURE__ */ jsx(Body, { className: "text-surface-ink font-breadBody flex items-center gap-2 opacity-50 ", children });
69
+ }
70
+ return /* @__PURE__ */ jsxs(
71
+ "a",
72
+ {
73
+ href,
74
+ target: isExternal ? "_blank" : "_self",
75
+ rel: isExternal ? "noopener noreferrer" : "",
76
+ className: `font-breadBody flex items-center gap-2 ${mode === "colored" ? "text-surface-ink hover:text-paper-0" : ""}`,
77
+ children: [
78
+ children,
79
+ isExternal && /* @__PURE__ */ jsx(ArrowUpRightIcon, { className: "w-6 h-6 text-orange-0" })
80
+ ]
81
+ }
82
+ );
83
+ }
84
+ function Footer({
85
+ className = "",
86
+ topClassName = "",
87
+ infoClassName = "",
88
+ mode = "colored"
89
+ }) {
90
+ return /* @__PURE__ */ jsxs(
91
+ "footer",
92
+ {
93
+ className: `px-4 py-12 ${mode === "colored" ? "bg-primary-orange text-white" : "bg-transparent text-surface-ink"} ${className}`,
94
+ children: [
95
+ /* @__PURE__ */ jsxs(
96
+ "div",
97
+ {
98
+ className: `mb-8 max-w-79.5 mx-auto md:max-w-7xl xl:flex xl:gap-4 ${topClassName}`,
99
+ children: [
100
+ /* @__PURE__ */ jsxs(
101
+ "div",
102
+ {
103
+ className: `md:flex md:items-center md:justify-between md:mb-8 xl:flex-col xl:w-full xl:max-w-max ${infoClassName}`,
104
+ children: [
105
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center md:items-start mb-4 md:mb-0 xl:mb-6", children: [
106
+ /* @__PURE__ */ jsx("div", { className: "flex uppercase text-2xl items-center gap-3 mb-2", children: /* @__PURE__ */ jsx(
107
+ Logo,
108
+ {
109
+ text: "Bread Cooperative",
110
+ size: 23,
111
+ color: mode === "colored" ? "white" : void 0
112
+ }
113
+ ) }),
114
+ /* @__PURE__ */ jsx("p", { className: "font-breadBody text-center md:text-left", children: "Solidarity forever." })
115
+ ] }),
116
+ /* @__PURE__ */ jsx("div", { className: "mb-4 xl:w-full", children: /* @__PURE__ */ jsx(SocialIcons, { className: "xl:gap-4" }) })
117
+ ]
118
+ }
119
+ ),
120
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-4 md:flex-row md:justify-between xl:w-full xl:max-w-212 xl:ml-auto", children: [
121
+ /* @__PURE__ */ jsxs("div", { className: "w-full", children: [
122
+ /* @__PURE__ */ jsx(
123
+ Body,
124
+ {
125
+ className: `text-lg mb-4 ${mode === "transparent" ? "text-core-orange" : ""}`,
126
+ children: "Cooperative"
127
+ }
128
+ ),
129
+ /* @__PURE__ */ jsxs("ul", { className: "space-y-3", children: [
130
+ /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx(FooterLink, { mode, href: LINKS.docs, children: "Documentation" }) }),
131
+ /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx(FooterLink, { mode, href: LINKS.newsletter, children: "Blog" }) }),
132
+ /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx(
133
+ FooterLink,
134
+ {
135
+ mode,
136
+ href: LINKS.contributorForm,
137
+ children: "Contribute"
138
+ }
139
+ ) })
140
+ ] })
141
+ ] }),
142
+ /* @__PURE__ */ jsxs("div", { className: "w-full", children: [
143
+ /* @__PURE__ */ jsx(
144
+ Body,
145
+ {
146
+ className: `text-lg mb-4 ${mode === "transparent" ? "text-core-orange" : ""}`,
147
+ children: "Solidarity tools"
148
+ }
149
+ ),
150
+ /* @__PURE__ */ jsx("ul", { className: "space-y-3", children: SOLIDARITY_TOOLS.map((tool) => /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx(
151
+ FooterLink,
152
+ {
153
+ href: tool.webLink || "",
154
+ isExternal: !tool.comingSoon,
155
+ children: tool.title
156
+ }
157
+ ) }, tool.id)) })
158
+ ] }),
159
+ /* @__PURE__ */ jsxs("div", { className: "w-full", children: [
160
+ /* @__PURE__ */ jsx(
161
+ Body,
162
+ {
163
+ className: `text-lg mb-4 ${mode === "transparent" ? "text-core-orange" : ""}`,
164
+ children: "Reach out"
165
+ }
166
+ ),
167
+ /* @__PURE__ */ jsxs(
168
+ "a",
169
+ {
170
+ href: "mailto:contact@bread.coop",
171
+ className: `font-breadBody flex items-center gap-2 ${mode === "colored" ? "text-surface-ink hover:text-paper-0" : ""}`,
172
+ children: [
173
+ /* @__PURE__ */ jsx(EnvelopeSimpleIcon, { className: "w-6 h-6 text-orange-0" }),
174
+ "contact@bread.coop"
175
+ ]
176
+ }
177
+ )
178
+ ] }),
179
+ /* @__PURE__ */ jsxs("div", { className: "w-full", children: [
180
+ /* @__PURE__ */ jsx(
181
+ Body,
182
+ {
183
+ className: `text-lg mb-4 ${mode === "transparent" ? "text-core-orange" : ""}`,
184
+ children: "Support us"
185
+ }
186
+ ),
187
+ /* @__PURE__ */ jsxs("ul", { className: "space-y-3", children: [
188
+ /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx(
189
+ FooterLink,
190
+ {
191
+ mode,
192
+ href: LINKS.giveth,
193
+ isExternal: true,
194
+ children: "Donate in crypto"
195
+ }
196
+ ) }),
197
+ /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx(
198
+ FooterLink,
199
+ {
200
+ mode,
201
+ href: LINKS.openCollective,
202
+ isExternal: true,
203
+ children: "Donate in fiat"
204
+ }
205
+ ) })
206
+ ] })
207
+ ] })
208
+ ] })
209
+ ]
210
+ }
211
+ ),
212
+ /* @__PURE__ */ jsxs("div", { className: "border-t border-orange-0 pt-6 flex flex-col justify-between items-center gap-4 md:flex-row md:mx-auto md:max-w-7xl", children: [
213
+ /* @__PURE__ */ jsx(Body, { className: "text-sm", children: "Creative Commons \xA9BREAD Cooperative" }),
214
+ /* @__PURE__ */ jsx("div", { className: "flex items-center gap-4", children: /* @__PURE__ */ jsx(Body, { className: "text-sm", children: "All Rights Reserved" }) })
215
+ ] })
216
+ ]
217
+ }
218
+ );
219
+ }
220
+ export {
221
+ Footer as default
222
+ };
@@ -0,0 +1,9 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { App } from '../interface/app.mjs';
3
+
4
+ declare function LoadingIcon({ app, className, }: {
5
+ app: App;
6
+ className?: string;
7
+ }): react_jsx_runtime.JSX.Element;
8
+
9
+ export { LoadingIcon };
@@ -0,0 +1,49 @@
1
+ import "../chunk-FWCSY2DS.mjs";
2
+ import { jsx, jsxs } from "react/jsx-runtime";
3
+ import { cn } from "../utils/index.mjs";
4
+ function LoadingIcon({
5
+ app,
6
+ className
7
+ }) {
8
+ return /* @__PURE__ */ jsx("div", { className: cn("relative w-8 h-8", className), children: /* @__PURE__ */ jsxs(
9
+ "svg",
10
+ {
11
+ className: "w-full h-full transform -rotate-90",
12
+ viewBox: "0 0 120 120",
13
+ children: [
14
+ /* @__PURE__ */ jsx(
15
+ "circle",
16
+ {
17
+ cx: "60",
18
+ cy: "60",
19
+ r: "50",
20
+ fill: "none",
21
+ strokeWidth: "20",
22
+ className: app === "fund" ? "stroke-orange-2" : app === "stacks" ? "stroke-[#B9D5FF]" : "stroke-[#CBE9E5]"
23
+ }
24
+ ),
25
+ /* @__PURE__ */ jsx(
26
+ "circle",
27
+ {
28
+ cx: "60",
29
+ cy: "60",
30
+ r: "50",
31
+ fill: "none",
32
+ strokeWidth: "20",
33
+ strokeDasharray: "314",
34
+ strokeDashoffset: "235",
35
+ strokeLinecap: "round",
36
+ className: cn(
37
+ "origin-center animate-spin",
38
+ app === "fund" ? "stroke-orange-0" : app === "stacks" ? "stroke-primary-blue" : "stroke-primary-jade"
39
+ ),
40
+ style: { animationDuration: "2s" }
41
+ }
42
+ )
43
+ ]
44
+ }
45
+ ) });
46
+ }
47
+ export {
48
+ LoadingIcon
49
+ };
@@ -0,0 +1,15 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { Address } from 'viem';
3
+ import { NavAccountDetailsProps } from './account-widget.mjs';
4
+ import { App } from '../../interface/app.mjs';
5
+ import 'react';
6
+ import 'wagmi';
7
+ import '@wagmi/core';
8
+
9
+ interface AccountMenuProps extends Pick<NavAccountDetailsProps, "widgetItems" | "ensNameResult" | "actionItems"> {
10
+ userAddress: Address;
11
+ app: App;
12
+ }
13
+ declare const AccountMenu: ({ userAddress, ensNameResult, app, widgetItems, actionItems }: AccountMenuProps) => react_jsx_runtime.JSX.Element;
14
+
15
+ export { type AccountMenuProps, AccountMenu as default };
@@ -0,0 +1,48 @@
1
+ "use client";
2
+ import "../../chunk-FWCSY2DS.mjs";
3
+ import { jsx, jsxs } from "react/jsx-runtime";
4
+ import * as NavigationMenu from "@radix-ui/react-navigation-menu";
5
+ import { Body } from "../typography/Typography.mjs";
6
+ import { truncateAddress } from "../../utils/truncate-address.mjs";
7
+ import { CaretDownIcon } from "@phosphor-icons/react";
8
+ import NavAccountDetails from "./account-widget.mjs";
9
+ import { appsConfig } from "../../utils/app.mjs";
10
+ const AccountMenu = ({
11
+ userAddress,
12
+ ensNameResult,
13
+ app,
14
+ widgetItems,
15
+ actionItems
16
+ }) => {
17
+ return /* @__PURE__ */ jsxs(NavigationMenu.Root, { className: "relative", children: [
18
+ /* @__PURE__ */ jsx(NavigationMenu.List, { children: /* @__PURE__ */ jsxs(NavigationMenu.Item, { children: [
19
+ /* @__PURE__ */ jsx(NavigationMenu.Trigger, { className: "group w-full", children: /* @__PURE__ */ jsxs(
20
+ Body,
21
+ {
22
+ bold: true,
23
+ className: "w-full flex items-center justify-center gap-2.5 truncate text-ellipsis py-3 px-6 bg-paper-2 border border-surface-ink font-bold",
24
+ children: [
25
+ ensNameResult.data || truncateAddress(userAddress || ""),
26
+ /* @__PURE__ */ jsx("span", { className: appsConfig[app].text, children: /* @__PURE__ */ jsx(CaretDownIcon, {}) })
27
+ ]
28
+ }
29
+ ) }),
30
+ /* @__PURE__ */ jsx(NavigationMenu.Content, { className: "w-max", children: /* @__PURE__ */ jsx(
31
+ NavAccountDetails,
32
+ {
33
+ className: "border w-full md:w-screen md:max-w-110.75 md:bg-paper-main md:border-paper-2",
34
+ userAddress,
35
+ ensNameResult,
36
+ app,
37
+ widgetItems,
38
+ actionItems
39
+ }
40
+ ) })
41
+ ] }) }),
42
+ /* @__PURE__ */ jsx(NavigationMenu.Viewport, { className: "nav-account-menu absolute top-14 right-0 z-20 left-0 md:left-auto" })
43
+ ] });
44
+ };
45
+ var account_menu_default = AccountMenu;
46
+ export {
47
+ account_menu_default as default
48
+ };
@@ -0,0 +1,14 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { App } from '../../interface/app.mjs';
3
+ import { NavAccountDetailsProps } from './account-widget.mjs';
4
+ import 'react';
5
+ import 'wagmi';
6
+ import '@wagmi/core';
7
+ import 'viem';
8
+
9
+ interface AccountSectionProps extends Pick<NavAccountDetailsProps, "widgetItems" | "actionItems"> {
10
+ app: App;
11
+ }
12
+ declare const AccountSection: ({ app, widgetItems, actionItems }: AccountSectionProps) => react_jsx_runtime.JSX.Element;
13
+
14
+ export { AccountSection as default };
@@ -0,0 +1,68 @@
1
+ "use client";
2
+ import "../../chunk-FWCSY2DS.mjs";
3
+ import { jsx } from "react/jsx-runtime";
4
+ import { useAccount, useEnsName } from "wagmi";
5
+ import { usePrivy, useWallets } from "@privy-io/react-auth";
6
+ import { LoginButton } from "../auth/index.mjs";
7
+ import { useConnectedUser } from "../connected-user/index.mjs";
8
+ import AccountMenu from "./account-menu.mjs";
9
+ import { SignInIcon } from "@phosphor-icons/react/dist/ssr";
10
+ import { useAuthProvider } from "../../context/lib.mjs";
11
+ import { useMemo } from "react";
12
+ const AccountSection = ({ app, widgetItems, actionItems }) => {
13
+ const { user } = useConnectedUser();
14
+ const authProvider = useAuthProvider();
15
+ const { address: wagmiAddress } = useAccount();
16
+ const wagmiEnsName = useEnsName({
17
+ address: wagmiAddress,
18
+ query: { enabled: Boolean(wagmiAddress) && authProvider === "general" }
19
+ });
20
+ const { ready: privyReady } = usePrivy();
21
+ const { wallets } = useWallets();
22
+ const { address, ensNameResult } = useMemo(() => {
23
+ if (authProvider === "privy") {
24
+ const activeWallet = wallets.find(
25
+ (wallet) => {
26
+ var _a;
27
+ return wallet.walletClientType === "privy" || wallet.walletClientType === "embedded_wallet" || ((_a = wallet.walletClientType) == null ? void 0 : _a.includes("embedded"));
28
+ }
29
+ );
30
+ return {
31
+ address: activeWallet == null ? void 0 : activeWallet.address,
32
+ ensNameResult: {
33
+ data: void 0,
34
+ isLoading: !privyReady,
35
+ isError: false
36
+ }
37
+ };
38
+ }
39
+ return {
40
+ address: wagmiAddress,
41
+ ensNameResult: wagmiEnsName
42
+ };
43
+ }, [authProvider, wallets, privyReady, wagmiAddress, wagmiEnsName]);
44
+ if (user.status === "CONNECTED" && address) {
45
+ return /* @__PURE__ */ jsx(
46
+ AccountMenu,
47
+ {
48
+ widgetItems,
49
+ actionItems,
50
+ userAddress: address,
51
+ ensNameResult,
52
+ app
53
+ }
54
+ );
55
+ }
56
+ return /* @__PURE__ */ jsx("div", { className: "mt-6 md:mt-0", children: /* @__PURE__ */ jsx(
57
+ LoginButton,
58
+ {
59
+ app,
60
+ status: user.status,
61
+ rightIcon: /* @__PURE__ */ jsx(SignInIcon, { size: 24 })
62
+ }
63
+ ) });
64
+ };
65
+ var account_section_default = AccountSection;
66
+ export {
67
+ account_section_default as default
68
+ };
@@ -0,0 +1,12 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { Icon } from '@phosphor-icons/react';
3
+ import { ReactNode } from 'react';
4
+
5
+ declare const NavAccountWidgetItem: ({ I, label, children, appIconColor, }: {
6
+ I: Icon;
7
+ appIconColor: string;
8
+ label: string;
9
+ children: ReactNode;
10
+ }) => react_jsx_runtime.JSX.Element;
11
+
12
+ export { NavAccountWidgetItem as default };
@@ -0,0 +1,21 @@
1
+ "use client";
2
+ import "../../chunk-FWCSY2DS.mjs";
3
+ import { jsx, jsxs } from "react/jsx-runtime";
4
+ import clsx from "clsx";
5
+ import { Body } from "../typography/Typography.mjs";
6
+ const NavAccountWidgetItem = ({
7
+ I,
8
+ label,
9
+ children,
10
+ appIconColor
11
+ }) => {
12
+ return /* @__PURE__ */ jsxs("li", { className: clsx("flex items-center justify-start gap-2"), children: [
13
+ /* @__PURE__ */ jsx(I, { size: 24, className: appIconColor }),
14
+ /* @__PURE__ */ jsx(Body, { className: "mr-auto ml-2", children: label }),
15
+ /* @__PURE__ */ jsx("div", { className: "flex items-center justify-center gap-2", children })
16
+ ] });
17
+ };
18
+ var account_widget_item_default = NavAccountWidgetItem;
19
+ export {
20
+ account_widget_item_default as default
21
+ };
@@ -0,0 +1,22 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { ReactNode } from 'react';
3
+ import { UseEnsNameReturnType } from 'wagmi';
4
+ import { GetEnsNameReturnType } from '@wagmi/core';
5
+ import { App } from '../../interface/app.mjs';
6
+ import { Address } from 'viem';
7
+
8
+ interface NavAccountDetailsProps {
9
+ userAddress: Address;
10
+ ensNameResult: UseEnsNameReturnType<GetEnsNameReturnType> | {
11
+ data: string | undefined;
12
+ isLoading: boolean;
13
+ isError: boolean;
14
+ };
15
+ className?: string;
16
+ app: App;
17
+ widgetItems?: ReactNode;
18
+ actionItems?: ReactNode;
19
+ }
20
+ declare const NavAccountDetails: ({ className, userAddress, ensNameResult, app, widgetItems, actionItems, }: NavAccountDetailsProps) => react_jsx_runtime.JSX.Element;
21
+
22
+ export { type NavAccountDetailsProps, NavAccountDetails as default };
@@ -0,0 +1,118 @@
1
+ "use client";
2
+ import "../../chunk-FWCSY2DS.mjs";
3
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
4
+ import {
5
+ ArrowUpRightIcon,
6
+ GraphIcon,
7
+ UserCircleIcon,
8
+ WalletIcon
9
+ } from "@phosphor-icons/react";
10
+ import clsx from "clsx";
11
+ import { Body } from "../typography/Typography.mjs";
12
+ import { truncateAddress } from "../../utils/truncate-address.mjs";
13
+ import { Logo } from "../Logo/index.mjs";
14
+ import LogoutButton from "./log-out.mjs";
15
+ import { appsConfig } from "../../utils/app.mjs";
16
+ import { useBreadBalance } from "../../hooks/use-bread-balance.mjs";
17
+ import NavAccountWidgetItem from "./account-widget-item.mjs";
18
+ import { FormattedDecimalNumber } from "../typography/formatted-dec-num.mjs";
19
+ import { CopyButtonIcon } from "../buttons/index.mjs";
20
+ import { useConnectedUser } from "../connected-user/index.mjs";
21
+ const chainsIcon = {
22
+ 100: "/gnosis_icon.svg"
23
+ };
24
+ const NavAccountDetails = ({
25
+ className,
26
+ userAddress,
27
+ ensNameResult,
28
+ app,
29
+ widgetItems,
30
+ actionItems
31
+ }) => {
32
+ var _a, _b, _c;
33
+ const { BREAD } = useBreadBalance({ address: userAddress });
34
+ const { user } = useConnectedUser();
35
+ const appIconColor = appsConfig[app].text;
36
+ const chain = user.status === "CONNECTED" || user.status === "UNSUPPORTED_CHAIN" ? user.chain : void 0;
37
+ const blockExplorerUrl = (_b = (_a = chain == null ? void 0 : chain.blockExplorers) == null ? void 0 : _a.default.url) != null ? _b : "https://gnosisscan.io";
38
+ const scanLink = `${blockExplorerUrl}/address/`;
39
+ const chainName = (_c = chain == null ? void 0 : chain.name) != null ? _c : "Unknown";
40
+ const chainIcon = chain ? chainsIcon[chain.id] : void 0;
41
+ return /* @__PURE__ */ jsxs(
42
+ "section",
43
+ {
44
+ className: clsx(
45
+ "bg-paper-2 p-5 flex flex-col gap-4 w-full max-w-md",
46
+ className
47
+ ),
48
+ children: [
49
+ /* @__PURE__ */ jsxs(
50
+ NavAccountWidgetItem,
51
+ {
52
+ I: UserCircleIcon,
53
+ appIconColor,
54
+ label: ensNameResult.data || truncateAddress(userAddress || ""),
55
+ children: [
56
+ /* @__PURE__ */ jsx(
57
+ CopyButtonIcon,
58
+ {
59
+ textToCopy: ensNameResult.data || userAddress
60
+ }
61
+ ),
62
+ /* @__PURE__ */ jsx(
63
+ "a",
64
+ {
65
+ href: scanLink + (userAddress || ""),
66
+ className: "text-surface-grey",
67
+ target: "_blank",
68
+ rel: "noopener noreferrer",
69
+ children: /* @__PURE__ */ jsx(ArrowUpRightIcon, { size: 24 })
70
+ }
71
+ )
72
+ ]
73
+ }
74
+ ),
75
+ /* @__PURE__ */ jsx(
76
+ NavAccountWidgetItem,
77
+ {
78
+ I: WalletIcon,
79
+ appIconColor,
80
+ label: "Bread Balance",
81
+ children: /* @__PURE__ */ jsxs(Fragment, { children: [
82
+ /* @__PURE__ */ jsx(Logo, { size: 24 }),
83
+ /* @__PURE__ */ jsx(Body, { children: /* @__PURE__ */ jsx(FormattedDecimalNumber, { value: BREAD }) })
84
+ ] })
85
+ }
86
+ ),
87
+ widgetItems,
88
+ /* @__PURE__ */ jsx(
89
+ NavAccountWidgetItem,
90
+ {
91
+ I: GraphIcon,
92
+ appIconColor,
93
+ label: "Network",
94
+ children: /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-center", children: [
95
+ chainIcon && /* @__PURE__ */ jsx(
96
+ "img",
97
+ {
98
+ src: chainIcon,
99
+ alt: "",
100
+ width: 24,
101
+ height: 24,
102
+ className: "mr-2"
103
+ }
104
+ ),
105
+ /* @__PURE__ */ jsx(Body, { className: "font-bold", children: chainName })
106
+ ] })
107
+ }
108
+ ),
109
+ actionItems,
110
+ /* @__PURE__ */ jsx(LogoutButton, { className: "mt-1" })
111
+ ]
112
+ }
113
+ );
114
+ };
115
+ var account_widget_default = NavAccountDetails;
116
+ export {
117
+ account_widget_default as default
118
+ };
@@ -0,0 +1,11 @@
1
+ export { NavSolidarityApps, NavSolidarityAppsDesktop } from './solidarity-apps.mjs';
2
+ export { Navbar } from './navbar.mjs';
3
+ export { default as NavAccountWidgetItem } from './account-widget-item.mjs';
4
+ import 'react/jsx-runtime';
5
+ import '../../interface/app.mjs';
6
+ import 'react';
7
+ import './account-widget.mjs';
8
+ import 'wagmi';
9
+ import '@wagmi/core';
10
+ import 'viem';
11
+ import '@phosphor-icons/react';
@@ -0,0 +1,10 @@
1
+ import "../../chunk-FWCSY2DS.mjs";
2
+ import { NavSolidarityApps, NavSolidarityAppsDesktop } from "./solidarity-apps.mjs";
3
+ import { Navbar } from "./navbar.mjs";
4
+ import { default as default2 } from "./account-widget-item.mjs";
5
+ export {
6
+ default2 as NavAccountWidgetItem,
7
+ NavSolidarityApps,
8
+ NavSolidarityAppsDesktop,
9
+ Navbar
10
+ };
@@ -0,0 +1,7 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+
3
+ declare const LogoutButton: ({ className }: {
4
+ className?: string;
5
+ }) => react_jsx_runtime.JSX.Element;
6
+
7
+ export { LogoutButton as default };
@@ -0,0 +1,34 @@
1
+ "use client";
2
+ import "../../chunk-FWCSY2DS.mjs";
3
+ import { jsx } from "react/jsx-runtime";
4
+ import { SignOutIcon } from "@phosphor-icons/react";
5
+ import clsx from "clsx";
6
+ import { useDisconnect } from "wagmi";
7
+ import { usePrivy } from "@privy-io/react-auth";
8
+ import LiftedButton from "../LiftedButton/LiftedButton.mjs";
9
+ import { useAuthProvider } from "../../context/lib.mjs";
10
+ const LogoutButton = ({ className }) => {
11
+ const authProvider = useAuthProvider();
12
+ const { disconnect: wagmiDisconnect } = useDisconnect();
13
+ const { logout: privyLogout } = usePrivy();
14
+ const handleLogout = () => {
15
+ if (authProvider === "privy") {
16
+ privyLogout();
17
+ } else {
18
+ wagmiDisconnect();
19
+ }
20
+ };
21
+ return /* @__PURE__ */ jsx("div", { className: clsx("lifted-button-container", className), children: /* @__PURE__ */ jsx(
22
+ LiftedButton,
23
+ {
24
+ preset: "burn",
25
+ rightIcon: /* @__PURE__ */ jsx(SignOutIcon, {}),
26
+ onClick: handleLogout,
27
+ children: "Sign out"
28
+ }
29
+ ) });
30
+ };
31
+ var log_out_default = LogoutButton;
32
+ export {
33
+ log_out_default as default
34
+ };