@deframe-sdk/components 0.1.15 → 0.1.16

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
@@ -2632,45 +2632,6 @@ var HistoryWithdrawDetailsView = ({
2632
2632
  ] }) })
2633
2633
  ] });
2634
2634
  };
2635
- var SwapNetworkSelectorView = ({
2636
- chainLabel,
2637
- chainImage,
2638
- onClick,
2639
- directionLabel = "De",
2640
- testId = "swap-network-selector",
2641
- className
2642
- }) => {
2643
- const baseClasses = "flex flex-row items-center gap-[var(--deframe-widget-size-gap-xs)]";
2644
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-test-id": testId, className: tailwindMerge.twMerge(baseClasses, className), children: [
2645
- /* @__PURE__ */ jsxRuntime.jsx(TextBody, { as: "span", variant: "text-small", className: "tracking-wide text-[color:var(--deframe-widget-color-text-tertiary)]", children: directionLabel }),
2646
- /* @__PURE__ */ jsxRuntime.jsxs(
2647
- "button",
2648
- {
2649
- "data-testid": testId,
2650
- type: "button",
2651
- onClick,
2652
- className: "ml-[var(--deframe-widget-size-gap-lg)] bg-[var(--deframe-widget-color-bg-tertiary)] border border-[color:var(--deframe-widget-color-border-tertiary)] rounded-[var(--deframe-widget-size-radius-md)] flex items-center gap-[var(--deframe-widget-size-gap-xs)] px-[var(--deframe-widget-size-padding-x-sm)] py-[var(--deframe-widget-size-padding-y-xs)] hover:border-[color:var(--deframe-widget-color-border-secondary)] transition-colors [font-size:var(--deframe-widget-font-size-sm)] [line-height:var(--deframe-widget-font-leading-sm)] text-[color:var(--deframe-widget-color-text-secondary)] cursor-pointer",
2653
- "aria-label": `${directionLabel} ${chainLabel}`,
2654
- children: [
2655
- chainImage ? /* @__PURE__ */ jsxRuntime.jsx("img", { src: chainImage, alt: chainLabel, className: "w-3 h-3 rounded-[var(--deframe-widget-size-radius-full)]" }) : null,
2656
- /* @__PURE__ */ jsxRuntime.jsx("span", { children: chainLabel }),
2657
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center justify-center w-[18px] h-[18px]", children: /* @__PURE__ */ jsxRuntime.jsx(hi2.HiChevronDown, { className: "w-3 h-3 text-[color:var(--deframe-widget-color-text-tertiary)]" }) })
2658
- ]
2659
- }
2660
- )
2661
- ] });
2662
- };
2663
- var SwapQuoteHeaderView = ({
2664
- label,
2665
- timerElement,
2666
- className
2667
- }) => {
2668
- const baseClasses = "border-b border-[color:var(--deframe-widget-color-border-secondary)] pb-[var(--deframe-widget-size-padding-y-sm)]";
2669
- return /* @__PURE__ */ jsxRuntime.jsx("div", { "data-test-id": "swap-quote-header", className: tailwindMerge.twMerge(baseClasses, className), children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between", children: [
2670
- /* @__PURE__ */ jsxRuntime.jsx(TextBody, { as: "span", variant: "text-small", className: "[font-weight:var(--deframe-widget-font-weight-semibold)] text-[color:var(--deframe-widget-color-text-secondary)] inline-flex items-center", children: label }),
2671
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center gap-[var(--deframe-widget-size-gap-md)]", children: timerElement })
2672
- ] }) });
2673
- };
2674
2635
  var SwapAmountInputView = ({
2675
2636
  value,
2676
2637
  hasError,
@@ -2728,127 +2689,6 @@ var SwapAmountInputView = ({
2728
2689
  })
2729
2690
  );
2730
2691
  };
