@deframe-sdk/components 0.1.14 → 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.mjs CHANGED
@@ -4,7 +4,7 @@ import { HiXMark, HiChevronUp, HiChevronDown, HiChevronLeft, HiArrowRight, HiArr
4
4
  import * as React6 from 'react';
5
5
  import React6__default, { useState, useEffect } from 'react';
6
6
  import { motion, AnimatePresence } from 'framer-motion';
7
- import { MdClose, MdOutlineSearch, MdOutlineSearchOff, MdOutlineSwapHoriz, MdHistory, MdArrowRight, MdArrowDropDown, MdCheckCircleOutline, MdErrorOutline, MdWarningAmber, MdInfoOutline, MdArrowUpward, MdArrowDownward } from 'react-icons/md';
7
+ import { MdClose, MdOutlineSearch, MdOutlineSearchOff, MdOutlineSwapHoriz, MdHistory, MdOutlineSwapVert, MdArrowRight, MdArrowDropDown, MdCheckCircleOutline, MdErrorOutline, MdWarningAmber, MdInfoOutline, MdArrowUpward, MdArrowDownward } from 'react-icons/md';
8
8
  import { IoAlertCircleOutline, IoTimeOutline, IoCheckmarkOutline } from 'react-icons/io5';
9
9
  import { PiClockCountdownBold } from 'react-icons/pi';
10
10
 
@@ -168,14 +168,14 @@ function PrimaryButton(_a) {
168
168
  /** enabled state */
169
169
  enabled: [
170
170
  "hover:opacity-90",
171
- "text-[var(--deframe-widget-color-text-primary)]",
171
+ "text-[color:var(--deframe-widget-color-text-inverse)]",
172
172
  "bg-[var(--deframe-widget-color-brand-primary)]",
173
173
  "border-[color:var(--deframe-widget-color-border-primary)]",
174
174
  "cursor-pointer"
175
175
  ].join(" "),
176
176
  /** disabled state */
177
177
  disabled: [
178
- "text-[var(--deframe-widget-color-text-primary-disabled)]",
178
+ "text-[color:var(--deframe-widget-color-text-inverse-disabled)]",
179
179
  "bg-[var(--deframe-widget-color-brand-primary-disabled)]",
180
180
  "border-[color:var(--deframe-widget-color-border-primary-disabled)]",
181
181
  "cursor-not-allowed"
@@ -231,7 +231,7 @@ function SecondaryButton(_a) {
231
231
  ].join(" ");
232
232
  const stateClasses = {
233
233
  enabled: [
234
- "text-[color:var(--deframe-widget-color-brand-secondary)]",
234
+ "text-[color:var(--deframe-widget-color-text-secondary)]",
235
235
  "border-[color:var(--deframe-widget-color-border-secondary)]",
236
236
  "hover:opacity-90",
237
237
  "cursor-pointer"
@@ -291,7 +291,7 @@ function TertiaryButton(_a) {
291
291
  ].join(" ");
292
292
  const stateClasses = {
293
293
  enabled: [
294
- "text-[color:var(--deframe-widget-color-brand-tertiary)]",
294
+ "text-[color:var(--deframe-widget-color-text-tertiary)]",
295
295
  "hover:opacity-90",
296
296
  "cursor-pointer"
297
297
  ].join(" "),
@@ -418,12 +418,12 @@ function Link(_a) {
418
418
  ].join(" ");
419
419
  const stateClasses = {
420
420
  enabled: [
421
- "text-[color:var(--deframe-widget-color-brand-primary)]",
421
+ "text-[color:var(--deframe-widget-color-text-highlight)]",
422
422
  "underline",
423
423
  "cursor-pointer"
424
424
  ].join(" "),
425
425
  disabled: [
426
- "text-[var(--deframe-widget-color-brand-primary-disabled)]",
426
+ "text-[color:var(--deframe-widget-color-text-highlight-disabled)]",
427
427
  "cursor-not-allowed",
428
428
  "pointer-events-none"
429
429
  ].join(" ")
@@ -885,25 +885,35 @@ var Text = React6.forwardRef(
885
885
  var _b = _a, {
886
886
  children,
887
887
  as: Component = "p",
888
+ disabled = false,
888
889
  className = ""
889
890
  } = _b, props = __objRest(_b, [
890
891
  "children",
891
892
  "as",
893
+ "disabled",
892
894
  "className"
893
895
  ]);
894
896
  const baseClasses = [
895
897
  "[font-family:var(--deframe-widget-font-family)]",
896
898
  "[font-size:var(--deframe-widget-font-size-md)]",
897
899
  "[line-height:var(--deframe-widget-font-leading-md)]",
898
- "[font-weight:var(--deframe-widget-font-weight-regular)]",
899
- "text-[color:var(--deframe-widget-color-text-primary)]"
900
+ "[font-weight:var(--deframe-widget-font-weight-regular)]"
900
901
  ].join(" ");
901
- const textClasses = twMerge(baseClasses, className);
902
+ const stateClasses = {
903
+ enabled: "text-[color:var(--deframe-widget-color-text-primary)]",
904
+ disabled: "text-[color:var(--deframe-widget-color-text-primary-disabled)]"
905
+ };
906
+ const textClasses = twMerge(
907
+ baseClasses,
908
+ stateClasses[disabled ? "disabled" : "enabled"],
909
+ className
910
+ );
902
911
  return React6.createElement(
903
912
  Component,
904
913
  __spreadValues({
905
914
  ref,
906
- className: textClasses
915
+ className: textClasses,
916
+ "aria-disabled": disabled || void 0
907
917
  }, props),
908
918
  children
909
919
  );
@@ -916,10 +926,12 @@ var TextAccent = React6.forwardRef(
916
926
  var _b = _a, {
917
927
  as = "span",
918
928
  variant = "accent-medium",
929
+ disabled = false,
919
930
  className = ""
920
931
  } = _b, props = __objRest(_b, [
921
932
  "as",
922
933
  "variant",
934
+ "disabled",
923
935
  "className"
924
936
  ]);
925
937
  const accentVariants = {
@@ -939,8 +951,16 @@ var TextAccent = React6.forwardRef(
939
951
  "[font-weight:var(--deframe-widget-font-weight-semibold)]"
940
952
  ].join(" ")
941
953
  };
954
+ const stateClasses = {
955
+ enabled: "text-[color:var(--deframe-widget-color-text-primary)]",
956
+ disabled: "text-[color:var(--deframe-widget-color-text-primary-disabled)]"
957
+ };
942
958
  const variantClass = accentVariants[variant];
943
- const accentClasses = twMerge(variantClass, className);
959
+ const accentClasses = twMerge(
960
+ variantClass,
961
+ stateClasses[disabled ? "disabled" : "enabled"],
962
+ className
963
+ );
944
964
  return /* @__PURE__ */ jsx(
945
965
  Text_default,
946
966
  __spreadValues({
@@ -948,7 +968,8 @@ var TextAccent = React6.forwardRef(
948
968
  as,
949
969
  className: accentClasses,
950
970
  "data-slot": "text-accent",
951
- "data-test-id": "text-accent"
971
+ "data-test-id": "text-accent",
972
+ "aria-disabled": disabled || void 0
952
973
  }, props)
953
974
  );
954
975
  }
@@ -959,18 +980,15 @@ var TextBody = React6.forwardRef(
959
980
  var _b = _a, {
960
981
  as = "p",
961
982
  variant = "text-medium",
983
+ disabled = false,
962
984
  className = ""
963
985
  } = _b, props = __objRest(_b, [
964
986
  "as",
965
987
  "variant",
988
+ "disabled",
966
989
  "className"
967
990
  ]);
968
991
  const bodyVariants = {
969
- "[font-size:var(--deframe-widget-font-size-lg)] [line-height:var(--deframe-widget-font-leading-lg)]": [
970
- "[font-size:var(--deframe-widget-font-size-lg)]",
971
- "[line-height:var(--deframe-widget-font-leading-lg)]",
972
- "[font-weight:var(--deframe-widget-font-weight-regular)]"
973
- ].join(" "),
974
992
  "text-large": [
975
993
  "[font-size:var(--deframe-widget-font-size-lg)]",
976
994
  "[line-height:var(--deframe-widget-font-leading-lg)]",
@@ -987,8 +1005,16 @@ var TextBody = React6.forwardRef(
987
1005
  "[font-weight:var(--deframe-widget-font-weight-regular)]"
988
1006
  ].join(" ")
989
1007
  };
1008
+ const stateClasses = {
1009
+ enabled: "text-[color:var(--deframe-widget-color-text-primary)]",
1010
+ disabled: "text-[color:var(--deframe-widget-color-text-primary-disabled)]"
1011
+ };
990
1012
  const variantClass = bodyVariants[variant];
991
- const bodyClasses = twMerge(variantClass, className);
1013
+ const bodyClasses = twMerge(
1014
+ variantClass,
1015
+ stateClasses[disabled ? "disabled" : "enabled"],
1016
+ className
1017
+ );
992
1018
  return /* @__PURE__ */ jsx(
993
1019
  Text_default,
994
1020
  __spreadValues({
@@ -996,7 +1022,8 @@ var TextBody = React6.forwardRef(
996
1022
  as,
997
1023
  className: bodyClasses,
998
1024
  "data-slot": "text-body",
999
- "data-test-id": "text-body"
1025
+ "data-test-id": "text-body",
1026
+ "aria-disabled": disabled || void 0
1000
1027
  }, props)
1001
1028
  );
1002
1029
  }
@@ -1007,10 +1034,12 @@ var TextHeading = React6.forwardRef(
1007
1034
  var _b = _a, {
1008
1035
  as,
1009
1036
  variant = "h2",
1037
+ disabled = false,
1010
1038
  className = ""
1011
1039
  } = _b, props = __objRest(_b, [
1012
1040
  "as",
1013
1041
  "variant",
1042
+ "disabled",
1014
1043
  "className"
1015
1044
  ]);
1016
1045
  const headingVariants = {
@@ -1045,8 +1074,16 @@ var TextHeading = React6.forwardRef(
1045
1074
  "[font-weight:var(--deframe-widget-font-weight-bold)]"
1046
1075
  ].join(" ")
1047
1076
  };
1077
+ const stateClasses = {
1078
+ enabled: "text-[color:var(--deframe-widget-color-text-primary)]",
1079
+ disabled: "text-[color:var(--deframe-widget-color-text-primary-disabled)]"
1080
+ };
1048
1081
  const variantClass = headingVariants[variant];
1049
- const headingClasses = twMerge(variantClass, className);
1082
+ const headingClasses = twMerge(
1083
+ variantClass,
1084
+ stateClasses[disabled ? "disabled" : "enabled"],
1085
+ className
1086
+ );
1050
1087
  return /* @__PURE__ */ jsx(
1051
1088
  Text_default,
1052
1089
  __spreadValues({
@@ -1054,7 +1091,8 @@ var TextHeading = React6.forwardRef(
1054
1091
  as: variant === "h-large" ? "h1" : variant,
1055
1092
  className: headingClasses,
1056
1093
  "data-slot": "text-heading",
1057
- "data-test-id": "text-heading"
1094
+ "data-test-id": "text-heading",
1095
+ "aria-disabled": disabled || void 0
1058
1096
  }, props)
1059
1097
  );
1060
1098
  }
@@ -1573,7 +1611,7 @@ function BannerNotificationMessage(_a) {
1573
1611
  return /* @__PURE__ */ jsx(
1574
1612
  TextBody,
1575
1613
  __spreadValues({
1576
- variant: "[font-size:var(--deframe-widget-font-size-md)] [line-height:var(--deframe-widget-font-leading-md)]",
1614
+ variant: "text-medium",
1577
1615
  "data-slot": "banner-notification-message",
1578
1616
  "data-test-id": "banner-notification-message",
1579
1617
  className: twMerge("text-inherit", className)
@@ -1879,7 +1917,7 @@ var SummaryDetails = ({
1879
1917
  /* @__PURE__ */ jsx(
1880
1918
  TextBody,
1881
1919
  {
1882
- variant: "[font-size:var(--deframe-widget-font-size-sm)] [line-height:var(--deframe-widget-font-leading-sm)]",
1920
+ variant: "text-small",
1883
1921
  className: twMerge("text-[color:var(--deframe-widget-color-text-tertiary)]", item.labelClassName),
1884
1922
  children: item.label
1885
1923
  }
@@ -1887,7 +1925,7 @@ var SummaryDetails = ({
1887
1925
  typeof item.value === "string" ? /* @__PURE__ */ jsx(
1888
1926
  TextBody,
1889
1927
  {
1890
- variant: "[font-size:var(--deframe-widget-font-size-sm)] [line-height:var(--deframe-widget-font-leading-sm)]",
1928
+ variant: "text-small",
1891
1929
  className: twMerge("text-[color:var(--deframe-widget-color-text-primary)] [font-weight:var(--deframe-widget-font-weight-medium)]", item.valueClassName),
1892
1930
  children: item.value
1893
1931
  }
@@ -2573,45 +2611,6 @@ var HistoryWithdrawDetailsView = ({
2573
2611
  ] }) })
2574
2612
  ] });
2575
2613
  };
2576
- var SwapNetworkSelectorView = ({
2577
- chainLabel,
2578
- chainImage,
2579
- onClick,
2580
- directionLabel = "De",
2581
- testId = "swap-network-selector",
2582
- className
2583
- }) => {
2584
- const baseClasses = "flex flex-row items-center gap-[var(--deframe-widget-size-gap-xs)]";
2585
- return /* @__PURE__ */ jsxs("div", { "data-test-id": testId, className: twMerge(baseClasses, className), children: [
2586
- /* @__PURE__ */ jsx(TextBody, { as: "span", variant: "[font-size:var(--deframe-widget-font-size-sm)] [line-height:var(--deframe-widget-font-leading-sm)]", className: "tracking-wide text-[color:var(--deframe-widget-color-text-tertiary)]", children: directionLabel }),
2587
- /* @__PURE__ */ jsxs(
2588
- "button",
2589
- {
2590
- "data-testid": testId,
2591
- type: "button",
2592
- onClick,
2593
- 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",
2594
- "aria-label": `${directionLabel} ${chainLabel}`,
2595
- children: [
2596
- chainImage ? /* @__PURE__ */ jsx("img", { src: chainImage, alt: chainLabel, className: "w-3 h-3 rounded-[var(--deframe-widget-size-radius-full)]" }) : null,
2597
- /* @__PURE__ */ jsx("span", { children: chainLabel }),
2598
- /* @__PURE__ */ jsx("div", { className: "flex items-center justify-center w-[18px] h-[18px]", children: /* @__PURE__ */ jsx(HiChevronDown, { className: "w-3 h-3 text-[color:var(--deframe-widget-color-text-tertiary)]" }) })
2599
- ]
2600
- }
2601
- )
2602
- ] });
2603
- };
2604
- var SwapQuoteHeaderView = ({
2605
- label,
2606
- timerElement,
2607
- className
2608
- }) => {
2609
- const baseClasses = "border-b border-[color:var(--deframe-widget-color-border-secondary)] pb-[var(--deframe-widget-size-padding-y-sm)]";
2610
- return /* @__PURE__ */ jsx("div", { "data-test-id": "swap-quote-header", className: twMerge(baseClasses, className), children: /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
2611
- /* @__PURE__ */ jsx(TextBody, { as: "span", variant: "[font-size:var(--deframe-widget-font-size-sm)] [line-height:var(--deframe-widget-font-leading-sm)]", className: "[font-weight:var(--deframe-widget-font-weight-semibold)] text-[color:var(--deframe-widget-color-text-secondary)] inline-flex items-center", children: label }),
2612
- /* @__PURE__ */ jsx("div", { className: "flex items-center gap-[var(--deframe-widget-size-gap-md)]", children: timerElement })
2613
- ] }) });
2614
- };
2615
2614
  var SwapAmountInputView = ({
2616
2615
  value,
2617
2616
  hasError,
@@ -2669,127 +2668,6 @@ var SwapAmountInputView = ({
2669
2668
  })
2670
2669
  );
2671
2670
  };
2672
- var SwapOutputAmountView = ({
2673
- displayOutput,
2674
- isLoading,
2675
- loadingElement,
2676
- searchingQuoteLabel = "Searching quote...",
2677
- className
2678
- }) => {
2679
- 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)]";
2680
- return /* @__PURE__ */ jsx("div", { "data-test-id": "swap-flow-output-amount", className: twMerge(baseClasses, className), children: isLoading ? /* @__PURE__ */ jsx(TextBody, { as: "span", variant: "[font-size:var(--deframe-widget-font-size-sm)] [line-height:var(--deframe-widget-font-leading-sm)]", className: "text-[color:var(--deframe-widget-color-text-primary-disabled)] inline-flex items-center", children: loadingElement != null ? loadingElement : searchingQuoteLabel }) : displayOutput });
2681
- };
2682
- var SwapQuoteErrorsView = ({
2683
- hasQuoteError,
2684
- hasBytecodeError,
2685
- quoteErrorMessage = "Unable to get quote for this transaction",
2686
- bytecodeErrorMessage = "Error building transaction"
2687
- }) => {
2688
- return /* @__PURE__ */ jsxs("div", { "data-test-id": "swap-quote-errors", children: [
2689
- hasQuoteError && /* @__PURE__ */ jsx("div", { className: "mt-sm", children: /* @__PURE__ */ jsx(
2690
- BannerNotification,
2691
- {
2692
- type: "inline",
2693
- variant: "error",
2694
- message: quoteErrorMessage
2695
- }
2696
- ) }),
2697
- hasBytecodeError && /* @__PURE__ */ jsx("div", { className: "mt-sm", children: /* @__PURE__ */ jsx(
2698
- BannerNotification,
2699
- {
2700
- type: "inline",
2701
- variant: "error",
2702
- message: bytecodeErrorMessage
2703
- }
2704
- ) })
2705
- ] });
2706
- };
2707
- var SLIPPAGE_OPTIONS = [10, 50, 100];
2708
- var SwapSlippageToleranceButtonsView = ({
2709
- slippageBps,
2710
- onSelect,
2711
- formatPercentage,
2712
- className
2713
- }) => {
2714
- const baseClasses = "flex gap-[var(--deframe-widget-size-gap-xs)]";
2715
- return /* @__PURE__ */ jsx("div", { "data-test-id": "swap-slippage-tolerance-buttons", className: twMerge(baseClasses, className), children: SLIPPAGE_OPTIONS.map((option) => {
2716
- const isActive = slippageBps === option;
2717
- 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)]";
2718
- 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)]";
2719
- 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";
2720
- return /* @__PURE__ */ jsx(
2721
- "button",
2722
- {
2723
- "data-test-id": `slippage-option-${option}`,
2724
- type: "button",
2725
- onClick: () => onSelect(option),
2726
- className: twMerge(buttonBase, isActive ? activeClasses : inactiveClasses),
2727
- "aria-label": `${formatPercentage(option)}% slippage`,
2728
- "aria-pressed": isActive,
2729
- children: formatPercentage(option)
2730
- },
2731
- option
2732
- );
2733
- }) });
2734
- };
2735
- var SwapTokenSelectorView = ({
2736
- token,
2737
- onClick,
2738
- testId = "swap-token-selector",
2739
- selectTokenLabel = "Select token",
2740
- className
2741
- }) => {
2742
- 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";
2743
- return /* @__PURE__ */ jsxs(
2744
- "button",
2745
- {
2746
- "data-test-id": testId,
2747
- type: "button",
2748
- onClick,
2749
- className: twMerge(baseClasses, className),
2750
- "aria-label": token ? token.symbol : selectTokenLabel,
2751
- children: [
2752
- /* @__PURE__ */ jsx("div", { className: "flex items-center gap-[var(--deframe-widget-size-gap-sm)] flex-1", children: token ? /* @__PURE__ */ jsxs(Fragment, { children: [
2753
- token.logoURI ? /* @__PURE__ */ jsx("img", { src: token.logoURI, alt: token.symbol, className: "w-6 h-6 rounded-[var(--deframe-widget-size-radius-full)]" }) : /* @__PURE__ */ 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() }),
2754
- /* @__PURE__ */ jsx(TextBody, { as: "span", className: "text-[color:var(--deframe-widget-color-text-primary)]", children: token.symbol })
2755
- ] }) : /* @__PURE__ */ jsx(TextBody, { as: "span", className: "text-[color:var(--deframe-widget-color-text-secondary)]", children: selectTokenLabel }) }),
2756
- /* @__PURE__ */ jsx("div", { className: "flex items-center justify-center w-[18px] h-[18px]", children: /* @__PURE__ */ jsx(HiChevronDown, { className: "w-3 h-3 text-[color:var(--deframe-widget-color-text-tertiary)]" }) })
2757
- ]
2758
- }
2759
- );
2760
- };
2761
- var SwapQuoteBlockchainCostsView = ({
2762
- totalCostFormatted,
2763
- feePercentage,
2764
- gasCostFormatted,
2765
- protocolFee,
2766
- blockchainCostsLabel = "Blockchain Costs",
2767
- networkGasLabel = "Network Gas",
2768
- protocolFeeLabel = "Protocol Fee",
2769
- collapseLabel = "Collapse",
2770
- expandLabel = "Expand"
2771
- }) => {
2772
- return /* @__PURE__ */ jsx("div", { "data-test-id": "swap-quote-blockchain-costs", children: /* @__PURE__ */ jsx(
2773
- CollapsibleInfoRow,
2774
- {
2775
- label: blockchainCostsLabel,
2776
- value: `${totalCostFormatted} ~ ${feePercentage}%`,
2777
- defaultOpen: true,
2778
- collapseLabel,
2779
- expandLabel,
2780
- children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-[var(--deframe-widget-size-gap-sm)]", children: [
2781
- /* @__PURE__ */ jsxs(InfoRowWithIcon, { children: [
2782
- /* @__PURE__ */ jsx(InfoRowIconLabel, { children: networkGasLabel }),
2783
- /* @__PURE__ */ jsx(InfoRowIconValue, { children: gasCostFormatted })
2784
- ] }),
2785
- /* @__PURE__ */ jsxs(InfoRowWithIcon, { borderBottom: true, children: [
2786
- /* @__PURE__ */ jsx(InfoRowIconLabel, { children: protocolFeeLabel }),
2787
- /* @__PURE__ */ jsx(InfoRowIconValue, { children: protocolFee })
2788
- ] })
2789
- ] })
2790
- }
2791
- ) });
2792
- };
2793
2671
  var ChooseAStrategyActionsheetView = ({
2794
2672
  isOpen,
2795
2673
  currentActionSheetId,
@@ -2832,7 +2710,7 @@ var ChooseAStrategyActionsheetView = ({
2832
2710
  /* @__PURE__ */ jsx(ListItemLeftSide, { children: /* @__PURE__ */ jsx("img", { src: logoUrl, alt: assetName, className: "w-10 h-10 rounded-[var(--deframe-widget-size-radius-full)]" }) }),
2833
2711
  /* @__PURE__ */ jsxs(ListItemContent, { className: "gap-[var(--deframe-widget-size-gap-xs)]", children: [
2834
2712
  /* @__PURE__ */ jsx(TextBody, { children: resolvedYieldLabel }),
2835
- /* @__PURE__ */ jsx(TextBody, { variant: "[font-size:var(--deframe-widget-font-size-sm)] [line-height:var(--deframe-widget-font-leading-sm)]", children: Badge })
2713
+ /* @__PURE__ */ jsx(TextBody, { variant: "text-small", children: Badge })
2836
2714
  ] }),
2837
2715
  /* @__PURE__ */ jsx(ListItemRightSide, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-center items-center gap-[var(--deframe-widget-size-gap-xs)]", children: [
2838
2716
  /* @__PURE__ */ jsxs("span", { className: "text-[color:var(--deframe-widget-color-state-success)]", children: [
@@ -2858,8 +2736,16 @@ var StrategyDetailsView = ({
2858
2736
  headerTitle = "Details",
2859
2737
  strategyInfoTitle = "Strategy Info",
2860
2738
  depositButtonLabel = "Deposit",
2861
- backAriaLabel = "Back"
2739
+ backAriaLabel = "Back",
2740
+ error,
2741
+ notFoundMessage
2862
2742
  }) => {
2743
+ if (error) {
2744
+ return /* @__PURE__ */ jsx(BackgroundContainer, { children: /* @__PURE__ */ jsx("div", { className: "text-text-secondary dark:text-text-secondary-dark p-md", children: error }) });
2745
+ }
2746
+ if (notFoundMessage) {
2747
+ return /* @__PURE__ */ jsx(BackgroundContainer, { children: /* @__PURE__ */ jsx("div", { className: "text-text-secondary dark:text-text-secondary-dark p-md", children: notFoundMessage }) });
2748
+ }
2863
2749
  return /* @__PURE__ */ jsxs(BackgroundContainer, { children: [
2864
2750
  /* @__PURE__ */ jsx(DetailsHeader, { title: headerTitle, onBack, backAriaLabel }),
2865
2751
  /* @__PURE__ */ 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__ */ jsxs("div", { className: "flex flex-col gap-[var(--deframe-widget-size-gap-lg)] min-h-full", children: [
@@ -2867,7 +2753,7 @@ var StrategyDetailsView = ({
2867
2753
  /* @__PURE__ */ jsx("img", { "data-test-id": "strategy-logo", src: logoUrl, alt: title, className: "w-20 h-20 rounded-[var(--deframe-widget-size-radius-full)]" }),
2868
2754
  /* @__PURE__ */ jsx(TextHeading, { variant: "h5", children: title })
2869
2755
  ] }),
2870
- /* @__PURE__ */ jsx(TextBody, { variant: "[font-size:var(--deframe-widget-font-size-sm)] [line-height:var(--deframe-widget-font-leading-sm)]", children: description }),
2756
+ /* @__PURE__ */ jsx(TextBody, { variant: "text-small", children: description }),
2871
2757
  /* @__PURE__ */ jsx(
2872
2758
  SummaryDetails,
2873
2759
  {
@@ -2960,7 +2846,7 @@ var SearchEmptyState = ({
2960
2846
  /* @__PURE__ */ jsx("div", { className: "w-20 h-20 bg-[var(--deframe-widget-color-bg-tertiary)] rounded-[var(--deframe-widget-size-radius-full)] flex justify-center items-center", children: /* @__PURE__ */ jsx(MdOutlineSearchOff, { className: "w-10 h-10 text-[color:var(--deframe-widget-color-text-tertiary)]" }) }),
2961
2847
  /* @__PURE__ */ jsx(TextHeading, { variant: "h3", children: title })
2962
2848
  ] }),
2963
- /* @__PURE__ */ jsx("div", { className: "self-stretch text-center", children: /* @__PURE__ */ jsx(TextBody, { variant: "[font-size:var(--deframe-widget-font-size-sm)] [line-height:var(--deframe-widget-font-leading-sm)]", children: description }) })
2849
+ /* @__PURE__ */ jsx("div", { className: "self-stretch text-center", children: /* @__PURE__ */ jsx(TextBody, { variant: "text-small", children: description }) })
2964
2850
  ] }) });
2965
2851
  };
2966
2852
  var CollapsibleSection = ({
@@ -2995,7 +2881,7 @@ var CollapsibleSection = ({
2995
2881
  children: [
2996
2882
  /* @__PURE__ */ jsx("div", { className: "flex items-center gap-[var(--deframe-widget-size-gap-xs)]", children: /* @__PURE__ */ jsx(TextBody, { className: "text-[color:var(--deframe-widget-color-text-primary-dark)] [font-weight:var(--deframe-widget-font-weight-medium)]", children: title }) }),
2997
2883
  /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-[var(--deframe-widget-size-gap-xs)]", children: [
2998
- subtitle && /* @__PURE__ */ jsx(TextBody, { variant: "[font-size:var(--deframe-widget-font-size-sm)] [line-height:var(--deframe-widget-font-leading-sm)]", children: subtitle }),
2884
+ subtitle && /* @__PURE__ */ jsx(TextBody, { variant: "text-small", children: subtitle }),
2999
2885
  /* @__PURE__ */ jsx(
3000
2886
  motion.svg,
3001
2887
  {
@@ -4030,7 +3916,7 @@ var ChooseAnAssetSwapView = ({
4030
3916
  ] }),
4031
3917
  searchValue && displayedTokens.length === 0 && !isFetching ? /* @__PURE__ */ jsx(SearchEmptyState, { title: labels.searchEmptyTitle, description: labels.searchEmptyDescription }) : /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-[var(--deframe-widget-size-gap-sm)] w-full mt-[var(--deframe-widget-size-gap-md)] overflow-y-auto flex-1 min-h-0", children: [
4032
3918
  isFetching && /* @__PURE__ */ jsx("div", { className: "flex justify-center items-center w-full py-[var(--deframe-widget-size-padding-y-md)]", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-[var(--deframe-widget-size-gap-xs)]", children: [
4033
- /* @__PURE__ */ jsx(TextBody, { variant: "[font-size:var(--deframe-widget-font-size-sm)] [line-height:var(--deframe-widget-font-leading-sm)]", className: "text-[color:var(--deframe-widget-color-text-secondary)]", children: labels.searchingText }),
3919
+ /* @__PURE__ */ jsx(TextBody, { variant: "text-small", className: "text-[color:var(--deframe-widget-color-text-secondary)]", children: labels.searchingText }),
4034
3920
  /* @__PURE__ */ jsx(LoadingDots, {})
4035
3921
  ] }) }),
4036
3922
  displayedTokens.map((token, index) => {
@@ -4050,11 +3936,11 @@ var ChooseAnAssetSwapView = ({
4050
3936
  /* @__PURE__ */ jsx(ListItemLeftSide, { children: /* @__PURE__ */ jsx("img", { src: token.logoURI || "", alt: token.name, className: "w-10 h-10 rounded-[var(--deframe-widget-size-radius-full)]" }) }),
4051
3937
  /* @__PURE__ */ jsxs(ListItemContent, { children: [
4052
3938
  /* @__PURE__ */ jsx(TextBody, { children: token.name }),
4053
- /* @__PURE__ */ jsx(TextBody, { variant: "[font-size:var(--deframe-widget-font-size-sm)] [line-height:var(--deframe-widget-font-leading-sm)]", children: token.symbol })
3939
+ /* @__PURE__ */ jsx(TextBody, { variant: "text-small", children: token.symbol })
4054
3940
  ] }),
4055
3941
  /* @__PURE__ */ jsxs(ListItemRightSide, { children: [
4056
3942
  /* @__PURE__ */ jsx(TextBody, { children: formattedBalance }),
4057
- /* @__PURE__ */ jsx(TextBody, { variant: "[font-size:var(--deframe-widget-font-size-sm)] [line-height:var(--deframe-widget-font-leading-sm)]", children: formatCurrencyValue(Number(balance == null ? void 0 : balance.amountInUSD) || 0) })
3943
+ /* @__PURE__ */ jsx(TextBody, { variant: "text-small", children: formatCurrencyValue(Number(balance == null ? void 0 : balance.amountInUSD) || 0) })
4058
3944
  ] })
4059
3945
  ]
4060
3946
  },
@@ -4068,77 +3954,77 @@ var ChooseAnAssetSwapView = ({
4068
3954
  }
4069
3955
  ) });
4070
3956
  };
4071
- var SwapFormView = ({
4072
- labels,
4073
- onHistoryClick,
4074
- fromCard,
4075
- switchButton,
4076
- toCard,
4077
- advancedSettings,
4078
- transactionDetails,
4079
- confirmButton
3957
+ var SwapTokenSelectorView = ({
3958
+ token,
3959
+ onClick,
3960
+ testId = "swap-token-selector",
3961
+ selectTokenLabel = "Select token",
3962
+ className
4080
3963
  }) => {
4081
- return /* @__PURE__ */ jsxs(Fragment, { children: [
4082
- /* @__PURE__ */ jsx(
4083
- "div",
4084
- {
4085
- "data-testid": "swap-form-view",
4086
- className: "flex-1 min-h-0 overflow-y-auto swap-flow-content pr-sm",
4087
- children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-md text-text-secondary dark:text-text-secondary-dark", children: [
4088
- /* @__PURE__ */ jsxs("div", { className: "flex items-start justify-between gap-md", children: [
4089
- /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-sm", children: [
4090
- /* @__PURE__ */ jsx(TextHeading, { variant: "h5", className: "!text-[21px]", children: /* @__PURE__ */ jsx("span", { "data-testid": "swap-flow-title", children: labels.title }) }),
4091
- labels.subtitle && /* @__PURE__ */ jsx(TextBody, { variant: "text-small", className: "!text-[14px]", children: labels.subtitle })
4092
- ] }),
4093
- /* @__PURE__ */ jsx(
4094
- "button",
4095
- {
4096
- "data-testid": "swap-history-button",
4097
- type: "button",
4098
- onClick: onHistoryClick,
4099
- 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",
4100
- "aria-label": labels.historyAriaLabel,
4101
- children: /* @__PURE__ */ jsx(MdHistory, { className: "w-6 h-6" })
4102
- }
4103
- )
4104
- ] }),
4105
- /* @__PURE__ */ jsxs("div", { className: "relative flex flex-col items-stretch gap-sm", children: [
4106
- fromCard,
4107
- switchButton,
4108
- toCard
4109
- ] }),
4110
- advancedSettings,
4111
- /* @__PURE__ */ jsx("div", { className: "pb-xl", children: transactionDetails })
4112
- ] })
4113
- }
4114
- ),
4115
- /* @__PURE__ */ jsx(
4116
- "div",
4117
- {
4118
- "data-testid": "swap-flow-footer",
4119
- className: "border-t p-md border-border-default dark:border-border-default-dark bg-bg-primary dark:bg-bg-primary-dark",
4120
- children: confirmButton
4121
- }
4122
- )
4123
- ] });
3964
+ 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";
3965
+ return /* @__PURE__ */ jsxs(
3966
+ "button",
3967
+ {
3968
+ "data-test-id": testId,
3969
+ type: "button",
3970
+ onClick,
3971
+ className: twMerge(baseClasses, className),
3972
+ "aria-label": token ? token.symbol : selectTokenLabel,
3973
+ children: [
3974
+ /* @__PURE__ */ jsx("div", { className: "flex items-center gap-[var(--deframe-widget-size-gap-sm)] flex-1", children: token ? /* @__PURE__ */ jsxs(Fragment, { children: [
3975
+ token.logoURI ? /* @__PURE__ */ jsx("img", { src: token.logoURI, alt: token.symbol, className: "w-6 h-6 rounded-[var(--deframe-widget-size-radius-full)]" }) : /* @__PURE__ */ 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() }),
3976
+ /* @__PURE__ */ jsx(TextBody, { as: "span", className: "text-[color:var(--deframe-widget-color-text-primary)]", children: token.symbol })
3977
+ ] }) : /* @__PURE__ */ jsx(TextBody, { as: "span", className: "text-[color:var(--deframe-widget-color-text-secondary)]", children: selectTokenLabel }) }),
3978
+ /* @__PURE__ */ jsx("div", { className: "flex items-center justify-center w-[18px] h-[18px]", children: /* @__PURE__ */ jsx(HiChevronDown, { className: "w-3 h-3 text-[color:var(--deframe-widget-color-text-tertiary)]" }) })
3979
+ ]
3980
+ }
3981
+ );
4124
3982
  };
4125
- var SwapFromCardView = ({
4126
- labels,
4127
- selectedToken,
4128
- onTokenClick,
4129
- balanceFormatted,
4130
- balanceUsdFormatted,
4131
- onBalanceClick,
3983
+ var SwapNetworkSelectorView = ({
4132
3984
  chainLabel,
4133
3985
  chainImage,
4134
- onNetworkClick,
4135
- amountValue,
4136
- amountHasError,
3986
+ onClick,
3987
+ directionLabel = "De",
3988
+ testId = "swap-network-selector",
3989
+ className
3990
+ }) => {
3991
+ const baseClasses = "flex flex-row items-center gap-[var(--deframe-widget-size-gap-xs)]";
3992
+ return /* @__PURE__ */ jsxs("div", { "data-test-id": testId, className: twMerge(baseClasses, className), children: [
3993
+ /* @__PURE__ */ jsx(TextBody, { as: "span", variant: "text-small", className: "tracking-wide text-[color:var(--deframe-widget-color-text-tertiary)]", children: directionLabel }),
3994
+ /* @__PURE__ */ jsxs(
3995
+ "button",
3996
+ {
3997
+ "data-testid": testId,
3998
+ type: "button",
3999
+ onClick,
4000
+ 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",
4001
+ "aria-label": `${directionLabel} ${chainLabel}`,
4002
+ children: [
4003
+ chainImage ? /* @__PURE__ */ jsx("img", { src: chainImage, alt: chainLabel, className: "w-3 h-3 rounded-[var(--deframe-widget-size-radius-full)]" }) : null,
4004
+ /* @__PURE__ */ jsx("span", { children: chainLabel }),
4005
+ /* @__PURE__ */ jsx("div", { className: "flex items-center justify-center w-[18px] h-[18px]", children: /* @__PURE__ */ jsx(HiChevronDown, { className: "w-3 h-3 text-[color:var(--deframe-widget-color-text-tertiary)]" }) })
4006
+ ]
4007
+ }
4008
+ )
4009
+ ] });
4010
+ };
4011
+ var SwapFromCardView = ({
4012
+ labels,
4013
+ selectedToken,
4014
+ onTokenClick,
4015
+ balanceFormatted,
4016
+ balanceUsdFormatted,
4017
+ onBalanceClick,
4018
+ chainLabel,
4019
+ chainImage,
4020
+ onNetworkClick,
4021
+ amountValue,
4022
+ amountHasError,
4137
4023
  onAmountChange,
4138
4024
  maxFractionDigits,
4139
4025
  amountUsdFormatted,
4140
4026
  isAmountUsdLoading,
4141
- amountSlot
4027
+ field
4142
4028
  }) => {
4143
4029
  return /* @__PURE__ */ jsx(SectionCard, { className: "flex flex-col gap-sm", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-row gap-md items-center", children: [
4144
4030
  /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-sm flex-1", children: [
@@ -4193,7 +4079,7 @@ var SwapFromCardView = ({
4193
4079
  }
4194
4080
  )
4195
4081
  ] }),
4196
- /* @__PURE__ */ jsx("div", { className: "flex flex-col flex-1 items-end justify-center gap-xs", children: amountSlot != null ? amountSlot : /* @__PURE__ */ jsxs(Fragment, { children: [
4082
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col flex-1 items-end justify-center gap-xs", children: [
4197
4083
  /* @__PURE__ */ jsx(
4198
4084
  SwapAmountInputView,
4199
4085
  {
@@ -4201,7 +4087,8 @@ var SwapFromCardView = ({
4201
4087
  hasError: amountHasError,
4202
4088
  onChange: onAmountChange,
4203
4089
  maxFractionDigits,
4204
- ariaLabel: labels.amountPlaceholder
4090
+ ariaLabel: labels.amountPlaceholder,
4091
+ field
4205
4092
  }
4206
4093
  ),
4207
4094
  /* @__PURE__ */ jsx(
@@ -4213,9 +4100,19 @@ var SwapFromCardView = ({
4213
4100
  children: isAmountUsdLoading ? /* @__PURE__ */ jsx(LoadingDots, {}) : amountUsdFormatted
4214
4101
  }
4215
4102
  )
4216
- ] }) })
4103
+ ] })
4217
4104
  ] }) });
4218
4105
  };
4106
+ var SwapOutputAmountView = ({
4107
+ displayOutput,
4108
+ isLoading,
4109
+ loadingElement,
4110
+ searchingQuoteLabel = "Searching quote...",
4111
+ className
4112
+ }) => {
4113
+ 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)]";
4114
+ return /* @__PURE__ */ jsx("div", { "data-test-id": "swap-flow-output-amount", className: twMerge(baseClasses, className), children: isLoading ? /* @__PURE__ */ 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 });
4115
+ };
4219
4116
  var SwapToCardView = ({
4220
4117
  labels,
4221
4118
  selectedToken,
@@ -4293,6 +4190,152 @@ var SwapToCardView = ({
4293
4190
  ] })
4294
4191
  ] }) });
