@coinbase/cdp-react 0.0.18 → 0.0.20

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.
Files changed (148) hide show
  1. package/dist/assets/Button.css +1 -1
  2. package/dist/assets/EmailForm.css +1 -0
  3. package/dist/assets/Error.css +1 -1
  4. package/dist/assets/Field.css +1 -1
  5. package/dist/assets/Input.css +1 -1
  6. package/dist/assets/Label.css +1 -0
  7. package/dist/assets/LoadingSkeleton.css +1 -1
  8. package/dist/assets/LoadingSpinner.css +1 -1
  9. package/dist/assets/Modal.css +1 -0
  10. package/dist/assets/OTP.css +1 -1
  11. package/dist/assets/OTPForm.css +1 -0
  12. package/dist/assets/PhoneNumberForm.css +1 -0
  13. package/dist/assets/PhoneNumberInput.css +1 -0
  14. package/dist/assets/SignIn.css +1 -1
  15. package/dist/assets/SignInAuthMethodButtons.css +1 -0
  16. package/dist/assets/SignInBackButton.css +1 -0
  17. package/dist/assets/SignInCredentials.css +1 -0
  18. package/dist/assets/SignInDescription.css +1 -1
  19. package/dist/assets/SignInFooter.css +1 -0
  20. package/dist/assets/SignInForm.css +1 -1
  21. package/dist/assets/SignInImage.css +1 -1
  22. package/dist/assets/SignInModal.css +1 -1
  23. package/dist/assets/SignInTitle.css +1 -1
  24. package/dist/assets/SuccessMessage.css +1 -0
  25. package/dist/assets/SwitchFadeTransition.css +1 -0
  26. package/dist/assets/SwitchSlideTransition.css +1 -0
  27. package/dist/assets/SwitchTransition.css +1 -0
  28. package/dist/assets/ThemeProvider.css +1 -1
  29. package/dist/assets/VisuallyHidden.css +1 -1
  30. package/dist/chunks/index.BzllgVaP.js +12 -0
  31. package/dist/components/AuthButton/index.js +7 -7
  32. package/dist/components/CDPReactProvider/index.d.ts +3 -0
  33. package/dist/components/CDPReactProvider/index.js +20 -13
  34. package/dist/components/SendTransactionButton/index.js +1 -1
  35. package/dist/components/SignIn/SignInAuthMethodButtons.d.ts +13 -0
  36. package/dist/components/SignIn/SignInAuthMethodButtons.js +59 -0
  37. package/dist/components/SignIn/SignInBackButton.d.ts +9 -0
  38. package/dist/components/SignIn/SignInBackButton.js +38 -0
  39. package/dist/components/SignIn/SignInCredentials.d.ts +2 -0
  40. package/dist/components/SignIn/SignInCredentials.js +8 -0
  41. package/dist/components/SignIn/SignInDescription.d.ts +4 -3
  42. package/dist/components/SignIn/SignInDescription.js +16 -23
  43. package/dist/components/SignIn/SignInFooter.d.ts +2 -0
  44. package/dist/components/SignIn/SignInFooter.js +18 -0
  45. package/dist/components/SignIn/SignInForm.d.ts +12 -4
  46. package/dist/components/SignIn/SignInForm.js +30 -195
  47. package/dist/components/SignIn/SignInImage.d.ts +2 -2
  48. package/dist/components/SignIn/SignInImage.js +11 -14
  49. package/dist/components/SignIn/SignInProvider.d.ts +1 -1
  50. package/dist/components/SignIn/SignInProvider.js +24 -16
  51. package/dist/components/SignIn/SignInTitle.d.ts +4 -3
  52. package/dist/components/SignIn/SignInTitle.js +18 -13
  53. package/dist/components/SignIn/flows/SignInWithEmail.d.ts +6 -0
  54. package/dist/components/SignIn/flows/SignInWithEmail.js +88 -0
  55. package/dist/components/SignIn/flows/SignInWithSms.d.ts +8 -0
  56. package/dist/components/SignIn/flows/SignInWithSms.js +3011 -0
  57. package/dist/components/SignIn/hooks/useEmailForm.d.ts +13 -0
  58. package/dist/components/SignIn/hooks/useEmailForm.js +42 -0
  59. package/dist/components/SignIn/hooks/useOTPForm.d.ts +16 -0
  60. package/dist/components/SignIn/hooks/useOTPForm.js +59 -0
  61. package/dist/components/SignIn/hooks/usePhoneNumberForm.d.ts +13 -0
  62. package/dist/components/SignIn/hooks/usePhoneNumberForm.js +42 -0
  63. package/dist/components/SignIn/index.d.ts +5 -2
  64. package/dist/components/SignIn/index.js +42 -24
  65. package/dist/components/SignIn/types.d.ts +106 -0
  66. package/dist/components/SignIn/types.js +3 -0
  67. package/dist/components/SignIn/useSignInReducer.d.ts +1 -57
  68. package/dist/components/SignIn/useSignInReducer.js +62 -20
  69. package/dist/components/SignInModal/index.d.ts +2 -2
  70. package/dist/components/SignInModal/index.js +56 -44
  71. package/dist/components/SignOutButton/index.js +1 -1
  72. package/dist/components/ThemeProvider/index.js +1 -1
  73. package/dist/components/forms/EmailForm/index.d.ts +11 -0
  74. package/dist/components/forms/EmailForm/index.js +56 -0
  75. package/dist/components/{Field → forms/Field}/index.d.ts +2 -1
  76. package/dist/components/forms/Field/index.js +24 -0
  77. package/dist/components/{Input → forms/Input}/index.js +1 -1
  78. package/dist/components/forms/Label/index.d.ts +7 -0
  79. package/dist/components/forms/Label/index.js +13 -0
  80. package/dist/components/{OTP → forms/OTP}/index.d.ts +3 -0
  81. package/dist/components/forms/OTP/index.js +65 -0
  82. package/dist/components/forms/OTPForm/index.d.ts +16 -0
  83. package/dist/components/forms/OTPForm/index.js +76 -0
  84. package/dist/components/forms/PhoneNumberForm/index.d.ts +14 -0
  85. package/dist/components/forms/PhoneNumberForm/index.js +68 -0
  86. package/dist/components/forms/PhoneNumberInput/PhoneNumberMetadata.d.ts +2 -0
  87. package/dist/components/forms/PhoneNumberInput/PhoneNumberMetadata.js +5 -0
  88. package/dist/components/forms/PhoneNumberInput/index.d.ts +10 -0
  89. package/dist/components/forms/PhoneNumberInput/index.js +76 -0
  90. package/dist/components/forms/PhoneNumberInput/maskOverride.d.ts +8 -0
  91. package/dist/components/forms/PhoneNumberInput/maskOverride.js +61 -0
  92. package/dist/components/forms/PhoneNumberInput/usePhoneNumberFormatter.d.ts +7 -0
  93. package/dist/components/forms/PhoneNumberInput/usePhoneNumberFormatter.js +52 -0
  94. package/dist/components/{Button → ui/Button}/index.d.ts +2 -1
  95. package/dist/components/ui/Button/index.js +75 -0
  96. package/dist/components/{Error → ui/Error}/index.d.ts +2 -2
  97. package/dist/components/ui/Error/index.js +16 -0
  98. package/dist/components/ui/LoadingSkeleton/index.js +19 -0
  99. package/dist/components/{LoadingSpinner → ui/LoadingSpinner}/index.js +6 -6
  100. package/dist/components/ui/Modal/index.d.ts +11 -0
  101. package/dist/components/ui/Modal/index.js +27 -0
  102. package/dist/components/{ServerError → ui/ServerError}/index.js +4 -4
  103. package/dist/components/ui/SuccessMessage/index.d.ts +7 -0
  104. package/dist/components/ui/SuccessMessage/index.js +16 -0
  105. package/dist/components/ui/SwitchFadeTransition/index.d.ts +5 -0
  106. package/dist/components/ui/SwitchFadeTransition/index.js +24 -0
  107. package/dist/components/ui/SwitchSlideTransition/index.d.ts +7 -0
  108. package/dist/components/ui/SwitchSlideTransition/index.js +27 -0
  109. package/dist/components/ui/SwitchTransition/index.d.ts +25 -0
  110. package/dist/components/ui/SwitchTransition/index.js +155 -0
  111. package/dist/components/{VisuallyHidden → ui/VisuallyHidden}/index.js +2 -2
  112. package/dist/data/countries.d.ts +12 -0
  113. package/dist/data/countries.js +25 -0
  114. package/dist/data/countryNames.d.ts +1 -0
  115. package/dist/data/countryNames.js +6 -0
  116. package/dist/hooks/usePhoneNumberValidators.d.ts +14 -0
  117. package/dist/hooks/usePhoneNumberValidators.js +36 -0
  118. package/dist/hooks/useTimer.d.ts +5 -0
  119. package/dist/hooks/useTimer.js +24 -0
  120. package/dist/icons/IconArrowLeft.d.ts +2 -0
  121. package/dist/icons/IconArrowLeft.js +14 -0
  122. package/dist/icons/IconCheckCircle.js +2 -3
  123. package/dist/icons/IconCoinbaseWordmark.js +5 -5
  124. package/dist/icons/IconEnvelope.d.ts +2 -0
  125. package/dist/icons/IconEnvelope.js +7 -0
  126. package/dist/icons/IconExclamationCircle.js +3 -4
  127. package/dist/icons/IconPhone.d.ts +2 -0
  128. package/dist/icons/IconPhone.js +7 -0
  129. package/dist/icons/IconXMark.js +6 -5
  130. package/dist/icons/index.d.ts +3 -0
  131. package/dist/icons/index.js +14 -8
  132. package/dist/index.js +66 -53
  133. package/dist/theme/theme.d.ts +11 -2
  134. package/dist/theme/tokens.d.ts +30 -6
  135. package/dist/theme/tokens.js +7 -3
  136. package/dist/utils/parseValuesFromPhoneNumber.d.ts +6 -0
  137. package/dist/utils/parseValuesFromPhoneNumber.js +16 -0
  138. package/package.json +23 -7
  139. package/dist/components/Button/index.js +0 -50
  140. package/dist/components/Error/index.js +0 -16
  141. package/dist/components/Field/index.js +0 -22
  142. package/dist/components/LoadingSkeleton/index.js +0 -19
  143. package/dist/components/OTP/index.js +0 -50
  144. /package/dist/components/{Input → forms/Input}/index.d.ts +0 -0
  145. /package/dist/components/{LoadingSkeleton → ui/LoadingSkeleton}/index.d.ts +0 -0
  146. /package/dist/components/{LoadingSpinner → ui/LoadingSpinner}/index.d.ts +0 -0
  147. /package/dist/components/{ServerError → ui/ServerError}/index.d.ts +0 -0
  148. /package/dist/components/{VisuallyHidden → ui/VisuallyHidden}/index.d.ts +0 -0
