@rango-dev/widget-embedded 0.20.1-next.20 → 0.20.1-next.21

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 (84) hide show
  1. package/dist/components/BlockchainList/BlockchainList.styles.d.ts +161 -1
  2. package/dist/components/BlockchainList/BlockchainList.styles.d.ts.map +1 -1
  3. package/dist/components/HeaderButtons/HeaderButtons.types.d.ts +0 -1
  4. package/dist/components/HeaderButtons/HeaderButtons.types.d.ts.map +1 -1
  5. package/dist/components/HeaderButtons/HomeButtons.d.ts.map +1 -1
  6. package/dist/components/Layout/Layout.d.ts +2 -3
  7. package/dist/components/Layout/Layout.d.ts.map +1 -1
  8. package/dist/components/Layout/Layout.helpers.d.ts +2 -0
  9. package/dist/components/Layout/Layout.helpers.d.ts.map +1 -0
  10. package/dist/components/Layout/Layout.styles.d.ts +2 -4
  11. package/dist/components/Layout/Layout.styles.d.ts.map +1 -1
  12. package/dist/components/Layout/Layout.types.d.ts +6 -3
  13. package/dist/components/Layout/Layout.types.d.ts.map +1 -1
  14. package/dist/components/Layout/PageContainer.d.ts +166 -0
  15. package/dist/components/Layout/PageContainer.d.ts.map +1 -0
  16. package/dist/components/Layout/ScrollableArea.d.ts +164 -0
  17. package/dist/components/Layout/ScrollableArea.d.ts.map +1 -0
  18. package/dist/components/Layout/index.d.ts +2 -0
  19. package/dist/components/Layout/index.d.ts.map +1 -1
  20. package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.styles.d.ts.map +1 -1
  21. package/dist/components/SettingsContainer/SettingsContainer.style.d.ts +0 -161
  22. package/dist/components/SettingsContainer/SettingsContainer.style.d.ts.map +1 -1
  23. package/dist/components/SettingsContainer/index.d.ts +1 -1
  24. package/dist/components/SettingsContainer/index.d.ts.map +1 -1
  25. package/dist/components/SwapDetails/SwapDetails.Placeholder.d.ts.map +1 -1
  26. package/dist/components/SwapDetails/SwapDetails.d.ts.map +1 -1
  27. package/dist/components/SwapDetails/SwapDetails.styles.d.ts +161 -1
  28. package/dist/components/SwapDetails/SwapDetails.styles.d.ts.map +1 -1
  29. package/dist/components/TokenList/TokenList.styles.d.ts.map +1 -1
  30. package/dist/containers/App/App.styles.d.ts.map +1 -1
  31. package/dist/containers/QuoteInfo/QuoteInfo.d.ts +1 -1
  32. package/dist/containers/QuoteInfo/QuoteInfo.d.ts.map +1 -1
  33. package/dist/containers/QuoteInfo/QuoteInfo.styles.d.ts +0 -324
  34. package/dist/containers/QuoteInfo/QuoteInfo.styles.d.ts.map +1 -1
  35. package/dist/containers/QuoteInfo/QuoteInfo.types.d.ts +0 -7
  36. package/dist/containers/QuoteInfo/QuoteInfo.types.d.ts.map +1 -1
  37. package/dist/index.js +2 -2
  38. package/dist/index.js.map +4 -4
  39. package/dist/pages/ConfirmSwapPage.d.ts.map +1 -1
  40. package/dist/pages/HistoryPage.d.ts.map +1 -1
  41. package/dist/pages/Home.d.ts.map +1 -1
  42. package/dist/pages/LanguagePage.d.ts.map +1 -1
  43. package/dist/pages/LiquiditySourcePage.d.ts.map +1 -1
  44. package/dist/pages/SelectSwapItemsPage.d.ts.map +1 -1
  45. package/dist/pages/SettingsPage.d.ts.map +1 -1
  46. package/dist/pages/ThemePage.d.ts.map +1 -1
  47. package/dist/pages/WalletsPage.d.ts.map +1 -1
  48. package/dist/utils/ui.d.ts +2 -0
  49. package/dist/utils/ui.d.ts.map +1 -1
  50. package/package.json +2 -2
  51. package/src/components/BlockchainList/BlockchainList.styles.ts +4 -3
  52. package/src/components/BlockchainList/BlockchainList.tsx +1 -1
  53. package/src/components/HeaderButtons/HeaderButtons.types.ts +0 -1
  54. package/src/components/HeaderButtons/HomeButtons.tsx +1 -2
  55. package/src/components/Layout/Layout.helpers.ts +16 -0
  56. package/src/components/Layout/Layout.styles.ts +17 -31
  57. package/src/components/Layout/Layout.tsx +23 -21
  58. package/src/components/Layout/Layout.types.ts +9 -8
  59. package/src/components/Layout/PageContainer.tsx +24 -0
  60. package/src/components/Layout/ScrollableArea.tsx +11 -0
  61. package/src/components/Layout/index.ts +2 -0
  62. package/src/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.styles.ts +0 -1
  63. package/src/components/SettingsContainer/SettingsContainer.style.ts +0 -5
  64. package/src/components/SettingsContainer/index.ts +0 -1
  65. package/src/components/SwapDetails/SwapDetails.Placeholder.tsx +0 -1
  66. package/src/components/SwapDetails/SwapDetails.styles.ts +5 -6
  67. package/src/components/SwapDetails/SwapDetails.tsx +3 -5
  68. package/src/components/TokenList/TokenList.styles.ts +2 -0
  69. package/src/components/TokenList/TokenList.tsx +1 -1
  70. package/src/containers/App/App.styles.ts +2 -0
  71. package/src/containers/QuoteInfo/QuoteInfo.styles.ts +0 -15
  72. package/src/containers/QuoteInfo/QuoteInfo.tsx +30 -77
  73. package/src/containers/QuoteInfo/QuoteInfo.types.ts +0 -7
  74. package/src/pages/ConfirmSwapPage.tsx +49 -42
  75. package/src/pages/HistoryPage.tsx +4 -11
  76. package/src/pages/Home.tsx +35 -37
  77. package/src/pages/LanguagePage.tsx +3 -4
  78. package/src/pages/LiquiditySourcePage.tsx +3 -4
  79. package/src/pages/SelectBlockchainPage.tsx +38 -38
  80. package/src/pages/SelectSwapItemsPage.tsx +40 -38
  81. package/src/pages/SettingsPage.tsx +3 -4
  82. package/src/pages/ThemePage.tsx +3 -4
  83. package/src/pages/WalletsPage.tsx +12 -13
  84. package/src/utils/ui.ts +20 -0
