@loafmarkets/ui 0.1.87 → 0.1.89
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.js +208 -193
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +209 -194
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React5 from 'react';
|
|
2
|
-
import React5__default, { createContext, useState, useEffect,
|
|
2
|
+
import React5__default, { createContext, useState, useEffect, useCallback, useContext, useMemo, useRef } from 'react';
|
|
3
3
|
import { Slot } from '@radix-ui/react-slot';
|
|
4
4
|
import { cva } from 'class-variance-authority';
|
|
5
5
|
import { clsx } from 'clsx';
|
|
@@ -6115,6 +6115,191 @@ var PropertySubheader = React5.forwardRef(
|
|
|
6115
6115
|
}
|
|
6116
6116
|
);
|
|
6117
6117
|
PropertySubheader.displayName = "PropertySubheader";
|
|
6118
|
+
var slideIn = keyframes`
|
|
6119
|
+
from { transform: translateX(110%); opacity: 0; }
|
|
6120
|
+
to { transform: translateX(0); opacity: 1; }
|
|
6121
|
+
`;
|
|
6122
|
+
var slideOut = keyframes`
|
|
6123
|
+
from { transform: translateX(0); opacity: 1; }
|
|
6124
|
+
to { transform: translateX(110%); opacity: 0; }
|
|
6125
|
+
`;
|
|
6126
|
+
var progressShrink = keyframes`
|
|
6127
|
+
from { width: 100%; }
|
|
6128
|
+
to { width: 0%; }
|
|
6129
|
+
`;
|
|
6130
|
+
var VARIANT_COLORS = {
|
|
6131
|
+
success: { accent: "#0ecb81", icon: "\u2713" },
|
|
6132
|
+
error: { accent: "#f6465d", icon: "\u2715" },
|
|
6133
|
+
info: { accent: "#E6C656", icon: "\u2139" },
|
|
6134
|
+
pending: { accent: "#7EB3E6", icon: "\u25CC" }
|
|
6135
|
+
};
|
|
6136
|
+
var Wrapper = styled25.div`
|
|
6137
|
+
position: relative;
|
|
6138
|
+
display: flex;
|
|
6139
|
+
flex-direction: column;
|
|
6140
|
+
gap: 0;
|
|
6141
|
+
width: 340px;
|
|
6142
|
+
background: #0d0f1a;
|
|
6143
|
+
border: 1px solid rgba(255, 255, 255, 0.08);
|
|
6144
|
+
border-radius: 10px;
|
|
6145
|
+
overflow: hidden;
|
|
6146
|
+
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04);
|
|
6147
|
+
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`};
|
|
6148
|
+
pointer-events: all;
|
|
6149
|
+
`;
|
|
6150
|
+
var Body = styled25.div`
|
|
6151
|
+
display: flex;
|
|
6152
|
+
align-items: flex-start;
|
|
6153
|
+
gap: 12px;
|
|
6154
|
+
padding: 14px 16px 12px;
|
|
6155
|
+
`;
|
|
6156
|
+
var IconDot = styled25.div`
|
|
6157
|
+
flex-shrink: 0;
|
|
6158
|
+
width: 28px;
|
|
6159
|
+
height: 28px;
|
|
6160
|
+
border-radius: 50%;
|
|
6161
|
+
background: ${({ $color }) => $color}1a;
|
|
6162
|
+
border: 1px solid ${({ $color }) => $color}55;
|
|
6163
|
+
display: flex;
|
|
6164
|
+
align-items: center;
|
|
6165
|
+
justify-content: center;
|
|
6166
|
+
font-size: 0.75rem;
|
|
6167
|
+
font-weight: 700;
|
|
6168
|
+
color: ${({ $color }) => $color};
|
|
6169
|
+
margin-top: 1px;
|
|
6170
|
+
`;
|
|
6171
|
+
var Content = styled25.div`
|
|
6172
|
+
flex: 1;
|
|
6173
|
+
min-width: 0;
|
|
6174
|
+
`;
|
|
6175
|
+
var Title = styled25.p`
|
|
6176
|
+
margin: 0 0 2px;
|
|
6177
|
+
font-size: 0.8rem;
|
|
6178
|
+
font-weight: 600;
|
|
6179
|
+
color: #fff;
|
|
6180
|
+
letter-spacing: 0.01em;
|
|
6181
|
+
`;
|
|
6182
|
+
var Amount = styled25.p`
|
|
6183
|
+
margin: 0 0 6px;
|
|
6184
|
+
font-size: 1.05rem;
|
|
6185
|
+
font-weight: 700;
|
|
6186
|
+
color: #E6C656;
|
|
6187
|
+
letter-spacing: -0.01em;
|
|
6188
|
+
`;
|
|
6189
|
+
var TxRow = styled25.a`
|
|
6190
|
+
display: inline-flex;
|
|
6191
|
+
align-items: center;
|
|
6192
|
+
gap: 5px;
|
|
6193
|
+
font-family: 'IBM Plex Mono', 'Space Mono', monospace;
|
|
6194
|
+
font-size: 0.68rem;
|
|
6195
|
+
color: rgba(255, 255, 255, 0.4);
|
|
6196
|
+
text-decoration: none;
|
|
6197
|
+
transition: color 0.15s;
|
|
6198
|
+
&:hover {
|
|
6199
|
+
color: #7EB3E6;
|
|
6200
|
+
}
|
|
6201
|
+
`;
|
|
6202
|
+
var TxArrow = styled25.span`
|
|
6203
|
+
font-size: 0.6rem;
|
|
6204
|
+
opacity: 0.6;
|
|
6205
|
+
`;
|
|
6206
|
+
var CloseBtn = styled25.button`
|
|
6207
|
+
flex-shrink: 0;
|
|
6208
|
+
background: none;
|
|
6209
|
+
border: none;
|
|
6210
|
+
padding: 2px 4px;
|
|
6211
|
+
cursor: pointer;
|
|
6212
|
+
color: rgba(255, 255, 255, 0.25);
|
|
6213
|
+
font-size: 0.9rem;
|
|
6214
|
+
line-height: 1;
|
|
6215
|
+
transition: color 0.15s;
|
|
6216
|
+
&:hover { color: rgba(255, 255, 255, 0.7); }
|
|
6217
|
+
`;
|
|
6218
|
+
var ProgressBar = styled25.div`
|
|
6219
|
+
height: 2px;
|
|
6220
|
+
background: rgba(255, 255, 255, 0.06);
|
|
6221
|
+
position: relative;
|
|
6222
|
+
&::after {
|
|
6223
|
+
content: '';
|
|
6224
|
+
position: absolute;
|
|
6225
|
+
left: 0;
|
|
6226
|
+
top: 0;
|
|
6227
|
+
height: 100%;
|
|
6228
|
+
background: ${({ $color }) => $color};
|
|
6229
|
+
animation: ${css`${progressShrink} ${({ $duration }) => $duration}ms linear forwards`};
|
|
6230
|
+
}
|
|
6231
|
+
`;
|
|
6232
|
+
var Container = styled25.div`
|
|
6233
|
+
position: fixed;
|
|
6234
|
+
bottom: 24px;
|
|
6235
|
+
right: 24px;
|
|
6236
|
+
z-index: 9999;
|
|
6237
|
+
display: flex;
|
|
6238
|
+
flex-direction: column-reverse;
|
|
6239
|
+
gap: 10px;
|
|
6240
|
+
pointer-events: none;
|
|
6241
|
+
`;
|
|
6242
|
+
var DEFAULT_EXPLORER = "https://sepolia.basescan.org/tx/";
|
|
6243
|
+
function truncateHash(hash) {
|
|
6244
|
+
return `${hash.slice(0, 6)}\u2026${hash.slice(-4)}`;
|
|
6245
|
+
}
|
|
6246
|
+
function ToastItem({ toast, onDismiss }) {
|
|
6247
|
+
const [exiting, setExiting] = useState(false);
|
|
6248
|
+
const timerRef = useRef(null);
|
|
6249
|
+
const dismiss = useCallback(() => {
|
|
6250
|
+
setExiting(true);
|
|
6251
|
+
setTimeout(() => onDismiss(toast.id), 280);
|
|
6252
|
+
}, [onDismiss, toast.id]);
|
|
6253
|
+
useEffect(() => {
|
|
6254
|
+
const duration2 = toast.duration ?? 6e3;
|
|
6255
|
+
if (duration2 > 0) {
|
|
6256
|
+
timerRef.current = setTimeout(dismiss, duration2);
|
|
6257
|
+
}
|
|
6258
|
+
return () => {
|
|
6259
|
+
if (timerRef.current) clearTimeout(timerRef.current);
|
|
6260
|
+
};
|
|
6261
|
+
}, [dismiss, toast.duration]);
|
|
6262
|
+
const { accent, icon } = VARIANT_COLORS[toast.variant];
|
|
6263
|
+
const duration = toast.duration ?? 6e3;
|
|
6264
|
+
const explorerBase = toast.explorerUrl ?? DEFAULT_EXPLORER;
|
|
6265
|
+
const txUrl = toast.txHash ? `${explorerBase}${toast.txHash}` : void 0;
|
|
6266
|
+
return /* @__PURE__ */ jsxs(Wrapper, { $exiting: exiting, children: [
|
|
6267
|
+
/* @__PURE__ */ jsxs(Body, { children: [
|
|
6268
|
+
/* @__PURE__ */ jsx(IconDot, { $color: accent, children: icon }),
|
|
6269
|
+
/* @__PURE__ */ jsxs(Content, { children: [
|
|
6270
|
+
/* @__PURE__ */ jsx(Title, { children: toast.title }),
|
|
6271
|
+
toast.amount && /* @__PURE__ */ jsx(Amount, { children: toast.amount }),
|
|
6272
|
+
toast.txHash && txUrl && /* @__PURE__ */ jsxs(TxRow, { href: txUrl, target: "_blank", rel: "noopener noreferrer", children: [
|
|
6273
|
+
truncateHash(toast.txHash),
|
|
6274
|
+
/* @__PURE__ */ jsx(TxArrow, { children: "\u2197" })
|
|
6275
|
+
] })
|
|
6276
|
+
] }),
|
|
6277
|
+
/* @__PURE__ */ jsx(CloseBtn, { type: "button", onClick: dismiss, "aria-label": "Dismiss", children: "\u2715" })
|
|
6278
|
+
] }),
|
|
6279
|
+
duration > 0 && /* @__PURE__ */ jsx(ProgressBar, { $color: accent, $duration: duration })
|
|
6280
|
+
] });
|
|
6281
|
+
}
|
|
6282
|
+
var ToastContext = createContext(null);
|
|
6283
|
+
function ToastProvider({ children }) {
|
|
6284
|
+
const [toasts, setToasts] = useState([]);
|
|
6285
|
+
const addToast = useCallback((data) => {
|
|
6286
|
+
const id = `toast-${Date.now()}-${Math.random().toString(36).slice(2, 7)}`;
|
|
6287
|
+
setToasts((prev) => [...prev, { ...data, id }]);
|
|
6288
|
+
return id;
|
|
6289
|
+
}, []);
|
|
6290
|
+
const dismiss = useCallback((id) => {
|
|
6291
|
+
setToasts((prev) => prev.filter((t) => t.id !== id));
|
|
6292
|
+
}, []);
|
|
6293
|
+
return /* @__PURE__ */ jsxs(ToastContext.Provider, { value: { toast: addToast, dismiss }, children: [
|
|
6294
|
+
children,
|
|
6295
|
+
/* @__PURE__ */ jsx(Container, { children: toasts.map((t) => /* @__PURE__ */ jsx(ToastItem, { toast: t, onDismiss: dismiss }, t.id)) })
|
|
6296
|
+
] });
|
|
6297
|
+
}
|
|
6298
|
+
function useToast() {
|
|
6299
|
+
const ctx = useContext(ToastContext);
|
|
6300
|
+
if (!ctx) throw new Error("useToast must be used within a ToastProvider");
|
|
6301
|
+
return ctx;
|
|
6302
|
+
}
|
|
6118
6303
|
var DEFAULT_LOGO_SRC = Loaf_logo_Banner_default;
|
|
6119
6304
|
var DEFAULT_LOGO_ALT = "Loaf";
|
|
6120
6305
|
var OTP_INPUT_LENGTH = 6;
|
|
@@ -6142,6 +6327,7 @@ var LoginPopup = ({
|
|
|
6142
6327
|
const [error, setError] = useState("");
|
|
6143
6328
|
const [loading, setLoading] = useState(false);
|
|
6144
6329
|
const [isSignUp, setIsSignUp] = useState(false);
|
|
6330
|
+
const { toast } = useToast();
|
|
6145
6331
|
const [fundingAmount] = useState("");
|
|
6146
6332
|
const [kycLoading, setKycLoading] = useState(false);
|
|
6147
6333
|
const [showKycWidget, setShowKycWidget] = useState(false);
|
|
@@ -6155,6 +6341,11 @@ var LoginPopup = ({
|
|
|
6155
6341
|
setView(initialView);
|
|
6156
6342
|
}
|
|
6157
6343
|
}, [initialView]);
|
|
6344
|
+
useEffect(() => {
|
|
6345
|
+
if (view === "kyc" && renderKycWidget) {
|
|
6346
|
+
setShowKycWidget(true);
|
|
6347
|
+
}
|
|
6348
|
+
}, [view, renderKycWidget]);
|
|
6158
6349
|
useEffect(() => {
|
|
6159
6350
|
if (!transakWidgetUrl) return;
|
|
6160
6351
|
const handleTransakMessage = (event) => {
|
|
@@ -6357,10 +6548,19 @@ var LoginPopup = ({
|
|
|
6357
6548
|
};
|
|
6358
6549
|
const handleKycWidgetResult = (result) => {
|
|
6359
6550
|
setShowKycWidget(false);
|
|
6551
|
+
onClose();
|
|
6360
6552
|
if (result.passed) {
|
|
6361
|
-
|
|
6553
|
+
toast({
|
|
6554
|
+
variant: "success",
|
|
6555
|
+
title: "KYC submitted \u2014 pending review",
|
|
6556
|
+
amount: "Your documents are under review. Please check back in a few minutes."
|
|
6557
|
+
});
|
|
6362
6558
|
} else {
|
|
6363
|
-
|
|
6559
|
+
toast({
|
|
6560
|
+
variant: "error",
|
|
6561
|
+
title: "Verification unsuccessful",
|
|
6562
|
+
amount: "Your identity check didn't pass. Please contact support if you believe this is an error."
|
|
6563
|
+
});
|
|
6364
6564
|
}
|
|
6365
6565
|
};
|
|
6366
6566
|
const handleKycWidgetClose = () => {
|
|
@@ -6451,7 +6651,7 @@ var LoginPopup = ({
|
|
|
6451
6651
|
if (view === "main") {
|
|
6452
6652
|
return /* @__PURE__ */ jsx(Overlay2, { onClick: onClose, children: /* @__PURE__ */ jsxs(PopupContainer, { onClick: (event) => event.stopPropagation(), children: [
|
|
6453
6653
|
/* @__PURE__ */ jsx(CloseButton, { onClick: onClose, "aria-label": "Close login popup", children: /* @__PURE__ */ jsx("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ jsx("path", { d: "M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z" }) }) }),
|
|
6454
|
-
/* @__PURE__ */ jsxs(
|
|
6654
|
+
/* @__PURE__ */ jsxs(Title2, { children: [
|
|
6455
6655
|
/* @__PURE__ */ jsx(LogoContainer3, { children: /* @__PURE__ */ jsx(LogoImage, { src: logoSrc, alt: logoAlt }) }),
|
|
6456
6656
|
"Welcome to Loaf"
|
|
6457
6657
|
] }),
|
|
@@ -6512,7 +6712,7 @@ var LoginPopup = ({
|
|
|
6512
6712
|
/* @__PURE__ */ jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ jsx("path", { d: "M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20v-2z" }) }),
|
|
6513
6713
|
"Back"
|
|
6514
6714
|
] }),
|
|
6515
|
-
/* @__PURE__ */ jsxs(
|
|
6715
|
+
/* @__PURE__ */ jsxs(Title2, { children: [
|
|
6516
6716
|
/* @__PURE__ */ jsx(LogoContainer3, { children: /* @__PURE__ */ jsx(LogoImage, { src: logoSrc, alt: logoAlt }) }),
|
|
6517
6717
|
isSignUp ? "Sign up with Email" : "Sign in with Email"
|
|
6518
6718
|
] }),
|
|
@@ -6551,7 +6751,7 @@ var LoginPopup = ({
|
|
|
6551
6751
|
/* @__PURE__ */ jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ jsx("path", { d: "M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20v-2z" }) }),
|
|
6552
6752
|
"Back"
|
|
6553
6753
|
] }),
|
|
6554
|
-
/* @__PURE__ */ jsxs(
|
|
6754
|
+
/* @__PURE__ */ jsxs(Title2, { children: [
|
|
6555
6755
|
/* @__PURE__ */ jsx(LogoContainer3, { children: /* @__PURE__ */ jsx(LogoImage, { src: logoSrc, alt: logoAlt }) }),
|
|
6556
6756
|
"Enter Verification Code"
|
|
6557
6757
|
] }),
|
|
@@ -6822,7 +7022,7 @@ var CloseButton = styled25.button`
|
|
|
6822
7022
|
color: var(--color-accent, #e6c656);
|
|
6823
7023
|
}
|
|
6824
7024
|
`;
|
|
6825
|
-
var
|
|
7025
|
+
var Title2 = styled25.h2`
|
|
6826
7026
|
font-size: 1.75rem;
|
|
6827
7027
|
font-weight: 600;
|
|
6828
7028
|
color: var(--color-text, #eaecef);
|
|
@@ -9629,7 +9829,7 @@ function OfferingProgressCard({
|
|
|
9629
9829
|
const interval = setInterval(() => setCountdown(calculateCountdown()), 1e3);
|
|
9630
9830
|
return () => clearInterval(interval);
|
|
9631
9831
|
}, [opensAt]);
|
|
9632
|
-
return /* @__PURE__ */ jsxs(
|
|
9832
|
+
return /* @__PURE__ */ jsxs(Container2, { style, className, children: [
|
|
9633
9833
|
/* @__PURE__ */ jsxs(Header2, { children: [
|
|
9634
9834
|
/* @__PURE__ */ jsxs("h3", { children: [
|
|
9635
9835
|
/* @__PURE__ */ jsx(FaChartLine, {}),
|
|
@@ -9730,7 +9930,7 @@ function OfferingProgressCard({
|
|
|
9730
9930
|
] })
|
|
9731
9931
|
] });
|
|
9732
9932
|
}
|
|
9733
|
-
var
|
|
9933
|
+
var Container2 = styled25.div`
|
|
9734
9934
|
background-color: var(--color-card-darker, #111);
|
|
9735
9935
|
border-radius: 8px;
|
|
9736
9936
|
padding: 1.5rem;
|
|
@@ -10266,191 +10466,6 @@ var LiveIndicatorDot = styled25.span`
|
|
|
10266
10466
|
100% { box-shadow: 0 0 0 0 rgba(14,203,129,0); }
|
|
10267
10467
|
}
|
|
10268
10468
|
`;
|
|
10269
|
-
var slideIn = keyframes`
|
|
10270
|
-
from { transform: translateX(110%); opacity: 0; }
|
|
10271
|
-
to { transform: translateX(0); opacity: 1; }
|
|
10272
|
-
`;
|
|
10273
|
-
var slideOut = keyframes`
|
|
10274
|
-
from { transform: translateX(0); opacity: 1; }
|
|
10275
|
-
to { transform: translateX(110%); opacity: 0; }
|
|
10276
|
-
`;
|
|
10277
|
-
var progressShrink = keyframes`
|
|
10278
|
-
from { width: 100%; }
|
|
10279
|
-
to { width: 0%; }
|
|
10280
|
-
`;
|
|
10281
|
-
var VARIANT_COLORS = {
|
|
10282
|
-
success: { accent: "#0ecb81", icon: "\u2713" },
|
|
10283
|
-
error: { accent: "#f6465d", icon: "\u2715" },
|
|
10284
|
-
info: { accent: "#E6C656", icon: "\u2139" },
|
|
10285
|
-
pending: { accent: "#7EB3E6", icon: "\u25CC" }
|
|
10286
|
-
};
|
|
10287
|
-
var Wrapper = styled25.div`
|
|
10288
|
-
position: relative;
|
|
10289
|
-
display: flex;
|
|
10290
|
-
flex-direction: column;
|
|
10291
|
-
gap: 0;
|
|
10292
|
-
width: 340px;
|
|
10293
|
-
background: #0d0f1a;
|
|
10294
|
-
border: 1px solid rgba(255, 255, 255, 0.08);
|
|
10295
|
-
border-radius: 10px;
|
|
10296
|
-
overflow: hidden;
|
|
10297
|
-
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04);
|
|
10298
|
-
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`};
|
|
10299
|
-
pointer-events: all;
|
|
10300
|
-
`;
|
|
10301
|
-
var Body = styled25.div`
|
|
10302
|
-
display: flex;
|
|
10303
|
-
align-items: flex-start;
|
|
10304
|
-
gap: 12px;
|
|
10305
|
-
padding: 14px 16px 12px;
|
|
10306
|
-
`;
|
|
10307
|
-
var IconDot = styled25.div`
|
|
10308
|
-
flex-shrink: 0;
|
|
10309
|
-
width: 28px;
|
|
10310
|
-
height: 28px;
|
|
10311
|
-
border-radius: 50%;
|
|
10312
|
-
background: ${({ $color }) => $color}1a;
|
|
10313
|
-
border: 1px solid ${({ $color }) => $color}55;
|
|
10314
|
-
display: flex;
|
|
10315
|
-
align-items: center;
|
|
10316
|
-
justify-content: center;
|
|
10317
|
-
font-size: 0.75rem;
|
|
10318
|
-
font-weight: 700;
|
|
10319
|
-
color: ${({ $color }) => $color};
|
|
10320
|
-
margin-top: 1px;
|
|
10321
|
-
`;
|
|
10322
|
-
var Content = styled25.div`
|
|
10323
|
-
flex: 1;
|
|
10324
|
-
min-width: 0;
|
|
10325
|
-
`;
|
|
10326
|
-
var Title2 = styled25.p`
|
|
10327
|
-
margin: 0 0 2px;
|
|
10328
|
-
font-size: 0.8rem;
|
|
10329
|
-
font-weight: 600;
|
|
10330
|
-
color: #fff;
|
|
10331
|
-
letter-spacing: 0.01em;
|
|
10332
|
-
`;
|
|
10333
|
-
var Amount = styled25.p`
|
|
10334
|
-
margin: 0 0 6px;
|
|
10335
|
-
font-size: 1.05rem;
|
|
10336
|
-
font-weight: 700;
|
|
10337
|
-
color: #E6C656;
|
|
10338
|
-
letter-spacing: -0.01em;
|
|
10339
|
-
`;
|
|
10340
|
-
var TxRow = styled25.a`
|
|
10341
|
-
display: inline-flex;
|
|
10342
|
-
align-items: center;
|
|
10343
|
-
gap: 5px;
|
|
10344
|
-
font-family: 'IBM Plex Mono', 'Space Mono', monospace;
|
|
10345
|
-
font-size: 0.68rem;
|
|
10346
|
-
color: rgba(255, 255, 255, 0.4);
|
|
10347
|
-
text-decoration: none;
|
|
10348
|
-
transition: color 0.15s;
|
|
10349
|
-
&:hover {
|
|
10350
|
-
color: #7EB3E6;
|
|
10351
|
-
}
|
|
10352
|
-
`;
|
|
10353
|
-
var TxArrow = styled25.span`
|
|
10354
|
-
font-size: 0.6rem;
|
|
10355
|
-
opacity: 0.6;
|
|
10356
|
-
`;
|
|
10357
|
-
var CloseBtn = styled25.button`
|
|
10358
|
-
flex-shrink: 0;
|
|
10359
|
-
background: none;
|
|
10360
|
-
border: none;
|
|
10361
|
-
padding: 2px 4px;
|
|
10362
|
-
cursor: pointer;
|
|
10363
|
-
color: rgba(255, 255, 255, 0.25);
|
|
10364
|
-
font-size: 0.9rem;
|
|
10365
|
-
line-height: 1;
|
|
10366
|
-
transition: color 0.15s;
|
|
10367
|
-
&:hover { color: rgba(255, 255, 255, 0.7); }
|
|
10368
|
-
`;
|
|
10369
|
-
var ProgressBar = styled25.div`
|
|
10370
|
-
height: 2px;
|
|
10371
|
-
background: rgba(255, 255, 255, 0.06);
|
|
10372
|
-
position: relative;
|
|
10373
|
-
&::after {
|
|
10374
|
-
content: '';
|
|
10375
|
-
position: absolute;
|
|
10376
|
-
left: 0;
|
|
10377
|
-
top: 0;
|
|
10378
|
-
height: 100%;
|
|
10379
|
-
background: ${({ $color }) => $color};
|
|
10380
|
-
animation: ${css`${progressShrink} ${({ $duration }) => $duration}ms linear forwards`};
|
|
10381
|
-
}
|
|
10382
|
-
`;
|
|
10383
|
-
var Container2 = styled25.div`
|
|
10384
|
-
position: fixed;
|
|
10385
|
-
bottom: 24px;
|
|
10386
|
-
right: 24px;
|
|
10387
|
-
z-index: 9999;
|
|
10388
|
-
display: flex;
|
|
10389
|
-
flex-direction: column-reverse;
|
|
10390
|
-
gap: 10px;
|
|
10391
|
-
pointer-events: none;
|
|
10392
|
-
`;
|
|
10393
|
-
var DEFAULT_EXPLORER = "https://sepolia.basescan.org/tx/";
|
|
10394
|
-
function truncateHash(hash) {
|
|
10395
|
-
return `${hash.slice(0, 6)}\u2026${hash.slice(-4)}`;
|
|
10396
|
-
}
|
|
10397
|
-
function ToastItem({ toast, onDismiss }) {
|
|
10398
|
-
const [exiting, setExiting] = useState(false);
|
|
10399
|
-
const timerRef = useRef(null);
|
|
10400
|
-
const dismiss = useCallback(() => {
|
|
10401
|
-
setExiting(true);
|
|
10402
|
-
setTimeout(() => onDismiss(toast.id), 280);
|
|
10403
|
-
}, [onDismiss, toast.id]);
|
|
10404
|
-
useEffect(() => {
|
|
10405
|
-
const duration2 = toast.duration ?? 6e3;
|
|
10406
|
-
if (duration2 > 0) {
|
|
10407
|
-
timerRef.current = setTimeout(dismiss, duration2);
|
|
10408
|
-
}
|
|
10409
|
-
return () => {
|
|
10410
|
-
if (timerRef.current) clearTimeout(timerRef.current);
|
|
10411
|
-
};
|
|
10412
|
-
}, [dismiss, toast.duration]);
|
|
10413
|
-
const { accent, icon } = VARIANT_COLORS[toast.variant];
|
|
10414
|
-
const duration = toast.duration ?? 6e3;
|
|
10415
|
-
const explorerBase = toast.explorerUrl ?? DEFAULT_EXPLORER;
|
|
10416
|
-
const txUrl = toast.txHash ? `${explorerBase}${toast.txHash}` : void 0;
|
|
10417
|
-
return /* @__PURE__ */ jsxs(Wrapper, { $exiting: exiting, children: [
|
|
10418
|
-
/* @__PURE__ */ jsxs(Body, { children: [
|
|
10419
|
-
/* @__PURE__ */ jsx(IconDot, { $color: accent, children: icon }),
|
|
10420
|
-
/* @__PURE__ */ jsxs(Content, { children: [
|
|
10421
|
-
/* @__PURE__ */ jsx(Title2, { children: toast.title }),
|
|
10422
|
-
toast.amount && /* @__PURE__ */ jsx(Amount, { children: toast.amount }),
|
|
10423
|
-
toast.txHash && txUrl && /* @__PURE__ */ jsxs(TxRow, { href: txUrl, target: "_blank", rel: "noopener noreferrer", children: [
|
|
10424
|
-
truncateHash(toast.txHash),
|
|
10425
|
-
/* @__PURE__ */ jsx(TxArrow, { children: "\u2197" })
|
|
10426
|
-
] })
|
|
10427
|
-
] }),
|
|
10428
|
-
/* @__PURE__ */ jsx(CloseBtn, { type: "button", onClick: dismiss, "aria-label": "Dismiss", children: "\u2715" })
|
|
10429
|
-
] }),
|
|
10430
|
-
duration > 0 && /* @__PURE__ */ jsx(ProgressBar, { $color: accent, $duration: duration })
|
|
10431
|
-
] });
|
|
10432
|
-
}
|
|
10433
|
-
var ToastContext = createContext(null);
|
|
10434
|
-
function ToastProvider({ children }) {
|
|
10435
|
-
const [toasts, setToasts] = useState([]);
|
|
10436
|
-
const addToast = useCallback((data) => {
|
|
10437
|
-
const id = `toast-${Date.now()}-${Math.random().toString(36).slice(2, 7)}`;
|
|
10438
|
-
setToasts((prev) => [...prev, { ...data, id }]);
|
|
10439
|
-
return id;
|
|
10440
|
-
}, []);
|
|
10441
|
-
const dismiss = useCallback((id) => {
|
|
10442
|
-
setToasts((prev) => prev.filter((t) => t.id !== id));
|
|
10443
|
-
}, []);
|
|
10444
|
-
return /* @__PURE__ */ jsxs(ToastContext.Provider, { value: { toast: addToast, dismiss }, children: [
|
|
10445
|
-
children,
|
|
10446
|
-
/* @__PURE__ */ jsx(Container2, { children: toasts.map((t) => /* @__PURE__ */ jsx(ToastItem, { toast: t, onDismiss: dismiss }, t.id)) })
|
|
10447
|
-
] });
|
|
10448
|
-
}
|
|
10449
|
-
function useToast() {
|
|
10450
|
-
const ctx = useContext(ToastContext);
|
|
10451
|
-
if (!ctx) throw new Error("useToast must be used within a ToastProvider");
|
|
10452
|
-
return ctx;
|
|
10453
|
-
}
|
|
10454
10469
|
function OrderPanel({
|
|
10455
10470
|
statusLabel,
|
|
10456
10471
|
statusColor,
|