@coinbase/cdp-react 0.0.19 → 0.0.21

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 (96) hide show
  1. package/dist/assets/Button.css +1 -1
  2. package/dist/assets/EmailForm.css +1 -1
  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 -1
  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 -1
  12. package/dist/assets/PhoneNumberForm.css +1 -1
  13. package/dist/assets/PhoneNumberInput.css +1 -1
  14. package/dist/assets/SignInAuthMethodButtons.css +1 -1
  15. package/dist/assets/SignInModal.css +1 -1
  16. package/dist/assets/SuccessMessage.css +1 -1
  17. package/dist/assets/SwitchFadeTransition.css +1 -1
  18. package/dist/assets/SwitchSlideTransition.css +1 -1
  19. package/dist/assets/SwitchTransition.css +1 -1
  20. package/dist/assets/ThemeProvider.css +1 -1
  21. package/dist/assets/VisuallyHidden.css +1 -1
  22. package/dist/components/AuthButton/index.js +6 -6
  23. package/dist/components/SendTransactionButton/index.js +1 -1
  24. package/dist/components/SignIn/SignInAuthMethodButtons.js +21 -19
  25. package/dist/components/SignIn/SignInBackButton.js +1 -1
  26. package/dist/components/SignIn/SignInForm.d.ts +1 -1
  27. package/dist/components/SignIn/SignInForm.js +21 -15
  28. package/dist/components/SignIn/flows/SignInWithEmail.d.ts +1 -0
  29. package/dist/components/SignIn/flows/SignInWithEmail.js +68 -51
  30. package/dist/components/SignIn/flows/SignInWithSms.d.ts +3 -0
  31. package/dist/components/SignIn/flows/SignInWithSms.js +519 -502
  32. package/dist/components/SignInModal/index.js +48 -55
  33. package/dist/components/SignOutButton/index.js +1 -1
  34. package/dist/components/ThemeProvider/index.js +1 -1
  35. package/dist/components/{EmailForm → forms/EmailForm}/index.js +10 -10
  36. package/dist/components/forms/Field/index.js +24 -0
  37. package/dist/components/{Input → forms/Input}/index.js +1 -1
  38. package/dist/components/{Label → forms/Label}/index.js +1 -1
  39. package/dist/components/forms/OTP/index.js +65 -0
  40. package/dist/components/{OTPForm → forms/OTPForm}/index.js +28 -28
  41. package/dist/components/{PhoneNumberForm → forms/PhoneNumberForm}/index.js +19 -19
  42. package/dist/components/{PhoneNumberInput → forms/PhoneNumberInput}/index.d.ts +1 -1
  43. package/dist/components/forms/PhoneNumberInput/index.js +76 -0
  44. package/dist/components/{PhoneNumberInput → forms/PhoneNumberInput}/maskOverride.js +1 -1
  45. package/dist/components/{PhoneNumberInput → forms/PhoneNumberInput}/usePhoneNumberFormatter.d.ts +2 -2
  46. package/dist/components/{PhoneNumberInput → forms/PhoneNumberInput}/usePhoneNumberFormatter.js +1 -1
  47. package/dist/components/{Button → ui/Button}/index.d.ts +1 -1
  48. package/dist/components/{Button → ui/Button}/index.js +20 -20
  49. package/dist/components/ui/Error/index.js +16 -0
  50. package/dist/components/ui/LoadingSkeleton/index.js +19 -0
  51. package/dist/components/{LoadingSpinner → ui/LoadingSpinner}/index.js +6 -6
  52. package/dist/components/ui/Modal/index.d.ts +11 -0
  53. package/dist/components/ui/Modal/index.js +27 -0
  54. package/dist/components/{ServerError → ui/ServerError}/index.js +1 -1
  55. package/dist/components/ui/SuccessMessage/index.js +16 -0
  56. package/dist/components/{SwitchFadeTransition → ui/SwitchFadeTransition}/index.js +2 -2
  57. package/dist/components/{SwitchSlideTransition → ui/SwitchSlideTransition}/index.js +2 -2
  58. package/dist/components/{SwitchTransition → ui/SwitchTransition}/index.d.ts +1 -1
  59. package/dist/components/{SwitchTransition → ui/SwitchTransition}/index.js +27 -27
  60. package/dist/components/{VisuallyHidden → ui/VisuallyHidden}/index.js +2 -2
  61. package/dist/theme/theme.d.ts +1 -1
  62. package/dist/theme/tokens.d.ts +2 -2
  63. package/dist/theme/tokens.js +1 -1
  64. package/package.json +17 -5
  65. package/dist/assets/FlowEmailOTP.css +0 -1
  66. package/dist/assets/FlowPhoneNumberOTP.css +0 -1
  67. package/dist/components/Error/index.js +0 -16
  68. package/dist/components/Field/index.js +0 -24
  69. package/dist/components/FlowEmailOTP/index.d.ts +0 -18
  70. package/dist/components/FlowEmailOTP/index.js +0 -70
  71. package/dist/components/FlowPhoneNumberOTP/index.d.ts +0 -18
  72. package/dist/components/FlowPhoneNumberOTP/index.js +0 -75
  73. package/dist/components/LoadingSkeleton/index.js +0 -19
  74. package/dist/components/OTP/index.js +0 -65
  75. package/dist/components/PhoneNumberInput/index.js +0 -76
  76. package/dist/components/SuccessMessage/index.js +0 -16
  77. package/dist/utils/validatePhoneNumber.d.ts +0 -1
  78. package/dist/utils/validatePhoneNumber.js +0 -1
  79. /package/dist/components/{EmailForm → forms/EmailForm}/index.d.ts +0 -0
  80. /package/dist/components/{Field → forms/Field}/index.d.ts +0 -0
  81. /package/dist/components/{Input → forms/Input}/index.d.ts +0 -0
  82. /package/dist/components/{Label → forms/Label}/index.d.ts +0 -0
  83. /package/dist/components/{OTP → forms/OTP}/index.d.ts +0 -0
  84. /package/dist/components/{OTPForm → forms/OTPForm}/index.d.ts +0 -0
  85. /package/dist/components/{PhoneNumberForm → forms/PhoneNumberForm}/index.d.ts +0 -0
  86. /package/dist/components/{PhoneNumberInput → forms/PhoneNumberInput}/PhoneNumberMetadata.d.ts +0 -0
  87. /package/dist/components/{PhoneNumberInput → forms/PhoneNumberInput}/PhoneNumberMetadata.js +0 -0
  88. /package/dist/components/{PhoneNumberInput → forms/PhoneNumberInput}/maskOverride.d.ts +0 -0
  89. /package/dist/components/{Error → ui/Error}/index.d.ts +0 -0
  90. /package/dist/components/{LoadingSkeleton → ui/LoadingSkeleton}/index.d.ts +0 -0
  91. /package/dist/components/{LoadingSpinner → ui/LoadingSpinner}/index.d.ts +0 -0
  92. /package/dist/components/{ServerError → ui/ServerError}/index.d.ts +0 -0
  93. /package/dist/components/{SuccessMessage → ui/SuccessMessage}/index.d.ts +0 -0
  94. /package/dist/components/{SwitchFadeTransition → ui/SwitchFadeTransition}/index.d.ts +0 -0
  95. /package/dist/components/{SwitchSlideTransition → ui/SwitchSlideTransition}/index.d.ts +0 -0
  96. /package/dist/components/{VisuallyHidden → ui/VisuallyHidden}/index.d.ts +0 -0