2731
- var SwapOutputAmountView = ({
2732
- displayOutput,
2733
- isLoading,
2734
- loadingElement,
2735
- searchingQuoteLabel = "Searching quote...",
2736
- className
2737
- }) => {
2738
- const baseClasses = "[font-size:var(--deframe-widget-font-size-xxl)] [line-height:var(--deframe-widget-font-leading-xxl)] [font-weight:var(--deframe-widget-font-weight-extrabold)] text-right w-full min-w-[120px] text-[color:var(--deframe-widget-color-text-primary)]";
2739
- return /* @__PURE__ */ jsxRuntime.jsx("div", { "data-test-id": "swap-flow-output-amount", className: tailwindMerge.twMerge(baseClasses, className), children: isLoading ? /* @__PURE__ */ jsxRuntime.jsx(TextBody, { as: "span", variant: "text-small", className: "text-[color:var(--deframe-widget-color-text-primary-disabled)] inline-flex items-center", children: loadingElement != null ? loadingElement : searchingQuoteLabel }) : displayOutput });
2740
- };
2741
- var SwapQuoteErrorsView = ({
2742
- hasQuoteError,
2743
- hasBytecodeError,
2744
- quoteErrorMessage = "Unable to get quote for this transaction",
2745
- bytecodeErrorMessage = "Error building transaction"
2746
- }) => {
2747
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-test-id": "swap-quote-errors", children: [
2748
- hasQuoteError && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-sm", children: /* @__PURE__ */ jsxRuntime.jsx(
2749
- BannerNotification,
2750
- {
2751
- type: "inline",
2752
- variant: "error",
2753
- message: quoteErrorMessage
2754
- }
2755
- ) }),
2756
- hasBytecodeError && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-sm", children: /* @__PURE__ */ jsxRuntime.jsx(
2757
- BannerNotification,
2758
- {
2759
- type: "inline",
2760
- variant: "error",
2761
- message: bytecodeErrorMessage
2762
- }
2763
- ) })
2764
- ] });
2765
- };
2766
- var SLIPPAGE_OPTIONS = [10, 50, 100];
2767
- var SwapSlippageToleranceButtonsView = ({
2768
- slippageBps,
2769
- onSelect,
2770
- formatPercentage,
2771
- className
2772
- }) => {
2773
- const baseClasses = "flex gap-[var(--deframe-widget-size-gap-xs)]";
2774
- return /* @__PURE__ */ jsxRuntime.jsx("div", { "data-test-id": "swap-slippage-tolerance-buttons", className: tailwindMerge.twMerge(baseClasses, className), children: SLIPPAGE_OPTIONS.map((option) => {
2775
- const isActive = slippageBps === option;
2776
- const activeClasses = "border-[color:var(--deframe-widget-color-brand-primary)] text-[color:var(--deframe-widget-color-brand-primary)] bg-[color:color-mix(in_srgb,var(--deframe-widget-color-brand-primary)_18%,transparent)]";
2777
- const inactiveClasses = "border-[color:var(--deframe-widget-color-border-tertiary)] text-[color:var(--deframe-widget-color-text-secondary)] bg-[var(--deframe-widget-color-bg-primary)]";
2778
- const buttonBase = "px-[var(--deframe-widget-size-padding-x-sm)] py-[var(--deframe-widget-size-padding-y-xs)] rounded-[var(--deframe-widget-size-radius-xs)] border [font-size:var(--deframe-widget-font-size-sm)] [line-height:var(--deframe-widget-font-leading-sm)] cursor-pointer";
2779
- return /* @__PURE__ */ jsxRuntime.jsx(
2780
- "button",
2781
- {
2782
- "data-test-id": `slippage-option-${option}`,
2783
- type: "button",
2784
- onClick: () => onSelect(option),
2785
- className: tailwindMerge.twMerge(buttonBase, isActive ? activeClasses : inactiveClasses),
2786
- "aria-label": `${formatPercentage(option)}% slippage`,
2787
- "aria-pressed": isActive,
2788
- children: formatPercentage(option)
2789
- },
2790
- option
2791
- );
2792
- }) });
2793
- };
2794
- var SwapTokenSelectorView = ({
2795
- token,
2796
- onClick,
2797
- testId = "swap-token-selector",
2798
- selectTokenLabel = "Select token",
2799
- className
2800
- }) => {
2801
- const baseClasses = "h-[56px] border border-[color:var(--deframe-widget-color-border-secondary)] rounded-[var(--deframe-widget-size-radius-xs)] overflow-hidden hover:border-[color:var(--deframe-widget-color-border-primary)] transition-colors flex items-center px-[var(--deframe-widget-size-padding-x-sm)] py-[6px] w-full cursor-pointer";
2802
- return /* @__PURE__ */ jsxRuntime.jsxs(
2803
- "button",
2804
- {
2805
- "data-test-id": testId,
2806
- type: "button",
2807
- onClick,
2808
- className: tailwindMerge.twMerge(baseClasses, className),
2809
- "aria-label": token ? token.symbol : selectTokenLabel,
2810
- children: [
2811
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center gap-[var(--deframe-widget-size-gap-sm)] flex-1", children: token ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
2812
- token.logoURI ? /* @__PURE__ */ jsxRuntime.jsx("img", { src: token.logoURI, alt: token.symbol, className: "w-6 h-6 rounded-[var(--deframe-widget-size-radius-full)]" }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-6 h-6 rounded-[var(--deframe-widget-size-radius-full)] bg-[var(--deframe-widget-color-bg-secondary)] text-[color:var(--deframe-widget-color-text-secondary)] flex items-center justify-center text-[10px] [font-weight:var(--deframe-widget-font-weight-semibold)]", children: (token.symbol || "").slice(0, 3).toUpperCase() }),
2813
- /* @__PURE__ */ jsxRuntime.jsx(TextBody, { as: "span", className: "text-[color:var(--deframe-widget-color-text-primary)]", children: token.symbol })
2814
- ] }) : /* @__PURE__ */ jsxRuntime.jsx(TextBody, { as: "span", className: "text-[color:var(--deframe-widget-color-text-secondary)]", children: selectTokenLabel }) }),
2815
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center justify-center w-[18px] h-[18px]", children: /* @__PURE__ */ jsxRuntime.jsx(hi2.HiChevronDown, { className: "w-3 h-3 text-[color:var(--deframe-widget-color-text-tertiary)]" }) })
2816
- ]
2817
- }
2818
- );
2819
- };
2820
- var SwapQuoteBlockchainCostsView = ({
2821
- totalCostFormatted,
2822
- feePercentage,
2823
- gasCostFormatted,
2824
- protocolFee,
2825
- blockchainCostsLabel = "Blockchain Costs",
2826
- networkGasLabel = "Network Gas",
2827
- protocolFeeLabel = "Protocol Fee",
2828
- collapseLabel = "Collapse",
2829
- expandLabel = "Expand"
2830
- }) => {
2831
- return /* @__PURE__ */ jsxRuntime.jsx("div", { "data-test-id": "swap-quote-blockchain-costs", children: /* @__PURE__ */ jsxRuntime.jsx(
2832
- CollapsibleInfoRow,
2833
- {
2834
- label: blockchainCostsLabel,
2835
- value: `${totalCostFormatted} ~ ${feePercentage}%`,
2836
- defaultOpen: true,
2837
- collapseLabel,
2838
- expandLabel,
2839
- children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-[var(--deframe-widget-size-gap-sm)]", children: [
2840
- /* @__PURE__ */ jsxRuntime.jsxs(InfoRowWithIcon, { children: [
2841
- /* @__PURE__ */ jsxRuntime.jsx(InfoRowIconLabel, { children: networkGasLabel }),
2842
- /* @__PURE__ */ jsxRuntime.jsx(InfoRowIconValue, { children: gasCostFormatted })
2843
- ] }),
2844
- /* @__PURE__ */ jsxRuntime.jsxs(InfoRowWithIcon, { borderBottom: true, children: [
2845
- /* @__PURE__ */ jsxRuntime.jsx(InfoRowIconLabel, { children: protocolFeeLabel }),
2846
- /* @__PURE__ */ jsxRuntime.jsx(InfoRowIconValue, { children: protocolFee })
2847
- ] })
2848
- ] })
2849
- }
2850
- ) });
2851
- };
2852
2692
  var ChooseAStrategyActionsheetView = ({
2853
2693
  isOpen,
2854
2694
  currentActionSheetId,
@@ -2917,8 +2757,16 @@ var StrategyDetailsView = ({
2917
2757
  headerTitle = "Details",
2918
2758
  strategyInfoTitle = "Strategy Info",
2919
2759
  depositButtonLabel = "Deposit",
2920
- backAriaLabel = "Back"
2760
+ backAriaLabel = "Back",
2761
+ error,
2762
+ notFoundMessage
2921
2763
  }) => {
2764
+ if (error) {
2765
+ return /* @__PURE__ */ jsxRuntime.jsx(BackgroundContainer, { children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-text-secondary dark:text-text-secondary-dark p-md", children: error }) });
2766
+ }
2767
+ if (notFoundMessage) {
2768
+ return /* @__PURE__ */ jsxRuntime.jsx(BackgroundContainer, { children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-text-secondary dark:text-text-secondary-dark p-md", children: notFoundMessage }) });
2769
+ }
2922
2770
  return /* @__PURE__ */ jsxRuntime.jsxs(BackgroundContainer, { children: [
2923
2771
  /* @__PURE__ */ jsxRuntime.jsx(DetailsHeader, { title: headerTitle, onBack, backAriaLabel }),
2924
2772
  /* @__PURE__ */ jsxRuntime.jsx("div", { "data-test-id": "strategy-details-content", className: "flex-1 min-h-0 overflow-y-auto px-[var(--deframe-widget-size-padding-x-md)] py-[var(--deframe-widget-size-padding-y-md)] py-[var(--deframe-widget-size-padding-y-lg)] pb-[var(--deframe-widget-size-padding-y-xxl)]", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-[var(--deframe-widget-size-gap-lg)] min-h-full", children: [
@@ -4127,56 +3975,56 @@ var ChooseAnAssetSwapView = ({
4127
3975
  }
4128
3976
  ) });
4129
3977
  };
4130
- var SwapFormView = ({
4131
- labels,
4132
- onHistoryClick,
4133
- fromCard,
4134
- switchButton,
4135
- toCard,
4136
- advancedSettings,
4137
- transactionDetails,
4138
- confirmButton
3978
+ var SwapTokenSelectorView = ({
3979
+ token,
3980
+ onClick,
3981
+ testId = "swap-token-selector",
3982
+ selectTokenLabel = "Select token",
3983
+ className
4139
3984
  }) => {
4140
- return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
4141
- /* @__PURE__ */ jsxRuntime.jsx(
4142
- "div",
4143
- {
4144
- "data-testid": "swap-form-view",
4145
- className: "flex-1 min-h-0 overflow-y-auto swap-flow-content pr-sm",
4146
- children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-md text-text-secondary dark:text-text-secondary-dark", children: [
4147
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-start justify-between gap-md", children: [
4148
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-sm", children: [
4149
- /* @__PURE__ */ jsxRuntime.jsx(TextHeading, { variant: "h5", className: "!text-[21px]", children: /* @__PURE__ */ jsxRuntime.jsx("span", { "data-testid": "swap-flow-title", children: labels.title }) }),
4150
- labels.subtitle && /* @__PURE__ */ jsxRuntime.jsx(TextBody, { variant: "text-small", className: "!text-[14px]", children: labels.subtitle })
4151
- ] }),
4152
- /* @__PURE__ */ jsxRuntime.jsx(
4153
- "button",
4154
- {
4155
- "data-testid": "swap-history-button",
4156
- type: "button",
4157
- onClick: onHistoryClick,
4158
- className: "flex items-center justify-center w-12 h-12 transition-colors rounded-full cursor-pointer text-text-secondary dark:text-text-secondary-dark hover:text-brand-primary",
4159
- "aria-label": labels.historyAriaLabel,
4160
- children: /* @__PURE__ */ jsxRuntime.jsx(md.MdHistory, { className: "w-6 h-6" })
4161
- }
4162
- )
4163
- ] }),
4164
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative flex flex-col items-stretch gap-sm", children: [
4165
- fromCard,
4166
- switchButton,
4167
- toCard
4168
- ] }),
4169
- advancedSettings,
4170
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pb-xl", children: transactionDetails })
4171
- ] })
4172
- }
4173
- ),
4174
- /* @__PURE__ */ jsxRuntime.jsx(
4175
- "div",
3985
+ const baseClasses = "h-[56px] border border-[color:var(--deframe-widget-color-border-secondary)] rounded-[var(--deframe-widget-size-radius-xs)] overflow-hidden hover:border-[color:var(--deframe-widget-color-border-primary)] transition-colors flex items-center px-[var(--deframe-widget-size-padding-x-sm)] py-[6px] w-full cursor-pointer";
3986
+ return /* @__PURE__ */ jsxRuntime.jsxs(
3987
+ "button",
3988
+ {
3989
+ "data-test-id": testId,
3990
+ type: "button",
3991
+ onClick,
3992
+ className: tailwindMerge.twMerge(baseClasses, className),
3993
+ "aria-label": token ? token.symbol : selectTokenLabel,
3994
+ children: [
3995
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center gap-[var(--deframe-widget-size-gap-sm)] flex-1", children: token ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
3996
+ token.logoURI ? /* @__PURE__ */ jsxRuntime.jsx("img", { src: token.logoURI, alt: token.symbol, className: "w-6 h-6 rounded-[var(--deframe-widget-size-radius-full)]" }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-6 h-6 rounded-[var(--deframe-widget-size-radius-full)] bg-[var(--deframe-widget-color-bg-secondary)] text-[color:var(--deframe-widget-color-text-secondary)] flex items-center justify-center text-[10px] [font-weight:var(--deframe-widget-font-weight-semibold)]", children: (token.symbol || "").slice(0, 3).toUpperCase() }),
3997
+ /* @__PURE__ */ jsxRuntime.jsx(TextBody, { as: "span", className: "text-[color:var(--deframe-widget-color-text-primary)]", children: token.symbol })
3998
+ ] }) : /* @__PURE__ */ jsxRuntime.jsx(TextBody, { as: "span", className: "text-[color:var(--deframe-widget-color-text-secondary)]", children: selectTokenLabel }) }),
3999
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center justify-center w-[18px] h-[18px]", children: /* @__PURE__ */ jsxRuntime.jsx(hi2.HiChevronDown, { className: "w-3 h-3 text-[color:var(--deframe-widget-color-text-tertiary)]" }) })
4000
+ ]
4001
+ }
4002
+ );
4003
+ };
4004
+ var SwapNetworkSelectorView = ({
4005
+ chainLabel,
4006
+ chainImage,
4007
+ onClick,
4008
+ directionLabel = "De",
4009
+ testId = "swap-network-selector",
4010
+ className
4011
+ }) => {
4012
+ const baseClasses = "flex flex-row items-center gap-[var(--deframe-widget-size-gap-xs)]";
4013
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-test-id": testId, className: tailwindMerge.twMerge(baseClasses, className), children: [
4014
+ /* @__PURE__ */ jsxRuntime.jsx(TextBody, { as: "span", variant: "text-small", className: "tracking-wide text-[color:var(--deframe-widget-color-text-tertiary)]", children: directionLabel }),
4015
+ /* @__PURE__ */ jsxRuntime.jsxs(
4016
+ "button",
4176
4017
  {
4177
- "data-testid": "swap-flow-footer",
4178
- className: "border-t p-md border-border-default dark:border-border-default-dark bg-bg-primary dark:bg-bg-primary-dark",
4179
- children: confirmButton
4018
+ "data-testid": testId,
4019
+ type: "button",
4020
+ onClick,
4021
+ className: "ml-[var(--deframe-widget-size-gap-lg)] bg-[var(--deframe-widget-color-bg-tertiary)] border border-[color:var(--deframe-widget-color-border-tertiary)] rounded-[var(--deframe-widget-size-radius-md)] flex items-center gap-[var(--deframe-widget-size-gap-xs)] px-[var(--deframe-widget-size-padding-x-sm)] py-[var(--deframe-widget-size-padding-y-xs)] hover:border-[color:var(--deframe-widget-color-border-secondary)] transition-colors [font-size:var(--deframe-widget-font-size-sm)] [line-height:var(--deframe-widget-font-leading-sm)] text-[color:var(--deframe-widget-color-text-secondary)] cursor-pointer",
4022
+ "aria-label": `${directionLabel} ${chainLabel}`,
4023
+ children: [
4024
+ chainImage ? /* @__PURE__ */ jsxRuntime.jsx("img", { src: chainImage, alt: chainLabel, className: "w-3 h-3 rounded-[var(--deframe-widget-size-radius-full)]" }) : null,
4025
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: chainLabel }),
4026
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center justify-center w-[18px] h-[18px]", children: /* @__PURE__ */ jsxRuntime.jsx(hi2.HiChevronDown, { className: "w-3 h-3 text-[color:var(--deframe-widget-color-text-tertiary)]" }) })
4027
+ ]
4180
4028
  }
