@elsapiens/ui 0.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 ADDED
@@ -0,0 +1,493 @@
1
+ # @elsapiens/ui
2
+
3
+ Comprehensive React UI component library for building modern interfaces.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install @elsapiens/ui @elsapiens/utils @elsapiens/styles
9
+ # or
10
+ pnpm add @elsapiens/ui @elsapiens/utils @elsapiens/styles
11
+ ```
12
+
13
+ ## Features
14
+
15
+ - 50+ production-ready React components
16
+ - TypeScript support with full type definitions
17
+ - Tailwind CSS styling with CSS variables
18
+ - Form integration ready
19
+ - Chart components powered by Recharts
20
+ - Accessible and responsive
21
+
22
+ ## Quick Start
23
+
24
+ ```tsx
25
+ import { Button, Card, CardHeader, CardTitle, CardContent } from '@elsapiens/ui';
26
+ import '@elsapiens/styles';
27
+
28
+ function App() {
29
+ return (
30
+ <Card>
31
+ <CardHeader>
32
+ <CardTitle>Welcome</CardTitle>
33
+ </CardHeader>
34
+ <CardContent>
35
+ <Button>Get Started</Button>
36
+ </CardContent>
37
+ </Card>
38
+ );
39
+ }
40
+ ```
41
+
42
+ ## Components
43
+
44
+ ### Form Components
45
+
46
+ #### Button
47
+
48
+ ```tsx
49
+ import { Button } from '@elsapiens/ui';
50
+
51
+ <Button>Default</Button>
52
+ <Button variant="secondary">Secondary</Button>
53
+ <Button variant="outline">Outline</Button>
54
+ <Button variant="ghost">Ghost</Button>
55
+ <Button variant="destructive">Destructive</Button>
56
+
57
+ <Button size="sm">Small</Button>
58
+ <Button size="lg">Large</Button>
59
+
60
+ <Button loading>Loading...</Button>
61
+ <Button disabled>Disabled</Button>
62
+
63
+ <Button>
64
+ <PlusIcon className="w-4 h-4 mr-2" />
65
+ With Icon
66
+ </Button>
67
+ ```
68
+
69
+ #### Input
70
+
71
+ ```tsx
72
+ import { Input } from '@elsapiens/ui';
73
+
74
+ <Input placeholder="Enter text..." />
75
+ <Input type="email" placeholder="Email" />
76
+ <Input type="password" placeholder="Password" />
77
+ <Input error="This field is required" />
78
+ <Input disabled />
79
+
80
+ // Controlled
81
+ const [value, setValue] = useState('');
82
+ <Input value={value} onChange={(e) => setValue(e.target.value)} />
83
+ ```
84
+
85
+ #### Select
86
+
87
+ ```tsx
88
+ import { Select } from '@elsapiens/ui';
89
+
90
+ <Select
91
+ options={[
92
+ { value: 'apple', label: 'Apple' },
93
+ { value: 'banana', label: 'Banana' },
94
+ { value: 'orange', label: 'Orange' },
95
+ ]}
96
+ value={selected}
97
+ onChange={setSelected}
98
+ placeholder="Select a fruit"
99
+ />
100
+ ```
101
+
102
+ #### SearchableSelect
103
+
104
+ ```tsx
105
+ import { SearchableSelect } from '@elsapiens/ui';
106
+
107
+ <SearchableSelect
108
+ options={users}
109
+ value={selectedUser}
110
+ onChange={setSelectedUser}
111
+ getOptionLabel={(user) => user.name}
112
+ getOptionValue={(user) => user.id}
113
+ placeholder="Search users..."
114
+ />
115
+ ```
116
+
117
+ #### DatePicker
118
+
119
+ ```tsx
120
+ import { DatePicker, DateRangePicker } from '@elsapiens/ui';
121
+
122
+ <DatePicker
123
+ value={date}
124
+ onChange={setDate}
125
+ placeholder="Select date"
126
+ />
127
+
128
+ <DateRangePicker
129
+ value={dateRange}
130
+ onChange={setDateRange}
131
+ placeholder="Select date range"
132
+ />
133
+ ```
134
+
135
+ #### Toggle & Checkbox
136
+
137
+ ```tsx
138
+ import { Toggle, Checkbox, CheckboxGroup } from '@elsapiens/ui';
139
+
140
+ <Toggle checked={enabled} onChange={setEnabled} />
141
+
142
+ <Checkbox
143
+ checked={agreed}
144
+ onChange={setAgreed}
145
+ label="I agree to the terms"
146
+ />
147
+
148
+ <CheckboxGroup
149
+ options={[
150
+ { value: 'email', label: 'Email notifications' },
151
+ { value: 'sms', label: 'SMS notifications' },
152
+ ]}
153
+ value={notifications}
154
+ onChange={setNotifications}
155
+ />
156
+ ```
157
+
158
+ ### Display Components
159
+
160
+ #### Card
161
+
162
+ ```tsx
163
+ import {
164
+ Card,
165
+ CardHeader,
166
+ CardTitle,
167
+ CardDescription,
168
+ CardContent,
169
+ CardFooter,
170
+ } from '@elsapiens/ui';
171
+
172
+ <Card>
173
+ <CardHeader>
174
+ <CardTitle>Card Title</CardTitle>
175
+ <CardDescription>Card description text</CardDescription>
176
+ </CardHeader>
177
+ <CardContent>
178
+ <p>Card content goes here</p>
179
+ </CardContent>
180
+ <CardFooter>
181
+ <Button>Action</Button>
182
+ </CardFooter>
183
+ </Card>
184
+
185
+ // Padding variants
186
+ <Card padding="none">No padding</Card>
187
+ <Card padding="sm">Small padding</Card>
188
+ <Card padding="lg">Large padding</Card>
189
+ ```
190
+
191
+ #### Badge
192
+
193
+ ```tsx
194
+ import { Badge } from '@elsapiens/ui';
195
+
196
+ <Badge>Default</Badge>
197
+ <Badge variant="primary">Primary</Badge>
198
+ <Badge variant="success">Success</Badge>
199
+ <Badge variant="warning">Warning</Badge>
200
+ <Badge variant="error">Error</Badge>
201
+ <Badge variant="info">Info</Badge>
202
+
203
+ <Badge size="sm">Small</Badge>
204
+ <Badge size="lg">Large</Badge>
205
+ ```
206
+
207
+ #### Avatar
208
+
209
+ ```tsx
210
+ import { Avatar, AvatarGroup } from '@elsapiens/ui';
211
+
212
+ <Avatar src="/user.jpg" alt="John Doe" />
213
+ <Avatar src="/user.jpg" size="sm" />
214
+ <Avatar src="/user.jpg" size="lg" />
215
+ <Avatar fallback="JD" />
216
+
217
+ <AvatarGroup max={3}>
218
+ <Avatar src="/user1.jpg" />
219
+ <Avatar src="/user2.jpg" />
220
+ <Avatar src="/user3.jpg" />
221
+ <Avatar src="/user4.jpg" />
222
+ </AvatarGroup>
223
+ ```
224
+
225
+ #### Table
226
+
227
+ ```tsx
228
+ import { Table, Badge } from '@elsapiens/ui';
229
+
230
+ const data = [
231
+ { id: 1, name: 'John', status: 'active' },
232
+ { id: 2, name: 'Jane', status: 'pending' },
233
+ ];
234
+
235
+ <Table
236
+ data={data}
237
+ columns={[
238
+ { key: 'name', header: 'Name' },
239
+ {
240
+ key: 'status',
241
+ header: 'Status',
242
+ render: (item) => (
243
+ <Badge variant={item.status === 'active' ? 'success' : 'warning'}>
244
+ {item.status}
245
+ </Badge>
246
+ ),
247
+ },
248
+ ]}
249
+ striped={false}
250
+ inCard="full"
251
+ cardPadding="lg"
252
+ />
253
+ ```
254
+
255
+ ### Interaction Components
256
+
257
+ #### Modal
258
+
259
+ ```tsx
260
+ import { Modal, Button } from '@elsapiens/ui';
261
+
262
+ const [isOpen, setIsOpen] = useState(false);
263
+
264
+ <Button onClick={() => setIsOpen(true)}>Open Modal</Button>
265
+
266
+ <Modal
267
+ isOpen={isOpen}
268
+ onClose={() => setIsOpen(false)}
269
+ title="Modal Title"
270
+ >
271
+ <p>Modal content goes here</p>
272
+ <div className="flex justify-end gap-2 mt-4">
273
+ <Button variant="outline" onClick={() => setIsOpen(false)}>
274
+ Cancel
275
+ </Button>
276
+ <Button onClick={handleConfirm}>Confirm</Button>
277
+ </div>
278
+ </Modal>
279
+ ```
280
+
281
+ #### Toast
282
+
283
+ ```tsx
284
+ import { ToastProvider, useToast, Button } from '@elsapiens/ui';
285
+
286
+ // Wrap your app
287
+ <ToastProvider>
288
+ <App />
289
+ </ToastProvider>
290
+
291
+ // Use in components
292
+ function MyComponent() {
293
+ const { toast } = useToast();
294
+
295
+ return (
296
+ <Button onClick={() => toast.success('Saved successfully!')}>
297
+ Save
298
+ </Button>
299
+ );
300
+ }
301
+
302
+ // Toast variants
303
+ toast.success('Success message');
304
+ toast.error('Error message');
305
+ toast.warning('Warning message');
306
+ toast.info('Info message');
307
+ ```
308
+
309
+ #### Tooltip
310
+
311
+ ```tsx
312
+ import { Tooltip } from '@elsapiens/ui';
313
+
314
+ <Tooltip content="This is a tooltip">
315
+ <Button>Hover me</Button>
316
+ </Tooltip>
317
+
318
+ <Tooltip content="Bottom tooltip" side="bottom">
319
+ <span>Hover me</span>
320
+ </Tooltip>
321
+ ```
322
+
323
+ ### Chart Components
324
+
325
+ ```tsx
326
+ import {
327
+ LineChart,
328
+ AreaChart,
329
+ BarChart,
330
+ PieChart,
331
+ DonutChart,
332
+ Sparkline,
333
+ TrendSparkline,
334
+ } from '@elsapiens/ui';
335
+
336
+ const data = [
337
+ { month: 'Jan', revenue: 4000, expenses: 2400 },
338
+ { month: 'Feb', revenue: 3000, expenses: 1398 },
339
+ { month: 'Mar', revenue: 2000, expenses: 9800 },
340
+ ];
341
+
342
+ // Line Chart
343
+ <LineChart
344
+ data={data}
345
+ xAxisKey="month"
346
+ lines={[
347
+ { dataKey: 'revenue', name: 'Revenue', color: 'primary' },
348
+ { dataKey: 'expenses', name: 'Expenses', color: 'error' },
349
+ ]}
350
+ height={300}
351
+ showLegend
352
+ />
353
+
354
+ // Area Chart
355
+ <AreaChart
356
+ data={data}
357
+ xAxisKey="month"
358
+ areas={[
359
+ { dataKey: 'revenue', name: 'Revenue', color: 'primary' },
360
+ ]}
361
+ height={300}
362
+ />
363
+
364
+ // Bar Chart
365
+ <BarChart
366
+ data={data}
367
+ xAxisKey="month"
368
+ bars={[
369
+ { dataKey: 'revenue', name: 'Revenue', color: 'primary' },
370
+ ]}
371
+ height={300}
372
+ />
373
+
374
+ // Pie/Donut Chart
375
+ const pieData = [
376
+ { name: 'Direct', value: 400, color: 'primary' },
377
+ { name: 'Organic', value: 300, color: 'success' },
378
+ { name: 'Referral', value: 200, color: 'warning' },
379
+ ];
380
+
381
+ <PieChart data={pieData} height={300} />
382
+ <DonutChart
383
+ data={pieData}
384
+ height={300}
385
+ centerValue="900"
386
+ centerSubtext="Total"
387
+ />
388
+
389
+ // Sparklines (for inline use)
390
+ <Sparkline data={[10, 20, 15, 25, 30]} width={100} height={30} />
391
+ <TrendSparkline data={[10, 20, 15, 25, 30]} type="area" />
392
+ ```
393
+
394
+ ### Loading States
395
+
396
+ ```tsx
397
+ import { Skeleton, SkeletonText, SkeletonCard } from '@elsapiens/ui';
398
+
399
+ // Basic skeleton
400
+ <Skeleton className="h-4 w-full" />
401
+ <Skeleton className="h-10 w-10 rounded-full" />
402
+
403
+ // Text skeleton
404
+ <SkeletonText lines={3} />
405
+
406
+ // Card skeleton
407
+ <SkeletonCard />
408
+ ```
409
+
410
+ ### Tabs & Stepper
411
+
412
+ ```tsx
413
+ import { Tabs, TabsList, TabsTrigger, TabsContent } from '@elsapiens/ui';
414
+
415
+ <Tabs defaultValue="tab1">
416
+ <TabsList>
417
+ <TabsTrigger value="tab1">Tab 1</TabsTrigger>
418
+ <TabsTrigger value="tab2">Tab 2</TabsTrigger>
419
+ </TabsList>
420
+ <TabsContent value="tab1">Content 1</TabsContent>
421
+ <TabsContent value="tab2">Content 2</TabsContent>
422
+ </Tabs>
423
+
424
+ import { Stepper } from '@elsapiens/ui';
425
+
426
+ <Stepper
427
+ steps={[
428
+ { id: 'step1', label: 'Details', status: 'completed' },
429
+ { id: 'step2', label: 'Review', status: 'current' },
430
+ { id: 'step3', label: 'Confirm', status: 'upcoming' },
431
+ ]}
432
+ />
433
+ ```
434
+
435
+ ## Component Reference
436
+
437
+ ### Form Components
438
+ | Component | Description |
439
+ |-----------|-------------|
440
+ | `Button` | Clickable button with variants |
441
+ | `Input` | Text input field |
442
+ | `Textarea` | Multi-line text input |
443
+ | `Select` | Dropdown select |
444
+ | `SearchableSelect` | Select with search |
445
+ | `MultiSelect` | Multiple selection |
446
+ | `Combobox` | Autocomplete input |
447
+ | `DatePicker` | Date selection |
448
+ | `TimePicker` | Time selection |
449
+ | `DateRangePicker` | Date range selection |
450
+ | `NumericInput` | Number input with formatting |
451
+ | `PhoneInput` | Phone number input |
452
+ | `CurrencyInput` | Currency input |
453
+ | `Toggle` | On/off switch |
454
+ | `Checkbox` | Checkbox input |
455
+ | `CheckboxGroup` | Multiple checkboxes |
456
+ | `RadioGroup` | Radio button group |
457
+ | `Slider` | Range slider |
458
+ | `FileUpload` | File upload |
459
+
460
+ ### Display Components
461
+ | Component | Description |
462
+ |-----------|-------------|
463
+ | `Card` | Content container |
464
+ | `Badge` | Status/label badge |
465
+ | `Avatar` | User avatar |
466
+ | `Table` | Data table |
467
+ | `Progress` | Progress bar |
468
+ | `Skeleton` | Loading placeholder |
469
+ | `Tabs` | Tabbed content |
470
+ | `Stepper` | Step indicator |
471
+
472
+ ### Interaction Components
473
+ | Component | Description |
474
+ |-----------|-------------|
475
+ | `Modal` | Dialog modal |
476
+ | `ConfirmDialog` | Confirmation modal |
477
+ | `Toast` | Notification toast |
478
+ | `Tooltip` | Hover tooltip |
479
+ | `Popover` | Positioned popover |
480
+
481
+ ### Chart Components
482
+ | Component | Description |
483
+ |-----------|-------------|
484
+ | `LineChart` | Line/trend chart |
485
+ | `AreaChart` | Area chart |
486
+ | `BarChart` | Bar chart |
487
+ | `PieChart` | Pie chart |
488
+ | `DonutChart` | Donut chart |
489
+ | `Sparkline` | Inline mini chart |
490
+
491
+ ## License
492
+
493
+ MIT