@alkimi.org/ui-kit 0.1.13 → 0.1.14

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 CHANGED
@@ -10,95 +10,59 @@ npm install @alkimi.org/ui-kit
10
10
 
11
11
  ## Setup
12
12
 
13
- ### 1. Install Tailwind CSS
13
+ ### 1. Install Tailwind CSS v4
14
14
 
15
- If you haven't already, install Tailwind CSS in your project:
15
+ If you haven't already, install Tailwind CSS v4 and its dependencies in your project:
16
16
 
17
17
  ```bash
18
- npm install -D tailwindcss postcss autoprefixer
19
- npx tailwindcss init -p
18
+ npm install -D tailwindcss@next @tailwindcss/postcss@next postcss autoprefixer
20
19
  ```
21
20
 
22
- ### 2. Configure Tailwind
21
+ ### 2. Configure PostCSS
23
22
 
24
- Update your `tailwind.config.js` to include the library's content:
23
+ Create or update your `postcss.config.js`:
24
+
25
+ ```js
26
+ module.exports = {
27
+ plugins: {
28
+ "@tailwindcss/postcss": {},
29
+ autoprefixer: {},
30
+ },
31
+ }
32
+ ```
33
+
34
+ ### 3. Configure Tailwind
35
+
36
+ Create a `tailwind.config.js` to specify your content paths:
25
37
 
26
38
  ```js
27
39
  /** @type {import('tailwindcss').Config} */
28
40
  module.exports = {
29
- darkMode: ["class"],
30
41
  content: [
42
+ // 👇 Scans YOUR project files for Tailwind classes
31
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)
32
50
  "./node_modules/@alkimi.org/ui-kit/dist/**/*.{js,mjs}",
33
51
  ],
34
- theme: {
35
- fontSize: {
36
- xs: ["0.75rem", "1rem"],
37
- sm: ["12px", "1.25rem"],
38
- base: ["14px", "1.5rem"],
39
- lg: ["1.125rem", "1.75rem"],
40
- xl: ["1.25rem", "1.75rem"],
41
- "2xl": ["1.5rem", "2rem"],
42
- "3xl": ["1.875rem", "2.25rem"],
43
- "4xl": ["2.25rem", "2.5rem"],
44
- "5xl": ["3rem", "1"],
45
- "6xl": ["3.75rem", "1"],
46
- "7xl": ["4.5rem", "1"],
47
- "8xl": ["6rem", "1"],
48
- "9xl": ["8rem", "1"],
49
- },
50
- extend: {
51
- colors: {
52
- border: "hsl(var(--border))",
53
- input: "hsl(var(--input))",
54
- ring: "hsl(var(--ring))",
55
- background: "hsl(var(--background))",
56
- foreground: "hsl(var(--foreground))",
57
- primary: {
58
- DEFAULT: "hsl(var(--primary))",
59
- foreground: "hsl(var(--primary-foreground))",
60
- },
61
- secondary: {
62
- DEFAULT: "hsl(var(--secondary))",
63
- foreground: "hsl(var(--secondary-foreground))",
64
- },
65
- destructive: {
66
- DEFAULT: "hsl(var(--destructive))",
67
- foreground: "hsl(var(--destructive-foreground))",
68
- },
69
- muted: {
70
- DEFAULT: "hsl(var(--muted))",
71
- foreground: "hsl(var(--muted-foreground))",
72
- },
73
- accent: {
74
- DEFAULT: "hsl(var(--accent))",
75
- foreground: "hsl(var(--accent-foreground))",
76
- },
77
- popover: {
78
- DEFAULT: "hsl(var(--popover))",
79
- foreground: "hsl(var(--popover-foreground))",
80
- },
81
- card: {
82
- DEFAULT: "hsl(var(--card))",
83
- foreground: "hsl(var(--card-foreground))",
84
- },
85
- },
86
- borderRadius: {
87
- DEFAULT: "var(--radius)",
88
- lg: "calc(var(--radius) + 2px)",
89
- md: "var(--radius)",
90
- sm: "calc(var(--radius) - 2px)",
91
- xl: "calc(var(--radius) + 4px)",
92
- "2xl": "calc(var(--radius) + 6px)",
93
- "3xl": "3.75rem",
94
- },
95
- },
96
- },
97
- plugins: [require("tailwindcss-animate")],
98
52
  }
99
53
  ```
