eha-design-system-ai 0.4.0 → 0.6.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/EHA_RULES.md CHANGED
@@ -6,10 +6,47 @@ These rules apply to any AI agent using the `eha-design-system-ai` MCP server.
6
6
 
7
7
  1. All component imports from `eha-design-system` — never from `rsuite` directly
8
8
  2. Button always uses `variant` prop — `'primary' | 'secondary' | 'tertiary' | 'ghost'`
9
- 3. `ThemeProvider` with the correct `brandId` prop always wraps the app root
10
- 4. Missing components -> output comment, never build custom: `// MISSING: [Name] not in EHA DS`
11
- 5. Never hardcode brand colours resolve via `brands[brandId].colorPrimitives.*`
12
- 6. Logo assets must be static files at `/public/brands/[brand]/logo.svg` never remote URLs
9
+ 3. `ThemeProvider` must use `brand`, never `brandId` (example: `<ThemeProvider brand="lomis">`)
10
+ 4. In `main.tsx`, import order is mandatory: `rsuite` CSS first, brand CSS second
11
+ 5. Sidenav item objects use `title`, never `label`
12
+ 6. Brand token access uses `brands[brand].colorPrimitives.*`, never `brands[brand].colors.*`
13
+ 7. Missing components -> output comment, never build custom: `// MISSING: [Name] — not in EHA DS`
14
+ 8. Never hardcode brand colours — resolve via `brands[brand].colorPrimitives.*`
15
+ 9. Logo assets must be static files at `/public/brands/[brand]/logo.svg` — never remote URLs
16
+
17
+ ## Required Setup Before UI Code
18
+
19
+ Install these dependencies in consumer apps:
20
+
21
+ ```bash
22
+ npm install eha-design-system rsuite @emotion/react @emotion/styled @mui/icons-material rxjs
23
+ ```
24
+
25
+ For Vite projects, add aliases:
26
+
27
+ ```ts
28
+ resolve: {
29
+ alias: {
30
+ 'eha-design-system/styles': path.resolve(__dirname, 'node_modules/eha-design-system/styles'),
31
+ 'rsuite/dist/rsuite.min.css': path.resolve(__dirname, 'node_modules/rsuite/dist/rsuite.min.css'),
32
+ },
33
+ }
34
+ ```
35
+
36
+ Main entry setup (order is critical):
37
+
38
+ ```tsx
39
+ import 'rsuite/dist/rsuite.min.css';
40
+ import 'eha-design-system/styles/brands/lomis.css';
41
+
42
+ import { ThemeProvider } from 'eha-design-system';
43
+ ```
44
+
45
+ Manrope font must be loaded in `index.html`, then applied globally:
46
+
47
+ ```css
48
+ body { font-family: 'Manrope', system-ui, -apple-system, sans-serif; }
49
+ ```
13
50
 
14
51
  ## Brand Token Access
15
52
 
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # eha-design-system-ai
2
2
 
3
- AI compatibility layer for EHA Design System enables LLMs to reliably generate UI components without hallucination.
3
+ AI compatibility layer for EHA Design System, enables LLMs to reliably generate UI components without hallucination.
4
4
 
5
5
  ## What It Does
6
6
 
@@ -50,84 +50,84 @@ This is picked up automatically by Claude Code, opencode, Cursor, and other MCP-
50
50
 
51
51
  | Tool | Description |
52
52
  |------|-------------|
53
- | `get_brand` | **Call first for branded projects.** Returns ThemeProvider setup, CSS import, and brand-specific colour tokens |
53
+ | `get_brand` | **Call first for branded projects.** Returns ThemeProvider setup and brand-specific colour tokens |
54
54
  | `get_components` | List all components, filter by category or search term |
55
55
  | `get_component` | Full props, usage, and common mistakes for a specific component |
56
56
  | `resolve_figma` | Map Figma node names to DS components, flag MISSING ones |
57
- | `get_tokens` | Design tokens — pass `brandId` for brand-specific colours |
57
+ | `get_tokens` | Design tokens — pass `brandId` (or `brand`) for brand-specific colours |
58
58
  | `get_recipe` | Pre-built layout patterns for common page types |
