@0xsquid/ui 0.2.0 → 0.4.0

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.
Files changed (124) hide show
  1. package/README.md +20 -0
  2. package/dist/cjs/index.js +375 -310
  3. package/dist/cjs/types/components/buttons/AssetsButton.d.ts +10 -0
  4. package/dist/cjs/types/components/buttons/BoostButton.d.ts +1 -1
  5. package/dist/cjs/types/components/buttons/SettingsButton.d.ts +4 -0
  6. package/dist/cjs/types/components/buttons/index.d.ts +2 -1
  7. package/dist/cjs/types/components/controls/SettingsSlider.d.ts +5 -0
  8. package/dist/cjs/types/components/controls/Switch.d.ts +2 -2
  9. package/dist/cjs/types/components/controls/Tooltip.d.ts +4 -2
  10. package/dist/cjs/types/components/controls/index.d.ts +1 -0
  11. package/dist/cjs/types/components/icons/Arrow.d.ts +20 -0
  12. package/dist/cjs/types/components/icons/Clock.d.ts +8 -0
  13. package/dist/cjs/types/components/icons/Coins.d.ts +4 -0
  14. package/dist/cjs/types/components/icons/CompassRound.d.ts +8 -0
  15. package/dist/cjs/types/components/icons/DashboardFast.d.ts +4 -0
  16. package/dist/cjs/types/components/icons/DotGrid.d.ts +4 -1
  17. package/dist/cjs/types/components/icons/Help.d.ts +16 -0
  18. package/dist/cjs/types/components/icons/Infinity.d.ts +4 -0
  19. package/dist/cjs/types/components/icons/Lightning.d.ts +4 -0
  20. package/dist/cjs/types/components/icons/SquidLogo.d.ts +1 -0
  21. package/dist/cjs/types/components/icons/SwapStepSeparator.d.ts +1 -0
  22. package/dist/cjs/types/components/icons/TradingViewSteps.d.ts +4 -0
  23. package/dist/cjs/types/components/layout/Boost.d.ts +9 -1
  24. package/dist/cjs/types/components/layout/DropdownMenu.d.ts +9 -0
  25. package/dist/cjs/types/components/layout/Menu.d.ts +6 -2
  26. package/dist/cjs/types/components/layout/NavigationBar.d.ts +3 -1
  27. package/dist/cjs/types/components/layout/SwapConfiguration.d.ts +3 -0
  28. package/dist/cjs/types/components/layout/SwapProgressViewHeader.d.ts +6 -0
  29. package/dist/cjs/types/components/layout/SwapStepsCollapsed.d.ts +5 -0
  30. package/dist/cjs/types/components/layout/TokenPair.d.ts +12 -0
  31. package/dist/cjs/types/components/layout/index.d.ts +3 -0
  32. package/dist/cjs/types/components/lists/DropdownMenuItem.d.ts +3 -3
  33. package/dist/cjs/types/components/lists/SettingsItem.d.ts +9 -0
  34. package/dist/cjs/types/components/lists/SwapDetailListItem.d.ts +8 -0
  35. package/dist/cjs/types/components/lists/SwapStepItem.d.ts +9 -0
  36. package/dist/cjs/types/components/lists/index.d.ts +3 -0
  37. package/dist/cjs/types/components/views/ProfileView.d.ts +1 -0
  38. package/dist/cjs/types/components/views/SwapDetailsView.d.ts +1 -0
  39. package/dist/cjs/types/core/themes.d.ts +2 -0
  40. package/dist/cjs/types/hooks/index.d.ts +1 -0
  41. package/dist/cjs/types/hooks/useModal.d.ts +10 -0
  42. package/dist/cjs/types/index.d.ts +1 -0
  43. package/dist/cjs/types/providers/SquidConfigProvider.d.ts +4 -2
  44. package/dist/cjs/types/stories/buttons/{Dropdown.stories.d.ts → AssetsButton.stories.d.ts} +3 -2
  45. package/dist/cjs/types/stories/buttons/SettingsButton.stories.d.ts +6 -0
  46. package/dist/cjs/types/stories/controls/SettingsSlider.stories.d.ts +7 -0
  47. package/dist/cjs/types/stories/layout/Boost.stories.d.ts +6 -0
  48. package/dist/cjs/types/stories/layout/DropdownMenu.stories.d.ts +6 -0
  49. package/dist/cjs/types/stories/layout/Menu.stories.d.ts +2 -0
  50. package/dist/cjs/types/stories/layout/NavigationBar.stories.d.ts +1 -0
  51. package/dist/cjs/types/stories/layout/SwapProgressView.stories.d.ts +9 -0
  52. package/dist/cjs/types/stories/layout/SwapProgressViewHeader.stories.d.ts +6 -0
  53. package/dist/cjs/types/stories/layout/TokenPair.stories.d.ts +6 -0
  54. package/dist/cjs/types/stories/lists/SettingsItem.stories.d.ts +9 -0
  55. package/dist/cjs/types/stories/lists/SwapDetailListItem.stories.d.ts +7 -0
  56. package/dist/cjs/types/stories/lists/SwapStepItem.stories.d.ts +10 -0
  57. package/dist/cjs/types/stories/views/ProfileView.stories.d.ts +6 -0
  58. package/dist/cjs/types/stories/views/SwapDetailsView.stories.d.ts +6 -0
  59. package/dist/cjs/types/types/components.d.ts +11 -0
  60. package/dist/cjs/types/types/config.d.ts +1 -0
  61. package/dist/esm/index.js +367 -311
  62. package/dist/esm/types/components/buttons/AssetsButton.d.ts +10 -0
  63. package/dist/esm/types/components/buttons/BoostButton.d.ts +1 -1
  64. package/dist/esm/types/components/buttons/SettingsButton.d.ts +4 -0
  65. package/dist/esm/types/components/buttons/index.d.ts +2 -1
  66. package/dist/esm/types/components/controls/SettingsSlider.d.ts +5 -0
  67. package/dist/esm/types/components/controls/Switch.d.ts +2 -2
  68. package/dist/esm/types/components/controls/Tooltip.d.ts +4 -2
  69. package/dist/esm/types/components/controls/index.d.ts +1 -0
  70. package/dist/esm/types/components/icons/Arrow.d.ts +20 -0
  71. package/dist/esm/types/components/icons/Clock.d.ts +8 -0
  72. package/dist/esm/types/components/icons/Coins.d.ts +4 -0
  73. package/dist/esm/types/components/icons/CompassRound.d.ts +8 -0
  74. package/dist/esm/types/components/icons/DashboardFast.d.ts +4 -0
  75. package/dist/esm/types/components/icons/DotGrid.d.ts +4 -1
  76. package/dist/esm/types/components/icons/Help.d.ts +16 -0
  77. package/dist/esm/types/components/icons/Infinity.d.ts +4 -0
  78. package/dist/esm/types/components/icons/Lightning.d.ts +4 -0
  79. package/dist/esm/types/components/icons/SquidLogo.d.ts +1 -0
  80. package/dist/esm/types/components/icons/SwapStepSeparator.d.ts +1 -0
  81. package/dist/esm/types/components/icons/TradingViewSteps.d.ts +4 -0
  82. package/dist/esm/types/components/layout/Boost.d.ts +9 -1
  83. package/dist/esm/types/components/layout/DropdownMenu.d.ts +9 -0
  84. package/dist/esm/types/components/layout/Menu.d.ts +6 -2
  85. package/dist/esm/types/components/layout/NavigationBar.d.ts +3 -1
  86. package/dist/esm/types/components/layout/SwapConfiguration.d.ts +3 -0
  87. package/dist/esm/types/components/layout/SwapProgressViewHeader.d.ts +6 -0
  88. package/dist/esm/types/components/layout/SwapStepsCollapsed.d.ts +5 -0
  89. package/dist/esm/types/components/layout/TokenPair.d.ts +12 -0
  90. package/dist/esm/types/components/layout/index.d.ts +3 -0
  91. package/dist/esm/types/components/lists/DropdownMenuItem.d.ts +3 -3
  92. package/dist/esm/types/components/lists/SettingsItem.d.ts +9 -0
  93. package/dist/esm/types/components/lists/SwapDetailListItem.d.ts +8 -0
  94. package/dist/esm/types/components/lists/SwapStepItem.d.ts +9 -0
  95. package/dist/esm/types/components/lists/index.d.ts +3 -0
  96. package/dist/esm/types/components/views/ProfileView.d.ts +1 -0
  97. package/dist/esm/types/components/views/SwapDetailsView.d.ts +1 -0
  98. package/dist/esm/types/core/themes.d.ts +2 -0
  99. package/dist/esm/types/hooks/index.d.ts +1 -0
  100. package/dist/esm/types/hooks/useModal.d.ts +10 -0
  101. package/dist/esm/types/index.d.ts +1 -0
  102. package/dist/esm/types/providers/SquidConfigProvider.d.ts +4 -2
  103. package/dist/esm/types/stories/buttons/{Dropdown.stories.d.ts → AssetsButton.stories.d.ts} +3 -2
  104. package/dist/esm/types/stories/buttons/SettingsButton.stories.d.ts +6 -0
  105. package/dist/esm/types/stories/controls/SettingsSlider.stories.d.ts +7 -0
  106. package/dist/esm/types/stories/layout/Boost.stories.d.ts +6 -0
  107. package/dist/esm/types/stories/layout/DropdownMenu.stories.d.ts +6 -0
  108. package/dist/esm/types/stories/layout/Menu.stories.d.ts +2 -0
  109. package/dist/esm/types/stories/layout/NavigationBar.stories.d.ts +1 -0
  110. package/dist/esm/types/stories/layout/SwapProgressView.stories.d.ts +9 -0
  111. package/dist/esm/types/stories/layout/SwapProgressViewHeader.stories.d.ts +6 -0
  112. package/dist/esm/types/stories/layout/TokenPair.stories.d.ts +6 -0
  113. package/dist/esm/types/stories/lists/SettingsItem.stories.d.ts +9 -0
  114. package/dist/esm/types/stories/lists/SwapDetailListItem.stories.d.ts +7 -0
  115. package/dist/esm/types/stories/lists/SwapStepItem.stories.d.ts +10 -0
  116. package/dist/esm/types/stories/views/ProfileView.stories.d.ts +6 -0
  117. package/dist/esm/types/stories/views/SwapDetailsView.stories.d.ts +6 -0
  118. package/dist/esm/types/types/components.d.ts +11 -0
  119. package/dist/esm/types/types/config.d.ts +1 -0
  120. package/dist/index.css +338 -55
  121. package/dist/index.d.ts +119 -20
  122. package/package.json +3 -3
  123. package/dist/cjs/types/components/buttons/Dropdown.d.ts +0 -7
  124. package/dist/esm/types/components/buttons/Dropdown.d.ts +0 -7
package/dist/esm/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
2
- import { useRef, useState, useEffect, useMemo, createContext } from 'react';
2
+ import { useMemo, useRef, useState, useEffect, useCallback } from 'react';
3
3
 
4
4
  function r(e){var t,f,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(f=r(e[t]))&&(n&&(n+=" "),n+=f);}else for(f in e)e[f]&&(n&&(n+=" "),n+=f);return n}function clsx(){for(var e,t,f=0,n="",o=arguments.length;f<o;f++)(e=arguments[f])&&(t=r(e))&&(n&&(n+=" "),n+=t);return n}
5
5
 
@@ -2572,16 +2572,6 @@ function __rest(s, e) {
2572
2572
  return t;
2573
2573
  }
2574
2574
 
2575
- function __awaiter(thisArg, _arguments, P, generator) {
2576
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
2577
- return new (P || (P = Promise))(function (resolve, reject) {
2578
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
2579
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
2580
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
2581
- step((generator = generator.apply(thisArg, _arguments || [])).next());
2582
- });
2583
- }
2584
-
2585
2575
  typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
2586
2576
  var e = new Error(message);
2587
2577
  return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
@@ -2645,6 +2635,9 @@ function ChevronRightSmallIcon() {
2645
2635
  function ArrowLeftIcon() {
2646
2636
  return (jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", children: jsx("path", { d: "M10 6L4 12L10 18M5 12H20", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round" }) }));
2647
2637
  }
2638
+ function ChevronGrabberVerticalIcon({ size = '16', className, }) {
2639
+ return (jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: size, height: size, viewBox: "0 0 16 16", fill: "none", className: className, children: jsx("path", { d: "M5.33301 6.00002L7.52827 3.80476C7.78862 3.54441 8.21073 3.54441 8.47108 3.80476L10.6663 6.00002M5.33301 10L7.52827 12.1953C7.78862 12.4556 8.21073 12.4556 8.47108 12.1953L10.6663 10", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round" }) }));
2640
+ }
2648
2641
 
2649
2642
  function ArrowButton(_a) {
2650
2643
  var { label, disabled } = _a, props = __rest(_a, ["label", "disabled"]);
@@ -2655,350 +2648,229 @@ function ArrowButton(_a) {
2655
2648
  'aria-disabled:tw-bg-grey-600 aria-disabled:tw-text-grey-800'), children: jsx(ArrowRightIcon, {}) })] })));
2656
2649
  }
2657
2650
 
