@rabbitio/ui-kit 1.0.0-beta.6 → 1.0.0-beta.61
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 +14 -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 +17210 -0
- package/coverage/coverage-final.json +160 -0
- package/coverage/favicon.png +0 -0
- package/coverage/index.html +1241 -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/assets/wrappedImages/arrowIcon.jsx.html +142 -0
- package/coverage/ui-kit/src/assets/wrappedImages/arrowTosca.jsx.html +145 -0
- package/coverage/ui-kit/src/assets/wrappedImages/arrowWhite.jsx.html +145 -0
- package/coverage/ui-kit/src/assets/wrappedImages/darkRectangle.jsx.html +139 -0
- package/coverage/ui-kit/src/assets/wrappedImages/determinedError.jsx.html +472 -0
- package/coverage/ui-kit/src/assets/wrappedImages/failedValidationIcon.jsx.html +244 -0
- package/coverage/ui-kit/src/assets/wrappedImages/index.html +251 -0
- package/coverage/ui-kit/src/assets/wrappedImages/infoIcon.jsx.html +151 -0
- package/coverage/ui-kit/src/assets/wrappedImages/noticeQuestionIcon.jsx.html +265 -0
- package/coverage/ui-kit/src/assets/wrappedImages/successfulValidationIcon.jsx.html +205 -0
- package/coverage/ui-kit/src/assets/wrappedImages/walletIcon.jsx.html +199 -0
- package/coverage/ui-kit/src/common/adapters/axiosAdapter.js.html +190 -0
- package/coverage/ui-kit/src/common/adapters/index.html +131 -0
- package/coverage/ui-kit/src/common/adapters/qrUtils.js.html +139 -0
- package/coverage/ui-kit/src/common/amountUtils.js.html +1393 -0
- package/coverage/ui-kit/src/common/errorUtils.js.html +211 -0
- package/coverage/ui-kit/src/common/external-apis/apiGroups.js.html +250 -0
- package/coverage/ui-kit/src/common/external-apis/index.html +131 -0
- package/coverage/ui-kit/src/common/external-apis/ipAddressProviders.js.html +499 -0
- package/coverage/ui-kit/src/common/fiatCurrenciesService.js.html +568 -0
- package/coverage/ui-kit/src/common/index.html +146 -0
- package/coverage/ui-kit/src/common/models/blockchain.js.html +115 -0
- package/coverage/ui-kit/src/common/models/coin.js.html +556 -0
- package/coverage/ui-kit/src/common/models/index.html +146 -0
- package/coverage/ui-kit/src/common/models/protocol.js.html +100 -0
- package/coverage/ui-kit/src/common/utils/cache.js.html +889 -0
- package/coverage/ui-kit/src/common/utils/emailAPI.js.html +139 -0
- package/coverage/ui-kit/src/common/utils/index.html +161 -0
- package/coverage/ui-kit/src/common/utils/logging/index.html +131 -0
- package/coverage/ui-kit/src/common/utils/logging/logger.js.html +229 -0
- package/coverage/ui-kit/src/common/utils/logging/logsStorage.js.html +268 -0
- package/coverage/ui-kit/src/common/utils/postponeExecution.js.html +118 -0
- package/coverage/ui-kit/src/common/utils/safeStringify.js.html +235 -0
- package/coverage/ui-kit/src/components/atoms/AssetIcon/AssetIcon.jsx.html +277 -0
- package/coverage/ui-kit/src/components/atoms/AssetIcon/index.html +116 -0
- package/coverage/ui-kit/src/components/atoms/AssetSelection/AssetSelection.jsx.html +310 -0
- package/coverage/ui-kit/src/components/atoms/AssetSelection/index.html +116 -0
- package/coverage/ui-kit/src/components/atoms/BackgroundTitle/BackgroundTitle.jsx.html +217 -0
- package/coverage/ui-kit/src/components/atoms/BackgroundTitle/index.html +116 -0
- package/coverage/ui-kit/src/components/atoms/InformationMessage/InformationMessage.jsx.html +265 -0
- package/coverage/ui-kit/src/components/atoms/InformationMessage/index.html +116 -0
- package/coverage/ui-kit/src/components/atoms/Input/Input.jsx.html +679 -0
- package/coverage/ui-kit/src/components/atoms/Input/index.html +116 -0
- package/coverage/ui-kit/src/components/atoms/LoadingDots/LoadingDots.jsx.html +256 -0
- package/coverage/ui-kit/src/components/atoms/LoadingDots/index.html +116 -0
- package/coverage/ui-kit/src/components/atoms/NoticeIcon/NoticeIcon.jsx.html +298 -0
- package/coverage/ui-kit/src/components/atoms/NoticeIcon/index.html +116 -0
- package/coverage/ui-kit/src/components/atoms/QrCode/QrCode.jsx.html +187 -0
- package/coverage/ui-kit/src/components/atoms/QrCode/index.html +116 -0
- package/coverage/ui-kit/src/components/atoms/RateSelector/RateSelector.jsx.html +196 -0
- package/coverage/ui-kit/src/components/atoms/RateSelector/index.html +116 -0
- package/coverage/ui-kit/src/components/atoms/SupportChat/SupportChat.jsx.html +229 -0
- package/coverage/ui-kit/src/components/atoms/SupportChat/index.html +116 -0
- package/coverage/ui-kit/src/components/atoms/Textarea/Textarea.jsx.html +559 -0
- package/coverage/ui-kit/src/components/atoms/Textarea/index.html +116 -0
- package/coverage/ui-kit/src/components/atoms/TitleBox/TitleBox.jsx.html +577 -0
- package/coverage/ui-kit/src/components/atoms/TitleBox/index.html +116 -0
- package/coverage/ui-kit/src/components/atoms/Tooltip/Tooltip.jsx.html +295 -0
- package/coverage/ui-kit/src/components/atoms/Tooltip/index.html +116 -0
- package/coverage/ui-kit/src/components/atoms/TwoLinesOfText/LinesOfText.jsx.html +325 -0
- package/coverage/ui-kit/src/components/atoms/TwoLinesOfText/index.html +116 -0
- package/coverage/ui-kit/src/components/atoms/Validation/Validation.jsx.html +202 -0
- package/coverage/ui-kit/src/components/atoms/Validation/index.html +116 -0
- package/coverage/ui-kit/src/components/atoms/buttons/Button/Button.jsx.html +802 -0
- package/coverage/ui-kit/src/components/atoms/buttons/Button/index.html +116 -0
- package/coverage/ui-kit/src/components/atoms/buttons/Close/Close.jsx.html +262 -0
- package/coverage/ui-kit/src/components/atoms/buttons/Close/index.html +116 -0
- package/coverage/ui-kit/src/components/atoms/buttons/LinkButton/LinkButton.jsx.html +430 -0
- package/coverage/ui-kit/src/components/atoms/buttons/LinkButton/index.html +116 -0
- package/coverage/ui-kit/src/components/atoms/buttons/RadioButtonWithText/RadioButtonWithText.jsx.html +469 -0
- package/coverage/ui-kit/src/components/atoms/buttons/RadioButtonWithText/index.html +116 -0
- package/coverage/ui-kit/src/components/hooks/index.html +131 -0
- package/coverage/ui-kit/src/components/hooks/useCallHandlingErrors.js.html +163 -0
- package/coverage/ui-kit/src/components/hooks/useReferredState.js.html +157 -0
- package/coverage/ui-kit/src/components/molecules/AmountInput/AmountInput.jsx.html +1348 -0
- package/coverage/ui-kit/src/components/molecules/AmountInput/index.html +116 -0
- package/coverage/ui-kit/src/components/molecules/CoinPicker/CoinPicker.jsx.html +2011 -0
- package/coverage/ui-kit/src/components/molecules/CoinPicker/index.html +116 -0
- package/coverage/ui-kit/src/components/molecules/LineWithIconLink/LineWithIconLink.jsx.html +205 -0
- package/coverage/ui-kit/src/components/molecules/LineWithIconLink/index.html +116 -0
- package/coverage/ui-kit/src/components/molecules/TitledLineWithIconLink/TitledLineWithIconLink.jsx.html +175 -0
- package/coverage/ui-kit/src/components/molecules/TitledLineWithIconLink/index.html +116 -0
- package/coverage/ui-kit/src/components/organisms/CoinPickerDialogStep/CoinPickerDialogStep.jsx.html +283 -0
- package/coverage/ui-kit/src/components/organisms/CoinPickerDialogStep/index.html +116 -0
- package/coverage/ui-kit/src/components/organisms/Dialog/Dialog.jsx.html +1630 -0
- package/coverage/ui-kit/src/components/organisms/Dialog/DialogButtons/DialogButtons.jsx.html +451 -0
- package/coverage/ui-kit/src/components/organisms/Dialog/DialogButtons/index.html +116 -0
- package/coverage/ui-kit/src/components/organisms/Dialog/DialogStep/DialogStep.jsx.html +2146 -0
- package/coverage/ui-kit/src/components/organisms/Dialog/DialogStep/index.html +116 -0
- package/coverage/ui-kit/src/components/organisms/Dialog/index.html +116 -0
- package/coverage/ui-kit/src/components/organisms/SwapForm/SwapForm.jsx.html +3883 -0
- package/coverage/ui-kit/src/components/organisms/SwapForm/index.html +116 -0
- package/coverage/ui-kit/src/components/templates/DeterminedErrorDialogStep/DeterminedErrorDialogStep.jsx.html +316 -0
- package/coverage/ui-kit/src/components/templates/DeterminedErrorDialogStep/index.html +116 -0
- package/coverage/ui-kit/src/components/utils/index.html +161 -0
- package/coverage/ui-kit/src/components/utils/inputValueProviders.js.html +259 -0
- package/coverage/ui-kit/src/components/utils/textUtils.js.html +139 -0
- package/coverage/ui-kit/src/components/utils/uiUtils.js.html +127 -0
- package/coverage/ui-kit/src/components/utils/urlQueryUtils.js.html +346 -0
- package/coverage/ui-kit/src/constants/atoms/Close/close.jsx.html +100 -0
- package/coverage/ui-kit/src/constants/atoms/Close/index.html +116 -0
- package/coverage/ui-kit/src/constants/atoms/LinkButton/index.html +116 -0
- package/coverage/ui-kit/src/constants/atoms/LinkButton/linkButton.jsx.html +103 -0
- package/coverage/ui-kit/src/constants/atoms/Tooltip/index.html +116 -0
- package/coverage/ui-kit/src/constants/atoms/Tooltip/tooltip.jsx.html +109 -0
- package/coverage/ui-kit/src/constants/globalConstants.jsx.html +97 -0
- package/coverage/ui-kit/src/constants/index.html +116 -0
- package/coverage/ui-kit/src/constants/organisms/dialog/DialogStep/dialogStep.js.html +88 -0
- package/coverage/ui-kit/src/constants/organisms/dialog/DialogStep/index.html +116 -0
- package/coverage/ui-kit/src/constants/organisms/dialog/dialog.js.html +172 -0
- package/coverage/ui-kit/src/constants/organisms/dialog/index.html +116 -0
- package/coverage/ui-kit/src/index.html +116 -0
- package/coverage/ui-kit/src/index.js.html +367 -0
- package/coverage/ui-kit/src/robustExteranlApiCallerService/cacheAndConcurrentRequestsResolver.js.html +1762 -0
- package/coverage/ui-kit/src/robustExteranlApiCallerService/cachedRobustExternalApiCallerService.js.html +649 -0
- package/coverage/ui-kit/src/robustExteranlApiCallerService/cancelProcessing.js.html +172 -0
- package/coverage/ui-kit/src/robustExteranlApiCallerService/concurrentCalculationsMetadataHolder.js.html +394 -0
- package/coverage/ui-kit/src/robustExteranlApiCallerService/externalApiProvider.js.html +553 -0
- package/coverage/ui-kit/src/robustExteranlApiCallerService/externalServicesStatsCollector.js.html +331 -0
- package/coverage/ui-kit/src/robustExteranlApiCallerService/index.html +206 -0
- package/coverage/ui-kit/src/robustExteranlApiCallerService/robustExternalAPICallerService.js.html +1249 -0
- package/coverage/ui-kit/src/swaps-lib/external-apis/index.html +131 -0
- package/coverage/ui-kit/src/swaps-lib/external-apis/swapProvider.js.html +727 -0
- package/coverage/ui-kit/src/swaps-lib/external-apis/swapspaceSwapProvider.js.html +2899 -0
- package/coverage/ui-kit/src/swaps-lib/models/baseSwapCreationInfo.js.html +214 -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 +487 -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 +2191 -0
- package/coverage/ui-kit/src/swaps-lib/utils/index.html +116 -0
- package/coverage/ui-kit/src/swaps-lib/utils/swapUtils.js.html +742 -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 +946 -0
- package/coverage/ui-kit/stories/atoms/buttons/Close.stories.jsx.html +214 -0
- package/coverage/ui-kit/stories/atoms/buttons/LinkButton.stories.jsx.html +295 -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 +589 -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 +193 -0
- package/coverage/ui-kit/stories/templates/index.html +116 -0
- package/dist/index.cjs +9963 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +71409 -1641
- package/dist/index.css.map +1 -1
- package/dist/index.modern.js +7672 -11
- package/dist/index.modern.js.map +1 -1
- package/dist/index.module.js +9883 -11
- package/dist/index.module.js.map +1 -1
- package/dist/index.umd.js +9954 -12
- package/dist/index.umd.js.map +1 -1
- package/index.js +1 -1
- package/package.json +27 -5
- package/src/assets/image/icons/arrow-tosca.svg +3 -0
- package/src/assets/wrappedImages/arrowIcon.jsx +19 -0
- package/src/assets/wrappedImages/arrowTosca.jsx +20 -0
- package/src/assets/wrappedImages/arrowWhite.jsx +20 -0
- package/src/assets/wrappedImages/darkRectangle.jsx +18 -0
- package/src/assets/wrappedImages/determinedError.jsx +129 -0
- package/src/assets/wrappedImages/failedValidationIcon.jsx +53 -0
- package/src/assets/wrappedImages/infoIcon.jsx +22 -0
- package/src/assets/wrappedImages/noticeQuestionIcon.jsx +60 -0
- package/src/assets/wrappedImages/successfulValidationIcon.jsx +40 -0
- package/src/assets/wrappedImages/walletIcon.jsx +38 -0
- package/src/common/adapters/axiosAdapter.js +35 -0
- package/src/common/adapters/qrUtils.js +18 -0
- package/src/common/amountUtils.js +436 -0
- package/src/common/errorUtils.js +42 -0
- package/src/common/external-apis/apiGroups.js +55 -0
- package/src/common/external-apis/ipAddressProviders.js +138 -0
- package/src/common/fiatCurrenciesService.js +161 -0
- package/src/common/models/blockchain.js +10 -0
- package/src/common/models/coin.js +157 -0
- package/src/common/models/protocol.js +5 -0
- package/src/common/tests/integration/external-apis/ipAddressProviders/getClientIpAddress.test.js +14 -0
- package/src/common/utils/cache.js +268 -0
- package/src/common/utils/emailAPI.js +18 -0
- package/src/common/utils/logging/logger.js +48 -0
- package/src/common/utils/logging/logsStorage.js +61 -0
- package/src/common/utils/postponeExecution.js +11 -0
- package/src/common/utils/safeStringify.js +50 -0
- package/src/components/atoms/AssetIcon/AssetIcon.jsx +64 -0
- package/src/components/atoms/AssetIcon/asset-icon.module.scss +42 -0
- package/src/components/atoms/AssetSelection/AssetSelection.jsx +75 -0
- package/src/components/atoms/AssetSelection/asset-selection.module.scss +55 -0
- package/src/components/atoms/BackgroundTitle/BackgroundTitle.jsx +44 -0
- package/src/components/atoms/BackgroundTitle/background-title.module.scss +52 -0
- package/src/components/atoms/InformationMessage/InformationMessage.jsx +60 -0
- package/src/components/atoms/InformationMessage/information-message.module.scss +36 -0
- package/src/components/atoms/Input/Input.jsx +198 -0
- package/src/components/atoms/Input/input.module.scss +107 -0
- package/{stories → src/components}/atoms/LoadingDots/LoadingDots.module.scss +1 -1
- package/src/components/atoms/NoticeIcon/NoticeIcon.jsx +71 -0
- package/src/components/atoms/NoticeIcon/notice-icon.module.scss +14 -0
- package/src/components/atoms/QrCode/QrCode.jsx +34 -0
- package/src/components/atoms/QrCode/qr-code.module.scss +9 -0
- package/src/components/atoms/RateSelector/RateSelector.jsx +37 -0
- package/src/components/atoms/RateSelector/rate-selector.module.scss +47 -0
- package/src/components/atoms/SupportChat/SupportChat.jsx +48 -0
- package/src/components/atoms/Textarea/Textarea.jsx +158 -0
- package/src/components/atoms/Textarea/textarea.module.scss +71 -0
- package/src/components/atoms/TitleBox/TitleBox.jsx +164 -0
- package/src/components/atoms/TitleBox/title-box.module.scss +30 -0
- package/src/components/atoms/Tooltip/Tooltip.jsx +70 -0
- package/src/components/atoms/Tooltip/tooltip.module.scss +237 -0
- package/src/components/atoms/TwoLinesOfText/LinesOfText.jsx +80 -0
- package/src/components/atoms/TwoLinesOfText/lines-of-text.module.scss +65 -0
- package/src/components/atoms/Validation/Validation.jsx +39 -0
- package/src/components/atoms/Validation/validation.module.scss +15 -0
- package/{stories → src/components}/atoms/buttons/Button/Button.jsx +5 -1
- package/{stories → src/components}/atoms/buttons/Button/Button.module.scss +1 -1
- package/src/components/atoms/buttons/Close/Close.jsx +59 -0
- package/src/components/atoms/buttons/Close/close.module.scss +75 -0
- package/src/components/atoms/buttons/LinkButton/LinkButton.jsx +115 -0
- package/src/components/atoms/buttons/LinkButton/link-button.module.scss +49 -0
- package/src/components/atoms/buttons/RadioButtonWithText/RadioButtonWithText.jsx +128 -0
- package/src/components/atoms/buttons/RadioButtonWithText/radio-button-with-text.module.scss +86 -0
- package/src/components/hooks/useCallHandlingErrors.js +26 -0
- package/src/components/hooks/useReferredState.js +24 -0
- package/src/components/molecules/AmountInput/AmountInput.jsx +421 -0
- package/src/components/molecules/AmountInput/amount-input.module.scss +189 -0
- package/src/components/molecules/CoinPicker/CoinPicker.jsx +642 -0
- package/src/components/molecules/CoinPicker/coin-picker.module.scss +210 -0
- package/src/components/molecules/LineWithIconLink/LineWithIconLink.jsx +40 -0
- package/src/components/molecules/LineWithIconLink/line-with-icon-link.module.scss +25 -0
- package/src/components/molecules/TitledLineWithIconLink/TitledLineWithIconLink.jsx +30 -0
- package/src/components/organisms/CoinPickerDialogStep/CoinPickerDialogStep.jsx +66 -0
- package/src/components/organisms/Dialog/Dialog.jsx +515 -0
- package/src/components/organisms/Dialog/DialogButtons/DialogButtons.jsx +122 -0
- package/src/components/organisms/Dialog/DialogButtons/dialog-buttons.module.scss +25 -0
- package/src/components/organisms/Dialog/DialogStep/DialogStep.jsx +687 -0
- package/src/components/organisms/Dialog/DialogStep/dialog-step.module.scss +383 -0
- package/src/components/organisms/Dialog/dialog.module.scss +226 -0
- package/src/components/organisms/SwapForm/SwapForm.jsx +1266 -0
- package/src/components/organisms/SwapForm/swap-form.module.scss +134 -0
- package/src/components/templates/DeterminedErrorDialogStep/DeterminedErrorDialogStep.jsx +77 -0
- package/src/components/tests/utils/inputValueProviders/provideFormatOfFloatValueByInputString.test.js +139 -0
- package/src/components/tests/utils/urlQueryUtils/getQueryParameterValues.test.js +71 -0
- package/src/components/tests/utils/urlQueryUtils/saveQueryParameterAndValues.test.js +144 -0
- package/src/components/utils/inputValueProviders.js +58 -0
- package/src/components/utils/textUtils.js +18 -0
- package/src/components/utils/uiUtils.js +14 -0
- package/src/components/utils/urlQueryUtils.js +87 -0
- package/src/constants/atoms/Close/close.jsx +5 -0
- package/src/constants/atoms/LinkButton/linkButton.jsx +6 -0
- package/src/constants/atoms/Tooltip/tooltip.jsx +8 -0
- package/src/constants/globalConstants.jsx +4 -0
- package/src/constants/organisms/dialog/DialogStep/dialogStep.js +1 -0
- package/src/constants/organisms/dialog/dialog.js +29 -0
- package/src/index.js +94 -0
- package/src/robustExteranlApiCallerService/cacheAndConcurrentRequestsResolver.js +559 -0
- package/src/robustExteranlApiCallerService/cachedRobustExternalApiCallerService.js +188 -0
- package/src/robustExteranlApiCallerService/cancelProcessing.js +29 -0
- package/src/robustExteranlApiCallerService/concurrentCalculationsMetadataHolder.js +103 -0
- package/src/robustExteranlApiCallerService/externalApiProvider.js +156 -0
- package/src/robustExteranlApiCallerService/externalServicesStatsCollector.js +82 -0
- package/src/robustExteranlApiCallerService/robustExternalAPICallerService.js +388 -0
- package/src/robustExteranlApiCallerService/tests/robustExternalAPICallerService/robustExternalAPICallerService/callExternalAPI/_performCallAttempt.test.js +787 -0
- package/src/robustExteranlApiCallerService/tests/robustExternalAPICallerService/robustExternalAPICallerService/callExternalAPI/callExternalAPI.test.js +745 -0
- package/src/robustExteranlApiCallerService/tests/robustExternalAPICallerService/robustExternalAPICallerService/constructor.test.js +31 -0
- package/src/swaps-lib/external-apis/swapProvider.js +214 -0
- package/src/swaps-lib/external-apis/swapspaceSwapProvider.js +938 -0
- package/src/swaps-lib/models/baseSwapCreationInfo.js +43 -0
- package/src/swaps-lib/models/existingSwap.js +73 -0
- package/src/swaps-lib/models/existingSwapWithFiatData.js +134 -0
- package/src/swaps-lib/services/publicSwapService.js +702 -0
- package/src/swaps-lib/test/external-apis/swapspaceSwapProvider/_fetchSupportedCurrenciesIfNeeded.test.js +506 -0
- package/src/swaps-lib/test/external-apis/swapspaceSwapProvider/createSwap.test.js +1311 -0
- package/src/swaps-lib/test/external-apis/swapspaceSwapProvider/getAllSupportedCurrencies.test.js +76 -0
- package/src/swaps-lib/test/external-apis/swapspaceSwapProvider/getDepositCurrencies.test.js +82 -0
- package/src/swaps-lib/test/external-apis/swapspaceSwapProvider/getSwapInfo.test.js +1892 -0
- package/src/swaps-lib/test/external-apis/swapspaceSwapProvider/getWithdrawalCurrencies.test.js +111 -0
- package/src/swaps-lib/test/utils/swapUtils/safeHandleRequestsLimitExceeding.test.js +88 -0
- package/src/swaps-lib/utils/swapUtils.js +219 -0
- package/stories/stubs/exampleContent.jsx +20 -0
- package/styles/_placeholder.scss +1 -1
- 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 +1 -1
- package/styles/index.scss +5 -3
- package/stories/index.js +0 -2
- /package/{stories → src/components}/atoms/LoadingDots/LoadingDots.jsx +0 -0
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
import React, { forwardRef } from "react";
|
|
2
|
+
import TextareaAutosize from "react-textarea-autosize";
|
|
3
|
+
import PropTypes from "prop-types";
|
|
4
|
+
|
|
5
|
+
import s from "./textarea.module.scss";
|
|
6
|
+
|
|
7
|
+
import { useCallHandlingErrors } from "../../hooks/useCallHandlingErrors";
|
|
8
|
+
import { Validation } from "../Validation/Validation";
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* A textarea component with optional adaptive height and validation messaging.
|
|
12
|
+
*
|
|
13
|
+
* @param {string} name - The name of the textarea.
|
|
14
|
+
* @param {function} onChange - Handler for change events.
|
|
15
|
+
* @param {string} placeholder - Placeholder text for the textarea.
|
|
16
|
+
* @param {string} alertText - Text for the alert message.
|
|
17
|
+
* @param {string} successAlertText - Text for the success alert message.
|
|
18
|
+
* @param {string} value - Value of the textarea.
|
|
19
|
+
* @param {string} label - Label text for the textarea.
|
|
20
|
+
* @param {string|null} id - ID for the textarea element.
|
|
21
|
+
* @param {boolean} autoFocus - If the textarea should be auto-focused.
|
|
22
|
+
* @param {boolean} fullHeight - If the textarea should be full height.
|
|
23
|
+
* @param {boolean} smallText - If the textarea should use small text styling.
|
|
24
|
+
* @param {boolean} adaptiveHeight - If the textarea should adjust its height based on content.
|
|
25
|
+
* @param {boolean} disabled - If the textarea is disabled.
|
|
26
|
+
* @param {boolean} errorEncountered - If there is an error related to the textarea.
|
|
27
|
+
* @param {boolean} ignoreEnter - If Enter key presses should be ignored.
|
|
28
|
+
*/
|
|
29
|
+
export const Textarea = forwardRef(
|
|
30
|
+
(
|
|
31
|
+
{
|
|
32
|
+
name = "",
|
|
33
|
+
onChange = () => {},
|
|
34
|
+
placeholder = "",
|
|
35
|
+
alertText = "",
|
|
36
|
+
successAlertText = "",
|
|
37
|
+
value = "",
|
|
38
|
+
label = "",
|
|
39
|
+
id = null,
|
|
40
|
+
autoFocus = false,
|
|
41
|
+
fullHeight = false,
|
|
42
|
+
smallText = false,
|
|
43
|
+
adaptiveHeight = false,
|
|
44
|
+
disabled = false,
|
|
45
|
+
errorEncountered = false,
|
|
46
|
+
ignoreEnter = false,
|
|
47
|
+
},
|
|
48
|
+
ref
|
|
49
|
+
) => {
|
|
50
|
+
const callHandlingErrors = useCallHandlingErrors();
|
|
51
|
+
|
|
52
|
+
const onChangeProxy = (e) => {
|
|
53
|
+
if (ignoreEnter)
|
|
54
|
+
e.target.value = e.target.value.replace(/(\r\n|\n|\r)/gm, "");
|
|
55
|
+
|
|
56
|
+
if (e.target?.value.indexOf("\n") === -1 || !ignoreEnter)
|
|
57
|
+
onChange(e);
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
return (
|
|
61
|
+
<div
|
|
62
|
+
className={
|
|
63
|
+
s["textarea"] +
|
|
64
|
+
` ${fullHeight ? " " + s["full-height"] : ""}`
|
|
65
|
+
}
|
|
66
|
+
>
|
|
67
|
+
{label ? (
|
|
68
|
+
<label htmlFor={id} className={s["textarea-input-label"]}>
|
|
69
|
+
{label}
|
|
70
|
+
</label>
|
|
71
|
+
) : null}
|
|
72
|
+
|
|
73
|
+
{adaptiveHeight ? (
|
|
74
|
+
<TextareaAutosize
|
|
75
|
+
className={
|
|
76
|
+
s["textarea-input"] +
|
|
77
|
+
" " +
|
|
78
|
+
s["adaptive-height"] +
|
|
79
|
+
(disabled ? " " + s["disabled"] : "") +
|
|
80
|
+
(errorEncountered
|
|
81
|
+
? " " + s["error-encountered"]
|
|
82
|
+
: "")
|
|
83
|
+
}
|
|
84
|
+
minRows={1}
|
|
85
|
+
maxRows={3}
|
|
86
|
+
onChange={(e) => callHandlingErrors(onChangeProxy, e)}
|
|
87
|
+
placeholder={placeholder}
|
|
88
|
+
value={value}
|
|
89
|
+
id={id}
|
|
90
|
+
autoFocus={autoFocus}
|
|
91
|
+
ref={ref}
|
|
92
|
+
disabled={disabled}
|
|
93
|
+
/>
|
|
94
|
+
) : (
|
|
95
|
+
<textarea
|
|
96
|
+
name={name}
|
|
97
|
+
className={
|
|
98
|
+
s["textarea-input"] +
|
|
99
|
+
` ${fullHeight ? s["full-height"] : ""} ${
|
|
100
|
+
smallText ? s["small-text"] : ""
|
|
101
|
+
} ${disabled ? s["disabled"] : ""}`
|
|
102
|
+
}
|
|
103
|
+
onChange={(e) => callHandlingErrors(onChange, e)}
|
|
104
|
+
placeholder={placeholder}
|
|
105
|
+
value={value}
|
|
106
|
+
id={id}
|
|
107
|
+
autoFocus={autoFocus}
|
|
108
|
+
ref={ref}
|
|
109
|
+
disabled={disabled}
|
|
110
|
+
/>
|
|
111
|
+
)}
|
|
112
|
+
|
|
113
|
+
{alertText || successAlertText ? (
|
|
114
|
+
<Validation
|
|
115
|
+
text={alertText || successAlertText}
|
|
116
|
+
isSuccessAlert={!alertText}
|
|
117
|
+
/>
|
|
118
|
+
) : null}
|
|
119
|
+
</div>
|
|
120
|
+
);
|
|
121
|
+
}
|
|
122
|
+
);
|
|
123
|
+
|
|
124
|
+
Textarea.propTypes = {
|
|
125
|
+
name: PropTypes.string,
|
|
126
|
+
onChange: PropTypes.func,
|
|
127
|
+
placeholder: PropTypes.string,
|
|
128
|
+
alertText: PropTypes.string,
|
|
129
|
+
successAlertText: PropTypes.string,
|
|
130
|
+
value: PropTypes.string,
|
|
131
|
+
label: PropTypes.string,
|
|
132
|
+
id: PropTypes.string,
|
|
133
|
+
autoFocus: PropTypes.bool,
|
|
134
|
+
fullHeight: PropTypes.bool,
|
|
135
|
+
smallText: PropTypes.bool,
|
|
136
|
+
adaptiveHeight: PropTypes.bool,
|
|
137
|
+
disabled: PropTypes.bool,
|
|
138
|
+
errorEncountered: PropTypes.bool,
|
|
139
|
+
ignoreEnter: PropTypes.bool,
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
Textarea.defaultProps = {
|
|
143
|
+
name: "",
|
|
144
|
+
onChange: () => {},
|
|
145
|
+
placeholder: "",
|
|
146
|
+
alertText: "",
|
|
147
|
+
successAlertText: "",
|
|
148
|
+
value: "",
|
|
149
|
+
label: "",
|
|
150
|
+
id: null,
|
|
151
|
+
autoFocus: false,
|
|
152
|
+
fullHeight: false,
|
|
153
|
+
smallText: false,
|
|
154
|
+
adaptiveHeight: false,
|
|
155
|
+
disabled: false,
|
|
156
|
+
errorEncountered: false,
|
|
157
|
+
ignoreEnter: false,
|
|
158
|
+
};
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
@import "../../../../styles/index";
|
|
2
|
+
|
|
3
|
+
.textarea {
|
|
4
|
+
display: flex;
|
|
5
|
+
flex-direction: column;
|
|
6
|
+
|
|
7
|
+
&.full-height {
|
|
8
|
+
height: 100%;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
&-input {
|
|
12
|
+
@extend %text-medium;
|
|
13
|
+
padding: Padding("5");
|
|
14
|
+
border-radius: 7px;
|
|
15
|
+
background: SolidColor("lightsmoke");
|
|
16
|
+
border: none;
|
|
17
|
+
width: 100%;
|
|
18
|
+
resize: none;
|
|
19
|
+
min-height: 117px;
|
|
20
|
+
font-size: 16px;
|
|
21
|
+
color: SolidColor("grey");
|
|
22
|
+
appearance: none;
|
|
23
|
+
transition: 0.2s box-shadow $transitionEaseOut;
|
|
24
|
+
box-shadow: $shadowOutlineStatic;
|
|
25
|
+
|
|
26
|
+
&-label {
|
|
27
|
+
@include typograpy(h6);
|
|
28
|
+
font-weight: $semi-bold;
|
|
29
|
+
color: SolidColor("grey");
|
|
30
|
+
margin-bottom: Margin("2");
|
|
31
|
+
display: block;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
@media (hover: hover) {
|
|
35
|
+
&:hover:not(:focus) {
|
|
36
|
+
box-shadow: $shadowOutlineHover;
|
|
37
|
+
transition: 0.02s box-shadow $transitionEaseOut;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
&:focus {
|
|
42
|
+
box-shadow: $shadowOutlineActive;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
&::placeholder {
|
|
46
|
+
@extend %text-medium;
|
|
47
|
+
font-size: 16px;
|
|
48
|
+
color: SolidColor("grey");
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
&.full-height {
|
|
52
|
+
height: 100%;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
&.adaptive-height {
|
|
56
|
+
min-height: auto;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
&.small-text {
|
|
60
|
+
font-size: 12px;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
&.disabled {
|
|
64
|
+
opacity: 0.5;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
&.error-encountered {
|
|
68
|
+
box-shadow: $shadowOutlineError !important;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
import React, { useState } from "react";
|
|
2
|
+
import PropTypes from "prop-types";
|
|
3
|
+
|
|
4
|
+
import s from "./title-box.module.scss";
|
|
5
|
+
|
|
6
|
+
import { useCallHandlingErrors } from "../../hooks/useCallHandlingErrors.js";
|
|
7
|
+
import { copyBrowserTextToClipboard } from "../../utils/textUtils.js";
|
|
8
|
+
import { TOOLTIP_POSITIONS } from "../../../constants/atoms/Tooltip/tooltip.jsx";
|
|
9
|
+
|
|
10
|
+
import { NoticeIcon } from "../NoticeIcon/NoticeIcon.jsx";
|
|
11
|
+
import { LinkButton } from "../buttons/LinkButton/LinkButton.jsx";
|
|
12
|
+
import { Tooltip } from "../Tooltip/Tooltip.jsx";
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* A box component for displaying a title with optional controls like buttons or icons and any children inside.
|
|
16
|
+
*
|
|
17
|
+
* @component
|
|
18
|
+
* @param {string} title - The main title text.
|
|
19
|
+
* @param {string} linkText - The text for the link button, if any.
|
|
20
|
+
* @param {Function} linkButtonClick - The function to execute when the link button is clicked.
|
|
21
|
+
* @param {boolean} isLinkButtonDisabled - Determines if the link button is disabled.
|
|
22
|
+
* @param {React.ReactNode} children - Child components to be rendered.
|
|
23
|
+
* @param {boolean} linkButtonLoader - Displays a loader animation on the link button if true.
|
|
24
|
+
* @param {boolean} fullWidth - If true, the title box will take full width of its container.
|
|
25
|
+
* @param {string} titleNoticeText - The text for a notice icon tooltip.
|
|
26
|
+
* @param {string} titleNoticeIcon - The icon for the notice tooltip.
|
|
27
|
+
* @param {string} titleNoticePosition - Tooltip position for the notice icon.
|
|
28
|
+
* @param {boolean} bigTitle - If true, uses a larger font size for the title.
|
|
29
|
+
* @param {boolean} transparentTitle - If true, the title has a transparent background.
|
|
30
|
+
* @param {string} copyButtonText - The text for the copy button.
|
|
31
|
+
* @param {string} copyButtonContent - The content to be copied to the clipboard.
|
|
32
|
+
* @param {string} copyButtonTooltipContent - Tooltip content displayed after copying.
|
|
33
|
+
*/
|
|
34
|
+
export const TitleBox = ({
|
|
35
|
+
title = "",
|
|
36
|
+
linkText = "",
|
|
37
|
+
linkButtonClick = (resetButtonLoader) => {},
|
|
38
|
+
isLinkButtonDisabled = false,
|
|
39
|
+
children,
|
|
40
|
+
linkButtonLoader = false,
|
|
41
|
+
fullWidth = true,
|
|
42
|
+
titleNoticeText = "",
|
|
43
|
+
titleNoticeIcon,
|
|
44
|
+
titleNoticePosition,
|
|
45
|
+
bigTitle = false,
|
|
46
|
+
transparentTitle = false,
|
|
47
|
+
copyButtonText,
|
|
48
|
+
copyButtonContent,
|
|
49
|
+
copyButtonTooltipContent,
|
|
50
|
+
}) => {
|
|
51
|
+
const handleError = useCallHandlingErrors();
|
|
52
|
+
|
|
53
|
+
const transparentTitleClass = transparentTitle
|
|
54
|
+
? s["transparent-title"]
|
|
55
|
+
: "";
|
|
56
|
+
|
|
57
|
+
const [showCopyNotice, setShowCopyNotice] = useState(false);
|
|
58
|
+
|
|
59
|
+
const handleCopyButton = (e) => {
|
|
60
|
+
handleError(() => {
|
|
61
|
+
setShowCopyNotice(true);
|
|
62
|
+
copyBrowserTextToClipboard(copyButtonContent);
|
|
63
|
+
setTimeout(() => {
|
|
64
|
+
setShowCopyNotice(false);
|
|
65
|
+
}, 1500);
|
|
66
|
+
}, e);
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
return (
|
|
70
|
+
<div
|
|
71
|
+
className={`${s["title-box"]} ${fullWidth ? s["full-width"] : ""}`}
|
|
72
|
+
>
|
|
73
|
+
{title || titleNoticeText || linkText ? (
|
|
74
|
+
<div className={s["title-box-wrapper"]}>
|
|
75
|
+
{bigTitle ? (
|
|
76
|
+
<h5
|
|
77
|
+
className={
|
|
78
|
+
s["title-box-wrapper-title"] +
|
|
79
|
+
" " +
|
|
80
|
+
transparentTitleClass
|
|
81
|
+
}
|
|
82
|
+
>
|
|
83
|
+
{title}
|
|
84
|
+
</h5>
|
|
85
|
+
) : (
|
|
86
|
+
<h6
|
|
87
|
+
className={
|
|
88
|
+
s["title-box-wrapper-title"] +
|
|
89
|
+
" " +
|
|
90
|
+
transparentTitleClass
|
|
91
|
+
}
|
|
92
|
+
>
|
|
93
|
+
{title}
|
|
94
|
+
</h6>
|
|
95
|
+
)}
|
|
96
|
+
{titleNoticeText ? (
|
|
97
|
+
<NoticeIcon
|
|
98
|
+
noticeText={titleNoticeText}
|
|
99
|
+
titleNoticeIcon={titleNoticeIcon}
|
|
100
|
+
tooltipPosition={titleNoticePosition}
|
|
101
|
+
/>
|
|
102
|
+
) : null}
|
|
103
|
+
{copyButtonContent && copyButtonText ? (
|
|
104
|
+
<div className={s["title-box-wrapper-link-button"]}>
|
|
105
|
+
<LinkButton
|
|
106
|
+
content={copyButtonText}
|
|
107
|
+
onClick={handleCopyButton}
|
|
108
|
+
isLoadable={false}
|
|
109
|
+
isDisabled={false}
|
|
110
|
+
/>
|
|
111
|
+
<Tooltip
|
|
112
|
+
position={TOOLTIP_POSITIONS.TOP_LEFT}
|
|
113
|
+
showTooltip={showCopyNotice}
|
|
114
|
+
>
|
|
115
|
+
{copyButtonTooltipContent}
|
|
116
|
+
</Tooltip>
|
|
117
|
+
</div>
|
|
118
|
+
) : linkText ? (
|
|
119
|
+
<div className={s["title-box-wrapper-link-button"]}>
|
|
120
|
+
<LinkButton
|
|
121
|
+
content={linkText}
|
|
122
|
+
onClick={linkButtonClick}
|
|
123
|
+
isLoadable={linkButtonLoader}
|
|
124
|
+
isDisabled={isLinkButtonDisabled}
|
|
125
|
+
/>
|
|
126
|
+
</div>
|
|
127
|
+
) : null}
|
|
128
|
+
</div>
|
|
129
|
+
) : null}
|
|
130
|
+
{children}
|
|
131
|
+
</div>
|
|
132
|
+
);
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
TitleBox.propTypes = {
|
|
136
|
+
title: PropTypes.string,
|
|
137
|
+
linkText: PropTypes.string,
|
|
138
|
+
linkButtonClick: PropTypes.func,
|
|
139
|
+
isLinkButtonDisabled: PropTypes.bool,
|
|
140
|
+
children: PropTypes.node,
|
|
141
|
+
linkButtonLoader: PropTypes.bool,
|
|
142
|
+
fullWidth: PropTypes.bool,
|
|
143
|
+
titleNoticeText: PropTypes.string,
|
|
144
|
+
titleNoticeIcon: PropTypes.string,
|
|
145
|
+
titleNoticePosition: PropTypes.string,
|
|
146
|
+
bigTitle: PropTypes.bool,
|
|
147
|
+
transparentTitle: PropTypes.bool,
|
|
148
|
+
copyButtonText: PropTypes.string,
|
|
149
|
+
copyButtonContent: PropTypes.string,
|
|
150
|
+
copyButtonTooltipContent: PropTypes.string,
|
|
151
|
+
};
|
|
152
|
+
|
|
153
|
+
TitleBox.defaultProps = {
|
|
154
|
+
title: "",
|
|
155
|
+
linkText: "",
|
|
156
|
+
linkButtonClick: () => {},
|
|
157
|
+
isLinkButtonDisabled: false,
|
|
158
|
+
linkButtonLoader: false,
|
|
159
|
+
fullWidth: true,
|
|
160
|
+
titleNoticeText: "",
|
|
161
|
+
titleNoticePosition: TOOLTIP_POSITIONS.TOP,
|
|
162
|
+
bigTitle: false,
|
|
163
|
+
transparentTitle: false,
|
|
164
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
@import "../../../../styles/index";
|
|
2
|
+
|
|
3
|
+
.title-box {
|
|
4
|
+
&.full-width {
|
|
5
|
+
width: 100%;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
&-wrapper {
|
|
9
|
+
width: 100%;
|
|
10
|
+
display: flex;
|
|
11
|
+
align-items: center;
|
|
12
|
+
justify-content: space-between;
|
|
13
|
+
flex-grow: 1;
|
|
14
|
+
margin-bottom: Margin("1");
|
|
15
|
+
gap: Margin("2");
|
|
16
|
+
min-height: 26px;
|
|
17
|
+
|
|
18
|
+
&-title {
|
|
19
|
+
color: SolidColor("grey");
|
|
20
|
+
font-weight: $semi-bold;
|
|
21
|
+
&.transparent-title {
|
|
22
|
+
color: rgba($white, 0.2);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
&-link-button {
|
|
27
|
+
position: relative;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { CSSTransition } from "react-transition-group";
|
|
3
|
+
import PropTypes from "prop-types";
|
|
4
|
+
|
|
5
|
+
import s from "./tooltip.module.scss";
|
|
6
|
+
import DarkRectangle from "../../../assets/wrappedImages/darkRectangle.jsx";
|
|
7
|
+
|
|
8
|
+
import { useCallHandlingErrors } from "../../hooks/useCallHandlingErrors.js";
|
|
9
|
+
import { TOOLTIP_POSITIONS } from "../../../constants/atoms/Tooltip/tooltip.jsx";
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Tooltip component for displaying contextual information.
|
|
13
|
+
*
|
|
14
|
+
* @component
|
|
15
|
+
* @param {React.ReactNode} children - The content to display inside the tooltip.
|
|
16
|
+
* @param {boolean} showTooltip - Controls whether the tooltip is visible.
|
|
17
|
+
* @param {Function} handleClick - Handler for click events.
|
|
18
|
+
* @param {boolean} wide - If true, applies a wider style to the tooltip.
|
|
19
|
+
* @param {string} position - One of the predefined positions for the tooltip.
|
|
20
|
+
* @param {boolean} ignorePointerEvents - If true, the tooltip will not react to pointer events.
|
|
21
|
+
*/
|
|
22
|
+
export const Tooltip = ({
|
|
23
|
+
children,
|
|
24
|
+
showTooltip,
|
|
25
|
+
handleClick = () => {},
|
|
26
|
+
wide = false,
|
|
27
|
+
position = TOOLTIP_POSITIONS.TOP,
|
|
28
|
+
ignorePointerEvents = false,
|
|
29
|
+
}) => {
|
|
30
|
+
const handleError = useCallHandlingErrors();
|
|
31
|
+
|
|
32
|
+
const onClick = (e) => {
|
|
33
|
+
e.stopPropagation();
|
|
34
|
+
handleClick();
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
return (
|
|
38
|
+
<CSSTransition in={showTooltip} timeout={400} unmountOnExit>
|
|
39
|
+
<span
|
|
40
|
+
className={`${s["tooltip"]} ${wide ? s["wide"] : ""} ${
|
|
41
|
+
s[position]
|
|
42
|
+
} ${ignorePointerEvents ? s["ignore-pointer"] : ""}`}
|
|
43
|
+
onClick={(e) => handleError(onClick, e)}
|
|
44
|
+
onDoubleClick={(e) =>
|
|
45
|
+
handleError((e) => e.stopPropagation(), e)
|
|
46
|
+
}
|
|
47
|
+
>
|
|
48
|
+
<DarkRectangle />
|
|
49
|
+
{/*<img src={darkRectangle} alt="dark rectangle" />*/}
|
|
50
|
+
{children}
|
|
51
|
+
</span>
|
|
52
|
+
</CSSTransition>
|
|
53
|
+
);
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
Tooltip.propTypes = {
|
|
57
|
+
children: PropTypes.node.isRequired,
|
|
58
|
+
showTooltip: PropTypes.bool.isRequired,
|
|
59
|
+
handleClick: PropTypes.func,
|
|
60
|
+
wide: PropTypes.bool,
|
|
61
|
+
position: PropTypes.oneOf(Object.values(TOOLTIP_POSITIONS)),
|
|
62
|
+
ignorePointerEvents: PropTypes.bool,
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
Tooltip.defaultProps = {
|
|
66
|
+
handleClick: () => {},
|
|
67
|
+
wide: false,
|
|
68
|
+
position: TOOLTIP_POSITIONS.TOP,
|
|
69
|
+
ignorePointerEvents: false,
|
|
70
|
+
};
|