100
54
 
101
- ### 3. Import Styles
55
+ **Important**: The second path (`node_modules/@alkimi.org/ui-kit/dist/...`) is **required** for the library components to display correctly. It tells Tailwind to scan the library's compiled files and generate CSS for the utility classes used inside the components (like `bg-primary`, `rounded-3xl`, etc.).
56
+
57
+ ### 4. Import Tailwind in Your CSS
58
+
59
+ Create or update your main CSS file (e.g., `app.css` or `globals.css`):
60
+
61
+ ```css
62
+ @import "tailwindcss";
63
+ ```
64
+
65
+ ### 5. Import Styles
102
66
 
103
67
  Import the library's CSS in your main application file (e.g., `App.tsx` or `index.tsx`):
104
68
 
@@ -106,40 +70,98 @@ Import the library's CSS in your main application file (e.g., `App.tsx` or `inde
106
70
  import "@alkimi.org/ui-kit/styles.css"
107
71
  ```
108
72
 
109
- Or if you prefer, add the CSS variables to your own CSS file:
73
+ ## Customizing Colors
74
+
75
+ The library uses CSS variables for colors, making it easy to customize. You have two approaches:
76
+
77
+ ### Option A: Override CSS Variables (Recommended)
78
+
79
+ Add custom color values to your CSS file **after** importing the library styles:
110
80
 
111
81
  ```css
82
+ /* In your app.css or globals.css */
83
+ @import "tailwindcss";
84
+ @import "@alkimi.org/ui-kit/styles.css";
85
+
86
+ /* 👇 Override the library's default colors */
87
+ @layer base {
88
+ :root {
89
+ /* Your custom colors (HSL format: Hue Saturation% Lightness%) */
90
+ --primary: 220 100% 50%; /* Custom blue primary color */
91
+ --primary-foreground: 0 0% 100%; /* White text on primary */
92
+ --secondary: 280 60% 60%; /* Custom purple secondary */
93
+ --background: 0 0% 100%; /* White background */
94
+ --foreground: 0 0% 0%; /* Black text */
95
+
96
+ /* You can override any of these variables:
97
+ --muted, --muted-foreground
98
+ --accent, --accent-foreground
99
+ --destructive, --destructive-foreground
100
+ --border, --input, --ring
101
+ --radius (border radius)
102
+ */
103
+ }
104
+ }
105
+ ```
106
+
107
+ ### Option B: Don't Import Library CSS (Manual Setup)
108
+
109
+ If you want complete control, skip importing the library CSS and define all variables yourself:
110
+
111
+ ```css
112
+ /* In your app.css or globals.css */
113
+ @import "tailwindcss";
114
+
112
115
  @layer base {
113
116
  :root {
114
- /* Dark Mode Theme (Default) */
115
- --background: 240 10% 4%;
116
- --foreground: 144 100% 97%;
117
- --card: 0 0% 3.5%;
118
- --card-foreground: 140 100% 97.1%;
119
- --popover: 0 0% 3.5%;
120
- --popover-foreground: 140 100% 97.1%;
121
- --primary: 140 100% 97.1%;
122
- --primary-foreground: 240 6% 10%;
123
- --secondary: 240 4% 16%;
124
- --secondary-foreground: 140 100% 97.1%;
125
- --muted: 240 4% 16%;
126
- --muted-foreground: 144 4.3% 54.9%;
127
- --accent: 0 0% 15.3%;
128
- --accent-foreground: 140 100% 97.1%;
129
- --destructive: 0 62.8% 30.6%;
130
- --destructive-foreground: 140 100% 97.1%;
131
- --border: 240 3.7% 27.6%;
132
- --input: 240 3.7% 27.6%;
133
- --ring: 140 100% 97.1%;
134
- --radius: 0.625rem;
117
+ /* Define ALL color variables used by the library */
118
+ --background: 0 0% 100%;
119
+ --foreground: 0 0% 0%;
120
+ --card: 0 0% 100%;
121
+ --card-foreground: 0 0% 0%;
122
+ --popover: 0 0% 100%;
123
+ --popover-foreground: 0 0% 0%;
124
+ --primary: 220 100% 50%;
125
+ --primary-foreground: 0 0% 100%;
126
+ --secondary: 280 60% 60%;
127
+ --secondary-foreground: 0 0% 100%;
128
+ --muted: 0 0% 96%;
129
+ --muted-foreground: 0 0% 45%;
130
+ --accent: 0 0% 96%;
131
+ --accent-foreground: 0 0% 0%;
132
+ --destructive: 0 84% 60%;
133
+ --destructive-foreground: 0 0% 100%;
134
+ --border: 0 0% 90%;
135
+ --input: 0 0% 90%;
136
+ --ring: 220 100% 50%;
137
+ --radius: 0.5rem;
135
138
  }
136
139
 
137
140
  body {
138
- font-size: 14px;
141
+ @apply bg-background text-foreground;
139
142
  }
140
143
  }
