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