@coinbase/cdp-react 0.0.11 → 0.0.13

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.
Files changed (46) hide show
  1. package/README.md +4 -4
  2. package/dist/assets/Button.css +1 -1
  3. package/dist/assets/Error.css +1 -1
  4. package/dist/assets/Field.css +1 -1
  5. package/dist/assets/Input.css +1 -1
  6. package/dist/assets/LoadingSkeleton.css +1 -1
  7. package/dist/assets/LoadingSpinner.css +1 -1
  8. package/dist/assets/OTP.css +1 -1
  9. package/dist/assets/SignIn.css +1 -1
  10. package/dist/assets/SignInDescription.css +1 -0
  11. package/dist/assets/SignInForm.css +1 -0
  12. package/dist/assets/SignInImage.css +1 -0
  13. package/dist/assets/SignInModal.css +1 -1
  14. package/dist/assets/SignInTitle.css +1 -0
  15. package/dist/assets/SignOutButton.css +1 -1
  16. package/dist/assets/VisuallyHidden.css +1 -1
  17. package/dist/components/AuthButton/index.d.ts +7 -1
  18. package/dist/components/AuthButton/index.js +51 -31
  19. package/dist/components/Button/index.js +38 -22
  20. package/dist/components/Field/index.js +11 -11
  21. package/dist/components/LoadingSpinner/index.js +7 -7
  22. package/dist/components/OTP/index.js +26 -25
  23. package/dist/components/SignIn/SignInDescription.js +20 -18
  24. package/dist/components/SignIn/SignInForm.js +111 -100
  25. package/dist/components/SignIn/SignInImage.js +13 -11
  26. package/dist/components/SignIn/SignInTitle.js +12 -11
  27. package/dist/components/SignIn/index.js +22 -21
  28. package/dist/components/SignInModal/index.js +30 -30
  29. package/dist/components/SignOutButton/index.js +8 -8
  30. package/dist/components/ThemeProvider/index.d.ts +1 -3
  31. package/dist/components/ThemeProvider/index.js +7 -7
  32. package/dist/components/VisuallyHidden/index.js +4 -4
  33. package/dist/icons/IconCoinbaseWordmark.js +5 -5
  34. package/dist/index.js +45 -39
  35. package/dist/theme/cssVariables.d.ts +5 -0
  36. package/dist/theme/cssVariables.js +10 -0
  37. package/dist/theme/index.d.ts +1 -0
  38. package/dist/theme/index.js +14 -8
  39. package/dist/theme/theme.d.ts +237 -33
  40. package/dist/theme/theme.js +3 -3
  41. package/dist/theme/tokens.d.ts +679 -45
  42. package/dist/theme/tokens.js +142 -43
  43. package/dist/theme/utils.d.ts +14 -2
  44. package/dist/theme/utils.js +23 -14
  45. package/package.json +9 -5
  46. package/dist/chunks/SignIn.module.Dl3CqKQ_.js +0 -20