141
144
  ```
142
145
 
146
+ **Note**: When using Option B, don't import `@alkimi.org/ui-kit/styles.css` in your code.
147
+
148
+ ## Typography & Sizing
149
+
150
+ The library uses **rem-based sizing** with a base font size of **1rem (16px)**. All font sizes use rem units for better accessibility and scalability:
151
+
152
+ - **Base text**: 1rem (16px)
153
+ - **Small text**: 0.875rem (14px) - Used in small buttons, captions, etc.
154
+ - **Large text**: 1.125rem (18px) and above
155
+
156
+ ### Button Sizes
157
+
158
+ Buttons have the following font sizes by default:
159
+ - **Small** (`size="sm"`): 0.875rem (14px)
160
+ - **Default**: 1rem (16px)
161
+ - **Large** (`size="lg"`): 1rem (16px)
162
+
163
+ You can override these sizes using Tailwind's text utility classes (e.g., `className="text-lg"`) on any component.
164
+
143
165
  ## Usage
144
166
 
145
167
  You can import components in two ways:
package/README.md CHANGED
@@ -10,95 +10,59 @@ npm install @alkimi.org/ui-kit
10
10
 
11
11
  ## Setup
12
12
 
13
- ### 1. Install Tailwind CSS
13
+ ### 1. Install Tailwind CSS v4
14
14
 
15
- If you haven't already, install Tailwind CSS in your project:
15
+ If you haven't already, install Tailwind CSS v4 and its dependencies in your project:
16
16
 
17
17
  ```bash
18
- npm install -D tailwindcss postcss autoprefixer
19
- npx tailwindcss init -p
18
+ npm install -D tailwindcss@next @tailwindcss/postcss@next postcss autoprefixer
20
19
  ```
21
20
 
22
- ### 2. Configure Tailwind
21
+ ### 2. Configure PostCSS
23
22
 
24
- Update your `tailwind.config.js` to include the library's content:
23
+ Create or update your `postcss.config.js`:
24
+
25
+ ```js
26
+ module.exports = {
27
+ plugins: {
28
+ "@tailwindcss/postcss": {},
29
+ autoprefixer: {},
30
+ },
31
+ }
32
+ ```
33
+
34
+ ### 3. Configure Tailwind
35
+
36
+ Create a `tailwind.config.js` to specify your content paths:
25
37
 
26
38
  ```js
27
39
  /** @type {import('tailwindcss').Config} */
28
40
  module.exports = {
29
- darkMode: ["class"],
30
41
  content: [
42
+ // Scans YOUR project files for Tailwind classes
31
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)
32
50
  "./node_modules/@alkimi.org/ui-kit/dist/**/*.{js,mjs}",
33
51
  ],
