@rango-dev/widget-embedded 0.22.4-next.6 → 0.22.4-next.7

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 (175) hide show
  1. package/dist/components/AppRoutes.d.ts.map +1 -1
  2. package/dist/components/BlockchainList/BlockchainList.styles.d.ts +3 -0
  3. package/dist/components/BlockchainList/BlockchainList.styles.d.ts.map +1 -1
  4. package/dist/components/BlockchainsSection/BlockchainsSection.styles.d.ts +1 -0
  5. package/dist/components/BlockchainsSection/BlockchainsSection.styles.d.ts.map +1 -1
  6. package/dist/components/ConfirmWalletsModal/ConfirmWallets.helpers.d.ts +2 -2
  7. package/dist/components/ConfirmWalletsModal/ConfirmWallets.helpers.d.ts.map +1 -1
  8. package/dist/components/ConfirmWalletsModal/ConfirmWallets.styles.d.ts +15 -0
  9. package/dist/components/ConfirmWalletsModal/ConfirmWallets.styles.d.ts.map +1 -1
  10. package/dist/components/ConfirmWalletsModal/ConfirmWalletsModal.d.ts.map +1 -1
  11. package/dist/components/ConfirmWalletsModal/WalletList.styles.d.ts +3 -0
  12. package/dist/components/ConfirmWalletsModal/WalletList.styles.d.ts.map +1 -1
  13. package/dist/components/CustomCollapsible/CustomCollapsible.styles.d.ts +4 -0
  14. package/dist/components/CustomCollapsible/CustomCollapsible.styles.d.ts.map +1 -1
  15. package/dist/components/HeaderButtons/HeaderButtons.d.ts +4 -0
  16. package/dist/components/HeaderButtons/HeaderButtons.d.ts.map +1 -0
  17. package/dist/components/HeaderButtons/HeaderButtons.styles.d.ts +5 -0
  18. package/dist/components/HeaderButtons/HeaderButtons.styles.d.ts.map +1 -1
  19. package/dist/components/HeaderButtons/HeaderButtons.types.d.ts +3 -2
  20. package/dist/components/HeaderButtons/HeaderButtons.types.d.ts.map +1 -1
  21. package/dist/components/HeaderButtons/index.d.ts +1 -1
  22. package/dist/components/HeaderButtons/index.d.ts.map +1 -1
  23. package/dist/components/HistoryGroupedList/HistoryGroupedList.styles.d.ts +6 -0
  24. package/dist/components/HistoryGroupedList/HistoryGroupedList.styles.d.ts.map +1 -1
  25. package/dist/components/Layout/Layout.d.ts.map +1 -1
  26. package/dist/components/Layout/Layout.styles.d.ts +3 -0
  27. package/dist/components/Layout/Layout.styles.d.ts.map +1 -1
  28. package/dist/components/Layout/Layout.types.d.ts +1 -0
  29. package/dist/components/Layout/Layout.types.d.ts.map +1 -1
  30. package/dist/components/Layout/PageContainer.d.ts +1 -0
  31. package/dist/components/Layout/PageContainer.d.ts.map +1 -1
  32. package/dist/components/Layout/ScrollableArea.d.ts +1 -0
  33. package/dist/components/Layout/ScrollableArea.d.ts.map +1 -1
  34. package/dist/components/LoadingLiquiditySourceList/LoadingLiquiditySourceList.styles.d.ts +1 -0
  35. package/dist/components/LoadingLiquiditySourceList/LoadingLiquiditySourceList.styles.d.ts.map +1 -1
  36. package/dist/components/LoadingSwapDetails/LoadingSwapDetails.styles.d.ts +14 -0
  37. package/dist/components/LoadingSwapDetails/LoadingSwapDetails.styles.d.ts.map +1 -1
  38. package/dist/components/NoResult/NoResult.styles.d.ts +3 -0
  39. package/dist/components/NoResult/NoResult.styles.d.ts.map +1 -1
  40. package/dist/components/NotificationContent/NotificationContent.styles.d.ts +4 -0
  41. package/dist/components/NotificationContent/NotificationContent.styles.d.ts.map +1 -1
  42. package/dist/components/Quote/Quote.d.ts.map +1 -1
  43. package/dist/components/Quote/Quote.styles.d.ts +1136 -25
  44. package/dist/components/Quote/Quote.styles.d.ts.map +1 -1
  45. package/dist/components/Quote/Quote.types.d.ts +12 -7
  46. package/dist/components/Quote/Quote.types.d.ts.map +1 -1
  47. package/dist/components/Quote/QuoteCostDetails.d.ts.map +1 -1
  48. package/dist/components/Quote/QuoteCostDetails.styles.d.ts +5 -0
  49. package/dist/components/Quote/QuoteCostDetails.styles.d.ts.map +1 -1
  50. package/dist/components/Quote/QuoteSummary.styles.d.ts +2 -0
  51. package/dist/components/Quote/QuoteSummary.styles.d.ts.map +1 -1
  52. package/dist/components/Quote/QuoteTrigger .d.ts.map +1 -1
  53. package/dist/components/QuoteSkeleton/QuoteSkeleton.styles.d.ts +4 -0
  54. package/dist/components/QuoteSkeleton/QuoteSkeleton.styles.d.ts.map +1 -1
  55. package/dist/components/QuoteSkeleton/QuoteSkeleton.types.d.ts +1 -1
  56. package/dist/components/QuoteSkeleton/QuoteSkeleton.types.d.ts.map +1 -1
  57. package/dist/components/QuoteSkeleton/QuoteSummarySkeleton.d.ts.map +1 -1
  58. package/dist/components/QuoteSkeleton/QuoteSummarySkeleton.styles.d.ts +20 -10
  59. package/dist/components/QuoteSkeleton/QuoteSummarySkeleton.styles.d.ts.map +1 -1
  60. package/dist/components/QuoteSkeleton/QuoteSummarySkeleton.types.d.ts +1 -1
  61. package/dist/components/QuoteSkeleton/QuoteSummarySkeleton.types.d.ts.map +1 -1
  62. package/dist/components/QuoteSkeleton/StepSkeleton.styles.d.ts +5 -0
  63. package/dist/components/QuoteSkeleton/StepSkeleton.styles.d.ts.map +1 -1
  64. package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.styles.d.ts +4 -0
  65. package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.styles.d.ts.map +1 -1
  66. package/dist/components/SearchInput/SearchInput.styles.d.ts +1 -0
  67. package/dist/components/SearchInput/SearchInput.styles.d.ts.map +1 -1
  68. package/dist/components/SettingsContainer/SettingsContainer.style.d.ts +3 -0
  69. package/dist/components/SettingsContainer/SettingsContainer.style.d.ts.map +1 -1
  70. package/dist/components/Slippage/Slippage.styles.d.ts +5 -0
  71. package/dist/components/Slippage/Slippage.styles.d.ts.map +1 -1
  72. package/dist/components/SwapDetails/SwapDetails.styles.d.ts +13 -0
  73. package/dist/components/SwapDetails/SwapDetails.styles.d.ts.map +1 -1
  74. package/dist/components/SwapDetailsAlerts/SwapDetailsAlerts.styles.d.ts +1 -0
  75. package/dist/components/SwapDetailsAlerts/SwapDetailsAlerts.styles.d.ts.map +1 -1
  76. package/dist/components/SwapDetailsAlerts/SwapDetailsAlerts.types.d.ts +2 -1
  77. package/dist/components/SwapDetailsAlerts/SwapDetailsAlerts.types.d.ts.map +1 -1
  78. package/dist/components/SwapDetailsModal/SwapDetailsModal.styles.d.ts +1 -0
  79. package/dist/components/SwapDetailsModal/SwapDetailsModal.styles.d.ts.map +1 -1
  80. package/dist/components/SwapDetailsModal/index.d.ts +1 -1
  81. package/dist/components/SwapDetailsModal/index.d.ts.map +1 -1
  82. package/dist/components/TokenList/TokenList.styles.d.ts +17 -0
  83. package/dist/components/TokenList/TokenList.styles.d.ts.map +1 -1
  84. package/dist/components/WalletModal/WalletModalContent.styles.d.ts +4 -0
  85. package/dist/components/WalletModal/WalletModalContent.styles.d.ts.map +1 -1
  86. package/dist/constants/navigationRoutes.d.ts +1 -0
  87. package/dist/constants/navigationRoutes.d.ts.map +1 -1
  88. package/dist/constants/quote.d.ts +5 -1
  89. package/dist/constants/quote.d.ts.map +1 -1
  90. package/dist/containers/App/App.styles.d.ts +1 -0
  91. package/dist/containers/App/App.styles.d.ts.map +1 -1
  92. package/dist/containers/QuoteInfo/QuoteInfo.d.ts.map +1 -1
  93. package/dist/containers/QuoteInfo/QuoteInfo.styles.d.ts +3 -0
  94. package/dist/containers/QuoteInfo/QuoteInfo.styles.d.ts.map +1 -1
  95. package/dist/containers/QuoteInfo/QuoteInfo.types.d.ts +6 -3
  96. package/dist/containers/QuoteInfo/QuoteInfo.types.d.ts.map +1 -1
  97. package/dist/hooks/useConfirmSwap/useConfirmSwap.d.ts.map +1 -1
  98. package/dist/hooks/useConfirmSwap/useConfirmSwap.helpers.d.ts +5 -4
  99. package/dist/hooks/useConfirmSwap/useConfirmSwap.helpers.d.ts.map +1 -1
  100. package/dist/hooks/useConfirmSwap/useConfirmSwap.types.d.ts +1 -1
  101. package/dist/hooks/useConfirmSwap/useConfirmSwap.types.d.ts.map +1 -1
  102. package/dist/hooks/useFetch.d.ts +12 -0
  103. package/dist/hooks/useFetch.d.ts.map +1 -0
  104. package/dist/hooks/useFetchAllQuotes.d.ts +4 -0
  105. package/dist/hooks/useFetchAllQuotes.d.ts.map +1 -0
  106. package/dist/hooks/useFetchConfirmQuote.d.ts +4 -0
  107. package/dist/hooks/useFetchConfirmQuote.d.ts.map +1 -0
  108. package/dist/hooks/useSwapInput.d.ts +5 -5
  109. package/dist/hooks/useSwapInput.d.ts.map +1 -1
  110. package/dist/index.js +2 -2
  111. package/dist/index.js.map +4 -4
  112. package/dist/pages/ConfirmSwapPage.d.ts.map +1 -1
  113. package/dist/pages/Home.d.ts.map +1 -1
  114. package/dist/pages/Routes.d.ts +3 -0
  115. package/dist/pages/Routes.d.ts.map +1 -0
  116. package/dist/store/quote.d.ts +32 -10
  117. package/dist/store/quote.d.ts.map +1 -1
  118. package/dist/store/wallets.d.ts +0 -2
  119. package/dist/store/wallets.d.ts.map +1 -1
  120. package/dist/types/quote.d.ts +19 -1
  121. package/dist/types/quote.d.ts.map +1 -1
  122. package/dist/utils/quote.d.ts +12 -9
  123. package/dist/utils/quote.d.ts.map +1 -1
  124. package/dist/utils/swap.d.ts +18 -18
  125. package/dist/utils/swap.d.ts.map +1 -1
  126. package/dist/utils/wallets.d.ts +3 -3
  127. package/dist/utils/wallets.d.ts.map +1 -1
  128. package/package.json +2 -2
  129. package/src/components/AppRoutes.tsx +5 -0
  130. package/src/components/ConfirmWalletsModal/ConfirmWallets.helpers.ts +3 -3
  131. package/src/components/ConfirmWalletsModal/ConfirmWalletsModal.tsx +21 -18
  132. package/src/components/HeaderButtons/{HomeButtons.tsx → HeaderButtons.tsx} +39 -26
  133. package/src/components/HeaderButtons/HeaderButtons.types.ts +3 -2
  134. package/src/components/HeaderButtons/index.ts +1 -1
  135. package/src/components/Layout/Layout.tsx +13 -1
  136. package/src/components/Layout/Layout.types.ts +1 -0
  137. package/src/components/Quote/Quote.styles.ts +133 -38
  138. package/src/components/Quote/Quote.tsx +68 -13
  139. package/src/components/Quote/Quote.types.ts +13 -7
  140. package/src/components/Quote/QuoteCostDetails.tsx +9 -4
  141. package/src/components/Quote/QuoteTrigger .tsx +7 -3
  142. package/src/components/QuoteSkeleton/QuoteSkeleton.tsx +2 -2
  143. package/src/components/QuoteSkeleton/QuoteSkeleton.types.ts +1 -1
  144. package/src/components/QuoteSkeleton/QuoteSummarySkeleton.styles.ts +10 -12
  145. package/src/components/QuoteSkeleton/QuoteSummarySkeleton.tsx +28 -9
  146. package/src/components/QuoteSkeleton/QuoteSummarySkeleton.types.ts +1 -1
  147. package/src/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.helpers.ts +19 -19
  148. package/src/components/SwapDetails/SwapDetails.tsx +1 -1
  149. package/src/components/SwapDetailsAlerts/SwapDetailsAlerts.types.ts +1 -1
  150. package/src/components/SwapDetailsModal/index.ts +1 -1
  151. package/src/constants/navigationRoutes.ts +1 -0
  152. package/src/constants/quote.ts +17 -1
  153. package/src/containers/QuoteInfo/QuoteInfo.tsx +32 -7
  154. package/src/containers/QuoteInfo/QuoteInfo.types.ts +6 -3
  155. package/src/hooks/useConfirmSwap/useConfirmSwap.helpers.ts +36 -20
  156. package/src/hooks/useConfirmSwap/useConfirmSwap.ts +76 -78
  157. package/src/hooks/useConfirmSwap/useConfirmSwap.types.ts +1 -1
  158. package/src/hooks/useFetch.ts +48 -0
  159. package/src/hooks/useFetchAllQuotes.ts +21 -0
  160. package/src/hooks/useFetchConfirmQuote.ts +21 -0
  161. package/src/hooks/useSwapInput.ts +59 -31
  162. package/src/pages/ConfirmSwapPage.tsx +12 -9
  163. package/src/pages/Home.tsx +25 -15
  164. package/src/pages/Routes.tsx +131 -0
  165. package/src/store/quote.ts +60 -22
  166. package/src/store/wallets.ts +0 -2
  167. package/src/types/quote.ts +27 -1
  168. package/src/utils/quote.ts +129 -67
  169. package/src/utils/swap.ts +37 -77
  170. package/src/utils/wallets.ts +10 -9
  171. package/dist/components/HeaderButtons/HomeButtons.d.ts +0 -4
  172. package/dist/components/HeaderButtons/HomeButtons.d.ts.map +0 -1
  173. package/dist/hooks/useFetchQuote.d.ts +0 -9
  174. package/dist/hooks/useFetchQuote.d.ts.map +0 -1
  175. package/src/hooks/useFetchQuote.ts +0 -38
