@sproutsocial/seeds-react-theme 3.6.2 → 4.1.0

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 (42) hide show
  1. package/README.md +199 -0
  2. package/commonjs/builders/buildCSS.js +202 -0
  3. package/commonjs/builders/buildTailwindV4.js +238 -0
  4. package/commonjs/builders/index.js +65 -0
  5. package/commonjs/builders/utils.js +225 -0
  6. package/commonjs/dark/theme.js +48 -3
  7. package/commonjs/light/theme.js +56 -3
  8. package/dist/tailwind-preset.css +118 -0
  9. package/dist/theme-all.css +961 -0
  10. package/dist/theme-dark.css +480 -0
  11. package/dist/theme.css +480 -0
  12. package/dist/themes/dark/_themed.scss +7 -0
  13. package/dist/themes/dark/theme.scss +94 -6
  14. package/dist/themes/extendedThemes/sproutTheme/dark/_themed.scss +7 -0
  15. package/dist/themes/extendedThemes/sproutTheme/dark/theme.scss +47 -3
  16. package/dist/themes/extendedThemes/sproutTheme/light/_themed.scss +7 -0
  17. package/dist/themes/extendedThemes/sproutTheme/light/theme.scss +47 -3
  18. package/dist/themes/light/_themed.scss +7 -0
  19. package/dist/themes/light/theme.scss +94 -6
  20. package/dist/themes/types/_themed.scss +7 -0
  21. package/dist/types/builders/buildCSS.d.ts +8 -0
  22. package/dist/types/builders/buildCSS.d.ts.map +1 -0
  23. package/dist/types/builders/buildTailwindV4.d.ts +18 -0
  24. package/dist/types/builders/buildTailwindV4.d.ts.map +1 -0
  25. package/dist/types/builders/index.d.ts +10 -0
  26. package/dist/types/builders/index.d.ts.map +1 -0
  27. package/dist/types/builders/utils.d.ts +53 -0
  28. package/dist/types/builders/utils.d.ts.map +1 -0
  29. package/dist/types/dark/theme.d.ts +88 -0
  30. package/dist/types/dark/theme.d.ts.map +1 -1
  31. package/dist/types/light/theme.d.ts +88 -0
  32. package/dist/types/light/theme.d.ts.map +1 -1
  33. package/dist/types/types/theme.colors.d.ts +1 -0
  34. package/dist/types/types/theme.colors.d.ts.map +1 -1
  35. package/lib/builders/buildCSS.js +200 -0
  36. package/lib/builders/buildTailwindV4.js +233 -0
  37. package/lib/builders/index.js +37 -0
  38. package/lib/builders/utils.js +209 -0
  39. package/lib/dark/theme.js +48 -3
  40. package/lib/light/theme.js +56 -3
  41. package/package.json +24 -2
  42. package/tailwind-preset.js +199 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sproutsocial/seeds-react-theme",
3
- "version": "3.6.2",
3
+ "version": "4.1.0",
4
4
  "description": "Seeds Theme",
5
5
  "main": "commonjs/index.js",
6
6
  "module": "lib/index.js",
@@ -10,11 +10,25 @@
10
10
  "files": [
11
11
  "commonjs",
12
12
  "dist",
13
- "lib"
13
+ "lib",
14
+ "tailwind-preset.js"
14
15
  ],
16
+ "exports": {
17
+ ".": {
18
+ "import": "./lib/index.js",
19
+ "require": "./commonjs/index.js",
20
+ "types": "./dist/types/index.d.ts"
21
+ },
22
+ "./tailwind-preset": "./tailwind-preset.js",
23
+ "./css/theme": "./dist/theme.css",
24
+ "./css/theme-dark": "./dist/theme-dark.css",
25
+ "./css/theme-all": "./dist/theme-all.css",
26
+ "./css/tailwind-preset": "./dist/tailwind-preset.css"
27
+ },
15
28
  "scripts": {
16
29
  "build": "yarn build:ts-declarations && tsx buildScript.ts",
17
30
  "build:ts-declarations": "tsc --project tsconfig.build.json && tsc-alias -p tsconfig.build.json",
31
+ "build:css": "tsx src/builders/buildCSS.ts",
18
32
  "clean": "rm -rf .turbo dist lib commonjs __flow__",
19
33
  "clean:modules": "rm -rf node_modules",
20
34
  "typecheck": "tsc --noEmit"
@@ -37,6 +51,14 @@
37
51
  "@sproutsocial/seeds-tsconfig": "*",
38
52
  "tsc-alias": "^1.8.11"
39
53
  },
