@daimo/sdk 1.4.2 → 1.5.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/dist/client/createDaimoClient.d.ts +24 -6
- package/dist/client/createDaimoClient.d.ts.map +1 -1
- package/dist/client/createDaimoClient.js +47 -0
- package/dist/client/createDaimoClient.js.map +1 -1
- package/dist/common/account.d.ts +160 -21
- package/dist/common/account.d.ts.map +1 -1
- package/dist/common/account.js +12 -1
- package/dist/common/account.js.map +1 -1
- package/dist/common/api.d.ts +25 -12
- package/dist/common/api.d.ts.map +1 -1
- package/dist/common/api.js +11 -1
- package/dist/common/api.js.map +1 -1
- package/dist/common/index.d.ts +1 -0
- package/dist/common/index.d.ts.map +1 -1
- package/dist/common/index.js +1 -0
- package/dist/common/index.js.map +1 -1
- package/dist/common/session.d.ts +27 -3
- package/dist/common/session.d.ts.map +1 -1
- package/dist/common/session.js.map +1 -1
- package/dist/common/theme.d.ts +47 -0
- package/dist/common/theme.d.ts.map +1 -0
- package/dist/common/theme.js +230 -0
- package/dist/common/theme.js.map +1 -0
- package/dist/common/token.d.ts +6 -0
- package/dist/common/token.d.ts.map +1 -1
- package/dist/common/token.js +47 -1
- package/dist/common/token.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/web/accountWallet.d.ts +15 -0
- package/dist/web/accountWallet.d.ts.map +1 -0
- package/dist/web/accountWallet.js +44 -0
- package/dist/web/accountWallet.js.map +1 -0
- package/dist/web/api/index.d.ts +17 -11
- package/dist/web/api/index.d.ts.map +1 -1
- package/dist/web/api/navTree.d.ts +27 -5
- package/dist/web/api/navTree.d.ts.map +1 -1
- package/dist/web/components/ApplePayLogo.d.ts +9 -0
- package/dist/web/components/ApplePayLogo.d.ts.map +1 -0
- package/dist/web/components/ApplePayLogo.js +15 -0
- package/dist/web/components/ApplePayLogo.js.map +1 -0
- package/dist/web/components/ChooseChainPage.d.ts.map +1 -1
- package/dist/web/components/ChooseChainPage.js +3 -3
- package/dist/web/components/ChooseChainPage.js.map +1 -1
- package/dist/web/components/ChooseOptionPage.d.ts.map +1 -1
- package/dist/web/components/ChooseOptionPage.js +20 -7
- package/dist/web/components/ChooseOptionPage.js.map +1 -1
- package/dist/web/components/ChooseWalletPage.js +12 -3
- package/dist/web/components/ChooseWalletPage.js.map +1 -1
- package/dist/web/components/ConfirmationPage.d.ts.map +1 -1
- package/dist/web/components/ConfirmationPage.js +2 -1
- package/dist/web/components/ConfirmationPage.js.map +1 -1
- package/dist/web/components/ConfirmationSpinner.d.ts +3 -1
- package/dist/web/components/ConfirmationSpinner.d.ts.map +1 -1
- package/dist/web/components/ConfirmationSpinner.js +7 -2
- package/dist/web/components/ConfirmationSpinner.js.map +1 -1
- package/dist/web/components/DaimoFrame.d.ts +51 -0
- package/dist/web/components/DaimoFrame.d.ts.map +1 -0
- package/dist/web/components/DaimoFrame.js +173 -0
- package/dist/web/components/DaimoFrame.js.map +1 -0
- package/dist/web/components/DaimoModal.d.ts.map +1 -1
- package/dist/web/components/DaimoModal.js +127 -52
- package/dist/web/components/DaimoModal.js.map +1 -1
- package/dist/web/components/DaimoModalPreview.d.ts +11 -0
- package/dist/web/components/DaimoModalPreview.d.ts.map +1 -0
- package/dist/web/components/DaimoModalPreview.js +98 -0
- package/dist/web/components/DaimoModalPreview.js.map +1 -0
- package/dist/web/components/DeeplinkPage.d.ts.map +1 -1
- package/dist/web/components/DeeplinkPage.js +4 -3
- package/dist/web/components/DeeplinkPage.js.map +1 -1
- package/dist/web/components/ErrorPage.d.ts.map +1 -1
- package/dist/web/components/ErrorPage.js +4 -1
- package/dist/web/components/ErrorPage.js.map +1 -1
- package/dist/web/components/ExchangePage.d.ts.map +1 -1
- package/dist/web/components/ExchangePage.js +8 -23
- package/dist/web/components/ExchangePage.js.map +1 -1
- package/dist/web/components/ExternalPaymentPage.d.ts +22 -0
- package/dist/web/components/ExternalPaymentPage.d.ts.map +1 -0
- package/dist/web/components/ExternalPaymentPage.js +24 -0
- package/dist/web/components/ExternalPaymentPage.js.map +1 -0
- package/dist/web/components/ModalChrome.d.ts +28 -0
- package/dist/web/components/ModalChrome.d.ts.map +1 -0
- package/dist/web/components/ModalChrome.js +64 -0
- package/dist/web/components/ModalChrome.js.map +1 -0
- package/dist/web/components/ModalSkeleton.d.ts.map +1 -1
- package/dist/web/components/ModalSkeleton.js +2 -4
- package/dist/web/components/ModalSkeleton.js.map +1 -1
- package/dist/web/components/SelectAmountPage.d.ts.map +1 -1
- package/dist/web/components/SelectAmountPage.js +2 -2
- package/dist/web/components/SelectAmountPage.js.map +1 -1
- package/dist/web/components/SelectTokenPage.d.ts.map +1 -1
- package/dist/web/components/SelectTokenPage.js +8 -7
- package/dist/web/components/SelectTokenPage.js.map +1 -1
- package/dist/web/components/Skeleton.d.ts +19 -0
- package/dist/web/components/Skeleton.d.ts.map +1 -0
- package/dist/web/components/Skeleton.js +21 -0
- package/dist/web/components/Skeleton.js.map +1 -0
- package/dist/web/components/StripeOnrampPage.d.ts +3 -27
- package/dist/web/components/StripeOnrampPage.d.ts.map +1 -1
- package/dist/web/components/StripeOnrampPage.js +7 -116
- package/dist/web/components/StripeOnrampPage.js.map +1 -1
- package/dist/web/components/TokenAmountEntry.d.ts +9 -3
- package/dist/web/components/TokenAmountEntry.d.ts.map +1 -1
- package/dist/web/components/TokenAmountEntry.js +49 -27
- package/dist/web/components/TokenAmountEntry.js.map +1 -1
- package/dist/web/components/WaitingDepositAddressPage.d.ts +39 -0
- package/dist/web/components/WaitingDepositAddressPage.d.ts.map +1 -1
- package/dist/web/components/WaitingDepositAddressPage.js +61 -32
- package/dist/web/components/WaitingDepositAddressPage.js.map +1 -1
- package/dist/web/components/WalletAmountPage.d.ts.map +1 -1
- package/dist/web/components/WalletAmountPage.js +7 -4
- package/dist/web/components/WalletAmountPage.js.map +1 -1
- package/dist/web/components/account/AccountApplePayPage.d.ts +1 -1
- package/dist/web/components/account/AccountApplePayPage.d.ts.map +1 -1
- package/dist/web/components/account/AccountApplePayPage.js +26 -14
- package/dist/web/components/account/AccountApplePayPage.js.map +1 -1
- package/dist/web/components/account/AccountBankDetailsPage.d.ts +2 -1
- package/dist/web/components/account/AccountBankDetailsPage.d.ts.map +1 -1
- package/dist/web/components/account/AccountBankDetailsPage.js +166 -54
- package/dist/web/components/account/AccountBankDetailsPage.js.map +1 -1
- package/dist/web/components/account/AccountBankPickerPage.d.ts.map +1 -1
- package/dist/web/components/account/AccountBankPickerPage.js +15 -13
- package/dist/web/components/account/AccountBankPickerPage.js.map +1 -1
- package/dist/web/components/account/AccountBankTransferSubmittedPage.d.ts +3 -1
- package/dist/web/components/account/AccountBankTransferSubmittedPage.d.ts.map +1 -1
- package/dist/web/components/account/AccountBankTransferSubmittedPage.js +9 -3
- package/dist/web/components/account/AccountBankTransferSubmittedPage.js.map +1 -1
- package/dist/web/components/account/AccountCreatingWalletPage.d.ts.map +1 -1
- package/dist/web/components/account/AccountCreatingWalletPage.js +6 -4
- package/dist/web/components/account/AccountCreatingWalletPage.js.map +1 -1
- package/dist/web/components/account/AccountEmailPage.d.ts.map +1 -1
- package/dist/web/components/account/AccountEmailPage.js +20 -14
- package/dist/web/components/account/AccountEmailPage.js.map +1 -1
- package/dist/web/components/account/AccountEnrollmentPage.d.ts +7 -3
- package/dist/web/components/account/AccountEnrollmentPage.d.ts.map +1 -1
- package/dist/web/components/account/AccountEnrollmentPage.js +142 -107
- package/dist/web/components/account/AccountEnrollmentPage.js.map +1 -1
- package/dist/web/components/account/AccountEnrollmentUpdatePage.d.ts +10 -0
- package/dist/web/components/account/AccountEnrollmentUpdatePage.d.ts.map +1 -0
- package/dist/web/components/account/AccountEnrollmentUpdatePage.js +214 -0
- package/dist/web/components/account/AccountEnrollmentUpdatePage.js.map +1 -0
- package/dist/web/components/account/AccountFlowProvider.d.ts +1 -1
- package/dist/web/components/account/AccountFlowProvider.d.ts.map +1 -1
- package/dist/web/components/account/AccountFlowProvider.js +26 -20
- package/dist/web/components/account/AccountFlowProvider.js.map +1 -1
- package/dist/web/components/account/AccountKycInfoPage.d.ts +13 -0
- package/dist/web/components/account/AccountKycInfoPage.d.ts.map +1 -0
- package/dist/web/components/account/AccountKycInfoPage.js +37 -0
- package/dist/web/components/account/AccountKycInfoPage.js.map +1 -0
- package/dist/web/components/account/AccountOtpCodeEntry.d.ts +4 -1
- package/dist/web/components/account/AccountOtpCodeEntry.d.ts.map +1 -1
- package/dist/web/components/account/AccountOtpCodeEntry.js +46 -43
- package/dist/web/components/account/AccountOtpCodeEntry.js.map +1 -1
- package/dist/web/components/account/AccountPaymentPage.d.ts +3 -2
- package/dist/web/components/account/AccountPaymentPage.d.ts.map +1 -1
- package/dist/web/components/account/AccountPaymentPage.js +30 -18
- package/dist/web/components/account/AccountPaymentPage.js.map +1 -1
- package/dist/web/components/account/AccountPhoneOtpPage.d.ts.map +1 -1
- package/dist/web/components/account/AccountPhoneOtpPage.js +22 -9
- package/dist/web/components/account/AccountPhoneOtpPage.js.map +1 -1
- package/dist/web/components/account/AccountPhonePage.d.ts.map +1 -1
- package/dist/web/components/account/AccountPhonePage.js +30 -12
- package/dist/web/components/account/AccountPhonePage.js.map +1 -1
- package/dist/web/components/account/AccountRipioOtpPage.d.ts +7 -0
- package/dist/web/components/account/AccountRipioOtpPage.d.ts.map +1 -0
- package/dist/web/components/account/AccountRipioOtpPage.js +53 -0
- package/dist/web/components/account/AccountRipioOtpPage.js.map +1 -0
- package/dist/web/components/account/AccountStatusPage.d.ts +1 -3
- package/dist/web/components/account/AccountStatusPage.d.ts.map +1 -1
- package/dist/web/components/account/AccountStatusPage.js +29 -39
- package/dist/web/components/account/AccountStatusPage.js.map +1 -1
- package/dist/web/components/account/accountNav.d.ts +1 -1
- package/dist/web/components/account/accountNav.d.ts.map +1 -1
- package/dist/web/components/account/accountNav.js +5 -1
- package/dist/web/components/account/accountNav.js.map +1 -1
- package/dist/web/components/account/formSchemas.d.ts +81 -0
- package/dist/web/components/account/formSchemas.d.ts.map +1 -0
- package/dist/web/components/account/formSchemas.js +80 -0
- package/dist/web/components/account/formSchemas.js.map +1 -0
- package/dist/web/components/account/formSchemas.test.d.ts +2 -0
- package/dist/web/components/account/formSchemas.test.d.ts.map +1 -0
- package/dist/web/components/account/formSchemas.test.js +57 -0
- package/dist/web/components/account/formSchemas.test.js.map +1 -0
- package/dist/web/components/account/kycRequirement.d.ts +14 -0
- package/dist/web/components/account/kycRequirement.d.ts.map +1 -0
- package/dist/web/components/account/kycRequirement.js +48 -0
- package/dist/web/components/account/kycRequirement.js.map +1 -0
- package/dist/web/components/account/phone.d.ts +2 -1
- package/dist/web/components/account/phone.d.ts.map +1 -1
- package/dist/web/components/account/phone.js +11 -2
- package/dist/web/components/account/phone.js.map +1 -1
- package/dist/web/components/buttons.d.ts +3 -2
- package/dist/web/components/buttons.d.ts.map +1 -1
- package/dist/web/components/buttons.js +4 -4
- package/dist/web/components/buttons.js.map +1 -1
- package/dist/web/components/containers.d.ts +7 -2
- package/dist/web/components/containers.d.ts.map +1 -1
- package/dist/web/components/containers.js +73 -30
- package/dist/web/components/containers.js.map +1 -1
- package/dist/web/components/formFields.d.ts +39 -0
- package/dist/web/components/formFields.d.ts.map +1 -0
- package/dist/web/components/formFields.js +70 -0
- package/dist/web/components/formFields.js.map +1 -0
- package/dist/web/components/icons.d.ts +17 -1
- package/dist/web/components/icons.d.ts.map +1 -1
- package/dist/web/components/icons.js +30 -2
- package/dist/web/components/icons.js.map +1 -1
- package/dist/web/components/shared.d.ts +1 -1
- package/dist/web/components/shared.d.ts.map +1 -1
- package/dist/web/components/shared.js +22 -22
- package/dist/web/components/shared.js.map +1 -1
- package/dist/web/formatAmount.d.ts +5 -0
- package/dist/web/formatAmount.d.ts.map +1 -0
- package/dist/web/formatAmount.js +53 -0
- package/dist/web/formatAmount.js.map +1 -0
- package/dist/web/formatAmount.test.d.ts +2 -0
- package/dist/web/formatAmount.test.d.ts.map +1 -0
- package/dist/web/formatAmount.test.js +43 -0
- package/dist/web/formatAmount.test.js.map +1 -0
- package/dist/web/hooks/accountAuthNav.d.ts +3 -0
- package/dist/web/hooks/accountAuthNav.d.ts.map +1 -0
- package/dist/web/hooks/accountAuthNav.js +24 -0
- package/dist/web/hooks/accountAuthNav.js.map +1 -0
- package/dist/web/hooks/accountAuthNav.test.d.ts +2 -0
- package/dist/web/hooks/accountAuthNav.test.d.ts.map +1 -0
- package/dist/web/hooks/accountAuthNav.test.js +32 -0
- package/dist/web/hooks/accountAuthNav.test.js.map +1 -0
- package/dist/web/hooks/formatUserError.d.ts.map +1 -1
- package/dist/web/hooks/formatUserError.js +13 -2
- package/dist/web/hooks/formatUserError.js.map +1 -1
- package/dist/web/hooks/locale.d.ts +2 -0
- package/dist/web/hooks/locale.d.ts.map +1 -1
- package/dist/web/hooks/locale.js +41 -4
- package/dist/web/hooks/locale.js.map +1 -1
- package/dist/web/hooks/locale.test.d.ts +2 -0
- package/dist/web/hooks/locale.test.d.ts.map +1 -0
- package/dist/web/hooks/locale.test.js +41 -0
- package/dist/web/hooks/locale.test.js.map +1 -0
- package/dist/web/hooks/locales/en.d.ts +26 -2
- package/dist/web/hooks/locales/en.d.ts.map +1 -1
- package/dist/web/hooks/locales/en.js +36 -12
- package/dist/web/hooks/locales/en.js.map +1 -1
- package/dist/web/hooks/locales/es.d.ts.map +1 -1
- package/dist/web/hooks/locales/es.js +35 -11
- package/dist/web/hooks/locales/es.js.map +1 -1
- package/dist/web/hooks/locales/ja.d.ts.map +1 -1
- package/dist/web/hooks/locales/ja.js +36 -12
- package/dist/web/hooks/locales/ja.js.map +1 -1
- package/dist/web/hooks/locales/ko.d.ts.map +1 -1
- package/dist/web/hooks/locales/ko.js +36 -12
- package/dist/web/hooks/locales/ko.js.map +1 -1
- package/dist/web/hooks/locales/pt.d.ts +4 -0
- package/dist/web/hooks/locales/pt.d.ts.map +1 -0
- package/dist/web/hooks/locales/pt.js +164 -0
- package/dist/web/hooks/locales/pt.js.map +1 -0
- package/dist/web/hooks/locales/zh.d.ts.map +1 -1
- package/dist/web/hooks/locales/zh.js +36 -12
- package/dist/web/hooks/locales/zh.js.map +1 -1
- package/dist/web/hooks/navEvent.js +2 -2
- package/dist/web/hooks/navEvent.js.map +1 -1
- package/dist/web/hooks/types.d.ts +15 -3
- package/dist/web/hooks/types.d.ts.map +1 -1
- package/dist/web/hooks/types.js.map +1 -1
- package/dist/web/hooks/useAccountFlow.d.ts +17 -11
- package/dist/web/hooks/useAccountFlow.d.ts.map +1 -1
- package/dist/web/hooks/useAccountFlow.js +71 -28
- package/dist/web/hooks/useAccountFlow.js.map +1 -1
- package/dist/web/hooks/useCreateDeposit.d.ts +1 -1
- package/dist/web/hooks/useCreateDeposit.d.ts.map +1 -1
- package/dist/web/hooks/useCreateDeposit.js +15 -103
- package/dist/web/hooks/useCreateDeposit.js.map +1 -1
- package/dist/web/hooks/useDraftDeposit.d.ts +2 -1
- package/dist/web/hooks/useDraftDeposit.d.ts.map +1 -1
- package/dist/web/hooks/useDraftDeposit.js +18 -1
- package/dist/web/hooks/useDraftDeposit.js.map +1 -1
- package/dist/web/hooks/useSessionNav.d.ts +6 -3
- package/dist/web/hooks/useSessionNav.d.ts.map +1 -1
- package/dist/web/hooks/useSessionNav.js +131 -39
- package/dist/web/hooks/useSessionNav.js.map +1 -1
- package/dist/web/hooks/useWalletFlow.d.ts.map +1 -1
- package/dist/web/hooks/useWalletFlow.js +74 -26
- package/dist/web/hooks/useWalletFlow.js.map +1 -1
- package/dist/web/hooks/walletError.d.ts +9 -0
- package/dist/web/hooks/walletError.d.ts.map +1 -0
- package/dist/web/hooks/walletError.js +16 -0
- package/dist/web/hooks/walletError.js.map +1 -0
- package/dist/web/index.d.ts +7 -1
- package/dist/web/index.d.ts.map +1 -1
- package/dist/web/index.js +3 -0
- package/dist/web/index.js.map +1 -1
- package/dist/web/styles.css +1 -1
- package/dist/web/theme.css +1 -1
- package/dist/web/theme.d.ts +7 -0
- package/dist/web/theme.d.ts.map +1 -0
- package/dist/web/theme.js +23 -0
- package/dist/web/theme.js.map +1 -0
- package/package.json +7 -4
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
import { useLayoutEffect, useRef } from "react";
|
|
3
|
+
const MODAL_LOADING_MIN_HEIGHT = "min(360px, 90dvh)";
|
|
4
|
+
const HEIGHT_MORPH_MS = 180;
|
|
5
|
+
const HEIGHT_MORPH_EASING = "cubic-bezier(0.23, 1, 0.32, 1)";
|
|
6
|
+
export const MODAL_CONTENT_CLASS = "daimo-modal-content daimo-relative daimo-w-full daimo-max-w-[420px] daimo-max-h-[90vh] daimo-overflow-hidden daimo-bg-[var(--daimo-surface)] daimo-rounded-t-[var(--daimo-radius-xl)] sm:daimo-rounded-[var(--daimo-radius-xl)] daimo-shadow-lg daimo-flex daimo-flex-col";
|
|
5
7
|
/**
|
|
6
8
|
* Quick height morph on discrete page changes.
|
|
7
9
|
* Snapshots current height, measures new, tweens between.
|
|
@@ -9,50 +11,91 @@ import { CloseIcon } from "./icons.js";
|
|
|
9
11
|
*/
|
|
10
12
|
function usePageHeightMorph(ref, pageKey) {
|
|
11
13
|
const prevKey = useRef(pageKey);
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
14
|
+
const measuredHeight = useRef(null);
|
|
15
|
+
const stopAnimation = useRef(null);
|
|
16
|
+
useLayoutEffect(() => {
|
|
17
|
+
const el = ref.current;
|
|
18
|
+
if (!el)
|
|
15
19
|
return;
|
|
20
|
+
const previousHeight = measuredHeight.current;
|
|
21
|
+
const changed = prevKey.current !== pageKey;
|
|
16
22
|
prevKey.current = pageKey;
|
|
17
|
-
|
|
18
|
-
if (isFirst.current) {
|
|
19
|
-
isFirst.current = false;
|
|
23
|
+
if (!changed)
|
|
20
24
|
return;
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
if (
|
|
25
|
+
stopAnimation.current?.();
|
|
26
|
+
stopAnimation.current = null;
|
|
27
|
+
if (previousHeight == null || prefersReducedMotion())
|
|
24
28
|
return;
|
|
25
|
-
// Snapshot current rendered height
|
|
26
|
-
const from = el.offsetHeight;
|
|
27
|
-
// Remove any leftover explicit height so we can measure natural size
|
|
28
29
|
el.style.transition = "none";
|
|
29
30
|
el.style.height = "auto";
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
const nextHeight = el.offsetHeight;
|
|
32
|
+
if (Math.abs(previousHeight - nextHeight) < 1) {
|
|
33
|
+
measuredHeight.current = nextHeight;
|
|
33
34
|
return;
|
|
34
|
-
|
|
35
|
-
el.style.height = `${
|
|
36
|
-
// Force reflow so the browser registers the start value
|
|
35
|
+
}
|
|
36
|
+
el.style.height = `${previousHeight}px`;
|
|
37
37
|
void el.offsetHeight;
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
38
|
+
let done = false;
|
|
39
|
+
let frame = 0;
|
|
40
|
+
let timeout = 0;
|
|
41
|
+
const finish = (event) => {
|
|
42
|
+
if (event && (event.target !== el || event.propertyName !== "height")) {
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
if (done)
|
|
46
|
+
return;
|
|
47
|
+
done = true;
|
|
48
|
+
window.cancelAnimationFrame(frame);
|
|
49
|
+
window.clearTimeout(timeout);
|
|
50
|
+
el.removeEventListener("transitionend", finish);
|
|
41
51
|
el.style.transition = "";
|
|
42
52
|
el.style.height = "";
|
|
43
|
-
el.
|
|
53
|
+
measuredHeight.current = el.offsetHeight;
|
|
54
|
+
stopAnimation.current = null;
|
|
55
|
+
};
|
|
56
|
+
stopAnimation.current = () => {
|
|
57
|
+
if (done)
|
|
58
|
+
return;
|
|
59
|
+
done = true;
|
|
60
|
+
window.cancelAnimationFrame(frame);
|
|
61
|
+
window.clearTimeout(timeout);
|
|
62
|
+
el.removeEventListener("transitionend", finish);
|
|
63
|
+
const currentHeight = el.offsetHeight;
|
|
64
|
+
el.style.transition = "none";
|
|
65
|
+
el.style.height = `${currentHeight}px`;
|
|
66
|
+
measuredHeight.current = currentHeight;
|
|
67
|
+
};
|
|
68
|
+
frame = window.requestAnimationFrame(() => {
|
|
69
|
+
el.style.transition = `height ${HEIGHT_MORPH_MS}ms ${HEIGHT_MORPH_EASING}`;
|
|
70
|
+
el.style.height = `${nextHeight}px`;
|
|
71
|
+
});
|
|
72
|
+
timeout = window.setTimeout(finish, HEIGHT_MORPH_MS + 50);
|
|
73
|
+
el.addEventListener("transitionend", finish);
|
|
74
|
+
return () => {
|
|
75
|
+
stopAnimation.current?.();
|
|
76
|
+
stopAnimation.current = null;
|
|
44
77
|
};
|
|
45
|
-
el.addEventListener("transitionend", cleanup);
|
|
46
78
|
}, [ref, pageKey]);
|
|
79
|
+
useLayoutEffect(() => {
|
|
80
|
+
const el = ref.current;
|
|
81
|
+
if (!el || stopAnimation.current)
|
|
82
|
+
return;
|
|
83
|
+
measuredHeight.current = el.offsetHeight;
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
function prefersReducedMotion() {
|
|
87
|
+
return (typeof window !== "undefined" &&
|
|
88
|
+
window.matchMedia("(prefers-reduced-motion: reduce)").matches);
|
|
47
89
|
}
|
|
48
|
-
export function ModalContainer({ children, showFooterSpacer = true, onClose, pageKey, }) {
|
|
90
|
+
export function ModalContainer({ children, showFooterSpacer = true, onClose, pageKey, reserveLoadingHeight = false, }) {
|
|
49
91
|
const backdropClass = "daimo-modal-backdrop daimo-fixed daimo-inset-0 daimo-z-50 daimo-bg-black/50";
|
|
50
|
-
const contentClass = "daimo-modal-content daimo-relative daimo-w-full daimo-max-w-[420px] daimo-max-h-[90vh] daimo-overflow-hidden daimo-bg-[var(--daimo-surface)] daimo-rounded-t-[var(--daimo-radius-xl)] sm:daimo-rounded-[var(--daimo-radius-xl)] daimo-shadow-lg daimo-flex daimo-flex-col";
|
|
51
92
|
const contentRef = useRef(null);
|
|
52
93
|
usePageHeightMorph(contentRef, pageKey);
|
|
53
|
-
return (_jsxs(_Fragment, { children: [_jsx("div", { className: backdropClass, onClick: onClose }), _jsx("div", { className: "daimo-fixed daimo-inset-0 daimo-z-50 daimo-flex daimo-justify-center daimo-items-end sm:daimo-items-center daimo-pointer-events-none daimo-px-0 sm:daimo-px-4", children: _jsxs("div", { ref: contentRef, className: `daimo-pointer-events-auto ${
|
|
94
|
+
return (_jsxs(_Fragment, { children: [_jsx("div", { className: backdropClass, onClick: onClose }), _jsx("div", { className: "daimo-fixed daimo-inset-0 daimo-z-50 daimo-flex daimo-justify-center daimo-items-end sm:daimo-items-center daimo-pointer-events-none daimo-px-0 sm:daimo-px-4", children: _jsxs("div", { ref: contentRef, className: `daimo-pointer-events-auto ${MODAL_CONTENT_CLASS}`, style: reserveLoadingHeight
|
|
95
|
+
? { minHeight: MODAL_LOADING_MIN_HEIGHT }
|
|
96
|
+
: undefined, onClick: (e) => e.stopPropagation(), children: [_jsx("div", { className: "daimo-flex-1 daimo-min-h-0 daimo-flex daimo-flex-col", children: children }), showFooterSpacer && _jsx("div", { className: "daimo-h-8 daimo-shrink-0" })] }) })] }));
|
|
54
97
|
}
|
|
55
98
|
export function EmbeddedContainer({ children, showFooterSpacer = true, }) {
|
|
56
|
-
return (_jsx("div", { className: "daimo-bg-transparent daimo-flex daimo-flex-col daimo-items-center", children: _jsxs("div", { className: "daimo-w-full daimo-max-w-[512px] daimo-bg-[var(--daimo-surface)] daimo-flex daimo-flex-col", children: [children, showFooterSpacer && _jsx("div", { className: "daimo-h-8" })] }) }));
|
|
99
|
+
return (_jsx("div", { className: "daimo-bg-transparent daimo-flex daimo-flex-col daimo-items-center", children: _jsxs("div", { className: "daimo-relative daimo-w-full daimo-max-w-[512px] daimo-bg-[var(--daimo-surface)] daimo-flex daimo-flex-col", children: [children, showFooterSpacer && _jsx("div", { className: "daimo-h-8" })] }) }));
|
|
57
100
|
}
|
|
58
101
|
//# sourceMappingURL=containers.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"containers.js","sourceRoot":"","sources":["../../../src/web/components/containers.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAa,
|
|
1
|
+
{"version":3,"file":"containers.js","sourceRoot":"","sources":["../../../src/web/components/containers.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAa,eAAe,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAE3D,MAAM,wBAAwB,GAAG,mBAAmB,CAAC;AACrD,MAAM,eAAe,GAAG,GAAG,CAAC;AAC5B,MAAM,mBAAmB,GAAG,gCAAgC,CAAC;AAC7D,MAAM,CAAC,MAAM,mBAAmB,GAC9B,2QAA2Q,CAAC;AAgB9Q;;;;GAIG;AACH,SAAS,kBAAkB,CACzB,GAA2C,EAC3C,OAA2B;IAE3B,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC;IAChC,MAAM,cAAc,GAAG,MAAM,CAAgB,IAAI,CAAC,CAAC;IACnD,MAAM,aAAa,GAAG,MAAM,CAAsB,IAAI,CAAC,CAAC;IAExD,eAAe,CAAC,GAAG,EAAE;QACnB,MAAM,EAAE,GAAG,GAAG,CAAC,OAAO,CAAC;QACvB,IAAI,CAAC,EAAE;YAAE,OAAO;QAEhB,MAAM,cAAc,GAAG,cAAc,CAAC,OAAO,CAAC;QAC9C,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,KAAK,OAAO,CAAC;QAC5C,OAAO,CAAC,OAAO,GAAG,OAAO,CAAC;QAC1B,IAAI,CAAC,OAAO;YAAE,OAAO;QAErB,aAAa,CAAC,OAAO,EAAE,EAAE,CAAC;QAC1B,aAAa,CAAC,OAAO,GAAG,IAAI,CAAC;QAE7B,IAAI,cAAc,IAAI,IAAI,IAAI,oBAAoB,EAAE;YAAE,OAAO;QAE7D,EAAE,CAAC,KAAK,CAAC,UAAU,GAAG,MAAM,CAAC;QAC7B,EAAE,CAAC,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC;QACzB,MAAM,UAAU,GAAG,EAA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AU,cAAc,CAAC,EAC7B,QAAQ,EACR,gBAAgB,GAAG,IAAI,EACvB,OAAO,EACP,OAAO,EACP,oBAAoB,GAAG,KAAK,GACR;IACpB,MAAM,aAAa,GACjB,6EAA6E,CAAC;IAEhF,MAAM,UAAU,GAAG,MAAM,CAAiB,IAAI,CAAC,CAAC;IAChD,kBAAkB,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;IAExC,OAAO,CACL,8BAEE,cAAK,SAAS,EAAE,aAAa,EAAE,OAAO,EAAE,OAAO,GAAI,EAEnD,cAAK,SAAS,EAAC,+JAA+J,YAC5K,eACE,GAAG,EAAE,UAAU,EACf,SAAS,EAAE,6BAA6B,mBAAmB,EAAE,EAC7D,KAAK,EACH,oBAAoB;wBAClB,CAAC,CAAC,EAAE,SAAS,EAAE,wBAAwB,EAAE;wBACzC,CAAC,CAAC,SAAS,EAEf,OAAO,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,eAAe,EAAE,aAEnC,cAAK,SAAS,EAAC,sDAAsD,YAClE,QAAQ,GACL,EACL,gBAAgB,IAAI,cAAK,SAAS,EAAC,0BAA0B,GAAG,IAC7D,GACF,IACL,CACJ,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,EAChC,QAAQ,EACR,gBAAgB,GAAG,IAAI,GACmB;IAC1C,OAAO,CACL,cAAK,SAAS,EAAC,mEAAmE,YAChF,eAAK,SAAS,EAAC,2GAA2G,aACvH,QAAQ,EACR,gBAAgB,IAAI,cAAK,SAAS,EAAC,WAAW,GAAG,IAC9C,GACF,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { type InputHTMLAttributes, type ReactNode } from "react";
|
|
2
|
+
export type DaimoFormFieldProps = {
|
|
3
|
+
label: string;
|
|
4
|
+
children: (props: {
|
|
5
|
+
id: string;
|
|
6
|
+
describedBy?: string;
|
|
7
|
+
invalid: boolean;
|
|
8
|
+
}) => ReactNode;
|
|
9
|
+
description?: string;
|
|
10
|
+
error?: string;
|
|
11
|
+
hideError?: boolean;
|
|
12
|
+
labelVisibility?: "visible" | "sr-only";
|
|
13
|
+
};
|
|
14
|
+
export declare function DaimoFormField({ label, children, description, error, hideError, labelVisibility, }: DaimoFormFieldProps): import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
export declare const DaimoTextField: import("react").ForwardRefExoticComponent<InputHTMLAttributes<HTMLInputElement> & {
|
|
16
|
+
invalid?: boolean;
|
|
17
|
+
} & import("react").RefAttributes<HTMLInputElement>>;
|
|
18
|
+
export type DaimoSegmentedNumberSegment = {
|
|
19
|
+
id?: string;
|
|
20
|
+
name?: string;
|
|
21
|
+
value: string;
|
|
22
|
+
maxLength: number;
|
|
23
|
+
placeholder: string;
|
|
24
|
+
ariaLabel: string;
|
|
25
|
+
autoComplete?: string;
|
|
26
|
+
invalid?: boolean;
|
|
27
|
+
className?: string;
|
|
28
|
+
width?: string;
|
|
29
|
+
inputRef?: (input: HTMLInputElement | null) => void;
|
|
30
|
+
onBlur?: InputHTMLAttributes<HTMLInputElement>["onBlur"];
|
|
31
|
+
onValueChange: (value: string) => void;
|
|
32
|
+
canAutoAdvance?: (value: string) => boolean;
|
|
33
|
+
};
|
|
34
|
+
export type DaimoSegmentedNumberFieldProps = {
|
|
35
|
+
segments: DaimoSegmentedNumberSegment[];
|
|
36
|
+
describedBy?: string;
|
|
37
|
+
};
|
|
38
|
+
export declare function DaimoSegmentedNumberField({ segments, describedBy, }: DaimoSegmentedNumberFieldProps): import("react/jsx-runtime").JSX.Element;
|
|
39
|
+
//# sourceMappingURL=formFields.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formFields.d.ts","sourceRoot":"","sources":["../../../src/web/components/formFields.tsx"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,mBAAmB,EAExB,KAAK,SAAS,EAIf,MAAM,OAAO,CAAC;AAIf,MAAM,MAAM,mBAAmB,GAAG;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3C,QAAQ,EAAE,2BAA2B,EAAE,CAAC;IACxC,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,wBAAgB,yBAAyB,CAAC,EACxC,QAAQ,EACR,WAAW,GACZ,EAAE,8BAA8B,2CA4FhC"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef, useCallback, useId, useRef, } from "react";
|
|
3
|
+
import { TextInput } from "./shared.js";
|
|
4
|
+
export function DaimoFormField({ label, children, description, error, hideError, labelVisibility = "visible", }) {
|
|
5
|
+
const id = useId();
|
|
6
|
+
const descriptionId = description ? `${id}-description` : undefined;
|
|
7
|
+
const errorId = error ? `${id}-error` : undefined;
|
|
8
|
+
const describedBy = [descriptionId, errorId].filter(Boolean).join(" ");
|
|
9
|
+
return (_jsxs("label", { className: "daimo-flex daimo-flex-col daimo-gap-1.5", htmlFor: id, children: [_jsx("span", { className: labelVisibility === "sr-only"
|
|
10
|
+
? "daimo-sr-only"
|
|
11
|
+
: "daimo-text-xs daimo-font-medium daimo-text-[var(--daimo-text-secondary)]", children: label }), children({
|
|
12
|
+
id,
|
|
13
|
+
describedBy: describedBy || undefined,
|
|
14
|
+
invalid: error != null,
|
|
15
|
+
}), description && (_jsx("span", { id: descriptionId, className: "daimo-text-xs daimo-leading-relaxed daimo-text-[var(--daimo-text-secondary)]", children: description })), error && !hideError && (_jsx("span", { id: errorId, className: "daimo-text-xs daimo-leading-relaxed daimo-text-[var(--daimo-error)]", children: error }))] }));
|
|
16
|
+
}
|
|
17
|
+
export const DaimoTextField = forwardRef(function DaimoTextField({ className, invalid, ...props }, ref) {
|
|
18
|
+
return (_jsx(TextInput, { ...props, ref: ref, "aria-invalid": invalid || props["aria-invalid"] || undefined, className: `${invalid ? "daimo-ring-1 daimo-ring-[var(--daimo-error)] " : ""}${className ?? ""}` }));
|
|
19
|
+
});
|
|
20
|
+
export function DaimoSegmentedNumberField({ segments, describedBy, }) {
|
|
21
|
+
const inputRefs = useRef([]);
|
|
22
|
+
const setInputRef = useCallback((index, input) => {
|
|
23
|
+
inputRefs.current[index] = input;
|
|
24
|
+
segments[index]?.inputRef?.(input);
|
|
25
|
+
}, [segments]);
|
|
26
|
+
const focusNextWhenFilled = (index, value, segment) => {
|
|
27
|
+
if (value.length !== segment.maxLength)
|
|
28
|
+
return;
|
|
29
|
+
if (segment.canAutoAdvance != null && !segment.canAutoAdvance(value)) {
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
inputRefs.current[index + 1]?.focus();
|
|
33
|
+
};
|
|
34
|
+
const focusPreviousOnEmptyBackspace = (event, index) => {
|
|
35
|
+
if (event.key === "Backspace" && event.currentTarget.value === "") {
|
|
36
|
+
inputRefs.current[index - 1]?.focus();
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
const handlePaste = (event) => {
|
|
40
|
+
const digitCount = segments.reduce((total, segment) => total + segment.maxLength, 0);
|
|
41
|
+
const pasted = digitsOnly(event.clipboardData.getData("text"), digitCount);
|
|
42
|
+
if (pasted.length < 2)
|
|
43
|
+
return;
|
|
44
|
+
event.preventDefault();
|
|
45
|
+
let offset = 0;
|
|
46
|
+
let nextFocusIndex = 0;
|
|
47
|
+
segments.forEach((segment, index) => {
|
|
48
|
+
const value = pasted.slice(offset, offset + segment.maxLength);
|
|
49
|
+
segment.onValueChange(value);
|
|
50
|
+
offset += segment.maxLength;
|
|
51
|
+
if (value.length === segment.maxLength) {
|
|
52
|
+
nextFocusIndex = index + 1;
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
inputRefs.current[Math.min(nextFocusIndex, segments.length - 1)]?.focus();
|
|
56
|
+
};
|
|
57
|
+
return (_jsx("div", { className: "daimo-grid daimo-w-full daimo-min-w-0 daimo-gap-2", style: {
|
|
58
|
+
gridTemplateColumns: segments
|
|
59
|
+
.map((segment) => segment.width ?? "minmax(0, 1fr)")
|
|
60
|
+
.join(" "),
|
|
61
|
+
}, children: segments.map((segment, index) => (_jsx(DaimoTextField, { ref: (input) => setInputRef(index, input), id: segment.id, name: segment.name, onBlur: segment.onBlur, type: "text", inputMode: "numeric", autoComplete: segment.autoComplete, pattern: "[0-9]*", maxLength: segment.maxLength, value: segment.value, onChange: (event) => {
|
|
62
|
+
const value = digitsOnly(event.target.value, segment.maxLength);
|
|
63
|
+
segment.onValueChange(value);
|
|
64
|
+
focusNextWhenFilled(index, value, segment);
|
|
65
|
+
}, onKeyDown: (event) => focusPreviousOnEmptyBackspace(event, index), onPaste: handlePaste, placeholder: segment.placeholder, "aria-label": segment.ariaLabel, "aria-describedby": describedBy, invalid: segment.invalid, className: `daimo-h-12 daimo-px-2 daimo-py-3 daimo-text-center ${segment.className ?? ""}` }, segment.name ?? segment.ariaLabel))) }));
|
|
66
|
+
}
|
|
67
|
+
function digitsOnly(value, maxLength) {
|
|
68
|
+
return value.replace(/\D/g, "").slice(0, maxLength);
|
|
69
|
+
}
|
|
70
|
+
//# sourceMappingURL=formFields.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formFields.js","sourceRoot":"","sources":["../../../src/web/components/formFields.tsx"],"names":[],"mappings":";AAAA,OAAO,EAEL,UAAU,EAIV,WAAW,EACX,KAAK,EACL,MAAM,GACP,MAAM,OAAO,CAAC;AAEf,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAexC,MAAM,UAAU,cAAc,CAAC,EAC7B,KAAK,EACL,QAAQ,EACR,WAAW,EACX,KAAK,EACL,SAAS,EACT,eAAe,GAAG,SAAS,GACP;IACpB,MAAM,EAAE,GAAG,KAAK,EAAE,CAAC;IACnB,MAAM,aAAa,GAAG,WAAW,CAAC,CAAC,CAAC,GAAG,EAAE,cAAc,CAAC,CAAC,CAAC,SAAS,CAAC;IACpE,MAAM,OAAO,GAAG,KAAK,CAAC,CAAC,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC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B,SAAS,EAAE,OAAO,CAAC,SAAS,EAC5B,KAAK,EAAE,OAAO,CAAC,KAAK,EACpB,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE;gBAClB,MAAM,KAAK,GAAG,UAAU,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC;gBAChE,OAAO,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;gBAC7B,mBAAmB,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;YAC7C,CAAC,EACD,SAAS,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,6BAA6B,CAAC,KAAK,EAAE,KAAK,CAAC,EACjE,OAAO,EAAE,WAAW,EACpB,WAAW,EAAE,OAAO,CAAC,WAAW,gBACpB,OAAO,CAAC,SAAS,sBACX,WAAW,EAC7B,OAAO,EAAE,OAAO,CAAC,OAAO,EACxB,SAAS,EAAE,sDAAsD,OAAO,CAAC,SAAS,IAAI,EAAE,EAAE,IAtBrF,OAAO,CAAC,IAAI,IAAI,OAAO,CAAC,SAAS,CAuBtC,CACH,CAAC,GACE,CACP,CAAC;AACJ,CAAC;AAED,SAAS,UAAU,CAAC,KAAa,EAAE,SAAiB;IAClD,OAAO,KAAK,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,SAAS,CAAC,CAAC;AACtD,CAAC"}
|
|
@@ -6,10 +6,14 @@ type IconProps = {
|
|
|
6
6
|
export declare function CheckIcon({ className, size }: IconProps): import("react/jsx-runtime").JSX.Element;
|
|
7
7
|
/** Clock icon for expired/timeout states */
|
|
8
8
|
export declare function ExpiredIcon({ className, size }: IconProps): import("react/jsx-runtime").JSX.Element;
|
|
9
|
-
/**
|
|
9
|
+
/** Alert icon for error states */
|
|
10
10
|
export declare function ErrorIcon({ className, size }: IconProps): import("react/jsx-runtime").JSX.Element;
|
|
11
11
|
/** Back arrow for navigation */
|
|
12
12
|
export declare function BackArrowIcon({ className, size }: IconProps): import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
/** Chevron icon for compact previous/next controls */
|
|
14
|
+
export declare function ChevronIcon({ className, size, direction, }: IconProps & {
|
|
15
|
+
direction?: "left" | "right";
|
|
16
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
13
17
|
/** Opposing arrows for switching payment modes */
|
|
14
18
|
export declare function SwitchArrowsIcon({ className, size, flipY, animated, }: IconProps & {
|
|
15
19
|
flipY?: boolean;
|
|
@@ -17,6 +21,12 @@ export declare function SwitchArrowsIcon({ className, size, flipY, animated, }:
|
|
|
17
21
|
}): import("react/jsx-runtime").JSX.Element;
|
|
18
22
|
/** Close X icon for modal dismiss */
|
|
19
23
|
export declare function CloseIcon({ className, size }: IconProps): import("react/jsx-runtime").JSX.Element;
|
|
24
|
+
/** Horizontal ellipsis for compact account actions */
|
|
25
|
+
export declare function EllipsisIcon({ className, size }: IconProps): import("react/jsx-runtime").JSX.Element;
|
|
26
|
+
/** Envelope for account email */
|
|
27
|
+
export declare function EmailIcon({ className, size }: IconProps): import("react/jsx-runtime").JSX.Element;
|
|
28
|
+
/** Door arrow for signing out */
|
|
29
|
+
export declare function LogoutIcon({ className, size }: IconProps): import("react/jsx-runtime").JSX.Element;
|
|
20
30
|
/** Copy icon with checkmark state */
|
|
21
31
|
export declare function CopyIcon({ className, size, copied, }: IconProps & {
|
|
22
32
|
copied?: boolean;
|
|
@@ -25,5 +35,11 @@ export declare function CopyIcon({ className, size, copied, }: IconProps & {
|
|
|
25
35
|
export declare function DaimoLogoIcon({ className, size }: IconProps): import("react/jsx-runtime").JSX.Element;
|
|
26
36
|
/** External link icon */
|
|
27
37
|
export declare function ExternalLinkIcon({ className, size }: IconProps): import("react/jsx-runtime").JSX.Element;
|
|
38
|
+
/** YouTube logo for video walkthrough actions */
|
|
39
|
+
export declare function YouTubeLogoIcon({ className, size }: IconProps): import("react/jsx-runtime").JSX.Element;
|
|
40
|
+
/** QR-style icon for direct deposit instructions */
|
|
41
|
+
export declare function DepositInstructionsIcon({ className, size }: IconProps): import("react/jsx-runtime").JSX.Element;
|
|
42
|
+
/** Warning triangle for critical transfer instructions */
|
|
43
|
+
export declare function WarningIcon({ className, size }: IconProps): import("react/jsx-runtime").JSX.Element;
|
|
28
44
|
export {};
|
|
29
45
|
//# sourceMappingURL=icons.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"icons.d.ts","sourceRoot":"","sources":["../../../src/web/components/icons.tsx"],"names":[],"mappings":"AAAA,KAAK,SAAS,GAAG;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,8CAA8C;AAC9C,wBAAgB,SAAS,CAAC,EAAE,SAAS,EAAE,IAAS,EAAE,EAAE,SAAS,2CAgB5D;AAED,4CAA4C;AAC5C,wBAAgB,WAAW,CAAC,EAAE,SAAS,EAAE,IAAS,EAAE,EAAE,SAAS,2CAiB9D;AAED,
|
|
1
|
+
{"version":3,"file":"icons.d.ts","sourceRoot":"","sources":["../../../src/web/components/icons.tsx"],"names":[],"mappings":"AAAA,KAAK,SAAS,GAAG;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,8CAA8C;AAC9C,wBAAgB,SAAS,CAAC,EAAE,SAAS,EAAE,IAAS,EAAE,EAAE,SAAS,2CAgB5D;AAED,4CAA4C;AAC5C,wBAAgB,WAAW,CAAC,EAAE,SAAS,EAAE,IAAS,EAAE,EAAE,SAAS,2CAiB9D;AAED,kCAAkC;AAClC,wBAAgB,SAAS,CAAC,EAAE,SAAS,EAAE,IAAS,EAAE,EAAE,SAAS,2CAgC5D;AAED,gCAAgC;AAChC,wBAAgB,aAAa,CAAC,EAAE,SAAS,EAAE,IAAQ,EAAE,EAAE,SAAS,2CAkB/D;AAED,sDAAsD;AACtD,wBAAgB,WAAW,CAAC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,wBAAgB,WAAW,CAAC,EAAE,SAAS,EAAE,IAAS,EAAE,EAAE,SAAS,2CAmB9D"}
|
|
@@ -7,14 +7,18 @@ export function CheckIcon({ className, size = 40 }) {
|
|
|
7
7
|
export function ExpiredIcon({ className, size = 40 }) {
|
|
8
8
|
return (_jsxs("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", className: className ?? "daimo-text-[var(--daimo-error)]", children: [_jsx("circle", { cx: "12", cy: "12", r: "10" }), _jsx("path", { d: "M12 6v6l4 2" })] }));
|
|
9
9
|
}
|
|
10
|
-
/**
|
|
10
|
+
/** Alert icon for error states */
|
|
11
11
|
export function ErrorIcon({ className, size = 40 }) {
|
|
12
|
-
return (_jsxs("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none",
|
|
12
|
+
return (_jsxs("svg", { "aria-hidden": "true", width: size, height: size, viewBox: "0 0 24 24", fill: "none", className: className ?? "daimo-text-[var(--daimo-error-badge-mark)]", children: [_jsx("circle", { cx: "12", cy: "12", r: "8.25", stroke: "currentColor", strokeWidth: "1.8", opacity: "0.95" }), _jsx("path", { d: "M12 7.4v5.2", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round" }), _jsx("path", { d: "M12 16.55h.01", stroke: "currentColor", strokeWidth: "2.4", strokeLinecap: "round" })] }));
|
|
13
13
|
}
|
|
14
14
|
/** Back arrow for navigation */
|
|
15
15
|
export function BackArrowIcon({ className, size = 9 }) {
|
|
16
16
|
return (_jsx("svg", { width: size, height: Math.round((size * 16) / 9), viewBox: "0 0 9 16", fill: "none", className: className ?? "daimo-text-[var(--daimo-text-muted)]", children: _jsx("path", { d: "M8 1L1 8L8 15", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) }));
|
|
17
17
|
}
|
|
18
|
+
/** Chevron icon for compact previous/next controls */
|
|
19
|
+
export function ChevronIcon({ className, size = 16, direction = "right", }) {
|
|
20
|
+
return (_jsx("svg", { width: size, height: size, viewBox: "0 0 16 16", fill: "none", className: className ?? "daimo-text-[var(--daimo-text-muted)]", style: { transform: direction === "left" ? "rotate(180deg)" : undefined }, "aria-hidden": "true", children: _jsx("path", { d: "M6 3.5 10.5 8 6 12.5", stroke: "currentColor", strokeWidth: "1.75", strokeLinecap: "round", strokeLinejoin: "round" }) }));
|
|
21
|
+
}
|
|
18
22
|
/** Opposing arrows for switching payment modes */
|
|
19
23
|
export function SwitchArrowsIcon({ className, size = 16, flipY = false, animated = false, }) {
|
|
20
24
|
return (_jsx("svg", { "aria-hidden": "true", width: size, height: size, viewBox: "0 0 24 24", fill: "none", className: className ?? "daimo-text-[var(--daimo-text-muted)]", style: {
|
|
@@ -26,6 +30,18 @@ export function SwitchArrowsIcon({ className, size = 16, flipY = false, animated
|
|
|
26
30
|
export function CloseIcon({ className, size = 14 }) {
|
|
27
31
|
return (_jsx("svg", { width: size, height: size, viewBox: "0 0 14 14", fill: "none", className: className ?? "daimo-text-[var(--daimo-text-muted)]", children: _jsx("path", { d: "M1 13L13 1M1 1L13 13", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round" }) }));
|
|
28
32
|
}
|
|
33
|
+
/** Horizontal ellipsis for compact account actions */
|
|
34
|
+
export function EllipsisIcon({ className, size = 18 }) {
|
|
35
|
+
return (_jsx("svg", { "aria-hidden": "true", width: size, height: size, viewBox: "0 0 18 18", fill: "none", className: className ?? "daimo-text-[var(--daimo-text-muted)]", children: _jsx("path", { d: "M4 14h.01M9 14h.01M14 14h.01", stroke: "currentColor", strokeWidth: "2.6", strokeLinecap: "round" }) }));
|
|
36
|
+
}
|
|
37
|
+
/** Envelope for account email */
|
|
38
|
+
export function EmailIcon({ className, size = 16 }) {
|
|
39
|
+
return (_jsxs("svg", { "aria-hidden": "true", width: size, height: size, viewBox: "0 0 18 18", fill: "none", className: className ?? "daimo-text-[var(--daimo-text-muted)]", children: [_jsx("path", { d: "M2.5 5c0-.97.78-1.75 1.75-1.75h9.5c.97 0 1.75.78 1.75 1.75v8c0 .97-.78 1.75-1.75 1.75h-9.5c-.97 0-1.75-.78-1.75-1.75V5Z", stroke: "currentColor", strokeWidth: "1.8", strokeLinecap: "round", strokeLinejoin: "round" }), _jsx("path", { d: "m3.35 4.8 4.9 4.1c.44.37 1.06.37 1.5 0l4.9-4.1", stroke: "currentColor", strokeWidth: "1.8", strokeLinecap: "round", strokeLinejoin: "round" })] }));
|
|
40
|
+
}
|
|
41
|
+
/** Door arrow for signing out */
|
|
42
|
+
export function LogoutIcon({ className, size = 18 }) {
|
|
43
|
+
return (_jsxs("svg", { "aria-hidden": "true", width: size, height: size, viewBox: "0 0 18 18", fill: "none", className: className ?? "daimo-text-[var(--daimo-text-muted)]", children: [_jsx("path", { d: "M7.5 3.25H4.75c-.83 0-1.5.67-1.5 1.5v8.5c0 .83.67 1.5 1.5 1.5H7.5", stroke: "currentColor", strokeWidth: "1.7", strokeLinecap: "round", strokeLinejoin: "round" }), _jsx("path", { d: "M11 5.25 14.75 9 11 12.75M14.25 9H7.5", stroke: "currentColor", strokeWidth: "1.7", strokeLinecap: "round", strokeLinejoin: "round" })] }));
|
|
44
|
+
}
|
|
29
45
|
/** Copy icon with checkmark state */
|
|
30
46
|
export function CopyIcon({ className, size = 20, copied = false, }) {
|
|
31
47
|
if (copied) {
|
|
@@ -41,4 +57,16 @@ export function DaimoLogoIcon({ className, size = 16 }) {
|
|
|
41
57
|
export function ExternalLinkIcon({ className, size = 16 }) {
|
|
42
58
|
return (_jsxs("svg", { "aria-hidden": "true", width: size, height: size, viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", className: className, children: [_jsx("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M4 4C2.89543 4 2 4.89543 2 6V12C2 13.1046 2.89543 14 4 14H10C11.1046 14 12 13.1046 12 12V9.66667C12 9.11438 12.4477 8.66667 13 8.66667C13.5523 8.66667 14 9.11438 14 9.66667V12C14 14.2091 12.2091 16 10 16H4C1.79086 16 0 14.2091 0 12V6C0 3.79086 1.79086 2 4 2H6.33333C6.88562 2 7.33333 2.44772 7.33333 3C7.33333 3.55228 6.88562 4 6.33333 4H4Z", fill: "currentColor", fillOpacity: 0.4 }), _jsx("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M9.5 1C9.5 0.447715 9.94772 0 10.5 0H15C15.5523 0 16 0.447715 16 1V5.5C16 6.05228 15.5523 6.5 15 6.5C14.4477 6.5 14 6.05228 14 5.5V3.41421L8.70711 8.70711C8.31658 9.09763 7.68342 9.09763 7.29289 8.70711C6.90237 8.31658 6.90237 7.68342 7.29289 7.29289L12.5858 2H10.5C9.94772 2 9.5 1.55228 9.5 1Z", fill: "currentColor", fillOpacity: 0.4 })] }));
|
|
43
59
|
}
|
|
60
|
+
/** YouTube logo for video walkthrough actions */
|
|
61
|
+
export function YouTubeLogoIcon({ className, size = 20 }) {
|
|
62
|
+
return (_jsxs("svg", { "aria-hidden": "true", width: size, height: size, viewBox: "0 0 24 24", className: className, children: [_jsx("path", { fill: "#FF0033", d: "M21.58 7.19a2.72 2.72 0 0 0-1.91-1.93C17.98 4.8 12 4.8 12 4.8s-5.98 0-7.67.46a2.72 2.72 0 0 0-1.91 1.93A28.4 28.4 0 0 0 2 12a28.4 28.4 0 0 0 .42 4.81 2.72 2.72 0 0 0 1.91 1.93c1.69.46 7.67.46 7.67.46s5.98 0 7.67-.46a2.72 2.72 0 0 0 1.91-1.93A28.4 28.4 0 0 0 22 12a28.4 28.4 0 0 0-.42-4.81Z" }), _jsx("path", { fill: "#FFFFFF", d: "m10 15.2 5.2-3.2L10 8.8v6.4Z" })] }));
|
|
63
|
+
}
|
|
64
|
+
/** QR-style icon for direct deposit instructions */
|
|
65
|
+
export function DepositInstructionsIcon({ className, size = 20 }) {
|
|
66
|
+
return (_jsxs("svg", { "aria-hidden": "true", width: size, height: size, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.6", strokeLinecap: "round", strokeLinejoin: "round", className: className, children: [_jsx("path", { d: "M4 5.25C4 4.56 4.56 4 5.25 4h4.5C10.44 4 11 4.56 11 5.25v4.5C11 10.44 10.44 11 9.75 11h-4.5C4.56 11 4 10.44 4 9.75v-4.5Z" }), _jsx("path", { d: "M4 14.25C4 13.56 4.56 13 5.25 13h4.5c.69 0 1.25.56 1.25 1.25v4.5c0 .69-.56 1.25-1.25 1.25h-4.5C4.56 20 4 19.44 4 18.75v-4.5Z" }), _jsx("path", { d: "M13 5.25C13 4.56 13.56 4 14.25 4h4.5c.69 0 1.25.56 1.25 1.25v4.5c0 .69-.56 1.25-1.25 1.25h-4.5C13.56 11 13 10.44 13 9.75v-4.5Z" }), _jsx("path", { d: "M6.75 6.75h.5" }), _jsx("path", { d: "M6.75 16.75h.5" }), _jsx("path", { d: "M15.75 6.75h.5" }), _jsx("path", { d: "M14 14h.5" }), _jsx("path", { d: "M19.5 14h.5" }), _jsx("path", { d: "M14 19.5h.5" }), _jsx("path", { d: "M19.5 19.5h.5" }), _jsx("path", { d: "M16.75 16.75h.5" })] }));
|
|
67
|
+
}
|
|
68
|
+
/** Warning triangle for critical transfer instructions */
|
|
69
|
+
export function WarningIcon({ className, size = 20 }) {
|
|
70
|
+
return (_jsxs("svg", { "aria-hidden": "true", width: size, height: size, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.8", strokeLinecap: "round", strokeLinejoin: "round", className: className, children: [_jsx("path", { d: "M10.3 4.5 2.7 17.7A2 2 0 0 0 4.4 20.7h15.2a2 2 0 0 0 1.7-3L13.7 4.5a2 2 0 0 0-3.4 0Z" }), _jsx("path", { d: "M12 8.5v5" }), _jsx("path", { d: "M12 17h.01" })] }));
|
|
71
|
+
}
|
|
44
72
|
//# sourceMappingURL=icons.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"icons.js","sourceRoot":"","sources":["../../../src/web/components/icons.tsx"],"names":[],"mappings":";AAKA,8CAA8C;AAC9C,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AW,EAAC,KAAK,EACjB,aAAa,EAAC,OAAO,EACrB,cAAc,EAAC,OAAO,EACtB,SAAS,EAAE,SAAS,aAEpB,eAAM,CAAC,EAAC,0HAA0H,GAAG,EACrI,eAAM,CAAC,EAAC,8HAA8H,GAAG,EACzI,eAAM,CAAC,EAAC,gIAAgI,GAAG,EAC3I,eAAM,CAAC,EAAC,eAAe,GAAG,EAC1B,eAAM,CAAC,EAAC,gBAAgB,GAAG,EAC3B,eAAM,CAAC,EAAC,gBAAgB,GAAG,EAC3B,eAAM,CAAC,EAAC,WAAW,GAAG,EACtB,eAAM,CAAC,EAAC,aAAa,GAAG,EACxB,eAAM,CAAC,EAAC,aAAa,GAAG,EACxB,eAAM,CAAC,EAAC,eAAe,GAAG,EAC1B,eAAM,CAAC,EAAC,iBAAiB,GAAG,IACxB,CACP,CAAC;AACJ,CAAC;AAED,0DAA0D;AAC1D,MAAM,UAAU,WAAW,CAAC,EAAE,SAAS,EAAE,IAAI,GAAG,EAAE,EAAa;IAC7D,OAAO,CACL,8BACc,MAAM,EAClB,KAAK,EAAE,IAAI,EACX,MAAM,EAAE,IAAI,EACZ,OAAO,EAAC,WAAW,EACnB,IAAI,EAAC,MAAM,EACX,MAAM,EAAC,cAAc,EACrB,WAAW,EAAC,KAAK,EACjB,aAAa,EAAC,OAAO,EACrB,cAAc,EAAC,OAAO,EACtB,SAAS,EAAE,SAAS,aAEpB,eAAM,CAAC,EAAC,sFAAsF,GAAG,EACjG,eAAM,CAAC,EAAC,WAAW,GAAG,EACtB,eAAM,CAAC,EAAC,YAAY,GAAG,IACnB,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -33,7 +33,7 @@ export declare function useAmountInput(minimum: number, maximum: number, initial
|
|
|
33
33
|
handleChange: (amt: number, valid: boolean) => void;
|
|
34
34
|
};
|
|
35
35
|
/** Standard text input with consistent styling. */
|
|
36
|
-
export declare
|
|
36
|
+
export declare const TextInput: import("react").ForwardRefExoticComponent<import("react").InputHTMLAttributes<HTMLInputElement> & import("react").RefAttributes<HTMLInputElement>>;
|
|
37
37
|
/** Resolve relative icon paths to absolute URLs */
|
|
38
38
|
export declare function resolveIconUrl(icon: string, baseUrl: string): string;
|
|
39
39
|
/** Standard page header with optional back button and centered title */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../../src/web/components/shared.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../../src/web/components/shared.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,SAAS,EAKV,MAAM,OAAO,CAAC;AAqBf,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAU3D,OAAO,EAAE,aAAa,EAAY,MAAM,YAAY,CAAC;AAErD,OAAO,EAAE,aAAa,EAAE,CAAC;AAyBzB,wBAAgB,eAAe;;;kBAGI,KAAK,CAAC,OAAO,CAAC,cAAc,CAAC;EAM/D;AAyBD,KAAK,gBAAgB,GAAG;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,kEAAkE;IAClE,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,0EAA0E;IAC1E,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,yCAAyC;IACzC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,yCAAyC;IACzC,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;IACtD,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AAEF;;;GAGG;AACH,wBAAgB,WAAW,CAAC,EAC1B,OAAO,EACP,OAAO,EACP,cAAoB,EACpB,YAAY,EACZ,YAAY,EACZ,QAAQ,EACR,QAAQ,EACR,QAAgB,GACjB,EAAE,gB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;IAC1B,iFAAiF;IACjF,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,iGAAiG;IACjG,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,kEAAkE;IAClE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,uBAAuB,CAAC,EACtC,KAAK,EACL,OAAO,EACP,MAAM,EACN,OAAO,EACP,IAAW,EACX,gBAAgB,EAChB,YAAY,EACZ,QAAQ,EACR,OAAO,GACR,EAAE,4BAA4B,2CA4E9B;AAED,mCAAmC;AACnC,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAE5D;AAED,iEAAiE;AACjE,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAKxE;AAID,KAAK,qBAAqB,GAAG;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,mDAAmD;IACnD,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,uCAAuC;IACvC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,oCAAoC;IACpC,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CAClC,CAAC;AAEF,8CAA8C;AAC9C,wBAAgB,gBAAgB,CAAC,EAC/B,KAAK,EACL,KAAK,EACL,YAAY,EACZ,MAAM,EACN,QAAgB,EAChB,MAAM,GACP,EAAE,qBAAqB,2CA2BvB"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useCallback, useEffect, useRef, useState } from "react";
|
|
2
|
+
import { forwardRef, useCallback, useEffect, useRef, useState, } from "react";
|
|
3
3
|
import { arbitrum, base, bsc, celo, ethereum, getChainName, gnosis, hyperEvm, linea, megaEth, monad, optimism, polygon, solana, tempo, tron, worldchain, } from "../../common/chain.js";
|
|
4
|
+
import { formatAmountInput, formatFixedAmount, isValidAmountInput, parseDisplayAmount, } from "../formatAmount.js";
|
|
4
5
|
import { t } from "../hooks/locale.js";
|
|
5
6
|
import { SecondaryLinkButton } from "./buttons.js";
|
|
6
7
|
import { BackArrowIcon, CopyIcon } from "./icons.js";
|
|
@@ -72,31 +73,30 @@ export function AmountInput({ minimum, maximum, currencySymbol = "$", defaultLab
|
|
|
72
73
|
const showMinWarning = inputValue !== "" && amount > 0 && amount < minimum;
|
|
73
74
|
const showMaxWarning = inputValue !== "" && amount > maximum;
|
|
74
75
|
const handleInputChange = (e) => {
|
|
75
|
-
const value = e.target.value;
|
|
76
|
-
if (value
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
76
|
+
const value = parseDisplayAmount(e.target.value);
|
|
77
|
+
if (!isValidAmountInput(value, 2))
|
|
78
|
+
return;
|
|
79
|
+
setInputValue(value);
|
|
80
|
+
const newAmount = parseFloat(value) || 0;
|
|
81
|
+
const newIsValid = newAmount >= minimum && newAmount <= maximum;
|
|
82
|
+
onChange?.(newAmount, newIsValid);
|
|
82
83
|
};
|
|
83
84
|
const handleKeyDown = (e) => {
|
|
84
85
|
if (e.key === "Enter" && isValid) {
|
|
85
86
|
onSubmit(amount);
|
|
86
87
|
}
|
|
87
88
|
};
|
|
88
|
-
const
|
|
89
|
+
const displayValue = formatAmountInput(inputValue);
|
|
90
|
+
const placeholder = formatAmountInput("0.00");
|
|
91
|
+
const inputWidth = displayValue.length === 0
|
|
89
92
|
? "3.55ch"
|
|
90
|
-
: `${Math.min(
|
|
91
|
-
const fmtAmount = (n) => new Intl.NumberFormat(undefined, {
|
|
92
|
-
minimumFractionDigits: 2,
|
|
93
|
-
maximumFractionDigits: 2,
|
|
94
|
-
}).format(n);
|
|
93
|
+
: `${Math.min(displayValue.length - (displayValue.match(/\./g) || []).length * 0.55, 12)}ch`;
|
|
95
94
|
const label = showMinWarning
|
|
96
|
-
? `${t.minimum} ${currencySymbol}${
|
|
95
|
+
? `${t.minimum} ${currencySymbol}${formatFixedAmount(minimum)}`
|
|
97
96
|
: showMaxWarning
|
|
98
|
-
? `${t.maximum} ${currencySymbol}${
|
|
99
|
-
: (defaultLabel ??
|
|
97
|
+
? `${t.maximum} ${currencySymbol}${formatFixedAmount(maximum)}`
|
|
98
|
+
: (defaultLabel ??
|
|
99
|
+
`${t.minimum} ${currencySymbol}${formatFixedAmount(minimum)}`);
|
|
100
100
|
const labelClass = showMinWarning || showMaxWarning
|
|
101
101
|
? "daimo-text-base daimo-text-[var(--daimo-text)]"
|
|
102
102
|
: "daimo-text-base daimo-text-[var(--daimo-text-secondary)]";
|
|
@@ -108,12 +108,12 @@ export function AmountInput({ minimum, maximum, currencySymbol = "$", defaultLab
|
|
|
108
108
|
return;
|
|
109
109
|
didAutofocusRef.current = true;
|
|
110
110
|
requestAnimationFrame(() => el.focus());
|
|
111
|
-
}, type: "text", inputMode: "decimal", value:
|
|
111
|
+
}, type: "text", inputMode: "decimal", value: displayValue, disabled: disabled, onChange: handleInputChange, onKeyDown: handleKeyDown, placeholder: placeholder, className: "daimo-bg-transparent daimo-font-semibold daimo-text-[var(--daimo-text)] daimo-placeholder-[var(--daimo-placeholder)] daimo-outline-none daimo-border-none daimo-shadow-none daimo-caret-[var(--daimo-text-muted)] daimo-ring-0 focus:daimo-outline-none focus:daimo-ring-0 focus:daimo-border-none focus:daimo-shadow-none", style: {
|
|
112
112
|
width: inputWidth,
|
|
113
113
|
minWidth: "1ch",
|
|
114
114
|
maxWidth: "10ch",
|
|
115
115
|
fontSize: "clamp(16px, 30px, 30px)",
|
|
116
|
-
} })] }), _jsx("p", { className: labelClass
|
|
116
|
+
} })] }), _jsx("p", { className: `${labelClass} daimo-min-h-[24px]`, children: label })] }));
|
|
117
117
|
}
|
|
118
118
|
/** Hook to manage amount input state externally */
|
|
119
119
|
export function useAmountInput(minimum, maximum, initialValue) {
|
|
@@ -139,10 +139,10 @@ export function useAmountInput(minimum, maximum, initialValue) {
|
|
|
139
139
|
return { amount, isValid, handleChange };
|
|
140
140
|
}
|
|
141
141
|
/** Standard text input with consistent styling. */
|
|
142
|
-
export function TextInput(props) {
|
|
142
|
+
export const TextInput = forwardRef(function TextInput(props, ref) {
|
|
143
143
|
const { className, ...rest } = props;
|
|
144
|
-
return (_jsx("input", { ...rest, className: `daimo-w-full daimo-px-3 daimo-py-2 daimo-text-
|
|
145
|
-
}
|
|
144
|
+
return (_jsx("input", { ...rest, ref: ref, className: `daimo-box-border daimo-w-full daimo-min-w-0 daimo-max-w-full daimo-px-3 daimo-py-2 daimo-text-base daimo-bg-[var(--daimo-surface-secondary)] daimo-text-[var(--daimo-text)] daimo-placeholder-[var(--daimo-placeholder)] daimo-rounded-[var(--daimo-radius-md)] daimo-border-none daimo-outline-none focus:daimo-ring-2 focus:daimo-ring-[var(--daimo-accent)] daimo-transition-shadow ${className ?? ""}` }));
|
|
145
|
+
});
|
|
146
146
|
/** Resolve relative icon paths to absolute URLs */
|
|
147
147
|
export function resolveIconUrl(icon, baseUrl) {
|
|
148
148
|
if (icon.startsWith("http://") ||
|