59
59
  | `get_rules` | Agent rules, import conventions, and constraints |
60
60
 
61
61
  ---
62
62
 
63
- ## Multi-Brand Theming
63
+ ## Critical Consumer Setup (Must Apply First)
64
+
65
+ The design system does not bundle all required runtime styling dependencies. Install these in the consuming app:
64
66
 
65
- EHA Design System supports 4 brands. Each brand has its own colour token set and CSS stylesheet. Spacing, typography, border radius, shadows, and z-index are **identical across all brands**.
67
+ ```bash
68
+ npm install eha-design-system rsuite @emotion/react @emotion/styled @mui/icons-material rxjs
69
+ ```
66
70
 
67
- ### Available Brands
71
+ For Vite projects, add aliases to avoid export-map failures for style imports:
72
+
73
+ ```ts
74
+ import path from 'path';
75
+
76
+ resolve: {
77
+ alias: {
78
+ 'eha-design-system/styles': path.resolve(__dirname, 'node_modules/eha-design-system/styles'),
79
+ 'rsuite/dist/rsuite.min.css': path.resolve(__dirname, 'node_modules/rsuite/dist/rsuite.min.css'),
80
+ },
81
+ }
82
+ ```
68
83
 
69
- | Brand | Primary | Secondary | Tertiary | Use Case |
70
- |-------|---------|-----------|----------|----------|
71
- | `eha` | `#0090FC` | `#EBCB00` | `#003963` | Default — health programmes |
72
- | `etrac` | `#0090FC` | `#EBCB00` | `#003963` | Vaccination tracking |
73
- | `lomis` | `#0090FC` | `#EBCB00` | `#1E3A5F` | Logistics Management |
74
- | `reach` | `#522E1C` | `#E3C934` | `#003963` | Reach Data Portal |
84
+ Load Manrope in `index.html` and apply it globally:
75
85
 
76
- > ⚠️ **Reach brand** has a significantly different visual identity — primary is **terracotta brown**, not blue. Links and interactive elements are also brown. Always use `ThemeProvider` and never hardcode colour values.
86
+ ```html
87
+ <link rel="preconnect" href="https://fonts.googleapis.com" />
88
+ <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
89
+ <link href="https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700;800&display=swap" rel="stylesheet" />
90
+ ```
77
91
 
78
- ### Setup (Two Steps)
92
+ ```css
93
+ body {
94
+ font-family: 'Manrope', system-ui, -apple-system, sans-serif;
95
+ }
96
+ ```
79
97
 
80
- **Step 1 — Import the brand CSS at your app entry point (`main.tsx` or `App.tsx`):**
98
+ In `main.tsx`, import order is mandatory:
81
99
 
82
100
  ```tsx
83
- // Choose your brand:
84
- import 'eha-design-system/styles/brands/eha.css';
85
- import 'eha-design-system/styles/brands/etrac.css';
101
+ import 'rsuite/dist/rsuite.min.css';
86
102
  import 'eha-design-system/styles/brands/lomis.css';
87
- import 'eha-design-system/styles/brands/reach.css';
88
103
  ```
89
104
 
90
- **Step 2 — Wrap your app root with `ThemeProvider`:**
105
+ ---
106
+
107
+ ## Multi-Brand Theming
108
+
109
+ EHA Design System supports 4 brands. Each brand has its own colour token set. Spacing, typography, border radius, shadows, and z-index are **identical across all brands**.
110
+
111
+ ### Setup
112
+
113
+ Wrap your app root with `ThemeProvider` and pass the `brand` prop (never `brandId`).
91
114
 
92
115
  ```tsx
116
+ import 'rsuite/dist/rsuite.min.css';
117
+ import 'eha-design-system/styles/brands/lomis.css';
118
+
93
119
  import { ThemeProvider } from 'eha-design-system';
94
120
 
95
121
  function App() {
96
122
  return (
97
- <ThemeProvider brandId="lomis">
123
+ <ThemeProvider brand="lomis">
98
124
  <YourApp />
99
125
  </ThemeProvider>
100
126
  );
101
127
  }
102
128
  ```
103
129
 
