@aurora-is-near/intents-swap-widget 3.19.1 → 3.21.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/components/BaseContainer.d.ts +2 -0
- package/dist/components/BaseContainer.js +23 -0
- package/dist/components/BaseContainer.js.map +1 -0
- package/dist/components/WidgetContainer.js +17 -18
- package/dist/components/WidgetContainer.js.map +1 -1
- package/dist/{config-CpXS2LPZ.js → config-CyBNYvb1.js} +833 -820
- package/dist/{config-CpXS2LPZ.js.map → config-CyBNYvb1.js.map} +1 -1
- package/dist/config.js +1 -1
- package/dist/errors.js +1 -1
- package/dist/ext/alchemy/index.js +1 -1
- package/dist/ext/index.js +1 -1
- package/dist/features/BalanceRpcLoader/TokenBalanceLoader.js +1 -1
- package/dist/features/BalanceRpcLoader/index.js +1 -1
- package/dist/features/BalanceRpcLoader/useTokenBalanceRpc.js +1 -1
- package/dist/features/ChainsDropdown/index.js +1 -1
- package/dist/features/ChainsSelector/index.js +1 -1
- package/dist/features/DepositMethodSwitcher.js +1 -1
- package/dist/features/ErrorBoundary.js +1 -1
- package/dist/features/ExternalDeposit.js +1 -1
- package/dist/features/SendAddress/index.js +1 -1
- package/dist/features/SendAddress/useNotification.js +1 -1
- package/dist/features/SubmitButton/index.js +1 -1
- package/dist/features/SuccessScreen/index.js +1 -1
- package/dist/features/SuccessScreen/useSummaryItemsCount.js +1 -1
- package/dist/features/SwapDirectionSwitcher.js +1 -1
- package/dist/features/SwapQuote/SwapQuote.js +1 -1
- package/dist/features/SwapQuote/index.js +1 -1
- package/dist/features/TokenInput/TokenInput.js +1 -1
- package/dist/features/TokenInput/TokenInputEmpty.js +1 -1
- package/dist/features/TokenInput/TokenInputSource.js +1 -1
- package/dist/features/TokenInput/TokenInputTarget.js +1 -1
- package/dist/features/TokenInput/WalletBalance.js +1 -1
- package/dist/features/TokenInput/hooks/index.js +1 -1
- package/dist/features/TokenInput/hooks/useTokenInputBalance.js +1 -1
- package/dist/features/TokenInput/index.js +1 -1
- package/dist/features/TokensList/TokenItem.js +1 -1
- package/dist/features/TokensList/TokensList.js +1 -1
- package/dist/features/TokensList/index.js +1 -1
- package/dist/features/TokensModal.js +1 -1
- package/dist/features/WalletCompatibilityCheck/WalletCompatibilityModal.js +1 -1
- package/dist/features/WalletCompatibilityCheck/index.js +1 -1
- package/dist/features/index.js +1 -1
- package/dist/hooks/index.js +1 -1
- package/dist/hooks/useAllTokens.js +1 -1
- package/dist/hooks/useChains.js +1 -1
- package/dist/hooks/useCompatibilityCheck.js +1 -1
- package/dist/hooks/useDefaultToken.js +1 -1
- package/dist/hooks/useExternalDepositStatus/index.js +1 -1
- package/dist/hooks/useExternalDepositStatus/usePoaExternalDepositStatus.js +1 -1
- package/dist/hooks/useIntentsBalance.js +1 -1
- package/dist/hooks/useIsCompatibilityCheckRequired.js +1 -1
- package/dist/hooks/useMakeDepositAddress.js +1 -1
- package/dist/hooks/useMakeIntentsTransfer.js +1 -1
- package/dist/hooks/useMakeNEARFtTransferCall.js +1 -1
- package/dist/hooks/useMakeQuote.js +1 -1
- package/dist/hooks/useMakeQuoteTransfer.js +1 -1
- package/dist/hooks/useMakeTransfer.js +1 -1
- package/dist/hooks/useMergedBalance.js +1 -1
- package/dist/hooks/useSwitchChain.js +1 -1
- package/dist/hooks/useTheme.js +1 -1
- package/dist/hooks/useTokenInputPair.js +1 -1
- package/dist/hooks/useTokens.js +1 -1
- package/dist/hooks/useTokensFiltered.js +1 -1
- package/dist/hooks/useTokensIntentsUnique.js +1 -1
- package/dist/index.js +1 -1
- package/dist/machine/effects/index.js +1 -1
- package/dist/machine/effects/useAlchemyBalanceEffect.js +1 -1
- package/dist/machine/effects/useBalancesUpdateEffect.js +1 -1
- package/dist/machine/effects/useMakeQuoteEffect.js +1 -1
- package/dist/machine/effects/useSelectedTokensEffect.js +1 -1
- package/dist/machine/effects/useSetTokenBalanceEffect.js +1 -1
- package/dist/machine/effects/useSetTokenIntentsTargetEffect.js +1 -1
- package/dist/machine/effects/useWalletConnEffect.js +1 -1
- package/dist/machine/events/index.js +1 -1
- package/dist/machine/events/tokenSelect.js +1 -1
- package/dist/machine/events/validateInputAndMoveTo.js +1 -1
- package/dist/machine/events/validateInputs.js +1 -1
- package/dist/machine/index.js +1 -1
- package/dist/machine/snap.js +1 -1
- package/dist/machine/subscriptions/checkers/isSendAddressAsConnected.js +1 -1
- package/dist/machine/subscriptions/index.js +1 -1
- package/dist/styles.css +1 -1
- package/dist/tailwind.css +3 -1
- package/dist/theme/ThemeProvider.js +1 -1
- package/dist/theme.css +10 -5
- package/dist/types/theme.d.ts +6 -0
- package/dist/utils/intents/signers/near.js +1 -1
- package/dist/utils/intents/signers/privy.js +1 -1
- package/dist/utils/near/getNearNep141StorageBalance.js +1 -1
- package/dist/widgets/WidgetDeposit/WidgetDepositContent.js +1 -1
- package/dist/widgets/WidgetDeposit/WidgetDepositSkeleton.js +1 -1
- package/dist/widgets/WidgetDeposit/index.js +15 -14
- package/dist/widgets/WidgetDeposit/index.js.map +1 -1
- package/dist/widgets/WidgetSwap/WidgetSwapContent.js +1 -1
- package/dist/widgets/WidgetSwap/WidgetSwapSkeleton.js +1 -1
- package/dist/widgets/WidgetSwap/index.js +15 -14
- package/dist/widgets/WidgetSwap/index.js.map +1 -1
- package/dist/widgets/WidgetWithdraw/WidgetWithdrawContent.js +1 -1
- package/dist/widgets/WidgetWithdraw/WidgetWithdrawSkeleton.js +1 -1
- package/dist/widgets/WidgetWithdraw/index.js +13 -12
- package/dist/widgets/WidgetWithdraw/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/BaseContainer.tsx +19 -0
- package/src/components/WidgetContainer.tsx +0 -1
- package/src/tailwind.css +3 -1
- package/src/theme/ThemeProvider.tsx +52 -8
- package/src/theme.css +10 -5
- package/src/types/theme.ts +8 -0
- package/src/widgets/WidgetDeposit/index.tsx +10 -7
- package/src/widgets/WidgetSwap/index.tsx +10 -7
- package/src/widgets/WidgetWithdraw/index.tsx +10 -7
|
@@ -1,21 +1,31 @@
|
|
|
1
1
|
import { createContext, type ReactNode, useEffect, useMemo } from 'react';
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
ColorPalette,
|
|
5
|
+
ColorScheme,
|
|
6
|
+
HexColor,
|
|
7
|
+
Theme,
|
|
8
|
+
ThemeBorderRadius,
|
|
9
|
+
} from '../types/theme';
|
|
4
10
|
import { ColorStop, createColorPalette } from './createColorPalette';
|
|
5
11
|
import { useConfig } from '@/config';
|
|
6
12
|
|
|
7
|
-
const
|
|
8
|
-
key: string,
|
|
9
|
-
value: string,
|
|
10
|
-
parentEl: Element | null,
|
|
11
|
-
) => {
|
|
13
|
+
const setVariable = (key: string, value: string, parentEl: Element | null) => {
|
|
12
14
|
let parentElement = document.body;
|
|
13
15
|
|
|
14
16
|
if (parentEl instanceof HTMLElement) {
|
|
15
17
|
parentElement = parentEl;
|
|
16
18
|
}
|
|
17
19
|
|
|
18
|
-
parentElement.style.setProperty(
|
|
20
|
+
parentElement.style.setProperty(key, value);
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
const setColorVariable = (
|
|
24
|
+
key: string,
|
|
25
|
+
value: string,
|
|
26
|
+
parentEl: Element | null,
|
|
27
|
+
) => {
|
|
28
|
+
setVariable(`--c-sw-${key}`, value, parentEl);
|
|
19
29
|
};
|
|
20
30
|
|
|
21
31
|
const setColorVariables = (
|
|
@@ -44,24 +54,54 @@ const setColorPalette = (
|
|
|
44
54
|
setColorVariables(palette, colorKey, parentEl);
|
|
45
55
|
};
|
|
46
56
|
|
|
57
|
+
const setBorderRadiusVariables = (
|
|
58
|
+
borderRadius: ThemeBorderRadius,
|
|
59
|
+
parentEl: Element | null,
|
|
60
|
+
) => {
|
|
61
|
+
const values: Record<
|
|
62
|
+
'none' | 'sm' | 'md' | 'lg',
|
|
63
|
+
{ sm: number; md: number; lg: number }
|
|
64
|
+
> = {
|
|
65
|
+
none: { sm: 0, md: 0, lg: 0 },
|
|
66
|
+
sm: { sm: 4, md: 6, lg: 10 },
|
|
67
|
+
md: { sm: 6, md: 10, lg: 16 },
|
|
68
|
+
lg: { sm: 8, md: 24, lg: 24 },
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
setVariable('--r-sw-sm', `${values[borderRadius].sm}px`, parentEl);
|
|
72
|
+
setVariable('--r-sw-md', `${values[borderRadius].md}px`, parentEl);
|
|
73
|
+
setVariable('--r-sw-lg', `${values[borderRadius].lg}px`, parentEl);
|
|
74
|
+
};
|
|
75
|
+
|
|
47
76
|
const loadTheme = (parentEl: Element | null, theme: Theme) => {
|
|
48
77
|
const {
|
|
49
78
|
primaryColor,
|
|
50
79
|
surfaceColor,
|
|
80
|
+
containerColor,
|
|
51
81
|
successColor,
|
|
52
82
|
warningColor,
|
|
53
83
|
errorColor,
|
|
54
84
|
colorScheme = 'dark',
|
|
85
|
+
borderRadius = 'md',
|
|
86
|
+
stylePreset = 'clean',
|
|
55
87
|
} = theme;
|
|
56
88
|
|
|
57
89
|
if (primaryColor) {
|
|
58
90
|
setColorPalette('accent', 500, parentEl, primaryColor, colorScheme);
|
|
91
|
+
|
|
92
|
+
if (stylePreset === 'bold') {
|
|
93
|
+
setColorPalette('gray', 50, parentEl, primaryColor, colorScheme);
|
|
94
|
+
}
|
|
59
95
|
}
|
|
60
96
|
|
|
61
|
-
if (surfaceColor) {
|
|
97
|
+
if (surfaceColor && stylePreset === 'clean') {
|
|
62
98
|
setColorPalette('gray', 950, parentEl, surfaceColor, colorScheme);
|
|
63
99
|
}
|
|
64
100
|
|
|
101
|
+
if (containerColor) {
|
|
102
|
+
setColorVariable('container', containerColor, parentEl);
|
|
103
|
+
}
|
|
104
|
+
|
|
65
105
|
if (successColor) {
|
|
66
106
|
setColorVariable('status-success', successColor, parentEl);
|
|
67
107
|
}
|
|
@@ -73,6 +113,10 @@ const loadTheme = (parentEl: Element | null, theme: Theme) => {
|
|
|
73
113
|
if (errorColor) {
|
|
74
114
|
setColorVariable('status-error', errorColor, parentEl);
|
|
75
115
|
}
|
|
116
|
+
|
|
117
|
+
if (borderRadius) {
|
|
118
|
+
setBorderRadiusVariables(borderRadius, parentEl);
|
|
119
|
+
}
|
|
76
120
|
};
|
|
77
121
|
|
|
78
122
|
export const ThemeContext = createContext<Theme | undefined>(undefined);
|
package/src/theme.css
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
:root {
|
|
2
2
|
--font-family-sw: 'Inter', sans-serif;
|
|
3
3
|
--default-font-family: var(--font-family-sw);
|
|
4
|
-
|
|
5
|
-
--r-sw-sm: 6px;
|
|
6
|
-
--r-sw-md: 10px;
|
|
7
|
-
--r-sw-lg: 16px;
|
|
8
|
-
--r-sw-xl: 24px;
|
|
9
4
|
}
|
|
10
5
|
|
|
11
6
|
@layer base {
|
|
7
|
+
body[data-sw-theme] {
|
|
8
|
+
--r-sw-sm: 6px;
|
|
9
|
+
--r-sw-md: 10px;
|
|
10
|
+
--r-sw-lg: 16px;
|
|
11
|
+
}
|
|
12
|
+
|
|
12
13
|
body[data-sw-theme="light"] {
|
|
13
14
|
color-scheme: light;
|
|
14
15
|
|
|
@@ -39,6 +40,8 @@
|
|
|
39
40
|
--c-sw-status-success: #00652F;
|
|
40
41
|
--c-sw-status-warning: #A87A04;
|
|
41
42
|
--c-sw-status-error: #9F002B;
|
|
43
|
+
|
|
44
|
+
--c-sw-container: #000;
|
|
42
45
|
}
|
|
43
46
|
|
|
44
47
|
body[data-sw-theme="dark"] {
|
|
@@ -71,6 +74,8 @@
|
|
|
71
74
|
--c-sw-status-success: #98FFB5;
|
|
72
75
|
--c-sw-status-warning: #FADFAD;
|
|
73
76
|
--c-sw-status-error: #FFB8BE;
|
|
77
|
+
|
|
78
|
+
--c-sw-container: #FFF;
|
|
74
79
|
}
|
|
75
80
|
}
|
|
76
81
|
|
package/src/types/theme.ts
CHANGED
|
@@ -2,14 +2,22 @@ export type HexColor = `#${string}`;
|
|
|
2
2
|
|
|
3
3
|
export type ColorScheme = 'light' | 'dark';
|
|
4
4
|
|
|
5
|
+
export type ThemeBorderRadius = 'none' | 'sm' | 'md' | 'lg';
|
|
6
|
+
|
|
7
|
+
export type ThemeStylePreset = 'clean' | 'bold';
|
|
8
|
+
|
|
5
9
|
export type Theme = {
|
|
6
10
|
colorScheme?: ColorScheme;
|
|
11
|
+
stylePreset?: ThemeStylePreset;
|
|
7
12
|
backgroundColor?: HexColor;
|
|
8
13
|
primaryColor?: HexColor;
|
|
9
14
|
surfaceColor?: HexColor;
|
|
15
|
+
containerColor?: HexColor;
|
|
10
16
|
successColor?: HexColor;
|
|
11
17
|
warningColor?: HexColor;
|
|
12
18
|
errorColor?: HexColor;
|
|
19
|
+
borderRadius?: ThemeBorderRadius;
|
|
20
|
+
showContainer?: boolean;
|
|
13
21
|
};
|
|
14
22
|
|
|
15
23
|
export type ColorPalette = Record<
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { BaseContainer } from '../../components/BaseContainer';
|
|
1
2
|
import {
|
|
2
3
|
WidgetContainer,
|
|
3
4
|
WidgetContainerProps,
|
|
@@ -13,11 +14,13 @@ export const WidgetDeposit = ({
|
|
|
13
14
|
className,
|
|
14
15
|
...widgetProps
|
|
15
16
|
}: WidgetDepositProps) => (
|
|
16
|
-
<
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
17
|
+
<BaseContainer>
|
|
18
|
+
<WidgetContainer
|
|
19
|
+
className={className}
|
|
20
|
+
isFullPage={isFullPage}
|
|
21
|
+
HeaderComponent={HeaderComponent}
|
|
22
|
+
FooterComponent={FooterComponent}>
|
|
23
|
+
<WidgetDepositContent {...widgetProps} />
|
|
24
|
+
</WidgetContainer>
|
|
25
|
+
</BaseContainer>
|
|
23
26
|
);
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { BaseContainer } from '../../components/BaseContainer';
|
|
1
2
|
import {
|
|
2
3
|
WidgetContainer,
|
|
3
4
|
WidgetContainerProps,
|
|
@@ -13,11 +14,13 @@ export const WidgetSwap = ({
|
|
|
13
14
|
className,
|
|
14
15
|
...widgetProps
|
|
15
16
|
}: WidgetSwapProps) => (
|
|
16
|
-
<
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
17
|
+
<BaseContainer>
|
|
18
|
+
<WidgetContainer
|
|
19
|
+
className={className}
|
|
20
|
+
isFullPage={isFullPage}
|
|
21
|
+
HeaderComponent={HeaderComponent}
|
|
22
|
+
FooterComponent={FooterComponent}>
|
|
23
|
+
<WidgetSwapContent {...widgetProps} />
|
|
24
|
+
</WidgetContainer>
|
|
25
|
+
</BaseContainer>
|
|
23
26
|
);
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { BaseContainer } from '../../components/BaseContainer';
|
|
1
2
|
import {
|
|
2
3
|
WidgetContainer,
|
|
3
4
|
WidgetContainerProps,
|
|
@@ -14,11 +15,13 @@ export const WidgetWithdraw = ({
|
|
|
14
15
|
className,
|
|
15
16
|
...widgetProps
|
|
16
17
|
}: WidgetWithdrawProps) => (
|
|
17
|
-
<
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
18
|
+
<BaseContainer>
|
|
19
|
+
<WidgetContainer
|
|
20
|
+
className={className}
|
|
21
|
+
isFullPage={isFullPage}
|
|
22
|
+
HeaderComponent={HeaderComponent}
|
|
23
|
+
FooterComponent={FooterComponent}>
|
|
24
|
+
<WidgetWithdrawContent {...widgetProps} />
|
|
25
|
+
</WidgetContainer>
|
|
26
|
+
</BaseContainer>
|
|
24
27
|
);
|