34
- theme: {
35
- fontSize: {
36
- xs: ['0.75rem', '1rem'],
37
- sm: ['12px', '1.25rem'],
38
- base: ['14px', '1.5rem'],
39
- lg: ['1.125rem', '1.75rem'],
40
- xl: ['1.25rem', '1.75rem'],
41
- '2xl': ['1.5rem', '2rem'],
42
- '3xl': ['1.875rem', '2.25rem'],
43
- '4xl': ['2.25rem', '2.5rem'],
44
- '5xl': ['3rem', '1'],
45
- '6xl': ['3.75rem', '1'],
46
- '7xl': ['4.5rem', '1'],
47
- '8xl': ['6rem', '1'],
48
- '9xl': ['8rem', '1'],
49
- },
50
- extend: {
51
- colors: {
52
- border: "hsl(var(--border))",
53
- input: "hsl(var(--input))",
54
- ring: "hsl(var(--ring))",
55
- background: "hsl(var(--background))",
56
- foreground: "hsl(var(--foreground))",
57
- primary: {
58
- DEFAULT: "hsl(var(--primary))",
59
- foreground: "hsl(var(--primary-foreground))",
60
- },
61
- secondary: {
62
- DEFAULT: "hsl(var(--secondary))",
63
- foreground: "hsl(var(--secondary-foreground))",
64
- },
65
- destructive: {
66
- DEFAULT: "hsl(var(--destructive))",
67
- foreground: "hsl(var(--destructive-foreground))",
68
- },
69
- muted: {
70
- DEFAULT: "hsl(var(--muted))",
71
- foreground: "hsl(var(--muted-foreground))",
72
- },
73
- accent: {
74
- DEFAULT: "hsl(var(--accent))",
75
- foreground: "hsl(var(--accent-foreground))",
76
- },
77
- popover: {
78
- DEFAULT: "hsl(var(--popover))",
79
- foreground: "hsl(var(--popover-foreground))",
80
- },
81
- card: {
82
- DEFAULT: "hsl(var(--card))",
83
- foreground: "hsl(var(--card-foreground))",
84
- },
85
- },
86
- borderRadius: {
87
- DEFAULT: "var(--radius)",
88
- lg: "calc(var(--radius) + 2px)",
89
- md: "var(--radius)",
90
- sm: "calc(var(--radius) - 2px)",
91
- xl: "calc(var(--radius) + 4px)",
92
- "2xl": "calc(var(--radius) + 6px)",
93
- "3xl": "3.75rem",
94
- },
95
- },
96
- },
97
- plugins: [require("tailwindcss-animate")],
98
52
  }
99
53
  ```
100
54
 
101
- ### 3. Import Styles
55
+ **Important**: The second path (`node_modules/@alkimi.org/ui-kit/dist/...`) is **required** for the library components to display correctly. It tells Tailwind to scan the library's compiled files and generate CSS for the utility classes used inside the components (like `bg-primary`, `rounded-3xl`, etc.).
56
+
57
+ ### 4. Import Tailwind in Your CSS
58
+
59
+ Create or update your main CSS file (e.g., `app.css` or `globals.css`):
60
+
61
+ ```css
62
+ @import "tailwindcss";
63
+ ```
64
+
65
+ ### 5. Import Styles
102
66
 
103
67
  Import the library's CSS in your main application file (e.g., `App.tsx` or `index.tsx`):
104
68
 
@@ -106,40 +70,100 @@ Import the library's CSS in your main application file (e.g., `App.tsx` or `inde
106
70
  import "@alkimi.org/ui-kit/styles.css"
107
71
  ```
108
72
 
109
- Or if you prefer, add the CSS variables to your own CSS file:
73
+ ## Customizing Colors
74
+
75
+ The library uses CSS variables for colors, making it easy to customize. You have two approaches:
76
+
77
+ ### Option A: Override CSS Variables (Recommended)
78
+
79
+ Add custom color values to your CSS file **after** importing the library styles:
110
80
 
111
81
  ```css
