@deframe-sdk/components 0.1.57 → 0.1.59
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 +7 -4
- package/dist/index.d.ts +7 -4
- package/dist/index.js +86 -57
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +86 -57
- package/dist/index.mjs.map +1 -1
- package/dist/styles.css +3 -0
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -6048,7 +6048,7 @@ var SwapToCardView = ({
|
|
|
6048
6048
|
] }) });
|
|
6049
6049
|
};
|
|
6050
6050
|
var baseClasses = [
|
|
6051
|
-
"inline-flex items-center justify-center",
|
|
6051
|
+
"flex-1 inline-flex items-center justify-center",
|
|
6052
6052
|
"py-[3px] px-[10px]",
|
|
6053
6053
|
"rounded-[var(--deframe-widget-size-radius-full)]",
|
|
6054
6054
|
"cursor-pointer text-[12px] transition-all duration-150 outline-none",
|
|
@@ -6073,7 +6073,7 @@ var stateClasses = {
|
|
|
6073
6073
|
};
|
|
6074
6074
|
function SlippageChip({
|
|
6075
6075
|
options = [],
|
|
6076
|
-
selected =
|
|
6076
|
+
selected = void 0,
|
|
6077
6077
|
onSelect,
|
|
6078
6078
|
formatLabel,
|
|
6079
6079
|
className
|
|
@@ -6083,7 +6083,7 @@ function SlippageChip({
|
|
|
6083
6083
|
{
|
|
6084
6084
|
"data-test-id": "slippage-chips",
|
|
6085
6085
|
"data-slot": "slippage-chips",
|
|
6086
|
-
className: twMerge("flex
|
|
6086
|
+
className: twMerge("flex w-full gap-sm", className),
|
|
6087
6087
|
children: options.map((bps) => /* @__PURE__ */ jsx(
|
|
6088
6088
|
"button",
|
|
6089
6089
|
{
|
|
@@ -6094,7 +6094,7 @@ function SlippageChip({
|
|
|
6094
6094
|
className: twMerge(baseClasses, stateClasses[bps === selected ? "active" : "default"]),
|
|
6095
6095
|
children: formatLabel(bps)
|
|
6096
6096
|
},
|
|
6097
|
-
bps
|
|
6097
|
+
String(bps)
|
|
6098
6098
|
))
|
|
6099
6099
|
}
|
|
6100
6100
|
);
|
|
@@ -6107,6 +6107,7 @@ var SwapAdvancedSettingsView = ({
|
|
|
6107
6107
|
onSlippageSelect,
|
|
6108
6108
|
formatPercentage,
|
|
6109
6109
|
slippageOptions,
|
|
6110
|
+
slippageLabel,
|
|
6110
6111
|
percentageOptions,
|
|
6111
6112
|
onPercentageClick,
|
|
6112
6113
|
slippageFormatted,
|
|
@@ -6124,15 +6125,6 @@ var SwapAdvancedSettingsView = ({
|
|
|
6124
6125
|
collapseText,
|
|
6125
6126
|
expandText,
|
|
6126
6127
|
children: /* @__PURE__ */ jsxs("div", { className: "w-full flex flex-col gap-sm", children: [
|
|
6127
|
-
/* @__PURE__ */ jsx(
|
|
6128
|
-
SlippageChip,
|
|
6129
|
-
{
|
|
6130
|
-
options: slippageOptions,
|
|
6131
|
-
selected: slippageBps,
|
|
6132
|
-
onSelect: onSlippageSelect,
|
|
6133
|
-
formatLabel: formatPercentage
|
|
6134
|
-
}
|
|
6135
|
-
),
|
|
6136
6128
|
/* @__PURE__ */ jsx("div", { className: "flex w-full gap-sm", children: percentageOptions.map((pct, index) => {
|
|
6137
6129
|
const isMax = index === percentageOptions.length - 1;
|
|
6138
6130
|
const label = isMax ? maxLabel : `${pct / 100}%`;
|
|
@@ -6145,7 +6137,19 @@ var SwapAdvancedSettingsView = ({
|
|
|
6145
6137
|
},
|
|
6146
6138
|
pct
|
|
6147
6139
|
);
|
|
6148
|
-
}) })
|
|
6140
|
+
}) }),
|
|
6141
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-xs w-full", children: [
|
|
6142
|
+
/* @__PURE__ */ jsx("span", { className: "text-[11px] [font-weight:var(--deframe-widget-font-weight-medium)] text-[color:var(--deframe-widget-color-text-secondary)] font-[var(--deframe-widget-font-family)]", children: slippageLabel }),
|
|
6143
|
+
/* @__PURE__ */ jsx(
|
|
6144
|
+
SlippageChip,
|
|
6145
|
+
{
|
|
6146
|
+
options: slippageOptions,
|
|
6147
|
+
selected: slippageBps,
|
|
6148
|
+
onSelect: onSlippageSelect,
|
|
6149
|
+
formatLabel: formatPercentage
|
|
6150
|
+
}
|
|
6151
|
+
)
|
|
6152
|
+
] })
|
|
6149
6153
|
] })
|
|
6150
6154
|
}
|
|
6151
6155
|
) }) });
|
|
@@ -7748,13 +7752,13 @@ function SlippageDetailRow({ label, options, selected, onSelect: handleSelect, f
|
|
|
7748
7752
|
"div",
|
|
7749
7753
|
{
|
|
7750
7754
|
"data-test-id": "swap-form-simple-slippage-row",
|
|
7751
|
-
className: "flex
|
|
7755
|
+
className: "flex flex-col py-[10px] gap-[var(--deframe-widget-size-gap-sm)]",
|
|
7752
7756
|
children: [
|
|
7753
7757
|
/* @__PURE__ */ jsx(
|
|
7754
7758
|
"span",
|
|
7755
7759
|
{
|
|
7756
7760
|
"data-test-id": "swap-form-simple-detail-row-label",
|
|
7757
|
-
className: "text-[11px] [font-weight:var(--deframe-widget-font-weight-medium)] uppercase tracking-[0.07em] text-[color:var(--deframe-widget-color-text-tertiary)] font-[var(--deframe-widget-font-family)]
|
|
7761
|
+
className: "text-[11px] [font-weight:var(--deframe-widget-font-weight-medium)] uppercase tracking-[0.07em] text-[color:var(--deframe-widget-color-text-tertiary)] font-[var(--deframe-widget-font-family)]",
|
|
7758
7762
|
children: label
|
|
7759
7763
|
}
|
|
7760
7764
|
),
|
|
@@ -7765,7 +7769,7 @@ function SlippageDetailRow({ label, options, selected, onSelect: handleSelect, f
|
|
|
7765
7769
|
selected,
|
|
7766
7770
|
onSelect: handleSelect,
|
|
7767
7771
|
formatLabel,
|
|
7768
|
-
className: "gap-[4px] [&_button]:py-[2px] [&_button]:px-[7px] [&_button]:text-[11px]"
|
|
7772
|
+
className: "w-full gap-[4px] [&_button]:py-[2px] [&_button]:px-[7px] [&_button]:text-[11px]"
|
|
7769
7773
|
}
|
|
7770
7774
|
)
|
|
7771
7775
|
]
|
|
@@ -10504,7 +10508,7 @@ var ImageBannerCard = ({
|
|
|
10504
10508
|
}
|
|
10505
10509
|
);
|
|
10506
10510
|
};
|
|
10507
|
-
var GRID_COLS = "grid grid-cols-[
|
|
10511
|
+
var GRID_COLS = "grid grid-cols-[1fr_100px_100px_100px] gap-x-[var(--deframe-widget-size-gap-md)]";
|
|
10508
10512
|
var HISTORY_COLORS = {
|
|
10509
10513
|
deposit: "var(--deframe-widget-color-state-info)",
|
|
10510
10514
|
withdraw: "var(--deframe-widget-color-text-secondary)",
|
|
@@ -10516,6 +10520,7 @@ var EarnHubStrategyCard = ({
|
|
|
10516
10520
|
network,
|
|
10517
10521
|
investedFormatted,
|
|
10518
10522
|
earningsFormatted,
|
|
10523
|
+
profitFormatted,
|
|
10519
10524
|
isLoading,
|
|
10520
10525
|
onInvestClick,
|
|
10521
10526
|
onWithdrawClick,
|
|
@@ -10566,6 +10571,7 @@ var EarnHubStrategyCard = ({
|
|
|
10566
10571
|
children: earningsFormatted
|
|
10567
10572
|
}
|
|
10568
10573
|
) }),
|
|
10574
|
+
/* @__PURE__ */ jsx("div", { className: "flex justify-center", children: isLoading ? /* @__PURE__ */ jsx(Skeleton, { variant: "rect", width: 50, height: 16 }) : profitFormatted ? /* @__PURE__ */ jsx("span", { className: "text-[length:var(--deframe-widget-font-size-sm)] [font-weight:var(--deframe-widget-font-weight-semibold)] text-[color:var(--deframe-widget-color-text-primary)] font-[var(--deframe-widget-font-family)] leading-none", children: profitFormatted }) : /* @__PURE__ */ jsx("span", { className: "text-[length:var(--deframe-widget-font-size-xs)] text-[color:var(--deframe-widget-color-text-tertiary)]", children: "\u2014" }) }),
|
|
10569
10575
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-end gap-[var(--deframe-widget-size-gap-xs)]", children: [
|
|
10570
10576
|
/* @__PURE__ */ jsx("div", { className: "flex flex-col items-end", children: isLoading ? /* @__PURE__ */ jsx(Skeleton, { variant: "rect", width: 60, height: 16 }) : investedFormatted ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
10571
10577
|
/* @__PURE__ */ jsx("span", { className: "text-[length:var(--deframe-widget-font-size-sm)] [font-weight:var(--deframe-widget-font-weight-semibold)] text-[color:var(--deframe-widget-color-text-primary)] leading-[var(--deframe-widget-font-leading-sm)] font-[var(--deframe-widget-font-family)]", children: investedFormatted }),
|
|
@@ -10769,7 +10775,7 @@ var columnHeaderClasses = [
|
|
|
10769
10775
|
"text-[color:var(--deframe-widget-color-text-tertiary)]",
|
|
10770
10776
|
"leading-[var(--deframe-widget-font-leading-xs)]"
|
|
10771
10777
|
].join(" ");
|
|
10772
|
-
var GRID_COLS2 = "grid grid-cols-[
|
|
10778
|
+
var GRID_COLS2 = "grid grid-cols-[1fr_100px_100px_100px] gap-x-[var(--deframe-widget-size-gap-md)]";
|
|
10773
10779
|
var BANNER_COLORS = [
|
|
10774
10780
|
"var(--deframe-widget-color-brand-primary)",
|
|
10775
10781
|
"var(--deframe-widget-color-brand-secondary)"
|
|
@@ -10866,6 +10872,7 @@ var EarnDesktopViewSimple = ({
|
|
|
10866
10872
|
network: p.strategy.network,
|
|
10867
10873
|
investedFormatted: formatCurrency(p.spotPosition.underlyingBalanceUSD),
|
|
10868
10874
|
earningsFormatted: `${(p.spotPosition.apy * 100).toFixed(2)}%`,
|
|
10875
|
+
profitFormatted: formatCurrency(p.spotPosition.profitInUSD),
|
|
10869
10876
|
isLoading: false,
|
|
10870
10877
|
history: (_a = historyByAsset.get(p.strategy.assetName.toUpperCase())) != null ? _a : [],
|
|
10871
10878
|
onInvestClick: onDeposit ? () => onDeposit(p.strategy.id) : () => {
|
|
@@ -11016,13 +11023,13 @@ var EarnDesktopViewSimple = ({
|
|
|
11016
11023
|
"px-[var(--deframe-widget-size-padding-x-md)] py-[var(--deframe-widget-size-padding-y-sm)]",
|
|
11017
11024
|
"border-t border-[color:var(--deframe-widget-color-border-secondary)]"
|
|
11018
11025
|
),
|
|
11019
|
-
children: [labels == null ? void 0 : labels.columnStrategy, labels == null ? void 0 : labels.
|
|
11026
|
+
children: [labels == null ? void 0 : labels.columnStrategy, labels == null ? void 0 : labels.columnApy, labels == null ? void 0 : labels.columnProfit, labels == null ? void 0 : labels.columnInvested].map((label, i) => /* @__PURE__ */ jsx(
|
|
11020
11027
|
"span",
|
|
11021
11028
|
{
|
|
11022
11029
|
className: twMerge(
|
|
11023
11030
|
columnHeaderClasses,
|
|
11024
|
-
i === 1 && "text-center",
|
|
11025
|
-
i ===
|
|
11031
|
+
(i === 1 || i === 2) && "text-center",
|
|
11032
|
+
i === 3 && "text-right"
|
|
11026
11033
|
),
|
|
11027
11034
|
children: label
|
|
11028
11035
|
},
|
|
@@ -16362,6 +16369,7 @@ var OnrampFormSimpleView = ({
|
|
|
16362
16369
|
error
|
|
16363
16370
|
}) => {
|
|
16364
16371
|
const hasPixCode = !!pixCode;
|
|
16372
|
+
const isWaitingForPixPayment = hasPixCode && !isExpired;
|
|
16365
16373
|
const isSubmitDisabled = !amount || amount === "0" || amount === "" || isBelowMinAmount || hasNoAmount || isProcessing;
|
|
16366
16374
|
const panelBaseClasses = [
|
|
16367
16375
|
"relative flex flex-col overflow-hidden w-[420px]",
|
|
@@ -16408,6 +16416,61 @@ var OnrampFormSimpleView = ({
|
|
|
16408
16416
|
"hover:bg-[color:color-mix(in_srgb,var(--deframe-widget-color-bg-tertiary)_60%,transparent)]",
|
|
16409
16417
|
"hover:text-[color:var(--deframe-widget-color-text-primary)]"
|
|
16410
16418
|
].join(" ");
|
|
16419
|
+
let footerContent;
|
|
16420
|
+
if (!hasPixCode) {
|
|
16421
|
+
footerContent = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
16422
|
+
/* @__PURE__ */ jsx(
|
|
16423
|
+
SecondaryButton,
|
|
16424
|
+
{
|
|
16425
|
+
type: "button",
|
|
16426
|
+
className: secondaryButtonClasses,
|
|
16427
|
+
onClick: onBack,
|
|
16428
|
+
"aria-label": "Cancelar dep\xF3sito",
|
|
16429
|
+
"data-test-id": "onramp-form-simple-view-cancel",
|
|
16430
|
+
children: "Cancelar"
|
|
16431
|
+
}
|
|
16432
|
+
),
|
|
16433
|
+
/* @__PURE__ */ jsx(
|
|
16434
|
+
PrimaryButton,
|
|
16435
|
+
{
|
|
16436
|
+
type: "button",
|
|
16437
|
+
className: "flex-1 h-12 rounded-[var(--deframe-widget-size-radius-sm)] text-[15px]",
|
|
16438
|
+
onClick: onSubmit,
|
|
16439
|
+
disabled: isSubmitDisabled,
|
|
16440
|
+
"aria-label": submitLabel,
|
|
16441
|
+
"data-test-id": "onramp-form-simple-view-submit",
|
|
16442
|
+
children: isProcessing ? "Processando..." : submitLabel
|
|
16443
|
+
}
|
|
16444
|
+
)
|
|
16445
|
+
] });
|
|
16446
|
+
} else if (isWaitingForPixPayment) {
|
|
16447
|
+
footerContent = /* @__PURE__ */ jsxs(
|
|
16448
|
+
PrimaryButton,
|
|
16449
|
+
{
|
|
16450
|
+
type: "button",
|
|
16451
|
+
className: "w-full h-12 rounded-[var(--deframe-widget-size-radius-sm)] text-[15px]",
|
|
16452
|
+
disabled: true,
|
|
16453
|
+
"aria-label": "Aguardando pagamento PIX",
|
|
16454
|
+
"data-test-id": "onramp-form-simple-view-waiting-payment",
|
|
16455
|
+
children: [
|
|
16456
|
+
"Aguardando pagamento ",
|
|
16457
|
+
/* @__PURE__ */ jsx(LoadingDots, {})
|
|
16458
|
+
]
|
|
16459
|
+
}
|
|
16460
|
+
);
|
|
16461
|
+
} else {
|
|
16462
|
+
footerContent = /* @__PURE__ */ jsx(
|
|
16463
|
+
SecondaryButton,
|
|
16464
|
+
{
|
|
16465
|
+
type: "button",
|
|
16466
|
+
className: twMerge(secondaryButtonClasses, "w-full"),
|
|
16467
|
+
onClick: onBack,
|
|
16468
|
+
"aria-label": "Cancelar",
|
|
16469
|
+
"data-test-id": "onramp-form-simple-view-cancel",
|
|
16470
|
+
children: "Cancelar"
|
|
16471
|
+
}
|
|
16472
|
+
);
|
|
16473
|
+
}
|
|
16411
16474
|
return /* @__PURE__ */ jsxs(
|
|
16412
16475
|
"div",
|
|
16413
16476
|
{
|
|
@@ -16744,41 +16807,7 @@ var OnrampFormSimpleView = ({
|
|
|
16744
16807
|
"data-slot": "onramp-form-simple-footer",
|
|
16745
16808
|
"data-test-id": "onramp-form-simple-view-footer",
|
|
16746
16809
|
className: footerBaseClasses,
|
|
16747
|
-
children:
|
|
16748
|
-
/* @__PURE__ */ jsx(
|
|
16749
|
-
SecondaryButton,
|
|
16750
|
-
{
|
|
16751
|
-
type: "button",
|
|
16752
|
-
className: secondaryButtonClasses,
|
|
16753
|
-
onClick: onBack,
|
|
16754
|
-
"aria-label": "Cancelar dep\xF3sito",
|
|
16755
|
-
"data-test-id": "onramp-form-simple-view-cancel",
|
|
16756
|
-
children: "Cancelar"
|
|
16757
|
-
}
|
|
16758
|
-
),
|
|
16759
|
-
/* @__PURE__ */ jsx(
|
|
16760
|
-
PrimaryButton,
|
|
16761
|
-
{
|
|
16762
|
-
type: "button",
|
|
16763
|
-
className: "flex-1 h-12 rounded-[var(--deframe-widget-size-radius-sm)] text-[15px]",
|
|
16764
|
-
onClick: onSubmit,
|
|
16765
|
-
disabled: isSubmitDisabled,
|
|
16766
|
-
"aria-label": submitLabel,
|
|
16767
|
-
"data-test-id": "onramp-form-simple-view-submit",
|
|
16768
|
-
children: isProcessing ? "Processando..." : submitLabel
|
|
16769
|
-
}
|
|
16770
|
-
)
|
|
16771
|
-
] }) : /* @__PURE__ */ jsx(
|
|
16772
|
-
SecondaryButton,
|
|
16773
|
-
{
|
|
16774
|
-
type: "button",
|
|
16775
|
-
className: twMerge(secondaryButtonClasses, "w-full"),
|
|
16776
|
-
onClick: onBack,
|
|
16777
|
-
"aria-label": "Cancelar",
|
|
16778
|
-
"data-test-id": "onramp-form-simple-view-cancel",
|
|
16779
|
-
children: "Cancelar"
|
|
16780
|
-
}
|
|
16781
|
-
)
|
|
16810
|
+
children: footerContent
|
|
16782
16811
|
}
|
|
16783
16812
|
)
|
|
16784
16813
|
]
|