104
- ### Brand Colour Differences
105
-
106
- **eha / etrac** — identical palettes, differ in brand assets only:
107
- ```
108
- primary: #0090FC (blue)
109
- secondary: #EBCB00 (yellow)
110
- tertiary: #003963 (dark navy)
111
- ```
112
-
113
- **lomis** — different tertiary scale (navy blues):
114
- ```
115
- primary: #0090FC (blue)
116
- secondary: #EBCB00 (yellow)
117
- tertiary: #1E3A5F (deep navy)
118
- tertiary scale: #EFF6FF → #1E3A5F (blue/indigo range)
119
- interactive.tertiary: #3B82F6
120
- ```
121
-
122
- **reach** — completely different visual identity:
123
- ```
124
- primary: #522E1C (terracotta brown)
125
- secondary: #E3C934 (golden yellow)
126
- primary scale: earthy browns (#E4C2B1 → #311C11)
127
- links: #422516 (brown, not blue)
128
- focus ring: #6F4C3A (dark brown)
129
- info colour: #6F4C3A / infoBg: #E4C2B1
130
- ```
130
+ Available brands: `eha` (default), `etrac`, `lomis`, `reach`.
131
131
 
132
132
  ---
133
133
 
@@ -163,7 +163,6 @@ console.log(tokens.colors.primary); // '#0090FC'
163
163
  const lomis = brandConfigs.lomis;
164
164
  console.log(lomis.primary); // '#0090FC'
165
165
  console.log(lomis.tertiary); // '#1E3A5F'
166
- console.log(lomis.cssImport); // "import 'eha-design-system/styles/brands/lomis.css'"
167
166
 
168
167
  const reach = brandConfigs.reach;
169
168
  console.log(reach.primary); // '#522E1C'
@@ -175,12 +174,16 @@ console.log(reach.keyDifferences); // array of what makes reach different
175
174
  ## Core Rules for Agents
176
175
 
177
176
  1. **Call `get_brand` first** when building for a specific brand
178
- 2. **Import brand CSS before `ThemeProvider`**order matters
179
- 3. **Never hardcode brand colours**use ThemeProvider CSS custom properties
180
- 4. **All imports from `eha-design-system`**never from `rsuite` directly
181
- 5. **Button always uses `variant` prop** — `'primary' | 'secondary' | 'tertiary' | 'ghost'`
182
- 6. **Missing components** output `// MISSING: [Name] not in EHA Design System`, do NOT build manually
183
- 7. **For Login/Settings pages** → use `LoginTemplate` / `ProfileSettingsTemplate` first
177
+ 2. **Install setup dependencies in consumer app first** `rsuite`, `@emotion/react`, `@emotion/styled`, `@mui/icons-material`, `rxjs`
178
+ 3. **All imports from `eha-design-system`**never from `rsuite` directly
179
+ 4. **Button always uses `variant` prop** `'primary' | 'secondary' | 'tertiary' | 'ghost'`
180
+ 5. **In `main.tsx`, import CSS in this order** — `rsuite` first, brand CSS second
181
+ 6. **ThemeProvider uses `brand` prop**never `brandId`
182
+ 7. **Sidenav items use `title` key** — never `label`
183
+ 8. **Brand tokens use `brands[brand].colorPrimitives.*`** — never `brands[brand].colors.*`
184
+ 9. **Never hardcode brand colours** — use ThemeProvider + tokens
185
+ 10. **Missing components** → output `// MISSING: [Name] — not in EHA Design System`, do NOT build manually
186
+ 11. **For Login/Settings pages** → use `LoginTemplate` / `ProfileSettingsTemplate` first
184
187
 
185
188
  ---
186
189
 
@@ -210,7 +213,7 @@ console.log(reach.keyDifferences); // array of what makes reach different
210
213
  | Dropdown | navigation | title, trigger, Dropdown.Item |
211
214
  | PageHeader | layout | title, subtitle, user, onAction |
212
215
  | Drawer | layout | open, placement, size, sub-components |
213
- | Accordion | layout | bordered, Accordion.Panel |
216
+ | Accordion | layout | bordered, AccordionPanel |
214
217
 
215
218
  ## Full-Page Templates
216
219