@equal-experts/kuat-react 0.1.3 → 0.2.1

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.md ADDED
@@ -0,0 +1,392 @@
1
+ # @equal-experts/kuat-react
2
+
3
+ A guide for integrating the Kuat Design System React component library into your application.
4
+
5
+ ---
6
+
7
+ ## Installation
8
+
9
+ ### Prerequisites
10
+
11
+ - React 18.2.0 or higher
12
+ - Node.js 18 or higher
13
+ - A package manager (npm, pnpm, or yarn)
14
+
15
+ ### Install the Package
16
+
17
+ ```bash
18
+ # Using pnpm (recommended)
19
+ pnpm add @equal-experts/kuat-react
20
+
21
+ # Using npm
22
+ npm install @equal-experts/kuat-react
23
+
24
+ # Using yarn
25
+ yarn add @equal-experts/kuat-react
26
+ ```
27
+
28
+ ### Install Peer Dependencies
29
+
30
+ The library requires React, React DOM, and Radix UI packages as peer dependencies. Install only the packages you need based on which components you use:
31
+
32
+ ```bash
33
+ # Required peer dependencies
34
+ pnpm add react react-dom
35
+
36
+ # Install Radix UI packages as needed (examples for common components)
37
+ pnpm add @radix-ui/react-slot @radix-ui/react-dialog @radix-ui/react-dropdown-menu
38
+
39
+ # Optional: Install lucide-react for icons (or use your preferred icon library)
40
+ pnpm add lucide-react
41
+ ```
42
+
43
+ **Note:** `@equal-experts/kuat-core` is bundled with this package - you don't need to install it separately. Only install the Radix UI packages for the components you actually use.
44
+
45
+ ---
46
+
47
+ ## Setup
48
+
49
+ ### 1. Configure Tailwind CSS
50
+
51
+ The Kuat Design System uses Tailwind CSS v4. You'll need to configure Tailwind in your project.
52
+
53
+ #### Install Tailwind CSS v4
54
+
55
+ ```bash
56
+ pnpm add -D tailwindcss@next @tailwindcss/vite
57
+ ```
58
+
59
+ #### Create `tailwind.config.ts`
60
+
61
+ ```typescript
62
+ import type { Config } from "tailwindcss";
63
+
64
+ const config: Config = {
65
+ content: [
66
+ "./src/**/*.{js,ts,jsx,tsx}",
67
+ "./node_modules/@equal-experts/kuat-react/**/*.{js,ts,jsx,tsx}", // Include Kuat components
68
+ ],
69
+ theme: {
70
+ extend: {
71
+ colors: {
72
+ background: "var(--background)",
73
+ foreground: "var(--foreground)",
74
+ primary: {
75
+ DEFAULT: "var(--primary)",
76
+ foreground: "var(--primary-foreground)",
77
+ },
78
+ secondary: {
79
+ DEFAULT: "var(--secondary)",
80
+ foreground: "var(--secondary-foreground)",
81
+ },
82
+ // ... other color tokens from @equal-experts/kuat-core
83
+ },
84
+ borderRadius: {
85
+ lg: "var(--radius)",
86
+ md: "calc(var(--radius) - 2px)",
87
+ sm: "calc(var(--radius) - 4px)",
88
+ },
89
+ fontFamily: {
90
+ sans: ["var(--font-sans)"],
91
+ serif: ["var(--font-serif)"],
92
+ mono: ["var(--font-mono)"],
93
+ },
94
+ },
95
+ },
96
+ plugins: [],
97
+ };
98
+
99
+ export default config;
100
+ ```
101
+
102
+ #### Configure Vite (if using Vite)
103
+
104
+ ```typescript
105
+ // vite.config.ts
106
+ import { defineConfig } from "vite";
107
+ import react from "@vitejs/plugin-react";
108
+ import tailwindcss from "@tailwindcss/vite";
109
+
110
+ export default defineConfig({
111
+ plugins: [react(), tailwindcss()],
112
+ });
113
+ ```
114
+
115
+ ### 2. Import Styles
116
+
117
+ Import the Kuat Design System styles in your application's entry point:
118
+
119
+ ```typescript
120
+ // main.tsx or App.tsx
121
+ import "@equal-experts/kuat-react/styles";
122
+ ```
123
+
124
+ This imports the bundled CSS file which includes all design tokens from `@equal-experts/kuat-core` (no need to install `@equal-experts/kuat-core` separately).
125
+
126
+ **Note:** The styles include:
127
+ - Design tokens from `@equal-experts/kuat-core` (colors, spacing, typography)
128
+ - Tailwind CSS base styles
129
+ - Component-specific styles
130
+
131
+ ### 3. (Optional) Configure Fonts
132
+
133
+ The Kuat Design System uses Lexend (sans-serif), Lora (serif), and JetBrains Mono (monospace) fonts. These are loaded via Google Fonts in the core package.
134
+
135
+ If you want to use different fonts or load them differently, you can override the CSS variables:
136
+
137
+ ```css
138
+ :root {
139
+ --font-sans: 'Your Sans Font', sans-serif;
140
+ --font-serif: 'Your Serif Font', serif;
141
+ --font-mono: 'Your Mono Font', monospace;
142
+ }
143
+ ```
144
+
145
+ ---
146
+
147
+ ## Basic Usage
148
+
149
+ ### Import Components
150
+
151
+ ```typescript
152
+ import { Button } from "@equal-experts/kuat-react";
153
+ ```
154
+
155
+ ### Use in Your App
156
+
157
+ ```tsx
158
+ import { Button } from "@equal-experts/kuat-react";
159
+
160
+ function App() {
161
+ return (
162
+ <div>
163
+ <Button>Click me</Button>
164
+ <Button variant="outline">Outline button</Button>
165
+ <Button variant="destructive">Delete</Button>
166
+ </div>
167
+ );
168
+ }
169
+ ```
170
+
171
+ ---
172
+
173
+ ## Component Examples
174
+
175
+ ### Button
176
+
177
+ The Button component supports multiple variants and sizes:
178
+
179
+ ```tsx
180
+ import { Button } from "@equal-experts/kuat-react";
181
+
182
+ function ButtonExamples() {
183
+ return (
184
+ <div className="space-x-4">
185
+ {/* Variants */}
186
+ <Button variant="default">Default</Button>
187
+ <Button variant="destructive">Destructive</Button>
188
+ <Button variant="outline">Outline</Button>
189
+ <Button variant="secondary">Secondary</Button>
190
+ <Button variant="ghost">Ghost</Button>
191
+ <Button variant="link">Link</Button>
192
+
193
+ {/* Sizes */}
194
+ <Button size="sm">Small</Button>
195
+ <Button size="default">Default</Button>
196
+ <Button size="lg">Large</Button>
197
+ <Button size="icon">🚀</Button>
198
+
199
+ {/* With onClick */}
200
+ <Button onClick={() => alert("Clicked!")}>
201
+ Click me
202
+ </Button>
203
+
204
+ {/* Disabled */}
205
+ <Button disabled>Disabled</Button>
206
+
207
+ {/* As child (for composition) */}
208
+ <Button asChild>
209
+ <a href="/link">Link Button</a>
210
+ </Button>
211
+ </div>
212
+ );
213
+ }
214
+ ```
215
+
216
+ ### TypeScript Support
217
+
218
+ All components are fully typed:
219
+
220
+ ```tsx
221
+ import { Button, type ButtonProps } from "@equal-experts/kuat-react";
222
+
223
+ // ButtonProps includes all standard button HTML attributes
224
+ const CustomButton: React.FC<ButtonProps> = (props) => {
225
+ return <Button {...props} />;
226
+ };
227
+ ```
228
+
229
+ ---
230
+
231
+ ## Styling and Theming
232
+
233
+ ### Using Design Tokens
234
+
235
+ The Kuat Design System provides CSS variables for all design tokens. Use them in your custom components:
236
+
237
+ ```tsx
238
+ function CustomComponent() {
239
+ return (
240
+ <div
241
+ className="bg-background text-foreground p-4 rounded-lg"
242
+ style={{
243
+ borderColor: "var(--border)",
244
+ }}
245
+ >
246
+ Custom styled component
247
+ </div>
248
+ );
249
+ }
250
+ ```
251
+
252
+ ### Dark Mode
253
+
254
+ Dark mode is supported via the `.dark` class. Apply it to your root element:
255
+
256
+ ```tsx
257
+ // In your root component or HTML
258
+ <html className="dark">
259
+ <body>
260
+ <App />
261
+ </body>
262
+ </html>
263
+ ```
264
+
265
+ Or toggle dynamically:
266
+
267
+ ```tsx
268
+ import { useState } from "react";
269
+
270
+ function App() {
271
+ const [isDark, setIsDark] = useState(false);
272
+
273
+ return (
274
+ <div className={isDark ? "dark" : ""}>
275
+ <button onClick={() => setIsDark(!isDark)}>
276
+ Toggle theme
277
+ </button>
278
+ {/* Your app */}
279
+ </div>
280
+ );
281
+ }
282
+ ```
283
+
284
+ ### Customizing Colors
285
+
286
+ Override CSS variables to customize the theme:
287
+
288
+ ```css
289
+ /* In your global CSS file */
290
+ :root {
291
+ --primary: oklch(0.645 0.163 237.5); /* Your primary color */
292
+ --primary-foreground: oklch(1.0 0.0 0.0); /* White */
293
+ }
294
+
295
+ .dark {
296
+ --primary: oklch(0.585 0.145 237.5); /* Darker primary for dark mode */
297
+ --primary-foreground: oklch(1.0 0.0 0.0); /* White */
298
+ }
299
+ ```
300
+
301
+ ---
302
+
303
+ ## Advanced Usage
304
+
305
+ ### Composing Components
306
+
307
+ Use the `asChild` prop to compose components:
308
+
309
+ ```tsx
310
+ import { Button } from "@equal-experts/kuat-react";
311
+ import { Link } from "react-router-dom";
312
+
313
+ function NavigationButton() {
314
+ return (
315
+ <Button asChild variant="ghost">
316
+ <Link to="/dashboard">Dashboard</Link>
317
+ </Button>
318
+ );
319
+ }
320
+ ```
321
+
322
+ ### Using Variants Programmatically
323
+
324
+ Import and use variant functions:
325
+
326
+ ```tsx
327
+ import { buttonVariants } from "@equal-experts/kuat-react";
328
+ import { cn } from "@equal-experts/kuat-react";
329
+
330
+ function CustomButton({ className, ...props }) {
331
+ return (
332
+ <button
333
+ className={cn(buttonVariants({ variant: "outline", size: "lg" }), className)}
334
+ {...props}
335
+ />
336
+ );
337
+ }
338
+ ```
339
+
340
+ ---
341
+
342
+ ## Troubleshooting
343
+
344
+ ### Styles Not Loading
345
+
346
+ 1. **Check import order**: Ensure you import `@equal-experts/kuat-react/styles` before your own styles
347
+ 2. **Verify Tailwind config**: Make sure `@equal-experts/kuat-react` is included in your `content` paths
348
+ 3. **Check build output**: Ensure the CSS file is being included in your build
349
+
350
+ ### TypeScript Errors
351
+
352
+ 1. **Install types**: Ensure `@types/react` and `@types/react-dom` are installed
353
+ 2. **Check TypeScript version**: Requires TypeScript 5.3 or higher
354
+ 3. **Verify imports**: Use named imports, not default imports
355
+
356
+ ### Components Not Rendering
357
+
358
+ 1. **Check React version**: Requires React 18.2.0 or higher
359
+ 2. **Verify peer dependencies**: Ensure `react` and `react-dom` are installed
360
+ 3. **Check console**: Look for runtime errors in the browser console
361
+
362
+ ---
363
+
364
+ ## Package Structure
365
+
366
+ ```
367
+ @equal-experts/kuat-react
368
+ ├── dist/
369
+ │ ├── index.js # Compiled JavaScript
370
+ │ ├── index.d.ts # TypeScript definitions
371
+ │ └── index.css # Compiled styles
372
+ └── src/
373
+ ├── components/ # Component source files
374
+ ├── lib/ # Utilities
375
+ └── styles.css # Style source
376
+ ```
377
+
378
+ ---
379
+
380
+ ## Additional Resources
381
+
382
+ - **Design System Documentation**: See [../../docs/agent/design/design-system.md](../../docs/agent/design/design-system.md)
383
+ - **Component Guidelines**: See [../../docs/agent/technical/component-guidelines.md](../../docs/agent/technical/component-guidelines.md)
384
+ - **shadcn/ui Documentation**: [https://ui.shadcn.com](https://ui.shadcn.com)
385
+ - **Tailwind CSS v4**: [https://tailwindcss.com](https://tailwindcss.com)
386
+
387
+ ---
388
+
389
+ ## Support
390
+
391
+ For issues, questions, or contributions, please refer to the main repository documentation or open an issue in the project repository.
392
+
@@ -0,0 +1,11 @@
1
+ import { VariantProps } from 'class-variance-authority';
2
+ import * as React from "react";
3
+ declare const buttonVariants: (props?: ({
4
+ variant?: "default" | "destructive" | "outline" | "secondary" | "ghost" | "link" | null | undefined;
5
+ size?: "default" | "sm" | "lg" | "icon" | null | undefined;
6
+ } & import('class-variance-authority/types').ClassProp) | undefined) => string;
7
+ export interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement>, VariantProps<typeof buttonVariants> {
8
+ asChild?: boolean;
9
+ }
10
+ declare const Button: React.ForwardRefExoticComponent<ButtonProps & React.RefAttributes<HTMLButtonElement>>;
11
+ export { Button, buttonVariants };
@@ -0,0 +1,3 @@
1
+ export { cn } from './lib/utils';
2
+ export { Button, buttonVariants } from './components/ui/button';
3
+ export type { ButtonProps } from './components/ui/button';