@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.
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 +55 -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 +23 -0
  8. package/agent-docs/components/kuat-header.md +27 -0
  9. package/agent-docs/external/kuat-agent-rules/reference/accessibility/README.md +7 -0
  10. package/agent-docs/external/kuat-agent-rules/reference/accessibility/accessibility.md +446 -0
  11. package/agent-docs/external/kuat-agent-rules/reference/brand/README.md +9 -0
  12. package/agent-docs/external/kuat-agent-rules/reference/brand/brand.md +109 -0
  13. package/agent-docs/external/kuat-agent-rules/reference/brand/logo.md +152 -0
  14. package/agent-docs/external/kuat-agent-rules/reference/brand/voice-and-tone.md +166 -0
  15. package/agent-docs/external/kuat-agent-rules/reference/content/README.md +12 -0
  16. package/agent-docs/external/kuat-agent-rules/reference/content/formatting.md +120 -0
  17. package/agent-docs/external/kuat-agent-rules/reference/content/numbers.md +87 -0
  18. package/agent-docs/external/kuat-agent-rules/reference/content/punctuation.md +94 -0
  19. package/agent-docs/external/kuat-agent-rules/reference/content/writing-style.md +96 -0
  20. package/agent-docs/external/kuat-agent-rules/reference/design-language/README.md +11 -0
  21. package/agent-docs/external/kuat-agent-rules/reference/design-language/borders.md +160 -0
  22. package/agent-docs/external/kuat-agent-rules/reference/design-language/colours.md +201 -0
  23. package/agent-docs/external/kuat-agent-rules/reference/design-language/design-language.md +117 -0
  24. package/agent-docs/external/kuat-agent-rules/reference/design-language/spacing.md +131 -0
  25. package/agent-docs/external/kuat-agent-rules/reference/design-language/tokens/README.md +29 -0
  26. package/agent-docs/external/kuat-agent-rules/reference/design-language/tokens/colors.tokens.json +84 -0
  27. package/agent-docs/external/kuat-agent-rules/reference/design-language/typography.md +156 -0
  28. package/agent-docs/external/kuat-agent-rules/reference/media-types/web-marketing/README.md +10 -0
  29. package/agent-docs/external/kuat-agent-rules/reference/media-types/web-marketing/content/README.md +26 -0
  30. package/agent-docs/external/kuat-agent-rules/reference/media-types/web-marketing/content/blog-posts.md +29 -0
  31. package/agent-docs/external/kuat-agent-rules/reference/media-types/web-marketing/content/marketing-content.md +61 -0
  32. package/agent-docs/external/kuat-agent-rules/reference/media-types/web-marketing/content/seo.md +40 -0
  33. package/agent-docs/external/kuat-agent-rules/reference/media-types/web-marketing/emails.md +68 -0
  34. package/agent-docs/external/kuat-agent-rules/reference/media-types/web-marketing/patterns/README.md +7 -0
  35. package/agent-docs/external/kuat-agent-rules/reference/media-types/web-marketing/patterns/marketing-pages.md +368 -0
  36. package/agent-docs/external/kuat-agent-rules/reference/media-types/web-marketing/website.md +154 -0
  37. package/agent-docs/external/kuat-agent-rules/reference/media-types/web-product/README.md +16 -0
  38. package/agent-docs/external/kuat-agent-rules/reference/media-types/web-product/accessibility.md +392 -0
  39. package/agent-docs/external/kuat-agent-rules/reference/media-types/web-product/component-decision-tree.md +248 -0
  40. package/agent-docs/external/kuat-agent-rules/reference/media-types/web-product/component-registry.md +49 -0
  41. package/agent-docs/external/kuat-agent-rules/reference/media-types/web-product/content/README.md +29 -0
  42. package/agent-docs/external/kuat-agent-rules/reference/media-types/web-product/content/actions.md +45 -0
  43. package/agent-docs/external/kuat-agent-rules/reference/media-types/web-product/content/confirmations.md +51 -0
  44. package/agent-docs/external/kuat-agent-rules/reference/media-types/web-product/content/empty-states.md +37 -0
  45. package/agent-docs/external/kuat-agent-rules/reference/media-types/web-product/content/errors.md +48 -0
  46. package/agent-docs/external/kuat-agent-rules/reference/media-types/web-product/content/forms.md +68 -0
  47. package/agent-docs/external/kuat-agent-rules/reference/media-types/web-product/content/product-content.md +128 -0
  48. package/agent-docs/external/kuat-agent-rules/reference/media-types/web-product/design.md +177 -0
  49. package/agent-docs/external/kuat-agent-rules/reference/media-types/web-product/emails.md +65 -0
  50. package/agent-docs/external/kuat-agent-rules/reference/media-types/web-product/patterns/README.md +10 -0
  51. package/agent-docs/external/kuat-agent-rules/reference/media-types/web-product/patterns/authentication.md +303 -0
  52. package/agent-docs/external/kuat-agent-rules/reference/media-types/web-product/patterns/dashboards.md +313 -0
  53. package/agent-docs/external/kuat-agent-rules/reference/media-types/web-product/patterns/documentation.md +333 -0
  54. package/agent-docs/external/kuat-agent-rules/reference/media-types/web-product/patterns/forms.md +361 -0
  55. package/agent-docs/kuat-docs/rules/README.md +155 -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,301 @@
