@turk.net/mui 3.0.6 → 3.0.8
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/.opencode/rules/design-compliance.md +119 -0
- package/.opencode/skills/onehub-design-verification/SKILL.md +315 -0
- package/.opencode/skills/turknet-onehub-component-usage/SKILL.md +16 -16
- package/COMPONENT_GLOSSARY.md +500 -0
- package/COMPONENT_MAP.md +567 -0
- package/DESIGN_RULES.md +399 -0
- package/DESIGN_SOURCES.md +198 -0
- package/DESIGN_TOKENS_MAP.md +271 -0
- package/ESLINT_DESIGN_RULES.md +392 -0
- package/LLM_EXAMPLES.md +183 -169
- package/LLM_GUIDELINES.md +192 -192
- package/PAGE_PATTERNS.md +509 -0
- package/README.md +18 -19
- package/SKILL_SETUP.md +237 -200
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -0
- package/dist/index.mjs.map +1 -1
- package/dist/theme/index.js +1 -0
- package/dist/theme/index.js.map +1 -1
- package/dist/theme/index.mjs +1 -0
- package/dist/theme/index.mjs.map +1 -1
- package/package.json +20 -3
- package/scripts/verify-design.js +351 -0
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
# OneHub Design Compliance Rule
|
|
2
|
+
|
|
3
|
+
> **alwaysApply: true**
|
|
4
|
+
> **priority: high**
|
|
5
|
+
> **category: design**
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Core Rules (Condensed from DESIGN_RULES.md)
|
|
10
|
+
|
|
11
|
+
When writing UI code for OneHub, you **MUST** follow these rules. Any violation is a **blocking design defect**.
|
|
12
|
+
|
|
13
|
+
### TYPOGRAPHY — MUST NOT use MUI default variants
|
|
14
|
+
|
|
15
|
+
- **MUST NOT** use `h1`-`h6`, `body1`, `body2`, `subtitle1`, `subtitle2`, `caption`, `button`, `overline` — these are DISABLED in the theme
|
|
16
|
+
- **MUST ONLY** use Untitled UI variants: `display.*` (titles) and `text.*` (body, labels)
|
|
17
|
+
- Page titles: `display.lg.bold` or `display.md.semibold`
|
|
18
|
+
- Body text: `text.md.regular` or `text.sm.regular`
|
|
19
|
+
- Table headers: `text.xs.medium`
|
|
20
|
+
- Labels: `text.xs.regular` or `text.sm.regular`
|
|
21
|
+
|
|
22
|
+
### COLORS — MUST NOT use raw hex or non-vars palette
|
|
23
|
+
|
|
24
|
+
- **MUST reference colors via CSS custom properties** with `--palette-` prefix: `var(--palette-neutral-foreground-1-rest)`, `var(--palette-brand-background-1-rest)`
|
|
25
|
+
- **THE `--palette-` PREFIX IS REQUIRED.** MUI v5'te custom renk şemasına CSS variables olarak yalnızca `--palette-*` prefix'i ile erişilebilir. `var(--neutral-foreground-1-rest)` çalışmaz.
|
|
26
|
+
- **MUST NOT** use raw hex values (`#242424`, `#2970ff`)
|
|
27
|
+
- **MUST NOT** use `theme.palette.primary.main` (non-vars palette)
|
|
28
|
+
- Component `color` props MUST match COMPONENT_MAP.md:
|
|
29
|
+
- Button: `primary` | `secondary` | `error`
|
|
30
|
+
- TextField/Select: `neutral` | `brand` | `danger`
|
|
31
|
+
- Checkbox/Radio/Switch: `primary` | `error`
|
|
32
|
+
- Chip: `informative` | `brand` | `danger` | `success` | `severewarning` | `important` | `warning`
|
|
33
|
+
- Badge: `default` | `brand` | `success` | `danger` | `severe-warning` | `warning` | `important` | `white`
|
|
34
|
+
- Alert: `success` | `warning` | `error` | `info`
|
|
35
|
+
|
|
36
|
+
**CSS custom property kullanım örnekleri:**
|
|
37
|
+
```typescript
|
|
38
|
+
// ✅ CORRECT — --palette- prefix ile (MUI v5'te çalışan yazım)
|
|
39
|
+
sx={{ color: 'var(--palette-neutral-foreground-1-rest)' }}
|
|
40
|
+
sx={{ bgcolor: 'var(--palette-brand-background-1-rest)' }}
|
|
41
|
+
sx={{ borderColor: 'var(--palette-neutral-stroke-1-rest)' }}
|
|
42
|
+
|
|
43
|
+
// ❌ WRONG — prefix eksik, MUI v5'te çalışmaz
|
|
44
|
+
sx={{ color: 'var(--neutral-foreground-1-rest)' }}
|
|
45
|
+
sx={{ bgcolor: 'var(--brand-background-1-rest)' }}
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### SPACING — MUST NOT use raw pixel values
|
|
49
|
+
|
|
50
|
+
- **MUST use `theme.spacing(n)`** for all spacing (1 unit = 4px)
|
|
51
|
+
- **MUST NOT** use raw values: `'8px'`, `16`, `sx={{ padding: '16px' }}`
|
|
52
|
+
- Standard values: 4px=spacing(1), 8px=spacing(2), 12px=spacing(3), 16px=spacing(4), 24px=spacing(6), 32px=spacing(8), 64px=spacing(16)
|
|
53
|
+
|
|
54
|
+
### COMPONENTS — MUST NOT use invalid props
|
|
55
|
+
|
|
56
|
+
- **MUST NOT** use `style={{}}` (inline styles) — use `sx` prop
|
|
57
|
+
- **MUST NOT** create custom components duplicating MUI functionality
|
|
58
|
+
- **MUST** verify variant/size/color combinations against COMPONENT_MAP.md
|
|
59
|
+
- Checkbox/Radio size **MUST NOT** be `large` (only `small`, `medium`)
|
|
60
|
+
|
|
61
|
+
### FORMS — MUST use standard libraries
|
|
62
|
+
|
|
63
|
+
- Forms MUST use Formik + Yup
|
|
64
|
+
- Data fetching MUST use React Query (TanStack Query)
|
|
65
|
+
- API calls MUST use Hermes API client (GraphQL)
|
|
66
|
+
|
|
67
|
+
### LAYOUT — MUST use OneHub layout components
|
|
68
|
+
|
|
69
|
+
- TabBased: `@turknet/onehub/layouts/app/TabBased`
|
|
70
|
+
- WithSidebar: `@turknet/onehub/layouts/page/WithSidebar`
|
|
71
|
+
- **MUST NOT** use MUI Drawer or AppBar directly
|
|
72
|
+
|
|
73
|
+
### ICONS — MUST use OneHub icon system
|
|
74
|
+
|
|
75
|
+
- Import from `@turknet/onehub/icons` (SVG components, preferred)
|
|
76
|
+
- Or use Tune icon font via project's `TuneIcon` component
|
|
77
|
+
|
|
78
|
+
### STYLING — MUST use theme-aware styling
|
|
79
|
+
|
|
80
|
+
- Use `sx` prop with theme values for one-off styles
|
|
81
|
+
- Use `styled()` from `@mui/material/styles` for reusable components
|
|
82
|
+
- Use CSS custom properties for colors, shadows, borders
|
|
83
|
+
|
|
84
|
+
---
|
|
85
|
+
|
|
86
|
+
## Quick Validation Before Commit
|
|
87
|
+
|
|
88
|
+
Before committing any UI code, verify:
|
|
89
|
+
- [ ] No `<Typography variant="h1">` (or any default MUI variant)
|
|
90
|
+
- [ ] No `style={{}}` props
|
|
91
|
+
- [ ] No raw hex colors (`#XXXXXX`)
|
|
92
|
+
- [ ] All CSS `var()` references use `--palette-` prefix (e.g. `var(--palette-neutral-foreground-1-rest)`)
|
|
93
|
+
- [ ] No raw px values in spacing (`'8px'`, `16`)
|
|
94
|
+
- [ ] All color props match valid values per component
|
|
95
|
+
- [ ] Icons from `@turknet/onehub/icons`, not from `@mui/icons-material`
|
|
96
|
+
|
|
97
|
+
---
|
|
98
|
+
|
|
99
|
+
## Reference
|
|
100
|
+
|
|
101
|
+
| File | Use |
|
|
102
|
+
|------|-----|
|
|
103
|
+
| `DESIGN_RULES.md` | Full mandatory rules with examples |
|
|
104
|
+
| `COMPONENT_MAP.md` | Figma → MUI component mapping with exact props |
|
|
105
|
+
| `COMPONENT_GLOSSARY.md` | All usable components with valid prop combinations |
|
|
106
|
+
| `DESIGN_TOKENS_MAP.md` | Color, spacing, typography token paths |
|
|
107
|
+
| `PAGE_PATTERNS.md` | Standard page layout patterns |
|
|
108
|
+
|
|
109
|
+
---
|
|
110
|
+
|
|
111
|
+
## Enforcement
|
|
112
|
+
|
|
113
|
+
This rule is enforced by:
|
|
114
|
+
1. **This file** — Always-apply rule in `.opencode/rules/`
|
|
115
|
+
2. **`onehub-design-verification` skill** — Step-by-step manual verification
|
|
116
|
+
3. **`scripts/verify-design.js`** — Automated scanner for CI
|
|
117
|
+
4. **ESLINT_DESIGN_RULES.md** — Specification for future ESLint plugin
|
|
118
|
+
|
|
119
|
+
Run the automated check: `node scripts/verify-design.js src/`
|
|
@@ -0,0 +1,315 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: onehub-design-verification
|
|
3
|
+
description: Use WHEN user asks for design review, design audit, or after creating new pages/components. Step-by-step design validation checklist checking typography, colors, spacing, component props, and layout patterns against OneHub design rules.
|
|
4
|
+
license: MIT
|
|
5
|
+
compatibility: React 18.2+, Next.js 13+, MUI v5/v9
|
|
6
|
+
metadata:
|
|
7
|
+
theme-package: "@turknet/onehub"
|
|
8
|
+
design-system: "Untitled UI"
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# OneHub Design Verification Skill
|
|
12
|
+
|
|
13
|
+
> **Purpose:** Step-by-step design validation checklist for AI agents and developers. Use this after writing any UI code to verify compliance with OneHub design rules.
|
|
14
|
+
>
|
|
15
|
+
> **References:** DESIGN_RULES.md, COMPONENT_MAP.md, DESIGN_TOKENS_MAP.md, COMPONENT_GLOSSARY.md
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## Scope & Trigger
|
|
20
|
+
|
|
21
|
+
**You MUST use this skill WHEN:**
|
|
22
|
+
- User explicitly asks for a design review or design audit
|
|
23
|
+
- After creating new pages, components, or UI features
|
|
24
|
+
- After modifying existing component code
|
|
25
|
+
- Before committing UI changes to version control
|
|
26
|
+
- When user says "check design", "verify design", "design review"
|
|
27
|
+
|
|
28
|
+
**You SHOULD use this skill WHEN:**
|
|
29
|
+
- Reviewing pull requests that contain UI code
|
|
30
|
+
- Onboarding new developers to OneHub
|
|
31
|
+
- Debugging visual inconsistencies between code and Figma design
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
## Verification Checklist
|
|
36
|
+
|
|
37
|
+
Complete each check in order. Every check marked ❌ is a **design defect** that MUST be fixed before merge.
|
|
38
|
+
|
|
39
|
+
### 1. Typography Check
|
|
40
|
+
|
|
41
|
+
- [ ] No MUI default variants used (`h1`-`h6`, `body1`, `body2`, `subtitle1`, `subtitle2`, `caption`, `button`, `overline`)
|
|
42
|
+
- [ ] All `<Typography>` takes Untitled UI variant (`display.*`, `text.*`)
|
|
43
|
+
- [ ] Page titles use `display.lg.bold` or appropriate heading
|
|
44
|
+
- [ ] Body text uses `text.md.regular` or `text.sm.regular`
|
|
45
|
+
- [ ] Table headers use `text.xs.medium`
|
|
46
|
+
- [ ] Labels use `text.xs.regular` or `text.sm.regular`
|
|
47
|
+
- [ ] Font weight matches context (see DESIGN_RULES.md Rule 1.3)
|
|
48
|
+
|
|
49
|
+
```typescript
|
|
50
|
+
// ✅ CORRECT
|
|
51
|
+
<Typography variant="display.lg.bold">Page Title</Typography>
|
|
52
|
+
<Typography variant="text.md.regular">Body text</Typography>
|
|
53
|
+
<Typography variant="text.xs.medium">LABEL</Typography>
|
|
54
|
+
|
|
55
|
+
// ❌ WRONG
|
|
56
|
+
<Typography variant="h1">Page Title</Typography> // MUI default — DISABLED
|
|
57
|
+
<Typography variant="body1">Text</Typography> // MUI default — DISABLED
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### 2. Color Check
|
|
61
|
+
|
|
62
|
+
- [ ] No raw hex color values (`#242424`, `#2970ff`, etc.) in component code
|
|
63
|
+
- [ ] All colors use CSS custom properties (`var(--neutral-foreground-1-rest)`) or `theme.vars.palette.*`
|
|
64
|
+
- [ ] Component `color` props use ONLY valid values from COMPONENT_MAP.md:
|
|
65
|
+
- `Button`: `primary`, `secondary`, `error`
|
|
66
|
+
- `TextField`/`Select`: `neutral`, `brand`, `danger`
|
|
67
|
+
- `Checkbox`/`Radio`/`Switch`: `primary`, `error`
|
|
68
|
+
- `Chip`: `primary`, `secondary`, `error`
|
|
69
|
+
- `Badge`: `default`, `brand`, `success`, `danger`, `severewarning`, `warning`, `important`
|
|
70
|
+
- `Alert`: `success`, `warning`, `error`, `info`
|
|
71
|
+
- [ ] No `color="success"` on Button (not defined)
|
|
72
|
+
- [ ] No `color="primary"` on TextField (not defined)
|
|
73
|
+
|
|
74
|
+
```typescript
|
|
75
|
+
// ✅ CORRECT
|
|
76
|
+
sx={{ color: 'var(--neutral-foreground-1-rest)' }}
|
|
77
|
+
sx={{ bgcolor: theme.vars.palette.brand.background[1].rest }}
|
|
78
|
+
<Button color="primary" variant="contained">Save</Button>
|
|
79
|
+
<TextField color="neutral" />
|
|
80
|
+
|
|
81
|
+
// ❌ WRONG
|
|
82
|
+
sx={{ color: '#242424' }} // Raw hex
|
|
83
|
+
<Button color="success">Save</Button> // Undefined for Button
|
|
84
|
+
<TextField color="primary" /> // Undefined for TextField
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### 3. Spacing Check
|
|
88
|
+
|
|
89
|
+
- [ ] No raw pixel values in spacing (`'8px'`, `16`, etc.)
|
|
90
|
+
- [ ] All spacing uses `theme.spacing(n)` (1 unit = 4px)
|
|
91
|
+
- [ ] Spacing values follow standard grid: 4px, 8px, 12px, 16px, 24px, 32px, 64px
|
|
92
|
+
- [ ] No `sx={{ padding: '8px' }}` — use `sx={{ padding: theme.spacing(2) }}`
|
|
93
|
+
|
|
94
|
+
```typescript
|
|
95
|
+
// ✅ CORRECT
|
|
96
|
+
sx={{ padding: theme.spacing(2) }}
|
|
97
|
+
sx={{ gap: theme.spacing(1) }}
|
|
98
|
+
sx={{ marginLeft: theme.spacing(3) }}
|
|
99
|
+
|
|
100
|
+
// ❌ WRONG
|
|
101
|
+
sx={{ padding: '8px' }}
|
|
102
|
+
sx={{ gap: 4 }}
|
|
103
|
+
sx={{ marginLeft: 12 }}
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
### 4. Component Props Check
|
|
107
|
+
|
|
108
|
+
- [ ] All `variant`/`size`/`color` combinations match COMPONENT_MAP.md
|
|
109
|
+
- [ ] No undefined combinations (e.g., `<Button variant="gradient">`)
|
|
110
|
+
- [ ] `<Checkbox>` and `<Radio>` size is NOT `large` (only `small`, `medium`)
|
|
111
|
+
- [ ] `<Chip>` variant is one of: `filled`, `tint`, `outline`, `ghost`
|
|
112
|
+
- [ ] `<Badge>` color uses OneHub palette (NOT MUI default `primary`/`secondary`/`error`)
|
|
113
|
+
- [ ] Buttons have `disableElevation: true` by default (theme handles this)
|
|
114
|
+
|
|
115
|
+
```typescript
|
|
116
|
+
// ❌ WRONG — Invalid combinations
|
|
117
|
+
<Button variant="gradient" color="success">Gradient</Button>
|
|
118
|
+
<Checkbox size="large" />
|
|
119
|
+
<Chip variant="soft" color="success" />
|
|
120
|
+
|
|
121
|
+
// ✅ CORRECT
|
|
122
|
+
<Button variant="contained" color="primary">Save</Button>
|
|
123
|
+
<Checkbox color="primary" size="small" />
|
|
124
|
+
<Chip variant="tint" color="primary" label="Active" />
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
### 5. Style Check
|
|
128
|
+
|
|
129
|
+
- [ ] No inline `style={{}}` props on ANY component
|
|
130
|
+
- [ ] All styling uses `sx` prop with theme values
|
|
131
|
+
- [ ] CSS custom properties used for colors, shadows, borders
|
|
132
|
+
- [ ] `styled()` is used for complex/reusable style objects
|
|
133
|
+
|
|
134
|
+
```typescript
|
|
135
|
+
// ❌ WRONG
|
|
136
|
+
<div style={{ padding: 20, color: 'red' }}>Text</div>
|
|
137
|
+
<Button style={{ backgroundColor: 'blue' }}>Click</Button>
|
|
138
|
+
|
|
139
|
+
// ✅ CORRECT
|
|
140
|
+
<Box sx={{ padding: theme.spacing(5), color: 'var(--danger-foreground-1-rest)' }}>
|
|
141
|
+
<Button sx={{ bgcolor: theme.vars.palette.brand.background[1].rest }}>
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
### 6. Component Selection Check
|
|
145
|
+
|
|
146
|
+
- [ ] No custom components duplicating MUI functionality
|
|
147
|
+
- [ ] No forbidden MUI components (ToggleButton, Rating, SpeedDial, BottomNavigation, MobileStepper, ImageList, Timeline, Accordion, Breadcrumbs, Drawer, AppBar)
|
|
148
|
+
- [ ] Tables use custom Box-based layout (not MUI Table for data tables — see COMPONENT_MAP.md#table-data-grid)
|
|
149
|
+
- [ ] Forms use Formik + Yup
|
|
150
|
+
- [ ] Data fetching uses React Query (TanStack Query)
|
|
151
|
+
- [ ] Icons imported from `@turknet/onehub/icons` or Tune icon font
|
|
152
|
+
- [ ] Layout uses `TabBasedLayout` or `WithSidebarLayout` from `@turknet/onehub`
|
|
153
|
+
|
|
154
|
+
### 7. Typography Variant Selection Check
|
|
155
|
+
|
|
156
|
+
Verify typography variant matches content hierarchy:
|
|
157
|
+
|
|
158
|
+
| Context | Expected Variant |
|
|
159
|
+
|---------|-----------------|
|
|
160
|
+
| Page title | `display.lg.bold` or `display.md.semibold` |
|
|
161
|
+
| Section header | `text.lg.medium` or `text.md.semibold` |
|
|
162
|
+
| Body text | `text.md.regular` or `text.sm.regular` |
|
|
163
|
+
| Table header | `text.xs.medium` |
|
|
164
|
+
| Table cell | `text.sm.regular` |
|
|
165
|
+
| Form label | `text.sm.regular` or `text.xs.regular` |
|
|
166
|
+
| Helper/error text | `text.xs.regular` |
|
|
167
|
+
| Button text | `text.sm.medium` |
|
|
168
|
+
| Chip/Badge text | `text.xs.medium` |
|
|
169
|
+
|
|
170
|
+
### 8. Border Radius Check
|
|
171
|
+
|
|
172
|
+
- [ ] Small elements (checkbox): `4px` → `theme.shape.borderRadius / 2`
|
|
173
|
+
- [ ] Buttons, inputs, cards, radio: `8px` → `theme.shape.borderRadius`
|
|
174
|
+
- [ ] Chips, badges, filter tags: `16px` → `theme.shape.borderRadius * 2`
|
|
175
|
+
|
|
176
|
+
### 9. Accessibility Check
|
|
177
|
+
|
|
178
|
+
- [ ] All form inputs have associated labels
|
|
179
|
+
- [ ] Icon buttons have `aria-label`
|
|
180
|
+
- [ ] Tables have proper header rows
|
|
181
|
+
- [ ] Interactive elements are keyboard accessible
|
|
182
|
+
|
|
183
|
+
### 10. Import Check
|
|
184
|
+
|
|
185
|
+
- [ ] No full library imports (`import * as Mui from '@mui/material'`)
|
|
186
|
+
- [ ] Named imports only from `@mui/material`
|
|
187
|
+
- [ ] `@mui/material/styles` for `styled()` function
|
|
188
|
+
|
|
189
|
+
---
|
|
190
|
+
|
|
191
|
+
## Running the VERIFICATION Script
|
|
192
|
+
|
|
193
|
+
After completing the manual checklist, run the automated scanner:
|
|
194
|
+
|
|
195
|
+
```bash
|
|
196
|
+
# src/ dizinini tara
|
|
197
|
+
node scripts/verify-design.js src/
|
|
198
|
+
|
|
199
|
+
# Belirli bir dizini tara
|
|
200
|
+
node scripts/verify-design.js src/components/
|
|
201
|
+
|
|
202
|
+
# Çıkış kodu: 0 = temiz, 1 = ihlal var
|
|
203
|
+
echo $?
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
The script checks:
|
|
207
|
+
- Invalid variant/color/size props on MUI components
|
|
208
|
+
- Forbidden MUI typography variants
|
|
209
|
+
- Inline styles (`style={{}}`)
|
|
210
|
+
- Magic number spacing (raw px values)
|
|
211
|
+
- Raw hex colors
|
|
212
|
+
- Forbidden MUI components (no theme override)
|
|
213
|
+
|
|
214
|
+
---
|
|
215
|
+
|
|
216
|
+
## Design Review Output Format
|
|
217
|
+
|
|
218
|
+
When performing a design review, output results in this format:
|
|
219
|
+
|
|
220
|
+
```markdown
|
|
221
|
+
## Design Review Results
|
|
222
|
+
|
|
223
|
+
### Summary
|
|
224
|
+
- Files checked: X
|
|
225
|
+
- Violations found: Y
|
|
226
|
+
- Rules checked: 10
|
|
227
|
+
|
|
228
|
+
### Violations
|
|
229
|
+
|
|
230
|
+
#### 1. Typography (N issues)
|
|
231
|
+
- `file.tsx:123` — `<Typography variant="h3">` — MUI default variant DISABLED
|
|
232
|
+
|
|
233
|
+
#### 2. Colors (N issues)
|
|
234
|
+
- `file.tsx:45` — `color="#2970ff"` — Raw hex, use theme.vars
|
|
235
|
+
|
|
236
|
+
#### 3. Spacing (N issues)
|
|
237
|
+
- `file.tsx:78` — `padding: '16px'` — Magic number, use theme.spacing(4)
|
|
238
|
+
|
|
239
|
+
### ✅ Passed Checks
|
|
240
|
+
- Component props: All valid
|
|
241
|
+
- Component selection: No forbidden components
|
|
242
|
+
- Accessibility: Labels present
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
---
|
|
246
|
+
|
|
247
|
+
## Reference Files
|
|
248
|
+
|
|
249
|
+
Always consult these files when verifying:
|
|
250
|
+
|
|
251
|
+
| File | Content |
|
|
252
|
+
|------|---------|
|
|
253
|
+
| `DESIGN_RULES.md` | Mandatory rules (MUST/MUST NOT) |
|
|
254
|
+
| `COMPONENT_MAP.md` | Figma → MUI component mapping with exact props |
|
|
255
|
+
| `COMPONENT_GLOSSARY.md` | Full component catalog with valid prop combinations |
|
|
256
|
+
| `DESIGN_TOKENS_MAP.md` | Color, spacing, typography token mapping |
|
|
257
|
+
| `PAGE_PATTERNS.md` | Standard page layout patterns |
|
|
258
|
+
| `LLM_GUIDELINES.md` | Component usage rules |
|
|
259
|
+
| `LLM_EXAMPLES.md` | Correct/incorrect usage examples |
|
|
260
|
+
|
|
261
|
+
---
|
|
262
|
+
|
|
263
|
+
## Common Violations & Fixes
|
|
264
|
+
|
|
265
|
+
### Violation: MUI default typography
|
|
266
|
+
|
|
267
|
+
```typescript
|
|
268
|
+
// ❌ WRONG
|
|
269
|
+
<Typography variant="h1">Title</Typography>
|
|
270
|
+
|
|
271
|
+
// ✅ FIX
|
|
272
|
+
<Typography variant="display.lg.bold">Title</Typography>
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
### Violation: Raw color
|
|
276
|
+
|
|
277
|
+
```typescript
|
|
278
|
+
// ❌ WRONG
|
|
279
|
+
sx={{ backgroundColor: '#2970ff' }}
|
|
280
|
+
|
|
281
|
+
// ✅ FIX
|
|
282
|
+
sx={{ backgroundColor: 'var(--brand-background-1-rest)' }}
|
|
283
|
+
// or
|
|
284
|
+
sx={{ backgroundColor: theme.vars.palette.brand.background[1].rest }}
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
### Violation: Magic spacing
|
|
288
|
+
|
|
289
|
+
```typescript
|
|
290
|
+
// ❌ WRONG
|
|
291
|
+
sx={{ padding: '16px' }}
|
|
292
|
+
|
|
293
|
+
// ✅ FIX
|
|
294
|
+
sx={{ padding: theme.spacing(4) }}
|
|
295
|
+
```
|
|
296
|
+
|
|
297
|
+
### Violation: Invalid color prop
|
|
298
|
+
|
|
299
|
+
```typescript
|
|
300
|
+
// ❌ WRONG
|
|
301
|
+
<Button color="success">Save</Button>
|
|
302
|
+
|
|
303
|
+
// ✅ FIX
|
|
304
|
+
<Button color="primary" variant="contained">Save</Button>
|
|
305
|
+
```
|
|
306
|
+
|
|
307
|
+
### Violation: Inline style
|
|
308
|
+
|
|
309
|
+
```typescript
|
|
310
|
+
// ❌ WRONG
|
|
311
|
+
<Button style={{ marginTop: 20 }}>Click</Button>
|
|
312
|
+
|
|
313
|
+
// ✅ FIX
|
|
314
|
+
<Button sx={{ marginTop: theme.spacing(5) }}>Click</Button>
|
|
315
|
+
```
|
|
@@ -10,28 +10,28 @@ metadata:
|
|
|
10
10
|
|
|
11
11
|
# @turknet/onehub Material UI Component Usage Guide
|
|
12
12
|
|
|
13
|
-
> **CRITICAL FOR LLM MODELS**: This skill is essential when writing components for projects using `@turknet/onehub`.
|
|
13
|
+
> **CRITICAL FOR LLM MODELS**: This skill is essential when writing components for projects using `@turknet/onehub`. You MUST read and apply ALL rules.
|
|
14
14
|
|
|
15
15
|
---
|
|
16
16
|
|
|
17
|
-
##
|
|
17
|
+
## Scope & Trigger
|
|
18
18
|
|
|
19
|
-
**
|
|
19
|
+
**You MUST use this skill WHEN:**
|
|
20
20
|
- Generating React/TSX components for projects using `@turknet/onehub` theme
|
|
21
21
|
- Writing code that imports Material UI components (`@mui/material`)
|
|
22
22
|
- Styling buttons, forms, typography, cards, dialogs, tables, or any MUI component
|
|
23
23
|
- Creating layouts with Paper, Container, Box, Stack, Grid
|
|
24
24
|
|
|
25
|
-
**
|
|
25
|
+
**You MUST NOT use this skill WHEN:**
|
|
26
26
|
- Using other UI frameworks (Chakra UI, shadcn/ui, Tailwind custom components)
|
|
27
27
|
- Writing non-UI code (hooks, utilities, services, API calls)
|
|
28
28
|
- Dealing with unrelated packages
|
|
29
29
|
|
|
30
30
|
---
|
|
31
31
|
|
|
32
|
-
##
|
|
32
|
+
## Foundation Rules
|
|
33
33
|
|
|
34
|
-
### Rule 1:
|
|
34
|
+
### Rule 1: You MUST ONLY Use Material UI from @mui/material
|
|
35
35
|
|
|
36
36
|
```tsx
|
|
37
37
|
// ✅ CORRECT
|
|
@@ -42,7 +42,7 @@ import CustomButton from './components/CustomButton';
|
|
|
42
42
|
import { Button } from 'chakra-ui';
|
|
43
43
|
```
|
|
44
44
|
|
|
45
|
-
### Rule 2:
|
|
45
|
+
### Rule 2: You MUST ONLY Use Defined Variants, Sizes, and Colors
|
|
46
46
|
|
|
47
47
|
```tsx
|
|
48
48
|
// ✅ CORRECT: Defined combination
|
|
@@ -52,7 +52,7 @@ import { Button } from 'chakra-ui';
|
|
|
52
52
|
<Button variant="gradient" size="huge" color="unknown" />
|
|
53
53
|
```
|
|
54
54
|
|
|
55
|
-
### Rule 3:
|
|
55
|
+
### Rule 3: You MUST NEVER Write Custom Components or Inline Styles
|
|
56
56
|
|
|
57
57
|
```tsx
|
|
58
58
|
// ✅ CORRECT
|
|
@@ -71,7 +71,7 @@ function CustomButton() {
|
|
|
71
71
|
</Button>
|
|
72
72
|
```
|
|
73
73
|
|
|
74
|
-
### Rule 4: Use Theme Color Palettes Correctly
|
|
74
|
+
### Rule 4: You MUST Use Theme Color Palettes Correctly
|
|
75
75
|
|
|
76
76
|
```tsx
|
|
77
77
|
// ✅ CORRECT: Use neutral, brand, danger
|
|
@@ -85,9 +85,9 @@ function CustomButton() {
|
|
|
85
85
|
</div>
|
|
86
86
|
```
|
|
87
87
|
|
|
88
|
-
**Note**: Shared colors (red, green, orange, etc.)
|
|
88
|
+
**Note**: Shared colors (red, green, orange, etc.) MUST ONLY be used for custom components when design demands them. They MUST NOT be used via inline styles on MUI components.
|
|
89
89
|
|
|
90
|
-
### Rule 5:
|
|
90
|
+
### Rule 5: You MUST ALWAYS Use Typography Variants
|
|
91
91
|
|
|
92
92
|
```tsx
|
|
93
93
|
// ✅ CORRECT: Use customized variants
|
|
@@ -103,7 +103,7 @@ function CustomButton() {
|
|
|
103
103
|
|
|
104
104
|
---
|
|
105
105
|
|
|
106
|
-
##
|
|
106
|
+
## Theme System Reference
|
|
107
107
|
|
|
108
108
|
### Color Palettes
|
|
109
109
|
|
|
@@ -188,7 +188,7 @@ text.xs.{regular|medium|semibold|bold} → 12px
|
|
|
188
188
|
|
|
189
189
|
### Paper Elevation Levels
|
|
190
190
|
|
|
191
|
-
|
|
191
|
+
You MUST use the `elevation` prop with values **0-24 only**:
|
|
192
192
|
|
|
193
193
|
```tsx
|
|
194
194
|
<Paper elevation={0}>Flat (no shadow)</Paper>
|
|
@@ -200,7 +200,7 @@ Use `elevation` prop with values **0-24**:
|
|
|
200
200
|
|
|
201
201
|
---
|
|
202
202
|
|
|
203
|
-
##
|
|
203
|
+
## Component Structure & Sub-Components
|
|
204
204
|
|
|
205
205
|
### Form Components with Sub-Components
|
|
206
206
|
|
|
@@ -549,8 +549,8 @@ const CustomStatusBadge = () => (
|
|
|
549
549
|
|
|
550
550
|
### Checklist
|
|
551
551
|
|
|
552
|
-
- [ ] Does the component use
|
|
553
|
-
- [ ] Are
|
|
552
|
+
- [ ] Does the component use ONLY Material UI from `@mui/material`?
|
|
553
|
+
- [ ] Are ALL variant/size/color combinations defined in this guide?
|
|
554
554
|
- [ ] Did I use Typography variants instead of HTML tags?
|
|
555
555
|
- [ ] Did I avoid inline styles and custom components?
|
|
556
556
|
- [ ] For form components, did I specify the `color` prop?
|