@@ -0,0 +1,61 @@
1
+ import "libphonenumber-js";
2
+ import { nonThrowingGetCountryCallingCode as e } from "../../../data/countries.js";
3
+ const n = (r) => r.startsWith("1") ? r.slice(1) : r, i = {
4
+ 234: {
5
+ /**
6
+ * libphonenumber-js bug:
7
+ *
8
+ * Nigerial phone numbers require a 0 prefix for the mask to work.
9
+ */
10
+ prefix: "0"
11
+ },
12
+ 33: {
13
+ /**
14
+ * libphonenumber-js bug:
15
+ *
16
+ * French phone numbers require a 0 prefix for the mask to work.
17
+ * On top of that, libphonenumber does not take that 0 into account on maxLength.
18
+ * This means that if the user types a number with the 0, the number will be cropped short.
19
+ *
20
+ * Example: 01 23 45 67 89 would be cropped to 01 23 45 67 8.
21
+ * Users could overcome this by omiting the 0, but this would mean the mask formatting would
22
+ * not work, and the input would look plain 123456789.
23
+ */
24
+ prefix: "0",
25
+ maxLength: 10
26
+ },
27
+ 1: {
28
+ /**
29
+ * libphonenumber-js bug:
30
+ *
31
+ * Calling code 1 Phone numbers cannot start with 1.
32
+ * If we allow them to, the masks will show 1 (234) 567-890, and limit the length to 10
33
+ * The above is an invalid US number though, as phone numbers need to have 10 digits EXCLUDING
34
+ * the internation code 1.
35
+ *
36
+ * This does not introduce a bug because we already have the Country Code picker, so adding
37
+ * the international code to the Phone input is a user mistake.
38
+ */
39
+ normalizer: n
40
+ },
41
+ 44: {
42
+ /**
43
+ * libphonenumber-js bug:
44
+ *
45
+ * GB has max 10 digit phone numbers AFTER A LEADING 0 (so actually 11)
46
+ * On top of that, the libphonenumber-js mask does not work without the leading 0.
47
+ *
48
+ * This will enforce adding the leading 0, and override the max length to 11 instead of 10.
49
+ */
50
+ prefix: "0",
51
+ maxLength: 11
52
+ }
53
+ }, a = (r) => {
54
+ if (!r)
55
+ return {};
56
+ const t = e(r);
57
+ return t ? i[t] ?? {} : {};
58
+ };
59
+ export {
60
+ a as getMaskOverride
61
+ };
@@ -0,0 +1,7 @@
1
+ import { CountryCode } from 'libphonenumber-js';
2
+ export declare const usePhoneNumberFormatter: (phoneNumber: string, countryCode: CountryCode | undefined) => {
3
+ formatBeforePhoneNumberChange: (inputPhoneNumber: string) => import('../../../utils/parseValuesFromPhoneNumber').PhoneNumber;
4
+ formatBeforeCountryCodeChange: (newCountryCode: CountryCode) => import('../../../utils/parseValuesFromPhoneNumber').PhoneNumber;
5
+ placeholder: string | undefined;
6
+ formattedDisplayNumber: string;
7
+ };
@@ -0,0 +1,52 @@
1
+ import { parseIncompletePhoneNumber as I, getExampleNumber as l, AsYouType as K } from "libphonenumber-js";
2
+ import { useCallback as S, useMemo as N } from "react";
3
+ import { parseValuesFromPhoneNumber as B } from "../../../utils/parseValuesFromPhoneNumber.js";
4
+ import { getMaskOverride as L } from "./maskOverride.js";
5
+ import { PhoneNumberMetadata as G } from "./PhoneNumberMetadata.js";
6
+ const i = { AC: "40123", AD: "312345", AE: "501234567", AF: "701234567", AG: "2684641234", AI: "2642351234", AL: "672123456", AM: "77123456", AO: "923123456", AR: "91123456789", AS: "6847331234", AT: "664123456", AU: "412345678", AW: "5601234", AX: "412345678", AZ: "401234567", BA: "61123456", BB: "2462501234", BD: "1812345678", BE: "470123456", BF: "70123456", BG: "43012345", BH: "36001234", BI: "79561234", BJ: "0195123456", BL: "690001234", BM: "4413701234", BN: "7123456", BO: "71234567", BQ: "3181234", BR: "11961234567", BS: "2423591234", BT: "17123456", BW: "71123456", BY: "294911911", BZ: "6221234", CA: "5062345678", CC: "412345678", CD: "991234567", CF: "70012345", CG: "061234567", CH: "781234567", CI: "0123456789", CK: "71234", CL: "221234567", CM: "671234567", CN: "13123456789", CO: "3211234567", CR: "83123456", CU: "51234567", CV: "9911234", CW: "95181234", CX: "412345678", CY: "96123456", CZ: "601123456", DE: "15123456789", DJ: "77831001", DK: "34412345", DM: "7672251234", DO: "8092345678", DZ: "551234567", EC: "991234567", EE: "51234567", EG: "1001234567", EH: "650123456", ER: "7123456", ES: "612345678", ET: "911234567", FI: "412345678", FJ: "7012345", FK: "51234", FM: "3501234", FO: "211234", FR: "612345678", GA: "06031234", GB: "7400123456", GD: "4734031234", GE: "555123456", GF: "694201234", GG: "7781123456", GH: "231234567", GI: "57123456", GL: "221234", GM: "3012345", GN: "601123456", GP: "690001234", GQ: "222123456", GR: "6912345678", GT: "51234567", GU: "6713001234", GW: "955012345", GY: "6091234", HK: "51234567", HN: "91234567", HR: "921234567", HT: "34101234", HU: "201234567", ID: "812345678", IE: "850123456", IL: "502345678", IM: "7924123456", IN: "8123456789", IO: "3801234", IQ: "7912345678", IR: "9123456789", IS: "6111234", IT: "3123456789", JE: "7797712345", JM: "8762101234", JO: "790123456", JP: "9012345678", KE: "712123456", KG: "700123456", KH: "91234567", KI: "72001234", KM: "3212345", KN: "8697652917", KP: "1921234567", KR: "1020000000", KW: "50012345", KY: "3453231234", KZ: "7710009998", LA: "2023123456", LB: "71123456", LC: "7582845678", LI: "660234567", LK: "712345678", LR: "770123456", LS: "50123456", LT: "61234567", LU: "628123456", LV: "21234567", LY: "912345678", MA: "650123456", MC: "612345678", MD: "62112345", ME: "67622901", MF: "690001234", MG: "321234567", MH: "2351234", MK: "72345678", ML: "65012345", MM: "92123456", MN: "88123456", MO: "66123456", MP: "6702345678", MQ: "696201234", MR: "22123456", MS: "6644923456", MT: "96961234", MU: "52512345", MV: "7712345", MW: "991234567", MX: "2221234567", MY: "123456789", MZ: "821234567", NA: "811234567", NC: "751234", NE: "93123456", NF: "381234", NG: "8021234567", NI: "81234567", NL: "612345678", NO: "40612345", NP: "9841234567", NR: "5551234", NU: "8884012", NZ: "211234567", OM: "92123456", PA: "61234567", PE: "912345678", PF: "87123456", PG: "70123456", PH: "9051234567", PK: "3012345678", PL: "512345678", PM: "551234", PR: "7872345678", PS: "599123456", PT: "912345678", PW: "6201234", PY: "961456789", QA: "33123456", RE: "692123456", RO: "712034567", RS: "601234567", RU: "9123456789", RW: "720123456", SA: "512345678", SB: "7421234", SC: "2510123", SD: "911231234", SE: "701234567", SG: "81234567", SH: "51234", SI: "31234567", SJ: "41234567", SK: "912123456", SL: "25123456", SM: "66661212", SN: "701234567", SO: "71123456", SR: "7412345", SS: "977123456", ST: "9812345", SV: "70123456", SX: "7215205678", SY: "944567890", SZ: "76123456", TA: "8999", TC: "6492311234", TD: "63012345", TG: "90112345", TH: "812345678", TJ: "917123456", TK: "7290", TL: "77212345", TM: "66123456", TN: "20123456", TO: "7715123", TR: "5012345678", TT: "8682911234", TV: "901234", TW: "912345678", TZ: "621234567", UA: "501234567", UG: "712345678", US: "2015550123", UY: "94231234", UZ: "912345678", VA: "3123456789", VC: "7844301234", VE: "4121234567", VG: "2843001234", VI: "3406421234", VN: "912345678", VU: "5912345", WF: "821234", WS: "7212345", XK: "43201234", YE: "712345678", YT: "639012345", ZA: "711234567", ZM: "955123456", ZW: "712345678" }, u = (n, r) => {
7
+ const s = S(() => {
8
+ if (!G.numberingPlan || !r)
9
+ return 20;
10
+ const { maxLength: e } = L(r);
11
+ return e || (Math.max(...G.numberingPlan.possibleLengths()) ?? 20);
12
+ }, [r]), m = S(
13
+ (e, t) => {
14
+ const { prefix: M, normalizer: a } = L(t);
15
+ if (M && e && !e.startsWith(M))
16
+ return M + e;
17
+ const E = a ? a(e) : e;
18
+ return I(E);
19
+ },
20
+ []
21
+ ), T = S(
22
+ (e) => {
23
+ const t = s(), a = m(e, r).slice(0, t);
24
+ return B(a, r);
25
+ },
26
+ [r, s, m]
27
+ ), A = S(
28
+ (e) => {
29
+ G.selectNumberingPlan(e);
30
+ const t = s(), M = n.slice(0, t), a = m(M, e);
31
+ return B(a, e);
32
+ },
33
+ [n, s, m]
34
+ ), o = N(() => r ? l(r ?? "US", i)?.formatNational().replace(/\d/g, "0") : "", [r]), P = N(() => r ? new K(r).input(n) : n, [r, n]);
35
+ return N(
36
+ () => ({
37
+ formatBeforePhoneNumberChange: T,
38
+ formatBeforeCountryCodeChange: A,
39
+ placeholder: o,
40
+ formattedDisplayNumber: P
41
+ }),
42
+ [
43
+ A,
44
+ T,
45
+ P,
46
+ o
47
+ ]
48
+ );
49
+ };
50
+ export {
51
+ u as usePhoneNumberFormatter
52
+ };
@@ -1,8 +1,9 @@
1
1
  import { ButtonHTMLAttributes, ReactNode } from 'react';