54
+ "peerDependencies": {
55
+ "tailwindcss": ">=3.0.0 || >=4.0.0"
56
+ },
57
+ "peerDependenciesMeta": {
58
+ "tailwindcss": {
59
+ "optional": true
60
+ }
61
+ },
40
62
  "engines": {
41
63
  "node": ">=18"
42
64
  }
@@ -0,0 +1,199 @@
1
+ /**
2
+ * Seeds Design System — Tailwind CSS Preset
3
+ *
4
+ * Usage:
5
+ * // tailwind.config.js
6
+ * module.exports = {
7
+ * presets: [require('@sproutsocial/seeds-react-theme/tailwind-preset')],
8
+ * content: ['./src/**\/*.{html,ts,tsx,jsx}'],
9
+ * };
10
+ *
11
+ * All values are sourced from Seeds token packages — no hardcoded values.
12
+ * Colors use static token values so dark mode is handled via Tailwind's
13
+ * built-in `dark:` variant (darkMode: 'class'). No runtime CSS variable
14
+ * dependency required for button/color tokens.
15
+ *
16
+ * Non-button tokens (app, container, text, form) still reference CSS custom
17
+ * properties and require loading theme-all.css for dark mode to work.
18
+ * These can be migrated to static token values + `dark:` classes over time.
19
+ */
20
+
21
+ const COLORS = require("@sproutsocial/seeds-color");
22
+ const SPACE = require("@sproutsocial/seeds-space");
23
+ const BORDER = require("@sproutsocial/seeds-border");
24
+ const TYPOGRAPHY = require("@sproutsocial/seeds-typography");
25
+
26
+ /** @type {import('tailwindcss').Config} */
27
+ module.exports = {
28
+ theme: {
29
+ extend: {
30
+ // -----------------------------------------------------------------------
31
+ // Spacing — from @sproutsocial/seeds-space
32
+ // Usage: p-300, m-400, gap-500, w-600, etc.
33
+ // -----------------------------------------------------------------------
34
+ spacing: {
35
+ 0: SPACE.SPACE_SIZE_0, // 0px
36
+ 100: SPACE.SPACE_SIZE_100, // 2px
37
+ 200: SPACE.SPACE_SIZE_200, // 4px
38
+ 300: SPACE.SPACE_SIZE_300, // 8px
39
+ 350: SPACE.SPACE_SIZE_350, // 12px
40
+ 400: SPACE.SPACE_SIZE_400, // 16px
41
+ 450: SPACE.SPACE_SIZE_450, // 24px
42
+ 500: SPACE.SPACE_SIZE_500, // 32px
43
+ 600: SPACE.SPACE_SIZE_600, // 40px
44
+ },
45
+
46
+ // -----------------------------------------------------------------------
47
+ // Border radius — from @sproutsocial/seeds-border
48
+ // Usage: rounded-400, rounded-500, rounded-pill, etc.
49
+ // -----------------------------------------------------------------------
50
+ // -----------------------------------------------------------------------
51
+ // Font size — from @sproutsocial/seeds-typography
52
+ // Usage: text-200, text-300, text-400, etc.
53
+ // -----------------------------------------------------------------------
54
+ fontSize: {
55
+ 100: [
56
+ TYPOGRAPHY.TYPOGRAPHY_SIZE_100.fontSize,
57
+ { lineHeight: TYPOGRAPHY.TYPOGRAPHY_SIZE_100.lineHeight },
58
+ ],
59
+ 200: [
60
+ TYPOGRAPHY.TYPOGRAPHY_SIZE_200.fontSize,
61
+ { lineHeight: TYPOGRAPHY.TYPOGRAPHY_SIZE_200.lineHeight },
62
+ ],
63
+ 300: [
64
+ TYPOGRAPHY.TYPOGRAPHY_SIZE_300.fontSize,
65
+ { lineHeight: TYPOGRAPHY.TYPOGRAPHY_SIZE_300.lineHeight },
66
+ ],
67
+ 400: [
68
+ TYPOGRAPHY.TYPOGRAPHY_SIZE_400.fontSize,
69
+ { lineHeight: TYPOGRAPHY.TYPOGRAPHY_SIZE_400.lineHeight },
70
+ ],
71
+ 500: [
72
+ TYPOGRAPHY.TYPOGRAPHY_SIZE_500.fontSize,
73
+ { lineHeight: TYPOGRAPHY.TYPOGRAPHY_SIZE_500.lineHeight },
74
+ ],
75
+ 600: [
76
+ TYPOGRAPHY.TYPOGRAPHY_SIZE_600.fontSize,
77
+ { lineHeight: TYPOGRAPHY.TYPOGRAPHY_SIZE_600.lineHeight },
78
+ ],
79
+ 700: [
80
+ TYPOGRAPHY.TYPOGRAPHY_SIZE_700.fontSize,
81
+ { lineHeight: TYPOGRAPHY.TYPOGRAPHY_SIZE_700.lineHeight },
82
+ ],
83
+ },
84
+
85
+ borderRadius: {
86
+ 400: BORDER.BORDER_RADIUS_400, // 4px
87
+ 500: BORDER.BORDER_RADIUS_500, // 6px
88
+ 600: BORDER.BORDER_RADIUS_600, // 8px
89
+ 800: BORDER.BORDER_RADIUS_800, // 12px
90
+ 900: BORDER.BORDER_RADIUS_900, // 24px
91
+ 1000: BORDER.BORDER_RADIUS_1000, // 999999px
92
+ pill: "999999px",
93
+ inner: "4px",
94
+ outer: "8px",
95
+ },
96
+
97
+ colors: {
98
+ // ---------------------------------------------------------------------
99
+ // Button tokens — from @sproutsocial/seeds-color
100
+ //
101
+ // Light mode values used by default; dark mode via `dark:` variant:
102
+ // <button class="bg-button-primary-bg-base dark:bg-button-primary-bg-base-dark">
103
+ // ---------------------------------------------------------------------
104
+
105
+ // Primary
106
+ "button-primary-bg-base": COLORS.COLOR_BLUE_700,
107
+ "button-primary-bg-hover": COLORS.COLOR_BLUE_800,
108
+ "button-primary-bg-active": COLORS.COLOR_BLUE_900,
109
+ "button-primary-text-base": COLORS.COLOR_NEUTRAL_0,
110
+ "button-primary-text-hover": COLORS.COLOR_NEUTRAL_0,
111
+ "button-primary-border-base": "transparent",
112
+ // dark
113
+ "button-primary-bg-base-dark": COLORS.COLOR_BLUE_400,
114
+ "button-primary-bg-hover-dark": COLORS.COLOR_BLUE_300,
115
+ "button-primary-bg-active-dark": COLORS.COLOR_BLUE_200,
116
+ "button-primary-text-base-dark": COLORS.COLOR_NEUTRAL_900,
117
+ "button-primary-text-hover-dark": COLORS.COLOR_NEUTRAL_1000,
118
+
119
+ // Secondary
120
+ "button-secondary-bg-base": "transparent",
121
+ "button-secondary-bg-hover": COLORS.COLOR_NEUTRAL_800,
122
+ "button-secondary-bg-active": COLORS.COLOR_NEUTRAL_900,
123
+ "button-secondary-text-base": COLORS.COLOR_NEUTRAL_800,
124
+ "button-secondary-text-hover": COLORS.COLOR_NEUTRAL_0,
125
+ "button-secondary-border-base": COLORS.COLOR_NEUTRAL_800,
126
+ // dark
127
+ "button-secondary-bg-hover-dark": COLORS.COLOR_NEUTRAL_100,
128
+ "button-secondary-bg-active-dark": COLORS.COLOR_NEUTRAL_0,
129
+ "button-secondary-text-base-dark": COLORS.COLOR_NEUTRAL_0,
130
+ "button-secondary-text-hover-dark": COLORS.COLOR_NEUTRAL_800,
131
+ "button-secondary-border-base-dark": COLORS.COLOR_NEUTRAL_0,
132
+
133
+ // Destructive
134
+ "button-destructive-bg-base": COLORS.COLOR_RED_800,
135
+ "button-destructive-bg-hover": COLORS.COLOR_RED_900,
136
+ "button-destructive-bg-active": COLORS.COLOR_RED_1000,
137
+ "button-destructive-text-base": COLORS.COLOR_NEUTRAL_0,
138
+ "button-destructive-text-hover": COLORS.COLOR_NEUTRAL_0,
139
+ "button-destructive-border-base": "transparent",
140
+ // dark
141
+ "button-destructive-bg-base-dark": COLORS.COLOR_RED_400,
142
+ "button-destructive-bg-hover-dark": COLORS.COLOR_RED_300,
143
+ "button-destructive-bg-active-dark": COLORS.COLOR_RED_200,
144
+ "button-destructive-text-base-dark": COLORS.COLOR_NEUTRAL_900,
145
+ "button-destructive-text-hover-dark": COLORS.COLOR_NEUTRAL_1000,
146
+
147
+ // Placeholder
148
+ "button-placeholder-bg-base": "transparent",
149
+ "button-placeholder-bg-hover": COLORS.COLOR_NEUTRAL_0,
150
+ "button-placeholder-bg-active": COLORS.COLOR_NEUTRAL_0,
151
+ "button-placeholder-text-base": COLORS.COLOR_BLUE_700,
152
+ "button-placeholder-text-hover": COLORS.COLOR_BLUE_800,
153
+ "button-placeholder-border-base": COLORS.COLOR_NEUTRAL_500,
154
+ // dark
155
+ "button-placeholder-bg-hover-dark": COLORS.COLOR_NEUTRAL_1100,
156
+ "button-placeholder-bg-active-dark": COLORS.COLOR_NEUTRAL_1100,
157
+ "button-placeholder-text-base-dark": COLORS.COLOR_BLUE_400,
158
+ "button-placeholder-text-hover-dark": COLORS.COLOR_BLUE_300,
159
+
160
+ // ---------------------------------------------------------------------
161
+ // Remaining tokens — CSS variable approach
162
+ //
163
+ // These reference CSS custom properties and require loading theme-all.css.
164
+ // Migrate to static token values + `dark:` classes over time.
165
+ // These are intentionally kept for now to compare the pros and cons
166
+ // ---------------------------------------------------------------------
167
+
168
+ // App
169
+ "app-bg-base": "var(--color-app-bg-base)",
170
+
171
+ // Container
172
+ "container-bg-base": "var(--color-container-bg-base)",
173
+ "container-bg-success": "var(--color-container-bg-success)",
174
+ "container-bg-warning": "var(--color-container-bg-warning)",
175
+ "container-bg-error": "var(--color-container-bg-error)",
176
+ "container-bg-info": "var(--color-container-bg-info)",
177
+ "container-bg-opportunity": "var(--color-container-bg-opportunity)",
178
+ "container-border-base": "var(--color-container-border-base)",
179
+ "container-border-success": "var(--color-container-border-success)",
180
+ "container-border-warning": "var(--color-container-border-warning)",
181
+ "container-border-error": "var(--color-container-border-error)",
182
+ "container-border-info": "var(--color-container-border-info)",
183
+ "container-border-opportunity":
184
+ "var(--color-container-border-opportunity)",
185
+
186
+ // Text
187
+ "text-body": "var(--color-text-body)",
188
+ "text-headline": "var(--color-text-headline)",
189
+ "text-subtext": "var(--color-text-subtext)",
190
+
191
+ // Form
192
+ "form-bg-base": "var(--color-form-bg-base)",
193
+ "form-border-base": "var(--color-form-border-base)",
194
+ "form-border-selected": "var(--color-form-border-selected)",
195
+ "form-placeholder-base": "var(--color-form-placeholder-base)",
196
+ },
197
+ },
198
+ },
199
+ };