4181
4029
  )
4182
4030
  ] });
@@ -4197,7 +4045,7 @@ var SwapFromCardView = ({
4197
4045
  maxFractionDigits,
4198
4046
  amountUsdFormatted,
4199
4047
  isAmountUsdLoading,
4200
- amountSlot
4048
+ field
4201
4049
  }) => {
4202
4050
  return /* @__PURE__ */ jsxRuntime.jsx(SectionCard, { className: "flex flex-col gap-sm", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-row gap-md items-center", children: [
4203
4051
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-sm flex-1", children: [
@@ -4252,7 +4100,7 @@ var SwapFromCardView = ({
4252
4100
  }
4253
4101
  )
4254
4102
  ] }),
4255
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col flex-1 items-end justify-center gap-xs", children: amountSlot != null ? amountSlot : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
4103
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col flex-1 items-end justify-center gap-xs", children: [
4256
4104
  /* @__PURE__ */ jsxRuntime.jsx(
4257
4105
  SwapAmountInputView,
4258
4106
  {
@@ -4260,7 +4108,8 @@ var SwapFromCardView = ({
4260
4108
  hasError: amountHasError,
4261
4109
  onChange: onAmountChange,
4262
4110
  maxFractionDigits,
4263
- ariaLabel: labels.amountPlaceholder
4111
+ ariaLabel: labels.amountPlaceholder,
4112
+ field
4264
4113
  }
4265
4114
  ),
4266
4115
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -4272,10 +4121,20 @@ var SwapFromCardView = ({
4272
4121
  children: isAmountUsdLoading ? /* @__PURE__ */ jsxRuntime.jsx(LoadingDots, {}) : amountUsdFormatted
4273
4122
  }
4274
4123
  )
4275
- ] }) })
4124
+ ] })
4276
4125
  ] }) });
