@breadcoop/ui 1.0.25 → 2.0.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/chunk-FWCSY2DS.mjs +37 -0
- package/dist/components/LiftedButton/LiftedButton.d.mts +29 -0
- package/dist/components/LiftedButton/LiftedButton.mjs +149 -0
- package/dist/components/LiftedButton/LiftedButtonPresets.d.mts +55 -0
- package/dist/components/LiftedButton/LiftedButtonPresets.mjs +85 -0
- package/dist/components/LiftedButton/index.d.mts +2 -0
- package/dist/components/LiftedButton/index.mjs +0 -0
- package/dist/components/Logo/Logo.d.mts +29 -0
- package/dist/components/Logo/Logo.mjs +273 -0
- package/dist/components/Logo/index.d.mts +3 -0
- package/dist/components/Logo/index.mjs +5 -0
- package/dist/components/auth/button-shell.d.mts +5 -0
- package/dist/components/auth/button-shell.mjs +8 -0
- package/dist/components/auth/index.d.mts +5 -0
- package/dist/components/auth/index.mjs +5 -0
- package/dist/components/auth/login-button-general.d.mts +13 -0
- package/dist/components/auth/login-button-general.mjs +80 -0
- package/dist/components/auth/login-button-privy.d.mts +13 -0
- package/dist/components/auth/login-button-privy.mjs +64 -0
- package/dist/components/auth/login-button.d.mts +8 -0
- package/dist/components/auth/login-button.mjs +32 -0
- package/dist/components/buttons/button.d.mts +20 -0
- package/dist/components/buttons/button.mjs +93 -0
- package/dist/components/buttons/copy-icon.d.mts +10 -0
- package/dist/components/buttons/copy-icon.mjs +44 -0
- package/dist/components/buttons/index.d.mts +6 -0
- package/dist/components/buttons/index.mjs +7 -0
- package/dist/components/chip/chip.d.mts +12 -0
- package/dist/components/chip/chip.mjs +34 -0
- package/dist/components/connected-user/context.d.mts +14 -0
- package/dist/components/connected-user/context.mjs +22 -0
- package/dist/components/connected-user/index.d.mts +6 -0
- package/dist/components/connected-user/index.mjs +7 -0
- package/dist/components/connected-user/interface.d.mts +16 -0
- package/dist/components/connected-user/interface.mjs +0 -0
- package/dist/components/connected-user/privy-provider.d.mts +10 -0
- package/dist/components/connected-user/privy-provider.mjs +55 -0
- package/dist/components/connected-user/provider-general.d.mts +10 -0
- package/dist/components/connected-user/provider-general.mjs +38 -0
- package/dist/components/connected-user/provider.d.mts +9 -0
- package/dist/components/connected-user/provider.mjs +15 -0
- package/dist/components/footer/footer.d.mts +11 -0
- package/dist/components/footer/footer.mjs +222 -0
- package/dist/components/loading-icon.d.mts +9 -0
- package/dist/components/loading-icon.mjs +49 -0
- package/dist/components/navbar/account-menu.d.mts +15 -0
- package/dist/components/navbar/account-menu.mjs +48 -0
- package/dist/components/navbar/account-section.d.mts +14 -0
- package/dist/components/navbar/account-section.mjs +68 -0
- package/dist/components/navbar/account-widget-item.d.mts +12 -0
- package/dist/components/navbar/account-widget-item.mjs +21 -0
- package/dist/components/navbar/account-widget.d.mts +22 -0
- package/dist/components/navbar/account-widget.mjs +118 -0
- package/dist/components/navbar/index.d.mts +11 -0
- package/dist/components/navbar/index.mjs +10 -0
- package/dist/components/navbar/log-out.d.mts +7 -0
- package/dist/components/navbar/log-out.mjs +34 -0
- package/dist/components/navbar/navbar-menu.d.mts +12 -0
- package/dist/components/navbar/navbar-menu.mjs +57 -0
- package/dist/components/navbar/navbar.d.mts +25 -0
- package/dist/components/navbar/navbar.mjs +63 -0
- package/dist/components/navbar/solidarity-apps.d.mts +17 -0
- package/dist/components/navbar/solidarity-apps.mjs +167 -0
- package/dist/components/typography/Typography.d.mts +42 -0
- package/dist/components/typography/Typography.mjs +52 -0
- package/dist/components/typography/formatted-dec-num.d.mts +15 -0
- package/dist/components/typography/formatted-dec-num.mjs +40 -0
- package/dist/constansts/links.d.mts +26 -0
- package/dist/constansts/links.mjs +27 -0
- package/dist/constansts/tools.d.mts +23 -0
- package/dist/constansts/tools.mjs +52 -0
- package/dist/context/index.d.mts +5 -0
- package/dist/context/index.mjs +5 -0
- package/dist/context/lib.d.mts +31 -0
- package/dist/context/lib.mjs +33 -0
- package/dist/hooks/index.d.mts +4 -0
- package/dist/hooks/index.mjs +7 -0
- package/dist/hooks/use-auto-connect.d.mts +8 -0
- package/dist/hooks/use-auto-connect.mjs +39 -0
- package/dist/hooks/use-bread-balance.d.mts +13 -0
- package/dist/hooks/use-bread-balance.mjs +32 -0
- package/dist/hooks/use-copy-to-clipboard.d.mts +9 -0
- package/dist/hooks/use-copy-to-clipboard.mjs +26 -0
- package/dist/index.d.mts +33 -306
- package/dist/index.mjs +41 -1
- package/dist/interface/app.d.mts +3 -0
- package/dist/interface/app.mjs +0 -0
- package/dist/tailwind-preset.js +1 -0
- package/dist/theme.css +1 -0
- package/dist/utils/app.d.mts +19 -0
- package/dist/utils/app.mjs +21 -0
- package/dist/utils/cn.d.mts +5 -0
- package/dist/utils/cn.mjs +9 -0
- package/dist/utils/copy-to-clipboard.d.mts +3 -0
- package/dist/utils/copy-to-clipboard.mjs +10 -0
- package/dist/utils/cssValidation.d.mts +7 -0
- package/dist/utils/cssValidation.mjs +44 -0
- package/dist/utils/formatter.d.mts +3 -0
- package/dist/utils/formatter.mjs +13 -0
- package/dist/utils/index.d.mts +3 -0
- package/dist/utils/index.mjs +7 -0
- package/dist/utils/truncate-address.d.mts +3 -0
- package/dist/utils/truncate-address.mjs +5 -0
- package/package.json +10 -11
- package/tailwind-preset.js +1 -0
- package/theme.css +1 -0
- package/dist/index.d.ts +0 -306
- package/dist/index.js +0 -1
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import {
|
|
2
|
+
__objRest,
|
|
3
|
+
__spreadProps,
|
|
4
|
+
__spreadValues
|
|
5
|
+
} from "../../chunk-FWCSY2DS.mjs";
|
|
6
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
import { LoadingIcon } from "../loading-icon.mjs";
|
|
8
|
+
import { cn } from "../../utils/index.mjs";
|
|
9
|
+
const getBaseClassName = (app, variant) => {
|
|
10
|
+
if (variant === "destructive") {
|
|
11
|
+
return "bg-system-red hover:bg-[#BF0A00] active:bg-system-red";
|
|
12
|
+
}
|
|
13
|
+
if (variant === "positive") {
|
|
14
|
+
return "bg-system-green hover:bg-[#2B8F00] active:bg-system-green";
|
|
15
|
+
}
|
|
16
|
+
if (variant === "light") {
|
|
17
|
+
return "bg-paper-main text-surface-ink border-surface-ink hover:bg-paper-2 active:bg-paper-main";
|
|
18
|
+
}
|
|
19
|
+
if (app === "fund") {
|
|
20
|
+
if (variant === "primary") {
|
|
21
|
+
return "bg-core-orange hover:bg-orange-1 active:bg-core-orange";
|
|
22
|
+
}
|
|
23
|
+
return "bg-[#FBDED1] text-core-orange hover:bg-[#FFF1EA] active:bg-[#FBDED1]";
|
|
24
|
+
}
|
|
25
|
+
if (app === "stacks") {
|
|
26
|
+
if (variant === "primary") {
|
|
27
|
+
return "bg-primary-blue hover:bg-blue-2 active:bg-primary-blue";
|
|
28
|
+
}
|
|
29
|
+
return "bg-[#B9D5FF] text-primary-blue hover:bg-[#99C2FF] active:bg-[#B9D5FF]";
|
|
30
|
+
}
|
|
31
|
+
if (variant === "primary") {
|
|
32
|
+
return "bg-primary-jade hover:bg-jade-2 active:bg-primary-jade";
|
|
33
|
+
}
|
|
34
|
+
return "bg-[#CBE9E5] text-primary-jade hover:bg-[#BCD9D5] active:bg-[#CBE9E5]";
|
|
35
|
+
};
|
|
36
|
+
const Button = (_a) => {
|
|
37
|
+
var _b = _a, {
|
|
38
|
+
as,
|
|
39
|
+
app = "fund",
|
|
40
|
+
size,
|
|
41
|
+
variant = "primary",
|
|
42
|
+
rightIcon,
|
|
43
|
+
leftIcon,
|
|
44
|
+
children,
|
|
45
|
+
disabled,
|
|
46
|
+
className,
|
|
47
|
+
isLoading,
|
|
48
|
+
showChildrenWhenLoading,
|
|
49
|
+
withBorder
|
|
50
|
+
} = _b, rest = __objRest(_b, [
|
|
51
|
+
"as",
|
|
52
|
+
"app",
|
|
53
|
+
"size",
|
|
54
|
+
"variant",
|
|
55
|
+
"rightIcon",
|
|
56
|
+
"leftIcon",
|
|
57
|
+
"children",
|
|
58
|
+
"disabled",
|
|
59
|
+
"className",
|
|
60
|
+
"isLoading",
|
|
61
|
+
"showChildrenWhenLoading",
|
|
62
|
+
"withBorder"
|
|
63
|
+
]);
|
|
64
|
+
const Component = as != null ? as : "button";
|
|
65
|
+
return /* @__PURE__ */ jsxs(
|
|
66
|
+
Component,
|
|
67
|
+
__spreadProps(__spreadValues({}, rest), {
|
|
68
|
+
className: cn(
|
|
69
|
+
getBaseClassName(app, variant),
|
|
70
|
+
"flex items-center justify-center gap-2 active:shadow-none disabled:shadow-none disabled:bg-surface-grey disabled:cursor-not-allowed",
|
|
71
|
+
"transition-all duration-200 border disabled:border-transparent",
|
|
72
|
+
variant !== "light" && withBorder && "border-surface-ink",
|
|
73
|
+
variant !== "light" && !withBorder && "border-transparent",
|
|
74
|
+
size === "icon" ? "p-2.5" : size === "sm" ? "py-1 px-4" : "py-4 px-8",
|
|
75
|
+
size === "sm" ? "shadow-[0.125rem_0.125rem_0px_0px_#595959]" : "shadow-[0.25rem_0.25rem_0px_0px_#595959]",
|
|
76
|
+
className
|
|
77
|
+
),
|
|
78
|
+
disabled: disabled || isLoading,
|
|
79
|
+
children: [
|
|
80
|
+
(!isLoading || isLoading && showChildrenWhenLoading) && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
81
|
+
leftIcon,
|
|
82
|
+
children,
|
|
83
|
+
rightIcon
|
|
84
|
+
] }),
|
|
85
|
+
isLoading && /* @__PURE__ */ jsx(LoadingIcon, { app })
|
|
86
|
+
]
|
|
87
|
+
})
|
|
88
|
+
);
|
|
89
|
+
};
|
|
90
|
+
var button_default = Button;
|
|
91
|
+
export {
|
|
92
|
+
button_default as default
|
|
93
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { ButtonHTMLAttributes } from 'react';
|
|
3
|
+
import { UseCopyToClipboardPayload } from '../../hooks/use-copy-to-clipboard.mjs';
|
|
4
|
+
|
|
5
|
+
interface CopyButtonProps extends ButtonHTMLAttributes<HTMLButtonElement>, UseCopyToClipboardPayload {
|
|
6
|
+
checkedIconSize?: number;
|
|
7
|
+
}
|
|
8
|
+
declare const CopyButtonIcon: ({ children, textToCopy, checkedIconSize, ...buttonProps }: CopyButtonProps) => react_jsx_runtime.JSX.Element;
|
|
9
|
+
|
|
10
|
+
export { CopyButtonIcon as default };
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
__objRest,
|
|
4
|
+
__spreadProps,
|
|
5
|
+
__spreadValues
|
|
6
|
+
} from "../../chunk-FWCSY2DS.mjs";
|
|
7
|
+
import { jsx } from "react/jsx-runtime";
|
|
8
|
+
import { CheckIcon, CopyIcon } from "@phosphor-icons/react";
|
|
9
|
+
import {
|
|
10
|
+
useCopyToClipboard
|
|
11
|
+
} from "../../hooks/use-copy-to-clipboard.mjs";
|
|
12
|
+
import { cn } from "../../utils/index.mjs";
|
|
13
|
+
import { useBreadUIKitContext } from "../../context/lib.mjs";
|
|
14
|
+
import { appsConfig } from "../../utils/app.mjs";
|
|
15
|
+
const CopyButtonIcon = (_a) => {
|
|
16
|
+
var _b = _a, {
|
|
17
|
+
children,
|
|
18
|
+
textToCopy,
|
|
19
|
+
checkedIconSize = 24
|
|
20
|
+
} = _b, buttonProps = __objRest(_b, [
|
|
21
|
+
"children",
|
|
22
|
+
"textToCopy",
|
|
23
|
+
"checkedIconSize"
|
|
24
|
+
]);
|
|
25
|
+
const { copied, copy } = useCopyToClipboard({
|
|
26
|
+
textToCopy
|
|
27
|
+
});
|
|
28
|
+
const app = useBreadUIKitContext().app;
|
|
29
|
+
return /* @__PURE__ */ jsx(
|
|
30
|
+
"button",
|
|
31
|
+
__spreadProps(__spreadValues({}, buttonProps), {
|
|
32
|
+
onClick: copy,
|
|
33
|
+
className: cn(
|
|
34
|
+
buttonProps.className,
|
|
35
|
+
copied ? "text-system-green!" : appsConfig[app].text
|
|
36
|
+
),
|
|
37
|
+
children: copied ? /* @__PURE__ */ jsx(CheckIcon, { size: checkedIconSize, className: "" }) : /* @__PURE__ */ jsx(CopyIcon, { size: 24, className: "fill-current" })
|
|
38
|
+
})
|
|
39
|
+
);
|
|
40
|
+
};
|
|
41
|
+
var copy_icon_default = CopyButtonIcon;
|
|
42
|
+
export {
|
|
43
|
+
copy_icon_default as default
|
|
44
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
|
|
4
|
+
interface ChipProps {
|
|
5
|
+
size?: "small" | "regular";
|
|
6
|
+
children: ReactNode;
|
|
7
|
+
icon?: boolean;
|
|
8
|
+
className?: string;
|
|
9
|
+
}
|
|
10
|
+
declare const Chip: ({ size, icon, className, children, }: ChipProps) => react_jsx_runtime.JSX.Element;
|
|
11
|
+
|
|
12
|
+
export { Chip as default };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import "../../chunk-FWCSY2DS.mjs";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
const Chip = ({
|
|
4
|
+
size = "small",
|
|
5
|
+
icon,
|
|
6
|
+
className = "",
|
|
7
|
+
children
|
|
8
|
+
}) => {
|
|
9
|
+
let extraClass = "";
|
|
10
|
+
if (size === "small") {
|
|
11
|
+
if (icon) {
|
|
12
|
+
extraClass = "p-2";
|
|
13
|
+
} else {
|
|
14
|
+
extraClass = "py-1 px-4";
|
|
15
|
+
}
|
|
16
|
+
} else {
|
|
17
|
+
if (icon) {
|
|
18
|
+
extraClass = "p-3";
|
|
19
|
+
} else {
|
|
20
|
+
extraClass = "py-3 px-6";
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
return /* @__PURE__ */ jsx(
|
|
24
|
+
"div",
|
|
25
|
+
{
|
|
26
|
+
className: `border border-surface-ink hover:border-[#EA5817] disabled:border-surface-grey disabled:border-2 flex items-center justify-center gap-2.5 bg-paper-main ${extraClass} ${className}`,
|
|
27
|
+
children
|
|
28
|
+
}
|
|
29
|
+
);
|
|
30
|
+
};
|
|
31
|
+
var chip_default = Chip;
|
|
32
|
+
export {
|
|
33
|
+
chip_default as default
|
|
34
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { TConnectedUserState } from './interface.mjs';
|
|
3
|
+
import 'viem';
|
|
4
|
+
|
|
5
|
+
declare const ConnectedUserContext: React.Context<{
|
|
6
|
+
user: TConnectedUserState;
|
|
7
|
+
isSafe: boolean;
|
|
8
|
+
}>;
|
|
9
|
+
declare const useConnectedUser: () => {
|
|
10
|
+
user: TConnectedUserState;
|
|
11
|
+
isSafe: boolean;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export { ConnectedUserContext, useConnectedUser };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import "../../chunk-FWCSY2DS.mjs";
|
|
3
|
+
import { createContext, useContext } from "react";
|
|
4
|
+
const ConnectedUserContext = createContext({
|
|
5
|
+
user: {
|
|
6
|
+
status: "LOADING"
|
|
7
|
+
},
|
|
8
|
+
isSafe: false
|
|
9
|
+
});
|
|
10
|
+
const useConnectedUser = () => {
|
|
11
|
+
const context = useContext(ConnectedUserContext);
|
|
12
|
+
if (context === void 0) {
|
|
13
|
+
throw new Error(
|
|
14
|
+
"useConnectedUser must be used within a ConnectedUserProvider"
|
|
15
|
+
);
|
|
16
|
+
}
|
|
17
|
+
return context;
|
|
18
|
+
};
|
|
19
|
+
export {
|
|
20
|
+
ConnectedUserContext,
|
|
21
|
+
useConnectedUser
|
|
22
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { useConnectedUser } from './context.mjs';
|
|
2
|
+
export { ConnectedUserProvider } from './provider.mjs';
|
|
3
|
+
export { TConnectedUserState, TUserConnected, TUserLoading, TUserNotConnected } from './interface.mjs';
|
|
4
|
+
import 'react';
|
|
5
|
+
import 'react/jsx-runtime';
|
|
6
|
+
import 'viem';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Hex, Chain } from 'viem';
|
|
2
|
+
|
|
3
|
+
type TUserLoading = {
|
|
4
|
+
status: "LOADING";
|
|
5
|
+
};
|
|
6
|
+
type TUserNotConnected = {
|
|
7
|
+
status: "NOT_CONNECTED";
|
|
8
|
+
};
|
|
9
|
+
type TUserConnected = {
|
|
10
|
+
status: "CONNECTED" | "UNSUPPORTED_CHAIN";
|
|
11
|
+
address: Hex;
|
|
12
|
+
chain: Chain;
|
|
13
|
+
};
|
|
14
|
+
type TConnectedUserState = TUserLoading | TUserNotConnected | TUserConnected;
|
|
15
|
+
|
|
16
|
+
export type { TConnectedUserState, TUserConnected, TUserLoading, TUserNotConnected };
|
|
File without changes
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
|
|
4
|
+
interface IConnectedUserProviderPrivyProps {
|
|
5
|
+
children: ReactNode;
|
|
6
|
+
chainId: number;
|
|
7
|
+
}
|
|
8
|
+
declare function ConnectedUserProviderPrivy({ chainId, children, }: IConnectedUserProviderPrivyProps): react_jsx_runtime.JSX.Element;
|
|
9
|
+
|
|
10
|
+
export { ConnectedUserProviderPrivy };
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import "../../chunk-FWCSY2DS.mjs";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
import { useMemo } from "react";
|
|
5
|
+
import { useChains } from "wagmi";
|
|
6
|
+
import { usePrivy, useWallets } from "@privy-io/react-auth";
|
|
7
|
+
import { ConnectedUserContext } from "./context.mjs";
|
|
8
|
+
function ConnectedUserProviderPrivy({
|
|
9
|
+
chainId,
|
|
10
|
+
children
|
|
11
|
+
}) {
|
|
12
|
+
const { ready, authenticated } = usePrivy();
|
|
13
|
+
const { wallets } = useWallets();
|
|
14
|
+
const configuredChains = useChains();
|
|
15
|
+
const defaultChain = useMemo(
|
|
16
|
+
() => {
|
|
17
|
+
var _a;
|
|
18
|
+
return (_a = configuredChains.find((c) => c.id === chainId)) != null ? _a : configuredChains[0];
|
|
19
|
+
},
|
|
20
|
+
[configuredChains, chainId]
|
|
21
|
+
);
|
|
22
|
+
const embeddedWallet = useMemo(() => {
|
|
23
|
+
return wallets.find(
|
|
24
|
+
(wallet) => {
|
|
25
|
+
var _a;
|
|
26
|
+
return wallet.walletClientType === "privy" || wallet.walletClientType === "embedded_wallet" || ((_a = wallet.walletClientType) == null ? void 0 : _a.includes("embedded"));
|
|
27
|
+
}
|
|
28
|
+
);
|
|
29
|
+
}, [wallets]);
|
|
30
|
+
const user = useMemo(() => {
|
|
31
|
+
var _a;
|
|
32
|
+
if (!ready) return { status: "LOADING" };
|
|
33
|
+
if (!authenticated || !(embeddedWallet == null ? void 0 : embeddedWallet.address)) {
|
|
34
|
+
return { status: "NOT_CONNECTED" };
|
|
35
|
+
}
|
|
36
|
+
const address = embeddedWallet.address;
|
|
37
|
+
const walletChainId = embeddedWallet.chainId;
|
|
38
|
+
const parsedChainId = walletChainId ? parseInt(walletChainId.split(":")[1]) : void 0;
|
|
39
|
+
const _status = parsedChainId === chainId ? "CONNECTED" : "UNSUPPORTED_CHAIN";
|
|
40
|
+
const chain = (_a = configuredChains.find((c) => c.id === parsedChainId)) != null ? _a : defaultChain;
|
|
41
|
+
return {
|
|
42
|
+
status: _status,
|
|
43
|
+
address,
|
|
44
|
+
chain
|
|
45
|
+
};
|
|
46
|
+
}, [ready, authenticated, embeddedWallet, chainId, configuredChains, defaultChain]);
|
|
47
|
+
const isSafe = useMemo(() => {
|
|
48
|
+
return (embeddedWallet == null ? void 0 : embeddedWallet.walletClientType) === "safe" || false;
|
|
49
|
+
}, [embeddedWallet]);
|
|
50
|
+
const value = useMemo(() => ({ user, isSafe }), [user, isSafe]);
|
|
51
|
+
return /* @__PURE__ */ jsx(ConnectedUserContext.Provider, { value, children });
|
|
52
|
+
}
|
|
53
|
+
export {
|
|
54
|
+
ConnectedUserProviderPrivy
|
|
55
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
|
|
4
|
+
interface IConnectedUserProviderGeneralProps {
|
|
5
|
+
children: ReactNode;
|
|
6
|
+
chainId: number;
|
|
7
|
+
}
|
|
8
|
+
declare function ConnectedUserProviderGeneral({ chainId, children }: IConnectedUserProviderGeneralProps): react_jsx_runtime.JSX.Element;
|
|
9
|
+
|
|
10
|
+
export { ConnectedUserProviderGeneral };
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import "../../chunk-FWCSY2DS.mjs";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
import { useMemo } from "react";
|
|
5
|
+
import { useAccount, useChains } from "wagmi";
|
|
6
|
+
import { useAutoConnect } from "../../hooks/use-auto-connect.mjs";
|
|
7
|
+
import { ConnectedUserContext } from "./context.mjs";
|
|
8
|
+
function ConnectedUserProviderGeneral({ chainId, children }) {
|
|
9
|
+
const { isConnected, connector, address, status, chain } = useAccount();
|
|
10
|
+
const { isSafe } = useAutoConnect(connector);
|
|
11
|
+
const configuredChains = useChains();
|
|
12
|
+
const defaultChain = useMemo(
|
|
13
|
+
() => {
|
|
14
|
+
var _a;
|
|
15
|
+
return (_a = configuredChains.find((c) => c.id === chainId)) != null ? _a : configuredChains[0];
|
|
16
|
+
},
|
|
17
|
+
[configuredChains, chainId]
|
|
18
|
+
);
|
|
19
|
+
const user = useMemo(() => {
|
|
20
|
+
if (status === "connecting" && !address) {
|
|
21
|
+
return { status: "LOADING" };
|
|
22
|
+
}
|
|
23
|
+
if (status === "disconnected" || !isConnected || !address) {
|
|
24
|
+
return { status: "NOT_CONNECTED" };
|
|
25
|
+
}
|
|
26
|
+
const _status = (chain == null ? void 0 : chain.id) === chainId ? "CONNECTED" : "UNSUPPORTED_CHAIN";
|
|
27
|
+
return {
|
|
28
|
+
status: _status,
|
|
29
|
+
address,
|
|
30
|
+
chain: chain != null ? chain : defaultChain
|
|
31
|
+
};
|
|
32
|
+
}, [isConnected, address, chain, status, chainId, defaultChain]);
|
|
33
|
+
const value = useMemo(() => ({ user, isSafe }), [user, isSafe]);
|
|
34
|
+
return /* @__PURE__ */ jsx(ConnectedUserContext.Provider, { value, children });
|
|
35
|
+
}
|
|
36
|
+
export {
|
|
37
|
+
ConnectedUserProviderGeneral
|
|
38
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
|
|
4
|
+
interface IConnectedUserProviderProps {
|
|
5
|
+
children: ReactNode;
|
|
6
|
+
}
|
|
7
|
+
declare function ConnectedUserProvider({ children }: IConnectedUserProviderProps): react_jsx_runtime.JSX.Element;
|
|
8
|
+
|
|
9
|
+
export { ConnectedUserProvider };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import "../../chunk-FWCSY2DS.mjs";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
import { useAuthProvider, useBreadUIKitContext } from "../../context/lib.mjs";
|
|
5
|
+
import { ConnectedUserProviderPrivy } from "./privy-provider.mjs";
|
|
6
|
+
import { ConnectedUserProviderGeneral } from "./provider-general.mjs";
|
|
7
|
+
function ConnectedUserProvider({ children }) {
|
|
8
|
+
const authProvider = useAuthProvider();
|
|
9
|
+
const { chainId } = useBreadUIKitContext();
|
|
10
|
+
const Provider = authProvider === "privy" ? ConnectedUserProviderPrivy : ConnectedUserProviderGeneral;
|
|
11
|
+
return /* @__PURE__ */ jsx(Provider, { chainId, children });
|
|
12
|
+
}
|
|
13
|
+
export {
|
|
14
|
+
ConnectedUserProvider
|
|
15
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
|
|
3
|
+
interface FooterProps {
|
|
4
|
+
className?: string;
|
|
5
|
+
topClassName?: string;
|
|
6
|
+
infoClassName?: string;
|
|
7
|
+
mode?: "colored" | "transparent";
|
|
8
|
+
}
|
|
9
|
+
declare function Footer({ className, topClassName, infoClassName, mode, }: FooterProps): react_jsx_runtime.JSX.Element;
|
|
10
|
+
|
|
11
|
+
export { Footer as default };
|
|
@@ -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
|
+
};
|