@deframe-sdk/components 0.1.36 → 0.1.38
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 +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +53 -61
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +53 -61
- package/dist/index.mjs.map +1 -1
- package/dist/styles.css +9 -12
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -2416,6 +2416,7 @@ interface EarnDepositFormViewProps {
|
|
|
2416
2416
|
isTxError: boolean;
|
|
2417
2417
|
txSuccessMessage?: string;
|
|
2418
2418
|
txErrorMessage?: string;
|
|
2419
|
+
insufficientBalanceMessage?: string;
|
|
2419
2420
|
bytecodeErrorMessage?: string;
|
|
2420
2421
|
transactionErrorLabel: string;
|
|
2421
2422
|
isQuoteValid: boolean;
|
|
@@ -2471,6 +2472,7 @@ interface EarnWithdrawFormViewProps {
|
|
|
2471
2472
|
isTxError: boolean;
|
|
2472
2473
|
txSuccessMessage?: string;
|
|
2473
2474
|
txErrorMessage?: string;
|
|
2475
|
+
insufficientBalanceMessage?: string;
|
|
2474
2476
|
bytecodeErrorMessage?: string;
|
|
2475
2477
|
transactionErrorLabel: string;
|
|
2476
2478
|
isQuoteValid: boolean;
|
package/dist/index.d.ts
CHANGED
|
@@ -2416,6 +2416,7 @@ interface EarnDepositFormViewProps {
|
|
|
2416
2416
|
isTxError: boolean;
|
|
2417
2417
|
txSuccessMessage?: string;
|
|
2418
2418
|
txErrorMessage?: string;
|
|
2419
|
+
insufficientBalanceMessage?: string;
|
|
2419
2420
|
bytecodeErrorMessage?: string;
|
|
2420
2421
|
transactionErrorLabel: string;
|
|
2421
2422
|
isQuoteValid: boolean;
|
|
@@ -2471,6 +2472,7 @@ interface EarnWithdrawFormViewProps {
|
|
|
2471
2472
|
isTxError: boolean;
|
|
2472
2473
|
txSuccessMessage?: string;
|
|
2473
2474
|
txErrorMessage?: string;
|
|
2475
|
+
insufficientBalanceMessage?: string;
|
|
2474
2476
|
bytecodeErrorMessage?: string;
|
|
2475
2477
|
transactionErrorLabel: string;
|
|
2476
2478
|
isQuoteValid: boolean;
|
package/dist/index.js
CHANGED
|
@@ -9377,7 +9377,6 @@ var ImageBannerCard = ({
|
|
|
9377
9377
|
);
|
|
9378
9378
|
};
|
|
9379
9379
|
var GRID_COLS = "grid grid-cols-[1fr_100px_130px] gap-x-[var(--deframe-widget-size-gap-md)]";
|
|
9380
|
-
var HISTORY_PAGE_SIZE = 5;
|
|
9381
9380
|
var HISTORY_CONFIG = {
|
|
9382
9381
|
deposit: { label: "Depositado", color: "var(--deframe-widget-color-state-info)" },
|
|
9383
9382
|
withdraw: { label: "Sacado", color: "var(--deframe-widget-color-text-secondary)" },
|
|
@@ -9395,14 +9394,11 @@ var EarnHubStrategyCard = ({
|
|
|
9395
9394
|
history = [],
|
|
9396
9395
|
labels
|
|
9397
9396
|
}) => {
|
|
9398
|
-
var _a, _b, _c, _d
|
|
9397
|
+
var _a, _b, _c, _d;
|
|
9399
9398
|
const [expanded, setExpanded] = React6__namespace.default.useState(false);
|
|
9400
|
-
const [showAll, setShowAll] = React6__namespace.default.useState(false);
|
|
9401
9399
|
const investLabel = (_a = labels == null ? void 0 : labels.investLabel) != null ? _a : "Depositar";
|
|
9402
9400
|
const withdrawLabel = (_b = labels == null ? void 0 : labels.withdrawLabel) != null ? _b : "Sacar";
|
|
9403
9401
|
const historyTitle = (_c = labels == null ? void 0 : labels.historyTitle) != null ? _c : "Hist\xF3rico";
|
|
9404
|
-
const visibleHistory = showAll ? history : history.slice(0, HISTORY_PAGE_SIZE);
|
|
9405
|
-
const hasMore = history.length > HISTORY_PAGE_SIZE && !showAll;
|
|
9406
9402
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
9407
9403
|
"li",
|
|
9408
9404
|
{
|
|
@@ -9495,7 +9491,7 @@ var EarnHubStrategyCard = ({
|
|
|
9495
9491
|
),
|
|
9496
9492
|
history.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-test-id": "earn-hub-strategy-card-history", children: [
|
|
9497
9493
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[length:var(--deframe-widget-font-size-xs)] [font-weight:var(--deframe-widget-font-weight-medium)] uppercase tracking-[0.08em] text-[color:var(--deframe-widget-color-text-tertiary)]", children: historyTitle }),
|
|
9498
|
-
/* @__PURE__ */ jsxRuntime.jsx("ol", { className: "list-none m-0 p-0", children:
|
|
9494
|
+
/* @__PURE__ */ jsxRuntime.jsx("ol", { className: "list-none m-0 p-0 max-h-[200px] overflow-y-auto", children: history.map((entry) => {
|
|
9499
9495
|
var _a2;
|
|
9500
9496
|
const config = (_a2 = HISTORY_CONFIG[entry.type]) != null ? _a2 : HISTORY_CONFIG.deposit;
|
|
9501
9497
|
const isClickable = !!entry.onClick;
|
|
@@ -9534,26 +9530,7 @@ var EarnHubStrategyCard = ({
|
|
|
9534
9530
|
},
|
|
9535
9531
|
entry.id
|
|
9536
9532
|
);
|
|
9537
|
-
}) })
|
|
9538
|
-
hasMore && /* @__PURE__ */ jsxRuntime.jsx(
|
|
9539
|
-
"button",
|
|
9540
|
-
{
|
|
9541
|
-
type: "button",
|
|
9542
|
-
onClick: () => setShowAll(true),
|
|
9543
|
-
className: tailwindMerge.twMerge(
|
|
9544
|
-
"mt-[var(--deframe-widget-size-gap-sm)] w-full",
|
|
9545
|
-
"text-[length:var(--deframe-widget-font-size-xs)] [font-weight:var(--deframe-widget-font-weight-medium)]",
|
|
9546
|
-
"text-[color:var(--deframe-widget-color-text-secondary)]",
|
|
9547
|
-
"font-[var(--deframe-widget-font-family)]",
|
|
9548
|
-
"hover:text-[color:var(--deframe-widget-color-brand-primary)]",
|
|
9549
|
-
"transition-colors duration-150 cursor-pointer",
|
|
9550
|
-
"py-[var(--deframe-widget-size-padding-y-xs)]",
|
|
9551
|
-
"border-t border-[color:var(--deframe-widget-color-border-tertiary)]",
|
|
9552
|
-
"outline-none bg-transparent border-x-0 border-b-0"
|
|
9553
|
-
),
|
|
9554
|
-
children: (_e = labels == null ? void 0 : labels.showMoreLabel) != null ? _e : `Ver mais (${history.length - HISTORY_PAGE_SIZE} itens)`
|
|
9555
|
-
}
|
|
9556
|
-
)
|
|
9533
|
+
}) })
|
|
9557
9534
|
] })
|
|
9558
9535
|
]
|
|
9559
9536
|
}
|
|
@@ -10716,21 +10693,33 @@ var EarnNoBalanceNotificationView = ({
|
|
|
10716
10693
|
prompt,
|
|
10717
10694
|
actionLabel,
|
|
10718
10695
|
onAction
|
|
10719
|
-
}) => /* @__PURE__ */ jsxRuntime.jsx("div", { className: "
|
|
10720
|
-
|
|
10721
|
-
|
|
10722
|
-
|
|
10723
|
-
|
|
10724
|
-
|
|
10725
|
-
|
|
10726
|
-
|
|
10727
|
-
|
|
10728
|
-
|
|
10729
|
-
|
|
10730
|
-
|
|
10731
|
-
|
|
10732
|
-
|
|
10733
|
-
|
|
10696
|
+
}) => /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-[var(--deframe-widget-size-gap-md)]", children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
10697
|
+
"div",
|
|
10698
|
+
{
|
|
10699
|
+
"data-test-id": "earn-no-balance-notification",
|
|
10700
|
+
className: [
|
|
10701
|
+
"bg-[color-mix(in_srgb,var(--deframe-widget-color-state-warning)_16%,transparent)]",
|
|
10702
|
+
"border border-[var(--deframe-widget-color-state-warning)]",
|
|
10703
|
+
"rounded-[var(--deframe-widget-size-radius-sm)]",
|
|
10704
|
+
"px-[var(--deframe-widget-size-padding-x-md)] py-[var(--deframe-widget-size-padding-y-md)]",
|
|
10705
|
+
"flex flex-col gap-[var(--deframe-widget-size-gap-md)]"
|
|
10706
|
+
].join(" "),
|
|
10707
|
+
children: [
|
|
10708
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-start gap-[var(--deframe-widget-size-gap-sm)]", children: [
|
|
10709
|
+
/* @__PURE__ */ jsxRuntime.jsx("svg", { className: "w-5 h-5 text-[color:var(--deframe-widget-color-state-warning)] flex-shrink-0 mt-0.5", fill: "currentColor", viewBox: "0 0 20 20", children: /* @__PURE__ */ jsxRuntime.jsx("path", { fillRule: "evenodd", d: "M8.257 3.099c.765-1.36 2.722-1.36 3.486 0l5.58 9.92c.75 1.334-.213 2.98-1.742 2.98H4.42c-1.53 0-2.493-1.646-1.743-2.98l5.58-9.92zM11 13a1 1 0 11-2 0 1 1 0 012 0zm-1-8a1 1 0 00-1 1v3a1 1 0 002 0V6a1 1 0 00-1-1z", clipRule: "evenodd" }) }),
|
|
10710
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-1", children: /* @__PURE__ */ jsxRuntime.jsx(TextBody, { variant: "text-small", children: prompt }) })
|
|
10711
|
+
] }),
|
|
10712
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
10713
|
+
PrimaryButton,
|
|
10714
|
+
{
|
|
10715
|
+
type: "button",
|
|
10716
|
+
onClick: onAction,
|
|
10717
|
+
children: actionLabel
|
|
10718
|
+
}
|
|
10719
|
+
)
|
|
10720
|
+
]
|
|
10721
|
+
}
|
|
10722
|
+
) });
|
|
10734
10723
|
var EarnTxStatusCardView = ({
|
|
10735
10724
|
statusLabel,
|
|
10736
10725
|
isProcessing,
|
|
@@ -11337,6 +11326,8 @@ var EarnDepositFormViewSimple = ({
|
|
|
11337
11326
|
isTxError,
|
|
11338
11327
|
txSuccessMessage,
|
|
11339
11328
|
txErrorMessage,
|
|
11329
|
+
// Insufficient balance
|
|
11330
|
+
insufficientBalanceMessage,
|
|
11340
11331
|
// Bytecode error
|
|
11341
11332
|
bytecodeErrorMessage,
|
|
11342
11333
|
// Submit button
|
|
@@ -11344,7 +11335,7 @@ var EarnDepositFormViewSimple = ({
|
|
|
11344
11335
|
submitButtonText
|
|
11345
11336
|
}) => {
|
|
11346
11337
|
const hasToken = selectedToken != null;
|
|
11347
|
-
const hasError = !!bytecodeErrorMessage;
|
|
11338
|
+
const hasError = !!insufficientBalanceMessage || !!bytecodeErrorMessage;
|
|
11348
11339
|
const isSubmitDisabled = !hasToken || submitDisabled || !amountValue || amountValue === "0" || amountValue === "";
|
|
11349
11340
|
const [cardHovered, setCardHovered] = React6__namespace.default.useState(false);
|
|
11350
11341
|
const hideTimerRef = React6__namespace.default.useRef(void 0);
|
|
@@ -11505,7 +11496,21 @@ var EarnDepositFormViewSimple = ({
|
|
|
11505
11496
|
children: selectTokenLabel
|
|
11506
11497
|
}
|
|
11507
11498
|
),
|
|
11508
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
11499
|
+
hasError && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-[var(--deframe-widget-size-gap-sm)]", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
11500
|
+
EarnInlineNotificationSimpleView,
|
|
11501
|
+
{
|
|
11502
|
+
variant: "error",
|
|
11503
|
+
message: insufficientBalanceMessage || bytecodeErrorMessage
|
|
11504
|
+
}
|
|
11505
|
+
) }),
|
|
11506
|
+
showNoBalanceNotification ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-[var(--deframe-widget-size-gap-sm)]", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
11507
|
+
EarnNoBalanceNotificationView,
|
|
11508
|
+
{
|
|
11509
|
+
prompt: noBalancePrompt,
|
|
11510
|
+
actionLabel: goToSwapLabel,
|
|
11511
|
+
onAction: onGoToSwap
|
|
11512
|
+
}
|
|
11513
|
+
) }) : /* @__PURE__ */ jsxRuntime.jsx(framerMotion.AnimatePresence, { children: hasToken && cardHovered && /* @__PURE__ */ jsxRuntime.jsx(
|
|
11509
11514
|
framerMotion.motion.div,
|
|
11510
11515
|
{
|
|
11511
11516
|
"data-slot": "deposit-simple-chips-row",
|
|
@@ -11525,21 +11530,6 @@ var EarnDepositFormViewSimple = ({
|
|
|
11525
11530
|
}
|
|
11526
11531
|
)
|
|
11527
11532
|
}
|
|
11528
|
-
) }),
|
|
11529
|
-
showNoBalanceNotification && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-[var(--deframe-widget-size-gap-sm)]", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
11530
|
-
EarnNoBalanceNotificationView,
|
|
11531
|
-
{
|
|
11532
|
-
prompt: noBalancePrompt,
|
|
11533
|
-
actionLabel: goToSwapLabel,
|
|
11534
|
-
onAction: onGoToSwap
|
|
11535
|
-
}
|
|
11536
|
-
) }),
|
|
11537
|
-
bytecodeErrorMessage && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-[var(--deframe-widget-size-gap-sm)]", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
11538
|
-
EarnInlineNotificationSimpleView,
|
|
11539
|
-
{
|
|
11540
|
-
variant: "error",
|
|
11541
|
-
message: bytecodeErrorMessage
|
|
11542
|
-
}
|
|
11543
11533
|
) })
|
|
11544
11534
|
]
|
|
11545
11535
|
}
|
|
@@ -11795,6 +11785,8 @@ var EarnWithdrawFormViewSimple = ({
|
|
|
11795
11785
|
isTxError,
|
|
11796
11786
|
txSuccessMessage,
|
|
11797
11787
|
txErrorMessage,
|
|
11788
|
+
// Insufficient balance
|
|
11789
|
+
insufficientBalanceMessage,
|
|
11798
11790
|
// Bytecode error
|
|
11799
11791
|
bytecodeErrorMessage,
|
|
11800
11792
|
// Submit button
|
|
@@ -11802,7 +11794,7 @@ var EarnWithdrawFormViewSimple = ({
|
|
|
11802
11794
|
submitButtonText
|
|
11803
11795
|
}) => {
|
|
11804
11796
|
const hasToken = selectedToken != null;
|
|
11805
|
-
const hasError = !!bytecodeErrorMessage;
|
|
11797
|
+
const hasError = !!insufficientBalanceMessage || !!bytecodeErrorMessage;
|
|
11806
11798
|
const isSubmitDisabled = !hasToken || submitDisabled || !amountValue || amountValue === "0" || amountValue === "";
|
|
11807
11799
|
const [cardHovered, setCardHovered] = React6__namespace.default.useState(false);
|
|
11808
11800
|
const hideTimerRef = React6__namespace.default.useRef(void 0);
|
|
@@ -11981,11 +11973,11 @@ var EarnWithdrawFormViewSimple = ({
|
|
|
11981
11973
|
)
|
|
11982
11974
|
}
|
|
11983
11975
|
) }),
|
|
11984
|
-
|
|
11976
|
+
hasError && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-[var(--deframe-widget-size-gap-sm)]", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
11985
11977
|
EarnInlineNotificationSimpleView,
|
|
11986
11978
|
{
|
|
11987
11979
|
variant: "error",
|
|
11988
|
-
message: bytecodeErrorMessage
|
|
11980
|
+
message: insufficientBalanceMessage || bytecodeErrorMessage
|
|
11989
11981
|
}
|
|
11990
11982
|
) })
|
|
11991
11983
|
]
|