2
- import { ButtonVariant } from '../../theme/theme';
2
+ import { ButtonSize, ButtonVariant } from '../../../theme/theme';
3
3
  export interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
4
4
  isPending?: boolean;
5
5
  pendingLabel?: ReactNode;
6
+ size?: ButtonSize;
6
7
  variant?: ButtonVariant;
7
8
  }
8
9
  export declare const Button: import('react').ForwardRefExoticComponent<ButtonProps & import('react').RefAttributes<HTMLButtonElement>>;
@@ -0,0 +1,75 @@
1
+ import { jsx as e, jsxs as c, Fragment as y } from "react/jsx-runtime";
2
+ import { forwardRef as p, useMemo as a } from "react";
3
+ import { LoadingSpinner as B } from "../LoadingSpinner/index.js";
4
+ import { VisuallyHidden as k } from "../VisuallyHidden/index.js";
5
+ import "../../../theme/theme.js";
6
+ import '../../../assets/Button.css';const f = "Button-module__btn___Wj6Dr", g = "Button-module__primary___WGT--", z = "Button-module__secondary___Fx0LJ", r = {
7
+ btn: f,
8
+ "size-lg": "Button-module__size-lg___WlcVE",
9
+ "size-md": "Button-module__size-md___-SMmD",
10
+ "size-sm": "Button-module__size-sm___Vnrq6",
11
+ "link-primary": "Button-module__link-primary___6Zgkh",
12
+ "link-secondary": "Button-module__link-secondary___S0Qdo",
13
+ primary: g,
14
+ secondary: z,
15
+ "transparent-primary": "Button-module__transparent-primary___iwWv5",
16
+ "transparent-secondary": "Button-module__transparent-secondary___GfRXu"
17
+ }, h = p(
18
+ ({
19
+ children: s,
20
+ className: o = "",
21
+ isPending: i,
22
+ pendingLabel: m = "Loading...",
23
+ size: t = "lg",
24
+ variant: n = "primary",
25
+ ..._
26
+ }, d) => {
27
+ const u = a(() => {
28
+ if (n === "linkPrimary" || n === "linkSecondary")
29
+ return "";
30
+ switch (t) {
31
+ case "lg":
32
+ return r["size-lg"];
33
+ case "md":
34
+ return r["size-md"];
35
+ case "sm":
36
+ return r["size-sm"];
37
+ default:
38
+ return r["size-lg"];
39
+ }
40
+ }, [t, n]), l = a(() => {
41
+ switch (n) {
42
+ case "primary":
43
+ return r.primary;
44
+ case "secondary":
45
+ return r.secondary;
46
+ case "linkPrimary":
47
+ return r["link-primary"];
48
+ case "linkSecondary":
49
+ return r["link-secondary"];
50
+ case "transparentPrimary":
51
+ return r["transparent-primary"];
52
+ case "transparentSecondary":
53
+ return r["transparent-secondary"];
54
+ default:
55
+ return r.primary;
56
+ }
57
+ }, [n]);
58
+ return /* @__PURE__ */ e(
59
+ "button",
60
+ {
61
+ className: `${r.btn} ${u} ${l} ${o}`,
62
+ ref: d,
63
+ ..._,
64
+ children: i ? /* @__PURE__ */ c(y, { children: [
65
+ /* @__PURE__ */ e(B, { "aria-hidden": "true" }),
66
+ /* @__PURE__ */ e(k, { children: m })
67
+ ] }) : s
68
+ }
69
+ );
70
+ }
71
+ );
72
+ h.displayName = "Button";
73
+ export {
74
+ h as Button
75
+ };
@@ -1,5 +1,5 @@
1
- import { ReactNode } from 'react';
2
- export interface Props {
1
+ import { HTMLAttributes, ReactNode } from 'react';
2
+ export interface Props extends HTMLAttributes<HTMLParagraphElement> {
3
3
  children: ReactNode;
4
4
  id?: string;
5
5
  className?: string;
@@ -0,0 +1,16 @@
1
+ import { jsxs as m, jsx as r } from "react/jsx-runtime";
2
+ import { forwardRef as t } from "react";
3
+ import { IconExclamationCircle as a } from "../../../icons/IconExclamationCircle.js";
4
+ import '../../../assets/Error.css';const _ = "Error-module__error___zeTQt", l = "Error-module__icon___uwkis", o = {
5
+ error: _,
6
+ icon: l
7
+ }, p = t(
8
+ ({ children: e, id: s, className: c = "", ...n }, i) => /* @__PURE__ */ m("p", { id: s, className: `${o.error} ${c}`, ref: i, ...n, children: [
9
+ /* @__PURE__ */ r(a, { className: o.icon }),
10
+ /* @__PURE__ */ r("span", { children: e })
11
+ ] })
12
+ );
13
+ p.displayName = "Error";
14
+ export {
15
+ p as Error
16
+ };
@@ -0,0 +1,19 @@
1
+ import { jsx as d } from "react/jsx-runtime";
2
+ import "react";
3
+ import '../../../assets/LoadingSkeleton.css';const e = "LoadingSkeleton-module__loading___kqndV", i = {
4
+ loading: e
5
+ }, s = ({
6
+ as: o = "div",
7
+ className: n = "",
8
+ style: a
9
+ }) => /* @__PURE__ */ d(
10
+ o,
11
+ {
12
+ "aria-hidden": "true",
13
+ className: `${i.loading} ${n}`,
14
+ style: a
15
+ }
16
+ );
17
+ export {
18
+ s as LoadingSkeleton
19
+ };
@@ -1,8 +1,8 @@
1
1
  import { jsx as n } from "react/jsx-runtime";
2
- import '../../assets/LoadingSpinner.css';const i = "LoadingSpinner-module__spinner___X3Bl3", e = {
3
- spinner: i,
4
- "spinner-circle": "LoadingSpinner-module__spinner-circle___NCrsp"
5
- }, l = ({ className: r }) => /* @__PURE__ */ n(
2
+ import '../../../assets/LoadingSpinner.css';const r = "LoadingSpinner-module__spinner___-zo6Y", e = {
3
+ spinner: r,
4
+ "spinner-circle": "LoadingSpinner-module__spinner-circle___9Jfm7"
5
+ }, o = ({ className: i }) => /* @__PURE__ */ n(
6
6
  "svg",
7
7
  {
8
8
  xmlns: "http://www.w3.org/2000/svg",
@@ -12,7 +12,7 @@ import '../../assets/LoadingSpinner.css';const i = "LoadingSpinner-module__spinn
12
12
  width: "24",
13
13
  height: "24",
14
14
  stroke: "currentColor",
15
- className: r,
15
+ className: i,
16
16
  children: /* @__PURE__ */ n("g", { className: e.spinner, children: /* @__PURE__ */ n(
17
17
  "circle",
18
18
  {
@@ -27,5 +27,5 @@ import '../../assets/LoadingSpinner.css';const i = "LoadingSpinner-module__spinn
27
27
  }
28
28
  );
29
29
  export {
30
- l as LoadingSpinner
30
+ o as LoadingSpinner
31
31
  };
@@ -0,0 +1,11 @@
1
+ import { DialogContentProps } from '@radix-ui/react-dialog';
2
+ import { HTMLAttributes } from 'react';
3
+ interface ModalContentProps extends DialogContentProps, HTMLAttributes<HTMLDivElement> {
4
+ }
5
+ export declare const ModalContent: import('react').ForwardRefExoticComponent<ModalContentProps & import('react').RefAttributes<HTMLDivElement>>;
6
+ export declare const Modal: import('react').FC<import('@radix-ui/react-dialog').DialogProps>;
7
+ export declare const ModalClose: import('react').ForwardRefExoticComponent<import('@radix-ui/react-dialog').DialogCloseProps & import('react').RefAttributes<HTMLButtonElement>>;
8
+ export declare const ModalDescription: import('react').ForwardRefExoticComponent<import('@radix-ui/react-dialog').DialogDescriptionProps & import('react').RefAttributes<HTMLParagraphElement>>;
9
+ export declare const ModalTitle: import('react').ForwardRefExoticComponent<import('@radix-ui/react-dialog').DialogTitleProps & import('react').RefAttributes<HTMLHeadingElement>>;
10
+ export declare const ModalTrigger: import('react').ForwardRefExoticComponent<import('@radix-ui/react-dialog').DialogTriggerProps & import('react').RefAttributes<HTMLButtonElement>>;
11
+ export {};
@@ -0,0 +1,27 @@
1
+ import { jsx as o, jsxs as t } from "react/jsx-runtime";
2
+ import { DialogPortal as i, DialogOverlay as c, DialogContent as d, Dialog as n, DialogClose as m, DialogDescription as _, DialogTitle as g, DialogTrigger as p } from "@radix-ui/react-dialog";
3
+ import { forwardRef as M } from "react";
4
+ import { useTheme as D } from "../../ThemeProvider/index.js";
5
+ import '../../../assets/Modal.css';const f = "Modal-module__modal___MUsZA", y = "Modal-module__overlay___-RqGQ", v = "Modal-module__spacer___dIfOA", l = {
6
+ modal: f,
7
+ overlay: y,
8
+ spacer: v
9
+ }, u = M(
10
+ ({ children: a, ...e }, s) => {
11
+ const { cssVariables: r } = D();
12
+ return /* @__PURE__ */ o(i, { children: /* @__PURE__ */ t(c, { className: l.overlay, style: r, children: [
13
+ /* @__PURE__ */ o("div", { className: l.spacer }),
14
+ /* @__PURE__ */ o(d, { ...e, ref: s, className: l.modal, children: a })
15
+ ] }) });
16
+ }
17
+ );
18
+ u.displayName = "ModalContent";
19
+ const x = n, j = m, A = _, O = g, R = p;
20
+ export {
21
+ x as Modal,
22
+ j as ModalClose,
23
+ u as ModalContent,
24
+ A as ModalDescription,
25
+ O as ModalTitle,
26
+ R as ModalTrigger
27
+ };
@@ -1,12 +1,12 @@
1
1
  import { jsx as s } from "react/jsx-runtime";
2
2
  import "@coinbase/cdp-hooks";
3
3
  import { forwardRef as t } from "react";
4
- import { isApiError as p } from "../../utils/isApiError.js";
5
- import { Error as f } from "../Error/index.js";
4
+ import { Error as p } from "../Error/index.js";
5
+ import { isApiError as f } from "../../../utils/isApiError.js";
6
6
  const a = t(
7
7
  ({ error: r, id: o, className: e = "" }, m) => {
8
- const i = p(r) ? r.errorMessage : r;
9
- return /* @__PURE__ */ s(f, { ref: m, id: o, className: e, children: i });
8
+ const i = f(r) ? r.errorMessage : r;
9
+ return /* @__PURE__ */ s(p, { ref: m, id: o, className: e, children: i });
10
10
  }
11
11
  );
12
12
  a.displayName = "ServerError";
@@ -0,0 +1,7 @@
1
+ import { HTMLAttributes, ReactNode } from 'react';
2
+ export interface Props extends HTMLAttributes<HTMLParagraphElement> {
3
+ children: ReactNode;
4
+ id?: string;
5
+ className?: string;
6
+ }
7
+ export declare const SuccessMessage: import('react').ForwardRefExoticComponent<Props & import('react').RefAttributes<HTMLParagraphElement>>;
@@ -0,0 +1,16 @@
1
+ import { jsxs as m, jsx as s } from "react/jsx-runtime";
2
+ import { forwardRef as u } from "react";
3
+ import { IconCheckCircle as i } from "../../../icons/IconCheckCircle.js";
4
+ import '../../../assets/SuccessMessage.css';const t = "SuccessMessage-module__success___ZOELg", _ = "SuccessMessage-module__icon___QpPW-", c = {
5
+ success: t,
6
+ icon: _
7
+ }, l = u(
8
+ ({ children: e, id: o, className: r = "", ...a }, n) => /* @__PURE__ */ m("p", { id: o, className: `${c.success} ${r}`, ref: n, ...a, children: [
9
+ /* @__PURE__ */ s(i, { className: c.icon }),
10
+ /* @__PURE__ */ s("span", { children: e })
11
+ ] })
12
+ );
13
+ l.displayName = "SuccessMessage";
14
+ export {
15
+ l as SuccessMessage
16
+ };
@@ -0,0 +1,5 @@
1
+ import { Key } from 'react';
2
+ import { SwitchTransitionProps, SwitchTransitionRef } from '../SwitchTransition/SwitchTransition';
3
+ export type SwitchFadeTransitionProps<T extends Key> = Omit<SwitchTransitionProps<T>, "transitionName" | "unmountOnExit" | "mountOnEnter" | "preEnter">;
4
+ export type SwitchFadeTransitionRef<T extends Key> = SwitchTransitionRef<T>;
5
+ export declare const SwitchFadeTransition: <T extends Key>({ children, className, ...props }: SwitchFadeTransitionProps<T>) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,24 @@
1
+ import { jsx as r } from "react/jsx-runtime";
2
+ import "react";
3
+ import { SwitchTransition as e } from "../SwitchTransition/index.js";
4
+ import '../../../assets/SwitchFadeTransition.css';const o = {
5
+ "switch-fade-transition": "SwitchFadeTransition-module__switch-fade-transition___--lbT"
6
+ }, c = ({
7
+ children: t,
8
+ className: i = "",
9
+ ...n
10
+ }) => /* @__PURE__ */ r(
11
+ e,
12
+ {
13
+ transitionName: "fade",
14
+ className: `${o["switch-fade-transition"]} ${i}`,
15
+ preEnter: !0,
16
+ mountOnEnter: !0,
17
+ unmountOnExit: !0,
18
+ ...n,
19
+ children: t
20
+ }
21
+ );
22
+ export {
23
+ c as SwitchFadeTransition
24
+ };
@@ -0,0 +1,7 @@
1
+ import { Key } from 'react';
2
+ import { SwitchTransitionProps, SwitchTransitionRef } from '../SwitchTransition/SwitchTransition';
3
+ export interface SwitchSlideTransitionProps<T extends Key> extends Omit<SwitchTransitionProps<T>, "transitionName" | "unmountOnExit" | "mountOnEnter" | "preEnter"> {
4
+ direction?: "left" | "right";
5
+ }
6
+ export type SwitchSlideTransitionRef<T extends Key> = SwitchTransitionRef<T>;
7
+ export declare const SwitchSlideTransition: <T extends Key>({ children, className, direction, timeout, ...props }: SwitchSlideTransitionProps<T>) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,27 @@
1
+ import { jsx as e } from "react/jsx-runtime";
2
+ import "react";
3
+ import { SwitchTransition as o } from "../SwitchTransition/index.js";
4
+ import '../../../assets/SwitchSlideTransition.css';const a = {
5
+ "switch-slide-transition": "SwitchSlideTransition-module__switch-slide-transition___FykQG"
6
+ }, u = ({
7
+ children: t,
8
+ className: i = "",
9
+ direction: n = "left",
10
+ timeout: r = 300,
11
+ ...s
12
+ }) => /* @__PURE__ */ e(
13
+ o,
14
+ {
15
+ transitionName: `slide-${n}`,
16
+ className: `${a["switch-slide-transition"]} ${i}`,
17
+ preEnter: !0,
18
+ mountOnEnter: !0,
19
+ unmountOnExit: !0,
20
+ timeout: r,
21
+ ...s,
22
+ children: t
23
+ }
24
+ );
25
+ export {
26
+ u as SwitchSlideTransition
27
+ };
@@ -0,0 +1,25 @@
1
+ import { ElementType, HTMLAttributes, Key, ReactNode, Ref } from 'react';
2
+ import { TransitionMapOptions, TransitionMapResult, TransitionState } from 'react-transition-state';
3
+ export interface SwitchTransitionRef<T extends Key> {
4
+ transition: TransitionMapResult<T>;
5
+ }
6
+ export interface SwitchTransitionProps<T extends Key> extends Omit<HTMLAttributes<HTMLElement>, "children">, TransitionMapOptions<T> {
7
+ animateHeight?: boolean;
8
+ autoFocus?: boolean;
9
+ as?: ElementType;
10
+ children: (props: {
11
+ "data-index": number;
12
+ inert?: boolean;
13
+ itemKey: T;
14
+ "data-transition": string;
15
+ "data-status": TransitionState["status"] | undefined;
16
+ "data-is-enter": TransitionState["isEnter"] | undefined;
17
+ "data-is-resolved": TransitionState["isResolved"] | undefined;
18
+ "data-parent": string;
19
+ }) => ReactNode;
20
+ className?: string;
21
+ items: readonly T[] | T[];
22
+ transitionName: "fade" | "slide-left" | "slide-right" | string;
23
+ transitionRef?: Ref<SwitchTransitionRef<T>>;
24
+ }
25
+ export declare const SwitchTransition: <T extends Key>({ allowMultiple, animateHeight, autoFocus, initialEntered, as: Component, children, className, enter, exit, items, mountOnEnter, onStateChange, preEnter, preExit, style, timeout, transitionName, transitionRef, unmountOnExit, ...props }: SwitchTransitionProps<T>) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,155 @@
1
+ import { jsx as m, Fragment as B } from "react/jsx-runtime";
2
+ import { useId as D, useState as R, useRef as F, useImperativeHandle as G, useLayoutEffect as _, useEffect as H } from "react";
3
+ import { useTransitionMap as J } from "react-transition-state";
4
+ import '../../../assets/SwitchTransition.css';const P = {
5
+ "transition-wrapper": "SwitchTransition-module__transition-wrapper___jrI35"
6
+ }, Q = (h) => {
7
+ const {
8
+ children: r,
9
+ index: d,
10
+ itemKey: i,
11
+ initialEntered: l,
12
+ setItem: u,
13
+ deleteItem: f,
14
+ stateMap: b,
15
+ transitionName: v,
16
+ parentKey: y
17
+ } = h;
18
+ H(() => (u(i, { initialEntered: l }), () => {
19
+ f(i);
20
+ }), [i, l, u, f]);
21
+ const { isEnter: p, isMounted: I, isResolved: w, status: x } = b.get(i) || {};
22
+ return I ? r({
23
+ "data-index": d,
24
+ inert: !p,
25
+ itemKey: i,
26
+ "data-transition": v,
27
+ "data-status": x,
28
+ "data-is-enter": p,
29
+ "data-is-resolved": w,
30
+ "data-parent": y
31
+ }) : null;
32
+ }, X = ({
33
+ allowMultiple: h,
34
+ animateHeight: r,
35
+ autoFocus: d,
36
+ initialEntered: i,
37
+ as: l = "div",
38
+ children: u,
39
+ className: f = "",
40
+ enter: b,
41
+ exit: v,
42
+ items: y,
43
+ mountOnEnter: p,
44
+ onStateChange: I,
45
+ preEnter: w,
46
+ preExit: x,
47
+ style: j,
48
+ timeout: e = 200,
49
+ transitionName: T,
50
+ transitionRef: q,
51
+ unmountOnExit: z,
52
+ ...$
53
+ }) => {
54
+ const L = D(), s = $.id || L, [E, N] = R(null), [S, C] = R(null), g = F(null), o = J({
55
+ allowMultiple: h,
56
+ initialEntered: !1,
57
+ mountOnEnter: p,
58
+ unmountOnExit: z,
59
+ preEnter: w,
60
+ preExit: x,
61
+ enter: b,
62
+ exit: v,
63
+ timeout: e,
64
+ onStateChange: I
65
+ });
66
+ G(q, () => ({
67
+ transition: r || d ? {
68
+ ...o,
69
+ toggle: (t) => {
70
+ o.toggle(t), N(t);
71
+ }
72
+ } : o
73
+ })), _(() => {
74
+ if (!r)
75
+ return;
76
+ let t = null;
77
+ const n = g.current;
78
+ if (!n)
79
+ return;
80
+ const c = setTimeout(() => {
81
+ const a = n.querySelector(
82
+ `[data-is-enter="true"][data-parent="${s}"]`
83
+ );
84
+ if (!a)
85
+ return;
86
+ const M = a?.scrollHeight ?? null;
87
+ M !== null && C(M), t = new ResizeObserver((O) => {
88
+ for (const k of O) {
89
+ const A = k.contentRect.height;
90
+ C(A);
91
+ }
92
+ }), t.observe(a);
93
+ }, 0);
94
+ return () => {
95
+ c && clearTimeout(c), t?.disconnect();
96
+ };
97
+ }, [r, E, s]), _(() => {
98
+ if (!d)
99
+ return;
100
+ const t = typeof e == "number" ? e : e.enter;
101
+ if (t === void 0)
102
+ return;
103
+ const n = setTimeout(() => {
104
+ const c = g.current?.querySelector(
105
+ `[data-is-enter="true"][data-parent="${s}"]`
106
+ );
107
+ if (!c)
108
+ return;
109
+ const a = c.querySelector(
110
+ 'input, textarea, select, button, [tabindex]:not([tabindex="-1"])'
111
+ );
112
+ a && a.focus();
113
+ }, t);
114
+ return () => {
115
+ n && clearTimeout(n);
116
+ };
117
+ }, [d, E, s, e]);
118
+ const K = /* @__PURE__ */ m(B, { children: y.map((t, n) => /* @__PURE__ */ m(
119
+ Q,
120
+ {
121
+ index: n,
122
+ itemKey: t,
123
+ setItem: o.setItem,
124
+ deleteItem: o.deleteItem,
125
+ stateMap: o.stateMap,
126
+ initialEntered: i ? n === 0 : void 0,
127
+ transitionName: T,
128
+ parentKey: s,
129
+ children: u
130
+ },
131
+ n
132
+ )) });
133
+ return /* @__PURE__ */ m(
134
+ l,
135
+ {
136
+ ...$,
137
+ id: s,
138
+ ref: g,
139
+ "data-transition": T || void 0,
140
+ "data-animate-height": r,
141
+ className: `${P["transition-wrapper"]} ${f}`,
142
+ style: {
143
+ ...j,
144
+ "--cdp-web-transition-enter-timeout": typeof e == "object" ? `${e.enter ?? 200}ms` : void 0,
145
+ "--cdp-web-transition-exit-timeout": typeof e == "object" ? `${e.exit ?? 200}ms` : void 0,
146
+ "--cdp-web-transition-timeout": typeof e == "number" ? `${e}ms` : void 0,
147
+ "--cdp-web-transition-height": r && S ? `${S}px` : void 0
148
+ },
149
+ children: r ? /* @__PURE__ */ m("div", { children: K }) : K
150
+ }
151
+ );
152
+ };
153
+ export {
154
+ X as SwitchTransition
155
+ };
@@ -1,7 +1,7 @@
1
1
  import { jsx as i } from "react/jsx-runtime";
2
2
  import "react";
3
- import '../../assets/VisuallyHidden.css';const d = {
4
- "visually-hidden": "VisuallyHidden-module__visually-hidden___qdUPg"
3
+ import '../../../assets/VisuallyHidden.css';const d = {
4
+ "visually-hidden": "VisuallyHidden-module__visually-hidden___tD5Vj"
5
5
  }, a = ({ as: s = "span", children: l }) => l ? /* @__PURE__ */ i(s, { className: d["visually-hidden"], children: l }) : null;
6
6
  export {
7
7
  a as VisuallyHidden
@@ -0,0 +1,12 @@
1
+ import { CountryCallingCode, CountryCode as ICountryCode } from 'libphonenumber-js';
2
+ export type CountryCode = ICountryCode;
3
+ export type CountryOption = {
4
+ callingCode: CountryCallingCode;
5
+ code: CountryCode;
6
+ flag: string;
7
+ name: string;
8
+ };
9
+ export declare const OFAC_BLOCKED_COUNTRIES: string[];
10
+ export declare const DEFAULT_COUNTRY_CODE: CountryCode;
11
+ export declare const nonThrowingGetCountryCallingCode: (countryCode: CountryCode) => CountryCallingCode | undefined;
12
+ export declare const countries: CountryOption[];