@rabbitio/ui-kit 1.0.0-beta.9 → 1.0.0-beta.91
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.gitlab-ci.yml +29 -0
- package/.husky/commit-msg +19 -0
- package/.husky/pre-push +1 -0
- package/CHANGELOG.md +0 -0
- package/README.md +27 -18
- package/coverage/base.css +224 -0
- package/coverage/block-navigation.js +87 -0
- package/coverage/clover.xml +16765 -0
- package/coverage/coverage-final.json +116 -0
- package/coverage/favicon.png +0 -0
- package/coverage/index.html +1001 -0
- package/coverage/prettify.css +1 -0
- package/coverage/prettify.js +2 -0
- package/coverage/rabbit-ui-kit/index.html +116 -0
- package/coverage/rabbit-ui-kit/index.js.html +88 -0
- package/coverage/rabbit-ui-kit/src/common-apis/adapters/analyticsAdapters/googleAnalyticsAdapter.js.html +148 -0
- package/coverage/rabbit-ui-kit/src/common-apis/adapters/analyticsAdapters/index.html +146 -0
- package/coverage/rabbit-ui-kit/src/common-apis/adapters/analyticsAdapters/metrikaAdapter.js.html +169 -0
- package/coverage/rabbit-ui-kit/src/common-apis/adapters/analyticsAdapters/mixpanelAdapter.js.html +199 -0
- package/coverage/rabbit-ui-kit/src/common-apis/adapters/axiosAdapter.js.html +190 -0
- package/coverage/rabbit-ui-kit/src/common-apis/adapters/index.html +131 -0
- package/coverage/rabbit-ui-kit/src/common-apis/adapters/qrUtils.js.html +139 -0
- package/coverage/rabbit-ui-kit/src/common-apis/external-apis/apiGroups.js.html +250 -0
- package/coverage/rabbit-ui-kit/src/common-apis/external-apis/emailAPI.js.html +133 -0
- package/coverage/rabbit-ui-kit/src/common-apis/external-apis/index.html +146 -0
- package/coverage/rabbit-ui-kit/src/common-apis/external-apis/ipAddressProviders.js.html +352 -0
- package/coverage/rabbit-ui-kit/src/common-apis/globalConstants.jsx.html +94 -0
- package/coverage/rabbit-ui-kit/src/common-apis/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/common-apis/models/blockchain.js.html +115 -0
- package/coverage/rabbit-ui-kit/src/common-apis/models/coin.js.html +829 -0
- package/coverage/rabbit-ui-kit/src/common-apis/models/index.html +146 -0
- package/coverage/rabbit-ui-kit/src/common-apis/models/protocol.js.html +100 -0
- package/coverage/rabbit-ui-kit/src/common-apis/services/fiatCurrenciesService.js.html +544 -0
- package/coverage/rabbit-ui-kit/src/common-apis/services/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/common-apis/utils/amountUtils.js.html +1162 -0
- package/coverage/rabbit-ui-kit/src/common-apis/utils/cache.js.html +811 -0
- package/coverage/rabbit-ui-kit/src/common-apis/utils/errorUtils.js.html +211 -0
- package/coverage/rabbit-ui-kit/src/common-apis/utils/index.html +191 -0
- package/coverage/rabbit-ui-kit/src/common-apis/utils/logging/index.html +131 -0
- package/coverage/rabbit-ui-kit/src/common-apis/utils/logging/logger.js.html +208 -0
- package/coverage/rabbit-ui-kit/src/common-apis/utils/logging/logsStorage.js.html +268 -0
- package/coverage/rabbit-ui-kit/src/common-apis/utils/postponeExecution.js.html +118 -0
- package/coverage/rabbit-ui-kit/src/common-apis/utils/rabbitTicker.js.html +157 -0
- package/coverage/rabbit-ui-kit/src/common-apis/utils/safeStringify.js.html +235 -0
- package/coverage/rabbit-ui-kit/src/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/index.js.html +376 -0
- package/coverage/rabbit-ui-kit/src/robust-api-caller/cacheAndConcurrentRequestsResolver.js.html +1570 -0
- package/coverage/rabbit-ui-kit/src/robust-api-caller/cachedRobustExternalApiCallerService.js.html +526 -0
- package/coverage/rabbit-ui-kit/src/robust-api-caller/cancelProcessing.js.html +172 -0
- package/coverage/rabbit-ui-kit/src/robust-api-caller/concurrentCalculationsMetadataHolder.js.html +310 -0
- package/coverage/rabbit-ui-kit/src/robust-api-caller/externalApiProvider.js.html +553 -0
- package/coverage/rabbit-ui-kit/src/robust-api-caller/externalServicesStatsCollector.js.html +319 -0
- package/coverage/rabbit-ui-kit/src/robust-api-caller/index.html +206 -0
- package/coverage/rabbit-ui-kit/src/robust-api-caller/robustExternalAPICallerService.js.html +997 -0
- package/coverage/rabbit-ui-kit/src/swaps-lib/external-apis/exolixSwapProvider.js.html +1825 -0
- package/coverage/rabbit-ui-kit/src/swaps-lib/external-apis/index.html +161 -0
- package/coverage/rabbit-ui-kit/src/swaps-lib/external-apis/letsExchangeSwapProvider.js.html +1618 -0
- package/coverage/rabbit-ui-kit/src/swaps-lib/external-apis/swapProvider.js.html +1819 -0
- package/coverage/rabbit-ui-kit/src/swaps-lib/external-apis/swapspaceSwapProvider.js.html +1861 -0
- package/coverage/rabbit-ui-kit/src/swaps-lib/models/baseSwapCreationInfo.js.html +319 -0
- package/coverage/rabbit-ui-kit/src/swaps-lib/models/existingSwap.js.html +514 -0
- package/coverage/rabbit-ui-kit/src/swaps-lib/models/existingSwapWithFiatData.js.html +529 -0
- package/coverage/rabbit-ui-kit/src/swaps-lib/models/index.html +176 -0
- package/coverage/rabbit-ui-kit/src/swaps-lib/models/partner.js.html +166 -0
- package/coverage/rabbit-ui-kit/src/swaps-lib/models/swapProviderCoinInfo.js.html +331 -0
- package/coverage/rabbit-ui-kit/src/swaps-lib/services/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/swaps-lib/services/publicSwapService.js.html +1555 -0
- package/coverage/rabbit-ui-kit/src/swaps-lib/utils/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/swaps-lib/utils/swapUtils.js.html +670 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/assets/wrappedImages/arrowIcon.jsx.html +124 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/assets/wrappedImages/arrowTosca.jsx.html +127 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/assets/wrappedImages/arrowWhite.jsx.html +127 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/assets/wrappedImages/darkRectangle.jsx.html +106 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/assets/wrappedImages/determinedError.jsx.html +439 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/assets/wrappedImages/failedValidationIcon.jsx.html +202 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/assets/wrappedImages/index.html +281 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/assets/wrappedImages/infoIcon.jsx.html +133 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/assets/wrappedImages/messageIcon.jsx.html +346 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/assets/wrappedImages/noticeQuestionIcon.jsx.html +247 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/assets/wrappedImages/successfulValidationIcon.jsx.html +163 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/assets/wrappedImages/supportDialogImage.jsx.html +268 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/assets/wrappedImages/walletIcon.jsx.html +151 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/AssetIcon/AssetIcon.jsx.html +256 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/AssetIcon/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/AssetSelection/AssetSelection.jsx.html +289 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/AssetSelection/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/BackgroundTitle/BackgroundTitle.jsx.html +187 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/BackgroundTitle/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/InformationMessage/InformationMessage.jsx.html +238 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/InformationMessage/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/Input/Input.jsx.html +634 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/Input/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/LoadingDots/LoadingDots.jsx.html +196 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/LoadingDots/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/NoticeIcon/NoticeIcon.jsx.html +277 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/NoticeIcon/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/QrCode/QrCode.jsx.html +217 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/QrCode/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/RateSelector/RateSelector.jsx.html +175 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/RateSelector/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/SupportChat/SupportChat.jsx.html +217 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/SupportChat/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/Textarea/Textarea.jsx.html +529 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/Textarea/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/TitleBox/TitleBox.jsx.html +508 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/TitleBox/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/Tooltip/Tooltip.jsx.html +316 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/Tooltip/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/TwoLinesOfText/LinesOfText.jsx.html +313 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/TwoLinesOfText/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/Validation/Validation.jsx.html +202 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/Validation/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/buttons/Button/Button.jsx.html +712 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/buttons/Button/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/buttons/Close/Close.jsx.html +259 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/buttons/Close/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/buttons/LinkButton/LinkButton.jsx.html +421 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/buttons/LinkButton/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/buttons/RadioButtonWithText/RadioButtonWithText.jsx.html +415 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/buttons/RadioButtonWithText/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/molecules/AmountInput/AmountInput.jsx.html +1429 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/molecules/AmountInput/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/molecules/CoinPicker/CoinPicker.jsx.html +1474 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/molecules/CoinPicker/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/molecules/ColoredNotice/ColoredNotice.jsx.html +211 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/molecules/ColoredNotice/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/molecules/LineWithIconLink/LineWithIconLink.jsx.html +190 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/molecules/LineWithIconLink/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/molecules/LogoCarousel/LogoCarousel.jsx.html +307 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/molecules/LogoCarousel/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/molecules/SearchableCoinsList/SearchableCoinsList.jsx.html +496 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/molecules/SearchableCoinsList/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/molecules/TitledLineWithIconLink/TitledLineWithIconLink.jsx.html +181 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/molecules/TitledLineWithIconLink/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/organisms/CoinPickerDialogStep/CoinPickerDialogStep.jsx.html +283 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/organisms/CoinPickerDialogStep/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/organisms/Dialog/Dialog.jsx.html +1567 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/organisms/Dialog/DialogButtons/DialogButtons.jsx.html +481 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/organisms/Dialog/DialogButtons/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/organisms/Dialog/DialogStep/DialogStep.jsx.html +1747 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/organisms/Dialog/DialogStep/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/organisms/Dialog/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/organisms/SwapForm/SwapForm.jsx.html +4207 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/organisms/SwapForm/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/organisms/WaitlistSubscription/WaitlistSubscription.jsx.html +559 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/organisms/WaitlistSubscription/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/templates/DeterminedErrorDialogStep/DeterminedErrorDialogStep.jsx.html +316 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/templates/DeterminedErrorDialogStep/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/hooks/index.html +146 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/hooks/useCallHandlingErrors.js.html +151 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/hooks/useIsHydrated.js.html +121 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/hooks/useReferredState.js.html +157 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/utils/index.html +161 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/utils/inputValueProviders.js.html +235 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/utils/textUtils.js.html +139 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/utils/uiUtils.js.html +121 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/utils/urlQueryUtils.js.html +271 -0
- package/coverage/rabbit-ui-kit/stories/atoms/BackgroundTitle.stories.jsx.html +202 -0
- package/coverage/rabbit-ui-kit/stories/atoms/LinesOfText.stories.jsx.html +283 -0
- package/coverage/rabbit-ui-kit/stories/atoms/LoadingDots.stories.jsx.html +226 -0
- package/coverage/rabbit-ui-kit/stories/atoms/QrCode.stories.jsx.html +175 -0
- package/coverage/rabbit-ui-kit/stories/atoms/RateSelector.stories.jsx.html +136 -0
- package/coverage/rabbit-ui-kit/stories/atoms/Validation.stories.jsx.html +178 -0
- package/coverage/rabbit-ui-kit/stories/atoms/buttons/Button.stories.jsx.html +883 -0
- package/coverage/rabbit-ui-kit/stories/atoms/buttons/Close.stories.jsx.html +211 -0
- package/coverage/rabbit-ui-kit/stories/atoms/buttons/LinkButton.stories.jsx.html +301 -0
- package/coverage/rabbit-ui-kit/stories/atoms/buttons/index.html +146 -0
- package/coverage/rabbit-ui-kit/stories/atoms/index.html +191 -0
- package/coverage/rabbit-ui-kit/stories/molecules/AmountInput.stories.jsx.html +289 -0
- package/coverage/rabbit-ui-kit/stories/molecules/CoinPicker.stories.jsx.html +322 -0
- package/coverage/rabbit-ui-kit/stories/molecules/ColoredNotice.stories.jsx.html +178 -0
- package/coverage/rabbit-ui-kit/stories/molecules/LineWithIconLink.stories.jsx.html +154 -0
- package/coverage/rabbit-ui-kit/stories/molecules/LogoCarousel.stories.jsx.html +235 -0
- package/coverage/rabbit-ui-kit/stories/molecules/TitledLineWithIconLink.stories.jsx.html +160 -0
- package/coverage/rabbit-ui-kit/stories/molecules/index.html +191 -0
- package/coverage/rabbit-ui-kit/stories/organisms/Dialog/Dialog.stories.jsx.html +523 -0
- package/coverage/rabbit-ui-kit/stories/organisms/Dialog/DialogButtons/DialogButtons.stories.jsx.html +328 -0
- package/coverage/rabbit-ui-kit/stories/organisms/Dialog/DialogButtons/index.html +116 -0
- package/coverage/rabbit-ui-kit/stories/organisms/Dialog/DialogStep/DialogStep.stories.jsx.html +337 -0
- package/coverage/rabbit-ui-kit/stories/organisms/Dialog/DialogStep/index.html +116 -0
- package/coverage/rabbit-ui-kit/stories/organisms/Dialog/index.html +116 -0
- package/coverage/rabbit-ui-kit/stories/organisms/WaitlistSubscription.stories.jsx.html +151 -0
- package/coverage/rabbit-ui-kit/stories/organisms/index.html +116 -0
- package/coverage/rabbit-ui-kit/stories/stubs/coins.jsx.html +6880 -0
- package/coverage/rabbit-ui-kit/stories/stubs/exampleContent.jsx.html +145 -0
- package/coverage/rabbit-ui-kit/stories/stubs/index.html +131 -0
- package/coverage/rabbit-ui-kit/stories/templates/DeterminedErrorDialogStep.stories.jsx.html +190 -0
- package/coverage/rabbit-ui-kit/stories/templates/index.html +116 -0
- package/coverage/sort-arrow-sprite.png +0 -0
- package/coverage/sorter.js +196 -0
- package/dist/global.css +197 -0
- package/dist/global.css.map +1 -0
- package/dist/index.cjs +12451 -25
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +2339 -8491
- package/dist/index.css.map +1 -1
- package/dist/index.modern.js +9597 -26
- package/dist/index.modern.js.map +1 -1
- package/dist/index.module.js +12357 -27
- package/dist/index.module.js.map +1 -1
- package/dist/index.umd.js +12442 -29
- package/dist/index.umd.js.map +1 -1
- package/package.json +35 -9
- package/raw +1000 -0
- package/src/common-apis/adapters/analyticsAdapters/googleAnalyticsAdapter.js +21 -0
- package/src/common-apis/adapters/analyticsAdapters/metrikaAdapter.js +28 -0
- package/src/common-apis/adapters/analyticsAdapters/mixpanelAdapter.js +38 -0
- package/src/common-apis/adapters/axiosAdapter.js +35 -0
- package/src/common-apis/adapters/qrUtils.js +18 -0
- package/src/common-apis/external-apis/apiGroups.js +55 -0
- package/src/common-apis/external-apis/emailAPI.js +16 -0
- package/src/common-apis/external-apis/ipAddressProviders.js +89 -0
- package/src/common-apis/globalConstants.jsx +3 -0
- package/src/common-apis/models/blockchain.js +10 -0
- package/src/common-apis/models/coin.js +248 -0
- package/src/common-apis/models/protocol.js +5 -0
- package/src/{common → common-apis/services}/fiatCurrenciesService.js +4 -12
- package/src/common-apis/tests/integration/external-apis/ipAddressProviders/getClientIpAddress.test.js +12 -0
- package/src/common-apis/tests/units/utils/amountUtils/composeRateText.test.js +152 -0
- package/src/{common → common-apis/utils}/amountUtils.js +72 -136
- package/src/common-apis/utils/cache.js +242 -0
- package/src/{common → common-apis/utils}/errorUtils.js +15 -0
- package/src/common-apis/utils/logging/logger.js +41 -0
- package/src/common-apis/utils/logging/logsStorage.js +61 -0
- package/src/common-apis/utils/postponeExecution.js +11 -0
- package/src/common-apis/utils/rabbitTicker.js +24 -0
- package/src/common-apis/utils/safeStringify.js +50 -0
- package/src/index.js +96 -9
- package/src/robust-api-caller/cacheAndConcurrentRequestsResolver.js +495 -0
- package/src/robust-api-caller/cachedRobustExternalApiCallerService.js +147 -0
- package/src/robust-api-caller/cancelProcessing.js +29 -0
- package/src/robust-api-caller/concurrentCalculationsMetadataHolder.js +75 -0
- package/src/robust-api-caller/externalApiProvider.js +156 -0
- package/src/robust-api-caller/externalServicesStatsCollector.js +78 -0
- package/src/robust-api-caller/robustExternalAPICallerService.js +304 -0
- package/src/robust-api-caller/tests/robustExternalAPICallerService/robustExternalAPICallerService/callExternalAPI/_performCallAttempt.test.js +533 -0
- package/src/robust-api-caller/tests/robustExternalAPICallerService/robustExternalAPICallerService/callExternalAPI/callExternalAPI.test.js +532 -0
- package/src/robust-api-caller/tests/robustExternalAPICallerService/robustExternalAPICallerService/constructor.test.js +19 -0
- package/src/swaps-lib/external-apis/exolixSwapProvider.js +580 -0
- package/src/swaps-lib/external-apis/letsExchangeSwapProvider.js +511 -0
- package/src/swaps-lib/external-apis/swapProvider.js +578 -0
- package/src/swaps-lib/external-apis/swapspaceSwapProvider.js +592 -0
- package/src/swaps-lib/models/baseSwapCreationInfo.js +78 -0
- package/src/swaps-lib/models/existingSwap.js +143 -0
- package/src/swaps-lib/models/existingSwapWithFiatData.js +148 -0
- package/src/swaps-lib/models/partner.js +27 -0
- package/src/swaps-lib/models/swapProviderCoinInfo.js +82 -0
- package/src/swaps-lib/services/publicSwapService.js +490 -0
- package/src/swaps-lib/test/external-apis/exolixSwapProvider/_fetchSupportedCurrenciesIfNeeded.test.js +34 -0
- package/src/swaps-lib/test/external-apis/exolixSwapProvider/createSwap.test.js +1043 -0
- package/src/swaps-lib/test/external-apis/exolixSwapProvider/getSwapInfo.test.js +611 -0
- package/src/swaps-lib/test/external-apis/swapProvider/getAllSupportedCurrencies.test.js +63 -0
- package/src/swaps-lib/test/external-apis/swapProvider/getDepositCurrencies.test.js +73 -0
- package/src/swaps-lib/test/external-apis/swapProvider/getWithdrawalCurrencies.test.js +102 -0
- package/src/swaps-lib/test/external-apis/swapProvider/removeProtocolNameFromCoinName.test.js +152 -0
- package/src/swaps-lib/test/external-apis/swapspaceSwapProvider/_fetchSupportedCurrenciesIfNeeded.test.js +536 -0
- package/src/swaps-lib/test/external-apis/swapspaceSwapProvider/createSwap.test.js +1214 -0
- package/src/swaps-lib/test/external-apis/swapspaceSwapProvider/getSwapInfo.test.js +1707 -0
- package/src/swaps-lib/test/utils/swapUtils/safeHandleRequestsLimitExceeding.test.js +80 -0
- package/src/swaps-lib/utils/swapUtils.js +195 -0
- package/{styles → src/ui-kit/assets/styles}/_functions.scss +5 -0
- package/{styles → src/ui-kit/assets/styles}/_mixins.scss +2 -2
- package/{styles → src/ui-kit/assets/styles}/_placeholder.scss +3 -3
- package/{styles → src/ui-kit/assets/styles}/_variables.scss +17 -15
- package/src/ui-kit/assets/styles/fonts/NunitoSans-Bold.ttf +0 -0
- package/src/ui-kit/assets/styles/fonts/NunitoSans-ExtraBold.ttf +0 -0
- package/src/ui-kit/assets/styles/fonts/NunitoSans-Light.ttf +0 -0
- package/src/ui-kit/assets/styles/fonts/NunitoSans-Regular.ttf +0 -0
- package/src/ui-kit/assets/styles/fonts/NunitoSans-SemiBold.ttf +0 -0
- package/src/ui-kit/assets/styles/global.scss +171 -0
- package/src/ui-kit/assets/styles/index.scss +10 -0
- package/src/ui-kit/assets/wrappedImages/arrowIcon.jsx +13 -0
- package/src/ui-kit/assets/wrappedImages/arrowTosca.jsx +14 -0
- package/src/ui-kit/assets/wrappedImages/arrowWhite.jsx +14 -0
- package/src/ui-kit/assets/wrappedImages/darkRectangle.jsx +7 -0
- package/src/ui-kit/assets/wrappedImages/determinedError.jsx +118 -0
- package/src/ui-kit/assets/wrappedImages/failedValidationIcon.jsx +39 -0
- package/src/ui-kit/assets/wrappedImages/infoIcon.jsx +16 -0
- package/src/ui-kit/assets/wrappedImages/messageIcon.jsx +87 -0
- package/src/ui-kit/assets/wrappedImages/noticeQuestionIcon.jsx +54 -0
- package/src/ui-kit/assets/wrappedImages/successfulValidationIcon.jsx +26 -0
- package/src/ui-kit/assets/wrappedImages/supportDialogImage.jsx +61 -0
- package/src/ui-kit/assets/wrappedImages/walletIcon.jsx +22 -0
- package/src/ui-kit/components/atoms/AssetIcon/AssetIcon.jsx +57 -0
- package/src/{components → ui-kit/components}/atoms/AssetIcon/asset-icon.module.scss +1 -1
- package/src/ui-kit/components/atoms/AssetSelection/AssetSelection.jsx +68 -0
- package/src/ui-kit/components/atoms/AssetSelection/asset-selection.module.scss +56 -0
- package/src/ui-kit/components/atoms/BackgroundTitle/BackgroundTitle.jsx +34 -0
- package/src/ui-kit/components/atoms/BackgroundTitle/background-title.module.scss +52 -0
- package/src/ui-kit/components/atoms/InformationMessage/InformationMessage.jsx +51 -0
- package/src/ui-kit/components/atoms/InformationMessage/information-message.module.scss +38 -0
- package/src/ui-kit/components/atoms/Input/Input.jsx +183 -0
- package/src/ui-kit/components/atoms/Input/input.module.scss +107 -0
- package/src/{components → ui-kit/components}/atoms/LoadingDots/LoadingDots.jsx +8 -28
- package/src/{components → ui-kit/components}/atoms/LoadingDots/LoadingDots.module.scss +3 -2
- package/src/ui-kit/components/atoms/NoticeIcon/NoticeIcon.jsx +64 -0
- package/src/ui-kit/components/atoms/NoticeIcon/notice-icon.module.scss +14 -0
- package/src/ui-kit/components/atoms/QrCode/QrCode.jsx +44 -0
- package/src/ui-kit/components/atoms/QrCode/qr-code.module.scss +15 -0
- package/src/ui-kit/components/atoms/RateSelector/RateSelector.jsx +30 -0
- package/src/ui-kit/components/atoms/RateSelector/rate-selector.module.scss +47 -0
- package/src/{components → ui-kit/components}/atoms/SupportChat/SupportChat.jsx +5 -1
- package/src/ui-kit/components/atoms/Textarea/Textarea.jsx +148 -0
- package/src/ui-kit/components/atoms/Textarea/textarea.module.scss +71 -0
- package/src/ui-kit/components/atoms/TitleBox/TitleBox.jsx +141 -0
- package/src/ui-kit/components/atoms/TitleBox/title-box.module.scss +32 -0
- package/src/ui-kit/components/atoms/Tooltip/Tooltip.jsx +77 -0
- package/src/ui-kit/components/atoms/Tooltip/tooltip.module.scss +237 -0
- package/src/ui-kit/components/atoms/TwoLinesOfText/LinesOfText.jsx +76 -0
- package/src/ui-kit/components/atoms/TwoLinesOfText/lines-of-text.module.scss +65 -0
- package/src/ui-kit/components/atoms/Validation/Validation.jsx +39 -0
- package/src/ui-kit/components/atoms/Validation/validation.module.scss +19 -0
- package/src/{components → ui-kit/components}/atoms/buttons/Button/Button.jsx +24 -50
- package/src/{components → ui-kit/components}/atoms/buttons/Button/Button.module.scss +1 -1
- package/src/ui-kit/components/atoms/buttons/Close/Close.jsx +58 -0
- package/src/ui-kit/components/atoms/buttons/Close/close.module.scss +75 -0
- package/src/ui-kit/components/atoms/buttons/LinkButton/LinkButton.jsx +112 -0
- package/src/ui-kit/components/atoms/buttons/LinkButton/link-button.module.scss +49 -0
- package/src/ui-kit/components/atoms/buttons/RadioButtonWithText/RadioButtonWithText.jsx +110 -0
- package/src/ui-kit/components/atoms/buttons/RadioButtonWithText/radio-button-with-text.module.scss +86 -0
- package/src/ui-kit/components/molecules/AmountInput/AmountInput.jsx +448 -0
- package/src/ui-kit/components/molecules/AmountInput/amount-input.module.scss +233 -0
- package/src/ui-kit/components/molecules/CoinPicker/CoinPicker.jsx +463 -0
- package/src/ui-kit/components/molecules/CoinPicker/coin-picker.module.scss +207 -0
- package/src/ui-kit/components/molecules/ColoredNotice/ColoredNotice.jsx +42 -0
- package/src/ui-kit/components/molecules/ColoredNotice/colored-notice.module.scss +20 -0
- package/src/ui-kit/components/molecules/LineWithIconLink/LineWithIconLink.jsx +35 -0
- package/src/ui-kit/components/molecules/LineWithIconLink/line-with-icon-link.module.scss +25 -0
- package/src/ui-kit/components/molecules/LogoCarousel/LogoCarousel.jsx +74 -0
- package/src/ui-kit/components/molecules/LogoCarousel/logo-carousel.module.scss +106 -0
- package/src/ui-kit/components/molecules/SearchableCoinsList/SearchableCoinsList.jsx +137 -0
- package/src/ui-kit/components/molecules/TitledLineWithIconLink/TitledLineWithIconLink.jsx +32 -0
- package/src/ui-kit/components/organisms/CoinPickerDialogStep/CoinPickerDialogStep.jsx +66 -0
- package/src/ui-kit/components/organisms/Dialog/Dialog.jsx +494 -0
- package/src/ui-kit/components/organisms/Dialog/DialogButtons/DialogButtons.jsx +132 -0
- package/src/ui-kit/components/organisms/Dialog/DialogButtons/dialog-buttons.module.scss +25 -0
- package/src/ui-kit/components/organisms/Dialog/DialogStep/DialogStep.jsx +554 -0
- package/src/ui-kit/components/organisms/Dialog/DialogStep/dialog-step.module.scss +381 -0
- package/src/ui-kit/components/organisms/Dialog/dialog.module.scss +226 -0
- package/src/ui-kit/components/organisms/SwapForm/SwapForm.jsx +1374 -0
- package/src/ui-kit/components/organisms/SwapForm/swap-form.module.scss +134 -0
- package/src/ui-kit/components/organisms/WaitlistSubscription/WaitlistSubscription.jsx +158 -0
- package/src/ui-kit/components/templates/DeterminedErrorDialogStep/DeterminedErrorDialogStep.jsx +77 -0
- package/src/ui-kit/hooks/useCallHandlingErrors.js +22 -0
- package/src/ui-kit/hooks/useIsHydrated.js +12 -0
- package/src/ui-kit/hooks/useReferredState.js +24 -0
- package/src/ui-kit/tests/utils/inputValueProviders/provideFormatOfFloatValueByInputString.test.js +146 -0
- package/src/ui-kit/tests/utils/urlQueryUtils/getQueryParameterValues.test.js +65 -0
- package/src/ui-kit/tests/utils/urlQueryUtils/saveQueryParameterAndValues.test.js +104 -0
- package/src/ui-kit/utils/inputValueProviders.js +50 -0
- package/src/ui-kit/utils/textUtils.js +18 -0
- package/src/ui-kit/utils/uiUtils.js +12 -0
- package/src/ui-kit/utils/urlQueryUtils.js +62 -0
- package/stories/font.scss +40 -0
- package/stories/stubs/coins.jsx +2266 -0
- package/stories/stubs/exampleContent.jsx +20 -0
- package/src/components/atoms/AssetIcon/AssetIcon.jsx +0 -55
- package/styles/_global-classes.scss +0 -433
- package/styles/fonts/NunitoSans-Bold.ttf +0 -0
- package/styles/fonts/NunitoSans-ExtraBold.ttf +0 -0
- package/styles/fonts/NunitoSans-Light.ttf +0 -0
- package/styles/fonts/NunitoSans-Regular.ttf +0 -0
- package/styles/fonts/NunitoSans-SemiBold.ttf +0 -0
- package/styles/global-styles-index.scss +0 -74
- package/styles/index.scss +0 -33
- /package/{styles → src/ui-kit/assets/styles}/colors/_light-colors.scss +0 -0
- /package/{styles → src/ui-kit/assets/styles}/colors/_solid-colors.scss +0 -0
- /package/{styles → src/ui-kit/assets/styles}/size/_margin-size.scss +0 -0
- /package/{styles → src/ui-kit/assets/styles}/size/_padding-size.scss +0 -0
|
@@ -0,0 +1,494 @@
|
|
|
1
|
+
import React, { useEffect, useRef, useState } from "react";
|
|
2
|
+
import PropTypes from "prop-types";
|
|
3
|
+
import { CSSTransition } from "react-transition-group";
|
|
4
|
+
import AnimateHeight from "react-animate-height";
|
|
5
|
+
import ResizeObserver from "resize-observer-polyfill";
|
|
6
|
+
import { clearAllBodyScrollLocks, disableBodyScroll, enableBodyScroll } from "body-scroll-lock";
|
|
7
|
+
import animateScrollTo from "animated-scroll-to";
|
|
8
|
+
|
|
9
|
+
import { useReferredState } from "../../../hooks/useReferredState.js";
|
|
10
|
+
import { logErrorOrOutputToConsole } from "../../../../common-apis/utils/errorUtils.js";
|
|
11
|
+
|
|
12
|
+
import s from "./dialog.module.scss";
|
|
13
|
+
import { Close } from "../../atoms/buttons/Close/Close.jsx";
|
|
14
|
+
import { DialogButtons } from "./DialogButtons/DialogButtons.jsx";
|
|
15
|
+
|
|
16
|
+
export const DIALOG_SIZES = {
|
|
17
|
+
small: {
|
|
18
|
+
width: "550px",
|
|
19
|
+
height: "650px",
|
|
20
|
+
},
|
|
21
|
+
regular: {
|
|
22
|
+
width: "600px",
|
|
23
|
+
height: "650px",
|
|
24
|
+
},
|
|
25
|
+
large: {
|
|
26
|
+
width: "700px",
|
|
27
|
+
height: "650px",
|
|
28
|
+
},
|
|
29
|
+
largePlus: {
|
|
30
|
+
width: "750px",
|
|
31
|
+
height: "650px",
|
|
32
|
+
},
|
|
33
|
+
largePlusPlus: {
|
|
34
|
+
width: "800px",
|
|
35
|
+
height: "650px",
|
|
36
|
+
},
|
|
37
|
+
extraLarge: {
|
|
38
|
+
width: "1000px",
|
|
39
|
+
height: "650px",
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export const DIALOG_TRANSITION_STEP_DURATION = 200;
|
|
44
|
+
|
|
45
|
+
// If changed - update the prop configuration in the stories and related components.
|
|
46
|
+
/**
|
|
47
|
+
* Flexible modal window component with support for multiple steps. Can be used as an inline component and inserted in regular layouts. Only <DialogStep> components can be passed as children.
|
|
48
|
+
*
|
|
49
|
+
* @component
|
|
50
|
+
* @param {Object} props - Component props.
|
|
51
|
+
* @param {boolean} props.showDialog - Step name, specified on the root dialog level, used as an ID for dialog navigation.
|
|
52
|
+
* @param {string} props.onClose - Handler for when the dialog is closed.
|
|
53
|
+
* @param {string} props.initControls - State-setting function to initialize the dialog-to-step connection.
|
|
54
|
+
* @param {string} props.children - Content of the dialog window, supports only dialog step components.
|
|
55
|
+
* @param {Coin} props.width - Width in pixels, formatted as "1000px" and passed a string. Values should be used from constants.
|
|
56
|
+
* @param {string} props.dispatchDialogOpened - Dispatch upon the dialog closure.
|
|
57
|
+
* @param {string} props.dispatchDialogClosed - Dispatch upon the dialog opening.
|
|
58
|
+
* @param {boolean} props.inline - If false or not set, dialog will be opened as a modal window above the UI. If true, inline mode will be used, making the dialog a regular block, that can be placed inside a regular layout. Default: false.
|
|
59
|
+
* @returns {JSX.Element} React component
|
|
60
|
+
*/
|
|
61
|
+
export const Dialog = ({
|
|
62
|
+
showDialog = false,
|
|
63
|
+
onClose = () => {},
|
|
64
|
+
initControls = null,
|
|
65
|
+
children = [],
|
|
66
|
+
width = "",
|
|
67
|
+
dispatchDialogOpened = () => {},
|
|
68
|
+
dispatchDialogClosed = () => {},
|
|
69
|
+
inline = false,
|
|
70
|
+
}) => {
|
|
71
|
+
const buttonsConfigurationDefault = {
|
|
72
|
+
primaryButtonTitle: null,
|
|
73
|
+
primaryButtonOnClick: null,
|
|
74
|
+
primaryButtonLoader: false,
|
|
75
|
+
primaryButtonTo: null,
|
|
76
|
+
primaryButtonSetClickTrigger: () => {},
|
|
77
|
+
secondaryButtonTitle: null,
|
|
78
|
+
secondaryButtonOnClick: null,
|
|
79
|
+
secondaryButtonTo: null,
|
|
80
|
+
fixedButtonsEnabled: false,
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
const [showDialogProcessed, setShowDialogProcessed] = useState(false);
|
|
84
|
+
const [currentStep, setCurrentStep] = useState(0);
|
|
85
|
+
const [steps, setSteps] = useState(null);
|
|
86
|
+
const [dialogConfiguration, updateDialogConfiguration] = useState({
|
|
87
|
+
cornerBackButtonTitle: "",
|
|
88
|
+
customWidth: width !== "" ? width : DIALOG_SIZES.small.width,
|
|
89
|
+
});
|
|
90
|
+
const [animationConfiguration, updateAnimationConfiguration] = useState({
|
|
91
|
+
animateHeightDelay: DIALOG_TRANSITION_STEP_DURATION * 2,
|
|
92
|
+
animateHeightTransitionSpeed: DIALOG_TRANSITION_STEP_DURATION,
|
|
93
|
+
animateHeightTransitionEnabled: false,
|
|
94
|
+
wrapperWidthAnimationEnabled: false,
|
|
95
|
+
currentStepAnimationEnabled: false,
|
|
96
|
+
cornerBackButtonAnimationEnabled: false,
|
|
97
|
+
triggerAnimationFinishedDispatcher: false,
|
|
98
|
+
dialogContainerOverflowDisabled: false,
|
|
99
|
+
hideMobileBottomButtonSection: false,
|
|
100
|
+
});
|
|
101
|
+
const [stepAnimationFinishedTrigger, setStepAnimationFinishedTrigger] = useState(0);
|
|
102
|
+
const [dialogVerticalHeight, setDialogVerticalHeight] = useState(300);
|
|
103
|
+
const [currentStepRef, setCurrentStepRef] = useState({});
|
|
104
|
+
const [dimensions, setDimensions] = useState({ width: 0, height: 0 });
|
|
105
|
+
const [buttonsConfiguration, updateButtonsConfigurationState] = useState(buttonsConfigurationDefault);
|
|
106
|
+
const [buttonControllingStep, updateButtonControllingStep] = useReferredState("");
|
|
107
|
+
const [isMultiStep, setIsMultiStep] = useState(false);
|
|
108
|
+
|
|
109
|
+
const dialogWrapperRef = useRef();
|
|
110
|
+
const dialogRef = useRef();
|
|
111
|
+
const scrollableRef = useRef();
|
|
112
|
+
const resizeObserverRef = useRef(null);
|
|
113
|
+
|
|
114
|
+
const updateButtonsConfiguration = (newConfiguration, stepName) => {
|
|
115
|
+
if (buttonControllingStep.current === stepName || buttonControllingStep.current === "")
|
|
116
|
+
updateButtonsConfigurationState(newConfiguration);
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
useEffect(() => {
|
|
120
|
+
if (showDialog) disableAnimation();
|
|
121
|
+
setShowDialogProcessed(showDialog);
|
|
122
|
+
showDialog ? dispatchDialogOpened() : dispatchDialogClosed();
|
|
123
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
124
|
+
}, [showDialog]);
|
|
125
|
+
|
|
126
|
+
const showCornerButtonForStep = (stepName, stepButtonShowParam) => {
|
|
127
|
+
if (stepName !== "") {
|
|
128
|
+
let stepNameId = steps.findIndex(step => step.name === stepName);
|
|
129
|
+
return stepButtonShowParam !== null && typeof stepButtonShowParam === "boolean"
|
|
130
|
+
? stepButtonShowParam
|
|
131
|
+
: stepNameId > steps.findIndex(step => step.hidden === false);
|
|
132
|
+
} else {
|
|
133
|
+
return false;
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
const nextStep = (animationControlEnabled = true) => {
|
|
138
|
+
const nextStep = steps.find((step, index) => index > currentStep && step.hidden === false);
|
|
139
|
+
if (nextStep) {
|
|
140
|
+
goToStep(nextStep.name, animationControlEnabled);
|
|
141
|
+
return true;
|
|
142
|
+
} else {
|
|
143
|
+
return false;
|
|
144
|
+
}
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
const previousStep = (animationControlEnabled = true) => {
|
|
148
|
+
const prevSteps = steps
|
|
149
|
+
.map((step, index) => {
|
|
150
|
+
return index < currentStep && step.hidden === false ? step.name : undefined;
|
|
151
|
+
})
|
|
152
|
+
.filter(item => typeof item !== "undefined");
|
|
153
|
+
|
|
154
|
+
if (prevSteps.length > 0) {
|
|
155
|
+
goToStep(prevSteps[prevSteps.length - 1], animationControlEnabled);
|
|
156
|
+
return true;
|
|
157
|
+
} else {
|
|
158
|
+
return false;
|
|
159
|
+
}
|
|
160
|
+
};
|
|
161
|
+
|
|
162
|
+
const getStepClass = stepName => {
|
|
163
|
+
if (steps.length > 1) {
|
|
164
|
+
let stepNameId = steps.findIndex(step => step.name === stepName);
|
|
165
|
+
let stepClass = currentStep > stepNameId ? "prev" : currentStep === stepNameId ? "current" : "next";
|
|
166
|
+
return stepClass;
|
|
167
|
+
} else {
|
|
168
|
+
return "current";
|
|
169
|
+
}
|
|
170
|
+
};
|
|
171
|
+
|
|
172
|
+
const isCurrentStep = stepName => {
|
|
173
|
+
return steps[currentStep].name === stepName;
|
|
174
|
+
};
|
|
175
|
+
|
|
176
|
+
const toFirstStep = (animationControlEnabled = true) => {
|
|
177
|
+
if (animationControlEnabled) enableAnimation();
|
|
178
|
+
setCurrentStep(steps.findIndex(step => step.hidden === false));
|
|
179
|
+
};
|
|
180
|
+
|
|
181
|
+
const goToStep = (stepName, animationControlEnabled = true) => {
|
|
182
|
+
if (animationControlEnabled) enableAnimation();
|
|
183
|
+
try {
|
|
184
|
+
let stepNameId = steps.findIndex(step => step.name === stepName);
|
|
185
|
+
setCurrentStep(stepNameId);
|
|
186
|
+
} catch (e) {
|
|
187
|
+
logErrorOrOutputToConsole(e);
|
|
188
|
+
}
|
|
189
|
+
};
|
|
190
|
+
|
|
191
|
+
const provideCurrentStepRef = ref => {
|
|
192
|
+
setCurrentStepRef(ref);
|
|
193
|
+
};
|
|
194
|
+
|
|
195
|
+
const disableAnimation = (dispatch = false) => {
|
|
196
|
+
updateAnimationConfiguration(prev => {
|
|
197
|
+
return {
|
|
198
|
+
...prev,
|
|
199
|
+
animateHeightTransitionEnabled: false,
|
|
200
|
+
wrapperWidthAnimationEnabled: false,
|
|
201
|
+
currentStepAnimationEnabled: false,
|
|
202
|
+
cornerBackButtonAnimationEnabled: false,
|
|
203
|
+
dialogContainerOverflowDisabled: false,
|
|
204
|
+
hideMobileBottomButtonSection: false,
|
|
205
|
+
};
|
|
206
|
+
});
|
|
207
|
+
if (dispatch) {
|
|
208
|
+
updateAnimationConfiguration(prev => {
|
|
209
|
+
return {
|
|
210
|
+
...prev,
|
|
211
|
+
triggerAnimationFinishedDispatcher: true,
|
|
212
|
+
};
|
|
213
|
+
});
|
|
214
|
+
}
|
|
215
|
+
};
|
|
216
|
+
|
|
217
|
+
useEffect(() => {
|
|
218
|
+
if (animationConfiguration.triggerAnimationFinishedDispatcher) {
|
|
219
|
+
setStepAnimationFinishedTrigger(prev => prev + 1);
|
|
220
|
+
updateAnimationConfiguration(prev => {
|
|
221
|
+
return {
|
|
222
|
+
...prev,
|
|
223
|
+
triggerAnimationFinishedDispatcher: false,
|
|
224
|
+
};
|
|
225
|
+
});
|
|
226
|
+
}
|
|
227
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
228
|
+
}, [animationConfiguration]);
|
|
229
|
+
|
|
230
|
+
const enableAnimation = () => {
|
|
231
|
+
updateAnimationConfiguration(prev => {
|
|
232
|
+
return {
|
|
233
|
+
...prev,
|
|
234
|
+
animateHeightTransitionEnabled: true,
|
|
235
|
+
wrapperWidthAnimationEnabled: true,
|
|
236
|
+
currentStepAnimationEnabled: true,
|
|
237
|
+
cornerBackButtonAnimationEnabled: true,
|
|
238
|
+
dialogContainerOverflowDisabled: true,
|
|
239
|
+
hideMobileBottomButtonSection: true,
|
|
240
|
+
};
|
|
241
|
+
});
|
|
242
|
+
};
|
|
243
|
+
|
|
244
|
+
const scrollDialogToTop = () => {
|
|
245
|
+
animateScrollTo(0, {
|
|
246
|
+
elementToScroll: dialogRef?.current,
|
|
247
|
+
minDuration: DIALOG_TRANSITION_STEP_DURATION,
|
|
248
|
+
maxDuration: DIALOG_TRANSITION_STEP_DURATION,
|
|
249
|
+
});
|
|
250
|
+
animateScrollTo(0, {
|
|
251
|
+
elementToScroll: scrollableRef?.current,
|
|
252
|
+
minDuration: DIALOG_TRANSITION_STEP_DURATION,
|
|
253
|
+
maxDuration: DIALOG_TRANSITION_STEP_DURATION,
|
|
254
|
+
});
|
|
255
|
+
};
|
|
256
|
+
|
|
257
|
+
const clearButtonsConfiguration = () => {
|
|
258
|
+
updateButtonsConfigurationState(buttonsConfigurationDefault);
|
|
259
|
+
};
|
|
260
|
+
|
|
261
|
+
useEffect(() => {
|
|
262
|
+
initControls &&
|
|
263
|
+
initControls(prev => {
|
|
264
|
+
return {
|
|
265
|
+
...prev,
|
|
266
|
+
stepAnimationFinishedTrigger: stepAnimationFinishedTrigger,
|
|
267
|
+
};
|
|
268
|
+
});
|
|
269
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
270
|
+
}, [stepAnimationFinishedTrigger]);
|
|
271
|
+
|
|
272
|
+
useEffect(() => {
|
|
273
|
+
initControls &&
|
|
274
|
+
initControls(prev => {
|
|
275
|
+
return {
|
|
276
|
+
...prev,
|
|
277
|
+
animationConfiguration: animationConfiguration,
|
|
278
|
+
};
|
|
279
|
+
});
|
|
280
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
281
|
+
}, [animationConfiguration]);
|
|
282
|
+
|
|
283
|
+
useEffect(() => {
|
|
284
|
+
if (currentStepRef.current) {
|
|
285
|
+
resizeObserverRef.current = new ResizeObserver((entries = []) => {
|
|
286
|
+
entries.forEach(entry => {
|
|
287
|
+
const { width, height } = entry.contentRect;
|
|
288
|
+
setDimensions({ width, height });
|
|
289
|
+
});
|
|
290
|
+
});
|
|
291
|
+
if (currentStepRef.current) resizeObserverRef.current.observe(currentStepRef.current);
|
|
292
|
+
return () => {
|
|
293
|
+
if (resizeObserverRef.current) resizeObserverRef.current.disconnect();
|
|
294
|
+
};
|
|
295
|
+
}
|
|
296
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
297
|
+
}, [currentStepRef]);
|
|
298
|
+
|
|
299
|
+
useEffect(() => {
|
|
300
|
+
setDialogVerticalHeight(prev => (prev !== 0 && dimensions.height === 0 ? prev : dimensions.height));
|
|
301
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
302
|
+
}, [dimensions]);
|
|
303
|
+
|
|
304
|
+
useEffect(() => {
|
|
305
|
+
const childrenFormatted = children.length > 1 ? children : [children];
|
|
306
|
+
|
|
307
|
+
let stepsArr = childrenFormatted.map(child => {
|
|
308
|
+
return {
|
|
309
|
+
name: child.props.stepName,
|
|
310
|
+
hidden: !!child.props.hidden,
|
|
311
|
+
};
|
|
312
|
+
});
|
|
313
|
+
setSteps(stepsArr);
|
|
314
|
+
|
|
315
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
316
|
+
}, []);
|
|
317
|
+
|
|
318
|
+
useEffect(() => {
|
|
319
|
+
setIsMultiStep(typeof initControls === "function");
|
|
320
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
321
|
+
}, [initControls]);
|
|
322
|
+
|
|
323
|
+
useEffect(() => {
|
|
324
|
+
if (steps)
|
|
325
|
+
initControls &&
|
|
326
|
+
initControls({
|
|
327
|
+
nextStep: nextStep,
|
|
328
|
+
previousStep: previousStep,
|
|
329
|
+
currentStep: currentStep,
|
|
330
|
+
isCurrentStep: isCurrentStep,
|
|
331
|
+
getStepClass: getStepClass,
|
|
332
|
+
updateDialogConfiguration: updateDialogConfiguration,
|
|
333
|
+
toFirstStep: toFirstStep,
|
|
334
|
+
goToStep: goToStep,
|
|
335
|
+
provideCurrentStepRef: provideCurrentStepRef,
|
|
336
|
+
animationConfiguration: animationConfiguration,
|
|
337
|
+
disableAnimation: disableAnimation,
|
|
338
|
+
enableAnimation: enableAnimation,
|
|
339
|
+
showCornerButtonForStep: showCornerButtonForStep,
|
|
340
|
+
stepAnimationFinishedTrigger: stepAnimationFinishedTrigger,
|
|
341
|
+
scrollDialogToTop: scrollDialogToTop,
|
|
342
|
+
updateButtonsConfiguration: updateButtonsConfiguration,
|
|
343
|
+
clearButtonsConfiguration: clearButtonsConfiguration,
|
|
344
|
+
buttonControllingStep: buttonControllingStep.current,
|
|
345
|
+
updateButtonControllingStep: updateButtonControllingStep,
|
|
346
|
+
updateAnimationConfiguration: updateAnimationConfiguration,
|
|
347
|
+
inline: inline,
|
|
348
|
+
});
|
|
349
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
350
|
+
}, [currentStep, steps]);
|
|
351
|
+
|
|
352
|
+
useEffect(() => {
|
|
353
|
+
return () => {
|
|
354
|
+
clearAllBodyScrollLocks();
|
|
355
|
+
updateButtonControllingStep("");
|
|
356
|
+
clearButtonsConfiguration();
|
|
357
|
+
};
|
|
358
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
359
|
+
}, []);
|
|
360
|
+
|
|
361
|
+
return (
|
|
362
|
+
<CSSTransition
|
|
363
|
+
in={showDialogProcessed}
|
|
364
|
+
timeout={DIALOG_TRANSITION_STEP_DURATION}
|
|
365
|
+
classNames={
|
|
366
|
+
inline
|
|
367
|
+
? undefined
|
|
368
|
+
: {
|
|
369
|
+
enter: s["dialog-transition-enter"],
|
|
370
|
+
enterActive: s["dialog-transition-enter-active"],
|
|
371
|
+
exit: s["dialog-transition-exit"],
|
|
372
|
+
exitActive: s["dialog-transition-exit-active"],
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
unmountOnExit
|
|
376
|
+
onExited={() => {
|
|
377
|
+
disableAnimation(false);
|
|
378
|
+
clearButtonsConfiguration();
|
|
379
|
+
updateButtonControllingStep("");
|
|
380
|
+
}}
|
|
381
|
+
onExiting={() => {
|
|
382
|
+
if (inline) return;
|
|
383
|
+
enableBodyScroll(scrollableRef.current);
|
|
384
|
+
enableBodyScroll(dialogRef.current);
|
|
385
|
+
}}
|
|
386
|
+
onEntered={() => {
|
|
387
|
+
if (inline) return;
|
|
388
|
+
disableBodyScroll(scrollableRef.current);
|
|
389
|
+
disableBodyScroll(dialogRef.current);
|
|
390
|
+
}}
|
|
391
|
+
>
|
|
392
|
+
<div
|
|
393
|
+
className={
|
|
394
|
+
s["dialog"] +
|
|
395
|
+
" " +
|
|
396
|
+
(dialogVerticalHeight > 1 || !isMultiStep ? "" : " " + s["hidden"]) +
|
|
397
|
+
(animationConfiguration.dialogContainerOverflowDisabled
|
|
398
|
+
? " " + s["vertical-overflow-disabled"]
|
|
399
|
+
: "") +
|
|
400
|
+
(inline ? " " + s["inline"] : "")
|
|
401
|
+
}
|
|
402
|
+
ref={dialogRef}
|
|
403
|
+
>
|
|
404
|
+
<div className={s["scrollable"] + (inline ? " " + s["inline"] : "")} ref={scrollableRef}>
|
|
405
|
+
<div
|
|
406
|
+
className={
|
|
407
|
+
s["dialog-wrapper"] +
|
|
408
|
+
(animationConfiguration.wrapperWidthAnimationEnabled ? "" : " " + s["animation-disabled"]) +
|
|
409
|
+
(inline ? " " + s["inline"] : "")
|
|
410
|
+
}
|
|
411
|
+
ref={dialogWrapperRef}
|
|
412
|
+
style={
|
|
413
|
+
dialogConfiguration.customWidth !== ""
|
|
414
|
+
? { maxWidth: dialogConfiguration.customWidth }
|
|
415
|
+
: width !== ""
|
|
416
|
+
? { maxWidth: width }
|
|
417
|
+
: null
|
|
418
|
+
}
|
|
419
|
+
>
|
|
420
|
+
<AnimateHeight
|
|
421
|
+
duration={
|
|
422
|
+
animationConfiguration.animateHeightTransitionEnabled
|
|
423
|
+
? animationConfiguration.animateHeightTransitionSpeed
|
|
424
|
+
: 0
|
|
425
|
+
}
|
|
426
|
+
delay={
|
|
427
|
+
animationConfiguration.animateHeightTransitionEnabled
|
|
428
|
+
? animationConfiguration.animateHeightDelay
|
|
429
|
+
: 0
|
|
430
|
+
}
|
|
431
|
+
height={isMultiStep ? dialogVerticalHeight : "auto"}
|
|
432
|
+
contentClassName={s["dialog-wrapper-rah-content"]}
|
|
433
|
+
>
|
|
434
|
+
{inline ? (
|
|
435
|
+
""
|
|
436
|
+
) : (
|
|
437
|
+
<div className={s["dialog-wrapper-close"]}>
|
|
438
|
+
<Close color="dark" onClick={e => onClose()} large />
|
|
439
|
+
</div>
|
|
440
|
+
)}
|
|
441
|
+
{children}
|
|
442
|
+
</AnimateHeight>
|
|
443
|
+
</div>
|
|
444
|
+
</div>
|
|
445
|
+
{
|
|
446
|
+
<CSSTransition
|
|
447
|
+
in={
|
|
448
|
+
(!!buttonsConfiguration.primaryButtonTitle ||
|
|
449
|
+
!!buttonsConfiguration.secondaryButtonTitle) &&
|
|
450
|
+
!animationConfiguration.hideMobileBottomButtonSection &&
|
|
451
|
+
buttonsConfiguration.fixedButtonsEnabled
|
|
452
|
+
}
|
|
453
|
+
timeout={DIALOG_TRANSITION_STEP_DURATION}
|
|
454
|
+
// classNames={s["fixed-buttons-container"]}
|
|
455
|
+
classNames={{
|
|
456
|
+
enter: s["fixed-buttons-container-enter"],
|
|
457
|
+
enterActive: s["fixed-buttons-container-enter-active"],
|
|
458
|
+
enterDone: s["fixed-buttons-container-enter-done"],
|
|
459
|
+
exit: s["fixed-buttons-container-exit"],
|
|
460
|
+
exitActive: s["fixed-buttons-container-exit-active"],
|
|
461
|
+
exitDone: s["fixed-buttons-container-exit-done"],
|
|
462
|
+
}}
|
|
463
|
+
unmountOnExit
|
|
464
|
+
>
|
|
465
|
+
<div className={s["fixed-buttons-container"]}>
|
|
466
|
+
<DialogButtons {...buttonsConfiguration} />
|
|
467
|
+
</div>
|
|
468
|
+
</CSSTransition>
|
|
469
|
+
}
|
|
470
|
+
</div>
|
|
471
|
+
</CSSTransition>
|
|
472
|
+
);
|
|
473
|
+
};
|
|
474
|
+
|
|
475
|
+
Dialog.propTypes = {
|
|
476
|
+
showDialog: PropTypes.bool,
|
|
477
|
+
onClose: PropTypes.func.isRequired,
|
|
478
|
+
initControls: PropTypes.func,
|
|
479
|
+
children: PropTypes.node,
|
|
480
|
+
width: PropTypes.oneOf(["550px", "600px", "700px", "750px", "800px", "1000px"]),
|
|
481
|
+
dispatchDialogOpened: PropTypes.func,
|
|
482
|
+
dispatchDialogClosed: PropTypes.func,
|
|
483
|
+
inline: PropTypes.bool,
|
|
484
|
+
};
|
|
485
|
+
|
|
486
|
+
Dialog.defaultProps = {
|
|
487
|
+
showDialog: false,
|
|
488
|
+
onClose: () => {},
|
|
489
|
+
initControls: null,
|
|
490
|
+
children: [],
|
|
491
|
+
dispatchDialogOpened: () => {},
|
|
492
|
+
dispatchDialogClosed: () => {},
|
|
493
|
+
inline: false,
|
|
494
|
+
};
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import PropTypes from "prop-types";
|
|
3
|
+
|
|
4
|
+
import { useCallHandlingErrors } from "../../../../hooks/useCallHandlingErrors.js";
|
|
5
|
+
|
|
6
|
+
import s from "./dialog-buttons.module.scss";
|
|
7
|
+
import { LinkButton } from "../../../atoms/buttons/LinkButton/LinkButton.jsx";
|
|
8
|
+
import { Button } from "../../../atoms/buttons/Button/Button.jsx";
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Renders a dialog component with configurable primary and secondary buttons.
|
|
12
|
+
* This component allows for a variety of configurations including different button modes,
|
|
13
|
+
* sizes, and actions. It's designed to handle user interactions effectively with error management.
|
|
14
|
+
*
|
|
15
|
+
* @component
|
|
16
|
+
* @param {Object} props - Props for configuring the DialogButtons.
|
|
17
|
+
* @param {string} [props.primaryButtonTitle] - The text to display on the primary button.
|
|
18
|
+
* @param {Function} props.primaryButtonOnClick - Function to call when the primary button is clicked.
|
|
19
|
+
* @param {boolean} props.primaryButtonEnabled - Determines whether the secondary button is enabled.
|
|
20
|
+
* @param {boolean} [props.primaryButtonLoader=false] - Whether to show a loader on the primary button.
|
|
21
|
+
* @param {string} [props.primaryButtonTo] - The URL or route the primary button should navigate to.
|
|
22
|
+
* @param {Function} [props.primaryButtonSetClickTrigger] - Additional click handling logic for the primary button.
|
|
23
|
+
* @param {string} [props.secondaryButtonTitle] - The text to display on the secondary button.
|
|
24
|
+
* @param {Function} props.secondaryButtonOnClick - Function to call when the secondary button is clicked.
|
|
25
|
+
* @param {boolean} props.secondaryButtonEnabled - Determines whether the primary button is enabled.
|
|
26
|
+
* @param {string} [props.secondaryButtonTo] - The URL or route the secondary button should navigate to.
|
|
27
|
+
* @param {boolean} [props.secondaryButtonBig=false] - Makes the secondary button larger for visual emphasis.
|
|
28
|
+
* @param {boolean} [props.withBackgroundImage=false] - Indicates if the button should adjust its styling for background images.
|
|
29
|
+
* @param {boolean} [props.hideOnMobiles=false] - Whether to hide the buttons on mobile devices for responsive designs.
|
|
30
|
+
* @returns {React.Element} The rendered component with two buttons based on provided props.
|
|
31
|
+
*/
|
|
32
|
+
export const DialogButtons = ({
|
|
33
|
+
primaryButtonTitle,
|
|
34
|
+
primaryButtonOnClick,
|
|
35
|
+
primaryButtonEnabled,
|
|
36
|
+
primaryButtonLoader = false,
|
|
37
|
+
primaryButtonTo,
|
|
38
|
+
primaryButtonSetClickTrigger,
|
|
39
|
+
secondaryButtonTitle,
|
|
40
|
+
secondaryButtonOnClick,
|
|
41
|
+
secondaryButtonEnabled,
|
|
42
|
+
secondaryButtonTo,
|
|
43
|
+
secondaryButtonBig = false,
|
|
44
|
+
withBackgroundImage = false,
|
|
45
|
+
hideOnMobiles = false,
|
|
46
|
+
}) => {
|
|
47
|
+
const callHandlingErrors = useCallHandlingErrors();
|
|
48
|
+
|
|
49
|
+
return (
|
|
50
|
+
<>
|
|
51
|
+
<div
|
|
52
|
+
className={
|
|
53
|
+
s["dialog-buttons"] +
|
|
54
|
+
(hideOnMobiles ? " " + s["hide-on-mobiles"] : "") +
|
|
55
|
+
(secondaryButtonBig ? " " + s["space-between-layout"] : "")
|
|
56
|
+
}
|
|
57
|
+
>
|
|
58
|
+
{secondaryButtonTitle ? (
|
|
59
|
+
secondaryButtonTo ? (
|
|
60
|
+
<Button
|
|
61
|
+
mode="primary-transparent"
|
|
62
|
+
to={secondaryButtonTo}
|
|
63
|
+
size="lg"
|
|
64
|
+
loader={false}
|
|
65
|
+
fullWidthOnMobiles
|
|
66
|
+
content={secondaryButtonTitle}
|
|
67
|
+
onClick={secondaryButtonOnClick}
|
|
68
|
+
handleError={callHandlingErrors}
|
|
69
|
+
isDisabled={!secondaryButtonEnabled}
|
|
70
|
+
/>
|
|
71
|
+
) : secondaryButtonBig ? (
|
|
72
|
+
<Button
|
|
73
|
+
mode="transparent"
|
|
74
|
+
size="lg"
|
|
75
|
+
loader={false}
|
|
76
|
+
fullWidthOnMobiles
|
|
77
|
+
content={secondaryButtonTitle}
|
|
78
|
+
onClick={secondaryButtonOnClick}
|
|
79
|
+
handleError={callHandlingErrors}
|
|
80
|
+
isDisabled={!secondaryButtonEnabled}
|
|
81
|
+
/>
|
|
82
|
+
) : (
|
|
83
|
+
<LinkButton
|
|
84
|
+
onClick={secondaryButtonOnClick}
|
|
85
|
+
content={secondaryButtonTitle}
|
|
86
|
+
isColored={!withBackgroundImage}
|
|
87
|
+
isDisabled={!secondaryButtonEnabled}
|
|
88
|
+
/>
|
|
89
|
+
)
|
|
90
|
+
) : null}
|
|
91
|
+
|
|
92
|
+
{primaryButtonTitle ? (
|
|
93
|
+
<Button
|
|
94
|
+
mode="primary"
|
|
95
|
+
size="lg"
|
|
96
|
+
onClick={primaryButtonOnClick}
|
|
97
|
+
loader={primaryButtonLoader}
|
|
98
|
+
to={primaryButtonTo}
|
|
99
|
+
fullWidthOnMobiles
|
|
100
|
+
content={primaryButtonTitle}
|
|
101
|
+
setClickTrigger={primaryButtonSetClickTrigger}
|
|
102
|
+
handleError={callHandlingErrors}
|
|
103
|
+
isDisabled={!primaryButtonEnabled}
|
|
104
|
+
/>
|
|
105
|
+
) : null}
|
|
106
|
+
</div>
|
|
107
|
+
</>
|
|
108
|
+
);
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
DialogButtons.propTypes = {
|
|
112
|
+
primaryButtonTitle: PropTypes.string,
|
|
113
|
+
primaryButtonOnClick: PropTypes.func,
|
|
114
|
+
primaryButtonEnabled: PropTypes.bool,
|
|
115
|
+
primaryButtonLoader: PropTypes.bool,
|
|
116
|
+
primaryButtonTo: PropTypes.string,
|
|
117
|
+
primaryButtonSetClickTrigger: PropTypes.func,
|
|
118
|
+
secondaryButtonTitle: PropTypes.string,
|
|
119
|
+
secondaryButtonOnClick: PropTypes.func,
|
|
120
|
+
secondaryButtonEnabled: PropTypes.bool,
|
|
121
|
+
secondaryButtonTo: PropTypes.string,
|
|
122
|
+
secondaryButtonBig: PropTypes.bool,
|
|
123
|
+
withBackgroundImage: PropTypes.bool,
|
|
124
|
+
hideOnMobiles: PropTypes.bool,
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
DialogButtons.defaultProps = {
|
|
128
|
+
primaryButtonLoader: false,
|
|
129
|
+
secondaryButtonBig: false,
|
|
130
|
+
withBackgroundImage: false,
|
|
131
|
+
hideOnMobiles: false,
|
|
132
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
@use "../../../../assets/styles/index" as *;
|
|
2
|
+
|
|
3
|
+
.dialog-buttons {
|
|
4
|
+
display: flex;
|
|
5
|
+
justify-content: flex-end;
|
|
6
|
+
align-items: center;
|
|
7
|
+
gap: Margin("5");
|
|
8
|
+
width: 100%;
|
|
9
|
+
flex-wrap: wrap-reverse;
|
|
10
|
+
|
|
11
|
+
@media (max-width: $phone-width) {
|
|
12
|
+
flex-direction: column-reverse;
|
|
13
|
+
gap: Margin("5");
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
&.hide-on-mobiles {
|
|
17
|
+
@media (max-width: $tablet-width) {
|
|
18
|
+
display: none;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
&.space-between-layout {
|
|
23
|
+
justify-content: space-between;
|
|
24
|
+
}
|
|
25
|
+
}
|