@gadagi/design-system 1.0.0 → 1.0.3
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 +216 -0
- package/package.json +1 -1
- package/src/tokens/colors.ts +10 -1
package/README.md
ADDED
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
# @gadagi/design-system - Design System
|
|
2
|
+
|
|
3
|
+
A comprehensive design system for the Gadagi platform, providing reusable React components, theme support, and design tokens.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- 🎨 **Design Tokens** - Consistent colors, typography, and spacing
|
|
8
|
+
- 🧩 **React Components** - Pre-built UI components (Button, Input, Badge)
|
|
9
|
+
- 🌓 **Theme Support** - Built-in light and dark themes
|
|
10
|
+
- 📱 **Responsive** - Mobile-first design approach
|
|
11
|
+
- ♿ **WCAG Compliant** - Accessible color contrast ratios
|
|
12
|
+
- 🎯 **TypeScript** - Full type safety
|
|
13
|
+
- 📦 **Tree Shakable** - Optimized bundle size
|
|
14
|
+
|
|
15
|
+
## Installation
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
npm install @gadagi/design-system
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Peer Dependencies
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
npm install react react-dom
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Quick Start
|
|
28
|
+
|
|
29
|
+
```tsx
|
|
30
|
+
import { ThemeProvider, Button, Input, Badge } from '@gadagi/design-system';
|
|
31
|
+
|
|
32
|
+
function App() {
|
|
33
|
+
return (
|
|
34
|
+
<ThemeProvider defaultTheme="light">
|
|
35
|
+
<div>
|
|
36
|
+
<Button variant="primary">Click me</Button>
|
|
37
|
+
<Input placeholder="Enter text" />
|
|
38
|
+
<Badge count={5}>Notifications</Badge>
|
|
39
|
+
</div>
|
|
40
|
+
</ThemeProvider>
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## Theme System
|
|
46
|
+
|
|
47
|
+
### Light Theme
|
|
48
|
+
|
|
49
|
+
```tsx
|
|
50
|
+
import { ThemeProvider } from '@gadagi/design-system';
|
|
51
|
+
|
|
52
|
+
<ThemeProvider defaultTheme="light">
|
|
53
|
+
<YourApp />
|
|
54
|
+
</ThemeProvider>
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### Dark Theme
|
|
58
|
+
|
|
59
|
+
```tsx
|
|
60
|
+
<ThemeProvider defaultTheme="dark">
|
|
61
|
+
<YourApp />
|
|
62
|
+
</ThemeProvider>
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### Custom Theme
|
|
66
|
+
|
|
67
|
+
```tsx
|
|
68
|
+
import { ThemeProvider, colors } from '@gadagi/design-system';
|
|
69
|
+
|
|
70
|
+
const customTheme = {
|
|
71
|
+
primary: colors.primary[500],
|
|
72
|
+
background: '#ffffff',
|
|
73
|
+
text: '#000000',
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
<ThemeProvider theme={customTheme}>
|
|
77
|
+
<YourApp />
|
|
78
|
+
</ThemeProvider>
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
## Components
|
|
82
|
+
|
|
83
|
+
### Button
|
|
84
|
+
|
|
85
|
+
```tsx
|
|
86
|
+
import { Button } from '@gadagi/design-system';
|
|
87
|
+
|
|
88
|
+
<Button variant="primary" size="md" onClick={() => console.log('clicked')}>
|
|
89
|
+
Primary Button
|
|
90
|
+
</Button>
|
|
91
|
+
|
|
92
|
+
<Button variant="danger" size="sm" disabled>
|
|
93
|
+
Disabled Button
|
|
94
|
+
</Button>
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
**Props:**
|
|
98
|
+
- `variant`: 'primary' | 'secondary' | 'danger' | 'success'
|
|
99
|
+
- `size`: 'sm' | 'md' | 'lg'
|
|
100
|
+
- `disabled?: boolean`
|
|
101
|
+
- `onClick?: () => void`
|
|
102
|
+
|
|
103
|
+
### Input
|
|
104
|
+
|
|
105
|
+
```tsx
|
|
106
|
+
import { Input } from '@gadagi/design-system';
|
|
107
|
+
|
|
108
|
+
<Input
|
|
109
|
+
placeholder="Enter your email"
|
|
110
|
+
label="Email Address"
|
|
111
|
+
error="Invalid email format"
|
|
112
|
+
hint="We'll never share your email"
|
|
113
|
+
fullWidth
|
|
114
|
+
/>
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
**Props:**
|
|
118
|
+
- `placeholder?: string`
|
|
119
|
+
- `label?: string`
|
|
120
|
+
- `error?: string`
|
|
121
|
+
- `hint?: string`
|
|
122
|
+
- `fullWidth?: boolean`
|
|
123
|
+
- `id?: string`
|
|
124
|
+
|
|
125
|
+
### Badge
|
|
126
|
+
|
|
127
|
+
```tsx
|
|
128
|
+
import { Badge } from '@gadagi/design-system';
|
|
129
|
+
|
|
130
|
+
<Badge count={5}>
|
|
131
|
+
<span>Notifications</span>
|
|
132
|
+
</Badge>
|
|
133
|
+
|
|
134
|
+
<Badge count={99} variant="danger">
|
|
135
|
+
<span>Alerts</span>
|
|
136
|
+
</Badge>
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
**Props:**
|
|
140
|
+
- `count: number`
|
|
141
|
+
- `variant?: 'primary' | 'danger' | 'success'`
|
|
142
|
+
- `children?: ReactNode`
|
|
143
|
+
|
|
144
|
+
## Design Tokens
|
|
145
|
+
|
|
146
|
+
### Colors
|
|
147
|
+
|
|
148
|
+
```tsx
|
|
149
|
+
import { colors, darkColors } from '@gadagi/design-system';
|
|
150
|
+
|
|
151
|
+
// Light theme colors
|
|
152
|
+
colors.primary[500] // #4a3fb5
|
|
153
|
+
colors.success[500] // #2fb855
|
|
154
|
+
colors.danger[500] // #dc4c4c
|
|
155
|
+
|
|
156
|
+
// Dark theme colors
|
|
157
|
+
darkColors.primary[500] // #7c71e6
|
|
158
|
+
darkColors.success[500] // #4ade80
|
|
159
|
+
darkColors.danger[500] // #f87171
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
### Typography
|
|
163
|
+
|
|
164
|
+
```tsx
|
|
165
|
+
import { typography } from '@gadagi/design-system';
|
|
166
|
+
|
|
167
|
+
typography.fontSize.sm // 14px
|
|
168
|
+
typography.fontSize.md // 16px
|
|
169
|
+
typography.fontSize.lg // 18px
|
|
170
|
+
typography.fontWeight.medium // 500
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
### Spacing
|
|
174
|
+
|
|
175
|
+
```tsx
|
|
176
|
+
import { spacing } from '@gadagi/design-system';
|
|
177
|
+
|
|
178
|
+
spacing[1] // 4px
|
|
179
|
+
spacing[2] // 8px
|
|
180
|
+
spacing[4] // 16px
|
|
181
|
+
spacing[8] // 32px
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
## Accessibility
|
|
185
|
+
|
|
186
|
+
All components are built with WCAG 2.1 AA compliance in mind:
|
|
187
|
+
|
|
188
|
+
- **Color Contrast**: All text and UI elements meet 4.5:1 contrast ratios
|
|
189
|
+
- **Keyboard Navigation**: Full keyboard support for all interactive elements
|
|
190
|
+
- **Screen Readers**: Proper ARIA labels and semantic HTML
|
|
191
|
+
- **Focus Management**: Clear focus indicators and logical tab order
|
|
192
|
+
|
|
193
|
+
## Browser Support
|
|
194
|
+
|
|
195
|
+
- Chrome 90+
|
|
196
|
+
- Firefox 88+
|
|
197
|
+
- Safari 14+
|
|
198
|
+
- Edge 90+
|
|
199
|
+
|
|
200
|
+
## Contributing
|
|
201
|
+
|
|
202
|
+
1. Clone the repository
|
|
203
|
+
2. Install dependencies: `npm install`
|
|
204
|
+
3. Start development: `npm run dev`
|
|
205
|
+
4. Make your changes
|
|
206
|
+
5. Run tests: `npm test`
|
|
207
|
+
6. Build: `npm run build`
|
|
208
|
+
7. Publish: `npm publish`
|
|
209
|
+
|
|
210
|
+
## License
|
|
211
|
+
|
|
212
|
+
MIT © Gadagi Team
|
|
213
|
+
|
|
214
|
+
## Changelog
|
|
215
|
+
|
|
216
|
+
See [CHANGELOG.md](./CHANGELOG.md) for version history and updates.
|
package/package.json
CHANGED
package/src/tokens/colors.ts
CHANGED
|
@@ -16,6 +16,15 @@
|
|
|
16
16
|
800: '#1e293b',
|
|
17
17
|
900: '#0f172a',
|
|
18
18
|
},
|
|
19
|
+
error: {
|
|
20
|
+
50: '#fef2f2',
|
|
21
|
+
100: '#fee2e2',
|
|
22
|
+
500: '#ef4444',
|
|
23
|
+
600: '#dc2626',
|
|
24
|
+
700: '#b91c1c',
|
|
25
|
+
800: '#991b1b',
|
|
26
|
+
900: '#7f1d1d',
|
|
27
|
+
},
|
|
19
28
|
success: {
|
|
20
29
|
500: '#2fb855', // WCAG compliant version of #36cd69
|
|
21
30
|
100: '#dcfce7',
|
|
@@ -24,7 +33,7 @@
|
|
|
24
33
|
500: '#e6a110', // WCAG compliant version of #f9b115
|
|
25
34
|
100: '#fef3c7',
|
|
26
35
|
},
|
|
27
|
-
danger:
|
|
36
|
+
danger: {
|
|
28
37
|
500: '#dc4c4c', // WCAG compliant version of #e55353
|
|
29
38
|
100: '#fee2e2',
|
|
30
39
|
},
|