@lifi/widget 1.15.0 → 1.16.1
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/App.js +21 -0
- package/AppProvider.d.ts +0 -4
- package/AppProvider.js +2 -10
- package/cjs/App.js +21 -0
- package/cjs/AppProvider.d.ts +0 -4
- package/cjs/AppProvider.js +3 -12
- package/cjs/components/ActiveSwaps/ActiveSwapItem.d.ts +5 -0
- package/cjs/components/ActiveSwaps/ActiveSwapItem.js +45 -0
- package/cjs/components/{SwapsInProgress/SwapsInProgress.d.ts → ActiveSwaps/ActiveSwaps.d.ts} +1 -1
- package/cjs/components/ActiveSwaps/ActiveSwaps.js +30 -0
- package/cjs/components/ActiveSwaps/ActiveSwaps.style.d.ts +78 -0
- package/cjs/components/ActiveSwaps/ActiveSwaps.style.js +40 -0
- package/cjs/components/ActiveSwaps/index.d.ts +2 -0
- package/cjs/components/ActiveSwaps/index.js +18 -0
- package/cjs/components/AppContainer.js +2 -2
- package/cjs/components/Card/Card.d.ts +7 -4
- package/cjs/components/Card/Card.js +38 -28
- package/cjs/{pages/SelectTokenPage → components/ChainSelect}/ChainSelect.d.ts +0 -0
- package/cjs/components/ChainSelect/ChainSelect.js +35 -0
- package/cjs/components/{SwapsInProgress/SwapsInProgress.style.d.ts → ChainSelect/ChainSelect.style.d.ts} +10 -19
- package/cjs/components/ChainSelect/ChainSelect.style.js +19 -0
- package/cjs/components/ChainSelect/index.d.ts +2 -0
- package/cjs/components/ChainSelect/index.js +18 -0
- package/cjs/components/ChainSelect/useChainSelect.d.ts +8 -0
- package/cjs/components/ChainSelect/useChainSelect.js +33 -0
- package/cjs/components/Header/Header.js +1 -9
- package/cjs/components/Header/NavigationHeader.js +6 -11
- package/cjs/components/PoweredBy/PoweredBy.style.d.ts +1 -1
- package/cjs/components/PoweredBy/PoweredBy.style.js +1 -0
- package/cjs/components/SelectChainAndToken.js +5 -5
- package/cjs/components/SendToWallet/SendToWallet.js +6 -6
- package/cjs/components/Step/CircularProgress.js +1 -1
- package/cjs/components/Step/CircularProgress.style.js +1 -1
- package/cjs/components/Step/StepProcess.js +1 -5
- package/cjs/components/Step/StepProcess.style.d.ts +1 -1
- package/cjs/components/Step/StepTimer.d.ts +1 -0
- package/cjs/components/Step/StepTimer.js +6 -6
- package/cjs/components/SwapButton/SwapButton.js +5 -12
- package/cjs/components/SwapButton/types.d.ts +2 -2
- package/cjs/components/SwapRouteCard/SwapRouteCard.js +1 -1
- package/cjs/components/TokenAvatar/TokenAvatar.style.js +0 -3
- package/cjs/components/TokenList/TokenList.js +6 -2
- package/cjs/config/theme.js +24 -23
- package/cjs/config/version.d.ts +1 -1
- package/cjs/config/version.js +1 -1
- package/cjs/hooks/index.d.ts +2 -0
- package/cjs/hooks/index.js +2 -0
- package/cjs/hooks/useChains.d.ts +1 -97
- package/cjs/hooks/useChains.js +12 -19
- package/cjs/hooks/useFeaturedTokens.js +2 -2
- package/cjs/hooks/useGasSufficiency.js +6 -7
- package/cjs/hooks/useInitializer.js +6 -0
- package/cjs/{components/Step/utils.d.ts → hooks/useProcessMessage.d.ts} +4 -0
- package/cjs/{components/Step/utils.js → hooks/useProcessMessage.js} +16 -10
- package/cjs/hooks/useRouteExecution.d.ts +1 -1
- package/cjs/hooks/useRouteExecution.js +26 -35
- package/cjs/hooks/useSwapRoutes.js +10 -11
- package/cjs/hooks/useTokenBalances.js +4 -4
- package/cjs/hooks/useTokenSearch.js +3 -2
- package/cjs/hooks/useTokens.js +3 -2
- package/cjs/hooks/useTools.js +3 -2
- package/cjs/hooks/useWidgetEvents.d.ts +3 -0
- package/cjs/hooks/useWidgetEvents.js +13 -0
- package/cjs/i18n/en/translation.json +13 -8
- package/cjs/i18n/index.d.ts +10 -5
- package/cjs/index.d.ts +1 -0
- package/cjs/index.js +3 -1
- package/cjs/pages/ActiveSwapsPage/ActiveSwapsEmpty.d.ts +2 -0
- package/cjs/pages/ActiveSwapsPage/ActiveSwapsEmpty.js +18 -0
- package/cjs/pages/ActiveSwapsPage/ActiveSwapsPage.d.ts +2 -0
- package/cjs/pages/ActiveSwapsPage/ActiveSwapsPage.js +21 -0
- package/cjs/pages/ActiveSwapsPage/index.d.ts +1 -0
- package/cjs/{components/SwapsInProgress → pages/ActiveSwapsPage}/index.js +1 -1
- package/cjs/pages/MainPage/MainPage.js +2 -3
- package/cjs/pages/MainPage/MainSwapButton.js +3 -1
- package/cjs/pages/MainPage/SwapRoutes.js +4 -1
- package/cjs/pages/SelectChainPage/SelectChainPage.d.ts +3 -0
- package/cjs/pages/SelectChainPage/SelectChainPage.js +33 -0
- package/cjs/pages/SelectChainPage/SelectChainPage.style.d.ts +21 -0
- package/cjs/pages/SelectChainPage/SelectChainPage.style.js +20 -0
- package/cjs/pages/SelectChainPage/index.d.ts +1 -0
- package/cjs/pages/SelectChainPage/index.js +17 -0
- package/cjs/pages/SelectTokenPage/SelectTokenPage.d.ts +2 -4
- package/cjs/pages/SelectTokenPage/SelectTokenPage.js +2 -2
- package/cjs/pages/SelectWalletPage/SelectWalletPage.js +4 -4
- package/cjs/pages/SelectWalletPage/SelectWalletPage.style.d.ts +2 -27
- package/cjs/pages/SelectWalletPage/SelectWalletPage.style.js +4 -14
- package/cjs/pages/SettingsPage/ColorSchemeButtonGroup.style.d.ts +1 -1
- package/cjs/pages/SettingsPage/EnabledBridgesSelect.js +3 -6
- package/cjs/pages/SettingsPage/EnabledExchangesSelect.js +3 -5
- package/cjs/pages/SettingsPage/RoutePrioritySelect.js +5 -1
- package/cjs/pages/SwapDetailsPage/SwapDetailsPage.js +1 -1
- package/cjs/pages/SwapPage/StatusBottomSheet.js +25 -36
- package/cjs/pages/SwapPage/SwapPage.js +5 -1
- package/cjs/providers/SDKProvider/SDKProvider.d.ts +4 -0
- package/cjs/providers/SDKProvider/SDKProvider.js +27 -0
- package/cjs/providers/SDKProvider/index.d.ts +1 -0
- package/cjs/providers/SDKProvider/index.js +17 -0
- package/cjs/providers/SwapFormProvider/SwapFormProvider.js +39 -11
- package/cjs/providers/TelemetryProvider/TelemetryProvider.d.ts +4 -0
- package/cjs/providers/TelemetryProvider/TelemetryProvider.js +11 -0
- package/cjs/providers/TelemetryProvider/index.d.ts +1 -0
- package/cjs/providers/TelemetryProvider/index.js +17 -0
- package/cjs/providers/WalletProvider/WalletProvider.d.ts +1 -4
- package/cjs/providers/WalletProvider/WalletProvider.js +10 -3
- package/cjs/providers/WidgetProvider/WidgetProvider.js +1 -16
- package/cjs/providers/index.d.ts +2 -0
- package/cjs/providers/index.js +2 -0
- package/cjs/stores/chains/index.d.ts +4 -0
- package/cjs/stores/chains/index.js +20 -0
- package/cjs/stores/chains/types.d.ts +8 -0
- package/cjs/stores/chains/types.js +2 -0
- package/cjs/stores/chains/useChainOrder.d.ts +1 -0
- package/cjs/stores/chains/useChainOrder.js +12 -0
- package/cjs/stores/chains/useChainOrderStore.d.ts +19 -0
- package/cjs/stores/chains/useChainOrderStore.js +42 -0
- package/cjs/stores/chains/useInitializeChainOrder.d.ts +1 -0
- package/cjs/stores/chains/useInitializeChainOrder.js +12 -0
- package/cjs/stores/route/index.d.ts +2 -1
- package/cjs/stores/route/index.js +2 -1
- package/cjs/stores/route/useExecutingRoutesIds.d.ts +1 -0
- package/cjs/stores/route/useExecutingRoutesIds.js +20 -0
- package/cjs/stores/route/useRouteStore.js +5 -4
- package/cjs/stores/route/utils.d.ts +4 -0
- package/cjs/stores/route/utils.js +21 -0
- package/cjs/stores/settings/useSettingsStore.js +5 -2
- package/cjs/types/events.d.ts +5 -0
- package/cjs/types/events.js +9 -0
- package/cjs/types/index.d.ts +1 -0
- package/cjs/types/index.js +1 -0
- package/cjs/types/widget.d.ts +2 -1
- package/cjs/utils/colors.d.ts +1 -1
- package/cjs/utils/navigationRoutes.d.ts +5 -0
- package/cjs/utils/navigationRoutes.js +31 -4
- package/components/ActiveSwaps/ActiveSwapItem.d.ts +5 -0
- package/components/ActiveSwaps/ActiveSwapItem.js +41 -0
- package/components/{SwapsInProgress/SwapsInProgress.d.ts → ActiveSwaps/ActiveSwaps.d.ts} +1 -1
- package/components/ActiveSwaps/ActiveSwaps.js +26 -0
- package/components/ActiveSwaps/ActiveSwaps.style.d.ts +78 -0
- package/components/ActiveSwaps/ActiveSwaps.style.js +37 -0
- package/components/ActiveSwaps/index.d.ts +2 -0
- package/components/ActiveSwaps/index.js +2 -0
- package/components/AppContainer.js +1 -1
- package/components/Card/Card.d.ts +7 -4
- package/components/Card/Card.js +39 -29
- package/{pages/SelectTokenPage → components/ChainSelect}/ChainSelect.d.ts +0 -0
- package/components/ChainSelect/ChainSelect.js +31 -0
- package/components/{SwapsInProgress/SwapsInProgress.style.d.ts → ChainSelect/ChainSelect.style.d.ts} +10 -19
- package/components/ChainSelect/ChainSelect.style.js +16 -0
- package/components/ChainSelect/index.d.ts +2 -0
- package/components/ChainSelect/index.js +2 -0
- package/components/ChainSelect/useChainSelect.d.ts +8 -0
- package/components/ChainSelect/useChainSelect.js +29 -0
- package/components/Header/Header.js +1 -9
- package/components/Header/NavigationHeader.js +6 -11
- package/components/PoweredBy/PoweredBy.style.d.ts +1 -1
- package/components/PoweredBy/PoweredBy.style.js +1 -0
- package/components/SelectChainAndToken.js +1 -1
- package/components/SendToWallet/SendToWallet.js +6 -6
- package/components/Step/CircularProgress.js +3 -3
- package/components/Step/CircularProgress.style.js +1 -1
- package/components/Step/StepProcess.js +2 -6
- package/components/Step/StepProcess.style.d.ts +1 -1
- package/components/Step/StepTimer.d.ts +1 -0
- package/components/Step/StepTimer.js +6 -6
- package/components/SwapButton/SwapButton.js +6 -13
- package/components/SwapButton/types.d.ts +2 -2
- package/components/SwapRouteCard/SwapRouteCard.js +1 -1
- package/components/TokenAvatar/TokenAvatar.style.js +0 -3
- package/components/TokenList/TokenList.js +6 -2
- package/config/theme.js +24 -23
- package/config/version.d.ts +1 -1
- package/config/version.js +1 -1
- package/hooks/index.d.ts +2 -0
- package/hooks/index.js +2 -0
- package/hooks/useChains.d.ts +1 -97
- package/hooks/useChains.js +11 -18
- package/hooks/useFeaturedTokens.js +1 -1
- package/hooks/useGasSufficiency.js +1 -2
- package/hooks/useInitializer.js +6 -0
- package/{components/Step/utils.d.ts → hooks/useProcessMessage.d.ts} +4 -0
- package/{pages/SwapPage/utils.js → hooks/useProcessMessage.js} +15 -10
- package/hooks/useRouteExecution.d.ts +1 -1
- package/hooks/useRouteExecution.js +26 -35
- package/hooks/useSwapRoutes.js +3 -4
- package/hooks/useTokenBalances.js +3 -3
- package/hooks/useTokenSearch.js +3 -2
- package/hooks/useTokens.js +3 -2
- package/hooks/useTools.js +3 -2
- package/hooks/useWidgetEvents.d.ts +3 -0
- package/hooks/useWidgetEvents.js +6 -0
- package/i18n/en/translation.json +13 -8
- package/i18n/index.d.ts +10 -5
- package/index.d.ts +1 -0
- package/index.js +1 -0
- package/package.json +14 -13
- package/pages/ActiveSwapsPage/ActiveSwapsEmpty.d.ts +2 -0
- package/pages/ActiveSwapsPage/ActiveSwapsEmpty.js +14 -0
- package/pages/ActiveSwapsPage/ActiveSwapsPage.d.ts +2 -0
- package/pages/ActiveSwapsPage/ActiveSwapsPage.js +17 -0
- package/pages/ActiveSwapsPage/index.d.ts +1 -0
- package/pages/ActiveSwapsPage/index.js +1 -0
- package/pages/MainPage/MainPage.js +2 -3
- package/pages/MainPage/MainSwapButton.js +3 -1
- package/pages/MainPage/SwapRoutes.js +4 -1
- package/pages/SelectChainPage/SelectChainPage.d.ts +3 -0
- package/pages/SelectChainPage/SelectChainPage.js +29 -0
- package/pages/SelectChainPage/SelectChainPage.style.d.ts +21 -0
- package/pages/SelectChainPage/SelectChainPage.style.js +17 -0
- package/pages/SelectChainPage/index.d.ts +1 -0
- package/pages/SelectChainPage/index.js +1 -0
- package/pages/SelectTokenPage/SelectTokenPage.d.ts +2 -4
- package/pages/SelectTokenPage/SelectTokenPage.js +2 -2
- package/pages/SelectWalletPage/SelectWalletPage.js +5 -5
- package/pages/SelectWalletPage/SelectWalletPage.style.d.ts +2 -27
- package/pages/SelectWalletPage/SelectWalletPage.style.js +4 -14
- package/pages/SettingsPage/ColorSchemeButtonGroup.style.d.ts +1 -1
- package/pages/SettingsPage/EnabledBridgesSelect.js +4 -7
- package/pages/SettingsPage/EnabledExchangesSelect.js +4 -6
- package/pages/SettingsPage/RoutePrioritySelect.js +5 -1
- package/pages/SwapDetailsPage/SwapDetailsPage.js +1 -1
- package/pages/SwapPage/StatusBottomSheet.js +27 -38
- package/pages/SwapPage/SwapPage.js +5 -1
- package/providers/SDKProvider/SDKProvider.d.ts +4 -0
- package/providers/SDKProvider/SDKProvider.js +19 -0
- package/providers/SDKProvider/index.d.ts +1 -0
- package/providers/SDKProvider/index.js +1 -0
- package/providers/SwapFormProvider/SwapFormProvider.js +39 -11
- package/providers/TelemetryProvider/TelemetryProvider.d.ts +4 -0
- package/providers/TelemetryProvider/TelemetryProvider.js +7 -0
- package/providers/TelemetryProvider/index.d.ts +1 -0
- package/providers/TelemetryProvider/index.js +1 -0
- package/providers/WalletProvider/WalletProvider.d.ts +1 -4
- package/providers/WalletProvider/WalletProvider.js +10 -3
- package/providers/WidgetProvider/WidgetProvider.js +3 -18
- package/providers/index.d.ts +2 -0
- package/providers/index.js +2 -0
- package/stores/chains/index.d.ts +4 -0
- package/stores/chains/index.js +4 -0
- package/stores/chains/types.d.ts +8 -0
- package/stores/chains/types.js +1 -0
- package/stores/chains/useChainOrder.d.ts +1 -0
- package/stores/chains/useChainOrder.js +5 -0
- package/stores/chains/useChainOrderStore.d.ts +19 -0
- package/stores/chains/useChainOrderStore.js +36 -0
- package/stores/chains/useInitializeChainOrder.d.ts +1 -0
- package/stores/chains/useInitializeChainOrder.js +5 -0
- package/stores/route/index.d.ts +2 -1
- package/stores/route/index.js +2 -1
- package/stores/route/useExecutingRoutesIds.d.ts +1 -0
- package/stores/route/useExecutingRoutesIds.js +13 -0
- package/stores/route/useRouteStore.js +5 -4
- package/stores/route/utils.d.ts +4 -0
- package/stores/route/utils.js +15 -0
- package/stores/settings/useSettingsStore.js +5 -2
- package/tsconfig.cjs.tsbuildinfo +1 -1
- package/types/events.d.ts +5 -0
- package/types/events.js +6 -0
- package/types/index.d.ts +1 -0
- package/types/index.js +1 -0
- package/types/widget.d.ts +2 -1
- package/utils/colors.d.ts +1 -1
- package/utils/navigationRoutes.d.ts +5 -0
- package/utils/navigationRoutes.js +30 -3
- package/cjs/components/SwapButton/SwapButton.style.d.ts +0 -65
- package/cjs/components/SwapButton/SwapButton.style.js +0 -15
- package/cjs/components/SwapsInProgress/SwapsInProgress.js +0 -29
- package/cjs/components/SwapsInProgress/SwapsInProgress.style.js +0 -17
- package/cjs/components/SwapsInProgress/index.d.ts +0 -1
- package/cjs/config/lifi.d.ts +0 -4
- package/cjs/config/lifi.js +0 -14
- package/cjs/pages/SelectTokenPage/ChainSelect.js +0 -31
- package/cjs/pages/SwapPage/utils.d.ts +0 -6
- package/cjs/pages/SwapPage/utils.js +0 -93
- package/cjs/stores/route/useExecutingRoutes.d.ts +0 -2
- package/cjs/stores/route/useExecutingRoutes.js +0 -13
- package/components/Step/utils.js +0 -89
- package/components/SwapButton/SwapButton.style.d.ts +0 -65
- package/components/SwapButton/SwapButton.style.js +0 -12
- package/components/SwapsInProgress/SwapsInProgress.js +0 -25
- package/components/SwapsInProgress/SwapsInProgress.style.js +0 -14
- package/components/SwapsInProgress/index.d.ts +0 -1
- package/components/SwapsInProgress/index.js +0 -1
- package/config/lifi.d.ts +0 -4
- package/config/lifi.js +0 -7
- package/pages/SelectTokenPage/ChainSelect.js +0 -27
- package/pages/SwapPage/utils.d.ts +0 -6
- package/stores/route/useExecutingRoutes.d.ts +0 -2
- package/stores/route/useExecutingRoutes.js +0 -6
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.useSetChainOrder = void 0;
|
|
7
|
+
const shallow_1 = __importDefault(require("zustand/shallow"));
|
|
8
|
+
const useChainOrderStore_1 = require("./useChainOrderStore");
|
|
9
|
+
const useSetChainOrder = () => {
|
|
10
|
+
return (0, useChainOrderStore_1.useChainOrderStore)((state) => [state.setChain, state.initializeChains], shallow_1.default);
|
|
11
|
+
};
|
|
12
|
+
exports.useSetChainOrder = useSetChainOrder;
|
|
@@ -15,7 +15,8 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./types"), exports);
|
|
18
|
-
__exportStar(require("./
|
|
18
|
+
__exportStar(require("./useExecutingRoutesIds"), exports);
|
|
19
19
|
__exportStar(require("./useRouteStore"), exports);
|
|
20
20
|
__exportStar(require("./useSetExecutableRoute"), exports);
|
|
21
21
|
__exportStar(require("./useSwapHistory"), exports);
|
|
22
|
+
__exportStar(require("./utils"), exports);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const useExecutingRoutesIds: (address?: string) => string[];
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.useExecutingRoutesIds = void 0;
|
|
7
|
+
const shallow_1 = __importDefault(require("zustand/shallow"));
|
|
8
|
+
const useRouteStore_1 = require("./useRouteStore");
|
|
9
|
+
const useExecutingRoutesIds = (address) => {
|
|
10
|
+
return (0, useRouteStore_1.useRouteStore)((state) => Object.values(state.routes)
|
|
11
|
+
.filter((item) => item.route.fromAddress === address &&
|
|
12
|
+
(item.status === 'loading' || item.status === 'error'))
|
|
13
|
+
.sort((a, b) => {
|
|
14
|
+
var _a, _b, _c, _d;
|
|
15
|
+
return ((_b = (_a = b === null || b === void 0 ? void 0 : b.route.steps[0].execution) === null || _a === void 0 ? void 0 : _a.process[0].startedAt) !== null && _b !== void 0 ? _b : 0) -
|
|
16
|
+
((_d = (_c = a === null || a === void 0 ? void 0 : a.route.steps[0].execution) === null || _c === void 0 ? void 0 : _c.process[0].startedAt) !== null && _d !== void 0 ? _d : 0);
|
|
17
|
+
})
|
|
18
|
+
.map(({ route }) => route.id), shallow_1.default);
|
|
19
|
+
};
|
|
20
|
+
exports.useExecutingRoutesIds = useExecutingRoutesIds;
|
|
@@ -7,6 +7,7 @@ exports.useRouteStore = void 0;
|
|
|
7
7
|
const zustand_1 = __importDefault(require("zustand"));
|
|
8
8
|
const middleware_1 = require("zustand/middleware");
|
|
9
9
|
const immer_1 = require("zustand/middleware/immer");
|
|
10
|
+
const utils_1 = require("./utils");
|
|
10
11
|
exports.useRouteStore = (0, zustand_1.default)()((0, middleware_1.persist)((0, immer_1.immer)((set) => ({
|
|
11
12
|
routes: {},
|
|
12
13
|
setExecutableRoute: (route) => set((state) => {
|
|
@@ -24,12 +25,12 @@ exports.useRouteStore = (0, zustand_1.default)()((0, middleware_1.persist)((0, i
|
|
|
24
25
|
updateRoute: (route) => set((state) => {
|
|
25
26
|
if (state.routes[route.id]) {
|
|
26
27
|
state.routes[route.id].route = route;
|
|
27
|
-
const isFailed =
|
|
28
|
+
const isFailed = (0, utils_1.isRouteFailed)(route);
|
|
28
29
|
if (isFailed) {
|
|
29
30
|
state.routes[route.id].status = 'error';
|
|
30
31
|
return;
|
|
31
32
|
}
|
|
32
|
-
const isDone =
|
|
33
|
+
const isDone = (0, utils_1.isRouteCompleted)(route);
|
|
33
34
|
if (isDone) {
|
|
34
35
|
state.routes[route.id].status = 'success';
|
|
35
36
|
return;
|
|
@@ -68,12 +69,12 @@ exports.useRouteStore = (0, zustand_1.default)()((0, middleware_1.persist)((0, i
|
|
|
68
69
|
route,
|
|
69
70
|
status: 'idle',
|
|
70
71
|
};
|
|
71
|
-
const isFailed =
|
|
72
|
+
const isFailed = (0, utils_1.isRouteFailed)(route);
|
|
72
73
|
if (isFailed) {
|
|
73
74
|
state.routes[route.id].status = 'error';
|
|
74
75
|
return;
|
|
75
76
|
}
|
|
76
|
-
const isDone =
|
|
77
|
+
const isDone = (0, utils_1.isRouteCompleted)(route);
|
|
77
78
|
if (isDone) {
|
|
78
79
|
state.routes[route.id].status = 'success';
|
|
79
80
|
return;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isRouteActive = exports.isRouteFailed = exports.isRouteCompleted = void 0;
|
|
4
|
+
const isRouteCompleted = (route) => {
|
|
5
|
+
return route.steps.every((step) => { var _a; return ((_a = step.execution) === null || _a === void 0 ? void 0 : _a.status) === 'DONE'; });
|
|
6
|
+
};
|
|
7
|
+
exports.isRouteCompleted = isRouteCompleted;
|
|
8
|
+
const isRouteFailed = (route) => {
|
|
9
|
+
return route.steps.some((step) => { var _a; return ((_a = step.execution) === null || _a === void 0 ? void 0 : _a.status) === 'FAILED'; });
|
|
10
|
+
};
|
|
11
|
+
exports.isRouteFailed = isRouteFailed;
|
|
12
|
+
const isRouteActive = (route) => {
|
|
13
|
+
if (!route) {
|
|
14
|
+
return false;
|
|
15
|
+
}
|
|
16
|
+
const isDone = (0, exports.isRouteCompleted)(route);
|
|
17
|
+
const isFailed = (0, exports.isRouteFailed)(route);
|
|
18
|
+
const alreadyStarted = route.steps.some((step) => step.execution);
|
|
19
|
+
return !isDone && !isFailed && alreadyStarted;
|
|
20
|
+
};
|
|
21
|
+
exports.isRouteActive = isRouteActive;
|
|
@@ -42,12 +42,15 @@ exports.useSettingsStore = (0, zustand_1.default)()((0, middleware_1.persist)((0
|
|
|
42
42
|
return;
|
|
43
43
|
}
|
|
44
44
|
if (state[`_enabled${toolType}`]) {
|
|
45
|
-
|
|
46
|
-
|
|
45
|
+
// Add a new tools
|
|
46
|
+
const enabledTools = tools
|
|
47
|
+
.filter((tool) => !Object.prototype.hasOwnProperty.call(state[`_enabled${toolType}`], tool))
|
|
47
48
|
.reduce((values, tool) => {
|
|
48
49
|
values[tool] = true;
|
|
49
50
|
return values;
|
|
50
51
|
}, state[`_enabled${toolType}`]);
|
|
52
|
+
// Filter tools we no longer have
|
|
53
|
+
state[`_enabled${toolType}`] = Object.fromEntries(Object.entries(enabledTools).filter(([key]) => tools.includes(key)));
|
|
51
54
|
}
|
|
52
55
|
else {
|
|
53
56
|
state[`_enabled${toolType}`] = tools.reduce((values, tool) => {
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.WidgetEvent = void 0;
|
|
4
|
+
var WidgetEvent;
|
|
5
|
+
(function (WidgetEvent) {
|
|
6
|
+
WidgetEvent["SwapStarted"] = "swapStarted";
|
|
7
|
+
WidgetEvent["SwapCompleted"] = "swapCompleted";
|
|
8
|
+
WidgetEvent["SwapFailed"] = "swapFailed";
|
|
9
|
+
})(WidgetEvent = exports.WidgetEvent || (exports.WidgetEvent = {}));
|
package/cjs/types/index.d.ts
CHANGED
package/cjs/types/index.js
CHANGED
|
@@ -14,5 +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("./events"), exports);
|
|
17
18
|
__exportStar(require("./token"), exports);
|
|
18
19
|
__exportStar(require("./widget"), exports);
|
package/cjs/types/widget.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ChainKey, Token } from '@lifi/sdk';
|
|
1
|
+
import type { ChainKey, ConfigUpdate, Token } from '@lifi/sdk';
|
|
2
2
|
import type { PaletteMode, PaletteOptions, Shape } from '@mui/material';
|
|
3
3
|
import type { TypographyOptions } from '@mui/material/styles/createTypography';
|
|
4
4
|
import type { Signer } from 'ethers';
|
|
@@ -29,6 +29,7 @@ interface WidgetConfigBase {
|
|
|
29
29
|
integrator?: string;
|
|
30
30
|
disabledChains?: number[];
|
|
31
31
|
featuredTokens?: Token[];
|
|
32
|
+
sdkConfig?: ConfigUpdate;
|
|
32
33
|
}
|
|
33
34
|
declare type WidgetFromTokenConfig = {
|
|
34
35
|
fromChain: `${ChainKey}` | number;
|
package/cjs/utils/colors.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { Theme } from '@mui/material';
|
|
2
2
|
export declare const getContrastAlphaColor: (theme: Theme, alpha: string | number) => string;
|
|
3
|
-
export declare const getContrastTextColor: (theme: Theme, background?: string) => "#
|
|
3
|
+
export declare const getContrastTextColor: (theme: Theme, background?: string) => "#000" | "#fff";
|
|
@@ -4,10 +4,15 @@ export declare const navigationRoutes: {
|
|
|
4
4
|
settings: string;
|
|
5
5
|
fromToken: string;
|
|
6
6
|
toToken: string;
|
|
7
|
+
fromChain: string;
|
|
8
|
+
toChain: string;
|
|
7
9
|
swapRoutes: string;
|
|
8
10
|
swapExecution: string;
|
|
9
11
|
swapHistory: string;
|
|
12
|
+
activeSwaps: string;
|
|
10
13
|
swapDetails: string;
|
|
11
14
|
};
|
|
12
15
|
export declare const navigationRoutesValues: string[];
|
|
16
|
+
export declare const stickyHeaderRoutes: string[];
|
|
17
|
+
export declare const backButtonRoutes: string[];
|
|
13
18
|
export declare type NavigationRouteType = keyof typeof navigationRoutes;
|
|
@@ -1,15 +1,42 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.navigationRoutesValues = exports.navigationRoutes = void 0;
|
|
3
|
+
exports.backButtonRoutes = exports.stickyHeaderRoutes = exports.navigationRoutesValues = exports.navigationRoutes = void 0;
|
|
4
4
|
exports.navigationRoutes = {
|
|
5
5
|
home: '/',
|
|
6
|
-
selectWallet: '
|
|
6
|
+
selectWallet: 'wallet',
|
|
7
7
|
settings: 'settings',
|
|
8
|
-
fromToken: '
|
|
9
|
-
toToken: '
|
|
8
|
+
fromToken: 'from-token',
|
|
9
|
+
toToken: 'to-token',
|
|
10
|
+
fromChain: 'from-chain',
|
|
11
|
+
toChain: 'to-chain',
|
|
10
12
|
swapRoutes: 'swap-routes',
|
|
11
13
|
swapExecution: 'swap-execution',
|
|
12
14
|
swapHistory: 'swap-history',
|
|
15
|
+
activeSwaps: 'active-swaps',
|
|
13
16
|
swapDetails: 'swap-details',
|
|
14
17
|
};
|
|
15
18
|
exports.navigationRoutesValues = Object.values(exports.navigationRoutes);
|
|
19
|
+
exports.stickyHeaderRoutes = [
|
|
20
|
+
exports.navigationRoutes.selectWallet,
|
|
21
|
+
exports.navigationRoutes.fromChain,
|
|
22
|
+
exports.navigationRoutes.toChain,
|
|
23
|
+
exports.navigationRoutes.settings,
|
|
24
|
+
exports.navigationRoutes.swapRoutes,
|
|
25
|
+
exports.navigationRoutes.swapExecution,
|
|
26
|
+
exports.navigationRoutes.swapHistory,
|
|
27
|
+
exports.navigationRoutes.activeSwaps,
|
|
28
|
+
exports.navigationRoutes.swapDetails,
|
|
29
|
+
];
|
|
30
|
+
exports.backButtonRoutes = [
|
|
31
|
+
exports.navigationRoutes.selectWallet,
|
|
32
|
+
exports.navigationRoutes.settings,
|
|
33
|
+
exports.navigationRoutes.swapHistory,
|
|
34
|
+
exports.navigationRoutes.activeSwaps,
|
|
35
|
+
exports.navigationRoutes.fromToken,
|
|
36
|
+
exports.navigationRoutes.toToken,
|
|
37
|
+
exports.navigationRoutes.fromChain,
|
|
38
|
+
exports.navigationRoutes.toChain,
|
|
39
|
+
exports.navigationRoutes.swapRoutes,
|
|
40
|
+
exports.navigationRoutes.swapExecution,
|
|
41
|
+
exports.navigationRoutes.swapDetails,
|
|
42
|
+
];
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { ArrowForward as ArrowForwardIcon, Info as InfoIcon, Warning as WarningIcon, } from '@mui/icons-material';
|
|
3
|
+
import { ListItemAvatar, ListItemText, Typography } from '@mui/material';
|
|
4
|
+
import { useNavigate } from 'react-router-dom';
|
|
5
|
+
import { useProcessMessage, useRouteExecution } from '../../hooks';
|
|
6
|
+
import { navigationRoutes } from '../../utils';
|
|
7
|
+
import { StepTimer } from '../Step/StepTimer';
|
|
8
|
+
import { TokenAvatar, TokenAvatarGroup } from '../TokenAvatar';
|
|
9
|
+
import { ListItem, ListItemButton } from './ActiveSwaps.style';
|
|
10
|
+
export const ActiveSwapItem = ({ routeId, dense }) => {
|
|
11
|
+
var _a;
|
|
12
|
+
const navigate = useNavigate();
|
|
13
|
+
const { route, status } = useRouteExecution(routeId, true);
|
|
14
|
+
// TODO: replace with ES2023 findLast
|
|
15
|
+
const lastActiveStep = route === null || route === void 0 ? void 0 : route.steps.slice().reverse().find((step) => step.execution);
|
|
16
|
+
const lastActiveProcess = (_a = lastActiveStep === null || lastActiveStep === void 0 ? void 0 : lastActiveStep.execution) === null || _a === void 0 ? void 0 : _a.process.at(-1);
|
|
17
|
+
const { title } = useProcessMessage(lastActiveStep, lastActiveProcess);
|
|
18
|
+
if (!route || !lastActiveStep) {
|
|
19
|
+
return null;
|
|
20
|
+
}
|
|
21
|
+
const handleClick = () => {
|
|
22
|
+
navigate(navigationRoutes.swapExecution, { state: { routeId } });
|
|
23
|
+
};
|
|
24
|
+
const getStatusComponent = () => {
|
|
25
|
+
switch (lastActiveProcess === null || lastActiveProcess === void 0 ? void 0 : lastActiveProcess.status) {
|
|
26
|
+
case 'ACTION_REQUIRED':
|
|
27
|
+
return _jsx(InfoIcon, { color: "info", fontSize: "small" });
|
|
28
|
+
case 'FAILED':
|
|
29
|
+
return _jsx(WarningIcon, { color: "error", fontSize: "small" });
|
|
30
|
+
default:
|
|
31
|
+
return (_jsx(Typography, Object.assign({ fontSize: 14, fontWeight: 500 }, { children: _jsx(StepTimer, { step: lastActiveStep, hideInProgress: true }) })));
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
const ListItemComponent = dense ? ListItem : ListItemButton;
|
|
35
|
+
return (_jsxs(ListItemComponent, Object.assign({ onClick: handleClick, dense: true, disableRipple: true }, { children: [_jsx(ListItemAvatar, { children: _jsxs(TokenAvatarGroup, Object.assign({ total: 2 }, { children: [_jsx(TokenAvatar, { token: route.fromToken }), _jsx(TokenAvatar, { token: route.toToken })] })) }), _jsx(ListItemText, { sx: { margin: 0 }, disableTypography: true, primary: _jsxs(Typography, Object.assign({ fontWeight: 500, lineHeight: 1, sx: {
|
|
36
|
+
display: 'flex',
|
|
37
|
+
alignItems: 'center',
|
|
38
|
+
marginLeft: 2,
|
|
39
|
+
height: 16,
|
|
40
|
+
} }, { children: [route.fromToken.symbol, _jsx(ArrowForwardIcon, { sx: { paddingX: 0.5 } }), route.toToken.symbol] })), secondary: status !== 'success' ? (_jsx(Typography, Object.assign({ fontWeight: 400, fontSize: 12, color: "text.secondary", lineHeight: 1, mt: 0.75, ml: 2 }, { children: title }))) : null }), getStatusComponent()] })));
|
|
41
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Stack } from '@mui/material';
|
|
3
|
+
import { useTranslation } from 'react-i18next';
|
|
4
|
+
import { useNavigate } from 'react-router-dom';
|
|
5
|
+
import { useWallet } from '../../providers';
|
|
6
|
+
import { useExecutingRoutesIds } from '../../stores';
|
|
7
|
+
import { navigationRoutes } from '../../utils';
|
|
8
|
+
import { CardTitle } from '../Card';
|
|
9
|
+
import { ActiveSwapItem } from './ActiveSwapItem';
|
|
10
|
+
import { ProgressCard, ShowAllButton } from './ActiveSwaps.style';
|
|
11
|
+
export const ActiveSwaps = (props) => {
|
|
12
|
+
const { t } = useTranslation();
|
|
13
|
+
const navigate = useNavigate();
|
|
14
|
+
const { account } = useWallet();
|
|
15
|
+
const executingRoutes = useExecutingRoutesIds(account.address);
|
|
16
|
+
if (!(executingRoutes === null || executingRoutes === void 0 ? void 0 : executingRoutes.length)) {
|
|
17
|
+
return null;
|
|
18
|
+
}
|
|
19
|
+
const handleShowAll = () => {
|
|
20
|
+
navigate(navigationRoutes.activeSwaps);
|
|
21
|
+
};
|
|
22
|
+
const hasShowAll = (executingRoutes === null || executingRoutes === void 0 ? void 0 : executingRoutes.length) > 2;
|
|
23
|
+
return (_jsxs(ProgressCard, Object.assign({}, props, { children: [_jsx(CardTitle, { children: t('header.activeSwaps') }), _jsx(Stack, Object.assign({ spacing: 1.5, pt: 1.5, pb: hasShowAll ? 0 : 2 }, { children: executingRoutes.slice(0, 2).map((routeId) => (_jsx(ActiveSwapItem, { routeId: routeId, dense: true }, routeId))) })), hasShowAll ? (_jsx(ShowAllButton, Object.assign({ disableRipple: true, fullWidth: true, onClick: handleShowAll, sx: (theme) => ({
|
|
24
|
+
padding: theme.spacing(0.75, 2),
|
|
25
|
+
}) }, { children: t('button.showAll') }))) : null] })));
|
|
26
|
+
};
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const ProgressCard: import("@emotion/styled").StyledComponent<import("@mui/system").SystemProps<import("@mui/material").Theme> & {
|
|
3
|
+
children?: import("react").ReactNode;
|
|
4
|
+
component?: import("react").ElementType<any> | undefined;
|
|
5
|
+
ref?: import("react").Ref<unknown> | undefined;
|
|
6
|
+
sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
|
|
7
|
+
} & import("@mui/material/OverridableComponent").CommonProps & Omit<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof import("react").HTMLAttributes<HTMLDivElement>> & {
|
|
8
|
+
ref?: import("react").RefObject<HTMLDivElement> | ((instance: HTMLDivElement | null) => void) | null | undefined;
|
|
9
|
+
}, keyof import("@mui/material/OverridableComponent").CommonProps | "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
|
+
variant?: ("default" | "error" | "selected") | undefined;
|
|
11
|
+
dense?: boolean | undefined;
|
|
12
|
+
indented?: boolean | undefined;
|
|
13
|
+
onClick?: import("react").MouseEventHandler<HTMLDivElement> | undefined;
|
|
14
|
+
}, {}, {}>;
|
|
15
|
+
export declare const ListItemButton: import("@emotion/styled").StyledComponent<import("@mui/material").ListItemButtonBaseProps & Omit<{
|
|
16
|
+
action?: import("react").Ref<import("@mui/material").ButtonBaseActions> | undefined;
|
|
17
|
+
centerRipple?: boolean | undefined;
|
|
18
|
+
children?: import("react").ReactNode;
|
|
19
|
+
classes?: Partial<import("@mui/material").ButtonBaseClasses> | undefined;
|
|
20
|
+
disabled?: boolean | undefined;
|
|
21
|
+
disableRipple?: boolean | undefined;
|
|
22
|
+
disableTouchRipple?: boolean | undefined;
|
|
23
|
+
focusRipple?: boolean | undefined;
|
|
24
|
+
focusVisibleClassName?: string | undefined;
|
|
25
|
+
LinkComponent?: import("react").ElementType<any> | undefined;
|
|
26
|
+
onFocusVisible?: import("react").FocusEventHandler<any> | undefined;
|
|
27
|
+
sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
|
|
28
|
+
tabIndex?: number | undefined;
|
|
29
|
+
TouchRippleProps?: Partial<import("@mui/material/ButtonBase/TouchRipple").TouchRippleProps> | undefined;
|
|
30
|
+
touchRippleRef?: import("react").Ref<import("@mui/material/ButtonBase/TouchRipple").TouchRippleActions> | undefined;
|
|
31
|
+
}, "classes"> & import("@mui/material/OverridableComponent").CommonProps & Omit<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof import("react").HTMLAttributes<HTMLDivElement>> & {
|
|
32
|
+
ref?: import("react").RefObject<HTMLDivElement> | ((instance: HTMLDivElement | null) => void) | null | undefined;
|
|
33
|
+
}, "className" | "style" | "classes" | "tabIndex" | "children" | "action" | "centerRipple" | "disabled" | "disableRipple" | "disableTouchRipple" | "focusRipple" | "focusVisibleClassName" | "LinkComponent" | "onFocusVisible" | "sx" | "TouchRippleProps" | "touchRippleRef" | "alignItems" | "autoFocus" | "dense" | "divider" | "selected" | "disableGutters"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
|
|
34
|
+
export declare const ListItem: import("@emotion/styled").StyledComponent<{
|
|
35
|
+
button?: false | undefined;
|
|
36
|
+
} & import("@mui/material").ListItemBaseProps & {
|
|
37
|
+
components?: {
|
|
38
|
+
Root?: import("react").ElementType<any> | undefined;
|
|
39
|
+
} | undefined;
|
|
40
|
+
componentsProps?: {
|
|
41
|
+
root?: (import("react").HTMLAttributes<HTMLDivElement> & import("@mui/material").ListItemComponentsPropsOverrides) | undefined;
|
|
42
|
+
} | undefined;
|
|
43
|
+
} & import("@mui/material/OverridableComponent").CommonProps & Omit<Pick<import("react").DetailedHTMLProps<import("react").LiHTMLAttributes<HTMLLIElement>, HTMLLIElement>, "key" | keyof import("react").LiHTMLAttributes<HTMLLIElement>> & {
|
|
44
|
+
ref?: ((instance: HTMLLIElement | null) => void) | import("react").RefObject<HTMLLIElement> | null | undefined;
|
|
45
|
+
}, "button" | "className" | "style" | "classes" | "children" | "disabled" | "sx" | "alignItems" | "autoFocus" | "dense" | "divider" | "components" | "componentsProps" | "selected" | "disableGutters" | "ContainerComponent" | "ContainerProps" | "disablePadding" | "secondaryAction"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
|
|
46
|
+
export declare const ShowAllButton: import("@emotion/styled").StyledComponent<{
|
|
47
|
+
children?: import("react").ReactNode;
|
|
48
|
+
classes?: Partial<import("@mui/material").ButtonClasses> | undefined;
|
|
49
|
+
color?: "inherit" | "primary" | "secondary" | "error" | "warning" | "info" | "success" | undefined;
|
|
50
|
+
disabled?: boolean | undefined;
|
|
51
|
+
disableElevation?: boolean | undefined;
|
|
52
|
+
disableFocusRipple?: boolean | undefined;
|
|
53
|
+
endIcon?: import("react").ReactNode;
|
|
54
|
+
fullWidth?: boolean | undefined;
|
|
55
|
+
href?: string | undefined;
|
|
56
|
+
size?: "small" | "medium" | "large" | undefined;
|
|
57
|
+
startIcon?: import("react").ReactNode;
|
|
58
|
+
sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
|
|
59
|
+
variant?: "text" | "outlined" | "contained" | undefined;
|
|
60
|
+
} & Omit<{
|
|
61
|
+
action?: import("react").Ref<import("@mui/material").ButtonBaseActions> | undefined;
|
|
62
|
+
centerRipple?: boolean | undefined;
|
|
63
|
+
children?: import("react").ReactNode;
|
|
64
|
+
classes?: Partial<import("@mui/material").ButtonBaseClasses> | undefined;
|
|
65
|
+
disabled?: boolean | undefined;
|
|
66
|
+
disableRipple?: boolean | undefined;
|
|
67
|
+
disableTouchRipple?: boolean | undefined;
|
|
68
|
+
focusRipple?: boolean | undefined;
|
|
69
|
+
focusVisibleClassName?: string | undefined;
|
|
70
|
+
LinkComponent?: import("react").ElementType<any> | undefined;
|
|
71
|
+
onFocusVisible?: import("react").FocusEventHandler<any> | undefined;
|
|
72
|
+
sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
|
|
73
|
+
tabIndex?: number | undefined;
|
|
74
|
+
TouchRippleProps?: Partial<import("@mui/material/ButtonBase/TouchRipple").TouchRippleProps> | undefined;
|
|
75
|
+
touchRippleRef?: import("react").Ref<import("@mui/material/ButtonBase/TouchRipple").TouchRippleActions> | undefined;
|
|
76
|
+
}, "classes"> & import("@mui/material/OverridableComponent").CommonProps & Omit<Pick<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "key" | keyof import("react").ButtonHTMLAttributes<HTMLButtonElement>> & {
|
|
77
|
+
ref?: ((instance: HTMLButtonElement | null) => void) | import("react").RefObject<HTMLButtonElement> | null | undefined;
|
|
78
|
+
}, keyof import("@mui/material/OverridableComponent").CommonProps | "tabIndex" | "color" | "children" | "action" | "centerRipple" | "disabled" | "disableRipple" | "disableTouchRipple" | "focusRipple" | "focusVisibleClassName" | "LinkComponent" | "onFocusVisible" | "sx" | "TouchRippleProps" | "touchRippleRef" | "href" | "disableElevation" | "disableFocusRipple" | "endIcon" | "fullWidth" | "size" | "startIcon" | "variant"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { Button, ListItem as MuiListItem, ListItemButton as MuiListItemButton, } from '@mui/material';
|
|
2
|
+
import { listItemSecondaryActionClasses } from '@mui/material/ListItemSecondaryAction';
|
|
3
|
+
import { alpha, styled } from '@mui/material/styles';
|
|
4
|
+
import { getContrastAlphaColor } from '../../utils';
|
|
5
|
+
import { Card } from '../Card';
|
|
6
|
+
export const ProgressCard = styled(Card)(({ theme }) => ({
|
|
7
|
+
borderColor: alpha(theme.palette.secondary.main, 0.48),
|
|
8
|
+
background: alpha(theme.palette.secondary.main, 0.08),
|
|
9
|
+
'&:hover': {
|
|
10
|
+
background: alpha(theme.palette.secondary.main, 0.08),
|
|
11
|
+
},
|
|
12
|
+
}));
|
|
13
|
+
export const ListItemButton = styled(MuiListItemButton)(({ theme }) => ({
|
|
14
|
+
borderRadius: theme.shape.borderRadiusSecondary,
|
|
15
|
+
paddingLeft: theme.spacing(1.5),
|
|
16
|
+
paddingRight: theme.spacing(1.5),
|
|
17
|
+
height: 64,
|
|
18
|
+
'&:hover': {
|
|
19
|
+
backgroundColor: getContrastAlphaColor(theme, '4%'),
|
|
20
|
+
},
|
|
21
|
+
}));
|
|
22
|
+
export const ListItem = styled(MuiListItem, {
|
|
23
|
+
shouldForwardProp: (prop) => prop !== 'disableRipple',
|
|
24
|
+
})(({ theme }) => ({
|
|
25
|
+
padding: theme.spacing(0, 1.5),
|
|
26
|
+
[`.${listItemSecondaryActionClasses.root}`]: {
|
|
27
|
+
right: theme.spacing(3),
|
|
28
|
+
},
|
|
29
|
+
'&:hover': {
|
|
30
|
+
cursor: 'pointer',
|
|
31
|
+
},
|
|
32
|
+
}));
|
|
33
|
+
export const ShowAllButton = styled(Button)(({ theme }) => ({
|
|
34
|
+
'&:hover': {
|
|
35
|
+
background: 'none',
|
|
36
|
+
},
|
|
37
|
+
}));
|
|
@@ -3,7 +3,7 @@ import { Box, Container, ScopedCssBaseline } from '@mui/material';
|
|
|
3
3
|
import { styled } from '@mui/material/styles';
|
|
4
4
|
import { useLayoutEffect, useRef } from 'react';
|
|
5
5
|
import { useLocation } from 'react-router-dom';
|
|
6
|
-
import { useWidgetConfig } from '../providers
|
|
6
|
+
import { useWidgetConfig } from '../providers';
|
|
7
7
|
import { ElementId } from '../utils';
|
|
8
8
|
const CssBaselineContainer = styled(ScopedCssBaseline)(({ theme }) => ({
|
|
9
9
|
// height: '100%',
|
|
@@ -1,14 +1,17 @@
|
|
|
1
|
+
import type { Theme } from '@mui/material';
|
|
1
2
|
import type { MouseEventHandler } from 'react';
|
|
2
|
-
|
|
3
|
+
declare type CardVariant = 'default' | 'selected' | 'error';
|
|
4
|
+
export declare const Card: import("@emotion/styled").StyledComponent<import("@mui/system").SystemProps<Theme> & {
|
|
3
5
|
children?: import("react").ReactNode;
|
|
4
6
|
component?: import("react").ElementType<any> | undefined;
|
|
5
7
|
ref?: import("react").Ref<unknown> | undefined;
|
|
6
|
-
sx?: import("@mui/material").SxProps<
|
|
8
|
+
sx?: import("@mui/material").SxProps<Theme> | undefined;
|
|
7
9
|
} & import("@mui/material/OverridableComponent").CommonProps & Omit<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof import("react").HTMLAttributes<HTMLDivElement>> & {
|
|
8
10
|
ref?: import("react").RefObject<HTMLDivElement> | ((instance: HTMLDivElement | null) => void) | null | undefined;
|
|
9
|
-
}, keyof import("@mui/material/OverridableComponent").CommonProps | "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<
|
|
10
|
-
variant?:
|
|
11
|
+
}, keyof import("@mui/material/OverridableComponent").CommonProps | "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> & {
|
|
12
|
+
variant?: CardVariant | undefined;
|
|
11
13
|
dense?: boolean | undefined;
|
|
12
14
|
indented?: boolean | undefined;
|
|
13
15
|
onClick?: MouseEventHandler<HTMLDivElement> | undefined;
|
|
14
16
|
}, {}, {}>;
|
|
17
|
+
export {};
|
package/components/Card/Card.js
CHANGED
|
@@ -1,32 +1,42 @@
|
|
|
1
1
|
import { Box } from '@mui/material';
|
|
2
|
-
import { darken, lighten, styled } from '@mui/material/styles';
|
|
2
|
+
import { alpha, darken, lighten, styled } from '@mui/material/styles';
|
|
3
|
+
const getBackgroundColor = (theme, variant) => variant === 'selected'
|
|
4
|
+
? theme.palette.mode === 'light'
|
|
5
|
+
? alpha(theme.palette.primary.main, 0.04)
|
|
6
|
+
: alpha(theme.palette.primary.main, 0.42)
|
|
7
|
+
: theme.palette.background.paper;
|
|
3
8
|
export const Card = styled(Box, {
|
|
4
9
|
shouldForwardProp: (prop) => !['dense', 'variant', 'indented'].includes(prop),
|
|
5
|
-
})(({ theme, variant, dense, indented, onClick }) =>
|
|
6
|
-
backgroundColor
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
:
|
|
11
|
-
? theme.palette.
|
|
12
|
-
:
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
:
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
10
|
+
})(({ theme, variant, dense, indented, onClick }) => {
|
|
11
|
+
const backgroundColor = getBackgroundColor(theme, variant);
|
|
12
|
+
return {
|
|
13
|
+
backgroundColor,
|
|
14
|
+
border: `1px solid`,
|
|
15
|
+
borderColor: variant === 'error'
|
|
16
|
+
? theme.palette.error.main
|
|
17
|
+
: variant === 'selected'
|
|
18
|
+
? theme.palette.primary.main
|
|
19
|
+
: theme.palette.mode === 'light'
|
|
20
|
+
? theme.palette.grey[300]
|
|
21
|
+
: theme.palette.grey[800],
|
|
22
|
+
borderRadius: dense
|
|
23
|
+
? theme.shape.borderRadiusSecondary
|
|
24
|
+
: theme.shape.borderRadius,
|
|
25
|
+
overflow: 'hidden',
|
|
26
|
+
position: 'relative',
|
|
27
|
+
padding: indented ? theme.spacing(2) : 0,
|
|
28
|
+
boxSizing: 'border-box',
|
|
29
|
+
'&:hover': {
|
|
30
|
+
cursor: onClick ? 'pointer' : 'default',
|
|
31
|
+
backgroundColor: onClick
|
|
32
|
+
? theme.palette.mode === 'light'
|
|
33
|
+
? darken(backgroundColor, 0.02)
|
|
34
|
+
: lighten(backgroundColor, 0.02)
|
|
35
|
+
: theme.palette.background.paper,
|
|
36
|
+
},
|
|
37
|
+
transition: theme.transitions.create(['background-color'], {
|
|
38
|
+
duration: theme.transitions.duration.enteringScreen,
|
|
39
|
+
easing: theme.transitions.easing.easeOut,
|
|
40
|
+
}),
|
|
41
|
+
};
|
|
42
|
+
});
|
|
File without changes
|