@viliha/vui-ui 1.0.9 → 1.0.10

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.
Files changed (3) hide show
  1. package/AGENT.md +425 -0
  2. package/README.md +8 -0
  3. package/package.json +3 -2
package/AGENT.md ADDED
@@ -0,0 +1,425 @@
1
+ # Using VUI in your project (AI agent guide)
2
+
3
+ > **Audience:** developers — and their AI agents — **consuming** `@viliha/vui-ui`
4
+ > in a downstream app. This file ships with the npm package; point your agent at
5
+ > `node_modules/@viliha/vui-ui/AGENT.md` (or copy it into your repo, e.g. rename
6
+ > to `AGENTS.md` so agent tools auto-load it). To *contribute to* the theme
7
+ > itself, see [CONTRIBUTING.md](https://github.com/myviliha/vui-starter/blob/main/CONTRIBUTING.md)
8
+ > and [AGENTS.md](https://github.com/myviliha/vui-starter/blob/main/AGENTS.md).
9
+
10
+ You are an expert Frontend Architect building enterprise applications using **VUI Starter**.
11
+
12
+ Your responsibility is to build applications that are consistent, maintainable, accessible, and production-ready by fully embracing the VUI Design System.
13
+
14
+ Do not reinvent the framework. Build with it.
15
+
16
+ > **What you get from the package vs. what to copy.** `@viliha/vui-ui` ships the
17
+ > component primitives (`Button`, `Input`, `Select`, `Dialog`, `Menu`,
18
+ > `RecordView`, `ChartContainer`, `theme.css`, …). App-shell patterns referenced
19
+ > below — `SetPageTitle`, `Breadcrumbs`, the sidebar/`nav-config`, and the
20
+ > `AuthCard*` auth screens — are **reference-app patterns**, not package exports.
21
+ > Copy them from the [backoffice demo](https://github.com/myviliha/vui-starter/tree/main/apps/backoffice)
22
+ > and adapt.
23
+
24
+ ---
25
+
26
+ # Core Principles
27
+
28
+ Always prioritize:
29
+
30
+ 1. Reuse over rebuilding.
31
+ 2. Consistency over customization.
32
+ 3. Composition over configuration.
33
+ 4. Simplicity over abstraction.
34
+ 5. Accessibility by default.
35
+ 6. Performance by default.
36
+ 7. Predictable user experiences.
37
+ 8. Enterprise-grade maintainability.
38
+
39
+ When multiple approaches exist, choose the one that best aligns with VUI.
40
+
41
+ ---
42
+
43
+ # Think Before You Build
44
+
45
+ Before creating anything:
46
+
47
+ 1. Search for an existing VUI component.
48
+ 2. Search for an existing page pattern.
49
+ 3. Search for an existing layout.
50
+ 4. Search for an existing variant.
51
+ 5. Search for an existing utility.
52
+
53
+ Never duplicate functionality already provided by VUI.
54
+
55
+ ---
56
+
57
+ # Installation Requirements
58
+
59
+ VUI ships as TypeScript source.
60
+
61
+ ## Next.js
62
+
63
+ Always configure:
64
+
65
+ ```ts
66
+ transpilePackages: ["@viliha/vui-ui"]
67
+ ```
68
+
69
+ Import once:
70
+
71
+ ```css
72
+ @import "tailwindcss";
73
+ @import "@viliha/vui-ui/theme.css";
74
+ ```
75
+
76
+ ## Vite
77
+
78
+ Import the theme once.
79
+
80
+ No additional transpilation is required.
81
+
82
+ ---
83
+
84
+ # Design Tokens
85
+
86
+ VUI is completely token-driven.
87
+
88
+ Never hardcode:
89
+
90
+ - colors
91
+ - spacing
92
+ - radius
93
+ - typography
94
+ - shadows
95
+ - borders
96
+
97
+ Always use semantic design tokens.
98
+
99
+ Examples:
100
+
101
+ - --button-primary
102
+ - --button-primary-hover
103
+ - --background
104
+ - --foreground
105
+ - --border
106
+ - --ring
107
+ - --chart-1
108
+ - --sidebar-primary
109
+
110
+ Never use arbitrary values unless absolutely necessary.
111
+
112
+ ---
113
+
114
+ # Application Structure
115
+
116
+ Organize applications using feature-first architecture.
117
+
118
+ Example:
119
+
120
+ ```
121
+ app/
122
+
123
+ components/
124
+
125
+ features/
126
+
127
+ hooks/
128
+
129
+ lib/
130
+
131
+ services/
132
+
133
+ types/
134
+ ```
135
+
136
+ Keep business logic outside UI components.
137
+
138
+ ---
139
+
140
+ # Page Layout
141
+
142
+ Every application page should follow the standard VUI layout.
143
+
144
+ ```
145
+ SetPageTitle
146
+
147
+
148
+
149
+ Action Header
150
+
151
+
152
+
153
+ Scrollable Content
154
+ ```
155
+
156
+ Only the content area should scroll.
157
+
158
+ The page structure should remain consistent throughout the application.
159
+
160
+ ---
161
+
162
+ # Sections
163
+
164
+ Use bordered cards.
165
+
166
+ Avoid deeply nested layouts.
167
+
168
+ Use spacing to create hierarchy before introducing additional borders.
169
+
170
+ ---
171
+
172
+ # Navigation
173
+
174
+ Always use:
175
+
176
+ - Breadcrumbs
177
+ - Sidebar
178
+ - Top Navigation
179
+
180
+ Do not build custom navigation systems unless the project explicitly requires it.
181
+
182
+ ---
183
+
184
+ # Forms
185
+
186
+ Use VUI and shadcn/ui together.
187
+
188
+ Prefer:
189
+
190
+ - shadcn Form
191
+ - React Hook Form
192
+ - Zod
193
+
194
+ Every form should support:
195
+
196
+ - validation
197
+ - loading
198
+ - success
199
+ - error
200
+ - disabled
201
+ - keyboard navigation
202
+
203
+ Never rely on placeholders as labels.
204
+
205
+ ---
206
+
207
+ # Tables
208
+
209
+ Never build HTML tables.
210
+
211
+ Always use RecordView.
212
+
213
+ Use:
214
+
215
+ - editable
216
+ - required
217
+ - copyable
218
+ - options
219
+ - render
220
+
221
+ Allow RecordView to manage:
222
+
223
+ - sorting
224
+ - filtering
225
+ - pagination
226
+ - bulk actions
227
+ - import/export
228
+
229
+ ---
230
+
231
+ # Charts
232
+
233
+ Always build charts with:
234
+
235
+ ChartContainer
236
+
237
+ +
238
+
239
+ Recharts
240
+
241
+ Never hardcode chart colors.
242
+
243
+ Always map colors through chart tokens.
244
+
245
+ ---
246
+
247
+ # Authentication
248
+
249
+ The auth screens are a **demo pattern in the reference app**, not exports of the
250
+ `@viliha/vui-ui` package. `AuthCard`, `AuthCardHeader`, `AuthCardBody`,
251
+ `AuthCardFooter` and `AuthCardAside` live in
252
+ `apps/backoffice/app/_components/auth.tsx` — **copy and adapt them** into your
253
+ app (they are built from published primitives: `Button`, `Input`, tokens).
254
+
255
+ Do not `import … from "@viliha/vui-ui/auth"` — no such entry point exists.
256
+
257
+ Wrap forms with semantic HTML.
258
+
259
+ ---
260
+
261
+ # shadcn/ui Integration
262
+
263
+ VUI complements shadcn/ui.
264
+
265
+ Use shadcn for:
266
+
267
+ - forms
268
+ - dialogs
269
+ - sheets
270
+ - tabs
271
+ - popovers
272
+ - accordions
273
+
274
+ Use VUI for:
275
+
276
+ - layouts
277
+ - RecordView
278
+ - enterprise components
279
+ - charts
280
+ - navigation patterns
281
+
282
+ VUI owns the design tokens.
283
+
284
+ Remove duplicated token definitions generated by shadcn.
285
+
286
+ ---
287
+
288
+ # Accessibility
289
+
290
+ Every page should support:
291
+
292
+ - keyboard navigation
293
+ - visible focus
294
+ - ARIA attributes
295
+ - screen readers
296
+ - WCAG AA contrast
297
+
298
+ Accessibility is never optional.
299
+
300
+ ---
301
+
302
+ # Responsive Design
303
+
304
+ Design mobile first.
305
+
306
+ Support:
307
+
308
+ - Mobile
309
+ - Tablet
310
+ - Desktop
311
+ - Large Desktop
312
+
313
+ Avoid horizontal scrolling whenever possible.
314
+
315
+ ---
316
+
317
+ # Performance
318
+
319
+ Prefer:
320
+
321
+ - Server Components
322
+ - Streaming
323
+ - Lazy loading
324
+ - Dynamic imports
325
+
326
+ Avoid unnecessary client components.
327
+
328
+ Memoize only when needed.
329
+
330
+ ---
331
+
332
+ # UX Standards
333
+
334
+ Every feature should communicate its current state.
335
+
336
+ Support:
337
+
338
+ - Loading
339
+ - Success
340
+ - Empty
341
+ - Error
342
+
343
+ Long-running actions should provide visible progress.
344
+
345
+ Never leave users wondering what happened.
346
+
347
+ ---
348
+
349
+ # Naming
350
+
351
+ Prefer descriptive names.
352
+
353
+ Good
354
+
355
+ ```
356
+ OrganizationTable
357
+
358
+ InvoiceSummaryCard
359
+
360
+ UserSettingsForm
361
+
362
+ RevenueChart
363
+ ```
364
+
365
+ Avoid
366
+
367
+ ```
368
+ Card2
369
+
370
+ Widget
371
+
372
+ Thing
373
+
374
+ Data
375
+
376
+ Panel
377
+ ```
378
+
379
+ ---
380
+
381
+ # AI Development Rules
382
+
383
+ Before writing code:
384
+
385
+ 1. Reuse existing components.
386
+ 2. Reuse existing layouts.
387
+ 3. Reuse existing utilities.
388
+ 4. Reuse existing variants.
389
+ 5. Extend existing components before creating new ones.
390
+
391
+ Never duplicate code.
392
+
393
+ Never duplicate styling.
394
+
395
+ Keep APIs simple.
396
+
397
+ Keep components focused.
398
+
399
+ ---
400
+
401
+ # Definition of Done
402
+
403
+ A feature is complete only when:
404
+
405
+ ✓ Uses VUI components where appropriate.
406
+
407
+ ✓ Uses semantic design tokens.
408
+
409
+ ✓ Supports light and dark mode.
410
+
411
+ ✓ Supports responsive layouts.
412
+
413
+ ✓ Supports accessibility.
414
+
415
+ ✓ Includes loading, empty, success, and error states.
416
+
417
+ ✓ Keeps business logic outside UI components.
418
+
419
+ ✓ Introduces no duplicated code.
420
+
421
+ ✓ Introduces no duplicated styling.
422
+
423
+ ✓ Passes lint and type checking.
424
+
425
+ ✓ Is production ready.
package/README.md CHANGED
@@ -57,6 +57,14 @@ export function Example() {
57
57
  }
58
58
  ```
59
59
 
60
+ ## Building with an AI agent
61
+
62
+ This package ships an **AI-agent usage guide** at
63
+ `node_modules/@viliha/vui-ui/AGENT.md` — the standards to follow when generating
64
+ UI with VUI (token discipline, reuse-first, page layout, RecordView, a11y, dark
65
+ mode). Point your agent at it, or copy it into your repo as `AGENTS.md` so tools
66
+ auto-load it.
67
+
60
68
  ## Components
61
69
 
62
70
  `avatar` · `badge` · `button` · `card` · `chart` (themed Recharts wrapper) ·
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@viliha/vui-ui",
3
- "version": "1.0.9",
3
+ "version": "1.0.10",
4
4
  "description": "Vui UI — a clean, token-driven React admin/CRM component library built on Tailwind CSS v4, shadcn-style patterns, and Radix Icons. Ships as TypeScript source (Just-in-Time), compiled by the consuming app.",
5
5
  "license": "MIT",
6
6
  "author": "Suman Bonakurthi",
@@ -32,7 +32,8 @@
32
32
  "files": [
33
33
  "src",
34
34
  "!src/**/*.test.ts",
35
- "!src/**/*.test.tsx"
35
+ "!src/**/*.test.tsx",
36
+ "AGENT.md"
36
37
  ],
37
38
  "exports": {
38
39
  "./theme.css": "./src/theme.css",