@rabbitio/ui-kit 1.0.0-beta.8 → 1.0.0-beta.80
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 +16372 -0
- package/coverage/coverage-final.json +154 -0
- package/coverage/favicon.png +0 -0
- package/coverage/index.html +1151 -0
- package/coverage/prettify.css +1 -0
- package/coverage/prettify.js +2 -0
- package/coverage/sort-arrow-sprite.png +0 -0
- package/coverage/sorter.js +196 -0
- package/coverage/ui-kit/index.html +116 -0
- package/coverage/ui-kit/index.js.html +88 -0
- package/coverage/ui-kit/src/common-apis/adapters/axiosAdapter.js.html +190 -0
- package/coverage/ui-kit/src/common-apis/adapters/index.html +131 -0
- package/coverage/ui-kit/src/common-apis/adapters/qrUtils.js.html +139 -0
- package/coverage/ui-kit/src/common-apis/amountUtils.js.html +1162 -0
- package/coverage/ui-kit/src/common-apis/errorUtils.js.html +211 -0
- package/coverage/ui-kit/src/common-apis/external-apis/apiGroups.js.html +250 -0
- package/coverage/ui-kit/src/common-apis/external-apis/index.html +131 -0
- package/coverage/ui-kit/src/common-apis/external-apis/ipAddressProviders.js.html +352 -0
- package/coverage/ui-kit/src/common-apis/fiatCurrenciesService.js.html +544 -0
- package/coverage/ui-kit/src/common-apis/globalConstants.jsx.html +94 -0
- package/coverage/ui-kit/src/common-apis/index.html +161 -0
- package/coverage/ui-kit/src/common-apis/models/blockchain.js.html +115 -0
- package/coverage/ui-kit/src/common-apis/models/coin.js.html +544 -0
- package/coverage/ui-kit/src/common-apis/models/index.html +146 -0
- package/coverage/ui-kit/src/common-apis/models/protocol.js.html +100 -0
- package/coverage/ui-kit/src/common-apis/utils/cache.js.html +811 -0
- package/coverage/ui-kit/src/common-apis/utils/emailAPI.js.html +133 -0
- package/coverage/ui-kit/src/common-apis/utils/index.html +161 -0
- package/coverage/ui-kit/src/common-apis/utils/logging/index.html +131 -0
- package/coverage/ui-kit/src/common-apis/utils/logging/logger.js.html +208 -0
- package/coverage/ui-kit/src/common-apis/utils/logging/logsStorage.js.html +268 -0
- package/coverage/ui-kit/src/common-apis/utils/postponeExecution.js.html +118 -0
- package/coverage/ui-kit/src/common-apis/utils/safeStringify.js.html +235 -0
- package/coverage/ui-kit/src/index.html +116 -0
- package/coverage/ui-kit/src/index.js.html +337 -0
- package/coverage/ui-kit/src/robust-api-caller/cacheAndConcurrentRequestsResolver.js.html +1570 -0
- package/coverage/ui-kit/src/robust-api-caller/cachedRobustExternalApiCallerService.js.html +526 -0
- package/coverage/ui-kit/src/robust-api-caller/cancelProcessing.js.html +172 -0
- package/coverage/ui-kit/src/robust-api-caller/concurrentCalculationsMetadataHolder.js.html +310 -0
- package/coverage/ui-kit/src/robust-api-caller/externalApiProvider.js.html +553 -0
- package/coverage/ui-kit/src/robust-api-caller/externalServicesStatsCollector.js.html +319 -0
- package/coverage/ui-kit/src/robust-api-caller/index.html +206 -0
- package/coverage/ui-kit/src/robust-api-caller/robustExternalAPICallerService.js.html +997 -0
- package/coverage/ui-kit/src/swaps-lib/external-apis/index.html +146 -0
- package/coverage/ui-kit/src/swaps-lib/external-apis/letsExchangeSwapProvider.js.html +1513 -0
- package/coverage/ui-kit/src/swaps-lib/external-apis/swapProvider.js.html +1558 -0
- package/coverage/ui-kit/src/swaps-lib/external-apis/swapspaceSwapProvider.js.html +1735 -0
- package/coverage/ui-kit/src/swaps-lib/models/baseSwapCreationInfo.js.html +223 -0
- package/coverage/ui-kit/src/swaps-lib/models/existingSwap.js.html +304 -0
- package/coverage/ui-kit/src/swaps-lib/models/existingSwapWithFiatData.js.html +469 -0
- package/coverage/ui-kit/src/swaps-lib/models/index.html +146 -0
- package/coverage/ui-kit/src/swaps-lib/services/index.html +116 -0
- package/coverage/ui-kit/src/swaps-lib/services/publicSwapService.js.html +2098 -0
- package/coverage/ui-kit/src/swaps-lib/utils/index.html +116 -0
- package/coverage/ui-kit/src/swaps-lib/utils/swapUtils.js.html +670 -0
- package/coverage/ui-kit/src/ui-kit/assets/wrappedImages/arrowIcon.jsx.html +124 -0
- package/coverage/ui-kit/src/ui-kit/assets/wrappedImages/arrowTosca.jsx.html +127 -0
- package/coverage/ui-kit/src/ui-kit/assets/wrappedImages/arrowWhite.jsx.html +127 -0
- package/coverage/ui-kit/src/ui-kit/assets/wrappedImages/darkRectangle.jsx.html +106 -0
- package/coverage/ui-kit/src/ui-kit/assets/wrappedImages/determinedError.jsx.html +439 -0
- package/coverage/ui-kit/src/ui-kit/assets/wrappedImages/failedValidationIcon.jsx.html +202 -0
- package/coverage/ui-kit/src/ui-kit/assets/wrappedImages/index.html +251 -0
- package/coverage/ui-kit/src/ui-kit/assets/wrappedImages/infoIcon.jsx.html +133 -0
- package/coverage/ui-kit/src/ui-kit/assets/wrappedImages/noticeQuestionIcon.jsx.html +247 -0
- package/coverage/ui-kit/src/ui-kit/assets/wrappedImages/successfulValidationIcon.jsx.html +163 -0
- package/coverage/ui-kit/src/ui-kit/assets/wrappedImages/walletIcon.jsx.html +151 -0
- package/coverage/ui-kit/src/ui-kit/components/atoms/AssetIcon/AssetIcon.jsx.html +256 -0
- package/coverage/ui-kit/src/ui-kit/components/atoms/AssetIcon/index.html +116 -0
- package/coverage/ui-kit/src/ui-kit/components/atoms/AssetSelection/AssetSelection.jsx.html +289 -0
- package/coverage/ui-kit/src/ui-kit/components/atoms/AssetSelection/index.html +116 -0
- package/coverage/ui-kit/src/ui-kit/components/atoms/BackgroundTitle/BackgroundTitle.jsx.html +187 -0
- package/coverage/ui-kit/src/ui-kit/components/atoms/BackgroundTitle/index.html +116 -0
- package/coverage/ui-kit/src/ui-kit/components/atoms/InformationMessage/InformationMessage.jsx.html +238 -0
- package/coverage/ui-kit/src/ui-kit/components/atoms/InformationMessage/index.html +116 -0
- package/coverage/ui-kit/src/ui-kit/components/atoms/Input/Input.jsx.html +634 -0
- package/coverage/ui-kit/src/ui-kit/components/atoms/Input/index.html +116 -0
- package/coverage/ui-kit/src/ui-kit/components/atoms/LoadingDots/LoadingDots.jsx.html +196 -0
- package/coverage/ui-kit/src/ui-kit/components/atoms/LoadingDots/index.html +116 -0
- package/coverage/ui-kit/src/ui-kit/components/atoms/NoticeIcon/NoticeIcon.jsx.html +277 -0
- package/coverage/ui-kit/src/ui-kit/components/atoms/NoticeIcon/index.html +116 -0
- package/coverage/ui-kit/src/ui-kit/components/atoms/QrCode/QrCode.jsx.html +235 -0
- package/coverage/ui-kit/src/ui-kit/components/atoms/QrCode/index.html +116 -0
- package/coverage/ui-kit/src/ui-kit/components/atoms/RateSelector/RateSelector.jsx.html +175 -0
- package/coverage/ui-kit/src/ui-kit/components/atoms/RateSelector/index.html +116 -0
- package/coverage/ui-kit/src/ui-kit/components/atoms/SupportChat/SupportChat.jsx.html +217 -0
- package/coverage/ui-kit/src/ui-kit/components/atoms/SupportChat/index.html +116 -0
- package/coverage/ui-kit/src/ui-kit/components/atoms/Textarea/Textarea.jsx.html +529 -0
- package/coverage/ui-kit/src/ui-kit/components/atoms/Textarea/index.html +116 -0
- package/coverage/ui-kit/src/ui-kit/components/atoms/TitleBox/TitleBox.jsx.html +508 -0
- package/coverage/ui-kit/src/ui-kit/components/atoms/TitleBox/index.html +116 -0
- package/coverage/ui-kit/src/ui-kit/components/atoms/Tooltip/Tooltip.jsx.html +316 -0
- package/coverage/ui-kit/src/ui-kit/components/atoms/Tooltip/index.html +116 -0
- package/coverage/ui-kit/src/ui-kit/components/atoms/TwoLinesOfText/LinesOfText.jsx.html +313 -0
- package/coverage/ui-kit/src/ui-kit/components/atoms/TwoLinesOfText/index.html +116 -0
- package/coverage/ui-kit/src/ui-kit/components/atoms/Validation/Validation.jsx.html +208 -0
- package/coverage/ui-kit/src/ui-kit/components/atoms/Validation/index.html +116 -0
- package/coverage/ui-kit/src/ui-kit/components/atoms/buttons/Button/Button.jsx.html +712 -0
- package/coverage/ui-kit/src/ui-kit/components/atoms/buttons/Button/index.html +116 -0
- package/coverage/ui-kit/src/ui-kit/components/atoms/buttons/Close/Close.jsx.html +259 -0
- package/coverage/ui-kit/src/ui-kit/components/atoms/buttons/Close/index.html +116 -0
- package/coverage/ui-kit/src/ui-kit/components/atoms/buttons/LinkButton/LinkButton.jsx.html +421 -0
- package/coverage/ui-kit/src/ui-kit/components/atoms/buttons/LinkButton/index.html +116 -0
- package/coverage/ui-kit/src/ui-kit/components/atoms/buttons/RadioButtonWithText/RadioButtonWithText.jsx.html +415 -0
- package/coverage/ui-kit/src/ui-kit/components/atoms/buttons/RadioButtonWithText/index.html +116 -0
- package/coverage/ui-kit/src/ui-kit/components/molecules/AmountInput/AmountInput.jsx.html +1060 -0
- package/coverage/ui-kit/src/ui-kit/components/molecules/AmountInput/index.html +116 -0
- package/coverage/ui-kit/src/ui-kit/components/molecules/CoinPicker/CoinPicker.jsx.html +1618 -0
- package/coverage/ui-kit/src/ui-kit/components/molecules/CoinPicker/index.html +116 -0
- package/coverage/ui-kit/src/ui-kit/components/molecules/LineWithIconLink/LineWithIconLink.jsx.html +190 -0
- package/coverage/ui-kit/src/ui-kit/components/molecules/LineWithIconLink/index.html +116 -0
- package/coverage/ui-kit/src/ui-kit/components/molecules/TitledLineWithIconLink/TitledLineWithIconLink.jsx.html +181 -0
- package/coverage/ui-kit/src/ui-kit/components/molecules/TitledLineWithIconLink/index.html +116 -0
- package/coverage/ui-kit/src/ui-kit/components/organisms/CoinPickerDialogStep/CoinPickerDialogStep.jsx.html +283 -0
- package/coverage/ui-kit/src/ui-kit/components/organisms/CoinPickerDialogStep/index.html +116 -0
- package/coverage/ui-kit/src/ui-kit/components/organisms/Dialog/Dialog.jsx.html +1567 -0
- package/coverage/ui-kit/src/ui-kit/components/organisms/Dialog/DialogButtons/DialogButtons.jsx.html +451 -0
- package/coverage/ui-kit/src/ui-kit/components/organisms/Dialog/DialogButtons/index.html +116 -0
- package/coverage/ui-kit/src/ui-kit/components/organisms/Dialog/DialogStep/DialogStep.jsx.html +1699 -0
- package/coverage/ui-kit/src/ui-kit/components/organisms/Dialog/DialogStep/index.html +116 -0
- package/coverage/ui-kit/src/ui-kit/components/organisms/Dialog/index.html +116 -0
- package/coverage/ui-kit/src/ui-kit/components/organisms/SwapForm/SwapForm.jsx.html +4075 -0
- package/coverage/ui-kit/src/ui-kit/components/organisms/SwapForm/index.html +116 -0
- package/coverage/ui-kit/src/ui-kit/components/templates/DeterminedErrorDialogStep/DeterminedErrorDialogStep.jsx.html +316 -0
- package/coverage/ui-kit/src/ui-kit/components/templates/DeterminedErrorDialogStep/index.html +116 -0
- package/coverage/ui-kit/src/ui-kit/hooks/index.html +146 -0
- package/coverage/ui-kit/src/ui-kit/hooks/useCallHandlingErrors.js.html +151 -0
- package/coverage/ui-kit/src/ui-kit/hooks/useIsHydrated.js.html +121 -0
- package/coverage/ui-kit/src/ui-kit/hooks/useReferredState.js.html +157 -0
- package/coverage/ui-kit/src/ui-kit/utils/index.html +161 -0
- package/coverage/ui-kit/src/ui-kit/utils/inputValueProviders.js.html +235 -0
- package/coverage/ui-kit/src/ui-kit/utils/textUtils.js.html +139 -0
- package/coverage/ui-kit/src/ui-kit/utils/uiUtils.js.html +121 -0
- package/coverage/ui-kit/src/ui-kit/utils/urlQueryUtils.js.html +271 -0
- package/coverage/ui-kit/stories/atoms/BackgroundTitle.stories.jsx.html +202 -0
- package/coverage/ui-kit/stories/atoms/LinesOfText.stories.jsx.html +283 -0
- package/coverage/ui-kit/stories/atoms/LoadingDots.stories.jsx.html +226 -0
- package/coverage/ui-kit/stories/atoms/QrCode.stories.jsx.html +175 -0
- package/coverage/ui-kit/stories/atoms/RateSelector.stories.jsx.html +136 -0
- package/coverage/ui-kit/stories/atoms/Validation.stories.jsx.html +178 -0
- package/coverage/ui-kit/stories/atoms/buttons/Button.stories.jsx.html +883 -0
- package/coverage/ui-kit/stories/atoms/buttons/Close.stories.jsx.html +211 -0
- package/coverage/ui-kit/stories/atoms/buttons/LinkButton.stories.jsx.html +301 -0
- package/coverage/ui-kit/stories/atoms/buttons/index.html +146 -0
- package/coverage/ui-kit/stories/atoms/index.html +191 -0
- package/coverage/ui-kit/stories/molecules/LineWithIconLink.stories.jsx.html +154 -0
- package/coverage/ui-kit/stories/molecules/TitledLineWithIconLink.stories.jsx.html +160 -0
- package/coverage/ui-kit/stories/molecules/index.html +131 -0
- package/coverage/ui-kit/stories/organisms/Dialog/Dialog.stories.jsx.html +523 -0
- package/coverage/ui-kit/stories/organisms/Dialog/DialogButtons/DialogButtons.stories.jsx.html +328 -0
- package/coverage/ui-kit/stories/organisms/Dialog/DialogButtons/index.html +116 -0
- package/coverage/ui-kit/stories/organisms/Dialog/DialogStep/DialogStep.stories.jsx.html +337 -0
- package/coverage/ui-kit/stories/organisms/Dialog/DialogStep/index.html +116 -0
- package/coverage/ui-kit/stories/organisms/Dialog/index.html +116 -0
- package/coverage/ui-kit/stories/stubs/exampleContent.jsx.html +145 -0
- package/coverage/ui-kit/stories/stubs/index.html +116 -0
- package/coverage/ui-kit/stories/templates/DeterminedErrorDialogStep.stories.jsx.html +190 -0
- package/coverage/ui-kit/stories/templates/index.html +116 -0
- package/coverage/ui-kit/storybook-static/138.56b7edc4.iframe.bundle.js.html +85 -0
- package/coverage/ui-kit/storybook-static/312.6f62bbd9.iframe.bundle.js.html +85 -0
- package/coverage/ui-kit/storybook-static/341.57a15f57.iframe.bundle.js.html +85 -0
- package/coverage/ui-kit/storybook-static/595.2e40d981.iframe.bundle.js.html +85 -0
- package/coverage/ui-kit/storybook-static/607.3ea32459.iframe.bundle.js.html +85 -0
- package/coverage/ui-kit/storybook-static/609.949af3f6.iframe.bundle.js.html +85 -0
- package/coverage/ui-kit/storybook-static/693.1acf0184.iframe.bundle.js.html +85 -0
- package/coverage/ui-kit/storybook-static/797.c87cdf19.iframe.bundle.js.html +85 -0
- package/coverage/ui-kit/storybook-static/862.c15e3c9c.iframe.bundle.js.html +85 -0
- package/coverage/ui-kit/storybook-static/87.0a1bfeb1.iframe.bundle.js.html +85 -0
- package/coverage/ui-kit/storybook-static/893.e21210d8.iframe.bundle.js.html +85 -0
- package/coverage/ui-kit/storybook-static/996.10688684.iframe.bundle.js.html +85 -0
- package/coverage/ui-kit/storybook-static/atoms-BackgroundTitle-stories.1a5386a1.iframe.bundle.js.html +85 -0
- package/coverage/ui-kit/storybook-static/atoms-LinesOfText-stories.7043a48b.iframe.bundle.js.html +85 -0
- package/coverage/ui-kit/storybook-static/atoms-LoadingDots-stories.662d6a83.iframe.bundle.js.html +85 -0
- package/coverage/ui-kit/storybook-static/atoms-QrCode-stories.e10363b6.iframe.bundle.js.html +85 -0
- package/coverage/ui-kit/storybook-static/atoms-RateSelector-stories.da7b9f1f.iframe.bundle.js.html +85 -0
- package/coverage/ui-kit/storybook-static/atoms-Validation-stories.d561b311.iframe.bundle.js.html +85 -0
- package/coverage/ui-kit/storybook-static/atoms-buttons-Button-stories.d336c1a5.iframe.bundle.js.html +85 -0
- package/coverage/ui-kit/storybook-static/atoms-buttons-Close-stories.0a902a7c.iframe.bundle.js.html +85 -0
- package/coverage/ui-kit/storybook-static/atoms-buttons-LinkButton-stories.ca93ab6b.iframe.bundle.js.html +85 -0
- package/coverage/ui-kit/storybook-static/index.html +536 -0
- package/coverage/ui-kit/storybook-static/main.75ff1c31.iframe.bundle.js.html +85 -0
- package/coverage/ui-kit/storybook-static/molecules-LineWithIconLink-stories.2d2d5753.iframe.bundle.js.html +85 -0
- package/coverage/ui-kit/storybook-static/molecules-TitledLineWithIconLink-stories.1383fe3f.iframe.bundle.js.html +85 -0
- package/coverage/ui-kit/storybook-static/organisms-Dialog-Dialog-stories.4e6da717.iframe.bundle.js.html +85 -0
- package/coverage/ui-kit/storybook-static/organisms-Dialog-DialogButtons-DialogButtons-stories.b79c32a3.iframe.bundle.js.html +85 -0
- package/coverage/ui-kit/storybook-static/organisms-Dialog-DialogStep-DialogStep-stories.74896048.iframe.bundle.js.html +85 -0
- package/coverage/ui-kit/storybook-static/rabbitio/ui-kit/node_modules/@storybook/addon-backgrounds/dist/index.html +116 -0
- package/coverage/ui-kit/storybook-static/rabbitio/ui-kit/node_modules/@storybook/addon-backgrounds/dist/preview.js.html +118 -0
- package/coverage/ui-kit/storybook-static/rabbitio/ui-kit/node_modules/@storybook/components/dist/formatter-SWP5E3XI.mjs.html +118 -0
- package/coverage/ui-kit/storybook-static/rabbitio/ui-kit/node_modules/@storybook/components/dist/index.html +116 -0
- package/coverage/ui-kit/storybook-static/rabbitio/ui-kit/node_modules/buffer/index.html +116 -0
- package/coverage/ui-kit/storybook-static/rabbitio/ui-kit/node_modules/buffer/index.js.html +118 -0
- package/coverage/ui-kit/storybook-static/rabbitio/ui-kit/node_modules/markdown-to-jsx/dist/index.html +116 -0
- package/coverage/ui-kit/storybook-static/rabbitio/ui-kit/node_modules/markdown-to-jsx/dist/index.modern.js.html +118 -0
- package/coverage/ui-kit/storybook-static/runtime~main.b108a22d.iframe.bundle.js.html +85 -0
- package/coverage/ui-kit/storybook-static/sb-addons/actions-9/index.html +116 -0
- package/coverage/ui-kit/storybook-static/sb-addons/actions-9/manager-bundle.js.html +94 -0
- package/coverage/ui-kit/storybook-static/sb-addons/essentials-backgrounds-2/index.html +116 -0
- package/coverage/ui-kit/storybook-static/sb-addons/essentials-backgrounds-2/manager-bundle.js.html +121 -0
- package/coverage/ui-kit/storybook-static/sb-addons/essentials-controls-1/index.html +116 -0
- package/coverage/ui-kit/storybook-static/sb-addons/essentials-controls-1/manager-bundle.js.html +274 -0
- package/coverage/ui-kit/storybook-static/sb-addons/essentials-measure-4/index.html +116 -0
- package/coverage/ui-kit/storybook-static/sb-addons/essentials-measure-4/manager-bundle.js.html +94 -0
- package/coverage/ui-kit/storybook-static/sb-addons/essentials-outline-5/index.html +116 -0
- package/coverage/ui-kit/storybook-static/sb-addons/essentials-outline-5/manager-bundle.js.html +94 -0
- package/coverage/ui-kit/storybook-static/sb-addons/essentials-toolbars-3/index.html +116 -0
- package/coverage/ui-kit/storybook-static/sb-addons/essentials-toolbars-3/manager-bundle.js.html +94 -0
- package/coverage/ui-kit/storybook-static/sb-addons/interactions-7/index.html +116 -0
- package/coverage/ui-kit/storybook-static/sb-addons/interactions-7/manager-bundle.js.html +121 -0
- package/coverage/ui-kit/storybook-static/sb-addons/links-0/index.html +116 -0
- package/coverage/ui-kit/storybook-static/sb-addons/links-0/manager-bundle.js.html +94 -0
- package/coverage/ui-kit/storybook-static/sb-addons/onboarding-6/index.html +116 -0
- package/coverage/ui-kit/storybook-static/sb-addons/onboarding-6/manager-bundle.js.html +1588 -0
- package/coverage/ui-kit/storybook-static/sb-addons/viewport-8/index.html +116 -0
- package/coverage/ui-kit/storybook-static/sb-addons/viewport-8/manager-bundle.js.html +94 -0
- package/coverage/ui-kit/storybook-static/sb-manager/WithTooltip-V3YHNWJZ-LVYLGZW2.js.html +88 -0
- package/coverage/ui-kit/storybook-static/sb-manager/chunk-2IXBUOFS.js.html +106 -0
- package/coverage/ui-kit/storybook-static/sb-manager/chunk-INSKDKQB.js.html +1129 -0
- package/coverage/ui-kit/storybook-static/sb-manager/chunk-NGTUFCUO.js.html +112 -0
- package/coverage/ui-kit/storybook-static/sb-manager/chunk-UUEAOBSN.js.html +1303 -0
- package/coverage/ui-kit/storybook-static/sb-manager/chunk-ZEU7PDD3.js.html +88 -0
- package/coverage/ui-kit/storybook-static/sb-manager/formatter-SWP5E3XI-7BGIK6BL.js.html +553 -0
- package/coverage/ui-kit/storybook-static/sb-manager/globals-module-info.js.html +88 -0
- package/coverage/ui-kit/storybook-static/sb-manager/globals.js.html +88 -0
- package/coverage/ui-kit/storybook-static/sb-manager/index.html +281 -0
- package/coverage/ui-kit/storybook-static/sb-manager/index.js.html +88 -0
- package/coverage/ui-kit/storybook-static/sb-manager/runtime.js.html +88 -0
- package/coverage/ui-kit/storybook-static/sb-manager/syntaxhighlighter-V7JZZA35-DXZCI2WR.js.html +88 -0
- package/coverage/ui-kit/storybook-static/sb-preview/globals.js.html +88 -0
- package/coverage/ui-kit/storybook-static/sb-preview/index.html +131 -0
- package/coverage/ui-kit/storybook-static/sb-preview/runtime.js.html +421 -0
- package/coverage/ui-kit/storybook-static/templates-DeterminedErrorDialogStep-stories.3cc14214.iframe.bundle.js.html +85 -0
- package/dist/global.css +197 -0
- package/dist/global.css.map +1 -0
- package/dist/index.cjs +10864 -21
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +2212 -8491
- package/dist/index.css.map +1 -1
- package/dist/index.modern.js +8354 -22
- package/dist/index.modern.js.map +1 -1
- package/dist/index.module.js +10784 -23
- package/dist/index.module.js.map +1 -1
- package/dist/index.umd.js +10855 -25
- package/dist/index.umd.js.map +1 -1
- package/index.js +1 -1
- package/package.json +36 -9
- package/src/common-apis/adapters/axiosAdapter.js +35 -0
- package/src/common-apis/adapters/qrUtils.js +18 -0
- package/src/common-apis/amountUtils.js +359 -0
- package/src/common-apis/errorUtils.js +42 -0
- package/src/common-apis/external-apis/apiGroups.js +55 -0
- package/src/common-apis/external-apis/ipAddressProviders.js +89 -0
- package/src/common-apis/fiatCurrenciesService.js +153 -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 +153 -0
- package/src/common-apis/models/protocol.js +5 -0
- package/src/common-apis/tests/amountUtils/composeRateText.test.js +152 -0
- package/src/common-apis/tests/integration/external-apis/ipAddressProviders/getClientIpAddress.test.js +12 -0
- package/src/common-apis/utils/cache.js +242 -0
- package/src/common-apis/utils/emailAPI.js +16 -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/safeStringify.js +50 -0
- package/src/index.js +84 -0
- 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/letsExchangeSwapProvider.js +476 -0
- package/src/swaps-lib/external-apis/swapProvider.js +491 -0
- package/src/swaps-lib/external-apis/swapspaceSwapProvider.js +550 -0
- package/src/swaps-lib/models/baseSwapCreationInfo.js +46 -0
- package/src/swaps-lib/models/existingSwap.js +73 -0
- package/src/swaps-lib/models/existingSwapWithFiatData.js +128 -0
- package/src/swaps-lib/services/publicSwapService.js +671 -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 +538 -0
- package/src/swaps-lib/test/external-apis/swapspaceSwapProvider/createSwap.test.js +1249 -0
- package/src/swaps-lib/test/external-apis/swapspaceSwapProvider/getSwapInfo.test.js +1700 -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 +165 -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/noticeQuestionIcon.jsx +54 -0
- package/src/ui-kit/assets/wrappedImages/successfulValidationIcon.jsx +26 -0
- package/src/ui-kit/assets/wrappedImages/walletIcon.jsx +22 -0
- package/src/ui-kit/components/atoms/AssetIcon/AssetIcon.jsx +57 -0
- package/{stories → src/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/{stories → src/ui-kit/components}/atoms/LoadingDots/LoadingDots.jsx +8 -28
- package/{stories → src/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 +50 -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/{stories → src/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 +41 -0
- package/src/ui-kit/components/atoms/Validation/validation.module.scss +15 -0
- package/{stories → src/ui-kit/components}/atoms/buttons/Button/Button.jsx +24 -50
- package/{stories → src/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 +325 -0
- package/src/ui-kit/components/molecules/AmountInput/amount-input.module.scss +199 -0
- package/src/ui-kit/components/molecules/CoinPicker/CoinPicker.jsx +511 -0
- package/src/ui-kit/components/molecules/CoinPicker/coin-picker.module.scss +207 -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/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 +122 -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 +538 -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 +1330 -0
- package/src/ui-kit/components/organisms/SwapForm/swap-form.module.scss +134 -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 +132 -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/stubs/exampleContent.jsx +20 -0
- package/stories/atoms/AssetIcon/AssetIcon.jsx +0 -55
- package/stories/index.js +0 -4
- 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,110 @@
|
|
|
1
|
+
import React, { useState } from "react";
|
|
2
|
+
import PropTypes from "prop-types";
|
|
3
|
+
|
|
4
|
+
import s from "./radio-button-with-text.module.scss";
|
|
5
|
+
|
|
6
|
+
import { useCallHandlingErrors } from "../../../../hooks/useCallHandlingErrors.js";
|
|
7
|
+
|
|
8
|
+
import { Tooltip } from "../../Tooltip/Tooltip.jsx";
|
|
9
|
+
import { LoadingDots } from "../../LoadingDots/LoadingDots.jsx";
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* RadioButtonWithText component with a label and optional tooltip.
|
|
13
|
+
*
|
|
14
|
+
* @component
|
|
15
|
+
* @param {string} [text=""] - The text to display next to the radio button.
|
|
16
|
+
* @param {function} onStateChange - Callback function triggered when the state of the radio button changes.
|
|
17
|
+
* @param {boolean} [isSwitchedOn=false] - Whether the radio button is switched on.
|
|
18
|
+
* @param {boolean} [isDisabled=false] - Whether the radio button is disabled.
|
|
19
|
+
* @param {string} [tooltipText=""] - Text to display in the tooltip when hovering over the component.
|
|
20
|
+
* @param {string} [id=""] - The id of the radio button.
|
|
21
|
+
*/
|
|
22
|
+
export const RadioButtonWithText = ({
|
|
23
|
+
text = "",
|
|
24
|
+
onStateChange,
|
|
25
|
+
isSwitchedOn = false,
|
|
26
|
+
isDisabled = false,
|
|
27
|
+
tooltipText = "",
|
|
28
|
+
id = "",
|
|
29
|
+
}) => {
|
|
30
|
+
const [isLoading, setIsLoading] = useState(false);
|
|
31
|
+
const [showTooltip, setShowTooltip] = useState(false);
|
|
32
|
+
const [showTooltipTimeoutId, setShowTooltipTimeoutId] = useState(-1);
|
|
33
|
+
|
|
34
|
+
const handleError = useCallHandlingErrors();
|
|
35
|
+
|
|
36
|
+
function handleChange() {
|
|
37
|
+
if (!isLoading && !isDisabled) {
|
|
38
|
+
setIsLoading(true);
|
|
39
|
+
handleError(() => onStateChange(() => setIsLoading(false)));
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const onMouseEnter = () => {
|
|
44
|
+
if (tooltipText) {
|
|
45
|
+
setShowTooltipTimeoutId(setTimeout(() => setShowTooltip(true), 700));
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
const onMouseLeave = () => {
|
|
50
|
+
if (tooltipText) {
|
|
51
|
+
setShowTooltip(false);
|
|
52
|
+
clearTimeout(showTooltipTimeoutId);
|
|
53
|
+
setShowTooltipTimeoutId(null);
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
return (
|
|
58
|
+
<div className={s["radio-button-with-text-container"]}>
|
|
59
|
+
<label
|
|
60
|
+
htmlFor={"radio-button-with-text-" + id}
|
|
61
|
+
className={[
|
|
62
|
+
s["radio-button-with-text"],
|
|
63
|
+
isSwitchedOn ? s["selected"] : "",
|
|
64
|
+
isLoading ? s["hide"] : "",
|
|
65
|
+
isDisabled ? s["disabled"] : "",
|
|
66
|
+
].join(" ")}
|
|
67
|
+
onMouseEnter={e => handleError(onMouseEnter, e)}
|
|
68
|
+
onMouseLeave={e => handleError(onMouseLeave, e)}
|
|
69
|
+
>
|
|
70
|
+
{tooltipText && showTooltip ? (
|
|
71
|
+
<div>
|
|
72
|
+
{/*TODO: [bug, critical] click is still propagated*/}
|
|
73
|
+
<Tooltip showTooltip={showTooltip} handleClick={() => setShowTooltip(false)}>
|
|
74
|
+
{tooltipText}
|
|
75
|
+
</Tooltip>
|
|
76
|
+
</div>
|
|
77
|
+
) : null}
|
|
78
|
+
<div className={s["radio-button-with-text-dots"] + (isLoading ? s["show"] : "")}>
|
|
79
|
+
<LoadingDots />
|
|
80
|
+
</div>
|
|
81
|
+
<div className={s["radio-button-with-text-content"] + " " + (false ? s["hide"] : "")}>
|
|
82
|
+
<input
|
|
83
|
+
id={"radio-button-with-text-" + id}
|
|
84
|
+
type="checkbox"
|
|
85
|
+
value={isSwitchedOn}
|
|
86
|
+
onChange={handleChange}
|
|
87
|
+
/>
|
|
88
|
+
<span className={s["radio-button-with-text-wrapper"]}>{text}</span>
|
|
89
|
+
</div>
|
|
90
|
+
</label>
|
|
91
|
+
</div>
|
|
92
|
+
);
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
RadioButtonWithText.propTypes = {
|
|
96
|
+
text: PropTypes.string,
|
|
97
|
+
onStateChange: PropTypes.func,
|
|
98
|
+
isSwitchedOn: PropTypes.bool,
|
|
99
|
+
isDisabled: PropTypes.bool,
|
|
100
|
+
tooltipText: PropTypes.string,
|
|
101
|
+
id: PropTypes.string,
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
RadioButtonWithText.defaultProps = {
|
|
105
|
+
text: "",
|
|
106
|
+
isSwitchedOn: false,
|
|
107
|
+
isDisabled: false,
|
|
108
|
+
tooltipText: "",
|
|
109
|
+
id: "",
|
|
110
|
+
};
|
package/src/ui-kit/components/atoms/buttons/RadioButtonWithText/radio-button-with-text.module.scss
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
@use "../../../../assets/styles/index" as *;
|
|
2
|
+
|
|
3
|
+
.radio-button-with-text-container {
|
|
4
|
+
display: flex;
|
|
5
|
+
align-items: flex-start;
|
|
6
|
+
justify-content: flex-start;
|
|
7
|
+
width: 57px;
|
|
8
|
+
height: 30px;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.radio-button-with-text {
|
|
12
|
+
height: 30px;
|
|
13
|
+
padding: Padding("1") 14px Padding("1") 43px;
|
|
14
|
+
position: relative;
|
|
15
|
+
background-color: SolidColor("smoke");
|
|
16
|
+
border-radius: 100px;
|
|
17
|
+
transition: 0.2s background-color $transitionEaseOut;
|
|
18
|
+
cursor: pointer;
|
|
19
|
+
|
|
20
|
+
&.selected {
|
|
21
|
+
background-color: SolidColor("tosca");
|
|
22
|
+
padding: Padding("1") 43px Padding("1") 14px;
|
|
23
|
+
|
|
24
|
+
&:before {
|
|
25
|
+
transform: translateX(27px);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
&.disabled {
|
|
30
|
+
opacity: 0.6;
|
|
31
|
+
cursor: default !important;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
&.hide {
|
|
35
|
+
&:before {
|
|
36
|
+
content: none;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
&:before {
|
|
41
|
+
content: "";
|
|
42
|
+
width: 26px;
|
|
43
|
+
height: 26px;
|
|
44
|
+
border-radius: 50%;
|
|
45
|
+
background-color: $white;
|
|
46
|
+
position: absolute;
|
|
47
|
+
left: 2px;
|
|
48
|
+
top: 2px;
|
|
49
|
+
transform: translateX(0px);
|
|
50
|
+
transition: 0.2s transform $transitionEaseOut;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
input {
|
|
54
|
+
display: none;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
&-wrapper {
|
|
58
|
+
color: $white;
|
|
59
|
+
font-weight: $bold;
|
|
60
|
+
font-size: 12px;
|
|
61
|
+
line-height: 22px;
|
|
62
|
+
white-space: nowrap;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
&-content {
|
|
66
|
+
margin-top: -1px;
|
|
67
|
+
|
|
68
|
+
&.hide {
|
|
69
|
+
opacity: 0;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
&-dots {
|
|
74
|
+
position: absolute;
|
|
75
|
+
top: 50%;
|
|
76
|
+
left: 50%;
|
|
77
|
+
transform: translate(-50%, -50%);
|
|
78
|
+
opacity: 0;
|
|
79
|
+
z-index: -1;
|
|
80
|
+
|
|
81
|
+
&.show {
|
|
82
|
+
opacity: 1;
|
|
83
|
+
z-index: 0;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
@@ -0,0 +1,325 @@
|
|
|
1
|
+
import React, { useEffect, useState } from "react";
|
|
2
|
+
import { BigNumber } from "bignumber.js";
|
|
3
|
+
|
|
4
|
+
import s from "./amount-input.module.scss";
|
|
5
|
+
import WalletIcon from "../../../assets/wrappedImages/walletIcon.jsx";
|
|
6
|
+
|
|
7
|
+
import { useCallHandlingErrors } from "../../../hooks/useCallHandlingErrors.js";
|
|
8
|
+
import { InputValuesProviders } from "../../../utils/inputValueProviders.js";
|
|
9
|
+
import { logErrorOrOutputToConsole } from "../../../../common-apis/errorUtils.js";
|
|
10
|
+
|
|
11
|
+
import { TitleBox } from "../../atoms/TitleBox/TitleBox.jsx";
|
|
12
|
+
import { AmountUtils } from "../../../../common-apis/amountUtils.js";
|
|
13
|
+
import { AssetSelection } from "../../atoms/AssetSelection/AssetSelection.jsx";
|
|
14
|
+
import { Validation } from "../../atoms/Validation/Validation.jsx";
|
|
15
|
+
|
|
16
|
+
// TODO: [dev] add JSDoc
|
|
17
|
+
export const AmountInput = React.forwardRef(
|
|
18
|
+
(
|
|
19
|
+
{
|
|
20
|
+
label = "",
|
|
21
|
+
handleCoinAmountChange = btcAmount => {},
|
|
22
|
+
handleFiatAmountChange = fiatAmount => {},
|
|
23
|
+
handleChangeAssetClick = () => {},
|
|
24
|
+
handleBalanceValidationChange = isValid => {},
|
|
25
|
+
disabled,
|
|
26
|
+
locked,
|
|
27
|
+
alertText,
|
|
28
|
+
predefinedValue,
|
|
29
|
+
children,
|
|
30
|
+
ticker,
|
|
31
|
+
tickerPrintable,
|
|
32
|
+
assetDecimalPlaces,
|
|
33
|
+
assetBalance = { fiatAmount: null, assetAmount: null },
|
|
34
|
+
assetIconSrc,
|
|
35
|
+
assetIconProtocolSrc,
|
|
36
|
+
fallbackAssetIconSrc,
|
|
37
|
+
isSendAll = null,
|
|
38
|
+
handleSendAllClick = () => {},
|
|
39
|
+
showBalance = false,
|
|
40
|
+
showBalanceValidation = false,
|
|
41
|
+
showChangeAssetButton = false,
|
|
42
|
+
changeAssetButtonProtocol,
|
|
43
|
+
changeAssetButtonDisabled = false,
|
|
44
|
+
upperFormPosition,
|
|
45
|
+
lowerFormPosition,
|
|
46
|
+
errorEncountered,
|
|
47
|
+
updateAssetInputTo = null,
|
|
48
|
+
estimateAmount = false,
|
|
49
|
+
isLoading = false,
|
|
50
|
+
cryptoAssetToFiatRate = null,
|
|
51
|
+
fiatCurrencyCode = null,
|
|
52
|
+
fiatCurrencyDecimals = null,
|
|
53
|
+
linkButtonActiveText = null,
|
|
54
|
+
linkButtonInactiveText = null,
|
|
55
|
+
balanceLoaderText = null,
|
|
56
|
+
fiatInputPlaceholderText = null,
|
|
57
|
+
},
|
|
58
|
+
buttonForwardRef
|
|
59
|
+
) => {
|
|
60
|
+
const callHandlingErrors = useCallHandlingErrors();
|
|
61
|
+
|
|
62
|
+
const [coinAmountValue, setCoinAmountValue] = useState("");
|
|
63
|
+
const [coinAmountPlaceholder, setCoinAmountPlaceholder] = useState("0");
|
|
64
|
+
const [fiatAmountValue, setFiatAmountValue] = useState("");
|
|
65
|
+
const [interactedWith, setInteractedWith] = useState(false);
|
|
66
|
+
const [fiatAmountAutoFocus, setFiatAmountAutoFocus] = useState(false);
|
|
67
|
+
const [isInFocus, setIsInFocus] = useState(false);
|
|
68
|
+
const [highlightBalance, setHighlightBalance] = useState(false);
|
|
69
|
+
const [highlightInput, setHighlightInput] = useState(false);
|
|
70
|
+
|
|
71
|
+
const resetToDefault = () => {
|
|
72
|
+
setInteractedWith(false);
|
|
73
|
+
setFiatAmountAutoFocus(false);
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
useEffect(() => {
|
|
77
|
+
if (updateAssetInputTo !== null) handleChangeAmount(updateAssetInputTo?.toString(), false);
|
|
78
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
79
|
+
}, [updateAssetInputTo]);
|
|
80
|
+
|
|
81
|
+
const handleChangeAmount = (newAmountString, handlerEnabled = true) => {
|
|
82
|
+
(async () => {
|
|
83
|
+
try {
|
|
84
|
+
const correctedAmount = InputValuesProviders.provideFormatOfFloatValueByInputString(
|
|
85
|
+
newAmountString,
|
|
86
|
+
assetDecimalPlaces
|
|
87
|
+
);
|
|
88
|
+
setCoinAmountValue(correctedAmount);
|
|
89
|
+
if (handlerEnabled) handleCoinAmountChange(correctedAmount);
|
|
90
|
+
|
|
91
|
+
if (correctedAmount !== "" && cryptoAssetToFiatRate != null) {
|
|
92
|
+
const fiatAmount = BigNumber(correctedAmount)
|
|
93
|
+
.times(cryptoAssetToFiatRate)
|
|
94
|
+
.toFixed(fiatCurrencyDecimals);
|
|
95
|
+
setFiatAmountValue(fiatAmount);
|
|
96
|
+
handleFiatAmountChange(fiatAmount);
|
|
97
|
+
} else {
|
|
98
|
+
setFiatAmountValue("");
|
|
99
|
+
}
|
|
100
|
+
} catch (e) {
|
|
101
|
+
setFiatAmountValue(null);
|
|
102
|
+
logErrorOrOutputToConsole(e);
|
|
103
|
+
}
|
|
104
|
+
})();
|
|
105
|
+
setInteractedWith(true);
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
const handleChangeAmountFiat = newAmountString => {
|
|
109
|
+
if (cryptoAssetToFiatRate == null) return;
|
|
110
|
+
(async () => {
|
|
111
|
+
try {
|
|
112
|
+
const correctedFiatAmount = InputValuesProviders.provideFormatOfFloatValueByInputString(
|
|
113
|
+
newAmountString,
|
|
114
|
+
fiatCurrencyDecimals
|
|
115
|
+
);
|
|
116
|
+
setFiatAmountValue(correctedFiatAmount);
|
|
117
|
+
handleFiatAmountChange(correctedFiatAmount);
|
|
118
|
+
|
|
119
|
+
const coinAmount =
|
|
120
|
+
correctedFiatAmount !== ""
|
|
121
|
+
? BigNumber(correctedFiatAmount).div(cryptoAssetToFiatRate).toFixed(assetDecimalPlaces)
|
|
122
|
+
: "0";
|
|
123
|
+
const coinsAmount = BigNumber(coinAmount).isZero() ? "" : coinAmount;
|
|
124
|
+
setCoinAmountValue(coinsAmount);
|
|
125
|
+
handleCoinAmountChange(coinsAmount);
|
|
126
|
+
} catch (e) {
|
|
127
|
+
setFiatAmountValue(null);
|
|
128
|
+
logErrorOrOutputToConsole(e);
|
|
129
|
+
}
|
|
130
|
+
})();
|
|
131
|
+
};
|
|
132
|
+
|
|
133
|
+
const placeholderByDecimalCount = decimalCount =>
|
|
134
|
+
"0" + (decimalCount > 0 ? "." + "0".repeat(decimalCount) : "");
|
|
135
|
+
|
|
136
|
+
const handleFiatInteraction = () => {
|
|
137
|
+
if (disabled || locked) return;
|
|
138
|
+
setFiatAmountAutoFocus(true);
|
|
139
|
+
setInteractedWith(true);
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
useEffect(() => {
|
|
143
|
+
predefinedValue != null && handleChangeAmount(predefinedValue + "");
|
|
144
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
145
|
+
}, [predefinedValue]);
|
|
146
|
+
|
|
147
|
+
useEffect(() => {
|
|
148
|
+
if (!cryptoAssetToFiatRate || typeof cryptoAssetToFiatRate !== "string") return;
|
|
149
|
+
|
|
150
|
+
handleChangeAmount(coinAmountValue, false);
|
|
151
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
152
|
+
}, [cryptoAssetToFiatRate]);
|
|
153
|
+
|
|
154
|
+
useEffect(() => {
|
|
155
|
+
try {
|
|
156
|
+
setCoinAmountPlaceholder(placeholderByDecimalCount(assetDecimalPlaces));
|
|
157
|
+
} catch (e) {
|
|
158
|
+
logErrorOrOutputToConsole(e);
|
|
159
|
+
}
|
|
160
|
+
resetToDefault();
|
|
161
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
162
|
+
}, [ticker]);
|
|
163
|
+
|
|
164
|
+
// Check if input & balance highlights are needed after a change in either the asset amount or the balance
|
|
165
|
+
useEffect(() => {
|
|
166
|
+
if (!showBalanceValidation || assetBalance?.assetAmount == null) return;
|
|
167
|
+
|
|
168
|
+
let enableHighlight = BigNumber(coinAmountValue).gt(assetBalance?.assetAmount);
|
|
169
|
+
|
|
170
|
+
handleBalanceValidationChange(enableHighlight);
|
|
171
|
+
setHighlightBalance(enableHighlight);
|
|
172
|
+
setHighlightInput(enableHighlight);
|
|
173
|
+
|
|
174
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
175
|
+
}, [coinAmountValue, assetBalance]);
|
|
176
|
+
|
|
177
|
+
// Clearing the custom focus upon disabling or enabling the form
|
|
178
|
+
useEffect(() => setIsInFocus(false), [disabled, locked]);
|
|
179
|
+
|
|
180
|
+
return (
|
|
181
|
+
<>
|
|
182
|
+
<TitleBox
|
|
183
|
+
title={label}
|
|
184
|
+
linkText={isSendAll !== null ? (isSendAll ? linkButtonActiveText : linkButtonInactiveText) : null}
|
|
185
|
+
linkButtonClick={handleSendAllClick}
|
|
186
|
+
>
|
|
187
|
+
<div
|
|
188
|
+
className={[
|
|
189
|
+
s["amount-input-container"],
|
|
190
|
+
isInFocus ? s["focus"] : "",
|
|
191
|
+
errorEncountered || highlightInput ? s["error-encountered"] : "",
|
|
192
|
+
upperFormPosition ? s["upper-form-position"] : "",
|
|
193
|
+
lowerFormPosition ? s["lower-form-position"] : "",
|
|
194
|
+
].join(" ")}
|
|
195
|
+
>
|
|
196
|
+
<div
|
|
197
|
+
className={`${s["amount-input-container-input-wrapper"]} ${disabled ? s["disabled"] : ""}
|
|
198
|
+
${children ? s["bottom-margin"] : ""}`}
|
|
199
|
+
>
|
|
200
|
+
{showBalance ? (
|
|
201
|
+
<div className={s["asset-balance"] + " " + (highlightBalance ? s["red"] : "")}>
|
|
202
|
+
<WalletIcon />
|
|
203
|
+
<p>
|
|
204
|
+
{assetBalance?.assetAmount != null &&
|
|
205
|
+
assetBalance?.fiatAmount != null &&
|
|
206
|
+
ticker &&
|
|
207
|
+
fiatCurrencyCode ? (
|
|
208
|
+
<>
|
|
209
|
+
{AmountUtils.cryptoFull(
|
|
210
|
+
assetBalance.assetAmount,
|
|
211
|
+
tickerPrintable,
|
|
212
|
+
assetDecimalPlaces
|
|
213
|
+
)}
|
|
214
|
+
<span>
|
|
215
|
+
{" ~ " +
|
|
216
|
+
AmountUtils.fiat(assetBalance.fiatAmount, fiatCurrencyCode)}
|
|
217
|
+
</span>
|
|
218
|
+
</>
|
|
219
|
+
) : (
|
|
220
|
+
balanceLoaderText
|
|
221
|
+
)}
|
|
222
|
+
</p>
|
|
223
|
+
</div>
|
|
224
|
+
) : (
|
|
225
|
+
""
|
|
226
|
+
)}
|
|
227
|
+
|
|
228
|
+
<div className={s["requested-amount-coin"]}>
|
|
229
|
+
<span className={s["requested-amount-coin-currency"]}>
|
|
230
|
+
{tickerPrintable ? (estimateAmount ? "~ " : "") + tickerPrintable : ""}
|
|
231
|
+
</span>
|
|
232
|
+
{!isLoading ? (
|
|
233
|
+
<input
|
|
234
|
+
type="text"
|
|
235
|
+
inputMode="decimal"
|
|
236
|
+
value={coinAmountValue}
|
|
237
|
+
onChange={e => handleChangeAmount(e.target.value)}
|
|
238
|
+
placeholder={coinAmountPlaceholder}
|
|
239
|
+
className={s["requested-amount-coin-input"]}
|
|
240
|
+
disabled={disabled || locked}
|
|
241
|
+
onFocus={e => callHandlingErrors(() => setIsInFocus(true), e)}
|
|
242
|
+
onBlur={e => callHandlingErrors(() => setIsInFocus(false), e)}
|
|
243
|
+
/>
|
|
244
|
+
) : (
|
|
245
|
+
<div className={s["requested-amount-coin-skeleton"]}>
|
|
246
|
+
<span
|
|
247
|
+
className={
|
|
248
|
+
s["requested-amount-coin-skeleton-content"] + " " + "skeleton-dark"
|
|
249
|
+
}
|
|
250
|
+
></span>
|
|
251
|
+
</div>
|
|
252
|
+
)}
|
|
253
|
+
</div>
|
|
254
|
+
{fiatCurrencyCode !== null ? (
|
|
255
|
+
<>
|
|
256
|
+
<div
|
|
257
|
+
className={
|
|
258
|
+
s["requested-amount-fiat"] + (interactedWith ? " " + s["interacted"] : "")
|
|
259
|
+
}
|
|
260
|
+
>
|
|
261
|
+
{interactedWith ? (
|
|
262
|
+
<>
|
|
263
|
+
<span className={s["requested-amount-fiat-currency"]}>
|
|
264
|
+
{(estimateAmount ? "~ " : "") + fiatCurrencyCode}
|
|
265
|
+
</span>
|
|
266
|
+
|
|
267
|
+
{!isLoading && cryptoAssetToFiatRate ? (
|
|
268
|
+
<input
|
|
269
|
+
type="text"
|
|
270
|
+
inputMode="decimal"
|
|
271
|
+
className={s["requested-amount-fiat-input"]}
|
|
272
|
+
value={fiatAmountValue}
|
|
273
|
+
disabled={disabled || locked}
|
|
274
|
+
onChange={e => handleChangeAmountFiat(e.target.value)}
|
|
275
|
+
placeholder={placeholderByDecimalCount(fiatCurrencyDecimals)}
|
|
276
|
+
autoFocus={fiatAmountAutoFocus}
|
|
277
|
+
onFocus={e => callHandlingErrors(() => setIsInFocus(true), e)}
|
|
278
|
+
onBlur={e => callHandlingErrors(() => setIsInFocus(false), e)}
|
|
279
|
+
/>
|
|
280
|
+
) : (
|
|
281
|
+
<div className={s["requested-amount-fiat-skeleton"]}>
|
|
282
|
+
<span
|
|
283
|
+
className={
|
|
284
|
+
s["requested-amount-fiat-skeleton-content"] +
|
|
285
|
+
" " +
|
|
286
|
+
"skeleton-dark"
|
|
287
|
+
}
|
|
288
|
+
></span>
|
|
289
|
+
</div>
|
|
290
|
+
)}
|
|
291
|
+
</>
|
|
292
|
+
) : (
|
|
293
|
+
<span
|
|
294
|
+
className={s["requested-amount-fiat-placeholder"]}
|
|
295
|
+
onClick={e => callHandlingErrors(() => handleFiatInteraction(), e)}
|
|
296
|
+
>
|
|
297
|
+
{fiatInputPlaceholderText}
|
|
298
|
+
</span>
|
|
299
|
+
)}
|
|
300
|
+
</div>
|
|
301
|
+
</>
|
|
302
|
+
) : null}
|
|
303
|
+
</div>
|
|
304
|
+
{showChangeAssetButton && ticker ? (
|
|
305
|
+
<div className={s["amount-input-container-button-wrapper"]} ref={buttonForwardRef}>
|
|
306
|
+
<AssetSelection
|
|
307
|
+
assetIconSrc={assetIconSrc}
|
|
308
|
+
assetIconProtocolSrc={assetIconProtocolSrc}
|
|
309
|
+
fallbackSrc={fallbackAssetIconSrc}
|
|
310
|
+
handleClick={handleChangeAssetClick}
|
|
311
|
+
disabled={changeAssetButtonDisabled}
|
|
312
|
+
protocolName={changeAssetButtonProtocol}
|
|
313
|
+
/>
|
|
314
|
+
</div>
|
|
315
|
+
) : (
|
|
316
|
+
""
|
|
317
|
+
)}
|
|
318
|
+
{children}
|
|
319
|
+
</div>
|
|
320
|
+
</TitleBox>
|
|
321
|
+
{alertText ? <Validation text={alertText} /> : null}
|
|
322
|
+
</>
|
|
323
|
+
);
|
|
324
|
+
}
|
|
325
|
+
);
|