@loafmarkets/ui 0.1.326 → 0.1.328
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +25 -24
- package/dist/index.d.ts +25 -24
- package/dist/index.js +201 -201
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +201 -201
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -2920,7 +2920,7 @@ var PropertyNewsUpdates = React5.forwardRef(
|
|
|
2920
2920
|
/* @__PURE__ */ jsx(
|
|
2921
2921
|
"div",
|
|
2922
2922
|
{
|
|
2923
|
-
className: cn("flex flex-1 flex-col overflow-hidden", isHomeVariant ? "mt-2 gap-0" : "mt-4 gap-3"),
|
|
2923
|
+
className: cn("flex flex-1 flex-col overflow-y-auto overflow-x-hidden", isHomeVariant ? "mt-2 gap-0" : "mt-4 gap-3"),
|
|
2924
2924
|
style: !isPurchaseVariant && !isHomeVariant ? { minHeight: `${ITEMS_PER_PAGE * 86}px` } : void 0,
|
|
2925
2925
|
children: isPurchaseVariant ? purchaseItems.length > 0 ? purchaseItems.slice(0, 7).map((purchase, index) => {
|
|
2926
2926
|
const maxAmount = 6e4;
|
|
@@ -11567,192 +11567,6 @@ var SignInButton = styled9.button`
|
|
|
11567
11567
|
background: rgba(240, 185, 11, 0.1);
|
|
11568
11568
|
}
|
|
11569
11569
|
`;
|
|
11570
|
-
var slideIn = keyframes`
|
|
11571
|
-
from { transform: translateX(110%); opacity: 0; }
|
|
11572
|
-
to { transform: translateX(0); opacity: 1; }
|
|
11573
|
-
`;
|
|
11574
|
-
var slideOut = keyframes`
|
|
11575
|
-
from { transform: translateX(0); opacity: 1; }
|
|
11576
|
-
to { transform: translateX(110%); opacity: 0; }
|
|
11577
|
-
`;
|
|
11578
|
-
var progressShrink = keyframes`
|
|
11579
|
-
from { width: 100%; }
|
|
11580
|
-
to { width: 0%; }
|
|
11581
|
-
`;
|
|
11582
|
-
var VARIANT_COLORS = {
|
|
11583
|
-
success: { accent: "#0ecb81", icon: "\u2713" },
|
|
11584
|
-
error: { accent: "#f6465d", icon: "\u2715" },
|
|
11585
|
-
sell: { accent: "#f6465d", icon: "\u2713" },
|
|
11586
|
-
info: { accent: "#E6C656", icon: "\u2139" },
|
|
11587
|
-
pending: { accent: "#7EB3E6", icon: "\u25CC" }
|
|
11588
|
-
};
|
|
11589
|
-
var Wrapper2 = styled9.div`
|
|
11590
|
-
position: relative;
|
|
11591
|
-
display: flex;
|
|
11592
|
-
flex-direction: column;
|
|
11593
|
-
gap: 0;
|
|
11594
|
-
width: 340px;
|
|
11595
|
-
background: #0d0f1a;
|
|
11596
|
-
border: 1px solid rgba(255, 255, 255, 0.08);
|
|
11597
|
-
border-radius: 10px;
|
|
11598
|
-
overflow: hidden;
|
|
11599
|
-
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04);
|
|
11600
|
-
animation: ${({ $exiting }) => $exiting ? css`${slideOut} 0.28s cubic-bezier(0.4,0,1,1) forwards` : css`${slideIn} 0.32s cubic-bezier(0,0,0.2,1) forwards`};
|
|
11601
|
-
pointer-events: all;
|
|
11602
|
-
`;
|
|
11603
|
-
var Body = styled9.div`
|
|
11604
|
-
display: flex;
|
|
11605
|
-
align-items: flex-start;
|
|
11606
|
-
gap: 12px;
|
|
11607
|
-
padding: 14px 16px 12px;
|
|
11608
|
-
`;
|
|
11609
|
-
var IconDot = styled9.div`
|
|
11610
|
-
flex-shrink: 0;
|
|
11611
|
-
width: 28px;
|
|
11612
|
-
height: 28px;
|
|
11613
|
-
border-radius: 50%;
|
|
11614
|
-
background: ${({ $color }) => $color}1a;
|
|
11615
|
-
border: 1px solid ${({ $color }) => $color}55;
|
|
11616
|
-
display: flex;
|
|
11617
|
-
align-items: center;
|
|
11618
|
-
justify-content: center;
|
|
11619
|
-
font-size: 0.75rem;
|
|
11620
|
-
font-weight: 700;
|
|
11621
|
-
color: ${({ $color }) => $color};
|
|
11622
|
-
margin-top: 1px;
|
|
11623
|
-
`;
|
|
11624
|
-
var Content = styled9.div`
|
|
11625
|
-
flex: 1;
|
|
11626
|
-
min-width: 0;
|
|
11627
|
-
`;
|
|
11628
|
-
var Title2 = styled9.p`
|
|
11629
|
-
margin: 0 0 2px;
|
|
11630
|
-
font-size: 0.8rem;
|
|
11631
|
-
font-weight: 600;
|
|
11632
|
-
color: #fff;
|
|
11633
|
-
letter-spacing: 0.01em;
|
|
11634
|
-
`;
|
|
11635
|
-
var Amount = styled9.p`
|
|
11636
|
-
margin: 0 0 6px;
|
|
11637
|
-
font-size: 1.05rem;
|
|
11638
|
-
font-weight: 700;
|
|
11639
|
-
color: #E6C656;
|
|
11640
|
-
letter-spacing: -0.01em;
|
|
11641
|
-
`;
|
|
11642
|
-
var TxRow = styled9.a`
|
|
11643
|
-
display: inline-flex;
|
|
11644
|
-
align-items: center;
|
|
11645
|
-
gap: 5px;
|
|
11646
|
-
font-family: 'IBM Plex Mono', 'Space Mono', monospace;
|
|
11647
|
-
font-size: 0.68rem;
|
|
11648
|
-
color: rgba(255, 255, 255, 0.4);
|
|
11649
|
-
text-decoration: none;
|
|
11650
|
-
transition: color 0.15s;
|
|
11651
|
-
&:hover {
|
|
11652
|
-
color: #7EB3E6;
|
|
11653
|
-
}
|
|
11654
|
-
`;
|
|
11655
|
-
var TxArrow = styled9.span`
|
|
11656
|
-
font-size: 0.6rem;
|
|
11657
|
-
opacity: 0.6;
|
|
11658
|
-
`;
|
|
11659
|
-
var CloseBtn = styled9.button`
|
|
11660
|
-
flex-shrink: 0;
|
|
11661
|
-
background: none;
|
|
11662
|
-
border: none;
|
|
11663
|
-
padding: 2px 4px;
|
|
11664
|
-
cursor: pointer;
|
|
11665
|
-
color: rgba(255, 255, 255, 0.25);
|
|
11666
|
-
font-size: 0.9rem;
|
|
11667
|
-
line-height: 1;
|
|
11668
|
-
transition: color 0.15s;
|
|
11669
|
-
&:hover { color: rgba(255, 255, 255, 0.7); }
|
|
11670
|
-
`;
|
|
11671
|
-
var ProgressBar = styled9.div`
|
|
11672
|
-
height: 2px;
|
|
11673
|
-
background: rgba(255, 255, 255, 0.06);
|
|
11674
|
-
position: relative;
|
|
11675
|
-
&::after {
|
|
11676
|
-
content: '';
|
|
11677
|
-
position: absolute;
|
|
11678
|
-
left: 0;
|
|
11679
|
-
top: 0;
|
|
11680
|
-
height: 100%;
|
|
11681
|
-
background: ${({ $color }) => $color};
|
|
11682
|
-
animation: ${css`${progressShrink} ${({ $duration }) => $duration}ms linear forwards`};
|
|
11683
|
-
}
|
|
11684
|
-
`;
|
|
11685
|
-
var Container = styled9.div`
|
|
11686
|
-
position: fixed;
|
|
11687
|
-
bottom: 24px;
|
|
11688
|
-
right: 24px;
|
|
11689
|
-
z-index: 9999;
|
|
11690
|
-
display: flex;
|
|
11691
|
-
flex-direction: column-reverse;
|
|
11692
|
-
gap: 10px;
|
|
11693
|
-
pointer-events: none;
|
|
11694
|
-
`;
|
|
11695
|
-
var DEFAULT_EXPLORER = "https://sepolia.basescan.org/tx/";
|
|
11696
|
-
function truncateHash(hash) {
|
|
11697
|
-
return `${hash.slice(0, 6)}\u2026${hash.slice(-4)}`;
|
|
11698
|
-
}
|
|
11699
|
-
function ToastItem({ toast, onDismiss }) {
|
|
11700
|
-
const [exiting, setExiting] = useState(false);
|
|
11701
|
-
const timerRef = useRef(null);
|
|
11702
|
-
const dismiss = useCallback(() => {
|
|
11703
|
-
setExiting(true);
|
|
11704
|
-
setTimeout(() => onDismiss(toast.id), 280);
|
|
11705
|
-
}, [onDismiss, toast.id]);
|
|
11706
|
-
useEffect(() => {
|
|
11707
|
-
const duration2 = toast.duration ?? 6e3;
|
|
11708
|
-
if (duration2 > 0) {
|
|
11709
|
-
timerRef.current = setTimeout(dismiss, duration2);
|
|
11710
|
-
}
|
|
11711
|
-
return () => {
|
|
11712
|
-
if (timerRef.current) clearTimeout(timerRef.current);
|
|
11713
|
-
};
|
|
11714
|
-
}, [dismiss, toast.duration]);
|
|
11715
|
-
const { accent, icon } = VARIANT_COLORS[toast.variant];
|
|
11716
|
-
const duration = toast.duration ?? 6e3;
|
|
11717
|
-
const explorerBase = toast.explorerUrl ?? DEFAULT_EXPLORER;
|
|
11718
|
-
const txUrl = toast.txHash ? `${explorerBase}${toast.txHash}` : void 0;
|
|
11719
|
-
return /* @__PURE__ */ jsxs(Wrapper2, { $exiting: exiting, children: [
|
|
11720
|
-
/* @__PURE__ */ jsxs(Body, { children: [
|
|
11721
|
-
/* @__PURE__ */ jsx(IconDot, { $color: accent, children: icon }),
|
|
11722
|
-
/* @__PURE__ */ jsxs(Content, { children: [
|
|
11723
|
-
/* @__PURE__ */ jsx(Title2, { children: toast.title }),
|
|
11724
|
-
toast.amount && /* @__PURE__ */ jsx(Amount, { children: toast.amount }),
|
|
11725
|
-
toast.txHash && txUrl && /* @__PURE__ */ jsxs(TxRow, { href: txUrl, target: "_blank", rel: "noopener noreferrer", children: [
|
|
11726
|
-
truncateHash(toast.txHash),
|
|
11727
|
-
/* @__PURE__ */ jsx(TxArrow, { children: "\u2197" })
|
|
11728
|
-
] })
|
|
11729
|
-
] }),
|
|
11730
|
-
/* @__PURE__ */ jsx(CloseBtn, { type: "button", onClick: dismiss, "aria-label": "Dismiss", children: "\u2715" })
|
|
11731
|
-
] }),
|
|
11732
|
-
duration > 0 && /* @__PURE__ */ jsx(ProgressBar, { $color: accent, $duration: duration })
|
|
11733
|
-
] });
|
|
11734
|
-
}
|
|
11735
|
-
var ToastContext = createContext(null);
|
|
11736
|
-
function ToastProvider({ children }) {
|
|
11737
|
-
const [toasts, setToasts] = useState([]);
|
|
11738
|
-
const addToast = useCallback((data) => {
|
|
11739
|
-
const id = `toast-${Date.now()}-${Math.random().toString(36).slice(2, 7)}`;
|
|
11740
|
-
setToasts((prev) => [...prev, { ...data, id }]);
|
|
11741
|
-
return id;
|
|
11742
|
-
}, []);
|
|
11743
|
-
const dismiss = useCallback((id) => {
|
|
11744
|
-
setToasts((prev) => prev.filter((t) => t.id !== id));
|
|
11745
|
-
}, []);
|
|
11746
|
-
return /* @__PURE__ */ jsxs(ToastContext.Provider, { value: { toast: addToast, dismiss }, children: [
|
|
11747
|
-
children,
|
|
11748
|
-
/* @__PURE__ */ jsx(Container, { children: toasts.map((t) => /* @__PURE__ */ jsx(ToastItem, { toast: t, onDismiss: dismiss }, t.id)) })
|
|
11749
|
-
] });
|
|
11750
|
-
}
|
|
11751
|
-
function useToast() {
|
|
11752
|
-
const ctx = useContext(ToastContext);
|
|
11753
|
-
if (!ctx) throw new Error("useToast must be used within a ToastProvider");
|
|
11754
|
-
return ctx;
|
|
11755
|
-
}
|
|
11756
11570
|
function AssetSelectorBar({
|
|
11757
11571
|
propertyName,
|
|
11758
11572
|
tokenPrice,
|
|
@@ -12040,11 +11854,11 @@ var IPOOptionLocation = styled9.div`
|
|
|
12040
11854
|
font-weight: 500;
|
|
12041
11855
|
}
|
|
12042
11856
|
`;
|
|
12043
|
-
var
|
|
11857
|
+
var slideOut = keyframes`
|
|
12044
11858
|
0% { transform: translateY(0); opacity: 1; }
|
|
12045
11859
|
100% { transform: translateY(100%); opacity: 0; }
|
|
12046
11860
|
`;
|
|
12047
|
-
var
|
|
11861
|
+
var slideIn = keyframes`
|
|
12048
11862
|
0% { transform: translateY(-100%); opacity: 0; }
|
|
12049
11863
|
100% { transform: translateY(0); opacity: 1; }
|
|
12050
11864
|
`;
|
|
@@ -12057,13 +11871,13 @@ var SlideWrap = styled9.span`
|
|
|
12057
11871
|
`;
|
|
12058
11872
|
var SlideNew = styled9.span`
|
|
12059
11873
|
display: inline-block;
|
|
12060
|
-
animation: ${(props) => props.$animate ?
|
|
11874
|
+
animation: ${(props) => props.$animate ? slideIn : "none"} 0.35s cubic-bezier(0.4, 0, 0.2, 1) forwards;
|
|
12061
11875
|
`;
|
|
12062
11876
|
var SlideOld = styled9.span`
|
|
12063
11877
|
position: absolute;
|
|
12064
11878
|
top: 0;
|
|
12065
11879
|
left: 0;
|
|
12066
|
-
animation: ${
|
|
11880
|
+
animation: ${slideOut} 0.35s cubic-bezier(0.4, 0, 0.2, 1) forwards;
|
|
12067
11881
|
`;
|
|
12068
11882
|
function SlideDigit({ value }) {
|
|
12069
11883
|
const prevRef = useRef(value);
|
|
@@ -12155,7 +11969,7 @@ function OfferingProgressCard({
|
|
|
12155
11969
|
}
|
|
12156
11970
|
if (variant === "home") {
|
|
12157
11971
|
const isPreLive = !ipoStarted && ipoStatus !== "CLOSED" && ipoStatus !== "CANCELLED";
|
|
12158
|
-
return /* @__PURE__ */ jsxs(
|
|
11972
|
+
return /* @__PURE__ */ jsxs(Container, { style, className, children: [
|
|
12159
11973
|
/* @__PURE__ */ jsxs(Header2, { children: [
|
|
12160
11974
|
/* @__PURE__ */ jsxs("h3", { children: [
|
|
12161
11975
|
/* @__PURE__ */ jsx(FaChartLine, {}),
|
|
@@ -12237,7 +12051,7 @@ function OfferingProgressCard({
|
|
|
12237
12051
|
] })
|
|
12238
12052
|
] });
|
|
12239
12053
|
}
|
|
12240
|
-
return /* @__PURE__ */ jsxs(
|
|
12054
|
+
return /* @__PURE__ */ jsxs(Container, { style, className, children: [
|
|
12241
12055
|
/* @__PURE__ */ jsxs(Header2, { children: [
|
|
12242
12056
|
/* @__PURE__ */ jsxs("h3", { children: [
|
|
12243
12057
|
/* @__PURE__ */ jsx(FaChartLine, {}),
|
|
@@ -12338,7 +12152,7 @@ function OfferingProgressCard({
|
|
|
12338
12152
|
] })
|
|
12339
12153
|
] });
|
|
12340
12154
|
}
|
|
12341
|
-
var
|
|
12155
|
+
var Container = styled9.div`
|
|
12342
12156
|
background-color: var(--color-card-darker, #111);
|
|
12343
12157
|
border-radius: 8px;
|
|
12344
12158
|
padding: 1.5rem;
|
|
@@ -14140,7 +13954,7 @@ function PortfolioActivityPanel({
|
|
|
14140
13954
|
const handleTabChange = (tab) => {
|
|
14141
13955
|
setActiveTab(tab);
|
|
14142
13956
|
};
|
|
14143
|
-
return /* @__PURE__ */ jsxs(
|
|
13957
|
+
return /* @__PURE__ */ jsxs(Container2, { className, style, children: [
|
|
14144
13958
|
/* @__PURE__ */ jsx(PanelTitle, { children: "Activity" }),
|
|
14145
13959
|
/* @__PURE__ */ jsxs(TabContainer, { children: [
|
|
14146
13960
|
showPositionsTab && /* @__PURE__ */ jsxs(Tab, { $active: activeTab === "positions", onClick: () => handleTabChange("positions"), children: [
|
|
@@ -14323,11 +14137,11 @@ function PortfolioActivityPanel({
|
|
|
14323
14137
|
] })
|
|
14324
14138
|
] }),
|
|
14325
14139
|
onClosePosition && /* @__PURE__ */ jsx(PositionsCell, { children: /* @__PURE__ */ jsxs(CloseActions, { children: [
|
|
14326
|
-
/* @__PURE__ */ jsx(
|
|
14140
|
+
/* @__PURE__ */ jsx(CloseBtn, { onClick: (e) => {
|
|
14327
14141
|
e.stopPropagation();
|
|
14328
14142
|
onClosePosition(pos.tokenName, "market", pos.quantity, pos.marketPrice);
|
|
14329
14143
|
}, children: "Market Sell" }),
|
|
14330
|
-
/* @__PURE__ */ jsx(
|
|
14144
|
+
/* @__PURE__ */ jsx(CloseBtn, { onClick: (e) => {
|
|
14331
14145
|
e.stopPropagation();
|
|
14332
14146
|
onClosePosition(pos.tokenName, "limit", pos.quantity, pos.marketPrice);
|
|
14333
14147
|
}, children: "Limit Sell" })
|
|
@@ -14564,7 +14378,7 @@ function PortfolioActivityPanel({
|
|
|
14564
14378
|
] }) })
|
|
14565
14379
|
] });
|
|
14566
14380
|
}
|
|
14567
|
-
var
|
|
14381
|
+
var Container2 = styled9.div`
|
|
14568
14382
|
display: flex;
|
|
14569
14383
|
flex-direction: column;
|
|
14570
14384
|
overflow: hidden;
|
|
@@ -14988,7 +14802,7 @@ var CloseActions = styled9.div`
|
|
|
14988
14802
|
gap: 0.35rem;
|
|
14989
14803
|
align-items: center;
|
|
14990
14804
|
`;
|
|
14991
|
-
var
|
|
14805
|
+
var CloseBtn = styled9.button`
|
|
14992
14806
|
background: transparent;
|
|
14993
14807
|
border: 1px solid rgba(230, 200, 126, 0.25);
|
|
14994
14808
|
border-radius: 4px;
|
|
@@ -15342,9 +15156,9 @@ function PropertyBuy({
|
|
|
15342
15156
|
onVerifyIdentity,
|
|
15343
15157
|
portfolioActivity,
|
|
15344
15158
|
newsItems = [],
|
|
15345
|
-
newsConnectionStatus
|
|
15159
|
+
newsConnectionStatus,
|
|
15160
|
+
toast
|
|
15346
15161
|
}) {
|
|
15347
|
-
const { toast } = useToast();
|
|
15348
15162
|
const [sliderValue, setSliderValue] = useState(0);
|
|
15349
15163
|
const [availableBalance, setAvailableBalance] = useState(walletUsdcBalance ?? 0);
|
|
15350
15164
|
const [manualOrderAmount, setManualOrderAmount] = useState(null);
|
|
@@ -18244,6 +18058,192 @@ function GalleryContent({ galleryImages, startIndex, title, subtitle, onClose })
|
|
|
18244
18058
|
}
|
|
18245
18059
|
);
|
|
18246
18060
|
}
|
|
18061
|
+
var slideIn2 = keyframes`
|
|
18062
|
+
from { transform: translateX(110%); opacity: 0; }
|
|
18063
|
+
to { transform: translateX(0); opacity: 1; }
|
|
18064
|
+
`;
|
|
18065
|
+
var slideOut2 = keyframes`
|
|
18066
|
+
from { transform: translateX(0); opacity: 1; }
|
|
18067
|
+
to { transform: translateX(110%); opacity: 0; }
|
|
18068
|
+
`;
|
|
18069
|
+
var progressShrink = keyframes`
|
|
18070
|
+
from { width: 100%; }
|
|
18071
|
+
to { width: 0%; }
|
|
18072
|
+
`;
|
|
18073
|
+
var VARIANT_COLORS = {
|
|
18074
|
+
success: { accent: "#0ecb81", icon: "\u2713" },
|
|
18075
|
+
error: { accent: "#f6465d", icon: "\u2715" },
|
|
18076
|
+
sell: { accent: "#f6465d", icon: "\u2713" },
|
|
18077
|
+
info: { accent: "#E6C656", icon: "\u2139" },
|
|
18078
|
+
pending: { accent: "#7EB3E6", icon: "\u25CC" }
|
|
18079
|
+
};
|
|
18080
|
+
var Wrapper2 = styled9.div`
|
|
18081
|
+
position: relative;
|
|
18082
|
+
display: flex;
|
|
18083
|
+
flex-direction: column;
|
|
18084
|
+
gap: 0;
|
|
18085
|
+
width: 340px;
|
|
18086
|
+
background: #0d0f1a;
|
|
18087
|
+
border: 1px solid rgba(255, 255, 255, 0.08);
|
|
18088
|
+
border-radius: 10px;
|
|
18089
|
+
overflow: hidden;
|
|
18090
|
+
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04);
|
|
18091
|
+
animation: ${({ $exiting }) => $exiting ? css`${slideOut2} 0.28s cubic-bezier(0.4,0,1,1) forwards` : css`${slideIn2} 0.32s cubic-bezier(0,0,0.2,1) forwards`};
|
|
18092
|
+
pointer-events: all;
|
|
18093
|
+
`;
|
|
18094
|
+
var Body = styled9.div`
|
|
18095
|
+
display: flex;
|
|
18096
|
+
align-items: flex-start;
|
|
18097
|
+
gap: 12px;
|
|
18098
|
+
padding: 14px 16px 12px;
|
|
18099
|
+
`;
|
|
18100
|
+
var IconDot = styled9.div`
|
|
18101
|
+
flex-shrink: 0;
|
|
18102
|
+
width: 28px;
|
|
18103
|
+
height: 28px;
|
|
18104
|
+
border-radius: 50%;
|
|
18105
|
+
background: ${({ $color }) => $color}1a;
|
|
18106
|
+
border: 1px solid ${({ $color }) => $color}55;
|
|
18107
|
+
display: flex;
|
|
18108
|
+
align-items: center;
|
|
18109
|
+
justify-content: center;
|
|
18110
|
+
font-size: 0.75rem;
|
|
18111
|
+
font-weight: 700;
|
|
18112
|
+
color: ${({ $color }) => $color};
|
|
18113
|
+
margin-top: 1px;
|
|
18114
|
+
`;
|
|
18115
|
+
var Content = styled9.div`
|
|
18116
|
+
flex: 1;
|
|
18117
|
+
min-width: 0;
|
|
18118
|
+
`;
|
|
18119
|
+
var Title2 = styled9.p`
|
|
18120
|
+
margin: 0 0 2px;
|
|
18121
|
+
font-size: 0.8rem;
|
|
18122
|
+
font-weight: 600;
|
|
18123
|
+
color: #fff;
|
|
18124
|
+
letter-spacing: 0.01em;
|
|
18125
|
+
`;
|
|
18126
|
+
var Amount = styled9.p`
|
|
18127
|
+
margin: 0 0 6px;
|
|
18128
|
+
font-size: 1.05rem;
|
|
18129
|
+
font-weight: 700;
|
|
18130
|
+
color: #E6C656;
|
|
18131
|
+
letter-spacing: -0.01em;
|
|
18132
|
+
`;
|
|
18133
|
+
var TxRow = styled9.a`
|
|
18134
|
+
display: inline-flex;
|
|
18135
|
+
align-items: center;
|
|
18136
|
+
gap: 5px;
|
|
18137
|
+
font-family: 'IBM Plex Mono', 'Space Mono', monospace;
|
|
18138
|
+
font-size: 0.68rem;
|
|
18139
|
+
color: rgba(255, 255, 255, 0.4);
|
|
18140
|
+
text-decoration: none;
|
|
18141
|
+
transition: color 0.15s;
|
|
18142
|
+
&:hover {
|
|
18143
|
+
color: #7EB3E6;
|
|
18144
|
+
}
|
|
18145
|
+
`;
|
|
18146
|
+
var TxArrow = styled9.span`
|
|
18147
|
+
font-size: 0.6rem;
|
|
18148
|
+
opacity: 0.6;
|
|
18149
|
+
`;
|
|
18150
|
+
var CloseBtn2 = styled9.button`
|
|
18151
|
+
flex-shrink: 0;
|
|
18152
|
+
background: none;
|
|
18153
|
+
border: none;
|
|
18154
|
+
padding: 2px 4px;
|
|
18155
|
+
cursor: pointer;
|
|
18156
|
+
color: rgba(255, 255, 255, 0.25);
|
|
18157
|
+
font-size: 0.9rem;
|
|
18158
|
+
line-height: 1;
|
|
18159
|
+
transition: color 0.15s;
|
|
18160
|
+
&:hover { color: rgba(255, 255, 255, 0.7); }
|
|
18161
|
+
`;
|
|
18162
|
+
var ProgressBar = styled9.div`
|
|
18163
|
+
height: 2px;
|
|
18164
|
+
background: rgba(255, 255, 255, 0.06);
|
|
18165
|
+
position: relative;
|
|
18166
|
+
&::after {
|
|
18167
|
+
content: '';
|
|
18168
|
+
position: absolute;
|
|
18169
|
+
left: 0;
|
|
18170
|
+
top: 0;
|
|
18171
|
+
height: 100%;
|
|
18172
|
+
background: ${({ $color }) => $color};
|
|
18173
|
+
animation: ${css`${progressShrink} ${({ $duration }) => $duration}ms linear forwards`};
|
|
18174
|
+
}
|
|
18175
|
+
`;
|
|
18176
|
+
var Container3 = styled9.div`
|
|
18177
|
+
position: fixed;
|
|
18178
|
+
bottom: 24px;
|
|
18179
|
+
right: 24px;
|
|
18180
|
+
z-index: 9999;
|
|
18181
|
+
display: flex;
|
|
18182
|
+
flex-direction: column-reverse;
|
|
18183
|
+
gap: 10px;
|
|
18184
|
+
pointer-events: none;
|
|
18185
|
+
`;
|
|
18186
|
+
var DEFAULT_EXPLORER = "https://sepolia.basescan.org/tx/";
|
|
18187
|
+
function truncateHash(hash) {
|
|
18188
|
+
return `${hash.slice(0, 6)}\u2026${hash.slice(-4)}`;
|
|
18189
|
+
}
|
|
18190
|
+
function ToastItem({ toast, onDismiss }) {
|
|
18191
|
+
const [exiting, setExiting] = useState(false);
|
|
18192
|
+
const timerRef = useRef(null);
|
|
18193
|
+
const dismiss = useCallback(() => {
|
|
18194
|
+
setExiting(true);
|
|
18195
|
+
setTimeout(() => onDismiss(toast.id), 280);
|
|
18196
|
+
}, [onDismiss, toast.id]);
|
|
18197
|
+
useEffect(() => {
|
|
18198
|
+
const duration2 = toast.duration ?? 6e3;
|
|
18199
|
+
if (duration2 > 0) {
|
|
18200
|
+
timerRef.current = setTimeout(dismiss, duration2);
|
|
18201
|
+
}
|
|
18202
|
+
return () => {
|
|
18203
|
+
if (timerRef.current) clearTimeout(timerRef.current);
|
|
18204
|
+
};
|
|
18205
|
+
}, [dismiss, toast.duration]);
|
|
18206
|
+
const { accent, icon } = VARIANT_COLORS[toast.variant];
|
|
18207
|
+
const duration = toast.duration ?? 6e3;
|
|
18208
|
+
const explorerBase = toast.explorerUrl ?? DEFAULT_EXPLORER;
|
|
18209
|
+
const txUrl = toast.txHash ? `${explorerBase}${toast.txHash}` : void 0;
|
|
18210
|
+
return /* @__PURE__ */ jsxs(Wrapper2, { $exiting: exiting, children: [
|
|
18211
|
+
/* @__PURE__ */ jsxs(Body, { children: [
|
|
18212
|
+
/* @__PURE__ */ jsx(IconDot, { $color: accent, children: icon }),
|
|
18213
|
+
/* @__PURE__ */ jsxs(Content, { children: [
|
|
18214
|
+
/* @__PURE__ */ jsx(Title2, { children: toast.title }),
|
|
18215
|
+
toast.amount && /* @__PURE__ */ jsx(Amount, { children: toast.amount }),
|
|
18216
|
+
toast.txHash && txUrl && /* @__PURE__ */ jsxs(TxRow, { href: txUrl, target: "_blank", rel: "noopener noreferrer", children: [
|
|
18217
|
+
truncateHash(toast.txHash),
|
|
18218
|
+
/* @__PURE__ */ jsx(TxArrow, { children: "\u2197" })
|
|
18219
|
+
] })
|
|
18220
|
+
] }),
|
|
18221
|
+
/* @__PURE__ */ jsx(CloseBtn2, { type: "button", onClick: dismiss, "aria-label": "Dismiss", children: "\u2715" })
|
|
18222
|
+
] }),
|
|
18223
|
+
duration > 0 && /* @__PURE__ */ jsx(ProgressBar, { $color: accent, $duration: duration })
|
|
18224
|
+
] });
|
|
18225
|
+
}
|
|
18226
|
+
var ToastContext = createContext(null);
|
|
18227
|
+
function ToastProvider({ children }) {
|
|
18228
|
+
const [toasts, setToasts] = useState([]);
|
|
18229
|
+
const addToast = useCallback((data) => {
|
|
18230
|
+
const id = `toast-${Date.now()}-${Math.random().toString(36).slice(2, 7)}`;
|
|
18231
|
+
setToasts((prev) => [...prev, { ...data, id }]);
|
|
18232
|
+
return id;
|
|
18233
|
+
}, []);
|
|
18234
|
+
const dismiss = useCallback((id) => {
|
|
18235
|
+
setToasts((prev) => prev.filter((t) => t.id !== id));
|
|
18236
|
+
}, []);
|
|
18237
|
+
return /* @__PURE__ */ jsxs(ToastContext.Provider, { value: { toast: addToast, dismiss }, children: [
|
|
18238
|
+
children,
|
|
18239
|
+
/* @__PURE__ */ jsx(Container3, { children: toasts.map((t) => /* @__PURE__ */ jsx(ToastItem, { toast: t, onDismiss: dismiss }, t.id)) })
|
|
18240
|
+
] });
|
|
18241
|
+
}
|
|
18242
|
+
function useToast() {
|
|
18243
|
+
const ctx = useContext(ToastContext);
|
|
18244
|
+
if (!ctx) throw new Error("useToast must be used within a ToastProvider");
|
|
18245
|
+
return ctx;
|
|
18246
|
+
}
|
|
18247
18247
|
var INTERVALS = [1e3, 2e3, 4e3, 5e3, 7e3, 1e4, 12e3];
|
|
18248
18248
|
function useAdaptivePolling({ enabled, onPoll }) {
|
|
18249
18249
|
const onPollRef = useRef(onPoll);
|