@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.js CHANGED
@@ -2130,8 +2130,8 @@ var ActionSheet = ({
2130
2130
  document.addEventListener("keydown", handleEscape);
2131
2131
  return () => document.removeEventListener("keydown", handleEscape);
2132
2132
  }, [isThisSheetActive, onClose]);
2133
- const handleBackdropClick = (e) => {
2134
- if (closeOnBackdropClick && e.target === e.currentTarget) {
2133
+ const handleBackdropClick = () => {
2134
+ if (closeOnBackdropClick) {
2135
2135
  onClose == null ? void 0 : onClose();
2136
2136
  }
2137
2137
  };
@@ -2213,6 +2213,7 @@ var ActionSheet = ({
2213
2213
  /* @__PURE__ */ jsxRuntime.jsx(
2214
2214
  framerMotion.motion.div,
2215
2215
  {
2216
+ onClick: (e) => e.stopPropagation(),
2216
2217
  className: tailwindMerge.twMerge(
2217
2218
  "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",
2218
2219
  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)]",
@@ -4433,11 +4434,20 @@ var SearchInput = ({
4433
4434
  inputTestId
4434
4435
  }) => {
4435
4436
  const [internalValue, setInternalValue] = React6.useState(controlledValue || "");
4437
+ const inputRef = React6__namespace.default.useRef(null);
4436
4438
  React6.useEffect(() => {
4437
4439
  if (controlledValue !== void 0) {
4438
4440
  setInternalValue(controlledValue);
4439
4441
  }
4440
4442
  }, [controlledValue]);
4443
+ React6.useEffect(() => {
4444
+ if (!autoFocus || disabled) return;
4445
+ const frameId = requestAnimationFrame(() => {
4446
+ var _a;
4447
+ return (_a = inputRef.current) == null ? void 0 : _a.focus();
4448
+ });
4449
+ return () => cancelAnimationFrame(frameId);
4450
+ }, [autoFocus, disabled]);
4441
4451
  const handleInputChange = (newValue) => {
4442
4452
  setInternalValue(newValue);
4443
4453
  onChange == null ? void 0 : onChange(newValue);
@@ -4447,6 +4457,7 @@ var SearchInput = ({
4447
4457
  /* @__PURE__ */ jsxRuntime.jsx(
4448
4458
  "input",
4449
4459
  {
4460
+ ref: inputRef,
4450
4461
  "data-testid": inputTestId,
4451
4462
  type: "text",
4452
4463
  value: internalValue,
@@ -6344,6 +6355,7 @@ var ChooseAnAssetSwapView = ({
6344
6355
  onClose,
6345
6356
  onSearch,
6346
6357
  autoFocus,
6358
+ closeOnBackdropClick = true,
6347
6359
  displayedTokens,
6348
6360
  hasMore,
6349
6361
  onLoadMore,
@@ -6368,6 +6380,7 @@ var ChooseAnAssetSwapView = ({
6368
6380
  onClose,
6369
6381
  position: "bottom",
6370
6382
  height: "full",
6383
+ closeOnBackdropClick,
6371
6384
  contentClassName: "w-full max-w-[620px] mx-auto",
6372
6385
  children: /* @__PURE__ */ jsxRuntime.jsxs(BackgroundContainer, { className: "flex flex-col h-full", children: [
6373
6386
  /* @__PURE__ */ jsxRuntime.jsx(Navbar, { children: /* @__PURE__ */ jsxRuntime.jsx(CloseButton_default, { testId: `swap-token-actionsheet-close-${actionSheetId}`, onClick: onClose }) }),
@@ -6989,6 +7002,7 @@ var SwapFormView = ({
6989
7002
  onHistoryClick,
6990
7003
  onSwitchTokens,
6991
7004
  switchTokensAriaLabel,
7005
+ showHistoryTooltip = false,
6992
7006
  fromCard,
6993
7007
  toCard,
6994
7008
  advancedSettings,
@@ -6996,6 +7010,8 @@ var SwapFormView = ({
6996
7010
  priceImpactWarning,
6997
7011
  confirmButton
6998
7012
  }) => {
7013
+ const historyTooltipId = React6__namespace.default.useId();
7014
+ const historyTooltipProps = showHistoryTooltip ? { "aria-describedby": historyTooltipId, title: labels.historyAriaLabel } : {};
6999
7015
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
7000
7016
  /* @__PURE__ */ jsxRuntime.jsx(
7001
7017
  "div",
@@ -7008,17 +7024,29 @@ var SwapFormView = ({
7008
7024
  /* @__PURE__ */ jsxRuntime.jsx(TextHeading, { variant: "h5", className: "!text-[21px]", children: /* @__PURE__ */ jsxRuntime.jsx("span", { "data-testid": "swap-flow-title", children: labels.title }) }),
7009
7025
  labels.subtitle && /* @__PURE__ */ jsxRuntime.jsx(TextBody, { variant: "text-small", className: "!text-[14px]", children: labels.subtitle })
7010
7026
  ] }),
7011
- /* @__PURE__ */ jsxRuntime.jsx(
7012
- "button",
7013
- {
7014
- "data-testid": "swap-history-button",
7015
- type: "button",
7016
- onClick: onHistoryClick,
7017
- 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",
7018
- "aria-label": labels.historyAriaLabel,
7019
- children: /* @__PURE__ */ jsxRuntime.jsx(md.MdHistory, { className: "w-6 h-6" })
7020
- }
7021
- )
7027
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative inline-flex group", children: [
7028
+ /* @__PURE__ */ jsxRuntime.jsx(
7029
+ "button",
7030
+ __spreadProps(__spreadValues({
7031
+ "data-testid": "swap-history-button",
7032
+ type: "button",
7033
+ onClick: onHistoryClick,
7034
+ 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",
7035
+ "aria-label": labels.historyAriaLabel
7036
+ }, historyTooltipProps), {
7037
+ children: /* @__PURE__ */ jsxRuntime.jsx(md.MdHistory, { className: "w-6 h-6" })
7038
+ })
7039
+ ),
7040
+ showHistoryTooltip && /* @__PURE__ */ jsxRuntime.jsx(
7041
+ "span",
7042
+ {
7043
+ id: historyTooltipId,
7044
+ role: "tooltip",
7045
+ 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",
7046
+ children: labels.historyAriaLabel
7047
+ }
7048
+ )
7049
+ ] })
7022
7050
  ] }),
7023
7051
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative flex flex-col items-stretch gap-sm", children: [
7024
7052
  /* @__PURE__ */ jsxRuntime.jsx(SwapFromCardView, __spreadValues({}, fromCard)),
@@ -7938,6 +7966,10 @@ var ConfirmSwapButtonViewSimple = ({
7938
7966
  }
7939
7967
  ) });
7940
7968
  };
7969
+ var simpleDirectionRowClassNames = {
7970
+ default: "flex justify-center relative -my-[16px] z-[1]",
7971
+ compact: "flex justify-center relative -my-[12px] z-[1]"
7972
+ };
7941
7973
  var SwapFormViewSimple = ({
7942
7974
  onSubmit,
7943
7975
  formRef,
@@ -7945,6 +7977,8 @@ var SwapFormViewSimple = ({
7945
7977
  onHistoryClick,
7946
7978
  onSwitchTokens,
7947
7979
  switchTokensAriaLabel,
7980
+ showHistoryTooltip = false,
7981
+ directionButtonSpacing = "default",
7948
7982
  fromCard,
7949
7983
  toCard,
7950
7984
  advancedSettings,
@@ -7955,6 +7989,7 @@ var SwapFormViewSimple = ({
7955
7989
  const containerRef = React6.useRef(null);
7956
7990
  const [panelPos, setPanelPos] = React6.useState(null);
7957
7991
  const [showPanel, setShowPanel] = React6.useState(false);
7992
+ const directionRowClassName = simpleDirectionRowClassNames[directionButtonSpacing];
7958
7993
  React6.useEffect(() => {
7959
7994
  if (!advancedSettings.isOpen) setShowPanel(false);
7960
7995
  }, [advancedSettings.isOpen]);
@@ -8004,7 +8039,7 @@ var SwapFormViewSimple = ({
8004
8039
  {
8005
8040
  "data-test-id": "swap-form-simple-top-row",
8006
8041
  className: "flex items-center justify-end mb-[var(--deframe-widget-size-gap-sm)]",
8007
- children: /* @__PURE__ */ jsxRuntime.jsx(HistoryButton, { onClick: onHistoryClick, ariaLabel: labels.historyAriaLabel })
8042
+ children: /* @__PURE__ */ jsxRuntime.jsx(HistoryButton, { onClick: onHistoryClick, ariaLabel: labels.historyAriaLabel, showTooltip: showHistoryTooltip })
8008
8043
  }
8009
8044
  ),
8010
8045
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -8023,7 +8058,7 @@ var SwapFormViewSimple = ({
8023
8058
  "div",
8024
8059
  {
8025
8060
  "data-test-id": "swap-form-simple-direction-row",
8026
- className: "flex justify-center relative -my-[16px] z-[1]",
8061
+ className: directionRowClassName,
8027
8062
  children: /* @__PURE__ */ jsxRuntime.jsx(
8028
8063
  SwapDirectionButton,
8029
8064
  {
@@ -8112,48 +8147,72 @@ var SwapFormViewSimple = ({
8112
8147
  }
8113
8148
  );
8114
8149
  };
8115
- function HistoryButton({ onClick, ariaLabel }) {
8116
- return /* @__PURE__ */ jsxRuntime.jsx(
8117
- "button",
8118
- {
8119
- "data-test-id": "swap-form-simple-history-button",
8120
- type: "button",
8121
- onClick,
8122
- "aria-label": ariaLabel,
8123
- className: tailwindMerge.twMerge(
8124
- "inline-flex items-center justify-center",
8125
- "w-9 h-9",
8126
- "rounded-[var(--deframe-widget-size-radius-sm)]",
8127
- "border-none",
8128
- "cursor-pointer",
8129
- "bg-transparent",
8130
- "hover:bg-[color:color-mix(in_srgb,var(--deframe-widget-color-bg-tertiary)_92%,transparent)]",
8131
- "transition-[background] duration-150",
8132
- "flex-shrink-0",
8133
- "outline-none",
8134
- "text-[color:var(--deframe-widget-color-text-secondary)]"
8135
- ),
8136
- children: /* @__PURE__ */ jsxRuntime.jsxs(
8137
- "svg",
8138
- {
8139
- "data-test-id": "swap-form-simple-history-icon",
8140
- viewBox: "0 0 24 24",
8141
- width: "20",
8142
- height: "20",
8143
- fill: "none",
8144
- stroke: "currentColor",
8145
- strokeWidth: "2",
8146
- strokeLinecap: "round",
8147
- strokeLinejoin: "round",
8148
- "aria-hidden": "true",
8149
- children: [
8150
- /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "12", cy: "12", r: "10" }),
8151
- /* @__PURE__ */ jsxRuntime.jsx("polyline", { points: "12 6 12 12 16 14" })
8152
- ]
8153
- }
8154
- )
8155
- }
8156
- );
8150
+ function HistoryButton({ onClick, ariaLabel, showTooltip }) {
8151
+ const tooltipId = React6.useId();
8152
+ const tooltipProps = showTooltip ? { "aria-describedby": tooltipId, title: ariaLabel } : {};
8153
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative inline-flex group", children: [
8154
+ /* @__PURE__ */ jsxRuntime.jsx(
8155
+ "button",
8156
+ __spreadProps(__spreadValues({
8157
+ "data-test-id": "swap-form-simple-history-button",
8158
+ type: "button",
8159
+ onClick,
8160
+ "aria-label": ariaLabel
8161
+ }, tooltipProps), {
8162
+ className: tailwindMerge.twMerge(
8163
+ "inline-flex items-center justify-center",
8164
+ "w-9 h-9",
8165
+ "rounded-[var(--deframe-widget-size-radius-sm)]",
8166
+ "border-none",
8167
+ "cursor-pointer",
8168
+ "bg-transparent",
8169
+ "hover:bg-[color:color-mix(in_srgb,var(--deframe-widget-color-bg-tertiary)_92%,transparent)]",
8170
+ "transition-[background] duration-150",
8171
+ "flex-shrink-0",
8172
+ "outline-none",
8173
+ "text-[color:var(--deframe-widget-color-text-secondary)]"
8174
+ ),
8175
+ children: /* @__PURE__ */ jsxRuntime.jsxs(
8176
+ "svg",
8177
+ {
8178
+ "data-test-id": "swap-form-simple-history-icon",
8179
+ viewBox: "0 0 24 24",
8180
+ width: "20",
8181
+ height: "20",
8182
+ fill: "none",
8183
+ stroke: "currentColor",
8184
+ strokeWidth: "2",
8185
+ strokeLinecap: "round",
8186
+ strokeLinejoin: "round",
8187
+ "aria-hidden": "true",
8188
+ children: [
8189
+ /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "12", cy: "12", r: "10" }),
8190
+ /* @__PURE__ */ jsxRuntime.jsx("polyline", { points: "12 6 12 12 16 14" })
8191
+ ]
8192
+ }
8193
+ )
8194
+ })
8195
+ ),
8196
+ showTooltip && /* @__PURE__ */ jsxRuntime.jsx(
8197
+ "span",
8198
+ {
8199
+ id: tooltipId,
8200
+ role: "tooltip",
8201
+ className: tailwindMerge.twMerge(
8202
+ "pointer-events-none absolute right-0 top-full z-10 mt-[6px]",
8203
+ "rounded-[var(--deframe-widget-size-radius-xs)]",
8204
+ "bg-[var(--deframe-widget-color-bg-tertiary)]",
8205
+ "px-[8px] py-[5px]",
8206
+ "text-[12px] [font-weight:var(--deframe-widget-font-weight-medium)]",
8207
+ "text-[color:var(--deframe-widget-color-text-primary)]",
8208
+ "whitespace-nowrap shadow-[0px_4px_16px_0px_#00000066]",
8209
+ "opacity-0 transition-opacity duration-150",
8210
+ "group-hover:opacity-100 group-focus-within:opacity-100"
8211
+ ),
8212
+ children: ariaLabel
8213
+ }
8214
+ )
8215
+ ] });
8157
8216
  }
8158
8217
  function SwapDirectionButton({ onClick, ariaLabel }) {
8159
8218
  const [isHovered, setIsHovered] = React6.useState(false);
@@ -9100,6 +9159,7 @@ function ChooseNetworkAndAssetViewSimple({
9100
9159
  onAssetClick,
9101
9160
  onSearch,
9102
9161
  autoFocus,
9162
+ closeOnBackdropClick = true,
9103
9163
  hasMore,
9104
9164
  onLoadMore,
9105
9165
  isFetching,
@@ -9116,6 +9176,9 @@ function ChooseNetworkAndAssetViewSimple({
9116
9176
  setQuery(q);
9117
9177
  onSearch(q);
9118
9178
  }, [onSearch]);
9179
+ const handleBackdropClick = React6__namespace.useCallback(() => {
9180
+ if (closeOnBackdropClick) onClose();
9181
+ }, [closeOnBackdropClick, onClose]);
9119
9182
  const handleNetworkSelect = React6__namespace.useCallback((network) => {
9120
9183
  var _a2;
9121
9184
  setQuery("");
@@ -9206,7 +9269,7 @@ function ChooseNetworkAndAssetViewSimple({
9206
9269
  animate: { opacity: 1 },
9207
9270
  exit: { opacity: 0 },
9208
9271
  transition: { duration: 0.2 },
9209
- onClick: onClose,
9272
+ onClick: handleBackdropClick,
9210
9273
  "data-test-id": "backdrop",
9211
9274
  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",
9212
9275
  children: /* @__PURE__ */ jsxRuntime.jsxs(
@@ -9330,7 +9393,7 @@ function ChooseNetworkAndAssetViewSimple({
9330
9393
  animate: { opacity: 1 },
9331
9394
  exit: { opacity: 0 },
9332
9395
  transition: { duration: 0.2 },
9333
- onClick: onClose,
9396
+ onClick: handleBackdropClick,
9334
9397
  "data-test-id": "backdrop",
9335
9398
  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)]",
9336
9399
  children: /* @__PURE__ */ jsxRuntime.jsxs(
@@ -9692,20 +9755,29 @@ var SwapHistoryView = ({
9692
9755
  isLoading,
9693
9756
  items,
9694
9757
  onItemClick,
9758
+ onClose,
9695
9759
  pageSize = 10
9696
9760
  }) => {
9761
+ var _a;
9697
9762
  const [visibleCount, setVisibleCount] = React6__namespace.default.useState(pageSize);
9763
+ const backHeader = onClose ? /* @__PURE__ */ jsxRuntime.jsx(DetailsHeader, { title: (_a = labels.title) != null ? _a : "", onBack: onClose, backAriaLabel: labels.closeAriaLabel, className: "px-0 pt-0" }) : null;
9698
9764
  if (isLoading) {
9699
- return /* @__PURE__ */ jsxRuntime.jsx(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: /* @__PURE__ */ jsxRuntime.jsx(LoadingSkeleton, {}) });
9765
+ return /* @__PURE__ */ jsxRuntime.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: [
9766
+ backHeader,
9767
+ /* @__PURE__ */ jsxRuntime.jsx(LoadingSkeleton, {})
9768
+ ] });
9700
9769
  }
9701
9770
  if (items.length === 0) {
9702
- return /* @__PURE__ */ jsxRuntime.jsx(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: /* @__PURE__ */ jsxRuntime.jsx(
9703
- EmptyState,
9704
- {
9705
- title: labels.emptyTitle,
9706
- description: labels.emptyDescription
9707
- }
9708
- ) });
9771
+ return /* @__PURE__ */ jsxRuntime.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__ */ jsxRuntime.jsx(
9774
+ EmptyState,
9775
+ {
9776
+ title: labels.emptyTitle,
9777
+ description: labels.emptyDescription
9778
+ }
9779
+ )
9780
+ ] });
9709
9781
  }
9710
9782
  const visibleItems = items.slice(0, visibleCount);
9711
9783
  const grouped = /* @__PURE__ */ new Map();
@@ -9720,26 +9792,29 @@ var SwapHistoryView = ({
9720
9792
  }
9721
9793
  const sortedDates = Array.from(grouped.keys()).sort((a, b) => b.localeCompare(a));
9722
9794
  const hasMore = items.length > visibleCount;
9723
- return /* @__PURE__ */ jsxRuntime.jsx(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: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "self-stretch flex flex-col gap-[16px]", children: [
9724
- sortedDates.map((dateKey) => {
9725
- const groupItems = grouped.get(dateKey);
9726
- const dateLabel = historyFormatDate(groupItems[0].createdAt, labels.locale);
9727
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "self-stretch flex flex-col gap-[var(--deframe-widget-size-gap-sm)]", children: [
9728
- /* @__PURE__ */ jsxRuntime.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 }),
9729
- groupItems.map((item) => /* @__PURE__ */ jsxRuntime.jsx(
9730
- HistoryListItem,
9731
- {
9732
- item,
9733
- labels: labels.historyItem,
9734
- onClick: onItemClick ? () => onItemClick(item.id) : void 0,
9735
- className: "!rounded-[var(--deframe-widget-size-radius-xs)] !border-0 !min-h-[72px]"
9736
- },
9737
- item.id
9738
- ))
9739
- ] }, dateKey);
9740
- }),
9741
- hasMore && labels.loadMoreLabel && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex justify-center pt-[var(--deframe-widget-size-padding-y-sm)]", children: /* @__PURE__ */ jsxRuntime.jsx(TertiaryButton, { onClick: () => setVisibleCount((c) => c + pageSize), children: labels.loadMoreLabel }) })
9742
- ] }) });
9795
+ return /* @__PURE__ */ jsxRuntime.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: [
9796
+ backHeader,
9797
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "self-stretch flex flex-col gap-[16px]", children: [
9798
+ sortedDates.map((dateKey) => {
9799
+ const groupItems = grouped.get(dateKey);
9800
+ const dateLabel = historyFormatDate(groupItems[0].createdAt, labels.locale);
9801
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "self-stretch flex flex-col gap-[var(--deframe-widget-size-gap-sm)]", children: [
9802
+ /* @__PURE__ */ jsxRuntime.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 }),
9803
+ groupItems.map((item) => /* @__PURE__ */ jsxRuntime.jsx(
9804
+ HistoryListItem,
9805
+ {
9806
+ item,
9807
+ labels: labels.historyItem,
9808
+ onClick: onItemClick ? () => onItemClick(item.id) : void 0,
9809
+ className: "!rounded-[var(--deframe-widget-size-radius-xs)] !border-0 !min-h-[72px]"
9810
+ },
9811
+ item.id
9812
+ ))
9813
+ ] }, dateKey);
9814
+ }),
9815
+ hasMore && labels.loadMoreLabel && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex justify-center pt-[var(--deframe-widget-size-padding-y-sm)]", children: /* @__PURE__ */ jsxRuntime.jsx(TertiaryButton, { onClick: () => setVisibleCount((c) => c + pageSize), children: labels.loadMoreLabel }) })
9816
+ ] })
9817
+ ] });
9743
9818
  };
9744
9819
  var variantStyles2 = {
9745
9820
  SUCCESS: {
@@ -9816,6 +9891,32 @@ function StatusBadge2({ status, labels, className }) {
9816
9891
  }
9817
9892
  );
9818
9893
  }
9894
+ var explorerLinkClass = "text-[color:var(--deframe-widget-color-brand-primary)] underline text-[12px] leading-none [font-weight:var(--deframe-widget-font-weight-semibold)]";
9895
+ function renderExplorerLink(tx) {
9896
+ return /* @__PURE__ */ jsxRuntime.jsx(
9897
+ "a",
9898
+ {
9899
+ "data-test-id": "history-list-item-simple-explorer",
9900
+ href: tx.explorerUrl,
9901
+ target: "_blank",
9902
+ rel: "noopener noreferrer",
9903
+ className: explorerLinkClass,
9904
+ children: tx.label
9905
+ }
9906
+ );
9907
+ }
9908
+ function renderExplorerLinks(transactions) {
9909
+ if (!(transactions == null ? void 0 : transactions.length)) return null;
9910
+ if (transactions.length === 1) return renderExplorerLink(transactions[0]);
9911
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center gap-[var(--deframe-widget-size-gap-xs)] flex-wrap", children: transactions.map((tx, i) => /* @__PURE__ */ jsxRuntime.jsxs(React6__namespace.Fragment, { children: [
9912
+ i > 0 && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[color:var(--deframe-widget-color-text-tertiary)] text-[12px]", children: "\u2192" }),
9913
+ tx.prefix && /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-[color:var(--deframe-widget-color-text-secondary)] text-[12px]", children: [
9914
+ tx.prefix,
9915
+ ":"
9916
+ ] }),
9917
+ renderExplorerLink(tx)
9918
+ ] }, tx.explorerUrl)) });
9919
+ }
9819
9920
  var HistoryListItemSimple = ({ item, labels, locale }) => {
9820
9921
  const label = historyResolveLabel(item, labels);
9821
9922
  const { primary, secondary } = historyResolveAmounts(item);
@@ -9878,7 +9979,8 @@ var HistoryListItemSimple = ({ item, labels, locale }) => {
9878
9979
  }
9879
9980
  )