@@ -1,30 +1,30 @@
1
1
  import { jsx as e, jsxs as c, Fragment as y } from "react/jsx-runtime";
2
- import { forwardRef as p, useMemo as s } from "react";
3
- import "../../theme/theme.js";
2
+ import { forwardRef as p, useMemo as a } from "react";
4
3
  import { LoadingSpinner as B } from "../LoadingSpinner/index.js";
5
4
  import { VisuallyHidden as k } from "../VisuallyHidden/index.js";
6
- import '../../assets/Button.css';const g = "Button-module__btn___Fx11X", z = "Button-module__primary___s1sM6", f = "Button-module__secondary___R0waJ", r = {
7
- btn: g,
8
- "size-lg": "Button-module__size-lg___2sR8u",
9
- "size-md": "Button-module__size-md___HBcrV",
10
- "size-sm": "Button-module__size-sm___yph5g",
11
- "link-primary": "Button-module__link-primary___wROmv",
12
- "link-secondary": "Button-module__link-secondary___5VErP",
13
- primary: z,
14
- secondary: f,
15
- "transparent-primary": "Button-module__transparent-primary___Ah0yM",
16
- "transparent-secondary": "Button-module__transparent-secondary___kk5sZ"
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
17
  }, h = p(
18
18
  ({
19
- children: a,
19
+ children: s,
20
20
  className: o = "",
21
21
  isPending: i,
22
22
  pendingLabel: m = "Loading...",
23
23
  size: t = "lg",
24
24
  variant: n = "primary",
25
25
  ..._
26
- }, u) => {
27
- const d = s(() => {
26
+ }, d) => {
27
+ const u = a(() => {
28
28
  if (n === "linkPrimary" || n === "linkSecondary")
29
29
  return "";
30
30
  switch (t) {
@@ -37,7 +37,7 @@ import '../../assets/Button.css';const g = "Button-module__btn___Fx11X", z = "Bu
37
37
  default:
38
38
  return r["size-lg"];
39
39
  }
40
- }, [t, n]), l = s(() => {
40
+ }, [t, n]), l = a(() => {
41
41
  switch (n) {
42
42
  case "primary":
43
43
  return r.primary;
@@ -58,13 +58,13 @@ import '../../assets/Button.css';const g = "Button-module__btn___Fx11X", z = "Bu
58
58
  return /* @__PURE__ */ e(
59
59
  "button",
60
60
  {
61
- className: `${r.btn} ${d} ${l} ${o}`,
62
- ref: u,
61
+ className: `${r.btn} ${u} ${l} ${o}`,
62
+ ref: d,
63
63
  ..._,
64
64
  children: i ? /* @__PURE__ */ c(y, { children: [
65
65
  /* @__PURE__ */ e(B, { "aria-hidden": "true" }),
66
66
  /* @__PURE__ */ e(k, { children: m })
67
- ] }) : a
67
+ ] }) : s
68
68
  }
69
69
  );
70
70
  }
@@ -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
+ };
@@ -2,7 +2,7 @@ import { jsx as s } from "react/jsx-runtime";
2
2
  import "@coinbase/cdp-hooks";
3
3
  import { forwardRef as t } from "react";
4
4
  import { Error as p } from "../Error/index.js";
5
- import { isApiError as f } from "../../utils/isApiError.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
8
  const i = f(r) ? r.errorMessage : r;
@@ -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
+ };
@@ -1,8 +1,8 @@
1
1
  import { jsx as r } from "react/jsx-runtime";
