@rabbitio/ui-kit 1.0.0-beta.9 → 1.0.0-beta.91
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/.gitlab-ci.yml +29 -0
- package/.husky/commit-msg +19 -0
- package/.husky/pre-push +1 -0
- package/CHANGELOG.md +0 -0
- package/README.md +27 -18
- package/coverage/base.css +224 -0
- package/coverage/block-navigation.js +87 -0
- package/coverage/clover.xml +16765 -0
- package/coverage/coverage-final.json +116 -0
- package/coverage/favicon.png +0 -0
- package/coverage/index.html +1001 -0
- package/coverage/prettify.css +1 -0
- package/coverage/prettify.js +2 -0
- package/coverage/rabbit-ui-kit/index.html +116 -0
- package/coverage/rabbit-ui-kit/index.js.html +88 -0
- package/coverage/rabbit-ui-kit/src/common-apis/adapters/analyticsAdapters/googleAnalyticsAdapter.js.html +148 -0
- package/coverage/rabbit-ui-kit/src/common-apis/adapters/analyticsAdapters/index.html +146 -0
- package/coverage/rabbit-ui-kit/src/common-apis/adapters/analyticsAdapters/metrikaAdapter.js.html +169 -0
- package/coverage/rabbit-ui-kit/src/common-apis/adapters/analyticsAdapters/mixpanelAdapter.js.html +199 -0
- package/coverage/rabbit-ui-kit/src/common-apis/adapters/axiosAdapter.js.html +190 -0
- package/coverage/rabbit-ui-kit/src/common-apis/adapters/index.html +131 -0
- package/coverage/rabbit-ui-kit/src/common-apis/adapters/qrUtils.js.html +139 -0
- package/coverage/rabbit-ui-kit/src/common-apis/external-apis/apiGroups.js.html +250 -0
- package/coverage/rabbit-ui-kit/src/common-apis/external-apis/emailAPI.js.html +133 -0
- package/coverage/rabbit-ui-kit/src/common-apis/external-apis/index.html +146 -0
- package/coverage/rabbit-ui-kit/src/common-apis/external-apis/ipAddressProviders.js.html +352 -0
- package/coverage/rabbit-ui-kit/src/common-apis/globalConstants.jsx.html +94 -0
- package/coverage/rabbit-ui-kit/src/common-apis/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/common-apis/models/blockchain.js.html +115 -0
- package/coverage/rabbit-ui-kit/src/common-apis/models/coin.js.html +829 -0
- package/coverage/rabbit-ui-kit/src/common-apis/models/index.html +146 -0
- package/coverage/rabbit-ui-kit/src/common-apis/models/protocol.js.html +100 -0
- package/coverage/rabbit-ui-kit/src/common-apis/services/fiatCurrenciesService.js.html +544 -0
- package/coverage/rabbit-ui-kit/src/common-apis/services/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/common-apis/utils/amountUtils.js.html +1162 -0
- package/coverage/rabbit-ui-kit/src/common-apis/utils/cache.js.html +811 -0
- package/coverage/rabbit-ui-kit/src/common-apis/utils/errorUtils.js.html +211 -0
- package/coverage/rabbit-ui-kit/src/common-apis/utils/index.html +191 -0
- package/coverage/rabbit-ui-kit/src/common-apis/utils/logging/index.html +131 -0
- package/coverage/rabbit-ui-kit/src/common-apis/utils/logging/logger.js.html +208 -0
- package/coverage/rabbit-ui-kit/src/common-apis/utils/logging/logsStorage.js.html +268 -0
- package/coverage/rabbit-ui-kit/src/common-apis/utils/postponeExecution.js.html +118 -0
- package/coverage/rabbit-ui-kit/src/common-apis/utils/rabbitTicker.js.html +157 -0
- package/coverage/rabbit-ui-kit/src/common-apis/utils/safeStringify.js.html +235 -0
- package/coverage/rabbit-ui-kit/src/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/index.js.html +376 -0
- package/coverage/rabbit-ui-kit/src/robust-api-caller/cacheAndConcurrentRequestsResolver.js.html +1570 -0
- package/coverage/rabbit-ui-kit/src/robust-api-caller/cachedRobustExternalApiCallerService.js.html +526 -0
- package/coverage/rabbit-ui-kit/src/robust-api-caller/cancelProcessing.js.html +172 -0
- package/coverage/rabbit-ui-kit/src/robust-api-caller/concurrentCalculationsMetadataHolder.js.html +310 -0
- package/coverage/rabbit-ui-kit/src/robust-api-caller/externalApiProvider.js.html +553 -0
- package/coverage/rabbit-ui-kit/src/robust-api-caller/externalServicesStatsCollector.js.html +319 -0
- package/coverage/rabbit-ui-kit/src/robust-api-caller/index.html +206 -0
- package/coverage/rabbit-ui-kit/src/robust-api-caller/robustExternalAPICallerService.js.html +997 -0
- package/coverage/rabbit-ui-kit/src/swaps-lib/external-apis/exolixSwapProvider.js.html +1825 -0
- package/coverage/rabbit-ui-kit/src/swaps-lib/external-apis/index.html +161 -0
- package/coverage/rabbit-ui-kit/src/swaps-lib/external-apis/letsExchangeSwapProvider.js.html +1618 -0
- package/coverage/rabbit-ui-kit/src/swaps-lib/external-apis/swapProvider.js.html +1819 -0
- package/coverage/rabbit-ui-kit/src/swaps-lib/external-apis/swapspaceSwapProvider.js.html +1861 -0
- package/coverage/rabbit-ui-kit/src/swaps-lib/models/baseSwapCreationInfo.js.html +319 -0
- package/coverage/rabbit-ui-kit/src/swaps-lib/models/existingSwap.js.html +514 -0
- package/coverage/rabbit-ui-kit/src/swaps-lib/models/existingSwapWithFiatData.js.html +529 -0
- package/coverage/rabbit-ui-kit/src/swaps-lib/models/index.html +176 -0
- package/coverage/rabbit-ui-kit/src/swaps-lib/models/partner.js.html +166 -0
- package/coverage/rabbit-ui-kit/src/swaps-lib/models/swapProviderCoinInfo.js.html +331 -0
- package/coverage/rabbit-ui-kit/src/swaps-lib/services/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/swaps-lib/services/publicSwapService.js.html +1555 -0
- package/coverage/rabbit-ui-kit/src/swaps-lib/utils/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/swaps-lib/utils/swapUtils.js.html +670 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/assets/wrappedImages/arrowIcon.jsx.html +124 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/assets/wrappedImages/arrowTosca.jsx.html +127 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/assets/wrappedImages/arrowWhite.jsx.html +127 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/assets/wrappedImages/darkRectangle.jsx.html +106 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/assets/wrappedImages/determinedError.jsx.html +439 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/assets/wrappedImages/failedValidationIcon.jsx.html +202 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/assets/wrappedImages/index.html +281 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/assets/wrappedImages/infoIcon.jsx.html +133 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/assets/wrappedImages/messageIcon.jsx.html +346 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/assets/wrappedImages/noticeQuestionIcon.jsx.html +247 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/assets/wrappedImages/successfulValidationIcon.jsx.html +163 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/assets/wrappedImages/supportDialogImage.jsx.html +268 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/assets/wrappedImages/walletIcon.jsx.html +151 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/AssetIcon/AssetIcon.jsx.html +256 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/AssetIcon/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/AssetSelection/AssetSelection.jsx.html +289 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/AssetSelection/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/BackgroundTitle/BackgroundTitle.jsx.html +187 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/BackgroundTitle/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/InformationMessage/InformationMessage.jsx.html +238 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/InformationMessage/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/Input/Input.jsx.html +634 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/Input/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/LoadingDots/LoadingDots.jsx.html +196 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/LoadingDots/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/NoticeIcon/NoticeIcon.jsx.html +277 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/NoticeIcon/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/QrCode/QrCode.jsx.html +217 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/QrCode/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/RateSelector/RateSelector.jsx.html +175 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/RateSelector/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/SupportChat/SupportChat.jsx.html +217 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/SupportChat/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/Textarea/Textarea.jsx.html +529 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/Textarea/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/TitleBox/TitleBox.jsx.html +508 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/TitleBox/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/Tooltip/Tooltip.jsx.html +316 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/Tooltip/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/TwoLinesOfText/LinesOfText.jsx.html +313 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/TwoLinesOfText/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/Validation/Validation.jsx.html +202 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/Validation/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/buttons/Button/Button.jsx.html +712 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/buttons/Button/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/buttons/Close/Close.jsx.html +259 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/buttons/Close/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/buttons/LinkButton/LinkButton.jsx.html +421 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/buttons/LinkButton/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/buttons/RadioButtonWithText/RadioButtonWithText.jsx.html +415 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/buttons/RadioButtonWithText/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/molecules/AmountInput/AmountInput.jsx.html +1429 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/molecules/AmountInput/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/molecules/CoinPicker/CoinPicker.jsx.html +1474 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/molecules/CoinPicker/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/molecules/ColoredNotice/ColoredNotice.jsx.html +211 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/molecules/ColoredNotice/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/molecules/LineWithIconLink/LineWithIconLink.jsx.html +190 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/molecules/LineWithIconLink/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/molecules/LogoCarousel/LogoCarousel.jsx.html +307 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/molecules/LogoCarousel/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/molecules/SearchableCoinsList/SearchableCoinsList.jsx.html +496 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/molecules/SearchableCoinsList/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/molecules/TitledLineWithIconLink/TitledLineWithIconLink.jsx.html +181 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/molecules/TitledLineWithIconLink/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/organisms/CoinPickerDialogStep/CoinPickerDialogStep.jsx.html +283 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/organisms/CoinPickerDialogStep/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/organisms/Dialog/Dialog.jsx.html +1567 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/organisms/Dialog/DialogButtons/DialogButtons.jsx.html +481 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/organisms/Dialog/DialogButtons/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/organisms/Dialog/DialogStep/DialogStep.jsx.html +1747 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/organisms/Dialog/DialogStep/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/organisms/Dialog/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/organisms/SwapForm/SwapForm.jsx.html +4207 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/organisms/SwapForm/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/organisms/WaitlistSubscription/WaitlistSubscription.jsx.html +559 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/organisms/WaitlistSubscription/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/templates/DeterminedErrorDialogStep/DeterminedErrorDialogStep.jsx.html +316 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/templates/DeterminedErrorDialogStep/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/hooks/index.html +146 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/hooks/useCallHandlingErrors.js.html +151 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/hooks/useIsHydrated.js.html +121 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/hooks/useReferredState.js.html +157 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/utils/index.html +161 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/utils/inputValueProviders.js.html +235 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/utils/textUtils.js.html +139 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/utils/uiUtils.js.html +121 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/utils/urlQueryUtils.js.html +271 -0
- package/coverage/rabbit-ui-kit/stories/atoms/BackgroundTitle.stories.jsx.html +202 -0
- package/coverage/rabbit-ui-kit/stories/atoms/LinesOfText.stories.jsx.html +283 -0
- package/coverage/rabbit-ui-kit/stories/atoms/LoadingDots.stories.jsx.html +226 -0
- package/coverage/rabbit-ui-kit/stories/atoms/QrCode.stories.jsx.html +175 -0
- package/coverage/rabbit-ui-kit/stories/atoms/RateSelector.stories.jsx.html +136 -0
- package/coverage/rabbit-ui-kit/stories/atoms/Validation.stories.jsx.html +178 -0
- package/coverage/rabbit-ui-kit/stories/atoms/buttons/Button.stories.jsx.html +883 -0
- package/coverage/rabbit-ui-kit/stories/atoms/buttons/Close.stories.jsx.html +211 -0
- package/coverage/rabbit-ui-kit/stories/atoms/buttons/LinkButton.stories.jsx.html +301 -0
- package/coverage/rabbit-ui-kit/stories/atoms/buttons/index.html +146 -0
- package/coverage/rabbit-ui-kit/stories/atoms/index.html +191 -0
- package/coverage/rabbit-ui-kit/stories/molecules/AmountInput.stories.jsx.html +289 -0
- package/coverage/rabbit-ui-kit/stories/molecules/CoinPicker.stories.jsx.html +322 -0
- package/coverage/rabbit-ui-kit/stories/molecules/ColoredNotice.stories.jsx.html +178 -0
- package/coverage/rabbit-ui-kit/stories/molecules/LineWithIconLink.stories.jsx.html +154 -0
- package/coverage/rabbit-ui-kit/stories/molecules/LogoCarousel.stories.jsx.html +235 -0
- package/coverage/rabbit-ui-kit/stories/molecules/TitledLineWithIconLink.stories.jsx.html +160 -0
- package/coverage/rabbit-ui-kit/stories/molecules/index.html +191 -0
- package/coverage/rabbit-ui-kit/stories/organisms/Dialog/Dialog.stories.jsx.html +523 -0
- package/coverage/rabbit-ui-kit/stories/organisms/Dialog/DialogButtons/DialogButtons.stories.jsx.html +328 -0
- package/coverage/rabbit-ui-kit/stories/organisms/Dialog/DialogButtons/index.html +116 -0
- package/coverage/rabbit-ui-kit/stories/organisms/Dialog/DialogStep/DialogStep.stories.jsx.html +337 -0
- package/coverage/rabbit-ui-kit/stories/organisms/Dialog/DialogStep/index.html +116 -0
- package/coverage/rabbit-ui-kit/stories/organisms/Dialog/index.html +116 -0
- package/coverage/rabbit-ui-kit/stories/organisms/WaitlistSubscription.stories.jsx.html +151 -0
- package/coverage/rabbit-ui-kit/stories/organisms/index.html +116 -0
- package/coverage/rabbit-ui-kit/stories/stubs/coins.jsx.html +6880 -0
- package/coverage/rabbit-ui-kit/stories/stubs/exampleContent.jsx.html +145 -0
- package/coverage/rabbit-ui-kit/stories/stubs/index.html +131 -0
- package/coverage/rabbit-ui-kit/stories/templates/DeterminedErrorDialogStep.stories.jsx.html +190 -0
- package/coverage/rabbit-ui-kit/stories/templates/index.html +116 -0
- package/coverage/sort-arrow-sprite.png +0 -0
- package/coverage/sorter.js +196 -0
- package/dist/global.css +197 -0
- package/dist/global.css.map +1 -0
- package/dist/index.cjs +12451 -25
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +2339 -8491
- package/dist/index.css.map +1 -1
- package/dist/index.modern.js +9597 -26
- package/dist/index.modern.js.map +1 -1
- package/dist/index.module.js +12357 -27
- package/dist/index.module.js.map +1 -1
- package/dist/index.umd.js +12442 -29
- package/dist/index.umd.js.map +1 -1
- package/package.json +35 -9
- package/raw +1000 -0
- package/src/common-apis/adapters/analyticsAdapters/googleAnalyticsAdapter.js +21 -0
- package/src/common-apis/adapters/analyticsAdapters/metrikaAdapter.js +28 -0
- package/src/common-apis/adapters/analyticsAdapters/mixpanelAdapter.js +38 -0
- package/src/common-apis/adapters/axiosAdapter.js +35 -0
- package/src/common-apis/adapters/qrUtils.js +18 -0
- package/src/common-apis/external-apis/apiGroups.js +55 -0
- package/src/common-apis/external-apis/emailAPI.js +16 -0
- package/src/common-apis/external-apis/ipAddressProviders.js +89 -0
- package/src/common-apis/globalConstants.jsx +3 -0
- package/src/common-apis/models/blockchain.js +10 -0
- package/src/common-apis/models/coin.js +248 -0
- package/src/common-apis/models/protocol.js +5 -0
- package/src/{common → common-apis/services}/fiatCurrenciesService.js +4 -12
- package/src/common-apis/tests/integration/external-apis/ipAddressProviders/getClientIpAddress.test.js +12 -0
- package/src/common-apis/tests/units/utils/amountUtils/composeRateText.test.js +152 -0
- package/src/{common → common-apis/utils}/amountUtils.js +72 -136
- package/src/common-apis/utils/cache.js +242 -0
- package/src/{common → common-apis/utils}/errorUtils.js +15 -0
- package/src/common-apis/utils/logging/logger.js +41 -0
- package/src/common-apis/utils/logging/logsStorage.js +61 -0
- package/src/common-apis/utils/postponeExecution.js +11 -0
- package/src/common-apis/utils/rabbitTicker.js +24 -0
- package/src/common-apis/utils/safeStringify.js +50 -0
- package/src/index.js +96 -9
- package/src/robust-api-caller/cacheAndConcurrentRequestsResolver.js +495 -0
- package/src/robust-api-caller/cachedRobustExternalApiCallerService.js +147 -0
- package/src/robust-api-caller/cancelProcessing.js +29 -0
- package/src/robust-api-caller/concurrentCalculationsMetadataHolder.js +75 -0
- package/src/robust-api-caller/externalApiProvider.js +156 -0
- package/src/robust-api-caller/externalServicesStatsCollector.js +78 -0
- package/src/robust-api-caller/robustExternalAPICallerService.js +304 -0
- package/src/robust-api-caller/tests/robustExternalAPICallerService/robustExternalAPICallerService/callExternalAPI/_performCallAttempt.test.js +533 -0
- package/src/robust-api-caller/tests/robustExternalAPICallerService/robustExternalAPICallerService/callExternalAPI/callExternalAPI.test.js +532 -0
- package/src/robust-api-caller/tests/robustExternalAPICallerService/robustExternalAPICallerService/constructor.test.js +19 -0
- package/src/swaps-lib/external-apis/exolixSwapProvider.js +580 -0
- package/src/swaps-lib/external-apis/letsExchangeSwapProvider.js +511 -0
- package/src/swaps-lib/external-apis/swapProvider.js +578 -0
- package/src/swaps-lib/external-apis/swapspaceSwapProvider.js +592 -0
- package/src/swaps-lib/models/baseSwapCreationInfo.js +78 -0
- package/src/swaps-lib/models/existingSwap.js +143 -0
- package/src/swaps-lib/models/existingSwapWithFiatData.js +148 -0
- package/src/swaps-lib/models/partner.js +27 -0
- package/src/swaps-lib/models/swapProviderCoinInfo.js +82 -0
- package/src/swaps-lib/services/publicSwapService.js +490 -0
- package/src/swaps-lib/test/external-apis/exolixSwapProvider/_fetchSupportedCurrenciesIfNeeded.test.js +34 -0
- package/src/swaps-lib/test/external-apis/exolixSwapProvider/createSwap.test.js +1043 -0
- package/src/swaps-lib/test/external-apis/exolixSwapProvider/getSwapInfo.test.js +611 -0
- package/src/swaps-lib/test/external-apis/swapProvider/getAllSupportedCurrencies.test.js +63 -0
- package/src/swaps-lib/test/external-apis/swapProvider/getDepositCurrencies.test.js +73 -0
- package/src/swaps-lib/test/external-apis/swapProvider/getWithdrawalCurrencies.test.js +102 -0
- package/src/swaps-lib/test/external-apis/swapProvider/removeProtocolNameFromCoinName.test.js +152 -0
- package/src/swaps-lib/test/external-apis/swapspaceSwapProvider/_fetchSupportedCurrenciesIfNeeded.test.js +536 -0
- package/src/swaps-lib/test/external-apis/swapspaceSwapProvider/createSwap.test.js +1214 -0
- package/src/swaps-lib/test/external-apis/swapspaceSwapProvider/getSwapInfo.test.js +1707 -0
- package/src/swaps-lib/test/utils/swapUtils/safeHandleRequestsLimitExceeding.test.js +80 -0
- package/src/swaps-lib/utils/swapUtils.js +195 -0
- package/{styles → src/ui-kit/assets/styles}/_functions.scss +5 -0
- package/{styles → src/ui-kit/assets/styles}/_mixins.scss +2 -2
- package/{styles → src/ui-kit/assets/styles}/_placeholder.scss +3 -3
- package/{styles → src/ui-kit/assets/styles}/_variables.scss +17 -15
- package/src/ui-kit/assets/styles/fonts/NunitoSans-Bold.ttf +0 -0
- package/src/ui-kit/assets/styles/fonts/NunitoSans-ExtraBold.ttf +0 -0
- package/src/ui-kit/assets/styles/fonts/NunitoSans-Light.ttf +0 -0
- package/src/ui-kit/assets/styles/fonts/NunitoSans-Regular.ttf +0 -0
- package/src/ui-kit/assets/styles/fonts/NunitoSans-SemiBold.ttf +0 -0
- package/src/ui-kit/assets/styles/global.scss +171 -0
- package/src/ui-kit/assets/styles/index.scss +10 -0
- package/src/ui-kit/assets/wrappedImages/arrowIcon.jsx +13 -0
- package/src/ui-kit/assets/wrappedImages/arrowTosca.jsx +14 -0
- package/src/ui-kit/assets/wrappedImages/arrowWhite.jsx +14 -0
- package/src/ui-kit/assets/wrappedImages/darkRectangle.jsx +7 -0
- package/src/ui-kit/assets/wrappedImages/determinedError.jsx +118 -0
- package/src/ui-kit/assets/wrappedImages/failedValidationIcon.jsx +39 -0
- package/src/ui-kit/assets/wrappedImages/infoIcon.jsx +16 -0
- package/src/ui-kit/assets/wrappedImages/messageIcon.jsx +87 -0
- package/src/ui-kit/assets/wrappedImages/noticeQuestionIcon.jsx +54 -0
- package/src/ui-kit/assets/wrappedImages/successfulValidationIcon.jsx +26 -0
- package/src/ui-kit/assets/wrappedImages/supportDialogImage.jsx +61 -0
- package/src/ui-kit/assets/wrappedImages/walletIcon.jsx +22 -0
- package/src/ui-kit/components/atoms/AssetIcon/AssetIcon.jsx +57 -0
- package/src/{components → ui-kit/components}/atoms/AssetIcon/asset-icon.module.scss +1 -1
- package/src/ui-kit/components/atoms/AssetSelection/AssetSelection.jsx +68 -0
- package/src/ui-kit/components/atoms/AssetSelection/asset-selection.module.scss +56 -0
- package/src/ui-kit/components/atoms/BackgroundTitle/BackgroundTitle.jsx +34 -0
- package/src/ui-kit/components/atoms/BackgroundTitle/background-title.module.scss +52 -0
- package/src/ui-kit/components/atoms/InformationMessage/InformationMessage.jsx +51 -0
- package/src/ui-kit/components/atoms/InformationMessage/information-message.module.scss +38 -0
- package/src/ui-kit/components/atoms/Input/Input.jsx +183 -0
- package/src/ui-kit/components/atoms/Input/input.module.scss +107 -0
- package/src/{components → ui-kit/components}/atoms/LoadingDots/LoadingDots.jsx +8 -28
- package/src/{components → ui-kit/components}/atoms/LoadingDots/LoadingDots.module.scss +3 -2
- package/src/ui-kit/components/atoms/NoticeIcon/NoticeIcon.jsx +64 -0
- package/src/ui-kit/components/atoms/NoticeIcon/notice-icon.module.scss +14 -0
- package/src/ui-kit/components/atoms/QrCode/QrCode.jsx +44 -0
- package/src/ui-kit/components/atoms/QrCode/qr-code.module.scss +15 -0
- package/src/ui-kit/components/atoms/RateSelector/RateSelector.jsx +30 -0
- package/src/ui-kit/components/atoms/RateSelector/rate-selector.module.scss +47 -0
- package/src/{components → ui-kit/components}/atoms/SupportChat/SupportChat.jsx +5 -1
- package/src/ui-kit/components/atoms/Textarea/Textarea.jsx +148 -0
- package/src/ui-kit/components/atoms/Textarea/textarea.module.scss +71 -0
- package/src/ui-kit/components/atoms/TitleBox/TitleBox.jsx +141 -0
- package/src/ui-kit/components/atoms/TitleBox/title-box.module.scss +32 -0
- package/src/ui-kit/components/atoms/Tooltip/Tooltip.jsx +77 -0
- package/src/ui-kit/components/atoms/Tooltip/tooltip.module.scss +237 -0
- package/src/ui-kit/components/atoms/TwoLinesOfText/LinesOfText.jsx +76 -0
- package/src/ui-kit/components/atoms/TwoLinesOfText/lines-of-text.module.scss +65 -0
- package/src/ui-kit/components/atoms/Validation/Validation.jsx +39 -0
- package/src/ui-kit/components/atoms/Validation/validation.module.scss +19 -0
- package/src/{components → ui-kit/components}/atoms/buttons/Button/Button.jsx +24 -50
- package/src/{components → ui-kit/components}/atoms/buttons/Button/Button.module.scss +1 -1
- package/src/ui-kit/components/atoms/buttons/Close/Close.jsx +58 -0
- package/src/ui-kit/components/atoms/buttons/Close/close.module.scss +75 -0
- package/src/ui-kit/components/atoms/buttons/LinkButton/LinkButton.jsx +112 -0
- package/src/ui-kit/components/atoms/buttons/LinkButton/link-button.module.scss +49 -0
- package/src/ui-kit/components/atoms/buttons/RadioButtonWithText/RadioButtonWithText.jsx +110 -0
- package/src/ui-kit/components/atoms/buttons/RadioButtonWithText/radio-button-with-text.module.scss +86 -0
- package/src/ui-kit/components/molecules/AmountInput/AmountInput.jsx +448 -0
- package/src/ui-kit/components/molecules/AmountInput/amount-input.module.scss +233 -0
- package/src/ui-kit/components/molecules/CoinPicker/CoinPicker.jsx +463 -0
- package/src/ui-kit/components/molecules/CoinPicker/coin-picker.module.scss +207 -0
- package/src/ui-kit/components/molecules/ColoredNotice/ColoredNotice.jsx +42 -0
- package/src/ui-kit/components/molecules/ColoredNotice/colored-notice.module.scss +20 -0
- package/src/ui-kit/components/molecules/LineWithIconLink/LineWithIconLink.jsx +35 -0
- package/src/ui-kit/components/molecules/LineWithIconLink/line-with-icon-link.module.scss +25 -0
- package/src/ui-kit/components/molecules/LogoCarousel/LogoCarousel.jsx +74 -0
- package/src/ui-kit/components/molecules/LogoCarousel/logo-carousel.module.scss +106 -0
- package/src/ui-kit/components/molecules/SearchableCoinsList/SearchableCoinsList.jsx +137 -0
- package/src/ui-kit/components/molecules/TitledLineWithIconLink/TitledLineWithIconLink.jsx +32 -0
- package/src/ui-kit/components/organisms/CoinPickerDialogStep/CoinPickerDialogStep.jsx +66 -0
- package/src/ui-kit/components/organisms/Dialog/Dialog.jsx +494 -0
- package/src/ui-kit/components/organisms/Dialog/DialogButtons/DialogButtons.jsx +132 -0
- package/src/ui-kit/components/organisms/Dialog/DialogButtons/dialog-buttons.module.scss +25 -0
- package/src/ui-kit/components/organisms/Dialog/DialogStep/DialogStep.jsx +554 -0
- package/src/ui-kit/components/organisms/Dialog/DialogStep/dialog-step.module.scss +381 -0
- package/src/ui-kit/components/organisms/Dialog/dialog.module.scss +226 -0
- package/src/ui-kit/components/organisms/SwapForm/SwapForm.jsx +1374 -0
- package/src/ui-kit/components/organisms/SwapForm/swap-form.module.scss +134 -0
- package/src/ui-kit/components/organisms/WaitlistSubscription/WaitlistSubscription.jsx +158 -0
- package/src/ui-kit/components/templates/DeterminedErrorDialogStep/DeterminedErrorDialogStep.jsx +77 -0
- package/src/ui-kit/hooks/useCallHandlingErrors.js +22 -0
- package/src/ui-kit/hooks/useIsHydrated.js +12 -0
- package/src/ui-kit/hooks/useReferredState.js +24 -0
- package/src/ui-kit/tests/utils/inputValueProviders/provideFormatOfFloatValueByInputString.test.js +146 -0
- package/src/ui-kit/tests/utils/urlQueryUtils/getQueryParameterValues.test.js +65 -0
- package/src/ui-kit/tests/utils/urlQueryUtils/saveQueryParameterAndValues.test.js +104 -0
- package/src/ui-kit/utils/inputValueProviders.js +50 -0
- package/src/ui-kit/utils/textUtils.js +18 -0
- package/src/ui-kit/utils/uiUtils.js +12 -0
- package/src/ui-kit/utils/urlQueryUtils.js +62 -0
- package/stories/font.scss +40 -0
- package/stories/stubs/coins.jsx +2266 -0
- package/stories/stubs/exampleContent.jsx +20 -0
- package/src/components/atoms/AssetIcon/AssetIcon.jsx +0 -55
- package/styles/_global-classes.scss +0 -433
- package/styles/fonts/NunitoSans-Bold.ttf +0 -0
- package/styles/fonts/NunitoSans-ExtraBold.ttf +0 -0
- package/styles/fonts/NunitoSans-Light.ttf +0 -0
- package/styles/fonts/NunitoSans-Regular.ttf +0 -0
- package/styles/fonts/NunitoSans-SemiBold.ttf +0 -0
- package/styles/global-styles-index.scss +0 -74
- package/styles/index.scss +0 -33
- /package/{styles → src/ui-kit/assets/styles}/colors/_light-colors.scss +0 -0
- /package/{styles → src/ui-kit/assets/styles}/colors/_solid-colors.scss +0 -0
- /package/{styles → src/ui-kit/assets/styles}/size/_margin-size.scss +0 -0
- /package/{styles → src/ui-kit/assets/styles}/size/_padding-size.scss +0 -0
|
@@ -0,0 +1,448 @@
|
|
|
1
|
+
import React, { useEffect, useState } from "react";
|
|
2
|
+
import { BigNumber } from "bignumber.js";
|
|
3
|
+
import { CSSTransition } from "react-transition-group";
|
|
4
|
+
import PropTypes from "prop-types";
|
|
5
|
+
|
|
6
|
+
import s from "./amount-input.module.scss";
|
|
7
|
+
import WalletIcon from "../../../assets/wrappedImages/walletIcon.jsx";
|
|
8
|
+
|
|
9
|
+
import { useCallHandlingErrors } from "../../../hooks/useCallHandlingErrors.js";
|
|
10
|
+
import { InputValuesProviders } from "../../../utils/inputValueProviders.js";
|
|
11
|
+
import { logErrorOrOutputToConsole } from "../../../../common-apis/utils/errorUtils.js";
|
|
12
|
+
|
|
13
|
+
import { TitleBox } from "../../atoms/TitleBox/TitleBox.jsx";
|
|
14
|
+
import { AmountUtils } from "../../../../common-apis/utils/amountUtils.js";
|
|
15
|
+
import { AssetSelection } from "../../atoms/AssetSelection/AssetSelection.jsx";
|
|
16
|
+
import { Validation } from "../../atoms/Validation/Validation.jsx";
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* AmountInput component is used for inputting an amount in both cryptocurrency and fiat formats.
|
|
20
|
+
* It supports converting between the two based on the provided exchange rate.
|
|
21
|
+
*
|
|
22
|
+
* @component
|
|
23
|
+
* @param {Object} props
|
|
24
|
+
* @param {string} props.label - The label displayed above the input.
|
|
25
|
+
* @param {Function} props.handleCoinAmountChange - Callback function called when the coin amount changes.
|
|
26
|
+
* @param {Function} props.handleFiatAmountChange - Callback function called when the fiat amount changes.
|
|
27
|
+
* @param {Function} props.handleChangeAssetClick - Callback function called when the asset change button is clicked.
|
|
28
|
+
* @param {Function} props.handleBalanceValidationChange - Callback function called when balance validation changes.
|
|
29
|
+
* @param {boolean} props.disabled - Disables the input fields when true.
|
|
30
|
+
* @param {boolean} props.locked - Locks the input fields when true.
|
|
31
|
+
* @param {string} props.alertText - Text to be displayed as an alert below the input.
|
|
32
|
+
* @param {string} props.predefinedValue - Predefined value to be set in the input.
|
|
33
|
+
* @param {React.ReactNode} props.children - Any additional elements to be rendered inside the component.
|
|
34
|
+
* @param {string} props.ticker - The ticker code of the asset.
|
|
35
|
+
* @param {string} props.tickerPrintable - The printable version of the ticker code.
|
|
36
|
+
* @param {number} props.assetDecimalPlaces - The number of decimal places allowed for the asset.
|
|
37
|
+
* @param {Object} props.assetBalance - The balance of the asset in both fiat and crypto formats.
|
|
38
|
+
* @param {string} props.assetIconSrc - The source URL of the asset icon.
|
|
39
|
+
* @param {string} props.assetIconProtocolSrc - The source URL of the asset protocol icon.
|
|
40
|
+
* @param {string} props.fallbackAssetIconSrc - The source URL of the fallback asset icon.
|
|
41
|
+
* @param {boolean} props.isSendAll - Determines if the "Send All" button is shown.
|
|
42
|
+
* @param {Function} props.handleSendAllClick - Callback function called when the "Send All" button is clicked.
|
|
43
|
+
* @param {boolean} props.showBalance - Determines if the balance should be displayed.
|
|
44
|
+
* @param {boolean} props.showBalanceValidation - Determines if the balance validation should be shown.
|
|
45
|
+
* @param {boolean} props.showChangeAssetButton - Determines if the change asset button should be displayed.
|
|
46
|
+
* @param {string} props.changeAssetButtonProtocol - The protocol name to be displayed on the change asset button.
|
|
47
|
+
* @param {boolean} props.changeAssetButtonDisabled - Disables the change asset button when true.
|
|
48
|
+
* @param {boolean} props.upperFormPosition - Applies a style for the upper form position.
|
|
49
|
+
* @param {boolean} props.lowerFormPosition - Applies a style for the lower form position.
|
|
50
|
+
* @param {boolean} props.errorEncountered - Indicates if an error was encountered.
|
|
51
|
+
* @param {string} props.updateAssetInputTo - The value to update the asset input to.
|
|
52
|
+
* @param {boolean} props.estimateAmount - Indicates if the amount is estimated.
|
|
53
|
+
* @param {boolean} props.isLoading - Indicates if the component is in a loading state.
|
|
54
|
+
* @param {string} props.cryptoAssetToFiatRate - The conversion rate from crypto asset to fiat.
|
|
55
|
+
* @param {string} props.fiatCurrencyCode - The fiat currency code.
|
|
56
|
+
* @param {number} props.fiatCurrencyDecimals - The number of decimal places allowed for the fiat currency.
|
|
57
|
+
* @param {string} props.linkButtonActiveText - The text for the active state of the link button.
|
|
58
|
+
* @param {string} props.linkButtonInactiveText - The text for the inactive state of the link button.
|
|
59
|
+
* @param {string} props.balanceLoaderText - The text to display while the balance is loading.
|
|
60
|
+
* @param {string} props.fiatInputPlaceholderText - The placeholder text for the fiat input.
|
|
61
|
+
* @param {React.Ref} buttonForwardRef - A ref passed to the change asset button.
|
|
62
|
+
*/
|
|
63
|
+
export const AmountInput = React.forwardRef(
|
|
64
|
+
(
|
|
65
|
+
{
|
|
66
|
+
label = "",
|
|
67
|
+
handleCoinAmountChange = btcAmount => {},
|
|
68
|
+
handleFiatAmountChange = fiatAmount => {},
|
|
69
|
+
handleChangeAssetClick = () => {},
|
|
70
|
+
handleBalanceValidationChange = isValid => {},
|
|
71
|
+
disabled,
|
|
72
|
+
locked,
|
|
73
|
+
alertText,
|
|
74
|
+
predefinedValue,
|
|
75
|
+
children,
|
|
76
|
+
ticker,
|
|
77
|
+
tickerPrintable,
|
|
78
|
+
assetDecimalPlaces,
|
|
79
|
+
assetBalance = { fiatAmount: null, assetAmount: null },
|
|
80
|
+
assetIconSrc,
|
|
81
|
+
assetIconProtocolSrc,
|
|
82
|
+
fallbackAssetIconSrc,
|
|
83
|
+
isSendAll = null,
|
|
84
|
+
handleSendAllClick = () => {},
|
|
85
|
+
showBalance = false,
|
|
86
|
+
showBalanceValidation = false,
|
|
87
|
+
showChangeAssetButton = false,
|
|
88
|
+
changeAssetButtonProtocol,
|
|
89
|
+
changeAssetButtonDisabled = false,
|
|
90
|
+
upperFormPosition,
|
|
91
|
+
lowerFormPosition,
|
|
92
|
+
errorEncountered,
|
|
93
|
+
updateAssetInputTo = null,
|
|
94
|
+
estimateAmount = false,
|
|
95
|
+
isLoading = false,
|
|
96
|
+
cryptoAssetToFiatRate = null,
|
|
97
|
+
fiatCurrencyCode = null,
|
|
98
|
+
fiatCurrencyDecimals = null,
|
|
99
|
+
linkButtonActiveText = null,
|
|
100
|
+
linkButtonInactiveText = null,
|
|
101
|
+
balanceLoaderText = null,
|
|
102
|
+
fiatInputPlaceholderText = null,
|
|
103
|
+
},
|
|
104
|
+
buttonForwardRef
|
|
105
|
+
) => {
|
|
106
|
+
const callHandlingErrors = useCallHandlingErrors();
|
|
107
|
+
|
|
108
|
+
const [coinAmountValue, setCoinAmountValue] = useState("");
|
|
109
|
+
const [coinAmountPlaceholder, setCoinAmountPlaceholder] = useState("0");
|
|
110
|
+
const [fiatAmountValue, setFiatAmountValue] = useState("");
|
|
111
|
+
const [interactedWith, setInteractedWith] = useState(false);
|
|
112
|
+
const [fiatAmountAutoFocus, setFiatAmountAutoFocus] = useState(false);
|
|
113
|
+
const [isInFocus, setIsInFocus] = useState(false);
|
|
114
|
+
const [highlightBalance, setHighlightBalance] = useState(false);
|
|
115
|
+
const [highlightInput, setHighlightInput] = useState(false);
|
|
116
|
+
|
|
117
|
+
const resetToDefault = () => {
|
|
118
|
+
setInteractedWith(false);
|
|
119
|
+
setFiatAmountAutoFocus(false);
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
useEffect(() => {
|
|
123
|
+
if (updateAssetInputTo !== null) handleChangeAmount(updateAssetInputTo?.toString(), false);
|
|
124
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
125
|
+
}, [updateAssetInputTo]);
|
|
126
|
+
|
|
127
|
+
const handleChangeAmount = (newAmountString, handlerEnabled = true) => {
|
|
128
|
+
(async () => {
|
|
129
|
+
try {
|
|
130
|
+
const correctedAmount = InputValuesProviders.provideFormatOfFloatValueByInputString(
|
|
131
|
+
newAmountString,
|
|
132
|
+
assetDecimalPlaces
|
|
133
|
+
);
|
|
134
|
+
setCoinAmountValue(correctedAmount);
|
|
135
|
+
if (handlerEnabled) handleCoinAmountChange(correctedAmount);
|
|
136
|
+
|
|
137
|
+
if (correctedAmount !== "" && cryptoAssetToFiatRate != null) {
|
|
138
|
+
const fiatAmount = BigNumber(correctedAmount)
|
|
139
|
+
.times(cryptoAssetToFiatRate)
|
|
140
|
+
.toFixed(fiatCurrencyDecimals);
|
|
141
|
+
setFiatAmountValue(fiatAmount);
|
|
142
|
+
handleFiatAmountChange(fiatAmount);
|
|
143
|
+
} else {
|
|
144
|
+
setFiatAmountValue("");
|
|
145
|
+
}
|
|
146
|
+
} catch (e) {
|
|
147
|
+
setFiatAmountValue(null);
|
|
148
|
+
logErrorOrOutputToConsole(e);
|
|
149
|
+
}
|
|
150
|
+
})();
|
|
151
|
+
setInteractedWith(true);
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
const handleChangeAmountFiat = newAmountString => {
|
|
155
|
+
if (cryptoAssetToFiatRate == null) return;
|
|
156
|
+
(async () => {
|
|
157
|
+
try {
|
|
158
|
+
const correctedFiatAmount = InputValuesProviders.provideFormatOfFloatValueByInputString(
|
|
159
|
+
newAmountString,
|
|
160
|
+
fiatCurrencyDecimals
|
|
161
|
+
);
|
|
162
|
+
setFiatAmountValue(correctedFiatAmount);
|
|
163
|
+
handleFiatAmountChange(correctedFiatAmount);
|
|
164
|
+
|
|
165
|
+
const coinAmount =
|
|
166
|
+
correctedFiatAmount !== ""
|
|
167
|
+
? BigNumber(correctedFiatAmount).div(cryptoAssetToFiatRate).toFixed(assetDecimalPlaces)
|
|
168
|
+
: "0";
|
|
169
|
+
const coinsAmount = BigNumber(coinAmount).isZero() ? "" : coinAmount;
|
|
170
|
+
setCoinAmountValue(coinsAmount);
|
|
171
|
+
handleCoinAmountChange(coinsAmount);
|
|
172
|
+
} catch (e) {
|
|
173
|
+
setFiatAmountValue(null);
|
|
174
|
+
logErrorOrOutputToConsole(e);
|
|
175
|
+
}
|
|
176
|
+
})();
|
|
177
|
+
};
|
|
178
|
+
|
|
179
|
+
const placeholderByDecimalCount = decimalCount =>
|
|
180
|
+
"0" + (decimalCount > 0 ? "." + "0".repeat(decimalCount) : "");
|
|
181
|
+
|
|
182
|
+
const handleFiatInteraction = () => {
|
|
183
|
+
if (disabled || locked) return;
|
|
184
|
+
setFiatAmountAutoFocus(true);
|
|
185
|
+
setInteractedWith(true);
|
|
186
|
+
};
|
|
187
|
+
|
|
188
|
+
useEffect(() => {
|
|
189
|
+
predefinedValue != null && handleChangeAmount(predefinedValue + "");
|
|
190
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
191
|
+
}, [predefinedValue]);
|
|
192
|
+
|
|
193
|
+
useEffect(() => {
|
|
194
|
+
if (!cryptoAssetToFiatRate || typeof cryptoAssetToFiatRate !== "string") return;
|
|
195
|
+
|
|
196
|
+
handleChangeAmount(coinAmountValue, false);
|
|
197
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
198
|
+
}, [cryptoAssetToFiatRate]);
|
|
199
|
+
|
|
200
|
+
useEffect(() => {
|
|
201
|
+
try {
|
|
202
|
+
setCoinAmountPlaceholder(placeholderByDecimalCount(assetDecimalPlaces));
|
|
203
|
+
} catch (e) {
|
|
204
|
+
logErrorOrOutputToConsole(e);
|
|
205
|
+
}
|
|
206
|
+
resetToDefault();
|
|
207
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
208
|
+
}, [ticker]);
|
|
209
|
+
|
|
210
|
+
// Check if input & balance highlights are needed after a change in either the asset amount or the balance
|
|
211
|
+
useEffect(() => {
|
|
212
|
+
if (!showBalanceValidation || assetBalance?.assetAmount == null) return;
|
|
213
|
+
|
|
214
|
+
let enableHighlight = BigNumber(coinAmountValue).gt(assetBalance?.assetAmount);
|
|
215
|
+
|
|
216
|
+
handleBalanceValidationChange(enableHighlight);
|
|
217
|
+
setHighlightBalance(enableHighlight);
|
|
218
|
+
setHighlightInput(enableHighlight);
|
|
219
|
+
|
|
220
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
221
|
+
}, [coinAmountValue, assetBalance]);
|
|
222
|
+
|
|
223
|
+
// Clearing the custom focus upon disabling or enabling the form
|
|
224
|
+
useEffect(() => setIsInFocus(false), [disabled, locked]);
|
|
225
|
+
|
|
226
|
+
return (
|
|
227
|
+
<>
|
|
228
|
+
<TitleBox
|
|
229
|
+
title={label}
|
|
230
|
+
linkText={isSendAll !== null ? (isSendAll ? linkButtonActiveText : linkButtonInactiveText) : null}
|
|
231
|
+
linkButtonClick={handleSendAllClick}
|
|
232
|
+
>
|
|
233
|
+
<div
|
|
234
|
+
className={[
|
|
235
|
+
s["amount-input-container"],
|
|
236
|
+
isInFocus ? s["focus"] : "",
|
|
237
|
+
errorEncountered || highlightInput ? s["error-encountered"] : "",
|
|
238
|
+
upperFormPosition ? s["upper-form-position"] : "",
|
|
239
|
+
lowerFormPosition ? s["lower-form-position"] : "",
|
|
240
|
+
].join(" ")}
|
|
241
|
+
>
|
|
242
|
+
<div
|
|
243
|
+
className={`${s["amount-input-container-input-wrapper"]} ${disabled ? s["disabled"] : ""}
|
|
244
|
+
${children ? s["bottom-margin"] : ""}`}
|
|
245
|
+
>
|
|
246
|
+
{showBalance ? (
|
|
247
|
+
<div className={s["asset-balance"] + " " + (highlightBalance ? s["red"] : "")}>
|
|
248
|
+
<WalletIcon />
|
|
249
|
+
<p>
|
|
250
|
+
{assetBalance?.assetAmount != null &&
|
|
251
|
+
assetBalance?.fiatAmount != null &&
|
|
252
|
+
ticker &&
|
|
253
|
+
fiatCurrencyCode ? (
|
|
254
|
+
<>
|
|
255
|
+
{AmountUtils.cryptoFull(
|
|
256
|
+
assetBalance.assetAmount,
|
|
257
|
+
tickerPrintable,
|
|
258
|
+
assetDecimalPlaces
|
|
259
|
+
)}
|
|
260
|
+
<span>
|
|
261
|
+
{" ~ " +
|
|
262
|
+
AmountUtils.fiat(assetBalance.fiatAmount, fiatCurrencyCode)}
|
|
263
|
+
</span>
|
|
264
|
+
</>
|
|
265
|
+
) : (
|
|
266
|
+
balanceLoaderText
|
|
267
|
+
)}
|
|
268
|
+
</p>
|
|
269
|
+
</div>
|
|
270
|
+
) : (
|
|
271
|
+
""
|
|
272
|
+
)}
|
|
273
|
+
|
|
274
|
+
<div className={s["requested-amount-coin"]}>
|
|
275
|
+
<span className={s["requested-amount-coin-currency"]}>
|
|
276
|
+
{tickerPrintable ? (estimateAmount ? "~ " : "") + tickerPrintable : ""}
|
|
277
|
+
</span>
|
|
278
|
+
{!isLoading ? (
|
|
279
|
+
<input
|
|
280
|
+
type="text"
|
|
281
|
+
inputMode="decimal"
|
|
282
|
+
value={coinAmountValue}
|
|
283
|
+
onChange={e => handleChangeAmount(e.target.value)}
|
|
284
|
+
placeholder={coinAmountPlaceholder}
|
|
285
|
+
className={s["requested-amount-coin-input"]}
|
|
286
|
+
disabled={disabled || locked}
|
|
287
|
+
onFocus={e => callHandlingErrors(() => setIsInFocus(true), e)}
|
|
288
|
+
onBlur={e => callHandlingErrors(() => setIsInFocus(false), e)}
|
|
289
|
+
/>
|
|
290
|
+
) : (
|
|
291
|
+
<div className={s["requested-amount-coin-skeleton"]}>
|
|
292
|
+
<span
|
|
293
|
+
className={
|
|
294
|
+
s["requested-amount-coin-skeleton-content"] + " " + "skeleton-dark"
|
|
295
|
+
}
|
|
296
|
+
></span>
|
|
297
|
+
</div>
|
|
298
|
+
)}
|
|
299
|
+
</div>
|
|
300
|
+
<CSSTransition
|
|
301
|
+
in={fiatCurrencyCode !== null}
|
|
302
|
+
timeout={200}
|
|
303
|
+
classNames={{
|
|
304
|
+
enter: s["requested-amount-fiat-enter"],
|
|
305
|
+
enterActive: s["requested-amount-fiat-enter-active"],
|
|
306
|
+
exit: s["requested-amount-fiat-exit"],
|
|
307
|
+
exitActive: s["requested-amount-fiat-exit-active"],
|
|
308
|
+
}}
|
|
309
|
+
unmountOnExit
|
|
310
|
+
>
|
|
311
|
+
<div
|
|
312
|
+
className={
|
|
313
|
+
s["requested-amount-fiat"] + (interactedWith ? " " + s["interacted"] : "")
|
|
314
|
+
}
|
|
315
|
+
>
|
|
316
|
+
{interactedWith ? (
|
|
317
|
+
<>
|
|
318
|
+
<span className={s["requested-amount-fiat-currency"]}>
|
|
319
|
+
{(estimateAmount ? "~ " : "") + fiatCurrencyCode}
|
|
320
|
+
</span>
|
|
321
|
+
|
|
322
|
+
{!isLoading && cryptoAssetToFiatRate != null ? (
|
|
323
|
+
<input
|
|
324
|
+
type="text"
|
|
325
|
+
inputMode="decimal"
|
|
326
|
+
className={s["requested-amount-fiat-input"]}
|
|
327
|
+
value={fiatAmountValue}
|
|
328
|
+
disabled={disabled || locked}
|
|
329
|
+
onChange={e => handleChangeAmountFiat(e.target.value)}
|
|
330
|
+
placeholder={placeholderByDecimalCount(fiatCurrencyDecimals)}
|
|
331
|
+
autoFocus={fiatAmountAutoFocus}
|
|
332
|
+
onFocus={e => callHandlingErrors(() => setIsInFocus(true), e)}
|
|
333
|
+
onBlur={e => callHandlingErrors(() => setIsInFocus(false), e)}
|
|
334
|
+
/>
|
|
335
|
+
) : (
|
|
336
|
+
<div className={s["requested-amount-fiat-skeleton"]}>
|
|
337
|
+
<span
|
|
338
|
+
className={
|
|
339
|
+
s["requested-amount-fiat-skeleton-content"] +
|
|
340
|
+
" " +
|
|
341
|
+
"skeleton-dark"
|
|
342
|
+
}
|
|
343
|
+
></span>
|
|
344
|
+
</div>
|
|
345
|
+
)}
|
|
346
|
+
</>
|
|
347
|
+
) : (
|
|
348
|
+
<span
|
|
349
|
+
className={s["requested-amount-fiat-placeholder"]}
|
|
350
|
+
onClick={e => callHandlingErrors(() => handleFiatInteraction(), e)}
|
|
351
|
+
>
|
|
352
|
+
{fiatInputPlaceholderText}
|
|
353
|
+
</span>
|
|
354
|
+
)}
|
|
355
|
+
</div>
|
|
356
|
+
</CSSTransition>
|
|
357
|
+
</div>
|
|
358
|
+
{showChangeAssetButton && ticker ? (
|
|
359
|
+
<div className={s["amount-input-container-button-wrapper"]} ref={buttonForwardRef}>
|
|
360
|
+
<AssetSelection
|
|
361
|
+
assetIconSrc={assetIconSrc}
|
|
362
|
+
assetIconProtocolSrc={assetIconProtocolSrc}
|
|
363
|
+
fallbackSrc={fallbackAssetIconSrc}
|
|
364
|
+
handleClick={handleChangeAssetClick}
|
|
365
|
+
disabled={changeAssetButtonDisabled}
|
|
366
|
+
protocolName={changeAssetButtonProtocol}
|
|
367
|
+
/>
|
|
368
|
+
</div>
|
|
369
|
+
) : (
|
|
370
|
+
""
|
|
371
|
+
)}
|
|
372
|
+
{children}
|
|
373
|
+
</div>
|
|
374
|
+
</TitleBox>
|
|
375
|
+
{alertText ? <Validation text={alertText} /> : null}
|
|
376
|
+
</>
|
|
377
|
+
);
|
|
378
|
+
}
|
|
379
|
+
);
|
|
380
|
+
|
|
381
|
+
AmountInput.propTypes = {
|
|
382
|
+
label: PropTypes.string,
|
|
383
|
+
handleCoinAmountChange: PropTypes.func,
|
|
384
|
+
handleFiatAmountChange: PropTypes.func,
|
|
385
|
+
handleChangeAssetClick: PropTypes.func,
|
|
386
|
+
handleBalanceValidationChange: PropTypes.func,
|
|
387
|
+
disabled: PropTypes.bool,
|
|
388
|
+
locked: PropTypes.bool,
|
|
389
|
+
alertText: PropTypes.string,
|
|
390
|
+
predefinedValue: PropTypes.string,
|
|
391
|
+
children: PropTypes.node,
|
|
392
|
+
ticker: PropTypes.string,
|
|
393
|
+
tickerPrintable: PropTypes.string,
|
|
394
|
+
assetDecimalPlaces: PropTypes.number,
|
|
395
|
+
assetBalance: PropTypes.shape({
|
|
396
|
+
fiatAmount: PropTypes.string,
|
|
397
|
+
assetAmount: PropTypes.string,
|
|
398
|
+
}),
|
|
399
|
+
assetIconSrc: PropTypes.string,
|
|
400
|
+
assetIconProtocolSrc: PropTypes.string,
|
|
401
|
+
fallbackAssetIconSrc: PropTypes.string,
|
|
402
|
+
isSendAll: PropTypes.bool,
|
|
403
|
+
handleSendAllClick: PropTypes.func,
|
|
404
|
+
showBalance: PropTypes.bool,
|
|
405
|
+
showBalanceValidation: PropTypes.bool,
|
|
406
|
+
showChangeAssetButton: PropTypes.bool,
|
|
407
|
+
changeAssetButtonProtocol: PropTypes.string,
|
|
408
|
+
changeAssetButtonDisabled: PropTypes.bool,
|
|
409
|
+
upperFormPosition: PropTypes.bool,
|
|
410
|
+
lowerFormPosition: PropTypes.bool,
|
|
411
|
+
errorEncountered: PropTypes.bool,
|
|
412
|
+
updateAssetInputTo: PropTypes.string,
|
|
413
|
+
estimateAmount: PropTypes.bool,
|
|
414
|
+
isLoading: PropTypes.bool,
|
|
415
|
+
cryptoAssetToFiatRate: PropTypes.string,
|
|
416
|
+
fiatCurrencyCode: PropTypes.string,
|
|
417
|
+
fiatCurrencyDecimals: PropTypes.number,
|
|
418
|
+
linkButtonActiveText: PropTypes.string,
|
|
419
|
+
linkButtonInactiveText: PropTypes.string,
|
|
420
|
+
balanceLoaderText: PropTypes.string,
|
|
421
|
+
fiatInputPlaceholderText: PropTypes.string,
|
|
422
|
+
buttonForwardRef: PropTypes.object,
|
|
423
|
+
};
|
|
424
|
+
|
|
425
|
+
AmountInput.defaultProps = {
|
|
426
|
+
label: "",
|
|
427
|
+
handleCoinAmountChange: () => {},
|
|
428
|
+
handleFiatAmountChange: () => {},
|
|
429
|
+
handleChangeAssetClick: () => {},
|
|
430
|
+
handleBalanceValidationChange: () => {},
|
|
431
|
+
assetBalance: { fiatAmount: null, assetAmount: null },
|
|
432
|
+
isSendAll: null,
|
|
433
|
+
handleSendAllClick: () => {},
|
|
434
|
+
showBalance: false,
|
|
435
|
+
showBalanceValidation: false,
|
|
436
|
+
showChangeAssetButton: false,
|
|
437
|
+
changeAssetButtonDisabled: false,
|
|
438
|
+
updateAssetInputTo: null,
|
|
439
|
+
estimateAmount: false,
|
|
440
|
+
isLoading: false,
|
|
441
|
+
cryptoAssetToFiatRate: null,
|
|
442
|
+
fiatCurrencyCode: null,
|
|
443
|
+
fiatCurrencyDecimals: null,
|
|
444
|
+
linkButtonActiveText: null,
|
|
445
|
+
linkButtonInactiveText: null,
|
|
446
|
+
balanceLoaderText: null,
|
|
447
|
+
fiatInputPlaceholderText: null,
|
|
448
|
+
};
|
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
@use "../../../assets/styles/index" as *;
|
|
2
|
+
|
|
3
|
+
.amount-input-container {
|
|
4
|
+
padding: Padding("5");
|
|
5
|
+
background: SolidColor("lightsmoke");
|
|
6
|
+
border-radius: 8px;
|
|
7
|
+
display: flex;
|
|
8
|
+
align-items: center;
|
|
9
|
+
gap: 10px;
|
|
10
|
+
justify-content: space-between;
|
|
11
|
+
transition: 0.2s box-shadow ease;
|
|
12
|
+
min-height: 86.5px;
|
|
13
|
+
|
|
14
|
+
&.upper-form-position {
|
|
15
|
+
border-bottom-left-radius: 4px;
|
|
16
|
+
border-bottom-right-radius: 4px;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
&.lower-form-position {
|
|
20
|
+
border-top-left-radius: 4px;
|
|
21
|
+
border-top-right-radius: 4px;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
&.error-encountered {
|
|
25
|
+
box-shadow: $shadowOutlineError !important;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
@media (hover: hover) {
|
|
29
|
+
&:hover {
|
|
30
|
+
&:not(.focus) {
|
|
31
|
+
box-shadow: $shadowOutlineHover;
|
|
32
|
+
transition: 0.02s box-shadow ease;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
&.focus {
|
|
38
|
+
box-shadow: $shadowOutlineActive;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
&-input-wrapper {
|
|
42
|
+
width: 100%;
|
|
43
|
+
|
|
44
|
+
&.disabled {
|
|
45
|
+
opacity: 0.15;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
&.bottom-margin {
|
|
49
|
+
@media (max-width: $tablet-width) {
|
|
50
|
+
margin-bottom: Margin("5");
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.asset-balance {
|
|
55
|
+
display: flex;
|
|
56
|
+
justify-content: flex-start;
|
|
57
|
+
align-items: center;
|
|
58
|
+
|
|
59
|
+
svg {
|
|
60
|
+
margin-left: -1px;
|
|
61
|
+
margin-right: 4px;
|
|
62
|
+
|
|
63
|
+
path {
|
|
64
|
+
transition: stroke 0.2s ease;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
&.red {
|
|
69
|
+
svg path {
|
|
70
|
+
stroke: SolidColor("red");
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
p {
|
|
74
|
+
color: SolidColor("red");
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
p {
|
|
79
|
+
color: SolidColor("grey");
|
|
80
|
+
transition: color 0.2s ease;
|
|
81
|
+
|
|
82
|
+
span {
|
|
83
|
+
opacity: 0.5;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.requested-amount-coin {
|
|
89
|
+
font-size: 20px;
|
|
90
|
+
font-weight: $bold;
|
|
91
|
+
color: SolidColor("dark");
|
|
92
|
+
width: 100%;
|
|
93
|
+
padding: 0;
|
|
94
|
+
display: flex;
|
|
95
|
+
align-items: center;
|
|
96
|
+
position: relative;
|
|
97
|
+
|
|
98
|
+
&::after {
|
|
99
|
+
content: " ";
|
|
100
|
+
width: 100%;
|
|
101
|
+
height: 100%;
|
|
102
|
+
position: absolute;
|
|
103
|
+
top: 0;
|
|
104
|
+
left: 0;
|
|
105
|
+
box-shadow: -20px 0px 10px -15px SolidColor(lightsmoke) inset;
|
|
106
|
+
pointer-events: none;
|
|
107
|
+
user-select: none;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
&-currency,
|
|
111
|
+
&-input {
|
|
112
|
+
font-size: inherit;
|
|
113
|
+
font-weight: inherit;
|
|
114
|
+
font-family: inherit;
|
|
115
|
+
color: inherit;
|
|
116
|
+
margin: 0;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
&-currency {
|
|
120
|
+
user-select: none;
|
|
121
|
+
padding-right: 4px;
|
|
122
|
+
white-space: nowrap;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
&-input {
|
|
126
|
+
border: none;
|
|
127
|
+
background: transparent;
|
|
128
|
+
padding: 0;
|
|
129
|
+
width: 100%;
|
|
130
|
+
flex-grow: 1;
|
|
131
|
+
margin: 0;
|
|
132
|
+
|
|
133
|
+
&::placeholder {
|
|
134
|
+
color: rgba(SolidColor("dark"), 0.3);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
&-skeleton {
|
|
139
|
+
height: 24px;
|
|
140
|
+
width: 40%;
|
|
141
|
+
display: flex;
|
|
142
|
+
align-items: center;
|
|
143
|
+
|
|
144
|
+
&-content {
|
|
145
|
+
@extend %skeleton-big-text;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
.requested-amount-fiat {
|
|
151
|
+
color: SolidColor("grey");
|
|
152
|
+
display: flex;
|
|
153
|
+
align-items: center;
|
|
154
|
+
font-size: 14px;
|
|
155
|
+
text-align: left;
|
|
156
|
+
|
|
157
|
+
&-enter {
|
|
158
|
+
opacity: 0;
|
|
159
|
+
margin-top: -19px;
|
|
160
|
+
transform: translateY(24px);
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
&-enter-active {
|
|
164
|
+
opacity: 1;
|
|
165
|
+
transition:
|
|
166
|
+
opacity 0.2s $transitionEaseOut,
|
|
167
|
+
margin-top 0.2s $transitionEaseOut,
|
|
168
|
+
transform 0.2s $transitionEaseOut;
|
|
169
|
+
margin-top: 0;
|
|
170
|
+
transform: translateY(0);
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
&-exit {
|
|
174
|
+
opacity: 1;
|
|
175
|
+
margin-top: 0;
|
|
176
|
+
transform: translateY(0);
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
&-exit-active {
|
|
180
|
+
opacity: 0;
|
|
181
|
+
transition:
|
|
182
|
+
opacity 0.1s $transitionEaseOut,
|
|
183
|
+
margin-top 0.2s $transitionEaseOut,
|
|
184
|
+
transform 0.2s $transitionEaseOut;
|
|
185
|
+
margin-top: -19px;
|
|
186
|
+
transform: translateY(24px);
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
&-currency,
|
|
190
|
+
&-input,
|
|
191
|
+
&-placeholder {
|
|
192
|
+
font-size: inherit;
|
|
193
|
+
font-weight: inherit;
|
|
194
|
+
font-family: inherit;
|
|
195
|
+
color: inherit;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
&-currency {
|
|
199
|
+
user-select: none;
|
|
200
|
+
padding-right: 4px;
|
|
201
|
+
white-space: nowrap;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
&-input {
|
|
205
|
+
background: none;
|
|
206
|
+
outline: none;
|
|
207
|
+
border: none;
|
|
208
|
+
padding: 0;
|
|
209
|
+
width: 100%;
|
|
210
|
+
flex-grow: 1;
|
|
211
|
+
margin: 0;
|
|
212
|
+
|
|
213
|
+
&::placeholder {
|
|
214
|
+
color: rgba(SolidColor("dark"), 0.3);
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
&-skeleton {
|
|
219
|
+
width: 25%;
|
|
220
|
+
display: flex;
|
|
221
|
+
align-items: center;
|
|
222
|
+
|
|
223
|
+
&-content {
|
|
224
|
+
@extend %skeleton-text;
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
&-placeholder {
|
|
229
|
+
cursor: pointer;
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
}
|