@foundrykit/tailwind 0.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 (3) hide show
  1. package/README.md +351 -0
  2. package/package.json +33 -0
  3. package/src/globals.css +138 -0
package/README.md ADDED
@@ -0,0 +1,351 @@
1
+ # @foundrykit/tailwind
2
+
3
+ Tailwind CSS configuration and theme setup for the FoundryKit design system. Provides consistent design tokens, utilities, and styling across all FoundryKit components.
4
+
5
+ ## Features
6
+
7
+ - **Design tokens** - Consistent colors, spacing, typography, and other design values
8
+ - **Component utilities** - Pre-built utility classes for common component patterns
9
+ - **Theme integration** - Seamless integration with your existing theme
10
+ - **CSS variables** - Modern CSS custom properties for dynamic theming
11
+ - **Tailwind v4** - Built for the latest Tailwind CSS version
12
+
13
+ ## Installation
14
+
15
+ ```bash
16
+ pnpm add @foundrykit/tailwind
17
+ ```
18
+
19
+ ## Quick Start
20
+
21
+ ### 1. Import the CSS
22
+
23
+ In your main CSS file (e.g., `globals.css`):
24
+
25
+ ```css
26
+ @import "@foundrykit/tailwind/globals.css";
27
+ ```
28
+
29
+ ### 2. Use in Components
30
+
31
+ ```tsx
32
+ import { Button } from '@foundrykit/primitives/button'
33
+
34
+ function MyComponent() {
35
+ return (
36
+ <Button className="bg-primary text-primary-foreground hover:bg-primary/90">
37
+ Click me
38
+ </Button>
39
+ )
40
+ }
41
+ ```
42
+
43
+ ## Design Tokens
44
+
45
+ ### Colors
46
+
47
+ The package provides a comprehensive color system:
48
+
49
+ ```css
50
+ /* Primary colors */
51
+ --color-primary: 222.2 84% 4.9%;
52
+ --color-primary-foreground: 210 40% 98%;
53
+
54
+ /* Secondary colors */
55
+ --color-secondary: 210 40% 96%;
56
+ --color-secondary-foreground: 222.2 84% 4.9%;
57
+
58
+ /* Accent colors */
59
+ --color-accent: 210 40% 96%;
60
+ --color-accent-foreground: 222.2 84% 4.9%;
61
+
62
+ /* Semantic colors */
63
+ --color-destructive: 0 84.2% 60.2%;
64
+ --color-destructive-foreground: 210 40% 98%;
65
+ --color-muted: 210 40% 96%;
66
+ --color-muted-foreground: 215.4 16.3% 46.9%;
67
+ --color-border: 214.3 31.8% 91.4%;
68
+ --color-input: 214.3 31.8% 91.4%;
69
+ --color-ring: 222.2 84% 4.9%;
70
+ --color-background: 0 0% 100%;
71
+ --color-foreground: 222.2 84% 4.9%;
72
+ ```
73
+
74
+ ### Spacing
75
+
76
+ Consistent spacing scale:
77
+
78
+ ```css
79
+ --spacing-0: 0px;
80
+ --spacing-1: 0.25rem;
81
+ --spacing-2: 0.5rem;
82
+ --spacing-3: 0.75rem;
83
+ --spacing-4: 1rem;
84
+ --spacing-5: 1.25rem;
85
+ --spacing-6: 1.5rem;
86
+ --spacing-8: 2rem;
87
+ --spacing-10: 2.5rem;
88
+ --spacing-12: 3rem;
89
+ --spacing-16: 4rem;
90
+ --spacing-20: 5rem;
91
+ --spacing-24: 6rem;
92
+ --spacing-32: 8rem;
93
+ --spacing-40: 10rem;
94
+ --spacing-48: 12rem;
95
+ --spacing-56: 14rem;
96
+ --spacing-64: 16rem;
97
+ ```
98
+
99
+ ### Typography
100
+
101
+ Typography tokens for consistent text styling:
102
+
103
+ ```css
104
+ /* Font families */
105
+ --font-sans: ui-sans-serif, system-ui, sans-serif;
106
+ --font-serif: ui-serif, Georgia, serif;
107
+ --font-mono: ui-monospace, SFMono-Regular, monospace;
108
+
109
+ /* Font sizes */
110
+ --font-size-xs: 0.75rem;
111
+ --font-size-sm: 0.875rem;
112
+ --font-size-base: 1rem;
113
+ --font-size-lg: 1.125rem;
114
+ --font-size-xl: 1.25rem;
115
+ --font-size-2xl: 1.5rem;
116
+ --font-size-3xl: 1.875rem;
117
+ --font-size-4xl: 2.25rem;
118
+ --font-size-5xl: 3rem;
119
+ --font-size-6xl: 3.75rem;
120
+
121
+ /* Font weights */
122
+ --font-weight-thin: 100;
123
+ --font-weight-extralight: 200;
124
+ --font-weight-light: 300;
125
+ --font-weight-normal: 400;
126
+ --font-weight-medium: 500;
127
+ --font-weight-semibold: 600;
128
+ --font-weight-bold: 700;
129
+ --font-weight-extrabold: 800;
130
+ --font-weight-black: 900;
131
+ ```
132
+
133
+ ### Border Radius
134
+
135
+ Consistent border radius values:
136
+
137
+ ```css
138
+ --radius-none: 0px;
139
+ --radius-sm: 0.125rem;
140
+ --radius-base: 0.25rem;
141
+ --radius-md: 0.375rem;
142
+ --radius-lg: 0.5rem;
143
+ --radius-xl: 0.75rem;
144
+ --radius-2xl: 1rem;
145
+ --radius-3xl: 1.5rem;
146
+ --radius-full: 9999px;
147
+ ```
148
+
149
+ ## Usage
150
+
151
+ ### Basic Styling
152
+
153
+ ```tsx
154
+ import { Button } from '@foundrykit/primitives/button'
155
+
156
+ function StyledButton() {
157
+ return (
158
+ <Button className="
159
+ bg-primary text-primary-foreground
160
+ hover:bg-primary/90
161
+ px-4 py-2 rounded-md
162
+ font-medium transition-colors
163
+ ">
164
+ Styled Button
165
+ </Button>
166
+ )
167
+ }
168
+ ```
169
+
170
+ ### Using Design Tokens
171
+
172
+ ```tsx
173
+ function Card() {
174
+ return (
175
+ <div className="
176
+ bg-background text-foreground
177
+ border border-border rounded-lg
178
+ p-6 shadow-sm
179
+ ">
180
+ <h3 className="text-lg font-semibold mb-2">Card Title</h3>
181
+ <p className="text-muted-foreground">Card content goes here</p>
182
+ </div>
183
+ )
184
+ }
185
+ ```
186
+
187
+ ### Responsive Design
188
+
189
+ ```tsx
190
+ function ResponsiveComponent() {
191
+ return (
192
+ <div className="
193
+ grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3
194
+ gap-4 md:gap-6 lg:gap-8
195
+ p-4 md:p-6 lg:p-8
196
+ ">
197
+ {/* Content */}
198
+ </div>
199
+ )
200
+ }
201
+ ```
202
+
203
+ ### Dark Mode Support
204
+
205
+ ```tsx
206
+ function ThemeAwareComponent() {
207
+ return (
208
+ <div className="
209
+ bg-background text-foreground
210
+ dark:bg-background dark:text-foreground
211
+ border border-border dark:border-border
212
+ ">
213
+ <p className="text-muted-foreground dark:text-muted-foreground">
214
+ This component adapts to light and dark themes
215
+ </p>
216
+ </div>
217
+ )
218
+ }
219
+ ```
220
+
221
+ ## Customization
222
+
223
+ ### Extending the Theme
224
+
225
+ Create your own `globals.css` to extend the theme:
226
+
227
+ ```css
228
+ @import "@foundrykit/tailwind/globals.css";
229
+
230
+ /* Custom design tokens */
231
+ :root {
232
+ --color-brand: 220 14% 96%;
233
+ --color-brand-foreground: 220 9% 46%;
234
+
235
+ --font-size-custom: 1.1rem;
236
+ --spacing-custom: 1.75rem;
237
+ }
238
+
239
+ /* Custom utilities */
240
+ @utility custom-button {
241
+ @apply bg-brand text-brand-foreground px-custom py-2 rounded-md;
242
+ }
243
+ ```
244
+
245
+ ### Component-Specific Styles
246
+
247
+ ```css
248
+ /* Custom component styles */
249
+ @utility button-primary {
250
+ @apply bg-primary text-primary-foreground hover:bg-primary/90;
251
+ }
252
+
253
+ @utility button-secondary {
254
+ @apply bg-secondary text-secondary-foreground hover:bg-secondary/80;
255
+ }
256
+
257
+ @utility card-elevated {
258
+ @apply bg-background border border-border rounded-lg shadow-lg;
259
+ }
260
+ ```
261
+
262
+ ### Custom Color Palette
263
+
264
+ ```css
265
+ /* Define custom colors */
266
+ :root {
267
+ --color-custom-blue: 221 83% 53%;
268
+ --color-custom-green: 142 76% 36%;
269
+ --color-custom-purple: 262 83% 58%;
270
+ }
271
+
272
+ /* Use in components */
273
+ .custom-button {
274
+ background-color: hsl(var(--color-custom-blue));
275
+ color: white;
276
+ }
277
+ ```
278
+
279
+ ## Integration with Frameworks
280
+
281
+ ### Next.js
282
+
283
+ In your `app/globals.css`:
284
+
285
+ ```css
286
+ @import "@foundrykit/tailwind/globals.css";
287
+
288
+ /* Your custom styles */
289
+ ```
290
+
291
+ ### React (Vite)
292
+
293
+ In your `src/index.css`:
294
+
295
+ ```css
296
+ @import "@foundrykit/tailwind/globals.css";
297
+
298
+ /* Your custom styles */
299
+ ```
300
+
301
+ ### Vue
302
+
303
+ In your `src/assets/main.css`:
304
+
305
+ ```css
306
+ @import "@foundrykit/tailwind/globals.css";
307
+
308
+ /* Your custom styles */
309
+ ```
310
+
311
+ ## Performance
312
+
313
+ ### Optimized Bundle
314
+
315
+ - Tree-shakable CSS
316
+ - Minimal runtime overhead
317
+ - Efficient class generation
318
+ - Optimized for Tailwind v4
319
+
320
+ ### Best Practices
321
+
322
+ ```tsx
323
+ // ✅ Good - Use semantic class names
324
+ <div className="bg-background text-foreground p-4 rounded-lg">
325
+
326
+ // ❌ Avoid - Hard-coded values
327
+ <div className="bg-white text-black p-4 rounded-lg">
328
+ ```
329
+
330
+ ## Migration from Tailwind v3
331
+
332
+ If you're migrating from Tailwind v3:
333
+
334
+ 1. **Update imports** - Use the new CSS import syntax
335
+ 2. **Remove config files** - Tailwind v4 uses CSS-based configuration
336
+ 3. **Update class names** - Some utilities may have changed
337
+ 4. **Test thoroughly** - Verify all styles work as expected
338
+
339
+ ## Contributing
340
+
341
+ When contributing to the Tailwind package:
342
+
343
+ 1. Follow the design token naming conventions
344
+ 2. Ensure accessibility compliance
345
+ 3. Test with both light and dark themes
346
+ 4. Update this README
347
+ 5. Maintain backward compatibility
348
+
349
+ ## License
350
+
351
+ MIT
package/package.json ADDED
@@ -0,0 +1,33 @@
1
+ {
2
+ "name": "@foundrykit/tailwind",
3
+ "version": "0.1.0",
4
+ "type": "module",
5
+ "private": false,
6
+ "publishConfig": {
7
+ "access": "public"
8
+ },
9
+ "sideEffects": [
10
+ "**/*.css"
11
+ ],
12
+ "exports": {
13
+ "./globals.css": "./src/globals.css"
14
+ },
15
+ "dependencies": {
16
+ "tailwindcss": "^4.1.1",
17
+ "tw-animate-css": "^1.2.0"
18
+ },
19
+ "devDependencies": {
20
+ "eslint": "^9.0.0",
21
+ "@foundrykit/eslint-config": "0.1.0"
22
+ },
23
+ "peerDependencies": {
24
+ "tailwindcss": "^4.1.1",
25
+ "tw-animate-css": "^1.2.0"
26
+ },
27
+ "scripts": {
28
+ "build": "echo 'No build required for CSS package'",
29
+ "dev": "echo 'No dev build required for CSS package'",
30
+ "lint": "eslint . --max-warnings 0",
31
+ "type-check": "echo 'No TypeScript files to check'"
32
+ }
33
+ }
@@ -0,0 +1,138 @@
1
+ @import "tailwindcss";
2
+ @source "../../../apps/**/*.{ts,tsx}";
3
+ @source "../../../components/**/*.{ts,tsx}";
4
+ @source "../**/*.{ts,tsx}";
5
+
6
+ /* Scan every workspace package: primitives, blocks, components, etc. */
7
+ @source "../../*/{src,dist}/**/*.{ts,tsx,js,jsx,mjs,cjs}";
8
+
9
+ /* When consumed from npm: scan installed @foundrykit packages */
10
+ @source "../../../node_modules/@foundrykit/**/*.{ts,tsx,js,jsx,mjs,cjs}";
11
+
12
+ @import "tw-animate-css";
13
+
14
+ @custom-variant dark (&:is(.dark *));
15
+
16
+ :root {
17
+ --background: oklch(1 0 0);
18
+ --foreground: oklch(0.145 0 0);
19
+ --card: oklch(1 0 0);
20
+ --card-foreground: oklch(0.145 0 0);
21
+ --popover: oklch(1 0 0);
22
+ --popover-foreground: oklch(0.145 0 0);
23
+ --primary: oklch(0.205 0 0);
24
+ --primary-foreground: oklch(0.985 0 0);
25
+ --secondary: oklch(0.97 0 0);
26
+ --secondary-foreground: oklch(0.205 0 0);
27
+ --muted: oklch(0.97 0 0);
28
+ --muted-foreground: oklch(0.556 0 0);
29
+ --accent: oklch(0.97 0 0);
30
+ --accent-foreground: oklch(0.205 0 0);
31
+ --destructive: oklch(0.577 0.245 27.325);
32
+ --destructive-foreground: oklch(0.577 0.245 27.325);
33
+ --border: oklch(0.922 0 0);
34
+ --input: oklch(0.922 0 0);
35
+ --ring: oklch(0.708 0 0);
36
+ --chart-1: oklch(0.646 0.222 41.116);
37
+ --chart-2: oklch(0.6 0.118 184.704);
38
+ --chart-3: oklch(0.398 0.07 227.392);
39
+ --chart-4: oklch(0.828 0.189 84.429);
40
+ --chart-5: oklch(0.769 0.188 70.08);
41
+ --radius: 0.625rem;
42
+ --sidebar: oklch(0.985 0 0);
43
+ --sidebar-foreground: oklch(0.145 0 0);
44
+ --sidebar-primary: oklch(0.205 0 0);
45
+ --sidebar-primary-foreground: oklch(0.985 0 0);
46
+ --sidebar-accent: oklch(0.97 0 0);
47
+ --sidebar-accent-foreground: oklch(0.205 0 0);
48
+ --sidebar-border: oklch(0.922 0 0);
49
+ --sidebar-ring: oklch(0.708 0 0);
50
+ }
51
+
52
+ .dark {
53
+ --background: oklch(0.145 0 0);
54
+ --foreground: oklch(0.985 0 0);
55
+ --card: oklch(0.145 0 0);
56
+ --card-foreground: oklch(0.985 0 0);
57
+ --popover: oklch(0.145 0 0);
58
+ --popover-foreground: oklch(0.985 0 0);
59
+ --primary: oklch(0.985 0 0);
60
+ --primary-foreground: oklch(0.205 0 0);
61
+ --secondary: oklch(0.269 0 0);
62
+ --secondary-foreground: oklch(0.985 0 0);
63
+ --muted: oklch(0.269 0 0);
64
+ --muted-foreground: oklch(0.708 0 0);
65
+ --accent: oklch(0.269 0 0);
66
+ --accent-foreground: oklch(0.985 0 0);
67
+ --destructive: oklch(0.396 0.141 25.723);
68
+ --destructive-foreground: oklch(0.637 0.237 25.331);
69
+ --border: oklch(0.269 0 0);
70
+ --input: oklch(0.269 0 0);
71
+ --ring: oklch(0.556 0 0);
72
+ --chart-1: oklch(0.488 0.243 264.376);
73
+ --chart-2: oklch(0.696 0.17 162.48);
74
+ --chart-3: oklch(0.769 0.188 70.08);
75
+ --chart-4: oklch(0.627 0.265 303.9);
76
+ --chart-5: oklch(0.645 0.246 16.439);
77
+ --sidebar: oklch(0.205 0 0);
78
+ --sidebar-foreground: oklch(0.985 0 0);
79
+ --sidebar-primary: oklch(0.488 0.243 264.376);
80
+ --sidebar-primary-foreground: oklch(0.985 0 0);
81
+ --sidebar-accent: oklch(0.269 0 0);
82
+ --sidebar-accent-foreground: oklch(0.985 0 0);
83
+ --sidebar-border: oklch(0.269 0 0);
84
+ --sidebar-ring: oklch(0.439 0 0);
85
+ }
86
+
87
+ @theme inline {
88
+ --color-background: var(--background);
89
+ --color-foreground: var(--foreground);
90
+ --color-card: var(--card);
91
+ --color-card-foreground: var(--card-foreground);
92
+ --color-popover: var(--popover);
93
+ --color-popover-foreground: var(--popover-foreground);
94
+ --color-primary: var(--primary);
95
+ --color-primary-foreground: var(--primary-foreground);
96
+ --color-secondary: var(--secondary);
97
+ --color-secondary-foreground: var(--secondary-foreground);
98
+ --color-muted: var(--muted);
99
+ --color-muted-foreground: var(--muted-foreground);
100
+ --color-accent: var(--accent);
101
+ --color-accent-foreground: var(--accent-foreground);
102
+ --color-destructive: var(--destructive);
103
+ --color-destructive-foreground: var(--destructive-foreground);
104
+ --color-border: var(--border);
105
+ --color-input: var(--input);
106
+ --color-ring: var(--ring);
107
+ --color-chart-1: var(--chart-1);
108
+ --color-chart-2: var(--chart-2);
109
+ --color-chart-3: var(--chart-3);
110
+ --color-chart-4: var(--chart-4);
111
+ --color-chart-5: var(--chart-5);
112
+ --radius-sm: calc(var(--radius) - 4px);
113
+ --radius-md: calc(var(--radius) - 2px);
114
+ --radius-lg: var(--radius);
115
+ --radius-xl: calc(var(--radius) + 4px);
116
+ --color-sidebar: var(--sidebar);
117
+ --color-sidebar-foreground: var(--sidebar-foreground);
118
+ --color-sidebar-primary: var(--sidebar-primary);
119
+ --color-sidebar-primary-foreground: var(--sidebar-primary-foreground);
120
+ --color-sidebar-accent: var(--sidebar-accent);
121
+ --color-sidebar-accent-foreground: var(--sidebar-accent-foreground);
122
+ --color-sidebar-border: var(--sidebar-border);
123
+ --color-sidebar-ring: var(--sidebar-ring);
124
+ }
125
+
126
+ @layer base {
127
+ * {
128
+ @apply border-border outline-ring/50;
129
+ }
130
+ body {
131
+ @apply bg-background text-foreground;
132
+ }
133
+
134
+ button:not(:disabled),
135
+ [role='button']:not(:disabled) {
136
+ cursor: pointer;
137
+ }
138
+ }