@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.
Files changed (111) hide show
  1. package/dist/components/BaseContainer.d.ts +2 -0
  2. package/dist/components/BaseContainer.js +23 -0
  3. package/dist/components/BaseContainer.js.map +1 -0
  4. package/dist/components/WidgetContainer.js +17 -18
  5. package/dist/components/WidgetContainer.js.map +1 -1
  6. package/dist/{config-CpXS2LPZ.js → config-CyBNYvb1.js} +833 -820
  7. package/dist/{config-CpXS2LPZ.js.map → config-CyBNYvb1.js.map} +1 -1
  8. package/dist/config.js +1 -1
  9. package/dist/errors.js +1 -1
  10. package/dist/ext/alchemy/index.js +1 -1
  11. package/dist/ext/index.js +1 -1
  12. package/dist/features/BalanceRpcLoader/TokenBalanceLoader.js +1 -1
  13. package/dist/features/BalanceRpcLoader/index.js +1 -1
  14. package/dist/features/BalanceRpcLoader/useTokenBalanceRpc.js +1 -1
  15. package/dist/features/ChainsDropdown/index.js +1 -1
  16. package/dist/features/ChainsSelector/index.js +1 -1
  17. package/dist/features/DepositMethodSwitcher.js +1 -1
  18. package/dist/features/ErrorBoundary.js +1 -1
  19. package/dist/features/ExternalDeposit.js +1 -1
  20. package/dist/features/SendAddress/index.js +1 -1
  21. package/dist/features/SendAddress/useNotification.js +1 -1
  22. package/dist/features/SubmitButton/index.js +1 -1
  23. package/dist/features/SuccessScreen/index.js +1 -1
  24. package/dist/features/SuccessScreen/useSummaryItemsCount.js +1 -1
  25. package/dist/features/SwapDirectionSwitcher.js +1 -1
  26. package/dist/features/SwapQuote/SwapQuote.js +1 -1
  27. package/dist/features/SwapQuote/index.js +1 -1
  28. package/dist/features/TokenInput/TokenInput.js +1 -1
  29. package/dist/features/TokenInput/TokenInputEmpty.js +1 -1
  30. package/dist/features/TokenInput/TokenInputSource.js +1 -1
  31. package/dist/features/TokenInput/TokenInputTarget.js +1 -1
  32. package/dist/features/TokenInput/WalletBalance.js +1 -1
  33. package/dist/features/TokenInput/hooks/index.js +1 -1
  34. package/dist/features/TokenInput/hooks/useTokenInputBalance.js +1 -1
  35. package/dist/features/TokenInput/index.js +1 -1
  36. package/dist/features/TokensList/TokenItem.js +1 -1
  37. package/dist/features/TokensList/TokensList.js +1 -1
  38. package/dist/features/TokensList/index.js +1 -1
  39. package/dist/features/TokensModal.js +1 -1
  40. package/dist/features/WalletCompatibilityCheck/WalletCompatibilityModal.js +1 -1
  41. package/dist/features/WalletCompatibilityCheck/index.js +1 -1
  42. package/dist/features/index.js +1 -1
  43. package/dist/hooks/index.js +1 -1
  44. package/dist/hooks/useAllTokens.js +1 -1
  45. package/dist/hooks/useChains.js +1 -1
  46. package/dist/hooks/useCompatibilityCheck.js +1 -1
  47. package/dist/hooks/useDefaultToken.js +1 -1
  48. package/dist/hooks/useExternalDepositStatus/index.js +1 -1
  49. package/dist/hooks/useExternalDepositStatus/usePoaExternalDepositStatus.js +1 -1
  50. package/dist/hooks/useIntentsBalance.js +1 -1
  51. package/dist/hooks/useIsCompatibilityCheckRequired.js +1 -1
  52. package/dist/hooks/useMakeDepositAddress.js +1 -1
  53. package/dist/hooks/useMakeIntentsTransfer.js +1 -1
  54. package/dist/hooks/useMakeNEARFtTransferCall.js +1 -1
  55. package/dist/hooks/useMakeQuote.js +1 -1
  56. package/dist/hooks/useMakeQuoteTransfer.js +1 -1
  57. package/dist/hooks/useMakeTransfer.js +1 -1
  58. package/dist/hooks/useMergedBalance.js +1 -1
  59. package/dist/hooks/useSwitchChain.js +1 -1
  60. package/dist/hooks/useTheme.js +1 -1
  61. package/dist/hooks/useTokenInputPair.js +1 -1
  62. package/dist/hooks/useTokens.js +1 -1
  63. package/dist/hooks/useTokensFiltered.js +1 -1
  64. package/dist/hooks/useTokensIntentsUnique.js +1 -1
  65. package/dist/index.js +1 -1
  66. package/dist/machine/effects/index.js +1 -1
  67. package/dist/machine/effects/useAlchemyBalanceEffect.js +1 -1
  68. package/dist/machine/effects/useBalancesUpdateEffect.js +1 -1
  69. package/dist/machine/effects/useMakeQuoteEffect.js +1 -1
  70. package/dist/machine/effects/useSelectedTokensEffect.js +1 -1
  71. package/dist/machine/effects/useSetTokenBalanceEffect.js +1 -1
  72. package/dist/machine/effects/useSetTokenIntentsTargetEffect.js +1 -1
  73. package/dist/machine/effects/useWalletConnEffect.js +1 -1
  74. package/dist/machine/events/index.js +1 -1
  75. package/dist/machine/events/tokenSelect.js +1 -1
  76. package/dist/machine/events/validateInputAndMoveTo.js +1 -1
  77. package/dist/machine/events/validateInputs.js +1 -1
  78. package/dist/machine/index.js +1 -1
  79. package/dist/machine/snap.js +1 -1
  80. package/dist/machine/subscriptions/checkers/isSendAddressAsConnected.js +1 -1
  81. package/dist/machine/subscriptions/index.js +1 -1
  82. package/dist/styles.css +1 -1
  83. package/dist/tailwind.css +3 -1
  84. package/dist/theme/ThemeProvider.js +1 -1
  85. package/dist/theme.css +10 -5
  86. package/dist/types/theme.d.ts +6 -0
  87. package/dist/utils/intents/signers/near.js +1 -1
  88. package/dist/utils/intents/signers/privy.js +1 -1
  89. package/dist/utils/near/getNearNep141StorageBalance.js +1 -1
  90. package/dist/widgets/WidgetDeposit/WidgetDepositContent.js +1 -1
  91. package/dist/widgets/WidgetDeposit/WidgetDepositSkeleton.js +1 -1
  92. package/dist/widgets/WidgetDeposit/index.js +15 -14
  93. package/dist/widgets/WidgetDeposit/index.js.map +1 -1
  94. package/dist/widgets/WidgetSwap/WidgetSwapContent.js +1 -1
  95. package/dist/widgets/WidgetSwap/WidgetSwapSkeleton.js +1 -1
  96. package/dist/widgets/WidgetSwap/index.js +15 -14
  97. package/dist/widgets/WidgetSwap/index.js.map +1 -1
  98. package/dist/widgets/WidgetWithdraw/WidgetWithdrawContent.js +1 -1
  99. package/dist/widgets/WidgetWithdraw/WidgetWithdrawSkeleton.js +1 -1
  100. package/dist/widgets/WidgetWithdraw/index.js +13 -12
  101. package/dist/widgets/WidgetWithdraw/index.js.map +1 -1
  102. package/package.json +1 -1
  103. package/src/components/BaseContainer.tsx +19 -0
  104. package/src/components/WidgetContainer.tsx +0 -1
  105. package/src/tailwind.css +3 -1
  106. package/src/theme/ThemeProvider.tsx +52 -8
  107. package/src/theme.css +10 -5
  108. package/src/types/theme.ts +8 -0
  109. package/src/widgets/WidgetDeposit/index.tsx +10 -7
  110. package/src/widgets/WidgetSwap/index.tsx +10 -7
  111. 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 { ColorPalette, ColorScheme, HexColor, Theme } from '../types/theme';
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 setColorVariable = (
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(`--c-sw-${key}`, value);
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
 
@@ -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
- <WidgetContainer
17
- className={className}
18
- isFullPage={isFullPage}
19
- HeaderComponent={HeaderComponent}
20
- FooterComponent={FooterComponent}>
21
- <WidgetDepositContent {...widgetProps} />
22
- </WidgetContainer>
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
- <WidgetContainer
17
- className={className}
18
- isFullPage={isFullPage}
19
- HeaderComponent={HeaderComponent}
20
- FooterComponent={FooterComponent}>
21
- <WidgetSwapContent {...widgetProps} />
22
- </WidgetContainer>
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
- <WidgetContainer
18
- className={className}
19
- isFullPage={isFullPage}
20
- HeaderComponent={HeaderComponent}
21
- FooterComponent={FooterComponent}>
22
- <WidgetWithdrawContent {...widgetProps} />
23
- </WidgetContainer>
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
  );