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