@madecki/ui 0.1.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 +450 -43
- package/cursor-rule-template.md +95 -0
- package/dist/index.cjs +210 -7
- 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 +205 -8
- package/dist/index.js.map +1 -1
- package/llm-context.md +104 -0
- package/package.json +30 -24
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
|
|
|
@@ -15,15 +30,29 @@ pnpm add @madecki/ui
|
|
|
15
30
|
## Requirements
|
|
16
31
|
|
|
17
32
|
- React 18+
|
|
18
|
-
- Tailwind CSS
|
|
33
|
+
- Tailwind CSS 4+
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
## MFE Consistency Guide
|
|
38
|
+
|
|
39
|
+
### 1. Tailwind Configuration (Required)
|
|
40
|
+
|
|
41
|
+
All MFE apps **must** use the shared Tailwind preset to ensure identical design tokens.
|
|
19
42
|
|
|
20
|
-
|
|
43
|
+
**Option A: Using CSS `@config` directive (recommended for Tailwind v4)**
|
|
21
44
|
|
|
22
|
-
|
|
45
|
+
```css
|
|
46
|
+
/* app.css or globals.css */
|
|
47
|
+
@import "tailwindcss";
|
|
48
|
+
@config "@madecki/ui/tailwind-preset";
|
|
49
|
+
@source "./node_modules/@madecki/ui/dist/**/*.{js,cjs}";
|
|
50
|
+
```
|
|
23
51
|
|
|
24
|
-
|
|
52
|
+
**Option B: Using JavaScript config**
|
|
25
53
|
|
|
26
54
|
```js
|
|
55
|
+
// tailwind.config.js
|
|
27
56
|
import { madeckiPreset } from "@madecki/ui/tailwind-preset";
|
|
28
57
|
|
|
29
58
|
/** @type {import('tailwindcss').Config} */
|
|
@@ -31,44 +60,321 @@ export default {
|
|
|
31
60
|
presets: [madeckiPreset],
|
|
32
61
|
content: [
|
|
33
62
|
"./src/**/*.{js,ts,jsx,tsx}",
|
|
34
|
-
// Include the package components
|
|
35
63
|
"./node_modules/@madecki/ui/dist/**/*.{js,cjs}",
|
|
36
64
|
],
|
|
37
|
-
// ... your config
|
|
38
65
|
};
|
|
39
66
|
```
|
|
40
67
|
|
|
41
|
-
### 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:
|
|
42
106
|
|
|
43
107
|
```tsx
|
|
44
|
-
|
|
45
|
-
|
|
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
|
+
|
|
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
|
|
46
168
|
```
|
|
47
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
|
+
---
|
|
237
|
+
|
|
48
238
|
## Components
|
|
49
239
|
|
|
50
|
-
###
|
|
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.
|
|
297
|
+
|
|
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 |
|
|
51
325
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
326
|
+
### Interactive Components
|
|
327
|
+
|
|
328
|
+
#### Button
|
|
329
|
+
|
|
330
|
+
Primary button with multiple color variants and sizes.
|
|
56
331
|
|
|
57
332
|
```tsx
|
|
58
333
|
<Button variant="primary" size="md" onClick={() => {}}>
|
|
59
334
|
Click me
|
|
60
335
|
</Button>
|
|
336
|
+
```
|
|
337
|
+
|
|
338
|
+
#### ButtonTransparent
|
|
339
|
+
|
|
340
|
+
Transparent/outlined button variant.
|
|
61
341
|
|
|
342
|
+
```tsx
|
|
62
343
|
<ButtonTransparent variant="success">
|
|
63
344
|
Transparent Button
|
|
64
345
|
</ButtonTransparent>
|
|
346
|
+
```
|
|
347
|
+
|
|
348
|
+
#### GradientButton
|
|
349
|
+
|
|
350
|
+
Button with gradient border effect.
|
|
65
351
|
|
|
352
|
+
```tsx
|
|
66
353
|
<GradientButton size="lg">
|
|
67
354
|
Gradient Button
|
|
68
355
|
</GradientButton>
|
|
69
356
|
```
|
|
70
357
|
|
|
71
|
-
|
|
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.
|
|
72
378
|
|
|
73
379
|
```tsx
|
|
74
380
|
<Input
|
|
@@ -81,35 +387,55 @@ import { Heart, Share, TwitterIcon } from "@madecki/ui";
|
|
|
81
387
|
/>
|
|
82
388
|
```
|
|
83
389
|
|
|
84
|
-
###
|
|
390
|
+
### Navigation
|
|
391
|
+
|
|
392
|
+
#### Tabs
|
|
393
|
+
|
|
394
|
+
Tab navigation component.
|
|
85
395
|
|
|
86
396
|
```tsx
|
|
87
397
|
<Tabs
|
|
88
398
|
tabs={[
|
|
89
399
|
{ label: "Tab 1", value: "tab1" },
|
|
90
400
|
{ label: "Tab 2", value: "tab2" },
|
|
91
|
-
{ label: "Tab 3", value: "tab3" },
|
|
92
401
|
]}
|
|
93
402
|
onTabClick={(value) => console.log("Selected:", value)}
|
|
94
403
|
/>
|
|
95
404
|
```
|
|
96
405
|
|
|
97
|
-
###
|
|
406
|
+
### Feedback Components
|
|
407
|
+
|
|
408
|
+
#### Spinner
|
|
409
|
+
|
|
410
|
+
Loading spinner with size variants.
|
|
98
411
|
|
|
99
412
|
```tsx
|
|
100
413
|
<Spinner size="md" />
|
|
414
|
+
```
|
|
415
|
+
|
|
416
|
+
#### SpinnerOverlay
|
|
417
|
+
|
|
418
|
+
Full-screen loading overlay.
|
|
419
|
+
|
|
420
|
+
```tsx
|
|
101
421
|
<SpinnerOverlay isVisible={isLoading} />
|
|
102
422
|
```
|
|
103
423
|
|
|
104
|
-
###
|
|
424
|
+
### Content Components
|
|
425
|
+
|
|
426
|
+
#### BlockQuote
|
|
427
|
+
|
|
428
|
+
Styled blockquote for quotations.
|
|
105
429
|
|
|
106
430
|
```tsx
|
|
107
431
|
<BlockQuote>
|
|
108
|
-
"This is a quote with
|
|
432
|
+
"This is a quote with nice styling."
|
|
109
433
|
</BlockQuote>
|
|
110
434
|
```
|
|
111
435
|
|
|
112
|
-
|
|
436
|
+
#### ContentBox
|
|
437
|
+
|
|
438
|
+
Info/warning/success/danger boxes with icon support.
|
|
113
439
|
|
|
114
440
|
```tsx
|
|
115
441
|
import { ContentBox, Info, Warning } from "@madecki/ui";
|
|
@@ -123,20 +449,24 @@ import { ContentBox, Info, Warning } from "@madecki/ui";
|
|
|
123
449
|
</ContentBox>
|
|
124
450
|
```
|
|
125
451
|
|
|
126
|
-
|
|
452
|
+
#### Hr
|
|
453
|
+
|
|
454
|
+
Styled horizontal rule.
|
|
127
455
|
|
|
128
456
|
```tsx
|
|
129
457
|
<Hr className="my-8" />
|
|
130
458
|
```
|
|
131
459
|
|
|
460
|
+
---
|
|
461
|
+
|
|
132
462
|
## Icons
|
|
133
463
|
|
|
134
464
|
### Heart
|
|
135
465
|
|
|
136
466
|
```tsx
|
|
137
|
-
<Heart variant="outline" />
|
|
138
|
-
<Heart variant="filled" />
|
|
139
|
-
<Heart variant="gradient" />
|
|
467
|
+
<Heart variant="outline" />
|
|
468
|
+
<Heart variant="filled" />
|
|
469
|
+
<Heart variant="gradient" />
|
|
140
470
|
```
|
|
141
471
|
|
|
142
472
|
### Share
|
|
@@ -161,29 +491,47 @@ import { ContentBox, Info, Warning } from "@madecki/ui";
|
|
|
161
491
|
<LinkedInIcon />
|
|
162
492
|
<InstagramIcon />
|
|
163
493
|
|
|
164
|
-
|
|
494
|
+
{/* Without wrapper */}
|
|
165
495
|
<TwitterIcon withWrapper={false} />
|
|
166
496
|
```
|
|
167
497
|
|
|
168
|
-
|
|
498
|
+
---
|
|
499
|
+
|
|
500
|
+
## MFE Integration Checklist
|
|
501
|
+
|
|
502
|
+
Use this checklist when integrating the library into a new MFE app:
|
|
169
503
|
|
|
170
|
-
|
|
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)
|
|
171
514
|
|
|
172
|
-
|
|
173
|
-
|-----------|-----------|
|
|
174
|
-
| primary | #1E1E1E |
|
|
175
|
-
| darkgray | #272727 |
|
|
176
|
-
| lightgray | #6D6D6D |
|
|
177
|
-
| gray | #3A3A3A |
|
|
178
|
-
| white | #FCFAF7 |
|
|
179
|
-
| success | #87BB54 |
|
|
180
|
-
| danger | #CB5065 |
|
|
181
|
-
| info | #714E8E |
|
|
182
|
-
| blue | #2084E1 |
|
|
183
|
-
| warning | #EDA867 |
|
|
184
|
-
| neutral | #E1E1E1 |
|
|
515
|
+
---
|
|
185
516
|
|
|
186
|
-
|
|
517
|
+
## Extending the Library
|
|
518
|
+
|
|
519
|
+
### Adding Custom Components
|
|
520
|
+
|
|
521
|
+
When you need components not in the library, follow these guidelines:
|
|
522
|
+
|
|
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
|
|
527
|
+
|
|
528
|
+
### When NOT to Use Library Components
|
|
529
|
+
|
|
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
|
+
---
|
|
187
535
|
|
|
188
536
|
## Development
|
|
189
537
|
|
|
@@ -201,6 +549,65 @@ npm run build
|
|
|
201
549
|
npm run typecheck
|
|
202
550
|
```
|
|
203
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
|
+
|
|
572
|
+
## Releasing
|
|
573
|
+
|
|
574
|
+
Releases are fully automated using [semantic-release](https://semantic-release.gitbook.io/). When commits are pushed to `main`, the CI automatically:
|
|
575
|
+
|
|
576
|
+
1. Analyzes commit messages to determine the version bump
|
|
577
|
+
2. Updates `package.json` and `CHANGELOG.md`
|
|
578
|
+
3. Creates a Git tag and GitHub Release
|
|
579
|
+
4. Publishes to NPM with provenance
|
|
580
|
+
|
|
581
|
+
### Commit Message Format
|
|
582
|
+
|
|
583
|
+
This project uses [Conventional Commits](https://www.conventionalcommits.org/) enforced by [commitlint](https://commitlint.js.org/).
|
|
584
|
+
|
|
585
|
+
**Format:** `type(scope?): description`
|
|
586
|
+
|
|
587
|
+
| Type | Description | Release |
|
|
588
|
+
|------|-------------|---------|
|
|
589
|
+
| `feat` | New feature | Minor |
|
|
590
|
+
| `fix` | Bug fix | Patch |
|
|
591
|
+
| `docs` | Documentation only | None |
|
|
592
|
+
| `style` | Code style (formatting) | None |
|
|
593
|
+
| `refactor` | Code change (no fix/feat) | None |
|
|
594
|
+
| `perf` | Performance improvement | Patch |
|
|
595
|
+
| `test` | Adding/updating tests | None |
|
|
596
|
+
| `chore` | Maintenance tasks | None |
|
|
597
|
+
|
|
598
|
+
### Examples
|
|
599
|
+
|
|
600
|
+
```bash
|
|
601
|
+
# Bug fix → patch release (1.0.0 → 1.0.1)
|
|
602
|
+
git commit -m "fix: resolve button click handler"
|
|
603
|
+
|
|
604
|
+
# New feature → minor release (1.0.0 → 1.1.0)
|
|
605
|
+
git commit -m "feat: add Toast notification component"
|
|
606
|
+
|
|
607
|
+
# Breaking change → major release (1.0.0 → 2.0.0)
|
|
608
|
+
git commit -m "feat!: drop support for React 17"
|
|
609
|
+
```
|
|
610
|
+
|
|
204
611
|
## License
|
|
205
612
|
|
|
206
613
|
MIT
|
|
@@ -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
|
+
```
|