@coinbase/cdp-react 0.0.72 → 0.0.73

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.
@@ -1,11 +1,11 @@
1
- import { jsxs as y, jsx as _ } from "react/jsx-runtime";
2
- import { c as S } from "../../../chunks/lite.1fxw3LjI.js";
3
- import { forwardRef as v, useRef as F, useMemo as T, useState as $, useEffect as I } from "react";
4
- import { useTheme as H } from "../../ThemeProvider/index.js";
5
- import { LoadingSkeleton as R } from "../LoadingSkeleton/index.js";
1
+ import { jsxs as H, jsx as B } from "react/jsx-runtime";
2
+ import { c as F } from "../../../chunks/lite.1fxw3LjI.js";
3
+ import { forwardRef as R, useRef as y, useMemo as C, useState as U, useEffect as T } from "react";
4
+ import { useTheme as L } from "../../ThemeProvider/index.js";
5
+ import { LoadingSkeleton as W } from "../LoadingSkeleton/index.js";
6
6
  import "../../../theme/theme.js";
7
- import { colorsBase as l } from "../../../theme/tokens.js";
8
- import '../../../assets/IframeButton.css';const C = "IframeButton-module__label___Vvl8W", U = "IframeButton-module__iframe___0RBLL", L = "IframeButton-module__hidden___LcF1X", s = {
7
+ import { colorsBase as i } from "../../../theme/tokens.js";
8
+ import '../../../assets/IframeButton.css';const N = "IframeButton-module__label___Vvl8W", P = "IframeButton-module__iframe___0RBLL", j = "IframeButton-module__hidden___LcF1X", s = {
9
9
  "iframe-button": "IframeButton-module__iframe-button___XeAhH",
10
10
  "full-width": "IframeButton-module__full-width___lQWpM",
11
11
  "size-lg": "IframeButton-module__size-lg___HCOiF",
@@ -13,153 +13,154 @@ import '../../../assets/IframeButton.css';const C = "IframeButton-module__label_
13
13
  "size-sm": "IframeButton-module__size-sm___U8ILi",
14
14
  "size-xs": "IframeButton-module__size-xs___S2jGa",
15
15
  "loading-skeleton": "IframeButton-module__loading-skeleton___fzBol",
16
- label: C,
16
+ label: N,
17
17
  "with-icon": "IframeButton-module__with-icon___KBiq1",
18
- iframe: U,
19
- hidden: L,
18
+ iframe: P,
19
+ hidden: j,
20
20
  "computed-style": "IframeButton-module__computed-style___ciB13"
21
- }, W = {
22
- pageBg: l.white,
23
- buttonBg: l.blue500,
21
+ }, k = {
22
+ pageBg: i.white,
23
+ buttonBg: i.blue500,
24
24
  buttonBgHover: "#0748d6",
25
25
  buttonBgPressed: "#0b3eae",
26
- buttonBgFocus: l.blue550,
27
- buttonBorder: l.blue550,
26
+ buttonBgFocus: i.blue550,
27
+ buttonBorder: i.blue550,
28
28
  buttonBorderHover: "#0748d6",
29
29
  buttonBorderPressed: "#0b3eae",
30
- buttonBorderFocus: l.blue550,
31
- buttonBorderFocusInset: l.white,
32
- buttonText: l.white,
33
- buttonTextHover: l.white,
34
- buttonTextPressed: l.white,
35
- buttonTextFocus: l.white,
30
+ buttonBorderFocus: i.blue550,
31
+ buttonBorderFocusInset: i.white,
32
+ buttonText: i.white,
33
+ buttonTextHover: i.white,
34
+ buttonTextPressed: i.white,
35
+ buttonTextFocus: i.white,
36
36
  buttonBorderRadius: 99999,
37
37
  buttonFontSize: 16,
38
38
  buttonFontWeight: 500,
39
39
  buttonSize: "md",
40
40
  fontUrl: "",
41
41
  fontFamily: ""
42
- }, N = Object.keys(W), P = (n) => N.every(
43
- (e) => e === "fontUrl" || e === "buttonSize" ? !0 : n[e] !== void 0
44
- ), f = (n, e, t) => (e.style.backgroundColor = `var(--cdp-web-${n})`, k(getComputedStyle(e).backgroundColor, t)), k = (n, e) => {
45
- if (!n || typeof n != "string")
46
- return console.warn("Invalid color input:", n), "";
47
- const t = n.trim();
42
+ }, $ = Object.keys(k), q = (o) => $.every(
43
+ (e) => e === "fontUrl" || e === "buttonSize" ? !0 : o[e] !== void 0
44
+ ), v = (o, e) => o === e ? !0 : !o || !e ? !1 : $.every((t) => o[t] === e[t]), f = (o, e, t) => (e.style.backgroundColor = `var(--cdp-web-${o})`, A(getComputedStyle(e).backgroundColor, t)), A = (o, e) => {
45
+ if (!o || typeof o != "string")
46
+ return console.warn("Invalid color input:", o), "";
47
+ const t = o.trim();
48
48
  if (t.startsWith("#"))
49
49
  return /^#[0-9A-Fa-f]{6}([0-9A-Fa-f]{2})?$/.test(t) ? t.toLowerCase() : (console.warn("Invalid hex color:", t), "");
50
50
  if (t === "transparent") return "transparent";
51
51
  if (t === "none") return "none";
52
- const o = e.getContext("2d", { willReadFrequently: !0 });
53
- if (!o)
52
+ const r = e.getContext("2d", { willReadFrequently: !0 });
53
+ if (!r)
54
54
  return console.warn("Could not create canvas context"), "";
55
- if (o.fillStyle = t, o.fillStyle.startsWith("#"))
56
- return o.fillStyle.toLowerCase();
57
- o.fillRect(0, 0, 1, 1);
58
- const a = o.getImageData(0, 0, 1, 1), [m, r, c, i] = a.data, d = m.toString(16).padStart(2, "0"), u = r.toString(16).padStart(2, "0"), g = c.toString(16).padStart(2, "0");
59
- if (i < 255) {
60
- const b = i.toString(16).padStart(2, "0");
61
- return `#${d}${u}${g}${b}`;
55
+ if (r.fillStyle = t, r.fillStyle.startsWith("#"))
56
+ return r.fillStyle.toLowerCase();
57
+ r.fillRect(0, 0, 1, 1);
58
+ const a = r.getImageData(0, 0, 1, 1), [m, n, c, l] = a.data, d = m.toString(16).padStart(2, "0"), u = n.toString(16).padStart(2, "0"), _ = c.toString(16).padStart(2, "0");
59
+ if (l < 255) {
60
+ const b = l.toString(16).padStart(2, "0");
61
+ return `#${d}${u}${_}${b}`;
62
62
  }
63
- return `#${d}${u}${g}`;
64
- }, j = (n, e, t, o) => {
65
- const a = getComputedStyle(t), m = f("colors-page-bg-default", t, o), r = f(`colors-cta-${e}-bg-default`, t, o), c = f(`colors-cta-${e}-bg-hover`, t, o), i = f(`colors-cta-${e}-bg-pressed`, t, o), d = f(`colors-cta-${e}-text-default`, t, o);
63
+ return `#${d}${u}${_}`;
64
+ }, M = (o, e, t, r) => {
65
+ const a = getComputedStyle(t), m = f("colors-page-bg-default", t, r), n = f(`colors-cta-${e}-bg-default`, t, r), c = f(`colors-cta-${e}-bg-hover`, t, r), l = f(`colors-cta-${e}-bg-pressed`, t, r), d = f(`colors-cta-${e}-text-default`, t, r);
66
66
  return {
67
67
  pageBg: m,
68
- buttonBg: r,
68
+ buttonBg: n,
69
69
  buttonBgHover: c,
70
- buttonBgPressed: i,
71
- buttonBgFocus: r,
72
- buttonBorder: r,
70
+ buttonBgPressed: l,
71
+ buttonBgFocus: n,
72
+ buttonBorder: n,
73
73
  buttonBorderHover: c,
74
- buttonBorderPressed: i,
75
- buttonBorderFocus: f(`colors-cta-${e}-border-focus`, t, o),
74
+ buttonBorderPressed: l,
75
+ buttonBorderFocus: f(`colors-cta-${e}-border-focus`, t, r),
76
76
  buttonBorderFocusInset: m,
77
77
  buttonBorderRadius: parseInt(a.borderRadius),
78
78
  buttonFontSize: parseInt(a.fontSize),
79
79
  buttonFontWeight: parseInt(a.fontWeight),
80
80
  buttonText: d,
81
- buttonTextHover: f(`colors-cta-${e}-text-hover`, t, o),
81
+ buttonTextHover: f(`colors-cta-${e}-text-hover`, t, r),
82
82
  buttonTextPressed: d,
83
83
  buttonTextFocus: d,
84
- buttonSize: n ?? "md",
84
+ buttonSize: o ?? "md",
85
85
  fontFamily: a.fontFamily,
86
86
  fontUrl: ""
87
87
  };
88
- }, A = {
88
+ }, V = {
89
89
  xs: s["size-xs"],
90
90
  sm: s["size-sm"],
91
91
  md: s["size-md"],
92
92
  lg: s["size-lg"]
93
- }, M = v(
93
+ }, D = R(
94
94
  ({
95
- className: n = "",
95
+ className: o = "",
96
96
  isPending: e,
97
97
  label: t,
98
- icon: o,
98
+ icon: r,
99
99
  fullWidth: a,
100
100
  size: m,
101
- theme: r,
101
+ theme: n,
102
102
  onThemeChange: c,
103
- ...i
103
+ ...l
104
104
  }, d) => {
105
- const u = m === "none" ? "md" : m, { theme: g } = H(), b = g["font-url-iframe"], p = F(null), h = F(null), B = T(() => !!r && P(r), [r]), [x, z] = $(
106
- B ? {
107
- ...r,
108
- fontUrl: r?.fontUrl ?? b,
105
+ const u = m === "none" ? "md" : m, { theme: _ } = L(), b = _["font-url-iframe"], p = y(null), x = y(null), h = C(() => !!n && q(n), [n]), [S, z] = U(
106
+ h ? {
107
+ ...n,
108
+ fontUrl: n?.fontUrl ?? b,
109
109
  buttonSize: u ?? "md"
110
110
  } : void 0
111
111
  );
112
- return I(() => {
113
- if (B) {
114
- z({
115
- ...r,
116
- fontUrl: r?.fontUrl ?? b,
112
+ return T(() => {
113
+ if (h) {
114
+ const g = {
115
+ ...n,
116
+ fontUrl: n?.fontUrl ?? b,
117
117
  buttonSize: u ?? "md"
118
- });
118
+ };
119
+ z((w) => v(g, w) ? w : g);
119
120
  return;
120
121
  }
121
- if (!p.current || !h.current) return;
122
- const w = j(
123
- u ?? "md",
124
- i.variant ?? "primary",
125
- p.current,
126
- h.current
127
- );
128
- z({
129
- ...w,
122
+ if (!p.current || !x.current) return;
123
+ const I = {
124
+ ...M(
125
+ u ?? "md",
126
+ l.variant ?? "primary",
127
+ p.current,
128
+ x.current
129
+ ),
130
130
  fontUrl: b,
131
- ...r
132
- });
133
- }, [i.variant, u, B, r, b]), I(() => {
134
- x && c?.(x);
135
- }, [x, c]), /* @__PURE__ */ y(
131
+ ...n
132
+ };
133
+ z((g) => v(I, g) ? g : I);
134
+ }, [l.variant, u, h, n, b, _]), T(() => {
135
+ S && c?.(S);
136
+ }, [S, c]), /* @__PURE__ */ H(
136
137
  "div",
137
138
  {
138
- className: S(
139
+ className: F(
139
140
  s["iframe-button"],
140
- o && s["with-icon"],
141
+ r && s["with-icon"],
141
142
  a && s["full-width"],
142
- u && A[u]
143
+ u && V[u]
143
144
  ),
144
145
  "data-part": "iframe-button",
145
146
  children: [
146
- /* @__PURE__ */ _("span", { className: s.label, children: t }),
147
- e && /* @__PURE__ */ _(R, { className: S(s["loading-skeleton"]) }),
148
- /* @__PURE__ */ _(
147
+ /* @__PURE__ */ B("span", { className: s.label, children: t }),
148
+ e && /* @__PURE__ */ B(W, { className: F(s["loading-skeleton"]) }),
149
+ /* @__PURE__ */ B(
149
150
  "iframe",
150
151
  {
151
152
  ref: d,
152
- className: S(s.iframe, e ? s.hidden : void 0, n),
153
- ...i
153
+ className: F(s.iframe, e ? s.hidden : void 0, o),
154
+ ...l
154
155
  }
155
156
  ),
156
- !B && /* @__PURE__ */ _("div", { ref: p, className: s["computed-style"], children: /* @__PURE__ */ _("canvas", { ref: h }) })
157
+ !h && /* @__PURE__ */ B("div", { ref: p, className: s["computed-style"], children: /* @__PURE__ */ B("canvas", { ref: x }) })
157
158
  ]
158
159
  }
159
160
  );
160
161
  }
161
162
  );
162
- M.displayName = "IframeButton";
163
+ D.displayName = "IframeButton";
163
164
  export {
164
- M as IframeButton
165
+ D as IframeButton
165
166
  };
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const VERSION = "0.0.72";
1
+ export declare const VERSION = "0.0.73";
package/dist/version.js CHANGED
@@ -1,4 +1,4 @@
1
- const o = "0.0.72";
1
+ const o = "0.0.73";
2
2
  export {
3
3
  o as VERSION
4
4
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coinbase/cdp-react",
3
- "version": "0.0.72",
3
+ "version": "0.0.73",
4
4
  "type": "module",
5
5
  "dependencies": {
6
6
  "@internationalized/number": "3.6.4",
@@ -15,8 +15,8 @@
15
15
  },
16
16
  "peerDependencies": {
17
17
  "react": ">=18.2.0 <19.2.0",
18
- "@coinbase/cdp-core": "^0.0.72",
19
- "@coinbase/cdp-hooks": "^0.0.72"
18
+ "@coinbase/cdp-core": "^0.0.73",
19
+ "@coinbase/cdp-hooks": "^0.0.73"
20
20
  },
21
21
  "devDependencies": {
22
22
  "@size-limit/preset-big-lib": "^11.2.0",
@@ -47,8 +47,8 @@
47
47
  "vite": "^7.0.4",
48
48
  "vite-plugin-dts": "^4.5.4",
49
49
  "vite-plugin-lib-inject-css": "^2.2.2",
50
- "@coinbase/cdp-core": "^0.0.72",
51
- "@coinbase/cdp-hooks": "^0.0.72"
50
+ "@coinbase/cdp-core": "^0.0.73",
51
+ "@coinbase/cdp-hooks": "^0.0.73"
52
52
  },
53
53
  "size-limit": [
54
54
  {