@madecki/ui 1.0.0 → 1.1.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/README.md +405 -66
- package/cursor-rule-template.md +95 -0
- package/dist/index.cjs +204 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +57 -1
- package/dist/index.d.ts +57 -1
- package/dist/index.js +199 -1
- package/dist/index.js.map +1 -1
- package/llm-context.md +104 -0
- package/package.json +7 -3
package/README.md
CHANGED
|
@@ -1,6 +1,21 @@
|
|
|
1
1
|
# @madecki/ui
|
|
2
2
|
|
|
3
|
-
A collection of reusable React UI components built with TypeScript and Tailwind CSS.
|
|
3
|
+
A collection of reusable React UI components built with TypeScript and Tailwind CSS. Designed to ensure visual and functional consistency across Micro Frontend (MFE) applications.
|
|
4
|
+
|
|
5
|
+
## Why This Library?
|
|
6
|
+
|
|
7
|
+
When building multiple MFE applications, maintaining consistency is challenging:
|
|
8
|
+
|
|
9
|
+
- **Visual consistency** - Same colors, spacing, typography, and component styling
|
|
10
|
+
- **Code consistency** - Same component APIs, patterns, and behaviors
|
|
11
|
+
- **Developer experience** - Familiar components reduce onboarding time
|
|
12
|
+
|
|
13
|
+
This library solves these problems by providing:
|
|
14
|
+
|
|
15
|
+
1. **Pre-built components** with consistent styling and APIs
|
|
16
|
+
2. **Tailwind preset** that exports the complete design system
|
|
17
|
+
3. **Layout primitives** for consistent page structures
|
|
18
|
+
4. **Typography components** for unified text styling
|
|
4
19
|
|
|
5
20
|
## Installation
|
|
6
21
|
|
|
@@ -17,15 +32,18 @@ pnpm add @madecki/ui
|
|
|
17
32
|
- React 18+
|
|
18
33
|
- Tailwind CSS 4+
|
|
19
34
|
|
|
20
|
-
|
|
35
|
+
---
|
|
21
36
|
|
|
22
|
-
|
|
37
|
+
## MFE Consistency Guide
|
|
23
38
|
|
|
24
|
-
|
|
39
|
+
### 1. Tailwind Configuration (Required)
|
|
25
40
|
|
|
26
|
-
|
|
41
|
+
All MFE apps **must** use the shared Tailwind preset to ensure identical design tokens.
|
|
42
|
+
|
|
43
|
+
**Option A: Using CSS `@config` directive (recommended for Tailwind v4)**
|
|
27
44
|
|
|
28
45
|
```css
|
|
46
|
+
/* app.css or globals.css */
|
|
29
47
|
@import "tailwindcss";
|
|
30
48
|
@config "@madecki/ui/tailwind-preset";
|
|
31
49
|
@source "./node_modules/@madecki/ui/dist/**/*.{js,cjs}";
|
|
@@ -33,9 +51,8 @@ Reference the preset in your main CSS file:
|
|
|
33
51
|
|
|
34
52
|
**Option B: Using JavaScript config**
|
|
35
53
|
|
|
36
|
-
If you prefer a `tailwind.config.js` file:
|
|
37
|
-
|
|
38
54
|
```js
|
|
55
|
+
// tailwind.config.js
|
|
39
56
|
import { madeckiPreset } from "@madecki/ui/tailwind-preset";
|
|
40
57
|
|
|
41
58
|
/** @type {import('tailwindcss').Config} */
|
|
@@ -48,37 +65,316 @@ export default {
|
|
|
48
65
|
};
|
|
49
66
|
```
|
|
50
67
|
|
|
51
|
-
### 2.
|
|
68
|
+
### 2. Use Library Components (Required)
|
|
69
|
+
|
|
70
|
+
Import and use components from the library instead of creating custom ones:
|
|
71
|
+
|
|
72
|
+
```tsx
|
|
73
|
+
import {
|
|
74
|
+
Button,
|
|
75
|
+
Input,
|
|
76
|
+
Heading,
|
|
77
|
+
Text,
|
|
78
|
+
Container,
|
|
79
|
+
Stack,
|
|
80
|
+
Grid,
|
|
81
|
+
} from "@madecki/ui";
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
### 3. Consistent Layout Structure
|
|
85
|
+
|
|
86
|
+
Use the layout components to create consistent page structures:
|
|
87
|
+
|
|
88
|
+
```tsx
|
|
89
|
+
import { Container, Stack, Heading, Text } from "@madecki/ui";
|
|
90
|
+
|
|
91
|
+
function Page() {
|
|
92
|
+
return (
|
|
93
|
+
<Container size="lg">
|
|
94
|
+
<Stack gap="6">
|
|
95
|
+
<Heading level={1}>Page Title</Heading>
|
|
96
|
+
<Text>Page content goes here.</Text>
|
|
97
|
+
</Stack>
|
|
98
|
+
</Container>
|
|
99
|
+
);
|
|
100
|
+
}
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
### 4. Dark Mode Support
|
|
104
|
+
|
|
105
|
+
All components support dark mode via the `dark` class. Implement consistent dark mode across apps:
|
|
52
106
|
|
|
53
107
|
```tsx
|
|
54
|
-
|
|
55
|
-
|
|
108
|
+
// Add 'dark' class to html or body element
|
|
109
|
+
document.documentElement.classList.add("dark");
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
### 5. Custom Styling Guidelines
|
|
113
|
+
|
|
114
|
+
When you need custom styles, **always use the design tokens**:
|
|
115
|
+
|
|
116
|
+
```tsx
|
|
117
|
+
// ✅ DO: Use design tokens
|
|
118
|
+
<div className="bg-primary text-white p-5 rounded-md">
|
|
119
|
+
|
|
120
|
+
// ❌ DON'T: Use arbitrary values
|
|
121
|
+
<div className="bg-[#1E1E1E] text-[#FCFAF7] p-[16px] rounded-[20px]">
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
### 6. AI/LLM Integration
|
|
125
|
+
|
|
126
|
+
When using AI assistants (Cursor, Copilot, Claude, etc.) to build MFE apps, configure them to use this library correctly.
|
|
127
|
+
|
|
128
|
+
#### Option A: Cursor Rules (Recommended for Cursor)
|
|
129
|
+
|
|
130
|
+
Copy the rule template to your MFE project:
|
|
131
|
+
|
|
132
|
+
```bash
|
|
133
|
+
# Create the rules directory
|
|
134
|
+
mkdir -p .cursor/rules
|
|
135
|
+
|
|
136
|
+
# Copy the template (adjust path to your node_modules)
|
|
137
|
+
cp node_modules/@madecki/ui/cursor-rule-template.md .cursor/rules/madecki-ui.mdc
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
Or manually create `.cursor/rules/madecki-ui.mdc` with content from `cursor-rule-template.md`.
|
|
141
|
+
|
|
142
|
+
#### Option B: Point AI to Documentation
|
|
143
|
+
|
|
144
|
+
When starting a conversation with an AI assistant, reference the context file:
|
|
145
|
+
|
|
56
146
|
```
|
|
147
|
+
Read node_modules/@madecki/ui/llm-context.md and use @madecki/ui components for all UI.
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
Or in Cursor, use `@madecki-ui` to reference the file directly.
|
|
151
|
+
|
|
152
|
+
#### Option C: Project-Level Context
|
|
153
|
+
|
|
154
|
+
Create a `CLAUDE.md` or `AGENTS.md` file in your project root:
|
|
155
|
+
|
|
156
|
+
```markdown
|
|
157
|
+
# AI Instructions
|
|
158
|
+
|
|
159
|
+
This project uses @madecki/ui for all UI components.
|
|
160
|
+
|
|
161
|
+
Before creating any UI component, check node_modules/@madecki/ui/llm-context.md
|
|
162
|
+
for available components and design tokens.
|
|
163
|
+
|
|
164
|
+
Rules:
|
|
165
|
+
- Always import from "@madecki/ui"
|
|
166
|
+
- Never create custom Button, Input, Heading, or Text components
|
|
167
|
+
- Always use design tokens, never arbitrary Tailwind values
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
#### What Gets Exported
|
|
171
|
+
|
|
172
|
+
| File | Purpose | Path |
|
|
173
|
+
|------|---------|------|
|
|
174
|
+
| `llm-context.md` | Condensed component reference for AI | `node_modules/@madecki/ui/llm-context.md` |
|
|
175
|
+
| `cursor-rule-template.md` | Ready-to-use Cursor rule | `node_modules/@madecki/ui/cursor-rule-template.md` |
|
|
176
|
+
| `README.md` | Full documentation | `node_modules/@madecki/ui/README.md` |
|
|
177
|
+
| TypeScript types | Prop autocompletion | Automatic via IDE |
|
|
178
|
+
|
|
179
|
+
---
|
|
180
|
+
|
|
181
|
+
## Design System
|
|
182
|
+
|
|
183
|
+
### Color Palette
|
|
184
|
+
|
|
185
|
+
| Token | Value | Usage |
|
|
186
|
+
|------------|-----------|--------------------------------|
|
|
187
|
+
| `primary` | #1E1E1E | Main background, dark surfaces |
|
|
188
|
+
| `darkgray` | #272727 | Secondary backgrounds |
|
|
189
|
+
| `gray` | #3A3A3A | Borders, subtle backgrounds |
|
|
190
|
+
| `lightgray`| #6D6D6D | Muted text, secondary text |
|
|
191
|
+
| `icongray` | #BFBFBF | Icons, disabled states |
|
|
192
|
+
| `white` | #FCFAF7 | Primary text, light surfaces |
|
|
193
|
+
| `success` | #87BB54 | Success states, confirmations |
|
|
194
|
+
| `danger` | #CB5065 | Errors, destructive actions |
|
|
195
|
+
| `warning` | #EDA867 | Warnings, cautions |
|
|
196
|
+
| `info` | #714E8E | Informational elements |
|
|
197
|
+
| `blue` | #2084E1 | Links, interactive elements |
|
|
198
|
+
| `neutral` | #E1E1E1 | Neutral backgrounds, borders |
|
|
199
|
+
|
|
200
|
+
### Spacing Scale
|
|
201
|
+
|
|
202
|
+
| Token | Value | Usage |
|
|
203
|
+
|-------|-------|--------------------------|
|
|
204
|
+
| `1` | 4px | Tight spacing |
|
|
205
|
+
| `2` | 8px | Compact spacing |
|
|
206
|
+
| `3` | 12px | Small spacing |
|
|
207
|
+
| `4` | 14px | Default tight padding |
|
|
208
|
+
| `5` | 16px | Default spacing |
|
|
209
|
+
| `6` | 20px | Medium spacing |
|
|
210
|
+
| `7` | 24px | Component padding |
|
|
211
|
+
| `8` | 28px | Section spacing |
|
|
212
|
+
| `9` | 32px | Large spacing |
|
|
213
|
+
| `10` | 40px | Extra large spacing |
|
|
214
|
+
|
|
215
|
+
### Typography Scale
|
|
216
|
+
|
|
217
|
+
| Token | Size | Usage |
|
|
218
|
+
|--------|-------|--------------------------|
|
|
219
|
+
| `xs` | 12px | Captions, labels |
|
|
220
|
+
| `sm` | 14px | Small text, metadata |
|
|
221
|
+
| `md` | 16px | Body text (default) |
|
|
222
|
+
| `lg` | 18px | Large body, emphasis |
|
|
223
|
+
| `xl` | 20px | Small headings |
|
|
224
|
+
| `2xl` | 24px | Section headings |
|
|
225
|
+
| `3xl` | 29px | Page headings |
|
|
226
|
+
| `4xl` | 34px | Hero headings |
|
|
227
|
+
|
|
228
|
+
### Border Radius
|
|
229
|
+
|
|
230
|
+
| Token | Value | Usage |
|
|
231
|
+
|----------|-------|--------------------------|
|
|
232
|
+
| `sm` | 10px | Small components |
|
|
233
|
+
| `md` | 20px | Cards, containers |
|
|
234
|
+
| `circle` | 50% | Circular elements |
|
|
235
|
+
|
|
236
|
+
---
|
|
57
237
|
|
|
58
238
|
## Components
|
|
59
239
|
|
|
60
|
-
###
|
|
240
|
+
### Layout Components
|
|
241
|
+
|
|
242
|
+
#### Container
|
|
243
|
+
|
|
244
|
+
Centers content with consistent max-widths and padding.
|
|
245
|
+
|
|
246
|
+
```tsx
|
|
247
|
+
<Container size="lg" centered>
|
|
248
|
+
{/* Content */}
|
|
249
|
+
</Container>
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
| Prop | Type | Default | Description |
|
|
253
|
+
|------|------|---------|-------------|
|
|
254
|
+
| `size` | `"sm" \| "md" \| "lg" \| "xl" \| "full"` | `"lg"` | Max-width |
|
|
255
|
+
| `centered` | `boolean` | `true` | Center horizontally |
|
|
256
|
+
|
|
257
|
+
#### Stack
|
|
258
|
+
|
|
259
|
+
Vertical or horizontal flex layout with consistent gaps.
|
|
260
|
+
|
|
261
|
+
```tsx
|
|
262
|
+
<Stack direction="vertical" gap="5" align="center">
|
|
263
|
+
<div>Item 1</div>
|
|
264
|
+
<div>Item 2</div>
|
|
265
|
+
</Stack>
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
| Prop | Type | Default | Description |
|
|
269
|
+
|------|------|---------|-------------|
|
|
270
|
+
| `direction` | `"vertical" \| "horizontal"` | `"vertical"` | Stack direction |
|
|
271
|
+
| `gap` | `"1"` - `"10"` | `"4"` | Gap between items |
|
|
272
|
+
| `align` | `"start" \| "center" \| "end" \| "stretch"` | `"stretch"` | Alignment |
|
|
273
|
+
| `justify` | `"start" \| "center" \| "end" \| "between" \| "around"` | `"start"` | Justification |
|
|
274
|
+
| `wrap` | `boolean` | `false` | Allow wrapping |
|
|
275
|
+
|
|
276
|
+
#### Grid
|
|
277
|
+
|
|
278
|
+
CSS grid layout with consistent column configurations.
|
|
279
|
+
|
|
280
|
+
```tsx
|
|
281
|
+
<Grid cols={3} gap="5">
|
|
282
|
+
<GridItem>Item 1</GridItem>
|
|
283
|
+
<GridItem colSpan={2}>Wide Item</GridItem>
|
|
284
|
+
</Grid>
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
| Prop | Type | Default | Description |
|
|
288
|
+
|------|------|---------|-------------|
|
|
289
|
+
| `cols` | `1 \| 2 \| 3 \| 4 \| 5 \| 6 \| 12` | `3` | Number of columns |
|
|
290
|
+
| `gap` | `"1"` - `"10"` | `"5"` | Gap between items |
|
|
291
|
+
|
|
292
|
+
### Typography Components
|
|
293
|
+
|
|
294
|
+
#### Heading
|
|
295
|
+
|
|
296
|
+
Semantic headings with consistent styling.
|
|
61
297
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
298
|
+
```tsx
|
|
299
|
+
<Heading level={1} color="default">Page Title</Heading>
|
|
300
|
+
<Heading level={2} size="xl" weight="semibold">Section</Heading>
|
|
301
|
+
```
|
|
302
|
+
|
|
303
|
+
| Prop | Type | Default | Description |
|
|
304
|
+
|------|------|---------|-------------|
|
|
305
|
+
| `level` | `1 \| 2 \| 3 \| 4 \| 5 \| 6` | `2` | HTML heading level |
|
|
306
|
+
| `size` | `"xs"` - `"4xl"` | Auto by level | Font size |
|
|
307
|
+
| `weight` | `"normal" \| "medium" \| "semibold" \| "bold"` | `"bold"` | Font weight |
|
|
308
|
+
| `color` | `"default" \| "muted" \| "primary" \| "success" \| "warning" \| "danger"` | `"default"` | Text color |
|
|
309
|
+
|
|
310
|
+
#### Text
|
|
311
|
+
|
|
312
|
+
Body text with consistent styling.
|
|
313
|
+
|
|
314
|
+
```tsx
|
|
315
|
+
<Text size="md" color="muted">Secondary information</Text>
|
|
316
|
+
<Text as="span" weight="semibold">Inline emphasis</Text>
|
|
317
|
+
```
|
|
318
|
+
|
|
319
|
+
| Prop | Type | Default | Description |
|
|
320
|
+
|------|------|---------|-------------|
|
|
321
|
+
| `as` | `"p" \| "span" \| "div" \| "label"` | `"p"` | HTML element |
|
|
322
|
+
| `size` | `"xs" \| "sm" \| "md" \| "lg"` | `"md"` | Font size |
|
|
323
|
+
| `weight` | `"normal" \| "medium" \| "semibold" \| "bold"` | `"normal"` | Font weight |
|
|
324
|
+
| `color` | `"default" \| "muted" \| "primary" \| "success" \| "warning" \| "danger"` | `"default"` | Text color |
|
|
325
|
+
|
|
326
|
+
### Interactive Components
|
|
327
|
+
|
|
328
|
+
#### Button
|
|
329
|
+
|
|
330
|
+
Primary button with multiple color variants and sizes.
|
|
66
331
|
|
|
67
332
|
```tsx
|
|
68
333
|
<Button variant="primary" size="md" onClick={() => {}}>
|
|
69
334
|
Click me
|
|
70
335
|
</Button>
|
|
336
|
+
```
|
|
71
337
|
|
|
338
|
+
#### ButtonTransparent
|
|
339
|
+
|
|
340
|
+
Transparent/outlined button variant.
|
|
341
|
+
|
|
342
|
+
```tsx
|
|
72
343
|
<ButtonTransparent variant="success">
|
|
73
344
|
Transparent Button
|
|
74
345
|
</ButtonTransparent>
|
|
346
|
+
```
|
|
75
347
|
|
|
348
|
+
#### GradientButton
|
|
349
|
+
|
|
350
|
+
Button with gradient border effect.
|
|
351
|
+
|
|
352
|
+
```tsx
|
|
76
353
|
<GradientButton size="lg">
|
|
77
354
|
Gradient Button
|
|
78
355
|
</GradientButton>
|
|
79
356
|
```
|
|
80
357
|
|
|
81
|
-
|
|
358
|
+
#### RadioButtons
|
|
359
|
+
|
|
360
|
+
Radio button group component.
|
|
361
|
+
|
|
362
|
+
```tsx
|
|
363
|
+
<RadioButtons
|
|
364
|
+
name="option"
|
|
365
|
+
options={[
|
|
366
|
+
{ label: "Option 1", value: "1" },
|
|
367
|
+
{ label: "Option 2", value: "2" },
|
|
368
|
+
]}
|
|
369
|
+
onChange={(value) => console.log(value)}
|
|
370
|
+
/>
|
|
371
|
+
```
|
|
372
|
+
|
|
373
|
+
### Form Components
|
|
374
|
+
|
|
375
|
+
#### Input
|
|
376
|
+
|
|
377
|
+
Text input with variants and icon support.
|
|
82
378
|
|
|
83
379
|
```tsx
|
|
84
380
|
<Input
|
|
@@ -91,35 +387,55 @@ import { Heart, Share, TwitterIcon } from "@madecki/ui";
|
|
|
91
387
|
/>
|
|
92
388
|
```
|
|
93
389
|
|
|
94
|
-
###
|
|
390
|
+
### Navigation
|
|
391
|
+
|
|
392
|
+
#### Tabs
|
|
393
|
+
|
|
394
|
+
Tab navigation component.
|
|
95
395
|
|
|
96
396
|
```tsx
|
|
97
397
|
<Tabs
|
|
98
398
|
tabs={[
|
|
99
399
|
{ label: "Tab 1", value: "tab1" },
|
|
100
400
|
{ label: "Tab 2", value: "tab2" },
|
|
101
|
-
{ label: "Tab 3", value: "tab3" },
|
|
102
401
|
]}
|
|
103
402
|
onTabClick={(value) => console.log("Selected:", value)}
|
|
104
403
|
/>
|
|
105
404
|
```
|
|
106
405
|
|
|
107
|
-
###
|
|
406
|
+
### Feedback Components
|
|
407
|
+
|
|
408
|
+
#### Spinner
|
|
409
|
+
|
|
410
|
+
Loading spinner with size variants.
|
|
108
411
|
|
|
109
412
|
```tsx
|
|
110
413
|
<Spinner size="md" />
|
|
414
|
+
```
|
|
415
|
+
|
|
416
|
+
#### SpinnerOverlay
|
|
417
|
+
|
|
418
|
+
Full-screen loading overlay.
|
|
419
|
+
|
|
420
|
+
```tsx
|
|
111
421
|
<SpinnerOverlay isVisible={isLoading} />
|
|
112
422
|
```
|
|
113
423
|
|
|
114
|
-
###
|
|
424
|
+
### Content Components
|
|
425
|
+
|
|
426
|
+
#### BlockQuote
|
|
427
|
+
|
|
428
|
+
Styled blockquote for quotations.
|
|
115
429
|
|
|
116
430
|
```tsx
|
|
117
431
|
<BlockQuote>
|
|
118
|
-
"This is a quote with
|
|
432
|
+
"This is a quote with nice styling."
|
|
119
433
|
</BlockQuote>
|
|
120
434
|
```
|
|
121
435
|
|
|
122
|
-
|
|
436
|
+
#### ContentBox
|
|
437
|
+
|
|
438
|
+
Info/warning/success/danger boxes with icon support.
|
|
123
439
|
|
|
124
440
|
```tsx
|
|
125
441
|
import { ContentBox, Info, Warning } from "@madecki/ui";
|
|
@@ -133,20 +449,24 @@ import { ContentBox, Info, Warning } from "@madecki/ui";
|
|
|
133
449
|
</ContentBox>
|
|
134
450
|
```
|
|
135
451
|
|
|
136
|
-
|
|
452
|
+
#### Hr
|
|
453
|
+
|
|
454
|
+
Styled horizontal rule.
|
|
137
455
|
|
|
138
456
|
```tsx
|
|
139
457
|
<Hr className="my-8" />
|
|
140
458
|
```
|
|
141
459
|
|
|
460
|
+
---
|
|
461
|
+
|
|
142
462
|
## Icons
|
|
143
463
|
|
|
144
464
|
### Heart
|
|
145
465
|
|
|
146
466
|
```tsx
|
|
147
|
-
<Heart variant="outline" />
|
|
148
|
-
<Heart variant="filled" />
|
|
149
|
-
<Heart variant="gradient" />
|
|
467
|
+
<Heart variant="outline" />
|
|
468
|
+
<Heart variant="filled" />
|
|
469
|
+
<Heart variant="gradient" />
|
|
150
470
|
```
|
|
151
471
|
|
|
152
472
|
### Share
|
|
@@ -171,29 +491,47 @@ import { ContentBox, Info, Warning } from "@madecki/ui";
|
|
|
171
491
|
<LinkedInIcon />
|
|
172
492
|
<InstagramIcon />
|
|
173
493
|
|
|
174
|
-
|
|
494
|
+
{/* Without wrapper */}
|
|
175
495
|
<TwitterIcon withWrapper={false} />
|
|
176
496
|
```
|
|
177
497
|
|
|
178
|
-
|
|
498
|
+
---
|
|
499
|
+
|
|
500
|
+
## MFE Integration Checklist
|
|
501
|
+
|
|
502
|
+
Use this checklist when integrating the library into a new MFE app:
|
|
503
|
+
|
|
504
|
+
- [ ] Install `@madecki/ui` package
|
|
505
|
+
- [ ] Configure Tailwind to use `madeckiPreset`
|
|
506
|
+
- [ ] Add `@source` directive to scan library components
|
|
507
|
+
- [ ] Replace custom buttons with `Button`, `ButtonTransparent`, or `GradientButton`
|
|
508
|
+
- [ ] Replace custom inputs with `Input`
|
|
509
|
+
- [ ] Use `Container` for page-level layouts
|
|
510
|
+
- [ ] Use `Stack` and `Grid` for component layouts
|
|
511
|
+
- [ ] Use `Heading` and `Text` for all typography
|
|
512
|
+
- [ ] Implement dark mode with `dark` class toggle
|
|
513
|
+
- [ ] Verify all custom styles use design tokens (no arbitrary values)
|
|
514
|
+
|
|
515
|
+
---
|
|
516
|
+
|
|
517
|
+
## Extending the Library
|
|
518
|
+
|
|
519
|
+
### Adding Custom Components
|
|
520
|
+
|
|
521
|
+
When you need components not in the library, follow these guidelines:
|
|
179
522
|
|
|
180
|
-
|
|
523
|
+
1. **Use design tokens** - Only use colors, spacing, and typography from the preset
|
|
524
|
+
2. **Follow naming conventions** - Match existing component API patterns
|
|
525
|
+
3. **Support dark mode** - Include `dark:` variants
|
|
526
|
+
4. **Consider contributing** - If widely useful, submit a PR to add it to the library
|
|
181
527
|
|
|
182
|
-
|
|
183
|
-
|-----------|-----------|
|
|
184
|
-
| primary | #1E1E1E |
|
|
185
|
-
| darkgray | #272727 |
|
|
186
|
-
| lightgray | #6D6D6D |
|
|
187
|
-
| gray | #3A3A3A |
|
|
188
|
-
| white | #FCFAF7 |
|
|
189
|
-
| success | #87BB54 |
|
|
190
|
-
| danger | #CB5065 |
|
|
191
|
-
| info | #714E8E |
|
|
192
|
-
| blue | #2084E1 |
|
|
193
|
-
| warning | #EDA867 |
|
|
194
|
-
| neutral | #E1E1E1 |
|
|
528
|
+
### When NOT to Use Library Components
|
|
195
529
|
|
|
196
|
-
|
|
530
|
+
- **One-off specialized UI** - Unique to a single app/feature
|
|
531
|
+
- **Third-party integrations** - Complex widgets with their own styling
|
|
532
|
+
- **Performance-critical** - When you need maximum optimization
|
|
533
|
+
|
|
534
|
+
---
|
|
197
535
|
|
|
198
536
|
## Development
|
|
199
537
|
|
|
@@ -211,6 +549,26 @@ npm run build
|
|
|
211
549
|
npm run typecheck
|
|
212
550
|
```
|
|
213
551
|
|
|
552
|
+
### Adding or Modifying Components
|
|
553
|
+
|
|
554
|
+
When you add, remove, or change component APIs, update these files:
|
|
555
|
+
|
|
556
|
+
1. **Component files** - `src/components/*/`
|
|
557
|
+
2. **Exports** - `src/components/index.ts` and `src/index.ts`
|
|
558
|
+
3. **LLM context** - `llm-context.md` (component list and props)
|
|
559
|
+
4. **Cursor template** - `cursor-rule-template.md` (quick reference)
|
|
560
|
+
5. **README** - This file (full documentation)
|
|
561
|
+
|
|
562
|
+
The `.cursor/rules/` directory contains Cursor rules for developing this library. These rules remind AI assistants to keep documentation in sync when components change.
|
|
563
|
+
|
|
564
|
+
### File Structure
|
|
565
|
+
|
|
566
|
+
```
|
|
567
|
+
src/components/ComponentName/
|
|
568
|
+
├── ComponentName.tsx # Component implementation
|
|
569
|
+
└── index.ts # Re-exports
|
|
570
|
+
```
|
|
571
|
+
|
|
214
572
|
## Releasing
|
|
215
573
|
|
|
216
574
|
Releases are fully automated using [semantic-release](https://semantic-release.gitbook.io/). When commits are pushed to `main`, the CI automatically:
|
|
@@ -222,32 +580,20 @@ Releases are fully automated using [semantic-release](https://semantic-release.g
|
|
|
222
580
|
|
|
223
581
|
### Commit Message Format
|
|
224
582
|
|
|
225
|
-
This project uses [Conventional Commits](https://www.conventionalcommits.org/) enforced by [commitlint](https://commitlint.js.org/).
|
|
583
|
+
This project uses [Conventional Commits](https://www.conventionalcommits.org/) enforced by [commitlint](https://commitlint.js.org/).
|
|
226
584
|
|
|
227
585
|
**Format:** `type(scope?): description`
|
|
228
586
|
|
|
229
|
-
### Commit Types
|
|
230
|
-
|
|
231
587
|
| Type | Description | Release |
|
|
232
588
|
|------|-------------|---------|
|
|
233
589
|
| `feat` | New feature | Minor |
|
|
234
590
|
| `fix` | Bug fix | Patch |
|
|
235
591
|
| `docs` | Documentation only | None |
|
|
236
|
-
| `style` | Code style (formatting
|
|
237
|
-
| `refactor` | Code change
|
|
592
|
+
| `style` | Code style (formatting) | None |
|
|
593
|
+
| `refactor` | Code change (no fix/feat) | None |
|
|
238
594
|
| `perf` | Performance improvement | Patch |
|
|
239
|
-
| `test` | Adding
|
|
595
|
+
| `test` | Adding/updating tests | None |
|
|
240
596
|
| `chore` | Maintenance tasks | None |
|
|
241
|
-
| `ci` | CI/CD changes | None |
|
|
242
|
-
| `build` | Build system changes | None |
|
|
243
|
-
|
|
244
|
-
### Breaking Changes
|
|
245
|
-
|
|
246
|
-
Add `!` after the type or include `BREAKING CHANGE:` in the footer for major version bumps:
|
|
247
|
-
|
|
248
|
-
```bash
|
|
249
|
-
feat!: require Tailwind v4
|
|
250
|
-
```
|
|
251
597
|
|
|
252
598
|
### Examples
|
|
253
599
|
|
|
@@ -258,15 +604,8 @@ git commit -m "fix: resolve button click handler"
|
|
|
258
604
|
# New feature → minor release (1.0.0 → 1.1.0)
|
|
259
605
|
git commit -m "feat: add Toast notification component"
|
|
260
606
|
|
|
261
|
-
# With scope
|
|
262
|
-
git commit -m "feat(Button): add loading state"
|
|
263
|
-
|
|
264
607
|
# Breaking change → major release (1.0.0 → 2.0.0)
|
|
265
608
|
git commit -m "feat!: drop support for React 17"
|
|
266
|
-
|
|
267
|
-
# No release
|
|
268
|
-
git commit -m "docs: update installation instructions"
|
|
269
|
-
git commit -m "chore: update dependencies"
|
|
270
609
|
```
|
|
271
610
|
|
|
272
611
|
## License
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
# Cursor Rule Template for MFE Apps
|
|
2
|
+
|
|
3
|
+
Copy the content below to `.cursor/rules/madecki-ui.mdc` in your MFE project:
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
```markdown
|
|
8
|
+
---
|
|
9
|
+
description: Rules for using @madecki/ui component library
|
|
10
|
+
globs: **/*.{tsx,jsx,ts,js}
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
# @madecki/ui Component Library
|
|
14
|
+
|
|
15
|
+
This project uses @madecki/ui for UI components. ALWAYS use library components instead of creating custom ones.
|
|
16
|
+
|
|
17
|
+
## Required: Check Library First
|
|
18
|
+
|
|
19
|
+
Before creating ANY UI component, check if @madecki/ui has it:
|
|
20
|
+
|
|
21
|
+
### Layout
|
|
22
|
+
- `Container` - Page wrapper with max-width
|
|
23
|
+
- `Stack` - Vertical/horizontal flex layout
|
|
24
|
+
- `Grid` / `GridItem` - CSS grid layout
|
|
25
|
+
|
|
26
|
+
### Typography
|
|
27
|
+
- `Heading` - h1-h6 with consistent styling
|
|
28
|
+
- `Text` - Body text with variants
|
|
29
|
+
|
|
30
|
+
### Interactive
|
|
31
|
+
- `Button`, `ButtonTransparent`, `GradientButton` - Buttons
|
|
32
|
+
- `Input` - Form inputs
|
|
33
|
+
- `Tabs` - Tab navigation
|
|
34
|
+
- `RadioButtons` - Radio groups
|
|
35
|
+
|
|
36
|
+
### Feedback
|
|
37
|
+
- `Spinner`, `SpinnerOverlay` - Loading states
|
|
38
|
+
- `ContentBox` - Info/warning/success/danger boxes
|
|
39
|
+
|
|
40
|
+
### Content
|
|
41
|
+
- `BlockQuote`, `Hr` - Content elements
|
|
42
|
+
|
|
43
|
+
### Icons
|
|
44
|
+
- `Heart`, `Share`, `Search`, `Info`, `Warning`
|
|
45
|
+
- `TwitterIcon`, `LinkedInIcon`, `InstagramIcon`
|
|
46
|
+
|
|
47
|
+
## Import Pattern
|
|
48
|
+
|
|
49
|
+
```tsx
|
|
50
|
+
import { Container, Stack, Heading, Text, Button } from "@madecki/ui";
|
|
51
|
+
import { Heart, Info } from "@madecki/ui";
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## Design Tokens
|
|
55
|
+
|
|
56
|
+
ALWAYS use these Tailwind classes, NEVER arbitrary values:
|
|
57
|
+
|
|
58
|
+
### Colors
|
|
59
|
+
`primary`, `darkgray`, `gray`, `lightgray`, `icongray`, `white`, `success`, `danger`, `warning`, `info`, `blue`, `neutral`
|
|
60
|
+
|
|
61
|
+
### Spacing (gap, padding, margin)
|
|
62
|
+
`1`-`10` (4px to 40px scale)
|
|
63
|
+
|
|
64
|
+
### Typography
|
|
65
|
+
`xs`, `sm`, `md`, `lg`, `xl`, `2xl`, `3xl`, `4xl`
|
|
66
|
+
|
|
67
|
+
### Border Radius
|
|
68
|
+
`sm` (10px), `md` (20px), `circle` (50%)
|
|
69
|
+
|
|
70
|
+
## Page Structure Pattern
|
|
71
|
+
|
|
72
|
+
```tsx
|
|
73
|
+
import { Container, Stack, Heading, Text } from "@madecki/ui";
|
|
74
|
+
|
|
75
|
+
export function Page() {
|
|
76
|
+
return (
|
|
77
|
+
<Container size="lg">
|
|
78
|
+
<Stack gap="6">
|
|
79
|
+
<Heading level={1}>Page Title</Heading>
|
|
80
|
+
<Text color="muted">Page description</Text>
|
|
81
|
+
{/* Content */}
|
|
82
|
+
</Stack>
|
|
83
|
+
</Container>
|
|
84
|
+
);
|
|
85
|
+
}
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
## Rules
|
|
89
|
+
|
|
90
|
+
1. NEVER create custom Button, Input, Heading, or Text components
|
|
91
|
+
2. NEVER use arbitrary Tailwind values like `bg-[#123456]` or `p-[17px]`
|
|
92
|
+
3. ALWAYS use `Container` for page wrappers
|
|
93
|
+
4. ALWAYS use `Stack` or `Grid` for component layouts
|
|
94
|
+
5. ALWAYS support dark mode when adding custom styles
|
|
95
|
+
```
|