4295
4192
  };
4193
+ var SLIPPAGE_OPTIONS = [10, 50, 100];
4194
+ var SwapSlippageToleranceButtonsView = ({
4195
+ slippageBps,
4196
+ onSelect,
4197
+ formatPercentage,
4198
+ className
4199
+ }) => {
4200
+ const baseClasses = "flex gap-[var(--deframe-widget-size-gap-xs)]";
4201
+ return /* @__PURE__ */ jsx("div", { "data-test-id": "swap-slippage-tolerance-buttons", className: twMerge(baseClasses, className), children: SLIPPAGE_OPTIONS.map((option) => {
4202
+ const isActive = slippageBps === option;
4203
+ 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)]";
4204
+ 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)]";
4205
+ 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";
4206
+ return /* @__PURE__ */ jsx(
4207
+ "button",
4208
+ {
4209
+ "data-test-id": `slippage-option-${option}`,
4210
+ type: "button",
4211
+ onClick: () => onSelect(option),
4212
+ className: twMerge(buttonBase, isActive ? activeClasses : inactiveClasses),
4213
+ "aria-label": `${formatPercentage(option)}% slippage`,
4214
+ "aria-pressed": isActive,
4215
+ children: formatPercentage(option)
4216
+ },
4217
+ option
4218
+ );
4219
+ }) });
4220
+ };
4221
+ var SwapAdvancedSettingsView = ({
4222
+ title,
4223
+ isOpen,
4224
+ onOpenChange,
4225
+ slippageBps,
4226
+ onSlippageSelect,
4227
+ formatPercentage,
4228
+ percentageOptions,
4229
+ onPercentageClick,
4230
+ slippageFormatted,
4231
+ collapseText,
4232
+ expandText,
4233
+ maxLabel
4234
+ }) => {
4235
+ return /* @__PURE__ */ jsx("div", { className: "pb-2 mt-md", children: /* @__PURE__ */ jsx(SectionCard, { children: /* @__PURE__ */ jsxs(
4236
+ CollapsibleSection,
4237
+ {
4238
+ title,
4239
+ subtitle: slippageFormatted,
4240
+ open: isOpen,
4241
+ onOpenChange,
4242
+ collapseText,
4243
+ expandText,
4244
+ children: [
4245
+ /* @__PURE__ */ jsx(
4246
+ SwapSlippageToleranceButtonsView,
4247
+ {
4248
+ slippageBps,
4249
+ onSelect: onSlippageSelect,
4250
+ formatPercentage,
4251
+ className: "mt-md"
4252
+ }
4253
+ ),
4254
+ /* @__PURE__ */ jsx("div", { className: "w-full mt-md", children: /* @__PURE__ */ jsx("div", { className: "flex w-full gap-sm", children: percentageOptions.map((pct, index) => {
4255
+ const isMax = index === percentageOptions.length - 1;
4256
+ const label = isMax ? maxLabel : `${pct / 100}%`;
4257
+ return /* @__PURE__ */ jsx(
4258
+ PercentageButton,
4259
+ {
4260
+ type: "button",
4261
+ onClick: () => onPercentageClick(pct),
4262
+ children: label
4263
+ },
4264
+ pct
4265
+ );
4266
+ }) }) })
4267
+ ]
4268
+ }
4269
+ ) }) });
4270
+ };
4271
+ var SwapQuoteHeaderView = ({
4272
+ label,
4273
+ timerElement,
4274
+ className
4275
+ }) => {
4276
+ const baseClasses = "border-b border-[color:var(--deframe-widget-color-border-secondary)] pb-[var(--deframe-widget-size-padding-y-sm)]";
4277
+ return /* @__PURE__ */ jsx("div", { "data-test-id": "swap-quote-header", className: twMerge(baseClasses, className), children: /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
4278
+ /* @__PURE__ */ 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 }),
4279
+ /* @__PURE__ */ jsx("div", { className: "flex items-center gap-[var(--deframe-widget-size-gap-md)]", children: timerElement })
4280
+ ] }) });
4281
+ };
4282
+ var SwapQuoteBlockchainCostsView = ({
4283
+ totalCostFormatted,
4284
+ feePercentage,
4285
+ gasCostFormatted,
4286
+ protocolFee,
4287
+ blockchainCostsLabel = "Blockchain Costs",
4288
+ networkGasLabel = "Network Gas",
4289
+ protocolFeeLabel = "Protocol Fee",
4290
+ collapseLabel = "Collapse",
4291
+ expandLabel = "Expand"
4292
+ }) => {
4293
+ return /* @__PURE__ */ jsx("div", { "data-test-id": "swap-quote-blockchain-costs", children: /* @__PURE__ */ jsx(
4294
+ CollapsibleInfoRow,
4295
+ {
4296
+ label: blockchainCostsLabel,
4297
+ value: `${totalCostFormatted} ~ ${feePercentage}%`,
4298
+ defaultOpen: true,
4299
+ collapseLabel,
4300
+ expandLabel,
4301
+ children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-[var(--deframe-widget-size-gap-sm)]", children: [
4302
+ /* @__PURE__ */ jsxs(InfoRowWithIcon, { children: [
4303
+ /* @__PURE__ */ jsx(InfoRowIconLabel, { children: networkGasLabel }),
4304
+ /* @__PURE__ */ jsx(InfoRowIconValue, { children: gasCostFormatted })
4305
+ ] }),
4306
+ /* @__PURE__ */ jsxs(InfoRowWithIcon, { borderBottom: true, children: [
4307
+ /* @__PURE__ */ jsx(InfoRowIconLabel, { children: protocolFeeLabel }),
4308
+ /* @__PURE__ */ jsx(InfoRowIconValue, { children: protocolFee })
4309
+ ] })
4310
+ ] })
4311
+ }
4312
+ ) });
4313
+ };
4314
+ var SwapQuoteErrorsView = ({
4315
+ hasQuoteError,
4316
+ hasBytecodeError,
4317
+ quoteErrorMessage = "Unable to get quote for this transaction",
4318
+ bytecodeErrorMessage = "Error building transaction"
4319
+ }) => {
4320
+ return /* @__PURE__ */ jsxs("div", { "data-test-id": "swap-quote-errors", children: [
4321
+ hasQuoteError && /* @__PURE__ */ jsx("div", { className: "mt-sm", children: /* @__PURE__ */ jsx(
4322
+ BannerNotification,
4323
+ {
4324
+ type: "inline",
4325
+ variant: "error",
4326
+ message: quoteErrorMessage
4327
+ }
4328
+ ) }),
4329
+ hasBytecodeError && /* @__PURE__ */ jsx("div", { className: "mt-sm", children: /* @__PURE__ */ jsx(
4330
+ BannerNotification,
4331
+ {
4332
+ type: "inline",
4333
+ variant: "error",
4334
+ message: bytecodeErrorMessage
4335
+ }
4336
+ ) })
4337
+ ] });
4338
+ };
4296
4339
  var SwapQuoteDetailsView = ({
4297
4340
  labels,
4298
4341
  isVisible,
@@ -4378,56 +4421,6 @@ var SwapQuoteDetailsView = ({
4378
4421
  )
4379
4422
  ] });