2658
- const animationDuration = '500ms';
2659
- function BoostButton({ boostMode = 'normal', onToggleBoostMode, }) {
2660
- const boostIndicatorRef = useRef(null);
2661
- function handleToggleBoostMode() {
2662
- if (!boostIndicatorRef.current)
2663
- return;
2664
- // we don't want to trigger the animation when the component is mounted
2665
- // so we set the animation duration only when user clicks the button
2666
- boostIndicatorRef.current.style.setProperty('--boost-animation-duration', animationDuration);
2667
- if (boostIndicatorRef.current.dataset.boostMode === 'normal') {
2668
- boostIndicatorRef.current.dataset.boostMode = 'boost';
2669
- onToggleBoostMode === null || onToggleBoostMode === void 0 ? void 0 : onToggleBoostMode({ boostMode: 'boost' });
2670
- }
2671
- else {
2672
- boostIndicatorRef.current.dataset.boostMode = 'normal';
2673
- onToggleBoostMode === null || onToggleBoostMode === void 0 ? void 0 : onToggleBoostMode({ boostMode: 'normal' });
2674
- }
2675
- }
2676
- return (jsxs("div", { onClick: handleToggleBoostMode, className: "tw-relative tw-flex tw-h-squid-xl tw-w-[140px] tw-flex-col tw-justify-between tw-overflow-hidden tw-bg-grey-900 tw-pb-squid-xxs tw-text-grey-300", children: [jsx("span", { className: "tw-via-grey-900/70 tw-absolute tw-left-0 tw-top-0 tw-z-10 tw-h-full tw-w-8 tw-bg-gradient-to-r tw-from-grey-900 tw-to-transparent" }), jsx("span", { className: "tw-via-grey-900/70 tw-absolute tw-right-0 tw-top-0 tw-z-10 tw-h-full tw-w-8 tw-bg-gradient-to-l tw-from-grey-900 tw-to-transparent" }), jsxs("div", { ref: boostIndicatorRef, "data-boost-mode": boostMode, className: "tw-group tw-peer tw-flex tw-h-full tw-items-center tw-justify-between tw-transition-transform data-[boost-mode=boost]:tw-animate-move-to-left-with-spring-bounce data-[boost-mode=normal]:tw-animate-move-to-right-with-spring-bounce", children: [jsx("div", { className: "tw-w-1/2 tw-text-center", children: jsx(BodyText, { size: "small", className: "tw-text-grey-300", children: "Normal" }) }), jsxs("div", { className: "tw-w-1/2 tw-text-center", children: [jsx(BodyText, { size: "small", className: "tw-text-status-positive", children: "Boost" }), ' '] }), jsx("div", { className: "tw-absolute tw-bottom-0 tw-h-1.5 tw-w-[1.5px] tw-rounded-sm tw-bg-grey-500 tw-text-grey-500 group-data-[boost-mode=boost]:tw-left-[calc(50%-2px)] group-data-[boost-mode=normal]:tw-left-[calc(50%-6px)]", style: {
2677
- boxShadow: generateMarkerLines(40),
2678
- } })] }), jsx("div", { className: cn('tw-absolute tw-bottom-0.5 tw-left-[calc(50%-1.5px)] tw-z-20 tw-h-[10px] tw-w-[3px] tw-rounded-sm tw-transition-colors peer-data-[boost-mode=boost]:tw-bg-status-positive peer-data-[boost-mode=normal]:tw-bg-current', `tw-duration-${animationDuration}`) })] }));
2679
- }
2680
- function generateMarkerLines(count) {
2681
- const halfCount = Math.ceil(count / 2);
2682
- const rightShadows = Array.from({ length: halfCount }, (_, index) => {
2683
- return `-${(index + 1) * 6}px 0 currentColor`;
2684
- });
2685
- const leftShadows = Array.from({ length: halfCount }, (_, index) => {
2686
- return `${(index + 1) * 6}px 0 currentColor`;
2687
- });
2688
- const allShadows = [...rightShadows, ...leftShadows];
2689
- return allShadows.join(', ');
2690
- }
2691
-
2692
- const buttonSizeClassMap = {
2693
- md: 'tw-px-squid-xs tw-py-squid-xxs tw-rounded-squid-m tw-border tw-flex tw-items-center tw-gap-squid-xxs tw-min-w-[60px] tw-h-squid-xl tw-justify-center',
2694
- lg: 'tw-border tw-rounded-squid-xxl tw-p-1 tw-h-button tw-w-full',
2695
- };
2696
- const buttonVariantClassMap = {
2697
- primary: 'tw-bg-royal-500 tw-text-grey-100 tw-border-material-light-thin',
2698
- secondary: 'tw-bg-grey-100 tw-text-grey-800 tw-border-material-light-thin',
2699
- tertiary: 'tw-bg-grey-800 tw-text-grey-300 tw-border-material-light-thin',
2700
- };
2701
- // right now all variants have the same disabled styles
2702
- // in the future, we can add more disabled styles for different variants
2703
- const buttonDisabledClass = 'disabled:tw-bg-grey-800 disabled:tw-text-grey-600';
2704
- function Button(_a) {
2705
- var { label, disabled, size, variant, icon } = _a, props = __rest(_a, ["label", "disabled", "size", "variant", "icon"]);
2706
- return (jsx("button", Object.assign({}, props, { disabled: disabled, className: clsx(buttonSizeClassMap[size], buttonVariantClassMap[variant],
2707
- // disabled styles
2708
- buttonDisabledClass,
2709
- // custom classes from props
2710
- props.className), children: size === 'lg' ? (jsx("span", { className: "tw-px-squid-m", children: jsx(BodyText, { size: "medium", children: label }) })) : size === 'md' ? (label && !icon ? (
2711
- // label only
2712
- jsx(BodyText, { size: "small", children: label })) : !label && icon ? (
2713
- // icon only
2714
- icon) : (
2715
- // icon and label
2716
- jsxs(Fragment, { children: [icon, jsx(BodyText, { className: "tw-pr-1", size: "small", children: label })] }))) : null })));
2717
- }
2718
-
2719
- function Chip(_a) {
2720
- var { label, icon } = _a, props = __rest(_a, ["label", "icon"]);
2721
- return (jsx("div", Object.assign({}, props, { className: cn('tw-flex tw-h-squid-m tw-items-center tw-justify-center tw-rounded-squid-m tw-bg-grey-500 tw-text-grey-900', icon && 'tw-w-squid-m', props.className), children: label ? (jsx(CaptionText, { className: "tw-min-w-squid-xl tw-px-squid-xxs tw-text-center", children: label })) : (icon) })));
2651
+ function PlusIcon() {
2652
+ return (jsx("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: jsx("path", { d: "M12 17V12M12 12V7M12 12H17M12 12H7", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round" }) }));
2722
2653
  }
2723
2654
 
2655
+ const SQUID_THEME_CSS_VARIABLE_PREFIX = '--squid-theme-';
2724
2656
  /**
2725
2657
  * Mapping between readable variables name and css variables used TailwindCSS config
2726
2658
  */
2727
2659
  const themeTypesKeys = {
2728
2660
  'accent-gold': {
2729
- cssVariable: '--squid-theme-accent-gold',
2661
+ cssVariable: `${SQUID_THEME_CSS_VARIABLE_PREFIX}accent-gold`,
2730
2662
  },
2731
2663
  'accent-salmon': {
2732
- cssVariable: '--squid-theme-accent-salmon',
2664
+ cssVariable: `${SQUID_THEME_CSS_VARIABLE_PREFIX}accent-salmon`,
2733
2665
  },
2734
2666
  'grey-100': {
2735
- cssVariable: '--squid-theme-grey-100',
2667
+ cssVariable: `${SQUID_THEME_CSS_VARIABLE_PREFIX}grey-100`,
2736
2668
  },
2737
2669
  'grey-200': {
2738
- cssVariable: '--squid-theme-grey-200',
2670
+ cssVariable: `${SQUID_THEME_CSS_VARIABLE_PREFIX}grey-200`,
2739
2671
  },
2740
2672
  'grey-300': {
2741
- cssVariable: '--squid-theme-grey-300',
2673
+ cssVariable: `${SQUID_THEME_CSS_VARIABLE_PREFIX}grey-300`,
2742
2674
  },
2743
2675
  'grey-400': {
2744
- cssVariable: '--squid-theme-grey-400',
2676
+ cssVariable: `${SQUID_THEME_CSS_VARIABLE_PREFIX}grey-400`,
2745
2677
  },
2746
2678
  'grey-500': {
2747
- cssVariable: '--squid-theme-grey-500',
2679
+ cssVariable: `${SQUID_THEME_CSS_VARIABLE_PREFIX}grey-500`,
2748
2680
  },
2749
2681
  'grey-600': {
2750
- cssVariable: '--squid-theme-grey-600',
2682
+ cssVariable: `${SQUID_THEME_CSS_VARIABLE_PREFIX}grey-600`,
2751
2683
  },
2752
2684
  'grey-700': {
2753
- cssVariable: '--squid-theme-grey-700',
2685
+ cssVariable: `${SQUID_THEME_CSS_VARIABLE_PREFIX}grey-700`,
2754
2686
  },
2755
2687
  'grey-800': {
2756
- cssVariable: '--squid-theme-grey-800',
2688
+ cssVariable: `${SQUID_THEME_CSS_VARIABLE_PREFIX}grey-800`,
2757
2689
  },
2758
2690
  'grey-900': {
2759
- cssVariable: '--squid-theme-grey-900',
2691
+ cssVariable: `${SQUID_THEME_CSS_VARIABLE_PREFIX}grey-900`,
2760
2692
  },
2761
2693
  'material-dark-average': {
2762
- cssVariable: '--squid-theme-material-dark-average',
2694
+ cssVariable: `${SQUID_THEME_CSS_VARIABLE_PREFIX}material-dark-average`,
2763
2695
  },
2764
2696
  'material-dark-thick': {
2765
- cssVariable: '--squid-theme-material-dark-thick',
2697
+ cssVariable: `${SQUID_THEME_CSS_VARIABLE_PREFIX}material-dark-thick`,
2766
2698
  },
2767
2699
  'material-dark-thin': {
2768
- cssVariable: '--squid-theme-material-dark-thin',
2700
+ cssVariable: `${SQUID_THEME_CSS_VARIABLE_PREFIX}material-dark-thin`,
2769
2701
  },
2770
2702
  'material-light-average': {
2771
- cssVariable: '--squid-theme-material-light-average',
2703
+ cssVariable: `${SQUID_THEME_CSS_VARIABLE_PREFIX}material-light-average`,
2772
2704
  },
2773
2705
  'material-light-thick': {
2774
- cssVariable: '--squid-theme-material-light-thick',
2706
+ cssVariable: `${SQUID_THEME_CSS_VARIABLE_PREFIX}material-light-thick`,
2775
2707
  },
2776
2708
  'material-light-thin': {
2777
- cssVariable: '--squid-theme-material-light-thin',
2709
+ cssVariable: `${SQUID_THEME_CSS_VARIABLE_PREFIX}material-light-thin`,
2778
2710
  },
2779
2711
  'royal-100': {
2780
- cssVariable: '--squid-theme-royal-100',
2712
+ cssVariable: `${SQUID_THEME_CSS_VARIABLE_PREFIX}royal-100`,
2781
2713
  },
2782
2714
  'royal-200': {
2783
- cssVariable: '--squid-theme-royal-200',
2715
+ cssVariable: `${SQUID_THEME_CSS_VARIABLE_PREFIX}royal-200`,
2784
2716
  },
2785
2717
  'royal-300': {
2786
- cssVariable: '--squid-theme-royal-300',
2718
+ cssVariable: `${SQUID_THEME_CSS_VARIABLE_PREFIX}royal-300`,
2787
2719
  },
2788
2720
  'royal-400': {
2789
- cssVariable: '--squid-theme-royal-400',
2721
+ cssVariable: `${SQUID_THEME_CSS_VARIABLE_PREFIX}royal-400`,
2790
2722
  },
2791
2723
  'royal-500': {
2792
- cssVariable: '--squid-theme-royal-500',
2724
+ cssVariable: `${SQUID_THEME_CSS_VARIABLE_PREFIX}royal-500`,
2793
2725
  },
2794
2726
  'royal-600': {
2795
- cssVariable: '--squid-theme-royal-600',
2727
+ cssVariable: `${SQUID_THEME_CSS_VARIABLE_PREFIX}royal-600`,
2796
2728
  },
2797
2729
  'royal-700': {
2798
- cssVariable: '--squid-theme-royal-700',
2730
+ cssVariable: `${SQUID_THEME_CSS_VARIABLE_PREFIX}royal-700`,
2799
2731
  },
2800
2732
  'royal-800': {
2801
- cssVariable: '--squid-theme-royal-800',
2733
+ cssVariable: `${SQUID_THEME_CSS_VARIABLE_PREFIX}royal-800`,
2802
2734
  },
2803
2735
  'status-negative': {
2804
- cssVariable: '--squid-theme-status-negative',
2736
+ cssVariable: `${SQUID_THEME_CSS_VARIABLE_PREFIX}status-negative`,
2805
2737
  },
2806
2738
  'status-positive': {
2807
- cssVariable: '--squid-theme-status-positive',
2739
+ cssVariable: `${SQUID_THEME_CSS_VARIABLE_PREFIX}status-positive`,
2808
2740
  },
2809
2741
  'volt-300': {
2810
- cssVariable: '--squid-theme-volt-300',
2742
+ cssVariable: `${SQUID_THEME_CSS_VARIABLE_PREFIX}volt-300`,
2811
2743
  },
2812
2744
  'volt-400': {
2813
- cssVariable: '--squid-theme-volt-400',
2745
+ cssVariable: `${SQUID_THEME_CSS_VARIABLE_PREFIX}volt-400`,
2814
2746
  },
2815
2747
  'volt-600': {
2816
- cssVariable: '--squid-theme-volt-600',
2748
+ cssVariable: `${SQUID_THEME_CSS_VARIABLE_PREFIX}volt-600`,
2817
2749
  },
2818
2750
  'volt-700': {
2819
- cssVariable: '--squid-theme-volt-700',
2751
+ cssVariable: `${SQUID_THEME_CSS_VARIABLE_PREFIX}volt-700`,
2820
2752
  },
2821
2753
  'volt-800': {
2822
- cssVariable: '--squid-theme-volt-800',
2754
+ cssVariable: `${SQUID_THEME_CSS_VARIABLE_PREFIX}volt-800`,
2823
2755
  },
2824
2756
  'volt-900': {
2825
- cssVariable: '--squid-theme-volt-900',
2757
+ cssVariable: `${SQUID_THEME_CSS_VARIABLE_PREFIX}volt-900`,
2826
2758
  },
2827
2759
  };