@@ -6,7 +6,7 @@ import React, { useState } from 'react';
6
6
  import { useNavigate } from 'react-router-dom';
7
7
 
8
8
  import { BlockchainsSection } from '../components/BlockchainsSection';
9
- import { Layout } from '../components/Layout';
9
+ import { Layout, PageContainer } from '../components/Layout';
10
10
  import { SearchInput } from '../components/SearchInput';
11
11
  import { TokenList } from '../components/TokenList/TokenList';
12
12
  import { navigationRoutes } from '../constants/navigationRoutes';
@@ -78,45 +78,47 @@ export function SelectSwapItemsPage(props: PropTypes) {
78
78
  header={{
79
79
  title: i18n.t('Swap {type}', { type: types[type] }),
80
80
  }}>
81
- <BlockchainsSection
82
- blockchains={blockchains}
83
- type={type == 'source' ? 'from' : 'to'}
84
- blockchain={type === 'source' ? fromBlockchain : toBlockchain}
85
- onMoreClick={() => navigate(navigationRoutes.blockchains)}
86
- onChange={(blockchain) => {
87
- updateBlockchain(blockchain);
88
- }}
89
- />
90
- <Divider size={24} />
91
- <SearchInput
92
- value={searchedFor}
93
- autoFocus
94
- placeholder={i18n.t('Search Token')}
95
- color="light"
96
- variant="contained"
97
- size="large"
98
- setValue={() => setSearchedFor('')}
99
- onChange={(event) => setSearchedFor(event.target.value)}
100
- />
101
- <Divider size={16} />
102
- <TokenList
103
- list={tokensList}
104
- selectedBlockchain={selectedBlockchainName}
105
- searchedFor={searchedFor}
106
- type={type}
107
- onChange={(token) => {
108
- updateToken(token);
81
+ <PageContainer>
82
+ <BlockchainsSection
83
+ blockchains={blockchains}
84
+ type={type == 'source' ? 'from' : 'to'}
85
+ blockchain={type === 'source' ? fromBlockchain : toBlockchain}
86
+ onMoreClick={() => navigate(navigationRoutes.blockchains)}
87
+ onChange={(blockchain) => {
88
+ updateBlockchain(blockchain);
89
+ }}
90
+ />
91
+ <Divider size={24} />
92
+ <SearchInput
93
+ value={searchedFor}
94
+ autoFocus
95
+ placeholder={i18n.t('Search Token')}
96
+ color="light"
97
+ variant="contained"
98
+ size="large"
99
+ setValue={() => setSearchedFor('')}
100
+ onChange={(event) => setSearchedFor(event.target.value)}
101
+ />
102
+ <Divider size={16} />
103
+ <TokenList
104
+ list={tokensList}
105
+ selectedBlockchain={selectedBlockchainName}
106
+ searchedFor={searchedFor}
107
+ type={type}
108
+ onChange={(token) => {
109
+ updateToken(token);
109
110
 
110
- const tokenBlockchain = blockchains.find(
111
- (chain) => token.blockchain === chain.name
112
- );
113
- if (tokenBlockchain) {
114
- updateBlockchain(tokenBlockchain);
115
- }
111
+ const tokenBlockchain = blockchains.find(
112
+ (chain) => token.blockchain === chain.name
113
+ );
114
+ if (tokenBlockchain) {
115
+ updateBlockchain(tokenBlockchain);
116
+ }
116
117
 
117
- navigateBack();
118
- }}
119
- />
118
+ navigateBack();
119
+ }}
120
+ />
121
+ </PageContainer>
120
122
  </Layout>
121
123
  );