4380
4423
  };
4381
- var SwapAdvancedSettingsView = ({
4382
- title,
4383
- isOpen,
4384
- onOpenChange,
4385
- slippageBps,
4386
- onSlippageSelect,
4387
- formatPercentage,
4388
- percentageOptions,
4389
- onPercentageClick,
4390
- slippageFormatted,
4391
- collapseText,
4392
- expandText,
4393
- maxLabel
4394
- }) => {
4395
- return /* @__PURE__ */ jsx("div", { className: "pb-2 mt-md", children: /* @__PURE__ */ jsx(SectionCard, { children: /* @__PURE__ */ jsxs(
4396
- CollapsibleSection,
4397
- {
4398
- title,
4399
- subtitle: slippageFormatted,
4400
- open: isOpen,
4401
- onOpenChange,
4402
- collapseText,
4403
- expandText,
4404
- children: [
4405
- /* @__PURE__ */ jsx(
4406
- SwapSlippageToleranceButtonsView,
4407
- {
4408
- slippageBps,
4409
- onSelect: onSlippageSelect,
4410
- formatPercentage,
4411
- className: "mt-md"
4412
- }
4413
- ),
4414
- /* @__PURE__ */ jsx("div", { className: "w-full mt-md", children: /* @__PURE__ */ jsx("div", { className: "flex w-full gap-sm", children: percentageOptions.map((pct, index) => {
4415
- const isMax = index === percentageOptions.length - 1;
4416
- const label = isMax ? maxLabel : `${pct / 100}%`;
4417
- return /* @__PURE__ */ jsx(
4418
- PercentageButton,
4419
- {
4420
- type: "button",
4421
- onClick: () => onPercentageClick(pct),
4422
- children: label
4423
- },
4424
- pct
4425
- );
4426
- }) }) })
4427
- ]
4428
- }
4429
- ) }) });
4430
- };
4431
4424
  var ConfirmSwapButtonView = ({
4432
4425
  buttonLabel,
4433
4426
  disabled,
@@ -4447,6 +4440,73 @@ var ConfirmSwapButtonView = ({
4447
4440
  }
4448
4441
  ) });