@@ -14,51 +14,150 @@ const e = {
14
14
  // contextual
15
15
  red500: "#cf202f",
16
16
  green500: "#008531"
17
- }, r = {
18
- colors: {
19
- // Contextual
20
- error: e.red500,
21
- success: e.green500,
22
- // Background
23
- background: e.white,
24
- backgroundOverlay: "rgba(255,255,255,0.5)",
25
- backgroundSkeleton: e.gray100,
26
- // Foreground
27
- text: e.black,
28
- textSecondary: e.gray700,
29
- // Primary action
30
- primary: e.blue500,
31
- primaryText: e.white,
32
- primaryHoverBackground: e.blue550,
33
- primaryHoverText: e.white,
34
- primaryFocusRing: e.blue500,
35
- // Secondary action
36
- secondary: e.gray100,
37
- secondaryText: e.black,
38
- secondaryHoverBackground: e.gray200,
39
- secondaryHoverText: e.black,
40
- secondaryFocusRing: e.black,
41
- // Link
42
- linkText: e.blue500,
43
- linkHover: e.blue550,
44
- linkSecondaryText: e.black,
45
- linkSecondaryHover: e.gray700,
46
- // Borders and dividers
47
- border: e.gray200,
48
- // Input
49
- inputBackground: e.white,
50
- inputBorder: e.gray500,
51
- inputFocusBorder: e.blue500,
52
- inputLabel: e.black,
53
- inputPlaceholder: e.gray700,
54
- inputText: e.black
17
+ }, a = {
18
+ bg: {
19
+ default: { value: e.white },
20
+ // background
21
+ alternate: { value: e.gray100 },
22
+ // alternate background
23
+ overlay: { value: "{colors.bg.alternate}", modify: { type: "alpha", value: 0.33 } },
24
+ // overlay background
25
+ skeleton: { value: "{colors.fg.default}", modify: { type: "alpha", value: 0.1 } },
26
+ // skeleton background
27
+ primary: { value: e.blue500 },
28
+ // primary color background
29
+ secondary: { value: e.gray100 }
30
+ // secondary color background
31
+ },
32
+ fg: {
33
+ default: { value: e.black },
34
+ // text
35
+ muted: { value: e.gray700 },
36
+ // secondary (muted) text
37
+ primary: { value: e.blue500 },
38
+ // primary color text
39
+ onPrimary: { value: e.white },
40
+ // text on primary color
41
+ onSecondary: { value: e.black },
42
+ // text on secondary color
43
+ positive: { value: e.green500 },
44
+ // positive color text
45
+ negative: { value: e.red500 }
46
+ // negative color text
47
+ },
48
+ line: {
49
+ default: { value: e.gray200 },
50
+ // line color
51
+ heavy: { value: e.gray500 },
52
+ // higher contrast line color
53
+ primary: { value: "{colors.fg.primary}" },
54
+ // primary line color
55
+ positive: { value: "{colors.fg.positive}" },
56
+ // positive line color
57
+ negative: { value: "{colors.fg.negative}" }
58
+ // negative line color
59
+ }
60
+ }, l = {
61
+ page: {
62
+ bg: {
63
+ default: { value: "{colors.bg.default}" }
64
+ },
65
+ border: {
66
+ default: { value: "{colors.line.default}" }
67
+ },
68
+ text: {
69
+ default: { value: "{colors.fg.default}" },
70
+ muted: { value: "{colors.fg.muted}" }
71
+ }
55
72
  },
56
- fontFamily: {
57
- sans: '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"'
73
+ cta: {
74
+ primary: {
75
+ bg: {
76
+ default: { value: "{colors.bg.primary}" },
77
+ hover: { value: "{colors.bg.primary}", modify: { type: "alpha", value: "0.9" } }
78
+ },
79
+ border: {
80
+ focus: { value: "{colors.line.primary}" }
81
+ },
82
+ text: {
83
+ default: { value: "{colors.fg.onPrimary}" },
84
+ hover: { value: "{colors.fg.onPrimary}" }
85
+ }
86
+ },
87
+ secondary: {
88
+ bg: {
89
+ default: { value: "{colors.bg.secondary}" },
90
+ hover: {
91
+ value: "{colors.bg.secondary}",
92
+ modify: { type: "alpha", value: "0.9" }
93
+ }
94
+ },
95
+ border: {
96
+ focus: { value: "{colors.line.primary}" }
97
+ },
98
+ text: {
99
+ default: { value: "{colors.fg.onSecondary}" },
100
+ hover: { value: "{colors.fg.onSecondary}" }
101
+ }
102
+ }
103
+ },
104
+ link: {
105
+ primary: {
106
+ text: {
107
+ default: { value: "{colors.fg.primary}" },
108
+ hover: { value: "{colors.fg.primary}", modify: { type: "alpha", value: "0.9" } }
109
+ }
110
+ },
111
+ secondary: {
112
+ text: {
113
+ default: { value: "{colors.fg.default}" },
114
+ hover: { value: "{colors.fg.default}", modify: { type: "alpha", value: "0.9" } }
115
+ }
116
+ }
117
+ },
118
+ input: {
119
+ bg: {
120
+ default: { value: "{colors.bg.default}" }
121
+ },
122
+ border: {
123
+ default: { value: "{colors.line.heavy}" },
124
+ focus: { value: "{colors.line.primary}" },
125
+ error: { value: "{colors.line.negative}" }
126
+ },
127
+ label: {
128
+ default: { value: "{colors.fg.default}" }
129
+ },
130
+ placeholder: {
131
+ default: { value: "{colors.fg.muted}" }
132
+ },
133
+ text: {
134
+ default: { value: "{colors.fg.default}" }
135
+ },
136
+ errorText: {
137
+ default: { value: "{colors.fg.negative}" }
138
+ }
139
+ }
140
+ }, o = {
141
+ ...a,
142
+ ...l
143
+ }, r = {
144
+ family: {
145
+ sans: {
146
+ value: '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"'
147
+ }
58
148
  },
59
- fontSizeBase: 16
149
+ size: {
150
+ base: { value: 16 }
151
+ }
152
+ }, u = {
153
+ colors: o,
154
+ font: r
60
155
  };
61
156
  export {
62
- e as colors,
63
- r as tokens
157
+ o as colors,
158
+ e as colorsBase,
159
+ l as colorsComponents,
160
+ a as colorsSemantic,
161
+ r as font,
162
+ u as tokens
64
163
  };
@@ -1,10 +1,22 @@
1
1
  export type KebabCasePaths<T> = T extends Record<string, unknown> ? {
2
- [K in keyof T]: T[K] extends Record<string, unknown> ? `${K & string}-${KebabCasePaths<T[K]> & string}` : K & string;
2
+ [K in keyof T]: T[K] extends {
3
+ value: unknown;
4
+ } ? K & string : T[K] extends Record<string, unknown> ? `${K & string}-${KebabCasePaths<T[K]> & string}` : K & string;
3
5
  }[keyof T] : never;
4
6
  export type Flattened<T extends Record<string, unknown>> = {
5
7
  [K in KebabCasePaths<T>]: string;
6
8
  };
7
- export declare function flattenTokensObject<T extends Record<string, unknown>>(obj: T, path?: string[]): Flattened<T>;
9
+ export type TokenValue = {
10
+ value: string | number;
11
+ modify?: {
12
+ type: "alpha";
13
+ value: number | string;
14
+ };
15
+ };
16
+ export type NestedTokenObject = {
17
+ [key: string]: TokenValue | NestedTokenObject;
18
+ };
19
+ export declare function flattenTokensObject<T extends NestedTokenObject>(tokensObject: T, cssVarPrefix?: string): Flattened<T>;
8
20
  export declare const themeToCssVariables: (theme: Record<string, string>) => CDPWebCSSVariables;
9
21
  export type CDPWebCSSVariables = {
10
22
  [key: `--cdp-web-${string}`]: string;
@@ -1,18 +1,27 @@
1
- function i(n, r = []) {
2
- const t = {};
3
- for (const [s, e] of Object.entries(n)) {
4
- const o = [...r, s];
5
- if (typeof e == "object" && e !== null && !Array.isArray(e))
6
- Object.assign(t, i(e, o));
7
- else {
8
- const c = o.join("-");
9
- Array.isArray(e) ? t[c] = e.join(" ") : t[c] = typeof e == "number" ? `${e}px` : String(e);
10
- }
1
+ function f(e) {
2
+ return typeof e == "object" && e !== null && "value" in e && (typeof e.value == "string" || typeof e.value == "number");
3
+ }
4
+ function p(e, t = "cdp-web") {
5
+ const n = {};
6
+ function o(u, s) {
7
+ for (const l in u)
8
+ if (Object.prototype.hasOwnProperty.call(u, l)) {
9
+ const c = [...s, l], r = u[l];
10
+ if (f(r)) {
11
+ const i = c.join("-");
12
+ n[i] = a(r, t);
13
+ } else typeof r == "object" && r !== null && o(r, c);
14
+ }
11
15
  }
12
- return t;
16
+ return o(e, []), n;
13
17
  }
14
- const a = (n) => Object.entries(n).reduce((r, [t, s]) => (r[`--cdp-web-${t}`] = s, r), {});
18
+ const a = (e, t) => {
19
+ if (typeof e.value == "number")
20
+ return `${e.value}px`;
21
+ const n = e.value.startsWith("{") && e.value.endsWith("}") ? `var(--${t ? `${t}-` : ""}${e.value.slice(1, -1).replace(/\./g, "-")})` : e.value;
22
+ return e.modify?.type === "alpha" ? `color(from ${n} srgb r g b / ${e.modify.value ?? 1})` : n;
23
+ }, y = (e) => Object.entries(e).reduce((t, [n, o]) => (t[`--cdp-web-${n}`] = o, t), {});
15
24
  export {
16
- i as flattenTokensObject,
17
- a as themeToCssVariables
25
+ p as flattenTokensObject,
26
+ y as themeToCssVariables
18
27
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coinbase/cdp-react",
3
- "version": "0.0.11",
3
+ "version": "0.0.13",
4
4
  "type": "module",
5
5
  "dependencies": {
6
6
  "@radix-ui/react-dialog": "^1.1.14",
@@ -9,8 +9,8 @@
9
9
  },
10
10
  "peerDependencies": {
11
11
  "react": ">=18.2.0",
12
- "@coinbase/cdp-core": "^0.0.11",
13
- "@coinbase/cdp-hooks": "^0.0.11"
12
+ "@coinbase/cdp-hooks": "^0.0.13",
13
+ "@coinbase/cdp-core": "^0.0.13"
14
14
  },
15
15
  "devDependencies": {
16
16
  "@size-limit/preset-big-lib": "^11.2.0",
@@ -25,17 +25,21 @@
25
25
  "@types/react": "^19.1.0",
26
26
  "@types/react-dom": "^19.1.0",
27
27
  "@vitejs/plugin-react": "^4.6.0",
28
+ "eslint-plugin-css-modules": "^2.12.0",
28
29
  "eslint-plugin-react": "^7.37.5",
29
30
  "eslint-plugin-react-hooks": "^5.2.0",
30
31
  "glob": "^11.0.3",
31
32
  "react": "^19.1.0",
32
33
  "react-dom": "^19.1.0",
33
34
  "size-limit": "^11.2.0",
35
+ "stylelint": "^16.22.0",
36
+ "stylelint-config-standard": "^38.0.0",
37
+ "stylelint-value-no-unknown-custom-properties": "^6.0.1",
34
38
  "vite": "^7.0.4",
35
39
  "vite-plugin-dts": "^4.5.4",
36
40
  "vite-plugin-lib-inject-css": "^2.2.2",
37
- "@coinbase/cdp-core": "^0.0.11",
38
- "@coinbase/cdp-hooks": "^0.0.11"
41
+ "@coinbase/cdp-core": "^0.0.13",
42
+ "@coinbase/cdp-hooks": "^0.0.13"
39
43
  },
40
44
  "size-limit": [
41
45
  {
@@ -1,20 +0,0 @@
1
- import '../assets/SignIn.css';const n = "SignIn-module__signIn___cS7KU", _ = "SignIn-module__heading___nzF-H", o = "SignIn-module__description___6bRpF", e = "SignIn-module__medium___rfGKj", r = "SignIn-module__form___MXCq6", s = "SignIn-module__logo___9j5Y-", i = "SignIn-module__formFooter___Rasrs", c = "SignIn-module__serverStateWrapper___GML6w", t = "SignIn-module__loadingSpinner___JnMDX", m = "SignIn-module__serverError___p4Z3K", g = "SignIn-module__resetTimer___s-bUu", d = "SignIn-module__successIcon___2a7me", I = "SignIn-module__footer___3Gkbc", l = "SignIn-module__coinbaseIcon___cOnQb", u = "SignIn-module__hr___WFRgK", S = {
2
- signIn: n,
3
- heading: _,
4
- description: o,
5
- medium: e,
6
- form: r,
7
- logo: s,
8
- formFooter: i,
9
- serverStateWrapper: c,
10
- loadingSpinner: t,
11
- serverError: m,
12
- resetTimer: g,
13
- successIcon: d,
14
- footer: I,
15
- coinbaseIcon: l,
16
- hr: u
17
- };
18
- export {
19
- S as s
20
- };