122
124
  }
@@ -13,8 +13,7 @@ import {
13
13
  import React from 'react';
14
14
  import { useNavigate } from 'react-router-dom';
15
15
 
16
- import { Layout } from '../components/Layout';
17
- import { SettingsContainer } from '../components/SettingsContainer';
16
+ import { Layout, PageContainer } from '../components/Layout';
18
17
  import { Slippage } from '../components/Slippage';
19
18
  import { SlippageTooltipContainer as TooltipContainer } from '../components/Slippage/Slippage.styles';
20
19
  import { navigationRoutes } from '../constants/navigationRoutes';
@@ -183,7 +182,7 @@ export function SettingsPage() {
183
182
  header={{
184
183
  title: i18n.t('Settings'),
185
184
  }}>
186
- <SettingsContainer>
185
+ <PageContainer>
187
186
  <Slippage />
188
187
  <List
189
188
  type={
@@ -191,7 +190,7 @@ export function SettingsPage() {
191
190
  }
192
191
  items={settingItems}
193
192
  />
194
- </SettingsContainer>
193
+ </PageContainer>
195
194
  </Layout>
196
195
  );
197
196
  }
@@ -11,8 +11,7 @@ import {
11
11
  } from '@rango-dev/ui';
12
12
  import React from 'react';
13
13
 
14
- import { Layout } from '../components/Layout';
15
- import { SettingsContainer } from '../components/SettingsContainer';
14
+ import { Layout, PageContainer } from '../components/Layout';
16
15
  import { useAppStore } from '../store/AppStore';
17
16
 
18
17
  type Theme = 'dark' | 'light' | 'auto';
@@ -70,7 +69,7 @@ export function ThemePage() {
70
69
  header={{
71
70
  title: i18n.t('Theme'),
72
71
  }}>
73
- <SettingsContainer>
72
+ <PageContainer>
74
73
  <RadioRoot
75
74
  onValueChange={(value) => setTheme(value as Theme)}
76
75
  value={theme}>
@@ -85,7 +84,7 @@ export function ThemePage() {
85
84
  items={themesList}
86
85
  />
87
86
  </RadioRoot>
88
- </SettingsContainer>
87
+ </PageContainer>
89
88
  </Layout>
90
89
  );
91
90
  }
@@ -2,9 +2,9 @@ import type { WalletType } from '@rango-dev/wallets-shared';
2
2
 
3
3
  import { i18n } from '@lingui/core';
4
4
  import { styled, Typography, Wallet, WalletState } from '@rango-dev/ui';
5
- import React, { Fragment, useState } from 'react';
5
+ import React, { useState } from 'react';
6
6
 
7
- import { Layout } from '../components/Layout';
7
+ import { Layout, PageContainer } from '../components/Layout';
8
8
  import { WalletModal } from '../components/WalletModal';
9
9
  import { useWalletList } from '../hooks/useWalletList';
10
10
  import { useAppStore } from '../store/AppStore';
@@ -20,7 +20,7 @@ const ListContainer = styled('div', {
20
20
  height: '100%',
21
21
  });
22
22
 
23
- const Container = styled('div', {
23
+ const Container = styled(PageContainer, {
24
24
  textAlign: 'center',
25
25
  });
26
26
 
@@ -71,16 +71,15 @@ export function WalletsPage() {
71
71
  {list.map((wallet, index) => {
72
72
  const key = `wallet-${index}-${wallet.type}`;
73
73
  return (
74
- <Fragment key={key}>
75
- <Wallet
76
- {...wallet}
77
- container={getContainer()}
78
- onClick={(type) => {
79
- void handleClick(type);
80
- }}
81
- isLoading={fetchMetaStatus === 'loading'}
82
- />
83
- </Fragment>
74
+ <Wallet
75
+ key={key}
76
+ {...wallet}
77
+ container={getContainer()}
78
+ onClick={(type) => {
79
+ void handleClick(type);
80
+ }}
81
+ isLoading={fetchMetaStatus === 'loading'}
82
+ />
84
83
  );
85
84
  })}
86
85
  <WalletModal
package/src/utils/ui.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  /* eslint-disable @typescript-eslint/no-magic-numbers */
2
2
  import type { WidgetTheme } from '../types';
3
3
  import type { createTheme } from '@rango-dev/ui';
4
+ import type React from 'react';
4
5
 
5
6
  import {
6
7
  theme as baseThemeTokens,
@@ -70,3 +71,22 @@ export function customizedThemeTokens(
70
71
  dark,
71
72
  };
72
73
  }
74
+
75
+ export function joinList(
76
+ list: React.JSX.Element[],
77
+ divider: React.JSX.Element
78
+ ) {
79
+ if (list.length <= 1) {
80
+ return list;
81
+ }
82
+
83
+ const output: React.JSX.Element[] = [];
84
+ list.forEach((item, index) => {
85
+ output.push(item);
86
+ if (index < list.length - 1) {
87
+ output.push(divider);
88
+ }
89
+ });
90
+
91
+ return output;
92
+ }