@dynamic-labs-sdk/react-ui 0.0.0 → 1.51.0
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/README.md +71 -0
- package/dist/components/Badge/Badge.d.ts +33 -0
- package/dist/components/Badge/Badge.d.ts.map +1 -0
- package/dist/components/Badge/index.d.ts +3 -0
- package/dist/components/Badge/index.d.ts.map +1 -0
- package/dist/components/Button/Button.d.ts +65 -0
- package/dist/components/Button/Button.d.ts.map +1 -0
- package/dist/components/Button/index.d.ts +3 -0
- package/dist/components/Button/index.d.ts.map +1 -0
- package/dist/components/Checkbox/Checkbox.d.ts +56 -0
- package/dist/components/Checkbox/Checkbox.d.ts.map +1 -0
- package/dist/components/Checkbox/index.d.ts +3 -0
- package/dist/components/Checkbox/index.d.ts.map +1 -0
- package/dist/components/CheckboxField/CheckboxField.d.ts +63 -0
- package/dist/components/CheckboxField/CheckboxField.d.ts.map +1 -0
- package/dist/components/CheckboxField/index.d.ts +3 -0
- package/dist/components/CheckboxField/index.d.ts.map +1 -0
- package/dist/components/CopyButton/CopyButton.d.ts +48 -0
- package/dist/components/CopyButton/CopyButton.d.ts.map +1 -0
- package/dist/components/CopyButton/CopyButton.text.d.ts +12 -0
- package/dist/components/CopyButton/CopyButton.text.d.ts.map +1 -0
- package/dist/components/CopyButton/index.d.ts +3 -0
- package/dist/components/CopyButton/index.d.ts.map +1 -0
- package/dist/components/CopyField/CopyField.d.ts +57 -0
- package/dist/components/CopyField/CopyField.d.ts.map +1 -0
- package/dist/components/CopyField/CopyField.text.d.ts +13 -0
- package/dist/components/CopyField/CopyField.text.d.ts.map +1 -0
- package/dist/components/CopyField/index.d.ts +3 -0
- package/dist/components/CopyField/index.d.ts.map +1 -0
- package/dist/components/CopyMorphIcon/CopyMorphIcon.d.ts +38 -0
- package/dist/components/CopyMorphIcon/CopyMorphIcon.d.ts.map +1 -0
- package/dist/components/CopyMorphIcon/index.d.ts +3 -0
- package/dist/components/CopyMorphIcon/index.d.ts.map +1 -0
- package/dist/components/CopyText/CopyText.d.ts +50 -0
- package/dist/components/CopyText/CopyText.d.ts.map +1 -0
- package/dist/components/CopyText/CopyText.text.d.ts +13 -0
- package/dist/components/CopyText/CopyText.text.d.ts.map +1 -0
- package/dist/components/CopyText/index.d.ts +3 -0
- package/dist/components/CopyText/index.d.ts.map +1 -0
- package/dist/components/DynamicUiProvider/DynamicUiProvider.d.ts +49 -0
- package/dist/components/DynamicUiProvider/DynamicUiProvider.d.ts.map +1 -0
- package/dist/components/DynamicUiProvider/index.d.ts +3 -0
- package/dist/components/DynamicUiProvider/index.d.ts.map +1 -0
- package/dist/components/Panel/Panel.d.ts +50 -0
- package/dist/components/Panel/Panel.d.ts.map +1 -0
- package/dist/components/Panel/index.d.ts +3 -0
- package/dist/components/Panel/index.d.ts.map +1 -0
- package/dist/components/Panel/usePanel/index.d.ts +3 -0
- package/dist/components/Panel/usePanel/index.d.ts.map +1 -0
- package/dist/components/Panel/usePanel/usePanel.d.ts +30 -0
- package/dist/components/Panel/usePanel/usePanel.d.ts.map +1 -0
- package/dist/components/PanelHeader/PanelHeader.d.ts +50 -0
- package/dist/components/PanelHeader/PanelHeader.d.ts.map +1 -0
- package/dist/components/PanelHeader/PanelHeader.text.d.ts +12 -0
- package/dist/components/PanelHeader/PanelHeader.text.d.ts.map +1 -0
- package/dist/components/PanelHeader/index.d.ts +3 -0
- package/dist/components/PanelHeader/index.d.ts.map +1 -0
- package/dist/components/PanelHeader/usePanelHeader/index.d.ts +3 -0
- package/dist/components/PanelHeader/usePanelHeader/index.d.ts.map +1 -0
- package/dist/components/PanelHeader/usePanelHeader/usePanelHeader.d.ts +33 -0
- package/dist/components/PanelHeader/usePanelHeader/usePanelHeader.d.ts.map +1 -0
- package/dist/components/PanelHost/PanelHost.d.ts +48 -0
- package/dist/components/PanelHost/PanelHost.d.ts.map +1 -0
- package/dist/components/PanelHost/PanelHostCard/PanelHostCard.d.ts +37 -0
- package/dist/components/PanelHost/PanelHostCard/PanelHostCard.d.ts.map +1 -0
- package/dist/components/PanelHost/PanelHostCard/index.d.ts +3 -0
- package/dist/components/PanelHost/PanelHostCard/index.d.ts.map +1 -0
- package/dist/components/PanelHost/PanelHostContext/PanelHostContext.d.ts +49 -0
- package/dist/components/PanelHost/PanelHostContext/PanelHostContext.d.ts.map +1 -0
- package/dist/components/PanelHost/PanelHostContext/index.d.ts +3 -0
- package/dist/components/PanelHost/PanelHostContext/index.d.ts.map +1 -0
- package/dist/components/PanelHost/findChoice/findChoice.d.ts +27 -0
- package/dist/components/PanelHost/findChoice/findChoice.d.ts.map +1 -0
- package/dist/components/PanelHost/findChoice/index.d.ts +3 -0
- package/dist/components/PanelHost/findChoice/index.d.ts.map +1 -0
- package/dist/components/PanelHost/focusAfterScreenChange/focusAfterScreenChange.d.ts +38 -0
- package/dist/components/PanelHost/focusAfterScreenChange/focusAfterScreenChange.d.ts.map +1 -0
- package/dist/components/PanelHost/focusAfterScreenChange/index.d.ts +3 -0
- package/dist/components/PanelHost/focusAfterScreenChange/index.d.ts.map +1 -0
- package/dist/components/PanelHost/getChoiceLabel/getChoiceLabel.d.ts +21 -0
- package/dist/components/PanelHost/getChoiceLabel/getChoiceLabel.d.ts.map +1 -0
- package/dist/components/PanelHost/getChoiceLabel/index.d.ts +3 -0
- package/dist/components/PanelHost/getChoiceLabel/index.d.ts.map +1 -0
- package/dist/components/PanelHost/getFocusableElements/getFocusableElements.d.ts +22 -0
- package/dist/components/PanelHost/getFocusableElements/getFocusableElements.d.ts.map +1 -0
- package/dist/components/PanelHost/getFocusableElements/index.d.ts +3 -0
- package/dist/components/PanelHost/getFocusableElements/index.d.ts.map +1 -0
- package/dist/components/PanelHost/getFocusedChoice/getFocusedChoice.d.ts +33 -0
- package/dist/components/PanelHost/getFocusedChoice/getFocusedChoice.d.ts.map +1 -0
- package/dist/components/PanelHost/getFocusedChoice/index.d.ts +3 -0
- package/dist/components/PanelHost/getFocusedChoice/index.d.ts.map +1 -0
- package/dist/components/PanelHost/index.d.ts +3 -0
- package/dist/components/PanelHost/index.d.ts.map +1 -0
- package/dist/components/PanelHost/isFilledSearchField/index.d.ts +3 -0
- package/dist/components/PanelHost/isFilledSearchField/index.d.ts.map +1 -0
- package/dist/components/PanelHost/isFilledSearchField/isFilledSearchField.d.ts +22 -0
- package/dist/components/PanelHost/isFilledSearchField/isFilledSearchField.d.ts.map +1 -0
- package/dist/components/PanelHost/observeCardHeight/index.d.ts +3 -0
- package/dist/components/PanelHost/observeCardHeight/index.d.ts.map +1 -0
- package/dist/components/PanelHost/observeCardHeight/observeCardHeight.d.ts +29 -0
- package/dist/components/PanelHost/observeCardHeight/observeCardHeight.d.ts.map +1 -0
- package/dist/components/PanelHost/popChoiceForTitle/index.d.ts +3 -0
- package/dist/components/PanelHost/popChoiceForTitle/index.d.ts.map +1 -0
- package/dist/components/PanelHost/popChoiceForTitle/popChoiceForTitle.d.ts +39 -0
- package/dist/components/PanelHost/popChoiceForTitle/popChoiceForTitle.d.ts.map +1 -0
- package/dist/components/PanelHost/useCardHeight/index.d.ts +3 -0
- package/dist/components/PanelHost/useCardHeight/index.d.ts.map +1 -0
- package/dist/components/PanelHost/useCardHeight/useCardHeight.d.ts +29 -0
- package/dist/components/PanelHost/useCardHeight/useCardHeight.d.ts.map +1 -0
- package/dist/components/PanelHost/useNavigationGate/index.d.ts +3 -0
- package/dist/components/PanelHost/useNavigationGate/index.d.ts.map +1 -0
- package/dist/components/PanelHost/useNavigationGate/useNavigationGate.d.ts +22 -0
- package/dist/components/PanelHost/useNavigationGate/useNavigationGate.d.ts.map +1 -0
- package/dist/components/PanelHost/usePanelHost/index.d.ts +3 -0
- package/dist/components/PanelHost/usePanelHost/index.d.ts.map +1 -0
- package/dist/components/PanelHost/usePanelHost/usePanelHost.d.ts +48 -0
- package/dist/components/PanelHost/usePanelHost/usePanelHost.d.ts.map +1 -0
- package/dist/components/PanelHost/useScreenFocus/index.d.ts +3 -0
- package/dist/components/PanelHost/useScreenFocus/index.d.ts.map +1 -0
- package/dist/components/PanelHost/useScreenFocus/useScreenFocus.d.ts +45 -0
- package/dist/components/PanelHost/useScreenFocus/useScreenFocus.d.ts.map +1 -0
- package/dist/components/ProviderIcon/ProviderIcon.d.ts +48 -0
- package/dist/components/ProviderIcon/ProviderIcon.d.ts.map +1 -0
- package/dist/components/ProviderIcon/index.d.ts +3 -0
- package/dist/components/ProviderIcon/index.d.ts.map +1 -0
- package/dist/components/ProviderOption/ProviderOption.d.ts +56 -0
- package/dist/components/ProviderOption/ProviderOption.d.ts.map +1 -0
- package/dist/components/ProviderOption/index.d.ts +3 -0
- package/dist/components/ProviderOption/index.d.ts.map +1 -0
- package/dist/components/QRCode/QRCode.constants.d.ts +45 -0
- package/dist/components/QRCode/QRCode.constants.d.ts.map +1 -0
- package/dist/components/QRCode/QRCode.d.ts +86 -0
- package/dist/components/QRCode/QRCode.d.ts.map +1 -0
- package/dist/components/QRCode/QRCode.text.d.ts +16 -0
- package/dist/components/QRCode/QRCode.text.d.ts.map +1 -0
- package/dist/components/QRCode/buildQrCodeOptions/buildQrCodeOptions.d.ts +31 -0
- package/dist/components/QRCode/buildQrCodeOptions/buildQrCodeOptions.d.ts.map +1 -0
- package/dist/components/QRCode/buildQrCodeOptions/index.d.ts +3 -0
- package/dist/components/QRCode/buildQrCodeOptions/index.d.ts.map +1 -0
- package/dist/components/QRCode/decorateQrReveal/decorateQrReveal.d.ts +20 -0
- package/dist/components/QRCode/decorateQrReveal/decorateQrReveal.d.ts.map +1 -0
- package/dist/components/QRCode/decorateQrReveal/index.d.ts +2 -0
- package/dist/components/QRCode/decorateQrReveal/index.d.ts.map +1 -0
- package/dist/components/QRCode/index.d.ts +3 -0
- package/dist/components/QRCode/index.d.ts.map +1 -0
- package/dist/components/QRCode/logoOverlayPx/index.d.ts +3 -0
- package/dist/components/QRCode/logoOverlayPx/index.d.ts.map +1 -0
- package/dist/components/QRCode/logoOverlayPx/logoOverlayPx.d.ts +28 -0
- package/dist/components/QRCode/logoOverlayPx/logoOverlayPx.d.ts.map +1 -0
- package/dist/components/QRCode/pollForQrReveal/index.d.ts +3 -0
- package/dist/components/QRCode/pollForQrReveal/index.d.ts.map +1 -0
- package/dist/components/QRCode/pollForQrReveal/pollForQrReveal.d.ts +39 -0
- package/dist/components/QRCode/pollForQrReveal/pollForQrReveal.d.ts.map +1 -0
- package/dist/components/QRCode/snapQrGeometry/index.d.ts +3 -0
- package/dist/components/QRCode/snapQrGeometry/index.d.ts.map +1 -0
- package/dist/components/QRCode/snapQrGeometry/snapQrGeometry.d.ts +35 -0
- package/dist/components/QRCode/snapQrGeometry/snapQrGeometry.d.ts.map +1 -0
- package/dist/components/QRCode/useQrCode/index.d.ts +3 -0
- package/dist/components/QRCode/useQrCode/index.d.ts.map +1 -0
- package/dist/components/QRCode/useQrCode/useQrCode.d.ts +55 -0
- package/dist/components/QRCode/useQrCode/useQrCode.d.ts.map +1 -0
- package/dist/components/SearchBar/SearchBar.d.ts +56 -0
- package/dist/components/SearchBar/SearchBar.d.ts.map +1 -0
- package/dist/components/SearchBar/SearchBar.text.d.ts +12 -0
- package/dist/components/SearchBar/SearchBar.text.d.ts.map +1 -0
- package/dist/components/SearchBar/index.d.ts +3 -0
- package/dist/components/SearchBar/index.d.ts.map +1 -0
- package/dist/components/Select/Select.d.ts +88 -0
- package/dist/components/Select/Select.d.ts.map +1 -0
- package/dist/components/Select/Select.text.d.ts +13 -0
- package/dist/components/Select/Select.text.d.ts.map +1 -0
- package/dist/components/Select/SelectPopover/SelectPopover.d.ts +116 -0
- package/dist/components/Select/SelectPopover/SelectPopover.d.ts.map +1 -0
- package/dist/components/Select/SelectPopover/index.d.ts +3 -0
- package/dist/components/Select/SelectPopover/index.d.ts.map +1 -0
- package/dist/components/Select/index.d.ts +3 -0
- package/dist/components/Select/index.d.ts.map +1 -0
- package/dist/components/Select/useSelect/index.d.ts +3 -0
- package/dist/components/Select/useSelect/index.d.ts.map +1 -0
- package/dist/components/Select/useSelect/useSelect.d.ts +106 -0
- package/dist/components/Select/useSelect/useSelect.d.ts.map +1 -0
- package/dist/components/TokenBalanceOption/TokenBalanceOption.d.ts +64 -0
- package/dist/components/TokenBalanceOption/TokenBalanceOption.d.ts.map +1 -0
- package/dist/components/TokenBalanceOption/index.d.ts +3 -0
- package/dist/components/TokenBalanceOption/index.d.ts.map +1 -0
- package/dist/components/TokenMark/TokenMark.d.ts +52 -0
- package/dist/components/TokenMark/TokenMark.d.ts.map +1 -0
- package/dist/components/TokenMark/index.d.ts +3 -0
- package/dist/components/TokenMark/index.d.ts.map +1 -0
- package/dist/components/TokenMark/useTokenMark/index.d.ts +3 -0
- package/dist/components/TokenMark/useTokenMark/index.d.ts.map +1 -0
- package/dist/components/TokenMark/useTokenMark/useTokenMark.d.ts +40 -0
- package/dist/components/TokenMark/useTokenMark/useTokenMark.d.ts.map +1 -0
- package/dist/exports/flow.d.ts +10 -0
- package/dist/exports/flow.d.ts.map +1 -0
- package/dist/exports/index.d.ts +58 -0
- package/dist/exports/index.d.ts.map +1 -0
- package/dist/flow/components/FlowErrorBanner/FlowErrorBanner.d.ts +52 -0
- package/dist/flow/components/FlowErrorBanner/FlowErrorBanner.d.ts.map +1 -0
- package/dist/flow/components/FlowErrorBanner/index.d.ts +3 -0
- package/dist/flow/components/FlowErrorBanner/index.d.ts.map +1 -0
- package/dist/flow/components/FlowLoader/FlowLoader.constants.d.ts +3 -0
- package/dist/flow/components/FlowLoader/FlowLoader.constants.d.ts.map +1 -0
- package/dist/flow/components/FlowLoader/FlowLoader.d.ts +51 -0
- package/dist/flow/components/FlowLoader/FlowLoader.d.ts.map +1 -0
- package/dist/flow/components/FlowLoader/index.d.ts +3 -0
- package/dist/flow/components/FlowLoader/index.d.ts.map +1 -0
- package/dist/flow/components/FlowPaymentLedger/FlowPaymentLedger.d.ts +72 -0
- package/dist/flow/components/FlowPaymentLedger/FlowPaymentLedger.d.ts.map +1 -0
- package/dist/flow/components/FlowPaymentLedger/index.d.ts +3 -0
- package/dist/flow/components/FlowPaymentLedger/index.d.ts.map +1 -0
- package/dist/flow/components/FlowPaymentMethodOption/FlowPaymentMethodOption.d.ts +63 -0
- package/dist/flow/components/FlowPaymentMethodOption/FlowPaymentMethodOption.d.ts.map +1 -0
- package/dist/flow/components/FlowPaymentMethodOption/index.d.ts +3 -0
- package/dist/flow/components/FlowPaymentMethodOption/index.d.ts.map +1 -0
- package/dist/flow/components/FlowPaymentStepTracker/FlowPaymentStepTracker.d.ts +56 -0
- package/dist/flow/components/FlowPaymentStepTracker/FlowPaymentStepTracker.d.ts.map +1 -0
- package/dist/flow/components/FlowPaymentStepTracker/FlowPaymentStepTracker.text.d.ts +16 -0
- package/dist/flow/components/FlowPaymentStepTracker/FlowPaymentStepTracker.text.d.ts.map +1 -0
- package/dist/flow/components/FlowPaymentStepTracker/getStepState/getStepState.d.ts +36 -0
- package/dist/flow/components/FlowPaymentStepTracker/getStepState/getStepState.d.ts.map +1 -0
- package/dist/flow/components/FlowPaymentStepTracker/getStepState/index.d.ts +3 -0
- package/dist/flow/components/FlowPaymentStepTracker/getStepState/index.d.ts.map +1 -0
- package/dist/flow/components/FlowPaymentStepTracker/index.d.ts +3 -0
- package/dist/flow/components/FlowPaymentStepTracker/index.d.ts.map +1 -0
- package/dist/flow/components/FlowPaymentStepTracker/stepIcons/StepClockIcon/StepClockIcon.d.ts +19 -0
- package/dist/flow/components/FlowPaymentStepTracker/stepIcons/StepClockIcon/StepClockIcon.d.ts.map +1 -0
- package/dist/flow/components/FlowPaymentStepTracker/stepIcons/StepClockIcon/index.d.ts +2 -0
- package/dist/flow/components/FlowPaymentStepTracker/stepIcons/StepClockIcon/index.d.ts.map +1 -0
- package/dist/flow/components/FlowPaymentStepTracker/stepIcons/StepDoneIcon/StepDoneIcon.d.ts +18 -0
- package/dist/flow/components/FlowPaymentStepTracker/stepIcons/StepDoneIcon/StepDoneIcon.d.ts.map +1 -0
- package/dist/flow/components/FlowPaymentStepTracker/stepIcons/StepDoneIcon/index.d.ts +2 -0
- package/dist/flow/components/FlowPaymentStepTracker/stepIcons/StepDoneIcon/index.d.ts.map +1 -0
- package/dist/flow/components/FlowPaymentStepTracker/stepIcons/StepDotIcon/StepDotIcon.d.ts +17 -0
- package/dist/flow/components/FlowPaymentStepTracker/stepIcons/StepDotIcon/StepDotIcon.d.ts.map +1 -0
- package/dist/flow/components/FlowPaymentStepTracker/stepIcons/StepDotIcon/index.d.ts +2 -0
- package/dist/flow/components/FlowPaymentStepTracker/stepIcons/StepDotIcon/index.d.ts.map +1 -0
- package/dist/flow/components/FlowPaymentSwapTile/FlowPaymentSwapTile.d.ts +38 -0
- package/dist/flow/components/FlowPaymentSwapTile/FlowPaymentSwapTile.d.ts.map +1 -0
- package/dist/flow/components/FlowPaymentSwapTile/FlowPaymentSwapTile.text.d.ts +13 -0
- package/dist/flow/components/FlowPaymentSwapTile/FlowPaymentSwapTile.text.d.ts.map +1 -0
- package/dist/flow/components/FlowPaymentSwapTile/index.d.ts +3 -0
- package/dist/flow/components/FlowPaymentSwapTile/index.d.ts.map +1 -0
- package/dist/flow/components/FlowPill/FlowPill.d.ts +36 -0
- package/dist/flow/components/FlowPill/FlowPill.d.ts.map +1 -0
- package/dist/flow/components/FlowPill/index.d.ts +3 -0
- package/dist/flow/components/FlowPill/index.d.ts.map +1 -0
- package/dist/flow/components/FlowRefundAddressSheet/FlowRefundAddressSheet.constants.d.ts +11 -0
- package/dist/flow/components/FlowRefundAddressSheet/FlowRefundAddressSheet.constants.d.ts.map +1 -0
- package/dist/flow/components/FlowRefundAddressSheet/FlowRefundAddressSheet.d.ts +62 -0
- package/dist/flow/components/FlowRefundAddressSheet/FlowRefundAddressSheet.d.ts.map +1 -0
- package/dist/flow/components/FlowRefundAddressSheet/FlowRefundAddressSheet.text.d.ts +20 -0
- package/dist/flow/components/FlowRefundAddressSheet/FlowRefundAddressSheet.text.d.ts.map +1 -0
- package/dist/flow/components/FlowRefundAddressSheet/index.d.ts +3 -0
- package/dist/flow/components/FlowRefundAddressSheet/index.d.ts.map +1 -0
- package/dist/flow/components/FlowRefundAddressSheet/useFlowRefundAddressSheet/index.d.ts +3 -0
- package/dist/flow/components/FlowRefundAddressSheet/useFlowRefundAddressSheet/index.d.ts.map +1 -0
- package/dist/flow/components/FlowRefundAddressSheet/useFlowRefundAddressSheet/useFlowRefundAddressSheet.d.ts +61 -0
- package/dist/flow/components/FlowRefundAddressSheet/useFlowRefundAddressSheet/useFlowRefundAddressSheet.d.ts.map +1 -0
- package/dist/flow/components/FlowStatusBar/FlowStatusBar.d.ts +42 -0
- package/dist/flow/components/FlowStatusBar/FlowStatusBar.d.ts.map +1 -0
- package/dist/flow/components/FlowStatusBar/index.d.ts +3 -0
- package/dist/flow/components/FlowStatusBar/index.d.ts.map +1 -0
- package/dist/flow/components/FlowStatusHero/FlowStatusHero.d.ts +74 -0
- package/dist/flow/components/FlowStatusHero/FlowStatusHero.d.ts.map +1 -0
- package/dist/flow/components/FlowStatusHero/index.d.ts +3 -0
- package/dist/flow/components/FlowStatusHero/index.d.ts.map +1 -0
- package/dist/flow/components/FlowStatusTray/FlowStatusTray.constants.d.ts +6 -0
- package/dist/flow/components/FlowStatusTray/FlowStatusTray.constants.d.ts.map +1 -0
- package/dist/flow/components/FlowStatusTray/FlowStatusTray.d.ts +49 -0
- package/dist/flow/components/FlowStatusTray/FlowStatusTray.d.ts.map +1 -0
- package/dist/flow/components/FlowStatusTray/index.d.ts +3 -0
- package/dist/flow/components/FlowStatusTray/index.d.ts.map +1 -0
- package/dist/flow/components/FlowStatusTray/useFlowStatusTray/index.d.ts +3 -0
- package/dist/flow/components/FlowStatusTray/useFlowStatusTray/index.d.ts.map +1 -0
- package/dist/flow/components/FlowStatusTray/useFlowStatusTray/useFlowStatusTray.d.ts +37 -0
- package/dist/flow/components/FlowStatusTray/useFlowStatusTray/useFlowStatusTray.d.ts.map +1 -0
- package/dist/flow/components/FlowSwapTile/FlowSwapTile.d.ts +55 -0
- package/dist/flow/components/FlowSwapTile/FlowSwapTile.d.ts.map +1 -0
- package/dist/flow/components/FlowSwapTile/FlowSwapTile.text.d.ts +14 -0
- package/dist/flow/components/FlowSwapTile/FlowSwapTile.text.d.ts.map +1 -0
- package/dist/flow/components/FlowSwapTile/FlowSwapTileSide/FlowSwapTileSide.d.ts +50 -0
- package/dist/flow/components/FlowSwapTile/FlowSwapTileSide/FlowSwapTileSide.d.ts.map +1 -0
- package/dist/flow/components/FlowSwapTile/FlowSwapTileSide/index.d.ts +3 -0
- package/dist/flow/components/FlowSwapTile/FlowSwapTileSide/index.d.ts.map +1 -0
- package/dist/flow/components/FlowSwapTile/index.d.ts +4 -0
- package/dist/flow/components/FlowSwapTile/index.d.ts.map +1 -0
- package/dist/flow/constants.d.ts +22 -0
- package/dist/flow/constants.d.ts.map +1 -0
- package/dist/flow/flow.types.d.ts +129 -0
- package/dist/flow/flow.types.d.ts.map +1 -0
- package/dist/flow/hooks/useFlowUiSettings/FlowUiSettingsContext/FlowUiSettingsContext.d.ts +15 -0
- package/dist/flow/hooks/useFlowUiSettings/FlowUiSettingsContext/FlowUiSettingsContext.d.ts.map +1 -0
- package/dist/flow/hooks/useFlowUiSettings/FlowUiSettingsContext/index.d.ts +2 -0
- package/dist/flow/hooks/useFlowUiSettings/FlowUiSettingsContext/index.d.ts.map +1 -0
- package/dist/flow/hooks/useFlowUiSettings/index.d.ts +3 -0
- package/dist/flow/hooks/useFlowUiSettings/index.d.ts.map +1 -0
- package/dist/flow/hooks/useFlowUiSettings/useFlowUiSettings.d.ts +23 -0
- package/dist/flow/hooks/useFlowUiSettings/useFlowUiSettings.d.ts.map +1 -0
- package/dist/flow/utils/formatFlowAmount/formatFlowAmount.d.ts +21 -0
- package/dist/flow/utils/formatFlowAmount/formatFlowAmount.d.ts.map +1 -0
- package/dist/flow/utils/formatFlowAmount/index.d.ts +3 -0
- package/dist/flow/utils/formatFlowAmount/index.d.ts.map +1 -0
- package/dist/flow/utils/formatFlowEstimate/formatFlowEstimate.d.ts +20 -0
- package/dist/flow/utils/formatFlowEstimate/formatFlowEstimate.d.ts.map +1 -0
- package/dist/flow/utils/formatFlowEstimate/index.d.ts +3 -0
- package/dist/flow/utils/formatFlowEstimate/index.d.ts.map +1 -0
- package/dist/flow/utils/formatFlowOrderTotal/formatFlowOrderTotal.d.ts +21 -0
- package/dist/flow/utils/formatFlowOrderTotal/formatFlowOrderTotal.d.ts.map +1 -0
- package/dist/flow/utils/formatFlowOrderTotal/index.d.ts +3 -0
- package/dist/flow/utils/formatFlowOrderTotal/index.d.ts.map +1 -0
- package/dist/flow/utils/formatFlowPayment/formatFlowPayment.d.ts +42 -0
- package/dist/flow/utils/formatFlowPayment/formatFlowPayment.d.ts.map +1 -0
- package/dist/flow/utils/formatFlowPayment/index.d.ts +3 -0
- package/dist/flow/utils/formatFlowPayment/index.d.ts.map +1 -0
- package/dist/flow/utils/getExchangeAttachErrorKind/getExchangeAttachErrorKind.constants.d.ts +4 -0
- package/dist/flow/utils/getExchangeAttachErrorKind/getExchangeAttachErrorKind.constants.d.ts.map +1 -0
- package/dist/flow/utils/getExchangeAttachErrorKind/getExchangeAttachErrorKind.d.ts +29 -0
- package/dist/flow/utils/getExchangeAttachErrorKind/getExchangeAttachErrorKind.d.ts.map +1 -0
- package/dist/flow/utils/getExchangeAttachErrorKind/index.d.ts +3 -0
- package/dist/flow/utils/getExchangeAttachErrorKind/index.d.ts.map +1 -0
- package/dist/flow/utils/getFlowAmountUsd/getFlowAmountUsd.d.ts +21 -0
- package/dist/flow/utils/getFlowAmountUsd/getFlowAmountUsd.d.ts.map +1 -0
- package/dist/flow/utils/getFlowAmountUsd/index.d.ts +3 -0
- package/dist/flow/utils/getFlowAmountUsd/index.d.ts.map +1 -0
- package/dist/flow/utils/getFlowDepositAddressSourceTokenOptions/getFlowDepositAddressSourceTokenOptions.d.ts +33 -0
- package/dist/flow/utils/getFlowDepositAddressSourceTokenOptions/getFlowDepositAddressSourceTokenOptions.d.ts.map +1 -0
- package/dist/flow/utils/getFlowDepositAddressSourceTokenOptions/index.d.ts +3 -0
- package/dist/flow/utils/getFlowDepositAddressSourceTokenOptions/index.d.ts.map +1 -0
- package/dist/flow/utils/getFlowExchangeUrl/getFlowExchangeUrl.d.ts +31 -0
- package/dist/flow/utils/getFlowExchangeUrl/getFlowExchangeUrl.d.ts.map +1 -0
- package/dist/flow/utils/getFlowExchangeUrl/index.d.ts +3 -0
- package/dist/flow/utils/getFlowExchangeUrl/index.d.ts.map +1 -0
- package/dist/flow/utils/getFlowMerchantLogoUrl/getFlowMerchantLogoUrl.d.ts +23 -0
- package/dist/flow/utils/getFlowMerchantLogoUrl/getFlowMerchantLogoUrl.d.ts.map +1 -0
- package/dist/flow/utils/getFlowMerchantLogoUrl/index.d.ts +3 -0
- package/dist/flow/utils/getFlowMerchantLogoUrl/index.d.ts.map +1 -0
- package/dist/flow/utils/getFlowPaymentMethods/getFlowPaymentMethods.d.ts +23 -0
- package/dist/flow/utils/getFlowPaymentMethods/getFlowPaymentMethods.d.ts.map +1 -0
- package/dist/flow/utils/getFlowPaymentMethods/index.d.ts +3 -0
- package/dist/flow/utils/getFlowPaymentMethods/index.d.ts.map +1 -0
- package/dist/flow/utils/getFlowPaymentTotal/getFlowPaymentTotal.d.ts +24 -0
- package/dist/flow/utils/getFlowPaymentTotal/getFlowPaymentTotal.d.ts.map +1 -0
- package/dist/flow/utils/getFlowPaymentTotal/index.d.ts +3 -0
- package/dist/flow/utils/getFlowPaymentTotal/index.d.ts.map +1 -0
- package/dist/flow/utils/getFlowSourceNetworkKey/getFlowSourceNetworkKey.d.ts +27 -0
- package/dist/flow/utils/getFlowSourceNetworkKey/getFlowSourceNetworkKey.d.ts.map +1 -0
- package/dist/flow/utils/getFlowSourceNetworkKey/index.d.ts +3 -0
- package/dist/flow/utils/getFlowSourceNetworkKey/index.d.ts.map +1 -0
- package/dist/flow/utils/getSubmitTransactionErrorType/getSubmitTransactionErrorType.d.ts +26 -0
- package/dist/flow/utils/getSubmitTransactionErrorType/getSubmitTransactionErrorType.d.ts.map +1 -0
- package/dist/flow/utils/getSubmitTransactionErrorType/index.d.ts +3 -0
- package/dist/flow/utils/getSubmitTransactionErrorType/index.d.ts.map +1 -0
- package/dist/flow/utils/getWalletAttachErrorType/getWalletAttachErrorType.d.ts +21 -0
- package/dist/flow/utils/getWalletAttachErrorType/getWalletAttachErrorType.d.ts.map +1 -0
- package/dist/flow/utils/getWalletAttachErrorType/index.d.ts +3 -0
- package/dist/flow/utils/getWalletAttachErrorType/index.d.ts.map +1 -0
- package/dist/flow/utils/isRefundAddressValid/index.d.ts +3 -0
- package/dist/flow/utils/isRefundAddressValid/index.d.ts.map +1 -0
- package/dist/flow/utils/isRefundAddressValid/isRefundAddressValid.constants.d.ts +11 -0
- package/dist/flow/utils/isRefundAddressValid/isRefundAddressValid.constants.d.ts.map +1 -0
- package/dist/flow/utils/isRefundAddressValid/isRefundAddressValid.d.ts +33 -0
- package/dist/flow/utils/isRefundAddressValid/isRefundAddressValid.d.ts.map +1 -0
- package/dist/flow/utils/openFlowExchangeUrl/index.d.ts +3 -0
- package/dist/flow/utils/openFlowExchangeUrl/index.d.ts.map +1 -0
- package/dist/flow/utils/openFlowExchangeUrl/openFlowExchangeUrl.d.ts +29 -0
- package/dist/flow/utils/openFlowExchangeUrl/openFlowExchangeUrl.d.ts.map +1 -0
- package/dist/flow/utils/resolveFlowPhase/index.d.ts +3 -0
- package/dist/flow/utils/resolveFlowPhase/index.d.ts.map +1 -0
- package/dist/flow/utils/resolveFlowPhase/resolveFlowPhase.d.ts +35 -0
- package/dist/flow/utils/resolveFlowPhase/resolveFlowPhase.d.ts.map +1 -0
- package/dist/flow/views/FlowAlreadyPaid/FlowAlreadyPaid.d.ts +50 -0
- package/dist/flow/views/FlowAlreadyPaid/FlowAlreadyPaid.d.ts.map +1 -0
- package/dist/flow/views/FlowAlreadyPaid/FlowAlreadyPaid.text.d.ts +19 -0
- package/dist/flow/views/FlowAlreadyPaid/FlowAlreadyPaid.text.d.ts.map +1 -0
- package/dist/flow/views/FlowAlreadyPaid/getFlowAlreadyPaidDetails/getFlowAlreadyPaidDetails.d.ts +54 -0
- package/dist/flow/views/FlowAlreadyPaid/getFlowAlreadyPaidDetails/getFlowAlreadyPaidDetails.d.ts.map +1 -0
- package/dist/flow/views/FlowAlreadyPaid/getFlowAlreadyPaidDetails/index.d.ts +3 -0
- package/dist/flow/views/FlowAlreadyPaid/getFlowAlreadyPaidDetails/index.d.ts.map +1 -0
- package/dist/flow/views/FlowAlreadyPaid/index.d.ts +3 -0
- package/dist/flow/views/FlowAlreadyPaid/index.d.ts.map +1 -0
- package/dist/flow/views/FlowChooseExchangeView/FlowChooseExchangeView.constants.d.ts +10 -0
- package/dist/flow/views/FlowChooseExchangeView/FlowChooseExchangeView.constants.d.ts.map +1 -0
- package/dist/flow/views/FlowChooseExchangeView/FlowChooseExchangeView.d.ts +73 -0
- package/dist/flow/views/FlowChooseExchangeView/FlowChooseExchangeView.d.ts.map +1 -0
- package/dist/flow/views/FlowChooseExchangeView/FlowChooseExchangeView.text.d.ts +18 -0
- package/dist/flow/views/FlowChooseExchangeView/FlowChooseExchangeView.text.d.ts.map +1 -0
- package/dist/flow/views/FlowChooseExchangeView/index.d.ts +3 -0
- package/dist/flow/views/FlowChooseExchangeView/index.d.ts.map +1 -0
- package/dist/flow/views/FlowChoosePaymentSourceView/FlowChoosePaymentSourceView.d.ts +61 -0
- package/dist/flow/views/FlowChoosePaymentSourceView/FlowChoosePaymentSourceView.d.ts.map +1 -0
- package/dist/flow/views/FlowChoosePaymentSourceView/FlowChoosePaymentSourceView.text.d.ts +18 -0
- package/dist/flow/views/FlowChoosePaymentSourceView/FlowChoosePaymentSourceView.text.d.ts.map +1 -0
- package/dist/flow/views/FlowChoosePaymentSourceView/index.d.ts +3 -0
- package/dist/flow/views/FlowChoosePaymentSourceView/index.d.ts.map +1 -0
- package/dist/flow/views/FlowChooseTokenView/FlowChooseTokenView.d.ts +68 -0
- package/dist/flow/views/FlowChooseTokenView/FlowChooseTokenView.d.ts.map +1 -0
- package/dist/flow/views/FlowChooseTokenView/FlowChooseTokenView.text.d.ts +17 -0
- package/dist/flow/views/FlowChooseTokenView/FlowChooseTokenView.text.d.ts.map +1 -0
- package/dist/flow/views/FlowChooseTokenView/index.d.ts +3 -0
- package/dist/flow/views/FlowChooseTokenView/index.d.ts.map +1 -0
- package/dist/flow/views/FlowChooseTokenView/useFlowChooseTokenView/index.d.ts +3 -0
- package/dist/flow/views/FlowChooseTokenView/useFlowChooseTokenView/index.d.ts.map +1 -0
- package/dist/flow/views/FlowChooseTokenView/useFlowChooseTokenView/useFlowChooseTokenView.d.ts +48 -0
- package/dist/flow/views/FlowChooseTokenView/useFlowChooseTokenView/useFlowChooseTokenView.d.ts.map +1 -0
- package/dist/flow/views/FlowDepositAddressView/FlowDepositAddressView.d.ts +111 -0
- package/dist/flow/views/FlowDepositAddressView/FlowDepositAddressView.d.ts.map +1 -0
- package/dist/flow/views/FlowDepositAddressView/FlowDepositAddressView.text.d.ts +26 -0
- package/dist/flow/views/FlowDepositAddressView/FlowDepositAddressView.text.d.ts.map +1 -0
- package/dist/flow/views/FlowDepositAddressView/buildFlowDepositUri/buildFlowDepositUri.constants.d.ts +13 -0
- package/dist/flow/views/FlowDepositAddressView/buildFlowDepositUri/buildFlowDepositUri.constants.d.ts.map +1 -0
- package/dist/flow/views/FlowDepositAddressView/buildFlowDepositUri/buildFlowDepositUri.d.ts +60 -0
- package/dist/flow/views/FlowDepositAddressView/buildFlowDepositUri/buildFlowDepositUri.d.ts.map +1 -0
- package/dist/flow/views/FlowDepositAddressView/buildFlowDepositUri/index.d.ts +3 -0
- package/dist/flow/views/FlowDepositAddressView/buildFlowDepositUri/index.d.ts.map +1 -0
- package/dist/flow/views/FlowDepositAddressView/getFlowDepositSourceKey/getFlowDepositSourceKey.d.ts +37 -0
- package/dist/flow/views/FlowDepositAddressView/getFlowDepositSourceKey/getFlowDepositSourceKey.d.ts.map +1 -0
- package/dist/flow/views/FlowDepositAddressView/getFlowDepositSourceKey/index.d.ts +3 -0
- package/dist/flow/views/FlowDepositAddressView/getFlowDepositSourceKey/index.d.ts.map +1 -0
- package/dist/flow/views/FlowDepositAddressView/index.d.ts +4 -0
- package/dist/flow/views/FlowDepositAddressView/index.d.ts.map +1 -0
- package/dist/flow/views/FlowDepositAddressView/resolveFlowDepositAddressDetails/index.d.ts +3 -0
- package/dist/flow/views/FlowDepositAddressView/resolveFlowDepositAddressDetails/index.d.ts.map +1 -0
- package/dist/flow/views/FlowDepositAddressView/resolveFlowDepositAddressDetails/resolveFlowDepositAddressDetails.d.ts +73 -0
- package/dist/flow/views/FlowDepositAddressView/resolveFlowDepositAddressDetails/resolveFlowDepositAddressDetails.d.ts.map +1 -0
- package/dist/flow/views/FlowDepositAddressView/resolveFlowDepositAddressRefund/index.d.ts +3 -0
- package/dist/flow/views/FlowDepositAddressView/resolveFlowDepositAddressRefund/index.d.ts.map +1 -0
- package/dist/flow/views/FlowDepositAddressView/resolveFlowDepositAddressRefund/resolveFlowDepositAddressRefund.d.ts +41 -0
- package/dist/flow/views/FlowDepositAddressView/resolveFlowDepositAddressRefund/resolveFlowDepositAddressRefund.d.ts.map +1 -0
- package/dist/flow/views/FlowDepositAddressView/resolveFlowDepositAddressSelection/index.d.ts +3 -0
- package/dist/flow/views/FlowDepositAddressView/resolveFlowDepositAddressSelection/index.d.ts.map +1 -0
- package/dist/flow/views/FlowDepositAddressView/resolveFlowDepositAddressSelection/resolveFlowDepositAddressSelection.d.ts +49 -0
- package/dist/flow/views/FlowDepositAddressView/resolveFlowDepositAddressSelection/resolveFlowDepositAddressSelection.d.ts.map +1 -0
- package/dist/flow/views/FlowDepositAddressView/useFlowDepositAddressView/index.d.ts +3 -0
- package/dist/flow/views/FlowDepositAddressView/useFlowDepositAddressView/index.d.ts.map +1 -0
- package/dist/flow/views/FlowDepositAddressView/useFlowDepositAddressView/useFlowDepositAddressView.d.ts +107 -0
- package/dist/flow/views/FlowDepositAddressView/useFlowDepositAddressView/useFlowDepositAddressView.d.ts.map +1 -0
- package/dist/flow/views/FlowExchangeView/FlowExchangeView.constants.d.ts +3 -0
- package/dist/flow/views/FlowExchangeView/FlowExchangeView.constants.d.ts.map +1 -0
- package/dist/flow/views/FlowExchangeView/FlowExchangeView.d.ts +81 -0
- package/dist/flow/views/FlowExchangeView/FlowExchangeView.d.ts.map +1 -0
- package/dist/flow/views/FlowExchangeView/FlowExchangeView.text.d.ts +21 -0
- package/dist/flow/views/FlowExchangeView/FlowExchangeView.text.d.ts.map +1 -0
- package/dist/flow/views/FlowExchangeView/getFlowExchangeViewStatusKey/getFlowExchangeViewStatusKey.d.ts +33 -0
- package/dist/flow/views/FlowExchangeView/getFlowExchangeViewStatusKey/getFlowExchangeViewStatusKey.d.ts.map +1 -0
- package/dist/flow/views/FlowExchangeView/getFlowExchangeViewStatusKey/index.d.ts +3 -0
- package/dist/flow/views/FlowExchangeView/getFlowExchangeViewStatusKey/index.d.ts.map +1 -0
- package/dist/flow/views/FlowExchangeView/index.d.ts +3 -0
- package/dist/flow/views/FlowExchangeView/index.d.ts.map +1 -0
- package/dist/flow/views/FlowExpired/FlowExpired.d.ts +49 -0
- package/dist/flow/views/FlowExpired/FlowExpired.d.ts.map +1 -0
- package/dist/flow/views/FlowExpired/FlowExpired.text.d.ts +19 -0
- package/dist/flow/views/FlowExpired/FlowExpired.text.d.ts.map +1 -0
- package/dist/flow/views/FlowExpired/getFlowExpiredDetails/getFlowExpiredDetails.d.ts +48 -0
- package/dist/flow/views/FlowExpired/getFlowExpiredDetails/getFlowExpiredDetails.d.ts.map +1 -0
- package/dist/flow/views/FlowExpired/getFlowExpiredDetails/index.d.ts +3 -0
- package/dist/flow/views/FlowExpired/getFlowExpiredDetails/index.d.ts.map +1 -0
- package/dist/flow/views/FlowExpired/index.d.ts +3 -0
- package/dist/flow/views/FlowExpired/index.d.ts.map +1 -0
- package/dist/flow/views/FlowLeaveDepositAddressView/FlowLeaveDepositAddressView.d.ts +54 -0
- package/dist/flow/views/FlowLeaveDepositAddressView/FlowLeaveDepositAddressView.d.ts.map +1 -0
- package/dist/flow/views/FlowLeaveDepositAddressView/FlowLeaveDepositAddressView.text.d.ts +21 -0
- package/dist/flow/views/FlowLeaveDepositAddressView/FlowLeaveDepositAddressView.text.d.ts.map +1 -0
- package/dist/flow/views/FlowLeaveDepositAddressView/index.d.ts +3 -0
- package/dist/flow/views/FlowLeaveDepositAddressView/index.d.ts.map +1 -0
- package/dist/flow/views/FlowLeaveExchangeView/FlowLeaveExchangeView.d.ts +59 -0
- package/dist/flow/views/FlowLeaveExchangeView/FlowLeaveExchangeView.d.ts.map +1 -0
- package/dist/flow/views/FlowLeaveExchangeView/FlowLeaveExchangeView.text.d.ts +14 -0
- package/dist/flow/views/FlowLeaveExchangeView/FlowLeaveExchangeView.text.d.ts.map +1 -0
- package/dist/flow/views/FlowLeaveExchangeView/index.d.ts +3 -0
- package/dist/flow/views/FlowLeaveExchangeView/index.d.ts.map +1 -0
- package/dist/flow/views/FlowLoadError/FlowLoadError.d.ts +49 -0
- package/dist/flow/views/FlowLoadError/FlowLoadError.d.ts.map +1 -0
- package/dist/flow/views/FlowLoadError/FlowLoadError.text.d.ts +27 -0
- package/dist/flow/views/FlowLoadError/FlowLoadError.text.d.ts.map +1 -0
- package/dist/flow/views/FlowLoadError/index.d.ts +3 -0
- package/dist/flow/views/FlowLoadError/index.d.ts.map +1 -0
- package/dist/flow/views/FlowLoadingView/FlowLoadingView.d.ts +33 -0
- package/dist/flow/views/FlowLoadingView/FlowLoadingView.d.ts.map +1 -0
- package/dist/flow/views/FlowLoadingView/FlowLoadingView.text.d.ts +13 -0
- package/dist/flow/views/FlowLoadingView/FlowLoadingView.text.d.ts.map +1 -0
- package/dist/flow/views/FlowLoadingView/index.d.ts +3 -0
- package/dist/flow/views/FlowLoadingView/index.d.ts.map +1 -0
- package/dist/flow/views/FlowPaymentCancelled/FlowPaymentCancelled.d.ts +41 -0
- package/dist/flow/views/FlowPaymentCancelled/FlowPaymentCancelled.d.ts.map +1 -0
- package/dist/flow/views/FlowPaymentCancelled/FlowPaymentCancelled.text.d.ts +19 -0
- package/dist/flow/views/FlowPaymentCancelled/FlowPaymentCancelled.text.d.ts.map +1 -0
- package/dist/flow/views/FlowPaymentCancelled/getFlowPaymentCancelledDetails/getFlowPaymentCancelledDetails.d.ts +34 -0
- package/dist/flow/views/FlowPaymentCancelled/getFlowPaymentCancelledDetails/getFlowPaymentCancelledDetails.d.ts.map +1 -0
- package/dist/flow/views/FlowPaymentCancelled/getFlowPaymentCancelledDetails/index.d.ts +3 -0
- package/dist/flow/views/FlowPaymentCancelled/getFlowPaymentCancelledDetails/index.d.ts.map +1 -0
- package/dist/flow/views/FlowPaymentCancelled/index.d.ts +3 -0
- package/dist/flow/views/FlowPaymentCancelled/index.d.ts.map +1 -0
- package/dist/flow/views/FlowPaymentComplete/FlowPaymentComplete.d.ts +65 -0
- package/dist/flow/views/FlowPaymentComplete/FlowPaymentComplete.d.ts.map +1 -0
- package/dist/flow/views/FlowPaymentComplete/FlowPaymentComplete.text.d.ts +35 -0
- package/dist/flow/views/FlowPaymentComplete/FlowPaymentComplete.text.d.ts.map +1 -0
- package/dist/flow/views/FlowPaymentComplete/getFlowPaymentCompleteDetails/getFlowPaymentCompleteDetails.d.ts +89 -0
- package/dist/flow/views/FlowPaymentComplete/getFlowPaymentCompleteDetails/getFlowPaymentCompleteDetails.d.ts.map +1 -0
- package/dist/flow/views/FlowPaymentComplete/getFlowPaymentCompleteDetails/index.d.ts +3 -0
- package/dist/flow/views/FlowPaymentComplete/getFlowPaymentCompleteDetails/index.d.ts.map +1 -0
- package/dist/flow/views/FlowPaymentComplete/index.d.ts +3 -0
- package/dist/flow/views/FlowPaymentComplete/index.d.ts.map +1 -0
- package/dist/flow/views/FlowPaymentFailed/FlowPaymentFailed.d.ts +40 -0
- package/dist/flow/views/FlowPaymentFailed/FlowPaymentFailed.d.ts.map +1 -0
- package/dist/flow/views/FlowPaymentFailed/FlowPaymentFailed.text.d.ts +19 -0
- package/dist/flow/views/FlowPaymentFailed/FlowPaymentFailed.text.d.ts.map +1 -0
- package/dist/flow/views/FlowPaymentFailed/getFlowPaymentFailedDetails/getFlowPaymentFailedDetails.d.ts +42 -0
- package/dist/flow/views/FlowPaymentFailed/getFlowPaymentFailedDetails/getFlowPaymentFailedDetails.d.ts.map +1 -0
- package/dist/flow/views/FlowPaymentFailed/getFlowPaymentFailedDetails/index.d.ts +3 -0
- package/dist/flow/views/FlowPaymentFailed/getFlowPaymentFailedDetails/index.d.ts.map +1 -0
- package/dist/flow/views/FlowPaymentFailed/index.d.ts +3 -0
- package/dist/flow/views/FlowPaymentFailed/index.d.ts.map +1 -0
- package/dist/flow/views/FlowPaymentNotApproved/FlowPaymentNotApproved.d.ts +79 -0
- package/dist/flow/views/FlowPaymentNotApproved/FlowPaymentNotApproved.d.ts.map +1 -0
- package/dist/flow/views/FlowPaymentNotApproved/FlowPaymentNotApproved.text.d.ts +38 -0
- package/dist/flow/views/FlowPaymentNotApproved/FlowPaymentNotApproved.text.d.ts.map +1 -0
- package/dist/flow/views/FlowPaymentNotApproved/index.d.ts +3 -0
- package/dist/flow/views/FlowPaymentNotApproved/index.d.ts.map +1 -0
- package/dist/flow/views/FlowPaymentRefunded/FlowPaymentRefunded.d.ts +41 -0
- package/dist/flow/views/FlowPaymentRefunded/FlowPaymentRefunded.d.ts.map +1 -0
- package/dist/flow/views/FlowPaymentRefunded/FlowPaymentRefunded.text.d.ts +19 -0
- package/dist/flow/views/FlowPaymentRefunded/FlowPaymentRefunded.text.d.ts.map +1 -0
- package/dist/flow/views/FlowPaymentRefunded/index.d.ts +3 -0
- package/dist/flow/views/FlowPaymentRefunded/index.d.ts.map +1 -0
- package/dist/flow/views/FlowProcessingPayment/FlowProcessingPayment.constants.d.ts +7 -0
- package/dist/flow/views/FlowProcessingPayment/FlowProcessingPayment.constants.d.ts.map +1 -0
- package/dist/flow/views/FlowProcessingPayment/FlowProcessingPayment.d.ts +41 -0
- package/dist/flow/views/FlowProcessingPayment/FlowProcessingPayment.d.ts.map +1 -0
- package/dist/flow/views/FlowProcessingPayment/FlowProcessingPayment.text.d.ts +13 -0
- package/dist/flow/views/FlowProcessingPayment/FlowProcessingPayment.text.d.ts.map +1 -0
- package/dist/flow/views/FlowProcessingPayment/getFlowProcessingPaymentDetails/getFlowProcessingPaymentDetails.d.ts +52 -0
- package/dist/flow/views/FlowProcessingPayment/getFlowProcessingPaymentDetails/getFlowProcessingPaymentDetails.d.ts.map +1 -0
- package/dist/flow/views/FlowProcessingPayment/getFlowProcessingPaymentDetails/index.d.ts +4 -0
- package/dist/flow/views/FlowProcessingPayment/getFlowProcessingPaymentDetails/index.d.ts.map +1 -0
- package/dist/flow/views/FlowProcessingPayment/getFlowProcessingStep/getFlowProcessingStep.d.ts +29 -0
- package/dist/flow/views/FlowProcessingPayment/getFlowProcessingStep/getFlowProcessingStep.d.ts.map +1 -0
- package/dist/flow/views/FlowProcessingPayment/getFlowProcessingStep/index.d.ts +3 -0
- package/dist/flow/views/FlowProcessingPayment/getFlowProcessingStep/index.d.ts.map +1 -0
- package/dist/flow/views/FlowProcessingPayment/index.d.ts +3 -0
- package/dist/flow/views/FlowProcessingPayment/index.d.ts.map +1 -0
- package/dist/flow/views/FlowReviewPaymentView/FlowReviewPaymentView.constants.d.ts +15 -0
- package/dist/flow/views/FlowReviewPaymentView/FlowReviewPaymentView.constants.d.ts.map +1 -0
- package/dist/flow/views/FlowReviewPaymentView/FlowReviewPaymentView.d.ts +80 -0
- package/dist/flow/views/FlowReviewPaymentView/FlowReviewPaymentView.d.ts.map +1 -0
- package/dist/flow/views/FlowReviewPaymentView/FlowReviewPaymentView.text.d.ts +35 -0
- package/dist/flow/views/FlowReviewPaymentView/FlowReviewPaymentView.text.d.ts.map +1 -0
- package/dist/flow/views/FlowReviewPaymentView/formatQuoteTimeLeft/formatQuoteTimeLeft.d.ts +20 -0
- package/dist/flow/views/FlowReviewPaymentView/formatQuoteTimeLeft/formatQuoteTimeLeft.d.ts.map +1 -0
- package/dist/flow/views/FlowReviewPaymentView/formatQuoteTimeLeft/index.d.ts +3 -0
- package/dist/flow/views/FlowReviewPaymentView/formatQuoteTimeLeft/index.d.ts.map +1 -0
- package/dist/flow/views/FlowReviewPaymentView/index.d.ts +3 -0
- package/dist/flow/views/FlowReviewPaymentView/index.d.ts.map +1 -0
- package/dist/flow/views/FlowReviewPaymentView/useFlowReviewPaymentView/index.d.ts +3 -0
- package/dist/flow/views/FlowReviewPaymentView/useFlowReviewPaymentView/index.d.ts.map +1 -0
- package/dist/flow/views/FlowReviewPaymentView/useFlowReviewPaymentView/useFlowReviewPaymentView.d.ts +72 -0
- package/dist/flow/views/FlowReviewPaymentView/useFlowReviewPaymentView/useFlowReviewPaymentView.d.ts.map +1 -0
- package/dist/flow/views/FlowReviewPaymentView/useFlowReviewPaymentView/useQuoteCountdown/index.d.ts +3 -0
- package/dist/flow/views/FlowReviewPaymentView/useFlowReviewPaymentView/useQuoteCountdown/index.d.ts.map +1 -0
- package/dist/flow/views/FlowReviewPaymentView/useFlowReviewPaymentView/useQuoteCountdown/useQuoteCountdown.constants.d.ts +10 -0
- package/dist/flow/views/FlowReviewPaymentView/useFlowReviewPaymentView/useQuoteCountdown/useQuoteCountdown.constants.d.ts.map +1 -0
- package/dist/flow/views/FlowReviewPaymentView/useFlowReviewPaymentView/useQuoteCountdown/useQuoteCountdown.d.ts +30 -0
- package/dist/flow/views/FlowReviewPaymentView/useFlowReviewPaymentView/useQuoteCountdown/useQuoteCountdown.d.ts.map +1 -0
- package/dist/flow/views/FlowWalletConnectionView/FlowWalletAttachErrorBanner/FlowWalletAttachErrorBanner.d.ts +38 -0
- package/dist/flow/views/FlowWalletConnectionView/FlowWalletAttachErrorBanner/FlowWalletAttachErrorBanner.d.ts.map +1 -0
- package/dist/flow/views/FlowWalletConnectionView/FlowWalletAttachErrorBanner/FlowWalletAttachErrorBanner.text.d.ts +15 -0
- package/dist/flow/views/FlowWalletConnectionView/FlowWalletAttachErrorBanner/FlowWalletAttachErrorBanner.text.d.ts.map +1 -0
- package/dist/flow/views/FlowWalletConnectionView/FlowWalletAttachErrorBanner/index.d.ts +3 -0
- package/dist/flow/views/FlowWalletConnectionView/FlowWalletAttachErrorBanner/index.d.ts.map +1 -0
- package/dist/flow/views/FlowWalletConnectionView/FlowWalletConnectionView.d.ts +61 -0
- package/dist/flow/views/FlowWalletConnectionView/FlowWalletConnectionView.d.ts.map +1 -0
- package/dist/flow/views/FlowWalletConnectionView/FlowWalletConnectionView.text.d.ts +23 -0
- package/dist/flow/views/FlowWalletConnectionView/FlowWalletConnectionView.text.d.ts.map +1 -0
- package/dist/flow/views/FlowWalletConnectionView/index.d.ts +3 -0
- package/dist/flow/views/FlowWalletConnectionView/index.d.ts.map +1 -0
- package/dist/flow/widgets/FlowDepositAddressWidget/FlowDepositAddressWidget.d.ts +72 -0
- package/dist/flow/widgets/FlowDepositAddressWidget/FlowDepositAddressWidget.d.ts.map +1 -0
- package/dist/flow/widgets/FlowDepositAddressWidget/FlowDepositAddressWidgetContent/FlowDepositAddressWidgetContent.d.ts +39 -0
- package/dist/flow/widgets/FlowDepositAddressWidget/FlowDepositAddressWidgetContent/FlowDepositAddressWidgetContent.d.ts.map +1 -0
- package/dist/flow/widgets/FlowDepositAddressWidget/FlowDepositAddressWidgetContent/index.d.ts +3 -0
- package/dist/flow/widgets/FlowDepositAddressWidget/FlowDepositAddressWidgetContent/index.d.ts.map +1 -0
- package/dist/flow/widgets/FlowDepositAddressWidget/index.d.ts +3 -0
- package/dist/flow/widgets/FlowDepositAddressWidget/index.d.ts.map +1 -0
- package/dist/flow/widgets/FlowDepositAddressWidget/renderFlowDepositAddressRoute/index.d.ts +3 -0
- package/dist/flow/widgets/FlowDepositAddressWidget/renderFlowDepositAddressRoute/index.d.ts.map +1 -0
- package/dist/flow/widgets/FlowDepositAddressWidget/renderFlowDepositAddressRoute/renderFlowDepositAddressRoute.d.ts +29 -0
- package/dist/flow/widgets/FlowDepositAddressWidget/renderFlowDepositAddressRoute/renderFlowDepositAddressRoute.d.ts.map +1 -0
- package/dist/flow/widgets/FlowDepositAddressWidget/routes/depositAddressRoute/depositAddressRoute.d.ts +16 -0
- package/dist/flow/widgets/FlowDepositAddressWidget/routes/depositAddressRoute/depositAddressRoute.d.ts.map +1 -0
- package/dist/flow/widgets/FlowDepositAddressWidget/routes/depositAddressRoute/index.d.ts +3 -0
- package/dist/flow/widgets/FlowDepositAddressWidget/routes/depositAddressRoute/index.d.ts.map +1 -0
- package/dist/flow/widgets/FlowDepositAddressWidget/routes/flowDepositAddressRoutes.d.ts +13 -0
- package/dist/flow/widgets/FlowDepositAddressWidget/routes/flowDepositAddressRoutes.d.ts.map +1 -0
- package/dist/flow/widgets/FlowDepositAddressWidget/routes/flowDepositAddressRoutes.types.d.ts +38 -0
- package/dist/flow/widgets/FlowDepositAddressWidget/routes/flowDepositAddressRoutes.types.d.ts.map +1 -0
- package/dist/flow/widgets/FlowDepositAddressWidget/routes/leaveDepositAddressRoute/index.d.ts +3 -0
- package/dist/flow/widgets/FlowDepositAddressWidget/routes/leaveDepositAddressRoute/index.d.ts.map +1 -0
- package/dist/flow/widgets/FlowDepositAddressWidget/routes/leaveDepositAddressRoute/leaveDepositAddressRoute.d.ts +16 -0
- package/dist/flow/widgets/FlowDepositAddressWidget/routes/leaveDepositAddressRoute/leaveDepositAddressRoute.d.ts.map +1 -0
- package/dist/flow/widgets/FlowDepositAddressWidget/useFlowDepositAddressWidget/index.d.ts +3 -0
- package/dist/flow/widgets/FlowDepositAddressWidget/useFlowDepositAddressWidget/index.d.ts.map +1 -0
- package/dist/flow/widgets/FlowDepositAddressWidget/useFlowDepositAddressWidget/resolveFlowDepositAddressBack/index.d.ts +3 -0
- package/dist/flow/widgets/FlowDepositAddressWidget/useFlowDepositAddressWidget/resolveFlowDepositAddressBack/index.d.ts.map +1 -0
- package/dist/flow/widgets/FlowDepositAddressWidget/useFlowDepositAddressWidget/resolveFlowDepositAddressBack/resolveFlowDepositAddressBack.d.ts +41 -0
- package/dist/flow/widgets/FlowDepositAddressWidget/useFlowDepositAddressWidget/resolveFlowDepositAddressBack/resolveFlowDepositAddressBack.d.ts.map +1 -0
- package/dist/flow/widgets/FlowDepositAddressWidget/useFlowDepositAddressWidget/useFlowDepositAddressWidget.d.ts +75 -0
- package/dist/flow/widgets/FlowDepositAddressWidget/useFlowDepositAddressWidget/useFlowDepositAddressWidget.d.ts.map +1 -0
- package/dist/flow/widgets/FlowOutcomeBoundary/FlowOutcomeBoundary.d.ts +45 -0
- package/dist/flow/widgets/FlowOutcomeBoundary/FlowOutcomeBoundary.d.ts.map +1 -0
- package/dist/flow/widgets/FlowOutcomeBoundary/FlowOutcomeBoundary.types.d.ts +18 -0
- package/dist/flow/widgets/FlowOutcomeBoundary/FlowOutcomeBoundary.types.d.ts.map +1 -0
- package/dist/flow/widgets/FlowOutcomeBoundary/FlowOutcomeOwnerContext/FlowOutcomeOwnerContext.d.ts +14 -0
- package/dist/flow/widgets/FlowOutcomeBoundary/FlowOutcomeOwnerContext/FlowOutcomeOwnerContext.d.ts.map +1 -0
- package/dist/flow/widgets/FlowOutcomeBoundary/FlowOutcomeOwnerContext/index.d.ts +2 -0
- package/dist/flow/widgets/FlowOutcomeBoundary/FlowOutcomeOwnerContext/index.d.ts.map +1 -0
- package/dist/flow/widgets/FlowOutcomeBoundary/index.d.ts +3 -0
- package/dist/flow/widgets/FlowOutcomeBoundary/index.d.ts.map +1 -0
- package/dist/flow/widgets/FlowOutcomeBoundary/useFlowOutcome/index.d.ts +3 -0
- package/dist/flow/widgets/FlowOutcomeBoundary/useFlowOutcome/index.d.ts.map +1 -0
- package/dist/flow/widgets/FlowOutcomeBoundary/useFlowOutcome/useFlowOutcome.d.ts +25 -0
- package/dist/flow/widgets/FlowOutcomeBoundary/useFlowOutcome/useFlowOutcome.d.ts.map +1 -0
- package/dist/flow/widgets/FlowOutcomeBoundary/useFlowOutcomeBoundary/index.d.ts +3 -0
- package/dist/flow/widgets/FlowOutcomeBoundary/useFlowOutcomeBoundary/index.d.ts.map +1 -0
- package/dist/flow/widgets/FlowOutcomeBoundary/useFlowOutcomeBoundary/useFlowOutcomeBoundary.d.ts +49 -0
- package/dist/flow/widgets/FlowOutcomeBoundary/useFlowOutcomeBoundary/useFlowOutcomeBoundary.d.ts.map +1 -0
- package/dist/flow/widgets/FlowOutcomeBoundary/useFlowOutcomeBoundary/useResumedPaymentPending/index.d.ts +3 -0
- package/dist/flow/widgets/FlowOutcomeBoundary/useFlowOutcomeBoundary/useResumedPaymentPending/index.d.ts.map +1 -0
- package/dist/flow/widgets/FlowOutcomeBoundary/useFlowOutcomeBoundary/useResumedPaymentPending/useResumedPaymentPending.constants.d.ts +7 -0
- package/dist/flow/widgets/FlowOutcomeBoundary/useFlowOutcomeBoundary/useResumedPaymentPending/useResumedPaymentPending.constants.d.ts.map +1 -0
- package/dist/flow/widgets/FlowOutcomeBoundary/useFlowOutcomeBoundary/useResumedPaymentPending/useResumedPaymentPending.d.ts +28 -0
- package/dist/flow/widgets/FlowOutcomeBoundary/useFlowOutcomeBoundary/useResumedPaymentPending/useResumedPaymentPending.d.ts.map +1 -0
- package/dist/flow/widgets/FlowPayWithExchangeWidget/FlowPayWithExchangeWidget.d.ts +63 -0
- package/dist/flow/widgets/FlowPayWithExchangeWidget/FlowPayWithExchangeWidget.d.ts.map +1 -0
- package/dist/flow/widgets/FlowPayWithExchangeWidget/FlowPayWithExchangeWidgetContent/FlowPayWithExchangeWidgetContent.d.ts +45 -0
- package/dist/flow/widgets/FlowPayWithExchangeWidget/FlowPayWithExchangeWidgetContent/FlowPayWithExchangeWidgetContent.d.ts.map +1 -0
- package/dist/flow/widgets/FlowPayWithExchangeWidget/FlowPayWithExchangeWidgetContent/index.d.ts +3 -0
- package/dist/flow/widgets/FlowPayWithExchangeWidget/FlowPayWithExchangeWidgetContent/index.d.ts.map +1 -0
- package/dist/flow/widgets/FlowPayWithExchangeWidget/FlowPayWithExchangeWidgetScreen/FlowPayWithExchangeWidgetScreen.d.ts +38 -0
- package/dist/flow/widgets/FlowPayWithExchangeWidget/FlowPayWithExchangeWidgetScreen/FlowPayWithExchangeWidgetScreen.d.ts.map +1 -0
- package/dist/flow/widgets/FlowPayWithExchangeWidget/FlowPayWithExchangeWidgetScreen/index.d.ts +3 -0
- package/dist/flow/widgets/FlowPayWithExchangeWidget/FlowPayWithExchangeWidgetScreen/index.d.ts.map +1 -0
- package/dist/flow/widgets/FlowPayWithExchangeWidget/index.d.ts +3 -0
- package/dist/flow/widgets/FlowPayWithExchangeWidget/index.d.ts.map +1 -0
- package/dist/flow/widgets/FlowPayWithExchangeWidget/renderFlowPayWithExchangeRoute/index.d.ts +3 -0
- package/dist/flow/widgets/FlowPayWithExchangeWidget/renderFlowPayWithExchangeRoute/index.d.ts.map +1 -0
- package/dist/flow/widgets/FlowPayWithExchangeWidget/renderFlowPayWithExchangeRoute/renderFlowPayWithExchangeRoute.d.ts +29 -0
- package/dist/flow/widgets/FlowPayWithExchangeWidget/renderFlowPayWithExchangeRoute/renderFlowPayWithExchangeRoute.d.ts.map +1 -0
- package/dist/flow/widgets/FlowPayWithExchangeWidget/routes/chooseExchangeRoute/chooseExchangeRoute.d.ts +15 -0
- package/dist/flow/widgets/FlowPayWithExchangeWidget/routes/chooseExchangeRoute/chooseExchangeRoute.d.ts.map +1 -0
- package/dist/flow/widgets/FlowPayWithExchangeWidget/routes/chooseExchangeRoute/index.d.ts +3 -0
- package/dist/flow/widgets/FlowPayWithExchangeWidget/routes/chooseExchangeRoute/index.d.ts.map +1 -0
- package/dist/flow/widgets/FlowPayWithExchangeWidget/routes/exchangeRoute/exchangeRoute.d.ts +21 -0
- package/dist/flow/widgets/FlowPayWithExchangeWidget/routes/exchangeRoute/exchangeRoute.d.ts.map +1 -0
- package/dist/flow/widgets/FlowPayWithExchangeWidget/routes/exchangeRoute/index.d.ts +3 -0
- package/dist/flow/widgets/FlowPayWithExchangeWidget/routes/exchangeRoute/index.d.ts.map +1 -0
- package/dist/flow/widgets/FlowPayWithExchangeWidget/routes/flowPayWithExchangeRoutes.d.ts +14 -0
- package/dist/flow/widgets/FlowPayWithExchangeWidget/routes/flowPayWithExchangeRoutes.d.ts.map +1 -0
- package/dist/flow/widgets/FlowPayWithExchangeWidget/routes/flowPayWithExchangeRoutes.types.d.ts +38 -0
- package/dist/flow/widgets/FlowPayWithExchangeWidget/routes/flowPayWithExchangeRoutes.types.d.ts.map +1 -0
- package/dist/flow/widgets/FlowPayWithExchangeWidget/routes/leaveExchangeRoute/index.d.ts +3 -0
- package/dist/flow/widgets/FlowPayWithExchangeWidget/routes/leaveExchangeRoute/index.d.ts.map +1 -0
- package/dist/flow/widgets/FlowPayWithExchangeWidget/routes/leaveExchangeRoute/leaveExchangeRoute.d.ts +21 -0
- package/dist/flow/widgets/FlowPayWithExchangeWidget/routes/leaveExchangeRoute/leaveExchangeRoute.d.ts.map +1 -0
- package/dist/flow/widgets/FlowPayWithExchangeWidget/useFlowExchangeList/index.d.ts +3 -0
- package/dist/flow/widgets/FlowPayWithExchangeWidget/useFlowExchangeList/index.d.ts.map +1 -0
- package/dist/flow/widgets/FlowPayWithExchangeWidget/useFlowExchangeList/useFlowExchangeList.d.ts +42 -0
- package/dist/flow/widgets/FlowPayWithExchangeWidget/useFlowExchangeList/useFlowExchangeList.d.ts.map +1 -0
- package/dist/flow/widgets/FlowPayWithExchangeWidget/useFlowPayWithExchangeWidget/getRouterParams/getRouterParams.d.ts +25 -0
- package/dist/flow/widgets/FlowPayWithExchangeWidget/useFlowPayWithExchangeWidget/getRouterParams/getRouterParams.d.ts.map +1 -0
- package/dist/flow/widgets/FlowPayWithExchangeWidget/useFlowPayWithExchangeWidget/getRouterParams/index.d.ts +3 -0
- package/dist/flow/widgets/FlowPayWithExchangeWidget/useFlowPayWithExchangeWidget/getRouterParams/index.d.ts.map +1 -0
- package/dist/flow/widgets/FlowPayWithExchangeWidget/useFlowPayWithExchangeWidget/index.d.ts +4 -0
- package/dist/flow/widgets/FlowPayWithExchangeWidget/useFlowPayWithExchangeWidget/index.d.ts.map +1 -0
- package/dist/flow/widgets/FlowPayWithExchangeWidget/useFlowPayWithExchangeWidget/resolveFlowExchangeBack/index.d.ts +3 -0
- package/dist/flow/widgets/FlowPayWithExchangeWidget/useFlowPayWithExchangeWidget/resolveFlowExchangeBack/index.d.ts.map +1 -0
- package/dist/flow/widgets/FlowPayWithExchangeWidget/useFlowPayWithExchangeWidget/resolveFlowExchangeBack/resolveFlowExchangeBack.d.ts +54 -0
- package/dist/flow/widgets/FlowPayWithExchangeWidget/useFlowPayWithExchangeWidget/resolveFlowExchangeBack/resolveFlowExchangeBack.d.ts.map +1 -0
- package/dist/flow/widgets/FlowPayWithExchangeWidget/useFlowPayWithExchangeWidget/useAttachFlowExchange/index.d.ts +3 -0
- package/dist/flow/widgets/FlowPayWithExchangeWidget/useFlowPayWithExchangeWidget/useAttachFlowExchange/index.d.ts.map +1 -0
- package/dist/flow/widgets/FlowPayWithExchangeWidget/useFlowPayWithExchangeWidget/useAttachFlowExchange/useAttachFlowExchange.d.ts +64 -0
- package/dist/flow/widgets/FlowPayWithExchangeWidget/useFlowPayWithExchangeWidget/useAttachFlowExchange/useAttachFlowExchange.d.ts.map +1 -0
- package/dist/flow/widgets/FlowPayWithExchangeWidget/useFlowPayWithExchangeWidget/useFlowPayWithExchangeWidget.d.ts +44 -0
- package/dist/flow/widgets/FlowPayWithExchangeWidget/useFlowPayWithExchangeWidget/useFlowPayWithExchangeWidget.d.ts.map +1 -0
- package/dist/flow/widgets/FlowPayWithExchangeWidget/useFlowPayWithExchangeWidget/useFlowPayWithExchangeWidget.types.d.ts +40 -0
- package/dist/flow/widgets/FlowPayWithExchangeWidget/useFlowPayWithExchangeWidget/useFlowPayWithExchangeWidget.types.d.ts.map +1 -0
- package/dist/flow/widgets/FlowPayWithExchangeWidget/useResumedFlowExchange/getWaitingFlowExchangeId/getWaitingFlowExchangeId.d.ts +30 -0
- package/dist/flow/widgets/FlowPayWithExchangeWidget/useResumedFlowExchange/getWaitingFlowExchangeId/getWaitingFlowExchangeId.d.ts.map +1 -0
- package/dist/flow/widgets/FlowPayWithExchangeWidget/useResumedFlowExchange/getWaitingFlowExchangeId/index.d.ts +3 -0
- package/dist/flow/widgets/FlowPayWithExchangeWidget/useResumedFlowExchange/getWaitingFlowExchangeId/index.d.ts.map +1 -0
- package/dist/flow/widgets/FlowPayWithExchangeWidget/useResumedFlowExchange/index.d.ts +3 -0
- package/dist/flow/widgets/FlowPayWithExchangeWidget/useResumedFlowExchange/index.d.ts.map +1 -0
- package/dist/flow/widgets/FlowPayWithExchangeWidget/useResumedFlowExchange/useResumedFlowExchange.d.ts +41 -0
- package/dist/flow/widgets/FlowPayWithExchangeWidget/useResumedFlowExchange/useResumedFlowExchange.d.ts.map +1 -0
- package/dist/flow/widgets/FlowPayWithWalletWidget/FlowPayWithWalletWidget.d.ts +80 -0
- package/dist/flow/widgets/FlowPayWithWalletWidget/FlowPayWithWalletWidget.d.ts.map +1 -0
- package/dist/flow/widgets/FlowPayWithWalletWidget/FlowPayWithWalletWidgetContent/FlowPayWithWalletWidgetContent.d.ts +30 -0
- package/dist/flow/widgets/FlowPayWithWalletWidget/FlowPayWithWalletWidgetContent/FlowPayWithWalletWidgetContent.d.ts.map +1 -0
- package/dist/flow/widgets/FlowPayWithWalletWidget/FlowPayWithWalletWidgetContent/index.d.ts +3 -0
- package/dist/flow/widgets/FlowPayWithWalletWidget/FlowPayWithWalletWidgetContent/index.d.ts.map +1 -0
- package/dist/flow/widgets/FlowPayWithWalletWidget/index.d.ts +3 -0
- package/dist/flow/widgets/FlowPayWithWalletWidget/index.d.ts.map +1 -0
- package/dist/flow/widgets/FlowPayWithWalletWidget/renderFlowPayWithWalletRoute/index.d.ts +3 -0
- package/dist/flow/widgets/FlowPayWithWalletWidget/renderFlowPayWithWalletRoute/index.d.ts.map +1 -0
- package/dist/flow/widgets/FlowPayWithWalletWidget/renderFlowPayWithWalletRoute/renderFlowPayWithWalletRoute.d.ts +29 -0
- package/dist/flow/widgets/FlowPayWithWalletWidget/renderFlowPayWithWalletRoute/renderFlowPayWithWalletRoute.d.ts.map +1 -0
- package/dist/flow/widgets/FlowPayWithWalletWidget/routes/chooseTokenRoute/ChooseTokenRouteView.d.ts +56 -0
- package/dist/flow/widgets/FlowPayWithWalletWidget/routes/chooseTokenRoute/ChooseTokenRouteView.d.ts.map +1 -0
- package/dist/flow/widgets/FlowPayWithWalletWidget/routes/chooseTokenRoute/chooseTokenRoute.d.ts +23 -0
- package/dist/flow/widgets/FlowPayWithWalletWidget/routes/chooseTokenRoute/chooseTokenRoute.d.ts.map +1 -0
- package/dist/flow/widgets/FlowPayWithWalletWidget/routes/chooseTokenRoute/index.d.ts +3 -0
- package/dist/flow/widgets/FlowPayWithWalletWidget/routes/chooseTokenRoute/index.d.ts.map +1 -0
- package/dist/flow/widgets/FlowPayWithWalletWidget/routes/connectWalletRoute/ConnectWalletRouteView.d.ts +58 -0
- package/dist/flow/widgets/FlowPayWithWalletWidget/routes/connectWalletRoute/ConnectWalletRouteView.d.ts.map +1 -0
- package/dist/flow/widgets/FlowPayWithWalletWidget/routes/connectWalletRoute/connectWalletRoute.d.ts +18 -0
- package/dist/flow/widgets/FlowPayWithWalletWidget/routes/connectWalletRoute/connectWalletRoute.d.ts.map +1 -0
- package/dist/flow/widgets/FlowPayWithWalletWidget/routes/connectWalletRoute/index.d.ts +3 -0
- package/dist/flow/widgets/FlowPayWithWalletWidget/routes/connectWalletRoute/index.d.ts.map +1 -0
- package/dist/flow/widgets/FlowPayWithWalletWidget/routes/flowPayWithWalletRoutes.d.ts +14 -0
- package/dist/flow/widgets/FlowPayWithWalletWidget/routes/flowPayWithWalletRoutes.d.ts.map +1 -0
- package/dist/flow/widgets/FlowPayWithWalletWidget/routes/flowPayWithWalletRoutes.types.d.ts +63 -0
- package/dist/flow/widgets/FlowPayWithWalletWidget/routes/flowPayWithWalletRoutes.types.d.ts.map +1 -0
- package/dist/flow/widgets/FlowPayWithWalletWidget/routes/paymentNotApprovedRoute/PaymentNotApprovedRouteView.d.ts +57 -0
- package/dist/flow/widgets/FlowPayWithWalletWidget/routes/paymentNotApprovedRoute/PaymentNotApprovedRouteView.d.ts.map +1 -0
- package/dist/flow/widgets/FlowPayWithWalletWidget/routes/paymentNotApprovedRoute/index.d.ts +3 -0
- package/dist/flow/widgets/FlowPayWithWalletWidget/routes/paymentNotApprovedRoute/index.d.ts.map +1 -0
- package/dist/flow/widgets/FlowPayWithWalletWidget/routes/paymentNotApprovedRoute/paymentNotApprovedRoute.d.ts +19 -0
- package/dist/flow/widgets/FlowPayWithWalletWidget/routes/paymentNotApprovedRoute/paymentNotApprovedRoute.d.ts.map +1 -0
- package/dist/flow/widgets/FlowPayWithWalletWidget/routes/paymentSentRoute/PaymentSentRouteView.d.ts +31 -0
- package/dist/flow/widgets/FlowPayWithWalletWidget/routes/paymentSentRoute/PaymentSentRouteView.d.ts.map +1 -0
- package/dist/flow/widgets/FlowPayWithWalletWidget/routes/paymentSentRoute/index.d.ts +3 -0
- package/dist/flow/widgets/FlowPayWithWalletWidget/routes/paymentSentRoute/index.d.ts.map +1 -0
- package/dist/flow/widgets/FlowPayWithWalletWidget/routes/paymentSentRoute/paymentSentRoute.d.ts +20 -0
- package/dist/flow/widgets/FlowPayWithWalletWidget/routes/paymentSentRoute/paymentSentRoute.d.ts.map +1 -0
- package/dist/flow/widgets/FlowPayWithWalletWidget/routes/reviewPaymentRoute/ReviewPaymentRouteView.d.ts +64 -0
- package/dist/flow/widgets/FlowPayWithWalletWidget/routes/reviewPaymentRoute/ReviewPaymentRouteView.d.ts.map +1 -0
- package/dist/flow/widgets/FlowPayWithWalletWidget/routes/reviewPaymentRoute/index.d.ts +3 -0
- package/dist/flow/widgets/FlowPayWithWalletWidget/routes/reviewPaymentRoute/index.d.ts.map +1 -0
- package/dist/flow/widgets/FlowPayWithWalletWidget/routes/reviewPaymentRoute/reviewPaymentRoute.d.ts +19 -0
- package/dist/flow/widgets/FlowPayWithWalletWidget/routes/reviewPaymentRoute/reviewPaymentRoute.d.ts.map +1 -0
- package/dist/flow/widgets/FlowPayWithWalletWidget/useFlowPayWithWalletWidget/findResumableWalletAccount/findResumableWalletAccount.d.ts +31 -0
- package/dist/flow/widgets/FlowPayWithWalletWidget/useFlowPayWithWalletWidget/findResumableWalletAccount/findResumableWalletAccount.d.ts.map +1 -0
- package/dist/flow/widgets/FlowPayWithWalletWidget/useFlowPayWithWalletWidget/findResumableWalletAccount/index.d.ts +3 -0
- package/dist/flow/widgets/FlowPayWithWalletWidget/useFlowPayWithWalletWidget/findResumableWalletAccount/index.d.ts.map +1 -0
- package/dist/flow/widgets/FlowPayWithWalletWidget/useFlowPayWithWalletWidget/getRouterParams/getRouterParams.d.ts +26 -0
- package/dist/flow/widgets/FlowPayWithWalletWidget/useFlowPayWithWalletWidget/getRouterParams/getRouterParams.d.ts.map +1 -0
- package/dist/flow/widgets/FlowPayWithWalletWidget/useFlowPayWithWalletWidget/getRouterParams/index.d.ts +3 -0
- package/dist/flow/widgets/FlowPayWithWalletWidget/useFlowPayWithWalletWidget/getRouterParams/index.d.ts.map +1 -0
- package/dist/flow/widgets/FlowPayWithWalletWidget/useFlowPayWithWalletWidget/getSubmitErrorAction/getSubmitErrorAction.d.ts +41 -0
- package/dist/flow/widgets/FlowPayWithWalletWidget/useFlowPayWithWalletWidget/getSubmitErrorAction/getSubmitErrorAction.d.ts.map +1 -0
- package/dist/flow/widgets/FlowPayWithWalletWidget/useFlowPayWithWalletWidget/getSubmitErrorAction/index.d.ts +3 -0
- package/dist/flow/widgets/FlowPayWithWalletWidget/useFlowPayWithWalletWidget/getSubmitErrorAction/index.d.ts.map +1 -0
- package/dist/flow/widgets/FlowPayWithWalletWidget/useFlowPayWithWalletWidget/index.d.ts +3 -0
- package/dist/flow/widgets/FlowPayWithWalletWidget/useFlowPayWithWalletWidget/index.d.ts.map +1 -0
- package/dist/flow/widgets/FlowPayWithWalletWidget/useFlowPayWithWalletWidget/useAttachWalletSource/index.d.ts +3 -0
- package/dist/flow/widgets/FlowPayWithWalletWidget/useFlowPayWithWalletWidget/useAttachWalletSource/index.d.ts.map +1 -0
- package/dist/flow/widgets/FlowPayWithWalletWidget/useFlowPayWithWalletWidget/useAttachWalletSource/useAttachWalletSource.d.ts +52 -0
- package/dist/flow/widgets/FlowPayWithWalletWidget/useFlowPayWithWalletWidget/useAttachWalletSource/useAttachWalletSource.d.ts.map +1 -0
- package/dist/flow/widgets/FlowPayWithWalletWidget/useFlowPayWithWalletWidget/useFlowPayWithWalletWidget.d.ts +97 -0
- package/dist/flow/widgets/FlowPayWithWalletWidget/useFlowPayWithWalletWidget/useFlowPayWithWalletWidget.d.ts.map +1 -0
- package/dist/flow/widgets/FlowPayWithWalletWidget/useFlowPayWithWalletWidget/useSubmitPayment/index.d.ts +3 -0
- package/dist/flow/widgets/FlowPayWithWalletWidget/useFlowPayWithWalletWidget/useSubmitPayment/index.d.ts.map +1 -0
- package/dist/flow/widgets/FlowPayWithWalletWidget/useFlowPayWithWalletWidget/useSubmitPayment/useSubmitErrorState/index.d.ts +3 -0
- package/dist/flow/widgets/FlowPayWithWalletWidget/useFlowPayWithWalletWidget/useSubmitPayment/useSubmitErrorState/index.d.ts.map +1 -0
- package/dist/flow/widgets/FlowPayWithWalletWidget/useFlowPayWithWalletWidget/useSubmitPayment/useSubmitErrorState/useSubmitErrorState.d.ts +33 -0
- package/dist/flow/widgets/FlowPayWithWalletWidget/useFlowPayWithWalletWidget/useSubmitPayment/useSubmitErrorState/useSubmitErrorState.d.ts.map +1 -0
- package/dist/flow/widgets/FlowPayWithWalletWidget/useFlowPayWithWalletWidget/useSubmitPayment/useSubmitPayment.d.ts +66 -0
- package/dist/flow/widgets/FlowPayWithWalletWidget/useFlowPayWithWalletWidget/useSubmitPayment/useSubmitPayment.d.ts.map +1 -0
- package/dist/flow/widgets/FlowPayWithWalletWidget/useFlowPayWithWalletWidget/useTokenPick/index.d.ts +3 -0
- package/dist/flow/widgets/FlowPayWithWalletWidget/useFlowPayWithWalletWidget/useTokenPick/index.d.ts.map +1 -0
- package/dist/flow/widgets/FlowPayWithWalletWidget/useFlowPayWithWalletWidget/useTokenPick/useTokenPick.d.ts +57 -0
- package/dist/flow/widgets/FlowPayWithWalletWidget/useFlowPayWithWalletWidget/useTokenPick/useTokenPick.d.ts.map +1 -0
- package/dist/flow/widgets/FlowWidget/FlowWidget.d.ts +71 -0
- package/dist/flow/widgets/FlowWidget/FlowWidget.d.ts.map +1 -0
- package/dist/flow/widgets/FlowWidget/FlowWidgetContent/FlowWidgetContent.d.ts +35 -0
- package/dist/flow/widgets/FlowWidget/FlowWidgetContent/FlowWidgetContent.d.ts.map +1 -0
- package/dist/flow/widgets/FlowWidget/FlowWidgetContent/index.d.ts +3 -0
- package/dist/flow/widgets/FlowWidget/FlowWidgetContent/index.d.ts.map +1 -0
- package/dist/flow/widgets/FlowWidget/index.d.ts +3 -0
- package/dist/flow/widgets/FlowWidget/index.d.ts.map +1 -0
- package/dist/flow/widgets/FlowWidget/renderFlowWidgetRoute/index.d.ts +3 -0
- package/dist/flow/widgets/FlowWidget/renderFlowWidgetRoute/index.d.ts.map +1 -0
- package/dist/flow/widgets/FlowWidget/renderFlowWidgetRoute/renderFlowWidgetRoute.d.ts +29 -0
- package/dist/flow/widgets/FlowWidget/renderFlowWidgetRoute/renderFlowWidgetRoute.d.ts.map +1 -0
- package/dist/flow/widgets/FlowWidget/routes/choosePaymentMethodRoute/choosePaymentMethodRoute.d.ts +16 -0
- package/dist/flow/widgets/FlowWidget/routes/choosePaymentMethodRoute/choosePaymentMethodRoute.d.ts.map +1 -0
- package/dist/flow/widgets/FlowWidget/routes/choosePaymentMethodRoute/index.d.ts +3 -0
- package/dist/flow/widgets/FlowWidget/routes/choosePaymentMethodRoute/index.d.ts.map +1 -0
- package/dist/flow/widgets/FlowWidget/routes/flowWidgetRoutes.constants.d.ts +10 -0
- package/dist/flow/widgets/FlowWidget/routes/flowWidgetRoutes.constants.d.ts.map +1 -0
- package/dist/flow/widgets/FlowWidget/routes/flowWidgetRoutes.d.ts +13 -0
- package/dist/flow/widgets/FlowWidget/routes/flowWidgetRoutes.d.ts.map +1 -0
- package/dist/flow/widgets/FlowWidget/routes/flowWidgetRoutes.types.d.ts +40 -0
- package/dist/flow/widgets/FlowWidget/routes/flowWidgetRoutes.types.d.ts.map +1 -0
- package/dist/flow/widgets/FlowWidget/routes/payWithDepositAddressRoute/index.d.ts +3 -0
- package/dist/flow/widgets/FlowWidget/routes/payWithDepositAddressRoute/index.d.ts.map +1 -0
- package/dist/flow/widgets/FlowWidget/routes/payWithDepositAddressRoute/payWithDepositAddressRoute.d.ts +17 -0
- package/dist/flow/widgets/FlowWidget/routes/payWithDepositAddressRoute/payWithDepositAddressRoute.d.ts.map +1 -0
- package/dist/flow/widgets/FlowWidget/routes/payWithExchangeRoute/index.d.ts +3 -0
- package/dist/flow/widgets/FlowWidget/routes/payWithExchangeRoute/index.d.ts.map +1 -0
- package/dist/flow/widgets/FlowWidget/routes/payWithExchangeRoute/payWithExchangeRoute.d.ts +19 -0
- package/dist/flow/widgets/FlowWidget/routes/payWithExchangeRoute/payWithExchangeRoute.d.ts.map +1 -0
- package/dist/flow/widgets/FlowWidget/routes/payWithWalletRoute/index.d.ts +3 -0
- package/dist/flow/widgets/FlowWidget/routes/payWithWalletRoute/index.d.ts.map +1 -0
- package/dist/flow/widgets/FlowWidget/routes/payWithWalletRoute/payWithWalletRoute.d.ts +17 -0
- package/dist/flow/widgets/FlowWidget/routes/payWithWalletRoute/payWithWalletRoute.d.ts.map +1 -0
- package/dist/flow/widgets/FlowWidget/useFlowWidget/getResumedFlowPaymentMethod/getResumedFlowPaymentMethod.d.ts +24 -0
- package/dist/flow/widgets/FlowWidget/useFlowWidget/getResumedFlowPaymentMethod/getResumedFlowPaymentMethod.d.ts.map +1 -0
- package/dist/flow/widgets/FlowWidget/useFlowWidget/getResumedFlowPaymentMethod/index.d.ts +3 -0
- package/dist/flow/widgets/FlowWidget/useFlowWidget/getResumedFlowPaymentMethod/index.d.ts.map +1 -0
- package/dist/flow/widgets/FlowWidget/useFlowWidget/getRouterParams/getRouterParams.d.ts +29 -0
- package/dist/flow/widgets/FlowWidget/useFlowWidget/getRouterParams/getRouterParams.d.ts.map +1 -0
- package/dist/flow/widgets/FlowWidget/useFlowWidget/getRouterParams/index.d.ts +3 -0
- package/dist/flow/widgets/FlowWidget/useFlowWidget/getRouterParams/index.d.ts.map +1 -0
- package/dist/flow/widgets/FlowWidget/useFlowWidget/index.d.ts +3 -0
- package/dist/flow/widgets/FlowWidget/useFlowWidget/index.d.ts.map +1 -0
- package/dist/flow/widgets/FlowWidget/useFlowWidget/useFlowWidget.d.ts +53 -0
- package/dist/flow/widgets/FlowWidget/useFlowWidget/useFlowWidget.d.ts.map +1 -0
- package/dist/flow.cjs +7097 -0
- package/dist/flow.cjs.map +1 -0
- package/dist/flow.css +1 -0
- package/dist/flow.esm.js +7094 -0
- package/dist/flow.esm.js.map +1 -0
- package/dist/i18n/TextProvider/TextProvider.d.ts +49 -0
- package/dist/i18n/TextProvider/TextProvider.d.ts.map +1 -0
- package/dist/i18n/TextProvider/index.d.ts +3 -0
- package/dist/i18n/TextProvider/index.d.ts.map +1 -0
- package/dist/i18n/interpolateText/index.d.ts +3 -0
- package/dist/i18n/interpolateText/index.d.ts.map +1 -0
- package/dist/i18n/interpolateText/interpolateText.d.ts +44 -0
- package/dist/i18n/interpolateText/interpolateText.d.ts.map +1 -0
- package/dist/i18n/text.types.d.ts +32 -0
- package/dist/i18n/text.types.d.ts.map +1 -0
- package/dist/i18n/useText/index.d.ts +3 -0
- package/dist/i18n/useText/index.d.ts.map +1 -0
- package/dist/i18n/useText/useText.d.ts +39 -0
- package/dist/i18n/useText/useText.d.ts.map +1 -0
- package/dist/icons/ArrowLeftIcon/ArrowLeftIcon.d.ts +24 -0
- package/dist/icons/ArrowLeftIcon/ArrowLeftIcon.d.ts.map +1 -0
- package/dist/icons/ArrowLeftIcon/index.d.ts +2 -0
- package/dist/icons/ArrowLeftIcon/index.d.ts.map +1 -0
- package/dist/icons/BankIcon/BankIcon.d.ts +23 -0
- package/dist/icons/BankIcon/BankIcon.d.ts.map +1 -0
- package/dist/icons/BankIcon/index.d.ts +2 -0
- package/dist/icons/BankIcon/index.d.ts.map +1 -0
- package/dist/icons/ChevronDownIcon/ChevronDownIcon.d.ts +22 -0
- package/dist/icons/ChevronDownIcon/ChevronDownIcon.d.ts.map +1 -0
- package/dist/icons/ChevronDownIcon/index.d.ts +2 -0
- package/dist/icons/ChevronDownIcon/index.d.ts.map +1 -0
- package/dist/icons/CopyIcon/CopyIcon.d.ts +19 -0
- package/dist/icons/CopyIcon/CopyIcon.d.ts.map +1 -0
- package/dist/icons/CopyIcon/index.d.ts +2 -0
- package/dist/icons/CopyIcon/index.d.ts.map +1 -0
- package/dist/icons/QrCodeIcon/QrCodeIcon.d.ts +23 -0
- package/dist/icons/QrCodeIcon/QrCodeIcon.d.ts.map +1 -0
- package/dist/icons/QrCodeIcon/index.d.ts +2 -0
- package/dist/icons/QrCodeIcon/index.d.ts.map +1 -0
- package/dist/icons/SearchIcon/SearchIcon.d.ts +23 -0
- package/dist/icons/SearchIcon/SearchIcon.d.ts.map +1 -0
- package/dist/icons/SearchIcon/index.d.ts +2 -0
- package/dist/icons/SearchIcon/index.d.ts.map +1 -0
- package/dist/icons/UnknownTokenIcon/UnknownTokenIcon.d.ts +21 -0
- package/dist/icons/UnknownTokenIcon/UnknownTokenIcon.d.ts.map +1 -0
- package/dist/icons/UnknownTokenIcon/index.d.ts +2 -0
- package/dist/icons/UnknownTokenIcon/index.d.ts.map +1 -0
- package/dist/icons/WalletIcon/WalletIcon.d.ts +23 -0
- package/dist/icons/WalletIcon/WalletIcon.d.ts.map +1 -0
- package/dist/icons/WalletIcon/index.d.ts +2 -0
- package/dist/icons/WalletIcon/index.d.ts.map +1 -0
- package/dist/icons/icon.types.d.ts +7 -0
- package/dist/icons/icon.types.d.ts.map +1 -0
- package/dist/index.cjs +106 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.css +1 -0
- package/dist/index.esm.js +80 -0
- package/dist/index.esm.js.map +1 -0
- package/dist/motion/MotionProvider/MotionProvider.d.ts +22 -0
- package/dist/motion/MotionProvider/MotionProvider.d.ts.map +1 -0
- package/dist/motion/MotionProvider/index.d.ts +2 -0
- package/dist/motion/MotionProvider/index.d.ts.map +1 -0
- package/dist/motion/motionTokens.d.ts +63 -0
- package/dist/motion/motionTokens.d.ts.map +1 -0
- package/dist/package-BtQHztmi.cjs +4821 -0
- package/dist/package-BtQHztmi.cjs.map +1 -0
- package/dist/package-jOFC3RJg.esm.js +4606 -0
- package/dist/package-jOFC3RJg.esm.js.map +1 -0
- package/dist/tsconfig.lib.tsbuildinfo +1 -0
- package/dist/utils/assertValidNonNegativeDecimalString/assertValidNonNegativeDecimalString.d.ts +23 -0
- package/dist/utils/assertValidNonNegativeDecimalString/assertValidNonNegativeDecimalString.d.ts.map +1 -0
- package/dist/utils/assertValidNonNegativeDecimalString/index.d.ts +3 -0
- package/dist/utils/assertValidNonNegativeDecimalString/index.d.ts.map +1 -0
- package/dist/utils/formatFiatAmount/formatFiatAmount.d.ts +30 -0
- package/dist/utils/formatFiatAmount/formatFiatAmount.d.ts.map +1 -0
- package/dist/utils/formatFiatAmount/index.d.ts +3 -0
- package/dist/utils/formatFiatAmount/index.d.ts.map +1 -0
- package/dist/utils/getChainInfo/getChainInfo.d.ts +31 -0
- package/dist/utils/getChainInfo/getChainInfo.d.ts.map +1 -0
- package/dist/utils/getChainInfo/index.d.ts +3 -0
- package/dist/utils/getChainInfo/index.d.ts.map +1 -0
- package/dist/utils/hooks/useCopyToClipboard/index.d.ts +3 -0
- package/dist/utils/hooks/useCopyToClipboard/index.d.ts.map +1 -0
- package/dist/utils/hooks/useCopyToClipboard/useCopyToClipboard.d.ts +32 -0
- package/dist/utils/hooks/useCopyToClipboard/useCopyToClipboard.d.ts.map +1 -0
- package/dist/utils/hooks/useGetWalletName/index.d.ts +3 -0
- package/dist/utils/hooks/useGetWalletName/index.d.ts.map +1 -0
- package/dist/utils/hooks/useGetWalletName/useGetWalletName.d.ts +33 -0
- package/dist/utils/hooks/useGetWalletName/useGetWalletName.d.ts.map +1 -0
- package/dist/utils/hooks/useIsomorphicLayoutEffect/index.d.ts +2 -0
- package/dist/utils/hooks/useIsomorphicLayoutEffect/index.d.ts.map +1 -0
- package/dist/utils/hooks/useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.d.ts +21 -0
- package/dist/utils/hooks/useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.d.ts.map +1 -0
- package/dist/utils/hooks/useViewRouter/index.d.ts +3 -0
- package/dist/utils/hooks/useViewRouter/index.d.ts.map +1 -0
- package/dist/utils/hooks/useViewRouter/useViewRouter.d.ts +83 -0
- package/dist/utils/hooks/useViewRouter/useViewRouter.d.ts.map +1 -0
- package/dist/utils/isValidImageSource/index.d.ts +2 -0
- package/dist/utils/isValidImageSource/index.d.ts.map +1 -0
- package/dist/utils/isValidImageSource/isValidImageSource.d.ts +21 -0
- package/dist/utils/isValidImageSource/isValidImageSource.d.ts.map +1 -0
- package/dist/utils/truncateWalletAddress/index.d.ts +3 -0
- package/dist/utils/truncateWalletAddress/index.d.ts.map +1 -0
- package/dist/utils/truncateWalletAddress/truncateWalletAddress.d.ts +23 -0
- package/dist/utils/truncateWalletAddress/truncateWalletAddress.d.ts.map +1 -0
- package/dist/views/BalancesList/BalancesList.d.ts +84 -0
- package/dist/views/BalancesList/BalancesList.d.ts.map +1 -0
- package/dist/views/BalancesList/BalancesList.text.d.ts +12 -0
- package/dist/views/BalancesList/BalancesList.text.d.ts.map +1 -0
- package/dist/views/BalancesList/index.d.ts +3 -0
- package/dist/views/BalancesList/index.d.ts.map +1 -0
- package/dist/views/ProviderList/ProviderList.d.ts +115 -0
- package/dist/views/ProviderList/ProviderList.d.ts.map +1 -0
- package/dist/views/ProviderList/ProviderList.text.d.ts +20 -0
- package/dist/views/ProviderList/ProviderList.text.d.ts.map +1 -0
- package/dist/views/ProviderList/getProviderMatchRank/getProviderMatchRank.d.ts +25 -0
- package/dist/views/ProviderList/getProviderMatchRank/getProviderMatchRank.d.ts.map +1 -0
- package/dist/views/ProviderList/getProviderMatchRank/index.d.ts +3 -0
- package/dist/views/ProviderList/getProviderMatchRank/index.d.ts.map +1 -0
- package/dist/views/ProviderList/index.d.ts +3 -0
- package/dist/views/ProviderList/index.d.ts.map +1 -0
- package/dist/views/ProviderList/rankProviderMatches/index.d.ts +3 -0
- package/dist/views/ProviderList/rankProviderMatches/index.d.ts.map +1 -0
- package/dist/views/ProviderList/rankProviderMatches/rankProviderMatches.d.ts +29 -0
- package/dist/views/ProviderList/rankProviderMatches/rankProviderMatches.d.ts.map +1 -0
- package/dist/views/WalletAccountBalances/WalletAccountBalances.d.ts +62 -0
- package/dist/views/WalletAccountBalances/WalletAccountBalances.d.ts.map +1 -0
- package/dist/views/WalletAccountBalances/WalletAccountBalances.text.d.ts +13 -0
- package/dist/views/WalletAccountBalances/WalletAccountBalances.text.d.ts.map +1 -0
- package/dist/views/WalletAccountBalances/index.d.ts +3 -0
- package/dist/views/WalletAccountBalances/index.d.ts.map +1 -0
- package/dist/views/WalletAccountBalances/orderBalancesByTokenMarketValueDesc/index.d.ts +3 -0
- package/dist/views/WalletAccountBalances/orderBalancesByTokenMarketValueDesc/index.d.ts.map +1 -0
- package/dist/views/WalletAccountBalances/orderBalancesByTokenMarketValueDesc/orderBalancesByTokenMarketValueDesc.d.ts +31 -0
- package/dist/views/WalletAccountBalances/orderBalancesByTokenMarketValueDesc/orderBalancesByTokenMarketValueDesc.d.ts.map +1 -0
- package/dist/views/WalletAccountBalances/toTokenBalanceRow/index.d.ts +3 -0
- package/dist/views/WalletAccountBalances/toTokenBalanceRow/index.d.ts.map +1 -0
- package/dist/views/WalletAccountBalances/toTokenBalanceRow/toTokenBalanceRow.d.ts +69 -0
- package/dist/views/WalletAccountBalances/toTokenBalanceRow/toTokenBalanceRow.d.ts.map +1 -0
- package/dist/views/WalletAccountBalances/useWalletAccountBalances/index.d.ts +3 -0
- package/dist/views/WalletAccountBalances/useWalletAccountBalances/index.d.ts.map +1 -0
- package/dist/views/WalletAccountBalances/useWalletAccountBalances/useWalletAccountBalances.d.ts +67 -0
- package/dist/views/WalletAccountBalances/useWalletAccountBalances/useWalletAccountBalances.d.ts.map +1 -0
- package/dist/views/WalletChainList/WalletChainList.d.ts +59 -0
- package/dist/views/WalletChainList/WalletChainList.d.ts.map +1 -0
- package/dist/views/WalletChainList/WalletChainList.text.d.ts +12 -0
- package/dist/views/WalletChainList/WalletChainList.text.d.ts.map +1 -0
- package/dist/views/WalletChainList/index.d.ts +3 -0
- package/dist/views/WalletChainList/index.d.ts.map +1 -0
- package/dist/views/WalletConnectQrCode/WalletConnectQrCode.d.ts +53 -0
- package/dist/views/WalletConnectQrCode/WalletConnectQrCode.d.ts.map +1 -0
- package/dist/views/WalletConnectQrCode/WalletConnectQrCode.text.d.ts +28 -0
- package/dist/views/WalletConnectQrCode/WalletConnectQrCode.text.d.ts.map +1 -0
- package/dist/views/WalletConnectQrCode/index.d.ts +3 -0
- package/dist/views/WalletConnectQrCode/index.d.ts.map +1 -0
- package/dist/views/WalletConnectionStatus/WalletConnectionStatus.d.ts +72 -0
- package/dist/views/WalletConnectionStatus/WalletConnectionStatus.d.ts.map +1 -0
- package/dist/views/WalletConnectionStatus/index.d.ts +3 -0
- package/dist/views/WalletConnectionStatus/index.d.ts.map +1 -0
- package/dist/views/WalletList/WalletList.d.ts +58 -0
- package/dist/views/WalletList/WalletList.d.ts.map +1 -0
- package/dist/views/WalletList/WalletList.text.d.ts +16 -0
- package/dist/views/WalletList/WalletList.text.d.ts.map +1 -0
- package/dist/views/WalletList/index.d.ts +3 -0
- package/dist/views/WalletList/index.d.ts.map +1 -0
- package/dist/widgets/ConnectWalletOptionWidget/ConnectWalletOptionWidget.d.ts +99 -0
- package/dist/widgets/ConnectWalletOptionWidget/ConnectWalletOptionWidget.d.ts.map +1 -0
- package/dist/widgets/ConnectWalletOptionWidget/ConnectWalletOptionWidget.text.d.ts +30 -0
- package/dist/widgets/ConnectWalletOptionWidget/ConnectWalletOptionWidget.text.d.ts.map +1 -0
- package/dist/widgets/ConnectWalletOptionWidget/getConnectWalletRouteTitle/getConnectWalletRouteTitle.d.ts +27 -0
- package/dist/widgets/ConnectWalletOptionWidget/getConnectWalletRouteTitle/getConnectWalletRouteTitle.d.ts.map +1 -0
- package/dist/widgets/ConnectWalletOptionWidget/getConnectWalletRouteTitle/index.d.ts +3 -0
- package/dist/widgets/ConnectWalletOptionWidget/getConnectWalletRouteTitle/index.d.ts.map +1 -0
- package/dist/widgets/ConnectWalletOptionWidget/index.d.ts +3 -0
- package/dist/widgets/ConnectWalletOptionWidget/index.d.ts.map +1 -0
- package/dist/widgets/ConnectWalletOptionWidget/renderConnectWalletRoute/index.d.ts +3 -0
- package/dist/widgets/ConnectWalletOptionWidget/renderConnectWalletRoute/index.d.ts.map +1 -0
- package/dist/widgets/ConnectWalletOptionWidget/renderConnectWalletRoute/renderConnectWalletRoute.d.ts +30 -0
- package/dist/widgets/ConnectWalletOptionWidget/renderConnectWalletRoute/renderConnectWalletRoute.d.ts.map +1 -0
- package/dist/widgets/ConnectWalletOptionWidget/routes/chainPickerRoute/ChainPickerRouteView.d.ts +42 -0
- package/dist/widgets/ConnectWalletOptionWidget/routes/chainPickerRoute/ChainPickerRouteView.d.ts.map +1 -0
- package/dist/widgets/ConnectWalletOptionWidget/routes/chainPickerRoute/ChainPickerRouteView.text.d.ts +8 -0
- package/dist/widgets/ConnectWalletOptionWidget/routes/chainPickerRoute/ChainPickerRouteView.text.d.ts.map +1 -0
- package/dist/widgets/ConnectWalletOptionWidget/routes/chainPickerRoute/chainPickerRoute.d.ts +24 -0
- package/dist/widgets/ConnectWalletOptionWidget/routes/chainPickerRoute/chainPickerRoute.d.ts.map +1 -0
- package/dist/widgets/ConnectWalletOptionWidget/routes/chainPickerRoute/index.d.ts +3 -0
- package/dist/widgets/ConnectWalletOptionWidget/routes/chainPickerRoute/index.d.ts.map +1 -0
- package/dist/widgets/ConnectWalletOptionWidget/routes/connectWalletRoutes.d.ts +14 -0
- package/dist/widgets/ConnectWalletOptionWidget/routes/connectWalletRoutes.d.ts.map +1 -0
- package/dist/widgets/ConnectWalletOptionWidget/routes/connectWalletRoutes.types.d.ts +108 -0
- package/dist/widgets/ConnectWalletOptionWidget/routes/connectWalletRoutes.types.d.ts.map +1 -0
- package/dist/widgets/ConnectWalletOptionWidget/routes/connectedRoute/ConnectedRouteView.d.ts +33 -0
- package/dist/widgets/ConnectWalletOptionWidget/routes/connectedRoute/ConnectedRouteView.d.ts.map +1 -0
- package/dist/widgets/ConnectWalletOptionWidget/routes/connectedRoute/ConnectedRouteView.text.d.ts +16 -0
- package/dist/widgets/ConnectWalletOptionWidget/routes/connectedRoute/ConnectedRouteView.text.d.ts.map +1 -0
- package/dist/widgets/ConnectWalletOptionWidget/routes/connectedRoute/connectedRoute.d.ts +22 -0
- package/dist/widgets/ConnectWalletOptionWidget/routes/connectedRoute/connectedRoute.d.ts.map +1 -0
- package/dist/widgets/ConnectWalletOptionWidget/routes/connectedRoute/index.d.ts +3 -0
- package/dist/widgets/ConnectWalletOptionWidget/routes/connectedRoute/index.d.ts.map +1 -0
- package/dist/widgets/ConnectWalletOptionWidget/routes/connectingRoute/ConnectingRouteView.d.ts +33 -0
- package/dist/widgets/ConnectWalletOptionWidget/routes/connectingRoute/ConnectingRouteView.d.ts.map +1 -0
- package/dist/widgets/ConnectWalletOptionWidget/routes/connectingRoute/ConnectingRouteView.text.d.ts +17 -0
- package/dist/widgets/ConnectWalletOptionWidget/routes/connectingRoute/ConnectingRouteView.text.d.ts.map +1 -0
- package/dist/widgets/ConnectWalletOptionWidget/routes/connectingRoute/connectingRoute.d.ts +23 -0
- package/dist/widgets/ConnectWalletOptionWidget/routes/connectingRoute/connectingRoute.d.ts.map +1 -0
- package/dist/widgets/ConnectWalletOptionWidget/routes/connectingRoute/index.d.ts +3 -0
- package/dist/widgets/ConnectWalletOptionWidget/routes/connectingRoute/index.d.ts.map +1 -0
- package/dist/widgets/ConnectWalletOptionWidget/routes/errorRoute/ErrorRouteView.d.ts +44 -0
- package/dist/widgets/ConnectWalletOptionWidget/routes/errorRoute/ErrorRouteView.d.ts.map +1 -0
- package/dist/widgets/ConnectWalletOptionWidget/routes/errorRoute/ErrorRouteView.text.d.ts +15 -0
- package/dist/widgets/ConnectWalletOptionWidget/routes/errorRoute/ErrorRouteView.text.d.ts.map +1 -0
- package/dist/widgets/ConnectWalletOptionWidget/routes/errorRoute/errorRoute.d.ts +24 -0
- package/dist/widgets/ConnectWalletOptionWidget/routes/errorRoute/errorRoute.d.ts.map +1 -0
- package/dist/widgets/ConnectWalletOptionWidget/routes/errorRoute/index.d.ts +3 -0
- package/dist/widgets/ConnectWalletOptionWidget/routes/errorRoute/index.d.ts.map +1 -0
- package/dist/widgets/ConnectWalletOptionWidget/routes/listRoute/ListRouteView.d.ts +29 -0
- package/dist/widgets/ConnectWalletOptionWidget/routes/listRoute/ListRouteView.d.ts.map +1 -0
- package/dist/widgets/ConnectWalletOptionWidget/routes/listRoute/ListRouteView.text.d.ts +8 -0
- package/dist/widgets/ConnectWalletOptionWidget/routes/listRoute/ListRouteView.text.d.ts.map +1 -0
- package/dist/widgets/ConnectWalletOptionWidget/routes/listRoute/index.d.ts +3 -0
- package/dist/widgets/ConnectWalletOptionWidget/routes/listRoute/index.d.ts.map +1 -0
- package/dist/widgets/ConnectWalletOptionWidget/routes/listRoute/listRoute.d.ts +20 -0
- package/dist/widgets/ConnectWalletOptionWidget/routes/listRoute/listRoute.d.ts.map +1 -0
- package/dist/widgets/ConnectWalletOptionWidget/routes/qrCodeRoute/QrCodeRouteView.d.ts +32 -0
- package/dist/widgets/ConnectWalletOptionWidget/routes/qrCodeRoute/QrCodeRouteView.d.ts.map +1 -0
- package/dist/widgets/ConnectWalletOptionWidget/routes/qrCodeRoute/QrCodeRouteView.text.d.ts +11 -0
- package/dist/widgets/ConnectWalletOptionWidget/routes/qrCodeRoute/QrCodeRouteView.text.d.ts.map +1 -0
- package/dist/widgets/ConnectWalletOptionWidget/routes/qrCodeRoute/index.d.ts +3 -0
- package/dist/widgets/ConnectWalletOptionWidget/routes/qrCodeRoute/index.d.ts.map +1 -0
- package/dist/widgets/ConnectWalletOptionWidget/routes/qrCodeRoute/qrCodeRoute.d.ts +24 -0
- package/dist/widgets/ConnectWalletOptionWidget/routes/qrCodeRoute/qrCodeRoute.d.ts.map +1 -0
- package/dist/widgets/ConnectWalletOptionWidget/routes/redirectingRoute/RedirectingRouteView.d.ts +34 -0
- package/dist/widgets/ConnectWalletOptionWidget/routes/redirectingRoute/RedirectingRouteView.d.ts.map +1 -0
- package/dist/widgets/ConnectWalletOptionWidget/routes/redirectingRoute/RedirectingRouteView.text.d.ts +17 -0
- package/dist/widgets/ConnectWalletOptionWidget/routes/redirectingRoute/RedirectingRouteView.text.d.ts.map +1 -0
- package/dist/widgets/ConnectWalletOptionWidget/routes/redirectingRoute/index.d.ts +3 -0
- package/dist/widgets/ConnectWalletOptionWidget/routes/redirectingRoute/index.d.ts.map +1 -0
- package/dist/widgets/ConnectWalletOptionWidget/routes/redirectingRoute/redirectingRoute.d.ts +24 -0
- package/dist/widgets/ConnectWalletOptionWidget/routes/redirectingRoute/redirectingRoute.d.ts.map +1 -0
- package/dist/widgets/ConnectWalletOptionWidget/useConnectWalletOptionWidget/index.d.ts +3 -0
- package/dist/widgets/ConnectWalletOptionWidget/useConnectWalletOptionWidget/index.d.ts.map +1 -0
- package/dist/widgets/ConnectWalletOptionWidget/useConnectWalletOptionWidget/useConnectWalletOptionWidget.d.ts +89 -0
- package/dist/widgets/ConnectWalletOptionWidget/useConnectWalletOptionWidget/useConnectWalletOptionWidget.d.ts.map +1 -0
- package/package.json +73 -1
|
@@ -0,0 +1,4821 @@
|
|
|
1
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
2
|
+
let motion_react = require("motion/react");
|
|
3
|
+
let _radix_ui_react_checkbox = require("@radix-ui/react-checkbox");
|
|
4
|
+
let react = require("react");
|
|
5
|
+
let _dynamic_labs_sdk_client_core = require("@dynamic-labs-sdk/client/core");
|
|
6
|
+
let react_dom = require("react-dom");
|
|
7
|
+
let _dynamic_labs_sdk_react_hooks = require("@dynamic-labs-sdk/react-hooks");
|
|
8
|
+
let _dynamic_labs_iconic = require("@dynamic-labs/iconic");
|
|
9
|
+
let _dynamic_labs_sdk_client = require("@dynamic-labs-sdk/client");
|
|
10
|
+
|
|
11
|
+
//#region src/components/Badge/Badge.tsx
|
|
12
|
+
/**
|
|
13
|
+
* A small status pill, such as the "Installed" marker on a wallet row.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```tsx
|
|
17
|
+
* import { Badge } from '@/components/Badge/Badge';
|
|
18
|
+
*
|
|
19
|
+
* const App = () => <Badge>Installed</Badge>;
|
|
20
|
+
* ```
|
|
21
|
+
* @param params.children - The label.
|
|
22
|
+
* @param params.className - Extra class names for the badge element.
|
|
23
|
+
* @returns The badge.
|
|
24
|
+
* @see BadgeProps
|
|
25
|
+
* @see WalletList
|
|
26
|
+
* @notInstrumented
|
|
27
|
+
*/
|
|
28
|
+
const Badge = ({ children, className }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
29
|
+
className,
|
|
30
|
+
"data-slot": "dyn-badge",
|
|
31
|
+
children
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
//#endregion
|
|
35
|
+
//#region src/motion/motionTokens.ts
|
|
36
|
+
/**
|
|
37
|
+
* The single timing source for animated elements. Hover is not here on
|
|
38
|
+
* purpose: it is a CSS transition, so it works before hydration.
|
|
39
|
+
*/
|
|
40
|
+
const SPRING = {
|
|
41
|
+
bounce: 0,
|
|
42
|
+
type: "spring",
|
|
43
|
+
visualDuration: .25
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* Press scale by target size. A full-width plate barely moves, or the whole
|
|
47
|
+
* card reads as flexing; a small icon button moves most.
|
|
48
|
+
*/
|
|
49
|
+
const PRESS_SCALE = {
|
|
50
|
+
control: .97,
|
|
51
|
+
icon: .92,
|
|
52
|
+
plate: .99,
|
|
53
|
+
row: .995
|
|
54
|
+
};
|
|
55
|
+
/**
|
|
56
|
+
* Popover entrance: ease-out-quint — a steep start so the panel answers the
|
|
57
|
+
* tap instantly, then a gentle settle.
|
|
58
|
+
*/
|
|
59
|
+
const POPOVER_ENTER = {
|
|
60
|
+
duration: .15,
|
|
61
|
+
ease: [
|
|
62
|
+
.23,
|
|
63
|
+
1,
|
|
64
|
+
.32,
|
|
65
|
+
1
|
|
66
|
+
]
|
|
67
|
+
};
|
|
68
|
+
/** Popover exit: faster and simpler than the entrance — out fast. */
|
|
69
|
+
const POPOVER_EXIT = {
|
|
70
|
+
duration: .1,
|
|
71
|
+
ease: [
|
|
72
|
+
.25,
|
|
73
|
+
.46,
|
|
74
|
+
.45,
|
|
75
|
+
.94
|
|
76
|
+
]
|
|
77
|
+
};
|
|
78
|
+
/**
|
|
79
|
+
* Panel geometry: the card's height between screens. Shorter than `SPRING`
|
|
80
|
+
* because the card is the frame, and a frame that lags reads as sluggish.
|
|
81
|
+
*/
|
|
82
|
+
const HEIGHT_SPRING = {
|
|
83
|
+
bounce: 0,
|
|
84
|
+
type: "spring",
|
|
85
|
+
visualDuration: .18
|
|
86
|
+
};
|
|
87
|
+
/** The outgoing panel title fades out first, faster than the new one fades in. */
|
|
88
|
+
const TITLE_FADE_OUT = {
|
|
89
|
+
duration: .12,
|
|
90
|
+
ease: "easeOut"
|
|
91
|
+
};
|
|
92
|
+
/** The incoming panel title waits a beat, so the two titles barely overlap. */
|
|
93
|
+
const TITLE_FADE_IN = {
|
|
94
|
+
delay: .05,
|
|
95
|
+
duration: .17,
|
|
96
|
+
ease: "easeOut"
|
|
97
|
+
};
|
|
98
|
+
/**
|
|
99
|
+
* How long pointer input is ignored after a screen change, so a double tap
|
|
100
|
+
* doesn't also hit what lands under the finger. Covers `HEIGHT_SPRING` plus
|
|
101
|
+
* the title fade; retune it with them. Keyboard input is never gated.
|
|
102
|
+
*/
|
|
103
|
+
const NAVIGATION_GATE_MS = 360;
|
|
104
|
+
/** No animation: what reduced motion swaps in for a height or title change. */
|
|
105
|
+
const INSTANT_TRANSITION = { duration: 0 };
|
|
106
|
+
|
|
107
|
+
//#endregion
|
|
108
|
+
//#region src/components/Button/Button.tsx
|
|
109
|
+
/**
|
|
110
|
+
* A full-width action button: a solid `primary` call to action, or a tonal
|
|
111
|
+
* `secondary` one shown beneath it.
|
|
112
|
+
*
|
|
113
|
+
* @example
|
|
114
|
+
* ```tsx
|
|
115
|
+
* import { Button } from '@/components/Button/Button';
|
|
116
|
+
*
|
|
117
|
+
* const App = () => (
|
|
118
|
+
* <>
|
|
119
|
+
* <Button onClick={() => {}}>Try again</Button>
|
|
120
|
+
* <Button variant="secondary" onClick={() => {}}>Pay another way</Button>
|
|
121
|
+
* </>
|
|
122
|
+
* );
|
|
123
|
+
* ```
|
|
124
|
+
* @param params.children - The label.
|
|
125
|
+
* @param params.className - Extra class names for the button element.
|
|
126
|
+
* @param params.disabled - Disables the button.
|
|
127
|
+
* @param params.onClick - Fires when the button is pressed.
|
|
128
|
+
* @param params.type - The native button type. Defaults to `'button'`.
|
|
129
|
+
* @param params.variant - The visual weight. Defaults to `'primary'`.
|
|
130
|
+
* @returns The button.
|
|
131
|
+
* @see ButtonProps
|
|
132
|
+
* @see CopyButton
|
|
133
|
+
* @see Select
|
|
134
|
+
* @notInstrumented
|
|
135
|
+
*/
|
|
136
|
+
const Button = ({ children, className, disabled, onClick, type = "button", variant = "primary" }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(motion_react.m.button, {
|
|
137
|
+
className,
|
|
138
|
+
"data-slot": "dyn-button",
|
|
139
|
+
"data-variant": variant,
|
|
140
|
+
disabled,
|
|
141
|
+
initial: false,
|
|
142
|
+
onClick,
|
|
143
|
+
type,
|
|
144
|
+
whileTap: disabled ? void 0 : { scale: PRESS_SCALE.plate },
|
|
145
|
+
children
|
|
146
|
+
});
|
|
147
|
+
|
|
148
|
+
//#endregion
|
|
149
|
+
//#region src/components/Checkbox/Checkbox.tsx
|
|
150
|
+
/**
|
|
151
|
+
* A tri-state control: unchecked, checked, or indeterminate. The mark
|
|
152
|
+
* crossfades between a check and a minus as `data-state` changes.
|
|
153
|
+
*
|
|
154
|
+
* @example
|
|
155
|
+
* ```tsx
|
|
156
|
+
* import { Checkbox } from '@/components/Checkbox/Checkbox';
|
|
157
|
+
*
|
|
158
|
+
* const App = () => (
|
|
159
|
+
* <Checkbox
|
|
160
|
+
* aria-label="Use as login method"
|
|
161
|
+
* checked={checked}
|
|
162
|
+
* onCheckedChange={(next) => setChecked(next === true)}
|
|
163
|
+
* />
|
|
164
|
+
* );
|
|
165
|
+
* ```
|
|
166
|
+
* @param params.asChild - Renders the control's styles on the child element.
|
|
167
|
+
* @param params.checked - Controlled state: `true`, `false`, or `'indeterminate'`.
|
|
168
|
+
* @param params.className - Extra class names for the control element.
|
|
169
|
+
* @param params.defaultChecked - Initial state when uncontrolled.
|
|
170
|
+
* @param params.disabled - Disables the control.
|
|
171
|
+
* @param params.name - Form field name.
|
|
172
|
+
* @param params.onCheckedChange - Fires with the next state when toggled.
|
|
173
|
+
* @param params.required - Marks the checkbox as required in a form.
|
|
174
|
+
* @param params.value - Form field value.
|
|
175
|
+
* The remaining `Checkbox.Root` and button DOM props pass through unchanged.
|
|
176
|
+
* @returns The checkbox.
|
|
177
|
+
* @see CheckboxProps
|
|
178
|
+
* @see CheckboxField
|
|
179
|
+
* @notInstrumented
|
|
180
|
+
*/
|
|
181
|
+
const Checkbox = ({ className, ...props }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_radix_ui_react_checkbox.Root, {
|
|
182
|
+
className,
|
|
183
|
+
...props,
|
|
184
|
+
"data-slot": "dyn-checkbox",
|
|
185
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_radix_ui_react_checkbox.Indicator, {
|
|
186
|
+
"data-slot": "dyn-checkbox-indicator",
|
|
187
|
+
forceMount: true,
|
|
188
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("svg", {
|
|
189
|
+
"aria-hidden": true,
|
|
190
|
+
"data-slot": "dyn-checkbox-mark-minus",
|
|
191
|
+
fill: "none",
|
|
192
|
+
stroke: "currentColor",
|
|
193
|
+
strokeLinecap: "round",
|
|
194
|
+
strokeLinejoin: "round",
|
|
195
|
+
viewBox: "0 0 24 24",
|
|
196
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
|
|
197
|
+
d: "M5 12L19 12",
|
|
198
|
+
pathLength: 1,
|
|
199
|
+
strokeWidth: 3
|
|
200
|
+
})
|
|
201
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("svg", {
|
|
202
|
+
"aria-hidden": true,
|
|
203
|
+
"data-slot": "dyn-checkbox-mark-check",
|
|
204
|
+
fill: "none",
|
|
205
|
+
stroke: "currentColor",
|
|
206
|
+
strokeLinecap: "round",
|
|
207
|
+
strokeLinejoin: "round",
|
|
208
|
+
viewBox: "0 0 24 24",
|
|
209
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
|
|
210
|
+
d: "M4 12L9 17L20 6",
|
|
211
|
+
pathLength: 1,
|
|
212
|
+
strokeWidth: 3
|
|
213
|
+
})
|
|
214
|
+
})]
|
|
215
|
+
})
|
|
216
|
+
});
|
|
217
|
+
|
|
218
|
+
//#endregion
|
|
219
|
+
//#region src/components/CheckboxField/CheckboxField.tsx
|
|
220
|
+
/**
|
|
221
|
+
* A checkbox row for consent and settings copy: the box plus a label,
|
|
222
|
+
* composed so the whole row toggles. The `<label>` wrapper forwards
|
|
223
|
+
* clicks to the checkbox button, so both controlled and uncontrolled
|
|
224
|
+
* usage work with no extra wiring.
|
|
225
|
+
*
|
|
226
|
+
* @example
|
|
227
|
+
* ```tsx
|
|
228
|
+
* import { CheckboxField } from '@/components/CheckboxField/CheckboxField';
|
|
229
|
+
*
|
|
230
|
+
* const App = () => (
|
|
231
|
+
* <CheckboxField
|
|
232
|
+
* checked={agreed}
|
|
233
|
+
* onCheckedChange={(next) => setAgreed(next === true)}
|
|
234
|
+
* >
|
|
235
|
+
* I agree to the <a href="/terms">Terms of Service</a>
|
|
236
|
+
* </CheckboxField>
|
|
237
|
+
* );
|
|
238
|
+
* ```
|
|
239
|
+
* @param params.checked - Controlled state: `true`, `false`, or `'indeterminate'`.
|
|
240
|
+
* @param params.children - Label content rendered beside the box.
|
|
241
|
+
* @param params.className - Extra class names for the row element.
|
|
242
|
+
* @param params.defaultChecked - Initial state when uncontrolled.
|
|
243
|
+
* @param params.disabled - Disables the row.
|
|
244
|
+
* @param params.onCheckedChange - Fires with the next state when toggled.
|
|
245
|
+
* The remaining `Checkbox.Root` and button DOM props pass through to the box.
|
|
246
|
+
* @returns The checkbox field.
|
|
247
|
+
* @see CheckboxFieldProps
|
|
248
|
+
* @see Checkbox
|
|
249
|
+
* @notInstrumented
|
|
250
|
+
*/
|
|
251
|
+
const CheckboxField = ({ children, className, ...props }) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
|
|
252
|
+
className,
|
|
253
|
+
"data-slot": "dyn-checkbox-field",
|
|
254
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Checkbox, { ...props }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
255
|
+
"data-slot": "dyn-checkbox-field-label",
|
|
256
|
+
children
|
|
257
|
+
})]
|
|
258
|
+
});
|
|
259
|
+
|
|
260
|
+
//#endregion
|
|
261
|
+
//#region src/i18n/TextProvider/TextProvider.tsx
|
|
262
|
+
const TextContext = (0, react.createContext)({});
|
|
263
|
+
/**
|
|
264
|
+
* Provides text overrides to generic components and views.
|
|
265
|
+
*
|
|
266
|
+
* Nested providers merge at both the slot and text-key levels.
|
|
267
|
+
*
|
|
268
|
+
* @example
|
|
269
|
+
* ```tsx
|
|
270
|
+
* <TextProvider text={{ 'dyn-search-bar': { placeholder: 'Find' } }}>
|
|
271
|
+
* <SearchBar onChange={setQuery} value={query} />
|
|
272
|
+
* </TextProvider>
|
|
273
|
+
* ```
|
|
274
|
+
* @param params.children - The subtree receiving the text dictionary.
|
|
275
|
+
* @param params.text - Text overrides keyed by component slot.
|
|
276
|
+
* @returns The provider subtree.
|
|
277
|
+
* @see TextProviderProps
|
|
278
|
+
* @see TextContext
|
|
279
|
+
* @notInstrumented
|
|
280
|
+
*/
|
|
281
|
+
const TextProvider = ({ children, text }) => {
|
|
282
|
+
const parent = (0, react.useContext)(TextContext);
|
|
283
|
+
const value = (0, react.useMemo)(() => {
|
|
284
|
+
const merged = { ...parent };
|
|
285
|
+
for (const [slot, slotText] of Object.entries(text ?? {})) merged[slot] = {
|
|
286
|
+
...parent[slot],
|
|
287
|
+
...slotText
|
|
288
|
+
};
|
|
289
|
+
return merged;
|
|
290
|
+
}, [parent, text]);
|
|
291
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TextContext.Provider, {
|
|
292
|
+
value,
|
|
293
|
+
children
|
|
294
|
+
});
|
|
295
|
+
};
|
|
296
|
+
|
|
297
|
+
//#endregion
|
|
298
|
+
//#region src/i18n/useText/useText.ts
|
|
299
|
+
/**
|
|
300
|
+
* Resolves text from the nearest provider, falling back to component defaults.
|
|
301
|
+
*
|
|
302
|
+
* @example
|
|
303
|
+
* ```tsx
|
|
304
|
+
* const text = useText({
|
|
305
|
+
* defaults: SEARCH_BAR_TEXT,
|
|
306
|
+
* slot: 'dyn-search-bar',
|
|
307
|
+
* });
|
|
308
|
+
*
|
|
309
|
+
* return <input aria-label={text('placeholder')} />;
|
|
310
|
+
* ```
|
|
311
|
+
* @param params.defaults - Default strings for the component.
|
|
312
|
+
* @param params.slot - The component's data-slot namespace.
|
|
313
|
+
* @returns A text lookup function.
|
|
314
|
+
* @see UseTextParams
|
|
315
|
+
* @see TextProvider
|
|
316
|
+
* @notInstrumented
|
|
317
|
+
*/
|
|
318
|
+
const useText = ({ defaults, slot }) => {
|
|
319
|
+
const dictionary = (0, react.useContext)(TextContext);
|
|
320
|
+
return (key) => dictionary[slot]?.[key] ?? defaults[key] ?? "";
|
|
321
|
+
};
|
|
322
|
+
|
|
323
|
+
//#endregion
|
|
324
|
+
//#region src/icons/CopyIcon/CopyIcon.tsx
|
|
325
|
+
/**
|
|
326
|
+
* Two-sheet copy glyph for the copy morph component.
|
|
327
|
+
*
|
|
328
|
+
* @example
|
|
329
|
+
* ```tsx
|
|
330
|
+
* import { CopyIcon } from '@/components/icons/CopyIcon/CopyIcon';
|
|
331
|
+
*
|
|
332
|
+
* const App = () => <CopyIcon />;
|
|
333
|
+
* ```
|
|
334
|
+
* @param params.className - Extra class names for the svg element.
|
|
335
|
+
* @param params.size - Rendered edge length in pixels.
|
|
336
|
+
* @returns The copy glyph.
|
|
337
|
+
* @see IconProps
|
|
338
|
+
* @notInstrumented
|
|
339
|
+
*/
|
|
340
|
+
const CopyIcon = ({ className, size = 18.489 }) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
|
|
341
|
+
"aria-hidden": "true",
|
|
342
|
+
className,
|
|
343
|
+
"data-slot": "dyn-copy-icon",
|
|
344
|
+
fill: "none",
|
|
345
|
+
focusable: "false",
|
|
346
|
+
height: size,
|
|
347
|
+
viewBox: "0 0 18.489 18.489",
|
|
348
|
+
width: size,
|
|
349
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
350
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("g", {
|
|
351
|
+
transform: "translate(5.39265 1.54075)",
|
|
352
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("g", {
|
|
353
|
+
"data-slot": "dyn-copy-icon-back",
|
|
354
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
|
|
355
|
+
clipRule: "evenodd",
|
|
356
|
+
d: "M2.31112 0C1.03472 0 0 1.03472 0 2.31112V3.85186H1.54075V2.31112C1.54075 1.88565 1.88565 1.54075 2.31112 1.54075H9.24448C9.66994 1.54075 10.0148 1.88565 10.0148 2.31112V9.24448C10.0148 9.66994 9.66994 10.0148 9.24448 10.0148H7.70373V11.5556H9.24448C10.5209 11.5556 11.5556 10.5209 11.5556 9.24448V2.31112C11.5556 1.03472 10.5209 0 9.24448 0H2.31112Z",
|
|
357
|
+
fill: "currentColor",
|
|
358
|
+
fillRule: "evenodd"
|
|
359
|
+
})
|
|
360
|
+
})
|
|
361
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("g", {
|
|
362
|
+
transform: "translate(1.54075 5.39265)",
|
|
363
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("g", {
|
|
364
|
+
"data-slot": "dyn-copy-icon-front",
|
|
365
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
|
|
366
|
+
clipRule: "evenodd",
|
|
367
|
+
d: "M0 2.31112C0 1.03472 1.03472 0 2.31112 0H9.24448C10.5209 0 11.5556 1.03472 11.5556 2.31112V9.24448C11.5556 10.5209 10.5209 11.5556 9.24448 11.5556H2.31112C1.03472 11.5556 0 10.5209 0 9.24448V2.31112ZM2.31112 1.54075C1.88565 1.54075 1.54075 1.88565 1.54075 2.31112V9.24448C1.54075 9.66994 1.88565 10.0148 2.31112 10.0148H9.24448C9.66994 10.0148 10.0148 9.66994 10.0148 9.24448V2.31112C10.0148 1.88565 9.66994 1.54075 9.24448 1.54075H2.31112Z",
|
|
368
|
+
fill: "currentColor",
|
|
369
|
+
fillRule: "evenodd"
|
|
370
|
+
})
|
|
371
|
+
})
|
|
372
|
+
})]
|
|
373
|
+
});
|
|
374
|
+
|
|
375
|
+
//#endregion
|
|
376
|
+
//#region src/components/CopyMorphIcon/CopyMorphIcon.tsx
|
|
377
|
+
/**
|
|
378
|
+
* A copy-to-clipboard glyph that morphs into a tick on success: the two
|
|
379
|
+
* sheets spin and slide away as the tick lands one beat behind them.
|
|
380
|
+
*
|
|
381
|
+
* @example
|
|
382
|
+
* ```tsx
|
|
383
|
+
* import { CopyMorphIcon } from '@/components/CopyMorphIcon/CopyMorphIcon';
|
|
384
|
+
*
|
|
385
|
+
* const App = () => <CopyMorphIcon copied={false} />;
|
|
386
|
+
* ```
|
|
387
|
+
* @param params.className - Extra class names for the icon element.
|
|
388
|
+
* @param params.copied - Whether the copy has landed.
|
|
389
|
+
* @param params.size - Rendered edge length in pixels.
|
|
390
|
+
* @returns The copy-morph icon.
|
|
391
|
+
* @see CopyMorphIconProps
|
|
392
|
+
* @see CopyIcon
|
|
393
|
+
* @notInstrumented
|
|
394
|
+
*/
|
|
395
|
+
const CopyMorphIcon = ({ className, copied, size }) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
396
|
+
"aria-hidden": "true",
|
|
397
|
+
className,
|
|
398
|
+
"data-slot": "dyn-copy-morph",
|
|
399
|
+
"data-state": copied ? "copied" : "idle",
|
|
400
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(CopyIcon, { size }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("svg", {
|
|
401
|
+
"data-slot": "dyn-copy-morph-tick",
|
|
402
|
+
fill: "none",
|
|
403
|
+
viewBox: "0 0 12 12",
|
|
404
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
|
|
405
|
+
d: "M2.5 6.5 L5 9 L9.5 3",
|
|
406
|
+
strokeLinecap: "round",
|
|
407
|
+
strokeLinejoin: "round",
|
|
408
|
+
strokeWidth: 1.75
|
|
409
|
+
})
|
|
410
|
+
})]
|
|
411
|
+
});
|
|
412
|
+
|
|
413
|
+
//#endregion
|
|
414
|
+
//#region src/components/CopyButton/CopyButton.text.ts
|
|
415
|
+
/**
|
|
416
|
+
* Default text for {@link CopyButton}.
|
|
417
|
+
*/
|
|
418
|
+
const COPY_BUTTON_TEXT = { copied: "Copied" };
|
|
419
|
+
|
|
420
|
+
//#endregion
|
|
421
|
+
//#region src/utils/hooks/useCopyToClipboard/useCopyToClipboard.ts
|
|
422
|
+
/** How long {@link UseCopyToClipboard.copied} stays true before it resets, in ms. */
|
|
423
|
+
const COPIED_RESET_MS = 2e3;
|
|
424
|
+
/**
|
|
425
|
+
* Copies a value to the clipboard and tracks a short-lived "copied" flag that
|
|
426
|
+
* a caller can use to swap a label or morph an icon before it resets itself.
|
|
427
|
+
*
|
|
428
|
+
* @example
|
|
429
|
+
* ```tsx
|
|
430
|
+
* const { copied, copy } = useCopyToClipboard({ value: 'wc:pairing-uri' });
|
|
431
|
+
* ```
|
|
432
|
+
* @param params.value - The text written to the clipboard when `copy` runs.
|
|
433
|
+
* @returns The `copied` flag and the `copy` handler.
|
|
434
|
+
* @see UseCopyToClipboard
|
|
435
|
+
* @see CopyButton
|
|
436
|
+
* @notInstrumented
|
|
437
|
+
*/
|
|
438
|
+
const useCopyToClipboard = ({ value }) => {
|
|
439
|
+
const [copied, setCopied] = (0, react.useState)(false);
|
|
440
|
+
const resetTimer = (0, react.useRef)(void 0);
|
|
441
|
+
const isMounted = (0, react.useRef)(true);
|
|
442
|
+
(0, react.useEffect)(() => () => {
|
|
443
|
+
isMounted.current = false;
|
|
444
|
+
clearTimeout(resetTimer.current);
|
|
445
|
+
}, []);
|
|
446
|
+
const copy = () => {
|
|
447
|
+
const clipboard = globalThis.navigator?.clipboard;
|
|
448
|
+
if (!clipboard) return;
|
|
449
|
+
(async () => {
|
|
450
|
+
try {
|
|
451
|
+
await clipboard.writeText(value);
|
|
452
|
+
} catch {
|
|
453
|
+
return;
|
|
454
|
+
}
|
|
455
|
+
if (!isMounted.current) return;
|
|
456
|
+
setCopied(true);
|
|
457
|
+
clearTimeout(resetTimer.current);
|
|
458
|
+
resetTimer.current = setTimeout(() => setCopied(false), COPIED_RESET_MS);
|
|
459
|
+
})();
|
|
460
|
+
};
|
|
461
|
+
return {
|
|
462
|
+
copied,
|
|
463
|
+
copy
|
|
464
|
+
};
|
|
465
|
+
};
|
|
466
|
+
|
|
467
|
+
//#endregion
|
|
468
|
+
//#region src/components/CopyButton/CopyButton.tsx
|
|
469
|
+
/**
|
|
470
|
+
* A button that copies `value` to the clipboard and briefly confirms with
|
|
471
|
+
* "Copied" before restoring its label. A generic action — it neither knows nor
|
|
472
|
+
* cares what the value is (a pairing URI, a deposit address, …).
|
|
473
|
+
*
|
|
474
|
+
* Built on {@link Button}, so it inherits the shared plate, variants, and press
|
|
475
|
+
* animation; its icon is the {@link CopyMorphIcon} glyph, which morphs into a
|
|
476
|
+
* tick as the copy lands.
|
|
477
|
+
*
|
|
478
|
+
* @example
|
|
479
|
+
* ```tsx
|
|
480
|
+
* import { CopyButton } from '@/components/CopyButton/CopyButton';
|
|
481
|
+
*
|
|
482
|
+
* const App = () => <CopyButton value="wc:pairing-uri">Copy QR URI</CopyButton>;
|
|
483
|
+
* ```
|
|
484
|
+
* @param params.children - The button label, shown until a copy swaps it to "Copied".
|
|
485
|
+
* @param params.className - Extra class names for the button element.
|
|
486
|
+
* @param params.value - The text written to the clipboard when the button is pressed.
|
|
487
|
+
* @param params.variant - The button's visual weight. Defaults to `'secondary'`.
|
|
488
|
+
* @returns The copy button.
|
|
489
|
+
* @see CopyButtonProps
|
|
490
|
+
* @see CopyMorphIcon
|
|
491
|
+
* @copy copied - Confirmation shown briefly after the copy succeeds, temporarily replacing the button `value`.
|
|
492
|
+
* @notInstrumented
|
|
493
|
+
*/
|
|
494
|
+
const CopyButton = ({ children, className, value, variant = "secondary" }) => {
|
|
495
|
+
const text = useText({
|
|
496
|
+
defaults: COPY_BUTTON_TEXT,
|
|
497
|
+
slot: "dyn-copy-button"
|
|
498
|
+
});
|
|
499
|
+
const { copied, copy } = useCopyToClipboard({ value });
|
|
500
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(Button, {
|
|
501
|
+
className,
|
|
502
|
+
onClick: copy,
|
|
503
|
+
variant,
|
|
504
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(CopyMorphIcon, { copied }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
505
|
+
"data-slot": "dyn-copy-button-label",
|
|
506
|
+
children: copied ? text("copied") : children
|
|
507
|
+
})]
|
|
508
|
+
});
|
|
509
|
+
};
|
|
510
|
+
|
|
511
|
+
//#endregion
|
|
512
|
+
//#region src/i18n/interpolateText/interpolateText.ts
|
|
513
|
+
/**
|
|
514
|
+
* Fills a `{placeholder}` token in a piece of text: every occurrence of
|
|
515
|
+
* `token` in `template` is replaced by `value`. Components use it to render
|
|
516
|
+
* copy keys like `connectingHelper` against the wallet the customer picked.
|
|
517
|
+
*
|
|
518
|
+
* @example
|
|
519
|
+
* ```ts
|
|
520
|
+
* const message = interpolateText({
|
|
521
|
+
* template: text('connectingHelper'),
|
|
522
|
+
* token: '{wallet}',
|
|
523
|
+
* value: wallet?.name ?? '',
|
|
524
|
+
* });
|
|
525
|
+
* ```
|
|
526
|
+
* @param params.template - The text carrying the placeholder.
|
|
527
|
+
* @param params.token - The placeholder substring to replace.
|
|
528
|
+
* @param params.value - The value substituted in.
|
|
529
|
+
* @returns The text with the placeholder filled.
|
|
530
|
+
* @see InterpolateTextParams
|
|
531
|
+
* @see useText
|
|
532
|
+
* @notInstrumented
|
|
533
|
+
*/
|
|
534
|
+
const interpolateText = ({ template, token, value }) => template.split(token).join(value);
|
|
535
|
+
|
|
536
|
+
//#endregion
|
|
537
|
+
//#region src/components/CopyField/CopyField.text.ts
|
|
538
|
+
/**
|
|
539
|
+
* Default text for {@link CopyField}.
|
|
540
|
+
*/
|
|
541
|
+
const COPY_FIELD_TEXT = {
|
|
542
|
+
copiedLabel: "{label} copied",
|
|
543
|
+
copyLabel: "Copy: {label}"
|
|
544
|
+
};
|
|
545
|
+
|
|
546
|
+
//#endregion
|
|
547
|
+
//#region src/components/CopyField/CopyField.tsx
|
|
548
|
+
/**
|
|
549
|
+
* A labeled value with a real copy button: the amount is COPYABLE, not just
|
|
550
|
+
* readable. BitPay names retyped amounts as the #1 underpayment cause; this
|
|
551
|
+
* is the fix.
|
|
552
|
+
*
|
|
553
|
+
* @example
|
|
554
|
+
* ```tsx
|
|
555
|
+
* import { CopyField } from '@/components/CopyField/CopyField';
|
|
556
|
+
*
|
|
557
|
+
* const App = () => (
|
|
558
|
+
* <CopyField
|
|
559
|
+
* copyValue="0x1234567890abcdef"
|
|
560
|
+
* display="0x1234…cdef"
|
|
561
|
+
* label="To this address"
|
|
562
|
+
* />
|
|
563
|
+
* );
|
|
564
|
+
* ```
|
|
565
|
+
* @param params.className - Extra class names for the field element.
|
|
566
|
+
* @param params.copyValue - The text written to the clipboard when the button is pressed.
|
|
567
|
+
* @param params.display - The value as rendered, usually truncated.
|
|
568
|
+
* @param params.focusOnMount - Focus the copy button on mount.
|
|
569
|
+
* @param params.label - The field label, also used in the button's accessible name.
|
|
570
|
+
* @returns The copy field.
|
|
571
|
+
* @see CopyFieldProps
|
|
572
|
+
* @see CopyButton
|
|
573
|
+
* @copy copyLabel - Accessible name of the copy button; `{label}` is replaced by the field's label.
|
|
574
|
+
* @copy copiedLabel - Accessible name while the copy confirmation shows; `{label}` is replaced by the field's label.
|
|
575
|
+
* @notInstrumented
|
|
576
|
+
*/
|
|
577
|
+
const CopyField = ({ className, copyValue, display, focusOnMount, label }) => {
|
|
578
|
+
const text = useText({
|
|
579
|
+
defaults: COPY_FIELD_TEXT,
|
|
580
|
+
slot: "dyn-copy-field"
|
|
581
|
+
});
|
|
582
|
+
const { copied, copy } = useCopyToClipboard({ value: copyValue });
|
|
583
|
+
const ariaLabel = interpolateText({
|
|
584
|
+
template: text(copied ? "copiedLabel" : "copyLabel"),
|
|
585
|
+
token: "{label}",
|
|
586
|
+
value: label
|
|
587
|
+
});
|
|
588
|
+
const focusOnMountRef = (0, react.useRef)(focusOnMount);
|
|
589
|
+
const setButton = (0, react.useCallback)((node) => {
|
|
590
|
+
if (node && focusOnMountRef.current) requestAnimationFrame(() => node.focus({ preventScroll: true }));
|
|
591
|
+
}, []);
|
|
592
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
593
|
+
className,
|
|
594
|
+
"data-slot": "dyn-copy-field",
|
|
595
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
596
|
+
"data-slot": "dyn-copy-field-text",
|
|
597
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
598
|
+
"data-slot": "dyn-copy-field-label",
|
|
599
|
+
children: label
|
|
600
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
601
|
+
"data-slot": "dyn-copy-field-value",
|
|
602
|
+
children: display
|
|
603
|
+
})]
|
|
604
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
605
|
+
"aria-label": ariaLabel,
|
|
606
|
+
"data-slot": "dyn-copy-field-button",
|
|
607
|
+
onClick: copy,
|
|
608
|
+
ref: setButton,
|
|
609
|
+
type: "button",
|
|
610
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CopyMorphIcon, { copied })
|
|
611
|
+
})]
|
|
612
|
+
});
|
|
613
|
+
};
|
|
614
|
+
|
|
615
|
+
//#endregion
|
|
616
|
+
//#region src/icons/ArrowLeftIcon/ArrowLeftIcon.tsx
|
|
617
|
+
/**
|
|
618
|
+
* Left-arrow glyph for the header's Back button.
|
|
619
|
+
*
|
|
620
|
+
* The source artwork is 13.33×10.67; it is centred inside a square 16 viewBox
|
|
621
|
+
* (the header's glyph box) so the icon reads as a square edge length like every
|
|
622
|
+
* other {@link IconProps} icon, and inherits its color from `currentColor`
|
|
623
|
+
* so the button can darken it on hover.
|
|
624
|
+
*
|
|
625
|
+
* @example
|
|
626
|
+
* ```tsx
|
|
627
|
+
* import { ArrowLeftIcon } from '@/components/icons/ArrowLeftIcon/ArrowLeftIcon';
|
|
628
|
+
*
|
|
629
|
+
* const App = () => <ArrowLeftIcon />;
|
|
630
|
+
* ```
|
|
631
|
+
* @param params.className - Extra class names for the svg element.
|
|
632
|
+
* @param params.size - Rendered edge length in pixels.
|
|
633
|
+
* @returns The back-arrow glyph.
|
|
634
|
+
* @see IconProps
|
|
635
|
+
* @notInstrumented
|
|
636
|
+
*/
|
|
637
|
+
const ArrowLeftIcon = ({ className, size = 16 }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("svg", {
|
|
638
|
+
"aria-hidden": "true",
|
|
639
|
+
className,
|
|
640
|
+
fill: "none",
|
|
641
|
+
focusable: "false",
|
|
642
|
+
height: size,
|
|
643
|
+
viewBox: "0 0 16 16",
|
|
644
|
+
width: size,
|
|
645
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
646
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
|
|
647
|
+
clipRule: "evenodd",
|
|
648
|
+
d: "M5.80474 0.195262C6.06509 0.455612 6.06509 0.877722 5.80474 1.13807L2.27614 4.66667L12.6667 4.66667C13.0349 4.66667 13.3333 4.96514 13.3333 5.33333C13.3333 5.70152 13.0349 6 12.6667 6H2.27614L5.80474 9.5286C6.06509 9.78895 6.06509 10.2111 5.80474 10.4714C5.54439 10.7318 5.12228 10.7318 4.86193 10.4714L0.195262 5.80474C-0.0650874 5.54439 -0.0650874 5.12228 0.195262 4.86193L4.86193 0.195262C5.12228 -0.0650874 5.54439 -0.0650874 5.80474 0.195262Z",
|
|
649
|
+
fill: "currentColor",
|
|
650
|
+
fillRule: "evenodd",
|
|
651
|
+
transform: "translate(1.33333 2.66665)"
|
|
652
|
+
})
|
|
653
|
+
});
|
|
654
|
+
|
|
655
|
+
//#endregion
|
|
656
|
+
//#region src/components/PanelHeader/PanelHeader.text.ts
|
|
657
|
+
/**
|
|
658
|
+
* Default text for {@link PanelHeader}.
|
|
659
|
+
*/
|
|
660
|
+
const PANEL_HEADER_TEXT = { back: "Back" };
|
|
661
|
+
|
|
662
|
+
//#endregion
|
|
663
|
+
//#region src/components/PanelHeader/usePanelHeader/usePanelHeader.ts
|
|
664
|
+
/**
|
|
665
|
+
* State for {@link PanelHeader}: whether Back shows, its copy, and the title
|
|
666
|
+
* crossfade timing, which reduced motion turns into an instant swap.
|
|
667
|
+
*
|
|
668
|
+
* @example
|
|
669
|
+
* ```tsx
|
|
670
|
+
* const { hasBackButton, text, titleTransition } = usePanelHeader({ onBack });
|
|
671
|
+
* ```
|
|
672
|
+
* @param params.onBack - Fires when Back is pressed; `undefined` hides Back.
|
|
673
|
+
* @returns What the header renders.
|
|
674
|
+
* @see PanelHeader
|
|
675
|
+
* @see PanelHost
|
|
676
|
+
* @notInstrumented
|
|
677
|
+
*/
|
|
678
|
+
const usePanelHeader = ({ onBack }) => {
|
|
679
|
+
const isReducedMotion = (0, motion_react.useReducedMotion)() === true;
|
|
680
|
+
const text = useText({
|
|
681
|
+
defaults: PANEL_HEADER_TEXT,
|
|
682
|
+
slot: "dyn-panel-header"
|
|
683
|
+
});
|
|
684
|
+
return {
|
|
685
|
+
hasBackButton: onBack !== void 0,
|
|
686
|
+
text,
|
|
687
|
+
titleTransition: isReducedMotion ? {
|
|
688
|
+
enter: INSTANT_TRANSITION,
|
|
689
|
+
exit: INSTANT_TRANSITION
|
|
690
|
+
} : {
|
|
691
|
+
enter: TITLE_FADE_IN,
|
|
692
|
+
exit: TITLE_FADE_OUT
|
|
693
|
+
}
|
|
694
|
+
};
|
|
695
|
+
};
|
|
696
|
+
|
|
697
|
+
//#endregion
|
|
698
|
+
//#region src/components/PanelHeader/PanelHeader.tsx
|
|
699
|
+
/**
|
|
700
|
+
* The panel's title bar: a Back button on the left, the centered screen
|
|
701
|
+
* title, and a balancing spacer on the right so the title stays optically
|
|
702
|
+
* centered whether or not Back is shown. A single bordered strip that sits
|
|
703
|
+
* above whatever screen body is rendered below it. When the title changes,
|
|
704
|
+
* only the title text crossfades; the bar stays still.
|
|
705
|
+
*
|
|
706
|
+
* @example
|
|
707
|
+
* ```tsx
|
|
708
|
+
* import { PanelHeader } from '@/components/PanelHeader/PanelHeader';
|
|
709
|
+
*
|
|
710
|
+
* const App = () => (
|
|
711
|
+
* <PanelHeader onBack={() => history.back()} title="Connect" />
|
|
712
|
+
* );
|
|
713
|
+
* ```
|
|
714
|
+
* @param params.backLabel - The Back button's accessible label; overrides the `back` copy.
|
|
715
|
+
* @param params.className - Extra class names for the header element.
|
|
716
|
+
* @param params.onBack - Fires when the Back button is pressed. Omit on a root screen to hide Back.
|
|
717
|
+
* @param params.title - The centered screen title.
|
|
718
|
+
* @param params.titleId - An id for the title, so the surrounding card can be named by it.
|
|
719
|
+
* @returns The header bar.
|
|
720
|
+
* @see PanelHeaderProps
|
|
721
|
+
* @see Panel
|
|
722
|
+
* @copy back - Accessible label of the back button.
|
|
723
|
+
* @notInstrumented
|
|
724
|
+
*/
|
|
725
|
+
const PanelHeader = ({ backLabel, className, onBack, title, titleId }) => {
|
|
726
|
+
const { hasBackButton, text, titleTransition } = usePanelHeader({ onBack });
|
|
727
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
728
|
+
className,
|
|
729
|
+
"data-slot": "dyn-panel-header",
|
|
730
|
+
children: [
|
|
731
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
732
|
+
"data-slot": "dyn-panel-header-slot",
|
|
733
|
+
children: hasBackButton ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(motion_react.m.button, {
|
|
734
|
+
"aria-label": backLabel ?? text("back"),
|
|
735
|
+
"data-slot": "dyn-panel-header-button",
|
|
736
|
+
onClick: onBack,
|
|
737
|
+
type: "button",
|
|
738
|
+
whileTap: { scale: PRESS_SCALE.icon },
|
|
739
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ArrowLeftIcon, {})
|
|
740
|
+
}) : null
|
|
741
|
+
}),
|
|
742
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("h1", {
|
|
743
|
+
"aria-label": title,
|
|
744
|
+
"data-slot": "dyn-panel-header-title",
|
|
745
|
+
id: titleId,
|
|
746
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(motion_react.AnimatePresence, {
|
|
747
|
+
initial: false,
|
|
748
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(motion_react.m.span, {
|
|
749
|
+
animate: {
|
|
750
|
+
opacity: 1,
|
|
751
|
+
transition: titleTransition.enter
|
|
752
|
+
},
|
|
753
|
+
"aria-hidden": "true",
|
|
754
|
+
"data-slot": "dyn-panel-header-title-text",
|
|
755
|
+
exit: {
|
|
756
|
+
opacity: 0,
|
|
757
|
+
transition: titleTransition.exit
|
|
758
|
+
},
|
|
759
|
+
initial: { opacity: 0 },
|
|
760
|
+
children: title
|
|
761
|
+
}, title)
|
|
762
|
+
})
|
|
763
|
+
}),
|
|
764
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
765
|
+
"aria-hidden": "true",
|
|
766
|
+
"data-slot": "dyn-panel-header-slot"
|
|
767
|
+
})
|
|
768
|
+
]
|
|
769
|
+
});
|
|
770
|
+
};
|
|
771
|
+
|
|
772
|
+
//#endregion
|
|
773
|
+
//#region src/utils/hooks/useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.ts
|
|
774
|
+
/**
|
|
775
|
+
* `useLayoutEffect` in the browser and `useEffect` during server rendering,
|
|
776
|
+
* where React 18 warns that a layout effect does nothing. Effects never run on
|
|
777
|
+
* the server either way, so only the warning changes.
|
|
778
|
+
*
|
|
779
|
+
* @example
|
|
780
|
+
* ```ts
|
|
781
|
+
* useIsomorphicLayoutEffect(() => {
|
|
782
|
+
* measure();
|
|
783
|
+
* }, [measure]);
|
|
784
|
+
* ```
|
|
785
|
+
* @param effect - The effect to run after the DOM updates.
|
|
786
|
+
* @param deps - The values the effect depends on; omit to run after every render.
|
|
787
|
+
* @returns Nothing.
|
|
788
|
+
* @see usePanel
|
|
789
|
+
* @see Panel
|
|
790
|
+
* @notInstrumented
|
|
791
|
+
*/
|
|
792
|
+
const useIsomorphicLayoutEffect = (effect, deps) => {
|
|
793
|
+
((0, _dynamic_labs_sdk_client_core.isServerSideRendering)() ? react.useEffect : react.useLayoutEffect)(effect, deps);
|
|
794
|
+
};
|
|
795
|
+
|
|
796
|
+
//#endregion
|
|
797
|
+
//#region src/components/PanelHost/PanelHostContext/PanelHostContext.ts
|
|
798
|
+
/**
|
|
799
|
+
* Set by {@link PanelHost}; `undefined` outside one, where a {@link Panel}
|
|
800
|
+
* draws its own card.
|
|
801
|
+
*
|
|
802
|
+
* @example
|
|
803
|
+
* ```tsx
|
|
804
|
+
* const host = useContext(PanelHostContext);
|
|
805
|
+
* const isHosted = host !== undefined;
|
|
806
|
+
* ```
|
|
807
|
+
* @returns The context object panels read their host from.
|
|
808
|
+
* @see PanelHost
|
|
809
|
+
* @see usePanel
|
|
810
|
+
*/
|
|
811
|
+
const PanelHostContext = (0, react.createContext)(void 0);
|
|
812
|
+
|
|
813
|
+
//#endregion
|
|
814
|
+
//#region src/components/Panel/usePanel/usePanel.ts
|
|
815
|
+
/**
|
|
816
|
+
* Connects a {@link Panel} to the {@link PanelHost} around it, if any: on
|
|
817
|
+
* mount the panel becomes the screen that owns the host's header, and on
|
|
818
|
+
* every render it reports its current title, Back and Back label.
|
|
819
|
+
*
|
|
820
|
+
* @example
|
|
821
|
+
* ```tsx
|
|
822
|
+
* const { isHosted } = usePanel({ onBack, title });
|
|
823
|
+
* ```
|
|
824
|
+
* @param params.onBack - Fires when Back is pressed; `undefined` hides Back.
|
|
825
|
+
* @param params.title - The header title; `undefined` hides the header.
|
|
826
|
+
* @returns Whether a host draws the card.
|
|
827
|
+
* @see Panel
|
|
828
|
+
* @see PanelHost
|
|
829
|
+
* @notInstrumented
|
|
830
|
+
*/
|
|
831
|
+
const usePanel = ({ onBack, title }) => {
|
|
832
|
+
const host = (0, react.useContext)(PanelHostContext);
|
|
833
|
+
const backLabel = useText({
|
|
834
|
+
defaults: PANEL_HEADER_TEXT,
|
|
835
|
+
slot: "dyn-panel-header"
|
|
836
|
+
})("back");
|
|
837
|
+
const id = (0, react.useId)();
|
|
838
|
+
const registerPanel = host?.registerPanel;
|
|
839
|
+
const reportHeader = host?.reportHeader;
|
|
840
|
+
const unregisterPanel = host?.unregisterPanel;
|
|
841
|
+
useIsomorphicLayoutEffect(() => {
|
|
842
|
+
if (registerPanel === void 0 || unregisterPanel === void 0) return;
|
|
843
|
+
registerPanel(id);
|
|
844
|
+
return () => unregisterPanel(id);
|
|
845
|
+
}, [
|
|
846
|
+
id,
|
|
847
|
+
registerPanel,
|
|
848
|
+
unregisterPanel
|
|
849
|
+
]);
|
|
850
|
+
useIsomorphicLayoutEffect(() => {
|
|
851
|
+
reportHeader?.(id, {
|
|
852
|
+
backLabel,
|
|
853
|
+
onBack,
|
|
854
|
+
title
|
|
855
|
+
});
|
|
856
|
+
});
|
|
857
|
+
return { isHosted: host !== void 0 };
|
|
858
|
+
};
|
|
859
|
+
|
|
860
|
+
//#endregion
|
|
861
|
+
//#region src/components/Panel/Panel.tsx
|
|
862
|
+
/**
|
|
863
|
+
* The default panel box: the bordered, rounded card that frames a screen — an
|
|
864
|
+
* optional {@link PanelHeader} on top and the screen body below it. Screens
|
|
865
|
+
* share the card chrome and header here rather than drawing their own. Omit
|
|
866
|
+
* `title` for a headerless panel that is body only. Inside a
|
|
867
|
+
* {@link PanelHost}, the host draws the card and header, and the panel
|
|
868
|
+
* renders only its body.
|
|
869
|
+
*
|
|
870
|
+
* @example
|
|
871
|
+
* ```tsx
|
|
872
|
+
* import { Panel } from '@/components/Panel/Panel';
|
|
873
|
+
*
|
|
874
|
+
* const App = () => (
|
|
875
|
+
* <Panel onBack={() => history.back()} title="Choose a token">
|
|
876
|
+
* <TokenList />
|
|
877
|
+
* </Panel>
|
|
878
|
+
* );
|
|
879
|
+
* ```
|
|
880
|
+
* @param params.children - The screen body rendered under the header.
|
|
881
|
+
* @param params.className - Extra class names for the card element, or the body inside a host.
|
|
882
|
+
* @param params.onBack - Fires when the Back button is pressed. Omit on a root screen to hide Back.
|
|
883
|
+
* @param params.title - The centered header title. Omit for a headerless panel.
|
|
884
|
+
* @returns The panel box.
|
|
885
|
+
* @see PanelProps
|
|
886
|
+
* @see PanelHeader
|
|
887
|
+
* @see PanelHost
|
|
888
|
+
* @notInstrumented
|
|
889
|
+
*/
|
|
890
|
+
const Panel = ({ children, className, onBack, title }) => {
|
|
891
|
+
const { isHosted } = usePanel({
|
|
892
|
+
onBack,
|
|
893
|
+
title
|
|
894
|
+
});
|
|
895
|
+
if (isHosted) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
896
|
+
className,
|
|
897
|
+
"data-slot": "dyn-panel-content",
|
|
898
|
+
children
|
|
899
|
+
});
|
|
900
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
901
|
+
className,
|
|
902
|
+
"data-slot": "dyn-panel",
|
|
903
|
+
children: [title !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PanelHeader, {
|
|
904
|
+
onBack,
|
|
905
|
+
title
|
|
906
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
907
|
+
"data-slot": "dyn-panel-body",
|
|
908
|
+
children
|
|
909
|
+
})]
|
|
910
|
+
});
|
|
911
|
+
};
|
|
912
|
+
|
|
913
|
+
//#endregion
|
|
914
|
+
//#region src/utils/isValidImageSource/isValidImageSource.ts
|
|
915
|
+
/**
|
|
916
|
+
* Checks whether a URL is safe to use as an `<img>` `src`: an `https://`
|
|
917
|
+
* address, or an inline `data:image/...` URI (the format the SDK's own
|
|
918
|
+
* provider-icon fixtures ship as). Anything else — `javascript:`,
|
|
919
|
+
* `data:text/html`, `http://`, etc. — is rejected, since a wallet provider's
|
|
920
|
+
* icon URL is untrusted, third-party input rendered on a payment screen.
|
|
921
|
+
*
|
|
922
|
+
* @param url - The candidate image URL.
|
|
923
|
+
* @returns `true` when the URL is a safe image source, otherwise `false`.
|
|
924
|
+
* @example
|
|
925
|
+
* ```ts
|
|
926
|
+
* isValidImageSource('https://example.test/metamask.svg'); // true
|
|
927
|
+
* isValidImageSource('data:image/png;base64,iVBORw0KGgo='); // true
|
|
928
|
+
* isValidImageSource('javascript:alert(1)'); // false
|
|
929
|
+
* ```
|
|
930
|
+
* @see ProviderIcon
|
|
931
|
+
* @see TokenMark
|
|
932
|
+
* @notInstrumented
|
|
933
|
+
*/
|
|
934
|
+
const isValidImageSource = (url) => /^https:\/\//i.test(url.trim()) || /^data:image\//i.test(url.trim());
|
|
935
|
+
|
|
936
|
+
//#endregion
|
|
937
|
+
//#region src/components/ProviderIcon/ProviderIcon.tsx
|
|
938
|
+
/**
|
|
939
|
+
* A wallet or exchange icon, rendered from a URL rather than bundled artwork.
|
|
940
|
+
* Falls back to a monogram of the provider's name when there is no URL, or
|
|
941
|
+
* when the image at that URL fails to load.
|
|
942
|
+
*
|
|
943
|
+
* @example
|
|
944
|
+
* ```tsx
|
|
945
|
+
* import { ProviderIcon } from '@/components/ProviderIcon/ProviderIcon';
|
|
946
|
+
*
|
|
947
|
+
* const App = () => (
|
|
948
|
+
* <ProviderIcon name="MetaMask" url="https://example.test/metamask.svg" />
|
|
949
|
+
* );
|
|
950
|
+
* ```
|
|
951
|
+
* @param params.className - Extra class names for the icon element.
|
|
952
|
+
* @param params.name - Display name, used for the monogram fallback.
|
|
953
|
+
* @param params.url - Icon URL. Absent renders the monogram.
|
|
954
|
+
* @returns The provider icon.
|
|
955
|
+
* @see ProviderIconProps
|
|
956
|
+
* @see isValidImageSource
|
|
957
|
+
* @see ProviderOption
|
|
958
|
+
* @see ProviderList
|
|
959
|
+
* @notInstrumented
|
|
960
|
+
*/
|
|
961
|
+
const ProviderIcon = ({ className, name: name$1, url }) => {
|
|
962
|
+
const [failedUrl, setFailedUrl] = (0, react.useState)(void 0);
|
|
963
|
+
const showsIcon = url !== void 0 && isValidImageSource(url) && url !== failedUrl;
|
|
964
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
965
|
+
"aria-hidden": "true",
|
|
966
|
+
className,
|
|
967
|
+
"data-has-icon": showsIcon || void 0,
|
|
968
|
+
"data-slot": "dyn-provider-icon",
|
|
969
|
+
children: showsIcon ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("img", {
|
|
970
|
+
alt: "",
|
|
971
|
+
"data-slot": "dyn-provider-icon-image",
|
|
972
|
+
onError: () => setFailedUrl(url),
|
|
973
|
+
src: url
|
|
974
|
+
}) : name$1.trim().charAt(0).toUpperCase() || "?"
|
|
975
|
+
});
|
|
976
|
+
};
|
|
977
|
+
|
|
978
|
+
//#endregion
|
|
979
|
+
//#region src/components/ProviderOption/ProviderOption.tsx
|
|
980
|
+
/**
|
|
981
|
+
* One pickable wallet or exchange: icon, name, optional trailing badge.
|
|
982
|
+
*
|
|
983
|
+
* @example
|
|
984
|
+
* ```tsx
|
|
985
|
+
* import { ProviderOption } from '@/components/ProviderOption/ProviderOption';
|
|
986
|
+
*
|
|
987
|
+
* const App = () => (
|
|
988
|
+
* <ProviderOption
|
|
989
|
+
* icon={<ProviderIcon name="MetaMask" url="https://example.test/metamask.svg" />}
|
|
990
|
+
* name="MetaMask"
|
|
991
|
+
* onClick={() => {}}
|
|
992
|
+
* />
|
|
993
|
+
* );
|
|
994
|
+
* ```
|
|
995
|
+
* @param params.badge - Trailing marker.
|
|
996
|
+
* @param params.className - Extra class names for the row element.
|
|
997
|
+
* @param params.icon - The provider icon.
|
|
998
|
+
* @param params.name - The provider's display name.
|
|
999
|
+
* @param params.onClick - Fires when the row is chosen.
|
|
1000
|
+
* @param params.id - Row identifier, exposed as `data-testid="provider-option-<id>"`.
|
|
1001
|
+
* @returns The provider option.
|
|
1002
|
+
* @see ProviderOptionProps
|
|
1003
|
+
* @see ProviderList
|
|
1004
|
+
* @notInstrumented
|
|
1005
|
+
*/
|
|
1006
|
+
const ProviderOption = ({ badge, className, icon, id, name: name$1, onClick }) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(motion_react.m.button, {
|
|
1007
|
+
className,
|
|
1008
|
+
"data-slot": "dyn-provider-option",
|
|
1009
|
+
"data-testid": id !== void 0 ? `provider-option-${id}` : void 0,
|
|
1010
|
+
initial: false,
|
|
1011
|
+
onClick,
|
|
1012
|
+
type: "button",
|
|
1013
|
+
whileTap: { scale: PRESS_SCALE.row },
|
|
1014
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
1015
|
+
"data-slot": "dyn-provider-option-lead",
|
|
1016
|
+
children: [icon, /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1017
|
+
"data-slot": "dyn-provider-option-name",
|
|
1018
|
+
children: name$1
|
|
1019
|
+
})]
|
|
1020
|
+
}), badge !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1021
|
+
"data-slot": "dyn-provider-option-badge",
|
|
1022
|
+
children: badge
|
|
1023
|
+
})]
|
|
1024
|
+
});
|
|
1025
|
+
|
|
1026
|
+
//#endregion
|
|
1027
|
+
//#region src/components/QRCode/QRCode.constants.ts
|
|
1028
|
+
/**
|
|
1029
|
+
* Tunable design/timing values for the QRCode family (`QRCode`,
|
|
1030
|
+
* `snapQrGeometry`, `decorateQrReveal`, `buildQrCodeOptions`,
|
|
1031
|
+
* `pollForQrReveal`), gathered so a tweak touches one file, not five.
|
|
1032
|
+
* Values derived from these (e.g. a delay computed from a duration and a
|
|
1033
|
+
* spread) stay local to the function that derives them.
|
|
1034
|
+
*/
|
|
1035
|
+
/** Design-locked default tile size, in px. Always square (width = height). */
|
|
1036
|
+
const QR_DEFAULT_SIZE = 180;
|
|
1037
|
+
/** Tile corner radius, in px. */
|
|
1038
|
+
const QR_TILE_RADIUS = 18;
|
|
1039
|
+
/** Quiet ring target before snapping — see snapQrGeometry. */
|
|
1040
|
+
const QR_TILE_PAD = 15;
|
|
1041
|
+
/** Pinned QR version, so every short payload (EVM/Solana/Bitcoin addresses) draws the same grid. */
|
|
1042
|
+
const QR_VERSION = 5;
|
|
1043
|
+
/** Module count for {@link QR_VERSION} (version*4 + 17) — used for both drawing and ghost sizing. */
|
|
1044
|
+
const QR_MODULES = QR_VERSION * 4 + 17;
|
|
1045
|
+
/** Design-locked dots + rounded finders — matches the shape language of the placeholder's ghost pattern. */
|
|
1046
|
+
const QR_STYLE = {
|
|
1047
|
+
cornerDotType: "dot",
|
|
1048
|
+
cornerType: "extra-rounded",
|
|
1049
|
+
dotType: "dots",
|
|
1050
|
+
ink: "#000000"
|
|
1051
|
+
};
|
|
1052
|
+
/** Fraction of the code's error-correction capacity the logo's cleared hole covers. */
|
|
1053
|
+
const QR_DEFAULT_LOGO_SIZE = .25;
|
|
1054
|
+
/** ECC level H's coverage fraction — qr-code-styling sizes the hidden-module hole as imageSize × this. */
|
|
1055
|
+
const QR_LOGO_ECC_COVERAGE = .3;
|
|
1056
|
+
/** In px, shrinks the logo within its cleared hole (not outer spacing) — keep small or it reads as tiny. */
|
|
1057
|
+
const QR_LOGO_MARGIN = 4;
|
|
1058
|
+
/** Transparent 1×1, handed to qr-code-styling only so it clears the center hole — the real icon is drawn as our own overlay, so the sprite URL it can't render never reaches the library. */
|
|
1059
|
+
const QR_LOGO_HOLE_IMAGE = "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7";
|
|
1060
|
+
/** Stagger span from the first dot to the last, in ms. */
|
|
1061
|
+
const QR_REVEAL_SPREAD_MS = 570;
|
|
1062
|
+
/** Each dot's own grow-in duration, in ms. */
|
|
1063
|
+
const QR_REVEAL_DOT_MS = 340;
|
|
1064
|
+
/** Hold before the first dot grows in, in ms. */
|
|
1065
|
+
const QR_REVEAL_DELAY_MS = 50;
|
|
1066
|
+
/** Small per-dot random wobble on top of the wave delay, in ms — organic, never the driver. */
|
|
1067
|
+
const QR_REVEAL_JITTER_MS = 20;
|
|
1068
|
+
/** How far ahead of the local wave a finder eye appears, in ms. */
|
|
1069
|
+
const QR_REVEAL_EYE_LEAD_MS = 0;
|
|
1070
|
+
/** Must match the ghost's fade-out duration in QRCode.css — kept in sync by hand, CSS can't be read back into JS. */
|
|
1071
|
+
const QR_REVEAL_GHOST_FADE_MS = 450;
|
|
1072
|
+
|
|
1073
|
+
//#endregion
|
|
1074
|
+
//#region src/components/QRCode/QRCode.text.ts
|
|
1075
|
+
/**
|
|
1076
|
+
* Default text for {@link QRCode}.
|
|
1077
|
+
*/
|
|
1078
|
+
const QR_CODE_TEXT = { encoding: "QR code encoding {value}" };
|
|
1079
|
+
/**
|
|
1080
|
+
* Placeholder token used in {@link QR_CODE_TEXT.encoding}.
|
|
1081
|
+
*/
|
|
1082
|
+
const QR_CODE_VALUE_TOKEN = "{value}";
|
|
1083
|
+
|
|
1084
|
+
//#endregion
|
|
1085
|
+
//#region src/components/QRCode/buildQrCodeOptions/buildQrCodeOptions.ts
|
|
1086
|
+
/**
|
|
1087
|
+
* Builds the qr-code-styling options for a drawn QR code: the design-locked
|
|
1088
|
+
* dot/corner style and size always, plus a cleared, margined hole for a
|
|
1089
|
+
* logo when there is one.
|
|
1090
|
+
*
|
|
1091
|
+
* @example
|
|
1092
|
+
* ```ts
|
|
1093
|
+
* const options = buildQrCodeOptions({ hasLogo: false, logoSize: 0.4, px: 148, value: 'https://example.com' });
|
|
1094
|
+
* ```
|
|
1095
|
+
* @param params.hasLogo - Whether to clear a hole for the logo overlay.
|
|
1096
|
+
* @param params.logoSize - Fraction of the code the logo's hole occupies.
|
|
1097
|
+
* @param params.px - The drawn code's exact pixel size.
|
|
1098
|
+
* @param params.value - The data the code encodes.
|
|
1099
|
+
* @returns The options to pass to `new QRCodeStyling(...)` or `.update(...)`.
|
|
1100
|
+
* @see QRCode
|
|
1101
|
+
* @see useQrCode
|
|
1102
|
+
* @notInstrumented
|
|
1103
|
+
*/
|
|
1104
|
+
const buildQrCodeOptions = ({ hasLogo, logoSize, px, value }) => ({
|
|
1105
|
+
backgroundOptions: { color: "transparent" },
|
|
1106
|
+
cornersDotOptions: {
|
|
1107
|
+
color: QR_STYLE.ink,
|
|
1108
|
+
type: QR_STYLE.cornerDotType
|
|
1109
|
+
},
|
|
1110
|
+
cornersSquareOptions: {
|
|
1111
|
+
color: QR_STYLE.ink,
|
|
1112
|
+
type: QR_STYLE.cornerType
|
|
1113
|
+
},
|
|
1114
|
+
data: value,
|
|
1115
|
+
dotsOptions: {
|
|
1116
|
+
color: QR_STYLE.ink,
|
|
1117
|
+
roundSize: false,
|
|
1118
|
+
type: QR_STYLE.dotType
|
|
1119
|
+
},
|
|
1120
|
+
height: px,
|
|
1121
|
+
image: hasLogo ? QR_LOGO_HOLE_IMAGE : void 0,
|
|
1122
|
+
imageOptions: {
|
|
1123
|
+
hideBackgroundDots: true,
|
|
1124
|
+
imageSize: logoSize,
|
|
1125
|
+
margin: QR_LOGO_MARGIN
|
|
1126
|
+
},
|
|
1127
|
+
qrOptions: { errorCorrectionLevel: "H" },
|
|
1128
|
+
type: "svg",
|
|
1129
|
+
width: px
|
|
1130
|
+
});
|
|
1131
|
+
|
|
1132
|
+
//#endregion
|
|
1133
|
+
//#region src/components/QRCode/logoOverlayPx/logoOverlayPx.ts
|
|
1134
|
+
/**
|
|
1135
|
+
* Sizes the logo overlay to the hole qr-code-styling actually clears, minus
|
|
1136
|
+
* the margin the hole keeps on every side.
|
|
1137
|
+
*
|
|
1138
|
+
* The library hides a module count of `floor(modules × sqrt(imageSize ×
|
|
1139
|
+
* eccCoverage))`, so the hole's edge grows with `sqrt(logoSize)`, not linearly
|
|
1140
|
+
* — a linear `px × logoSize` overlay outgrows the hole above ~0.3 and covers
|
|
1141
|
+
* live modules.
|
|
1142
|
+
*
|
|
1143
|
+
* @example
|
|
1144
|
+
* ```ts
|
|
1145
|
+
* const width = logoOverlayPx({ logoSize: 0.25, px: 148 }); // 32
|
|
1146
|
+
* ```
|
|
1147
|
+
* @param params.logoSize - Fraction of the code's error-correction capacity the cleared hole covers.
|
|
1148
|
+
* @param params.px - The drawn code's exact pixel size.
|
|
1149
|
+
* @returns The overlay's width and height in px.
|
|
1150
|
+
* @see QRCode
|
|
1151
|
+
* @see useQrCode
|
|
1152
|
+
* @notInstrumented
|
|
1153
|
+
*/
|
|
1154
|
+
const logoOverlayPx = ({ logoSize, px }) => {
|
|
1155
|
+
const holePx = px * Math.sqrt(logoSize * QR_LOGO_ECC_COVERAGE);
|
|
1156
|
+
return Math.max(0, Math.floor(holePx) - 2 * QR_LOGO_MARGIN);
|
|
1157
|
+
};
|
|
1158
|
+
|
|
1159
|
+
//#endregion
|
|
1160
|
+
//#region src/components/QRCode/decorateQrReveal/decorateQrReveal.ts
|
|
1161
|
+
const LOGO_DELAY_MS = QR_REVEAL_DELAY_MS + QR_REVEAL_SPREAD_MS + QR_REVEAL_DOT_MS;
|
|
1162
|
+
/**
|
|
1163
|
+
* Assigns each drawn QR module its grow-in delay and duration. Runs once,
|
|
1164
|
+
* after qr-code-styling has appended the svg — the draw is async, so the
|
|
1165
|
+
* caller polls until modules exist before calling this. Finder eyes
|
|
1166
|
+
* complete first; a center logo, if the code has one, grows in last, once
|
|
1167
|
+
* every module has finished. Jitter is a position hash, not `Math.random`,
|
|
1168
|
+
* so a re-render of the same code staggers identically.
|
|
1169
|
+
*
|
|
1170
|
+
* @example
|
|
1171
|
+
* ```ts
|
|
1172
|
+
* decorateQrReveal(svgElement);
|
|
1173
|
+
* ```
|
|
1174
|
+
* @param svg - The drawn QR code's svg element.
|
|
1175
|
+
* @returns Nothing — mutates the svg's modules in place.
|
|
1176
|
+
* @see QRCode
|
|
1177
|
+
* @see pollForQrReveal
|
|
1178
|
+
* @notInstrumented
|
|
1179
|
+
*/
|
|
1180
|
+
const decorateQrReveal = (svg) => {
|
|
1181
|
+
const size = svg.viewBox.baseVal.height || svg.clientHeight || 1;
|
|
1182
|
+
const modules = Array.from(svg.querySelectorAll("rect, circle, path"));
|
|
1183
|
+
for (const module$1 of modules) {
|
|
1184
|
+
let bounds;
|
|
1185
|
+
try {
|
|
1186
|
+
bounds = module$1.getBBox();
|
|
1187
|
+
} catch {
|
|
1188
|
+
continue;
|
|
1189
|
+
}
|
|
1190
|
+
if (bounds.width <= 0) continue;
|
|
1191
|
+
if (bounds.width > size * .3) continue;
|
|
1192
|
+
const isEye = bounds.width > size / QR_MODULES * 4;
|
|
1193
|
+
const cx = bounds.x + bounds.width / 2;
|
|
1194
|
+
const cy = bounds.y + bounds.height / 2;
|
|
1195
|
+
const hash = Math.abs(Math.sin(cx * 12.9898 + cy * 78.233) * 43758.5453) % 1;
|
|
1196
|
+
const phase = (cx + cy) / (2 * size);
|
|
1197
|
+
if (isEye) {
|
|
1198
|
+
const delay$1 = QR_REVEAL_DELAY_MS + phase * QR_REVEAL_SPREAD_MS - QR_REVEAL_EYE_LEAD_MS;
|
|
1199
|
+
module$1.style.setProperty("--dyn-qr-reveal-delay", `${Math.max(0, Math.round(delay$1))}ms`);
|
|
1200
|
+
module$1.classList.add("dyn-qr-eye-in");
|
|
1201
|
+
continue;
|
|
1202
|
+
}
|
|
1203
|
+
const delay = QR_REVEAL_DELAY_MS + phase * QR_REVEAL_SPREAD_MS + (hash - .5) * 2 * QR_REVEAL_JITTER_MS;
|
|
1204
|
+
module$1.style.setProperty("--dyn-qr-reveal-delay", `${Math.max(0, Math.round(delay))}ms`);
|
|
1205
|
+
module$1.classList.add("dyn-qr-dot-in");
|
|
1206
|
+
}
|
|
1207
|
+
const logo = svg.querySelector("image");
|
|
1208
|
+
if (logo) {
|
|
1209
|
+
logo.style.setProperty("--dyn-qr-reveal-delay", `${LOGO_DELAY_MS}ms`);
|
|
1210
|
+
logo.classList.add("dyn-qr-dot-in");
|
|
1211
|
+
}
|
|
1212
|
+
};
|
|
1213
|
+
|
|
1214
|
+
//#endregion
|
|
1215
|
+
//#region src/components/QRCode/pollForQrReveal/pollForQrReveal.ts
|
|
1216
|
+
const POLL_TIMEOUT_MS = 3e3;
|
|
1217
|
+
const MIN_MODULES_TO_DECORATE = 8;
|
|
1218
|
+
const IDLE_POLL_INTERVAL_MS = 1e3;
|
|
1219
|
+
/**
|
|
1220
|
+
* Polls, frame by frame, for a QR code's asynchronously-drawn svg to have
|
|
1221
|
+
* enough modules, decorates its reveal animation once, then calls
|
|
1222
|
+
* `onRevealed` after the placeholder's own fade-out duration
|
|
1223
|
+
* (`QR_REVEAL_GHOST_FADE_MS`) — the placeholder unmounts only once its CSS
|
|
1224
|
+
* dissolve has actually finished, not the instant the real code appears.
|
|
1225
|
+
*
|
|
1226
|
+
* @example
|
|
1227
|
+
* ```ts
|
|
1228
|
+
* const stop = pollForQrReveal({
|
|
1229
|
+
* getSvg: () => holder.current?.querySelector('svg'),
|
|
1230
|
+
* onReady: () => setIsRevealing(true),
|
|
1231
|
+
* onRevealed: () => setShowPlaceholder(false),
|
|
1232
|
+
* });
|
|
1233
|
+
* ```
|
|
1234
|
+
* @param params.getSvg - Returns the drawn code's svg, or a nullish value before it exists.
|
|
1235
|
+
* @param params.onReady - Called the moment the svg is decorated, before the fade-out window starts.
|
|
1236
|
+
* @param params.onRevealed - Called once decorated and the fade-out window has elapsed.
|
|
1237
|
+
* @returns A cleanup function that stops polling and cancels the pending call to `onRevealed`.
|
|
1238
|
+
* @see decorateQrReveal
|
|
1239
|
+
* @see QRCode
|
|
1240
|
+
* @notInstrumented
|
|
1241
|
+
*/
|
|
1242
|
+
const pollForQrReveal = ({ getSvg, onReady, onRevealed }) => {
|
|
1243
|
+
let stopped = false;
|
|
1244
|
+
const start = performance.now();
|
|
1245
|
+
const tick = () => {
|
|
1246
|
+
if (stopped) return;
|
|
1247
|
+
const svg = getSvg();
|
|
1248
|
+
if (svg && svg.querySelectorAll("rect, circle, path").length > MIN_MODULES_TO_DECORATE) {
|
|
1249
|
+
decorateQrReveal(svg);
|
|
1250
|
+
onReady?.();
|
|
1251
|
+
setTimeout(() => {
|
|
1252
|
+
if (!stopped) onRevealed();
|
|
1253
|
+
}, QR_REVEAL_GHOST_FADE_MS);
|
|
1254
|
+
return;
|
|
1255
|
+
}
|
|
1256
|
+
if (performance.now() - start < POLL_TIMEOUT_MS) {
|
|
1257
|
+
requestAnimationFrame(tick);
|
|
1258
|
+
return;
|
|
1259
|
+
}
|
|
1260
|
+
if (svg) {
|
|
1261
|
+
onRevealed();
|
|
1262
|
+
return;
|
|
1263
|
+
}
|
|
1264
|
+
setTimeout(() => {
|
|
1265
|
+
if (!stopped) tick();
|
|
1266
|
+
}, IDLE_POLL_INTERVAL_MS);
|
|
1267
|
+
};
|
|
1268
|
+
requestAnimationFrame(tick);
|
|
1269
|
+
return () => {
|
|
1270
|
+
stopped = true;
|
|
1271
|
+
};
|
|
1272
|
+
};
|
|
1273
|
+
|
|
1274
|
+
//#endregion
|
|
1275
|
+
//#region src/components/QRCode/snapQrGeometry/snapQrGeometry.ts
|
|
1276
|
+
/**
|
|
1277
|
+
* Snaps a QR tile's target width to an exact module multiple.
|
|
1278
|
+
*
|
|
1279
|
+
* qr-code-styling floors to integer pixels per module and silently centers
|
|
1280
|
+
* the remainder as invisible internal padding, so an unsnapped width hides a
|
|
1281
|
+
* few pixels of ring inside the drawn svg instead of showing them as the
|
|
1282
|
+
* visible quiet zone. Picking the nearest integer module size and
|
|
1283
|
+
* recomputing the ring from what's left keeps the visible ring exact and
|
|
1284
|
+
* uniform — `pad` is the target it lands closest to, not a guarantee.
|
|
1285
|
+
*
|
|
1286
|
+
* @example
|
|
1287
|
+
* ```ts
|
|
1288
|
+
* const { px, ring } = snapQrGeometry({ pad: 12, tileWidth: 160 });
|
|
1289
|
+
* ```
|
|
1290
|
+
* @param params.pad - Quiet ring target, in px, before snapping.
|
|
1291
|
+
* @param params.tileWidth - The tile's outer width, in px.
|
|
1292
|
+
* @returns The drawn code's exact size and the ring left over.
|
|
1293
|
+
* @see QRCode
|
|
1294
|
+
* @see useQrCode
|
|
1295
|
+
* @notInstrumented
|
|
1296
|
+
*/
|
|
1297
|
+
const snapQrGeometry = ({ pad, tileWidth }) => {
|
|
1298
|
+
const inner = Math.round(tileWidth) - 2;
|
|
1299
|
+
let perModule = Math.max(1, Math.round((inner - pad * 2) / QR_MODULES));
|
|
1300
|
+
if (perModule * QR_MODULES > inner - 8) perModule = Math.max(1, perModule - 1);
|
|
1301
|
+
const px = perModule * QR_MODULES;
|
|
1302
|
+
return {
|
|
1303
|
+
px,
|
|
1304
|
+
ring: Math.max(0, (inner - px) / 2)
|
|
1305
|
+
};
|
|
1306
|
+
};
|
|
1307
|
+
|
|
1308
|
+
//#endregion
|
|
1309
|
+
//#region src/components/QRCode/useQrCode/useQrCode.ts
|
|
1310
|
+
/**
|
|
1311
|
+
* Manages QR code drawing and its loading placeholder state.
|
|
1312
|
+
*
|
|
1313
|
+
* @example
|
|
1314
|
+
* ```tsx
|
|
1315
|
+
* const { holder, px } = useQrCode({ logoSize: 0.4, size: 180, value: 'https://example.com' });
|
|
1316
|
+
* ```
|
|
1317
|
+
* @param params.logoSize - Fraction of the code's error-correction capacity the logo's cleared hole covers.
|
|
1318
|
+
* @param params.logoSrc - A logo image URL drawn in the code's cleared center.
|
|
1319
|
+
* @param params.size - Tile size in px.
|
|
1320
|
+
* @param params.value - The data the code encodes.
|
|
1321
|
+
* @returns The QR code drawing state and holder ref.
|
|
1322
|
+
* @see QRCode
|
|
1323
|
+
* @see buildQrCodeOptions
|
|
1324
|
+
* @notInstrumented
|
|
1325
|
+
*/
|
|
1326
|
+
const useQrCode = ({ logoSize, logoSrc, size, value }) => {
|
|
1327
|
+
const holder = (0, react.useRef)(null);
|
|
1328
|
+
const qrCodeStyling = (0, react.useRef)(null);
|
|
1329
|
+
const wasLoading = (0, react.useRef)(!value);
|
|
1330
|
+
const [showPlaceholder, setShowPlaceholder] = (0, react.useState)(!value);
|
|
1331
|
+
const [isRevealing, setIsRevealing] = (0, react.useState)(false);
|
|
1332
|
+
const [isDrawn, setIsDrawn] = (0, react.useState)(false);
|
|
1333
|
+
const { px, ring } = snapQrGeometry({
|
|
1334
|
+
pad: QR_TILE_PAD,
|
|
1335
|
+
tileWidth: size
|
|
1336
|
+
});
|
|
1337
|
+
const ghostModule = px / QR_MODULES;
|
|
1338
|
+
const hasLogo = Boolean(logoSrc && isValidImageSource(logoSrc));
|
|
1339
|
+
const logoPx = logoOverlayPx({
|
|
1340
|
+
logoSize,
|
|
1341
|
+
px
|
|
1342
|
+
});
|
|
1343
|
+
const clearQrCode = (0, react.useCallback)(() => {
|
|
1344
|
+
qrCodeStyling.current = null;
|
|
1345
|
+
holder.current?.replaceChildren();
|
|
1346
|
+
wasLoading.current = true;
|
|
1347
|
+
setShowPlaceholder(true);
|
|
1348
|
+
setIsRevealing(false);
|
|
1349
|
+
setIsDrawn(false);
|
|
1350
|
+
}, []);
|
|
1351
|
+
const drawQrCode = (0, react.useCallback)(({ qrValue }) => {
|
|
1352
|
+
const isGenuineReveal = wasLoading.current;
|
|
1353
|
+
const options = buildQrCodeOptions({
|
|
1354
|
+
hasLogo,
|
|
1355
|
+
logoSize,
|
|
1356
|
+
px,
|
|
1357
|
+
value: qrValue
|
|
1358
|
+
});
|
|
1359
|
+
let cancelled = false;
|
|
1360
|
+
let stopReveal;
|
|
1361
|
+
const startRevealIfPending = () => {
|
|
1362
|
+
if (!isGenuineReveal) return;
|
|
1363
|
+
stopReveal = pollForQrReveal({
|
|
1364
|
+
getSvg: () => holder.current?.querySelector("svg"),
|
|
1365
|
+
onReady: () => setIsRevealing(true),
|
|
1366
|
+
onRevealed: () => {
|
|
1367
|
+
wasLoading.current = false;
|
|
1368
|
+
setShowPlaceholder(false);
|
|
1369
|
+
setIsRevealing(false);
|
|
1370
|
+
}
|
|
1371
|
+
});
|
|
1372
|
+
};
|
|
1373
|
+
if (qrCodeStyling.current) {
|
|
1374
|
+
qrCodeStyling.current.update(options);
|
|
1375
|
+
setIsDrawn(true);
|
|
1376
|
+
startRevealIfPending();
|
|
1377
|
+
return () => {
|
|
1378
|
+
stopReveal?.();
|
|
1379
|
+
};
|
|
1380
|
+
}
|
|
1381
|
+
import("qr-code-styling").then(({ default: QRCodeStylingClass }) => {
|
|
1382
|
+
if (cancelled) return;
|
|
1383
|
+
qrCodeStyling.current = new QRCodeStylingClass(options);
|
|
1384
|
+
qrCodeStyling.current.append(holder.current);
|
|
1385
|
+
setIsDrawn(true);
|
|
1386
|
+
startRevealIfPending();
|
|
1387
|
+
});
|
|
1388
|
+
return () => {
|
|
1389
|
+
cancelled = true;
|
|
1390
|
+
stopReveal?.();
|
|
1391
|
+
};
|
|
1392
|
+
}, [
|
|
1393
|
+
hasLogo,
|
|
1394
|
+
logoSize,
|
|
1395
|
+
px
|
|
1396
|
+
]);
|
|
1397
|
+
(0, react.useEffect)(() => {
|
|
1398
|
+
if (!value) {
|
|
1399
|
+
clearQrCode();
|
|
1400
|
+
return;
|
|
1401
|
+
}
|
|
1402
|
+
return drawQrCode({ qrValue: value });
|
|
1403
|
+
}, [
|
|
1404
|
+
value,
|
|
1405
|
+
clearQrCode,
|
|
1406
|
+
drawQrCode
|
|
1407
|
+
]);
|
|
1408
|
+
return {
|
|
1409
|
+
ghostModule,
|
|
1410
|
+
hasLogo,
|
|
1411
|
+
holder,
|
|
1412
|
+
isDrawn,
|
|
1413
|
+
isRevealing,
|
|
1414
|
+
logoPx,
|
|
1415
|
+
px,
|
|
1416
|
+
ring,
|
|
1417
|
+
showPlaceholder
|
|
1418
|
+
};
|
|
1419
|
+
};
|
|
1420
|
+
|
|
1421
|
+
//#endregion
|
|
1422
|
+
//#region src/components/QRCode/QRCode.tsx
|
|
1423
|
+
/**
|
|
1424
|
+
* A generated, scannable QR code — never a static image, since the payload
|
|
1425
|
+
* changes per render (a pairing URI, a deposit address, …). Knows nothing
|
|
1426
|
+
* about wallets, chains, or any particular protocol: it draws whatever
|
|
1427
|
+
* string it is given. Renders a pulsing placeholder in place of the code
|
|
1428
|
+
* while `value` is not yet available, e.g. a pairing URI still being
|
|
1429
|
+
* generated.
|
|
1430
|
+
*
|
|
1431
|
+
* @example
|
|
1432
|
+
* ```tsx
|
|
1433
|
+
* import { QRCode } from '@/components/QRCode/QRCode';
|
|
1434
|
+
*
|
|
1435
|
+
* const App = () => <QRCode value="https://example.com" />;
|
|
1436
|
+
* ```
|
|
1437
|
+
* @param params.className - Extra class names for the tile element.
|
|
1438
|
+
* @param params.label - A concise accessible name for the code, preferred over naming it by its encoded value. Applied only once `value` is set.
|
|
1439
|
+
* @param params.loadingMessage - Shown next to the placeholder pattern while `value` is not yet available.
|
|
1440
|
+
* @param params.logoSrc - A logo image URL drawn in the code's cleared center once `value` is available.
|
|
1441
|
+
* @param params.logoSize - Fraction of the code's error-correction capacity the logo's cleared hole covers. Defaults to the design-locked size.
|
|
1442
|
+
* @param params.size - Tile size (width and height), in px. Defaults to the design-locked box.
|
|
1443
|
+
* @param params.value - The data the code encodes. Omit while the payload is still being generated.
|
|
1444
|
+
* @returns The QR code.
|
|
1445
|
+
* @see QRCodeProps
|
|
1446
|
+
* @see useQrCode
|
|
1447
|
+
* @copy encoding - Accessible label announcing what the code encodes; custom text may include `{value}`, replaced by the payload.
|
|
1448
|
+
* @notInstrumented
|
|
1449
|
+
*/
|
|
1450
|
+
const QRCode = ({ className, label, loadingMessage, logoSize = QR_DEFAULT_LOGO_SIZE, logoSrc, size = QR_DEFAULT_SIZE, value }) => {
|
|
1451
|
+
const text = useText({
|
|
1452
|
+
defaults: QR_CODE_TEXT,
|
|
1453
|
+
slot: "dyn-qr-code"
|
|
1454
|
+
});
|
|
1455
|
+
const { ghostModule, hasLogo, holder, isDrawn, isRevealing, logoPx, px, ring, showPlaceholder } = useQrCode({
|
|
1456
|
+
logoSize,
|
|
1457
|
+
logoSrc,
|
|
1458
|
+
size,
|
|
1459
|
+
value
|
|
1460
|
+
});
|
|
1461
|
+
const logoImageSrc = logoSrc?.trim();
|
|
1462
|
+
const shouldRenderLogo = hasLogo && isDrawn && !showPlaceholder;
|
|
1463
|
+
const graphicLabel = value ? label ?? interpolateText({
|
|
1464
|
+
template: text("encoding"),
|
|
1465
|
+
token: QR_CODE_VALUE_TOKEN,
|
|
1466
|
+
value
|
|
1467
|
+
}) : void 0;
|
|
1468
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1469
|
+
className,
|
|
1470
|
+
"data-slot": "dyn-qr-code",
|
|
1471
|
+
style: {
|
|
1472
|
+
borderRadius: QR_TILE_RADIUS,
|
|
1473
|
+
height: size,
|
|
1474
|
+
padding: ring,
|
|
1475
|
+
width: size
|
|
1476
|
+
},
|
|
1477
|
+
children: [
|
|
1478
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1479
|
+
"aria-label": graphicLabel,
|
|
1480
|
+
"data-slot": "dyn-qr-code-graphic",
|
|
1481
|
+
role: value ? "img" : void 0,
|
|
1482
|
+
style: {
|
|
1483
|
+
height: px,
|
|
1484
|
+
width: px
|
|
1485
|
+
},
|
|
1486
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1487
|
+
"aria-hidden": "true",
|
|
1488
|
+
"data-slot": "dyn-qr-code-holder",
|
|
1489
|
+
ref: holder,
|
|
1490
|
+
style: {
|
|
1491
|
+
height: px,
|
|
1492
|
+
width: px
|
|
1493
|
+
}
|
|
1494
|
+
})
|
|
1495
|
+
}),
|
|
1496
|
+
shouldRenderLogo && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("img", {
|
|
1497
|
+
alt: "",
|
|
1498
|
+
"aria-hidden": "true",
|
|
1499
|
+
"data-slot": "dyn-qr-code-logo",
|
|
1500
|
+
src: logoImageSrc,
|
|
1501
|
+
style: { "--dyn-qr-logo-px": `${logoPx}px` }
|
|
1502
|
+
}),
|
|
1503
|
+
showPlaceholder && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
1504
|
+
"aria-hidden": "true",
|
|
1505
|
+
"data-revealing": isRevealing || void 0,
|
|
1506
|
+
"data-slot": "dyn-qr-code-ghost",
|
|
1507
|
+
style: {
|
|
1508
|
+
"--dyn-qr-ghost-module": `${ghostModule}px`,
|
|
1509
|
+
inset: ring
|
|
1510
|
+
},
|
|
1511
|
+
children: [
|
|
1512
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1513
|
+
"data-corner": "top-left",
|
|
1514
|
+
"data-slot": "dyn-qr-code-ghost-finder",
|
|
1515
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { "data-slot": "dyn-qr-code-ghost-finder-dot" })
|
|
1516
|
+
}),
|
|
1517
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1518
|
+
"data-corner": "top-right",
|
|
1519
|
+
"data-slot": "dyn-qr-code-ghost-finder",
|
|
1520
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { "data-slot": "dyn-qr-code-ghost-finder-dot" })
|
|
1521
|
+
}),
|
|
1522
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1523
|
+
"data-corner": "bottom-left",
|
|
1524
|
+
"data-slot": "dyn-qr-code-ghost-finder",
|
|
1525
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { "data-slot": "dyn-qr-code-ghost-finder-dot" })
|
|
1526
|
+
}),
|
|
1527
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { "data-slot": "dyn-qr-code-ghost-field" })
|
|
1528
|
+
]
|
|
1529
|
+
}),
|
|
1530
|
+
showPlaceholder && loadingMessage && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1531
|
+
"data-revealing": isRevealing || void 0,
|
|
1532
|
+
"data-slot": "dyn-qr-code-message-wrap",
|
|
1533
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1534
|
+
"data-slot": "dyn-qr-code-message",
|
|
1535
|
+
children: loadingMessage
|
|
1536
|
+
})
|
|
1537
|
+
})
|
|
1538
|
+
]
|
|
1539
|
+
});
|
|
1540
|
+
};
|
|
1541
|
+
|
|
1542
|
+
//#endregion
|
|
1543
|
+
//#region src/icons/SearchIcon/SearchIcon.tsx
|
|
1544
|
+
/**
|
|
1545
|
+
* Search glyph for the search bar component.
|
|
1546
|
+
*
|
|
1547
|
+
* Defaults to its ink box rather than the larger slot the search bar reserves: the
|
|
1548
|
+
* artwork is cropped to the ink, so stretching it to the slot distorts it.
|
|
1549
|
+
* Centring inside the slot is the search bar's CSS problem, not this component's.
|
|
1550
|
+
*
|
|
1551
|
+
* @example
|
|
1552
|
+
* ```tsx
|
|
1553
|
+
* import { SearchIcon } from '@/components/icons/SearchIcon/SearchIcon';
|
|
1554
|
+
*
|
|
1555
|
+
* const App = () => <SearchIcon />;
|
|
1556
|
+
* ```
|
|
1557
|
+
* @param params.className - Extra class names for the svg element.
|
|
1558
|
+
* @param params.size - Rendered edge length in pixels.
|
|
1559
|
+
* @returns The search glyph.
|
|
1560
|
+
* @see IconProps
|
|
1561
|
+
* @notInstrumented
|
|
1562
|
+
*/
|
|
1563
|
+
const SearchIcon = ({ className, size = 15.4075 }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("svg", {
|
|
1564
|
+
"aria-hidden": "true",
|
|
1565
|
+
className,
|
|
1566
|
+
fill: "none",
|
|
1567
|
+
focusable: "false",
|
|
1568
|
+
height: size,
|
|
1569
|
+
viewBox: "0 0 15.4075 15.4075",
|
|
1570
|
+
width: size,
|
|
1571
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1572
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
|
|
1573
|
+
clipRule: "evenodd",
|
|
1574
|
+
d: "M6.16298 1.54075C3.61019 1.54075 1.54075 3.61019 1.54075 6.16298C1.54075 8.71577 3.61019 10.7852 6.16298 10.7852C8.71577 10.7852 10.7852 8.71577 10.7852 6.16298C10.7852 3.61019 8.71577 1.54075 6.16298 1.54075ZM0 6.16298C0 2.75926 2.75926 0 6.16298 0C9.5667 0 12.326 2.75926 12.326 6.16298C12.326 7.58718 11.8429 8.89855 11.0316 9.94216L15.1818 14.0923C15.4827 14.3932 15.4827 14.881 15.1818 15.1818C14.881 15.4827 14.3932 15.4827 14.0923 15.1818L9.94216 11.0316C8.89855 11.8429 7.58718 12.326 6.16298 12.326C2.75926 12.326 0 9.5667 0 6.16298Z",
|
|
1575
|
+
fill: "currentColor",
|
|
1576
|
+
fillRule: "evenodd"
|
|
1577
|
+
})
|
|
1578
|
+
});
|
|
1579
|
+
|
|
1580
|
+
//#endregion
|
|
1581
|
+
//#region src/components/SearchBar/SearchBar.text.ts
|
|
1582
|
+
/**
|
|
1583
|
+
* Default text for {@link SearchBar}.
|
|
1584
|
+
*/
|
|
1585
|
+
const SEARCH_BAR_TEXT = { placeholder: "Search" };
|
|
1586
|
+
|
|
1587
|
+
//#endregion
|
|
1588
|
+
//#region src/components/SearchBar/SearchBar.tsx
|
|
1589
|
+
/**
|
|
1590
|
+
* A search field: a search glyph and an input inside one bordered plate.
|
|
1591
|
+
*
|
|
1592
|
+
* Focus is set through a ref with `preventScroll`, never the `autoFocus`
|
|
1593
|
+
* attribute: native autofocus scrolls the nearest scrollable ancestor, and the
|
|
1594
|
+
* widget's card clips its overflow, so it yanks the card's content out of
|
|
1595
|
+
* view.
|
|
1596
|
+
*
|
|
1597
|
+
* @example
|
|
1598
|
+
* ```tsx
|
|
1599
|
+
* import { SearchBar } from '@/components/SearchBar/SearchBar';
|
|
1600
|
+
*
|
|
1601
|
+
* const App = () => {
|
|
1602
|
+
* const [query, setQuery] = useState('');
|
|
1603
|
+
*
|
|
1604
|
+
* return <SearchBar onChange={setQuery} value={query} />;
|
|
1605
|
+
* };
|
|
1606
|
+
* ```
|
|
1607
|
+
* @param params.autoFocus - Focus the input on mount.
|
|
1608
|
+
* @param params.className - Extra class names for the bar element.
|
|
1609
|
+
* @param params.onChange - Fires with the new query.
|
|
1610
|
+
* @param params.placeholder - Placeholder and accessible name.
|
|
1611
|
+
* @param params.value - The current query.
|
|
1612
|
+
* @returns The search bar.
|
|
1613
|
+
* @see SearchBarProps
|
|
1614
|
+
* @see SearchIcon
|
|
1615
|
+
* @copy placeholder - Placeholder and accessible name of the search input.
|
|
1616
|
+
* @notInstrumented
|
|
1617
|
+
*/
|
|
1618
|
+
const SearchBar = ({ autoFocus, className, onChange, placeholder, value }) => {
|
|
1619
|
+
const text = useText({
|
|
1620
|
+
defaults: SEARCH_BAR_TEXT,
|
|
1621
|
+
slot: "dyn-search-bar"
|
|
1622
|
+
});
|
|
1623
|
+
const resolvedPlaceholder = placeholder ?? text("placeholder");
|
|
1624
|
+
const input = (0, react.useRef)(null);
|
|
1625
|
+
const setInput = (0, react.useCallback)((node) => {
|
|
1626
|
+
input.current = node;
|
|
1627
|
+
if (node && autoFocus) node.focus({ preventScroll: true });
|
|
1628
|
+
}, [autoFocus]);
|
|
1629
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1630
|
+
className,
|
|
1631
|
+
"data-slot": "dyn-search-bar",
|
|
1632
|
+
role: "search",
|
|
1633
|
+
onMouseDown: (event) => {
|
|
1634
|
+
if (event.target !== input.current) {
|
|
1635
|
+
event.preventDefault();
|
|
1636
|
+
input.current?.focus({ preventScroll: true });
|
|
1637
|
+
}
|
|
1638
|
+
},
|
|
1639
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(SearchIcon, {}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
1640
|
+
"aria-label": resolvedPlaceholder,
|
|
1641
|
+
"data-slot": "dyn-search-bar-input",
|
|
1642
|
+
onChange: (event) => onChange(event.target.value),
|
|
1643
|
+
placeholder: resolvedPlaceholder,
|
|
1644
|
+
ref: setInput,
|
|
1645
|
+
type: "search",
|
|
1646
|
+
value
|
|
1647
|
+
})]
|
|
1648
|
+
});
|
|
1649
|
+
};
|
|
1650
|
+
|
|
1651
|
+
//#endregion
|
|
1652
|
+
//#region src/icons/ChevronDownIcon/ChevronDownIcon.tsx
|
|
1653
|
+
/**
|
|
1654
|
+
* Downward chevron for disclosure controls like the select trigger.
|
|
1655
|
+
*
|
|
1656
|
+
* `size` is the rendered box edge, not the artwork's: the glyph keeps its
|
|
1657
|
+
* designed proportions and stays centred inside the square slot.
|
|
1658
|
+
*
|
|
1659
|
+
* @example
|
|
1660
|
+
* ```tsx
|
|
1661
|
+
* import { ChevronDownIcon } from '@/components/icons/ChevronDownIcon/ChevronDownIcon';
|
|
1662
|
+
*
|
|
1663
|
+
* const App = () => <ChevronDownIcon />;
|
|
1664
|
+
* ```
|
|
1665
|
+
* @param params.className - Extra class names for the svg element.
|
|
1666
|
+
* @param params.size - Rendered edge length in pixels.
|
|
1667
|
+
* @returns The chevron glyph.
|
|
1668
|
+
* @see IconProps
|
|
1669
|
+
* @notInstrumented
|
|
1670
|
+
*/
|
|
1671
|
+
const ChevronDownIcon = ({ className, size = 16 }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("svg", {
|
|
1672
|
+
"aria-hidden": "true",
|
|
1673
|
+
className,
|
|
1674
|
+
fill: "none",
|
|
1675
|
+
focusable: "false",
|
|
1676
|
+
height: size,
|
|
1677
|
+
viewBox: "0 0 16 16",
|
|
1678
|
+
width: size,
|
|
1679
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1680
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
|
|
1681
|
+
clipRule: "evenodd",
|
|
1682
|
+
d: "M2.86191 5.19526C3.12226 4.93491 3.54437 4.93491 3.80472 5.19526L7.99998 9.39052L12.1953 5.19526C12.4556 4.93491 12.8777 4.93491 13.1381 5.19526C13.3984 5.45561 13.3984 5.87772 13.1381 6.13807L8.47139 10.8047C8.21104 11.0651 7.78893 11.0651 7.52858 10.8047L2.86191 6.13807C2.60156 5.87772 2.60156 5.45561 2.86191 5.19526Z",
|
|
1683
|
+
fill: "currentColor",
|
|
1684
|
+
fillRule: "evenodd"
|
|
1685
|
+
})
|
|
1686
|
+
});
|
|
1687
|
+
|
|
1688
|
+
//#endregion
|
|
1689
|
+
//#region src/components/Select/Select.text.ts
|
|
1690
|
+
/**
|
|
1691
|
+
* Default text for {@link Select}.
|
|
1692
|
+
*/
|
|
1693
|
+
const SELECT_TEXT = {
|
|
1694
|
+
searchNoMatch: "No match",
|
|
1695
|
+
searchPlaceholder: "Search"
|
|
1696
|
+
};
|
|
1697
|
+
|
|
1698
|
+
//#endregion
|
|
1699
|
+
//#region src/components/Select/SelectPopover/SelectPopover.tsx
|
|
1700
|
+
/**
|
|
1701
|
+
* Wraps an option's icon in the `dyn-select-icon` slot span, or nothing when
|
|
1702
|
+
* the option has no icon. Shared by the popover's rows and the trigger's
|
|
1703
|
+
* selected value.
|
|
1704
|
+
*
|
|
1705
|
+
* @param icon - The option's icon node, if any.
|
|
1706
|
+
* @returns The slotted icon or null.
|
|
1707
|
+
* @see SelectOption
|
|
1708
|
+
* @see SelectPopover
|
|
1709
|
+
* @notInstrumented
|
|
1710
|
+
*/
|
|
1711
|
+
const optionIcon = (icon) => icon === void 0 ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1712
|
+
"aria-hidden": "true",
|
|
1713
|
+
"data-slot": "dyn-select-icon",
|
|
1714
|
+
children: icon
|
|
1715
|
+
});
|
|
1716
|
+
const popoverStyle = (anchor) => ({
|
|
1717
|
+
left: anchor.left,
|
|
1718
|
+
maxHeight: anchor.maxHeight,
|
|
1719
|
+
transformOrigin: anchor.below ? "50% 0" : "50% 100%",
|
|
1720
|
+
width: anchor.width,
|
|
1721
|
+
...anchor.below ? { top: anchor.offset } : { bottom: anchor.offset }
|
|
1722
|
+
});
|
|
1723
|
+
/**
|
|
1724
|
+
* The option panel {@link Select} portals to `document.body`: an optional
|
|
1725
|
+
* filter input over the list of icon-and-name options.
|
|
1726
|
+
*
|
|
1727
|
+
* Sits fixed under (or above, when the trigger hugs the viewport bottom) the
|
|
1728
|
+
* trigger using {@link SelectAnchor}, with an ease-out-quint enter and a
|
|
1729
|
+
* quicker exit. Options are real buttons so Tab reaches them natively;
|
|
1730
|
+
* `noMatch` copy only appears while a filter hides everything.
|
|
1731
|
+
*
|
|
1732
|
+
* @example
|
|
1733
|
+
* ```tsx
|
|
1734
|
+
* <SelectPopover
|
|
1735
|
+
* anchor={anchor}
|
|
1736
|
+
* emptyText="No match"
|
|
1737
|
+
* onEscapeKey={onEscapeKey}
|
|
1738
|
+
* onPick={onChange}
|
|
1739
|
+
* options={visibleOptions}
|
|
1740
|
+
* popoverRef={popoverRef}
|
|
1741
|
+
* query={query}
|
|
1742
|
+
* searchPlaceholder="Search"
|
|
1743
|
+
* setQuery={setQuery}
|
|
1744
|
+
* />
|
|
1745
|
+
* ```
|
|
1746
|
+
* @param params.anchor - Geometry measured by the hook on open.
|
|
1747
|
+
* @param params.emptyText - Copy shown when the filter hides every option.
|
|
1748
|
+
* @param params.onEscapeKey - Shared Escape handler.
|
|
1749
|
+
* @param params.onPick - Fires with the chosen option's id.
|
|
1750
|
+
* @param params.options - The options still visible under the filter.
|
|
1751
|
+
* @param params.popoverRef - The popover element ref.
|
|
1752
|
+
* @param params.query - The current search filter text.
|
|
1753
|
+
* @param params.searchPlaceholder - Filter input placeholder and accessible name.
|
|
1754
|
+
* @param params.searchable - Adds the filter input to the popover.
|
|
1755
|
+
* @param params.selectedId - The chosen option's id.
|
|
1756
|
+
* @param params.setQuery - Updates the search filter text.
|
|
1757
|
+
* @returns The select popover.
|
|
1758
|
+
* @see Select
|
|
1759
|
+
* @see SelectPopoverProps
|
|
1760
|
+
* @notInstrumented
|
|
1761
|
+
*/
|
|
1762
|
+
const SelectPopover = ({ anchor, emptyText, onEscapeKey, onPick, options, popoverRef, query, searchable, searchPlaceholder, selectedId, setQuery }) => {
|
|
1763
|
+
const enterY = anchor.below ? -4 : 4;
|
|
1764
|
+
const optionButton = (option) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(motion_react.m.button, {
|
|
1765
|
+
"aria-selected": option.id === selectedId,
|
|
1766
|
+
"data-slot": "dyn-select-option",
|
|
1767
|
+
initial: false,
|
|
1768
|
+
onClick: () => onPick({ id: option.id }),
|
|
1769
|
+
role: "option",
|
|
1770
|
+
type: "button",
|
|
1771
|
+
whileTap: { scale: PRESS_SCALE.control },
|
|
1772
|
+
children: [optionIcon(option.icon), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1773
|
+
"data-slot": "dyn-select-option-name",
|
|
1774
|
+
children: option.name
|
|
1775
|
+
})]
|
|
1776
|
+
}, option.id);
|
|
1777
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(motion_react.m.div, {
|
|
1778
|
+
animate: {
|
|
1779
|
+
opacity: 1,
|
|
1780
|
+
scale: 1,
|
|
1781
|
+
transition: POPOVER_ENTER,
|
|
1782
|
+
y: 0
|
|
1783
|
+
},
|
|
1784
|
+
"data-slot": "dyn-select-popover",
|
|
1785
|
+
exit: {
|
|
1786
|
+
opacity: 0,
|
|
1787
|
+
scale: .96,
|
|
1788
|
+
transition: POPOVER_EXIT,
|
|
1789
|
+
y: enterY
|
|
1790
|
+
},
|
|
1791
|
+
initial: {
|
|
1792
|
+
opacity: 0,
|
|
1793
|
+
scale: .96,
|
|
1794
|
+
y: enterY
|
|
1795
|
+
},
|
|
1796
|
+
onKeyDown: onEscapeKey,
|
|
1797
|
+
ref: popoverRef,
|
|
1798
|
+
role: "listbox",
|
|
1799
|
+
style: popoverStyle(anchor),
|
|
1800
|
+
children: [
|
|
1801
|
+
searchable ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
1802
|
+
"aria-label": searchPlaceholder,
|
|
1803
|
+
"data-slot": "dyn-select-search",
|
|
1804
|
+
onChange: (event) => setQuery(event.target.value),
|
|
1805
|
+
placeholder: searchPlaceholder,
|
|
1806
|
+
ref: (node) => {
|
|
1807
|
+
if (node) requestAnimationFrame(() => node.focus({ preventScroll: true }));
|
|
1808
|
+
},
|
|
1809
|
+
type: "search",
|
|
1810
|
+
value: query
|
|
1811
|
+
}) : null,
|
|
1812
|
+
options.length === 0 && query.trim() !== "" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1813
|
+
"data-slot": "dyn-select-empty",
|
|
1814
|
+
children: emptyText
|
|
1815
|
+
}) : null,
|
|
1816
|
+
options.map(optionButton)
|
|
1817
|
+
]
|
|
1818
|
+
});
|
|
1819
|
+
};
|
|
1820
|
+
|
|
1821
|
+
//#endregion
|
|
1822
|
+
//#region src/components/Select/useSelect/useSelect.ts
|
|
1823
|
+
/** Pixels between the trigger and the popover. */
|
|
1824
|
+
const POPOVER_GAP = 4;
|
|
1825
|
+
/** Tallest the option list is allowed to grow, matching the CSS cap. */
|
|
1826
|
+
const POPOVER_MAX_HEIGHT = 264;
|
|
1827
|
+
/**
|
|
1828
|
+
* Open state, anchor geometry, filtering, and dismissal wiring for
|
|
1829
|
+
* {@link Select}.
|
|
1830
|
+
*
|
|
1831
|
+
* The popover portals to `document.body` because the widget card clips its
|
|
1832
|
+
* overflow (its height animation needs `overflow: hidden`), so an in-tree
|
|
1833
|
+
* panel would be guillotined at the card edge. On open the trigger's rect is
|
|
1834
|
+
* measured and the popover grows toward whichever side of the viewport has
|
|
1835
|
+
* more room, capped at {@link POPOVER_MAX_HEIGHT} or the space left on that
|
|
1836
|
+
* side. Dismissal listens while open only: pointerdown outside both the root
|
|
1837
|
+
* and the portaled popover closes, and so do outside scrolls and resize,
|
|
1838
|
+
* since a fixed-position panel would detach from its trigger — scrolls born
|
|
1839
|
+
* inside the popover's own overflow are exempt, or a long option list could
|
|
1840
|
+
* never be scrolled.
|
|
1841
|
+
*
|
|
1842
|
+
* @example
|
|
1843
|
+
* ```tsx
|
|
1844
|
+
* const { open, anchor, toggle, triggerRef } = useSelect({ options });
|
|
1845
|
+
* ```
|
|
1846
|
+
* @param params.options - The options the search filter narrows.
|
|
1847
|
+
* @returns The select's open state, refs, geometry, and filtered options.
|
|
1848
|
+
* @see Select
|
|
1849
|
+
* @see UseSelectResult
|
|
1850
|
+
* @notInstrumented
|
|
1851
|
+
*/
|
|
1852
|
+
const useSelect = ({ autoFocus, disabled, onChange, options, value }) => {
|
|
1853
|
+
const [open, setOpen] = (0, react.useState)(false);
|
|
1854
|
+
const [query, setQuery] = (0, react.useState)("");
|
|
1855
|
+
const [anchor, setAnchor] = (0, react.useState)(null);
|
|
1856
|
+
const [portalClassName, setPortalClassName] = (0, react.useState)("dyn-root");
|
|
1857
|
+
const rootRef = (0, react.useRef)(null);
|
|
1858
|
+
const popoverRef = (0, react.useRef)(null);
|
|
1859
|
+
const triggerRef = (0, react.useRef)(null);
|
|
1860
|
+
const close = (0, react.useCallback)(() => setOpen(false), []);
|
|
1861
|
+
const toggle = (0, react.useCallback)(() => {
|
|
1862
|
+
if (disabled === true) return;
|
|
1863
|
+
setOpen((wasOpen) => {
|
|
1864
|
+
if (wasOpen) return false;
|
|
1865
|
+
const rect = triggerRef.current?.getBoundingClientRect();
|
|
1866
|
+
if (rect) {
|
|
1867
|
+
const spaceBelow = window.innerHeight - rect.bottom - POPOVER_GAP;
|
|
1868
|
+
const spaceAbove = rect.top - POPOVER_GAP;
|
|
1869
|
+
const below = spaceBelow >= spaceAbove;
|
|
1870
|
+
setAnchor({
|
|
1871
|
+
below,
|
|
1872
|
+
left: rect.left,
|
|
1873
|
+
maxHeight: Math.max(0, Math.min(POPOVER_MAX_HEIGHT, below ? spaceBelow : spaceAbove)),
|
|
1874
|
+
offset: below ? rect.bottom + POPOVER_GAP : window.innerHeight - rect.top + POPOVER_GAP,
|
|
1875
|
+
width: rect.width
|
|
1876
|
+
});
|
|
1877
|
+
}
|
|
1878
|
+
setPortalClassName(rootRef.current?.closest(".dyn-root")?.className ?? "dyn-root");
|
|
1879
|
+
setQuery("");
|
|
1880
|
+
return true;
|
|
1881
|
+
});
|
|
1882
|
+
}, [disabled]);
|
|
1883
|
+
(0, react.useEffect)(() => {
|
|
1884
|
+
if (disabled === true) setOpen(false);
|
|
1885
|
+
}, [disabled]);
|
|
1886
|
+
const onEscapeKey = (0, react.useCallback)((event) => {
|
|
1887
|
+
if (event.key !== "Escape" || !open) return;
|
|
1888
|
+
event.stopPropagation();
|
|
1889
|
+
setOpen(false);
|
|
1890
|
+
triggerRef.current?.focus({ preventScroll: true });
|
|
1891
|
+
}, [open]);
|
|
1892
|
+
const setTrigger = (0, react.useCallback)((node) => {
|
|
1893
|
+
triggerRef.current = node;
|
|
1894
|
+
if (node && autoFocus) requestAnimationFrame(() => node.focus({ preventScroll: true }));
|
|
1895
|
+
}, [autoFocus]);
|
|
1896
|
+
const pick = (0, react.useCallback)(({ id }) => {
|
|
1897
|
+
if (disabled === true) return;
|
|
1898
|
+
onChange?.(id);
|
|
1899
|
+
close();
|
|
1900
|
+
}, [
|
|
1901
|
+
close,
|
|
1902
|
+
disabled,
|
|
1903
|
+
onChange
|
|
1904
|
+
]);
|
|
1905
|
+
const labelId = `${(0, react.useId)()}-label`;
|
|
1906
|
+
const valueId = `${labelId}-value`;
|
|
1907
|
+
const selected = options.find((option) => option.id === value);
|
|
1908
|
+
const watchDismissal = (0, react.useCallback)(() => {
|
|
1909
|
+
const onPointerDown = (event) => {
|
|
1910
|
+
const target = event.target;
|
|
1911
|
+
const insideRoot = rootRef.current?.contains(target) === true;
|
|
1912
|
+
const insidePopover = popoverRef.current?.contains(target) === true;
|
|
1913
|
+
if (!insideRoot && !insidePopover) setOpen(false);
|
|
1914
|
+
};
|
|
1915
|
+
const onScroll = (event) => {
|
|
1916
|
+
if (!(event.target instanceof Node && popoverRef.current?.contains(event.target) === true)) setOpen(false);
|
|
1917
|
+
};
|
|
1918
|
+
const closeOnResize = () => setOpen(false);
|
|
1919
|
+
document.addEventListener("pointerdown", onPointerDown);
|
|
1920
|
+
window.addEventListener("scroll", onScroll, true);
|
|
1921
|
+
window.addEventListener("resize", closeOnResize);
|
|
1922
|
+
return () => {
|
|
1923
|
+
document.removeEventListener("pointerdown", onPointerDown);
|
|
1924
|
+
window.removeEventListener("scroll", onScroll, true);
|
|
1925
|
+
window.removeEventListener("resize", closeOnResize);
|
|
1926
|
+
};
|
|
1927
|
+
}, []);
|
|
1928
|
+
(0, react.useEffect)(() => {
|
|
1929
|
+
if (!open) return;
|
|
1930
|
+
return watchDismissal();
|
|
1931
|
+
}, [open, watchDismissal]);
|
|
1932
|
+
const trimmedQuery = query.trim().toLowerCase();
|
|
1933
|
+
return {
|
|
1934
|
+
anchor,
|
|
1935
|
+
close,
|
|
1936
|
+
labelId,
|
|
1937
|
+
onEscapeKey,
|
|
1938
|
+
open,
|
|
1939
|
+
pick,
|
|
1940
|
+
popoverRef,
|
|
1941
|
+
portalClassName,
|
|
1942
|
+
query,
|
|
1943
|
+
rootRef,
|
|
1944
|
+
selected,
|
|
1945
|
+
setQuery,
|
|
1946
|
+
setTrigger,
|
|
1947
|
+
toggle,
|
|
1948
|
+
triggerRef,
|
|
1949
|
+
valueId,
|
|
1950
|
+
visibleOptions: trimmedQuery ? options.filter((option) => option.name.toLowerCase().includes(trimmedQuery)) : options
|
|
1951
|
+
};
|
|
1952
|
+
};
|
|
1953
|
+
|
|
1954
|
+
//#endregion
|
|
1955
|
+
//#region src/components/Select/Select.tsx
|
|
1956
|
+
/**
|
|
1957
|
+
* A labelled select: a bordered trigger that opens an anchored popover of
|
|
1958
|
+
* icon-and-name options.
|
|
1959
|
+
*
|
|
1960
|
+
* The trigger starts on the `placeholder` in placeholder ink until a `value`
|
|
1961
|
+
* arrives, then shows the chosen option's icon and name. The popover portals
|
|
1962
|
+
* to `document.body` — the widget card clips overflow, so an in-tree panel
|
|
1963
|
+
* would be guillotined at the card edge — and is positioned from the
|
|
1964
|
+
* trigger's bounding rect each time it opens. Escape closes the popover and
|
|
1965
|
+
* stops propagation so the widget's pop-one-level Escape does not also fire.
|
|
1966
|
+
* Pass `searchable` for a filter input at the top of the popover.
|
|
1967
|
+
*
|
|
1968
|
+
* @example
|
|
1969
|
+
* ```tsx
|
|
1970
|
+
* import { Select } from '@/components/Select/Select';
|
|
1971
|
+
*
|
|
1972
|
+
* const App = () => {
|
|
1973
|
+
* const [token, setToken] = useState<string>();
|
|
1974
|
+
*
|
|
1975
|
+
* return (
|
|
1976
|
+
* <Select
|
|
1977
|
+
* label="Pay with"
|
|
1978
|
+
* onChange={setToken}
|
|
1979
|
+
* options={[
|
|
1980
|
+
* { id: 'usdc', name: 'USDC', icon: <TokenMark tokenIcon={usdcUrl} /> },
|
|
1981
|
+
* { id: 'sol', name: 'SOL', icon: <TokenMark tokenIcon={solUrl} /> },
|
|
1982
|
+
* ]}
|
|
1983
|
+
* placeholder="Choose a token"
|
|
1984
|
+
* value={token}
|
|
1985
|
+
* />
|
|
1986
|
+
* );
|
|
1987
|
+
* };
|
|
1988
|
+
* ```
|
|
1989
|
+
* @param params.autoFocus - Focus the trigger on mount.
|
|
1990
|
+
* @param params.className - Extra class names for the root element.
|
|
1991
|
+
* @param params.disabled - Disables the trigger so no popover can open.
|
|
1992
|
+
* @param params.label - The field's label.
|
|
1993
|
+
* @param params.onChange - Fires with the chosen option's id.
|
|
1994
|
+
* @param params.options - The options listed in the popover.
|
|
1995
|
+
* @param params.placeholder - Shown until an option is chosen.
|
|
1996
|
+
* @param params.searchable - Adds a filter input to the popover.
|
|
1997
|
+
* @param params.value - The chosen option's id.
|
|
1998
|
+
* @returns The select field.
|
|
1999
|
+
* @see SelectProps
|
|
2000
|
+
* @see useSelect
|
|
2001
|
+
* @copy searchNoMatch - Shown when the search filter hides every option.
|
|
2002
|
+
* @copy searchPlaceholder - Placeholder and accessible name of the popover's filter input.
|
|
2003
|
+
* @notInstrumented
|
|
2004
|
+
*/
|
|
2005
|
+
const Select = ({ autoFocus, className, disabled, label, onChange, options, placeholder, searchable, value }) => {
|
|
2006
|
+
const text = useText({
|
|
2007
|
+
defaults: SELECT_TEXT,
|
|
2008
|
+
slot: "dyn-select"
|
|
2009
|
+
});
|
|
2010
|
+
const { anchor, labelId, onEscapeKey, open, pick, popoverRef, portalClassName, query, rootRef, selected, setQuery, setTrigger, toggle, valueId, visibleOptions } = useSelect({
|
|
2011
|
+
autoFocus,
|
|
2012
|
+
disabled,
|
|
2013
|
+
onChange,
|
|
2014
|
+
options,
|
|
2015
|
+
value
|
|
2016
|
+
});
|
|
2017
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
2018
|
+
className,
|
|
2019
|
+
"data-slot": "dyn-select",
|
|
2020
|
+
ref: rootRef,
|
|
2021
|
+
children: [
|
|
2022
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
2023
|
+
"data-slot": "dyn-select-label",
|
|
2024
|
+
id: labelId,
|
|
2025
|
+
children: label
|
|
2026
|
+
}),
|
|
2027
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(motion_react.m.button, {
|
|
2028
|
+
"aria-expanded": open,
|
|
2029
|
+
"aria-labelledby": `${labelId} ${valueId}`,
|
|
2030
|
+
"aria-haspopup": "listbox",
|
|
2031
|
+
"data-empty": selected === void 0,
|
|
2032
|
+
"data-slot": "dyn-select-trigger",
|
|
2033
|
+
disabled,
|
|
2034
|
+
initial: false,
|
|
2035
|
+
onClick: toggle,
|
|
2036
|
+
onKeyDown: onEscapeKey,
|
|
2037
|
+
ref: setTrigger,
|
|
2038
|
+
type: "button",
|
|
2039
|
+
whileTap: { scale: PRESS_SCALE.row },
|
|
2040
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
2041
|
+
"data-slot": "dyn-select-value-wrap",
|
|
2042
|
+
children: [optionIcon(selected?.icon), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
2043
|
+
"data-slot": "dyn-select-value",
|
|
2044
|
+
id: valueId,
|
|
2045
|
+
children: selected === void 0 ? placeholder : selected.name
|
|
2046
|
+
})]
|
|
2047
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(motion_react.m.span, {
|
|
2048
|
+
animate: { rotate: open ? 180 : 0 },
|
|
2049
|
+
"data-slot": "dyn-select-chevron",
|
|
2050
|
+
initial: false,
|
|
2051
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ChevronDownIcon, {})
|
|
2052
|
+
})]
|
|
2053
|
+
}),
|
|
2054
|
+
typeof document === "undefined" ? null : (0, react_dom.createPortal)(/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
2055
|
+
className: portalClassName,
|
|
2056
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(motion_react.AnimatePresence, {
|
|
2057
|
+
initial: false,
|
|
2058
|
+
children: open && anchor !== null ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SelectPopover, {
|
|
2059
|
+
anchor,
|
|
2060
|
+
emptyText: text("searchNoMatch"),
|
|
2061
|
+
onEscapeKey,
|
|
2062
|
+
onPick: pick,
|
|
2063
|
+
options: visibleOptions,
|
|
2064
|
+
popoverRef,
|
|
2065
|
+
query,
|
|
2066
|
+
searchable,
|
|
2067
|
+
searchPlaceholder: text("searchPlaceholder"),
|
|
2068
|
+
selectedId: value,
|
|
2069
|
+
setQuery
|
|
2070
|
+
}) : null
|
|
2071
|
+
})
|
|
2072
|
+
}), document.body)
|
|
2073
|
+
]
|
|
2074
|
+
});
|
|
2075
|
+
};
|
|
2076
|
+
|
|
2077
|
+
//#endregion
|
|
2078
|
+
//#region src/components/TokenBalanceOption/TokenBalanceOption.tsx
|
|
2079
|
+
/**
|
|
2080
|
+
* One pickable token holding: a leading mark (a `TokenMark`, a network-badged
|
|
2081
|
+
* icon, any node), the token's name with its held amount under it, and the
|
|
2082
|
+
* holding's fiat value pinned to the trailing edge.
|
|
2083
|
+
*
|
|
2084
|
+
* @example
|
|
2085
|
+
* ```tsx
|
|
2086
|
+
* import { TokenBalanceOption } from '@/components/TokenBalanceOption/TokenBalanceOption';
|
|
2087
|
+
*
|
|
2088
|
+
* const App = () => (
|
|
2089
|
+
* <TokenBalanceOption
|
|
2090
|
+
* balance="812.40 USDC"
|
|
2091
|
+
* icon={<TokenMark tokenIcon="https://example.test/usdc.svg" />}
|
|
2092
|
+
* name="USD Coin"
|
|
2093
|
+
* onClick={() => {}}
|
|
2094
|
+
* value="$812.40"
|
|
2095
|
+
* />
|
|
2096
|
+
* );
|
|
2097
|
+
* ```
|
|
2098
|
+
* @param params.balance - Held amount shown under the name, already formatted.
|
|
2099
|
+
* @param params.className - Extra class names for the row element.
|
|
2100
|
+
* @param params.icon - The token mark.
|
|
2101
|
+
* @param params.id - Row identifier, exposed as `data-testid="token-balance-option-<id>"`.
|
|
2102
|
+
* @param params.name - The token's display name.
|
|
2103
|
+
* @param params.onClick - Fires when the row is chosen.
|
|
2104
|
+
* @param params.value - Fiat value pinned to the trailing edge.
|
|
2105
|
+
* @returns The token balance option.
|
|
2106
|
+
* @see TokenBalanceOptionProps
|
|
2107
|
+
* @see BalancesList
|
|
2108
|
+
* @notInstrumented
|
|
2109
|
+
*/
|
|
2110
|
+
const TokenBalanceOption = ({ balance, className, icon, id, name: name$1, onClick, value }) => {
|
|
2111
|
+
const hasBalance = balance !== void 0 && balance !== "";
|
|
2112
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(motion_react.m.button, {
|
|
2113
|
+
className,
|
|
2114
|
+
"data-slot": "dyn-token-balance-option",
|
|
2115
|
+
"data-testid": id !== void 0 ? `token-balance-option-${id}` : void 0,
|
|
2116
|
+
initial: false,
|
|
2117
|
+
onClick,
|
|
2118
|
+
type: "button",
|
|
2119
|
+
whileTap: { scale: PRESS_SCALE.row },
|
|
2120
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
2121
|
+
"data-slot": "dyn-token-balance-option-lead",
|
|
2122
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
2123
|
+
"aria-hidden": true,
|
|
2124
|
+
"data-slot": "dyn-token-balance-option-icon",
|
|
2125
|
+
children: icon
|
|
2126
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
2127
|
+
"data-slot": "dyn-token-balance-option-texts",
|
|
2128
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
2129
|
+
"data-slot": "dyn-token-balance-option-name",
|
|
2130
|
+
children: name$1
|
|
2131
|
+
}), hasBalance && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
2132
|
+
"data-slot": "dyn-token-balance-option-meta",
|
|
2133
|
+
children: balance
|
|
2134
|
+
})]
|
|
2135
|
+
})]
|
|
2136
|
+
}), value !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
2137
|
+
"data-slot": "dyn-token-balance-option-value",
|
|
2138
|
+
children: value
|
|
2139
|
+
})]
|
|
2140
|
+
});
|
|
2141
|
+
};
|
|
2142
|
+
|
|
2143
|
+
//#endregion
|
|
2144
|
+
//#region src/icons/UnknownTokenIcon/UnknownTokenIcon.tsx
|
|
2145
|
+
/**
|
|
2146
|
+
* Placeholder coin for a token whose artwork is missing or failed to load —
|
|
2147
|
+
* a disc with a question mark knocked out, drawn in `currentColor` so it can
|
|
2148
|
+
* take the neutral tone of whatever surface hosts it.
|
|
2149
|
+
*
|
|
2150
|
+
* @example
|
|
2151
|
+
* ```tsx
|
|
2152
|
+
* import { UnknownTokenIcon } from '@/icons/UnknownTokenIcon/UnknownTokenIcon';
|
|
2153
|
+
*
|
|
2154
|
+
* const App = () => <UnknownTokenIcon size={24} />;
|
|
2155
|
+
* ```
|
|
2156
|
+
* @param params.className - Extra class names for the svg element.
|
|
2157
|
+
* @param params.size - Rendered edge length in pixels.
|
|
2158
|
+
* @returns The unknown-token glyph.
|
|
2159
|
+
* @see IconProps
|
|
2160
|
+
* @notInstrumented
|
|
2161
|
+
*/
|
|
2162
|
+
const UnknownTokenIcon = ({ className, size = 24 }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("svg", {
|
|
2163
|
+
"aria-hidden": "true",
|
|
2164
|
+
className,
|
|
2165
|
+
fill: "none",
|
|
2166
|
+
focusable: "false",
|
|
2167
|
+
height: size,
|
|
2168
|
+
viewBox: "0 0 24 24",
|
|
2169
|
+
width: size,
|
|
2170
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
2171
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
|
|
2172
|
+
clipRule: "evenodd",
|
|
2173
|
+
d: "M12 2C6.48 2 2 6.48 2 12C2 17.52 6.48 22 12 22C17.52 22 22 17.52 22 12C22 6.48 17.52 2 12 2ZM13 19H11V17H13V19ZM15.07 11.25L14.17 12.17C13.45 12.9 13 13.5 13 15H11V14.5C11 13.4 11.45 12.4 12.17 11.67L13.41 10.41C13.78 10.05 14 9.55 14 9C14 7.9 13.1 7 12 7C10.9 7 10 7.9 10 9H8C8 6.79 9.79 5 12 5C14.21 5 16 6.79 16 9C16 9.88 15.64 10.68 15.07 11.25Z",
|
|
2174
|
+
fill: "currentColor",
|
|
2175
|
+
fillRule: "evenodd"
|
|
2176
|
+
})
|
|
2177
|
+
});
|
|
2178
|
+
|
|
2179
|
+
//#endregion
|
|
2180
|
+
//#region src/components/TokenMark/useTokenMark/useTokenMark.ts
|
|
2181
|
+
/**
|
|
2182
|
+
* Decides which of the provider-supplied icon URLs may render, remembering
|
|
2183
|
+
* URLs that already failed. Each failed URL is tracked rather than a bare
|
|
2184
|
+
* boolean, so a later URL on the same mounted mark gets a fresh attempt.
|
|
2185
|
+
*
|
|
2186
|
+
* @example
|
|
2187
|
+
* ```tsx
|
|
2188
|
+
* const { showTokenIcon } = useTokenMark({ tokenIcon: 'https://example.test/usdc.svg' });
|
|
2189
|
+
* ```
|
|
2190
|
+
* @param params.networkIcon - Icon URL of the token's network.
|
|
2191
|
+
* @param params.tokenIcon - Icon URL of the token.
|
|
2192
|
+
* @returns The icon visibility flags and failure markers.
|
|
2193
|
+
* @see TokenMark
|
|
2194
|
+
* @see isValidImageSource
|
|
2195
|
+
* @notInstrumented
|
|
2196
|
+
*/
|
|
2197
|
+
const useTokenMark = ({ networkIcon, tokenIcon }) => {
|
|
2198
|
+
const [failedTokenUrl, setFailedTokenUrl] = (0, react.useState)(void 0);
|
|
2199
|
+
const [failedNetworkUrl, setFailedNetworkUrl] = (0, react.useState)(void 0);
|
|
2200
|
+
const showTokenIcon = tokenIcon !== void 0 && isValidImageSource(tokenIcon) && tokenIcon !== failedTokenUrl;
|
|
2201
|
+
return {
|
|
2202
|
+
setNetworkIconFailed: () => setFailedNetworkUrl(networkIcon),
|
|
2203
|
+
setTokenIconFailed: () => setFailedTokenUrl(tokenIcon),
|
|
2204
|
+
showNetworkBadge: networkIcon !== void 0 && isValidImageSource(networkIcon) && networkIcon !== failedNetworkUrl,
|
|
2205
|
+
showTokenIcon
|
|
2206
|
+
};
|
|
2207
|
+
};
|
|
2208
|
+
|
|
2209
|
+
//#endregion
|
|
2210
|
+
//#region src/components/TokenMark/TokenMark.tsx
|
|
2211
|
+
/**
|
|
2212
|
+
* A token's icon disc with the network icon punched in as a circular badge
|
|
2213
|
+
* at its bottom-left — the convention wallet UIs use to read "USDC on Base"
|
|
2214
|
+
* at a glance. Both icons arrive as URLs from a balances provider rather
|
|
2215
|
+
* than bundled artwork; an absent, unsafe, or broken token URL renders the
|
|
2216
|
+
* {@link UnknownTokenIcon} placeholder, and an absent or broken network URL
|
|
2217
|
+
* simply drops the badge. The mark is sized by the
|
|
2218
|
+
* `--dyn-size-token-mark` token (24px by default); the badge scales
|
|
2219
|
+
* with it.
|
|
2220
|
+
*
|
|
2221
|
+
* @example
|
|
2222
|
+
* ```tsx
|
|
2223
|
+
* import { TokenMark } from '@/components/TokenMark/TokenMark';
|
|
2224
|
+
*
|
|
2225
|
+
* const App = () => (
|
|
2226
|
+
* <TokenMark
|
|
2227
|
+
* networkIcon="https://example.test/base.svg"
|
|
2228
|
+
* tokenIcon="https://example.test/usdc.svg"
|
|
2229
|
+
* />
|
|
2230
|
+
* );
|
|
2231
|
+
* ```
|
|
2232
|
+
* @param params.className - Extra class names for the mark element.
|
|
2233
|
+
* @param params.networkIcon - Icon URL of the token's network. Omit for a bare token mark.
|
|
2234
|
+
* @param params.tokenIcon - Icon URL of the token. Falls back to a placeholder glyph.
|
|
2235
|
+
* @returns The token mark.
|
|
2236
|
+
* @see TokenMarkProps
|
|
2237
|
+
* @see useTokenMark
|
|
2238
|
+
* @notInstrumented
|
|
2239
|
+
*/
|
|
2240
|
+
const TokenMark = ({ className, networkIcon, tokenIcon }) => {
|
|
2241
|
+
const { setNetworkIconFailed, setTokenIconFailed, showNetworkBadge, showTokenIcon } = useTokenMark({
|
|
2242
|
+
networkIcon,
|
|
2243
|
+
tokenIcon
|
|
2244
|
+
});
|
|
2245
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
2246
|
+
"aria-hidden": "true",
|
|
2247
|
+
className,
|
|
2248
|
+
"data-slot": "dyn-token-mark",
|
|
2249
|
+
children: [showTokenIcon ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("img", {
|
|
2250
|
+
alt: "",
|
|
2251
|
+
"data-slot": "dyn-token-mark-token",
|
|
2252
|
+
onError: setTokenIconFailed,
|
|
2253
|
+
src: tokenIcon
|
|
2254
|
+
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
2255
|
+
"data-slot": "dyn-token-mark-unknown",
|
|
2256
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(UnknownTokenIcon, {})
|
|
2257
|
+
}), showNetworkBadge ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
2258
|
+
"data-slot": "dyn-token-mark-network",
|
|
2259
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("img", {
|
|
2260
|
+
alt: "",
|
|
2261
|
+
"data-slot": "dyn-token-mark-network-image",
|
|
2262
|
+
onError: setNetworkIconFailed,
|
|
2263
|
+
src: networkIcon
|
|
2264
|
+
})
|
|
2265
|
+
}) : null]
|
|
2266
|
+
});
|
|
2267
|
+
};
|
|
2268
|
+
|
|
2269
|
+
//#endregion
|
|
2270
|
+
//#region src/utils/hooks/useGetWalletName/useGetWalletName.ts
|
|
2271
|
+
/**
|
|
2272
|
+
* Resolves the display name of a wallet account's provider — e.g. `MetaMask`
|
|
2273
|
+
* for a `metamask` provider key — for showing the wallet's name in the UI. The
|
|
2274
|
+
* lookup stays disabled until an account is passed, so it is safe to call with
|
|
2275
|
+
* an account that has not connected yet.
|
|
2276
|
+
*
|
|
2277
|
+
* @param params.walletAccount - The wallet account, once one is available.
|
|
2278
|
+
* @returns The provider's display name, or `undefined` before it resolves.
|
|
2279
|
+
* @example
|
|
2280
|
+
* ```ts
|
|
2281
|
+
* const walletName = useGetWalletName({ walletAccount });
|
|
2282
|
+
* ```
|
|
2283
|
+
* @see UseGetWalletNameParams
|
|
2284
|
+
* @see useGetWalletProviderDataByKey
|
|
2285
|
+
* @notInstrumented
|
|
2286
|
+
*/
|
|
2287
|
+
const useGetWalletName = ({ walletAccount }) => {
|
|
2288
|
+
const { data: walletProvider } = (0, _dynamic_labs_sdk_react_hooks.useGetWalletProviderDataByKey)({
|
|
2289
|
+
queryParams: { enabled: walletAccount !== void 0 },
|
|
2290
|
+
walletProviderKey: walletAccount?.walletProviderKey
|
|
2291
|
+
});
|
|
2292
|
+
return walletProvider?.metadata.displayName;
|
|
2293
|
+
};
|
|
2294
|
+
|
|
2295
|
+
//#endregion
|
|
2296
|
+
//#region src/components/PanelHost/isFilledSearchField/isFilledSearchField.ts
|
|
2297
|
+
/**
|
|
2298
|
+
* Whether a key press landed in a search field that has text. The browser
|
|
2299
|
+
* clears such a field on Escape, so Escape belongs to the field rather than
|
|
2300
|
+
* to Back. Other fields have no Escape action of their own.
|
|
2301
|
+
*
|
|
2302
|
+
* @example
|
|
2303
|
+
* ```ts
|
|
2304
|
+
* if (isFilledSearchField({ target: event.target })) return;
|
|
2305
|
+
* ```
|
|
2306
|
+
* @param params.target - Where a key press landed.
|
|
2307
|
+
* @returns True for a search input with a value.
|
|
2308
|
+
* @see PanelHost
|
|
2309
|
+
* @see usePanelHost
|
|
2310
|
+
* @notInstrumented
|
|
2311
|
+
*/
|
|
2312
|
+
const isFilledSearchField = ({ target }) => target instanceof HTMLInputElement && target.type === "search" && target.value !== "";
|
|
2313
|
+
|
|
2314
|
+
//#endregion
|
|
2315
|
+
//#region src/components/PanelHost/observeCardHeight/observeCardHeight.ts
|
|
2316
|
+
/**
|
|
2317
|
+
* Watches the content wrapper and reports the height the card should animate
|
|
2318
|
+
* to: the wrapper's height plus the card's top and bottom borders. The
|
|
2319
|
+
* wrapper is measured, never the animating card, so the animation can't feed
|
|
2320
|
+
* back into its own target.
|
|
2321
|
+
*
|
|
2322
|
+
* @example
|
|
2323
|
+
* ```ts
|
|
2324
|
+
* const stop = observeCardHeight({ card, measure, onHeight: setCardHeight });
|
|
2325
|
+
* ```
|
|
2326
|
+
* @param params.card - The border-box card whose height is animated.
|
|
2327
|
+
* @param params.measure - The wrapper holding the header and body.
|
|
2328
|
+
* @param params.onHeight - Receives the card's target height.
|
|
2329
|
+
* @returns Stops observing.
|
|
2330
|
+
* @see PanelHost
|
|
2331
|
+
* @see usePanelHost
|
|
2332
|
+
* @notInstrumented
|
|
2333
|
+
*/
|
|
2334
|
+
const observeCardHeight = ({ card, measure, onHeight }) => {
|
|
2335
|
+
if (typeof ResizeObserver === "undefined") return () => void 0;
|
|
2336
|
+
const observer = new ResizeObserver(() => {
|
|
2337
|
+
const style = getComputedStyle(card);
|
|
2338
|
+
onHeight(measure.getBoundingClientRect().height + Number.parseFloat(style.borderTopWidth) + Number.parseFloat(style.borderBottomWidth));
|
|
2339
|
+
});
|
|
2340
|
+
observer.observe(measure);
|
|
2341
|
+
return () => observer.disconnect();
|
|
2342
|
+
};
|
|
2343
|
+
|
|
2344
|
+
//#endregion
|
|
2345
|
+
//#region src/components/PanelHost/useCardHeight/useCardHeight.ts
|
|
2346
|
+
/**
|
|
2347
|
+
* Measures the wrapper inside the card and gives the card a height to animate
|
|
2348
|
+
* to. The wrapper is measured, never the animating card. Reduced motion makes
|
|
2349
|
+
* the change instant, which `MotionConfig` alone doesn't do for height.
|
|
2350
|
+
*
|
|
2351
|
+
* @example
|
|
2352
|
+
* ```tsx
|
|
2353
|
+
* const { cardAnimate, cardRef, heightTransition, measureRef } = useCardHeight();
|
|
2354
|
+
* ```
|
|
2355
|
+
* @returns Refs for the card and wrapper, and the height animation.
|
|
2356
|
+
* @see PanelHost
|
|
2357
|
+
* @see observeCardHeight
|
|
2358
|
+
* @notInstrumented
|
|
2359
|
+
*/
|
|
2360
|
+
const useCardHeight = () => {
|
|
2361
|
+
const isReducedMotion = (0, motion_react.useReducedMotion)() === true;
|
|
2362
|
+
const cardRef = (0, react.useRef)(null);
|
|
2363
|
+
const measureRef = (0, react.useRef)(null);
|
|
2364
|
+
const [cardHeight, setCardHeight] = (0, react.useState)(void 0);
|
|
2365
|
+
(0, react.useEffect)(() => {
|
|
2366
|
+
const card = cardRef.current;
|
|
2367
|
+
const measure = measureRef.current;
|
|
2368
|
+
if (card === null || measure === null) return void 0;
|
|
2369
|
+
return observeCardHeight({
|
|
2370
|
+
card,
|
|
2371
|
+
measure,
|
|
2372
|
+
onHeight: setCardHeight
|
|
2373
|
+
});
|
|
2374
|
+
}, []);
|
|
2375
|
+
return {
|
|
2376
|
+
cardAnimate: cardHeight === void 0 ? void 0 : { height: cardHeight },
|
|
2377
|
+
cardRef,
|
|
2378
|
+
heightTransition: isReducedMotion ? INSTANT_TRANSITION : HEIGHT_SPRING,
|
|
2379
|
+
measureRef
|
|
2380
|
+
};
|
|
2381
|
+
};
|
|
2382
|
+
|
|
2383
|
+
//#endregion
|
|
2384
|
+
//#region src/components/PanelHost/useNavigationGate/useNavigationGate.ts
|
|
2385
|
+
/**
|
|
2386
|
+
* The pointer gate after a screen change: on for {@link NAVIGATION_GATE_MS},
|
|
2387
|
+
* so a double tap doesn't also hit what lands under the finger.
|
|
2388
|
+
*
|
|
2389
|
+
* @example
|
|
2390
|
+
* ```ts
|
|
2391
|
+
* const { isNavigating, startNavigationGate } = useNavigationGate();
|
|
2392
|
+
* ```
|
|
2393
|
+
* @returns Whether the gate is on, and a function that starts it.
|
|
2394
|
+
* @see PanelHost
|
|
2395
|
+
* @see usePanelHost
|
|
2396
|
+
* @notInstrumented
|
|
2397
|
+
*/
|
|
2398
|
+
const useNavigationGate = () => {
|
|
2399
|
+
const [isNavigating, setIsNavigating] = (0, react.useState)(false);
|
|
2400
|
+
const timerRef = (0, react.useRef)(void 0);
|
|
2401
|
+
const startNavigationGate = (0, react.useCallback)(() => {
|
|
2402
|
+
clearTimeout(timerRef.current);
|
|
2403
|
+
setIsNavigating(true);
|
|
2404
|
+
timerRef.current = setTimeout(() => setIsNavigating(false), NAVIGATION_GATE_MS);
|
|
2405
|
+
}, []);
|
|
2406
|
+
(0, react.useEffect)(() => () => clearTimeout(timerRef.current), []);
|
|
2407
|
+
return {
|
|
2408
|
+
isNavigating,
|
|
2409
|
+
startNavigationGate
|
|
2410
|
+
};
|
|
2411
|
+
};
|
|
2412
|
+
|
|
2413
|
+
//#endregion
|
|
2414
|
+
//#region src/components/PanelHost/getChoiceLabel/getChoiceLabel.ts
|
|
2415
|
+
/**
|
|
2416
|
+
* Names a choice the way assistive tech would in the common case: its
|
|
2417
|
+
* `aria-label`, else its trimmed text.
|
|
2418
|
+
*
|
|
2419
|
+
* @example
|
|
2420
|
+
* ```ts
|
|
2421
|
+
* const label = getChoiceLabel({ element: button });
|
|
2422
|
+
* ```
|
|
2423
|
+
* @param params.element - The choice to name.
|
|
2424
|
+
* @returns The label, or an empty string when the choice has none.
|
|
2425
|
+
* @see getFocusedChoice
|
|
2426
|
+
* @see findChoice
|
|
2427
|
+
* @notInstrumented
|
|
2428
|
+
*/
|
|
2429
|
+
const getChoiceLabel = ({ element }) => element.getAttribute("aria-label") ?? element.textContent?.trim() ?? "";
|
|
2430
|
+
|
|
2431
|
+
//#endregion
|
|
2432
|
+
//#region src/components/PanelHost/getFocusableElements/getFocusableElements.ts
|
|
2433
|
+
/**
|
|
2434
|
+
* Elements a keyboard user can tab to, minus hidden inputs and anything
|
|
2435
|
+
* disabled (directly or by a disabled fieldset) or taken out of the tab order
|
|
2436
|
+
* with `tabindex="-1"`.
|
|
2437
|
+
*/
|
|
2438
|
+
const FOCUSABLE_SELECTOR = "a[href]:not([tabindex=\"-1\"]), button:not(:disabled):not([tabindex=\"-1\"]), input:not(:disabled):not([type=\"hidden\"]):not([tabindex=\"-1\"]), select:not(:disabled):not([tabindex=\"-1\"]), textarea:not(:disabled):not([tabindex=\"-1\"]), [tabindex]:not([tabindex=\"-1\"])";
|
|
2439
|
+
/**
|
|
2440
|
+
* Lists the tabbable elements inside a container, in document order, so a
|
|
2441
|
+
* screen can remember a choice by its position and find it again after it
|
|
2442
|
+
* remounts.
|
|
2443
|
+
*
|
|
2444
|
+
* @example
|
|
2445
|
+
* ```ts
|
|
2446
|
+
* const index = getFocusableElements({ container: body }).indexOf(button);
|
|
2447
|
+
* ```
|
|
2448
|
+
* @param params.container - The element to search inside.
|
|
2449
|
+
* @returns The tabbable elements, in document order.
|
|
2450
|
+
* @see PanelHost
|
|
2451
|
+
* @see usePanelHost
|
|
2452
|
+
* @notInstrumented
|
|
2453
|
+
*/
|
|
2454
|
+
const getFocusableElements = ({ container }) => Array.from(container.querySelectorAll(FOCUSABLE_SELECTOR));
|
|
2455
|
+
|
|
2456
|
+
//#endregion
|
|
2457
|
+
//#region src/components/PanelHost/findChoice/findChoice.ts
|
|
2458
|
+
/**
|
|
2459
|
+
* Finds a remembered choice again after its screen remounts: the element at
|
|
2460
|
+
* the remembered position when its label still matches, so two choices with
|
|
2461
|
+
* the same label stay apart; else the first element with that label; else
|
|
2462
|
+
* whatever now sits at that position.
|
|
2463
|
+
*
|
|
2464
|
+
* @example
|
|
2465
|
+
* ```ts
|
|
2466
|
+
* findChoice({ choice: { index: 1, label: 'MetaMask' }, container: body })?.focus();
|
|
2467
|
+
* ```
|
|
2468
|
+
* @param params.choice - The remembered choice.
|
|
2469
|
+
* @param params.container - The screen body to search.
|
|
2470
|
+
* @returns The element, or `undefined` when the body has nothing there.
|
|
2471
|
+
* @see getFocusedChoice
|
|
2472
|
+
* @see focusAfterScreenChange
|
|
2473
|
+
* @notInstrumented
|
|
2474
|
+
*/
|
|
2475
|
+
const findChoice = ({ choice, container }) => {
|
|
2476
|
+
const elements = getFocusableElements({ container });
|
|
2477
|
+
const atIndex = elements.at(choice.index);
|
|
2478
|
+
const hasLabel = (element) => getChoiceLabel({ element }) === choice.label;
|
|
2479
|
+
if (atIndex !== void 0 && hasLabel(atIndex)) return atIndex;
|
|
2480
|
+
return elements.find(hasLabel) ?? atIndex;
|
|
2481
|
+
};
|
|
2482
|
+
|
|
2483
|
+
//#endregion
|
|
2484
|
+
//#region src/components/PanelHost/focusAfterScreenChange/focusAfterScreenChange.ts
|
|
2485
|
+
/**
|
|
2486
|
+
* Places focus after a screen change. Coming back, it lands on the choice that
|
|
2487
|
+
* opened the screen, unless the payer has moved focus elsewhere on the page.
|
|
2488
|
+
* Otherwise, if focus fell to the page because the old screen unmounted, it
|
|
2489
|
+
* moves to the card so keyboard users stay inside. Neither scrolls the card.
|
|
2490
|
+
*
|
|
2491
|
+
* @example
|
|
2492
|
+
* ```ts
|
|
2493
|
+
* focusAfterScreenChange({
|
|
2494
|
+
* body,
|
|
2495
|
+
* card,
|
|
2496
|
+
* hadFocus: true,
|
|
2497
|
+
* restoreChoice: { index: 1, label: 'MetaMask' },
|
|
2498
|
+
* });
|
|
2499
|
+
* ```
|
|
2500
|
+
* @param params.body - The screen body the choices sit in.
|
|
2501
|
+
* @param params.card - The card the screens render in.
|
|
2502
|
+
* @param params.hadFocus - Whether focus was inside the card before the change.
|
|
2503
|
+
* @param params.restoreChoice - The choice to refocus when coming back.
|
|
2504
|
+
* @returns Nothing; focus moves as a side effect.
|
|
2505
|
+
* @see PanelHost
|
|
2506
|
+
* @see findChoice
|
|
2507
|
+
* @notInstrumented
|
|
2508
|
+
*/
|
|
2509
|
+
const focusAfterScreenChange = ({ body, card, hadFocus, restoreChoice }) => {
|
|
2510
|
+
const { activeElement, body: pageBody } = card.ownerDocument;
|
|
2511
|
+
const isFocusLost = activeElement === null || activeElement === pageBody;
|
|
2512
|
+
const isFocusOurs = isFocusLost || card.contains(activeElement);
|
|
2513
|
+
const target = restoreChoice === void 0 || !isFocusOurs ? void 0 : findChoice({
|
|
2514
|
+
choice: restoreChoice,
|
|
2515
|
+
container: body
|
|
2516
|
+
});
|
|
2517
|
+
if (target !== void 0) {
|
|
2518
|
+
target.focus({ preventScroll: true });
|
|
2519
|
+
return;
|
|
2520
|
+
}
|
|
2521
|
+
if (hadFocus && isFocusLost) card.focus({ preventScroll: true });
|
|
2522
|
+
};
|
|
2523
|
+
|
|
2524
|
+
//#endregion
|
|
2525
|
+
//#region src/components/PanelHost/getFocusedChoice/getFocusedChoice.ts
|
|
2526
|
+
/**
|
|
2527
|
+
* Describes a focused element as a choice to restore later: its accessible
|
|
2528
|
+
* label and its position among the body's tabbable elements.
|
|
2529
|
+
*
|
|
2530
|
+
* @example
|
|
2531
|
+
* ```ts
|
|
2532
|
+
* const choice = getFocusedChoice({ container: body, element: event.target });
|
|
2533
|
+
* ```
|
|
2534
|
+
* @param params.container - The screen body the choice sits in.
|
|
2535
|
+
* @param params.element - The element that received focus.
|
|
2536
|
+
* @returns The choice, or `undefined` when the element isn't tabbable there.
|
|
2537
|
+
* @see findChoice
|
|
2538
|
+
* @see getFocusableElements
|
|
2539
|
+
* @notInstrumented
|
|
2540
|
+
*/
|
|
2541
|
+
const getFocusedChoice = ({ container, element }) => {
|
|
2542
|
+
const index = getFocusableElements({ container }).indexOf(element);
|
|
2543
|
+
if (index < 0) return void 0;
|
|
2544
|
+
return {
|
|
2545
|
+
index,
|
|
2546
|
+
label: getChoiceLabel({ element })
|
|
2547
|
+
};
|
|
2548
|
+
};
|
|
2549
|
+
|
|
2550
|
+
//#endregion
|
|
2551
|
+
//#region src/components/PanelHost/popChoiceForTitle/popChoiceForTitle.ts
|
|
2552
|
+
/**
|
|
2553
|
+
* Finds the choice to restore when going back to a screen: the most recent
|
|
2554
|
+
* forward move made from a screen with that title. Moves after it are
|
|
2555
|
+
* dropped with it, so screens that share a title each get their own choice,
|
|
2556
|
+
* and a history that missed a step still finds the right entry.
|
|
2557
|
+
*
|
|
2558
|
+
* @example
|
|
2559
|
+
* ```ts
|
|
2560
|
+
* const { choice, history } = popChoiceForTitle({ history, title: 'Choose' });
|
|
2561
|
+
* ```
|
|
2562
|
+
* @param params.history - The forward moves so far, oldest first.
|
|
2563
|
+
* @param params.title - The title of the screen being returned to.
|
|
2564
|
+
* @returns The choice, and the history that remains.
|
|
2565
|
+
* @see useScreenFocus
|
|
2566
|
+
* @see findChoice
|
|
2567
|
+
* @notInstrumented
|
|
2568
|
+
*/
|
|
2569
|
+
const popChoiceForTitle = ({ history, title }) => {
|
|
2570
|
+
for (let index = history.length - 1; index >= 0; index -= 1) {
|
|
2571
|
+
const entry = history[index];
|
|
2572
|
+
if (entry?.title === title) return {
|
|
2573
|
+
choice: entry.choice,
|
|
2574
|
+
history: history.slice(0, index)
|
|
2575
|
+
};
|
|
2576
|
+
}
|
|
2577
|
+
return {
|
|
2578
|
+
choice: void 0,
|
|
2579
|
+
history
|
|
2580
|
+
};
|
|
2581
|
+
};
|
|
2582
|
+
|
|
2583
|
+
//#endregion
|
|
2584
|
+
//#region src/components/PanelHost/useScreenFocus/useScreenFocus.ts
|
|
2585
|
+
/**
|
|
2586
|
+
* Focus across screen changes: remembers the choice that opened each screen,
|
|
2587
|
+
* with the title of the screen it was on, and puts focus back on it when the
|
|
2588
|
+
* payer returns. Going forward, focus that fell to the page moves to the card,
|
|
2589
|
+
* but only if it was in the card when the screen changed.
|
|
2590
|
+
*
|
|
2591
|
+
* @example
|
|
2592
|
+
* ```ts
|
|
2593
|
+
* const { onCardBlur, onCardFocus, placeFocus } = useScreenFocus({ bodyRef, cardRef });
|
|
2594
|
+
* ```
|
|
2595
|
+
* @param params.bodyRef - The screen body the choices sit in.
|
|
2596
|
+
* @param params.cardRef - The card the screens render in.
|
|
2597
|
+
* @returns Focus handlers for the card, and a function to call on each screen change.
|
|
2598
|
+
* @see PanelHost
|
|
2599
|
+
* @see focusAfterScreenChange
|
|
2600
|
+
* @notInstrumented
|
|
2601
|
+
*/
|
|
2602
|
+
const useScreenFocus = ({ bodyRef, cardRef }) => {
|
|
2603
|
+
const historyRef = (0, react.useRef)([]);
|
|
2604
|
+
const recentChoicesRef = (0, react.useRef)([]);
|
|
2605
|
+
const hasFocusRef = (0, react.useRef)(false);
|
|
2606
|
+
const onCardFocus = (0, react.useCallback)((event) => {
|
|
2607
|
+
hasFocusRef.current = true;
|
|
2608
|
+
const body = bodyRef.current;
|
|
2609
|
+
const element = event.target;
|
|
2610
|
+
if (body === null || !(element instanceof HTMLElement)) return;
|
|
2611
|
+
const choice = getFocusedChoice({
|
|
2612
|
+
container: body,
|
|
2613
|
+
element
|
|
2614
|
+
});
|
|
2615
|
+
if (choice === void 0) return;
|
|
2616
|
+
recentChoicesRef.current = [{
|
|
2617
|
+
choice,
|
|
2618
|
+
element
|
|
2619
|
+
}, ...recentChoicesRef.current].slice(0, 2);
|
|
2620
|
+
}, [bodyRef]);
|
|
2621
|
+
return {
|
|
2622
|
+
onCardBlur: (0, react.useCallback)((event) => {
|
|
2623
|
+
const { currentTarget, relatedTarget, target } = event;
|
|
2624
|
+
const isStayingInside = relatedTarget instanceof Node && currentTarget.contains(relatedTarget);
|
|
2625
|
+
const isUnmounting = target instanceof Node && !target.isConnected;
|
|
2626
|
+
if (!isStayingInside && !isUnmounting) hasFocusRef.current = false;
|
|
2627
|
+
}, []),
|
|
2628
|
+
onCardFocus,
|
|
2629
|
+
placeFocus: (0, react.useCallback)(({ enteringTitle, isGoingBack, leavingTitle }) => {
|
|
2630
|
+
const recent = recentChoicesRef.current;
|
|
2631
|
+
const opening = recent.find(({ element }) => !element.isConnected) ?? recent[0];
|
|
2632
|
+
recentChoicesRef.current = [];
|
|
2633
|
+
if (!isGoingBack && leavingTitle !== void 0 && opening !== void 0) historyRef.current.push({
|
|
2634
|
+
choice: opening.choice,
|
|
2635
|
+
title: leavingTitle
|
|
2636
|
+
});
|
|
2637
|
+
let restoreChoice;
|
|
2638
|
+
if (isGoingBack && enteringTitle !== void 0) {
|
|
2639
|
+
const popped = popChoiceForTitle({
|
|
2640
|
+
history: historyRef.current,
|
|
2641
|
+
title: enteringTitle
|
|
2642
|
+
});
|
|
2643
|
+
historyRef.current = popped.history;
|
|
2644
|
+
restoreChoice = popped.choice;
|
|
2645
|
+
}
|
|
2646
|
+
const body = bodyRef.current;
|
|
2647
|
+
const card = cardRef.current;
|
|
2648
|
+
if (body === null || card === null) return;
|
|
2649
|
+
focusAfterScreenChange({
|
|
2650
|
+
body,
|
|
2651
|
+
card,
|
|
2652
|
+
hadFocus: hasFocusRef.current,
|
|
2653
|
+
restoreChoice
|
|
2654
|
+
});
|
|
2655
|
+
}, [bodyRef, cardRef])
|
|
2656
|
+
};
|
|
2657
|
+
};
|
|
2658
|
+
|
|
2659
|
+
//#endregion
|
|
2660
|
+
//#region src/components/PanelHost/usePanelHost/usePanelHost.ts
|
|
2661
|
+
const EMPTY_HEADER = {
|
|
2662
|
+
backLabel: void 0,
|
|
2663
|
+
hasBack: false,
|
|
2664
|
+
title: void 0
|
|
2665
|
+
};
|
|
2666
|
+
/**
|
|
2667
|
+
* State and behaviour for {@link PanelHost}: tracks which panel owns the
|
|
2668
|
+
* header and when the screen changes, then runs the height animation, the
|
|
2669
|
+
* pointer gate and focus placement for it, and sends Escape to Back.
|
|
2670
|
+
*
|
|
2671
|
+
* @example
|
|
2672
|
+
* ```tsx
|
|
2673
|
+
* const host = usePanelHost();
|
|
2674
|
+
* ```
|
|
2675
|
+
* @returns What the host renders.
|
|
2676
|
+
* @see PanelHost
|
|
2677
|
+
* @see usePanel
|
|
2678
|
+
* @notInstrumented
|
|
2679
|
+
*/
|
|
2680
|
+
const usePanelHost = () => {
|
|
2681
|
+
const cardHeight = useCardHeight();
|
|
2682
|
+
const { cardRef } = cardHeight;
|
|
2683
|
+
const bodyRef = (0, react.useRef)(null);
|
|
2684
|
+
const titleId = (0, react.useId)();
|
|
2685
|
+
const { isNavigating, startNavigationGate } = useNavigationGate();
|
|
2686
|
+
const { onCardBlur, onCardFocus, placeFocus } = useScreenFocus({
|
|
2687
|
+
bodyRef,
|
|
2688
|
+
cardRef
|
|
2689
|
+
});
|
|
2690
|
+
const [header, setHeader] = (0, react.useState)(EMPTY_HEADER);
|
|
2691
|
+
const [outlet, setOutlet] = (0, react.useState)(null);
|
|
2692
|
+
const backRef = (0, react.useRef)(void 0);
|
|
2693
|
+
const panelsRef = (0, react.useRef)([]);
|
|
2694
|
+
const reportsRef = (0, react.useRef)(/* @__PURE__ */ new Map());
|
|
2695
|
+
const reporterRef = (0, react.useRef)(void 0);
|
|
2696
|
+
const titleRef = (0, react.useRef)(void 0);
|
|
2697
|
+
const isGoingBackRef = (0, react.useRef)(false);
|
|
2698
|
+
const showHeader = (0, react.useCallback)((report) => {
|
|
2699
|
+
backRef.current = report?.onBack;
|
|
2700
|
+
if (report === void 0) {
|
|
2701
|
+
setHeader(EMPTY_HEADER);
|
|
2702
|
+
return;
|
|
2703
|
+
}
|
|
2704
|
+
const { backLabel, onBack, title } = report;
|
|
2705
|
+
const hasBack = onBack !== void 0;
|
|
2706
|
+
setHeader((current) => current.title === title && current.hasBack === hasBack && current.backLabel === backLabel ? current : {
|
|
2707
|
+
backLabel,
|
|
2708
|
+
hasBack,
|
|
2709
|
+
title
|
|
2710
|
+
});
|
|
2711
|
+
}, []);
|
|
2712
|
+
const registerPanel = (0, react.useCallback)((id) => {
|
|
2713
|
+
panelsRef.current = [...panelsRef.current.filter((panel) => panel !== id), id];
|
|
2714
|
+
}, []);
|
|
2715
|
+
const enterScreen = (0, react.useCallback)((title) => {
|
|
2716
|
+
const isGoingBack = isGoingBackRef.current;
|
|
2717
|
+
isGoingBackRef.current = false;
|
|
2718
|
+
if (reporterRef.current === void 0) return;
|
|
2719
|
+
startNavigationGate();
|
|
2720
|
+
placeFocus({
|
|
2721
|
+
enteringTitle: title,
|
|
2722
|
+
isGoingBack,
|
|
2723
|
+
leavingTitle: titleRef.current
|
|
2724
|
+
});
|
|
2725
|
+
}, [placeFocus, startNavigationGate]);
|
|
2726
|
+
const reportHeader = (0, react.useCallback)((id, report) => {
|
|
2727
|
+
reportsRef.current.set(id, report);
|
|
2728
|
+
if (panelsRef.current.at(-1) !== id) return;
|
|
2729
|
+
if (id !== reporterRef.current || report.title !== titleRef.current) enterScreen(report.title);
|
|
2730
|
+
reporterRef.current = id;
|
|
2731
|
+
titleRef.current = report.title;
|
|
2732
|
+
showHeader(report);
|
|
2733
|
+
}, [enterScreen, showHeader]);
|
|
2734
|
+
const unregisterPanel = (0, react.useCallback)((id) => {
|
|
2735
|
+
const isOwner = panelsRef.current.at(-1) === id;
|
|
2736
|
+
panelsRef.current = panelsRef.current.filter((panel) => panel !== id);
|
|
2737
|
+
reportsRef.current.delete(id);
|
|
2738
|
+
if (!isOwner) return;
|
|
2739
|
+
const nextOwner = panelsRef.current.at(-1);
|
|
2740
|
+
showHeader(nextOwner === void 0 ? void 0 : reportsRef.current.get(nextOwner));
|
|
2741
|
+
}, [showHeader]);
|
|
2742
|
+
const goBack = (0, react.useCallback)(() => {
|
|
2743
|
+
isGoingBackRef.current = true;
|
|
2744
|
+
backRef.current?.();
|
|
2745
|
+
}, []);
|
|
2746
|
+
const onHostClickCapture = (0, react.useCallback)(() => {
|
|
2747
|
+
isGoingBackRef.current = false;
|
|
2748
|
+
}, []);
|
|
2749
|
+
const onKeyDown = (0, react.useCallback)((event) => {
|
|
2750
|
+
if (event.key !== "Escape" || event.defaultPrevented) return;
|
|
2751
|
+
if (event.nativeEvent.isComposing || backRef.current === void 0) return;
|
|
2752
|
+
if (isFilledSearchField({ target: event.target })) return;
|
|
2753
|
+
event.preventDefault();
|
|
2754
|
+
goBack();
|
|
2755
|
+
}, [goBack]);
|
|
2756
|
+
const contextValue = (0, react.useMemo)(() => ({
|
|
2757
|
+
outlet,
|
|
2758
|
+
registerPanel,
|
|
2759
|
+
reportHeader,
|
|
2760
|
+
unregisterPanel
|
|
2761
|
+
}), [
|
|
2762
|
+
outlet,
|
|
2763
|
+
registerPanel,
|
|
2764
|
+
reportHeader,
|
|
2765
|
+
unregisterPanel
|
|
2766
|
+
]);
|
|
2767
|
+
return {
|
|
2768
|
+
...cardHeight,
|
|
2769
|
+
bodyRef,
|
|
2770
|
+
contextValue,
|
|
2771
|
+
goBack,
|
|
2772
|
+
header,
|
|
2773
|
+
isNavigating,
|
|
2774
|
+
onCardBlur,
|
|
2775
|
+
onCardFocus,
|
|
2776
|
+
onHostClickCapture,
|
|
2777
|
+
onKeyDown,
|
|
2778
|
+
setOutlet,
|
|
2779
|
+
titleId
|
|
2780
|
+
};
|
|
2781
|
+
};
|
|
2782
|
+
|
|
2783
|
+
//#endregion
|
|
2784
|
+
//#region src/components/PanelHost/PanelHostCard/PanelHostCard.tsx
|
|
2785
|
+
/**
|
|
2786
|
+
* The card an outermost {@link PanelHost} draws: the header the current
|
|
2787
|
+
* screen reports, the body, and the outlet below the card. The card's height
|
|
2788
|
+
* follows its content, and the card is named by the current title.
|
|
2789
|
+
*
|
|
2790
|
+
* @example
|
|
2791
|
+
* ```tsx
|
|
2792
|
+
* import { PanelHostCard } from '@/components/PanelHost/PanelHostCard';
|
|
2793
|
+
*
|
|
2794
|
+
* const Host = () => <PanelHostCard>{screens}</PanelHostCard>;
|
|
2795
|
+
* ```
|
|
2796
|
+
* @param params.children - The screens, each rendering a Panel.
|
|
2797
|
+
* @param params.className - Extra class names for the host element.
|
|
2798
|
+
* @returns The persistent card.
|
|
2799
|
+
* @see PanelHostCardProps
|
|
2800
|
+
* @see PanelHost
|
|
2801
|
+
* @see usePanelHost
|
|
2802
|
+
* @notInstrumented
|
|
2803
|
+
*/
|
|
2804
|
+
const PanelHostCard = ({ children, className }) => {
|
|
2805
|
+
const host = usePanelHost();
|
|
2806
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
2807
|
+
className,
|
|
2808
|
+
"data-slot": "dyn-panel-host",
|
|
2809
|
+
onClickCapture: host.onHostClickCapture,
|
|
2810
|
+
onKeyDown: host.onKeyDown,
|
|
2811
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(PanelHostContext.Provider, {
|
|
2812
|
+
value: host.contextValue,
|
|
2813
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(motion_react.m.div, {
|
|
2814
|
+
animate: host.cardAnimate,
|
|
2815
|
+
"aria-labelledby": host.header.title === void 0 ? void 0 : host.titleId,
|
|
2816
|
+
"data-navigating": host.isNavigating,
|
|
2817
|
+
"data-slot": "dyn-panel",
|
|
2818
|
+
initial: false,
|
|
2819
|
+
onBlur: host.onCardBlur,
|
|
2820
|
+
onFocus: host.onCardFocus,
|
|
2821
|
+
ref: host.cardRef,
|
|
2822
|
+
role: "group",
|
|
2823
|
+
tabIndex: -1,
|
|
2824
|
+
transition: host.heightTransition,
|
|
2825
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
2826
|
+
"data-slot": "dyn-panel-measure",
|
|
2827
|
+
ref: host.measureRef,
|
|
2828
|
+
children: [host.header.title !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PanelHeader, {
|
|
2829
|
+
backLabel: host.header.backLabel,
|
|
2830
|
+
onBack: host.header.hasBack ? host.goBack : void 0,
|
|
2831
|
+
title: host.header.title,
|
|
2832
|
+
titleId: host.titleId
|
|
2833
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
2834
|
+
"data-slot": "dyn-panel-body",
|
|
2835
|
+
ref: host.bodyRef,
|
|
2836
|
+
children
|
|
2837
|
+
})]
|
|
2838
|
+
})
|
|
2839
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
2840
|
+
"data-slot": "dyn-panel-host-outlet",
|
|
2841
|
+
ref: host.setOutlet
|
|
2842
|
+
})]
|
|
2843
|
+
})
|
|
2844
|
+
});
|
|
2845
|
+
};
|
|
2846
|
+
|
|
2847
|
+
//#endregion
|
|
2848
|
+
//#region src/components/PanelHost/PanelHost.tsx
|
|
2849
|
+
/**
|
|
2850
|
+
* Keeps one card mounted across screens: every {@link Panel} rendered inside
|
|
2851
|
+
* it hands over its title and Back and renders only its body, so changing
|
|
2852
|
+
* screens changes the card's height and title rather than replacing the card.
|
|
2853
|
+
* Escape goes back one level, pointer input pauses briefly after each screen
|
|
2854
|
+
* change, and focus returns to the choice that opened a screen on Back. A
|
|
2855
|
+
* host inside another host renders its children into the outer card.
|
|
2856
|
+
*
|
|
2857
|
+
* @example
|
|
2858
|
+
* ```tsx
|
|
2859
|
+
* import { PanelHost } from '@/components/PanelHost/PanelHost';
|
|
2860
|
+
*
|
|
2861
|
+
* const Widget = () => (
|
|
2862
|
+
* <PanelHost>
|
|
2863
|
+
* {step === 'list' ? (
|
|
2864
|
+
* <Panel title="Choose a token">…</Panel>
|
|
2865
|
+
* ) : (
|
|
2866
|
+
* <Panel onBack={back} title="Review">…</Panel>
|
|
2867
|
+
* )}
|
|
2868
|
+
* </PanelHost>
|
|
2869
|
+
* );
|
|
2870
|
+
* ```
|
|
2871
|
+
* @param params.children - The screens, each rendering a Panel.
|
|
2872
|
+
* @param params.className - Extra class names for the host element.
|
|
2873
|
+
* @returns The persistent card.
|
|
2874
|
+
* @see PanelHostProps
|
|
2875
|
+
* @see Panel
|
|
2876
|
+
* @see PanelHeader
|
|
2877
|
+
* @notInstrumented
|
|
2878
|
+
*/
|
|
2879
|
+
const PanelHost = ({ children, className }) => {
|
|
2880
|
+
if ((0, react.useContext)(PanelHostContext) !== void 0) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_jsx_runtime.Fragment, { children });
|
|
2881
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PanelHostCard, {
|
|
2882
|
+
className,
|
|
2883
|
+
children
|
|
2884
|
+
});
|
|
2885
|
+
};
|
|
2886
|
+
|
|
2887
|
+
//#endregion
|
|
2888
|
+
//#region src/widgets/ConnectWalletOptionWidget/routes/chainPickerRoute/ChainPickerRouteView.text.ts
|
|
2889
|
+
/**
|
|
2890
|
+
* Default text for the chain-picker route of {@link ConnectWalletOptionWidget}.
|
|
2891
|
+
*/
|
|
2892
|
+
const CHAIN_PICKER_ROUTE_TEXT = { chainPickerTitle: "Choose a chain" };
|
|
2893
|
+
|
|
2894
|
+
//#endregion
|
|
2895
|
+
//#region src/widgets/ConnectWalletOptionWidget/routes/connectedRoute/ConnectedRouteView.text.ts
|
|
2896
|
+
/**
|
|
2897
|
+
* Default text for the connected route of {@link ConnectWalletOptionWidget}.
|
|
2898
|
+
*/
|
|
2899
|
+
const CONNECTED_ROUTE_TEXT = {
|
|
2900
|
+
connectedStatusMessage: "{wallet} connected.",
|
|
2901
|
+
connectedTitle: "{wallet}"
|
|
2902
|
+
};
|
|
2903
|
+
|
|
2904
|
+
//#endregion
|
|
2905
|
+
//#region src/widgets/ConnectWalletOptionWidget/routes/connectingRoute/ConnectingRouteView.text.ts
|
|
2906
|
+
/**
|
|
2907
|
+
* Default text for the connecting route of {@link ConnectWalletOptionWidget}.
|
|
2908
|
+
*/
|
|
2909
|
+
const CONNECTING_ROUTE_TEXT = {
|
|
2910
|
+
connectingStatusMessage: "Approve the connection in {wallet} to continue.",
|
|
2911
|
+
connectingTitle: "Connect {wallet}"
|
|
2912
|
+
};
|
|
2913
|
+
|
|
2914
|
+
//#endregion
|
|
2915
|
+
//#region src/widgets/ConnectWalletOptionWidget/routes/errorRoute/ErrorRouteView.text.ts
|
|
2916
|
+
/**
|
|
2917
|
+
* Default text for the error route of {@link ConnectWalletOptionWidget}.
|
|
2918
|
+
*/
|
|
2919
|
+
const ERROR_ROUTE_TEXT = {
|
|
2920
|
+
errorStatusMessage: "{wallet} didn’t connect. Please try again.",
|
|
2921
|
+
errorTitle: "Couldn’t connect",
|
|
2922
|
+
tryAgainLabel: "Try again"
|
|
2923
|
+
};
|
|
2924
|
+
|
|
2925
|
+
//#endregion
|
|
2926
|
+
//#region src/widgets/ConnectWalletOptionWidget/routes/listRoute/ListRouteView.text.ts
|
|
2927
|
+
/**
|
|
2928
|
+
* Default text for the list route of {@link ConnectWalletOptionWidget}.
|
|
2929
|
+
*/
|
|
2930
|
+
const LIST_ROUTE_TEXT = { listTitle: "Connect a wallet" };
|
|
2931
|
+
|
|
2932
|
+
//#endregion
|
|
2933
|
+
//#region src/widgets/ConnectWalletOptionWidget/routes/qrCodeRoute/QrCodeRouteView.text.ts
|
|
2934
|
+
/**
|
|
2935
|
+
* Default text for the QR-code route of {@link ConnectWalletOptionWidget}.
|
|
2936
|
+
*/
|
|
2937
|
+
const QR_CODE_ROUTE_TEXT = { qrCodeTitle: "Scan with {wallet}" };
|
|
2938
|
+
|
|
2939
|
+
//#endregion
|
|
2940
|
+
//#region src/widgets/ConnectWalletOptionWidget/routes/redirectingRoute/RedirectingRouteView.text.ts
|
|
2941
|
+
/**
|
|
2942
|
+
* Default text for the redirecting route of {@link ConnectWalletOptionWidget}.
|
|
2943
|
+
*/
|
|
2944
|
+
const REDIRECTING_ROUTE_TEXT = {
|
|
2945
|
+
redirectingStatusMessage: "Connect from browser in {wallet}",
|
|
2946
|
+
redirectingStatusSecondaryMessage: "If the wallet app isn’t installed on your device, you may not be redirected."
|
|
2947
|
+
};
|
|
2948
|
+
|
|
2949
|
+
//#endregion
|
|
2950
|
+
//#region src/widgets/ConnectWalletOptionWidget/ConnectWalletOptionWidget.text.ts
|
|
2951
|
+
/**
|
|
2952
|
+
* Default text for {@link ConnectWalletOptionWidget}: the merge of every route
|
|
2953
|
+
* module's own defaults, so each copy key lives next to the route that renders
|
|
2954
|
+
* it.
|
|
2955
|
+
*/
|
|
2956
|
+
const CONNECT_WALLET_WIDGET_TEXT = {
|
|
2957
|
+
...CHAIN_PICKER_ROUTE_TEXT,
|
|
2958
|
+
...CONNECTED_ROUTE_TEXT,
|
|
2959
|
+
...CONNECTING_ROUTE_TEXT,
|
|
2960
|
+
...ERROR_ROUTE_TEXT,
|
|
2961
|
+
...LIST_ROUTE_TEXT,
|
|
2962
|
+
...QR_CODE_ROUTE_TEXT,
|
|
2963
|
+
...REDIRECTING_ROUTE_TEXT
|
|
2964
|
+
};
|
|
2965
|
+
/**
|
|
2966
|
+
* Placeholder token in {@link CONNECT_WALLET_WIDGET_TEXT} replaced with the
|
|
2967
|
+
* wallet's display name at render.
|
|
2968
|
+
*/
|
|
2969
|
+
const CONNECT_WALLET_WIDGET_WALLET_TOKEN = "{wallet}";
|
|
2970
|
+
|
|
2971
|
+
//#endregion
|
|
2972
|
+
//#region src/utils/getChainInfo/getChainInfo.ts
|
|
2973
|
+
/**
|
|
2974
|
+
* Curated display info for the chains this SDK ships a wallet connector
|
|
2975
|
+
* for. Deliberately partial — {@link Chain} carries every chain the wallet
|
|
2976
|
+
* book knows about, most of which have no package in this monorepo.
|
|
2977
|
+
*/
|
|
2978
|
+
const CHAIN_INFO = {
|
|
2979
|
+
ALEO: {
|
|
2980
|
+
icon: _dynamic_labs_iconic.AleoIcon,
|
|
2981
|
+
label: "Aleo"
|
|
2982
|
+
},
|
|
2983
|
+
APTOS: {
|
|
2984
|
+
icon: _dynamic_labs_iconic.AptosIcon,
|
|
2985
|
+
label: "Aptos"
|
|
2986
|
+
},
|
|
2987
|
+
BTC: {
|
|
2988
|
+
icon: _dynamic_labs_iconic.BitcoinIcon,
|
|
2989
|
+
label: "Bitcoin"
|
|
2990
|
+
},
|
|
2991
|
+
COSMOS: {
|
|
2992
|
+
icon: _dynamic_labs_iconic.CosmosIcon,
|
|
2993
|
+
label: "Cosmos"
|
|
2994
|
+
},
|
|
2995
|
+
EVM: {
|
|
2996
|
+
icon: _dynamic_labs_iconic.EthereumIcon,
|
|
2997
|
+
label: "EVM"
|
|
2998
|
+
},
|
|
2999
|
+
SOL: {
|
|
3000
|
+
icon: _dynamic_labs_iconic.SolanaIcon,
|
|
3001
|
+
label: "Solana"
|
|
3002
|
+
},
|
|
3003
|
+
STARK: {
|
|
3004
|
+
icon: _dynamic_labs_iconic.StarknetIcon,
|
|
3005
|
+
label: "Starknet"
|
|
3006
|
+
},
|
|
3007
|
+
STELLAR: {
|
|
3008
|
+
icon: _dynamic_labs_iconic.StellarIcon,
|
|
3009
|
+
label: "Stellar"
|
|
3010
|
+
},
|
|
3011
|
+
SUI: {
|
|
3012
|
+
icon: _dynamic_labs_iconic.SuiIcon,
|
|
3013
|
+
label: "Sui"
|
|
3014
|
+
},
|
|
3015
|
+
TON: {
|
|
3016
|
+
icon: _dynamic_labs_iconic.TonIcon,
|
|
3017
|
+
label: "Ton"
|
|
3018
|
+
},
|
|
3019
|
+
TRON: {
|
|
3020
|
+
icon: _dynamic_labs_iconic.TronIcon,
|
|
3021
|
+
label: "Tron"
|
|
3022
|
+
}
|
|
3023
|
+
};
|
|
3024
|
+
/**
|
|
3025
|
+
* Maps a {@link Chain} to its display info. Falls
|
|
3026
|
+
* back to the raw chain code with no icon for a chain with no curated
|
|
3027
|
+
* entry, rather than guessing at one.
|
|
3028
|
+
*
|
|
3029
|
+
* @example
|
|
3030
|
+
* ```ts
|
|
3031
|
+
* getChainInfo('SOL'); // { icon: SolanaIcon, label: 'Solana' }
|
|
3032
|
+
* ```
|
|
3033
|
+
* @param chain - The chain to look up.
|
|
3034
|
+
* @returns The chain's display info.
|
|
3035
|
+
* @see ChainInfo
|
|
3036
|
+
* @see WalletChainList
|
|
3037
|
+
* @notInstrumented
|
|
3038
|
+
*/
|
|
3039
|
+
const getChainInfo = (chain) => CHAIN_INFO[chain] ?? { label: chain };
|
|
3040
|
+
|
|
3041
|
+
//#endregion
|
|
3042
|
+
//#region src/views/WalletChainList/WalletChainList.text.ts
|
|
3043
|
+
/**
|
|
3044
|
+
* Default text for {@link WalletChainList}.
|
|
3045
|
+
*/
|
|
3046
|
+
const WALLET_CHAIN_LIST_TEXT = { message: "This wallet supports multiple chains. Select which chain you'd like to connect to" };
|
|
3047
|
+
|
|
3048
|
+
//#endregion
|
|
3049
|
+
//#region src/views/WalletChainList/WalletChainList.tsx
|
|
3050
|
+
/**
|
|
3051
|
+
* The chain picker shown after a customer picks a wallet that supports more
|
|
3052
|
+
* than one chain. A chain is not a wallet or exchange provider, so this does
|
|
3053
|
+
* not reuse {@link ProviderList} or its `dyn-provider-*` slots — it carries
|
|
3054
|
+
* its own rows and its own styling contract, even though the row recipe
|
|
3055
|
+
* (height, radius, hover) is the same shared visual as `ProviderOption`.
|
|
3056
|
+
* Each row renders `data-testid="wallet-chain-option-<chain>"` for `getByTestId`
|
|
3057
|
+
* targeting.
|
|
3058
|
+
*
|
|
3059
|
+
* @example
|
|
3060
|
+
* ```tsx
|
|
3061
|
+
* import { WalletChainList } from '@/views/WalletChainList/WalletChainList';
|
|
3062
|
+
*
|
|
3063
|
+
* const App = () => (
|
|
3064
|
+
* <WalletChainList chains={['EVM', 'SOL']} onSelectChain={(chain) => console.log(chain)} />
|
|
3065
|
+
* );
|
|
3066
|
+
* ```
|
|
3067
|
+
* @param params.chains - Chains to offer, in display order.
|
|
3068
|
+
* @param params.className - Extra class names for the list element.
|
|
3069
|
+
* @param params.onSelectChain - Fires with the chosen chain.
|
|
3070
|
+
* @param params.wallet - The picked wallet, shown above the chains when present.
|
|
3071
|
+
* @returns The wallet chain list.
|
|
3072
|
+
* @see WalletChainListProps
|
|
3073
|
+
* @see WalletList
|
|
3074
|
+
* @see ConnectWalletOptionWidget
|
|
3075
|
+
* @see useGetWalletOptionsCatalogue
|
|
3076
|
+
* @see useConnectWalletOption
|
|
3077
|
+
* @copy message - Lead line under the wallet icon, above the chain options.
|
|
3078
|
+
* @notInstrumented
|
|
3079
|
+
*/
|
|
3080
|
+
const WalletChainList = ({ chains, className, onSelectChain, wallet }) => {
|
|
3081
|
+
const text = useText({
|
|
3082
|
+
defaults: WALLET_CHAIN_LIST_TEXT,
|
|
3083
|
+
slot: "dyn-wallet-chain-list"
|
|
3084
|
+
});
|
|
3085
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
3086
|
+
className,
|
|
3087
|
+
"data-slot": "dyn-wallet-chain-list",
|
|
3088
|
+
children: [wallet !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(ProviderIcon, {
|
|
3089
|
+
name: wallet.name,
|
|
3090
|
+
url: wallet.iconUrl
|
|
3091
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
3092
|
+
"data-slot": "dyn-wallet-chain-list-message",
|
|
3093
|
+
children: text("message")
|
|
3094
|
+
})] }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
3095
|
+
"data-slot": "dyn-wallet-chain-options",
|
|
3096
|
+
children: chains.map((chain) => {
|
|
3097
|
+
const { icon: ChainIcon, label } = getChainInfo(chain);
|
|
3098
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
|
|
3099
|
+
"data-slot": "dyn-wallet-chain-option",
|
|
3100
|
+
"data-testid": `wallet-chain-option-${chain}`,
|
|
3101
|
+
onClick: () => onSelectChain(chain),
|
|
3102
|
+
type: "button",
|
|
3103
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
3104
|
+
"data-slot": "dyn-wallet-chain-option-icon",
|
|
3105
|
+
children: ChainIcon ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ChainIcon, {}) : null
|
|
3106
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
3107
|
+
"data-slot": "dyn-wallet-chain-option-name",
|
|
3108
|
+
children: label
|
|
3109
|
+
})]
|
|
3110
|
+
}, chain);
|
|
3111
|
+
})
|
|
3112
|
+
})]
|
|
3113
|
+
});
|
|
3114
|
+
};
|
|
3115
|
+
|
|
3116
|
+
//#endregion
|
|
3117
|
+
//#region src/widgets/ConnectWalletOptionWidget/routes/chainPickerRoute/ChainPickerRouteView.tsx
|
|
3118
|
+
/**
|
|
3119
|
+
* The chain-picker screen of {@link ConnectWalletOptionWidget}: shows when the
|
|
3120
|
+
* picked wallet supports more than one chain.
|
|
3121
|
+
*
|
|
3122
|
+
* @example
|
|
3123
|
+
* ```tsx
|
|
3124
|
+
* const view = (
|
|
3125
|
+
* <ChainPickerRouteView
|
|
3126
|
+
* chains={chains}
|
|
3127
|
+
* onSelectChain={onSelectChain}
|
|
3128
|
+
* walletOption={walletOption}
|
|
3129
|
+
* />
|
|
3130
|
+
* );
|
|
3131
|
+
* ```
|
|
3132
|
+
* @param params.chains - The chains the picked wallet supports.
|
|
3133
|
+
* @param params.onSelectChain - Picks a chain for the selected wallet and starts the connection.
|
|
3134
|
+
* @param params.walletOption - The picked wallet.
|
|
3135
|
+
* @returns The chain-picker screen.
|
|
3136
|
+
* @see chainPickerRoute
|
|
3137
|
+
* @see ConnectWalletOptionWidget
|
|
3138
|
+
* @see WalletChainList
|
|
3139
|
+
* @copy chainPickerTitle - Header title for the chain-picker route.
|
|
3140
|
+
* @notInstrumented
|
|
3141
|
+
*/
|
|
3142
|
+
const ChainPickerRouteView = ({ chains, onSelectChain, walletOption }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(WalletChainList, {
|
|
3143
|
+
chains,
|
|
3144
|
+
onSelectChain: (chain) => onSelectChain({ chain }),
|
|
3145
|
+
wallet: walletOption
|
|
3146
|
+
});
|
|
3147
|
+
|
|
3148
|
+
//#endregion
|
|
3149
|
+
//#region src/widgets/ConnectWalletOptionWidget/routes/chainPickerRoute/chainPickerRoute.tsx
|
|
3150
|
+
/**
|
|
3151
|
+
* The chain-picker route of {@link ConnectWalletOptionWidget}: shows when the
|
|
3152
|
+
* picked wallet supports more than one chain. `retainInHistory` makes it a back
|
|
3153
|
+
* target, so an abandoned attempt returns here rather than to the wallet
|
|
3154
|
+
* list.
|
|
3155
|
+
*
|
|
3156
|
+
* @see ConnectWalletRouteModule
|
|
3157
|
+
* @see connectWalletRoutes
|
|
3158
|
+
* @see ChainPickerRouteView
|
|
3159
|
+
*/
|
|
3160
|
+
const chainPickerRoute = {
|
|
3161
|
+
getTitle: ({ text }) => text("chainPickerTitle"),
|
|
3162
|
+
render: ({ route, widget }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ChainPickerRouteView, {
|
|
3163
|
+
chains: route.params.walletOption.supportedChains,
|
|
3164
|
+
onSelectChain: widget.selectChain,
|
|
3165
|
+
walletOption: route.params.walletOption
|
|
3166
|
+
}),
|
|
3167
|
+
retainInHistory: true
|
|
3168
|
+
};
|
|
3169
|
+
|
|
3170
|
+
//#endregion
|
|
3171
|
+
//#region src/views/WalletConnectionStatus/WalletConnectionStatus.tsx
|
|
3172
|
+
/**
|
|
3173
|
+
* A wallet connection status block: the wallet's icon, a status line, and
|
|
3174
|
+
* optional actions. `indicator` marks the icon: 'pending' spins a ring
|
|
3175
|
+
* around it while the wallet holds the approval; 'success' and 'error'
|
|
3176
|
+
* stamp a tick or cross badge on its corner. The message is repeated in a
|
|
3177
|
+
* visually-hidden live region so the status change is announced when the
|
|
3178
|
+
* icon alone would carry no meaning.
|
|
3179
|
+
*
|
|
3180
|
+
* @example
|
|
3181
|
+
* ```tsx
|
|
3182
|
+
* <WalletConnectionStatus
|
|
3183
|
+
* actions={<Button onClick={tryAgain}>Try again</Button>}
|
|
3184
|
+
* message="MetaMask didn’t connect. You can try again."
|
|
3185
|
+
* wallet={metamaskOption}
|
|
3186
|
+
* />
|
|
3187
|
+
* ```
|
|
3188
|
+
* @param params.actions - Optional actions under the message.
|
|
3189
|
+
* @param params.className - Extra class names for the root element.
|
|
3190
|
+
* @param params.indicator - The mark on the wallet icon.
|
|
3191
|
+
* @param params.message - The status line.
|
|
3192
|
+
* @param params.secondaryMessage - Optional lighter line under the message.
|
|
3193
|
+
* @param params.wallet - The wallet being connected.
|
|
3194
|
+
* @returns The wallet connection status block.
|
|
3195
|
+
* @see WalletConnectionStatusProps
|
|
3196
|
+
* @see ProviderIcon
|
|
3197
|
+
* @see WalletList
|
|
3198
|
+
* @see useConnectWalletOption
|
|
3199
|
+
* @see ConnectWalletOptionWidget
|
|
3200
|
+
* @notInstrumented
|
|
3201
|
+
*/
|
|
3202
|
+
const WalletConnectionStatus = ({ actions, className, indicator, message, secondaryMessage, wallet }) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
3203
|
+
className,
|
|
3204
|
+
"data-slot": "dyn-wallet-connection-status",
|
|
3205
|
+
children: [
|
|
3206
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
3207
|
+
"aria-live": "polite",
|
|
3208
|
+
"data-slot": "dyn-wallet-connection-status-announce",
|
|
3209
|
+
role: "status",
|
|
3210
|
+
children: secondaryMessage === void 0 ? message : `${message}. ${secondaryMessage}`
|
|
3211
|
+
}),
|
|
3212
|
+
wallet !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
3213
|
+
"data-slot": "dyn-wallet-connection-status-icon",
|
|
3214
|
+
children: [
|
|
3215
|
+
indicator === "pending" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
3216
|
+
"aria-hidden": "true",
|
|
3217
|
+
"data-slot": "dyn-wallet-connection-status-ring"
|
|
3218
|
+
}),
|
|
3219
|
+
indicator === "success" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
3220
|
+
"aria-hidden": "true",
|
|
3221
|
+
"data-slot": "dyn-wallet-connection-status-badge",
|
|
3222
|
+
"data-variant": "success",
|
|
3223
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("svg", {
|
|
3224
|
+
fill: "none",
|
|
3225
|
+
height: "10",
|
|
3226
|
+
viewBox: "0 0 10 10",
|
|
3227
|
+
width: "10",
|
|
3228
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
|
|
3229
|
+
d: "M1.5 5.5L4 8L8.5 2.5",
|
|
3230
|
+
stroke: "currentColor",
|
|
3231
|
+
strokeLinecap: "round",
|
|
3232
|
+
strokeLinejoin: "round",
|
|
3233
|
+
strokeWidth: "1.8"
|
|
3234
|
+
})
|
|
3235
|
+
})
|
|
3236
|
+
}),
|
|
3237
|
+
indicator === "error" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
3238
|
+
"aria-hidden": "true",
|
|
3239
|
+
"data-slot": "dyn-wallet-connection-status-badge",
|
|
3240
|
+
"data-variant": "error",
|
|
3241
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("svg", {
|
|
3242
|
+
fill: "none",
|
|
3243
|
+
height: "10",
|
|
3244
|
+
viewBox: "0 0 10 10",
|
|
3245
|
+
width: "10",
|
|
3246
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
|
|
3247
|
+
d: "M2.2 2.2L7.8 7.8M7.8 2.2L2.2 7.8",
|
|
3248
|
+
stroke: "currentColor",
|
|
3249
|
+
strokeLinecap: "round",
|
|
3250
|
+
strokeLinejoin: "round",
|
|
3251
|
+
strokeWidth: "1.8"
|
|
3252
|
+
})
|
|
3253
|
+
})
|
|
3254
|
+
}),
|
|
3255
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(ProviderIcon, {
|
|
3256
|
+
name: wallet.name,
|
|
3257
|
+
url: wallet.iconUrl
|
|
3258
|
+
})
|
|
3259
|
+
]
|
|
3260
|
+
}),
|
|
3261
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
3262
|
+
"data-slot": "dyn-wallet-connection-status-message",
|
|
3263
|
+
children: message
|
|
3264
|
+
}),
|
|
3265
|
+
secondaryMessage !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
3266
|
+
"data-slot": "dyn-wallet-connection-status-secondary-message",
|
|
3267
|
+
children: secondaryMessage
|
|
3268
|
+
}),
|
|
3269
|
+
actions
|
|
3270
|
+
]
|
|
3271
|
+
});
|
|
3272
|
+
|
|
3273
|
+
//#endregion
|
|
3274
|
+
//#region src/widgets/ConnectWalletOptionWidget/routes/connectedRoute/ConnectedRouteView.tsx
|
|
3275
|
+
/**
|
|
3276
|
+
* The connected screen of {@link ConnectWalletOptionWidget}: the success
|
|
3277
|
+
* confirmation once the wallet approves.
|
|
3278
|
+
*
|
|
3279
|
+
* @example
|
|
3280
|
+
* ```tsx
|
|
3281
|
+
* const view = <ConnectedRouteView text={text} walletOption={walletOption} />;
|
|
3282
|
+
* ```
|
|
3283
|
+
* @param params.text - The view's text lookup for copy keys.
|
|
3284
|
+
* @param params.walletOption - The wallet being connected.
|
|
3285
|
+
* @returns The connected screen.
|
|
3286
|
+
* @see connectedRoute
|
|
3287
|
+
* @see ConnectWalletOptionWidget
|
|
3288
|
+
* @see WalletConnectionStatus
|
|
3289
|
+
* @copy connectedTitle - Header title once the wallet account connects; custom text may include `{wallet}`, replaced by the wallet's display name.
|
|
3290
|
+
* @copy connectedStatusMessage - Confirmation line once the wallet connects; custom text may include `{wallet}`, replaced by the wallet's display name.
|
|
3291
|
+
* @notInstrumented
|
|
3292
|
+
*/
|
|
3293
|
+
const ConnectedRouteView = ({ text, walletOption }) => {
|
|
3294
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(WalletConnectionStatus, {
|
|
3295
|
+
indicator: "success",
|
|
3296
|
+
message: interpolateText({
|
|
3297
|
+
template: text("connectedStatusMessage"),
|
|
3298
|
+
token: CONNECT_WALLET_WIDGET_WALLET_TOKEN,
|
|
3299
|
+
value: walletOption.name
|
|
3300
|
+
}),
|
|
3301
|
+
wallet: walletOption
|
|
3302
|
+
});
|
|
3303
|
+
};
|
|
3304
|
+
|
|
3305
|
+
//#endregion
|
|
3306
|
+
//#region src/widgets/ConnectWalletOptionWidget/routes/connectedRoute/connectedRoute.tsx
|
|
3307
|
+
/**
|
|
3308
|
+
* The connected route of {@link ConnectWalletOptionWidget}: the success
|
|
3309
|
+
* confirmation once the wallet approves. `terminal` marks the flow done —
|
|
3310
|
+
* there is nowhere to go back to.
|
|
3311
|
+
*
|
|
3312
|
+
* @see ConnectWalletRouteModule
|
|
3313
|
+
* @see connectWalletRoutes
|
|
3314
|
+
* @see ConnectedRouteView
|
|
3315
|
+
*/
|
|
3316
|
+
const connectedRoute = {
|
|
3317
|
+
getTitle: ({ route, text }) => interpolateText({
|
|
3318
|
+
template: text("connectedTitle"),
|
|
3319
|
+
token: CONNECT_WALLET_WIDGET_WALLET_TOKEN,
|
|
3320
|
+
value: route.params.walletOption.name
|
|
3321
|
+
}),
|
|
3322
|
+
render: ({ route, text }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ConnectedRouteView, {
|
|
3323
|
+
text,
|
|
3324
|
+
walletOption: route.params.walletOption
|
|
3325
|
+
}),
|
|
3326
|
+
terminal: true
|
|
3327
|
+
};
|
|
3328
|
+
|
|
3329
|
+
//#endregion
|
|
3330
|
+
//#region src/widgets/ConnectWalletOptionWidget/routes/connectingRoute/ConnectingRouteView.tsx
|
|
3331
|
+
/**
|
|
3332
|
+
* The connecting screen of {@link ConnectWalletOptionWidget}: the pending wait
|
|
3333
|
+
* while the wallet holds the approval.
|
|
3334
|
+
*
|
|
3335
|
+
* @example
|
|
3336
|
+
* ```tsx
|
|
3337
|
+
* const view = <ConnectingRouteView text={text} walletOption={walletOption} />;
|
|
3338
|
+
* ```
|
|
3339
|
+
* @param params.text - The view's text lookup for copy keys.
|
|
3340
|
+
* @param params.walletOption - The wallet being connected.
|
|
3341
|
+
* @returns The connecting screen.
|
|
3342
|
+
* @see connectingRoute
|
|
3343
|
+
* @see ConnectWalletOptionWidget
|
|
3344
|
+
* @see WalletConnectionStatus
|
|
3345
|
+
* @copy connectingTitle - Header title while the wallet holds the approval or the app redirects into its in-app browser; custom text may include `{wallet}`, replaced by the wallet's display name.
|
|
3346
|
+
* @copy connectingStatusMessage - Waiting line while the wallet holds the approval; custom text may include `{wallet}`, replaced by the wallet's display name.
|
|
3347
|
+
* @notInstrumented
|
|
3348
|
+
*/
|
|
3349
|
+
const ConnectingRouteView = ({ text, walletOption }) => {
|
|
3350
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(WalletConnectionStatus, {
|
|
3351
|
+
indicator: "pending",
|
|
3352
|
+
message: interpolateText({
|
|
3353
|
+
template: text("connectingStatusMessage"),
|
|
3354
|
+
token: CONNECT_WALLET_WIDGET_WALLET_TOKEN,
|
|
3355
|
+
value: walletOption.name
|
|
3356
|
+
}),
|
|
3357
|
+
wallet: walletOption
|
|
3358
|
+
});
|
|
3359
|
+
};
|
|
3360
|
+
|
|
3361
|
+
//#endregion
|
|
3362
|
+
//#region src/widgets/ConnectWalletOptionWidget/routes/connectingRoute/connectingRoute.tsx
|
|
3363
|
+
/**
|
|
3364
|
+
* The connecting route of {@link ConnectWalletOptionWidget}: the pending wait
|
|
3365
|
+
* while the wallet holds the approval. Transient — it shares one stack
|
|
3366
|
+
* slot with the rest of the in-flight attempt, so Back lands on the pick
|
|
3367
|
+
* that started it.
|
|
3368
|
+
*
|
|
3369
|
+
* @see ConnectWalletRouteModule
|
|
3370
|
+
* @see connectWalletRoutes
|
|
3371
|
+
* @see ConnectingRouteView
|
|
3372
|
+
*/
|
|
3373
|
+
const connectingRoute = {
|
|
3374
|
+
getTitle: ({ route, text }) => interpolateText({
|
|
3375
|
+
template: text("connectingTitle"),
|
|
3376
|
+
token: CONNECT_WALLET_WIDGET_WALLET_TOKEN,
|
|
3377
|
+
value: route.params.walletOption.name
|
|
3378
|
+
}),
|
|
3379
|
+
render: ({ route, text }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ConnectingRouteView, {
|
|
3380
|
+
text,
|
|
3381
|
+
walletOption: route.params.walletOption
|
|
3382
|
+
})
|
|
3383
|
+
};
|
|
3384
|
+
|
|
3385
|
+
//#endregion
|
|
3386
|
+
//#region src/widgets/ConnectWalletOptionWidget/routes/errorRoute/ErrorRouteView.tsx
|
|
3387
|
+
/**
|
|
3388
|
+
* The error screen of {@link ConnectWalletOptionWidget}: shown when the wallet
|
|
3389
|
+
* declines or the connection fails, with a retry that restarts the same
|
|
3390
|
+
* attempt.
|
|
3391
|
+
*
|
|
3392
|
+
* @example
|
|
3393
|
+
* ```tsx
|
|
3394
|
+
* const view = (
|
|
3395
|
+
* <ErrorRouteView
|
|
3396
|
+
* onTryAgain={onTryAgain}
|
|
3397
|
+
* text={text}
|
|
3398
|
+
* walletOption={walletOption}
|
|
3399
|
+
* />
|
|
3400
|
+
* );
|
|
3401
|
+
* ```
|
|
3402
|
+
* @param params.onTryAgain - Retries the last connection attempt.
|
|
3403
|
+
* @param params.text - The view's text lookup for copy keys.
|
|
3404
|
+
* @param params.walletOption - The wallet whose connection failed or was declined.
|
|
3405
|
+
* @returns The error screen.
|
|
3406
|
+
* @see errorRoute
|
|
3407
|
+
* @see ConnectWalletOptionWidget
|
|
3408
|
+
* @see WalletConnectionStatus
|
|
3409
|
+
* @copy errorTitle - Header title when the connection fails or is declined.
|
|
3410
|
+
* @copy errorStatusMessage - Shown when the connection fails or is declined; custom text may include `{wallet}`, replaced by the wallet's display name.
|
|
3411
|
+
* @copy tryAgainLabel - Label of the button that retries a failed connection.
|
|
3412
|
+
* @notInstrumented
|
|
3413
|
+
*/
|
|
3414
|
+
const ErrorRouteView = ({ onTryAgain, text, walletOption }) => {
|
|
3415
|
+
const messageText = interpolateText({
|
|
3416
|
+
template: text("errorStatusMessage"),
|
|
3417
|
+
token: CONNECT_WALLET_WIDGET_WALLET_TOKEN,
|
|
3418
|
+
value: walletOption.name
|
|
3419
|
+
});
|
|
3420
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(WalletConnectionStatus, {
|
|
3421
|
+
actions: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Button, {
|
|
3422
|
+
onClick: onTryAgain,
|
|
3423
|
+
children: text("tryAgainLabel")
|
|
3424
|
+
}),
|
|
3425
|
+
indicator: "error",
|
|
3426
|
+
message: messageText,
|
|
3427
|
+
wallet: walletOption
|
|
3428
|
+
});
|
|
3429
|
+
};
|
|
3430
|
+
|
|
3431
|
+
//#endregion
|
|
3432
|
+
//#region src/widgets/ConnectWalletOptionWidget/routes/errorRoute/errorRoute.tsx
|
|
3433
|
+
/**
|
|
3434
|
+
* The error route of {@link ConnectWalletOptionWidget}: shown when the wallet
|
|
3435
|
+
* declines or the connection fails, with a retry that restarts the same
|
|
3436
|
+
* attempt. Neither retained in history nor terminal — the customer can still go back
|
|
3437
|
+
* to the last pick.
|
|
3438
|
+
*
|
|
3439
|
+
* @see ConnectWalletRouteModule
|
|
3440
|
+
* @see connectWalletRoutes
|
|
3441
|
+
* @see ErrorRouteView
|
|
3442
|
+
*/
|
|
3443
|
+
const errorRoute = {
|
|
3444
|
+
getTitle: ({ text }) => text("errorTitle"),
|
|
3445
|
+
render: ({ route, text, widget }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ErrorRouteView, {
|
|
3446
|
+
onTryAgain: widget.tryAgain,
|
|
3447
|
+
text,
|
|
3448
|
+
walletOption: route.params.walletOption
|
|
3449
|
+
})
|
|
3450
|
+
};
|
|
3451
|
+
|
|
3452
|
+
//#endregion
|
|
3453
|
+
//#region src/views/ProviderList/ProviderList.text.ts
|
|
3454
|
+
/**
|
|
3455
|
+
* Default text for {@link ProviderList}.
|
|
3456
|
+
*/
|
|
3457
|
+
const PROVIDER_LIST_TEXT = {
|
|
3458
|
+
empty: "No providers available",
|
|
3459
|
+
noMatches: "No matches for “{searchText}”",
|
|
3460
|
+
remainingNoun: "more",
|
|
3461
|
+
searchPlaceholder: "Search"
|
|
3462
|
+
};
|
|
3463
|
+
/**
|
|
3464
|
+
* Placeholder token used in {@link PROVIDER_LIST_TEXT.noMatches}.
|
|
3465
|
+
*/
|
|
3466
|
+
const PROVIDER_LIST_SEARCH_TEXT_TOKEN = "{searchText}";
|
|
3467
|
+
|
|
3468
|
+
//#endregion
|
|
3469
|
+
//#region src/views/ProviderList/getProviderMatchRank/getProviderMatchRank.ts
|
|
3470
|
+
/**
|
|
3471
|
+
* Scores how well a provider name matches a search: 0 when the name starts
|
|
3472
|
+
* with the query, 1 when one of its words does, 2 when it contains the query
|
|
3473
|
+
* anywhere. Lower scores list first.
|
|
3474
|
+
*
|
|
3475
|
+
* @example
|
|
3476
|
+
* ```ts
|
|
3477
|
+
* getProviderMatchRank({ name: 'Coinbase Wallet', query: 'wal' }); // 1
|
|
3478
|
+
* ```
|
|
3479
|
+
* @param params.name - The provider name to test.
|
|
3480
|
+
* @param params.query - The search text, already trimmed and lowercased.
|
|
3481
|
+
* @returns The rank, or `undefined` when the name doesn't match.
|
|
3482
|
+
* @see rankProviderMatches
|
|
3483
|
+
* @see ProviderList
|
|
3484
|
+
* @notInstrumented
|
|
3485
|
+
*/
|
|
3486
|
+
const getProviderMatchRank = ({ name: name$1, query }) => {
|
|
3487
|
+
const lowerName = name$1.toLowerCase();
|
|
3488
|
+
if (lowerName.startsWith(query)) return 0;
|
|
3489
|
+
if (lowerName.split(/[^\p{L}\p{N}]+/u).some((word) => word.startsWith(query))) return 1;
|
|
3490
|
+
if (lowerName.includes(query)) return 2;
|
|
3491
|
+
};
|
|
3492
|
+
|
|
3493
|
+
//#endregion
|
|
3494
|
+
//#region src/views/ProviderList/rankProviderMatches/rankProviderMatches.ts
|
|
3495
|
+
/**
|
|
3496
|
+
* Filters providers by name and orders the matches by relevance: names that
|
|
3497
|
+
* start with the query first, then names with a word that does, then names
|
|
3498
|
+
* containing it anywhere. Ties keep their display order.
|
|
3499
|
+
*
|
|
3500
|
+
* @example
|
|
3501
|
+
* ```ts
|
|
3502
|
+
* const matches = rankProviderMatches({ items, query: 'me' });
|
|
3503
|
+
* ```
|
|
3504
|
+
* @param params.items - Providers to search, in display order.
|
|
3505
|
+
* @param params.query - The search text, already trimmed and lowercased.
|
|
3506
|
+
* @returns The matching items, best match first.
|
|
3507
|
+
* @see ProviderList
|
|
3508
|
+
* @see getProviderMatchRank
|
|
3509
|
+
* @notInstrumented
|
|
3510
|
+
*/
|
|
3511
|
+
const rankProviderMatches = ({ items, query }) => items.map((item) => ({
|
|
3512
|
+
item,
|
|
3513
|
+
rank: getProviderMatchRank({
|
|
3514
|
+
name: item.name,
|
|
3515
|
+
query
|
|
3516
|
+
})
|
|
3517
|
+
})).filter((match) => match.rank !== void 0).sort((a, b) => a.rank - b.rank).map(({ item }) => item);
|
|
3518
|
+
|
|
3519
|
+
//#endregion
|
|
3520
|
+
//#region src/views/ProviderList/ProviderList.tsx
|
|
3521
|
+
const SKELETON_ROW_COUNT$1 = 3;
|
|
3522
|
+
/**
|
|
3523
|
+
* A searchable, optionally-truncated list of providers: wallets, exchanges,
|
|
3524
|
+
* or any other option shaped like a name, an icon, and an optional badge.
|
|
3525
|
+
*
|
|
3526
|
+
* The search text is controlled by the caller rather than held here, so the
|
|
3527
|
+
* same list can be driven by a URL, a test, or a parent screen. Each row
|
|
3528
|
+
* renders `data-testid="provider-option-<item.id>"` for `getByTestId`
|
|
3529
|
+
* targeting.
|
|
3530
|
+
*
|
|
3531
|
+
* @example
|
|
3532
|
+
* ```tsx
|
|
3533
|
+
* import { ProviderList } from '@/views/ProviderList/ProviderList';
|
|
3534
|
+
*
|
|
3535
|
+
* const App = () => {
|
|
3536
|
+
* const [searchText, setSearchText] = useState('');
|
|
3537
|
+
*
|
|
3538
|
+
* return (
|
|
3539
|
+
* <ProviderList
|
|
3540
|
+
* items={[{ icon: null, id: 'metamask', name: 'MetaMask' }]}
|
|
3541
|
+
* onSearchTextChange={setSearchText}
|
|
3542
|
+
* searchText={searchText}
|
|
3543
|
+
* />
|
|
3544
|
+
* );
|
|
3545
|
+
* };
|
|
3546
|
+
* ```
|
|
3547
|
+
* @param params.className - Extra class names for the list element.
|
|
3548
|
+
* @param params.defaultVisibleCount - Shown once `items` outgrows this count and the list isn't filtered — e.g. 4 renders the first four wallets and collapses the rest into the closing row. Omitted shows every item.
|
|
3549
|
+
* @param params.emptyText - Message shown when `items` is empty outright — not a search with no matches. Defaults to "No providers available".
|
|
3550
|
+
* @param params.isLoading - `true` renders placeholder rows instead of `items` and suppresses `emptyText` — for a list that hasn't resolved yet, not a genuinely empty one.
|
|
3551
|
+
* @param params.items - Providers to offer, in display order.
|
|
3552
|
+
* @param params.onSearchTextChange - Fires with the new search text.
|
|
3553
|
+
* @param params.remainingNoun - Plural noun for what the closing row counts, e.g. "Wallets" or "Exchanges". Defaults to "more".
|
|
3554
|
+
* @param params.searchPlaceholder - Placeholder and accessible name for the search field, e.g. "Search for wallets".
|
|
3555
|
+
* @param params.searchText - The current filter text.
|
|
3556
|
+
* @param params.showSearch - Whether to show the search field: always, never, or only when the list outgrows `defaultVisibleCount`.
|
|
3557
|
+
* @returns The provider list.
|
|
3558
|
+
* @see ProviderListProps
|
|
3559
|
+
* @see ProviderOption
|
|
3560
|
+
* @copy empty - Message shown when `items` is empty outright.
|
|
3561
|
+
* @copy noMatches - Message shown when the filter matches nothing; custom text may include `{searchText}`, replaced by the current query.
|
|
3562
|
+
* @copy remainingNoun - Plural noun for what the closing show-more row counts.
|
|
3563
|
+
* @copy searchPlaceholder - Placeholder and accessible name of the search field.
|
|
3564
|
+
* @notInstrumented
|
|
3565
|
+
*/
|
|
3566
|
+
const ProviderList = ({ className, defaultVisibleCount, emptyText, isLoading = false, items, onSearchTextChange, remainingNoun, searchPlaceholder, searchText, showSearch = true }) => {
|
|
3567
|
+
const text = useText({
|
|
3568
|
+
defaults: PROVIDER_LIST_TEXT,
|
|
3569
|
+
slot: "dyn-provider-list"
|
|
3570
|
+
});
|
|
3571
|
+
const resolvedEmptyText = emptyText ?? text("empty");
|
|
3572
|
+
const resolvedRemainingNoun = remainingNoun ?? text("remainingNoun");
|
|
3573
|
+
const resolvedSearchPlaceholder = searchPlaceholder ?? text("searchPlaceholder");
|
|
3574
|
+
const trimmedSearchText = searchText.trim().toLowerCase();
|
|
3575
|
+
const isSearching = trimmedSearchText !== "";
|
|
3576
|
+
const noMatchesText = interpolateText({
|
|
3577
|
+
template: text("noMatches"),
|
|
3578
|
+
token: PROVIDER_LIST_SEARCH_TEXT_TOKEN,
|
|
3579
|
+
value: searchText
|
|
3580
|
+
});
|
|
3581
|
+
const matches = isSearching ? rankProviderMatches({
|
|
3582
|
+
items,
|
|
3583
|
+
query: trimmedSearchText
|
|
3584
|
+
}) : items;
|
|
3585
|
+
const outgrows = defaultVisibleCount !== void 0 && items.length > defaultVisibleCount;
|
|
3586
|
+
const truncateAt = !isSearching && outgrows ? defaultVisibleCount : void 0;
|
|
3587
|
+
const visible = truncateAt !== void 0 ? matches.slice(0, truncateAt) : matches;
|
|
3588
|
+
const remainingCount = truncateAt !== void 0 ? items.length - truncateAt : void 0;
|
|
3589
|
+
const searchVisible = showSearch === "auto" ? outgrows : showSearch;
|
|
3590
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
3591
|
+
className,
|
|
3592
|
+
"data-slot": "dyn-provider-list",
|
|
3593
|
+
children: [searchVisible ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SearchBar, {
|
|
3594
|
+
autoFocus: true,
|
|
3595
|
+
onChange: onSearchTextChange,
|
|
3596
|
+
placeholder: resolvedSearchPlaceholder,
|
|
3597
|
+
value: searchText
|
|
3598
|
+
}) : null, /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
3599
|
+
"data-slot": "dyn-provider-list-rows",
|
|
3600
|
+
children: [
|
|
3601
|
+
isLoading ? Array.from({ length: SKELETON_ROW_COUNT$1 }, (_, index) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
3602
|
+
"aria-hidden": "true",
|
|
3603
|
+
"data-slot": "dyn-provider-list-skeleton-row"
|
|
3604
|
+
}, index)) : visible.map((item) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ProviderOption, {
|
|
3605
|
+
badge: item.badge,
|
|
3606
|
+
icon: item.icon,
|
|
3607
|
+
name: item.name,
|
|
3608
|
+
onClick: item.onClick,
|
|
3609
|
+
id: item.id
|
|
3610
|
+
}, item.id)),
|
|
3611
|
+
!isLoading && matches.length === 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
3612
|
+
"data-slot": "dyn-provider-list-empty",
|
|
3613
|
+
children: isSearching ? noMatchesText : resolvedEmptyText
|
|
3614
|
+
}) : null,
|
|
3615
|
+
!isLoading && remainingCount ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
3616
|
+
"data-slot": "dyn-provider-list-remaining",
|
|
3617
|
+
children: [
|
|
3618
|
+
"+",
|
|
3619
|
+
remainingCount,
|
|
3620
|
+
" ",
|
|
3621
|
+
resolvedRemainingNoun
|
|
3622
|
+
]
|
|
3623
|
+
}) : null
|
|
3624
|
+
]
|
|
3625
|
+
})]
|
|
3626
|
+
});
|
|
3627
|
+
};
|
|
3628
|
+
|
|
3629
|
+
//#endregion
|
|
3630
|
+
//#region src/views/WalletList/WalletList.text.ts
|
|
3631
|
+
/**
|
|
3632
|
+
* Default text for {@link WalletList}.
|
|
3633
|
+
*/
|
|
3634
|
+
const WALLET_LIST_TEXT = {
|
|
3635
|
+
empty: "No wallets available",
|
|
3636
|
+
error: "Couldn’t load wallets",
|
|
3637
|
+
installed: "Installed",
|
|
3638
|
+
remainingNoun: "Wallets",
|
|
3639
|
+
searchPlaceholder: "Search for wallets"
|
|
3640
|
+
};
|
|
3641
|
+
|
|
3642
|
+
//#endregion
|
|
3643
|
+
//#region src/views/WalletList/WalletList.tsx
|
|
3644
|
+
/** Default number of wallet options shown before the closing row. */
|
|
3645
|
+
const DEFAULT_VISIBLE_COUNT = 8;
|
|
3646
|
+
/**
|
|
3647
|
+
* The wallet-picker screen: fetches the wallet options catalogue and renders
|
|
3648
|
+
* it through {@link ProviderList} with the wallet-specific display params
|
|
3649
|
+
* (visible count, closing-row noun, search placeholder). Connecting a
|
|
3650
|
+
* wallet, opening a WalletConnect QR, or showing an install link are the
|
|
3651
|
+
* caller's job — this component only surfaces the catalogue and reports a
|
|
3652
|
+
* selection. Rows are keyed by wallet key — `data-testid` is
|
|
3653
|
+
* `provider-option-<key>` — so a test can pick a wallet with `getByTestId`.
|
|
3654
|
+
*
|
|
3655
|
+
* @example
|
|
3656
|
+
* ```tsx
|
|
3657
|
+
* import { WalletList } from '@/views/WalletList/WalletList';
|
|
3658
|
+
*
|
|
3659
|
+
* const App = () => (
|
|
3660
|
+
* <WalletList onSelectWalletOption={(option) => console.log(option.key)} />
|
|
3661
|
+
* );
|
|
3662
|
+
* ```
|
|
3663
|
+
* @param params.className - Extra class names for the list element.
|
|
3664
|
+
* @param params.onSelectWalletOption - Fires with the chosen wallet option.
|
|
3665
|
+
* @returns The wallet list.
|
|
3666
|
+
* @see WalletListProps
|
|
3667
|
+
* @see useGetWalletOptionsCatalogue
|
|
3668
|
+
* @see useConnectWalletOption
|
|
3669
|
+
* @see WalletConnectionStatus
|
|
3670
|
+
* @see WalletConnectQrCode
|
|
3671
|
+
* @see ConnectWalletOptionWidget
|
|
3672
|
+
* @copy empty - Message shown when no wallets are available.
|
|
3673
|
+
* @copy error - Message shown when wallets fail to load.
|
|
3674
|
+
* @copy installed - Badge on a wallet row whose extension is installed.
|
|
3675
|
+
* @copy remainingNoun - Plural noun for what the closing show-more row counts.
|
|
3676
|
+
* @copy searchPlaceholder - Placeholder and accessible name of the search field.
|
|
3677
|
+
* @notInstrumented
|
|
3678
|
+
*/
|
|
3679
|
+
const WalletList = ({ className, onSelectWalletOption }) => {
|
|
3680
|
+
const text = useText({
|
|
3681
|
+
defaults: WALLET_LIST_TEXT,
|
|
3682
|
+
slot: "dyn-wallet-list"
|
|
3683
|
+
});
|
|
3684
|
+
const [searchText, setSearchText] = (0, react.useState)("");
|
|
3685
|
+
const { data: walletOptions, isError, isPending, isPlaceholderData } = (0, _dynamic_labs_sdk_react_hooks.useGetWalletOptionsCatalogue)({ includeMobileOptions: true });
|
|
3686
|
+
const items = (walletOptions ?? []).map((option) => ({
|
|
3687
|
+
badge: (0, _dynamic_labs_sdk_client.isWalletExtensionInstalled)({ walletOption: option }) ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Badge, { children: text("installed") }) : void 0,
|
|
3688
|
+
icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ProviderIcon, {
|
|
3689
|
+
name: option.name,
|
|
3690
|
+
url: option.iconUrl
|
|
3691
|
+
}),
|
|
3692
|
+
id: option.key,
|
|
3693
|
+
name: option.name,
|
|
3694
|
+
onClick: () => onSelectWalletOption(option)
|
|
3695
|
+
}));
|
|
3696
|
+
const isLoading = isPending || isPlaceholderData && items.length === 0;
|
|
3697
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ProviderList, {
|
|
3698
|
+
className,
|
|
3699
|
+
defaultVisibleCount: DEFAULT_VISIBLE_COUNT,
|
|
3700
|
+
emptyText: isError ? text("error") : text("empty"),
|
|
3701
|
+
isLoading,
|
|
3702
|
+
items,
|
|
3703
|
+
onSearchTextChange: setSearchText,
|
|
3704
|
+
remainingNoun: text("remainingNoun"),
|
|
3705
|
+
searchPlaceholder: text("searchPlaceholder"),
|
|
3706
|
+
searchText
|
|
3707
|
+
});
|
|
3708
|
+
};
|
|
3709
|
+
|
|
3710
|
+
//#endregion
|
|
3711
|
+
//#region src/widgets/ConnectWalletOptionWidget/routes/listRoute/ListRouteView.tsx
|
|
3712
|
+
/**
|
|
3713
|
+
* The wallet-list screen of {@link ConnectWalletOptionWidget}: the catalogue
|
|
3714
|
+
* the flow opens on.
|
|
3715
|
+
*
|
|
3716
|
+
* @example
|
|
3717
|
+
* ```tsx
|
|
3718
|
+
* const view = <ListRouteView onSelectWalletOption={onSelectWalletOption} />;
|
|
3719
|
+
* ```
|
|
3720
|
+
* @param params.onSelectWalletOption - Picks a wallet; shows the chain picker or starts the connection.
|
|
3721
|
+
* @returns The wallet-list screen.
|
|
3722
|
+
* @see listRoute
|
|
3723
|
+
* @see ConnectWalletOptionWidget
|
|
3724
|
+
* @see WalletList
|
|
3725
|
+
* @copy listTitle - Header title for the wallet-list route.
|
|
3726
|
+
* @notInstrumented
|
|
3727
|
+
*/
|
|
3728
|
+
const ListRouteView = ({ onSelectWalletOption }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(WalletList, { onSelectWalletOption });
|
|
3729
|
+
|
|
3730
|
+
//#endregion
|
|
3731
|
+
//#region src/widgets/ConnectWalletOptionWidget/routes/listRoute/listRoute.tsx
|
|
3732
|
+
/**
|
|
3733
|
+
* The wallet-list route of {@link ConnectWalletOptionWidget}: the screen the
|
|
3734
|
+
* flow opens on and the back target in-flight routes return to — its
|
|
3735
|
+
* `retainInHistory` flag is what lets routes leaving it push onto the stack.
|
|
3736
|
+
*
|
|
3737
|
+
* @see ConnectWalletRouteModule
|
|
3738
|
+
* @see connectWalletRoutes
|
|
3739
|
+
* @see ListRouteView
|
|
3740
|
+
*/
|
|
3741
|
+
const listRoute = {
|
|
3742
|
+
getTitle: ({ text }) => text("listTitle"),
|
|
3743
|
+
render: ({ widget }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ListRouteView, { onSelectWalletOption: widget.selectWalletOption }),
|
|
3744
|
+
retainInHistory: true
|
|
3745
|
+
};
|
|
3746
|
+
|
|
3747
|
+
//#endregion
|
|
3748
|
+
//#region src/views/WalletConnectQrCode/WalletConnectQrCode.text.ts
|
|
3749
|
+
/**
|
|
3750
|
+
* Default text for {@link WalletConnectQrCode}.
|
|
3751
|
+
*/
|
|
3752
|
+
const WALLET_CONNECT_QR_CODE_TEXT = {
|
|
3753
|
+
copyUriLabel: "Copy QR URI",
|
|
3754
|
+
helper: "Scan this QR code from your mobile wallet or phone’s camera to connect.",
|
|
3755
|
+
qrCodeLabel: "QR code for {wallet}",
|
|
3756
|
+
title: "Scan with {wallet}"
|
|
3757
|
+
};
|
|
3758
|
+
/**
|
|
3759
|
+
* Placeholder token in {@link WALLET_CONNECT_QR_CODE_TEXT} replaced with the
|
|
3760
|
+
* wallet's display name at render.
|
|
3761
|
+
*/
|
|
3762
|
+
const WALLET_CONNECT_QR_CODE_WALLET_TOKEN = "{wallet}";
|
|
3763
|
+
|
|
3764
|
+
//#endregion
|
|
3765
|
+
//#region src/views/WalletConnectQrCode/WalletConnectQrCode.tsx
|
|
3766
|
+
/**
|
|
3767
|
+
* The pairing-URI scan step: a scannable QR code with the wallet's mark at its
|
|
3768
|
+
* center, a button to copy the raw URI as a fallback for customers who can't
|
|
3769
|
+
* scan, and a line telling them how to scan it. The wallet name and Back live
|
|
3770
|
+
* in the panel header, not here.
|
|
3771
|
+
*
|
|
3772
|
+
* @example
|
|
3773
|
+
* ```tsx
|
|
3774
|
+
* import { WalletConnectQrCode } from '@/views/WalletConnectQrCode/WalletConnectQrCode';
|
|
3775
|
+
*
|
|
3776
|
+
* const App = () => <WalletConnectQrCode uri="wc:pair" walletName="MetaMask" />;
|
|
3777
|
+
* ```
|
|
3778
|
+
* @param params.className - Extra class names for the root element.
|
|
3779
|
+
* @param params.uri - The pairing URI, encoded and offered to copy.
|
|
3780
|
+
* @param params.walletIconUrl - The wallet's icon URL.
|
|
3781
|
+
* @param params.walletName - The wallet's display name.
|
|
3782
|
+
* @returns The QR scan screen.
|
|
3783
|
+
* @see WalletConnectQrCodeProps
|
|
3784
|
+
* @see QRCode
|
|
3785
|
+
* @see useConnectWalletOption
|
|
3786
|
+
* @see WalletList
|
|
3787
|
+
* @see ConnectWalletOptionWidget
|
|
3788
|
+
* @copy copyUriLabel - Label of the copy-to-clipboard button under the QR code.
|
|
3789
|
+
* @copy helper - Helper line under the QR code telling the customer how to scan.
|
|
3790
|
+
* @copy qrCodeLabel - Accessible name for the QR graphic; custom text may include `{wallet}`, replaced by the wallet's display name.
|
|
3791
|
+
* @copy title - Announced heading for the QR scan step; custom text may include `{wallet}`, replaced by the wallet's display name.
|
|
3792
|
+
* @notInstrumented
|
|
3793
|
+
*/
|
|
3794
|
+
const WalletConnectQrCode = ({ className, uri, walletIconUrl, walletName }) => {
|
|
3795
|
+
const text = useText({
|
|
3796
|
+
defaults: WALLET_CONNECT_QR_CODE_TEXT,
|
|
3797
|
+
slot: "dyn-wallet-connect-qr-code"
|
|
3798
|
+
});
|
|
3799
|
+
const withWallet = (value) => interpolateText({
|
|
3800
|
+
template: value,
|
|
3801
|
+
token: WALLET_CONNECT_QR_CODE_WALLET_TOKEN,
|
|
3802
|
+
value: walletName
|
|
3803
|
+
});
|
|
3804
|
+
const announcedTitle = withWallet(text("title"));
|
|
3805
|
+
const codeLabel = withWallet(text("qrCodeLabel"));
|
|
3806
|
+
const helper = text("helper");
|
|
3807
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
3808
|
+
className,
|
|
3809
|
+
"data-slot": "dyn-wallet-connect-qr-code",
|
|
3810
|
+
children: [
|
|
3811
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
3812
|
+
"aria-live": "polite",
|
|
3813
|
+
"data-slot": "dyn-wallet-connect-qr-code-announce",
|
|
3814
|
+
role: "status",
|
|
3815
|
+
children: `${announcedTitle}. ${helper}`
|
|
3816
|
+
}),
|
|
3817
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
3818
|
+
"data-slot": "dyn-wallet-connect-qr-code-code",
|
|
3819
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(QRCode, {
|
|
3820
|
+
label: codeLabel,
|
|
3821
|
+
logoSrc: walletIconUrl,
|
|
3822
|
+
value: uri
|
|
3823
|
+
})
|
|
3824
|
+
}),
|
|
3825
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
3826
|
+
"data-slot": "dyn-wallet-connect-qr-code-helper",
|
|
3827
|
+
children: helper
|
|
3828
|
+
}),
|
|
3829
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(CopyButton, {
|
|
3830
|
+
value: uri,
|
|
3831
|
+
children: text("copyUriLabel")
|
|
3832
|
+
})
|
|
3833
|
+
]
|
|
3834
|
+
});
|
|
3835
|
+
};
|
|
3836
|
+
|
|
3837
|
+
//#endregion
|
|
3838
|
+
//#region src/widgets/ConnectWalletOptionWidget/routes/qrCodeRoute/QrCodeRouteView.tsx
|
|
3839
|
+
/**
|
|
3840
|
+
* The pairing-QR screen of {@link ConnectWalletOptionWidget}: the code scan
|
|
3841
|
+
* for connections that resolve to a URI.
|
|
3842
|
+
*
|
|
3843
|
+
* @example
|
|
3844
|
+
* ```tsx
|
|
3845
|
+
* const view = <QrCodeRouteView uri={uri} walletOption={walletOption} />;
|
|
3846
|
+
* ```
|
|
3847
|
+
* @param params.uri - The pairing URI the code encodes.
|
|
3848
|
+
* @param params.walletOption - The wallet being paired.
|
|
3849
|
+
* @returns The pairing-QR screen.
|
|
3850
|
+
* @see qrCodeRoute
|
|
3851
|
+
* @see ConnectWalletOptionWidget
|
|
3852
|
+
* @see WalletConnectQrCode
|
|
3853
|
+
* @copy qrCodeTitle - Header title for the pairing-QR route; custom text may include `{wallet}`, replaced by the wallet's display name.
|
|
3854
|
+
* @notInstrumented
|
|
3855
|
+
*/
|
|
3856
|
+
const QrCodeRouteView = ({ uri, walletOption }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(WalletConnectQrCode, {
|
|
3857
|
+
uri,
|
|
3858
|
+
walletIconUrl: walletOption.iconUrl,
|
|
3859
|
+
walletName: walletOption.name
|
|
3860
|
+
});
|
|
3861
|
+
|
|
3862
|
+
//#endregion
|
|
3863
|
+
//#region src/widgets/ConnectWalletOptionWidget/routes/qrCodeRoute/qrCodeRoute.tsx
|
|
3864
|
+
/**
|
|
3865
|
+
* The QR route of {@link ConnectWalletOptionWidget}: the pairing-code scan for
|
|
3866
|
+
* connections that resolve to a URI. Transient — it shares the in-flight
|
|
3867
|
+
* attempt's stack slot.
|
|
3868
|
+
*
|
|
3869
|
+
* @see ConnectWalletRouteModule
|
|
3870
|
+
* @see connectWalletRoutes
|
|
3871
|
+
* @see QrCodeRouteView
|
|
3872
|
+
*/
|
|
3873
|
+
const qrCodeRoute = {
|
|
3874
|
+
getTitle: ({ route, text }) => interpolateText({
|
|
3875
|
+
template: text("qrCodeTitle"),
|
|
3876
|
+
token: CONNECT_WALLET_WIDGET_WALLET_TOKEN,
|
|
3877
|
+
value: route.params.walletOption.name
|
|
3878
|
+
}),
|
|
3879
|
+
render: ({ route }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(QrCodeRouteView, {
|
|
3880
|
+
uri: route.params.uri,
|
|
3881
|
+
walletOption: route.params.walletOption
|
|
3882
|
+
})
|
|
3883
|
+
};
|
|
3884
|
+
|
|
3885
|
+
//#endregion
|
|
3886
|
+
//#region src/widgets/ConnectWalletOptionWidget/routes/redirectingRoute/RedirectingRouteView.tsx
|
|
3887
|
+
/**
|
|
3888
|
+
* The redirecting screen of {@link ConnectWalletOptionWidget}: shown while the
|
|
3889
|
+
* page reloads into the wallet's own in-app browser — the only place a
|
|
3890
|
+
* browser-only wallet can connect. Shares the connecting screen's title.
|
|
3891
|
+
*
|
|
3892
|
+
* @example
|
|
3893
|
+
* ```tsx
|
|
3894
|
+
* const view = <RedirectingRouteView text={text} walletOption={walletOption} />;
|
|
3895
|
+
* ```
|
|
3896
|
+
* @param params.text - The view's text lookup for copy keys.
|
|
3897
|
+
* @param params.walletOption - The wallet being connected.
|
|
3898
|
+
* @returns The redirecting screen.
|
|
3899
|
+
* @see redirectingRoute
|
|
3900
|
+
* @see ConnectWalletOptionWidget
|
|
3901
|
+
* @see WalletConnectionStatus
|
|
3902
|
+
* @copy redirectingStatusMessage - Lead line while the app reloads into the wallet's in-app browser; custom text may include `{wallet}`, replaced by the wallet's display name.
|
|
3903
|
+
* @copy redirectingStatusSecondaryMessage - Secondary line under the redirecting status warning that nothing may happen when the wallet app is not installed.
|
|
3904
|
+
* @notInstrumented
|
|
3905
|
+
*/
|
|
3906
|
+
const RedirectingRouteView = ({ text, walletOption }) => {
|
|
3907
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(WalletConnectionStatus, {
|
|
3908
|
+
indicator: "pending",
|
|
3909
|
+
message: interpolateText({
|
|
3910
|
+
template: text("redirectingStatusMessage"),
|
|
3911
|
+
token: CONNECT_WALLET_WIDGET_WALLET_TOKEN,
|
|
3912
|
+
value: walletOption.name
|
|
3913
|
+
}),
|
|
3914
|
+
secondaryMessage: text("redirectingStatusSecondaryMessage"),
|
|
3915
|
+
wallet: walletOption
|
|
3916
|
+
});
|
|
3917
|
+
};
|
|
3918
|
+
|
|
3919
|
+
//#endregion
|
|
3920
|
+
//#region src/widgets/ConnectWalletOptionWidget/routes/redirectingRoute/redirectingRoute.tsx
|
|
3921
|
+
/**
|
|
3922
|
+
* The redirecting route of {@link ConnectWalletOptionWidget}: shown while the
|
|
3923
|
+
* page reloads into the wallet's own in-app browser — the only place a
|
|
3924
|
+
* browser-only wallet can connect. Shares the connecting screen's title and
|
|
3925
|
+
* the in-flight attempt's stack slot.
|
|
3926
|
+
*
|
|
3927
|
+
* @see ConnectWalletRouteModule
|
|
3928
|
+
* @see connectWalletRoutes
|
|
3929
|
+
* @see RedirectingRouteView
|
|
3930
|
+
*/
|
|
3931
|
+
const redirectingRoute = {
|
|
3932
|
+
getTitle: ({ route, text }) => interpolateText({
|
|
3933
|
+
template: text("connectingTitle"),
|
|
3934
|
+
token: CONNECT_WALLET_WIDGET_WALLET_TOKEN,
|
|
3935
|
+
value: route.params.walletOption.name
|
|
3936
|
+
}),
|
|
3937
|
+
render: ({ route, text }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(RedirectingRouteView, {
|
|
3938
|
+
text,
|
|
3939
|
+
walletOption: route.params.walletOption
|
|
3940
|
+
})
|
|
3941
|
+
};
|
|
3942
|
+
|
|
3943
|
+
//#endregion
|
|
3944
|
+
//#region src/widgets/ConnectWalletOptionWidget/routes/connectWalletRoutes.ts
|
|
3945
|
+
/**
|
|
3946
|
+
* The route table behind {@link ConnectWalletOptionWidget}: every screen of the
|
|
3947
|
+
* wallet connection as a route module that owns its rendering and history
|
|
3948
|
+
* behavior. A route missing here, or a module filed under another route's
|
|
3949
|
+
* name, fails type checking — adding or dropping a screen is a single module.
|
|
3950
|
+
*
|
|
3951
|
+
* @see ConnectWalletRouteModule
|
|
3952
|
+
* @see renderConnectWalletRoute
|
|
3953
|
+
*/
|
|
3954
|
+
const connectWalletRoutes = {
|
|
3955
|
+
"chain-picker": chainPickerRoute,
|
|
3956
|
+
connected: connectedRoute,
|
|
3957
|
+
connecting: connectingRoute,
|
|
3958
|
+
error: errorRoute,
|
|
3959
|
+
list: listRoute,
|
|
3960
|
+
"qr-code": qrCodeRoute,
|
|
3961
|
+
redirecting: redirectingRoute
|
|
3962
|
+
};
|
|
3963
|
+
|
|
3964
|
+
//#endregion
|
|
3965
|
+
//#region src/widgets/ConnectWalletOptionWidget/getConnectWalletRouteTitle/getConnectWalletRouteTitle.ts
|
|
3966
|
+
/**
|
|
3967
|
+
* Resolves the header title for a route through its route module. The generic
|
|
3968
|
+
* route name ties the route to its own module, so the lookup needs no cast.
|
|
3969
|
+
*
|
|
3970
|
+
* @example
|
|
3971
|
+
* ```tsx
|
|
3972
|
+
* const title = getConnectWalletRouteTitle({ route: widget.currentRoute, text });
|
|
3973
|
+
* ```
|
|
3974
|
+
* @param params.route - The route entry the title describes.
|
|
3975
|
+
* @param params.text - The text lookup for copy keys.
|
|
3976
|
+
* @returns The route's title.
|
|
3977
|
+
* @see connectWalletRoutes
|
|
3978
|
+
* @see renderConnectWalletRoute
|
|
3979
|
+
* @notInstrumented
|
|
3980
|
+
*/
|
|
3981
|
+
const getConnectWalletRouteTitle = ({ route, text }) => connectWalletRoutes[route.name].getTitle({
|
|
3982
|
+
route,
|
|
3983
|
+
text
|
|
3984
|
+
});
|
|
3985
|
+
|
|
3986
|
+
//#endregion
|
|
3987
|
+
//#region src/widgets/ConnectWalletOptionWidget/renderConnectWalletRoute/renderConnectWalletRoute.ts
|
|
3988
|
+
/**
|
|
3989
|
+
* Renders the wallet connection screen for a route through its route module.
|
|
3990
|
+
* The generic route name ties the route to its own module, so the lookup
|
|
3991
|
+
* needs no cast.
|
|
3992
|
+
*
|
|
3993
|
+
* @example
|
|
3994
|
+
* ```tsx
|
|
3995
|
+
* renderConnectWalletRoute({ route: widget.currentRoute, text, widget });
|
|
3996
|
+
* ```
|
|
3997
|
+
* @param params.route - The route entry to render.
|
|
3998
|
+
* @param params.text - The text lookup for copy keys.
|
|
3999
|
+
* @param params.widget - The widget's latest state and actions.
|
|
4000
|
+
* @returns The route's screen.
|
|
4001
|
+
* @see connectWalletRoutes
|
|
4002
|
+
* @see ConnectWalletRouteModule
|
|
4003
|
+
* @notInstrumented
|
|
4004
|
+
*/
|
|
4005
|
+
const renderConnectWalletRoute = ({ route, text, widget }) => connectWalletRoutes[route.name].render({
|
|
4006
|
+
route,
|
|
4007
|
+
text,
|
|
4008
|
+
widget
|
|
4009
|
+
});
|
|
4010
|
+
|
|
4011
|
+
//#endregion
|
|
4012
|
+
//#region src/utils/hooks/useViewRouter/useViewRouter.ts
|
|
4013
|
+
/**
|
|
4014
|
+
* A minimal screen router: a stack of route entries, each a `{ name, params }`
|
|
4015
|
+
* pair typed by the caller's discriminated union. `navigate` pushes forward
|
|
4016
|
+
* from a retained route and replaces one that is not, so transient
|
|
4017
|
+
* screens occupy one stack slot and Back lands on the last retained route. `push`,
|
|
4018
|
+
* `replace`, `pop`, and `reset` remain for callers that want explicit moves.
|
|
4019
|
+
*
|
|
4020
|
+
* @example
|
|
4021
|
+
* ```tsx
|
|
4022
|
+
* const router = useViewRouter<AppRoute>({
|
|
4023
|
+
* initial: { name: 'home' },
|
|
4024
|
+
* routes: appRoutes,
|
|
4025
|
+
* });
|
|
4026
|
+
* router.navigate({ name: 'details', params: { id: '42' } });
|
|
4027
|
+
* ```
|
|
4028
|
+
* @param params.initial - Captured on mount as the starting route and reset target; later changes are ignored.
|
|
4029
|
+
* @param params.initialStack - Instead of `initial`: the starting stack, oldest first, its last entry shown.
|
|
4030
|
+
* @param params.routes - The route table `navigate` reads `retainInHistory` flags from.
|
|
4031
|
+
* @returns The stack, its top entry, and the moves that change it.
|
|
4032
|
+
* @see UseViewRouterParams
|
|
4033
|
+
* @see UseViewRouterResult
|
|
4034
|
+
* @see ViewRouteDescriptor
|
|
4035
|
+
* @notInstrumented
|
|
4036
|
+
*/
|
|
4037
|
+
const useViewRouter = (params) => {
|
|
4038
|
+
const { routes } = params;
|
|
4039
|
+
const initialStackRef = (0, react.useRef)([...params.initialStack ?? [params.initial]]);
|
|
4040
|
+
const [stack, setStack] = (0, react.useState)(initialStackRef.current);
|
|
4041
|
+
const push = (0, react.useCallback)((route) => {
|
|
4042
|
+
setStack((entries) => [...entries, route]);
|
|
4043
|
+
}, []);
|
|
4044
|
+
const replace = (0, react.useCallback)((route) => {
|
|
4045
|
+
setStack((entries) => [...entries.slice(0, -1), route]);
|
|
4046
|
+
}, []);
|
|
4047
|
+
const pop = (0, react.useCallback)(() => {
|
|
4048
|
+
setStack((entries) => entries.length > 1 ? entries.slice(0, -1) : entries);
|
|
4049
|
+
}, []);
|
|
4050
|
+
const isRetainedInHistory = (0, react.useCallback)((route) => routes === void 0 ? true : routes[route.name]?.retainInHistory === true, [routes]);
|
|
4051
|
+
const navigate = (0, react.useCallback)((route) => {
|
|
4052
|
+
setStack((entries) => {
|
|
4053
|
+
const current = entries[entries.length - 1];
|
|
4054
|
+
if (isRetainedInHistory(current)) return [...entries, route];
|
|
4055
|
+
return [...entries.slice(0, -1), route];
|
|
4056
|
+
});
|
|
4057
|
+
}, [isRetainedInHistory]);
|
|
4058
|
+
const reset = (0, react.useCallback)(() => {
|
|
4059
|
+
setStack(initialStackRef.current);
|
|
4060
|
+
}, []);
|
|
4061
|
+
return {
|
|
4062
|
+
canPop: stack.length > 1,
|
|
4063
|
+
current: stack[stack.length - 1],
|
|
4064
|
+
navigate,
|
|
4065
|
+
pop,
|
|
4066
|
+
push,
|
|
4067
|
+
replace,
|
|
4068
|
+
reset,
|
|
4069
|
+
stack: [...stack]
|
|
4070
|
+
};
|
|
4071
|
+
};
|
|
4072
|
+
|
|
4073
|
+
//#endregion
|
|
4074
|
+
//#region src/widgets/ConnectWalletOptionWidget/useConnectWalletOptionWidget/useConnectWalletOptionWidget.ts
|
|
4075
|
+
/**
|
|
4076
|
+
* The state machine behind {@link ConnectWalletOptionWidget}: a stack of typed
|
|
4077
|
+
* route entries driven by `useConnectWalletOption` across the wallet pick,
|
|
4078
|
+
* optional chain pick, wallet-side wait, and URI-pairing scan.
|
|
4079
|
+
*
|
|
4080
|
+
* Each connection attempt is stamped with a generation so a settle arriving
|
|
4081
|
+
* after the customer went back — an abandoned approval, or a stale pairing
|
|
4082
|
+
* URI — is ignored rather than reviving a route they left.
|
|
4083
|
+
*
|
|
4084
|
+
* @example
|
|
4085
|
+
* ```tsx
|
|
4086
|
+
* const { currentRoute, selectWalletOption, tryAgain } = useConnectWalletOptionWidget({
|
|
4087
|
+
* onConnected: ({ walletAccount }) => console.log(walletAccount.address),
|
|
4088
|
+
* });
|
|
4089
|
+
* ```
|
|
4090
|
+
* @param params.onBack - Leaves the widget from its first screen.
|
|
4091
|
+
* @param params.onConnected - Fires with the connected account on success, and a way to start over.
|
|
4092
|
+
* @param params.onSelectWalletOption - Fires when the customer picks a wallet from the list.
|
|
4093
|
+
* @returns The current route and the actions that advance it.
|
|
4094
|
+
* @see UseConnectWalletOptionWidgetParams
|
|
4095
|
+
* @see UseConnectWalletOptionWidgetResult
|
|
4096
|
+
* @notInstrumented
|
|
4097
|
+
*/
|
|
4098
|
+
const useConnectWalletOptionWidget = ({ onBack, onConnected, onSelectWalletOption } = {}) => {
|
|
4099
|
+
const client = (0, _dynamic_labs_sdk_react_hooks.useDynamicClient)();
|
|
4100
|
+
const { mutate: connectWalletOption } = (0, _dynamic_labs_sdk_react_hooks.useConnectWalletOption)();
|
|
4101
|
+
const { mutate: redirectToInAppBrowser } = (0, _dynamic_labs_sdk_react_hooks.useRedirectToInAppBrowser)();
|
|
4102
|
+
const { data: walletOptionsCatalogue } = (0, _dynamic_labs_sdk_react_hooks.useGetWalletOptionsCatalogue)({ includeMobileOptions: true });
|
|
4103
|
+
const router = useViewRouter({
|
|
4104
|
+
initial: { name: "list" },
|
|
4105
|
+
routes: connectWalletRoutes
|
|
4106
|
+
});
|
|
4107
|
+
const generationRef = (0, react.useRef)(0);
|
|
4108
|
+
const selectedChainRef = (0, react.useRef)(void 0);
|
|
4109
|
+
const connectedAccountRef = (0, react.useRef)(void 0);
|
|
4110
|
+
const startConnection = ({ chain, walletOption }) => {
|
|
4111
|
+
const generation = generationRef.current + 1;
|
|
4112
|
+
generationRef.current = generation;
|
|
4113
|
+
selectedChainRef.current = chain;
|
|
4114
|
+
router.navigate({
|
|
4115
|
+
name: "connecting",
|
|
4116
|
+
params: { walletOption }
|
|
4117
|
+
});
|
|
4118
|
+
const handleWalletBrowserRedirect = ({ chain: redirectChain, walletKey }) => {
|
|
4119
|
+
if (generationRef.current !== generation) return;
|
|
4120
|
+
router.navigate({
|
|
4121
|
+
name: "redirecting",
|
|
4122
|
+
params: { walletOption }
|
|
4123
|
+
});
|
|
4124
|
+
redirectToInAppBrowser({
|
|
4125
|
+
appUrl: globalThis.location?.href ?? "",
|
|
4126
|
+
chain: redirectChain,
|
|
4127
|
+
walletKey,
|
|
4128
|
+
walletOptionsCatalogue
|
|
4129
|
+
}, { onError: () => {
|
|
4130
|
+
if (generationRef.current !== generation) return;
|
|
4131
|
+
router.navigate({
|
|
4132
|
+
name: "error",
|
|
4133
|
+
params: { walletOption }
|
|
4134
|
+
});
|
|
4135
|
+
} });
|
|
4136
|
+
};
|
|
4137
|
+
const onConnectionUri = ({ uri }) => {
|
|
4138
|
+
if (generationRef.current !== generation) return;
|
|
4139
|
+
if ((0, _dynamic_labs_sdk_client.isMobile)()) {
|
|
4140
|
+
(0, _dynamic_labs_sdk_client_core.getCore)(client).openDeeplink(uri).catch(() => {
|
|
4141
|
+
if (generationRef.current !== generation) return;
|
|
4142
|
+
router.navigate({
|
|
4143
|
+
name: "error",
|
|
4144
|
+
params: { walletOption }
|
|
4145
|
+
});
|
|
4146
|
+
});
|
|
4147
|
+
return;
|
|
4148
|
+
}
|
|
4149
|
+
router.navigate({
|
|
4150
|
+
name: "qr-code",
|
|
4151
|
+
params: {
|
|
4152
|
+
uri,
|
|
4153
|
+
walletOption
|
|
4154
|
+
}
|
|
4155
|
+
});
|
|
4156
|
+
};
|
|
4157
|
+
const onConnectionError = () => {
|
|
4158
|
+
if (generationRef.current !== generation) return;
|
|
4159
|
+
router.navigate({
|
|
4160
|
+
name: "error",
|
|
4161
|
+
params: { walletOption }
|
|
4162
|
+
});
|
|
4163
|
+
};
|
|
4164
|
+
const onConnectionSuccess = (walletAccount) => {
|
|
4165
|
+
if (generationRef.current !== generation) {
|
|
4166
|
+
if (!(connectedAccountRef.current !== void 0 && connectedAccountRef.current.id === walletAccount.id)) (0, _dynamic_labs_sdk_client_core.removeUnverifiedWalletAccount)({ unverifiedWalletAccount: walletAccount }, client);
|
|
4167
|
+
return;
|
|
4168
|
+
}
|
|
4169
|
+
connectedAccountRef.current = walletAccount;
|
|
4170
|
+
router.navigate({
|
|
4171
|
+
name: "connected",
|
|
4172
|
+
params: { walletOption }
|
|
4173
|
+
});
|
|
4174
|
+
const startOver = () => {
|
|
4175
|
+
if (generationRef.current !== generation) return;
|
|
4176
|
+
generationRef.current += 1;
|
|
4177
|
+
router.reset();
|
|
4178
|
+
};
|
|
4179
|
+
onConnected?.({
|
|
4180
|
+
startOver,
|
|
4181
|
+
walletAccount
|
|
4182
|
+
});
|
|
4183
|
+
};
|
|
4184
|
+
connectWalletOption({
|
|
4185
|
+
chain,
|
|
4186
|
+
handleWalletBrowserRedirect,
|
|
4187
|
+
onConnectionUri,
|
|
4188
|
+
walletKey: walletOption.key,
|
|
4189
|
+
walletOptionsCatalogue
|
|
4190
|
+
}, {
|
|
4191
|
+
onError: onConnectionError,
|
|
4192
|
+
onSuccess: onConnectionSuccess
|
|
4193
|
+
});
|
|
4194
|
+
};
|
|
4195
|
+
const selectWalletOption = (walletOption) => {
|
|
4196
|
+
onSelectWalletOption?.(walletOption);
|
|
4197
|
+
if (walletOption.connectionOptions.length === 0) {
|
|
4198
|
+
const installationUrl = walletOption.installationUrls === void 0 ? void 0 : (0, _dynamic_labs_sdk_client.getInstallationLinkForCurrentPlatform)({ installationUrls: walletOption.installationUrls });
|
|
4199
|
+
try {
|
|
4200
|
+
(0, _dynamic_labs_sdk_client_core.assertSafeNavigationUrl)(installationUrl ?? "");
|
|
4201
|
+
globalThis.open?.(installationUrl, "_blank", "noopener,noreferrer");
|
|
4202
|
+
} catch {}
|
|
4203
|
+
return;
|
|
4204
|
+
}
|
|
4205
|
+
if (walletOption.supportedChains.length > 1) {
|
|
4206
|
+
router.navigate({
|
|
4207
|
+
name: "chain-picker",
|
|
4208
|
+
params: { walletOption }
|
|
4209
|
+
});
|
|
4210
|
+
return;
|
|
4211
|
+
}
|
|
4212
|
+
startConnection({
|
|
4213
|
+
chain: walletOption.supportedChains[0],
|
|
4214
|
+
walletOption
|
|
4215
|
+
});
|
|
4216
|
+
};
|
|
4217
|
+
const selectChain = ({ chain }) => {
|
|
4218
|
+
const walletOption = router.current.params?.walletOption;
|
|
4219
|
+
if (walletOption === void 0) return;
|
|
4220
|
+
startConnection({
|
|
4221
|
+
chain,
|
|
4222
|
+
walletOption
|
|
4223
|
+
});
|
|
4224
|
+
};
|
|
4225
|
+
const tryAgain = () => {
|
|
4226
|
+
const walletOption = router.current.params?.walletOption;
|
|
4227
|
+
if (walletOption === void 0) return;
|
|
4228
|
+
startConnection({
|
|
4229
|
+
chain: selectedChainRef.current,
|
|
4230
|
+
walletOption
|
|
4231
|
+
});
|
|
4232
|
+
};
|
|
4233
|
+
const isTerminalRoute = connectWalletRoutes[router.current.name].terminal === true;
|
|
4234
|
+
const goBack = (0, react.useMemo)(() => {
|
|
4235
|
+
if (isTerminalRoute) return;
|
|
4236
|
+
if (!router.canPop) return onBack;
|
|
4237
|
+
return () => {
|
|
4238
|
+
generationRef.current += 1;
|
|
4239
|
+
router.pop();
|
|
4240
|
+
};
|
|
4241
|
+
}, [
|
|
4242
|
+
isTerminalRoute,
|
|
4243
|
+
onBack,
|
|
4244
|
+
router.canPop,
|
|
4245
|
+
router.pop
|
|
4246
|
+
]);
|
|
4247
|
+
return {
|
|
4248
|
+
currentRoute: router.current,
|
|
4249
|
+
goBack,
|
|
4250
|
+
selectChain,
|
|
4251
|
+
selectWalletOption,
|
|
4252
|
+
tryAgain
|
|
4253
|
+
};
|
|
4254
|
+
};
|
|
4255
|
+
|
|
4256
|
+
//#endregion
|
|
4257
|
+
//#region src/widgets/ConnectWalletOptionWidget/ConnectWalletOptionWidget.tsx
|
|
4258
|
+
/**
|
|
4259
|
+
* The wallet connection orchestrator: walks the customer through picking a
|
|
4260
|
+
* wallet from {@link WalletList}, picking a chain on {@link WalletChainList}
|
|
4261
|
+
* when the wallet offers more than one, waiting on the wallet's approval,
|
|
4262
|
+
* and scanning a pairing code on {@link WalletConnectQrCode} when the
|
|
4263
|
+
* connection resolves to a URI pairing. Connects through
|
|
4264
|
+
* `useConnectWalletOption` and reports the connected account through
|
|
4265
|
+
* `onConnected`.
|
|
4266
|
+
*
|
|
4267
|
+
* Every screen renders inside a {@link Panel} whose header shows the current
|
|
4268
|
+
* route's title and Back. The panel stays mounted across route transitions,
|
|
4269
|
+
* so `children` placed above the screen keep their state. Rendered inside
|
|
4270
|
+
* another widget, it shares that widget's card.
|
|
4271
|
+
*
|
|
4272
|
+
* @example
|
|
4273
|
+
* ```tsx
|
|
4274
|
+
* import { ConnectWalletOptionWidget } from '@/widgets/ConnectWalletOptionWidget/ConnectWalletOptionWidget';
|
|
4275
|
+
*
|
|
4276
|
+
* const App = () => (
|
|
4277
|
+
* <ConnectWalletOptionWidget
|
|
4278
|
+
* onConnected={({ walletAccount }) => console.log(walletAccount.address)}
|
|
4279
|
+
* />
|
|
4280
|
+
* );
|
|
4281
|
+
* ```
|
|
4282
|
+
* @param params.children - Content shown at the top of the panel body, above every screen.
|
|
4283
|
+
* @param params.className - Extra class names for the root element.
|
|
4284
|
+
* @param params.onBack - Leaves the widget from its first screen.
|
|
4285
|
+
* @param params.onConnected - Fires with the connected account on success, and a way to start over.
|
|
4286
|
+
* @param params.onSelectWalletOption - Fires when the customer picks a wallet from the list.
|
|
4287
|
+
* @returns The wallet connection orchestration.
|
|
4288
|
+
* @see ConnectWalletOptionWidgetProps
|
|
4289
|
+
* @see Panel
|
|
4290
|
+
* @see PanelHost
|
|
4291
|
+
* @see WalletList
|
|
4292
|
+
* @see WalletChainList
|
|
4293
|
+
* @see WalletConnectionStatus
|
|
4294
|
+
* @see WalletConnectQrCode
|
|
4295
|
+
* @see useGetWalletOptionsCatalogue
|
|
4296
|
+
* @see useConnectWalletOption
|
|
4297
|
+
* @copy listTitle - Header title for the wallet-list route.
|
|
4298
|
+
* @copy chainPickerTitle - Header title for the chain-picker route.
|
|
4299
|
+
* @copy connectingTitle - Header title while the wallet holds the approval or the app redirects into its in-app browser; custom text may include `{wallet}`, replaced by the wallet's display name.
|
|
4300
|
+
* @copy connectingStatusMessage - Waiting line while the wallet holds the approval; custom text may include `{wallet}`, replaced by the wallet's display name.
|
|
4301
|
+
* @copy connectedTitle - Header title once the wallet account connects; custom text may include `{wallet}`, replaced by the wallet's display name.
|
|
4302
|
+
* @copy connectedStatusMessage - Confirmation line once the wallet connects; custom text may include `{wallet}`, replaced by the wallet's display name.
|
|
4303
|
+
* @copy errorTitle - Header title when the connection fails or is declined.
|
|
4304
|
+
* @copy errorStatusMessage - Shown when the connection fails or is declined; custom text may include `{wallet}`, replaced by the wallet's display name.
|
|
4305
|
+
* @copy tryAgainLabel - Label of the button that retries a failed connection.
|
|
4306
|
+
* @copy qrCodeTitle - Header title for the pairing-QR route; custom text may include `{wallet}`, replaced by the wallet's display name.
|
|
4307
|
+
* @copy redirectingStatusMessage - Lead line while the app reloads into the wallet's in-app browser; custom text may include `{wallet}`, replaced by the wallet's display name.
|
|
4308
|
+
* @copy redirectingStatusSecondaryMessage - Secondary line under the redirecting status warning that nothing may happen when the wallet app is not installed.
|
|
4309
|
+
* @notInstrumented
|
|
4310
|
+
*/
|
|
4311
|
+
const ConnectWalletOptionWidget = ({ children, className, onBack, onConnected, onSelectWalletOption }) => {
|
|
4312
|
+
const text = useText({
|
|
4313
|
+
defaults: CONNECT_WALLET_WIDGET_TEXT,
|
|
4314
|
+
slot: "dyn-connect-wallet-option-widget"
|
|
4315
|
+
});
|
|
4316
|
+
const widget = useConnectWalletOptionWidget({
|
|
4317
|
+
onBack,
|
|
4318
|
+
onConnected,
|
|
4319
|
+
onSelectWalletOption
|
|
4320
|
+
});
|
|
4321
|
+
const { currentRoute, goBack } = widget;
|
|
4322
|
+
const title = getConnectWalletRouteTitle({
|
|
4323
|
+
route: currentRoute,
|
|
4324
|
+
text
|
|
4325
|
+
});
|
|
4326
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
4327
|
+
className,
|
|
4328
|
+
"data-slot": "dyn-connect-wallet-option-widget-root",
|
|
4329
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PanelHost, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(Panel, {
|
|
4330
|
+
onBack: goBack,
|
|
4331
|
+
title,
|
|
4332
|
+
children: [children, /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
4333
|
+
"data-slot": "dyn-connect-wallet-option-widget",
|
|
4334
|
+
children: renderConnectWalletRoute({
|
|
4335
|
+
route: currentRoute,
|
|
4336
|
+
text,
|
|
4337
|
+
widget
|
|
4338
|
+
})
|
|
4339
|
+
})]
|
|
4340
|
+
}) })
|
|
4341
|
+
});
|
|
4342
|
+
};
|
|
4343
|
+
|
|
4344
|
+
//#endregion
|
|
4345
|
+
//#region src/views/BalancesList/BalancesList.text.ts
|
|
4346
|
+
/**
|
|
4347
|
+
* Default text for {@link BalancesList}.
|
|
4348
|
+
*/
|
|
4349
|
+
const BALANCES_LIST_TEXT = { empty: "No token balances available" };
|
|
4350
|
+
|
|
4351
|
+
//#endregion
|
|
4352
|
+
//#region src/views/BalancesList/BalancesList.tsx
|
|
4353
|
+
const SKELETON_ROW_COUNT = 3;
|
|
4354
|
+
/**
|
|
4355
|
+
* A list of pickable token holdings, one {@link TokenBalanceOption} per entry.
|
|
4356
|
+
* Renders placeholder rows while `isLoading` and an empty state when
|
|
4357
|
+
* `balances` is empty — the list itself is dumb: fetching, formatting, and
|
|
4358
|
+
* ordering happen above it.
|
|
4359
|
+
*
|
|
4360
|
+
* @example
|
|
4361
|
+
* ```tsx
|
|
4362
|
+
* import { BalancesList } from '@/views/BalancesList/BalancesList';
|
|
4363
|
+
*
|
|
4364
|
+
* const App = () => (
|
|
4365
|
+
* <BalancesList
|
|
4366
|
+
* balances={[{ icon: null, id: 'usdc-base', name: 'USD Coin' }]}
|
|
4367
|
+
* onTokenSelect={(item) => console.log(item.id)}
|
|
4368
|
+
* />
|
|
4369
|
+
* );
|
|
4370
|
+
* ```
|
|
4371
|
+
* @param params.balances - Token holdings to offer, in display order.
|
|
4372
|
+
* @param params.className - Extra class names for the list element.
|
|
4373
|
+
* @param params.emptyText - Message shown when `balances` is empty.
|
|
4374
|
+
* @param params.isLoading - `true` renders placeholder rows instead of `balances`.
|
|
4375
|
+
* @param params.onTokenSelect - Fires with the chosen item when a row is tapped.
|
|
4376
|
+
* @returns The balances list.
|
|
4377
|
+
* @see BalancesListProps
|
|
4378
|
+
* @see TokenBalanceOption
|
|
4379
|
+
* @copy empty - Message shown when `balances` is empty.
|
|
4380
|
+
* @notInstrumented
|
|
4381
|
+
*/
|
|
4382
|
+
const BalancesList = ({ balances, className, emptyText, isLoading = false, onTokenSelect }) => {
|
|
4383
|
+
const text = useText({
|
|
4384
|
+
defaults: BALANCES_LIST_TEXT,
|
|
4385
|
+
slot: "dyn-balances-list"
|
|
4386
|
+
});
|
|
4387
|
+
const resolvedEmptyText = emptyText ?? text("empty");
|
|
4388
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
4389
|
+
className,
|
|
4390
|
+
"data-slot": "dyn-balances-list",
|
|
4391
|
+
children: [
|
|
4392
|
+
isLoading && Array.from({ length: SKELETON_ROW_COUNT }, (_, index) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
4393
|
+
"aria-hidden": "true",
|
|
4394
|
+
"data-slot": "dyn-balances-list-skeleton-row"
|
|
4395
|
+
}, index)),
|
|
4396
|
+
!isLoading && balances.map((item) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TokenBalanceOption, {
|
|
4397
|
+
balance: item.balance,
|
|
4398
|
+
icon: item.icon,
|
|
4399
|
+
id: item.id,
|
|
4400
|
+
name: item.name,
|
|
4401
|
+
onClick: onTokenSelect !== void 0 ? () => onTokenSelect(item) : void 0,
|
|
4402
|
+
value: item.value
|
|
4403
|
+
}, item.id)),
|
|
4404
|
+
!isLoading && balances.length === 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
4405
|
+
"data-slot": "dyn-balances-list-empty",
|
|
4406
|
+
children: resolvedEmptyText
|
|
4407
|
+
})
|
|
4408
|
+
]
|
|
4409
|
+
});
|
|
4410
|
+
};
|
|
4411
|
+
|
|
4412
|
+
//#endregion
|
|
4413
|
+
//#region src/views/WalletAccountBalances/orderBalancesByTokenMarketValueDesc/orderBalancesByTokenMarketValueDesc.ts
|
|
4414
|
+
/**
|
|
4415
|
+
* Orders token balances by each token's fiat market value, descending; tokens
|
|
4416
|
+
* without a `marketValue` sort as zero.
|
|
4417
|
+
*
|
|
4418
|
+
* @example
|
|
4419
|
+
* ```ts
|
|
4420
|
+
* const ordered = orderBalancesByTokenMarketValueDesc({ tokens });
|
|
4421
|
+
* ```
|
|
4422
|
+
* @param params.tokens - The token balances to order.
|
|
4423
|
+
* @returns A new array of the same tokens, highest market value first.
|
|
4424
|
+
* @see OrderBalancesByTokenMarketValueDescParams
|
|
4425
|
+
* @see useWalletAccountBalances
|
|
4426
|
+
* @notInstrumented
|
|
4427
|
+
*/
|
|
4428
|
+
const orderBalancesByTokenMarketValueDesc = ({ tokens }) => [...tokens].sort((a, b) => (b.marketValue ?? 0) - (a.marketValue ?? 0));
|
|
4429
|
+
|
|
4430
|
+
//#endregion
|
|
4431
|
+
//#region src/views/WalletAccountBalances/toTokenBalanceRow/toTokenBalanceRow.ts
|
|
4432
|
+
const USD_FORMATTER = new Intl.NumberFormat("en-US", {
|
|
4433
|
+
currency: "USD",
|
|
4434
|
+
style: "currency"
|
|
4435
|
+
});
|
|
4436
|
+
/**
|
|
4437
|
+
* Maps one API {@link TokenBalance} into a display-ready
|
|
4438
|
+
* {@link WalletAccountTokenBalance}: formatted held amount and fiat value, a
|
|
4439
|
+
* `<networkId>:<token address>` row id, and the badge icons.
|
|
4440
|
+
*
|
|
4441
|
+
* @example
|
|
4442
|
+
* ```ts
|
|
4443
|
+
* const row = toTokenBalanceRow({ networkIcons, token });
|
|
4444
|
+
* ```
|
|
4445
|
+
* @param params.networkIcons - Network icon URLs keyed by network id.
|
|
4446
|
+
* @param params.token - The raw API balance to map.
|
|
4447
|
+
* @returns The display-ready token row.
|
|
4448
|
+
* @see ToTokenBalanceRowParams
|
|
4449
|
+
* @see WalletAccountTokenBalance
|
|
4450
|
+
* @notInstrumented
|
|
4451
|
+
*/
|
|
4452
|
+
const toTokenBalanceRow = ({ networkIcons, token }) => {
|
|
4453
|
+
const networkId = token.networkId;
|
|
4454
|
+
const networkIcon = networkId !== void 0 ? networkIcons?.[String(networkId)] : void 0;
|
|
4455
|
+
return {
|
|
4456
|
+
balance: `${(0, _dynamic_labs_sdk_client.formatTokenAmount)({
|
|
4457
|
+
decimals: token.decimals,
|
|
4458
|
+
rawAmount: token.rawBalanceString
|
|
4459
|
+
})} ${token.symbol}`,
|
|
4460
|
+
id: `${networkId ?? "unknown"}:${token.address}`,
|
|
4461
|
+
name: token.name,
|
|
4462
|
+
networkIcon,
|
|
4463
|
+
token,
|
|
4464
|
+
tokenIcon: token.logoURI,
|
|
4465
|
+
value: token.marketValue !== void 0 ? USD_FORMATTER.format(token.marketValue) : void 0
|
|
4466
|
+
};
|
|
4467
|
+
};
|
|
4468
|
+
|
|
4469
|
+
//#endregion
|
|
4470
|
+
//#region src/views/WalletAccountBalances/useWalletAccountBalances/useWalletAccountBalances.ts
|
|
4471
|
+
/**
|
|
4472
|
+
* Fetches a wallet account's token balances on the given networks.
|
|
4473
|
+
*
|
|
4474
|
+
* Queries `useGetTokenBalances` for `walletAccount` on `networkIds` (its
|
|
4475
|
+
* single chain), then maps the results into display-ready rows sorted by
|
|
4476
|
+
* fiat value. Returns an empty list — with the query disabled — when
|
|
4477
|
+
* `networkIds` is empty.
|
|
4478
|
+
*
|
|
4479
|
+
* @example
|
|
4480
|
+
* ```tsx
|
|
4481
|
+
* const { isLoading, tokenBalances } = useWalletAccountBalances({
|
|
4482
|
+
* networkIds: [8453, 1],
|
|
4483
|
+
* walletAccount,
|
|
4484
|
+
* });
|
|
4485
|
+
* ```
|
|
4486
|
+
* @param params.networkIcons - Network icon URLs keyed by network id, rendered as each row's mark badge.
|
|
4487
|
+
* @param params.networkIds - The networks to query balances on, for the account's chain.
|
|
4488
|
+
* @param params.onTokenSelect - Fires with the chosen token balance when a row is selected.
|
|
4489
|
+
* @param params.walletAccount - The wallet account whose token balances are fetched.
|
|
4490
|
+
* @returns The loading flag and display-ready token rows.
|
|
4491
|
+
* @see UseWalletAccountBalancesParams
|
|
4492
|
+
* @see WalletAccountTokenBalance
|
|
4493
|
+
* @notInstrumented
|
|
4494
|
+
*/
|
|
4495
|
+
const useWalletAccountBalances = ({ networkIcons, networkIds, onTokenSelect, walletAccount }) => {
|
|
4496
|
+
const { data, isError, isLoading } = (0, _dynamic_labs_sdk_react_hooks.useGetTokenBalances)({
|
|
4497
|
+
filterSpamTokens: true,
|
|
4498
|
+
includeNative: true,
|
|
4499
|
+
includePrices: true,
|
|
4500
|
+
networkIds: networkIds.map(String),
|
|
4501
|
+
queryParams: { enabled: networkIds.length > 0 },
|
|
4502
|
+
walletAccount
|
|
4503
|
+
});
|
|
4504
|
+
const tokenBalances = (0, react.useMemo)(() => {
|
|
4505
|
+
return orderBalancesByTokenMarketValueDesc({ tokens: (data ?? []).filter((token) => token.networkId !== void 0) }).map((token) => toTokenBalanceRow({
|
|
4506
|
+
networkIcons,
|
|
4507
|
+
token
|
|
4508
|
+
}));
|
|
4509
|
+
}, [data, networkIcons]);
|
|
4510
|
+
return {
|
|
4511
|
+
handleTokenSelect: (0, react.useMemo)(() => {
|
|
4512
|
+
if (onTokenSelect === void 0) return;
|
|
4513
|
+
return ({ id }) => {
|
|
4514
|
+
const row = tokenBalances.find(({ id: rowId }) => rowId === id);
|
|
4515
|
+
if (row !== void 0) onTokenSelect(row.token);
|
|
4516
|
+
};
|
|
4517
|
+
}, [onTokenSelect, tokenBalances]),
|
|
4518
|
+
isError,
|
|
4519
|
+
isLoading,
|
|
4520
|
+
tokenBalances
|
|
4521
|
+
};
|
|
4522
|
+
};
|
|
4523
|
+
|
|
4524
|
+
//#endregion
|
|
4525
|
+
//#region src/views/WalletAccountBalances/WalletAccountBalances.text.ts
|
|
4526
|
+
/**
|
|
4527
|
+
* Default text for {@link WalletAccountBalances}.
|
|
4528
|
+
*/
|
|
4529
|
+
const WALLET_ACCOUNT_BALANCES_TEXT = {
|
|
4530
|
+
empty: "No token balances available",
|
|
4531
|
+
error: "Couldn’t load balances"
|
|
4532
|
+
};
|
|
4533
|
+
|
|
4534
|
+
//#endregion
|
|
4535
|
+
//#region src/views/WalletAccountBalances/WalletAccountBalances.tsx
|
|
4536
|
+
/**
|
|
4537
|
+
* A wallet account's token holdings on the given networks, as a pickable
|
|
4538
|
+
* {@link BalancesList}. Fetches through {@link useWalletAccountBalances} —
|
|
4539
|
+
* `networkIds` queried through `useGetTokenBalances` — and
|
|
4540
|
+
* renders a {@link TokenMark} per row, placeholder rows while loading, an
|
|
4541
|
+
* error state when the request fails, and an empty state when nothing is
|
|
4542
|
+
* held.
|
|
4543
|
+
*
|
|
4544
|
+
* @copy empty - Message shown when the account holds no tokens.
|
|
4545
|
+
* @copy error - Message shown when the balance request fails.
|
|
4546
|
+
*
|
|
4547
|
+
* @example
|
|
4548
|
+
* ```tsx
|
|
4549
|
+
* import { WalletAccountBalances } from '@/views/WalletAccountBalances/WalletAccountBalances';
|
|
4550
|
+
*
|
|
4551
|
+
* const App = () => (
|
|
4552
|
+
* <WalletAccountBalances
|
|
4553
|
+
* networkIds={[8453]}
|
|
4554
|
+
* onTokenSelect={(token) => console.log(token.symbol)}
|
|
4555
|
+
* walletAccount={walletAccount}
|
|
4556
|
+
* />
|
|
4557
|
+
* );
|
|
4558
|
+
* ```
|
|
4559
|
+
* @param params.className - Extra class names for the list element.
|
|
4560
|
+
* @param params.networkIcons - Network icon URLs keyed by network id, rendered as each row's mark badge.
|
|
4561
|
+
* @param params.networkIds - The networks to list balances on, for the account's chain.
|
|
4562
|
+
* @param params.onTokenSelect - Fires with the chosen token balance when a row is tapped.
|
|
4563
|
+
* @param params.walletAccount - The wallet account whose token balances are listed.
|
|
4564
|
+
* @returns The account balances list.
|
|
4565
|
+
* @see WalletAccountBalancesProps
|
|
4566
|
+
* @see useWalletAccountBalances
|
|
4567
|
+
* @notInstrumented
|
|
4568
|
+
*/
|
|
4569
|
+
const WalletAccountBalances = ({ className, networkIcons, networkIds, onTokenSelect, walletAccount }) => {
|
|
4570
|
+
const text = useText({
|
|
4571
|
+
defaults: WALLET_ACCOUNT_BALANCES_TEXT,
|
|
4572
|
+
slot: "dyn-wallet-account-balances"
|
|
4573
|
+
});
|
|
4574
|
+
const { handleTokenSelect, isError, isLoading, tokenBalances } = useWalletAccountBalances({
|
|
4575
|
+
networkIcons,
|
|
4576
|
+
networkIds,
|
|
4577
|
+
onTokenSelect,
|
|
4578
|
+
walletAccount
|
|
4579
|
+
});
|
|
4580
|
+
const resolvedEmptyText = isError ? text("error") : text("empty");
|
|
4581
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BalancesList, {
|
|
4582
|
+
balances: tokenBalances.map((row) => ({
|
|
4583
|
+
balance: row.balance,
|
|
4584
|
+
icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TokenMark, {
|
|
4585
|
+
networkIcon: row.networkIcon,
|
|
4586
|
+
tokenIcon: row.tokenIcon
|
|
4587
|
+
}),
|
|
4588
|
+
id: row.id,
|
|
4589
|
+
name: row.name,
|
|
4590
|
+
value: row.value
|
|
4591
|
+
})),
|
|
4592
|
+
className,
|
|
4593
|
+
emptyText: resolvedEmptyText,
|
|
4594
|
+
isLoading,
|
|
4595
|
+
onTokenSelect: handleTokenSelect
|
|
4596
|
+
});
|
|
4597
|
+
};
|
|
4598
|
+
|
|
4599
|
+
//#endregion
|
|
4600
|
+
//#region package.json
|
|
4601
|
+
var name = "@dynamic-labs-sdk/react-ui";
|
|
4602
|
+
var version = "1.51.0";
|
|
4603
|
+
|
|
4604
|
+
//#endregion
|
|
4605
|
+
Object.defineProperty(exports, 'Badge', {
|
|
4606
|
+
enumerable: true,
|
|
4607
|
+
get: function () {
|
|
4608
|
+
return Badge;
|
|
4609
|
+
}
|
|
4610
|
+
});
|
|
4611
|
+
Object.defineProperty(exports, 'BalancesList', {
|
|
4612
|
+
enumerable: true,
|
|
4613
|
+
get: function () {
|
|
4614
|
+
return BalancesList;
|
|
4615
|
+
}
|
|
4616
|
+
});
|
|
4617
|
+
Object.defineProperty(exports, 'Button', {
|
|
4618
|
+
enumerable: true,
|
|
4619
|
+
get: function () {
|
|
4620
|
+
return Button;
|
|
4621
|
+
}
|
|
4622
|
+
});
|
|
4623
|
+
Object.defineProperty(exports, 'Checkbox', {
|
|
4624
|
+
enumerable: true,
|
|
4625
|
+
get: function () {
|
|
4626
|
+
return Checkbox;
|
|
4627
|
+
}
|
|
4628
|
+
});
|
|
4629
|
+
Object.defineProperty(exports, 'CheckboxField', {
|
|
4630
|
+
enumerable: true,
|
|
4631
|
+
get: function () {
|
|
4632
|
+
return CheckboxField;
|
|
4633
|
+
}
|
|
4634
|
+
});
|
|
4635
|
+
Object.defineProperty(exports, 'ConnectWalletOptionWidget', {
|
|
4636
|
+
enumerable: true,
|
|
4637
|
+
get: function () {
|
|
4638
|
+
return ConnectWalletOptionWidget;
|
|
4639
|
+
}
|
|
4640
|
+
});
|
|
4641
|
+
Object.defineProperty(exports, 'CopyButton', {
|
|
4642
|
+
enumerable: true,
|
|
4643
|
+
get: function () {
|
|
4644
|
+
return CopyButton;
|
|
4645
|
+
}
|
|
4646
|
+
});
|
|
4647
|
+
Object.defineProperty(exports, 'CopyField', {
|
|
4648
|
+
enumerable: true,
|
|
4649
|
+
get: function () {
|
|
4650
|
+
return CopyField;
|
|
4651
|
+
}
|
|
4652
|
+
});
|
|
4653
|
+
Object.defineProperty(exports, 'CopyMorphIcon', {
|
|
4654
|
+
enumerable: true,
|
|
4655
|
+
get: function () {
|
|
4656
|
+
return CopyMorphIcon;
|
|
4657
|
+
}
|
|
4658
|
+
});
|
|
4659
|
+
Object.defineProperty(exports, 'PRESS_SCALE', {
|
|
4660
|
+
enumerable: true,
|
|
4661
|
+
get: function () {
|
|
4662
|
+
return PRESS_SCALE;
|
|
4663
|
+
}
|
|
4664
|
+
});
|
|
4665
|
+
Object.defineProperty(exports, 'Panel', {
|
|
4666
|
+
enumerable: true,
|
|
4667
|
+
get: function () {
|
|
4668
|
+
return Panel;
|
|
4669
|
+
}
|
|
4670
|
+
});
|
|
4671
|
+
Object.defineProperty(exports, 'PanelHeader', {
|
|
4672
|
+
enumerable: true,
|
|
4673
|
+
get: function () {
|
|
4674
|
+
return PanelHeader;
|
|
4675
|
+
}
|
|
4676
|
+
});
|
|
4677
|
+
Object.defineProperty(exports, 'PanelHost', {
|
|
4678
|
+
enumerable: true,
|
|
4679
|
+
get: function () {
|
|
4680
|
+
return PanelHost;
|
|
4681
|
+
}
|
|
4682
|
+
});
|
|
4683
|
+
Object.defineProperty(exports, 'PanelHostContext', {
|
|
4684
|
+
enumerable: true,
|
|
4685
|
+
get: function () {
|
|
4686
|
+
return PanelHostContext;
|
|
4687
|
+
}
|
|
4688
|
+
});
|
|
4689
|
+
Object.defineProperty(exports, 'ProviderIcon', {
|
|
4690
|
+
enumerable: true,
|
|
4691
|
+
get: function () {
|
|
4692
|
+
return ProviderIcon;
|
|
4693
|
+
}
|
|
4694
|
+
});
|
|
4695
|
+
Object.defineProperty(exports, 'ProviderList', {
|
|
4696
|
+
enumerable: true,
|
|
4697
|
+
get: function () {
|
|
4698
|
+
return ProviderList;
|
|
4699
|
+
}
|
|
4700
|
+
});
|
|
4701
|
+
Object.defineProperty(exports, 'ProviderOption', {
|
|
4702
|
+
enumerable: true,
|
|
4703
|
+
get: function () {
|
|
4704
|
+
return ProviderOption;
|
|
4705
|
+
}
|
|
4706
|
+
});
|
|
4707
|
+
Object.defineProperty(exports, 'QRCode', {
|
|
4708
|
+
enumerable: true,
|
|
4709
|
+
get: function () {
|
|
4710
|
+
return QRCode;
|
|
4711
|
+
}
|
|
4712
|
+
});
|
|
4713
|
+
Object.defineProperty(exports, 'SPRING', {
|
|
4714
|
+
enumerable: true,
|
|
4715
|
+
get: function () {
|
|
4716
|
+
return SPRING;
|
|
4717
|
+
}
|
|
4718
|
+
});
|
|
4719
|
+
Object.defineProperty(exports, 'SearchBar', {
|
|
4720
|
+
enumerable: true,
|
|
4721
|
+
get: function () {
|
|
4722
|
+
return SearchBar;
|
|
4723
|
+
}
|
|
4724
|
+
});
|
|
4725
|
+
Object.defineProperty(exports, 'Select', {
|
|
4726
|
+
enumerable: true,
|
|
4727
|
+
get: function () {
|
|
4728
|
+
return Select;
|
|
4729
|
+
}
|
|
4730
|
+
});
|
|
4731
|
+
Object.defineProperty(exports, 'TextContext', {
|
|
4732
|
+
enumerable: true,
|
|
4733
|
+
get: function () {
|
|
4734
|
+
return TextContext;
|
|
4735
|
+
}
|
|
4736
|
+
});
|
|
4737
|
+
Object.defineProperty(exports, 'TextProvider', {
|
|
4738
|
+
enumerable: true,
|
|
4739
|
+
get: function () {
|
|
4740
|
+
return TextProvider;
|
|
4741
|
+
}
|
|
4742
|
+
});
|
|
4743
|
+
Object.defineProperty(exports, 'TokenBalanceOption', {
|
|
4744
|
+
enumerable: true,
|
|
4745
|
+
get: function () {
|
|
4746
|
+
return TokenBalanceOption;
|
|
4747
|
+
}
|
|
4748
|
+
});
|
|
4749
|
+
Object.defineProperty(exports, 'TokenMark', {
|
|
4750
|
+
enumerable: true,
|
|
4751
|
+
get: function () {
|
|
4752
|
+
return TokenMark;
|
|
4753
|
+
}
|
|
4754
|
+
});
|
|
4755
|
+
Object.defineProperty(exports, 'WalletAccountBalances', {
|
|
4756
|
+
enumerable: true,
|
|
4757
|
+
get: function () {
|
|
4758
|
+
return WalletAccountBalances;
|
|
4759
|
+
}
|
|
4760
|
+
});
|
|
4761
|
+
Object.defineProperty(exports, 'WalletChainList', {
|
|
4762
|
+
enumerable: true,
|
|
4763
|
+
get: function () {
|
|
4764
|
+
return WalletChainList;
|
|
4765
|
+
}
|
|
4766
|
+
});
|
|
4767
|
+
Object.defineProperty(exports, 'WalletList', {
|
|
4768
|
+
enumerable: true,
|
|
4769
|
+
get: function () {
|
|
4770
|
+
return WalletList;
|
|
4771
|
+
}
|
|
4772
|
+
});
|
|
4773
|
+
Object.defineProperty(exports, 'interpolateText', {
|
|
4774
|
+
enumerable: true,
|
|
4775
|
+
get: function () {
|
|
4776
|
+
return interpolateText;
|
|
4777
|
+
}
|
|
4778
|
+
});
|
|
4779
|
+
Object.defineProperty(exports, 'isValidImageSource', {
|
|
4780
|
+
enumerable: true,
|
|
4781
|
+
get: function () {
|
|
4782
|
+
return isValidImageSource;
|
|
4783
|
+
}
|
|
4784
|
+
});
|
|
4785
|
+
Object.defineProperty(exports, 'name', {
|
|
4786
|
+
enumerable: true,
|
|
4787
|
+
get: function () {
|
|
4788
|
+
return name;
|
|
4789
|
+
}
|
|
4790
|
+
});
|
|
4791
|
+
Object.defineProperty(exports, 'useCopyToClipboard', {
|
|
4792
|
+
enumerable: true,
|
|
4793
|
+
get: function () {
|
|
4794
|
+
return useCopyToClipboard;
|
|
4795
|
+
}
|
|
4796
|
+
});
|
|
4797
|
+
Object.defineProperty(exports, 'useGetWalletName', {
|
|
4798
|
+
enumerable: true,
|
|
4799
|
+
get: function () {
|
|
4800
|
+
return useGetWalletName;
|
|
4801
|
+
}
|
|
4802
|
+
});
|
|
4803
|
+
Object.defineProperty(exports, 'useText', {
|
|
4804
|
+
enumerable: true,
|
|
4805
|
+
get: function () {
|
|
4806
|
+
return useText;
|
|
4807
|
+
}
|
|
4808
|
+
});
|
|
4809
|
+
Object.defineProperty(exports, 'useViewRouter', {
|
|
4810
|
+
enumerable: true,
|
|
4811
|
+
get: function () {
|
|
4812
|
+
return useViewRouter;
|
|
4813
|
+
}
|
|
4814
|
+
});
|
|
4815
|
+
Object.defineProperty(exports, 'version', {
|
|
4816
|
+
enumerable: true,
|
|
4817
|
+
get: function () {
|
|
4818
|
+
return version;
|
|
4819
|
+
}
|
|
4820
|
+
});
|
|
4821
|
+
//# sourceMappingURL=package-BtQHztmi.cjs.map
|