@coinbase/cdp-react 0.0.24 → 0.0.25
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 +2 -2
- package/dist/assets/AmountInput.css +1 -1
- package/dist/assets/AuthButton.css +1 -1
- package/dist/assets/ExchangeAmountInput.css +1 -1
- package/dist/assets/Fund.css +1 -0
- package/dist/assets/FundAmountInput.css +1 -0
- package/dist/assets/FundErrorScreen.css +1 -0
- package/dist/assets/FundForm.css +1 -0
- package/dist/assets/FundModal.css +1 -0
- package/dist/assets/FundPaymentMethods.css +1 -0
- package/dist/assets/FundPresetAmountInputs.css +1 -0
- package/dist/assets/FundTitle.css +1 -0
- package/dist/assets/FundTransactionStatus.css +1 -0
- package/dist/assets/Input.css +1 -1
- package/dist/assets/Modal.css +1 -1
- package/dist/assets/ThemeProvider.css +1 -1
- package/dist/components/Fund/FundForm.d.ts +18 -0
- package/dist/components/Fund/FundForm.js +156 -0
- package/dist/components/Fund/FundProvider.d.ts +6 -0
- package/dist/components/Fund/FundProvider.js +128 -0
- package/dist/components/Fund/FundTitle.d.ts +5 -0
- package/dist/components/Fund/FundTitle.js +17 -0
- package/dist/components/Fund/components/FundAmountInput.d.ts +5 -0
- package/dist/components/Fund/components/FundAmountInput.js +58 -0
- package/dist/components/Fund/components/FundErrorScreen.d.ts +6 -0
- package/dist/components/Fund/components/FundErrorScreen.js +118 -0
- package/dist/components/Fund/components/FundPaymentMethods.d.ts +6 -0
- package/dist/components/Fund/components/FundPaymentMethods.js +55 -0
- package/dist/components/Fund/components/FundPresetAmountInputs.d.ts +6 -0
- package/dist/components/Fund/components/FundPresetAmountInputs.js +41 -0
- package/dist/components/Fund/components/FundTransactionStatus.d.ts +8 -0
- package/dist/components/Fund/components/FundTransactionStatus.js +106 -0
- package/dist/components/Fund/hooks/useBuyUrl.d.ts +14 -0
- package/dist/components/Fund/hooks/useBuyUrl.js +65 -0
- package/dist/components/Fund/hooks/useEmitLifecycleStatus.d.ts +5 -0
- package/dist/components/Fund/hooks/useEmitLifecycleStatus.js +14 -0
- package/dist/components/Fund/hooks/useExchangeRate.d.ts +11 -0
- package/dist/components/Fund/hooks/useExchangeRate.js +62 -0
- package/dist/components/Fund/hooks/usePaymentMethods.d.ts +11 -0
- package/dist/components/Fund/hooks/usePaymentMethods.js +112 -0
- package/dist/components/Fund/hooks/usePopupMonitor.d.ts +3 -0
- package/dist/components/Fund/hooks/usePopupMonitor.js +17 -0
- package/dist/components/Fund/hooks/useSetupOnrampEventListeners.d.ts +1 -0
- package/dist/components/Fund/hooks/useSetupOnrampEventListeners.js +56 -0
- package/dist/components/Fund/index.d.ts +10 -0
- package/dist/components/Fund/index.js +30 -0
- package/dist/components/Fund/types.d.ts +218 -0
- package/dist/components/Fund/types.js +1 -0
- package/dist/components/Fund/useFundReducer.d.ts +9 -0
- package/dist/components/Fund/useFundReducer.js +104 -0
- package/dist/components/Fund/utils/buildPaymentMethods.d.ts +5 -0
- package/dist/components/Fund/utils/buildPaymentMethods.js +57 -0
- package/dist/components/Fund/utils/setupOnrampEventListeners.d.ts +9 -0
- package/dist/components/Fund/utils/setupOnrampEventListeners.js +19 -0
- package/dist/components/Fund/utils/subscribeToWindowMessage.d.ts +14 -0
- package/dist/components/Fund/utils/subscribeToWindowMessage.js +24 -0
- package/dist/components/FundModal/index.d.ts +9 -0
- package/dist/components/FundModal/index.js +92 -0
- package/dist/components/forms/ExchangeAmountInput/index.js +93 -65
- package/dist/components/forms/ExchangeAmountInput/types.d.ts +2 -1
- package/dist/components/forms/ExchangeAmountInput/useExchangeAmountInput.js +42 -38
- package/dist/components/forms/Input/index.d.ts +6 -2
- package/dist/components/forms/Input/index.js +27 -12
- package/dist/components/forms/PhoneNumberInput/index.d.ts +2 -2
- package/dist/components/ui/Button/index.js +7 -7
- package/dist/components/ui/ButtonBase/index.js +19 -19
- package/dist/components/ui/LoadingSpinner/index.d.ts +9 -2
- package/dist/components/ui/LoadingSpinner/index.js +39 -17
- package/dist/icons/IconAppleLogo.d.ts +2 -0
- package/dist/icons/IconAppleLogo.js +10 -0
- package/dist/icons/IconCoinbaseMark.d.ts +2 -0
- package/dist/icons/IconCoinbaseMark.js +13 -0
- package/dist/icons/IconCreditCard.d.ts +2 -0
- package/dist/icons/IconCreditCard.js +10 -0
- package/dist/icons/IconExclamationTriangle.d.ts +2 -0
- package/dist/icons/IconExclamationTriangle.js +14 -0
- package/dist/icons/index.d.ts +1 -0
- package/dist/icons/index.js +18 -16
- package/dist/index.d.ts +2 -0
- package/dist/index.js +86 -73
- package/dist/theme/theme.d.ts +23 -0
- package/dist/theme/tokens.d.ts +67 -0
- package/dist/theme/tokens.js +19 -2
- package/dist/utils/formatFiat.d.ts +1 -0
- package/dist/utils/formatFiat.js +13 -0
- package/dist/utils/openPopup.d.ts +7 -0
- package/dist/utils/openPopup.js +15 -0
- package/package.json +6 -6
|
@@ -1,87 +1,115 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { forwardRef as
|
|
3
|
-
import { AmountInput as
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import
|
|
1
|
+
import { jsxs as u, Fragment as $, jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as v, useCallback as C } from "react";
|
|
3
|
+
import { AmountInput as L } from "../AmountInput/index.js";
|
|
4
|
+
import { Button as z } from "../../ui/Button/index.js";
|
|
5
|
+
import { LoadingSkeleton as j } from "../../ui/LoadingSkeleton/index.js";
|
|
6
|
+
import { DEFAULT_LOCALE as D } from "../../../data/locale.js";
|
|
7
|
+
import { IconArrowsUpDown as F } from "../../../icons/IconArrowsUpDown.js";
|
|
8
|
+
import { useExchangeAmountInput as S } from "./useExchangeAmountInput.js";
|
|
9
|
+
import '../../../assets/ExchangeAmountInput.css';const V = "ExchangeAmountInput-module__icon___b5JpF", t = {
|
|
8
10
|
"flex-row": "ExchangeAmountInput-module__flex-row___ZKB-Q",
|
|
9
11
|
"gap-1": "ExchangeAmountInput-module__gap-1___vuNQW",
|
|
10
12
|
"gap-2": "ExchangeAmountInput-module__gap-2___4-s-b",
|
|
11
13
|
"swap-button": "ExchangeAmountInput-module__swap-button___i9lSz",
|
|
12
|
-
icon:
|
|
13
|
-
|
|
14
|
+
icon: V,
|
|
15
|
+
"output-loading-skeleton": "ExchangeAmountInput-module__output-loading-skeleton___gKMEZ",
|
|
16
|
+
"output-loading-skeleton-placeholder": "ExchangeAmountInput-module__output-loading-skeleton-placeholder___1-jT-",
|
|
17
|
+
"output-currency": "ExchangeAmountInput-module__output-currency___vlpC1"
|
|
18
|
+
}, B = v(
|
|
14
19
|
({
|
|
15
|
-
cryptoAmount:
|
|
16
|
-
cryptoCurrency:
|
|
17
|
-
cryptoDecimalPlaces:
|
|
18
|
-
fiatAmount:
|
|
19
|
-
fiatCurrency:
|
|
20
|
-
fiatDecimalPlaces:
|
|
21
|
-
exchangeRate:
|
|
22
|
-
inputType:
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
20
|
+
cryptoAmount: i,
|
|
21
|
+
cryptoCurrency: l,
|
|
22
|
+
cryptoDecimalPlaces: _,
|
|
23
|
+
fiatAmount: d,
|
|
24
|
+
fiatCurrency: p,
|
|
25
|
+
fiatDecimalPlaces: g,
|
|
26
|
+
exchangeRate: a,
|
|
27
|
+
inputType: o,
|
|
28
|
+
isExchangeRatePending: h,
|
|
29
|
+
locale: c = D,
|
|
30
|
+
setCryptoAmount: x,
|
|
31
|
+
setFiatAmount: f,
|
|
32
|
+
setInputType: r,
|
|
33
|
+
...A
|
|
34
|
+
}, E) => {
|
|
35
|
+
const w = o === "fiat" ? `switch input to ${l}` : `switch input to ${p}`, {
|
|
36
|
+
inputValue: I,
|
|
37
|
+
inputCurrency: N,
|
|
38
|
+
inputDecimalPlaces: b,
|
|
39
|
+
formatOutputValue: s,
|
|
40
|
+
outputValue: e,
|
|
41
|
+
outputCurrency: m,
|
|
42
|
+
handleChange: k
|
|
43
|
+
} = S({
|
|
44
|
+
cryptoAmount: i,
|
|
45
|
+
cryptoCurrency: l,
|
|
46
|
+
cryptoDecimalPlaces: _,
|
|
47
|
+
exchangeRate: a,
|
|
48
|
+
fiatAmount: d,
|
|
49
|
+
fiatCurrency: p,
|
|
50
|
+
fiatDecimalPlaces: g,
|
|
51
|
+
inputType: o,
|
|
52
|
+
locale: c,
|
|
53
|
+
setCryptoAmount: x,
|
|
54
|
+
setFiatAmount: f
|
|
55
|
+
}), y = C(() => {
|
|
56
|
+
r(o === "fiat" ? "crypto" : "fiat");
|
|
57
|
+
}, [o, r]);
|
|
58
|
+
return /* @__PURE__ */ u($, { children: [
|
|
53
59
|
/* @__PURE__ */ n(
|
|
54
|
-
|
|
60
|
+
L,
|
|
55
61
|
{
|
|
56
|
-
ref:
|
|
57
|
-
amount:
|
|
58
|
-
unit:
|
|
59
|
-
decimalPlaces:
|
|
60
|
-
locale:
|
|
61
|
-
setAmount:
|
|
62
|
-
...
|
|
62
|
+
ref: E,
|
|
63
|
+
amount: I,
|
|
64
|
+
unit: N,
|
|
65
|
+
decimalPlaces: b,
|
|
66
|
+
locale: c,
|
|
67
|
+
setAmount: k,
|
|
68
|
+
...A
|
|
63
69
|
}
|
|
64
70
|
),
|
|
65
|
-
/* @__PURE__ */
|
|
71
|
+
!a && h && /* @__PURE__ */ n(j, { className: t["output-loading-skeleton"], children: /* @__PURE__ */ u("span", { className: t["output-loading-skeleton-placeholder"], children: [
|
|
72
|
+
s(e ?? 0),
|
|
73
|
+
" ",
|
|
74
|
+
m
|
|
75
|
+
] }) }),
|
|
76
|
+
a && /* @__PURE__ */ u("span", { className: `${t["flex-row"]} ${t["gap-1"]}`, children: [
|
|
66
77
|
/* @__PURE__ */ n(
|
|
67
|
-
|
|
78
|
+
z,
|
|
68
79
|
{
|
|
69
|
-
"aria-label":
|
|
80
|
+
"aria-label": w,
|
|
70
81
|
className: t["swap-button"],
|
|
71
|
-
onClick:
|
|
82
|
+
onClick: y,
|
|
72
83
|
type: "button",
|
|
73
|
-
|
|
84
|
+
size: "xs",
|
|
85
|
+
variant: "transparentSecondary",
|
|
86
|
+
children: /* @__PURE__ */ n(F, { className: t.icon })
|
|
74
87
|
}
|
|
75
88
|
),
|
|
76
|
-
/* @__PURE__ */
|
|
77
|
-
/* @__PURE__ */ n(
|
|
78
|
-
|
|
89
|
+
/* @__PURE__ */ u("span", { className: `${t["flex-row"]} ${t["gap-2"]}`, children: [
|
|
90
|
+
/* @__PURE__ */ n(
|
|
91
|
+
"span",
|
|
92
|
+
{
|
|
93
|
+
"data-part": "amount-output-unsized-value",
|
|
94
|
+
"data-testid": "exchange-amount-output-value",
|
|
95
|
+
children: s(isNaN(e ?? 0) ? 0 : e ?? 0)
|
|
96
|
+
}
|
|
97
|
+
),
|
|
98
|
+
/* @__PURE__ */ n(
|
|
99
|
+
"span",
|
|
100
|
+
{
|
|
101
|
+
"data-part": "amount-output-unsized-currency",
|
|
102
|
+
"data-testid": "exchange-amount-output-currency",
|
|
103
|
+
className: t["output-currency"],
|
|
104
|
+
children: m
|
|
105
|
+
}
|
|
106
|
+
)
|
|
79
107
|
] })
|
|
80
108
|
] })
|
|
81
109
|
] });
|
|
82
110
|
}
|
|
83
111
|
);
|
|
84
|
-
|
|
112
|
+
B.displayName = "ExchangeAmountInput";
|
|
85
113
|
export {
|
|
86
|
-
|
|
114
|
+
B as ExchangeAmountInput
|
|
87
115
|
};
|
|
@@ -4,11 +4,12 @@ export type ExchangeAmountInputProps = {
|
|
|
4
4
|
cryptoAmount: AmountInputProps["amount"];
|
|
5
5
|
cryptoDecimalPlaces?: AmountInputProps["decimalPlaces"];
|
|
6
6
|
cryptoCurrency: NonNullable<AmountInputProps["unit"]>;
|
|
7
|
-
exchangeRate
|
|
7
|
+
exchangeRate?: number;
|
|
8
8
|
fiatAmount: AmountInputProps["amount"];
|
|
9
9
|
fiatCurrency: NonNullable<AmountInputProps["unit"]>;
|
|
10
10
|
fiatDecimalPlaces?: AmountInputProps["decimalPlaces"];
|
|
11
11
|
inputType: InputType;
|
|
12
|
+
isExchangeRatePending?: boolean;
|
|
12
13
|
locale?: string;
|
|
13
14
|
max?: number;
|
|
14
15
|
min?: number;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { Big as
|
|
1
|
+
import { Big as B } from "big.js";
|
|
2
2
|
import { useCallback as u, useMemo as _ } from "react";
|
|
3
3
|
import { useNumberParseAndFormat as I } from "../AmountInput/useNumberParseAndFormat.js";
|
|
4
4
|
import { DEFAULT_LOCALE as k } from "../../../data/locale.js";
|
|
5
5
|
const O = (f) => {
|
|
6
6
|
try {
|
|
7
|
-
return
|
|
7
|
+
return B(f);
|
|
8
8
|
} catch {
|
|
9
9
|
return null;
|
|
10
10
|
}
|
|
@@ -12,87 +12,91 @@ const O = (f) => {
|
|
|
12
12
|
cryptoAmount: f,
|
|
13
13
|
cryptoCurrency: F,
|
|
14
14
|
cryptoDecimalPlaces: n = 8,
|
|
15
|
-
exchangeRate:
|
|
16
|
-
fiatAmount:
|
|
17
|
-
fiatCurrency:
|
|
15
|
+
exchangeRate: m,
|
|
16
|
+
fiatAmount: V,
|
|
17
|
+
fiatCurrency: h,
|
|
18
18
|
fiatDecimalPlaces: i = 2,
|
|
19
19
|
inputType: o,
|
|
20
20
|
locale: E = k,
|
|
21
|
-
setFiatAmount:
|
|
21
|
+
setFiatAmount: s,
|
|
22
22
|
setCryptoAmount: d
|
|
23
23
|
}) => {
|
|
24
|
-
const
|
|
24
|
+
const L = u(
|
|
25
25
|
(r) => {
|
|
26
|
-
|
|
26
|
+
s(r);
|
|
27
27
|
const t = O(r);
|
|
28
28
|
if (r === 0 || isNaN(r) || t === null) {
|
|
29
|
-
d(
|
|
29
|
+
d(NaN);
|
|
30
30
|
return;
|
|
31
31
|
}
|
|
32
|
-
const
|
|
33
|
-
d(
|
|
32
|
+
const N = t.times(m ?? 0);
|
|
33
|
+
d(
|
|
34
|
+
N.eq(0) ? 0 : +N.toFixed(n, B.roundDown)
|
|
35
|
+
);
|
|
34
36
|
},
|
|
35
|
-
[
|
|
36
|
-
),
|
|
37
|
+
[m, s, d, n]
|
|
38
|
+
), b = u(
|
|
37
39
|
(r) => {
|
|
38
40
|
d(r);
|
|
39
41
|
const t = O(r);
|
|
40
42
|
if (r === 0 || isNaN(r) || t === null) {
|
|
41
|
-
|
|
43
|
+
s(NaN);
|
|
42
44
|
return;
|
|
43
45
|
}
|
|
44
|
-
const
|
|
45
|
-
|
|
46
|
+
const N = m ? t.div(m) : B(0);
|
|
47
|
+
s(
|
|
48
|
+
N.eq(0) ? 0 : +N.toFixed(i, B.roundDown)
|
|
49
|
+
);
|
|
46
50
|
},
|
|
47
|
-
[
|
|
48
|
-
),
|
|
51
|
+
[m, s, d, i]
|
|
52
|
+
), q = u(
|
|
49
53
|
(r, t) => {
|
|
50
|
-
o === "fiat" ?
|
|
54
|
+
o === "fiat" ? L(r) : b(r), t?.(r);
|
|
51
55
|
},
|
|
52
|
-
[
|
|
53
|
-
), { formatter:
|
|
56
|
+
[L, b, o]
|
|
57
|
+
), { formatter: a } = I({
|
|
54
58
|
inputValue: "",
|
|
55
59
|
locale: E,
|
|
56
60
|
options: {
|
|
57
61
|
maximumFractionDigits: i,
|
|
58
62
|
minimumFractionDigits: 0
|
|
59
63
|
}
|
|
60
|
-
}), { formatter:
|
|
64
|
+
}), { formatter: g } = I({
|
|
61
65
|
inputValue: "",
|
|
62
66
|
locale: E,
|
|
63
67
|
options: {
|
|
64
68
|
maximumFractionDigits: n,
|
|
65
69
|
minimumFractionDigits: 0
|
|
66
70
|
}
|
|
67
|
-
}),
|
|
68
|
-
(r) => o === "fiat" ?
|
|
69
|
-
[
|
|
70
|
-
),
|
|
71
|
-
(r) => o === "fiat" ?
|
|
72
|
-
[
|
|
71
|
+
}), w = u(
|
|
72
|
+
(r) => o === "fiat" ? a.format(r) : g.format(r),
|
|
73
|
+
[g, a, o]
|
|
74
|
+
), x = u(
|
|
75
|
+
(r) => o === "fiat" ? g.format(r) : a.format(r),
|
|
76
|
+
[g, a, o]
|
|
73
77
|
);
|
|
74
78
|
return _(
|
|
75
79
|
() => ({
|
|
76
|
-
inputCurrency: o === "fiat" ?
|
|
80
|
+
inputCurrency: o === "fiat" ? h : F,
|
|
77
81
|
inputDecimalPlaces: o === "fiat" ? i : n,
|
|
78
|
-
inputValue: o === "fiat" ?
|
|
79
|
-
formatInputValue:
|
|
80
|
-
formatOutputValue:
|
|
81
|
-
handleChange:
|
|
82
|
-
outputCurrency: o === "fiat" ? F :
|
|
82
|
+
inputValue: o === "fiat" ? V : f,
|
|
83
|
+
formatInputValue: w,
|
|
84
|
+
formatOutputValue: x,
|
|
85
|
+
handleChange: q,
|
|
86
|
+
outputCurrency: o === "fiat" ? F : h,
|
|
83
87
|
outputDecimalPlaces: o === "fiat" ? n : i,
|
|
84
|
-
outputValue: o === "fiat" ? f :
|
|
88
|
+
outputValue: o === "fiat" ? f : V
|
|
85
89
|
}),
|
|
86
90
|
[
|
|
87
91
|
f,
|
|
88
92
|
F,
|
|
89
93
|
n,
|
|
90
|
-
N,
|
|
91
94
|
V,
|
|
95
|
+
h,
|
|
92
96
|
i,
|
|
93
|
-
q,
|
|
94
97
|
w,
|
|
95
|
-
|
|
98
|
+
x,
|
|
99
|
+
q,
|
|
96
100
|
o
|
|
97
101
|
]
|
|
98
102
|
);
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import { FormValidityStateProps } from '@radix-ui/react-form';
|
|
2
2
|
import { InputHTMLAttributes } from 'react';
|
|
3
|
-
|
|
4
|
-
export
|
|
3
|
+
import { InputSize } from '../../../theme/theme';
|
|
4
|
+
export interface InputProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "size"> {
|
|
5
|
+
size?: InputSize;
|
|
6
|
+
}
|
|
7
|
+
export declare const Input: import('react').ForwardRefExoticComponent<InputProps & import('react').RefAttributes<HTMLInputElement>>;
|
|
8
|
+
export declare const withValidityState: (props: InputProps) => FormValidityStateProps["children"];
|
|
@@ -1,17 +1,32 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as m } from "react/jsx-runtime";
|
|
2
2
|
import "@radix-ui/react-form";
|
|
3
|
-
import { forwardRef as p } from "react";
|
|
4
|
-
import '../../../assets/Input.css';const
|
|
5
|
-
input:
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
import { forwardRef as p, useMemo as l } from "react";
|
|
4
|
+
import '../../../assets/Input.css';const d = "Input-module__input___-mK8z", t = {
|
|
5
|
+
input: d,
|
|
6
|
+
"size-lg": "Input-module__size-lg___IYoRG",
|
|
7
|
+
"size-md": "Input-module__size-md___8hkn5",
|
|
8
|
+
"size-sm": "Input-module__size-sm___cnynF",
|
|
9
|
+
"size-xs": "Input-module__size-xs___aK-NH"
|
|
10
|
+
}, o = p(
|
|
11
|
+
({ className: e = "", size: s = "md", ...i }, n) => {
|
|
12
|
+
const _ = l(() => {
|
|
13
|
+
const u = [t.input], a = {
|
|
14
|
+
lg: t["size-lg"],
|
|
15
|
+
md: t["size-md"],
|
|
16
|
+
sm: t["size-sm"],
|
|
17
|
+
xs: t["size-xs"]
|
|
18
|
+
};
|
|
19
|
+
return s && u.push(a[s]), u.join(" ");
|
|
20
|
+
}, [s]);
|
|
21
|
+
return /* @__PURE__ */ m("input", { ref: n, className: `${_} ${e}`, ...i });
|
|
22
|
+
}
|
|
8
23
|
);
|
|
9
|
-
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
-
return /* @__PURE__ */
|
|
24
|
+
o.displayName = "Input";
|
|
25
|
+
const I = (e) => (i) => {
|
|
26
|
+
const n = i === void 0 || i.valid ? void 0 : !0;
|
|
27
|
+
return /* @__PURE__ */ m(o, { ...e, "aria-invalid": n });
|
|
13
28
|
};
|
|
14
29
|
export {
|
|
15
|
-
|
|
16
|
-
|
|
30
|
+
o as Input,
|
|
31
|
+
I as withValidityState
|
|
17
32
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { CountryCode } from 'libphonenumber-js';
|
|
2
|
-
import {
|
|
2
|
+
import { InputProps } from '../Input/Input';
|
|
3
3
|
import { PhoneNumber } from '../../../utils/parseValuesFromPhoneNumber';
|
|
4
|
-
export interface PhoneNumberInputProps extends Omit<
|
|
4
|
+
export interface PhoneNumberInputProps extends Omit<InputProps, "value" | "onChange"> {
|
|
5
5
|
onCountryCodeChange: (newCountry: CountryCode) => void;
|
|
6
6
|
countryCode?: CountryCode;
|
|
7
7
|
onPhoneNumberChange: (phoneNumber: PhoneNumber) => void;
|
|
@@ -21,24 +21,24 @@ import '../../../assets/Button.css';const f = "Button-module__btn___Wj6Dr", S =
|
|
|
21
21
|
transparentPrimary: r["transparent-primary"],
|
|
22
22
|
transparentSecondary: r["transparent-secondary"],
|
|
23
23
|
control: r["control-btn"]
|
|
24
|
-
},
|
|
24
|
+
}, x = u(
|
|
25
25
|
({
|
|
26
26
|
children: e,
|
|
27
27
|
className: i = "",
|
|
28
28
|
isPending: o,
|
|
29
29
|
pendingLabel: s = "Loading...",
|
|
30
|
-
size: m = "
|
|
30
|
+
size: m = "md",
|
|
31
31
|
variant: n = "primary",
|
|
32
32
|
..._
|
|
33
33
|
}, d) => {
|
|
34
|
-
const
|
|
34
|
+
const y = n === "linkPrimary" || n === "linkSecondary" ? "none" : m, l = a[n] ?? a.primary;
|
|
35
35
|
return /* @__PURE__ */ t(
|
|
36
36
|
k,
|
|
37
37
|
{
|
|
38
|
-
className: `${r.btn} ${
|
|
38
|
+
className: `${r.btn} ${l} ${i}`,
|
|
39
39
|
ref: d,
|
|
40
40
|
isPending: o,
|
|
41
|
-
size:
|
|
41
|
+
size: y,
|
|
42
42
|
..._,
|
|
43
43
|
children: o ? /* @__PURE__ */ c(p, { children: [
|
|
44
44
|
/* @__PURE__ */ t(B, { "aria-hidden": "true" }),
|
|
@@ -48,7 +48,7 @@ import '../../../assets/Button.css';const f = "Button-module__btn___Wj6Dr", S =
|
|
|
48
48
|
);
|
|
49
49
|
}
|
|
50
50
|
);
|
|
51
|
-
|
|
51
|
+
x.displayName = "Button";
|
|
52
52
|
export {
|
|
53
|
-
|
|
53
|
+
x as Button
|
|
54
54
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { forwardRef as
|
|
1
|
+
import { jsx as d } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as B, useMemo as r } from "react";
|
|
3
3
|
import "../../../theme/theme.js";
|
|
4
4
|
import '../../../assets/ButtonBase.css';const z = "ButtonBase-module__btn___9S8PJ", s = {
|
|
5
5
|
btn: z,
|
|
@@ -8,32 +8,32 @@ import '../../../assets/ButtonBase.css';const z = "ButtonBase-module__btn___9S8P
|
|
|
8
8
|
"size-md": "ButtonBase-module__size-md___sAsBJ",
|
|
9
9
|
"size-sm": "ButtonBase-module__size-sm___xHCtU",
|
|
10
10
|
"size-xs": "ButtonBase-module__size-xs___LiiO7"
|
|
11
|
-
},
|
|
11
|
+
}, _ = {
|
|
12
|
+
lg: s["size-lg"],
|
|
13
|
+
md: s["size-md"],
|
|
14
|
+
sm: s["size-sm"],
|
|
15
|
+
xs: s["size-xs"],
|
|
16
|
+
none: ""
|
|
17
|
+
}, c = B(
|
|
12
18
|
({
|
|
13
19
|
children: n,
|
|
14
20
|
className: m = "",
|
|
15
21
|
fullWidth: t = !1,
|
|
16
22
|
isPending: i,
|
|
17
|
-
size: o = "
|
|
18
|
-
...
|
|
19
|
-
},
|
|
20
|
-
const
|
|
21
|
-
const e = [s.btn]
|
|
22
|
-
|
|
23
|
-
md: s["size-md"],
|
|
24
|
-
sm: s["size-sm"],
|
|
25
|
-
xs: s["size-xs"],
|
|
26
|
-
none: ""
|
|
27
|
-
};
|
|
28
|
-
return e.push(_[o] ?? _.lg), t && e.push(s["full-width"]), e.join(" ");
|
|
23
|
+
size: o = "md",
|
|
24
|
+
...u
|
|
25
|
+
}, a) => {
|
|
26
|
+
const l = r(() => {
|
|
27
|
+
const e = [s.btn];
|
|
28
|
+
return e.push(_[o] ?? _.md), t && e.push(s["full-width"]), e.join(" ");
|
|
29
29
|
}, [t, o]);
|
|
30
|
-
return /* @__PURE__ */
|
|
30
|
+
return /* @__PURE__ */ d(
|
|
31
31
|
"button",
|
|
32
32
|
{
|
|
33
|
-
className: `${
|
|
34
|
-
ref:
|
|
33
|
+
className: `${l} ${m}`,
|
|
34
|
+
ref: a,
|
|
35
35
|
"data-pending": i,
|
|
36
|
-
...
|
|
36
|
+
...u,
|
|
37
37
|
children: n
|
|
38
38
|
}
|
|
39
39
|
);
|
|
@@ -1,3 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
import { CSSProperties } from 'react';
|
|
2
|
+
interface LoadingSpinnerProps {
|
|
2
3
|
className?: string;
|
|
3
|
-
|
|
4
|
+
staticStroke?: boolean;
|
|
5
|
+
staticStrokeColor?: string;
|
|
6
|
+
strokeWidth?: string | number;
|
|
7
|
+
style?: CSSProperties;
|
|
8
|
+
}
|
|
9
|
+
export declare const LoadingSpinner: ({ className, staticStroke, staticStrokeColor, strokeWidth, style, }: LoadingSpinnerProps) => import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export {};
|
|
@@ -1,8 +1,15 @@
|
|
|
1
|
-
import { jsx as n } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
3
|
-
|
|
1
|
+
import { jsx as n, jsxs as s } from "react/jsx-runtime";
|
|
2
|
+
import "react";
|
|
3
|
+
import '../../../assets/LoadingSpinner.css';const p = "LoadingSpinner-module__spinner___-zo6Y", i = {
|
|
4
|
+
spinner: p,
|
|
4
5
|
"spinner-circle": "LoadingSpinner-module__spinner-circle___9Jfm7"
|
|
5
|
-
},
|
|
6
|
+
}, g = ({
|
|
7
|
+
className: o,
|
|
8
|
+
staticStroke: c,
|
|
9
|
+
staticStrokeColor: r = "currentColor",
|
|
10
|
+
strokeWidth: e = "3",
|
|
11
|
+
style: l
|
|
12
|
+
}) => /* @__PURE__ */ n(
|
|
6
13
|
"svg",
|
|
7
14
|
{
|
|
8
15
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -12,20 +19,35 @@ import '../../../assets/LoadingSpinner.css';const r = "LoadingSpinner-module__sp
|
|
|
12
19
|
width: "24",
|
|
13
20
|
height: "24",
|
|
14
21
|
stroke: "currentColor",
|
|
15
|
-
className:
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
22
|
+
className: o,
|
|
23
|
+
style: l,
|
|
24
|
+
children: /* @__PURE__ */ s("g", { className: i.spinner, children: [
|
|
25
|
+
c && /* @__PURE__ */ n(
|
|
26
|
+
"circle",
|
|
27
|
+
{
|
|
28
|
+
cx: "12",
|
|
29
|
+
cy: "12",
|
|
30
|
+
r: "9.5",
|
|
31
|
+
fill: "none",
|
|
32
|
+
strokeWidth: e,
|
|
33
|
+
stroke: r,
|
|
34
|
+
opacity: r === "currentColor" ? "0.2" : void 0
|
|
35
|
+
}
|
|
36
|
+
),
|
|
37
|
+
/* @__PURE__ */ n(
|
|
38
|
+
"circle",
|
|
39
|
+
{
|
|
40
|
+
className: i["spinner-circle"],
|
|
41
|
+
cx: "12",
|
|
42
|
+
cy: "12",
|
|
43
|
+
r: "9.5",
|
|
44
|
+
fill: "none",
|
|
45
|
+
strokeWidth: e
|
|
46
|
+
}
|
|
47
|
+
)
|
|
48
|
+
] })
|
|
27
49
|
}
|
|
28
50
|
);
|
|
29
51
|
export {
|
|
30
|
-
|
|
52
|
+
g as LoadingSpinner
|
|
31
53
|
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { jsxs as r, jsx as C } from "react/jsx-runtime";
|
|
2
|
+
import "react";
|
|
3
|
+
import { SvgIcon as t } from "./SvgIcon.js";
|
|
4
|
+
const h = (o) => /* @__PURE__ */ r(t, { width: "14", height: "16", viewBox: "0 0 14 16", fill: "currentColor", ...o, children: [
|
|
5
|
+
/* @__PURE__ */ C("path", { d: "M10.0787 0C10.1159 0 10.1532 0 10.1925 0C10.2839 1.12836 9.85317 1.97146 9.32974 2.58201C8.81615 3.18834 8.11286 3.77641 6.97537 3.68718C6.89949 2.57498 7.33088 1.79441 7.8536 1.18527C8.33839 0.617575 9.22716 0.112414 10.0787 0Z" }),
|
|
6
|
+
/* @__PURE__ */ C("path", { d: "M13.5221 11.7446C13.5221 11.7558 13.5221 11.7657 13.5221 11.7762C13.2025 12.7444 12.7465 13.5741 12.19 14.3442C11.6821 15.0432 11.0596 15.984 9.94808 15.984C8.98765 15.984 8.3497 15.3664 7.36537 15.3496C6.32414 15.3327 5.75153 15.866 4.79952 16.0002C4.69062 16.0002 4.58172 16.0002 4.47493 16.0002C3.77585 15.899 3.21167 15.3454 2.80066 14.8465C1.5887 13.3725 0.652147 11.4685 0.477905 9.0319C0.477905 8.79302 0.477905 8.55485 0.477905 8.31597C0.551677 6.57215 1.399 5.15432 2.52525 4.46719C3.11963 4.10185 3.93674 3.7906 4.84659 3.92971C5.23653 3.99014 5.6349 4.12363 5.98408 4.25571C6.315 4.38288 6.72883 4.60841 7.12087 4.59647C7.38645 4.58874 7.65062 4.45033 7.91831 4.35267C8.7024 4.06953 9.47103 3.74493 10.4842 3.89739C11.7017 4.08147 12.5659 4.62246 13.0999 5.45714C12.0699 6.11265 11.2556 7.10049 11.3947 8.7874C11.5184 10.3197 12.4092 11.2162 13.5221 11.7446Z" })
|
|
7
|
+
] });
|
|
8
|
+
export {
|
|
9
|
+
h as IconAppleLogo
|
|
10
|
+
};
|
|
@@ -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 e = (i) => /* @__PURE__ */ o(r, { width: "16", height: "17", viewBox: "0 0 16 17", fill: "none", ...i, children: /* @__PURE__ */ o(
|
|
5
|
+
"path",
|
|
6
|
+
{
|
|
7
|
+
d: "M8.01503 12.5C5.80088 12.5 4.00751 10.6354 4.00751 8.33333C4.00751 6.03125 5.80088 4.16667 8.01503 4.16667C9.99875 4.16667 11.6452 5.67014 11.9624 7.63889H16C15.6594 3.36111 12.2162 0 8.01503 0C3.59006 0 0 3.73264 0 8.33333C0 12.934 3.59006 16.6667 8.01503 16.6667C12.2162 16.6667 15.6594 13.3056 16 9.02778H11.9624C11.6452 10.9965 9.99875 12.5 8.01503 12.5Z",
|
|
8
|
+
fill: "#0052ff"
|
|
9
|
+
}
|
|
10
|
+
) });
|
|
11
|
+
export {
|
|
12
|
+
e as IconCoinbaseMark
|
|
13
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { jsxs as t, jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import "react";
|
|
3
|
+
import { SvgIcon as i } from "./SvgIcon.js";
|
|
4
|
+
const d = (o) => /* @__PURE__ */ t(i, { width: "14", height: "16", viewBox: "0 0 14 16", fill: "currentColor", ...o, children: [
|
|
5
|
+
/* @__PURE__ */ r("path", { d: "M0.477905 2.33301V12.9997H13.5221V2.33301H0.477905ZM12.1634 3.99967V5.33301H1.83668V3.99967H12.1634ZM1.83668 11.333V7.66634H12.1634V11.333H1.83668Z" }),
|
|
6
|
+
/* @__PURE__ */ r("path", { d: "M2.65195 8.66634H7.00003V9.66634H2.65195V8.66634Z" })
|
|
7
|
+
] });
|
|
8
|
+
export {
|
|
9
|
+
d as IconCreditCard
|
|
10
|
+
};
|