9880
9981
  ] })
9881
- ] })
9982
+ ] }),
9983
+ renderExplorerLinks(item.transactions)
9882
9984
  ]
9883
9985
  }
9884
9986
  );
@@ -11374,7 +11476,12 @@ function formatEarnPositions(positions, { currency, locale, formatCurrency }) {
11374
11476
  const principalUSD = p.spotPosition.underlyingBalanceUSD - p.spotPosition.profitInUSD;
11375
11477
  const investedFormatted = isBrlPegged && p.spotPosition.principal ? formatHistoryAssetAmount({ amountHumanized: p.spotPosition.principal.humanized, symbol, currency, locale, formatCurrency }) : formatCurrency(principalUSD);
11376
11478
  const totalBrla = isBrlPegged && principalHumanized > 0 && principalUSD > 0 ? p.spotPosition.underlyingBalanceUSD * principalHumanized / principalUSD : null;
11377
- const totalValueFormatted = totalBrla !== null ? formatHistoryAssetAmount({ amountHumanized: String(totalBrla), symbol, currency, locale, formatCurrency }) : formatCurrency(p.spotPosition.underlyingBalanceUSD);
11479
+ const totalValueFormatted = (() => {
11480
+ if (totalBrla !== null) {
11481
+ return totalBrla < 0.01 ? investedFormatted : formatHistoryAssetAmount({ amountHumanized: String(totalBrla), symbol, currency, locale, formatCurrency });
11482
+ }
11483
+ return p.spotPosition.underlyingBalanceUSD < 0.01 ? investedFormatted : formatCurrency(p.spotPosition.underlyingBalanceUSD);
11484
+ })();
11378
11485
  return __spreadProps(__spreadValues({}, p), { spotPosition: __spreadProps(__spreadValues({}, p.spotPosition), { investedFormatted, totalValueFormatted }) });
11379
11486
  })
11380
11487
  });