4277
4126
  };
4278
- var SwapToCardView = ({
4127
+ var SwapOutputAmountView = ({
4128
+ displayOutput,
4129
+ isLoading,
4130
+ loadingElement,
4131
+ searchingQuoteLabel = "Searching quote...",
4132
+ className
4133
+ }) => {
4134
+ const baseClasses = "[font-size:var(--deframe-widget-font-size-xxl)] [line-height:var(--deframe-widget-font-leading-xxl)] [font-weight:var(--deframe-widget-font-weight-extrabold)] text-right w-full min-w-[120px] text-[color:var(--deframe-widget-color-text-primary)]";
4135
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { "data-test-id": "swap-flow-output-amount", className: tailwindMerge.twMerge(baseClasses, className), children: isLoading ? /* @__PURE__ */ jsxRuntime.jsx(TextBody, { as: "span", variant: "text-small", className: "text-[color:var(--deframe-widget-color-text-primary-disabled)] inline-flex items-center", children: loadingElement != null ? loadingElement : searchingQuoteLabel }) : displayOutput });
4136
+ };
4137
+ var SwapToCardView = ({
4279
4138
  labels,
4280
4139
  selectedToken,
4281
4140
  onTokenClick,
@@ -4352,6 +4211,152 @@ var SwapToCardView = ({
4352
4211
  ] })
4353
4212
  ] }) });
