@lifi/widget 3.26.1 → 3.27.0-beta.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.
- package/dist/esm/components/BaseTransactionButton/BaseTransactionButton.js +2 -1
- package/dist/esm/components/BaseTransactionButton/BaseTransactionButton.js.map +1 -1
- package/dist/esm/components/BottomSheet/BottomSheet.js +13 -5
- package/dist/esm/components/BottomSheet/BottomSheet.js.map +1 -1
- package/dist/esm/components/Header/CloseDrawerButton.js +2 -5
- package/dist/esm/components/Header/CloseDrawerButton.js.map +1 -1
- package/dist/esm/components/Header/Header.style.d.ts +1 -2
- package/dist/esm/components/Header/Header.style.js +3 -4
- package/dist/esm/components/Header/Header.style.js.map +1 -1
- package/dist/esm/components/Header/NavigationHeader.js +17 -21
- package/dist/esm/components/Header/NavigationHeader.js.map +1 -1
- package/dist/esm/components/Header/SplitNavigationTabs.d.ts +1 -0
- package/dist/esm/components/Header/{NavigationTabs.js → SplitNavigationTabs.js} +4 -5
- package/dist/esm/components/Header/SplitNavigationTabs.js.map +1 -0
- package/dist/esm/components/Header/WalletHeader.d.ts +0 -1
- package/dist/esm/components/Header/WalletHeader.js +10 -14
- package/dist/esm/components/Header/WalletHeader.js.map +1 -1
- package/dist/esm/components/Step/StepProcess.js +8 -3
- package/dist/esm/components/Step/StepProcess.js.map +1 -1
- package/dist/esm/components/Tabs/NavigationTabs.d.ts +4 -0
- package/dist/esm/components/Tabs/NavigationTabs.js +39 -0
- package/dist/esm/components/Tabs/NavigationTabs.js.map +1 -0
- package/dist/esm/components/TokenList/TokenListItem.js +1 -0
- package/dist/esm/components/TokenList/TokenListItem.js.map +1 -1
- package/dist/esm/components/TokenList/useTokenSelect.js +9 -2
- package/dist/esm/components/TokenList/useTokenSelect.js.map +1 -1
- package/dist/esm/config/version.d.ts +1 -1
- package/dist/esm/config/version.js +1 -1
- package/dist/esm/config/version.js.map +1 -1
- package/dist/esm/pages/MainPage/MainPage.js +10 -2
- package/dist/esm/pages/MainPage/MainPage.js.map +1 -1
- package/dist/esm/pages/SettingsPage/RoutePrioritySettings.js +1 -1
- package/dist/esm/pages/SettingsPage/RoutePrioritySettings.js.map +1 -1
- package/dist/esm/themes/azureLight.js +2 -3
- package/dist/esm/themes/azureLight.js.map +1 -1
- package/dist/esm/themes/createTheme.js +6 -0
- package/dist/esm/themes/createTheme.js.map +1 -1
- package/dist/esm/themes/types.d.ts +15 -1
- package/dist/esm/themes/watermelonLight.js +12 -0
- package/dist/esm/themes/watermelonLight.js.map +1 -1
- package/dist/esm/themes/windows95.js +11 -0
- package/dist/esm/themes/windows95.js.map +1 -1
- package/dist/esm/types/widget.d.ts +3 -2
- package/dist/esm/types/widget.js +1 -0
- package/dist/esm/types/widget.js.map +1 -1
- package/package.json +4 -4
- package/package.json.tmp +3 -3
- package/src/components/BaseTransactionButton/BaseTransactionButton.tsx +2 -1
- package/src/components/BottomSheet/BottomSheet.tsx +14 -3
- package/src/components/Header/CloseDrawerButton.tsx +2 -5
- package/src/components/Header/Header.style.ts +3 -5
- package/src/components/Header/NavigationHeader.tsx +66 -73
- package/src/components/Header/{NavigationTabs.tsx → SplitNavigationTabs.tsx} +10 -14
- package/src/components/Header/WalletHeader.tsx +13 -19
- package/src/components/Step/StepProcess.tsx +8 -3
- package/src/components/Tabs/NavigationTabs.tsx +40 -0
- package/src/components/TokenList/TokenListItem.tsx +1 -0
- package/src/components/TokenList/useTokenSelect.ts +14 -2
- package/src/config/version.ts +1 -1
- package/src/pages/MainPage/MainPage.tsx +11 -2
- package/src/pages/SettingsPage/RoutePrioritySettings.tsx +0 -1
- package/src/themes/azureLight.ts +2 -3
- package/src/themes/createTheme.ts +6 -0
- package/src/themes/types.ts +20 -0
- package/src/themes/watermelonLight.ts +12 -0
- package/src/themes/windows95.ts +12 -0
- package/src/types/widget.ts +3 -0
- package/dist/esm/components/Header/NavigationTabs.d.ts +0 -1
- package/dist/esm/components/Header/NavigationTabs.js.map +0 -1
|
@@ -13,13 +13,13 @@ import {
|
|
|
13
13
|
import { BackButton } from './BackButton.js'
|
|
14
14
|
import { CloseDrawerButton } from './CloseDrawerButton.js'
|
|
15
15
|
import { HeaderAppBar, HeaderControlsContainer } from './Header.style.js'
|
|
16
|
-
import { NavigationTabs } from './NavigationTabs.js'
|
|
17
16
|
import { SettingsButton } from './SettingsButton.js'
|
|
17
|
+
import { SplitNavigationTabs } from './SplitNavigationTabs.js'
|
|
18
18
|
import { TransactionHistoryButton } from './TransactionHistoryButton.js'
|
|
19
|
-
import { SplitWalletMenuButton } from './WalletHeader.js'
|
|
20
19
|
|
|
21
20
|
export const NavigationHeader: React.FC = () => {
|
|
22
|
-
const { subvariant, hiddenUI, variant, defaultUI } =
|
|
21
|
+
const { subvariant, hiddenUI, variant, defaultUI, subvariantOptions } =
|
|
22
|
+
useWidgetConfig()
|
|
23
23
|
const { navigateBack } = useNavigateBack()
|
|
24
24
|
const { account } = useAccount()
|
|
25
25
|
const { element, title } = useHeaderStore((state) => state)
|
|
@@ -31,77 +31,70 @@ export const NavigationHeader: React.FC = () => {
|
|
|
31
31
|
const path = cleanedPathname.substring(cleanedPathname.lastIndexOf('/') + 1)
|
|
32
32
|
const hasPath = navigationRoutesValues.includes(path)
|
|
33
33
|
|
|
34
|
-
const
|
|
34
|
+
const showSplitOptions =
|
|
35
|
+
subvariant === 'split' && !hasPath && !subvariantOptions?.split
|
|
35
36
|
|
|
36
37
|
return (
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
{
|
|
52
|
-
<
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
/>
|
|
99
|
-
)
|
|
100
|
-
}
|
|
101
|
-
/>
|
|
102
|
-
</Routes>
|
|
103
|
-
</HeaderAppBar>
|
|
104
|
-
{splitSubvariant ? <NavigationTabs /> : null}
|
|
105
|
-
</>
|
|
38
|
+
<HeaderAppBar elevation={0} sx={{ paddingTop: 1, paddingBottom: 0.5 }}>
|
|
39
|
+
{backButtonRoutes.includes(path) ? (
|
|
40
|
+
<BackButton
|
|
41
|
+
onClick={() =>
|
|
42
|
+
navigateBack(
|
|
43
|
+
// From transaction details page, navigate to home page
|
|
44
|
+
path === navigationRoutes.transactionDetails
|
|
45
|
+
? navigationRoutes.home
|
|
46
|
+
: undefined
|
|
47
|
+
)
|
|
48
|
+
}
|
|
49
|
+
/>
|
|
50
|
+
) : null}
|
|
51
|
+
{showSplitOptions ? (
|
|
52
|
+
<Box sx={{ flex: 1, marginRight: 1 }}>
|
|
53
|
+
<SplitNavigationTabs />
|
|
54
|
+
</Box>
|
|
55
|
+
) : (
|
|
56
|
+
<Typography
|
|
57
|
+
align={hasPath ? 'center' : 'left'}
|
|
58
|
+
noWrap={defaultUI?.navigationHeaderTitleNoWrap ?? true}
|
|
59
|
+
sx={{
|
|
60
|
+
fontSize: hasPath ? 18 : 24,
|
|
61
|
+
fontWeight: '700',
|
|
62
|
+
flex: 1,
|
|
63
|
+
}}
|
|
64
|
+
>
|
|
65
|
+
{title}
|
|
66
|
+
</Typography>
|
|
67
|
+
)}
|
|
68
|
+
<Routes>
|
|
69
|
+
<Route
|
|
70
|
+
path={navigationRoutes.home}
|
|
71
|
+
element={
|
|
72
|
+
<HeaderControlsContainer>
|
|
73
|
+
{account.isConnected && !hiddenUI?.includes(HiddenUI.History) && (
|
|
74
|
+
<TransactionHistoryButton />
|
|
75
|
+
)}
|
|
76
|
+
<SettingsButton />
|
|
77
|
+
{variant === 'drawer' &&
|
|
78
|
+
!hiddenUI?.includes(HiddenUI.DrawerCloseButton) ? (
|
|
79
|
+
<CloseDrawerButton header="navigation" />
|
|
80
|
+
) : null}
|
|
81
|
+
</HeaderControlsContainer>
|
|
82
|
+
}
|
|
83
|
+
/>
|
|
84
|
+
<Route
|
|
85
|
+
path="*"
|
|
86
|
+
element={
|
|
87
|
+
element || (
|
|
88
|
+
<Box
|
|
89
|
+
sx={{
|
|
90
|
+
width: 28,
|
|
91
|
+
height: 40,
|
|
92
|
+
}}
|
|
93
|
+
/>
|
|
94
|
+
)
|
|
95
|
+
}
|
|
96
|
+
/>
|
|
97
|
+
</Routes>
|
|
98
|
+
</HeaderAppBar>
|
|
106
99
|
)
|
|
107
100
|
}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { useTranslation } from 'react-i18next'
|
|
2
2
|
import { useFieldActions } from '../../stores/form/useFieldActions.js'
|
|
3
3
|
import { useSplitSubvariantStore } from '../../stores/settings/useSplitSubvariantStore.js'
|
|
4
|
-
import {
|
|
5
|
-
import { HeaderAppBar } from './Header.style.js'
|
|
4
|
+
import { NavigationTab, NavigationTabs } from '../Tabs/NavigationTabs.js'
|
|
6
5
|
|
|
7
|
-
export const
|
|
6
|
+
export const SplitNavigationTabs = () => {
|
|
8
7
|
const { t } = useTranslation()
|
|
9
8
|
const [state, setState] = useSplitSubvariantStore((state) => [
|
|
10
9
|
state.state,
|
|
@@ -20,16 +19,13 @@ export const NavigationTabs = () => {
|
|
|
20
19
|
}
|
|
21
20
|
|
|
22
21
|
return (
|
|
23
|
-
<
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
<Tab label={t('header.bridge')} disableRipple />
|
|
32
|
-
</Tabs>
|
|
33
|
-
</HeaderAppBar>
|
|
22
|
+
<NavigationTabs
|
|
23
|
+
value={state === 'swap' ? 0 : 1}
|
|
24
|
+
onChange={handleChange}
|
|
25
|
+
aria-label="tabs"
|
|
26
|
+
>
|
|
27
|
+
<NavigationTab label={t('header.swap')} disableRipple />
|
|
28
|
+
<NavigationTab label={t('header.bridge')} disableRipple />
|
|
29
|
+
</NavigationTabs>
|
|
34
30
|
)
|
|
35
31
|
}
|
|
@@ -27,10 +27,9 @@ import { WalletMenu } from './WalletMenu.js'
|
|
|
27
27
|
import { WalletMenuContainer } from './WalletMenu.style.js'
|
|
28
28
|
|
|
29
29
|
const useInternalWalletManagement = () => {
|
|
30
|
-
const {
|
|
30
|
+
const { hiddenUI } = useWidgetConfig()
|
|
31
31
|
const { useExternalWalletProvidersOnly } = useExternalWalletProvider()
|
|
32
32
|
|
|
33
|
-
const isSplitVariant = subvariant === 'split'
|
|
34
33
|
const isWalletMenuHidden = hiddenUI?.includes(HiddenUI.WalletMenu)
|
|
35
34
|
|
|
36
35
|
const shouldShowWalletMenu =
|
|
@@ -38,25 +37,19 @@ const useInternalWalletManagement = () => {
|
|
|
38
37
|
|
|
39
38
|
return {
|
|
40
39
|
shouldShowWalletMenu,
|
|
41
|
-
isSplitVariant,
|
|
42
40
|
}
|
|
43
41
|
}
|
|
44
42
|
|
|
45
43
|
export const WalletHeader: React.FC = () => {
|
|
46
|
-
const { shouldShowWalletMenu
|
|
44
|
+
const { shouldShowWalletMenu } = useInternalWalletManagement()
|
|
47
45
|
|
|
48
|
-
return shouldShowWalletMenu
|
|
46
|
+
return shouldShowWalletMenu ? (
|
|
49
47
|
<HeaderAppBar elevation={0} sx={{ justifyContent: 'flex-end' }}>
|
|
50
48
|
<WalletMenuButton />
|
|
51
49
|
</HeaderAppBar>
|
|
52
50
|
) : null
|
|
53
51
|
}
|
|
54
52
|
|
|
55
|
-
export const SplitWalletMenuButton: React.FC = () => {
|
|
56
|
-
const { shouldShowWalletMenu, isSplitVariant } = useInternalWalletManagement()
|
|
57
|
-
return shouldShowWalletMenu && isSplitVariant ? <WalletMenuButton /> : null
|
|
58
|
-
}
|
|
59
|
-
|
|
60
53
|
export const WalletMenuButton: React.FC = () => {
|
|
61
54
|
const { variant, hiddenUI } = useWidgetConfig()
|
|
62
55
|
const { account, accounts } = useAccount()
|
|
@@ -92,24 +85,25 @@ export const WalletMenuButton: React.FC = () => {
|
|
|
92
85
|
|
|
93
86
|
const ConnectButton = () => {
|
|
94
87
|
const { t } = useTranslation()
|
|
95
|
-
const { walletConfig,
|
|
88
|
+
const { walletConfig, variant } = useWidgetConfig()
|
|
96
89
|
const { openWalletMenu } = useWalletMenu()
|
|
97
|
-
const connect = async () => {
|
|
90
|
+
const connect = async (event: React.MouseEvent<HTMLElement>) => {
|
|
98
91
|
if (!walletConfig?.usePartialWalletManagement && walletConfig?.onConnect) {
|
|
99
92
|
walletConfig.onConnect()
|
|
100
93
|
return
|
|
101
94
|
}
|
|
102
95
|
openWalletMenu()
|
|
96
|
+
event.currentTarget.blur() // Remove focus to prevent accessibility issues when opening drawer
|
|
103
97
|
}
|
|
104
98
|
|
|
99
|
+
const walletPosition = variant === 'drawer' ? 'start' : 'end'
|
|
100
|
+
|
|
105
101
|
return (
|
|
106
102
|
<WalletButton
|
|
107
|
-
|
|
108
|
-
endIcon={
|
|
109
|
-
variant !== 'drawer' && subvariant !== 'split' ? <Wallet /> : undefined
|
|
110
|
-
}
|
|
103
|
+
withOffset={walletPosition === 'end'}
|
|
104
|
+
endIcon={walletPosition === 'end' ? <Wallet /> : undefined}
|
|
111
105
|
startIcon={
|
|
112
|
-
|
|
106
|
+
walletPosition === 'start' ? (
|
|
113
107
|
<Wallet sx={{ marginLeft: -0.25 }} />
|
|
114
108
|
) : undefined
|
|
115
109
|
}
|
|
@@ -121,13 +115,13 @@ const ConnectButton = () => {
|
|
|
121
115
|
}
|
|
122
116
|
|
|
123
117
|
const ConnectedButton = ({ account }: { account: Account }) => {
|
|
124
|
-
const { subvariant } = useWidgetConfig()
|
|
125
118
|
const { chain } = useChain(account.chainId)
|
|
126
119
|
const [anchorEl, setAnchorEl] = useState<HTMLElement | null>(null)
|
|
127
120
|
const walletAddress = shortenAddress(account.address)
|
|
128
121
|
|
|
129
122
|
const handleClick = (event: React.MouseEvent<HTMLElement>) => {
|
|
130
123
|
setAnchorEl(event.currentTarget)
|
|
124
|
+
event.currentTarget.blur() // Remove focus to prevent accessibility issues when opening drawer
|
|
131
125
|
}
|
|
132
126
|
|
|
133
127
|
const handleClose = () => {
|
|
@@ -137,7 +131,7 @@ const ConnectedButton = ({ account }: { account: Account }) => {
|
|
|
137
131
|
return (
|
|
138
132
|
<>
|
|
139
133
|
<WalletButton
|
|
140
|
-
|
|
134
|
+
withOffset
|
|
141
135
|
endIcon={<ExpandMore />}
|
|
142
136
|
startIcon={
|
|
143
137
|
chain?.logoURI ? (
|
|
@@ -13,12 +13,17 @@ export const StepProcess: React.FC<{
|
|
|
13
13
|
const { title, message } = useProcessMessage(step, process)
|
|
14
14
|
const { getTransactionLink } = useExplorer()
|
|
15
15
|
|
|
16
|
-
const transactionLink = process.
|
|
16
|
+
const transactionLink = process.txHash
|
|
17
17
|
? getTransactionLink({
|
|
18
|
-
|
|
18
|
+
txHash: process.txHash,
|
|
19
19
|
chain: process.chainId,
|
|
20
20
|
})
|
|
21
|
-
:
|
|
21
|
+
: process.txLink
|
|
22
|
+
? getTransactionLink({
|
|
23
|
+
txLink: process.txLink,
|
|
24
|
+
chain: process.chainId,
|
|
25
|
+
})
|
|
26
|
+
: undefined
|
|
22
27
|
|
|
23
28
|
return (
|
|
24
29
|
<Box
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { styled, Tabs, tabsClasses } from '@mui/material'
|
|
2
|
+
import { Tab } from './Tabs.style.js'
|
|
3
|
+
|
|
4
|
+
export const NavigationTabs = styled(Tabs, {
|
|
5
|
+
name: 'MuiNavigationTabs',
|
|
6
|
+
slot: 'root',
|
|
7
|
+
})(({ theme }) => ({
|
|
8
|
+
overflow: 'visible', // Prevent shadows from being cut off
|
|
9
|
+
width: 'fit-content',
|
|
10
|
+
minHeight: theme.spacing(5),
|
|
11
|
+
maxHeight: theme.spacing(5),
|
|
12
|
+
background: 'transparent',
|
|
13
|
+
...theme.applyStyles('dark', {
|
|
14
|
+
backgroundColor: 'transparent',
|
|
15
|
+
}),
|
|
16
|
+
[`& .${tabsClasses.scroller}`]: {
|
|
17
|
+
padding: 0,
|
|
18
|
+
overflow: 'visible !important', // Enforce since overflow is set dynamically
|
|
19
|
+
},
|
|
20
|
+
[`& .${tabsClasses.indicator}`]: {
|
|
21
|
+
boxShadow: 'none',
|
|
22
|
+
top: 0,
|
|
23
|
+
left: 0,
|
|
24
|
+
height: '100%',
|
|
25
|
+
width: '100%',
|
|
26
|
+
borderRadius: theme.vars.shape.borderRadius,
|
|
27
|
+
backgroundColor: `rgba(${theme.vars.palette.common.onBackgroundChannel} / 0.04)`,
|
|
28
|
+
...theme.applyStyles('dark', {
|
|
29
|
+
backgroundColor: `rgba(${theme.vars.palette.common.onBackgroundChannel} / 0.08)`,
|
|
30
|
+
}),
|
|
31
|
+
},
|
|
32
|
+
}))
|
|
33
|
+
|
|
34
|
+
export const NavigationTab = styled(Tab, {
|
|
35
|
+
name: 'MuiNavigationTab',
|
|
36
|
+
slot: 'root',
|
|
37
|
+
})(({ theme }) => ({
|
|
38
|
+
minHeight: theme.spacing(5),
|
|
39
|
+
maxHeight: theme.spacing(5),
|
|
40
|
+
}))
|
|
@@ -102,6 +102,7 @@ const OpenTokenDetailsButton = ({
|
|
|
102
102
|
size="small"
|
|
103
103
|
onClick={(e) => {
|
|
104
104
|
e.stopPropagation()
|
|
105
|
+
e.currentTarget.blur() // Remove focus to prevent accessibility issues when opening drawer
|
|
105
106
|
onClick(tokenAddress, withoutContractAddress)
|
|
106
107
|
}}
|
|
107
108
|
>
|
|
@@ -6,6 +6,7 @@ import { useChainOrderStoreContext } from '../../stores/chains/ChainOrderStore.j
|
|
|
6
6
|
import type { FormType } from '../../stores/form/types.js'
|
|
7
7
|
import { FormKeyHelper } from '../../stores/form/types.js'
|
|
8
8
|
import { useFieldActions } from '../../stores/form/useFieldActions.js'
|
|
9
|
+
import { useSplitSubvariantStore } from '../../stores/settings/useSplitSubvariantStore.js'
|
|
9
10
|
import { WidgetEvent } from '../../types/events.js'
|
|
10
11
|
import type { DisabledUI } from '../../types/widget.js'
|
|
11
12
|
|
|
@@ -16,6 +17,7 @@ export type UseTokenSelectArgs = {
|
|
|
16
17
|
|
|
17
18
|
export const useTokenSelect = (formType: FormType, onClick?: () => void) => {
|
|
18
19
|
const { subvariant, disabledUI } = useWidgetConfig()
|
|
20
|
+
const splitSubvariant = useSplitSubvariantStore((store) => store.state)
|
|
19
21
|
const emitter = useWidgetEvents()
|
|
20
22
|
const { setFieldValue, getFieldValues } = useFieldActions()
|
|
21
23
|
const autoPopulateToAddress = useToAddressAutoPopulate()
|
|
@@ -47,10 +49,19 @@ export const useTokenSelect = (formType: FormType, onClick?: () => void) => {
|
|
|
47
49
|
FormKeyHelper.getChainKey(oppositeFormType),
|
|
48
50
|
'toAddress'
|
|
49
51
|
)
|
|
52
|
+
|
|
50
53
|
// TODO: remove when we enable same chain/token transfers
|
|
51
|
-
|
|
54
|
+
const isSameTokenTransfer =
|
|
52
55
|
selectedOppositeTokenAddress === tokenAddress &&
|
|
53
|
-
selectedOppositeChainId === selectedChainId
|
|
56
|
+
selectedOppositeChainId === selectedChainId
|
|
57
|
+
|
|
58
|
+
const isBridgeToSameChain =
|
|
59
|
+
subvariant === 'split' &&
|
|
60
|
+
splitSubvariant === 'bridge' &&
|
|
61
|
+
selectedOppositeChainId === selectedChainId
|
|
62
|
+
|
|
63
|
+
if (
|
|
64
|
+
(isSameTokenTransfer || isBridgeToSameChain) &&
|
|
54
65
|
subvariant !== 'custom'
|
|
55
66
|
) {
|
|
56
67
|
setFieldValue(FormKeyHelper.getTokenKey(oppositeFormType), '', {
|
|
@@ -106,6 +117,7 @@ export const useTokenSelect = (formType: FormType, onClick?: () => void) => {
|
|
|
106
117
|
onClick,
|
|
107
118
|
setFieldValue,
|
|
108
119
|
subvariant,
|
|
120
|
+
splitSubvariant,
|
|
109
121
|
tokenKey,
|
|
110
122
|
]
|
|
111
123
|
)
|
package/src/config/version.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export const name = '@lifi/widget'
|
|
2
|
-
export const version = '3.
|
|
2
|
+
export const version = '3.27.0-beta.0'
|
|
@@ -24,13 +24,22 @@ export const MainPage: React.FC = () => {
|
|
|
24
24
|
useWidgetConfig()
|
|
25
25
|
const custom = subvariant === 'custom'
|
|
26
26
|
const showPoweredBy = !hiddenUI?.includes(HiddenUI.PoweredBy)
|
|
27
|
+
const showGasRefuelMessage = !hiddenUI?.includes(HiddenUI.GasRefuelMessage)
|
|
27
28
|
|
|
29
|
+
const splitTitle =
|
|
30
|
+
subvariantOptions?.split === 'bridge'
|
|
31
|
+
? t('header.bridge')
|
|
32
|
+
: subvariantOptions?.split === 'swap'
|
|
33
|
+
? t('header.swap')
|
|
34
|
+
: undefined
|
|
28
35
|
const title =
|
|
29
36
|
subvariant === 'custom'
|
|
30
37
|
? t(`header.${subvariantOptions?.custom ?? 'checkout'}`)
|
|
31
38
|
: subvariant === 'refuel'
|
|
32
39
|
? t('header.gas')
|
|
33
|
-
:
|
|
40
|
+
: subvariant === 'split' && splitTitle
|
|
41
|
+
? splitTitle
|
|
42
|
+
: t('header.exchange')
|
|
34
43
|
|
|
35
44
|
useHeader(title)
|
|
36
45
|
|
|
@@ -48,7 +57,7 @@ export const MainPage: React.FC = () => {
|
|
|
48
57
|
) : null}
|
|
49
58
|
{!wideVariant ? <Routes sx={marginSx} /> : null}
|
|
50
59
|
<SendToWalletButton sx={marginSx} />
|
|
51
|
-
<GasRefuelMessage mb={2} />
|
|
60
|
+
{showGasRefuelMessage ? <GasRefuelMessage mb={2} /> : null}
|
|
52
61
|
<MainWarningMessages mb={2} />
|
|
53
62
|
<Box
|
|
54
63
|
sx={{
|
package/src/themes/azureLight.ts
CHANGED
|
@@ -48,12 +48,11 @@ export const azureLightTheme: WidgetTheme = {
|
|
|
48
48
|
defaultProps: { variant: 'filled' },
|
|
49
49
|
},
|
|
50
50
|
// Used only for 'split' subvariant and can be safely removed if not used
|
|
51
|
-
|
|
51
|
+
MuiNavigationTabs: {
|
|
52
52
|
styleOverrides: {
|
|
53
53
|
root: {
|
|
54
|
-
backgroundColor: '#f8f8fa',
|
|
55
54
|
[`.${tabsClasses.indicator}`]: {
|
|
56
|
-
backgroundColor: '#
|
|
55
|
+
backgroundColor: '#f8f8fa',
|
|
57
56
|
},
|
|
58
57
|
},
|
|
59
58
|
},
|
|
@@ -469,6 +469,12 @@ export const createTheme = (widgetTheme: WidgetTheme = {}) => {
|
|
|
469
469
|
},
|
|
470
470
|
},
|
|
471
471
|
},
|
|
472
|
+
MuiNavigationTabs: {
|
|
473
|
+
...widgetTheme.components?.MuiNavigationTabs,
|
|
474
|
+
},
|
|
475
|
+
MuiNavigationTab: {
|
|
476
|
+
...widgetTheme.components?.MuiNavigationTab,
|
|
477
|
+
},
|
|
472
478
|
},
|
|
473
479
|
})
|
|
474
480
|
|
package/src/themes/types.ts
CHANGED
|
@@ -3,6 +3,8 @@ import type {
|
|
|
3
3
|
ComponentsOverrides,
|
|
4
4
|
ComponentsVariants,
|
|
5
5
|
SimplePaletteColorOptions,
|
|
6
|
+
TabProps,
|
|
7
|
+
TabsProps,
|
|
6
8
|
} from '@mui/material'
|
|
7
9
|
import type {} from '@mui/material/themeCssVarsAugmentation'
|
|
8
10
|
import type { CSSProperties } from 'react'
|
|
@@ -42,9 +44,13 @@ declare module '@mui/material/styles' {
|
|
|
42
44
|
}
|
|
43
45
|
interface ComponentNameToClassKey {
|
|
44
46
|
MuiInputCard: 'root'
|
|
47
|
+
MuiNavigationTabs: 'root'
|
|
48
|
+
MuiNavigationTab: 'root'
|
|
45
49
|
}
|
|
46
50
|
interface ComponentsPropsList {
|
|
47
51
|
MuiInputCard: Partial<CardProps>
|
|
52
|
+
MuiNavigationTabs: Partial<TabsProps>
|
|
53
|
+
MuiNavigationTab: Partial<TabProps>
|
|
48
54
|
}
|
|
49
55
|
interface Components {
|
|
50
56
|
MuiInputCard?: {
|
|
@@ -54,6 +60,20 @@ declare module '@mui/material/styles' {
|
|
|
54
60
|
>['MuiInputCard']
|
|
55
61
|
variants?: ComponentsVariants['MuiInputCard']
|
|
56
62
|
}
|
|
63
|
+
MuiNavigationTabs?: {
|
|
64
|
+
defaultProps?: ComponentsPropsList['MuiNavigationTabs']
|
|
65
|
+
styleOverrides?: ComponentsOverrides<
|
|
66
|
+
Omit<Theme, 'components'>
|
|
67
|
+
>['MuiNavigationTabs']
|
|
68
|
+
variants?: ComponentsVariants['MuiNavigationTabs']
|
|
69
|
+
}
|
|
70
|
+
MuiNavigationTab?: {
|
|
71
|
+
defaultProps?: ComponentsPropsList['MuiNavigationTab']
|
|
72
|
+
styleOverrides?: ComponentsOverrides<
|
|
73
|
+
Omit<Theme, 'components'>
|
|
74
|
+
>['MuiNavigationTab']
|
|
75
|
+
variants?: ComponentsVariants['MuiNavigationTab']
|
|
76
|
+
}
|
|
57
77
|
}
|
|
58
78
|
interface Palette {
|
|
59
79
|
playground: Palette['primary']
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { tabsClasses } from '@mui/material'
|
|
1
2
|
import type { WidgetTheme } from '../types/widget.js'
|
|
2
3
|
|
|
3
4
|
export const watermelonLightTheme: WidgetTheme = {
|
|
@@ -46,6 +47,17 @@ export const watermelonLightTheme: WidgetTheme = {
|
|
|
46
47
|
MuiCard: {
|
|
47
48
|
defaultProps: { variant: 'elevation' },
|
|
48
49
|
},
|
|
50
|
+
MuiNavigationTabs: {
|
|
51
|
+
styleOverrides: {
|
|
52
|
+
root: ({ theme }) => ({
|
|
53
|
+
[`.${tabsClasses.indicator}`]: {
|
|
54
|
+
backgroundColor: '#ffffff',
|
|
55
|
+
filter: `drop-shadow(0 1px 4px rgba(${theme.vars.palette.common.onBackgroundChannel} / 0.08))`,
|
|
56
|
+
borderRadius: '16px',
|
|
57
|
+
},
|
|
58
|
+
}),
|
|
59
|
+
},
|
|
60
|
+
},
|
|
49
61
|
// MuiIconButton: {
|
|
50
62
|
// styleOverrides: {
|
|
51
63
|
// root: ({ theme }) => ({
|
package/src/themes/windows95.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { tabsClasses } from '@mui/material'
|
|
1
2
|
import type { WidgetTheme } from '../types/widget.js'
|
|
2
3
|
|
|
3
4
|
export const windows95Theme: WidgetTheme = {
|
|
@@ -84,6 +85,17 @@ export const windows95Theme: WidgetTheme = {
|
|
|
84
85
|
},
|
|
85
86
|
},
|
|
86
87
|
},
|
|
88
|
+
MuiNavigationTabs: {
|
|
89
|
+
styleOverrides: {
|
|
90
|
+
root: {
|
|
91
|
+
[`.${tabsClasses.indicator}`]: {
|
|
92
|
+
backgroundColor: '#dfdfdf',
|
|
93
|
+
boxShadow:
|
|
94
|
+
'inset -1px -1px #0a0a0a, inset 1px 1px #ffffff, inset -2px -2px #808080, inset 2px 2px #dfdfdf',
|
|
95
|
+
},
|
|
96
|
+
},
|
|
97
|
+
},
|
|
98
|
+
},
|
|
87
99
|
MuiIconButton: {
|
|
88
100
|
defaultProps: {
|
|
89
101
|
// disableRipple: true,
|
package/src/types/widget.ts
CHANGED
|
@@ -62,6 +62,8 @@ export type WidgetThemeComponents = Partial<
|
|
|
62
62
|
| 'MuiCard'
|
|
63
63
|
| 'MuiIconButton'
|
|
64
64
|
| 'MuiInputCard'
|
|
65
|
+
| 'MuiNavigationTabs'
|
|
66
|
+
| 'MuiNavigationTab'
|
|
65
67
|
| 'MuiTabs'
|
|
66
68
|
>
|
|
67
69
|
>
|
|
@@ -113,6 +115,7 @@ export enum HiddenUI {
|
|
|
113
115
|
BridgesSettings = 'bridgesSettings',
|
|
114
116
|
AddressBookConnectedWallets = 'addressBookConnectedWallets',
|
|
115
117
|
LowAddressActivityConfirmation = 'lowAddressActivityConfirmation',
|
|
118
|
+
GasRefuelMessage = 'gasRefuelMessage',
|
|
116
119
|
}
|
|
117
120
|
export type HiddenUIType = `${HiddenUI}`
|
|
118
121
|
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const NavigationTabs: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"NavigationTabs.js","sourceRoot":"","sources":["../../../../src/components/Header/NavigationTabs.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,EAAE,eAAe,EAAE,MAAM,sCAAsC,CAAA;AACtE,OAAO,EAAE,uBAAuB,EAAE,MAAM,kDAAkD,CAAA;AAC1F,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAA;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAEhD,MAAM,CAAC,MAAM,cAAc,GAAG,GAAG,EAAE;IACjC,MAAM,EAAE,CAAC,EAAE,GAAG,cAAc,EAAE,CAAA;IAC9B,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,uBAAuB,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC;QAC3D,KAAK,CAAC,KAAK;QACX,KAAK,CAAC,QAAQ;KACf,CAAC,CAAA;IAEF,MAAM,EAAE,aAAa,EAAE,GAAG,eAAe,EAAE,CAAA;IAC3C,MAAM,YAAY,GAAG,CAAC,CAAuB,EAAE,KAAa,EAAE,EAAE;QAC9D,aAAa,CAAC,YAAY,EAAE,EAAE,CAAC,CAAA;QAC/B,aAAa,CAAC,WAAW,EAAE,EAAE,CAAC,CAAA;QAC9B,aAAa,CAAC,SAAS,EAAE,EAAE,CAAC,CAAA;QAC5B,QAAQ,CAAC,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAA;IAC3C,CAAC,CAAA;IAED,OAAO,CACL,KAAC,YAAY,IAAC,SAAS,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,UAAU,EAAE,CAAC,EAAE,aAAa,EAAE,GAAG,EAAE,YACnE,MAAC,IAAI,IACH,KAAK,EAAE,KAAK,KAAK,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAC/B,QAAQ,EAAE,YAAY,gBACX,MAAM,EACjB,cAAc,EAAC,SAAS,aAExB,KAAC,GAAG,IAAC,KAAK,EAAE,CAAC,CAAC,aAAa,CAAC,EAAE,aAAa,SAAG,EAC9C,KAAC,GAAG,IAAC,KAAK,EAAE,CAAC,CAAC,eAAe,CAAC,EAAE,aAAa,SAAG,IAC3C,GACM,CAChB,CAAA;AACH,CAAC,CAAA"}
|