@coinbase/cdp-react 0.0.109 → 0.0.110
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/OAuthStatusModal.css +1 -1
- package/dist/assets/SignIn.css +1 -1
- package/dist/assets/SignInImage.css +1 -1
- package/dist/assets/StatusView.css +1 -0
- package/dist/assets/SwitchTransition.css +1 -1
- package/dist/chunks/{CDPReactProvider.CFWIUvzR.js → CDPReactProvider.BWInVuNJ.js} +89 -86
- package/dist/chunks/LinkAuthFlow.0FnIchwa.js +144 -0
- package/dist/chunks/index.Du1vsLh6.js +23 -0
- package/dist/components/CDPReactProvider/index.d.ts +7 -1
- package/dist/components/CDPReactProvider/index.js +11 -7
- package/dist/components/EnrollMfa/index.js +1 -1
- package/dist/components/EnrollMfaModal/index.js +1 -1
- package/dist/components/ExportWallet/index.js +6 -4
- package/dist/components/ExportWalletModal/index.js +1 -1
- package/dist/components/Fund/index.js +1 -1
- package/dist/components/FundModal/index.js +1 -1
- package/dist/components/LinkAuth/LinkAuthFlow.js +9 -5
- package/dist/components/LinkAuth/LinkAuthFlowBackButton.js +2 -2
- package/dist/components/LinkAuth/LinkAuthFlowProvider.d.ts +22 -8
- package/dist/components/LinkAuth/LinkAuthFlowProvider.js +2 -2
- package/dist/components/LinkAuth/LinkAuthItem.js +1 -1
- package/dist/components/LinkAuth/LinkAuthItems.js +35 -28
- package/dist/components/LinkAuth/LinkAuthProvider.js +25 -18
- package/dist/components/LinkAuth/index.d.ts +2 -2
- package/dist/components/LinkAuth/index.js +63 -62
- package/dist/components/LinkAuth/types.d.ts +6 -1
- package/dist/components/LinkAuth/types.js +5 -3
- package/dist/components/LinkAuth/utils.js +3 -3
- package/dist/components/LinkAuthModal/index.d.ts +1 -1
- package/dist/components/LinkAuthModal/index.js +56 -46
- package/dist/components/OAuthStatusModal/index.js +113 -135
- package/dist/components/SignIn/SignInAuthMethodButtons.d.ts +5 -2
- package/dist/components/SignIn/SignInAuthMethodButtons.js +83 -52
- package/dist/components/SignIn/SignInBackButton.js +1 -1
- package/dist/components/SignIn/SignInDescription.js +2 -2
- package/dist/components/SignIn/SignInForm.js +2 -2
- package/dist/components/SignIn/SignInImage.d.ts +12 -3
- package/dist/components/SignIn/SignInImage.js +36 -13
- package/dist/components/SignIn/SignInProvider.js +5 -4
- package/dist/components/SignIn/SignInTitle.js +2 -2
- package/dist/components/SignIn/flows/SignInWithEmail.d.ts +0 -4
- package/dist/components/SignIn/flows/SignInWithEmail.js +73 -74
- package/dist/components/SignIn/flows/SignInWithOAuth.js +1 -1
- package/dist/components/SignIn/flows/SignInWithSiwe.d.ts +27 -0
- package/dist/components/SignIn/flows/SignInWithSiwe.js +63 -0
- package/dist/components/SignIn/flows/SignInWithSms.d.ts +0 -6
- package/dist/components/SignIn/flows/SignInWithSms.js +85 -86
- package/dist/components/SignIn/hooks/useEmailForm.js +13 -13
- package/dist/components/SignIn/hooks/useFlowTransition.d.ts +14 -0
- package/dist/components/SignIn/hooks/useFlowTransition.js +13 -0
- package/dist/components/SignIn/hooks/useOTPForm.js +29 -29
- package/dist/components/SignIn/hooks/usePhoneNumberForm.js +10 -10
- package/dist/components/SignIn/hooks/useStartSiwe.d.ts +10 -0
- package/dist/components/SignIn/hooks/useStartSiwe.js +24 -0
- package/dist/components/SignIn/index.d.ts +2 -2
- package/dist/components/SignIn/index.js +29 -29
- package/dist/components/SignIn/types.d.ts +24 -2
- package/dist/components/SignIn/types.js +5 -1
- package/dist/components/SignIn/useSignInReducer.js +67 -46
- package/dist/components/SignInModal/index.d.ts +1 -1
- package/dist/components/SignInModal/index.js +77 -67
- package/dist/components/SiweStatusView/connectors/baseAccount.d.ts +22 -0
- package/dist/components/SiweStatusView/connectors/baseAccount.js +49 -0
- package/dist/components/SiweStatusView/connectors/siweConnectors.d.ts +6 -0
- package/dist/components/SiweStatusView/connectors/siweConnectors.js +9 -0
- package/dist/components/SiweStatusView/connectors/types.d.ts +45 -0
- package/dist/components/SiweStatusView/connectors/types.js +2 -0
- package/dist/components/SiweStatusView/getSiweErrorMessage.d.ts +13 -0
- package/dist/components/SiweStatusView/getSiweErrorMessage.js +15 -0
- package/dist/components/SiweStatusView/index.d.ts +36 -0
- package/dist/components/SiweStatusView/index.js +71 -0
- package/dist/components/SiweStatusView/toSiweProvider.d.ts +10 -0
- package/dist/components/SiweStatusView/toSiweProvider.js +13 -0
- package/dist/components/SiweStatusView/useSiweFlow.d.ts +37 -0
- package/dist/components/SiweStatusView/useSiweFlow.js +35 -0
- package/dist/components/VerifyMfa/index.js +1 -1
- package/dist/components/VerifyMfaInline/index.js +1 -1
- package/dist/components/VerifyMfaModal/index.js +1 -1
- package/dist/components/ui/StatusView/index.d.ts +35 -0
- package/dist/components/ui/StatusView/index.js +55 -0
- package/dist/components/ui/SwitchFadeTransition/index.d.ts +1 -1
- package/dist/components/ui/SwitchFadeTransition/index.js +8 -12
- package/dist/components/ui/SwitchSlideTransition/index.d.ts +1 -1
- package/dist/components/ui/SwitchSlideTransition/index.js +8 -12
- package/dist/components/ui/SwitchTransition/index.d.ts +10 -3
- package/dist/components/ui/SwitchTransition/index.js +99 -98
- package/dist/hooks/useVerifyMfaModal.js +1 -1
- package/dist/icons/IconBaseColorLogo.d.ts +10 -0
- package/dist/icons/IconBaseColorLogo.js +13 -0
- package/dist/icons/IconBaseLogo.d.ts +24 -0
- package/dist/icons/IconBaseLogo.js +13 -0
- package/dist/icons/index.d.ts +2 -0
- package/dist/icons/index.js +36 -32
- package/dist/index.js +230 -225
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +13 -6
- package/dist/assets/SwitchFadeTransition.css +0 -1
- package/dist/assets/SwitchSlideTransition.css +0 -1
- package/dist/chunks/LinkAuthFlow.S1XbYaG5.js +0 -111
- package/dist/chunks/index.IrJ_irKX.js +0 -17
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { SiweProviderType } from './connectors/siweConnectors';
|
|
2
|
+
/**
|
|
3
|
+
* Extracts the SIWE provider type from an auth method (e.g. `"siwe:base"` -> `"base"`).
|
|
4
|
+
*
|
|
5
|
+
* @param {string} [authMethod] - The auth method to convert.
|
|
6
|
+
* @returns {SiweProviderType | undefined} The SIWE provider type, or undefined if not a known SIWE provider.
|
|
7
|
+
*
|
|
8
|
+
* @group Utilities
|
|
9
|
+
*/
|
|
10
|
+
export declare function toSiweProvider(authMethod?: string): SiweProviderType | undefined;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { siweConnectors as n } from "./connectors/siweConnectors.js";
|
|
2
|
+
function o(i) {
|
|
3
|
+
return i in n;
|
|
4
|
+
}
|
|
5
|
+
function s(i) {
|
|
6
|
+
if (!i)
|
|
7
|
+
return;
|
|
8
|
+
const r = i.startsWith("siwe:") ? i.split(":")[1] : i;
|
|
9
|
+
return o(r) ? r : void 0;
|
|
10
|
+
}
|
|
11
|
+
export {
|
|
12
|
+
s as toSiweProvider
|
|
13
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { SiweProviderType } from './connectors/siweConnectors';
|
|
2
|
+
/**
|
|
3
|
+
* Handlers invoked as a SIWE attempt progresses. `onSuccess`/`onError` only fire when the attempt
|
|
4
|
+
* is still the most recent one, so a stale resolution from an abandoned flow is ignored.
|
|
5
|
+
*/
|
|
6
|
+
export interface SiweFlowHandlers {
|
|
7
|
+
/** Called when the attempt starts, before the wallet connects. Always fires. */
|
|
8
|
+
onStart?: () => void;
|
|
9
|
+
/** Called when the attempt completes successfully and is still the latest attempt. */
|
|
10
|
+
onSuccess?: () => void;
|
|
11
|
+
/**
|
|
12
|
+
* Called when the attempt fails and is still the latest attempt, with a user-facing message
|
|
13
|
+
* (or `undefined` to fall back to a generic message).
|
|
14
|
+
*/
|
|
15
|
+
onError?: (message: string | undefined) => void;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* The return type of the useSiweFlow hook.
|
|
19
|
+
*/
|
|
20
|
+
export interface UseSiweFlowReturnType {
|
|
21
|
+
/** Runs a guarded SIWE attempt, invoking the handlers as it progresses. */
|
|
22
|
+
start: (handlers?: SiweFlowHandlers) => Promise<void>;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* A generic hook for authenticating with a SIWE provider (e.g. Base) via Sign In With Ethereum.
|
|
26
|
+
*
|
|
27
|
+
* It connects the wallet via the provider's connector, runs the SIWE flow, and automatically
|
|
28
|
+
* links to the current user when already signed in.
|
|
29
|
+
*
|
|
30
|
+
* A module-scoped run guard ensures only the most recent attempt's success/error is reported, so a
|
|
31
|
+
* flow that resolves after the user navigated away cannot update the current UI. Errors are mapped
|
|
32
|
+
* to user-facing copy via {@link getSiweErrorMessage} and logged once here.
|
|
33
|
+
*
|
|
34
|
+
* @param {SiweProviderType} provider - The SIWE provider to authenticate with.
|
|
35
|
+
* @returns {UseSiweFlowReturnType} A function to start a guarded SIWE attempt.
|
|
36
|
+
*/
|
|
37
|
+
export declare const useSiweFlow: (provider: SiweProviderType) => UseSiweFlowReturnType;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { useIsSignedIn as p, useSignInWithSiwe as I, useLinkSiwe as y, useVerifySiweSignature as h } from "@coinbase/cdp-hooks";
|
|
2
|
+
import { useCallback as k } from "react";
|
|
3
|
+
import { u as C } from "../../chunks/CDPReactProvider.BWInVuNJ.js";
|
|
4
|
+
import { siweConnectors as v } from "./connectors/siweConnectors.js";
|
|
5
|
+
import { getSiweErrorMessage as E } from "./getSiweErrorMessage.js";
|
|
6
|
+
let i = 0;
|
|
7
|
+
const M = (e) => {
|
|
8
|
+
const { appName: r } = C(), { isSignedIn: s } = p(), { signInWithSiwe: a } = I(), { linkSiwe: c } = y(), { verifySiweSignature: w } = h();
|
|
9
|
+
return { start: k(
|
|
10
|
+
async (o) => {
|
|
11
|
+
const u = ++i;
|
|
12
|
+
o?.onStart?.();
|
|
13
|
+
try {
|
|
14
|
+
const t = v[e], { provider: n, address: m, chainId: S } = await t.connect(r), g = s ? c : a, { flowId: f, message: d } = await g({
|
|
15
|
+
address: m,
|
|
16
|
+
chainId: S,
|
|
17
|
+
domain: window.location.hostname,
|
|
18
|
+
uri: window.location.origin
|
|
19
|
+
}), l = await t.sign(n, d, m);
|
|
20
|
+
if (await w({ flowId: f, signature: l }), u !== i)
|
|
21
|
+
return;
|
|
22
|
+
o?.onSuccess?.();
|
|
23
|
+
} catch (t) {
|
|
24
|
+
if (u !== i)
|
|
25
|
+
return;
|
|
26
|
+
const n = E(t);
|
|
27
|
+
o?.onError?.(n), n || console.error(t);
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
[e, r, s, a, c, w]
|
|
31
|
+
) };
|
|
32
|
+
};
|
|
33
|
+
export {
|
|
34
|
+
M as useSiweFlow
|
|
35
|
+
};
|
|
@@ -2,7 +2,7 @@ import "react/jsx-runtime";
|
|
|
2
2
|
import "@coinbase/cdp-hooks";
|
|
3
3
|
import "../../chunks/useSendComponentCallOnce.BI4daEvm.js";
|
|
4
4
|
import "react";
|
|
5
|
-
import { V as p } from "../../chunks/CDPReactProvider.
|
|
5
|
+
import { V as p } from "../../chunks/CDPReactProvider.BWInVuNJ.js";
|
|
6
6
|
import "@coinbase/cdp-core";
|
|
7
7
|
import { VerifyMfaDescription as x } from "./VerifyMfaDescription.js";
|
|
8
8
|
import { VerifyMfaFlow as y } from "./VerifyMfaFlow.js";
|
|
@@ -7,7 +7,7 @@ import { c as j } from "../../chunks/lite.1fxw3LjI.js";
|
|
|
7
7
|
import { Button as H } from "../ui/Button/index.js";
|
|
8
8
|
import { SwitchFadeTransition as J } from "../ui/SwitchFadeTransition/index.js";
|
|
9
9
|
import { SwitchSlideTransition as Q } from "../ui/SwitchSlideTransition/index.js";
|
|
10
|
-
import { V as U } from "../../chunks/CDPReactProvider.
|
|
10
|
+
import { V as U } from "../../chunks/CDPReactProvider.BWInVuNJ.js";
|
|
11
11
|
import { IconArrowLeft as Z } from "../../icons/IconArrowLeft.js";
|
|
12
12
|
import "../../theme/theme.js";
|
|
13
13
|
import { useVerifyMfaContext as $ } from "../VerifyMfa/VerifyMfaProvider.js";
|
|
@@ -2,7 +2,7 @@ import "react/jsx-runtime";
|
|
|
2
2
|
import "../../chunks/useSendComponentCallOnce.BI4daEvm.js";
|
|
3
3
|
import "react";
|
|
4
4
|
import "../../chunks/lite.1fxw3LjI.js";
|
|
5
|
-
import { c, d as x, e as C } from "../../chunks/CDPReactProvider.
|
|
5
|
+
import { c, d as x, e as C } from "../../chunks/CDPReactProvider.BWInVuNJ.js";
|
|
6
6
|
import "../ui/Button/index.js";
|
|
7
7
|
import "../ui/Modal/index.js";
|
|
8
8
|
import "../ui/VisuallyHidden/index.js";
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* The status to display.
|
|
4
|
+
*/
|
|
5
|
+
export type StatusViewStatus = "pending" | "success" | "error";
|
|
6
|
+
/**
|
|
7
|
+
* Props for the StatusView component.
|
|
8
|
+
*/
|
|
9
|
+
export interface StatusViewProps {
|
|
10
|
+
/** The status to render (drives the graphic). */
|
|
11
|
+
status: StatusViewStatus;
|
|
12
|
+
/** The headline text. */
|
|
13
|
+
title: ReactNode;
|
|
14
|
+
/** Optional supporting description text. */
|
|
15
|
+
description?: ReactNode;
|
|
16
|
+
/** Visually hide the description while preserving its layout (e.g. before a countdown starts). */
|
|
17
|
+
descriptionHidden?: boolean;
|
|
18
|
+
/** An icon overlaid on the pending spinner (e.g. a provider logo). Ignored for success/error. */
|
|
19
|
+
icon?: ReactNode;
|
|
20
|
+
/** Additional content rendered below the description (e.g. a retry button). */
|
|
21
|
+
children?: ReactNode;
|
|
22
|
+
/** Optional className for the root element. */
|
|
23
|
+
className?: string;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* A generic, non-auth-specific status view that renders a pending/success/error graphic
|
|
27
|
+
* with a title, optional description, and optional extra content. Shared by the OAuth
|
|
28
|
+
* status modal and the inline SIWE flow.
|
|
29
|
+
*
|
|
30
|
+
* @param {StatusViewProps} props - The props for the component.
|
|
31
|
+
* @returns {JSX.Element} The StatusView component.
|
|
32
|
+
*
|
|
33
|
+
* @group Components
|
|
34
|
+
*/
|
|
35
|
+
export declare const StatusView: ({ status, title, description, descriptionHidden, icon, children, className, }: StatusViewProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { jsxs as e, jsx as i } from "react/jsx-runtime";
|
|
2
|
+
import { c as o } from "../../../chunks/lite.1fxw3LjI.js";
|
|
3
|
+
import "react";
|
|
4
|
+
import { LoadingSpinner as u } from "../LoadingSpinner/index.js";
|
|
5
|
+
import { IconCheck as d } from "../../../icons/IconCheck.js";
|
|
6
|
+
import { IconXMark as m } from "../../../icons/IconXMark.js";
|
|
7
|
+
import '../../../assets/StatusView.css';const p = "StatusView-module__graphic___wq1hU", h = "StatusView-module__spinner___icv07", g = "StatusView-module__icon___4B8WP", w = "StatusView-module__subhead___xhgCR", S = "StatusView-module__description___gH-Dw", v = "StatusView-module__ring___fK6w9", V = "StatusView-module__invisible___BQHRn", s = {
|
|
8
|
+
"status-view": "StatusView-module__status-view___DXdAF",
|
|
9
|
+
graphic: p,
|
|
10
|
+
spinner: h,
|
|
11
|
+
icon: g,
|
|
12
|
+
"icon-success": "StatusView-module__icon-success___rj7r1",
|
|
13
|
+
"icon-error": "StatusView-module__icon-error___sjTY6",
|
|
14
|
+
subhead: w,
|
|
15
|
+
description: S,
|
|
16
|
+
ring: v,
|
|
17
|
+
"ring-success": "StatusView-module__ring-success___UCrQB",
|
|
18
|
+
"ring-error": "StatusView-module__ring-error___yVzvS",
|
|
19
|
+
invisible: V
|
|
20
|
+
}, j = ({
|
|
21
|
+
status: r,
|
|
22
|
+
title: a,
|
|
23
|
+
description: c,
|
|
24
|
+
descriptionHidden: _,
|
|
25
|
+
icon: n,
|
|
26
|
+
children: t,
|
|
27
|
+
className: l
|
|
28
|
+
}) => /* @__PURE__ */ e("div", { className: o(s["status-view"], l), children: [
|
|
29
|
+
r === "pending" && /* @__PURE__ */ e("div", { className: s.graphic, children: [
|
|
30
|
+
/* @__PURE__ */ i(
|
|
31
|
+
u,
|
|
32
|
+
{
|
|
33
|
+
strokeWidth: "5%",
|
|
34
|
+
staticStroke: !0,
|
|
35
|
+
staticStrokeColor: "var(--cdp-web-colors-line-default)",
|
|
36
|
+
className: s.spinner
|
|
37
|
+
}
|
|
38
|
+
),
|
|
39
|
+
n && /* @__PURE__ */ i("span", { className: s.icon, children: n })
|
|
40
|
+
] }),
|
|
41
|
+
r === "success" && /* @__PURE__ */ e("div", { className: s.graphic, children: [
|
|
42
|
+
/* @__PURE__ */ i("span", { className: `${s.ring} ${s["ring-success"]}` }),
|
|
43
|
+
/* @__PURE__ */ i("span", { className: `${s.icon} ${s["icon-success"]}`, children: /* @__PURE__ */ i(d, {}) })
|
|
44
|
+
] }),
|
|
45
|
+
r === "error" && /* @__PURE__ */ e("div", { className: `${s.graphic}`, children: [
|
|
46
|
+
/* @__PURE__ */ i("span", { className: `${s.ring} ${s["ring-error"]}` }),
|
|
47
|
+
/* @__PURE__ */ i("span", { className: `${s.icon} ${s["icon-error"]}`, children: /* @__PURE__ */ i(m, {}) })
|
|
48
|
+
] }),
|
|
49
|
+
/* @__PURE__ */ i("p", { className: s.subhead, children: a }),
|
|
50
|
+
c !== void 0 && /* @__PURE__ */ i("p", { className: o(s.description, _ && s.invisible), children: c }),
|
|
51
|
+
t
|
|
52
|
+
] });
|
|
53
|
+
export {
|
|
54
|
+
j as StatusView
|
|
55
|
+
};
|
|
@@ -17,4 +17,4 @@ export type SwitchFadeTransitionRef<T extends Key> = SwitchTransitionRef<T>;
|
|
|
17
17
|
* @param props.direction - The direction of the transition.
|
|
18
18
|
* @returns {JSX.Element} The SwitchFadeTransition component.
|
|
19
19
|
*/
|
|
20
|
-
export declare const SwitchFadeTransition: <T extends Key>({ children,
|
|
20
|
+
export declare const SwitchFadeTransition: <T extends Key>({ children, ...props }: SwitchFadeTransitionProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,24 +1,20 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
2
2
|
import "react";
|
|
3
|
-
import { SwitchTransition as
|
|
4
|
-
|
|
5
|
-
"switch-fade-transition": "SwitchFadeTransition-module__switch-fade-transition___--lbT"
|
|
6
|
-
}, c = ({
|
|
3
|
+
import { SwitchTransition as i } from "../SwitchTransition/index.js";
|
|
4
|
+
const u = ({
|
|
7
5
|
children: t,
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
e,
|
|
6
|
+
...r
|
|
7
|
+
}) => /* @__PURE__ */ n(
|
|
8
|
+
i,
|
|
12
9
|
{
|
|
13
10
|
transitionName: "fade",
|
|
14
|
-
className: `${o["switch-fade-transition"]} ${i}`,
|
|
15
11
|
preEnter: !0,
|
|
16
12
|
mountOnEnter: !0,
|
|
17
13
|
unmountOnExit: !0,
|
|
18
|
-
...
|
|
14
|
+
...r,
|
|
19
15
|
children: t
|
|
20
16
|
}
|
|
21
17
|
);
|
|
22
18
|
export {
|
|
23
|
-
|
|
19
|
+
u as SwitchFadeTransition
|
|
24
20
|
};
|
|
@@ -20,4 +20,4 @@ export type SwitchSlideTransitionRef<T extends Key> = SwitchTransitionRef<T>;
|
|
|
20
20
|
* @param props.timeout - The timeout for the transition.
|
|
21
21
|
* @returns {JSX.Element} The SwitchSlideTransition component.
|
|
22
22
|
*/
|
|
23
|
-
export declare const SwitchSlideTransition: <T extends Key>({ children,
|
|
23
|
+
export declare const SwitchSlideTransition: <T extends Key>({ children, direction, timeout, ...props }: SwitchSlideTransitionProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,27 +1,23 @@
|
|
|
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
|
-
|
|
5
|
-
"switch-slide-transition": "SwitchSlideTransition-module__switch-slide-transition___FykQG"
|
|
6
|
-
}, u = ({
|
|
4
|
+
const p = ({
|
|
7
5
|
children: t,
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
...s
|
|
6
|
+
direction: r = "left",
|
|
7
|
+
timeout: n = 300,
|
|
8
|
+
...i
|
|
12
9
|
}) => /* @__PURE__ */ e(
|
|
13
10
|
o,
|
|
14
11
|
{
|
|
15
|
-
transitionName: `slide-${
|
|
16
|
-
className: `${a["switch-slide-transition"]} ${i}`,
|
|
12
|
+
transitionName: `slide-${r}`,
|
|
17
13
|
preEnter: !0,
|
|
18
14
|
mountOnEnter: !0,
|
|
19
15
|
unmountOnExit: !0,
|
|
20
|
-
timeout:
|
|
21
|
-
...
|
|
16
|
+
timeout: n,
|
|
17
|
+
...i,
|
|
22
18
|
children: t
|
|
23
19
|
}
|
|
24
20
|
);
|
|
25
21
|
export {
|
|
26
|
-
|
|
22
|
+
p as SwitchSlideTransition
|
|
27
23
|
};
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import { ElementType, HTMLAttributes, Key, ReactNode, Ref } from 'react';
|
|
2
2
|
import { TransitionMapOptions, TransitionMapResult } from '../../../hooks/useTransitionMap';
|
|
3
3
|
import { TransitionState } from '../../../utils/transition';
|
|
4
|
-
|
|
4
|
+
/**
|
|
5
|
+
* A pre-defined transition name type.
|
|
6
|
+
*/
|
|
7
|
+
type TransitionName = "fade" | "slide-left" | "slide-right";
|
|
8
|
+
export { type TransitionMapOptions, type TransitionMapResult, type TransitionState, type TransitionName, };
|
|
5
9
|
/**
|
|
6
10
|
* TransitionRef type for the SwitchTransition component.
|
|
7
11
|
*/
|
|
@@ -36,8 +40,10 @@ export interface SwitchTransitionProps<T extends Key> extends Omit<HTMLAttribute
|
|
|
36
40
|
className?: string;
|
|
37
41
|
/** Item keys to transition between. */
|
|
38
42
|
items: readonly T[] | T[];
|
|
43
|
+
/** The item to start in the entered state. Defaults to the first item. Only relevant when `initialEntered` is set. */
|
|
44
|
+
initialItem?: T;
|
|
39
45
|
/** The name of the transition. Use one of the defined values to use a pre-defined transition, or a custom string to use a custom transition. */
|
|
40
|
-
transitionName:
|
|
46
|
+
transitionName: TransitionName | string;
|
|
41
47
|
/** A ref to provide access to the transition result. */
|
|
42
48
|
transitionRef?: Ref<SwitchTransitionRef<T>>;
|
|
43
49
|
}
|
|
@@ -52,6 +58,7 @@ export interface SwitchTransitionProps<T extends Key> extends Omit<HTMLAttribute
|
|
|
52
58
|
* @param {(props: { key: T } & Partial<TransitionState>) => ReactNode} props.children - A render function for each child. A child will be rednered for each item in the `items` prop, which will be passed to the render function as the `key` prop. The TransitionState (status, isMounted, isEnter, isResolved) will also be passed to the render function as data-attributes.
|
|
53
59
|
* @param {string} props.className - The class name to apply to the component.
|
|
54
60
|
* @param {T[]} props.items - Item keys to transition between.
|
|
61
|
+
* @param {T} props.initialItem - The item to start in the entered state (defaults to the first item).
|
|
55
62
|
* @param {TransitionMapOptions["enter"]} props.enter - Enable or disable enter phase transitions.
|
|
56
63
|
* @param {TransitionMapOptions["exit"]} props.exit - Enable or disable exit phase transition.
|
|
57
64
|
* @param {TransitionMapOptions["initialEntered"]} props.initialEntered - Beginning from 'entered' state.
|
|
@@ -66,4 +73,4 @@ export interface SwitchTransitionProps<T extends Key> extends Omit<HTMLAttribute
|
|
|
66
73
|
* @param {CSSProperties} props.style - Styles to apply to the component.
|
|
67
74
|
* @returns {JSX.Element} The component.
|
|
68
75
|
*/
|
|
69
|
-
export declare const SwitchTransition: <T extends Key>({ allowMultiple, animateHeight, autoFocus, initialEntered, as: Component, children, className, enter, exit, items, mountOnEnter, onStateChange, preEnter, preExit, style, timeout, transitionName, transitionRef, unmountOnExit, ...props }: SwitchTransitionProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
76
|
+
export declare const SwitchTransition: <T extends Key>({ allowMultiple, animateHeight, autoFocus, initialEntered, as: Component, children, className, enter, exit, items, initialItem, mountOnEnter, onStateChange, preEnter, preExit, style, timeout, transitionName, transitionRef, unmountOnExit, ...props }: SwitchTransitionProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,153 +1,154 @@
|
|
|
1
|
-
import { jsx as b, Fragment as
|
|
2
|
-
import { useRef as
|
|
3
|
-
import { useTransitionMap as
|
|
4
|
-
import '../../../assets/SwitchTransition.css';const
|
|
1
|
+
import { jsx as b, Fragment as J } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as _, useId as P, useState as j, useImperativeHandle as Q, useLayoutEffect as U, useEffect as q } from "react";
|
|
3
|
+
import { useTransitionMap as V } from "../../../hooks/useTransitionMap.js";
|
|
4
|
+
import '../../../assets/SwitchTransition.css';const W = {
|
|
5
5
|
"transition-wrapper": "SwitchTransition-module__transition-wrapper___jrI35"
|
|
6
|
-
},
|
|
6
|
+
}, X = (y) => {
|
|
7
7
|
const {
|
|
8
8
|
children: n,
|
|
9
|
-
index:
|
|
10
|
-
itemKey:
|
|
11
|
-
initialEntered:
|
|
12
|
-
setItem:
|
|
13
|
-
deleteItem:
|
|
14
|
-
stateMap:
|
|
15
|
-
transitionName:
|
|
16
|
-
parentKey:
|
|
17
|
-
} =
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
}), [
|
|
21
|
-
const
|
|
22
|
-
return
|
|
23
|
-
"data-index":
|
|
9
|
+
index: i,
|
|
10
|
+
itemKey: s,
|
|
11
|
+
initialEntered: r,
|
|
12
|
+
setItem: p,
|
|
13
|
+
deleteItem: m,
|
|
14
|
+
stateMap: I,
|
|
15
|
+
transitionName: w,
|
|
16
|
+
parentKey: v
|
|
17
|
+
} = y;
|
|
18
|
+
q(() => (p(s, { initialEntered: r }), () => {
|
|
19
|
+
m(s);
|
|
20
|
+
}), [s, r, p, m]);
|
|
21
|
+
const a = I.get(s), x = a?.isMounted ?? !!r, h = a?.isEnter ?? !!r, g = a?.isResolved ?? !!r, E = a?.status ?? (r ? "entered" : void 0);
|
|
22
|
+
return x ? n({
|
|
23
|
+
"data-index": i,
|
|
24
24
|
inert: !h,
|
|
25
|
-
itemKey:
|
|
26
|
-
"data-transition":
|
|
27
|
-
"data-status":
|
|
25
|
+
itemKey: s,
|
|
26
|
+
"data-transition": w,
|
|
27
|
+
"data-status": E,
|
|
28
28
|
"data-is-enter": h,
|
|
29
|
-
"data-is-resolved":
|
|
30
|
-
"data-parent":
|
|
29
|
+
"data-is-resolved": g,
|
|
30
|
+
"data-parent": v
|
|
31
31
|
}) : null;
|
|
32
|
-
},
|
|
33
|
-
allowMultiple:
|
|
32
|
+
}, F = ({
|
|
33
|
+
allowMultiple: y,
|
|
34
34
|
animateHeight: n,
|
|
35
|
-
autoFocus:
|
|
36
|
-
initialEntered:
|
|
37
|
-
as:
|
|
38
|
-
children:
|
|
39
|
-
className:
|
|
40
|
-
enter:
|
|
41
|
-
exit:
|
|
42
|
-
items:
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
35
|
+
autoFocus: i,
|
|
36
|
+
initialEntered: s,
|
|
37
|
+
as: r = "div",
|
|
38
|
+
children: p,
|
|
39
|
+
className: m = "",
|
|
40
|
+
enter: I,
|
|
41
|
+
exit: w,
|
|
42
|
+
items: v,
|
|
43
|
+
initialItem: a,
|
|
44
|
+
mountOnEnter: x,
|
|
45
|
+
onStateChange: h,
|
|
46
|
+
preEnter: g,
|
|
47
|
+
preExit: E,
|
|
48
|
+
style: z,
|
|
48
49
|
timeout: e = 200,
|
|
49
50
|
transitionName: $,
|
|
50
|
-
transitionRef:
|
|
51
|
-
unmountOnExit:
|
|
52
|
-
...
|
|
51
|
+
transitionRef: L,
|
|
52
|
+
unmountOnExit: N,
|
|
53
|
+
...R
|
|
53
54
|
}) => {
|
|
54
|
-
const
|
|
55
|
-
allowMultiple:
|
|
55
|
+
const O = _(a ?? v[0]), A = P(), d = R.id || A, [S, B] = j(null), [M, C] = j(null), T = _(null), c = V({
|
|
56
|
+
allowMultiple: y,
|
|
56
57
|
initialEntered: !1,
|
|
57
|
-
mountOnEnter:
|
|
58
|
-
unmountOnExit:
|
|
59
|
-
preEnter:
|
|
60
|
-
preExit:
|
|
61
|
-
enter:
|
|
62
|
-
exit:
|
|
58
|
+
mountOnEnter: x,
|
|
59
|
+
unmountOnExit: N,
|
|
60
|
+
preEnter: g,
|
|
61
|
+
preExit: E,
|
|
62
|
+
enter: I,
|
|
63
|
+
exit: w,
|
|
63
64
|
timeout: e,
|
|
64
|
-
onStateChange:
|
|
65
|
+
onStateChange: h
|
|
65
66
|
});
|
|
66
|
-
|
|
67
|
-
transition: n ||
|
|
68
|
-
...
|
|
67
|
+
Q(L, () => ({
|
|
68
|
+
transition: n || i ? {
|
|
69
|
+
...c,
|
|
69
70
|
toggle: (t) => {
|
|
70
|
-
|
|
71
|
+
c.toggle(t), B(t);
|
|
71
72
|
}
|
|
72
|
-
} :
|
|
73
|
-
})),
|
|
73
|
+
} : c
|
|
74
|
+
})), U(() => {
|
|
74
75
|
if (!n)
|
|
75
76
|
return;
|
|
76
77
|
let t = null;
|
|
77
|
-
const
|
|
78
|
-
if (!
|
|
78
|
+
const o = T.current;
|
|
79
|
+
if (!o)
|
|
79
80
|
return;
|
|
80
|
-
const
|
|
81
|
-
const
|
|
82
|
-
`[data-is-enter="true"][data-parent="${
|
|
81
|
+
const l = setTimeout(() => {
|
|
82
|
+
const u = o.querySelector(
|
|
83
|
+
`[data-is-enter="true"][data-parent="${d}"]`
|
|
83
84
|
);
|
|
84
|
-
if (!
|
|
85
|
+
if (!u)
|
|
85
86
|
return;
|
|
86
|
-
const
|
|
87
|
-
|
|
88
|
-
for (const
|
|
89
|
-
const
|
|
90
|
-
|
|
87
|
+
const f = u?.scrollHeight ?? null;
|
|
88
|
+
f !== null && C(f), t = new ResizeObserver((D) => {
|
|
89
|
+
for (const G of D) {
|
|
90
|
+
const H = G.contentRect.height;
|
|
91
|
+
C(H);
|
|
91
92
|
}
|
|
92
|
-
}), t.observe(
|
|
93
|
+
}), t.observe(u);
|
|
93
94
|
}, 0);
|
|
94
95
|
return () => {
|
|
95
|
-
|
|
96
|
+
l && clearTimeout(l), t?.disconnect();
|
|
96
97
|
};
|
|
97
|
-
}, [n, S,
|
|
98
|
-
if (!
|
|
98
|
+
}, [n, S, d]), q(() => {
|
|
99
|
+
if (!i)
|
|
99
100
|
return;
|
|
100
101
|
const t = typeof e == "number" ? e : e.enter;
|
|
101
102
|
if (t === void 0)
|
|
102
103
|
return;
|
|
103
|
-
const
|
|
104
|
-
const
|
|
105
|
-
`[data-is-enter="true"][data-parent="${
|
|
104
|
+
const o = setTimeout(() => {
|
|
105
|
+
const l = T.current?.querySelector(
|
|
106
|
+
`[data-is-enter="true"][data-parent="${d}"]`
|
|
106
107
|
);
|
|
107
|
-
if (!
|
|
108
|
+
if (!l)
|
|
108
109
|
return;
|
|
109
|
-
const
|
|
110
|
-
|
|
110
|
+
const u = typeof i == "string" ? i : 'input, textarea, select, button, [tabindex]:not([tabindex="-1"])', f = l.querySelector(u);
|
|
111
|
+
f && f.focus();
|
|
111
112
|
}, t);
|
|
112
113
|
return () => {
|
|
113
|
-
|
|
114
|
+
o && clearTimeout(o);
|
|
114
115
|
};
|
|
115
|
-
}, [
|
|
116
|
-
const
|
|
117
|
-
|
|
116
|
+
}, [i, S, d, e]);
|
|
117
|
+
const K = /* @__PURE__ */ b(J, { children: v.map((t, o) => /* @__PURE__ */ b(
|
|
118
|
+
X,
|
|
118
119
|
{
|
|
119
|
-
index:
|
|
120
|
+
index: o,
|
|
120
121
|
itemKey: t,
|
|
121
|
-
setItem:
|
|
122
|
-
deleteItem:
|
|
123
|
-
stateMap:
|
|
124
|
-
initialEntered:
|
|
122
|
+
setItem: c.setItem,
|
|
123
|
+
deleteItem: c.deleteItem,
|
|
124
|
+
stateMap: c.stateMap,
|
|
125
|
+
initialEntered: s ? O.current === t : void 0,
|
|
125
126
|
transitionName: $,
|
|
126
|
-
parentKey:
|
|
127
|
-
children:
|
|
127
|
+
parentKey: d,
|
|
128
|
+
children: p
|
|
128
129
|
},
|
|
129
130
|
t
|
|
130
131
|
)) });
|
|
131
132
|
return /* @__PURE__ */ b(
|
|
132
|
-
|
|
133
|
+
r,
|
|
133
134
|
{
|
|
134
|
-
...
|
|
135
|
-
id:
|
|
135
|
+
...R,
|
|
136
|
+
id: d,
|
|
136
137
|
ref: T,
|
|
137
138
|
"data-transition": $ || void 0,
|
|
138
139
|
"data-animate-height": n,
|
|
139
|
-
className: `${
|
|
140
|
+
className: `${W["transition-wrapper"]} ${m}`,
|
|
140
141
|
style: {
|
|
141
|
-
...
|
|
142
|
+
...z,
|
|
142
143
|
"--cdp-web-transition-enter-timeout": typeof e == "object" ? `${e.enter ?? 200}ms` : void 0,
|
|
143
144
|
"--cdp-web-transition-exit-timeout": typeof e == "object" ? `${e.exit ?? 200}ms` : void 0,
|
|
144
145
|
"--cdp-web-transition-timeout": typeof e == "number" ? `${e}ms` : void 0,
|
|
145
|
-
"--cdp-web-transition-height": n &&
|
|
146
|
+
"--cdp-web-transition-height": n && M ? `${M}px` : void 0
|
|
146
147
|
},
|
|
147
|
-
children: n ? /* @__PURE__ */ b("div", { children:
|
|
148
|
+
children: n ? /* @__PURE__ */ b("div", { children: K }) : K
|
|
148
149
|
}
|
|
149
150
|
);
|
|
150
151
|
};
|
|
151
152
|
export {
|
|
152
|
-
|
|
153
|
+
F as SwitchTransition
|
|
153
154
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "react/jsx-runtime";
|
|
2
2
|
import "@coinbase/cdp-core";
|
|
3
3
|
import "../chunks/useSendComponentCallOnce.BI4daEvm.js";
|
|
4
|
-
import { g as t, h as m, f as p } from "../chunks/CDPReactProvider.
|
|
4
|
+
import { g as t, h as m, f as p } from "../chunks/CDPReactProvider.BWInVuNJ.js";
|
|
5
5
|
import "react";
|
|
6
6
|
export {
|
|
7
7
|
t as VerifyMfaModalProvider,
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { SVGProps } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Colored Base logo icon component (Base blue).
|
|
4
|
+
*
|
|
5
|
+
* @param {SVGProps<SVGSVGElement>} props - The props for the icon.
|
|
6
|
+
* @returns {JSX.Element} The Base logo icon.
|
|
7
|
+
*
|
|
8
|
+
* @group Components
|
|
9
|
+
*/
|
|
10
|
+
export declare const IconBaseColorLogo: (props: Omit<SVGProps<SVGSVGElement>, "viewBox">) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import "react";
|
|
3
|
+
import { SvgIcon as r } from "./SvgIcon.js";
|
|
4
|
+
const h = (C) => /* @__PURE__ */ o(r, { width: "32", height: "32", viewBox: "0 0 249 249", ...C, children: /* @__PURE__ */ o(
|
|
5
|
+
"path",
|
|
6
|
+
{
|
|
7
|
+
d: "M0 19.671C0 12.9332 0 9.56425 1.26956 6.97276C2.48511 4.49151 4.49151 2.48511 6.97276 1.26956C9.56425 0 12.9332 0 19.671 0H229.329C236.067 0 239.436 0 242.027 1.26956C244.508 2.48511 246.515 4.49151 247.73 6.97276C249 9.56425 249 12.9332 249 19.671V229.329C249 236.067 249 239.436 247.73 242.027C246.515 244.508 244.508 246.515 242.027 247.73C239.436 249 236.067 249 229.329 249H19.671C12.9332 249 9.56425 249 6.97276 247.73C4.49151 246.515 2.48511 244.508 1.26956 242.027C0 239.436 0 236.067 0 229.329V19.671Z",
|
|
8
|
+
fill: "#0000FF"
|
|
9
|
+
}
|
|
10
|
+
) });
|
|
11
|
+
export {
|
|
12
|
+
h as IconBaseColorLogo
|
|
13
|
+
};
|