@equal-experts/kuat-vue 0.1.4 → 0.2.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.
package/README.md ADDED
@@ -0,0 +1,461 @@
1
+ # @equal-experts/kuat-vue
2
+
3
+ A guide for integrating the Kuat Design System Vue component library into your application.
4
+
5
+ ---
6
+
7
+ ## Installation
8
+
9
+ ### Prerequisites
10
+
11
+ - Vue 3.4.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-vue
20
+
21
+ # Using npm
22
+ npm install @equal-experts/kuat-vue
23
+
24
+ # Using yarn
25
+ yarn add @equal-experts/kuat-vue
26
+ ```
27
+
28
+ ### Install Peer Dependencies
29
+
30
+ The library requires Vue, Radix Vue, and Reka UI as peer dependencies:
31
+
32
+ ```bash
33
+ # Required peer dependencies
34
+ pnpm add vue radix-vue reka-ui
35
+
36
+ # Optional: Install lucide-vue-next for icons (or use your preferred icon library)
37
+ pnpm add lucide-vue-next
38
+ ```
39
+
40
+ **Note:** `@equal-experts/kuat-core` is bundled with this package - you don't need to install it separately.
41
+
42
+ ---
43
+
44
+ ## Setup
45
+
46
+ ### 1. Configure Tailwind CSS
47
+
48
+ The Kuat Design System uses Tailwind CSS v4. You'll need to configure Tailwind in your project.
49
+
50
+ #### Install Tailwind CSS v4
51
+
52
+ ```bash
53
+ pnpm add -D tailwindcss@next @tailwindcss/vite
54
+ ```
55
+
56
+ #### Create `tailwind.config.ts`
57
+
58
+ ```typescript
59
+ import type { Config } from "tailwindcss";
60
+
61
+ const config: Config = {
62
+ content: [
63
+ "./src/**/*.{js,ts,jsx,tsx,vue}",
64
+ "./node_modules/@equal-experts/kuat-vue/**/*.{js,ts,vue}", // Include Kuat components
65
+ ],
66
+ theme: {
67
+ extend: {
68
+ colors: {
69
+ background: "var(--background)",
70
+ foreground: "var(--foreground)",
71
+ primary: {
72
+ DEFAULT: "var(--primary)",
73
+ foreground: "var(--primary-foreground)",
74
+ },
75
+ secondary: {
76
+ DEFAULT: "var(--secondary)",
77
+ foreground: "var(--secondary-foreground)",
78
+ },
79
+ // ... other color tokens from @equal-experts/kuat-core
80
+ },
81
+ borderRadius: {
82
+ lg: "var(--radius)",
83
+ md: "calc(var(--radius) - 2px)",
84
+ sm: "calc(var(--radius) - 4px)",
85
+ },
86
+ fontFamily: {
87
+ sans: ["var(--font-sans)"],
88
+ serif: ["var(--font-serif)"],
89
+ mono: ["var(--font-mono)"],
90
+ },
91
+ },
92
+ },
93
+ plugins: [],
94
+ };
95
+
96
+ export default config;
97
+ ```
98
+
99
+ #### Configure Vite (if using Vite)
100
+
101
+ ```typescript
102
+ // vite.config.ts
103
+ import { defineConfig } from "vite";
104
+ import vue from "@vitejs/plugin-vue";
105
+ import tailwindcss from "@tailwindcss/vite";
106
+
107
+ export default defineConfig({
108
+ plugins: [vue(), tailwindcss()],
109
+ });
110
+ ```
111
+
112
+ ### 2. Import Styles
113
+
114
+ Import the Kuat Design System styles in your application's entry point:
115
+
116
+ ```typescript
117
+ // main.ts
118
+ import { createApp } from "vue";
119
+ import App from "./App.vue";
120
+ import "@equal-experts/kuat-vue/styles";
121
+
122
+ createApp(App).mount("#app");
123
+ ```
124
+
125
+ 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).
126
+
127
+ **Note:** The styles include:
128
+ - Design tokens from `@equal-experts/kuat-core` (colors, spacing, typography)
129
+ - Tailwind CSS base styles
130
+ - Component-specific styles
131
+
132
+ ### 3. (Optional) Configure Fonts
133
+
134
+ 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.
135
+
136
+ If you want to use different fonts or load them differently, you can override the CSS variables:
137
+
138
+ ```css
139
+ :root {
140
+ --font-sans: 'Your Sans Font', sans-serif;
141
+ --font-serif: 'Your Serif Font', serif;
142
+ --font-mono: 'Your Mono Font', monospace;
143
+ }
144
+ ```
145
+
146
+ ---
147
+
148
+ ## Basic Usage
149
+
150
+ ### Import Components
151
+
152
+ ```typescript
153
+ import { Button } from "@equal-experts/kuat-vue";
154
+ ```
155
+
156
+ ### Use in Your App
157
+
158
+ ```vue
159
+ <template>
160
+ <div>
161
+ <Button>Click me</Button>
162
+ <Button variant="outline">Outline button</Button>
163
+ <Button variant="destructive">Delete</Button>
164
+ </div>
165
+ </template>
166
+
167
+ <script setup lang="ts">
168
+ import { Button } from "@equal-experts/kuat-vue";
169
+ </script>
170
+ ```
171
+
172
+ ---
173
+
174
+ ## Component Examples
175
+
176
+ ### Button
177
+
178
+ The Button component supports multiple variants and sizes:
179
+
180
+ ```vue
181
+ <template>
182
+ <div class="space-x-4">
183
+ <!-- Variants -->
184
+ <Button variant="default">Default</Button>
185
+ <Button variant="destructive">Destructive</Button>
186
+ <Button variant="outline">Outline</Button>
187
+ <Button variant="secondary">Secondary</Button>
188
+ <Button variant="ghost">Ghost</Button>
189
+ <Button variant="link">Link</Button>
190
+
191
+ <!-- Sizes -->
192
+ <Button size="sm">Small</Button>
193
+ <Button size="default">Default</Button>
194
+ <Button size="lg">Large</Button>
195
+ <Button size="icon">🚀</Button>
196
+ <Button size="icon-sm">📱</Button>
197
+ <Button size="icon-lg">💻</Button>
198
+
199
+ <!-- With click handler -->
200
+ <Button @click="handleClick">
201
+ Click me
202
+ </Button>
203
+
204
+ <!-- Disabled -->
205
+ <Button disabled>Disabled</Button>
206
+
207
+ <!-- As child (for composition) -->
208
+ <Button as-child>
209
+ <a href="/link">Link Button</a>
210
+ </Button>
211
+ </div>
212
+ </template>
213
+
214
+ <script setup lang="ts">
215
+ import { Button } from "@equal-experts/kuat-vue";
216
+
217
+ function handleClick() {
218
+ alert("Clicked!");
219
+ }
220
+ </script>
221
+ ```
222
+
223
+ ### TypeScript Support
224
+
225
+ All components are fully typed:
226
+
227
+ ```vue
228
+ <script setup lang="ts">
229
+ import { Button, type ButtonVariants } from "@equal-experts/kuat-vue";
230
+
231
+ const variant: ButtonVariants["variant"] = "outline";
232
+ const size: ButtonVariants["size"] = "lg";
233
+ </script>
234
+
235
+ <template>
236
+ <Button :variant="variant" :size="size">
237
+ Typed Button
238
+ </Button>
239
+ </template>
240
+ ```
241
+
242
+ ---
243
+
244
+ ## Styling and Theming
245
+
246
+ ### Using Design Tokens
247
+
248
+ The Kuat Design System provides CSS variables for all design tokens. Use them in your custom components:
249
+
250
+ ```vue
251
+ <template>
252
+ <div class="custom-component">
253
+ Custom styled component
254
+ </div>
255
+ </template>
256
+
257
+ <style scoped>
258
+ .custom-component {
259
+ background-color: var(--background);
260
+ color: var(--foreground);
261
+ padding: var(--spacing);
262
+ border-color: var(--border);
263
+ border-radius: var(--radius);
264
+ }
265
+ </style>
266
+ ```
267
+
268
+ Or with Tailwind classes:
269
+
270
+ ```vue
271
+ <template>
272
+ <div class="bg-background text-foreground p-4 rounded-lg border border-border">
273
+ Custom styled component
274
+ </div>
275
+ </template>
276
+ ```
277
+
278
+ ### Dark Mode
279
+
280
+ Dark mode is supported via the `.dark` class. Apply it to your root element:
281
+
282
+ ```vue
283
+ <!-- In your root component -->
284
+ <template>
285
+ <div :class="{ dark: isDark }">
286
+ <App />
287
+ </div>
288
+ </template>
289
+
290
+ <script setup lang="ts">
291
+ import { ref } from "vue";
292
+
293
+ const isDark = ref(false);
294
+ </script>
295
+ ```
296
+
297
+ Or toggle dynamically:
298
+
299
+ ```vue
300
+ <template>
301
+ <div :class="{ dark: isDark }">
302
+ <button @click="isDark = !isDark">
303
+ Toggle theme
304
+ </button>
305
+ <!-- Your app -->
306
+ </div>
307
+ </template>
308
+
309
+ <script setup lang="ts">
310
+ import { ref } from "vue";
311
+
312
+ const isDark = ref(false);
313
+ </script>
314
+ ```
315
+
316
+ ### Customizing Colors
317
+
318
+ Override CSS variables to customize the theme:
319
+
320
+ ```css
321
+ /* In your global CSS file */
322
+ :root {
323
+ --primary: oklch(0.645 0.163 237.5); /* Your primary color */
324
+ --primary-foreground: oklch(1.0 0.0 0.0); /* White */
325
+ }
326
+
327
+ .dark {
328
+ --primary: oklch(0.585 0.145 237.5); /* Darker primary for dark mode */
329
+ --primary-foreground: oklch(1.0 0.0 0.0); /* White */
330
+ }
331
+ ```
332
+
333
+ ---
334
+
335
+ ## Advanced Usage
336
+
337
+ ### Composing Components
338
+
339
+ Use the `as-child` prop to compose components:
340
+
341
+ ```vue
342
+ <template>
343
+ <Button as-child variant="ghost">
344
+ <router-link to="/dashboard">Dashboard</router-link>
345
+ </Button>
346
+ </template>
347
+
348
+ <script setup lang="ts">
349
+ import { Button } from "@equal-experts/kuat-vue";
350
+ </script>
351
+ ```
352
+
353
+ ### Using Variants Programmatically
354
+
355
+ Import and use variant functions:
356
+
357
+ ```vue
358
+ <template>
359
+ <button :class="buttonClass">
360
+ Custom Button
361
+ </button>
362
+ </template>
363
+
364
+ <script setup lang="ts">
365
+ import { buttonVariants } from "@equal-experts/kuat-vue";
366
+ import { cn } from "@equal-experts/kuat-vue";
367
+
368
+ const buttonClass = cn(
369
+ buttonVariants({ variant: "outline", size: "lg" }),
370
+ "custom-class"
371
+ );
372
+ </script>
373
+ ```
374
+
375
+ ### Global Component Registration
376
+
377
+ Register components globally if preferred:
378
+
379
+ ```typescript
380
+ // main.ts
381
+ import { createApp } from "vue";
382
+ import App from "./App.vue";
383
+ import * as KuatComponents from "@equal-experts/kuat-vue";
384
+
385
+ const app = createApp(App);
386
+
387
+ // Register all components globally
388
+ Object.entries(KuatComponents).forEach(([name, component]) => {
389
+ if (name !== "default" && typeof component === "object") {
390
+ app.component(name, component);
391
+ }
392
+ });
393
+
394
+ app.mount("#app");
395
+ ```
396
+
397
+ Then use without importing:
398
+
399
+ ```vue
400
+ <template>
401
+ <Button>No import needed</Button>
402
+ </template>
403
+ ```
404
+
405
+ ---
406
+
407
+ ## Troubleshooting
408
+
409
+ ### Styles Not Loading
410
+
411
+ 1. **Check import order**: Ensure you import `@equal-experts/kuat-vue/styles` before your own styles
412
+ 2. **Verify Tailwind config**: Make sure `@equal-experts/kuat-vue` is included in your `content` paths
413
+ 3. **Check build output**: Ensure the CSS file is being included in your build
414
+ 4. **Vue SFC**: If using Single File Components, ensure styles are processed correctly
415
+
416
+ ### TypeScript Errors
417
+
418
+ 1. **Install types**: Ensure Vue TypeScript support is configured
419
+ 2. **Check TypeScript version**: Requires TypeScript 5.3 or higher
420
+ 3. **Verify imports**: Use named imports, not default imports
421
+ 4. **Vue TSConfig**: Ensure your `tsconfig.json` includes Vue file types
422
+
423
+ ### Components Not Rendering
424
+
425
+ 1. **Check Vue version**: Requires Vue 3.4.0 or higher
426
+ 2. **Verify peer dependencies**: Ensure `vue` is installed
427
+ 3. **Check console**: Look for runtime errors in the browser console
428
+ 4. **Build mode**: Ensure you're using the correct build mode (ES modules)
429
+
430
+ ---
431
+
432
+ ## Package Structure
433
+
434
+ ```
435
+ @equal-experts/kuat-vue
436
+ ├── dist/
437
+ │ ├── index.js # Compiled JavaScript
438
+ │ ├── index.d.ts # TypeScript definitions
439
+ │ └── index.css # Compiled styles
440
+ └── src/
441
+ ├── components/ # Component source files
442
+ ├── lib/ # Utilities
443
+ └── styles.css # Style source
444
+ ```
445
+
446
+ ---
447
+
448
+ ## Additional Resources
449
+
450
+ - **Design System Documentation**: See [../../docs/agent/design/design-system.md](../../docs/agent/design/design-system.md)
451
+ - **Component Guidelines**: See [../../docs/agent/technical/component-guidelines.md](../../docs/agent/technical/component-guidelines.md)
452
+ - **shadcn-vue Documentation**: [https://www.shadcn-vue.com](https://www.shadcn-vue.com)
453
+ - **Tailwind CSS v4**: [https://tailwindcss.com](https://tailwindcss.com)
454
+ - **Vue 3 Documentation**: [https://vuejs.org](https://vuejs.org)
455
+
456
+ ---
457
+
458
+ ## Support
459
+
460
+ For issues, questions, or contributions, please refer to the main repository documentation or open an issue in the project repository.
461
+
@@ -0,0 +1,43 @@
1
+ import { PrimitiveProps } from 'reka-ui';
2
+ import { HTMLAttributes } from 'vue';
3
+ import { ButtonVariants } from '.';
4
+
5
+ interface Props extends PrimitiveProps {
6
+ variant?: ButtonVariants["variant"];
7
+ size?: ButtonVariants["size"];
8
+ class?: HTMLAttributes["class"];
9
+ }
10
+ declare function __VLS_template(): {
11
+ default?(_: {}): any;
12
+ };
13
+ declare const __VLS_component: import('vue').DefineComponent<import('vue').ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<Props>, {
14
+ as: string;
15
+ }>>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<Props>, {
16
+ as: string;
17
+ }>>> & Readonly<{}>, {
18
+ as: import('reka-ui').AsTag | import('vue').Component;
19
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
20
+ declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, ReturnType<typeof __VLS_template>>;
21
+ export default _default;
22
+ type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
23
+ type __VLS_TypePropsToRuntimeProps<T> = {
24
+ [K in keyof T]-?: {} extends Pick<T, K> ? {
25
+ type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
26
+ } : {
27
+ type: import('vue').PropType<T[K]>;
28
+ required: true;
29
+ };
30
+ };
31
+ type __VLS_WithDefaults<P, D> = {
32
+ [K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
33
+ default: D[K];
34
+ }> : P[K];
35
+ };
36
+ type __VLS_Prettify<T> = {
37
+ [K in keyof T]: T[K];
38
+ } & {};
39
+ type __VLS_WithTemplateSlots<T, S> = T & {
40
+ new (): {
41
+ $slots: S;
42
+ };
43
+ };
@@ -0,0 +1,8 @@
1
+ import { VariantProps } from 'class-variance-authority';
2
+
3
+ export { default as Button } from './Button.vue';
4
+ export declare const buttonVariants: (props?: ({
5
+ variant?: "default" | "destructive" | "outline" | "secondary" | "ghost" | "link" | null | undefined;
6
+ size?: "default" | "sm" | "lg" | "icon" | "icon-sm" | "icon-lg" | null | undefined;
7
+ } & import('class-variance-authority/types').ClassProp) | undefined) => string;
8
+ export type ButtonVariants = VariantProps<typeof buttonVariants>;
@@ -0,0 +1,3 @@
1
+ export { cn } from './lib/utils';
2
+ export { Button, buttonVariants } from './components/ui/button';
3
+ export type { ButtonVariants } from './components/ui/button';