@lifi/widget 1.32.0 → 1.32.2
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/AppDrawer.style.d.ts +1 -1
- package/cjs/AppDrawer.style.d.ts +1 -1
- package/cjs/components/ActiveSwaps/ActiveSwapItem.js +1 -1
- package/cjs/components/ActiveSwaps/ActiveSwaps.style.d.ts +2 -2
- package/cjs/components/ActiveSwaps/ActiveSwaps.style.js +1 -1
- package/cjs/components/Card/Card.d.ts +0 -2
- package/cjs/components/Card/Card.js +2 -8
- package/cjs/components/ChainSelect/ChainSelect.style.d.ts +0 -1
- package/cjs/components/Header/Header.style.d.ts +1 -1
- package/cjs/components/Header/WalletHeader.js +1 -1
- package/cjs/components/ListItemButton.js +1 -1
- package/cjs/components/ReverseTokensButton/ReverseTokensButton.style.d.ts +1 -1
- package/cjs/components/SendToWallet/SendToWallet.style.d.ts +1 -1
- package/cjs/components/Step/StepProcess.style.d.ts +1 -1
- package/cjs/components/SwapInput/SwapInput.style.d.ts +1 -1
- package/cjs/components/SwapInput/SwapInputAdornment.style.d.ts +1 -1
- package/cjs/components/SwapRouteCard/SwapRouteCard.js +1 -1
- package/cjs/components/SwapRouteCard/SwapRouteCard.style.d.ts +1 -1
- package/cjs/components/SwapRouteCard/SwapRouteCardSkeleton.js +1 -1
- package/cjs/components/TokenList/TokenList.style.d.ts +1 -1
- package/cjs/components/TokenList/TokenListItem.js +1 -1
- package/cjs/config/theme.js +25 -0
- package/cjs/config/version.d.ts +1 -1
- package/cjs/config/version.js +1 -1
- package/cjs/hooks/useTools.js +1 -2
- package/cjs/i18n/en.json +0 -4
- package/cjs/i18n/it.json +8 -8
- package/cjs/i18n/uk.json +8 -8
- package/cjs/i18n/zh.json +8 -8
- package/cjs/pages/SelectChainPage/SelectChainPage.js +1 -1
- package/cjs/pages/SelectEnabledToolsPage/SelectEnabledToolsPage.js +1 -1
- package/cjs/pages/SelectNativeTokenPage/SelectNativeTokenPage.js +1 -1
- package/cjs/pages/SelectWalletPage/SelectWalletPage.js +1 -1
- package/cjs/pages/SettingsPage/ColorSchemeButtonGroup.style.d.ts +1 -1
- package/cjs/pages/SettingsPage/EnabledToolsButton.js +1 -1
- package/cjs/providers/WidgetProvider/WidgetProvider.js +3 -5
- package/cjs/stores/StoreProvider.js +1 -7
- package/cjs/stores/chains/index.d.ts +1 -2
- package/cjs/stores/chains/index.js +1 -2
- package/cjs/stores/chains/useChainOrder.js +2 -2
- package/cjs/stores/chains/useChainOrderStore.d.ts +3 -0
- package/cjs/stores/chains/{createChainOrderStore.js → useChainOrderStore.js} +3 -4
- package/cjs/stores/routes/types.d.ts +1 -1
- package/cjs/stores/routes/useRecommendedRouteStore.d.ts +10 -2
- package/cjs/stores/routes/useRecommendedRouteStore.js +30 -2
- package/cjs/stores/settings/index.d.ts +1 -1
- package/cjs/stores/settings/index.js +1 -1
- package/cjs/stores/settings/useAppearance.js +2 -2
- package/cjs/stores/settings/useSettings.js +2 -2
- package/cjs/stores/settings/useSettingsStore.d.ts +6 -0
- package/cjs/stores/settings/{createSettingsStore.js → useSettingsStore.js} +20 -4
- package/cjs/utils/colors.d.ts +2 -2
- package/cjs/utils/colors.js +1 -3
- package/components/ActiveSwaps/ActiveSwapItem.js +1 -1
- package/components/ActiveSwaps/ActiveSwaps.style.d.ts +2 -2
- package/components/ActiveSwaps/ActiveSwaps.style.js +1 -1
- package/components/Card/Card.d.ts +0 -2
- package/components/Card/Card.js +2 -8
- package/components/ChainSelect/ChainSelect.style.d.ts +0 -1
- package/components/Header/Header.style.d.ts +1 -1
- package/components/Header/WalletHeader.js +1 -1
- package/components/ListItemButton.js +1 -1
- package/components/ReverseTokensButton/ReverseTokensButton.style.d.ts +1 -1
- package/components/SendToWallet/SendToWallet.style.d.ts +1 -1
- package/components/Step/StepProcess.style.d.ts +1 -1
- package/components/SwapInput/SwapInput.style.d.ts +1 -1
- package/components/SwapInput/SwapInputAdornment.style.d.ts +1 -1
- package/components/SwapRouteCard/SwapRouteCard.js +1 -1
- package/components/SwapRouteCard/SwapRouteCard.style.d.ts +1 -1
- package/components/SwapRouteCard/SwapRouteCardSkeleton.js +1 -1
- package/components/TokenList/TokenList.style.d.ts +1 -1
- package/components/TokenList/TokenListItem.js +1 -1
- package/config/theme.js +25 -0
- package/config/version.d.ts +1 -1
- package/config/version.js +1 -1
- package/hooks/useTools.js +2 -3
- package/i18n/en.json +0 -4
- package/i18n/it.json +8 -8
- package/i18n/uk.json +8 -8
- package/i18n/zh.json +8 -8
- package/package.json +4 -4
- package/pages/SelectChainPage/SelectChainPage.js +1 -1
- package/pages/SelectEnabledToolsPage/SelectEnabledToolsPage.js +1 -1
- package/pages/SelectNativeTokenPage/SelectNativeTokenPage.js +1 -1
- package/pages/SelectWalletPage/SelectWalletPage.js +1 -1
- package/pages/SettingsPage/ColorSchemeButtonGroup.style.d.ts +1 -1
- package/pages/SettingsPage/EnabledToolsButton.js +1 -1
- package/providers/WidgetProvider/WidgetProvider.js +5 -7
- package/stores/StoreProvider.js +2 -8
- package/stores/chains/index.d.ts +1 -2
- package/stores/chains/index.js +1 -2
- package/stores/chains/useChainOrder.js +1 -1
- package/stores/chains/useChainOrderStore.d.ts +3 -0
- package/stores/chains/{createChainOrderStore.js → useChainOrderStore.js} +2 -2
- package/stores/routes/types.d.ts +1 -1
- package/stores/routes/useRecommendedRouteStore.d.ts +10 -2
- package/stores/routes/useRecommendedRouteStore.js +25 -1
- package/stores/settings/index.d.ts +1 -1
- package/stores/settings/index.js +1 -1
- package/stores/settings/useAppearance.js +1 -1
- package/stores/settings/useSettings.js +1 -1
- package/stores/settings/useSettingsStore.d.ts +6 -0
- package/stores/settings/{createSettingsStore.js → useSettingsStore.js} +18 -2
- package/tsconfig.cjs.tsbuildinfo +1 -1
- package/utils/colors.d.ts +2 -2
- package/utils/colors.js +1 -3
- package/cjs/stores/chains/ChainOrderStore.d.ts +0 -9
- package/cjs/stores/chains/ChainOrderStore.js +0 -32
- package/cjs/stores/chains/createChainOrderStore.d.ts +0 -4
- package/cjs/stores/settings/SettingsStore.d.ts +0 -11
- package/cjs/stores/settings/SettingsStore.js +0 -48
- package/cjs/stores/settings/createSettingsStore.d.ts +0 -5
- package/stores/chains/ChainOrderStore.d.ts +0 -9
- package/stores/chains/ChainOrderStore.js +0 -26
- package/stores/chains/createChainOrderStore.d.ts +0 -4
- package/stores/settings/SettingsStore.d.ts +0 -11
- package/stores/settings/SettingsStore.js +0 -41
- package/stores/settings/createSettingsStore.d.ts +0 -5
|
@@ -20,6 +20,6 @@ const EnabledToolsButton = ({ type }) => {
|
|
|
20
20
|
const handleClick = () => {
|
|
21
21
|
navigate(utils_1.navigationRoutes[type.toLowerCase()]);
|
|
22
22
|
};
|
|
23
|
-
return ((0, jsx_runtime_1.jsxs)(EnabledToolsButton_style_1.ListItemButton, { onClick: handleClick,
|
|
23
|
+
return ((0, jsx_runtime_1.jsxs)(EnabledToolsButton_style_1.ListItemButton, { onClick: handleClick, children: [(0, jsx_runtime_1.jsx)(EnabledToolsButton_style_1.ListItemText, { primary: t(`settings.enabled${type}`) }), (0, jsx_runtime_1.jsxs)(material_1.Box, { display: "flex", alignItems: "center", children: [(0, jsx_runtime_1.jsx)(EnabledToolsButton_style_1.ListItemText, { primary: `${enabledTools}/${tools}` }), (0, jsx_runtime_1.jsx)(icons_material_1.ChevronRight, {})] })] }));
|
|
24
24
|
};
|
|
25
25
|
exports.EnabledToolsButton = EnabledToolsButton;
|
|
@@ -14,7 +14,6 @@ const WidgetContext = (0, react_1.createContext)(initialContext);
|
|
|
14
14
|
const useWidgetConfig = () => (0, react_1.useContext)(WidgetContext);
|
|
15
15
|
exports.useWidgetConfig = useWidgetConfig;
|
|
16
16
|
const WidgetProvider = ({ children, config: { fromChain, fromToken, toChain, toToken, fromAmount, ...config } = {}, }) => {
|
|
17
|
-
const settingsStoreContext = (0, stores_1.useSettingsStoreContext)();
|
|
18
17
|
const elementId = (0, react_1.useId)();
|
|
19
18
|
const value = (0, react_1.useMemo)(() => {
|
|
20
19
|
try {
|
|
@@ -25,7 +24,7 @@ const WidgetProvider = ({ children, config: { fromChain, fromToken, toChain, toT
|
|
|
25
24
|
delete searchParams[`${key}Token`];
|
|
26
25
|
}
|
|
27
26
|
});
|
|
28
|
-
|
|
27
|
+
const value = {
|
|
29
28
|
...config,
|
|
30
29
|
fromChain: (searchParams.fromChain &&
|
|
31
30
|
isNaN(parseInt(searchParams.fromChain, 10))) ||
|
|
@@ -52,15 +51,14 @@ const WidgetProvider = ({ children, config: { fromChain, fromToken, toChain, toT
|
|
|
52
51
|
: fromAmount,
|
|
53
52
|
elementId,
|
|
54
53
|
};
|
|
54
|
+
(0, stores_1.setDefaultSettings)(value);
|
|
55
|
+
return value;
|
|
55
56
|
}
|
|
56
57
|
catch (e) {
|
|
57
58
|
console.warn(e);
|
|
58
59
|
return { ...config, elementId };
|
|
59
60
|
}
|
|
60
61
|
}, [config, elementId, fromAmount, fromChain, fromToken, toChain, toToken]);
|
|
61
|
-
(0, react_1.useEffect)(() => {
|
|
62
|
-
(0, stores_1.setDefaultSettings)(settingsStoreContext, value);
|
|
63
|
-
}, [settingsStoreContext, value]);
|
|
64
62
|
return ((0, jsx_runtime_1.jsx)(WidgetContext.Provider, { value: value, children: children }));
|
|
65
63
|
};
|
|
66
64
|
exports.WidgetProvider = WidgetProvider;
|
|
@@ -2,14 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.StoreProvider = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
-
const chains_1 = require("./chains");
|
|
6
5
|
const routes_1 = require("./routes");
|
|
7
|
-
const settings_1 = require("./settings");
|
|
8
6
|
const StoreProvider = ({ children, namePrefix }) => {
|
|
9
|
-
return ((0, jsx_runtime_1.jsx)(routes_1.RouteExecutionStoreProvider, { namePrefix: namePrefix, children: (0, jsx_runtime_1.jsx)(
|
|
10
|
-
// namePrefix={namePrefix}
|
|
11
|
-
, { children: (0, jsx_runtime_1.jsx)(chains_1.ChainOrderStoreProvider
|
|
12
|
-
// namePrefix={namePrefix}
|
|
13
|
-
, { children: children }) }) }));
|
|
7
|
+
return ((0, jsx_runtime_1.jsx)(routes_1.RouteExecutionStoreProvider, { namePrefix: namePrefix, children: (0, jsx_runtime_1.jsx)(routes_1.RecommendedRouteStoreProvider, { children: children }) }));
|
|
14
8
|
};
|
|
15
9
|
exports.StoreProvider = StoreProvider;
|
|
@@ -14,7 +14,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./ChainOrderStore"), exports);
|
|
18
|
-
__exportStar(require("./createChainOrderStore"), exports);
|
|
19
17
|
__exportStar(require("./types"), exports);
|
|
20
18
|
__exportStar(require("./useChainOrder"), exports);
|
|
19
|
+
__exportStar(require("./useChainOrderStore"), exports);
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useChainOrder = void 0;
|
|
4
4
|
const shallow_1 = require("zustand/shallow");
|
|
5
|
-
const
|
|
5
|
+
const _1 = require(".");
|
|
6
6
|
const useChainOrder = () => {
|
|
7
|
-
return (0,
|
|
7
|
+
return (0, _1.useChainOrderStore)((state) => [state.chainOrder, state.setChain], shallow_1.shallow);
|
|
8
8
|
};
|
|
9
9
|
exports.useChainOrder = useChainOrder;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.useChainOrderStore = exports.maxChainToOrder = void 0;
|
|
4
4
|
const zustand_1 = require("zustand");
|
|
5
5
|
const middleware_1 = require("zustand/middleware");
|
|
6
6
|
exports.maxChainToOrder = 9;
|
|
7
|
-
|
|
7
|
+
exports.useChainOrderStore = (0, zustand_1.create)((0, middleware_1.persist)((set, get) => ({
|
|
8
8
|
chainOrder: [],
|
|
9
9
|
availableChains: [],
|
|
10
10
|
initializeChains: (chainIds) => {
|
|
@@ -46,8 +46,7 @@ const createChainOrderStore = ({ namePrefix }) => (0, zustand_1.create)((0, midd
|
|
|
46
46
|
});
|
|
47
47
|
},
|
|
48
48
|
}), {
|
|
49
|
-
name:
|
|
49
|
+
name: `li.fi-widget-chains-order`,
|
|
50
50
|
version: 0,
|
|
51
51
|
partialize: (state) => ({ chainOrder: state.chainOrder }),
|
|
52
52
|
}));
|
|
53
|
-
exports.createChainOrderStore = createChainOrderStore;
|
|
@@ -1,2 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { StoreApi, UseBoundStore } from 'zustand';
|
|
3
|
+
import type { PersistStoreProviderProps } from '../types';
|
|
4
|
+
import type { RecommendedRouteState } from './types';
|
|
5
|
+
export declare const createRecommendedRouteStore: () => UseBoundStore<StoreApi<RecommendedRouteState>>;
|
|
6
|
+
export type RecommendedRouteStore = UseBoundStore<StoreApi<RecommendedRouteState>>;
|
|
7
|
+
export declare const RecommendedRouteStoreContext: import("react").Context<RecommendedRouteStore | null>;
|
|
8
|
+
export declare function RecommendedRouteStoreProvider({ children, ...props }: PersistStoreProviderProps): JSX.Element;
|
|
9
|
+
export declare function useRecommendedRouteStore<T>(selector: (state: RecommendedRouteState) => T, equalityFn?: (left: T, right: T) => boolean): T;
|
|
10
|
+
export declare function useRecommendedRouteStoreContext(): RecommendedRouteStore;
|
|
@@ -1,11 +1,39 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useRecommendedRouteStore = void 0;
|
|
3
|
+
exports.useRecommendedRouteStoreContext = exports.useRecommendedRouteStore = exports.RecommendedRouteStoreProvider = exports.RecommendedRouteStoreContext = exports.createRecommendedRouteStore = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
4
6
|
const zustand_1 = require("zustand");
|
|
5
|
-
|
|
7
|
+
const createRecommendedRouteStore = () => (0, zustand_1.create)((set) => ({
|
|
6
8
|
setRecommendedRoute: (recommendedRoute) => {
|
|
7
9
|
set(() => ({
|
|
8
10
|
recommendedRoute,
|
|
9
11
|
}));
|
|
10
12
|
},
|
|
11
13
|
}));
|
|
14
|
+
exports.createRecommendedRouteStore = createRecommendedRouteStore;
|
|
15
|
+
exports.RecommendedRouteStoreContext = (0, react_1.createContext)(null);
|
|
16
|
+
function RecommendedRouteStoreProvider({ children, ...props }) {
|
|
17
|
+
const storeRef = (0, react_1.useRef)();
|
|
18
|
+
if (!storeRef.current) {
|
|
19
|
+
storeRef.current = (0, exports.createRecommendedRouteStore)();
|
|
20
|
+
}
|
|
21
|
+
return ((0, jsx_runtime_1.jsx)(exports.RecommendedRouteStoreContext.Provider, { value: storeRef.current, children: children }));
|
|
22
|
+
}
|
|
23
|
+
exports.RecommendedRouteStoreProvider = RecommendedRouteStoreProvider;
|
|
24
|
+
function useRecommendedRouteStore(selector, equalityFn) {
|
|
25
|
+
const useStore = (0, react_1.useContext)(exports.RecommendedRouteStoreContext);
|
|
26
|
+
if (!useStore) {
|
|
27
|
+
throw new Error(`You forgot to wrap your component in <${RecommendedRouteStoreProvider.name}>.`);
|
|
28
|
+
}
|
|
29
|
+
return useStore(selector, equalityFn);
|
|
30
|
+
}
|
|
31
|
+
exports.useRecommendedRouteStore = useRecommendedRouteStore;
|
|
32
|
+
function useRecommendedRouteStoreContext() {
|
|
33
|
+
const useStore = (0, react_1.useContext)(exports.RecommendedRouteStoreContext);
|
|
34
|
+
if (!useStore) {
|
|
35
|
+
throw new Error(`You forgot to wrap your component in <${RecommendedRouteStoreProvider.name}>.`);
|
|
36
|
+
}
|
|
37
|
+
return useStore;
|
|
38
|
+
}
|
|
39
|
+
exports.useRecommendedRouteStoreContext = useRecommendedRouteStoreContext;
|
|
@@ -14,8 +14,8 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./SettingsStore"), exports);
|
|
18
17
|
__exportStar(require("./types"), exports);
|
|
19
18
|
__exportStar(require("./useAppearance"), exports);
|
|
20
19
|
__exportStar(require("./useSendToWalletStore"), exports);
|
|
21
20
|
__exportStar(require("./useSettings"), exports);
|
|
21
|
+
__exportStar(require("./useSettingsStore"), exports);
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useAppearance = void 0;
|
|
4
4
|
const shallow_1 = require("zustand/shallow");
|
|
5
|
-
const
|
|
5
|
+
const useSettingsStore_1 = require("./useSettingsStore");
|
|
6
6
|
const useAppearance = () => {
|
|
7
|
-
const [appearance, setValue] = (0,
|
|
7
|
+
const [appearance, setValue] = (0, useSettingsStore_1.useSettingsStore)((state) => [state.appearance, state.setValue], shallow_1.shallow);
|
|
8
8
|
const setAppearance = (appearance) => {
|
|
9
9
|
setValue('appearance', appearance);
|
|
10
10
|
};
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useSettings = void 0;
|
|
4
4
|
const shallow_1 = require("zustand/shallow");
|
|
5
|
-
const
|
|
5
|
+
const useSettingsStore_1 = require("./useSettingsStore");
|
|
6
6
|
const useSettings = (keys) => {
|
|
7
|
-
return (0,
|
|
7
|
+
return (0, useSettingsStore_1.useSettingsStore)((state) => keys.reduce((values, key) => {
|
|
8
8
|
values[key] = state[key];
|
|
9
9
|
return values;
|
|
10
10
|
}, {}), shallow_1.shallow);
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { WidgetConfig } from '../../types';
|
|
2
|
+
import type { SettingsProps, SettingsState } from './types';
|
|
3
|
+
export declare const defaultConfigurableSettings: Pick<SettingsState, 'routePriority' | 'slippage'>;
|
|
4
|
+
export declare const defaultSettings: SettingsProps;
|
|
5
|
+
export declare const useSettingsStore: import("zustand").UseBoundStore<import("zustand").StoreApi<SettingsState>>;
|
|
6
|
+
export declare const setDefaultSettings: (config?: WidgetConfig) => void;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.setDefaultSettings = exports.useSettingsStore = exports.defaultSettings = exports.defaultConfigurableSettings = void 0;
|
|
4
4
|
const zustand_1 = require("zustand");
|
|
5
5
|
const middleware_1 = require("zustand/middleware");
|
|
6
6
|
const types_1 = require("./types");
|
|
@@ -15,7 +15,7 @@ exports.defaultSettings = {
|
|
|
15
15
|
enabledBridges: [],
|
|
16
16
|
enabledExchanges: [],
|
|
17
17
|
};
|
|
18
|
-
|
|
18
|
+
exports.useSettingsStore = (0, zustand_1.create)((0, middleware_1.persist)((set, get) => ({
|
|
19
19
|
...exports.defaultSettings,
|
|
20
20
|
setValue: (key, value) => set(() => ({
|
|
21
21
|
[key]: value,
|
|
@@ -74,7 +74,7 @@ const createSettingsStore = ({ namePrefix }) => (0, zustand_1.create)((0, middle
|
|
|
74
74
|
get().initializeTools('Exchanges', exchanges, true);
|
|
75
75
|
},
|
|
76
76
|
}), {
|
|
77
|
-
name:
|
|
77
|
+
name: `li.fi-widget-settings`,
|
|
78
78
|
version: 2,
|
|
79
79
|
partialize: (state) => {
|
|
80
80
|
const { enabledBridges, enabledExchanges, ...partializedState } = state;
|
|
@@ -99,4 +99,20 @@ const createSettingsStore = ({ namePrefix }) => (0, zustand_1.create)((0, middle
|
|
|
99
99
|
return persistedState;
|
|
100
100
|
},
|
|
101
101
|
}));
|
|
102
|
-
|
|
102
|
+
const setDefaultSettings = (config) => {
|
|
103
|
+
const { slippage, routePriority, setValue } = exports.useSettingsStore.getState();
|
|
104
|
+
const defaultSlippage = (config?.slippage ||
|
|
105
|
+
config?.sdkConfig?.defaultRouteOptions?.slippage ||
|
|
106
|
+
0) * 100;
|
|
107
|
+
const defaultRoutePriority = config?.routePriority || config?.sdkConfig?.defaultRouteOptions?.order;
|
|
108
|
+
exports.defaultConfigurableSettings.slippage = (defaultSlippage || exports.defaultConfigurableSettings.slippage)?.toString();
|
|
109
|
+
exports.defaultConfigurableSettings.routePriority =
|
|
110
|
+
defaultRoutePriority || exports.defaultConfigurableSettings.routePriority;
|
|
111
|
+
if (!slippage) {
|
|
112
|
+
setValue('slippage', exports.defaultConfigurableSettings.slippage);
|
|
113
|
+
}
|
|
114
|
+
if (!routePriority) {
|
|
115
|
+
setValue('routePriority', exports.defaultConfigurableSettings.routePriority);
|
|
116
|
+
}
|
|
117
|
+
};
|
|
118
|
+
exports.setDefaultSettings = setDefaultSettings;
|
package/cjs/utils/colors.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type { Theme } from '@mui/material';
|
|
2
|
-
export declare const getContrastAlphaColor: (
|
|
1
|
+
import type { PaletteMode, Theme } from '@mui/material';
|
|
2
|
+
export declare const getContrastAlphaColor: (mode: PaletteMode, alpha: string | number) => string;
|
|
3
3
|
export declare const getContrastTextColor: (theme: Theme, background?: string) => "#fff" | "#000";
|
package/cjs/utils/colors.js
CHANGED
|
@@ -3,9 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.getContrastTextColor = exports.getContrastAlphaColor = void 0;
|
|
4
4
|
const colors_1 = require("@mui/material/colors");
|
|
5
5
|
const styles_1 = require("@mui/material/styles");
|
|
6
|
-
const getContrastAlphaColor = (
|
|
7
|
-
? `rgb(0 0 0 / ${alpha})`
|
|
8
|
-
: `rgb(255 255 255 / ${alpha})`;
|
|
6
|
+
const getContrastAlphaColor = (mode, alpha) => mode === 'light' ? `rgb(0 0 0 / ${alpha})` : `rgb(255 255 255 / ${alpha})`;
|
|
9
7
|
exports.getContrastAlphaColor = getContrastAlphaColor;
|
|
10
8
|
const getContrastTextColor = (theme, background) => (0, styles_1.getContrastRatio)(colors_1.common.white, background ?? theme.palette.primary.main) >= 3
|
|
11
9
|
? colors_1.common.white
|
|
@@ -38,7 +38,7 @@ export const ActiveSwapItem = ({ routeId, dense }) => {
|
|
|
38
38
|
}
|
|
39
39
|
};
|
|
40
40
|
const ListItemComponent = dense ? ListItem : ListItemButton;
|
|
41
|
-
return (_jsxs(ListItemComponent, { onClick: handleClick, dense: true, disableRipple:
|
|
41
|
+
return (_jsxs(ListItemComponent, { onClick: handleClick, dense: true, disableRipple: dense, children: [_jsx(ListItemAvatar, { children: _jsxs(TokenAvatarGroup, { total: 2, children: [_jsx(TokenAvatar, { token: route.fromToken }), _jsx(TokenAvatar, { token: route.toToken })] }) }), _jsx(ListItemText, { sx: { margin: 0 }, disableTypography: true, primary: _jsxs(Typography, { fontWeight: 500, lineHeight: 1, sx: {
|
|
42
42
|
display: 'flex',
|
|
43
43
|
alignItems: 'center',
|
|
44
44
|
marginLeft: 2,
|
|
@@ -35,11 +35,11 @@ export declare const ListItem: import("@emotion/styled").StyledComponent<{
|
|
|
35
35
|
} | undefined;
|
|
36
36
|
} & import("@mui/material/OverridableComponent").CommonProps & Omit<Omit<import("react").DetailedHTMLProps<import("react").LiHTMLAttributes<HTMLLIElement>, HTMLLIElement>, "ref"> & {
|
|
37
37
|
ref?: ((instance: HTMLLIElement | null) => void) | import("react").RefObject<HTMLLIElement> | null | undefined;
|
|
38
|
-
}, "button" | "className" | "style" | "classes" | "children" | "disabled" | "sx" | "alignItems" | "autoFocus" | "dense" | "divider" | "components" | "
|
|
38
|
+
}, "button" | "className" | "style" | "classes" | "children" | "disabled" | "sx" | "alignItems" | "autoFocus" | "dense" | "divider" | "components" | "slotProps" | "slots" | "componentsProps" | "selected" | "disableGutters" | "ContainerComponent" | "ContainerProps" | "disablePadding" | "secondaryAction"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
|
|
39
39
|
export declare const ShowAllButton: import("@emotion/styled").StyledComponent<{
|
|
40
40
|
children?: import("react").ReactNode;
|
|
41
41
|
classes?: Partial<import("@mui/material").ButtonClasses> | undefined;
|
|
42
|
-
color?: "inherit" | "success" | "warning" | "error" | "
|
|
42
|
+
color?: "inherit" | "success" | "warning" | "error" | "primary" | "secondary" | "info" | undefined;
|
|
43
43
|
disabled?: boolean | undefined;
|
|
44
44
|
disableElevation?: boolean | undefined;
|
|
45
45
|
disableFocusRipple?: boolean | undefined;
|
|
@@ -8,7 +8,7 @@ export const ListItemButton = styled(MuiListItemButton)(({ theme }) => ({
|
|
|
8
8
|
paddingRight: theme.spacing(1.5),
|
|
9
9
|
height: 64,
|
|
10
10
|
'&:hover': {
|
|
11
|
-
backgroundColor: getContrastAlphaColor(theme, '4%'),
|
|
11
|
+
backgroundColor: getContrastAlphaColor(theme.palette.mode, '4%'),
|
|
12
12
|
},
|
|
13
13
|
}));
|
|
14
14
|
export const ListItem = styled(MuiListItem, {
|
|
@@ -4,7 +4,6 @@ type CardVariant = 'default' | 'selected' | 'error';
|
|
|
4
4
|
export type CardProps = {
|
|
5
5
|
variant?: CardVariant;
|
|
6
6
|
selectionColor?: 'primary' | 'secondary';
|
|
7
|
-
dense?: boolean;
|
|
8
7
|
indented?: boolean;
|
|
9
8
|
onClick?: MouseEventHandler<HTMLDivElement>;
|
|
10
9
|
pointerEvents?: 'auto' | 'none';
|
|
@@ -19,7 +18,6 @@ export declare const Card: import("@emotion/styled").StyledComponent<import("@mu
|
|
|
19
18
|
}, "children" | "sx" | "ref" | ("p" | "color" | "border" | "boxShadow" | "fontWeight" | "zIndex" | "alignContent" | "alignItems" | "alignSelf" | "bottom" | "boxSizing" | "columnGap" | "display" | "flexBasis" | "flexDirection" | "flexGrow" | "flexShrink" | "flexWrap" | "fontFamily" | "fontSize" | "fontStyle" | "gridAutoColumns" | "gridAutoFlow" | "gridAutoRows" | "gridTemplateAreas" | "gridTemplateColumns" | "gridTemplateRows" | "height" | "justifyContent" | "justifyItems" | "justifySelf" | "left" | "letterSpacing" | "lineHeight" | "marginBottom" | "marginLeft" | "marginRight" | "marginTop" | "maxHeight" | "maxWidth" | "minHeight" | "minWidth" | "order" | "paddingBottom" | "paddingLeft" | "paddingRight" | "paddingTop" | "position" | "right" | "rowGap" | "textAlign" | "textOverflow" | "textTransform" | "top" | "visibility" | "whiteSpace" | "width" | "borderBottom" | "borderColor" | "borderLeft" | "borderRadius" | "borderRight" | "borderTop" | "flex" | "gap" | "gridArea" | "gridColumn" | "gridRow" | "margin" | "overflow" | "padding" | "bgcolor" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "marginX" | "my" | "marginY" | "pt" | "pr" | "pb" | "pl" | "px" | "paddingX" | "py" | "paddingY" | "typography" | "displayPrint") | "component"> & import("@mui/system").MUIStyledCommonProps<Theme> & {
|
|
20
19
|
variant?: CardVariant | undefined;
|
|
21
20
|
selectionColor?: "primary" | "secondary" | undefined;
|
|
22
|
-
dense?: boolean | undefined;
|
|
23
21
|
indented?: boolean | undefined;
|
|
24
22
|
onClick?: MouseEventHandler<HTMLDivElement> | undefined;
|
|
25
23
|
pointerEvents?: "none" | "auto" | undefined;
|
package/components/Card/Card.js
CHANGED
|
@@ -9,14 +9,8 @@ const getBackgroundColor = (theme, variant, selectionColor) => variant === 'sele
|
|
|
9
9
|
: alpha(theme.palette.secondary.main, theme.palette.mode === 'light' ? 0.08 : 0.12)
|
|
10
10
|
: theme.palette.background.paper;
|
|
11
11
|
export const Card = styled(Box, {
|
|
12
|
-
shouldForwardProp: (prop) => ![
|
|
13
|
-
|
|
14
|
-
'variant',
|
|
15
|
-
'indented',
|
|
16
|
-
'selectionColor',
|
|
17
|
-
'pointerEvents',
|
|
18
|
-
].includes(prop),
|
|
19
|
-
})(({ theme, variant, selectionColor = 'primary', dense, indented, pointerEvents, onClick, }) => {
|
|
12
|
+
shouldForwardProp: (prop) => !['variant', 'indented', 'selectionColor', 'pointerEvents'].includes(prop),
|
|
13
|
+
})(({ theme, variant, selectionColor = 'primary', indented, pointerEvents, onClick, }) => {
|
|
20
14
|
const backgroundColor = getBackgroundColor(theme, variant, selectionColor);
|
|
21
15
|
const backgroundHoverColor = onClick
|
|
22
16
|
? theme.palette.mode === 'light'
|
|
@@ -9,7 +9,6 @@ export declare const ChainCard: import("@emotion/styled").StyledComponent<import
|
|
|
9
9
|
}, "children" | "sx" | "ref" | ("p" | "color" | "border" | "boxShadow" | "fontWeight" | "zIndex" | "alignContent" | "alignItems" | "alignSelf" | "bottom" | "boxSizing" | "columnGap" | "display" | "flexBasis" | "flexDirection" | "flexGrow" | "flexShrink" | "flexWrap" | "fontFamily" | "fontSize" | "fontStyle" | "gridAutoColumns" | "gridAutoFlow" | "gridAutoRows" | "gridTemplateAreas" | "gridTemplateColumns" | "gridTemplateRows" | "height" | "justifyContent" | "justifyItems" | "justifySelf" | "left" | "letterSpacing" | "lineHeight" | "marginBottom" | "marginLeft" | "marginRight" | "marginTop" | "maxHeight" | "maxWidth" | "minHeight" | "minWidth" | "order" | "paddingBottom" | "paddingLeft" | "paddingRight" | "paddingTop" | "position" | "right" | "rowGap" | "textAlign" | "textOverflow" | "textTransform" | "top" | "visibility" | "whiteSpace" | "width" | "borderBottom" | "borderColor" | "borderLeft" | "borderRadius" | "borderRight" | "borderTop" | "flex" | "gap" | "gridArea" | "gridColumn" | "gridRow" | "margin" | "overflow" | "padding" | "bgcolor" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "marginX" | "my" | "marginY" | "pt" | "pr" | "pb" | "pl" | "px" | "paddingX" | "py" | "paddingY" | "typography" | "displayPrint") | "component"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme> & {
|
|
10
10
|
variant?: ("default" | "error" | "selected") | undefined;
|
|
11
11
|
selectionColor?: "primary" | "secondary" | undefined;
|
|
12
|
-
dense?: boolean | undefined;
|
|
13
12
|
indented?: boolean | undefined;
|
|
14
13
|
onClick?: import("react").MouseEventHandler<HTMLDivElement> | undefined;
|
|
15
14
|
pointerEvents?: "none" | "auto" | undefined;
|
|
@@ -21,7 +21,7 @@ export declare const Container: import("@emotion/styled").StyledComponent<import
|
|
|
21
21
|
export declare const WalletButton: import("@emotion/styled").StyledComponent<{
|
|
22
22
|
children?: import("react").ReactNode;
|
|
23
23
|
classes?: Partial<import("@mui/material").ButtonClasses> | undefined;
|
|
24
|
-
color?: "inherit" | "success" | "warning" | "error" | "
|
|
24
|
+
color?: "inherit" | "success" | "warning" | "error" | "primary" | "secondary" | "info" | undefined;
|
|
25
25
|
disabled?: boolean | undefined;
|
|
26
26
|
disableElevation?: boolean | undefined;
|
|
27
27
|
disableFocusRipple?: boolean | undefined;
|
|
@@ -52,7 +52,7 @@ const ConnectedButton = () => {
|
|
|
52
52
|
};
|
|
53
53
|
return (_jsxs(_Fragment, { children: [_jsx(WalletButton, { endIcon: _jsx(ExpandMoreIcon, {}), startIcon: _jsx(Avatar, { src: chain?.logoURI, alt: chain?.key, sx: { width: 24, height: 24 }, children: chain?.name[0] }), sx: {
|
|
54
54
|
marginRight: -1.25,
|
|
55
|
-
}, onClick: handleClick, children: walletAddress }), _jsxs(WalletMenu, { anchorEl: anchorEl, open: Boolean(anchorEl), onClose: handleClose, children: [_jsxs(MenuItem, { onClick: handleCopyAddress,
|
|
55
|
+
}, onClick: handleClick, children: walletAddress }), _jsxs(WalletMenu, { anchorEl: anchorEl, open: Boolean(anchorEl), onClose: handleClose, children: [_jsxs(MenuItem, { onClick: handleCopyAddress, children: [_jsx(ContentCopyIcon, {}), t(`button.copyAddress`)] }), _jsxs(MenuItem, { component: "a", onClick: handleClose, href: `${chain?.metamask.blockExplorerUrls[0]}address/${account.address}`, target: "_blank", children: [_jsx(OpenInNewOutlinedIcon, {}), t(`button.viewOnExplorer`)] }), _jsx(Button, { onClick: handleDisconnect, fullWidth: true, startIcon: _jsx(PowerSettingsIcon, {}), sx: {
|
|
56
56
|
marginTop: 1,
|
|
57
57
|
}, children: t(`button.disconnect`) })] })] }));
|
|
58
58
|
};
|
|
@@ -6,6 +6,6 @@ export const ListItemButton = styled(MuiListItemButton)(({ theme }) => ({
|
|
|
6
6
|
paddingLeft: theme.spacing(1.5),
|
|
7
7
|
height: 56,
|
|
8
8
|
'&:hover': {
|
|
9
|
-
backgroundColor: getContrastAlphaColor(theme, '4%'),
|
|
9
|
+
backgroundColor: getContrastAlphaColor(theme.palette.mode, '4%'),
|
|
10
10
|
},
|
|
11
11
|
}));
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
export declare const IconButton: import("@emotion/styled").StyledComponent<{
|
|
3
3
|
children?: import("react").ReactNode;
|
|
4
4
|
classes?: Partial<import("@mui/material").IconButtonClasses> | undefined;
|
|
5
|
-
color?: "inherit" | "default" | "success" | "warning" | "error" | "
|
|
5
|
+
color?: "inherit" | "default" | "success" | "warning" | "error" | "primary" | "secondary" | "info" | undefined;
|
|
6
6
|
disabled?: boolean | undefined;
|
|
7
7
|
disableFocusRipple?: boolean | undefined;
|
|
8
8
|
edge?: false | "end" | "start" | undefined;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
export declare const FormControl: import("@emotion/styled").StyledComponent<{
|
|
3
3
|
children?: import("react").ReactNode;
|
|
4
4
|
classes?: Partial<import("@mui/material").FormControlClasses> | undefined;
|
|
5
|
-
color?: "success" | "warning" | "error" | "
|
|
5
|
+
color?: "success" | "warning" | "error" | "primary" | "secondary" | "info" | undefined;
|
|
6
6
|
disabled?: boolean | undefined;
|
|
7
7
|
error?: boolean | undefined;
|
|
8
8
|
fullWidth?: boolean | undefined;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
export declare const LinkButton: import("@emotion/styled").StyledComponent<{
|
|
3
3
|
children?: import("react").ReactNode;
|
|
4
4
|
classes?: Partial<import("@mui/material").IconButtonClasses> | undefined;
|
|
5
|
-
color?: "inherit" | "default" | "success" | "warning" | "error" | "
|
|
5
|
+
color?: "inherit" | "default" | "success" | "warning" | "error" | "primary" | "secondary" | "info" | undefined;
|
|
6
6
|
disabled?: boolean | undefined;
|
|
7
7
|
disableFocusRipple?: boolean | undefined;
|
|
8
8
|
edge?: false | "end" | "start" | undefined;
|
|
@@ -4,7 +4,7 @@ export declare const minInputFontSize = 14;
|
|
|
4
4
|
export declare const FormControl: import("@emotion/styled").StyledComponent<{
|
|
5
5
|
children?: import("react").ReactNode;
|
|
6
6
|
classes?: Partial<import("@mui/material").FormControlClasses> | undefined;
|
|
7
|
-
color?: "success" | "warning" | "error" | "
|
|
7
|
+
color?: "success" | "warning" | "error" | "primary" | "secondary" | "info" | undefined;
|
|
8
8
|
disabled?: boolean | undefined;
|
|
9
9
|
error?: boolean | undefined;
|
|
10
10
|
fullWidth?: boolean | undefined;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
export declare const Button: import("@emotion/styled").StyledComponent<{
|
|
3
3
|
children?: import("react").ReactNode;
|
|
4
4
|
classes?: Partial<import("@mui/material").ButtonClasses> | undefined;
|
|
5
|
-
color?: "inherit" | "success" | "warning" | "error" | "
|
|
5
|
+
color?: "inherit" | "success" | "warning" | "error" | "primary" | "secondary" | "info" | undefined;
|
|
6
6
|
disabled?: boolean | undefined;
|
|
7
7
|
disableElevation?: boolean | undefined;
|
|
8
8
|
disableFocusRipple?: boolean | undefined;
|
|
@@ -25,7 +25,7 @@ export const SwapRouteCard = ({ route, active, variant = 'default', expanded, ..
|
|
|
25
25
|
? { ...route.fromToken, amount: route.fromAmount }
|
|
26
26
|
: { ...route.toToken, amount: route.toAmount };
|
|
27
27
|
const cardContent = (_jsxs(Box, { flex: 1, children: [widgetVariant !== 'refuel' && !useRecommendedRoute ? (_jsxs(Box, { display: "flex", justifyContent: "space-between", alignItems: "center", mb: 2, children: [_jsx(Label, { active: active ?? label !== alternativeTag, children: label }), variant === 'stretched' ? (_jsx(SwapRouteCardEssentials, { route: route })) : null] })) : null, _jsxs(Box, { display: "flex", justifyContent: "space-between", alignItems: "center", children: [_jsx(Token, { token: token, step: variant === 'stretched' ? route.steps[0] : undefined, disableDescription: variant === 'dense' && widgetVariant !== 'refuel' }), variant === 'stretched' && !expanded ? (_jsx(IconButton, { onClick: handleExpand, size: "small", children: cardExpanded ? _jsx(ExpandLessIcon, {}) : _jsx(ExpandMoreIcon, {}) })) : null] }), _jsx(Collapse, { timeout: 225, in: cardExpanded, mountOnEnter: true, unmountOnExit: true, children: route.steps.map((step) => (_jsx(StepActions, { step: step, mt: 2 }, step.id))) }), variant !== 'stretched' ? (_jsx(SwapRouteCardEssentials, { route: route, dense: true })) : null] }));
|
|
28
|
-
return widgetVariant === 'refuel' ? (cardContent) : (_jsx(Card, {
|
|
28
|
+
return widgetVariant === 'refuel' ? (cardContent) : (_jsx(Card, { variant: active ? 'selected' : 'default', selectionColor: "secondary", indented: true, ...other, children: cardContent }));
|
|
29
29
|
};
|
|
30
30
|
export const SwapRouteCardEssentials = ({ route, dense }) => {
|
|
31
31
|
const { t } = useTranslation();
|
|
@@ -17,7 +17,7 @@ export declare const Label: import("@emotion/styled").StyledComponent<import("@m
|
|
|
17
17
|
export declare const IconButton: import("@emotion/styled").StyledComponent<{
|
|
18
18
|
children?: import("react").ReactNode;
|
|
19
19
|
classes?: Partial<import("@mui/material").IconButtonClasses> | undefined;
|
|
20
|
-
color?: "inherit" | "default" | "success" | "warning" | "error" | "
|
|
20
|
+
color?: "inherit" | "default" | "success" | "warning" | "error" | "primary" | "secondary" | "info" | undefined;
|
|
21
21
|
disabled?: boolean | undefined;
|
|
22
22
|
disableFocusRipple?: boolean | undefined;
|
|
23
23
|
edge?: false | "end" | "start" | undefined;
|
|
@@ -7,5 +7,5 @@ export const SwapRouteCardSkeleton = ({ variant, ...other }) => {
|
|
|
7
7
|
const cardContent = (_jsxs(Box, { flex: 1, children: [widgetVariant !== 'refuel' && !useRecommendedRoute ? (_jsxs(Box, { display: "flex", justifyContent: "space-between", alignItems: "center", mb: 2, children: [_jsx(Skeleton, { variant: "rectangular", width: 118, height: 24, sx: (theme) => ({
|
|
8
8
|
borderRadius: `${theme.shape.borderRadiusSecondary}px`,
|
|
9
9
|
}) }), variant === 'stretched' ? (_jsxs(Box, { display: "flex", children: [_jsx(Skeleton, { variant: "text", width: 52, height: 24, sx: { marginRight: 2 } }), _jsx(Skeleton, { variant: "text", width: 44, height: 24, sx: { marginRight: 2 } }), _jsx(Skeleton, { variant: "text", width: 32, height: 24 })] })) : null] })) : null, _jsxs(Box, { children: [_jsxs(Box, { display: "flex", alignItems: "center", children: [_jsx(Box, { mr: 2, children: _jsx(Skeleton, { variant: "circular", width: 32, height: 32 }) }), _jsx(Skeleton, { variant: "text", width: 96, height: 32 })] }), _jsxs(Box, { ml: 6, display: "flex", alignItems: "center", children: [_jsx(Skeleton, { variant: "text", width: 102, height: 16, sx: { borderRadius: 0.5 } }), variant === 'stretched' ? (_jsx(Skeleton, { variant: "text", width: 72, height: 16, sx: { marginLeft: 1 } })) : null] })] }), variant !== 'stretched' ? (_jsxs(Box, { mt: 2, display: "flex", justifyContent: "space-between", children: [_jsx(Skeleton, { variant: "text", width: 48, height: 24 }), _jsx(Skeleton, { variant: "text", width: 48, height: 24 })] })) : null] }));
|
|
10
|
-
return widgetVariant === 'refuel' ? (cardContent) : (_jsx(Card, {
|
|
10
|
+
return widgetVariant === 'refuel' ? (cardContent) : (_jsx(Card, { indented: true, ...other, children: cardContent }));
|
|
11
11
|
};
|
|
@@ -35,4 +35,4 @@ export declare const ListItem: import("@emotion/styled").StyledComponent<{
|
|
|
35
35
|
} | undefined;
|
|
36
36
|
} & import("@mui/material/OverridableComponent").CommonProps & Omit<Omit<import("react").DetailedHTMLProps<import("react").LiHTMLAttributes<HTMLLIElement>, HTMLLIElement>, "ref"> & {
|
|
37
37
|
ref?: ((instance: HTMLLIElement | null) => void) | import("react").RefObject<HTMLLIElement> | null | undefined;
|
|
38
|
-
}, "button" | "className" | "style" | "classes" | "children" | "disabled" | "sx" | "alignItems" | "autoFocus" | "dense" | "divider" | "components" | "
|
|
38
|
+
}, "button" | "className" | "style" | "classes" | "children" | "disabled" | "sx" | "alignItems" | "autoFocus" | "dense" | "divider" | "components" | "slotProps" | "slots" | "componentsProps" | "selected" | "disableGutters" | "ContainerComponent" | "ContainerProps" | "disablePadding" | "secondaryAction"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
|
|
@@ -14,7 +14,7 @@ export const TokenListItem = memo(({ onClick, size, start, token, showBalance, i
|
|
|
14
14
|
export const TokenListItemButton = ({ onClick, token, showBalance, isBalanceLoading, }) => {
|
|
15
15
|
const { t } = useTranslation();
|
|
16
16
|
const tokenPrice = formatTokenPrice(token.amount, token.priceUSD);
|
|
17
|
-
return (_jsxs(ListItemButton, { onClick: onClick, dense: true,
|
|
17
|
+
return (_jsxs(ListItemButton, { onClick: onClick, dense: true, children: [_jsx(ListItemAvatar, { children: _jsx(Avatar, { src: token.logoURI, alt: token.symbol, children: token.symbol[0] }) }), _jsx(ListItemText, { primary: token.symbol, secondary: token.name }), showBalance ? (isBalanceLoading ? (_jsx(TokenAmountSkeleton, {})) : (_jsxs(Box, { sx: { textAlign: 'right' }, children: [Number(token.amount) ? (_jsx(Typography, { variant: "body1", noWrap: true, children: t('format.number', {
|
|
18
18
|
value: token.amount,
|
|
19
19
|
}) })) : null, tokenPrice ? (_jsx(Typography, { fontWeight: 400, fontSize: 12, color: "text.secondary", "data-price": token.priceUSD, children: t(`format.currency`, {
|
|
20
20
|
value: tokenPrice,
|
package/config/theme.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { loadingButtonClasses } from '@mui/lab/LoadingButton';
|
|
2
|
+
import { touchRippleClasses } from '@mui/material/ButtonBase';
|
|
2
3
|
import { common } from '@mui/material/colors';
|
|
3
4
|
import { dialogActionsClasses } from '@mui/material/DialogActions';
|
|
4
5
|
import { alpha, createTheme as createMuiTheme, darken, getContrastRatio, lighten, } from '@mui/material/styles';
|
|
6
|
+
import { keyframes } from '@mui/system';
|
|
5
7
|
const palette = {
|
|
6
8
|
primary: {
|
|
7
9
|
main: '#3F49E1',
|
|
@@ -41,6 +43,16 @@ const shape = {
|
|
|
41
43
|
borderRadius: 12,
|
|
42
44
|
borderRadiusSecondary: 8,
|
|
43
45
|
};
|
|
46
|
+
const enterKeyframe = keyframes `
|
|
47
|
+
0% {
|
|
48
|
+
transform: scale(0);
|
|
49
|
+
opacity: 0.05;
|
|
50
|
+
}
|
|
51
|
+
100% {
|
|
52
|
+
transform: scale(1);
|
|
53
|
+
opacity: 0.1;
|
|
54
|
+
}
|
|
55
|
+
`;
|
|
44
56
|
export const createTheme = (mode, theme = {}) => {
|
|
45
57
|
const primaryMainColor = theme.palette?.primary?.main ??
|
|
46
58
|
palette.primary.main;
|
|
@@ -104,6 +116,19 @@ export const createTheme = (mode, theme = {}) => {
|
|
|
104
116
|
},
|
|
105
117
|
},
|
|
106
118
|
},
|
|
119
|
+
MuiButtonBase: {
|
|
120
|
+
styleOverrides: {
|
|
121
|
+
root: {
|
|
122
|
+
[`& .${touchRippleClasses.ripple}.${touchRippleClasses.rippleVisible}`]: {
|
|
123
|
+
animationName: `${enterKeyframe}`,
|
|
124
|
+
},
|
|
125
|
+
[`& .${touchRippleClasses.ripple}.${touchRippleClasses.rippleVisible}`]: {
|
|
126
|
+
opacity: 0.1,
|
|
127
|
+
animationName: `${enterKeyframe}`,
|
|
128
|
+
},
|
|
129
|
+
},
|
|
130
|
+
},
|
|
131
|
+
},
|
|
107
132
|
MuiButton: {
|
|
108
133
|
defaultProps: {
|
|
109
134
|
disableElevation: true,
|
package/config/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export declare const name = "@lifi/widget";
|
|
2
|
-
export declare const version = "1.32.
|
|
2
|
+
export declare const version = "1.32.2";
|
package/config/version.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export const name = '@lifi/widget';
|
|
2
|
-
export const version = '1.32.
|
|
2
|
+
export const version = '1.32.2';
|