@lifi/widget 3.25.0 → 3.26.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/CHANGELOG.md +27 -0
- package/dist/esm/components/AmountInput/AmountInput.js +75 -17
- package/dist/esm/components/AmountInput/AmountInput.js.map +1 -1
- package/dist/esm/components/AmountInput/AmountInput.style.d.ts +4 -0
- package/dist/esm/components/AmountInput/AmountInput.style.js +11 -0
- package/dist/esm/components/AmountInput/AmountInput.style.js.map +1 -1
- package/dist/esm/components/AmountInput/AmountInputAdornment.style.d.ts +1 -0
- package/dist/esm/components/AmountInput/AmountInputAdornment.style.js +64 -5
- package/dist/esm/components/AmountInput/AmountInputAdornment.style.js.map +1 -1
- package/dist/esm/components/AmountInput/AmountInputEndAdornment.js +20 -7
- package/dist/esm/components/AmountInput/AmountInputEndAdornment.js.map +1 -1
- package/dist/esm/components/AmountInput/PriceFormHelperText.js +41 -15
- package/dist/esm/components/AmountInput/PriceFormHelperText.js.map +1 -1
- package/dist/esm/components/AmountInput/PriceFormHelperText.style.d.ts +1 -0
- package/dist/esm/components/AmountInput/PriceFormHelperText.style.js +29 -0
- package/dist/esm/components/AmountInput/PriceFormHelperText.style.js.map +1 -0
- package/dist/esm/components/AppContainer.js +1 -0
- package/dist/esm/components/AppContainer.js.map +1 -1
- package/dist/esm/components/ChainSelect/useChainSelect.js +2 -4
- package/dist/esm/components/ChainSelect/useChainSelect.js.map +1 -1
- package/dist/esm/components/Chains/ChainsExpanded.d.ts +1 -1
- package/dist/esm/components/Chains/ChainsExpanded.js +3 -2
- package/dist/esm/components/Chains/ChainsExpanded.js.map +1 -1
- package/dist/esm/components/Chains/ChainsExpanded.style.js +1 -2
- package/dist/esm/components/Chains/ChainsExpanded.style.js.map +1 -1
- package/dist/esm/components/Chains/SelectChainContent.d.ts +1 -1
- package/dist/esm/components/Chains/SelectChainContent.js +3 -2
- package/dist/esm/components/Chains/SelectChainContent.js.map +1 -1
- package/dist/esm/components/Chains/VirtualizedChainList.js +5 -3
- package/dist/esm/components/Chains/VirtualizedChainList.js.map +1 -1
- package/dist/esm/components/Expansion/Expansion.js +5 -16
- package/dist/esm/components/Expansion/Expansion.js.map +1 -1
- package/dist/esm/components/Expansion/Expansion.style.d.ts +32 -0
- package/dist/esm/components/Expansion/Expansion.style.js +40 -0
- package/dist/esm/components/Expansion/Expansion.style.js.map +1 -0
- package/dist/esm/components/Expansion/ExpansionTransition.d.ts +0 -1
- package/dist/esm/components/Expansion/ExpansionTransition.js +1 -30
- package/dist/esm/components/Expansion/ExpansionTransition.js.map +1 -1
- package/dist/esm/components/Header/NavigationHeader.js +5 -1
- package/dist/esm/components/Header/NavigationHeader.js.map +1 -1
- package/dist/esm/components/Routes/RoutesContent.d.ts +2 -3
- package/dist/esm/components/Routes/RoutesContent.js +8 -23
- package/dist/esm/components/Routes/RoutesContent.js.map +1 -1
- package/dist/esm/components/Routes/RoutesExpanded.d.ts +2 -3
- package/dist/esm/components/Routes/RoutesExpanded.js +24 -8
- package/dist/esm/components/Routes/RoutesExpanded.js.map +1 -1
- package/dist/esm/components/Routes/RoutesExpanded.style.js +2 -2
- package/dist/esm/components/Routes/RoutesExpanded.style.js.map +1 -1
- package/dist/esm/components/SendToWallet/SendToWalletButton.js +1 -1
- package/dist/esm/components/SendToWallet/SendToWalletButton.js.map +1 -1
- package/dist/esm/components/SendToWallet/SendToWalletExpandButton.js +3 -3
- package/dist/esm/components/SendToWallet/SendToWalletExpandButton.js.map +1 -1
- package/dist/esm/components/Step/StepProcess.js +3 -8
- package/dist/esm/components/Step/StepProcess.js.map +1 -1
- package/dist/esm/components/TokenList/TokenDetailsSheetContent.js +1 -2
- package/dist/esm/components/TokenList/TokenDetailsSheetContent.js.map +1 -1
- package/dist/esm/components/TokenList/useTokenSelect.js +2 -4
- package/dist/esm/components/TokenList/useTokenSelect.js.map +1 -1
- package/dist/esm/config/version.d.ts +1 -1
- package/dist/esm/config/version.js +1 -1
- package/dist/esm/hooks/useFromAmountThreshold.js +2 -2
- package/dist/esm/hooks/useFromAmountThreshold.js.map +1 -1
- package/dist/esm/hooks/useGasSufficiency.js +3 -3
- package/dist/esm/hooks/useGasSufficiency.js.map +1 -1
- package/dist/esm/hooks/useNavigateBack.d.ts +1 -1
- package/dist/esm/hooks/useNavigateBack.js +8 -2
- package/dist/esm/hooks/useNavigateBack.js.map +1 -1
- package/dist/esm/hooks/useRouteExecution.js +1 -2
- package/dist/esm/hooks/useRouteExecution.js.map +1 -1
- package/dist/esm/hooks/useRoutes.js +51 -8
- package/dist/esm/hooks/useRoutes.js.map +1 -1
- package/dist/esm/hooks/useSettingMonitor.js +1 -2
- package/dist/esm/hooks/useSettingMonitor.js.map +1 -1
- package/dist/esm/hooks/useTokenAddressBalance.js +4 -1
- package/dist/esm/hooks/useTokenAddressBalance.js.map +1 -1
- package/dist/esm/hooks/useTokenSearch.js +5 -2
- package/dist/esm/hooks/useTokenSearch.js.map +1 -1
- package/dist/esm/hooks/useTokens.js +2 -2
- package/dist/esm/hooks/useTokens.js.map +1 -1
- package/dist/esm/hooks/useTools.js +2 -2
- package/dist/esm/hooks/useTools.js.map +1 -1
- package/dist/esm/i18n/bn.json +1 -1
- package/dist/esm/i18n/de.json +1 -1
- package/dist/esm/i18n/en.json +1 -1
- package/dist/esm/i18n/es.json +1 -1
- package/dist/esm/i18n/fr.json +1 -1
- package/dist/esm/i18n/hi.json +1 -1
- package/dist/esm/i18n/id.json +1 -1
- package/dist/esm/i18n/it.json +1 -1
- package/dist/esm/i18n/ja.json +1 -1
- package/dist/esm/i18n/ko.json +1 -1
- package/dist/esm/i18n/pt.json +1 -1
- package/dist/esm/i18n/th.json +1 -1
- package/dist/esm/i18n/tr.json +1 -1
- package/dist/esm/i18n/uk.json +1 -1
- package/dist/esm/i18n/vi.json +1 -1
- package/dist/esm/i18n/zh.json +1 -1
- package/dist/esm/pages/SelectEnabledToolsPage.js +4 -2
- package/dist/esm/pages/SelectEnabledToolsPage.js.map +1 -1
- package/dist/esm/pages/SelectTokenPage/SearchTokenInput.js +14 -7
- package/dist/esm/pages/SelectTokenPage/SearchTokenInput.js.map +1 -1
- package/dist/esm/pages/SettingsPage/BridgeAndExchangeSettings.js +1 -2
- package/dist/esm/pages/SettingsPage/BridgeAndExchangeSettings.js.map +1 -1
- package/dist/esm/pages/TransactionPage/TransactionPage.js +5 -3
- package/dist/esm/pages/TransactionPage/TransactionPage.js.map +1 -1
- package/dist/esm/stores/bookmarks/BookmarkStore.d.ts +1 -2
- package/dist/esm/stores/bookmarks/BookmarkStore.js +3 -3
- package/dist/esm/stores/bookmarks/BookmarkStore.js.map +1 -1
- package/dist/esm/stores/bookmarks/useBookmarkActions.js +1 -2
- package/dist/esm/stores/bookmarks/useBookmarkActions.js.map +1 -1
- package/dist/esm/stores/bookmarks/useBookmarks.js +1 -2
- package/dist/esm/stores/bookmarks/useBookmarks.js.map +1 -1
- package/dist/esm/stores/chains/ChainOrderStore.d.ts +1 -1
- package/dist/esm/stores/chains/ChainOrderStore.js +3 -2
- package/dist/esm/stores/chains/ChainOrderStore.js.map +1 -1
- package/dist/esm/stores/chains/useChainOrder.js +1 -2
- package/dist/esm/stores/chains/useChainOrder.js.map +1 -1
- package/dist/esm/stores/form/useFieldActions.js +1 -2
- package/dist/esm/stores/form/useFieldActions.js.map +1 -1
- package/dist/esm/stores/form/useFieldValues.js +1 -2
- package/dist/esm/stores/form/useFieldValues.js.map +1 -1
- package/dist/esm/stores/form/useFormStore.d.ts +1 -2
- package/dist/esm/stores/form/useFormStore.js +3 -3
- package/dist/esm/stores/form/useFormStore.js.map +1 -1
- package/dist/esm/stores/form/useTouchedFields.js +1 -2
- package/dist/esm/stores/form/useTouchedFields.js.map +1 -1
- package/dist/esm/stores/form/useValidation.js +5 -2
- package/dist/esm/stores/form/useValidation.js.map +1 -1
- package/dist/esm/stores/form/useValidationActions.js +1 -2
- package/dist/esm/stores/form/useValidationActions.js.map +1 -1
- package/dist/esm/stores/header/useHeaderStore.d.ts +1 -1
- package/dist/esm/stores/header/useHeaderStore.js +3 -2
- package/dist/esm/stores/header/useHeaderStore.js.map +1 -1
- package/dist/esm/stores/inputMode/useInputModeStore.d.ts +9 -0
- package/dist/esm/stores/inputMode/useInputModeStore.js +19 -0
- package/dist/esm/stores/inputMode/useInputModeStore.js.map +1 -0
- package/dist/esm/stores/routes/RouteExecutionStore.d.ts +1 -1
- package/dist/esm/stores/routes/RouteExecutionStore.js +3 -2
- package/dist/esm/stores/routes/RouteExecutionStore.js.map +1 -1
- package/dist/esm/stores/routes/useExecutingRoutesIds.js +1 -2
- package/dist/esm/stores/routes/useExecutingRoutesIds.js.map +1 -1
- package/dist/esm/stores/settings/useSendToWalletStore.d.ts +2 -1
- package/dist/esm/stores/settings/useSendToWalletStore.js +6 -3
- package/dist/esm/stores/settings/useSendToWalletStore.js.map +1 -1
- package/dist/esm/stores/settings/useSettings.js +1 -2
- package/dist/esm/stores/settings/useSettings.js.map +1 -1
- package/dist/esm/stores/settings/useSettingsActions.js +1 -2
- package/dist/esm/stores/settings/useSettingsActions.js.map +1 -1
- package/dist/esm/stores/settings/useSettingsStore.d.ts +2 -1
- package/dist/esm/stores/settings/useSettingsStore.js +5 -1
- package/dist/esm/stores/settings/useSettingsStore.js.map +1 -1
- package/dist/esm/stores/settings/useSplitSubvariantStore.js +2 -1
- package/dist/esm/stores/settings/useSplitSubvariantStore.js.map +1 -1
- package/dist/esm/themes/createTheme.js +5 -1
- package/dist/esm/themes/createTheme.js.map +1 -1
- package/dist/esm/types/widget.d.ts +2 -1
- package/dist/esm/types/widget.js +1 -0
- package/dist/esm/types/widget.js.map +1 -1
- package/dist/esm/utils/format.d.ts +4 -0
- package/dist/esm/utils/format.js +26 -0
- package/dist/esm/utils/format.js.map +1 -1
- package/dist/esm/utils/getPriceImpact.d.ts +2 -2
- package/dist/esm/utils/getPriceImpact.js.map +1 -1
- package/package.json +12 -12
- package/package.json.tmp +14 -14
- package/src/components/AmountInput/AmountInput.style.tsx +13 -0
- package/src/components/AmountInput/AmountInput.tsx +91 -18
- package/src/components/AmountInput/AmountInputAdornment.style.tsx +66 -5
- package/src/components/AmountInput/AmountInputEndAdornment.tsx +40 -10
- package/src/components/AmountInput/PriceFormHelperText.style.tsx +29 -0
- package/src/components/AmountInput/PriceFormHelperText.tsx +63 -19
- package/src/components/AppContainer.tsx +1 -0
- package/src/components/ChainSelect/useChainSelect.ts +2 -4
- package/src/components/Chains/ChainsExpanded.style.tsx +1 -2
- package/src/components/Chains/ChainsExpanded.tsx +6 -2
- package/src/components/Chains/SelectChainContent.tsx +81 -82
- package/src/components/Chains/VirtualizedChainList.tsx +5 -6
- package/src/components/Expansion/Expansion.style.tsx +43 -0
- package/src/components/Expansion/Expansion.tsx +8 -23
- package/src/components/Expansion/ExpansionTransition.tsx +5 -33
- package/src/components/Header/NavigationHeader.tsx +10 -1
- package/src/components/Routes/RoutesContent.tsx +14 -31
- package/src/components/Routes/RoutesExpanded.style.ts +2 -2
- package/src/components/Routes/RoutesExpanded.tsx +33 -13
- package/src/components/SendToWallet/SendToWalletButton.tsx +1 -1
- package/src/components/SendToWallet/SendToWalletExpandButton.tsx +8 -3
- package/src/components/Step/StepProcess.tsx +3 -8
- package/src/components/TokenList/TokenDetailsSheetContent.tsx +1 -2
- package/src/components/TokenList/useTokenSelect.ts +2 -4
- package/src/config/version.ts +1 -1
- package/src/hooks/useFromAmountThreshold.ts +6 -2
- package/src/hooks/useGasSufficiency.ts +4 -4
- package/src/hooks/useNavigateBack.ts +26 -17
- package/src/hooks/useRouteExecution.ts +1 -3
- package/src/hooks/useRoutes.ts +92 -37
- package/src/hooks/useSettingMonitor.ts +7 -11
- package/src/hooks/useTokenAddressBalance.ts +6 -1
- package/src/hooks/useTokenSearch.ts +5 -2
- package/src/hooks/useTokens.ts +2 -2
- package/src/hooks/useTools.ts +2 -2
- package/src/i18n/bn.json +1 -1
- package/src/i18n/de.json +1 -1
- package/src/i18n/en.json +1 -1
- package/src/i18n/es.json +1 -1
- package/src/i18n/fr.json +1 -1
- package/src/i18n/hi.json +1 -1
- package/src/i18n/id.json +1 -1
- package/src/i18n/it.json +1 -1
- package/src/i18n/ja.json +1 -1
- package/src/i18n/ko.json +1 -1
- package/src/i18n/pt.json +1 -1
- package/src/i18n/th.json +1 -1
- package/src/i18n/tr.json +1 -1
- package/src/i18n/uk.json +1 -1
- package/src/i18n/vi.json +1 -1
- package/src/i18n/zh.json +1 -1
- package/src/pages/SelectEnabledToolsPage.tsx +4 -5
- package/src/pages/SelectTokenPage/SearchTokenInput.tsx +19 -7
- package/src/pages/SettingsPage/BridgeAndExchangeSettings.tsx +1 -2
- package/src/pages/TransactionPage/TransactionPage.tsx +17 -9
- package/src/stores/bookmarks/BookmarkStore.tsx +3 -6
- package/src/stores/bookmarks/useBookmarkActions.ts +9 -13
- package/src/stores/bookmarks/useBookmarks.ts +1 -3
- package/src/stores/chains/ChainOrderStore.tsx +3 -3
- package/src/stores/chains/useChainOrder.ts +1 -5
- package/src/stores/form/useFieldActions.ts +10 -14
- package/src/stores/form/useFieldValues.ts +1 -3
- package/src/stores/form/useFormStore.ts +3 -6
- package/src/stores/form/useTouchedFields.ts +1 -2
- package/src/stores/form/useValidation.ts +5 -5
- package/src/stores/form/useValidationActions.ts +5 -9
- package/src/stores/header/useHeaderStore.tsx +3 -5
- package/src/stores/inputMode/useInputModeStore.ts +29 -0
- package/src/stores/routes/RouteExecutionStore.tsx +3 -3
- package/src/stores/routes/useExecutingRoutesIds.ts +14 -17
- package/src/stores/settings/useSendToWalletStore.ts +11 -8
- package/src/stores/settings/useSettings.ts +8 -11
- package/src/stores/settings/useSettingsActions.ts +8 -12
- package/src/stores/settings/useSettingsStore.ts +8 -1
- package/src/stores/settings/useSplitSubvariantStore.tsx +2 -1
- package/src/themes/createTheme.ts +5 -1
- package/src/types/widget.ts +1 -0
- package/src/utils/format.ts +33 -0
- package/src/utils/getPriceImpact.ts +2 -2
package/src/i18n/vi.json
CHANGED
package/src/i18n/zh.json
CHANGED
|
@@ -14,7 +14,6 @@ import {
|
|
|
14
14
|
import type { MouseEventHandler } from 'react'
|
|
15
15
|
import { type FormEventHandler, useMemo, useState } from 'react'
|
|
16
16
|
import { useTranslation } from 'react-i18next'
|
|
17
|
-
import { shallow } from 'zustand/shallow'
|
|
18
17
|
import { FullPageContainer } from '../components/FullPageContainer.js'
|
|
19
18
|
import { ListItemText } from '../components/ListItemText.js'
|
|
20
19
|
import { StickySearchInput } from '../components/Search/SearchInput.js'
|
|
@@ -76,10 +75,10 @@ export const SelectEnabledToolsPage: React.FC<{
|
|
|
76
75
|
const typeKey = type.toLowerCase() as 'bridges' | 'exchanges'
|
|
77
76
|
const { tools } = useTools()
|
|
78
77
|
const { setToolValue, toggleToolKeys } = useSettingsActions()
|
|
79
|
-
const [enabledTools, disabledTools] = useSettingsStore(
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
)
|
|
78
|
+
const [enabledTools, disabledTools] = useSettingsStore((state) => [
|
|
79
|
+
state[`_enabled${type}`],
|
|
80
|
+
state[`disabled${type}`],
|
|
81
|
+
])
|
|
83
82
|
|
|
84
83
|
const { t } = useTranslation()
|
|
85
84
|
const elementId = useDefaultElementId()
|
|
@@ -1,15 +1,27 @@
|
|
|
1
|
-
import { useEffect } from 'react'
|
|
1
|
+
import { useCallback, useEffect } from 'react'
|
|
2
2
|
import { useTranslation } from 'react-i18next'
|
|
3
3
|
import { SearchInput } from '../../components/Search/SearchInput.js'
|
|
4
4
|
import { useFieldActions } from '../../stores/form/useFieldActions.js'
|
|
5
|
-
import {
|
|
5
|
+
import { useFieldValues } from '../../stores/form/useFieldValues.js'
|
|
6
6
|
|
|
7
7
|
export const SearchTokenInput = () => {
|
|
8
8
|
const { t } = useTranslation()
|
|
9
|
-
const
|
|
10
|
-
const {
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
const [value] = useFieldValues('tokenSearchFilter')
|
|
10
|
+
const { setFieldValue, setAsTouched } = useFieldActions()
|
|
11
|
+
|
|
12
|
+
const onChange = useCallback(
|
|
13
|
+
(newValue: string | number | undefined) => {
|
|
14
|
+
setFieldValue('tokenSearchFilter', newValue, {
|
|
15
|
+
isDirty: true,
|
|
16
|
+
isTouched: true,
|
|
17
|
+
})
|
|
18
|
+
},
|
|
19
|
+
[setFieldValue]
|
|
20
|
+
)
|
|
21
|
+
|
|
22
|
+
const onBlur = useCallback(() => {
|
|
23
|
+
setAsTouched('tokenSearchFilter')
|
|
24
|
+
}, [setAsTouched])
|
|
13
25
|
|
|
14
26
|
useEffect(
|
|
15
27
|
() => () => {
|
|
@@ -20,7 +32,7 @@ export const SearchTokenInput = () => {
|
|
|
20
32
|
|
|
21
33
|
return (
|
|
22
34
|
<SearchInput
|
|
23
|
-
name=
|
|
35
|
+
name="tokenSearchFilter"
|
|
24
36
|
placeholder={t('main.tokenSearch')}
|
|
25
37
|
onChange={(e) => onChange((e.target as HTMLInputElement).value)}
|
|
26
38
|
onBlur={onBlur}
|
|
@@ -2,7 +2,6 @@ import AirlineStops from '@mui/icons-material/AirlineStops'
|
|
|
2
2
|
import SwapHoriz from '@mui/icons-material/SwapHoriz'
|
|
3
3
|
import { useTranslation } from 'react-i18next'
|
|
4
4
|
import { useNavigate } from 'react-router-dom'
|
|
5
|
-
import { shallow } from 'zustand/shallow'
|
|
6
5
|
import { CardButton } from '../../components/Card/CardButton.js'
|
|
7
6
|
import { useSettingMonitor } from '../../hooks/useSettingMonitor.js'
|
|
8
7
|
import { useWidgetConfig } from '../../providers/WidgetProvider/WidgetProvider.js'
|
|
@@ -25,7 +24,7 @@ export const BridgeAndExchangeSettings: React.FC<{
|
|
|
25
24
|
const [enabledTools, tools] = useSettingsStore((state) => {
|
|
26
25
|
const enabledTools = Object.values(state[`_enabled${type}`])
|
|
27
26
|
return [enabledTools.filter(Boolean).length, enabledTools.length]
|
|
28
|
-
}
|
|
27
|
+
})
|
|
29
28
|
|
|
30
29
|
const { hiddenUI } = useWidgetConfig()
|
|
31
30
|
|
|
@@ -19,6 +19,7 @@ import { useWidgetConfig } from '../../providers/WidgetProvider/WidgetProvider.j
|
|
|
19
19
|
import { useFieldActions } from '../../stores/form/useFieldActions.js'
|
|
20
20
|
import { RouteExecutionStatus } from '../../stores/routes/types.js'
|
|
21
21
|
import { WidgetEvent } from '../../types/events.js'
|
|
22
|
+
import { HiddenUI } from '../../types/widget.js'
|
|
22
23
|
import { getAccumulatedFeeCostsBreakdown } from '../../utils/fees.js'
|
|
23
24
|
import { ConfirmToAddressSheet } from './ConfirmToAddressSheet.js'
|
|
24
25
|
import type { ExchangeRateBottomSheetBase } from './ExchangeRateBottomSheet.js'
|
|
@@ -37,8 +38,12 @@ export const TransactionPage: React.FC = () => {
|
|
|
37
38
|
const { setFieldValue } = useFieldActions()
|
|
38
39
|
const emitter = useWidgetEvents()
|
|
39
40
|
const { navigateBack } = useNavigateBack()
|
|
40
|
-
const {
|
|
41
|
-
|
|
41
|
+
const {
|
|
42
|
+
subvariant,
|
|
43
|
+
subvariantOptions,
|
|
44
|
+
contractSecondaryComponent,
|
|
45
|
+
hiddenUI,
|
|
46
|
+
} = useWidgetConfig()
|
|
42
47
|
const { state }: any = useLocation()
|
|
43
48
|
const stateRouteId = state?.routeId
|
|
44
49
|
const [routeId, setRouteId] = useState<string>(stateRouteId)
|
|
@@ -141,7 +146,8 @@ export const TransactionPage: React.FC = () => {
|
|
|
141
146
|
toAddress &&
|
|
142
147
|
!hasActivity &&
|
|
143
148
|
!isLoadingAddressActivity &&
|
|
144
|
-
isActivityAddressFetched
|
|
149
|
+
isActivityAddressFetched &&
|
|
150
|
+
!hiddenUI?.includes(HiddenUI.LowAddressActivityConfirmation)
|
|
145
151
|
) {
|
|
146
152
|
confirmToAddressSheetRef.current?.open()
|
|
147
153
|
return
|
|
@@ -248,12 +254,14 @@ export const TransactionPage: React.FC = () => {
|
|
|
248
254
|
/>
|
|
249
255
|
) : null}
|
|
250
256
|
<ExchangeRateBottomSheet ref={exchangeRateBottomSheetRef} />
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
+
{!hiddenUI?.includes(HiddenUI.LowAddressActivityConfirmation) ? (
|
|
258
|
+
<ConfirmToAddressSheet
|
|
259
|
+
ref={confirmToAddressSheetRef}
|
|
260
|
+
onContinue={handleExecuteRoute}
|
|
261
|
+
toAddress={toAddress!}
|
|
262
|
+
toChainId={route.toChainId!}
|
|
263
|
+
/>
|
|
264
|
+
) : null}
|
|
257
265
|
</PageContainer>
|
|
258
266
|
)
|
|
259
267
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createContext, useContext, useRef } from 'react'
|
|
2
|
-
import {
|
|
2
|
+
import { useShallow } from 'zustand/shallow'
|
|
3
3
|
import { useWidgetConfig } from '../../providers/WidgetProvider/WidgetProvider.js'
|
|
4
4
|
import type { PersistStoreProviderProps } from '../types.js'
|
|
5
5
|
import { createBookmarksStore } from './createBookmarkStore.js'
|
|
@@ -25,10 +25,7 @@ export const BookmarkStoreProvider: React.FC<PersistStoreProviderProps> = ({
|
|
|
25
25
|
)
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
export function useBookmarkStore<T>(
|
|
29
|
-
selector: (store: BookmarkState) => T,
|
|
30
|
-
equalityFunction = shallow
|
|
31
|
-
) {
|
|
28
|
+
export function useBookmarkStore<T>(selector: (store: BookmarkState) => T) {
|
|
32
29
|
const useStore = useContext(BookmarkStoreContext)
|
|
33
30
|
|
|
34
31
|
if (!useStore) {
|
|
@@ -37,5 +34,5 @@ export function useBookmarkStore<T>(
|
|
|
37
34
|
)
|
|
38
35
|
}
|
|
39
36
|
|
|
40
|
-
return useStore(selector
|
|
37
|
+
return useStore(useShallow(selector))
|
|
41
38
|
}
|
|
@@ -1,20 +1,16 @@
|
|
|
1
|
-
import { shallow } from 'zustand/shallow'
|
|
2
1
|
import { useBookmarkStore } from './BookmarkStore.js'
|
|
3
2
|
import type { BookmarkActions } from './types.js'
|
|
4
3
|
|
|
5
4
|
export const useBookmarkActions = () => {
|
|
6
|
-
const actions = useBookmarkStore<BookmarkActions>(
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}),
|
|
16
|
-
shallow
|
|
17
|
-
)
|
|
5
|
+
const actions = useBookmarkStore<BookmarkActions>((store) => ({
|
|
6
|
+
getBookmark: store.getBookmark,
|
|
7
|
+
addBookmark: store.addBookmark,
|
|
8
|
+
removeBookmark: store.removeBookmark,
|
|
9
|
+
setSelectedBookmark: store.setSelectedBookmark,
|
|
10
|
+
getSelectedBookmark: store.getSelectedBookmark,
|
|
11
|
+
addRecentWallet: store.addRecentWallet,
|
|
12
|
+
removeRecentWallet: store.removeRecentWallet,
|
|
13
|
+
}))
|
|
18
14
|
|
|
19
15
|
return actions
|
|
20
16
|
}
|
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
import { shallow } from 'zustand/shallow'
|
|
2
1
|
import { useBookmarkStore } from './BookmarkStore.js'
|
|
3
2
|
import type { BookmarkProps } from './types.js'
|
|
4
3
|
|
|
5
4
|
export const useBookmarks = (): BookmarkProps => {
|
|
6
5
|
const [bookmarks, selectedBookmark, recentWallets] = useBookmarkStore(
|
|
7
|
-
(store) => [store.bookmarks, store.selectedBookmark, store.recentWallets]
|
|
8
|
-
shallow
|
|
6
|
+
(store) => [store.bookmarks, store.selectedBookmark, store.recentWallets]
|
|
9
7
|
)
|
|
10
8
|
|
|
11
9
|
return {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { createContext, useContext, useEffect, useRef } from 'react'
|
|
2
2
|
import type { StoreApi } from 'zustand'
|
|
3
|
+
import { useShallow } from 'zustand/shallow'
|
|
3
4
|
import type { UseBoundStoreWithEqualityFn } from 'zustand/traditional'
|
|
4
5
|
import { useChains } from '../../hooks/useChains.js'
|
|
5
6
|
import { useExternalWalletProvider } from '../../providers/WalletProvider/useExternalWalletProvider.js'
|
|
@@ -115,9 +116,8 @@ export function useChainOrderStoreContext() {
|
|
|
115
116
|
}
|
|
116
117
|
|
|
117
118
|
export function useChainOrderStore<T>(
|
|
118
|
-
selector: (state: ChainOrderState) => T
|
|
119
|
-
equalityFn?: (left: T, right: T) => boolean
|
|
119
|
+
selector: (state: ChainOrderState) => T
|
|
120
120
|
): T {
|
|
121
121
|
const useStore = useChainOrderStoreContext()
|
|
122
|
-
return useStore(selector
|
|
122
|
+
return useStore(useShallow(selector))
|
|
123
123
|
}
|
|
@@ -1,12 +1,8 @@
|
|
|
1
|
-
import { shallow } from 'zustand/shallow'
|
|
2
1
|
import type { FormType } from '../form/types.js'
|
|
3
2
|
import { useChainOrderStore } from './ChainOrderStore.js'
|
|
4
3
|
|
|
5
4
|
export const useChainOrder = (
|
|
6
5
|
type: FormType
|
|
7
6
|
): [number[], (chainId: number, type: FormType) => void] => {
|
|
8
|
-
return useChainOrderStore(
|
|
9
|
-
(state) => [state.chainOrder[type], state.setChain],
|
|
10
|
-
shallow
|
|
11
|
-
)
|
|
7
|
+
return useChainOrderStore((state) => [state.chainOrder[type], state.setChain])
|
|
12
8
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { useCallback } from 'react'
|
|
2
|
-
import { shallow } from 'zustand/shallow'
|
|
3
2
|
import { useWidgetEvents } from '../../hooks/useWidgetEvents.js'
|
|
4
3
|
import type { FormFieldChanged } from '../../types/events.js'
|
|
5
4
|
import { WidgetEvent } from '../../types/events.js'
|
|
@@ -14,19 +13,16 @@ import { useFormStore } from './useFormStore.js'
|
|
|
14
13
|
|
|
15
14
|
export const useFieldActions = () => {
|
|
16
15
|
const emitter = useWidgetEvents()
|
|
17
|
-
const actions = useFormStore<FormActions>(
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
}),
|
|
28
|
-
shallow
|
|
29
|
-
)
|
|
16
|
+
const actions = useFormStore<FormActions>((store) => ({
|
|
17
|
+
getFieldValues: store.getFieldValues,
|
|
18
|
+
isTouched: store.isTouched,
|
|
19
|
+
isDirty: store.isDirty,
|
|
20
|
+
resetField: store.resetField,
|
|
21
|
+
setAsTouched: store.setAsTouched,
|
|
22
|
+
setDefaultValues: store.setDefaultValues,
|
|
23
|
+
setFieldValue: store.setFieldValue,
|
|
24
|
+
setUserAndDefaultValues: store.setUserAndDefaultValues,
|
|
25
|
+
}))
|
|
30
26
|
|
|
31
27
|
const setFieldValueWithEmittedEvents = useCallback(
|
|
32
28
|
(
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { shallow } from 'zustand/shallow'
|
|
2
1
|
import type { FormFieldArray, FormFieldNames } from './types.js'
|
|
3
2
|
import { useFormStore } from './useFormStore.js'
|
|
4
3
|
|
|
@@ -6,8 +5,7 @@ import { useFormStore } from './useFormStore.js'
|
|
|
6
5
|
export const useFieldValues = <T extends FormFieldNames[]>(...names: T) => {
|
|
7
6
|
const values = useFormStore(
|
|
8
7
|
(store) =>
|
|
9
|
-
names.map((name) => store.userValues[name]?.value) as FormFieldArray<T
|
|
10
|
-
shallow
|
|
8
|
+
names.map((name) => store.userValues[name]?.value) as FormFieldArray<T>
|
|
11
9
|
)
|
|
12
10
|
|
|
13
11
|
return values
|
|
@@ -1,17 +1,14 @@
|
|
|
1
1
|
import { useContext } from 'react'
|
|
2
|
-
import {
|
|
2
|
+
import { useShallow } from 'zustand/shallow'
|
|
3
3
|
import { FormStoreContext } from './FormStoreContext.js'
|
|
4
4
|
import type { FormValuesState } from './types.js'
|
|
5
5
|
|
|
6
|
-
export function useFormStore<T>(
|
|
7
|
-
selector: (state: FormValuesState) => T,
|
|
8
|
-
equalityFn = shallow
|
|
9
|
-
): T {
|
|
6
|
+
export function useFormStore<T>(selector: (state: FormValuesState) => T): T {
|
|
10
7
|
const useStore = useContext(FormStoreContext)
|
|
11
8
|
|
|
12
9
|
if (!useStore) {
|
|
13
10
|
throw new Error('You forgot to wrap your component in <FormStoreProvider>.')
|
|
14
11
|
}
|
|
15
12
|
|
|
16
|
-
return useStore(selector
|
|
13
|
+
return useStore(useShallow(selector))
|
|
17
14
|
}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { shallow } from 'zustand/shallow'
|
|
2
1
|
import { useFormStore } from './useFormStore.js'
|
|
3
2
|
|
|
4
3
|
export const useTouchedFields = () => {
|
|
5
|
-
const touchedFields = useFormStore((store) => store.touchedFields
|
|
4
|
+
const touchedFields = useFormStore((store) => store.touchedFields)
|
|
6
5
|
|
|
7
6
|
return touchedFields
|
|
8
7
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { shallow } from 'zustand/shallow'
|
|
2
1
|
import type { ValidationProps } from './types.js'
|
|
3
2
|
import { useFormStore } from './useFormStore.js'
|
|
4
3
|
export const useValidation = (): Omit<ValidationProps, 'validation'> => {
|
|
5
|
-
const [isValid, isValidating, errors] = useFormStore(
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
const [isValid, isValidating, errors] = useFormStore((store) => [
|
|
5
|
+
store.isValid,
|
|
6
|
+
store.isValidating,
|
|
7
|
+
store.errors,
|
|
8
|
+
])
|
|
9
9
|
|
|
10
10
|
return {
|
|
11
11
|
isValid,
|
|
@@ -1,16 +1,12 @@
|
|
|
1
|
-
import { shallow } from 'zustand/shallow'
|
|
2
1
|
import type { ValidationActions } from './types.js'
|
|
3
2
|
import { useFormStore } from './useFormStore.js'
|
|
4
3
|
|
|
5
4
|
export const useValidationActions = () => {
|
|
6
|
-
const actions = useFormStore<ValidationActions>(
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}),
|
|
12
|
-
shallow
|
|
13
|
-
)
|
|
5
|
+
const actions = useFormStore<ValidationActions>((store) => ({
|
|
6
|
+
addFieldValidation: store.addFieldValidation,
|
|
7
|
+
triggerFieldValidation: store.triggerFieldValidation,
|
|
8
|
+
clearErrors: store.clearErrors,
|
|
9
|
+
}))
|
|
14
10
|
|
|
15
11
|
return actions
|
|
16
12
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { createContext, useContext, useRef } from 'react'
|
|
2
|
+
import { useShallow } from 'zustand/shallow'
|
|
2
3
|
import { createWithEqualityFn } from 'zustand/traditional'
|
|
3
4
|
import type { PersistStoreProviderProps } from '../types.js'
|
|
4
5
|
import type { HeaderState, HeaderStore } from './types.js'
|
|
@@ -27,12 +28,9 @@ export function useHeaderStoreContext() {
|
|
|
27
28
|
return useStore
|
|
28
29
|
}
|
|
29
30
|
|
|
30
|
-
export function useHeaderStore<T>(
|
|
31
|
-
selector: (state: HeaderState) => T,
|
|
32
|
-
equalityCheck?: (objA: T, objB: T) => boolean
|
|
33
|
-
): T {
|
|
31
|
+
export function useHeaderStore<T>(selector: (state: HeaderState) => T): T {
|
|
34
32
|
const useStore = useHeaderStoreContext()
|
|
35
|
-
return useStore(selector
|
|
33
|
+
return useStore(useShallow(selector))
|
|
36
34
|
}
|
|
37
35
|
|
|
38
36
|
// We use fixed position on the header when Widget is in Full Height layout.
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { create } from 'zustand'
|
|
2
|
+
import type { FormTypeProps } from '../form/types.js'
|
|
3
|
+
|
|
4
|
+
export type InputMode = 'amount' | 'price'
|
|
5
|
+
|
|
6
|
+
interface InputModeState {
|
|
7
|
+
inputMode: Record<'from' | 'to', InputMode>
|
|
8
|
+
setInputMode: (formType: FormTypeProps['formType'], mode: InputMode) => void
|
|
9
|
+
toggleInputMode: (formType: FormTypeProps['formType']) => void
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export const useInputModeStore = create<InputModeState>((set, get) => ({
|
|
13
|
+
inputMode: {
|
|
14
|
+
from: 'amount',
|
|
15
|
+
to: 'amount',
|
|
16
|
+
},
|
|
17
|
+
setInputMode: (formType, mode) =>
|
|
18
|
+
set((state) => ({
|
|
19
|
+
inputMode: {
|
|
20
|
+
...state.inputMode,
|
|
21
|
+
[formType]: mode,
|
|
22
|
+
},
|
|
23
|
+
})),
|
|
24
|
+
toggleInputMode: (formType) => {
|
|
25
|
+
const currentMode = get().inputMode[formType]
|
|
26
|
+
const newMode = currentMode === 'amount' ? 'price' : 'amount'
|
|
27
|
+
get().setInputMode(formType, newMode)
|
|
28
|
+
},
|
|
29
|
+
}))
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { createContext, useContext, useRef } from 'react'
|
|
2
2
|
import type { StoreApi } from 'zustand'
|
|
3
|
+
import { useShallow } from 'zustand/shallow'
|
|
3
4
|
import type { UseBoundStoreWithEqualityFn } from 'zustand/traditional'
|
|
4
5
|
import type { PersistStoreProviderProps } from '../types.js'
|
|
5
6
|
import { createRouteExecutionStore } from './createRouteExecutionStore.js'
|
|
@@ -38,9 +39,8 @@ export function useRouteExecutionStoreContext() {
|
|
|
38
39
|
}
|
|
39
40
|
|
|
40
41
|
export function useRouteExecutionStore<T>(
|
|
41
|
-
selector: (state: RouteExecutionState) => T
|
|
42
|
-
equalityFn?: (left: T, right: T) => boolean
|
|
42
|
+
selector: (state: RouteExecutionState) => T
|
|
43
43
|
): T {
|
|
44
44
|
const useStore = useRouteExecutionStoreContext()
|
|
45
|
-
return useStore(selector
|
|
45
|
+
return useStore(useShallow(selector))
|
|
46
46
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { useAccount } from '@lifi/wallet-management'
|
|
2
|
-
import { shallow } from 'zustand/shallow'
|
|
3
2
|
import { useRouteExecutionStore } from './RouteExecutionStore.js'
|
|
4
3
|
import type { RouteExecution } from './types.js'
|
|
5
4
|
import { RouteExecutionStatus } from './types.js'
|
|
@@ -7,21 +6,19 @@ import { RouteExecutionStatus } from './types.js'
|
|
|
7
6
|
export const useExecutingRoutesIds = () => {
|
|
8
7
|
const { accounts } = useAccount()
|
|
9
8
|
const accountAddresses = accounts.map((account) => account.address)
|
|
10
|
-
return useRouteExecutionStore(
|
|
11
|
-
(state)
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
(item)
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
(
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
.map(({ route }) => route.id),
|
|
25
|
-
shallow
|
|
9
|
+
return useRouteExecutionStore((state) =>
|
|
10
|
+
(Object.values(state.routes) as RouteExecution[])
|
|
11
|
+
.filter(
|
|
12
|
+
(item) =>
|
|
13
|
+
accountAddresses.includes(item.route.fromAddress) &&
|
|
14
|
+
(item.status === RouteExecutionStatus.Pending ||
|
|
15
|
+
item.status === RouteExecutionStatus.Failed)
|
|
16
|
+
)
|
|
17
|
+
.sort(
|
|
18
|
+
(a, b) =>
|
|
19
|
+
(b?.route.steps[0].execution?.process[0]?.startedAt ?? 0) -
|
|
20
|
+
(a?.route.steps[0].execution?.process[0]?.startedAt ?? 0)
|
|
21
|
+
)
|
|
22
|
+
.map(({ route }) => route.id)
|
|
26
23
|
)
|
|
27
24
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useShallow } from 'zustand/shallow'
|
|
2
2
|
import { createWithEqualityFn } from 'zustand/traditional'
|
|
3
3
|
import type { SendToWalletStore } from './types.js'
|
|
4
4
|
|
|
5
|
-
export const
|
|
5
|
+
export const sendToWalletStore = createWithEqualityFn<SendToWalletStore>(
|
|
6
6
|
(set) => ({
|
|
7
7
|
showSendToWallet: false,
|
|
8
8
|
setSendToWallet: (value) =>
|
|
@@ -13,13 +13,16 @@ export const useSendToWalletStore = createWithEqualityFn<SendToWalletStore>(
|
|
|
13
13
|
Object.is
|
|
14
14
|
)
|
|
15
15
|
|
|
16
|
+
export const useSendToWalletStore = <T>(
|
|
17
|
+
selector: (state: SendToWalletStore) => T
|
|
18
|
+
): T => {
|
|
19
|
+
return sendToWalletStore(useShallow(selector))
|
|
20
|
+
}
|
|
21
|
+
|
|
16
22
|
export const useSendToWalletActions = () => {
|
|
17
|
-
const actions = useSendToWalletStore(
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
}),
|
|
21
|
-
shallow
|
|
22
|
-
)
|
|
23
|
+
const actions = useSendToWalletStore((store) => ({
|
|
24
|
+
setSendToWallet: store.setSendToWallet,
|
|
25
|
+
}))
|
|
23
26
|
|
|
24
27
|
return actions
|
|
25
28
|
}
|
|
@@ -1,19 +1,16 @@
|
|
|
1
|
-
import { shallow } from 'zustand/shallow'
|
|
2
1
|
import type { SettingsState } from './types.js'
|
|
3
2
|
import { useSettingsStore } from './useSettingsStore.js'
|
|
4
3
|
|
|
5
4
|
export const useSettings = <K extends keyof SettingsState>(
|
|
6
5
|
keys: Array<K>
|
|
7
6
|
): Pick<SettingsState, (typeof keys)[number]> => {
|
|
8
|
-
return useSettingsStore(
|
|
9
|
-
(
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
),
|
|
17
|
-
shallow
|
|
7
|
+
return useSettingsStore((state) =>
|
|
8
|
+
keys.reduce(
|
|
9
|
+
(values, key) => {
|
|
10
|
+
values[key] = state[key]
|
|
11
|
+
return values
|
|
12
|
+
},
|
|
13
|
+
{} as Pick<SettingsState, (typeof keys)[number]>
|
|
14
|
+
)
|
|
18
15
|
)
|
|
19
16
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { useCallback } from 'react'
|
|
2
|
-
import { shallow } from 'zustand/shallow'
|
|
3
2
|
import type { widgetEvents } from '../../hooks/useWidgetEvents.js'
|
|
4
3
|
import { useWidgetEvents } from '../../hooks/useWidgetEvents.js'
|
|
5
4
|
import { WidgetEvent } from '../../types/events.js'
|
|
@@ -47,17 +46,14 @@ const emitEventOnChange = <T extends (...args: any[]) => any>(
|
|
|
47
46
|
|
|
48
47
|
export const useSettingsActions = () => {
|
|
49
48
|
const emitter = useWidgetEvents()
|
|
50
|
-
const actions = useSettingsStore(
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
}),
|
|
59
|
-
shallow
|
|
60
|
-
)
|
|
49
|
+
const actions = useSettingsStore((state) => ({
|
|
50
|
+
setValue: state.setValue,
|
|
51
|
+
getValue: state.getValue,
|
|
52
|
+
getSettings: state.getSettings,
|
|
53
|
+
reset: state.reset,
|
|
54
|
+
setToolValue: state.setToolValue,
|
|
55
|
+
toggleToolKeys: state.toggleToolKeys,
|
|
56
|
+
}))
|
|
61
57
|
|
|
62
58
|
const setValueWithEmittedEvent = useCallback<ValueSetter<SettingsProps>>(
|
|
63
59
|
(value, newValue) => {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/** biome-ignore-all lint/correctness/noUnusedVariables: allowed in this store */
|
|
2
2
|
import type { StateCreator } from 'zustand'
|
|
3
3
|
import { persist } from 'zustand/middleware'
|
|
4
|
+
import { useShallow } from 'zustand/shallow'
|
|
4
5
|
import { createWithEqualityFn } from 'zustand/traditional'
|
|
5
6
|
import type { SettingsProps, SettingsState } from './types.js'
|
|
6
7
|
import { SettingsToolTypes } from './types.js'
|
|
@@ -28,7 +29,7 @@ export const defaultSettings: SettingsProps = {
|
|
|
28
29
|
_enabledExchanges: {},
|
|
29
30
|
}
|
|
30
31
|
|
|
31
|
-
export const
|
|
32
|
+
export const settingsStore = createWithEqualityFn<SettingsState>(
|
|
32
33
|
persist(
|
|
33
34
|
(set, get) => ({
|
|
34
35
|
...defaultSettings,
|
|
@@ -176,3 +177,9 @@ export const useSettingsStore = createWithEqualityFn<SettingsState>(
|
|
|
176
177
|
) as StateCreator<SettingsState, [], [], SettingsState>,
|
|
177
178
|
Object.is
|
|
178
179
|
)
|
|
180
|
+
|
|
181
|
+
export const useSettingsStore = <T>(
|
|
182
|
+
selector: (state: SettingsState) => T
|
|
183
|
+
): T => {
|
|
184
|
+
return settingsStore(useShallow(selector))
|
|
185
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { createContext, useContext, useRef } from 'react'
|
|
2
|
+
import { useShallow } from 'zustand/shallow'
|
|
2
3
|
import { createWithEqualityFn } from 'zustand/traditional'
|
|
3
4
|
import type {
|
|
4
5
|
SplitSubvariantProps,
|
|
@@ -47,7 +48,7 @@ export function useSplitSubvariantStore<T>(
|
|
|
47
48
|
selector: (state: SplitSubvariantState) => T
|
|
48
49
|
): T {
|
|
49
50
|
const useStore = useSplitSubvariantStoreContext()
|
|
50
|
-
return useStore(selector)
|
|
51
|
+
return useStore(useShallow(selector))
|
|
51
52
|
}
|
|
52
53
|
|
|
53
54
|
export const createSplitSubvariantStore = ({ state }: SplitSubvariantProps) =>
|