@coinbase/cdp-react 0.0.78 → 0.0.80
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 +5 -0
- package/dist/assets/Badge.css +1 -0
- package/dist/assets/Banner.css +1 -1
- package/dist/assets/CDPReactProvider.css +1 -0
- package/dist/assets/CoinbaseFooter.css +1 -1
- package/dist/assets/CopyTextField.css +1 -0
- package/dist/assets/EnrollMfa.css +1 -0
- package/dist/assets/EnrollMfaDescription.css +1 -0
- package/dist/assets/EnrollMfaFlow.css +1 -0
- package/dist/assets/EnrollMfaFlowBackButton.css +1 -0
- package/dist/assets/EnrollMfaItems.css +1 -0
- package/dist/assets/EnrollMfaModal.css +1 -0
- package/dist/assets/EnrollMfaTitle.css +1 -0
- package/dist/assets/ExportWallet.css +1 -1
- package/dist/assets/OTPForm.css +1 -1
- package/dist/assets/QRCode.css +1 -0
- package/dist/assets/ToggleListItem.css +1 -0
- package/dist/assets/VerifyMfaDescription.css +1 -0
- package/dist/assets/VerifyMfaFlow.css +1 -0
- package/dist/assets/VerifyMfaImage.css +1 -0
- package/dist/assets/VerifyMfaInline.css +1 -0
- package/dist/assets/VerifyMfaTitle.css +1 -0
- package/dist/assets/totp.css +1 -0
- package/dist/chunks/CDPReactProvider.CIQm4C4z.js +299 -0
- package/dist/chunks/{LinkAuthFlow.3HN888DV.js → LinkAuthFlow.BaUSMzGH.js} +1 -1
- package/dist/chunks/index.CKQKBoX2.js +9 -0
- package/dist/chunks/{index.Bvudzh_y.js → index.C_DV0Ud7.js} +1 -1
- package/dist/chunks/index.Dp-lIxM1.js +9 -0
- package/dist/components/CDPReactProvider/index.d.ts +4 -1
- package/dist/components/CDPReactProvider/index.js +11 -79
- package/dist/components/CopyAddress/index.js +24 -60
- package/dist/components/EnrollMfa/EnrollMfaDescription.d.ts +6 -0
- package/dist/components/EnrollMfa/EnrollMfaDescription.js +21 -0
- package/dist/components/EnrollMfa/EnrollMfaFlow.d.ts +12 -0
- package/dist/components/EnrollMfa/EnrollMfaFlow.js +46 -0
- package/dist/components/EnrollMfa/EnrollMfaFlowBackButton.d.ts +9 -0
- package/dist/components/EnrollMfa/EnrollMfaFlowBackButton.js +39 -0
- package/dist/components/EnrollMfa/EnrollMfaFlowProvider.d.ts +21 -0
- package/dist/components/EnrollMfa/EnrollMfaFlowProvider.js +34 -0
- package/dist/components/EnrollMfa/EnrollMfaFooter.d.ts +2 -0
- package/dist/components/EnrollMfa/EnrollMfaFooter.js +7 -0
- package/dist/components/EnrollMfa/EnrollMfaImage.d.ts +6 -0
- package/dist/components/EnrollMfa/EnrollMfaImage.js +19 -0
- package/dist/components/EnrollMfa/EnrollMfaItem.d.ts +11 -0
- package/dist/components/EnrollMfa/EnrollMfaItem.js +21 -0
- package/dist/components/EnrollMfa/EnrollMfaItems.d.ts +9 -0
- package/dist/components/EnrollMfa/EnrollMfaItems.js +39 -0
- package/dist/components/EnrollMfa/EnrollMfaProvider.d.ts +14 -0
- package/dist/components/EnrollMfa/EnrollMfaProvider.js +24 -0
- package/dist/components/EnrollMfa/EnrollMfaTitle.d.ts +6 -0
- package/dist/components/EnrollMfa/EnrollMfaTitle.js +21 -0
- package/dist/components/EnrollMfa/index.d.ts +20 -0
- package/dist/components/EnrollMfa/index.js +171 -0
- package/dist/components/EnrollMfa/methods/totp.d.ts +6 -0
- package/dist/components/EnrollMfa/methods/totp.js +120 -0
- package/dist/components/EnrollMfa/types.d.ts +83 -0
- package/dist/components/EnrollMfa/types.js +2 -0
- package/dist/components/EnrollMfa/useEnrollMfaReducer.d.ts +3 -0
- package/dist/components/EnrollMfa/useEnrollMfaReducer.js +111 -0
- package/dist/components/EnrollMfaModal/index.d.ts +20 -0
- package/dist/components/EnrollMfaModal/index.js +144 -0
- package/dist/components/ExportWallet/index.d.ts +2 -1
- package/dist/components/ExportWallet/index.js +225 -165
- package/dist/components/ExportWalletModal/index.d.ts +7 -4
- package/dist/components/ExportWalletModal/index.js +9 -7
- package/dist/components/Fund/index.js +5 -5
- package/dist/components/FundModal/index.js +14 -14
- package/dist/components/LinkAuth/LinkAuthFlow.js +2 -2
- package/dist/components/LinkAuth/LinkAuthFlowBackButton.js +2 -2
- package/dist/components/LinkAuth/LinkAuthFlowProvider.js +2 -2
- package/dist/components/LinkAuth/LinkAuthItem.js +26 -45
- package/dist/components/LinkAuth/LinkAuthItems.js +1 -1
- package/dist/components/LinkAuth/LinkAuthProvider.js +1 -1
- package/dist/components/LinkAuth/index.js +3 -3
- package/dist/components/LinkAuth/types.js +1 -1
- package/dist/components/LinkAuth/utils.js +1 -1
- package/dist/components/LinkAuthModal/index.js +2 -2
- package/dist/components/OAuthStatusModal/index.js +1 -1
- package/dist/components/SignIn/SignInAuthMethodButtons.js +1 -1
- 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.js +5 -5
- package/dist/components/SignIn/SignInProvider.js +1 -1
- package/dist/components/SignIn/SignInTitle.js +2 -2
- package/dist/components/SignIn/flows/SignInWithEmail.js +1 -1
- package/dist/components/SignIn/flows/SignInWithOAuth.js +1 -1
- package/dist/components/SignIn/flows/SignInWithSms.js +1 -1
- package/dist/components/SignIn/index.js +4 -4
- package/dist/components/SignIn/types.js +1 -1
- package/dist/components/SignIn/useSignInReducer.js +1 -1
- package/dist/components/SignInModal/index.js +13 -13
- package/dist/components/ThemeProvider/index.d.ts +4 -6
- package/dist/components/ThemeProvider/index.js +32 -21
- package/dist/components/VerifyMfa/VerifyMfaDescription.d.ts +6 -0
- package/dist/components/VerifyMfa/VerifyMfaDescription.js +21 -0
- package/dist/components/VerifyMfa/VerifyMfaFlow.d.ts +11 -0
- package/dist/components/VerifyMfa/VerifyMfaFlow.js +19 -0
- package/dist/components/VerifyMfa/VerifyMfaFooter.d.ts +2 -0
- package/dist/components/VerifyMfa/VerifyMfaFooter.js +7 -0
- package/dist/components/VerifyMfa/VerifyMfaImage.d.ts +6 -0
- package/dist/components/VerifyMfa/VerifyMfaImage.js +21 -0
- package/dist/components/VerifyMfa/VerifyMfaProvider.d.ts +15 -0
- package/dist/components/VerifyMfa/VerifyMfaProvider.js +28 -0
- package/dist/components/VerifyMfa/VerifyMfaTitle.d.ts +6 -0
- package/dist/components/VerifyMfa/VerifyMfaTitle.js +21 -0
- package/dist/components/VerifyMfa/index.d.ts +16 -0
- package/dist/components/VerifyMfa/index.js +20 -0
- package/dist/components/VerifyMfa/methods/totp.d.ts +6 -0
- package/dist/components/VerifyMfa/methods/totp.js +69 -0
- package/dist/components/VerifyMfa/types.d.ts +60 -0
- package/dist/components/VerifyMfa/types.js +2 -0
- package/dist/components/VerifyMfa/useVerifyMfaReducer.d.ts +2 -0
- package/dist/components/VerifyMfa/useVerifyMfaReducer.js +61 -0
- package/dist/components/VerifyMfaInline/index.d.ts +40 -0
- package/dist/components/VerifyMfaInline/index.js +175 -0
- package/dist/components/VerifyMfaModal/index.d.ts +23 -0
- package/dist/components/VerifyMfaModal/index.js +19 -0
- package/dist/components/forms/AmountInput/index.d.ts +1 -1
- package/dist/components/forms/ExchangeAmountInput/index.d.ts +1 -1
- package/dist/components/forms/OTPForm/index.d.ts +2 -2
- package/dist/components/forms/OTPForm/index.js +81 -64
- package/dist/components/ui/Badge/index.d.ts +7 -0
- package/dist/components/ui/Badge/index.js +9 -0
- package/dist/components/ui/CopyTextField/index.d.ts +10 -0
- package/dist/components/ui/CopyTextField/index.js +81 -0
- package/dist/components/ui/Modal/index.js +4 -4
- package/dist/components/ui/QRCode/QRCodeSvg.d.ts +17 -0
- package/dist/components/ui/QRCode/QRCodeSvg.js +57 -0
- package/dist/components/ui/QRCode/index.d.ts +5 -0
- package/dist/components/ui/QRCode/index.js +31 -0
- package/dist/components/ui/QRCode/useCorners.d.ts +1 -0
- package/dist/components/ui/QRCode/useCorners.js +72 -0
- package/dist/components/ui/QRCode/useDotsPath.d.ts +11 -0
- package/dist/components/ui/QRCode/useDotsPath.js +66 -0
- package/dist/components/ui/QRCode/useLogo.d.ts +12 -0
- package/dist/components/ui/QRCode/useLogo.js +52 -0
- package/dist/components/ui/QRCode/useMatrix.d.ts +1 -0
- package/dist/components/ui/QRCode/useMatrix.js +17 -0
- package/dist/components/ui/ToggleListItem/index.d.ts +15 -0
- package/dist/components/ui/ToggleListItem/index.js +52 -0
- package/dist/hooks/useKeyExportPostMessage.js +67 -55
- package/dist/hooks/useVerifyMfaModal.d.ts +22 -0
- package/dist/hooks/useVerifyMfaModal.js +10 -0
- package/dist/icons/IconCoinbaseWordmark.js +10 -13
- package/dist/icons/IconPinCode.d.ts +2 -0
- package/dist/icons/IconPinCode.js +13 -0
- package/dist/icons/IconShield.d.ts +2 -0
- package/dist/icons/IconShield.js +7 -0
- package/dist/icons/IconSmartPhone.d.ts +2 -0
- package/dist/icons/IconSmartPhone.js +7 -0
- package/dist/icons/index.d.ts +5 -2
- package/dist/icons/index.js +22 -16
- package/dist/index.d.ts +6 -0
- package/dist/index.js +220 -165
- package/dist/theme/theme.d.ts +104 -0
- package/dist/theme/tokens.d.ts +312 -0
- package/dist/theme/tokens.js +70 -0
- package/dist/utils/transition.d.ts +2 -2
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +9 -7
- package/dist/assets/CopyAddress.css +0 -1
- package/dist/assets/LinkAuthItem.css +0 -1
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { InputHTMLAttributes } from 'react';
|
|
2
2
|
import { ExchangeAmountInputProps } from './types';
|
|
3
|
-
export declare const ExchangeAmountInput: import('react').ForwardRefExoticComponent<ExchangeAmountInputProps & Omit<InputHTMLAttributes<HTMLInputElement>, "type" | "value" | "
|
|
3
|
+
export declare const ExchangeAmountInput: import('react').ForwardRefExoticComponent<ExchangeAmountInputProps & Omit<InputHTMLAttributes<HTMLInputElement>, "type" | "value" | "inputMode" | "onChange" | "max" | "min"> & import('react').RefAttributes<HTMLInputElement>>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { APIError } from '@coinbase/cdp-hooks';
|
|
2
2
|
import { FormHTMLAttributes, Ref } from 'react';
|
|
3
|
-
export interface OTPFormProps extends
|
|
3
|
+
export interface OTPFormProps extends FormHTMLAttributes<HTMLFormElement> {
|
|
4
4
|
canResetOTP?: boolean;
|
|
5
5
|
error?: string | APIError;
|
|
6
6
|
isPending?: boolean;
|
|
@@ -13,4 +13,4 @@ export interface OTPFormProps extends Omit<FormHTMLAttributes<HTMLFormElement>,
|
|
|
13
13
|
resendCountdown?: number | null;
|
|
14
14
|
successMessage?: string;
|
|
15
15
|
}
|
|
16
|
-
export declare const OTPForm: ({ canResetOTP, error, isPending, onOTPChange, onResendOTP, otp, otpInputsRef, passwordLength, resendCountdown, successMessage, ...props }: OTPFormProps) => import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
export declare const OTPForm: ({ canResetOTP, children, error, isPending, onOTPChange, onResendOTP, otp, otpInputsRef, passwordLength, resendCountdown, successMessage, ...props }: OTPFormProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,77 +1,94 @@
|
|
|
1
|
-
import { jsxs as
|
|
1
|
+
import { jsxs as o, jsx as e } from "react/jsx-runtime";
|
|
2
2
|
import "@coinbase/cdp-hooks";
|
|
3
|
-
import { Form as
|
|
3
|
+
import { Form as F } from "@radix-ui/react-form";
|
|
4
|
+
import { c as w } from "../../../chunks/lite.1fxw3LjI.js";
|
|
4
5
|
import "react";
|
|
5
|
-
import { OTP as
|
|
6
|
-
import { Button as
|
|
7
|
-
import { LoadingSpinner as
|
|
8
|
-
import { VisuallyHidden as
|
|
9
|
-
import { isApiError as
|
|
6
|
+
import { OTP as N } from "../OTP/index.js";
|
|
7
|
+
import { Button as v } from "../../ui/Button/index.js";
|
|
8
|
+
import { LoadingSpinner as m } from "../../ui/LoadingSpinner/index.js";
|
|
9
|
+
import { VisuallyHidden as y } from "../../ui/VisuallyHidden/index.js";
|
|
10
|
+
import { isApiError as O } from "../../../utils/isApiError.js";
|
|
10
11
|
import "libphonenumber-js";
|
|
11
|
-
import '../../../assets/OTPForm.css';const
|
|
12
|
+
import '../../../assets/OTPForm.css';const r = {
|
|
12
13
|
"otp-form": "OTPForm-module__otp-form___G1-63",
|
|
13
|
-
"
|
|
14
|
-
"
|
|
14
|
+
"resend-controls": "OTPForm-module__resend-controls___yFns-",
|
|
15
|
+
"loading-spinner-wrapper": "OTPForm-module__loading-spinner-wrapper___iw7f0",
|
|
16
|
+
"resend-controls-spinner-wrapper": "OTPForm-module__resend-controls-spinner-wrapper___AyU3A",
|
|
15
17
|
"loading-spinner": "OTPForm-module__loading-spinner___8N9XU",
|
|
16
18
|
"resend-wrapper": "OTPForm-module__resend-wrapper___aZUAz",
|
|
17
19
|
"reset-timer": "OTPForm-module__reset-timer___7ElWj"
|
|
18
|
-
},
|
|
19
|
-
canResetOTP:
|
|
20
|
-
|
|
20
|
+
}, V = ({
|
|
21
|
+
canResetOTP: s,
|
|
22
|
+
children: d,
|
|
23
|
+
error: i,
|
|
21
24
|
isPending: a,
|
|
22
|
-
onOTPChange:
|
|
25
|
+
onOTPChange: t,
|
|
23
26
|
onResendOTP: l,
|
|
24
|
-
otp:
|
|
25
|
-
otpInputsRef:
|
|
26
|
-
passwordLength:
|
|
27
|
-
resendCountdown:
|
|
28
|
-
successMessage:
|
|
29
|
-
...
|
|
30
|
-
}) =>
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
/* @__PURE__ */
|
|
50
|
-
|
|
51
|
-
|
|
27
|
+
otp: _,
|
|
28
|
+
otpInputsRef: c,
|
|
29
|
+
passwordLength: u,
|
|
30
|
+
resendCountdown: n,
|
|
31
|
+
successMessage: h,
|
|
32
|
+
...f
|
|
33
|
+
}) => {
|
|
34
|
+
const p = !!l;
|
|
35
|
+
return /* @__PURE__ */ o(F, { ...f, children: [
|
|
36
|
+
/* @__PURE__ */ e(
|
|
37
|
+
N,
|
|
38
|
+
{
|
|
39
|
+
ref: c,
|
|
40
|
+
name: "otp",
|
|
41
|
+
"aria-label": "Enter code",
|
|
42
|
+
autoSubmit: !0,
|
|
43
|
+
passwordLength: u || 6,
|
|
44
|
+
value: _,
|
|
45
|
+
error: O(i) ? i.message : i,
|
|
46
|
+
onChange: (g) => g.preventDefault(),
|
|
47
|
+
onValueChange: t,
|
|
48
|
+
className: r["otp-form"],
|
|
49
|
+
successMessage: h
|
|
50
|
+
}
|
|
51
|
+
),
|
|
52
|
+
!p && a && /* @__PURE__ */ e("div", { className: r["loading-spinner-wrapper"], children: /* @__PURE__ */ e(m, { className: r["loading-spinner"] }) }),
|
|
53
|
+
p && /* @__PURE__ */ o("div", { className: r["resend-controls"], children: [
|
|
54
|
+
a && !s && /* @__PURE__ */ e(
|
|
55
|
+
"div",
|
|
52
56
|
{
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
children: "
|
|
57
|
+
className: w(
|
|
58
|
+
r["loading-spinner-wrapper"],
|
|
59
|
+
r["resend-controls-spinner-wrapper"]
|
|
60
|
+
),
|
|
61
|
+
children: /* @__PURE__ */ e(m, { className: r["loading-spinner"] })
|
|
58
62
|
}
|
|
59
|
-
)
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
63
|
+
),
|
|
64
|
+
/* @__PURE__ */ o("div", { className: r["resend-wrapper"], children: [
|
|
65
|
+
s && /* @__PURE__ */ e(
|
|
66
|
+
v,
|
|
67
|
+
{
|
|
68
|
+
type: "button",
|
|
69
|
+
onClick: l,
|
|
70
|
+
isPending: a,
|
|
71
|
+
variant: "linkPrimary",
|
|
72
|
+
children: "Resend code"
|
|
73
|
+
}
|
|
74
|
+
),
|
|
75
|
+
!s && n !== null && /* @__PURE__ */ e("div", { className: r["reset-timer"], children: /* @__PURE__ */ o("p", { children: [
|
|
76
|
+
"Resend code in ",
|
|
77
|
+
/* @__PURE__ */ o("span", { "aria-hidden": "true", children: [
|
|
78
|
+
n,
|
|
79
|
+
"s"
|
|
80
|
+
] }),
|
|
81
|
+
/* @__PURE__ */ o(y, { children: [
|
|
82
|
+
n,
|
|
83
|
+
" ",
|
|
84
|
+
n === 1 ? "second" : "seconds"
|
|
85
|
+
] })
|
|
86
|
+
] }) })
|
|
87
|
+
] })
|
|
88
|
+
] }),
|
|
89
|
+
d
|
|
90
|
+
] });
|
|
91
|
+
};
|
|
75
92
|
export {
|
|
76
|
-
|
|
93
|
+
V as OTPForm
|
|
77
94
|
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { HTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
interface BadgeProps extends HTMLAttributes<HTMLSpanElement> {
|
|
3
|
+
children?: ReactNode;
|
|
4
|
+
variant?: "primary" | "secondary" | "warning";
|
|
5
|
+
}
|
|
6
|
+
export declare const Badge: ({ children, className, variant, ...props }: BadgeProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { c as o } from "../../../chunks/lite.1fxw3LjI.js";
|
|
3
|
+
import "react";
|
|
4
|
+
import '../../../assets/Badge.css';const d = "Badge-module__badge___IxlOE", m = {
|
|
5
|
+
badge: d
|
|
6
|
+
}, p = ({ children: a, className: e = "", variant: r = "primary", ...s }) => /* @__PURE__ */ t("span", { className: o(m.badge, e), "data-variant": r, ...s, children: a });
|
|
7
|
+
export {
|
|
8
|
+
p as Badge
|
|
9
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { HTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
export interface CopyTextFieldProps extends Omit<HTMLAttributes<HTMLDivElement>, "children"> {
|
|
3
|
+
value: string;
|
|
4
|
+
displayValue?: ReactNode;
|
|
5
|
+
label?: string;
|
|
6
|
+
copyAriaLabel?: string;
|
|
7
|
+
onCopy?: () => void;
|
|
8
|
+
onCopySuccess?: () => void;
|
|
9
|
+
}
|
|
10
|
+
export declare const CopyTextField: ({ className, value, displayValue, label, copyAriaLabel, onCopy, onCopySuccess, ...props }: CopyTextFieldProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { jsxs as p, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { c as _ } from "../../../chunks/lite.1fxw3LjI.js";
|
|
3
|
+
import { useRef as b, useState as C, useCallback as f } from "react";
|
|
4
|
+
import { Label as T } from "../../forms/Label/index.js";
|
|
5
|
+
import { IconCheck as h } from "../../../icons/IconCheck.js";
|
|
6
|
+
import { IconCopy as F } from "../../../icons/IconCopy.js";
|
|
7
|
+
import '../../../assets/CopyTextField.css';const N = "CopyTextField-module__label___gpVUi", I = "CopyTextField-module__disabled___HTUmj", e = {
|
|
8
|
+
"copy-text-field": "CopyTextField-module__copy-text-field___zvHRO",
|
|
9
|
+
"visually-hidden": "CopyTextField-module__visually-hidden___-sZqH",
|
|
10
|
+
label: N,
|
|
11
|
+
"input-container": "CopyTextField-module__input-container___tSIdj",
|
|
12
|
+
"text-truncated": "CopyTextField-module__text-truncated___mKZc-",
|
|
13
|
+
disabled: I,
|
|
14
|
+
"copy-button": "CopyTextField-module__copy-button___U0AJC",
|
|
15
|
+
"success-icon": "CopyTextField-module__success-icon___uzpP3",
|
|
16
|
+
"copy-icon": "CopyTextField-module__copy-icon___FKK7q"
|
|
17
|
+
}, R = ({
|
|
18
|
+
className: u = "",
|
|
19
|
+
value: o,
|
|
20
|
+
displayValue: m,
|
|
21
|
+
label: a,
|
|
22
|
+
copyAriaLabel: y = "Copy",
|
|
23
|
+
onCopy: l,
|
|
24
|
+
onCopySuccess: d,
|
|
25
|
+
...i
|
|
26
|
+
}) => {
|
|
27
|
+
const c = b(null), [x, s] = C(!1), n = i["aria-disabled"] === !0 || i["aria-disabled"] === "true", r = f(() => {
|
|
28
|
+
if (o) {
|
|
29
|
+
l?.();
|
|
30
|
+
try {
|
|
31
|
+
if (navigator.clipboard)
|
|
32
|
+
navigator.clipboard.writeText(o);
|
|
33
|
+
else
|
|
34
|
+
throw new Error("Clipboard API not supported");
|
|
35
|
+
} catch {
|
|
36
|
+
c.current?.select(), document.execCommand("copy");
|
|
37
|
+
}
|
|
38
|
+
s(!0), setTimeout(() => {
|
|
39
|
+
s(!1);
|
|
40
|
+
}, 2e3), d?.();
|
|
41
|
+
}
|
|
42
|
+
}, [o, l, d]);
|
|
43
|
+
return /* @__PURE__ */ p("div", { className: _(e["copy-text-field"], u), ...i, children: [
|
|
44
|
+
a && /* @__PURE__ */ t(T, { as: "span", className: e.label, "data-part": "label", children: a }),
|
|
45
|
+
/* @__PURE__ */ p("div", { className: e["input-container"], onClick: r, "data-part": "input-container", children: [
|
|
46
|
+
/* @__PURE__ */ t(
|
|
47
|
+
"span",
|
|
48
|
+
{
|
|
49
|
+
className: _(e["text-truncated"], n ? e.disabled : ""),
|
|
50
|
+
"data-part": "input-text",
|
|
51
|
+
children: m ?? o
|
|
52
|
+
}
|
|
53
|
+
),
|
|
54
|
+
/* @__PURE__ */ t(
|
|
55
|
+
"button",
|
|
56
|
+
{
|
|
57
|
+
type: "button",
|
|
58
|
+
"aria-label": y,
|
|
59
|
+
onClick: r,
|
|
60
|
+
className: e["copy-button"],
|
|
61
|
+
children: x ? /* @__PURE__ */ t(h, { className: e["success-icon"] }) : /* @__PURE__ */ t(F, { className: e["copy-icon"] })
|
|
62
|
+
}
|
|
63
|
+
),
|
|
64
|
+
/* @__PURE__ */ t(
|
|
65
|
+
"input",
|
|
66
|
+
{
|
|
67
|
+
ref: c,
|
|
68
|
+
type: "text",
|
|
69
|
+
value: o,
|
|
70
|
+
readOnly: !0,
|
|
71
|
+
"aria-disabled": n,
|
|
72
|
+
className: e["visually-hidden"],
|
|
73
|
+
tabIndex: -1
|
|
74
|
+
}
|
|
75
|
+
)
|
|
76
|
+
] })
|
|
77
|
+
] });
|
|
78
|
+
};
|
|
79
|
+
export {
|
|
80
|
+
R as CopyTextField
|
|
81
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as o, jsxs as n } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { DialogPortal as _, DialogOverlay as p, DialogContent as g, Dialog as M, DialogTitle as D, DialogDescription as f, DialogClose as u, DialogTrigger as y } from "@radix-ui/react-dialog";
|
|
3
3
|
import { c as e } from "../../../chunks/lite.1fxw3LjI.js";
|
|
4
4
|
import { forwardRef as v, useMemo as C } from "react";
|
|
5
5
|
import { useTheme as T } from "../../ThemeProvider/index.js";
|
|
@@ -13,14 +13,14 @@ import '../../../assets/Modal.css';const x = "Modal-module__modal___MUsZA", N =
|
|
|
13
13
|
() => ({ ...s, ...l }),
|
|
14
14
|
[s, l]
|
|
15
15
|
);
|
|
16
|
-
return /* @__PURE__ */ o(
|
|
16
|
+
return /* @__PURE__ */ o(_, { children: /* @__PURE__ */ n(p, { className: e(a.overlay, c), style: m, children: [
|
|
17
17
|
/* @__PURE__ */ o("div", { className: a.spacer }),
|
|
18
|
-
/* @__PURE__ */ o(
|
|
18
|
+
/* @__PURE__ */ o(g, { ...i, ref: d, className: e(a.modal, t), children: r })
|
|
19
19
|
] }) });
|
|
20
20
|
}
|
|
21
21
|
);
|
|
22
22
|
j.displayName = "ModalContent";
|
|
23
|
-
const w =
|
|
23
|
+
const w = M, G = u, I = f, P = D, Q = y;
|
|
24
24
|
export {
|
|
25
25
|
w as Modal,
|
|
26
26
|
G as ModalClose,
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export type QRCodeSVGProps = {
|
|
2
|
+
value: string;
|
|
3
|
+
size?: number;
|
|
4
|
+
color?: string;
|
|
5
|
+
backgroundColor?: string;
|
|
6
|
+
logo?: {
|
|
7
|
+
uri: string;
|
|
8
|
+
};
|
|
9
|
+
logoSize?: number;
|
|
10
|
+
logoBackgroundColor?: string;
|
|
11
|
+
logoMargin?: number;
|
|
12
|
+
logoBorderRadius?: number;
|
|
13
|
+
ecl?: "L" | "M" | "Q" | "H";
|
|
14
|
+
isAsyncDataFetched?: boolean;
|
|
15
|
+
cornerFillColor?: string;
|
|
16
|
+
};
|
|
17
|
+
export declare function QRCodeSVG({ value, size, color, backgroundColor, logo, logoSize, logoBackgroundColor, logoMargin, logoBorderRadius, ecl, cornerFillColor, }: QRCodeSVGProps): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { jsxs as m, jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo as L } from "react";
|
|
3
|
+
import { useCorners as v } from "./useCorners.js";
|
|
4
|
+
import { useDotsPath as w } from "./useDotsPath.js";
|
|
5
|
+
import { useLogo as b } from "./useLogo.js";
|
|
6
|
+
import { useMatrix as j } from "./useMatrix.js";
|
|
7
|
+
const q = 2;
|
|
8
|
+
function N({
|
|
9
|
+
value: i,
|
|
10
|
+
size: t = 100,
|
|
11
|
+
color: d = "black",
|
|
12
|
+
backgroundColor: e = "white",
|
|
13
|
+
logo: f,
|
|
14
|
+
logoSize: c = t * 0.2,
|
|
15
|
+
logoBackgroundColor: p = "transparent",
|
|
16
|
+
logoMargin: h = 5,
|
|
17
|
+
logoBorderRadius: s = 0,
|
|
18
|
+
ecl: u = "Q",
|
|
19
|
+
cornerFillColor: l
|
|
20
|
+
}) {
|
|
21
|
+
const o = j(i, u), r = t / o.length * q, g = v(t, o.length, e, l), x = L(() => [-r, -r, t + r * 2, t + r * 2].join(" "), [r, t]), k = b({
|
|
22
|
+
size: t,
|
|
23
|
+
logo: f,
|
|
24
|
+
logoSize: c,
|
|
25
|
+
logoBackgroundColor: p,
|
|
26
|
+
logoMargin: h,
|
|
27
|
+
logoBorderRadius: s
|
|
28
|
+
}), a = w({
|
|
29
|
+
matrix: o,
|
|
30
|
+
size: t,
|
|
31
|
+
logoSize: c,
|
|
32
|
+
logoMargin: h,
|
|
33
|
+
logoBorderRadius: s,
|
|
34
|
+
hasLogo: !1
|
|
35
|
+
});
|
|
36
|
+
return a ? /* @__PURE__ */ m("svg", { viewBox: x, width: t, height: t, "data-testid": "qr-code-svg", children: [
|
|
37
|
+
/* @__PURE__ */ n("g", { children: /* @__PURE__ */ n(
|
|
38
|
+
"rect",
|
|
39
|
+
{
|
|
40
|
+
x: -r,
|
|
41
|
+
y: -r,
|
|
42
|
+
width: t + r * 2,
|
|
43
|
+
height: t + r * 2,
|
|
44
|
+
fill: e,
|
|
45
|
+
"data-testid": "qr-code-background"
|
|
46
|
+
}
|
|
47
|
+
) }),
|
|
48
|
+
/* @__PURE__ */ m("g", { children: [
|
|
49
|
+
/* @__PURE__ */ n("path", { d: a, fill: d, strokeLinecap: "butt", stroke: "black", strokeWidth: 0 }),
|
|
50
|
+
g,
|
|
51
|
+
k
|
|
52
|
+
] })
|
|
53
|
+
] }) : null;
|
|
54
|
+
}
|
|
55
|
+
export {
|
|
56
|
+
N as QRCodeSVG
|
|
57
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { HTMLAttributes } from 'react';
|
|
2
|
+
import { QRCodeSVGProps } from './QRCodeSvg';
|
|
3
|
+
type QRCodeProps = QRCodeSVGProps & Omit<HTMLAttributes<HTMLDivElement>, "children">;
|
|
4
|
+
export declare const QRCode: ({ value, size, color, backgroundColor, ecl, isAsyncDataFetched, cornerFillColor, className, ...props }: QRCodeProps) => import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
export {};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { c as p } from "../../../chunks/lite.1fxw3LjI.js";
|
|
3
|
+
import "react";
|
|
4
|
+
import { QRCodeSVG as l } from "./QRCodeSvg.js";
|
|
5
|
+
import '../../../assets/QRCode.css';const _ = {
|
|
6
|
+
"qr-code": "QRCode-module__qr-code___Ourka"
|
|
7
|
+
}, x = ({
|
|
8
|
+
value: r,
|
|
9
|
+
size: e,
|
|
10
|
+
color: d,
|
|
11
|
+
backgroundColor: t,
|
|
12
|
+
ecl: c,
|
|
13
|
+
isAsyncDataFetched: m,
|
|
14
|
+
cornerFillColor: s,
|
|
15
|
+
className: a = "",
|
|
16
|
+
...i
|
|
17
|
+
}) => /* @__PURE__ */ o("div", { className: p(_["qr-code"], a), "data-part": "qr-code", ...i, children: /* @__PURE__ */ o(
|
|
18
|
+
l,
|
|
19
|
+
{
|
|
20
|
+
value: r,
|
|
21
|
+
size: e,
|
|
22
|
+
color: d,
|
|
23
|
+
backgroundColor: t,
|
|
24
|
+
isAsyncDataFetched: m,
|
|
25
|
+
ecl: c,
|
|
26
|
+
cornerFillColor: s
|
|
27
|
+
}
|
|
28
|
+
) });
|
|
29
|
+
export {
|
|
30
|
+
x as QRCode
|
|
31
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function useCorners(size: number, matrixLength: number, backgroundColor: string, fillColor?: string): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { jsxs as o, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo as y } from "react";
|
|
3
|
+
import { CORNER_SIZE as d } from "./useDotsPath.js";
|
|
4
|
+
function k(r, x, c, i = "black") {
|
|
5
|
+
const s = r / x, t = s * d, h = s * 2, n = s;
|
|
6
|
+
return y(
|
|
7
|
+
() => /* @__PURE__ */ o("g", { children: [
|
|
8
|
+
/* @__PURE__ */ e("rect", { x: "0", y: "0", rx: 9.5, ry: 9.5, width: t, height: t, fill: i }),
|
|
9
|
+
/* @__PURE__ */ e(
|
|
10
|
+
"rect",
|
|
11
|
+
{
|
|
12
|
+
x: "0",
|
|
13
|
+
y: r - t,
|
|
14
|
+
rx: 9.5,
|
|
15
|
+
ry: 9.5,
|
|
16
|
+
width: t,
|
|
17
|
+
height: t,
|
|
18
|
+
fill: i
|
|
19
|
+
}
|
|
20
|
+
),
|
|
21
|
+
/* @__PURE__ */ e(
|
|
22
|
+
"rect",
|
|
23
|
+
{
|
|
24
|
+
x: r - t,
|
|
25
|
+
y: "0",
|
|
26
|
+
rx: 9.5,
|
|
27
|
+
ry: 9.5,
|
|
28
|
+
width: t,
|
|
29
|
+
height: t,
|
|
30
|
+
fill: i
|
|
31
|
+
}
|
|
32
|
+
),
|
|
33
|
+
/* @__PURE__ */ e(
|
|
34
|
+
"circle",
|
|
35
|
+
{
|
|
36
|
+
cx: t / 2,
|
|
37
|
+
cy: t / 2,
|
|
38
|
+
r: h,
|
|
39
|
+
stroke: c,
|
|
40
|
+
strokeWidth: n,
|
|
41
|
+
fill: "none"
|
|
42
|
+
}
|
|
43
|
+
),
|
|
44
|
+
/* @__PURE__ */ e(
|
|
45
|
+
"circle",
|
|
46
|
+
{
|
|
47
|
+
cx: t / 2,
|
|
48
|
+
cy: r - t / 2,
|
|
49
|
+
r: h,
|
|
50
|
+
stroke: c,
|
|
51
|
+
strokeWidth: n,
|
|
52
|
+
fill: "none"
|
|
53
|
+
}
|
|
54
|
+
),
|
|
55
|
+
/* @__PURE__ */ e(
|
|
56
|
+
"circle",
|
|
57
|
+
{
|
|
58
|
+
cx: r - t / 2,
|
|
59
|
+
cy: t / 2,
|
|
60
|
+
r: h,
|
|
61
|
+
stroke: c,
|
|
62
|
+
strokeWidth: n,
|
|
63
|
+
fill: "none"
|
|
64
|
+
}
|
|
65
|
+
)
|
|
66
|
+
] }),
|
|
67
|
+
[c, h, n, i, t, r]
|
|
68
|
+
);
|
|
69
|
+
}
|
|
70
|
+
export {
|
|
71
|
+
k as useCorners
|
|
72
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare const CORNER_SIZE = 7;
|
|
2
|
+
type UseDotsPathProps = {
|
|
3
|
+
matrix: number[][];
|
|
4
|
+
size: number;
|
|
5
|
+
logoSize: number;
|
|
6
|
+
logoMargin: number;
|
|
7
|
+
logoBorderRadius: number;
|
|
8
|
+
hasLogo: boolean;
|
|
9
|
+
};
|
|
10
|
+
export declare function useDotsPath({ matrix, size, logoSize, logoMargin, logoBorderRadius, hasLogo, }: UseDotsPathProps): string;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { useMemo as R } from "react";
|
|
2
|
+
const M = [
|
|
3
|
+
[1, 1, 1, 1, 1, 1, 1],
|
|
4
|
+
[1, 0, 0, 0, 0, 0, 1],
|
|
5
|
+
[1, 0, 0, 0, 0, 0, 1],
|
|
6
|
+
[1, 0, 0, 0, 0, 0, 1],
|
|
7
|
+
[1, 0, 0, 0, 0, 0, 1],
|
|
8
|
+
[1, 0, 0, 0, 0, 0, 1],
|
|
9
|
+
[1, 1, 1, 1, 1, 1, 1]
|
|
10
|
+
], D = [
|
|
11
|
+
[0, 0, 0, 0, 0, 0, 0],
|
|
12
|
+
[0, 0, 0, 0, 0, 0, 0],
|
|
13
|
+
[0, 0, 1, 1, 1, 0, 0],
|
|
14
|
+
[0, 0, 1, 1, 1, 0, 0],
|
|
15
|
+
[0, 0, 1, 1, 1, 0, 0],
|
|
16
|
+
[0, 0, 0, 0, 0, 0, 0],
|
|
17
|
+
[0, 0, 0, 0, 0, 0, 0]
|
|
18
|
+
];
|
|
19
|
+
function S(o, f, u, a) {
|
|
20
|
+
return Math.sqrt((a - f) ** 2 + (u - o) ** 2);
|
|
21
|
+
}
|
|
22
|
+
const h = 7;
|
|
23
|
+
function A({
|
|
24
|
+
matrix: o,
|
|
25
|
+
size: f,
|
|
26
|
+
logoSize: u,
|
|
27
|
+
logoMargin: a,
|
|
28
|
+
logoBorderRadius: $,
|
|
29
|
+
hasLogo: m
|
|
30
|
+
}) {
|
|
31
|
+
return R(() => {
|
|
32
|
+
const d = f / o.length;
|
|
33
|
+
let I = "";
|
|
34
|
+
const s = o.length;
|
|
35
|
+
return o.forEach((E, t) => {
|
|
36
|
+
E.forEach((g, n) => {
|
|
37
|
+
if (!(M[t]?.[n] || M[t - s + h]?.[n] || M[t]?.[n - s + h]) && !(D[t]?.[n] || D[t - s + h]?.[n] || D[t]?.[n - s + h])) {
|
|
38
|
+
if (m) {
|
|
39
|
+
const i = $ >= u / 2, l = u + a * 2, e = f / s, p = l / e, c = Math.floor(s / 2);
|
|
40
|
+
if (i) {
|
|
41
|
+
const r = p / 2;
|
|
42
|
+
if (S(n, t, c, c) - 0.5 <= r)
|
|
43
|
+
return;
|
|
44
|
+
} else {
|
|
45
|
+
const r = Math.ceil(p / 2);
|
|
46
|
+
if (t <= c + r && t >= c - r && n <= c + r && n >= c - r)
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
if (g) {
|
|
51
|
+
const i = d * n + d / 2, l = d * t + d / 2, e = d / 2;
|
|
52
|
+
I += `
|
|
53
|
+
M ${i} ${l - e}
|
|
54
|
+
A ${e} ${e} 0 1 1 ${i - 0.01} ${l - e}
|
|
55
|
+
Z
|
|
56
|
+
`;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
}), I;
|
|
61
|
+
}, [m, $, a, u, o, f]);
|
|
62
|
+
}
|
|
63
|
+
export {
|
|
64
|
+
h as CORNER_SIZE,
|
|
65
|
+
A as useDotsPath
|
|
66
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
type RenderLogoProps = {
|
|
2
|
+
size: number;
|
|
3
|
+
logo: {
|
|
4
|
+
uri: string;
|
|
5
|
+
} | undefined;
|
|
6
|
+
logoSize: number;
|
|
7
|
+
logoBackgroundColor: string;
|
|
8
|
+
logoMargin: number;
|
|
9
|
+
logoBorderRadius: number;
|
|
10
|
+
};
|
|
11
|
+
export declare function useLogo({ size, logo, logoSize, logoBackgroundColor, logoMargin, logoBorderRadius, }: RenderLogoProps): import("react/jsx-runtime").JSX.Element | undefined;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { jsxs as l, jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo as u } from "react";
|
|
3
|
+
function x({
|
|
4
|
+
size: n,
|
|
5
|
+
logo: e,
|
|
6
|
+
logoSize: t,
|
|
7
|
+
logoBackgroundColor: p,
|
|
8
|
+
logoMargin: h,
|
|
9
|
+
logoBorderRadius: c
|
|
10
|
+
}) {
|
|
11
|
+
return u(() => {
|
|
12
|
+
if (!e)
|
|
13
|
+
return;
|
|
14
|
+
const d = (n - t - h * 2) / 2, i = t + h * 2, s = c + h / t * c, f = n / 2 - t / 2;
|
|
15
|
+
return /* @__PURE__ */ l("g", { x: d, y: d, children: [
|
|
16
|
+
/* @__PURE__ */ l("defs", { children: [
|
|
17
|
+
/* @__PURE__ */ r("clipPath", { id: "clip-logo-background", children: /* @__PURE__ */ r(
|
|
18
|
+
"rect",
|
|
19
|
+
{
|
|
20
|
+
width: i,
|
|
21
|
+
height: i,
|
|
22
|
+
rx: s,
|
|
23
|
+
ry: s
|
|
24
|
+
}
|
|
25
|
+
) }),
|
|
26
|
+
/* @__PURE__ */ r("clipPath", { id: "clip-logo", children: /* @__PURE__ */ r("rect", { width: t, height: t, rx: c, ry: c }) })
|
|
27
|
+
] }),
|
|
28
|
+
/* @__PURE__ */ r("g", { children: /* @__PURE__ */ r(
|
|
29
|
+
"rect",
|
|
30
|
+
{
|
|
31
|
+
width: i,
|
|
32
|
+
height: i,
|
|
33
|
+
fill: p,
|
|
34
|
+
clipPath: "url(#clip-logo-background)"
|
|
35
|
+
}
|
|
36
|
+
) }),
|
|
37
|
+
/* @__PURE__ */ r("g", { transform: `translate(${f}, ${f})`, children: /* @__PURE__ */ r(
|
|
38
|
+
"image",
|
|
39
|
+
{
|
|
40
|
+
width: t,
|
|
41
|
+
height: t,
|
|
42
|
+
preserveAspectRatio: "xMidYMid slice",
|
|
43
|
+
href: e.uri,
|
|
44
|
+
clipPath: "url(#clip-logo)"
|
|
45
|
+
}
|
|
46
|
+
) })
|
|
47
|
+
] });
|
|
48
|
+
}, [e, p, c, h, t, n]);
|
|
49
|
+
}
|
|
50
|
+
export {
|
|
51
|
+
x as useLogo
|
|
52
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function useMatrix(value: string, errorCorrectionLevel: "L" | "M" | "Q" | "H"): any;
|