4354
4213
  };
4214
+ var SLIPPAGE_OPTIONS = [10, 50, 100];
4215
+ var SwapSlippageToleranceButtonsView = ({
4216
+ slippageBps,
4217
+ onSelect,
4218
+ formatPercentage,
4219
+ className
4220
+ }) => {
4221
+ const baseClasses = "flex gap-[var(--deframe-widget-size-gap-xs)]";
4222
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { "data-test-id": "swap-slippage-tolerance-buttons", className: tailwindMerge.twMerge(baseClasses, className), children: SLIPPAGE_OPTIONS.map((option) => {
4223
+ const isActive = slippageBps === option;
4224
+ const activeClasses = "border-[color:var(--deframe-widget-color-brand-primary)] text-[color:var(--deframe-widget-color-brand-primary)] bg-[color:color-mix(in_srgb,var(--deframe-widget-color-brand-primary)_18%,transparent)]";
4225
+ const inactiveClasses = "border-[color:var(--deframe-widget-color-border-tertiary)] text-[color:var(--deframe-widget-color-text-secondary)] bg-[var(--deframe-widget-color-bg-primary)]";
4226
+ const buttonBase = "px-[var(--deframe-widget-size-padding-x-sm)] py-[var(--deframe-widget-size-padding-y-xs)] rounded-[var(--deframe-widget-size-radius-xs)] border [font-size:var(--deframe-widget-font-size-sm)] [line-height:var(--deframe-widget-font-leading-sm)] cursor-pointer";
4227
+ return /* @__PURE__ */ jsxRuntime.jsx(
4228
+ "button",
4229
+ {
4230
+ "data-test-id": `slippage-option-${option}`,
4231
+ type: "button",
4232
+ onClick: () => onSelect(option),
4233
+ className: tailwindMerge.twMerge(buttonBase, isActive ? activeClasses : inactiveClasses),
4234
+ "aria-label": `${formatPercentage(option)}% slippage`,
4235
+ "aria-pressed": isActive,
4236
+ children: formatPercentage(option)
4237
+ },
4238
+ option
4239
+ );
4240
+ }) });
4241
+ };
4242
+ var SwapAdvancedSettingsView = ({
4243
+ title,
4244
+ isOpen,
4245
+ onOpenChange,
4246
+ slippageBps,
4247
+ onSlippageSelect,
4248
+ formatPercentage,
4249
+ percentageOptions,
4250
+ onPercentageClick,
4251
+ slippageFormatted,
4252
+ collapseText,
4253
+ expandText,
4254
+ maxLabel
4255
+ }) => {
4256
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pb-2 mt-md", children: /* @__PURE__ */ jsxRuntime.jsx(SectionCard, { children: /* @__PURE__ */ jsxRuntime.jsxs(
4257
+ CollapsibleSection,
4258
+ {
4259
+ title,
4260
+ subtitle: slippageFormatted,
4261
+ open: isOpen,
4262
+ onOpenChange,
4263
+ collapseText,
4264
+ expandText,
4265
+ children: [
4266
+ /* @__PURE__ */ jsxRuntime.jsx(
4267
+ SwapSlippageToleranceButtonsView,
4268
+ {
4269
+ slippageBps,
4270
+ onSelect: onSlippageSelect,
4271
+ formatPercentage,
4272
+ className: "mt-md"
4273
+ }
4274
+ ),
4275
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full mt-md", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex w-full gap-sm", children: percentageOptions.map((pct, index) => {
4276
+ const isMax = index === percentageOptions.length - 1;
4277
+ const label = isMax ? maxLabel : `${pct / 100}%`;
4278
+ return /* @__PURE__ */ jsxRuntime.jsx(
4279
+ PercentageButton,
4280
+ {
4281
+ type: "button",
4282
+ onClick: () => onPercentageClick(pct),
4283
+ children: label
4284
+ },
4285
+ pct
4286
+ );
4287
+ }) }) })
4288
+ ]
4289
+ }
4290
+ ) }) });
4291
+ };
4292
+ var SwapQuoteHeaderView = ({
4293
+ label,
4294
+ timerElement,
4295
+ className
4296
+ }) => {
4297
+ const baseClasses = "border-b border-[color:var(--deframe-widget-color-border-secondary)] pb-[var(--deframe-widget-size-padding-y-sm)]";
4298
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { "data-test-id": "swap-quote-header", className: tailwindMerge.twMerge(baseClasses, className), children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between", children: [
4299
+ /* @__PURE__ */ jsxRuntime.jsx(TextBody, { as: "span", variant: "text-small", className: "[font-weight:var(--deframe-widget-font-weight-semibold)] text-[color:var(--deframe-widget-color-text-secondary)] inline-flex items-center", children: label }),
4300
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center gap-[var(--deframe-widget-size-gap-md)]", children: timerElement })
4301
+ ] }) });
4302
+ };
4303
+ var SwapQuoteBlockchainCostsView = ({
4304
+ totalCostFormatted,
4305
+ feePercentage,
4306
+ gasCostFormatted,
4307
+ protocolFee,
4308
+ blockchainCostsLabel = "Blockchain Costs",
4309
+ networkGasLabel = "Network Gas",
4310
+ protocolFeeLabel = "Protocol Fee",
4311
+ collapseLabel = "Collapse",
4312
+ expandLabel = "Expand"
4313
+ }) => {
4314
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { "data-test-id": "swap-quote-blockchain-costs", children: /* @__PURE__ */ jsxRuntime.jsx(
4315
+ CollapsibleInfoRow,
4316
+ {
4317
+ label: blockchainCostsLabel,
4318
+ value: `${totalCostFormatted} ~ ${feePercentage}%`,
4319
+ defaultOpen: true,
4320
+ collapseLabel,
4321
+ expandLabel,
4322
+ children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-[var(--deframe-widget-size-gap-sm)]", children: [
4323
+ /* @__PURE__ */ jsxRuntime.jsxs(InfoRowWithIcon, { children: [
4324
+ /* @__PURE__ */ jsxRuntime.jsx(InfoRowIconLabel, { children: networkGasLabel }),
4325
+ /* @__PURE__ */ jsxRuntime.jsx(InfoRowIconValue, { children: gasCostFormatted })
4326
+ ] }),
4327
+ /* @__PURE__ */ jsxRuntime.jsxs(InfoRowWithIcon, { borderBottom: true, children: [
4328
+ /* @__PURE__ */ jsxRuntime.jsx(InfoRowIconLabel, { children: protocolFeeLabel }),
4329
+ /* @__PURE__ */ jsxRuntime.jsx(InfoRowIconValue, { children: protocolFee })
4330
+ ] })
4331
+ ] })
4332
+ }
4333
+ ) });
4334
+ };
4335
+ var SwapQuoteErrorsView = ({
4336
+ hasQuoteError,
4337
+ hasBytecodeError,
4338
+ quoteErrorMessage = "Unable to get quote for this transaction",
4339
+ bytecodeErrorMessage = "Error building transaction"
4340
+ }) => {
4341
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-test-id": "swap-quote-errors", children: [
4342
+ hasQuoteError && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-sm", children: /* @__PURE__ */ jsxRuntime.jsx(
4343
+ BannerNotification,
4344
+ {
4345
+ type: "inline",
4346
+ variant: "error",
4347
+ message: quoteErrorMessage
4348
+ }
4349
+ ) }),
4350
+ hasBytecodeError && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-sm", children: /* @__PURE__ */ jsxRuntime.jsx(
4351
+ BannerNotification,
4352
+ {
4353
+ type: "inline",
4354
+ variant: "error",
4355
+ message: bytecodeErrorMessage
4356
+ }
4357
+ ) })
4358
+ ] });
4359
+ };
4355
4360
  var SwapQuoteDetailsView = ({
4356
4361
  labels,
4357
4362
  isVisible,
@@ -4437,56 +4442,6 @@ var SwapQuoteDetailsView = ({
4437
4442
  )
4438
4443
  ] });
