@coinbase/cdp-react 0.0.31 → 0.0.32
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/Button.css +1 -1
- package/dist/assets/FundErrorScreen.css +1 -1
- package/dist/assets/FundModal.css +1 -1
- package/dist/assets/FundTransactionStatus.css +1 -1
- package/dist/assets/Select.css +1 -1
- package/dist/assets/ThemeProvider.css +1 -1
- package/dist/components/Fund/FundProvider.js +34 -32
- package/dist/components/Fund/components/FundTransactionStatus.js +69 -68
- package/dist/components/Fund/hooks/useBuyUrl.d.ts +2 -1
- package/dist/components/Fund/hooks/useBuyUrl.js +45 -33
- package/dist/components/Fund/types.d.ts +1 -0
- package/dist/components/FundModal/index.js +33 -32
- package/dist/components/forms/Select/index.js +1 -1
- package/dist/icons/IconExclamationTriangle.js +3 -10
- package/dist/theme/theme.d.ts +59 -10
- package/dist/theme/tokens.d.ts +176 -29
- package/dist/theme/tokens.js +53 -15
- package/dist/theme/utils.d.ts +6 -0
- package/dist/theme/utils.js +37 -20
- package/package.json +5 -5
package/dist/theme/tokens.js
CHANGED
|
@@ -21,6 +21,8 @@ const e = {
|
|
|
21
21
|
// background
|
|
22
22
|
alternate: { value: e.gray100 },
|
|
23
23
|
// alternate background
|
|
24
|
+
contrast: { value: "{colors.fg.default}" },
|
|
25
|
+
// contrast background, used to mix with other backgrounds to create relative colors (i.e. for hover / pressed states)
|
|
24
26
|
overlay: { value: "{colors.bg.alternate}", modify: { type: "alpha", value: 0.33 } },
|
|
25
27
|
// overlay background
|
|
26
28
|
skeleton: { value: "{colors.fg.default}", modify: { type: "alpha", value: 0.1 } },
|
|
@@ -60,7 +62,7 @@ const e = {
|
|
|
60
62
|
negative: { value: "{colors.fg.negative}" }
|
|
61
63
|
// negative line color
|
|
62
64
|
}
|
|
63
|
-
},
|
|
65
|
+
}, o = {
|
|
64
66
|
page: {
|
|
65
67
|
bg: {
|
|
66
68
|
default: { value: "{colors.bg.default}" }
|
|
@@ -77,7 +79,14 @@ const e = {
|
|
|
77
79
|
primary: {
|
|
78
80
|
bg: {
|
|
79
81
|
default: { value: "{colors.bg.primary}" },
|
|
80
|
-
hover: {
|
|
82
|
+
hover: {
|
|
83
|
+
value: "{colors.bg.primary}",
|
|
84
|
+
modify: { type: "mix", value: [["{colors.bg.contrast}", "15%"]] }
|
|
85
|
+
},
|
|
86
|
+
pressed: {
|
|
87
|
+
value: "{colors.bg.primary}",
|
|
88
|
+
modify: { type: "mix", value: [["{colors.bg.contrast}", "30%"]] }
|
|
89
|
+
}
|
|
81
90
|
},
|
|
82
91
|
border: {
|
|
83
92
|
focus: { value: "{colors.line.primary}" }
|
|
@@ -92,7 +101,11 @@ const e = {
|
|
|
92
101
|
default: { value: "{colors.bg.secondary}" },
|
|
93
102
|
hover: {
|
|
94
103
|
value: "{colors.bg.secondary}",
|
|
95
|
-
modify: { type: "
|
|
104
|
+
modify: { type: "mix", value: [["{colors.bg.contrast}", "10%"]] }
|
|
105
|
+
},
|
|
106
|
+
pressed: {
|
|
107
|
+
value: "{colors.bg.secondary}",
|
|
108
|
+
modify: { type: "mix", value: [["{colors.bg.contrast}", "20%"]] }
|
|
96
109
|
}
|
|
97
110
|
},
|
|
98
111
|
border: {
|
|
@@ -108,13 +121,27 @@ const e = {
|
|
|
108
121
|
primary: {
|
|
109
122
|
text: {
|
|
110
123
|
default: { value: "{colors.fg.primary}" },
|
|
111
|
-
hover: {
|
|
124
|
+
hover: {
|
|
125
|
+
value: "{colors.fg.primary}",
|
|
126
|
+
modify: { type: "mix", value: [["{colors.bg.contrast}", "15%"]] }
|
|
127
|
+
},
|
|
128
|
+
pressed: {
|
|
129
|
+
value: "{colors.fg.primary}",
|
|
130
|
+
modify: { type: "mix", value: [["{colors.bg.contrast}", "30%"]] }
|
|
131
|
+
}
|
|
112
132
|
}
|
|
113
133
|
},
|
|
114
134
|
secondary: {
|
|
115
135
|
text: {
|
|
116
136
|
default: { value: "{colors.fg.default}" },
|
|
117
|
-
hover: {
|
|
137
|
+
hover: {
|
|
138
|
+
value: "{colors.fg.default}",
|
|
139
|
+
modify: { type: "mix", value: [["{colors.bg.contrast}", "10%"]] }
|
|
140
|
+
},
|
|
141
|
+
pressed: {
|
|
142
|
+
value: "{colors.fg.default}",
|
|
143
|
+
modify: { type: "mix", value: [["{colors.bg.contrast}", "20%"]] }
|
|
144
|
+
}
|
|
118
145
|
}
|
|
119
146
|
}
|
|
120
147
|
},
|
|
@@ -150,7 +177,15 @@ const e = {
|
|
|
150
177
|
},
|
|
151
178
|
trigger: {
|
|
152
179
|
bg: {
|
|
153
|
-
default: { value: "{colors.bg.default}" }
|
|
180
|
+
default: { value: "{colors.bg.default}" },
|
|
181
|
+
hover: {
|
|
182
|
+
value: "{colors.bg.default}",
|
|
183
|
+
modify: { type: "mix", value: [["{colors.bg.contrast}", "5%"]] }
|
|
184
|
+
},
|
|
185
|
+
pressed: {
|
|
186
|
+
value: "{colors.bg.default}",
|
|
187
|
+
modify: { type: "mix", value: [["{colors.bg.contrast}", "7%"]] }
|
|
188
|
+
}
|
|
154
189
|
},
|
|
155
190
|
border: {
|
|
156
191
|
default: { value: "{colors.line.default}" },
|
|
@@ -184,7 +219,10 @@ const e = {
|
|
|
184
219
|
item: {
|
|
185
220
|
bg: {
|
|
186
221
|
default: { value: "{colors.bg.default}" },
|
|
187
|
-
highlight: {
|
|
222
|
+
highlight: {
|
|
223
|
+
value: "{colors.bg.default}",
|
|
224
|
+
modify: { type: "mix", value: [["{colors.bg.contrast}", "10%"]] }
|
|
225
|
+
}
|
|
188
226
|
},
|
|
189
227
|
text: {
|
|
190
228
|
default: { value: "{colors.fg.default}" },
|
|
@@ -206,30 +244,30 @@ const e = {
|
|
|
206
244
|
default: { value: "{colors.fg.default}" }
|
|
207
245
|
}
|
|
208
246
|
}
|
|
209
|
-
},
|
|
247
|
+
}, a = {
|
|
210
248
|
...l,
|
|
211
|
-
...
|
|
249
|
+
...o
|
|
212
250
|
}, r = {
|
|
213
251
|
family: {
|
|
214
252
|
mono: {
|
|
215
253
|
value: '"DM Mono", monospace'
|
|
216
254
|
},
|
|
217
255
|
sans: {
|
|
218
|
-
value: '"
|
|
256
|
+
value: '"Rethink Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"'
|
|
219
257
|
}
|
|
220
258
|
},
|
|
221
259
|
size: {
|
|
222
260
|
base: { value: 16 }
|
|
223
261
|
}
|
|
224
|
-
},
|
|
225
|
-
colors:
|
|
262
|
+
}, t = {
|
|
263
|
+
colors: a,
|
|
226
264
|
font: r
|
|
227
265
|
};
|
|
228
266
|
export {
|
|
229
|
-
|
|
267
|
+
a as colors,
|
|
230
268
|
e as colorsBase,
|
|
231
|
-
|
|
269
|
+
o as colorsComponents,
|
|
232
270
|
l as colorsSemantic,
|
|
233
271
|
r as font,
|
|
234
|
-
|
|
272
|
+
t as tokens
|
|
235
273
|
};
|
package/dist/theme/utils.d.ts
CHANGED
|
@@ -11,6 +11,12 @@ export type TokenValue = {
|
|
|
11
11
|
modify?: {
|
|
12
12
|
type: "alpha";
|
|
13
13
|
value: number | string;
|
|
14
|
+
} | {
|
|
15
|
+
type: "hsl";
|
|
16
|
+
value: [number, number, number];
|
|
17
|
+
} | {
|
|
18
|
+
type: "mix";
|
|
19
|
+
value: ReadonlyArray<string | readonly [string, string]>;
|
|
14
20
|
};
|
|
15
21
|
};
|
|
16
22
|
export type NestedTokenObject = {
|
package/dist/theme/utils.js
CHANGED
|
@@ -1,27 +1,44 @@
|
|
|
1
|
-
function
|
|
2
|
-
return typeof
|
|
1
|
+
function a(t) {
|
|
2
|
+
return typeof t == "object" && t !== null && "value" in t && (typeof t.value == "string" || typeof t.value == "number");
|
|
3
3
|
}
|
|
4
|
-
function p(
|
|
5
|
-
const
|
|
6
|
-
function
|
|
7
|
-
for (const
|
|
8
|
-
if (Object.prototype.hasOwnProperty.call(
|
|
9
|
-
const
|
|
10
|
-
if (
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
} else typeof
|
|
4
|
+
function p(t, e = "cdp-web") {
|
|
5
|
+
const o = {};
|
|
6
|
+
function n(r, c) {
|
|
7
|
+
for (const s in r)
|
|
8
|
+
if (Object.prototype.hasOwnProperty.call(r, s)) {
|
|
9
|
+
const f = [...c, s], i = r[s];
|
|
10
|
+
if (a(i)) {
|
|
11
|
+
const u = f.join("-");
|
|
12
|
+
o[u] = y(i, e);
|
|
13
|
+
} else typeof i == "object" && i !== null && n(i, f);
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
|
-
return
|
|
16
|
+
return n(t, []), o;
|
|
17
17
|
}
|
|
18
|
-
const
|
|
19
|
-
if (typeof
|
|
20
|
-
return `${
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
|
|
18
|
+
const l = (t, e) => t.startsWith("{") && t.endsWith("}") ? `var(--${e ? `${e}-` : ""}${t.slice(1, -1).replace(/\./g, "-")})` : t, y = (t, e) => {
|
|
19
|
+
if (typeof t.value == "number")
|
|
20
|
+
return `${t.value}px`;
|
|
21
|
+
const o = l(t.value, e);
|
|
22
|
+
if (t.modify?.type === "alpha")
|
|
23
|
+
return `color(from ${o} srgb r g b / ${t.modify.value ?? 1})`;
|
|
24
|
+
if (t.modify?.type === "hsl") {
|
|
25
|
+
const [n, r, c] = t.modify.value;
|
|
26
|
+
return `hsl(from ${o} calc(h * ${n}) calc(s * ${r}) calc(l * ${c}))`;
|
|
27
|
+
}
|
|
28
|
+
if (t.modify?.type === "mix") {
|
|
29
|
+
let n = o;
|
|
30
|
+
return t.modify.value.forEach((r) => {
|
|
31
|
+
if (typeof r == "string")
|
|
32
|
+
n += `, ${l(r, e)}`;
|
|
33
|
+
else {
|
|
34
|
+
const [c, s] = r;
|
|
35
|
+
n += `, ${l(c, e)} ${s}`;
|
|
36
|
+
}
|
|
37
|
+
}), `color-mix(in oklab, ${n})`;
|
|
38
|
+
}
|
|
39
|
+
return o;
|
|
40
|
+
}, m = (t) => Object.entries(t).reduce((e, [o, n]) => (e[`--cdp-web-${o}`] = n, e), {});
|
|
24
41
|
export {
|
|
25
42
|
p as flattenTokensObject,
|
|
26
|
-
|
|
43
|
+
m as themeToCssVariables
|
|
27
44
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coinbase/cdp-react",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.32",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"dependencies": {
|
|
6
6
|
"@internationalized/number": "3.6.4",
|
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
},
|
|
15
15
|
"peerDependencies": {
|
|
16
16
|
"react": ">=18.2.0",
|
|
17
|
-
"@coinbase/cdp-core": "^0.0.
|
|
18
|
-
"@coinbase/cdp-hooks": "^0.0.
|
|
17
|
+
"@coinbase/cdp-core": "^0.0.32",
|
|
18
|
+
"@coinbase/cdp-hooks": "^0.0.32"
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
|
21
21
|
"@size-limit/preset-big-lib": "^11.2.0",
|
|
@@ -45,8 +45,8 @@
|
|
|
45
45
|
"vite": "^7.0.4",
|
|
46
46
|
"vite-plugin-dts": "^4.5.4",
|
|
47
47
|
"vite-plugin-lib-inject-css": "^2.2.2",
|
|
48
|
-
"@coinbase/cdp-core": "^0.0.
|
|
49
|
-
"@coinbase/cdp-hooks": "^0.0.
|
|
48
|
+
"@coinbase/cdp-core": "^0.0.32",
|
|
49
|
+
"@coinbase/cdp-hooks": "^0.0.32"
|
|
50
50
|
},
|
|
51
51
|
"size-limit": [
|
|
52
52
|
{
|