@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
package/package.json CHANGED
@@ -1,16 +1,18 @@
1
1
  {
2
2
  "name": "@coinbase/cdp-react",
3
- "version": "0.0.18",
3
+ "version": "0.0.20",
4
4
  "type": "module",
5
5
  "dependencies": {
6
6
  "@radix-ui/react-dialog": "^1.1.14",
7
7
  "@radix-ui/react-form": "^0.1.7",
8
- "@radix-ui/react-one-time-password-field": "^0.1.7"
8
+ "@radix-ui/react-one-time-password-field": "^0.1.7",
9
+ "react-transition-state": "2.3.0",
10
+ "libphonenumber-js": "^1.12.10"
9
11
  },
10
12
  "peerDependencies": {
11
13
  "react": ">=18.2.0",
12
- "@coinbase/cdp-core": "^0.0.18",
13
- "@coinbase/cdp-hooks": "^0.0.18"
14
+ "@coinbase/cdp-core": "^0.0.20",
15
+ "@coinbase/cdp-hooks": "^0.0.20"
14
16
  },
15
17
  "devDependencies": {
16
18
  "@size-limit/preset-big-lib": "^11.2.0",
@@ -31,6 +33,7 @@
31
33
  "glob": "^11.0.3",
32
34
  "react": "^19.1.0",
33
35
  "react-dom": "^19.1.0",
36
+ "rollup-plugin-visualizer": "^6.0.3",
34
37
  "size-limit": "^11.2.0",
35
38
  "stylelint": "^16.22.0",
36
39
  "stylelint-config-standard": "^38.0.0",
@@ -38,8 +41,8 @@
38
41
  "vite": "^7.0.4",
39
42
  "vite-plugin-dts": "^4.5.4",
40
43
  "vite-plugin-lib-inject-css": "^2.2.2",
41
- "@coinbase/cdp-core": "^0.0.18",
42
- "@coinbase/cdp-hooks": "^0.0.18"
44
+ "@coinbase/cdp-core": "^0.0.20",
45
+ "@coinbase/cdp-hooks": "^0.0.20"
43
46
  },
44
47
  "size-limit": [
45
48
  {
@@ -47,7 +50,7 @@
47
50
  "path": "./dist/index.js",
48
51
  "import": "*",
49
52
  "running": false,
50
- "limit": "65 KB"
53
+ "limit": "70 KB"
51
54
  },
52
55
  {
53
56
  "name": "single-component",
@@ -77,6 +80,18 @@
77
80
  "default": "./dist/components/*/index.js"
78
81
  }
79
82
  },
83
+ "./components/forms/*": {
84
+ "import": {
85
+ "types": "./dist/components/forms/*/index.d.ts",
86
+ "default": "./dist/components/forms/*/index.js"
87
+ }
88
+ },
89
+ "./components/ui/*": {
90
+ "import": {
91
+ "types": "./dist/components/ui/*/index.d.ts",
92
+ "default": "./dist/components/ui/*/index.js"
93
+ }
94
+ },
80
95
  "./icons": {
81
96
  "import": {
82
97
  "types": "./dist/icons/index.d.ts",
@@ -105,6 +120,7 @@
105
120
  "scripts": {
106
121
  "build": "pnpm run check:types && vite build",
107
122
  "build:watch": "vite build --watch",
123
+ "analyze": "vite build --config vite-analyze.config.ts",
108
124
  "check:types": "tsc --noEmit",
109
125
  "clean": "rm -rf dist",
110
126
  "clean:all": "pnpm clean && rm -rf node_modules",
@@ -1,50 +0,0 @@
1
- import { jsx as n, jsxs as d, Fragment as y } from "react/jsx-runtime";
2
- import { forwardRef as c, useMemo as p } from "react";
3
- import "../../theme/theme.js";
4
- import { LoadingSpinner as u } from "../LoadingSpinner/index.js";
5
- import { VisuallyHidden as l } from "../VisuallyHidden/index.js";
6
- import '../../assets/Button.css';const k = "Button-module__btn___Fx11X", B = "Button-module__primary___s1sM6", f = "Button-module__secondary___R0waJ", r = {
7
- btn: k,
8
- "link-primary": "Button-module__link-primary___wROmv",
9
- "link-secondary": "Button-module__link-secondary___5VErP",
10
- primary: B,
11
- secondary: f,
12
- "transparent-primary": "Button-module__transparent-primary___Ah0yM",
13
- "transparent-secondary": "Button-module__transparent-secondary___kk5sZ"
14
- }, h = c(
15
- ({
16
- children: t,
17
- className: e = "",
18
- isPending: o,
19
- pendingLabel: s = "Loading...",
20
- variant: a = "primary",
21
- ...i
22
- }, m) => {
23
- const _ = p(() => {
24
- switch (a) {
25
- case "primary":
26
- return r.primary;
27
- case "secondary":
28
- return r.secondary;
29
- case "linkPrimary":
30
- return r["link-primary"];
31
- case "linkSecondary":
32
- return r["link-secondary"];
33
- case "transparentPrimary":
34
- return r["transparent-primary"];
35
- case "transparentSecondary":
36
- return r["transparent-secondary"];
37
- default:
38
- return r.primary;
39
- }
40
- }, [a]);
41
- return /* @__PURE__ */ n("button", { className: `${r.btn} ${_} ${e}`, ref: m, ...i, children: o ? /* @__PURE__ */ d(y, { children: [
42
- /* @__PURE__ */ n(u, { "aria-hidden": "true" }),
43
- /* @__PURE__ */ n(l, { children: s })
44
- ] }) : t });
45
- }
46
- );
47
- h.displayName = "Button";
48
- export {
49
- h as Button
50
- };
@@ -1,16 +0,0 @@
1
- import { jsxs as n, jsx as r } from "react/jsx-runtime";
2
- import { forwardRef as i } from "react";
3
- import { IconExclamationCircle as t } from "../../icons/IconExclamationCircle.js";
4
- import '../../assets/Error.css';const a = "Error-module__error___mRFLG", _ = "Error-module__icon___web4F", o = {
5
- error: a,
6
- icon: _
7
- }, l = i(
8
- ({ children: e, id: s, className: c = "" }, m) => /* @__PURE__ */ n("p", { id: s, className: `${o.error} ${c}`, ref: m, children: [
9
- /* @__PURE__ */ r(t, { className: o.icon }),
10
- /* @__PURE__ */ r("span", { children: e })
11
- ] })
12
- );
13
- l.displayName = "Error";
14
- export {
15
- l as Error
16
- };
@@ -1,22 +0,0 @@
1
- import { jsxs as c, jsx as e } from "react/jsx-runtime";
2
- import { FormField as n, FormLabel as _, FormValidityState as F, FormControl as h, FormMessage as f } from "@radix-ui/react-form";
3
- import "react";
4
- import { Error as b } from "../Error/index.js";
5
- import '../../assets/Field.css';const u = "Field-module__label___LAQio", i = {
6
- "field-wrapper": "Field-module__field-wrapper___0p4i7",
7
- label: u
8
- }, y = ({
9
- children: l,
10
- className: o = "",
11
- label: a,
12
- name: d,
13
- style: m,
14
- validators: s
15
- }) => /* @__PURE__ */ c(n, { name: d, className: `${o} ${i["field-wrapper"]}`, style: m, children: [
16
- /* @__PURE__ */ e(_, { className: i.label, children: a }),
17
- /* @__PURE__ */ e(F, { children: (r) => l && /* @__PURE__ */ e(h, { asChild: !0, children: l(r) }) }),
18
- s?.map(([r, t], p) => /* @__PURE__ */ e(f, { match: r, asChild: !0, children: /* @__PURE__ */ e(b, { children: t }) }, p))
19
- ] });
20
- export {
21
- y as Field
22
- };
@@ -1,19 +0,0 @@
1
- import { jsx as a } from "react/jsx-runtime";
2
- import "react";
3
- import '../../assets/LoadingSkeleton.css';const i = "LoadingSkeleton-module__loading___ezIkq", t = {
4
- loading: i
5
- }, s = ({
6
- as: o = "div",
7
- className: n = "",
8
- style: e
9
- }) => /* @__PURE__ */ a(
10
- o,
11
- {
12
- "aria-hidden": "true",
13
- className: `${t.loading} ${n}`,
14
- style: e
15
- }
16
- );
17
- export {
18
- s as LoadingSkeleton
19
- };
@@ -1,50 +0,0 @@
1
- import { jsxs as d, jsx as o } from "react/jsx-runtime";
2
- import { OneTimePasswordField as _, OneTimePasswordFieldInput as f, OneTimePasswordFieldHiddenInput as P } from "@radix-ui/react-one-time-password-field";
3
- import { forwardRef as O, useId as T, useRef as h, useEffect as y } from "react";
4
- import { Input as I } from "../Input/index.js";
5
- import { Error as v } from "../Error/index.js";
6
- import '../../assets/OTP.css';const w = "OTP-module__otp___EUcSo", N = "OTP-module__input___MEBPV", r = {
7
- otp: w,
8
- "group-container": "OTP-module__group-container___rfrCo",
9
- "input-container": "OTP-module__input-container___-yRBL",
10
- input: N
11
- }, R = O(
12
- ({ error: i, passwordLength: s = 6, className: l = "", ...c }, n) => {
13
- const u = T(), a = h(/* @__PURE__ */ new Map()), p = (e, t) => {
14
- e ? a.current.set(t, e) : a.current.delete(t);
15
- };
16
- return y(() => {
17
- const e = Array.from(a.current.values());
18
- typeof n == "function" ? n(e) : n && (n.current = e);
19
- }, [s, n]), /* @__PURE__ */ d("div", { className: `${r.otp} ${l}`, children: [
20
- /* @__PURE__ */ d(
21
- _,
22
- {
23
- ...c,
24
- className: r["group-container"],
25
- "aria-invalid": !!i,
26
- "aria-describedby": i ? u : void 0,
27
- style: {
28
- "--cdp-web-otp-input-width": `${Math.floor(100 / s)}%`
29
- },
30
- children: [
31
- Array.from({ length: s }, (e, t) => /* @__PURE__ */ o("div", { className: r["input-container"], children: /* @__PURE__ */ o(f, { asChild: !0, children: /* @__PURE__ */ o(
32
- I,
33
- {
34
- name: `${c.name || "otp"}-${t}`,
35
- ref: (m) => p(m, t),
36
- className: r.input
37
- }
38
- ) }) }, t)),
39
- /* @__PURE__ */ o(P, {})
40
- ]
41
- }
42
- ),
43
- i && /* @__PURE__ */ o(v, { id: u, children: i })
44
- ] });
45
- }
46
- );
47
- R.displayName = "OTP";
48
- export {
49
- R as OTP
50
- };