@coinbase/cdp-react 0.0.3 → 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/AuthButton.css +1 -0
- package/dist/assets/Button.css +1 -1
- package/dist/assets/Input.css +1 -1
- package/dist/assets/LoadingSkeleton.css +1 -0
- package/dist/assets/SignIn.css +1 -1
- package/dist/assets/SignInModal.css +1 -1
- package/dist/components/AuthButton/index.d.ts +2 -1
- package/dist/components/AuthButton/index.js +34 -16
- package/dist/components/LoadingSkeleton/index.d.ts +8 -0
- package/dist/components/LoadingSkeleton/index.js +19 -0
- package/dist/components/SignIn/SignInForm.js +96 -87
- package/dist/components/SignIn/index.js +1 -1
- package/dist/components/SignInModal/index.js +1 -1
- package/dist/components/SignOutButton/index.js +1 -1
- package/dist/theme/theme.d.ts +1 -0
- package/dist/theme/tokens.d.ts +1 -0
- package/dist/theme/tokens.js +1 -0
- package/package.json +5 -5
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.AuthButton-module__loading___JpDqi{border-radius:9999em;height:3.5em;width:7.5em}
|
package/dist/assets/Button.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.Button-module__btn___Fx11X{--cdp-web-button-ring-color: transparent;--cdp-web-button-ring-width: 2px;--cdp-web-button-ring-inset-color: transparent;--cdp-web-button-ring-inset-width: 2px;box-shadow:inset 0 0 0 var(--cdp-web-button-ring-inset-width) var(--cdp-web-button-ring-inset-color),0 0 0 var(--cdp-web-button-ring-width) var(--cdp-web-button-ring-color);display:inline-flex;align-items:center;justify-content:center;gap:.5em;padding:1em;border-radius:9999em;border:0;background-color:transparent;color:var(--cdp-web-colors-text);font-size:1em;font-weight:500;line-height:1.5;text-decoration:none;cursor:pointer;transition:all .15s ease-in-out;-webkit-user-select:none;user-select:none}.Button-module__primary___s1sM6{background-color:var(--cdp-web-colors-primary);color:var(--cdp-web-colors-primaryText)}.Button-module__primary___s1sM6:hover{background-color:var(--cdp-web-colors-primaryHoverBackground);color:var(--cdp-web-colors-primaryHoverText)}.Button-module__primary___s1sM6:focus-visible{--cdp-web-button-ring-color: var(--cdp-web-colors-primaryFocusRing);--cdp-web-button-ring-inset-color: var(--cdp-web-colors-background);outline:none}.Button-module__secondary___R0waJ{background-color:var(--cdp-web-colors-secondary);color:var(--cdp-web-colors-secondaryText)}.Button-module__secondary___R0waJ:hover{background-color:var(--cdp-web-colors-secondaryHoverBackground);color:var(--cdp-web-colors-secondaryHoverText)}.Button-module__secondary___R0waJ:focus-visible{--cdp-web-button-ring-color: var(--cdp-web-colors-secondaryFocusRing);--cdp-web-button-ring-inset-color: var(--cdp-web-colors-background);outline:none}.Button-module__transparentPrimary___o7JPs{background-color:transparent;color:var(--cdp-web-colors-linkText)}.Button-module__transparentPrimary___o7JPs:hover{color:var(--cdp-web-colors-linkHover)}.Button-module__transparentPrimary___o7JPs:focus-visible{--cdp-web-button-ring-color: var(--cdp-web-colors-linkText);outline:none}.Button-module__transparentSecondary___4ehOz{background-color:transparent;color:var(--cdp-web-colors-linkSecondaryText)}.Button-module__transparentSecondary___4ehOz:hover{color:var(--cdp-web-colors-linkSecondaryHover)}.Button-module__transparentSecondary___4ehOz:focus-visible{--cdp-web-button-ring-color: var(--cdp-web-colors-linkSecondaryText);outline:none}
|
|
1
|
+
.Button-module__btn___Fx11X{--cdp-web-button-ring-color: transparent;--cdp-web-button-ring-width: 2px;--cdp-web-button-ring-inset-color: transparent;--cdp-web-button-ring-inset-width: 2px;box-sizing:border-box;box-shadow:inset 0 0 0 var(--cdp-web-button-ring-inset-width) var(--cdp-web-button-ring-inset-color),0 0 0 var(--cdp-web-button-ring-width) var(--cdp-web-button-ring-color);display:inline-flex;align-items:center;justify-content:center;gap:.5em;padding:1em;border-radius:9999em;border:0;background-color:transparent;color:var(--cdp-web-colors-text);font-size:1em;font-weight:500;line-height:1.5;text-decoration:none;cursor:pointer;transition:all .15s ease-in-out;-webkit-user-select:none;user-select:none}.Button-module__primary___s1sM6{background-color:var(--cdp-web-colors-primary);color:var(--cdp-web-colors-primaryText)}.Button-module__primary___s1sM6:hover{background-color:var(--cdp-web-colors-primaryHoverBackground);color:var(--cdp-web-colors-primaryHoverText)}.Button-module__primary___s1sM6:focus{outline:none}.Button-module__primary___s1sM6:focus-visible{--cdp-web-button-ring-color: var(--cdp-web-colors-primaryFocusRing);--cdp-web-button-ring-inset-color: var(--cdp-web-colors-background);outline:none}.Button-module__secondary___R0waJ{background-color:var(--cdp-web-colors-secondary);color:var(--cdp-web-colors-secondaryText)}.Button-module__secondary___R0waJ:hover{background-color:var(--cdp-web-colors-secondaryHoverBackground);color:var(--cdp-web-colors-secondaryHoverText)}.Button-module__secondary___R0waJ:focus{outline:none}.Button-module__secondary___R0waJ:focus-visible{--cdp-web-button-ring-color: var(--cdp-web-colors-secondaryFocusRing);--cdp-web-button-ring-inset-color: var(--cdp-web-colors-background);outline:none}.Button-module__transparentPrimary___o7JPs{background-color:transparent;color:var(--cdp-web-colors-linkText)}.Button-module__transparentPrimary___o7JPs:hover{color:var(--cdp-web-colors-linkHover)}.Button-module__transparentPrimary___o7JPs:focus{outline:none}.Button-module__transparentPrimary___o7JPs:focus-visible{--cdp-web-button-ring-color: var(--cdp-web-colors-linkText);outline:none}.Button-module__transparentSecondary___4ehOz{background-color:transparent;color:var(--cdp-web-colors-linkSecondaryText)}.Button-module__transparentSecondary___4ehOz:hover{color:var(--cdp-web-colors-linkSecondaryHover)}.Button-module__transparentSecondary___4ehOz:focus{outline:none}.Button-module__transparentSecondary___4ehOz:focus-visible{--cdp-web-button-ring-color: var(--cdp-web-colors-linkSecondaryText);outline:none}
|
package/dist/assets/Input.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.Input-module__input___WjT81{--cdp-web-input-ring-width: 1px;--cdp-web-input-ring-color: var(--cdp-web-colors-inputBorder);font-size:1em;padding:.75em;border-radius:.5em;border:1px solid transparent;background-color:var(--cdp-web-colors-inputBackground);box-shadow:0 0 0 var(--cdp-web-input-ring-width) var(--cdp-web-input-ring-color);color:var(--cdp-web-colors-inputText);transition:all .15s ease-in-out;width:100%}.Input-module__input___WjT81::placeholder{color:var(--cdp-web-colors-inputPlaceholder)}.Input-module__input___WjT81:focus-visible{outline:none;--cdp-web-input-ring-color: var(--cdp-web-colors-inputFocusBorder);--cdp-web-input-ring-width: 2px}.Input-module__input___WjT81[aria-invalid=true]{--cdp-web-input-ring-color: var(--cdp-web-colors-error)}
|
|
1
|
+
.Input-module__input___WjT81{--cdp-web-input-ring-width: 1px;--cdp-web-input-ring-color: var(--cdp-web-colors-inputBorder);box-sizing:border-box;font-size:1em;padding:.75em;border-radius:.5em;border:1px solid transparent;background-color:var(--cdp-web-colors-inputBackground);box-shadow:0 0 0 var(--cdp-web-input-ring-width) var(--cdp-web-input-ring-color);color:var(--cdp-web-colors-inputText);transition:all .15s ease-in-out;width:100%}.Input-module__input___WjT81::placeholder{color:var(--cdp-web-colors-inputPlaceholder)}.Input-module__input___WjT81:focus-visible{outline:none;--cdp-web-input-ring-color: var(--cdp-web-colors-inputFocusBorder);--cdp-web-input-ring-width: 2px}.Input-module__input___WjT81[aria-invalid=true]{--cdp-web-input-ring-color: var(--cdp-web-colors-error)}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.LoadingSkeleton-module__loading___ezIkq{animation:LoadingSkeleton-module__pulse___a9tGO 2s cubic-bezier(.4,0,.6,1) infinite;background-color:var(--cdp-web-colors-backgroundSkeleton);cursor:progress}@keyframes LoadingSkeleton-module__pulse___a9tGO{50%{opacity:.5}}
|
package/dist/assets/SignIn.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.SignIn-module__signIn___cS7KU{border-radius:.75em;font:var(--cdp-web-fontSizeBase) / 1.5 var(--cdp-web-fontFamily-sans);background-color:var(--cdp-web-colors-background);color:var(--cdp-web-colors-text);display:flex;flex-direction:column;gap:1em;max-width:38.25em;padding:1em 2em;width:100%}.SignIn-module__heading___nzF-H{font-size:1.75em;line-height:1.29;margin:0}.SignIn-module__description___6bRpF{color:var(--cdp-web-colors-textSecondary);margin:0}.SignIn-module__medium___rfGKj{font-weight:500}.SignIn-module__form___MXCq6{display:flex;flex-direction:column;gap:1em}.SignIn-module__logo___9j5Y-{display:block;margin:0;width:64px;height:64px;border-radius:9999em;object-fit:cover}.SignIn-module__formFooter___Rasrs{display:flex;flex-flow:column nowrap;align-items:stretch;justify-content:center;gap:.5em;min-height:1.5em}.SignIn-module__serverStateWrapper___GML6w{min-height:1.5em}.SignIn-module__loadingSpinner___JnMDX{color:var(--cdp-web-colors-linkText);display:block;margin:0 auto}.SignIn-module__formFooter___Rasrs button{width:100%}.SignIn-module__serverError___p4Z3K{justify-content:center}.SignIn-module__resetTimer___s-bUu{color:var(--cdp-web-colors-textSecondary);font-size:.875em;font-weight:500;line-height:1em;padding:1.5em 0;text-align:center}.SignIn-module__resetTimer___s-bUu p{margin:0}.SignIn-module__successIcon___2a7me{color:var(--cdp-web-colors-success);display:block;height:4em;width:4em}.SignIn-module__footer___3Gkbc{color:var(--cdp-web-colors-textSecondary);display:flex;align-items:center;justify-content:center;gap:.5em;font-size:.75em;line-height:1;padding:.5em 2em 1em}.SignIn-module__coinbaseIcon___cOnQb{color:var(--cdp-web-colors-linkText);height:1em;width:auto}.SignIn-module__footer___3Gkbc p{display:flex;align-items:center;gap:.25em;margin:0}.SignIn-module__hr___WFRgK{border:0;border-top:1px solid var(--cdp-web-colors-border);width:100%}
|
|
1
|
+
.SignIn-module__signIn___cS7KU{border-radius:.75em;box-sizing:border-box;font:var(--cdp-web-fontSizeBase) / 1.5 var(--cdp-web-fontFamily-sans);background-color:var(--cdp-web-colors-background);color:var(--cdp-web-colors-text);display:flex;flex-direction:column;gap:1em;max-width:38.25em;padding:1em 2em;width:100%}.SignIn-module__signIn___cS7KU *{box-sizing:border-box}.SignIn-module__heading___nzF-H{font-size:1.75em;line-height:1.29;margin:0}.SignIn-module__description___6bRpF{color:var(--cdp-web-colors-textSecondary);margin:0}.SignIn-module__medium___rfGKj{font-weight:500}.SignIn-module__form___MXCq6{display:flex;flex-direction:column;gap:1em}.SignIn-module__logo___9j5Y-{display:block;margin:0;width:64px;height:64px;border-radius:9999em;object-fit:cover}.SignIn-module__formFooter___Rasrs{display:flex;flex-flow:column nowrap;align-items:stretch;justify-content:center;gap:.5em;min-height:1.5em}.SignIn-module__serverStateWrapper___GML6w{min-height:1.5em}.SignIn-module__loadingSpinner___JnMDX{color:var(--cdp-web-colors-linkText);display:block;margin:0 auto}.SignIn-module__formFooter___Rasrs button{width:100%}.SignIn-module__serverError___p4Z3K{justify-content:center}.SignIn-module__resetTimer___s-bUu{color:var(--cdp-web-colors-textSecondary);font-size:.875em;font-weight:500;line-height:1em;padding:1.5em 0;text-align:center}.SignIn-module__resetTimer___s-bUu p{margin:0}.SignIn-module__successIcon___2a7me{color:var(--cdp-web-colors-success);display:block;height:4em;width:4em}.SignIn-module__footer___3Gkbc{color:var(--cdp-web-colors-textSecondary);display:flex;align-items:center;justify-content:center;gap:.5em;font-size:.75em;line-height:1;padding:.5em 2em 1em}.SignIn-module__coinbaseIcon___cOnQb{color:var(--cdp-web-colors-linkText);height:1em;width:auto}.SignIn-module__footer___3Gkbc p{display:flex;align-items:center;gap:.25em;margin:0}.SignIn-module__hr___WFRgK{border:0;border-top:1px solid var(--cdp-web-colors-border);width:100%}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.SignInModal-module__trigger___IcJ8x{padding-left:2em;padding-right:2em}.SignInModal-module__modal___PErrT{--shadow-md: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1);box-shadow:var(--shadow-md);width:100%;max-width:38.25em;background:var(--cdp-web-colors-background);border-radius:.5em;outline:1px solid var(--cdp-web-colors-border);position:relative}.SignInModal-module__modal___PErrT[data-state=open]{animation:SignInModal-module__slideIn___7GyWR .2s ease-out,SignInModal-module__fadeIn___-TaAT .2s ease-out}.SignInModal-module__modal___PErrT[data-state=closed]{animation:SignInModal-module__slideOut___Ntrrb .2s ease-in,SignInModal-module__fadeOut___bzuhB .2s ease-in}.SignInModal-module__signIn___hQuJk{height:100%}.SignInModal-module__signInForm___6-UdI,.SignInModal-module__signInForm___6-UdI form{flex-grow:1}.SignInModal-module__signInTitle___AF-XA,.SignInModal-module__signInDescription___SZjXu{text-align:center}.SignInModal-module__signInImage___hMBda{display:flex;justify-content:center;align-items:center;flex-grow:1;margin:2em 0}.SignInModal-module__closeWrapper___cx8Zq{display:flex;justify-content:flex-end;align-items:center}.SignInModal-module__closeButton___yf-ZW{position:relative;left:1em;width:3em}.SignInModal-module__closeButton___yf-ZW svg{height:1em;width:1em}.SignInModal-module__overlay___-0rmi{background:var(--cdp-web-colors-backgroundOverlay);-webkit-backdrop-filter:blur(.5em);backdrop-filter:blur(.5em);display:grid;grid-template-rows:auto 1fr;inset:0;overflow-y:auto;place-items:end center;position:fixed;z-index:1000}.SignInModal-module__overlay___-0rmi[data-state=open]{animation:SignInModal-module__fadeIn___-TaAT .2s ease-out}.SignInModal-module__overlay___-0rmi[data-state=closed]{animation:SignInModal-module__fadeOut___bzuhB .2s ease-in}.SignInModal-module__spacer___x-lRH{height:1em}@keyframes SignInModal-module__fadeIn___-TaAT{0%{opacity:0}to{opacity:1}}@keyframes SignInModal-module__fadeOut___bzuhB{0%{opacity:1}to{opacity:0}}@keyframes SignInModal-module__slideIn___7GyWR{0%{transform:translateY(100%)}to{transform:translateY(0)}}@keyframes SignInModal-module__slideOut___Ntrrb{0%{transform:translateY(0)}to{transform:translateY(100%)}}@media (min-width: 400px){.SignInModal-module__overlay___-0rmi{padding:.5rem}}@media (min-width: 600px){.SignInModal-module__overlay___-0rmi{place-items:center;padding:1rem;grid-template-rows:1fr}.SignInModal-module__modal___PErrT{height:auto}.SignInModal-module__spacer___x-lRH{display:none}.SignInModal-module__signIn___hQuJk{padding-left:0;padding-right:0}.SignInModal-module__closeWrapper___cx8Zq,.SignInModal-module__signInImage___hMBda,.SignInModal-module__signInTitle___AF-XA,.SignInModal-module__signInDescription___SZjXu,.SignInModal-module__signInForm___6-UdI>form,.SignInModal-module__signInForm___6-UdI>div{padding-left:2.5em;padding-right:2.5em}.SignInModal-module__signInImage___hMBda{align-self:flex-start;margin:0}.SignInModal-module__signInTitle___AF-XA,.SignInModal-module__signInDescription___SZjXu{text-align:left}@keyframes SignInModal-module__slideIn___7GyWR{0%{transform:translateY(10%)}to{transform:translateY(0)}}@keyframes SignInModal-module__slideOut___Ntrrb{0%{transform:translateY(0)}to{transform:translateY(10%)}}}
|
|
1
|
+
.SignInModal-module__trigger___IcJ8x{padding-left:2em;padding-right:2em}.SignInModal-module__modal___PErrT{--shadow-md: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1);box-sizing:border-box;box-shadow:var(--shadow-md);width:100%;max-width:38.25em;background:var(--cdp-web-colors-background);border-radius:.5em;outline:1px solid var(--cdp-web-colors-border);position:relative}.SignInModal-module__modal___PErrT[data-state=open]{animation:SignInModal-module__slideIn___7GyWR .2s ease-out,SignInModal-module__fadeIn___-TaAT .2s ease-out}.SignInModal-module__modal___PErrT[data-state=closed]{animation:SignInModal-module__slideOut___Ntrrb .2s ease-in,SignInModal-module__fadeOut___bzuhB .2s ease-in}.SignInModal-module__signIn___hQuJk{height:100%}.SignInModal-module__signInForm___6-UdI,.SignInModal-module__signInForm___6-UdI form{flex-grow:1}.SignInModal-module__signInTitle___AF-XA,.SignInModal-module__signInDescription___SZjXu{text-align:center}.SignInModal-module__signInImage___hMBda{display:flex;justify-content:center;align-items:center;flex-grow:1;margin:2em 0}.SignInModal-module__closeWrapper___cx8Zq{display:flex;justify-content:flex-end;align-items:center}.SignInModal-module__closeButton___yf-ZW{position:relative;left:1em;width:3em}.SignInModal-module__closeButton___yf-ZW svg{height:1em;width:1em}.SignInModal-module__overlay___-0rmi{background:var(--cdp-web-colors-backgroundOverlay);box-sizing:border-box;-webkit-backdrop-filter:blur(.5em);backdrop-filter:blur(.5em);display:grid;grid-template-rows:auto 1fr;inset:0;overflow-y:auto;place-items:end center;position:fixed;z-index:1000}.SignInModal-module__overlay___-0rmi[data-state=open]{animation:SignInModal-module__fadeIn___-TaAT .2s ease-out}.SignInModal-module__overlay___-0rmi[data-state=closed]{animation:SignInModal-module__fadeOut___bzuhB .2s ease-in}.SignInModal-module__spacer___x-lRH{height:1em}@keyframes SignInModal-module__fadeIn___-TaAT{0%{opacity:0}to{opacity:1}}@keyframes SignInModal-module__fadeOut___bzuhB{0%{opacity:1}to{opacity:0}}@keyframes SignInModal-module__slideIn___7GyWR{0%{transform:translateY(100%)}to{transform:translateY(0)}}@keyframes SignInModal-module__slideOut___Ntrrb{0%{transform:translateY(0)}to{transform:translateY(100%)}}@media (min-width: 400px){.SignInModal-module__overlay___-0rmi{padding:.5rem}}@media (min-width: 600px){.SignInModal-module__overlay___-0rmi{place-items:center;padding:1rem;grid-template-rows:1fr}.SignInModal-module__modal___PErrT{height:auto}.SignInModal-module__spacer___x-lRH{display:none}.SignInModal-module__signIn___hQuJk{padding-left:0;padding-right:0}.SignInModal-module__closeWrapper___cx8Zq,.SignInModal-module__signInImage___hMBda,.SignInModal-module__signInTitle___AF-XA,.SignInModal-module__signInDescription___SZjXu,.SignInModal-module__signInForm___6-UdI>form,.SignInModal-module__signInForm___6-UdI>div{padding-left:2.5em;padding-right:2.5em}.SignInModal-module__signInImage___hMBda{align-self:flex-start;margin:0}.SignInModal-module__signInTitle___AF-XA,.SignInModal-module__signInDescription___SZjXu{text-align:left}@keyframes SignInModal-module__slideIn___7GyWR{0%{transform:translateY(10%)}to{transform:translateY(0)}}@keyframes SignInModal-module__slideOut___Ntrrb{0%{transform:translateY(0)}to{transform:translateY(10%)}}}
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import { HTMLAttributes } from 'react';
|
|
2
|
+
export declare const AuthButton: (props: HTMLAttributes<HTMLDivElement>) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,20 +1,38 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useIsSignedIn as
|
|
3
|
-
import { useState as
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
1
|
+
import { jsxs as I, jsx as i } from "react/jsx-runtime";
|
|
2
|
+
import { useIsInitialized as O, useIsSignedIn as T, useEvmAddress as A } from "@coinbase/cdp-hooks";
|
|
3
|
+
import { useMemo as _, useState as d, useRef as f, useCallback as w, useEffect as S } from "react";
|
|
4
|
+
import { LoadingSkeleton as v } from "../LoadingSkeleton/index.js";
|
|
5
|
+
import { SignInModal as x } from "../SignInModal/index.js";
|
|
6
|
+
import { SignOutButton as B } from "../SignOutButton/index.js";
|
|
7
|
+
import '../../assets/AuthButton.css';const M = "AuthButton-module__loading___JpDqi", R = {
|
|
8
|
+
loading: M
|
|
9
|
+
}, y = (g) => {
|
|
10
|
+
const s = O(), c = T(), l = A(), o = _(() => c && !!l, [c, l]), [a, n] = d(o), [u, m] = d(!1), e = f(null), t = f(null), r = w(() => {
|
|
11
|
+
m(!1), e.current && clearTimeout(e.current), e.current = setTimeout(() => {
|
|
12
|
+
n(!0);
|
|
13
|
+
}, 200);
|
|
14
|
+
}, []), h = () => {
|
|
15
|
+
t.current && clearTimeout(t.current), t.current = setTimeout(() => {
|
|
16
|
+
r();
|
|
17
|
+
}, 300);
|
|
18
|
+
}, p = () => {
|
|
19
|
+
n(!1);
|
|
15
20
|
};
|
|
16
|
-
return
|
|
21
|
+
return S(() => {
|
|
22
|
+
if (o) {
|
|
23
|
+
if (e.current || t.current)
|
|
24
|
+
return;
|
|
25
|
+
u ? r() : n(!0);
|
|
26
|
+
} else
|
|
27
|
+
n(!1);
|
|
28
|
+
}, [o, u, r]), S(() => () => {
|
|
29
|
+
e.current && clearTimeout(e.current), t.current && clearTimeout(t.current);
|
|
30
|
+
}, []), /* @__PURE__ */ I("div", { ...g, children: [
|
|
31
|
+
!s && /* @__PURE__ */ i(v, { className: R.loading }),
|
|
32
|
+
s && a && /* @__PURE__ */ i(B, { onSuccess: p }),
|
|
33
|
+
s && !a && /* @__PURE__ */ i(x, { open: u, setIsOpen: m, onSuccess: h })
|
|
34
|
+
] });
|
|
17
35
|
};
|
|
18
36
|
export {
|
|
19
|
-
|
|
37
|
+
y as AuthButton
|
|
20
38
|
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { CSSProperties, ElementType } from 'react';
|
|
2
|
+
interface LoadingSkeletonProps {
|
|
3
|
+
as?: ElementType;
|
|
4
|
+
className?: string;
|
|
5
|
+
style?: CSSProperties;
|
|
6
|
+
}
|
|
7
|
+
export declare const LoadingSkeleton: ({ as: Component, className, style, }: LoadingSkeletonProps) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
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,40 +1,40 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useSignInWithEmail as
|
|
3
|
-
import { Form as
|
|
4
|
-
import {
|
|
1
|
+
import { jsxs as o, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { useSignInWithEmail as U, useVerifyEmailOTP as A } from "@coinbase/cdp-hooks";
|
|
3
|
+
import { Form as R, FormSubmit as C } from "@radix-ui/react-form";
|
|
4
|
+
import { useState as I, useEffect as T, useRef as F } from "react";
|
|
5
|
+
import { Field as B } from "../Field/index.js";
|
|
6
|
+
import { withValidityState as x } from "../Input/index.js";
|
|
7
|
+
import { LoadingSpinner as V } from "../LoadingSpinner/index.js";
|
|
8
|
+
import { OTP as k } from "../OTP/index.js";
|
|
9
|
+
import { ServerError as O } from "../ServerError/index.js";
|
|
10
|
+
import { VisuallyHidden as W } from "../VisuallyHidden/index.js";
|
|
11
|
+
import { IconCoinbaseWordmark as D } from "../../icons/IconCoinbaseWordmark.js";
|
|
12
|
+
import { IconLock as $ } from "../../icons/IconLock.js";
|
|
13
|
+
import { isApiError as P } from "../../utils/isApiError.js";
|
|
14
|
+
import { isEmailInvalid as j } from "../../utils/isEmailInvalid.js";
|
|
15
|
+
import { s } from "../../chunks/SignIn.module.Dl3CqKQ_.js";
|
|
16
|
+
import { useSignInContext as g } from "./SignInProvider.js";
|
|
5
17
|
import { Button as b } from "../Button/index.js";
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
import { IconLock as V } from "../../icons/IconLock.js";
|
|
11
|
-
import { isApiError as T } from "../../utils/isApiError.js";
|
|
12
|
-
import { isEmailInvalid as k } from "../../utils/isEmailInvalid.js";
|
|
13
|
-
import { s as a } from "../../chunks/SignIn.module.Dl3CqKQ_.js";
|
|
14
|
-
import { useSignInContext as S } from "./SignInProvider.js";
|
|
15
|
-
import { withValidityState as W } from "../Input/index.js";
|
|
16
|
-
import { LoadingSpinner as D } from "../LoadingSpinner/index.js";
|
|
17
|
-
import { VisuallyHidden as $ } from "../VisuallyHidden/index.js";
|
|
18
|
-
const j = ({ submit: f }) => {
|
|
19
|
-
const { state: n, dispatch: d } = S(), e = () => d({ type: "CLEAR_ERROR" }), h = (p) => (p.preventDefault(), f(n.email));
|
|
20
|
-
return /* @__PURE__ */ i(
|
|
21
|
-
I,
|
|
18
|
+
const q = ({ submit: u }) => {
|
|
19
|
+
const { state: n, dispatch: d } = g(), e = () => d({ type: "CLEAR_ERROR" }), f = (p) => (p.preventDefault(), u(n.email));
|
|
20
|
+
return /* @__PURE__ */ o(
|
|
21
|
+
R,
|
|
22
22
|
{
|
|
23
|
-
className:
|
|
23
|
+
className: s.form,
|
|
24
24
|
onClearServerErrors: e,
|
|
25
|
-
onSubmit:
|
|
25
|
+
onSubmit: f,
|
|
26
26
|
children: [
|
|
27
27
|
/* @__PURE__ */ t(
|
|
28
|
-
|
|
28
|
+
B,
|
|
29
29
|
{
|
|
30
30
|
label: "Email address",
|
|
31
31
|
name: "email",
|
|
32
32
|
validators: [
|
|
33
33
|
["valueMissing", "Email is required"],
|
|
34
34
|
["typeMismatch", "Use a valid email address"],
|
|
35
|
-
[
|
|
35
|
+
[j, "Use a valid email address"]
|
|
36
36
|
],
|
|
37
|
-
children:
|
|
37
|
+
children: x({
|
|
38
38
|
type: "email",
|
|
39
39
|
placeholder: "name@example.com",
|
|
40
40
|
required: !0,
|
|
@@ -45,50 +45,50 @@ const j = ({ submit: f }) => {
|
|
|
45
45
|
})
|
|
46
46
|
}
|
|
47
47
|
),
|
|
48
|
-
n.error && /* @__PURE__ */ t(
|
|
49
|
-
/* @__PURE__ */ t(
|
|
48
|
+
n.error && /* @__PURE__ */ t(O, { error: n.error, className: s.serverError }),
|
|
49
|
+
/* @__PURE__ */ t(C, { asChild: !0, children: /* @__PURE__ */ t(b, { type: "submit", isPending: n.isPending, children: "Continue with email" }) })
|
|
50
50
|
]
|
|
51
51
|
}
|
|
52
52
|
);
|
|
53
|
-
},
|
|
54
|
-
reset:
|
|
53
|
+
}, H = ({
|
|
54
|
+
reset: u,
|
|
55
55
|
resetCountdown: n,
|
|
56
56
|
submit: d
|
|
57
57
|
}) => {
|
|
58
|
-
const { state: e, dispatch:
|
|
59
|
-
|
|
58
|
+
const { state: e, dispatch: f } = g(), p = () => f({ type: "CLEAR_ERROR" }), c = F([]), h = (m) => (m.preventDefault(), d(e.otp)), E = () => {
|
|
59
|
+
u(), c.current[0]?.focus();
|
|
60
60
|
};
|
|
61
|
-
return
|
|
62
|
-
e.step === "otp" &&
|
|
63
|
-
}, [e.step]), /* @__PURE__ */
|
|
64
|
-
|
|
61
|
+
return T(() => {
|
|
62
|
+
e.step === "otp" && c.current[0]?.focus();
|
|
63
|
+
}, [e.step]), /* @__PURE__ */ o(
|
|
64
|
+
R,
|
|
65
65
|
{
|
|
66
|
-
className: `${
|
|
66
|
+
className: `${s.form}`,
|
|
67
67
|
onClearServerErrors: p,
|
|
68
|
-
onSubmit:
|
|
68
|
+
onSubmit: h,
|
|
69
69
|
children: [
|
|
70
70
|
/* @__PURE__ */ t(
|
|
71
|
-
|
|
71
|
+
k,
|
|
72
72
|
{
|
|
73
|
-
ref:
|
|
73
|
+
ref: c,
|
|
74
74
|
name: "otp",
|
|
75
75
|
"aria-label": "Six-digit Verification Code",
|
|
76
76
|
passwordLength: 6,
|
|
77
77
|
value: e.otp,
|
|
78
|
-
onChange: (
|
|
79
|
-
onValueChange: (
|
|
80
|
-
|
|
78
|
+
onChange: (m) => m.preventDefault(),
|
|
79
|
+
onValueChange: (m) => {
|
|
80
|
+
f({ type: "SET_OTP", payload: { otp: m } });
|
|
81
81
|
},
|
|
82
82
|
autoSubmit: !0
|
|
83
83
|
}
|
|
84
84
|
),
|
|
85
|
-
/* @__PURE__ */
|
|
86
|
-
(e.isPending && !e.canResetOTP || e.error) && /* @__PURE__ */
|
|
87
|
-
e.isPending && !e.canResetOTP && /* @__PURE__ */ t(
|
|
88
|
-
e.error && /* @__PURE__ */ t(
|
|
85
|
+
/* @__PURE__ */ o("div", { className: s.formFooter, children: [
|
|
86
|
+
(e.isPending && !e.canResetOTP || e.error) && /* @__PURE__ */ o("div", { className: s.serverStateWrapper, children: [
|
|
87
|
+
e.isPending && !e.canResetOTP && /* @__PURE__ */ t(V, { className: s.loadingSpinner }),
|
|
88
|
+
e.error && /* @__PURE__ */ t(O, { error: e.error, className: s.serverError })
|
|
89
89
|
] }),
|
|
90
|
-
/* @__PURE__ */
|
|
91
|
-
e.canResetOTP && /* @__PURE__ */ t(
|
|
90
|
+
/* @__PURE__ */ o("div", { children: [
|
|
91
|
+
e.canResetOTP && /* @__PURE__ */ t(C, { asChild: !0, children: /* @__PURE__ */ t(
|
|
92
92
|
b,
|
|
93
93
|
{
|
|
94
94
|
type: "button",
|
|
@@ -98,13 +98,13 @@ const j = ({ submit: f }) => {
|
|
|
98
98
|
children: "Resend code"
|
|
99
99
|
}
|
|
100
100
|
) }),
|
|
101
|
-
!e.canResetOTP && /* @__PURE__ */ t("div", { className:
|
|
101
|
+
!e.canResetOTP && /* @__PURE__ */ t("div", { className: s.resetTimer, children: /* @__PURE__ */ o("p", { children: [
|
|
102
102
|
"Resend code in ",
|
|
103
|
-
/* @__PURE__ */
|
|
103
|
+
/* @__PURE__ */ o("span", { "aria-hidden": "true", children: [
|
|
104
104
|
n,
|
|
105
105
|
"s"
|
|
106
106
|
] }),
|
|
107
|
-
/* @__PURE__ */
|
|
107
|
+
/* @__PURE__ */ o(W, { children: [
|
|
108
108
|
n,
|
|
109
109
|
" ",
|
|
110
110
|
n === 1 ? "second" : "seconds"
|
|
@@ -115,63 +115,72 @@ const j = ({ submit: f }) => {
|
|
|
115
115
|
]
|
|
116
116
|
}
|
|
117
117
|
);
|
|
118
|
-
},
|
|
119
|
-
as:
|
|
118
|
+
}, ce = ({
|
|
119
|
+
as: u = "div",
|
|
120
120
|
className: n = "",
|
|
121
121
|
onSuccess: d,
|
|
122
122
|
...e
|
|
123
123
|
}) => {
|
|
124
|
-
const
|
|
125
|
-
|
|
126
|
-
|
|
124
|
+
const c = "An error occurred while signing in. Please try again.", [h, E] = I(0), [m, y] = I(!1), _ = U(), w = A(), { state: i, dispatch: l } = g(), L = (a) => {
|
|
125
|
+
E(a), y(!0);
|
|
126
|
+
};
|
|
127
|
+
T(() => {
|
|
128
|
+
if (!m)
|
|
129
|
+
return;
|
|
130
|
+
const a = setInterval(() => {
|
|
131
|
+
E((r) => r > 1 ? r - 1 : (y(!1), 0));
|
|
132
|
+
}, 1e3);
|
|
133
|
+
return () => clearInterval(a);
|
|
134
|
+
}, [m]), T(() => {
|
|
135
|
+
h === 0 && i.step === "otp" && !i.canResetOTP && l({ type: "ALLOW_RESET_OTP" });
|
|
136
|
+
}, [h, i.step, i.canResetOTP, l]);
|
|
137
|
+
const v = async (a) => {
|
|
138
|
+
if (!i.isPending) {
|
|
139
|
+
l({ type: "SUBMIT_EMAIL", payload: { email: a } });
|
|
127
140
|
try {
|
|
128
|
-
const { flowId: r } = await
|
|
129
|
-
email:
|
|
141
|
+
const { flowId: r } = await _({
|
|
142
|
+
email: a
|
|
130
143
|
});
|
|
131
|
-
|
|
144
|
+
l({ type: "SUBMIT_EMAIL_SUCCESS", payload: { flowId: r } }), L(60);
|
|
132
145
|
} catch (r) {
|
|
133
|
-
const
|
|
134
|
-
|
|
146
|
+
const S = P(r) ? r : r instanceof Error && r.message || c;
|
|
147
|
+
l({ type: "SUBMIT_EMAIL_FAILURE", payload: { error: S } }), console.error(r);
|
|
135
148
|
}
|
|
136
149
|
}
|
|
137
|
-
},
|
|
138
|
-
if (!
|
|
139
|
-
if (
|
|
140
|
-
|
|
150
|
+
}, N = async (a) => {
|
|
151
|
+
if (!i.isPending) {
|
|
152
|
+
if (a.length !== 6) {
|
|
153
|
+
l({ type: "SET_OTP", payload: { otp: a } });
|
|
141
154
|
return;
|
|
142
155
|
}
|
|
143
|
-
|
|
156
|
+
l({ type: "SUBMIT_OTP", payload: { otp: a } });
|
|
144
157
|
try {
|
|
145
|
-
await
|
|
146
|
-
flowId:
|
|
147
|
-
otp:
|
|
148
|
-
}),
|
|
158
|
+
await w({
|
|
159
|
+
flowId: i.flowId,
|
|
160
|
+
otp: a
|
|
161
|
+
}), l({ type: "SUBMIT_OTP_SUCCESS", payload: { otp: a } }), d?.();
|
|
149
162
|
} catch (r) {
|
|
150
|
-
const
|
|
151
|
-
|
|
163
|
+
const S = P(r) ? r : r instanceof Error && r.message || c;
|
|
164
|
+
l({ type: "SUBMIT_OTP_FAILURE", payload: { error: S } }), console.error(r);
|
|
152
165
|
}
|
|
153
166
|
}
|
|
154
|
-
},
|
|
155
|
-
|
|
156
|
-
c((r) => r === 1 ? (m.current && clearInterval(m.current), s({ type: "ALLOW_RESET_OTP" }), 0) : r - 1);
|
|
157
|
-
}, 1e3);
|
|
158
|
-
}, w = () => {
|
|
159
|
-
s({ type: "RESET_OTP" }), g(u.email), v(60);
|
|
167
|
+
}, M = () => {
|
|
168
|
+
l({ type: "RESET_OTP" }), y(!1), v(i.email);
|
|
160
169
|
};
|
|
161
|
-
return /* @__PURE__ */
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
/* @__PURE__ */ t("hr", { className:
|
|
165
|
-
/* @__PURE__ */
|
|
166
|
-
/* @__PURE__ */ t(
|
|
167
|
-
/* @__PURE__ */
|
|
170
|
+
return /* @__PURE__ */ o(u, { className: `${s.form} ${n}`, ...e, children: [
|
|
171
|
+
i.step === "email" && /* @__PURE__ */ t(q, { submit: v }),
|
|
172
|
+
i.step === "otp" && /* @__PURE__ */ t(H, { submit: N, reset: M, resetCountdown: h }),
|
|
173
|
+
/* @__PURE__ */ t("hr", { className: s.hr }),
|
|
174
|
+
/* @__PURE__ */ o("div", { className: s.footer, children: [
|
|
175
|
+
/* @__PURE__ */ t($, { className: s.icon }),
|
|
176
|
+
/* @__PURE__ */ o("p", { children: [
|
|
168
177
|
"Secured by",
|
|
169
178
|
" ",
|
|
170
|
-
/* @__PURE__ */ t("a", { href: "https://www.coinbase.com/security", target: "_blank", rel: "noreferrer", children: /* @__PURE__ */ t(
|
|
179
|
+
/* @__PURE__ */ t("a", { href: "https://www.coinbase.com/security", target: "_blank", rel: "noreferrer", children: /* @__PURE__ */ t(D, { className: s.coinbaseIcon, "aria-label": "Coinbase" }) })
|
|
171
180
|
] })
|
|
172
181
|
] })
|
|
173
182
|
] });
|
|
174
183
|
};
|
|
175
184
|
export {
|
|
176
|
-
|
|
185
|
+
ce as SignInForm
|
|
177
186
|
};
|
|
@@ -6,7 +6,7 @@ import { SignInForm as I } from "./SignInForm.js";
|
|
|
6
6
|
import { SignInImage as c } from "./SignInImage.js";
|
|
7
7
|
import { SignInProvider as f, useSignInContext as S } from "./SignInProvider.js";
|
|
8
8
|
import { SignInTitle as a } from "./SignInTitle.js";
|
|
9
|
-
const l = ({ className: t, children: o, onSuccess: m }) => {
|
|
9
|
+
const l = ({ className: t = "", children: o, onSuccess: m }) => {
|
|
10
10
|
const { state: e } = S(), r = typeof o == "function" ? o(e) : o;
|
|
11
11
|
return /* @__PURE__ */ i("div", { className: `${g.signIn} ${t}`, children: [
|
|
12
12
|
r,
|
|
@@ -2,13 +2,13 @@ import { jsxs as o, jsx as n } from "react/jsx-runtime";
|
|
|
2
2
|
import { Dialog as g, DialogTrigger as c, DialogPortal as m, DialogOverlay as _, DialogContent as d, DialogClose as I, DialogTitle as p, DialogDescription as u } from "@radix-ui/react-dialog";
|
|
3
3
|
import "react";
|
|
4
4
|
import { IconXMark as h } from "../../icons/IconXMark.js";
|
|
5
|
-
import { Button as r } from "../Button/index.js";
|
|
6
5
|
import { SignIn as S } from "../SignIn/index.js";
|
|
7
6
|
import { useTheme as D } from "../ThemeProvider/index.js";
|
|
8
7
|
import { SignInImage as M } from "../SignIn/SignInImage.js";
|
|
9
8
|
import { SignInTitle as f } from "../SignIn/SignInTitle.js";
|
|
10
9
|
import { SignInDescription as v } from "../SignIn/SignInDescription.js";
|
|
11
10
|
import { SignInForm as N } from "../SignIn/SignInForm.js";
|
|
11
|
+
import { Button as r } from "../Button/index.js";
|
|
12
12
|
import '../../assets/SignInModal.css';const y = "SignInModal-module__trigger___IcJ8x", T = "SignInModal-module__modal___PErrT", C = "SignInModal-module__signIn___hQuJk", x = "SignInModal-module__signInForm___6-UdI", B = "SignInModal-module__signInTitle___AF-XA", F = "SignInModal-module__signInDescription___SZjXu", W = "SignInModal-module__signInImage___hMBda", j = "SignInModal-module__closeWrapper___cx8Zq", X = "SignInModal-module__closeButton___yf-ZW", Z = "SignInModal-module__overlay___-0rmi", b = "SignInModal-module__spacer___x-lRH", i = {
|
|
13
13
|
trigger: y,
|
|
14
14
|
modal: T,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx as s } from "react/jsx-runtime";
|
|
2
2
|
import { useSignOut as r } from "@coinbase/cdp-hooks";
|
|
3
3
|
import "react";
|
|
4
|
-
import { Button as m } from "../Button/index.js";
|
|
5
4
|
import "../../theme/theme.js";
|
|
5
|
+
import { Button as m } from "../Button/index.js";
|
|
6
6
|
import '../../assets/SignOutButton.css';const g = "SignOutButton-module__signOutButton___WNhmy", c = {
|
|
7
7
|
signOutButton: g
|
|
8
8
|
}, l = ({ children: t, variant: n = "primary", onSuccess: o }) => {
|
package/dist/theme/theme.d.ts
CHANGED
package/dist/theme/tokens.d.ts
CHANGED
package/dist/theme/tokens.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coinbase/cdp-react",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.5",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"dependencies": {
|
|
6
6
|
"@radix-ui/react-dialog": "^1.1.14",
|
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
},
|
|
10
10
|
"peerDependencies": {
|
|
11
11
|
"react": ">=18.2.0",
|
|
12
|
-
"@coinbase/cdp-
|
|
13
|
-
"@coinbase/cdp-
|
|
12
|
+
"@coinbase/cdp-core": "^0.0.5",
|
|
13
|
+
"@coinbase/cdp-hooks": "^0.0.5"
|
|
14
14
|
},
|
|
15
15
|
"devDependencies": {
|
|
16
16
|
"@size-limit/preset-big-lib": "^11.2.0",
|
|
@@ -34,8 +34,8 @@
|
|
|
34
34
|
"vite": "^7.0.4",
|
|
35
35
|
"vite-plugin-dts": "^4.5.4",
|
|
36
36
|
"vite-plugin-lib-inject-css": "^2.2.2",
|
|
37
|
-
"@coinbase/cdp-core": "^0.0.
|
|
38
|
-
"@coinbase/cdp-hooks": "^0.0.
|
|
37
|
+
"@coinbase/cdp-core": "^0.0.5",
|
|
38
|
+
"@coinbase/cdp-hooks": "^0.0.5"
|
|
39
39
|
},
|
|
40
40
|
"size-limit": [
|
|
41
41
|
{
|