@rabbitio/ui-kit 1.0.0-beta.7 → 1.0.0-beta.70
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 +11536 -0
- package/coverage/coverage-final.json +100 -0
- package/coverage/favicon.png +0 -0
- package/coverage/index.html +986 -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/assets/wrappedImages/arrowIcon.jsx.html +124 -0
- package/coverage/rabbit-ui-kit/src/assets/wrappedImages/arrowTosca.jsx.html +127 -0
- package/coverage/rabbit-ui-kit/src/assets/wrappedImages/arrowWhite.jsx.html +127 -0
- package/coverage/rabbit-ui-kit/src/assets/wrappedImages/darkRectangle.jsx.html +106 -0
- package/coverage/rabbit-ui-kit/src/assets/wrappedImages/determinedError.jsx.html +439 -0
- package/coverage/rabbit-ui-kit/src/assets/wrappedImages/failedValidationIcon.jsx.html +202 -0
- package/coverage/rabbit-ui-kit/src/assets/wrappedImages/index.html +251 -0
- package/coverage/rabbit-ui-kit/src/assets/wrappedImages/infoIcon.jsx.html +133 -0
- package/coverage/rabbit-ui-kit/src/assets/wrappedImages/noticeQuestionIcon.jsx.html +247 -0
- package/coverage/rabbit-ui-kit/src/assets/wrappedImages/successfulValidationIcon.jsx.html +163 -0
- package/coverage/rabbit-ui-kit/src/assets/wrappedImages/walletIcon.jsx.html +151 -0
- package/coverage/rabbit-ui-kit/src/common/adapters/axiosAdapter.js.html +190 -0
- package/coverage/rabbit-ui-kit/src/common/adapters/index.html +131 -0
- package/coverage/rabbit-ui-kit/src/common/adapters/qrUtils.js.html +139 -0
- package/coverage/rabbit-ui-kit/src/common/amountUtils.js.html +1162 -0
- package/coverage/rabbit-ui-kit/src/common/errorUtils.js.html +211 -0
- package/coverage/rabbit-ui-kit/src/common/external-apis/apiGroups.js.html +250 -0
- package/coverage/rabbit-ui-kit/src/common/external-apis/index.html +131 -0
- package/coverage/rabbit-ui-kit/src/common/external-apis/ipAddressProviders.js.html +352 -0
- package/coverage/rabbit-ui-kit/src/common/fiatCurrenciesService.js.html +544 -0
- package/coverage/rabbit-ui-kit/src/common/index.html +146 -0
- package/coverage/rabbit-ui-kit/src/common/models/blockchain.js.html +115 -0
- package/coverage/rabbit-ui-kit/src/common/models/coin.js.html +544 -0
- package/coverage/rabbit-ui-kit/src/common/models/index.html +146 -0
- package/coverage/rabbit-ui-kit/src/common/models/protocol.js.html +100 -0
- package/coverage/rabbit-ui-kit/src/common/utils/cache.js.html +811 -0
- package/coverage/rabbit-ui-kit/src/common/utils/emailAPI.js.html +133 -0
- package/coverage/rabbit-ui-kit/src/common/utils/index.html +161 -0
- package/coverage/rabbit-ui-kit/src/common/utils/logging/index.html +131 -0
- package/coverage/rabbit-ui-kit/src/common/utils/logging/logger.js.html +208 -0
- package/coverage/rabbit-ui-kit/src/common/utils/logging/logsStorage.js.html +268 -0
- package/coverage/rabbit-ui-kit/src/common/utils/postponeExecution.js.html +118 -0
- package/coverage/rabbit-ui-kit/src/common/utils/safeStringify.js.html +235 -0
- package/coverage/rabbit-ui-kit/src/components/atoms/AssetIcon/AssetIcon.jsx.html +247 -0
- package/coverage/rabbit-ui-kit/src/components/atoms/AssetIcon/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/components/atoms/AssetSelection/AssetSelection.jsx.html +286 -0
- package/coverage/rabbit-ui-kit/src/components/atoms/AssetSelection/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/components/atoms/BackgroundTitle/BackgroundTitle.jsx.html +187 -0
- package/coverage/rabbit-ui-kit/src/components/atoms/BackgroundTitle/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/components/atoms/InformationMessage/InformationMessage.jsx.html +235 -0
- package/coverage/rabbit-ui-kit/src/components/atoms/InformationMessage/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/components/atoms/Input/Input.jsx.html +631 -0
- package/coverage/rabbit-ui-kit/src/components/atoms/Input/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/components/atoms/LoadingDots/LoadingDots.jsx.html +196 -0
- package/coverage/rabbit-ui-kit/src/components/atoms/LoadingDots/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/components/atoms/NoticeIcon/NoticeIcon.jsx.html +277 -0
- package/coverage/rabbit-ui-kit/src/components/atoms/NoticeIcon/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/components/atoms/QrCode/QrCode.jsx.html +187 -0
- package/coverage/rabbit-ui-kit/src/components/atoms/QrCode/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/components/atoms/RateSelector/RateSelector.jsx.html +172 -0
- package/coverage/rabbit-ui-kit/src/components/atoms/RateSelector/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/components/atoms/SupportChat/SupportChat.jsx.html +214 -0
- package/coverage/rabbit-ui-kit/src/components/atoms/SupportChat/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/components/atoms/Textarea/Textarea.jsx.html +523 -0
- package/coverage/rabbit-ui-kit/src/components/atoms/Textarea/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/components/atoms/TitleBox/TitleBox.jsx.html +508 -0
- package/coverage/rabbit-ui-kit/src/components/atoms/TitleBox/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/components/atoms/Tooltip/Tooltip.jsx.html +289 -0
- package/coverage/rabbit-ui-kit/src/components/atoms/Tooltip/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/components/atoms/TwoLinesOfText/LinesOfText.jsx.html +307 -0
- package/coverage/rabbit-ui-kit/src/components/atoms/TwoLinesOfText/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/components/atoms/Validation/Validation.jsx.html +208 -0
- package/coverage/rabbit-ui-kit/src/components/atoms/Validation/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/components/atoms/buttons/Button/Button.jsx.html +712 -0
- package/coverage/rabbit-ui-kit/src/components/atoms/buttons/Button/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/components/atoms/buttons/Close/Close.jsx.html +244 -0
- package/coverage/rabbit-ui-kit/src/components/atoms/buttons/Close/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/components/atoms/buttons/LinkButton/LinkButton.jsx.html +403 -0
- package/coverage/rabbit-ui-kit/src/components/atoms/buttons/LinkButton/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/components/atoms/buttons/RadioButtonWithText/RadioButtonWithText.jsx.html +415 -0
- package/coverage/rabbit-ui-kit/src/components/atoms/buttons/RadioButtonWithText/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/components/hooks/index.html +131 -0
- package/coverage/rabbit-ui-kit/src/components/hooks/useCallHandlingErrors.js.html +151 -0
- package/coverage/rabbit-ui-kit/src/components/hooks/useReferredState.js.html +157 -0
- package/coverage/rabbit-ui-kit/src/components/molecules/AmountInput/AmountInput.jsx.html +997 -0
- package/coverage/rabbit-ui-kit/src/components/molecules/AmountInput/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/components/molecules/CoinPicker/CoinPicker.jsx.html +1612 -0
- package/coverage/rabbit-ui-kit/src/components/molecules/CoinPicker/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/components/molecules/LineWithIconLink/LineWithIconLink.jsx.html +190 -0
- package/coverage/rabbit-ui-kit/src/components/molecules/LineWithIconLink/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/components/molecules/TitledLineWithIconLink/TitledLineWithIconLink.jsx.html +175 -0
- package/coverage/rabbit-ui-kit/src/components/molecules/TitledLineWithIconLink/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/components/organisms/CoinPickerDialogStep/CoinPickerDialogStep.jsx.html +277 -0
- package/coverage/rabbit-ui-kit/src/components/organisms/CoinPickerDialogStep/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/components/organisms/Dialog/Dialog.jsx.html +1480 -0
- package/coverage/rabbit-ui-kit/src/components/organisms/Dialog/DialogButtons/DialogButtons.jsx.html +451 -0
- package/coverage/rabbit-ui-kit/src/components/organisms/Dialog/DialogButtons/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/components/organisms/Dialog/DialogStep/DialogStep.jsx.html +1684 -0
- package/coverage/rabbit-ui-kit/src/components/organisms/Dialog/DialogStep/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/components/organisms/Dialog/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/components/organisms/SwapForm/SwapForm.jsx.html +3400 -0
- package/coverage/rabbit-ui-kit/src/components/organisms/SwapForm/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/components/templates/DeterminedErrorDialogStep/DeterminedErrorDialogStep.jsx.html +316 -0
- package/coverage/rabbit-ui-kit/src/components/templates/DeterminedErrorDialogStep/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/components/utils/index.html +161 -0
- package/coverage/rabbit-ui-kit/src/components/utils/inputValueProviders.js.html +235 -0
- package/coverage/rabbit-ui-kit/src/components/utils/textUtils.js.html +139 -0
- package/coverage/rabbit-ui-kit/src/components/utils/uiUtils.js.html +121 -0
- package/coverage/rabbit-ui-kit/src/components/utils/urlQueryUtils.js.html +271 -0
- package/coverage/rabbit-ui-kit/src/constants/atoms/Close/close.jsx.html +100 -0
- package/coverage/rabbit-ui-kit/src/constants/atoms/Close/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/constants/atoms/LinkButton/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/constants/atoms/LinkButton/linkButton.jsx.html +103 -0
- package/coverage/rabbit-ui-kit/src/constants/atoms/Tooltip/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/constants/atoms/Tooltip/tooltip.jsx.html +109 -0
- package/coverage/rabbit-ui-kit/src/constants/globalConstants.jsx.html +94 -0
- package/coverage/rabbit-ui-kit/src/constants/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/constants/organisms/dialog/DialogStep/dialogStep.js.html +88 -0
- package/coverage/rabbit-ui-kit/src/constants/organisms/dialog/DialogStep/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/constants/organisms/dialog/dialog.js.html +172 -0
- package/coverage/rabbit-ui-kit/src/constants/organisms/dialog/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/index.js.html +349 -0
- package/coverage/rabbit-ui-kit/src/robustExteranlApiCallerService/cacheAndConcurrentRequestsResolver.js.html +1570 -0
- package/coverage/rabbit-ui-kit/src/robustExteranlApiCallerService/cachedRobustExternalApiCallerService.js.html +526 -0
- package/coverage/rabbit-ui-kit/src/robustExteranlApiCallerService/cancelProcessing.js.html +172 -0
- package/coverage/rabbit-ui-kit/src/robustExteranlApiCallerService/concurrentCalculationsMetadataHolder.js.html +310 -0
- package/coverage/rabbit-ui-kit/src/robustExteranlApiCallerService/externalApiProvider.js.html +553 -0
- package/coverage/rabbit-ui-kit/src/robustExteranlApiCallerService/externalServicesStatsCollector.js.html +319 -0
- package/coverage/rabbit-ui-kit/src/robustExteranlApiCallerService/index.html +206 -0
- package/coverage/rabbit-ui-kit/src/robustExteranlApiCallerService/robustExternalAPICallerService.js.html +997 -0
- package/coverage/rabbit-ui-kit/src/swaps-lib/external-apis/index.html +131 -0
- package/coverage/rabbit-ui-kit/src/swaps-lib/external-apis/swapProvider.js.html +709 -0
- package/coverage/rabbit-ui-kit/src/swaps-lib/external-apis/swapspaceSwapProvider.js.html +2197 -0
- package/coverage/rabbit-ui-kit/src/swaps-lib/models/baseSwapCreationInfo.js.html +214 -0
- package/coverage/rabbit-ui-kit/src/swaps-lib/models/existingSwap.js.html +304 -0
- package/coverage/rabbit-ui-kit/src/swaps-lib/models/existingSwapWithFiatData.js.html +469 -0
- package/coverage/rabbit-ui-kit/src/swaps-lib/models/index.html +146 -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 +1888 -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 +595 -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 +946 -0
- package/coverage/rabbit-ui-kit/stories/atoms/buttons/Close.stories.jsx.html +214 -0
- package/coverage/rabbit-ui-kit/stories/atoms/buttons/LinkButton.stories.jsx.html +295 -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/LineWithIconLink.stories.jsx.html +154 -0
- package/coverage/rabbit-ui-kit/stories/molecules/TitledLineWithIconLink.stories.jsx.html +160 -0
- package/coverage/rabbit-ui-kit/stories/molecules/index.html +131 -0
- package/coverage/rabbit-ui-kit/stories/organisms/Dialog/Dialog.stories.jsx.html +589 -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/stubs/exampleContent.jsx.html +145 -0
- package/coverage/rabbit-ui-kit/stories/stubs/index.html +116 -0
- package/coverage/rabbit-ui-kit/stories/templates/DeterminedErrorDialogStep.stories.jsx.html +193 -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/index.cjs +10019 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +71418 -1641
- package/dist/index.css.map +1 -1
- package/dist/index.modern.js +7716 -11
- package/dist/index.modern.js.map +1 -1
- package/dist/index.module.js +9939 -11
- package/dist/index.module.js.map +1 -1
- package/dist/index.umd.js +10010 -12
- package/dist/index.umd.js.map +1 -1
- package/index.js +1 -1
- package/package.json +29 -5
- package/src/assets/image/icons/arrow-tosca.svg +3 -0
- package/src/assets/wrappedImages/arrowIcon.jsx +13 -0
- package/src/assets/wrappedImages/arrowTosca.jsx +14 -0
- package/src/assets/wrappedImages/arrowWhite.jsx +14 -0
- package/src/assets/wrappedImages/darkRectangle.jsx +7 -0
- package/src/assets/wrappedImages/determinedError.jsx +118 -0
- package/src/assets/wrappedImages/failedValidationIcon.jsx +39 -0
- package/src/assets/wrappedImages/infoIcon.jsx +16 -0
- package/src/assets/wrappedImages/noticeQuestionIcon.jsx +54 -0
- package/src/assets/wrappedImages/successfulValidationIcon.jsx +26 -0
- package/src/assets/wrappedImages/walletIcon.jsx +22 -0
- package/src/common/adapters/axiosAdapter.js +35 -0
- package/src/common/adapters/qrUtils.js +18 -0
- package/src/common/amountUtils.js +359 -0
- package/src/common/errorUtils.js +42 -0
- package/src/common/external-apis/apiGroups.js +55 -0
- package/src/common/external-apis/ipAddressProviders.js +89 -0
- package/src/common/fiatCurrenciesService.js +153 -0
- package/src/common/models/blockchain.js +10 -0
- package/src/common/models/coin.js +153 -0
- package/src/common/models/protocol.js +5 -0
- package/src/common/tests/amountUtils/composeRateText.test.js +152 -0
- package/src/common/tests/integration/external-apis/ipAddressProviders/getClientIpAddress.test.js +12 -0
- package/src/common/utils/cache.js +242 -0
- package/src/common/utils/emailAPI.js +16 -0
- package/src/common/utils/logging/logger.js +41 -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 +54 -0
- package/{stories → src/components}/atoms/AssetIcon/asset-icon.module.scss +1 -1
- package/src/components/atoms/AssetSelection/AssetSelection.jsx +67 -0
- package/src/components/atoms/AssetSelection/asset-selection.module.scss +56 -0
- package/src/components/atoms/BackgroundTitle/BackgroundTitle.jsx +34 -0
- package/src/components/atoms/BackgroundTitle/background-title.module.scss +52 -0
- package/src/components/atoms/InformationMessage/InformationMessage.jsx +50 -0
- package/src/components/atoms/InformationMessage/information-message.module.scss +38 -0
- package/src/components/atoms/Input/Input.jsx +182 -0
- package/src/components/atoms/Input/input.module.scss +107 -0
- package/{stories → src/components}/atoms/LoadingDots/LoadingDots.jsx +8 -28
- package/{stories → src/components}/atoms/LoadingDots/LoadingDots.module.scss +1 -1
- package/src/components/atoms/NoticeIcon/NoticeIcon.jsx +64 -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 +15 -0
- package/src/components/atoms/RateSelector/RateSelector.jsx +29 -0
- package/src/components/atoms/RateSelector/rate-selector.module.scss +47 -0
- package/{stories/atoms/SupportChat/SupportChat.js → src/components/atoms/SupportChat/SupportChat.jsx} +4 -1
- package/src/components/atoms/Textarea/Textarea.jsx +146 -0
- package/src/components/atoms/Textarea/textarea.module.scss +71 -0
- package/src/components/atoms/TitleBox/TitleBox.jsx +141 -0
- package/src/components/atoms/TitleBox/title-box.module.scss +32 -0
- package/src/components/atoms/Tooltip/Tooltip.jsx +68 -0
- package/src/components/atoms/Tooltip/tooltip.module.scss +237 -0
- package/src/components/atoms/TwoLinesOfText/LinesOfText.jsx +74 -0
- package/src/components/atoms/TwoLinesOfText/lines-of-text.module.scss +65 -0
- package/src/components/atoms/Validation/Validation.jsx +41 -0
- package/src/components/atoms/Validation/validation.module.scss +15 -0
- package/{stories → src/components}/atoms/buttons/Button/Button.jsx +22 -48
- package/{stories → src/components}/atoms/buttons/Button/Button.module.scss +1 -1
- package/src/components/atoms/buttons/Close/Close.jsx +53 -0
- package/src/components/atoms/buttons/Close/close.module.scss +75 -0
- package/src/components/atoms/buttons/LinkButton/LinkButton.jsx +106 -0
- package/src/components/atoms/buttons/LinkButton/link-button.module.scss +49 -0
- package/src/components/atoms/buttons/RadioButtonWithText/RadioButtonWithText.jsx +110 -0
- package/src/components/atoms/buttons/RadioButtonWithText/radio-button-with-text.module.scss +86 -0
- package/src/components/hooks/useCallHandlingErrors.js +22 -0
- package/src/components/hooks/useReferredState.js +24 -0
- package/src/components/molecules/AmountInput/AmountInput.jsx +304 -0
- package/src/components/molecules/AmountInput/amount-input.module.scss +189 -0
- package/src/components/molecules/CoinPicker/CoinPicker.jsx +509 -0
- package/src/components/molecules/CoinPicker/coin-picker.module.scss +207 -0
- package/src/components/molecules/LineWithIconLink/LineWithIconLink.jsx +35 -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 +64 -0
- package/src/components/organisms/Dialog/Dialog.jsx +465 -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 +533 -0
- package/src/components/organisms/Dialog/DialogStep/dialog-step.module.scss +381 -0
- package/src/components/organisms/Dialog/dialog.module.scss +226 -0
- package/src/components/organisms/SwapForm/SwapForm.jsx +1105 -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 +132 -0
- package/src/components/tests/utils/urlQueryUtils/getQueryParameterValues.test.js +65 -0
- package/src/components/tests/utils/urlQueryUtils/saveQueryParameterAndValues.test.js +104 -0
- package/src/components/utils/inputValueProviders.js +50 -0
- package/src/components/utils/textUtils.js +18 -0
- package/src/components/utils/uiUtils.js +12 -0
- package/src/components/utils/urlQueryUtils.js +62 -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 +3 -0
- package/src/constants/organisms/dialog/DialogStep/dialogStep.js +1 -0
- package/src/constants/organisms/dialog/dialog.js +29 -0
- package/src/index.js +88 -0
- package/src/robustExteranlApiCallerService/cacheAndConcurrentRequestsResolver.js +495 -0
- package/src/robustExteranlApiCallerService/cachedRobustExternalApiCallerService.js +147 -0
- package/src/robustExteranlApiCallerService/cancelProcessing.js +29 -0
- package/src/robustExteranlApiCallerService/concurrentCalculationsMetadataHolder.js +75 -0
- package/src/robustExteranlApiCallerService/externalApiProvider.js +156 -0
- package/src/robustExteranlApiCallerService/externalServicesStatsCollector.js +78 -0
- package/src/robustExteranlApiCallerService/robustExternalAPICallerService.js +304 -0
- package/src/robustExteranlApiCallerService/tests/robustExternalAPICallerService/robustExternalAPICallerService/callExternalAPI/_performCallAttempt.test.js +533 -0
- package/src/robustExteranlApiCallerService/tests/robustExternalAPICallerService/robustExternalAPICallerService/callExternalAPI/callExternalAPI.test.js +532 -0
- package/src/robustExteranlApiCallerService/tests/robustExternalAPICallerService/robustExternalAPICallerService/constructor.test.js +19 -0
- package/src/swaps-lib/external-apis/swapProvider.js +208 -0
- package/src/swaps-lib/external-apis/swapspaceSwapProvider.js +704 -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 +128 -0
- package/src/swaps-lib/services/publicSwapService.js +601 -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/getAllSupportedCurrencies.test.js +66 -0
- package/src/swaps-lib/test/external-apis/swapspaceSwapProvider/getDepositCurrencies.test.js +76 -0
- package/src/swaps-lib/test/external-apis/swapspaceSwapProvider/getSwapInfo.test.js +1580 -0
- package/src/swaps-lib/test/external-apis/swapspaceSwapProvider/getWithdrawalCurrencies.test.js +105 -0
- package/src/swaps-lib/test/utils/swapUtils/safeHandleRequestsLimitExceeding.test.js +80 -0
- package/src/swaps-lib/utils/swapUtils.js +170 -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/atoms/AssetIcon/AssetIcon.js +0 -55
- package/stories/index.js +0 -4
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
@import "../../../../styles/index";
|
|
2
|
+
|
|
3
|
+
.tooltip {
|
|
4
|
+
@include typograpy("p");
|
|
5
|
+
font-weight: $medium;
|
|
6
|
+
line-height: 20px;
|
|
7
|
+
padding: Padding("5") Padding("4");
|
|
8
|
+
background: SolidColor("dark");
|
|
9
|
+
position: absolute;
|
|
10
|
+
bottom: calc(100% + 15px);
|
|
11
|
+
left: 50%;
|
|
12
|
+
transform: translateX(-50%);
|
|
13
|
+
color: $white;
|
|
14
|
+
border-radius: $borderRadius;
|
|
15
|
+
z-index: 3;
|
|
16
|
+
display: block;
|
|
17
|
+
min-width: 200px;
|
|
18
|
+
max-width: 300px;
|
|
19
|
+
text-align: center;
|
|
20
|
+
word-wrap: break-word;
|
|
21
|
+
word-break: normal;
|
|
22
|
+
|
|
23
|
+
&.enter {
|
|
24
|
+
opacity: 0;
|
|
25
|
+
transform: translateX(-50%) translateY(10px) scale(0.95);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
&.enter-active,
|
|
29
|
+
&.exit {
|
|
30
|
+
opacity: 1;
|
|
31
|
+
transform: translateX(-50%) translateY(0) scale(1);
|
|
32
|
+
transition: 0.2s all $transitionEaseOut;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
&.exit-active {
|
|
36
|
+
opacity: 0;
|
|
37
|
+
transform: translateX(-50%) translateY(0) scale(1);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
&.top-left {
|
|
41
|
+
transform: none;
|
|
42
|
+
bottom: calc(100% + 15px);
|
|
43
|
+
right: -14px;
|
|
44
|
+
left: auto;
|
|
45
|
+
img,
|
|
46
|
+
svg {
|
|
47
|
+
left: auto;
|
|
48
|
+
right: 0px;
|
|
49
|
+
top: calc(100% - 4px);
|
|
50
|
+
transform: translateX(-40%);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
&.enter {
|
|
54
|
+
opacity: 0;
|
|
55
|
+
transform: translateX(5px) translateY(10px) scale(0.95);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
&.enter-active,
|
|
59
|
+
&.enter-done,
|
|
60
|
+
&.exit {
|
|
61
|
+
opacity: 1;
|
|
62
|
+
transform: translateX(0) translateY(0) scale(1);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
&.exit-active {
|
|
66
|
+
opacity: 0;
|
|
67
|
+
transform: translateX(0) translateY(0) scale(1);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
&.top-right {
|
|
72
|
+
transform: none;
|
|
73
|
+
bottom: calc(100% + 15px);
|
|
74
|
+
left: -14px;
|
|
75
|
+
img,
|
|
76
|
+
svg {
|
|
77
|
+
left: 0px;
|
|
78
|
+
top: calc(100% - 4px);
|
|
79
|
+
transform: translateX(40%);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
&.enter {
|
|
83
|
+
opacity: 0;
|
|
84
|
+
transform: translateX(-5px) translateY(10px) scale(0.95);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
&.enter-active,
|
|
88
|
+
&.enter-done,
|
|
89
|
+
&.exit {
|
|
90
|
+
opacity: 1;
|
|
91
|
+
transform: translateX(0) translateY(0) scale(1);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
&.exit-active {
|
|
95
|
+
opacity: 0;
|
|
96
|
+
transform: translateX(0) translateY(0) scale(1);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
&.left {
|
|
101
|
+
left: auto;
|
|
102
|
+
right: calc(100% + 16px);
|
|
103
|
+
bottom: calc(100% - 4px);
|
|
104
|
+
img,
|
|
105
|
+
svg {
|
|
106
|
+
top: calc(41%);
|
|
107
|
+
left: calc(100% - 7px);
|
|
108
|
+
transform: rotateZ(-90deg);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
&.enter {
|
|
112
|
+
opacity: 0;
|
|
113
|
+
transform: translateX(16px) translateY(50%) scale(0.95);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
&.enter-active,
|
|
117
|
+
&.enter-done,
|
|
118
|
+
&.exit {
|
|
119
|
+
opacity: 1;
|
|
120
|
+
transform: translateX(0) translateY(50%) scale(1);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
&.exit-active {
|
|
124
|
+
opacity: 0;
|
|
125
|
+
transform: translateX(0) translateY(50%) scale(1);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
&.bottom {
|
|
130
|
+
// TODO: [dev] Currently works for RBF form. Not tested in other cases
|
|
131
|
+
bottom: auto;
|
|
132
|
+
top: calc(100% + 16px);
|
|
133
|
+
left: 50%;
|
|
134
|
+
img,
|
|
135
|
+
svg {
|
|
136
|
+
position: absolute;
|
|
137
|
+
top: -12px;
|
|
138
|
+
left: calc(50% - 12px);
|
|
139
|
+
transform: rotateZ(-180deg);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
&.enter {
|
|
143
|
+
opacity: 0;
|
|
144
|
+
transform: translateX(-50%) translateY(-10px) scale(0.95);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
&.enter-active,
|
|
148
|
+
&.enter-done,
|
|
149
|
+
&.exit {
|
|
150
|
+
opacity: 1;
|
|
151
|
+
transform: translateX(-50%) translateY(0) scale(1);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
&.exit-active {
|
|
155
|
+
opacity: 0;
|
|
156
|
+
transform: translateX(-50%) translateY(0) scale(1);
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
&.right {
|
|
161
|
+
// TODO: [dev] Currently works for RBF form. Not tested in other cases
|
|
162
|
+
left: calc(100% + 16px);
|
|
163
|
+
right: auto;
|
|
164
|
+
top: 7px;
|
|
165
|
+
bottom: auto;
|
|
166
|
+
img,
|
|
167
|
+
svg {
|
|
168
|
+
position: absolute;
|
|
169
|
+
top: calc(50% - 6px);
|
|
170
|
+
left: -18px;
|
|
171
|
+
transform: rotateZ(-270deg);
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
&.enter {
|
|
175
|
+
opacity: 0;
|
|
176
|
+
transform: translateX(-16px) translateY(-50%) scale(0.95);
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
&.enter-active,
|
|
180
|
+
&.enter-done,
|
|
181
|
+
&.exit {
|
|
182
|
+
opacity: 1;
|
|
183
|
+
transform: translateX(0) translateY(-50%) scale(1);
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
&.exit-active {
|
|
187
|
+
opacity: 0;
|
|
188
|
+
transform: translateX(0) translateY(-50%) scale(1);
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
&.wide {
|
|
193
|
+
min-width: 300px;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
&.ignore-pointer {
|
|
197
|
+
pointer-events: none;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
&-enter {
|
|
201
|
+
opacity: 0;
|
|
202
|
+
bottom: calc(100% - 10px);
|
|
203
|
+
position: absolute;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
&-enter-active {
|
|
207
|
+
opacity: 1;
|
|
208
|
+
bottom: calc(100% + 15px);
|
|
209
|
+
position: absolute;
|
|
210
|
+
transition: 0.3s;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
&-enter-done {
|
|
214
|
+
bottom: calc(100% + 15px);
|
|
215
|
+
position: absolute;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
&-exit {
|
|
219
|
+
opacity: 1;
|
|
220
|
+
bottom: calc(100% + 15px);
|
|
221
|
+
position: absolute;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
&-exit-active {
|
|
225
|
+
opacity: 0;
|
|
226
|
+
bottom: calc(100% - 10px);
|
|
227
|
+
position: absolute;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
img,
|
|
231
|
+
svg {
|
|
232
|
+
position: absolute;
|
|
233
|
+
top: calc(100% - 1px);
|
|
234
|
+
left: 50%;
|
|
235
|
+
transform: translateX(-50%);
|
|
236
|
+
}
|
|
237
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import PropTypes from "prop-types";
|
|
3
|
+
|
|
4
|
+
import s from "./lines-of-text.module.scss";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Renders up to three lines of text with configurable options for horizontal layout, text wrapping, and breaking.
|
|
8
|
+
* Optionally, displays a default text content centered vertically if provided.
|
|
9
|
+
*
|
|
10
|
+
* @param {string} firstLineText - Text for the first line.
|
|
11
|
+
* @param {string} secondLineText - Text for the second line.
|
|
12
|
+
* @param {string} thirdLineText - Text for the third line.
|
|
13
|
+
* @param {boolean} isHorizontal - If true, displays the text horizontally.
|
|
14
|
+
* @param {string} defaultTextContent - Default text content to display, centered vertically.
|
|
15
|
+
* @param {boolean} isFirstLineTextReducible - If true, the first line text can be reduced.
|
|
16
|
+
* @param {string} firstLineNotReducibleSuffix - Suffix to append to the first line text if not reducible.
|
|
17
|
+
* @param {boolean} wrapFirstLine - If true, allows the first line text to wrap.
|
|
18
|
+
* @param {boolean} breakFirstLine - If true, allows the first line text to break onto the next line.
|
|
19
|
+
*/
|
|
20
|
+
export const LinesOfText = ({
|
|
21
|
+
firstLineText = "",
|
|
22
|
+
secondLineText = "",
|
|
23
|
+
thirdLineText = "",
|
|
24
|
+
isHorizontal = false,
|
|
25
|
+
defaultTextContent = "",
|
|
26
|
+
isFirstLineTextReducible = false,
|
|
27
|
+
firstLineNotReducibleSuffix = "",
|
|
28
|
+
wrapFirstLine = false,
|
|
29
|
+
breakFirstLine = false,
|
|
30
|
+
}) => {
|
|
31
|
+
return defaultTextContent ? (
|
|
32
|
+
<div className={s["centered-vertically"]}>{defaultTextContent}</div>
|
|
33
|
+
) : (
|
|
34
|
+
<div className={isHorizontal ? s["horizontal"] : ""}>
|
|
35
|
+
<h5 className={s["first-line-text"]}>
|
|
36
|
+
<span
|
|
37
|
+
className={`${isFirstLineTextReducible ? s["shorted"] : s["full-text"]} ${
|
|
38
|
+
wrapFirstLine ? " " + s["wrap"] : ""
|
|
39
|
+
} ${breakFirstLine ? " " + s["break"] : ""}`}
|
|
40
|
+
>
|
|
41
|
+
{firstLineText}
|
|
42
|
+
</span>
|
|
43
|
+
{`\u00A0${firstLineNotReducibleSuffix}`}
|
|
44
|
+
</h5>
|
|
45
|
+
{isHorizontal ? <div className={s["line"]} /> : null}
|
|
46
|
+
{secondLineText ? <p className={s["second-line-text"]}>{secondLineText}</p> : null}
|
|
47
|
+
{thirdLineText ? <p className={s["second-line-text"]}>{thirdLineText}</p> : null}
|
|
48
|
+
</div>
|
|
49
|
+
);
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
LinesOfText.propTypes = {
|
|
53
|
+
firstLineText: PropTypes.string,
|
|
54
|
+
secondLineText: PropTypes.string,
|
|
55
|
+
thirdLineText: PropTypes.string,
|
|
56
|
+
isHorizontal: PropTypes.bool,
|
|
57
|
+
defaultTextContent: PropTypes.string,
|
|
58
|
+
isFirstLineTextReducible: PropTypes.bool,
|
|
59
|
+
firstLineNotReducibleSuffix: PropTypes.string,
|
|
60
|
+
wrapFirstLine: PropTypes.bool,
|
|
61
|
+
breakFirstLine: PropTypes.bool,
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
LinesOfText.defaultProps = {
|
|
65
|
+
firstLineText: "",
|
|
66
|
+
secondLineText: "",
|
|
67
|
+
thirdLineText: "",
|
|
68
|
+
isHorizontal: false,
|
|
69
|
+
defaultTextContent: "",
|
|
70
|
+
isFirstLineTextReducible: false,
|
|
71
|
+
firstLineNotReducibleSuffix: "",
|
|
72
|
+
wrapFirstLine: false,
|
|
73
|
+
breakFirstLine: false,
|
|
74
|
+
};
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
@import "../../../../styles/index";
|
|
2
|
+
|
|
3
|
+
.first-line-text {
|
|
4
|
+
display: flex;
|
|
5
|
+
font-weight: $bold;
|
|
6
|
+
white-space: nowrap;
|
|
7
|
+
// font-family: NunitoSans;
|
|
8
|
+
text-align: left;
|
|
9
|
+
|
|
10
|
+
.wrap {
|
|
11
|
+
white-space: normal;
|
|
12
|
+
word-wrap: break-word;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.break {
|
|
16
|
+
word-break: break-all;
|
|
17
|
+
white-space: break-spaces;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.full-text {
|
|
21
|
+
width: 100%;
|
|
22
|
+
display: flex;
|
|
23
|
+
align-items: center;
|
|
24
|
+
gap: Margin("2");
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.shorted {
|
|
28
|
+
word-wrap: unset;
|
|
29
|
+
white-space: nowrap;
|
|
30
|
+
overflow: hidden;
|
|
31
|
+
text-overflow: ellipsis;
|
|
32
|
+
|
|
33
|
+
@media (max-width: $tablet-width) {
|
|
34
|
+
width: auto;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.horizontal {
|
|
40
|
+
display: flex;
|
|
41
|
+
align-items: center;
|
|
42
|
+
|
|
43
|
+
@media (max-width: $phone-width) {
|
|
44
|
+
flex-direction: column;
|
|
45
|
+
align-items: flex-start;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.line {
|
|
49
|
+
width: 20px;
|
|
50
|
+
margin: 0 Margin("3");
|
|
51
|
+
text-align: left;
|
|
52
|
+
// font-family: NunitoSans;
|
|
53
|
+
|
|
54
|
+
@media (max-width: $phone-width) {
|
|
55
|
+
display: none;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.second-line-text {
|
|
61
|
+
color: SolidColor("grey");
|
|
62
|
+
white-space: nowrap;
|
|
63
|
+
text-align: left;
|
|
64
|
+
// font-family: NunitoSans;
|
|
65
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import PropTypes from "prop-types";
|
|
3
|
+
|
|
4
|
+
import s from "./validation.module.scss";
|
|
5
|
+
import SuccessfulValidationIcon from "../../../assets/wrappedImages/successfulValidationIcon";
|
|
6
|
+
import FailedValidationIcon from "../../../assets/wrappedImages/failedValidationIcon";
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Simple validation message with an icon.
|
|
10
|
+
* It shows either a success or failure icon based on the isSuccessAlert prop.
|
|
11
|
+
*
|
|
12
|
+
* @param {Object} props - The component props.
|
|
13
|
+
* @param {string} props.text - The validation message text to display.
|
|
14
|
+
* @param {boolean} props.isSuccessAlert - Determines if the displayed alert is for a success (true) or failure (false).
|
|
15
|
+
*/
|
|
16
|
+
export const Validation = ({ text = "", isSuccessAlert }) => {
|
|
17
|
+
return (
|
|
18
|
+
<div className={s["validation"]}>
|
|
19
|
+
<div>
|
|
20
|
+
{isSuccessAlert ? (
|
|
21
|
+
// <img src={successfulValidationIcon} alt="validation icon" />
|
|
22
|
+
<SuccessfulValidationIcon />
|
|
23
|
+
) : (
|
|
24
|
+
// <img src={failedValidationIcon} alt="validation icon" />
|
|
25
|
+
<FailedValidationIcon />
|
|
26
|
+
)}
|
|
27
|
+
</div>
|
|
28
|
+
<span className={s["validation-text"]}>{text}</span>
|
|
29
|
+
</div>
|
|
30
|
+
);
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
Validation.propTypes = {
|
|
34
|
+
text: PropTypes.string,
|
|
35
|
+
isSuccessAlert: PropTypes.bool.isRequired,
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
Validation.defaultProps = {
|
|
39
|
+
text: "",
|
|
40
|
+
isSuccessAlert: false,
|
|
41
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
@import "../../../../styles/index";
|
|
2
|
+
|
|
3
|
+
.validation {
|
|
4
|
+
display: flex;
|
|
5
|
+
align-items: center;
|
|
6
|
+
margin-top: Margin("3");
|
|
7
|
+
|
|
8
|
+
&-text {
|
|
9
|
+
text-align: left;
|
|
10
|
+
color: SolidColor("sky");
|
|
11
|
+
@extend .ml-2;
|
|
12
|
+
font-size: 14px;
|
|
13
|
+
@extend %text-semibold;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -46,7 +46,7 @@ export const Button = ({
|
|
|
46
46
|
icon = "",
|
|
47
47
|
content = "",
|
|
48
48
|
isDisabled = false,
|
|
49
|
-
setClickTrigger =
|
|
49
|
+
setClickTrigger = p => {},
|
|
50
50
|
isFormSubmittingButton = false,
|
|
51
51
|
bigIcon = false,
|
|
52
52
|
checkmarkOnClick = false,
|
|
@@ -72,7 +72,7 @@ export const Button = ({
|
|
|
72
72
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
73
73
|
}, [isLoading]);
|
|
74
74
|
|
|
75
|
-
const buttonClick =
|
|
75
|
+
const buttonClick = e => {
|
|
76
76
|
if (isLoading || isDisabled) {
|
|
77
77
|
return false;
|
|
78
78
|
}
|
|
@@ -84,7 +84,11 @@ export const Button = ({
|
|
|
84
84
|
}, 2000);
|
|
85
85
|
}
|
|
86
86
|
|
|
87
|
-
e
|
|
87
|
+
if (e?.persist) {
|
|
88
|
+
// Persisting React's SyntheticEvent to be able to use it in any async context
|
|
89
|
+
e.persist();
|
|
90
|
+
}
|
|
91
|
+
|
|
88
92
|
!propagatePrimaryButtonClick && e.stopPropagation();
|
|
89
93
|
if (loader) {
|
|
90
94
|
setIsLoading(true);
|
|
@@ -99,77 +103,47 @@ export const Button = ({
|
|
|
99
103
|
(fullWidthOnMobiles ? ` ${styles["full-width-on-mobiles"]}` : "") +
|
|
100
104
|
(fullWidthOnTablets ? ` ${styles["full-width-on-tablets"]}` : "") +
|
|
101
105
|
(isDisabled ? ` ${styles.disable}` : "") +
|
|
102
|
-
(smallPaddingOnSmallMobiles
|
|
103
|
-
? ` ${styles["small-padding-on-small-mobiles"]}`
|
|
104
|
-
: "");
|
|
106
|
+
(smallPaddingOnSmallMobiles ? ` ${styles["small-padding-on-small-mobiles"]}` : "");
|
|
105
107
|
|
|
106
108
|
return (
|
|
107
109
|
<>
|
|
108
110
|
{isFormSubmittingButton ? <input type="submit" hidden /> : null}
|
|
109
111
|
{to ? (
|
|
110
|
-
<a
|
|
111
|
-
className={classNames}
|
|
112
|
-
onClick={(e) => handleError(buttonClick, e)}
|
|
113
|
-
href={to}
|
|
114
|
-
ref={buttonRef}
|
|
115
|
-
>
|
|
112
|
+
<a className={classNames} onClick={e => handleError(buttonClick, e)} href={to} ref={buttonRef}>
|
|
116
113
|
{icon ? (
|
|
117
|
-
<div
|
|
118
|
-
className={
|
|
119
|
-
styles["button-with-icon"] +
|
|
120
|
-
(bigIcon ? ` ${styles["big-icon"]}` : "")
|
|
121
|
-
}
|
|
122
|
-
>
|
|
114
|
+
<div className={styles["button-with-icon"] + (bigIcon ? ` ${styles["big-icon"]}` : "")}>
|
|
123
115
|
<img src={icon} alt="button icon" />
|
|
124
|
-
<span className={styles["button-with-icon-text"]}>
|
|
125
|
-
{content}
|
|
126
|
-
</span>
|
|
116
|
+
<span className={styles["button-with-icon-text"]}>{content}</span>
|
|
127
117
|
</div>
|
|
128
118
|
) : (
|
|
129
119
|
content
|
|
130
120
|
)}
|
|
131
121
|
</a>
|
|
132
122
|
) : (
|
|
133
|
-
<div
|
|
134
|
-
className={classNames}
|
|
135
|
-
onClick={(e) => handleError(buttonClick, e)}
|
|
136
|
-
ref={buttonRef}
|
|
137
|
-
>
|
|
123
|
+
<div className={classNames} onClick={e => handleError(buttonClick, e)} ref={buttonRef}>
|
|
138
124
|
<div
|
|
139
|
-
className={`${styles["button-primary-dots-wrapper"]} ${
|
|
140
|
-
isLoading && loader ? styles.show : ""
|
|
141
|
-
}`}
|
|
125
|
+
className={`${styles["button-primary-dots-wrapper"]} ${isLoading && loader ? styles.show : ""}`}
|
|
142
126
|
>
|
|
143
|
-
{loader && isLoading ?
|
|
144
|
-
<LoadingDots isColored={mode === "white"} />
|
|
145
|
-
) : null}
|
|
127
|
+
{loader && isLoading ? <LoadingDots isColored={mode === "white"} /> : null}
|
|
146
128
|
</div>
|
|
147
129
|
<div
|
|
148
|
-
className={`${styles["button-success-icon"]} ${
|
|
149
|
-
styles[
|
|
150
|
-
}
|
|
130
|
+
className={`${styles["button-success-icon"]} ${styles[mode]} ${
|
|
131
|
+
isCheckShown ? styles["show"] : ""
|
|
132
|
+
}`}
|
|
151
133
|
></div>
|
|
152
134
|
{icon ? (
|
|
153
135
|
<div
|
|
154
136
|
className={`${styles["button-with-icon"]} ${
|
|
155
|
-
(isLoading && loader) ||
|
|
156
|
-
(checkmarkOnClick && isCheckShown)
|
|
157
|
-
? styles["hide"]
|
|
158
|
-
: ""
|
|
137
|
+
(isLoading && loader) || (checkmarkOnClick && isCheckShown) ? styles["hide"] : ""
|
|
159
138
|
} ${bigIcon ? styles["big-icon"] : ""}`}
|
|
160
139
|
>
|
|
161
140
|
<img src={icon} alt="button icon" />
|
|
162
|
-
<span className={styles["button-with-icon-text"]}>
|
|
163
|
-
{content}
|
|
164
|
-
</span>
|
|
141
|
+
<span className={styles["button-with-icon-text"]}>{content}</span>
|
|
165
142
|
</div>
|
|
166
143
|
) : (
|
|
167
144
|
<span
|
|
168
145
|
className={`${styles["button-text"]} ${
|
|
169
|
-
(isLoading && loader) ||
|
|
170
|
-
(checkmarkOnClick && isCheckShown)
|
|
171
|
-
? styles["hide"]
|
|
172
|
-
: ""
|
|
146
|
+
(isLoading && loader) || (checkmarkOnClick && isCheckShown) ? styles["hide"] : ""
|
|
173
147
|
}`}
|
|
174
148
|
>
|
|
175
149
|
{content}
|
|
@@ -225,11 +199,11 @@ Button.defaultProps = {
|
|
|
225
199
|
icon: "",
|
|
226
200
|
content: "",
|
|
227
201
|
isDisabled: false,
|
|
228
|
-
setClickTrigger:
|
|
202
|
+
setClickTrigger: p => {},
|
|
229
203
|
isFormSubmittingButton: false,
|
|
230
204
|
bigIcon: false,
|
|
231
205
|
checkmarkOnClick: false,
|
|
232
206
|
propagatePrimaryButtonClick: true,
|
|
233
207
|
smallPaddingOnSmallMobiles: false,
|
|
234
|
-
handleError:
|
|
208
|
+
handleError: func => func(),
|
|
235
209
|
};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import PropTypes from "prop-types";
|
|
3
|
+
|
|
4
|
+
import s from "./close.module.scss";
|
|
5
|
+
|
|
6
|
+
import { useCallHandlingErrors } from "../../../hooks/useCallHandlingErrors";
|
|
7
|
+
import { CLOSE_COLORS } from "../../../../constants/atoms/Close/close";
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* A component for rendering a close icon that handles errors on click.
|
|
11
|
+
* This component uses an SVG to render the icon and allows customization
|
|
12
|
+
* through props for color, size, and the click event handling.
|
|
13
|
+
*
|
|
14
|
+
* @param {Object} props - The properties passed to the component.
|
|
15
|
+
* @param {string} props.color - The color theme of the close icon.
|
|
16
|
+
* Should be one of the properties of CLOSE_COLORS.
|
|
17
|
+
* @param {Function} props.onClick - The function to call when the icon is clicked.
|
|
18
|
+
* @param {boolean} props.large - Whether the icon should be displayed in a larger size.
|
|
19
|
+
*/
|
|
20
|
+
export const Close = ({ color = CLOSE_COLORS.WHITE, onClick = () => {}, large = false }) => {
|
|
21
|
+
const callHandlingErrors = useCallHandlingErrors();
|
|
22
|
+
|
|
23
|
+
return (
|
|
24
|
+
<svg
|
|
25
|
+
className={s["close"] + " " + s[color] + (large ? " " + s["large"] : "")}
|
|
26
|
+
onClick={e => callHandlingErrors(onClick, e)}
|
|
27
|
+
style={{ cursor: "pointer" }}
|
|
28
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
29
|
+
viewBox={`0 0 50 50`}
|
|
30
|
+
x="0px"
|
|
31
|
+
y="0px"
|
|
32
|
+
>
|
|
33
|
+
<path
|
|
34
|
+
d="M28.228,23.986L47.092,5.122c1.172-1.171,1.172-3.071,0-4.242c-1.172-1.172-3.07-1.172-4.242,0L23.986,19.744L5.121,0.88
|
|
35
|
+
c-1.172-1.172-3.07-1.172-4.242,0c-1.172,1.171-1.172,3.071,0,4.242l18.865,18.864L0.879,42.85c-1.172,1.171-1.172,3.071,0,4.242
|
|
36
|
+
C1.465,47.677,2.233,47.97,3,47.97s1.535-0.293,2.121-0.879l18.865-18.864L42.85,47.091c0.586,0.586,1.354,0.879,2.121,0.879
|
|
37
|
+
s1.535-0.293,2.121-0.879c1.172-1.171,1.172-3.071,0-4.242L28.228,23.986z"
|
|
38
|
+
/>
|
|
39
|
+
</svg>
|
|
40
|
+
);
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
Close.propTypes = {
|
|
44
|
+
color: PropTypes.oneOf(Object.values(CLOSE_COLORS)),
|
|
45
|
+
onClick: PropTypes.func,
|
|
46
|
+
large: PropTypes.bool,
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
Close.defaultProps = {
|
|
50
|
+
color: CLOSE_COLORS.WHITE,
|
|
51
|
+
onClick: () => {},
|
|
52
|
+
large: false,
|
|
53
|
+
};
|