@alkimi.org/ui-kit 0.1.15 → 0.1.17
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 +149 -284
- package/README.md +131 -88
- package/README.npm.md +131 -88
- package/dist/{chunk-SVWC2KRP.js → chunk-5CDUAMIG.js} +2 -2
- package/dist/{chunk-SVWC2KRP.js.map → chunk-5CDUAMIG.js.map} +1 -1
- package/dist/{chunk-BCAQUOTY.mjs → chunk-AXL7HSZW.mjs} +2 -2
- package/dist/{chunk-BCAQUOTY.mjs.map → chunk-AXL7HSZW.mjs.map} +1 -1
- package/dist/components/TextDecoder.js +1 -1
- package/dist/components/TextDecoder.mjs +1 -1
- package/dist/index.css +1 -1
- package/dist/index.css.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/dist/styles.css +1 -1
- package/dist/styles.css.map +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
|
|
108
125
|
|
|
109
|
-
|
|
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
|
|
136
|
+
|
|
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
|
```
|
|
@@ -203,64 +246,12 @@ Make sure to include your custom font using `@font-face` or a web font service l
|
|
|
203
246
|
|
|
204
247
|
You can import components in two ways:
|
|
205
248
|
|
|
206
|
-
### Option 1: Import from Main Package
|
|
207
|
-
|
|
208
|
-
```tsx
|
|
209
|
-
import { Button, Card } from "@alkimi.org/ui-kit"
|
|
210
|
-
```
|
|
211
|
-
|
|
212
|
-
### Option 2: Import Individual Components (Optimized Bundle Size)
|
|
249
|
+
### Option 1: Import from Main Package
|
|
213
250
|
|
|
214
|
-
|
|
251
|
+
Import all components from the main package entry point:
|
|
215
252
|
|
|
216
253
|
```tsx
|
|
217
|
-
|
|
218
|
-
import { Button } from "@alkimi.org/ui-kit/button"
|
|
219
|
-
|
|
220
|
-
// Import only the Tabs components
|
|
221
|
-
import {
|
|
222
|
-
Tabs,
|
|
223
|
-
TabsList,
|
|
224
|
-
TabsTrigger,
|
|
225
|
-
TabsContent,
|
|
226
|
-
} from "@alkimi.org/ui-kit/tabs"
|
|
227
|
-
|
|
228
|
-
// Import utilities
|
|
229
|
-
import { cn } from "@alkimi.org/ui-kit/utils"
|
|
230
|
-
```
|
|
231
|
-
|
|
232
|
-
**Note**: Both import methods require installing the full `@alkimi.org/ui-kit` package. The individual imports help optimize your production bundle size (only used components are included), but don't reduce installation size.
|
|
233
|
-
|
|
234
|
-
### Available Component Paths
|
|
235
|
-
|
|
236
|
-
- `@alkimi.org/ui-kit/button` - Button component
|
|
237
|
-
- `@alkimi.org/ui-kit/tabs` - Tabs components (with animated sliding indicator)
|
|
238
|
-
- `@alkimi.org/ui-kit/text-decoder` - TextDecoder component
|
|
239
|
-
- `@alkimi.org/ui-kit/glitch-link` - GlitchLink component (requires Next.js)
|
|
240
|
-
- `@alkimi.org/ui-kit/pixel-load` - PixelLoad component (requires Next.js)
|
|
241
|
-
- `@alkimi.org/ui-kit/utils` - Utility functions
|
|
242
|
-
|
|
243
|
-
### Next.js Components
|
|
244
|
-
|
|
245
|
-
Some components require Next.js to be installed:
|
|
246
|
-
|
|
247
|
-
```bash
|
|
248
|
-
npm install next
|
|
249
|
-
```
|
|
250
|
-
|
|
251
|
-
Then you can use:
|
|
252
|
-
|
|
253
|
-
```tsx
|
|
254
|
-
import GlitchLink from "@alkimi.org/ui-kit/glitch-link"
|
|
255
|
-
import { PixelLoad } from "@alkimi.org/ui-kit/pixel-load"
|
|
256
|
-
```
|
|
257
|
-
|
|
258
|
-
> **Note:** If you're not using Next.js, you can still use all other components. Next.js is marked as an optional peer dependency.
|
|
259
|
-
|
|
260
|
-
### Button Component
|
|
261
|
-
|
|
262
|
-
```tsx
|
|
263
|
-
import { Button } from "@alkimi.org/ui-kit/button"
|
|
254
|
+
import { Button, Tabs } from "@alkimi.org/ui-kit"
|
|
264
255
|
|
|
265
256
|
function App() {
|
|
266
257
|
return (
|
|
@@ -278,153 +269,27 @@ function App() {
|
|
|
278
269
|
}
|
|
279
270
|
```
|
|
280
271
|
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
To add more shadcn/ui components to this library:
|
|
284
|
-
|
|
285
|
-
1. Use the shadcn CLI to add components:
|
|
286
|
-
|
|
287
|
-
```bash
|
|
288
|
-
npx shadcn-ui@latest add [component-name]
|
|
289
|
-
```
|
|
290
|
-
|
|
291
|
-
2. Export the new component in [src/index.ts](src/index.ts):
|
|
292
|
-
|
|
293
|
-
```tsx
|
|
294
|
-
export { ComponentName } from "./components/component-name"
|
|
295
|
-
```
|
|
296
|
-
|
|
297
|
-
3. Create a story file in the `stories/` folder:
|
|
298
|
-
|
|
299
|
-
```tsx
|
|
300
|
-
// stories/ComponentName.stories.tsx
|
|
301
|
-
import type { Meta, StoryObj } from "@storybook/react"
|
|
302
|
-
import { ComponentName } from "../src/components/component-name"
|
|
303
|
-
|
|
304
|
-
const meta = {
|
|
305
|
-
title: "Components/ComponentName",
|
|
306
|
-
component: ComponentName,
|
|
307
|
-
parameters: {
|
|
308
|
-
layout: "centered",
|
|
309
|
-
},
|
|
310
|
-
tags: ["autodocs"],
|
|
311
|
-
} satisfies Meta<typeof ComponentName>
|
|
312
|
-
|
|
313
|
-
export default meta
|
|
314
|
-
type Story = StoryObj<typeof meta>
|
|
315
|
-
|
|
316
|
-
export const Default: Story = {
|
|
317
|
-
args: {
|
|
318
|
-
// your component props
|
|
319
|
-
},
|
|
320
|
-
}
|
|
321
|
-
```
|
|
322
|
-
|
|
323
|
-
4. Test locally with Storybook:
|
|
324
|
-
|
|
325
|
-
```bash
|
|
326
|
-
npm run storybook
|
|
327
|
-
```
|
|
328
|
-
|
|
329
|
-
5. Commit and push to main:
|
|
330
|
-
|
|
331
|
-
```bash
|
|
332
|
-
git add .
|
|
333
|
-
git commit -m "feat: add ComponentName"
|
|
334
|
-
git push
|
|
335
|
-
```
|
|
336
|
-
|
|
337
|
-
6. Update the Storybook deployment:
|
|
338
|
-
|
|
339
|
-
```bash
|
|
340
|
-
git checkout storybook
|
|
341
|
-
git merge main
|
|
342
|
-
git push
|
|
343
|
-
```
|
|
344
|
-
|
|
345
|
-
Vercel will automatically rebuild and deploy the updated Storybook.
|
|
346
|
-
|
|
347
|
-
7. (Optional) Publish to npm:
|
|
348
|
-
```bash
|
|
349
|
-
git checkout main
|
|
350
|
-
# Update version in package.json
|
|
351
|
-
npm run build
|
|
352
|
-
npm publish
|
|
353
|
-
```
|
|
354
|
-
|
|
355
|
-
## Development
|
|
356
|
-
|
|
357
|
-
### Running the Demo
|
|
358
|
-
|
|
359
|
-
To see the components in action, run the demo application:
|
|
360
|
-
|
|
361
|
-
```bash
|
|
362
|
-
cd demo
|
|
363
|
-
npm install
|
|
364
|
-
npm run dev
|
|
365
|
-
```
|
|
366
|
-
|
|
367
|
-
Then open [http://localhost:3000](http://localhost:3000) in your browser.
|
|
368
|
-
|
|
369
|
-
The demo showcases all available components with interactive examples, including:
|
|
370
|
-
|
|
371
|
-
- All button variants and sizes
|
|
372
|
-
- Card layouts and compositions
|
|
373
|
-
- Dark mode toggle
|
|
374
|
-
- Interactive component states
|
|
375
|
-
|
|
376
|
-
### Build
|
|
377
|
-
|
|
378
|
-
Build the library for production:
|
|
379
|
-
|
|
380
|
-
```bash
|
|
381
|
-
npm run build
|
|
382
|
-
```
|
|
383
|
-
|
|
384
|
-
### Watch Mode
|
|
385
|
-
|
|
386
|
-
Build the library in watch mode during development:
|
|
387
|
-
|
|
388
|
-
```bash
|
|
389
|
-
npm run dev
|
|
390
|
-
```
|
|
391
|
-
|
|
392
|
-
### Type Check
|
|
393
|
-
|
|
394
|
-
Run TypeScript type checking:
|
|
395
|
-
|
|
396
|
-
```bash
|
|
397
|
-
npm run type-check
|
|
398
|
-
```
|
|
399
|
-
|
|
400
|
-
### Storybook
|
|
401
|
-
|
|
402
|
-
View and develop components in isolation using Storybook:
|
|
403
|
-
|
|
404
|
-
```bash
|
|
405
|
-
npm run storybook
|
|
406
|
-
```
|
|
272
|
+
### Option 2: Import Individual Components (Optimized Bundle Size)
|
|
407
273
|
|
|
408
|
-
|
|
274
|
+
For better code splitting and smaller production bundles, import components individually:
|
|
409
275
|
|
|
410
|
-
|
|
276
|
+
```tsx
|
|
277
|
+
// Import only the Button component
|
|
278
|
+
import { Button } from "@alkimi.org/ui-kit/button"
|
|
411
279
|
|
|
412
|
-
|
|
280
|
+
// Import only the Tabs components
|
|
281
|
+
import {
|
|
282
|
+
Tabs,
|
|
283
|
+
TabsList,
|
|
284
|
+
TabsTrigger,
|
|
285
|
+
TabsContent,
|
|
286
|
+
} from "@alkimi.org/ui-kit/tabs"
|
|
413
287
|
|
|
414
|
-
|
|
415
|
-
|
|
288
|
+
// Import utilities
|
|
289
|
+
import { cn } from "@alkimi.org/ui-kit/utils"
|
|
416
290
|
```
|
|
417
291
|
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
## Publishing to npm
|
|
421
|
-
|
|
422
|
-
1. Update the version number in [package.json](package.json) (e.g., from `0.1.3` to `0.1.4`)
|
|
423
|
-
2. Build the library: `npm run build`
|
|
424
|
-
3. Login to npm (if not already logged in): `npm login`
|
|
425
|
-
4. Publish: `npm publish`
|
|
426
|
-
|
|
427
|
-
**Note:** Make sure to bump the version in [package.json](package.json) before publishing any changes to avoid conflicts with existing versions on npm.
|
|
292
|
+
**Note**: Both import methods require installing the full `@alkimi.org/ui-kit` package. The individual imports help optimize your production bundle size (only used components are included), but don't reduce installation size.
|
|
428
293
|
|
|
429
294
|
## License
|
|
430
295
|
|