@rango-dev/widget-embedded 0.28.3-next.5 → 0.28.3-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 (100) hide show
  1. package/dist/components/BlockchainList/BlockchainList.styles.d.ts +12 -21
  2. package/dist/components/BlockchainList/BlockchainList.styles.d.ts.map +1 -1
  3. package/dist/components/BlockchainsSection/BlockchainsSection.styles.d.ts +4 -7
  4. package/dist/components/BlockchainsSection/BlockchainsSection.styles.d.ts.map +1 -1
  5. package/dist/components/ConfirmWalletsModal/ConfirmWallets.styles.d.ts +60 -105
  6. package/dist/components/ConfirmWalletsModal/ConfirmWallets.styles.d.ts.map +1 -1
  7. package/dist/components/ConfirmWalletsModal/ConfirmWalletsModal.d.ts.map +1 -1
  8. package/dist/components/ConfirmWalletsModal/WalletList.d.ts.map +1 -1
  9. package/dist/components/ConfirmWalletsModal/WalletList.styles.d.ts +12 -21
  10. package/dist/components/ConfirmWalletsModal/WalletList.styles.d.ts.map +1 -1
  11. package/dist/components/ConfirmWalletsModal/WalletList.type.d.ts +1 -0
  12. package/dist/components/ConfirmWalletsModal/WalletList.type.d.ts.map +1 -1
  13. package/dist/components/CustomCollapsible/CustomCollapsible.styles.d.ts +16 -28
  14. package/dist/components/CustomCollapsible/CustomCollapsible.styles.d.ts.map +1 -1
  15. package/dist/components/HeaderButtons/HeaderButtons.styles.d.ts +32 -56
  16. package/dist/components/HeaderButtons/HeaderButtons.styles.d.ts.map +1 -1
  17. package/dist/components/HistoryGroupedList/HistoryGroupedList.styles.d.ts +24 -42
  18. package/dist/components/HistoryGroupedList/HistoryGroupedList.styles.d.ts.map +1 -1
  19. package/dist/components/Layout/Layout.styles.d.ts +16 -28
  20. package/dist/components/Layout/Layout.styles.d.ts.map +1 -1
  21. package/dist/components/Layout/PageContainer.d.ts +4 -7
  22. package/dist/components/Layout/PageContainer.d.ts.map +1 -1
  23. package/dist/components/Layout/ScrollableArea.d.ts +4 -7
  24. package/dist/components/Layout/ScrollableArea.d.ts.map +1 -1
  25. package/dist/components/LoadingLiquiditySourceList/LoadingLiquiditySourceList.styles.d.ts +4 -7
  26. package/dist/components/LoadingLiquiditySourceList/LoadingLiquiditySourceList.styles.d.ts.map +1 -1
  27. package/dist/components/LoadingSwapDetails/LoadingSwapDetails.styles.d.ts +56 -98
  28. package/dist/components/LoadingSwapDetails/LoadingSwapDetails.styles.d.ts.map +1 -1
  29. package/dist/components/NoResult/NoResult.styles.d.ts +16 -28
  30. package/dist/components/NoResult/NoResult.styles.d.ts.map +1 -1
  31. package/dist/components/NotificationContent/NotificationContent.styles.d.ts +33 -57
  32. package/dist/components/NotificationContent/NotificationContent.styles.d.ts.map +1 -1
  33. package/dist/components/Quote/Quote.styles.d.ts +85 -148
  34. package/dist/components/Quote/Quote.styles.d.ts.map +1 -1
  35. package/dist/components/Quote/QuoteCostDetails.styles.d.ts +20 -35
  36. package/dist/components/Quote/QuoteCostDetails.styles.d.ts.map +1 -1
  37. package/dist/components/Quote/QuoteSummary.styles.d.ts +8 -14
  38. package/dist/components/Quote/QuoteSummary.styles.d.ts.map +1 -1
  39. package/dist/components/QuoteSkeleton/QuoteSkeleton.styles.d.ts +16 -28
  40. package/dist/components/QuoteSkeleton/QuoteSkeleton.styles.d.ts.map +1 -1
  41. package/dist/components/QuoteSkeleton/QuoteSummarySkeleton.styles.d.ts +40 -70
  42. package/dist/components/QuoteSkeleton/QuoteSummarySkeleton.styles.d.ts.map +1 -1
  43. package/dist/components/QuoteSkeleton/StepSkeleton.styles.d.ts +20 -35
  44. package/dist/components/QuoteSkeleton/StepSkeleton.styles.d.ts.map +1 -1
  45. package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.styles.d.ts +16 -28
  46. package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.styles.d.ts.map +1 -1
  47. package/dist/components/Quotes/Quotes.styles.d.ts +12 -21
  48. package/dist/components/Quotes/Quotes.styles.d.ts.map +1 -1
  49. package/dist/components/RefreshModal/RefreshModal.styles.d.ts +5 -8
  50. package/dist/components/RefreshModal/RefreshModal.styles.d.ts.map +1 -1
  51. package/dist/components/SearchInput/SearchInput.styles.d.ts +4 -7
  52. package/dist/components/SearchInput/SearchInput.styles.d.ts.map +1 -1
  53. package/dist/components/SettingsContainer/SettingsContainer.style.d.ts +12 -21
  54. package/dist/components/SettingsContainer/SettingsContainer.style.d.ts.map +1 -1
  55. package/dist/components/Slippage/Slippage.styles.d.ts +20 -35
  56. package/dist/components/Slippage/Slippage.styles.d.ts.map +1 -1
  57. package/dist/components/SwapDetails/SwapDetails.styles.d.ts +60 -105
  58. package/dist/components/SwapDetails/SwapDetails.styles.d.ts.map +1 -1
  59. package/dist/components/SwapDetailsAlerts/SwapDetailsAlerts.styles.d.ts +12 -21
  60. package/dist/components/SwapDetailsAlerts/SwapDetailsAlerts.styles.d.ts.map +1 -1
  61. package/dist/components/SwapDetailsModal/SwapDetailsModal.styles.d.ts +8 -14
  62. package/dist/components/SwapDetailsModal/SwapDetailsModal.styles.d.ts.map +1 -1
  63. package/dist/components/SwitchFromAndTo/SwitchFromAndTo.styles.d.ts +8 -14
  64. package/dist/components/SwitchFromAndTo/SwitchFromAndTo.styles.d.ts.map +1 -1
  65. package/dist/components/TokenList/TokenList.d.ts.map +1 -1
  66. package/dist/components/TokenList/TokenList.styles.d.ts +72 -126
  67. package/dist/components/TokenList/TokenList.styles.d.ts.map +1 -1
  68. package/dist/components/WalletModal/WalletModalContent.styles.d.ts +16 -28
  69. package/dist/components/WalletModal/WalletModalContent.styles.d.ts.map +1 -1
  70. package/dist/components/WalletNamespacesModal/WalletNamespacesModal.styles.d.ts +4 -7
  71. package/dist/components/WalletNamespacesModal/WalletNamespacesModal.styles.d.ts.map +1 -1
  72. package/dist/containers/App/App.styles.d.ts +4 -7
  73. package/dist/containers/App/App.styles.d.ts.map +1 -1
  74. package/dist/containers/ExpandedQuotes/ExpandedQuotes.styles.d.ts +8 -14
  75. package/dist/containers/ExpandedQuotes/ExpandedQuotes.styles.d.ts.map +1 -1
  76. package/dist/containers/Inputs/Inputs.styles.d.ts +8 -14
  77. package/dist/containers/Inputs/Inputs.styles.d.ts.map +1 -1
  78. package/dist/containers/QuoteInfo/QuoteInfo.styles.d.ts +12 -21
  79. package/dist/containers/QuoteInfo/QuoteInfo.styles.d.ts.map +1 -1
  80. package/dist/index.js +2 -2
  81. package/dist/index.js.map +3 -3
  82. package/dist/store/wallets.d.ts.map +1 -1
  83. package/dist/types/config.d.ts +5 -3
  84. package/dist/types/config.d.ts.map +1 -1
  85. package/dist/utils/colors.d.ts +7 -10
  86. package/dist/utils/colors.d.ts.map +1 -1
  87. package/dist/utils/ui.d.ts +2 -1
  88. package/dist/utils/ui.d.ts.map +1 -1
  89. package/dist/widget-embedded.build.json +1 -1
  90. package/package.json +2 -2
  91. package/src/components/ConfirmWalletsModal/ConfirmWalletsModal.tsx +86 -23
  92. package/src/components/ConfirmWalletsModal/WalletList.tsx +4 -2
  93. package/src/components/ConfirmWalletsModal/WalletList.type.ts +1 -0
  94. package/src/components/HeaderButtons/HeaderButtons.styles.ts +1 -1
  95. package/src/components/Quote/Quote.styles.ts +5 -5
  96. package/src/components/TokenList/TokenList.tsx +8 -13
  97. package/src/store/wallets.ts +7 -2
  98. package/src/types/config.ts +7 -3
  99. package/src/utils/colors.ts +160 -117
  100. package/src/utils/ui.ts +28 -33
