@pibit.ai/cure-design-system 0.2.2 → 0.2.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 +95 -198
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,245 +1,164 @@
|
|
|
1
|
-
# @pibit/
|
|
1
|
+
# @pibit.ai/cure-design-system
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
A modern, accessible React component library for building B2B SaaS applications.
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
This is the initial release with core primitive components.
|
|
5
|
+
📚 **[View Storybook Documentation](https://pibit-ai.github.io/pibit-components/)**
|
|
8
6
|
|
|
9
7
|
## Installation
|
|
10
8
|
|
|
11
9
|
```bash
|
|
12
|
-
npm install @pibit/
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
### Peer Dependencies
|
|
16
|
-
|
|
17
|
-
You need to have these installed in your project:
|
|
18
|
-
|
|
19
|
-
```bash
|
|
20
|
-
npm install react react-dom tailwindcss
|
|
10
|
+
npm install @pibit.ai/cure-design-system
|
|
21
11
|
```
|
|
22
12
|
|
|
23
13
|
## Setup
|
|
24
14
|
|
|
25
|
-
### 1.
|
|
15
|
+
### 1. Configure Tailwind
|
|
26
16
|
|
|
27
|
-
|
|
17
|
+
Add the component library to your `tailwind.config.js`:
|
|
28
18
|
|
|
29
19
|
```javascript
|
|
30
20
|
/** @type {import('tailwindcss').Config} */
|
|
31
21
|
export default {
|
|
32
22
|
content: [
|
|
33
23
|
'./src/**/*.{js,ts,jsx,tsx}',
|
|
34
|
-
'./node_modules/@pibit/
|
|
24
|
+
'./node_modules/@pibit.ai/cure-design-system/**/*.{js,ts,jsx,tsx}',
|
|
35
25
|
],
|
|
36
|
-
// ... rest of your config
|
|
37
26
|
};
|
|
38
27
|
```
|
|
39
28
|
|
|
40
29
|
### 2. Import Styles
|
|
41
30
|
|
|
42
|
-
In your main entry file (e.g., `main.tsx` or `App.tsx`):
|
|
43
|
-
|
|
44
31
|
```typescript
|
|
45
|
-
import '@pibit/
|
|
32
|
+
import '@pibit.ai/cure-design-system/styles';
|
|
46
33
|
```
|
|
47
34
|
|
|
48
35
|
## Components
|
|
49
36
|
|
|
50
|
-
###
|
|
37
|
+
### Primitives
|
|
51
38
|
|
|
52
|
-
- **Button**
|
|
53
|
-
- **Input**
|
|
54
|
-
- **Checkbox**
|
|
55
|
-
- **Badge**
|
|
56
|
-
- **Avatar**
|
|
57
|
-
- **Icon**
|
|
39
|
+
- **Button** – Multiple variants, sizes, and states
|
|
40
|
+
- **Input** – Text input with labels, validation, and icons
|
|
41
|
+
- **Checkbox** – Accessible checkbox with label and description
|
|
42
|
+
- **Badge** – Status indicators and labels
|
|
43
|
+
- **Avatar** – Profile images with fallback support
|
|
44
|
+
- **Icon** – Unified icon system
|
|
45
|
+
- **Text** – Typography component
|
|
46
|
+
- **Heading** – Semantic headings
|
|
47
|
+
- **Toggle** – Switch component
|
|
58
48
|
|
|
59
|
-
|
|
49
|
+
### Patterns
|
|
60
50
|
|
|
61
|
-
|
|
51
|
+
- **Table** – Data table with sorting and pagination
|
|
62
52
|
|
|
63
|
-
|
|
64
|
-
import { Button } from '@pibit/components/primitives/button';
|
|
65
|
-
|
|
66
|
-
function App() {
|
|
67
|
-
return (
|
|
68
|
-
<>
|
|
69
|
-
<Button>Click me</Button>
|
|
70
|
-
<Button variant="secondary" size="lg">Large Secondary</Button>
|
|
71
|
-
<Button variant="destructive">Delete</Button>
|
|
72
|
-
<Button isDisabled>Disabled</Button>
|
|
73
|
-
</>
|
|
74
|
-
);
|
|
75
|
-
}
|
|
76
|
-
```
|
|
53
|
+
## Usage
|
|
77
54
|
|
|
78
|
-
###
|
|
79
|
-
|
|
80
|
-
```typescript
|
|
81
|
-
import { Input } from '@pibit/components/primitives/input';
|
|
82
|
-
import { Icon } from '@pibit/components/primitives/icon';
|
|
83
|
-
|
|
84
|
-
function LoginForm() {
|
|
85
|
-
return (
|
|
86
|
-
<>
|
|
87
|
-
<Input
|
|
88
|
-
label="Email"
|
|
89
|
-
type="email"
|
|
90
|
-
placeholder="you@example.com"
|
|
91
|
-
isRequired
|
|
92
|
-
/>
|
|
93
|
-
<Input
|
|
94
|
-
label="Search"
|
|
95
|
-
type="search"
|
|
96
|
-
placeholder="Search..."
|
|
97
|
-
leftIcon={<Icon name="SearchMd" size={16} />}
|
|
98
|
-
/>
|
|
99
|
-
<Input
|
|
100
|
-
label="Password"
|
|
101
|
-
type="password"
|
|
102
|
-
errorMessage="Password is required"
|
|
103
|
-
/>
|
|
104
|
-
</>
|
|
105
|
-
);
|
|
106
|
-
}
|
|
107
|
-
```
|
|
55
|
+
### Button
|
|
108
56
|
|
|
109
|
-
|
|
57
|
+
```tsx
|
|
58
|
+
import { Button } from '@pibit.ai/cure-design-system/primitives/button';
|
|
110
59
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
function TermsForm() {
|
|
115
|
-
const [accepted, setAccepted] = useState(false);
|
|
116
|
-
|
|
117
|
-
return (
|
|
118
|
-
<Checkbox
|
|
119
|
-
label="I accept the terms and conditions"
|
|
120
|
-
description="You must accept to continue"
|
|
121
|
-
checked={accepted}
|
|
122
|
-
onCheckedChange={(checked) => setAccepted(!!checked)}
|
|
123
|
-
/>
|
|
124
|
-
);
|
|
125
|
-
}
|
|
60
|
+
<Button variant="primary">Submit</Button>
|
|
61
|
+
<Button variant="secondary" size="lg">Cancel</Button>
|
|
62
|
+
<Button variant="destructive">Delete</Button>
|
|
126
63
|
```
|
|
127
64
|
|
|
128
|
-
###
|
|
129
|
-
|
|
130
|
-
```typescript
|
|
131
|
-
import { Badge } from '@pibit/components/primitives/badge';
|
|
132
|
-
|
|
133
|
-
function StatusIndicator({ status }) {
|
|
134
|
-
return (
|
|
135
|
-
<>
|
|
136
|
-
<Badge variant="success">Active</Badge>
|
|
137
|
-
<Badge variant="warning">Pending</Badge>
|
|
138
|
-
<Badge variant="error">Failed</Badge>
|
|
139
|
-
<Badge variant="outline">Draft</Badge>
|
|
140
|
-
</>
|
|
141
|
-
);
|
|
142
|
-
}
|
|
143
|
-
```
|
|
65
|
+
### Input
|
|
144
66
|
|
|
145
|
-
|
|
67
|
+
```tsx
|
|
68
|
+
import { Input } from '@pibit.ai/cure-design-system/primitives/input';
|
|
69
|
+
import { Icon } from '@pibit.ai/cure-design-system/primitives/icon';
|
|
146
70
|
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
src={user.avatarUrl}
|
|
154
|
-
alt={user.name}
|
|
155
|
-
fallback={user.initials}
|
|
156
|
-
size="lg"
|
|
157
|
-
/>
|
|
158
|
-
);
|
|
159
|
-
}
|
|
160
|
-
```
|
|
71
|
+
<Input
|
|
72
|
+
label="Email"
|
|
73
|
+
type="email"
|
|
74
|
+
placeholder="you@example.com"
|
|
75
|
+
isRequired
|
|
76
|
+
/>
|
|
161
77
|
|
|
162
|
-
|
|
78
|
+
<Input
|
|
79
|
+
label="Search"
|
|
80
|
+
leftIcon={<Icon name="SearchMd" size={16} />}
|
|
81
|
+
placeholder="Search..."
|
|
82
|
+
/>
|
|
163
83
|
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
<>
|
|
170
|
-
<Icon name="ChevronDown" size={16} />
|
|
171
|
-
<Icon name="SearchMd" size={20} className="text-gray-500" />
|
|
172
|
-
<Icon name="CheckCircle" size={24} className="text-success-600" />
|
|
173
|
-
</>
|
|
174
|
-
);
|
|
175
|
-
}
|
|
84
|
+
<Input
|
|
85
|
+
label="Password"
|
|
86
|
+
type="password"
|
|
87
|
+
errorMessage="Password is required"
|
|
88
|
+
/>
|
|
176
89
|
```
|
|
177
90
|
|
|
178
|
-
|
|
91
|
+
### Checkbox
|
|
179
92
|
|
|
180
|
-
|
|
93
|
+
```tsx
|
|
94
|
+
import { Checkbox } from '@pibit.ai/cure-design-system/primitives/checkbox';
|
|
181
95
|
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
96
|
+
<Checkbox
|
|
97
|
+
label="I accept the terms and conditions"
|
|
98
|
+
description="You must accept to continue"
|
|
99
|
+
checked={accepted}
|
|
100
|
+
onCheckedChange={(checked) => setAccepted(!!checked)}
|
|
101
|
+
/>
|
|
185
102
|
```
|
|
186
103
|
|
|
187
|
-
###
|
|
104
|
+
### Badge
|
|
188
105
|
|
|
189
|
-
```
|
|
190
|
-
import {
|
|
106
|
+
```tsx
|
|
107
|
+
import { Badge } from '@pibit.ai/cure-design-system/primitives/badge';
|
|
108
|
+
|
|
109
|
+
<Badge variant="success">Active</Badge>
|
|
110
|
+
<Badge variant="warning">Pending</Badge>
|
|
111
|
+
<Badge variant="error">Failed</Badge>
|
|
112
|
+
<Badge variant="outline">Draft</Badge>
|
|
191
113
|
```
|
|
192
114
|
|
|
193
|
-
|
|
115
|
+
### Avatar
|
|
194
116
|
|
|
195
|
-
|
|
117
|
+
```tsx
|
|
118
|
+
import { Avatar } from '@pibit.ai/cure-design-system/primitives/avatar';
|
|
196
119
|
|
|
197
|
-
|
|
198
|
-
|
|
120
|
+
<Avatar
|
|
121
|
+
src={user.avatarUrl}
|
|
122
|
+
alt={user.name}
|
|
123
|
+
fallback={user.initials}
|
|
124
|
+
size="lg"
|
|
125
|
+
/>
|
|
199
126
|
```
|
|
200
127
|
|
|
201
|
-
###
|
|
202
|
-
|
|
203
|
-
```bash
|
|
204
|
-
npm run storybook
|
|
205
|
-
```
|
|
128
|
+
### Icon
|
|
206
129
|
|
|
207
|
-
|
|
130
|
+
```tsx
|
|
131
|
+
import { Icon } from '@pibit.ai/cure-design-system/primitives/icon';
|
|
208
132
|
|
|
209
|
-
|
|
210
|
-
|
|
133
|
+
<Icon name="ChevronDown" size={16} />
|
|
134
|
+
<Icon name="SearchMd" size={20} className="text-gray-500" />
|
|
135
|
+
<Icon name="CheckCircle" size={24} className="text-success-600" />
|
|
211
136
|
```
|
|
212
137
|
|
|
213
|
-
|
|
138
|
+
## Imports
|
|
214
139
|
|
|
215
|
-
|
|
216
|
-
|
|
140
|
+
### Direct imports (recommended)
|
|
141
|
+
|
|
142
|
+
```typescript
|
|
143
|
+
import { Button } from '@pibit.ai/cure-design-system/primitives/button';
|
|
144
|
+
import { Input } from '@pibit.ai/cure-design-system/primitives/input';
|
|
217
145
|
```
|
|
218
146
|
|
|
219
|
-
|
|
147
|
+
### Barrel import
|
|
220
148
|
|
|
149
|
+
```typescript
|
|
150
|
+
import { Button, Input, Badge } from '@pibit.ai/cure-design-system';
|
|
221
151
|
```
|
|
222
|
-
src/
|
|
223
|
-
├── primitives/ # Phase 0 - Basic UI components (Button, Input, etc.)
|
|
224
|
-
├── patterns/ # Phase 1 - Composable patterns (Select, Modal, etc.)
|
|
225
|
-
├── complex/ # Phase 2 - Heavy library abstractions (DataTable, etc.)
|
|
226
|
-
├── domain/ # Phase 3 - Business-aware components (FieldRenderer, etc.)
|
|
227
|
-
├── utils/ # Shared utilities
|
|
228
|
-
└── styles/ # Design tokens and global styles
|
|
229
|
-
```
|
|
230
|
-
|
|
231
|
-
## Bundle Size
|
|
232
152
|
|
|
233
|
-
|
|
153
|
+
## Accessibility
|
|
234
154
|
|
|
235
|
-
|
|
236
|
-
- **Input**: ~8KB
|
|
237
|
-
- **Checkbox**: ~6KB
|
|
238
|
-
- **Badge**: ~3KB
|
|
239
|
-
- **Avatar**: ~5KB
|
|
240
|
-
- **Icon**: ~2KB (+ Untitled UI icons as needed)
|
|
155
|
+
All components are built with accessibility as a priority:
|
|
241
156
|
|
|
242
|
-
|
|
157
|
+
- WCAG 2.1 AA compliant
|
|
158
|
+
- Full keyboard navigation
|
|
159
|
+
- Screen reader support
|
|
160
|
+
- Proper focus management
|
|
161
|
+
- Semantic HTML
|
|
243
162
|
|
|
244
163
|
## Browser Support
|
|
245
164
|
|
|
@@ -248,28 +167,6 @@ Phase 0 primitives are designed to be lightweight:
|
|
|
248
167
|
- Safari (latest)
|
|
249
168
|
- Edge (latest)
|
|
250
169
|
|
|
251
|
-
## Accessibility
|
|
252
|
-
|
|
253
|
-
All components are built with accessibility in mind:
|
|
254
|
-
|
|
255
|
-
- ✅ WCAG 2.1 AA compliant
|
|
256
|
-
- ✅ Keyboard navigation
|
|
257
|
-
- ✅ Screen reader support
|
|
258
|
-
- ✅ Focus management
|
|
259
|
-
- ✅ Semantic HTML
|
|
260
|
-
|
|
261
170
|
## License
|
|
262
171
|
|
|
263
172
|
MIT
|
|
264
|
-
|
|
265
|
-
## Contributing
|
|
266
|
-
|
|
267
|
-
See `CONTRIBUTING.md` for development guidelines.
|
|
268
|
-
|
|
269
|
-
## Roadmap
|
|
270
|
-
|
|
271
|
-
- **v0.1.0** (Week 1) - Phase 0: Primitives ← YOU ARE HERE
|
|
272
|
-
- **v0.2.0** (Week 2) - Phase 1: Patterns (Select, Modal, DatePicker)
|
|
273
|
-
- **v0.3.0** (Week 3) - Phase 2: Complex (DataTable, RichTextEditor)
|
|
274
|
-
- **v0.4.0** (Week 4) - Phase 3: Domain (FieldRenderer, PermissionGate)
|
|
275
|
-
- **v1.0.0** (Week 4) - Stable release
|