@deframe-sdk/components 0.1.71 → 0.1.73
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 +13 -5
- package/dist/index.d.ts +13 -5
- package/dist/index.js +196 -89
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +197 -90
- package/dist/index.mjs.map +1 -1
- package/dist/styles.css +21 -0
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -2,7 +2,7 @@ import { twMerge } from 'tailwind-merge';
|
|
|
2
2
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
3
3
|
import { HiXMark, HiChevronUp, HiChevronDown, HiChevronLeft, HiOutlineClock, HiArrowRight, HiArrowLeft } from 'react-icons/hi2';
|
|
4
4
|
import * as React6 from 'react';
|
|
5
|
-
import React6__default, { useMemo, useState, useEffect, useRef, useCallback } from 'react';
|
|
5
|
+
import React6__default, { useMemo, useState, useEffect, useRef, useCallback, useId } from 'react';
|
|
6
6
|
import { motion, AnimatePresence } from 'framer-motion';
|
|
7
7
|
import { MdClose, MdOutlineSearch, MdOutlineSearchOff, MdOutlineSwapHoriz, MdHistory, MdOutlineSwapVert, MdArrowRight, MdArrowDropDown, MdOutlineArrowBack, MdOutlineArrowDropDown, MdOutlineClose, MdContentCopy, MdOutlineExpandMore, MdQrCodeScanner, MdOutlineArrowUpward, MdOutlineArrowDownward, MdCheckCircleOutline, MdErrorOutline, MdWarningAmber, MdInfoOutline, MdAccessTime, MdArrowUpward, MdArrowDownward } from 'react-icons/md';
|
|
8
8
|
import { IoAlertCircleOutline, IoTimeOutline, IoCheckmarkOutline } from 'react-icons/io5';
|
|
@@ -2106,8 +2106,8 @@ var ActionSheet = ({
|
|
|
2106
2106
|
document.addEventListener("keydown", handleEscape);
|
|
2107
2107
|
return () => document.removeEventListener("keydown", handleEscape);
|
|
2108
2108
|
}, [isThisSheetActive, onClose]);
|
|
2109
|
-
const handleBackdropClick = (
|
|
2110
|
-
if (closeOnBackdropClick
|
|
2109
|
+
const handleBackdropClick = () => {
|
|
2110
|
+
if (closeOnBackdropClick) {
|
|
2111
2111
|
onClose == null ? void 0 : onClose();
|
|
2112
2112
|
}
|
|
2113
2113
|
};
|
|
@@ -2189,6 +2189,7 @@ var ActionSheet = ({
|
|
|
2189
2189
|
/* @__PURE__ */ jsx(
|
|
2190
2190
|
motion.div,
|
|
2191
2191
|
{
|
|
2192
|
+
onClick: (e) => e.stopPropagation(),
|
|
2192
2193
|
className: twMerge(
|
|
2193
2194
|
"relative w-full bg-[var(--deframe-widget-color-bg-secondary)] shadow-[0_20px_50px_color-mix(in_srgb,var(--deframe-widget-color-text-primary)_28%,transparent)] overflow-hidden",
|
|
2194
2195
|
position === "bottom" ? "max-w-full rounded-t-[var(--deframe-widget-size-radius-xl)]" : "max-w-lg rounded-[var(--deframe-widget-size-radius-xl)] mx-[var(--deframe-widget-size-gap-md)]",
|
|
@@ -4409,11 +4410,20 @@ var SearchInput = ({
|
|
|
4409
4410
|
inputTestId
|
|
4410
4411
|
}) => {
|
|
4411
4412
|
const [internalValue, setInternalValue] = useState(controlledValue || "");
|
|
4413
|
+
const inputRef = React6__default.useRef(null);
|
|
4412
4414
|
useEffect(() => {
|
|
4413
4415
|
if (controlledValue !== void 0) {
|
|
4414
4416
|
setInternalValue(controlledValue);
|
|
4415
4417
|
}
|
|
4416
4418
|
}, [controlledValue]);
|
|
4419
|
+
useEffect(() => {
|
|
4420
|
+
if (!autoFocus || disabled) return;
|
|
4421
|
+
const frameId = requestAnimationFrame(() => {
|
|
4422
|
+
var _a;
|
|
4423
|
+
return (_a = inputRef.current) == null ? void 0 : _a.focus();
|
|
4424
|
+
});
|
|
4425
|
+
return () => cancelAnimationFrame(frameId);
|
|
4426
|
+
}, [autoFocus, disabled]);
|
|
4417
4427
|
const handleInputChange = (newValue) => {
|
|
4418
4428
|
setInternalValue(newValue);
|
|
4419
4429
|
onChange == null ? void 0 : onChange(newValue);
|
|
@@ -4423,6 +4433,7 @@ var SearchInput = ({
|
|
|
4423
4433
|
/* @__PURE__ */ jsx(
|
|
4424
4434
|
"input",
|
|
4425
4435
|
{
|
|
4436
|
+
ref: inputRef,
|
|
4426
4437
|
"data-testid": inputTestId,
|
|
4427
4438
|
type: "text",
|
|
4428
4439
|
value: internalValue,
|
|
@@ -6320,6 +6331,7 @@ var ChooseAnAssetSwapView = ({
|
|
|
6320
6331
|
onClose,
|
|
6321
6332
|
onSearch,
|
|
6322
6333
|
autoFocus,
|
|
6334
|
+
closeOnBackdropClick = true,
|
|
6323
6335
|
displayedTokens,
|
|
6324
6336
|
hasMore,
|
|
6325
6337
|
onLoadMore,
|
|
@@ -6344,6 +6356,7 @@ var ChooseAnAssetSwapView = ({
|
|
|
6344
6356
|
onClose,
|
|
6345
6357
|
position: "bottom",
|
|
6346
6358
|
height: "full",
|
|
6359
|
+
closeOnBackdropClick,
|
|
6347
6360
|
contentClassName: "w-full max-w-[620px] mx-auto",
|
|
6348
6361
|
children: /* @__PURE__ */ jsxs(BackgroundContainer, { className: "flex flex-col h-full", children: [
|
|
6349
6362
|
/* @__PURE__ */ jsx(Navbar, { children: /* @__PURE__ */ jsx(CloseButton_default, { testId: `swap-token-actionsheet-close-${actionSheetId}`, onClick: onClose }) }),
|
|
@@ -6965,6 +6978,7 @@ var SwapFormView = ({
|
|
|
6965
6978
|
onHistoryClick,
|
|
6966
6979
|
onSwitchTokens,
|
|
6967
6980
|
switchTokensAriaLabel,
|
|
6981
|
+
showHistoryTooltip = false,
|
|
6968
6982
|
fromCard,
|
|
6969
6983
|
toCard,
|
|
6970
6984
|
advancedSettings,
|
|
@@ -6972,6 +6986,8 @@ var SwapFormView = ({
|
|
|
6972
6986
|
priceImpactWarning,
|
|
6973
6987
|
confirmButton
|
|
6974
6988
|
}) => {
|
|
6989
|
+
const historyTooltipId = React6__default.useId();
|
|
6990
|
+
const historyTooltipProps = showHistoryTooltip ? { "aria-describedby": historyTooltipId, title: labels.historyAriaLabel } : {};
|
|
6975
6991
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
6976
6992
|
/* @__PURE__ */ jsx(
|
|
6977
6993
|
"div",
|
|
@@ -6984,17 +7000,29 @@ var SwapFormView = ({
|
|
|
6984
7000
|
/* @__PURE__ */ jsx(TextHeading, { variant: "h5", className: "!text-[21px]", children: /* @__PURE__ */ jsx("span", { "data-testid": "swap-flow-title", children: labels.title }) }),
|
|
6985
7001
|
labels.subtitle && /* @__PURE__ */ jsx(TextBody, { variant: "text-small", className: "!text-[14px]", children: labels.subtitle })
|
|
6986
7002
|
] }),
|
|
6987
|
-
/* @__PURE__ */
|
|
6988
|
-
|
|
6989
|
-
|
|
6990
|
-
|
|
6991
|
-
|
|
6992
|
-
|
|
6993
|
-
|
|
6994
|
-
|
|
6995
|
-
|
|
6996
|
-
|
|
6997
|
-
|
|
7003
|
+
/* @__PURE__ */ jsxs("div", { className: "relative inline-flex group", children: [
|
|
7004
|
+
/* @__PURE__ */ jsx(
|
|
7005
|
+
"button",
|
|
7006
|
+
__spreadProps(__spreadValues({
|
|
7007
|
+
"data-testid": "swap-history-button",
|
|
7008
|
+
type: "button",
|
|
7009
|
+
onClick: onHistoryClick,
|
|
7010
|
+
className: "flex items-center justify-center w-12 h-12 transition-colors rounded-full cursor-pointer text-[color:var(--deframe-widget-color-text-secondary)] dark:text-[color:var(--deframe-widget-color-text-secondary-dark)] hover:text-brand-primary",
|
|
7011
|
+
"aria-label": labels.historyAriaLabel
|
|
7012
|
+
}, historyTooltipProps), {
|
|
7013
|
+
children: /* @__PURE__ */ jsx(MdHistory, { className: "w-6 h-6" })
|
|
7014
|
+
})
|
|
7015
|
+
),
|
|
7016
|
+
showHistoryTooltip && /* @__PURE__ */ jsx(
|
|
7017
|
+
"span",
|
|
7018
|
+
{
|
|
7019
|
+
id: historyTooltipId,
|
|
7020
|
+
role: "tooltip",
|
|
7021
|
+
className: "pointer-events-none absolute right-0 top-full z-10 mt-1 whitespace-nowrap rounded-[var(--deframe-widget-size-radius-xs)] bg-[var(--deframe-widget-color-bg-tertiary)] px-2 py-1 text-xs text-[color:var(--deframe-widget-color-text-primary)] opacity-0 shadow-lg transition-opacity group-hover:opacity-100 group-focus-within:opacity-100",
|
|
7022
|
+
children: labels.historyAriaLabel
|
|
7023
|
+
}
|
|
7024
|
+
)
|
|
7025
|
+
] })
|
|
6998
7026
|
] }),
|
|
6999
7027
|
/* @__PURE__ */ jsxs("div", { className: "relative flex flex-col items-stretch gap-sm", children: [
|
|
7000
7028
|
/* @__PURE__ */ jsx(SwapFromCardView, __spreadValues({}, fromCard)),
|
|
@@ -7914,6 +7942,10 @@ var ConfirmSwapButtonViewSimple = ({
|
|
|
7914
7942
|
}
|
|
7915
7943
|
) });
|
|
7916
7944
|
};
|
|
7945
|
+
var simpleDirectionRowClassNames = {
|
|
7946
|
+
default: "flex justify-center relative -my-[16px] z-[1]",
|
|
7947
|
+
compact: "flex justify-center relative -my-[12px] z-[1]"
|
|
7948
|
+
};
|
|
7917
7949
|
var SwapFormViewSimple = ({
|
|
7918
7950
|
onSubmit,
|
|
7919
7951
|
formRef,
|
|
@@ -7921,6 +7953,8 @@ var SwapFormViewSimple = ({
|
|
|
7921
7953
|
onHistoryClick,
|
|
7922
7954
|
onSwitchTokens,
|
|
7923
7955
|
switchTokensAriaLabel,
|
|
7956
|
+
showHistoryTooltip = false,
|
|
7957
|
+
directionButtonSpacing = "default",
|
|
7924
7958
|
fromCard,
|
|
7925
7959
|
toCard,
|
|
7926
7960
|
advancedSettings,
|
|
@@ -7931,6 +7965,7 @@ var SwapFormViewSimple = ({
|
|
|
7931
7965
|
const containerRef = useRef(null);
|
|
7932
7966
|
const [panelPos, setPanelPos] = useState(null);
|
|
7933
7967
|
const [showPanel, setShowPanel] = useState(false);
|
|
7968
|
+
const directionRowClassName = simpleDirectionRowClassNames[directionButtonSpacing];
|
|
7934
7969
|
useEffect(() => {
|
|
7935
7970
|
if (!advancedSettings.isOpen) setShowPanel(false);
|
|
7936
7971
|
}, [advancedSettings.isOpen]);
|
|
@@ -7980,7 +8015,7 @@ var SwapFormViewSimple = ({
|
|
|
7980
8015
|
{
|
|
7981
8016
|
"data-test-id": "swap-form-simple-top-row",
|
|
7982
8017
|
className: "flex items-center justify-end mb-[var(--deframe-widget-size-gap-sm)]",
|
|
7983
|
-
children: /* @__PURE__ */ jsx(HistoryButton, { onClick: onHistoryClick, ariaLabel: labels.historyAriaLabel })
|
|
8018
|
+
children: /* @__PURE__ */ jsx(HistoryButton, { onClick: onHistoryClick, ariaLabel: labels.historyAriaLabel, showTooltip: showHistoryTooltip })
|
|
7984
8019
|
}
|
|
7985
8020
|
),
|
|
7986
8021
|
/* @__PURE__ */ jsx(
|
|
@@ -7999,7 +8034,7 @@ var SwapFormViewSimple = ({
|
|
|
7999
8034
|
"div",
|
|
8000
8035
|
{
|
|
8001
8036
|
"data-test-id": "swap-form-simple-direction-row",
|
|
8002
|
-
className:
|
|
8037
|
+
className: directionRowClassName,
|
|
8003
8038
|
children: /* @__PURE__ */ jsx(
|
|
8004
8039
|
SwapDirectionButton,
|
|
8005
8040
|
{
|
|
@@ -8088,48 +8123,72 @@ var SwapFormViewSimple = ({
|
|
|
8088
8123
|
}
|
|
8089
8124
|
);
|
|
8090
8125
|
};
|
|
8091
|
-
function HistoryButton({ onClick, ariaLabel }) {
|
|
8092
|
-
|
|
8093
|
-
|
|
8094
|
-
|
|
8095
|
-
|
|
8096
|
-
|
|
8097
|
-
|
|
8098
|
-
|
|
8099
|
-
|
|
8100
|
-
|
|
8101
|
-
"
|
|
8102
|
-
|
|
8103
|
-
|
|
8104
|
-
|
|
8105
|
-
|
|
8106
|
-
|
|
8107
|
-
|
|
8108
|
-
|
|
8109
|
-
|
|
8110
|
-
|
|
8111
|
-
|
|
8112
|
-
|
|
8113
|
-
|
|
8114
|
-
|
|
8115
|
-
|
|
8116
|
-
|
|
8117
|
-
|
|
8118
|
-
|
|
8119
|
-
|
|
8120
|
-
|
|
8121
|
-
|
|
8122
|
-
|
|
8123
|
-
|
|
8124
|
-
|
|
8125
|
-
|
|
8126
|
-
|
|
8127
|
-
|
|
8128
|
-
|
|
8129
|
-
|
|
8130
|
-
|
|
8131
|
-
|
|
8132
|
-
|
|
8126
|
+
function HistoryButton({ onClick, ariaLabel, showTooltip }) {
|
|
8127
|
+
const tooltipId = useId();
|
|
8128
|
+
const tooltipProps = showTooltip ? { "aria-describedby": tooltipId, title: ariaLabel } : {};
|
|
8129
|
+
return /* @__PURE__ */ jsxs("div", { className: "relative inline-flex group", children: [
|
|
8130
|
+
/* @__PURE__ */ jsx(
|
|
8131
|
+
"button",
|
|
8132
|
+
__spreadProps(__spreadValues({
|
|
8133
|
+
"data-test-id": "swap-form-simple-history-button",
|
|
8134
|
+
type: "button",
|
|
8135
|
+
onClick,
|
|
8136
|
+
"aria-label": ariaLabel
|
|
8137
|
+
}, tooltipProps), {
|
|
8138
|
+
className: twMerge(
|
|
8139
|
+
"inline-flex items-center justify-center",
|
|
8140
|
+
"w-9 h-9",
|
|
8141
|
+
"rounded-[var(--deframe-widget-size-radius-sm)]",
|
|
8142
|
+
"border-none",
|
|
8143
|
+
"cursor-pointer",
|
|
8144
|
+
"bg-transparent",
|
|
8145
|
+
"hover:bg-[color:color-mix(in_srgb,var(--deframe-widget-color-bg-tertiary)_92%,transparent)]",
|
|
8146
|
+
"transition-[background] duration-150",
|
|
8147
|
+
"flex-shrink-0",
|
|
8148
|
+
"outline-none",
|
|
8149
|
+
"text-[color:var(--deframe-widget-color-text-secondary)]"
|
|
8150
|
+
),
|
|
8151
|
+
children: /* @__PURE__ */ jsxs(
|
|
8152
|
+
"svg",
|
|
8153
|
+
{
|
|
8154
|
+
"data-test-id": "swap-form-simple-history-icon",
|
|
8155
|
+
viewBox: "0 0 24 24",
|
|
8156
|
+
width: "20",
|
|
8157
|
+
height: "20",
|
|
8158
|
+
fill: "none",
|
|
8159
|
+
stroke: "currentColor",
|
|
8160
|
+
strokeWidth: "2",
|
|
8161
|
+
strokeLinecap: "round",
|
|
8162
|
+
strokeLinejoin: "round",
|
|
8163
|
+
"aria-hidden": "true",
|
|
8164
|
+
children: [
|
|
8165
|
+
/* @__PURE__ */ jsx("circle", { cx: "12", cy: "12", r: "10" }),
|
|
8166
|
+
/* @__PURE__ */ jsx("polyline", { points: "12 6 12 12 16 14" })
|
|
8167
|
+
]
|
|
8168
|
+
}
|
|
8169
|
+
)
|
|
8170
|
+
})
|
|
8171
|
+
),
|
|
8172
|
+
showTooltip && /* @__PURE__ */ jsx(
|
|
8173
|
+
"span",
|
|
8174
|
+
{
|
|
8175
|
+
id: tooltipId,
|
|
8176
|
+
role: "tooltip",
|
|
8177
|
+
className: twMerge(
|
|
8178
|
+
"pointer-events-none absolute right-0 top-full z-10 mt-[6px]",
|
|
8179
|
+
"rounded-[var(--deframe-widget-size-radius-xs)]",
|
|
8180
|
+
"bg-[var(--deframe-widget-color-bg-tertiary)]",
|
|
8181
|
+
"px-[8px] py-[5px]",
|
|
8182
|
+
"text-[12px] [font-weight:var(--deframe-widget-font-weight-medium)]",
|
|
8183
|
+
"text-[color:var(--deframe-widget-color-text-primary)]",
|
|
8184
|
+
"whitespace-nowrap shadow-[0px_4px_16px_0px_#00000066]",
|
|
8185
|
+
"opacity-0 transition-opacity duration-150",
|
|
8186
|
+
"group-hover:opacity-100 group-focus-within:opacity-100"
|
|
8187
|
+
),
|
|
8188
|
+
children: ariaLabel
|
|
8189
|
+
}
|
|
8190
|
+
)
|
|
8191
|
+
] });
|
|
8133
8192
|
}
|
|
8134
8193
|
function SwapDirectionButton({ onClick, ariaLabel }) {
|
|
8135
8194
|
const [isHovered, setIsHovered] = useState(false);
|
|
@@ -9076,6 +9135,7 @@ function ChooseNetworkAndAssetViewSimple({
|
|
|
9076
9135
|
onAssetClick,
|
|
9077
9136
|
onSearch,
|
|
9078
9137
|
autoFocus,
|
|
9138
|
+
closeOnBackdropClick = true,
|
|
9079
9139
|
hasMore,
|
|
9080
9140
|
onLoadMore,
|
|
9081
9141
|
isFetching,
|
|
@@ -9092,6 +9152,9 @@ function ChooseNetworkAndAssetViewSimple({
|
|
|
9092
9152
|
setQuery(q);
|
|
9093
9153
|
onSearch(q);
|
|
9094
9154
|
}, [onSearch]);
|
|
9155
|
+
const handleBackdropClick = React6.useCallback(() => {
|
|
9156
|
+
if (closeOnBackdropClick) onClose();
|
|
9157
|
+
}, [closeOnBackdropClick, onClose]);
|
|
9095
9158
|
const handleNetworkSelect = React6.useCallback((network) => {
|
|
9096
9159
|
var _a2;
|
|
9097
9160
|
setQuery("");
|
|
@@ -9182,7 +9245,7 @@ function ChooseNetworkAndAssetViewSimple({
|
|
|
9182
9245
|
animate: { opacity: 1 },
|
|
9183
9246
|
exit: { opacity: 0 },
|
|
9184
9247
|
transition: { duration: 0.2 },
|
|
9185
|
-
onClick:
|
|
9248
|
+
onClick: handleBackdropClick,
|
|
9186
9249
|
"data-test-id": "backdrop",
|
|
9187
9250
|
className: "fixed inset-0 bg-[color:color-mix(in_srgb,var(--deframe-widget-color-bg-primary)_88%,transparent)] backdrop-blur-[4px] z-50 flex flex-col justify-end",
|
|
9188
9251
|
children: /* @__PURE__ */ jsxs(
|
|
@@ -9306,7 +9369,7 @@ function ChooseNetworkAndAssetViewSimple({
|
|
|
9306
9369
|
animate: { opacity: 1 },
|
|
9307
9370
|
exit: { opacity: 0 },
|
|
9308
9371
|
transition: { duration: 0.2 },
|
|
9309
|
-
onClick:
|
|
9372
|
+
onClick: handleBackdropClick,
|
|
9310
9373
|
"data-test-id": "backdrop",
|
|
9311
9374
|
className: "fixed inset-0 bg-[color:color-mix(in_srgb,var(--deframe-widget-color-bg-primary)_88%,transparent)] backdrop-blur-[4px] z-50 flex items-center justify-center px-[var(--deframe-widget-size-padding-x-md)] py-[var(--deframe-widget-size-padding-y-md)]",
|
|
9312
9375
|
children: /* @__PURE__ */ jsxs(
|
|
@@ -9668,20 +9731,29 @@ var SwapHistoryView = ({
|
|
|
9668
9731
|
isLoading,
|
|
9669
9732
|
items,
|
|
9670
9733
|
onItemClick,
|
|
9734
|
+
onClose,
|
|
9671
9735
|
pageSize = 10
|
|
9672
9736
|
}) => {
|
|
9737
|
+
var _a;
|
|
9673
9738
|
const [visibleCount, setVisibleCount] = React6__default.useState(pageSize);
|
|
9739
|
+
const backHeader = onClose ? /* @__PURE__ */ jsx(DetailsHeader, { title: (_a = labels.title) != null ? _a : "", onBack: onClose, backAriaLabel: labels.closeAriaLabel, className: "px-0 pt-0" }) : null;
|
|
9674
9740
|
if (isLoading) {
|
|
9675
|
-
return /* @__PURE__ */
|
|
9741
|
+
return /* @__PURE__ */ jsxs(BackgroundContainer, { className: "px-[var(--deframe-widget-size-padding-x-md)] py-[var(--deframe-widget-size-padding-y-md)] flex flex-col min-h-0 flex-1", children: [
|
|
9742
|
+
backHeader,
|
|
9743
|
+
/* @__PURE__ */ jsx(LoadingSkeleton, {})
|
|
9744
|
+
] });
|
|
9676
9745
|
}
|
|
9677
9746
|
if (items.length === 0) {
|
|
9678
|
-
return /* @__PURE__ */
|
|
9679
|
-
|
|
9680
|
-
|
|
9681
|
-
|
|
9682
|
-
|
|
9683
|
-
|
|
9684
|
-
|
|
9747
|
+
return /* @__PURE__ */ jsxs(BackgroundContainer, { className: "px-[var(--deframe-widget-size-padding-x-md)] py-[var(--deframe-widget-size-padding-y-md)] flex flex-col min-h-0 flex-1", children: [
|
|
9748
|
+
backHeader,
|
|
9749
|
+
/* @__PURE__ */ jsx(
|
|
9750
|
+
EmptyState,
|
|
9751
|
+
{
|
|
9752
|
+
title: labels.emptyTitle,
|
|
9753
|
+
description: labels.emptyDescription
|
|
9754
|
+
}
|
|
9755
|
+
)
|
|
9756
|
+
] });
|
|
9685
9757
|
}
|
|
9686
9758
|
const visibleItems = items.slice(0, visibleCount);
|
|
9687
9759
|
const grouped = /* @__PURE__ */ new Map();
|
|
@@ -9696,26 +9768,29 @@ var SwapHistoryView = ({
|
|
|
9696
9768
|
}
|
|
9697
9769
|
const sortedDates = Array.from(grouped.keys()).sort((a, b) => b.localeCompare(a));
|
|
9698
9770
|
const hasMore = items.length > visibleCount;
|
|
9699
|
-
return /* @__PURE__ */
|
|
9700
|
-
|
|
9701
|
-
|
|
9702
|
-
|
|
9703
|
-
|
|
9704
|
-
|
|
9705
|
-
|
|
9706
|
-
|
|
9707
|
-
|
|
9708
|
-
|
|
9709
|
-
|
|
9710
|
-
|
|
9711
|
-
|
|
9712
|
-
|
|
9713
|
-
|
|
9714
|
-
|
|
9715
|
-
|
|
9716
|
-
|
|
9717
|
-
|
|
9718
|
-
|
|
9771
|
+
return /* @__PURE__ */ jsxs(BackgroundContainer, { className: "px-[var(--deframe-widget-size-padding-x-md)] py-[var(--deframe-widget-size-padding-y-md)] flex flex-col min-h-0 flex-1", children: [
|
|
9772
|
+
backHeader,
|
|
9773
|
+
/* @__PURE__ */ jsxs("div", { className: "self-stretch flex flex-col gap-[16px]", children: [
|
|
9774
|
+
sortedDates.map((dateKey) => {
|
|
9775
|
+
const groupItems = grouped.get(dateKey);
|
|
9776
|
+
const dateLabel = historyFormatDate(groupItems[0].createdAt, labels.locale);
|
|
9777
|
+
return /* @__PURE__ */ jsxs("div", { className: "self-stretch flex flex-col gap-[var(--deframe-widget-size-gap-sm)]", children: [
|
|
9778
|
+
/* @__PURE__ */ jsx("div", { className: "[font-size:var(--deframe-widget-font-size-sm)] [line-height:var(--deframe-widget-font-leading-sm)] text-[color:var(--deframe-widget-color-text-secondary)]", children: dateLabel }),
|
|
9779
|
+
groupItems.map((item) => /* @__PURE__ */ jsx(
|
|
9780
|
+
HistoryListItem,
|
|
9781
|
+
{
|
|
9782
|
+
item,
|
|
9783
|
+
labels: labels.historyItem,
|
|
9784
|
+
onClick: onItemClick ? () => onItemClick(item.id) : void 0,
|
|
9785
|
+
className: "!rounded-[var(--deframe-widget-size-radius-xs)] !border-0 !min-h-[72px]"
|
|
9786
|
+
},
|
|
9787
|
+
item.id
|
|
9788
|
+
))
|
|
9789
|
+
] }, dateKey);
|
|
9790
|
+
}),
|
|
9791
|
+
hasMore && labels.loadMoreLabel && /* @__PURE__ */ jsx("div", { className: "flex justify-center pt-[var(--deframe-widget-size-padding-y-sm)]", children: /* @__PURE__ */ jsx(TertiaryButton, { onClick: () => setVisibleCount((c) => c + pageSize), children: labels.loadMoreLabel }) })
|
|
9792
|
+
] })
|
|
9793
|
+
] });
|
|
9719
9794
|
};
|
|
9720
9795
|
var variantStyles2 = {
|
|
9721
9796
|
SUCCESS: {
|
|
@@ -9792,6 +9867,32 @@ function StatusBadge2({ status, labels, className }) {
|
|
|
9792
9867
|
}
|
|
9793
9868
|
);
|
|
9794
9869
|
}
|
|
9870
|
+
var explorerLinkClass = "text-[color:var(--deframe-widget-color-brand-primary)] underline text-[12px] leading-none [font-weight:var(--deframe-widget-font-weight-semibold)]";
|
|
9871
|
+
function renderExplorerLink(tx) {
|
|
9872
|
+
return /* @__PURE__ */ jsx(
|
|
9873
|
+
"a",
|
|
9874
|
+
{
|
|
9875
|
+
"data-test-id": "history-list-item-simple-explorer",
|
|
9876
|
+
href: tx.explorerUrl,
|
|
9877
|
+
target: "_blank",
|
|
9878
|
+
rel: "noopener noreferrer",
|
|
9879
|
+
className: explorerLinkClass,
|
|
9880
|
+
children: tx.label
|
|
9881
|
+
}
|
|
9882
|
+
);
|
|
9883
|
+
}
|
|
9884
|
+
function renderExplorerLinks(transactions) {
|
|
9885
|
+
if (!(transactions == null ? void 0 : transactions.length)) return null;
|
|
9886
|
+
if (transactions.length === 1) return renderExplorerLink(transactions[0]);
|
|
9887
|
+
return /* @__PURE__ */ jsx("div", { className: "flex items-center gap-[var(--deframe-widget-size-gap-xs)] flex-wrap", children: transactions.map((tx, i) => /* @__PURE__ */ jsxs(React6.Fragment, { children: [
|
|
9888
|
+
i > 0 && /* @__PURE__ */ jsx("span", { className: "text-[color:var(--deframe-widget-color-text-tertiary)] text-[12px]", children: "\u2192" }),
|
|
9889
|
+
tx.prefix && /* @__PURE__ */ jsxs("span", { className: "text-[color:var(--deframe-widget-color-text-secondary)] text-[12px]", children: [
|
|
9890
|
+
tx.prefix,
|
|
9891
|
+
":"
|
|
9892
|
+
] }),
|
|
9893
|
+
renderExplorerLink(tx)
|
|
9894
|
+
] }, tx.explorerUrl)) });
|
|
9895
|
+
}
|
|
9795
9896
|
var HistoryListItemSimple = ({ item, labels, locale }) => {
|
|
9796
9897
|
const label = historyResolveLabel(item, labels);
|
|
9797
9898
|
const { primary, secondary } = historyResolveAmounts(item);
|
|
@@ -9854,7 +9955,8 @@ var HistoryListItemSimple = ({ item, labels, locale }) => {
|
|
|
9854
9955
|
}
|
|
9855
9956
|
)
|
|
9856
9957
|
] })
|
|
9857
|
-
] })
|
|
9958
|
+
] }),
|
|
9959
|
+
renderExplorerLinks(item.transactions)
|
|
9858
9960
|
]
|
|
9859
9961
|
}
|
|
9860
9962
|
);
|
|
@@ -11350,7 +11452,12 @@ function formatEarnPositions(positions, { currency, locale, formatCurrency }) {
|
|
|
11350
11452
|
const principalUSD = p.spotPosition.underlyingBalanceUSD - p.spotPosition.profitInUSD;
|
|
11351
11453
|
const investedFormatted = isBrlPegged && p.spotPosition.principal ? formatHistoryAssetAmount({ amountHumanized: p.spotPosition.principal.humanized, symbol, currency, locale, formatCurrency }) : formatCurrency(principalUSD);
|
|
11352
11454
|
const totalBrla = isBrlPegged && principalHumanized > 0 && principalUSD > 0 ? p.spotPosition.underlyingBalanceUSD * principalHumanized / principalUSD : null;
|
|
11353
|
-
const totalValueFormatted =
|
|
11455
|
+
const totalValueFormatted = (() => {
|
|
11456
|
+
if (totalBrla !== null) {
|
|
11457
|
+
return totalBrla < 0.01 ? investedFormatted : formatHistoryAssetAmount({ amountHumanized: String(totalBrla), symbol, currency, locale, formatCurrency });
|
|
11458
|
+
}
|
|
11459
|
+
return p.spotPosition.underlyingBalanceUSD < 0.01 ? investedFormatted : formatCurrency(p.spotPosition.underlyingBalanceUSD);
|
|
11460
|
+
})();
|
|
11354
11461
|
return __spreadProps(__spreadValues({}, p), { spotPosition: __spreadProps(__spreadValues({}, p.spotPosition), { investedFormatted, totalValueFormatted }) });
|
|
11355
11462
|
})
|
|
11356
11463
|
});
|