package/src/utils/ui.ts CHANGED
@@ -8,14 +8,15 @@ import {
8
8
  } from '@rango-dev/ui';
9
9
  import React from 'react';
10
10
 
11
- import { generateColors } from '../utils/colors';
11
+ import { expandToGenerateThemeColors } from '../utils/colors';
12
12
  import { toHash } from '../utils/hash';
13
13
 
14
14
  import { THEME_CLASS_NAME_PREFIX } from './configs';
15
15
 
16
+ type Tokens = Parameters<typeof createTheme>[0];
16
17
  interface CustomizedThemeValues {
17
18
  id: string;
18
- tokens: Parameters<typeof createTheme>[0];
19
+ tokens: Tokens;
19
20
  }
20
21
 
21
22
  interface CustomizedTheme {
@@ -27,48 +28,42 @@ export function customizedThemeTokens(
27
28
  colors: WidgetTheme['colors']
28
29
  ): CustomizedTheme {
29
30
  const baseColors = baseThemeTokens.colors;
31
+ const baseDarkColors = {
32
+ ...baseColors,
33
+ ...defaultDarkColors,
34
+ };
35
+ let lightTheme: CustomizedTheme['light'] = undefined;
36
+ let darkTheme: CustomizedTheme['dark'] = undefined;
30
37
 
31
- const darkColorsWithDefaults = generateColors(
32
- {
33
- ...baseColors,
34
- ...defaultDarkColors,
35
- },
36
- true,
37
- colors?.dark
38
- );
39
- const lightColorsWithDefaults = generateColors(
40
- baseColors,
41
- false,
42
- colors?.light
43
- );
44
- const hasDefaultDarkColors = Object.keys(darkColorsWithDefaults).length > 0;
45
- const hasDefaultLightColors = Object.keys(lightColorsWithDefaults).length > 0;
46
-
47
- let light: CustomizedTheme['light'] = undefined;
48
- let dark: CustomizedTheme['dark'] = undefined;
49
-
50
- if (hasDefaultLightColors) {
51
- const tokens = { colors: lightColorsWithDefaults };
38
+ if (colors?.light) {
39
+ const lightColors = expandToGenerateThemeColors(baseColors, colors.light);
40
+ const tokens = { colors: lightColors };
52
41
  const id = `${THEME_CLASS_NAME_PREFIX}-light-${toHash(tokens)}`;
53
- light = {
42
+ lightTheme = {
54
43
  id,
55
- tokens,
44
+ tokens: tokens as Tokens,
56
45
  };
57
46
  }
58
- if (hasDefaultDarkColors) {
59
- const tokens = {
60
- colors: darkColorsWithDefaults,
61
- };
47
+
48
+ if (colors?.dark) {
49
+ const darkColors = expandToGenerateThemeColors(
50
+ baseDarkColors,
51
+ colors.dark,
52
+ {
53
+ reverseNeutralRange: true,
54
+ }
55
+ );
56
+ const tokens = { colors: darkColors };
62
57
  const id = `${THEME_CLASS_NAME_PREFIX}-dark-${toHash(tokens)}`;
63
- dark = {
58
+ darkTheme = {
64
59
  id,
65
- tokens,
60
+ tokens: tokens as Tokens,
66
61
  };
67
62
  }
68
63
 
69
64
  return {
70
- light,
71
- dark,
65
+ light: lightTheme,
66
+ dark: darkTheme,
72
67
  };
73
68
  }
74
69