4439
4444
  };
4440
- var SwapAdvancedSettingsView = ({
4441
- title,
4442
- isOpen,
4443
- onOpenChange,
4444
- slippageBps,
4445
- onSlippageSelect,
4446
- formatPercentage,
4447
- percentageOptions,
4448
- onPercentageClick,
4449
- slippageFormatted,
4450
- collapseText,
4451
- expandText,
4452
- maxLabel
4453
- }) => {
4454
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pb-2 mt-md", children: /* @__PURE__ */ jsxRuntime.jsx(SectionCard, { children: /* @__PURE__ */ jsxRuntime.jsxs(
4455
- CollapsibleSection,
4456
- {
4457
- title,
4458
- subtitle: slippageFormatted,
4459
- open: isOpen,
4460
- onOpenChange,
4461
- collapseText,
4462
- expandText,
4463
- children: [
4464
- /* @__PURE__ */ jsxRuntime.jsx(
4465
- SwapSlippageToleranceButtonsView,
4466
- {
4467
- slippageBps,
4468
- onSelect: onSlippageSelect,
4469
- formatPercentage,
4470
- className: "mt-md"
4471
- }
4472
- ),
4473
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full mt-md", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex w-full gap-sm", children: percentageOptions.map((pct, index) => {
4474
- const isMax = index === percentageOptions.length - 1;
4475
- const label = isMax ? maxLabel : `${pct / 100}%`;
4476
- return /* @__PURE__ */ jsxRuntime.jsx(
4477
- PercentageButton,
4478
- {
4479
- type: "button",
4480
- onClick: () => onPercentageClick(pct),
4481
- children: label
4482
- },
4483
- pct
4484
- );
4485
- }) }) })
4486
- ]
4487
- }
4488
- ) }) });
4489
- };
4490
4445
  var ConfirmSwapButtonView = ({
4491
4446
  buttonLabel,
4492
4447
  disabled,
@@ -4506,6 +4461,73 @@ var ConfirmSwapButtonView = ({
4506
4461
  }
4507
4462
  ) });
