@alkimi.org/ui-kit 0.1.15 → 0.1.16
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/README.github.md +131 -88
- package/README.md +131 -88
- package/README.npm.md +131 -88
- package/dist/components/button.d.mts +1 -1
- package/dist/components/button.d.ts +1 -1
- package/package.json +1 -1
package/README.github.md
CHANGED
|
@@ -10,15 +10,28 @@ npm install @alkimi.org/ui-kit
|
|
|
10
10
|
|
|
11
11
|
## Setup
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
You have **two setup options** depending on your needs:
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
- **Option A (Recommended)**: Import pre-compiled library styles - simpler setup, works immediately
|
|
16
|
+
- **Option B (Advanced)**: Manual styling with full control - requires more configuration
|
|
17
|
+
|
|
18
|
+
Choose the option that best fits your project requirements.
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
### Option A: Import Library Styles (Recommended)
|
|
23
|
+
|
|
24
|
+
**Best for**: Most projects. Simple setup with minimal configuration.
|
|
25
|
+
|
|
26
|
+
**What you get**: Pre-compiled utility classes (`rounded-lg`, `bg-primary`, etc.) + CSS variables + fonts
|
|
27
|
+
|
|
28
|
+
#### 1. Install Tailwind CSS v4
|
|
16
29
|
|
|
17
30
|
```bash
|
|
18
31
|
npm install -D tailwindcss@next @tailwindcss/postcss@next postcss autoprefixer
|
|
19
32
|
```
|
|
20
33
|
|
|
21
|
-
|
|
34
|
+
#### 2. Configure PostCSS
|
|
22
35
|
|
|
23
36
|
Create or update your `postcss.config.js`:
|
|
24
37
|
|
|
@@ -31,119 +44,149 @@ module.exports = {
|
|
|
31
44
|
}
|
|
32
45
|
```
|
|
33
46
|
|
|
34
|
-
|
|
47
|
+
#### 3. Import Library Styles
|
|
35
48
|
|
|
36
|
-
|
|
49
|
+
In your root layout file (e.g., `app/layout.tsx` for Next.js App Router):
|
|
37
50
|
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
content: [
|
|
42
|
-
// 👇 Scans YOUR project files for Tailwind classes
|
|
43
|
-
"./src/**/*.{js,jsx,ts,tsx}",
|
|
44
|
-
"./app/**/*.{js,jsx,ts,tsx}", // If using Next.js App Router
|
|
45
|
-
"./pages/**/*.{js,jsx,ts,tsx}", // If using Next.js Pages Router
|
|
46
|
-
"./components/**/*.{js,jsx,ts,tsx}",
|
|
47
|
-
|
|
48
|
-
// 👇 Scans the UI Kit's components for their Tailwind classes
|
|
49
|
-
// (Required for library components to be styled correctly)
|
|
50
|
-
"./node_modules/@alkimi.org/ui-kit/dist/**/*.{js,mjs}",
|
|
51
|
-
],
|
|
52
|
-
}
|
|
51
|
+
```tsx
|
|
52
|
+
import "@alkimi.org/ui-kit/styles.css"
|
|
53
|
+
import "./globals.css" // Your custom CSS
|
|
53
54
|
```
|
|
54
55
|
|
|
55
|
-
**Important**:
|
|
56
|
+
**Important**: Import the library styles **before** your custom CSS so you can override variables if needed.
|
|
56
57
|
|
|
57
|
-
|
|
58
|
+
#### 4. Configure Your CSS
|
|
58
59
|
|
|
59
|
-
Create
|
|
60
|
+
Create your `globals.css`:
|
|
60
61
|
|
|
61
62
|
```css
|
|
62
63
|
@import "tailwindcss";
|
|
64
|
+
|
|
65
|
+
/* Optional: Override library CSS variables */
|
|
66
|
+
:root {
|
|
67
|
+
/* Example: Custom primary color */
|
|
68
|
+
--primary: oklch(0.992 0.019 155.826);
|
|
69
|
+
--primary-foreground: oklch(0.205 0 0);
|
|
70
|
+
|
|
71
|
+
/* You can override any of these variables:
|
|
72
|
+
--secondary, --secondary-foreground
|
|
73
|
+
--background, --foreground
|
|
74
|
+
--muted, --muted-foreground
|
|
75
|
+
--accent, --accent-foreground
|
|
76
|
+
--destructive, --destructive-foreground
|
|
77
|
+
--border, --input, --ring
|
|
78
|
+
--radius (border radius)
|
|
79
|
+
*/
|
|
80
|
+
}
|
|
63
81
|
```
|
|
64
82
|
|
|
65
|
-
|
|
83
|
+
**That's it!** The library components will work immediately because:
|
|
66
84
|
|
|
67
|
-
|
|
85
|
+
- `styles.css` contains pre-compiled utility classes
|
|
86
|
+
- All CSS variables are defined
|
|
87
|
+
- Fonts are included
|
|
88
|
+
- **No `@source` directive needed** (utilities are already compiled into the CSS)
|
|
68
89
|
|
|
69
|
-
|
|
70
|
-
import "@alkimi.org/ui-kit/styles.css"
|
|
71
|
-
```
|
|
90
|
+
#### When to Use Option A
|
|
72
91
|
|
|
73
|
-
|
|
92
|
+
- You want the quickest setup
|
|
93
|
+
- You're happy with the library's default styling approach
|
|
94
|
+
- You want to customize colors via CSS variables
|
|
95
|
+
- You don't need complete control over Tailwind configuration
|
|
74
96
|
|
|
75
|
-
|
|
97
|
+
---
|
|
76
98
|
|
|
77
|
-
### Option
|
|
99
|
+
### Option B: Manual Styling (Advanced)
|
|
78
100
|
|
|
79
|
-
|
|
101
|
+
**Best for**: Advanced users who want complete control over CSS generation and Tailwind configuration.
|
|
80
102
|
|
|
81
|
-
|
|
82
|
-
/* In your app.css or globals.css */
|
|
83
|
-
@import "tailwindcss";
|
|
84
|
-
@import "@alkimi.org/ui-kit/styles.css";
|
|
103
|
+
**What you do**: Define all CSS variables yourself and use `@source` to dynamically generate utility classes.
|
|
85
104
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
*/
|
|
103
|
-
}
|
|
105
|
+
#### 1. Install Tailwind CSS v4
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
npm install -D tailwindcss@next @tailwindcss/postcss@next postcss autoprefixer
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
#### 2. Configure PostCSS
|
|
112
|
+
|
|
113
|
+
Create or update your `postcss.config.js`:
|
|
114
|
+
|
|
115
|
+
```js
|
|
116
|
+
module.exports = {
|
|
117
|
+
plugins: {
|
|
118
|
+
"@tailwindcss/postcss": {},
|
|
119
|
+
autoprefixer: {},
|
|
120
|
+
},
|
|
104
121
|
}
|
|
105
122
|
```
|
|
106
123
|
|
|
107
|
-
|
|
124
|
+
#### 3. Do NOT Import Library Styles
|
|
125
|
+
|
|
126
|
+
In your root layout file (e.g., `app/layout.tsx`):
|
|
127
|
+
|
|
128
|
+
```tsx
|
|
129
|
+
// ❌ Do NOT import library styles in Option B
|
|
130
|
+
// import "@alkimi.org/ui-kit/styles.css"
|
|
131
|
+
|
|
132
|
+
import "./globals.css" // Only import your custom CSS
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
#### 4. Configure Your CSS with @source
|
|
108
136
|
|
|
109
|
-
|
|
137
|
+
Create your `globals.css`:
|
|
110
138
|
|
|
111
139
|
```css
|
|
112
|
-
/* In your app.css or globals.css */
|
|
113
140
|
@import "tailwindcss";
|
|
114
141
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
142
|
+
/* REQUIRED: Tell Tailwind v4 to scan library components */
|
|
143
|
+
@source "../node_modules/@alkimi.org/ui-kit/dist/**/*.{js,mjs}";
|
|
144
|
+
|
|
145
|
+
/* REQUIRED: Define ALL CSS variables the library needs */
|
|
146
|
+
:root {
|
|
147
|
+
--background: oklch(0.992 0.019 155.826);
|
|
148
|
+
--foreground: oklch(0.205 0 0);
|
|
149
|
+
--card: oklch(0.992 0.019 155.826);
|
|
150
|
+
--card-foreground: oklch(0.205 0 0);
|
|
151
|
+
--popover: oklch(0.992 0.019 155.826);
|
|
152
|
+
--popover-foreground: oklch(0.205 0 0);
|
|
153
|
+
--primary: oklch(0.992 0.019 155.826);
|
|
154
|
+
--primary-foreground: oklch(0.205 0 0);
|
|
155
|
+
--secondary: oklch(0.269 0 0);
|
|
156
|
+
--secondary-foreground: oklch(0.992 0.019 155.826);
|
|
157
|
+
--muted: oklch(0.269 0 0);
|
|
158
|
+
--muted-foreground: oklch(0.608 0 0);
|
|
159
|
+
--accent: oklch(0.269 0 0);
|
|
160
|
+
--accent-foreground: oklch(0.992 0.019 155.826);
|
|
161
|
+
--destructive: oklch(0.576 0.214 25.467);
|
|
162
|
+
--destructive-foreground: oklch(0.992 0.019 155.826);
|
|
163
|
+
--border: #3f3f46;
|
|
164
|
+
--input: #3f3f46;
|
|
165
|
+
--ring: oklch(0.992 0.019 155.826);
|
|
166
|
+
--radius: 0.625rem;
|
|
167
|
+
--font-family: "Helvetica Now Display", "Helvetica", sans-serif;
|
|
168
|
+
}
|
|
139
169
|
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
}
|
|
170
|
+
body {
|
|
171
|
+
@apply bg-background text-foreground;
|
|
143
172
|
}
|
|
144
173
|
```
|
|
145
174
|
|
|
146
|
-
**
|
|
175
|
+
**Key points**:
|
|
176
|
+
|
|
177
|
+
- The `@source` directive tells Tailwind v4 to scan the library's component files
|
|
178
|
+
- Tailwind will dynamically generate utility classes for any classes used in those components
|
|
179
|
+
- You must define all CSS variables the library expects
|
|
180
|
+
- VS Code may show a warning for `@source` - you can safely ignore it (it's a valid Tailwind v4 directive)
|
|
181
|
+
|
|
182
|
+
#### When to Use Option B
|
|
183
|
+
|
|
184
|
+
- You want complete control over CSS generation
|
|
185
|
+
- You're customizing Tailwind's configuration extensively
|
|
186
|
+
- You want to manage all CSS variables manually
|
|
187
|
+
- You're comfortable with more advanced Tailwind v4 configuration
|
|
188
|
+
|
|
189
|
+
---
|
|
147
190
|
|
|
148
191
|
## Typography & Sizing
|
|
149
192
|
|
|
@@ -181,7 +224,7 @@ You can override the default font family by setting the `--font-family` CSS vari
|
|
|
181
224
|
@layer base {
|
|
182
225
|
:root {
|
|
183
226
|
/* Override the library's default font */
|
|
184
|
-
--font-family:
|
|
227
|
+
--font-family: "Your Custom Font", "Helvetica", sans-serif;
|
|
185
228
|
}
|
|
186
229
|
}
|
|
187
230
|
```
|
|
@@ -190,11 +233,11 @@ Make sure to include your custom font using `@font-face` or a web font service l
|
|
|
190
233
|
|
|
191
234
|
```css
|
|
192
235
|
/* Example: Using Google Fonts */
|
|
193
|
-
@import url(
|
|
236
|
+
@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap");
|
|
194
237
|
|
|
195
238
|
@layer base {
|
|
196
239
|
:root {
|
|
197
|
-
--font-family:
|
|
240
|
+
--font-family: "Inter", system-ui, sans-serif;
|
|
198
241
|
}
|
|
199
242
|
}
|
|
200
243
|
```
|
package/README.md
CHANGED
|
@@ -10,15 +10,28 @@ npm install @alkimi.org/ui-kit
|
|
|
10
10
|
|
|
11
11
|
## Setup
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
You have **two setup options** depending on your needs:
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
- **Option A (Recommended)**: Import pre-compiled library styles - simpler setup, works immediately
|
|
16
|
+
- **Option B (Advanced)**: Manual styling with full control - requires more configuration
|
|
17
|
+
|
|
18
|
+
Choose the option that best fits your project requirements.
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
### Option A: Import Library Styles (Recommended)
|
|
23
|
+
|
|
24
|
+
**Best for**: Most projects. Simple setup with minimal configuration.
|
|
25
|
+
|
|
26
|
+
**What you get**: Pre-compiled utility classes (`rounded-lg`, `bg-primary`, etc.) + CSS variables + fonts
|
|
27
|
+
|
|
28
|
+
#### 1. Install Tailwind CSS v4
|
|
16
29
|
|
|
17
30
|
```bash
|
|
18
31
|
npm install -D tailwindcss@next @tailwindcss/postcss@next postcss autoprefixer
|
|
19
32
|
```
|
|
20
33
|
|
|
21
|
-
|
|
34
|
+
#### 2. Configure PostCSS
|
|
22
35
|
|
|
23
36
|
Create or update your `postcss.config.js`:
|
|
24
37
|
|
|
@@ -31,119 +44,149 @@ module.exports = {
|
|
|
31
44
|
}
|
|
32
45
|
```
|
|
33
46
|
|
|
34
|
-
|
|
47
|
+
#### 3. Import Library Styles
|
|
35
48
|
|
|
36
|
-
|
|
49
|
+
In your root layout file (e.g., `app/layout.tsx` for Next.js App Router):
|
|
37
50
|
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
content: [
|
|
42
|
-
// Scans YOUR project files for Tailwind classes
|
|
43
|
-
"./src/**/*.{js,jsx,ts,tsx}",
|
|
44
|
-
"./app/**/*.{js,jsx,ts,tsx}", // If using Next.js App Router
|
|
45
|
-
"./pages/**/*.{js,jsx,ts,tsx}", // If using Next.js Pages Router
|
|
46
|
-
"./components/**/*.{js,jsx,ts,tsx}",
|
|
47
|
-
|
|
48
|
-
// Scans the UI Kit's components for their Tailwind classes
|
|
49
|
-
// (Required for library components to be styled correctly)
|
|
50
|
-
"./node_modules/@alkimi.org/ui-kit/dist/**/*.{js,mjs}",
|
|
51
|
-
],
|
|
52
|
-
}
|
|
51
|
+
```tsx
|
|
52
|
+
import "@alkimi.org/ui-kit/styles.css"
|
|
53
|
+
import "./globals.css" // Your custom CSS
|
|
53
54
|
```
|
|
54
55
|
|
|
55
|
-
**Important**:
|
|
56
|
+
**Important**: Import the library styles **before** your custom CSS so you can override variables if needed.
|
|
56
57
|
|
|
57
|
-
|
|
58
|
+
#### 4. Configure Your CSS
|
|
58
59
|
|
|
59
|
-
Create
|
|
60
|
+
Create your `globals.css`:
|
|
60
61
|
|
|
61
62
|
```css
|
|
62
63
|
@import "tailwindcss";
|
|
64
|
+
|
|
65
|
+
/* Optional: Override library CSS variables */
|
|
66
|
+
:root {
|
|
67
|
+
/* Example: Custom primary color */
|
|
68
|
+
--primary: oklch(0.992 0.019 155.826);
|
|
69
|
+
--primary-foreground: oklch(0.205 0 0);
|
|
70
|
+
|
|
71
|
+
/* You can override any of these variables:
|
|
72
|
+
--secondary, --secondary-foreground
|
|
73
|
+
--background, --foreground
|
|
74
|
+
--muted, --muted-foreground
|
|
75
|
+
--accent, --accent-foreground
|
|
76
|
+
--destructive, --destructive-foreground
|
|
77
|
+
--border, --input, --ring
|
|
78
|
+
--radius (border radius)
|
|
79
|
+
*/
|
|
80
|
+
}
|
|
63
81
|
```
|
|
64
82
|
|
|
65
|
-
|
|
83
|
+
**That's it!** The library components will work immediately because:
|
|
66
84
|
|
|
67
|
-
|
|
85
|
+
- `styles.css` contains pre-compiled utility classes
|
|
86
|
+
- All CSS variables are defined
|
|
87
|
+
- Fonts are included
|
|
88
|
+
- **No `@source` directive needed** (utilities are already compiled into the CSS)
|
|
68
89
|
|
|
69
|
-
|
|
70
|
-
import "@alkimi.org/ui-kit/styles.css"
|
|
71
|
-
```
|
|
90
|
+
#### When to Use Option A
|
|
72
91
|
|
|
73
|
-
|
|
92
|
+
- You want the quickest setup
|
|
93
|
+
- You're happy with the library's default styling approach
|
|
94
|
+
- You want to customize colors via CSS variables
|
|
95
|
+
- You don't need complete control over Tailwind configuration
|
|
74
96
|
|
|
75
|
-
|
|
97
|
+
---
|
|
76
98
|
|
|
77
|
-
### Option
|
|
99
|
+
### Option B: Manual Styling (Advanced)
|
|
78
100
|
|
|
79
|
-
|
|
101
|
+
**Best for**: Advanced users who want complete control over CSS generation and Tailwind configuration.
|
|
80
102
|
|
|
81
|
-
|
|
82
|
-
/* In your app.css or globals.css */
|
|
83
|
-
@import "tailwindcss";
|
|
84
|
-
@import "@alkimi.org/ui-kit/styles.css";
|
|
103
|
+
**What you do**: Define all CSS variables yourself and use `@source` to dynamically generate utility classes.
|
|
85
104
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
*/
|
|
103
|
-
}
|
|
105
|
+
#### 1. Install Tailwind CSS v4
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
npm install -D tailwindcss@next @tailwindcss/postcss@next postcss autoprefixer
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
#### 2. Configure PostCSS
|
|
112
|
+
|
|
113
|
+
Create or update your `postcss.config.js`:
|
|
114
|
+
|
|
115
|
+
```js
|
|
116
|
+
module.exports = {
|
|
117
|
+
plugins: {
|
|
118
|
+
"@tailwindcss/postcss": {},
|
|
119
|
+
autoprefixer: {},
|
|
120
|
+
},
|
|
104
121
|
}
|
|
105
122
|
```
|
|
106
123
|
|
|
107
|
-
|
|
124
|
+
#### 3. Do NOT Import Library Styles
|
|
125
|
+
|
|
126
|
+
In your root layout file (e.g., `app/layout.tsx`):
|
|
127
|
+
|
|
128
|
+
```tsx
|
|
129
|
+
// ❌ Do NOT import library styles in Option B
|
|
130
|
+
// import "@alkimi.org/ui-kit/styles.css"
|
|
131
|
+
|
|
132
|
+
import "./globals.css" // Only import your custom CSS
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
#### 4. Configure Your CSS with @source
|
|
108
136
|
|
|
109
|
-
|
|
137
|
+
Create your `globals.css`:
|
|
110
138
|
|
|
111
139
|
```css
|
|
112
|
-
/* In your app.css or globals.css */
|
|
113
140
|
@import "tailwindcss";
|
|
114
141
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
142
|
+
/* REQUIRED: Tell Tailwind v4 to scan library components */
|
|
143
|
+
@source "../node_modules/@alkimi.org/ui-kit/dist/**/*.{js,mjs}";
|
|
144
|
+
|
|
145
|
+
/* REQUIRED: Define ALL CSS variables the library needs */
|
|
146
|
+
:root {
|
|
147
|
+
--background: oklch(0.992 0.019 155.826);
|
|
148
|
+
--foreground: oklch(0.205 0 0);
|
|
149
|
+
--card: oklch(0.992 0.019 155.826);
|
|
150
|
+
--card-foreground: oklch(0.205 0 0);
|
|
151
|
+
--popover: oklch(0.992 0.019 155.826);
|
|
152
|
+
--popover-foreground: oklch(0.205 0 0);
|
|
153
|
+
--primary: oklch(0.992 0.019 155.826);
|
|
154
|
+
--primary-foreground: oklch(0.205 0 0);
|
|
155
|
+
--secondary: oklch(0.269 0 0);
|
|
156
|
+
--secondary-foreground: oklch(0.992 0.019 155.826);
|
|
157
|
+
--muted: oklch(0.269 0 0);
|
|
158
|
+
--muted-foreground: oklch(0.608 0 0);
|
|
159
|
+
--accent: oklch(0.269 0 0);
|
|
160
|
+
--accent-foreground: oklch(0.992 0.019 155.826);
|
|
161
|
+
--destructive: oklch(0.576 0.214 25.467);
|
|
162
|
+
--destructive-foreground: oklch(0.992 0.019 155.826);
|
|
163
|
+
--border: #3f3f46;
|
|
164
|
+
--input: #3f3f46;
|
|
165
|
+
--ring: oklch(0.992 0.019 155.826);
|
|
166
|
+
--radius: 0.625rem;
|
|
167
|
+
--font-family: "Helvetica Now Display", "Helvetica", sans-serif;
|
|
168
|
+
}
|
|
139
169
|
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
}
|
|
170
|
+
body {
|
|
171
|
+
@apply bg-background text-foreground;
|
|
143
172
|
}
|
|
144
173
|
```
|
|
145
174
|
|
|
146
|
-
**
|
|
175
|
+
**Key points**:
|
|
176
|
+
|
|
177
|
+
- The `@source` directive tells Tailwind v4 to scan the library's component files
|
|
178
|
+
- Tailwind will dynamically generate utility classes for any classes used in those components
|
|
179
|
+
- You must define all CSS variables the library expects
|
|
180
|
+
- VS Code may show a warning for `@source` - you can safely ignore it (it's a valid Tailwind v4 directive)
|
|
181
|
+
|
|
182
|
+
#### When to Use Option B
|
|
183
|
+
|
|
184
|
+
- You want complete control over CSS generation
|
|
185
|
+
- You're customizing Tailwind's configuration extensively
|
|
186
|
+
- You want to manage all CSS variables manually
|
|
187
|
+
- You're comfortable with more advanced Tailwind v4 configuration
|
|
188
|
+
|
|
189
|
+
---
|
|
147
190
|
|
|
148
191
|
## Typography & Sizing
|
|
149
192
|
|
|
@@ -181,7 +224,7 @@ You can override the default font family by setting the `--font-family` CSS vari
|
|
|
181
224
|
@layer base {
|
|
182
225
|
:root {
|
|
183
226
|
/* Override the library's default font */
|
|
184
|
-
--font-family:
|
|
227
|
+
--font-family: "Your Custom Font", "Helvetica", sans-serif;
|
|
185
228
|
}
|
|
186
229
|
}
|
|
187
230
|
```
|
|
@@ -190,11 +233,11 @@ Make sure to include your custom font using `@font-face` or a web font service l
|
|
|
190
233
|
|
|
191
234
|
```css
|
|
192
235
|
/* Example: Using Google Fonts */
|
|
193
|
-
@import url(
|
|
236
|
+
@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap");
|
|
194
237
|
|
|
195
238
|
@layer base {
|
|
196
239
|
:root {
|
|
197
|
-
--font-family:
|
|
240
|
+
--font-family: "Inter", system-ui, sans-serif;
|
|
198
241
|
}
|
|
199
242
|
}
|
|
200
243
|
```
|
package/README.npm.md
CHANGED
|
@@ -10,15 +10,28 @@ npm install @alkimi.org/ui-kit
|
|
|
10
10
|
|
|
11
11
|
## Setup
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
You have **two setup options** depending on your needs:
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
- **Option A (Recommended)**: Import pre-compiled library styles - simpler setup, works immediately
|
|
16
|
+
- **Option B (Advanced)**: Manual styling with full control - requires more configuration
|
|
17
|
+
|
|
18
|
+
Choose the option that best fits your project requirements.
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
### Option A: Import Library Styles (Recommended)
|
|
23
|
+
|
|
24
|
+
**Best for**: Most projects. Simple setup with minimal configuration.
|
|
25
|
+
|
|
26
|
+
**What you get**: Pre-compiled utility classes (`rounded-lg`, `bg-primary`, etc.) + CSS variables + fonts
|
|
27
|
+
|
|
28
|
+
#### 1. Install Tailwind CSS v4
|
|
16
29
|
|
|
17
30
|
```bash
|
|
18
31
|
npm install -D tailwindcss@next @tailwindcss/postcss@next postcss autoprefixer
|
|
19
32
|
```
|
|
20
33
|
|
|
21
|
-
|
|
34
|
+
#### 2. Configure PostCSS
|
|
22
35
|
|
|
23
36
|
Create or update your `postcss.config.js`:
|
|
24
37
|
|
|
@@ -31,119 +44,149 @@ module.exports = {
|
|
|
31
44
|
}
|
|
32
45
|
```
|
|
33
46
|
|
|
34
|
-
|
|
47
|
+
#### 3. Import Library Styles
|
|
35
48
|
|
|
36
|
-
|
|
49
|
+
In your root layout file (e.g., `app/layout.tsx` for Next.js App Router):
|
|
37
50
|
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
content: [
|
|
42
|
-
// Scans YOUR project files for Tailwind classes
|
|
43
|
-
"./src/**/*.{js,jsx,ts,tsx}",
|
|
44
|
-
"./app/**/*.{js,jsx,ts,tsx}", // If using Next.js App Router
|
|
45
|
-
"./pages/**/*.{js,jsx,ts,tsx}", // If using Next.js Pages Router
|
|
46
|
-
"./components/**/*.{js,jsx,ts,tsx}",
|
|
47
|
-
|
|
48
|
-
// Scans the UI Kit's components for their Tailwind classes
|
|
49
|
-
// (Required for library components to be styled correctly)
|
|
50
|
-
"./node_modules/@alkimi.org/ui-kit/dist/**/*.{js,mjs}",
|
|
51
|
-
],
|
|
52
|
-
}
|
|
51
|
+
```tsx
|
|
52
|
+
import "@alkimi.org/ui-kit/styles.css"
|
|
53
|
+
import "./globals.css" // Your custom CSS
|
|
53
54
|
```
|
|
54
55
|
|
|
55
|
-
**Important**:
|
|
56
|
+
**Important**: Import the library styles **before** your custom CSS so you can override variables if needed.
|
|
56
57
|
|
|
57
|
-
|
|
58
|
+
#### 4. Configure Your CSS
|
|
58
59
|
|
|
59
|
-
Create
|
|
60
|
+
Create your `globals.css`:
|
|
60
61
|
|
|
61
62
|
```css
|
|
62
63
|
@import "tailwindcss";
|
|
64
|
+
|
|
65
|
+
/* Optional: Override library CSS variables */
|
|
66
|
+
:root {
|
|
67
|
+
/* Example: Custom primary color */
|
|
68
|
+
--primary: oklch(0.992 0.019 155.826);
|
|
69
|
+
--primary-foreground: oklch(0.205 0 0);
|
|
70
|
+
|
|
71
|
+
/* You can override any of these variables:
|
|
72
|
+
--secondary, --secondary-foreground
|
|
73
|
+
--background, --foreground
|
|
74
|
+
--muted, --muted-foreground
|
|
75
|
+
--accent, --accent-foreground
|
|
76
|
+
--destructive, --destructive-foreground
|
|
77
|
+
--border, --input, --ring
|
|
78
|
+
--radius (border radius)
|
|
79
|
+
*/
|
|
80
|
+
}
|
|
63
81
|
```
|
|
64
82
|
|
|
65
|
-
|
|
83
|
+
**That's it!** The library components will work immediately because:
|
|
66
84
|
|
|
67
|
-
|
|
85
|
+
- `styles.css` contains pre-compiled utility classes
|
|
86
|
+
- All CSS variables are defined
|
|
87
|
+
- Fonts are included
|
|
88
|
+
- **No `@source` directive needed** (utilities are already compiled into the CSS)
|
|
68
89
|
|
|
69
|
-
|
|
70
|
-
import "@alkimi.org/ui-kit/styles.css"
|
|
71
|
-
```
|
|
90
|
+
#### When to Use Option A
|
|
72
91
|
|
|
73
|
-
|
|
92
|
+
- You want the quickest setup
|
|
93
|
+
- You're happy with the library's default styling approach
|
|
94
|
+
- You want to customize colors via CSS variables
|
|
95
|
+
- You don't need complete control over Tailwind configuration
|
|
74
96
|
|
|
75
|
-
|
|
97
|
+
---
|
|
76
98
|
|
|
77
|
-
### Option
|
|
99
|
+
### Option B: Manual Styling (Advanced)
|
|
78
100
|
|
|
79
|
-
|
|
101
|
+
**Best for**: Advanced users who want complete control over CSS generation and Tailwind configuration.
|
|
80
102
|
|
|
81
|
-
|
|
82
|
-
/* In your app.css or globals.css */
|
|
83
|
-
@import "tailwindcss";
|
|
84
|
-
@import "@alkimi.org/ui-kit/styles.css";
|
|
103
|
+
**What you do**: Define all CSS variables yourself and use `@source` to dynamically generate utility classes.
|
|
85
104
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
*/
|
|
103
|
-
}
|
|
105
|
+
#### 1. Install Tailwind CSS v4
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
npm install -D tailwindcss@next @tailwindcss/postcss@next postcss autoprefixer
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
#### 2. Configure PostCSS
|
|
112
|
+
|
|
113
|
+
Create or update your `postcss.config.js`:
|
|
114
|
+
|
|
115
|
+
```js
|
|
116
|
+
module.exports = {
|
|
117
|
+
plugins: {
|
|
118
|
+
"@tailwindcss/postcss": {},
|
|
119
|
+
autoprefixer: {},
|
|
120
|
+
},
|
|
104
121
|
}
|
|
105
122
|
```
|
|
106
123
|
|
|
107
|
-
|
|
124
|
+
#### 3. Do NOT Import Library Styles
|
|
125
|
+
|
|
126
|
+
In your root layout file (e.g., `app/layout.tsx`):
|
|
127
|
+
|
|
128
|
+
```tsx
|
|
129
|
+
// ❌ Do NOT import library styles in Option B
|
|
130
|
+
// import "@alkimi.org/ui-kit/styles.css"
|
|
131
|
+
|
|
132
|
+
import "./globals.css" // Only import your custom CSS
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
#### 4. Configure Your CSS with @source
|
|
108
136
|
|
|
109
|
-
|
|
137
|
+
Create your `globals.css`:
|
|
110
138
|
|
|
111
139
|
```css
|
|
112
|
-
/* In your app.css or globals.css */
|
|
113
140
|
@import "tailwindcss";
|
|
114
141
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
142
|
+
/* REQUIRED: Tell Tailwind v4 to scan library components */
|
|
143
|
+
@source "../node_modules/@alkimi.org/ui-kit/dist/**/*.{js,mjs}";
|
|
144
|
+
|
|
145
|
+
/* REQUIRED: Define ALL CSS variables the library needs */
|
|
146
|
+
:root {
|
|
147
|
+
--background: oklch(0.992 0.019 155.826);
|
|
148
|
+
--foreground: oklch(0.205 0 0);
|
|
149
|
+
--card: oklch(0.992 0.019 155.826);
|
|
150
|
+
--card-foreground: oklch(0.205 0 0);
|
|
151
|
+
--popover: oklch(0.992 0.019 155.826);
|
|
152
|
+
--popover-foreground: oklch(0.205 0 0);
|
|
153
|
+
--primary: oklch(0.992 0.019 155.826);
|
|
154
|
+
--primary-foreground: oklch(0.205 0 0);
|
|
155
|
+
--secondary: oklch(0.269 0 0);
|
|
156
|
+
--secondary-foreground: oklch(0.992 0.019 155.826);
|
|
157
|
+
--muted: oklch(0.269 0 0);
|
|
158
|
+
--muted-foreground: oklch(0.608 0 0);
|
|
159
|
+
--accent: oklch(0.269 0 0);
|
|
160
|
+
--accent-foreground: oklch(0.992 0.019 155.826);
|
|
161
|
+
--destructive: oklch(0.576 0.214 25.467);
|
|
162
|
+
--destructive-foreground: oklch(0.992 0.019 155.826);
|
|
163
|
+
--border: #3f3f46;
|
|
164
|
+
--input: #3f3f46;
|
|
165
|
+
--ring: oklch(0.992 0.019 155.826);
|
|
166
|
+
--radius: 0.625rem;
|
|
167
|
+
--font-family: "Helvetica Now Display", "Helvetica", sans-serif;
|
|
168
|
+
}
|
|
139
169
|
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
}
|
|
170
|
+
body {
|
|
171
|
+
@apply bg-background text-foreground;
|
|
143
172
|
}
|
|
144
173
|
```
|
|
145
174
|
|
|
146
|
-
**
|
|
175
|
+
**Key points**:
|
|
176
|
+
|
|
177
|
+
- The `@source` directive tells Tailwind v4 to scan the library's component files
|
|
178
|
+
- Tailwind will dynamically generate utility classes for any classes used in those components
|
|
179
|
+
- You must define all CSS variables the library expects
|
|
180
|
+
- VS Code may show a warning for `@source` - you can safely ignore it (it's a valid Tailwind v4 directive)
|
|
181
|
+
|
|
182
|
+
#### When to Use Option B
|
|
183
|
+
|
|
184
|
+
- You want complete control over CSS generation
|
|
185
|
+
- You're customizing Tailwind's configuration extensively
|
|
186
|
+
- You want to manage all CSS variables manually
|
|
187
|
+
- You're comfortable with more advanced Tailwind v4 configuration
|
|
188
|
+
|
|
189
|
+
---
|
|
147
190
|
|
|
148
191
|
## Typography & Sizing
|
|
149
192
|
|
|
@@ -181,7 +224,7 @@ You can override the default font family by setting the `--font-family` CSS vari
|
|
|
181
224
|
@layer base {
|
|
182
225
|
:root {
|
|
183
226
|
/* Override the library's default font */
|
|
184
|
-
--font-family:
|
|
227
|
+
--font-family: "Your Custom Font", "Helvetica", sans-serif;
|
|
185
228
|
}
|
|
186
229
|
}
|
|
187
230
|
```
|
|
@@ -190,11 +233,11 @@ Make sure to include your custom font using `@font-face` or a web font service l
|
|
|
190
233
|
|
|
191
234
|
```css
|
|
192
235
|
/* Example: Using Google Fonts */
|
|
193
|
-
@import url(
|
|
236
|
+
@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap");
|
|
194
237
|
|
|
195
238
|
@layer base {
|
|
196
239
|
:root {
|
|
197
|
-
--font-family:
|
|
240
|
+
--font-family: "Inter", system-ui, sans-serif;
|
|
198
241
|
}
|
|
199
242
|
}
|
|
200
243
|
```
|
|
@@ -3,7 +3,7 @@ import * as React from 'react';
|
|
|
3
3
|
import { VariantProps } from 'class-variance-authority';
|
|
4
4
|
|
|
5
5
|
declare const buttonVariants: (props?: ({
|
|
6
|
-
variant?: "default" | "destructive" | "outline" | "secondary" | "ghost" |
|
|
6
|
+
variant?: "link" | "default" | "destructive" | "outline" | "secondary" | "ghost" | null | undefined;
|
|
7
7
|
size?: "default" | "sm" | "lg" | "icon" | null | undefined;
|
|
8
8
|
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
9
9
|
interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement>, VariantProps<typeof buttonVariants> {
|
|
@@ -3,7 +3,7 @@ import * as React from 'react';
|
|
|
3
3
|
import { VariantProps } from 'class-variance-authority';
|
|
4
4
|
|
|
5
5
|
declare const buttonVariants: (props?: ({
|
|
6
|
-
variant?: "default" | "destructive" | "outline" | "secondary" | "ghost" |
|
|
6
|
+
variant?: "link" | "default" | "destructive" | "outline" | "secondary" | "ghost" | null | undefined;
|
|
7
7
|
size?: "default" | "sm" | "lg" | "icon" | null | undefined;
|
|
8
8
|
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
9
9
|
interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement>, VariantProps<typeof buttonVariants> {
|