1
+ # Authentication Scenarios
2
+
3
+ Patterns for login, registration, password flows, and account verification.
4
+
5
+ ---
6
+
7
+ ## Principles
8
+
9
+ ### User Goals
10
+
11
+ - **Get in quickly** - Authentication is a barrier to the actual task
12
+ - **Feel secure** - Trust that credentials are protected
13
+ - **Recover easily** - Forgot password shouldn't be frustrating
14
+
15
+ ### UX Principles
16
+
17
+ | Principle | Implementation |
18
+ |-----------|----------------|
19
+ | Minimise friction | Only ask for essential information |
20
+ | Clear feedback | Immediate, helpful error messages |
21
+ | Maintain trust | Security indicators, clear privacy info |
22
+ | Support recovery | Easy password reset, account recovery |
23
+
24
+ ### Success Metrics
25
+
26
+ - Time to complete login/registration
27
+ - Password reset completion rate
28
+ - Error rate and recovery success
29
+ - Abandonment rate
30
+
31
+ ---
32
+
33
+ ## Layout
34
+
35
+ **Base Layout:** [Single Column](../design/layouts.md#3-single-column-layout)
36
+
37
+ Authentication pages should minimise distraction and focus users on the task.
38
+
39
+ ### Page Structure
40
+
41
+ ```
42
+ ┌─────────────────────────────────────────┐
43
+ │ [Logo] (centered) │
44
+ ├─────────────────────────────────────────┤
45
+ │ │
46
+ │ ┌─────────────────────────┐ │
47
+ │ │ Auth Card │ │
48
+ │ │ (max 400px) │ │
49
+ │ │ │ │
50
+ │ │ [Form Fields] │ │
51
+ │ │ │ │
52
+ │ │ [Primary Action] │ │
53
+ │ │ │ │
54
+ │ │ [Secondary Link] │ │
55
+ │ └─────────────────────────┘ │
56
+ │ │
57
+ ├─────────────────────────────────────────┤
58
+ │ Footer (minimal: legal links) │
59
+ └─────────────────────────────────────────┘
60
+ ```
61
+
62
+ ### Specifications
63
+
64
+ | Element | Value |
65
+ |---------|-------|
66
+ | Content alignment | Centered (vertical + horizontal) |
67
+ | Card max-width | 400px |
68
+ | Card padding | 32px (`p-8`) |
69
+ | Card background | `bg-card` with `border` |
70
+ | Card radius | 6px (interactive element) |
71
+ | Minimum viewport height | 100vh |
72
+ | Logo placement | Centered above card, or inside card header |
73
+
74
+ ### Header
75
+
76
+ - **Minimal navigation** - Logo only, no full navigation
77
+ - Logo links to marketing site or app home
78
+ - No distracting elements
79
+
80
+ ### Footer
81
+
82
+ - Minimal: legal links only (Privacy Policy, Terms)
83
+ - Copyright notice optional
84
+ - No marketing content
85
+
86
+ ---
87
+
88
+ ## Design
89
+
90
+ ### Color Tokens
91
+
92
+ | Element | Token |
93
+ |---------|-------|
94
+ | Page background | `bg-background` or `bg-muted` |
95
+ | Card background | `bg-card` |
96
+ | Card border | `border` |
97
+ | Primary button | `bg-primary` |
98
+ | Error text | `text-destructive` |
99
+ | Link text | `text-primary` |
100
+
101
+ ### Typography
102
+
103
+ | Element | Style |
104
+ |---------|-------|
105
+ | Page heading | `text-2xl font-bold` |
106
+ | Subheading | `text-muted-foreground` |
107
+ | Labels | `text-sm font-medium` |
108
+ | Input text | `text-base` |
109
+ | Error messages | `text-sm text-destructive` |
110
+ | Links | `text-sm text-primary underline` |
111
+
112
+ ### Spacing
113
+
114
+ | Element | Spacing |
115
+ |---------|---------|
116
+ | Between fields | 24px (`space-y-6`) |
117
+ | Label to input | 8px |
118
+ | Input to error | 4px |
119
+ | Form to button | 24px |
120
+ | Button to secondary link | 16px |
121
+
122
+ ---
123
+
124
+ ## Content
125
+
126
+ ### Login Page
127
+
128
+ **Required Elements:**
129
+
130
+ 1. Logo (centered above card or in card header)
131
+ 2. Heading: "Sign in" or "Welcome back"
132
+ 3. Email/username field with label
133
+ 4. Password field with show/hide toggle
134
+ 5. "Forgot password?" link (below password field, right-aligned)
135
+ 6. Primary submit button (full width)
136
+ 7. Secondary action: "Don't have an account? Sign up"
137
+
138
+ **Microcopy:**
139
+
140
+ | Element | Example |
141
+ |---------|---------|
142
+ | Heading | "Sign in to your account" |
143
+ | Email label | "Email address" |
144
+ | Password label | "Password" |
145
+ | Submit button | "Sign in" |
146
+ | Forgot link | "Forgot your password?" |
147
+ | Register link | "Don't have an account? Sign up" |
148
+
149
+ ### Registration Page
150
+
151
+ **Required Elements:**
152
+
153
+ 1. Logo
154
+ 2. Heading: "Create account" or "Get started"
155
+ 3. Name field(s) - first/last or full name
156
+ 4. Email field
157
+ 5. Password field with strength indicator
158
+ 6. Terms acceptance checkbox
159
+ 7. Primary submit button
160
+ 8. Secondary: "Already have an account? Sign in"
161
+
162
+ **Password Requirements Display:**
163
+
164
+ - Show requirements list below password field
165
+ - Check/uncheck as requirements are met
166
+ - Unmet: `text-muted-foreground`
167
+ - Met: `text-green-600` with checkmark
168
+
169
+ ### Password Reset Flow
170
+
171
+ **Step 1: Request Reset**
172
+
173
+ - Email field only
174
+ - "Send reset link" button
175
+ - Success message (don't reveal if email exists)
176
+
177
+ **Step 2: Reset Password**
178
+
179
+ - New password field
180
+ - Confirm password field
181
+ - Password requirements visible
182
+ - "Reset password" button
183
+
184
+ ### MFA / Code Entry
185
+
186
+ - 6-digit code input (individual boxes or single field)
187
+ - "Resend code" link with countdown timer
188
+ - "Use different method" secondary action
189
+ - Clear instructions on where code was sent
190
+
191
+ ---
192
+
193
+ ## Accessibility
194
+
195
+ **Base requirements:** See [accessibility/design.md](../accessibility/design.md), [accessibility/content.md](../accessibility/content.md), and [accessibility/technical.md](../accessibility/technical.md)
196
+
197
+ **Scenario-specific:**
198
+
199
+ | Requirement | Implementation |
200
+ |-------------|----------------|
201
+ | Focus first field | Auto-focus email/username on page load |
202
+ | Form labels | All inputs have visible, associated labels |
203
+ | Error linking | Use `aria-describedby` for error messages |
204
+ | Submit on Enter | Form submits when Enter pressed in any field |
205
+ | Password toggle | Toggle button is keyboard accessible |
206
+ | Error announcement | Screen reader announces errors on submit |
207
+
208
+ ### Form Validation
209
+
210
+ Follow the standard validation pattern:
211
+
212
+ - **Validate on submit** - Show all errors after submission attempt
213
+ - **Never disable submit button** - Users can always attempt submission
214
+ - **No inline validation on blur** - Don't interrupt mid-flow
215
+ - **Error summary** - Show summary at top with links to fields
216
+ - **Focus first error** - Move focus to first invalid field
217
+
218
+ ---
219
+
220
+ ## Implementation
221
+
222
+ ### Button Placement
223
+
224
+ | Button | Position | Variant |
225
+ |--------|----------|---------|
226
+ | Primary (Submit) | Full width | `variant="default"` |
227
+ | Secondary link | Below button, centered | Text link |
228
+ | Forgot password | Below password field, right | Text link |
229
+
230
+ ### Error States
231
+
232
+ | Error Type | Display Location |
233
+ |------------|-----------------|
234
+ | Field validation | Inline, below field |
235
+ | Invalid credentials | Alert above form |
236
+ | Rate limiting | Alert above form with wait time |
237
+ | Network error | Alert above form with retry option |
238
+
239
+ ### Security Considerations
240
+
241
+ | Requirement | Implementation |
242
+ |-------------|----------------|
243
+ | Don't reveal email existence | Generic "check your email" messages |
244
+ | Rate limit attempts | Show user-friendly wait message |
245
+ | Password visibility | Toggle with clear state indication |
246
+ | Session timeout | Warn before logging out |
247
+
248
+ ### Responsive Behavior
249
+
250
+ | Breakpoint | Behavior |
251
+ |------------|----------|
252
+ | Mobile | Card padding reduced to 24px, full width with margin |
253
+ | Tablet | Centered card, 400px max |
254
+ | Desktop | Centered card, 400px max |
255
+
256
+ ---
257
+
258
+ ## Best Practices
259
+
260
+ ### Do's
261
+
262
+ 1. **Keep forms minimal** - Only required fields
263
+ 2. **Show password option** - Let users verify their input
264
+ 3. **Persist email** - Remember email for returning users (with consent)
265
+ 4. **Clear success states** - Confirm successful actions
266
+ 5. **Offer alternatives** - Social login, SSO where appropriate
267
+
268
+ ### Don'ts
269
+
270
+ 1. **Don't use CAPTCHAs** as first defense - Use rate limiting first
271
+ 2. **Don't reveal** whether an email exists in the system
272
+ 3. **Don't require** password confirmation on login
273
+ 4. **Don't auto-submit** on field completion
274
+ 5. **Don't clear form** on error - Preserve user input
275
+
276
+ ### Common Mistakes
277
+
278
+ | Mistake | Solution |
279
+ |---------|----------|
280
+ | Disabling submit button | Always allow submission attempts |
281
+ | Inline blur validation | Validate on submit only |
282
+ | Vague errors ("Invalid input") | Specific, actionable messages |
283
+ | No password visibility toggle | Always include toggle |
284
+ | Missing forgot password | Prominent link near password field |
285
+
286
+ ### Edge Cases
287
+
288
+ | Case | Handling |
289
+ |------|----------|
290
+ | Expired password reset link | Clear message with option to request new link |
291
+ | Account locked | Explain why, provide recovery path |
292
+ | Email not verified | Offer to resend verification |
293
+ | Session expired mid-flow | Preserve form data, prompt re-authentication |
294
+
295
+ ---
296
+
297
+ ## Related Documentation
298
+
299
+ - [Layout Primitives](../design/layouts.md) - Single Column layout
300
+ - [Technical Accessibility](../accessibility/technical.md) - Form validation pattern
301
+ - [Forms Scenario](./forms.md) - General form patterns
@@ -0,0 +1,314 @@
1
+ # Dashboard Scenarios
2
+
3
+ Patterns for data dashboards, analytics views, metrics displays, and reporting interfaces.
4
+
5
+ ---
6
+
7
+ ## Principles
8
+
9
+ ### User Goals
10
+
11
+ - **Get insights quickly** - Key metrics visible at a glance
12
+ - **Understand trends** - Patterns and changes over time
13
+ - **Take action** - Clear paths from data to decisions
14
+ - **Explore deeper** - Drill down into details when needed
15
+
16
+ ### UX Principles
17
+
18
+ | Principle | Implementation |
19
+ |-----------|----------------|
20
+ | Information hierarchy | Most important metrics first and largest |
21
+ | Progressive disclosure | Overview first, details on demand |
22
+ | Consistent data | Same time periods, units, formats |
23
+ | Actionable context | Explain what numbers mean |
24
+
25
+ ### Success Metrics
26
+
27
+ - Time to find key information
28
+ - Decision confidence
29
+ - Filter usage patterns
30
+ - Drill-down completion rates
31
+
32
+ ---
33
+
34
+ ## Layout
35
+
36
+ **Base Layout:** [Sidebar Navigation](../design/layouts.md#2-sidebar-navigation-layout)
37
+
38
+ Dashboards benefit from persistent navigation and maximum content width.
39
+
40
+ ### Metrics Dashboard Structure
41
+
42
+ ```
43
+ ┌──────┬──────────────────────────────────┐
44
+ │ │ Header: Page Title + Filters │
45
+ │ Side ├──────────────────────────────────┤
46
+ │ bar │ ┌────┐ ┌────┐ ┌────┐ ┌────┐ │
47
+ │ │ │KPI │ │KPI │ │KPI │ │KPI │ │
48
+ │ │ └────┘ └────┘ └────┘ └────┘ │
49
+ │ ├──────────────────────────────────┤
50
+ │ │ ┌─────────────────────────────┐ │
51
+ │ │ │ Primary Chart │ │
52
+ │ │ └─────────────────────────────┘ │
53
+ │ ├──────────────────────────────────┤
54
+ │ │ ┌────────────┐ ┌────────────┐ │
55
+ │ │ │ Secondary │ │ Secondary │ │
56
+ │ │ └────────────┘ └────────────┘ │
57
+ └──────┴──────────────────────────────────┘
58
+ ```
59
+
60
+ ### Data Table Dashboard Structure
61
+
62
+ ```
63
+ ┌──────┬──────────────────────────────────┐
64
+ │ │ Header: Title + Actions │
65
+ │ Side ├──────────────────────────────────┤
66
+ │ bar │ Filters Bar │
67
+ │ ├──────────────────────────────────┤
68
+ │ │ ┌─────────────────────────────┐ │
69
+ │ │ │ │ │
70
+ │ │ │ Data Table │ │
71
+ │ │ │ (scrollable) │ │
72
+ │ │ │ │ │
73
+ │ │ └─────────────────────────────┘ │
74
+ │ ├──────────────────────────────────┤
75
+ │ │ Pagination │
76
+ └──────┴──────────────────────────────────┘
77
+ ```
78
+
79
+ ### Specifications
80
+
81
+ | Element | Value |
82
+ |---------|-------|
83
+ | Sidebar width | 240-280px (collapsible to 64px) |
84
+ | Content padding | 24-32px |
85
+ | KPI card grid | 4 columns desktop, 2 tablet, 1 mobile |
86
+ | Grid gap | 16-24px |
87
+
88
+ ---
89
+
90
+ ## Design
91
+
92
+ ### Color Tokens
93
+
94
+ | Element | Token |
95
+ |---------|-------|
96
+ | Page background | `bg-background` |
97
+ | Card background | `bg-card` |
98
+ | Card border | `border` |
99
+ | Sidebar | `bg-sidebar` |
100
+ | Positive trend | `text-green-600` / `text-green-500` (dark) |
101
+ | Negative trend | `text-destructive` |
102
+ | Neutral | `text-muted-foreground` |
103
+
104
+ ### KPI Card Pattern
105
+
106
+ | Element | Specification |
107
+ |---------|---------------|
108
+ | Container | `bg-card`, `border`, 6px radius |
109
+ | Padding | 24px (`p-6`) |
110
+ | Label | `text-sm text-muted-foreground` |
111
+ | Value | `text-2xl font-bold` or `text-3xl font-bold` |
112
+ | Trend | Small text with arrow icon |
113
+
114
+ ### Chart Container Pattern
115
+
116
+ | Element | Specification |
117
+ |---------|---------------|
118
+ | Container | `bg-card`, `border`, 6px radius |
119
+ | Padding | 24px (`p-6`) |
120
+ | Header | Title left, controls right |
121
+ | Min height | 300px primary, 200px secondary |
122
+
123
+ ### Typography Hierarchy
124
+
125
+ | Element | Style |
126
+ |---------|-------|
127
+ | Page title | `text-2xl font-bold` |
128
+ | Section headers | `text-lg font-semibold` |
129
+ | KPI labels | `text-sm text-muted-foreground` |
130
+ | KPI values | `text-2xl font-bold` |
131
+ | Chart titles | `text-base font-medium` |
132
+ | Table headers | `text-sm font-medium` |
133
+
134
+ ---
135
+
136
+ ## Content
137
+
138
+ ### KPI Cards
139
+
140
+ **Structure:**
141
+
142
+ 1. Label (what the metric is)
143
+ 2. Value (the number)
144
+ 3. Trend indicator (optional)
145
+ 4. Sparkline (optional)
146
+
147
+ **Example Content:**
148
+
149
+ | Label | Value | Trend |
150
+ |-------|-------|-------|
151
+ | "Total Revenue" | "$124,500" | "+12% vs last month" |
152
+ | "Active Users" | "2,847" | "-3% vs last week" |
153
+ | "Conversion Rate" | "4.2%" | "No change" |
154
+
155
+ ### Chart Headers
156
+
157
+ ```
158
+ ┌─────────────────────────────────────┐
159
+ │ Chart Title [Period ▼] [⋮]│
160
+ ├─────────────────────────────────────┤
161
+ │ │
162
+ │ Chart Area │
163
+ │ │
164
+ └─────────────────────────────────────┘
165
+ ```
166
+
167
+ - Title describes what data shows
168
+ - Period selector for time range
169
+ - Overflow menu for export, settings
170
+
171
+ ### Empty States
172
+
173
+ | Scenario | Message |
174
+ |----------|---------|
175
+ | No data available | "No data available for this time period" |
176
+ | Filtered with no results | "No results match your filters" + "Clear filters" button |
177
+ | Loading error | "Unable to load data" + "Retry" button |
178
+ | New user | "No activity yet" + guidance to get started |
179
+
180
+ ### Loading States
181
+
182
+ - KPI cards: Skeleton with pulse animation
183
+ - Charts: Skeleton rectangle with centered spinner
184
+ - Tables: 5-10 skeleton rows
185
+ - Show loading indicator, never stale data without indicator
186
+
187
+ ---
188
+
189
+ ## Accessibility
190
+
191
+ **Base requirements:** See [accessibility/design.md](../accessibility/design.md), [accessibility/content.md](../accessibility/content.md), and [accessibility/technical.md](../accessibility/technical.md)
192
+
193
+ **Scenario-specific:**
194
+
195
+ | Requirement | Implementation |
196
+ |-------------|----------------|
197
+ | Chart alternatives | Provide data tables as alternatives to visual charts |
198
+ | Color meaning | Never use color alone for status (add icons, labels) |
199
+ | Screen reader | KPI values announced with context ("Revenue: $124,500, up 12%") |
200
+ | Focus order | KPIs first, then filters, then main content |
201
+ | Live regions | Use `aria-live` for updating data |
202
+
203
+ ### Data Visualisation
204
+
205
+ - Provide text summaries of chart insights
206
+ - Link to accessible data table from each chart
207
+ - Use patterns/textures in addition to colors
208
+ - Ensure legends are keyboard navigable
209
+
210
+ ---
211
+
212
+ ## Implementation
213
+
214
+ ### Filter Patterns
215
+
216
+ **Filter Bar (above content):**
217
+
218
+ ```
219
+ ┌─────────────────────────────────────────────────────┐
220
+ │ [Date Range ▼] [Category ▼] [Status ▼] [Search] │
221
+ └─────────────────────────────────────────────────────┘
222
+ ```
223
+
224
+ - Horizontal layout
225
+ - Date range picker left
226
+ - Category filters middle
227
+ - Search right
228
+ - Background: `bg-muted/50` or transparent
229
+
230
+ **Filter Sidebar (within content):**
231
+
232
+ Use for complex filtering (10+ filter options):
233
+
234
+ - Collapsible sections
235
+ - Checkbox groups
236
+ - Range sliders
237
+ - "Apply" and "Clear" actions at bottom
238
+
239
+ ### Data Table Patterns
240
+
241
+ | Element | Implementation |
242
+ |---------|----------------|
243
+ | Sortable columns | Click header to sort, show arrow direction |
244
+ | Row selection | Checkbox in first column |
245
+ | Row actions | Overflow menu or icon buttons |
246
+ | Pagination | Bottom of table with page size selector |
247
+ | Empty state | Centered message in table body |
248
+
249
+ ### State Management
250
+
251
+ | State | Handling |
252
+ |-------|----------|
253
+ | Loading | Show skeleton, disable interactions |
254
+ | Error | Show error message with retry |
255
+ | Empty | Show contextual empty state |
256
+ | Stale | Show "Last updated" timestamp |
257
+ | Refreshing | Show subtle loading indicator, keep data visible |
258
+
259
+ ### Responsive Behavior
260
+
261
+ | Breakpoint | KPI Grid | Charts | Tables |
262
+ |------------|----------|--------|--------|
263
+ | Mobile | 1 column | Full width, stacked | Horizontal scroll or card view |
264
+ | Tablet | 2 columns | Full width | Horizontal scroll |
265
+ | Desktop | 4 columns | Grid layout | Full table |
266
+
267
+ ---
268
+
269
+ ## Best Practices
270
+
271
+ ### Do's
272
+
273
+ 1. **Show key metrics first** - Most important KPIs at top
274
+ 2. **Provide context** - Explain what numbers mean
275
+ 3. **Enable comparison** - Show trends, previous periods
276
+ 4. **Allow customisation** - Date ranges, filters
277
+ 5. **Cache appropriately** - Don't reload unchanged data
278
+ 6. **Indicate data freshness** - Show last updated time
279
+
280
+ ### Don'ts
281
+
282
+ 1. **Don't overwhelm** - 4-6 KPIs maximum on first view
283
+ 2. **Don't auto-refresh** without indication
284
+ 3. **Don't use misleading scales** - Start axes at zero unless justified
285
+ 4. **Don't remove context** - Show units, time periods
286
+ 5. **Don't block interactions** during loading
287
+
288
+ ### Common Mistakes
289
+
290
+ | Mistake | Solution |
291
+ |---------|----------|
292
+ | Too many metrics | Prioritise, use progressive disclosure |
293
+ | No loading states | Add skeletons, spinners |
294
+ | Unclear time periods | Always show selected date range |
295
+ | Color-only status | Add icons, labels for accessibility |
296
+ | Fixed chart sizes | Make charts responsive |
297
+
298
+ ### Edge Cases
299
+
300
+ | Case | Handling |
301
+ |------|----------|
302
+ | Very large numbers | Use abbreviations (1.2M, 3.4K) |
303
+ | Zero values | Show "0" not empty or dash |
304
+ | Partial data | Show with caveat ("Data incomplete") |
305
+ | Real-time data | Show update indicator, timestamp |
306
+ | Export large datasets | Async export with notification |
307
+
308
+ ---
309
+
310
+ ## Related Documentation
311
+
312
+ - [Layout Primitives](../design/layouts.md) - Sidebar Navigation layout
313
+ - [Design Accessibility](../accessibility/design.md) - Color and contrast
314
+ - [Multi-Column Layout](../design/layouts.md#4-multi-column-layout) - Grid patterns