@coinbase/cdp-react 0.0.11 → 0.0.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -4
- package/dist/assets/Button.css +1 -1
- package/dist/assets/Error.css +1 -1
- package/dist/assets/Field.css +1 -1
- package/dist/assets/Input.css +1 -1
- package/dist/assets/LoadingSkeleton.css +1 -1
- package/dist/assets/LoadingSpinner.css +1 -1
- package/dist/assets/OTP.css +1 -1
- package/dist/assets/SignIn.css +1 -1
- package/dist/assets/SignInDescription.css +1 -0
- package/dist/assets/SignInForm.css +1 -0
- package/dist/assets/SignInImage.css +1 -0
- package/dist/assets/SignInModal.css +1 -1
- package/dist/assets/SignInTitle.css +1 -0
- package/dist/assets/SignOutButton.css +1 -1
- package/dist/assets/VisuallyHidden.css +1 -1
- package/dist/components/AuthButton/index.d.ts +7 -1
- package/dist/components/AuthButton/index.js +51 -31
- package/dist/components/Button/index.js +38 -22
- package/dist/components/Field/index.js +11 -11
- package/dist/components/LoadingSpinner/index.js +7 -7
- package/dist/components/OTP/index.js +26 -25
- package/dist/components/SignIn/SignInDescription.js +20 -18
- package/dist/components/SignIn/SignInForm.js +112 -101
- package/dist/components/SignIn/SignInImage.js +13 -11
- package/dist/components/SignIn/SignInTitle.js +12 -11
- package/dist/components/SignIn/index.js +22 -21
- package/dist/components/SignInModal/index.js +29 -29
- package/dist/components/SignOutButton/index.js +7 -7
- package/dist/components/ThemeProvider/index.d.ts +1 -3
- package/dist/components/ThemeProvider/index.js +7 -7
- package/dist/components/VisuallyHidden/index.js +4 -4
- package/dist/index.js +45 -39
- package/dist/theme/cssVariables.d.ts +5 -0
- package/dist/theme/cssVariables.js +10 -0
- package/dist/theme/index.d.ts +1 -0
- package/dist/theme/index.js +14 -8
- package/dist/theme/theme.d.ts +237 -33
- package/dist/theme/theme.js +3 -3
- package/dist/theme/tokens.d.ts +679 -45
- package/dist/theme/tokens.js +142 -43
- package/dist/theme/utils.d.ts +14 -2
- package/dist/theme/utils.js +23 -14
- package/package.json +9 -5
- package/dist/chunks/SignIn.module.Dl3CqKQ_.js +0 -20
|
@@ -1,113 +1,123 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useSignInWithEmail as
|
|
3
|
-
import { Form as
|
|
4
|
-
import { useState as
|
|
5
|
-
import { Button as
|
|
6
|
-
import { Field as
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
1
|
+
import { jsxs as i, jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { useSignInWithEmail as N, useVerifyEmailOTP as U } from "@coinbase/cdp-hooks";
|
|
3
|
+
import { Form as P, FormSubmit as R } from "@radix-ui/react-form";
|
|
4
|
+
import { useState as v, useEffect as y, useRef as A } from "react";
|
|
5
|
+
import { Button as C } from "../Button/index.js";
|
|
6
|
+
import { Field as V } from "../Field/index.js";
|
|
7
|
+
import { withValidityState as B } from "../Input/index.js";
|
|
8
|
+
import { LoadingSpinner as x } from "../LoadingSpinner/index.js";
|
|
9
|
+
import { OTP as q } from "../OTP/index.js";
|
|
10
|
+
import { ServerError as O } from "../ServerError/index.js";
|
|
11
|
+
import { VisuallyHidden as k } from "../VisuallyHidden/index.js";
|
|
12
|
+
import { IconCoinbaseWordmark as D } from "../../icons/IconCoinbaseWordmark.js";
|
|
10
13
|
import { IconLock as W } from "../../icons/IconLock.js";
|
|
11
|
-
import { isApiError as
|
|
12
|
-
import { isEmailInvalid as
|
|
13
|
-
import {
|
|
14
|
-
import
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
14
|
+
import { isApiError as T } from "../../utils/isApiError.js";
|
|
15
|
+
import { isEmailInvalid as $ } from "../../utils/isEmailInvalid.js";
|
|
16
|
+
import { useSignInContext as E } from "./SignInProvider.js";
|
|
17
|
+
import '../../assets/SignInForm.css';const j = "SignInForm-module__form___8Mc3V", J = "SignInForm-module__footer___6Lo9w", Z = "SignInForm-module__hr___fOcy4", G = "SignInForm-module__icon___qkJnq", n = {
|
|
18
|
+
form: j,
|
|
19
|
+
"form-footer": "SignInForm-module__form-footer___PqM2J",
|
|
20
|
+
"server-state-wrapper": "SignInForm-module__server-state-wrapper___QVsXy",
|
|
21
|
+
"loading-spinner": "SignInForm-module__loading-spinner___W6gZo",
|
|
22
|
+
"server-error": "SignInForm-module__server-error___dD9VE",
|
|
23
|
+
"reset-timer": "SignInForm-module__reset-timer___Ms2YZ",
|
|
24
|
+
footer: J,
|
|
25
|
+
"coinbase-icon": "SignInForm-module__coinbase-icon___vGv7u",
|
|
26
|
+
hr: Z,
|
|
27
|
+
icon: G
|
|
28
|
+
}, H = ({ submit: u }) => {
|
|
29
|
+
const { state: s, dispatch: d } = E(), e = () => d({ type: "CLEAR_ERROR" }), _ = (p) => (p.preventDefault(), u(s.email));
|
|
30
|
+
return /* @__PURE__ */ i(
|
|
31
|
+
P,
|
|
22
32
|
{
|
|
23
|
-
className:
|
|
33
|
+
className: n.form,
|
|
24
34
|
onClearServerErrors: e,
|
|
25
|
-
onSubmit:
|
|
35
|
+
onSubmit: _,
|
|
26
36
|
children: [
|
|
27
|
-
/* @__PURE__ */
|
|
28
|
-
|
|
37
|
+
/* @__PURE__ */ o(
|
|
38
|
+
V,
|
|
29
39
|
{
|
|
30
40
|
label: "Email address",
|
|
31
41
|
name: "email",
|
|
32
42
|
validators: [
|
|
33
43
|
["valueMissing", "Email is required"],
|
|
34
44
|
["typeMismatch", "Use a valid email address"],
|
|
35
|
-
[
|
|
45
|
+
[$, "Use a valid email address"]
|
|
36
46
|
],
|
|
37
|
-
children:
|
|
47
|
+
children: B({
|
|
38
48
|
type: "email",
|
|
39
49
|
placeholder: "name@example.com",
|
|
40
50
|
required: !0,
|
|
41
|
-
value:
|
|
51
|
+
value: s.email,
|
|
42
52
|
onChange: (p) => {
|
|
43
53
|
d({ type: "SET_EMAIL", payload: { email: p.target.value } });
|
|
44
54
|
}
|
|
45
55
|
})
|
|
46
56
|
}
|
|
47
57
|
),
|
|
48
|
-
|
|
49
|
-
/* @__PURE__ */
|
|
58
|
+
s.error && /* @__PURE__ */ o(O, { error: s.error, className: n["server-error"] }),
|
|
59
|
+
/* @__PURE__ */ o(R, { asChild: !0, children: /* @__PURE__ */ o(C, { type: "submit", isPending: s.isPending, children: "Continue with email" }) })
|
|
50
60
|
]
|
|
51
61
|
}
|
|
52
62
|
);
|
|
53
|
-
},
|
|
63
|
+
}, Q = ({
|
|
54
64
|
reset: u,
|
|
55
|
-
resetCountdown:
|
|
65
|
+
resetCountdown: s,
|
|
56
66
|
submit: d
|
|
57
67
|
}) => {
|
|
58
|
-
const { state: e, dispatch:
|
|
59
|
-
u(),
|
|
68
|
+
const { state: e, dispatch: _ } = E(), p = () => _({ type: "CLEAR_ERROR" }), l = A([]), f = (c) => (c.preventDefault(), d(e.otp)), h = () => {
|
|
69
|
+
u(), l.current[0]?.focus();
|
|
60
70
|
};
|
|
61
|
-
return
|
|
62
|
-
e.step === "otp" &&
|
|
63
|
-
}, [e.step]), /* @__PURE__ */
|
|
64
|
-
|
|
71
|
+
return y(() => {
|
|
72
|
+
e.step === "otp" && l.current[0]?.focus();
|
|
73
|
+
}, [e.step]), /* @__PURE__ */ i(
|
|
74
|
+
P,
|
|
65
75
|
{
|
|
66
|
-
className: `${
|
|
76
|
+
className: `${n.form}`,
|
|
67
77
|
onClearServerErrors: p,
|
|
68
|
-
onSubmit:
|
|
78
|
+
onSubmit: f,
|
|
69
79
|
children: [
|
|
70
|
-
/* @__PURE__ */
|
|
71
|
-
|
|
80
|
+
/* @__PURE__ */ o(
|
|
81
|
+
q,
|
|
72
82
|
{
|
|
73
|
-
ref:
|
|
83
|
+
ref: l,
|
|
74
84
|
name: "otp",
|
|
75
85
|
"aria-label": "Six-digit Verification Code",
|
|
76
86
|
passwordLength: 6,
|
|
77
87
|
value: e.otp,
|
|
78
|
-
onChange: (
|
|
79
|
-
onValueChange: (
|
|
80
|
-
|
|
88
|
+
onChange: (c) => c.preventDefault(),
|
|
89
|
+
onValueChange: (c) => {
|
|
90
|
+
_({ type: "SET_OTP", payload: { otp: c } });
|
|
81
91
|
},
|
|
82
92
|
autoSubmit: !0
|
|
83
93
|
}
|
|
84
94
|
),
|
|
85
|
-
/* @__PURE__ */
|
|
86
|
-
(e.isPending && !e.canResetOTP || e.error) && /* @__PURE__ */
|
|
87
|
-
e.isPending && !e.canResetOTP && /* @__PURE__ */
|
|
88
|
-
e.error && /* @__PURE__ */
|
|
95
|
+
/* @__PURE__ */ i("div", { className: n["form-footer"], children: [
|
|
96
|
+
(e.isPending && !e.canResetOTP || e.error) && /* @__PURE__ */ i("div", { className: n["server-state-wrapper"], children: [
|
|
97
|
+
e.isPending && !e.canResetOTP && /* @__PURE__ */ o(x, { className: n["loading-spinner"] }),
|
|
98
|
+
e.error && /* @__PURE__ */ o(O, { error: e.error, className: n["server-error"] })
|
|
89
99
|
] }),
|
|
90
|
-
/* @__PURE__ */
|
|
91
|
-
e.canResetOTP && /* @__PURE__ */
|
|
92
|
-
|
|
100
|
+
/* @__PURE__ */ i("div", { children: [
|
|
101
|
+
e.canResetOTP && /* @__PURE__ */ o(R, { asChild: !0, children: /* @__PURE__ */ o(
|
|
102
|
+
C,
|
|
93
103
|
{
|
|
94
104
|
type: "button",
|
|
95
|
-
onClick:
|
|
105
|
+
onClick: h,
|
|
96
106
|
isPending: e.isPending,
|
|
97
107
|
variant: "transparentPrimary",
|
|
98
108
|
children: "Resend code"
|
|
99
109
|
}
|
|
100
110
|
) }),
|
|
101
|
-
!e.canResetOTP && /* @__PURE__ */
|
|
111
|
+
!e.canResetOTP && /* @__PURE__ */ o("div", { className: n["reset-timer"], children: /* @__PURE__ */ i("p", { children: [
|
|
102
112
|
"Resend code in ",
|
|
103
|
-
/* @__PURE__ */
|
|
104
|
-
|
|
113
|
+
/* @__PURE__ */ i("span", { "aria-hidden": "true", children: [
|
|
114
|
+
s,
|
|
105
115
|
"s"
|
|
106
116
|
] }),
|
|
107
|
-
/* @__PURE__ */
|
|
108
|
-
|
|
117
|
+
/* @__PURE__ */ i(k, { children: [
|
|
118
|
+
s,
|
|
109
119
|
" ",
|
|
110
|
-
|
|
120
|
+
s === 1 ? "second" : "seconds"
|
|
111
121
|
] })
|
|
112
122
|
] }) })
|
|
113
123
|
] })
|
|
@@ -115,71 +125,72 @@ const q = ({ submit: u }) => {
|
|
|
115
125
|
]
|
|
116
126
|
}
|
|
117
127
|
);
|
|
118
|
-
},
|
|
128
|
+
}, pe = ({
|
|
119
129
|
as: u = "div",
|
|
120
|
-
className:
|
|
130
|
+
className: s = "",
|
|
121
131
|
onSuccess: d,
|
|
122
132
|
...e
|
|
123
133
|
}) => {
|
|
124
|
-
const
|
|
125
|
-
|
|
134
|
+
const l = "An error occurred while signing in. Please try again.", [f, h] = v(0), [c, S] = v(!1), b = N(), F = U(), { state: a, dispatch: m } = E(), w = (t) => {
|
|
135
|
+
h(t), S(!0);
|
|
126
136
|
};
|
|
127
|
-
|
|
128
|
-
if (!
|
|
137
|
+
y(() => {
|
|
138
|
+
if (!c)
|
|
129
139
|
return;
|
|
130
|
-
const
|
|
131
|
-
|
|
140
|
+
const t = setInterval(() => {
|
|
141
|
+
h((r) => r > 1 ? r - 1 : (S(!1), 0));
|
|
132
142
|
}, 1e3);
|
|
133
|
-
return () => clearInterval(
|
|
134
|
-
}, [
|
|
135
|
-
|
|
136
|
-
}, [
|
|
137
|
-
const
|
|
138
|
-
if (!
|
|
139
|
-
|
|
143
|
+
return () => clearInterval(t);
|
|
144
|
+
}, [c]), y(() => {
|
|
145
|
+
f === 0 && a.step === "otp" && !a.canResetOTP && m({ type: "ALLOW_RESET_OTP" });
|
|
146
|
+
}, [f, a.step, a.canResetOTP, m]);
|
|
147
|
+
const I = async (t) => {
|
|
148
|
+
if (!a.isPending) {
|
|
149
|
+
m({ type: "SUBMIT_EMAIL", payload: { email: t } });
|
|
140
150
|
try {
|
|
141
|
-
const { flowId: r } = await
|
|
142
|
-
email:
|
|
151
|
+
const { flowId: r } = await b({
|
|
152
|
+
email: t
|
|
143
153
|
});
|
|
144
|
-
|
|
154
|
+
m({ type: "SUBMIT_EMAIL_SUCCESS", payload: { flowId: r } }), w(60);
|
|
145
155
|
} catch (r) {
|
|
146
|
-
const
|
|
147
|
-
|
|
156
|
+
const g = T(r) ? r : r instanceof Error && r.message || l;
|
|
157
|
+
m({ type: "SUBMIT_EMAIL_FAILURE", payload: { error: g } }), console.error(r);
|
|
148
158
|
}
|
|
149
159
|
}
|
|
150
|
-
},
|
|
151
|
-
if (!
|
|
152
|
-
if (
|
|
153
|
-
|
|
160
|
+
}, L = async (t) => {
|
|
161
|
+
if (!a.isPending) {
|
|
162
|
+
if (t.length !== 6) {
|
|
163
|
+
m({ type: "SET_OTP", payload: { otp: t } });
|
|
154
164
|
return;
|
|
155
165
|
}
|
|
156
|
-
|
|
166
|
+
m({ type: "SUBMIT_OTP", payload: { otp: t } });
|
|
157
167
|
try {
|
|
158
|
-
await
|
|
159
|
-
flowId:
|
|
160
|
-
otp:
|
|
161
|
-
}),
|
|
168
|
+
await F({
|
|
169
|
+
flowId: a.flowId,
|
|
170
|
+
otp: t
|
|
171
|
+
}), m({ type: "SUBMIT_OTP_SUCCESS", payload: { otp: t } }), d?.();
|
|
162
172
|
} catch (r) {
|
|
163
|
-
const
|
|
164
|
-
|
|
173
|
+
const g = T(r) ? r : r instanceof Error && r.message || l;
|
|
174
|
+
m({ type: "SUBMIT_OTP_FAILURE", payload: { error: g } }), console.error(r);
|
|
165
175
|
}
|
|
166
176
|
}
|
|
167
177
|
}, M = () => {
|
|
168
|
-
|
|
178
|
+
m({ type: "RESET_OTP" }), S(!1), I(a.email);
|
|
169
179
|
};
|
|
170
|
-
return /* @__PURE__ */
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
/* @__PURE__ */
|
|
174
|
-
/* @__PURE__ */
|
|
175
|
-
/* @__PURE__ */
|
|
176
|
-
/* @__PURE__ */
|
|
177
|
-
"Secured by
|
|
178
|
-
|
|
180
|
+
return /* @__PURE__ */ i(u, { className: `${n.form} ${s}`, ...e, children: [
|
|
181
|
+
a.step === "email" && /* @__PURE__ */ o(H, { submit: I }),
|
|
182
|
+
a.step === "otp" && /* @__PURE__ */ o(Q, { submit: L, reset: M, resetCountdown: f }),
|
|
183
|
+
/* @__PURE__ */ o("hr", { className: n.hr }),
|
|
184
|
+
/* @__PURE__ */ i("div", { className: n.footer, children: [
|
|
185
|
+
/* @__PURE__ */ o(W, { className: n.icon }),
|
|
186
|
+
/* @__PURE__ */ i("p", { children: [
|
|
187
|
+
"Secured by",
|
|
188
|
+
" ",
|
|
189
|
+
/* @__PURE__ */ o(D, { className: n["coinbase-icon"], "aria-label": "Coinbase" })
|
|
179
190
|
] })
|
|
180
191
|
] })
|
|
181
192
|
] });
|
|
182
193
|
};
|
|
183
194
|
export {
|
|
184
|
-
|
|
195
|
+
pe as SignInForm
|
|
185
196
|
};
|
|
@@ -1,21 +1,23 @@
|
|
|
1
1
|
import { jsx as e } from "react/jsx-runtime";
|
|
2
|
-
import { useAppConfig as
|
|
2
|
+
import { useAppConfig as p } from "../CDPReactProvider/index.js";
|
|
3
3
|
import { IconCheckCircle as a } from "../../icons/IconCheckCircle.js";
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
import { useSignInContext as _ } from "./SignInProvider.js";
|
|
5
|
+
import '../../assets/SignInImage.css';const f = "SignInImage-module__logo___rlzt-", i = {
|
|
6
|
+
logo: f,
|
|
7
|
+
"success-icon": "SignInImage-module__success-icon___avUF9"
|
|
8
|
+
}, l = (o) => /^https?:\/\//.test(o), S = ({ className: o = "", alt: r, src: t }) => {
|
|
9
|
+
const { state: g } = _(), { step: n } = g, s = p(), m = s.logoUrl && l(s.logoUrl) ? s.logoUrl : void 0, c = t && l(t) ? t : m, u = r || s.name;
|
|
10
|
+
return n !== "success" && c ? /* @__PURE__ */ e(
|
|
9
11
|
"img",
|
|
10
12
|
{
|
|
11
|
-
src:
|
|
12
|
-
alt:
|
|
13
|
-
className: `${
|
|
13
|
+
src: c,
|
|
14
|
+
alt: u || "",
|
|
15
|
+
className: `${i.logo} ${o}`,
|
|
14
16
|
width: 64,
|
|
15
17
|
height: 64
|
|
16
18
|
}
|
|
17
|
-
) :
|
|
19
|
+
) : n === "success" ? /* @__PURE__ */ e(a, { className: `${i["success-icon"]} ${o}` }) : null;
|
|
18
20
|
};
|
|
19
21
|
export {
|
|
20
|
-
|
|
22
|
+
S as SignInImage
|
|
21
23
|
};
|
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
2
2
|
import { useMemo as c } from "react";
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
3
|
+
import { useSignInContext as a } from "./SignInProvider.js";
|
|
4
|
+
import '../../assets/SignInTitle.css';const u = "SignInTitle-module__heading___QJ071", m = {
|
|
5
|
+
heading: u
|
|
6
|
+
}, p = ({
|
|
7
|
+
as: t = "h2",
|
|
8
|
+
children: n,
|
|
9
|
+
className: s = "",
|
|
10
|
+
...i
|
|
10
11
|
}) => {
|
|
11
|
-
const { state:
|
|
12
|
-
return /* @__PURE__ */
|
|
12
|
+
const { state: e } = a(), o = c(() => e.step === "success" ? "Success" : e.step === "otp" ? "Enter verification code" : "Sign in", [e.step]);
|
|
13
|
+
return /* @__PURE__ */ r(t, { className: `${m.heading} ${s}`, ...i, children: n || o });
|
|
13
14
|
};
|
|
14
15
|
export {
|
|
15
|
-
|
|
16
|
+
p as SignInTitle
|
|
16
17
|
};
|
|
@@ -1,28 +1,29 @@
|
|
|
1
|
-
import { jsx as n, jsxs as
|
|
1
|
+
import { jsx as n, jsxs as r, Fragment as s } from "react/jsx-runtime";
|
|
2
2
|
import "react";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
/* @__PURE__ */ n(a, {}),
|
|
3
|
+
import { SignInDescription as g } from "./SignInDescription.js";
|
|
4
|
+
import { SignInForm as c } from "./SignInForm.js";
|
|
5
|
+
import { SignInImage as p } from "./SignInImage.js";
|
|
6
|
+
import { SignInProvider as I, useSignInContext as S } from "./SignInProvider.js";
|
|
7
|
+
import { SignInTitle as f } from "./SignInTitle.js";
|
|
8
|
+
import '../../assets/SignIn.css';const a = {
|
|
9
|
+
"sign-in": "SignIn-module__sign-in___cYpee"
|
|
10
|
+
}, l = ({ className: i = "", children: t, onSuccess: e }) => {
|
|
11
|
+
const { state: m } = S(), o = typeof t == "function" ? t(m) : t;
|
|
12
|
+
return /* @__PURE__ */ r("div", { className: `${a["sign-in"]} ${i}`, children: [
|
|
13
|
+
o,
|
|
14
|
+
!o && /* @__PURE__ */ r(s, { children: [
|
|
16
15
|
/* @__PURE__ */ n(p, {}),
|
|
17
|
-
/* @__PURE__ */ n(
|
|
16
|
+
/* @__PURE__ */ n(f, {}),
|
|
17
|
+
/* @__PURE__ */ n(g, {}),
|
|
18
|
+
/* @__PURE__ */ n(c, { onSuccess: e })
|
|
18
19
|
] })
|
|
19
20
|
] });
|
|
20
|
-
},
|
|
21
|
+
}, C = (i) => /* @__PURE__ */ n(I, { children: /* @__PURE__ */ n(l, { ...i }) });
|
|
21
22
|
export {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
23
|
+
C as SignIn,
|
|
24
|
+
g as SignInDescription,
|
|
25
|
+
c as SignInForm,
|
|
26
|
+
p as SignInImage,
|
|
27
|
+
f as SignInTitle,
|
|
27
28
|
S as useSignInContext
|
|
28
29
|
};
|
|
@@ -1,50 +1,50 @@
|
|
|
1
|
-
import { jsxs as o, jsx as
|
|
2
|
-
import { Dialog as
|
|
1
|
+
import { jsxs as o, jsx as i } from "react/jsx-runtime";
|
|
2
|
+
import { Dialog as t, DialogTrigger as g, DialogPortal as _, DialogOverlay as d, DialogContent as c, DialogClose as p, DialogTitle as u, DialogDescription as I } from "@radix-ui/react-dialog";
|
|
3
3
|
import "react";
|
|
4
4
|
import { IconXMark as h } from "../../icons/IconXMark.js";
|
|
5
5
|
import { Button as r } from "../Button/index.js";
|
|
6
6
|
import { SignIn as S } from "../SignIn/index.js";
|
|
7
|
-
import { useTheme as
|
|
7
|
+
import { useTheme as f } from "../ThemeProvider/index.js";
|
|
8
8
|
import { SignInImage as M } from "../SignIn/SignInImage.js";
|
|
9
|
-
import { SignInTitle as
|
|
9
|
+
import { SignInTitle as D } from "../SignIn/SignInTitle.js";
|
|
10
10
|
import { SignInDescription as v } from "../SignIn/SignInDescription.js";
|
|
11
11
|
import { SignInForm as N } from "../SignIn/SignInForm.js";
|
|
12
|
-
import '../../assets/SignInModal.css';const y = "SignInModal-module__trigger___IcJ8x",
|
|
12
|
+
import '../../assets/SignInModal.css';const y = "SignInModal-module__trigger___IcJ8x", C = "SignInModal-module__modal___PErrT", x = "SignInModal-module__overlay___-0rmi", b = "SignInModal-module__spacer___x-lRH", n = {
|
|
13
13
|
trigger: y,
|
|
14
|
-
modal:
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
overlay:
|
|
14
|
+
modal: C,
|
|
15
|
+
"sign-in": "SignInModal-module__sign-in___n05-5",
|
|
16
|
+
"sign-in-form": "SignInModal-module__sign-in-form___Jzx1-",
|
|
17
|
+
"sign-in-title": "SignInModal-module__sign-in-title___cju2s",
|
|
18
|
+
"sign-in-description": "SignInModal-module__sign-in-description___-Oi9q",
|
|
19
|
+
"sign-in-image": "SignInModal-module__sign-in-image___DGg7B",
|
|
20
|
+
"close-wrapper": "SignInModal-module__close-wrapper___zuxDu",
|
|
21
|
+
"close-button": "SignInModal-module__close-button___k1I5Q",
|
|
22
|
+
overlay: x,
|
|
23
23
|
spacer: b
|
|
24
|
-
},
|
|
25
|
-
const { cssVariables:
|
|
26
|
-
return /* @__PURE__ */ o(
|
|
27
|
-
/* @__PURE__ */
|
|
28
|
-
/* @__PURE__ */
|
|
29
|
-
/* @__PURE__ */
|
|
30
|
-
/* @__PURE__ */
|
|
31
|
-
/* @__PURE__ */
|
|
24
|
+
}, F = ({ children: l, open: a, setIsOpen: s, onSuccess: e }) => {
|
|
25
|
+
const { cssVariables: m } = f();
|
|
26
|
+
return /* @__PURE__ */ o(t, { open: a, onOpenChange: s, children: [
|
|
27
|
+
/* @__PURE__ */ i(g, { asChild: !0, children: l || /* @__PURE__ */ i(r, { variant: "primary", className: n.trigger, children: "Sign In" }) }),
|
|
28
|
+
/* @__PURE__ */ i(_, { children: /* @__PURE__ */ o(d, { className: n.overlay, style: m, children: [
|
|
29
|
+
/* @__PURE__ */ i("div", { className: n.spacer }),
|
|
30
|
+
/* @__PURE__ */ i(c, { className: n.modal, children: /* @__PURE__ */ o(S, { onSuccess: e, className: n["sign-in"], children: [
|
|
31
|
+
/* @__PURE__ */ i("div", { className: n["close-wrapper"], children: /* @__PURE__ */ i(p, { asChild: !0, children: /* @__PURE__ */ i(
|
|
32
32
|
r,
|
|
33
33
|
{
|
|
34
34
|
"aria-label": "Close",
|
|
35
35
|
variant: "transparentSecondary",
|
|
36
|
-
className: `${
|
|
37
|
-
children: /* @__PURE__ */
|
|
36
|
+
className: `${n["close-button"]}`,
|
|
37
|
+
children: /* @__PURE__ */ i(h, {})
|
|
38
38
|
}
|
|
39
39
|
) }) }),
|
|
40
|
-
/* @__PURE__ */
|
|
41
|
-
/* @__PURE__ */
|
|
42
|
-
/* @__PURE__ */
|
|
43
|
-
/* @__PURE__ */
|
|
40
|
+
/* @__PURE__ */ i("div", { className: n["sign-in-image"], children: /* @__PURE__ */ i(M, {}) }),
|
|
41
|
+
/* @__PURE__ */ i("div", { className: n["sign-in-title"], children: /* @__PURE__ */ i(u, { asChild: !0, children: /* @__PURE__ */ i(D, {}) }) }),
|
|
42
|
+
/* @__PURE__ */ i(I, { asChild: !0, children: /* @__PURE__ */ i(v, { className: n["sign-in-description"] }) }),
|
|
43
|
+
/* @__PURE__ */ i(N, { className: n["sign-in-form"], onSuccess: e })
|
|
44
44
|
] }) })
|
|
45
45
|
] }) })
|
|
46
46
|
] });
|
|
47
47
|
};
|
|
48
48
|
export {
|
|
49
|
-
|
|
49
|
+
F as SignInModal
|
|
50
50
|
};
|
|
@@ -3,14 +3,14 @@ import { useSignOut as r } from "@coinbase/cdp-hooks";
|
|
|
3
3
|
import "react";
|
|
4
4
|
import { Button as m } from "../Button/index.js";
|
|
5
5
|
import "../../theme/theme.js";
|
|
6
|
-
import '../../assets/SignOutButton.css';const
|
|
7
|
-
|
|
8
|
-
},
|
|
9
|
-
const
|
|
10
|
-
await
|
|
6
|
+
import '../../assets/SignOutButton.css';const e = {
|
|
7
|
+
"sign-out-button": "SignOutButton-module__sign-out-button___qiybe"
|
|
8
|
+
}, O = ({ children: t, variant: o = "primary", onSuccess: n }) => {
|
|
9
|
+
const i = r(), u = async () => {
|
|
10
|
+
await i(), n?.();
|
|
11
11
|
};
|
|
12
|
-
return /* @__PURE__ */ s(m, { variant:
|
|
12
|
+
return /* @__PURE__ */ s(m, { variant: o, className: e["sign-out-button"], onClick: u, children: t || "Sign out" });
|
|
13
13
|
};
|
|
14
14
|
export {
|
|
15
|
-
|
|
15
|
+
O as SignOutButton
|
|
16
16
|
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { jsx as m } from "react/jsx-runtime";
|
|
2
|
-
import { createContext as
|
|
3
|
-
import {
|
|
2
|
+
import { createContext as p, useMemo as s, useContext as u } from "react";
|
|
3
|
+
import { theme as n } from "../../theme/theme.js";
|
|
4
4
|
import { themeToCssVariables as l } from "../../theme/utils.js";
|
|
5
|
-
import '../../assets/ThemeProvider.css';const
|
|
6
|
-
wrapper:
|
|
7
|
-
}, a =
|
|
5
|
+
import '../../assets/ThemeProvider.css';const w = "ThemeProvider-module__wrapper___aXwhZ", d = {
|
|
6
|
+
wrapper: w
|
|
7
|
+
}, a = p(void 0), _ = ({
|
|
8
8
|
children: e,
|
|
9
9
|
className: c = "",
|
|
10
10
|
style: i,
|
|
@@ -13,14 +13,14 @@ import '../../assets/ThemeProvider.css';const d = "ThemeProvider-module__wrapper
|
|
|
13
13
|
const t = s(
|
|
14
14
|
() => o ? { ...n, ...o } : n,
|
|
15
15
|
[o]
|
|
16
|
-
), r = s(() => l(t), [t]),
|
|
16
|
+
), r = s(() => l(t), [t]), h = s(
|
|
17
17
|
() => ({
|
|
18
18
|
theme: t,
|
|
19
19
|
cssVariables: r
|
|
20
20
|
}),
|
|
21
21
|
[t, r]
|
|
22
22
|
);
|
|
23
|
-
return /* @__PURE__ */ m(a.Provider, { value:
|
|
23
|
+
return /* @__PURE__ */ m(a.Provider, { value: h, children: /* @__PURE__ */ m("div", { className: `${d.wrapper} ${c}`, style: { ...i, ...r }, children: e }) });
|
|
24
24
|
}, C = () => {
|
|
25
25
|
const e = u(a);
|
|
26
26
|
if (!e)
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx as i } from "react/jsx-runtime";
|
|
2
2
|
import "react";
|
|
3
|
-
import '../../assets/VisuallyHidden.css';const d =
|
|
4
|
-
|
|
5
|
-
},
|
|
3
|
+
import '../../assets/VisuallyHidden.css';const d = {
|
|
4
|
+
"visually-hidden": "VisuallyHidden-module__visually-hidden___qdUPg"
|
|
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
|
|
8
8
|
};
|