@equal-experts/kuat-react 0.13.0 → 0.13.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.
Files changed (150) hide show
  1. package/agent-docs/AGENTS.md +10 -0
  2. package/agent-docs/README.md +17 -0
  3. package/agent-docs/bundle-manifest.json +63 -0
  4. package/agent-docs/components/_template.md +21 -0
  5. package/agent-docs/components/button-group.md +27 -0
  6. package/agent-docs/components/button.md +50 -0
  7. package/agent-docs/components/components.manifest.json +20 -0
  8. package/agent-docs/components/kuat-header.md +27 -0
  9. package/agent-docs/external/kuat-agent-rules/kuat-docs/rules/LOADING.md +166 -0
  10. package/agent-docs/external/kuat-agent-rules/kuat-docs/rules/foundations/accessibility.md +444 -0
  11. package/agent-docs/external/kuat-agent-rules/kuat-docs/rules/foundations/brand.md +99 -0
  12. package/agent-docs/external/kuat-agent-rules/kuat-docs/rules/foundations/content/README.md +28 -0
  13. package/agent-docs/external/kuat-agent-rules/kuat-docs/rules/foundations/content/formatting.md +93 -0
  14. package/agent-docs/external/kuat-agent-rules/kuat-docs/rules/foundations/content/numbers.md +69 -0
  15. package/agent-docs/external/kuat-agent-rules/kuat-docs/rules/foundations/content/punctuation.md +75 -0
  16. package/agent-docs/external/kuat-agent-rules/kuat-docs/rules/foundations/content/voice-and-tone.md +263 -0
  17. package/agent-docs/external/kuat-agent-rules/kuat-docs/rules/foundations/content/writing-style.md +91 -0
  18. package/agent-docs/external/kuat-agent-rules/kuat-docs/rules/foundations/design/README.md +28 -0
  19. package/agent-docs/external/kuat-agent-rules/kuat-docs/rules/foundations/design/borders.md +159 -0
  20. package/agent-docs/external/kuat-agent-rules/kuat-docs/rules/foundations/design/colours.md +173 -0
  21. package/agent-docs/external/kuat-agent-rules/kuat-docs/rules/foundations/design/design-language.md +116 -0
  22. package/agent-docs/external/kuat-agent-rules/kuat-docs/rules/foundations/design/spacing.md +130 -0
  23. package/agent-docs/external/kuat-agent-rules/kuat-docs/rules/foundations/design/typography.md +155 -0
  24. package/agent-docs/external/kuat-agent-rules/kuat-docs/rules/foundations/logo.md +151 -0
  25. package/agent-docs/external/kuat-agent-rules/kuat-docs/rules/types/web/marketing/content/README.md +26 -0
  26. package/agent-docs/external/kuat-agent-rules/kuat-docs/rules/types/web/marketing/content/blog-posts.md +33 -0
  27. package/agent-docs/external/kuat-agent-rules/kuat-docs/rules/types/web/marketing/content/marketing-content.md +65 -0
  28. package/agent-docs/external/kuat-agent-rules/kuat-docs/rules/types/web/marketing/content/seo.md +44 -0
  29. package/agent-docs/external/kuat-agent-rules/kuat-docs/rules/types/web/marketing/emails.md +74 -0
  30. package/agent-docs/external/kuat-agent-rules/kuat-docs/rules/types/web/marketing/scenarios/README.md +18 -0
  31. package/agent-docs/external/kuat-agent-rules/kuat-docs/rules/types/web/marketing/scenarios/marketing-pages.md +368 -0
  32. package/agent-docs/external/kuat-agent-rules/kuat-docs/rules/types/web/marketing/website.md +169 -0
  33. package/agent-docs/external/kuat-agent-rules/kuat-docs/rules/types/web/product/DEPRECATIONS.md +28 -0
  34. package/agent-docs/external/kuat-agent-rules/kuat-docs/rules/types/web/product/README.md +65 -0
  35. package/agent-docs/external/kuat-agent-rules/kuat-docs/rules/types/web/product/accessibility.md +402 -0
  36. package/agent-docs/external/kuat-agent-rules/kuat-docs/rules/types/web/product/component-decision-tree.md +263 -0
  37. package/agent-docs/external/kuat-agent-rules/kuat-docs/rules/types/web/product/component-registry.md +68 -0
  38. package/agent-docs/external/kuat-agent-rules/kuat-docs/rules/types/web/product/content/README.md +29 -0
  39. package/agent-docs/external/kuat-agent-rules/kuat-docs/rules/types/web/product/content/actions.md +51 -0
  40. package/agent-docs/external/kuat-agent-rules/kuat-docs/rules/types/web/product/content/confirmations.md +57 -0
  41. package/agent-docs/external/kuat-agent-rules/kuat-docs/rules/types/web/product/content/empty-states.md +43 -0
  42. package/agent-docs/external/kuat-agent-rules/kuat-docs/rules/types/web/product/content/errors.md +54 -0
  43. package/agent-docs/external/kuat-agent-rules/kuat-docs/rules/types/web/product/content/forms.md +74 -0
  44. package/agent-docs/external/kuat-agent-rules/kuat-docs/rules/types/web/product/content/product-content.md +138 -0
  45. package/agent-docs/external/kuat-agent-rules/kuat-docs/rules/types/web/product/design.md +207 -0
  46. package/agent-docs/external/kuat-agent-rules/kuat-docs/rules/types/web/product/emails.md +71 -0
  47. package/agent-docs/external/kuat-agent-rules/kuat-docs/rules/types/web/product/review-checklist.md +57 -0
  48. package/agent-docs/external/kuat-agent-rules/kuat-docs/rules/types/web/product/review-context.md +44 -0
  49. package/agent-docs/external/kuat-agent-rules/kuat-docs/rules/types/web/product/scenarios/README.md +82 -0
  50. package/agent-docs/external/kuat-agent-rules/kuat-docs/rules/types/web/product/scenarios/authentication.md +303 -0
  51. package/agent-docs/external/kuat-agent-rules/kuat-docs/rules/types/web/product/scenarios/dashboards.md +313 -0
  52. package/agent-docs/external/kuat-agent-rules/kuat-docs/rules/types/web/product/scenarios/documentation.md +333 -0
  53. package/agent-docs/external/kuat-agent-rules/kuat-docs/rules/types/web/product/scenarios/forms.md +361 -0
  54. package/agent-docs/external/kuat-agent-rules/kuat-docs/rules/types/web/product/technical.md +488 -0
  55. package/agent-docs/kuat-docs/rules/README.md +148 -0
  56. package/agent-docs/kuat-docs/rules/design/layouts.md +394 -0
  57. package/agent-docs/kuat-docs/rules/scenarios/README.md +83 -0
  58. package/agent-docs/kuat-docs/rules/scenarios/authentication.md +301 -0
  59. package/agent-docs/kuat-docs/rules/scenarios/dashboards.md +314 -0
  60. package/agent-docs/kuat-docs/rules/scenarios/documentation.md +333 -0
  61. package/agent-docs/kuat-docs/rules/scenarios/forms.md +359 -0
  62. package/agent-docs/kuat-docs/rules/scenarios/marketing-pages.md +367 -0
  63. package/agent-docs/manifest.json +9 -0
  64. package/agent-docs/rules/LOADING-consumer.md +27 -0
  65. package/dist/accordion.d.ts +2 -0
  66. package/dist/alert-dialog.d.ts +2 -0
  67. package/dist/badge.d.ts +3 -0
  68. package/dist/button-group.d.ts +2 -0
  69. package/dist/button.d.ts +3 -0
  70. package/dist/carousel.d.ts +2 -0
  71. package/dist/checkbox.d.ts +3 -0
  72. package/dist/components/ui/accordion/accordion.d.ts +7 -0
  73. package/dist/components/ui/accordion/index.d.ts +1 -0
  74. package/dist/components/ui/alert-dialog/alert-dialog.d.ts +20 -0
  75. package/dist/components/ui/alert-dialog/index.d.ts +1 -0
  76. package/dist/components/ui/badge/badge.d.ts +16 -0
  77. package/dist/components/ui/badge/index.d.ts +2 -0
  78. package/dist/components/ui/breadcrumb/Breadcrumb.d.ts +29 -0
  79. package/dist/components/ui/breadcrumb/breadcrumb-primitives.d.ts +19 -0
  80. package/dist/components/ui/breadcrumb/index.d.ts +4 -0
  81. package/dist/components/ui/button/button.d.ts +27 -0
  82. package/dist/components/ui/button/index.d.ts +2 -0
  83. package/dist/components/ui/button-group/button-group.d.ts +23 -0
  84. package/dist/components/ui/button-group/index.d.ts +2 -0
  85. package/dist/components/ui/carousel/carousel.d.ts +50 -0
  86. package/dist/components/ui/carousel/index.d.ts +2 -0
  87. package/dist/components/ui/checkbox/checkbox-field.d.ts +23 -0
  88. package/dist/components/ui/checkbox/checkbox.d.ts +5 -0
  89. package/dist/components/ui/checkbox/index.d.ts +4 -0
  90. package/dist/components/ui/content-card/content-card.d.ts +29 -0
  91. package/dist/components/ui/content-card/index.d.ts +2 -0
  92. package/dist/components/ui/dropdown-menu/dropdown-menu.d.ts +27 -0
  93. package/dist/components/ui/dropdown-menu/index.d.ts +1 -0
  94. package/dist/components/ui/ee-logo-icon/ee-logo-icon.d.ts +11 -0
  95. package/dist/components/ui/ee-logo-icon/index.d.ts +2 -0
  96. package/dist/components/ui/field/field.d.ts +28 -0
  97. package/dist/components/ui/field/index.d.ts +2 -0
  98. package/dist/components/ui/icon-button/icon-button.d.ts +27 -0
  99. package/dist/components/ui/icon-button/index.d.ts +2 -0
  100. package/dist/components/ui/input/index.d.ts +2 -0
  101. package/dist/components/ui/input/input.d.ts +20 -0
  102. package/dist/components/ui/kuat-carousel/index.d.ts +2 -0
  103. package/dist/components/ui/kuat-carousel/kuat-carousel.d.ts +16 -0
  104. package/dist/components/ui/kuat-header/index.d.ts +4 -0
  105. package/dist/components/ui/kuat-header/kuat-header.d.ts +16 -0
  106. package/dist/components/ui/kuat-header/kuat-header.logic.d.ts +32 -0
  107. package/dist/components/ui/kuat-header/kuat-header.types.d.ts +91 -0
  108. package/dist/components/ui/kuat-logo-lockup/index.d.ts +2 -0
  109. package/dist/components/ui/kuat-logo-lockup/kuat-logo-lockup.d.ts +17 -0
  110. package/dist/components/ui/kuat-radial-progress/index.d.ts +2 -0
  111. package/dist/components/ui/kuat-radial-progress/kuat-radial-progress.d.ts +16 -0
  112. package/dist/components/ui/radio/index.d.ts +4 -0
  113. package/dist/components/ui/radio/radio-field.d.ts +25 -0
  114. package/dist/components/ui/radio/radio.d.ts +7 -0
  115. package/dist/components/ui/select/constants.d.ts +19 -0
  116. package/dist/components/ui/select/index.d.ts +3 -0
  117. package/dist/components/ui/select/select.d.ts +53 -0
  118. package/dist/components/ui/separator/index.d.ts +2 -0
  119. package/dist/components/ui/separator/separator.d.ts +9 -0
  120. package/dist/components/ui/sonner/index.d.ts +4 -0
  121. package/dist/components/ui/sonner/sonner-content.d.ts +15 -0
  122. package/dist/components/ui/sonner/sonner.d.ts +21 -0
  123. package/dist/components/ui/switch/index.d.ts +4 -0
  124. package/dist/components/ui/switch/switch-field.d.ts +23 -0
  125. package/dist/components/ui/switch/switch.d.ts +5 -0
  126. package/dist/components/ui/textarea/index.d.ts +2 -0
  127. package/dist/components/ui/textarea/textarea.d.ts +9 -0
  128. package/dist/components/ui/toggle/constants.d.ts +4 -0
  129. package/dist/components/ui/toggle/index.d.ts +6 -0
  130. package/dist/components/ui/toggle/toggle-group.d.ts +11 -0
  131. package/dist/components/ui/toggle/toggle.d.ts +9 -0
  132. package/dist/field.d.ts +3 -0
  133. package/dist/icon-button.d.ts +3 -0
  134. package/dist/index.d.ts +47 -0
  135. package/dist/input.d.ts +3 -0
  136. package/dist/kuat-carousel.d.ts +2 -0
  137. package/dist/kuat-radial-progress.d.ts +7 -0
  138. package/dist/lib/react-node-compat.d.ts +7 -0
  139. package/dist/lib/utils.d.ts +3 -0
  140. package/dist/radio.d.ts +3 -0
  141. package/dist/select.d.ts +3 -0
  142. package/dist/sonner.d.ts +1 -0
  143. package/dist/style.css +1 -1
  144. package/dist/style.css.d.ts +2 -0
  145. package/dist/switch.d.ts +1 -0
  146. package/dist/test/setup.d.ts +1 -0
  147. package/dist/textarea.d.ts +3 -0
  148. package/dist/toggle-group.d.ts +3 -0
  149. package/dist/toggle.d.ts +3 -0
  150. package/package.json +4 -2