4449
4442
  };
4443
+ var SwapFormView = ({
4444
+ onSubmit,
4445
+ formRef,
4446
+ labels,
4447
+ onHistoryClick,
4448
+ onSwitchTokens,
4449
+ switchTokensAriaLabel,
4450
+ fromCard,
4451
+ toCard,
4452
+ advancedSettings,
4453
+ transactionDetails,
4454
+ confirmButton
4455
+ }) => {
4456
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
4457
+ /* @__PURE__ */ jsx(
4458
+ "div",
4459
+ {
4460
+ "data-testid": "swap-form-view",
4461
+ className: "flex-1 min-h-0 overflow-y-auto swap-flow-content pr-sm",
4462
+ children: /* @__PURE__ */ jsx("form", { ref: formRef, onSubmit, "data-testid": "swap-flow-form", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-md text-text-secondary dark:text-text-secondary-dark", children: [
4463
+ /* @__PURE__ */ jsxs("div", { className: "flex items-start justify-between gap-md", children: [
4464
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-sm", children: [
4465
+ /* @__PURE__ */ jsx(TextHeading, { variant: "h5", className: "!text-[21px]", children: /* @__PURE__ */ jsx("span", { "data-testid": "swap-flow-title", children: labels.title }) }),
4466
+ labels.subtitle && /* @__PURE__ */ jsx(TextBody, { variant: "text-small", className: "!text-[14px]", children: labels.subtitle })
4467
+ ] }),
4468
+ /* @__PURE__ */ jsx(
4469
+ "button",
4470
+ {
4471
+ "data-testid": "swap-history-button",
4472
+ type: "button",
4473
+ onClick: onHistoryClick,
4474
+ 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",
4475
+ "aria-label": labels.historyAriaLabel,
4476
+ children: /* @__PURE__ */ jsx(MdHistory, { className: "w-6 h-6" })
4477
+ }
4478
+ )
4479
+ ] }),
4480
+ /* @__PURE__ */ jsxs("div", { className: "relative flex flex-col items-stretch gap-sm", children: [
4481
+ /* @__PURE__ */ jsx(SwapFromCardView, __spreadValues({}, fromCard)),
4482
+ /* @__PURE__ */ jsx("div", { className: "flex justify-center -my-5 relative z-10", children: /* @__PURE__ */ jsx(
4483
+ "button",
4484
+ {
4485
+ "data-testid": "swap-switch-tokens-button",
4486
+ type: "button",
4487
+ onClick: onSwitchTokens,
4488
+ 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",
4489
+ "aria-label": switchTokensAriaLabel,
4490
+ children: /* @__PURE__ */ jsx(MdOutlineSwapVert, { className: "w-5 h-5" })
4491
+ }
4492
+ ) }),
4493
+ /* @__PURE__ */ jsx(SwapToCardView, __spreadValues({}, toCard))
4494
+ ] }),
4495
+ /* @__PURE__ */ jsx(SwapAdvancedSettingsView, __spreadValues({}, advancedSettings)),
4496
+ /* @__PURE__ */ jsx("div", { className: "pb-xl", children: /* @__PURE__ */ jsx(SwapQuoteDetailsView, __spreadValues({}, transactionDetails)) })
4497
+ ] }) })
4498
+ }
4499
+ ),
4500
+ /* @__PURE__ */ jsx(
4501
+ "div",
4502
+ {
4503
+ "data-testid": "swap-flow-footer",
4504
+ className: "border-t p-md border-border-default dark:border-border-default-dark bg-bg-primary dark:bg-bg-primary-dark",
4505
+ children: /* @__PURE__ */ jsx(ConfirmSwapButtonView, __spreadValues({}, confirmButton))
4506
+ }
4507
+ )
4508
+ ] });
4509
+ };
4450
4510
  var ChooseANetworkView = ({
4451
4511
  labels,
4452
4512
  autoFocus = true,
@@ -5059,7 +5119,14 @@ var EarnDesktopView = ({
5059
5119
  transactions
5060
5120
  }) => {
5061
5121
  if (isLoading) {
5062
- return /* @__PURE__ */ jsx(Fragment, { children: loadingSkeleton });
5122
+ if (loadingSkeleton) {
5123
+ return /* @__PURE__ */ jsx(Fragment, { children: loadingSkeleton });
5124
+ }
5125
+ return /* @__PURE__ */ 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: [
5126
+ /* @__PURE__ */ jsx("div", { className: "h-24 rounded bg-[var(--deframe-widget-color-bg-secondary)]" }),
5127
+ /* @__PURE__ */ jsx("div", { className: "h-40 rounded bg-[var(--deframe-widget-color-bg-secondary)]" }),
5128
+ /* @__PURE__ */ jsx("div", { className: "h-60 rounded bg-[var(--deframe-widget-color-bg-secondary)]" })
5129
+ ] });
5063
5130
  }
5064
5131
  return /* @__PURE__ */ 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: [
5065
5132
  /* @__PURE__ */ jsx(EarnInvestmentSummaryView, __spreadValues({}, summary)),
@@ -5068,28 +5135,32 @@ var EarnDesktopView = ({
5068
5135
  /* @__PURE__ */ jsx(EarnRecentTransactionsView, __spreadValues({}, transactions))
5069
5136
  ] });
5070
5137
  };
