@reactberry/system 2.0.0-beta
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 +48 -0
- package/package.json +74 -0
- package/src/blocks/Accordion/index.tsx +158 -0
- package/src/blocks/AnimatedCarousel/index.tsx +188 -0
- package/src/blocks/AppleGlow/index.tsx +144 -0
- package/src/blocks/Avatar/index.tsx +167 -0
- package/src/blocks/Await/index.tsx +45 -0
- package/src/blocks/Cards/AnimatedCard/index.tsx +175 -0
- package/src/blocks/Cards/FluorescentCard/index.tsx +180 -0
- package/src/blocks/Cards/InfoCard/index.tsx +206 -0
- package/src/blocks/Cards/TickerCard/index.tsx +125 -0
- package/src/blocks/Carousel/index.tsx +216 -0
- package/src/blocks/Checkbox/index.tsx +101 -0
- package/src/blocks/Collection/index.tsx +59 -0
- package/src/blocks/Container/index.tsx +55 -0
- package/src/blocks/Controls/Control.tsx +67 -0
- package/src/blocks/Controls/index.tsx +11 -0
- package/src/blocks/CyclingNumber/index.tsx +78 -0
- package/src/blocks/DisplaySet/index.tsx +42 -0
- package/src/blocks/Divider/index.tsx +14 -0
- package/src/blocks/Draggable/index.tsx +266 -0
- package/src/blocks/Drawer/index.tsx +136 -0
- package/src/blocks/DynamicIsland/DynamicIsland.tsx +89 -0
- package/src/blocks/DynamicIsland/index.tsx +2 -0
- package/src/blocks/Fader/index.tsx +145 -0
- package/src/blocks/FamilyDrawer/README.md +116 -0
- package/src/blocks/FamilyDrawer/example.tsx +108 -0
- package/src/blocks/FamilyDrawer/index.tsx +119 -0
- package/src/blocks/FamilyDrawer/views/DefaultView.tsx +93 -0
- package/src/blocks/FamilyDrawer/views/KeyView.tsx +129 -0
- package/src/blocks/FamilyDrawer/views/PhraseView.tsx +129 -0
- package/src/blocks/FamilyDrawer/views/RemoveView.tsx +81 -0
- package/src/blocks/FieldSet/index.tsx +173 -0
- package/src/blocks/Filesystem/index.tsx +198 -0
- package/src/blocks/Gallery/Carousel/index.tsx +257 -0
- package/src/blocks/Gallery/Modal/index.tsx +83 -0
- package/src/blocks/Gallery/index.tsx +57 -0
- package/src/blocks/Gallery/utils/animationVariants.ts +18 -0
- package/src/blocks/Gallery/utils/aspectRatio.ts +14 -0
- package/src/blocks/Gallery/utils/downloadPhoto.ts +24 -0
- package/src/blocks/Gallery/utils/range.ts +11 -0
- package/src/blocks/GradientMesh/index.tsx +106 -0
- package/src/blocks/Group/index.tsx +152 -0
- package/src/blocks/Heading/index.tsx +111 -0
- package/src/blocks/HorizontalScroller/index.tsx +135 -0
- package/src/blocks/Icon/index.tsx +45 -0
- package/src/blocks/Indicator/index.tsx +27 -0
- package/src/blocks/InlineEditor/index.tsx +216 -0
- package/src/blocks/List/index.tsx +657 -0
- package/src/blocks/Main/index.tsx +17 -0
- package/src/blocks/Marquee/index.tsx +116 -0
- package/src/blocks/MaskedField/index.tsx +199 -0
- package/src/blocks/Menu/MenuContent.tsx +246 -0
- package/src/blocks/Menu/MenuContext.tsx +34 -0
- package/src/blocks/Menu/MenuItem.tsx +104 -0
- package/src/blocks/Menu/index.tsx +60 -0
- package/src/blocks/Modal/index.tsx +268 -0
- package/src/blocks/MorphingPopover/index.tsx +294 -0
- package/src/blocks/Overlay/Backdrop.tsx +48 -0
- package/src/blocks/Overlay/OverscrollGuard.tsx +36 -0
- package/src/blocks/Overlay/index.ts +2 -0
- package/src/blocks/Parallax/index.tsx +117 -0
- package/src/blocks/ParallaxSection/index.tsx +61 -0
- package/src/blocks/Placeholder/index.tsx +48 -0
- package/src/blocks/Popover/index.tsx +402 -0
- package/src/blocks/Progress/getProgressColor.ts +61 -0
- package/src/blocks/Progress/index.tsx +179 -0
- package/src/blocks/ProgressiveBlur/index.tsx +75 -0
- package/src/blocks/README.md +15 -0
- package/src/blocks/RenderAsset/index.tsx +18 -0
- package/src/blocks/ScrollContainer/index.tsx +93 -0
- package/src/blocks/ShinyText/index.tsx +72 -0
- package/src/blocks/Skeleton/index.tsx +71 -0
- package/src/blocks/Slider/SliderControls.tsx +119 -0
- package/src/blocks/Slider/index.tsx +140 -0
- package/src/blocks/Slider/useSlider.ts +126 -0
- package/src/blocks/Slideshow/index.tsx +177 -0
- package/src/blocks/Spotlight/index.tsx +144 -0
- package/src/blocks/Steps/StepIndicator.tsx +149 -0
- package/src/blocks/Steps/StepProgress.tsx +164 -0
- package/src/blocks/Steps/Steps.tsx +197 -0
- package/src/blocks/Steps/StepsNav.tsx +30 -0
- package/src/blocks/Steps/StepsTracker.tsx +80 -0
- package/src/blocks/Steps/hooks.ts +71 -0
- package/src/blocks/Steps/index.tsx +16 -0
- package/src/blocks/Steps/types.ts +71 -0
- package/src/blocks/StickySectionStack/index.tsx +136 -0
- package/src/blocks/Switch/index.tsx +85 -0
- package/src/blocks/SystemNotice/index.tsx +81 -0
- package/src/blocks/Table/README.md +251 -0
- package/src/blocks/Table/Table.tsx +207 -0
- package/src/blocks/Table/TablePagination.tsx +189 -0
- package/src/blocks/Table/index.ts +33 -0
- package/src/blocks/Table/useTableControls.ts +331 -0
- package/src/blocks/Tag/index.tsx +27 -0
- package/src/blocks/TextBreak/index.tsx +96 -0
- package/src/blocks/TextReveal/index.tsx +104 -0
- package/src/blocks/Thumbnail/index.tsx +26 -0
- package/src/blocks/Ticker/index.tsx +112 -0
- package/src/blocks/Toast/index.tsx +77 -0
- package/src/blocks/Tooltip/index.tsx +174 -0
- package/src/blocks/Underlay/index.tsx +104 -0
- package/src/blocks/Upload/Dropzone.tsx +92 -0
- package/src/blocks/Upload/UploadBtn.tsx +38 -0
- package/src/blocks/Upload/index.tsx +61 -0
- package/src/blocks/Upload/types.ts +37 -0
- package/src/blocks/VideoMarquee/index.tsx +511 -0
- package/src/blocks/index.ts +119 -0
- package/src/blocks/pagination/Pagination.tsx +148 -0
- package/src/blocks/pagination/PaginationList.tsx +41 -0
- package/src/blocks/pagination/index.ts +2 -0
- package/src/charts/BarChart.tsx +63 -0
- package/src/charts/PieChart.tsx +39 -0
- package/src/charts/index.ts +3 -0
- package/src/charts/utils.ts +103 -0
- package/src/docs/README.md +373 -0
- package/src/docs/reference/README.md +299 -0
- package/src/elements/box.ts +163 -0
- package/src/elements/button.ts +49 -0
- package/src/elements/field.ts +129 -0
- package/src/elements/index.ts +8 -0
- package/src/elements/text.ts +47 -0
- package/src/elements/utils.js +97 -0
- package/src/hooks/use-copy-to-clipboard.tsx +33 -0
- package/src/hooks/use-enter-submit.tsx +23 -0
- package/src/hooks/use-local-storage.ts +42 -0
- package/src/hooks/use-sidebar.tsx +109 -0
- package/src/hooks/useAnimatedText.ts +32 -0
- package/src/hooks/useAutosizeTextArea.ts +45 -0
- package/src/hooks/useBreakpoint.tsx +123 -0
- package/src/hooks/useClickOutside.tsx +38 -0
- package/src/hooks/useHover.tsx +33 -0
- package/src/hooks/useHoverList.tsx +17 -0
- package/src/hooks/useKeyboardShortcuts.ts +91 -0
- package/src/hooks/useKeypress.ts +27 -0
- package/src/hooks/useOverlay.ts +32 -0
- package/src/hooks/useReducedMotion.ts +25 -0
- package/src/hooks/useStandaloneMode.ts +35 -0
- package/src/hooks/useTouchDevice.ts +34 -0
- package/src/icons/index.tsx +129 -0
- package/src/index.ts +12 -0
- package/src/providers/DesignSystemProvider.tsx +35 -0
- package/src/providers/StyledComponentsRegistry.tsx +30 -0
- package/src/providers/index.ts +2 -0
- package/src/themes/README.md +30 -0
- package/src/themes/default/assets/badge-avatar.tsx +45 -0
- package/src/themes/default/assets/logo.tsx +42 -0
- package/src/themes/default/global.ts +138 -0
- package/src/themes/default/modes/dark/config.js +49 -0
- package/src/themes/default/modes/dark/skins.js +631 -0
- package/src/themes/default/modes/dark/theme.js +87 -0
- package/src/themes/default/modes/light/config.js +48 -0
- package/src/themes/default/modes/light/skins.js +1026 -0
- package/src/themes/default/modes/light/theme.js +74 -0
- package/src/themes/default/tokens/controls.js +53 -0
- package/src/themes/default/tokens/shadows.js +63 -0
- package/src/themes/default/tokens/shapes.js +37 -0
- package/src/themes/default/tokens/space.js +143 -0
- package/src/themes/default/tokens/spectre.js +16 -0
- package/src/themes/default/utils.js +523 -0
- package/src/themes/index.ts +11 -0
- package/src/types.ts +394 -0
- package/src/utils/overlayTheme.ts +61 -0
- package/src/utils/pickColor.ts +15 -0
- package/tsconfig.json +24 -0
|
@@ -0,0 +1,373 @@
|
|
|
1
|
+
# Design System Documentation
|
|
2
|
+
|
|
3
|
+
This directory contains comprehensive documentation for this React-based component library built with styled-components and styled-system for consistent, accessible, and maintainable user interfaces.
|
|
4
|
+
|
|
5
|
+
> **📋 Documentation Status:** Currently under active improvement. See [DOCUMENTATION_AUDIT.md](./DOCUMENTATION_AUDIT.md) for current gaps and planned improvements.
|
|
6
|
+
|
|
7
|
+
## Quick Start
|
|
8
|
+
|
|
9
|
+
**New to the design system?** Start here:
|
|
10
|
+
1. 📖 [Getting Started Guide](./guides/getting-started.md) - Your first components
|
|
11
|
+
2. 🧩 [Component Composition](./guides/component-composition.md) - Building complex UIs
|
|
12
|
+
3. 🎨 [Theme Integration](./guides/theming-guide.md) - Customizing appearance
|
|
13
|
+
4. 📱 [Responsive Design](./guides/responsive-design.md) - Mobile-first patterns
|
|
14
|
+
|
|
15
|
+
## Documentation Structure
|
|
16
|
+
|
|
17
|
+
```
|
|
18
|
+
docs/
|
|
19
|
+
├── README.md # This overview
|
|
20
|
+
├── DOCUMENTATION_AUDIT.md # Current status and improvement plan
|
|
21
|
+
├── index.md # Quick reference for AI assistants
|
|
22
|
+
├── elements.md # Core components (Box, Text, Button, Field)
|
|
23
|
+
├── blocks.md # Composed components (⚠️ Being expanded)
|
|
24
|
+
├── themes.md # Theme system and customization
|
|
25
|
+
├── api/ # Detailed component APIs
|
|
26
|
+
│ ├── Box.md # Layout component reference
|
|
27
|
+
│ ├── Text.md # Typography component reference
|
|
28
|
+
│ ├── Button.md # Button component reference
|
|
29
|
+
│ ├── Field.md # Form input reference
|
|
30
|
+
│ └── blocks/ # 🚧 Block components (coming soon)
|
|
31
|
+
├── guides/ # Step-by-step tutorials
|
|
32
|
+
│ ├── getting-started.md # Your first components
|
|
33
|
+
│ ├── component-composition.md # Building complex UIs
|
|
34
|
+
│ ├── theming-guide.md # Customizing themes
|
|
35
|
+
│ ├── responsive-design.md # Mobile-first patterns
|
|
36
|
+
│ ├── accessibility.md # Building inclusive interfaces
|
|
37
|
+
│ └── 🚧 Additional guides # Migration, testing, performance
|
|
38
|
+
├── examples/ # Practical patterns
|
|
39
|
+
│ ├── layouts/ # Layout examples
|
|
40
|
+
│ ├── forms/ # Form patterns
|
|
41
|
+
│ └── 🚧 More examples # Navigation, cards, patterns
|
|
42
|
+
└── assets/ # Design resources
|
|
43
|
+
├── design-tokens.md # Token reference
|
|
44
|
+
├── color-palettes.md # Color system
|
|
45
|
+
└── typography-scale.md # Typography system
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
**Legend:** ✅ Complete | ⚠️ Partial | 🚧 In Progress | 📋 Planned
|
|
49
|
+
|
|
50
|
+
## Quick Start Guide
|
|
51
|
+
|
|
52
|
+
### 1. Import Components
|
|
53
|
+
|
|
54
|
+
```jsx
|
|
55
|
+
// Core elements (fully documented)
|
|
56
|
+
import { Box, Text, Button, Field } from '@/design-system/elements';
|
|
57
|
+
|
|
58
|
+
// Composed blocks (documentation in progress)
|
|
59
|
+
import { Avatar, Container, Heading } from '@/design-system/blocks';
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### 2. Basic Usage
|
|
63
|
+
|
|
64
|
+
```jsx
|
|
65
|
+
function WelcomeCard() {
|
|
66
|
+
return (
|
|
67
|
+
<Box skin="card" p="m" gap="s" maxWidth="400px">
|
|
68
|
+
<Text as="h2" fontSize="l" fontWeight="bold" color="primary">
|
|
69
|
+
Welcome to Design System
|
|
70
|
+
</Text>
|
|
71
|
+
<Text as="p" fontSize="s" color="secondary" lineHeight="relaxed">
|
|
72
|
+
Build amazing interfaces with our design system.
|
|
73
|
+
</Text>
|
|
74
|
+
<Button variant="primary" $size="medium">
|
|
75
|
+
Get Started
|
|
76
|
+
</Button>
|
|
77
|
+
</Box>
|
|
78
|
+
);
|
|
79
|
+
}
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### 3. Theme Integration
|
|
83
|
+
|
|
84
|
+
```jsx
|
|
85
|
+
import { ThemeProvider } from '@/lib/theme-provider';
|
|
86
|
+
import { theme } from '@/design-system/themes';
|
|
87
|
+
|
|
88
|
+
function App() {
|
|
89
|
+
return (
|
|
90
|
+
<ThemeProvider theme={theme}>
|
|
91
|
+
<WelcomeCard />
|
|
92
|
+
</ThemeProvider>
|
|
93
|
+
);
|
|
94
|
+
}
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
> **💡 Tip:** For complete examples and patterns, see our [Getting Started Guide](./guides/getting-started.md).
|
|
98
|
+
|
|
99
|
+
## Core Architecture
|
|
100
|
+
|
|
101
|
+
### Component Hierarchy
|
|
102
|
+
|
|
103
|
+
```
|
|
104
|
+
┌─────────────────────────────────────┐
|
|
105
|
+
│ Applications │
|
|
106
|
+
├─────────────────────────────────────┤
|
|
107
|
+
│ Blocks │ ← 50+ Composed Components
|
|
108
|
+
│ (Avatar, Card, Modal, Layout) │
|
|
109
|
+
├─────────────────────────────────────┤
|
|
110
|
+
│ Elements │ ← Core Building Blocks
|
|
111
|
+
│ (Box, Text, Button, Field) │
|
|
112
|
+
├─────────────────────────────────────┤
|
|
113
|
+
│ Themes │ ← Design Tokens & Styling
|
|
114
|
+
│ (Colors, Typography, etc.) │
|
|
115
|
+
└─────────────────────────────────────┘
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
### Component Rules
|
|
119
|
+
|
|
120
|
+
#### Box Component (Layout Only)
|
|
121
|
+
- **Use for**: containers, layouts, divs, non-text elements
|
|
122
|
+
- **⚠️ NO typography props**: fontSize, fontWeight, color, etc.
|
|
123
|
+
- **Props**: `skin`, `shape`, `gap`, `p`, `m`, `display`, flex/grid props
|
|
124
|
+
|
|
125
|
+
#### Text Component (All Text Content)
|
|
126
|
+
- **Use for**: h1-6, p, span, label, any text content
|
|
127
|
+
- **✅ Has typography props**: fontSize, fontWeight, color, lineHeight
|
|
128
|
+
- **Extends**: All Box props + typography props
|
|
129
|
+
|
|
130
|
+
#### Button & Field Components
|
|
131
|
+
- **Button**: Extends Text with interactive functionality
|
|
132
|
+
- **Field**: Extends Text with form input capabilities
|
|
133
|
+
|
|
134
|
+
## Essential Concepts
|
|
135
|
+
|
|
136
|
+
### 1. Theme Aliases (Always Use These)
|
|
137
|
+
|
|
138
|
+
```jsx
|
|
139
|
+
// ✅ Good - Use theme aliases
|
|
140
|
+
<Box p="m" gap="s" />
|
|
141
|
+
<Text fontSize="l" color="primary" />
|
|
142
|
+
|
|
143
|
+
// ❌ Bad - Don't use indices or arbitrary values
|
|
144
|
+
<Box p={5} gap="12px" />
|
|
145
|
+
<Text fontSize="18px" color="#3B82F6" />
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
**Available Aliases:**
|
|
149
|
+
- **Space**: `mini`, `xs`, `s`, `m`, `l`, `xl`, `xxl`, `xxxl`
|
|
150
|
+
- **Font Sizes**: `xs`, `s`, `m`, `l`, `xl`, `xxl`, `xxxl`
|
|
151
|
+
- **Shapes**: `square`, `roundedSmall`, `rounded`, `roundedLarge`, `pill`, `circle`
|
|
152
|
+
|
|
153
|
+
### 2. Skin System
|
|
154
|
+
|
|
155
|
+
Pre-defined styling combinations for consistency:
|
|
156
|
+
|
|
157
|
+
```jsx
|
|
158
|
+
// Surface skins for containers
|
|
159
|
+
<Box skin="base">Base background</Box>
|
|
160
|
+
<Box skin="surface">Secondary surface</Box>
|
|
161
|
+
<Box skin="card">Card with elevation</Box>
|
|
162
|
+
|
|
163
|
+
// Semantic skins for meaning
|
|
164
|
+
<Box skin="success">Success state</Box>
|
|
165
|
+
<Box skin="error">Error state</Box>
|
|
166
|
+
<Box skin="warning">Warning state</Box>
|
|
167
|
+
|
|
168
|
+
// Color coding
|
|
169
|
+
<Box skin="blue">Blue category</Box>
|
|
170
|
+
<Box skin="green">Green category</Box>
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
### 3. Responsive Design
|
|
174
|
+
|
|
175
|
+
Mobile-first approach with responsive arrays:
|
|
176
|
+
|
|
177
|
+
```jsx
|
|
178
|
+
<Box
|
|
179
|
+
width={[1, 1/2, 1/3]} // 100% → 50% → 33%
|
|
180
|
+
p={['xs', 's', 'm']} // 8px → 12px → 16px
|
|
181
|
+
display={['block', 'flex']} // block → flex
|
|
182
|
+
>
|
|
183
|
+
<Text fontSize={['s', 'm', 'l']}>
|
|
184
|
+
Responsive content
|
|
185
|
+
</Text>
|
|
186
|
+
</Box>
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
## Key Documentation
|
|
190
|
+
|
|
191
|
+
### 📚 Core References (✅ Complete)
|
|
192
|
+
- **[elements.md](./elements.md)** - Complete Box, Text, Button, Field documentation
|
|
193
|
+
- **[blocks.md](./blocks.md)** - Composed components overview (⚠️ Individual docs in progress)
|
|
194
|
+
- **[themes.md](./themes.md)** - Theme system, tokens, and customization
|
|
195
|
+
|
|
196
|
+
### 🔧 Detailed APIs (✅ Core Elements Complete)
|
|
197
|
+
- **[api/Box.md](./api/Box.md)** - Layout component props and patterns
|
|
198
|
+
- **[api/Text.md](./api/Text.md)** - Typography component and semantic HTML
|
|
199
|
+
- **[api/Button.md](./api/Button.md)** - Interactive button variants and states
|
|
200
|
+
- **[api/Field.md](./api/Field.md)** - Form input types and validation
|
|
201
|
+
- **api/blocks/** - 🚧 Individual block component documentation (coming soon)
|
|
202
|
+
|
|
203
|
+
### 📖 Step-by-Step Guides (✅ Core Guides Complete)
|
|
204
|
+
- **[guides/getting-started.md](./guides/getting-started.md)** - Build your first components
|
|
205
|
+
- **[guides/component-composition.md](./guides/component-composition.md)** - Complex UI patterns
|
|
206
|
+
- **[guides/responsive-design.md](./guides/responsive-design.md)** - Mobile-first design
|
|
207
|
+
- **[guides/accessibility.md](./guides/accessibility.md)** - Inclusive interfaces
|
|
208
|
+
- **[guides/theming-guide.md](./guides/theming-guide.md)** - Theme customization
|
|
209
|
+
|
|
210
|
+
### 💡 Real-World Examples (⚠️ Expanding)
|
|
211
|
+
- **[examples/layouts/dashboard.md](./examples/layouts/dashboard.md)** - Dashboard patterns
|
|
212
|
+
- **[examples/forms/form-patterns.md](./examples/forms/form-patterns.md)** - Form design patterns
|
|
213
|
+
- **examples/navigation/** - 🚧 Navigation patterns (planned)
|
|
214
|
+
- **examples/cards/** - 🚧 Card patterns (planned)
|
|
215
|
+
|
|
216
|
+
### 🎨 Design Assets (✅ Complete)
|
|
217
|
+
- **[assets/design-tokens.md](./assets/design-tokens.md)** - Complete token reference
|
|
218
|
+
- **[assets/color-palettes.md](./assets/color-palettes.md)** - Color system and accessibility
|
|
219
|
+
- **[assets/typography-scale.md](./assets/typography-scale.md)** - Typography system
|
|
220
|
+
|
|
221
|
+
## Common Patterns
|
|
222
|
+
|
|
223
|
+
### Form Field Pattern
|
|
224
|
+
```jsx
|
|
225
|
+
<Box>
|
|
226
|
+
<Text as="label" htmlFor="email" fontSize="s" fontWeight="medium" mb="xs">
|
|
227
|
+
Email Address
|
|
228
|
+
</Text>
|
|
229
|
+
<Field
|
|
230
|
+
id="email"
|
|
231
|
+
as="input"
|
|
232
|
+
type="email"
|
|
233
|
+
placeholder="Enter your email"
|
|
234
|
+
variant="outline"
|
|
235
|
+
$size="medium"
|
|
236
|
+
/>
|
|
237
|
+
</Box>
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
### Interactive Card Pattern
|
|
241
|
+
```jsx
|
|
242
|
+
<Box
|
|
243
|
+
skin="card"
|
|
244
|
+
p="m"
|
|
245
|
+
cursor="pointer"
|
|
246
|
+
hover="subtle"
|
|
247
|
+
focus="highlight"
|
|
248
|
+
shape="rounded"
|
|
249
|
+
>
|
|
250
|
+
<Text as="h3" fontSize="m" fontWeight="bold">Card Title</Text>
|
|
251
|
+
<Text fontSize="s" color="secondary">Card content</Text>
|
|
252
|
+
</Box>
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
### Navigation Pattern
|
|
256
|
+
```jsx
|
|
257
|
+
<Box display="flex" alignItems="center" justifyContent="space-between" p="m">
|
|
258
|
+
<Text as="h1" fontSize="l" fontWeight="bold" color="primary">
|
|
259
|
+
Reactberry
|
|
260
|
+
</Text>
|
|
261
|
+
<Box display="flex" gap="m" alignItems="center">
|
|
262
|
+
<Text as="a" href="/home" fontSize="s">Home</Text>
|
|
263
|
+
<Button variant="primary" $size="small">Sign In</Button>
|
|
264
|
+
</Box>
|
|
265
|
+
</Box>
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
## Best Practices Summary
|
|
269
|
+
|
|
270
|
+
### ✅ Do
|
|
271
|
+
1. **Use Text for all text content**
|
|
272
|
+
```jsx
|
|
273
|
+
<Text as="h1">Heading</Text>
|
|
274
|
+
<Text as="p">Paragraph</Text>
|
|
275
|
+
<Text as="label">Label</Text>
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
2. **Use theme aliases consistently**
|
|
279
|
+
```jsx
|
|
280
|
+
<Box p="m" gap="s" />
|
|
281
|
+
<Text fontSize="l" color="primary" />
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
3. **Follow semantic HTML structure**
|
|
285
|
+
```jsx
|
|
286
|
+
<Box as="main">
|
|
287
|
+
<Text as="h1">Page Title</Text>
|
|
288
|
+
<Text as="p">Content</Text>
|
|
289
|
+
</Box>
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
4. **Use appropriate skins for meaning**
|
|
293
|
+
```jsx
|
|
294
|
+
<Box skin="card">Container</Box>
|
|
295
|
+
<Box skin="error">Error message</Box>
|
|
296
|
+
```
|
|
297
|
+
|
|
298
|
+
### ❌ Don't
|
|
299
|
+
1. **Don't use Box for text content**
|
|
300
|
+
```jsx
|
|
301
|
+
// Wrong - Box doesn't support typography
|
|
302
|
+
<Box as="h1" fontSize="xl">Title</Box>
|
|
303
|
+
|
|
304
|
+
// Right - Text supports typography
|
|
305
|
+
<Text as="h1" fontSize="xl">Title</Text>
|
|
306
|
+
```
|
|
307
|
+
|
|
308
|
+
2. **Don't use arbitrary values**
|
|
309
|
+
```jsx
|
|
310
|
+
// Wrong - Hardcoded values
|
|
311
|
+
<Box p="16px" color="#333" />
|
|
312
|
+
|
|
313
|
+
// Right - Theme aliases
|
|
314
|
+
<Box p="m" color="primary" />
|
|
315
|
+
```
|
|
316
|
+
|
|
317
|
+
3. **Don't ignore responsive design**
|
|
318
|
+
```jsx
|
|
319
|
+
// Wrong - Fixed sizing
|
|
320
|
+
<Box width="300px" />
|
|
321
|
+
|
|
322
|
+
// Right - Responsive arrays
|
|
323
|
+
<Box width={[1, 1/2, 1/3]} />
|
|
324
|
+
```
|
|
325
|
+
|
|
326
|
+
## Current Status & Roadmap
|
|
327
|
+
|
|
328
|
+
### ✅ Complete
|
|
329
|
+
- **Core Elements**: Fully documented Box, Text, Button, Field components
|
|
330
|
+
- **Theme System**: Comprehensive theme documentation and customization guides
|
|
331
|
+
- **Guides**: Step-by-step tutorials for common patterns
|
|
332
|
+
- **Examples**: Layout and form patterns with working code
|
|
333
|
+
|
|
334
|
+
### 🚧 In Progress
|
|
335
|
+
- **Block Components**: Individual documentation for 50+ composed components
|
|
336
|
+
- **Advanced Examples**: Navigation, cards, and complex patterns
|
|
337
|
+
- **Testing Guide**: Component testing and validation strategies
|
|
338
|
+
- **Performance Guide**: Optimization best practices
|
|
339
|
+
|
|
340
|
+
### 📋 Planned
|
|
341
|
+
- **Migration Guide**: Upgrading between versions
|
|
342
|
+
- **Troubleshooting**: Common issues and solutions
|
|
343
|
+
- **Interactive Playground**: Live component examples
|
|
344
|
+
- **Video Tutorials**: Visual learning resources
|
|
345
|
+
|
|
346
|
+
## Support & Contributing
|
|
347
|
+
|
|
348
|
+
### Getting Help
|
|
349
|
+
- **Quick Reference**: Check [index.md](./index.md) for AI-friendly documentation
|
|
350
|
+
- **Component APIs**: Browse detailed [api/](./api/) documentation
|
|
351
|
+
- **Examples**: See [examples/](./examples/) for real-world patterns
|
|
352
|
+
- **Guides**: Follow step-by-step [guides/](./guides/) tutorials
|
|
353
|
+
- **Issues**: Report documentation gaps in [DOCUMENTATION_AUDIT.md](./DOCUMENTATION_AUDIT.md)
|
|
354
|
+
|
|
355
|
+
### Contributing to Documentation
|
|
356
|
+
1. **Follow the audit plan** - See [DOCUMENTATION_AUDIT.md](./DOCUMENTATION_AUDIT.md) for current priorities
|
|
357
|
+
2. **Use standard templates** - Maintain consistency across all documentation
|
|
358
|
+
3. **Include working examples** - All code should be tested and functional
|
|
359
|
+
4. **Test accessibility** - Ensure examples meet WCAG guidelines
|
|
360
|
+
5. **Update cross-references** - Keep internal links accurate and helpful
|
|
361
|
+
|
|
362
|
+
### Project Overview
|
|
363
|
+
|
|
364
|
+
The design system includes:
|
|
365
|
+
- **50+ Blocks** - Composed components (Avatar, Card, Modal, etc.) ⚠️ *Docs in progress*
|
|
366
|
+
- **4 Core Elements** - Building blocks (Box, Text, Button, Field) ✅ *Fully documented*
|
|
367
|
+
- **Comprehensive Theming** - Colors, typography, spacing, shapes ✅ *Complete*
|
|
368
|
+
- **Full Accessibility** - ARIA support, semantic HTML, keyboard navigation ✅ *Documented*
|
|
369
|
+
- **Responsive by Default** - Mobile-first with breakpoint support ✅ *Complete*
|
|
370
|
+
|
|
371
|
+
---
|
|
372
|
+
|
|
373
|
+
**📝 Documentation Feedback**: Found an issue or gap in the documentation? Please reference the [Documentation Audit](./DOCUMENTATION_AUDIT.md) or create an issue with specific improvement suggestions.
|
|
@@ -0,0 +1,299 @@
|
|
|
1
|
+
# Design System Reference Documentation
|
|
2
|
+
|
|
3
|
+
**Purpose:** Complete reference materials for Reactberry
|
|
4
|
+
|
|
5
|
+
This directory contains all reference documentation designed for both human developers and AI assistants.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## 📂 Directory Contents
|
|
10
|
+
|
|
11
|
+
### 🌳 Decision Trees
|
|
12
|
+
**Location:** `./decision-trees/`
|
|
13
|
+
|
|
14
|
+
Essential flowcharts for choosing the right components and props:
|
|
15
|
+
|
|
16
|
+
- **[component-selection.md](./decision-trees/component-selection.md)** - "What component do I need?" decision tree
|
|
17
|
+
- Text vs Box vs Button vs Field
|
|
18
|
+
- 30+ decision points with examples
|
|
19
|
+
- Common mistake warnings
|
|
20
|
+
|
|
21
|
+
- **[prop-selection.md](./decision-trees/prop-selection.md)** - "What props do I use?" decision tree
|
|
22
|
+
- **Critical:** `size` vs `$size` distinction
|
|
23
|
+
- Spacing, styling, layout, typography props
|
|
24
|
+
- Responsive patterns
|
|
25
|
+
|
|
26
|
+
**Use when:** Starting a new component or unsure which element to use
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
### ⚡ Quick Reference Cards
|
|
31
|
+
**Location:** `./quick-cards/`
|
|
32
|
+
|
|
33
|
+
One-page cheat sheets for each core component:
|
|
34
|
+
|
|
35
|
+
- **[box.md](./quick-cards/box.md)** - Box component essentials
|
|
36
|
+
- Most common use cases (5 examples)
|
|
37
|
+
- Essential props table
|
|
38
|
+
- Layout patterns
|
|
39
|
+
- Common mistakes with fixes
|
|
40
|
+
|
|
41
|
+
- **[button.md](./quick-cards/button.md)** - Button component essentials
|
|
42
|
+
- All variants (primary, secondary, ghost, outline)
|
|
43
|
+
- Size options (small, medium, large)
|
|
44
|
+
- States (disabled, loading, icon)
|
|
45
|
+
- **Critical reminder:** Use `$size` not `size`
|
|
46
|
+
|
|
47
|
+
- **[field.md](./quick-cards/field.md)** - Field component essentials
|
|
48
|
+
- All input types (text, email, password, textarea, select)
|
|
49
|
+
- Variants and sizes
|
|
50
|
+
- Accessibility patterns
|
|
51
|
+
- **Critical reminder:** Use `$size` not `size`
|
|
52
|
+
|
|
53
|
+
**Use when:** Quick lookup for component syntax and common patterns
|
|
54
|
+
|
|
55
|
+
---
|
|
56
|
+
|
|
57
|
+
### 📚 Pattern Libraries
|
|
58
|
+
|
|
59
|
+
- **[patterns-registry.md](./patterns-registry.md)** - 35+ copy-paste code patterns
|
|
60
|
+
- **Layout Patterns:** Flex, grid, cards, containers (8 patterns)
|
|
61
|
+
- **Form Patterns:** Inputs, validation, actions (7 patterns)
|
|
62
|
+
- **Interactive Patterns:** Buttons, groups, links (6 patterns)
|
|
63
|
+
- **Data Display Patterns:** Stats, lists, key-value pairs (4 patterns)
|
|
64
|
+
- **Navigation Patterns:** Headers, breadcrumbs, tabs (3 patterns)
|
|
65
|
+
- **Content Patterns:** Headings, empty states, alerts (4 patterns)
|
|
66
|
+
- **State Patterns:** Loading, error, success (3 patterns)
|
|
67
|
+
- Each pattern includes: components used, tokens, complexity level, common use cases
|
|
68
|
+
|
|
69
|
+
**Use when:** Need a starting point for common UI patterns
|
|
70
|
+
|
|
71
|
+
---
|
|
72
|
+
|
|
73
|
+
### ✅ Validation & Rules
|
|
74
|
+
|
|
75
|
+
- **[prop-validation.md](./prop-validation.md)** - Valid vs invalid prop combinations
|
|
76
|
+
- **Invalid combinations:** What NOT to do with examples
|
|
77
|
+
- **Required combinations:** What MUST be included
|
|
78
|
+
- **Recommended patterns:** Best practices
|
|
79
|
+
- Validation checklist (10 items)
|
|
80
|
+
- TypeScript validation examples
|
|
81
|
+
|
|
82
|
+
**Use when:** Debugging prop errors or validating code before committing
|
|
83
|
+
|
|
84
|
+
---
|
|
85
|
+
|
|
86
|
+
### 🔗 Component Dependencies
|
|
87
|
+
|
|
88
|
+
- **[component-dependencies.md](./component-dependencies.md)** - Component relationship graph
|
|
89
|
+
- Element hierarchy (Box → Text → Button/Field)
|
|
90
|
+
- Block dependencies (50+ blocks categorized)
|
|
91
|
+
- Import recommendations
|
|
92
|
+
- Circular dependency warnings
|
|
93
|
+
- "When to use what" guide
|
|
94
|
+
|
|
95
|
+
**Use when:** Understanding component relationships or deciding between element and block components
|
|
96
|
+
|
|
97
|
+
---
|
|
98
|
+
|
|
99
|
+
### 🐛 Troubleshooting
|
|
100
|
+
|
|
101
|
+
- **[common-errors.md](./common-errors.md)** - Top 10 errors with solutions
|
|
102
|
+
- **Error #1:** Using `size` instead of `$size` on Button/Field ⭐⭐⭐⭐⭐
|
|
103
|
+
- **Error #2:** Using Box for text content ⭐⭐⭐⭐
|
|
104
|
+
- **Error #3:** Missing semantic HTML (`as` prop) ⭐⭐⭐⭐
|
|
105
|
+
- **Error #4:** Arbitrary values instead of theme tokens ⭐⭐⭐
|
|
106
|
+
- **Error #5:** Missing label-input connection ⭐⭐⭐
|
|
107
|
+
- Plus 5 more common errors
|
|
108
|
+
- TypeScript error solutions
|
|
109
|
+
- Runtime warning fixes
|
|
110
|
+
- Styling issue troubleshooting
|
|
111
|
+
- Quick debugging checklist
|
|
112
|
+
|
|
113
|
+
**Use when:** Encountering errors or unexpected behavior
|
|
114
|
+
|
|
115
|
+
---
|
|
116
|
+
|
|
117
|
+
## 🎯 Quick Access by Need
|
|
118
|
+
|
|
119
|
+
### I need to...
|
|
120
|
+
|
|
121
|
+
| Need | Go To |
|
|
122
|
+
|------|-------|
|
|
123
|
+
| **Choose a component** | [Component Selection Decision Tree](./decision-trees/component-selection.md) |
|
|
124
|
+
| **Understand size vs $size** | [Prop Selection Decision Tree](./decision-trees/prop-selection.md#-critical-distinction-size-vs-size) |
|
|
125
|
+
| **Get started quickly** | [Quick Reference Cards](./quick-cards/) |
|
|
126
|
+
| **Copy a pattern** | [Patterns Registry](./patterns-registry.md) |
|
|
127
|
+
| **Fix an error** | [Common Errors](./common-errors.md) |
|
|
128
|
+
| **Validate my code** | [Prop Validation](./prop-validation.md) |
|
|
129
|
+
| **Understand dependencies** | [Component Dependencies](./component-dependencies.md) |
|
|
130
|
+
| **Learn Box** | [Box Quick Card](./quick-cards/box.md) |
|
|
131
|
+
| **Learn Button** | [Button Quick Card](./quick-cards/button.md) |
|
|
132
|
+
| **Learn Field** | [Field Quick Card](./quick-cards/field.md) |
|
|
133
|
+
|
|
134
|
+
---
|
|
135
|
+
|
|
136
|
+
## 🤖 AI Assistant Usage
|
|
137
|
+
|
|
138
|
+
### For New Components
|
|
139
|
+
1. **Check:** [Component Selection](./decision-trees/component-selection.md) - Which component?
|
|
140
|
+
2. **Reference:** [Quick Card](./quick-cards/) - Component syntax
|
|
141
|
+
3. **Copy:** [Patterns Registry](./patterns-registry.md) - Similar pattern
|
|
142
|
+
4. **Validate:** [Prop Validation](./prop-validation.md) - Props correct?
|
|
143
|
+
|
|
144
|
+
### For Debugging
|
|
145
|
+
1. **Error message?** → [Common Errors](./common-errors.md)
|
|
146
|
+
2. **Props not working?** → [Prop Validation](./prop-validation.md)
|
|
147
|
+
3. **Component relationships?** → [Component Dependencies](./component-dependencies.md)
|
|
148
|
+
4. **Still stuck?** → [Decision Trees](./decision-trees/)
|
|
149
|
+
|
|
150
|
+
### For Learning
|
|
151
|
+
1. **Start:** [Decision Trees](./decision-trees/) - Understand the system
|
|
152
|
+
2. **Practice:** [Patterns Registry](./patterns-registry.md) - Copy and modify
|
|
153
|
+
3. **Reference:** [Quick Cards](./quick-cards/) - Quick lookup
|
|
154
|
+
4. **Master:** [Prop Validation](./prop-validation.md) - Avoid mistakes
|
|
155
|
+
|
|
156
|
+
---
|
|
157
|
+
|
|
158
|
+
## 📊 Reference Statistics
|
|
159
|
+
|
|
160
|
+
- **Decision Trees:** 2 comprehensive flowcharts
|
|
161
|
+
- **Quick Cards:** 3 component cheat sheets
|
|
162
|
+
- **Patterns:** 35+ copy-paste examples
|
|
163
|
+
- **Error Solutions:** 10+ common issues covered
|
|
164
|
+
- **Validation Rules:** 50+ do's and don'ts
|
|
165
|
+
- **Dependency Graphs:** Complete component hierarchy
|
|
166
|
+
|
|
167
|
+
---
|
|
168
|
+
|
|
169
|
+
## 🎓 Learning Path
|
|
170
|
+
|
|
171
|
+
### Beginner → Intermediate
|
|
172
|
+
|
|
173
|
+
1. **Start:** Read [Component Selection Decision Tree](./decision-trees/component-selection.md)
|
|
174
|
+
- Understand Box vs Text vs Button vs Field
|
|
175
|
+
- Learn the decision process
|
|
176
|
+
|
|
177
|
+
2. **Learn:** Review [Quick Reference Cards](./quick-cards/)
|
|
178
|
+
- Box for layout
|
|
179
|
+
- Text for typography
|
|
180
|
+
- Button for actions ($size!)
|
|
181
|
+
- Field for inputs ($size!)
|
|
182
|
+
|
|
183
|
+
3. **Practice:** Copy patterns from [Patterns Registry](./patterns-registry.md)
|
|
184
|
+
- Start with basic layouts
|
|
185
|
+
- Try form patterns
|
|
186
|
+
- Build interactive components
|
|
187
|
+
|
|
188
|
+
4. **Validate:** Use [Prop Validation](./prop-validation.md) as a checklist
|
|
189
|
+
- Before committing code
|
|
190
|
+
- When reviewing PRs
|
|
191
|
+
|
|
192
|
+
### Intermediate → Advanced
|
|
193
|
+
|
|
194
|
+
1. **Master:** [Prop Selection Decision Tree](./decision-trees/prop-selection.md)
|
|
195
|
+
- Understand all prop types
|
|
196
|
+
- Learn responsive patterns
|
|
197
|
+
- Master the theme system
|
|
198
|
+
|
|
199
|
+
2. **Explore:** [Component Dependencies](./component-dependencies.md)
|
|
200
|
+
- Understand block components
|
|
201
|
+
- Learn composition patterns
|
|
202
|
+
- Avoid circular dependencies
|
|
203
|
+
|
|
204
|
+
3. **Debug:** Use [Common Errors](./common-errors.md) proactively
|
|
205
|
+
- Learn what to avoid
|
|
206
|
+
- Set up linting rules
|
|
207
|
+
- Educate team members
|
|
208
|
+
|
|
209
|
+
---
|
|
210
|
+
|
|
211
|
+
## ⚠️ Critical Reminders
|
|
212
|
+
|
|
213
|
+
**The Big 3 Mistakes:**
|
|
214
|
+
|
|
215
|
+
1. **size vs $size**
|
|
216
|
+
- Box/Text use `size` (generic spacing)
|
|
217
|
+
- Button/Field use `$size` (component sizing)
|
|
218
|
+
- This is THE most common error!
|
|
219
|
+
|
|
220
|
+
2. **Box vs Text**
|
|
221
|
+
- Box = layout/containers only
|
|
222
|
+
- Text = all text content
|
|
223
|
+
- Box doesn't support typography props
|
|
224
|
+
|
|
225
|
+
3. **Theme Tokens**
|
|
226
|
+
- Always use tokens: `p="m"` not `p="16px"`
|
|
227
|
+
- Enables consistency and theming
|
|
228
|
+
- Required for responsive behavior
|
|
229
|
+
|
|
230
|
+
---
|
|
231
|
+
|
|
232
|
+
## 🔗 Related Documentation
|
|
233
|
+
|
|
234
|
+
### Core Documentation
|
|
235
|
+
- **[Main README](../README.md)** - Design system overview
|
|
236
|
+
- **[Elements](../elements.md)** - Core components (Box, Text, Button, Field)
|
|
237
|
+
- **[Blocks](../blocks.md)** - Composed components
|
|
238
|
+
|
|
239
|
+
### API References
|
|
240
|
+
- **[Box API](../api/Box.md)** - Complete Box documentation
|
|
241
|
+
- **[Text API](../api/Text.md)** - Complete Text documentation
|
|
242
|
+
- **[Button API](../api/Button.md)** - Complete Button documentation
|
|
243
|
+
- **[Field API](../api/Field.md)** - Complete Field documentation
|
|
244
|
+
|
|
245
|
+
### Guides
|
|
246
|
+
- **[Getting Started](../guides/getting-started.md)** - First steps
|
|
247
|
+
- **[Component Composition](../guides/component-composition.md)** - Building complex UIs
|
|
248
|
+
- **[Responsive Design](../guides/responsive-design.md)** - Mobile-first patterns
|
|
249
|
+
- **[Accessibility](../guides/accessibility.md)** - Inclusive design
|
|
250
|
+
|
|
251
|
+
### Assets
|
|
252
|
+
- **[Design Tokens](../assets/design-tokens.md)** - All theme tokens
|
|
253
|
+
- **[Color Palettes](../assets/color-palettes.md)** - Color system
|
|
254
|
+
- **[Typography Scale](../assets/typography-scale.md)** - Typography system
|
|
255
|
+
|
|
256
|
+
---
|
|
257
|
+
|
|
258
|
+
## 📝 Contributing
|
|
259
|
+
|
|
260
|
+
### Adding New Patterns
|
|
261
|
+
1. Add to [Patterns Registry](./patterns-registry.md)
|
|
262
|
+
2. Include: components, tokens, complexity, use case
|
|
263
|
+
3. Provide copy-paste code example
|
|
264
|
+
4. Add to search index
|
|
265
|
+
|
|
266
|
+
### Adding New Errors
|
|
267
|
+
1. Add to [Common Errors](./common-errors.md)
|
|
268
|
+
2. Include: frequency, symptom, wrong code, correct code, why
|
|
269
|
+
3. Rank by frequency (⭐⭐⭐⭐⭐ = most common)
|
|
270
|
+
|
|
271
|
+
### Updating Quick Cards
|
|
272
|
+
1. Keep to one page per component
|
|
273
|
+
2. Focus on most common use cases (top 5)
|
|
274
|
+
3. Include essential props table
|
|
275
|
+
4. Add common mistakes section
|
|
276
|
+
|
|
277
|
+
---
|
|
278
|
+
|
|
279
|
+
## 🆘 Getting Help
|
|
280
|
+
|
|
281
|
+
**Can't find what you need?**
|
|
282
|
+
|
|
283
|
+
1. **Search** the [Patterns Registry](./patterns-registry.md) by component, token, or use case
|
|
284
|
+
2. **Check** [Common Errors](./common-errors.md) for your specific error message
|
|
285
|
+
3. **Review** [Decision Trees](./decision-trees/) for conceptual understanding
|
|
286
|
+
4. **Consult** main [README](../README.md) for broader documentation links
|
|
287
|
+
|
|
288
|
+
**Still stuck?**
|
|
289
|
+
- Check the [DOCUMENTATION_AUDIT](../DOCUMENTATION_AUDIT.md) for known gaps
|
|
290
|
+
- File an issue with specific questions
|
|
291
|
+
- Contribute documentation for patterns you've solved
|
|
292
|
+
|
|
293
|
+
---
|
|
294
|
+
|
|
295
|
+
**Last Updated:** 2025-01-09
|
|
296
|
+
**Maintainer:** Design System Team
|
|
297
|
+
**Status:** ✅ Complete and AI-optimized
|
|
298
|
+
|
|
299
|
+
**Purpose:** This reference directory is designed to be both human-readable and machine-parsable, enabling AI assistants to quickly find the right information and generate correct code on the first try.
|