@web3auth/modal 10.0.0-alpha.2 → 10.0.0-beta.1
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/dist/lib.cjs/node_modules/style-inject/dist/style-inject.es.js +1 -1
- package/dist/lib.cjs/packages/modal/src/config.js +3 -57
- package/dist/lib.cjs/packages/modal/src/index.js +1 -5
- package/dist/lib.cjs/packages/modal/src/modalManager.js +286 -189
- package/dist/lib.cjs/packages/modal/src/react/Web3AuthProvider.js +2 -2
- package/dist/lib.cjs/packages/modal/src/react/context/Web3AuthInnerContext.js +27 -38
- package/dist/lib.cjs/packages/modal/src/react/hooks/useWeb3Auth.js +2 -2
- package/dist/lib.cjs/packages/modal/src/ui/components/BottomSheet/BottomSheet.js +60 -0
- package/dist/lib.cjs/packages/modal/src/ui/components/Button/Button.js +47 -22
- package/dist/lib.cjs/packages/modal/src/ui/components/Button/Button.type.js +8 -0
- package/dist/lib.cjs/packages/modal/src/ui/components/Button/ButtonSocial/ButtonSocial.js +53 -0
- package/dist/lib.cjs/packages/modal/src/ui/components/Button/ButtonWallet/ButtonWallet.js +68 -0
- package/dist/lib.cjs/packages/modal/src/ui/components/ConnectWallet/ConnectWallet.js +202 -0
- package/dist/lib.cjs/packages/modal/src/ui/components/ConnectWallet/ConnectWalletChainFilter/ConnectWalletChainFilter.js +62 -0
- package/dist/lib.cjs/packages/modal/src/ui/components/{ExternalWallet/ExternalWalletChainNamespace.js → ConnectWallet/ConnectWalletChainNamespaceSelect/ConnectWalletChainNamespaceSelect.js} +28 -30
- package/dist/lib.cjs/packages/modal/src/ui/components/ConnectWallet/ConnectWalletHeader/ConnectWalletHeader.js +49 -0
- package/dist/lib.cjs/packages/modal/src/ui/components/ConnectWallet/ConnectWalletList/ConnectWalletList.js +140 -0
- package/dist/lib.cjs/packages/modal/src/ui/components/ConnectWallet/ConnectWalletQrCode/ConnectWalletQrCode.js +93 -0
- package/dist/lib.cjs/packages/modal/src/ui/components/ConnectWallet/ConnectWalletSearch/ConnectWalletSearch.js +55 -0
- package/dist/lib.cjs/packages/modal/src/ui/components/Embed/Embed.js +70 -0
- package/dist/lib.cjs/packages/modal/src/ui/components/Footer/Footer.js +53 -0
- package/dist/lib.cjs/packages/modal/src/ui/components/Image/Image.js +89 -0
- package/dist/lib.cjs/packages/modal/src/ui/components/Loader/Loader.js +151 -0
- package/dist/lib.cjs/packages/modal/src/ui/components/Login/Login.js +489 -0
- package/dist/lib.cjs/packages/modal/src/ui/components/Login/LoginOtp/LoginOtp.js +116 -0
- package/dist/lib.cjs/packages/modal/src/ui/components/Login/LoginPasswordLess/LoginPasswordLess.js +117 -0
- package/dist/lib.cjs/packages/modal/src/ui/components/LoginHint/LoginHint.js +52 -0
- package/dist/lib.cjs/packages/modal/src/ui/components/Modal/Modal.js +87 -0
- package/dist/lib.cjs/packages/modal/src/ui/components/Otp/Otp.js +190 -0
- package/dist/lib.cjs/packages/modal/src/ui/components/PulseLoader/PulseLoader.js +18 -0
- package/dist/lib.cjs/packages/modal/src/ui/components/Root/Root.js +452 -0
- package/dist/lib.cjs/packages/modal/src/ui/components/SocialLoginList/SocialLoginList.js +156 -0
- package/dist/lib.cjs/packages/modal/src/ui/components/Toast/Toast.js +70 -0
- package/dist/lib.cjs/packages/modal/src/ui/components/Widget/Widget.js +229 -0
- package/dist/lib.cjs/packages/modal/src/ui/config.js +10 -0
- package/dist/lib.cjs/packages/modal/src/ui/constants.js +18 -0
- package/dist/lib.cjs/packages/modal/src/ui/context/RootContext.js +20 -0
- package/dist/lib.cjs/packages/modal/src/ui/context/ThemeContext.js +2 -2
- package/dist/lib.cjs/packages/modal/src/ui/css/index.css.js +8 -0
- package/dist/lib.cjs/packages/modal/src/ui/handlers/AbstractHandler.js +117 -0
- package/dist/lib.cjs/packages/modal/src/ui/handlers/EmailPasswordlessHandler.js +54 -0
- package/dist/lib.cjs/packages/modal/src/ui/handlers/SmsPasswordlessHandler.js +57 -0
- package/dist/lib.cjs/packages/modal/src/ui/handlers/factory.js +19 -0
- package/dist/lib.cjs/packages/modal/src/ui/i18n/dutch.json.js +38 -2
- package/dist/lib.cjs/packages/modal/src/ui/i18n/english.json.js +38 -2
- package/dist/lib.cjs/packages/modal/src/ui/i18n/french.json.js +38 -2
- package/dist/lib.cjs/packages/modal/src/ui/i18n/german.json.js +38 -2
- package/dist/lib.cjs/packages/modal/src/ui/i18n/japanese.json.js +38 -2
- package/dist/lib.cjs/packages/modal/src/ui/i18n/korean.json.js +38 -2
- package/dist/lib.cjs/packages/modal/src/ui/i18n/mandarin.json.js +38 -2
- package/dist/lib.cjs/packages/modal/src/ui/i18n/portuguese.json.js +38 -2
- package/dist/lib.cjs/packages/modal/src/ui/i18n/spanish.json.js +38 -2
- package/dist/lib.cjs/packages/modal/src/ui/i18n/turkish.json.js +38 -2
- package/dist/lib.cjs/packages/modal/src/ui/interfaces.js +7 -10
- package/dist/lib.cjs/packages/modal/src/ui/loginModal.js +69 -43
- package/dist/lib.cjs/packages/modal/src/ui/utils.js +105 -20
- package/dist/lib.cjs/packages/modal/src/vue/Web3AuthProvider.js +1 -12
- package/dist/lib.cjs/types/config.d.ts +1 -5
- package/dist/lib.cjs/types/interface.d.ts +2 -6
- package/dist/lib.cjs/types/modalManager.d.ts +11 -4
- package/dist/lib.cjs/types/react/interfaces.d.ts +1 -6
- package/dist/lib.cjs/types/ui/components/BottomSheet/BottomSheet.d.ts +7 -0
- package/dist/lib.cjs/types/ui/components/BottomSheet/BottomSheet.type.d.ts +7 -0
- package/dist/lib.cjs/types/ui/components/BottomSheet/index.d.ts +2 -0
- package/dist/lib.cjs/types/ui/components/Button/Button.d.ts +2 -15
- package/dist/lib.cjs/types/ui/components/Button/Button.type.d.ts +12 -0
- package/dist/lib.cjs/types/ui/components/Button/ButtonSocial/ButtonSocial.d.ts +3 -0
- package/dist/lib.cjs/types/ui/components/Button/ButtonSocial/ButtonSocial.type.d.ts +14 -0
- package/dist/lib.cjs/types/ui/components/Button/ButtonSocial/index.d.ts +2 -0
- package/dist/lib.cjs/types/ui/components/Button/ButtonWallet/ButtonWallet.d.ts +3 -0
- package/dist/lib.cjs/types/ui/components/Button/ButtonWallet/ButtonWallet.type.d.ts +13 -0
- package/dist/lib.cjs/types/ui/components/Button/ButtonWallet/index.d.ts +2 -0
- package/dist/lib.cjs/types/ui/components/Button/index.d.ts +1 -0
- package/dist/lib.cjs/types/ui/components/ConnectWallet/ConnectWallet.d.ts +3 -0
- package/dist/lib.cjs/types/ui/components/ConnectWallet/ConnectWallet.type.d.ts +24 -0
- package/dist/lib.cjs/types/ui/components/ConnectWallet/ConnectWalletChainFilter/ConnectWalletChainFilter.d.ts +3 -0
- package/dist/lib.cjs/types/ui/components/ConnectWallet/ConnectWalletChainFilter/ConnectWalletChainFilter.type.d.ts +13 -0
- package/dist/lib.cjs/types/ui/components/ConnectWallet/ConnectWalletChainFilter/index.d.ts +2 -0
- package/dist/lib.cjs/types/ui/components/ConnectWallet/ConnectWalletChainNamespaceSelect/ConnectWalletChainNamespaceSelect.d.ts +3 -0
- package/dist/lib.cjs/types/ui/components/ConnectWallet/ConnectWalletChainNamespaceSelect/ConnectWalletChainNamespaceSelect.type.d.ts +10 -0
- package/dist/lib.cjs/types/ui/components/ConnectWallet/ConnectWalletChainNamespaceSelect/index.d.ts +2 -0
- package/dist/lib.cjs/types/ui/components/ConnectWallet/ConnectWalletHeader/ConnectWalletHeader.d.ts +3 -0
- package/dist/lib.cjs/types/ui/components/ConnectWallet/ConnectWalletHeader/ConnectWalletHeader.type.d.ts +6 -0
- package/dist/lib.cjs/types/ui/components/ConnectWallet/ConnectWalletHeader/index.d.ts +2 -0
- package/dist/lib.cjs/types/ui/components/ConnectWallet/ConnectWalletList/ConnectWalletList.d.ts +3 -0
- package/dist/lib.cjs/types/ui/components/ConnectWallet/ConnectWalletList/ConnectWalletList.type.d.ts +19 -0
- package/dist/lib.cjs/types/ui/components/ConnectWallet/ConnectWalletList/index.d.ts +2 -0
- package/dist/lib.cjs/types/ui/components/ConnectWallet/ConnectWalletQrCode/ConnectWalletQrCode.d.ts +3 -0
- package/dist/lib.cjs/types/ui/components/ConnectWallet/ConnectWalletQrCode/ConnectWalletQrCode.type.d.ts +9 -0
- package/dist/lib.cjs/types/ui/components/ConnectWallet/ConnectWalletQrCode/index.d.ts +2 -0
- package/dist/lib.cjs/types/ui/components/ConnectWallet/ConnectWalletSearch/ConnectWalletSearch.d.ts +3 -0
- package/dist/lib.cjs/types/ui/components/ConnectWallet/ConnectWalletSearch/ConnectWalletSearch.type.d.ts +9 -0
- package/dist/lib.cjs/types/ui/components/ConnectWallet/ConnectWalletSearch/index.d.ts +2 -0
- package/dist/lib.cjs/types/ui/components/ConnectWallet/index.d.ts +2 -0
- package/dist/lib.cjs/types/ui/components/Embed/Embed.d.ts +8 -0
- package/dist/lib.cjs/types/ui/components/Embed/Embed.type.d.ts +12 -0
- package/dist/lib.cjs/types/ui/components/Embed/index.d.ts +2 -0
- package/dist/lib.cjs/types/ui/components/Footer/Footer.d.ts +7 -0
- package/dist/lib.cjs/types/ui/components/Footer/Footer.type.d.ts +4 -0
- package/dist/lib.cjs/types/ui/components/Footer/index.d.ts +2 -0
- package/dist/lib.cjs/types/ui/components/Image/Image.d.ts +7 -0
- package/dist/lib.cjs/types/ui/components/{Image.d.ts → Image/Image.type.d.ts} +2 -1
- package/dist/lib.cjs/types/ui/components/Image/index.d.ts +2 -0
- package/dist/lib.cjs/types/ui/components/Loader/Loader.d.ts +8 -0
- package/dist/lib.cjs/types/ui/components/Loader/Loader.type.d.ts +12 -0
- package/dist/lib.cjs/types/ui/components/Loader/index.d.ts +2 -0
- package/dist/lib.cjs/types/ui/components/Login/Login.d.ts +3 -0
- package/dist/lib.cjs/types/ui/components/Login/Login.type.d.ts +29 -0
- package/dist/lib.cjs/types/ui/components/Login/LoginOtp/LoginOtp.d.ts +8 -0
- package/dist/lib.cjs/types/ui/components/Login/LoginOtp/LoginOtp.type.d.ts +10 -0
- package/dist/lib.cjs/types/ui/components/Login/LoginOtp/index.d.ts +2 -0
- package/dist/lib.cjs/types/ui/components/Login/LoginPasswordLess/LoginPasswordLess.d.ts +3 -0
- package/dist/lib.cjs/types/ui/components/Login/LoginPasswordLess/LoginPasswordLess.type.d.ts +13 -0
- package/dist/lib.cjs/types/ui/components/Login/LoginPasswordLess/index.d.ts +2 -0
- package/dist/lib.cjs/types/ui/components/Login/index.d.ts +2 -0
- package/dist/lib.cjs/types/ui/components/LoginHint/LoginHint.d.ts +3 -0
- package/dist/lib.cjs/types/ui/components/LoginHint/LoginHint.type.d.ts +6 -0
- package/dist/lib.cjs/types/ui/components/LoginHint/index.d.ts +2 -0
- package/dist/lib.cjs/types/ui/components/Modal/Modal.d.ts +8 -0
- package/dist/lib.cjs/types/ui/components/Modal/Modal.type.d.ts +14 -0
- package/dist/lib.cjs/types/ui/components/Modal/index.d.ts +2 -0
- package/dist/lib.cjs/types/ui/components/Otp/Otp.d.ts +3 -0
- package/dist/lib.cjs/types/ui/components/Otp/Otp.type.d.ts +22 -0
- package/dist/lib.cjs/types/ui/components/Otp/index.d.ts +2 -0
- package/dist/lib.cjs/types/ui/components/PulseLoader/PulseLoader.d.ts +2 -0
- package/dist/lib.cjs/types/ui/components/PulseLoader/index.d.ts +1 -0
- package/dist/lib.cjs/types/ui/components/Root/Root.d.ts +3 -0
- package/dist/lib.cjs/types/ui/components/Root/Root.type.d.ts +27 -0
- package/dist/lib.cjs/types/ui/components/Root/index.d.ts +2 -0
- package/dist/lib.cjs/types/ui/components/SocialLoginList/SocialLoginList.d.ts +3 -0
- package/dist/lib.cjs/types/ui/components/SocialLoginList/SocialLoginList.type.d.ts +11 -0
- package/dist/lib.cjs/types/ui/components/SocialLoginList/index.d.ts +2 -0
- package/dist/lib.cjs/types/ui/components/Toast/Toast.d.ts +2 -0
- package/dist/lib.cjs/types/ui/components/Toast/index.d.ts +1 -0
- package/dist/lib.cjs/types/ui/components/Widget/Widget.d.ts +3 -0
- package/dist/lib.cjs/types/ui/components/{Modal.d.ts → Widget/Widget.type.d.ts} +4 -5
- package/dist/lib.cjs/types/ui/components/Widget/index.d.ts +1 -0
- package/dist/lib.cjs/types/ui/config.d.ts +4 -1
- package/dist/lib.cjs/types/ui/constants.d.ts +13 -0
- package/dist/lib.cjs/types/ui/context/RootContext.d.ts +18 -0
- package/dist/lib.cjs/types/ui/handlers/AbstractHandler.d.ts +20 -0
- package/dist/lib.cjs/types/ui/handlers/EmailPasswordlessHandler.d.ts +8 -0
- package/dist/lib.cjs/types/ui/handlers/SmsPasswordlessHandler.d.ts +9 -0
- package/dist/lib.cjs/types/ui/handlers/factory.d.ts +5 -0
- package/dist/lib.cjs/types/ui/interfaces.d.ts +116 -15
- package/dist/lib.cjs/types/ui/loginModal.d.ts +9 -7
- package/dist/lib.cjs/types/ui/utils.d.ts +16 -3
- package/dist/lib.cjs/types/vue/interfaces.d.ts +1 -6
- package/dist/lib.esm/node_modules/style-inject/dist/style-inject.es.js +1 -1
- package/dist/lib.esm/packages/modal/src/config.js +4 -54
- package/dist/lib.esm/packages/modal/src/index.js +1 -1
- package/dist/lib.esm/packages/modal/src/modalManager.js +299 -195
- package/dist/lib.esm/packages/modal/src/react/context/Web3AuthInnerContext.js +1 -12
- package/dist/lib.esm/packages/modal/src/ui/components/BottomSheet/BottomSheet.js +58 -0
- package/dist/lib.esm/packages/modal/src/ui/components/Button/Button.js +48 -24
- package/dist/lib.esm/packages/modal/src/ui/components/Button/Button.type.js +6 -0
- package/dist/lib.esm/packages/modal/src/ui/components/Button/ButtonSocial/ButtonSocial.js +51 -0
- package/dist/lib.esm/packages/modal/src/ui/components/Button/ButtonWallet/ButtonWallet.js +66 -0
- package/dist/lib.esm/packages/modal/src/ui/components/ConnectWallet/ConnectWallet.js +200 -0
- package/dist/lib.esm/packages/modal/src/ui/components/ConnectWallet/ConnectWalletChainFilter/ConnectWalletChainFilter.js +60 -0
- package/dist/lib.esm/packages/modal/src/ui/components/{ExternalWallet/ExternalWalletChainNamespace.js → ConnectWallet/ConnectWalletChainNamespaceSelect/ConnectWalletChainNamespaceSelect.js} +28 -31
- package/dist/lib.esm/packages/modal/src/ui/components/ConnectWallet/ConnectWalletHeader/ConnectWalletHeader.js +47 -0
- package/dist/lib.esm/packages/modal/src/ui/components/ConnectWallet/ConnectWalletList/ConnectWalletList.js +138 -0
- package/dist/lib.esm/packages/modal/src/ui/components/ConnectWallet/ConnectWalletQrCode/ConnectWalletQrCode.js +91 -0
- package/dist/lib.esm/packages/modal/src/ui/components/ConnectWallet/ConnectWalletSearch/ConnectWalletSearch.js +56 -0
- package/dist/lib.esm/packages/modal/src/ui/components/Embed/Embed.js +68 -0
- package/dist/lib.esm/packages/modal/src/ui/components/Footer/Footer.js +51 -0
- package/dist/lib.esm/packages/modal/src/ui/components/Image/Image.js +87 -0
- package/dist/lib.esm/packages/modal/src/ui/components/Loader/Loader.js +152 -0
- package/dist/lib.esm/packages/modal/src/ui/components/Login/Login.js +489 -0
- package/dist/lib.esm/packages/modal/src/ui/components/Login/LoginOtp/LoginOtp.js +115 -0
- package/dist/lib.esm/packages/modal/src/ui/components/Login/LoginPasswordLess/LoginPasswordLess.js +115 -0
- package/dist/lib.esm/packages/modal/src/ui/components/LoginHint/LoginHint.js +50 -0
- package/dist/lib.esm/packages/modal/src/ui/components/Modal/Modal.js +85 -0
- package/dist/lib.esm/packages/modal/src/ui/components/Otp/Otp.js +188 -0
- package/dist/lib.esm/packages/modal/src/ui/components/PulseLoader/PulseLoader.js +16 -0
- package/dist/lib.esm/packages/modal/src/ui/components/Root/Root.js +462 -0
- package/dist/lib.esm/packages/modal/src/ui/components/SocialLoginList/SocialLoginList.js +154 -0
- package/dist/lib.esm/packages/modal/src/ui/components/Toast/Toast.js +68 -0
- package/dist/lib.esm/packages/modal/src/ui/components/Widget/Widget.js +231 -0
- package/dist/lib.esm/packages/modal/src/ui/config.js +9 -2
- package/dist/lib.esm/packages/modal/src/ui/constants.js +13 -0
- package/dist/lib.esm/packages/modal/src/ui/context/RootContext.js +18 -0
- package/dist/lib.esm/packages/modal/src/ui/css/index.css.js +6 -0
- package/dist/lib.esm/packages/modal/src/ui/handlers/AbstractHandler.js +115 -0
- package/dist/lib.esm/packages/modal/src/ui/handlers/EmailPasswordlessHandler.js +52 -0
- package/dist/lib.esm/packages/modal/src/ui/handlers/SmsPasswordlessHandler.js +55 -0
- package/dist/lib.esm/packages/modal/src/ui/handlers/factory.js +17 -0
- package/dist/lib.esm/packages/modal/src/ui/i18n/dutch.json.js +38 -3
- package/dist/lib.esm/packages/modal/src/ui/i18n/english.json.js +38 -3
- package/dist/lib.esm/packages/modal/src/ui/i18n/french.json.js +38 -3
- package/dist/lib.esm/packages/modal/src/ui/i18n/german.json.js +38 -3
- package/dist/lib.esm/packages/modal/src/ui/i18n/japanese.json.js +38 -3
- package/dist/lib.esm/packages/modal/src/ui/i18n/korean.json.js +38 -3
- package/dist/lib.esm/packages/modal/src/ui/i18n/mandarin.json.js +38 -3
- package/dist/lib.esm/packages/modal/src/ui/i18n/portuguese.json.js +38 -3
- package/dist/lib.esm/packages/modal/src/ui/i18n/spanish.json.js +38 -3
- package/dist/lib.esm/packages/modal/src/ui/i18n/turkish.json.js +38 -3
- package/dist/lib.esm/packages/modal/src/ui/interfaces.js +8 -9
- package/dist/lib.esm/packages/modal/src/ui/loginModal.js +70 -44
- package/dist/lib.esm/packages/modal/src/ui/utils.js +104 -22
- package/dist/lib.esm/packages/modal/src/vue/Web3AuthProvider.js +1 -12
- package/dist/modal.umd.min.js +1 -1
- package/dist/modal.umd.min.js.LICENSE.txt +8 -8
- package/package.json +14 -11
- package/dist/lib.cjs/packages/modal/src/ui/assets/arrow-left-dark.svg.js +0 -7
- package/dist/lib.cjs/packages/modal/src/ui/assets/arrow-left-light.svg.js +0 -7
- package/dist/lib.cjs/packages/modal/src/ui/assets/x-dark.svg.js +0 -7
- package/dist/lib.cjs/packages/modal/src/ui/assets/x-light.svg.js +0 -7
- package/dist/lib.cjs/packages/modal/src/ui/components/AdapterLoader.js +0 -108
- package/dist/lib.cjs/packages/modal/src/ui/components/Button/styles.css.js +0 -8
- package/dist/lib.cjs/packages/modal/src/ui/components/ExternalWallet/ExternalWalletButton.js +0 -44
- package/dist/lib.cjs/packages/modal/src/ui/components/ExternalWallet/ExternalWalletConnect.js +0 -67
- package/dist/lib.cjs/packages/modal/src/ui/components/ExternalWallet/ExternalWalletDetails.js +0 -43
- package/dist/lib.cjs/packages/modal/src/ui/components/ExternalWallet/ExternalWalletHeader.js +0 -46
- package/dist/lib.cjs/packages/modal/src/ui/components/ExternalWallet/ExternalWalletInstall.js +0 -167
- package/dist/lib.cjs/packages/modal/src/ui/components/ExternalWallets.js +0 -274
- package/dist/lib.cjs/packages/modal/src/ui/components/Footer.js +0 -20
- package/dist/lib.cjs/packages/modal/src/ui/components/Header.js +0 -81
- package/dist/lib.cjs/packages/modal/src/ui/components/Icon.js +0 -73
- package/dist/lib.cjs/packages/modal/src/ui/components/Image.js +0 -51
- package/dist/lib.cjs/packages/modal/src/ui/components/Loader.js +0 -59
- package/dist/lib.cjs/packages/modal/src/ui/components/Modal.js +0 -244
- package/dist/lib.cjs/packages/modal/src/ui/components/SelfCustodyViaWeb3Auth.js +0 -30
- package/dist/lib.cjs/packages/modal/src/ui/components/SocialLoginPasswordless.js +0 -148
- package/dist/lib.cjs/packages/modal/src/ui/components/SocialLogins.js +0 -152
- package/dist/lib.cjs/packages/modal/src/ui/components/WalletConnect.js +0 -84
- package/dist/lib.cjs/packages/modal/src/ui/css/web3auth.css.js +0 -8
- package/dist/lib.cjs/types/ui/components/AdapterLoader.d.ts +0 -11
- package/dist/lib.cjs/types/ui/components/ExternalWallet/ExternalWalletButton.d.ts +0 -7
- package/dist/lib.cjs/types/ui/components/ExternalWallet/ExternalWalletChainNamespace.d.ts +0 -9
- package/dist/lib.cjs/types/ui/components/ExternalWallet/ExternalWalletConnect.d.ts +0 -9
- package/dist/lib.cjs/types/ui/components/ExternalWallet/ExternalWalletDetails.d.ts +0 -10
- package/dist/lib.cjs/types/ui/components/ExternalWallet/ExternalWalletHeader.d.ts +0 -8
- package/dist/lib.cjs/types/ui/components/ExternalWallet/ExternalWalletInstall.d.ts +0 -8
- package/dist/lib.cjs/types/ui/components/ExternalWallets.d.ts +0 -15
- package/dist/lib.cjs/types/ui/components/Footer.d.ts +0 -1
- package/dist/lib.cjs/types/ui/components/Header.d.ts +0 -8
- package/dist/lib.cjs/types/ui/components/Icon.d.ts +0 -9
- package/dist/lib.cjs/types/ui/components/Loader.d.ts +0 -10
- package/dist/lib.cjs/types/ui/components/SelfCustodyViaWeb3Auth.d.ts +0 -1
- package/dist/lib.cjs/types/ui/components/SocialLoginPasswordless.d.ts +0 -14
- package/dist/lib.cjs/types/ui/components/SocialLogins.d.ts +0 -10
- package/dist/lib.cjs/types/ui/components/WalletConnect.d.ts +0 -8
- package/dist/lib.esm/packages/modal/src/ui/assets/arrow-left-dark.svg.js +0 -5
- package/dist/lib.esm/packages/modal/src/ui/assets/arrow-left-light.svg.js +0 -5
- package/dist/lib.esm/packages/modal/src/ui/assets/x-dark.svg.js +0 -5
- package/dist/lib.esm/packages/modal/src/ui/assets/x-light.svg.js +0 -5
- package/dist/lib.esm/packages/modal/src/ui/components/AdapterLoader.js +0 -106
- package/dist/lib.esm/packages/modal/src/ui/components/Button/styles.css.js +0 -6
- package/dist/lib.esm/packages/modal/src/ui/components/ExternalWallet/ExternalWalletButton.js +0 -42
- package/dist/lib.esm/packages/modal/src/ui/components/ExternalWallet/ExternalWalletConnect.js +0 -65
- package/dist/lib.esm/packages/modal/src/ui/components/ExternalWallet/ExternalWalletDetails.js +0 -44
- package/dist/lib.esm/packages/modal/src/ui/components/ExternalWallet/ExternalWalletHeader.js +0 -44
- package/dist/lib.esm/packages/modal/src/ui/components/ExternalWallet/ExternalWalletInstall.js +0 -165
- package/dist/lib.esm/packages/modal/src/ui/components/ExternalWallets.js +0 -276
- package/dist/lib.esm/packages/modal/src/ui/components/Footer.js +0 -18
- package/dist/lib.esm/packages/modal/src/ui/components/Header.js +0 -79
- package/dist/lib.esm/packages/modal/src/ui/components/Icon.js +0 -71
- package/dist/lib.esm/packages/modal/src/ui/components/Image.js +0 -49
- package/dist/lib.esm/packages/modal/src/ui/components/Loader.js +0 -57
- package/dist/lib.esm/packages/modal/src/ui/components/Modal.js +0 -243
- package/dist/lib.esm/packages/modal/src/ui/components/SelfCustodyViaWeb3Auth.js +0 -28
- package/dist/lib.esm/packages/modal/src/ui/components/SocialLoginPasswordless.js +0 -146
- package/dist/lib.esm/packages/modal/src/ui/components/SocialLogins.js +0 -151
- package/dist/lib.esm/packages/modal/src/ui/components/WalletConnect.js +0 -82
- package/dist/lib.esm/packages/modal/src/ui/css/web3auth.css.js +0 -6
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { AUTH_CONNECTION } from '@web3auth/auth';
|
|
2
|
+
import { useMemo } from 'react';
|
|
3
|
+
import { useTranslation } from 'react-i18next';
|
|
4
|
+
import i18nInstance from '../../../localeImport.js';
|
|
5
|
+
import { getIcons } from '../../../utils.js';
|
|
6
|
+
import OtpInput$1 from '../../Otp/Otp.js';
|
|
7
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* OtpInput component
|
|
11
|
+
* @param props - OtpInputProps
|
|
12
|
+
* @returns OtpInput component
|
|
13
|
+
*/
|
|
14
|
+
function OtpInput(props) {
|
|
15
|
+
const {
|
|
16
|
+
setShowOtpFlow,
|
|
17
|
+
handleOtpComplete,
|
|
18
|
+
authConnection,
|
|
19
|
+
loginHint = "",
|
|
20
|
+
errorMessage,
|
|
21
|
+
otpLoading
|
|
22
|
+
} = props;
|
|
23
|
+
const isMobileOtp = useMemo(() => authConnection === AUTH_CONNECTION.SMS_PASSWORDLESS, [authConnection]);
|
|
24
|
+
const [t] = useTranslation(undefined, {
|
|
25
|
+
i18n: i18nInstance
|
|
26
|
+
});
|
|
27
|
+
const parsedLoginHint = useMemo(() => {
|
|
28
|
+
if (authConnection === AUTH_CONNECTION.EMAIL_PASSWORDLESS) return loginHint;
|
|
29
|
+
const [countryCode, number] = loginHint.includes("-") ? loginHint.split("-") : ["", loginHint];
|
|
30
|
+
const masked = `${number}`.slice(-Math.floor(number.length / 2)).padStart(`${number}`.length, "*");
|
|
31
|
+
return `${countryCode} ${masked}`;
|
|
32
|
+
}, [loginHint, authConnection]);
|
|
33
|
+
return /*#__PURE__*/jsxs(Fragment, {
|
|
34
|
+
children: [/*#__PURE__*/jsx("div", {
|
|
35
|
+
className: "w3a--mr-auto w3a--flex w3a--w-full w3a--items-start w3a--justify-start",
|
|
36
|
+
children: /*#__PURE__*/jsx("button", {
|
|
37
|
+
type: "button",
|
|
38
|
+
className: "w3a--z-20 w3a--flex w3a--size-5 w3a--cursor-pointer w3a--items-center w3a--justify-center w3a--rounded-full",
|
|
39
|
+
onClick: () => setShowOtpFlow(false),
|
|
40
|
+
children: /*#__PURE__*/jsx("svg", {
|
|
41
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
42
|
+
fill: "none",
|
|
43
|
+
viewBox: "0 0 20 20",
|
|
44
|
+
className: "w3a--text-app-gray-900 dark:w3a--text-app-white",
|
|
45
|
+
children: /*#__PURE__*/jsx("path", {
|
|
46
|
+
fill: "currentColor",
|
|
47
|
+
fillRule: "evenodd",
|
|
48
|
+
d: "M9.707 16.707a1 1 0 0 1-1.414 0l-6-6a1 1 0 0 1 0-1.414l6-6a1 1 0 0 1 1.414 1.414L5.414 9H17a1 1 0 1 1 0 2H5.414l4.293 4.293a1 1 0 0 1 0 1.414",
|
|
49
|
+
clipRule: "evenodd"
|
|
50
|
+
})
|
|
51
|
+
})
|
|
52
|
+
})
|
|
53
|
+
}), /*#__PURE__*/jsxs("div", {
|
|
54
|
+
className: "-w3a--mt-10 w3a--flex w3a--size-full w3a--flex-1 w3a--flex-col w3a--items-center w3a--justify-center w3a--gap-y-4",
|
|
55
|
+
children: [/*#__PURE__*/jsx("img", {
|
|
56
|
+
src: getIcons(isMobileOtp ? "sms-otp-light" : "email-otp-light"),
|
|
57
|
+
alt: "otp",
|
|
58
|
+
className: "w3a--size-auto"
|
|
59
|
+
}), /*#__PURE__*/jsxs("div", {
|
|
60
|
+
className: "-w3a--mt-6 w3a--flex w3a--flex-col w3a--items-center w3a--justify-center w3a--gap-y-2",
|
|
61
|
+
children: [/*#__PURE__*/jsx("p", {
|
|
62
|
+
className: "w3a--text-lg w3a--font-bold w3a--text-app-gray-900 dark:w3a--text-app-white",
|
|
63
|
+
children: isMobileOtp ? t("modal.otp.mobile-title") : t("modal.otp.email-title")
|
|
64
|
+
}), /*#__PURE__*/jsxs("div", {
|
|
65
|
+
className: "w3a--flex w3a--flex-col w3a--items-center w3a--justify-center w3a--gap-y-1",
|
|
66
|
+
children: [/*#__PURE__*/jsx("p", {
|
|
67
|
+
className: "w3a--text-sm w3a--font-normal w3a--text-app-gray-500 dark:w3a--text-app-gray-300",
|
|
68
|
+
children: isMobileOtp ? t("modal.otp.mobile-subtext") : t("modal.otp.email-subtext")
|
|
69
|
+
}), /*#__PURE__*/jsx("p", {
|
|
70
|
+
className: "w3a--text-sm w3a--font-normal w3a--text-app-gray-500 dark:w3a--text-app-gray-300",
|
|
71
|
+
children: isMobileOtp ? parsedLoginHint : t("modal.otp.email-subtext-example", {
|
|
72
|
+
email: parsedLoginHint
|
|
73
|
+
})
|
|
74
|
+
})]
|
|
75
|
+
})]
|
|
76
|
+
}), /*#__PURE__*/jsx(OtpInput$1, {
|
|
77
|
+
length: 6,
|
|
78
|
+
onComplete: handleOtpComplete,
|
|
79
|
+
error: Boolean(errorMessage),
|
|
80
|
+
helperText: errorMessage,
|
|
81
|
+
loading: otpLoading,
|
|
82
|
+
disabled: otpLoading
|
|
83
|
+
})]
|
|
84
|
+
})]
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* LoginOtp component
|
|
90
|
+
* @param props - LoginOtpProps
|
|
91
|
+
* @returns LoginOtp component
|
|
92
|
+
*/
|
|
93
|
+
function LoginOtp(props) {
|
|
94
|
+
const {
|
|
95
|
+
otpLoading,
|
|
96
|
+
setShowOtpFlow,
|
|
97
|
+
handleOtpComplete,
|
|
98
|
+
authConnection,
|
|
99
|
+
loginHint,
|
|
100
|
+
errorMessage
|
|
101
|
+
} = props;
|
|
102
|
+
return /*#__PURE__*/jsx("div", {
|
|
103
|
+
className: "w3a--flex w3a--size-full w3a--flex-1 w3a--flex-col w3a--items-center w3a--justify-center w3a--gap-y-4",
|
|
104
|
+
children: /*#__PURE__*/jsx(OtpInput, {
|
|
105
|
+
errorMessage: errorMessage,
|
|
106
|
+
setShowOtpFlow: setShowOtpFlow,
|
|
107
|
+
handleOtpComplete: handleOtpComplete,
|
|
108
|
+
authConnection: authConnection,
|
|
109
|
+
loginHint: loginHint,
|
|
110
|
+
otpLoading: otpLoading
|
|
111
|
+
})
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
export { LoginOtp as default };
|
package/dist/lib.esm/packages/modal/src/ui/components/Login/LoginPasswordLess/LoginPasswordLess.js
ADDED
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { useRef, useState, useEffect } from 'react';
|
|
2
|
+
import { useTranslation } from 'react-i18next';
|
|
3
|
+
import i18nInstance from '../../../localeImport.js';
|
|
4
|
+
import { cn, getIcons } from '../../../utils.js';
|
|
5
|
+
import PulseLoader from '../../PulseLoader/PulseLoader.js';
|
|
6
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
7
|
+
|
|
8
|
+
function LoginPasswordLess(props) {
|
|
9
|
+
const {
|
|
10
|
+
isModalVisible,
|
|
11
|
+
isPasswordLessCtaClicked,
|
|
12
|
+
setIsPasswordLessCtaClicked,
|
|
13
|
+
title,
|
|
14
|
+
placeholder,
|
|
15
|
+
handleFormSubmit,
|
|
16
|
+
errorMessage,
|
|
17
|
+
isDark,
|
|
18
|
+
isPasswordLessLoading,
|
|
19
|
+
buttonRadius
|
|
20
|
+
} = props;
|
|
21
|
+
const [t] = useTranslation(undefined, {
|
|
22
|
+
i18n: i18nInstance
|
|
23
|
+
});
|
|
24
|
+
const inputRef = useRef(null);
|
|
25
|
+
const [inputValue, setInputValue] = useState("");
|
|
26
|
+
const [isInputFocused, setIsInputFocused] = useState(false);
|
|
27
|
+
const onInputChange = e => {
|
|
28
|
+
setInputValue(e.target.value);
|
|
29
|
+
setIsInputFocused(true);
|
|
30
|
+
};
|
|
31
|
+
const handleEnter = e => {
|
|
32
|
+
const {
|
|
33
|
+
key
|
|
34
|
+
} = e;
|
|
35
|
+
if (key === "Enter") {
|
|
36
|
+
handleFormSubmit(inputValue);
|
|
37
|
+
setIsInputFocused(false);
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
const onFormSubmit = e => {
|
|
41
|
+
e.preventDefault();
|
|
42
|
+
e.stopPropagation();
|
|
43
|
+
handleFormSubmit(inputValue);
|
|
44
|
+
setIsInputFocused(false);
|
|
45
|
+
};
|
|
46
|
+
useEffect(() => {
|
|
47
|
+
if (!isModalVisible) {
|
|
48
|
+
setIsPasswordLessCtaClicked(false);
|
|
49
|
+
}
|
|
50
|
+
}, [isModalVisible, setIsPasswordLessCtaClicked]);
|
|
51
|
+
useEffect(() => {
|
|
52
|
+
if (isPasswordLessCtaClicked) {
|
|
53
|
+
var _inputRef$current;
|
|
54
|
+
(_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 || _inputRef$current.focus();
|
|
55
|
+
}
|
|
56
|
+
}, [isPasswordLessCtaClicked]);
|
|
57
|
+
if (!isPasswordLessCtaClicked) {
|
|
58
|
+
return /*#__PURE__*/jsx("button", {
|
|
59
|
+
type: "button",
|
|
60
|
+
className: cn("w3a--btn !w3a--justify-between", {
|
|
61
|
+
"w3a--rounded-full": buttonRadius === "pill",
|
|
62
|
+
"w3a--rounded-lg": buttonRadius === "rounded",
|
|
63
|
+
"w3a--rounded-none": buttonRadius === "square"
|
|
64
|
+
}),
|
|
65
|
+
onClick: () => {
|
|
66
|
+
setIsPasswordLessCtaClicked(true);
|
|
67
|
+
},
|
|
68
|
+
children: /*#__PURE__*/jsx("p", {
|
|
69
|
+
className: "w3a--text-app-gray-900 dark:w3a--text-app-white",
|
|
70
|
+
children: t("modal.passwordless.title", {
|
|
71
|
+
title
|
|
72
|
+
})
|
|
73
|
+
})
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
return /*#__PURE__*/jsxs(Fragment, {
|
|
77
|
+
children: [/*#__PURE__*/jsxs("div", {
|
|
78
|
+
className: cn("w3a--input", isInputFocused && "!w3a--border-app-primary-600", {
|
|
79
|
+
"w3a--rounded-full": buttonRadius === "pill",
|
|
80
|
+
"w3a--rounded-lg": buttonRadius === "rounded",
|
|
81
|
+
"w3a--rounded-none": buttonRadius === "square"
|
|
82
|
+
}),
|
|
83
|
+
children: [/*#__PURE__*/jsx("input", {
|
|
84
|
+
ref: inputRef,
|
|
85
|
+
onInput: onInputChange,
|
|
86
|
+
value: inputValue,
|
|
87
|
+
placeholder: placeholder,
|
|
88
|
+
onFocus: () => {
|
|
89
|
+
setIsInputFocused(true);
|
|
90
|
+
},
|
|
91
|
+
onBlur: e => {
|
|
92
|
+
e.target.placeholder = `${placeholder}`;
|
|
93
|
+
setIsInputFocused(false);
|
|
94
|
+
},
|
|
95
|
+
type: "text",
|
|
96
|
+
className: cn("w3a--w-full w3a--appearance-none w3a--bg-transparent w3a--text-app-gray-900 w3a--outline-none placeholder:w3a--text-xs placeholder:w3a--text-app-gray-400 focus:w3a--outline-none active:w3a--outline-none dark:w3a--text-app-white dark:placeholder:w3a--text-app-gray-500"),
|
|
97
|
+
onKeyDown: e => handleEnter(e),
|
|
98
|
+
disabled: isPasswordLessLoading
|
|
99
|
+
}), isPasswordLessLoading && /*#__PURE__*/jsx(PulseLoader, {}), inputValue && !isPasswordLessLoading && /*#__PURE__*/jsx("button", {
|
|
100
|
+
type: "button",
|
|
101
|
+
className: "w3a--icon-animation w3a--appearance-none",
|
|
102
|
+
onClick: onFormSubmit,
|
|
103
|
+
children: /*#__PURE__*/jsx("img", {
|
|
104
|
+
src: getIcons(isDark ? "chevron-right-dark" : "chevron-right-light"),
|
|
105
|
+
alt: "arrow"
|
|
106
|
+
})
|
|
107
|
+
})]
|
|
108
|
+
}), errorMessage && !isInputFocused && isPasswordLessCtaClicked && /*#__PURE__*/jsx("p", {
|
|
109
|
+
className: "w3a--w-full w3a--pl-6 w3a--text-start w3a--text-xs w3a--font-normal w3a--text-app-red-500 dark:w3a--text-app-red-400",
|
|
110
|
+
children: errorMessage
|
|
111
|
+
})]
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
export { LoginPasswordLess as default };
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { useState, useMemo } from 'react';
|
|
2
|
+
import { cn } from '../../utils.js';
|
|
3
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
4
|
+
|
|
5
|
+
const LoginHint = ({
|
|
6
|
+
children,
|
|
7
|
+
content,
|
|
8
|
+
isDark = false,
|
|
9
|
+
hideHint = false
|
|
10
|
+
}) => {
|
|
11
|
+
const [showPopover, setShowPopover] = useState(false);
|
|
12
|
+
const handleMouseEnter = () => {
|
|
13
|
+
setShowPopover(true);
|
|
14
|
+
};
|
|
15
|
+
const handleMouseLeave = () => {
|
|
16
|
+
setShowPopover(false);
|
|
17
|
+
};
|
|
18
|
+
const triangleStyle = useMemo(() => {
|
|
19
|
+
const triangleSize = "8px"; // Customize the size of the triangle
|
|
20
|
+
const triangleColor = isDark ? "#ffffff" : "#1f2a37"; // Customize the color of the triangle
|
|
21
|
+
return {
|
|
22
|
+
borderTop: `${triangleSize} solid transparent`,
|
|
23
|
+
borderRight: "none",
|
|
24
|
+
borderBottom: `${triangleSize} solid transparent`,
|
|
25
|
+
borderLeft: `${triangleSize} solid ${triangleColor}`,
|
|
26
|
+
left: "0%",
|
|
27
|
+
top: `calc(100% - ${triangleSize})`
|
|
28
|
+
};
|
|
29
|
+
}, [isDark]);
|
|
30
|
+
return /*#__PURE__*/jsxs("div", {
|
|
31
|
+
className: "w3a--relative",
|
|
32
|
+
"aria-hidden": true,
|
|
33
|
+
onMouseEnter: handleMouseEnter,
|
|
34
|
+
onMouseLeave: handleMouseLeave,
|
|
35
|
+
onFocus: handleMouseEnter,
|
|
36
|
+
onBlur: handleMouseLeave,
|
|
37
|
+
onClick: handleMouseLeave,
|
|
38
|
+
children: [children, showPopover && !hideHint && /*#__PURE__*/jsxs("div", {
|
|
39
|
+
"data-popover": true,
|
|
40
|
+
role: "tooltip",
|
|
41
|
+
className: cn("w3a--absolute w3a--z-[45] w3a--shadow-2xl w3a--rounded-lg w3a--bottom-[100%] w3a--left-[50%] w3a--w-max w3a--text-xs w3a--px-[6px] w3a--py-[3px]", isDark ? "w3a--bg-app-white w3a--text-app-gray-900" : "w3a--bg-app-gray-800 w3a--text-app-gray-100"),
|
|
42
|
+
children: [content, /*#__PURE__*/jsx("div", {
|
|
43
|
+
className: "w3a--absolute",
|
|
44
|
+
style: triangleStyle
|
|
45
|
+
})]
|
|
46
|
+
})]
|
|
47
|
+
});
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
export { LoginHint as default };
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { useState, useEffect, useMemo } from 'react';
|
|
2
|
+
import { cn } from '../../utils.js';
|
|
3
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Modal component
|
|
7
|
+
* @param props - ModalProps
|
|
8
|
+
* @returns Modal component
|
|
9
|
+
*/
|
|
10
|
+
function Modal(props) {
|
|
11
|
+
const {
|
|
12
|
+
children,
|
|
13
|
+
open,
|
|
14
|
+
onClose,
|
|
15
|
+
placement = "center",
|
|
16
|
+
padding = true,
|
|
17
|
+
shadow = true,
|
|
18
|
+
border = false,
|
|
19
|
+
showCloseIcon = true,
|
|
20
|
+
borderRadius = "large"
|
|
21
|
+
} = props;
|
|
22
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
23
|
+
useEffect(() => {
|
|
24
|
+
if (open) {
|
|
25
|
+
document.body.style.overflow = "hidden";
|
|
26
|
+
// Give a very small delay for the animation to start from the correct position
|
|
27
|
+
setTimeout(() => {
|
|
28
|
+
setIsOpen(true);
|
|
29
|
+
}, 50);
|
|
30
|
+
} else {
|
|
31
|
+
setIsOpen(false);
|
|
32
|
+
// Remove overflow styling to enable scroll again.
|
|
33
|
+
document.body.style.overflow = "";
|
|
34
|
+
}
|
|
35
|
+
}, [open]);
|
|
36
|
+
const positions = useMemo(() => ({
|
|
37
|
+
center: "w3a--top-0 w3a--left-0 w3a--items-center w3a--justify-center",
|
|
38
|
+
"top-center": "w3a--top-8 w3a--left-0 w3a--items-start w3a--justify-center",
|
|
39
|
+
"bottom-center": "w3a--bottom-8 w3a--left-0 w3a--items-end w3a--justify-center",
|
|
40
|
+
left: "sm:w3a--left-8 w3a--flex w3a--items-center w3a--justify-center sm:w3a--justify-start",
|
|
41
|
+
right: "sm:w3a--right-8 w3a--flex w3a--items-center w3a--justify-center sm:w3a--justify-end"
|
|
42
|
+
}), []);
|
|
43
|
+
const placementClass = useMemo(() => positions[placement], [placement, positions]);
|
|
44
|
+
const onCloseHandler = () => {
|
|
45
|
+
if (onClose) onClose();
|
|
46
|
+
};
|
|
47
|
+
return /*#__PURE__*/jsx("div", {
|
|
48
|
+
className: cn("w3a--fixed w3a--z-50 w3a--overflow-hidden w3a--flex w3a--transition-all", placementClass, {
|
|
49
|
+
"w3a--w-screen w3a--h-screen": isOpen,
|
|
50
|
+
"w3a--w-0 w3a--h-0 w3a--delay-500": !isOpen
|
|
51
|
+
}),
|
|
52
|
+
children: /*#__PURE__*/jsxs("div", {
|
|
53
|
+
className: cn("w3a--bg-app-light-surface1 dark:w3a--bg-app-dark-surface-main w3a--w-[356px] [@media(min-width:375px)]:w3a--w-[393px] w3a--h-auto w3a--flex w3a--flex-col w3a--duration-500", {
|
|
54
|
+
"w3a--translate-y-0 w3a--delay-100": isOpen,
|
|
55
|
+
"w3a--translate-y-[100vh]": !isOpen,
|
|
56
|
+
"w3a--p-4": padding,
|
|
57
|
+
"w3a--shadow-xl sm:w3a--shadow-lg": shadow,
|
|
58
|
+
"w3a--border w3a--border-app-gray-100 dark:w3a--border-app-gray-800": border,
|
|
59
|
+
"w3a--rounded-[30px]": borderRadius === "large",
|
|
60
|
+
"w3a--rounded-2xl": borderRadius === "medium",
|
|
61
|
+
"w3a--rounded-none": borderRadius === "small"
|
|
62
|
+
}),
|
|
63
|
+
children: [showCloseIcon && /*#__PURE__*/jsx("div", {
|
|
64
|
+
className: "w3a--absolute w3a--right-6 w3a--top-[30px] w3a--z-10 w3a--cursor-pointer",
|
|
65
|
+
children: /*#__PURE__*/jsx("svg", {
|
|
66
|
+
width: "13",
|
|
67
|
+
height: "13",
|
|
68
|
+
viewBox: "0 0 13 13",
|
|
69
|
+
fill: "none",
|
|
70
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
71
|
+
onClick: onCloseHandler,
|
|
72
|
+
className: "w3a--text-app-gray-500 dark:w3a--text-app-gray-200",
|
|
73
|
+
children: /*#__PURE__*/jsx("path", {
|
|
74
|
+
fillRule: "evenodd",
|
|
75
|
+
clipRule: "evenodd",
|
|
76
|
+
d: "M0.292787 1.29299C0.480314 1.10552 0.734622 1.0002 0.999786 1.0002C1.26495 1.0002 1.51926 1.10552 1.70679 1.29299L5.99979 5.58599L10.2928 1.29299C10.385 1.19748 10.4954 1.1213 10.6174 1.06889C10.7394 1.01648 10.8706 0.988893 11.0034 0.987739C11.1362 0.986585 11.2678 1.01189 11.3907 1.06217C11.5136 1.11245 11.6253 1.1867 11.7192 1.28059C11.8131 1.37449 11.8873 1.48614 11.9376 1.60904C11.9879 1.73193 12.0132 1.86361 12.012 1.99639C12.0109 2.12917 11.9833 2.26039 11.9309 2.38239C11.8785 2.5044 11.8023 2.61474 11.7068 2.70699L7.41379 6.99999L11.7068 11.293C11.8889 11.4816 11.9897 11.7342 11.9875 11.9964C11.9852 12.2586 11.88 12.5094 11.6946 12.6948C11.5092 12.8802 11.2584 12.9854 10.9962 12.9877C10.734 12.9899 10.4814 12.8891 10.2928 12.707L5.99979 8.41399L1.70679 12.707C1.51818 12.8891 1.26558 12.9899 1.00339 12.9877C0.741188 12.9854 0.490376 12.8802 0.304968 12.6948C0.11956 12.5094 0.0143906 12.2586 0.0121121 11.9964C0.00983372 11.7342 0.110629 11.4816 0.292787 11.293L4.58579 6.99999L0.292787 2.70699C0.105316 2.51946 0 2.26515 0 1.99999C0 1.73483 0.105316 1.48052 0.292787 1.29299V1.29299Z",
|
|
77
|
+
fill: "currentColor"
|
|
78
|
+
})
|
|
79
|
+
})
|
|
80
|
+
}), children]
|
|
81
|
+
})
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export { Modal as default };
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
import { forwardRef, useState, useRef, useEffect } from 'react';
|
|
2
|
+
import { useTranslation } from 'react-i18next';
|
|
3
|
+
import i18nInstance from '../../localeImport.js';
|
|
4
|
+
import { cn } from '../../utils.js';
|
|
5
|
+
import PulseLoader from '../PulseLoader/PulseLoader.js';
|
|
6
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
7
|
+
|
|
8
|
+
const OtpInput = /*#__PURE__*/forwardRef(({
|
|
9
|
+
length,
|
|
10
|
+
loading,
|
|
11
|
+
resendTimer = 60,
|
|
12
|
+
onComplete,
|
|
13
|
+
onChange,
|
|
14
|
+
error = false,
|
|
15
|
+
success = false,
|
|
16
|
+
disabled = false,
|
|
17
|
+
classes,
|
|
18
|
+
helperText = "",
|
|
19
|
+
onResendTimer,
|
|
20
|
+
showCta = true,
|
|
21
|
+
showTimer = true,
|
|
22
|
+
autoFocus = false,
|
|
23
|
+
placeholder = "",
|
|
24
|
+
autoComplete = "one-time-code",
|
|
25
|
+
type = "text",
|
|
26
|
+
resendBtnText = ""
|
|
27
|
+
}, ref) => {
|
|
28
|
+
const [otpArray, setOtpArray] = useState(Array(length).fill(""));
|
|
29
|
+
const [timer, setTimer] = useState(resendTimer !== null && resendTimer !== void 0 ? resendTimer : 0);
|
|
30
|
+
const [t] = useTranslation(undefined, {
|
|
31
|
+
i18n: i18nInstance
|
|
32
|
+
});
|
|
33
|
+
const inputRefs = useRef([]);
|
|
34
|
+
const isInputValueValid = value => {
|
|
35
|
+
return /^\d$/.test(value) && value.trim().length === 1;
|
|
36
|
+
};
|
|
37
|
+
const handleKeyDown = (e, index) => {
|
|
38
|
+
if (e.key === "Backspace" || e.key === "Delete") {
|
|
39
|
+
e.preventDefault();
|
|
40
|
+
const newOtpArray = [...otpArray];
|
|
41
|
+
if (otpArray[index] !== "") {
|
|
42
|
+
newOtpArray[index] = "";
|
|
43
|
+
} else if (index > 0) {
|
|
44
|
+
var _inputRefs$current;
|
|
45
|
+
(_inputRefs$current = inputRefs.current[index - 1]) === null || _inputRefs$current === void 0 || _inputRefs$current.focus();
|
|
46
|
+
newOtpArray[index - 1] = "";
|
|
47
|
+
}
|
|
48
|
+
setOtpArray(newOtpArray);
|
|
49
|
+
if (onChange) onChange(newOtpArray.join(""));
|
|
50
|
+
} else if (e.key === "ArrowLeft") {
|
|
51
|
+
var _inputRefs$current2;
|
|
52
|
+
e.preventDefault();
|
|
53
|
+
(_inputRefs$current2 = inputRefs.current[index - 1]) === null || _inputRefs$current2 === void 0 || _inputRefs$current2.focus();
|
|
54
|
+
} else if (e.key === "ArrowRight") {
|
|
55
|
+
var _inputRefs$current3;
|
|
56
|
+
e.preventDefault();
|
|
57
|
+
(_inputRefs$current3 = inputRefs.current[index + 1]) === null || _inputRefs$current3 === void 0 || _inputRefs$current3.focus();
|
|
58
|
+
} else if (e.key === " " || e.key === "Spacebar" || e.key === "Space" || !isInputValueValid(e.key) && inputRefs.current[index + 1]) {
|
|
59
|
+
e.preventDefault();
|
|
60
|
+
inputRefs.current[index + 1].value = "";
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
const handleInputChange = (e, index) => {
|
|
64
|
+
e.preventDefault();
|
|
65
|
+
const {
|
|
66
|
+
value
|
|
67
|
+
} = e.target;
|
|
68
|
+
if (value && value.length > 1 && value.length === length) {
|
|
69
|
+
var _inputRefs$current4;
|
|
70
|
+
const pastedOtp = value.split("");
|
|
71
|
+
const newOtpArray = [...otpArray];
|
|
72
|
+
pastedOtp.forEach((key, idx) => {
|
|
73
|
+
newOtpArray[idx] = key;
|
|
74
|
+
});
|
|
75
|
+
setOtpArray(newOtpArray);
|
|
76
|
+
(_inputRefs$current4 = inputRefs.current[pastedOtp.length === length ? length - 1 : pastedOtp.length]) === null || _inputRefs$current4 === void 0 || _inputRefs$current4.focus();
|
|
77
|
+
if (onComplete && length === newOtpArray.length) onComplete(newOtpArray.join(""));
|
|
78
|
+
} else if (isInputValueValid(value)) {
|
|
79
|
+
const newOtpArray = [...otpArray].slice(0, length);
|
|
80
|
+
newOtpArray[index] = value;
|
|
81
|
+
setOtpArray(newOtpArray);
|
|
82
|
+
const otp = newOtpArray.join("");
|
|
83
|
+
// Move focus to the next input
|
|
84
|
+
if (index < length - 1 && inputRefs.current[index + 1]) {
|
|
85
|
+
var _inputRefs$current5;
|
|
86
|
+
(_inputRefs$current5 = inputRefs.current[index + 1]) === null || _inputRefs$current5 === void 0 || _inputRefs$current5.focus();
|
|
87
|
+
}
|
|
88
|
+
if (onChange) onChange(value);
|
|
89
|
+
if (onComplete && length === otp.length) onComplete(otp);
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
const handlePaste = e => {
|
|
93
|
+
e.preventDefault();
|
|
94
|
+
const pastedData = e.clipboardData.getData("text").slice(0, length);
|
|
95
|
+
if (pastedData && /^\d+$/.test(pastedData)) {
|
|
96
|
+
var _inputRefs$current6;
|
|
97
|
+
const pastedOtp = pastedData.split("");
|
|
98
|
+
const newOtpArray = [...otpArray];
|
|
99
|
+
pastedOtp.forEach((key, index) => {
|
|
100
|
+
newOtpArray[index] = key;
|
|
101
|
+
});
|
|
102
|
+
setOtpArray(newOtpArray);
|
|
103
|
+
(_inputRefs$current6 = inputRefs.current[pastedOtp.length === length ? length - 1 : pastedOtp.length]) === null || _inputRefs$current6 === void 0 || _inputRefs$current6.focus();
|
|
104
|
+
if (onComplete && length === newOtpArray.length) onComplete(newOtpArray.join(""));
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
const handleResendClick = () => {
|
|
108
|
+
setTimer(resendTimer || 0);
|
|
109
|
+
if (onResendTimer) onResendTimer();
|
|
110
|
+
};
|
|
111
|
+
useEffect(() => {
|
|
112
|
+
let interval = null;
|
|
113
|
+
// Start the resend timer
|
|
114
|
+
if (showCta && showTimer) {
|
|
115
|
+
interval = window.setInterval(() => {
|
|
116
|
+
if (timer > 0) {
|
|
117
|
+
setTimer(prev => prev - 1);
|
|
118
|
+
} else {
|
|
119
|
+
clearInterval(interval);
|
|
120
|
+
}
|
|
121
|
+
}, 1000);
|
|
122
|
+
}
|
|
123
|
+
return () => {
|
|
124
|
+
clearInterval(interval);
|
|
125
|
+
};
|
|
126
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
127
|
+
}, [timer]);
|
|
128
|
+
useEffect(() => {
|
|
129
|
+
if (inputRefs && autoFocus) {
|
|
130
|
+
var _inputRefs$current7;
|
|
131
|
+
(_inputRefs$current7 = inputRefs.current) === null || _inputRefs$current7 === void 0 || _inputRefs$current7[0].focus();
|
|
132
|
+
}
|
|
133
|
+
}, [autoFocus]);
|
|
134
|
+
const helperTextClass = cn("w3a--text-xs w3a--font-normal w3a--text-app-gray-500 dark:w3a--text-app-white w3a--mt-2", {
|
|
135
|
+
"w3a--text-app-red-500 dark:w3a--text-app-red-400": error,
|
|
136
|
+
"w3a--text-app-green-500 dark:w3a--text-app-green-400": success
|
|
137
|
+
}, classes === null || classes === void 0 ? void 0 : classes.helperText);
|
|
138
|
+
const inputKey = new Date().getFullYear();
|
|
139
|
+
return /*#__PURE__*/jsxs("div", {
|
|
140
|
+
className: cn("w3a--flex w3a--flex-col w3a--items-center", classes === null || classes === void 0 ? void 0 : classes.root),
|
|
141
|
+
ref: ref,
|
|
142
|
+
children: [/*#__PURE__*/jsx("form", {
|
|
143
|
+
className: cn("w3a--flex w3a--space-x-2", classes === null || classes === void 0 ? void 0 : classes.inputContainer),
|
|
144
|
+
children: otpArray.map((digit, index) => {
|
|
145
|
+
var _classes$success, _classes$error, _classes$disabled;
|
|
146
|
+
return /*#__PURE__*/jsx("input", {
|
|
147
|
+
id: `${inputKey + index}`,
|
|
148
|
+
type: type,
|
|
149
|
+
value: digit,
|
|
150
|
+
autoComplete: autoComplete,
|
|
151
|
+
placeholder: Array.isArray(placeholder) ? placeholder[index] : placeholder,
|
|
152
|
+
inputMode: "numeric",
|
|
153
|
+
onInput: e => handleInputChange(e, index),
|
|
154
|
+
onKeyUp: e => handleKeyDown(e, index),
|
|
155
|
+
onPaste: handlePaste,
|
|
156
|
+
className: cn("w3a--w-12 w3a--h-[42px] w3a--rounded-full w3a--border w3a--text-center w3a--text-xl w3a--focus:outline-none w3a--active:outline-none w3a--focus:border-app-primary-600 dark:w3a--focus:border-app-primary-500 w3a--border-app-gray-300 dark:w3a--border-app-gray-500 w3a--bg-app-gray-50 dark:w3a--bg-app-gray-700 w3a--text-app-gray-900 dark:w3a--text-app-white", success && ((_classes$success = classes === null || classes === void 0 ? void 0 : classes.success) !== null && _classes$success !== void 0 ? _classes$success : "w3a--border-app-green-400 dark:w3a--border-app-green-500 w3a--focus:w3a--border-app-green-400 dark:w3a--focus:w3a--border-app-green-500"), error && ((_classes$error = classes === null || classes === void 0 ? void 0 : classes.error) !== null && _classes$error !== void 0 ? _classes$error : "w3a--border-app-red-600 dark:w3a--border-app-red-500 w3a--focus:w3a--border-app-red-600 dark:w3a--focus:w3a--border-app-red-500"), disabled && ((_classes$disabled = classes === null || classes === void 0 ? void 0 : classes.disabled) !== null && _classes$disabled !== void 0 ? _classes$disabled : "w3a--border-app-gray-200 w3a--bg-app-gray-200 dark:w3a--border-app-gray-700 w3a--focus:w3a--border-app-gray-200 dark:w3a--focus:w3a--border-app-gray-700 w3a--cursor-not-allowed"), classes === null || classes === void 0 ? void 0 : classes.input),
|
|
157
|
+
ref: el => {
|
|
158
|
+
inputRefs.current[index] = el;
|
|
159
|
+
},
|
|
160
|
+
disabled: disabled
|
|
161
|
+
}, `${inputKey + index}`);
|
|
162
|
+
})
|
|
163
|
+
}), helperText && /*#__PURE__*/jsx("p", {
|
|
164
|
+
className: helperTextClass,
|
|
165
|
+
children: helperText
|
|
166
|
+
}), loading && /*#__PURE__*/jsx("div", {
|
|
167
|
+
className: "w3a--mt-3",
|
|
168
|
+
children: /*#__PURE__*/jsx(PulseLoader, {})
|
|
169
|
+
}), showCta && !loading && /*#__PURE__*/jsx("div", {
|
|
170
|
+
className: cn("w3a--flex w3a--items-center w3a--mt-3", classes === null || classes === void 0 ? void 0 : classes.ctaContainer),
|
|
171
|
+
children: timer > 0 && showTimer ? /*#__PURE__*/jsx("span", {
|
|
172
|
+
className: cn("w3a--text-xs w3a--text-app-gray-500 dark:w3a--text-app-gray-400", classes === null || classes === void 0 ? void 0 : classes.timerText),
|
|
173
|
+
children: t("modal.resendTimer", {
|
|
174
|
+
timer: timer
|
|
175
|
+
})
|
|
176
|
+
}) : /*#__PURE__*/jsx("button", {
|
|
177
|
+
type: "button",
|
|
178
|
+
className: cn("w3a--text-xs w3a--p-0 w3a--text-app-primary-600 dark:w3a--text-app-primary-500", classes === null || classes === void 0 ? void 0 : classes.resendBtnText),
|
|
179
|
+
onClick: handleResendClick,
|
|
180
|
+
disabled: timer > 0 && showTimer,
|
|
181
|
+
children: resendBtnText || t("modal.resendCode")
|
|
182
|
+
})
|
|
183
|
+
})]
|
|
184
|
+
});
|
|
185
|
+
});
|
|
186
|
+
OtpInput.displayName = "OtpInput";
|
|
187
|
+
|
|
188
|
+
export { OtpInput as default };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
+
|
|
3
|
+
const PulseLoader = () => {
|
|
4
|
+
return /*#__PURE__*/jsxs("div", {
|
|
5
|
+
className: "w3a--flex w3a--items-center w3a--justify-center w3a--gap-x-2",
|
|
6
|
+
children: [/*#__PURE__*/jsx("div", {
|
|
7
|
+
className: "w3a--animate-circle w3a--bg-app-gray-500 dark:w3a--bg-app-gray-200"
|
|
8
|
+
}), /*#__PURE__*/jsx("div", {
|
|
9
|
+
className: "w3a--animate-circle w3a--bg-app-gray-400 dark:w3a--bg-app-gray-400"
|
|
10
|
+
}), /*#__PURE__*/jsx("div", {
|
|
11
|
+
className: "w3a--animate-circle w3a--bg-app-gray-200 dark:w3a--bg-app-gray-600"
|
|
12
|
+
})]
|
|
13
|
+
});
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export { PulseLoader as default };
|