@@ -1,4 +1,4 @@
1
- import type { HomeButtonsPropTypes } from './HeaderButtons.types';
1
+ import type { HeaderButtonsPropTypes } from './HeaderButtons.types';
2
2
 
3
3
  import { i18n } from '@lingui/core';
4
4
  import {
@@ -19,23 +19,32 @@ import { HeaderButton } from './HeaderButtons.styles';
19
19
  import { RefreshButton } from './RefreshButton';
20
20
  import { UnreadNotificationsBadge } from './UnreadNotificationsBadge';
21
21
 
22
- export function HomeButtons(props: HomeButtonsPropTypes) {
23
- const { onClickRefresh, onClickHistory, onClickSettings } = props;
22
+ export function HeaderButtons(props: HeaderButtonsPropTypes) {
23
+ const {
24
+ onClickRefresh,
25
+ onClickHistory,
26
+ onClickSettings,
27
+ hidden = [],
28
+ } = props;
24
29
 
25
30
  const {
26
31
  config: { features },
27
32
  } = useAppStore();
28
33
 
29
- const isNotificationsHidden = isFeatureHidden('notification', features);
34
+ const isNotificationsHidden =
35
+ isFeatureHidden('notification', features) ||
36
+ hidden.includes('notifications');
30
37
 
31
38
  return (
32
39
  <>
33
- <Tooltip
34
- container={getContainer()}
35
- side="top"
36
- content={i18n.t('Refresh')}>
37
- <RefreshButton onClick={onClickRefresh} />
38
- </Tooltip>
40
+ {!hidden.includes('refresh') && (
41
+ <Tooltip
42
+ container={getContainer()}
43
+ side="top"
44
+ content={i18n.t('Refresh')}>
45
+ <RefreshButton onClick={onClickRefresh} />
46
+ </Tooltip>
47
+ )}
39
48
 
40
49
  {!isNotificationsHidden && (
41
50
  <Popover
@@ -57,22 +66,26 @@ export function HomeButtons(props: HomeButtonsPropTypes) {
57
66
  </div>
58
67
  </Popover>
59
68
  )}
60
- <Tooltip
61
- container={getContainer()}
62
- side="top"
63
- content={i18n.t('Settings')}>
64
- <HeaderButton size="small" variant="ghost" onClick={onClickSettings}>
65
- <SettingsIcon size={18} color="black" />
66
- </HeaderButton>
67
- </Tooltip>
68
- <Tooltip
69
- container={getContainer()}
70
- side="top"
71
- content={i18n.t('Transactions History')}>
72
- <HeaderButton size="small" variant="ghost" onClick={onClickHistory}>
73
- <TransactionIcon size={18} color="black" />
74
- </HeaderButton>
75
- </Tooltip>
69
+ {!hidden.includes('settings') && (
70
+ <Tooltip
71
+ container={getContainer()}
72
+ side="top"
73
+ content={i18n.t('Settings')}>
74
+ <HeaderButton size="small" variant="ghost" onClick={onClickSettings}>
75
+ <SettingsIcon size={18} color="black" />
76
+ </HeaderButton>
77
+ </Tooltip>
78
+ )}
79
+ {!hidden.includes('history') && (
80
+ <Tooltip
81
+ container={getContainer()}
82
+ side="top"
83
+ content={i18n.t('Transactions History')}>
84
+ <HeaderButton size="small" variant="ghost" onClick={onClickHistory}>
85
+ <TransactionIcon size={18} color="black" />
86
+ </HeaderButton>
87
+ </Tooltip>
88
+ )}
76
89
  </>
77
90
  );
78
91
  }
@@ -3,8 +3,9 @@ export interface PropTypes {
3
3
  isConnected?: boolean;
4
4
  container?: HTMLElement;
5
5
  }
6
- export interface HomeButtonsPropTypes {
6
+ export interface HeaderButtonsPropTypes {
7
+ onClickSettings?: () => void;
7
8
  onClickRefresh?: () => void;
8
9
  onClickHistory?: () => void;
9
- onClickSettings?: () => void;
10
+ hidden?: ('settings' | 'refresh' | 'history' | 'notifications')[];
10
11
  }
@@ -1,4 +1,4 @@
1
1
  export { BackButton } from './BackButton';
2
2
  export { CancelButton } from './CancelButton';
3
3
  export { WalletButton } from './WalletButton';
4
- export { HomeButtons } from './HomeButtons';
4
+ export { HeaderButtons } from './HeaderButtons';
@@ -101,7 +101,19 @@ function Layout(props: PropsWithChildren<PropTypes>) {
101
101
  className={activeTheme()}
102
102
  ref={containerRef}>
103
103
  <Header
104
- prefix={<>{showBackButton && <BackButton onClick={navigateBack} />}</>}
104
+ prefix={
105
+ <>
106
+ {showBackButton && (
107
+ <BackButton
108
+ onClick={() => {
109
+ navigateBack();
110
+ // As an example, used in routes page to add a custom logic when navigating back to the home page.
111
+ header.onBack && header.onBack();
112
+ }}
113
+ />
114
+ )}
115
+ </>
116
+ }
105
117
  title={header.title}
106
118
  suffix={
107
119
  <>
@@ -14,6 +14,7 @@ export interface PropTypes {
14
14
  suffix?: React.ReactNode;
15
15
  hasBackButton?: boolean;
16
16
  onCancel?: () => void;
17
+ onBack?: () => void;
17
18
  };
18
19
  footer?: React.ReactNode;
19
20
  height?: ContainerHeightProp;
@@ -1,5 +1,12 @@
1
1
  import * as Collapsible from '@radix-ui/react-collapsible';
2
- import { css, darkTheme, Image, styled, Typography } from '@rango-dev/ui';
2
+ import {
3
+ Button,
4
+ css,
5
+ darkTheme,
6
+ Image,
7
+ styled,
8
+ Typography,
9
+ } from '@rango-dev/ui';
3
10
 
4
11
  import { CollapsibleContent } from '../CustomCollapsible/CustomCollapsible.styles';
5
12
 
@@ -13,31 +20,64 @@ export const QuoteContainer = styled(Collapsible.Root, {
13
20
  overflowY: 'hidden',
14
21
  width: '100%',
15
22
  borderRadius: '$xm',
16
- cursor: 'default',
17
23
  variants: {
18
- recommended: {
19
- true: {
20
- $$color: '$colors$info300',
24
+ selected: {
25
+ true: {},
26
+ false: {
27
+ $$color: '$colors$neutral400',
21
28
  [`.${darkTheme} &`]: {
22
- $$color: '$colors$secondary800',
29
+ $$color: '$colors$neutral200',
23
30
  },
24
31
  backgroundColor: '$$color',
25
32
  },
26
- false: {
33
+ },
34
+ listItem: {
35
+ true: {
27
36
  $$color: '$colors$neutral400',
28
37
  [`.${darkTheme} &`]: {
29
38
  $$color: '$colors$neutral200',
30
39
  },
31
40
  backgroundColor: '$$color',
32
41
  },
42
+ false: {},
33
43
  },
34
44
  },
45
+
46
+ compoundVariants: [
47
+ {
48
+ listItem: false,
49
+ selected: true,
50
+ css: {
51
+ $$color: '$colors$info300',
52
+ [`.${darkTheme} &`]: {
53
+ $$color: '$colors$secondary800',
54
+ },
55
+ backgroundColor: '$$color',
56
+ },
57
+ },
58
+ {
59
+ listItem: true,
60
+ selected: false,
61
+ css: {
62
+ cursor: 'pointer',
63
+ '&:hover': {
64
+ backgroundColor: '$neutral300',
65
+ [`.${darkTheme} &`]: {
66
+ backgroundColor: '$neutral400',
67
+ },
68
+ },
69
+ },
70
+ },
71
+ ],
35
72
  });
36
73
 
37
74
  export const stepsDetailsStyles = css({
38
75
  padding: '$10 $15',
39
76
  });
40
-
77
+ export const AllRoutesButton = styled(Button, {
78
+ backgroundColor: 'transparent',
79
+ border: '1px solid $secondary',
80
+ });
41
81
  export const SummaryContainer = styled('div', {
42
82
  borderRadius: '$xm',
43
83
  display: 'flex',
@@ -45,35 +85,35 @@ export const SummaryContainer = styled('div', {
45
85
  alignItems: 'start',
46
86
  justifyContent: 'space-between',
47
87
  color: '$foreground',
48
- cursor: 'pointer',
49
88
  boxSizing: 'border-box',
50
89
  position: 'relative',
51
90
  variants: {
52
- recommended: {
53
- true: {
54
- $$color: '$colors$info100',
91
+ selected: {
92
+ true: {},
93
+ false: {
94
+ $$color: '$colors$neutral200',
55
95
  [`.${darkTheme} &`]: {
56
- $$color: '$colors$secondary600',
96
+ $$color: '$colors$neutral500',
57
97
  },
58
98
  backgroundColor: '$$color',
59
- '&:hover': {
60
- backgroundColor: '$$color',
61
- },
62
99
  },
63
- false: {
100
+ },
101
+ basic: { true: { borderTopRightRadius: '0', borderTopLeftRadius: '0' } },
102
+ listItem: {
103
+ true: {
64
104
  $$color: '$colors$neutral200',
65
105
  [`.${darkTheme} &`]: {
66
106
  $$color: '$colors$neutral500',
67
107
  },
68
108
  backgroundColor: '$$color',
69
109
  '&:hover': {
70
- backgroundColor: '$$color',
110
+ backgroundColor: '$neutral300',
111
+ [`.${darkTheme} &`]: {
112
+ backgroundColor: '$neutral400',
113
+ },
71
114
  },
115
+ cursor: 'pointer',
72
116
  },
73
- },
74
- basic: { true: { borderTopRightRadius: '0', borderTopLeftRadius: '0' } },
75
- listItem: {
76
- true: {},
77
117
  false: {},
78
118
  },
79
119
  },
@@ -81,27 +121,35 @@ export const SummaryContainer = styled('div', {
81
121
  compoundVariants: [
82
122
  {
83
123
  listItem: true,
84
- recommended: true,
124
+ selected: true,
125
+ css: {
126
+ border: '1px solid $secondary',
127
+ },
128
+ },
129
+ {
130
+ listItem: false,
131
+ selected: true,
85
132
  css: {
133
+ $$color: '$colors$info100',
134
+ [`.${darkTheme} &`]: {
135
+ $$color: '$colors$secondary600',
136
+ },
137
+ backgroundColor: '$$color',
86
138
  '&:hover': {
87
- $$color: '$colors$secondary200',
88
- [`.${darkTheme} &`]: {
89
- $$color: '$colors$secondary700',
90
- },
91
139
  backgroundColor: '$$color',
92
140
  },
93
141
  },
94
142
  },
95
143
  {
96
144
  listItem: true,
97
- recommended: false,
145
+ selected: false,
98
146
  css: {
147
+ cursor: 'pointer',
99
148
  '&:hover': {
100
- $$color: '$colors$neutral300',
149
+ backgroundColor: '$neutral300',
101
150
  [`.${darkTheme} &`]: {
102
- $$color: '$colors$neutral400',
151
+ backgroundColor: '$neutral400',
103
152
  },
104
- backgroundColor: '$$color',
105
153
  },
106
154
  },
107
155
  },
@@ -111,7 +159,15 @@ export const SummaryContainer = styled('div', {
111
159
  export const summaryStyles = css({
112
160
  width: '100%',
113
161
  padding: '$15 $15 $10 $15',
114
- cursor: 'default',
162
+ });
163
+
164
+ export const summaryHeaderStyles = css({
165
+ display: 'flex',
166
+ flexDirection: 'row',
167
+ justifyContent: 'space-between',
168
+ alignItems: 'center',
169
+ paddingBottom: '$10',
170
+ position: 'relative',
115
171
  });
116
172
 
117
173
  export const rowStyles = css({
@@ -124,7 +180,6 @@ export const rowStyles = css({
124
180
  },
125
181
  });
126
182
  export const basicInfoStyles = css({
127
- paddingTop: '$10',
128
183
  display: 'flex',
129
184
  alignItems: 'center',
130
185
  '.usd-value': {
@@ -163,23 +218,41 @@ export const Trigger = styled(Collapsible.Trigger, {
163
218
  },
164
219
  },
165
220
  },
166
- recommended: {
167
- true: {
168
- $$color: '$colors$info300',
221
+ selected: {
222
+ true: {},
223
+ false: {
224
+ $$color: '$colors$neutral400',
169
225
  [`.${darkTheme} &`]: {
170
- $$color: '$colors$secondary800',
226
+ $$color: '$colors$neutral200',
171
227
  },
172
228
  backgroundColor: '$$color',
173
229
  },
174
- false: {
230
+ },
231
+ listItem: {
232
+ true: {
175
233
  $$color: '$colors$neutral400',
176
234
  [`.${darkTheme} &`]: {
177
235
  $$color: '$colors$neutral200',
178
236
  },
179
237
  backgroundColor: '$$color',
180
238
  },
239
+ false: {},
181
240
  },
182
241
  },
242
+
243
+ compoundVariants: [
244
+ {
245
+ listItem: false,
246
+ selected: true,
247
+ css: {
248
+ $$color: '$colors$info300',
249
+ [`.${darkTheme} &`]: {
250
+ $$color: '$colors$secondary800',
251
+ },
252
+ backgroundColor: '$$color',
253
+ },
254
+ },
255
+ ],
183
256
  '.blockchains_section': {
184
257
  display: 'none',
185
258
  },
@@ -291,3 +364,25 @@ export const MoreStep = styled('div', {
291
364
  },
292
365
  },
293
366
  });
367
+
368
+ export const Tag = styled('div', {
369
+ backgroundColor: '$neutral400',
370
+ borderRadius: '$xs',
371
+ padding: '$2 $5',
372
+ fontSize: '$10',
373
+ fontWeight: 400,
374
+ });
375
+ export const TagContainer = styled('div', {
376
+ display: 'flex',
377
+ });
378
+
379
+ export const Line = styled('div', {
380
+ width: '100%',
381
+ borderTopWidth: '1px',
382
+ borderTopStyle: 'solid',
383
+ borderTopColor: '$neutral',
384
+ margin: '$5 0',
385
+ [`.${darkTheme} &`]: {
386
+ borderTopColor: '$neutral400',
387
+ },
388
+ });
@@ -35,19 +35,29 @@ import {
35
35
  getSwapperDisplayName,
36
36
  } from '../../utils/meta';
37
37
  import { formatTooltipNumbers, numberToString } from '../../utils/numbers';
38
- import { getPriceImpact, getPriceImpactLevel } from '../../utils/quote';
38
+ import {
39
+ getPriceImpact,
40
+ getPriceImpactLevel,
41
+ getRouteTagColor,
42
+ sortTags,
43
+ } from '../../utils/quote';
39
44
 
40
45
  import {
46
+ AllRoutesButton,
41
47
  BasicInfoOutput,
42
48
  basicInfoStyles,
43
49
  ContainerInfoOutput,
44
50
  Content,
45
51
  FrameIcon,
46
52
  HorizontalSeparator,
53
+ Line,
47
54
  QuoteContainer,
48
55
  stepsDetailsStyles,
49
56
  SummaryContainer,
57
+ summaryHeaderStyles,
50
58
  summaryStyles,
59
+ Tag,
60
+ TagContainer,
51
61
  } from './Quote.styles';
52
62
  import { QuoteCostDetails } from './QuoteCostDetails';
53
63
  import { QuoteSummary } from './QuoteSummary';
@@ -61,11 +71,12 @@ export function Quote(props: QuoteProps) {
61
71
  error,
62
72
  warning,
63
73
  type,
64
- recommended = true,
74
+ selected = false,
75
+ tagHidden = true,
76
+ onClickAllRoutes,
65
77
  } = props;
66
78
  const blockchains = useAppStore().blockchains();
67
79
  const swappers = useAppStore().swappers();
68
-
69
80
  const [expanded, setExpanded] = useState(props.expanded);
70
81
  const quoteRef = useRef<HTMLButtonElement | null>(null);
71
82
  const roundedInput = numberToString(
@@ -184,6 +195,7 @@ export function Quote(props: QuoteProps) {
184
195
  stepHasError || stepHasWarning ? (
185
196
  <FooterStepAlarm>
186
197
  <Alert
198
+ variant="alarm"
187
199
  type={stepHasError ? 'error' : 'warning'}
188
200
  title={
189
201
  error?.type === QuoteErrorType.BRIDGE_LIMIT
@@ -258,18 +270,59 @@ export function Quote(props: QuoteProps) {
258
270
  };
259
271
  });
260
272
  };
261
- const steps = getQuoteSteps(quote.result?.swaps ?? []);
273
+ const steps = getQuoteSteps(quote?.swaps ?? []);
274
+
262
275
  const numberOfSteps = steps.length;
263
- const tooltipContainer = getContainer();
276
+ const container = getContainer();
277
+ const sortedQuoteTags = sortTags(props.quote.tags || []);
278
+ const showAllRoutesButton = !!onClickAllRoutes;
264
279
 
265
280
  return (
266
281
  <>
267
282
  <SummaryContainer
268
- recommended={recommended}
283
+ selected={selected}
269
284
  listItem={type === 'list-item'}
270
285
  basic={type === 'basic'}>
271
286
  <div className={summaryStyles()}>
272
- <QuoteCostDetails steps={numberOfSteps} quote={quote} />
287
+ {!tagHidden && sortedQuoteTags.length ? (
288
+ <>
289
+ <TagContainer>
290
+ {sortedQuoteTags.map((tag, index) => {
291
+ const key = `${tag.value}_${index}`;
292
+ return (
293
+ <>
294
+ <Tag
295
+ style={{ color: getRouteTagColor(tag.value) }}
296
+ key={key}>
297
+ {tag.label}
298
+ </Tag>
299
+ <Divider size={4} direction="horizontal" />
300
+ </>
301
+ );
302
+ })}
303
+ </TagContainer>
304
+ <Line />
305
+ {!showAllRoutesButton && <Divider size={4} />}
306
+ </>
307
+ ) : null}
308
+ <div id="portal-root" className={summaryHeaderStyles()}>
309
+ <QuoteCostDetails steps={numberOfSteps} quote={quote} />
310
+
311
+ {showAllRoutesButton && (
312
+ <AllRoutesButton
313
+ onClick={(e) => {
314
+ e.stopPropagation();
315
+ onClickAllRoutes();
316
+ }}
317
+ size="xxsmall"
318
+ type="secondary"
319
+ variant="default">
320
+ <Typography color="secondary" variant="label" size="medium">
321
+ {i18n.t('See All Routes')}
322
+ </Typography>
323
+ </AllRoutesButton>
324
+ )}
325
+ </div>
273
326
  {type === 'basic' && (
274
327
  <div className={basicInfoStyles()}>
275
328
  <FrameIcon>
@@ -281,7 +334,7 @@ export function Quote(props: QuoteProps) {
281
334
  </BasicInfoOutput>
282
335
  <Tooltip
283
336
  content={formatTooltipNumbers(output.value)}
284
- container={tooltipContainer}
337
+ container={container}
285
338
  open={!output.value ? false : undefined}>
286
339
  <BasicInfoOutput size="small" variant="body">
287
340
  &nbsp;
@@ -293,7 +346,7 @@ export function Quote(props: QuoteProps) {
293
346
  </ContainerInfoOutput>
294
347
  <Tooltip
295
348
  content={formatTooltipNumbers(output.usdValue)}
296
- container={tooltipContainer}
349
+ container={container}
297
350
  style={{
298
351
  display: 'flex',
299
352
  }}>
@@ -309,9 +362,9 @@ export function Quote(props: QuoteProps) {
309
362
  )}
310
363
  {type === 'list-item' && (
311
364
  <TokenAmount
365
+ tooltipContainer={container}
312
366
  type="output"
313
367
  direction="vertical"
314
- tooltipContainer={tooltipContainer}
315
368
  price={{
316
369
  value: roundedOutput,
317
370
  usdValue: roundedOutputUsdValue,
@@ -340,12 +393,14 @@ export function Quote(props: QuoteProps) {
340
393
  )}
341
394
  </div>
342
395
  <QuoteContainer
343
- recommended={recommended}
396
+ selected={selected}
397
+ listItem={type === 'list-item'}
344
398
  open={expanded}
345
399
  onOpenChange={setExpanded}>
346
400
  <QuoteTrigger
401
+ type={type}
347
402
  quoteRef={quoteRef}
348
- recommended={recommended}
403
+ selected={selected}
349
404
  setExpanded={setExpanded}
350
405
  expanded={expanded}
351
406
  steps={steps}
@@ -359,10 +414,10 @@ export function Quote(props: QuoteProps) {
359
414
  <StepDetails
360
415
  type="quote-details"
361
416
  key={key}
417
+ tooltipContainer={container}
362
418
  step={step}
363
419
  hasSeparator={index !== steps.length - 1}
364
420
  state={step.state}
365
- tooltipContainer={tooltipContainer}
366
421
  />
367
422
  );
368
423
  })}
@@ -1,23 +1,29 @@
1
- import type { QuoteError, QuoteWarning } from '../../types';
1
+ import type { QuoteError, QuoteWarning, SelectedQuote } from '../../types';
2
2
  import type { Step } from '@rango-dev/ui';
3
- import type { BestRouteResponse } from 'rango-sdk';
4
3
  import type { ReactNode } from 'react';
5
4
 
6
5
  export type QuoteProps = {
7
6
  type: 'basic' | 'list-item' | 'swap-preview';
8
7
  error: QuoteError | null;
9
8
  warning: QuoteWarning | null;
10
- recommended: boolean;
11
- tag?: ReactNode;
12
- quote: BestRouteResponse;
9
+ quote: SelectedQuote;
13
10
  input: { value: string; usdValue: string };
14
11
  output: { value: string; usdValue?: string };
15
12
  expanded?: boolean;
13
+ tagHidden?: boolean;
14
+ selected?: boolean;
15
+ onClickAllRoutes?: () => void;
16
+ };
17
+
18
+ export type optionProps = {
19
+ value: string;
20
+ label: string;
16
21
  };
17
22
 
18
23
  export type QuoteTriggerProps = {
24
+ type: QuoteProps['type'];
19
25
  quoteRef: React.MutableRefObject<HTMLButtonElement | null>;
20
- recommended: boolean;
26
+ selected: boolean;
21
27
  setExpanded: React.Dispatch<React.SetStateAction<boolean | undefined>>;
22
28
  steps: Step[];
23
29
  expanded?: boolean;
@@ -32,6 +38,6 @@ export type QuoteTriggerImagesProps = {
32
38
  };
33
39
 
34
40
  export type QuoteCostDetailsProps = {
35
- quote: BestRouteResponse;
41
+ quote: SelectedQuote | null;
36
42
  steps: number;
37
43
  };
@@ -72,8 +72,8 @@ export function QuoteCostDetails(props: QuoteCostDetailsProps) {
72
72
  const [openCollapse, setOpenCollapse] = useState<boolean>(false);
73
73
  const { steps, quote } = props;
74
74
  const tokens = useAppStore().tokens();
75
- const totalTime = secondsToString(totalArrivalTime(quote.result?.swaps));
76
- const swaps = quote.result?.swaps ?? [];
75
+ const totalTime = secondsToString(totalArrivalTime(quote?.swaps));
76
+ const swaps = quote?.swaps ?? [];
77
77
  const container = getContainer();
78
78
 
79
79
  const totalFee = getTotalFeeInUsd(swaps, tokens);
@@ -83,7 +83,10 @@ export function QuoteCostDetails(props: QuoteCostDetailsProps) {
83
83
  return (
84
84
  <>
85
85
  <QuoteCost
86
- onClickFee={() => setOpen(!open)}
86
+ onClickFee={(e) => {
87
+ e.stopPropagation();
88
+ setOpen(!open);
89
+ }}
87
90
  fee={numberToString(
88
91
  totalFee,
89
92
  GAS_FEE_MIN_DECIMALS,
@@ -110,7 +113,9 @@ export function QuoteCostDetails(props: QuoteCostDetailsProps) {
110
113
  </IconButton>
111
114
  </ModalHeader>
112
115
  }
113
- onClose={() => setOpen(false)}>
116
+ onClose={() => {
117
+ setOpen(false);
118
+ }}>
114
119
  <ModalContainer>
115
120
  <Typography variant="title" size="small">
116
121
  {i18n.t('Details')}