5071
- var EarnInvestmentDetailsView = ({
5072
- title,
5073
- onBack,
5074
- tokenIcon,
5075
- fiatBalance,
5076
- profitAmount,
5077
- tokenAmount,
5078
- investedLabel,
5079
- earningsLabel,
5080
- summaryTitle,
5081
- summaryItems,
5082
- pastActivitiesTitle,
5083
- transactions,
5084
- onTransactionClick,
5085
- showMoreButton,
5086
- onLoadMore,
5087
- loadMoreLabel,
5088
- depositLabel,
5089
- onDeposit,
5090
- withdrawLabel,
5091
- onWithdraw
5092
- }) => {
5138
+ var EarnInvestmentDetailsView = (props) => {
5139
+ if (props.isLoading) {
5140
+ return /* @__PURE__ */ jsx(BackgroundContainer, { children: props.loadingSkeleton });
5141
+ }
5142
+ const {
5143
+ title,
5144
+ onBack,
5145
+ tokenIcon,
5146
+ fiatBalance,
5147
+ profitAmount,
5148
+ tokenAmount,
5149
+ investedLabel,
5150
+ earningsLabel,
5151
+ summaryTitle,
5152
+ summaryItems,
5153
+ pastActivitiesTitle,
5154
+ transactions,
5155
+ onTransactionClick,
5156
+ showMoreButton,
5157
+ onLoadMore,
5158
+ loadMoreLabel,
5159
+ depositLabel,
5160
+ onDeposit,
5161
+ withdrawLabel,
5162
+ onWithdraw
5163
+ } = props;
5093
5164
  return /* @__PURE__ */ jsxs(BackgroundContainer, { children: [
5094
5165
  /* @__PURE__ */ jsxs(Navbar, { children: [
5095
5166
  /* @__PURE__ */ jsx(BackButton, { onClick: onBack }),
@@ -6341,6 +6412,6 @@ var EarnWithdrawFailedView = ({
6341
6412
  );
6342
6413
  };
6343
6414
 
6344
- export { ActionButton, ActionSheet, AddressDisplay, ApyRange, BackButton, BackgroundContainer, BannerNotification, ChooseANetworkView, ChooseAStrategyActionsheetView, ChooseAnAssetSwapView, CloseButton_default as CloseButton, CollapsibleInfoRow, CollapsibleSection, ConfirmSwapButtonView, ConnectWalletList, Currency, DeframeComponentsProvider, DetailsHeader, EarnAmountInputView, EarnBalanceCard, EarnBytecodeErrorView, EarnDepositFailedView, EarnDepositFormView, EarnDepositProcessingView, EarnDepositSuccessView, EarnDepositWarningView, EarnDesktopView, EarnExploreGridView, EarnInvestedSectionView, EarnInvestmentDetailsView, EarnInvestmentSummaryView, EarnNoBalanceNotificationView, EarnPercentageButtonsView, EarnPositionCardView, EarnRecentTransactionsView, EarnTokenSelectorView, EarnTxStatusCardView, EarnWithdrawFailedView, EarnWithdrawFormView, EarnWithdrawProcessingView, EarnWithdrawSuccessView, EarnWithdrawTokenSelectorView, EarnWithdrawWarningView, Currency as Fiat, FlexCol, FlexRow, GroupedStrategyListView, HighRiskBadge, HistoryDepositDetailsView, HistoryListSkeleton, HistoryListView, HistorySwapDetailsView, HistoryTabEmpty, HistoryWithdrawDetailsView, InfoLabel, InfoRow, InfoRowIconLabel, InfoRowIconValue, InfoRowWithIcon, InfoValue, Input2 as Input, Label, Link, ListItem, ListItemContent, ListItemLeftSide, ListItemRightSide, LoadingDots, LowRiskBadge, MediumRiskBadge, Navbar, PercentageButton, PrimaryButton, ProgressIndicator, ScrollableContent, SearchEmptyState, SearchInput, SecondaryButton, SectionCard, Select, SelectContent, SelectItem, SelectTrigger, Skeleton, StepDisplay, StepStatusIcon, StepStatusText, StrategyDetailsView, StrategyGridCard, SummaryDetails, SummaryDetailsCryptoControlV2, SwapAdvancedSettingsView, SwapAmountInputView, SwapCrossChainProcessingView, SwapFormView, SwapFromCardView, SwapHistoryView, SwapNetworkSelectorView, SwapOutputAmountView, SwapProcessingView, SwapProcessingViewSimple, SwapQuoteBlockchainCostsView, SwapQuoteDetailsView, SwapQuoteErrorsView, SwapQuoteHeaderView, SwapSignatureWarningView, SwapSlippageToleranceButtonsView, SwapSuccessView, SwapSuccessViewSimple, SwapToCardView, SwapTokenSelectorView, SwapTransactionFailedView, SwapTransactionFailedViewSimple, SwapWidgetFallbackView, Tabs, TabsContent, TabsList, TabsTrigger, TertiaryButton, Text_default as Text, TextAccent, TextBody, TextHeading, Title, TokenWithChainBadge, TransactionProcessingDetails, TransactionScreen, TransactionScreenIcon, TransactionScreenInvestmentCard, WalletBalances, WalletConnectPanel, WalletItem, ConnectWalletList as WalletList, WalletListContainer };
6415
+ export { ActionButton, ActionSheet, AddressDisplay, ApyRange, BackButton, BackgroundContainer, BannerNotification, ChooseANetworkView, ChooseAStrategyActionsheetView, ChooseAnAssetSwapView, CloseButton_default as CloseButton, CollapsibleInfoRow, CollapsibleSection, ConfirmSwapButtonView, ConnectWalletList, Currency, DeframeComponentsProvider, DetailsHeader, EarnAmountInputView, EarnBalanceCard, EarnBytecodeErrorView, EarnDepositFailedView, EarnDepositFormView, EarnDepositProcessingView, EarnDepositSuccessView, EarnDepositWarningView, EarnDesktopView, EarnExploreGridView, EarnInvestedSectionView, EarnInvestmentDetailsView, EarnInvestmentSummaryView, EarnNoBalanceNotificationView, EarnPercentageButtonsView, EarnPositionCardView, EarnRecentTransactionsView, EarnTokenSelectorView, EarnTxStatusCardView, EarnWithdrawFailedView, EarnWithdrawFormView, EarnWithdrawProcessingView, EarnWithdrawSuccessView, EarnWithdrawTokenSelectorView, EarnWithdrawWarningView, Currency as Fiat, FlexCol, FlexRow, GroupedStrategyListView, HighRiskBadge, HistoryDepositDetailsView, HistoryListSkeleton, HistoryListView, HistorySwapDetailsView, HistoryTabEmpty, HistoryWithdrawDetailsView, InfoLabel, InfoRow, InfoRowIconLabel, InfoRowIconValue, InfoRowWithIcon, InfoValue, Input2 as Input, Label, Link, ListItem, ListItemContent, ListItemLeftSide, ListItemRightSide, LoadingDots, LowRiskBadge, MediumRiskBadge, Navbar, PercentageButton, PrimaryButton, ProgressIndicator, ScrollableContent, SearchEmptyState, SearchInput, SecondaryButton, SectionCard, Select, SelectContent, SelectItem, SelectTrigger, Skeleton, StepDisplay, StepStatusIcon, StepStatusText, StrategyDetailsView, StrategyGridCard, SummaryDetails, SummaryDetailsCryptoControlV2, SwapAdvancedSettingsView, SwapAmountInputView, SwapCrossChainProcessingView, SwapFormView, SwapFromCardView, SwapHistoryView, SwapProcessingView, SwapProcessingViewSimple, SwapQuoteDetailsView, SwapSignatureWarningView, SwapSuccessView, SwapSuccessViewSimple, SwapToCardView, SwapTransactionFailedView, SwapTransactionFailedViewSimple, SwapWidgetFallbackView, Tabs, TabsContent, TabsList, TabsTrigger, TertiaryButton, Text_default as Text, TextAccent, TextBody, TextHeading, Title, TokenWithChainBadge, TransactionProcessingDetails, TransactionScreen, TransactionScreenIcon, TransactionScreenInvestmentCard, WalletBalances, WalletConnectPanel, WalletItem, ConnectWalletList as WalletList, WalletListContainer };
6345
6416
  //# sourceMappingURL=index.mjs.map
6346
6417
  //# sourceMappingURL=index.mjs.map