2828
2760
 
2829
- /**
2830
- * Parsing the user readable config to css variables with HSL values
2831
- * @param style
2832
- */
2833
- const getParsedStyle = (style) => {
2834
- if (style) {
2835
- const styleKeys = Object.keys(themeTypesKeys);
2836
- const parsed = styleKeys.map((sk) => {
2837
- const themeItem = themeTypesKeys[sk];
2838
- let userValue = style[sk];
2839
- return {
2840
- [themeItem.cssVariable]: userValue,
2841
- };
2842
- });
2843
- // adds a variant with 0.05 opacity for each color
2844
- // will result in variables like this:
2845
- // var(--squid-theme-grey-100-005) --> grey-100 with 0.05 opacity
2846
- // styleKeys.forEach((sk) => {
2847
- // const themeItem = themeTypesKeys[sk]
2848
- // const valueWith005Opacity = getHexColorFromOpacityPercentage(
2849
- // style[sk], // i.e "#ffffff"
2850
- // 0.05,
2851
- // )
2852
- // // { "--squid-theme-grey-100-005": "#ffffff80" }
2853
- // parsed.push({
2854
- // [`${themeItem.cssVariable}-005`]: valueWith005Opacity,
2855
- // })
2856
- // })
2857
- parsed.push({
2858
- [`${themeTypesKeys['grey-100'].cssVariable}-005`]: getHexColorFromOpacityPercentage(style['grey-100'], 0.05),
2859
- });
2860
- return parsed.reduce((a, v) => {
2861
- const key = Object.keys(v)[0];
2862
- return Object.assign(Object.assign({}, a), { [key]: v[key] });
2863
- });
2864
- }
2865
- };
2866
- function getDominantColor(_a) {
2867
- return __awaiter(this, arguments, void 0, function* ({ imageUrl, sampleSize = 1000, }) {
2868
- return new Promise((resolve, reject) => {
2869
- const img = document.createElement('img');
2870
- img.src = imageUrl;
2871
- img.crossOrigin = 'Anonymous';
2872
- img.onload = () => {
2873
- const canvas = document.createElement('canvas');
2874
- const ctx = canvas.getContext('2d');
2875
- if (!ctx)
2876
- return reject(new Error('Could not create canvas context'));
2877
- const width = img.width;
2878
- const height = img.height;
2879
- const aspectRatio = width / height;
2880
- const newWidth = Math.sqrt(sampleSize * aspectRatio);
2881
- const newHeight = Math.sqrt(sampleSize / aspectRatio);
2882
- canvas.width = newWidth;
2883
- canvas.height = newHeight;
2884
- ctx.drawImage(img, 0, 0, newWidth, newHeight);
2885
- const imageData = ctx.getImageData(0, 0, newWidth, newHeight);
2886
- const data = imageData.data;
2887
- const colorCounts = {};
2888
- for (let i = 0; i < data.length; i += 4) {
2889
- const r = data[i];
2890
- const g = data[i + 1];
2891
- const b = data[i + 2];
2892
- const color = `${r},${g},${b}`;
2893
- colorCounts[color] = (colorCounts[color] || 0) + 1;
2894
- }
2895
- let dominantColor = '';
2896
- let maxCount = 0;
2897
- for (const color in colorCounts) {
2898
- if (colorCounts[color] > maxCount) {
2899
- dominantColor = color;
2900
- maxCount = colorCounts[color];
2901
- }
2902
- }
2903
- resolve(dominantColor.split(',').map(Number));
2904
- };
2905
- img.onerror = reject;
2906
- });
2907
- });
2908
- }
2909
- function getContrastColor({ r, g, b, }) {
2910
- const brightness = (r * 299 + g * 587 + b * 114) / 1000;
2911
- return brightness >= 128 ? '#000' : '#fff';
2912
- }
2913
- /**
2914
- * Returns a hexadecimal color with opacity based on the given color and opacity percentage.
2915
- *
2916
- * @example getHexColorFromOpacityPercentage('#FF0000', 0.5) // '#FF000080'
2917
- *
2918
- * @param {string} color - The base color in hexadecimal format.
2919
- * @param {number} opacity - The opacity percentage (0-1).
2920
- * @returns {string} The hexadecimal color with opacity.
2921
- */
2922
- function getHexColorFromOpacityPercentage(color, opacity) {
2923
- return (color +
2924
- Math.round(opacity * 255)
2925
- .toString(16)
2926
- .padStart(2, '0')).toUpperCase();
2927
- }
2928
-
2929
- function PlusIcon() {
2930
- return (jsx("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: jsx("path", { d: "M12 17V12M12 12V7M12 12H17M12 12H7", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round" }) }));
2931
- }
2932
-
2933
- const DEFAULT_RGB = [158, 121, 210];
2934
- const imageClass = 'tw-w-10 tw-aspect-square tw-ml-2 tw-mr-2 -tw-translate-x-2 tw-flex tw-items-center tw-justify-center';
2935
- function Dropdown({ chainImageUrl, tokenImageUrl, tokenSymbol, }) {
2936
- const [tokenImageRgb, setTokenImageRgb] = useState(DEFAULT_RGB);
2937
- const [chainImageRgb, setChainImageRgb] = useState(DEFAULT_RGB);
2938
- useEffect(() => {
2939
- if (tokenImageUrl) {
2940
- // get dominant color when image is loaded
2941
- getDominantColor({ imageUrl: tokenImageUrl })
2942
- .then((color) => {
2943
- setTokenImageRgb(color);
2944
- })
2945
- .catch((error) => {
2946
- setTokenImageRgb(DEFAULT_RGB);
2947
- console.error('Error getting dominant color for token:', error);
2948
- });
2949
- }
2950
- if (chainImageUrl) {
2951
- getDominantColor({ imageUrl: chainImageUrl })
2952
- .then((color) => {
2953
- setChainImageRgb(color);
2954
- })
2955
- .catch((error) => {
2956
- setChainImageRgb(DEFAULT_RGB);
2957
- console.error('Error getting dominant color for chain:', error);
2958
- });
2959
- }
2960
- }, []);
2961
- const dropdownGradient = useMemo(() => {
2962
- const defaultRgb = DEFAULT_RGB.join(',');
2963
- // if no chain icon, gradient is as follows:
2964
- // 0%-100% default color
2761
+ const imageClass = 'tw-w-[40px] tw-aspect-square tw-flex tw-items-center tw-justify-center';
2762
+ const defaultBgColor = `var(${themeTypesKeys['royal-500'].cssVariable})`;
2763
+ function AssetsButton({ chainImageUrl, tokenImageUrl, tokenSymbol, chainBgColor = defaultBgColor, tokenBgColor = defaultBgColor, tokenTextColor, }) {
2764
+ const bgGradient = useMemo(() => {
2965
2765
  if (!chainImageUrl) {
2966
- return `linear-gradient(to right, rgb(${defaultRgb}), rgb(${defaultRgb}))`;
2766
+ return `linear-gradient(to right, ${defaultBgColor}, ${defaultBgColor})`;
2967
2767
  }
2968
- const tokenRgb = tokenImageRgb.join(',');
2969
- const chainRgb = chainImageRgb.join(',');
2970
- // if chain icon present but no token icon, gradient is as follows:
2971
- // 0%-25% chain color, 25%-100% default color
2972
2768
  if (!tokenImageUrl) {
2973
- return `linear-gradient(to right, rgb(${chainRgb}) 25%, rgb(${defaultRgb}) 30%)`;
2769
+ return `linear-gradient(90deg, ${chainBgColor} 54.86%, ${tokenBgColor} 95.83%)`;
2974
2770
  }
2975
- // if both chain and token icons present, gradient is as follows:
2976
- // 0%-20% chain color, 20%-100% token color
2977
- return `linear-gradient(to right, rgb(${chainRgb}) 20%, rgb(${tokenRgb}) 25%)`;
2978
- }, [chainImageUrl, tokenImageUrl, tokenImageRgb, chainImageRgb]);
2979
- return (jsxs("div", { className: "dropdown-mask tw-flex tw-h-10 tw-w-[209px] tw-items-center tw-text-grey-100", style: {
2980
- backgroundImage: dropdownGradient,
2981
- }, children: [jsx("div", { className: clsx(imageClass), children: chainImageUrl ? jsx("img", { src: chainImageUrl, alt: "" }) : jsx(PlusIcon, {}) }), tokenImageUrl && chainImageUrl ? (jsx("div", { className: clsx(imageClass), children: jsx("img", { src: tokenImageUrl, alt: "" }) })) : null, tokenImageUrl && chainImageUrl ? (jsx(TokenSymbol, { rgb: tokenImageRgb, symbol: tokenSymbol || '' })) : (jsx(SelectTokenLabel, {}))] }));
2982
- }
2983
- const TokenSymbol = ({ rgb, symbol, }) => {
2984
- return (jsxs("div", { className: "tw-mx-auto tw-flex tw-items-center tw-justify-center tw-gap-1.5", style: {
2985
- color: getContrastColor({
2986
- r: Number(rgb[0]),
2987
- g: Number(rgb[1]),
2988
- b: Number(rgb[2]),
2989
- }),
2990
- }, children: [jsx(BodyText, { size: "small", children: symbol }), jsx(ChevronArrowIcon, {})] }));
2771
+ return `linear-gradient(to right, ${chainBgColor} 47.5%, ${tokenBgColor} 52.5%)`;
2772
+ }, [chainBgColor, tokenBgColor]);
2773
+ return (jsxs("div", { className: "tw-relative tw-flex tw-h-squid-xl tw-min-w-[209px] tw-items-center tw-text-grey-100", children: [jsx("svg", { className: "tw-absolute tw-left-0 tw-z-10 tw-h-[40px] tw-w-[72px] tw-text-material-light-thin", viewBox: "0 0 72 40", xmlns: "http://www.w3.org/2000/svg", fill: "currentColor", children: jsx("path", { d: "m57.86 5.86c-.53.53-1.05 1.06-1.56 1.59-3.29 3.38-6.37 6.55-10.3 6.55s-7.01-3.17-10.3-6.55c-.51-.53-1.03-1.06-1.56-1.59-3.9-3.91-9.02-5.86-14.14-5.86s-10.24 1.95-14.14 5.86c-3.91 3.9-5.86 9.02-5.86 14.14s1.95 10.24 5.86 14.14c3.91 3.91 9.02 5.86 14.14 5.86s10.24-1.95 14.14-5.86c.52-.53 1.04-1.06 1.55-1.58 3.29-3.39 6.37-6.56 10.31-6.56s7.02 3.17 10.31 6.56c.51.53 1.03 1.06 1.55 1.58 3.91 3.91 9.02 5.86 14.14 5.86v-40c-5.12 0-10.24 1.95-14.14 5.86zm14.14 33.14c-5.07 0-9.85-1.98-13.43-5.56-.52-.52-1.02-1.04-1.54-1.57-3.43-3.53-6.67-6.86-11.02-6.86s-7.6 3.33-11.04 6.88c-.5.52-1.01 1.04-1.53 1.56-3.59 3.59-8.36 5.57-13.44 5.57s-9.85-1.98-13.43-5.57c-3.59-3.59-5.56-8.36-5.56-13.43s1.98-9.85 5.56-13.44c3.58-3.6 8.35-5.58 13.43-5.58s9.85 1.98 13.44 5.57c.52.52 1.04 1.05 1.55 1.58 3.43 3.53 6.66 6.86 11.02 6.86s7.59-3.33 11.02-6.86c.51-.52 1.02-1.05 1.55-1.58 3.59-3.59 8.36-5.56 13.43-5.56v38z" }) }), jsx("div", { className: cn('tw-assets-button-mask tw-flex tw-h-squid-xl tw-items-center tw-justify-between', tokenImageUrl ? 'tw-w-[90px]' : 'tw-w-full tw-max-w-[72px]'), style: {
2774
+ backgroundImage: bgGradient,
2775
+ }, children: jsx("div", { className: clsx(imageClass), children: chainImageUrl ? (jsx("img", { src: chainImageUrl, alt: "" })) : (jsx(Fragment, { children: jsx(PlusIcon, {}) })) }) }), tokenImageUrl && chainImageUrl ? (jsx("div", { className: clsx(imageClass, 'tw-absolute tw-left-[54px] tw-h-squid-xl tw-rounded-bl-full tw-rounded-tl-full tw-border-b tw-border-t tw-border-material-light-thin'), style: {
2776
+ backgroundColor: tokenBgColor,
2777
+ }, children: jsx("img", { src: tokenImageUrl, alt: "", className: "tw-h-full -tw-translate-x-[2px]" }) })) : null, jsxs("div", { className: cn('tw-flex tw-h-squid-xl tw-w-fit tw-min-w-squid-xl tw-items-center tw-gap-squid-xxs tw-rounded-br-full tw-rounded-tr-full tw-border-b tw-border-r tw-border-t tw-border-material-light-thin tw-py-squid-xs tw-pr-squid-xs', tokenImageUrl && 'tw-pl-[7px]'), style: {
2778
+ backgroundColor: tokenBgColor,
2779
+ color: tokenTextColor,
2780
+ }, children: [jsx(BodyText, { size: "small", className: "tw-leading-[13px]", children: tokenImageUrl ? tokenSymbol : 'Select token' }), jsx(ChevronLargeRightIcon, {})] })] }));
2781
+ }
2782
+
2783
+ const animationDuration = '500ms';
2784
+ function BoostButton({ boostMode, onToggleBoostMode, }) {
2785
+ const boostIndicatorRef = useRef(null);
2786
+ function handleToggleBoostMode() {
2787
+ if (!boostIndicatorRef.current)
2788
+ return;
2789
+ // we don't want to trigger the animation when the component is mounted
2790
+ // so we set the animation duration only when user clicks the button
2791
+ boostIndicatorRef.current.style.setProperty('--boost-animation-duration', animationDuration);
2792
+ if (boostIndicatorRef.current.dataset.boostMode === 'normal') {
2793
+ boostIndicatorRef.current.dataset.boostMode = 'boost';
2794
+ onToggleBoostMode === null || onToggleBoostMode === void 0 ? void 0 : onToggleBoostMode({ boostMode: 'boost' });
2795
+ }
2796
+ else {
2797
+ boostIndicatorRef.current.dataset.boostMode = 'normal';
2798
+ onToggleBoostMode === null || onToggleBoostMode === void 0 ? void 0 : onToggleBoostMode({ boostMode: 'normal' });
2799
+ }
2800
+ }
2801
+ return (jsxs("div", { onClick: handleToggleBoostMode, className: "tw-relative tw-flex tw-h-squid-xl tw-w-[140px] tw-flex-col tw-justify-between tw-overflow-hidden tw-bg-grey-900 tw-pb-squid-xxs tw-text-grey-300", children: [jsx("span", { className: "tw-via-grey-900/70 tw-absolute tw-left-0 tw-top-0 tw-z-10 tw-h-full tw-w-8 tw-bg-gradient-to-r tw-from-grey-900 tw-to-transparent" }), jsx("span", { className: "tw-via-grey-900/70 tw-absolute tw-right-0 tw-top-0 tw-z-10 tw-h-full tw-w-8 tw-bg-gradient-to-l tw-from-grey-900 tw-to-transparent" }), jsxs("div", { ref: boostIndicatorRef, "data-boost-mode": boostMode, className: "tw-group tw-peer tw-flex tw-h-full tw-items-center tw-justify-between tw-transition-transform data-[boost-mode=boost]:tw-animate-move-to-left-with-spring-bounce data-[boost-mode=normal]:tw-animate-move-to-right-with-spring-bounce", children: [jsx("div", { className: "tw-w-1/2 tw-text-center", children: jsx(BodyText, { size: "small", className: "tw-text-grey-300", children: "Normal" }) }), jsxs("div", { className: "tw-w-1/2 tw-text-center", children: [jsx(BodyText, { size: "small", className: "tw-text-status-positive", children: "Boost" }), ' '] }), jsx("div", { className: "tw-absolute tw-bottom-0 tw-h-1.5 tw-w-[1.5px] tw-rounded-sm tw-bg-grey-500 tw-text-grey-500 group-data-[boost-mode=boost]:tw-left-[calc(50%-2px)] group-data-[boost-mode=normal]:tw-left-[calc(50%-6px)]", style: {
2802
+ boxShadow: generateMarkerLines(40),
2803
+ } })] }), jsx("div", { className: cn('tw-absolute tw-bottom-0.5 tw-left-[calc(50%-1.5px)] tw-z-20 tw-h-[10px] tw-w-[3px] tw-rounded-sm tw-transition-colors peer-data-[boost-mode=boost]:tw-bg-status-positive peer-data-[boost-mode=normal]:tw-bg-current'), style: {
2804
+ transitionDuration: animationDuration,
2805
+ } })] }));
2806
+ }
2807
+ function generateMarkerLines(count) {
2808
+ const halfCount = Math.ceil(count / 2);
2809
+ const rightShadows = Array.from({ length: halfCount }, (_, index) => {
2810
+ return `-${(index + 1) * 6}px 0 currentColor`;
2811
+ });
2812
+ const leftShadows = Array.from({ length: halfCount }, (_, index) => {
2813
+ return `${(index + 1) * 6}px 0 currentColor`;
2814
+ });
2815
+ const allShadows = [...rightShadows, ...leftShadows];
2816
+ return allShadows.join(', ');
2817
+ }
2818
+
2819
+ const buttonSizeClassMap = {
2820
+ md: 'tw-px-squid-xs tw-py-squid-xxs tw-rounded-squid-m tw-border tw-flex tw-items-center tw-gap-squid-xxs tw-min-w-[60px] tw-h-squid-xl tw-justify-center',
2821
+ lg: 'tw-border tw-rounded-squid-xxl tw-p-1 tw-h-button tw-w-full',
2991
2822
  };
2992
- const SelectTokenLabel = () => {
2993
- return (jsxs("div", { className: "tw-mx-auto tw-flex tw-items-center tw-justify-center tw-gap-1.5", children: [jsx(BodyText, { size: "small", children: "Select token" }), jsx(ChevronArrowIcon, {})] }));
2823
+ const buttonVariantClassMap = {
2824
+ primary: 'tw-bg-royal-500 tw-text-grey-100 tw-border-material-light-thin',
2825
+ secondary: 'tw-bg-grey-100 tw-text-grey-800 tw-border-material-light-thin',
2826
+ tertiary: 'tw-bg-grey-800 tw-text-grey-300 tw-border-material-light-thin',
2994
2827
  };
2828
+ // right now all variants have the same disabled styles
2829
+ // in the future, we can add more disabled styles for different variants
2830
+ const buttonDisabledClass = 'disabled:tw-bg-grey-800 disabled:tw-text-grey-600';
2831
+ function Button(_a) {
2832
+ var { label, disabled, size, variant, icon } = _a, props = __rest(_a, ["label", "disabled", "size", "variant", "icon"]);
2833
+ return (jsx("button", Object.assign({}, props, { disabled: disabled, className: clsx(buttonSizeClassMap[size], buttonVariantClassMap[variant],
2834
+ // disabled styles
2835
+ buttonDisabledClass,
2836
+ // custom classes from props
2837
+ props.className), children: size === 'lg' ? (jsx("span", { className: "tw-px-squid-m", children: jsx(BodyText, { size: "medium", children: label }) })) : size === 'md' ? (label && !icon ? (
2838
+ // label only
2839
+ jsx(BodyText, { size: "small", children: label })) : !label && icon ? (
2840
+ // icon only
2841
+ icon) : (
2842
+ // icon and label
2843
+ jsxs(Fragment, { children: [icon, jsx(BodyText, { className: "tw-pr-1", size: "small", children: label })] }))) : null })));
2844
+ }
2845
+
2846
+ function Chip(_a) {
2847
+ var { label, icon } = _a, props = __rest(_a, ["label", "icon"]);
2848
+ return (jsx("div", Object.assign({}, props, { className: cn('tw-flex tw-h-squid-m tw-items-center tw-justify-center tw-rounded-squid-m tw-bg-grey-500 tw-text-grey-900', icon && 'tw-w-squid-m', props.className), children: label ? (jsx(CaptionText, { className: "tw-min-w-squid-xl tw-px-squid-xxs tw-text-center", children: label })) : (icon) })));
2849
+ }
2995
2850
 
2996
2851
  function EthereumIcon() {
2997
2852
  return (jsxs("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [jsx("path", { d: "M9.99866 2.91669L9.99866 12.6994L14.471 10.1298L9.99866 2.91669Z", fill: "currentColor" }), jsx("path", { d: "M9.99872 2.91669L5.52637 10.1298L9.99872 12.6995V8.15387V2.91669Z", fill: "currentColor" }), jsx("path", { d: "M9.99866 13.5226V17.0802L14.4737 10.9542L9.99866 13.5226Z", fill: "currentColor" }), jsx("path", { d: "M9.99872 17.0801V13.5225L5.52637 10.9542L9.99872 17.0801Z", fill: "currentColor" }), jsx("path", { d: "M9.99866 12.6994L14.4709 10.1298L9.99866 8.15387V12.6994Z", fill: "currentColor" }), jsx("path", { d: "M5.52637 10.1298L9.99865 12.6994V8.15387L5.52637 10.1298Z", fill: "currentColor" })] }));
2998
2853
  }
2999
2854
 
3000
2855
  function FeeButton() {
3001
- return (jsxs("div", { className: "tw-flex tw-h-squid-xl tw-items-center tw-gap-x-squid-xs tw-px-squid-xs", children: [jsx(Chip, { label: "Fee" }), jsxs("span", { className: "tw-flex tw-items-center tw-gap-squid-xxs", children: [jsx(Chip, { icon: jsx(EthereumIcon, {}) }), jsx(UsdAmount, { usdAmount: 560 })] })] }));
2856
+ return (jsxs("div", { className: "tw-flex tw-h-squid-xl tw-items-center tw-gap-x-squid-xs tw-rounded-squid-m tw-px-squid-xs hover:tw-bg-material-light-thin", children: [jsx(Chip, { label: "Fee" }), jsxs("span", { className: "tw-flex tw-items-center tw-gap-squid-xxs", children: [jsx(Chip, { icon: jsx(EthereumIcon, {}) }), jsx(UsdAmount, { usdAmount: 560 })] })] }));
2857
+ }
2858
+
2859
+ // font size, line height, and letter spacing classes
2860
+ const textClassMap = {
2861
+ small: 'tw-text-heading-small tw-tracking-heading-small tw-leading-heading-small',
2862
+ medium: 'tw-text-heading-medium tw-tracking-heading-medium tw-leading-heading-medium',
2863
+ large: 'tw-text-heading-large tw-tracking-heading-large tw-leading-heading-large',
2864
+ };
2865
+ function HeadingText({ children, bold, size }) {
2866
+ const fontWeightClass = bold
2867
+ ? 'tw-font-heading-bold'
2868
+ : 'tw-font-heading-regular';
2869
+ return (jsx("h6", { className: clsx(textClassMap[size], fontWeightClass), children: children }));
2870
+ }
2871
+
2872
+ function SettingsButton({ label }) {
2873
+ return (jsx("button", { className: "tw-flex tw-items-center tw-justify-center tw-self-stretch tw-rounded-squid-xs tw-border-2 tw-border-transparent tw-p-squid-xs", children: jsx(CaptionText, { children: label }) }));
3002
2874
  }
3003
2875
 
3004
2876
  function SearchIcon() {
@@ -3013,6 +2885,10 @@ const PasteButton = () => {
3013
2885
  return (jsx("button", { className: "tw-h-[30px] tw-rounded-full tw-border tw-border-grey-700 tw-bg-grey-800 tw-px-2 tw-text-grey-300", children: jsx(CaptionText, { children: "Paste" }) }));
3014
2886
  };
3015
2887
 
2888
+ function SettingsSlider({ value, type }) {
2889
+ return (jsxs("div", { className: "tw-flex tw-items-center tw-justify-center tw-gap-squid-xs tw-self-stretch tw-rounded-squid-xs tw-border-royal-500 tw-p-squid-xs", children: [jsx("span", { className: "tw-flex tw-items-center tw-justify-center", children: type === 'percentage' ? (jsxs(Fragment, { children: [jsx(CaptionText, { className: "tw-text-grey-600", children: String(value) }), jsx(CaptionText, { className: "tw-text-grey-300", children: "%" })] })) : (jsxs(Fragment, { children: [jsx(CaptionText, { className: "tw-text-grey-300", children: "$" }), jsx(CaptionText, { className: "tw-text-grey-600", children: String(value) })] })) }), jsx(Chip, { icon: jsx(ChevronGrabberVerticalIcon, { className: "tw-text-grey-900" }) })] }));
2890
+ }
2891
+
3016
2892
  const switchSizeClassMap = {
3017
2893
  small: 'tw-w-[36px] tw-h-squid-m tw-p-0.5',
3018
2894
  large: 'tw-w-[54px] tw-h-squid-l tw-p-[3px]',
@@ -3021,14 +2897,14 @@ const switchCircleSizeClassMap = {
3021
2897
  small: 'tw-w-4 tw-h-4',
3022
2898
  large: 'tw-w-6 tw-h-6',
3023
2899
  };
3024
- function Switch({ checked, onChange, size }) {
2900
+ function Switch({ checked = false, onChange, size }) {
3025
2901
  return (
3026
2902
  // Switch container
3027
2903
  jsxs("label", { className: clsx('tw-relative tw-inline-flex tw-items-center tw-justify-end tw-overflow-hidden tw-rounded-squid-m tw-border tw-border-material-light-thin',
3028
2904
  // size styles
3029
2905
  switchSizeClassMap[size],
3030
2906
  // checked styles
3031
- checked ? 'tw-bg-status-positive' : 'tw-bg-grey-800'), children: [jsx("input", { checked: checked, onChange: (e) => onChange(e.target.checked), type: "checkbox", className: "tw-peer tw-sr-only" }), jsx("span", { style: {
2907
+ checked ? 'tw-bg-status-positive' : 'tw-bg-grey-800'), children: [jsx("input", { checked: checked, onChange: (e) => onChange === null || onChange === void 0 ? void 0 : onChange(e.target.checked), type: "checkbox", className: "tw-peer tw-sr-only" }), jsx("span", { style: {
3032
2908
  filter: 'drop-shadow(0px 5px 20px rgba(0, 0, 0, 0.33)) drop-shadow(0px 2px 5px rgba(0, 0, 0, 0.20))',
3033
2909
  }, className: clsx('tw-absolute tw-rounded-full tw-border tw-border-material-light-thin',
3034
2910
  // size styles
@@ -3039,12 +2915,13 @@ function Switch({ checked, onChange, size }) {
3039
2915
  : 'tw-left-0.5 tw-bg-grey-500') })] }));
3040
2916
  }
3041
2917
 
2918
+ const borderRadiusClassMap = {
2919
+ sm: 'tw-rounded-squid-s',
2920
+ lg: 'tw-rounded-squid-m',
2921
+ };
3042
2922
  function Menu(_a) {
3043
- var { children, menuClassName, contentClassName } = _a, props = __rest(_a, ["children", "menuClassName", "contentClassName"]);
3044
- return (jsx("div", Object.assign({}, props, { className: menuClassName, children: jsx("div", { style: {
3045
- boxShadow: '0px 2px 5px 1px rgba(0, 0, 0, 0.20), 0px 5px 20px -1px rgba(0, 0, 0, 0.33)',
3046
- backdropFilter: 'blur(calc(20px / 2))',
3047
- }, className: cn('tw-w-full tw-max-w-[320px] tw-items-center tw-justify-center tw-rounded-squid-m tw-border tw-border-material-light-thin tw-bg-material-dark-thick tw-p-squid-s tw-text-center tw-text-material-light-thick', contentClassName), children: typeof children === 'string' ? (jsx(CaptionText, { children: children })) : (children) }) })));
2923
+ var { children, containerClassName, contentClassName, title, displayControls, rounded = 'lg' } = _a, props = __rest(_a, ["children", "containerClassName", "contentClassName", "title", "displayControls", "rounded"]);
2924
+ return (jsx("div", Object.assign({}, props, { className: cn('tw-max-w-[320px]', containerClassName), children: jsxs("div", { className: cn('tw-backdrop-blur/10 tw-relative tw-inline-flex tw-flex-col tw-items-center tw-justify-center tw-gap-squid-xs tw-rounded-squid-m tw-bg-material-dark-thick tw-p-squid-s tw-text-center tw-text-material-light-thick group-data-[squid-theme-type=dark]:tw-shadow-elevation-dark-2 group-data-[squid-theme-type=light]:tw-shadow-elevation-light-2', borderRadiusClassMap[rounded], contentClassName), children: [title ? (jsx("div", { className: "tw-z-20 tw-flex tw-flex-col tw-items-center tw-justify-center tw-self-stretch tw-py-squid-xxs tw-text-grey-100", children: jsx(BodyText, { size: "small", className: "tw-self-stretch !tw-leading-[10px]", children: title }) })) : null, typeof children === 'string' ? (jsx(CaptionText, { className: "tw-z-20 tw-self-stretch", children: children })) : (jsx("div", { className: "tw-z-20", children: children })), displayControls ? (jsx("div", { className: "tw-z-20 tw-flex tw-flex-col tw-items-center tw-justify-center tw-gap-squid-xs tw-self-stretch tw-pt-squid-xs", children: jsx(Button, { size: "md", variant: "tertiary", label: "Learn more", className: "tw-self-stretch" }) })) : null, jsx("div", { className: cn('tw-backdrop-blur/10 tw-absolute tw-z-10 tw-h-full tw-w-full tw-border tw-border-material-light-thin tw-bg-material-light-thin', borderRadiusClassMap[rounded]) })] }) })));
3048
2925
  }
3049
2926
 
3050
2927
  const tooltipWidthClassMap = {
@@ -3060,12 +2937,12 @@ const tooltipThresholdClassMap = {
3060
2937
  xl: 'tw-pb-squid-xl',
3061
2938
  xxl: 'tw-pb-squid-xxl',
3062
2939
  };
3063
- function Tooltip({ children, tooltipContent, tooltipWidth = 'container', threshold = 'xxs', className, }) {
3064
- return (jsxs("div", { className: cn('tw-relative', className), children: [jsx("div", { className: "tw-peer", children: children }), jsx(Menu, { menuClassName: cn('tw-absolute peer-hover:tw-block hover:tw-block tw-hidden tw-z-40', 'tw-left-1/2 -tw-translate-x-1/2 tw-bottom-full', tooltipWidthClassMap[tooltipWidth], tooltipThresholdClassMap[threshold]), children: tooltipContent })] }));
2940
+ function Tooltip({ children, tooltipContent, tooltipWidth = 'container', threshold = 'xxs', containerClassName, childrenClassName, tooltipClassName, }) {
2941
+ return (jsxs("div", { className: cn('tw-relative', containerClassName), children: [jsx("div", { className: cn('tw-peer', childrenClassName), children: children }), jsx(Menu, { containerClassName: cn('tw-absolute tw-z-40 tw-hidden hover:tw-block peer-hover:tw-block', 'tw-bottom-full tw-left-1/2 -tw-translate-x-1/2', tooltipWidthClassMap[tooltipWidth], tooltipThresholdClassMap[threshold], tooltipClassName), children: tooltipContent })] }));
3065
2942
  }
3066
2943
 
3067
- function Boost() {
3068
- return (jsxs("div", { className: "tw-flex tw-h-squid-xl tw-items-center tw-gap-x-squid-xxs", children: [jsx(BoostButton, {}), jsx(Chip, { label: "20s", className: "tw-bg-status-positive tw-text-grey-900" })] }));
2944
+ function Boost({ boostMode, onToggleBoostMode }) {
2945
+ return (jsxs("div", { className: "tw-flex tw-h-squid-xl tw-items-center tw-gap-x-squid-xxs tw-bg-grey-900 tw-pr-squid-xxs", children: [jsx(BoostButton, { boostMode: boostMode, onToggleBoostMode: onToggleBoostMode }), jsx(Chip, { label: boostMode === 'normal' ? '10m' : '20s', className: cn('tw-text-grey-900 tw-transition-colors', boostMode === 'normal' ? 'tw-bg-grey-300' : 'tw-bg-status-positive') })] }));
3069
2946
  }
3070
2947
 
3071
2948
  var DetailsToolbarState;
@@ -3088,7 +2965,7 @@ const detailStateClassMap = {
3088
2965
  };
3089
2966
  function DetailsToolbar({ state = DetailsToolbarState.FULL, errorMessage, }) {
3090
2967
  const detailClassName = cn('tw-w-[190px]', detailStateClassMap[state]);
3091
- return (jsx("aside", { className: "tw-h-squid-[50px] tw-flex tw-w-[480px] tw-items-center tw-justify-around tw-bg-grey-900 tw-px-squid-m tw-py-squid-xxs tw-text-grey-500", children: state === DetailsToolbarState.ERROR ? (jsx(ErrorMessage, { message: errorMessage })) : (jsxs(Fragment, { children: [jsx("div", { className: detailClassName, children: jsx(FeeButton, {}) }), jsx("div", { className: "tw-flex tw-h-squid-xl tw-w-squid-xxl tw-items-center tw-justify-center", children: state === DetailsToolbarState.LOADING ? (jsx(Loader, { size: "32" })) : (jsx(Button, { variant: "tertiary", size: "md", className: "tw-border-transparent tw-bg-transparent", icon: jsx(ChevronLargeDownIcon, {}) })) }), jsx("div", { className: detailClassName, children: jsx(Boost, {}) })] })) }));
2968
+ return (jsx("aside", { className: "tw-h-squid-[50px] tw-flex tw-w-[480px] tw-items-center tw-justify-around tw-bg-grey-900 tw-px-squid-m tw-py-squid-xxs tw-text-grey-500", children: state === DetailsToolbarState.ERROR ? (jsx(ErrorMessage, { message: errorMessage })) : (jsxs(Fragment, { children: [jsx("div", { className: detailClassName, children: jsx(FeeButton, {}) }), jsx("div", { className: "tw-flex tw-h-squid-xl tw-w-squid-xxl tw-items-center tw-justify-center", children: state === DetailsToolbarState.LOADING ? (jsx(Loader, { size: "32" })) : (jsx(Button, { variant: "tertiary", size: "md", className: "tw-border-transparent tw-bg-transparent hover:tw-bg-material-light-thin", icon: jsx(ChevronLargeDownIcon, {}) })) }), jsx("div", { className: detailClassName, children: jsx(Boost, { boostMode: "boost" }) })] })) }));
3092
2969
  }
3093
2970
  const ErrorMessage = ({ message }) => {
3094
2971
  return (jsxs("div", { className: "tw-flex tw-h-squid-xl tw-flex-1 tw-items-center tw-gap-squid-xxs tw-text-status-negative", children: [jsx(EmojiSadIcon, {}), jsx(CaptionText, { children: message })] }));
@@ -3097,30 +2974,19 @@ const ErrorMessage = ({ message }) => {
3097
2974
  function Modal({ children }) {
3098
2975
  return (
3099
2976
  // modal container
3100
- jsx("div", { className: "tw-absolute tw-inset-0 tw-flex tw-items-start tw-justify-center tw-bg-material-dark-thick tw-px-squid-xs tw-py-squid-xl tw-pb-squid-m", style: {
3101
- backdropFilter: 'blur(20px)',
3102
- }, children: jsx("div", { className: "tw-relative tw-flex tw-h-[600px] tw-w-[400px] tw-flex-col tw-items-start tw-gap-squid-xxs tw-self-end tw-overflow-hidden", children: children }) }));
2977
+ jsx("div", { className: "tw-backdrop-blur/20 tw-absolute tw-inset-0 tw-flex tw-items-start tw-justify-center tw-bg-material-dark-thick tw-px-squid-xs tw-py-squid-xl tw-pb-squid-m", children: jsx("div", { className: "tw-relative tw-flex tw-h-[600px] tw-w-[400px] tw-flex-col tw-items-start tw-justify-end tw-gap-squid-xxs tw-self-end", children: children }) }));
3103
2978
  }
3104
2979
 
3105
- // font size, line height, and letter spacing classes
3106
- const textClassMap = {
3107
- small: 'tw-text-heading-small tw-tracking-heading-small tw-leading-heading-small',
3108
- medium: 'tw-text-heading-medium tw-tracking-heading-medium tw-leading-heading-medium',
3109
- large: 'tw-text-heading-large tw-tracking-heading-large tw-leading-heading-large',
3110
- };
3111
- function HeadingText({ children, bold, size }) {
3112
- const fontWeightClass = bold
3113
- ? 'tw-font-heading-bold'
3114
- : 'tw-font-heading-regular';
3115
- return (jsx("h6", { className: clsx(textClassMap[size], fontWeightClass), children: children }));
3116
- }
3117
-
3118
- function NavigationBar({ title, displayBackButton = false, logoUrl, }) {
3119
- return (jsxs("nav", { className: cn('tw-flex tw-max-h-[120px] tw-min-w-96 tw-flex-col tw-bg-grey-900 tw-text-grey-300'), children: [jsxs("div", { className: cn('tw-flex tw-h-squid-xxl tw-items-center tw-justify-end tw-gap-x-squid-xs', displayBackButton ? 'tw-px-squid-m' : 'tw-pl-squid-l tw-pr-squid-m'), children: [displayBackButton ? (jsx(Button, { variant: "tertiary", size: "md", icon: jsx(ArrowLeftIcon, {}) })) : null, logoUrl ? (jsx("img", { src: logoUrl, className: "tw-h-squid-xl tw-min-w-squid-xl" })) : null, jsx("span", { className: "tw-flex tw-flex-1 tw-items-center tw-justify-end", children: jsx(AddressButton, { label: "Connect" }) })] }), title ? (jsx("div", { className: "tw-flex tw-h-squid-xxl tw-items-center tw-px-squid-l tw-py-squid-xxs", children: jsx(HeadingText, { size: "small", children: title }) })) : null] }));
2980
+ function NavigationBar({ title, displayBackButton = false, logoUrl, transparent = false, displayButtonShadows = false, }) {
2981
+ return (jsxs("nav", { className: cn('tw-flex tw-max-h-[120px] tw-min-w-96 tw-flex-col tw-text-grey-300', transparent ? 'tw-bg-transparent' : 'tw-bg-grey-900'), children: [jsxs("div", { className: cn('tw-flex tw-h-squid-xxl tw-items-center tw-justify-end tw-gap-x-squid-xs', displayBackButton ? 'tw-px-squid-m' : 'tw-pl-squid-l tw-pr-squid-m'), children: [displayBackButton ? (jsx(Button, { className: displayButtonShadows
2982
+ ? 'group-data-[squid-theme-type=light]:tw-shadow-elevation-light-2 group-data-[squid-theme-type=dark]:tw-shadow-elevation-dark-2'
2983
+ : undefined, variant: "tertiary", size: "md", icon: jsx(ArrowLeftIcon, {}) })) : null, logoUrl ? (jsx("img", { src: logoUrl, className: "tw-h-squid-xl tw-min-w-squid-xl" })) : null, jsx("span", { className: "tw-flex tw-flex-1 tw-items-center tw-justify-end", children: jsx(AddressButton, { className: displayButtonShadows
2984
+ ? 'group-data-[squid-theme-type=light]:tw-shadow-elevation-light-2 group-data-[squid-theme-type=dark]:tw-shadow-elevation-dark-2'
2985
+ : undefined, label: "Connect" }) })] }), title ? (jsx("div", { className: "tw-flex tw-h-squid-xxl tw-items-center tw-px-squid-l tw-py-squid-xxs", children: jsx(HeadingText, { size: "small", children: title }) })) : null] }));
3120
2986
  }
3121
2987
 
3122
2988
  function ProductCard({ children }) {
3123
- return (jsx("div", { className: "tw-h-card tw-min-h-card tw-w-card tw-rounded-squid-xl tw-border-[1px] tw-border-solid tw-border-material-light-thick tw-bg-material-light-thick tw-p-squid-xs tw-backdrop-blur-[calc(1.25rem/2)]", children: jsx("div", { className: "tw-relative tw-flex tw-h-full tw-max-h-[660px] tw-w-full tw-flex-col tw-overflow-hidden tw-rounded-squid-l tw-bg-grey-900 tw-text-grey-300", children: children }) }));
2989
+ return (jsx("div", { className: "tw-backdrop-blur/10 tw-h-card tw-min-h-card tw-w-card tw-rounded-squid-xl tw-border-[1px] tw-border-solid tw-border-material-light-thick tw-bg-material-light-thick tw-p-squid-xs", children: jsx("div", { className: "tw-relative tw-flex tw-h-full tw-max-h-[660px] tw-w-full tw-flex-col tw-overflow-hidden tw-rounded-squid-l tw-bg-grey-900 tw-text-grey-300", children: children }) }));
3124
2990
  }
3125
2991
 
3126
2992
  function MaxIcon() {
@@ -3139,19 +3005,91 @@ function SwapConfiguration({ priceImpactPercentage, amount = 0, swapAmountUsd =
3139
3005
  const priceImpactClass = (priceImpactPercentage !== null && priceImpactPercentage !== void 0 ? priceImpactPercentage : 0) > 5
3140
3006
  ? 'tw-text-status-negative'
3141
3007
  : 'tw-text-grey-300';
3142
- return (jsxs("section", { className: "tw-h-[205px] tw-max-h-[205px] tw-bg-grey-900 tw-px-squid-l tw-pb-squid-m", children: [jsxs("header", { className: "tw-flex tw-items-center tw-gap-1 tw-py-squid-s tw-leading-5 tw-text-grey-300", children: [jsx(BodyText, { className: "tw-text-grey-500", size: "small", children: direction === 'from' ? 'Pay' : 'Receive' }), jsx(BodyText, { className: "tw-text-grey-600", size: "small", children: ":" }), jsx(WalletAddress, { ens: "so-so.eth" })] }), jsx(Dropdown, { chainImageUrl: chain === null || chain === void 0 ? void 0 : chain.iconUrl, tokenImageUrl: token === null || token === void 0 ? void 0 : token.iconUrl, tokenSymbol: token === null || token === void 0 ? void 0 : token.symbol }), jsx("input", { className: "tw-h-[75px] tw-w-full tw-bg-transparent tw-py-squid-m tw-text-heading-small tw-font-heading-regular tw-text-royal-400 placeholder:tw-text-grey-600 focus:tw-outline-none", placeholder: "0", value: amount }), !(token === null || token === void 0 ? void 0 : token.iconUrl) || isFetching ? null : (jsxs("footer", { className: "tw-flex tw-h-squid-m tw-max-h-squid-m tw-items-center tw-justify-between tw-gap-2 tw-text-grey-500", children: [jsxs("div", { className: "tw-flex tw-items-center tw-gap-1.5", children: [jsx(SwapInputsIcon, {}), jsx(UsdAmount, { usdAmount: swapAmountUsd }), priceImpactPercentage ? (jsxs("span", { className: clsx('tw-flex tw-items-center', priceImpactClass), children: [jsx(ArrowTriangle, {}), jsx(CaptionText, { bold: true, children: priceImpactPercentage.toString().concat('%') })] })) : null] }), jsxs("div", { className: "tw-flex tw-items-center tw-gap-1.5", children: [jsx(CaptionText, { className: "tw-opacity-66", children: "Balance" }), jsx(CaptionText, { children: balance }), jsx(MaxIcon, {})] })] }))] }));
3008
+ return (jsxs("section", { className: "tw-h-[205px] tw-max-h-[205px] tw-bg-grey-900 tw-pb-squid-m", children: [jsx("header", { className: "tw-flex tw-items-center tw-gap-1 tw-px-squid-l tw-py-squid-xs tw-leading-5 tw-text-grey-300", children: jsxs("div", { className: "-tw-ml-squid-xs tw-flex tw-h-squid-l tw-items-center tw-gap-squid-xxs tw-rounded-squid-s tw-px-squid-xs hover:tw-bg-material-light-thin", children: [jsx(BodyText, { className: "tw-text-grey-500", size: "small", children: direction === 'from' ? 'Pay' : 'Receive' }), jsx(BodyText, { className: "tw-text-grey-600", size: "small", children: ":" }), jsx(WalletAddress, { ens: "so-so.eth" })] }) }), jsx("div", { className: "tw-px-squid-l", children: jsx(AssetsButton, { chainImageUrl: chain === null || chain === void 0 ? void 0 : chain.iconUrl, tokenImageUrl: token === null || token === void 0 ? void 0 : token.iconUrl, tokenSymbol: token === null || token === void 0 ? void 0 : token.symbol, chainBgColor: chain === null || chain === void 0 ? void 0 : chain.bgColor, tokenBgColor: token === null || token === void 0 ? void 0 : token.bgColor, tokenTextColor: token === null || token === void 0 ? void 0 : token.textColor }) }), jsx("div", { className: "tw-px-squid-m", children: jsx("input", { className: "tw-my-squid-xs tw-h-[55px] tw-w-full tw-rounded-squid-s tw-bg-transparent tw-px-squid-xs tw-py-squid-s tw-text-heading-small tw-font-heading-regular tw-text-royal-400 placeholder:tw-text-grey-600 hover:tw-bg-material-light-thin focus:tw-bg-material-light-thin focus:tw-outline-none", placeholder: "0", value: amount }) }), !(token === null || token === void 0 ? void 0 : token.iconUrl) || isFetching ? null : (jsxs("footer", { className: "tw-flex tw-h-squid-m tw-max-h-squid-m tw-items-center tw-justify-between tw-gap-2 tw-px-squid-m tw-text-grey-500", children: [jsxs("div", { className: "tw-flex tw-h-squid-l tw-items-center tw-gap-1.5 tw-rounded-squid-s tw-px-squid-xs hover:tw-bg-material-light-thin", children: [jsx(SwapInputsIcon, {}), jsx(UsdAmount, { usdAmount: swapAmountUsd }), priceImpactPercentage ? (jsxs("span", { className: clsx('tw-flex tw-items-center', priceImpactClass), children: [jsx(ArrowTriangle, {}), jsx(CaptionText, { bold: true, children: priceImpactPercentage.toString().concat('%') })] })) : null] }), jsxs("div", { className: "tw-flex tw-h-squid-l tw-items-center tw-gap-1.5 tw-rounded-squid-s tw-px-squid-xs hover:tw-bg-material-light-thin", children: [jsx(CaptionText, { className: "tw-opacity-66", children: "Balance" }), jsx(CaptionText, { children: balance }), jsx(MaxIcon, {})] })] }))] }));
3143
3009
  }
3144
3010
 
3145
- function DropdownMenuItem({ label, imageUrl, icon, }) {
3146
- return (jsx("li", { className: "tw-max-h-squid-xl tw-w-full tw-px-squid-xxs", children: jsxs("div", { className: "tw-flex tw-h-squid-l tw-items-center tw-gap-squid-xxs tw-rounded-squid-xs tw-pl-squid-xxs", children: [jsx("div", { className: "tw-flex tw-h-squid-m tw-w-squid-m tw-items-center tw-justify-between tw-rounded-squid-xs", children: imageUrl ? (jsx("img", { src: imageUrl, className: "tw-h-full tw-w-full tw-rounded-squid-xxs" })) : (icon) }), jsx(CaptionText, { children: label })] }) }));
3011
+ function SwapProgressViewHeader({ title, description, }) {
3012
+ return (jsxs("header", { className: "tw-flex tw-h-[95px] tw-w-full tw-flex-col tw-gap-squid-s tw-bg-grey-800 tw-px-squid-m tw-py-squid-s", children: [jsx(BodyText, { size: "large", className: "tw-h-squid-m !tw-leading-[20px] tw-text-grey-300", children: title }), jsx(CaptionText, { className: "tw-h-squid-l tw-text-grey-500", children: description })] }));
3147
3013
  }
3148
3014
 
3149
- function DotGrid1x3HorizontalIcon() {
3150
- return (jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", children: jsx("path", { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M1.33325 8.00008C1.33325 7.2637 1.93021 6.66675 2.66659 6.66675C3.40297 6.66675 3.99992 7.2637 3.99992 8.00008C3.99992 8.73646 3.40297 9.33341 2.66659 9.33341C1.93021 9.33341 1.33325 8.73646 1.33325 8.00008ZM6.66659 8.00008C6.66659 7.2637 7.26354 6.66675 7.99992 6.66675C8.7363 6.66675 9.33325 7.2637 9.33325 8.00008C9.33325 8.73646 8.7363 9.33341 7.99992 9.33341C7.26354 9.33341 6.66659 8.73646 6.66659 8.00008ZM11.9999 8.00008C11.9999 7.2637 12.5969 6.66675 13.3333 6.66675C14.0696 6.66675 14.6666 7.2637 14.6666 8.00008C14.6666 8.73646 14.0696 9.33341 13.3333 9.33341C12.5969 9.33341 11.9999 8.73646 11.9999 8.00008Z", fill: "currentColor" }) }));
3015
+ function SwapStepSeparator() {
3016
+ return (jsx("span", { className: "tw-flex tw-h-squid-m tw-w-squid-xxl tw-items-center tw-justify-center tw-self-stretch tw-py-0.5", children: jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: "4", height: "21", viewBox: "0 0 4 21", fill: "none", children: jsx("path", { d: "M2 2.5V18.5", stroke: "currentColor", "stroke-width": "4", "stroke-linecap": "round" }) }) }));
3017
+ }
3018
+
3019
+ function DropdownMenuItem({ label, imageUrl, icon, labelClassName, }) {
3020
+ return (jsx("li", { className: "tw-max-h-squid-xl tw-w-full tw-px-squid-xxs", children: jsxs("div", { className: "tw-flex tw-h-squid-l tw-items-center tw-gap-squid-xxs tw-rounded-squid-xs tw-pl-squid-xxs hover:tw-bg-material-light-thin", children: [jsx("div", { className: "tw-flex tw-h-squid-m tw-w-squid-m tw-items-center tw-justify-between tw-rounded-squid-xs", children: imageUrl ? (jsx("img", { src: imageUrl, className: "tw-h-full tw-w-full tw-rounded-squid-xxs" })) : (icon) }), jsx(CaptionText, { className: labelClassName, children: label })] }) }));
3021
+ }
3022
+
3023
+ function useModal(props) {
3024
+ const [isModalOpen, setIsModalOpen] = useState(Boolean(props === null || props === void 0 ? void 0 : props.initialIsModalOpen));
3025
+ const modalRef = useRef(null);
3026
+ const openModalButtonRef = useRef(null);
3027
+ useEffect(() => {
3028
+ const handleClickOutside = (event) => {
3029
+ var _a;
3030
+ // close modal if the user clicked outside of it
3031
+ if (modalRef.current &&
3032
+ !modalRef.current.contains(event.target) &&
3033
+ !((_a = openModalButtonRef.current) === null || _a === void 0 ? void 0 : _a.contains(event.target))) {
3034
+ setIsModalOpen(false);
3035
+ }
3036
+ };
3037
+ document.addEventListener('click', handleClickOutside);
3038
+ return () => {
3039
+ document.removeEventListener('click', handleClickOutside);
3040
+ };
3041
+ }, [modalRef]);
3042
+ const openModal = useCallback(() => {
3043
+ setIsModalOpen((prev) => !prev);
3044
+ }, []);
3045
+ const closeModal = useCallback(() => {
3046
+ setIsModalOpen(false);
3047
+ }, []);
3048
+ return {
3049
+ isModalOpen,
3050
+ openModal,
3051
+ closeModal,
3052
+ modalRef,
3053
+ openModalButtonRef,
3054
+ };
3055
+ }
3056
+
3057
+ function CompassRound({ size = '20', className, }) {
3058
+ return (jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", width: size, height: size, viewBox: "0 0 20 20", fill: "none", className: className, children: [jsx("path", { d: "M17.7087 9.99996C17.7087 14.2572 14.2575 17.7083 10.0003 17.7083C5.74313 17.7083 2.29199 14.2572 2.29199 9.99996C2.29199 5.74276 5.74313 2.29163 10.0003 2.29163C14.2575 2.29163 17.7087 5.74276 17.7087 9.99996Z", stroke: "currentColor", "stroke-width": "1.5", "stroke-linejoin": "round" }), jsx("path", { d: "M12.2135 7.27515L8.79307 8.208C8.5084 8.28564 8.286 8.50803 8.20837 8.7927L7.27552 12.2132C7.19069 12.5242 7.47609 12.8096 7.78713 12.7248L11.2076 11.7919C11.4923 11.7143 11.7146 11.4919 11.7923 11.2072L12.7251 7.78677C12.81 7.47573 12.5246 7.19032 12.2135 7.27515Z", stroke: "currentColor", "stroke-width": "1.5", "stroke-linejoin": "round" })] }));
3059
+ }
3060
+ function CircleX({ size = '20', className, }) {
3061
+ return (jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: size, height: size, viewBox: "0 0 20 20", fill: "none", className: className, children: jsx("path", { d: "M12.5003 7.49996L7.50033 12.5M12.5003 12.5L7.50033 7.49996M17.7087 9.99996C17.7087 14.2572 14.2575 17.7083 10.0003 17.7083C5.74313 17.7083 2.29199 14.2572 2.29199 9.99996C2.29199 5.74276 5.74313 2.29163 10.0003 2.29163C14.2575 2.29163 17.7087 5.74276 17.7087 9.99996Z", stroke: "currentColor", "stroke-width": "1.5", "stroke-linecap": "round" }) }));
3062
+ }
3063
+
3064
+ function DotGrid1x3HorizontalIcon({ className, size = '16', }) {
3065
+ return (jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: size, height: size, viewBox: "0 0 16 16", fill: "none", className: className, children: jsx("path", { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M1.33325 8.00008C1.33325 7.2637 1.93021 6.66675 2.66659 6.66675C3.40297 6.66675 3.99992 7.2637 3.99992 8.00008C3.99992 8.73646 3.40297 9.33341 2.66659 9.33341C1.93021 9.33341 1.33325 8.73646 1.33325 8.00008ZM6.66659 8.00008C6.66659 7.2637 7.26354 6.66675 7.99992 6.66675C8.7363 6.66675 9.33325 7.2637 9.33325 8.00008C9.33325 8.73646 8.7363 9.33341 7.99992 9.33341C7.26354 9.33341 6.66659 8.73646 6.66659 8.00008ZM11.9999 8.00008C11.9999 7.2637 12.5969 6.66675 13.3333 6.66675C14.0696 6.66675 14.6666 7.2637 14.6666 8.00008C14.6666 8.73646 14.0696 9.33341 13.3333 9.33341C12.5969 9.33341 11.9999 8.73646 11.9999 8.00008Z", fill: "currentColor" }) }));
3066
+ }
3067
+
3068
+ function RefreshIcon() {
3069
+ return (jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", children: [jsx("path", { d: "M10.8333 17.4999C11.2936 17.4999 11.6667 17.1269 11.6667 16.6666C11.6667 16.2064 11.2936 15.8333 10.8333 15.8333C10.3731 15.8333 10 16.2064 10 16.6666C10 17.1269 10.3731 17.4999 10.8333 17.4999Z", fill: "currentColor" }), jsx("path", { d: "M17.5 9.16661C17.5 8.70638 17.1269 8.33328 16.6667 8.33328C16.2064 8.33328 15.8333 8.70638 15.8333 9.16661C15.8333 9.62685 16.2064 9.99995 16.6667 9.99995C17.1269 9.99995 17.5 9.62685 17.5 9.16661Z", fill: "currentColor" }), jsx("path", { d: "M16.6079 11.8899C17.0065 12.12 17.143 12.6297 16.9129 13.0283C16.6828 13.4268 16.1731 13.5634 15.7746 13.3333C15.376 13.1032 15.2394 12.5935 15.4695 12.1949C15.6997 11.7964 16.2093 11.6598 16.6079 11.8899Z", fill: "currentColor" }), jsx("path", { d: "M14.473 16.0785C14.8716 15.8483 15.0081 15.3387 14.778 14.9401C14.5479 14.5415 14.0382 14.405 13.6397 14.6351C13.2411 14.8652 13.1045 15.3749 13.3347 15.7734C13.5648 16.172 14.0744 16.3086 14.473 16.0785Z", fill: "currentColor" }), jsx("path", { d: "M15.7725 6.66661C15.3739 6.89673 14.8642 6.76017 14.6341 6.36159C14.404 5.96301 14.5405 5.45335 14.9391 5.22323C15.3377 4.99312 15.8474 5.12968 16.0775 5.52826C16.3076 5.92683 16.171 6.43649 15.7725 6.66661Z", fill: "currentColor" }), jsx("path", { d: "M7.70833 12.2917V16.875H3.125M7.5 16.4063C4.93915 15.4062 3.125 12.915 3.125 10C3.125 6.20304 6.20304 3.125 10 3.125C10.9614 3.125 11.8768 3.32235 12.7077 3.67876", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" })] }));
3070
+ }
3071
+
3072
+ function DropdownMenu({ dropdownRef, items, className, }) {
3073
+ return (jsx("div", { ref: dropdownRef, children: jsx(Menu, { rounded: "sm", containerClassName: cn('tw-absolute tw-right-0 tw-z-20', className), contentClassName: "!tw-p-0", children: jsx("ul", { className: "custom-scrollbar tw-flex tw-w-[144px] tw-flex-col tw-gap-squid-xxs tw-overflow-auto tw-px-0 tw-py-squid-xxs", children: items.map((item) => (jsx(DropdownMenuItem, Object.assign({}, item)))) }) }) }));
3151
3074
  }
3152
3075
 
3153
3076
  function HistoryItem({ firstImageUrl, secondImageUrl, isPending, dateCompleted, fromAmount, fromLabel, toAmount, toLabel, pendingLabel = 'Pending', }) {
3154
- return (jsxs("li", { className: "tw-flex tw-h-list-item-large tw-w-list-item-small tw-items-center tw-gap-squid-xs tw-bg-grey-900 tw-px-squid-m tw-py-squid-xxs tw-text-grey-300", children: [jsxs("div", { className: "tw-relative tw-h-10 tw-w-[60px]", children: [isPending ? (jsx("span", { className: "tw-absolute -tw-left-[5px] tw-bottom-0 tw-z-30 tw-flex tw-h-squid-m tw-w-squid-m tw-items-center tw-justify-center tw-rounded-full tw-border tw-border-grey-900 tw-bg-royal-400 tw-p-0.5", children: jsx(DotGrid1x3HorizontalIcon, {}) })) : null, jsx("img", { src: firstImageUrl, className: "tw-absolute tw-z-20 tw-h-10 tw-w-10 tw-rounded-full tw-border tw-border-grey-900" }), jsx("img", { src: secondImageUrl, className: "tw-absolute tw-left-5 tw-z-10 tw-h-10 tw-w-10 tw-rounded-full tw-border tw-border-grey-900" })] }), jsxs("div", { className: "tw-flex tw-h-10 tw-w-[230px] tw-flex-col", children: [jsxs("div", { className: "tw-flex tw-h-5 tw-items-center tw-justify-between tw-text-grey-500", children: [jsxs("div", { className: "tw-flex tw-items-center", children: [jsx(CaptionText, { children: fromLabel }), jsx("span", { className: "tw-text-grey-600", children: jsx(ChevronRightSmallIcon, {}) }), jsx(CaptionText, { children: toLabel })] }), isPending ? (jsx(CaptionText, { className: "tw-text-royal-400", children: pendingLabel })) : (jsx(CaptionText, { children: dateCompleted }))] }), jsxs("div", { className: "tw-flex tw-h-5 tw-items-center tw-gap-squid-xxs tw-text-grey-300", children: [jsx(BodyText, { size: "small", children: fromAmount }), jsx("span", { className: "tw-text-grey-600", children: jsx(ChevronLargeRightIcon, {}) }), jsx(BodyText, { size: "small", children: toAmount })] })] })] }));
3077
+ const { isModalOpen, modalRef, openModalButtonRef, openModal } = useModal();
3078
+ return (jsx("li", { className: "tw-h-list-item-large tw-min-w-list-item-small tw-self-stretch tw-bg-grey-900 tw-px-squid-xs tw-text-grey-300", children: jsxs("div", { className: "tw-group/history-item tw-relative tw-flex tw-flex-shrink-0 tw-items-center tw-gap-squid-xs tw-self-stretch tw-rounded-squid-s tw-px-squid-xs tw-py-squid-xxs hover:tw-bg-material-light-thin", children: [jsxs("div", { className: "tw-relative tw-h-10 tw-w-[60px]", children: [isPending ? (jsx("span", { className: "tw-absolute -tw-left-[5px] tw-bottom-0 tw-z-30 tw-flex tw-h-squid-m tw-w-squid-m tw-items-center tw-justify-center tw-rounded-full tw-border tw-border-grey-900 tw-bg-royal-400 tw-p-0.5", children: jsx(DotGrid1x3HorizontalIcon, {}) })) : null, jsx("img", { src: firstImageUrl, className: "tw-absolute tw-h-10 tw-w-10 tw-rounded-full tw-border tw-border-grey-900" }), jsx("img", { src: secondImageUrl, className: "tw-absolute tw-left-5 tw-h-10 tw-w-10 tw-rounded-full tw-border tw-border-grey-900" })] }), jsxs("div", { className: "tw-flex tw-h-10 tw-flex-1 tw-flex-col tw-self-stretch", children: [jsxs("div", { className: "tw-flex tw-h-5 tw-items-center tw-justify-between tw-text-grey-500", children: [jsxs("div", { className: "tw-flex tw-items-center", children: [jsx(CaptionText, { children: fromLabel }), jsx("span", { className: "tw-text-grey-600", children: jsx(ChevronRightSmallIcon, {}) }), jsx(CaptionText, { children: toLabel })] }), jsx("div", { className: "tw-transition-opacity group-hover/history-item:tw-opacity-0", children: isPending ? (jsx(CaptionText, { className: "tw-text-royal-400", children: pendingLabel })) : (jsx(CaptionText, { children: dateCompleted })) }), jsx("button", { className: "tw-absolute tw-right-squid-xxs tw-top-squid-xxs tw-flex tw-h-squid-xl tw-w-squid-xl tw-items-center tw-justify-center tw-rounded-squid-xs tw-bg-material-light-thin tw-p-2 tw-text-grey-300 tw-opacity-0 tw-transition-opacity group-hover/history-item:tw-opacity-100", onClick: openModal, ref: openModalButtonRef, children: jsx(DotGrid1x3HorizontalIcon, { size: "24" }) })] }), jsxs("div", { className: "tw-flex tw-h-5 tw-items-center tw-gap-squid-xxs tw-text-grey-300", children: [jsx(BodyText, { size: "small", children: fromAmount }), jsx("span", { className: "tw-text-grey-600", children: jsx(ChevronLargeRightIcon, {}) }), jsx(BodyText, { size: "small", children: toAmount })] })] }), isModalOpen ? (jsx(DropdownMenu, { dropdownRef: modalRef, items: [
3079
+ {
3080
+ label: 'Repeat swap',
3081
+ icon: jsx(RefreshIcon, {}),
3082
+ },
3083
+ {
3084
+ label: 'View on xyz',
3085
+ icon: jsx(CompassRound, {}),
3086
+ },
3087
+ {
3088
+ label: 'Clear',
3089
+ labelClassName: 'tw-text-status-negative',
3090
+ icon: jsx(CircleX, { className: "tw-text-status-negative" }),
3091
+ },
3092
+ ] })) : null] }) }));
3155
3093
  }
3156
3094
 
3157
3095
  const listItemSizeMap = {
@@ -3172,11 +3110,129 @@ function SectionTitle({ title, icon, accessory, actionIcon, className, }) {
3172
3110
  return (jsxs("header", { className: cn('tw-flex tw-h-[46px] tw-w-full tw-items-center tw-gap-squid-xxs tw-bg-grey-900 tw-px-squid-m tw-pb-squid-xs tw-pt-squid-m tw-text-royal-400', className), children: [icon, jsx(CaptionText, { children: title }), accessory ? (jsx(CaptionText, { className: "tw-flex-1 tw-text-right tw-text-grey-500", children: accessory })) : actionIcon ? (jsx("span", { className: "tw-flex tw-flex-1 tw-items-center tw-justify-end", children: actionIcon })) : null] }));
3173
3111
  }
3174
3112
 
3175
- const squidConfigContext = createContext(undefined);
3176
- function SquidConfigProvider({ theme, children, }) {
3177
- const Provider = squidConfigContext.Provider;
3113
+ function HelpIcon({ size = '20', className, }) {
3114
+ return (jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", width: size, height: size, viewBox: "0 0 20 20", fill: "none", className: className, children: [jsx("g", { "clip-path": "url(#clip0_457_36778)", children: jsx("path", { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M20 10C20 15.5228 15.5228 20 10 20C4.47715 20 0 15.5228 0 10C0 4.47715 4.47715 0 10 0C15.5228 0 20 4.47715 20 10ZM6 7C6 4.46214 8.03736 3 10 3C12.1193 3 14 4.66531 14 7C14 7.93746 13.7596 8.6603 13.368 9.2586C13.0353 9.76679 12.6034 10.1601 12.2697 10.4639L12.1757 10.5497C11.8041 10.8904 11.534 11.1593 11.337 11.504C11.1513 11.8288 11 12.2794 11 13C11 13.5523 10.5523 14 10 14C9.44772 14 9 13.5523 9 13C9 11.9706 9.22366 11.1712 9.60051 10.5117C9.96604 9.87199 10.4459 9.42214 10.8243 9.07535L10.8834 9.02116L10.8834 9.02116L10.8834 9.02115C11.2572 8.67885 11.5066 8.45039 11.6945 8.16328C11.8654 7.9022 12 7.56254 12 7C12 5.83469 11.0807 5 10 5C8.96264 5 8 5.73786 8 7C8 7.55228 7.55228 8 7 8C6.44772 8 6 7.55228 6 7ZM10 15C9.44771 15 9 15.4477 9 16C9 16.5523 9.44771 17 10 17C10.5523 17 11 16.5523 11 16C11 15.4477 10.5523 15 10 15Z", fill: "currentColor" }) }), jsx("defs", { children: jsx("clipPath", { id: "clip0_457_36778", children: jsx("rect", { width: "20", height: "20", fill: "white" }) }) })] }));
3115
+ }
3116
+
3117
+ function SettingsItem({ icon, label, controls, transparentControls = false, showHelpIcon = true, }) {
3118
+ return (jsxs("li", { className: "tw-flex tw-h-[50px] tw-scroll-px-5 tw-items-center tw-justify-center tw-gap-squid-xs tw-self-stretch tw-bg-grey-900 tw-px-5 tw-py-squid-xs tw-text-grey-300", children: [icon, jsxs("div", { className: "tw-flex tw-flex-1 tw-items-center tw-gap-squid-xxs tw-self-stretch", children: [jsx(BodyText, { size: "small", children: label }), showHelpIcon ? jsx(HelpIcon, { className: "tw-text-grey-600" }) : null] }), jsx("div", { className: cn('tw-flex tw-h-squid-l tw-items-center tw-justify-center tw-rounded-squid-xs', transparentControls ? '' : 'tw-bg-grey-800'), children: controls })] }));
3119
+ }
3120
+
3121
+ function SwapDetailListItem({ label, detail, icon, }) {
3122
+ return (jsx("li", { className: "tw-swap-detail-list-item-gradient tw-h-squid-l tw-w-full tw-bg-grey-800 tw-px-squid-xs tw-text-grey-300", children: jsxs("div", { className: "tw-flex tw-h-squid-l tw-items-center tw-justify-between tw-gap-squid-xs tw-rounded-squid-xs tw-px-squid-xs", children: [jsx("div", { className: "tw-h-6 tw-w-6 tw-text-grey-500", children: icon }), jsx(CaptionText, { className: "tw-flex-1 tw-text-grey-500", children: label }), typeof detail === 'string' ? (jsx(CaptionText, { children: detail })) : (detail)] }) }));
3123
+ }
3124
+
3125
+ function SwapStepItem({ descriptionBlocks, chipContent, showStepSeparator = false, }) {
3126
+ return (jsxs("li", { className: "tw-flex tw-w-list-item-large tw-flex-col tw-items-start tw-bg-grey-800 tw-text-grey-300", children: [showStepSeparator && jsx(SwapStepSeparator, {}), jsxs("div", { className: "tw-flex tw-w-full tw-items-center tw-text-royal-400", children: [jsx("span", { className: "tw-relative tw-flex tw-min-h-squid-l tw-items-center tw-justify-center tw-gap-squid-xxs tw-px-squid-xs", children: jsx(Chip, { className: "tw-w-squid-xl tw-bg-royal-400 tw-text-grey-900", icon: typeof chipContent === 'string' ? (jsx(CaptionText, { children: chipContent })) : (chipContent) }) }), jsx("div", { className: "tw-flex tw-min-h-squid-l tw-flex-1 tw-flex-wrap tw-items-center tw-justify-start tw-gap-squid-xxs tw-py-squid-xxs", children: descriptionBlocks.map(({ type, value }, index) => {
3127
+ if (type === 'string') {
3128
+ return (
3129
+ // Instead of displaying the string into a single <BodyText />
3130
+ // we split it into multiple <BodyText />
3131
+ // for edge case where the string is too long to fit in one line
3132
+ value
3133
+ .trim()
3134
+ .split(' ')
3135
+ .map((word, i) => (jsx(BodyText, { size: "small", className: "tw-leading-[20px]", children: word }, i))));
3136
+ }
3137
+ else if (type === 'image') {
3138
+ return (jsx("img", { src: value, className: "tw-h-squid-m tw-w-squid-m tw-rounded-full" }, index));
3139
+ }
3140
+ return null;
3141
+ }) })] })] }));
3142
+ }
3143
+
3144
+ function SwapStepsCollapsed({ steps, currentStepCount: _currentStepCount, }) {
3145
+ // handles if route component is mounted
3146
+ const [isRouteVisible, setIsRouteVisible] = useState(false);
3147
+ const currentStepCount = Math.round(_currentStepCount);
3148
+ // handles if route component is animating to show
3149
+ const [isShowRouteAnimationRunning, setIsShowRouteAnimationRunning] = useState(false);
3150
+ const currentStep = steps[currentStepCount - 1];
3151
+ const isLastStep = currentStepCount === steps.length;
3152
+ const isFirstStep = currentStepCount === 1;
3153
+ useEffect(() => {
3154
+ // we do not want to unmount the route component if the animation to show route is running
3155
+ if (isShowRouteAnimationRunning)
3156
+ return;
3157
+ // unmount route component when the animation of hiding is done
3158
+ const timeoutId = setTimeout(() => {
3159
+ setIsRouteVisible(false);
3160
+ }, 350);
3161
+ return () => {
3162
+ clearTimeout(timeoutId);
3163
+ };
3164
+ }, [isShowRouteAnimationRunning]);
3165
+ return (jsxs(Fragment, { children: [jsx(Tooltip, { tooltipContent: "View route", tooltipWidth: "max", containerClassName: "tw-w-full tw-rounded-full", childrenClassName: "tw-w-full tw-rounded-full", children: jsxs("button", { onClick: () => {
3166
+ // mount route component and start animation
3167
+ setIsRouteVisible(true);
3168
+ setIsShowRouteAnimationRunning(true);
3169
+ }, className: "tw-relative tw-flex tw-min-h-button tw-w-full tw-items-center tw-overflow-hidden tw-rounded-squid-xxl tw-border tw-border-material-light-thin tw-bg-grey-800 tw-px-squid-xs tw-text-grey-300", children: [!isLastStep && (jsxs("span", { className: "tw-absolute -tw-top-1.5", children: [jsx("span", { className: "tw-absolute tw-top-1 tw-h-full tw-w-full -tw-translate-x-1/2 tw-bg-gradient-to-b tw-from-grey-800 tw-to-transparent" }), jsx(SwapStepSeparator, {})] })), jsx(SwapStepItem, { descriptionBlocks: currentStep.descriptionBlocks, chipContent: currentStep.chipContent }), !isFirstStep && (jsxs("span", { className: "tw-absolute -tw-bottom-1.5", children: [jsx("span", { className: "tw-absolute tw-bottom-1 tw-h-full tw-w-full -tw-translate-x-1/2 tw-bg-gradient-to-b tw-from-transparent tw-to-grey-800" }), jsx(SwapStepSeparator, {})] }))] }) }), isRouteVisible && (jsxs("div", { className: cn('tw-absolute tw-top-0 tw-z-20 tw-flex tw-h-[536px] tw-w-full tw-flex-col tw-gap-squid-xxs tw-overflow-hidden tw-rounded-squid-l tw-border tw-border-material-light-thin tw-bg-grey-800', isShowRouteAnimationRunning
3170
+ ? 'tw-animate-slide-to-top'
3171
+ : 'tw-animate-slide-to-bottom'), children: [jsx("div", { className: "tw-flex tw-h-[52px] tw-items-center tw-justify-center tw-gap-squid-xs tw-self-stretch tw-p-squid-xs", children: jsx("button", { onClick: () => setIsShowRouteAnimationRunning(false), className: "tw-flex tw-h-squid-xl tw-w-40 tw-items-center tw-justify-center tw-rounded-squid-xs tw-px-10 hover:tw-bg-material-light-thin", children: jsx("span", { className: "tw-flex tw-h-8 tw-w-8 tw-items-center tw-justify-center tw-text-grey-300", children: jsx(ChevronLargeDownIcon, { size: "32" }) }) }) }), jsx("ul", { className: "custom-scrollbar tw-flex tw-w-[400px] tw-flex-1 tw-flex-col-reverse tw-items-center tw-self-stretch tw-overflow-y-auto tw-overflow-x-hidden tw-px-squid-xs", children: steps.map((step, index) => (jsx(SwapStepItem, { descriptionBlocks: step.descriptionBlocks, chipContent: step.chipContent, showStepSeparator: !(index === steps.length - 1) }, index))) }), jsx("footer", { className: "tw-flex tw-items-end tw-justify-center tw-gap-squid-xs tw-self-stretch tw-p-squid-s", children: jsx(Button, { size: "md", variant: "secondary", label: "View on Squidscan", className: "tw-w-full" }) })] }))] }));
3172
+ }
3173
+
3174
+ function TokenPair({ firstToken, secondToken }) {
3175
+ return (jsxs("div", { className: "tw-relative tw-h-[42px] tw-w-[94px]", children: [jsxs("svg", { width: "94", height: "42", viewBox: "0 0 94 42", fill: "none", xmlns: "http://www.w3.org/2000/svg", className: "tw-absolute tw-z-10 tw-text-material-light-average", children: [jsx("g", { filter: "url(#filter0_b_457_51391)", children: jsx("path", { d: "M58.5042 35.4956L58.5043 35.4957C62.5071 39.4985 67.7544 41.5 73.0001 41.5C84.3219 41.5 93.5 32.3218 93.5 21C93.5 9.67822 84.3219 0.5 73.0001 0.5C67.7544 0.499977 62.5071 2.50151 58.5043 6.50431C57.9743 7.03437 57.4538 7.57007 56.9412 8.09756L56.9403 8.09852C55.2889 9.79812 53.7279 11.4027 52.097 12.5879C50.4734 13.7678 48.8225 14.5 47 14.5C45.1775 14.5 43.5266 13.7678 41.903 12.5879C40.2721 11.4027 38.7111 9.79812 37.0597 8.09852L37.0589 8.09766C36.5463 7.57013 36.0258 7.03441 35.4957 6.50431C31.4929 2.50151 26.2456 0.499977 20.9999 0.5C15.7543 0.500023 10.5071 2.50156 6.50431 6.50431C2.50153 10.5071 0.5 15.7544 0.5 21C0.5 26.2456 2.50153 31.4929 6.50431 35.4957C10.5071 39.4984 15.7543 41.5 20.9999 41.5C26.2456 41.5 31.4929 39.4985 35.4957 35.4957L35.4958 35.4956C36.023 34.968 36.5408 34.4349 37.0508 33.9099L37.0521 33.9086C38.7042 32.2077 40.2665 30.6013 41.8988 29.4147C43.5238 28.2333 45.1763 27.5 47 27.5C48.8237 27.5 50.4762 28.2333 52.1012 29.4147C53.7335 30.6013 55.2958 32.2077 56.9479 33.9086L56.9492 33.9099C57.4592 34.4349 57.977 34.968 58.5042 35.4956Z", stroke: "currentColor" }) }), jsx("defs", { children: jsxs("filter", { id: "filter0_b_457_51391", x: "-20", y: "-20", width: "134", height: "82", filterUnits: "userSpaceOnUse", "color-interpolation-filters": "sRGB", children: [jsx("feFlood", { "flood-opacity": "0", result: "BackgroundImageFix" }), jsx("feGaussianBlur", { in: "BackgroundImageFix", stdDeviation: "10" }), jsx("feComposite", { in2: "SourceAlpha", operator: "in", result: "effect1_backgroundBlur_457_51391" }), jsx("feBlend", { mode: "normal", in: "SourceGraphic", in2: "effect1_backgroundBlur_457_51391", result: "shape" })] }) })] }), jsxs("div", { className: "tw-token-pair-mask tw-z-10 tw-flex tw-h-full tw-w-full tw-items-center tw-justify-between", style: {
3176
+ background: `linear-gradient(to right, ${firstToken.bgColor} 43.48%, ${secondToken.bgColor} 56.52%)`,
3177
+ }, children: [jsx("img", { className: "tw-ml-[1px] tw-aspect-square tw-w-10", src: firstToken.imageUrl }), jsx("img", { className: "tw-mr-[1px] tw-aspect-square tw-w-10", src: secondToken.imageUrl })] })] }));
3178
+ }
3179
+
3180
+ /**
3181
+ * Parsing the user readable config to css variables with HSL values
3182
+ * @param style
3183
+ */
3184
+ const getParsedStyle = (style) => {
3185
+ if (style) {
3186
+ const styleKeys = Object.keys(themeTypesKeys);
3187
+ const parsed = styleKeys.map((sk) => {
3188
+ const themeItem = themeTypesKeys[sk];
3189
+ let userValue = style[sk];
3190
+ return {
3191
+ [themeItem.cssVariable]: userValue,
3192
+ };
3193
+ });
3194
+ // adds a variant with 0.05 opacity for each color
3195
+ // will result in variables like this:
3196
+ // var(--squid-theme-grey-100-005) --> grey-100 with 0.05 opacity
3197
+ // styleKeys.forEach((sk) => {
3198
+ // const themeItem = themeTypesKeys[sk]
3199
+ // const valueWith005Opacity = getHexColorFromOpacityPercentage(
3200
+ // style[sk], // i.e "#ffffff"
3201
+ // 0.05,
3202
+ // )
3203
+ // // { "--squid-theme-grey-100-005": "#ffffff80" }
3204
+ // parsed.push({
3205
+ // [`${themeItem.cssVariable}-005`]: valueWith005Opacity,
3206
+ // })
3207
+ // })
3208
+ parsed.push({
3209
+ [`${themeTypesKeys['grey-100'].cssVariable}-005`]: getHexColorFromOpacityPercentage(style['grey-100'], 0.05),
3210
+ });
3211
+ return parsed.reduce((a, v) => {
3212
+ const key = Object.keys(v)[0];
3213
+ return Object.assign(Object.assign({}, a), { [key]: v[key] });
3214
+ });
3215
+ }
3216
+ };
3217
+ /**
3218
+ * Returns a hexadecimal color with opacity based on the given color and opacity percentage.
3219
+ *
3220
+ * @example getHexColorFromOpacityPercentage('#FF0000', 0.5) // '#FF000080'
3221
+ *
3222
+ * @param {string} color - The base color in hexadecimal format.
3223
+ * @param {number} opacity - The opacity percentage (0-1).
3224
+ * @returns {string} The hexadecimal color with opacity.
3225
+ */
3226
+ function getHexColorFromOpacityPercentage(color, opacity) {
3227
+ return (color +
3228
+ Math.round(opacity * 255)
3229
+ .toString(16)
3230
+ .padStart(2, '0')).toUpperCase();
3231
+ }
3232
+
3233
+ function SquidConfigProvider({ theme, children, themeType = 'light', }) {
3178
3234
  const parsedStyle = getParsedStyle(theme);
3179
- return (jsx(Provider, { value: theme, children: jsx("div", { style: parsedStyle, className: clsx('tw-text-base-content tw-relative tw-font-geist'), children: children }) }));
3235
+ return (jsx("div", { style: parsedStyle, "data-squid-theme-type": themeType, className: clsx('tw-text-base-content tw-group tw-relative tw-font-geist'), children: children }));
3180
3236
  }
3181
3237
 
3182
- export { AddressButton, ArrowButton, BadgeImage, BodyText, Boost, BoostButton, Button, CaptionText, Chip, DetailsToolbar, Dropdown, DropdownMenuItem, FeeButton, HeadingText, HistoryItem, Input, ListItem, Menu, MenuItem, Modal, NavigationBar, ProductCard, SectionTitle, SquidConfigProvider, SwapConfiguration, Switch, Tooltip, UsdAmount, WalletAddress };
3238
+ export { AddressButton, ArrowButton, AssetsButton, BadgeImage, BodyText, Boost, BoostButton, Button, CaptionText, Chip, DetailsToolbar, DropdownMenuItem, FeeButton, HeadingText, HistoryItem, Input, ListItem, Menu, MenuItem, Modal, NavigationBar, ProductCard, SectionTitle, SettingsButton, SettingsItem, SettingsSlider, SquidConfigProvider, SwapConfiguration, SwapDetailListItem, SwapProgressViewHeader, SwapStepItem, SwapStepsCollapsed, Switch, TokenPair, Tooltip, UsdAmount, WalletAddress, useModal };