4508
4463
  };
4464
+ var SwapFormView = ({
4465
+ onSubmit,
4466
+ formRef,
4467
+ labels,
4468
+ onHistoryClick,
4469
+ onSwitchTokens,
4470
+ switchTokensAriaLabel,
4471
+ fromCard,
4472
+ toCard,
4473
+ advancedSettings,
4474
+ transactionDetails,
4475
+ confirmButton
4476
+ }) => {
4477
+ return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
4478
+ /* @__PURE__ */ jsxRuntime.jsx(
4479
+ "div",
4480
+ {
4481
+ "data-testid": "swap-form-view",
4482
+ className: "flex-1 min-h-0 overflow-y-auto swap-flow-content pr-sm",
4483
+ children: /* @__PURE__ */ jsxRuntime.jsx("form", { ref: formRef, onSubmit, "data-testid": "swap-flow-form", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-md text-text-secondary dark:text-text-secondary-dark", children: [
4484
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-start justify-between gap-md", children: [
4485
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-sm", children: [
4486
+ /* @__PURE__ */ jsxRuntime.jsx(TextHeading, { variant: "h5", className: "!text-[21px]", children: /* @__PURE__ */ jsxRuntime.jsx("span", { "data-testid": "swap-flow-title", children: labels.title }) }),
4487
+ labels.subtitle && /* @__PURE__ */ jsxRuntime.jsx(TextBody, { variant: "text-small", className: "!text-[14px]", children: labels.subtitle })
4488
+ ] }),
4489
+ /* @__PURE__ */ jsxRuntime.jsx(
4490
+ "button",
4491
+ {
4492
+ "data-testid": "swap-history-button",
4493
+ type: "button",
4494
+ onClick: onHistoryClick,
4495
+ className: "flex items-center justify-center w-12 h-12 transition-colors rounded-full cursor-pointer text-text-secondary dark:text-text-secondary-dark hover:text-brand-primary",
4496
+ "aria-label": labels.historyAriaLabel,
4497
+ children: /* @__PURE__ */ jsxRuntime.jsx(md.MdHistory, { className: "w-6 h-6" })
4498
+ }
4499
+ )
4500
+ ] }),
4501
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative flex flex-col items-stretch gap-sm", children: [
4502
+ /* @__PURE__ */ jsxRuntime.jsx(SwapFromCardView, __spreadValues({}, fromCard)),
4503
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex justify-center -my-5 relative z-10", children: /* @__PURE__ */ jsxRuntime.jsx(
4504
+ "button",
4505
+ {
4506
+ "data-testid": "swap-switch-tokens-button",
4507
+ type: "button",
4508
+ onClick: onSwitchTokens,
4509
+ className: "w-10 h-10 rounded-full bg-brand-secondary shadow-md flex items-center justify-center text-text-primary hover:shadow-lg transition-shadow focus:outline-none focus:ring-2 focus:ring-brand-secondary cursor-pointer",
4510
+ "aria-label": switchTokensAriaLabel,
4511
+ children: /* @__PURE__ */ jsxRuntime.jsx(md.MdOutlineSwapVert, { className: "w-5 h-5" })
4512
+ }
4513
+ ) }),
4514
+ /* @__PURE__ */ jsxRuntime.jsx(SwapToCardView, __spreadValues({}, toCard))
4515
+ ] }),
4516
+ /* @__PURE__ */ jsxRuntime.jsx(SwapAdvancedSettingsView, __spreadValues({}, advancedSettings)),
4517
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pb-xl", children: /* @__PURE__ */ jsxRuntime.jsx(SwapQuoteDetailsView, __spreadValues({}, transactionDetails)) })
4518
+ ] }) })
4519
+ }
4520
+ ),
4521
+ /* @__PURE__ */ jsxRuntime.jsx(
4522
+ "div",
4523
+ {
4524
+ "data-testid": "swap-flow-footer",
4525
+ className: "border-t p-md border-border-default dark:border-border-default-dark bg-bg-primary dark:bg-bg-primary-dark",
4526
+ children: /* @__PURE__ */ jsxRuntime.jsx(ConfirmSwapButtonView, __spreadValues({}, confirmButton))
4527
+ }
4528
+ )
4529
+ ] });
4530
+ };
4509
4531
  var ChooseANetworkView = ({
4510
4532
  labels,
4511
4533
  autoFocus = true,
@@ -5118,7 +5140,14 @@ var EarnDesktopView = ({
5118
5140
  transactions
5119
5141
  }) => {
5120
5142
  if (isLoading) {
5121
- return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: loadingSkeleton });
5143
+ if (loadingSkeleton) {
5144
+ return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: loadingSkeleton });
5145
+ }
5146
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-[var(--deframe-widget-size-gap-md)] w-full flex-1 min-h-0 animate-pulse px-[var(--deframe-widget-size-padding-x-lg)] py-[var(--deframe-widget-size-padding-y-lg)]", children: [
5147
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-24 rounded bg-[var(--deframe-widget-color-bg-secondary)]" }),
5148
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-40 rounded bg-[var(--deframe-widget-color-bg-secondary)]" }),
5149
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-60 rounded bg-[var(--deframe-widget-color-bg-secondary)]" })
5150
+ ] });
5122
5151
  }