@@ -0,0 +1,402 @@
1
+ ---
2
+ scope: type
3
+ platform: web_product
4
+ prerequisites: foundations/accessibility.md
5
+ ---
6
+
7
+ # Technical Accessibility
8
+
9
+ Implementation rules for WCAG 2.2 AA compliance in web applications.
10
+
11
+ ---
12
+
13
+ **Prerequisites:** Load [foundations accessibility](../../../foundations/accessibility.md) first.
14
+
15
+ ---
16
+
17
+ ## Quick reference
18
+
19
+ - **Semantic HTML:** Use `<button>`, `<a href>`, `<input>`, headings, lists, tables; avoid div/span for interactive or structural meaning.
20
+ - **Keyboard:** All interactive elements focusable; logical focus order; visible focus (e.g. ring tokens); no traps; Escape closes modals.
21
+ - **Focus:** Modals trap focus, return focus on close, initial focus on first interactive element or title.
22
+ - **ARIA:** Use only when native HTML is insufficient; prefer native over ARIA.
23
+ - **Landmarks:** Use `<main>`, `<nav>`, `<header>`, `<footer>`; one `<main>` per page.
24
+ - **Forms:** Visible labels, required/error states, clear error messages, no time limits unless necessary.
25
+ - **Touch:** Minimum 44×44px touch targets; support viewport zoom.
26
+ - **Motion:** Respect `prefers-reduced-motion`; provide static alternative.
27
+
28
+ *Full detail follows.*
29
+
30
+ ---
31
+
32
+ ## Overview
33
+
34
+ Technical accessibility ensures that interfaces work correctly with assistive technologies and can be operated by all users regardless of input method.
35
+
36
+ **Key principle:** Use native HTML elements correctly before reaching for ARIA.
37
+
38
+ ---
39
+
40
+ ## Semantic HTML
41
+
42
+ ### Use Appropriate Elements
43
+
44
+ | Purpose | Use | Don't Use |
45
+ |---------|-----|-----------|
46
+ | Buttons (actions) | `<button>` | `<div onclick>` |
47
+ | Links (navigation) | `<a href>` | `<span onclick>` |
48
+ | Text input | `<input>` | `<div contenteditable>` |
49
+ | Lists | `<ul>`, `<ol>`, `<dl>` | Divs with manual bullets |
50
+ | Headings | `<h1>` - `<h6>` | Styled `<div>` or `<p>` |
51
+ | Tables | `<table>` with `<th>` | Grid of divs |
52
+
53
+ ### Heading Hierarchy
54
+
55
+ - One `<h1>` per page (the main title)
56
+ - Never skip heading levels (H1 → H2 → H3)
57
+ - Headings create document outline for screen readers
58
+ - Use CSS for visual styling, not heading levels
59
+
60
+ ### Native Over ARIA
61
+
62
+ > "The first rule of ARIA is: don't use ARIA if you can use native HTML."
63
+
64
+ Native elements have built-in accessibility:
65
+ - Keyboard support
66
+ - Focus management
67
+ - Screen reader announcements
68
+ - Form validation
69
+
70
+ ---
71
+
72
+ ## Keyboard Navigation
73
+
74
+ ### Requirements
75
+
76
+ - All interactive elements must be focusable
77
+ - Focus order must be logical (follows DOM order)
78
+ - Visible focus indicators at all times
79
+ - No keyboard traps (user can always tab away)
80
+
81
+ ### Standard Key Bindings
82
+
83
+ | Key | Action |
84
+ |-----|--------|
85
+ | Tab | Move focus to next interactive element |
86
+ | Shift + Tab | Move focus to previous element |
87
+ | Enter | Activate buttons and links |
88
+ | Space | Activate buttons, toggle checkboxes |
89
+ | Escape | Close modals, menus, dropdowns |
90
+ | Arrow keys | Navigate within components (menus, tabs, radio groups) |
91
+
92
+ ### Focus Indicators
93
+
94
+ - Use Kuat's `ring` tokens for focus styling
95
+ - Focus must be visible in both light and dark modes
96
+ - Never use `outline: none` without replacement
97
+ - Ensure 3:1 contrast ratio for focus indicator
98
+
99
+ ```css
100
+ /* Kuat focus pattern */
101
+ :focus-visible {
102
+ outline: 2px solid hsl(var(--ring));
103
+ outline-offset: 2px;
104
+ }
105
+ ```
106
+
107
+ ---
108
+
109
+ ## Focus Management
110
+
111
+ ### General Rules
112
+
113
+ - Focus should be visible at all times
114
+ - Focus order should match visual order
115
+ - Don't move focus unexpectedly
116
+
117
+ ### Modals and Dialogs
118
+
119
+ 1. **Trap focus** - Focus stays within modal while open
120
+ 2. **Initial focus** - Move focus to first interactive element (or modal title)
121
+ 3. **Return focus** - When closed, return focus to trigger element
122
+ 4. **Escape to close** - Always support Escape key
123
+
124
+ ### Dynamic Content
125
+
126
+ - When content updates, consider if focus should move
127
+ - Announce important changes to screen readers
128
+ - Don't auto-focus unless user-initiated
129
+
130
+ ### Skip Links
131
+
132
+ For pages with significant navigation:
133
+
134
+ ```html
135
+ <a href="#main-content" class="skip-link">
136
+ Skip to main content
137
+ </a>
138
+ ```
139
+
140
+ - Position visually hidden until focused
141
+ - First focusable element on page
142
+ - Target the main content area
143
+
144
+ ---
145
+
146
+ ## ARIA
147
+
148
+ Use ARIA only when native HTML is insufficient.
149
+
150
+ ### Common ARIA Attributes
151
+
152
+ | Pattern | Attributes | Usage |
153
+ |---------|------------|-------|
154
+ | Loading state | `aria-busy="true"` | While content is loading |
155
+ | Disabled | `aria-disabled="true"` | When action unavailable (prefer native `disabled`) |
156
+ | Expanded | `aria-expanded="true/false"` | Accordions, dropdowns, menus |
157
+ | Current | `aria-current="page"` | Current page in navigation |
158
+ | Modal | `role="dialog"`, `aria-modal="true"` | Modal dialogs |
159
+ | Live regions | `aria-live="polite/assertive"` | Dynamic content updates |
160
+
161
+ ### Error States
162
+
163
+ | Attribute | Purpose |
164
+ |-----------|---------|
165
+ | `aria-invalid="true"` | Mark field as invalid |
166
+ | `aria-describedby="error-id"` | Link field to error message |
167
+ | `aria-errormessage="error-id"` | Alternative to describedby (newer) |
168
+
169
+ ### Labels and Descriptions
170
+
171
+ | Attribute | Use When |
172
+ |-----------|----------|
173
+ | `aria-label` | No visible text label available |
174
+ | `aria-labelledby` | Label exists elsewhere on page |
175
+ | `aria-describedby` | Additional descriptive text (hints, errors) |
176
+
177
+ ---
178
+
179
+ ## Landmark Roles
180
+
181
+ Landmarks help screen reader users navigate page structure.
182
+
183
+ ### Required Landmarks
184
+
185
+ | Landmark | HTML Element | Role |
186
+ |----------|--------------|------|
187
+ | Banner | `<header>` | `role="banner"` |
188
+ | Main | `<main>` | `role="main"` |
189
+ | Navigation | `<nav>` | `role="navigation"` |
190
+ | Footer | `<footer>` | `role="contentinfo"` |
191
+ | Search | - | `role="search"` |
192
+ | Complementary | `<aside>` | `role="complementary"` |
193
+
194
+ ### Rules
195
+
196
+ - **One `<main>` per page** - The primary content area
197
+ - Use semantic HTML elements (they have implicit roles)
198
+ - Multiple `<nav>` elements should have unique `aria-label`
199
+ - `<header>` as direct child of `<body>` = banner role
200
+
201
+ ### Example Structure
202
+
203
+ ```html
204
+ <body>
205
+ <header><!-- banner --></header>
206
+ <nav aria-label="Main"><!-- navigation --></nav>
207
+ <main><!-- main content --></main>
208
+ <aside><!-- complementary --></aside>
209
+ <footer><!-- contentinfo --></footer>
210
+ </body>
211
+ ```
212
+
213
+ ---
214
+
215
+ ## Forms
216
+
217
+ ### Labels
218
+
219
+ - Every input **must** have an associated `<label>`
220
+ - Use `for` attribute matching input `id`
221
+ - Never use placeholder as the only label
222
+
223
+ ```html
224
+ <label for="email">Email address</label>
225
+ <input type="email" id="email" name="email" />
226
+ ```
227
+
228
+ ### Required Fields
229
+
230
+ - Mark required fields visually (asterisk *)
231
+ - Use `aria-required="true"` or `required` attribute
232
+ - Explain required field indicator at form start
233
+
234
+ ### Error Handling
235
+
236
+ - Link error messages to fields with `aria-describedby`
237
+ - Use `aria-invalid="true"` on invalid fields
238
+ - Provide clear, actionable error messages
239
+
240
+ ```html
241
+ <label for="email">Email address *</label>
242
+ <input
243
+ type="email"
244
+ id="email"
245
+ aria-describedby="email-error"
246
+ aria-invalid="true"
247
+ />
248
+ <p id="email-error" class="text-destructive">
249
+ Please enter a valid email address
250
+ </p>
251
+ ```
252
+
253
+ ### Form Validation Pattern
254
+
255
+ **Validate on submit, not on blur:**
256
+
257
+ | Rule | Rationale |
258
+ |------|-----------|
259
+ | **Validate on submit** | Show all errors after form submission attempt |
260
+ | **Never disable submit buttons** | Users should always be able to attempt submission |
261
+ | **No inline validation on blur** | Don't interrupt users mid-flow |
262
+ | **Error summary at top** | Show summary with links to invalid fields |
263
+ | **Focus first invalid field** | After failed submission, move focus to first error |
264
+
265
+ ### Grouping
266
+
267
+ - Group related fields with `<fieldset>` and `<legend>`
268
+ - Use for radio button groups, checkbox groups, address fields
269
+
270
+ ```html
271
+ <fieldset>
272
+ <legend>Notification preferences</legend>
273
+ <!-- related checkboxes -->
274
+ </fieldset>
275
+ ```
276
+
277
+ ### Time Limits
278
+
279
+ - No time limits on form completion (or provide generous extensions)
280
+ - Warn users before session timeout
281
+ - Allow users to extend or disable timeouts
282
+
283
+ ---
284
+
285
+ ## Responsive Design
286
+
287
+ ### Orientation
288
+
289
+ - Content must work in both portrait and landscape
290
+ - Don't restrict orientation unless essential (e.g., piano app)
291
+
292
+ ### Viewport
293
+
294
+ - No horizontal scrolling at 320px viewport width
295
+ - Content must reflow, not require two-dimensional scrolling
296
+ - Exception: data tables, images, maps may scroll horizontally
297
+
298
+ ### Touch Targets
299
+
300
+ | Context | Minimum Size |
301
+ |---------|--------------|
302
+ | Mobile touch targets | 44x44px |
303
+ | Spacing between targets | 8px minimum |
304
+ | Desktop click targets | 24x24px minimum |
305
+
306
+ ### Text Scaling
307
+
308
+ - Support text scaling up to 200%
309
+ - Use relative units (`rem`, `em`) not fixed `px` for fonts
310
+ - Test at browser zoom 200%
311
+
312
+ ---
313
+
314
+ ## Page Requirements
315
+
316
+ ### Page Titles
317
+
318
+ - Every page needs a unique, descriptive `<title>`
319
+ - Format: "Page Name | Site Name"
320
+ - Helps users identify pages in tabs and history
321
+
322
+ ### Language
323
+
324
+ - Declare page language: `<html lang="en">`
325
+ - Mark language changes inline: `<span lang="fr">Bonjour</span>`
326
+ - Helps screen readers pronounce content correctly
327
+
328
+ ### Consistent Navigation
329
+
330
+ - Navigation must appear in same location across pages
331
+ - Same components should behave consistently
332
+ - Don't rearrange navigation unexpectedly
333
+
334
+ ### Multiple Navigation Methods
335
+
336
+ Provide multiple ways to find content:
337
+
338
+ - Navigation menus
339
+ - Search functionality
340
+ - Site map
341
+ - Breadcrumbs
342
+
343
+ ---
344
+
345
+ ## Motion and Reduced Motion
346
+
347
+ Respect user preferences for reduced motion:
348
+
349
+ ```css
350
+ @media (prefers-reduced-motion: reduce) {
351
+ * {
352
+ animation-duration: 0.01ms !important;
353
+ transition-duration: 0.01ms !important;
354
+ }
355
+ }
356
+ ```
357
+
358
+ ### Kuat Implementation
359
+
360
+ Kuat components automatically respect `prefers-reduced-motion`. When building custom animations:
361
+
362
+ - Check for reduced motion preference
363
+ - Provide static alternatives
364
+ - Never use motion for essential information
365
+
366
+ ---
367
+
368
+ ## Testing Checklist
369
+
370
+ ### Keyboard Testing
371
+
372
+ - [ ] Can reach all interactive elements with Tab
373
+ - [ ] Focus order is logical
374
+ - [ ] Focus indicator is visible
375
+ - [ ] Can activate buttons/links with Enter/Space
376
+ - [ ] Can close modals with Escape
377
+ - [ ] No keyboard traps
378
+
379
+ ### Screen Reader Testing
380
+
381
+ - [ ] Page has descriptive title
382
+ - [ ] Headings create logical outline
383
+ - [ ] Images have appropriate alt text
384
+ - [ ] Links and buttons have clear labels
385
+ - [ ] Form fields are labelled
386
+ - [ ] Error messages are announced
387
+
388
+ ### Visual Testing
389
+
390
+ - [ ] Content visible at 200% zoom
391
+ - [ ] Works in both orientations
392
+ - [ ] Colour contrast meets requirements
393
+ - [ ] Information not conveyed by colour alone
394
+
395
+ ---
396
+
397
+ ## Related Documentation
398
+
399
+ - [Foundations Accessibility](../../../foundations/accessibility.md) - Principles and guidelines
400
+ - [Component Decision Tree](./component-decision-tree.md) - Component selection and patterns
401
+ - [Product Design](./design.md) - Layout patterns
402
+ - [Product Scenarios](./scenarios/) - Applied patterns for specific page types
@@ -0,0 +1,263 @@
1
+ ---
2
+ scope: type
3
+ platform: web_product
4
+ prerequisites: foundations
5
+ ---
6
+
7
+ # Component Decision Tree
8
+
9
+ Component selection and development patterns for Equal Experts web applications.
10
+
11
+ ---
12
+
13
+ **Prerequisites:** Load [foundations](../../../foundations/) first.
14
+
15
+ ---
16
+
17
+ ## Overview
18
+
19
+ When building UI for web applications, follow this priority order to ensure consistency and reduce maintenance burden.
20
+
21
+ ---
22
+
23
+ ## Component Decision Framework
24
+
25
+ | Priority | Source | When to Use |
26
+ |----------|--------|-------------|
27
+ | 1 | **Kuat Blocks** | Pre-built compositions (header, footer, search patterns) |
28
+ | 2 | **Kuat Components** | Custom components not in shadcn (ButtonGroup) |
29
+ | 3 | **shadcn Components** | Standard UI components, themed via kuat-core |
30
+ | 4 | **Custom Build** | Only when none of the above fit your needs |
31
+
32
+ ---
33
+
34
+ ## When to Use Each Source
35
+
36
+ ### Kuat Blocks
37
+
38
+ Pre-built compositions that combine multiple components:
39
+ - `KuatHeader` - Application header with logo and navigation
40
+ - `KuatFooter` - Application footer
41
+ - `KuatSearchPattern` - Search with filters and results
42
+
43
+ **Use when:** You need a complete, pre-built pattern that follows brand guidelines.
44
+
45
+ ### Kuat Components
46
+
47
+ Custom components unique to the design system:
48
+ - `ButtonGroup` - Group of related buttons
49
+ - Other components not available in shadcn
50
+
51
+ **Use when:** The component doesn't exist in shadcn but is needed across multiple applications.
52
+
53
+ ### shadcn Components
54
+
55
+ Standard UI components installed via CLI:
56
+ - Button, Dialog, Dropdown, Card, etc.
57
+ - Themed automatically via kuat-core CSS variables
58
+
59
+ **Use when:**
60
+ - The component exists in shadcn
61
+ - You only need theming changes (handled by kuat-core)
62
+ - You need to customize the component code for your specific app
63
+
64
+ ### Custom Build
65
+
66
+ Build from scratch only when:
67
+ - None of the above fit your needs
68
+ - The pattern is unique to your application
69
+ - You've confirmed no existing component can be adapted
70
+
71
+ ---
72
+
73
+ ## Per-component guides
74
+
75
+ Usage, variants, API, and accessibility for each primitive are **not** duplicated in this upstream file. Resolve by stable ID:
76
+
77
+ | ID | Guide location |
78
+ |----|----------------|
79
+ | `shadcn:button` | Package or overlay `components/button.md` |
80
+ | `kuat:button-group` | `components/button-group.md` |
81
+ | `kuat:kuat-header` | `components/kuat-header.md` |
82
+
83
+ 1. Look up IDs in [component-registry.md](./component-registry.md).
84
+ 2. Resolve path via `COMPONENT_MANIFEST` (`ensure-rules.sh` output) or `{RULES_ROOT}/agent-docs/components.manifest.json`.
85
+ 3. Load only the component docs referenced by the current task or artifact.
86
+
87
+ Architecture: [consumption-architecture.md](../../../../setup/consumption-architecture.md).
88
+
89
+ ---
90
+
91
+ ## Component Naming Conventions
92
+
93
+ ### Components
94
+
95
+ | Element | Convention | Example |
96
+ |---------|------------|---------|
97
+ | Component names | PascalCase | `Button`, `AlertDialog`, `Card` |
98
+ | File names | Match component | `Button.tsx`, `Button.vue` |
99
+ | Compound components | Parent.Child | `Card.Header`, `Dialog.Content` |
100
+
101
+ ### Props and Variants
102
+
103
+ | Element | Convention | Example |
104
+ |---------|------------|---------|
105
+ | Prop names | camelCase | `variant`, `size`, `isDisabled` |
106
+ | Variant values | camelCase | `default`, `destructive`, `outline` |
107
+ | Boolean props | is/has prefix | `isOpen`, `hasError`, `isLoading` |
108
+
109
+ ### Kuat Namespace
110
+
111
+ | Type | Naming | Example |
112
+ |------|--------|---------|
113
+ | Custom components | No prefix needed | `ButtonGroup`, `Separator` |
114
+ | Blocks (compositions) | `Kuat` prefix | `KuatHeader`, `KuatFooter` |
115
+ | Kuat-specific variants | `kuat-` prefix | `variant="kuat-cta"` |
116
+
117
+ ---
118
+
119
+ ## Variant Architecture
120
+
121
+ ### Using class-variance-authority (CVA)
122
+
123
+ All components with visual variants should use CVA:
124
+
125
+ ```typescript
126
+ cva(baseClasses, {
127
+ variants: {
128
+ variant: { ... },
129
+ size: { ... },
130
+ },
131
+ defaultVariants: { ... }
132
+ })
133
+ ```
134
+
135
+ ### Standard Variants
136
+
137
+ Most interactive components should support:
138
+
139
+ | Variant | Purpose | Common Values |
140
+ |---------|---------|---------------|
141
+ | `variant` | Visual style | `default`, `destructive`, `outline`, `secondary`, `ghost`, `link` |
142
+ | `size` | Dimension | `default`, `sm`, `lg`, `icon` |
143
+
144
+ ### Default Variants
145
+
146
+ Always specify `defaultVariants`:
147
+
148
+ | Variant | Default Value |
149
+ |---------|---------------|
150
+ | `variant` | `default` |
151
+ | `size` | `default` |
152
+
153
+ ---
154
+
155
+ ## Accessibility Requirements
156
+
157
+ ### Semantic HTML
158
+
159
+ - Use appropriate HTML elements (`<button>`, `<a>`, `<input>`)
160
+ - Don't use `<div>` for interactive elements
161
+ - Use proper heading hierarchy (`h1` → `h2` → `h3`)
162
+
163
+ ### Keyboard Navigation
164
+
165
+ - All interactive elements must be focusable
166
+ - Focus order should be logical
167
+ - Escape key closes modals/dialogs
168
+ - Enter/Space activates buttons
169
+ - Arrow keys navigate within groups
170
+
171
+ ### ARIA Attributes
172
+
173
+ | Scenario | Required Attributes |
174
+ |----------|---------------------|
175
+ | Loading state | `aria-busy="true"` |
176
+ | Disabled state | `aria-disabled="true"` or `disabled` |
177
+ | Expanded state | `aria-expanded="true/false"` |
178
+ | Modal dialogs | `role="dialog"`, `aria-modal="true"` |
179
+ | Error states | `aria-invalid="true"`, `aria-describedby` |
180
+
181
+ ### Focus Management
182
+
183
+ - Visible focus indicators (use `ring` tokens)
184
+ - Focus trapped in modals
185
+ - Focus returned when modals close
186
+ - Skip links for complex layouts
187
+
188
+ ---
189
+
190
+ ## Styling Rules
191
+
192
+ ### Design Tokens
193
+
194
+ - Use semantic color tokens (`bg-primary`, not `#0066CC`)
195
+ - Use spacing scale (`p-4`, not `padding: 17px`)
196
+ - Use border radius rules (0px/4px/6px)
197
+
198
+ ### The cn() Utility
199
+
200
+ Always use `cn()` for className merging:
201
+
202
+ ```tsx
203
+ import { cn } from "@/lib/utils"
204
+
205
+ <button className={cn(
206
+ "base-classes",
207
+ variant === "primary" && "primary-classes",
208
+ className
209
+ )} />
210
+ ```
211
+
212
+ ### State Styling
213
+
214
+ | State | Pattern |
215
+ |-------|---------|
216
+ | Hover | `hover:bg-{color}/90` |
217
+ | Focus | `focus:ring-2 focus:ring-ring` |
218
+ | Disabled | `disabled:opacity-50 disabled:pointer-events-none` |
219
+ | Active | `active:bg-{color}/80` |
220
+
221
+ ---
222
+
223
+ ## Testing Checklist
224
+
225
+ Before shipping a component, verify:
226
+
227
+ ### Functionality
228
+ - [ ] All variants render correctly
229
+ - [ ] Default props work
230
+ - [ ] Custom className can be passed
231
+ - [ ] Component ref is forwarded (React)
232
+
233
+ ### Types
234
+ - [ ] Props are properly typed
235
+ - [ ] Types are exported
236
+ - [ ] No TypeScript errors
237
+
238
+ ### Accessibility
239
+ - [ ] Keyboard navigation works
240
+ - [ ] Screen reader announces correctly
241
+ - [ ] Focus visible and logical
242
+ - [ ] ARIA attributes present
243
+
244
+ ### Styling
245
+ - [ ] Uses design tokens
246
+ - [ ] Works in light and dark mode
247
+ - [ ] Responsive if applicable
248
+ - [ ] Matches design specifications
249
+
250
+ ### Edge Cases
251
+ - [ ] Long text handled
252
+ - [ ] Empty states handled
253
+ - [ ] Loading states (if applicable)
254
+ - [ ] Error states (if applicable)
255
+
256
+ ---
257
+
258
+ ## Related Documentation
259
+
260
+ - [Accessibility](./accessibility.md) - Technical accessibility implementation
261
+ - [Technical Guidelines](./technical.md) - Setup and integration
262
+ - [Design Rules](./design.md) - Layout and visual design
263
+ - [Examples](./examples/) - Framework-specific code examples