@deframe-sdk/components 0.1.72 → 0.1.74

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 CHANGED
@@ -1535,6 +1535,7 @@ interface ChooseAnAssetSwapViewProps {
1535
1535
  onClose: () => void;
1536
1536
  onSearch: (value: string) => void;
1537
1537
  autoFocus: boolean;
1538
+ closeOnBackdropClick?: boolean;
1538
1539
  displayedTokens: TokenData[];
1539
1540
  hasMore: boolean;
1540
1541
  onLoadMore: () => void;
@@ -1637,6 +1638,7 @@ interface SwapQuoteDetailsLabels {
1637
1638
  blockchainCostsLabel: string;
1638
1639
  networkGasLabel: string;
1639
1640
  protocolFeeLabel: string;
1641
+ priceImpactLabel: string;
1640
1642
  slippageLabel: string;
1641
1643
  etaLabel: string;
1642
1644
  quoteIdLabel: string;
@@ -1657,6 +1659,8 @@ interface SwapQuoteDetailsViewProps {
1657
1659
  feePercentage: string;
1658
1660
  gasCostFormatted: string;
1659
1661
  protocolFee: string;
1662
+ priceImpactFormatted: string;
1663
+ priceImpactIsPositive: boolean;
1660
1664
  slippageFormatted: string;
1661
1665
  etaFormatted: string;
1662
1666
  quoteId: string;
@@ -1705,6 +1709,8 @@ interface SwapFormViewProps {
1705
1709
  onHistoryClick: () => void;
1706
1710
  onSwitchTokens: () => void;
1707
1711
  switchTokensAriaLabel: string;
1712
+ showHistoryTooltip?: boolean;
1713
+ directionButtonSpacing?: 'default' | 'compact';
1708
1714
  fromCard: SwapFromCardViewProps;
1709
1715
  toCard: SwapToCardViewProps;
1710
1716
  advancedSettings: SwapAdvancedSettingsViewProps;
@@ -1799,12 +1805,13 @@ interface ChooseNetworkAndAssetViewSimpleProps {
1799
1805
  onAssetClick: (token: TokenData) => void;
1800
1806
  onSearch: (value: string) => void;
1801
1807
  autoFocus?: boolean;
1808
+ closeOnBackdropClick?: boolean;
1802
1809
  hasMore: boolean;
1803
1810
  onLoadMore: () => void;
1804
1811
  isFetching: boolean;
1805
1812
  labels: ChooseNetworkAndAssetLabels;
1806
1813
  }
1807
- declare function ChooseNetworkAndAssetViewSimple({ isOpen, onClose, networks, selectedNetwork, onNetworkSelect, displayedTokens, findBalance, formatTokenAmount, formatCurrencyValue, onAssetClick, onSearch, autoFocus, hasMore, onLoadMore, isFetching, labels, }: ChooseNetworkAndAssetViewSimpleProps): react_jsx_runtime.JSX.Element;
1814
+ declare function ChooseNetworkAndAssetViewSimple({ isOpen, onClose, networks, selectedNetwork, onNetworkSelect, displayedTokens, findBalance, formatTokenAmount, formatCurrencyValue, onAssetClick, onSearch, autoFocus, closeOnBackdropClick, hasMore, onLoadMore, isFetching, labels, }: ChooseNetworkAndAssetViewSimpleProps): react_jsx_runtime.JSX.Element;
1808
1815
 
1809
1816
  type HistoryListItemStatus = 'SUCCESS' | 'PENDING' | 'FAILED' | 'REFUNDED' | 'INITIAL';
1810
1817
  type HistoryListItemType = 'SAMECHAIN_SWAP' | 'CROSSCHAIN_SWAP' | 'TRANSFER_IN' | 'TRANSFER_OUT' | 'ON_RAMP_FIAT' | 'OFF_RAMP_FIAT' | 'SAMECHAIN_INVESTMENT_DEPOSIT' | 'SAMECHAIN_INVESTMENT_WITHDRAW' | 'CROSSCHAIN_INVESTMENT_DEPOSIT' | 'CROSSCHAIN_INVESTMENT_WITHDRAW';
package/dist/index.d.ts CHANGED
@@ -1535,6 +1535,7 @@ interface ChooseAnAssetSwapViewProps {
1535
1535
  onClose: () => void;
1536
1536
  onSearch: (value: string) => void;
1537
1537
  autoFocus: boolean;
1538
+ closeOnBackdropClick?: boolean;
1538
1539
  displayedTokens: TokenData[];
1539
1540
  hasMore: boolean;
1540
1541
  onLoadMore: () => void;
@@ -1637,6 +1638,7 @@ interface SwapQuoteDetailsLabels {
1637
1638
  blockchainCostsLabel: string;
1638
1639
  networkGasLabel: string;
1639
1640
  protocolFeeLabel: string;
1641
+ priceImpactLabel: string;
1640
1642
  slippageLabel: string;
1641
1643
  etaLabel: string;
1642
1644
  quoteIdLabel: string;
@@ -1657,6 +1659,8 @@ interface SwapQuoteDetailsViewProps {
1657
1659
  feePercentage: string;
1658
1660
  gasCostFormatted: string;
1659
1661
  protocolFee: string;
1662
+ priceImpactFormatted: string;
1663
+ priceImpactIsPositive: boolean;
1660
1664
  slippageFormatted: string;
1661
1665
  etaFormatted: string;
1662
1666
  quoteId: string;
@@ -1705,6 +1709,8 @@ interface SwapFormViewProps {
1705
1709
  onHistoryClick: () => void;
1706
1710
  onSwitchTokens: () => void;
1707
1711
  switchTokensAriaLabel: string;
1712
+ showHistoryTooltip?: boolean;
1713
+ directionButtonSpacing?: 'default' | 'compact';
1708
1714
  fromCard: SwapFromCardViewProps;
1709
1715
  toCard: SwapToCardViewProps;
1710
1716
  advancedSettings: SwapAdvancedSettingsViewProps;
@@ -1799,12 +1805,13 @@ interface ChooseNetworkAndAssetViewSimpleProps {
1799
1805
  onAssetClick: (token: TokenData) => void;
1800
1806
  onSearch: (value: string) => void;
1801
1807
  autoFocus?: boolean;
1808
+ closeOnBackdropClick?: boolean;
1802
1809
  hasMore: boolean;
1803
1810
  onLoadMore: () => void;
1804
1811
  isFetching: boolean;
1805
1812
  labels: ChooseNetworkAndAssetLabels;
1806
1813
  }
1807
- declare function ChooseNetworkAndAssetViewSimple({ isOpen, onClose, networks, selectedNetwork, onNetworkSelect, displayedTokens, findBalance, formatTokenAmount, formatCurrencyValue, onAssetClick, onSearch, autoFocus, hasMore, onLoadMore, isFetching, labels, }: ChooseNetworkAndAssetViewSimpleProps): react_jsx_runtime.JSX.Element;
1814
+ declare function ChooseNetworkAndAssetViewSimple({ isOpen, onClose, networks, selectedNetwork, onNetworkSelect, displayedTokens, findBalance, formatTokenAmount, formatCurrencyValue, onAssetClick, onSearch, autoFocus, closeOnBackdropClick, hasMore, onLoadMore, isFetching, labels, }: ChooseNetworkAndAssetViewSimpleProps): react_jsx_runtime.JSX.Element;
1808
1815
 
1809
1816
  type HistoryListItemStatus = 'SUCCESS' | 'PENDING' | 'FAILED' | 'REFUNDED' | 'INITIAL';
1810
1817
  type HistoryListItemType = 'SAMECHAIN_SWAP' | 'CROSSCHAIN_SWAP' | 'TRANSFER_IN' | 'TRANSFER_OUT' | 'ON_RAMP_FIAT' | 'OFF_RAMP_FIAT' | 'SAMECHAIN_INVESTMENT_DEPOSIT' | 'SAMECHAIN_INVESTMENT_WITHDRAW' | 'CROSSCHAIN_INVESTMENT_DEPOSIT' | 'CROSSCHAIN_INVESTMENT_WITHDRAW';
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);
@@ -8307,14 +8366,6 @@ function AdvancedPanelContent({ advancedSettings, transactionDetails }) {
8307
8366
  ]
8308
8367
  }
8309
8368
  ),
8310
- transactionDetails.exchangeRateFormatted && /* @__PURE__ */ jsxRuntime.jsx(
8311
- "p",
8312
- {
8313
- "data-test-id": "swap-form-simple-advanced-panel-subtitle",
8314
- className: "text-[13px] text-[color:var(--deframe-widget-color-text-secondary)] m-0 mb-[var(--deframe-widget-size-gap-sm)] leading-[1.4] font-[inherit]",
8315
- children: transactionDetails.exchangeRateFormatted
8316
- }
8317
- ),
8318
8369
  /* @__PURE__ */ jsxRuntime.jsx(
8319
8370
  "div",
8320
8371
  {
@@ -8323,9 +8374,15 @@ function AdvancedPanelContent({ advancedSettings, transactionDetails }) {
8323
8374
  }
8324
8375
  ),
8325
8376
  /* @__PURE__ */ jsxRuntime.jsx(DetailRow, { label: transactionDetails.labels.exchangeRateLabel, value: transactionDetails.exchangeRateFormatted }),
8326
- /* @__PURE__ */ jsxRuntime.jsx(DetailRow, { label: transactionDetails.labels.blockchainCostsLabel, value: transactionDetails.totalCostFormatted }),
8327
- /* @__PURE__ */ jsxRuntime.jsx(DetailRow, { label: transactionDetails.labels.networkGasLabel, value: transactionDetails.gasCostFormatted }),
8328
- /* @__PURE__ */ jsxRuntime.jsx(DetailRow, { label: transactionDetails.labels.protocolFeeLabel, value: transactionDetails.protocolFee }),
8377
+ /* @__PURE__ */ jsxRuntime.jsx(DetailRow, { label: transactionDetails.labels.blockchainCostsLabel, value: `- ${transactionDetails.totalCostFormatted}`, valueColor: "negative" }),
8378
+ /* @__PURE__ */ jsxRuntime.jsx(
8379
+ DetailRow,
8380
+ {
8381
+ label: transactionDetails.labels.priceImpactLabel,
8382
+ value: transactionDetails.priceImpactFormatted,
8383
+ valueColor: transactionDetails.priceImpactIsPositive ? "positive" : "negative"
8384
+ }
8385
+ ),
8329
8386
  /* @__PURE__ */ jsxRuntime.jsx(
8330
8387
  SlippageDetailRow,
8331
8388
  {
@@ -8342,7 +8399,12 @@ function AdvancedPanelContent({ advancedSettings, transactionDetails }) {
8342
8399
  }
8343
8400
  );
8344
8401
  }
8345
- function DetailRow({ label, value }) {
8402
+ var valueColorClassNames = {
8403
+ default: "text-[color:var(--deframe-widget-color-text-primary)]",
8404
+ negative: "text-[color:var(--deframe-widget-color-state-error)]",
8405
+ positive: "text-[color:var(--deframe-widget-color-state-success)]"
8406
+ };
8407
+ function DetailRow({ label, value, valueColor = "default" }) {
8346
8408
  if (!label && !value) return null;
8347
8409
  return /* @__PURE__ */ jsxRuntime.jsxs(
8348
8410
  "div",
@@ -8362,7 +8424,7 @@ function DetailRow({ label, value }) {
8362
8424
  "span",
8363
8425
  {
8364
8426
  "data-test-id": "swap-form-simple-detail-row-value",
8365
- className: "text-[13px] [font-weight:var(--deframe-widget-font-weight-semibold)] text-right font-[var(--deframe-widget-font-family)] text-[color:var(--deframe-widget-color-text-primary)]",
8427
+ className: tailwindMerge.twMerge("text-[13px] [font-weight:var(--deframe-widget-font-weight-semibold)] text-right font-[var(--deframe-widget-font-family)]", valueColorClassNames[valueColor]),
8366
8428
  children: value
8367
8429
  }
8368
8430
  )
@@ -9100,6 +9162,7 @@ function ChooseNetworkAndAssetViewSimple({
9100
9162
  onAssetClick,
9101
9163
  onSearch,
9102
9164
  autoFocus,
9165
+ closeOnBackdropClick = true,
9103
9166
  hasMore,
9104
9167
  onLoadMore,
9105
9168
  isFetching,
@@ -9116,6 +9179,9 @@ function ChooseNetworkAndAssetViewSimple({
9116
9179
  setQuery(q);
9117
9180
  onSearch(q);
9118
9181
  }, [onSearch]);
9182
+ const handleBackdropClick = React6__namespace.useCallback(() => {
9183
+ if (closeOnBackdropClick) onClose();
9184
+ }, [closeOnBackdropClick, onClose]);
9119
9185
  const handleNetworkSelect = React6__namespace.useCallback((network) => {
9120
9186
  var _a2;
9121
9187
  setQuery("");
@@ -9206,7 +9272,7 @@ function ChooseNetworkAndAssetViewSimple({
9206
9272
  animate: { opacity: 1 },
9207
9273
  exit: { opacity: 0 },
9208
9274
  transition: { duration: 0.2 },
9209
- onClick: onClose,
9275
+ onClick: handleBackdropClick,
9210
9276
  "data-test-id": "backdrop",
9211
9277
  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
9278
  children: /* @__PURE__ */ jsxRuntime.jsxs(
@@ -9330,7 +9396,7 @@ function ChooseNetworkAndAssetViewSimple({
9330
9396
  animate: { opacity: 1 },
9331
9397
  exit: { opacity: 0 },
9332
9398
  transition: { duration: 0.2 },
9333
- onClick: onClose,
9399
+ onClick: handleBackdropClick,
9334
9400
  "data-test-id": "backdrop",
9335
9401
  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
9402
  children: /* @__PURE__ */ jsxRuntime.jsxs(
@@ -9692,20 +9758,29 @@ var SwapHistoryView = ({
9692
9758
  isLoading,
9693
9759
  items,
9694
9760
  onItemClick,
9761
+ onClose,
9695
9762
  pageSize = 10
9696
9763
  }) => {
9764
+ var _a;
9697
9765
  const [visibleCount, setVisibleCount] = React6__namespace.default.useState(pageSize);
9766
+ 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
9767
  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, {}) });
9768
+ 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: [
9769
+ backHeader,
9770
+ /* @__PURE__ */ jsxRuntime.jsx(LoadingSkeleton, {})
9771
+ ] });
9700
9772
  }
9701
9773
  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
- ) });
9774
+ 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: [
9775
+ backHeader,
9776
+ /* @__PURE__ */ jsxRuntime.jsx(
9777
+ EmptyState,
9778
+ {
9779
+ title: labels.emptyTitle,
9780
+ description: labels.emptyDescription
9781
+ }
9782
+ )
9783
+ ] });
9709
9784
  }
9710
9785
  const visibleItems = items.slice(0, visibleCount);
9711
9786
  const grouped = /* @__PURE__ */ new Map();
@@ -9720,26 +9795,29 @@ var SwapHistoryView = ({
9720
9795
  }
9721
9796
  const sortedDates = Array.from(grouped.keys()).sort((a, b) => b.localeCompare(a));
9722
9797
  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
- ] }) });
9798
+ 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: [
9799
+ backHeader,
9800
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "self-stretch flex flex-col gap-[16px]", children: [
9801
+ sortedDates.map((dateKey) => {
9802
+ const groupItems = grouped.get(dateKey);
9803
+ const dateLabel = historyFormatDate(groupItems[0].createdAt, labels.locale);
9804
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "self-stretch flex flex-col gap-[var(--deframe-widget-size-gap-sm)]", children: [
9805
+ /* @__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 }),
9806
+ groupItems.map((item) => /* @__PURE__ */ jsxRuntime.jsx(
9807
+ HistoryListItem,
9808
+ {
9809
+ item,
9810
+ labels: labels.historyItem,
9811
+ onClick: onItemClick ? () => onItemClick(item.id) : void 0,
9812
+ className: "!rounded-[var(--deframe-widget-size-radius-xs)] !border-0 !min-h-[72px]"
9813
+ },
9814
+ item.id
9815
+ ))
9816
+ ] }, dateKey);
9817
+ }),
9818
+ 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 }) })
9819
+ ] })
9820
+ ] });
9743
9821
  };
9744
9822
  var variantStyles2 = {
9745
9823
  SUCCESS: {