82
+ /* In your app.css or globals.css */
83
+ @import "tailwindcss";
84
+ @import "@alkimi.org/ui-kit/styles.css";
85
+
86
+ /* 👇 Override the library's default colors */
87
+ @layer base {
88
+ :root {
89
+ /* Your custom colors (HSL format: Hue Saturation% Lightness%) */
90
+ --primary: 220 100% 50%; /* Custom blue primary color */
91
+ --primary-foreground: 0 0% 100%; /* White text on primary */
92
+ --secondary: 280 60% 60%; /* Custom purple secondary */
93
+ --background: 0 0% 100%; /* White background */
94
+ --foreground: 0 0% 0%; /* Black text */
95
+
96
+ /* You can override any of these variables:
97
+ --card, --card-foreground
98
+ --popover, --popover-foreground
99
+ --muted, --muted-foreground
100
+ --accent, --accent-foreground
101
+ --destructive, --destructive-foreground
102
+ --border, --input, --ring
103
+ --radius (border radius)
104
+ */
105
+ }
106
+ }
107
+ ```
108
+
109
+ ### Option B: Don't Import Library CSS (Manual Setup)
110
+
111
+ If you want complete control, skip importing the library CSS and define all variables yourself:
112
+
113
+ ```css
114
+ /* In your app.css or globals.css */
115
+ @import "tailwindcss";
116
+
112
117
  @layer base {
113
118
  :root {
114
- /* Dark Mode Theme (Default) */
115
- --background: 240 10% 4%;
116
- --foreground: 144 100% 97%;
117
- --card: 0 0% 3.5%;
118
- --card-foreground: 140 100% 97.1%;
119
- --popover: 0 0% 3.5%;
120
- --popover-foreground: 140 100% 97.1%;
121
- --primary: 140 100% 97.1%;
122
- --primary-foreground: 240 6% 10%;
123
- --secondary: 240 4% 16%;
124
- --secondary-foreground: 140 100% 97.1%;
125
- --muted: 240 4% 16%;
126
- --muted-foreground: 144 4.3% 54.9%;
127
- --accent: 0 0% 15.3%;
128
- --accent-foreground: 140 100% 97.1%;
129
- --destructive: 0 62.8% 30.6%;
130
- --destructive-foreground: 140 100% 97.1%;
131
- --border: 240 3.7% 27.6%;
132
- --input: 240 3.7% 27.6%;
133
- --ring: 140 100% 97.1%;
134
- --radius: 0.625rem;
119
+ /* Define ALL color variables used by the library */
120
+ --background: 0 0% 100%;
121
+ --foreground: 0 0% 0%;
122
+ --card: 0 0% 100%;
123
+ --card-foreground: 0 0% 0%;
124
+ --popover: 0 0% 100%;
125
+ --popover-foreground: 0 0% 0%;
126
+ --primary: 220 100% 50%;
127
+ --primary-foreground: 0 0% 100%;
128
+ --secondary: 280 60% 60%;
129
+ --secondary-foreground: 0 0% 100%;
130
+ --muted: 0 0% 96%;
131
+ --muted-foreground: 0 0% 45%;
132
+ --accent: 0 0% 96%;
133
+ --accent-foreground: 0 0% 0%;
134
+ --destructive: 0 84% 60%;
135
+ --destructive-foreground: 0 0% 100%;
136
+ --border: 0 0% 90%;
137
+ --input: 0 0% 90%;
138
+ --ring: 220 100% 50%;
139
+ --radius: 0.5rem;
135
140
  }
136
141
 
137
142
  body {
138
- font-size: 14px;
143
+ @apply bg-background text-foreground;
139
144
  }
140
145
  }
141
146
  ```
142
147
 
148
+ **Note**: When using Option B, don't import `@alkimi.org/ui-kit/styles.css` in your code.
149
+
150
+ ## Typography & Sizing
151
+
152
+ The library uses **rem-based sizing** with a base font size of **1rem (16px)**. All font sizes use rem units for better accessibility and scalability:
153
+
154
+ - **Base text**: 1rem (16px)
155
+ - **Small text**: 0.875rem (14px) - Used in small buttons, captions, etc.
156
+ - **Large text**: 1.125rem (18px) and above
157
+
158
+ ### Button Sizes
159
+
160
+ Buttons have the following font sizes by default:
161
+ - **Small** (`size="sm"`): 0.875rem (14px)
162
+ - **Default**: 1rem (16px)
163
+ - **Large** (`size="lg"`): 1rem (16px)
164
+
165
+ You can override these sizes using Tailwind's text utility classes (e.g., `className="text-lg"`) on any component.
166
+
143
167
  ## Usage
144
168
 
145
169
  ### Button Component