2
2
  import "react";
3
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___0ACbj"
4
+ import '../../../assets/SwitchFadeTransition.css';const o = {
5
+ "switch-fade-transition": "SwitchFadeTransition-module__switch-fade-transition___--lbT"
6
6
  }, c = ({
7
7
  children: t,
8
8
  className: i = "",
@@ -1,8 +1,8 @@
1
1
  import { jsx as e } from "react/jsx-runtime";
2
2
  import "react";
3
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___iPQKq"
4
+ import '../../../assets/SwitchSlideTransition.css';const a = {
5
+ "switch-slide-transition": "SwitchSlideTransition-module__switch-slide-transition___FykQG"
6
6
  }, u = ({
7
7
  children: t,
8
8
  className: i = "",
@@ -18,7 +18,7 @@ export interface SwitchTransitionProps<T extends Key> extends Omit<HTMLAttribute
18
18
  "data-parent": string;
19
19
  }) => ReactNode;
20
20
  className?: string;
21
- items: T[];
21
+ items: readonly T[] | T[];
22
22
  transitionName: "fade" | "slide-left" | "slide-right" | string;
23
23
  transitionRef?: Ref<SwitchTransitionRef<T>>;
24
24
  }
@@ -1,9 +1,9 @@
1
- import { jsx as m, Fragment as W } from "react/jsx-runtime";
2
- import { useId as A, useState as R, useRef as B, useImperativeHandle as D, useLayoutEffect as _, useEffect as F } from "react";
3
- import { useTransitionMap as G } from "react-transition-state";
4
- import '../../assets/SwitchTransition.css';const H = {
5
- "transition-wrapper": "SwitchTransition-module__transition-wrapper___UekKW"
6
- }, J = (h) => {
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
7
  const {
8
8
  children: r,
9
9
  index: d,
@@ -15,18 +15,18 @@ import '../../assets/SwitchTransition.css';const H = {
15
15
  transitionName: v,
16
16
  parentKey: y
17
17
  } = h;
18
- F(() => (u(i, { initialEntered: l }), () => {
18
+ H(() => (u(i, { initialEntered: l }), () => {
19
19
  f(i);
20
20
  }), [i, l, u, f]);
21
- const { isEnter: p, isMounted: w, isResolved: I, status: x } = b.get(i) || {};
22
- return w ? r({
21
+ const { isEnter: p, isMounted: I, isResolved: w, status: x } = b.get(i) || {};
22
+ return I ? r({
23
23
  "data-index": d,
24
24
  inert: !p,
25
25
  itemKey: i,
26
26
  "data-transition": v,
27
27
  "data-status": x,
28
28
  "data-is-enter": p,
29
- "data-is-resolved": I,
29
+ "data-is-resolved": w,
30
30
  "data-parent": y
31
31
  }) : null;
32
32
  }, X = ({
@@ -41,33 +41,33 @@ import '../../assets/SwitchTransition.css';const H = {
41
41
  exit: v,
42
42
  items: y,
43
43
  mountOnEnter: p,
44
- onStateChange: w,
45
- preEnter: I,
44
+ onStateChange: I,
45
+ preEnter: w,
46
46
  preExit: x,
47
47
  style: j,
48
48
  timeout: e = 200,
49
49
  transitionName: T,
50
50
  transitionRef: q,
51
- unmountOnExit: k,
51
+ unmountOnExit: z,
52
52
  ...$
53
53
  }) => {
54
- const z = A(), s = $.id || z, [E, L] = R(null), [S, K] = R(null), g = B(null), o = G({
54
+ const L = D(), s = $.id || L, [E, N] = R(null), [S, C] = R(null), g = F(null), o = J({
55
55
  allowMultiple: h,
56
56
  initialEntered: !1,
57
57
  mountOnEnter: p,
58
- unmountOnExit: k,
59
- preEnter: I,
58
+ unmountOnExit: z,
59
+ preEnter: w,
60
60
  preExit: x,
61
61
  enter: b,
62
62
  exit: v,
63
63
  timeout: e,
64
- onStateChange: w
64
+ onStateChange: I
65
65
  });
66
- D(q, () => ({
66
+ G(q, () => ({
67
67
  transition: r || d ? {
68
68
  ...o,
69
69
  toggle: (t) => {
70
- o.toggle(t), L(t);
70
+ o.toggle(t), N(t);
71
71
  }
72
72
  } : o
73
73
  })), _(() => {
@@ -84,10 +84,10 @@ import '../../assets/SwitchTransition.css';const H = {
84
84
  if (!a)
85
85
  return;
86
86
  const M = a?.scrollHeight ?? null;
87
- M !== null && K(M), t = new ResizeObserver((N) => {
88
- for (const O of N) {
89
- const U = O.contentRect.height;
90
- K(U);
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
91
  }
92
92
  }), t.observe(a);
93
93
  }, 0);
@@ -115,8 +115,8 @@ import '../../assets/SwitchTransition.css';const H = {
115
115
  n && clearTimeout(n);
116
116
  };
117
117
  }, [d, E, s, e]);
118
- const C = /* @__PURE__ */ m(W, { children: y.map((t, n) => /* @__PURE__ */ m(
119
- J,
118
+ const K = /* @__PURE__ */ m(B, { children: y.map((t, n) => /* @__PURE__ */ m(
119
+ Q,
120
120
  {
121
121
  index: n,
122
122
  itemKey: t,
@@ -138,7 +138,7 @@ import '../../assets/SwitchTransition.css';const H = {
138
138
  ref: g,
139
139
  "data-transition": T || void 0,
140
140
  "data-animate-height": r,
141
- className: `${H["transition-wrapper"]} ${f}`,
141
+ className: `${P["transition-wrapper"]} ${f}`,
142
142
  style: {
143
143
  ...j,
144
144
  "--cdp-web-transition-enter-timeout": typeof e == "object" ? `${e.enter ?? 200}ms` : void 0,
@@ -146,7 +146,7 @@ import '../../assets/SwitchTransition.css';const H = {
146
146
  "--cdp-web-transition-timeout": typeof e == "number" ? `${e}ms` : void 0,
147
147
  "--cdp-web-transition-height": r && S ? `${S}px` : void 0
148
148
  },
149
- children: r ? /* @__PURE__ */ m("div", { children: C }) : C
149
+ children: r ? /* @__PURE__ */ m("div", { children: K }) : K
150
150
  }
151
151
  );
152
152
  };
@@ -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
@@ -226,7 +226,7 @@ export declare const theme: Flattened<{
226
226
  font: {
227
227
  readonly family: {
228
228
  readonly sans: {
229
- readonly value: "\"Inter\", -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Helvetica, Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\"";
229
+ readonly value: "\"DM Sans\", -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Helvetica, Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\"";
230
230
  };
231
231
  };
232
232
  readonly size: {
@@ -461,7 +461,7 @@ export declare const colors: {
461
461
  export declare const font: {
462
462
  readonly family: {
463
463
  readonly sans: {
464
- readonly value: "\"Inter\", -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Helvetica, Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\"";
464
+ readonly value: "\"DM Sans\", -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Helvetica, Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\"";
465
465
  };
466
466
  };
467
467
  readonly size: {
@@ -696,7 +696,7 @@ export declare const tokens: {
696
696
  font: {
697
697
  readonly family: {
698
698
  readonly sans: {
699
- readonly value: "\"Inter\", -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Helvetica, Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\"";
699
+ readonly value: "\"DM Sans\", -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Helvetica, Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\"";
700
700
  };
701
701
  };
702
702
  readonly size: {
@@ -147,7 +147,7 @@ const e = {
147
147
  }, r = {
148
148
  family: {
149
149
  sans: {
150
- value: '"Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"'
150
+ value: '"DM Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"'
151
151
  }
152
152
  },
153
153
  size: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coinbase/cdp-react",
3
- "version": "0.0.19",
3
+ "version": "0.0.21",
4
4
  "type": "module",
5
5
  "dependencies": {
6
6
  "@radix-ui/react-dialog": "^1.1.14",
@@ -11,8 +11,8 @@
11
11
  },
12
12
  "peerDependencies": {
13
13
  "react": ">=18.2.0",
14
- "@coinbase/cdp-core": "^0.0.19",
15
- "@coinbase/cdp-hooks": "^0.0.19"
14
+ "@coinbase/cdp-core": "^0.0.21",
15
+ "@coinbase/cdp-hooks": "^0.0.21"
16
16
  },
17
17
  "devDependencies": {
18
18
  "@size-limit/preset-big-lib": "^11.2.0",
@@ -41,8 +41,8 @@
41
41
  "vite": "^7.0.4",
42
42
  "vite-plugin-dts": "^4.5.4",
43
43
  "vite-plugin-lib-inject-css": "^2.2.2",
44
- "@coinbase/cdp-core": "^0.0.19",
45
- "@coinbase/cdp-hooks": "^0.0.19"
44
+ "@coinbase/cdp-core": "^0.0.21",
45
+ "@coinbase/cdp-hooks": "^0.0.21"
46
46
  },
47
47
  "size-limit": [
48
48
  {
@@ -80,6 +80,18 @@
80
80
  "default": "./dist/components/*/index.js"
81
81
  }
82
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
+ },
83
95
  "./icons": {
84
96
  "import": {
85
97
  "types": "./dist/icons/index.d.ts",
@@ -1 +0,0 @@
1
- .FlowEmailOTP-module__step-wrapper___Cdk60{display:flex;flex-direction:column}
@@ -1 +0,0 @@
1
- .FlowPhoneNumberOTP-module__step-wrapper___TtbeW{display:flex;flex-direction:column}
@@ -1,16 +0,0 @@
1
- import { jsxs as i, 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___mRFLG", l = "Error-module__icon___web4F", o = {
5
- error: _,
6
- icon: l
7
- }, p = t(
8
- ({ children: e, id: s, className: c = "", ...m }, n) => /* @__PURE__ */ i("p", { id: s, className: `${o.error} ${c}`, ref: n, ...m, 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
- };
@@ -1,24 +0,0 @@
1
- import { jsxs as n, jsx as r } from "react/jsx-runtime";
2
- import { FormField as F, FormLabel as f, FormValidityState as u, FormControl as C, FormMessage as d } from "@radix-ui/react-form";
3
- import "react";
4
- import { Error as o } from "../Error/index.js";
5
- import { Label as _ } from "../Label/index.js";
6
- import '../../assets/Field.css';const w = {
7
- "field-wrapper": "Field-module__field-wrapper___0p4i7"
8
- }, $ = ({
9
- children: i,
10
- className: t = "",
11
- inlineError: l,
12
- label: m,
13
- name: a,
14
- style: s,
15
- validators: p
16
- }) => /* @__PURE__ */ n(F, { name: a, className: `${t} ${w["field-wrapper"]}`, style: s, children: [
17
- /* @__PURE__ */ r(f, { asChild: !0, children: /* @__PURE__ */ r(_, { children: m }) }),
18
- /* @__PURE__ */ r(u, { children: (e) => i && /* @__PURE__ */ r(C, { asChild: !0, children: i(e) }) }),
19
- p?.map(([e, h], c) => /* @__PURE__ */ r(d, { match: e, asChild: !0, children: /* @__PURE__ */ r(o, { children: h }) }, c)),
20
- l && /* @__PURE__ */ r(d, { asChild: !0, children: /* @__PURE__ */ r(o, { children: l }) })
21
- ] });
22
- export {
23
- $ as Field
24
- };
@@ -1,18 +0,0 @@
1
- import { ReactNode, Ref } from 'react';
2
- import { EmailFormProps } from '../EmailForm/EmailForm';
3
- import { OTPFormProps } from '../OTPForm/OTPForm';
4
- import { SwitchSlideTransitionRef } from '../SwitchSlideTransition/SwitchSlideTransition';
5
- export type Step = "email" | "otp";
6
- export interface FlowEmailOTPProps extends Omit<EmailFormProps, "onSubmit">, Omit<OTPFormProps, "onSubmit"> {
7
- animateHeight?: boolean;
8
- children?: (props: {
9
- step: Step;
10
- Form: ReactNode;
11
- }) => ReactNode;
12
- className?: string;
13
- onSubmitEmail: EmailFormProps["onSubmit"];
14
- onSubmitOTP: OTPFormProps["onSubmit"];
15
- step: Step;
16
- transitionRef: Ref<SwitchSlideTransitionRef<Step>>;
17
- }
18
- export declare const FlowEmailOTP: ({ autoFocus, animateHeight, canResetOTP, className, children, email, error, isPending, successMessage, onEmailChange, onOTPChange, onResendOTP, onSubmitEmail, onSubmitOTP, otp, otpInputsRef, resendCountdown, step, transitionRef, }: FlowEmailOTPProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,70 +0,0 @@
1
- import { jsx as r, Fragment as b } from "react/jsx-runtime";
2
- import "react";
3
- import { EmailForm as x } from "../EmailForm/index.js";
4
- import { OTPForm as P } from "../OTPForm/index.js";
5
- import { SwitchSlideTransition as g } from "../SwitchSlideTransition/index.js";
6
- import '../../assets/FlowEmailOTP.css';const j = {
7
- "step-wrapper": "FlowEmailOTP-module__step-wrapper___Cdk60"
8
- }, A = ({
9
- autoFocus: n = !0,
10
- animateHeight: a = !0,
11
- canResetOTP: u,
12
- className: e = "",
13
- children: m,
14
- email: s,
15
- error: l,
16
- isPending: p,
17
- successMessage: d,
18
- onEmailChange: f,
19
- onOTPChange: c,
20
- onResendOTP: w,
21
- onSubmitEmail: F,
22
- onSubmitOTP: _,
23
- otp: h,
24
- otpInputsRef: E,
25
- resendCountdown: S,
26
- step: o,
27
- transitionRef: T
28
- }) => /* @__PURE__ */ r(b, { children: /* @__PURE__ */ r(
29
- g,
30
- {
31
- autoFocus: n,
32
- animateHeight: a,
33
- items: ["email", "otp"],
34
- initialEntered: !0,
35
- direction: o === "otp" ? "left" : "right",
36
- transitionRef: T,
37
- children: ({ itemKey: i, ...O }) => {
38
- let t = null;
39
- return i === "email" && (t = /* @__PURE__ */ r(
40
- x,
41
- {
42
- className: e,
43
- email: s,
44
- error: o === "email" ? l : "",
45
- isPending: p,
46
- onEmailChange: f,
47
- onSubmit: F
48
- }
49
- )), i === "otp" && (t = /* @__PURE__ */ r(
50
- P,
51
- {
52
- canResetOTP: u,
53
- className: e,
54
- error: o === "otp" ? l : "",
55
- isPending: p,
56
- onOTPChange: c,
57
- onResendOTP: w,
58
- onSubmit: _,
59
- otp: h,
60
- otpInputsRef: E,
61
- resendCountdown: S,
62
- successMessage: d
63
- }
64
- )), /* @__PURE__ */ r("div", { ...O, className: j["step-wrapper"], children: m ? m({ step: i, Form: t }) : t });
65
- }
66
- }
67
- ) });
68
- export {
69
- A as FlowEmailOTP
70
- };
@@ -1,18 +0,0 @@
1
- import { ReactNode, Ref } from 'react';
2
- import { OTPFormProps } from '../OTPForm/OTPForm';
3
- import { PhoneNumberFormProps } from '../PhoneNumberForm/PhoneNumberForm';
4
- import { SwitchSlideTransitionRef } from '../SwitchSlideTransition/SwitchSlideTransition';
5
- export type Step = "phoneNumber" | "otp";
6
- export interface FlowPhoneNumberOTPProps extends Omit<PhoneNumberFormProps, "onSubmit">, Omit<OTPFormProps, "onSubmit"> {
7
- animateHeight?: boolean;
8
- children?: (props: {
9
- step: Step;
10
- Form: ReactNode;
11
- }) => ReactNode;
12
- className?: string;
13
- onSubmitPhoneNumber: PhoneNumberFormProps["onSubmit"];
14
- onSubmitOTP: OTPFormProps["onSubmit"];
15
- step: Step;
16
- transitionRef: Ref<SwitchSlideTransitionRef<Step>>;
17
- }
18
- export declare const FlowPhoneNumberOTP: ({ animateHeight, autoFocus, canResetOTP, children, className, countryCode, error, isPending, onCountryCodeChange, onOTPChange, onPhoneNumberChange, onResendOTP, onSubmitOTP, onSubmitPhoneNumber, otp, otpInputsRef, phoneNumber, resendCountdown, step, successMessage, transitionRef, }: FlowPhoneNumberOTPProps) => import("react/jsx-runtime").JSX.Element;