5123
5152
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-[color:var(--deframe-widget-color-text-primary)] flex flex-col relative overflow-y-auto w-full flex-1 min-h-0 pb-[var(--deframe-widget-size-padding-y-lg)] gap-[var(--deframe-widget-size-gap-md)]", children: [
5124
5153
  /* @__PURE__ */ jsxRuntime.jsx(EarnInvestmentSummaryView, __spreadValues({}, summary)),
@@ -5127,28 +5156,32 @@ var EarnDesktopView = ({
5127
5156
  /* @__PURE__ */ jsxRuntime.jsx(EarnRecentTransactionsView, __spreadValues({}, transactions))
5128
5157
  ] });
5129
5158
  };
5130
- var EarnInvestmentDetailsView = ({
5131
- title,
5132
- onBack,
5133
- tokenIcon,
5134
- fiatBalance,
5135
- profitAmount,
5136
- tokenAmount,
5137
- investedLabel,
5138
- earningsLabel,
5139
- summaryTitle,
5140
- summaryItems,
5141
- pastActivitiesTitle,
5142
- transactions,
5143
- onTransactionClick,
5144
- showMoreButton,
5145
- onLoadMore,
5146
- loadMoreLabel,
5147
- depositLabel,
5148
- onDeposit,
5149
- withdrawLabel,
5150
- onWithdraw
5151
- }) => {
5159
+ var EarnInvestmentDetailsView = (props) => {
5160
+ if (props.isLoading) {
5161
+ return /* @__PURE__ */ jsxRuntime.jsx(BackgroundContainer, { children: props.loadingSkeleton });
5162
+ }
5163
+ const {
5164
+ title,
5165
+ onBack,
5166
+ tokenIcon,
5167
+ fiatBalance,
5168
+ profitAmount,
5169
+ tokenAmount,
5170
+ investedLabel,
5171
+ earningsLabel,
5172
+ summaryTitle,
5173
+ summaryItems,
5174
+ pastActivitiesTitle,
5175
+ transactions,
5176
+ onTransactionClick,
5177
+ showMoreButton,
5178
+ onLoadMore,
5179
+ loadMoreLabel,
5180
+ depositLabel,
5181
+ onDeposit,
5182
+ withdrawLabel,
5183
+ onWithdraw
5184
+ } = props;
5152
5185
  return /* @__PURE__ */ jsxRuntime.jsxs(BackgroundContainer, { children: [
5153
5186
  /* @__PURE__ */ jsxRuntime.jsxs(Navbar, { children: [
5154
5187
  /* @__PURE__ */ jsxRuntime.jsx(BackButton, { onClick: onBack }),
@@ -6497,20 +6530,13 @@ exports.SwapCrossChainProcessingView = SwapCrossChainProcessingView;
6497
6530
  exports.SwapFormView = SwapFormView;
6498
6531
  exports.SwapFromCardView = SwapFromCardView;
6499
6532
  exports.SwapHistoryView = SwapHistoryView;
6500
- exports.SwapNetworkSelectorView = SwapNetworkSelectorView;
6501
- exports.SwapOutputAmountView = SwapOutputAmountView;
6502
6533
  exports.SwapProcessingView = SwapProcessingView;
6503
6534
  exports.SwapProcessingViewSimple = SwapProcessingViewSimple;
6504
- exports.SwapQuoteBlockchainCostsView = SwapQuoteBlockchainCostsView;
6505
6535
  exports.SwapQuoteDetailsView = SwapQuoteDetailsView;
6506
- exports.SwapQuoteErrorsView = SwapQuoteErrorsView;
6507
- exports.SwapQuoteHeaderView = SwapQuoteHeaderView;
6508
6536
  exports.SwapSignatureWarningView = SwapSignatureWarningView;
6509
- exports.SwapSlippageToleranceButtonsView = SwapSlippageToleranceButtonsView;
6510
6537
  exports.SwapSuccessView = SwapSuccessView;
6511
6538
  exports.SwapSuccessViewSimple = SwapSuccessViewSimple;
6512
6539
  exports.SwapToCardView = SwapToCardView;
6513
- exports.SwapTokenSelectorView = SwapTokenSelectorView;
6514
6540
  exports.SwapTransactionFailedView = SwapTransactionFailedView;
6515
6541
  exports.SwapTransactionFailedViewSimple = SwapTransactionFailedViewSimple;
6516
6542
  exports.SwapWidgetFallbackView = SwapWidgetFallbackView;